@thestatic-tv/dcl-sdk 2.10.0 → 2.11.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/dist/index.mjs CHANGED
@@ -214,6 +214,7 @@ import { getSceneInformation } from "~system/Runtime";
214
214
  var PARCEL_SIZE = 16;
215
215
  var EDGE_STRIP = 1;
216
216
  var WALL_TOP_MAX = 32;
217
+ var GROUND_REACH = 3;
217
218
  function heightLimit(parcels) {
218
219
  return Math.log2(parcels + 1) * 20;
219
220
  }
@@ -260,13 +261,25 @@ function wallBoxes(rects, strip = EDGE_STRIP, top = wallTop(rects.length)) {
260
261
  function inParcels(p, rects) {
261
262
  return rects.some((r) => p.x >= r.minX && p.x <= r.maxX && p.z >= r.minZ && p.z <= r.maxZ);
262
263
  }
263
- function insideWalls(p, boxes) {
264
- return boxes.some((b) => p.x >= b.minX && p.x <= b.maxX && p.z >= b.minZ && p.z <= b.maxZ && p.y < b.top);
264
+ function spawnPointOf(metadata) {
265
+ const points = metadata?.spawnPoints;
266
+ if (!Array.isArray(points) || points.length === 0) return null;
267
+ const chosen = points.find((s) => s && s.default === true) || points[0];
268
+ const position = chosen?.position;
269
+ const coordinate = (v) => {
270
+ const values = (Array.isArray(v) ? v : [v]).filter((n) => typeof n === "number" && Number.isFinite(n));
271
+ return values.length === 0 ? null : (Math.min(...values) + Math.max(...values)) / 2;
272
+ };
273
+ const x = coordinate(position?.x);
274
+ const y = coordinate(position?.y);
275
+ const z = coordinate(position?.z);
276
+ return x === null || y === null || z === null ? null : { x, y, z };
265
277
  }
266
278
  var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
267
- function ejectPoint(boxes, rects, from) {
279
+ function entryPoint(boxes, rects, spawn, from) {
268
280
  const IN = 0.5;
269
- const p = from || { x: 0, y: 0, z: 0 };
281
+ const target = spawn || from || { x: 0, y: 0, z: 0 };
282
+ const y = spawn ? Math.max(0, spawn.y) : 0;
270
283
  let best = null;
271
284
  let bestDistance = Infinity;
272
285
  rects.forEach((rect, i) => {
@@ -274,20 +287,26 @@ function ejectPoint(boxes, rects, from) {
274
287
  if (!b) return;
275
288
  const along = (lo, hi, v) => clamp(v, lo + IN, hi - IN);
276
289
  for (const side of outerSides(rect, rects)) {
277
- const point = side === "west" ? { x: b.minX + IN, z: along(b.minZ, b.maxZ, p.z) } : side === "east" ? { x: b.maxX - IN, z: along(b.minZ, b.maxZ, p.z) } : side === "south" ? { x: along(b.minX, b.maxX, p.x), z: b.minZ + IN } : { x: along(b.minX, b.maxX, p.x), z: b.maxZ - IN };
278
- const distance = Math.hypot(point.x - p.x, point.z - p.z);
290
+ const point = side === "west" ? { x: (rect.minX + b.minX) / 2, z: along(b.minZ, b.maxZ, target.z) } : side === "east" ? { x: (rect.maxX + b.maxX) / 2, z: along(b.minZ, b.maxZ, target.z) } : side === "south" ? { x: along(b.minX, b.maxX, target.x), z: (rect.minZ + b.minZ) / 2 } : { x: along(b.minX, b.maxX, target.x), z: (rect.maxZ + b.maxZ) / 2 };
291
+ const distance = Math.hypot(point.x - target.x, point.z - target.z);
279
292
  if (distance < bestDistance) {
280
293
  bestDistance = distance;
281
- best = { x: point.x, y: b.top + 1, z: point.z };
294
+ best = { x: point.x, y, z: point.z };
282
295
  }
283
296
  }
284
297
  });
285
298
  return best;
286
299
  }
300
+ function mustMoveToEntry(p, boxes, rects, entryY) {
301
+ if (!inParcels(p, rects)) return false;
302
+ const overWall = boxes.some((b) => p.x >= b.minX && p.x <= b.maxX && p.z >= b.minZ && p.z <= b.maxZ);
303
+ return overWall || p.y > entryY + GROUND_REACH;
304
+ }
287
305
 
288
306
  // src/utils/bounds.ts
289
307
  var cachedBounds = null;
290
308
  var cachedParcelRects = [];
309
+ var cachedSpawn = null;
291
310
  var boundsInitialized = false;
292
311
  var boundsError = false;
293
312
  function parseParcel(parcel) {
@@ -313,6 +332,7 @@ async function getSceneBounds() {
313
332
  const metadata = JSON.parse(sceneInfo.metadataJson);
314
333
  parcels = metadata?.scene?.parcels || [];
315
334
  baseParcel = metadata?.scene?.base;
335
+ cachedSpawn = spawnPointOf(metadata);
316
336
  }
317
337
  if (parcels.length === 0) {
318
338
  boundsError = true;
@@ -367,6 +387,9 @@ function isPlayerInBounds(_bounds) {
367
387
  function getParcelRects() {
368
388
  return cachedParcelRects.map((r) => ({ ...r }));
369
389
  }
390
+ function getSpawnPoint() {
391
+ return cachedSpawn ? { ...cachedSpawn } : null;
392
+ }
370
393
  function getPlayerPosition() {
371
394
  try {
372
395
  const transform = Transform.getOrNull(engine2.PlayerEntity);
@@ -1038,6 +1061,216 @@ var FramesModule = class {
1038
1061
  }
1039
1062
  };
1040
1063
 
1064
+ // src/modules/stream-link.ts
1065
+ var LOCKED_LINE = "LOCKED: TheStatic.tv citizens";
1066
+ var UNAVAILABLE_LINE = "Stream link unavailable";
1067
+ var REASK_BEFORE_MS = 10 * 60 * 1e3;
1068
+ var REASK_CHECK_MS = 15 * 1e3;
1069
+ var REASK_RETRY_MS = 60 * 1e3;
1070
+ var CHANNEL_MAX = 100;
1071
+ function channelOf(value) {
1072
+ return typeof value === "string" && value !== "" && value.length <= CHANNEL_MAX ? value : null;
1073
+ }
1074
+ var StreamLinkModule = class {
1075
+ constructor(deps) {
1076
+ this.inFlight = /* @__PURE__ */ new Map();
1077
+ this.current = null;
1078
+ this.gen = 0;
1079
+ this.timerId = null;
1080
+ this.deps = deps;
1081
+ }
1082
+ now() {
1083
+ return this.deps.now ? this.deps.now() : Date.now();
1084
+ }
1085
+ log(msg, ...args) {
1086
+ this.deps.log?.(msg, ...args);
1087
+ }
1088
+ /** The channel of the locked play going on, or null */
1089
+ get playing() {
1090
+ return this.current ? this.current.channel : null;
1091
+ }
1092
+ /**
1093
+ * Ask the door for a channel's link, signed as the visitor. One request in flight per channel: an ask while one is
1094
+ * out gets the same answer. A blocked visitor gets 'blocked' and nothing is sent.
1095
+ */
1096
+ ask(channel) {
1097
+ if (this.deps.blocked()) return Promise.resolve({ ok: false, reason: "blocked" });
1098
+ const pending = this.inFlight.get(channel);
1099
+ if (pending) return pending;
1100
+ const request2 = this.request(channel).finally(() => {
1101
+ this.inFlight.delete(channel);
1102
+ });
1103
+ this.inFlight.set(channel, request2);
1104
+ return request2;
1105
+ }
1106
+ async request(channel) {
1107
+ const url = this.deps.doorUrl();
1108
+ if (!url) {
1109
+ this.log("Stream link: no scene id - cannot ask");
1110
+ return { ok: false, reason: "unavailable" };
1111
+ }
1112
+ try {
1113
+ const res = await this.deps.post(url, JSON.stringify({ channel }));
1114
+ let data = {};
1115
+ try {
1116
+ data = await res.json();
1117
+ } catch {
1118
+ }
1119
+ if (res.ok) {
1120
+ const link = data && typeof data.url === "string" ? data.url : "";
1121
+ const expiresAt = data && typeof data.expiresAt === "number" && Number.isFinite(data.expiresAt) ? data.expiresAt : null;
1122
+ if (!link.startsWith("https://")) {
1123
+ this.log("Stream link: an answer with no https url", res.status);
1124
+ return { ok: false, reason: "unavailable", status: res.status };
1125
+ }
1126
+ return { ok: true, url: link, expiresAt };
1127
+ }
1128
+ if (res.status === 403) {
1129
+ return { ok: false, reason: data?.reason === "guest" ? "guest" : "not-admitted", status: 403 };
1130
+ }
1131
+ this.log("Stream link: the door answered", res.status, data?.error);
1132
+ return { ok: false, reason: "unavailable", status: res.status };
1133
+ } catch (err) {
1134
+ this.log("Stream link: request failed", err);
1135
+ return { ok: false, reason: "unavailable" };
1136
+ }
1137
+ }
1138
+ /**
1139
+ * Play a locked channel: ask for its link and hand it to deliver, then keep it fresh while this play goes on. Ends
1140
+ * any locked play before it. A blocked visitor asks nothing; an invalid channel plays nothing.
1141
+ */
1142
+ play(channel, handlers) {
1143
+ this.cancel();
1144
+ const slug = channelOf(channel);
1145
+ if (!slug) {
1146
+ this.log("Stream link: a locked play names no channel - nothing plays");
1147
+ return;
1148
+ }
1149
+ if (this.deps.blocked()) return;
1150
+ const gen = ++this.gen;
1151
+ this.current = { gen, channel: slug, handlers, url: null, nextAskAt: null, lastAskAt: this.now(), asking: true };
1152
+ this.ask(slug).then((answer) => this.first(gen, answer)).catch(() => {
1153
+ });
1154
+ }
1155
+ /** The first answer for play gen: the link plays, or the notice says why not */
1156
+ first(gen, answer) {
1157
+ const play = this.current;
1158
+ if (!play || play.gen !== gen) return;
1159
+ play.asking = false;
1160
+ if (answer.ok && !this.deps.blocked()) {
1161
+ this.deliver(play, answer.url, answer.expiresAt);
1162
+ return;
1163
+ }
1164
+ this.end();
1165
+ if (!answer.ok && answer.reason !== "blocked") this.fail(play, answer.reason);
1166
+ }
1167
+ /** A re-ask's answer: a new link plays in place of the old; a refusal stops the play; a failure tries again later */
1168
+ again(gen, answer) {
1169
+ const play = this.current;
1170
+ if (!play || play.gen !== gen) return;
1171
+ play.asking = false;
1172
+ if (this.deps.blocked()) {
1173
+ this.cancel();
1174
+ return;
1175
+ }
1176
+ if (answer.ok) {
1177
+ this.deliver(play, answer.url, answer.expiresAt);
1178
+ return;
1179
+ }
1180
+ if (answer.reason === "guest" || answer.reason === "not-admitted") {
1181
+ this.log("Stream link: the re-ask was refused - stopping", play.channel);
1182
+ this.end();
1183
+ this.fail(play, answer.reason);
1184
+ try {
1185
+ play.handlers.stop?.();
1186
+ } catch (err) {
1187
+ this.log("Stream link: stop failed", err);
1188
+ }
1189
+ return;
1190
+ }
1191
+ play.nextAskAt = this.now() + REASK_RETRY_MS;
1192
+ }
1193
+ deliver(play, url, expiresAt) {
1194
+ const switched = url !== play.url;
1195
+ play.url = url;
1196
+ if (expiresAt === null) {
1197
+ play.nextAskAt = null;
1198
+ this.stopTimer();
1199
+ } else {
1200
+ play.nextAskAt = Math.max(play.lastAskAt + REASK_RETRY_MS, expiresAt * 1e3 - REASK_BEFORE_MS);
1201
+ this.startTimer();
1202
+ }
1203
+ if (!switched) return;
1204
+ try {
1205
+ play.handlers.deliver(url);
1206
+ } catch (err) {
1207
+ this.log("Stream link: deliver failed", err);
1208
+ }
1209
+ }
1210
+ fail(play, reason) {
1211
+ const line = reason === "guest" || reason === "not-admitted" ? LOCKED_LINE : UNAVAILABLE_LINE;
1212
+ this.deps.notify(line);
1213
+ try {
1214
+ play.handlers.failed?.(line);
1215
+ } catch (err) {
1216
+ this.log("Stream link: failed handler threw", err);
1217
+ }
1218
+ }
1219
+ /** Something played: a url other than this play's own link ends the locked play (the play changed) */
1220
+ playChanged(url) {
1221
+ if (this.current && url !== this.current.url) this.cancel();
1222
+ }
1223
+ /** Ends the locked play, if any: no re-ask, and an answer still on its way is dropped */
1224
+ cancel() {
1225
+ if (!this.current) return;
1226
+ this.log("Stream link: locked play ended", this.current.channel);
1227
+ this.end();
1228
+ }
1229
+ end() {
1230
+ this.current = null;
1231
+ this.stopTimer();
1232
+ }
1233
+ startTimer() {
1234
+ if (this.timerId !== null) return;
1235
+ this.timerId = this.deps.setInterval(() => this.tick(), REASK_CHECK_MS);
1236
+ }
1237
+ stopTimer() {
1238
+ if (this.timerId === null) return;
1239
+ this.deps.clearInterval(this.timerId);
1240
+ this.timerId = null;
1241
+ }
1242
+ /** Every REASK_CHECK_MS while a locked play has a link that expires: a blocked visitor's play ends; a due re-ask goes out */
1243
+ tick() {
1244
+ const play = this.current;
1245
+ if (!play) {
1246
+ this.stopTimer();
1247
+ return;
1248
+ }
1249
+ if (this.deps.blocked()) {
1250
+ this.cancel();
1251
+ return;
1252
+ }
1253
+ if (play.asking || play.nextAskAt === null || this.now() < play.nextAskAt) return;
1254
+ play.asking = true;
1255
+ play.lastAskAt = this.now();
1256
+ this.log("Stream link: asking again before the link expires", play.channel);
1257
+ const gen = play.gen;
1258
+ this.ask(play.channel).then((answer) => this.again(gen, answer)).catch(() => {
1259
+ });
1260
+ }
1261
+ };
1262
+
1263
+ // src/utils/signed-request.ts
1264
+ import { signedFetch as signedFetch2 } from "~system/SignedFetch";
1265
+ async function signedRequest(url, init = {}) {
1266
+ const res = await signedFetch2({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
1267
+ return {
1268
+ ok: res.ok,
1269
+ status: res.status,
1270
+ json: async () => res.body ? JSON.parse(res.body) : {}
1271
+ };
1272
+ }
1273
+
1041
1274
  // src/ui/guide-ui.tsx
1042
1275
  import ReactEcs2, { UiEntity as UiEntity2, Input as Input2, Label as Label2 } from "@dcl/sdk/react-ecs";
1043
1276
  import { Color4 as Color43 } from "@dcl/sdk/math";
@@ -1283,6 +1516,10 @@ function truncateText(text, maxLength) {
1283
1516
  }
1284
1517
 
1285
1518
  // src/ui/guide-ui.tsx
1519
+ function withLock(mapped, v, fallback) {
1520
+ if (v.locked !== true) return mapped;
1521
+ return { ...mapped, src: "", locked: true, channel: v.slug || v.channelId || fallback };
1522
+ }
1286
1523
  var GuideUIModule = class {
1287
1524
  constructor(client, config = {}) {
1288
1525
  // Visibility state
@@ -1447,7 +1684,7 @@ var GuideUIModule = class {
1447
1684
  for (const [slug, video] of Object.entries(data.videoMap)) {
1448
1685
  const v = video;
1449
1686
  const src = v.src || v.liveStreamUrl || "";
1450
- const mapped = {
1687
+ const mapped = withLock({
1451
1688
  id: v.id || slug,
1452
1689
  name: v.name || v.title || "Unknown",
1453
1690
  src,
@@ -1460,7 +1697,7 @@ var GuideUIModule = class {
1460
1697
  requiresAuth: v.requiresAuth,
1461
1698
  // An 18+ channel or one of its VODs (thestatic.tv's flag since 2026-10-15): it stays listed and asks first
1462
1699
  isNsfw: v.isNsfw === true
1463
- };
1700
+ }, v, slug);
1464
1701
  videos.push(mapped);
1465
1702
  if (mapped.isLive) {
1466
1703
  liveVideos.push(mapped);
@@ -1473,7 +1710,7 @@ var GuideUIModule = class {
1473
1710
  if (pl.name === "NODES") continue;
1474
1711
  playlists.push({
1475
1712
  name: pl.name,
1476
- videos: (pl.videos || []).map((v) => ({
1713
+ videos: (pl.videos || []).map((v) => withLock({
1477
1714
  id: v.id,
1478
1715
  name: v.name || v.title || "Unknown",
1479
1716
  src: v.src || v.liveStreamUrl || "",
@@ -1483,7 +1720,7 @@ var GuideUIModule = class {
1483
1720
  duration: v.duration,
1484
1721
  requiresAuth: v.requiresAuth,
1485
1722
  isNsfw: v.isNsfw === true
1486
- }))
1723
+ }, v, v.id))
1487
1724
  });
1488
1725
  }
1489
1726
  }
@@ -1908,6 +2145,14 @@ var GuideUIModule = class {
1908
2145
  ReactEcs2.createElement(Label2, { value: "LIVE", fontSize: this.s(10), color: THEME.colors.white })
1909
2146
  ]
1910
2147
  })
2148
+ ] : [],
2149
+ // A locked channel (2026-11-20): its badge, the words a refused pick shows - one line, 12px in the 260px card
2150
+ ...video.locked === true ? [
2151
+ ReactEcs2.createElement(UiEntity2, {
2152
+ key: "locked",
2153
+ uiTransform: { height: this.s(16), marginTop: 4 },
2154
+ uiText: { value: LOCKED_LINE, fontSize: this.s(12), color: THEME.colors.yellow }
2155
+ })
1911
2156
  ] : []
1912
2157
  ]
1913
2158
  }),
@@ -2074,7 +2319,7 @@ var GuideUIModule = class {
2074
2319
  // src/ui/chat-ui.tsx
2075
2320
  import ReactEcs3, { UiEntity as UiEntity3, Label as Label3, Input as Input3, Button as Button2 } from "@dcl/sdk/react-ecs";
2076
2321
  import { Color4 as Color44 } from "@dcl/sdk/math";
2077
- import { signedFetch as signedFetch2 } from "~system/SignedFetch";
2322
+ import { signedFetch as signedFetch3 } from "~system/SignedFetch";
2078
2323
  import { getPlayer } from "@dcl/sdk/players";
2079
2324
  import { openExternalUrl as openExternalUrl3 } from "~system/RestrictedActions";
2080
2325
  var POLL_INTERVAL_ACTIVE = 5e3;
@@ -2261,7 +2506,7 @@ var ChatUIModule = class {
2261
2506
  this.isSigningIn = true;
2262
2507
  try {
2263
2508
  const baseUrl = this.getBaseUrl();
2264
- const response = await signedFetch2({
2509
+ const response = await signedFetch3({
2265
2510
  url: `${baseUrl}/api/auth/dcl`,
2266
2511
  init: {
2267
2512
  method: "POST",
@@ -2363,7 +2608,7 @@ var ChatUIModule = class {
2363
2608
  this.inputText = "";
2364
2609
  try {
2365
2610
  const baseUrl = this.getBaseUrl();
2366
- const response = await signedFetch2({
2611
+ const response = await signedFetch3({
2367
2612
  url: `${baseUrl}/api/chat/send`,
2368
2613
  init: {
2369
2614
  method: "POST",
@@ -2913,7 +3158,6 @@ import ReactEcs6, { UiEntity as UiEntity6, Button as Button4, Label as Label6, I
2913
3158
  import { Color4 as Color46 } from "@dcl/sdk/math";
2914
3159
  import { getPlayer as getPlayer2 } from "@dcl/sdk/players";
2915
3160
  import { openExternalUrl as openExternalUrl5 } from "~system/RestrictedActions";
2916
- import { signedFetch as signedFetch3 } from "~system/SignedFetch";
2917
3161
 
2918
3162
  // src/ui/ui-renderer.tsx
2919
3163
  import ReactEcs4, { ReactEcsRenderer, UiEntity as UiEntity4, Label as Label4 } from "@dcl/sdk/react-ecs";
@@ -3228,6 +3472,7 @@ var ModerationModule = class {
3228
3472
  this.readWaiters = [];
3229
3473
  this.rects = [];
3230
3474
  this.boxes = [];
3475
+ this.spawn = null;
3231
3476
  this.wallEntities = [];
3232
3477
  this.lastBlocked = false;
3233
3478
  this.lastStanding = "clear";
@@ -3237,7 +3482,7 @@ var ModerationModule = class {
3237
3482
  this.wasInScene = null;
3238
3483
  this.sinceCheck = 0;
3239
3484
  this.started = false;
3240
- /** Every CHECK_EVERY_S: a lapsed kick, the re-reads, and a blocked visitor inside a wall moved above it */
3485
+ /** Every CHECK_EVERY_S: a lapsed kick, the re-reads, and a blocked visitor out of place moved to the front entry */
3241
3486
  this.system = (dt) => {
3242
3487
  if (this.hintDueAt !== null && this.now() >= this.hintDueAt) {
3243
3488
  this.hintDueAt = null;
@@ -3265,10 +3510,10 @@ var ModerationModule = class {
3265
3510
  if (inScene && now - this.lastReadAt >= REREAD_MS) this.readPending = true;
3266
3511
  this.wasInScene = inScene;
3267
3512
  this.tryRead();
3268
- if (me && this.blocked && insideWalls(me, this.boxes)) {
3269
- const to = ejectPoint(this.boxes, this.rects, me);
3270
- if (to) {
3271
- this.log("Blocked and inside the walls - moving above them", to);
3513
+ if (me && this.blocked) {
3514
+ const to = entryPoint(this.boxes, this.rects, this.spawn, me);
3515
+ if (to && mustMoveToEntry(me, this.boxes, this.rects, to.y)) {
3516
+ this.log("Blocked and inside the scene - moving to the front entry", to);
3272
3517
  Promise.resolve(movePlayerTo({ newRelativePosition: Vector3.create(to.x, to.y, to.z) })).catch(() => {
3273
3518
  });
3274
3519
  }
@@ -3291,6 +3536,7 @@ var ModerationModule = class {
3291
3536
  await getSceneBounds();
3292
3537
  this.rects = getParcelRects();
3293
3538
  this.boxes = wallBoxes(this.rects);
3539
+ this.spawn = getSpawnPoint();
3294
3540
  } catch {
3295
3541
  }
3296
3542
  this.sync();
@@ -3430,6 +3676,7 @@ var ModerationModule = class {
3430
3676
  };
3431
3677
 
3432
3678
  // src/ui/admin-panel-ui.tsx
3679
+ var VIDEO_PLAY_TYPES = /* @__PURE__ */ new Set(["videoPlay", "videoSetUrl", "videoPlaySlot"]);
3433
3680
  var FIGURE_NAMES = ["recordings", "vaulted", "slugKeyedLeft", "pendingReports"];
3434
3681
  function figuresOf(value) {
3435
3682
  const figures = value?.figures;
@@ -3529,6 +3776,11 @@ var AdminPanelUIModule = class {
3529
3776
  this.broadcastStatus = "";
3530
3777
  /** The url the screen last played - the scene's current one from the video state at load, or the last play here - which PLAYBACK Play sends */
3531
3778
  this.currentVideoUrl = null;
3779
+ /**
3780
+ * The locked channel the screen last played (2026-11-20), in place of a url: PLAYBACK Play queues it again as
3781
+ * `{ channel, locked: true }` - a locked channel's link is this visitor's own and never goes into the queue
3782
+ */
3783
+ this.currentLockedChannel = null;
3532
3784
  // Scene controls (2026-11-18): the scene's own declaration, each control's current option on this copy, the tab's
3533
3785
  // status line, and the once-a-load gates for the declaration's upload and the saved state's read
3534
3786
  this.controls = [];
@@ -3656,9 +3908,9 @@ var AdminPanelUIModule = class {
3656
3908
  )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column", margin: { bottom: 10 } } }, /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "HLS Playback:", fontSize: t.labelSmall, color: C2.textDim }), /* @__PURE__ */ ReactEcs6.createElement(
3657
3909
  Label6,
3658
3910
  {
3659
- value: this.streamData.hlsUrl || "Not available",
3911
+ value: this.streamData.locked === true ? LOCKED_LINE : this.streamData.hlsUrl || "Not available",
3660
3912
  fontSize: t.label,
3661
- color: this.streamData.hlsUrl ? C2.green : C2.textDim,
3913
+ color: this.streamData.locked === true ? C2.yellow : this.streamData.hlsUrl ? C2.green : C2.textDim,
3662
3914
  uiTransform: { margin: { left: 6 } }
3663
3915
  }
3664
3916
  )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, !this.streamData.isLive && /* @__PURE__ */ ReactEcs6.createElement(
@@ -3681,7 +3933,7 @@ var AdminPanelUIModule = class {
3681
3933
  color: C2.text,
3682
3934
  onMouseDown: () => this.stopStream()
3683
3935
  }
3684
- ), this.streamData.isLive && this.streamData.hlsUrl && /* @__PURE__ */ ReactEcs6.createElement(
3936
+ ), this.streamData.isLive && (this.streamData.hlsUrl || this.streamData.locked === true) && /* @__PURE__ */ ReactEcs6.createElement(
3685
3937
  Button4,
3686
3938
  {
3687
3939
  uiTransform: { width: this.s(100), height: this.s(UI_DIMENSIONS.admin.buttonHeightSmall), margin: 4 },
@@ -3689,7 +3941,7 @@ var AdminPanelUIModule = class {
3689
3941
  value: "Play on Screen",
3690
3942
  fontSize: t.buttonSmall,
3691
3943
  color: C2.text,
3692
- onMouseDown: () => this.playStreamOnScreen(this.streamData.hlsUrl)
3944
+ onMouseDown: () => this.playStreamOnScreen()
3693
3945
  }
3694
3946
  )), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 6 } } }, /* @__PURE__ */ ReactEcs6.createElement(
3695
3947
  Button4,
@@ -3782,7 +4034,7 @@ var AdminPanelUIModule = class {
3782
4034
  {
3783
4035
  value: this.videoStatus,
3784
4036
  fontSize: t.status,
3785
- color: this.videoStatus.startsWith("Not sent") ? C2.red : C2.green,
4037
+ color: this.videoStatus.startsWith("Not sent") || this.videoStatus === LOCKED_LINE || this.videoStatus === UNAVAILABLE_LINE ? C2.red : C2.green,
3786
4038
  uiTransform: { height: this.s(18), margin: { bottom: 6 } }
3787
4039
  }
3788
4040
  ), /* @__PURE__ */ ReactEcs6.createElement(this.SectionHead, { label: "PLAYBACK", color: C2.green }), /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "row", flexWrap: "wrap", margin: { bottom: 14 } } }, /* @__PURE__ */ ReactEcs6.createElement(
@@ -4325,8 +4577,37 @@ var AdminPanelUIModule = class {
4325
4577
  playUrl(url) {
4326
4578
  if (this.moderation.blocked) return;
4327
4579
  this.currentVideoUrl = url;
4580
+ this.currentLockedChannel = null;
4328
4581
  this.config.onVideoPlay?.(url);
4329
4582
  }
4583
+ /**
4584
+ * A locked channel's play (thestatic.tv's stream lock, 2026-11-20): a queued video command carrying
4585
+ * `{ channel, locked: true }`, the owner's Play on Screen for a locked stream, a locked slot. This copy asks
4586
+ * thestatic.tv's door for the link, signed as this visitor (the client's stream link: one request in flight per
4587
+ * channel, the re-ask before it expires), and plays it through onVideoPlay only when admitted. A refusal plays
4588
+ * nothing; the notice and this tab's video line say LOCKED: TheStatic.tv citizens. A blocked visitor asks nothing.
4589
+ * The link itself is never kept for PLAYBACK Play or sent to the queue - the channel is.
4590
+ */
4591
+ playLocked(channel) {
4592
+ if (this.moderation.blocked) return;
4593
+ const slug = channelOf(channel);
4594
+ if (!slug) {
4595
+ this.log("A locked play names no channel - nothing plays");
4596
+ return;
4597
+ }
4598
+ this.currentLockedChannel = slug;
4599
+ this.currentVideoUrl = null;
4600
+ this.client._playLockedChannel?.(slug, {
4601
+ deliver: (url) => {
4602
+ if (this.moderation.blocked) return;
4603
+ this.config.onVideoPlay?.(url);
4604
+ },
4605
+ stop: () => this.config.onVideoStop?.(),
4606
+ failed: (line) => {
4607
+ this.videoStatus = line;
4608
+ }
4609
+ });
4610
+ }
4330
4611
  /**
4331
4612
  * Toggle the admin panel open/closed
4332
4613
  */
@@ -4537,15 +4818,12 @@ var AdminPanelUIModule = class {
4537
4818
  * Every gated admin call is a DCL signed fetch (thestatic.tv STATIC-01, 2026-10-07): the
4538
4819
  * explorer signs it with the player's identity, and the server checks the signature and that it
4539
4820
  * came from the scene deployed at this scene's registered location. A wallet named in a query or
4540
- * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites.
4821
+ * body proved nothing and is no longer sent. Returns a fetch-like shape for the call sites. The
4822
+ * request itself lives in utils/signed-request.ts since 2026-11-20 (it was here), so the locked
4823
+ * channel's door - which a Standard scene asks too, with no panel - goes through the same one.
4541
4824
  */
4542
4825
  async signedRequest(url, init = {}) {
4543
- const res = await signedFetch3({ url, init: { method: init.method || "GET", headers: init.headers || {}, body: init.body } });
4544
- return {
4545
- ok: res.ok,
4546
- status: res.status,
4547
- json: async () => res.body ? JSON.parse(res.body) : {}
4548
- };
4826
+ return signedRequest(url, init);
4549
4827
  }
4550
4828
  /**
4551
4829
  * Every visitor's copy reads the scene's queue (a public GET, every 5 s). Since 2026-11-18 the poll sends the server's
@@ -4598,12 +4876,18 @@ var AdminPanelUIModule = class {
4598
4876
  } else if (cmd.type === "privateMode" && this.venue) {
4599
4877
  this.log("Received privateMode - re-reading my standing");
4600
4878
  this.moderation.handleCommand(cmd.type, cmd.payload);
4879
+ } else if (VIDEO_PLAY_TYPES.has(cmd.type) && cmd.payload?.locked === true) {
4880
+ this.log("Received locked play:", cmd.type, cmd.payload.channel);
4881
+ this.playLocked(cmd.payload.channel);
4601
4882
  } else if ((cmd.type === "videoPlay" || cmd.type === "videoSetUrl") && cmd.payload?.url) {
4602
4883
  this.log("Received video play:", cmd.type, cmd.payload.url);
4603
4884
  this.playUrl(cmd.payload.url);
4604
4885
  } else if (cmd.type === "videoStop" || cmd.type === "videoClear") {
4605
4886
  this.log("Received video stop/clear:", cmd.type);
4606
- if (cmd.type === "videoClear") this.currentVideoUrl = null;
4887
+ if (cmd.type === "videoClear") {
4888
+ this.currentVideoUrl = null;
4889
+ this.currentLockedChannel = null;
4890
+ }
4607
4891
  this.config.onVideoStop?.();
4608
4892
  } else if (cmd.type === "videoPlaySlot" && cmd.payload?.slot) {
4609
4893
  const slotId = cmd.payload.slot;
@@ -4667,6 +4951,11 @@ var AdminPanelUIModule = class {
4667
4951
  videoSlots: data.videoSlots || {}
4668
4952
  };
4669
4953
  if (typeof data.currentVideoUrl === "string" && data.currentVideoUrl !== "") this.currentVideoUrl = data.currentVideoUrl;
4954
+ const lockedCurrent = data.currentVideo?.locked === true ? channelOf(data.currentVideo.channel) : null;
4955
+ if (lockedCurrent) {
4956
+ this.currentLockedChannel = lockedCurrent;
4957
+ this.currentVideoUrl = null;
4958
+ }
4670
4959
  this.videoStateFetched = true;
4671
4960
  this.log("Video state fetched:", this.videoState.defaultSlot || "no default");
4672
4961
  }
@@ -4679,6 +4968,11 @@ var AdminPanelUIModule = class {
4679
4968
  */
4680
4969
  playSlot(slotId) {
4681
4970
  const slot = this.videoState?.videoSlots?.[slotId];
4971
+ if (slot?.locked === true) {
4972
+ this.log("Playing locked slot:", slotId);
4973
+ this.playLocked(slot.slug ?? slot.channel);
4974
+ return;
4975
+ }
4682
4976
  if (slot?.url) {
4683
4977
  this.log("Playing slot:", slotId, slot.url);
4684
4978
  this.playUrl(slot.url);
@@ -4694,7 +4988,10 @@ var AdminPanelUIModule = class {
4694
4988
  if (!this.videoState?.defaultSlot) return;
4695
4989
  const defaultSlot = this.videoState.defaultSlot;
4696
4990
  const slot = this.videoState.videoSlots?.[defaultSlot];
4697
- if (slot?.url) {
4991
+ if (slot?.locked === true) {
4992
+ this.log("Auto-playing locked default slot:", defaultSlot);
4993
+ this.playLocked(slot.slug ?? slot.channel);
4994
+ } else if (slot?.url) {
4698
4995
  this.log("Auto-playing default slot:", defaultSlot);
4699
4996
  this.playUrl(slot.url);
4700
4997
  }
@@ -5174,8 +5471,25 @@ var AdminPanelUIModule = class {
5174
5471
  this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5175
5472
  });
5176
5473
  }
5177
- /** Play on Screen: the scene's own live stream, as PLAY NOW with its HLS url (what the scene's page sends for it) */
5178
- playStreamOnScreen(url) {
5474
+ /**
5475
+ * Play on Screen: the scene's own live stream, as PLAY NOW with its HLS url (what the scene's page sends for it). A
5476
+ * locked stream (2026-11-20: the /stream answer says locked, with its slug and no hlsUrl) plays here through the
5477
+ * link asked for signed as the owner, and queues `videoSetUrl { channel, locked: true }` - never a url, so every
5478
+ * visitor's copy asks for its own link and only the admitted play it.
5479
+ */
5480
+ playStreamOnScreen() {
5481
+ const data = this.streamData;
5482
+ if (!data) return;
5483
+ if (data.locked === true) {
5484
+ const channel = channelOf(data.slug ?? data.channelId);
5485
+ if (!channel) return;
5486
+ this.playLocked(channel);
5487
+ this.sendSceneCommand("videoSetUrl", { channel, locked: true }, this.videoLine).catch(() => {
5488
+ });
5489
+ return;
5490
+ }
5491
+ const url = data.hlsUrl;
5492
+ if (!url) return;
5179
5493
  this.playUrl(url);
5180
5494
  this.sendSceneCommand("videoSetUrl", { url }, this.videoLine).catch(() => {
5181
5495
  });
@@ -5193,6 +5507,13 @@ var AdminPanelUIModule = class {
5193
5507
  */
5194
5508
  playbackPlay() {
5195
5509
  this.config.onCommand?.("videoPlay", { playing: true });
5510
+ const locked = this.currentLockedChannel;
5511
+ if (locked) {
5512
+ this.playLocked(locked);
5513
+ this.sendSceneCommand("videoPlay", { channel: locked, locked: true }, this.videoLine).catch(() => {
5514
+ });
5515
+ return;
5516
+ }
5196
5517
  const url = this.currentVideoUrl;
5197
5518
  if (!url) {
5198
5519
  this.videoStatus = "Not sent: no video";
@@ -5216,6 +5537,7 @@ var AdminPanelUIModule = class {
5216
5537
  resetDefault() {
5217
5538
  this.config.onCommand?.("videoClear", {});
5218
5539
  this.currentVideoUrl = null;
5540
+ this.currentLockedChannel = null;
5219
5541
  this.config.onVideoStop?.();
5220
5542
  this.sendSceneCommand("videoClear", {}, this.videoLine).catch(() => {
5221
5543
  });
@@ -5417,6 +5739,18 @@ var StaticTVClient = class {
5417
5739
  this.apiUrl = config.apiUrl || DEFAULT_BASE_URL;
5418
5740
  this.frames = new FramesModule(this);
5419
5741
  if (config.frames) this.frames.register(config.frames);
5742
+ this.streamLink = new StreamLinkModule({
5743
+ doorUrl: () => {
5744
+ const sceneId = this.getSceneId();
5745
+ return sceneId ? `${this.apiUrl}/scene/${encodeURIComponent(sceneId)}/stream/play` : null;
5746
+ },
5747
+ post: (url, body) => signedRequest(url, { method: "POST", headers: { "Content-Type": "application/json" }, body }),
5748
+ blocked: () => this.isVisitorBlocked,
5749
+ notify: (line) => this.showNotification(line),
5750
+ setInterval: dclSetInterval,
5751
+ clearInterval: dclClearInterval,
5752
+ log: (msg, ...args) => this.log(msg, ...args)
5753
+ });
5420
5754
  if (!config.apiKey) {
5421
5755
  this._disabled = true;
5422
5756
  this._keyType = null;
@@ -5608,6 +5942,7 @@ var StaticTVClient = class {
5608
5942
  */
5609
5943
  playVideo(url) {
5610
5944
  if (this.isVisitorBlocked) return;
5945
+ this.streamLink.playChanged(url);
5611
5946
  const screen = this.config.videoScreen;
5612
5947
  if (screen !== void 0) {
5613
5948
  this.log(`Playing video: ${url}`);
@@ -5632,6 +5967,7 @@ var StaticTVClient = class {
5632
5967
  */
5633
5968
  stopVideo() {
5634
5969
  const screen = this.config.videoScreen;
5970
+ this.streamLink.cancel();
5635
5971
  this._pendingVideoData = null;
5636
5972
  this._streamVerified = false;
5637
5973
  this._clearVerificationTimeout();
@@ -5790,10 +6126,48 @@ var StaticTVClient = class {
5790
6126
  _handleGuideVideoSelect(video) {
5791
6127
  if (!video.src) return;
5792
6128
  if (this.isVisitorBlocked) return;
6129
+ this.streamLink.cancel();
6130
+ this._playGuideEntry(video);
6131
+ }
6132
+ /**
6133
+ * A guide entry with its url, onto the SDK's player and/or onVideoPlay, with the stream verification - an unlocked
6134
+ * pick's, and a locked one's once its link is in hand (2026-11-20; until then this was _handleGuideVideoSelect's body)
6135
+ * @internal
6136
+ */
6137
+ _playGuideEntry(video) {
5793
6138
  this._pendingVideoData = video;
5794
6139
  const isLiveStream = video.channelId !== void 0 || video.src.includes(".m3u8") || video.src.includes("media.thestatic.tv");
5795
6140
  this._playVideoWithVerification(video, isLiveStream);
5796
6141
  }
6142
+ /**
6143
+ * A locked channel's guide entry picked (thestatic.tv's stream lock, 2026-11-20). It carries no url: the SDK asks
6144
+ * thestatic.tv's door for the link, signed as this visitor, and only with a link in hand does the entry go on - to
6145
+ * the SDK's player and onVideoPlay as an unlocked pick does, and to the scene's own guideUI.onVideoSelect - with the
6146
+ * link as its src. Scenes' own handlers play `video.src` (TheStatic.tv HQ's, the templates'), so handing them the
6147
+ * entry before the answer would play an empty src, and on a refusal play what should not play: a refusal hands
6148
+ * nobody anything and shows LOCKED: TheStatic.tv citizens. Each fresh link before the old one expires goes the same
6149
+ * way (the re-ask); a re-ask refused stops the video. A blocked visitor asks nothing.
6150
+ * @internal
6151
+ */
6152
+ _selectLockedGuideEntry(video) {
6153
+ if (this.isVisitorBlocked) return;
6154
+ this.streamLink.play(video.channel, {
6155
+ deliver: (url) => {
6156
+ const entry = { ...video, src: url };
6157
+ if (this.config.videoScreen !== void 0 || this.config.onVideoPlay) this._playGuideEntry(entry);
6158
+ if (this.config.guideUI?.onVideoSelect) this.config.guideUI.onVideoSelect(entry);
6159
+ },
6160
+ stop: () => this.stopVideo()
6161
+ });
6162
+ }
6163
+ /**
6164
+ * A locked channel's play from the Admin Panel - a queued video command carrying `{ channel, locked: true }`, the
6165
+ * owner's Play on Screen, a locked slot (2026-11-20): the same ask and re-ask as a guide pick, the panel's own hands.
6166
+ * @internal
6167
+ */
6168
+ _playLockedChannel(channel, handlers) {
6169
+ this.streamLink.play(channel, handlers);
6170
+ }
5797
6171
  /**
5798
6172
  * Play video with stream verification for live content
5799
6173
  * Works with both videoScreen (SDK-managed) and onVideoPlay (user-managed) modes.
@@ -5916,6 +6290,7 @@ var StaticTVClient = class {
5916
6290
  this.guideUI?.hide();
5917
6291
  this.chatUI?.hide();
5918
6292
  this.heartbeat?.stopWatching();
6293
+ this.streamLink.cancel();
5919
6294
  this._pendingVideoData = null;
5920
6295
  this._clearVerificationTimeout();
5921
6296
  if (screen !== void 0 && VideoPlayer.has(screen)) {
@@ -5957,6 +6332,10 @@ var StaticTVClient = class {
5957
6332
  const guideConfig = {
5958
6333
  ...this.config.guideUI,
5959
6334
  onVideoSelect: (video) => {
6335
+ if (video.locked === true) {
6336
+ this._selectLockedGuideEntry(video);
6337
+ return;
6338
+ }
5960
6339
  if (this.config.videoScreen !== void 0 || this.config.onVideoPlay) {
5961
6340
  this._handleGuideVideoSelect(video);
5962
6341
  }
@@ -6272,6 +6651,7 @@ var StaticTVClient = class {
6272
6651
  this.log("StaticTVClient destroyed (was disabled)");
6273
6652
  return;
6274
6653
  }
6654
+ this.streamLink.cancel();
6275
6655
  if (this.heartbeat) {
6276
6656
  this.heartbeat.stopWatching();
6277
6657
  }