@air-jam/sdk 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/arcade/bridge/controller.cjs +1 -1
  2. package/dist/arcade/bridge/controller.js +2 -2
  3. package/dist/arcade/bridge/host.cjs +1 -1
  4. package/dist/arcade/bridge/host.js +2 -2
  5. package/dist/arcade/bridge/iframe.cjs +1 -1
  6. package/dist/arcade/bridge/iframe.js +5 -5
  7. package/dist/arcade/bridge.cjs +1 -1
  8. package/dist/arcade/bridge.js +8 -8
  9. package/dist/arcade/host.cjs +0 -7
  10. package/dist/arcade/host.cjs.map +1 -1
  11. package/dist/arcade/host.js +4 -3
  12. package/dist/arcade/url.cjs +183 -2
  13. package/dist/arcade/url.cjs.map +1 -1
  14. package/dist/arcade/url.d.cts +1 -1
  15. package/dist/arcade/url.d.ts +1 -1
  16. package/dist/arcade/url.js +5 -4
  17. package/dist/arcade.cjs +184 -12
  18. package/dist/arcade.cjs.map +1 -1
  19. package/dist/arcade.d.cts +1 -1
  20. package/dist/arcade.d.ts +1 -1
  21. package/dist/arcade.js +22 -21
  22. package/dist/{chunk-2432OL7L.js → chunk-6CMB356F.js} +2 -2
  23. package/dist/{chunk-Y4RAPKKB.js → chunk-7OTQTT6H.js} +2 -2
  24. package/dist/{chunk-VDRNNGHX.js → chunk-CVYR5RJT.js} +9 -9
  25. package/dist/{chunk-VDRNNGHX.js.map → chunk-CVYR5RJT.js.map} +1 -1
  26. package/dist/{chunk-CQUG24WX.js → chunk-DY67S3LR.js} +2 -2
  27. package/dist/{chunk-NU5W6VAV.js → chunk-E5PVHEAX.js} +3 -3
  28. package/dist/{chunk-XLUWV45V.js → chunk-EDRQIOCV.js} +2 -2
  29. package/dist/{chunk-2J65FXEP.js → chunk-JO2HR5PV.js} +6 -4
  30. package/dist/chunk-JO2HR5PV.js.map +1 -0
  31. package/dist/{chunk-MKBASO6X.js → chunk-KOB73SPD.js} +2 -2
  32. package/dist/{chunk-VN5LDWVN.js → chunk-M4DKOI42.js} +2 -2
  33. package/dist/{chunk-HFWRZVZ3.js → chunk-NUJBMV3O.js} +13 -16
  34. package/dist/chunk-NUJBMV3O.js.map +1 -0
  35. package/dist/{chunk-D3X4MN4U.js → chunk-Q4UALQO4.js} +2 -2
  36. package/dist/chunk-UWJOIVON.js +369 -0
  37. package/dist/chunk-UWJOIVON.js.map +1 -0
  38. package/dist/index.cjs +515 -123
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +9 -2
  41. package/dist/index.d.ts +9 -2
  42. package/dist/index.js +175 -102
  43. package/dist/index.js.map +1 -1
  44. package/dist/preview.cjs +22 -11
  45. package/dist/preview.cjs.map +1 -1
  46. package/dist/preview.d.cts +1 -1
  47. package/dist/preview.d.ts +1 -1
  48. package/dist/preview.js +12 -12
  49. package/dist/preview.js.map +1 -1
  50. package/dist/runtime-topology.cjs +405 -0
  51. package/dist/runtime-topology.cjs.map +1 -0
  52. package/dist/runtime-topology.d.cts +59 -0
  53. package/dist/runtime-topology.d.ts +59 -0
  54. package/dist/runtime-topology.js +31 -0
  55. package/dist/runtime-topology.js.map +1 -0
  56. package/dist/ui.cjs +341 -30
  57. package/dist/ui.cjs.map +1 -1
  58. package/dist/ui.d.cts +11 -1
  59. package/dist/ui.d.ts +11 -1
  60. package/dist/ui.js +110 -32
  61. package/dist/ui.js.map +1 -1
  62. package/package.json +10 -3
  63. package/src/arcade/url.ts +2 -2
  64. package/src/components/join-qr-overlay.tsx +115 -31
  65. package/src/context/air-jam-context.tsx +2 -2
  66. package/src/dev/browser-log-sink.ts +1 -1
  67. package/src/hooks/use-host-audio-mute-preference.ts +99 -0
  68. package/src/index.ts +4 -0
  69. package/src/preview/ownership.ts +1 -1
  70. package/src/runtime/air-jam-config.ts +1 -1
  71. package/src/runtime/create-air-jam-app.tsx +2 -2
  72. package/src/runtime/embedded-runtime-adapters.ts +1 -1
  73. package/src/runtime/runtime-session-params.ts +2 -2
  74. package/src/runtime-topology.ts +569 -0
  75. package/dist/chunk-2J65FXEP.js.map +0 -1
  76. package/dist/chunk-HFWRZVZ3.js.map +0 -1
  77. /package/dist/{chunk-2432OL7L.js.map → chunk-6CMB356F.js.map} +0 -0
  78. /package/dist/{chunk-Y4RAPKKB.js.map → chunk-7OTQTT6H.js.map} +0 -0
  79. /package/dist/{chunk-CQUG24WX.js.map → chunk-DY67S3LR.js.map} +0 -0
  80. /package/dist/{chunk-NU5W6VAV.js.map → chunk-E5PVHEAX.js.map} +0 -0
  81. /package/dist/{chunk-XLUWV45V.js.map → chunk-EDRQIOCV.js.map} +0 -0
  82. /package/dist/{chunk-MKBASO6X.js.map → chunk-KOB73SPD.js.map} +0 -0
  83. /package/dist/{chunk-VN5LDWVN.js.map → chunk-M4DKOI42.js.map} +0 -0
  84. /package/dist/{chunk-D3X4MN4U.js.map → chunk-Q4UALQO4.js.map} +0 -0
package/dist/ui.cjs CHANGED
@@ -125,15 +125,255 @@ var import_react4 = require("react");
125
125
  var import_zustand3 = require("zustand");
126
126
  var import_shallow2 = require("zustand/react/shallow");
127
127
 
128
+ // src/runtime-topology.ts
129
+ var RUNTIME_MODES = /* @__PURE__ */ new Set([
130
+ "standalone-dev",
131
+ "standalone-secure",
132
+ "arcade-live",
133
+ "arcade-built",
134
+ "self-hosted-production",
135
+ "hosted-release"
136
+ ]);
137
+ var SURFACE_ROLES = /* @__PURE__ */ new Set([
138
+ "host",
139
+ "controller",
140
+ "platform-host",
141
+ "platform-controller"
142
+ ]);
143
+ var PROXY_STRATEGIES = /* @__PURE__ */ new Set([
144
+ "none",
145
+ "platform-proxy",
146
+ "dev-proxy"
147
+ ]);
148
+ var AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX = "aj_topology_";
149
+ var REQUIRED_QUERY_KEYS = [
150
+ "runtime_mode",
151
+ "surface_role",
152
+ "app_origin",
153
+ "backend_origin",
154
+ "public_host",
155
+ "asset_base_path",
156
+ "secure_transport",
157
+ "embedded",
158
+ "proxy_strategy"
159
+ ];
160
+ var isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
161
+ var assertString = (value, fieldName) => {
162
+ if (typeof value !== "string") {
163
+ throw new Error(`Runtime topology field "${fieldName}" must be a string.`);
164
+ }
165
+ const normalized = value.trim();
166
+ if (!normalized) {
167
+ throw new Error(`Runtime topology field "${fieldName}" cannot be empty.`);
168
+ }
169
+ return normalized;
170
+ };
171
+ var assertBoolean = (value, fieldName) => {
172
+ if (typeof value !== "boolean") {
173
+ throw new Error(`Runtime topology field "${fieldName}" must be a boolean.`);
174
+ }
175
+ return value;
176
+ };
177
+ var assertUrl = (value, fieldName) => {
178
+ const normalized = assertString(value, fieldName);
179
+ const withScheme = normalized.includes("://") ? normalized : `http://${normalized}`;
180
+ let parsed;
181
+ try {
182
+ parsed = new URL(withScheme);
183
+ } catch {
184
+ throw new Error(
185
+ `Runtime topology field "${fieldName}" must be a valid absolute URL.`
186
+ );
187
+ }
188
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
189
+ throw new Error(
190
+ `Runtime topology field "${fieldName}" must use http or https.`
191
+ );
192
+ }
193
+ parsed.pathname = "";
194
+ parsed.search = "";
195
+ parsed.hash = "";
196
+ return parsed.origin;
197
+ };
198
+ var normalizeAssetBasePath = (value) => {
199
+ if (value == null) {
200
+ return "/";
201
+ }
202
+ const normalized = assertString(value, "assetBasePath");
203
+ if (normalized === "/") {
204
+ return normalized;
205
+ }
206
+ const withLeadingSlash = normalized.startsWith("/") ? normalized : `/${normalized}`;
207
+ return withLeadingSlash.endsWith("/") && withLeadingSlash.length > 1 ? withLeadingSlash.slice(0, -1) : withLeadingSlash;
208
+ };
209
+ var fromBooleanParam = (value, fieldName) => {
210
+ if (value === "true") {
211
+ return true;
212
+ }
213
+ if (value === "false") {
214
+ return false;
215
+ }
216
+ throw new Error(
217
+ `Runtime topology query field "${fieldName}" must be "true" or "false".`
218
+ );
219
+ };
220
+ var resolveDefaultSocketOrigin = ({
221
+ proxyStrategy,
222
+ appOrigin,
223
+ backendOrigin
224
+ }) => {
225
+ if (proxyStrategy === "none") {
226
+ return backendOrigin;
227
+ }
228
+ return appOrigin;
229
+ };
230
+ var inferSecureTransport = ({
231
+ runtimeMode,
232
+ appOrigin,
233
+ backendOrigin,
234
+ socketOrigin,
235
+ publicHost
236
+ }) => {
237
+ if (runtimeMode === "standalone-secure") {
238
+ return true;
239
+ }
240
+ return [appOrigin, backendOrigin, socketOrigin, publicHost].every(
241
+ (origin) => origin.startsWith("https://")
242
+ );
243
+ };
244
+ var resolveRuntimeTopology = (input) => {
245
+ if (!isObject(input)) {
246
+ throw new Error("Runtime topology input must be an object.");
247
+ }
248
+ const runtimeMode = assertString(
249
+ input.runtimeMode,
250
+ "runtimeMode"
251
+ );
252
+ if (!RUNTIME_MODES.has(runtimeMode)) {
253
+ throw new Error(
254
+ `Unsupported runtime mode "${runtimeMode}". Use one of: ${Array.from(RUNTIME_MODES).join(", ")}.`
255
+ );
256
+ }
257
+ const surfaceRole = assertString(
258
+ input.surfaceRole,
259
+ "surfaceRole"
260
+ );
261
+ if (!SURFACE_ROLES.has(surfaceRole)) {
262
+ throw new Error(
263
+ `Unsupported surface role "${surfaceRole}". Use one of: ${Array.from(SURFACE_ROLES).join(", ")}.`
264
+ );
265
+ }
266
+ const appOrigin = assertUrl(input.appOrigin, "appOrigin");
267
+ const backendOrigin = assertUrl(input.backendOrigin, "backendOrigin");
268
+ const proxyStrategy = input.proxyStrategy == null ? "none" : assertString(input.proxyStrategy, "proxyStrategy");
269
+ if (!PROXY_STRATEGIES.has(proxyStrategy)) {
270
+ throw new Error(
271
+ `Unsupported proxy strategy "${proxyStrategy}". Use one of: ${Array.from(PROXY_STRATEGIES).join(", ")}.`
272
+ );
273
+ }
274
+ const socketOrigin = input.socketOrigin != null ? assertUrl(input.socketOrigin, "socketOrigin") : resolveDefaultSocketOrigin({ proxyStrategy, appOrigin, backendOrigin });
275
+ const publicHost = input.publicHost != null ? assertUrl(input.publicHost, "publicHost") : appOrigin;
276
+ const assetBasePath = normalizeAssetBasePath(input.assetBasePath);
277
+ const embedded = input.embedded == null ? false : assertBoolean(input.embedded, "embedded");
278
+ const embedParentOrigin = input.embedParentOrigin == null ? void 0 : assertUrl(input.embedParentOrigin, "embedParentOrigin");
279
+ if (embedded && !embedParentOrigin) {
280
+ throw new Error(
281
+ 'Embedded runtimes must provide "embedParentOrigin" in their topology.'
282
+ );
283
+ }
284
+ if (!embedded && embedParentOrigin) {
285
+ throw new Error(
286
+ 'Non-embedded runtimes cannot provide "embedParentOrigin" in their topology.'
287
+ );
288
+ }
289
+ const secureTransport = input.secureTransport == null ? inferSecureTransport({
290
+ runtimeMode,
291
+ appOrigin,
292
+ backendOrigin,
293
+ socketOrigin,
294
+ publicHost
295
+ }) : assertBoolean(input.secureTransport, "secureTransport");
296
+ return {
297
+ runtimeMode,
298
+ surfaceRole,
299
+ appOrigin,
300
+ backendOrigin,
301
+ socketOrigin,
302
+ publicHost,
303
+ assetBasePath,
304
+ secureTransport,
305
+ embedded,
306
+ ...embedParentOrigin ? { embedParentOrigin } : {},
307
+ proxyStrategy
308
+ };
309
+ };
310
+ var parseRuntimeTopologyFromSearchParams = (params) => {
311
+ if (!(params instanceof URLSearchParams)) {
312
+ throw new Error(
313
+ "Runtime topology search param reader expects URLSearchParams."
314
+ );
315
+ }
316
+ const hasAnyTopologyParam = REQUIRED_QUERY_KEYS.some(
317
+ (key) => params.has(`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}${key}`)
318
+ );
319
+ if (!hasAnyTopologyParam) {
320
+ return null;
321
+ }
322
+ const missing = REQUIRED_QUERY_KEYS.filter(
323
+ (key) => !params.has(`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}${key}`)
324
+ );
325
+ if (missing.length > 0) {
326
+ throw new Error(
327
+ `Runtime topology search params are incomplete. Missing: ${missing.join(", ")}.`
328
+ );
329
+ }
330
+ const embedParentOrigin = params.get(
331
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}embed_parent_origin`
332
+ );
333
+ return resolveRuntimeTopology({
334
+ runtimeMode: params.get(
335
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}runtime_mode`
336
+ ),
337
+ surfaceRole: params.get(
338
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}surface_role`
339
+ ),
340
+ appOrigin: params.get(
341
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}app_origin`
342
+ ),
343
+ backendOrigin: params.get(
344
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}backend_origin`
345
+ ),
346
+ socketOrigin: params.get(
347
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}socket_origin`
348
+ ),
349
+ publicHost: params.get(
350
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}public_host`
351
+ ),
352
+ assetBasePath: params.get(
353
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}asset_base_path`
354
+ ),
355
+ secureTransport: fromBooleanParam(
356
+ params.get(
357
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}secure_transport`
358
+ ),
359
+ "secure_transport"
360
+ ),
361
+ embedded: fromBooleanParam(
362
+ params.get(`${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}embedded`),
363
+ "embedded"
364
+ ),
365
+ proxyStrategy: params.get(
366
+ `${AIR_JAM_RUNTIME_TOPOLOGY_QUERY_PARAM_PREFIX}proxy_strategy`
367
+ ),
368
+ ...embedParentOrigin ? { embedParentOrigin } : {}
369
+ });
370
+ };
371
+
128
372
  // src/context/air-jam-context.tsx
129
- var import_runtime_topology3 = require("@air-jam/runtime-topology");
130
373
  var import_react = require("react");
131
374
  var import_zustand2 = require("zustand");
132
375
  var import_shallow = require("zustand/react/shallow");
133
376
 
134
- // src/dev/browser-log-sink.ts
135
- var import_runtime_topology = require("@air-jam/runtime-topology");
136
-
137
377
  // src/diagnostics.ts
138
378
  var listeners = /* @__PURE__ */ new Set();
139
379
  var lastEmissionByKey = /* @__PURE__ */ new Map();
@@ -495,9 +735,6 @@ var runtimeUrlSchema = import_zod6.z.string().trim().min(1).refine((value) => pa
495
735
  message: "URL must be a valid http(s) URL without embedded credentials."
496
736
  });
497
737
 
498
- // src/runtime/air-jam-config.ts
499
- var import_runtime_topology2 = require("@air-jam/runtime-topology");
500
-
501
738
  // src/state/connection-store.ts
502
739
  var import_zustand = require("zustand");
503
740
 
@@ -853,6 +1090,7 @@ function HostMuteButton({
853
1090
 
854
1091
  // src/components/join-qr-overlay.tsx
855
1092
  var import_react7 = require("react");
1093
+ var import_react_dom = require("react-dom");
856
1094
 
857
1095
  // src/components/room-qr-code.tsx
858
1096
  var import_qrcode = require("qrcode");
@@ -955,24 +1193,35 @@ var shellLabelClassName = "text-[0.6875rem] font-semibold tracking-[0.22em] text
955
1193
  var shellHelperTextClassName = "text-sm leading-5 text-white/52";
956
1194
  var shellFieldClassName = "h-11 min-w-0 w-full rounded-2xl border border-white/10 bg-black/40 px-3.5 text-sm text-white shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] outline-none placeholder:text-white/35";
957
1195
  var shellUtilityButtonClassName = "rounded-2xl border-white/12 bg-white/[0.045] text-white/88 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] hover:bg-white/[0.085] hover:text-white disabled:border-white/8 disabled:bg-white/[0.03] disabled:text-white/35";
958
- var shellPanelClassName = "rounded-[0.5rem] border border-white/10 bg-zinc-950/82 text-white shadow-[0_22px_70px_rgba(0,0,0,0.42)] backdrop-blur-md";
959
1196
 
960
1197
  // src/components/join-qr-overlay.tsx
961
1198
  var import_jsx_runtime8 = require("react/jsx-runtime");
962
1199
  var JoinQrOverlay = ({
963
1200
  open,
964
1201
  value,
1202
+ status = "ready",
965
1203
  roomId,
966
1204
  onClose,
967
- title = "Scan to join",
1205
+ title = "Scan QR code to join as a controller",
1206
+ roomLabel = "Join room",
968
1207
  description = "Scan with your phone to connect as a controller.",
1208
+ unavailableLabel = "Join URL unavailable right now.",
1209
+ loadingLabel = "Preparing join QR\u2026",
1210
+ qrAlt,
1211
+ showCloseButton = false,
969
1212
  className,
970
1213
  panelClassName,
971
1214
  qrClassName,
972
- size = 440
1215
+ bodyClassName,
1216
+ messageClassName,
1217
+ descriptionClassName,
1218
+ closeButtonClassName,
1219
+ size = 260
973
1220
  }) => {
974
1221
  const joinUrlValue = value?.trim() ?? "";
975
- const hasJoinUrl = joinUrlValue.length > 0;
1222
+ const effectiveStatus = status === "ready" && joinUrlValue.length === 0 ? "unavailable" : status;
1223
+ const overlaySize = `min(72vw, ${size}px)`;
1224
+ const [entered, setEntered] = (0, import_react7.useState)(false);
976
1225
  (0, import_react7.useEffect)(() => {
977
1226
  if (!open || typeof window === "undefined") {
978
1227
  return;
@@ -987,20 +1236,34 @@ var JoinQrOverlay = ({
987
1236
  window.removeEventListener("keydown", handleKeyDown);
988
1237
  };
989
1238
  }, [onClose, open]);
1239
+ (0, import_react7.useEffect)(() => {
1240
+ if (!open || typeof window === "undefined") {
1241
+ setEntered(false);
1242
+ return;
1243
+ }
1244
+ setEntered(false);
1245
+ const frame = window.requestAnimationFrame(() => {
1246
+ setEntered(true);
1247
+ });
1248
+ return () => {
1249
+ window.cancelAnimationFrame(frame);
1250
+ };
1251
+ }, [open]);
990
1252
  if (!open) {
991
1253
  return null;
992
1254
  }
993
1255
  const handlePanelClick = (event) => {
994
1256
  event.stopPropagation();
995
1257
  };
996
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1258
+ const dialog = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
997
1259
  "div",
998
1260
  {
999
1261
  role: "dialog",
1000
1262
  "aria-modal": "true",
1001
1263
  "aria-label": roomId ? `Join room ${roomId}` : title,
1002
1264
  className: cn(
1003
- "absolute inset-0 z-50 flex items-center justify-center bg-black/82 px-6 py-8 backdrop-blur-md",
1265
+ "pointer-events-auto fixed inset-0 z-[120] flex cursor-pointer flex-col items-center justify-center bg-black/85 px-6 backdrop-blur-md transition-opacity duration-200 ease-out",
1266
+ entered ? "opacity-100" : "opacity-0",
1004
1267
  className
1005
1268
  ),
1006
1269
  onClick: onClose,
@@ -1008,17 +1271,34 @@ var JoinQrOverlay = ({
1008
1271
  "div",
1009
1272
  {
1010
1273
  className: cn(
1011
- "flex w-full max-w-xl flex-col items-center gap-6 px-6 py-7 text-center",
1012
- shellPanelClassName,
1274
+ "flex cursor-default flex-col items-center gap-6 text-center transition-transform duration-200 ease-out",
1275
+ entered ? "translate-y-0" : "-translate-y-4",
1013
1276
  panelClassName
1014
1277
  ),
1015
1278
  onClick: handlePanelClick,
1016
1279
  children: [
1017
1280
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-1", children: [
1018
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[0.6875rem] font-semibold tracking-[0.22em] text-white/52 uppercase", children: title }),
1019
- roomId ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-3xl font-semibold tracking-[0.12em] text-white uppercase tabular-nums", children: roomId }) : null
1281
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-[11px] tracking-[0.18em] text-slate-400 uppercase", children: roomLabel }),
1282
+ roomId ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-2xl font-semibold tracking-tight text-white tabular-nums", children: roomId }) : null
1020
1283
  ] }),
1021
- hasJoinUrl ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1284
+ effectiveStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1285
+ "div",
1286
+ {
1287
+ className: cn(
1288
+ "flex flex-col items-center justify-center gap-3 rounded-lg border border-white/25 bg-white/6 px-5 py-10 text-sm text-white/70 shadow-sm",
1289
+ bodyClassName
1290
+ ),
1291
+ style: {
1292
+ width: overlaySize,
1293
+ height: "auto",
1294
+ aspectRatio: "1 / 1"
1295
+ },
1296
+ children: [
1297
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "h-8 w-8 animate-spin rounded-full border-2 border-white/15 border-t-white/85" }),
1298
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: loadingLabel })
1299
+ ]
1300
+ }
1301
+ ) : effectiveStatus === "ready" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1022
1302
  RoomQrCode,
1023
1303
  {
1024
1304
  value: joinUrlValue,
@@ -1026,31 +1306,65 @@ var JoinQrOverlay = ({
1026
1306
  padding: 2,
1027
1307
  foregroundColor: "#111827",
1028
1308
  backgroundColor: "#ffffff",
1029
- className: cn("rounded-xl bg-white shadow-sm", qrClassName),
1309
+ className: cn(
1310
+ "rounded-lg border border-white/25 bg-white/6 shadow-sm",
1311
+ qrClassName
1312
+ ),
1313
+ style: {
1314
+ width: overlaySize,
1315
+ height: "auto",
1316
+ aspectRatio: "1 / 1"
1317
+ },
1318
+ alt: qrAlt ?? (roomId ? `QR code to join room ${roomId}` : "QR code to join as a controller")
1319
+ }
1320
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1321
+ "div",
1322
+ {
1323
+ className: cn(
1324
+ "flex items-center justify-center rounded-lg border border-white/25 bg-white/6 px-5 py-10 text-sm text-white/70 shadow-sm",
1325
+ messageClassName
1326
+ ),
1030
1327
  style: {
1031
- width: "min(72vw, 26rem)",
1328
+ width: overlaySize,
1032
1329
  height: "auto",
1033
1330
  aspectRatio: "1 / 1"
1034
1331
  },
1035
- alt: roomId ? `QR code to join room ${roomId}` : "QR code to join as a controller"
1332
+ children: unavailableLabel
1036
1333
  }
1037
- ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex w-full max-w-[26rem] items-center justify-center rounded-xl border border-white/12 bg-white/6 px-5 py-10 text-sm leading-6 text-white/68", children: "Join URL unavailable right now." }),
1038
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "max-w-md text-sm leading-6 text-white/68", children: description }),
1334
+ ),
1039
1335
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1336
+ "p",
1337
+ {
1338
+ className: cn(
1339
+ "max-w-xs text-center text-sm text-slate-400",
1340
+ descriptionClassName
1341
+ ),
1342
+ children: description
1343
+ }
1344
+ ),
1345
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1040
1346
  Button,
1041
1347
  {
1042
1348
  type: "button",
1043
1349
  variant: "outline",
1044
1350
  onClick: onClose,
1045
- className: cn("rounded-2xl px-5", shellUtilityButtonClassName),
1351
+ className: cn(
1352
+ "rounded-2xl px-5",
1353
+ shellUtilityButtonClassName,
1354
+ closeButtonClassName
1355
+ ),
1046
1356
  children: "Close"
1047
1357
  }
1048
- )
1358
+ ) : null
1049
1359
  ]
1050
1360
  }
1051
1361
  )
1052
1362
  }
1053
1363
  );
1364
+ if (typeof document === "undefined") {
1365
+ return dialog;
1366
+ }
1367
+ return (0, import_react_dom.createPortal)(dialog, document.body);
1054
1368
  };
1055
1369
 
1056
1370
  // src/components/join-url-action-buttons.tsx
@@ -1844,9 +2158,6 @@ var createControllerPresentationSyncMessage = (payload) => ({
1844
2158
  payload
1845
2159
  });
1846
2160
 
1847
- // src/runtime/runtime-session-params.ts
1848
- var import_runtime_topology4 = require("@air-jam/runtime-topology");
1849
-
1850
2161
  // src/runtime/arcade-runtime-url.ts
1851
2162
  var parseOptionalArcadeSurfaceFromSearchParams = (params) => {
1852
2163
  const epochStr = params.get("aj_arcade_epoch");
@@ -1887,7 +2198,7 @@ var resolveLegacyEmbeddedTopology = ({
1887
2198
  const embedParentOrigin = joinUrlOrigin ?? referrerOrigin ?? appOrigin;
1888
2199
  const publicHost = joinUrlOrigin ?? appOrigin;
1889
2200
  const secureTransport = appOrigin.startsWith("https://") && publicHost.startsWith("https://") && embedParentOrigin.startsWith("https://");
1890
- return (0, import_runtime_topology4.resolveRuntimeTopology)({
2201
+ return resolveRuntimeTopology({
1891
2202
  runtimeMode: "arcade-live",
1892
2203
  surfaceRole,
1893
2204
  appOrigin,
@@ -1911,7 +2222,7 @@ var readEmbeddedControllerRuntimeParams = () => {
1911
2222
  if (!room || !controllerId) {
1912
2223
  return null;
1913
2224
  }
1914
- const topology = (0, import_runtime_topology4.parseRuntimeTopologyFromSearchParams)(params) ?? resolveLegacyEmbeddedTopology({
2225
+ const topology = parseRuntimeTopologyFromSearchParams(params) ?? resolveLegacyEmbeddedTopology({
1915
2226
  surfaceRole: "controller"
1916
2227
  });
1917
2228
  if (!topology) {