@dimina-kit/devtools 0.4.0-dev.20260729062524 → 0.4.0-dev.20260801163345

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/main/app/app.js +7 -0
  2. package/dist/main/app/bootstrap.d.ts +8 -5
  3. package/dist/main/app/bootstrap.js +15 -15
  4. package/dist/main/index.bundle.js +2207 -5152
  5. package/dist/main/ipc/app-lifecycle.d.ts +1 -31
  6. package/dist/main/ipc/app-lifecycle.js +1 -53
  7. package/dist/main/ipc/bridge-router.d.ts +19 -152
  8. package/dist/main/ipc/bridge-router.js +28 -2186
  9. package/dist/main/ipc/page-scroll.d.ts +1 -13
  10. package/dist/main/ipc/page-scroll.js +1 -16
  11. package/dist/main/ipc/session-listener-bag.d.ts +1 -40
  12. package/dist/main/ipc/session-listener-bag.js +1 -39
  13. package/dist/main/services/console-forward/index.d.ts +1 -60
  14. package/dist/main/services/console-forward/index.js +1 -225
  15. package/dist/main/services/console-forward/internal-log.d.ts +1 -10
  16. package/dist/main/services/console-forward/internal-log.js +1 -22
  17. package/dist/main/services/diagnostics/index.d.ts +1 -58
  18. package/dist/main/services/diagnostics/index.js +1 -60
  19. package/dist/main/services/dimina-resource-server.d.ts +1 -6
  20. package/dist/main/services/dimina-resource-server.js +1 -98
  21. package/dist/main/services/mcp/target-manager.js +5 -1
  22. package/dist/main/services/network-forward/index.d.ts +15 -3
  23. package/dist/main/services/network-forward/index.js +30 -4
  24. package/dist/main/services/network-forward/websocket.d.ts +36 -0
  25. package/dist/main/services/network-forward/websocket.js +120 -0
  26. package/dist/main/services/service-host-pool/pool.d.ts +1 -196
  27. package/dist/main/services/service-host-pool/pool.js +1 -363
  28. package/dist/main/services/simulator/custom-apis.d.ts +1 -42
  29. package/dist/main/services/simulator/custom-apis.js +1 -46
  30. package/dist/main/services/simulator/referer.d.ts +1 -9
  31. package/dist/main/services/simulator/referer.js +1 -19
  32. package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
  33. package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
  34. package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
  35. package/dist/main/services/simulator-temp-files/disk.js +1 -237
  36. package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
  37. package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
  38. package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
  39. package/dist/main/services/simulator-temp-files/index.js +1 -181
  40. package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
  41. package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
  42. package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
  43. package/dist/main/services/simulator-temp-files/resolver.js +1 -21
  44. package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
  45. package/dist/main/services/simulator-temp-files/store.js +1 -23
  46. package/dist/main/services/views/miniapp-partition.d.ts +1 -89
  47. package/dist/main/services/views/miniapp-partition.js +1 -158
  48. package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
  49. package/dist/main/services/views/simulator-session-policy.js +1 -98
  50. package/dist/main/services/workbench-context.d.ts +4 -1
  51. package/dist/main/services/workbench-context.js +17 -0
  52. package/dist/main/utils/ipc-registry.d.ts +21 -3
  53. package/dist/main/utils/ipc-registry.js +26 -23
  54. package/dist/main/utils/paths.d.ts +14 -0
  55. package/dist/main/utils/paths.js +14 -0
  56. package/dist/main/windows/service-host-window/create.d.ts +1 -92
  57. package/dist/main/windows/service-host-window/create.js +1 -154
  58. package/dist/native-host/common/common.js +154 -58
  59. package/dist/native-host/container/pageFrame.css +1 -1
  60. package/dist/native-host/render/render.js +6611 -3312
  61. package/dist/native-host/service/service.js +2 -2
  62. package/dist/preload/index.d.ts +2 -0
  63. package/dist/preload/index.js +1 -0
  64. package/dist/preload/runtime/clipboard.d.ts +6 -0
  65. package/dist/preload/runtime/clipboard.js +12 -0
  66. package/dist/preload/runtime/native-host.d.ts +2 -0
  67. package/dist/preload/runtime/native-host.js +5 -10
  68. package/dist/preload/runtime/node-bindings.d.ts +18 -0
  69. package/dist/preload/runtime/node-bindings.js +44 -0
  70. package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
  71. package/dist/preload/windows/main.cjs +1195 -897
  72. package/dist/preload/windows/main.cjs.map +4 -4
  73. package/dist/preload/windows/simulator.cjs +149 -60
  74. package/dist/preload/windows/simulator.cjs.map +4 -4
  75. package/dist/preload/windows/simulator.js +149 -60
  76. package/dist/render-host/pageFrame.html +3 -3
  77. package/dist/shared/bridge-channels.d.ts +1 -419
  78. package/dist/shared/bridge-channels.js +1 -89
  79. package/dist/shared/dmb-resource-url.d.ts +2 -0
  80. package/dist/shared/dmb-resource-url.js +2 -0
  81. package/dist/shared/ipc-channels.d.ts +2 -32
  82. package/dist/shared/ipc-channels.js +2 -5
  83. package/dist/shared/node-bindings.d.ts +2 -0
  84. package/dist/shared/node-bindings.js +2 -0
  85. package/dist/shared/request-core.d.ts +1 -83
  86. package/dist/shared/request-core.js +1 -167
  87. package/dist/simulator/assets/device-shell-Cw7c-IkG.js +2 -0
  88. package/dist/simulator/assets/{device-shell-BHz1v3Yo.css → device-shell-DbC5ccs8.css} +1 -1
  89. package/dist/simulator/assets/{jsx-runtime-hBv-rHqQ.js → jsx-runtime-DkKmJyBb.js} +2 -2
  90. package/dist/simulator/assets/simulator-COIE6R49.js +10 -0
  91. package/dist/simulator/assets/simulator-mini-app-BLn7XV8e.js +2 -0
  92. package/dist/simulator/simulator.html +2 -2
  93. package/dist/simulator/temp-files.d.ts +29 -0
  94. package/dist/simulator/temp-files.js +79 -0
  95. package/dist/simulator/types.d.ts +43 -0
  96. package/dist/simulator/types.js +2 -0
  97. package/package.json +6 -5
  98. package/dist/shared/simulator-api-metadata.d.ts +0 -26
  99. package/dist/shared/simulator-api-metadata.js +0 -59
  100. package/dist/shared/vpath.d.ts +0 -42
  101. package/dist/shared/vpath.js +0 -105
  102. package/dist/simulator/assets/device-shell-CH_DMYaz.js +0 -2
  103. package/dist/simulator/assets/simulator-DXraYerh.js +0 -10
  104. package/dist/simulator/assets/simulator-mini-app-w1Bhwkld.js +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimina-kit/devtools",
3
- "version": "0.4.0-dev.20260729062524",
3
+ "version": "0.4.0-dev.20260801163345",
4
4
  "description": "Dimina DevTools - modular developer tools for mini app debugging",
5
5
  "keywords": [
6
6
  "dimina",
@@ -89,10 +89,11 @@
89
89
  "chrome-remote-interface": "^0.34.0",
90
90
  "ws": "^8.20.0",
91
91
  "zod": "^4.3.6",
92
- "@dimina-kit/devkit": "0.1.2-dev.20260729062524",
93
- "@dimina-kit/view-anchor": "0.1.0-dev.20260729062524",
94
- "@dimina-kit/electron-deck": "0.1.0-dev.20260729062524",
95
- "@dimina-kit/inspect": "0.4.0-dev.20260729062524"
92
+ "@dimina-kit/electron-runtime": "0.1.0-dev.20260801163345",
93
+ "@dimina-kit/electron-deck": "0.1.0-dev.20260801163345",
94
+ "@dimina-kit/devkit": "0.1.2-dev.20260801163345",
95
+ "@dimina-kit/inspect": "0.4.0-dev.20260801163345",
96
+ "@dimina-kit/view-anchor": "0.1.0-dev.20260801163345"
96
97
  },
97
98
  "devDependencies": {
98
99
  "@playwright/test": "^1.59.1",
@@ -1,26 +0,0 @@
1
- export declare const PERSISTENT_SIMULATOR_APIS: ReadonlySet<string>;
2
- export declare function isPersistentSimulatorApi(name: string): boolean;
3
- /**
4
- * APIs whose one-shot call legitimately runs as long as the caller's wx
5
- * network timeout budget (`params.timeout`, default 60000ms) — the simulator
6
- * handler answers when the network answers, not within a fixed router window.
7
- */
8
- export declare const NETWORK_BUDGET_SIMULATOR_APIS: ReadonlySet<string>;
9
- /**
10
- * Flat watchdog window for forwarded one-shot calls whose handler is expected
11
- * to answer promptly; it guards against a missing handler / dead seam.
12
- */
13
- export declare const API_CALL_WATCHDOG_MS = 5000;
14
- /**
15
- * How long bridge-router's one-shot "no handler" watchdog waits before
16
- * tearing a forwarded simulator-API call down.
17
- *
18
- * Network-budget APIs get their wx timeout budget plus the flat window as
19
- * forwarding grace: the handler owns the real deadline (performRequest emits
20
- * `request:fail timeout` at the budget), so the watchdog only has to catch
21
- * the case where no verdict ever comes back. A flat 5s window here would
22
- * kill any HTTP call slower than 5s and drop its late — perfectly valid —
23
- * response. Every other API keeps the flat window.
24
- */
25
- export declare function apiCallWatchdogMs(name: string, params: Record<string, unknown> | undefined): number;
26
- //# sourceMappingURL=simulator-api-metadata.d.ts.map
@@ -1,59 +0,0 @@
1
- /**
2
- * Persistent (subscription) simulator APIs — a call that, once made, keeps
3
- * delivering a response on every underlying event instead of settling once.
4
- *
5
- * The dimina service runtime strips `keep` / `evtId` / `success` before the
6
- * call leaves the service host (it stores them service-local in
7
- * `callback.store`), so by the time `audioListen` reaches the container its
8
- * `keep: true` intent is gone and it would degrade to a one-shot call —
9
- * dropping every audio DOM event after the first. The container and router
10
- * therefore recognise these APIs by NAME and treat them as persistent
11
- * regardless of the (stripped) params.
12
- *
13
- * Currently only `audioListen` — the InnerAudioContext DOM-event bridge
14
- * (canplay / play / pause / ended / error / timeupdate / waiting / seeking /
15
- * seeked). Add any new subscription API here: this is the single source of
16
- * truth, consumed by `bridge-router` (skip the one-shot timeout, keep-alive
17
- * responses) and `run-api-async` (no premature settle, re-fire on every event).
18
- */
19
- import { MAX_TIMEOUT_MS, resolveTimeoutBudgetMs } from './request-core.js';
20
- export const PERSISTENT_SIMULATOR_APIS = new Set(['audioListen']);
21
- export function isPersistentSimulatorApi(name) {
22
- return PERSISTENT_SIMULATOR_APIS.has(name);
23
- }
24
- /**
25
- * APIs whose one-shot call legitimately runs as long as the caller's wx
26
- * network timeout budget (`params.timeout`, default 60000ms) — the simulator
27
- * handler answers when the network answers, not within a fixed router window.
28
- */
29
- export const NETWORK_BUDGET_SIMULATOR_APIS = new Set([
30
- 'request',
31
- 'downloadFile',
32
- 'uploadFile',
33
- ]);
34
- /**
35
- * Flat watchdog window for forwarded one-shot calls whose handler is expected
36
- * to answer promptly; it guards against a missing handler / dead seam.
37
- */
38
- export const API_CALL_WATCHDOG_MS = 5_000;
39
- /**
40
- * How long bridge-router's one-shot "no handler" watchdog waits before
41
- * tearing a forwarded simulator-API call down.
42
- *
43
- * Network-budget APIs get their wx timeout budget plus the flat window as
44
- * forwarding grace: the handler owns the real deadline (performRequest emits
45
- * `request:fail timeout` at the budget), so the watchdog only has to catch
46
- * the case where no verdict ever comes back. A flat 5s window here would
47
- * kill any HTTP call slower than 5s and drop its late — perfectly valid —
48
- * response. Every other API keeps the flat window.
49
- */
50
- export function apiCallWatchdogMs(name, params) {
51
- if (!NETWORK_BUDGET_SIMULATOR_APIS.has(name))
52
- return API_CALL_WATCHDOG_MS;
53
- // resolveTimeoutBudgetMs rejects non-finite/oversized caller timeouts, and
54
- // the final clamp keeps budget+grace inside setTimeout's range — an
55
- // overflowing delay would wrap to ~1ms and fire the watchdog immediately.
56
- const budget = resolveTimeoutBudgetMs(params?.timeout);
57
- return Math.min(budget + API_CALL_WATCHDOG_MS, MAX_TIMEOUT_MS);
58
- }
59
- //# sourceMappingURL=simulator-api-metadata.js.map
@@ -1,42 +0,0 @@
1
- /**
2
- * vpath resolver.
3
- *
4
- * Spec: `docs/file-system.md` — single resolver shared by every FSM
5
- * entry, the renderer-side temp store, and the main-process
6
- * protocol.handle / disk reader.
7
- *
8
- * resolveVPath(url): { kind, writable, realPath? } | null
9
- *
10
- * - `difile://_tmp/<id>` → kind=tmp, writable=false, no realPath
11
- * - `difile://_store/<id>` → kind=store, writable=false, realPath in base
12
- * - `difile://<rel>` → kind=usr, writable=true, realPath in base
13
- *
14
- * Security invariants (the resolver returns `null` instead of throwing):
15
- * - any non-`difile://` scheme is rejected outright;
16
- * - any `..` segment (raw or URL-encoded) is rejected before canonicalize;
17
- * - after `path.normalize` the resulting `realPath` MUST stay inside the
18
- * sandbox base; otherwise `null`;
19
- * - reserved prefixes `_tmp/` and `_store/` are case-sensitive — `_TMP/`,
20
- * `_Tmp/`, etc. fall through to the user-data namespace.
21
- */
22
- export type VPathKind = 'tmp' | 'store' | 'usr';
23
- export interface ResolvedVPath {
24
- kind: VPathKind;
25
- /** `tmp` and `store` are runtime-owned and read-only; `usr` is writable. */
26
- writable: boolean;
27
- /**
28
- * Canonical local path on disk for `store` / `usr` kinds (always within the
29
- * USER_DATA_PATH base directory after canonicalize). `tmp` kind has no
30
- * realPath — the bytes live in the renderer-side Blob Map.
31
- */
32
- realPath?: string;
33
- }
34
- /**
35
- * USER_DATA_PATH sandbox base. Looked up dynamically on every call so test
36
- * doubles (e.g. monkey-patching `os.homedir`) and the `DIMINA_HOME` env
37
- * override apply per invocation. The env override exists for headless test
38
- * affordance and to keep the renderer/main store sharing one base.
39
- */
40
- export declare function sandboxBase(): string;
41
- export declare function resolveVPath(url: unknown): ResolvedVPath | null;
42
- //# sourceMappingURL=vpath.d.ts.map
@@ -1,105 +0,0 @@
1
- /**
2
- * vpath resolver.
3
- *
4
- * Spec: `docs/file-system.md` — single resolver shared by every FSM
5
- * entry, the renderer-side temp store, and the main-process
6
- * protocol.handle / disk reader.
7
- *
8
- * resolveVPath(url): { kind, writable, realPath? } | null
9
- *
10
- * - `difile://_tmp/<id>` → kind=tmp, writable=false, no realPath
11
- * - `difile://_store/<id>` → kind=store, writable=false, realPath in base
12
- * - `difile://<rel>` → kind=usr, writable=true, realPath in base
13
- *
14
- * Security invariants (the resolver returns `null` instead of throwing):
15
- * - any non-`difile://` scheme is rejected outright;
16
- * - any `..` segment (raw or URL-encoded) is rejected before canonicalize;
17
- * - after `path.normalize` the resulting `realPath` MUST stay inside the
18
- * sandbox base; otherwise `null`;
19
- * - reserved prefixes `_tmp/` and `_store/` are case-sensitive — `_TMP/`,
20
- * `_Tmp/`, etc. fall through to the user-data namespace.
21
- */
22
- // Main-process (Node ESM) resolves these natively. Simulator (vite browser
23
- // bundle) externalizes node builtins as no-op stubs — that's safe here only
24
- // because the simulator never enters the `store`/`usr` branches below
25
- // (renderer-side FSM forwards disk-backed reads/writes to main via IPC).
26
- import os from 'node:os';
27
- import path from 'node:path';
28
- const DIFILE_PREFIX = 'difile://';
29
- /**
30
- * USER_DATA_PATH sandbox base. Looked up dynamically on every call so test
31
- * doubles (e.g. monkey-patching `os.homedir`) and the `DIMINA_HOME` env
32
- * override apply per invocation. The env override exists for headless test
33
- * affordance and to keep the renderer/main store sharing one base.
34
- */
35
- export function sandboxBase() {
36
- const env = (typeof process !== 'undefined' && process.env && process.env.DIMINA_HOME) || '';
37
- if (env) {
38
- return path.join(env, 'files');
39
- }
40
- return path.join(os.homedir(), '.dimina', 'files');
41
- }
42
- export function resolveVPath(url) {
43
- if (typeof url !== 'string')
44
- return null;
45
- if (!url.startsWith(DIFILE_PREFIX))
46
- return null;
47
- const raw = url.slice(DIFILE_PREFIX.length);
48
- if (raw.length === 0)
49
- return null;
50
- // Decode URL-encoded sequences first so `%2e%2e` style escapes are caught
51
- // by the segment check below.
52
- let decoded;
53
- try {
54
- decoded = decodeURIComponent(raw);
55
- }
56
- catch {
57
- return null;
58
- }
59
- // Reject NUL bytes (raw or %00) — Node `fs.*` throws TypeError on a NUL
60
- // in the path, bypassing the API's `fail` callback and crashing the
61
- // renderer. Pull the rejection up to the validator.
62
- if (decoded.includes('\0'))
63
- return null;
64
- // Developer convention: `wx.env.USER_DATA_PATH = 'difile://'` so a write
65
- // like `${USER_DATA_PATH}/foo.txt` produces `difile:///foo.txt`. Strip
66
- // leading slashes so that path-joins cleanly under the sandbox base.
67
- decoded = decoded.replace(/^[/\\]+/, '');
68
- if (decoded.length === 0)
69
- return null;
70
- // Reject any '..' or '.' segment after decoding. We split on both '/' and
71
- // '\\' so Windows-style separators cannot smuggle a traversal segment past
72
- // the validator on POSIX hosts.
73
- const segments = decoded.split(/[/\\]+/);
74
- if (segments.some(s => s === '..' || s === '.'))
75
- return null;
76
- // Classify by reserved prefix (case-sensitive — `_TMP/` is a user file).
77
- let kind;
78
- let writable;
79
- if (decoded.startsWith('_tmp/')) {
80
- kind = 'tmp';
81
- writable = false;
82
- }
83
- else if (decoded.startsWith('_store/')) {
84
- kind = 'store';
85
- writable = false;
86
- }
87
- else {
88
- kind = 'usr';
89
- writable = true;
90
- }
91
- // `tmp` lives in the renderer Blob Map — no realPath.
92
- if (kind === 'tmp') {
93
- return { kind, writable };
94
- }
95
- // `store` / `usr`: anchor under the sandbox base and assert containment
96
- // after normalization. Defense in depth against any traversal that the
97
- // segment check above missed (e.g. backslash trickery on POSIX).
98
- const base = sandboxBase();
99
- const joined = path.join(base, decoded);
100
- const normalized = path.normalize(joined);
101
- if (normalized !== base && !normalized.startsWith(base + path.sep))
102
- return null;
103
- return { kind, writable, realPath: normalized };
104
- }
105
- //# sourceMappingURL=vpath.js.map
@@ -1,2 +0,0 @@
1
- import{a as e,i as t,n,o as r,t as i}from"./jsx-runtime-hBv-rHqQ.js";import{t as a}from"./bridge-channels-zhsumfky.js";var o=r(),s=new Set([`audioListen`]);function c(e){return s.has(e)}function l(e,t,n,r){let i=e.apiRegistry[t];if(!i)return r({ok:!1,errMsg:`${t}:fail no handler`}),Promise.resolve();let a=c(t)||(n&&typeof n==`object`&&!Array.isArray(n)?n.keep===!0:!1);return new Promise(o=>{let s=!1,c=e=>{if(s){a&&e.ok&&r({...e,keep:!0});return}s=!0,r(a&&e.ok?{...e,keep:!0}:e),o()},l=Symbol(`sim-cb-success`),u=Symbol(`sim-cb-fail`),d=Symbol(`sim-cb-complete`),f=!1,p=Object.create(e);p.createCallbackFunction=e=>{if(e!=null)return(e===l||e===u)&&(f=!0),(...n)=>{let r=n[0];e===l?c({ok:!0,result:r}):e===u?c({ok:!1,errMsg:r&&typeof r==`object`&&`errMsg`in r?String(r.errMsg):`${t}:fail`,result:r}):e===d&&!a&&c({ok:!0,result:r})}};let m=n&&typeof n==`object`&&!Array.isArray(n)?{...n}:{};m.success=l,m.fail=u,m.complete=d;try{let e=i.call(p,m);if(e&&typeof e.then==`function`){Promise.resolve(e).then(e=>c({ok:!0,result:e}),e=>{c({ok:!1,errMsg:`${t}:fail ${e instanceof Error?e.message:String(e)}`})});return}if(s)return;if(a){o();return}if(f){o();return}c({ok:!0,result:e})}catch(e){c({ok:!1,errMsg:`${t}:fail ${e instanceof Error?e.message:String(e)}`})}})}var u={ios:44,android:64};function d(e){return(u[e]-32)/2}var f=i();function p({platform:e,statusBarHeight:t,onMore:n}){return(0,f.jsxs)(`div`,{className:`menu-capsule`,style:{width:87,height:32,top:t+d(e),right:10},children:[(0,f.jsxs)(`button`,{type:`button`,className:`menu-capsule__more`,"aria-label":`More`,onClick:n,children:[(0,f.jsx)(`span`,{className:`menu-capsule__dot menu-capsule__dot--side`}),(0,f.jsx)(`span`,{className:`menu-capsule__dot menu-capsule__dot--mid`}),(0,f.jsx)(`span`,{className:`menu-capsule__dot menu-capsule__dot--side`})]}),(0,f.jsx)(`div`,{className:`menu-capsule__divider`}),(0,f.jsx)(`div`,{className:`menu-capsule__close`,children:(0,f.jsxs)(`svg`,{viewBox:`0 0 22 22`,width:`22`,height:`22`,"aria-hidden":`true`,children:[(0,f.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7.8`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`}),(0,f.jsx)(`circle`,{cx:`11`,cy:`11`,r:`3.1`,fill:`currentColor`})]})})]})}var m={linear:`linear`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`},h={ios:`M17.51 3.87L15.73 2.1 5.84 12l9.9 9.9 1.77-1.77L9.38 12l8.13-8.13z`,android:`M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z`};function g({state:e,stackDepth:t,platform:n,statusBarHeight:r,navBarHeight:i,onBack:a,onHome:s,onMore:c}){let l=(0,o.useMemo)(()=>{if(!e.colorAnimation||e.colorAnimation.durationMs<=0)return;let t=m[e.colorAnimation.timingFunc]??`linear`;return`background-color ${e.colorAnimation.durationMs}ms ${t}, color ${e.colorAnimation.durationMs}ms ${t}`},[e.colorAnimation]),u=e.style===`custom`,d=t>1,g=!d&&e.homeButtonVisible,_=n===`ios`?`center`:`left`,v=n===`android`?30:24,y={backgroundColor:e.backgroundColor,color:e.textStyle===`white`?`#ffffff`:`#000000`,height:r+i,paddingTop:r,transition:l};return(0,f.jsxs)(`header`,{className:`nav-bar nav-bar--${n} nav-bar--${e.textStyle}${u?` nav-bar--custom`:``}`,style:y,"aria-hidden":u,children:[!u&&(0,f.jsxs)(`div`,{className:`nav-bar__row`,style:{height:i,justifyContent:_===`center`?`center`:`flex-start`},children:[(d||g)&&(0,f.jsxs)(`div`,{className:`nav-bar__leading`,children:[d&&(0,f.jsx)(`button`,{type:`button`,className:`nav-bar__back`,"aria-label":`Back`,onClick:a,children:(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:v,height:v,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:h[n],fill:`currentColor`})})}),g&&(0,f.jsx)(`button`,{type:`button`,className:`nav-bar__home`,"aria-label":`Home`,onClick:s,children:(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`22`,height:`22`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M3 12l9-9 9 9M5 10v10h14V10`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`})})})]}),(0,f.jsxs)(`div`,{className:`nav-bar__title nav-bar__title--${_}`,style:{color:e.textStyle===`white`?`#ffffff`:`#000000`},children:[e.loading&&(0,f.jsx)(`span`,{className:`nav-bar__spinner`,"aria-hidden":`true`}),(0,f.jsx)(`span`,{className:`nav-bar__title-text`,children:e.title})]})]}),(0,f.jsx)(p,{platform:n,statusBarHeight:r,onMore:c})]})}function _(e){return{title:e?.title??``,backgroundColor:e?.backgroundColor??`#000000`,textStyle:e?.textStyle??`white`,style:e?.style??`default`,loading:e?.loading??!1,homeButtonVisible:e?.homeButtonVisible??!1,colorAnimation:e?.colorAnimation}}function v(e){switch(e){case`notch`:return{width:164,height:30,top:0,bottomOnly:!0};case`dynamic-island`:return{width:124,height:36,top:11,bottomOnly:!1};default:return null}}function y({height:e,notchType:t,textStyle:n}){let r=v(t);return(0,f.jsxs)(`div`,{className:`device-statusbar`,style:{height:e,color:n===`black`?`#000000`:`#ffffff`},"aria-hidden":`true`,children:[(0,f.jsx)(`span`,{className:`device-statusbar__time`,children:`9:41`}),r&&(0,f.jsx)(`div`,{className:`device-statusbar__notch`,style:{width:r.width,height:r.height,top:r.top,borderRadius:r.bottomOnly?`0 0 ${Math.round(r.height*.6)}px ${Math.round(r.height*.6)}px`:`${r.height/2}px`}}),(0,f.jsxs)(`div`,{className:`device-statusbar__icons`,children:[(0,f.jsx)(`span`,{className:`device-statusbar__signal`}),(0,f.jsx)(`span`,{className:`device-statusbar__wifi`}),(0,f.jsx)(`span`,{className:`device-statusbar__battery`})]})]})}function b({state:e,currentPath:t,resourceBaseUrl:n,appId:r,onSwitch:i,bottomInset:a=0}){if(!e.config||!e.visible)return null;let{color:o,selectedColor:s,backgroundColor:c,borderStyle:l,list:u}=e.config,d=o||`#999999`,p=s||`#1890ff`;return(0,f.jsx)(`div`,{className:`dmb-tab-bar`,style:{backgroundColor:c||`#ffffff`,borderTopColor:l===`white`?`#ffffff`:`#e0e0e0`,paddingBottom:a},role:`tablist`,"aria-label":`TabBar`,children:u.map((a,o)=>{let s=x(a.pagePath),c=s===t,l=S(c?a.selectedIconPath??a.iconPath:a.iconPath,n,r),u=e.badges[o]??``,m=e.redDots[o]??!1;return(0,f.jsxs)(`button`,{type:`button`,className:`dmb-tab-bar__item${c?` is-selected`:``}`,role:`tab`,"aria-selected":c,onClick:()=>i(s),children:[l&&(0,f.jsx)(`span`,{className:`dmb-tab-bar__icon-slot`,children:(0,f.jsx)(`img`,{className:`dmb-tab-bar__icon`,src:l,alt:``,onError:e=>{e.currentTarget.style.display=`none`}})}),(0,f.jsx)(`span`,{className:`dmb-tab-bar__text`,style:{color:c?p:d},children:a.text||``}),u&&(0,f.jsx)(`span`,{className:`dmb-tab-bar__badge`,children:u}),!u&&m&&(0,f.jsx)(`span`,{className:`dmb-tab-bar__red-dot`})]},`${s}-${o}`)})})}function x(e){return e?e.replace(/^\/+/,``):``}function S(e,t,n){if(!e)return null;let r=e.trim();if(!r)return null;if(/^(?:data:|blob:|https?:|\/\/)/i.test(r))return r;if(!t)return null;let i=r.replace(/^\/+/,``).replace(/^\.\//,``);return i.startsWith(`${n}/`)?C(t,i):C(t,`${n}/main/${i}`)}function C(e,t){return`${e.endsWith(`/`)?e:`${e}/`}${t.replace(/^\/+/,``)}`}function w(){let[{toast:e,dialog:t},r]=(0,o.useState)(()=>n.getState());return(0,o.useEffect)(()=>n.subscribe(r),[]),(0,f.jsxs)(f.Fragment,{children:[e&&(0,f.jsx)(T,{toast:e}),t?.kind===`modal`&&(0,f.jsx)(D,{dialog:t}),t?.kind===`actionSheet`&&(0,f.jsx)(O,{dialog:t})]})}function T({toast:e}){(0,o.useEffect)(()=>{if(!Number.isFinite(e.duration))return;let t=window.setTimeout(()=>n.dismissToast(e),e.duration);return()=>window.clearTimeout(t)},[e]);let t=e.icon!==`none`||!!e.image;return(0,f.jsxs)(`div`,{className:`dmui-overlay`,"aria-live":`polite`,children:[e.mask&&(0,f.jsx)(`div`,{className:`dmui-mask dmui-mask--transparent`}),(0,f.jsxs)(`div`,{className:`dmui-toast${t?``:` dmui-toast--text`}`,role:`alert`,children:[e.image?(0,f.jsx)(`img`,{className:`dmui-toast__image`,src:e.image,alt:``}):(0,f.jsx)(E,{icon:e.icon}),e.title&&(0,f.jsx)(`div`,{className:`dmui-toast__title`,children:e.title})]})]})}function E({icon:e}){return e===`success`?(0,f.jsx)(`svg`,{className:`dmui-toast__icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M5 13l4 4L19 7`})}):e===`error`?(0,f.jsx)(`svg`,{className:`dmui-toast__icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})}):e===`loading`?(0,f.jsx)(`span`,{className:`dmui-toast__spinner`,"aria-hidden":`true`}):null}function D({dialog:e}){let[t,n]=(0,o.useState)(``),r=(0,o.useRef)(null);return(0,o.useEffect)(()=>{e.editable&&r.current?.focus()},[e.editable]),(0,f.jsxs)(`div`,{className:`dmui-overlay`,children:[(0,f.jsx)(`div`,{className:`dmui-mask`}),(0,f.jsxs)(`div`,{className:`dmui-modal`,role:`dialog`,"aria-modal":`true`,children:[e.title&&(0,f.jsx)(`div`,{className:`dmui-modal__title`,children:e.title}),e.editable?(0,f.jsx)(`input`,{ref:r,className:`dmui-modal__input`,value:t,placeholder:e.placeholderText,onChange:e=>n(e.target.value)}):e.content&&(0,f.jsx)(`div`,{className:`dmui-modal__content`,children:e.content}),(0,f.jsxs)(`div`,{className:`dmui-modal__actions`,children:[e.showCancel&&(0,f.jsx)(`button`,{type:`button`,className:`dmui-modal__button`,style:{color:e.cancelColor},onClick:()=>e.onResult(!1),children:e.cancelText}),(0,f.jsx)(`button`,{type:`button`,className:`dmui-modal__button`,style:{color:e.confirmColor},onClick:()=>e.onResult(!0,t),children:e.confirmText})]})]})]})}function O({dialog:e}){return(0,f.jsxs)(`div`,{className:`dmui-overlay`,children:[(0,f.jsx)(`div`,{className:`dmui-mask`,onClick:()=>e.onSelect(-1)}),(0,f.jsxs)(`div`,{className:`dmui-action-sheet`,role:`menu`,children:[(0,f.jsx)(`div`,{className:`dmui-action-sheet__items`,children:e.itemList.map((t,n)=>(0,f.jsx)(`button`,{type:`button`,className:`dmui-action-sheet__item`,style:{color:e.itemColor},onClick:()=>e.onSelect(n),children:t},n))}),(0,f.jsx)(`button`,{type:`button`,className:`dmui-action-sheet__cancel`,onClick:()=>e.onSelect(-1),children:`取消`})]})]})}function k({active:e,appId:n}){let r=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let i=r.current;if(!(!e||!i))return t(i,n)},[e,n]),(0,f.jsx)(`div`,{ref:r,className:`device-shell__extension-layer`,"data-dimina-simulator-overlay-root":!0})}function A(t,n,r){e({name:`capsule.more`,appId:t,appName:n||t,pagePath:r})}function j(e){if(!e)return{config:null,visible:!1,badges:[],redDots:[]};let t=e.list.length;return{config:M(e),visible:!0,badges:Array.from({length:t},()=>``),redDots:Array.from({length:t},()=>!1)}}function M(e){return{...e,list:e.list.map(e=>({...e}))}}function N(e,t){switch(t.kind){case`reset`:return{state:j(t.config),ok:!0,errMsg:`reset:ok`};case`visibility`:return{state:{...e,visible:t.visible},ok:!0,errMsg:t.visible?`showTabBar:ok`:`hideTabBar:ok`};case`apply`:return P(e,t.name,t.params)}}function P(e,t,n){if(!e.config)return{state:e,ok:!1,errMsg:`${t}:fail tabBar not configured`};switch(t){case`setTabBarStyle`:return ee(e,n);case`setTabBarItem`:return te(e,n);case`showTabBar`:return{state:{...e,visible:!0},ok:!0,errMsg:`showTabBar:ok`};case`hideTabBar`:return{state:{...e,visible:!1},ok:!0,errMsg:`hideTabBar:ok`};case`setTabBarBadge`:return ne(e,n);case`removeTabBarBadge`:return F(e,n);case`showTabBarRedDot`:return I(e,n,!0);case`hideTabBarRedDot`:return I(e,n,!1)}}function ee(e,t){if(!e.config)return{state:e,ok:!1,errMsg:`setTabBarStyle:fail tabBar not configured`};let n={...e.config},r=(e,t)=>{let r=R(t);r&&(n[e]=r)};return r(`color`,t.color),r(`selectedColor`,t.selectedColor),r(`backgroundColor`,t.backgroundColor),(t.borderStyle===`black`||t.borderStyle===`white`)&&(n.borderStyle=t.borderStyle),{state:{...e,config:n},ok:!0,errMsg:`setTabBarStyle:ok`}}function te(e,t){let n=L(e,t);if(n.err)return{state:e,ok:!1,errMsg:`setTabBarItem:fail ${n.err}`};if(!e.config)return{state:e,ok:!1,errMsg:`setTabBarItem:fail tabBar not configured`};let r=e.config.list[n.index],i={...r,text:typeof t.text==`string`?t.text:r.text,iconPath:typeof t.iconPath==`string`?t.iconPath:r.iconPath,selectedIconPath:typeof t.selectedIconPath==`string`?t.selectedIconPath:r.selectedIconPath},a=[...e.config.list];return a[n.index]=i,{state:{...e,config:{...e.config,list:a}},ok:!0,errMsg:`setTabBarItem:ok`}}function ne(e,t){let n=L(e,t);if(n.err)return{state:e,ok:!1,errMsg:`setTabBarBadge:fail ${n.err}`};let r=[...e.badges];r[n.index]=String(t.text??``);let i=[...e.redDots];return i[n.index]=!1,{state:{...e,badges:r,redDots:i},ok:!0,errMsg:`setTabBarBadge:ok`}}function F(e,t){let n=L(e,t);if(n.err)return{state:e,ok:!1,errMsg:`removeTabBarBadge:fail ${n.err}`};let r=[...e.badges];return r[n.index]=``,{state:{...e,badges:r},ok:!0,errMsg:`removeTabBarBadge:ok`}}function I(e,t,n){let r=L(e,t);if(r.err)return{state:e,ok:!1,errMsg:`${n?`showTabBarRedDot`:`hideTabBarRedDot`}:fail ${r.err}`};let i=[...e.redDots];i[r.index]=n;let a=[...e.badges];return n&&(a[r.index]=``),{state:{...e,redDots:i,badges:a},ok:!0,errMsg:`${n?`showTabBarRedDot`:`hideTabBarRedDot`}:ok`}}function L(e,t){let n=e.config?.list??[],r=t.index,i=Number(r);return n.length?r==null||!Number.isInteger(i)||i<0||i>=n.length?{index:-1,err:`invalid index ${r}`}:{index:i,err:null}:{index:-1,err:`tabBar not configured`}}function R(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||t.length>64?null:/[<>"';{}()\\]/.test(t)?/^(?:rgb|rgba|hsl|hsla)\(\s*[\d.,%\s/-]+\)$/i.test(t)?t:null:t}function z(e){return e?e.replace(/^\/+/,``):``}function B(e){if(!e)return null;let t=e.indexOf(`=`),n=t>=0?e.slice(0,t):e,r=t>=0?e.slice(t+1):``;return n?[decodeURIComponent(n),decodeURIComponent(r)]:null}function V(e){let t={};for(let n of e.split(`&`)){let e=B(n);e&&(t[e[0]]=e[1])}return t}function H(e){let[t,n]=(typeof e==`string`?e:``).split(`?`);return{pagePath:z(t),query:n?V(n):{}}}function U(e){let t={};return e.isTab&&(t[e.pagePath]=[e]),{stack:[e],tabStacks:t,currentTabPath:e.isTab?e.pagePath:null}}function W(e){return e.currentTabPath?{...e.tabStacks,[e.currentTabPath]:[...e.stack]}:e.tabStacks}function G(e,t){let n=e.stack[e.stack.length-1],r=[...e.stack,t];return{next:{...e,stack:r,tabStacks:e.currentTabPath?{...e.tabStacks,[e.currentTabPath]:r}:e.tabStacks},effects:n?[{kind:`lifecycle`,bridgeId:n.bridgeId,event:`pageHide`}]:[]}}function K(e,t){if(e.stack.length<=1)return{error:`no page to back`};let n=Math.min(Math.max(1,Number.isFinite(t)?t:1),e.stack.length-1),r=e.stack.slice(e.stack.length-n),i=e.stack.slice(0,e.stack.length-n),a=i[i.length-1],o={...e,stack:i,tabStacks:e.currentTabPath?{...e.tabStacks,[e.currentTabPath]:i}:e.tabStacks,currentTabPath:a.isTab?a.pagePath:e.currentTabPath},s=[];for(let e of r)s.push({kind:`lifecycle`,bridgeId:e.bridgeId,event:`pageUnload`}),s.push({kind:`closePage`,bridgeId:e.bridgeId});return s.push({kind:`lifecycle`,bridgeId:a.bridgeId,event:`pageShow`}),{next:o,effects:s}}function q(e,t){let n=e.stack[e.stack.length-1],r=[...e.stack.slice(0,e.stack.length-1),t],i={...e,stack:r,tabStacks:e.currentTabPath?{...e.tabStacks,[e.currentTabPath]:r}:e.tabStacks},a=[];return n&&(a.push({kind:`lifecycle`,bridgeId:n.bridgeId,event:`pageUnload`}),a.push({kind:`closePage`,bridgeId:n.bridgeId})),{next:i,effects:a}}function J(e,t){let n=new Set;for(let t of e.stack)n.add(t.bridgeId);for(let t of Object.values(e.tabStacks))for(let e of t)n.add(e.bridgeId);n.delete(t.bridgeId);let r=t.isTab?{[t.pagePath]:[t]}:{},i={stack:[t],tabStacks:r,currentTabPath:t.isTab?t.pagePath:null},a=[];for(let e of n)a.push({kind:`lifecycle`,bridgeId:e,event:`pageUnload`}),a.push({kind:`closePage`,bridgeId:e});return{next:i,effects:a}}function Y(e,t,n){let r=e.stack[e.stack.length-1],i=W(e),a,o=i[t];if(o&&o.length>0)a=o;else if(n)a=[n];else throw Error(`[page-stack] switchTab to ${t} requires either a cached substack or a freshly-opened entry`);let s={...e,stack:a,tabStacks:{...i,[t]:a},currentTabPath:t},c=a[a.length-1],l=[];return r&&r.bridgeId!==c.bridgeId&&l.push({kind:`lifecycle`,bridgeId:r.bridgeId,event:`pageHide`}),n||l.push({kind:`lifecycle`,bridgeId:c.bridgeId,event:`pageShow`}),{next:s,effects:l}}function X(e){let t=new Map,n=e.stack[e.stack.length-1]?.bridgeId,r=e=>{t.has(e.bridgeId)||t.set(e.bridgeId,{entry:e,visible:e.bridgeId===n})};for(let t of Object.values(e.tabStacks))for(let e of t)r(e);for(let t of e.stack)r(t);return Array.from(t.values())}function Z(e){return e.backgroundColor??`#ffffff`}function Q(e,t){let n=e.navigationBarBackgroundColor??`#ffffff`,r=e.navigationBarTextStyle??`black`,i=e.navigationStyle??`default`;return _({title:e.navigationBarTitleText??t,backgroundColor:n,textStyle:r,style:i,homeButtonVisible:e.homeButton===!0})}function re(e,t,n){switch(t){case`setNavigationBarTitle`:return{...e,title:typeof n.title==`string`?n.title:e.title};case`setNavigationBarColor`:return ae(e,n);case`showNavigationBarLoading`:return{...e,loading:!0};case`hideNavigationBarLoading`:return{...e,loading:!1};case`hideHomeButton`:return{...e,homeButtonVisible:!1};default:return e}}var ie=[`linear`,`easeIn`,`easeOut`,`easeInOut`];function ae(e,t){let n=typeof t.frontColor==`string`?t.frontColor.toLowerCase():void 0,r=n===`#ffffff`?`white`:n===`#000000`?`black`:e.textStyle,i=typeof t.backgroundColor==`string`?t.backgroundColor:e.backgroundColor,a=(()=>{let e=t.animation;if(!e||typeof e!=`object`)return;let n=e,r=typeof n.duration==`number`&&Number.isFinite(n.duration)?Math.max(0,n.duration):0,i=typeof n.timingFunc==`string`?n.timingFunc:`linear`;return{durationMs:r,timingFunc:ie.includes(i)?i:`linear`}})();return{...e,textStyle:r,backgroundColor:i,colorAnimation:a}}function oe(e,t,n){let r=e=>e.bridgeId===t?{...e,navBar:n(e.navBar)}:e,i=e.stack.map(r),a={};for(let[t,n]of Object.entries(e.tabStacks))a[t]=n.map(r);return{...e,stack:i,tabStacks:a}}var se=44,ce=24,le=44;function $({miniApp:e,bridgeId:t,platform:n=`ios`,active:r=!0}){let[i,s]=(0,o.useState)(()=>e.getInitialDevice());(0,o.useEffect)(()=>e.onSimulatorEvent(a.DEVICE_CHANGE,s),[e]);let c=i?.safeAreaInsets.top??(n===`ios`?se:ce),u=i?.safeAreaInsets.bottom??0,d=i?.notchType??`none`,p=(0,o.useMemo)(()=>e.getRenderPreloadUrl(),[e]),m=(0,o.useMemo)(()=>e.getTabBarConfig(),[e]),h=(0,o.useMemo)(()=>({bridgeId:t,pagePath:z(e.pagePath),query:{...e.query},isTab:!!e.getTabBarConfig()?.list.some(t=>z(t.pagePath)===z(e.pagePath)),windowConfig:e.rootWindowConfig??{},navBar:Q(e.rootWindowConfig??{},e.appId)}),[e,t]),[{shell:_,tabBar:v},x]=(0,o.useState)(()=>({shell:U(h),tabBar:j(m)})),S=(0,o.useRef)({shell:_,tabBar:v});(0,o.useEffect)(()=>{S.current={shell:_,tabBar:v}},[_,v]);let C=(0,o.useCallback)(t=>{for(let n of t)n.kind===`lifecycle`?e.notifyLifecycle(n.bridgeId,n.event):n.kind===`closePage`&&e.closePage(n.bridgeId)},[e]);(0,o.useEffect)(()=>e.onSimulatorEvent(a.NAV_BAR,e=>{x(t=>({...t,shell:oe(t.shell,e.bridgeId,t=>re(t,e.name,e.params))}))}),[e]),(0,o.useEffect)(()=>e.onSessionEvent(a.TAB_ACTION,t=>{let n=N(S.current.tabBar,{kind:`apply`,name:t.name,params:t.params});x(e=>({...e,tabBar:n.state})),e.notifyNavCallback({ok:n.ok,errMsg:n.errMsg,callbacks:t.callbacks})}),[e]);let T=(0,o.useCallback)(async t=>{let n=(n,r)=>e.notifyNavCallback({ok:n,errMsg:r,callbacks:t.callbacks});try{switch(t.name){case`navigateTo`:await ue(e,S,x,C,t,n);break;case`navigateBack`:de(S,x,C,t,n);break;case`redirectTo`:await fe(e,S,x,C,t,n);break;case`reLaunch`:await pe(e,S,x,C,t,n);break;case`switchTab`:await me(e,S,x,C,t,n);break}}catch(e){n(!1,`${t.name}:fail ${e instanceof Error?e.message:String(e)}`)}},[e,C]);(0,o.useEffect)(()=>e.onSessionEvent(a.NAV_ACTION,e=>{T(e)}),[T,e]),(0,o.useEffect)(()=>e.onSessionEvent(a.API_CALL,t=>{l(e,t.name,t.params,n=>{e.notifyApiResponse({requestId:t.requestId,ok:n.ok,result:n.result,errMsg:n.errMsg,keep:n.keep})})}),[e]);let E=(0,o.useCallback)(()=>{if(S.current.shell.stack.length<=1)return;let t=S.current.shell.stack;T({appSessionId:e.appSessionId??``,bridgeId:t[t.length-1].bridgeId,name:`navigateBack`,params:{delta:1},callbacks:{}})},[e,T]),D=(0,o.useCallback)(t=>{let n=S.current.shell;t===n.currentTabPath&&n.stack.length===1||T({appSessionId:e.appSessionId??``,bridgeId:n.stack[n.stack.length-1].bridgeId,name:`switchTab`,params:{url:`/${t}`},callbacks:{}})},[e,T]),O=_.stack[_.stack.length-1],M=X(_),P=(0,o.useCallback)(()=>{A(e.appId,O.navBar.title,O.pagePath)},[e.appId,O.navBar.title,O.pagePath]);return(0,o.useEffect)(()=>{e.notifyActivePage(O.bridgeId)},[e,O.bridgeId]),(0,o.useEffect)(()=>{e.notifyPageStack(_.stack.map(e=>({pagePath:e.pagePath,query:e.query})))},[e,_.stack]),(0,f.jsx)(`main`,{className:`device-shell-root`,children:(0,f.jsxs)(`section`,{className:`device-shell`,"aria-label":`Dimina simulator`,style:i?{width:i.screenWidth,height:i.screenHeight}:void 0,children:[(0,f.jsx)(y,{height:c,notchType:d,textStyle:O.navBar.textStyle}),(0,f.jsx)(g,{state:O.navBar,stackDepth:_.stack.length,platform:n,statusBarHeight:c,navBarHeight:le,onBack:E,onMore:P}),(0,f.jsx)(`div`,{className:`device-shell__viewport`,children:M.map(({entry:t,visible:n})=>(0,f.jsx)(`webview`,{className:`device-shell__webview`,src:e.createRenderHostUrl(t.bridgeId,t.pagePath,t.isTab,Z(t.windowConfig)),preload:p,allowpopups:`true`,style:{display:n?`flex`:`none`,zIndex:n?100:1,backgroundColor:Z(t.windowConfig)}},t.bridgeId))}),O.isTab&&(0,f.jsx)(b,{state:v,currentPath:_.currentTabPath,resourceBaseUrl:e.resourceBaseUrl,appId:e.appId,onSwitch:D,bottomInset:u}),(0,f.jsx)(w,{}),(0,f.jsx)(k,{active:r,appId:e.appId}),u>0&&(0,f.jsx)(`div`,{className:`device-shell__home-indicator`,style:{height:u},"aria-hidden":`true`})]})})}async function ue(e,t,n,r,i,a){let{pagePath:o,query:s}=H(i.params.url);if(!o){a(!1,`navigateTo:fail invalid url`);return}if(e.getTabBarConfig()?.list.some(e=>z(e.pagePath)===o)){a(!1,`navigateTo:fail can not navigateTo a tabbar page`);return}let c=await e.openPage(o,s),l={bridgeId:c.bridgeId,pagePath:c.pagePath,query:s,isTab:c.isTab,windowConfig:c.windowConfig,navBar:Q(c.windowConfig,e.appId)},{next:u,effects:d}=G(t.current.shell,l);n(e=>({...e,shell:u})),r(d),a(!0,`navigateTo:ok`)}function de(e,t,n,r,i){let a=r.params.delta,o=Number.isFinite(Number(a))?Number(a):1,s=K(e.current.shell,o);if(`error`in s){i(!1,`navigateBack:fail ${s.error}`);return}t(e=>({...e,shell:s.next})),n(s.effects),i(!0,`navigateBack:ok`)}async function fe(e,t,n,r,i,a){let{pagePath:o,query:s}=H(i.params.url);if(!o){a(!1,`redirectTo:fail invalid url`);return}if(e.getTabBarConfig()?.list.some(e=>z(e.pagePath)===o)){a(!1,`redirectTo:fail can not redirectTo a tabbar page`);return}let c=await e.openPage(o,s),l={bridgeId:c.bridgeId,pagePath:c.pagePath,query:s,isTab:c.isTab,windowConfig:c.windowConfig,navBar:Q(c.windowConfig,e.appId)},{next:u,effects:d}=q(t.current.shell,l);n(e=>({...e,shell:u})),r(d),a(!0,`redirectTo:ok`)}async function pe(e,t,n,r,i,a){let{pagePath:o,query:s}=H(i.params.url);if(!o){a(!1,`reLaunch:fail invalid url`);return}let c=await e.openPage(o,s),l={bridgeId:c.bridgeId,pagePath:c.pagePath,query:s,isTab:c.isTab,windowConfig:c.windowConfig,navBar:Q(c.windowConfig,e.appId)},{next:u,effects:d}=J(t.current.shell,l);n(e=>({...e,shell:u})),r(d),a(!0,`reLaunch:ok`)}async function me(e,t,n,r,i,a){let{pagePath:o}=H(i.params.url);if(!o){a(!1,`switchTab:fail invalid url`);return}if(!e.getTabBarConfig()?.list.some(e=>z(e.pagePath)===o)){a(!1,`switchTab:fail not a tabBar page: ${o}`);return}let s=t.current.shell.tabStacks[o],c=null;if(!s||s.length===0){let t=await e.openPage(o,{});c={bridgeId:t.bridgeId,pagePath:t.pagePath,query:{},isTab:!0,windowConfig:t.windowConfig,navBar:Q(t.windowConfig,e.appId)}}let{next:l,effects:u}=Y(t.current.shell,o,c);n(e=>({...e,shell:l})),r(u),a(!0,`switchTab:ok`)}export{$ as DeviceShell};
2
- //# sourceMappingURL=device-shell-CH_DMYaz.js.map