@dimina-kit/devtools 0.4.0-dev.20260728110120 → 0.4.0-dev.20260731100034

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 (105) hide show
  1. package/README.md +68 -0
  2. package/dist/main/api.d.ts +1 -0
  3. package/dist/main/app/app.d.ts +3 -0
  4. package/dist/main/app/app.js +15 -0
  5. package/dist/main/app/bootstrap.d.ts +8 -5
  6. package/dist/main/app/bootstrap.js +15 -15
  7. package/dist/main/index.bundle.js +2359 -5132
  8. package/dist/main/ipc/app-lifecycle.d.ts +1 -31
  9. package/dist/main/ipc/app-lifecycle.js +1 -53
  10. package/dist/main/ipc/bridge-router.d.ts +19 -152
  11. package/dist/main/ipc/bridge-router.js +28 -2186
  12. package/dist/main/ipc/page-scroll.d.ts +1 -13
  13. package/dist/main/ipc/page-scroll.js +1 -16
  14. package/dist/main/ipc/session-listener-bag.d.ts +1 -40
  15. package/dist/main/ipc/session-listener-bag.js +1 -39
  16. package/dist/main/services/console-forward/index.d.ts +1 -60
  17. package/dist/main/services/console-forward/index.js +1 -225
  18. package/dist/main/services/console-forward/internal-log.d.ts +1 -10
  19. package/dist/main/services/console-forward/internal-log.js +1 -22
  20. package/dist/main/services/diagnostics/index.d.ts +1 -58
  21. package/dist/main/services/diagnostics/index.js +1 -60
  22. package/dist/main/services/dimina-resource-server.d.ts +1 -6
  23. package/dist/main/services/dimina-resource-server.js +1 -98
  24. package/dist/main/services/network-forward/index.d.ts +15 -3
  25. package/dist/main/services/network-forward/index.js +30 -4
  26. package/dist/main/services/network-forward/websocket.d.ts +36 -0
  27. package/dist/main/services/network-forward/websocket.js +120 -0
  28. package/dist/main/services/service-host-pool/pool.d.ts +1 -196
  29. package/dist/main/services/service-host-pool/pool.js +1 -363
  30. package/dist/main/services/simulator/custom-apis.d.ts +1 -42
  31. package/dist/main/services/simulator/custom-apis.js +1 -46
  32. package/dist/main/services/simulator/referer.d.ts +1 -9
  33. package/dist/main/services/simulator/referer.js +1 -19
  34. package/dist/main/services/simulator/ui-extensions.d.ts +13 -0
  35. package/dist/main/services/simulator/ui-extensions.js +166 -0
  36. package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
  37. package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
  38. package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
  39. package/dist/main/services/simulator-temp-files/disk.js +1 -237
  40. package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
  41. package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
  42. package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
  43. package/dist/main/services/simulator-temp-files/index.js +1 -181
  44. package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
  45. package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
  46. package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
  47. package/dist/main/services/simulator-temp-files/resolver.js +1 -21
  48. package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
  49. package/dist/main/services/simulator-temp-files/store.js +1 -23
  50. package/dist/main/services/views/miniapp-partition.d.ts +1 -89
  51. package/dist/main/services/views/miniapp-partition.js +1 -158
  52. package/dist/main/services/views/native-simulator-view.js +3 -0
  53. package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
  54. package/dist/main/services/views/simulator-session-policy.js +1 -98
  55. package/dist/main/services/views/view-manager.d.ts +5 -0
  56. package/dist/main/services/workbench-context.d.ts +10 -1
  57. package/dist/main/services/workbench-context.js +20 -0
  58. package/dist/main/utils/ipc-registry.d.ts +21 -3
  59. package/dist/main/utils/ipc-registry.js +26 -23
  60. package/dist/main/utils/paths.d.ts +14 -0
  61. package/dist/main/utils/paths.js +14 -0
  62. package/dist/main/windows/service-host-window/create.d.ts +1 -92
  63. package/dist/main/windows/service-host-window/create.js +1 -154
  64. package/dist/native-host/render/render.js +51 -52
  65. package/dist/native-host/service/service.js +2 -2
  66. package/dist/preload/index.d.ts +2 -0
  67. package/dist/preload/index.js +1 -0
  68. package/dist/preload/runtime/clipboard.d.ts +6 -0
  69. package/dist/preload/runtime/clipboard.js +12 -0
  70. package/dist/preload/runtime/native-host.js +4 -10
  71. package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
  72. package/dist/preload/windows/main.cjs +46 -126
  73. package/dist/preload/windows/main.cjs.map +3 -3
  74. package/dist/preload/windows/simulator.cjs +83 -56
  75. package/dist/preload/windows/simulator.cjs.map +4 -4
  76. package/dist/preload/windows/simulator.js +83 -56
  77. package/dist/renderer/assets/{index-BJlFbXHb.js → index-BBg3YI5b.js} +2 -2
  78. package/dist/renderer/entries/main/index.html +1 -1
  79. package/dist/shared/bridge-channels.d.ts +1 -419
  80. package/dist/shared/bridge-channels.js +1 -89
  81. package/dist/shared/dmb-resource-url.d.ts +2 -0
  82. package/dist/shared/dmb-resource-url.js +2 -0
  83. package/dist/shared/ipc-channels.d.ts +2 -32
  84. package/dist/shared/ipc-channels.js +2 -5
  85. package/dist/shared/request-core.d.ts +1 -83
  86. package/dist/shared/request-core.js +1 -167
  87. package/dist/shared/simulator-ui.d.ts +61 -0
  88. package/dist/shared/simulator-ui.js +12 -0
  89. package/dist/shared/types.d.ts +7 -0
  90. package/dist/simulator/assets/device-shell-B03OuytR.js +2 -0
  91. package/dist/simulator/assets/device-shell-DbC5ccs8.css +1 -0
  92. package/dist/simulator/assets/{jsx-runtime-BDTY6fEq.js → jsx-runtime-hBv-rHqQ.js} +2 -2
  93. package/dist/simulator/assets/{simulator-CRyLSz1N.js → simulator-DpdXUf--.js} +5 -5
  94. package/dist/simulator/simulator.html +2 -2
  95. package/dist/simulator/temp-files.d.ts +29 -0
  96. package/dist/simulator/temp-files.js +79 -0
  97. package/dist/simulator/types.d.ts +43 -0
  98. package/dist/simulator/types.js +2 -0
  99. package/package.json +10 -5
  100. package/dist/shared/simulator-api-metadata.d.ts +0 -26
  101. package/dist/shared/simulator-api-metadata.js +0 -59
  102. package/dist/shared/vpath.d.ts +0 -42
  103. package/dist/shared/vpath.js +0 -105
  104. package/dist/simulator/assets/device-shell-DOy53Y0s.css +0 -1
  105. package/dist/simulator/assets/device-shell-Sbkjw8Nb.js +0 -2
@@ -1,168 +1,2 @@
1
- /**
2
- * Single authoritative implementation of wx.request network semantics, shared
3
- * by every request surface (simulator `directRequest`, preload api-compat
4
- * `wx.request` shim). Keeping the semantics in one module is what prevents the
5
- * surfaces from drifting apart on the core contract.
6
- *
7
- * The contract (official wx.request semantics):
8
- * - success vs fail is decided ONLY by whether a server response was
9
- * received. Any HTTP response — 200, 401, 500 — resolves via `success`
10
- * with `{ data, statusCode, header, errMsg: 'request:ok' }`; callers
11
- * branch on `statusCode` (e.g. 401 → re-login).
12
- * - `fail` fires only for network-layer failures and always carries a
13
- * non-empty errMsg: 'request:fail timeout' (deadline hit),
14
- * 'request:fail abort' (caller aborted), 'request:fail <reason>' (DNS/
15
- * connection/protocol errors).
16
- * - `timeout` defaults to 60000ms (the wx default) when omitted or
17
- * non-positive — a request never hangs indefinitely.
18
- * - `dataType` (default 'json') controls body decoding: 'json' attempts
19
- * JSON.parse with raw-text fallback; anything else keeps raw text.
20
- * `responseType: 'arraybuffer'` (or the legacy `dataType: 'arraybuffer'`
21
- * spelling) yields an ArrayBuffer instead.
22
- * - Outgoing headers merge case-insensitively via `Headers` so a caller's
23
- * `content-type` in any casing wins exactly once; the `application/json`
24
- * default applies only when the caller supplied none. Plain-object merges
25
- * would keep both casings as distinct keys and comma-join them on the wire.
26
- * - GET/HEAD serialize object `data` into URL query params (no body);
27
- * other methods send string data verbatim, form-encode objects under
28
- * application/x-www-form-urlencoded, and JSON-encode otherwise.
29
- * - `complete` fires exactly once, after success or fail, with that same
30
- * result object.
31
- *
32
- * Not provided: `cookies` on the success result — fetch() cannot read
33
- * Set-Cookie response headers, so surfacing a fabricated list would lie.
34
- */
35
- /**
36
- * The wx.request default timeout budget. Exported as the single source of
37
- * truth for every layer that reasons about a request's time budget — the
38
- * bridge-router watchdog (apiCallWatchdogMs in simulator-api-metadata.ts)
39
- * derives its window from this so the two cannot drift apart.
40
- */
41
- export const DEFAULT_REQUEST_TIMEOUT_MS = 60_000;
42
- /**
43
- * Largest delay setTimeout honours (2^31-1 ms). Anything above overflows the
44
- * signed-32-bit timer register and fires ~immediately (~1ms) instead of late —
45
- * so an oversized caller timeout must be rejected, never passed through.
46
- */
47
- export const MAX_TIMEOUT_MS = 2_147_483_647;
48
- /**
49
- * Resolve a caller-supplied wx timeout into a usable budget: a finite positive
50
- * number within setTimeout's range is honoured; anything else (absent, 0,
51
- * negative, NaN, Infinity, overflowing) falls back to the wx default. Shared
52
- * by performRequest and the bridge-router watchdog (apiCallWatchdogMs) so the
53
- * two layers can never disagree on what a valid timeout is.
54
- */
55
- export function resolveTimeoutBudgetMs(timeout) {
56
- const t = Number(timeout);
57
- return Number.isFinite(t) && t > 0 && t <= MAX_TIMEOUT_MS ? t : DEFAULT_REQUEST_TIMEOUT_MS;
58
- }
59
- function buildHeaders(header) {
60
- const headers = new Headers();
61
- for (const [key, value] of Object.entries(header ?? {})) {
62
- if (value != null)
63
- headers.set(key, String(value));
64
- }
65
- if (!headers.has('content-type'))
66
- headers.set('content-type', 'application/json');
67
- return headers;
68
- }
69
- function appendQueryParams(url, data) {
70
- // Resolve against the current document when available so page-relative URLs
71
- // keep working in the render-window shim.
72
- const base = typeof location !== 'undefined' ? location.href : undefined;
73
- const resolved = new URL(url, base);
74
- for (const [key, value] of Object.entries(data)) {
75
- resolved.searchParams.append(key, String(value));
76
- }
77
- return resolved.toString();
78
- }
79
- function encodeBody(data, contentType) {
80
- if (typeof data === 'string')
81
- return data;
82
- if (contentType.includes('application/x-www-form-urlencoded')) {
83
- const form = new URLSearchParams();
84
- for (const [key, value] of Object.entries(data)) {
85
- form.append(key, String(value));
86
- }
87
- return form.toString();
88
- }
89
- return JSON.stringify(data);
90
- }
91
- async function decodeResponseData(response, dataType, responseType) {
92
- if (responseType === 'arraybuffer' || dataType === 'arraybuffer') {
93
- return response.arrayBuffer();
94
- }
95
- const text = await response.text();
96
- if (dataType !== 'json')
97
- return text;
98
- try {
99
- return JSON.parse(text);
100
- }
101
- catch {
102
- return text;
103
- }
104
- }
105
- export function performRequest(opts, callbacks) {
106
- const method = (opts.method || 'GET').toUpperCase();
107
- const canHaveBody = method !== 'GET' && method !== 'HEAD';
108
- const headers = buildHeaders(opts.header);
109
- let url = opts.url;
110
- const init = { method, headers };
111
- if (!canHaveBody) {
112
- if (opts.data && typeof opts.data === 'object') {
113
- url = appendQueryParams(url, opts.data);
114
- }
115
- }
116
- else if (opts.data != null) {
117
- init.body = encodeBody(opts.data, headers.get('content-type') ?? '');
118
- }
119
- const controller = new AbortController();
120
- init.signal = controller.signal;
121
- // First verdict wins: a timeout/abort settles the call even though the fetch
122
- // promise is still pending, and the fetch's own late resolution/AbortError
123
- // rejection must not fire a second callback round.
124
- let settled = false;
125
- function settleSuccess(res) {
126
- if (settled)
127
- return;
128
- settled = true;
129
- clearTimeout(timer);
130
- callbacks.success?.(res);
131
- callbacks.complete?.(res);
132
- }
133
- function settleFail(err) {
134
- if (settled)
135
- return;
136
- settled = true;
137
- clearTimeout(timer);
138
- callbacks.fail?.(err);
139
- callbacks.complete?.(err);
140
- }
141
- const timeoutMs = resolveTimeoutBudgetMs(opts.timeout);
142
- const timer = setTimeout(() => {
143
- settleFail({ errMsg: 'request:fail timeout' });
144
- controller.abort();
145
- }, timeoutMs);
146
- const dataType = opts.dataType ?? 'json';
147
- const responseType = opts.responseType ?? 'text';
148
- fetch(url, init)
149
- .then(async (response) => {
150
- const header = {};
151
- response.headers.forEach((value, key) => {
152
- header[key] = value;
153
- });
154
- const data = await decodeResponseData(response, dataType, responseType);
155
- settleSuccess({ data, statusCode: response.status, header, errMsg: 'request:ok' });
156
- })
157
- .catch((error) => {
158
- const reason = error instanceof Error ? error.message : String(error);
159
- settleFail({ errMsg: `request:fail ${reason || 'network error'}` });
160
- });
161
- return {
162
- abort() {
163
- settleFail({ errMsg: 'request:fail abort' });
164
- controller.abort();
165
- },
166
- };
167
- }
1
+ export * from '@dimina-kit/electron-runtime/shared/request-core';
168
2
  //# sourceMappingURL=request-core.js.map
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Main-process registration supplied by a downstream host. The script must be
3
+ * a built renderer bundle that calls {@link registerSimulatorUiExtension}.
4
+ */
5
+ export interface SimulatorUiExtensionRegistration {
6
+ /** Stable, context-unique extension identifier. */
7
+ id: string;
8
+ /** Absolute path to a trusted renderer JavaScript bundle. */
9
+ rendererScriptPath: string;
10
+ }
11
+ /**
12
+ * Handle returned to the host that registered an extension. `invoke` crosses
13
+ * into the live simulator renderer and calls the extension's renderer-side
14
+ * method.
15
+ */
16
+ export interface SimulatorUiExtensionHandle {
17
+ dispose(): void | Promise<void>;
18
+ invoke<T = unknown>(method: string, params?: unknown): Promise<T>;
19
+ }
20
+ export interface SimulatorUiMountContext {
21
+ /** Stable host-owned layer inside the active device frame. */
22
+ overlayRoot: HTMLElement;
23
+ /** App currently represented by this DeviceShell. */
24
+ appId: string;
25
+ /** Aborted before the mount is disposed or moved to another shell. */
26
+ signal: AbortSignal;
27
+ }
28
+ export interface SimulatorChromeAction {
29
+ name: 'capsule.more';
30
+ appId: string;
31
+ appName: string;
32
+ pagePath: string;
33
+ }
34
+ /**
35
+ * Renderer-side half of a simulator UI extension.
36
+ *
37
+ * The extension owns its DOM and business semantics. Dimina owns the device
38
+ * layer, active-shell selection, reload lifecycle, and chrome-action delivery.
39
+ */
40
+ export interface SimulatorUiRendererExtension {
41
+ id: string;
42
+ mount?(context: SimulatorUiMountContext): void | (() => void);
43
+ invoke?(method: string, params: unknown): unknown | Promise<unknown>;
44
+ /**
45
+ * Return `false` to let another extension handle the action. Any other
46
+ * resolved value marks it handled.
47
+ */
48
+ onChromeAction?(action: SimulatorChromeAction): boolean | void | Promise<boolean | void>;
49
+ }
50
+ export interface SimulatorUiRuntimeBridge {
51
+ register(extension: SimulatorUiRendererExtension): () => void;
52
+ unregister(id: string): void;
53
+ has(id: string): boolean;
54
+ invoke(id: string, method: string, params: unknown): Promise<unknown>;
55
+ }
56
+ /**
57
+ * Register the renderer-side implementation from a host bundle loaded through
58
+ * `instance.registerSimulatorUiExtension`.
59
+ */
60
+ export declare function registerSimulatorUiExtension(extension: SimulatorUiRendererExtension): () => void;
61
+ //# sourceMappingURL=simulator-ui.d.ts.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Register the renderer-side implementation from a host bundle loaded through
3
+ * `instance.registerSimulatorUiExtension`.
4
+ */
5
+ export function registerSimulatorUiExtension(extension) {
6
+ const bridge = globalThis.__diminaSimulatorUi;
7
+ if (!bridge) {
8
+ throw new Error('Dimina simulator UI runtime is not available');
9
+ }
10
+ return bridge.register(extension);
11
+ }
12
+ //# sourceMappingURL=simulator-ui.js.map
@@ -183,6 +183,13 @@ export interface WorkbenchHostInstance {
183
183
  * The returned Disposable removes only the registration it created.
184
184
  */
185
185
  registerSimulatorApi(name: string, handler: SimulatorApiHandler): import('@dimina-kit/electron-deck/main').Disposable;
186
+ /**
187
+ * Installs a trusted downstream renderer bundle into this context's
188
+ * simulator UI runtime. Dimina owns the active DeviceShell mount point and
189
+ * reload/dispose lifecycle; the host owns the rendered DOM and business
190
+ * semantics.
191
+ */
192
+ registerSimulatorUiExtension(registration: import('./simulator-ui.js').SimulatorUiExtensionRegistration): import('./simulator-ui.js').SimulatorUiExtensionHandle;
186
193
  }
187
194
  /**
188
195
  * Pluggable backend for the project-list panel. Hosts may supply this to
@@ -0,0 +1,2 @@
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=new Set([`audioListen`]);function s(e){return o.has(e)}var c=r();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=s(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:o,onMore:s}){let l=(0,c.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:o,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:s})]})}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,c.useState)(()=>n.getState());return(0,c.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,c.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,c.useState)(``),r=(0,c.useRef)(null);return(0,c.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,c.useRef)(null);return(0,c.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 F(e,n);case`setTabBarItem`:return I(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 ee(e,n);case`removeTabBarBadge`:return te(e,n);case`showTabBarRedDot`:return L(e,n,!0);case`hideTabBarRedDot`:return L(e,n,!1)}}function F(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=z(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 I(e,t){let n=R(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 ee(e,t){let n=R(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 te(e,t){let n=R(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 L(e,t,n){let r=R(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 R(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 z(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 B(e){return e?e.replace(/^\/+/,``):``}function V(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 H(e){let t={};for(let n of e.split(`&`)){let e=V(n);e&&(t[e[0]]=e[1])}return t}function U(e){let[t,n]=(typeof e==`string`?e:``).split(`?`);return{pagePath:B(t),query:n?H(n):{}}}function W(e){let t={};return e.isTab&&(t[e.pagePath]=[e]),{stack:[e],tabStacks:t,currentTabPath:e.isTab?e.pagePath:null}}function G(e){return e.currentTabPath?{...e.tabStacks,[e.currentTabPath]:[...e.stack]}:e.tabStacks}function K(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 q(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 J(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 Y(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 X(e,t,n){let r=e.stack[e.stack.length-1],i=G(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 Z(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 Q(e){return e.backgroundColor??`#ffffff`}function $(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 ne(e,t,n){switch(t){case`setNavigationBarTitle`:return{...e,title:typeof n.title==`string`?n.title:e.title};case`setNavigationBarColor`:return ie(e,n);case`showNavigationBarLoading`:return{...e,loading:!0};case`hideNavigationBarLoading`:return{...e,loading:!1};case`hideHomeButton`:return{...e,homeButtonVisible:!1};default:return e}}var re=[`linear`,`easeIn`,`easeOut`,`easeInOut`];function ie(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:re.includes(i)?i:`linear`}})();return{...e,textStyle:r,backgroundColor:i,colorAnimation:a}}function ae(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 oe=44,se=24,ce=44;function le({miniApp:e,bridgeId:t,platform:n=`ios`,active:r=!0}){let i=new URLSearchParams(window.location.search).get(`embedded`)===`1`,[o,s]=(0,c.useState)(()=>e.getInitialDevice());(0,c.useEffect)(()=>e.onSimulatorEvent(a.DEVICE_CHANGE,s),[e]);let u=i?0:o?.safeAreaInsets.top??(n===`ios`?oe:se),d=i?0:o?.safeAreaInsets.bottom??0,p=o?.notchType??`none`,m=(0,c.useMemo)(()=>e.getRenderPreloadUrl(),[e]),h=(0,c.useMemo)(()=>e.getTabBarConfig(),[e]),_=(0,c.useMemo)(()=>({bridgeId:t,pagePath:B(e.pagePath),query:{...e.query},isTab:!!e.getTabBarConfig()?.list.some(t=>B(t.pagePath)===B(e.pagePath)),windowConfig:e.rootWindowConfig??{},navBar:$(e.rootWindowConfig??{},e.appId)}),[e,t]),[{shell:v,tabBar:x},S]=(0,c.useState)(()=>({shell:W(_),tabBar:j(h)})),C=(0,c.useRef)({shell:v,tabBar:x});(0,c.useEffect)(()=>{C.current={shell:v,tabBar:x}},[v,x]);let T=(0,c.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,c.useEffect)(()=>e.onSimulatorEvent(a.NAV_BAR,e=>{S(t=>({...t,shell:ae(t.shell,e.bridgeId,t=>ne(t,e.name,e.params))}))}),[e]),(0,c.useEffect)(()=>e.onSessionEvent(a.TAB_ACTION,t=>{let n=N(C.current.tabBar,{kind:`apply`,name:t.name,params:t.params});S(e=>({...e,tabBar:n.state})),e.notifyNavCallback({ok:n.ok,errMsg:n.errMsg,callbacks:t.callbacks})}),[e]);let E=(0,c.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,C,S,T,t,n);break;case`navigateBack`:de(C,S,T,t,n);break;case`redirectTo`:await fe(e,C,S,T,t,n);break;case`reLaunch`:await pe(e,C,S,T,t,n);break;case`switchTab`:await me(e,C,S,T,t,n);break}}catch(e){n(!1,`${t.name}:fail ${e instanceof Error?e.message:String(e)}`)}},[e,T]);(0,c.useEffect)(()=>e.onSessionEvent(a.NAV_ACTION,e=>{E(e)}),[E,e]),(0,c.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 D=(0,c.useCallback)(()=>{if(C.current.shell.stack.length<=1)return;let t=C.current.shell.stack;E({appSessionId:e.appSessionId??``,bridgeId:t[t.length-1].bridgeId,name:`navigateBack`,params:{delta:1},callbacks:{}})},[e,E]),O=(0,c.useCallback)(t=>{let n=C.current.shell;t===n.currentTabPath&&n.stack.length===1||E({appSessionId:e.appSessionId??``,bridgeId:n.stack[n.stack.length-1].bridgeId,name:`switchTab`,params:{url:`/${t}`},callbacks:{}})},[e,E]),M=v.stack[v.stack.length-1],P=Z(v),F=(0,c.useCallback)(()=>{A(e.appId,M.navBar.title,M.pagePath)},[e.appId,M.navBar.title,M.pagePath]);return(0,c.useEffect)(()=>{e.notifyActivePage(M.bridgeId)},[e,M.bridgeId]),(0,c.useEffect)(()=>{e.notifyPageStack(v.stack.map(e=>({pagePath:e.pagePath,query:e.query})))},[e,v.stack]),(0,f.jsx)(`main`,{className:`device-shell-root${i?` device-shell-root--embedded`:``}`,children:(0,f.jsxs)(`section`,{className:`device-shell${i?` device-shell--embedded`:``}`,"aria-label":`Dimina simulator`,style:!i&&o?{width:o.screenWidth,height:o.screenHeight}:void 0,children:[!i&&(0,f.jsx)(y,{height:u,notchType:p,textStyle:M.navBar.textStyle}),(0,f.jsx)(g,{state:M.navBar,stackDepth:v.stack.length,platform:n,statusBarHeight:u,navBarHeight:ce,onBack:D,onMore:F}),(0,f.jsx)(`div`,{className:`device-shell__viewport`,children:P.map(({entry:t,visible:n})=>(0,f.jsx)(`webview`,{className:`device-shell__webview`,src:e.createRenderHostUrl(t.bridgeId,t.pagePath,t.isTab,Q(t.windowConfig)),preload:m,allowpopups:`true`,style:{display:n?`flex`:`none`,zIndex:n?100:1,backgroundColor:Q(t.windowConfig)}},t.bridgeId))}),M.isTab&&(0,f.jsx)(b,{state:x,currentPath:v.currentTabPath,resourceBaseUrl:e.resourceBaseUrl,appId:e.appId,onSwitch:O,bottomInset:d}),(0,f.jsx)(w,{}),(0,f.jsx)(k,{active:r,appId:e.appId}),d>0&&(0,f.jsx)(`div`,{className:`device-shell__home-indicator`,style:{height:d},"aria-hidden":`true`})]})})}async function ue(e,t,n,r,i,a){let{pagePath:o,query:s}=U(i.params.url);if(!o){a(!1,`navigateTo:fail invalid url`);return}if(e.getTabBarConfig()?.list.some(e=>B(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:$(c.windowConfig,e.appId)},{next:u,effects:d}=K(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=q(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}=U(i.params.url);if(!o){a(!1,`redirectTo:fail invalid url`);return}if(e.getTabBarConfig()?.list.some(e=>B(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:$(c.windowConfig,e.appId)},{next:u,effects:d}=J(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}=U(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:$(c.windowConfig,e.appId)},{next:u,effects:d}=Y(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}=U(i.params.url);if(!o){a(!1,`switchTab:fail invalid url`);return}if(!e.getTabBarConfig()?.list.some(e=>B(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:$(t.windowConfig,e.appId)}}let{next:l,effects:u}=X(t.current.shell,o,c);n(e=>({...e,shell:l})),r(u),a(!0,`switchTab:ok`)}export{le as DeviceShell};
2
+ //# sourceMappingURL=device-shell-B03OuytR.js.map
@@ -0,0 +1 @@
1
+ .menu-capsule{box-sizing:border-box;color:#1f1f1f;pointer-events:none;background:#fff;border:.5px solid #e5e5e5;border-radius:16px;align-items:center;display:flex;position:absolute;overflow:hidden;box-shadow:0 1px 2px #00000014}.menu-capsule__more,.menu-capsule__close{flex:1;justify-content:center;align-items:center;display:flex}.menu-capsule__more{pointer-events:auto;cursor:pointer;color:inherit;background:0 0;border:0;gap:1px;padding:0}.menu-capsule__dot{background:currentColor;border-radius:50%}.menu-capsule__dot--side{width:4px;height:4px}.menu-capsule__dot--mid{width:6.4px;height:6.4px}.menu-capsule__divider{background:#e9e9e9;width:.5px;height:16px}.menu-capsule__close svg{color:currentColor}.nav-bar{box-sizing:border-box;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,PingFang SC,sans-serif;display:flex;position:relative}.nav-bar--custom{z-index:200;pointer-events:none;position:absolute;top:0;left:0;right:0;background-color:#0000!important}.nav-bar--custom .menu-capsule{pointer-events:auto}.nav-bar__row{align-items:center;padding:0 12px;display:flex;position:relative}.nav-bar__leading{z-index:1;align-items:center;gap:6px;display:flex;position:absolute;top:0;bottom:0;left:8px}.nav-bar__back,.nav-bar__home{cursor:pointer;width:32px;height:32px;color:inherit;background:0 0;border:0;justify-content:center;align-items:center;padding:0;display:flex}.nav-bar__title{flex:1;align-items:center;gap:6px;min-width:0;font-size:17px;font-weight:500;display:flex}.nav-bar__title--center{justify-content:center}.nav-bar__title--left{justify-content:flex-start;padding-left:48px}.nav-bar__title-text{text-overflow:ellipsis;white-space:nowrap;max-width:60%;overflow:hidden}.nav-bar__spinner{border:2px solid;border-right-color:#0000;border-radius:50%;width:14px;height:14px;animation:.8s linear infinite nav-bar-spin}@keyframes nav-bar-spin{to{transform:rotate(360deg)}}.device-statusbar{z-index:300;box-sizing:border-box;pointer-events:none;letter-spacing:.2px;justify-content:space-between;align-items:center;padding:0 28px;font:600 14px/1 -apple-system,BlinkMacSystemFont,SF Pro Text,Segoe UI,sans-serif;display:flex;position:absolute;top:0;left:0;right:0}.device-statusbar__time{font-variant-numeric:tabular-nums}.device-statusbar__notch{background:#000;position:absolute;left:50%;transform:translate(-50%)}.device-statusbar__icons{align-items:center;gap:6px;display:inline-flex}.device-statusbar__signal,.device-statusbar__wifi,.device-statusbar__battery{background:currentColor;display:block}.device-statusbar__signal{width:17px;height:11px;-webkit-mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 11'><rect x='0' y='8' width='3' height='3' rx='1'/><rect x='4.5' y='6' width='3' height='5' rx='1'/><rect x='9' y='3' width='3' height='8' rx='1'/><rect x='13.5' y='0' width='3' height='11' rx='1'/></svg>") 50%/contain no-repeat;mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 11'><rect x='0' y='8' width='3' height='3' rx='1'/><rect x='4.5' y='6' width='3' height='5' rx='1'/><rect x='9' y='3' width='3' height='8' rx='1'/><rect x='13.5' y='0' width='3' height='11' rx='1'/></svg>") 50%/contain no-repeat}.device-statusbar__wifi{border-radius:1px;width:16px;height:11px;-webkit-mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 11'><path d='M8 2.2c2.3 0 4.4.9 6 2.4l-1.4 1.5C11.4 4.9 9.8 4.2 8 4.2S4.6 4.9 3.4 6.1L2 4.6C3.6 3.1 5.7 2.2 8 2.2zm0 3.5c1.3 0 2.5.5 3.4 1.4L10 8.6c-.5-.5-1.2-.8-2-.8s-1.5.3-2 .8L4.6 7.1C5.5 6.2 6.7 5.7 8 5.7zm0 3.3l1.4 1.4c-.4.4-.9.6-1.4.6s-1-.2-1.4-.6L8 9z'/></svg>") 50%/contain no-repeat;mask:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 11'><path d='M8 2.2c2.3 0 4.4.9 6 2.4l-1.4 1.5C11.4 4.9 9.8 4.2 8 4.2S4.6 4.9 3.4 6.1L2 4.6C3.6 3.1 5.7 2.2 8 2.2zm0 3.5c1.3 0 2.5.5 3.4 1.4L10 8.6c-.5-.5-1.2-.8-2-.8s-1.5.3-2 .8L4.6 7.1C5.5 6.2 6.7 5.7 8 5.7zm0 3.3l1.4 1.4c-.4.4-.9.6-1.4.6s-1-.2-1.4-.6L8 9z'/></svg>") 50%/contain no-repeat}.device-statusbar__battery{background:0 0;border:1px solid;border-radius:3px;width:25px;height:12px;position:relative}.device-statusbar__battery:before{content:"";background:currentColor;border-radius:1px;position:absolute;inset:2px 8px 2px 2px}.device-statusbar__battery:after{content:"";background:currentColor;border-radius:0 1px 1px 0;width:2px;position:absolute;top:3px;bottom:3px;right:-3px}.dmb-tab-bar{box-sizing:content-box;z-index:9;border-top:1px solid #e0e0e0;flex-shrink:0;justify-content:space-around;align-items:stretch;width:100%;height:50px;display:flex}.dmb-tab-bar__item{cursor:pointer;font:inherit;color:inherit;background:0 0;border:0;outline:none;flex-direction:column;flex:1;justify-content:center;align-items:center;padding:4px 0 2px;display:flex;position:relative}.dmb-tab-bar__item:focus-visible{outline-offset:-2px;outline:2px solid #1890ff}.dmb-tab-bar__icon-slot{justify-content:center;align-items:center;width:24px;height:24px;margin-bottom:2px;display:flex}.dmb-tab-bar__icon{-o-object-fit:contain;object-fit:contain;max-width:100%;max-height:100%}.dmb-tab-bar__text{-webkit-user-select:none;user-select:none;font-size:11px;line-height:1}.dmb-tab-bar__badge{color:#fff;text-align:center;background:#f43f5e;border-radius:8px;min-width:16px;height:16px;padding:0 4px;font-size:10px;line-height:16px;position:absolute;top:0;right:calc(50% - 22px)}.dmb-tab-bar__red-dot{background:#f43f5e;border-radius:50%;width:8px;height:8px;position:absolute;top:4px;right:calc(50% - 16px)}.dmui-overlay{z-index:300;pointer-events:none;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.dmui-mask{pointer-events:auto;background:#00000080;position:absolute;inset:0}.dmui-mask--transparent{background:0 0}.dmui-toast{color:#fff;pointer-events:none;box-sizing:border-box;background:#000000bf;border-radius:10px;flex-direction:column;justify-content:center;align-items:center;gap:12px;min-width:120px;max-width:70%;padding:20px;display:flex;position:relative}.dmui-toast--text{border-radius:8px;min-width:0;padding:12px 18px}.dmui-toast__title{text-align:center;word-break:break-word;font:400 14px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.dmui-toast__icon{fill:none;stroke:#fff;stroke-width:2.4px;stroke-linecap:round;stroke-linejoin:round;width:40px;height:40px}.dmui-toast__image{-o-object-fit:contain;object-fit:contain;width:40px;height:40px}.dmui-toast__spinner{border:3px solid #ffffff4d;border-top-color:#fff;border-radius:50%;width:36px;height:36px;animation:.8s linear infinite dmui-spin}@keyframes dmui-spin{to{transform:rotate(360deg)}}.dmui-modal{pointer-events:auto;box-sizing:border-box;background:#fff;border-radius:12px;width:280px;max-width:80%;padding-top:24px;position:relative;overflow:hidden}.dmui-modal__title{color:#111827;text-align:center;padding:0 24px;font:600 17px/1.4 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.dmui-modal__content{color:#6b7280;text-align:center;max-height:200px;padding:8px 24px 20px;font:400 15px/1.5 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;overflow-y:auto}.dmui-modal__input{box-sizing:border-box;border:1px solid #e5e7eb;border-radius:4px;width:calc(100% - 48px);margin:16px 24px 20px;padding:6px 8px;font-size:15px;display:block}.dmui-modal__actions{border-top:1px solid #e5e7eb;display:flex}.dmui-modal__button{cursor:pointer;background:0 0;border:0;flex:1;padding:14px 0;font:400 17px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.dmui-modal__button+.dmui-modal__button{border-left:1px solid #e5e7eb}.dmui-overlay:has(.dmui-action-sheet){align-items:flex-end}.dmui-action-sheet{pointer-events:auto;box-sizing:border-box;width:100%;padding:8px;position:relative}.dmui-action-sheet__items{background:#fff;border-radius:12px;overflow:hidden}.dmui-action-sheet__item{text-align:center;cursor:pointer;background:0 0;border:0;width:100%;padding:16px 0;font:400 17px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;display:block}.dmui-action-sheet__item+.dmui-action-sheet__item{border-top:1px solid #ececec}.dmui-action-sheet__cancel{color:#111827;cursor:pointer;background:#fff;border:0;border-radius:12px;width:100%;margin-top:8px;padding:16px 0;font:600 17px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;display:block}.device-shell-root{color:#101418;box-sizing:border-box;background:#121212;width:100%;height:100vh;padding:24px;display:flex;overflow:auto}.device-shell-root--embedded{background:#fff;padding:0;overflow:hidden}@media (prefers-color-scheme:light){.device-shell-root{background:#e8e8e8}}.device-shell{background:#f8fafc;border:1px solid #1014182e;border-radius:38px;flex-direction:column;flex:none;min-height:0;margin:auto;display:flex;position:relative;overflow:hidden;box-shadow:0 18px 50px #10141838}.device-shell--embedded{width:100%;height:100%;box-shadow:none;border:0;border-radius:0;margin:0}.device-shell__status-bar{letter-spacing:0;color:#111827;background:#f8fafc;flex:0 0 42px;justify-content:space-between;align-items:center;padding:0 28px;font:600 13px/1 system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;display:flex}.device-shell__status-icons{align-items:center;gap:5px;display:inline-flex}.device-shell__status-icons span{background:#111827;display:block}.device-shell__status-icons span:first-child{border-radius:2px;width:16px;height:10px}.device-shell__status-icons span:nth-child(2){border-radius:50%;width:12px;height:12px}.device-shell__status-icons span:nth-child(3){border-radius:3px;width:20px;height:10px}.device-shell__viewport{background:#fff;flex:auto;min-height:0;position:relative}.device-shell__webview{background:#fff;border:0;width:100%;height:100%;display:block;position:absolute;inset:0}.device-shell__home-indicator{pointer-events:none;z-index:200;position:absolute;bottom:0;left:0;right:0}.device-shell__home-indicator:before{content:"";background:#111827;border-radius:999px;width:118px;height:4px;position:absolute;bottom:8px;left:50%;transform:translate(-50%)}.device-shell__extension-layer{z-index:400;pointer-events:none;position:absolute;inset:0;overflow:hidden}
@@ -1,2 +1,2 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")}),u=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},I={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function L(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,e.act=L,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=L,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),d=o(((e,t)=>{t.exports=u()})),f=6e4;function p(e){let t=Number(e);return Number.isFinite(t)&&t>0&&t<=2147483647?t:f}function m(e){let t=new Headers;for(let[n,r]of Object.entries(e??{}))r!=null&&t.set(n,String(r));return t.has(`content-type`)||t.set(`content-type`,`application/json`),t}function h(e,t){let n=typeof location<`u`?location.href:void 0,r=new URL(e,n);for(let[e,n]of Object.entries(t))r.searchParams.append(e,String(n));return r.toString()}function g(e,t){if(typeof e==`string`)return e;if(t.includes(`application/x-www-form-urlencoded`)){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))t.append(n,String(r));return t.toString()}return JSON.stringify(e)}async function _(e,t,n){if(n===`arraybuffer`||t===`arraybuffer`)return e.arrayBuffer();let r=await e.text();if(t!==`json`)return r;try{return JSON.parse(r)}catch{return r}}function v(e,t){let n=(e.method||`GET`).toUpperCase(),r=n!==`GET`&&n!==`HEAD`,i=m(e.header),a=e.url,o={method:n,headers:i};r?e.data!=null&&(o.body=g(e.data,i.get(`content-type`)??``)):e.data&&typeof e.data==`object`&&(a=h(a,e.data));let s=new AbortController;o.signal=s.signal;let c=!1;function l(e){c||(c=!0,clearTimeout(f),t.success?.(e),t.complete?.(e))}function u(e){c||(c=!0,clearTimeout(f),t.fail?.(e),t.complete?.(e))}let d=p(e.timeout),f=setTimeout(()=>{u({errMsg:`request:fail timeout`}),s.abort()},d),v=e.dataType??`json`,y=e.responseType??`text`;return fetch(a,o).then(async e=>{let t={};e.headers.forEach((e,n)=>{t[n]=e}),l({data:await _(e,v,y),statusCode:e.status,header:t,errMsg:`request:ok`})}).catch(e=>{u({errMsg:`request:fail ${(e instanceof Error?e.message:String(e))||`network error`}`})}),{abort(){u({errMsg:`request:fail abort`}),s.abort()}}}var y=new class{state={toast:null,dialog:null};listeners=new Set;getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}showToast(e){this.set({...this.state,toast:e})}hideToast(){this.set({...this.state,toast:null})}dismissToast(e){this.state.toast===e&&this.hideToast()}showDialog(e){this.set({...this.state,dialog:e})}hideDialog(){this.set({...this.state,dialog:null})}set(e){this.state=e;for(let t of this.listeners)t(e)}},b=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),x=o(((e,t)=>{t.exports=b()}));export{o as a,d as i,y as n,l as o,v as r,c as s,x as t};
2
- //# sourceMappingURL=jsx-runtime-BDTY6fEq.js.map
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")}),u=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`);return c}function M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},I={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function L(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,e.act=L,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=L,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),d=o(((e,t)=>{t.exports=u()})),f=new Map,p=new Map,m=null;function h(e){let t=p.get(e);if(t){p.delete(e),t.controller.abort();try{t.dispose?.()}catch(t){console.error(`[simulator-ui] extension "${e}" dispose failed:`,t)}}}function g(e){if(h(e.id),!m||!e.mount)return;let t=new AbortController,n={overlayRoot:m.overlayRoot,appId:m.appId,signal:t.signal};try{let r=e.mount(n);p.set(e.id,{controller:t,dispose:typeof r==`function`?r:void 0})}catch(n){t.abort(),console.error(`[simulator-ui] extension "${e.id}" mount failed:`,n)}}function _(){for(let e of Array.from(p.keys()))h(e);for(let e of f.values())g(e)}var v={register(e){let t=f.get(e.id);return t&&h(t.id),f.set(e.id,e),g(e),()=>{f.get(e.id)===e&&v.unregister(e.id)}},unregister(e){f.delete(e),h(e)},has(e){return f.has(e)},async invoke(e,t,n){let r=f.get(e);if(!r)throw Error(`Simulator UI extension "${e}" is not registered`);if(!r.invoke)throw Error(`Simulator UI extension "${e}" does not expose invoke()`);return await r.invoke(t,n)},async dispatchChromeAction(e){for(let t of f.values())if(t.onChromeAction)try{if(await t.onChromeAction(e)!==!1)return!0}catch(e){console.error(`[simulator-ui] extension "${t.id}" chrome action failed:`,e)}return!1}};globalThis.__diminaSimulatorUi=v;function y(e,t){let n={};return m={token:n,overlayRoot:e,appId:t},_(),()=>{m?.token===n&&(m=null,_())}}function b(e){return v.dispatchChromeAction(e)}var x=6e4;function S(e){let t=Number(e);return Number.isFinite(t)&&t>0&&t<=2147483647?t:x}function C(e){let t=new Headers;for(let[n,r]of Object.entries(e??{}))r!=null&&t.set(n,String(r));return t.has(`content-type`)||t.set(`content-type`,`application/json`),t}function w(e,t){let n=typeof location<`u`?location.href:void 0,r=new URL(e,n);for(let[e,n]of Object.entries(t))r.searchParams.append(e,String(n));return r.toString()}function T(e,t){if(typeof e==`string`)return e;if(t.includes(`application/x-www-form-urlencoded`)){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))t.append(n,String(r));return t.toString()}return JSON.stringify(e)}async function E(e,t,n){if(n===`arraybuffer`||t===`arraybuffer`)return e.arrayBuffer();let r=await e.text();if(t!==`json`)return r;try{return JSON.parse(r)}catch{return r}}function D(e,t){let n=(e.method||`GET`).toUpperCase(),r=n!==`GET`&&n!==`HEAD`,i=C(e.header),a=e.url,o={method:n,headers:i};r?e.data!=null&&(o.body=T(e.data,i.get(`content-type`)??``)):e.data&&typeof e.data==`object`&&(a=w(a,e.data));let s=new AbortController;o.signal=s.signal;let c=!1;function l(e){c||(c=!0,clearTimeout(f),t.success?.(e),t.complete?.(e))}function u(e){c||(c=!0,clearTimeout(f),t.fail?.(e),t.complete?.(e))}let d=S(e.timeout),f=setTimeout(()=>{u({errMsg:`request:fail timeout`}),s.abort()},d),p=e.dataType??`json`,m=e.responseType??`text`;return fetch(a,o).then(async e=>{let t={};e.headers.forEach((e,n)=>{t[n]=e}),l({data:await E(e,p,m),statusCode:e.status,header:t,errMsg:`request:ok`})}).catch(e=>{u({errMsg:`request:fail ${(e instanceof Error?e.message:String(e))||`network error`}`})}),{abort(){u({errMsg:`request:fail abort`}),s.abort()}}}var O=new class{state={toast:null,dialog:null};listeners=new Set;getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}showToast(e){this.set({...this.state,toast:e})}hideToast(){this.set({...this.state,toast:null})}dismissToast(e){this.state.toast===e&&this.hideToast()}showDialog(e){this.set({...this.state,dialog:e})}hideDialog(){this.set({...this.state,dialog:null})}set(e){this.state=e;for(let t of this.listeners)t(e)}},k=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),A=o(((e,t)=>{t.exports=k()}));export{b as a,l as c,y as i,c as l,O as n,d as o,D as r,o as s,A as t};
2
+ //# sourceMappingURL=jsx-runtime-hBv-rHqQ.js.map