dsh-browser-cdp 1.7.12 → 1.9.7

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/lib/client.js CHANGED
@@ -583,7 +583,7 @@ var watchEn = {
583
583
  refresh: "Refresh",
584
584
  backToLive: "← Back to live",
585
585
  dragHint: "Drag to move panel",
586
- loginTitle: "Log in via the CDP browser bridge window on your desktop",
586
+ loginTitle: "If the page asks you to sign in, log in in the {where} on your desktop.",
587
587
  loginBtn: "Logged in, save",
588
588
  loginSaving: "Saving…",
589
589
  loginSaved: "Saved {n} sessions",
@@ -591,7 +591,14 @@ var watchEn = {
591
591
  loginFailed: "Save failed",
592
592
  loginDismiss: "Dismiss",
593
593
  captchaTitle: "⚠️ CAPTCHA detected",
594
- captchaHint: "Complete verification in the CDP browser bridge window; the agent will continue.",
594
+ captchaHint: "Complete the verification manually in the {where}; the agent will continue after that.",
595
+ whereCdp: "“{label}” browser window",
596
+ whereEgo: "ego browser window",
597
+ whereTabbit: "Tabbit browser window",
598
+ whereLocal: "managed Chrome window",
599
+ whereGeneric: "agent browser window",
600
+ loginHeadless: "The active target is Lightpanda (headless) — there is no window to sign in or verify in. Switch to a headed target (CDP endpoint / local Chrome / ego CLI / Tabbit).",
601
+ loginSelfPersist: "Saved by the browser profile itself.",
595
602
  captchaDismiss: "Dismiss",
596
603
  hintReset: "Reset · scroll to pan · Ctrl+scroll to zoom · double-click to reset",
597
604
  hintPan: "Ctrl+scroll to zoom · Ctrl+drag to pan · double-click to reset",
@@ -646,7 +653,30 @@ var watchEn = {
646
653
  linksLocalEnableHint: "Checked = auto mode may fall back to the managed local browser when the activated target is unreachable",
647
654
  pickCardTitle: "Browser picks",
648
655
  pickCardElements: "{n} element(s) picked",
649
- pickCardRemove: "Remove these picks"
656
+ pickCardRemove: "Remove these picks",
657
+ pickCardSnapshotTag: "(capture-time snapshot)",
658
+ pickCardRecapture: "Recapture",
659
+ pickCardRecaptureHint: "Re-read this tab and overwrite the quoted report (same @ token)",
660
+ pickCardLive: "live",
661
+ trackAllOn: "全模式 · 全部 tab",
662
+ trackAllOff: "仅激活 tab",
663
+ trackAllHintOn: "全模式:space 内每个 tab 都单独报图,外框标出当前激活的那个。点一下回到仅激活。",
664
+ trackAllHintOff: "仅激活:只报激活 tab 的图。点一下切到全模式(track every tab)。",
665
+ pageRefresh: "Reload page",
666
+ pageRefreshHint: "Reload the agent page itself (Page.reload)",
667
+ openUrl: "Open URL",
668
+ openUrlHint: "Navigate the agent page to a URL",
669
+ openUrlPrompt: "URL to open in the agent browser",
670
+ sizeSyncOff: "🔒 Size lock",
671
+ sizeSyncOn: "🔓 Size sync",
672
+ sizeSyncHint: "Unlocked: dragging this panel resizes the REAL agent browser window. Click again to lock.",
673
+ sizePresets: "Presets",
674
+ sizePresetsHint: "Resize the agent browser window to a fixed aspect ratio",
675
+ maximizeWindow: "Maximize",
676
+ maximizeHint: "Maximize the real agent browser window",
677
+ resizeHint: "Drag to resize the real agent browser window",
678
+ sizeApiOutdated: "Size API not ready — restart DSH to load the new host build",
679
+ actionFailed: "Action failed"
650
680
  };
651
681
  var watchDict = {
652
682
  en: watchEn,
@@ -685,7 +715,7 @@ var watchDict = {
685
715
  refresh: "刷新",
686
716
  backToLive: "← 返回实时",
687
717
  dragHint: "拖动移动面板",
688
- loginTitle: "需要账号登录时,请到桌面上那个 「CDP 浏览器代理」 Chrome 窗口完成登录。",
718
+ loginTitle: "需要账号登录时,请到桌面上那个 {where} 完成登录。",
689
719
  loginBtn: "已登录,保存",
690
720
  loginSaving: "保存中…",
691
721
  loginSaved: "已保存 {n} 条会话",
@@ -693,7 +723,14 @@ var watchDict = {
693
723
  loginFailed: "保存失败",
694
724
  loginDismiss: "关闭提示",
695
725
  captchaTitle: "⚠️ 检测到人机验证",
696
- captchaHint: "请在桌面那个 「CDP 浏览器代理」 浏览器窗口手动完成验证,agent 会继续。",
726
+ captchaHint: "请在桌面那个 {where} 手动完成验证,agent 会继续。",
727
+ whereCdp: "「{label}」浏览器窗口",
728
+ whereEgo: "ego 浏览器窗口",
729
+ whereTabbit: "Tabbit 浏览器窗口",
730
+ whereLocal: "本机 Chrome 窗口(受管启动)",
731
+ whereGeneric: "agent 浏览器窗口",
732
+ loginHeadless: "当前激活的是 Lightpanda(无头引擎),没有可登录/验证的窗口;请切换到有头目标(CDP 端点 / 本机 Chrome / ego CLI / Tabbit)。",
733
+ loginSelfPersist: "登录态由该浏览器自身保存",
697
734
  captchaDismiss: "关闭提示",
698
735
  hintReset: "已复位 · 滚轮滚动页面 · Ctrl+滚轮缩放 · 双击复位",
699
736
  hintPan: "Ctrl+滚轮缩放 · Ctrl+拖动平移 · 双击复位",
@@ -748,7 +785,30 @@ var watchDict = {
748
785
  linksLocalEnableHint: "勾选 = 允许 auto 模式在激活目标不可达时回落本机启动",
749
786
  pickCardTitle: "浏览器点选内容",
750
787
  pickCardElements: "已选 {n} 个元素",
751
- pickCardRemove: "移除这段点选"
788
+ pickCardRemove: "移除这段点选",
789
+ pickCardSnapshotTag: "(点击时快照)",
790
+ pickCardRecapture: "重抓快照",
791
+ pickCardRecaptureHint: "重新读取这个 tab 并覆盖引用的报告(@ token 不变)",
792
+ pickCardLive: "实时",
793
+ trackAllOn: "全模式 · 全部 tab",
794
+ trackAllOff: "仅激活 tab",
795
+ trackAllHintOn: "全模式:space 内每个 tab 都单独出图,外框标出当前激活的那个;再点一下回到仅激活。",
796
+ trackAllHintOff: "仅激活:只出激活 tab 的图;点一下切到全模式(所有 tab 都跟踪)。",
797
+ pageRefresh: "刷新页面",
798
+ pageRefreshHint: "重新加载 agent 当前页面(Page.reload)",
799
+ openUrl: "打开网址",
800
+ openUrlHint: "让 agent 页面跳转到指定网址",
801
+ openUrlPrompt: "要在 agent 浏览器里打开的网址",
802
+ sizeSyncOff: "🔒 锁定尺寸",
803
+ sizeSyncOn: "🔓 尺寸同步",
804
+ sizeSyncHint: "解锁后拖动面板会直接改变 agent 浏览器真实窗口大小;再点一下锁定。",
805
+ sizePresets: "尺寸预设",
806
+ sizePresetsHint: "按固定比例设置 agent 浏览器窗口",
807
+ maximizeWindow: "最大化",
808
+ maximizeHint: "最大化真实 agent 浏览器窗口",
809
+ resizeHint: "拖动调整 agent 浏览器窗口大小",
810
+ sizeApiOutdated: "尺寸接口未就绪:请重启 DSH 以加载最新 host 构建",
811
+ actionFailed: "操作失败"
752
812
  }
753
813
  };
754
814
  function wt(key, params = void 0) {
@@ -756,7 +816,31 @@ function wt(key, params = void 0) {
756
816
  if (params) for (var k in params) text = text.replace(new RegExp("{" + k + "}", "g"), String(params[k]));
757
817
  return text;
758
818
  }
819
+ function linkWhere(link) {
820
+ var kind = link && link.kind || "";
821
+ var label = link && link.label || "";
822
+ if (kind === "lightpanda") return "";
823
+ if (kind === "ego-cli") return wt("whereEgo");
824
+ if (kind === "tabbit-cli") return wt("whereTabbit");
825
+ if (kind === "localhost" || kind === "local") return wt("whereLocal");
826
+ if (label) return wt("whereCdp", { label });
827
+ return wt("whereGeneric");
828
+ }
829
+ function linkLoginLine(link) {
830
+ if ((link && link.kind) === "lightpanda") return wt("loginHeadless");
831
+ return wt("loginTitle", { where: linkWhere(link) });
832
+ }
833
+ function linkCaptchaLine(link) {
834
+ if ((link && link.kind) === "lightpanda") return wt("loginHeadless");
835
+ return wt("captchaHint", { where: linkWhere(link) });
836
+ }
837
+ function linkFlushable(link) {
838
+ var kind = link && link.kind || "";
839
+ return kind !== "ego-cli" && kind !== "tabbit-cli" && kind !== "lightpanda";
840
+ }
759
841
  const SPACES_ROUTE = "/api/bcdp/spaces";
842
+ const TRACKING_ROUTE = "/api/bcdp/tracking";
843
+ const SWITCH_TAB_ROUTE = "/api/bcdp/switch-tab";
760
844
  const EGO_CLOSE_ROUTE = "/api/bcdp/close";
761
845
  const WATCH_START_ROUTE = "/api/bcdp/watch/start";
762
846
  const WATCH_SWITCH_ROUTE = "/api/bcdp/watch/switch";
@@ -776,6 +860,19 @@ function postJson(path, body) {
776
860
  });
777
861
  });
778
862
  }
863
+ /** Make one tab the browser's active target (panel click = "show me that tab"). */
864
+ function switchTabRemote(targetId) {
865
+ if (targetId === void 0 || targetId === null || targetId === "") return Promise.resolve(null);
866
+ return postJson(SWITCH_TAB_ROUTE, { targetId: String(targetId) }).catch(function() {
867
+ return null;
868
+ });
869
+ }
870
+ /** 全模式 switch: GET returns the current value, POST flips it. */
871
+ function setTrackAllRemote(all) {
872
+ return postJson(TRACKING_ROUTE, { all }).catch(function() {
873
+ return null;
874
+ });
875
+ }
779
876
  function createKeyboardProxy(send) {
780
877
  var input = document.createElement("textarea");
781
878
  input.className = "dsh-ego-keyboard-proxy";
@@ -1161,15 +1258,20 @@ const PANEL_CSS = `
1161
1258
 
1162
1259
  /* ---- login guide strip (top of the panel body) ---- */
1163
1260
  #dsh-ego-login { display:none; align-items:center; gap:8px; margin:0 14px 9px; padding:7px 10px;
1164
- border-radius:9px; border:1px solid rgba(255,214,10,.28); background: rgba(255,214,10,.09); }
1261
+ border-radius:9px; border:1px solid rgba(255,214,10,.28); background: rgba(255,214,10,.09);
1262
+ /* Narrow panel: let the action row fall to its own line instead of squeezing
1263
+ the sentence into a one-character column. */
1264
+ flex-wrap: wrap; row-gap:6px; container-type: inline-size; }
1165
1265
  #dsh-ego-login.show { display:flex; }
1166
- #dsh-ego-login .dsh-ego-login-txt { flex:1; min-width:0; font-size:11px; line-height:1.45; color:#f5f5f7; }
1266
+ #dsh-ego-login .dsh-ego-login-txt { flex:1 1 12em; min-width:0; font-size:11px; line-height:1.45; color:#f5f5f7;
1267
+ overflow-wrap: anywhere; }
1167
1268
  #dsh-ego-login .dsh-ego-login-txt b { color:#ffd60a; }
1168
1269
  #dsh-ego-login .dsh-ego-login-btn { flex:none; background:#0a84ff; color:#fff; border:none; border-radius:8px;
1169
1270
  font-size:11px; padding:4px 10px; cursor:pointer; white-space:nowrap; transition: background .15s ease; }
1170
1271
  #dsh-ego-login .dsh-ego-login-btn:hover { background:#338cff; }
1171
1272
  #dsh-ego-login .dsh-ego-login-btn.saving { opacity:.55; pointer-events:none; }
1172
- #dsh-ego-login .dsh-ego-login-note { flex:none; font-size:10.5px; color:#6e6e73; white-space:nowrap; }
1273
+ #dsh-ego-login .dsh-ego-login-note { flex:0 1 auto; min-width:0; max-width:100%; font-size:10.5px; color:#6e6e73;
1274
+ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
1173
1275
  /* dismiss (×) on guide strips so the user can close them and reclaim the space */
1174
1276
  .dsh-ego-dismiss { flex:none; width:18px; height:18px; line-height:1; border-radius:50%; border:none;
1175
1277
  background: rgba(255,255,255,.12); color:inherit; font-size:13px; cursor:pointer; opacity:.75;
@@ -1180,9 +1282,14 @@ const PANEL_CSS = `
1180
1282
 
1181
1283
  /* ---- human-verification (CAPTCHA) reminder strip ---- */
1182
1284
  #dsh-ego-captcha { display:none; align-items:center; gap:8px; margin:0 14px 9px; padding:8px 11px;
1183
- border-radius:9px; border:1px solid rgba(255,69,58,.4); background: rgba(255,69,58,.13); color:#ffe1de; }
1285
+ border-radius:9px; border:1px solid rgba(255,69,58,.4); background: rgba(255,69,58,.13); color:#ffe1de;
1286
+ flex-wrap: wrap; row-gap:6px; container-type: inline-size; }
1287
+ @container (max-width: 260px) {
1288
+ #dsh-ego-login .dsh-ego-login-note, #dsh-ego-captcha .dsh-ego-captcha-kind { display:none; }
1289
+ }
1184
1290
  #dsh-ego-captcha.show { display:flex; }
1185
- #dsh-ego-captcha .dsh-ego-captcha-txt { flex:1; min-width:0; font-size:11.5px; line-height:1.5; }
1291
+ #dsh-ego-captcha .dsh-ego-captcha-txt { flex:1 1 12em; min-width:0; font-size:11.5px; line-height:1.5;
1292
+ overflow-wrap: anywhere; }
1186
1293
  #dsh-ego-captcha .dsh-ego-captcha-txt b { color:#ff6961; }
1187
1294
  #dsh-ego-captcha .dsh-ego-captcha-kind { flex:none; font-size:10px; padding:2px 8px; border-radius:999px;
1188
1295
  background: rgba(255,255,255,.12); color:#ffd8d5; text-transform:uppercase; letter-spacing:.4px; }
@@ -1231,6 +1338,22 @@ const PANEL_CSS = `
1231
1338
  }
1232
1339
  .dsh-ego-back:hover { background: rgba(255,255,255,.2); }
1233
1340
  .dsh-ego-back.dsh-ego-pick-on { background: rgba(56,189,248,.3); color: #7dd3fc; }
1341
+ .dsh-ego-back.on { background: rgba(217,119,87,.45); border-color: rgba(217,119,87,.7); }
1342
+ .dsh-ego-presets {
1343
+ display:inline-flex; gap:3px; padding:3px; border-radius:7px;
1344
+ background: rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.12);
1345
+ }
1346
+ .dsh-ego-preset-item {
1347
+ background:transparent; border:none; color:#f5f5f7; cursor:pointer;
1348
+ font-size:11px; padding:2px 7px; border-radius:5px;
1349
+ }
1350
+ .dsh-ego-preset-item:hover { background: rgba(255,255,255,.2); }
1351
+ /* live/active indication: the picture that belongs to the browser's ACTIVE tab
1352
+ gets a green frame (全模式 makes this the only way to tell them apart). */
1353
+ .dsh-ego-liveview.is-live img, .dsh-ego-liveview.is-live video {
1354
+ box-shadow: 0 0 0 2px #30d158, 0 0 14px rgba(48,209,88,.3);
1355
+ }
1356
+ .dsh-ego-tab.is-live .dsh-ego-tabdot { background:#30d158; box-shadow:0 0 6px #30d15888; }
1234
1357
  .dsh-ego-liveimg {
1235
1358
  width:100%; border-radius:11px; display:block;
1236
1359
  max-height:50vh; object-fit:contain;
@@ -1283,6 +1406,13 @@ const ICON_REFRESH = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none
1283
1406
  const ICON_CLOCK = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><circle cx="12" cy="12" r="9"/><path d="M12 7.5V12l3 2"/></svg>`;
1284
1407
  const ICON_CLOSE = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>`;
1285
1408
  const ICON_GRIP = `<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><circle cx="8" cy="6" r="1.8"/><circle cx="16" cy="6" r="1.8"/><circle cx="8" cy="12" r="1.8"/><circle cx="16" cy="12" r="1.8"/><circle cx="8" cy="18" r="1.8"/><circle cx="16" cy="18" r="1.8"/></svg>`;
1409
+ const ICON_LOCK = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><rect x="4.5" y="10.5" width="15" height="10" rx="2"/><path d="M8 10.5V7.5a4 4 0 0 1 8 0v3"/></svg>`;
1410
+ const ICON_UNLOCK = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><rect x="4.5" y="10.5" width="15" height="10" rx="2"/><path d="M8 10.5V7.5a4 4 0 0 1 7.2-2.4"/></svg>`;
1411
+ const ICON_ASPECT = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2.2"/><path d="M3 10h18"/><path d="M8 5v5"/></svg>`;
1412
+ const ICON_MAXIMIZE = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H3v5"/><path d="M16 3h5v5"/><path d="M8 21H3v-5"/><path d="M16 21h5v-5"/></svg>`;
1413
+ const ICON_LINK = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><path d="M10 13.5a4 4 0 0 0 5.7 0l2.8-2.8a4 4 0 0 0-5.7-5.7L11.5 6.3"/><path d="M14 10.5a4 4 0 0 0-5.7 0l-2.8 2.8a4 4 0 0 0 5.7 5.7l1.3-1.3"/></svg>`;
1414
+ const ICON_GRID = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"><rect x="3.5" y="3.5" width="7" height="7" rx="1.6"/><rect x="13.5" y="3.5" width="7" height="7" rx="1.6"/><rect x="3.5" y="13.5" width="7" height="7" rx="1.6"/><rect x="13.5" y="13.5" width="7" height="7" rx="1.6"/></svg>`;
1415
+ const ICON_SQUARE = `<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"><rect x="5" y="5" width="14" height="14" rx="2.4"/></svg>`;
1286
1416
  var BRIDGE_ROUTES = {
1287
1417
  describe: "/api/dsh-browser-cdp/settings/describe",
1288
1418
  mutate: "/api/dsh-browser-cdp/settings/mutate"
@@ -1737,6 +1867,13 @@ var FAM_FIELD_GROUPS = [
1737
1867
  kind: "bool",
1738
1868
  en: ["ego-cli fallback frames (5s)", "With no CDP screencast (local ego-cli link active), capture one screenshot every 5s through the CLI so the watch panel still fills. Off = panel shows a placeholder and no screenshot subprocess is spawned"],
1739
1869
  zh: ["ego-cli 降级帧(5s 一刷)", "无 CDP screencast(本机 ego-cli 激活)时,每 5s 走一次 CLI 截图填充观察窗画面区。关 = 面板显示占位提示、不拉截图子进程"]
1870
+ },
1871
+ {
1872
+ k: "tabTracking",
1873
+ kind: "sel",
1874
+ options: ["active", "all"],
1875
+ en: ["Tab tracking (CLI routes)", "active = capture only the browser-active tab; all = capture every tab in the space (one picture each), the active one outlined green"],
1876
+ zh: ["tab 跟踪模式(CLI 路线)", "仅激活 = 只抓浏览器激活的那个 tab;全模式 = space 内每个 tab 各出一张图,激活那个用绿框标出"]
1740
1877
  }
1741
1878
  ]
1742
1879
  },
@@ -2691,13 +2828,13 @@ function mountFloatingWatch(ctx) {
2691
2828
  </div>
2692
2829
  <div id="dsh-ego-tabs"></div>
2693
2830
  <div id="dsh-ego-login">
2694
- <span class="dsh-ego-login-txt">${wt("loginTitle")}</span>
2831
+ <span class="dsh-ego-login-txt" id="dsh-ego-login-txt">${wt("loginTitle", { where: wt("whereGeneric") })}</span>
2695
2832
  <button id="dsh-ego-login-btn" class="dsh-ego-login-btn" type="button">${wt("loginBtn")}</button>
2696
2833
  <span class="dsh-ego-login-note" id="dsh-ego-login-note"></span>
2697
2834
  <button class="dsh-ego-dismiss" type="button" title="${wt("loginDismiss")}" data-dismiss="login">×</button>
2698
2835
  </div>
2699
2836
  <div id="dsh-ego-captcha">
2700
- <span class="dsh-ego-captcha-txt"><b>${wt("captchaTitle")}</b> — ${wt("captchaHint")}</span>
2837
+ <span class="dsh-ego-captcha-txt"><b>${wt("captchaTitle")}</b> — <span id="dsh-ego-captcha-hint">${wt("captchaHint", { where: wt("whereGeneric") })}</span></span>
2701
2838
  <span class="dsh-ego-captcha-kind" id="dsh-ego-captcha-kind"></span>
2702
2839
  <button class="dsh-ego-dismiss" type="button" title="${wt("captchaDismiss")}" data-dismiss="captcha">×</button>
2703
2840
  </div>
@@ -2727,10 +2864,12 @@ function mountFloatingWatch(ctx) {
2727
2864
  const historyList = panel.querySelector("#dsh-ego-historylist");
2728
2865
  const tabsEl = panel.querySelector("#dsh-ego-tabs");
2729
2866
  const loginEl = panel.querySelector("#dsh-ego-login");
2867
+ const loginTxt = panel.querySelector("#dsh-ego-login-txt");
2730
2868
  const loginBtn = panel.querySelector("#dsh-ego-login-btn");
2731
2869
  const loginNote = panel.querySelector("#dsh-ego-login-note");
2732
2870
  const captchaEl = panel.querySelector("#dsh-ego-captcha");
2733
2871
  const captchaKindEl = panel.querySelector("#dsh-ego-captcha-kind");
2872
+ const captchaHintEl = panel.querySelector("#dsh-ego-captcha-hint");
2734
2873
  const FLUSH_ROUTE$1 = "/api/bcdp/flush";
2735
2874
  const dismissedGuides = {
2736
2875
  login: false,
@@ -2753,6 +2892,8 @@ function mountFloatingWatch(ctx) {
2753
2892
  let disposed = false;
2754
2893
  let historyOpen = false;
2755
2894
  let lastList = [];
2895
+ let panelLink = null;
2896
+ let trackAll = false;
2756
2897
  const setHistory = (open) => {
2757
2898
  historyOpen = open;
2758
2899
  historyEl.classList.toggle("open", open);
@@ -3194,6 +3335,7 @@ function mountFloatingWatch(ctx) {
3194
3335
  });
3195
3336
  tab.appendChild(closeBtn$1);
3196
3337
  if (s.targetId === selectedTabId || selectedTabId === null && s.targetId === currentActiveId) tab.classList.add("active");
3338
+ if (s.active === true) tab.classList.add("is-live");
3197
3339
  tab.addEventListener("click", () => {
3198
3340
  if (selectedTabId === s.targetId) {
3199
3341
  selectedTabId = null;
@@ -3201,6 +3343,7 @@ function mountFloatingWatch(ctx) {
3201
3343
  renderSpaces(lastList);
3202
3344
  return;
3203
3345
  }
3346
+ if (s.targetId !== currentActiveId) switchTabRemote(s.targetId).then(() => refresh());
3204
3347
  selectedTabId = s.targetId;
3205
3348
  pinned = null;
3206
3349
  renderLiveMain(s, true);
@@ -3262,7 +3405,9 @@ function mountFloatingWatch(ctx) {
3262
3405
  };
3263
3406
  const renderSpaces = (spaces) => {
3264
3407
  if (disposed) return;
3265
- lastList = Array.isArray(spaces) ? spaces : [];
3408
+ const incoming = Array.isArray(spaces) ? spaces : [];
3409
+ lastList = trackAll ? incoming : incoming.filter((s) => s && s.active === true).slice(0, 1);
3410
+ if (lastList.length === 0 && incoming.length === 1) lastList = incoming.slice(0, 1);
3266
3411
  for (const s of lastList) {
3267
3412
  const prev = pageMeta.get(s.targetId) || { targetId: s.targetId };
3268
3413
  pageMeta.set(s.targetId, {
@@ -3316,7 +3461,7 @@ function mountFloatingWatch(ctx) {
3316
3461
  const renderLiveMain = (current, isPinned) => {
3317
3462
  body.innerHTML = "";
3318
3463
  const view = document.createElement("div");
3319
- view.className = "dsh-ego-liveview";
3464
+ view.className = "dsh-ego-liveview" + (isPinned ? "" : " is-live");
3320
3465
  const badge = document.createElement("div");
3321
3466
  badge.className = "dsh-ego-livebadge";
3322
3467
  badge.innerHTML = isPinned ? `<span class="dsh-ego-state-dot pin"></span> ${wt("pinned")}` : `<span class="dsh-ego-state-dot${fab.classList.contains("dsh-ego-busy") ? " busy" : ""}"></span> ${wt("realtime")}`;
@@ -3362,6 +3507,90 @@ function mountFloatingWatch(ctx) {
3362
3507
  }).then((r) => r.json().catch(() => null)).catch(() => null);
3363
3508
  });
3364
3509
  badge.appendChild(raiseBtn);
3510
+ const liveNotice = (text) => {
3511
+ if (!text) return;
3512
+ u.textContent = String(text);
3513
+ u.classList.add("dsh-ego-hint");
3514
+ };
3515
+ const runPanelAction = (btn, promise, onOk) => {
3516
+ btn.disabled = true;
3517
+ promise.then((res) => {
3518
+ if (res && res.ok === true) {
3519
+ if (onOk) onOk(res);
3520
+ } else liveNotice(res && res.error || wt("actionFailed"));
3521
+ }).catch(() => {
3522
+ liveNotice(wt("actionFailed"));
3523
+ }).then(() => {
3524
+ btn.disabled = false;
3525
+ });
3526
+ };
3527
+ const pageRefreshBtn = document.createElement("button");
3528
+ pageRefreshBtn.type = "button";
3529
+ pageRefreshBtn.className = "dsh-ego-back";
3530
+ pageRefreshBtn.title = wt("pageRefreshHint");
3531
+ pageRefreshBtn.textContent = wt("pageRefresh");
3532
+ pageRefreshBtn.addEventListener("click", () => {
3533
+ runPanelAction(pageRefreshBtn, panelNavigate("", true), () => refresh());
3534
+ });
3535
+ badge.appendChild(pageRefreshBtn);
3536
+ const openUrlBtn = document.createElement("button");
3537
+ openUrlBtn.type = "button";
3538
+ openUrlBtn.className = "dsh-ego-back";
3539
+ openUrlBtn.title = wt("openUrlHint");
3540
+ openUrlBtn.textContent = wt("openUrl");
3541
+ openUrlBtn.addEventListener("click", () => {
3542
+ const entered = window.prompt(wt("openUrlPrompt"), current.url || "https://");
3543
+ if (entered === null) return;
3544
+ const url = normalizeUrlInput(entered);
3545
+ if (url === "") return;
3546
+ runPanelAction(openUrlBtn, panelNavigate(url, false), () => refresh());
3547
+ });
3548
+ badge.appendChild(openUrlBtn);
3549
+ const maximizeBtn = document.createElement("button");
3550
+ maximizeBtn.type = "button";
3551
+ maximizeBtn.className = "dsh-ego-back";
3552
+ maximizeBtn.title = wt("maximizeHint");
3553
+ maximizeBtn.innerHTML = `${ICON_MAXIMIZE}<span style="margin-left:4px">${wt("maximizeWindow")}</span>`;
3554
+ maximizeBtn.addEventListener("click", () => {
3555
+ runPanelAction(maximizeBtn, panelWindowSize({ maximize: true }), () => refresh());
3556
+ });
3557
+ badge.appendChild(maximizeBtn);
3558
+ const presetBtn = document.createElement("button");
3559
+ presetBtn.type = "button";
3560
+ presetBtn.className = "dsh-ego-back";
3561
+ presetBtn.title = wt("sizePresetsHint");
3562
+ presetBtn.innerHTML = `${ICON_ASPECT}<span style="margin-left:4px">${wt("sizePresets")}</span>`;
3563
+ const presetRow = document.createElement("div");
3564
+ presetRow.className = "dsh-ego-presets";
3565
+ presetRow.hidden = true;
3566
+ for (const preset of SIZE_PRESETS || []) {
3567
+ const item = document.createElement("button");
3568
+ item.type = "button";
3569
+ item.className = "dsh-ego-preset-item";
3570
+ item.textContent = preset.label;
3571
+ item.addEventListener("click", () => {
3572
+ presetRow.hidden = true;
3573
+ presetBtn.classList.remove("on");
3574
+ runPanelAction(presetBtn, panelWindowSize({ aspect: preset.ratio }), () => refresh());
3575
+ });
3576
+ presetRow.appendChild(item);
3577
+ }
3578
+ presetBtn.addEventListener("click", () => {
3579
+ presetRow.hidden = !presetRow.hidden;
3580
+ presetBtn.classList.toggle("on", !presetRow.hidden);
3581
+ });
3582
+ badge.appendChild(presetBtn);
3583
+ badge.appendChild(presetRow);
3584
+ const trackBtn = document.createElement("button");
3585
+ trackBtn.type = "button";
3586
+ trackBtn.className = "dsh-ego-back" + (trackAll ? " on" : "");
3587
+ trackBtn.title = trackAll ? wt("trackAllHintOn") : wt("trackAllHintOff");
3588
+ trackBtn.innerHTML = `${trackAll ? ICON_GRID : ICON_SQUARE}<span style="margin-left:4px">${trackAll ? wt("trackAllOn") : wt("trackAllOff")}</span>`;
3589
+ trackBtn.addEventListener("click", () => {
3590
+ trackAll = !trackAll;
3591
+ setTrackAllRemote(trackAll).then(() => refresh());
3592
+ });
3593
+ badge.appendChild(trackBtn);
3365
3594
  const cached = frameCache.get(current.targetId);
3366
3595
  if (captureBackend === "ffmpeg" || cached) {
3367
3596
  const img = makeZoomImage(u, captureBackend === "ffmpeg" ? "video" : "img");
@@ -3396,10 +3625,11 @@ function mountFloatingWatch(ctx) {
3396
3625
  renderEmpty();
3397
3626
  return;
3398
3627
  }
3628
+ if (data.link) panelLink = data.link;
3399
3629
  applyCaptureStatus(data.capture);
3400
3630
  if (data.cliFrameMode === true && Array.isArray(data.spaces)) {
3401
- const cli = data.spaces.find((s) => s && s.targetId === CLI_FRAME_TARGET_ID);
3402
- if (cli) frameCache.set(CLI_FRAME_TARGET_ID, `${CLI_FRAME_ROUTE}?t=${cli.lastActive || Date.now()}`);
3631
+ const cliActive = data.spaces.find((s) => s && (s.targetId === data.cliFrameTargetId || s.active === true)) || data.spaces[0];
3632
+ if (cliActive) frameCache.set(cliActive.targetId || CLI_FRAME_TARGET_ID, `${CLI_FRAME_ROUTE}?t=${cliActive.lastActive || Date.now()}`);
3403
3633
  renderSpaces(data.spaces);
3404
3634
  return;
3405
3635
  }
@@ -3661,6 +3891,12 @@ function mountFloatingWatch(ctx) {
3661
3891
  panel.offsetHeight;
3662
3892
  panel.classList.add("dsh-ego-panel-open");
3663
3893
  fab.classList.add("on");
3894
+ fetch(TRACKING_ROUTE, { cache: "no-store" }).then((r) => r.json().catch(() => null)).then((data) => {
3895
+ if (data && typeof data.all === "boolean" && data.all !== trackAll) {
3896
+ trackAll = data.all;
3897
+ refresh();
3898
+ }
3899
+ }).catch(() => {});
3664
3900
  refresh();
3665
3901
  openStream();
3666
3902
  if (currentActiveId) syncWatch(selectedTabId || currentActiveId);
@@ -3702,6 +3938,10 @@ function mountFloatingWatch(ctx) {
3702
3938
  const show = lastList.some((s) => s.url && !s.url.startsWith("about:")) && !captchaEl.classList.contains("show");
3703
3939
  loginEl.classList.toggle("show", show);
3704
3940
  loginNote.textContent = "";
3941
+ if (loginTxt) loginTxt.textContent = linkLoginLine(panelLink);
3942
+ const canFlush = linkFlushable(panelLink);
3943
+ if (loginBtn instanceof HTMLElement) loginBtn.hidden = !canFlush;
3944
+ if (!canFlush) loginNote.textContent = wt("loginSelfPersist");
3705
3945
  };
3706
3946
  const maybeShowCaptchaGuide = () => {
3707
3947
  if (disposed || dismissedGuides.captcha) return;
@@ -3709,6 +3949,7 @@ function mountFloatingWatch(ctx) {
3709
3949
  const show = !!hit;
3710
3950
  captchaEl.classList.toggle("show", show);
3711
3951
  if (show && captchaKindEl) captchaKindEl.textContent = hit.humanCheck.kind || "captcha";
3952
+ if (captchaHintEl) captchaHintEl.textContent = linkCaptchaLine(panelLink);
3712
3953
  };
3713
3954
  loginBtn.addEventListener("click", () => {
3714
3955
  (async () => {
@@ -3771,7 +4012,174 @@ function mountFloatingWatch(ctx) {
3771
4012
  }
3772
4013
  var INPUT_ROUTE = "/api/bcdp/input";
3773
4014
  var FLUSH_ROUTE = "/api/bcdp/flush";
4015
+ var WINDOW_SIZE_ROUTE = "/api/bcdp/window-size";
4016
+ var PANEL_NAVIGATE_ROUTE = "/api/bcdp/navigate";
3774
4017
  var FRAME_FOLLOW_MIN_MS = 350;
4018
+ var SIZE_SYNC_KEY = "dsh-browser-cdp:size-sync";
4019
+ function sizeSyncStored() {
4020
+ try {
4021
+ return window.localStorage.getItem(SIZE_SYNC_KEY) === "1";
4022
+ } catch (e) {
4023
+ return false;
4024
+ }
4025
+ }
4026
+ function sizeSyncStore(enabled) {
4027
+ try {
4028
+ window.localStorage.setItem(SIZE_SYNC_KEY, enabled ? "1" : "0");
4029
+ } catch (e) {}
4030
+ }
4031
+ function createWindowSizeSync() {
4032
+ var enabled = false;
4033
+ var element = null;
4034
+ var observer = null;
4035
+ var timer = null;
4036
+ var inFlight = false;
4037
+ var baseWidth = 0;
4038
+ var pointerDown = false;
4039
+ var dragUntil = 0;
4040
+ var lastAt = 0;
4041
+ function onPointerDown() {
4042
+ pointerDown = true;
4043
+ }
4044
+ function onPointerUp() {
4045
+ if (!pointerDown) return;
4046
+ pointerDown = false;
4047
+ dragUntil = Date.now() + 350;
4048
+ if (enabled) schedule();
4049
+ }
4050
+ function stageWidth() {
4051
+ return Math.round(element && element.clientWidth || 0);
4052
+ }
4053
+ function schedule() {
4054
+ if (timer !== null) return;
4055
+ timer = setTimeout(send, 180);
4056
+ }
4057
+ function send() {
4058
+ timer = null;
4059
+ if (!enabled || !element) return;
4060
+ var w = stageWidth();
4061
+ if (w < 120) return;
4062
+ var now = Date.now();
4063
+ if (!pointerDown && now > dragUntil) {
4064
+ baseWidth = w;
4065
+ return;
4066
+ }
4067
+ var delta = w - baseWidth;
4068
+ if (Math.abs(delta) < 12) return;
4069
+ if (now - lastAt < 200) {
4070
+ schedule();
4071
+ return;
4072
+ }
4073
+ if (inFlight) {
4074
+ schedule();
4075
+ return;
4076
+ }
4077
+ inFlight = true;
4078
+ lastAt = now;
4079
+ var sentBase = w;
4080
+ postJson(WINDOW_SIZE_ROUTE, { delta }).then(function(parsed) {
4081
+ if (parsed && parsed.ok === true) baseWidth = sentBase;
4082
+ }).catch(function() {
4083
+ return null;
4084
+ }).then(function() {
4085
+ inFlight = false;
4086
+ });
4087
+ }
4088
+ function attach(el) {
4089
+ element = el || null;
4090
+ if (!enabled) return;
4091
+ if (observer !== null) {
4092
+ observer.disconnect();
4093
+ observer = null;
4094
+ }
4095
+ if (element && typeof ResizeObserver !== "undefined") try {
4096
+ observer = new ResizeObserver(function() {
4097
+ if (enabled) schedule();
4098
+ });
4099
+ observer.observe(element);
4100
+ } catch (e) {
4101
+ observer = null;
4102
+ }
4103
+ if (baseWidth === 0) baseWidth = stageWidth();
4104
+ }
4105
+ function setEnabled(next) {
4106
+ enabled = next === true;
4107
+ sizeSyncStore(enabled);
4108
+ if (!enabled) {
4109
+ if (timer !== null) {
4110
+ clearTimeout(timer);
4111
+ timer = null;
4112
+ }
4113
+ if (observer !== null) {
4114
+ observer.disconnect();
4115
+ observer = null;
4116
+ }
4117
+ document.removeEventListener("pointerdown", onPointerDown, true);
4118
+ document.removeEventListener("pointerup", onPointerUp, true);
4119
+ return;
4120
+ }
4121
+ baseWidth = stageWidth();
4122
+ lastAt = 0;
4123
+ document.addEventListener("pointerdown", onPointerDown, true);
4124
+ document.addEventListener("pointerup", onPointerUp, true);
4125
+ if (element) attach(element);
4126
+ }
4127
+ function dispose() {
4128
+ if (timer !== null) timer = null;
4129
+ if (observer !== null) {
4130
+ observer.disconnect();
4131
+ observer = null;
4132
+ }
4133
+ document.removeEventListener("pointerdown", onPointerDown, true);
4134
+ document.removeEventListener("pointerup", onPointerUp, true);
4135
+ element = null;
4136
+ }
4137
+ return {
4138
+ isEnabled: function() {
4139
+ return enabled;
4140
+ },
4141
+ setEnabled,
4142
+ attach,
4143
+ dispose
4144
+ };
4145
+ }
4146
+ var SIZE_PRESETS = [
4147
+ {
4148
+ label: "16:9",
4149
+ ratio: "16:9"
4150
+ },
4151
+ {
4152
+ label: "4:3",
4153
+ ratio: "4:3"
4154
+ },
4155
+ {
4156
+ label: "21:9",
4157
+ ratio: "21:9"
4158
+ },
4159
+ {
4160
+ label: "1:1",
4161
+ ratio: "1:1"
4162
+ },
4163
+ {
4164
+ label: "9:16",
4165
+ ratio: "9:16"
4166
+ }
4167
+ ];
4168
+ /** Panel refresh / URL: ONE body shape for both host routes. */
4169
+ function panelNavigate(url, reload) {
4170
+ return postJson(PANEL_NAVIGATE_ROUTE, reload ? { reload: true } : { url: String(url || "") });
4171
+ }
4172
+ /** Size sync / presets / maximize. */
4173
+ function panelWindowSize(body) {
4174
+ return postJson(WINDOW_SIZE_ROUTE, body || {});
4175
+ }
4176
+ /** Normalize whatever the user typed into an absolute URL. */
4177
+ function normalizeUrlInput(entered) {
4178
+ var url = String(entered || "").trim();
4179
+ if (url === "") return "";
4180
+ if (!/^[a-z][a-z0-9+.-]*:/i.test(url)) url = "https://" + url;
4181
+ return url;
4182
+ }
3775
4183
  var TAB_CSS = `
3776
4184
  .dsh-ego-side-root {
3777
4185
  display: flex; flex-direction: column; height: 100%; min-height: 0;
@@ -3806,6 +4214,14 @@ var TAB_CSS = `
3806
4214
  .dsh-ego-side-login, .dsh-ego-side-captcha {
3807
4215
  display: flex; align-items: center; gap: 7px; margin: 0 10px 7px; padding: 6px 9px;
3808
4216
  border-radius: 8px; font-size: 11px; line-height: 1.4;
4217
+ /* Narrow sidebar: wrap instead of squeezing the sentence to one character. */
4218
+ flex-wrap: wrap; row-gap: 5px;
4219
+ /* The strip is a query container so the secondary bits can step aside when the
4220
+ sidebar gets too narrow for them (see @container below). */
4221
+ container-type: inline-size;
4222
+ }
4223
+ @container (max-width: 260px) {
4224
+ .dsh-ego-side-login-note, .dsh-ego-side-captcha-kind { display: none; }
3809
4225
  }
3810
4226
  .dsh-ego-side-login {
3811
4227
  border: 1px solid rgba(255,214,10,.3); background: rgba(255,214,10,.1);
@@ -3813,7 +4229,7 @@ var TAB_CSS = `
3813
4229
  .dsh-ego-side-captcha {
3814
4230
  border: 1px solid rgba(255,69,58,.4); background: rgba(255,69,58,.13);
3815
4231
  }
3816
- .dsh-ego-side-login .dsh-ego-side-login-txt { flex: 1; min-width: 0; }
4232
+ .dsh-ego-side-login .dsh-ego-side-login-txt { flex: 1 1 11em; min-width: 0; overflow-wrap: anywhere; }
3817
4233
  .dsh-ego-side-login .dsh-ego-side-login-txt b { color: #ffd60a; }
3818
4234
  .dsh-ego-side-login-btn {
3819
4235
  flex: none; background: #0a84ff; color: #fff; border: none; border-radius: 7px;
@@ -3822,8 +4238,9 @@ var TAB_CSS = `
3822
4238
  }
3823
4239
  .dsh-ego-side-login-btn:hover { background: #338cff; }
3824
4240
  .dsh-ego-side-login-btn.saving { opacity: .55; pointer-events: none; }
3825
- .dsh-ego-side-login-note { flex: none; font-size: 10px; opacity: .6; white-space: nowrap; }
3826
- .dsh-ego-side-captcha-txt { flex: 1; min-width: 0; }
4241
+ .dsh-ego-side-login-note { flex: 0 1 auto; min-width: 0; max-width: 100%; font-size: 10px; opacity: .6;
4242
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
4243
+ .dsh-ego-side-captcha-txt { flex: 1 1 11em; min-width: 0; overflow-wrap: anywhere; }
3827
4244
  .dsh-ego-side-captcha-txt b { color: #ff6961; }
3828
4245
  .dsh-ego-side-captcha-kind {
3829
4246
  flex: none; font-size: 9.5px; padding: 2px 7px; border-radius: 999px;
@@ -3886,6 +4303,34 @@ var TAB_CSS = `
3886
4303
  }
3887
4304
  .dsh-ego-side-back:hover { background: rgba(128,128,128,.3); }
3888
4305
  .dsh-ego-side-back.dsh-ego-pick-on { background: rgba(56,189,248,.28); color: #0ea5e9; }
4306
+ .dsh-ego-side-back.on { background: rgba(217,119,87,.35); border-color: rgba(217,119,87,.6); }
4307
+ .dsh-ego-side-presets {
4308
+ display: inline-flex; gap: 3px; padding: 3px; border-radius: 7px;
4309
+ background: rgba(128,128,128,.12); border: 1px solid rgba(128,128,128,.18);
4310
+ }
4311
+ .dsh-ego-side-preset-item {
4312
+ background: transparent; border: none; color: inherit; cursor: pointer;
4313
+ font-size: 10.5px; padding: 2px 7px; border-radius: 5px; opacity: .8;
4314
+ }
4315
+ .dsh-ego-side-preset-item:hover { background: rgba(128,128,128,.24); opacity: 1; }
4316
+ /* size-sync stage: the live image sits in a positioned box so the edge/
4317
+ corner handles can overlay it. */
4318
+ .dsh-ego-side-stage { position: relative; display: flex; min-width: 0; }
4319
+ .dsh-ego-side-resize { position: absolute; z-index: 6; background: transparent; }
4320
+ .dsh-ego-side-resize-right { top: 0; bottom: 0; right: 0; width: 10px; cursor: col-resize; }
4321
+ .dsh-ego-side-resize-bottom { left: 0; right: 0; bottom: 0; height: 10px; cursor: row-resize; }
4322
+ .dsh-ego-side-resize-corner { right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; }
4323
+ .dsh-ego-size-unlocked .dsh-ego-side-resize-right,
4324
+ .dsh-ego-size-unlocked .dsh-ego-side-resize-bottom { background: rgba(217,119,87,.14); }
4325
+ .dsh-ego-size-unlocked .dsh-ego-side-resize-corner {
4326
+ background: rgba(217,119,87,.3); border-bottom-right-radius: 9px;
4327
+ }
4328
+ /* Green frame = this image belongs to the browser's ACTIVE tab. In 全模式 every
4329
+ tab has its own picture, so the outline is what marks the live one. */
4330
+ .dsh-ego-side-stage.is-live { box-shadow: 0 0 0 2px #30d158, 0 0 12px rgba(48,209,88,.3); border-radius: 11px; }
4331
+ .dsh-ego-side-tab.is-live .dsh-ego-side-tabdot { background: #30d158; box-shadow: 0 0 6px #30d158; }
4332
+ .dsh-ego-side-tab.is-live .dsh-ego-side-tabtxt { font-weight: 600; }
4333
+ .dsh-ego-side-resize:hover { background: rgba(217,119,87,.5) !important; }
3889
4334
  .dsh-ego-side-liveimg {
3890
4335
  width: 100%; border-radius: 9px; display: block;
3891
4336
  max-height: 50vh; object-fit: contain;
@@ -4000,6 +4445,35 @@ function CdpPicksDockCard(props) {
4000
4445
  var filesKey = refs.map(function(r) {
4001
4446
  return r.file;
4002
4447
  }).join("|");
4448
+ var reloadState = React.useState(0);
4449
+ var reloadKey = reloadState[0];
4450
+ var setReloadKey = reloadState[1];
4451
+ var liveState = React.useState({});
4452
+ var liveMeta = liveState[0];
4453
+ var setLiveMeta = liveState[1];
4454
+ React.useEffect(function() {
4455
+ var cancelled = false;
4456
+ fetch(SPACES_ROUTE, { cache: "no-store" }).then(function(res) {
4457
+ return res.json().catch(function() {
4458
+ return null;
4459
+ });
4460
+ }).then(function(data) {
4461
+ if (cancelled || !data || !Array.isArray(data.spaces)) return;
4462
+ var map = {};
4463
+ for (var i = 0; i < data.spaces.length; i++) {
4464
+ var s = data.spaces[i];
4465
+ if (s && s.targetId != null) map[String(s.targetId)] = {
4466
+ url: s.url || "",
4467
+ title: s.title || "",
4468
+ active: s.active === true
4469
+ };
4470
+ }
4471
+ setLiveMeta(map);
4472
+ }).catch(function() {});
4473
+ return function() {
4474
+ cancelled = true;
4475
+ };
4476
+ }, [Math.floor(tick[0] / 3)]);
4003
4477
  React.useEffect(function() {
4004
4478
  var cancelled = false;
4005
4479
  refs.forEach(function(r) {
@@ -4051,7 +4525,11 @@ function CdpPicksDockCard(props) {
4051
4525
  return function() {
4052
4526
  cancelled = true;
4053
4527
  };
4054
- }, [filesKey, Math.floor(tick[0] / 5)]);
4528
+ }, [
4529
+ filesKey,
4530
+ reloadKey,
4531
+ Math.floor(tick[0] / 5)
4532
+ ]);
4055
4533
  if (refs.length === 0) return null;
4056
4534
  function removeRef(line) {
4057
4535
  var cur = readDraftText(input);
@@ -4061,6 +4539,20 @@ function CdpPicksDockCard(props) {
4061
4539
  next = next.replace(/^\s*\n+/, "").replace(/\n+\s*$/, "");
4062
4540
  input.setDraft(next);
4063
4541
  }
4542
+ function recapture(r, targetId, live) {
4543
+ if (targetId === "") return;
4544
+ postJson("/bcdp/api/tab-anchor-report", {
4545
+ targetId,
4546
+ session: sid,
4547
+ file: r.file.slice(6),
4548
+ ...live && live.url ? { url: live.url } : {},
4549
+ ...live && live.title ? { title: live.title } : {}
4550
+ }).then(function(res) {
4551
+ if (res && res.ok !== false) setReloadKey(function(n) {
4552
+ return n + 1;
4553
+ });
4554
+ }).catch(function() {});
4555
+ }
4064
4556
  return h("div", { style: {
4065
4557
  display: "grid",
4066
4558
  gap: "6px"
@@ -4072,6 +4564,8 @@ function CdpPicksDockCard(props) {
4072
4564
  var isTabReport = false;
4073
4565
  var truncated = false;
4074
4566
  var degraded = "";
4567
+ var targetId = "";
4568
+ var reportSource = "";
4075
4569
  if (typeof content === "string" && content !== "") try {
4076
4570
  var obj = JSON.parse(content);
4077
4571
  elements = obj && obj.elements || [];
@@ -4080,14 +4574,29 @@ function CdpPicksDockCard(props) {
4080
4574
  isTabReport = !!(obj && obj.type === "tab-anchor-report");
4081
4575
  truncated = !!(obj && obj.truncated);
4082
4576
  degraded = obj && obj.degraded || "";
4577
+ targetId = obj && obj.targetId ? String(obj.targetId) : "";
4578
+ reportSource = obj && obj.source ? String(obj.source) : "";
4083
4579
  } catch (e) {
4084
4580
  pageTitle = "";
4085
4581
  }
4582
+ var live = targetId !== "" ? liveMeta[targetId] : null;
4583
+ var liveTitle = live && live.title || "";
4584
+ var liveUrl = live && live.url || "";
4086
4585
  var countText;
4087
4586
  if (typeof content !== "string" || content === "") countText = errs[r.file] ? "⚠ " + errs[r.file] : "…";
4088
4587
  else if (degraded) countText = wt("pickCardElements", { n: 0 }) + " · ⚠ " + degraded;
4089
- else countText = wt("pickCardElements", { n: elements.length }) + (truncated ? "+" : "");
4090
- var head = h("div", { className: "dsh-cdp-picks-head" }, h("span", { style: { fontWeight: 700 } }, isTabReport ? "🌐 " + (pageTitle || wt("pickCardTitle")) : "🌐 " + wt("pickCardTitle")), h("span", { className: "dsh-cdp-picks-sub" }, "@" + r.file), isTabReport && pageUrl ? h("span", { className: "dsh-cdp-picks-sub" }, pageUrl) : h("span", { className: "dsh-cdp-picks-sub" }, pageTitle), h("span", { className: "dsh-cdp-picks-sub" }, countText), h("button", {
4588
+ else countText = wt("pickCardElements", { n: elements.length }) + (truncated ? "+" : "") + (isTabReport ? " " + wt("pickCardSnapshotTag") : "");
4589
+ var head = h("div", { className: "dsh-cdp-picks-head" }, h("span", { style: { fontWeight: 700 } }, isTabReport ? "🌐 " + (liveTitle || pageTitle || wt("pickCardTitle")) : "🌐 " + wt("pickCardTitle")), h("span", { className: "dsh-cdp-picks-sub" }, "@" + r.file), h("span", { className: "dsh-cdp-picks-sub" }, liveUrl || pageUrl || pageTitle), isTabReport && live ? h("span", {
4590
+ className: "dsh-cdp-picks-sub",
4591
+ title: reportSource || "live"
4592
+ }, "● " + wt("pickCardLive")) : null, h("span", { className: "dsh-cdp-picks-sub" }, countText), isTabReport && targetId !== "" ? h("button", {
4593
+ type: "button",
4594
+ title: wt("pickCardRecaptureHint"),
4595
+ className: "dsh-cdp-picks-close",
4596
+ onClick: function() {
4597
+ recapture(r, targetId, live);
4598
+ }
4599
+ }, "⟳") : null, h("button", {
4091
4600
  type: "button",
4092
4601
  title: wt("pickCardRemove"),
4093
4602
  className: "dsh-cdp-picks-close",
@@ -4658,6 +5167,8 @@ function LivePreviewController(ctx) {
4658
5167
  this._zoomHint = null;
4659
5168
  this._zoomHintTimer = null;
4660
5169
  this._pointerState = null;
5170
+ this.link = null;
5171
+ this.trackAll = false;
4661
5172
  var self = this;
4662
5173
  this.keyboardProxy = createKeyboardProxy(function(targetId, type, params) {
4663
5174
  self.sendInput(targetId, type, params);
@@ -4686,6 +5197,9 @@ LivePreviewController.prototype._initialState = function() {
4686
5197
  busy: false,
4687
5198
  showLoginGuide: false,
4688
5199
  captchaKind: null,
5200
+ link: null,
5201
+ trackAll: false,
5202
+ agentActiveId: null,
4689
5203
  historyOpen: false,
4690
5204
  zoomHint: null,
4691
5205
  wiringStale: false,
@@ -4732,7 +5246,7 @@ LivePreviewController.prototype._recompute = function() {
4732
5246
  return s.targetId === self.selectedTabId;
4733
5247
  }) || null;
4734
5248
  currentTargetId = this.selectedTabId;
4735
- if (currentSpace && !currentSpace.thumbnail) {
5249
+ if (currentSpace) {
4736
5250
  var cached = this.frameCache.get(currentTargetId);
4737
5251
  if (cached) currentSpace = Object.assign({}, currentSpace, { thumbnail: cached });
4738
5252
  }
@@ -4746,10 +5260,8 @@ LivePreviewController.prototype._recompute = function() {
4746
5260
  if (activeMarked) {
4747
5261
  currentSpace = Object.assign({}, activeMarked);
4748
5262
  currentTargetId = activeMarked.targetId;
4749
- if (!currentSpace.thumbnail) {
4750
- var cached2 = this.frameCache.get(currentTargetId);
4751
- if (cached2) currentSpace.thumbnail = cached2;
4752
- }
5263
+ var cached2 = this.frameCache.get(currentTargetId);
5264
+ if (cached2) currentSpace.thumbnail = cached2;
4753
5265
  }
4754
5266
  }
4755
5267
  this.currentActiveId = currentTargetId;
@@ -4778,17 +5290,36 @@ LivePreviewController.prototype._recompute = function() {
4778
5290
  s.engineUnsupported = self.engineUnsupported;
4779
5291
  s.pick = self._pick;
4780
5292
  s.pickMessage = self._pickMessage;
5293
+ s.link = self.link;
5294
+ s.trackAll = self.trackAll;
5295
+ s.agentActiveId = self.agentActiveId;
4781
5296
  });
4782
5297
  this._syncWatch(currentTargetId);
4783
5298
  };
4784
5299
  LivePreviewController.prototype.start = function() {
4785
5300
  document.addEventListener("visibilitychange", this.onDocumentVisibility);
5301
+ var self = this;
5302
+ fetch(TRACKING_ROUTE, { cache: "no-store" }).then(function(res) {
5303
+ return res.json().catch(function() {
5304
+ return null;
5305
+ });
5306
+ }).then(function(data) {
5307
+ if (data && typeof data.all === "boolean") {
5308
+ self.trackAll = data.all;
5309
+ self._recompute();
5310
+ }
5311
+ }).catch(function() {});
4786
5312
  this._recompute();
4787
5313
  if (this.visible) {
4788
5314
  this.refresh();
4789
5315
  this.openStream();
4790
5316
  }
4791
5317
  };
5318
+ LivePreviewController.prototype.setTrackAll = function(all) {
5319
+ this.trackAll = all === true;
5320
+ this._recompute();
5321
+ setTrackAllRemote(this.trackAll);
5322
+ };
4792
5323
  LivePreviewController.prototype.togglePick = function() {
4793
5324
  var targetId = this.currentActiveId;
4794
5325
  if (this.pickControl.isEnabled()) {
@@ -4968,12 +5499,13 @@ LivePreviewController.prototype.refresh = function() {
4968
5499
  self._renderEmpty();
4969
5500
  return;
4970
5501
  }
5502
+ if (data.link) self.link = data.link;
4971
5503
  self._applyCaptureStatus(data.capture);
4972
5504
  if (data.cliFrameMode === true && Array.isArray(data.spaces)) {
4973
- var cli = data.spaces.find(function(s) {
4974
- return s && s.targetId === CLI_FRAME_TARGET_ID;
4975
- });
4976
- if (cli) self.frameCache.set(CLI_FRAME_TARGET_ID, CLI_FRAME_ROUTE + "?t=" + (cli.lastActive || Date.now()));
5505
+ var cliActive = data.spaces.find(function(s) {
5506
+ return s && (s.targetId === data.cliFrameTargetId || s.active === true);
5507
+ }) || data.spaces[0];
5508
+ if (cliActive) self.frameCache.set(cliActive.targetId || CLI_FRAME_TARGET_ID, CLI_FRAME_ROUTE + "?t=" + (cliActive.lastActive || Date.now()));
4977
5509
  self._processSpaces(data.spaces);
4978
5510
  return;
4979
5511
  }
@@ -4988,7 +5520,11 @@ LivePreviewController.prototype._renderEmpty = function() {
4988
5520
  };
4989
5521
  LivePreviewController.prototype._processSpaces = function(spaces) {
4990
5522
  if (this.disposed) return;
4991
- this.lastList = Array.isArray(spaces) ? spaces : [];
5523
+ var incoming = Array.isArray(spaces) ? spaces : [];
5524
+ this.lastList = this.trackAll ? incoming : incoming.filter(function(s$1) {
5525
+ return s$1 && s$1.active === true;
5526
+ }).slice(0, 1);
5527
+ if (this.lastList.length === 0 && incoming.length === 1) this.lastList = incoming.slice(0, 1);
4992
5528
  for (var i = 0; i < this.lastList.length; i++) {
4993
5529
  var s = this.lastList[i];
4994
5530
  var prev = this.pageMeta.get(s.targetId) || { targetId: s.targetId };
@@ -5180,6 +5716,7 @@ LivePreviewController.prototype.unpin = function() {
5180
5716
  this._recompute();
5181
5717
  };
5182
5718
  LivePreviewController.prototype.selectTab = function(targetId) {
5719
+ if (targetId !== this.currentActiveId) switchTabRemote(targetId);
5183
5720
  if (this.selectedTabId === targetId) {
5184
5721
  this.selectedTabId = null;
5185
5722
  this.pinned = null;
@@ -5245,6 +5782,15 @@ LivePreviewController.prototype.noteWired = function() {
5245
5782
  if (!self.disposed) self._recompute();
5246
5783
  });
5247
5784
  };
5785
+ LivePreviewController.prototype.noteViewport = function(targetId, width, height) {
5786
+ if (targetId == null) return;
5787
+ if (!Number.isFinite(width) || !Number.isFinite(height)) return;
5788
+ if (width <= 0 || height <= 0) return;
5789
+ var meta = this.pageMeta.get(targetId) || {};
5790
+ meta.vw = width;
5791
+ meta.vh = height;
5792
+ this.pageMeta.set(targetId, meta);
5793
+ };
5248
5794
  LivePreviewController.prototype._signalUnwired = function() {
5249
5795
  var now = Date.now();
5250
5796
  if (now - this._lastUnwiredAt < 5e3) return;
@@ -5400,12 +5946,141 @@ function EgoBrowserTab(props) {
5400
5946
  });
5401
5947
  var imgRef = React.useRef(null);
5402
5948
  var videoRef = React.useRef(null);
5949
+ var stageRef = React.useRef(null);
5950
+ var sizeSyncRef = React.useRef(null);
5951
+ if (sizeSyncRef.current === null) {
5952
+ sizeSyncRef.current = createWindowSizeSync();
5953
+ sizeSyncRef.current.setEnabled(sizeSyncStored());
5954
+ }
5955
+ var sizeSync = sizeSyncRef.current;
5956
+ var sizeSyncState = React.useState(sizeSync.isEnabled());
5957
+ var sizeSyncOn = sizeSyncState[0];
5958
+ var setSizeSyncOn = sizeSyncState[1];
5959
+ var presetState = React.useState(false);
5960
+ var presetOpen = presetState[0];
5961
+ var setPresetOpen = presetState[1];
5962
+ var noticeState = React.useState("");
5963
+ var sizeNotice = noticeState[0];
5964
+ var setSizeNotice = noticeState[1];
5965
+ var noteSizeResult = function(status, parsed) {
5966
+ if (status === 400 || status === 404) setSizeNotice(wt("sizeApiOutdated"));
5967
+ else if (parsed && parsed.ok === true) setSizeNotice("");
5968
+ };
5969
+ var noteViewport = function(targetId, parsed) {
5970
+ if (parsed && parsed.ok === true && parsed.viewport) controller.noteViewport(targetId, parsed.viewport.width, parsed.viewport.height);
5971
+ };
5972
+ var applyPreset = function(ratio) {
5973
+ setPresetOpen(false);
5974
+ var targetId = state.currentTargetId;
5975
+ panelWindowSize({ aspect: ratio }).then(function(parsed) {
5976
+ noteSizeResult(200, parsed);
5977
+ noteViewport(targetId, parsed);
5978
+ if (parsed && parsed.ok === true) controller.refresh();
5979
+ }).catch(function() {
5980
+ setSizeNotice(wt("actionFailed"));
5981
+ });
5982
+ };
5983
+ var openUrlInPanel = function() {
5984
+ var current = state.currentSpace;
5985
+ var entered = window.prompt(wt("openUrlPrompt"), current && current.url || "https://");
5986
+ if (entered === null) return;
5987
+ var url = normalizeUrlInput(entered);
5988
+ if (url === "") return;
5989
+ var targetId = state.currentTargetId;
5990
+ setSizeNotice("");
5991
+ panelNavigate(url, false).then(function(parsed) {
5992
+ if (parsed && parsed.ok === true) {
5993
+ setSizeNotice("");
5994
+ noteViewport(targetId, parsed);
5995
+ controller.refresh();
5996
+ } else setSizeNotice(parsed && parsed.error || wt("actionFailed"));
5997
+ }).catch(function() {
5998
+ setSizeNotice(wt("actionFailed"));
5999
+ });
6000
+ };
6001
+ var reloadPage = function() {
6002
+ setSizeNotice("");
6003
+ panelNavigate("", true).then(function(parsed) {
6004
+ if (parsed && parsed.ok === true) {
6005
+ setSizeNotice("");
6006
+ controller.refresh();
6007
+ } else setSizeNotice(parsed && parsed.error || wt("actionFailed"));
6008
+ }).catch(function() {
6009
+ setSizeNotice(wt("actionFailed"));
6010
+ });
6011
+ };
6012
+ var maximizeWindow = function() {
6013
+ var targetId = state.currentTargetId;
6014
+ setSizeNotice("");
6015
+ panelWindowSize({ maximize: true }).then(function(parsed) {
6016
+ noteSizeResult(200, parsed);
6017
+ noteViewport(targetId, parsed);
6018
+ if (parsed && parsed.ok === true) controller.refresh();
6019
+ else setSizeNotice(parsed && parsed.error || wt("actionFailed"));
6020
+ }).catch(function() {
6021
+ setSizeNotice(wt("actionFailed"));
6022
+ });
6023
+ };
6024
+ React.useEffect(function() {
6025
+ if (!presetOpen) return;
6026
+ return function() {};
6027
+ }, [presetOpen]);
6028
+ var beginResize = function(axis) {
6029
+ return function(event) {
6030
+ event.preventDefault();
6031
+ event.stopPropagation();
6032
+ var startX = event.clientX;
6033
+ var startY = event.clientY;
6034
+ var sentX = 0;
6035
+ var sentY = 0;
6036
+ var lastAt = 0;
6037
+ var inFlight = false;
6038
+ var targetId = state.currentTargetId;
6039
+ var sendStep = function(stepX, stepY) {
6040
+ var payload = {};
6041
+ if (Math.abs(stepX) >= 1) payload.delta = Math.round(stepX);
6042
+ if (Math.abs(stepY) >= 1) payload.dy = Math.round(stepY);
6043
+ if (payload.delta === void 0 && payload.dy === void 0) return;
6044
+ panelWindowSize(payload).then(function(parsed) {
6045
+ noteSizeResult(200, parsed);
6046
+ noteViewport(targetId, parsed);
6047
+ }).catch(function() {
6048
+ return null;
6049
+ }).then(function() {
6050
+ inFlight = false;
6051
+ });
6052
+ };
6053
+ var onMove = function(ev) {
6054
+ var dxTotal = axis === "y" ? 0 : ev.clientX - startX;
6055
+ var dyTotal = axis === "x" ? 0 : ev.clientY - startY;
6056
+ var stepX = dxTotal - sentX;
6057
+ var stepY = dyTotal - sentY;
6058
+ if (Math.abs(stepX) < 3 && Math.abs(stepY) < 3) return;
6059
+ var now = Date.now();
6060
+ if (inFlight || now - lastAt < 120) return;
6061
+ inFlight = true;
6062
+ lastAt = now;
6063
+ sentX = dxTotal;
6064
+ sentY = dyTotal;
6065
+ sendStep(stepX, stepY);
6066
+ };
6067
+ var onUp = function() {
6068
+ document.removeEventListener("pointermove", onMove);
6069
+ document.removeEventListener("pointerup", onUp);
6070
+ document.removeEventListener("pointercancel", onUp);
6071
+ };
6072
+ document.addEventListener("pointermove", onMove);
6073
+ document.addEventListener("pointerup", onUp);
6074
+ document.addEventListener("pointercancel", onUp);
6075
+ };
6076
+ };
5403
6077
  var bindLiveImg = function(el) {
5404
6078
  imgRef.current = el;
5405
6079
  if (el && state.currentTargetId != null && (controller.liveImg !== el || controller.liveImgTargetId !== state.currentTargetId)) {
5406
6080
  controller.setLiveImg(el, state.currentTargetId);
5407
6081
  controller.noteWired();
5408
6082
  }
6083
+ if (sizeSyncOn) sizeSync.attach(stageRef.current || el);
5409
6084
  };
5410
6085
  var bindLiveVideo = function(el) {
5411
6086
  videoRef.current = el;
@@ -5413,6 +6088,7 @@ function EgoBrowserTab(props) {
5413
6088
  controller.setLiveVideo(el, state.currentTargetId);
5414
6089
  controller.noteWired();
5415
6090
  }
6091
+ if (sizeSyncOn) sizeSync.attach(stageRef.current || el);
5416
6092
  };
5417
6093
  React.useEffect(function() {
5418
6094
  controller.start();
@@ -5423,6 +6099,21 @@ function EgoBrowserTab(props) {
5423
6099
  React.useEffect(function() {
5424
6100
  controller.setVisible(visible);
5425
6101
  }, [visible, controller]);
6102
+ React.useEffect(function() {
6103
+ if (!visible) sizeSync.attach(null);
6104
+ else if (sizeSyncOn) sizeSync.attach(stageRef.current || imgRef.current || videoRef.current);
6105
+ }, [
6106
+ visible,
6107
+ sizeSyncOn,
6108
+ sizeSync,
6109
+ state.currentTargetId,
6110
+ state.backend
6111
+ ]);
6112
+ React.useEffect(function() {
6113
+ return function() {
6114
+ sizeSync.dispose();
6115
+ };
6116
+ }, [sizeSync]);
5426
6117
  React.useEffect(function() {
5427
6118
  if (imgRef.current && state.currentTargetId != null) controller.setLiveImg(imgRef.current, state.currentTargetId);
5428
6119
  if (videoRef.current && state.currentTargetId != null) controller.setLiveVideo(videoRef.current, state.currentTargetId);
@@ -5450,6 +6141,15 @@ function EgoBrowserTab(props) {
5450
6141
  state.streamGeneration
5451
6142
  ]);
5452
6143
  var h = React.createElement;
6144
+ var icon = function(svg) {
6145
+ return h("span", {
6146
+ style: {
6147
+ display: "inline-flex",
6148
+ alignItems: "center"
6149
+ },
6150
+ dangerouslySetInnerHTML: { __html: svg }
6151
+ });
6152
+ };
5453
6153
  var header = h("div", { className: "dsh-ego-side-head" }, h("span", { className: "dsh-ego-side-title" }, h("span", { dangerouslySetInnerHTML: { __html: ICON_GLOBE } }), h("span", { style: { marginLeft: "5px" } }, state.busy ? wt("titleLive") : wt("title"))), h("button", {
5454
6154
  className: "dsh-ego-side-iconbtn" + (state.busy ? " spinning" : ""),
5455
6155
  title: wt("refresh"),
@@ -5511,18 +6211,20 @@ function EgoBrowserTab(props) {
5511
6211
  var guides = [];
5512
6212
  if (state.showLoginGuide) guides.push(h(EgoLoginGuide, {
5513
6213
  key: "login",
5514
- controller
6214
+ controller,
6215
+ link: state.link
5515
6216
  }));
5516
6217
  if (state.captchaKind) guides.push(h(EgoCaptchaGuide, {
5517
6218
  key: "captcha",
5518
6219
  kind: state.captchaKind,
5519
- controller
6220
+ controller,
6221
+ link: state.link
5520
6222
  }));
5521
6223
  var tabsEl = state.spaces.length > 0 ? h("div", { className: "dsh-ego-side-tabs" }, state.spaces.map(function(s) {
5522
6224
  var isActive = s.targetId === state.selectedTabId || state.selectedTabId === null && s.targetId === state.currentTargetId;
5523
6225
  return h("div", {
5524
6226
  key: s.targetId,
5525
- className: "dsh-ego-side-tab" + (isActive ? " active" : ""),
6227
+ className: "dsh-ego-side-tab" + (isActive ? " active" : "") + (s.active === true ? " is-live" : ""),
5526
6228
  title: s.url || "",
5527
6229
  onClick: function() {
5528
6230
  controller.selectTab(s.targetId);
@@ -5623,7 +6325,70 @@ function EgoBrowserTab(props) {
5623
6325
  return null;
5624
6326
  });
5625
6327
  }
5626
- }, wt("raiseWindow"))), liveImg, h("div", { className: "dsh-ego-side-livetitle" }, currentSpace.title || currentSpace.url || wt("newTab")), h("div", { className: "dsh-ego-side-liveurl" + (state.zoomHint ? " dsh-ego-side-hint" : "") }, state.zoomHint || currentSpace.url || "")));
6328
+ }, wt("raiseWindow")), h("button", {
6329
+ className: "dsh-ego-side-back",
6330
+ type: "button",
6331
+ title: wt("pageRefreshHint"),
6332
+ onClick: reloadPage
6333
+ }, icon(ICON_REFRESH), wt("pageRefresh")), h("button", {
6334
+ className: "dsh-ego-side-back",
6335
+ type: "button",
6336
+ title: wt("openUrlHint"),
6337
+ onClick: openUrlInPanel
6338
+ }, icon(ICON_LINK), wt("openUrl")), h("button", {
6339
+ className: "dsh-ego-side-back" + (state.trackAll ? " on" : ""),
6340
+ type: "button",
6341
+ title: state.trackAll ? wt("trackAllHintOn") : wt("trackAllHintOff"),
6342
+ onClick: function() {
6343
+ controller.setTrackAll(!state.trackAll);
6344
+ }
6345
+ }, icon(state.trackAll ? ICON_GRID : ICON_SQUARE), state.trackAll ? wt("trackAllOn") : wt("trackAllOff")), h("button", {
6346
+ className: "dsh-ego-side-back" + (sizeSyncOn ? " on" : ""),
6347
+ type: "button",
6348
+ title: wt("sizeSyncHint"),
6349
+ onClick: function() {
6350
+ var next = !sizeSyncOn;
6351
+ setSizeSyncOn(next);
6352
+ sizeSync.setEnabled(next);
6353
+ if (next) sizeSync.attach(stageRef.current || imgRef.current || videoRef.current);
6354
+ }
6355
+ }, icon(sizeSyncOn ? ICON_LOCK : ICON_UNLOCK), sizeSyncOn ? wt("sizeSyncOn") : wt("sizeSyncOff")), h("button", {
6356
+ className: "dsh-ego-side-back" + (presetOpen ? " on" : ""),
6357
+ type: "button",
6358
+ title: wt("sizePresetsHint"),
6359
+ onClick: function() {
6360
+ setPresetOpen(!presetOpen);
6361
+ }
6362
+ }, icon(ICON_ASPECT), wt("sizePresets")), h("button", {
6363
+ className: "dsh-ego-side-back",
6364
+ type: "button",
6365
+ title: wt("maximizeHint"),
6366
+ onClick: maximizeWindow
6367
+ }, icon(ICON_MAXIMIZE), wt("maximizeWindow")), presetOpen ? h("div", { className: "dsh-ego-side-presets" }, SIZE_PRESETS.map(function(preset) {
6368
+ return h("button", {
6369
+ key: preset.label,
6370
+ type: "button",
6371
+ className: "dsh-ego-side-preset-item",
6372
+ onClick: function() {
6373
+ applyPreset(preset.ratio);
6374
+ }
6375
+ }, preset.label);
6376
+ })) : null), h("div", {
6377
+ className: "dsh-ego-side-stage" + (sizeSyncOn ? " dsh-ego-size-unlocked" : "") + (state.currentTargetId != null && state.currentTargetId === state.agentActiveId ? " is-live" : ""),
6378
+ ref: stageRef
6379
+ }, liveImg, h("div", {
6380
+ className: "dsh-ego-side-resize dsh-ego-side-resize-right",
6381
+ title: wt("resizeHint"),
6382
+ onPointerDown: beginResize("x")
6383
+ }), h("div", {
6384
+ className: "dsh-ego-side-resize dsh-ego-side-resize-bottom",
6385
+ title: wt("resizeHint"),
6386
+ onPointerDown: beginResize("y")
6387
+ }), h("div", {
6388
+ className: "dsh-ego-side-resize dsh-ego-side-resize-corner",
6389
+ title: wt("resizeHint"),
6390
+ onPointerDown: beginResize("xy")
6391
+ })), h("div", { className: "dsh-ego-side-livetitle" }, currentSpace.title || currentSpace.url || wt("newTab")), h("div", { className: "dsh-ego-side-liveurl" + (state.zoomHint || sizeNotice ? " dsh-ego-side-hint" : "") }, sizeNotice || state.zoomHint || currentSpace.url || "")));
5627
6392
  }
5628
6393
  return h("div", { className: "dsh-ego-side-root" }, header, guides, tabsEl, body);
5629
6394
  }
@@ -5634,7 +6399,8 @@ function EgoLoginGuide(props) {
5634
6399
  var note = noteState[0], setNote = noteState[1];
5635
6400
  var savingState = React.useState(false);
5636
6401
  var saving = savingState[0], setSaving = savingState[1];
5637
- return h("div", { className: "dsh-ego-side-login" }, h("span", { className: "dsh-ego-side-login-txt" }, wt("loginTitle")), h("button", {
6402
+ var canFlush = linkFlushable(props.link);
6403
+ return h("div", { className: "dsh-ego-side-login" }, h("span", { className: "dsh-ego-side-login-txt" }, linkLoginLine(props.link)), canFlush ? h("button", {
5638
6404
  className: "dsh-ego-side-login-btn" + (saving ? " saving" : ""),
5639
6405
  type: "button",
5640
6406
  disabled: saving,
@@ -5650,7 +6416,7 @@ function EgoLoginGuide(props) {
5650
6416
  setSaving(false);
5651
6417
  });
5652
6418
  }
5653
- }, saving ? wt("loginSaving") : wt("loginBtn")), note ? h("span", { className: "dsh-ego-side-login-note" }, note) : null, h("button", {
6419
+ }, saving ? wt("loginSaving") : wt("loginBtn")) : null, !canFlush ? h("span", { className: "dsh-ego-side-login-note" }, wt("loginSelfPersist")) : null, note ? h("span", { className: "dsh-ego-side-login-note" }, note) : null, h("button", {
5654
6420
  className: "dsh-ego-side-iconbtn",
5655
6421
  type: "button",
5656
6422
  title: wt("loginDismiss"),
@@ -5663,7 +6429,7 @@ function EgoCaptchaGuide(props) {
5663
6429
  var controller = props.controller;
5664
6430
  var kind = props.kind;
5665
6431
  var h = React.createElement;
5666
- return h("div", { className: "dsh-ego-side-captcha" }, h("span", { className: "dsh-ego-side-captcha-txt" }, h("b", null, wt("captchaTitle")), " — " + wt("captchaHint")), h("span", { className: "dsh-ego-side-captcha-kind" }, kind), h("button", {
6432
+ return h("div", { className: "dsh-ego-side-captcha" }, h("span", { className: "dsh-ego-side-captcha-txt" }, h("b", null, wt("captchaTitle")), " — " + linkCaptchaLine(props.link)), h("span", { className: "dsh-ego-side-captcha-kind" }, kind), h("button", {
5667
6433
  className: "dsh-ego-side-iconbtn",
5668
6434
  type: "button",
5669
6435
  title: wt("captchaDismiss"),