@undefineds.co/xpod 0.4.32 → 0.4.34
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/auth/SolidTokenAuthenticator.d.ts +4 -1
- package/dist/api/auth/SolidTokenAuthenticator.js +43 -25
- package/dist/api/container/common.js +1 -0
- package/dist/api/container/index.js +1 -0
- package/dist/api/container/types.d.ts +2 -0
- package/dist/http/SubgraphSparqlHttpHandler.d.ts +32 -0
- package/dist/http/SubgraphSparqlHttpHandler.js +448 -1
- package/dist/http/SubgraphSparqlHttpHandler.jsonld +36 -0
- package/dist/storage/rdf/QleverSparqlEngine.d.ts +15 -0
- package/dist/storage/rdf/QleverSparqlEngine.js +40 -0
- package/dist/storage/rdf/QleverSparqlEngine.jsonld +8 -0
- package/dist/storage/rdf/RdfAccessScope.d.ts +12 -0
- package/dist/storage/rdf/RdfAccessScope.js +63 -3
- package/dist/storage/rdf/RdfQuerySparqlEngine.d.ts +7 -0
- package/dist/storage/rdf/RdfQuerySparqlEngine.js +30 -0
- package/dist/storage/rdf/RdfQuerySparqlEngine.jsonld +8 -0
- package/dist/storage/rdf/index.d.ts +1 -1
- package/dist/storage/rdf/index.js +6 -2
- package/dist/storage/sparql/SubgraphQueryEngine.d.ts +5 -0
- package/dist/storage/sparql/SubgraphQueryEngine.js +9 -0
- package/dist/storage/sparql/SubgraphQueryEngine.jsonld +16 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiBuiltinProvidersSection.d.ts +32 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiBuiltinProvidersSection.js +8 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +35 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +9 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +32 -6
- package/node_modules/@undefineds.co/ai-connections/dist/index.d.ts +1 -0
- package/node_modules/@undefineds.co/ai-connections/dist/index.js +1 -0
- package/node_modules/@undefineds.co/ai-connections/package.json +2 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/ai-connections-client.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/normalize.d.ts +16 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/normalize.js +80 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/request.js +19 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/contract/client/types.d.ts +31 -0
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/build-provenance.json +4 -4
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/index.json +15 -15
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/javascript/provider-catalog/index.json +2 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/javascript/service-access-resources/index.json +2 -2
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/source/package.json +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/materials/source-inventory.json +11 -11
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/provider-catalog-inputs.json +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/dist/service-access-resources-inputs.json +1 -1
- package/node_modules/@undefineds.co/ai-connections-runtime/package.json +1 -1
- package/node_modules/@undefineds.co/extension-host-contracts/dist/materials/build-provenance.json +1 -1
- package/node_modules/@undefineds.co/extension-host-contracts/dist/materials/index.json +3 -3
- package/node_modules/@undefineds.co/extension-host-contracts/dist/materials/source-inventory.json +1 -1
- package/node_modules/@undefineds.co/xpod-afs/dist/licenses/cli-producer-original-binding.json +1 -1
- package/node_modules/@undefineds.co/xpod-cli/dist/producer-materials/index.json +1 -1
- package/package.json +4 -4
- package/static/dashboard/assets/{AccountAuthBoundary-D2peXpst.js → AccountAuthBoundary-DXBGmvsI.js} +1 -1
- package/static/dashboard/assets/{DesktopOidcCallback-DXWArav6.js → DesktopOidcCallback-p24MYq1P.js} +1 -1
- package/static/dashboard/assets/{DevicePages-BULFk95K.js → DevicePages-DbvhTnse.js} +1 -1
- package/static/dashboard/assets/ModelsPage-UMDnRyLA.js +12 -0
- package/static/dashboard/assets/{PaneListHeader-BSfEbecP.js → PaneListHeader-DkEH0TT_.js} +1 -1
- package/static/dashboard/assets/{PodDeletionAuthorizationPanel-CH-Sx18g.js → PodDeletionAuthorizationPanel-CzrI8Pgw.js} +3 -3
- package/static/dashboard/assets/{PodPage-BMpejIra.js → PodPage-TaiWqMBx.js} +1 -1
- package/static/dashboard/assets/{SystemSettingsPage-H_Jj6WfF.js → SystemSettingsPage-D4gQjDt1.js} +1 -1
- package/static/dashboard/assets/{TasksPage-CTDxlQra.js → TasksPage-CmkiMYil.js} +1 -1
- package/static/dashboard/assets/{WebDesktopEntry-Ch7-0C9a.js → WebDesktopEntry-D9kEfhbz.js} +1 -1
- package/static/dashboard/assets/{XpodAiConnectionsPodStore-ggRE9fmE.js → XpodAiConnectionsPodStore-orY8vQFl.js} +2 -2
- package/static/dashboard/assets/{XpodShellApp-Bwf9UmeJ.js → XpodShellApp-DR65DMOb.js} +4 -4
- package/static/dashboard/assets/{account-session-CVzooxS2.js → account-session-BZ2ttIdq.js} +1 -1
- package/static/dashboard/assets/{button-DGh2QVt2.js → button-_rwfCMMH.js} +1 -1
- package/static/dashboard/assets/{collection-runtime-DwV_9rt2.js → collection-runtime-C74icLtf.js} +1 -1
- package/static/dashboard/assets/{createLucideIcon-yLhAxnfL.js → createLucideIcon-DrgScGhc.js} +1 -1
- package/static/dashboard/assets/{dashboard-xbXlitKr.js → dashboard--DWjqkYt.js} +2 -2
- package/static/dashboard/assets/{index-CMigfjqD.js → index-D6dB-UNq.js} +1 -1
- package/static/dashboard/assets/{index-BSiKqEdo.js → index-dx5sc4rE.js} +1 -1
- package/static/dashboard/assets/{label-CrDv_y1q.js → label-D02Jpvm9.js} +1 -1
- package/static/dashboard/assets/{list-BJM0nqti.js → list-DpFAisnq.js} +1 -1
- package/static/dashboard/assets/{nav-item-style-CQbGyYLb.js → nav-item-style-B1-0JkON.js} +1 -1
- package/static/dashboard/assets/{safe-continuation-ZTBQTFWB.js → safe-continuation-DUTIOFe5.js} +1 -1
- package/static/dashboard/assets/{section-header-CWHRWGXl.js → section-header-CtBnllbG.js} +1 -1
- package/static/dashboard/assets/{setting-row-qWtxYGK1.js → setting-row-D_JPuHAJ.js} +1 -1
- package/static/dashboard/assets/{xpod-remembered-login-DPMxurVN.js → xpod-remembered-login-CtmMI8xG.js} +3 -3
- package/static/dashboard/dashboard.html +1 -1
- package/static/settings/assets/{AccountAuthBoundary-4Ywjpb8o.js → AccountAuthBoundary-njIhHpLf.js} +1 -1
- package/static/settings/assets/{DesktopOidcCallback-CAmwMT_J.js → DesktopOidcCallback-BjjNwTxc.js} +1 -1
- package/static/settings/assets/{DevicePages-DvuHyfHo.js → DevicePages-FFJMu_zL.js} +1 -1
- package/static/settings/assets/ModelsPage-6567dZKQ.js +12 -0
- package/static/settings/assets/{PaneListHeader-CuFgIbhe.js → PaneListHeader-CuPah5aC.js} +1 -1
- package/static/settings/assets/{PodDeletionAuthorizationPanel-DdNgDHH5.js → PodDeletionAuthorizationPanel-aJCKasGz.js} +3 -3
- package/static/settings/assets/{PodPage-DnWCNGTO.js → PodPage-BA0DQ3AB.js} +1 -1
- package/static/settings/assets/{SystemSettingsPage-k9P_wQcl.js → SystemSettingsPage-BNPH4VWf.js} +1 -1
- package/static/settings/assets/{TasksPage-Dk7gUH3J.js → TasksPage-B5m82wjD.js} +1 -1
- package/static/settings/assets/{WebDesktopEntry-DJwPVVnU.js → WebDesktopEntry-DgwwIUhg.js} +1 -1
- package/static/settings/assets/{XpodAiConnectionsPodStore-BtJQiJsx.js → XpodAiConnectionsPodStore-BJm-rFPs.js} +2 -2
- package/static/settings/assets/{XpodShellApp-B47vEQJp.js → XpodShellApp-BwvekJJR.js} +4 -4
- package/static/settings/assets/{XpodThemeProvider-Ciuwo_yl.js → XpodThemeProvider-DyX0rUID.js} +2 -2
- package/static/settings/assets/{account-session-CMc10iEj.js → account-session-D6vibAra.js} +1 -1
- package/static/settings/assets/auth-callback-DXxmF0-p.js +1 -0
- package/static/settings/assets/{button-D1dGKY1f.js → button-CV4KJ59A.js} +1 -1
- package/static/settings/assets/{collection-runtime-hK37-47o.js → collection-runtime-CARp4Cii.js} +1 -1
- package/static/settings/assets/{createLucideIcon-nEiQH43b.js → createLucideIcon-BIwq0vQx.js} +1 -1
- package/static/settings/assets/{index-DNdvma6J.js → index-D-LgcKAb.js} +1 -1
- package/static/settings/assets/{label-C3EGk_2E.js → label-CFTl2bC_.js} +1 -1
- package/static/settings/assets/{list-BensBGZp.js → list-D2aO7Nu-.js} +1 -1
- package/static/settings/assets/{nav-item-style-BOKCPNz8.js → nav-item-style-BKpK5_1m.js} +1 -1
- package/static/settings/assets/{safe-continuation-BPwW6jdq.js → safe-continuation-DRRY_t4F.js} +1 -1
- package/static/settings/assets/{section-header-DOSj5RvJ.js → section-header-COECjyL5.js} +1 -1
- package/static/settings/assets/{setting-row-C9k4cGNM.js → setting-row-cGgL78vR.js} +1 -1
- package/static/settings/assets/{settings-DtP5C8hi.js → settings-Bvrm5N-k.js} +1 -1
- package/static/settings/assets/{xpod-remembered-login-DKFG-zi3.js → xpod-remembered-login-YAmn8ZiP.js} +3 -3
- package/static/settings/auth-callback.html +2 -2
- package/static/settings/settings.html +2 -2
- package/static/dashboard/assets/ModelsPage-xvsVzhGZ.js +0 -12
- package/static/settings/assets/ModelsPage-BDXqetwk.js +0 -12
- package/static/settings/assets/auth-callback-fcOBaX2w.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as o,p as s}from"./xpod-remembered-login-
|
|
1
|
+
import{s as o,p as s}from"./xpod-remembered-login-CtmMI8xG.js";import{C as u,P as C,a as p,b as P,c as S,d as g,e as c,f as h,g as b,h as T,i as j,S as v,j as x,k as B,l as f,m as I,n as y,o as A,q as D,r as O,t as V,u as k,v as q,w,x as z,y as J,z as N,A as U,B as E,D as F}from"./xpod-remembered-login-CtmMI8xG.js";import"./createLucideIcon-DrgScGhc.js";import"./dashboard--DWjqkYt.js";import"./button-_rwfCMMH.js";import"./PodDeletionAuthorizationPanel-CzrI8Pgw.js";import"./account-session-BZ2ttIdq.js";import"@comunica/query-sparql-solid";export{u as ColumnBuilder,C as PodArrayColumn,p as PodBooleanColumn,P as PodColumnBase,S as PodDateTimeColumn,g as PodIntegerColumn,c as PodJsonColumn,h as PodObjectColumn,b as PodStringColumn,T as PodTable,j as PodUriColumn,v as SolidSchema,x as boolean,B as date,f as generateNanoId,I as hasStringValue,y as hasTermValue,A as id,D as integer,O as isSolidSchema,V as json,k as mergeSchemaColumns,q as object,s as podTable,w as real,z as resolveTermIri,J as solidSchema,o as string,N as text,U as timestamp,E as uri,F as validateColumnOverride};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as m,D as R,T as j,N as B}from"./XpodShellApp-
|
|
1
|
+
import{n as m,D as R,T as j,N as B}from"./XpodShellApp-DR65DMOb.js";import{B as W,d as z,e as H,L as V,f as Z,Q as X,Q as Y,V as J}from"./XpodShellApp-DR65DMOb.js";import"./dashboard--DWjqkYt.js";import"./xpod-remembered-login-CtmMI8xG.js";import"./createLucideIcon-DrgScGhc.js";import"./button-_rwfCMMH.js";import"./PodDeletionAuthorizationPanel-CzrI8Pgw.js";import"./account-session-BZ2ttIdq.js";import"@comunica/query-sparql-solid";import"./safe-continuation-DUTIOFe5.js";import"./nav-item-style-B1-0JkON.js";function O(a){return!!a&&a.termType==="DefaultGraph"}function f(a){return a.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const P=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,T=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,g="./",Q="../",p="?",$="#";class b{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!P.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!b.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",f(e)],i=[],s=[],r=/[^/?#]*([/?#])/y;let n,h=0,u=0,o=r.lastIndex=e.length;for(;!h&&!u&&(n=r.exec(this.base));)n[1]===$?u=r.lastIndex-1:(t.push(f(n[0]),"(?:"),i.push(")?"),n[1]!==p?s.push(o=r.lastIndex):(h=o=r.lastIndex,u=this.base.indexOf($,h),this._pathReplacements[h]=p));for(let _=0;_<s.length;_++)this._pathReplacements[s[_]]=Q.repeat(s.length-_-1);return this._pathReplacements[s[s.length-1]]=g,this._baseLength=u>0?u:this.base.length,t.push(f(this.base.substring(o,this._baseLength)),h?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...i].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const i=t[0].length;if(i===this._baseLength&&i===e.length)return"";const s=this._pathReplacements[i];if(s){const r=e.substring(i);return s!==p&&!T.test(r)?e:s===g&&/^[^?#]/.test(r)?r:s+r}return e.substring(i-1)}}const c=R.defaultGraph(),{rdf:S,xsd:l}=m,x=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,w=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,k={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class d extends j{equals(e){return e===this}}class U{constructor(e,t){if(this._prefixRegex=/$0^/,e&&typeof e.write!="function"&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=t.end===void 0?!0:!!t.end;else{let i="";this._outputStream={write(s,r,n){i+=s,n&&n()},end:s=>{s&&s(null,i)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=c,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new b(t.baseIRI)))}get _inDefaultGraph(){return c.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,i,s,r){try{s.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
|
|
2
2
|
`:`
|
|
3
3
|
}
|
|
4
4
|
`)+(c.equals(s)?"":`${this._encodeIriOrBlank(s)} {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,j as o}from"./dashboard
|
|
1
|
+
import{r as t,j as o}from"./dashboard--DWjqkYt.js";import{c as s}from"./button-_rwfCMMH.js";const m=t.forwardRef(({className:e,...a},r)=>o.jsx("label",{ref:r,className:s("text-sm font-medium leading-none text-muted-foreground",e),...a}));m.displayName="Label";export{m as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,j as s}from"./dashboard
|
|
1
|
+
import{r as d,j as s}from"./dashboard--DWjqkYt.js";import{S as m,c}from"./button-_rwfCMMH.js";const u=d.forwardRef(({className:o,asChild:e=!1,children:r,...a},l)=>{const n=e?m:"div";return s.jsx(n,{ref:l,className:c("divide-y rounded-xl border border-border bg-card",o),...a,children:r})});u.displayName="ListSurface";const j=d.forwardRef(({className:o,leading:e,title:r,description:a,trailing:l,asChild:n=!1,children:t,...i},x)=>{const f=c("flex flex-wrap items-center gap-3 p-4 text-sm leading-normal",o),p=n?m:"div";return s.jsx(p,{ref:x,className:f,...i,children:n?t:s.jsxs(s.Fragment,{children:[e?s.jsx("span",{className:"shrink-0",children:e}):null,s.jsxs("div",{className:"min-w-0 flex-1 break-words",children:[r?s.jsx("div",{children:r}):null,a?s.jsx("p",{className:"mt-0.5 text-xs leading-normal text-muted-foreground",children:a}):null]}),l?s.jsx("span",{className:"shrink-0",children:l}):null,t?s.jsx("div",{className:"w-full min-w-0 break-words",children:t}):null]})})});j.displayName="ListRow";export{u as L,j as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as B}from"./createLucideIcon-yLhAxnfL.js";import{r as o,j as l}from"./dashboard-xbXlitKr.js";import{c as g}from"./button-DGh2QVt2.js";const V=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],de=B("database",V);function fe(e){if(!R(e))throw new Error("Applet layout descriptor must be an object");if(typeof e.type!="string")throw new Error("Applet layout descriptor type must be a string");switch(e.type){case"single-pane":case"two-pane":return P(e.context),e;case"three-pane":return P(e.context),e;default:throw new Error(`Unsupported applet layout type: ${e.type}`)}}function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function P(e){if(e!==void 0){if(!R(e))throw new Error("Applet layout descriptor context must be an object");if("collapsible"in e&&typeof e.collapsible!="boolean")throw new Error("Applet layout descriptor context.collapsible must be a boolean");if("initiallyCollapsed"in e&&typeof e.initiallyCollapsed!="boolean")throw new Error("Applet layout descriptor context.initiallyCollapsed must be a boolean")}}const G=184,p={narrow:768,wideObjects:1100};function K(e){const{pageType:t,contentWidth:n}=e,a=e.hasObjectCollection===!0;if(!Number.isFinite(n)||n<=0)throw new Error("Applet pane plan needs a positive contentWidth");return n<p.narrow?{pageType:t,navigation:"task-bar",panes:"single",showObjectColumn:!1}:n>=p.wideObjects&&t==="collection"&&a?{pageType:t,navigation:"rail",panes:"list-detail",showObjectColumn:!0}:{pageType:t,navigation:"rail",panes:t==="collection"&&n<p.wideObjects?"stack":"single",showObjectColumn:!1}}const D=o.createContext(null);function pe(){const e=o.useContext(D);if(!e)throw new Error("useWorkspaceLayout must be used inside TwoPaneLayout");return e}const Q=o.createContext(void 0),N="(max-width: 767px)",X={gridTemplateColumns:"210px minmax(0, 1fr)"};function Y(e){return e==="context"?"main":e}function I(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(N);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function U(){return typeof window>"u"||typeof window.matchMedia!="function"?"split":window.matchMedia(N).matches?"stack":"split"}function F(){return"split"}function z(e){const t=o.useSyncExternalStore(I,U,F);return e==="auto"?t:e}const T=`(min-width: ${p.wideObjects+G}px)`;function J(){return o.useSyncExternalStore(e=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(T);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>typeof window>"u"||typeof window.matchMedia!="function"?!0:window.matchMedia(T).matches,()=>!0)}function q(e){const t=o.useSyncExternalStore(I,U,F)==="stack",a=J()?p.wideObjects:t?p.narrow-1:p.narrow,r=K({pageType:e.pageType,contentWidth:a,hasObjectCollection:e.hasObjectCollection}),i=r.panes==="list-detail"?"split":"stack";return{resolvedMode:e.mode==="auto"?i:e.mode,showObjectColumn:r.showObjectColumn}}function Z({resolvedMode:e,history:t,resolvePane:n}){const[a,r]=o.useState("list"),i=o.useRef(null),x=o.useRef(null),k=o.useRef(null),y=o.useRef(null),m=o.useMemo(()=>({list:x,main:k,context:y}),[]),s=o.useCallback((c,f={})=>{const w=n?.(c)??c;r(w),e==="stack"&&(i.current=w,f.fromHistory||t?.push(w))},[t,n,e]),j=o.useCallback(()=>s("list"),[s]),v=o.useCallback(()=>s("main"),[s]),u=o.useCallback(()=>s("context"),[s]);return o.useLayoutEffect(()=>{if(e!=="stack"){i.current=null;return}const c=i.current;c&&(i.current=null,m[c].current?.focus())},[a,m,e]),o.useLayoutEffect(()=>{if(!(e!=="stack"||!t))return t.subscribe(c=>{s(c,{fromHistory:!0})})},[t,s,e]),{activePane:a,paneRefs:m,openList:j,openMain:v,openContext:u}}function he({listHeader:e,list:t,mainHeader:n,main:a,mode:r="auto",history:i,copy:x,className:k,pageType:y="collection",hasObjectCollection:m=!0}){const s=o.useContext(Q),{resolvedMode:j}=q({mode:r,pageType:y,hasObjectCollection:m}),v=z(r),u=s?v:j,c=y==="collection"&&m,{activePane:f,paneRefs:w,openList:C,openMain:A,openContext:S}=Z({resolvedMode:u,history:i,resolvePane:Y}),L=s?.onClose,O=o.useCallback(()=>{A(),L?.()},[A,L]),H=o.useMemo(()=>({mode:u,activePane:f,openList:C,openMain:O,openContext:S}),[f,S,C,O,u]),d=c&&u==="stack",M=!c||(s?u==="stack"&&!s.open:d&&f!=="list"),E=!s&&d&&f!=="main";return l.jsx(D.Provider,{value:H,children:l.jsx("section",{className:g("flex min-h-0 flex-1 flex-col bg-background",k),"data-workspace-layout":"two-pane","data-workspace-mode":u,children:l.jsxs("div",{className:g("grid min-h-0 flex-1",d||!c?"grid-cols-1":null),style:d||!c?void 0:X,"data-workspace-layout-mode":r,"data-workspace-object-column":c&&u==="split"?"shown":"hidden","data-workspace-active-pane":f,children:[l.jsxs("aside",{ref:w.list,className:g("min-h-0 flex-col overflow-hidden bg-layout-list-item @container",M?"hidden":"flex",d?"border-r-0":"border-r border-border"),"data-testid":"workspace-list-pane","data-workspace-pane":"list",hidden:M,tabIndex:d?-1:void 0,children:[l.jsx("header",{className:"h-12 shrink-0 border-b border-border bg-layout-list-header","data-workspace-list-header":"true",children:e}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:t})]}),l.jsxs("main",{ref:w.main,className:g("min-h-0 flex-col overflow-hidden bg-layout-content @container",E?"hidden":"flex"),"data-testid":"workspace-main-pane","data-workspace-pane":"main",hidden:E,inert:s?.open&&u==="stack"?!0:void 0,tabIndex:d?-1:void 0,children:[l.jsxs("header",{className:g("h-12 shrink-0 border-b border-border bg-layout-content",s?.headerLeading&&"flex min-w-0 items-center"),"data-workspace-main-header":"true",children:[s?.headerLeading?l.jsx("div",{className:"flex h-full shrink-0 items-center md:hidden","data-workspace-header-leading":!0,children:s.headerLeading}):null,s?.headerLeading?l.jsx("div",{className:"h-full min-w-0 flex-1",children:n}):n]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[d&&!s?l.jsx("button",{type:"button",className:"inline-flex items-center px-4 py-3 text-sm text-muted-foreground hover:text-foreground",onClick:C,children:x?.backToList??"返回列表"}):null,a]})]})]})})})}const h="/api/admin";async function ee(e={}){try{const t=await fetch(`${h}/status`,{signal:e.signal});if(t.ok)return await t.json()}catch(t){console.error("Failed to get admin status:",t)}return null}async function te(e={}){try{const t=await fetch(`${h}/config`,{signal:e.signal});if(t.ok)return await t.json()}catch(t){console.error("Failed to get admin config:",t)}return null}async function ne(e,t={}){try{const n=e?"?baseUrl="+encodeURIComponent(e):"",a=await fetch(h+"/public-ip"+n,{signal:t.signal});if(a.ok)return await a.json()}catch(n){console.error("Failed to get public ip check:",n)}return null}async function me(e){try{return(await fetch(`${h}/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:e})})).ok}catch(t){return console.error("Failed to update admin config:",t),!1}}async function we(){try{return(await fetch(`${h}/restart`,{method:"POST"})).ok}catch(e){return console.error("Failed to trigger restart:",e),!1}}async function ae(e={}){try{const t=await fetch("/service/status",{signal:e.signal});if(t.ok){const n=await t.json();if(Array.isArray(n))return n}}catch(t){console.error("Failed to get gateway status:",t)}return null}async function ge(e){try{const t=new URLSearchParams;e?.limit&&t.set("limit",e.limit.toString()),e?.level&&e.level!=="all"&&t.set("level",e.level),e?.source&&e.source!=="all"&&t.set("source",e.source);const n=t.toString(),a=n?`?${n}`:"";let r=await fetch(`/service/logs${a}`);if((r.status===404||r.status===405)&&(r=await fetch(`${h}/logs${a}`)),r.ok){const i=await r.json();return Array.isArray(i)?i:i.logs??[]}}catch(t){console.error("Failed to get logs:",t)}return[]}function oe(e){return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}/`:""}function re(e,t,n=""){return t?.baseUrl||oe(t?.fqdn)||e.CSS_BASE_URL||n}async function se(e={}){try{const t=await fetch(`${h}/ddns`,{signal:e.signal});if(t.ok)return await t.json()}catch(t){console.error("Failed to get ddns status:",t)}return null}async function ye(e={}){try{const t=await fetch("/provision/status",{signal:e.signal,credentials:"include",headers:{accept:"application/json"}});if(!t.ok)return null;const n=await t.json();return{registered:n.registered===!0,managed:n.managed===!0,nodeId:b(n.nodeId),cloudUrl:b(n.cloudUrl),serviceProviderDomain:b(n.spDomain),publicUrl:b(n.publicUrl)}}catch(t){return console.error("Failed to get provision status:",t),null}}function b(e){return typeof e=="string"&&e.length>0?e:null}async function be(e={}){const[t,n,a,r]=await Promise.all([ae(e),ee(e),te(e),se(e)]),i=await ne(re(a?.env??{},r),e);return{servicesData:t,adminData:n,configData:a,ddnsData:r,publicCheck:i,checkedAt:new Date}}function xe(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;const t=e.currentTarget.closest("[data-list-navigation]")??e.currentTarget.closest("nav");if(!t)return;const n=[...t.querySelectorAll('a[href]:not([aria-disabled="true"])')],a=n.indexOf(e.currentTarget);if(a<0||n.length===0)return;e.preventDefault();const r=e.key==="Home"?0:e.key==="End"?n.length-1:e.key==="ArrowDown"?(a+1)%n.length:(a-1+n.length)%n.length;n[r]?.focus()}const $="rounded-lg transition-colors",W="text-foreground hover:bg-accent/60",_="focus:outline-none focus:ring-0 focus-visible:bg-accent/70";function ke(e){return[$,_,e?"bg-accent text-accent-foreground":`text-foreground ${W}`,"relative flex h-[40px] w-[40px] items-center justify-center rounded-lg"].join(" ")}function je(e,t){const n=t?.compact===!0;return[$,_,e?"bg-accent text-accent-foreground":"",n?"rounded-lg px-2 py-2":"rounded-lg px-3 py-2.5","mx-2 flex items-center gap-3 text-sm transition-colors",e?"font-medium":`${W} text-foreground`].join(" ")}export{de as D,he as T,Q as W,se as a,je as b,ge as c,te as d,me as e,be as f,ye as g,xe as h,ne as i,ke as j,fe as k,D as l,we as t,pe as u};
|
|
1
|
+
import{c as B}from"./createLucideIcon-DrgScGhc.js";import{r as o,j as l}from"./dashboard--DWjqkYt.js";import{c as g}from"./button-_rwfCMMH.js";const V=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],de=B("database",V);function fe(e){if(!R(e))throw new Error("Applet layout descriptor must be an object");if(typeof e.type!="string")throw new Error("Applet layout descriptor type must be a string");switch(e.type){case"single-pane":case"two-pane":return P(e.context),e;case"three-pane":return P(e.context),e;default:throw new Error(`Unsupported applet layout type: ${e.type}`)}}function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function P(e){if(e!==void 0){if(!R(e))throw new Error("Applet layout descriptor context must be an object");if("collapsible"in e&&typeof e.collapsible!="boolean")throw new Error("Applet layout descriptor context.collapsible must be a boolean");if("initiallyCollapsed"in e&&typeof e.initiallyCollapsed!="boolean")throw new Error("Applet layout descriptor context.initiallyCollapsed must be a boolean")}}const G=184,p={narrow:768,wideObjects:1100};function K(e){const{pageType:t,contentWidth:n}=e,a=e.hasObjectCollection===!0;if(!Number.isFinite(n)||n<=0)throw new Error("Applet pane plan needs a positive contentWidth");return n<p.narrow?{pageType:t,navigation:"task-bar",panes:"single",showObjectColumn:!1}:n>=p.wideObjects&&t==="collection"&&a?{pageType:t,navigation:"rail",panes:"list-detail",showObjectColumn:!0}:{pageType:t,navigation:"rail",panes:t==="collection"&&n<p.wideObjects?"stack":"single",showObjectColumn:!1}}const D=o.createContext(null);function pe(){const e=o.useContext(D);if(!e)throw new Error("useWorkspaceLayout must be used inside TwoPaneLayout");return e}const Q=o.createContext(void 0),N="(max-width: 767px)",X={gridTemplateColumns:"210px minmax(0, 1fr)"};function Y(e){return e==="context"?"main":e}function I(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(N);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function U(){return typeof window>"u"||typeof window.matchMedia!="function"?"split":window.matchMedia(N).matches?"stack":"split"}function F(){return"split"}function z(e){const t=o.useSyncExternalStore(I,U,F);return e==="auto"?t:e}const T=`(min-width: ${p.wideObjects+G}px)`;function J(){return o.useSyncExternalStore(e=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(T);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>typeof window>"u"||typeof window.matchMedia!="function"?!0:window.matchMedia(T).matches,()=>!0)}function q(e){const t=o.useSyncExternalStore(I,U,F)==="stack",a=J()?p.wideObjects:t?p.narrow-1:p.narrow,r=K({pageType:e.pageType,contentWidth:a,hasObjectCollection:e.hasObjectCollection}),i=r.panes==="list-detail"?"split":"stack";return{resolvedMode:e.mode==="auto"?i:e.mode,showObjectColumn:r.showObjectColumn}}function Z({resolvedMode:e,history:t,resolvePane:n}){const[a,r]=o.useState("list"),i=o.useRef(null),x=o.useRef(null),k=o.useRef(null),y=o.useRef(null),m=o.useMemo(()=>({list:x,main:k,context:y}),[]),s=o.useCallback((c,f={})=>{const w=n?.(c)??c;r(w),e==="stack"&&(i.current=w,f.fromHistory||t?.push(w))},[t,n,e]),j=o.useCallback(()=>s("list"),[s]),v=o.useCallback(()=>s("main"),[s]),u=o.useCallback(()=>s("context"),[s]);return o.useLayoutEffect(()=>{if(e!=="stack"){i.current=null;return}const c=i.current;c&&(i.current=null,m[c].current?.focus())},[a,m,e]),o.useLayoutEffect(()=>{if(!(e!=="stack"||!t))return t.subscribe(c=>{s(c,{fromHistory:!0})})},[t,s,e]),{activePane:a,paneRefs:m,openList:j,openMain:v,openContext:u}}function he({listHeader:e,list:t,mainHeader:n,main:a,mode:r="auto",history:i,copy:x,className:k,pageType:y="collection",hasObjectCollection:m=!0}){const s=o.useContext(Q),{resolvedMode:j}=q({mode:r,pageType:y,hasObjectCollection:m}),v=z(r),u=s?v:j,c=y==="collection"&&m,{activePane:f,paneRefs:w,openList:C,openMain:A,openContext:S}=Z({resolvedMode:u,history:i,resolvePane:Y}),L=s?.onClose,O=o.useCallback(()=>{A(),L?.()},[A,L]),H=o.useMemo(()=>({mode:u,activePane:f,openList:C,openMain:O,openContext:S}),[f,S,C,O,u]),d=c&&u==="stack",M=!c||(s?u==="stack"&&!s.open:d&&f!=="list"),E=!s&&d&&f!=="main";return l.jsx(D.Provider,{value:H,children:l.jsx("section",{className:g("flex min-h-0 flex-1 flex-col bg-background",k),"data-workspace-layout":"two-pane","data-workspace-mode":u,children:l.jsxs("div",{className:g("grid min-h-0 flex-1",d||!c?"grid-cols-1":null),style:d||!c?void 0:X,"data-workspace-layout-mode":r,"data-workspace-object-column":c&&u==="split"?"shown":"hidden","data-workspace-active-pane":f,children:[l.jsxs("aside",{ref:w.list,className:g("min-h-0 flex-col overflow-hidden bg-layout-list-item @container",M?"hidden":"flex",d?"border-r-0":"border-r border-border"),"data-testid":"workspace-list-pane","data-workspace-pane":"list",hidden:M,tabIndex:d?-1:void 0,children:[l.jsx("header",{className:"h-12 shrink-0 border-b border-border bg-layout-list-header","data-workspace-list-header":"true",children:e}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:t})]}),l.jsxs("main",{ref:w.main,className:g("min-h-0 flex-col overflow-hidden bg-layout-content @container",E?"hidden":"flex"),"data-testid":"workspace-main-pane","data-workspace-pane":"main",hidden:E,inert:s?.open&&u==="stack"?!0:void 0,tabIndex:d?-1:void 0,children:[l.jsxs("header",{className:g("h-12 shrink-0 border-b border-border bg-layout-content",s?.headerLeading&&"flex min-w-0 items-center"),"data-workspace-main-header":"true",children:[s?.headerLeading?l.jsx("div",{className:"flex h-full shrink-0 items-center md:hidden","data-workspace-header-leading":!0,children:s.headerLeading}):null,s?.headerLeading?l.jsx("div",{className:"h-full min-w-0 flex-1",children:n}):n]}),l.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[d&&!s?l.jsx("button",{type:"button",className:"inline-flex items-center px-4 py-3 text-sm text-muted-foreground hover:text-foreground",onClick:C,children:x?.backToList??"返回列表"}):null,a]})]})]})})})}const h="/api/admin";async function ee(e={}){try{const t=await fetch(`${h}/status`,{signal:e.signal});if(t.ok)return await t.json()}catch(t){console.error("Failed to get admin status:",t)}return null}async function te(e={}){try{const t=await fetch(`${h}/config`,{signal:e.signal});if(t.ok)return await t.json()}catch(t){console.error("Failed to get admin config:",t)}return null}async function ne(e,t={}){try{const n=e?"?baseUrl="+encodeURIComponent(e):"",a=await fetch(h+"/public-ip"+n,{signal:t.signal});if(a.ok)return await a.json()}catch(n){console.error("Failed to get public ip check:",n)}return null}async function me(e){try{return(await fetch(`${h}/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:e})})).ok}catch(t){return console.error("Failed to update admin config:",t),!1}}async function we(){try{return(await fetch(`${h}/restart`,{method:"POST"})).ok}catch(e){return console.error("Failed to trigger restart:",e),!1}}async function ae(e={}){try{const t=await fetch("/service/status",{signal:e.signal});if(t.ok){const n=await t.json();if(Array.isArray(n))return n}}catch(t){console.error("Failed to get gateway status:",t)}return null}async function ge(e){try{const t=new URLSearchParams;e?.limit&&t.set("limit",e.limit.toString()),e?.level&&e.level!=="all"&&t.set("level",e.level),e?.source&&e.source!=="all"&&t.set("source",e.source);const n=t.toString(),a=n?`?${n}`:"";let r=await fetch(`/service/logs${a}`);if((r.status===404||r.status===405)&&(r=await fetch(`${h}/logs${a}`)),r.ok){const i=await r.json();return Array.isArray(i)?i:i.logs??[]}}catch(t){console.error("Failed to get logs:",t)}return[]}function oe(e){return e?e.startsWith("http://")||e.startsWith("https://")?e:`https://${e}/`:""}function re(e,t,n=""){return t?.baseUrl||oe(t?.fqdn)||e.CSS_BASE_URL||n}async function se(e={}){try{const t=await fetch(`${h}/ddns`,{signal:e.signal});if(t.ok)return await t.json()}catch(t){console.error("Failed to get ddns status:",t)}return null}async function ye(e={}){try{const t=await fetch("/provision/status",{signal:e.signal,credentials:"include",headers:{accept:"application/json"}});if(!t.ok)return null;const n=await t.json();return{registered:n.registered===!0,managed:n.managed===!0,nodeId:b(n.nodeId),cloudUrl:b(n.cloudUrl),serviceProviderDomain:b(n.spDomain),publicUrl:b(n.publicUrl)}}catch(t){return console.error("Failed to get provision status:",t),null}}function b(e){return typeof e=="string"&&e.length>0?e:null}async function be(e={}){const[t,n,a,r]=await Promise.all([ae(e),ee(e),te(e),se(e)]),i=await ne(re(a?.env??{},r),e);return{servicesData:t,adminData:n,configData:a,ddnsData:r,publicCheck:i,checkedAt:new Date}}function xe(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;const t=e.currentTarget.closest("[data-list-navigation]")??e.currentTarget.closest("nav");if(!t)return;const n=[...t.querySelectorAll('a[href]:not([aria-disabled="true"])')],a=n.indexOf(e.currentTarget);if(a<0||n.length===0)return;e.preventDefault();const r=e.key==="Home"?0:e.key==="End"?n.length-1:e.key==="ArrowDown"?(a+1)%n.length:(a-1+n.length)%n.length;n[r]?.focus()}const $="rounded-lg transition-colors",W="text-foreground hover:bg-accent/60",_="focus:outline-none focus:ring-0 focus-visible:bg-accent/70";function ke(e){return[$,_,e?"bg-accent text-accent-foreground":`text-foreground ${W}`,"relative flex h-[40px] w-[40px] items-center justify-center rounded-lg"].join(" ")}function je(e,t){const n=t?.compact===!0;return[$,_,e?"bg-accent text-accent-foreground":"",n?"rounded-lg px-2 py-2":"rounded-lg px-3 py-2.5","mx-2 flex items-center gap-3 text-sm transition-colors",e?"font-medium":`${W} text-foreground`].join(" ")}export{de as D,he as T,Q as W,se as a,je as b,ge as c,te as d,me as e,be as f,ye as g,xe as h,ne as i,ke as j,fe as k,D as l,we as t,pe as u};
|
package/static/dashboard/assets/{safe-continuation-ZTBQTFWB.js → safe-continuation-DUTIOFe5.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as $t}from"./dashboard-xbXlitKr.js";import{r as bt,g as J,b as Gt,c as Y,s as ct,d as yt,A as Wt}from"./account-session-CVzooxS2.js";const Xt="Cloud storage is not ready. Please wait for Xpod to reconnect and try again.",Et=new WeakMap;function it(){typeof window<"u"&&Et.delete(window)}function Jt(t){typeof window<"u"&&Et.set(window,t)}function Yt(t){try{sessionStorage.setItem("provisionCode",t)}catch{}}async function gn(t){const n=kt(t.accountIndex);if(!n)return;const e=ut(t);let o;try{o=await e(n,{headers:{accept:"application/json"},credentials:"omit"})}catch{return}if(!o.ok)return;const f=(await o.json().catch(()=>{}))?.controls?.account?.clientCredentials;if(typeof f!="string"||!f)return;const l=await bt(f,e,n);if(!l)return;const w=new URL(l,n);return w.origin===new URL(n).origin&&w.pathname.startsWith("/.account/")&&!w.username&&!w.password&&!w.hash?{collection:l,webId:t.webId}:void 0}function ut(t){const n=kt(t.accountIndex);return async(e,o)=>{if(t.assertCurrent?.(),!n)throw new Error("Invalid session Account authority");const s=new Headers(e instanceof Request?e.headers:void 0);new Headers(o?.headers).forEach((z,y)=>s.set(y,z)),/^CSS-Account-Token(?:\s|$)/iu.test(s.get("authorization")??"")&&s.delete("authorization");const f={...o,headers:s,credentials:"omit",redirect:"error"},l=new URL(e instanceof Request?e.url:String(e));if(l.origin!==new URL(n).origin||!l.pathname.startsWith("/.account/")||l.username||l.password||l.hash)throw new Error("Session Account request leaves the trusted authority");const w=new Request(e,f),p=e instanceof Request?await t.fetch(w):await t.fetch(w.url,f);try{t.assertCurrent?.()}catch(z){throw p.body?.cancel().catch(()=>{}),z}return p}}function kt(t){try{const n=new URL(t);return!["http:","https:"].includes(n.protocol)||n.username||n.password||n.pathname!=="/.account/"||n.search||n.hash?void 0:n.href}catch{return}}const B="/.account/";function Vt(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}async function mt(t=fetch){if(typeof window>"u")return B;if(!Qt(window.location.hostname)){const o=window.__XPOD__?.idpIndex;if(o!==void 0){try{const s=new URL(o,window.location.origin);if(typeof o=="string"&&o.trim()&&["http:","https:"].includes(s.protocol)&&s.pathname===B&&!s.username&&!s.password&&!s.search&&!s.hash)return it(),s.href}catch{}throw new Error("Server bootstrap did not expose a valid Account index")}}const n=await t(new URL("/provision/status",window.location.origin),{credentials:"include",headers:{accept:"application/json"}});if(n.status===404)return it(),new URL(B,window.location.origin).href;if(!n.ok)throw new Error(`Local provisioning status request failed (${n.status})`);let e;try{e=await n.json()}catch{throw new Error("Local provisioning status response was not valid JSON")}if(!Vt(e)||typeof e.managed!="boolean")throw new Error("Local provisioning status response was not valid");if(e.managed===!1)return it(),new URL(B,window.location.origin).href;if(typeof e.oidcIssuer=="string")try{const o=new URL(e.oidcIssuer);if(["http:","https:"].includes(o.protocol)&&!o.username&&!o.password)return Kt(t),typeof e.provisionCode=="string"&&Yt(e.provisionCode),new URL(B,o).href}catch{}throw new Error("Local provisioning status did not expose a valid OIDC issuer")}function Kt(t){const n=new URL("/provision/status",window.location.origin);Jt(async()=>{const e=await t(n,{credentials:"include",headers:{accept:"application/json"}}),o=e.ok?await e.json().catch(()=>{}):void 0;if(o?.managed!==!0||o?.registered!==!0||typeof o?.provisionCode!="string")throw new Error(Xt);return o.provisionCode})}function Qt(t){return t==="localhost"||t==="::1"||t==="[::1]"||/^127(?:\.\d{1,3}){3}$/u.test(t)}const Zt="/.account/",L="Xpod 登录服务暂时不可用,请稍后重试。",at=[250,750,1500],tn=300,Ct=3e3;function nn(){if(typeof window>"u")return!1;const t=window.location.pathname;return t==="/.account"||t.startsWith("/.account/")}function en(t){const n=t?.account;if(!n)return;const e={...typeof n.id=="string"?{id:n.id}:{},...typeof n.username=="string"?{username:n.username}:{},...typeof n.displayName=="string"?{displayName:n.displayName}:{}};return Object.keys(e).length>0?e:void 0}function At(t){return t?.account?.logout?{status:"authenticated"}:{status:"anonymous",mode:"login"}}function vt(t){return t===502||t===503||t===504}function Rt(t){return t?{status:"error",mode:"login",message:L}:{status:"initializing"}}function It(t){return new Promise(n=>setTimeout(n,t))}function yn({children:t}){const[n,e]=c.useState(),[o,s]=c.useState(null),[f,l]=c.useState(!0),[w,p]=c.useState(null),[z,y]=c.useState(!1),[tt,h]=c.useState({status:"initializing"}),T=c.useRef(0),v=c.useRef(!0),P=c.useRef(0),b=c.useRef(void 0),j=c.useRef(null),O=c.useRef(!1),E=c.useRef(void 0),_=c.useRef(void 0),dt=c.useRef(void 0),[Nt,Pt]=c.useState(0),nt=c.useRef(void 0),et=c.useRef(0),q=c.useRef(0),G=c.useRef(!1),F=c.useCallback(()=>{const r=j.current?.account;return r?.logout?JSON.stringify([b.current,r.id,r.logout,r.clientCredentials]):void 0},[]),R=c.useCallback(()=>{et.current+=1,G.current=!0},[]),g=c.useCallback((r,i,u)=>{const a=F(),d=nt.current,k=_.current;j.current=r,nt.current=i,_.current=u,(a!==F()||d!==i||k!==u)&&R(),G.current=!F()},[F,R]),rt=c.useCallback(()=>{const r=F(),i=et.current,u=J(),a=_.current;let d=!!r&&u===nt.current&&!G.current&&q.current===0;return()=>{if(a)try{if(a!==E.current||a!==_.current)throw new Error("Stale Account source");a.assertCurrent()}catch{d=!1}if(!d||!v.current||G.current||q.current>0||i!==et.current||r!==F()||u!==J())throw d=!1,new Error("Account 登录状态已改变,请重新打开客户端凭据操作。")}},[F]),jt=c.useCallback(r=>{const i=()=>{j.current?.account?.logout&&!_.current||(P.current+=1,(_.current||!j.current?.account?.logout&&E.current)&&(g(null),s(null),O.current=!1,h({status:"initializing"}),l(!0)),Pt(u=>u+1))};return E.current=r,i(),()=>{E.current===r&&(E.current=void 0,i())}},[g]),Ft=c.useCallback(async(r,i)=>{const u=b.current,a=new URL(r instanceof Request?r.url:String(r),u);if(!u||a.origin!==new URL(u).origin||!a.pathname.startsWith("/.account/")||a.username||a.password)throw new Error("Account request outside current authority");const d=rt(),k=_.current;d();const S=await(k?ut({accountIndex:u,fetch:k.fetch,assertCurrent:d}):fetch)(r instanceof Request?r:a.href,{...i,redirect:"error"});try{d()}catch(C){throw S.body?.cancel().catch(()=>{}),C}return S},[rt]),Mt=tt.status==="authenticated",Dt=f||tt.status==="submitting",W=c.useCallback(r=>{(Gt(r)||b.current&&b.current!==r)&&(P.current+=1,T.current+=1,O.current=!1,g(null),s(null),y(!1),h({status:"initializing"})),b.current=r,e(r)},[g]),X=c.useCallback(async()=>{l(!0),p(null),h(r=>r.status==="authenticated"?r:{status:"initializing"});try{const r=await mt();return v.current?(W(r),r):void 0}catch{if(!v.current)return;g(null),s(null),y(!1),p(L),h({status:"error",mode:"login",message:L}),l(!1);return}},[W,g]);c.useEffect(()=>{let r=!0;return mt().then(i=>{r&&v.current&&W(i)}).catch(()=>{!r||!v.current||(g(null),s(null),y(!1),p(L),h({status:"error",mode:"login",message:L}),l(!1))}),()=>{r=!1}},[W,g]),c.useEffect(()=>(v.current=!0,()=>{v.current=!1,R(),P.current+=1}),[R]);const m=c.useCallback(r=>v.current&&r===P.current,[]),ht=c.useCallback(async()=>{const r=new AbortController,i=setTimeout(()=>r.abort(),Ct);try{const u=b.current;if(!u)return!1;const a=await fetch(Y(new URL("oidc/consent/",u)),{headers:ct(void 0,u),credentials:"include",signal:r.signal});return a.ok?!!(await a.json()).client:!1}catch{return!1}finally{clearTimeout(i)}},[]),ot=c.useCallback(async({exposeTransientError:r,generation:i,confirmUnauthenticated:u})=>{const a=b.current;if(!a)return"stale";const d=J(),k=()=>d===J()?!0:(R(),!1);try{const I=await fetch(Y(a),{headers:ct(void 0,a),credentials:"include"});if(!m(i))return"stale";if(!k())return"transient-error";if(I.ok){const S=await I.json();if(!m(i))return"stale";if(!k())return"transient-error";if(!S?.controls||typeof S.controls!="object"||Array.isArray(S.controls))throw new Error("Invalid CSS Account controls response");let C=S.controls,wt;const A=E.current;if(!C.account?.logout&&A&&A!==dt.current&&q.current===0&&new URL(".account/",A.issuer).href===new URL(a).href){h(M=>M.status==="authenticated"?M:{status:"initializing"}),A.assertCurrent();const N=await ut({accountIndex:a,fetch:A.fetch,assertCurrent:()=>A.assertCurrent()})(Y(a),{headers:{accept:"application/json"},signal:AbortSignal.timeout(Ct)});if(!m(i)||A!==E.current)return"stale";if(A.assertCurrent(),!k())return"transient-error";if(N.ok){const M=await N.json();if(!m(i)||A!==E.current)return"stale";if(A.assertCurrent(),!k())return"transient-error";if(!M?.controls||typeof M.controls!="object"||Array.isArray(M.controls))throw new Error("Invalid CSS Account controls response");C=M.controls,C.account?.logout&&(wt=A)}else if(N.status!==401&&N.status!==403){if(vt(N.status)||N.status===408||N.status===429||N.status===500)throw new Error("Transient CSS Account controls response");return T.current+=1,y(!1),R(),p(L),h({status:"error",mode:"login",message:L}),"terminal-error"}}const Ht=++T.current;y(!1),g(C,d,wt),s(C),p(null);const pt=At(C);return O.current=pt.status==="anonymous",h(pt),C.account?.logout&&nn()&&ht().then(gt=>{m(i)&&Ht===T.current&&y(gt)}),"ok"}else{if(I.status===401||I.status===403)return u?(T.current+=1,yt(),O.current=!0,y(!1),g({}),s({}),h({status:"anonymous",mode:"login"}),p(null),"ok"):"unauthenticated";if(T.current+=1,y(!1),vt(I.status))return p(null),h(C=>C.status==="authenticated"?C:Rt(r)),"transient-error";R();const S=`Failed to load account controls (Status: ${I.status})`;return p(S),h({status:"error",mode:"login",message:S}),"terminal-error"}}catch{return m(i)?(T.current+=1,y(!1),p(null),h(I=>I.status==="authenticated"?I:Rt(r)),"transient-error"):"stale"}},[g,ht,m,R]),D=c.useCallback(async()=>{const r=++P.current;for(let i=0;i<=at.length;i+=1){const u=i===at.length,a=await ot({exposeTransientError:u,generation:r});if(a==="unauthenticated")return!m(r)||(await It(tn),!m(r))?"stale":ot({exposeTransientError:!0,generation:r,confirmUnauthenticated:!0});if(a!=="transient-error")return a;if(!m(r)||!u&&(h(d=>d.status==="authenticated"?d:{status:"initializing"}),await It(at[i]),!m(r)))return"stale"}return"transient-error"},[ot,m]);c.useEffect(()=>{if(!n)return;let r=!0;return(async()=>(await D(),r&&v.current&&l(!1)))(),()=>{r=!1}},[D,n,Nt]);const st=c.useCallback(async()=>{const r=await X();if(r&&r===n){const i=await D();if(v.current&&l(!1),i==="ok")return At(j.current)}return{status:"error",mode:"login",message:L}},[D,n,X]),zt=c.useCallback(async()=>{await st()},[st]),qt=c.useCallback(async()=>{q.current+=1,dt.current=E.current;try{R(),P.current+=1,T.current+=1,(_.current||!j.current?.account?.logout)&&(O.current=!1,(b.current??await X())&&await D());const r=b.current,i=j.current?.account?.logout,u=await bt(i,fetch,r);let a=!u&&(!!i||!O.current);if(u)try{const d=await fetch(Y(u),{method:"POST",headers:ct(void 0,r),credentials:"include"});a=!d.ok&&d.status!==401&&d.status!==403}catch{a=!0}if(a){h({status:"error",mode:"login",message:L});return}P.current+=1,T.current+=1,O.current=!0,l(!1),yt(),y(!1),g({}),s({}),p(null),h({status:"anonymous",mode:"login"})}finally{q.current-=1}},[g,D,X,R]),Bt=c.useMemo(()=>en(o),[o]);return $t.jsx(Wt.Provider,{value:{controls:o,isInitializing:f,initError:w,idpIndex:n??Zt,isLoggedIn:Mt,isAnonymous:()=>O.current,bindAccountCapability:rt,authenticating:Dt,hasOidcPending:z,refetchControls:st,registerAccountSession:jt,accountFetch:Ft,retry:zt,logout:qt,accountState:tt,identity:Bt},children:t})}const St=600*1e3,H=2048,x="xpod.safe-continuation.consent.v2",V="xpod.safe-continuation.management.v2",rn=/^\/\.account\/interaction\/([^/?#]+)$/u,on=/^\/\.account\/(?:interaction\/[^/?#]+\/)?account\/([^/?#]+)\//u;function K(){if(!(typeof window>"u"))try{return window.location.origin}catch{return}}function Lt(){if(!(typeof window>"u"))try{return window.sessionStorage}catch{return}}function lt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Q(t){return typeof t=="string"&&t.length>0&&t.length<=H}function $(t){return Q(t)&&t===t.trim()}function Tt(t){return typeof t=="number"&&Number.isFinite(t)&&t>0}function xt(t){return Q(t)&&rn.test(t)}function sn(t){if(typeof t!="string"||!t||t.length>H)return;const n=cn(t);if(n)return n;if(/^[^/?#:]+$/u.test(t)&&t===t.trim())return t}function cn(t){if(typeof t!="string"||!t||t.length>H)return;let n;try{n=new URL(t,K()??"http://localhost")}catch{return}if(!["http:","https:"].includes(n.protocol)||n.username||n.password)return;const e=on.exec(n.pathname);return e?e[1]:void 0}function mn(t,n){const e=t?.account,o=[n?.id,e?.id,e?.logout,e?.clientCredentials,e?.bindings,e?.pod].map(sn).filter(l=>!!l);if(o.length===0)return;const[s,...f]=o;return f.every(l=>l===s)?s:void 0}function an(t,n=K()){if(!n||typeof t!="string"||!t||t.length>H)return!1;let e;try{e=new URL(t,n)}catch{return!1}return e.origin===n&&!e.username&&!e.password&&e.pathname.startsWith("/.account/")}function Ut(t,n,e=K()){if(!e||!xt(t)||typeof n!="string"||!n||n.length>H)return!1;let o;try{o=new URL(n,e)}catch{return!1}return o.origin===e&&!o.username&&!o.password&&o.pathname===`${t}/oidc/consent/`&&o.search===""&&o.hash===""}function un(t){const n=Lt();if(!n)return null;try{return n.getItem(t)}catch{return null}}function Z(t){const n=un(t);if(n===null)return;let e;try{e=JSON.parse(n)}catch{return}return lt(e)?e:void 0}function U(t){const n=Lt();if(n)try{n.removeItem(t)}catch{}}function Ot(t){const{createdAt:n,expiresAt:e}=t;if(!Tt(n)||!Tt(e))return!1;const o=Date.now();if(n>o)return!1;const s=e-n;return s<=0||s>St||e>n+St?!1:e>o}function _t(t,n){return t.accountId===n.accountId&&t.interaction===n.interaction&&t.returnTo===n.returnTo&&t.createdAt===n.createdAt&&t.expiresAt===n.expiresAt}function ft(t){if(!t||t.kind!=="consent")return null;const{accountId:n,interaction:e,returnTo:o}=t;return!$(n)||!xt(e)||!Q(o)||!Ot(t)||!Ut(e,o)?null:{kind:"consent",accountId:n,interaction:e,returnTo:o,createdAt:t.createdAt,expiresAt:t.expiresAt}}function ln(t){if(!t||t.kind!=="management")return null;const{accountId:n,returnTo:e}=t;return!$(n)||!Q(e)||!Ot(t)||!an(e)?null:{kind:"management",accountId:n,returnTo:e,createdAt:t.createdAt,expiresAt:t.expiresAt}}function fn(t){const n=t?.accountId;if(!$(n))return U(V),null;const e=ln(Z(V));return!e||e.accountId!==n?(U(V),null):e}function Cn(t){const n=fn(t);return U(V),n}function dn(t){const n=t?.accountId;if(!$(n))return U(x),null;const e=ft(Z(x));return!e||e.accountId!==n?(U(x),null):e}function An(t,n,e={}){const o=n?.accountId;if(!$(o))return U(x),null;const s=ft(Z(x));if(!s||s.accountId!==o||!_t(s,t))return U(x),null;try{e.assertCurrent?.()}catch{return null}return U(x),s}async function hn(t,n={}){const e=n.origin??K();if(!e||!Ut(t.interaction,t.returnTo,e))return!1;const o=n.fetch??(typeof fetch=="function"?fetch:void 0);if(!o)return!1;const s=new URL(t.returnTo,e).href;let f;try{n.assertCurrent?.(),f=await o(s,{method:"GET",credentials:"include",redirect:"manual",headers:{accept:"application/json",...n.headers??{}}})}catch{return!1}try{n.assertCurrent?.()}catch{return!1}if(f.redirected===!0||typeof f.status=="number"&&f.status>=300&&f.status<400||!f.ok||typeof f.url=="string"&&f.url&&f.url!==s)return!1;const l=await f.json().catch(()=>{});if(!lt(l))return!1;const w=l.client;return lt(w)&&(typeof w.client_id=="string"||typeof w.client_name=="string")}async function vn(t,n={}){const e=dn(t);if(!e)return null;const o=await hn(e,n),s=ft(Z(x));if(!o||!s||s.accountId!==t.accountId||!_t(s,e))return U(x),null;try{n.assertCurrent?.()}catch{return null}return s}export{yn as A,vn as a,fn as b,hn as c,An as d,Cn as e,ut as f,gn as g,mn as r};
|
|
1
|
+
import{r as c,j as $t}from"./dashboard--DWjqkYt.js";import{r as bt,g as J,b as Gt,c as Y,s as ct,d as yt,A as Wt}from"./account-session-BZ2ttIdq.js";const Xt="Cloud storage is not ready. Please wait for Xpod to reconnect and try again.",Et=new WeakMap;function it(){typeof window<"u"&&Et.delete(window)}function Jt(t){typeof window<"u"&&Et.set(window,t)}function Yt(t){try{sessionStorage.setItem("provisionCode",t)}catch{}}async function gn(t){const n=kt(t.accountIndex);if(!n)return;const e=ut(t);let o;try{o=await e(n,{headers:{accept:"application/json"},credentials:"omit"})}catch{return}if(!o.ok)return;const f=(await o.json().catch(()=>{}))?.controls?.account?.clientCredentials;if(typeof f!="string"||!f)return;const l=await bt(f,e,n);if(!l)return;const w=new URL(l,n);return w.origin===new URL(n).origin&&w.pathname.startsWith("/.account/")&&!w.username&&!w.password&&!w.hash?{collection:l,webId:t.webId}:void 0}function ut(t){const n=kt(t.accountIndex);return async(e,o)=>{if(t.assertCurrent?.(),!n)throw new Error("Invalid session Account authority");const s=new Headers(e instanceof Request?e.headers:void 0);new Headers(o?.headers).forEach((z,y)=>s.set(y,z)),/^CSS-Account-Token(?:\s|$)/iu.test(s.get("authorization")??"")&&s.delete("authorization");const f={...o,headers:s,credentials:"omit",redirect:"error"},l=new URL(e instanceof Request?e.url:String(e));if(l.origin!==new URL(n).origin||!l.pathname.startsWith("/.account/")||l.username||l.password||l.hash)throw new Error("Session Account request leaves the trusted authority");const w=new Request(e,f),p=e instanceof Request?await t.fetch(w):await t.fetch(w.url,f);try{t.assertCurrent?.()}catch(z){throw p.body?.cancel().catch(()=>{}),z}return p}}function kt(t){try{const n=new URL(t);return!["http:","https:"].includes(n.protocol)||n.username||n.password||n.pathname!=="/.account/"||n.search||n.hash?void 0:n.href}catch{return}}const B="/.account/";function Vt(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}async function mt(t=fetch){if(typeof window>"u")return B;if(!Qt(window.location.hostname)){const o=window.__XPOD__?.idpIndex;if(o!==void 0){try{const s=new URL(o,window.location.origin);if(typeof o=="string"&&o.trim()&&["http:","https:"].includes(s.protocol)&&s.pathname===B&&!s.username&&!s.password&&!s.search&&!s.hash)return it(),s.href}catch{}throw new Error("Server bootstrap did not expose a valid Account index")}}const n=await t(new URL("/provision/status",window.location.origin),{credentials:"include",headers:{accept:"application/json"}});if(n.status===404)return it(),new URL(B,window.location.origin).href;if(!n.ok)throw new Error(`Local provisioning status request failed (${n.status})`);let e;try{e=await n.json()}catch{throw new Error("Local provisioning status response was not valid JSON")}if(!Vt(e)||typeof e.managed!="boolean")throw new Error("Local provisioning status response was not valid");if(e.managed===!1)return it(),new URL(B,window.location.origin).href;if(typeof e.oidcIssuer=="string")try{const o=new URL(e.oidcIssuer);if(["http:","https:"].includes(o.protocol)&&!o.username&&!o.password)return Kt(t),typeof e.provisionCode=="string"&&Yt(e.provisionCode),new URL(B,o).href}catch{}throw new Error("Local provisioning status did not expose a valid OIDC issuer")}function Kt(t){const n=new URL("/provision/status",window.location.origin);Jt(async()=>{const e=await t(n,{credentials:"include",headers:{accept:"application/json"}}),o=e.ok?await e.json().catch(()=>{}):void 0;if(o?.managed!==!0||o?.registered!==!0||typeof o?.provisionCode!="string")throw new Error(Xt);return o.provisionCode})}function Qt(t){return t==="localhost"||t==="::1"||t==="[::1]"||/^127(?:\.\d{1,3}){3}$/u.test(t)}const Zt="/.account/",L="Xpod 登录服务暂时不可用,请稍后重试。",at=[250,750,1500],tn=300,Ct=3e3;function nn(){if(typeof window>"u")return!1;const t=window.location.pathname;return t==="/.account"||t.startsWith("/.account/")}function en(t){const n=t?.account;if(!n)return;const e={...typeof n.id=="string"?{id:n.id}:{},...typeof n.username=="string"?{username:n.username}:{},...typeof n.displayName=="string"?{displayName:n.displayName}:{}};return Object.keys(e).length>0?e:void 0}function At(t){return t?.account?.logout?{status:"authenticated"}:{status:"anonymous",mode:"login"}}function vt(t){return t===502||t===503||t===504}function Rt(t){return t?{status:"error",mode:"login",message:L}:{status:"initializing"}}function It(t){return new Promise(n=>setTimeout(n,t))}function yn({children:t}){const[n,e]=c.useState(),[o,s]=c.useState(null),[f,l]=c.useState(!0),[w,p]=c.useState(null),[z,y]=c.useState(!1),[tt,h]=c.useState({status:"initializing"}),T=c.useRef(0),v=c.useRef(!0),P=c.useRef(0),b=c.useRef(void 0),j=c.useRef(null),O=c.useRef(!1),E=c.useRef(void 0),_=c.useRef(void 0),dt=c.useRef(void 0),[Nt,Pt]=c.useState(0),nt=c.useRef(void 0),et=c.useRef(0),q=c.useRef(0),G=c.useRef(!1),F=c.useCallback(()=>{const r=j.current?.account;return r?.logout?JSON.stringify([b.current,r.id,r.logout,r.clientCredentials]):void 0},[]),R=c.useCallback(()=>{et.current+=1,G.current=!0},[]),g=c.useCallback((r,i,u)=>{const a=F(),d=nt.current,k=_.current;j.current=r,nt.current=i,_.current=u,(a!==F()||d!==i||k!==u)&&R(),G.current=!F()},[F,R]),rt=c.useCallback(()=>{const r=F(),i=et.current,u=J(),a=_.current;let d=!!r&&u===nt.current&&!G.current&&q.current===0;return()=>{if(a)try{if(a!==E.current||a!==_.current)throw new Error("Stale Account source");a.assertCurrent()}catch{d=!1}if(!d||!v.current||G.current||q.current>0||i!==et.current||r!==F()||u!==J())throw d=!1,new Error("Account 登录状态已改变,请重新打开客户端凭据操作。")}},[F]),jt=c.useCallback(r=>{const i=()=>{j.current?.account?.logout&&!_.current||(P.current+=1,(_.current||!j.current?.account?.logout&&E.current)&&(g(null),s(null),O.current=!1,h({status:"initializing"}),l(!0)),Pt(u=>u+1))};return E.current=r,i(),()=>{E.current===r&&(E.current=void 0,i())}},[g]),Ft=c.useCallback(async(r,i)=>{const u=b.current,a=new URL(r instanceof Request?r.url:String(r),u);if(!u||a.origin!==new URL(u).origin||!a.pathname.startsWith("/.account/")||a.username||a.password)throw new Error("Account request outside current authority");const d=rt(),k=_.current;d();const S=await(k?ut({accountIndex:u,fetch:k.fetch,assertCurrent:d}):fetch)(r instanceof Request?r:a.href,{...i,redirect:"error"});try{d()}catch(C){throw S.body?.cancel().catch(()=>{}),C}return S},[rt]),Mt=tt.status==="authenticated",Dt=f||tt.status==="submitting",W=c.useCallback(r=>{(Gt(r)||b.current&&b.current!==r)&&(P.current+=1,T.current+=1,O.current=!1,g(null),s(null),y(!1),h({status:"initializing"})),b.current=r,e(r)},[g]),X=c.useCallback(async()=>{l(!0),p(null),h(r=>r.status==="authenticated"?r:{status:"initializing"});try{const r=await mt();return v.current?(W(r),r):void 0}catch{if(!v.current)return;g(null),s(null),y(!1),p(L),h({status:"error",mode:"login",message:L}),l(!1);return}},[W,g]);c.useEffect(()=>{let r=!0;return mt().then(i=>{r&&v.current&&W(i)}).catch(()=>{!r||!v.current||(g(null),s(null),y(!1),p(L),h({status:"error",mode:"login",message:L}),l(!1))}),()=>{r=!1}},[W,g]),c.useEffect(()=>(v.current=!0,()=>{v.current=!1,R(),P.current+=1}),[R]);const m=c.useCallback(r=>v.current&&r===P.current,[]),ht=c.useCallback(async()=>{const r=new AbortController,i=setTimeout(()=>r.abort(),Ct);try{const u=b.current;if(!u)return!1;const a=await fetch(Y(new URL("oidc/consent/",u)),{headers:ct(void 0,u),credentials:"include",signal:r.signal});return a.ok?!!(await a.json()).client:!1}catch{return!1}finally{clearTimeout(i)}},[]),ot=c.useCallback(async({exposeTransientError:r,generation:i,confirmUnauthenticated:u})=>{const a=b.current;if(!a)return"stale";const d=J(),k=()=>d===J()?!0:(R(),!1);try{const I=await fetch(Y(a),{headers:ct(void 0,a),credentials:"include"});if(!m(i))return"stale";if(!k())return"transient-error";if(I.ok){const S=await I.json();if(!m(i))return"stale";if(!k())return"transient-error";if(!S?.controls||typeof S.controls!="object"||Array.isArray(S.controls))throw new Error("Invalid CSS Account controls response");let C=S.controls,wt;const A=E.current;if(!C.account?.logout&&A&&A!==dt.current&&q.current===0&&new URL(".account/",A.issuer).href===new URL(a).href){h(M=>M.status==="authenticated"?M:{status:"initializing"}),A.assertCurrent();const N=await ut({accountIndex:a,fetch:A.fetch,assertCurrent:()=>A.assertCurrent()})(Y(a),{headers:{accept:"application/json"},signal:AbortSignal.timeout(Ct)});if(!m(i)||A!==E.current)return"stale";if(A.assertCurrent(),!k())return"transient-error";if(N.ok){const M=await N.json();if(!m(i)||A!==E.current)return"stale";if(A.assertCurrent(),!k())return"transient-error";if(!M?.controls||typeof M.controls!="object"||Array.isArray(M.controls))throw new Error("Invalid CSS Account controls response");C=M.controls,C.account?.logout&&(wt=A)}else if(N.status!==401&&N.status!==403){if(vt(N.status)||N.status===408||N.status===429||N.status===500)throw new Error("Transient CSS Account controls response");return T.current+=1,y(!1),R(),p(L),h({status:"error",mode:"login",message:L}),"terminal-error"}}const Ht=++T.current;y(!1),g(C,d,wt),s(C),p(null);const pt=At(C);return O.current=pt.status==="anonymous",h(pt),C.account?.logout&&nn()&&ht().then(gt=>{m(i)&&Ht===T.current&&y(gt)}),"ok"}else{if(I.status===401||I.status===403)return u?(T.current+=1,yt(),O.current=!0,y(!1),g({}),s({}),h({status:"anonymous",mode:"login"}),p(null),"ok"):"unauthenticated";if(T.current+=1,y(!1),vt(I.status))return p(null),h(C=>C.status==="authenticated"?C:Rt(r)),"transient-error";R();const S=`Failed to load account controls (Status: ${I.status})`;return p(S),h({status:"error",mode:"login",message:S}),"terminal-error"}}catch{return m(i)?(T.current+=1,y(!1),p(null),h(I=>I.status==="authenticated"?I:Rt(r)),"transient-error"):"stale"}},[g,ht,m,R]),D=c.useCallback(async()=>{const r=++P.current;for(let i=0;i<=at.length;i+=1){const u=i===at.length,a=await ot({exposeTransientError:u,generation:r});if(a==="unauthenticated")return!m(r)||(await It(tn),!m(r))?"stale":ot({exposeTransientError:!0,generation:r,confirmUnauthenticated:!0});if(a!=="transient-error")return a;if(!m(r)||!u&&(h(d=>d.status==="authenticated"?d:{status:"initializing"}),await It(at[i]),!m(r)))return"stale"}return"transient-error"},[ot,m]);c.useEffect(()=>{if(!n)return;let r=!0;return(async()=>(await D(),r&&v.current&&l(!1)))(),()=>{r=!1}},[D,n,Nt]);const st=c.useCallback(async()=>{const r=await X();if(r&&r===n){const i=await D();if(v.current&&l(!1),i==="ok")return At(j.current)}return{status:"error",mode:"login",message:L}},[D,n,X]),zt=c.useCallback(async()=>{await st()},[st]),qt=c.useCallback(async()=>{q.current+=1,dt.current=E.current;try{R(),P.current+=1,T.current+=1,(_.current||!j.current?.account?.logout)&&(O.current=!1,(b.current??await X())&&await D());const r=b.current,i=j.current?.account?.logout,u=await bt(i,fetch,r);let a=!u&&(!!i||!O.current);if(u)try{const d=await fetch(Y(u),{method:"POST",headers:ct(void 0,r),credentials:"include"});a=!d.ok&&d.status!==401&&d.status!==403}catch{a=!0}if(a){h({status:"error",mode:"login",message:L});return}P.current+=1,T.current+=1,O.current=!0,l(!1),yt(),y(!1),g({}),s({}),p(null),h({status:"anonymous",mode:"login"})}finally{q.current-=1}},[g,D,X,R]),Bt=c.useMemo(()=>en(o),[o]);return $t.jsx(Wt.Provider,{value:{controls:o,isInitializing:f,initError:w,idpIndex:n??Zt,isLoggedIn:Mt,isAnonymous:()=>O.current,bindAccountCapability:rt,authenticating:Dt,hasOidcPending:z,refetchControls:st,registerAccountSession:jt,accountFetch:Ft,retry:zt,logout:qt,accountState:tt,identity:Bt},children:t})}const St=600*1e3,H=2048,x="xpod.safe-continuation.consent.v2",V="xpod.safe-continuation.management.v2",rn=/^\/\.account\/interaction\/([^/?#]+)$/u,on=/^\/\.account\/(?:interaction\/[^/?#]+\/)?account\/([^/?#]+)\//u;function K(){if(!(typeof window>"u"))try{return window.location.origin}catch{return}}function Lt(){if(!(typeof window>"u"))try{return window.sessionStorage}catch{return}}function lt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Q(t){return typeof t=="string"&&t.length>0&&t.length<=H}function $(t){return Q(t)&&t===t.trim()}function Tt(t){return typeof t=="number"&&Number.isFinite(t)&&t>0}function xt(t){return Q(t)&&rn.test(t)}function sn(t){if(typeof t!="string"||!t||t.length>H)return;const n=cn(t);if(n)return n;if(/^[^/?#:]+$/u.test(t)&&t===t.trim())return t}function cn(t){if(typeof t!="string"||!t||t.length>H)return;let n;try{n=new URL(t,K()??"http://localhost")}catch{return}if(!["http:","https:"].includes(n.protocol)||n.username||n.password)return;const e=on.exec(n.pathname);return e?e[1]:void 0}function mn(t,n){const e=t?.account,o=[n?.id,e?.id,e?.logout,e?.clientCredentials,e?.bindings,e?.pod].map(sn).filter(l=>!!l);if(o.length===0)return;const[s,...f]=o;return f.every(l=>l===s)?s:void 0}function an(t,n=K()){if(!n||typeof t!="string"||!t||t.length>H)return!1;let e;try{e=new URL(t,n)}catch{return!1}return e.origin===n&&!e.username&&!e.password&&e.pathname.startsWith("/.account/")}function Ut(t,n,e=K()){if(!e||!xt(t)||typeof n!="string"||!n||n.length>H)return!1;let o;try{o=new URL(n,e)}catch{return!1}return o.origin===e&&!o.username&&!o.password&&o.pathname===`${t}/oidc/consent/`&&o.search===""&&o.hash===""}function un(t){const n=Lt();if(!n)return null;try{return n.getItem(t)}catch{return null}}function Z(t){const n=un(t);if(n===null)return;let e;try{e=JSON.parse(n)}catch{return}return lt(e)?e:void 0}function U(t){const n=Lt();if(n)try{n.removeItem(t)}catch{}}function Ot(t){const{createdAt:n,expiresAt:e}=t;if(!Tt(n)||!Tt(e))return!1;const o=Date.now();if(n>o)return!1;const s=e-n;return s<=0||s>St||e>n+St?!1:e>o}function _t(t,n){return t.accountId===n.accountId&&t.interaction===n.interaction&&t.returnTo===n.returnTo&&t.createdAt===n.createdAt&&t.expiresAt===n.expiresAt}function ft(t){if(!t||t.kind!=="consent")return null;const{accountId:n,interaction:e,returnTo:o}=t;return!$(n)||!xt(e)||!Q(o)||!Ot(t)||!Ut(e,o)?null:{kind:"consent",accountId:n,interaction:e,returnTo:o,createdAt:t.createdAt,expiresAt:t.expiresAt}}function ln(t){if(!t||t.kind!=="management")return null;const{accountId:n,returnTo:e}=t;return!$(n)||!Q(e)||!Ot(t)||!an(e)?null:{kind:"management",accountId:n,returnTo:e,createdAt:t.createdAt,expiresAt:t.expiresAt}}function fn(t){const n=t?.accountId;if(!$(n))return U(V),null;const e=ln(Z(V));return!e||e.accountId!==n?(U(V),null):e}function Cn(t){const n=fn(t);return U(V),n}function dn(t){const n=t?.accountId;if(!$(n))return U(x),null;const e=ft(Z(x));return!e||e.accountId!==n?(U(x),null):e}function An(t,n,e={}){const o=n?.accountId;if(!$(o))return U(x),null;const s=ft(Z(x));if(!s||s.accountId!==o||!_t(s,t))return U(x),null;try{e.assertCurrent?.()}catch{return null}return U(x),s}async function hn(t,n={}){const e=n.origin??K();if(!e||!Ut(t.interaction,t.returnTo,e))return!1;const o=n.fetch??(typeof fetch=="function"?fetch:void 0);if(!o)return!1;const s=new URL(t.returnTo,e).href;let f;try{n.assertCurrent?.(),f=await o(s,{method:"GET",credentials:"include",redirect:"manual",headers:{accept:"application/json",...n.headers??{}}})}catch{return!1}try{n.assertCurrent?.()}catch{return!1}if(f.redirected===!0||typeof f.status=="number"&&f.status>=300&&f.status<400||!f.ok||typeof f.url=="string"&&f.url&&f.url!==s)return!1;const l=await f.json().catch(()=>{});if(!lt(l))return!1;const w=l.client;return lt(w)&&(typeof w.client_id=="string"||typeof w.client_name=="string")}async function vn(t,n={}){const e=dn(t);if(!e)return null;const o=await hn(e,n),s=ft(Z(x));if(!o||!s||s.accountId!==t.accountId||!_t(s,e))return U(x),null;try{n.assertCurrent?.()}catch{return null}return s}export{yn as A,vn as a,fn as b,hn as c,An as d,Cn as e,ut as f,gn as g,mn as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./dashboard
|
|
1
|
+
import{j as e}from"./dashboard--DWjqkYt.js";import{c as n,a as m,i as c}from"./button-_rwfCMMH.js";const u=m(`inline-flex items-center rounded-lg border px-2.5 py-0.5 text-xs font-semibold transition-all duration-200 ${c}`,{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-sm shadow-primary/20 hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-sm shadow-destructive/20 hover:bg-destructive/90",outline:"border-border/40 text-foreground bg-muted/30 backdrop-blur-sm",pending:"border border-dashed border-muted-foreground bg-transparent text-muted-foreground shadow-none hover:bg-transparent"}},defaultVariants:{variant:"default"}});function b({className:r,variant:a,...s}){return e.jsx("div",{className:n(u({variant:a}),r),...s})}function f({title:r,description:a,actions:s,level:d=2,titleClassName:o,className:i,...l}){const t=n("text-sm leading-normal text-foreground",o);return e.jsxs("div",{...l,className:n("flex flex-wrap items-start justify-between gap-3",i),children:[e.jsxs("div",{className:"min-w-0",children:[d===3?e.jsx("h3",{className:t,children:r}):d===4?e.jsx("h4",{className:t,children:r}):e.jsx("h2",{className:t,children:r}),a?e.jsx("p",{className:"mt-1 text-xs leading-normal text-muted-foreground",children:a}):null]}),s?e.jsx("div",{className:"flex min-w-0 max-w-full flex-wrap items-center gap-2",children:s}):null]})}export{b as B,f as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as r}from"./dashboard
|
|
1
|
+
import{r as o,j as r}from"./dashboard--DWjqkYt.js";import{c as G,P,a as F,u as $}from"./PodDeletionAuthorizationPanel-CzrI8Pgw.js";import{u as M,c as j,i as W}from"./button-_rwfCMMH.js";import{E as X}from"./xpod-remembered-login-CtmMI8xG.js";var J=Object.defineProperty,w=(n,e)=>J(n,"name",{value:e,configurable:!0}),E="Switch",[K,de]=G(E),[Q,y]=K(E);function U(n){const{__scopeSwitch:e,checked:s,children:c,defaultChecked:a,disabled:t,form:i,name:l,onCheckedChange:d,required:h,value:S="on",internal_do_not_use_render:m}=n,[f,b]=$({prop:s,defaultProp:a??!1,onChange:d,caller:E}),[g,C]=o.useState(null),[x,v]=o.useState(null),R=o.useRef(!1),[u,p]=o.useReducer(k=>k+1,0),I=g?!!i||!!g.closest("form"):!0,_={checked:f,setChecked:b,disabled:t,control:g,setControl:C,name:l,form:i,value:S,hasConsumerStoppedPropagationRef:R,userInteractionCount:u,onUserInteraction:p,required:h,defaultChecked:a,isFormControl:I,bubbleInput:x,setBubbleInput:v};return r.jsx(Q,{scope:e,..._,children:H(m)?m(_):c})}w(U,"SwitchProvider");var V="SwitchTrigger",Y=o.forwardRef(w(function({__scopeSwitch:e,onClick:s,...c},a){const{control:t,form:i,value:l,disabled:d,checked:h,required:S,setControl:m,setChecked:f,hasConsumerStoppedPropagationRef:b,onUserInteraction:g,isFormControl:C,bubbleInput:x}=y(V,e),v=M(a,m),R=o.useRef(h);return o.useEffect(()=>{const u=i?t?.ownerDocument.getElementById(i):t?.form;if(u instanceof HTMLFormElement){const p=w(()=>f(R.current),"reset");return u.addEventListener("reset",p),()=>u.removeEventListener("reset",p)}},[t,i,f]),r.jsx(P.button,{type:"button",role:"switch","aria-checked":h,"aria-required":S,"data-state":N(h),"data-disabled":d?"":void 0,disabled:d,value:l,...c,ref:v,onClick:F(s,u=>{g(),f(p=>!p),x&&C&&(b.current=u.isPropagationStopped(),b.current||u.stopPropagation())})})},"SwitchTrigger")),q=o.forwardRef(w(function(e,s){const{__scopeSwitch:c,name:a,checked:t,defaultChecked:i,required:l,disabled:d,value:h,onCheckedChange:S,form:m,...f}=e;return r.jsx(U,{__scopeSwitch:c,checked:t,defaultChecked:i,disabled:d,required:l,onCheckedChange:S,name:a,form:m,value:h,internal_do_not_use_render:({isFormControl:b})=>r.jsxs(r.Fragment,{children:[r.jsx(Y,{...f,ref:s,__scopeSwitch:c}),b&&r.jsx(re,{__scopeSwitch:c})]})})},"Switch")),Z="SwitchThumb",ee=o.forwardRef(w(function(e,s){const{__scopeSwitch:c,...a}=e,t=y(Z,c);return r.jsx(P.span,{"data-state":N(t.checked),"data-disabled":t.disabled?"":void 0,...a,ref:s})},"SwitchThumb")),te="SwitchBubbleInput",re=o.forwardRef(w(function({__scopeSwitch:e,onClick:s,...c},a){const{control:t,hasConsumerStoppedPropagationRef:i,userInteractionCount:l,checked:d,defaultChecked:h,required:S,disabled:m,name:f,value:b,form:g,bubbleInput:C,setBubbleInput:x}=y(te,e),v=M(a,x),R=X(t),u=o.useRef(!1),p=o.useRef(d),I=o.useRef(l);o.useEffect(()=>{const k=C;if(!k)return;const A=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(A,"checked").set,B=l!==I.current;I.current=l;const O=p.current!==d;p.current=d;const z=!(B&&i.current);if(O&&T){u.current=!B;const D=new Event("click",{bubbles:z});T.call(k,d),k.dispatchEvent(D),u.current=!1}},[C,d,i,l]);const _=o.useRef(d);return r.jsx(P.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??_.current,required:S,disabled:m,name:f,value:b,form:g,...c,tabIndex:-1,ref:v,onClick:F(s,k=>{u.current&&k.stopPropagation()}),style:{...c.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function H(n){return typeof n=="function"}w(H,"isFunction");function N(n){return n?"checked":"unchecked"}w(N,"getState");const L=o.forwardRef(({className:n,...e},s)=>r.jsx(q,{className:j("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full","border-2 border-transparent","transition-all duration-200",W,"disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary","data-[state=unchecked]:bg-muted/50",n),...e,ref:s,children:r.jsx(ee,{className:j("pointer-events-none block h-5 w-5 rounded-full bg-background","shadow-md ring-0","transition-transform duration-200","data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));L.displayName=q.displayName;function ne({label:n,description:e,control:s,className:c,...a}){const t=o.useId(),i=e?`${t}-description`:void 0;return r.jsxs("div",{className:j("flex min-h-16 items-center justify-between gap-3 border-b border-border",c),...a,children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("label",{htmlFor:t,className:"text-sm leading-normal text-foreground",children:n}),e?r.jsx("p",{id:i,className:"mt-1 text-xs leading-normal text-muted-foreground",children:e}):null]}),r.jsx("div",{className:"shrink-0",children:s({id:t,"aria-describedby":i})})]})}function ue({checked:n,onCheckedChange:e,disabled:s,...c}){return r.jsx(ne,{...c,control:({id:a,"aria-describedby":t})=>r.jsx(L,{id:a,checked:n,onCheckedChange:e,disabled:s,"aria-describedby":t})})}export{ne as S,ue as a};
|