@limrun/ui 0.14.0-rc.5 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -26
- package/dist/components/remote-control.d.ts +36 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1189 -1089
- package/package.json +10 -51
- package/src/components/remote-control.tsx +267 -0
- package/src/index.ts +1 -1
- package/vite.config.ts +0 -9
- package/dist/app-store-relay/index.cjs +0 -9
- package/dist/app-store-relay/index.d.ts +0 -204
- package/dist/app-store-relay/index.js +0 -677
- package/dist/app-store-relay/react.cjs +0 -1
- package/dist/app-store-relay/react.d.ts +0 -15
- package/dist/app-store-relay/react.js +0 -69
- package/dist/apple-credentials/index.cjs +0 -1
- package/dist/apple-credentials/index.d.ts +0 -110
- package/dist/apple-credentials/index.js +0 -291
- package/dist/browser-storage-BnO-Ma-e.mjs +0 -219
- package/dist/browser-storage-DLxIqZk5.js +0 -1
- package/dist/client-C9z_sgOf.js +0 -1
- package/dist/client-CFDB4mX5.mjs +0 -191
- package/dist/core/device-install/apple/client.d.ts +0 -18
- package/dist/core/device-install/apple/crypto.d.ts +0 -20
- package/dist/core/device-install/apple/gsa-srp.d.ts +0 -26
- package/dist/core/device-install/apple/index.d.ts +0 -5
- package/dist/core/device-install/apple/provisioning.d.ts +0 -237
- package/dist/core/device-install/apple/relay.d.ts +0 -53
- package/dist/core/device-install/index.d.ts +0 -4
- package/dist/core/device-install/operations/index.d.ts +0 -6
- package/dist/core/device-install/operations/limbuild-client.d.ts +0 -43
- package/dist/core/device-install/operations/operations.d.ts +0 -47
- package/dist/core/device-install/operations/relay-client.d.ts +0 -26
- package/dist/core/device-install/operations/relay-protocol.d.ts +0 -27
- package/dist/core/device-install/operations/usbmux.d.ts +0 -32
- package/dist/core/device-install/operations/webusb.d.ts +0 -21
- package/dist/core/device-install/storage/browser-storage.d.ts +0 -56
- package/dist/core/device-install/storage/index.d.ts +0 -2
- package/dist/core/device-install/storage/secret-store.d.ts +0 -124
- package/dist/core/device-install/types.d.ts +0 -57
- package/dist/core/errors.d.ts +0 -1
- package/dist/core/play-publish/google.d.ts +0 -13
- package/dist/core/play-publish/publish.d.ts +0 -34
- package/dist/device-build/index.cjs +0 -1
- package/dist/device-build/index.d.ts +0 -4
- package/dist/device-build/index.js +0 -85
- package/dist/device-build/react.cjs +0 -1
- package/dist/device-build/react.d.ts +0 -21
- package/dist/device-build/react.js +0 -68
- package/dist/device-build/signing.d.ts +0 -20
- package/dist/device-install/demo/demo.d.ts +0 -0
- package/dist/device-install/index.cjs +0 -1
- package/dist/device-install/index.d.ts +0 -18
- package/dist/device-install/index.js +0 -594
- package/dist/device-install/react.cjs +0 -1
- package/dist/device-install/react.d.ts +0 -24
- package/dist/device-install/react.js +0 -105
- package/dist/errors-BSkqS7U-.js +0 -1
- package/dist/errors-gy8yQJos.mjs +0 -6
- package/dist/gsa-srp-Bme3JLEi.mjs +0 -266
- package/dist/gsa-srp-CCIfUz7Y.js +0 -1
- package/dist/index-ChhtuQ7e.js +0 -22
- package/dist/index-YDu8K9a4.mjs +0 -11279
- package/dist/limbuild-client-BagK_FWE.mjs +0 -83
- package/dist/limbuild-client-CVDwq54z.js +0 -1
- package/dist/play-publish/index.cjs +0 -1
- package/dist/play-publish/index.d.ts +0 -2
- package/dist/play-publish/index.js +0 -109
- package/dist/play-publish/react.cjs +0 -1
- package/dist/play-publish/react.d.ts +0 -31
- package/dist/play-publish/react.js +0 -91
- package/dist/provisioning-CDPvxd1h.mjs +0 -270
- package/dist/provisioning-CbC4h--7.js +0 -1
- package/src/app-store-relay/index.test.ts +0 -60
- package/src/app-store-relay/index.ts +0 -846
- package/src/app-store-relay/react.ts +0 -131
- package/src/apple-credentials/index.test.ts +0 -180
- package/src/apple-credentials/index.ts +0 -388
- package/src/core/device-install/apple/client.ts +0 -150
- package/src/core/device-install/apple/crypto.ts +0 -205
- package/src/core/device-install/apple/gsa-srp.ts +0 -123
- package/src/core/device-install/apple/index.ts +0 -5
- package/src/core/device-install/apple/provisioning.test.ts +0 -114
- package/src/core/device-install/apple/provisioning.ts +0 -419
- package/src/core/device-install/apple/relay.ts +0 -202
- package/src/core/device-install/index.ts +0 -4
- package/src/core/device-install/operations/index.ts +0 -6
- package/src/core/device-install/operations/limbuild-client.ts +0 -144
- package/src/core/device-install/operations/operations.ts +0 -239
- package/src/core/device-install/operations/relay-client.ts +0 -286
- package/src/core/device-install/operations/relay-protocol.ts +0 -71
- package/src/core/device-install/operations/usbmux.ts +0 -270
- package/src/core/device-install/operations/webusb-dom.d.ts +0 -54
- package/src/core/device-install/operations/webusb.ts +0 -110
- package/src/core/device-install/storage/browser-storage.test.ts +0 -65
- package/src/core/device-install/storage/browser-storage.ts +0 -325
- package/src/core/device-install/storage/index.ts +0 -2
- package/src/core/device-install/storage/secret-store.ts +0 -332
- package/src/core/device-install/types.ts +0 -69
- package/src/core/errors.ts +0 -3
- package/src/core/play-publish/google.ts +0 -113
- package/src/core/play-publish/publish.test.ts +0 -68
- package/src/core/play-publish/publish.ts +0 -89
- package/src/device-build/index.ts +0 -42
- package/src/device-build/react.ts +0 -130
- package/src/device-build/signing.ts +0 -94
- package/src/device-install/README.md +0 -423
- package/src/device-install/demo/demo.css +0 -493
- package/src/device-install/demo/demo.tsx +0 -1061
- package/src/device-install/demo/index.html +0 -12
- package/src/device-install/index.ts +0 -50
- package/src/device-install/react.ts +0 -195
- package/src/play-publish/README.md +0 -66
- package/src/play-publish/index.ts +0 -12
- package/src/play-publish/react.ts +0 -208
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limrun/ui",
|
|
3
|
-
"version": "0.14.0
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"tag": "next"
|
|
@@ -14,51 +14,6 @@
|
|
|
14
14
|
"import": "./dist/index.js",
|
|
15
15
|
"require": "./dist/index.cjs"
|
|
16
16
|
},
|
|
17
|
-
"./app-store-relay": {
|
|
18
|
-
"types": "./dist/app-store-relay/index.d.ts",
|
|
19
|
-
"import": "./dist/app-store-relay/index.js",
|
|
20
|
-
"require": "./dist/app-store-relay/index.cjs"
|
|
21
|
-
},
|
|
22
|
-
"./app-store-relay/react": {
|
|
23
|
-
"types": "./dist/app-store-relay/react.d.ts",
|
|
24
|
-
"import": "./dist/app-store-relay/react.js",
|
|
25
|
-
"require": "./dist/app-store-relay/react.cjs"
|
|
26
|
-
},
|
|
27
|
-
"./apple-credentials": {
|
|
28
|
-
"types": "./dist/apple-credentials/index.d.ts",
|
|
29
|
-
"import": "./dist/apple-credentials/index.js",
|
|
30
|
-
"require": "./dist/apple-credentials/index.cjs"
|
|
31
|
-
},
|
|
32
|
-
"./device-build": {
|
|
33
|
-
"types": "./dist/device-build/index.d.ts",
|
|
34
|
-
"import": "./dist/device-build/index.js",
|
|
35
|
-
"require": "./dist/device-build/index.cjs"
|
|
36
|
-
},
|
|
37
|
-
"./device-build/react": {
|
|
38
|
-
"types": "./dist/device-build/react.d.ts",
|
|
39
|
-
"import": "./dist/device-build/react.js",
|
|
40
|
-
"require": "./dist/device-build/react.cjs"
|
|
41
|
-
},
|
|
42
|
-
"./device-install": {
|
|
43
|
-
"types": "./dist/device-install/index.d.ts",
|
|
44
|
-
"import": "./dist/device-install/index.js",
|
|
45
|
-
"require": "./dist/device-install/index.cjs"
|
|
46
|
-
},
|
|
47
|
-
"./device-install/react": {
|
|
48
|
-
"types": "./dist/device-install/react.d.ts",
|
|
49
|
-
"import": "./dist/device-install/react.js",
|
|
50
|
-
"require": "./dist/device-install/react.cjs"
|
|
51
|
-
},
|
|
52
|
-
"./play-publish": {
|
|
53
|
-
"types": "./dist/play-publish/index.d.ts",
|
|
54
|
-
"import": "./dist/play-publish/index.js",
|
|
55
|
-
"require": "./dist/play-publish/index.cjs"
|
|
56
|
-
},
|
|
57
|
-
"./play-publish/react": {
|
|
58
|
-
"types": "./dist/play-publish/react.d.ts",
|
|
59
|
-
"import": "./dist/play-publish/react.js",
|
|
60
|
-
"require": "./dist/play-publish/react.cjs"
|
|
61
|
-
},
|
|
62
17
|
"./package.json": "./package.json"
|
|
63
18
|
},
|
|
64
19
|
"scripts": {
|
|
@@ -76,23 +31,27 @@
|
|
|
76
31
|
"directory": "packages/ui"
|
|
77
32
|
},
|
|
78
33
|
"license": "MIT",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
36
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
37
|
+
},
|
|
79
38
|
"devDependencies": {
|
|
80
|
-
"@types/node-forge": "^1.3.14",
|
|
81
39
|
"@types/react": "^19.1.12",
|
|
82
40
|
"@types/react-dom": "^19.1.9",
|
|
83
41
|
"@vitejs/plugin-react-swc": "^4.0.1",
|
|
42
|
+
"eslint": "^9.39.1",
|
|
84
43
|
"jsdom": "^26.0.0",
|
|
85
44
|
"path": "^0.12.7",
|
|
86
45
|
"react": "^19.1.1",
|
|
87
46
|
"react-dom": "^19.1.1",
|
|
47
|
+
"typescript": "5.8.3",
|
|
48
|
+
"typescript-eslint": "8.31.1",
|
|
88
49
|
"vite": "^7.1.4",
|
|
89
50
|
"vite-plugin-dts": "^4.5.4",
|
|
90
51
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
91
|
-
"vitest": "^2.
|
|
52
|
+
"vitest": "^3.2.6"
|
|
92
53
|
},
|
|
93
54
|
"dependencies": {
|
|
94
|
-
"
|
|
95
|
-
"clsx": "^2.1.1",
|
|
96
|
-
"node-forge": "^1.4.0"
|
|
55
|
+
"clsx": "^2.1.1"
|
|
97
56
|
}
|
|
98
57
|
}
|
|
@@ -233,6 +233,45 @@ interface RemoteControlProps {
|
|
|
233
233
|
* 16:9 / 1920×1080 — applies).
|
|
234
234
|
*/
|
|
235
235
|
cameraAspect?: CameraAspect;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* iOS only: when true, capture the user's microphone via
|
|
239
|
+
* `getUserMedia({ audio: true })` and stream it live into the
|
|
240
|
+
* simulator's mock microphone. Unlike the camera (which is
|
|
241
|
+
* demand-driven by apps inside the sim), the microphone is
|
|
242
|
+
* user-driven: flip this prop from a button in your UI. The
|
|
243
|
+
* component handles the browser permission prompt, the WebRTC
|
|
244
|
+
* track attach (no SDP renegotiation — the audio slot is
|
|
245
|
+
* pre-allocated) and the `microphoneStart`/`microphoneStop`
|
|
246
|
+
* signaling to the host. Progress and failures are reported via
|
|
247
|
+
* `onMicrophoneStateChange`. Ignored on Android instances.
|
|
248
|
+
*/
|
|
249
|
+
microphoneEnabled?: boolean;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Fires whenever the live-microphone pipeline changes state:
|
|
253
|
+
* after an enable attempt resolves (granted or denied), when the
|
|
254
|
+
* host acknowledges or rejects the stream, when the browser
|
|
255
|
+
* revokes the track mid-stream, and on disable. Use it to render
|
|
256
|
+
* the mic button's on/off/error state.
|
|
257
|
+
*/
|
|
258
|
+
onMicrophoneStateChange?: (state: MicrophoneState) => void;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Snapshot of the live-microphone pipeline, reported through
|
|
263
|
+
* `onMicrophoneStateChange`.
|
|
264
|
+
*/
|
|
265
|
+
export interface MicrophoneState {
|
|
266
|
+
/** True while the browser mic is captured and streaming to the sim. */
|
|
267
|
+
active: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Human-readable failure from the last attempt, if any (permission
|
|
270
|
+
* denied, no device, host rejection, ...).
|
|
271
|
+
*/
|
|
272
|
+
error?: string;
|
|
273
|
+
/** Device label of the captured microphone, when available. */
|
|
274
|
+
label?: string;
|
|
236
275
|
}
|
|
237
276
|
|
|
238
277
|
/**
|
|
@@ -510,6 +549,8 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
510
549
|
onCameraStats,
|
|
511
550
|
cameraResolutionCap = 'auto',
|
|
512
551
|
cameraAspect,
|
|
552
|
+
microphoneEnabled = false,
|
|
553
|
+
onMicrophoneStateChange,
|
|
513
554
|
}: RemoteControlProps,
|
|
514
555
|
ref,
|
|
515
556
|
) => {
|
|
@@ -594,6 +635,28 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
594
635
|
packetsSent?: number;
|
|
595
636
|
packetsLost?: number;
|
|
596
637
|
} | null>(null);
|
|
638
|
+
// User-driven outbound microphone state (iOS only). Unlike the
|
|
639
|
+
// camera, the mic is toggled by the `microphoneEnabled` prop; the
|
|
640
|
+
// track rides a pre-allocated sendonly audio transceiver so
|
|
641
|
+
// enabling/disabling is just a `replaceTrack`, plus a
|
|
642
|
+
// `microphoneStart`/`microphoneStop` WS signal so the host's
|
|
643
|
+
// audio state machine switches its source.
|
|
644
|
+
const microphoneEnabledRef = useRef(microphoneEnabled);
|
|
645
|
+
microphoneEnabledRef.current = microphoneEnabled;
|
|
646
|
+
const onMicrophoneStateChangeRef = useRef(onMicrophoneStateChange);
|
|
647
|
+
onMicrophoneStateChangeRef.current = onMicrophoneStateChange;
|
|
648
|
+
const outboundMicSenderRef = useRef<RTCRtpSender | null>(null);
|
|
649
|
+
const outboundMicStreamRef = useRef<MediaStream | null>(null);
|
|
650
|
+
// Bumped by detach and teardown so an attach suspended on an await
|
|
651
|
+
// (the getUserMedia prompt) detects it was superseded and bails.
|
|
652
|
+
const micGenerationRef = useRef(0);
|
|
653
|
+
// Serializes attach/detach work so their awaits (replaceTrack on the
|
|
654
|
+
// shared sender) can never interleave and undo each other's effects.
|
|
655
|
+
const micOpQueueRef = useRef<Promise<void>>(Promise.resolve());
|
|
656
|
+
// Correlates the in-flight `microphoneStart` with its result so a
|
|
657
|
+
// host-side rejection (e.g. no loopback device on the node) can
|
|
658
|
+
// tear the capture back down and surface the error.
|
|
659
|
+
const micStartPendingIdRef = useRef<string | null>(null);
|
|
597
660
|
const firstFrameShownRef = useRef(false);
|
|
598
661
|
const pendingScreenshotResolversRef = useRef<
|
|
599
662
|
Map<string, (value: ScreenshotData | PromiseLike<ScreenshotData>) => void>
|
|
@@ -1694,6 +1757,149 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
1694
1757
|
stopMediaStream(stream);
|
|
1695
1758
|
};
|
|
1696
1759
|
|
|
1760
|
+
// Runs one attach/detach operation after all previously queued ones,
|
|
1761
|
+
// so two operations' awaits never interleave on the shared sender (a
|
|
1762
|
+
// stale detach could otherwise clear a fresh attach's track, or send
|
|
1763
|
+
// `microphoneStop` after its `microphoneStart`).
|
|
1764
|
+
const runMicOp = (op: () => Promise<void>): Promise<void> => {
|
|
1765
|
+
const next = micOpQueueRef.current.then(op).catch((err) => {
|
|
1766
|
+
debugWarn('microphone operation failed:', err);
|
|
1767
|
+
});
|
|
1768
|
+
micOpQueueRef.current = next;
|
|
1769
|
+
return next;
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1772
|
+
// Capture the user's microphone and stream it to the simulator's
|
|
1773
|
+
// mock microphone. Safe to call redundantly: bails when already
|
|
1774
|
+
// attached, when the connection isn't up yet (the ICE-connected
|
|
1775
|
+
// handler re-invokes it), or when the prop flipped off mid-prompt.
|
|
1776
|
+
// Does NOT bump the generation: a redundant call (e.g. the ICE
|
|
1777
|
+
// handler firing on both `connected` and `completed`) must not
|
|
1778
|
+
// cancel an attach already in flight; only detach/teardown cancel.
|
|
1779
|
+
const attachMicrophone = (): Promise<void> => {
|
|
1780
|
+
if (platform !== 'ios') return Promise.resolve();
|
|
1781
|
+
return runMicOp(() => attachMicrophoneOp());
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
const attachMicrophoneOp = async () => {
|
|
1785
|
+
const generation = micGenerationRef.current;
|
|
1786
|
+
const isCurrent = () => generation === micGenerationRef.current && microphoneEnabledRef.current;
|
|
1787
|
+
const reportMicError = (error: string) => {
|
|
1788
|
+
safeInvoke('onMicrophoneStateChange', onMicrophoneStateChangeRef.current, {
|
|
1789
|
+
active: false,
|
|
1790
|
+
error,
|
|
1791
|
+
});
|
|
1792
|
+
};
|
|
1793
|
+
if (!isCurrent()) return;
|
|
1794
|
+
const ws = wsRef.current;
|
|
1795
|
+
const sender = outboundMicSenderRef.current;
|
|
1796
|
+
if (!ws || ws.readyState !== WebSocket.OPEN || !sender) {
|
|
1797
|
+
// Not connected yet — the post-connect hook retries while the
|
|
1798
|
+
// prop is still on.
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
if (outboundMicStreamRef.current) return;
|
|
1802
|
+
if (!navigator.mediaDevices || typeof navigator.mediaDevices.getUserMedia !== 'function') {
|
|
1803
|
+
// eslint-disable-next-line no-console
|
|
1804
|
+
console.warn(
|
|
1805
|
+
'[RemoteControl] navigator.mediaDevices.getUserMedia unavailable. ' +
|
|
1806
|
+
'getUserMedia requires a secure context (https or http://localhost).',
|
|
1807
|
+
);
|
|
1808
|
+
reportMicError('Microphone capture requires a secure context (https)');
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
let stream: MediaStream | null = null;
|
|
1812
|
+
try {
|
|
1813
|
+
stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: false });
|
|
1814
|
+
} catch (err) {
|
|
1815
|
+
// eslint-disable-next-line no-console
|
|
1816
|
+
console.warn('[RemoteControl] microphone getUserMedia denied/failed:', err);
|
|
1817
|
+
}
|
|
1818
|
+
if (!isCurrent()) {
|
|
1819
|
+
if (stream) stopMediaStream(stream);
|
|
1820
|
+
return;
|
|
1821
|
+
}
|
|
1822
|
+
if (!stream) {
|
|
1823
|
+
reportMicError('Microphone permission denied or no device available');
|
|
1824
|
+
return;
|
|
1825
|
+
}
|
|
1826
|
+
const audioTrack = stream.getAudioTracks()[0] ?? null;
|
|
1827
|
+
if (!audioTrack) {
|
|
1828
|
+
stopMediaStream(stream);
|
|
1829
|
+
reportMicError('Captured stream has no audio track');
|
|
1830
|
+
return;
|
|
1831
|
+
}
|
|
1832
|
+
try {
|
|
1833
|
+
await sender.replaceTrack(audioTrack);
|
|
1834
|
+
} catch (err) {
|
|
1835
|
+
debugWarn('replaceTrack(audioTrack) failed:', err);
|
|
1836
|
+
stopMediaStream(stream);
|
|
1837
|
+
reportMicError('Failed to attach the microphone track to the connection');
|
|
1838
|
+
return;
|
|
1839
|
+
}
|
|
1840
|
+
if (!isCurrent()) {
|
|
1841
|
+
try {
|
|
1842
|
+
await sender.replaceTrack(null);
|
|
1843
|
+
} catch (err) {
|
|
1844
|
+
debugWarn('replaceTrack(null) on stale mic attach failed:', err);
|
|
1845
|
+
}
|
|
1846
|
+
stopMediaStream(stream);
|
|
1847
|
+
return;
|
|
1848
|
+
}
|
|
1849
|
+
outboundMicStreamRef.current = stream;
|
|
1850
|
+
// If the browser revokes the track later (user clicks Stop in
|
|
1851
|
+
// the tab's mic indicator, device unplugged, ...) tear down and
|
|
1852
|
+
// tell the host, so the sim's mic goes back to silence instead
|
|
1853
|
+
// of freezing on the last buffer.
|
|
1854
|
+
audioTrack.onended = () => {
|
|
1855
|
+
if (outboundMicStreamRef.current !== stream) return;
|
|
1856
|
+
void detachMicrophone('microphone capture ended by the browser');
|
|
1857
|
+
};
|
|
1858
|
+
const id = `ui-mic-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
1859
|
+
micStartPendingIdRef.current = id;
|
|
1860
|
+
ws.send(JSON.stringify({ type: 'microphoneStart', id }));
|
|
1861
|
+
safeInvoke('onMicrophoneStateChange', onMicrophoneStateChangeRef.current, {
|
|
1862
|
+
active: true,
|
|
1863
|
+
label: audioTrack.label || undefined,
|
|
1864
|
+
});
|
|
1865
|
+
};
|
|
1866
|
+
|
|
1867
|
+
// Stop the live microphone: drop the track from the sender, stop
|
|
1868
|
+
// the capture (turning the browser's mic indicator off) and tell
|
|
1869
|
+
// the host to switch its audio source back to silence. Safe to
|
|
1870
|
+
// call when nothing is attached.
|
|
1871
|
+
const detachMicrophone = (error?: string): Promise<void> => {
|
|
1872
|
+
// Bump synchronously (not on the queue) so an attach that is
|
|
1873
|
+
// suspended on an await bails at its next checkpoint even while
|
|
1874
|
+
// it still owns the queue.
|
|
1875
|
+
++micGenerationRef.current;
|
|
1876
|
+
micStartPendingIdRef.current = null;
|
|
1877
|
+
return runMicOp(async () => {
|
|
1878
|
+
const sender = outboundMicSenderRef.current;
|
|
1879
|
+
const stream = outboundMicStreamRef.current;
|
|
1880
|
+
outboundMicStreamRef.current = null;
|
|
1881
|
+
if (sender && stream) {
|
|
1882
|
+
try {
|
|
1883
|
+
await sender.replaceTrack(null);
|
|
1884
|
+
} catch (err) {
|
|
1885
|
+
debugWarn('replaceTrack(null) on mic detach failed:', err);
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
if (stream) stopMediaStream(stream);
|
|
1889
|
+
const ws = wsRef.current;
|
|
1890
|
+
if (stream && ws && ws.readyState === WebSocket.OPEN) {
|
|
1891
|
+
const id = `ui-mic-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
1892
|
+
ws.send(JSON.stringify({ type: 'microphoneStop', id }));
|
|
1893
|
+
}
|
|
1894
|
+
if (stream || error) {
|
|
1895
|
+
safeInvoke('onMicrophoneStateChange', onMicrophoneStateChangeRef.current, {
|
|
1896
|
+
active: false,
|
|
1897
|
+
...(error !== undefined && { error }),
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
});
|
|
1901
|
+
};
|
|
1902
|
+
|
|
1697
1903
|
// Translate the user-facing resolution cap into a
|
|
1698
1904
|
// MediaTrackConstraints fragment we can feed `getUserMedia`
|
|
1699
1905
|
// or `applyConstraints`. Always returns a 30 fps ceiling so
|
|
@@ -1845,6 +2051,22 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
1845
2051
|
stopCameraStatsPoller();
|
|
1846
2052
|
stopOutboundLocalStream();
|
|
1847
2053
|
outboundCameraSenderRef.current = null;
|
|
2054
|
+
// Same for the live microphone. No `microphoneStop` signal here —
|
|
2055
|
+
// the WS is going away with the connection; if `microphoneEnabled`
|
|
2056
|
+
// is still on, the post-reconnect hook re-attaches.
|
|
2057
|
+
++micGenerationRef.current;
|
|
2058
|
+
micStartPendingIdRef.current = null;
|
|
2059
|
+
if (outboundMicStreamRef.current) {
|
|
2060
|
+
stopMediaStream(outboundMicStreamRef.current);
|
|
2061
|
+
outboundMicStreamRef.current = null;
|
|
2062
|
+
// The capture is gone; report it so consumers don't keep a stale
|
|
2063
|
+
// `active: true` across drops (a re-attach after reconnect
|
|
2064
|
+
// reports again).
|
|
2065
|
+
safeInvoke('onMicrophoneStateChange', onMicrophoneStateChangeRef.current, {
|
|
2066
|
+
active: false,
|
|
2067
|
+
});
|
|
2068
|
+
}
|
|
2069
|
+
outboundMicSenderRef.current = null;
|
|
1848
2070
|
// A scheduled cursor flush would otherwise call setState on a
|
|
1849
2071
|
// teardown component once the next frame runs.
|
|
1850
2072
|
if (cursorRafIdRef.current !== undefined) {
|
|
@@ -2162,6 +2384,18 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
2162
2384
|
: null;
|
|
2163
2385
|
outboundCameraSenderRef.current = outboundCameraTransceiver?.sender ?? null;
|
|
2164
2386
|
|
|
2387
|
+
// Same pre-allocation for the live microphone: a sendonly audio
|
|
2388
|
+
// slot negotiated once at connection setup, so toggling the mic
|
|
2389
|
+
// later is just `replaceTrack` — no SDP renegotiation. iOS only,
|
|
2390
|
+
// like the camera.
|
|
2391
|
+
const outboundMicTransceiver =
|
|
2392
|
+
platform === 'ios' ?
|
|
2393
|
+
peerConnection.addTransceiver('audio', {
|
|
2394
|
+
direction: 'sendonly',
|
|
2395
|
+
})
|
|
2396
|
+
: null;
|
|
2397
|
+
outboundMicSenderRef.current = outboundMicTransceiver?.sender ?? null;
|
|
2398
|
+
|
|
2165
2399
|
// As hardware encoder, we use H265 for iOS and VP9 for Android.
|
|
2166
2400
|
// We make sure these two are the first ones in the list.
|
|
2167
2401
|
// If not, the fallback is H264 which is also hardware accelerated, although not as good,
|
|
@@ -2383,6 +2617,11 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
2383
2617
|
updateStatus('ICE state: ' + iceState);
|
|
2384
2618
|
if (iceState === 'connected' || iceState === 'completed') {
|
|
2385
2619
|
clearIceDisconnectedGrace();
|
|
2620
|
+
// Re-attach the live microphone across reconnects (or apply a
|
|
2621
|
+
// prop that was flipped on before the connection was up).
|
|
2622
|
+
if (microphoneEnabledRef.current && !outboundMicStreamRef.current) {
|
|
2623
|
+
void attachMicrophone();
|
|
2624
|
+
}
|
|
2386
2625
|
return;
|
|
2387
2626
|
}
|
|
2388
2627
|
if (iceState === 'failed') {
|
|
@@ -2780,6 +3019,22 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
2780
3019
|
startCameraStatsPoller();
|
|
2781
3020
|
break;
|
|
2782
3021
|
}
|
|
3022
|
+
case 'microphoneStartResult': {
|
|
3023
|
+
if (micStartPendingIdRef.current === null || message.id !== micStartPendingIdRef.current) {
|
|
3024
|
+
break;
|
|
3025
|
+
}
|
|
3026
|
+
micStartPendingIdRef.current = null;
|
|
3027
|
+
if (typeof message.error === 'string') {
|
|
3028
|
+
// Host rejected the stream (e.g. no loopback device
|
|
3029
|
+
// assigned on the node). Tear the capture back down so
|
|
3030
|
+
// the browser's mic indicator doesn't stay lit for a
|
|
3031
|
+
// stream nobody hears.
|
|
3032
|
+
// eslint-disable-next-line no-console
|
|
3033
|
+
console.warn('[RemoteControl] microphoneStart rejected by host:', message.error);
|
|
3034
|
+
void detachMicrophone(message.error);
|
|
3035
|
+
}
|
|
3036
|
+
break;
|
|
3037
|
+
}
|
|
2783
3038
|
case 'terminateAppResult':
|
|
2784
3039
|
if (typeof message.id !== 'string') {
|
|
2785
3040
|
debugWarn('Received invalid terminateApp result message:', message);
|
|
@@ -2906,6 +3161,18 @@ export const RemoteControl = forwardRef<RemoteControlHandle, RemoteControlProps>
|
|
|
2906
3161
|
}
|
|
2907
3162
|
}, [cameraAspect]);
|
|
2908
3163
|
|
|
3164
|
+
// Drive the live microphone from the `microphoneEnabled` prop.
|
|
3165
|
+
// When flipped on before the connection is up, attachMicrophone
|
|
3166
|
+
// bails and the ICE-connected handler picks it up instead.
|
|
3167
|
+
useEffect(() => {
|
|
3168
|
+
if (microphoneEnabled) {
|
|
3169
|
+
void attachMicrophone();
|
|
3170
|
+
} else {
|
|
3171
|
+
void detachMicrophone();
|
|
3172
|
+
}
|
|
3173
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3174
|
+
}, [microphoneEnabled]);
|
|
3175
|
+
|
|
2909
3176
|
useEffect(() => {
|
|
2910
3177
|
// Reset video loaded state when connection params change
|
|
2911
3178
|
setVideoLoaded(false);
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { RemoteControl } from './components/remote-control';
|
|
2
|
-
export type { RemoteControlHandle } from './components/remote-control';
|
|
2
|
+
export type { RemoteControlHandle, MicrophoneState } from './components/remote-control';
|
|
3
3
|
|
|
4
4
|
// Accessibility / inspect-mode types and helpers. Exported so customers can
|
|
5
5
|
// build their own side panels, search UIs, or agent-driven inspectors on top
|
package/vite.config.ts
CHANGED
|
@@ -11,15 +11,6 @@ export default defineConfig({
|
|
|
11
11
|
lib: {
|
|
12
12
|
entry: {
|
|
13
13
|
index: resolve(__dirname, 'src/index.ts'),
|
|
14
|
-
'app-store-relay/index': resolve(__dirname, 'src/app-store-relay/index.ts'),
|
|
15
|
-
'app-store-relay/react': resolve(__dirname, 'src/app-store-relay/react.ts'),
|
|
16
|
-
'apple-credentials/index': resolve(__dirname, 'src/apple-credentials/index.ts'),
|
|
17
|
-
'device-build/index': resolve(__dirname, 'src/device-build/index.ts'),
|
|
18
|
-
'device-build/react': resolve(__dirname, 'src/device-build/react.ts'),
|
|
19
|
-
'device-install/index': resolve(__dirname, 'src/device-install/index.ts'),
|
|
20
|
-
'device-install/react': resolve(__dirname, 'src/device-install/react.ts'),
|
|
21
|
-
'play-publish/index': resolve(__dirname, 'src/play-publish/index.ts'),
|
|
22
|
-
'play-publish/react': resolve(__dirname, 'src/play-publish/react.ts'),
|
|
23
14
|
},
|
|
24
15
|
name: 'LimrunUI',
|
|
25
16
|
formats: ['es', 'cjs'],
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../client-C9z_sgOf.js"),f=require("../index-ChhtuQ7e.js"),B=require("../gsa-srp-CCIfUz7Y.js"),a=require("../provisioning-CbC4h--7.js"),T={name:"RSASSA-PKCS1-v1_5",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:"SHA-256"};async function K(e){if(!crypto.subtle)throw new Error("WebCrypto is not available in this browser.");const t=await crypto.subtle.generateKey(T,!0,["sign","verify"]),r=new Uint8Array(await crypto.subtle.exportKey("spki",t.publicKey)),n=A(U(0),$(e),r,x(0,new Uint8Array)),o=new Uint8Array(await crypto.subtle.sign("RSASSA-PKCS1-v1_5",t.privateKey,M(n))),i=A(n,A(C("1.2.840.113549.1.1.11"),L()),N(o)),p=new Uint8Array(await crypto.subtle.exportKey("pkcs8",t.privateKey));return{privateKey:t.privateKey,privateKeyPKCS8Base64:w(p),publicKeySPKIBase64:w(r),csrPEM:V("CERTIFICATE REQUEST",i),csrBase64:w(i)}}function E(e){if(!e.certificateBase64&&!e.certificatePEM)throw new Error("certificateBase64 or certificatePEM is required.");const t=f.forge.pki.privateKeyFromPem(H("PRIVATE KEY",e.privateKeyPKCS8Base64)),r=e.certificatePEM?f.forge.pki.certificateFromPem(e.certificatePEM):f.forge.pki.certificateFromAsn1(f.forge.asn1.fromDer(f.forge.util.createBuffer(G(e.certificateBase64)))),n=f.forge.pkcs12.toPkcs12Asn1(t,[r],e.password,{algorithm:"3des",friendlyName:e.friendlyName}),o=f.forge.asn1.toDer(n).getBytes();return W(o)}function $(e){const t=[D("2.5.4.3",O(e.commonName))];return e.emailAddress&&t.push(D("1.2.840.113549.1.9.1",F(e.emailAddress))),A(...t)}function D(e,t){return k(A(C(e),t))}function A(...e){return u(48,b(...e))}function k(...e){return u(49,b(...e))}function x(e,t){return u(160+e,t)}function U(e){return u(2,new Uint8Array([e]))}function L(){return new Uint8Array([5,0])}function O(e){return u(12,new TextEncoder().encode(e))}function F(e){return u(22,new TextEncoder().encode(e))}function N(e){return u(3,b(new Uint8Array([0]),e))}function C(e){const t=e.split(".").map(n=>parseInt(n,10));if(t.length<2||t.some(n=>!Number.isFinite(n)))throw new Error(`Invalid OID: ${e}`);const r=[t[0]*40+t[1]];for(const n of t.slice(2)){const o=[n&127];let i=n>>7;for(;i>0;)o.unshift(i&127|128),i>>=7;r.push(...o)}return u(6,new Uint8Array(r))}function u(e,t){return b(new Uint8Array([e]),z(t.byteLength),t)}function z(e){if(e<128)return new Uint8Array([e]);const t=[];let r=e;for(;r>0;)t.unshift(r&255),r>>=8;return new Uint8Array([128|t.length,...t])}function b(...e){const t=e.reduce((o,i)=>o+i.byteLength,0),r=new Uint8Array(t);let n=0;for(const o of e)r.set(o,n),n+=o.byteLength;return r}function V(e,t){const n=w(t).match(/.{1,64}/g)??[];return`-----BEGIN ${e}-----
|
|
2
|
-
${n.join(`
|
|
3
|
-
`)}
|
|
4
|
-
-----END ${e}-----
|
|
5
|
-
`}function H(e,t){const r=t.match(/.{1,64}/g)??[];return`-----BEGIN ${e}-----
|
|
6
|
-
${r.join(`
|
|
7
|
-
`)}
|
|
8
|
-
-----END ${e}-----
|
|
9
|
-
`}function w(e){let t="";for(const r of e)t+=String.fromCharCode(r);return btoa(t)}function W(e){return btoa(e)}function G(e){return atob(e)}function M(e){const t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}async function c({relay:e,request:t,label:r="Apple Developer Portal request",validatePortalResponse:n=!0,mapBody:o}){const i=await s.proxyProvisioningRequest(e,t);return n&&q(i.body,r),o?o(i.body,i):i}async function _(e){return c({...e,request:a.listTeamsRequest(),label:"Apple Developer team list",mapBody:t=>Ae([...t?.teams??[],...t?.availableProviders??[],...t?.provider?[t.provider]:[]])})}async function j({certificateKind:e="development",teamId:t="",...r}){return c({...r,request:e==="distribution"?a.findDistributionCertificatesRequest(t):a.findDevelopmentCertificatesRequest(t),label:"Apple Developer certificate list",mapBody:n=>n?.certRequests??[]})}async function Q({certificateKind:e="development",teamId:t="",csrPEM:r,...n}){return c({...n,request:e==="distribution"?a.submitDistributionCSRRequest({csrPEM:r,teamID:t}):a.submitDevelopmentCSRRequest({csrPEM:r,teamID:t}),label:e==="distribution"?"Apple Distribution certificate creation":"Apple Development certificate creation",mapBody:o=>o?.certRequest})}async function J({certificateKind:e="development",certificateId:t,teamId:r="",...n}){return c({...n,request:e==="distribution"?a.downloadDistributionCertificateRequest(t,r):a.downloadCertificateRequest(t,r),label:"Apple certificate download",validatePortalResponse:!1,mapBody:(o,i)=>i})}async function X({certificateKind:e="development",certificateId:t,teamId:r="",...n}){return c({...n,request:{method:"POST",path:"/account/ios/certificate/revokeCertificate.action",payload:{teamId:r,certificateId:t,type:e==="distribution"?"WXV89964HE":"83Q87W3TGH"}},label:"Apple certificate deletion",mapBody:o=>o})}async function Y({teamId:e="",search:t="",...r}){const n=t.trim().toLowerCase();return c({...r,request:a.findBundleIDRequest({bundleID:t,teamID:e}),label:"Apple bundle ID list",mapBody:o=>{const i=o?.appIds??[];return n?i.filter(p=>[p.identifier,p.bundleId,p.name].some(l=>typeof l=="string"&&l.toLowerCase().includes(n))):i}})}async function Z({teamId:e="",bundleId:t,name:r,...n}){return c({...n,request:a.createBundleIDRequest({bundleID:t,teamID:e,name:r}),label:"Apple bundle ID creation",mapBody:o=>o?.appId})}async function ee({teamId:e="",appIdId:t,bundleId:r,name:n,...o}){return c({...o,request:{method:"POST",path:"/account/ios/identifiers/updateAppId.action",payload:{teamId:e,appIdId:t,...r?{identifier:r}:{},...n?{name:n}:{}}},label:"Apple bundle ID update",mapBody:i=>i?.appId})}async function te({teamId:e="",appIdId:t,...r}){return c({...r,request:{method:"POST",path:"/account/ios/identifiers/deleteAppId.action",payload:{teamId:e,appIdId:t}},label:"Apple bundle ID deletion",mapBody:n=>n})}async function re({teamId:e="",deviceUDID:t="",...r}){const n=I(t);return c({...r,request:a.findDeviceRequest({deviceUDID:t,teamID:e}),label:"Apple device list",mapBody:o=>{const i=o?.devices??[];return n?i.filter(p=>I(p.deviceNumber)===n):i}})}function I(e){return(e??"").replace(/-/g,"").replace(/[^a-fA-F0-9]/g,"").toUpperCase()}async function ne({teamId:e="",deviceUDID:t,name:r,...n}){return c({...n,request:a.registerDeviceRequest({deviceUDID:t,teamID:e,name:r}),label:"Apple device registration",mapBody:o=>o?.device})}async function oe({teamId:e="",deviceId:t,name:r,...n}){return c({...n,request:{method:"POST",path:"/account/ios/device/updateDevice.action",payload:{teamId:e,deviceId:t,...r?{name:r}:{}}},label:"Apple device update",mapBody:o=>o?.device})}async function ie({teamId:e="",deviceId:t,...r}){return c({...r,request:{method:"POST",path:"/account/ios/device/deleteDevice.action",payload:{teamId:e,deviceId:t}},label:"Apple device deletion",mapBody:n=>n})}async function pe({profileKind:e="development",teamId:t="",bundleId:r="",...n}){return c({...n,request:e==="adhoc"?a.findAdHocProfilesRequest({bundleID:r,teamID:t}):e==="appstore"?a.findAppStoreProfilesRequest({bundleID:r,teamID:t}):a.findDevelopmentProfilesRequest({bundleID:r,teamID:t}),label:"Apple provisioning profile list",mapBody:o=>o?.provisioningProfiles??[]})}async function ae({profileKind:e="development",teamId:t="",bundleId:r,appIdId:n,certificateIds:o,deviceIds:i=[],name:p,...l}){const[d]=o;if(!d)throw new Error("At least one certificate ID is required to create an Apple provisioning profile.");let v;if(e==="appstore"){if(!p)throw new Error("An explicit name is required to create an App Store provisioning profile.");v=a.createAppStoreProfileRequest({teamID:t,appIDID:n,certificateID:d,name:p})}else e==="adhoc"?v=a.createAdHocProfileRequest({bundleID:r,teamID:t,appIDID:n,certificateID:d,deviceIDs:i,name:p}):v=a.createDevelopmentProfileRequest({bundleID:r,teamID:t,appIDID:n,certificateID:d,deviceIDs:i,name:p});return c({...l,request:v,label:"Apple provisioning profile creation",mapBody:R=>R?.provisioningProfile})}async function se({teamId:e="",profileId:t,...r}){return c({...r,request:a.downloadProfileRequest(t,e),label:"Apple provisioning profile download",validatePortalResponse:!1,mapBody:(n,o)=>o})}async function ce({teamId:e="",profileId:t,...r}){return c({...r,request:{method:"POST",path:"/account/ios/profile/deleteProvisioningProfile.action",payload:{teamId:e,provisioningProfileId:t}},label:"Apple provisioning profile deletion",mapBody:n=>n})}async function le({relay:e,providerId:t}){const r=Number(t),n=await s.proxyAppStoreConnectRequest(e,{method:"POST",path:"/olympus/v1/session",payload:{provider:{providerId:Number.isNaN(r)?t:r}}});if(n.status<200||n.status>=300)throw new Error(`App Store Connect provider switch failed: HTTP ${n.status} ${n.rawBody??""}`.trim());return n}async function ue({relay:e}){const t=await s.proxyAppStoreConnectRequest(e,{path:"/iris/v1/apiKeys"});return y(t,"App Store Connect API key list"),h(t.body?.data)}async function de({relay:e,nickname:t,roles:r=["APP_MANAGER"],allAppsVisible:n=!0}){if(!t)throw new Error("A nickname is required to create an App Store Connect API key.");const o=await s.proxyAppStoreConnectRequest(e,{method:"POST",path:"/iris/v1/apiKeys",payload:{data:{type:"apiKeys",attributes:{nickname:t,allAppsVisible:n,keyType:"PUBLIC_API",roles:r}}}});y(o,"App Store Connect API key creation");const i=m(o.body?.data);if(!i?.id)throw new Error("App Store Connect API key creation did not return a key ID.");return i}async function fe({relay:e,keyId:t}){const r=await s.proxyAppStoreConnectRequest(e,{path:`/iris/v1/apiKeys/${encodeURIComponent(t)}`,query:{"fields[apiKeys]":"privateKey",include:"provider"}});y(r,"App Store Connect API key download");const n=m(r.body?.data),o=S(n?.attributes,"privateKey");if(!o)throw new Error(`App Store Connect API key ${t} returned no private key. Apple serves it only once; revoke the key and create a new one.`);const i=(r.body?.included??[]).find(l=>l.type==="providers"),p=S(i?.attributes,"publicProviderId")??S(n?.attributes,"issuerId")??i?.id;return{privateKeyPem:o,issuerId:p}}async function P({relay:e,bundleId:t}){const r=await s.proxyAppStoreConnectRequest(e,{path:"/iris/v1/apps",query:{"filter[bundleId]":t}});return y(r,"App Store Connect app lookup"),h(r.body?.data).find(n=>S(n.attributes,"bundleId")===t)}async function g({relay:e,bundleId:t,name:r,sku:n,primaryLocale:o="en-US",versionString:i="1.0"}){if(!r)throw new Error("An app name is required to create an App Store Connect app record.");const p="IOS",l=await s.proxyAppStoreConnectRequest(e,{method:"POST",path:"/iris/v1/apps",payload:{data:{type:"apps",attributes:{sku:n||t,primaryLocale:o,bundleId:t},relationships:{appStoreVersions:{data:[{type:"appStoreVersions",id:`\${store-version-${p}}`}]},appInfos:{data:[{type:"appInfos",id:"${new-appInfo-id}"}]}}},included:[{type:"appInfos",id:"${new-appInfo-id}",relationships:{appInfoLocalizations:{data:[{type:"appInfoLocalizations",id:"${new-appInfoLocalization-id}"}]}}},{type:"appInfoLocalizations",id:"${new-appInfoLocalization-id}",attributes:{locale:o,name:r}},{type:"appStoreVersions",id:`\${store-version-${p}}`,attributes:{platform:p,versionString:i},relationships:{appStoreVersionLocalizations:{data:[{type:"appStoreVersionLocalizations",id:`\${new-${p}VersionLocalization-id}`}]}}},{type:"appStoreVersionLocalizations",id:`\${new-${p}VersionLocalization-id}`,attributes:{locale:o}}]}});y(l,"App Store Connect app creation");const d=m(l.body?.data);if(!d?.id)throw new Error("App Store Connect app creation did not return an app ID.");return d}async function ye(e){const t=await P({relay:e.relay,bundleId:e.bundleId});return t?{app:t,created:!1}:{app:await g(e),created:!0}}function y(e,t){const r=e.body?.errors;if(r&&r.length>0){const n=r.map(o=>o.detail??o.title??o.code??o.status).filter(Boolean).join("; ");throw new Error(`${t} failed: ${n||`HTTP ${e.status}`}`)}if(e.status<200||e.status>=300)throw new Error(`${t} failed: HTTP ${e.status} ${e.rawBody??""}`.trim())}function h(e){return e?Array.isArray(e)?e:[e]:[]}function m(e){if(e)return Array.isArray(e)?e[0]:e}function S(e,t){const r=e?.[t];return typeof r=="string"&&r!==""?r:void 0}function q(e,t){if(!e)throw new Error(`${t} returned an empty response.`);if(e.resultCode!==void 0&&e.resultCode!==0)throw new Error(`${t} failed: ${e.userString??e.resultString??e.resultCode}`)}function Ae(e){const t=new Set,r=[];for(const n of e){const o=String(n.teamId??n.providerId??n.publicProviderId??n.name??JSON.stringify(n));t.has(o)||(t.add(o),r.push(n))}return r}exports.AppleRelayWebSocketClient=s.AppleRelayWebSocketClient;exports.fetchAppleAccountSession=s.fetchAppleAccountSession;exports.openAppleRelayWebSocket=s.openAppleRelayWebSocket;exports.proxyAppStoreConnectRequest=s.proxyAppStoreConnectRequest;exports.proxyPhoneTwoFactorCode=s.proxyPhoneTwoFactorCode;exports.proxySrpComplete=s.proxySrpComplete;exports.proxySrpInit=s.proxySrpInit;exports.proxyTwoFactorCode=s.proxyTwoFactorCode;exports.startBrowserOwnedAppleIDLogin=s.startBrowserOwnedAppleIDLogin;exports.triggerPhoneTwoFactor=s.triggerPhoneTwoFactor;exports.triggerTrustedDeviceTwoFactor=s.triggerTrustedDeviceTwoFactor;exports.AppleGsaSrpClient=B.AppleGsaSrpClient;exports.assertAppStoreConnectResponseOK=y;exports.assertAppleDeveloperPortalResponseOK=q;exports.createAppStoreConnectApiKey=de;exports.createAppStoreConnectApp=g;exports.createAppleBundleID=Z;exports.createAppleCertificate=Q;exports.createAppleProfile=ae;exports.deleteAppleBundleID=te;exports.deleteAppleCertificate=X;exports.deleteAppleDevice=ie;exports.deleteAppleProfile=ce;exports.downloadAppStoreConnectApiKeyPrivateKey=fe;exports.downloadAppleCertificate=J;exports.downloadAppleProfile=se;exports.ensureAppStoreConnectApp=ye;exports.exportAppleCertificateP12=E;exports.findAppStoreConnectApp=P;exports.generateAppleSigningKeyAndCSR=K;exports.listAppStoreConnectApiKeys=ue;exports.listAppleBundleIDs=Y;exports.listAppleCertificates=j;exports.listAppleDevices=re;exports.listAppleProfiles=pe;exports.listAppleTeams=_;exports.registerAppleDevice=ne;exports.requestAppleProvisioning=c;exports.switchAppStoreConnectProvider=le;exports.updateAppleBundleID=ee;exports.updateAppleDevice=oe;
|