@series-inc/venus-sdk 3.1.2-beta.0 → 3.1.2-beta.2
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/{AdsApi-xw-M1AEl.d.mts → AdsApi-BV_VKgMO.d.mts} +4 -2
- package/dist/{AdsApi-xw-M1AEl.d.ts → AdsApi-BV_VKgMO.d.ts} +4 -2
- package/dist/{chunk-UXY5CKKG.mjs → chunk-3ZNKYBXC.mjs} +3 -3
- package/dist/chunk-3ZNKYBXC.mjs.map +1 -0
- package/dist/{chunk-QQTWO5KS.mjs → chunk-G5AFYBIK.mjs} +34 -10
- package/dist/chunk-G5AFYBIK.mjs.map +1 -0
- package/dist/index.cjs +33 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +2 -2
- package/dist/venus-api/index.cjs +32 -8
- package/dist/venus-api/index.cjs.map +1 -1
- package/dist/venus-api/index.d.mts +2 -2
- package/dist/venus-api/index.d.ts +2 -2
- package/dist/venus-api/index.mjs +1 -1
- package/dist/webview/index.cjs +1 -1
- package/dist/webview/index.cjs.map +1 -1
- package/dist/webview/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-QQTWO5KS.mjs.map +0 -1
- package/dist/chunk-UXY5CKKG.mjs.map +0 -1
|
@@ -819,7 +819,8 @@ interface LoggingApi {
|
|
|
819
819
|
}
|
|
820
820
|
|
|
821
821
|
interface SharedAssetsApi {
|
|
822
|
-
|
|
822
|
+
loadCharactersBundle(): Promise<ArrayBuffer>;
|
|
823
|
+
loadBurgerTimeAssetsBundle(): Promise<ArrayBuffer>;
|
|
823
824
|
loadLibraryCode(libraryKey: string): Promise<string>;
|
|
824
825
|
}
|
|
825
826
|
|
|
@@ -827,7 +828,8 @@ declare class RpcSharedAssetsApi implements SharedAssetsApi {
|
|
|
827
828
|
private readonly venusApi;
|
|
828
829
|
private readonly rpcClient;
|
|
829
830
|
constructor(rpcClient: RpcClient, venusApi: VenusAPI);
|
|
830
|
-
|
|
831
|
+
loadBurgerTimeAssetsBundle(): Promise<ArrayBuffer>;
|
|
832
|
+
loadCharactersBundle(): Promise<ArrayBuffer>;
|
|
831
833
|
loadLibraryCode(libraryKey: string): Promise<string>;
|
|
832
834
|
}
|
|
833
835
|
interface LoadEmbeddedAssetsRequest {
|
|
@@ -819,7 +819,8 @@ interface LoggingApi {
|
|
|
819
819
|
}
|
|
820
820
|
|
|
821
821
|
interface SharedAssetsApi {
|
|
822
|
-
|
|
822
|
+
loadCharactersBundle(): Promise<ArrayBuffer>;
|
|
823
|
+
loadBurgerTimeAssetsBundle(): Promise<ArrayBuffer>;
|
|
823
824
|
loadLibraryCode(libraryKey: string): Promise<string>;
|
|
824
825
|
}
|
|
825
826
|
|
|
@@ -827,7 +828,8 @@ declare class RpcSharedAssetsApi implements SharedAssetsApi {
|
|
|
827
828
|
private readonly venusApi;
|
|
828
829
|
private readonly rpcClient;
|
|
829
830
|
constructor(rpcClient: RpcClient, venusApi: VenusAPI);
|
|
830
|
-
|
|
831
|
+
loadBurgerTimeAssetsBundle(): Promise<ArrayBuffer>;
|
|
832
|
+
loadCharactersBundle(): Promise<ArrayBuffer>;
|
|
831
833
|
loadLibraryCode(libraryKey: string): Promise<string>;
|
|
832
834
|
}
|
|
833
835
|
interface LoadEmbeddedAssetsRequest {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// raw-loader
|
|
1
|
+
// raw-loader:E:\SeriesAI\venus\venus-sdk\packages\api\src\webview\webviewLibraryShim.js
|
|
2
2
|
var webviewLibraryShim_default = "/**\r\n * Venus Embedded Libraries WebView Shim\r\n *\r\n * This code is injected into H5 game WebViews BEFORE the game's main script runs.\r\n * It bootstraps the embedded libraries system by:\r\n * 1. Reading window.__venusLibrariesConfig (set by the Vite plugin)\r\n * 2. Loading libraries via RPC (mobile) or CDN (web)\r\n * 3. Registering libraries in window.__venusLibraryExports\r\n * 4. Allowing the game's virtual modules to access them\r\n *\r\n * This shim is NOT imported by H5 games - it's injected by the Venus host via\r\n * injectedJavaScriptBeforeContentLoaded in H5AppPoolRenderer.\r\n */\r\n\r\n;(function () {\r\n if (typeof window === 'undefined') {\r\n return\r\n }\r\n\r\n if (window.__venusLibraryShim && window.__venusLibraryShim.__initialized) {\r\n return\r\n }\r\n\r\n var RESPONSE_TYPE = 'H5_RESPONSE'\r\n var REQUEST_TYPE = 'H5_LOAD_EMBEDDED_ASSET'\r\n var REQUEST_TIMEOUT_MS = 12000\r\n var pendingRequests = new Map()\r\n\r\n function ensureConfig() {\r\n if (!window.__venusLibrariesConfig) {\r\n window.__venusLibrariesConfig = {\r\n enabled: false,\r\n required: [],\r\n manifest: {},\r\n cdnBase: '',\r\n }\r\n }\r\n if (!window.__venusLibrariesConfig.manifest) {\r\n window.__venusLibrariesConfig.manifest = {}\r\n }\r\n if (!Array.isArray(window.__venusLibrariesConfig.required)) {\r\n window.__venusLibrariesConfig.required = []\r\n }\r\n return window.__venusLibrariesConfig\r\n }\r\n\r\n function ensureExportsRegistry() {\r\n if (!window.__venusLibraryExports) {\r\n window.__venusLibraryExports = {}\r\n }\r\n return window.__venusLibraryExports\r\n }\r\n\r\n function hasHostBridge() {\r\n return !!(\r\n window.ReactNativeWebView &&\r\n typeof window.ReactNativeWebView.postMessage === 'function'\r\n )\r\n }\r\n\r\n function registerResponseListeners() {\r\n if (\r\n window.__venusLibraryShim &&\r\n window.__venusLibraryShim.__listenerRegistered\r\n ) {\r\n return\r\n }\r\n\r\n function handleMessage(event) {\r\n var payload = parsePayload(event && event.data)\r\n if (!payload || payload.type !== RESPONSE_TYPE || !payload.data) {\r\n return\r\n }\r\n var requestId = payload.data.requestId\r\n if (!requestId || !pendingRequests.has(requestId)) {\r\n return\r\n }\r\n var pending = pendingRequests.get(requestId)\r\n pendingRequests.delete(requestId)\r\n clearTimeout(pending.timeout)\r\n\r\n if (payload.data.success === false) {\r\n pending.reject(\r\n new Error(payload.data.error || 'Embedded library load failed'),\r\n )\r\n return\r\n }\r\n\r\n var value = payload.data.value || payload.data\r\n if (!value || !value.base64Data) {\r\n pending.reject(\r\n new Error('Embedded library response was missing base64Data'),\r\n )\r\n return\r\n }\r\n\r\n pending.resolve(value.base64Data)\r\n }\r\n\r\n if (\r\n typeof document !== 'undefined' &&\r\n typeof document.addEventListener === 'function'\r\n ) {\r\n document.addEventListener('message', handleMessage, false)\r\n }\r\n if (\r\n typeof window !== 'undefined' &&\r\n typeof window.addEventListener === 'function'\r\n ) {\r\n window.addEventListener('message', handleMessage, false)\r\n }\r\n\r\n if (!window.__venusLibraryShim) {\r\n window.__venusLibraryShim = {}\r\n }\r\n window.__venusLibraryShim.__listenerRegistered = true\r\n }\r\n\r\n function parsePayload(raw) {\r\n if (!raw || typeof raw !== 'string') {\r\n return null\r\n }\r\n try {\r\n return JSON.parse(raw)\r\n } catch (error) {\r\n return null\r\n }\r\n }\r\n\r\n function createRequestId(libraryKey) {\r\n var sanitized = ''\r\n for (var i = 0; i < libraryKey.length; i++) {\r\n var c = libraryKey.charAt(i)\r\n if (\r\n (c >= 'a' && c <= 'z') ||\r\n (c >= 'A' && c <= 'Z') ||\r\n (c >= '0' && c <= '9') ||\r\n c === '-' ||\r\n c === '_'\r\n ) {\r\n sanitized += c\r\n } else {\r\n sanitized += '_'\r\n }\r\n }\r\n return (\r\n 'embedded-lib-' +\r\n sanitized +\r\n '-' +\r\n Date.now() +\r\n '-' +\r\n Math.random().toString(36).slice(2)\r\n )\r\n }\r\n\r\n function postHostRequest(assetKey, requestId) {\r\n if (!hasHostBridge()) {\r\n throw new Error('Host bridge is unavailable')\r\n }\r\n var bridge = window.ReactNativeWebView\r\n var message = {\r\n type: REQUEST_TYPE,\r\n direction: 'H5_TO_APP',\r\n data: {\r\n requestId: requestId,\r\n assetKey: assetKey,\r\n },\r\n instanceId:\r\n (window._venusInitState && window._venusInitState.poolId) || 'unknown',\r\n timestamp: Date.now(),\r\n }\r\n bridge.postMessage(JSON.stringify(message))\r\n }\r\n\r\n function loadLibraryViaHost(assetKey, libraryKey) {\r\n return new Promise(function (resolve, reject) {\r\n var requestId = createRequestId(libraryKey)\r\n var timeout = setTimeout(function () {\r\n pendingRequests.delete(requestId)\r\n reject(new Error('Timed out loading embedded library: ' + libraryKey))\r\n }, REQUEST_TIMEOUT_MS)\r\n\r\n pendingRequests.set(requestId, {\r\n resolve: resolve,\r\n reject: reject,\r\n timeout: timeout,\r\n })\r\n\r\n try {\r\n postHostRequest(assetKey, requestId)\r\n } catch (error) {\r\n pendingRequests.delete(requestId)\r\n clearTimeout(timeout)\r\n reject(error)\r\n }\r\n })\r\n }\r\n\r\n function buildCdnUrl(config, entry) {\r\n var base = config.cdnBase || ''\r\n if (!base.endsWith('/')) {\r\n base += '/'\r\n }\r\n var path = entry.cdnPath\r\n if (path.charAt(0) === '/') {\r\n path = path.substring(1)\r\n }\r\n return base + path\r\n }\r\n\r\n async function loadLibraryViaCdn(config, entry, libraryKey) {\r\n if (!config.cdnBase) {\r\n throw new Error('CDN base URL is not configured')\r\n }\r\n var url = buildCdnUrl(config, entry)\r\n var response = await fetch(url, { credentials: 'omit' })\r\n if (!response.ok) {\r\n throw new Error(\r\n 'Failed to fetch embedded library from CDN: ' + libraryKey,\r\n )\r\n }\r\n return await response.text()\r\n }\r\n\r\n function decodeBase64ToUtf8(base64) {\r\n if (typeof base64 !== 'string') {\r\n throw new Error('Invalid base64 payload')\r\n }\r\n\r\n if (typeof atob === 'function') {\r\n var binary = atob(base64)\r\n if (typeof TextDecoder !== 'undefined') {\r\n var len = binary.length\r\n var bytes = new Uint8Array(len)\r\n for (var i = 0; i < len; i++) {\r\n bytes[i] = binary.charCodeAt(i)\r\n }\r\n return new TextDecoder('utf-8').decode(bytes)\r\n }\r\n return decodeURIComponent(escape(binary))\r\n }\r\n\r\n var bufferCtor =\r\n (typeof globalThis !== 'undefined' && globalThis.Buffer) ||\r\n (typeof window !== 'undefined' && window.Buffer)\r\n if (bufferCtor) {\r\n return bufferCtor.from(base64, 'base64').toString('utf-8')\r\n }\r\n\r\n throw new Error('No base64 decoder available')\r\n }\r\n\r\n function evaluateLibrarySource(libraryKey, globalVar, source) {\r\n var registry = ensureExportsRegistry()\r\n if (!source) {\r\n throw new Error('Embedded library source was empty for ' + libraryKey)\r\n }\r\n\r\n var previousValue = window[globalVar]\r\n try {\r\n var executor = new Function(\r\n source + '\\n//# sourceURL=venus-library-' + libraryKey + '.js',\r\n )\r\n executor.call(window)\r\n } catch (error) {\r\n throw new Error(\r\n 'Failed to evaluate embedded library ' +\r\n libraryKey +\r\n ': ' +\r\n (error && error.message ? error.message : error),\r\n )\r\n }\r\n\r\n var exported = window[globalVar] || previousValue\r\n if (!exported) {\r\n throw new Error(\r\n 'Embedded library ' + libraryKey + ' did not register ' + globalVar,\r\n )\r\n }\r\n\r\n registry[libraryKey] = exported\r\n return exported\r\n }\r\n\r\n async function ensureLibraryLoaded(config, libraryKey) {\r\n var registry = ensureExportsRegistry()\r\n if (registry[libraryKey]) {\r\n return registry[libraryKey]\r\n }\r\n\r\n var entry = config.manifest && config.manifest[libraryKey]\r\n if (!entry) {\r\n throw new Error('No manifest entry for embedded library ' + libraryKey)\r\n }\r\n\r\n var source = null\r\n if (config.useHost !== false && hasHostBridge()) {\r\n try {\r\n var base64 = await loadLibraryViaHost(entry.assetKey, libraryKey)\r\n source = decodeBase64ToUtf8(base64)\r\n } catch (error) {\r\n // Log the RPC error loudly before fallback\r\n console.error(\r\n '[Venus Libraries] Failed to load ' +\r\n libraryKey +\r\n ' from host via RPC:',\r\n error,\r\n )\r\n console.warn(\r\n '[Venus Libraries] Falling back to CDN for ' +\r\n libraryKey +\r\n '. This may indicate an asset packaging issue.',\r\n )\r\n }\r\n }\r\n\r\n if (!source) {\r\n source = await loadLibraryViaCdn(config, entry, libraryKey)\r\n }\r\n\r\n return evaluateLibrarySource(libraryKey, entry.globalVar, source)\r\n }\r\n\r\n async function bootstrap() {\r\n try {\r\n registerResponseListeners()\r\n getBootstrapPromise()\r\n\r\n var config = ensureConfig()\r\n\r\n if (!config.enabled) {\r\n if (bootstrapResolve) bootstrapResolve()\r\n return\r\n }\r\n\r\n if (!Array.isArray(config.required) || config.required.length === 0) {\r\n if (bootstrapResolve) bootstrapResolve()\r\n return\r\n }\r\n\r\n // Group libraries by load stage for parallel loading within stages\r\n var librariesByStage = {}\r\n for (var i = 0; i < config.required.length; i++) {\r\n var libraryKey = config.required[i]\r\n var entry = config.manifest[libraryKey]\r\n var stage = entry.loadStage || 0\r\n if (!librariesByStage[stage]) librariesByStage[stage] = []\r\n librariesByStage[stage].push(libraryKey)\r\n }\r\n\r\n // Load stages sequentially, libraries within each stage in parallel\r\n var stages = Object.keys(librariesByStage).sort(function (a, b) {\r\n return parseInt(a, 10) - parseInt(b, 10)\r\n })\r\n\r\n for (var s = 0; s < stages.length; s++) {\r\n var stage = stages[s]\r\n var libs = librariesByStage[stage]\r\n\r\n // Load all libraries in this stage in parallel\r\n var stagePromises = libs.map(function (libraryKey) {\r\n return ensureLibraryLoaded(config, libraryKey).catch(\r\n function (error) {\r\n console.error(\r\n '[Venus Libraries] Failed to load library ' + libraryKey,\r\n error,\r\n )\r\n throw error\r\n },\r\n )\r\n })\r\n\r\n await Promise.all(stagePromises)\r\n }\r\n\r\n if (bootstrapResolve) bootstrapResolve()\r\n } catch (error) {\r\n console.error('[Venus Libraries] Bootstrap error', error)\r\n if (bootstrapReject) bootstrapReject(error)\r\n throw error\r\n }\r\n }\r\n\r\n // Create a promise that resolves when bootstrap completes\r\n var bootstrapPromise = null\r\n var bootstrapResolve = null\r\n var bootstrapReject = null\r\n\r\n function getBootstrapPromise() {\r\n if (!bootstrapPromise) {\r\n bootstrapPromise = new Promise(function (resolve, reject) {\r\n bootstrapResolve = resolve\r\n bootstrapReject = reject\r\n })\r\n }\r\n return bootstrapPromise\r\n }\r\n\r\n window.__venusLibraryShim = {\r\n bootstrap: bootstrap,\r\n ready: getBootstrapPromise,\r\n getExports: function (libraryKey) {\r\n var registry = ensureExportsRegistry()\r\n return registry[libraryKey]\r\n },\r\n __initialized: true,\r\n }\r\n})()\r\n";
|
|
3
3
|
|
|
4
4
|
// src/webview/webviewLibraryShimSource.ts
|
|
@@ -8,5 +8,5 @@ function getWebviewLibraryShimSource() {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export { WEBVIEW_LIBRARY_SHIM_SOURCE, getWebviewLibraryShimSource };
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-3ZNKYBXC.mjs.map
|
|
12
|
+
//# sourceMappingURL=chunk-3ZNKYBXC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["raw-loader:E:/SeriesAI/venus/venus-sdk/packages/api/src/webview/webviewLibraryShim.js","../src/webview/webviewLibraryShimSource.ts"],"names":[],"mappings":";AAAA,IAAO,0BAAA,GAAQ,omYAAA;;;ACcR,IAAM,2BAAA,GAA8B;AAEpC,SAAS,2BAAA,GAAsC;AACpD,EAAA,OAAO,2BAAA;AACT","file":"chunk-3ZNKYBXC.mjs","sourcesContent":["export default \"/**\\r\\n * Venus Embedded Libraries WebView Shim\\r\\n *\\r\\n * This code is injected into H5 game WebViews BEFORE the game's main script runs.\\r\\n * It bootstraps the embedded libraries system by:\\r\\n * 1. Reading window.__venusLibrariesConfig (set by the Vite plugin)\\r\\n * 2. Loading libraries via RPC (mobile) or CDN (web)\\r\\n * 3. Registering libraries in window.__venusLibraryExports\\r\\n * 4. Allowing the game's virtual modules to access them\\r\\n *\\r\\n * This shim is NOT imported by H5 games - it's injected by the Venus host via\\r\\n * injectedJavaScriptBeforeContentLoaded in H5AppPoolRenderer.\\r\\n */\\r\\n\\r\\n;(function () {\\r\\n if (typeof window === 'undefined') {\\r\\n return\\r\\n }\\r\\n\\r\\n if (window.__venusLibraryShim && window.__venusLibraryShim.__initialized) {\\r\\n return\\r\\n }\\r\\n\\r\\n var RESPONSE_TYPE = 'H5_RESPONSE'\\r\\n var REQUEST_TYPE = 'H5_LOAD_EMBEDDED_ASSET'\\r\\n var REQUEST_TIMEOUT_MS = 12000\\r\\n var pendingRequests = new Map()\\r\\n\\r\\n function ensureConfig() {\\r\\n if (!window.__venusLibrariesConfig) {\\r\\n window.__venusLibrariesConfig = {\\r\\n enabled: false,\\r\\n required: [],\\r\\n manifest: {},\\r\\n cdnBase: '',\\r\\n }\\r\\n }\\r\\n if (!window.__venusLibrariesConfig.manifest) {\\r\\n window.__venusLibrariesConfig.manifest = {}\\r\\n }\\r\\n if (!Array.isArray(window.__venusLibrariesConfig.required)) {\\r\\n window.__venusLibrariesConfig.required = []\\r\\n }\\r\\n return window.__venusLibrariesConfig\\r\\n }\\r\\n\\r\\n function ensureExportsRegistry() {\\r\\n if (!window.__venusLibraryExports) {\\r\\n window.__venusLibraryExports = {}\\r\\n }\\r\\n return window.__venusLibraryExports\\r\\n }\\r\\n\\r\\n function hasHostBridge() {\\r\\n return !!(\\r\\n window.ReactNativeWebView &&\\r\\n typeof window.ReactNativeWebView.postMessage === 'function'\\r\\n )\\r\\n }\\r\\n\\r\\n function registerResponseListeners() {\\r\\n if (\\r\\n window.__venusLibraryShim &&\\r\\n window.__venusLibraryShim.__listenerRegistered\\r\\n ) {\\r\\n return\\r\\n }\\r\\n\\r\\n function handleMessage(event) {\\r\\n var payload = parsePayload(event && event.data)\\r\\n if (!payload || payload.type !== RESPONSE_TYPE || !payload.data) {\\r\\n return\\r\\n }\\r\\n var requestId = payload.data.requestId\\r\\n if (!requestId || !pendingRequests.has(requestId)) {\\r\\n return\\r\\n }\\r\\n var pending = pendingRequests.get(requestId)\\r\\n pendingRequests.delete(requestId)\\r\\n clearTimeout(pending.timeout)\\r\\n\\r\\n if (payload.data.success === false) {\\r\\n pending.reject(\\r\\n new Error(payload.data.error || 'Embedded library load failed'),\\r\\n )\\r\\n return\\r\\n }\\r\\n\\r\\n var value = payload.data.value || payload.data\\r\\n if (!value || !value.base64Data) {\\r\\n pending.reject(\\r\\n new Error('Embedded library response was missing base64Data'),\\r\\n )\\r\\n return\\r\\n }\\r\\n\\r\\n pending.resolve(value.base64Data)\\r\\n }\\r\\n\\r\\n if (\\r\\n typeof document !== 'undefined' &&\\r\\n typeof document.addEventListener === 'function'\\r\\n ) {\\r\\n document.addEventListener('message', handleMessage, false)\\r\\n }\\r\\n if (\\r\\n typeof window !== 'undefined' &&\\r\\n typeof window.addEventListener === 'function'\\r\\n ) {\\r\\n window.addEventListener('message', handleMessage, false)\\r\\n }\\r\\n\\r\\n if (!window.__venusLibraryShim) {\\r\\n window.__venusLibraryShim = {}\\r\\n }\\r\\n window.__venusLibraryShim.__listenerRegistered = true\\r\\n }\\r\\n\\r\\n function parsePayload(raw) {\\r\\n if (!raw || typeof raw !== 'string') {\\r\\n return null\\r\\n }\\r\\n try {\\r\\n return JSON.parse(raw)\\r\\n } catch (error) {\\r\\n return null\\r\\n }\\r\\n }\\r\\n\\r\\n function createRequestId(libraryKey) {\\r\\n var sanitized = ''\\r\\n for (var i = 0; i < libraryKey.length; i++) {\\r\\n var c = libraryKey.charAt(i)\\r\\n if (\\r\\n (c >= 'a' && c <= 'z') ||\\r\\n (c >= 'A' && c <= 'Z') ||\\r\\n (c >= '0' && c <= '9') ||\\r\\n c === '-' ||\\r\\n c === '_'\\r\\n ) {\\r\\n sanitized += c\\r\\n } else {\\r\\n sanitized += '_'\\r\\n }\\r\\n }\\r\\n return (\\r\\n 'embedded-lib-' +\\r\\n sanitized +\\r\\n '-' +\\r\\n Date.now() +\\r\\n '-' +\\r\\n Math.random().toString(36).slice(2)\\r\\n )\\r\\n }\\r\\n\\r\\n function postHostRequest(assetKey, requestId) {\\r\\n if (!hasHostBridge()) {\\r\\n throw new Error('Host bridge is unavailable')\\r\\n }\\r\\n var bridge = window.ReactNativeWebView\\r\\n var message = {\\r\\n type: REQUEST_TYPE,\\r\\n direction: 'H5_TO_APP',\\r\\n data: {\\r\\n requestId: requestId,\\r\\n assetKey: assetKey,\\r\\n },\\r\\n instanceId:\\r\\n (window._venusInitState && window._venusInitState.poolId) || 'unknown',\\r\\n timestamp: Date.now(),\\r\\n }\\r\\n bridge.postMessage(JSON.stringify(message))\\r\\n }\\r\\n\\r\\n function loadLibraryViaHost(assetKey, libraryKey) {\\r\\n return new Promise(function (resolve, reject) {\\r\\n var requestId = createRequestId(libraryKey)\\r\\n var timeout = setTimeout(function () {\\r\\n pendingRequests.delete(requestId)\\r\\n reject(new Error('Timed out loading embedded library: ' + libraryKey))\\r\\n }, REQUEST_TIMEOUT_MS)\\r\\n\\r\\n pendingRequests.set(requestId, {\\r\\n resolve: resolve,\\r\\n reject: reject,\\r\\n timeout: timeout,\\r\\n })\\r\\n\\r\\n try {\\r\\n postHostRequest(assetKey, requestId)\\r\\n } catch (error) {\\r\\n pendingRequests.delete(requestId)\\r\\n clearTimeout(timeout)\\r\\n reject(error)\\r\\n }\\r\\n })\\r\\n }\\r\\n\\r\\n function buildCdnUrl(config, entry) {\\r\\n var base = config.cdnBase || ''\\r\\n if (!base.endsWith('/')) {\\r\\n base += '/'\\r\\n }\\r\\n var path = entry.cdnPath\\r\\n if (path.charAt(0) === '/') {\\r\\n path = path.substring(1)\\r\\n }\\r\\n return base + path\\r\\n }\\r\\n\\r\\n async function loadLibraryViaCdn(config, entry, libraryKey) {\\r\\n if (!config.cdnBase) {\\r\\n throw new Error('CDN base URL is not configured')\\r\\n }\\r\\n var url = buildCdnUrl(config, entry)\\r\\n var response = await fetch(url, { credentials: 'omit' })\\r\\n if (!response.ok) {\\r\\n throw new Error(\\r\\n 'Failed to fetch embedded library from CDN: ' + libraryKey,\\r\\n )\\r\\n }\\r\\n return await response.text()\\r\\n }\\r\\n\\r\\n function decodeBase64ToUtf8(base64) {\\r\\n if (typeof base64 !== 'string') {\\r\\n throw new Error('Invalid base64 payload')\\r\\n }\\r\\n\\r\\n if (typeof atob === 'function') {\\r\\n var binary = atob(base64)\\r\\n if (typeof TextDecoder !== 'undefined') {\\r\\n var len = binary.length\\r\\n var bytes = new Uint8Array(len)\\r\\n for (var i = 0; i < len; i++) {\\r\\n bytes[i] = binary.charCodeAt(i)\\r\\n }\\r\\n return new TextDecoder('utf-8').decode(bytes)\\r\\n }\\r\\n return decodeURIComponent(escape(binary))\\r\\n }\\r\\n\\r\\n var bufferCtor =\\r\\n (typeof globalThis !== 'undefined' && globalThis.Buffer) ||\\r\\n (typeof window !== 'undefined' && window.Buffer)\\r\\n if (bufferCtor) {\\r\\n return bufferCtor.from(base64, 'base64').toString('utf-8')\\r\\n }\\r\\n\\r\\n throw new Error('No base64 decoder available')\\r\\n }\\r\\n\\r\\n function evaluateLibrarySource(libraryKey, globalVar, source) {\\r\\n var registry = ensureExportsRegistry()\\r\\n if (!source) {\\r\\n throw new Error('Embedded library source was empty for ' + libraryKey)\\r\\n }\\r\\n\\r\\n var previousValue = window[globalVar]\\r\\n try {\\r\\n var executor = new Function(\\r\\n source + '\\\\n//# sourceURL=venus-library-' + libraryKey + '.js',\\r\\n )\\r\\n executor.call(window)\\r\\n } catch (error) {\\r\\n throw new Error(\\r\\n 'Failed to evaluate embedded library ' +\\r\\n libraryKey +\\r\\n ': ' +\\r\\n (error && error.message ? error.message : error),\\r\\n )\\r\\n }\\r\\n\\r\\n var exported = window[globalVar] || previousValue\\r\\n if (!exported) {\\r\\n throw new Error(\\r\\n 'Embedded library ' + libraryKey + ' did not register ' + globalVar,\\r\\n )\\r\\n }\\r\\n\\r\\n registry[libraryKey] = exported\\r\\n return exported\\r\\n }\\r\\n\\r\\n async function ensureLibraryLoaded(config, libraryKey) {\\r\\n var registry = ensureExportsRegistry()\\r\\n if (registry[libraryKey]) {\\r\\n return registry[libraryKey]\\r\\n }\\r\\n\\r\\n var entry = config.manifest && config.manifest[libraryKey]\\r\\n if (!entry) {\\r\\n throw new Error('No manifest entry for embedded library ' + libraryKey)\\r\\n }\\r\\n\\r\\n var source = null\\r\\n if (config.useHost !== false && hasHostBridge()) {\\r\\n try {\\r\\n var base64 = await loadLibraryViaHost(entry.assetKey, libraryKey)\\r\\n source = decodeBase64ToUtf8(base64)\\r\\n } catch (error) {\\r\\n // Log the RPC error loudly before fallback\\r\\n console.error(\\r\\n '[Venus Libraries] Failed to load ' +\\r\\n libraryKey +\\r\\n ' from host via RPC:',\\r\\n error,\\r\\n )\\r\\n console.warn(\\r\\n '[Venus Libraries] Falling back to CDN for ' +\\r\\n libraryKey +\\r\\n '. This may indicate an asset packaging issue.',\\r\\n )\\r\\n }\\r\\n }\\r\\n\\r\\n if (!source) {\\r\\n source = await loadLibraryViaCdn(config, entry, libraryKey)\\r\\n }\\r\\n\\r\\n return evaluateLibrarySource(libraryKey, entry.globalVar, source)\\r\\n }\\r\\n\\r\\n async function bootstrap() {\\r\\n try {\\r\\n registerResponseListeners()\\r\\n getBootstrapPromise()\\r\\n\\r\\n var config = ensureConfig()\\r\\n\\r\\n if (!config.enabled) {\\r\\n if (bootstrapResolve) bootstrapResolve()\\r\\n return\\r\\n }\\r\\n\\r\\n if (!Array.isArray(config.required) || config.required.length === 0) {\\r\\n if (bootstrapResolve) bootstrapResolve()\\r\\n return\\r\\n }\\r\\n\\r\\n // Group libraries by load stage for parallel loading within stages\\r\\n var librariesByStage = {}\\r\\n for (var i = 0; i < config.required.length; i++) {\\r\\n var libraryKey = config.required[i]\\r\\n var entry = config.manifest[libraryKey]\\r\\n var stage = entry.loadStage || 0\\r\\n if (!librariesByStage[stage]) librariesByStage[stage] = []\\r\\n librariesByStage[stage].push(libraryKey)\\r\\n }\\r\\n\\r\\n // Load stages sequentially, libraries within each stage in parallel\\r\\n var stages = Object.keys(librariesByStage).sort(function (a, b) {\\r\\n return parseInt(a, 10) - parseInt(b, 10)\\r\\n })\\r\\n\\r\\n for (var s = 0; s < stages.length; s++) {\\r\\n var stage = stages[s]\\r\\n var libs = librariesByStage[stage]\\r\\n\\r\\n // Load all libraries in this stage in parallel\\r\\n var stagePromises = libs.map(function (libraryKey) {\\r\\n return ensureLibraryLoaded(config, libraryKey).catch(\\r\\n function (error) {\\r\\n console.error(\\r\\n '[Venus Libraries] Failed to load library ' + libraryKey,\\r\\n error,\\r\\n )\\r\\n throw error\\r\\n },\\r\\n )\\r\\n })\\r\\n\\r\\n await Promise.all(stagePromises)\\r\\n }\\r\\n\\r\\n if (bootstrapResolve) bootstrapResolve()\\r\\n } catch (error) {\\r\\n console.error('[Venus Libraries] Bootstrap error', error)\\r\\n if (bootstrapReject) bootstrapReject(error)\\r\\n throw error\\r\\n }\\r\\n }\\r\\n\\r\\n // Create a promise that resolves when bootstrap completes\\r\\n var bootstrapPromise = null\\r\\n var bootstrapResolve = null\\r\\n var bootstrapReject = null\\r\\n\\r\\n function getBootstrapPromise() {\\r\\n if (!bootstrapPromise) {\\r\\n bootstrapPromise = new Promise(function (resolve, reject) {\\r\\n bootstrapResolve = resolve\\r\\n bootstrapReject = reject\\r\\n })\\r\\n }\\r\\n return bootstrapPromise\\r\\n }\\r\\n\\r\\n window.__venusLibraryShim = {\\r\\n bootstrap: bootstrap,\\r\\n ready: getBootstrapPromise,\\r\\n getExports: function (libraryKey) {\\r\\n var registry = ensureExportsRegistry()\\r\\n return registry[libraryKey]\\r\\n },\\r\\n __initialized: true,\\r\\n }\\r\\n})()\\r\\n\"","/**\r\n * Webview Library Shim Source\r\n *\r\n * This module exports the shim code that is injected into H5 game WebViews.\r\n * The actual shim code is in webviewLibraryShim.js and imported as a raw string.\r\n *\r\n * Using Vite's ?raw import allows us to:\r\n * - Keep the shim as actual JavaScript (not a string literal)\r\n * - Get proper IDE support (syntax highlighting, linting)\r\n * - Avoid escaping issues\r\n */\r\n\r\nimport shimSource from './webviewLibraryShim.js?raw'\r\n\r\nexport const WEBVIEW_LIBRARY_SHIM_SOURCE = shimSource\r\n\r\nexport function getWebviewLibraryShimSource(): string {\r\n return WEBVIEW_LIBRARY_SHIM_SOURCE\r\n}\r\n"]}
|
|
@@ -886,7 +886,8 @@ var HostCdnApi = class {
|
|
|
886
886
|
return index === pathParts.length - 1 ? encodeURIComponent(part) : part;
|
|
887
887
|
});
|
|
888
888
|
const encodedSubPath = encodedParts.join("/");
|
|
889
|
-
const
|
|
889
|
+
const cacheBust = Date.now();
|
|
890
|
+
const fullUrl = this.baseUrl + "/" + encodedSubPath + `?cacheBust=${cacheBust}`;
|
|
890
891
|
return fullUrl;
|
|
891
892
|
}
|
|
892
893
|
resolveAvatarAssetUrl(subPath) {
|
|
@@ -3422,7 +3423,7 @@ function initializeTime(venusApi, host) {
|
|
|
3422
3423
|
}
|
|
3423
3424
|
|
|
3424
3425
|
// src/version.ts
|
|
3425
|
-
var SDK_VERSION = "3.1.2-beta.
|
|
3426
|
+
var SDK_VERSION = "3.1.2-beta.2";
|
|
3426
3427
|
|
|
3427
3428
|
// src/shared-assets/embeddedLibrariesManifest.ts
|
|
3428
3429
|
var DEFAULT_SHARED_LIB_CDN_BASE = "https://venus-static-01293ak.web.app/libs";
|
|
@@ -3593,6 +3594,10 @@ function base64ToUtf8(base64) {
|
|
|
3593
3594
|
return decodeURIComponent(escape(result));
|
|
3594
3595
|
}
|
|
3595
3596
|
|
|
3597
|
+
// src/shared-assets/consts.ts
|
|
3598
|
+
var BurgerTimeAssetsCdnPath = "burger-time/Core.stow";
|
|
3599
|
+
var CharacterAssetsCdnPath = "burger-time/Character.stow";
|
|
3600
|
+
|
|
3596
3601
|
// src/shared-assets/RpcSharedAssetsApi.ts
|
|
3597
3602
|
var RpcSharedAssetsApi = class {
|
|
3598
3603
|
constructor(rpcClient, venusApi) {
|
|
@@ -3601,18 +3606,33 @@ var RpcSharedAssetsApi = class {
|
|
|
3601
3606
|
this.rpcClient = rpcClient;
|
|
3602
3607
|
this.venusApi = venusApi;
|
|
3603
3608
|
}
|
|
3604
|
-
async
|
|
3609
|
+
async loadBurgerTimeAssetsBundle() {
|
|
3605
3610
|
try {
|
|
3606
3611
|
const response = await this.rpcClient.callT("H5_LOAD_EMBEDDED_ASSET" /* H5_LOAD_EMBEDDED_ASSET */, {
|
|
3607
|
-
assetKey:
|
|
3612
|
+
assetKey: "burgerTimeCoreBundle"
|
|
3608
3613
|
});
|
|
3609
3614
|
return base64ToArrayBuffer(response.base64Data);
|
|
3610
3615
|
} catch (err) {
|
|
3611
3616
|
try {
|
|
3612
|
-
const blob = await this.venusApi.cdn.fetchBlob(
|
|
3617
|
+
const blob = await this.venusApi.cdn.fetchBlob(BurgerTimeAssetsCdnPath);
|
|
3613
3618
|
return await blob.arrayBuffer();
|
|
3614
3619
|
} catch (e) {
|
|
3615
|
-
throw new Error(
|
|
3620
|
+
throw new Error("Failed to load burgerTimeAssetsBundle");
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
async loadCharactersBundle() {
|
|
3625
|
+
try {
|
|
3626
|
+
const response = await this.rpcClient.callT("H5_LOAD_EMBEDDED_ASSET" /* H5_LOAD_EMBEDDED_ASSET */, {
|
|
3627
|
+
assetKey: "characters"
|
|
3628
|
+
});
|
|
3629
|
+
return base64ToArrayBuffer(response.base64Data);
|
|
3630
|
+
} catch (err) {
|
|
3631
|
+
try {
|
|
3632
|
+
const blob = await this.venusApi.cdn.fetchBlob(CharacterAssetsCdnPath);
|
|
3633
|
+
return await blob.arrayBuffer();
|
|
3634
|
+
} catch (e) {
|
|
3635
|
+
throw new Error("Failed to load charactersBundle");
|
|
3616
3636
|
}
|
|
3617
3637
|
}
|
|
3618
3638
|
}
|
|
@@ -3650,8 +3670,12 @@ var MockSharedAssetsApi = class {
|
|
|
3650
3670
|
__publicField(this, "venusApi");
|
|
3651
3671
|
this.venusApi = venusApi;
|
|
3652
3672
|
}
|
|
3653
|
-
async
|
|
3654
|
-
const blob = await this.venusApi.cdn.fetchBlob(
|
|
3673
|
+
async loadBurgerTimeAssetsBundle() {
|
|
3674
|
+
const blob = await this.venusApi.cdn.fetchBlob(BurgerTimeAssetsCdnPath);
|
|
3675
|
+
return await blob.arrayBuffer();
|
|
3676
|
+
}
|
|
3677
|
+
async loadCharactersBundle() {
|
|
3678
|
+
const blob = await this.venusApi.cdn.fetchBlob(CharacterAssetsCdnPath);
|
|
3655
3679
|
return await blob.arrayBuffer();
|
|
3656
3680
|
}
|
|
3657
3681
|
async loadLibraryCode(libraryKey) {
|
|
@@ -5145,5 +5169,5 @@ function initializeSocial(venusApi, host) {
|
|
|
5145
5169
|
}
|
|
5146
5170
|
|
|
5147
5171
|
export { DEFAULT_SHARED_LIB_CDN_BASE, EMBEDDED_LIBRARIES, EMBEDDED_LIBRARY_BY_KEY, HASH_ALGORITHM_NODE, HASH_ALGORITHM_WEB_CRYPTO, HapticFeedbackStyle, HostCdnApi, HostDeviceApi, HostEnvironmentApi, HostProfileApi, HostSystemApi, HostTimeApi, MODULE_TO_LIBRARY_SPECIFIERS, MockAdsApi, MockAiApi, MockAnalyticsApi, MockAvatarApi, MockCdnApi, MockDeviceApi, MockEnvironmentApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLeaderboardApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockSocialApi, MockStorageApi, MockSystemApi, MockTimeApi, RemoteHost, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLeaderboardApi, RpcLifecycleApi, RpcLoggingApi, RpcNavigationApi, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRoomsApi, RpcSharedAssetsApi, RpcSimulationApi, RpcSocialApi, RpcStorageApi, SDK_VERSION, VenusMessageId, VenusRoom, base64ToArrayBuffer, base64ToUtf8, computeScoreHash, createHost, createMockStorageApi, getLibraryDefinition, initializeAds, initializeAi, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLeaderboard, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeSimulation, initializeSocial, initializeStackNavigation, initializeStorage, initializeSystem, initializeTime, isPacificDaylightTime, setupRoomNotifications };
|
|
5148
|
-
//# sourceMappingURL=chunk-
|
|
5149
|
-
//# sourceMappingURL=chunk-
|
|
5172
|
+
//# sourceMappingURL=chunk-G5AFYBIK.mjs.map
|
|
5173
|
+
//# sourceMappingURL=chunk-G5AFYBIK.mjs.map
|