@snagset/server 0.0.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.
Files changed (105) hide show
  1. package/README.md +83 -0
  2. package/dist/app.js +453 -0
  3. package/dist/app.js.map +1 -0
  4. package/dist/bin.js +951 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/boot.js +321 -0
  7. package/dist/boot.js.map +1 -0
  8. package/dist/config.generated.js +116 -0
  9. package/dist/config.generated.js.map +1 -0
  10. package/dist/config.js +180 -0
  11. package/dist/config.js.map +1 -0
  12. package/dist/crypto.js +26 -0
  13. package/dist/crypto.js.map +1 -0
  14. package/dist/db/connect.js +49 -0
  15. package/dist/db/connect.js.map +1 -0
  16. package/dist/db/migrate.js +210 -0
  17. package/dist/db/migrate.js.map +1 -0
  18. package/dist/db/migrations/0001_init.sql +1060 -0
  19. package/dist/db/migrations/0002_maintenance_claim.sql +109 -0
  20. package/dist/db/migrations/0003_email_provider.sql +35 -0
  21. package/dist/db/migrations/0004_unsubscribe.sql +24 -0
  22. package/dist/db/rls.js +58 -0
  23. package/dist/db/rls.js.map +1 -0
  24. package/dist/jobs/index.js +171 -0
  25. package/dist/jobs/index.js.map +1 -0
  26. package/dist/jobs/reaper.js +182 -0
  27. package/dist/jobs/reaper.js.map +1 -0
  28. package/dist/keys.js +77 -0
  29. package/dist/keys.js.map +1 -0
  30. package/dist/mail/index.js +75 -0
  31. package/dist/mail/index.js.map +1 -0
  32. package/dist/mail/mailer.js +27 -0
  33. package/dist/mail/mailer.js.map +1 -0
  34. package/dist/mail/notify.js +405 -0
  35. package/dist/mail/notify.js.map +1 -0
  36. package/dist/mail/resend.js +95 -0
  37. package/dist/mail/resend.js.map +1 -0
  38. package/dist/mail/smtp.js +315 -0
  39. package/dist/mail/smtp.js.map +1 -0
  40. package/dist/mail/unsubscribe.js +134 -0
  41. package/dist/mail/unsubscribe.js.map +1 -0
  42. package/dist/projectCache.js +50 -0
  43. package/dist/projectCache.js.map +1 -0
  44. package/dist/projects.js +101 -0
  45. package/dist/projects.js.map +1 -0
  46. package/dist/routes/attachments.js +159 -0
  47. package/dist/routes/attachments.js.map +1 -0
  48. package/dist/routes/auth.js +55 -0
  49. package/dist/routes/auth.js.map +1 -0
  50. package/dist/routes/commentEdit.js +201 -0
  51. package/dist/routes/commentEdit.js.map +1 -0
  52. package/dist/routes/comments.js +313 -0
  53. package/dist/routes/comments.js.map +1 -0
  54. package/dist/routes/cors.js +174 -0
  55. package/dist/routes/cors.js.map +1 -0
  56. package/dist/routes/jobs.js +56 -0
  57. package/dist/routes/jobs.js.map +1 -0
  58. package/dist/routes/mcpAuth.js +187 -0
  59. package/dist/routes/mcpAuth.js.map +1 -0
  60. package/dist/routes/mcpToken.js +94 -0
  61. package/dist/routes/mcpToken.js.map +1 -0
  62. package/dist/routes/owner.js +288 -0
  63. package/dist/routes/owner.js.map +1 -0
  64. package/dist/routes/reviewLinks.js +169 -0
  65. package/dist/routes/reviewLinks.js.map +1 -0
  66. package/dist/routes/rounds.js +137 -0
  67. package/dist/routes/rounds.js.map +1 -0
  68. package/dist/routes/sessions.js +349 -0
  69. package/dist/routes/sessions.js.map +1 -0
  70. package/dist/routes/sites.js +192 -0
  71. package/dist/routes/sites.js.map +1 -0
  72. package/dist/routes/threads.js +1080 -0
  73. package/dist/routes/threads.js.map +1 -0
  74. package/dist/routes/widget.js +132 -0
  75. package/dist/routes/widget.js.map +1 -0
  76. package/dist/serverless.js +97 -0
  77. package/dist/serverless.js.map +1 -0
  78. package/dist/session.js +152 -0
  79. package/dist/session.js.map +1 -0
  80. package/dist/storage/bucket.js +116 -0
  81. package/dist/storage/bucket.js.map +1 -0
  82. package/dist/storage/settings.js +132 -0
  83. package/dist/storage/settings.js.map +1 -0
  84. package/dist/vendor/adapters/index.js +1 -0
  85. package/dist/vendor/adapters/outbound/fence.js +44 -0
  86. package/dist/vendor/adapters/outbound/sanitise.js +233 -0
  87. package/dist/vendor/types/index.js +4 -0
  88. package/dist/vendor/types/names.js +254 -0
  89. package/dist/vendor/widget/object.js +38 -0
  90. package/dist/vendor/widget/predicates.js +377 -0
  91. package/package.json +53 -0
  92. package/static/dashboard/assets/index-CaPfKhFP.css +1 -0
  93. package/static/dashboard/assets/index-DfTNjHCK.js +1 -0
  94. package/static/dashboard/index.html +14 -0
  95. package/static/widget/snag.anchor-ext.js +1 -0
  96. package/static/widget/snag.anchor-fuzzy.js +1 -0
  97. package/static/widget/snag.capture.js +4 -0
  98. package/static/widget/snag.crumbs.js +4 -0
  99. package/static/widget/snag.dock.js +5 -0
  100. package/static/widget/snag.js +5 -0
  101. package/static/widget/snag.panels.js +2 -0
  102. package/static/widget/snag.runtime.js +2 -0
  103. package/static/widget/snag.screenshot.js +1 -0
  104. package/static/widget/snag.text.js +2 -0
  105. package/vercel.json +6 -0
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@snagset/server",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "The Snagset server (D63: the npm name `snagset` belongs to the MIT widget; this is what a `create-snagset` repo depends on) — Hono API + widget assets + dashboard statics + migrations, compiled into the one published npm package (foundations §10, LOCK L5/L7). Two entry points on the same createApp(deps): the Vercel serverless handler and the npx bin.",
7
+ "license": "AGPL-3.0-only",
8
+ "bin": {
9
+ "snagset": "./dist/bin.js"
10
+ },
11
+ "scripts": {
12
+ "dev": "node --experimental-strip-types --watch src/bin.ts",
13
+ "start": "node --experimental-strip-types src/bin.ts",
14
+ "migrate": "node --experimental-strip-types src/db/migrate.ts",
15
+ "typecheck": "tsc -p tsconfig.json --noEmit",
16
+ "test": "node --experimental-strip-types --test --test-concurrency=1 test/*.test.ts",
17
+ "gen:config": "node scripts/gen-config.mjs",
18
+ "gen:config:check": "node scripts/gen-config.mjs --check",
19
+ "gen:migration": "node scripts/gen-migration.mjs",
20
+ "gen:migration:check": "node scripts/gen-migration.mjs --check",
21
+ "build": "node scripts/build.mjs",
22
+ "prepack": "node scripts/build.mjs && node ../../tools/publish-manifest.mjs strip",
23
+ "postpack": "node ../../tools/publish-manifest.mjs restore"
24
+ },
25
+ "dependencies": {
26
+ "@hono/node-server": "2.1.1",
27
+ "aws4fetch": "1.0.20",
28
+ "drizzle-orm": "0.45.2",
29
+ "hono": "4.13.2",
30
+ "jose": "6.2.8",
31
+ "postgres": "3.4.9"
32
+ },
33
+ "main": "./dist/app.js",
34
+ "exports": {
35
+ ".": "./dist/app.js",
36
+ "./bin": "./dist/bin.js",
37
+ "./package.json": "./package.json",
38
+ "./serverless": "./dist/serverless.js"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "static",
43
+ "vercel.json",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "engines": {
48
+ "node": ">=22"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ }
53
+ }
@@ -0,0 +1 @@
1
+ :root{color-scheme:light dark;--ink: #16181d;--ink-soft: #5b6270;--ink-faint: #8b93a3;--bg: #f7f7f5;--surface: #ffffff;--line: #e3e3df;--line-soft: #eeeeea;--accent: #2b53d8;--accent-soft: #eaefff;--open: #b45309;--progress: #2b53d8;--review: #7c3aed;--resolved: #15803d;--mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;--sans: system-ui, -apple-system, "Segoe UI", Inter, sans-serif;--radius: 6px}@media(prefers-color-scheme:dark){:root{--ink: #e9eaee;--ink-soft: #a2a9b8;--ink-faint: #6f7789;--bg: #101216;--surface: #171a20;--line: #262a33;--line-soft: #1f232b;--accent: #7b9bff;--accent-soft: #1b2440;--open: #e5a13a;--progress: #7b9bff;--review: #b18bff;--resolved: #4ec27a}}*{box-sizing:border-box}body{margin:0;font:14px/1.5 var(--sans);color:var(--ink);background:var(--bg);-webkit-font-smoothing:antialiased}button{font:inherit;color:inherit}.shell{display:flex;flex-direction:column;height:100vh;overflow:hidden}.topbar{display:flex;align-items:center;gap:16px;padding:0 16px;height:52px;flex:none;border-bottom:1px solid var(--line);background:var(--surface)}.brand{font-weight:620;letter-spacing:-.01em;margin-inline-end:4px}.brand span{color:var(--ink-faint);font-weight:400}.topbar select{font:inherit;padding:4px 8px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);color:inherit}.spacer{flex:1}.who{color:var(--ink-soft);font-size:13px}.linkish{background:none;border:0;padding:4px 6px;color:var(--ink-soft);cursor:pointer;border-radius:var(--radius)}.linkish:hover{background:var(--line-soft);color:var(--ink)}.inbox{flex:1;display:grid;grid-template-columns:minmax(300px,380px) 1fr;min-height:0;overflow:hidden}@media(max-width:900px){.inbox{grid-template-columns:1fr}.inbox>.detail:not(.detail-open){display:none}}.list{border-inline-end:1px solid var(--line);background:var(--surface);display:flex;flex-direction:column;min-height:0}.filters{display:flex;gap:6px;padding:10px 12px;border-bottom:1px solid var(--line-soft);flex-wrap:wrap;align-items:center}.filters input[type=search]{font:inherit;flex:1;min-width:120px;padding:5px 9px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);color:inherit}.chip{font:500 12px/1 var(--sans);padding:5px 9px;border:1px solid var(--line);border-radius:999px;background:transparent;color:var(--ink-soft);cursor:pointer}.chip[aria-pressed=true]{background:var(--accent-soft);border-color:transparent;color:var(--accent)}.rows{overflow-y:auto;flex:1}.row{display:block;width:100%;text-align:start;border:0;border-bottom:1px solid var(--line-soft);background:none;padding:11px 12px;cursor:pointer}.row:hover{background:var(--line-soft)}.row[aria-current=true]{background:var(--accent-soft)}.row:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}.row-top{display:flex;align-items:center;gap:8px}.key{font:600 12px/1 var(--mono);color:var(--ink-faint)}.row-body{margin:4px 0 0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.row-meta{margin-top:5px;font-size:12px;color:var(--ink-faint);display:flex;gap:8px}.status{font:600 11px/1 var(--sans);text-transform:uppercase;letter-spacing:.04em;padding:3px 7px;border-radius:999px;border:1px solid currentColor}.status-open{color:var(--open)}.status-progress{color:var(--progress)}.status-review{color:var(--review)}.status-resolved{color:var(--resolved)}.detail{overflow-y:auto;min-height:0;padding:22px 26px 60px}.detail-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}.detail-head h1{font:600 19px/1.3 var(--sans);margin:0;letter-spacing:-.01em}.shot{margin:18px 0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:var(--surface)}.shot img{display:block;width:100%;height:auto}.shot figcaption{font:12px/1.4 var(--mono);color:var(--ink-faint);padding:7px 10px;border-top:1px solid var(--line-soft)}.no-shot{margin:18px 0;padding:22px;border:1px dashed var(--line);border-radius:var(--radius);color:var(--ink-soft);background:var(--surface)}.thread{margin:22px 0;display:flex;flex-direction:column;gap:14px}.comment{border-inline-start:2px solid var(--line);padding-inline-start:12px}.comment-head{display:flex;gap:8px;align-items:baseline;font-size:13px}.comment-head b{font-weight:600}.comment p{margin:3px 0 0;white-space:pre-wrap}.agent{font:600 10px/1 var(--sans);text-transform:uppercase;letter-spacing:.05em;padding:2px 5px;border-radius:3px;background:var(--review);color:var(--surface)}.block{margin:22px 0 0;border-top:1px solid var(--line);padding-top:14px}.block h2{font:600 11px/1 var(--sans);text-transform:uppercase;letter-spacing:.06em;color:var(--ink-faint);margin:0 0 10px}.kv{display:grid;grid-template-columns:max-content 1fr;gap:4px 14px;font-size:13px}.kv dt{color:var(--ink-soft)}.kv dd{margin:0;font-family:var(--mono);font-size:12.5px;overflow-wrap:anywhere}.warn{color:var(--open)}.actions{display:flex;gap:8px;margin:18px 0 0;flex-wrap:wrap}.btn{font:500 13px/1 var(--sans);padding:8px 12px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);cursor:pointer}.btn:hover{border-color:var(--ink-faint)}.btn-primary{background:var(--accent);border-color:transparent;color:#fff}.btn-primary:hover{filter:brightness(1.08)}.empty{padding:48px 26px;color:var(--ink-soft);max-width:46ch}.empty h2{font:600 16px/1.4 var(--sans);color:var(--ink);margin:0 0 6px}.gate{min-height:100vh;display:grid;place-items:center;padding:24px}.card{width:100%;max-width:360px;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:26px}.card h1{font:600 18px/1.3 var(--sans);margin:0 0 4px}.card p.sub{margin:0 0 18px;color:var(--ink-soft);font-size:13px}.field{display:block;margin-bottom:12px}.field span{display:block;font-size:12.5px;color:var(--ink-soft);margin-bottom:4px}.field input,.field textarea{font:inherit;width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);color:inherit}.field textarea{resize:vertical;min-height:60px}.field input:focus-visible,.field textarea:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.composer{margin:18px 0 0;max-width:480px}.composer .field{margin-bottom:8px}.composer .btn-primary{padding:8px 14px}.card .btn-primary{width:100%;padding:10px}.err{margin:0 0 14px;padding:9px 11px;border-radius:var(--radius);background:color-mix(in srgb,var(--open) 12%,transparent);color:var(--open);font-size:13px}.foot{flex:none;border-top:1px solid var(--line);padding:10px 16px;font:12px/1.4 var(--mono);color:var(--ink-faint);display:flex;gap:12px;flex-wrap:wrap}.carryover{display:block;width:100%;text-align:start;flex:none;border:0;border-bottom:1px solid color-mix(in srgb,var(--open) 35%,transparent);background:color-mix(in srgb,var(--open) 12%,transparent);color:var(--open);font:inherit;padding:9px 16px;cursor:pointer}.carryover:hover{background:color-mix(in srgb,var(--open) 20%,transparent)}.links{flex:1;display:grid;grid-template-columns:1fr minmax(300px,380px);gap:0;min-height:0;overflow:hidden}@media(max-width:900px){.links{grid-template-columns:1fr;overflow-y:auto}}.links-list{padding:22px 26px;overflow-y:auto;min-height:0}.links-title{font:600 19px/1.3 var(--sans);margin:0 0 16px;letter-spacing:-.01em}.links-side{border-inline-start:1px solid var(--line);background:var(--surface);padding:22px;overflow-y:auto;min-height:0;display:flex;flex-direction:column;gap:16px}.links-side .card{max-width:none;padding:20px}.links-side .card h2{font:600 15px/1.3 var(--sans);margin:0 0 4px}.links-side .card p.sub{margin:0 0 14px;color:var(--ink-soft);font-size:13px}.link-table{width:100%;border-collapse:collapse;font-size:13px}.link-table th{text-align:start;font:600 11px/1 var(--sans);text-transform:uppercase;letter-spacing:.05em;color:var(--ink-faint);padding:0 10px 8px 0;border-bottom:1px solid var(--line)}.link-table td{padding:10px 10px 10px 0;border-bottom:1px solid var(--line-soft);vertical-align:top}.link-table tr.link-dead{color:var(--ink-faint)}.link-round{display:inline-block;margin-inline-start:6px;font-size:11px;color:var(--ink-faint);border:1px solid var(--line);border-radius:999px;padding:1px 7px}.minted{border-color:var(--accent)}.token-box{display:flex;align-items:center;gap:8px;padding:9px 11px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg)}.token-box code{flex:1;font:12.5px/1.4 var(--mono);overflow-wrap:anywhere}.field select{font:inherit;width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);color:inherit}.sites{max-width:720px;margin:0 auto;padding:24px 20px 64px;display:flex;flex-direction:column;gap:28px}.sites h2{font-size:15px;margin:0 0 12px}.sites h3{font-size:13px;margin:20px 0 8px;color:var(--ink-soft)}.sites form{display:flex;flex-direction:column;gap:14px}.sites label{display:flex;flex-direction:column;gap:5px;font-size:13px;color:var(--ink-soft)}.sites input{font:inherit;padding:8px 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);color:inherit}.sites input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.sites small{color:var(--ink-faint);font-size:12px;line-height:1.5}.sites small code{font:11.5px/1 var(--mono)}.sites button[type=submit]{align-self:flex-start;font:inherit;padding:8px 14px;border:1px solid var(--accent);border-radius:var(--radius);background:var(--accent);color:#fff;cursor:pointer}.sites button[type=submit]:disabled{opacity:.45;cursor:default}.sites .error{color:var(--open);font-size:13px;margin:0}.site-add,.site-made,.site-list{border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);padding:18px 20px}.site-made{border-color:var(--accent)}.site-made p{font-size:13px;color:var(--ink-soft);margin:0 0 10px}.site-made pre{margin:0 0 8px;padding:11px 12px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);overflow-x:auto}.site-made pre code{font:12.5px/1.5 var(--mono);white-space:pre}.site-made form{flex-direction:row;align-items:center;gap:8px;margin-top:10px}.site-made form input{flex:1}.site-made form button{font:inherit;padding:8px 12px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);color:inherit;cursor:pointer}.origins{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:6px}.origins li code{font:11.5px/1 var(--mono);padding:4px 8px;border:1px solid var(--line);border-radius:999px;background:var(--bg)}.site-list ul{list-style:none;margin:0;padding:0}.site-list li{display:flex;align-items:baseline;gap:10px;padding:9px 0;border-bottom:1px solid var(--line-soft);font-size:13px}.site-list li:last-child{border-bottom:0}.site-list li code{font:11.5px/1 var(--mono);color:var(--ink-faint)}.site-list li span{margin-left:auto;color:var(--ink-faint);font-size:12px}.setup{max-width:460px;margin:0 auto;padding:56px 24px 64px}.setup h1{font-size:20px;margin:0 0 8px}.setup-lede{color:var(--ink-soft);font-size:13px;line-height:1.6;margin:0 0 24px}.setup form{display:flex;flex-direction:column;gap:16px}.setup label{display:flex;flex-direction:column;gap:5px;font-size:13px;color:var(--ink-soft)}.setup-opt{color:var(--ink-faint);font-weight:400}.setup input{font:inherit;padding:9px 11px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);color:inherit}.setup input:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.setup small{color:var(--ink-faint);font-size:12px;line-height:1.5}.setup button[type=submit],.setup-actions button:not(.linkish){font:inherit;padding:9px 14px;border:1px solid var(--accent);border-radius:var(--radius);background:var(--accent);color:#fff;cursor:pointer}.setup button[type=submit]:disabled{opacity:.45;cursor:default}.setup .error{color:var(--open);font-size:13px;margin:0}.setup pre{margin:0 0 12px;padding:11px 12px;border:1px solid var(--line);border-radius:var(--radius);background:var(--bg);overflow-x:auto}.setup pre code{font:12.5px/1.5 var(--mono);white-space:pre}.setup-actions{display:flex;align-items:center;gap:12px}.setup-note{color:var(--ink-faint);font-size:12.5px;line-height:1.6;margin:24px 0 0}.site-audience{display:flex;flex-direction:column;gap:8px;margin:0 0 12px}.site-audience label{display:flex;gap:9px;align-items:baseline;font-size:12.5px;color:var(--ink-soft);line-height:1.5;cursor:pointer}.site-audience input{accent-color:var(--accent)}.site-audience strong{color:var(--ink);font-weight:600}
@@ -0,0 +1 @@
1
+ (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))o(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var ee,C,Pe,U,he,Ie,xe,te,V,F,Re,le,ie,se,Q={},X=[],Be=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ne=Array.isArray;function L(e,n){for(var r in n)e[r]=n[r];return e}function ae(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function We(e,n,r){var o,i,s,l={};for(s in n)s=="key"?o=n[s]:s=="ref"?i=n[s]:l[s]=n[s];if(arguments.length>2&&(l.children=arguments.length>3?ee.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)l[s]===void 0&&(l[s]=e.defaultProps[s]);return K(e,l,o,i,null)}function K(e,n,r,o,i){var s={type:e,props:n,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Pe,__i:-1,__u:0};return i==null&&C.vnode!=null&&C.vnode(s),s}function E(e){return e.children}function J(e,n){this.props=e,this.context=n}function q(e,n){if(n==null)return e.__?q(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?q(e):null}function Ge(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],i=[],s=L({},n);s.__v=n.__v+1,C.vnode&&C.vnode(s),ce(e.__P,s,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,r??q(n),!!(32&n.__u),i),s.__v=n.__v,s.__.__k[s.__i]=s,De(o,s,i),n.__e=n.__=null,s.__e!=r&&je(s)}}function je(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),je(e)}function pe(e){(!e.__d&&(e.__d=!0)&&U.push(e)&&!Z.__r++||he!=C.debounceRendering)&&((he=C.debounceRendering)||Ie)(Z)}function Z(){try{for(var e,n=1;U.length;)U.length>n&&U.sort(xe),e=U.shift(),n=U.length,Ge(e)}finally{U.length=Z.__r=0}}function Ee(e,n,r,o,i,s,l,c,_,d,p){var k,a,h,m,y,b,f=o&&o.__k||X,v=n.length;for(_=ze(r,n,f,_,v),k=0;k<v;k++)(h=r.__k[k])!=null&&(a=h.__i!=-1&&f[h.__i]||Q,h.__i=k,b=ce(e,h,a,i,s,l,c,_,d,p),m=h.__e,h.ref&&a.ref!=h.ref&&(a.ref&&de(a.ref,null,h),p.push(h.ref,h.__c||m,h)),y==null&&m!=null&&(y=m),4&h.__u?(_=Ne(h,_,e),a.__e&&(a.__e=null)):typeof h.type=="function"&&b!==void 0?_=b:m&&(_=m.nextSibling),h.__u&=-7);return r.__e=y,_}function ze(e,n,r,o,i){var s,l,c,_,d,p=r.length,k=p,a=0;for(e.__k=new Array(i),s=0;s<i;s++)(l=n[s])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[s]=K(null,l,null,null,null):ne(l)?l=e.__k[s]=K(E,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[s]=K(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[s]=l,_=s+a,l.__=e,l.__b=e.__b+1,c=null,(d=l.__i=Ve(l,r,_,k))!=-1&&(k--,(c=r[d])&&(c.__u|=2)),c==null||c.__v==null?(d==-1&&(i>p?a--:i<p&&a++),typeof l.type!="function"&&(l.__u|=4)):d!=_&&(d==_-1?a--:d==_+1?a++:(d>_?a--:a++,l.__u|=4))):e.__k[s]=null;if(k)for(s=0;s<p;s++)(c=r[s])!=null&&(2&c.__u)==0&&(c.__e==o&&(o=q(c)),qe(c,c));return o}function Ne(e,n,r){var o,i;if(typeof e.type=="function"){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,n=Ne(o[i],n,r));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=q(e)),n=r.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Ve(e,n,r,o){var i,s,l,c=e.key,_=e.type,d=n[r],p=d!=null&&(2&d.__u)==0;if(d===null&&c==null||p&&c==d.key&&_==d.type)return r;if(o>(p?1:0)){for(i=r-1,s=r+1;i>=0||s<n.length;)if((d=n[l=i>=0?i--:s++])!=null&&(2&d.__u)==0&&c==d.key&&_==d.type)return l}return-1}function me(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||Be.test(n)?r:r+"px"}function G(e,n,r,o,i){var s,l;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(n in o)r&&n in r||me(e.style,n,"");if(r)for(n in r)o&&r[n]==o[n]||me(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")s=n!=(n=n.replace(Re,"$1")),l=n.toLowerCase(),n=l in e||n=="onFocusOut"||n=="onFocusIn"?l.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+s]=r,r?o?r[F]=o[F]:(r[F]=le,e.addEventListener(n,s?se:ie,s)):e.removeEventListener(n,s?se:ie,s);else{if(i=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function fe(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[V]==null)n[V]=le++;else if(n[V]<r[F])return;return r(C.event?C.event(n):n)}}}function ce(e,n,r,o,i,s,l,c,_,d){var p,k,a,h,m,y,b,f,v,T,N,g,u,S,A,$,j=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(_=!!(32&r.__u),s=[c=n.__e=r.__e]),(p=C.__b)&&p(n);e:if(typeof j=="function"){k=l.length;try{if(v=n.props,T=j.prototype&&j.prototype.render,N=(p=j.contextType)&&o[p.__c],g=p?N?N.props.value:p.__:o,r.__c?f=(a=n.__c=r.__c).__=a.__E:(T?n.__c=a=new j(v,g):(n.__c=a=new J(v,g),a.constructor=j,a.render=Je),N&&N.sub(a),a.state||(a.state={}),a.__n=o,h=a.__d=!0,a.__h=[],a._sb=[]),T&&a.__s==null&&(a.__s=a.state),T&&j.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=L({},a.__s)),L(a.__s,j.getDerivedStateFromProps(v,a.__s))),m=a.props,y=a.state,a.__v=n,h)T&&j.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),T&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(T&&j.getDerivedStateFromProps==null&&v!==m&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(v,g),n.__v==r.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(v,a.__s,g)===!1){n.__v!=r.__v&&(a.props=v,a.state=a.__s,a.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(O){O&&(O.__=n)}),X.push.apply(a.__h,a._sb),a._sb=[],a.__h.length&&l.push(a),c=q(r);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(v,a.__s,g),T&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(m,y,b)})}if(a.context=g,a.props=v,a.__P=e,a.__e=!1,u=C.__r,S=0,T)a.state=a.__s,a.__d=!1,u&&u(n),p=a.render(a.props,a.state,a.context),X.push.apply(a.__h,a._sb),a._sb=[];else do a.__d=!1,u&&u(n),p=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++S<25);a.state=a.__s,a.getChildContext!=null&&(o=L(L({},o),a.getChildContext())),T&&!h&&a.getSnapshotBeforeUpdate!=null&&(b=a.getSnapshotBeforeUpdate(m,y)),A=p!=null&&p.type===E&&p.key==null?Ue(p.props.children):p,c=Ee(e,ne(A)?A:[A],n,r,o,i,s,l,c,_,d),a.base=n.__e,n.__u&=-161,a.__h.length&&l.push(a),f&&(a.__E=a.__=null)}catch(O){if(l.length=k,n.__v=null,_||s!=null){if(O.then){for(n.__u|=_?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;s!=null&&(s[s.indexOf(c)]=null),n.__e=c}else if(s!=null)for($=s.length;$--;)ae(s[$])}else n.__e=r.__e;n.__k==null&&(n.__k=r.__k||[]),O.then||Le(n),C.__e(O,n,r)}}else s==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):c=n.__e=Ke(r.__e,n,r,o,i,s,l,_,d);return(p=C.diffed)&&p(n),128&n.__u?void 0:c}function Le(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Le))}function De(e,n,r){for(var o=0;o<r.length;o++)de(r[o],r[++o],r[++o]);C.__c&&C.__c(n,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){C.__e(s,i.__v)}})}function Ue(e){return typeof e!="object"||e==null||e.__b>0?e:ne(e)?e.map(Ue):e.constructor!==void 0?null:L({},e)}function Ke(e,n,r,o,i,s,l,c,_){var d,p,k,a,h,m,y,b=r.props||Q,f=n.props,v=n.type;if(v=="svg"?i="http://www.w3.org/2000/svg":v=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(d=0;d<s.length;d++)if((h=s[d])&&"setAttribute"in h==!!v&&(v?h.localName==v:h.nodeType==3)){e=h,s[d]=null;break}}if(e==null){if(v==null)return document.createTextNode(f);e=document.createElementNS(i,v,f.is&&f),c&&(C.__m&&C.__m(n,s),c=!1),s=null}if(v==null)b===f||c&&e.data==f||(e.data=f);else{if(s=v=="textarea"&&f.defaultValue!=null?null:s&&ee.call(e.childNodes),!c&&s!=null)for(b={},d=0;d<e.attributes.length;d++)b[(h=e.attributes[d]).name]=h.value;for(d in b)h=b[d],d=="dangerouslySetInnerHTML"?k=h:d=="children"||d in f||d=="value"&&"defaultValue"in f||d=="checked"&&"defaultChecked"in f||G(e,d,null,h,i);for(d in f)h=f[d],d=="children"?a=h:d=="dangerouslySetInnerHTML"?p=h:d=="value"?m=h:d=="checked"?y=h:c&&typeof h!="function"||b[d]===h||G(e,d,h,b[d],i);if(p)c||k&&(p.__html==k.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),n.__k=[];else if(k&&(e.innerHTML=""),Ee(n.type=="template"?e.content:e,ne(a)?a:[a],n,r,o,v=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,l,s?s[0]:r.__k&&q(r,0),c,_),s!=null)for(d=s.length;d--;)ae(s[d]);c&&v!="textarea"||(d="value",v=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[d]||v=="progress"&&!m||v=="option"&&m!=b[d])&&G(e,d,m,b[d],i),d="checked",y!=null&&y!=e[d]&&G(e,d,y,b[d],i))}return e}function de(e,n,r){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&n==null||(e.__u=e(n))}else e.current=n}catch(i){C.__e(i,r)}}function qe(e,n,r){var o,i;if(C.unmount&&C.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||de(o,null,n)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(s){C.__e(s,n)}o.base=o.__P=o.__n=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&qe(o[i],n,r||typeof e.type!="function");r||ae(e.__e),e.__c=e.__=e.__e=void 0}function Je(e,n,r){return this.constructor(e,r)}function Ye(e,n,r){var o,i,s,l;n==document&&(n=document.documentElement),C.__&&C.__(e,n),i=(o=!1)?null:n.__k,s=[],l=[],ce(n,e=n.__k=We(E,null,[e]),i||Q,Q,n.namespaceURI,i?null:n.firstChild?ee.call(n.childNodes):null,s,i?i.__e:n.firstChild,o,l),De(s,e,l),e.props.children=null}ee=X.slice,C={__e:function(e,n,r,o){for(var i,s,l;n=n.__;)if((i=n.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),l=i.__d),l)return i.__E=i}catch(c){e=c}throw e}},Pe=0,J.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=L({},this.state),typeof e=="function"&&(e=e(L({},r),this.props)),e&&L(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),pe(this))},J.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),pe(this))},J.prototype.render=E,U=[],Ie=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xe=function(e,n){return e.__v.__b-n.__v.__b},Z.__r=0,te=Math.random().toString(8),V="__d"+te,F="__a"+te,Re=/(PointerCapture)$|Capture$/i,le=0,ie=fe(!1),se=fe(!0);var Qe=0;function t(e,n,r,o,i,s){n||(n={});var l,c,_=n;if("ref"in _)for(c in _={},n)c=="ref"?l=n[c]:_[c]=n[c];var d={type:e,props:_,key:r,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Qe,__i:-1,__u:0,__source:i,__self:s};if(typeof e=="function"&&(l=e.defaultProps))for(c in l)_[c]===void 0&&(_[c]=l[c]);return C.vnode&&C.vnode(d),d}var B,P,re,ge,W=0,Oe=[],I=C,ve=I.__b,ye=I.__r,be=I.diffed,we=I.__c,ke=I.unmount,Se=I.__;function ue(e,n){I.__h&&I.__h(P,e,W||n),W=0;var r=P.__H||(P.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function w(e){return W=1,Xe(Fe,e)}function Xe(e,n,r){var o=ue(B++,2);if(o.t=e,!o.__c&&(o.__=[Fe(void 0,n),function(c){var _=o.__N?o.__N[0]:o.__[0],d=o.t(_,c);_!==d&&(o.__N=[d,o.__[1]],o.__c.setState({}))}],o.__c=P,!P.__f)){var i=function(c,_,d){if(!o.__c.__H)return!0;var p=!1,k=o.__c.props!==c;if(o.__c.__H.__.some(function(h){if(h.__N){p=!0;var m=h.__[0];h.__=h.__N,h.__N=void 0,m!==h.__[0]&&(k=!0)}}),s){var a=s.call(this,c,_,d);return p?a||k:a}return!p||k};P.__f=!0;var s=P.shouldComponentUpdate,l=P.componentWillUpdate;P.componentWillUpdate=function(c,_,d){if(this.__e){var p=s;s=void 0,i(c,_,d),s=p}l&&l.call(this,c,_,d)},P.shouldComponentUpdate=i}return o.__N||o.__}function M(e,n){var r=ue(B++,3);!I.__s&&Me(r.__H,n)&&(r.__=e,r.u=n,P.__H.__h.push(r))}function Ze(e){return W=5,_e(function(){return{current:e}},[])}function _e(e,n){var r=ue(B++,7);return Me(r.__H,n)&&(r.__=e(),r.__H=n,r.__h=e),r.__}function He(e,n){return W=8,_e(function(){return e},n)}function en(){for(var e;e=Oe.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(Y),n.__h.some(oe),n.__h=[]}catch(r){n.__h=[],I.__e(r,e.__v)}}}I.__b=function(e){P=null,ve&&ve(e)},I.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Se&&Se(e,n)},I.__r=function(e){ye&&ye(e),B=0;var n=(P=e.__c).__H;n&&(re===P?(n.__h=[],P.__h=[],n.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(n.__h.some(Y),n.__h.some(oe),n.__h=[],B=0)),re=P},I.diffed=function(e){be&&be(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Oe.push(n)!==1&&ge===I.requestAnimationFrame||((ge=I.requestAnimationFrame)||nn)(en)),n.__H.__.some(function(r){r.u&&(r.__H=r.u,r.u=void 0)})),re=P=null},I.__c=function(e,n){n.some(function(r){try{r.__h.some(Y),r.__h=r.__h.filter(function(o){return!o.__||oe(o)})}catch(o){n.some(function(i){i.__h&&(i.__h=[])}),n=[],I.__e(o,r.__v)}}),we&&we(e,n)},I.unmount=function(e){ke&&ke(e);var n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(o){try{Y(o)}catch(i){n=i}}),r.__H=void 0,n&&I.__e(n,r.__v))};var Ce=typeof requestAnimationFrame=="function";function nn(e){var n,r=function(){clearTimeout(o),Ce&&cancelAnimationFrame(n),setTimeout(e)},o=setTimeout(r,35);Ce&&(n=requestAnimationFrame(r))}function Y(e){var n=P,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),P=n}function oe(e){var n=P;e.__c=e.__(),P=n}function Me(e,n){return!e||e.length!==n.length||n.some(function(r,o){return r!==e[o]})}function Fe(e,n){return typeof n=="function"?n(e):n}const tn={csrf:"snag_csrf"},rn=tn.csrf,sn={csrf:"x-snagset-csrf"};class D extends Error{status;code;constructor(n,r){super(r.message),this.status=n,this.code=r.code}}function on(){for(const e of document.cookie.split(";")){const n=e.indexOf("=");if(n>0&&e.slice(0,n).trim()===rn)return e.slice(n+1).trim()}return""}async function R(e,n,r){const o=await fetch(n,{method:e,credentials:"same-origin",headers:{...r===void 0?{}:{"content-type":"application/json"},...e==="GET"?{}:{[sn.csrf]:on()}},...r===void 0?{}:{body:JSON.stringify(r)}});if(o.status===204)return;const i=await o.json().catch(()=>null);if(!o.ok){const s=i?.error;throw new D(o.status,s??{code:"unknown",message:`Request failed (${o.status}).`})}return i}const x={me:()=>R("GET","/api/v1/me"),setup:e=>R("POST","/api/v1/setup",e),login:(e,n)=>R("POST","/auth/login",{email:e,password:n}),logout:()=>R("POST","/auth/logout"),threads:(e,n={})=>{const r=new URLSearchParams;n.status&&r.set("status",n.status),n.route&&r.set("route",n.route),n.round&&r.set("round",String(n.round)),n.q&&r.set("q",n.q),n.since&&r.set("since",n.since);const o=r.toString();return R("GET",`/api/v1/projects/${encodeURIComponent(e)}/threads${o?`?${o}`:""}`)},createProject:(e,n)=>R("POST","/api/v1/projects",{name:e,origins:n}),setAudience:(e,n)=>R("PATCH",`/api/v1/projects/${encodeURIComponent(e)}`,{writeMode:n}),origins:e=>R("GET",`/api/v1/projects/${encodeURIComponent(e)}/origins`),addOrigin:(e,n)=>R("POST",`/api/v1/projects/${encodeURIComponent(e)}/origins`,{origin:n}),rounds:e=>R("GET",`/api/v1/projects/${encodeURIComponent(e)}/rounds`),createRound:(e,n)=>R("POST",`/api/v1/projects/${encodeURIComponent(e)}/rounds`,{name:n}),setStatus:(e,n,r)=>R("PATCH",`/api/v1/projects/${encodeURIComponent(e)}/threads/${encodeURIComponent(n)}`,{status:r}),addComment:(e,n)=>R("POST",`/api/v1/threads/${encodeURIComponent(e)}/comments`,{id:crypto.randomUUID(),body:n}),listLinks:e=>R("GET",`/api/v1/projects/${encodeURIComponent(e)}/review-links`),mintLink:(e,n)=>R("POST",`/api/v1/projects/${encodeURIComponent(e)}/review-links`,n),revokeLink:e=>R("DELETE",`/api/v1/review-links/${encodeURIComponent(e)}`)},ln={open:"Open",progress:"In progress",review:"Ready for review",resolved:"Resolved"};function $e(e){const n=new Date(e),r=Math.round((Date.now()-n.getTime())/6e4);return r<1?"just now":r<60?`${r}m ago`:r<1440?`${Math.round(r/60)}h ago`:n.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function an({context:e}){const n=e?.capture,r=e?.viewport,i=[["Viewport",r?.w?`${r.w} × ${r.h}`:null],["Browser",e?.browser??e?.ua??null],["Platform",e?.os??e?.platform??null],["Device pixel ratio",e?.dpr??null]].filter(([,l])=>l!=null&&l!==""),s=n?.category&&n.category!=="ok"&&n.category!=="full";return!i.length&&!n?null:t("section",{class:"block",children:[t("h2",{children:"Capture"}),i.length>0&&t("dl",{class:"kv",children:i.map(([l,c])=>t(E,{children:[t("dt",{children:l}),t("dd",{children:String(c)})]}))}),s&&t("p",{class:"warn",style:"margin:10px 0 0",children:[t("b",{children:n.category}),n.reasons?.length?` — ${n.reasons.join("; ")}`:""]}),n?.blindSpots?.length?t("p",{class:"warn",style:"margin:6px 0 0",children:[n.blindSpots.length," blind spot",n.blindSpots.length===1?"":"s",": ",n.blindSpots.join("; ")]}):null,n?.droppedCategories?.length?t("p",{class:"warn",style:"margin:6px 0 0",children:["Dropped: ",n.droppedCategories.join(", ")]}):null]})}function cn({onReply:e}){const[n,r]=w(""),[o,i]=w(!1),[s,l]=w("");return t("form",{class:"composer",onSubmit:async c=>{c.preventDefault();const _=n.trim();if(!(!_||o)){i(!0),l("");try{await e(_),r("")}catch(d){l(d instanceof D?d.message:"Could not send that reply.")}finally{i(!1)}}},children:[t("label",{class:"field",children:[t("span",{children:"Reply"}),t("textarea",{rows:3,placeholder:"Write a reply…",value:n,disabled:o,onInput:c=>r(c.target.value)})]}),s&&t("p",{class:"err",children:s}),t("button",{class:"btn btn-primary",type:"submit",disabled:o||!n.trim(),children:o?"Sending…":"Reply"})]})}function dn({thread:e,onStatus:n,onReply:r,busy:o}){const i=e.attachments?.find(c=>c.kind==="screenshot")??e.attachments?.[0],s=e.anchor?.label??"",l=e.anchor??{};return t("article",{class:"detail detail-open",children:[t("div",{class:"detail-head",children:[t("span",{class:"key",children:e.key}),t("h1",{children:s||"A comment on this page"}),t("span",{class:`status status-${e.status}`,children:ln[e.status]??e.status})]}),t("p",{style:"margin:6px 0 0;color:var(--ink-soft);font-size:13px",children:["Round ",e.roundNumber," · ",e.route||"/"," · left by ",e.createdBy.name||"someone"," ",$e(e.createdAt)]}),i?t("figure",{class:"shot",children:[t("img",{src:i.url,alt:`Screenshot of the page when ${e.key} was left`,width:i.width,height:i.height,loading:"lazy"}),t("figcaption",{children:["captured at ",i.width??"?"," × ",i.height??"?"]})]}):t("div",{class:"no-shot",children:[t("b",{children:"No screenshot for this one."}),t("p",{style:"margin:6px 0 0",children:"Either this instance had no bucket connected when it was left, or the reviewer turned the picture off for this comment. The anchor and the page context below are unaffected."})]}),t("section",{class:"thread",children:[e.comments.length===0&&t("p",{style:"color:var(--ink-soft)",children:"This thread has no readable comments."}),e.comments.map(c=>t("div",{class:"comment",children:[t("div",{class:"comment-head",children:[t("b",{children:c.author.name||"Anonymous"}),c.author.kind==="agent"&&t("span",{class:"agent",children:"agent"}),t("span",{style:"color:var(--ink-faint)",children:$e(c.createdAt)})]}),t("p",{children:c.body??t("i",{style:"color:var(--ink-faint)",children:"deleted"})})]},c.id))]}),t(cn,{onReply:r}),t("section",{class:"block",children:[t("h2",{children:"Anchor"}),t("dl",{class:"kv",children:[t("dt",{children:"State"}),t("dd",{children:e.anchorState}),s&&t(E,{children:[t("dt",{children:"Label"}),t("dd",{children:s})]}),l.css&&t(E,{children:[t("dt",{children:"Selector"}),t("dd",{children:String(l.css)})]}),l.domid&&t(E,{children:[t("dt",{children:"DOM id"}),t("dd",{children:String(l.domid)})]}),l.page?.pathname&&t(E,{children:[t("dt",{children:"Path"}),t("dd",{children:String(l.page.pathname)})]})]})]}),t(an,{context:e.context??{}}),t("div",{class:"actions",children:[e.status!=="resolved"?t("button",{class:"btn btn-primary",disabled:o,onClick:()=>n("resolved"),children:"Mark resolved"}):t("button",{class:"btn",disabled:o,onClick:()=>n("open"),children:"Reopen"}),e.status!=="progress"&&e.status!=="resolved"&&t("button",{class:"btn",disabled:o,onClick:()=>n("progress"),children:"In progress"}),l.page?.origin&&t("a",{class:"btn",href:`${l.page.origin}${l.page.pathname??"/"}?snag_t=${encodeURIComponent(e.key)}`,target:"_blank",rel:"noreferrer noopener",children:"Open on site ↗"})]})]})}function z(e){return e?new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):"—"}function un({uid:e,rounds:n}){const[r,o]=w(null),[i,s]=w(""),[l,c]=w(null),[_,d]=w(null),[p,k]=w(""),[a,h]=w("14"),[m,y]=w(""),[b,f]=w(!1),v=()=>{o(null),x.listLinks(e).then(g=>o(g.data)).catch(g=>s(g instanceof D?g.message:"Could not load the links."))};M(()=>{c(null),s(""),v()},[e]);const T=async g=>{g.preventDefault();const u=p.trim();if(!(!u||b)){f(!0),s("");try{const S=Number(a),A=Number.isFinite(S)&&S>0?new Date(Date.now()+S*864e5).toISOString():void 0,$=await x.mintLink(e,{name:u,...A?{expiresAt:A}:{},...m?{roundId:m}:{}});c($),k(""),h("14"),y(""),v()}catch(S){s(S instanceof D?S.message:"Could not create that link.")}finally{f(!1)}}},N=async g=>{if(confirm(`Revoke "${g.name}"? Every session minted from it is out within 10 s. This cannot be undone — minting a new link is the recovery.`)){d(g.id),s("");try{await x.revokeLink(g.id),c(u=>u?.id===g.id?null:u),v()}catch(u){s(u instanceof D?u.message:"Could not revoke that link.")}finally{d(null)}}};return t("div",{class:"links",children:[t("div",{class:"links-list",children:[t("h1",{class:"links-title",children:"Review links"}),i&&t("p",{class:"err",children:i}),r===null&&t("p",{class:"empty",children:"Loading…"}),r?.length===0&&t("div",{class:"empty",children:[t("h2",{children:"No links yet"}),t("p",{children:"Mint one on the right — once this project needs a link, it is the only way a reviewer gets in."})]}),r&&r.length>0&&t("table",{class:"link-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Name"}),t("th",{children:"Created"}),t("th",{children:"Expires"}),t("th",{children:"Last used"}),t("th",{children:"Uses"}),t("th",{})]})}),t("tbody",{children:r.map(g=>{const u=!!g.revokedAt,S=!u&&new Date(g.expiresAt).getTime()<=Date.now(),A=g.roundId?n?.find($=>$.id===g.roundId):null;return t("tr",{class:u||S?"link-dead":"",children:[t("td",{children:[g.name,A&&t("span",{class:"link-round",children:A.name})]}),t("td",{children:z(g.createdAt)}),t("td",{children:u?t("span",{class:"warn",children:["revoked ",z(g.revokedAt)]}):S?t("span",{class:"warn",children:"expired"}):z(g.expiresAt)}),t("td",{children:z(g.lastUsedAt)}),t("td",{children:g.useCount}),t("td",{children:!u&&t("button",{class:"btn",disabled:_===g.id,onClick:()=>void N(g),children:_===g.id?"Revoking…":"Revoke"})})]},g.id)})})]})]}),t("div",{class:"links-side",children:[l&&t("div",{class:"card minted",children:[t("h2",{children:['"',l.name,'" is ready']}),t("p",{class:"sub",children:["This is the only time the token is shown — the list on the left never carries it again. Paste it after the reviewed site's URL, e.g. ",t("code",{children:["https://yoursite.com/page",l.fragment]}),"."]}),t("div",{class:"token-box",children:[t("code",{children:l.fragment}),t("button",{class:"btn",onClick:()=>void navigator.clipboard.writeText(l.fragment).catch(()=>{}),children:"Copy"})]}),t("button",{class:"linkish",style:"margin-top:10px",onClick:()=>c(null),children:"Done"})]}),t("form",{class:"card",onSubmit:T,children:[t("h2",{children:"New link"}),t("label",{class:"field",children:[t("span",{children:"Name"}),t("input",{required:!0,placeholder:"Client review — round 2",value:p,onInput:g=>k(g.target.value)})]}),t("label",{class:"field",children:[t("span",{children:"Expires in (days, up to 90)"}),t("input",{type:"number",min:1,max:90,value:a,onInput:g=>h(g.target.value)})]}),n&&n.length>0&&t("label",{class:"field",children:[t("span",{children:"Pin to a round (optional)"}),t("select",{value:m,onChange:g=>y(g.target.value),children:[t("option",{value:"",children:"Any round"}),n.map(g=>t("option",{value:g.id,children:g.name},g.id))]})]}),t("button",{class:"btn btn-primary",type:"submit",disabled:b||!p.trim(),children:b?"Creating…":"Create link"})]})]})]})}function _n({me:e,onAdded:n,origin:r}){const[o,i]=w(""),[s,l]=w(""),[c,_]=w(!1),[d,p]=w(""),[k,a]=w(null);return t("div",{class:"sites",children:[t("section",{class:"site-add",children:[t("h2",{children:"Add a site"}),t("form",{onSubmit:async m=>{if(m.preventDefault(),!c){_(!0),p("");try{const y=await x.createProject(o.trim(),s.trim());a({uid:y.uid,name:y.name,...y.warning?{warning:y.warning}:{}}),i(""),l(""),n(y.uid)}catch(y){p(y instanceof D?y.message:"Something went wrong. Try again.")}finally{_(!1)}}},children:[t("label",{children:["Name",t("input",{value:o,placeholder:"Acme redesign",onInput:m=>i(m.target.value),required:!0})]}),t("label",{children:["Where it runs",t("input",{value:s,placeholder:"https://staging.acme.com, http://localhost:3000",onInput:m=>l(m.target.value)}),t("small",{children:["Comma-separated, with the scheme. Only these can talk to the site — a tag on any other address is ignored. ",t("code",{children:"https://*.acme.com"})," covers subdomains."]})]}),t("button",{type:"submit",disabled:c||!o.trim(),children:c?"Adding…":"Add site"}),d&&t("p",{class:"error",children:d})]})]}),k&&t(hn,{site:k,origin:r}),t("section",{class:"site-list",children:[t("h2",{children:"Your sites"}),t("ul",{children:e.projects.map(m=>t("li",{children:[t("strong",{children:m.name}),t("code",{children:m.uid}),t("span",{children:[m.threads," snag",m.threads===1?"":"s"," · ",m.unresolved," open"]})]},m.uid))})]})]})}function hn({site:e,origin:n}){const[r,o]=w([]),[i,s]=w(""),[l,c]=w(""),[_,d]=w("everyone"),[p,k]=w(""),a=y=>{const b=_;d(y),k(""),x.setAudience(e.uid,y==="everyone"?"open":"link-required").catch(()=>{d(b),k("Could not save — try again.")})},h=He(()=>{x.origins(e.uid).then(y=>o(y.origins)).catch(()=>o([]))},[e.uid]);M(h,[h]);const m=`<script src="${n}/snag.js" data-snag-site="${e.uid}" defer><\/script>`;return t("section",{class:"site-made",children:[t("h2",{children:[e.name," is ready"]}),t("p",{children:"Paste this into the site, immediately before the closing </body> tag."}),t("div",{class:"site-audience",role:"radiogroup","aria-label":"Who sees the toolbar",children:[t("label",{children:[t("input",{type:"radio",name:"audience",checked:_==="everyone",onChange:()=>a("everyone")}),t("span",{children:[t("strong",{children:"Everyone on these addresses"})," — the toolbar just appears, and anyone can comment. For staging. Saved to the server: change it here any time, no re-paste."]})]}),t("label",{children:[t("input",{type:"radio",name:"audience",checked:_==="links",onChange:()=>a("links")}),t("span",{children:[t("strong",{children:"Only people with a review link"})," — visitors see nothing. For production, where the visitors are your client's customers."]})]}),p&&t("p",{class:"error",children:p})]}),t("pre",{children:t("code",{children:m})}),t("button",{class:"linkish",onClick:()=>{navigator.clipboard?.writeText(m)},children:"Copy"}),t("h3",{children:"Allowed origins"}),r.length?t("ul",{class:"origins",children:r.map(y=>t("li",{children:t("code",{children:y})},y))}):t("p",{class:"warn",children:e.warning??"None yet — the tag will load and every request from it will be refused. Add one below."}),t("form",{onSubmit:async y=>{y.preventDefault();const b=i.trim();if(b){c("");try{const f=await x.addOrigin(e.uid,b);o(f.origins),s("")}catch(f){c(f instanceof D?f.message:"Could not add that origin.")}}},children:[t("input",{value:i,placeholder:"https://www.acme.com",onInput:y=>s(y.target.value)}),t("button",{type:"submit",disabled:!i.trim(),children:"Allow"}),l&&t("p",{class:"error",children:l})]})]})}function pn(e,n,r=[]){const o=new Set(r),i=e.filter(s=>!o.has(s.id));for(const s of n){if(o.has(s.id))continue;const l=i.findIndex(c=>c.id===s.id);l===-1?i.push(s):i[l]=s}return i}function mn({token:e,onClaimed:n}){const[r,o]=w(""),[i,s]=w(""),[l,c]=w(""),[_,d]=w(""),[p,k]=w(!1),[a,h]=w(""),[m,y]=w(null);return m?t(fn,{site:m,onContinue:n}):t("div",{class:"setup",children:[t("h1",{children:"Set up Snagset"}),t("p",{class:"setup-lede",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."}),t("form",{onSubmit:async f=>{if(f.preventDefault(),!p){k(!0),h("");try{const v=await x.setup({token:e,orgName:r.trim()||"My studio",projectName:i.trim(),email:l.trim(),password:_});y(v.project)}catch(v){h(v instanceof D?v.message:"Something went wrong. Try again.")}finally{k(!1)}}},children:[t("label",{children:["Your email",t("input",{type:"email",value:l,autocomplete:"username",required:!0,onInput:f=>c(f.target.value)})]}),t("label",{children:["Password",t("input",{type:"password",value:_,autocomplete:"new-password",required:!0,minLength:12,onInput:f=>d(f.target.value)}),t("small",{children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),t("label",{children:["Studio name ",t("span",{class:"setup-opt",children:"optional"}),t("input",{value:r,placeholder:"My studio",onInput:f=>o(f.target.value)})]}),t("label",{children:["First site ",t("span",{class:"setup-opt",children:"optional"}),t("input",{value:i,placeholder:"Acme redesign",onInput:f=>s(f.target.value)})]}),t("button",{type:"submit",disabled:p||!l.trim()||_.length<12,children:p?"Setting up…":"Create my account"}),a&&t("p",{class:"error",children:a})]})]})}function fn({site:e,onContinue:n}){const r=`<script src="${location.origin}/snag.js" data-snag-site="${e.uid}" defer><\/script>`;return t("div",{class:"setup",children:[t("h1",{children:[e.name," is ready"]}),t("p",{class:"setup-lede",children:"Paste this into the site you want reviewed, before the closing </body> tag."}),t("pre",{children:t("code",{children:r})}),t("div",{class:"setup-actions",children:[t("button",{type:"button",class:"linkish",onClick:()=>void navigator.clipboard?.writeText(r),children:"Copy"}),t("button",{type:"button",onClick:n,children:"Open the dashboard"})]}),t("p",{class:"setup-note",children:"The site's address has to be on its allow-list before comments can reach you — add it on the Sites screen. A tag on any other address loads and is ignored."})]})}const gn=["open","progress","review","resolved"],Te={open:"Open",progress:"In progress",review:"Ready",resolved:"Resolved"};function H(){const e=new URLSearchParams(location.search);return{project:e.get("project")??"",thread:e.get("t")??"",status:e.get("status")??"",q:e.get("q")??"",round:e.get("round")??"",screen:e.get("screen")??"",claim:e.get("claim")??""}}function Ae(e){const n={...H(),...e},r=new URLSearchParams;n.project&&r.set("project",n.project),n.thread&&r.set("t",n.thread),n.status&&r.set("status",n.status),n.q&&r.set("q",n.q),n.round&&r.set("round",n.round),n.screen&&r.set("screen",n.screen);const o=`${location.pathname}${r.toString()?`?${r}`:""}`;history.pushState(null,"",o)}function vn({onIn:e}){const[n,r]=w(""),[o,i]=w(""),[s,l]=w(""),[c,_]=w(!1);return t("div",{class:"gate",children:t("form",{class:"card",onSubmit:async d=>{d.preventDefault(),_(!0),l("");try{await x.login(n,o),e()}catch(p){l(p instanceof D?p.message:"Could not reach the server.")}finally{_(!1)}},children:[t("h1",{children:"Sign in"}),t("p",{class:"sub",children:"The studio side of Snagset. Reviewers do not sign in — they open a link."}),s&&t("p",{class:"err",children:s}),t("label",{class:"field",children:[t("span",{children:"Email"}),t("input",{type:"email",autocomplete:"username",required:!0,value:n,onInput:d=>r(d.target.value)})]}),t("label",{class:"field",children:[t("span",{children:"Password"}),t("input",{type:"password",autocomplete:"current-password",required:!0,value:o,onInput:d=>i(d.target.value)})]}),t("button",{class:"btn btn-primary",disabled:c,children:c?"Signing in…":"Sign in"}),t("p",{class:"sub",style:"margin:14px 0 0",children:["Forgotten it? There is no reset email on a fresh install — set a new one from the machine that runs the server: ",t("code",{children:"snagset passwd you@example.com"})]})]})})}function yn(){const[e,n]=w(null),[r,o]=w("loading"),[i,s]=w(H()),[l,c]=w(null),_=Ze(null),[d,p]=w(!1),[k,a]=w(null),[h,m]=w(null),y=He(async()=>{try{const u=await x.me();n(u),o("in"),!H().project&&u.projects[0]&&(Ae({project:u.projects[0].uid}),s(H()))}catch{o("out")}},[]);M(()=>{y(),fetch("/api/v1/meta").then(S=>S.json()).then(a).catch(()=>{});const u=()=>s(H());return addEventListener("popstate",u),()=>removeEventListener("popstate",u)},[y]);const b=i.project;M(()=>{if(r!=="in"||!b)return;let u=!0;return m(null),x.rounds(b).then(S=>u&&m(S.data)).catch(()=>u&&m([])),()=>{u=!1}},[r,b]);const f=i.round?Number(i.round):h?.[0]?.number??null;M(()=>{if(r!=="in"||!b||f===null)return;let u=!0;return c(null),x.threads(b,{round:f,...i.status?{status:i.status}:{},...i.q?{q:i.q}:{}}).then(S=>{u&&(c(S.data),_.current=S.serverTime)}).catch(()=>u&&c([])),()=>{u=!1}},[r,b,f,i.status,i.q]),M(()=>{if(r!=="in"||!b)return;let u=0;const S=()=>{if(document.hidden||!_.current)return;const A=Date.now();A-u<3e4||(u=A,x.threads(b,{...f===null?{}:{round:f},since:_.current,...i.status?{status:i.status}:{},...i.q?{q:i.q}:{}}).then($=>{_.current=$.serverTime,!(!$.data.length&&!$.deleted?.length)&&c(j=>j&&pn(j,$.data,$.deleted))}).catch(()=>{}))};return document.addEventListener("visibilitychange",S),()=>document.removeEventListener("visibilitychange",S)},[r,b,f,i.status,i.q]);const v=_e(()=>l?.find(u=>u.key===i.thread)??null,[l,i.thread]),T=u=>{Ae(u),s(H())};if(r==="loading")return t("div",{class:"empty",children:"Loading…"});if(r==="out"&&i.claim)return t(mn,{token:i.claim,onClaimed:()=>void y()});if(r==="out")return t(vn,{onIn:()=>void y()});const N=async u=>{if(v){p(!0);try{const S=await x.setStatus(b,v.id,u);c(A=>A?.map($=>$.id===S.id?{...$,...S}:$)??A)}finally{p(!1)}}},g=async u=>{if(!v)return;const S=await x.addComment(v.id,u);c(A=>A?.map($=>$.id===v.id?{...$,comments:[...$.comments,S],commentCount:$.commentCount+1}:$)??A)};return t("div",{class:"shell",children:[t("header",{class:"topbar",children:[t("div",{class:"brand",children:["Snagset ",t("span",{children:"studio"})]}),t("select",{value:b,onChange:u=>T({project:u.target.value,thread:""}),children:e.projects.map(u=>t("option",{value:u.uid,children:[u.name," · ",u.unresolved," open"]},u.uid))}),h&&h.length>0&&t("select",{value:String(f??""),onChange:u=>T({round:u.target.value,thread:""}),children:h.map(u=>t("option",{value:String(u.number),children:[u.name,u.closed?" (closed)":""," · ",u.unresolved," open"]},u.id))}),t("button",{class:"linkish",title:"Start a new round. The page goes clean; nothing is deleted.",onClick:async()=>{const u=(h?.[0]?.number??0)+1,S=prompt("Name for the new round",`Round ${u}`);if(S===null)return;const A=await x.createRound(b,S).catch(()=>null);if(!A)return;const $=await x.rounds(b).catch(()=>null);$&&m($.data),T({round:String(A.number),thread:""})},children:"+ Round"}),t("button",{class:"linkish","aria-pressed":i.screen==="links",onClick:()=>T({screen:i.screen==="links"?"":"links",thread:""}),children:"Links"}),t("button",{class:"linkish","aria-pressed":i.screen==="sites",onClick:()=>T({screen:i.screen==="sites"?"":"sites",thread:""}),children:"Sites"}),t("div",{class:"spacer"}),t("span",{class:"who",children:e.user.email}),t("button",{class:"linkish",onClick:async()=>{await x.logout().catch(()=>{}),o("out")},children:"Sign out"})]}),i.screen==="sites"?t(_n,{me:e,origin:location.origin,onAdded:async u=>{const S=await x.me().catch(()=>null);S&&n(S),T({project:u,thread:""})}}):i.screen==="links"?t(un,{uid:b,rounds:h}):t(E,{children:[h&&f!==null&&t(E,{children:h.filter(u=>u.number!==f&&u.unresolved>0).map(u=>t("button",{class:"carryover",onClick:()=>T({round:String(u.number),thread:""}),children:[t("b",{children:[u.unresolved," unresolved"]})," in ",u.name," — still open, not carried over. Go there ↗"]},u.id))}),t("div",{class:"inbox",children:[t("div",{class:"list",children:[t("div",{class:"filters",children:[t("input",{type:"search",placeholder:"Search comments",value:i.q,onInput:u=>T({q:u.target.value})}),gn.map(u=>t("button",{class:"chip","aria-pressed":i.status===u,onClick:()=>T({status:i.status===u?"":u}),children:Te[u]},u))]}),t("div",{class:"rows",children:[l===null&&t("p",{class:"empty",children:"Loading…"}),l?.length===0&&t("div",{class:"empty",children:[t("h2",{children:"Nothing here"}),t("p",{children:i.q||i.status?"No comment matches that filter.":"No comments on this project yet. Paste the script tag on the site and click something."})]}),l?.map(u=>t("button",{class:"row","aria-current":u.key===i.thread,onClick:()=>T({thread:u.key}),children:[t("div",{class:"row-top",children:[t("span",{class:"key",children:u.key}),t("span",{class:`status status-${u.status}`,children:Te[u.status]})]}),t("p",{class:"row-body",children:u.comments[0]?.body??u.anchor?.label??"(no comment)"}),t("div",{class:"row-meta",children:[t("span",{children:u.route||"/"}),t("span",{children:"·"}),t("span",{children:u.createdBy.name||"someone"}),u.attachments?.length?t("span",{children:"· 📷"}):null]})]},u.id))]})]}),v?t(dn,{thread:v,onStatus:u=>void N(u),onReply:g,busy:d}):t("div",{class:"empty",children:[t("h2",{children:"Pick a comment"}),t("p",{children:"Its screenshot, the thread, the anchor and the page context all open here."})]})]})]}),t("footer",{class:"foot",children:[t("span",{children:[e.org.name," · ",k?.version??"…"]}),k?.commit&&t("span",{children:k.commit.slice(0,8)})]})]})}Ye(t(yn,{}),document.getElementById("app"));
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="color-scheme" content="light dark" />
7
+ <title>Snagset</title>
8
+ <script type="module" crossorigin src="/assets/index-DfTNjHCK.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-CaPfKhFP.css">
10
+ </head>
11
+ <body>
12
+ <div id="app"></div>
13
+ </body>
14
+ </html>
@@ -0,0 +1 @@
1
+ const L={root:"data-snag-root"},W=t=>L[t],C=256,H=/[\u200B-\u200D\u2060\uFEFF]/gu,P=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,X=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function m(t){let e=t.normalize("NFC").replace(H,"");for(const[n,r]of X)e=e.replace(n,r);return e.replace(P," ").trim()}function M(t){const e=` ${t} `,n=new Set;for(let r=0;r<e.length-2;r++)n.add(e.slice(r,r+3));return n}function b(t,e){const n=m(t).slice(0,C),r=m(e).slice(0,C);if(n===r)return 1;if(!n||!r)return 0;const i=M(n),o=M(r);if(i.size===0||o.size===0)return 0;let a=0;for(const s of i)o.has(s)&&a++;return 2*a/(i.size+o.size)}function k(t,e){if(t.length===0&&e.length===0)return 1;const n=Math.max(t.length,e.length);if(n===0)return 1;let r=0;for(;r<t.length&&r<e.length&&N(t[t.length-1-r])===N(e[e.length-1-r]);)r++;return r/n}function N(t){return t.split(":")[0].toLowerCase()}const $={testid:1,domid:1,css:.9,aria:.75,"text-exact":.8,"text-fuzzy":.78,"path-rect":.35,none:0,manual:1},V=new Set(["testid","domid"]),E={anchored:.75,approximate:.35},u={tag:.15,role:.2,name:.25,text:.3,path:.1},j=t=>t<0?0:t>1?1:t;function T(t,e){let n=0,r=0;const i=e.path?.at(-1)?.split(":")[0];return i&&(n+=u.tag,t.tagName.toLowerCase()===i.toLowerCase()&&(r+=u.tag)),e.role&&(n+=u.role,t.role===e.role&&(r+=u.role)),e.accessibleName&&(n+=u.name,r+=u.name*b(t.accessibleName??"",e.accessibleName)),e.text?.exact&&(n+=u.text,r+=u.text*b(m(t.textContent??"").slice(0,512),e.text.exact)),e.path?.length&&(n+=u.path,r+=u.path*k(t.path??[],e.path)),n===0?1:r/n}function K(t,e,n){return t===1?1:e-n>=.15?.92:1/(1+Math.log2(t))}function S(t){const e=V.has(t.strategy)?.85+.15*t.corroboration:.6+.4*t.corroboration;let n=$[t.strategy]*(t.quality??1)*e*t.ambiguity;return t.strategy==="text-fuzzy"&&(n=Math.min(n,.74)),j(n)}function O(t){return t>=E.anchored?"anchored":t>=E.approximate?"approximate":"orphaned"}function U(t){return t.getBoundingClientRect()}function Q(t){if(t.closest('[inert],[aria-hidden="true"]'))return!1;const e=t.checkVisibility;if(typeof e=="function")return e.call(t,{contentVisibilityAuto:!0,opacityProperty:!1,visibilityProperty:!0});const n=U(t);if(!(n.width>0||n.height>0||t.getClientRects().length>0))return!1;const i=t.ownerDocument?.defaultView;return i?i.getComputedStyle(t).visibility!=="hidden":!0}const Y=256,Z=12;function v(t,e=Z){const n=[];let r=t;for(;r&&r.nodeType===1&&n.length<e;){const i=r.tagName.toLowerCase();if(i==="html")break;const o=r.parentElement;if(o){const a=[...o.children].filter(s=>s.tagName===r.tagName);n.push(a.length>1?`${i}:nth-of-type(${a.indexOf(r)+1})`:i)}else n.push(i);r=o}return n.reverse()}function D(t){const e=t.getAttribute("role");if(e)return e;const n=t.tagName.toLowerCase();if(n==="button")return"button";if(n==="a"&&t.hasAttribute("href"))return"link";if(n==="input"){const r=(t.getAttribute("type")??"text").toLowerCase();return r==="checkbox"||r==="radio"||r==="button"||r==="submit"?r==="submit"?"button":r:"textbox"}if(/^h[1-6]$/.test(n))return"heading";if(n==="nav")return"navigation";if(n==="img")return"img"}function z(t){const e=t.getAttribute("aria-label");if(e?.trim())return e.trim();const n=t.getAttribute("aria-labelledby");if(n){const o=n.split(/\s+/).map(a=>t.ownerDocument.getElementById(a)?.textContent??"").join(" ").trim();if(o)return o}const r=t.getAttribute("alt")??t.getAttribute("title");if(r?.trim())return r.trim();const i=(t.textContent??"").trim();return i?i.slice(0,Y):void 0}function I(t){return t<480?"xs":t<768?"sm":t<1024?"md":t<1440?"lg":"xl"}function B(){return{names:new WeakMap}}const G="[role], a[href], button, input, select, textarea, h1, h2, h3, h4, h5, h6, img, nav, main, [aria-label]",J=2e3,tt=200;function et(t,e){if(e.names.has(t))return e.names.get(t);const n=z(t);return e.names.set(t,n),n}function nt(t,e){if(e.ariaIndex)return e.ariaIndex;const n=new Map;let r=0;for(const i of t.querySelectorAll(G)){if(!x(i))continue;if(++r>J){e.ariaTruncated=!0;break}const o=D(i);if(!o)continue;const a=et(i,e);if(!a)continue;const s=n.get(o)??[];s.push({el:i,name:a}),n.set(o,s)}return e.ariaIndex=n,n}function rt(t,e){if(e.textMap)return e.textMap;const n=new Map;for(const r of t.querySelectorAll("*")){if(r.children.length>0||!x(r))continue;const i=m(r.textContent??"");if(!i)continue;const o=n.get(i)??[];o.push(r),n.set(i,o)}return e.textMap=n,n}const x=t=>!t.closest(`[${W("root")}]`);function it(t,e){return[...t.querySelectorAll(e)].filter(x)}function y(t,e){try{return it(t,e)}catch{return[]}}const ot=[{strategy:"aria",applicable:t=>!!t.role&&!!t.accessibleName,find:(t,e,n)=>{const r=nt(e,n).get(t.role)??[],i=[];for(const{el:o,name:a}of r.slice(0,tt))b(a,t.accessibleName)>=.9&&i.push(o);return i}},{strategy:"text-exact",applicable:t=>!!t.text?.exact,find:(t,e,n)=>rt(e,n).get(t.text.exact)??[]},{strategy:"path-rect",applicable:t=>!!t.path?.length,find:(t,e)=>{const n=t.path,r=y(e,n.join(" > "));if(r.length)return r.slice(0,50);const i=[...n];let o=0;for(let a=i.length-1;a>=0&&o<4;a--){const s=i[a].split(":")[0];if(s===i[a])continue;i[a]=s,o++;const c=y(e,i.join(" > "));if(c.length)return c.slice(0,50)}for(let a=1;a<=3&&a<n.length;a++){const s=y(e,n.slice(a).join(" > "));if(s.length)return s.slice(0,50)}return[]},quality:(t,e)=>k(v(t),e.path??[])}],w=t=>Math.min(1,Math.max(0,t));function at(t,e,n,r){const i=e.rect;if(!i||i.w<1||i.h<1)return 0;const o=t.getBoundingClientRect();if(o.width<1||o.height<1)return 0;const a=o.width*o.height/(i.w*i.h),s=o.width/o.height/(i.w/i.h),c=(1-w(Math.abs(Math.log2(a))/3))*(1-w(Math.abs(Math.log2(s))/2)),d=n?1-w(Math.hypot(o.x+r.scrollX-i.x,o.y+r.scrollY-i.y)/(2*r.innerHeight)):0;return .05*(.6*c+.4*d)}function R(t){return{tagName:t.tagName,role:D(t),accessibleName:z(t),textContent:t.textContent??"",path:v(t)}}const st={corroborate:(t,e)=>T(R(t),e),finalScore:S,stateFor:O},ut=(t,e,n)=>{const r=n.caches??B(),i=[],o=!!t.breakpoint&&!!n.viewportWidth&&t.breakpoint!==I(n.viewportWidth),a=!!t.breakpoint&&!!n.viewportWidth&&t.breakpoint===I(n.viewportWidth);for(const s of ot){if(!s.applicable(t))continue;const c=s.find(t,e,r);if(c.length===0)continue;if(s.strategy==="path-rect"&&o)return{element:null,strategy:"path-rect",score:0,state:"orphaned",reasons:["breakpoint"],candidates:0};const d=e.defaultView??e.ownerDocument?.defaultView??window,h=c.map(f=>{const p=T(R(f),t),A=s.quality?.(f,t)??1,_=s.strategy==="path-rect"?at(f,t,a,d):0;return{el:f,raw:p*A+_,c:p,q:A}}).sort((f,p)=>p.raw-f.raw),g=h[0],q=h[1]?.raw??0,F=K(h.length,g.raw,q);let l=S({strategy:s.strategy,quality:g.q,corroboration:g.c,ambiguity:F});return h.length>1&&i.push("ambiguous"),Q(g.el)||(i.push("hidden"),l=Math.min(l,.7)),s.strategy==="aria"&&r.ariaTruncated&&(i.push("index-truncated"),l=Math.min(l,.7)),{element:g.el,strategy:s.strategy,score:l,state:O(l),reasons:i.length?i:["exact"],candidates:h.length}}return null};export{B as createPassCaches,st as fuzzyDeps,ut as resolveExtended};
@@ -0,0 +1 @@
1
+ function x(e){return e.split("").reverse().join("")}function O(e,n,r){const s=x(n);return r.map(t=>{const a=Math.max(0,t.end-n.length-t.errors),g=x(e.slice(a,t.end));return{start:R(g,s,t.errors).reduce((h,c)=>t.end-c.end<h?t.end-c.end:h,t.end),end:t.end,errors:t.errors}})}function k(e){return(e|-e)>>31&1}function P(e,n,r,s){let t=e.P[r],a=e.M[r];const g=s>>>31,w=n[r]|g,h=w|a,c=(w&t)+t^t|w;let i=a|~(c|t),u=t&c;const o=k(i&e.lastRowMask[r])-k(u&e.lastRowMask[r]);return i<<=1,u<<=1,u|=g,i|=k(s)-g,t=u|~(h|i),a=i&h,e.P[r]=t,e.M[r]=a,o}function R(e,n,r){if(n.length===0)return[];r=Math.min(r,n.length);const s=[],t=32,a=Math.ceil(n.length/t)-1,g={P:new Uint32Array(a+1),M:new Uint32Array(a+1),lastRowMask:new Uint32Array(a+1)};g.lastRowMask.fill(1<<31),g.lastRowMask[a]=1<<(n.length-1)%t;const w=new Uint32Array(a+1),h=new Map,c=[];for(let o=0;o<256;o++)c.push(w);for(let o=0;o<n.length;o+=1){const f=n.charCodeAt(o);if(h.has(f))continue;const l=new Uint32Array(a+1);h.set(f,l),f<c.length&&(c[f]=l);for(let p=0;p<=a;p+=1){l[p]=0;for(let m=0;m<t;m+=1){const S=p*t+m;if(S>=n.length)continue;n.charCodeAt(S)===f&&(l[p]|=1<<m)}}}let i=Math.max(0,Math.ceil(r/t)-1);const u=new Uint32Array(a+1);for(let o=0;o<=i;o+=1)u[o]=(o+1)*t;u[a]=n.length;for(let o=0;o<=i;o+=1)g.P[o]=-1,g.M[o]=0;for(let o=0;o<e.length;o+=1){const f=e.charCodeAt(o);let l;f<c.length?l=c[f]:(l=h.get(f),typeof l>"u"&&(l=w));let p=0;for(let m=0;m<=i;m+=1)p=P(g,l,m,p),u[m]+=p;if(u[i]-p<=r&&i<a&&(l[i+1]&1||p<0)){i+=1,g.P[i]=-1,g.M[i]=0;let m;if(i===a){const S=n.length%t;m=S===0?t:S}else m=t;u[i]=u[i-1]+m-p+P(g,l,i,p)}else for(;i>0&&u[i]>=r+t;)i-=1;i===a&&u[i]<=r&&(u[i]<r&&s.splice(0,s.length),s.push({start:-1,end:o+1,errors:u[i]}),r=u[i])}return s}function N(e,n,r){const s=R(e,n,r);return O(e,n,s)}const W={root:"data-snag-root"},z=e=>W[e],L={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},H=e=>L[e];function Z(e){return e.getBoundingClientRect()}function V(e){if(e.closest('[inert],[aria-hidden="true"]'))return!1;const n=e.checkVisibility;if(typeof n=="function")return n.call(e,{contentVisibilityAuto:!0,opacityProperty:!1,visibilityProperty:!0});const r=Z(e);if(!(r.width>0||r.height>0||e.getClientRects().length>0))return!1;const t=e.ownerDocument?.defaultView;return t?t.getComputedStyle(e).visibility!=="hidden":!0}const T=4,C=typeof scheduler<"u"&&"yield"in scheduler?()=>scheduler.yield():()=>new Promise(e=>{const{port1:n,port2:r}=new MessageChannel;n.onmessage=()=>{n.close(),e()},r.postMessage(0)}),q=5e5,j=["script","style","noscript","template","svg",'[aria-hidden="true"]',`[${H("ignore")}]`].join(","),K=/[\u200B-\u200D\u2060\uFEFF]/,X=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;function Y(e){return"\u2018\u2019\u201A\u201B".includes(e)?"'":"\u201C\u201D\u201E\u201F".includes(e)?'"':"\u2010"<=e&&e<="\u2015"||e==="\u2212"?"-":e==="\u2026"?"...":e==="\u2044"?"/":e}function $(e,n,r){for(const s of e)if(!K.test(s)){if(X.test(s)){if(n.lastWasSpace)continue;if(n.lastWasSpace=!0,!r(" "))return;continue}n.lastWasSpace=!1;for(const t of Y(s))if(!r(t))return}}const G=new Set(["A","ABBR","B","BDI","BDO","CITE","CODE","DATA","DFN","EM","I","KBD","LABEL","MARK","Q","S","SAMP","SMALL","SPAN","STRONG","SUB","SUP","TIME","U","VAR","WBR"]);function Q(e){let n=e.parentElement;for(;n&&G.has(n.tagName);)n=n.parentElement;return n}async function J(e=document.body){return ee(e)}function ee(e,n){const r=e.ownerDocument??e,s=`[${z("root")}]`,t=new Map,a=new Map,g=d=>{const M=a.get(d);if(M!==void 0)return M;let y;return d.matches(j)||d.matches(s)?y=!0:d.parentElement?y=g(d.parentElement):y=!1,a.set(d,y),y},w=d=>{const M=t.get(d);if(M!==void 0)return M;const y=V(d);return t.set(d,y),y},h=r.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(d){const M=d.parentElement;return!M||g(M)||!w(M)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),c=[],i=[],u={lastWasSpace:!1};let o=0,f=!1,l=null,p=performance.now();const m=d=>{const M=Q(d);l&&M!==l&&!u.lastWasSpace&&(c.push(" "),o+=1,u.lastWasSpace=!0),l=M;const y=o;let A=!1;return $(d.data.normalize("NFC"),u,E=>o>=q?(A=!0,!1):(c.push(E),o+=1,!0)),o>y&&i.push({node:d,flatStart:y,flatEnd:o}),A?(f=!0,!1):!0},S=()=>({text:c.join(""),segments:i,truncated:f,epoch:0,builtAt:Date.now()});return(async()=>{for(let d=h.nextNode();d&&m(d);d=h.nextNode())performance.now()-p>=T&&(await C(),p=performance.now());return S()})()}const te=/[\u200B-\u200D\u2060\uFEFF]/gu,ne=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,re=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function b(e){let n=e.normalize("NFC").replace(te,"");for(const[r,s]of re)n=n.replace(r,s);return n.replace(ne," ").trim()}const oe="anchor-fuzzy",F=2e4,I=8,B=50,se=/^[\p{P}\p{S}\s]*$/u;function D(e){return e<8?0:e<32?Math.max(2,Math.floor(e/4)):Math.min(256,Math.floor(e/2))}function _(e,n){if(!n||!e)return 0;const r=N(e,n,Math.floor(n.length/2));if(r.length===0)return 0;let s=n.length;for(const t of r)t.errors<s&&(s=t.errors);return 1-s/n.length}async function U(e,n,r={}){const s=b(n.exact);if(s.length<8||se.test(s))return null;const t=e.text,a=[];for(let c=t.indexOf(s);c!==-1&&(a.push({start:c,end:c+s.length,errors:0}),!(a.length>=50));c=t.indexOf(s,c+1));if(a.length===0){const c=D(s.length),i=s.length+c;let u=performance.now();for(let o=0;o<t.length;o+=F){if(r.budget&&!r.budget())return null;const f=Math.min(t.length,o+F+i);for(const l of N(t.slice(o,f),s,c))if(a.push({start:o+l.start,end:o+l.end,errors:l.errors}),l.errors===0)break;if(a.some(l=>l.errors===0)||(performance.now()-u>=T&&(await C(),u=performance.now()),f===t.length))break}}if(a.length===0)return null;const g=n.prefix?b(n.prefix):"",w=n.suffix?b(n.suffix):"";let h=null;for(const c of a){let i=50,u=50*(1-c.errors/s.length);g&&(i+=20,u+=20*_(t.slice(Math.max(0,c.start-g.length),c.start),g)),w&&(i+=20,u+=20*_(t.slice(c.end,c.end+w.length),w)),r.hint!==void 0&&t.length>0&&(i+=2,u+=2*(1-Math.abs(c.start-r.hint)/t.length));const o=u/i;(!h||o>h.score)&&(h={...c,score:o})}return h&&h.score>=.5?h:null}function ie(e,n){let r=0,s=e.segments.length-1;for(;r<=s;){const t=r+s>>1,a=e.segments[t];if(n<a.flatStart)s=t-1;else if(n>=a.flatEnd)r=t+1;else return a.node.parentElement}return e.segments[Math.min(r,e.segments.length-1)]?.node.parentElement??null}function ae(e,n){const r=[],s=new Set,t=new Map;let a=null,g=0,w=!1,h=!1;const c=async()=>((!a||performance.now()-g>5e3)&&(a=await J(e.body),g=performance.now()),a);async function i(){if(!(w||h)){w=!0;try{const o=performance.now(),f=()=>performance.now()-o<B;let l=0;for(;r.length>0&&l<I&&f();){if(e.hidden)return;const p=r.shift();s.delete(p.id),l++;const m=await c(),S=p.rec,d=await U(m,S.text,{budget:f});if(h)return;if(!d)continue;const M=ie(m,d.start);if(!M||!M.isConnected)continue;const y=n.corroborate(M,S);let A=n.finalScore({strategy:"text-fuzzy",quality:d.score,corroboration:y,ambiguity:1});const E=["fuzzy"];if(m.truncated&&(A=Math.min(A,.7),E.push("index-truncated")),A<.35)continue;const v={element:M,strategy:"text-fuzzy",score:A,state:n.stateFor(A),reasons:E,candidates:1};t.set(p.id,v),p.onSettle(v)}}finally{w=!1}r.length>0&&!e.hidden&&!h&&(await C(),i())}}const u=()=>{e.hidden||i()};return e.addEventListener("visibilitychange",u),{enqueue(o,f,l){h||s.has(o)||t.has(o)||!f.text?.exact||b(f.text.exact).length<8||(s.add(o),r.push({id:o,rec:f,onSettle:l}),i())},hit(o){const f=t.get(o)??null;return f&&f.element&&!f.element.isConnected?(t.delete(o),null):f},destroy(){h=!0,r.length=0,s.clear(),t.clear(),a=null,e.removeEventListener("visibilitychange",u)}}}export{oe as CHUNK,B as FUZZY_BUDGET_MS,I as FUZZY_MAX_PINS_PER_PASS,F as FUZZY_WINDOW,ae as createFuzzyEngine,U as matchQuote,D as maxErrorsFor};
@@ -0,0 +1,4 @@
1
+ const Me="Snagset",H="snagset",T="snagset.v1",Ze="Snagset",Pe="Snag",Ie="Snags",Ue={root:"data-snag-root"},F=e=>Ue[e],Be={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},A=e=>Be[e],We={mask:"snag-mask",block:"snag-block"},j=e=>We[e],d={font:"--snag-font",accent:"--snag-accent",onAccent:"--snag-onAccent",bg:"--snag-bg",fg:"--snag-fg",muted:"--snag-muted",border:"--snag-border",radius:"--snag-radius",shadow:"--snag-shadow",z:"--snag-z",motion:"--snag-motion",surface:"--snag-surface",sunken:"--snag-sunken",hover:"--snag-hover",focus:"--snag-focus",disabled:"--snag-disabled",statusOpen:"--snag-status-open",statusProgress:"--snag-status-progress",statusReview:"--snag-status-review",statusResolved:"--snag-status-resolved",anchorOrphan:"--snag-anchor-orphan",tbH:"--snag-tb-h",dockW:"--snag-dock-w",kb:"--snag-kb",thumbX:"--snag-thumb-x",thumbW:"--snag-thumb-w"},He=e=>`var(${d[e]})`,C={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},Fe="snag:disclosure:v1",je="snag:identity",qe="data-snag-theme",Ve={session:e=>`snag:session:${e}`,identity:je,threads:(e,t)=>`snag:threads:${e}:${t}`,counts:e=>`snag:counts:${e}`,draft:(e,t)=>`snag:draft:${e}:${t}`,outbox:e=>`snag:outbox:${e}`,mode:"snag:mode",handoff:"snag:handoff",seenCoach:"snag:seen-coach",disclosure:Fe},z={database:"snag:blobs",store:"blobs"},Ke={route:"snagset:route"};function Xe(e,t){let n="Unknown";/Edg\//.test(e)?n="Edge":/OPR\//.test(e)?n="Opera":/Firefox\//.test(e)?n="Firefox":/Chrome\//.test(e)?n="Chrome":/Safari\//.test(e)&&(n="Safari");let r="";if(/Macintosh/.test(e)?r="macOS":/Windows/.test(e)?r="Windows":/iPhone|iPad/.test(e)?r="iOS":/Android/.test(e)?r="Android":/Linux/.test(e)&&(r="Linux"),t?.brands?.length){const s=t.brands.find(i=>!/Not.?A.?Brand/i.test(i.brand));s&&(n=s.brand)}t?.platform&&(r=t.platform);let a=!1;try{a=typeof matchMedia=="function"&&matchMedia("(pointer:coarse)").matches}catch{}const o=t?.mobile??(a||/Mobi|iPhone|Android/.test(e))?"Mobile":"Desktop";return{browser:n,os:r,device:o}}const Ye={ok:{status:"ok"},release:{status:"disabled",reason:"Screenshots are not available in this release."},"config-off":{status:"disabled",reason:"Screenshots are switched off for this project."},"feature-off":{status:"disabled",reason:"Screenshots are switched off for this project."},"reviewer-removed":{status:"disabled",reason:"You removed the screenshot before sending."},"csp-blocked":{status:"failed",reason:"Your Content-Security-Policy blocks data: images, so no screenshot could be taken."},"engine-load-failed":{status:"failed",reason:"The screenshot engine could not be loaded."},"engine-failed":{status:"failed",reason:"The screenshot engine failed on this page."},timeout:{status:"timeout",reason:"The screenshot timed out."},tainted:{status:"tainted",reason:"A cross-origin image made the page canvas unreadable."},"scope-forced":{status:"ok",reason:"The page was too large to capture in full; captured the area around your pin."},"masking-failed":{status:"failed",reason:"Masking could not be verified, so the screenshot was discarded."},navigated:{status:"failed",reason:"The page changed while the screenshot was being taken."}},Qe={disabled:"Console and network capture is off for this project.",truncated:"Earlier console and network entries were dropped to fit the buffer."};function v(e={}){const t=Ye[e.screenshot??"release"],n=e.breadcrumbs??"disabled",r=[];t.reason&&r.push(t.reason),n!=="ok"&&r.push(Qe[n]);const a={screenshot:t.status,breadcrumbs:n,reasons:r};return e.blindSpots?.length&&(a.blindSpots=e.blindSpots),e.droppedCategories?.length&&(a.droppedCategories=e.droppedCategories),e.maskedCount!==void 0&&e.maskedCount>0&&(a.maskedCount=e.maskedCount),a}function Je(e,t,n,r=!1){const a=e.capture?.breadcrumbs??"disabled";if(n){e.capture=v({screenshot:"config-off",breadcrumbs:a});return}if(r&&!t){e.capture=v({screenshot:"reviewer-removed",breadcrumbs:a});return}t&&(e.capture=v({screenshot:t.situation,breadcrumbs:a,...t.blindSpots.length?{blindSpots:t.blindSpots}:{},...t.maskedCount>0?{maskedCount:t.maskedCount}:{}}))}const Ge="pass(?:word|wd)?|pwd|secret|token|api[_-]?key|apikey|auth(?:orization)?|credential|session|sid|cookie|jwt|bearer|otp|mfa|totp|cvv|cvc|ssn|nino|iban|card(?:[_-]?number)?|account[_-]?number|private[_-]?key|signature|client[_-]?secret|refresh[_-]?token|access[_-]?token",et=new RegExp(`(["'\`]?)(?<![A-Za-z0-9])(?:${Ge})[\\w-]*\\b\\1?\\s*[:=]\\s*(?:(["'\`])((?:\\\\.|(?!\\2)[^\\\\])*)\\2|([^\\s,;&}\\])]{3,}))`,"gi"),tt=/^(?:Bearer|Basic|Digest|Negotiate|Token)$/i,nt=(e,t,n,r,a,o,s)=>{if(!n&&tt.test(a)&&s.slice(o+e.length).startsWith(" [redacted]")||(n?r:a).startsWith("[redacted"))return e;const i=n?`${n}${r}${n}`:a;return e.slice(0,e.length-i.length)+(n?`${n}[redacted]${n}`:"[redacted]")},q=/data:[a-z0-9.+-]*\/?[a-z0-9.+-]*;base64,[A-Za-z0-9+/=]{16,}/gi,V=/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{0,}/g,K=/\b(sk-[A-Za-z0-9]+-[A-Za-z0-9_-]{20,}|sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9]{20,}|(sk|pk|rk)_(live|test)_[A-Za-z0-9]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|glpat-[A-Za-z0-9_-]{16,}|xox[baprs]-[A-Za-z0-9-]{10,}|xapp-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16}|ASIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|ya29\.[A-Za-z0-9_-]{20,}|SG\.[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{30,}|dop_v1_[a-f0-9]{40,}|shpat_[a-f0-9]{30,}|sbp_[a-f0-9]{30,}|hf_[A-Za-z0-9]{30,}|nvapi-[A-Za-z0-9_-]{20,})\b/g,rt=/\b(Bearer|Basic|Digest|Negotiate|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi,X=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z]{2,24})+\b/g,R=/\b(?:\d[ -]?){12,18}\d\b/g,Y=/\b(?=[A-Za-z0-9+/]*[a-z])(?=[A-Za-z0-9+/]*[A-Z])(?=[A-Za-z0-9+/]*\d)[A-Za-z0-9+/]{40,}={0,2}\b/g,Q=/\b[0-9a-f]{32,}\b/gi,J=/\b(?=[A-Za-z0-9_-]*[a-z])(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{40,}\b/g,G=/\b[a-z][a-z0-9]{1,15}(?:_[a-z0-9]{1,15}){0,2}_(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{24,}\b/g,ee=/\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/gi,at=/^(?=[A-Za-z0-9_~.+/=-]*[a-z])(?=[A-Za-z0-9_~.+/=-]*[A-Z])(?=[A-Za-z0-9_~.+/=-]*\d)[A-Za-z0-9_~.+/=-]{24,}$/;function y(e,t){e.lastIndex=0;const n=e.test(t);return e.lastIndex=0,n}function te(e){const t=e.replace(/[ -]/g,"");if(t.length<13||t.length>19)return!1;let n=0,r=!1;for(let a=t.length-1;a>=0;a--){let o=t.charCodeAt(a)-48;r&&(o*=2,o>9&&(o-=9)),n+=o,r=!r}return n%10===0}function ot(e){R.lastIndex=0;for(const t of e.matchAll(R))if(te(t[0]))return!0;return!1}function E(e){let t=e;return t=t.replace(q,"data:[redacted]"),t=t.replace(rt,"$1 [redacted]"),t=t.replace(et,nt),t=t.replace(V,"[redacted:jwt]"),t=t.replace(K,"[redacted:key]"),t=t.replace(G,"[redacted:key]"),t=t.replace(ee,"[redacted:url-cred]@"),t=t.replace(X,"[redacted:email]"),t=t.replace(R,n=>te(n)?"[redacted:card]":n),t=t.replace(J,n=>`[redacted:b64:${n.length}]`),t=t.replace(Y,n=>`[redacted:b64:${n.length}]`),t=t.replace(Q,n=>`[redacted:hex:${n.length}]`),t}const st=C.query,it=C.fragment;function ne(e,t=[]){let n;try{const r=globalThis.location?.href;n=new URL(e,r)}catch{return E(e)}n.username="",n.password="";for(const r of[...n.searchParams.keys()]){if(it.includes(r)){n.searchParams.set(r,"[redacted]");continue}if(st.includes(r))continue;if(!t.includes(r)){n.searchParams.set(r,"[redacted]");continue}const a=n.searchParams.get(r)??"";E(a)!==a&&n.searchParams.set(r,"[redacted]")}return n.hash&&n.hash.length>1&&(n.hash=t.includes("#")?n.hash:"#[redacted]"),E(n.toString().replace(/%5Bredacted%5D/gi,"[redacted]"))}function O(e){return e.length>120?!0:y(X,e)||y(V,e)||y(K,e)||y(Q,e)||y(Y,e)||y(q,e)||y(J,e)||y(G,e)||y(ee,e)||at.test(e)||ot(e)}const ct=/^eyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/,lt=/^[a-f0-9]{32,}$/i,dt=/^(?=[A-Za-z0-9_-]{24,}$)(?=.*[A-Za-z])(?=.*\d)[A-Za-z0-9_-]+$/,ut="[redacted]";function ht(e){return e.includes("/")?e.split("/").map(t=>ct.test(t)||lt.test(t)||dt.test(t)?ut:t).join("/"):e}const ft=/\/index\.(html?|php)$/i;function mt(e){if(!e.startsWith("/"))return e;let t=e.replace(ft,"/");return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t.toLowerCase()}function re(e){try{const t=e.querySelector(`meta[name="${Ke.route}"]`)?.getAttribute("content")?.trim();return!t||t.length>512||!t.startsWith("/")?null:t}catch{return null}}const gt=[/^utm_/,/^(gclid|gbraid|wbraid|fbclid|msclkid|ttclid|twclid|igshid|yclid|li_fat_id)$/,/^(mc_cid|mc_eid|_hsenc|_hsmi|vero_id|oly_enc_id|oly_anon_id)$/,/^_vercel_/,/^__vercel_/,/^_rsc$/],pt=[...C.query,...C.fragment];function bt(e,t=[]){return pt.includes(e)||t.includes(e)?!0:gt.some(n=>n.test(e))}function wt(e,t={}){const n=t.significantQueryParams??[];if(n!=="*"&&n.length===0)return;let r;try{r=new URLSearchParams(e)}catch{return}const a={};for(const[o,s]of r)bt(o,t.ignoredQueryParams??[])||n!=="*"&&!n.includes(o)||(a[o]=s);return Object.keys(a).length>0?a:void 0}function ae(e,t){const n=e.length>4096?e.slice(0,4096):e,r=ne(n,t);return r.length<=2048?r:r.slice(0,2048)+`\u2026[+${r.length-2048}]`}function yt(e=location,t={}){const n=ht(e.pathname),r=t.routeOverride??(t.doc?re(t.doc):typeof document<"u"?re(document):null),a=wt(e.search??"",t.query);return{route:mt(r??n),pathname:n,...a?{query:a}:{},origin:e.origin}}function xt(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function $t(e){const t=e.urlParamAllowList??[];let n;try{n=ae(location.href,t)}catch{try{n=ae(document.URL,t)}catch{n=E(location.origin+location.pathname)}}let r=innerWidth,a=innerHeight;(r===0||a===0)&&(r=document.documentElement.clientWidth,a=document.documentElement.clientHeight);let o={w:0,h:0};try{o={w:screen.width,h:screen.height}}catch{}const s=navigator.userAgent||"",i=navigator.userAgentData,l=i?{brands:(i.brands??[]).map(u=>({brand:u.brand,version:u.version})),platform:i.platform,mobile:i.mobile}:void 0,h={schemaVersion:T,url:n,page:e.page,viewport:{w:r,h:a,dpr:devicePixelRatio||1},screen:o,ua:s,derived:Xe(s,l),language:navigator.language||navigator.languages?.[0]||"en",prefersColorScheme:xt()?"dark":"light",timestamp:new Date().toISOString(),capture:v({breadcrumbs:e.breadcrumbs?.status??"disabled"})};return l&&(h.uaData=l),e.breadcrumbs&&e.breadcrumbs.status!=="disabled"&&(h.breadcrumbs=e.breadcrumbs.records),h}const At={product:Me,set:Ze,item:Pe,items:Ie};function oe(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(r,a)=>{const o=n?.[a]??At[a];return o===void 0?r:String(o)})}const se=e=>new Intl.NumberFormat().format(e),ie=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)},ce={"where.anchored":"{label}","where.approximate":"position approximate \u2014 the page changed","where.orphaned":"moved \u2014 the element is gone","status.open":"Active","status.progress":"In progress","status.review":"In review","status.resolved":"Resolved","author.unknown":"Someone","label.image":"an image","label.link":"a link","label.button":"a button","label.tag":"the {tag}"},S=oe(ce),vt={"detail.details":"Anchor details","detail.hidden":"This element isn't visible right now \u2014 it may be inside a closed menu, tab, or accordion.","detail.orphaned":"The element this was pinned to has moved or gone \u2014 it was {label}.","detail.approximate":"The page changed since this was written, so the pin is close rather than exact \u2014 it points at {label}.","detail.unavailable":"Some of the matching steps couldn't load, so this was judged with the basic ones only.","detail.filedat":"Filed at {query}.","detail.openquery":"Open with original query","capture.agent":"{browser} \xB7 {os}","capture.agent.noos":"{browser}","capture.device":"{device} \xB7 {w}\xD7{h} @{dpr}x","capture.device.at1x":"{device} \xB7 {w}\xD7{h}"},Et={"export.title":"{product} \u2014 {origin}","export.summary.one":"1 comment, {unresolved} unresolved \xB7 exported {date}","export.summary.many":"{total} comments, {unresolved} unresolved \xB7 exported {date}","export.heading":"{n} \xB7 {key} \u2014 {status}","export.on":"On {label}","export.device":"Device","export.selector":"Selector","export.by":"By","export.nobody":"_(no comment)_","cursor.proxy":"Pick an element \u2014 Tab to move, Enter to comment","cursor.at":"{role}, {name}, {i} of {n}","cursor.here":"{role} {name}","export.screenshot":"Screenshot {key}","label.text":"\u201C{text}\u201D","hint.fine":"Click anything to comment \u2014 Esc when done","hint.coarse":"Tap anything to comment","highlight.chip":"{tag} \xB7 {name} \xB7 {w}\xD7{h}","highlight.chip.unnamed":"{tag} \xB7 {w}\xD7{h}"},f=oe({...ce,...vt,...Et}),St=[`[${A("mask")}]`,`.${j("mask")}`,`.${j("block")}`].join(", ");function le(e,t){return O(t)||!!e.closest?.(St)}function de(e){const n=(e.innerText??e.textContent??"").slice(0,512).trim().replace(/\s+/g," ");if(n&&!le(e,n))return f("label.text",{text:n.length>52?n.slice(0,52)+"\u2026":n});const r=e.tagName.toLowerCase();return r==="img"?f("label.image"):r==="a"?f("label.link"):r==="button"?f("label.button"):f("label.tag",{tag:r})}function _t(e,t){const n=t.trim().replace(/\s+/g," ");return n&&!le(e,n)?f("label.text",{text:n.length>52?n.slice(0,52)+"\u2026":n}):de(e)}const ue={open:{colour:"#4F6EF7"},progress:{colour:"#F59E0B"},review:{colour:"#8B5CF6"},resolved:{colour:"#10B981"}},kt=e=>e in ue?S(`status.${e}`):e;class Tt extends Error{code;constructor(t,n){super(n??t),this.name="AdapterError",this.code=t}}function he(e,t){const{anchorPending:n,anchorReasons:r,screenshotBlob:a,...o}=e;return o.attachments?.length&&t?.size&&(o.attachments=o.attachments.map(s=>{const i=t.get(s.id);return i?{...s,url:i}:s})),o}function fe(e){const t=e.context,n=t?.derived,r=t?.viewport;if(!t||!n||!r)return"";const a=Math.round(r.dpr*100)/100,o=n.os?f("capture.agent",{browser:n.browser,os:n.os}):f("capture.agent.noos",{browser:n.browser}),s=a===1?f("capture.device.at1x",{device:n.device,w:r.w,h:r.h}):f("capture.device",{device:n.device,w:r.w,h:r.h,dpr:a});return`${o} \xB7 ${s}`}function Ct(e,t,n){const r=e.map(l=>he(l,n)),a=r.filter(l=>l.status!=="resolved").length,o=[],s=[`# ${f("export.title",{origin:t.origin})}`,"",f(r.length===1?"export.summary.one":"export.summary.many",{total:se(r.length),unresolved:se(a),date:ie(t.exportedAt)})],i=new Map;for(const l of r)i.set(l.route,[...i.get(l.route)??[],l]);for(const[l,h]of i)s.push("","---","",`## ${l}`),h.forEach((u,b)=>{const g=u.comments[0];s.push("",`### ${f("export.heading",{n:b+1,key:u.key,status:kt(u.status)})}`,"",`**${f("export.on",{label:u.anchor.label})}**`,...u.anchorState==="anchored"?[]:[f(`detail.${u.anchorState}`,{label:u.anchor.label})],...u.anchor.css?[`**${f("export.selector")}** \`${u.anchor.css}\``]:[],...fe(u)?[`**${f("export.device")}** ${fe(u)}`]:[],`**${f("export.by")}** ${g?.author.name??u.createdBy.name} \xB7 ${ie(u.createdAt)}`,"",g?.body??f("export.nobody"));for(const c of u.attachments??[])c.url.startsWith("data:")&&(s.push("",`![${f("export.screenshot",{key:u.key})}][${c.id}]`),o.push(`[${c.id}]: ${c.url}`));for(const c of u.comments.slice(1))s.push("",`- **${c.author.name}** \u2014 ${c.body??""}`)});return o.length&&s.push("","---","",...o),s.join(`
2
+ `)+`
3
+ `}function zt(e,t,n){return JSON.stringify({schemaVersion:T,...t,threads:e.map(r=>he(r,n))},null,2)}function Nt(e,t,n,r){const a=n.exportedAt.slice(0,10);return e==="md"?{name:`${H}-${a}.md`,mime:"text/markdown",text:Ct(t,n,r)}:{name:`${H}-${a}.json`,mime:"application/json",text:zt(t,n,r)}}function Rt(e,t,n){const r=e.ownerDocument??e,a=URL.createObjectURL(new Blob([t.text],{type:`${t.mime};charset=utf-8`})),o=r.createElement("a");o.href=a,o.download=t.name,o.style.display="none",e.appendChild(o),o.dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!0,composed:!1})),o.remove(),n.setTimeout(()=>URL.revokeObjectURL(a),0)}let $=null;function Ot(){return $||($=new Promise((e,t)=>{let n;try{n=indexedDB.open(z.database,1)}catch(r){t(r);return}n.onupgradeneeded=()=>{n.result.createObjectStore(z.store).createIndex("project",["uid","env"])},n.onsuccess=()=>{n.result.onversionchange=()=>{n.result.close(),$=null},e(n.result)},n.onerror=()=>t(n.error??new Error("indexeddb-unavailable")),n.onblocked=()=>t(new Error("indexeddb-blocked"))}),$.catch(()=>{$=null}),$)}function D(e,t){return Ot().then(n=>new Promise((r,a)=>{const o=n.transaction(z.store,e),s=t(o.objectStore(z.store));o.oncomplete=()=>r(s.result),o.onerror=()=>a(o.error??s.error??new Error("indexeddb-error")),o.onabort=()=>{const i=o.error;i&&(i.name==="QuotaExceededError"||/quota/i.test(i.message??""))?a(new Tt("local_quota_exceeded")):a(i??new Error("indexeddb-abort"))}}))}async function me(e,t){const{blob:n,...r}=t,a={...r,bytes:await n.arrayBuffer(),type:n.type};await D("readwrite",o=>o.put(a,e))}function ge(e){return D("readonly",t=>t.get(e)).then(t=>{if(!t)return null;const{bytes:n,type:r,...a}=t;return{...a,blob:new Blob([n],{type:r})}})}function Dt(e){return D("readwrite",t=>t.delete(e)).then(()=>{})}function Lt(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>typeof r.result=="string"?t(r.result):n(new Error("read-failed")),r.onerror=()=>n(r.error??new Error("read-failed")),r.readAsDataURL(e)})}function Mt(e){const t=/^data:([^;,]+)?(;base64)?,(.*)$/s.exec(e);if(!t)throw new Error("not-a-data-uri");const n=t[1]??"application/octet-stream";if(!t[2])return new Blob([decodeURIComponent(t[3])],{type:n});const r=atob(t[3]),a=new Uint8Array(r.length);for(let o=0;o<r.length;o++)a[o]=r.charCodeAt(o);return new Blob([a],{type:n})}async function Zt(e){const t=e.flatMap(r=>r.attachments??[]),n=new Map;return t.length===0||await Promise.all(t.map(async r=>{const a=await ge(r.id).catch(()=>null);a&&n.set(r.id,await Lt(a.blob))})),n}async function Pt(e,t,n){const r=JSON.parse(e);if(r.schemaVersion!==T||!Array.isArray(r.threads))throw new Error(`not a ${T} archive`);const a=[];let o=0;for(const s of r.threads){if(!s.attachments?.length){a.push(s);continue}const i=[];for(const l of s.attachments)if(l.url.startsWith("data:")){const h=Mt(l.url);await me(l.id,{blob:h,uid:t,env:n,kind:l.kind,...l.width!==void 0?{width:l.width}:{},...l.height!==void 0?{height:l.height}:{},createdAt:Date.now()}),o++,i.push({...l,url:""})}else i.push(l);a.push({...s,attachments:i})}return localStorage.setItem(Ve.threads(t,n),JSON.stringify(a)),{threads:a.length,blobs:o}}function L(e){return e.getBoundingClientRect()}function pe(e){if(e.closest('[inert],[aria-hidden="true"]'))return!1;const t=e.checkVisibility;if(typeof t=="function")return t.call(e,{contentVisibilityAuto:!0,opacityProperty:!1,visibilityProperty:!0});const n=L(e);if(!(n.width>0||n.height>0||e.getClientRects().length>0))return!1;const a=e.ownerDocument?.defaultView;return a?a.getComputedStyle(e).visibility!=="hidden":!0}const be=`[${F("root")}]`;function we(e){const t=e.parentElement;return!t||t===e.ownerDocument.body||t===e.ownerDocument.documentElement||t.closest(be)?null:t}function ye(e){for(const t of e.children)if(!t.closest(be)&&pe(t))return t;return null}const xe=10;function $e(e){let t=e,n=0;for(;n++<xe;){const r=t.getRootNode();if(!(r instanceof ShadowRoot))break;t=r.host}return t}function It(e){const t=[];let n=e,r=0;for(;r++<xe;){const a=n.getRootNode();if(!(a instanceof ShadowRoot))break;n=a.host,t.unshift(n)}return t}const Ut=/[\u200B-\u200D\u2060\uFEFF]/gu,Bt=/[\s\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]+/gu,Wt=[[/[\u2018\u2019\u201A\u201B]/gu,"'"],[/[\u201C\u201D\u201E\u201F]/gu,'"'],[/[\u2010-\u2015\u2212]/gu,"-"],[/\u2026/gu,"..."],[/\u2044/gu,"/"]];function Ht(e){let t=e.normalize("NFC").replace(Ut,"");for(const[n,r]of Wt)t=t.replace(n,r);return t.replace(Bt," ").trim()}const Ft=[A("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],jt=256,qt=200,Vt=12;function Kt(e){for(const t of Ft){const n=e.getAttribute(t);if(n)return{attr:t,value:n}}}function Xt(e,t=Vt){const n=[];let r=e;for(;r&&r.nodeType===1&&n.length<t;){const a=r.tagName.toLowerCase();if(a==="html")break;const o=r.parentElement;if(o){const s=[...o.children].filter(i=>i.tagName===r.tagName);n.push(s.length>1?`${a}:nth-of-type(${s.indexOf(r)+1})`:a)}else n.push(a);r=o}return n.reverse()}function Ae(e){const t=e.getAttribute("role");if(t)return t;const n=e.tagName.toLowerCase();if(n==="button")return"button";if(n==="a"&&e.hasAttribute("href"))return"link";if(n==="input"){const r=(e.getAttribute("type")??"text").toLowerCase();return r==="checkbox"||r==="radio"||r==="button"||r==="submit"?r==="submit"?"button":r:"textbox"}if(/^h[1-6]$/.test(n))return"heading";if(n==="nav")return"navigation";if(n==="img")return"img"}function M(e){const t=e.getAttribute("aria-label");if(t?.trim())return t.trim();const n=e.getAttribute("aria-labelledby");if(n){const o=n.split(/\s+/).map(s=>e.ownerDocument.getElementById(s)?.textContent??"").join(" ").trim();if(o)return o}const r=e.getAttribute("alt")??e.getAttribute("title");if(r?.trim())return r.trim();const a=(e.textContent??"").trim();return a?a.slice(0,jt):void 0}function Yt(e){const t=e.tagName.toLowerCase();return t==="img"?S("label.image"):t==="a"?S("label.link"):t==="button"?S("label.button"):S("label.tag",{tag:t})}function Qt(e){return e<480?"xs":e<768?"sm":e<1024?"md":e<1440?"lg":"xl"}function Jt(e,t={}){const n=$e(e),r=Kt(n),a=L(n),o=n.ownerDocument,s=o.defaultView?.scrollX??0,i=o.defaultView?.scrollY??0,l=Ht(n.textContent??"").slice(0,qt),h={path:Xt(n),rect:{x:a.left+s,y:a.top+i,w:a.width,h:a.height},label:t.label??Yt(n)};r&&(h.testid=r.value),t.domid&&(h.domid=t.domid),t.css&&(h.css=t.css),t.hostPath?.length&&(h.hostPath=t.hostPath),t.xpath&&(h.xpath=t.xpath);const u=Ae(n);u&&(h.role=u);const b=M(n);b&&(h.accessibleName=b),l&&(h.text={exact:l}),t.point&&a.width>0&&a.height>0&&(h.offset={fx:ve((t.point.x-a.left)/a.width),fy:ve((t.point.y-a.top)/a.height)});const g=t.viewportWidth??o.defaultView?.innerWidth;return g&&(h.breakpoint=Qt(g)),h}const ve=e=>e<0?0:e>1?1:e,Gt='a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"]),[role], h1,h2,h3,h4,h5,h6, img, video, figure, table, li,main, nav, header, footer, aside, section[aria-label], form, [data-testid]',en=`[${F("root")}]`;function Ee(e=document.body){return[...e.querySelectorAll(Gt)].filter(t=>!t.closest(en)&&pe(t))}function tn(e,t){const n=e.ownerDocument??document,r=n.createElement("button");r.type="button",r.className="snag-cursor-proxy",r.setAttribute("aria-label",f("cursor.proxy")),r.style.cssText="position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;pointer-events:none",e.appendChild(r);let a=[],o=-1,s=null,i=null;const l=()=>i??a[o]??null;function h(c){const w=Ae(c),p=M(c),x=i?0:o+1;t.announce(i||!p?f("cursor.here",{role:w??c.tagName.toLowerCase(),name:p??""}):f("cursor.at",{role:w??c.tagName.toLowerCase(),name:p,i:x,n:a.length}))}function u(c){c&&(t.show(c),c.scrollIntoView({block:"nearest",behavior:"auto"}),h(c))}function b(c){i=null,a.length!==0&&(o=o<0?c===1?0:a.length-1:(o+c+a.length)%a.length,u(a[o]))}function g(c){const w=l();if(!w)return;const p=c==="out"?we(w):ye(w);if(!p)return;const x=a.indexOf(p);x>=0?(i=null,o=x):i=p,u(p)}return r.addEventListener("keydown",c=>{if(!(c.metaKey||c.ctrlKey||c.altKey))switch(c.key){case"Tab":case"ArrowDown":case"ArrowRight":c.preventDefault(),b(c.key==="Tab"&&c.shiftKey?-1:1);return;case"ArrowUp":case"ArrowLeft":c.preventDefault(),b(-1);return;case"[":c.preventDefault(),g("out");return;case"]":c.preventDefault(),g("in");return;case"Enter":case" ":{const w=l();if(!w)return;c.preventDefault();const p=w.getBoundingClientRect();t.pick(w,{x:p.left+p.width/2,y:p.top+p.height/2});return}}}),{engage(){a=Ee(n.body),o=-1,i=null,s=e.activeElement??n.activeElement,r.focus({preventScroll:!0})},release(){i=null,e.activeElement===r&&s?.focus?.(),s=null},destroy(){r.remove()}}}const m=Object.fromEntries(Object.keys(d).map(e=>[e,He(e)])),nn=Object.entries(ue).map(([e,t])=>` ${d[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
4
+ `);`${m.font}${m.fg}${d.font}${d.accent}${d.bg}${d.fg}${d.muted}${d.border}${d.radius}${d.shadow}${d.z}${d.motion}${d.surface}${m.fg}${m.bg}${d.sunken}${m.fg}${m.bg}${d.hover}${m.fg}${m.bg}${d.onAccent}${d.focus}${m.accent}${m.fg}${d.disabled}${m.muted}${m.bg}${nn}${d.anchorOrphan}${qe}${d.accent}${d.onAccent}${d.bg}${d.fg}${d.muted}${d.border}${d.shadow}${d.motion}${d.bg}${d.fg}${d.muted}${d.border}${d.accent}${d.onAccent}${d.surface}${d.sunken}${d.hover}${d.focus}${d.disabled}${d.shadow}${d.anchorOrphan}`;const Se={highlight:2,chip:4},_e=new WeakMap;function rn(e,t,n){let r=_e.get(e);if(r||_e.set(e,r=new Set),r.has(t))return;r.add(t);try{const s=new CSSStyleSheet;s.replaceSync(n),e.adoptedStyleSheets=[...e.adoptedStyleSheets,s];return}catch{}const o=(e.ownerDocument??document).createElement("style");o.setAttribute(`data-snag-${t}`,""),o.textContent=n,e.appendChild(o)}const an=` .snag-hl-layer{position:fixed;inset:0;pointer-events:none;z-index:${Se.highlight};contain:layout style;overflow:hidden}.snag-hl{position:absolute;box-sizing:border-box;border:2px solid ${m.accent};border-radius:3px;background:color-mix(in srgb,${m.accent} 12%,transparent);box-shadow:0 0 0 100vmax color-mix(in srgb,#000 4%,transparent);transition:top ${m.motion},left ${m.motion},width ${m.motion},height ${m.motion}}.snag-hl-chip{position:absolute;background:${m.accent};color:${m.onAccent};font:600 11px/1.5 ${m.font};padding:2px 7px;border-radius:4px;white-space:nowrap;max-width:min(48ch,90vw);overflow:hidden;text-overflow:ellipsis}.snag-hint{position:fixed;top:calc(12px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:${Se.chip};pointer-events:none;background:${m.bg};color:${m.fg};border:1px solid ${m.border};box-shadow:${m.shadow};border-radius:999px;padding:7px 14px;font:500 12px/1 ${m.font};white-space:nowrap;max-width:calc(100vw - 24px);overflow:hidden;text-overflow:ellipsis}`;function on(e,t,n){const r=e.ownerDocument??document;rn(e,"highlight",an);const a=r.createElement("div");a.className="snag-hl-layer",a.hidden=!0;const o=r.createElement("div");o.className="snag-hl";const s=r.createElement("div");s.className="snag-hl-chip",a.append(o,s);const i=r.createElement("div");i.className="snag-hint",i.setAttribute("role","status"),i.hidden=!0,i.textContent=f(t?"hint.coarse":"hint.fine");let l;function h(g){const c=L(g);if(c.width<=0&&c.height<=0)return u();a.hidden=!1,o.style.left=`${c.left}px`,o.style.top=`${c.top}px`,o.style.width=`${c.width}px`,o.style.height=`${c.height}px`;const w=M(g),p=g.tagName.toLowerCase(),x=Math.round(c.width),W=Math.round(c.height);s.textContent=w?f("highlight.chip",{tag:p,name:w,w:x,h:W}):f("highlight.chip.unnamed",{tag:p,w:x,h:W});const Le=c.top>=22;s.style.top=Le?`${c.top-20}px`:`${c.bottom+4}px`,s.style.left=`${Math.max(2,c.left)}px`,t&&(clearTimeout(l),l=setTimeout(u,400))}function u(){a.hidden=!0}let b=null;return{show:h,clear:u,setActive(g){n&&(b??=tn(e,{...n,show:h}),g?b.engage():b.release()),g||u(),g?e.append(a,i):(a.remove(),i.remove()),i.hidden=!g},destroy(){clearTimeout(l),b?.destroy(),a.remove(),i.remove()}}}const sn=new Set(["role","name","aria-label","rel","href"]);function cn(e,t){let n=sn.has(e);n||=e.startsWith("data-")&&_(e);let r=_(t)&&t.length<100;return r||=t.startsWith("#")&&_(t.slice(1)),n&&r}function ln(e){return _(e)}function dn(e){return _(e)}function un(e){return!0}function ke(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return"html";const n={root:document.body,idName:ln,className:dn,tagName:un,attr:cn,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,a={...n,...t},o=pn(a.root,n);let s,i=0;for(const h of hn(e,a,o)){if(new Date().getTime()-r.getTime()>a.timeoutMs||i>=a.maxNumberOfPathChecks){const b=mn(e,o);if(!b)throw new Error(`Timeout: Can't find a unique selector after ${a.timeoutMs}ms`);return k(b)}if(i++,I(h,o)){s=h;break}}if(!s)throw new Error("Selector was not found.");const l=[...Ne(s,e,a,o,r)];return l.sort(Z),l.length>0?k(l[0]):k(s)}function*hn(e,t,n){const r=[];let a=[],o=e,s=0;for(;o&&o!==n;){const i=fn(o,t);for(const l of i)l.level=s;if(r.push(i),o=o.parentElement,s++,a.push(...ze(r)),s>=t.seedMinLength){a.sort(Z);for(const l of a)yield l;a=[]}}a.sort(Z);for(const i of a)yield i}function _(e){if(/^[a-z\-]{3,}$/i.test(e)){const t=e.split(/-|[A-Z]/);for(const n of t)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return!1;return!0}return!1}function fn(e,t){const n=[],r=e.getAttribute("id");r&&t.idName(r)&&n.push({name:"#"+CSS.escape(r),penalty:0});for(let s=0;s<e.classList.length;s++){const i=e.classList[s];t.className(i)&&n.push({name:"."+CSS.escape(i),penalty:1})}for(let s=0;s<e.attributes.length;s++){const i=e.attributes[s];t.attr(i.name,i.value)&&n.push({name:`[${CSS.escape(i.name)}="${CSS.escape(i.value)}"]`,penalty:2})}const a=e.tagName.toLowerCase();if(t.tagName(a)){n.push({name:a,penalty:5});const s=P(e,a);s!==void 0&&n.push({name:Ce(a,s),penalty:10})}const o=P(e);return o!==void 0&&n.push({name:gn(a,o),penalty:50}),n}function k(e){let t=e[0],n=t.name;for(let r=1;r<e.length;r++){const a=e[r].level||0;t.level===a-1?n=`${e[r].name} > ${n}`:n=`${e[r].name} ${n}`,t=e[r]}return n}function Te(e){return e.map(t=>t.penalty).reduce((t,n)=>t+n,0)}function Z(e,t){return Te(e)-Te(t)}function P(e,t){const n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let a=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&a++,r!==e);)r=r.nextSibling;return a}function mn(e,t){let n=0,r=e;const a=[];for(;r&&r!==t;){const o=r.tagName.toLowerCase(),s=P(r,o);if(s===void 0)return;a.push({name:Ce(o,s),penalty:NaN,level:n}),r=r.parentElement,n++}if(I(a,t))return a}function gn(e,t){return e==="html"?"html":`${e}:nth-child(${t})`}function Ce(e,t){return e==="html"?"html":`${e}:nth-of-type(${t})`}function*ze(e,t=[]){if(e.length>0)for(let n of e[0])yield*ze(e.slice(1,e.length),t.concat(n));else yield t}function pn(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function I(e,t){const n=k(e);switch(t.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return!0;default:return!1}}function*Ne(e,t,n,r,a){if(e.length>2&&e.length>n.optimizedMinLength)for(let o=1;o<e.length-1;o++){if(new Date().getTime()-a.getTime()>n.timeoutMs)return;const i=[...e];i.splice(o,1),I(i,r)&&r.querySelector(k(i))===t&&(yield i,yield*Ne(i,t,n,r,a))}}const bn=A("anchor").replace(/anchor$/,""),wn=[A("anchor"),"data-testid","data-test-id","data-test","data-cy","data-qa","data-pw","data-automation-id"],Re=new Set([...wn,"name","aria-label","role","type","itemprop"]),yn=new Set(["name","type","role","aria-label","itemprop","href","alt","lang"]),xn=[/^class$|^style$/,/^data-v-/,/^_ngcontent-|^_nghost-|^ng-version$|^ng-reflect-/,/^data-reactid$|^data-react-checksum$|^data-react-helmet$/,/^data-radix-|^data-headlessui-|^data-floating-ui-|^data-state$|^data-side$/,/^data-svelte-h$|^data-astro-|^data-styled|^data-emotion$/],$n=[/^[0-9a-f]{8}-[0-9a-f]{4}-/i,/^[0-9a-f]{16,}$/i,/^:r[0-9a-z]+:$/,/^«r[0-9a-z]+»$/,/^\d{4,}$/,/^(ember|mui|mat|cdk|headlessui|radix|reach)-?\d/i,/^(ember|mui|mat|cdk|headlessui|radix|reach)(-?[a-z]+)*-?\d+$/i];function An(e){return e.startsWith(bn)&&e!==A("anchor")||e.startsWith("aria-")&&e!=="aria-label"||xn.some(t=>t.test(e))?!1:Re.has(e)||yn.has(e)}function vn(e,t){return!t||t.length>120||e==="href"&&(t.includes("?")||/^[a-z]+:\/\//i.test(t))?!0:$n.some(n=>n.test(t))}const N=(e,t)=>!vn(e,t)&&!O(t);function U(e){return N("id",e)&&/^[a-zA-Z0-9_-]+$/.test(e)}const En=e=>`"${e.replace(/([\\"])/g,"\\$1")}"`,Oe=e=>e.replace(/"[^"]*"|'[^']*'|#([A-Za-z_-][\w-]*)/g,(t,n)=>n?`[id=${En(n)}]`:t);function De(e,t,n){try{return n.querySelectorAll(e).length===1&&n.querySelector(e)===t}catch{return!1}}function B(e,t=document.body){const n={root:t,tagName:()=>!0,idName:U,seedMinLength:2,optimizedMinLength:2};try{const r=ke(e,{...n,timeoutMs:150,className:()=>!1,attr:(o,s)=>Re.has(o)&&N(o,s)}),a=Oe(r);if(De(a,e,t))return a}catch{}try{const r=ke(e,{...n,timeoutMs:300,className:Sn,attr:(o,s)=>An(o)&&N(o,s)}),a=Oe(r);return De(a,e,t)?a:void 0}catch{return}}function Sn(e){return!(!e||e.length>60||/^[a-z-]*\d/.test(e)||/[:[\]/]/.test(e)||/_[A-Za-z0-9]{5,}$/.test(e)||/^[a-z]+-[0-9a-f]{6,}$/i.test(e))}function _n(e){const t=[];let n=e;for(let r=0;n&&n.nodeType===1&&r<40;r++){const a=n.tagName.toLowerCase();let o=1,s=!1;for(let i=n.previousElementSibling;i;i=i.previousElementSibling)i.tagName===n.tagName&&o++;for(let i=n.nextElementSibling;!s&&i;i=i.nextElementSibling)i.tagName===n.tagName&&(s=!0);t.unshift(o>1||s?`${a}[${o}]`:a),n=n.parentElement}return`/${t.join("/")}`}function kn(e){const t=$e(e),n={},r=It(e);if(r.length){const o=r.map(s=>B(s)).filter(s=>!!s);o.length&&(n.hostPath=o)}const a=B(t);a&&(n.css=a),t.id&&U(t.id)&&(n.domid=t.id);try{n.xpath=_n(t)}catch{}return n}export{Je as applyShotOutcome,Nt as buildExport,Ee as candidates,$t as captureContext,v as captureReport,on as createAddChrome,Jt as createElementAnchor,Dt as deleteBlob,de as deriveAnchorLabel,yt as derivePageRef,_t as deriveQuoteLabel,kn as describeElement,Rt as download,B as generateCss,ge as getBlob,Pt as importArchive,O as isSensitiveValue,U as isStableId,N as isUsableAttrValue,ye as narrow,me as putBlob,E as redactText,ne as redactUrl,Zt as resolveAttachmentUris,we as widen};
@@ -0,0 +1,4 @@
1
+ const G="Snagset",W={anchor:"data-snag-anchor",ignore:"data-snag-ignore",mask:"data-snag-mask",nomask:"data-snag-nomask",src:"data-snag-src",component:"data-snag-component"},Y=n=>W[n],H={mask:"snag-mask",block:"snag-block"},v=n=>H[n],M={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},T={original:"snagset.original",wrapped:"snagset.wrapped"},X=Symbol.for(T.original),D=Symbol.for(T.wrapped),w=()=>{};function E(n,t,e){let s;try{s=n[t]}catch{return w}if(typeof s!="function"||s[D])return w;const i=s,d=e(i);let g=!1;const h=function(...r){return g?i.apply(this,r):d.apply(this,r)};try{const r=h;r[D]=!0,r[X]=i,Object.defineProperty(h,"name",{value:i.name,configurable:!0}),Object.defineProperty(h,"length",{value:i.length,configurable:!0})}catch{}try{n[t]=h}catch{return w}return n[t]!==h?w:()=>{let r;try{r=n[t]}catch{r=void 0}if(r===h)try{n[t]=i;return}catch{}g=!0}}const L="pass(?:word|wd)?|pwd|secret|token|api[_-]?key|apikey|auth(?:orization)?|credential|session|sid|cookie|jwt|bearer|otp|mfa|totp|cvv|cvc|ssn|nino|iban|card(?:[_-]?number)?|account[_-]?number|private[_-]?key|signature|client[_-]?secret|refresh[_-]?token|access[_-]?token",F=new RegExp(`(["'\`]?)(?<![A-Za-z0-9])(?:${L})[\\w-]*\\b\\1?\\s*[:=]\\s*(?:(["'\`])((?:\\\\.|(?!\\2)[^\\\\])*)\\2|([^\\s,;&}\\])]{3,}))`,"gi"),J=/^(?:Bearer|Basic|Digest|Negotiate|Token)$/i,V=(n,t,e,s,i,d,g)=>{if(!e&&J.test(i)&&g.slice(d+n.length).startsWith(" [redacted]")||(e?s:i).startsWith("[redacted"))return n;const h=e?`${e}${s}${e}`:i;return n.slice(0,n.length-h.length)+(e?`${e}[redacted]${e}`:"[redacted]")},Q=/data:[a-z0-9.+-]*\/?[a-z0-9.+-]*;base64,[A-Za-z0-9+/=]{16,}/gi,q=/\beyJ[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{0,}/g,x=/\b(sk-[A-Za-z0-9]+-[A-Za-z0-9_-]{20,}|sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9]{20,}|(sk|pk|rk)_(live|test)_[A-Za-z0-9]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|glpat-[A-Za-z0-9_-]{16,}|xox[baprs]-[A-Za-z0-9-]{10,}|xapp-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{16}|ASIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|ya29\.[A-Za-z0-9_-]{20,}|SG\.[A-Za-z0-9_-]{20,}|npm_[A-Za-z0-9]{30,}|dop_v1_[a-f0-9]{40,}|shpat_[a-f0-9]{30,}|sbp_[a-f0-9]{30,}|hf_[A-Za-z0-9]{30,}|nvapi-[A-Za-z0-9_-]{20,})\b/g,tt=/\b(Bearer|Basic|Digest|Negotiate|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi,et=/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z]{2,24})+\b/g,nt=/\b(?:\d[ -]?){12,18}\d\b/g,st=/\b(?=[A-Za-z0-9+/]*[a-z])(?=[A-Za-z0-9+/]*[A-Z])(?=[A-Za-z0-9+/]*\d)[A-Za-z0-9+/]{40,}={0,2}\b/g,rt=/\b[0-9a-f]{32,}\b/gi,at=/\b(?=[A-Za-z0-9_-]*[a-z])(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{40,}\b/g,ot=/\b[a-z][a-z0-9]{1,15}(?:_[a-z0-9]{1,15}){0,2}_(?=[A-Za-z0-9_-]*[A-Z])(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{24,}\b/g,it=/\b[a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:[^\s/@]+@/gi;function ct(n){const t=n.replace(/[ -]/g,"");if(t.length<13||t.length>19)return!1;let e=0,s=!1;for(let i=t.length-1;i>=0;i--){let d=t.charCodeAt(i)-48;s&&(d*=2,d>9&&(d-=9)),e+=d,s=!s}return e%10===0}function z(n){let t=n;return t=t.replace(Q,"data:[redacted]"),t=t.replace(tt,"$1 [redacted]"),t=t.replace(F,V),t=t.replace(q,"[redacted:jwt]"),t=t.replace(x,"[redacted:key]"),t=t.replace(ot,"[redacted:key]"),t=t.replace(it,"[redacted:url-cred]@"),t=t.replace(et,"[redacted:email]"),t=t.replace(nt,e=>ct(e)?"[redacted:card]":e),t=t.replace(at,e=>`[redacted:b64:${e.length}]`),t=t.replace(st,e=>`[redacted:b64:${e.length}]`),t=t.replace(rt,e=>`[redacted:hex:${e.length}]`),t}const lt=M.query,ut=M.fragment;function b(n,t=[]){let e;try{const s=globalThis.location?.href;e=new URL(n,s)}catch{return z(n)}e.username="",e.password="";for(const s of[...e.searchParams.keys()]){if(ut.includes(s)){e.searchParams.set(s,"[redacted]");continue}if(lt.includes(s))continue;if(!t.includes(s)){e.searchParams.set(s,"[redacted]");continue}const i=e.searchParams.get(s)??"";z(i)!==i&&e.searchParams.set(s,"[redacted]")}return e.hash&&e.hash.length>1&&(e.hash=t.includes("#")?e.hash:"#[redacted]"),z(e.toString().replace(/%5Bredacted%5D/gi,"[redacted]"))}const ft=new RegExp(`(?<![A-Za-z0-9])(?:${L})[\\w-]*$`,"i");function dt(n){return ft.test(n)}const ht=/^https?:\/\//i,P="[redacted]";function R(n,t=4){if(typeof n=="string")return ht.test(n)?b(n):z(n);if(n===null||typeof n!="object")return n;if(t<=0)return P;if(Array.isArray(n))return n.map(s=>R(s,t-1));const e={};for(const[s,i]of Object.entries(n))e[s]=dt(s)?P:R(i,t-1);return e}const pt=`[${Y("mask")}], .${v("mask")}, .${v("block")}`,B=256,U=2048;function j(n,t=3,e=U){const s=performance.now(),i=new Set;let d=0;const g=(r,m)=>{if(++d>8&&performance.now()-s>2)return"[unserialisable]";try{if(typeof r=="string")return r.length>B?`${r.slice(0,B)}\u2026`:r;if(r==null||typeof r=="number"||typeof r=="boolean"||typeof r=="bigint"||typeof r=="symbol")return String(r);if(typeof r=="function")return`[Function ${r.name||"anonymous"}]`;const y=r;if(r instanceof Error||typeof y.name=="string"&&typeof y.message=="string"&&"stack"in y){const a=typeof y.stack=="string"?y.stack.split(`
2
+ `).slice(0,10).join(`
3
+ `):"";return`${String(y.name)}: ${String(y.message)}${a?`
4
+ ${a}`:""}`.slice(0,U)}if(typeof Response<"u"&&r instanceof Response)return`[Response ${r.status}]`;if(typeof Request<"u"&&r instanceof Request)return`[Request ${r.method} \u2026]`;if(typeof Node<"u"&&r instanceof Node){const a=r,c=a.id?`#${a.id}`:"",u=typeof a.className=="string"&&a.className?`.${a.className.split(/\s+/)[0]}`:"";return`<${(a.tagName??r.nodeName??"node").toLowerCase()}${c}${u}>`}if(i.has(r))return"[Circular]";if(i.add(r),Array.isArray(r)){if(m<=0)return`[Array(${r.length})]`;const a=r.slice(0,10).map(c=>g(c,m-1));return r.length>10&&a.push(`\u2026+${r.length-10} more`),`[${a.join(", ")}]`}if(m<=0)return"[Object]";const k=Object.keys(y),$=[];for(const a of k.slice(0,20)){let c;try{c=g(y[a],m-1)}catch{c="[throws]"}$.push(`${a}: ${c}`)}return k.length>20&&$.push(`\u2026+${k.length-20} more`),`{${$.join(", ")}}`}catch{return"[unserialisable]"}},h=g(n,t);return h.length>e?`${h.slice(0,e)}\u2026`:h}const C=4096,I=512;function O(n){const t=JSON.stringify(n);let e=0;for(let s=0;s<t.length;s++)t.charCodeAt(s)>127&&(e+=2);return t.length+e}function S(n,t){return n.length>t?`${n.slice(0,t)}\u2026[+${n.length-t}]`:n}class K{buf=[];sizes=[];bytes=0;droppedCount=0;maxEntries;maxBytes;constructor(t=100,e=65536){this.maxEntries=Math.min(t,100),this.maxBytes=Math.min(e,65536)}push(t){let e=O(t);e>this.maxBytes>>2&&(t={...t,message:S(t.message,1024)},delete t.data,e=O(t));const s=this.buf[this.buf.length-1];if(s&&s.type===t.type&&s.level===t.level&&s.message===t.message&&Date.parse(t.t)-Date.parse(s.t)<1e3){const i=(s.data?.count??1)+1,d=this.sizes[this.sizes.length-1];s.data={...s.data,count:Math.min(i,1e3)},s.t=t.t;const g=O(s);this.sizes[this.sizes.length-1]=g,this.bytes+=g-d;return}for(this.buf.push(t),this.sizes.push(e),this.bytes+=e;this.buf.length>this.maxEntries||this.bytes>this.maxBytes;)this.buf.shift(),this.bytes-=this.sizes.shift(),this.droppedCount++}noteDropped(t){t>0&&(this.droppedCount+=t)}get dropped(){return this.droppedCount}drain(){const t=this.buf.slice();return this.droppedCount>0&&t.unshift({t:t[0]?.t??new Date().toISOString(),type:"system",level:"info",message:`${N} ${this.droppedCount} earlier breadcrumbs dropped (buffer limit)`}),t}clear(){this.buf.length=0,this.sizes.length=0,this.bytes=0}}const N=`[${G.toLowerCase()}]`;function gt(n={}){const t=n.win??window,e=n.config??{},s=new K(e.maxEntries??100,e.maxBytes??65536),i=new AbortController,d=[],g=[];let h=!1,r=!1;const m=(a,c,u,o)=>{if(!h){h=!0;try{const l=performance.now();let p=S(z(u.slice(0,C)),I);const A=o?R(o):void 0;performance.now()-l>4&&(p=S(p,256),r||(r=!0,s.push({t:new Date().toISOString(),type:"system",level:"info",message:`${N} a breadcrumb exceeded the redaction budget and was truncated`})));const _={t:new Date().toISOString(),type:a,message:p};c&&(_.level=c),A&&Object.keys(A).length&&(_.data=A),s.push(_)}catch{}h=!1}},y=([a,c,u,o])=>{const l=u==="log"||u==="info"||u==="warn"||u==="error"?u:"info";try{const p=c==="navigation"?b(o.slice(0,C)):S(z(o.slice(0,C)),I);s.push({t:new Date(a).toISOString(),type:c,level:l,message:p})}catch{}};if(n.early){const{records:a,dropped:c}=n.early.drain(l=>y(l));s.noteDropped(c);let u=0;const o=()=>{const l=performance.now();for(;u<a.length&&performance.now()-l<4;)y(a[u++]);u<a.length&&t.setTimeout(o,0)};o()}const k=e.consoleLevels??["log","info","warn","error"];if(e.console!==!1)for(const a of["log","info","debug"]){const c=a==="debug"?"info":a;k.includes(c)&&d.push(E(t.console,a,u=>function(...o){const l=u.apply(this,o);return m("console",c,o.map(p=>j(p)).join(" ")),l}))}const $=a=>{if(!n.backendOrigin)return!1;try{return new URL(a,t.location.href).origin===n.backendOrigin}catch{return!1}};if(e.network!==!1){d.push(E(t,"fetch",u=>function(...o){const l=performance.now();let p="GET",A="";try{const f=o[0];A=typeof f=="string"?f:f instanceof URL?f.href:f.url,p=(o[1]?.method??f.method??"GET").toUpperCase()}catch{}const _=u.apply(this,o);return $(A)?_:_.then(f=>(m("network",f.ok?"info":"error",`${p} ${b(f.url||A)} \u2192 ${f.status}`,{method:p,url:b(f.url||A),status:f.status,ok:f.ok,type:f.type,redirected:f.redirected,duration_ms:Math.round(performance.now()-l)}),f),f=>{const Z=f?.name==="AbortError";throw m("network",Z?"info":"error",`${p} ${b(A)} failed`,{method:p,url:b(A),duration_ms:Math.round(performance.now()-l),aborted:Z}),f})}));const a=new WeakMap,c=t.XMLHttpRequest?.prototype;c&&(d.push(E(c,"open",u=>function(...o){try{a.set(this,{method:String(o[0]??"GET").toUpperCase(),url:String(o[1]??""),t0:0})}catch{}return u.apply(this,o)})),d.push(E(c,"send",u=>function(...o){const l=a.get(this);return l&&!$(l.url)&&(l.t0=performance.now(),this.addEventListener("loadend",()=>{m("network",this.status>=400||this.status===0?"error":"info",`${l.method} ${b(l.url)} \u2192 ${this.status}`,{method:l.method,url:b(l.url),status:this.status,duration_ms:Math.round(performance.now()-l.t0)})},{once:!0,signal:i.signal})),u.apply(this,o)})))}if(e.navigation!==!1&&n.subscribeNav&&g.push(n.subscribeNav((a,c)=>{m("navigation","info",`${b(a)} \u2192 ${b(c)}`,{from:b(a),to:b(c)})})),e.clicks!==!1){let a=0;t.document.addEventListener("click",c=>{try{const u=performance.now();if(u-a<100)return;a=u;const o=c.target;if(!o||typeof o.closest!="function")return;if(o.closest(pt)){m("click",void 0,"click [masked]");return}const l=o.tagName.toLowerCase(),p=o.getAttribute("role")??"",A=(o.getAttribute("aria-label")??o.innerText??"").trim().slice(0,80),_=o.getAttribute("data-testid")??"",f=o.id?`#${o.id}`:"",Z=typeof o.className=="string"&&o.className?`.${o.className.split(/\s+/)[0]}`:"";m("click",void 0,`click <${l}${f}>${A?` "${A}"`:""}`,{tag:l,...p?{role:p}:{},..._?{testId:_}:{},selector:`${l}${f}${Z}`})}catch{}},{capture:!0,passive:!0,signal:i.signal})}return{drain:()=>s.drain(),status:()=>s.dropped>0?"truncated":"ok",note:a=>m("system","info",`${N} ${a}`),destroy(){i.abort();for(const a of d)a();d.length=0;for(const a of g)a();g.length=0,s.clear()}}}export{K as BreadcrumbBuffer,gt as installTierC,j as serialise};
@@ -0,0 +1,5 @@
1
+ var K,S,we,F,$e,Se,Ce,ae,V,q,Te,ie,le,ce,G={},Y=[],ct=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Q=Array.isArray;function j(e,t){for(var n in t)e[n]=t[n];return e}function de(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function P(e,t,n){var o,s,r,l={};for(r in t)r=="key"?o=t[r]:r=="ref"?s=t[r]:l[r]=t[r];if(arguments.length>2&&(l.children=arguments.length>3?K.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)l[r]===void 0&&(l[r]=e.defaultProps[r]);return J(e,l,o,s,null)}function J(e,t,n,o,s){var r={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++we,__i:-1,__u:0};return s==null&&S.vnode!=null&&S.vnode(r),r}function L(e){return e.children}function X(e,t){this.props=e,this.context=t}function U(e,t){if(t==null)return e.__?U(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?U(e):null}function dt(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],s=[],r=j({},t);r.__v=t.__v+1,S.vnode&&S.vnode(r),ue(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??U(t),!!(32&t.__u),s),r.__v=t.__v,r.__.__k[r.__i]=r,Ne(o,r,s),t.__e=t.__=null,r.__e!=n&&Ee(r)}}function Ee(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Ee(e)}function Ae(e){(!e.__d&&(e.__d=!0)&&F.push(e)&&!Z.__r++||$e!=S.debounceRendering)&&(($e=S.debounceRendering)||Se)(Z)}function Z(){try{for(var e,t=1;F.length;)F.length>t&&F.sort(Ce),e=F.shift(),t=F.length,dt(e)}finally{F.length=Z.__r=0}}function Me(e,t,n,o,s,r,l,d,p,u,f){var v,i,g,w,m,_,$=o&&o.__k||Y,x=t.length;for(p=ut(n,t,$,p,x),v=0;v<x;v++)(g=n.__k[v])!=null&&(i=g.__i!=-1&&$[g.__i]||G,g.__i=v,_=ue(e,g,i,s,r,l,d,p,u,f),w=g.__e,g.ref&&i.ref!=g.ref&&(i.ref&&pe(i.ref,null,g),f.push(g.ref,g.__c||w,g)),m==null&&w!=null&&(m=w),4&g.__u?(p=De(g,p,e),i.__e&&(i.__e=null)):typeof g.type=="function"&&_!==void 0?p=_:w&&(p=w.nextSibling),g.__u&=-7);return n.__e=m,p}function ut(e,t,n,o,s){var r,l,d,p,u,f=n.length,v=f,i=0;for(e.__k=new Array(s),r=0;r<s;r++)(l=t[r])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[r]=J(null,l,null,null,null):Q(l)?l=e.__k[r]=J(L,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[r]=J(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[r]=l,p=r+i,l.__=e,l.__b=e.__b+1,d=null,(u=l.__i=pt(l,n,p,v))!=-1&&(v--,(d=n[u])&&(d.__u|=2)),d==null||d.__v==null?(u==-1&&(s>f?i--:s<f&&i++),typeof l.type!="function"&&(l.__u|=4)):u!=p&&(u==p-1?i--:u==p+1?i++:(u>p?i--:i++,l.__u|=4))):e.__k[r]=null;if(v)for(r=0;r<f;r++)(d=n[r])!=null&&(2&d.__u)==0&&(d.__e==o&&(o=U(d)),Oe(d,d));return o}function De(e,t,n){var o,s;if(typeof e.type=="function"){for(o=e.__k,s=0;o&&s<o.length;s++)o[s]&&(o[s].__=e,t=De(o[s],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=U(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function pt(e,t,n,o){var s,r,l,d=e.key,p=e.type,u=t[n],f=u!=null&&(2&u.__u)==0;if(u===null&&d==null||f&&d==u.key&&p==u.type)return n;if(o>(f?1:0)){for(s=n-1,r=n+1;s>=0||r<t.length;)if((u=t[l=s>=0?s--:r++])!=null&&(2&u.__u)==0&&d==u.key&&p==u.type)return l}return-1}function Re(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ct.test(t)?n:n+"px"}function ee(e,t,n,o,s){var r,l;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Re(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Re(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(Te,"$1")),l=t.toLowerCase(),t=l in e||t=="onFocusOut"||t=="onFocusIn"?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=n,n?o?n[q]=o[q]:(n[q]=ie,e.addEventListener(t,r?ce:le,r)):e.removeEventListener(t,r?ce:le,r);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Pe(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[V]==null)t[V]=ie++;else if(t[V]<n[q])return;return n(S.event?S.event(t):t)}}}function ue(e,t,n,o,s,r,l,d,p,u){var f,v,i,g,w,m,_,$,x,A,M,y,C,D,N,B,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(p=!!(32&n.__u),r=[d=t.__e=n.__e]),(f=S.__b)&&f(t);e:if(typeof k=="function"){v=l.length;try{if(x=t.props,A=k.prototype&&k.prototype.render,M=(f=k.contextType)&&o[f.__c],y=f?M?M.props.value:f.__:o,n.__c?$=(i=t.__c=n.__c).__=i.__E:(A?t.__c=i=new k(x,y):(t.__c=i=new X(x,y),i.constructor=k,i.render=gt),M&&M.sub(i),i.state||(i.state={}),i.__n=o,g=i.__d=!0,i.__h=[],i._sb=[]),A&&i.__s==null&&(i.__s=i.state),A&&k.getDerivedStateFromProps!=null&&(i.__s==i.state&&(i.__s=j({},i.__s)),j(i.__s,k.getDerivedStateFromProps(x,i.__s))),w=i.props,m=i.state,i.__v=t,g)A&&k.getDerivedStateFromProps==null&&i.componentWillMount!=null&&i.componentWillMount(),A&&i.componentDidMount!=null&&i.__h.push(i.componentDidMount);else{if(A&&k.getDerivedStateFromProps==null&&x!==w&&i.componentWillReceiveProps!=null&&i.componentWillReceiveProps(x,y),t.__v==n.__v||!i.__e&&i.shouldComponentUpdate!=null&&i.shouldComponentUpdate(x,i.__s,y)===!1){t.__v!=n.__v&&(i.props=x,i.state=i.__s,i.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(R){R&&(R.__=t)}),Y.push.apply(i.__h,i._sb),i._sb=[],i.__h.length&&l.push(i),d=U(n);break e}i.componentWillUpdate!=null&&i.componentWillUpdate(x,i.__s,y),A&&i.componentDidUpdate!=null&&i.__h.push(function(){i.componentDidUpdate(w,m,_)})}if(i.context=y,i.props=x,i.__P=e,i.__e=!1,C=S.__r,D=0,A)i.state=i.__s,i.__d=!1,C&&C(t),f=i.render(i.props,i.state,i.context),Y.push.apply(i.__h,i._sb),i._sb=[];else do i.__d=!1,C&&C(t),f=i.render(i.props,i.state,i.context),i.state=i.__s;while(i.__d&&++D<25);i.state=i.__s,i.getChildContext!=null&&(o=j(j({},o),i.getChildContext())),A&&!g&&i.getSnapshotBeforeUpdate!=null&&(_=i.getSnapshotBeforeUpdate(w,m)),N=f!=null&&f.type===L&&f.key==null?Le(f.props.children):f,d=Me(e,Q(N)?N:[N],t,n,o,s,r,l,d,p,u),i.base=t.__e,t.__u&=-161,i.__h.length&&l.push(i),$&&(i.__E=i.__=null)}catch(R){if(l.length=v,t.__v=null,p||r!=null){if(R.then){for(t.__u|=p?160:128;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;r!=null&&(r[r.indexOf(d)]=null),t.__e=d}else if(r!=null)for(B=r.length;B--;)de(r[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),R.then||ze(t),S.__e(R,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):d=t.__e=ht(n.__e,t,n,o,s,r,l,p,u);return(f=S.diffed)&&f(t),128&t.__u?void 0:d}function ze(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ze))}function Ne(e,t,n){for(var o=0;o<n.length;o++)pe(n[o],n[++o],n[++o]);S.__c&&S.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(r){r.call(s)})}catch(r){S.__e(r,s.__v)}})}function Le(e){return typeof e!="object"||e==null||e.__b>0?e:Q(e)?e.map(Le):e.constructor!==void 0?null:j({},e)}function ht(e,t,n,o,s,r,l,d,p){var u,f,v,i,g,w,m,_=n.props||G,$=t.props,x=t.type;if(x=="svg"?s="http://www.w3.org/2000/svg":x=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),r!=null){for(u=0;u<r.length;u++)if((g=r[u])&&"setAttribute"in g==!!x&&(x?g.localName==x:g.nodeType==3)){e=g,r[u]=null;break}}if(e==null){if(x==null)return document.createTextNode($);e=document.createElementNS(s,x,$.is&&$),d&&(S.__m&&S.__m(t,r),d=!1),r=null}if(x==null)_===$||d&&e.data==$||(e.data=$);else{if(r=x=="textarea"&&$.defaultValue!=null?null:r&&K.call(e.childNodes),!d&&r!=null)for(_={},u=0;u<e.attributes.length;u++)_[(g=e.attributes[u]).name]=g.value;for(u in _)g=_[u],u=="dangerouslySetInnerHTML"?v=g:u=="children"||u in $||u=="value"&&"defaultValue"in $||u=="checked"&&"defaultChecked"in $||ee(e,u,null,g,s);for(u in $)g=$[u],u=="children"?i=g:u=="dangerouslySetInnerHTML"?f=g:u=="value"?w=g:u=="checked"?m=g:d&&typeof g!="function"||_[u]===g||ee(e,u,g,_[u],s);if(f)d||v&&(f.__html==v.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(v&&(e.innerHTML=""),Me(t.type=="template"?e.content:e,Q(i)?i:[i],t,n,o,x=="foreignObject"?"http://www.w3.org/1999/xhtml":s,r,l,r?r[0]:n.__k&&U(n,0),d,p),r!=null)for(u=r.length;u--;)de(r[u]);d&&x!="textarea"||(u="value",x=="progress"&&w==null?e.removeAttribute("value"):w!=null&&(w!==e[u]||x=="progress"&&!w||x=="option"&&w!=_[u])&&ee(e,u,w,_[u],s),u="checked",m!=null&&m!=e[u]&&ee(e,u,m,_[u],s))}return e}function pe(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(s){S.__e(s,n)}}function Oe(e,t,n){var o,s;if(S.unmount&&S.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||pe(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(r){S.__e(r,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(s=0;s<o.length;s++)o[s]&&Oe(o[s],t,n||typeof e.type!="function");n||de(e.__e),e.__c=e.__=e.__e=void 0}function gt(e,t,n){return this.constructor(e,n)}function He(e,t,n){var o,s,r,l;t==document&&(t=document.documentElement),S.__&&S.__(e,t),s=(o=!1)?null:t.__k,r=[],l=[],ue(t,e=t.__k=P(L,null,[e]),s||G,G,t.namespaceURI,s?null:t.firstChild?K.call(t.childNodes):null,r,s?s.__e:t.firstChild,o,l),Ne(r,e,l),e.props.children=null}K=Y.slice,S={__e:function(e,t,n,o){for(var s,r,l;t=t.__;)if((s=t.__c)&&!s.__)try{if((r=s.constructor)&&r.getDerivedStateFromError!=null&&(s.setState(r.getDerivedStateFromError(e)),l=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,o||{}),l=s.__d),l)return s.__E=s}catch(d){e=d}throw e}},we=0,X.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=j({},this.state),typeof e=="function"&&(e=e(j({},n),this.props)),e&&j(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ae(this))},X.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ae(this))},X.prototype.render=L,F=[],Se=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ce=function(e,t){return e.__v.__b-t.__v.__b},Z.__r=0,ae=Math.random().toString(8),V="__d"+ae,q="__a"+ae,Te=/(PointerCapture)$|Capture$/i,ie=0,le=Pe(!1),ce=Pe(!0);var ft=0;function a(e,t,n,o,s,r){t||(t={});var l,d,p=t;if("ref"in p)for(d in p={},t)d=="ref"?l=t[d]:p[d]=t[d];var u={type:e,props:p,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ft,__i:-1,__u:0,__source:s,__self:r};if(typeof e=="function"&&(l=e.defaultProps))for(d in l)p[d]===void 0&&(p[d]=l[d]);return S.vnode&&S.vnode(u),u}const _t="Snagset",mt="Snagset",kt="Snag",bt="Snags",b={font:"--snag-font",accent:"--snag-accent",onAccent:"--snag-onAccent",bg:"--snag-bg",fg:"--snag-fg",muted:"--snag-muted",border:"--snag-border",radius:"--snag-radius",shadow:"--snag-shadow",z:"--snag-z",motion:"--snag-motion",surface:"--snag-surface",sunken:"--snag-sunken",hover:"--snag-hover",focus:"--snag-focus",disabled:"--snag-disabled",statusOpen:"--snag-status-open",statusProgress:"--snag-status-progress",statusReview:"--snag-status-review",statusResolved:"--snag-status-resolved",anchorOrphan:"--snag-anchor-orphan",tbH:"--snag-tb-h",dockW:"--snag-dock-w",kb:"--snag-kb",thumbX:"--snag-thumb-x",thumbW:"--snag-thumb-w"},xt=e=>`var(${b[e]})`,yt=e=>"snag_"+e,Ie={query:["snag_t","snag_off","snag_debug","snag_theme"],fragment:["snag_k"]},vt="data-snag-theme";var W,T,he,je,te=0,Fe=[],E=S,Ue=E.__b,Be=E.__r,qe=E.diffed,We=E.__c,Ke=E.unmount,Ve=E.__;function ge(e,t){E.__h&&E.__h(T,e,te||t),te=0;var n=T.__H||(T.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function O(e){return te=1,wt(Qe,e)}function wt(e,t,n){var o=ge(W++,2);if(o.t=e,!o.__c&&(o.__=[Qe(void 0,t),function(d){var p=o.__N?o.__N[0]:o.__[0],u=o.t(p,d);p!==u&&(o.__N=[u,o.__[1]],o.__c.setState({}))}],o.__c=T,!T.__f)){var s=function(d,p,u){if(!o.__c.__H)return!0;var f=!1,v=o.__c.props!==d;if(o.__c.__H.__.some(function(g){if(g.__N){f=!0;var w=g.__[0];g.__=g.__N,g.__N=void 0,w!==g.__[0]&&(v=!0)}}),r){var i=r.call(this,d,p,u);return f?i||v:i}return!f||v};T.__f=!0;var r=T.shouldComponentUpdate,l=T.componentWillUpdate;T.componentWillUpdate=function(d,p,u){if(this.__e){var f=r;r=void 0,s(d,p,u),r=f}l&&l.call(this,d,p,u)},T.shouldComponentUpdate=s}return o.__N||o.__}function H(e,t){var n=ge(W++,3);!E.__s&&Ye(n.__H,t)&&(n.__=e,n.u=t,T.__H.__h.push(n))}function I(e){return te=5,$t(function(){return{current:e}},[])}function $t(e,t){var n=ge(W++,7);return Ye(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function St(){for(var e;e=Fe.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ne),t.__h.some(fe),t.__h=[]}catch(n){t.__h=[],E.__e(n,e.__v)}}}E.__b=function(e){T=null,Ue&&Ue(e)},E.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ve&&Ve(e,t)},E.__r=function(e){Be&&Be(e),W=0;var t=(T=e.__c).__H;t&&(he===T?(t.__h=[],T.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ne),t.__h.some(fe),t.__h=[],W=0)),he=T},E.diffed=function(e){qe&&qe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fe.push(t)!==1&&je===E.requestAnimationFrame||((je=E.requestAnimationFrame)||Ct)(St)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),he=T=null},E.__c=function(e,t){t.some(function(n){try{n.__h.some(ne),n.__h=n.__h.filter(function(o){return!o.__||fe(o)})}catch(o){t.some(function(s){s.__h&&(s.__h=[])}),t=[],E.__e(o,n.__v)}}),We&&We(e,t)},E.unmount=function(e){Ke&&Ke(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{ne(o)}catch(s){t=s}}),n.__H=void 0,t&&E.__e(t,n.__v))};var Ge=typeof requestAnimationFrame=="function";function Ct(e){var t,n=function(){clearTimeout(o),Ge&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Ge&&(t=requestAnimationFrame(n))}function ne(e){var t=T,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),T=t}function fe(e){var t=T;e.__c=e.__(),T=t}function Ye(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Qe(e,t){return typeof t=="function"?t(e):t}const Tt={product:_t,set:mt,item:kt,items:bt};function Je(e){return(t,n)=>(e[t]??"").replace(/\{(\w+)\}/g,(o,s)=>{const r=n?.[s]??Tt[s];return r===void 0?o:String(r)})}const z=e=>new Intl.NumberFormat().format(e),Xe={"where.anchored":"{label}","where.approximate":"position approximate \u2014 the page changed","where.orphaned":"moved \u2014 the element is gone","status.open":"Active","status.progress":"In progress","status.review":"In review","status.resolved":"Resolved","author.unknown":"Someone","label.image":"an image","label.link":"a link","label.button":"a button","label.tag":"the {tag}"},Et=Je(Xe),oe={open:{colour:"#4F6EF7"},progress:{colour:"#F59E0B"},review:{colour:"#8B5CF6"},resolved:{colour:"#10B981"}},_e=e=>oe[e]?.colour??"#8a8f98",Ze=e=>e==="progress"||e==="resolved"?"#16161a":"#fff",me=e=>e in oe?Et(`status.${e}`):e,c=Object.fromEntries(Object.keys(b).map(e=>[e,xt(e)])),At=Object.entries(oe).map(([e,t])=>` ${b[`status${e[0].toUpperCase()}${e.slice(1)}`]}:${t.colour};`).join(`
2
+ `);`${c.font}${c.fg}${b.font}${b.accent}${b.bg}${b.fg}${b.muted}${b.border}${b.radius}${b.shadow}${b.z}${b.motion}${b.surface}${c.fg}${c.bg}${b.sunken}${c.fg}${c.bg}${b.hover}${c.fg}${c.bg}${b.onAccent}${b.focus}${c.accent}${c.fg}${b.disabled}${c.muted}${c.bg}${At}${b.anchorOrphan}${vt}${b.accent}${b.onAccent}${b.bg}${b.fg}${b.muted}${b.border}${b.shadow}${b.motion}${b.bg}${b.fg}${b.muted}${b.border}${b.accent}${b.onAccent}${b.surface}${b.sunken}${b.hover}${b.focus}${b.disabled}${b.shadow}${b.anchorOrphan}`;const Mt={dock:5},et=new WeakMap;function tt(e,t,n){let o=et.get(e);if(o||et.set(e,o=new Set),o.has(t))return;o.add(t);try{const l=new CSSStyleSheet;l.replaceSync(n),e.adoptedStyleSheets=[...e.adoptedStyleSheets,l];return}catch{}const r=(e.ownerDocument??document).createElement("style");r.setAttribute(`data-snag-${t}`,""),r.textContent=n,e.appendChild(r)}const Dt=` .snag-input,.snag-text{width:100%;box-sizing:border-box;background:${c.surface};color:inherit;border:1px solid ${c.border};border-radius:${c.radius};padding:8px;font:inherit;resize:vertical}@media (pointer:coarse){.snag-input,.snag-text{font-size:16px}}.snag-input:focus,.snag-text:focus{outline:2px solid ${c.focus};outline-offset:1px;border-color:transparent}.snag-input--bad{border-color:${c.anchorOrphan}}.snag-note{margin:-2px 0 0;color:${c.anchorOrphan};font-size:11px;line-height:1.35}.snag-note.snag-dim{color:${c.muted}}.snag-actions{display:flex;justify-content:flex-end;gap:6px}.snag-actions button{appearance:none;border:0;border-radius:calc(${c.radius} - 1px);padding:7px 13px;font:inherit;cursor:pointer;min-height:32px;transition:background ${c.motion}}.snag-cancel{background:transparent;color:${c.muted}}.snag-armed{color:${c.anchorOrphan};font-weight:600}.snag-cancel:hover{background:${c.hover};color:inherit}.snag-send{background:${c.accent};color:${c.onAccent};font-weight:600}.snag-send:disabled{opacity:.45;cursor:not-allowed}.snag-actions button:focus-visible{outline:2px solid ${c.focus};outline-offset:2px}`;function Rt(e,t,n){const[o,s]=O(!1);return H(()=>{if(!o)return;const r=setTimeout(()=>s(!1),3e3);return()=>clearTimeout(r)},[o]),{armed:o,press(){if(o||t){s(!1),e();return}s(!0)}}}function Pt(e){const t=window.visualViewport;if(!t)return;let n=0,o=0;const s=()=>{n=0;const d=Math.max(0,Math.round(window.innerHeight-t.height-t.offsetTop));e.style.setProperty(b.kb,`${d}px`)},r=()=>{n||(n=requestAnimationFrame(s))},l=()=>{clearTimeout(o),o=window.setTimeout(s,300)};return s(),t.addEventListener("resize",r),t.addEventListener("scroll",r),window.addEventListener("orientationchange",r),e.addEventListener("focusout",l),()=>{n&&cancelAnimationFrame(n),clearTimeout(o),t.removeEventListener("resize",r),t.removeEventListener("scroll",r),window.removeEventListener("orientationchange",r),e.removeEventListener("focusout",l)}}const zt="noreferrer nofollow";function Nt(e){const t=e.trim();if(!t||/[-]/.test(t)||t.startsWith("//"))return null;const n=/^([a-z][a-z0-9+.-]*):/i.exec(t);return n?/^(https?|mailto)$/i.test(n[1])?t:null:t}const Lt=new RegExp(["\\*\\*(?=\\S)(?<bold>[\\s\\S]*?\\S)\\*\\*","(?<!\\w)__(?=\\S)(?<boldU>[\\s\\S]*?\\S)__(?!\\w)","(?<!\\*)\\*(?!\\*)(?=\\S)(?<em>[\\s\\S]*?\\S)(?<!\\*)\\*(?!\\*)","(?<!\\w)_(?=\\S)(?<emU>[\\s\\S]*?\\S)_(?!\\w)","`(?<code>[^`]+)`","\\[(?<label>[^\\]\\n]*)\\]\\((?<href>(?:[^()\\s]|\\([^()\\s]*\\))*)\\)"].join("|")),Ot=4;function re(e,t=0,n=0){const o=[];let s=e,r=t;if(n>=Ot)return e?[e]:[];for(;;){const l=Lt.exec(s);if(!l)return s&&o.push(s),o;l.index>0&&o.push(s.slice(0,l.index));const d=`i${r++}`,p=l.groups,u=p.bold??p.boldU,f=p.em??p.emU;if(u!==void 0)o.push(P("strong",{key:d},re(u,r,n+1)));else if(f!==void 0)o.push(P("em",{key:d},re(f,r,n+1)));else if(p.code!==void 0)o.push(P("code",{key:d},p.code));else{const v=Nt(p.href??"");o.push(v?P("a",{key:d,href:v,target:"_blank",rel:zt},p.label??""):l[0])}s=s.slice(l.index+l[0].length)}}const ke=/^```[^\n]*$/,be=/^[-*]\s+(.*)$/,xe=/^\d{1,9}[.)]\s+(.*)$/;function nt(e){const t=e.split(`
3
+ `),n=[];let o=0,s=0;for(;o<t.length;){const r=t[o];if(ke.test(r)){const u=[];for(o++;o<t.length&&!ke.test(t[o]);)u.push(t[o++]);o++,n.push(P("pre",{key:`b${s++}`},P("code",null,u.join(`
4
+ `))));continue}const l=be.exec(r),d=xe.exec(r);if(l||d){const u=l?be:xe,f=[];for(;o<t.length;){const v=u.exec(t[o]);if(!v)break;f.push(P("li",{key:`l${f.length}`},re(v[1]))),o++}n.push(P(l?"ul":"ol",{key:`b${s++}`},f));continue}const p=[];for(;o<t.length;){const u=t[o];if(!u.trim()||ke.test(u)||be.test(u)||xe.test(u))break;p.push(u),o++}p.length?n.push(P("p",{key:`b${s++}`},re(p.join(`
5
+ `)))):o++}return P("div",{class:"snag-md"},n)}const Ht={"detail.details":"Anchor details","detail.hidden":"This element isn't visible right now \u2014 it may be inside a closed menu, tab, or accordion.","detail.orphaned":"The element this was pinned to has moved or gone \u2014 it was {label}.","detail.approximate":"The page changed since this was written, so the pin is close rather than exact \u2014 it points at {label}.","detail.unavailable":"Some of the matching steps couldn't load, so this was judged with the basic ones only.","detail.filedat":"Filed at {query}.","detail.openquery":"Open with original query","capture.agent":"{browser} \xB7 {os}","capture.agent.noos":"{browser}","capture.device":"{device} \xB7 {w}\xD7{h} @{dpr}x","capture.device.at1x":"{device} \xB7 {w}\xD7{h}"},It={"disclosure.title":"Before your first comment","disclosure.always":"Each comment carries the page address, viewport size and browser make.","disclosure.crumbs.on":"Recent console messages and network results ride along, recognisable secrets redacted first.","disclosure.crumbs.off":"Console and network capture is off here.","disclosure.screenshot.off":"Screenshots are off for this project.","disclosure.screenshot.on":"{product} never reads what you type. Screenshots are pictures of the page, so anything visible on screen is in the picture \u2014 mark sensitive regions with {maskAttr} and they are blurred before the screenshot leaves your browser.","disclosure.retention":"Everything stays in this browser until someone exports it \u2014 the privacy notes list what can still leak.","disclosure.retention.server":"Your comment, the page address and the details above are sent to {host} when you post \u2014 the privacy notes list what can still leak.","disclosure.ack":"Got it","composer.aria":"New comment","composer.parent":"Pin the parent","composer.child":"Pin the first child","composer.shot":"Add a screenshot","composer.name":"Your name","composer.email":"Email, so we can reply","composer.email.bad":"Check the address \u2014 or leave it blank.","composer.chars":"{n} characters left","composer.body":"Comment","composer.body.placeholder":"What's the {item}?","action.cancel":"Cancel","action.post":"Post comment","composer.discard.sure":"Sure? Discard this comment","action.discard":"Discard?"},jt={"shot.open":"See the screenshot","shot.aria":"Screenshot","shot.close":"Close","announce.status":"Comment {key} set to {status}.","search.placeholder":"Search {n} comments\u2026","search.aria":"Search comments","round.label":"Round","round.closed":"(closed)","filter.status":"Status","filter.clear":"Clear","filter.selectall":"Select all","sort.button":"Sort","sort.newest":"Newest first","sort.oldest":"Oldest first","sort.page":"By page","filter.button":"Filter","filter.button.n":"Filter \xB7 {n}","filter.by":"Comments by","filter.by.anyone":"Anyone","filter.pages":"Pages","filter.pages.all":"All pages","filter.pageonly":"Show comments on this page only","badge.anchored":"","badge.approximate":"~","badge.orphaned":"moved","badge.hidden":"hidden","capture.label":"Comment left on","capture.page":"{route}","device.Mobile":"Mobile","device.Desktop":"Desktop","dock.aria":"All comments","dock.title.list":"All comments","dock.title.detail":"Comment","dock.close":"Close all comments","dock.empty":"No comments yet. Press +, then click anything on the page.","dock.empty.filter":"Nothing matches that filter.","dock.empty.orphans":"Every comment here lost its element \u2014 but what each one pointed at is still recorded.","dock.empty.page":"Nothing on this page. {n} comments on {m} other pages.","dock.row.empty":"(no comment)","dock.replies":"{n} replies","dock.here":"you\u2019re here","dock.goto":"Go to {route}","dock.cluster":"{n} comments in this cluster","dock.cluster.clear":"Show all","dock.hiddenrow":"That comment is now hidden by your filter","dock.hiddenrow.show":"Show","dock.back":"All","dock.back.aria":"Back to all comments","dock.position":"{n} of {total}","dock.prev":"Previous comment","dock.next":"Next comment","dock.clear":"Clear all","dock.clear.aria":"Delete every comment in this review","comment.edit":"Edit this comment","comment.delete":"Delete this comment and its pin","reply.delete":"Delete this reply","detail.hidden.show":"Show anyway","field.status":"Status","permalink.copy":"Copy link","permalink.copied":"Copied","reply.add":"Add reply","reply.aria":"Reply","reply.placeholder":"Reply\u2026","reply.send":"Reply","action.edit":"Edit","action.delete":"Delete","action.save":"Save","action.sure":"Sure?","export.md":"Export Markdown","export.json":"JSON"},Ft={...Xe,...Ht,...It,...jt},h=Je(Ft),Ut=[/^utm_/,/^(gclid|gbraid|wbraid|fbclid|msclkid|ttclid|twclid|igshid|yclid|li_fat_id)$/,/^(mc_cid|mc_eid|_hsenc|_hsmi|vero_id|oly_enc_id|oly_anon_id)$/,/^_vercel_/,/^__vercel_/,/^_rsc$/],Bt=[...Ie.query,...Ie.fragment];function qt(e,t=[]){return Bt.includes(e)||t.includes(e)?!0:Ut.some(n=>n.test(e))}const se=["open","progress","review","resolved"];function Wt(e,t){const n=e.includes(t)?e.filter(o=>o!==t):[...e,t];return n.length>=se.length?[]:n}function Kt(e,t,n){return t.statuses.length>0&&se.includes(e.status)&&!t.statuses.includes(e.status)||t.by&&e.createdBy.id!==t.by||t.page&&e.route!==t.page?!1:(t.read,!0)}function Vt(e,t,n,o){let s=e;t.pageOnly&&(s=s.filter(l=>l.route===n)),t.newOnly;const r=t.q?.trim().toLowerCase();return r&&(s=s.filter(l=>l.comments.some(d=>(d.body??"").toLowerCase().includes(r)||d.author.name.toLowerCase().includes(r))||l.createdBy.name.toLowerCase().includes(r))),s}function Gt(e,t){if(t==="page")return e;const n=(s,r)=>Date.parse(s.createdAt)-Date.parse(r.createdAt),o=[...e].sort(n);return t==="oldest"?o:o.reverse()}function Yt(e){const t=new Map;for(const n of e)t.set(n.status,(t.get(n.status)??0)+1);return{all:e.length,byStatus:t}}function Qt(e){return(e.read!=="all"?1:0)+(e.by?1:0)+(e.page?1:0)}const ye=Object.keys(oe);function ot({label:e,title:t,cls:n,onConfirm:o}){const{armed:s,press:r}=Rt(o);return a("button",{type:"button",class:`${n}${s?" snag-dk-armed":""}`,"aria-label":s?`${h("action.sure")} ${t}`:t,title:t,onClick:r,children:s?h("action.sure"):e})}function Jt({snag:e}){const t=e.context?.derived?.device;if(!t)return null;const n=h(`device.${t}`);return a("span",{class:"snag-dk-dev",title:n,"aria-label":n,role:"img",children:t==="Mobile"?a("svg",{width:"11",height:"14",viewBox:"0 0 11 14",fill:"none","aria-hidden":"true",children:[a("rect",{x:".75",y:".75",width:"9.5",height:"12.5",rx:"1.75",stroke:"currentColor","stroke-width":"1.5"}),a("path",{d:"M4.5 11h2",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})]}):a("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[a("rect",{x:".75",y:"1.75",width:"12.5",height:"8.5",rx:"1.75",stroke:"currentColor","stroke-width":"1.5"}),a("path",{d:"M5 12.75h4",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})]})})}function Xt({anchor:e}){const t=[];if(e.testid&&t.push(["testid",e.testid]),e.domid&&t.push(["id",e.domid]),e.css&&t.push(["css",e.css]),e.hostPath?.length&&t.push(["shadow host",e.hostPath.join(" >> ")]),e.role&&t.push(["role",e.role]),e.accessibleName&&t.push(["name",e.accessibleName]),e.text?.exact&&t.push(["text",e.text.exact]),e.path?.length&&t.push(["path",e.path.join(" > ")]),e.rect){const n=e.rect;t.push(["rect",`${Math.round(n.x)}, ${Math.round(n.y)} \u2014 ${Math.round(n.w)} x ${Math.round(n.h)}`])}return e.breakpoint&&t.push(["breakpoint",`${e.breakpoint} at capture \xB7 you are at ${typeof window>"u"?"?":window.innerWidth}px`]),a("details",{class:"snag-dk-anchor",children:[a("summary",{children:h("detail.details")}),a("dl",{children:t.map(([n,o])=>a("div",{children:[a("dt",{children:n}),a("dd",{children:o})]},n))})]})}function rt({body:e,onEdit:t,deleteLabel:n,onDelete:o}){const s=e??"",[r,l]=O(!1),[d,p]=O(s),u=I(null);return H(()=>{r&&u.current?.focus()},[r]),r?a("div",{class:"snag-dk-editbox",children:[a("textarea",{ref:u,class:"snag-text",rows:3,"aria-label":h("comment.edit"),value:d,onInput:f=>p(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.metaKey||f.ctrlKey)&&(f.preventDefault(),d.trim()&&(t(d.trim()),l(!1))),f.key==="Escape"&&(f.stopPropagation(),p(s),l(!1))}}),a("div",{class:"snag-actions",children:[a("button",{type:"button",class:"snag-cancel",onClick:()=>{p(s),l(!1)},children:h("action.cancel")}),a("button",{type:"button",class:"snag-send",disabled:!d.trim()||d.trim()===s,onClick:()=>{t(d.trim()),l(!1)},children:h("action.save")})]})]}):a("div",{class:"snag-dk-acts",children:[a("button",{type:"button",class:"snag-dk-act",title:h("comment.edit"),"aria-label":h("comment.edit"),onClick:()=>{p(s),l(!0)},children:h("action.edit")}),a(ot,{label:h("action.delete"),title:n,cls:"snag-dk-act snag-dk-act--danger",onConfirm:o})]})}function Zt({snag:e}){const t=e.anchorReasons?.includes("hidden")??!1;return a("span",{class:"snag-dk-dim snag-dk-where",children:[t&&a(L,{children:[a("span",{class:"snag-dk-moved",children:h("badge.hidden")})," "]}),e.anchorState!=="anchored"&&a(L,{children:[a("span",{class:"snag-dk-moved",children:h(`badge.${e.anchorState}`)})," "]}),e.anchor.label]})}function en(e){const t=new Map,n=new Map;for(const o of e){const s=(t.get(o.route)??0)+1;t.set(o.route,s),n.set(o.id,s)}return n}function tn(e,t){const n=new Map;for(const o of e){const s=n.get(o.route);s?s.push(o):n.set(o.route,[o])}return[...n.entries()].map(([o,s])=>({route:o,here:o===t,snags:s})).sort((o,s)=>o.route.localeCompare(s.route))}function nn({snag:e,n:t,here:n,onOpen:o,onHover:s}){const r=d=>s(n?d:null),l=n?"":h("dock.goto",{route:e.route});return a("li",{children:a("button",{type:"button",class:"snag-dk-item",onClick:()=>o(e.id),onPointerEnter:()=>r(e.id),onPointerLeave:()=>r(null),onFocus:()=>r(e.id),onBlur:()=>r(null),children:[a("span",{class:`snag-dk-num${e.anchorState==="anchored"?"":` snag-dk-num--${e.anchorState}`}`,style:{background:_e(e.status),color:Ze(e.status)},children:t}),a("span",{class:"snag-dk-main",children:[a("span",{class:`snag-dk-body${e.status==="resolved"?" snag-dk-done":""}`,children:e.comments[0]?.body??h("dock.row.empty")}),a("span",{class:"snag-dk-sub",children:a(Zt,{snag:e})})]}),a(Jt,{snag:e}),e.comments.length>1&&a("span",{class:"snag-dk-replies",role:"img","aria-label":h("dock.replies",{n:z(e.comments.length-1)}),children:z(e.comments.length-1)}),!n&&a("span",{class:"snag-dk-goto",role:"img",title:l,"aria-label":l,children:"\u2197"})]})})}function on({rounds:e,activeRound:t,onRound:n}){return a("label",{class:"snag-dk-round",children:[a("span",{class:"snag-dk-chiplabel",children:h("round.label")}),a("select",{class:"snag-input",value:String(t??""),onChange:o=>n(Number(o.currentTarget.value)),children:e.map(o=>a("option",{value:String(o.number),children:[o.name,o.closed?` ${h("round.closed")}`:""]},o.number))})]})}const st=e=>c[`status${e[0].toUpperCase()}${e.slice(1)}`]??c.muted;function rn({round:e,filter:t,onFilter:n}){const[o,s]=O(null),r=Yt(e),l=i=>{const g={...t};for(const[w,m]of Object.entries(i))m===void 0?delete g[w]:g[w]=m;n(g)},d=t.statuses.length>0,p=Qt(t),u=[...new Map(e.map(i=>[i.createdBy.id,i.createdBy.name]))],f=[...new Set(e.map(i=>i.route))].sort(),v=[...r.byStatus.keys()].filter(i=>!se.includes(i));return a("div",{class:"snag-dk-filters",children:[a("input",{class:"snag-input snag-dk-search",type:"search","aria-label":h("search.aria"),placeholder:h("search.placeholder",{n:z(e.length)}),value:t.q??"",onInput:i=>l({q:i.currentTarget.value||void 0})}),a("div",{class:"snag-dk-chiphead",children:[a("span",{class:"snag-dk-chiplabel",children:h("filter.status")}),a("button",{type:"button",class:"snag-dk-link",onClick:()=>l({statuses:[]}),children:h(d?"filter.selectall":"filter.clear")})]}),a("div",{class:"snag-dk-chips",role:"group","aria-label":h("filter.status"),children:[se.map(i=>{const g=t.statuses.includes(i);return a("button",{type:"button",class:"snag-dk-chip","aria-pressed":g,style:`border-color:color-mix(in srgb, ${st(i)} 60%, transparent);background:color-mix(in srgb, ${st(i)} ${g?28:10}%, transparent)`,onClick:()=>l({statuses:Wt(t.statuses,i)}),children:[me(i)," ",a("span",{class:"snag-dk-dim",children:z(r.byStatus.get(i)??0)})]})}),v.map(i=>a("span",{class:"snag-dk-chip snag-dk-chip-stray",children:[i," ",a("span",{class:"snag-dk-dim",children:z(r.byStatus.get(i)??0)})]}))]}),a("div",{class:"snag-dk-menus",children:[o&&a("div",{class:"snag-dk-menubg","aria-hidden":"true",onClick:()=>s(null)}),a("span",{class:"snag-dk-menuwrap",children:[a("button",{type:"button",class:"snag-dk-link","aria-expanded":o==="sort",onClick:()=>s(o==="sort"?null:"sort"),children:h("sort.button")}),o==="sort"&&a("div",{class:"snag-dk-menu",role:"menu",children:[["newest","sort.newest"],["oldest","sort.oldest"],["page","sort.page"]].map(([i,g])=>a("button",{type:"button",role:"menuitemradio","aria-checked":t.sort===i,onClick:()=>{l({sort:i}),s(null)},children:[a("span",{class:"snag-dk-tick","aria-hidden":"true",children:t.sort===i?"\u2713":"\xA0"}),h(g)]}))})]}),a("span",{class:"snag-dk-menuwrap",children:[a("button",{type:"button",class:"snag-dk-link","aria-expanded":o==="filter",onClick:()=>s(o==="filter"?null:"filter"),children:p>0?h("filter.button.n",{n:z(p)}):h("filter.button")}),o==="filter"&&a("div",{class:"snag-dk-menu snag-dk-menu-form",children:[a("label",{children:[h("filter.by"),a("select",{value:t.by??"",onChange:i=>l({by:i.currentTarget.value||void 0}),children:[a("option",{value:"",children:h("filter.by.anyone")}),u.map(([i,g])=>a("option",{value:i,children:g}))]})]}),a("label",{children:[h("filter.pages"),a("select",{value:t.page??"",onChange:i=>l({page:i.currentTarget.value||void 0}),children:[a("option",{value:"",children:h("filter.pages.all")}),f.map(i=>a("option",{value:i,children:i}))]})]})]})]})]}),a("label",{class:"snag-dk-pageonly",children:[a("input",{type:"checkbox",checked:t.pageOnly,onChange:i=>l({pageOnly:i.currentTarget.checked})})," ",h("filter.pageonly")]})]})}function sn({snags:e,groups:t,route:n,onOpen:o,onHover:s,onExport:r,onClearAll:l,clusterFilter:d,onClusterClear:p,filter:u,onFilter:f,hiddenNote:v,onHiddenShow:i,rounds:g,activeRound:w,onRound:m}){const _=en(e),$=t.flatMap(y=>y.snags),x=u.statuses.length>0||!!u.by||!!u.page||!!u.q?.trim()||u.pageOnly||u.newOnly||u.read!=="all",A=I(null),M=I(null);return H(()=>{const y=A.current,C=M.current;!y||!C||(y.scrollTop+=C.getBoundingClientRect().top-y.getBoundingClientRect().top)},[n,t.length]),a(L,{children:[g&&g.length>1&&m&&a(on,{rounds:g,...w===void 0?{}:{activeRound:w},onRound:m}),e.length>0&&a(rn,{round:e,filter:u,onFilter:f}),e.length===0?a("div",{class:"snag-dk-empty",children:a("p",{children:h("dock.empty")})}):$.length===0&&x?a("div",{class:"snag-dk-empty",children:u.pageOnly&&e.some(y=>y.route!==n)?a("p",{children:h("dock.empty.page",{n:z(e.filter(y=>y.route!==n).length),m:z(new Set(e.filter(y=>y.route!==n).map(y=>y.route)).size)})}):a("p",{children:h("dock.empty.filter")})}):a(L,{children:[v&&a("p",{class:"snag-dk-notice",children:[h("dock.hiddenrow")," ",a("button",{type:"button",class:"snag-dk-link",onClick:()=>i(v),children:h("dock.hiddenrow.show")})]}),d&&a("p",{class:"snag-dk-notice",children:[h("dock.cluster",{n:d.length})," ",a("button",{type:"button",class:"snag-dk-link",onClick:()=>p?.(),children:h("dock.cluster.clear")})]}),e.every(y=>y.anchorState==="orphaned")&&a("p",{class:"snag-dk-notice",children:h("dock.empty.orphans")}),a("div",{class:"snag-dk-scroll",ref:A,children:t.map(y=>a("section",{class:"snag-dk-group",ref:y.here?M:null,children:[y.route!==""&&a("h3",{class:"snag-dk-grouphd",children:[a("span",{class:"snag-dk-route",children:y.route}),y.here&&a("span",{class:"snag-dk-here",children:h("dock.here")}),a("span",{class:"snag-dk-dim",children:z(y.snags.length)})]}),a("ul",{class:"snag-dk-list",children:y.snags.map(C=>a(nn,{snag:C,n:_.get(C.id),here:y.here,onOpen:o,onHover:s},C.id))})]},y.route))})]}),a("div",{class:"snag-dk-foot",children:[a("button",{type:"button",class:"snag-dk-link",onClick:()=>r("md"),children:h("export.md")}),a("button",{type:"button",class:"snag-dk-link",onClick:()=>r("json"),children:h("export.json")}),e.length>0&&a(ot,{label:h("dock.clear"),title:h("dock.clear.aria"),cls:"snag-dk-link snag-dk-clear",onConfirm:l})]})]})}const ve=new Map;function an(e){const t=[];try{for(const[n,o]of new URL(e).searchParams)qt(n)||t.push(o&&o!=="[redacted]"?`${n}=${o}`:n)}catch{return null}return t.length?`?${t.join("&")}`:null}function ln({att:e,load:t}){const n=I(null),[o,s]=O(!1),[r,l]=O(null);return H(()=>{let d=!1;return t(e.id).then(async p=>{if(!p||d)return;const u=await createImageBitmap(p);d?u.close():l(u)}),()=>{d=!0}},[e.id]),H(()=>{const d=n.current;if(!d||!r)return;const p=142,u=p/r.width;d.width=p,d.height=Math.min(96,Math.round(r.height*u)),d.getContext("2d").drawImage(r,0,0,r.width,Math.round(d.height/u),0,0,d.width,d.height)},[r]),r?a(L,{children:[a("button",{type:"button",class:"snag-dk-shot",onClick:()=>s(!0),"aria-label":h("shot.open"),children:a("canvas",{ref:n})}),o&&a(cn,{bmp:r,onClose:()=>s(!1)})]}):null}function cn({bmp:e,onClose:t}){const n=I(null);return H(()=>{const o=n.current;o&&(o.width=e.width,o.height=e.height,o.getContext("2d").drawImage(e,0,0))},[e]),a("div",{class:"snag-dk-lightbox",role:"dialog","aria-modal":"true","aria-label":h("shot.aria"),tabIndex:-1,ref:o=>o?.focus(),onKeyDown:o=>{o.key==="Escape"&&(o.stopPropagation(),t())},onClick:t,children:[a("canvas",{ref:n}),a("button",{type:"button",class:"snag-dk-link snag-dk-lightclose",onClick:t,children:h("shot.close")})]})}function dn({snag:e,loadShot:t}){const n=e.context;if(!n)return null;const o=e.attachments?.find(d=>d.kind==="screenshot"),s=n.derived,r=n.viewport,l=r?Math.round(r.dpr*100)/100:1;return a("div",{class:"snag-dk-cap",children:[o&&t&&a(ln,{att:o,load:t}),a("p",{class:"snag-dk-caplabel",children:h("capture.label")}),n.page?.route!==void 0&&a("p",{children:h("capture.page",{route:n.page.route})}),s&&r&&a(L,{children:[a("p",{children:s.os?h("capture.agent",{browser:s.browser,os:s.os}):h("capture.agent.noos",{browser:s.browser})}),a("p",{children:l===1?h("capture.device.at1x",{device:s.device,w:r.w,h:r.h}):h("capture.device",{device:s.device,w:r.w,h:r.h,dpr:l})})]}),n.capture?.reasons?.map(d=>a("p",{class:"snag-dk-capwhy",children:d},d)),n.capture?.blindSpots?.map(d=>a("p",{class:"snag-dk-capwhy",children:d},d)),(()=>{const d=an(n.url);return d?a("p",{class:"snag-dk-capwhy",children:[h("detail.filedat",{query:d})," ",a("a",{class:"snag-dk-openq",href:n.url,target:"_blank",rel:"noreferrer",children:h("detail.openquery")})]}):null})()]})}function un({snag:e}){const[t,n]=O(!1),o=e.context?.url??e.route,s=`${o}${o.includes("?")?"&":"?"}${yt("t")}=${e.key}`;return navigator.clipboard?a("button",{type:"button",class:"snag-dk-link",onClick:()=>void navigator.clipboard.writeText(s).then(()=>{n(!0),setTimeout(()=>n(!1),1500)},()=>{}),children:h(t?"permalink.copied":"permalink.copy")}):a("input",{class:"snag-input snag-dk-permalink",readOnly:!0,value:s,"aria-label":h("permalink.copy"),onFocus:r=>r.currentTarget.select()})}function pn({snags:e,round:t,fallbackCursor:n,openId:o,onOpen:s,onStatus:r,onReply:l,onEdit:d,onDeleteComment:p,onDeleteThread:u,onShowAnyway:f,onAnnounce:v,loadShot:i}){const g=e.findIndex(k=>k.id===o),w=g>=0,m=w?g:Math.min(n,e.length),_=w?e[g]:t.find(k=>k.id===o),$=o?ve.get(o)??"":"",[x,A]=O($),[M,y]=O($.length>0),C=I(null);H(()=>{M&&C.current?.focus()},[M]);const D=k=>{A(k),o&&(k?ve.set(o,k):ve.delete(o))};if(!_)return null;const N=_.comments[0],B=t.filter(k=>k.route===_.route).findIndex(k=>k.id===_.id)+1;return a("div",{class:"snag-dk-detail",children:[a("div",{class:"snag-dk-detailhd",children:[a("button",{type:"button",class:"snag-dk-link",onClick:()=>s(null),"aria-label":h("dock.back.aria"),children:[a("span",{"aria-hidden":"true",children:"\u2190"})," ",h("dock.back")]}),a("span",{class:"snag-dk-dim",children:h("dock.position",{n:w?z(m+1):"\u2013",total:z(e.length)})}),a("span",{class:"snag-dk-nav",children:[a("button",{type:"button",class:"snag-dk-link",disabled:m<=0,"aria-label":h("dock.prev"),onClick:()=>s(e[m-1].id),children:"\u2191"}),a("button",{type:"button",class:"snag-dk-link",disabled:w?m>=e.length-1:m>=e.length,"aria-label":h("dock.next"),onClick:()=>s(e[w?m+1:m].id),children:"\u2193"})]})]}),a("div",{class:"snag-dk-card",children:[a("div",{class:"snag-dk-meta",children:[a("span",{class:"snag-dk-num",style:{background:_e(_.status),color:Ze(_.status)},children:B}),a("strong",{children:N?.author.name??h("author.unknown")}),a("span",{class:"snag-dk-dim",children:_.key}),a(un,{snag:_})]}),a("div",{class:"snag-dk-cardbody",children:nt(N?.body??"")}),N&&a(rt,{body:N.body,onEdit:k=>d(N.id,k),deleteLabel:h("comment.delete"),onDelete:()=>u(_.id)})]}),a("label",{class:"snag-dk-field",children:[a("span",{class:"snag-dk-dim",children:h("field.status")}),a("select",{class:"snag-dk-select",style:{borderColor:_e(_.status)},value:_.status,onChange:k=>{const R=k.target.value;r(_.id,R),v?.(h("announce.status",{key:_.key,status:me(R)}))},children:ye.map(k=>a("option",{value:k,children:me(k)},k))})]}),a(dn,{snag:_,...i?{loadShot:i}:{}}),_.anchorReasons?.includes("hidden")&&a("p",{class:"snag-dk-moved-note",children:[h("detail.hidden")," ",a("button",{type:"button",class:"snag-dk-link",onClick:()=>f?.(_),children:h("detail.hidden.show")})]}),_.anchorState!=="anchored"&&a("p",{class:"snag-dk-moved-note",children:[h(`detail.${_.anchorState}`,{label:_.anchor.label}),_.anchorReasons?.includes("budget-exceeded")&&` ${h("detail.unavailable")}`]}),_.anchorState!=="anchored"&&a(Xt,{anchor:_.anchor}),_.comments.length>1&&a("ul",{class:"snag-dk-replies-list",children:_.comments.slice(1).map(k=>a("li",{children:[a("strong",{children:k.author.name}),nt(k.body??""),a(rt,{body:k.body,onEdit:R=>d(k.id,R),deleteLabel:h("reply.delete"),onDelete:()=>p(k.id)})]},k.id))}),M?a("div",{class:"snag-dk-replybox",children:[a("textarea",{ref:C,class:"snag-text",rows:2,enterkeyhint:"enter","aria-label":h("reply.aria"),placeholder:h("reply.placeholder"),value:x,onInput:k=>D(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),x.trim()&&(l(_.id,x.trim()),D(""),y(!1))),k.key==="Escape"&&(k.stopPropagation(),k.target.blur())}}),a("div",{class:"snag-actions",children:[a("button",{type:"button",class:"snag-cancel",onClick:()=>{D(""),y(!1)},children:h("action.cancel")}),a("button",{type:"button",class:"snag-send",disabled:!x.trim(),onClick:()=>{l(_.id,x.trim()),D(""),y(!1)},children:h("reply.send")})]})]}):a("button",{type:"button",class:"snag-dk-addreply",onClick:()=>y(!0),children:h("reply.add")})]})}function hn(e){const t=e.openId?e.snags.find(m=>m.id===e.openId):null,n=I(null),o=e.clusterFilter?e.snags.filter(m=>e.clusterFilter.includes(m.id)):e.snags,s=Vt(o.filter(m=>Kt(m,e.filter)),e.filter,e.route),r=Gt(s,e.filter.sort),l=e.filter.sort==="page"?tn(r,e.route):[{route:"",here:!1,snags:r}],d=l.flatMap(m=>m.snags),p=I(0),u=d.findIndex(m=>m.id===e.openId);u>=0&&(p.current=u);const f=I(null),[v,i]=O(null);e.openId?(f.current={id:e.openId,absent:u===-1},v&&i(null)):f.current?.absent&&v!==f.current.id&&(i(f.current.id),f.current=null),H(()=>{n.current?.focus()},[e.openId]),H(()=>{if(!(window.matchMedia?.("(pointer: coarse)").matches??!1))return;const m=n.current;return m?Pt(m):void 0},[]);const g=I({snag:t,onStatus:e.onStatus});g.current={snag:t,onStatus:e.onStatus},H(()=>{const m=_=>{const{snag:$,onStatus:x}=g.current;if(!$||_.metaKey||_.ctrlKey||_.altKey||_.composedPath().some(y=>{const C=y;if(!C?.tagName)return!1;const D=C.tagName.toLowerCase();return D==="textarea"||D==="select"?!0:D==="input"?!/^(button|submit|checkbox|radio)$/i.test(C.type):C.isContentEditable?!0:/^(textbox|searchbox|combobox)$/.test(C.getAttribute?.("role")??"")}))return;const M=Number(_.key);if(M>=1&&M<=ye.length){_.preventDefault(),x($.id,ye[M-1]);return}(_.key==="r"||_.key==="R")&&(_.preventDefault(),x($.id,$.status==="resolved"?"open":"resolved"))};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[]);const w=window.matchMedia?.("(pointer: coarse)").matches??!1;return a("aside",{ref:n,class:"snag-dk",role:"complementary","aria-label":h("dock.aria"),tabIndex:-1,onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),e.openId?e.onOpen(null):e.onClose())},children:[w&&a("div",{class:"snag-dk-scrim","aria-hidden":"true",onClick:e.onClose}),w&&a("div",{class:"snag-dk-grab","aria-hidden":"true",onPointerDown:m=>{const _=m.clientY,$=m.currentTarget;try{$.setPointerCapture(m.pointerId)}catch{}$.onpointermove=x=>{x.clientY-_>56&&($.onpointermove=null,e.onClose())},$.onpointerup=()=>$.onpointermove=null},children:a("span",{})}),a("header",{class:"snag-dk-hd",children:[a("strong",{children:h(t?"dock.title.detail":"dock.title.list")}),a("button",{type:"button",class:"snag-dk-link",onClick:e.onClose,"aria-label":h("dock.close"),children:"\u2715"})]}),t?a(pn,{...e,snags:d,round:e.snags,fallbackCursor:p.current},t.id):a(sn,{...e,groups:l,hiddenNote:v,onHiddenShow:m=>{i(null),e.onOpen(m)}})]})}const at=360,gn=` .snag-dk{position:fixed;inset-block:0;inset-inline-end:0;width:${at}px;max-width:100vw;z-index:${Mt.dock};background:${c.bg};color:${c.fg};display:flex;flex-direction:column;font:400 13px/1.45 ${c.font};box-shadow:${c.shadow};border-inline-start:1px solid ${c.border};pointer-events:auto;overscroll-behavior:contain}.snag-dk-filters{padding:8px 12px 6px;border-block-end:1px solid ${c.border};display:grid;gap:6px}.snag-dk-round{display:flex;align-items:center;gap:8px;padding:8px 12px;border-block-end:1px solid ${c.border}}.snag-dk-round select{flex:1;min-width:0}.snag-dk-search{width:100%;box-sizing:border-box;font-size:12px;padding:5px 8px}.snag-dk-chiphead{display:flex;justify-content:space-between;align-items:center}.snag-dk-chiplabel{font:600 10px/1 ${c.font};letter-spacing:.06em;text-transform:uppercase;color:${c.muted}}.snag-dk-chips{display:grid;grid-template-columns:1fr 1fr;gap:4px}.snag-dk-chip{font:500 11px/1.2 ${c.font};color:${c.fg};padding:5px 8px;border-radius:6px;border:1px solid ${c.border};background:none;cursor:pointer;text-align:start;display:flex;justify-content:space-between;align-items:center;gap:4px}.snag-dk-chip[aria-pressed="true"]{font-weight:600}.snag-dk-chip-stray{color:${c.muted};cursor:default}.snag-dk-menus{display:flex;gap:10px;position:relative}.snag-dk-menuwrap{position:relative}.snag-dk-menubg{position:absolute;inset:-200px -20px -2000px;background:transparent;z-index:2}.snag-dk-menu{position:absolute;inset-block-start:100%;inset-inline-start:0;z-index:3;min-width:150px;background:${c.bg};border:1px solid ${c.border};border-radius:6px;box-shadow:${c.shadow};display:grid;padding:4px}.snag-dk-menu button{font:400 12px/1.3 ${c.font};color:${c.fg};background:none;border:0;text-align:start;padding:5px 8px;border-radius:4px;cursor:pointer;display:flex;gap:4px}.snag-dk-menu button:hover{background:color-mix(in srgb,${c.fg} 8%,transparent)}.snag-dk-menu-form{padding:8px;gap:6px;min-width:180px}.snag-dk-menu-form label{display:grid;gap:2px;font:600 10px/1.4 ${c.font};letter-spacing:.05em;text-transform:uppercase;color:${c.muted}}.snag-dk-menu-form select{font:400 12px/1.3 ${c.font};color:${c.fg};background:${c.bg};border:1px solid ${c.border};border-radius:4px;padding:4px}.snag-dk-pageonly{display:flex;align-items:center;gap:6px;font-size:12px;color:${c.fg};cursor:pointer}.snag-dk-permalink{font-size:11px;padding:2px 6px;max-width:110px}.snag-dk:focus{outline:none}@media (pointer:coarse){.snag-dk{inset-block-start:auto;inset-inline-start:0;width:auto;height:82vh;border-radius:14px 14px 0 0;box-sizing:border-box;padding-bottom:max(var(${b.tbH},68px),var(${b.kb},0px));padding-inline:env(safe-area-inset-left) env(safe-area-inset-right)}.snag-dk-scrim{position:fixed;inset:0;background:#0005;touch-action:none;z-index:-1}.snag-dk-grab{display:flex;justify-content:center;padding:10px 0 4px;touch-action:none}.snag-dk-grab span{width:36px;height:4px;border-radius:2px;background:${c.border}}.snag-dk-item{min-height:56px}.snag-dk-link{min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center}.snag-dk-select{min-height:44px}.snag-dk-chip{min-height:44px}.snag-dk-search{min-height:44px}}@media (pointer:fine){.snag-dk-scrim,.snag-dk-grab{display:none}}.snag-dk-hd{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid ${c.border};flex:0 0 auto}.snag-dk-scroll{overflow-y:auto;flex:1 1 auto}.snag-dk-list{list-style:none;margin:0;padding:0}.snag-dk-grouphd{position:sticky;top:0;z-index:1;margin:0;display:flex;align-items:center;gap:8px;padding:7px 14px;font:600 11px/1.45 ${c.font};letter-spacing:.02em;background:${c.sunken};border-bottom:1px solid ${c.border}}.snag-dk-route{color:${c.fg};overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;direction:ltr;unicode-bidi:isolate}.snag-dk-here{color:${c.accent};font-weight:600;flex:0 0 auto}.snag-dk-grouphd .snag-dk-dim{margin-inline-start:auto;font-weight:400;flex:0 0 auto}.snag-dk-goto{flex:0 0 auto;color:${c.muted};font-size:13px;line-height:1}.snag-dk-dev{flex:0 0 auto;color:${c.muted};display:flex;align-items:center}.snag-dk-item:hover .snag-dk-goto,.snag-dk-item:focus-visible .snag-dk-goto{color:${c.accent}}.snag-dk-item{display:flex;gap:10px;align-items:flex-start;width:100%;text-align:start;background:transparent;border:0;border-bottom:1px solid ${c.border};color:inherit;font:inherit;padding:11px 14px;cursor:pointer;transition:background ${c.motion}}.snag-dk-item:hover{background:${c.hover}}.snag-dk-item:focus-visible{outline:2px solid ${c.focus};outline-offset:-2px}.snag-dk-num{flex:0 0 22px;height:22px;border-radius:50% 50% 50% 2px;color:${c.onAccent};font-weight:600;font-size:11px;line-height:1;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.snag-dk-num--orphaned{border:2px solid ${c.anchorOrphan};box-shadow:inset 0 0 0 2px ${c.onAccent}}.snag-dk-num--approximate{border:2px dashed ${c.onAccent}}.snag-dk-main{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1 1 auto}.snag-dk-body,.snag-dk-sub{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.snag-dk-sub{font-size:11px}.snag-dk-dim{color:${c.muted}}.snag-dk-moved{color:${c.anchorOrphan};font-weight:600}.snag-dk-replies{background:${c.surface};border-radius:999px;padding:1px 7px;font-size:11px;flex:0 0 auto}.snag-dk-empty{padding:28px 16px;text-align:center;flex:1 1 auto}.snag-dk-empty p{margin:0 0 4px}.snag-dk-notice{margin:0;padding:11px 14px;font-size:12px;color:${c.muted};border-bottom:1px solid ${c.border};flex:0 0 auto}.snag-dk-foot{display:flex;gap:6px;padding:10px 14px;border-top:1px solid ${c.border};flex:0 0 auto}.snag-dk-link{background:transparent;border:0;color:${c.accent};font:inherit;cursor:pointer;padding:4px 6px;border-radius:calc(${c.radius} - 2px);transition:background ${c.motion}}.snag-dk-link:hover:not(:disabled){background:${c.hover}}.snag-dk-link:disabled{color:${c.disabled};cursor:not-allowed}.snag-dk-link:focus-visible{outline:2px solid ${c.focus};outline-offset:1px}.snag-dk-detail{padding:12px 14px;overflow-y:auto;flex:1 1 auto;display:flex;flex-direction:column;gap:12px}.snag-dk-detailhd{display:flex;align-items:center;justify-content:space-between;gap:8px}.snag-dk-nav{display:flex;gap:2px}.snag-dk-card{background:${c.surface};border-radius:${c.radius};padding:11px}.snag-dk-meta{display:flex;justify-content:space-between;gap:8px;font-size:12px;margin-bottom:6px}.snag-md{overflow-wrap:anywhere}.snag-md>*{margin:0}.snag-md>*+*{margin-block-start:6px}.snag-md p{white-space:pre-wrap}.snag-md ul,.snag-md ol{padding-inline-start:20px}.snag-md li+li{margin-block-start:2px}.snag-md code{background:${c.sunken};border-radius:3px;padding:1px 4px;font-size:.92em;font-family:ui-monospace,monospace}.snag-md pre{background:${c.sunken};border-radius:${c.radius};padding:8px 10px;overflow-x:auto}.snag-md pre code{background:none;padding:0;font-size:.92em}.snag-md a{color:${c.accent}}.snag-dk-field{display:flex;flex-direction:column;gap:4px;font-size:12px}.snag-dk-select{background:${c.surface};color:inherit;border:2px solid;border-radius:${c.radius};padding:7px 9px;font:inherit;min-height:34px}.snag-dk-done{color:${c.muted};text-decoration:line-through}.snag-dk-meta .snag-dk-num{margin-inline-end:2px}.snag-dk-cap{background:${c.sunken};border-radius:${c.radius};padding:9px 11px;display:flex;flex-direction:column;gap:1px;font-size:12px;overflow-wrap:anywhere}.snag-dk-cap p{margin:0}.snag-dk-shot{padding:0;border:1px solid ${c.border};border-radius:calc(${c.radius} - 2px);background:none;cursor:zoom-in;overflow:hidden;line-height:0;align-self:flex-start;margin-block-end:6px}.snag-dk-shot canvas{display:block;max-width:100%}.snag-dk-lightbox{position:fixed;inset:0;z-index:1;background:#000c;display:flex;align-items:center;justify-content:center;padding:24px;cursor:zoom-out}.snag-dk-lightbox canvas{max-width:100%;max-height:100%;object-fit:contain;box-shadow:${c.shadow};background:${c.bg}}.snag-dk-lightclose{position:absolute;inset-block-start:12px;inset-inline-end:16px;color:#fff}.snag-dk-caplabel{font-weight:600;font-size:11px;letter-spacing:.02em;margin-bottom:3px!important}.snag-dk-capwhy{color:${c.muted};font-size:11px;margin-top:5px!important}.snag-dk-moved-note{margin:0;padding:8px 10px;font-size:12px;background:${c.sunken};border-inline-start:3px solid ${c.anchorOrphan};border-radius:${c.radius}}.snag-dk-anchor{font-size:12px;border:1px solid ${c.border};border-radius:${c.radius};padding:6px 10px;background:${c.sunken}}.snag-dk-anchor summary{cursor:pointer;color:${c.muted};font-weight:600;list-style:revert}.snag-dk-anchor dl{margin:8px 0 2px;display:grid;gap:6px}.snag-dk-anchor dt{color:${c.muted};font-size:11px;letter-spacing:.03em;text-transform:uppercase}.snag-dk-anchor dd{margin:0;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;overflow-wrap:anywhere;user-select:text}.snag-dk-replies-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.snag-dk-replies-list li{background:${c.sunken};border-radius:${c.radius};padding:9px;overflow-wrap:anywhere}.snag-dk-acts{display:flex;gap:2px;margin-top:6px;opacity:0;transition:opacity ${c.motion}}.snag-dk-card:hover .snag-dk-acts,.snag-dk-replies-list li:hover .snag-dk-acts,.snag-dk-acts:focus-within{opacity:1}.snag-dk-act{background:transparent;border:0;color:${c.muted};font:inherit;font-size:11px;cursor:pointer;padding:3px 6px;border-radius:calc(${c.radius} - 3px);transition:background ${c.motion},color ${c.motion}}.snag-dk-act:hover{background:${c.hover};color:inherit}.snag-dk-act:focus-visible{outline:2px solid ${c.focus};outline-offset:1px}.snag-dk-act--danger:hover{color:${c.anchorOrphan}}.snag-dk-armed{color:${c.anchorOrphan};font-weight:600}.snag-dk-clear{margin-inline-start:auto}.snag-dk-editbox{display:flex;flex-direction:column;gap:8px;margin-top:8px}.snag-dk-addreply{background:transparent;border:1px dashed ${c.border};color:${c.muted};border-radius:${c.radius};padding:9px;font:inherit;cursor:pointer;text-align:start;transition:border-color ${c.motion},color ${c.motion}}.snag-dk-addreply:hover{border-color:${c.accent};color:inherit}.snag-dk-replybox{display:flex;flex-direction:column;gap:8px}`;function fn(e,t,n){const o=e.ownerDocument??document;tt(e,"form",Dt),tt(e,"dock",gn);const s=o.createElement("div");(n??e).appendChild(s);const r=o.defaultView?.matchMedia?.("(pointer: coarse)").matches??!1,l=p=>{const u=e.host;p&&!r?u.style.setProperty(b.dockW,`${at}px`):u.style.removeProperty(b.dockW)};l(!0);const d=p=>{He(a(hn,{...p}),s)};return d(t),{update:d,close(){l(!1),He(null,s),s.remove()}}}const it=24;function lt(e,t){const n=e.innerHeight,o=t.querySelector(".snag-dk");if(!o)return{top:0,bottom:n};const s=o.getBoundingClientRect();return s.height>=n-1?{top:0,bottom:n}:{top:0,bottom:Math.max(0,s.top)}}function _n(e,t,n){const o=n.anchor.rect;if(!o)return;const s=n.anchor.offset??{fy:.5},r=o.y+o.h*s.fy,l=lt(e,t),d=r-e.scrollY;if(d>=l.top+it&&d<=l.bottom-it)return;const p=e.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;e.scrollTo({top:Math.max(0,r-(l.top+l.bottom)/2),behavior:p?"auto":"smooth"})}export{fn as openDock,_n as scrollToSnag,lt as visibleStrip};
@@ -0,0 +1,5 @@
1
+ var __snagset_stub__=(function(A){"use strict";const v="Snagset",P="snagset:",g={api:"Snagset",config:"SnagsetConfig",disabled:"__SNAGSET_DISABLED__",assetBase:"__SNAGSET_ASSET_BASE__",collisionFallback:"__snagset__"},N={site:"data-snag-site",host:"data-snag-host",disabled:"data-snag-disabled",env:"data-snag-env",mode:"data-snag-mode",badge:"data-snag-badge",lang:"data-snag-lang",theme:"data-snag-theme",position:"data-snag-position",offset:"data-snag-offset",assetBase:"data-snag-asset-base",branch:"data-snag-branch",build:"data-snag-build",storage:"data-snag-storage",hotkey:"data-snag-hotkey",allowAutomation:"data-snag-allow-automation",screenshots:"data-snag-screenshots",maskSelectors:"data-snag-mask-selectors",nonce:"data-snag-nonce",autoMount:"data-snag-auto-mount"},w=e=>N[e],$=e=>"snag_"+e,I="snag:identity",R={off:"snag_off"},B={runtime:"snag.runtime.js"},E={original:"snagset.original",wrapped:"snagset.wrapped",instance:"snagset.instance"};function F(e){const{config:t}=e;if(e.globals[g.disabled])return{gate:"disabled-global",token:g.disabled,fix:`delete window.${g.disabled}`};if(e.configGlobal?.disabled===!0)return{gate:"disabled-config",token:`${g.config}.disabled`,fix:`set ${g.config}.disabled = false`};if("disabled"in t)return{gate:"disabled-attr",token:w("disabled"),fix:`remove ${w("disabled")} from the script tag`};if(new URLSearchParams(e.search).has($("off")))return{gate:"off-switch",token:$("off"),fix:`remove ?${$("off")} from the URL`};if(e.cookie.split("; ").some(c=>c.startsWith(R.off+"=")))return{gate:"off-switch",token:R.off,fix:`clear the ${R.off} cookie`};if((e.webdriver||"Cypress"in e.globals||U(e.globals.opener))&&!("allowAutomation"in t))return{gate:"automation",token:e.webdriver?"navigator.webdriver":"window.Cypress",fix:`add ${w("allowAutomation")} if this is deliberate`,silent:!0};const o=t.mode??"auto";if(o==="off")return{gate:"mode-off",token:`${w("mode")}="off"`,fix:`set ${w("mode")}="on"`};if(o==="auto"&&t.env==="production"&&!e.inReview)return{gate:"no-review-token",token:`${w("env")}="production"`,fix:`set ${w("mode")}="on" to review production deliberately`,silent:!0};if(e.configGlobal&&"enabled"in e.configGlobal){const c=e.configGlobal.enabled;let i=c===!1;if(typeof c=="function")try{i=c()===!1}catch{i=!1}if(i)return{gate:"config-disabled",token:`${g.config}.enabled`,fix:`set ${g.config}.enabled = true`}}const n=e.configGlobal?.allowedOrigins;return Array.isArray(n)&&!n.includes(e.origin??"")?{gate:"origin-not-allowed",token:`${g.config}.allowedOrigins`,fix:`add ${e.origin??"this origin"} to ${g.config}.allowedOrigins`}:null}function U(e){try{return!!e&&typeof e=="object"&&"Cypress"in e}catch{return!1}}function G(){let e=null;try{e=localStorage.getItem(I)}catch{return{}}if(!e)return{};if(e[0]!=="{")return{name:e};try{const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function x(e){return G().projects?.[e]?.holderId}const D=Symbol.for(E.original),L=Symbol.for(E.wrapped),k=()=>{};function K(e,t,r){let o;try{o=e[t]}catch{return k}if(typeof o!="function"||o[L])return k;const n=o,c=r(n);let i=!1;const a=function(...s){return i?n.apply(this,s):c.apply(this,s)};try{const s=a;s[L]=!0,s[D]=n,Object.defineProperty(a,"name",{value:n.name,configurable:!0}),Object.defineProperty(a,"length",{value:n.length,configurable:!0})}catch{}try{e[t]=a}catch{return k}return e[t]!==a?k:()=>{let s;try{s=e[t]}catch{s=void 0}if(s===a)try{e[t]=n;return}catch{}i=!0}}function O(e){try{if(typeof e=="string")return e.slice(0,512);if(e==null||typeof e!="object")return typeof e=="function"?`[Function ${e.name??""}]`:String(e);const t=e;if(typeof t.name=="string"&&typeof t.message=="string"||e instanceof Error){const r=`${String(t.name)}: ${String(t.message)}`,o=typeof t.stack=="string"?t.stack.split(`
2
+ `).slice(0,10).join(`
3
+ `):"";return(o?`${r}
4
+ ${o}`:r).slice(0,1024)}return t.nodeType!==void 0?typeof t.tagName=="string"?`<${t.tagName.toLowerCase()}>`:"[Node]":Array.isArray(e)?`[Array(${e.length})]`:`[${Object.prototype.toString.call(e).slice(8,-1)}]`}catch{return"[unreadable]"}}function Y(e,t,r){const o=[];let n=0,c=0,i=0,a=0,s=null,d=0;const m=(f,p,u)=>{if(!(d>=3))try{const y=Date.now();if(y-c>250&&(a&&(o.push([y,"system","info",`${a} records suppressed (flood guard)`]),a=0),c=y,i=0),++i>50){a++;return}const h=[y,f,p,u];if(s){s(h);return}for(o.push(h);o.length>100;)o.shift(),n++;d=0}catch{d++}};m("navigation","info",e.location.href),e.addEventListener("error",f=>{try{const p=f.target;if(p&&p!==e&&typeof p.tagName=="string"){m("error","error",`Failed to load <${p.tagName.toLowerCase()}> ${p.src??p.href??""}`);return}const u=f,y=`${u.message??"Script error"} (${u.filename??""}:${u.lineno??0}:${u.colno??0})`,h=u.error?`
5
+ ${O(u.error)}`:"";m("error","error",`${y}${h}`)}catch{d++}},{capture:!0,signal:r}),e.addEventListener("unhandledrejection",f=>{try{m("error","error",`Unhandled rejection: ${O(f.reason)}`)}catch{d++}},{signal:r});const l=[];if(t.early){let f=!1;for(const p of["error","warn"])l.push(K(e.console,p,u=>function(...y){const h=u.apply(this,y);return f||(f=!0,m("console",p,y.map(O).join(" ").slice(0,4096)),f=!1),h}))}const b=()=>{for(const f of l)f();l.length=0,s=null,o.length=0};return r.addEventListener("abort",b,{once:!0}),{drain(f){const u={records:o.slice(),dropped:n};return o.length=0,n=0,s=f,u},destroy:b}}const S="0.0.0",_=q();function q(){try{const e=location.hash.slice(1);if(!e.includes($("k")))return;const t=new URLSearchParams(e),r=t.get($("k"))??void 0;if(!r)return;t.delete($("k"));const o=t.toString(),n=location.pathname+location.search+(o?`#${o}`:"");return history.replaceState(history.state,"",n),r}catch{return}}const W=["site","host","disabled","env","mode","hotkey","allowAutomation","assetBase","theme","autoMount","storage"];function H(e){const t=e[g.config];return t&&typeof t=="object"?t:void 0}function V(e,t){const r={};for(const o of W){const n=t?.[o];(typeof n=="string"||typeof n=="number")&&(r[o]=String(n));const c=e?.getAttribute(w(o));c!=null&&(r[o]=c)}return r}function J(e,t){const r=new URL(e,t);return r.searchParams.set("cv",S),r.href}function j(e,t){if(!(e.host||!t))try{e.host=new URL(t,location.href).origin}catch{}}function X(e,t){const r=e.assetBase??window[g.assetBase];if(r)return new URL(r,location.href).href.replace(/\/?$/,"/");const o=t?.src;return o?new URL(".",o).href:new URL(".",location.href).href}function C(){const e=new Map,t=(r,o)=>void e.get(r)?.delete(o);return{on(r,o){let n=e.get(r);return n||e.set(r,n=new Set),n.add(o),()=>t(r,o)},off:t,emit(r,o){const n=e.get(r);if(n)for(const c of[...n])try{c(o)}catch(i){console.error(`[${v}] listener for "${r}" threw`,i)}document.dispatchEvent(new CustomEvent(`${P}${r}`,{detail:o,bubbles:!1,composed:!1}))}}}function z(e,t,r){let o=!1;const n=()=>{o||(o=!0,console.info(`[${v}] not activated: ${r}`))},c=C(),i={version:S,config:e,assetBase:t,state:"inert",pointerMode:"browse",activated:!1,init:()=>(n(),Promise.resolve(i)),activate:()=>(n(),Promise.resolve(null)),deactivate:()=>{},destroy:()=>{},setMode:n,setRoute:n,open:()=>(n(),Promise.resolve({ok:!1,reason:"inert"})),resync:()=>{},close:()=>{},on:c.on,off:c.off};return i}function M(e){const t=window.requestIdleCallback;typeof t=="function"?t(e,{timeout:2e3}):setTimeout(e,1)}function T(e){if(document.readyState==="complete"){M(e);return}window.addEventListener("load",()=>requestAnimationFrame(()=>requestAnimationFrame(()=>M(e))),{once:!0})}function Q(e,t,r){t.hotkey!=="off"&&document.addEventListener("keydown",o=>{if(!(!o.altKey||o.ctrlKey||o.metaKey)&&o.code==="KeyC"){if(o.preventDefault(),e.state==="active"){e.setMode(e.pointerMode==="add"?"comments":"add");return}e.activate().catch(()=>{})}},{capture:!0,signal:r})}function Z(e,t,r,o){let n=null,c,i="dormant",a=null,s=0;const d=C(),m={version:S,config:e,assetBase:t,get state(){return i},get pointerMode(){return i==="active"&&a?a.getState():"browse"},activated:!1,init(l){return l&&Object.assign(e,l),n?n.then(()=>m,()=>m):Promise.resolve(m)},activate(l){if(i==="destroyed")return Promise.resolve(null);if(a&&i!=="active"&&(i="active",d.emit("activated",{mode:a.getState()})),!n){const b=J(B.runtime,t);n=import(b).then(f=>i==="destroyed"?null:(m.activated=!0,i="active",a=f.mount(void 0,{assetBase:t,config:e,emit:d.emit,...o?{early:o}:{},..._?{reviewToken:_}:{}}),c!==void 0&&a.setRoute(c),d.emit("ready",{version:S,state:i}),d.emit("activated",{mode:a.getState()}),a)).catch(f=>{throw n=null,console.error(`[${v}] runtime failed to load from ${b}`,f),d.emit("error",{code:"runtime-load-failed",message:b,cause:f}),f})}return l?.mode?n.then(b=>(a?.setState(l.mode),b)):n},deactivate(){i!=="active"||!a||(a.closePanel(),a.setState("browse"),i="dormant",d.emit("deactivated",{}))},destroy(){if(i!=="destroyed"){r.abort(),s&&cancelAnimationFrame(s),s=0;try{a?.destroy()}catch(l){console.error(`[${v}] destroy failed`,l)}a=null,n=null,i="destroyed",m.activated=!1,d.emit("destroyed",{})}},setMode(l){if(i!=="destroyed"){if(i==="active"&&a){a.setState(l);return}m.activate({mode:l}).catch(()=>{})}},setRoute(l){c=l,a?.setRoute(l)},async open(l){return i==="destroyed"?{ok:!1,reason:"inert"}:await m.activate()?a.open(l):{ok:!1,reason:"inert"}},resync(){i!=="active"||s||(s=requestAnimationFrame(()=>{s=0,a?.refresh()}))},close(){a?.closePanel()},on:d.on,off:d.off};return Object.assign(m,{signal:r.signal})}const ee=`${P}stub-init`;function te(){if(typeof document>"u"||typeof window>"u")return;const e=performance.now(),t=document.currentScript,r=window,o=H(r),n=V(t,o),c=X(n,t);j(n,t?.src);let i="";try{i=document.cookie}catch{}const a=n.site?!!x(n.site):!1,s=F({config:n,search:location.search,cookie:i,webdriver:navigator.webdriver,globals:r,inReview:!!_||a,...o?{configGlobal:o}:{},origin:location.origin}),d=Symbol.for(E.instance),m=r[g.api];if(m?.[d]){(m.__duplicates??=[]).push({version:S,src:t?.src??""}),console.warn(`[${v}] a second copy of the script is on this page and was ignored; the first one is running. See window.${g.api}.__duplicates.`);return}const l=m===void 0?g.api:g.collisionFallback;if(l===g.collisionFallback&&console.warn(`[${v}] window.${g.api} is taken; installing at window.${g.collisionFallback}.`),s){const h=z(n,c,s.gate);h[d]=!0,r[l]=h,s.silent||console.info(`[${v}] not activated: ${s.gate} \u2014 ${s.fix}`);return}const b=new AbortController,f=o?.breadcrumbs,p=f===!1?void 0:Y(window,{early:f?.early!==!1},b.signal),u=Z(n,c,b,p);u[d]=!0,r[l]=u,ne(e),Q(u,n,u.signal);const y=new URLSearchParams(location.search).has($("t"));(n.mode==="on"||y||_||a)&&n.autoMount!=="false"?T(()=>void u.activate().catch(()=>{})):n.site&&n.host&&n.mode!=="off"&&n.autoMount!=="false"&&fetch(`${n.host.replace(/\/+$/,"")}/api/v1/projects/${n.site}/config`).then(h=>h.ok?h.json():null).then(h=>{h?.writeMode==="open"&&h.writable!==!1&&T(()=>void u.activate().catch(()=>{}))}).catch(()=>{})}function ne(e){try{performance.measure(ee,{start:e})}catch{}}return te(),A.inferHost=j,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),A})({});