gemi 0.4.93 → 0.4.95
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/app/App.d.ts +2 -11
- package/dist/app/App.d.ts.map +1 -1
- package/dist/app/index.js +3 -1
- package/dist/app/index.js.map +13 -0
- package/dist/auth/AuthenticationServiceContainer.d.ts +3 -1
- package/dist/auth/AuthenticationServiceContainer.d.ts.map +1 -1
- package/dist/auth/AuthenticationServiceProvider.d.ts +3 -5
- package/dist/auth/AuthenticationServiceProvider.d.ts.map +1 -1
- package/dist/bin/index.js +3 -0
- package/dist/broadcasting/index.js +3 -1
- package/dist/broadcasting/index.js.map +10 -0
- package/dist/{chunk-d09948245f5b426d.js → chunk-07f44e411ae4ea5e.js} +3 -1
- package/dist/chunk-07f44e411ae4ea5e.js.map +11 -0
- package/dist/{chunk-7ce930fe69575c87.js → chunk-0d97333b6af9fc45.js} +3 -1
- package/dist/chunk-0d97333b6af9fc45.js.map +9 -0
- package/dist/{chunk-e76c7e3bf2d698af.js → chunk-11de5b0adccef35c.js} +3 -1
- package/dist/chunk-11de5b0adccef35c.js.map +17 -0
- package/dist/{chunk-1770e9abf10029e0.js → chunk-18a59fffad60f059.js} +3 -1
- package/dist/chunk-18a59fffad60f059.js.map +12 -0
- package/dist/{chunk-8fec55214eb03a61.js → chunk-201c5005a90452fa.js} +4 -2
- package/dist/chunk-201c5005a90452fa.js.map +11 -0
- package/dist/{chunk-cfb8c5b12b0e5378.js → chunk-23d3df5f8342ecc6.js} +4 -2
- package/dist/chunk-23d3df5f8342ecc6.js.map +54 -0
- package/dist/chunk-278677330e53423b.js +4 -0
- package/dist/chunk-278677330e53423b.js.map +26 -0
- package/dist/{chunk-e1929f0f7003fbdf.js → chunk-28ec4c2b20e69deb.js} +4 -2
- package/dist/chunk-28ec4c2b20e69deb.js.map +10 -0
- package/dist/chunk-2f8cf8372320b622.js +4 -0
- package/dist/chunk-2f8cf8372320b622.js.map +11 -0
- package/dist/{chunk-ef791082443c0cbd.js → chunk-53b0fab00d83f47e.js} +3 -1
- package/dist/chunk-53b0fab00d83f47e.js.map +13 -0
- package/dist/chunk-57ba59dd008d6e0e.js +4 -0
- package/dist/chunk-57ba59dd008d6e0e.js.map +32 -0
- package/dist/chunk-642b04056dab5d64.js +4 -0
- package/dist/chunk-642b04056dab5d64.js.map +11 -0
- package/dist/{chunk-dfb863d471bf3b18.js → chunk-643529c2ad120db7.js} +4 -2
- package/dist/chunk-643529c2ad120db7.js.map +50 -0
- package/dist/{chunk-b6fb088270ea6584.js → chunk-683905a55f8da1ad.js} +4 -2
- package/dist/chunk-683905a55f8da1ad.js.map +64 -0
- package/dist/{chunk-035e233acf299392.js → chunk-90436b32a64fc784.js} +4 -2
- package/dist/chunk-90436b32a64fc784.js.map +53 -0
- package/dist/chunk-99c32e4d937131e0.js +4 -0
- package/dist/chunk-99c32e4d937131e0.js.map +10 -0
- package/dist/{chunk-d7525516b1305ba3.js → chunk-9be25fac5f76b2f7.js} +3 -1
- package/dist/chunk-9be25fac5f76b2f7.js.map +13 -0
- package/dist/{chunk-f10ba402aaacfc12.js → chunk-9f9e21f9fd0d6af1.js} +4 -2
- package/dist/chunk-9f9e21f9fd0d6af1.js.map +10 -0
- package/dist/chunk-9ff3d7096b6de8eb.js +4 -0
- package/dist/chunk-9ff3d7096b6de8eb.js.map +22 -0
- package/dist/{chunk-cfbe2cbcadcb1ac1.js → chunk-a7d87b5d6d789781.js} +3 -1
- package/dist/chunk-a7d87b5d6d789781.js.map +23 -0
- package/dist/chunk-b84d011a2972c7d1.js +4 -0
- package/dist/chunk-b84d011a2972c7d1.js.map +10 -0
- package/dist/{chunk-2f8839f406606d63.js → chunk-bace428bfab523c4.js} +3 -1
- package/dist/chunk-bace428bfab523c4.js.map +23 -0
- package/dist/{chunk-494de321e3423d54.js → chunk-bd708d3c982948aa.js} +4 -2
- package/dist/chunk-bd708d3c982948aa.js.map +16 -0
- package/dist/{chunk-496c32676431beab.js → chunk-c8c4a1285a266c51.js} +4 -2
- package/dist/chunk-c8c4a1285a266c51.js.map +169 -0
- package/dist/{chunk-eabfa03c809e14df.js → chunk-cd4bfdd46ec4cbb8.js} +4 -2
- package/dist/chunk-cd4bfdd46ec4cbb8.js.map +10 -0
- package/dist/{chunk-0f0add364d3ea615.js → chunk-cd9c5e8a6c80384f.js} +3 -1
- package/dist/chunk-cd9c5e8a6c80384f.js.map +20 -0
- package/dist/{chunk-04f04986e53516f0.js → chunk-d5b8023c223e3a60.js} +3 -1
- package/dist/chunk-d5b8023c223e3a60.js.map +10 -0
- package/dist/chunk-e4961d79807acd3d.js +4 -0
- package/dist/chunk-e4961d79807acd3d.js.map +33 -0
- package/dist/client/ClientRouterContext.d.ts.map +1 -1
- package/dist/client/HttpReload.d.ts.map +1 -1
- package/dist/email/index.js +3 -1
- package/dist/email/index.js.map +11 -0
- package/dist/facades/Auth.d.ts.map +1 -1
- package/dist/facades/Broadcast.d.ts.map +1 -1
- package/dist/facades/FileStorage.d.ts.map +1 -1
- package/dist/facades/I18n.d.ts.map +1 -1
- package/dist/facades/Prefetch.d.ts.map +1 -1
- package/dist/facades/index.js +3 -1
- package/dist/facades/index.js.map +28 -0
- package/dist/http/AuthenticationMiddlware.d.ts.map +1 -1
- package/dist/http/I18nServiceContainer.d.ts +6 -9
- package/dist/http/I18nServiceContainer.d.ts.map +1 -1
- package/dist/http/I18nServiceProvider.d.ts +3 -1
- package/dist/http/I18nServiceProvider.d.ts.map +1 -1
- package/dist/http/MiddlewareServiceProvider.d.ts +3 -1
- package/dist/http/MiddlewareServiceProvider.d.ts.map +1 -1
- package/dist/http/RateLimitMiddleware.d.ts.map +1 -1
- package/dist/http/index.js +3 -1
- package/dist/http/index.js.map +29 -0
- package/dist/kernel/Kernel.d.ts +4 -32
- package/dist/kernel/Kernel.d.ts.map +1 -1
- package/dist/kernel/KernelContext.d.ts +1 -1
- package/dist/kernel/KernelContext.d.ts.map +1 -1
- package/dist/kernel/context.d.ts +1 -21
- package/dist/kernel/context.d.ts.map +1 -1
- package/dist/kernel/index.js +3 -1
- package/dist/kernel/index.js.map +11 -0
- package/dist/server/index.js +6 -4
- package/dist/server/index.js.map +17 -0
- package/dist/services/ServiceContainer.d.ts +2 -2
- package/dist/services/ServiceContainer.d.ts.map +1 -1
- package/dist/services/email/EmailServiceContainer.d.ts +1 -1
- package/dist/services/email/EmailServiceContainer.d.ts.map +1 -1
- package/dist/services/file-storage/FileStorageServiceContainer.d.ts +3 -1
- package/dist/services/file-storage/FileStorageServiceContainer.d.ts.map +1 -1
- package/dist/services/file-storage/FileStorageServiceProvider.d.ts +3 -1
- package/dist/services/file-storage/FileStorageServiceProvider.d.ts.map +1 -1
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +12 -1
- package/dist/services/index.js.map +121 -0
- package/dist/services/middleware/MiddlewareServiceContainer.d.ts +3 -1
- package/dist/services/middleware/MiddlewareServiceContainer.d.ts.map +1 -1
- package/dist/services/rate-limiter/RateLimiterServiceContainer.d.ts +3 -1
- package/dist/services/rate-limiter/RateLimiterServiceContainer.d.ts.map +1 -1
- package/dist/services/rate-limiter/RateLimiterServiceProvider.d.ts +3 -1
- package/dist/services/rate-limiter/RateLimiterServiceProvider.d.ts.map +1 -1
- package/dist/services/router/ApiRouterServiceContainer.d.ts +5 -1
- package/dist/services/router/ApiRouterServiceContainer.d.ts.map +1 -1
- package/dist/services/router/ApiRouterServiceProvider.d.ts +3 -4
- package/dist/services/router/ApiRouterServiceProvider.d.ts.map +1 -1
- package/dist/services/router/ViewRouterServiceContainer.d.ts +11 -1
- package/dist/services/router/ViewRouterServiceContainer.d.ts.map +1 -1
- package/dist/services/router/ViewRouterServiceProvider.d.ts +4 -9
- package/dist/services/router/ViewRouterServiceProvider.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-0fd23409fff0376b.js +0 -2
- package/dist/chunk-2573b2361de4a370.js +0 -2
- package/dist/chunk-33abc8f4f7df6791.js +0 -2
- package/dist/chunk-6286081da32e2feb.js +0 -2
- package/dist/chunk-9a9d43e4b919c267.js +0 -2
- package/dist/chunk-c459f3e37965c22f.js +0 -2
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{C as
|
|
1
|
+
import{K as D} from"./chunk-0d97333b6af9fc45.js";var C=D((h,A)=>{var{defineProperty:Q,getOwnPropertyDescriptor:M,getOwnPropertyNames:J}=Object,V=Object.prototype.hasOwnProperty,I=(j,b)=>Q(j,"name",{value:b,configurable:!0}),w=(j,b)=>{for(var F in b)Q(j,F,{get:b[F],enumerable:!0})},O=(j,b,F,B)=>{if(b&&typeof b==="object"||typeof b==="function"){for(let G of J(b))if(!V.call(j,G)&&G!==F)Q(j,G,{get:()=>b[G],enumerable:!(B=M(b,G))||B.enumerable})}return j},q=(j)=>O(Q({},"__esModule",{value:!0}),j),Y={};w(Y,{CredentialsProviderError:()=>L,ProviderError:()=>U,TokenProviderError:()=>S,chain:()=>T,fromStatic:()=>N,memoize:()=>R});A.exports=q(Y);var Z=class j extends Error{constructor(b,F=!0){var B;let G,H=!0;if(typeof F==="boolean")G=void 0,H=F;else if(F!=null&&typeof F==="object")G=F.logger,H=F.tryNextLink??!0;super(b);this.name="ProviderError",this.tryNextLink=H,Object.setPrototypeOf(this,j.prototype),(B=G==null?void 0:G.debug)==null||B.call(G,`@smithy/property-provider ${H?"->":"(!)"} ${b}`)}static from(b,F=!0){return Object.assign(new this(b.message,F),b)}};I(Z,"ProviderError");var U=Z,$=class j extends U{constructor(b,F=!0){super(b,F);this.name="CredentialsProviderError",Object.setPrototypeOf(this,j.prototype)}};I($,"CredentialsProviderError");var L=$,z=class j extends U{constructor(b,F=!0){super(b,F);this.name="TokenProviderError",Object.setPrototypeOf(this,j.prototype)}};I(z,"TokenProviderError");var S=z,T=I((...j)=>async()=>{if(j.length===0)throw new U("No providers in chain");let b;for(let F of j)try{return await F()}catch(B){if(b=B,B==null?void 0:B.tryNextLink)continue;throw B}throw b},"chain"),N=I((j)=>()=>Promise.resolve(j),"fromStatic"),R=I((j,b,F)=>{let B,G,H,W=!1;const X=I(async()=>{if(!G)G=j();try{B=await G,H=!0,W=!1}finally{G=void 0}return B},"coalesceProvider");if(b===void 0)return async(K)=>{if(!H||(K==null?void 0:K.forceRefresh))B=await X();return B};return async(K)=>{if(!H||(K==null?void 0:K.forceRefresh))B=await X();if(W)return B;if(F&&!F(B))return W=!0,B;if(b(B))return await X(),B;return B}},"memoize")});
|
|
2
|
+
export{C as Fb};
|
|
3
|
+
|
|
4
|
+
//# debugId=CD4BFDD46EC4CBB864756e2164756e21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../node_modules/@smithy/property-provider/dist-cjs/index.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __name = (target, value) => __defProp(target, \"name\", { value, configurable: true });\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/index.ts\nvar src_exports = {};\n__export(src_exports, {\n CredentialsProviderError: () => CredentialsProviderError,\n ProviderError: () => ProviderError,\n TokenProviderError: () => TokenProviderError,\n chain: () => chain,\n fromStatic: () => fromStatic,\n memoize: () => memoize\n});\nmodule.exports = __toCommonJS(src_exports);\n\n// src/ProviderError.ts\nvar _ProviderError = class _ProviderError extends Error {\n constructor(message, options = true) {\n var _a;\n let logger;\n let tryNextLink = true;\n if (typeof options === \"boolean\") {\n logger = void 0;\n tryNextLink = options;\n } else if (options != null && typeof options === \"object\") {\n logger = options.logger;\n tryNextLink = options.tryNextLink ?? true;\n }\n super(message);\n this.name = \"ProviderError\";\n this.tryNextLink = tryNextLink;\n Object.setPrototypeOf(this, _ProviderError.prototype);\n (_a = logger == null ? void 0 : logger.debug) == null ? void 0 : _a.call(logger, `@smithy/property-provider ${tryNextLink ? \"->\" : \"(!)\"} ${message}`);\n }\n /**\n * @deprecated use new operator.\n */\n static from(error, options = true) {\n return Object.assign(new this(error.message, options), error);\n }\n};\n__name(_ProviderError, \"ProviderError\");\nvar ProviderError = _ProviderError;\n\n// src/CredentialsProviderError.ts\nvar _CredentialsProviderError = class _CredentialsProviderError extends ProviderError {\n /**\n * @override\n */\n constructor(message, options = true) {\n super(message, options);\n this.name = \"CredentialsProviderError\";\n Object.setPrototypeOf(this, _CredentialsProviderError.prototype);\n }\n};\n__name(_CredentialsProviderError, \"CredentialsProviderError\");\nvar CredentialsProviderError = _CredentialsProviderError;\n\n// src/TokenProviderError.ts\nvar _TokenProviderError = class _TokenProviderError extends ProviderError {\n /**\n * @override\n */\n constructor(message, options = true) {\n super(message, options);\n this.name = \"TokenProviderError\";\n Object.setPrototypeOf(this, _TokenProviderError.prototype);\n }\n};\n__name(_TokenProviderError, \"TokenProviderError\");\nvar TokenProviderError = _TokenProviderError;\n\n// src/chain.ts\nvar chain = /* @__PURE__ */ __name((...providers) => async () => {\n if (providers.length === 0) {\n throw new ProviderError(\"No providers in chain\");\n }\n let lastProviderError;\n for (const provider of providers) {\n try {\n const credentials = await provider();\n return credentials;\n } catch (err) {\n lastProviderError = err;\n if (err == null ? void 0 : err.tryNextLink) {\n continue;\n }\n throw err;\n }\n }\n throw lastProviderError;\n}, \"chain\");\n\n// src/fromStatic.ts\nvar fromStatic = /* @__PURE__ */ __name((staticValue) => () => Promise.resolve(staticValue), \"fromStatic\");\n\n// src/memoize.ts\nvar memoize = /* @__PURE__ */ __name((provider, isExpired, requiresRefresh) => {\n let resolved;\n let pending;\n let hasResult;\n let isConstant = false;\n const coalesceProvider = /* @__PURE__ */ __name(async () => {\n if (!pending) {\n pending = provider();\n }\n try {\n resolved = await pending;\n hasResult = true;\n isConstant = false;\n } finally {\n pending = void 0;\n }\n return resolved;\n }, \"coalesceProvider\");\n if (isExpired === void 0) {\n return async (options) => {\n if (!hasResult || (options == null ? void 0 : options.forceRefresh)) {\n resolved = await coalesceProvider();\n }\n return resolved;\n };\n }\n return async (options) => {\n if (!hasResult || (options == null ? void 0 : options.forceRefresh)) {\n resolved = await coalesceProvider();\n }\n if (isConstant) {\n return resolved;\n }\n if (requiresRefresh && !requiresRefresh(resolved)) {\n isConstant = true;\n return resolved;\n }\n if (isExpired(resolved)) {\n await coalesceProvider();\n return resolved;\n }\n return resolved;\n };\n}, \"memoize\");\n// Annotate the CommonJS export names for ESM import in node:\n\n0 && (module.exports = {\n CredentialsProviderError,\n ProviderError,\n TokenProviderError,\n chain,\n fromStatic,\n memoize\n});\n\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": "iEAAA,IAAuB,eAAnB,EAC0B,yBAA1B,EAC2B,oBAA3B,GADmB,OAEnB,EAAe,OAAO,UAAU,eAChC,EAAS,CAAC,EAAQ,IAAU,EAAU,EAAQ,OAAQ,CAAE,QAAO,aAAc,EAAK,CAAC,EACnF,EAAW,CAAC,EAAQ,IAAQ,CAC9B,QAAS,KAAQ,EACf,EAAU,EAAQ,EAAM,CAAE,IAAK,EAAI,GAAO,WAAY,EAAK,CAAC,GAE5D,EAAc,CAAC,EAAI,EAAM,EAAQ,IAAS,CAC5C,GAAI,UAAe,IAAS,iBAAmB,IAAS,YACtD,QAAS,KAAO,EAAkB,CAAI,EACpC,IAAK,EAAa,KAAK,EAAI,CAAG,GAAK,IAAQ,EACzC,EAAU,EAAI,EAAK,CAAE,IA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chunk-0d97333b6af9fc45.js";import"./chunk-9f9e21f9fd0d6af1.js";import{Fb as _} from"./chunk-cd4bfdd46ec4cbb8.js";import{Ib as N,Jb as W,Kb as I,Nb as v,Ob as P} from"./chunk-bace428bfab523c4.js";var T=h(_(),1);var H=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var u=h(_(),1);var K=300000,g="To refresh this SSO session run 'aws sso login' with the corresponding profile.";var R={},b=async(e)=>{const{SSOOIDCClient:r}=await import("./chunk-278677330e53423b.js");if(R[e])return R[e];const s=new r({region:e});return R[e]=s,s};var G=async(e,r)=>{const{CreateTokenCommand:s}=await import("./chunk-278677330e53423b.js");return(await b(r)).send(new s({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};var U=h(_(),1);var D=(e)=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new U.TokenProviderError(`Token is expired. ${g}`,!1)};var q=h(_(),1);var p=(e,r,s=!1)=>{if(typeof r==="undefined")throw new q.TokenProviderError(`Value not present for '${e}' in SSO Token${s?". Cannot refresh":""}. ${g}`,!1)};import{promises as B} from"fs";var{writeFile:Q}=B,j=(e,r)=>{const s=W(e),t=JSON.stringify(r,null,2);return Q(s,t)};var X=new Date(0),z=(e={})=>async()=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");const r=await P(e),s=N(e),t=r[s];if(!t)throw new u.TokenProviderError(`Profile '${s}' could not be found in shared credentials file.`,!1);else if(!t.sso_session)throw new u.TokenProviderError(`Profile '${s}' is missing required property 'sso_session'.`);const i=t.sso_session,a=(await v(e))[i];if(!a)throw new u.TokenProviderError(`Sso session '${i}' could not be found in shared credentials file.`,!1);for(let n of["sso_start_url","sso_region"])if(!a[n])throw new u.TokenProviderError(`Sso session '${i}' is missing required property '${n}'.`,!1);const{sso_start_url:l,sso_region:f}=a;let o;try{o=await I(i)}catch(n){throw new u.TokenProviderError(`The SSO session token associated with profile=${s} was not found or is invalid. ${g}`,!1)}p("accessToken",o.accessToken),p("expiresAt",o.expiresAt);const{accessToken:E,expiresAt:x}=o,c={token:E,expiration:new Date(x)};if(c.expiration.getTime()-Date.now()>K)return c;if(Date.now()-X.getTime()<30000)return D(c),c;p("clientId",o.clientId,!0),p("clientSecret",o.clientSecret,!0),p("refreshToken",o.refreshToken,!0);try{X.setTime(Date.now());const n=await G(o,f);p("accessToken",n.accessToken),p("expiresIn",n.expiresIn);const w=new Date(Date.now()+n.expiresIn*1000);try{await j(i,{...o,accessToken:n.accessToken,expiresAt:w.toISOString(),refreshToken:n.refreshToken})}catch(C){}return{token:n.accessToken,expiration:w}}catch(n){return D(c),c}};var k=h(_(),1);var y=!1,A=async({ssoStartUrl:e,ssoSession:r,ssoAccountId:s,ssoRegion:t,ssoRoleName:i,ssoClient:S,clientConfig:a,profile:l,logger:f})=>{let o;const E="To refresh this SSO session run aws sso login with the corresponding profile.";if(r)try{const d=await z({profile:l})();o={accessToken:d.token,expiresAt:new Date(d.expiration).toISOString()}}catch(d){throw new k.CredentialsProviderError(d.message,{tryNextLink:y,logger:f})}else try{o=await I(e)}catch(d){throw new k.CredentialsProviderError("The SSO session associated with this profile is invalid. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:y,logger:f})}if(new Date(o.expiresAt).getTime()-Date.now()<=0)throw new k.CredentialsProviderError("The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.",{tryNextLink:y,logger:f});const{accessToken:x}=o,{SSOClient:c,GetRoleCredentialsCommand:n}=await import("./chunk-9ff3d7096b6de8eb.js"),w=S||new c(Object.assign({},a??{},{region:a?.region??t}));let C;try{C=await w.send(new n({accountId:s,roleName:i,accessToken:x}))}catch(d){throw new k.CredentialsProviderError(d,{tryNextLink:y,logger:f})}const{roleCredentials:{accessKeyId:m,secretAccessKey:O,sessionToken:$,expiration:F,credentialScope:L,accountId:M}={}}=C;if(!m||!O||!$||!F)throw new k.CredentialsProviderError("SSO returns an invalid temporary credential.",{tryNextLink:y,logger:f});return{accessKeyId:m,secretAccessKey:O,sessionToken:$,expiration:new Date(F),...L&&{credentialScope:L},...M&&{accountId:M}}};var J=h(_(),1),V=(e,r)=>{const{sso_start_url:s,sso_account_id:t,sso_region:i,sso_role_name:S}=e;if(!s||!t||!i||!S)throw new J.CredentialsProviderError('Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", '+`"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:r});return e};var Ee=(e={})=>async()=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:r,ssoAccountId:s,ssoRegion:t,ssoRoleName:i,ssoSession:S}=e,{ssoClient:a}=e,l=N(e);if(!r&&!s&&!t&&!i&&!S){const o=(await P(e))[l];if(!o)throw new T.CredentialsProviderError(`Profile ${l} was not found.`,{logger:e.logger});if(!H(o))throw new T.CredentialsProviderError(`Profile ${l} is not configured with SSO credentials.`,{logger:e.logger});if(o?.sso_session){const m=(await v(e))[o.sso_session],O=` configurations in profile ${l} and sso-session ${o.sso_session}`;if(t&&t!==m.sso_region)throw new T.CredentialsProviderError("Conflicting SSO region"+O,{tryNextLink:!1,logger:e.logger});if(r&&r!==m.sso_start_url)throw new T.CredentialsProviderError("Conflicting SSO start_url"+O,{tryNextLink:!1,logger:e.logger});o.sso_region=m.sso_region,o.sso_start_url=m.sso_start_url}const{sso_start_url:E,sso_account_id:x,sso_region:c,sso_role_name:n,sso_session:w}=V(o,e.logger);return A({ssoStartUrl:E,ssoSession:w,ssoAccountId:x,ssoRegion:c,ssoRoleName:n,ssoClient:a,clientConfig:e.clientConfig,profile:l})}else if(!r||!s||!t||!i)throw new T.CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger});else return A({ssoStartUrl:r,ssoSession:S,ssoAccountId:s,ssoRegion:t,ssoRoleName:i,ssoClient:a,clientConfig:e.clientConfig,profile:l})};export{V as validateSsoProfile,H as isSsoProfile,Ee as fromSSO};
|
|
3
|
+
|
|
4
|
+
//# debugId=CD9C5E8A6C80384F64756e2164756e21
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/fromSSO.js", "../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/isSsoProfile.js", "../../../node_modules/@aws-sdk/token-providers/dist-es/fromSso.js", "../../../node_modules/@aws-sdk/token-providers/dist-es/constants.js", "../../../node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js", "../../../node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js", "../../../node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js", "../../../node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js", "../../../node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js", "../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js", "../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/validateSsoProfile.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { CredentialsProviderError } from \"@smithy/property-provider\";\nimport { getProfileName, loadSsoSessionData, parseKnownFiles } from \"@smithy/shared-ini-file-loader\";\nimport { isSsoProfile } from \"./isSsoProfile\";\nimport { resolveSSOCredentials } from \"./resolveSSOCredentials\";\nimport { validateSsoProfile } from \"./validateSsoProfile\";\nexport const fromSSO = (init = {}) => async () => {\n init.logger?.debug(\"@aws-sdk/credential-provider-sso - fromSSO\");\n const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;\n const { ssoClient } = init;\n const profileName = getProfileName(init);\n if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {\n const profiles = await parseKnownFiles(init);\n const profile = profiles[profileName];\n if (!profile) {\n throw new CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });\n }\n if (!isSsoProfile(profile)) {\n throw new CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, {\n logger: init.logger,\n });\n }\n if (profile?.sso_session) {\n const ssoSessions = await loadSsoSessionData(init);\n const session = ssoSessions[profile.sso_session];\n const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;\n if (ssoRegion && ssoRegion !== session.sso_region) {\n throw new CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {\n tryNextLink: false,\n logger: init.logger,\n });\n }\n if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {\n throw new CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {\n tryNextLink: false,\n logger: init.logger,\n });\n }\n profile.sso_region = session.sso_region;\n profile.sso_start_url = session.sso_start_url;\n }\n const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile(profile, init.logger);\n return resolveSSOCredentials({\n ssoStartUrl: sso_start_url,\n ssoSession: sso_session,\n ssoAccountId: sso_account_id,\n ssoRegion: sso_region,\n ssoRoleName: sso_role_name,\n ssoClient: ssoClient,\n clientConfig: init.clientConfig,\n profile: profileName,\n });\n }\n else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {\n throw new CredentialsProviderError(\"Incomplete configuration. The fromSSO() argument hash must include \" +\n '\"ssoStartUrl\", \"ssoAccountId\", \"ssoRegion\", \"ssoRoleName\"', { tryNextLink: false, logger: init.logger });\n }\n else {\n return resolveSSOCredentials({\n ssoStartUrl,\n ssoSession,\n ssoAccountId,\n ssoRegion,\n ssoRoleName,\n ssoClient,\n clientConfig: init.clientConfig,\n profile: profileName,\n });\n }\n};\n",
|
|
6
|
+
"export const isSsoProfile = (arg) => arg &&\n (typeof arg.sso_start_url === \"string\" ||\n typeof arg.sso_account_id === \"string\" ||\n typeof arg.sso_session === \"string\" ||\n typeof arg.sso_region === \"string\" ||\n typeof arg.sso_role_name === \"string\");\n",
|
|
7
|
+
"import { TokenProviderError } from \"@smithy/property-provider\";\nimport { getProfileName, getSSOTokenFromFile, loadSsoSessionData, parseKnownFiles, } from \"@smithy/shared-ini-file-loader\";\nimport { EXPIRE_WINDOW_MS, REFRESH_MESSAGE } from \"./constants\";\nimport { getNewSsoOidcToken } from \"./getNewSsoOidcToken\";\nimport { validateTokenExpiry } from \"./validateTokenExpiry\";\nimport { validateTokenKey } from \"./validateTokenKey\";\nimport { writeSSOTokenToFile } from \"./writeSSOTokenToFile\";\nconst lastRefreshAttemptTime = new Date(0);\nexport const fromSso = (init = {}) => async () => {\n init.logger?.debug(\"@aws-sdk/token-providers - fromSso\");\n const profiles = await parseKnownFiles(init);\n const profileName = getProfileName(init);\n const profile = profiles[profileName];\n if (!profile) {\n throw new TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);\n }\n else if (!profile[\"sso_session\"]) {\n throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);\n }\n const ssoSessionName = profile[\"sso_session\"];\n const ssoSessions = await loadSsoSessionData(init);\n const ssoSession = ssoSessions[ssoSessionName];\n if (!ssoSession) {\n throw new TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);\n }\n for (const ssoSessionRequiredKey of [\"sso_start_url\", \"sso_region\"]) {\n if (!ssoSession[ssoSessionRequiredKey]) {\n throw new TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);\n }\n }\n const ssoStartUrl = ssoSession[\"sso_start_url\"];\n const ssoRegion = ssoSession[\"sso_region\"];\n let ssoToken;\n try {\n ssoToken = await getSSOTokenFromFile(ssoSessionName);\n }\n catch (e) {\n throw new TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);\n }\n validateTokenKey(\"accessToken\", ssoToken.accessToken);\n validateTokenKey(\"expiresAt\", ssoToken.expiresAt);\n const { accessToken, expiresAt } = ssoToken;\n const existingToken = { token: accessToken, expiration: new Date(expiresAt) };\n if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {\n return existingToken;\n }\n if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1000) {\n validateTokenExpiry(existingToken);\n return existingToken;\n }\n validateTokenKey(\"clientId\", ssoToken.clientId, true);\n validateTokenKey(\"clientSecret\", ssoToken.clientSecret, true);\n validateTokenKey(\"refreshToken\", ssoToken.refreshToken, true);\n try {\n lastRefreshAttemptTime.setTime(Date.now());\n const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion);\n validateTokenKey(\"accessToken\", newSsoOidcToken.accessToken);\n validateTokenKey(\"expiresIn\", newSsoOidcToken.expiresIn);\n const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);\n try {\n await writeSSOTokenToFile(ssoSessionName, {\n ...ssoToken,\n accessToken: newSsoOidcToken.accessToken,\n expiresAt: newTokenExpiration.toISOString(),\n refreshToken: newSsoOidcToken.refreshToken,\n });\n }\n catch (error) {\n }\n return {\n token: newSsoOidcToken.accessToken,\n expiration: newTokenExpiration,\n };\n }\n catch (error) {\n validateTokenExpiry(existingToken);\n return existingToken;\n }\n};\n",
|
|
8
|
+
"export const EXPIRE_WINDOW_MS = 5 * 60 * 1000;\nexport const REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;\n",
|
|
9
|
+
"const ssoOidcClientsHash = {};\nexport const getSsoOidcClient = async (ssoRegion) => {\n const { SSOOIDCClient } = await import(\"@aws-sdk/client-sso-oidc\");\n if (ssoOidcClientsHash[ssoRegion]) {\n return ssoOidcClientsHash[ssoRegion];\n }\n const ssoOidcClient = new SSOOIDCClient({ region: ssoRegion });\n ssoOidcClientsHash[ssoRegion] = ssoOidcClient;\n return ssoOidcClient;\n};\n",
|
|
10
|
+
"import { getSsoOidcClient } from \"./getSsoOidcClient\";\nexport const getNewSsoOidcToken = async (ssoToken, ssoRegion) => {\n const { CreateTokenCommand } = await import(\"@aws-sdk/client-sso-oidc\");\n const ssoOidcClient = await getSsoOidcClient(ssoRegion);\n return ssoOidcClient.send(new CreateTokenCommand({\n clientId: ssoToken.clientId,\n clientSecret: ssoToken.clientSecret,\n refreshToken: ssoToken.refreshToken,\n grantType: \"refresh_token\",\n }));\n};\n",
|
|
11
|
+
"import { TokenProviderError } from \"@smithy/property-provider\";\nimport { REFRESH_MESSAGE } from \"./constants\";\nexport const validateTokenExpiry = (token) => {\n if (token.expiration && token.expiration.getTime() < Date.now()) {\n throw new TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);\n }\n};\n",
|
|
12
|
+
"import { TokenProviderError } from \"@smithy/property-provider\";\nimport { REFRESH_MESSAGE } from \"./constants\";\nexport const validateTokenKey = (key, value, forRefresh = false) => {\n if (typeof value === \"undefined\") {\n throw new TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? \". Cannot refresh\" : \"\"}. ${REFRESH_MESSAGE}`, false);\n }\n};\n",
|
|
13
|
+
"import { getSSOTokenFilepath } from \"@smithy/shared-ini-file-loader\";\nimport { promises as fsPromises } from \"fs\";\nconst { writeFile } = fsPromises;\nexport const writeSSOTokenToFile = (id, ssoToken) => {\n const tokenFilepath = getSSOTokenFilepath(id);\n const tokenString = JSON.stringify(ssoToken, null, 2);\n return writeFile(tokenFilepath, tokenString);\n};\n",
|
|
14
|
+
"import { fromSso as getSsoTokenProvider } from \"@aws-sdk/token-providers\";\nimport { CredentialsProviderError } from \"@smithy/property-provider\";\nimport { getSSOTokenFromFile } from \"@smithy/shared-ini-file-loader\";\nconst SHOULD_FAIL_CREDENTIAL_CHAIN = false;\nexport const resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, profile, logger, }) => {\n let token;\n const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;\n if (ssoSession) {\n try {\n const _token = await getSsoTokenProvider({ profile })();\n token = {\n accessToken: _token.token,\n expiresAt: new Date(_token.expiration).toISOString(),\n };\n }\n catch (e) {\n throw new CredentialsProviderError(e.message, {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n }\n else {\n try {\n token = await getSSOTokenFromFile(ssoStartUrl);\n }\n catch (e) {\n throw new CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n }\n if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {\n throw new CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n const { accessToken } = token;\n const { SSOClient, GetRoleCredentialsCommand } = await import(\"./loadSso\");\n const sso = ssoClient ||\n new SSOClient(Object.assign({}, clientConfig ?? {}, {\n region: clientConfig?.region ?? ssoRegion,\n }));\n let ssoResp;\n try {\n ssoResp = await sso.send(new GetRoleCredentialsCommand({\n accountId: ssoAccountId,\n roleName: ssoRoleName,\n accessToken,\n }));\n }\n catch (e) {\n throw new CredentialsProviderError(e, {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {}, } = ssoResp;\n if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {\n throw new CredentialsProviderError(\"SSO returns an invalid temporary credential.\", {\n tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,\n logger,\n });\n }\n return {\n accessKeyId,\n secretAccessKey,\n sessionToken,\n expiration: new Date(expiration),\n ...(credentialScope && { credentialScope }),\n ...(accountId && { accountId }),\n };\n};\n",
|
|
15
|
+
"import { CredentialsProviderError } from \"@smithy/property-provider\";\nexport const validateSsoProfile = (profile, logger) => {\n const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;\n if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {\n throw new CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters \"sso_account_id\", ` +\n `\"sso_region\", \"sso_role_name\", \"sso_start_url\". Got ${Object.keys(profile).join(\", \")}\\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });\n }\n return profile;\n};\n"
|
|
16
|
+
],
|
|
17
|
+
"mappings": ";mNAAA,iBCAO,MAAM,IAAe,CAAC,IAAQ,WACzB,EAAI,gBAAkB,iBACnB,EAAI,iBAAmB,iBACvB,EAAI,cAAgB,iBACpB,EAAI,aAAe,iBACnB,EAAI,gBAAkB,UCLrC,eCAO,IAAM,EAAmB,OACnB,EAAkB,kFCD/B,IAAM,EAAqB,CAAC,EACf,EAAmB,MAAO,IAAc,CACjD,MAAQ,iBAAkB,KAAa,uCACvC,GAAI,EAAmB,GACnB,OAAO,EAAmB,GAE9B,MAAM,EAAgB,IAAI,EAAc,CAAE,OAAQ,CAAU,CAAC,EAE7D,OADA,EAAmB,GAAa,EACzB,GCPJ,IAAM,EAAqB,MAAO,EAAU,IAAc,CAC7D,MAAQ,sBAAuB,KAAa,uCAE5C,OADsB,MAAM,EAAiB,CAAS,GACjC,KAAK,IAAI,EAAmB,CAC7C,SAAU,EAAS,SACnB,aAAc,EAAS,aACvB,aAAc,EAAS,aACvB,UAAW,eACf,CAAC,CAAC,GCTN,eAEO,IAAM,EAAsB,CAAC,IAAU,CAC1C,GAAI,EAAM,YAAc,EAAM,WAAW,QAAQ,EAAI,KAAK,IAAI,EAC1D,MAAM,IAAI,qBAAmB,qBAAqB,IAAmB,EAAK,GCJlF,eAEO,IAAM,EAAmB,CAAC,EAAK,EAAO,EAAa,KAAU,CAChE,UAAW,IAAU,YACjB,MAAM,IAAI,qBAAmB,0BAA0B,kBAAoB,EAAa,mBAAqB,OAAO,IA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AQ,EAAK,MACjB,CAAC,EAEL,GAAI,GAAS,YAAa,CAEtB,MAAM,GADc,MAAM,EAAmB,CAAI,GACrB,EAAQ,aAC9B,EAAc,8BAA8B,qBAA+B,EAAQ,cACzF,GAAI,GAAa,IAAc,EAAQ,WACnC,MAAM,IAAI,2BAAyB,yBAA2B,EAAa,CACvE,YAAa,GACb,OAAQ,EAAK,MACjB,CAAC,EAEL,GAAI,GAAe,IAAgB,EAAQ,cACvC,MAAM,IAAI,2BAAyB,4BAA8B,EAAa,CAC1E,YAAa,GACb,OAAQ,EAAK,MACjB,CAAC,EAEL,EAAQ,WAAa,EAAQ,WAC7B,EAAQ,cAAgB,EAAQ,cAEpC,MAAQ,gBAAe,iBAAgB,aAAY,gBAAe,eAAgB,EAAmB,EAAS,EAAK,MAAM,EACzH,OAAO,EAAsB,CACzB,YAAa,EACb,WAAY,EACZ,aAAc,EACd,UAAW,EACX,YAAa,EACb,UAAW,EACX,aAAc,EAAK,aACnB,QAAS,CACb,CAAC,WAEK,IAAgB,IAAiB,IAAc,EACrD,MAAM,IAAI,2BAAyB,+HAC8B,CAAE,YAAa,GAAO,OAAQ,EAAK,MAAO,CAAC,MAG5G,QAAO,EAAsB,CACzB,cACA,aACA,eACA,YACA,cACA,YACA,aAAc,EAAK,aACnB,QAAS,CACb,CAAC",
|
|
18
|
+
"debugId": "CD9C5E8A6C80384F64756e2164756e21",
|
|
19
|
+
"names": []
|
|
20
|
+
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{J as _} from"./chunk-0d97333b6af9fc45.js";import{Fb as S} from"./chunk-cd4bfdd46ec4cbb8.js";var E=_(S(),1),p="AWS_ACCESS_KEY_ID",A="AWS_SECRET_ACCESS_KEY",C="AWS_SESSION_TOKEN",N="AWS_CREDENTIAL_EXPIRATION",I="AWS_CREDENTIAL_SCOPE",a="AWS_ACCOUNT_ID",i=(e)=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");const o=process.env[p],r=process.env[A],n=process.env[C],s=process.env[N],t=process.env[I],c=process.env[a];if(o&&r)return{accessKeyId:o,secretAccessKey:r,...n&&{sessionToken:n},...s&&{expiration:new Date(s)},...t&&{credentialScope:t},...c&&{accountId:c}};throw new E.CredentialsProviderError("Unable to find environment variable credentials.",{logger:e?.logger})};export{i as fromEnv,C as ENV_SESSION,A as ENV_SECRET,p as ENV_KEY,N as ENV_EXPIRATION,I as ENV_CREDENTIAL_SCOPE,a as ENV_ACCOUNT_ID};export{p as D,A as E,i as F};
|
|
3
|
+
|
|
4
|
+
//# debugId=D5B8023C223E3A6064756e2164756e21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../node_modules/@aws-sdk/credential-provider-env/dist-es/fromEnv.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { CredentialsProviderError } from \"@smithy/property-provider\";\nexport const ENV_KEY = \"AWS_ACCESS_KEY_ID\";\nexport const ENV_SECRET = \"AWS_SECRET_ACCESS_KEY\";\nexport const ENV_SESSION = \"AWS_SESSION_TOKEN\";\nexport const ENV_EXPIRATION = \"AWS_CREDENTIAL_EXPIRATION\";\nexport const ENV_CREDENTIAL_SCOPE = \"AWS_CREDENTIAL_SCOPE\";\nexport const ENV_ACCOUNT_ID = \"AWS_ACCOUNT_ID\";\nexport const fromEnv = (init) => async () => {\n init?.logger?.debug(\"@aws-sdk/credential-provider-env - fromEnv\");\n const accessKeyId = process.env[ENV_KEY];\n const secretAccessKey = process.env[ENV_SECRET];\n const sessionToken = process.env[ENV_SESSION];\n const expiry = process.env[ENV_EXPIRATION];\n const credentialScope = process.env[ENV_CREDENTIAL_SCOPE];\n const accountId = process.env[ENV_ACCOUNT_ID];\n if (accessKeyId && secretAccessKey) {\n return {\n accessKeyId,\n secretAccessKey,\n ...(sessionToken && { sessionToken }),\n ...(expiry && { expiration: new Date(expiry) }),\n ...(credentialScope && { credentialScope }),\n ...(accountId && { accountId }),\n };\n }\n throw new CredentialsProviderError(\"Unable to find environment variable credentials.\", { logger: init?.logger });\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";iGAAA,iBACa,EAAU,oBACV,EAAa,wBACb,EAAc,oBACd,EAAiB,4BACjB,EAAuB,uBACvB,EAAiB,iBACjB,EAAU,CAAC,IAAS,SAAY,CACzC,GAAM,QAAQ,MAAM,4CAA4C,EAChE,MAAM,EAAc,QAAQ,IAAI,GAC1B,EAAkB,QAAQ,IAAI,GAC9B,EAAe,QAAQ,IAAI,GAC3B,EAAS,QAAQ,IAAI,GACrB,EAAkB,QAAQ,IAAI,GAC9B,EAAY,QAAQ,IAAI,GAC9B,GAAI,GAAe,EACf,MAAO,CACH,cACA,qBACI,GAAgB,CAAE,cAAa,KAC/B,GAAU,CAAE,WAAY,IAAI,KAAK,CAAM,CAAE,KACzC,GAAmB,CAAE,iBAAgB,KACrC,GAAa,CAAE,WAAU,CACjC,EAEJ,MAAM,IAAI,2BAAyB,mDAAoD,CAAE,OAAQ,GAAM,MAAO,CAAC",
|
|
8
|
+
"debugId": "D5B8023C223E3A6064756e2164756e21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{e as zr,h as or,i as ur} from"./http/index.js";import{q as tr,r as Gr,t as Yr,v as Xr} from"./facades/index.js";import{H as kr} from"./chunk-642b04056dab5d64.js";import{N as Y} from"./chunk-2f8cf8372320b622.js";import{Suspense as Re,useContext as nr,useEffect as Wr,useState as yr,StrictMode as be} from"react";import{createContext as qr} from"react";import{jsxDEV as Br} from"react/jsx-dev-runtime";var Q=qr({}),ir=(r)=>{let e=r.value;if(r.value)e=r.value;else e=window.__GEMI_DATA__;return Br(Q.Provider,{value:e,children:r.children},void 0,!1,void 0,this)};var G=function(){return G=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(r[s]=t[s])}return r},G.apply(null,arguments)};var Ur=function(r,e){if(!r){if(typeof console!=="undefined")console.warn(e);try{throw new Error(e)}catch(t){}}},ar=function(r){if(r===void 0)r={};var e=r,t=e.window,s=t===void 0?document.defaultView:t,n=s.history;function o(){var m=s.location,a=m.pathname,M=m.search,P=m.hash,S=n.state||{};return[S.idx,cr({pathname:a,search:M,hash:P,state:S.usr||null,key:S.key||"default"})]}var u=null;function i(){if(u)l.call(u),u=null;else{var m=J.Pop,a=o(),M=a[0],P=a[1];if(l.length)if(M!=null){var S=f-M;if(S)u={action:m,location:P,retry:function c(){T(S*-1)}},T(S)}else Ur(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else R(m)}}s.addEventListener(Ir,i);var g=J.Pop,C=o(),f=C[0],h=C[1],V=pr(),l=pr();if(f==null)f=0,n.replaceState(G({},n.state,{idx:f}),"");function v(m){return typeof m==="string"?m:Lr(m)}function W(m,a){if(a===void 0)a=null;return cr(G({pathname:h.pathname,hash:"",search:""},typeof m==="string"?_r(m):m,{state:a,key:Hr()}))}function p(m,a){return[{usr:m.state,key:m.key,idx:a},v(m)]}function b(m,a,M){return!l.length||(l.call({action:m,location:a,retry:M}),!1)}function R(m){g=m;var a=o();f=a[0],h=a[1],V.call({action:g,location:h})}function D(m,a){var M=J.Push,P=W(m,a);function S(){D(m,a)}if(b(M,P,S)){var c=p(P,f+1),w=c[0],y=c[1];try{n.pushState(w,"",y)}catch(E){s.location.assign(y)}R(M)}}function j(m,a){var M=J.Replace,P=W(m,a);function S(){j(m,a)}if(b(M,P,S)){var c=p(P,f),w=c[0],y=c[1];n.replaceState(w,"",y),R(M)}}function T(m){n.go(m)}var F={get action(){return g},get location(){return h},createHref:v,push:D,replace:j,go:T,back:function m(){T(-1)},forward:function m(){T(1)},listen:function m(a){return V.push(a)},block:function m(a){var M=l.push(a);if(l.length===1)s.addEventListener(mr,fr);return function(){if(M(),!l.length)s.removeEventListener(mr,fr)}}};return F};var fr=function(r){r.preventDefault(),r.returnValue=""},pr=function(){var r=[];return{get length(){return r.length},push:function e(t){return r.push(t),function(){r=r.filter(function(s){return s!==t})}},call:function e(t){r.forEach(function(s){return s&&s(t)})}}},Hr=function(){return Math.random().toString(36).substr(2,8)},Lr=function(r){var e=r.pathname,t=e===void 0?"/":e,s=r.search,n=s===void 0?"":s,o=r.hash,u=o===void 0?"":o;if(n&&n!=="?")t+=n.charAt(0)==="?"?n:"?"+n;if(u&&u!=="#")t+=u.charAt(0)==="#"?u:"#"+u;return t},_r=function(r){var e={};if(r){var t=r.indexOf("#");if(t>=0)e.hash=r.substr(t),r=r.substr(0,t);var s=r.indexOf("?");if(s>=0)e.search=r.substr(s),r=r.substr(0,s);if(r)e.pathname=r}return e},J;(function(r){r.Pop="POP",r.Push="PUSH",r.Replace="REPLACE"})(J||(J={}));var cr=function(r){return Object.freeze(r)},mr="beforeunload";var Ir="popstate";import{createContext as ce,useContext as Vr,useEffect as jr,useRef as B,useState as z} from"react";class N{subscribers=new Set;value;constructor(r){this.value=r}subscribe(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}next(r){this.value=r,this.subscribers.forEach((e)=>e(r))}getValue(){return this.value}}function gr(r){return new Promise((e)=>setTimeout(e,r))}class K{state=new N(100);unsubscribe;timer;tick=0;isTicking=!1;constructor(r){this.unsubscribe=r.subscribe((e)=>{if(e)this.start();else this.end()})}getNextIncrement(){const r=this.state.getValue();if(r===100)return Math.ceil(Math.random()*10);if(r<=20){if(Math.ceil(Math.random()*100)>80)return r;return r+Math.ceil(Math.random()*5)+1}if(r<=50){if(Math.ceil(Math.random()*100)>50)return r;return Math.min(r+Math.ceil(Math.random()*10),70)}if(r<=70){if(Math.ceil(Math.random()*100)>60)return r;return Math.min(r+Math.ceil(Math.random()*3),80)}if(r<=80)return Math.min(r+Math.ceil(Math.random()*1),90);if(r<=90){const e=Math.ceil(Math.random()*100)>50?0:1;return Math.min(r+e,94)}if(r<=94){const e=Math.ceil(Math.random()*100)>20?0:1;return Math.min(r+e,99)}}getNextInterval(){if(this.tick===0)return this.tick=1,200;const r=this.state.getValue();if(r>=88)return 400;if(r>=94)return 1000;if(r>=98)return 2000;return 100}async nextTick(){if(!this.isTicking)return;if(await gr(this.getNextInterval()),!this.isTicking)return;const r=this.getNextIncrement();this.state.next(Math.min(r,96)),await this.nextTick()}start(){this.isTicking=!0,this.nextTick()}end(){this.state.next(99),this.isTicking=!1,this.tick=0,setTimeout(()=>{this.state.next(100)},200)}destroy(){this.end(),this.unsubscribe()}}import{useEffect as oe,useState as ue} from"react";import{useContext as er} from"react";import{createContext as Kr,useContext as Ar,useState as A} from"react";import{jsxDEV as xr} from"react/jsx-dev-runtime";var x=Kr({}),lr=(r)=>{const{i18n:e}=Ar(Q),[t,s]=A(e.currentLocale),[n]=A(()=>{const f=new Map;for(let[h,V]of Object.entries(e.dictionary)){const l=new Map;for(let[v,W]of Object.entries(V))l.set(v,W);f.set(h,l)}return f}),[o,u]=A(()=>{if(!n.has(t))return{};return Object.fromEntries(n.get(t).entries())});function i(f){for(let[h,V]of Object.entries(f)){if(!n.has(h))n.set(h,new Map);const l=n.get(h);for(let[v,W]of Object.entries(V)){if(!l.has(v))l.set(v,{});l.set(v,W)}}u(Object.fromEntries(n.get(t).entries()))}const g=(f)=>{if(n.has(f))s(f),u(Object.fromEntries(n.get(f).entries()))},C=async(f,h,V)=>{if(Object.keys(e).length===0)return;const v=await(await fetch(`/api/__gemi__/services/i18n/translations?scope=${f}&locale=${h||t}`,{signal:V})).json();i(v)};return xr(x.Provider,{value:{locale:t,translations:o,changeLocale:g,updateDictionary:i,fetchTranslations:C},children:r.children},void 0,!1,void 0,this)};import{createContext as re,useContext as ee,useRef as hr} from"react";class Z{store;staleVariants=new Set;lastFetchRecord=new Map;key;constructor(r,e={}){this.key=r;const t=new Map,s=Date.now();for(let[n,o]of Object.entries(e))if(o)t.set(n,{loading:!1,data:o,error:null}),this.lastFetchRecord.set(n,s);this.store=new N(t)}getVariant(r){const e=this.store.getValue();if(!e.has(r))this.resolveVariant(r);else{const t=e.get(r);if(!t.loading){if(!t.data)return this.resolveVariant(r),e.get(r);else if(t.data){const s=this.staleVariants.has(r),n=Date.now(),o=n-(this.lastFetchRecord.get(r)??n)>5000;if(s||o)return this.lastFetchRecord.set(r,n),this.resolveVariant(r,!0),e.get(r)}}}return e.get(r)}mutate(r,e){const t=this.store.getValue(),s=t.get(r),n=e(s.data);this.staleVariants.add(r),this.store.next(t.set(r,{loading:!1,data:n,error:null})),this.resolveVariant(r);const o=[window.location.origin,this.key,r].filter((u)=>u.length>0).join("?");caches.delete(o)}async resolveVariant(r,e=!1){if(typeof window==="undefined")return;const t=this.store.getValue(),s=t.get(r);if(!e)t.set(r,{loading:!0,data:s?.data,error:s?.data});const n=[this.key,r].filter((i)=>i.length).join("?"),o=await fetch(`/api${n}`);let u=null;try{u=await o.json()}catch(i){this.store.next(t.set(r,{loading:!1,data:s?.data,error:i}))}if(o.ok)this.store.next(t.set(r,{loading:!1,data:u,error:null})),this.staleVariants.delete(r),this.lastFetchRecord.set(r,Date.now());else this.store.next(t.set(r,{loading:!1,data:s?.data,error:u}))}}import{jsxDEV as te} from"react/jsx-dev-runtime";var rr=re({getResource:(r,e={})=>{return new Z(r,e)},updatePrefecthedData:(r)=>{}}),Pr=({children:r})=>{const e=hr(new Map),{prefetchedData:t}=ee(Q),s=hr(t),n=(o)=>{for(let[u,i]of Object.entries(o))s.current[u]=i};return te(rr.Provider,{value:{updatePrefecthedData:n,getResource:(o,u)=>{let i=u;if(!i&&s.current[o])i=s.current[o];if(!e.current.has(o))e.current.set(o,new Z(o,i??{}));return e.current.get(o)}},children:r},void 0,!1,void 0,this)};function $(){const{updatePageData:r,history:e,getViewPathsFromPathname:t,getRoutePathnameFromHref:s,isNavigatingSubject:n,setNavigationAbortController:o,getScrollPosition:u}=er(d),{updatePrefecthedData:i}=er(rr),{fetchTranslations:g}=er(x);function C(f){return async(h,...V)=>{const l=new AbortController;o(l);const[v={}]=V,{search:W={},params:p={},shallow:b}={params:{},shallow:!1,...v},R=new URLSearchParams(W),D=tr(h,p),j=[tr(h,p),R.toString()].join("?");if(b){e?.[f](j);return}const T=t(h),F=new URLSearchParams(R);F.set("json","true");const m=[D,F.toString()].join("?");R.set("json","true");const a=s(h);n.next(!0);try{const[M]=await Promise.all([fetch(m,{signal:l.signal}),g(a,void 0,l.signal),...T.map((P)=>window.loaders[P]())]);if(M.ok){const{data:P,prefetchedData:S,directive:c={},is404:w=!1}=await M.json();if(c?.kind==="Redirect"){if(c?.path)n.next(!1),C("replace")(c.path,{params:{}});return}r(P),i(S),e?.[f](j,w?{status:404}:{}),setTimeout(()=>{window.scrollTo(0,u(j))},1)}}catch(M){n.next(!1)}n.next(!1)}}return{push:C("push"),replace:C("replace")}}function Rr(){const{push:r}=$(),e=q(),t=(n,o)=>{r(e.pathname,{search:n,shallow:o})};return new Cr(new URLSearchParams(e.search),t)}class Cr{r;e;constructor(r,e){this.searchParams=r;this.callback=e}get(r){return this.searchParams.get(r)}set(r,e){let t={};if(typeof r==="string"){let s=e;if(typeof e==="function")s=e(this.get(r)??"");t[r]=s}else t=r??{};for(let[s,n]of Object.entries(t)){let o=n;if(typeof n==="function")o=n(this.get(s)??"");this.searchParams.set(s,o)}return this}append(r,e){return this.searchParams.append(r,e),this}sort(){return this.searchParams.sort(),this}clear(){return this.searchParams=new URLSearchParams,this}delete(r){const e=Array.isArray(r)?r:[r];for(let t of e)this.searchParams.delete(t);return this}toJSON(){const r=new Map;for(let[e,t]of this.searchParams)if(r.has(e)){const s=r.get(e);if(Array.isArray(s))s.push(t),r.set(e,s);else r.set(e,[s,t])}else r.set(e,t);return Object.fromEntries(r.entries())}toString(){return this.searchParams.toString()}push(r="soft"){this.callback(this.toJSON(),r==="soft")}}import{useContext as se} from"react";function br(){const{getRoutePathnameFromHref:r}=se(d),e=q(),t=r(e.pathname);return{pathname:t,startsWith:(s)=>{return t.startsWith(s)}}}import{useContext as ne} from"react";function Mr(){const{params:r}=ne(d);return r}import{createPortal as ie} from"react-dom";import{jsxDEV as wr} from"react/jsx-dev-runtime";var vr=()=>{const{replace:r}=$(),e=Rr(),{pathname:t}=br(),s=Mr(),[n,o]=ue(!1),u=()=>{o(!0),r(t,{params:s,search:e.toJSON()}).catch(console.log).finally(()=>{o(!1)})};if(oe(()=>{if(import.meta.hot)import.meta.hot.on("vite:beforeFullReload",()=>{throw console.log("HELLO"),"(skipping full reload)"}),import.meta.hot.on("beforeFullReload",()=>{throw console.log("HELLO"),"(skipping full reload)"});return()=>{if(import.meta.hot)import.meta.hot.off("http-reload",u)}},[u]),!n||typeof document==="undefined")return null;return ie(wr("div",{className:"fixed z-[1000] bottom-0 right-0 p-2",children:wr("div",{className:"p-2 bg-white text-black rounded-md shadow-md",children:"..."},void 0,!1,void 0,this)},void 0,!1,void 0,this),document.body)};var me=function(r){const{locationSubject:e}=Vr(d);jr(()=>{return r(e.getValue()),e.subscribe(r)},[])};function q(){const r=Vr(d);if(!r)throw new Error("useLocation must be used within a ClientRouterProvider");const{locationSubject:e}=r,[t,s]=z(e?.getValue());return me((n)=>{s(n)}),t}import{jsxDEV as Sr} from"react/jsx-dev-runtime";var d=ce({}),Dr=(r)=>{const{children:e,pathname:t,currentPath:s,is404:n,routeManifest:o,pageData:u,params:i,searchParams:g}=r,[C,f]=z(i),h=B(new AbortController),[V]=z(()=>{return new N(!1)}),[l]=z(new K(V)),v=B(structuredClone(u)),W=B(new Map),p=n?["404"]:o[t]??["404"],b=B(new N(p)),[R]=z(()=>new N({hash:"",pathname:s,search:g,state:{},key:""})),[D]=z(()=>{let c=null;if(typeof window!=="undefined")c=ar();return c}),j=()=>{const c=[`${R.getValue().pathname}?${R.getValue().search}`].filter((w)=>w.length>0).join("");W.current.set(c,window.scrollY)},T=(c)=>{const w=[];for(let k of Object.keys(o))if(new Y({pathname:k}).test({pathname:c}))w.push(k);const y=w.sort((k,_)=>{const Zr=k.split("/").length+k.split(":").length,$r=_.split("/").length+_.split(":").length;return Zr-$r}),[E]=y??[];return E},F=(c)=>{const w=T(c);return o[w]??[]},m=(c)=>{return T(c)},a=(c)=>{const w=T(c);return new Y({pathname:w}).exec({pathname:c})?.pathname.groups};jr(()=>{return D?.listen(({location:c})=>{R.next(structuredClone(c)),f(a(c.pathname)),b.current.next((()=>{if(c.state?.status===404)return["404"];return F(c.pathname)})())}),window.addEventListener("scrollend",j),()=>{window.removeEventListener("scroll",j)}},[]);const M=(c)=>{const[w,y]=Object.entries(c)[0];if(!v.current?.[w])v.current[w]={};v.current[w]=y},P=(c)=>{return v.current[R.getValue().pathname][c]},S=(c)=>{h.current.abort(),h.current=c};return Sr(d.Provider,{value:{isNavigatingSubject:V,getViewPathsFromPathname:F,history:D,params:C,locationSubject:R,getScrollPosition:(c)=>{return W.current.get(c)||0},viewEntriesSubject:b.current,updatePageData:M,getPageData:P,getRoutePathnameFromHref:m,setNavigationAbortController:S,progressManager:l},children:[e,import.meta.hot&&Sr(vr,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};import{createContext as fe,lazy as pe} from"react";function X(r){let e=[];for(let[t,s]of r)e.push(t,...X(s).flat());return Array.from(new Set(e))}import{jsxDEV as ae} from"react/jsx-dev-runtime";var U=null;if(typeof window!=="undefined"){U={};const{componentTree:r}=window.__GEMI_DATA__;for(let e of X(r))U[e]=pe(window.loaders[e])}var sr=fe({viewImportMap:U}),Tr=(r)=>{return ae(sr.Provider,{value:{viewImportMap:r.viewImportMap??U},children:r.children},void 0,!1,void 0,this)};import{createContext as ge,useEffect as le,useRef as he} from"react";import{jsxDEV as Ce} from"react/jsx-dev-runtime";var Pe=ge({}),Or=(r)=>{const e=he(null);function t(){return new Promise((u)=>{if(e.current)u(e.current);else{const i=new WebSocket("ws://localhost:5173/");i.onopen=()=>{e.current=i,i.addEventListener("close",()=>{e.current=null}),u(i)}}})}const s=async(u,i)=>{const g=await t();g.send(JSON.stringify({type:"subscribe",topic:u})),g.addEventListener("message",i)},n=async(u,i)=>{const g=await t();g.send(JSON.stringify({type:"unsubscribe",topic:u})),g.removeEventListener("message",i)},o=async(u,i={})=>{(await t()).send(JSON.stringify({type:"broadcast",topic:u,payload:i}))};return le(()=>{return()=>{if(e.current)e.current.close(),e.current=null}},[]),Ce(Pe.Provider,{value:{subscribe:s,unsubscribe:n,broadcast:o},children:r.children},void 0,!1,void 0,this)};import{jsxDEV as O} from"react/jsx-dev-runtime";var dr=(r)=>{const{componentPath:e}=r,{viewImportMap:t}=nr(sr),{viewEntriesSubject:s,getPageData:n,history:o}=nr(d),[u,i]=yr(()=>s.getValue().includes(e)),[g,C]=yr(()=>n(e));if(Wr(()=>{return s.subscribe((V)=>{i(V.includes(e))})},[e]),Wr(()=>{return o?.listen(()=>{C(n(e))})},[]),!u)return null;const f=t[e];if(f)return O(f,{...g,children:r.children},void 0,!1,void 0,this);const h=t["404"];return O(h,{},void 0,!1,void 0,this)},Fr=(r)=>{const{componentTree:e}=r;return O(Re,{children:e.map((t)=>{const[s,n]=t;if(n.length>0)return O(dr,{componentPath:s,children:O(Fr,{componentTree:n},void 0,!1,void 0,this)},s,!1,void 0,this);return O(dr,{componentPath:s},s,!1,void 0,this)})},void 0,!1,void 0,this)},Nr=(r)=>{const{RootLayout:e}=r,{routeManifest:t,router:s,componentTree:n,pageData:o,auth:u}=nr(Q);return O(lr,{children:O(Or,{children:O(Pr,{children:O(Tr,{viewImportMap:r.viewImportMap,children:O(Dr,{searchParams:s.searchParams,params:s.params,pageData:o,is404:s.is404,pathname:s.pathname,currentPath:s.currentPath,routeManifest:t,children:O(be,{children:O(e,{children:O(Fr,{componentTree:n},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)};function Er(r){return(e)=>Qr(ir,{value:e.data,children:Qr(Nr,{RootLayout:r,viewImportMap:e.viewImportMap},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as Qr} from"react/jsx-dev-runtime";function I(r){const e={};for(let[t,s]of Object.entries(r))if("run"in s){const n=s;if("children"in n){const o=new n.children,u=I(o.routes);for(let[i,{exec:g,middleware:C}]of Object.entries(u)){const f=t==="/"?i:`${t}${i}`,h=i==="/"&&t!=="/"?t:f;e[h]={exec:[n.run.bind(n),...g],middleware:[...n.middlewares,...C]}}}else e[t]={exec:[n.run.bind(n)],middleware:n.middlewares}}else{const n=new s,o=I(n.routes);for(let[u,{exec:i,middleware:g}]of Object.entries(o)){const C=t==="/"?u:`${t}${u}`,f=u==="/"&&t!=="/"?t:C;e[f]={exec:i,middleware:[...n.middlewares,...g]}}}return Object.fromEntries(Object.entries(e).sort(([t],[s])=>{const n=t.split("/").length+t.split(":").length,o=s.split("/").length+s.split(":").length;return n-o}))}import{renderToReadableStream as Me} from"react-dom/server.browser";import{createElement as Jr,Fragment as we} from"react";function H(r){const e={};for(let[t,s]of Object.entries(r))if("run"in s){const n=s.viewPath;if("children"in s)e[t]=[n];if("children"in s){const o=new s.children,u=H(o.routes);for(let[i,g]of Object.entries(u)){const C=t==="/"?i:`${t}${i}`,f=i==="/"&&t!=="/"?t:C;e[f]=[n,...g]}}else e[t]=[n]}else{const n=new s,o=H(n.routes);for(let[u,i]of Object.entries(o)){const g=t==="/"?u:`${t}${u}`,C=u==="/"&&t!=="/"?t:g;e[C]=i}}return e}function L(r){const e=[];for(let[t,s]of Object.entries(r))if("run"in s){const n=s.viewPath;if("children"in s){const o=new s.children,u=L(o.routes);e.push([n,u])}else e.push([n,[]])}else{const n=new s,o=L(n.routes);e.push(...o)}return e}class ve extends kr{r;name="ViewRouterServiceContainer";flatViewRoutes={};routeManifest={};componentTree=[];flatComponentTree=[];RootLayout=null;constructor(r){super();this.service=r;const e={"/":r.rootRouter,"/auth":Yr};this.flatViewRoutes=I(e),this.routeManifest=H(e),this.componentTree=L(e),this.flatComponentTree=X(this.componentTree),this.RootLayout=Er(r.rootLayout)}boot(){}async handleViewRequest(r){const e=new URL(r.url),t=e.searchParams.get("json");let s=null;try{let p=[],b=[],R=null,D={};for(let[P,S]of Object.entries(this.flatViewRoutes)){const c=new Y({pathname:P});if(c.test({pathname:e.pathname})){R=P,D=c.exec({pathname:e.pathname})?.pathname.groups,p=S.exec,b=S.middleware;break}}const j=new ur(r,D),{data:T,cookies:F,headers:m,user:a,prefetchedData:M}=await or.run(j,async()=>{const P=or.getStore();P.setRequest(j),await Xr.use().runMiddleware(b,R);const S=await Promise.all([...p.map((E)=>E(j)),...Array.from(P.prefetchPromiseQueue).map((E)=>E())]),c=P.cookies,w=P.headers,y=P.prefetchedResources;return{data:S,cookies:c,headers:w,user:P.user,prefetchedData:Object.fromEntries(y.entries())}});s={data:T,prefetchedData:M,currentPathName:R,user:a,params:D,cookies:F,headers:m}}catch(p){if(p.kind===zr)if(t){const{status:b=400,data:R,directive:D,headers:j}=p.payload.api;return new Response(JSON.stringify({data:R,directive:D}),{headers:j,status:b})}else{const{status:b=400,error:R}=p.payload.view;return new Response(R?.message,{...p.payload.view,status:b})}else throw p}const{data:n,params:o,currentPathName:u,user:i,cookies:g}=s,C=n.reduce((p,b)=>{return{...p,...b}},{}),f=Gr.use(),h=f.isEnabled;let V={};if(h){const p=f.detectLocale(new ur(r,o)),b=f.getPageTranslations(p,u);V={supportedLocales:f.supportedLocales,currentLocale:p,dictionary:{[p]:b}}}if(t){const p=new Headers;return p.set("Content-Type","application/json"),g.forEach((b)=>p.append("Set-Cookie",b.toString())),p.append("Cache-Control",i?"private, no-cache, no-store, max-age=0, must-revalidate":"public, max-age=864000, must-revalidate"),new Response(JSON.stringify({data:{[e.pathname]:C},prefetchedData:s.prefetchedData,i18n:V,is404:!u}),{headers:p})}const l=new Headers;l.set("Content-Type","text/html"),l.set("Cache-Control",i?"private, no-cache, no-store, max-age=0, must-revalidate":"public, max-age=864000, must-revalidate"),l.set("ETag",'W/"'+Math.random().toString(36).substring(7)+'"'),s.cookies.forEach((p)=>l.append("Set-Cookie",p.toString()));const v={kind:"view",data:{pageData:{[e.pathname]:C},prefetchedData:s.prefetchedData,i18n:V,auth:{user:i},routeManifest:this.routeManifest,router:{pathname:u,params:o,currentPath:e.pathname,searchParams:e.search,is404:!u?!0:!1},componentTree:[["404",[]],...this.componentTree]},head:{}},W=this.RootLayout;return async(p)=>{const{bootstrapModules:b,loaders:R,styles:D,viewImportMap:j}=p,T=await Me(Jr(we,{children:[D,Jr(W,{data:v.data,viewImportMap:j})]}),{bootstrapScriptContent:`window.__GEMI_DATA__ = ${JSON.stringify(v.data)}; window.loaders=${R}`,bootstrapModules:b});return new Response(T,{status:!u?404:200,headers:l})}}}
|
|
2
|
+
export{ve as L};
|
|
3
|
+
|
|
4
|
+
//# debugId=E4961D79807ACD3D64756e2164756e21
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../client/ClientRouter.tsx", "../client/ServerDataProvider.tsx", "../../../node_modules/@babel/runtime/helpers/esm/extends.js", "../../../node_modules/history/index.js", "../client/ClientRouterContext.tsx", "../utils/Subject.ts", "../utils/sleep.ts", "../client/ProgressManager.ts", "../client/HttpReload.tsx", "../client/useNavigate.ts", "../client/i18n/I18nContext.tsx", "../client/QueryManagerContext.tsx", "../client/QueryResource.ts", "../client/useSearchParams.ts", "../client/useRoute.ts", "../client/useParams.ts", "../client/ComponentContext.tsx", "../client/helpers/flattenComponentTree.ts", "../client/WebsocketContext.tsx", "../client/createRoot.tsx", "../services/router/createFlatViewRoutes.ts", "../services/router/ViewRouterServiceContainer.ts", "../services/router/createRouteManifest.ts", "../services/router/createComponentTree.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import {\n Suspense,\n useContext,\n useEffect,\n useState,\n StrictMode,\n type PropsWithChildren,\n type ComponentType,\n} from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport {\n ClientRouterContext,\n ClientRouterProvider,\n} from \"./ClientRouterContext\";\nimport type { ComponentTree } from \"./types\";\nimport { ComponentsContext, ComponentsProvider } from \"./ComponentContext\";\nimport { QueryManagerProvider } from \"./QueryManagerContext\";\nimport { I18nProvider } from \"./i18n/I18nContext\";\nimport { WebSocketContextProvider } from \"./WebsocketContext\";\n\ninterface RouteProps {\n componentPath: string;\n}\n\nconst Route = (props: PropsWithChildren<RouteProps>) => {\n const { componentPath } = props;\n const { viewImportMap } = useContext(ComponentsContext);\n\n const { viewEntriesSubject, getPageData, history } =\n useContext(ClientRouterContext);\n\n const [render, setRender] = useState(() =>\n viewEntriesSubject.getValue().includes(componentPath),\n );\n const [data, setData] = useState(() => getPageData(componentPath));\n\n useEffect(() => {\n return viewEntriesSubject.subscribe((viewEntries) => {\n setRender(viewEntries.includes(componentPath));\n });\n }, [componentPath]);\n\n useEffect(() => {\n return history?.listen(() => {\n setData(getPageData(componentPath));\n });\n }, []);\n\n if (!render) return null;\n const Component = viewImportMap[componentPath];\n\n if (Component) {\n return <Component {...data}>{props.children}</Component>;\n }\n const NotFound = viewImportMap[\"404\"];\n return <NotFound />;\n};\n\nconst Routes = (props: { componentTree: ComponentTree }) => {\n const { componentTree } = props;\n\n return (\n <Suspense>\n {componentTree.map((node) => {\n const [path, subtree] = node;\n if (subtree.length > 0) {\n return (\n <Route key={path} componentPath={path}>\n <Routes componentTree={subtree} />\n </Route>\n );\n }\n return <Route key={path} componentPath={path} />;\n })}\n </Suspense>\n );\n};\n\nexport const ClientRouter = (props: {\n viewImportMap?: Record<string, any>;\n RootLayout: ComponentType<any>;\n}) => {\n const { RootLayout } = props;\n const { routeManifest, router, componentTree, pageData, auth } =\n useContext(ServerDataContext);\n\n return (\n <I18nProvider>\n <WebSocketContextProvider>\n <QueryManagerProvider>\n <ComponentsProvider viewImportMap={props.viewImportMap}>\n <ClientRouterProvider\n searchParams={router.searchParams}\n params={router.params}\n pageData={pageData}\n is404={router.is404}\n pathname={router.pathname}\n currentPath={router.currentPath}\n routeManifest={routeManifest}\n >\n <StrictMode>\n <RootLayout>\n <Routes componentTree={componentTree} />\n </RootLayout>\n </StrictMode>\n </ClientRouterProvider>\n </ComponentsProvider>\n </QueryManagerProvider>\n </WebSocketContextProvider>\n </I18nProvider>\n );\n};\n",
|
|
6
|
+
"import { createContext, type PropsWithChildren } from \"react\";\nimport type { Translations } from \"./i18n/I18nContext\";\nimport type { ComponentTree } from \"./types\";\nimport type { User } from \"../auth/adapters/types\";\n\ntype Data = Record<string, any>;\n\nexport interface ServerDataContextValue {\n routeManifest: Record<string, string[]>;\n pageData: Record<string, Record<string, Data>>;\n prefetchedData: Record<string, Data>;\n router: {\n pathname: string;\n params: Record<string, any>;\n currentPath: string;\n is404: boolean;\n searchParams: string;\n };\n i18n: {\n dictionary: Translations;\n currentLocale: string;\n supportedLocales: string[];\n };\n componentTree: ComponentTree;\n auth: {\n user: User;\n };\n}\n\nexport const ServerDataContext = createContext({} as ServerDataContextValue);\n\ninterface ServerDataProviderProps {\n value?: ServerDataContextValue;\n}\n\nexport const ServerDataProvider = (\n props: PropsWithChildren<ServerDataProviderProps>,\n) => {\n let _value = props.value;\n // Server\n if (props.value) {\n _value = props.value;\n } else {\n // Client\n _value = (window as any).__GEMI_DATA__;\n }\n\n return (\n <ServerDataContext.Provider value={_value}>\n {props.children}\n </ServerDataContext.Provider>\n );\n};\n",
|
|
7
|
+
"function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };",
|
|
8
|
+
"import _extends from '@babel/runtime/helpers/esm/extends';\n\n/**\r\n * Actions represent the type of change to a location value.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action\r\n */\nvar Action;\n\n(function (Action) {\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\n Action[\"Pop\"] = \"POP\";\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\n\n Action[\"Push\"] = \"PUSH\";\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\n\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\nvar readOnly = process.env.NODE_ENV !== \"production\" ? function (obj) {\n return Object.freeze(obj);\n} : function (obj) {\n return obj;\n};\n\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== 'undefined') console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nvar BeforeUnloadEventType = 'beforeunload';\nvar HashChangeEventType = 'hashchange';\nvar PopStateEventType = 'popstate';\n/**\r\n * Browser history stores the location in regular URLs. This is the standard for\r\n * most web apps, but it requires some configuration on the server to ensure you\r\n * serve the same app at multiple URLs.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\r\n */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$window = _options.window,\n window = _options$window === void 0 ? document.defaultView : _options$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation[0],\n nextLocation = _getIndexAndLocation[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better what\n // is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n var action = Action.Pop;\n\n var _getIndexAndLocation2 = getIndexAndLocation(),\n index = _getIndexAndLocation2[0],\n location = _getIndexAndLocation2[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n } // state defaults to `null` because `window.history.state` does\n\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation3 = getIndexAndLocation();\n\n index = _getIndexAndLocation3[0];\n location = _getIndexAndLocation3[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr[0],\n url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr2[0],\n url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Hash history stores the location in window.location.hash. This makes it ideal\r\n * for situations where you don't want to send the location to the server for\r\n * some reason, either because you do cannot configure it or the URL space is\r\n * reserved for something else.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\r\n */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options2 = options,\n _options2$window = _options2.window,\n window = _options2$window === void 0 ? document.defaultView : _options2$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _parsePath = parsePath(window.location.hash.substr(1)),\n _parsePath$pathname = _parsePath.pathname,\n pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,\n _parsePath$search = _parsePath.search,\n search = _parsePath$search === void 0 ? '' : _parsePath$search,\n _parsePath$hash = _parsePath.hash,\n hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;\n\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation4 = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation4[0],\n nextLocation = _getIndexAndLocation4[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better\n // what is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge\n // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event\n\n window.addEventListener(HashChangeEventType, function () {\n var _getIndexAndLocation5 = getIndexAndLocation(),\n nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.\n\n\n if (createPath(nextLocation) !== createPath(location)) {\n handlePop();\n }\n });\n var action = Action.Pop;\n\n var _getIndexAndLocation6 = getIndexAndLocation(),\n index = _getIndexAndLocation6[0],\n location = _getIndexAndLocation6[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function getBaseHref() {\n var base = document.querySelector('base');\n var href = '';\n\n if (base && base.getAttribute('href')) {\n var url = window.location.href;\n var hashIndex = url.indexOf('#');\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href;\n }\n\n function createHref(to) {\n return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation7 = getIndexAndLocation();\n\n index = _getIndexAndLocation7[0];\n location = _getIndexAndLocation7[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr3[0],\n url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr4[0],\n url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Memory history stores the current location in memory. It is designed for use\r\n * in stateful non-browser environments like tests and React Native.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory\r\n */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options3 = options,\n _options3$initialEntr = _options3.initialEntries,\n initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,\n initialIndex = _options3.initialIndex;\n var entries = initialEntries.map(function (entry) {\n var location = readOnly(_extends({\n pathname: '/',\n search: '',\n hash: '',\n state: null,\n key: createKey()\n }, typeof entry === 'string' ? parsePath(entry) : entry));\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: \" + JSON.stringify(entry) + \")\") : void 0;\n return location;\n });\n var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);\n var action = Action.Pop;\n var location = entries[index];\n var listeners = createEvents();\n var blockers = createEvents();\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n search: '',\n hash: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction, nextLocation) {\n action = nextAction;\n location = nextLocation;\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n applyTx(nextAction, nextLocation);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n entries[index] = nextLocation;\n applyTx(nextAction, nextLocation);\n }\n }\n\n function go(delta) {\n var nextIndex = clamp(index + delta, 0, entries.length - 1);\n var nextAction = Action.Pop;\n var nextLocation = entries[nextIndex];\n\n function retry() {\n go(delta);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index = nextIndex;\n applyTx(nextAction, nextLocation);\n }\n }\n\n var history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n return blockers.push(blocker);\n }\n };\n return history;\n} ////////////////////////////////////////////////////////////////////////////////\n// UTILS\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n\nfunction promptBeforeUnload(event) {\n // Cancel the event.\n event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.\n\n event.returnValue = '';\n}\n\nfunction createEvents() {\n var handlers = [];\n return {\n get length() {\n return handlers.length;\n },\n\n push: function push(fn) {\n handlers.push(fn);\n return function () {\n handlers = handlers.filter(function (handler) {\n return handler !== fn;\n });\n };\n },\n call: function call(arg) {\n handlers.forEach(function (fn) {\n return fn && fn(arg);\n });\n }\n };\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\r\n * Creates a string URL path from the given pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath\r\n */\n\n\nfunction createPath(_ref) {\n var _ref$pathname = _ref.pathname,\n pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,\n _ref$search = _ref.search,\n search = _ref$search === void 0 ? '' : _ref$search,\n _ref$hash = _ref.hash,\n hash = _ref$hash === void 0 ? '' : _ref$hash;\n if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;\n if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;\n return pathname;\n}\n/**\r\n * Parses a string URL path into its separate pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath\r\n */\n\nfunction parsePath(path) {\n var parsedPath = {};\n\n if (path) {\n var hashIndex = path.indexOf('#');\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var searchIndex = path.indexOf('?');\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n",
|
|
9
|
+
"import { type History, type Location, createBrowserHistory } from \"history\";\nimport {\n createContext,\n useContext,\n useEffect,\n useRef,\n useState,\n type PropsWithChildren,\n} from \"react\";\nimport { Subject } from \"../utils/Subject\";\n// @ts-ignore\nimport { URLPattern } from \"urlpattern-polyfill\";\nimport { ProgressManager } from \"./ProgressManager\";\nimport { HttpReload } from \"./HttpReload\";\n\ninterface ClientRouterContextValue {\n viewEntriesSubject: Subject<string[]>;\n history: History | null;\n updatePageData: (pageData: Record<string, any>) => void;\n getPageData: (key: string) => any;\n locationSubject: Subject<Location>;\n getScrollPosition: (path: string) => number;\n params: Record<string, string>;\n getViewPathsFromPathname: (pathname: string) => string[];\n getRoutePathnameFromHref: (href: string) => string | null;\n isNavigatingSubject: Subject<boolean>;\n setNavigationAbortController: (controller: AbortController) => void;\n progressManager: ProgressManager;\n}\n\nexport const ClientRouterContext = createContext(\n {} as ClientRouterContextValue,\n);\n\ninterface ClientRouterProviderProps {\n pathname: string;\n routeManifest: Record<string, string[]>;\n pageData: Record<string, any>;\n currentPath: string;\n params: Record<string, string>;\n searchParams: string;\n is404: boolean;\n}\n\nexport const ClientRouterProvider = (\n props: PropsWithChildren<ClientRouterProviderProps>,\n) => {\n const {\n children,\n pathname,\n currentPath,\n is404,\n routeManifest,\n pageData,\n params,\n searchParams,\n } = props;\n const [parameters, setParameters] = useState(params);\n const navigationAbortControllerRef = useRef(new AbortController());\n const [isNavigatingSubject] = useState(() => {\n return new Subject<boolean>(false);\n });\n\n const [progressManager] = useState(new ProgressManager(isNavigatingSubject));\n const pageDataRef = useRef(structuredClone(pageData));\n const scrollHistoryRef = useRef<Map<string, number>>(new Map());\n const initalViewEntries = is404\n ? [\"404\"]\n : (routeManifest[pathname] ?? [\"404\"]);\n const viewEntriesSubject = useRef(new Subject<string[]>(initalViewEntries));\n const [locationSubject] = useState(\n () =>\n new Subject<Location>({\n hash: \"\",\n pathname: currentPath,\n search: searchParams,\n state: {},\n key: \"\",\n }),\n );\n\n const [history] = useState<History | null>(() => {\n let history: History | null = null;\n\n // @ts-ignore\n if (typeof window !== \"undefined\") {\n history = createBrowserHistory();\n }\n return history;\n });\n\n const handleScroll = () => {\n const key = [\n `${locationSubject.getValue().pathname}?${locationSubject.getValue().search}`,\n ]\n .filter((item) => item.length > 0)\n .join(\"\");\n\n scrollHistoryRef.current.set(key, window.scrollY);\n };\n\n const findMatchingRouteFromParams = (pathname: string) => {\n const candidates: string[] = [];\n for (const route of Object.keys(routeManifest)) {\n const urlPattern = new URLPattern({ pathname: route });\n if (urlPattern.test({ pathname })) {\n candidates.push(route);\n }\n }\n const sortedCandidates = candidates.sort((a, b) => {\n const x = a.split(\"/\").length + a.split(\":\").length;\n const y = b.split(\"/\").length + b.split(\":\").length;\n return x - y;\n });\n\n const [route] = sortedCandidates ?? [];\n return route;\n };\n\n const getViewPathsFromPathname = (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n return routeManifest[route] ?? [];\n };\n\n const getRoutePathnameFromHref = (href: string) => {\n const route = findMatchingRouteFromParams(href);\n return route;\n };\n\n const getParams = (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n const urlPattern = new URLPattern({ pathname: route });\n return urlPattern.exec({ pathname })?.pathname.groups!;\n };\n\n useEffect(() => {\n history?.listen(({ location }) => {\n locationSubject.next(structuredClone(location));\n setParameters(getParams(location.pathname));\n viewEntriesSubject.current.next(\n (() => {\n if ((location.state as any)?.status === 404) {\n return [\"404\"];\n }\n return getViewPathsFromPathname(location.pathname);\n })(),\n );\n });\n\n window.addEventListener(\"scrollend\", handleScroll);\n return () => {\n window.removeEventListener(\"scroll\", handleScroll);\n };\n }, []);\n\n const updatePageData = (newPageData: Record<string, any>) => {\n const [key, value] = Object.entries(newPageData)[0];\n if (!pageDataRef.current?.[key]) {\n pageDataRef.current[key] = {};\n }\n\n pageDataRef.current[key] = value;\n };\n\n const getPageData = (key: string) => {\n return pageDataRef.current[locationSubject.getValue().pathname][key];\n };\n\n const setNavigationAbortController = (controller: AbortController) => {\n navigationAbortControllerRef.current.abort();\n navigationAbortControllerRef.current = controller;\n };\n\n return (\n <ClientRouterContext.Provider\n value={{\n isNavigatingSubject,\n getViewPathsFromPathname,\n history,\n params: parameters,\n locationSubject,\n getScrollPosition: (path: string) => {\n return scrollHistoryRef.current.get(path) || 0;\n },\n viewEntriesSubject: viewEntriesSubject.current,\n updatePageData,\n getPageData,\n getRoutePathnameFromHref,\n setNavigationAbortController,\n progressManager,\n }}\n >\n {children}\n {/* @ts-ignore */}\n {import.meta.hot && <HttpReload />}\n </ClientRouterContext.Provider>\n );\n};\n\nfunction useLocationChange(cb: (location: Location) => void) {\n const { locationSubject } = useContext(ClientRouterContext);\n useEffect(() => {\n cb(locationSubject.getValue());\n return locationSubject.subscribe(cb);\n }, []);\n}\n\nexport function useLocation() {\n const ctx = useContext(ClientRouterContext);\n if (!ctx) {\n throw new Error(\"useLocation must be used within a ClientRouterProvider\");\n }\n const { locationSubject } = ctx;\n const [location, setLocation] = useState(locationSubject?.getValue());\n\n useLocationChange((newLocation) => {\n setLocation(newLocation);\n });\n\n return location;\n}\n",
|
|
10
|
+
"export class Subject<T> {\n subscribers = new Set<(value: T) => void>();\n value: T;\n\n constructor(initialValue: T) {\n this.value = initialValue;\n }\n\n public subscribe(subscriber: (value: T) => void) {\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n }\n\n public next(value: T) {\n this.value = value;\n this.subscribers.forEach((subscriber) => subscriber(value));\n }\n\n public getValue() {\n return this.value;\n }\n}\n",
|
|
11
|
+
"export function sleep(time: number) {\n return new Promise((resolve) => setTimeout(resolve, time));\n}\n",
|
|
12
|
+
"import { Subject } from \"../utils/Subject\";\nimport { sleep } from \"../utils/sleep\";\n\nexport class ProgressManager {\n state = new Subject(100);\n unsubscribe: ReturnType<InstanceType<typeof Subject>[\"subscribe\"]>;\n timer: ReturnType<typeof setInterval>;\n tick = 0;\n isTicking = false;\n\n constructor(subject: Subject<boolean>) {\n this.unsubscribe = subject.subscribe((state) => {\n if (state) {\n this.start();\n } else {\n this.end();\n }\n });\n }\n\n getNextIncrement() {\n const current = this.state.getValue();\n if (current === 100) {\n return Math.ceil(Math.random() * 10);\n }\n\n if (current <= 20) {\n if (Math.ceil(Math.random() * 100) > 80) {\n return current;\n }\n return current + Math.ceil(Math.random() * 5) + 1;\n }\n\n if (current <= 50) {\n if (Math.ceil(Math.random() * 100) > 50) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 10), 70);\n }\n\n if (current <= 70) {\n if (Math.ceil(Math.random() * 100) > 60) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 3), 80);\n }\n\n if (current <= 80) {\n return Math.min(current + Math.ceil(Math.random() * 1), 90);\n }\n\n if (current <= 90) {\n const x = Math.ceil(Math.random() * 100) > 50 ? 0 : 1;\n return Math.min(current + x, 94);\n }\n\n if (current <= 94) {\n const x = Math.ceil(Math.random() * 100) > 20 ? 0 : 1;\n return Math.min(current + x, 99);\n }\n }\n\n getNextInterval() {\n if (this.tick === 0) {\n this.tick = 1;\n return 200;\n }\n const current = this.state.getValue();\n\n if (current >= 88) {\n return 400;\n }\n if (current >= 94) {\n return 1000;\n }\n if (current >= 98) {\n return 2000;\n }\n return 100;\n }\n\n async nextTick() {\n if (!this.isTicking) {\n return;\n }\n await sleep(this.getNextInterval());\n\n if (!this.isTicking) {\n return;\n }\n\n const increment = this.getNextIncrement();\n this.state.next(Math.min(increment, 96));\n\n await this.nextTick();\n }\n\n start() {\n this.isTicking = true;\n this.nextTick();\n }\n\n end() {\n this.state.next(99);\n this.isTicking = false;\n this.tick = 0;\n setTimeout(() => {\n this.state.next(100);\n }, 200);\n }\n\n destroy() {\n this.end();\n this.unsubscribe();\n }\n}\n",
|
|
13
|
+
"import { useEffect, useState } from \"react\";\nimport { useNavigate } from \"./useNavigate\";\nimport { useSearchParams } from \"./useSearchParams\";\nimport { useRoute } from \"./useRoute\";\nimport { useParams } from \"./useParams\";\nimport { createPortal } from \"react-dom\";\n\nexport const HttpReload = () => {\n const { replace } = useNavigate();\n const searchParams = useSearchParams();\n const { pathname } = useRoute();\n const params = useParams();\n const [reloading, setReloading] = useState(false);\n const handleReload = () => {\n setReloading(true);\n replace(pathname, {\n params: params,\n search: searchParams.toJSON(),\n } as any)\n .catch(console.log)\n .finally(() => {\n setReloading(false);\n });\n };\n useEffect(() => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.on(\"vite:beforeFullReload\", () => {\n console.log(\"HELLO\");\n throw \"(skipping full reload)\";\n });\n\n // @ts-ignore\n import.meta.hot.on(\"beforeFullReload\", () => {\n console.log(\"HELLO\");\n throw \"(skipping full reload)\";\n });\n }\n return () => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.off(\"http-reload\", handleReload);\n }\n };\n }, [handleReload]);\n\n if (!reloading || typeof document === \"undefined\") {\n return null;\n }\n return createPortal(\n <div className=\"fixed z-[1000] bottom-0 right-0 p-2\">\n <div className=\"p-2 bg-white text-black rounded-md shadow-md\">...</div>\n </div>,\n document.body,\n );\n};\n",
|
|
14
|
+
"import { useContext, startTransition } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\nimport type { UrlParser, ViewPaths } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { I18nContext } from \"./i18n/I18nContext\";\nimport { QueryManagerContext } from \"./QueryManagerContext\";\n\ntype Options<T extends ViewPaths> =\n UrlParser<T> extends Record<string, never>\n ? {\n search?: Record<string, string | number | boolean | undefined | null>;\n shallow?: boolean;\n }\n : {\n search?: Record<string, string | number | boolean | undefined | null>;\n params: UrlParser<T>;\n shallow?: boolean;\n };\n\nexport function useNavigate() {\n const {\n updatePageData,\n history,\n getViewPathsFromPathname,\n getRoutePathnameFromHref,\n isNavigatingSubject,\n setNavigationAbortController,\n getScrollPosition,\n } = useContext(ClientRouterContext);\n const { updatePrefecthedData } = useContext(QueryManagerContext);\n const { fetchTranslations } = useContext(I18nContext);\n\n function action(pushOrReplace: \"push\" | \"replace\") {\n return async <T extends ViewPaths>(\n path: T | (string & {}),\n ...args: UrlParser<T> extends Record<string, never>\n ? [options?: Options<T>]\n : [options: Options<T>]\n ) => {\n const navigationAbortController = new AbortController();\n setNavigationAbortController(navigationAbortController);\n\n const [options = {}] = args;\n const {\n search = {},\n params = {},\n shallow,\n } = {\n params: {},\n shallow: false,\n ...options,\n };\n const urlSearchParams = new URLSearchParams(search);\n\n const basePath = applyParams(path, params);\n\n const navigationPath = [\n applyParams(path, params),\n urlSearchParams.toString(),\n ].join(\"?\");\n\n if (shallow) {\n history?.[pushOrReplace](navigationPath);\n return;\n }\n\n const components = getViewPathsFromPathname(path);\n\n const fetchUrlSearchParams = new URLSearchParams(urlSearchParams);\n fetchUrlSearchParams.set(\"json\", \"true\");\n const fetchPath = [basePath, fetchUrlSearchParams.toString()].join(\"?\");\n\n urlSearchParams.set(\"json\", \"true\");\n\n const routePathname = getRoutePathnameFromHref(path);\n\n isNavigatingSubject.next(true);\n\n try {\n const [res] = await Promise.all([\n fetch(fetchPath, { signal: navigationAbortController.signal }),\n fetchTranslations(\n routePathname,\n undefined,\n navigationAbortController.signal,\n ),\n ...components.map((component) =>\n (window as any).loaders[component](),\n ),\n ]);\n\n if (res.ok) {\n const {\n data,\n prefetchedData,\n directive = {},\n is404 = false,\n } = await res.json();\n if (directive?.kind === \"Redirect\") {\n if (directive?.path) {\n isNavigatingSubject.next(false);\n action(\"replace\")(directive.path, { params: {} });\n }\n\n return;\n }\n updatePageData(data);\n updatePrefecthedData(prefetchedData);\n\n history?.[pushOrReplace](\n navigationPath,\n is404 ? { status: 404 } : {},\n );\n setTimeout(() => {\n window.scrollTo(0, getScrollPosition(navigationPath));\n }, 1);\n }\n } catch (err) {\n isNavigatingSubject.next(false);\n // Do something\n }\n\n isNavigatingSubject.next(false);\n };\n }\n\n return {\n push: action(\"push\"),\n replace: action(\"replace\"),\n };\n}\n",
|
|
15
|
+
"import {\n createContext,\n type PropsWithChildren,\n useContext,\n useState,\n} from \"react\";\nimport { ServerDataContext } from \"../ServerDataProvider\";\n\ntype TranslationScope = Record<string, string>;\ntype TranslationScopes = Record<string, TranslationScope>;\nexport type Translations = Record<string, TranslationScopes>;\n\ninterface I18nContextValue {\n locale: string;\n changeLocale: (locale: string) => void;\n updateDictionary: (\n translations: Record<string, Record<string, Record<string, string>>>,\n ) => void;\n translations: TranslationScopes;\n fetchTranslations: (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => Promise<void>;\n}\n\nexport const I18nContext = createContext({} as I18nContextValue);\n\ninterface I18nProviderProps {}\n\nexport type Dictionary = Map<string, Map<string, Record<string, string>>>;\n\nexport const I18nProvider = (props: PropsWithChildren<I18nProviderProps>) => {\n const { i18n } = useContext(ServerDataContext);\n\n const [currentLocale, setCurrentLocale] = useState(i18n.currentLocale);\n\n const [dictionary] = useState<Dictionary>(() => {\n const dictionary = new Map();\n for (const [locale, value] of Object.entries(i18n.dictionary)) {\n const scopes = new Map();\n for (const [scope, translations] of Object.entries(value)) {\n scopes.set(scope, translations);\n }\n dictionary.set(locale, scopes);\n }\n return dictionary;\n });\n\n const [currentTranslations, setCurrentTranslations] =\n useState<TranslationScopes>(() => {\n if (!dictionary.has(currentLocale)) {\n return {};\n }\n return Object.fromEntries(dictionary.get(currentLocale).entries());\n });\n\n function updateDictionary(\n translations: Record<string, Record<string, Record<string, string>>>,\n ) {\n for (const [locale, value] of Object.entries(translations)) {\n if (!dictionary.has(locale)) {\n dictionary.set(locale, new Map());\n }\n const scopes = dictionary.get(locale);\n for (const [scope, translations] of Object.entries(value)) {\n if (!scopes.has(scope)) {\n scopes.set(scope, {});\n }\n scopes.set(scope, translations);\n }\n }\n setCurrentTranslations(\n Object.fromEntries(dictionary.get(currentLocale).entries()),\n );\n }\n\n const changeLocale = (locale: string) => {\n if (dictionary.has(locale)) {\n setCurrentLocale(locale);\n setCurrentTranslations(\n Object.fromEntries(dictionary.get(locale).entries()),\n );\n }\n };\n\n const fetchTranslations = async (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => {\n if (Object.keys(i18n).length === 0) {\n return;\n }\n const response = await fetch(\n `/api/__gemi__/services/i18n/translations?scope=${pathname}&locale=${\n locale || currentLocale\n }`,\n {\n signal,\n },\n );\n const translations = await response.json();\n updateDictionary(translations);\n };\n\n return (\n <I18nContext.Provider\n value={{\n locale: currentLocale,\n translations: currentTranslations,\n changeLocale,\n updateDictionary,\n fetchTranslations,\n }}\n >\n {props.children}\n </I18nContext.Provider>\n );\n};\n",
|
|
16
|
+
"import {\n createContext,\n type PropsWithChildren,\n useContext,\n useRef,\n} from \"react\";\nimport { QueryResource } from \"./QueryResource\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\n\nexport const QueryManagerContext = createContext({\n getResource: (key: string, initialState: Record<string, any> = {}) => {\n return new QueryResource(key, initialState);\n },\n updatePrefecthedData: (_data: Record<string, Record<string, any>>) => {},\n});\n\nexport const QueryManagerProvider = ({ children }: PropsWithChildren) => {\n const resourcesRef = useRef<Map<string, QueryResource>>(new Map());\n const { prefetchedData } = useContext(ServerDataContext);\n const prefetchedDataRef = useRef(prefetchedData);\n\n const updatePrefecthedData = (data: Record<string, Record<string, any>>) => {\n for (const [key, value] of Object.entries(data)) {\n prefetchedDataRef.current[key] = value;\n }\n };\n\n return (\n <QueryManagerContext.Provider\n value={{\n updatePrefecthedData,\n getResource: (key: string, initialState?: Record<string, any>) => {\n let _initialState = initialState;\n if (!_initialState && prefetchedDataRef.current[key]) {\n _initialState = prefetchedDataRef.current[key];\n }\n if (!resourcesRef.current.has(key)) {\n resourcesRef.current.set(\n key,\n new QueryResource(key, _initialState ?? {}),\n );\n }\n return resourcesRef.current.get(key);\n },\n }}\n >\n {children}\n </QueryManagerContext.Provider>\n );\n};\n",
|
|
17
|
+
"import { Subject } from \"../utils/Subject\";\n\ntype State = {\n loading: boolean;\n data: any;\n error: any;\n};\n\nexport class QueryResource {\n store: Subject<Map<string, State>>;\n staleVariants = new Set<string>();\n lastFetchRecord = new Map<string, number>();\n key: string;\n\n constructor(key: string, initialState: Record<string, any> = {}) {\n this.key = key;\n const store = new Map();\n const now = Date.now();\n for (const [variantKey, data] of Object.entries(initialState)) {\n if (data) {\n store.set(variantKey, {\n loading: false,\n data,\n error: null,\n });\n this.lastFetchRecord.set(variantKey, now);\n }\n }\n\n this.store = new Subject(store);\n }\n\n getVariant(variantKey: string) {\n const store = this.store.getValue();\n if (!store.has(variantKey)) {\n this.resolveVariant(variantKey);\n } else {\n const variant = store.get(variantKey);\n\n if (!variant.loading) {\n // Don't have data\n if (!variant.data) {\n this.resolveVariant(variantKey);\n return store.get(variantKey);\n //\n } else if (variant.data) {\n const stale = this.staleVariants.has(variantKey);\n const now = Date.now();\n // TODO: age must be dynamic\n const old =\n now - (this.lastFetchRecord.get(variantKey) ?? now) > 5000;\n if (stale || old) {\n this.lastFetchRecord.set(variantKey, now);\n this.resolveVariant(variantKey, true);\n return store.get(variantKey);\n //\n }\n }\n }\n }\n return store.get(variantKey);\n }\n\n mutate(variantKey: string, fn: (data: any) => any) {\n const store = this.store.getValue();\n const state = store.get(variantKey);\n const data = fn(state.data);\n\n this.staleVariants.add(variantKey);\n this.store.next(\n store.set(variantKey, { loading: false, data, error: null }),\n );\n this.resolveVariant(variantKey);\n const cacheKey = [window.location.origin, this.key, variantKey]\n .filter((s) => s.length > 0)\n .join(\"?\");\n caches.delete(cacheKey);\n }\n\n private async resolveVariant(variantKey: string, silent = false) {\n if (typeof window === \"undefined\") {\n return;\n }\n const store = this.store.getValue();\n const previousState = store.get(variantKey);\n\n if (!silent) {\n store.set(variantKey, {\n loading: true,\n data: previousState?.data,\n error: previousState?.data,\n });\n }\n\n const fullUrl = [this.key, variantKey].filter((s) => s.length).join(\"?\");\n const response = await fetch(`/api${fullUrl}`);\n\n let data = null;\n try {\n data = await response.json();\n } catch (error) {\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n error,\n }),\n );\n }\n\n if (response.ok) {\n this.store.next(\n store.set(variantKey, { loading: false, data, error: null }),\n );\n this.staleVariants.delete(variantKey);\n this.lastFetchRecord.set(variantKey, Date.now());\n } else {\n // this.lastFetchRecord.set(variantKey, 0);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n error: data,\n }),\n );\n }\n }\n}\n",
|
|
18
|
+
"import { useLocation } from \"./ClientRouterContext\";\nimport { useNavigate } from \"./useNavigate\";\n\ntype SearchParamsCallback = (\n search: Record<string, any>,\n shallow: boolean,\n) => void;\n\nclass SearchParams {\n constructor(\n private searchParams: URLSearchParams,\n private callback: SearchParamsCallback,\n ) {}\n\n get(key: string) {\n return this.searchParams.get(key);\n }\n\n set(key: Record<string, string | ((state: string) => string)>): SearchParams;\n set(key: string, value: string | ((state: string) => string)): SearchParams;\n set(key: any, value?: any) {\n let entries: Record<string, any> = {};\n if (typeof key === \"string\") {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n entries[key] = _value;\n } else {\n entries = (key as any) ?? {};\n }\n for (const [key, value] of Object.entries(entries)) {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n this.searchParams.set(key, _value);\n }\n return this;\n }\n\n append(key: string, value: string) {\n this.searchParams.append(key, value);\n return this;\n }\n\n sort() {\n this.searchParams.sort();\n return this;\n }\n\n clear() {\n this.searchParams = new URLSearchParams();\n return this;\n }\n\n delete(key: string | string[]) {\n const keys = Array.isArray(key) ? key : [key];\n for (const key of keys) {\n this.searchParams.delete(key);\n }\n return this;\n }\n\n toJSON() {\n const map = new Map<string, string | string[]>();\n // @ts-ignore\n for (const [key, value] of this.searchParams) {\n if (map.has(key)) {\n const currentValue = map.get(key);\n if (Array.isArray(currentValue)) {\n currentValue.push(value);\n map.set(key, currentValue);\n } else {\n map.set(key, [currentValue, value]);\n }\n } else {\n map.set(key, value);\n }\n }\n\n return Object.fromEntries(map.entries());\n }\n\n toString() {\n return this.searchParams.toString();\n }\n\n push(mode: \"soft\" | \"hard\" = \"soft\") {\n this.callback(this.toJSON(), mode === \"soft\");\n }\n}\n\nexport function useSearchParams() {\n const { push } = useNavigate();\n const location = useLocation();\n const callback = (search: Record<string, any>, shallow: boolean) => {\n push(location.pathname as never, {\n search,\n shallow,\n });\n };\n\n const searchParams = new SearchParams(\n new URLSearchParams(location.search),\n callback,\n );\n\n return searchParams;\n}\n",
|
|
19
|
+
"import { useContext } from \"react\";\nimport { useLocation, ClientRouterContext } from \"./ClientRouterContext\";\nimport type { ViewPaths } from \"./types\";\n\ntype Pathname = ViewPaths;\n\nexport function useRoute() {\n const { getRoutePathnameFromHref } = useContext(ClientRouterContext);\n const location = useLocation();\n const routePath = getRoutePathnameFromHref(location.pathname) as Pathname;\n return {\n pathname: routePath,\n startsWith: (pathname: Pathname) => {\n return routePath.startsWith(pathname);\n },\n };\n}\n",
|
|
20
|
+
"import { useContext } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport function useParams() {\n const { params } = useContext(ClientRouterContext);\n return params;\n}\n",
|
|
21
|
+
"import { createContext, lazy, type PropsWithChildren } from \"react\";\nimport { type ServerDataContextValue } from \"./ServerDataProvider\";\nimport { flattenComponentTree } from \"./helpers/flattenComponentTree\";\n\nlet viewImportMap: Record<string, ReturnType<typeof lazy>> | null = null;\nif (typeof window !== \"undefined\" && process.env.NODE_ENV !== \"test\") {\n viewImportMap = {};\n const { componentTree } = (window as any)\n .__GEMI_DATA__ as ServerDataContextValue;\n\n for (const viewName of flattenComponentTree(componentTree)) {\n viewImportMap[viewName] = lazy((window as any).loaders[viewName]);\n }\n}\n\nexport const ComponentsContext = createContext({ viewImportMap });\n\nexport const ComponentsProvider = (\n props: PropsWithChildren<{ viewImportMap: typeof viewImportMap }>,\n) => {\n return (\n <ComponentsContext.Provider\n value={{ viewImportMap: props.viewImportMap ?? viewImportMap }}\n >\n {props.children}\n </ComponentsContext.Provider>\n );\n};\n",
|
|
22
|
+
"import type { ComponentTree } from \"../types\";\n\nexport function flattenComponentTree(componentTree: ComponentTree): string[] {\n let out: string[] = [];\n for (const [root, branches] of componentTree) {\n out.push(root, ...flattenComponentTree(branches).flat());\n }\n return Array.from(new Set(out));\n}\n",
|
|
23
|
+
"import {\n createContext,\n type PropsWithChildren,\n useEffect,\n useRef,\n} from \"react\";\n\ntype Subscribe = (\n topic: string,\n handler: (event: any) => void,\n) => Promise<void>;\n\nexport const WebSocketContext = createContext(\n {} as {\n broadcast: (topic: string, payload: Record<string, any>) => void;\n subscribe: Subscribe;\n unsubscribe: (\n topic: string,\n handler: (event: any) => void,\n ) => Promise<void>;\n },\n);\n\nexport const WebSocketContextProvider = (props: PropsWithChildren) => {\n const wsRef = useRef<WebSocket>(null);\n\n function getWS() {\n return new Promise<WebSocket>((resolve) => {\n if (wsRef.current) {\n resolve(wsRef.current);\n } else {\n const ws = new WebSocket(\"ws://localhost:5173/\");\n ws.onopen = () => {\n wsRef.current = ws;\n ws.addEventListener(\"close\", () => {\n wsRef.current = null;\n });\n resolve(ws);\n };\n }\n });\n }\n\n const subscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"subscribe\", topic }));\n ws.addEventListener(\"message\", handler);\n };\n\n const unsubscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"unsubscribe\", topic }));\n ws.removeEventListener(\"message\", handler);\n };\n\n const broadcast = async (topic: string, payload = {}) => {\n const ws = await getWS();\n ws.send(\n JSON.stringify({\n type: \"broadcast\",\n topic,\n payload,\n }),\n );\n };\n\n useEffect(() => {\n return () => {\n if (wsRef.current) {\n wsRef.current.close();\n wsRef.current = null;\n }\n };\n }, []);\n\n return (\n <WebSocketContext.Provider value={{ subscribe, unsubscribe, broadcast }}>\n {props.children}\n </WebSocketContext.Provider>\n );\n};\n",
|
|
24
|
+
"import { type ComponentType } from \"react\";\n\nimport { ClientRouter } from \"./ClientRouter\";\nimport { ServerDataProvider } from \"./ServerDataProvider\";\n\nexport function createRoot(RootLayout: ComponentType<any>) {\n return (props: any) => (\n <ServerDataProvider value={props.data}>\n <ClientRouter\n RootLayout={RootLayout}\n viewImportMap={props.viewImportMap}\n />\n </ServerDataProvider>\n );\n}\n",
|
|
25
|
+
"import { HttpRequest } from \"../../http\";\nimport type { ViewRoutes } from \"../../http/ViewRouter\";\n\nexport type ViewRouteExec = (req: HttpRequest<any, any>) => any; // TODO: fix type\n\nexport type FlatViewRoutes = Record<\n string,\n { exec: ViewRouteExec[]; middleware: (string | any)[] }\n>;\n\nexport function createFlatViewRoutes(routes: ViewRoutes) {\n const flatRoutes: FlatViewRoutes = {};\n\n for (const [routePath, viewConfigOrViewRouter] of Object.entries(routes)) {\n if (\"run\" in viewConfigOrViewRouter) {\n const route = viewConfigOrViewRouter;\n\n if (\"children\" in route) {\n const children = new route.children();\n const result = createFlatViewRoutes(children.routes);\n\n for (const [path, { exec, middleware }] of Object.entries(result)) {\n const key = routePath === \"/\" ? path : `${routePath}${path}`;\n const _key = path === \"/\" && routePath !== \"/\" ? routePath : key;\n\n flatRoutes[_key] = {\n exec: [route.run.bind(route), ...exec],\n middleware: [...route.middlewares, ...middleware],\n };\n }\n } else {\n flatRoutes[routePath] = {\n exec: [route.run.bind(route)],\n middleware: route.middlewares,\n };\n }\n } else {\n const router = new viewConfigOrViewRouter();\n const result = createFlatViewRoutes(router.routes);\n for (const [path, { exec, middleware }] of Object.entries(result)) {\n const key = routePath === \"/\" ? path : `${routePath}${path}`;\n const _key = path === \"/\" && routePath !== \"/\" ? routePath : key;\n flatRoutes[_key] = {\n exec,\n middleware: [...router.middlewares, ...middleware],\n };\n }\n }\n }\n\n return Object.fromEntries(\n Object.entries(flatRoutes).sort(([a], [b]) => {\n const x = a.split(\"/\").length + a.split(\":\").length;\n const y = b.split(\"/\").length + b.split(\":\").length;\n return x - y;\n }),\n );\n}\n",
|
|
26
|
+
"import { HttpRequest } from \"../../http\";\nimport { createRoot } from \"../../client/createRoot\";\n\nimport { Cookie } from \"../../http/Cookie\";\nimport { GEMI_REQUEST_BREAKER_ERROR } from \"../../http/Error\";\nimport { RequestContext } from \"../../http/requestContext\";\nimport type { RouterMiddleware } from \"../../http/Router\";\nimport {\n createFlatViewRoutes,\n FlatViewRoutes,\n type ViewRouteExec,\n} from \"./createFlatViewRoutes\";\nimport { ViewRouterServiceProvider } from \"./ViewRouterServiceProvider\";\n// @ts-ignore\nimport { renderToReadableStream } from \"react-dom/server.browser\";\nimport { createElement, Fragment } from \"react\";\n\n// @ts-ignore\nimport { URLPattern } from \"urlpattern-polyfill/urlpattern\";\nimport { ServiceContainer } from \"../ServiceContainer\";\nimport type { ViewRoutes } from \"../../http/ViewRouter\";\nimport { AuthViewRouter } from \"../../auth/AuthenticationServiceProvider\";\nimport { createRouteManifest } from \"./createRouteManifest\";\nimport { createComponentTree } from \"./createComponentTree\";\nimport { flattenComponentTree } from \"../../client/helpers/flattenComponentTree\";\nimport type { ComponentTree } from \"../../client/types\";\nimport { I18nServiceContainer } from \"../../http/I18nServiceContainer\";\nimport { MiddlewareServiceContainer } from \"../middleware/MiddlewareServiceContainer\";\n\nexport class ViewRouterServiceContainer extends ServiceContainer {\n name = \"ViewRouterServiceContainer\";\n\n flatViewRoutes: FlatViewRoutes = {};\n routeManifest: Record<string, string[]> = {};\n componentTree: ComponentTree = [];\n flatComponentTree: string[] = [];\n RootLayout: any = null;\n\n constructor(public service: ViewRouterServiceProvider) {\n super();\n const routes: ViewRoutes = {\n \"/\": service.rootRouter,\n \"/auth\": AuthViewRouter,\n };\n this.flatViewRoutes = createFlatViewRoutes(routes);\n this.routeManifest = createRouteManifest(routes);\n this.componentTree = createComponentTree(routes);\n this.flatComponentTree = flattenComponentTree(this.componentTree);\n this.RootLayout = createRoot(service.rootLayout);\n }\n\n boot() {}\n\n async handleViewRequest(req: Request) {\n const url = new URL(req.url);\n const isViewDataRequest = url.searchParams.get(\"json\");\n\n let pageData: {\n cookies: Set<Cookie>;\n headers: Headers;\n currentPathName: string;\n data: Record<string, any>;\n prefetchedData: Record<string, any>;\n user: any; // TODO: fix type\n params: Record<string, any>;\n } | null = null;\n\n try {\n let handlers: ViewRouteExec[] = [];\n let middlewares: (RouterMiddleware | string)[] = [];\n let currentPathName: null | string = null;\n let params: Record<string, any> = {};\n\n for (const [pathname, handler] of Object.entries(this.flatViewRoutes)) {\n const pattern = new URLPattern({ pathname });\n if (pattern.test({ pathname: url.pathname })) {\n currentPathName = pathname;\n params = pattern.exec({ pathname: url.pathname })?.pathname.groups!;\n handlers = handler.exec;\n middlewares = handler.middleware;\n break;\n }\n }\n\n const httpRequest = new HttpRequest(req, params);\n const { data, cookies, headers, user, prefetchedData } =\n await RequestContext.run(httpRequest, async () => {\n const ctx = RequestContext.getStore();\n ctx.setRequest(httpRequest);\n\n await MiddlewareServiceContainer.use().runMiddleware(\n middlewares,\n currentPathName,\n );\n\n const data = await Promise.all([\n ...handlers.map((fn) => fn(httpRequest as any)),\n ...Array.from(ctx.prefetchPromiseQueue).map((fn) => fn()),\n ]);\n\n const cookies = ctx.cookies;\n const headers = ctx.headers;\n const prefetchedResources = ctx.prefetchedResources;\n\n return {\n data,\n cookies,\n headers,\n user: ctx.user,\n prefetchedData: Object.fromEntries(prefetchedResources.entries()),\n };\n });\n\n pageData = {\n data,\n prefetchedData,\n currentPathName,\n user,\n params,\n cookies,\n headers,\n };\n } catch (err) {\n if (err.kind === GEMI_REQUEST_BREAKER_ERROR) {\n if (isViewDataRequest) {\n const { status = 400, data, directive, headers } = err.payload.api;\n return new Response(JSON.stringify({ data, directive }), {\n headers,\n status,\n });\n } else {\n const { status = 400, error } = err.payload.view;\n return new Response(error?.message, {\n ...err.payload.view,\n status,\n });\n }\n } else {\n throw err;\n }\n }\n\n const { data, params, currentPathName, user, cookies } = pageData;\n\n const viewData = data.reduce((acc, data) => {\n return {\n ...acc,\n ...data,\n };\n }, {});\n const i18nServiceContainer = I18nServiceContainer.use();\n const isI18nEnabled = i18nServiceContainer.isEnabled;\n let i18n: Record<string, any> = {};\n if (isI18nEnabled) {\n const locale = i18nServiceContainer.detectLocale(\n new HttpRequest(req, params as any),\n );\n const translations = i18nServiceContainer.getPageTranslations(\n locale,\n currentPathName,\n );\n\n i18n = {\n supportedLocales: i18nServiceContainer.supportedLocales,\n currentLocale: locale,\n dictionary: {\n [locale]: translations,\n },\n };\n }\n\n if (isViewDataRequest) {\n const headers = new Headers();\n headers.set(\"Content-Type\", \"application/json\");\n\n cookies.forEach((cookie) =>\n headers.append(\"Set-Cookie\", cookie.toString()),\n );\n\n headers.append(\n \"Cache-Control\",\n user\n ? \"private, no-cache, no-store, max-age=0, must-revalidate\"\n : \"public, max-age=864000, must-revalidate\",\n );\n\n return new Response(\n JSON.stringify({\n data: {\n [url.pathname]: viewData,\n },\n prefetchedData: pageData.prefetchedData,\n i18n,\n is404: !currentPathName,\n }),\n {\n headers,\n },\n );\n }\n\n const headers = new Headers();\n headers.set(\"Content-Type\", \"text/html\");\n headers.set(\n \"Cache-Control\",\n user\n ? \"private, no-cache, no-store, max-age=0, must-revalidate\"\n : \"public, max-age=864000, must-revalidate\",\n );\n headers.set(\"ETag\", 'W/\"' + Math.random().toString(36).substring(7) + '\"');\n\n pageData.cookies.forEach((cookie) =>\n headers.append(\"Set-Cookie\", cookie.toString()),\n );\n\n const result = {\n kind: \"view\",\n data: {\n pageData: {\n [url.pathname]: viewData,\n },\n prefetchedData: pageData.prefetchedData,\n i18n,\n auth: { user },\n routeManifest: this.routeManifest,\n router: {\n pathname: currentPathName,\n params,\n currentPath: url.pathname,\n searchParams: url.search,\n is404: !currentPathName ? true : false,\n },\n componentTree: [[\"404\", []], ...this.componentTree],\n },\n head: {},\n };\n const Root = this.RootLayout;\n return async (params: {\n styles: any[];\n viewImportMap: any;\n bootstrapModules: string[];\n loaders: string;\n }) => {\n const { bootstrapModules, loaders, styles, viewImportMap } = params;\n const stream = await renderToReadableStream(\n createElement(Fragment, {\n children: [\n styles,\n createElement(Root as any, {\n data: result.data,\n viewImportMap,\n }),\n ],\n }),\n {\n bootstrapScriptContent: `window.__GEMI_DATA__ = ${JSON.stringify(result.data)}; window.loaders=${loaders}`,\n bootstrapModules,\n },\n );\n\n return new Response(stream, {\n status: !currentPathName ? 404 : 200,\n headers,\n });\n };\n }\n}\n",
|
|
27
|
+
"import type { ViewRoutes } from \"../../http/ViewRouter\";\n\nexport function createRouteManifest(routes: ViewRoutes) {\n const routeManifest: Record<string, string[]> = {};\n for (const [routePath, routeHandler] of Object.entries(routes)) {\n if (\"run\" in routeHandler) {\n const viewPath = routeHandler.viewPath;\n\n if (\"children\" in routeHandler) {\n routeManifest[routePath] = [viewPath];\n }\n\n if (\"children\" in routeHandler) {\n const children = new routeHandler.children();\n const manifest = createRouteManifest(children.routes);\n for (const [path, viewPaths] of Object.entries(manifest)) {\n const key = routePath === \"/\" ? path : `${routePath}${path}`;\n const _key = path === \"/\" && routePath !== \"/\" ? routePath : key;\n routeManifest[_key] = [viewPath, ...viewPaths];\n }\n } else {\n routeManifest[routePath] = [viewPath];\n }\n } else {\n const router = new routeHandler();\n\n const manifest = createRouteManifest(router.routes);\n for (const [path, viewPaths] of Object.entries(manifest)) {\n const key = routePath === \"/\" ? path : `${routePath}${path}`;\n const _key = path === \"/\" && routePath !== \"/\" ? routePath : key;\n routeManifest[_key] = viewPaths;\n }\n }\n }\n\n return routeManifest;\n}\n",
|
|
28
|
+
"import type { ComponentTree } from \"../../client/types\";\nimport type { ViewRoutes } from \"../../http/ViewRouter\";\n\nexport function createComponentTree(routes: ViewRoutes): ComponentTree {\n const componentTree: ComponentTree = [];\n\n for (const [_, routeHandler] of Object.entries(routes)) {\n if (\"run\" in routeHandler) {\n const viewPath = routeHandler.viewPath;\n if (\"children\" in routeHandler) {\n const router = new routeHandler.children();\n const branch = createComponentTree(router.routes);\n componentTree.push([viewPath, branch]);\n } else {\n componentTree.push([viewPath, []]);\n }\n } else {\n const router = new routeHandler();\n const branch = createComponentTree(router.routes);\n componentTree.push(...branch);\n }\n }\n\n return componentTree;\n}\n"
|
|
29
|
+
],
|
|
30
|
+
"mappings": "6NAAA,YACE,mBACA,kBACA,eACA,iBACA,gBCLF,wBAAS,iEA6BF,IAAM,EAAoB,GAAc,CAAC,CAA2B,EAM9D,GAAqB,CAChC,IACG,CACH,IAAI,EAAS,EAAM,MAEnB,GAAI,EAAM,MACR,EAAS,EAAM,UAGf,GAAU,OAAe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version":3,"file":"ClientRouterContext.d.ts","sourceRoot":"","sources":["../../client/ClientRouterContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAwB,MAAM,SAAS,CAAC;AAC5E,OAAO,EAML,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ClientRouterContext.d.ts","sourceRoot":"","sources":["../../client/ClientRouterContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAwB,MAAM,SAAS,CAAC;AAC5E,OAAO,EAML,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,UAAU,wBAAwB;IAChC,kBAAkB,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACxD,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,wBAAwB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;IACzD,wBAAwB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC1D,mBAAmB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,4BAA4B,EAAE,CAAC,UAAU,EAAE,eAAe,KAAK,IAAI,CAAC;IACpE,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,eAAO,MAAM,mBAAmB,mDAE/B,CAAC;AAEF,UAAU,yBAAyB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,oBAAoB,UACxB,iBAAiB,CAAC,yBAAyB,CAAC,4CAwJpD,CAAC;AAUF,wBAAgB,WAAW,aAa1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpReload.d.ts","sourceRoot":"","sources":["../../client/HttpReload.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"HttpReload.d.ts","sourceRoot":"","sources":["../../client/HttpReload.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU,mCAkDtB,CAAC"}
|
package/dist/email/index.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"../chunk-
|
|
2
|
+
import"../chunk-642b04056dab5d64.js";import{J as T} from"../chunk-0d97333b6af9fc45.js";import{O as W} from"../chunk-b84d011a2972c7d1.js";import{P as Y,Q as V} from"../chunk-23d3df5f8342ecc6.js";import{Writable as O} from"stream";var C=T(V(),1);var{defineProperty:D,getOwnPropertySymbols:$}=Object,M=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,A=(F,q,z)=>(q in F)?D(F,q,{enumerable:!0,configurable:!0,writable:!0,value:z}):F[q]=z,U=(F,q)=>{for(var z in q||(q={}))if(M.call(q,z))A(F,z,q[z]);if($){for(var z of $(q))if(P.call(q,z))A(F,z,q[z])}return F},X=(F,q,z)=>{return new Promise((G,J)=>{var K=(H)=>{try{Q(z.next(H))}catch(L){J(L)}},R=(H)=>{try{Q(z.throw(H))}catch(L){J(L)}},Q=(H)=>H.done?G(H.value):Promise.resolve(H.value).then(K,R);Q((z=z.apply(F,q)).next())})},f={unformatted:["code","pre","em","strong","span"],indent_inner_html:!0,indent_char:" ",indent_size:2,sep:"\n"},w=(F,q={})=>{return C.default.html(F,U(U({},f),q))},x=[{selector:"img",format:"skip"},{selector:"#__react-email-preview",format:"skip"},{selector:"a",options:{linkBrackets:!1}}],B=new TextDecoder("utf-8"),I=(F)=>X(void 0,null,function*(){let q="";if("pipeTo"in F){const z=new WritableStream({write(G){q+=B.decode(G)}});yield F.pipeTo(z)}else{const z=new O({write(G,J,K){q+=B.decode(G),K()}});return F.pipe(z),new Promise((G,J)=>{z.on("error",J),z.on("close",()=>{G(q)})})}return q}),E=(F,q)=>X(void 0,null,function*(){const{default:z}=yield import("react-dom/server");let G;if(Object.hasOwn(z,"renderToReadableStream"))G=yield I(yield z.renderToReadableStream(F));else yield new Promise((R,Q)=>{const H=z.renderToPipeableStream(F,{onAllReady(){return X(this,null,function*(){G=yield I(H),R()})},onError(L){Q(L)}})});if(q==null?void 0:q.plainText)return Y(G,U({selectors:x},q.htmlToTextOptions));const K=`${'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'}${G.replace(/<!DOCTYPE.*?>/,"")}`;if(q==null?void 0:q.pretty)return w(K);return K}),j=new TextDecoder("utf-8");import{jsxDEV as g} from"react/jsx-dev-runtime";class N{from="";to=[];subject="No Subject";cc=[];bcc=[];attachments=[];template;static async send(F){const q=new this,{to:z=q.to,from:G=q.from,subject:J=q.subject,cc:K=q.cc,bcc:R=q.bcc,attachments:Q=q.attachments,data:H}=F,L=await q.render(H);if(process.env.EMAIL_DEBUG){const Z=`${process.env.ROOT_DIR}/.debug/emails/${(new Date()).toISOString()}${J}.html`;await Bun.write(Z,L),Bun.spawnSync(["open",Z]);return}await W.use().service.driver.send({bcc:R,cc:K,from:G,subject:J,to:z,attachments:Q,html:L})}async render(F){const q=this.template;return await E(g(q,{...F},void 0,!1,void 0,this))}}export{N as Email};
|
|
3
|
+
|
|
4
|
+
//# debugId=D2A2E9405F02BE4564756e2164756e21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../node_modules/@react-email/render/dist/node/index.mjs", "../email/Email.tsx"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"var __defProp = Object.defineProperty;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n};\n\n// src/node/render.ts\nimport { Writable } from \"node:stream\";\nimport { convert } from \"html-to-text\";\n\n// src/shared/utils/pretty.ts\nimport jsBeautify from \"js-beautify\";\nvar defaults = {\n unformatted: [\"code\", \"pre\", \"em\", \"strong\", \"span\"],\n indent_inner_html: true,\n indent_char: \" \",\n indent_size: 2,\n sep: \"\\n\"\n};\nvar pretty = (str, options = {}) => {\n return jsBeautify.html(str, __spreadValues(__spreadValues({}, defaults), options));\n};\n\n// src/shared/plain-text-selectors.ts\nvar plainTextSelectors = [\n { selector: \"img\", format: \"skip\" },\n { selector: \"#__react-email-preview\", format: \"skip\" },\n {\n selector: \"a\",\n options: { linkBrackets: false }\n }\n];\n\n// src/node/render.ts\nvar decoder = new TextDecoder(\"utf-8\");\nvar readStream = (stream) => __async(void 0, null, function* () {\n let result = \"\";\n if (\"pipeTo\" in stream) {\n const writableStream = new WritableStream({\n write(chunk) {\n result += decoder.decode(chunk);\n }\n });\n yield stream.pipeTo(writableStream);\n } else {\n const writable = new Writable({\n write(chunk, _encoding, callback) {\n result += decoder.decode(chunk);\n callback();\n }\n });\n stream.pipe(writable);\n return new Promise((resolve, reject) => {\n writable.on(\"error\", reject);\n writable.on(\"close\", () => {\n resolve(result);\n });\n });\n }\n return result;\n});\nvar render = (component, options) => __async(void 0, null, function* () {\n const { default: reactDOMServer } = yield import(\"react-dom/server\");\n let html;\n if (Object.hasOwn(reactDOMServer, \"renderToReadableStream\")) {\n html = yield readStream(\n yield reactDOMServer.renderToReadableStream(component)\n );\n } else {\n yield new Promise((resolve, reject) => {\n const stream = reactDOMServer.renderToPipeableStream(component, {\n onAllReady() {\n return __async(this, null, function* () {\n html = yield readStream(stream);\n resolve();\n });\n },\n onError(error) {\n reject(error);\n }\n });\n });\n }\n if (options == null ? void 0 : options.plainText) {\n return convert(html, __spreadValues({\n selectors: plainTextSelectors\n }, options.htmlToTextOptions));\n }\n const doctype = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">';\n const document = `${doctype}${html.replace(/<!DOCTYPE.*?>/, \"\")}`;\n if (options == null ? void 0 : options.pretty) {\n return pretty(document);\n }\n return document;\n});\n\n// src/node/render-async.ts\nimport { Writable as Writable2 } from \"node:stream\";\nimport { convert as convert2 } from \"html-to-text\";\nvar decoder2 = new TextDecoder(\"utf-8\");\nvar readStream2 = (stream) => __async(void 0, null, function* () {\n let result = \"\";\n if (\"pipeTo\" in stream) {\n const writableStream = new WritableStream({\n write(chunk) {\n result += decoder2.decode(chunk);\n }\n });\n yield stream.pipeTo(writableStream);\n } else {\n const writable = new Writable2({\n write(chunk, _encoding, callback) {\n result += decoder2.decode(chunk);\n callback();\n }\n });\n stream.pipe(writable);\n return new Promise((resolve, reject) => {\n writable.on(\"error\", reject);\n writable.on(\"close\", () => {\n resolve(result);\n });\n });\n }\n return result;\n});\nvar renderAsync = (component, options) => __async(void 0, null, function* () {\n const { default: reactDOMServer } = yield import(\"react-dom/server\");\n let html;\n if (Object.hasOwn(reactDOMServer, \"renderToReadableStream\")) {\n html = yield readStream2(\n yield reactDOMServer.renderToReadableStream(component)\n );\n } else {\n yield new Promise((resolve, reject) => {\n const stream = reactDOMServer.renderToPipeableStream(component, {\n onAllReady() {\n return __async(this, null, function* () {\n html = yield readStream2(stream);\n resolve();\n });\n },\n onError(error) {\n reject(error);\n }\n });\n });\n }\n if (options == null ? void 0 : options.plainText) {\n return convert2(html, __spreadValues({\n selectors: plainTextSelectors\n }, options.htmlToTextOptions));\n }\n const doctype = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">';\n const document = `${doctype}${html.replace(/<!DOCTYPE.*?>/, \"\")}`;\n if (options == null ? void 0 : options.pretty) {\n return pretty(document);\n }\n return document;\n});\nexport {\n plainTextSelectors,\n render,\n renderAsync\n};\n",
|
|
6
|
+
"import { ComponentType } from \"react\";\nimport { render } from \"@react-email/render\";\nimport { EmailServiceContainer } from \"../services/email/EmailServiceContainer\";\nimport { SendEmailParams } from \"../services/email/drivers/types\";\n\ninterface SendEmailArgs<T> extends Partial<Omit<SendEmailParams, \"html\">> {\n data: T;\n}\n\nexport class Email {\n from = \"\";\n to = [];\n subject = \"No Subject\";\n cc = [];\n bcc = [];\n attachments = [];\n template: ComponentType<any>;\n\n static async send<T extends Email>(\n this: new () => T,\n args: SendEmailArgs<\n T[\"template\"] extends (p: infer P) => JSX.Element ? P : never\n >,\n ) {\n const instance = new this();\n\n const {\n to = instance.to,\n from = instance.from,\n subject = instance.subject,\n cc = instance.cc,\n bcc = instance.bcc,\n attachments = instance.attachments,\n data,\n } = args;\n\n const html = await instance.render(data);\n\n if (process.env.EMAIL_DEBUG) {\n const fileName = `${process.env.ROOT_DIR}/.debug/emails/${new Date().toISOString()}${subject}.html`;\n await Bun.write(fileName, html);\n Bun.spawnSync([\"open\", fileName]);\n return;\n }\n\n await EmailServiceContainer.use().service.driver.send({\n bcc,\n cc,\n from,\n subject,\n to,\n attachments,\n html,\n });\n }\n\n protected async render<T extends Record<string, any>>(props: T) {\n const Template = this.template;\n const markup = await render(<Template {...props} />);\n\n return markup;\n }\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";yLAsCA,sBAAS,mBAIT,kBA1CA,IAAuB,eAAnB,EAC6B,sBAA7B,GAAsB,OACtB,EAAe,OAAO,UAAU,eAChC,EAAe,OAAO,UAAU,qBAChC,EAAkB,CAAC,EAAK,EAAK,KAAU,KAAO,GAAM,EAAU,EAAK,EAAK,CAAE,WAAY,GAAM,aAAc,GAAM,SAAU,GAAM,OAAM,CAAC,EAAI,EAAI,GAAO,EACtJ,EAAiB,CAAC,EAAG,IAAM,CAC7B,QAAS,KAAQ,IAAM,EAAI,CAAC,GAC1B,GAAI,EAAa,KAAK,EAAG,CAAI,EAC3B,EAAgB,EAAG,EAAM,EAAE,EAAK,EACpC,GAAI,GACF,QAAS,KAAQ,EAAoB,CAAC,EACpC,GAAI,EAAa,KAAK,EAAG,CAAI,EAC3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O,MAAM,EAAS,OAAO,CAAI,EAEvC,GAAI,QAAQ,IAAI,YAAa,CAC3B,MAAM,EAAW,GAAG,QAAQ,IAAI,2BAA0B,IAAI,KAAK,GAAE,YAAY,IAAI,SACrF,MAAM,IAAI,MAAM,EAAU,CAAI,EAC9B,IAAI,UAAU,CAAC,OAAQ,CAAQ,CAAC,EAChC,OAGF,MAAM,EAAsB,IAAI,EAAE,QAAQ,OAAO,KAAK,CACpD,MACA,KACA,OACA,UACA,KACA,cACA,MACF,CAAC,OAGa,OAAqC,CAAC,EAAU,CAC9D,MAAM,EAAW,KAAK,SAGtB,OAFe,MAAM,EAAO,EAAC,EAAD,IAAc,GAAd,qBAAqB,CAAE,EAIvD",
|
|
9
|
+
"debugId": "D2A2E9405F02BE4564756e2164756e21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../facades/Auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../facades/Auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAOnD,qBAAa,IAAI;WACF,IAAI,IAAI,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;WAoC5B,KAAK,CAChB,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,GAC7C,OAAO,CAAC,IAAI,CAAC;WAgBH,SAAS,CACpB,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,GAC7C,OAAO,CAAC,OAAO,CAAC;CAYpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Broadcast.d.ts","sourceRoot":"","sources":["../../facades/Broadcast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Broadcast.d.ts","sourceRoot":"","sources":["../../facades/Broadcast.ts"],"names":[],"mappings":"AAIA,qBAAa,SAAS;IACpB,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG;wBAS3B,MAAM,GAAG,eAAe,GAAG,WAAW,GAAG,iBAAiB,aACtD,OAAO;;CAWxB"}
|