@kubohiroya/turbowarp-extension-security-dialog 0.4.0 → 0.5.1

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/NOTICE.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Image attribution
2
2
 
3
+ ## common.svg
4
+
5
+ Original to this package: a jigsaw piece outline with a serif T, drawn for it and derived from no
6
+ other work. It is embedded into `dist` as a base64 data URI by `scripts/build.mjs`, so it ships in
7
+ the published package. It replaced an earlier icon whose origin was not recorded.
8
+
3
9
  ## custom.svg
4
10
 
5
11
  { } characters from https://github.com/jesseweed/seti-ui/blob/master/icons/json.svg under the MIT License:
package/README.ja.md CHANGED
@@ -208,9 +208,9 @@ flowchart TB
208
208
  両画面とも「詳細」ボタン・ソースコードの一覧内表示はありません。ラジオボタンとチェックボックスは説明の外側、
209
209
  選択状態バッジは共通コンポーネントのスロットに配置します。
210
210
 
211
- セキュリティ確認の上部には次の案内を1回表示し、その下にメタデータ取得状況を表示します。
211
+ セキュリティ確認の上部には次の案内を1回表示します。拒否・サンドボックスあり・なし・未指定の件数は最下部に表示します。
212
212
 
213
- > ⚠️マークの表示されている拡張を制作者の意図どおりに動作させるためには『サンドボックスなし』を選択してください。
213
+ > 機能拡張を読み込みます。機能拡張の製作者が「⚠️サンドボックスなし:必要」を指定しているものがあります。あなた自身でそれに従うかどうかを選択できます。
214
214
 
215
215
  `context="catalog"` の場合だけ、フッター内のボタンより上の独立した行に「『キャンセル』で選択一覧に戻ります。」と表示します。
216
216
  プロジェクト読み込みのキャンセル確認は従来の戻り先を維持し、この案内を表示しません。
package/README.md CHANGED
@@ -94,8 +94,8 @@ Neither view includes a Details button or inline source code. Radio buttons and
94
94
  remain outside the description; selection-state badges use a slot in the shared renderer.
95
95
 
96
96
  The security dialog explains the warning badge once above the list: “To make extensions
97
- marked ⚠️ work as their creators intended, choose Without sandbox.” Metadata progress
98
- appears below it. With `context="catalog"`, a separate footer row above the buttons says
97
+ marked ⚠️ work as their creators intended, choose Without sandbox.” Decision counts
98
+ appear in the footer. With `context="catalog"`, a separate footer row above the buttons says
99
99
  “Choose Cancel to return to the selection list.” Project context retains its own cancellation
100
100
  confirmation and does not show that destination.
101
101
 
package/dist/index.cjs CHANGED
@@ -43,6 +43,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
43
43
  // src/index.js
44
44
  var index_exports = {};
45
45
  __export(index_exports, {
46
+ createExtensionWaitDialog: () => createExtensionWaitDialog,
46
47
  decodeExtensionDataURL: () => decodeExtensionDataURL,
47
48
  encodeChoices: () => encodeChoices,
48
49
  fingerprint: () => fingerprint,
@@ -231,8 +232,8 @@ var import_jszip = __toESM(require("@turbowarp/jszip"), 1);
231
232
  var DATABASE = "tw-extension-security";
232
233
  var STORE = "project-preferences";
233
234
  var validMode = (mode) => ["deny", "sandboxed", "unsandboxed"].includes(mode);
234
- var fingerprint = async (text) => {
235
- const bytes = new _TextEncoder().encode(text);
235
+ var fingerprint = async (text2) => {
236
+ const bytes = new _TextEncoder().encode(text2);
236
237
  const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
237
238
  return Array.from(new Uint8Array(digest), (value) => value.toString(16).padStart(2, "0")).join("");
238
239
  };
@@ -386,9 +387,10 @@ var messages = {
386
387
  "loadSelected": "Load selected extensions",
387
388
  "loadingExtensions": "Loading\u2026",
388
389
  "title": "Extension Security",
390
+ "maximize": "Maximize",
391
+ "restoreWindow": "Restore window",
389
392
  "intro": "Choose how to run each extension (you can choose while metadata loads).",
390
393
  "allRequiredIntro": "All extensions require Without sandbox, which is already selected. Choose OK to load the project, or Cancel to stop.",
391
- "progress": "Extension information: {done}/{total}",
392
394
  "bulk": "Apply to all listed extensions",
393
395
  "extension": "Extension",
394
396
  "deny": "Deny",
@@ -406,7 +408,6 @@ var messages = {
406
408
  "requiredToRun": "Required",
407
409
  "unsupported": "Unsupported",
408
410
  "choiceReset": "The incompatible selection was cleared. Choose how to run this extension again.",
409
- "bulkNote": "Applies only to extensions that support this mode.",
410
411
  "note": "Metadata is provided by the author.",
411
412
  "summary": "Deny {deny} \xB7 With {sandboxed} \xB7 Without {unsandboxed} \xB7 Unselected {unselected}",
412
413
  "cancel": "Cancel",
@@ -420,6 +421,9 @@ var messages = {
420
421
  "source": "Source code",
421
422
  "sourceFailed": "Could not retrieve source code.",
422
423
  "preview": "Preview for {name}",
424
+ "fetchWaitTitle": "Fetching an extension",
425
+ "fetchWaitRetry": "Could not connect. Trying again ({attempt}/{attempts})",
426
+ "fetchWaitNote": "This takes a few seconds. If it keeps failing, loading stops and the project you had open is restored.",
423
427
  "warning": "Extensions without a sandbox can access your project and browser information."
424
428
  },
425
429
  "ja": {
@@ -432,7 +436,7 @@ var messages = {
432
436
  "distributionNote": "\u914D\u5E03\u65B9\u6CD5\u3068\u5B9F\u884C\u8A31\u53EF\u306F\u5225\u306E\u8A2D\u5B9A\u3067\u3059\u3002\u4E00\u62EC\u6307\u5B9A\u3057\u305F\u5F8C\u3001\u5404\u884C\u3067\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",
433
437
  "configuredSummary": "\u8A2D\u5B9A\u3059\u308B\u6A5F\u80FD\u62E1\u5F35 {count} \u4EF6",
434
438
  "applySettings": "\u62E1\u5F35\u306E\u8A2D\u5B9A\u3092\u9069\u7528",
435
- "securityInstruction": "\u300C\u26A0\uFE0F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\uFF1A\u5FC5\u8981\u300D\u304C\u8868\u793A\u3055\u308C\u3066\u3044\u308B\u62E1\u5F35\u3092\u5236\u4F5C\u8005\u306E\u610F\u56F3\u3069\u304A\u308A\u306B\u52D5\u4F5C\u3055\u305B\u308B\u305F\u3081\u306B\u306F\u300E\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u300F\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
439
+ "securityInstruction": "\u6A5F\u80FD\u62E1\u5F35\u3092\u8AAD\u307F\u8FBC\u307F\u307E\u3059\u3002\u6A5F\u80FD\u62E1\u5F35\u306E\u88FD\u4F5C\u8005\u304C\u300C\u26A0\uFE0F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057:\u5FC5\u8981\u300D\u3092\u6307\u5B9A\u3057\u3066\u3044\u308B\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\u3042\u306A\u305F\u81EA\u8EAB\u3067\u305D\u308C\u306B\u5F93\u3046\u304B\u3069\u3046\u304B\u3092\u9078\u629E\u3067\u304D\u307E\u3059\u3002",
436
440
  "catalogCancelDestination": "\u300E\u30AD\u30E3\u30F3\u30BB\u30EB\u300F\u3067\u9078\u629E\u4E00\u89A7\u306B\u623B\u308A\u307E\u3059\u3002",
437
441
  "selectionIntro": "\u8FFD\u52A0\u3059\u308B\u6A5F\u80FD\u62E1\u5F35\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002\u4F9D\u5B58\u3059\u308B\u6A5F\u80FD\u62E1\u5F35\u3082\u81EA\u52D5\u3067\u9078\u629E\u3055\u308C\u307E\u3059\u3002",
438
442
  "documentationFor": "{name}: \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8",
@@ -465,11 +469,12 @@ var messages = {
465
469
  "loadSelected": "\u9078\u629E\u3057\u305F\u62E1\u5F35\u3092\u8AAD\u307F\u8FBC\u3080",
466
470
  "loadingExtensions": "\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026",
467
471
  "title": "\u6A5F\u80FD\u62E1\u5F35\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3",
472
+ "maximize": "\u5168\u753B\u9762\u5316",
473
+ "restoreWindow": "\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",
468
474
  "intro": "\u5B9F\u884C\u65B9\u6CD5\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u53D6\u5F97\u4E2D\u3067\u3082\u9078\u629E\u3067\u304D\u307E\u3059\uFF09",
469
475
  "allRequiredIntro": "\u3059\u3079\u3066\u306E\u6A5F\u80FD\u62E1\u5F35\u3067\u5FC5\u8981\u306A\u300C\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u300D\u3092\u9078\u629E\u6E08\u307F\u3067\u3059\u3002\u300COK\u300D\u3067\u8AAD\u307F\u8FBC\u3080\u304B\u3001\u300C\u30AD\u30E3\u30F3\u30BB\u30EB\u300D\u3067\u4E2D\u6B62\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
470
- "progress": "\u6A5F\u80FD\u62E1\u5F35\u306E\u60C5\u5831\uFF1A{done}/{total} \u4EF6\u3092\u78BA\u8A8D",
471
- "bulk": "\u8868\u793A\u4E2D\u306E\u3059\u3079\u3066\u306B\u9069\u7528",
472
- "extension": "\u6A5F\u80FD\u62E1\u5F35",
476
+ "bulk": "\u3059\u3079\u3066\u306E\u6A5F\u80FD\u62E1\u5F35\u3092\u4E00\u62EC\u3067\u6307\u5B9A",
477
+ "extension": "\u305D\u308C\u305E\u308C\u306E\u6A5F\u80FD\u62E1\u5F35\u306B\u3064\u3044\u3066\u500B\u5225\u3067\u6307\u5B9A",
473
478
  "deny": "\u62D2\u5426",
474
479
  "unsandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057",
475
480
  "sandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u3042\u308A",
@@ -485,9 +490,8 @@ var messages = {
485
490
  "requiredToRun": "\u5FC5\u8981",
486
491
  "unsupported": "\u975E\u5BFE\u5FDC",
487
492
  "choiceReset": "\u975E\u5BFE\u5FDC\u306E\u9078\u629E\u3092\u89E3\u9664\u3057\u307E\u3057\u305F\u3002\u5B9F\u884C\u65B9\u6CD5\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
488
- "bulkNote": "\u305D\u306E\u30E2\u30FC\u30C9\u306B\u5BFE\u5FDC\u3059\u308B\u62E1\u5F35\u3060\u3051\u306B\u9069\u7528\u3057\u307E\u3059\u3002",
489
- "note": "\u30E1\u30BF\u30C7\u30FC\u30BF\u306F\u88FD\u4F5C\u8005\u306E\u81EA\u5DF1\u7533\u544A\u3067\u3059\u3002",
490
- "summary": "\u62D2\u5426 {deny} \xB7 \u3042\u308A {sandboxed} \xB7 \u306A\u3057 {unsandboxed} \xB7 \u672A\u6307\u5B9A {unselected}",
493
+ "note": "\u6A5F\u80FD\u62E1\u5F35\u306E\u8AAC\u660E\u3084\u5C5E\u6027\u60C5\u5831\u306F\u3001\u305D\u308C\u305E\u308C\u306E\u6A5F\u80FD\u62E1\u5F35\u306E\u88FD\u4F5C\u8005\u306B\u3088\u308A\u8A18\u8FF0\u3055\u308C\u305F\u3082\u306E\u3067\u3059\u3002",
494
+ "summary": "\u62D2\u5426 {deny} \xB7 \u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u3042\u308A {sandboxed} \xB7 \u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057 {unsandboxed} \xB7 \u672A\u6307\u5B9A {unselected}",
491
495
  "cancel": "\u30AD\u30E3\u30F3\u30BB\u30EB",
492
496
  "ok": "OK",
493
497
  "yes": "\u306F\u3044",
@@ -499,6 +503,9 @@ var messages = {
499
503
  "source": "\u30BD\u30FC\u30B9\u30B3\u30FC\u30C9",
500
504
  "sourceFailed": "\u30BD\u30FC\u30B9\u30B3\u30FC\u30C9\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",
501
505
  "preview": "{name} \u306E\u30D7\u30EC\u30D3\u30E5\u30FC",
506
+ "fetchWaitTitle": "\u6A5F\u80FD\u62E1\u5F35\u3092\u53D6\u5F97\u3057\u3066\u3044\u307E\u3059",
507
+ "fetchWaitRetry": "\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u518D\u8A66\u884C\u3057\u3066\u3044\u307E\u3059\uFF08{attempt}/{attempts}\uFF09",
508
+ "fetchWaitNote": "\u6570\u79D2\u3067\u7D42\u308F\u308A\u307E\u3059\u3002\u305D\u308C\u3067\u3082\u53D6\u5F97\u3067\u304D\u306A\u3044\u5834\u5408\u306F\u8AAD\u307F\u8FBC\u307F\u3092\u4E2D\u6B62\u3057\u3001\u958B\u3044\u3066\u3044\u305F\u4F5C\u54C1\u306B\u623B\u3057\u307E\u3059\u3002",
502
509
  "warning": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u306E\u62E1\u5F35\u306F\u3001\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3084\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u3059\u3002"
503
510
  }
504
511
  };
@@ -508,6 +515,86 @@ var formatMessage = (locale, key, values = {}) => {
508
515
  return template.replace(/\{(\w+)\}/g, (match, name) => String(values[name] === void 0 ? match : values[name]));
509
516
  };
510
517
 
518
+ // src/wait-dialog.js
519
+ var text = (document, tag, value, className) => {
520
+ const element = document.createElement(tag);
521
+ element.textContent = value;
522
+ if (className) element.className = className;
523
+ return element;
524
+ };
525
+ function createExtensionWaitDialog(document, locale = "en", { delayMs = 300 } = {}) {
526
+ let dialog = null;
527
+ let timer = null;
528
+ let latest = null;
529
+ let disposed = false;
530
+ const label = (key) => formatMessage(locale, key, latest || {});
531
+ const render = () => {
532
+ if (!dialog) return;
533
+ dialog.querySelector('[data-twextsec-wait="attempt"]').textContent = label("fetchWaitRetry");
534
+ dialog.querySelector('[data-twextsec-wait="source"]').textContent = latest.url || "";
535
+ };
536
+ const open = () => {
537
+ timer = null;
538
+ if (disposed || dialog || !document || !document.body) return;
539
+ dialog = document.createElement("dialog");
540
+ dialog.className = "twextsec-wait";
541
+ dialog.setAttribute("data-testid", "twextsec-wait");
542
+ dialog.setAttribute("aria-live", "polite");
543
+ dialog.appendChild(text(document, "h2", formatMessage(locale, "fetchWaitTitle")));
544
+ const attempt = text(document, "p", "");
545
+ attempt.setAttribute("data-twextsec-wait", "attempt");
546
+ const source = text(document, "p", "", "twextsec-wait-source");
547
+ source.setAttribute("data-twextsec-wait", "source");
548
+ dialog.append(
549
+ attempt,
550
+ source,
551
+ text(document, "p", formatMessage(locale, "fetchWaitNote"), "twextsec-wait-note")
552
+ );
553
+ dialog.addEventListener("cancel", (event) => event.preventDefault());
554
+ document.body.appendChild(dialog);
555
+ render();
556
+ try {
557
+ if (typeof dialog.showModal === "function") dialog.showModal();
558
+ } catch (error) {
559
+ }
560
+ };
561
+ return Object.freeze({
562
+ /**
563
+ * Report the attempt now being waited for, opening the dialog once the wait looks real.
564
+ * @param {object} info The url, the attempt it leads to, and how many there are in all.
565
+ * @returns {void}
566
+ */
567
+ show(info) {
568
+ if (disposed) return;
569
+ latest = info || {};
570
+ if (dialog) render();
571
+ else if (timer === null) timer = setTimeout(open, delayMs);
572
+ },
573
+ /**
574
+ * Take it down: the fetch resolved, one way or the other.
575
+ * @returns {void}
576
+ */
577
+ hide() {
578
+ if (timer !== null) {
579
+ clearTimeout(timer);
580
+ timer = null;
581
+ }
582
+ latest = null;
583
+ if (!dialog) return;
584
+ try {
585
+ dialog.close();
586
+ } catch (error) {
587
+ }
588
+ dialog.remove();
589
+ dialog = null;
590
+ },
591
+ dispose() {
592
+ disposed = true;
593
+ this.hide();
594
+ }
595
+ });
596
+ }
597
+
511
598
  // src/selection.js
512
599
  var httpsURL = (value) => {
513
600
  if (typeof value !== "string" || !value.trim()) throw new Error("Expected an HTTPS URL");
@@ -611,7 +698,7 @@ var parseExtensionCatalog = (data) => {
611
698
  if (typeof item[field] === "string") metadata[field] = item[field];
612
699
  }
613
700
  if (item.descriptions && typeof item.descriptions === "object") {
614
- metadata.descriptions = Object.fromEntries(Object.entries(item.descriptions).filter(([locale, text]) => /^[a-z]{2,8}(?:-[a-z0-9]{1,8})*$/.test(locale) && typeof text === "string"));
701
+ metadata.descriptions = Object.fromEntries(Object.entries(item.descriptions).filter(([locale, text2]) => /^[a-z]{2,8}(?:-[a-z0-9]{1,8})*$/.test(locale) && typeof text2 === "string"));
615
702
  }
616
703
  if (item.banner) metadata.banner = httpsURL(item.banner);
617
704
  if (item.repository) metadata.repository = httpsURL(item.repository);
package/dist/index.d.ts CHANGED
@@ -41,3 +41,9 @@ export interface ExtensionSelection {
41
41
  export function resolveExtensionSelection(entries: SelectableExtension[], explicitIds?: Iterable<string>, loadedIds?: Iterable<string>): ExtensionSelection;
42
42
  export function parseExtensionCatalog(data: unknown): SelectableExtension[];
43
43
  export function loadExtensionCatalog(url: string, signal?: AbortSignal): Promise<SelectableExtension[]>;
44
+ export interface ExtensionWaitDialog {
45
+ show(info: {url?: string; attempt: number; attempts: number}): void;
46
+ hide(): void;
47
+ dispose(): void;
48
+ }
49
+ export function createExtensionWaitDialog(document: Document, locale?: string, options?: {delayMs?: number}): ExtensionWaitDialog;
package/dist/index.mjs CHANGED
@@ -182,8 +182,8 @@ import JSZip from "@turbowarp/jszip";
182
182
  var DATABASE = "tw-extension-security";
183
183
  var STORE = "project-preferences";
184
184
  var validMode = (mode) => ["deny", "sandboxed", "unsandboxed"].includes(mode);
185
- var fingerprint = async (text) => {
186
- const bytes = new _TextEncoder().encode(text);
185
+ var fingerprint = async (text2) => {
186
+ const bytes = new _TextEncoder().encode(text2);
187
187
  const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
188
188
  return Array.from(new Uint8Array(digest), (value) => value.toString(16).padStart(2, "0")).join("");
189
189
  };
@@ -337,9 +337,10 @@ var messages = {
337
337
  "loadSelected": "Load selected extensions",
338
338
  "loadingExtensions": "Loading\u2026",
339
339
  "title": "Extension Security",
340
+ "maximize": "Maximize",
341
+ "restoreWindow": "Restore window",
340
342
  "intro": "Choose how to run each extension (you can choose while metadata loads).",
341
343
  "allRequiredIntro": "All extensions require Without sandbox, which is already selected. Choose OK to load the project, or Cancel to stop.",
342
- "progress": "Extension information: {done}/{total}",
343
344
  "bulk": "Apply to all listed extensions",
344
345
  "extension": "Extension",
345
346
  "deny": "Deny",
@@ -357,7 +358,6 @@ var messages = {
357
358
  "requiredToRun": "Required",
358
359
  "unsupported": "Unsupported",
359
360
  "choiceReset": "The incompatible selection was cleared. Choose how to run this extension again.",
360
- "bulkNote": "Applies only to extensions that support this mode.",
361
361
  "note": "Metadata is provided by the author.",
362
362
  "summary": "Deny {deny} \xB7 With {sandboxed} \xB7 Without {unsandboxed} \xB7 Unselected {unselected}",
363
363
  "cancel": "Cancel",
@@ -371,6 +371,9 @@ var messages = {
371
371
  "source": "Source code",
372
372
  "sourceFailed": "Could not retrieve source code.",
373
373
  "preview": "Preview for {name}",
374
+ "fetchWaitTitle": "Fetching an extension",
375
+ "fetchWaitRetry": "Could not connect. Trying again ({attempt}/{attempts})",
376
+ "fetchWaitNote": "This takes a few seconds. If it keeps failing, loading stops and the project you had open is restored.",
374
377
  "warning": "Extensions without a sandbox can access your project and browser information."
375
378
  },
376
379
  "ja": {
@@ -383,7 +386,7 @@ var messages = {
383
386
  "distributionNote": "\u914D\u5E03\u65B9\u6CD5\u3068\u5B9F\u884C\u8A31\u53EF\u306F\u5225\u306E\u8A2D\u5B9A\u3067\u3059\u3002\u4E00\u62EC\u6307\u5B9A\u3057\u305F\u5F8C\u3001\u5404\u884C\u3067\u5909\u66F4\u3067\u304D\u307E\u3059\u3002",
384
387
  "configuredSummary": "\u8A2D\u5B9A\u3059\u308B\u6A5F\u80FD\u62E1\u5F35 {count} \u4EF6",
385
388
  "applySettings": "\u62E1\u5F35\u306E\u8A2D\u5B9A\u3092\u9069\u7528",
386
- "securityInstruction": "\u300C\u26A0\uFE0F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\uFF1A\u5FC5\u8981\u300D\u304C\u8868\u793A\u3055\u308C\u3066\u3044\u308B\u62E1\u5F35\u3092\u5236\u4F5C\u8005\u306E\u610F\u56F3\u3069\u304A\u308A\u306B\u52D5\u4F5C\u3055\u305B\u308B\u305F\u3081\u306B\u306F\u300E\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u300F\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
389
+ "securityInstruction": "\u6A5F\u80FD\u62E1\u5F35\u3092\u8AAD\u307F\u8FBC\u307F\u307E\u3059\u3002\u6A5F\u80FD\u62E1\u5F35\u306E\u88FD\u4F5C\u8005\u304C\u300C\u26A0\uFE0F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057:\u5FC5\u8981\u300D\u3092\u6307\u5B9A\u3057\u3066\u3044\u308B\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\u3042\u306A\u305F\u81EA\u8EAB\u3067\u305D\u308C\u306B\u5F93\u3046\u304B\u3069\u3046\u304B\u3092\u9078\u629E\u3067\u304D\u307E\u3059\u3002",
387
390
  "catalogCancelDestination": "\u300E\u30AD\u30E3\u30F3\u30BB\u30EB\u300F\u3067\u9078\u629E\u4E00\u89A7\u306B\u623B\u308A\u307E\u3059\u3002",
388
391
  "selectionIntro": "\u8FFD\u52A0\u3059\u308B\u6A5F\u80FD\u62E1\u5F35\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002\u4F9D\u5B58\u3059\u308B\u6A5F\u80FD\u62E1\u5F35\u3082\u81EA\u52D5\u3067\u9078\u629E\u3055\u308C\u307E\u3059\u3002",
389
392
  "documentationFor": "{name}: \u30C9\u30AD\u30E5\u30E1\u30F3\u30C8",
@@ -416,11 +419,12 @@ var messages = {
416
419
  "loadSelected": "\u9078\u629E\u3057\u305F\u62E1\u5F35\u3092\u8AAD\u307F\u8FBC\u3080",
417
420
  "loadingExtensions": "\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026",
418
421
  "title": "\u6A5F\u80FD\u62E1\u5F35\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3",
422
+ "maximize": "\u5168\u753B\u9762\u5316",
423
+ "restoreWindow": "\u5143\u306E\u30B5\u30A4\u30BA\u306B\u623B\u3059",
419
424
  "intro": "\u5B9F\u884C\u65B9\u6CD5\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u53D6\u5F97\u4E2D\u3067\u3082\u9078\u629E\u3067\u304D\u307E\u3059\uFF09",
420
425
  "allRequiredIntro": "\u3059\u3079\u3066\u306E\u6A5F\u80FD\u62E1\u5F35\u3067\u5FC5\u8981\u306A\u300C\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u300D\u3092\u9078\u629E\u6E08\u307F\u3067\u3059\u3002\u300COK\u300D\u3067\u8AAD\u307F\u8FBC\u3080\u304B\u3001\u300C\u30AD\u30E3\u30F3\u30BB\u30EB\u300D\u3067\u4E2D\u6B62\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
421
- "progress": "\u6A5F\u80FD\u62E1\u5F35\u306E\u60C5\u5831\uFF1A{done}/{total} \u4EF6\u3092\u78BA\u8A8D",
422
- "bulk": "\u8868\u793A\u4E2D\u306E\u3059\u3079\u3066\u306B\u9069\u7528",
423
- "extension": "\u6A5F\u80FD\u62E1\u5F35",
426
+ "bulk": "\u3059\u3079\u3066\u306E\u6A5F\u80FD\u62E1\u5F35\u3092\u4E00\u62EC\u3067\u6307\u5B9A",
427
+ "extension": "\u305D\u308C\u305E\u308C\u306E\u6A5F\u80FD\u62E1\u5F35\u306B\u3064\u3044\u3066\u500B\u5225\u3067\u6307\u5B9A",
424
428
  "deny": "\u62D2\u5426",
425
429
  "unsandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057",
426
430
  "sandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u3042\u308A",
@@ -436,9 +440,8 @@ var messages = {
436
440
  "requiredToRun": "\u5FC5\u8981",
437
441
  "unsupported": "\u975E\u5BFE\u5FDC",
438
442
  "choiceReset": "\u975E\u5BFE\u5FDC\u306E\u9078\u629E\u3092\u89E3\u9664\u3057\u307E\u3057\u305F\u3002\u5B9F\u884C\u65B9\u6CD5\u3092\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
439
- "bulkNote": "\u305D\u306E\u30E2\u30FC\u30C9\u306B\u5BFE\u5FDC\u3059\u308B\u62E1\u5F35\u3060\u3051\u306B\u9069\u7528\u3057\u307E\u3059\u3002",
440
- "note": "\u30E1\u30BF\u30C7\u30FC\u30BF\u306F\u88FD\u4F5C\u8005\u306E\u81EA\u5DF1\u7533\u544A\u3067\u3059\u3002",
441
- "summary": "\u62D2\u5426 {deny} \xB7 \u3042\u308A {sandboxed} \xB7 \u306A\u3057 {unsandboxed} \xB7 \u672A\u6307\u5B9A {unselected}",
443
+ "note": "\u6A5F\u80FD\u62E1\u5F35\u306E\u8AAC\u660E\u3084\u5C5E\u6027\u60C5\u5831\u306F\u3001\u305D\u308C\u305E\u308C\u306E\u6A5F\u80FD\u62E1\u5F35\u306E\u88FD\u4F5C\u8005\u306B\u3088\u308A\u8A18\u8FF0\u3055\u308C\u305F\u3082\u306E\u3067\u3059\u3002",
444
+ "summary": "\u62D2\u5426 {deny} \xB7 \u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u3042\u308A {sandboxed} \xB7 \u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057 {unsandboxed} \xB7 \u672A\u6307\u5B9A {unselected}",
442
445
  "cancel": "\u30AD\u30E3\u30F3\u30BB\u30EB",
443
446
  "ok": "OK",
444
447
  "yes": "\u306F\u3044",
@@ -450,6 +453,9 @@ var messages = {
450
453
  "source": "\u30BD\u30FC\u30B9\u30B3\u30FC\u30C9",
451
454
  "sourceFailed": "\u30BD\u30FC\u30B9\u30B3\u30FC\u30C9\u3092\u53D6\u5F97\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002",
452
455
  "preview": "{name} \u306E\u30D7\u30EC\u30D3\u30E5\u30FC",
456
+ "fetchWaitTitle": "\u6A5F\u80FD\u62E1\u5F35\u3092\u53D6\u5F97\u3057\u3066\u3044\u307E\u3059",
457
+ "fetchWaitRetry": "\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u518D\u8A66\u884C\u3057\u3066\u3044\u307E\u3059\uFF08{attempt}/{attempts}\uFF09",
458
+ "fetchWaitNote": "\u6570\u79D2\u3067\u7D42\u308F\u308A\u307E\u3059\u3002\u305D\u308C\u3067\u3082\u53D6\u5F97\u3067\u304D\u306A\u3044\u5834\u5408\u306F\u8AAD\u307F\u8FBC\u307F\u3092\u4E2D\u6B62\u3057\u3001\u958B\u3044\u3066\u3044\u305F\u4F5C\u54C1\u306B\u623B\u3057\u307E\u3059\u3002",
453
459
  "warning": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u306E\u62E1\u5F35\u306F\u3001\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3084\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u3059\u3002"
454
460
  }
455
461
  };
@@ -459,6 +465,86 @@ var formatMessage = (locale, key, values = {}) => {
459
465
  return template.replace(/\{(\w+)\}/g, (match, name) => String(values[name] === void 0 ? match : values[name]));
460
466
  };
461
467
 
468
+ // src/wait-dialog.js
469
+ var text = (document, tag, value, className) => {
470
+ const element = document.createElement(tag);
471
+ element.textContent = value;
472
+ if (className) element.className = className;
473
+ return element;
474
+ };
475
+ function createExtensionWaitDialog(document, locale = "en", { delayMs = 300 } = {}) {
476
+ let dialog = null;
477
+ let timer = null;
478
+ let latest = null;
479
+ let disposed = false;
480
+ const label = (key) => formatMessage(locale, key, latest || {});
481
+ const render = () => {
482
+ if (!dialog) return;
483
+ dialog.querySelector('[data-twextsec-wait="attempt"]').textContent = label("fetchWaitRetry");
484
+ dialog.querySelector('[data-twextsec-wait="source"]').textContent = latest.url || "";
485
+ };
486
+ const open = () => {
487
+ timer = null;
488
+ if (disposed || dialog || !document || !document.body) return;
489
+ dialog = document.createElement("dialog");
490
+ dialog.className = "twextsec-wait";
491
+ dialog.setAttribute("data-testid", "twextsec-wait");
492
+ dialog.setAttribute("aria-live", "polite");
493
+ dialog.appendChild(text(document, "h2", formatMessage(locale, "fetchWaitTitle")));
494
+ const attempt = text(document, "p", "");
495
+ attempt.setAttribute("data-twextsec-wait", "attempt");
496
+ const source = text(document, "p", "", "twextsec-wait-source");
497
+ source.setAttribute("data-twextsec-wait", "source");
498
+ dialog.append(
499
+ attempt,
500
+ source,
501
+ text(document, "p", formatMessage(locale, "fetchWaitNote"), "twextsec-wait-note")
502
+ );
503
+ dialog.addEventListener("cancel", (event) => event.preventDefault());
504
+ document.body.appendChild(dialog);
505
+ render();
506
+ try {
507
+ if (typeof dialog.showModal === "function") dialog.showModal();
508
+ } catch (error) {
509
+ }
510
+ };
511
+ return Object.freeze({
512
+ /**
513
+ * Report the attempt now being waited for, opening the dialog once the wait looks real.
514
+ * @param {object} info The url, the attempt it leads to, and how many there are in all.
515
+ * @returns {void}
516
+ */
517
+ show(info) {
518
+ if (disposed) return;
519
+ latest = info || {};
520
+ if (dialog) render();
521
+ else if (timer === null) timer = setTimeout(open, delayMs);
522
+ },
523
+ /**
524
+ * Take it down: the fetch resolved, one way or the other.
525
+ * @returns {void}
526
+ */
527
+ hide() {
528
+ if (timer !== null) {
529
+ clearTimeout(timer);
530
+ timer = null;
531
+ }
532
+ latest = null;
533
+ if (!dialog) return;
534
+ try {
535
+ dialog.close();
536
+ } catch (error) {
537
+ }
538
+ dialog.remove();
539
+ dialog = null;
540
+ },
541
+ dispose() {
542
+ disposed = true;
543
+ this.hide();
544
+ }
545
+ });
546
+ }
547
+
462
548
  // src/selection.js
463
549
  var httpsURL = (value) => {
464
550
  if (typeof value !== "string" || !value.trim()) throw new Error("Expected an HTTPS URL");
@@ -562,7 +648,7 @@ var parseExtensionCatalog = (data) => {
562
648
  if (typeof item[field] === "string") metadata[field] = item[field];
563
649
  }
564
650
  if (item.descriptions && typeof item.descriptions === "object") {
565
- metadata.descriptions = Object.fromEntries(Object.entries(item.descriptions).filter(([locale, text]) => /^[a-z]{2,8}(?:-[a-z0-9]{1,8})*$/.test(locale) && typeof text === "string"));
651
+ metadata.descriptions = Object.fromEntries(Object.entries(item.descriptions).filter(([locale, text2]) => /^[a-z]{2,8}(?:-[a-z0-9]{1,8})*$/.test(locale) && typeof text2 === "string"));
566
652
  }
567
653
  if (item.banner) metadata.banner = httpsURL(item.banner);
568
654
  if (item.repository) metadata.repository = httpsURL(item.repository);
@@ -587,6 +673,7 @@ var loadExtensionCatalog = async (url, signal) => {
587
673
  return parseExtensionCatalog(await response.json());
588
674
  };
589
675
  export {
676
+ createExtensionWaitDialog,
590
677
  decodeExtensionDataURL,
591
678
  encodeChoices,
592
679
  fingerprint,