dsh-claude-design 2.4.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@
14
14
  <meta name="dc-babel-file" content="artifact-type/babel.min.js">
15
15
  <script>try{if(!document.documentElement.getAttribute("data-theme"))document.documentElement.setAttribute("data-theme",matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}catch(e){}</script>
16
16
  <script id="appifact-mode">(function(){var h=document.documentElement;function s(){var t=h.getAttribute('data-theme');if(t==='light'||t==='dark'){h.setAttribute('data-mode',t)}else{h.removeAttribute('data-mode')}}s();if(typeof MutationObserver==='function'){new MutationObserver(s).observe(h,{attributes:true,attributeFilter:['data-theme']})}})();</script>
17
- <script type="module" crossorigin src="./assets/index-9BhYeCfK.js"></script>
17
+ <script type="module" crossorigin src="./assets/index-BZKwYnL9.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="./assets/index-oDSQuawR.css">
19
19
  </head>
20
20
  <body>
@@ -0,0 +1,178 @@
1
+ var y=/^zh\b/i.test(navigator.language),K=n=>{if(!n)return"";let e=Math.max(0,(Date.now()-Date.parse(n))/1e3),t=new Intl.RelativeTimeFormat(y?"zh-CN":"en",{numeric:"auto"});return e<60?t.format(0,"second"):e<3600?t.format(-Math.round(e/60),"minute"):e<86400?t.format(-Math.round(e/3600),"hour"):t.format(-Math.round(e/86400),"day")};function T(n){let e=n.trim();if(!e)return"?";if(/^[぀-ヿ㐀-鿿가-힯]/.test(e))return[...e][0];let t=e.split(/\s+/);return((t[0]?.[0]??"")+(t[1]?.[0]??"")).toUpperCase()||"?"}var J=["#3d7a6c","#56688f","#8f6249","#76598f","#857536","#995466","#45799a","#667a45"],S=n=>{let e=0;for(let t of n)e=e*31+t.charCodeAt(0)|0;return J[Math.abs(e)%J.length]},j='<rect x="3" y="5.5" width="10" height="7.5" rx="2"/><path d="M8 5.5V3.3"/><circle cx="8" cy="2.6" r=".7" fill="currentColor" stroke="none"/><circle cx="6.1" cy="8.9" r="1" fill="currentColor" stroke="none"/><circle cx="9.9" cy="8.9" r="1" fill="currentColor" stroke="none"/><path d="M6.6 11.1h2.8M1.5 8.5v2M14.5 8.5v2"/>',w=(n,e=16)=>`<svg viewBox="0 0 16 16" width="${e}" height="${e}" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`,E=`
2
+ :host { all: initial; color: inherit; font-family: inherit; }
3
+ * { box-sizing: border-box; }
4
+ .wrap { --bg: #fff; --fg: #1a1915; --muted: #72706a; --faint: #a6a49d; --line: #e9e7e2; --soft: #f2f1ee; --hover: #e9e8e4;
5
+ --check: #2563d9; --ok: #2f8a4c; --danger: #c13b2e; --shadow: 0 16px 48px rgba(20,18,14,.16), 0 2px 8px rgba(20,18,14,.06);
6
+ font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--fg);
7
+ -webkit-font-smoothing: antialiased; }
8
+ @media (prefers-color-scheme: dark) { .wrap { --bg: #262624; --fg: #f3f2ef; --muted: #aaa8a2; --faint: #77756f; --line: #3a3936; --soft: #31302e; --hover: #3b3a37;
9
+ --check: #6ea2ff; --danger: #f07a6c; --shadow: 0 16px 48px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.3); } }
10
+ button { font: inherit; color: inherit; cursor: pointer; margin: 0; }
11
+ button:focus-visible { outline: 2px solid var(--check); outline-offset: 2px; }
12
+ button:disabled { cursor: default; }
13
+ svg { display: block; flex: none; }
14
+
15
+ /* The button wears its bar's colour and type, like the buttons beside it. */
16
+ .wrap.seat { color: inherit; font-family: inherit; }
17
+ .open { position: relative; height: 28px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 400; line-height: 1; white-space: nowrap; transition: background-color .12s ease-out; }
18
+ .open:hover, .open[aria-expanded="true"] { background: color-mix(in srgb, currentColor 6%, transparent); }
19
+ .open.bar { height: 24px; padding: 0 6px; border-radius: 6px; font-size: 13px; gap: 5px; }
20
+ .open.tool { width: 24px; height: 24px; padding: 0; border-radius: 6px; justify-content: center; }
21
+ .open.float { height: 32px; padding: 0 12px; color: var(--fg); background: var(--bg); box-shadow: 0 1px 3px rgba(20,18,14,.12), 0 0 0 1px rgba(20,18,14,.04); font-size: 13px; font-weight: 500; }
22
+ .open.float:hover, .open.float[aria-expanded="true"] { background: var(--soft); }
23
+ .open .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
24
+ .open.tool .dot { position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; }
25
+
26
+ .pop { position: fixed; z-index: 2147483000; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
27
+ .caret { position: fixed; z-index: 2147483001; width: 14px; height: 14px; background: var(--bg); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); border-radius: 3px 0 0 0; }
28
+ .body { overflow: auto; padding: 18px 20px 20px; overscroll-behavior: contain; }
29
+ .head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
30
+ h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
31
+ .label { color: var(--muted); font-size: 13px; margin: 18px 0 8px; }
32
+
33
+ .row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; }
34
+ .who { flex: 1; min-width: 0; }
35
+ .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
36
+ .name .faint { color: var(--muted); }
37
+ .sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
38
+ .sub.on { color: var(--ok); }
39
+ .sub.multi { white-space: normal; overflow-wrap: anywhere; }
40
+ .avatar { position: relative; width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-size: 13.5px; font-weight: 600; letter-spacing: .02em; }
41
+ .avatar.on::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg); }
42
+ .circle { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--soft); color: var(--fg); }
43
+ .off .circle, .off .who { opacity: .5; }
44
+ .paused .avatar { filter: grayscale(1); opacity: .55; }
45
+
46
+ .icon { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; display: grid; place-items: center; color: var(--fg); flex: none; }
47
+ .icon:hover { background: var(--soft); }
48
+ .icon.muted { color: var(--muted); }
49
+ .select { height: 32px; border: 0; border-radius: 8px; background: transparent; padding: 0 8px 0 10px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
50
+ .select:hover, .select[aria-expanded="true"] { background: var(--soft); }
51
+ .select.static { color: var(--faint); cursor: default; }
52
+ .select.static:hover { background: transparent; }
53
+ .select.wide { margin-left: -10px; max-width: 100%; font-weight: 500; }
54
+ .select.wide span { overflow: hidden; text-overflow: ellipsis; }
55
+ .pill { height: 32px; border: 0; border-radius: 8px; background: var(--soft); padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-weight: 500; font-size: 13.5px; flex: none; }
56
+ .pill:hover { background: var(--hover); }
57
+ .pill.done { color: var(--ok); }
58
+ .empty { color: var(--muted); font-size: 13px; padding: 6px 0 2px; }
59
+ .err { color: var(--danger); font-size: 12.5px; margin-top: 12px; }
60
+ .hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
61
+ .rule { height: 1px; background: var(--line); margin: 16px -20px 0; }
62
+ .foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
63
+ .foot .note { flex: 1; min-width: 0; color: var(--muted); font-size: 13.5px; }
64
+
65
+ .menu { position: fixed; z-index: 2147483002; min-width: 200px; max-width: min(340px, calc(100vw - 24px)); padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
66
+ .item { width: 100%; display: flex; align-items: center; gap: 16px; text-align: left; border: 0; background: transparent; border-radius: 9px; padding: 8px 10px 8px 12px; }
67
+ .item:hover:not(:disabled), .item:focus-visible { background: var(--soft); outline: none; }
68
+ .item:disabled { opacity: .45; }
69
+ .item .who { display: flex; flex-direction: column; }
70
+ .item .sub { white-space: normal; }
71
+ .item.danger .name { color: var(--danger); }
72
+ .item .tick { width: 18px; color: var(--check); }
73
+
74
+ .ask { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(2px); }
75
+ .ask-card { width: 100%; max-width: 360px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; }
76
+ .ask h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
77
+ .ask p { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }
78
+ .ask-row { display: flex; justify-content: flex-end; gap: 8px; }
79
+ .btn { height: 34px; border-radius: 8px; padding: 0 14px; border: 0; background: var(--soft); font-weight: 500; }
80
+ .btn:hover { background: var(--hover); }
81
+ .btn.danger { background: var(--danger); color: #fff; }
82
+ .btn.danger:hover { filter: brightness(.94); }
83
+ `;function r(n,e={},...t){let i=document.createElement(n);for(let[o,s]of Object.entries(e))o==="class"?i.className=s:o==="html"?i.innerHTML=s:i.setAttribute(o,s);return i.append(...t),i}function m(n,e,t,i,o){let s=r("button",{class:n,type:"button",...e});return t&&s.insertAdjacentHTML("beforeend",t),i!==void 0&&s.append(r("span",{},i)),o&&s.insertAdjacentHTML("beforeend",o),s}async function G(n){try{await navigator.clipboard.writeText(n)}catch{let e=r("textarea",{style:"position:fixed;opacity:0"});e.value=n,document.body.append(e),e.select(),document.execCommand("copy"),e.remove()}}var a=y?{title:"\u7248\u672C\u5386\u53F2",close:"\u5173\u95ED",back:"\u8FD4\u56DE",empty:"\u8FD8\u6CA1\u6709\u7248\u672C\u3002",loading:"\u6B63\u5728\u8BFB\u53D6\u2026",today:"\u4ECA\u5929",yesterday:"\u6628\u5929",you:"\uFF08\u4F60\uFF09",claude:"Agent",claudeSub:"\u76F4\u63A5\u6539\u4E86\u8FD9\u53F0\u7535\u8111\u4E0A\u7684\u6587\u4EF6",start:"\u6700\u65E9\u7684\u6837\u5B50",startSub:"\u5386\u53F2\u4ECE\u8FD9\u91CC\u5F00\u59CB",current:"\u5F53\u524D\u7248\u672C",restoredFrom:n=>`\u6062\u590D\u81EA ${n} \u7684\u7248\u672C`,restoredPart:n=>`\u90E8\u5206\u6062\u590D\u81EA ${n} \u7684\u7248\u672C`,overwrote:n=>`\u8986\u76D6\u4E86 ${n} \u7684\u4FEE\u6539`,replaced:n=>`\u6362\u6389\u4E86 ${n} \u521A\u8BBE\u7684\u5185\u5BB9`,ops:{added:"\u65B0\u589E",edited:"\u4FEE\u6539",deleted:"\u5220\u9664"},more:n=>`\u7B49 ${n} \u5904`,changes:"\u770B\u6539\u52A8",preview:"\u9884\u89C8",restore:"\u6062\u590D\u5230\u8FD9\u4E2A\u7248\u672C",restoreTitle:"\u6062\u590D\u5230\u8FD9\u4E2A\u7248\u672C\uFF1F",restoreText:n=>`\u6240\u6709\u5185\u5BB9\u56DE\u5230 ${n} \u7684\u6837\u5B50\u3002\u73B0\u5728\u7684\u5185\u5BB9\u4F1A\u4F5C\u4E3A\u4E00\u4E2A\u7248\u672C\u7559\u5728\u5386\u53F2\u91CC\uFF0C\u968F\u65F6\u80FD\u518D\u6062\u590D\u56DE\u6765\u3002`,restoreOne:"\u53EA\u6062\u590D\u8FD9\u4E00\u5904",restoreOneTitle:"\u53EA\u6062\u590D\u8FD9\u4E00\u5904\uFF1F",restoreOneText:(n,e)=>`\u300C${n}\u300D\u56DE\u5230 ${e} \u7684\u6837\u5B50\uFF0C\u5176\u4ED6\u5185\u5BB9\u4E0D\u53D8\u3002\u73B0\u5728\u7684\u5185\u5BB9\u4F1A\u7559\u5728\u5386\u53F2\u91CC\u3002`,restoreGo:"\u6062\u590D",cancel:"\u53D6\u6D88",binary:"\u8FD9\u4E00\u5904\u4E0D\u662F\u6587\u672C\uFF0C\u770B\u4E0D\u4E86\u9010\u884C\u6539\u52A8\u3002\u53EF\u4EE5\u7528\u300C\u9884\u89C8\u300D\u770B\u90A3\u4E2A\u7248\u672C\u3002",tooLarge:"\u6539\u52A8\u592A\u5927\uFF0C\u8FD9\u91CC\u663E\u793A\u4E0D\u4E0B\u3002\u53EF\u4EE5\u7528\u300C\u9884\u89C8\u300D\u770B\u90A3\u4E2A\u7248\u672C\u3002",missing:"\u8FD9\u4E2A\u7248\u672C\u7684\u5185\u5BB9\u5DF2\u7ECF\u4E0D\u5728\u5386\u53F2\u91CC\u4E86\u3002",skipped:n=>`\u2026 ${n} \u884C\u6CA1\u53D8`,truncated:"\u540E\u9762\u8FD8\u6709\u6539\u52A8\uFF0C\u8FD9\u91CC\u53EA\u663E\u793A\u524D\u4E00\u90E8\u5206\u3002",noChange:"\u5185\u5BB9\u6CA1\u6709\u53D8\u5316\u3002",needsLook:"\u9700\u8981\u4F60\u770B\u4E00\u4E0B",overwritten:(n,e,t)=>`${n} \u4FDD\u5B58\u300C${e}\u300D\u65F6\uFF0C\u8986\u76D6\u4E86\u4F60 ${t} \u7684\u4FEE\u6539\u3002`,overwroteYou:(n,e,t)=>`\u4F60\u4FDD\u5B58\u300C${e}\u300D\u65F6\uFF0C\u8986\u76D6\u4E86 ${n} ${t} \u7684\u4FEE\u6539\u3002`,softOver:(n,e,t)=>`${n} \u7D27\u63A5\u7740\u4E5F\u6539\u4E86\u300C${e}\u300D\uFF0C\u6362\u6389\u4E86\u4F60 ${t} \u8BBE\u7684\u5185\u5BB9\u3002`,deletedBack:(n,e,t)=>`\u4F60 ${t} \u5220\u6389\u4E86\u300C${e}\u300D\uFF0C${n} \u53C8\u6539\u4E86\u5B83\uFF0C\u5B83\u56DE\u6765\u4E86\u3002`,removedOver:(n,e,t)=>`${n} \u5220\u6389\u4E86\u300C${e}\u300D\uFF0C\u4F60 ${t} \u7684\u4FEE\u6539\u4E5F\u8DDF\u7740\u6CA1\u4E86\u3002`,compare:"\u770B\u770B\u5DEE\u522B",bringBack:"\u627E\u56DE",bringBackTitle:"\u627E\u56DE\u88AB\u8986\u76D6\u7684\u5185\u5BB9\uFF1F",bringBackText:(n,e)=>`\u300C${n}\u300D\u6362\u56DE${e}\u88AB\u8986\u76D6\u524D\u7684\u5185\u5BB9\u3002\u73B0\u5728\u7684\u5185\u5BB9\u4F1A\u7559\u5728\u5386\u53F2\u91CC\u3002`,bringBackPart:(n,e)=>`\u300C${n}\u300D\u91CC\u88AB\u6362\u6389\u7684\u90E8\u5206\u6362\u56DE${e}\u7684\u5185\u5BB9\uFF0C\u522B\u7684\u6539\u52A8\u90FD\u7559\u7740\u3002\u73B0\u5728\u7684\u5185\u5BB9\u4F1A\u7559\u5728\u5386\u53F2\u91CC\u3002`,deleteAgain:"\u518D\u5220\u6389",deleteAgainTitle:"\u518D\u5220\u6389\u5B83\uFF1F",deleteAgainText:n=>`\u300C${n}\u300D\u4F1A\u518D\u5220\u6389\u4E00\u6B21\u3002\u73B0\u5728\u7684\u5185\u5BB9\u4F1A\u7559\u5728\u5386\u53F2\u91CC\u3002`,deleteLegend:"\u7EA2\u8272\u662F\u73B0\u5728\u7684\u5185\u5BB9\uFF0C\u518D\u5220\u6389\u540E\u5C31\u6CA1\u6709\u4E86\u3002",yours:"\u4F60",theirs:n=>` ${n} `,dismiss:"\u77E5\u9053\u4E86",later:"\u7A0D\u540E\u518D\u770B",legend:"\u7EA2\u8272\u662F\u73B0\u5728\u7684\u5185\u5BB9\uFF0C\u7EFF\u8272\u662F\u627E\u56DE\u540E\u7684\u5185\u5BB9\u3002",changedSince:"\u4F60\u770B\u7684\u65F6\u5019\u5185\u5BB9\u53C8\u53D8\u4E86\uFF0C\u4E0B\u9762\u662F\u73B0\u5728\u7684\u5BF9\u6BD4\u3002",namesNote:"\u540D\u5B57\u662F\u6BCF\u4E2A\u4EBA\u52A0\u5165\u65F6\u81EA\u5DF1\u586B\u7684\u3002\u300CAgent\u300D\u6307\u76F4\u63A5\u6539\u8FD9\u53F0\u7535\u8111\u4E0A\u6587\u4EF6\u7684\u6539\u52A8\uFF08Agent \u6216\u547D\u4EE4\u884C\uFF09\u3002",viewOnly:"\u4F60\u53EF\u4EE5\u770B\u5386\u53F2\uFF1B\u6062\u590D\u9700\u8981\u7F16\u8F91\u6743\u9650\u3002",bannerAt:(n,e)=>`\u6B63\u5728\u770B ${n} \u7684\u7248\u672C \xB7 ${e}`,bannerCurrent:"\u8FD9\u662F\u5F53\u524D\u7248\u672C",readOnly:"\u53EA\u8BFB",backToCurrent:"\u56DE\u5230\u5F53\u524D\u7248\u672C",restoreThis:"\u6062\u590D\u8FD9\u4E2A\u7248\u672C",done:{restored:"\u5DF2\u6062\u590D",brought:"\u5DF2\u627E\u56DE",deleted:"\u5DF2\u5220\u6389"},failed:"\u6CA1\u80FD\u5B8C\u6210\uFF1A"}:{title:"Version history",close:"Close",back:"Back",empty:"No versions yet.",loading:"Loading\u2026",today:"Today",yesterday:"Yesterday",you:" (you)",claude:"Agent",claudeSub:"changed the files on this computer",start:"Where it started",startSub:"The history starts here",current:"Current",restoredFrom:n=>`Restored from ${n}`,restoredPart:n=>`Partly restored from ${n}`,overwrote:n=>`Saved over ${n}'s change`,replaced:n=>`Replaced what ${n} had just set`,ops:{added:"Added",edited:"Edited",deleted:"Deleted"},more:n=>`+${n} more`,changes:"Changes",preview:"Preview",restore:"Restore this version",restoreTitle:"Restore this version?",restoreText:n=>`Everything goes back to how it was at ${n}. What is there now stays in the history as a version you can restore.`,restoreOne:"Restore just this",restoreOneTitle:"Restore just this part?",restoreOneText:(n,e)=>`\u201C${n}\u201D goes back to how it was at ${e}; nothing else changes. What is there now stays in the history.`,restoreGo:"Restore",cancel:"Cancel",binary:"This part is not text, so there are no line changes to show. Preview shows that version.",tooLarge:"Too many changes to show here. Preview shows that version.",missing:"This version\u2019s content is no longer in the history.",skipped:n=>`\u2026 ${n} unchanged lines`,truncated:"There are more changes than shown here.",noChange:"No changes to the content.",needsLook:"Needs a look",overwritten:(n,e,t)=>`${n} saved \u201C${e}\u201D over your change from ${t}.`,overwroteYou:(n,e,t)=>`You saved \u201C${e}\u201D over ${n}\u2019s change from ${t}.`,softOver:(n,e,t)=>`${n} changed \u201C${e}\u201D right after you and replaced what you set at ${t}.`,deletedBack:(n,e,t)=>`You deleted \u201C${e}\u201D at ${t}; ${n} changed it, so it is back.`,removedOver:(n,e,t)=>`${n} deleted \u201C${e}\u201D, and your change from ${t} with it.`,compare:"Compare",bringBack:"Bring back",bringBackTitle:"Bring back what was saved over?",bringBackText:(n,e)=>`\u201C${n}\u201D goes back to ${e} content from before it was saved over. What is there now stays in the history.`,bringBackPart:(n,e)=>`What was replaced in \u201C${n}\u201D goes back to ${e} content; the other changes stay. What is there now stays in the history.`,deleteAgain:"Delete again",deleteAgainTitle:"Delete it again?",deleteAgainText:n=>`\u201C${n}\u201D is deleted again. What is there now stays in the history.`,deleteLegend:"Red is what is there now; deleting it again removes it.",yours:"your",theirs:n=>`${n}\u2019s`,dismiss:"Dismiss",later:"Later",legend:"Red is what is there now; green is what bringing it back restores.",changedSince:"This changed while you were looking. Here is how it compares now.",namesNote:"Names are what each person typed when they joined. \u201CAgent\u201D is a change made to the files on this computer (by the agent or the command line).",viewOnly:"You can read the history; restoring needs edit access.",bannerAt:(n,e)=>`Viewing the version from ${n} \xB7 ${e}`,bannerCurrent:"This is the current version",readOnly:"Read-only",backToCurrent:"Back to current",restoreThis:"Restore this version",done:{restored:"Restored",brought:"Brought back",deleted:"Deleted"},failed:"Could not do that: "},R={history:w('<path d="M2.6 8a5.4 5.4 0 1 0 1.6-3.8"/><path d="M2.4 2.6v2.6H5"/><path d="M8 5.2V8l1.9 1.3"/>',16),close:w('<path d="M4 4l8 8M12 4l-8 8"/>',18),back:w('<path d="M9.8 3.6 5.4 8l4.4 4.4"/>',18),robot:w(j,16),flag:w('<path d="M4 13.8V2.6M4 3h7.2l-1.6 2.6L11.2 8.2H4"/>',15)},U=`
84
+ .wrap.seat { display: inline-flex; align-items: center; gap: 2px; }
85
+ .open.only { padding: 0; width: 28px; justify-content: center; }
86
+ .open.bar.only { width: 24px; }
87
+ .open.float.only { width: 32px; }
88
+ .open.only .dot { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; }
89
+ .open.tool.only .dot { top: 2px; right: 2px; width: 5px; height: 5px; }
90
+ `,he=`
91
+ .ver { display: flex; gap: 12px; margin: 0 -10px; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
92
+ .ver:hover, .ver.opened { background: var(--soft); }
93
+ .ver .who { display: flex; flex-direction: column; gap: 2px; }
94
+ .top { display: flex; align-items: baseline; gap: 8px; }
95
+ .top .name { flex: 1; min-width: 0; font-weight: 500; }
96
+ .when { color: var(--muted); font-size: 12.5px; white-space: nowrap; flex: none; }
97
+ .avatar.small { width: 30px; height: 30px; font-size: 12px; margin-top: 1px; }
98
+ .avatar.agent { background: #c96442; }
99
+ .avatar.start { background: var(--hover); color: var(--muted); }
100
+ .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
101
+ .badge { font-size: 11.5px; line-height: 18px; padding: 0 8px; border-radius: 999px; background: var(--hover); color: var(--muted); white-space: nowrap; }
102
+ .badge.cur { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
103
+ .badge.warn { background: color-mix(in srgb, #d97706 17%, transparent); color: #a65a06; }
104
+ @media (prefers-color-scheme: dark) { .badge.warn { color: #f2a65a; } }
105
+ .files { margin-top: 6px; display: flex; flex-direction: column; gap: 1px; }
106
+ .file { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: 13px; }
107
+ .file .op { flex: none; font-size: 11.5px; color: var(--muted); min-width: 30px; }
108
+ .file .op.added { color: var(--ok); }
109
+ .file .op.deleted { color: var(--danger); }
110
+ .file .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
111
+ .link { flex: none; border: 0; background: transparent; color: var(--check); font-size: 12.5px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
112
+ .link:hover { background: var(--hover); }
113
+ .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
114
+ .btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
115
+ .btn.primary { background: var(--fg); color: var(--bg); }
116
+ .btn.primary:hover { background: var(--fg); filter: brightness(1.15); }
117
+ .ver.opened .btn:not(.primary), .notice .btn:not(.primary) { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
118
+ .ver.opened .btn:not(.primary):hover, .notice .btn:not(.primary):hover { background: var(--soft); }
119
+ .notice { border: 1px solid color-mix(in srgb, #d97706 30%, var(--line)); background: color-mix(in srgb, #d97706 6%, var(--bg)); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
120
+ .notice p { margin: 0; font-size: 13.5px; }
121
+ .notice .when { display: block; margin-top: 2px; }
122
+ .hint.note { color: #a65a06; }
123
+ @media (prefers-color-scheme: dark) { .hint.note { color: #f2a65a; } }
124
+ .dhead { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
125
+ .dhead h2 { font-size: 16px; }
126
+ .tally { font-size: 12.5px; white-space: nowrap; }
127
+ .tally .a { color: var(--ok); }
128
+ .tally .r { color: var(--danger); margin-left: 6px; }
129
+ .diff { margin: 12px -20px -20px; border-top: 1px solid var(--line); padding: 6px 0 10px; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
130
+ .dl { display: flex; padding-right: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
131
+ .dl .k { width: 26px; flex: none; text-align: center; color: var(--faint); user-select: none; }
132
+ .dl.add { background: color-mix(in srgb, var(--ok) 13%, transparent); }
133
+ .dl.add .k { color: var(--ok); }
134
+ .dl.del { background: color-mix(in srgb, var(--danger) 11%, transparent); }
135
+ .dl.del .k { color: var(--danger); }
136
+ .dl mark { color: inherit; border-radius: 3px; }
137
+ .dl.add mark { background: color-mix(in srgb, var(--ok) 32%, transparent); }
138
+ .dl.del mark { background: color-mix(in srgb, var(--danger) 28%, transparent); }
139
+ .dl.skip { color: var(--muted); padding: 3px 26px; font-family: inherit; }
140
+ .note { color: var(--muted); font-size: 12.5px; margin-top: 16px; }
141
+ .toast { position: fixed; right: 16px; bottom: 16px; z-index: 2147483003; width: min(380px, calc(100vw - 32px)); background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; }
142
+ .toast p { margin: 0; font-size: 13.5px; }
143
+ .toast.plain { width: auto; padding: 10px 16px; }
144
+ .banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2147482500; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--fg); color: var(--bg); box-shadow: var(--shadow); font-size: 13px; }
145
+ .banner .text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
146
+ .banner .ro { opacity: .65; white-space: nowrap; }
147
+ .banner .btn { height: 28px; padding: 0 12px; font-size: 12.5px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 16%, transparent); color: var(--bg); white-space: nowrap; }
148
+ .banner .btn:hover { background: color-mix(in srgb, var(--bg) 26%, transparent); }
149
+ .banner .btn.primary { background: var(--bg); color: var(--fg); }
150
+ @media (max-width: 560px) { .banner { left: 12px; right: 12px; transform: none; border-radius: 16px; flex-wrap: wrap; padding: 10px 12px; } .banner .text { white-space: normal; flex-basis: 100%; } }
151
+ `,x=n=>y?n.zh:n.en;function B(n){let e=new Date(n),t=new Date,i=s=>new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),o=Math.round((i(t)-i(e))/864e5);return o===0?a.today:o===1?a.yesterday:e.toLocaleDateString(y?"zh-CN":"en",{month:"short",day:"numeric",...e.getFullYear()===t.getFullYear()?{}:{year:"numeric"}})}var P=n=>new Date(n).toLocaleTimeString(y?"zh-CN":"en",{hour:"2-digit",minute:"2-digit"}),M=n=>`${B(n)} ${P(n)}`,ue=n=>P(n.first)===P(n.at)?P(n.at):`${P(n.first)}\u2013${P(n.at)}`;async function A(n,e){let t=await fetch(n,e===void 0?{cache:"no-store"}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),i=await t.json().catch(()=>null);if(!t.ok){let o=i;throw Object.assign(new Error(o?.message??`HTTP ${t.status}`),{code:o?.code})}return i}var I=class{button=r("button",{class:"open float only",type:"button","aria-haspopup":"dialog","aria-expanded":"false","aria-label":a.title,title:a.title});boot;look="float";layer=r("div",{"data-baoyu-history-layer":""});layerRoot=this.layer.attachShadow({mode:"open"});layerWrap=r("div",{class:"wrap"});pop=null;caret=r("div",{class:"caret"});toastNode=null;toastTimer;asking=null;data=null;screen={kind:"list"};opened=new Set;diff=null;error="";timer;toasted=new Set;busy=!1;constructor(e){this.boot=e,this.layerRoot.append(r("style",{},E+he),this.layerWrap),this.button.insertAdjacentHTML("beforeend",R.history),this.button.addEventListener("click",()=>this.pop?this.close():void this.open()),document.body.append(this.layer),e.preview?this.banner(e.preview):e.canRestore&&this.watchNotices()}setLook(e){this.look=e,this.button.className=`open ${e} only${this.button.classList.contains("has")?" has":""}`}async open(){this.pop||(this.hideToast(),this.screen={kind:"list"},this.pop=r("div",{class:"pop",role:"dialog","aria-label":a.title}),this.layerWrap.append(this.pop,this.caret),this.button.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",this.onPointer,!0),window.addEventListener("keydown",this.onKey,!0),window.addEventListener("resize",this.position),window.addEventListener("scroll",this.position,!0),this.paint(),await this.refresh(),this.timer=window.setInterval(()=>void this.refresh(),4e3))}close(){window.clearInterval(this.timer),document.removeEventListener("mousedown",this.onPointer,!0),window.removeEventListener("keydown",this.onKey,!0),window.removeEventListener("resize",this.position),window.removeEventListener("scroll",this.position,!0),this.asking=null,this.pop?.remove(),this.pop=null,this.caret.remove(),this.button.setAttribute("aria-expanded","false"),this.button.focus()}position=()=>{if(!this.pop)return;let e=window.innerWidth,t=window.innerHeight,i=this.button.getBoundingClientRect(),o=i.width>0&&i.bottom>0&&i.top<t,s=Math.min(480,e-24),c=o?i.right:e-16,l=Math.max(12,Math.min(c-s,e-s-12)),d=o?i.bottom+10:56;if(Object.assign(this.pop.style,{left:`${l}px`,top:`${d}px`,width:`${s}px`,maxHeight:`${Math.max(240,t-d-12)}px`}),o){let u=Math.max(l+18,Math.min(i.left+i.width/2-7,l+s-32));Object.assign(this.caret.style,{display:"",left:`${u}px`,top:`${d-7}px`})}else this.caret.style.display="none"};onPointer=e=>{let t=e.composedPath();!this.pop||t.includes(this.pop)||t.includes(this.button)||this.close()};onKey=e=>{e.key==="Escape"&&(e.stopPropagation(),e.preventDefault(),this.asking?this.asking():this.screen.kind==="diff"?this.go({kind:"list"}):this.close())};async refresh(){let e=JSON.stringify([this.data,this.error]);try{this.data=await A(`${this.boot.base}__history`),this.error=""}catch(t){this.error=a.failed+t.message}this.mark(this.data?.notices.length??0),!(this.asking||this.busy||this.pop?.firstChild&&JSON.stringify([this.data,this.error])===e)&&this.screen.kind==="list"&&this.paint()}mark(e){this.button.classList.toggle("has",e>0),this.button.querySelector(".dot")?.remove(),e>0&&this.button.append(r("span",{class:"dot",style:"background:#d97706"}))}go(e){this.screen=e,this.diff=null,this.paint(),e.kind==="diff"&&A(e.url).then(t=>{this.screen===e&&(this.diff=t,this.paint())},t=>{this.screen===e&&(this.error=a.failed+t.message,this.paint())})}async act(e,t,i){this.busy=!0;try{return await A(e,t),this.error="",this.toast(i),this.boot.preview?(location.href=this.boot.preview.current_url,!0):(this.screen={kind:"list"},await this.refresh(),this.paint(),!0)}catch(o){return o.code==="changed"&&this.screen.kind==="diff"?(this.error="",this.go({...this.screen,note:a.changedSince}),!1):(this.error=a.failed+o.message,this.paint(),!1)}finally{this.busy=!1}}restore(e,t){let i=M(e.at),o=t?e.files.find(s=>s.path===t):void 0;this.ask(o?a.restoreOneTitle:a.restoreTitle,o?a.restoreOneText(x(o.label),i):a.restoreText(i),a.restoreGo).then(s=>s&&this.act(`${this.boot.base}__history/${e.n}/restore`,t?{paths:[t]}:{},a.done.restored))}bringBack(e){let t=e.kind==="overwritten"?a.yours:a.theirs(e.lostBy==="agent"?a.claude:e.lostName),i=e.part?a.bringBackPart:a.bringBackText,o=this.screen.kind==="diff"&&this.screen.notice?.id===e.id&&this.diff&&"now"in this.diff?{now:this.diff.now}:{},s=c=>l=>l&&this.act(`${this.boot.base}__history/notice/${e.id}/recover`,o,c);e.deleted?this.ask(a.deleteAgainTitle,a.deleteAgainText(x(e.label)),a.deleteAgain).then(s(a.done.deleted)):this.ask(a.bringBackTitle,i(x(e.label),t),a.bringBack).then(s(a.done.brought))}async dismiss(e){try{let{notices:t}=await A(`${this.boot.base}__history/notices`,{dismiss:e.id});this.data&&(this.data.notices=t),this.mark(t.length)}catch(t){this.error=a.failed+t.message}this.screen.kind==="diff"&&(this.screen={kind:"list"}),this.paint()}ask(e,t,i){return new Promise(o=>{if(!this.pop)return o(!1);let s=r("div",{class:"ask",role:"alertdialog","aria-modal":"true","aria-label":e}),c=m("btn",{},"",a.cancel),l=m("btn primary",{},"",i),d=u=>{this.asking=null,s.remove(),o(u)};c.addEventListener("click",()=>d(!1)),l.addEventListener("click",()=>d(!0)),s.addEventListener("mousedown",u=>u.target===s&&d(!1)),s.append(r("div",{class:"ask-card"},r("h3",{},e),r("p",{},t),r("div",{class:"ask-row"},c,l))),this.asking=()=>d(!1),this.pop.append(s),l.focus()})}paint(){if(!this.pop)return;let e=this.pop.querySelector(".body")?.scrollTop??0,t=r("div",{class:"body"});this.screen.kind==="diff"?this.paintDiff(t,this.screen):this.paintList(t),this.error&&t.append(r("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(t),this.screen.kind==="list"&&(t.scrollTop=e),this.position()}paintList(e){let t=m("icon muted",{"aria-label":a.close,title:a.close},R.close);t.addEventListener("click",()=>this.close()),e.append(r("div",{class:"head"},r("h2",{},a.title),t));let i=this.data;if(!i){e.append(r("div",{class:"empty"},a.loading));return}if(i.notices.length){e.append(r("div",{class:"label"},a.needsLook));for(let s of i.notices)e.append(this.noticeCard(s,i.canRestore))}i.rows.length||e.append(r("div",{class:"empty"},a.empty));let o="";for(let s of i.rows){let c=B(s.at);c!==o&&(o=c,e.append(r("div",{class:"label"},c))),e.append(this.versionRow(s,i))}e.append(r("div",{class:"note"},i.canRestore?a.namesNote:`${a.viewOnly} ${a.namesNote}`))}who(e,t){if(e.by==="agent")return{name:a.claude,avatar:r("div",{class:"avatar small agent",html:R.robot})};if(e.by==="system")return{name:a.start,avatar:r("div",{class:"avatar small start",html:R.flag})};let i=e.userId===t;return{name:`${e.name}${i?a.you:""}`,avatar:r("div",{class:"avatar small",style:`background:${S(e.userId??e.name)}`},T(e.name))}}versionRow(e,t){let{name:i,avatar:o}=this.who(e,t.me),s=this.opened.has(e.n),c=e.files.map(g=>e.by==="system"||g.op==="edited"?x(g.label):`${a.ops[g.op]} ${x(g.label)}`),l=e.by==="system"&&!s?a.startSub:c.length>3?`${c.slice(0,3).join(y?"\u3001":", ")} ${a.more(c.length-3)}`:c.join(y?"\u3001":", "),d=r("div",{class:"badges"});if(e.current&&d.append(r("span",{class:"badge cur"},a.current)),e.restoredFrom!==void 0){let g=t.rows.find(L=>L.n===e.restoredFrom),b=g?M(g.at):`#${e.restoredFrom}`;d.append(r("span",{class:"badge"},e.restoredPart?a.restoredPart(b):a.restoredFrom(b)))}for(let g of e.overwrote??[])d.append(r("span",{class:"badge warn",title:x(g.label)},g.soft?a.replaced(g.by==="agent"?a.claude:g.name):a.overwrote(g.by==="agent"?a.claude:g.name)));let u=r("div",{class:"who"},r("div",{class:"top"},r("span",{class:"name"},i),r("span",{class:"when"},ue(e))),...s?[]:[r("div",{class:"sub"},e.by==="agent"&&!c.length?a.claudeSub:l)],...d.childElementCount?[d]:[]),h=r("div",{class:`ver${s?" opened":""}`,role:"button",tabindex:"0","aria-expanded":String(s)},o,u),f=g=>{g.target.closest("button")||(s?this.opened.delete(e.n):this.opened.add(e.n),this.paint())};if(h.addEventListener("click",f),h.addEventListener("keydown",g=>(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),f(g))),s){let g=r("div",{class:"files"});for(let $ of e.files){let q=m("link",{},"",a.changes);q.addEventListener("click",()=>this.go({kind:"diff",url:`${this.boot.base}__history/${e.n}/diff?path=${encodeURIComponent($.path)}`,title:x($.label),sub:`${i} \xB7 ${M(e.at)}`,...t.canRestore&&!e.current?{restore:{n:e.n,path:$.path,when:M(e.at)}}:{}})),g.append(r("div",{class:"file"},r("span",{class:`op ${$.op}`},a.ops[$.op]),r("span",{class:"fname",title:x($.label)},x($.label)),q))}u.append(g);let b=r("div",{class:"actions"}),L=m("btn small",{},"",a.preview);if(L.addEventListener("click",()=>window.open(e.preview,"_blank","noopener")),b.append(L),t.canRestore&&!e.current){let $=m("btn small primary",{},"",a.restore);$.addEventListener("click",()=>this.restore(e)),b.append($)}u.append(b)}return h}noticeText(e){let t=e.lostAt??e.at,i=B(t)===a.today?P(t):M(t);if(e.kind==="overwrote")return a.overwroteYou(e.lostBy==="agent"?a.claude:e.lostName,x(e.label),i);let o=e.by==="agent"?a.claude:e.name;return e.deleted?a.deletedBack(o,x(e.label),i):e.removed?a.removedOver(o,x(e.label),i):e.soft?a.softOver(o,x(e.label),i):a.overwritten(o,x(e.label),i)}noticeScreen(e){return{kind:"diff",url:`${this.boot.base}__history/notice/${e.id}/diff`,title:x(e.label),sub:this.noticeText(e),legend:e.deleted?a.deleteLegend:a.legend,notice:e}}noticeCard(e,t){let i=m("btn small",{},"",a.compare);i.addEventListener("click",()=>this.go(this.noticeScreen(e)));let o=m("btn small",{},"",a.dismiss);o.addEventListener("click",()=>void this.dismiss(e));let s=r("div",{class:"actions"},i);if(t){let c=m("btn small primary",{},"",e.deleted?a.deleteAgain:a.bringBack);c.addEventListener("click",()=>this.bringBack(e)),s.append(c)}return s.append(o),r("div",{class:"notice"},r("p",{},this.noticeText(e)),r("span",{class:"when"},M(e.at)),s)}paintDiff(e,t){let i=m("icon muted",{"aria-label":a.back,title:a.back},R.back);i.addEventListener("click",()=>this.go({kind:"list"}));let o=m("icon muted",{"aria-label":a.close,title:a.close},R.close);o.addEventListener("click",()=>this.close());let s=this.diff,c=s&&!s.binary&&!s.tooLarge&&!s.missing?r("span",{class:"tally"},r("span",{class:"a"},`+${s.added}`),r("span",{class:"r"},`\u2212${s.removed}`)):null;e.append(r("div",{class:"dhead"},i,r("h2",{},t.title),...c?[c]:[],o)),e.append(r("div",{class:"sub multi"},t.sub)),t.legend&&e.append(r("div",{class:"hint"},t.legend)),t.note&&e.append(r("div",{class:"hint note"},t.note));let l=r("div",{class:"actions"});if(t.restore){let h=t.restore,f=m("btn small primary",{},"",a.restoreOne);f.addEventListener("click",()=>{let g=this.data?.rows.find(b=>b.n===h.n);g&&this.restore(g,h.path)}),l.append(f)}if(t.notice){let h=t.notice;if(this.data?.canRestore){let g=m("btn small primary",{},"",h.deleted?a.deleteAgain:a.bringBack);g.addEventListener("click",()=>this.bringBack(h)),l.append(g)}let f=m("btn small",{},"",a.dismiss);f.addEventListener("click",()=>void this.dismiss(h)),l.append(f)}if(l.childElementCount&&e.append(l),!s){e.append(r("div",{class:"empty"},a.loading));return}if(s.missing||s.binary||s.tooLarge){e.append(r("div",{class:"empty"},s.missing?a.missing:s.binary?a.binary:a.tooLarge));return}if(!s.lines.some(([h])=>h==="+"||h==="-")){e.append(r("div",{class:"empty"},a.noChange));return}let d=r("div",{class:"diff"}),u=ge(s.lines);s.lines.forEach(([h,f],g)=>{if(h==="~"){d.append(r("div",{class:"dl skip"},a.skipped(f)));return}let b=u.get(g),L=b?r("span",{},f.slice(0,b[0]),r("mark",{},f.slice(b[0],b[1])),f.slice(b[1])):r("span",{},f||" ");d.append(r("div",{class:`dl${h==="+"?" add":h==="-"?" del":""}`},r("span",{class:"k"},h===" "?"":h==="-"?"\u2212":"+"),L))}),s.truncated&&d.append(r("div",{class:"dl skip"},a.truncated)),e.append(d)}watchNotices(){let e=async()=>{if(!document.hidden)try{let{notices:t}=await A(`${this.boot.base}__history/notices`);if(this.mark(t.length),this.pop)return;let i=t.find(o=>!this.toasted.has(o.id));for(let o of t)this.toasted.add(o.id);i&&this.noticeToast(i)}catch{}};e(),window.setInterval(()=>void e(),5e3)}noticeToast(e){this.hideToast();let t=m("btn small primary",{},"",a.compare);t.addEventListener("click",()=>{this.hideToast(),this.open().then(()=>{let c=this.data?.notices.find(l=>l.id===e.id)??e;this.go(this.noticeScreen(c))})});let i=m("btn small",{},"",a.later);i.addEventListener("click",()=>this.hideToast());let o=m("icon muted",{"aria-label":a.close,title:a.close,style:"margin:-6px -6px 0 0"},R.close);o.addEventListener("click",()=>this.hideToast());let s=r("div",{class:"toast",role:"status"},r("div",{class:"head"},r("p",{style:"flex:1"},this.noticeText(e)),o),r("div",{class:"actions"},t,i));this.toastNode=s,this.layerWrap.append(s)}toast(e){this.hideToast();let t=r("div",{class:"toast plain",role:"status"},r("p",{},e));this.toastNode=t,this.layerWrap.append(t),this.toastTimer=window.setTimeout(()=>this.hideToast(),2400)}hideToast(){window.clearTimeout(this.toastTimer),this.toastNode?.remove(),this.toastNode=null}banner(e){let t=e.by==="agent"?a.claude:e.by==="system"?a.start:e.name,i=r("div",{class:"banner",role:"status"},r("span",{class:"text"},e.current?a.bannerCurrent:a.bannerAt(M(e.at),t)),r("span",{class:"ro"},`\xB7 ${a.readOnly}`));if(this.boot.canRestore&&!e.current){let s=m("btn primary",{},"",a.restoreThis);s.addEventListener("click",async()=>{await this.open();let c=this.data?.rows.find(l=>l.n===e.n);c&&this.restore(c)}),i.append(s)}let o=m("btn",{},"",a.backToCurrent);o.addEventListener("click",()=>location.href=e.current_url),i.append(o),this.layerWrap.append(i)}};function ge(n){let e=new Map;for(let t=0;t<n.length;){if(n[t][0]!=="-"){t++;continue}let i=t;for(;i<n.length&&n[i][0]==="-";)i++;let o=i;for(;o<n.length&&n[o][0]==="+";)o++;if(o-i===i-t)for(let s=0;s<i-t;s++){let c=n[t+s][1],l=n[i+s][1],d=0;for(;d<c.length&&d<l.length&&c[d]===l[d];)d++;let u=0;for(;u<c.length-d&&u<l.length-d&&c[c.length-1-u]===l[l.length-1-u];)u++;d+u<Math.min(c.length,l.length)*.3||(e.set(t+s,[d,c.length-u]),e.set(i+s,[d,l.length-u]))}t=o}return e}function X(){let n=window.__baoyuHistory;return n&&typeof n.base=="string"?new I(n):null}var Te=Object.freeze([]);function Q(n){let e=!1,t=()=>{e||(e=!0,n())};typeof requestAnimationFrame=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&requestAnimationFrame(t),setTimeout(t,typeof document<"u"&&document.visibilityState==="visible"?100:16)}var C=["#785ee8","#dc3c3d","#019c7f","#fbb315","#ce447d","#10a122","#257de0","#d25f25"],D="#d25f25",fe=3e4,Z=5*6e4,me=5e3,W=3,v=y?{here:"\u6B64\u523B\u5728\u8FD9\u91CC",nobody:"\u53EA\u6709\u4F60\u5728\u770B",agent:"Agent",changed:n=>`\u521A\u6539\u4E86${n}`,slide:(n,e)=>`\u7B2C ${n} \u9875${e?` \xB7 ${e}`:""}`,board:n=>`\u5728\u300C${n}\u300D`,canvas:"\u5728\u753B\u5E03\u4E0A",presenting:"\u6B63\u5728\u653E\u6620",overview:"\u5728\u770B\u5168\u90E8\u9875\u9762",editing:"\u6B63\u5728\u7F16\u8F91",idle:"\u4E00\u4F1A\u513F\u6CA1\u52A8\u4E86",open:"\u5F00\u7740\u8FD9\u4E00\u9875",go:"\u8DF3\u5230\u8FD9\u4E00\u9875",hintEdit:n=>`${n} \u6B63\u5728\u6539\u8FD9\u4E00\u9875`,hintEditBoard:(n,e)=>`${n} \u6B63\u5728\u6539\u300C${e}\u300D`,hintAgent:"Agent \u521A\u6539\u4E86\u8FD9\u4E00\u9875",more:n=>`\u8FD8\u6709 ${n} \u4EBA`,roles:{owner:"\u6240\u6709\u8005",editor:"\u53EF\u7F16\u8F91",commenter:"\u53EF\u8BC4\u8BBA",viewer:"\u53EF\u67E5\u770B"},note:"\u6709\u4EBA\u6539\u4F60\u6B63\u5728\u770B\u7684\u5730\u65B9\u65F6\u4F1A\u63D0\u9192\u4F60\uFF0C\u4E0D\u4F1A\u9501\u4F4F\u3002"}:{here:"Here now",nobody:"Only you",agent:"Agent",changed:n=>`Just changed ${n}`,slide:(n,e)=>`Slide ${n}${e?` \xB7 ${e}`:""}`,board:n=>`On ${n}`,canvas:"On the canvas",presenting:"Presenting",overview:"Looking at all slides",editing:"editing",idle:"idle",open:"Has this open",go:"Go to this slide",hintEdit:n=>`${n} is editing this slide`,hintEditBoard:(n,e)=>`${n} is editing ${e}`,hintAgent:"Agent just changed this slide",more:n=>`${n} more`,roles:{owner:"Owner",editor:"Can edit",commenter:"Can comment",viewer:"Can view"},note:"You get a note when someone edits what you are looking at. Nothing is locked."},ee={robot:w(j,12),go:w('<path d="M6 3.8 10.2 8 6 12.2"/>',14)},ie=`
152
+ .av { position: relative; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 600; letter-spacing: .01em; line-height: 1; }
153
+ .av svg { width: 60%; height: 60%; }
154
+ .av.idle { opacity: .45; }
155
+ .av.editing::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--c); opacity: .55; }
156
+ `,oe=ie+`
157
+ .peers { padding: 0 4px; gap: 0; }
158
+ .peers[hidden] { display: none; }
159
+ .peers .stack { display: inline-flex; align-items: center; }
160
+ .peers .av { width: 22px; height: 22px; font-size: 10.5px; margin-left: -6px; box-shadow: 0 0 0 2px var(--ring, #fff); }
161
+ .peers .av:first-child { margin-left: 0; }
162
+ .peers.bar .av { width: 20px; height: 20px; font-size: 10px; }
163
+ .peers.float { padding: 0 8px; }
164
+ .open.peers.tool { width: auto; min-width: 24px; padding: 0 1px; }
165
+ .peers .plus { margin-left: 4px; font-size: 12px; color: inherit; opacity: .7; }
166
+ @media (prefers-color-scheme: dark) { .peers .av { box-shadow: 0 0 0 2px var(--ring, #262624); } }
167
+ `,ve=`
168
+ .peer { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: transparent; margin: 0 -10px; padding: 7px 10px; border-radius: 12px; width: calc(100% + 20px); }
169
+ button.peer:hover { background: var(--soft); }
170
+ .peer .av { width: 30px; height: 30px; font-size: 12px; }
171
+ .peer .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
172
+ .peer .role { color: var(--muted); font-weight: 400; font-size: 12.5px; margin-left: 6px; }
173
+ .peer .sub .on { color: var(--ok); }
174
+ .peer .go { color: var(--muted); }
175
+ .hint-note { position: fixed; z-index: 2147483000; max-width: min(320px, calc(100vw - 24px)); display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; animation: hint-in .16s ease-out; }
176
+ .hint-note .av { width: 22px; height: 22px; font-size: 10.5px; }
177
+ @keyframes hint-in { from { opacity: 0; transform: translateY(-4px); } }
178
+ `,H=n=>{let e=n.presence.context;return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null},N=n=>typeof n=="string"?n:typeof n=="object"&&n!==null&&typeof n.text=="string"?n.text:"",be=n=>{let e=n.presence.who,t=typeof e?.c=="string"?e.c.toLowerCase():"";if(C.includes(t)&&(n.kind==="agent"||t!==D))return t;if(n.kind==="agent")return D;let i=0;for(let s=0;s<n.by.length;s++)i=i*31+n.by.charCodeAt(s)>>>0;let o=i%C.length;return C[o]===D&&(o=(o+1)%C.length),C[o]},we=n=>{let[e=0,t=0,i=0]=[1,3,5].map(o=>{let s=parseInt(n.slice(o,o+2),16)/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4});return 1.05/(.2126*e+.7152*t+.0722*i+.05)<3?"#0b0b0b":"#ffffff"},V=(n,e)=>{if(n.agent||e-n.at>fe)return!1;let t=H(n.latest);if(!t||t.mode!==void 0&&t.mode!=="edit"&&t.mode!=="focused"&&t.mode!=="canvas")return!1;let i=t.selection;return Array.isArray(i)?i.length>0:Array.isArray(t.selected)&&t.selected.length>0},re=(n,e)=>{let t=n[e];return Array.isArray(t)?t.filter(i=>typeof i=="string"):[]},se=n=>{let e=Array.isArray(n.selected)?n.selected.find(t=>typeof t=="string"&&t.includes("#")):void 0;return e?e.slice(0,e.indexOf("#")):re(n,"selectedArtboards")[0]??""},te=n=>{let e=n.replace(/\.dc\.html$/,"");try{e=decodeURIComponent(e)}catch{}return e.slice(e.lastIndexOf("/")+1)||e},ae=n=>typeof n.page=="string"?n.page:"",ne=n=>{let e=n&&H(n);if(!e)return null;if(typeof e.slideId=="string"&&e.slideId)return`slide:${e.slideId}`;if(Array.isArray(e.visibleArtboards)){let t=se(e);return t?`board:${ae(e)}:${t}`:null}return null},ye=n=>{let e=n&&H(n);return e?typeof e.slideId=="string"&&e.slideId?new Set([`slide:${e.slideId}`]):new Set(re(e,"visibleArtboards").map(t=>`board:${ae(e)}:${t}`)):new Set},Y=class{node=r("button",{class:"open peers float",type:"button","aria-haspopup":"dialog","aria-expanded":"false",hidden:""});presence=null;people=[];seen=new Map;look="float";layer=r("div",{"data-baoyu-presence-layer":""});layerRoot=this.layer.attachShadow({mode:"open"});layerWrap=r("div",{class:"wrap"});pop=null;caret=r("div",{class:"caret"});hint=null;hintTimer;hinted=new Map;frame=!1;constructor(){this.layerRoot.append(r("style",{},E+ie+ve),this.layerWrap),this.node.addEventListener("click",()=>this.pop?this.close():this.open());let e=()=>{let t=window.__baoyuPresence;!t||t===this.presence||(this.presence=t,t.subscribe(()=>this.schedule()),this.schedule())};e(),window.addEventListener("baoyu-presence",e),window.setInterval(()=>this.schedule(),5e3)}setLook(e){this.look=e,this.node.className=`open peers ${e}`}schedule(){this.frame||(this.frame=!0,Q(()=>{this.frame=!1,this.update()}))}update(){let e=this.presence;if(!e)return;let t=Date.now(),i=e.peers(),o=new Set;for(let l of i){o.add(l.peer);let d=JSON.stringify(l.presence),u=this.seen.get(l.peer);(!u||u.json!==d)&&this.seen.set(l.peer,{json:d,at:t})}for(let l of this.seen.keys())o.has(l)||this.seen.delete(l);let s=new Map;for(let l of i){let d=l.kind==="agent";if(!d&&l.by===e.me.by)continue;let u=d?"agent":l.by,h=this.seen.get(l.peer)?.at??t,f=s.get(u);f&&f.at>=h||s.set(u,{key:u,name:d?v.agent:l.name||"?",role:l.role??"",agent:d,color:be(l),latest:l,at:h})}this.people=[...s.values()].sort((l,d)=>Number(d.agent)-Number(l.agent)||d.at-l.at);let c=i.find(l=>l.peer===e.me.peer);this.paintSeat(t),this.pop&&this.paintList(t),this.checkHint(ye(c),t)}avatar(e,t,i=""){let o=!e.agent&&t-e.at>Z,s=V(e,t),c=r("span",{class:`av${o?" idle":""}${s?" editing":""}${i?` ${i}`:""}`,style:`background:${e.color};color:${we(e.color)};--c:${e.color}`});return e.agent?c.innerHTML=ee.robot:c.textContent=T(e.name),c}paintSeat(e){let t=this.people;if(this.node.hidden=t.length===0,!t.length){this.pop&&this.close();return}let i=r("span",{class:"stack"});for(let c of t.slice(0,W))i.append(this.avatar(c,e));this.node.replaceChildren(i),t.length>W&&this.node.append(r("span",{class:"plus"},`+${t.length-W}`));let o=t.map(c=>c.name),s=`${v.here}: ${o.slice(0,5).join(y?"\u3001":", ")}${o.length>5?y?` ${v.more(o.length-5)}`:`, ${v.more(o.length-5)}`:""}`;this.node.setAttribute("aria-label",s),this.node.title=s}whereOf(e,t){let i=e.latest,o=H(i),s=typeof o?.slideId=="string"?o.slideId:"",c=s?document.querySelector(`[role="option"][data-slide-id="${CSS.escape(s)}"]`):null;if(e.agent){let u=i.presence.where,h=typeof(y?u?.zh:u?.en)=="string"?String(y?u.zh:u.en):"";return{text:h?v.changed(h):v.open,editing:!1,slide:c}}let l=V(e,t),d="";if(o?.mode==="present")d=v.presenting;else if(o?.mode==="grid")d=v.overview;else if(typeof o?.slideIndex=="number"&&o.slideIndex>0)d=v.slide(o.slideIndex,N(o.slideTitle));else if(o&&Array.isArray(o.visibleArtboards)){let u=se(o);d=u?v.board(te(u)):N(o.pageName)?v.board(N(o.pageName)):v.canvas}else N(o?.pageName)?d=v.board(N(o?.pageName)):d=v.open;return!l&&t-e.at>Z&&(d+=` \xB7 ${v.idle}`),{text:d,editing:l,slide:o?.mode==="present"?null:c}}open(){this.pop||!this.people.length||(this.pop=r("div",{class:"pop",role:"dialog","aria-label":v.here}),this.layer.isConnected||document.body.append(this.layer),this.layerWrap.append(this.pop,this.caret),this.node.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",this.onPointer,!0),window.addEventListener("keydown",this.onKey,!0),window.addEventListener("resize",this.position),window.addEventListener("scroll",this.position,!0),this.paintList(Date.now()))}close(){document.removeEventListener("mousedown",this.onPointer,!0),window.removeEventListener("keydown",this.onKey,!0),window.removeEventListener("resize",this.position),window.removeEventListener("scroll",this.position,!0),this.pop?.remove(),this.pop=null,this.caret.remove(),this.node.setAttribute("aria-expanded","false")}paintList(e){if(!this.pop)return;let t=r("div",{class:"body"},r("div",{class:"head"},r("h2",{},v.here)));this.people.length||t.append(r("div",{class:"empty"},v.nobody));for(let i of this.people){let o=this.whereOf(i,e),s=r("div",{class:"sub"},o.text);o.editing&&s.append(" \xB7 ",r("span",{class:"on"},v.editing));let c=r("div",{class:"name"},i.name),l=i.agent?"":v.roles[i.role]??"";l&&c.append(r("span",{class:"role"},l));let d=r("div",{class:"who"},c,s),u=o.slide?r("button",{class:"peer",type:"button",title:v.go}):r("div",{class:"peer"});if(u.append(this.avatar(i,e),d),o.slide){let h=o.slide;u.insertAdjacentHTML("beforeend",`<span class="go">${ee.go}</span>`),u.addEventListener("click",()=>{h.click(),h.scrollIntoView({block:"nearest"}),this.close()})}t.append(u)}this.presence?.peers().some(i=>i.kind!=="agent"&&H(i))&&t.append(r("div",{class:"hint"},v.note)),this.pop.replaceChildren(t),this.position()}position=()=>{if(!this.pop)return;let e=window.innerWidth,t=window.innerHeight,i=this.node.getBoundingClientRect(),o=i.width>0&&i.bottom>0&&i.top<t,s=Math.min(320,e-24),c=o?i.right+40:e-16,l=Math.max(12,Math.min(c-s,e-s-12)),d=o?i.bottom+10:56;if(Object.assign(this.pop.style,{left:`${l}px`,top:`${d}px`,width:`${s}px`,maxHeight:`${Math.max(200,t-d-12)}px`}),o){let u=Math.max(l+18,Math.min(i.left+i.width/2-7,l+s-32));Object.assign(this.caret.style,{display:"",left:`${u}px`,top:`${d-7}px`})}else this.caret.style.display="none"};onPointer=e=>{let t=e.composedPath();!this.pop||t.includes(this.pop)||t.includes(this.node)||this.close()};onKey=e=>{e.key==="Escape"&&(e.stopPropagation(),e.preventDefault(),this.close(),this.node.focus())};checkHint(e,t){for(let i of this.hinted.keys())this.people.some(o=>o.key===i&&ne(o.latest)===this.hinted.get(i))||this.hinted.delete(i);if(e.size)for(let i of this.people){let o=ne(i.latest);if(!(!o||!e.has(o)||this.hinted.get(i.key)===o)&&!(!i.agent&&!V(i,t))){this.hinted.set(i.key,o),this.showHint(i,t,o);return}}}showHint(e,t,i){window.clearTimeout(this.hintTimer),this.hint?.remove();let o=this.node.getBoundingClientRect();if(!o.width)return;this.layer.isConnected||document.body.append(this.layer);let s=r("div",{class:"hint-note",role:"status"},this.avatar(e,t),r("span",{},e.agent?v.hintAgent:i.startsWith("board:")?v.hintEditBoard(e.name,te(i.slice(i.indexOf(":",6)+1))):v.hintEdit(e.name)));this.layerWrap.append(s);let c=s.getBoundingClientRect().width;Object.assign(s.style,{top:`${o.bottom+10}px`,left:`${Math.max(12,Math.min(o.right-c,window.innerWidth-c-12))}px`}),this.hint=s,this.hintTimer=window.setTimeout(()=>{s.remove(),this.hint===s&&(this.hint=null)},me)}};function le(){return new Y}var O=window.__baoyuShare??{},_=O.role==="owner",z=O.noun??{en:"artifact",zh:"\u5185\u5BB9",zhThis:"\u8FD9\u4EFD\u5185\u5BB9"},de=["editor","commenter","viewer"],p=y?{share:"\u5206\u4EAB",title:`\u5206\u4EAB${z.zhThis}`,close:"\u5173\u95ED",peopleWithAccess:"\u6709\u6743\u8BBF\u95EE\u7684\u4EBA",joinedPeople:"\u52A0\u5165\u7684\u4EBA",generalAccess:"\u4E00\u822C\u8BBF\u95EE\u6743\u9650",inviteLinks:"\u9080\u8BF7\u94FE\u63A5",you:"\uFF08\u4F60\uFF09",thisComputer:"\u8FD9\u53F0\u7535\u8111",owner:"\u6240\u6709\u8005",roleNames:{editor:"\u7F16\u8F91\u8005",commenter:"\u8BC4\u8BBA\u8005",viewer:"\u67E5\u770B\u8005"},linkTitles:{editor:"\u53EF\u7F16\u8F91",commenter:"\u53EF\u8BC4\u8BBA",viewer:"\u4EC5\u67E5\u770B"},roleNotes:{editor:"\u7F16\u8F91\u548C\u8BC4\u8BBA",commenter:O.reactions?"\u8BC4\u8BBA\u548C\u8868\u60C5\u56DE\u5E94\uFF0C\u4E0D\u80FD\u7F16\u8F91":"\u8BC4\u8BBA\uFF0C\u4E0D\u80FD\u7F16\u8F91",viewer:"\u53EA\u80FD\u770B"},changeRole:n=>`\u66F4\u6539\u300C${n}\u300D\u7684\u89D2\u8272`,linkOff:"\u94FE\u63A5\u5DF2\u5173\u95ED",online:"\u5728\u7EBF",seen:n=>`${n}\u6765\u8FC7`,paused:"\u94FE\u63A5\u5DF2\u5173\u95ED\uFF0C\u6682\u65F6\u65E0\u6CD5\u8BBF\u95EE",none:"\u8FD8\u6CA1\u6709\u4EBA\u52A0\u5165\u3002\u628A\u4E0B\u9762\u7684\u94FE\u63A5\u53D1\u7ED9\u5BF9\u65B9\u3002",remove:"\u79FB\u51FA",removeTitle:n=>`\u79FB\u51FA\u300C${n}\u300D\uFF1F`,removeText:`\u5BF9\u65B9\u5C06\u65E0\u6CD5\u518D\u8BBF\u95EE${z.zhThis}\uFF0C\u4E4B\u540E\u4ECD\u53EF\u4EE5\u7528\u94FE\u63A5\u91CD\u65B0\u52A0\u5165\u3002`,onlyHere:"\u4EC5\u8FD9\u53F0\u7535\u8111",onlyHereNote:"\u522B\u4EBA\u6253\u4E0D\u5F00\u8FD9\u4E9B\u94FE\u63A5\u3002",onLan:"\u540C\u4E00\u7F51\u7EDC\u91CC\u6709\u94FE\u63A5\u7684\u4EBA",onLanNote:"\u540C\u4E00 Wi-Fi \u6216\u5C40\u57DF\u7F51\u91CC\u7684\u4EBA\u7528\u94FE\u63A5\u6253\u5F00\uFF0C\u62FF\u5230\u54EA\u4E2A\u94FE\u63A5\u5C31\u662F\u54EA\u4E2A\u89D2\u8272\u3002",whereOff:"\u53EA\u6709\u8FD9\u53F0\u7535\u8111\u80FD\u6253\u5F00\u8FD9\u4E9B\u94FE\u63A5\u3002",whereOn:n=>`\u5C40\u57DF\u7F51\u5730\u5740\uFF1A${n}`,noAddress:"\u8FD9\u53F0\u7535\u8111\u6CA1\u6709\u5C40\u57DF\u7F51\u5730\u5740\u3002",copyLink:"\u590D\u5236\u94FE\u63A5",onlyAccess:"\u53EA\u6709\u6709\u6743\u8BBF\u95EE\u7684\u4EBA\u624D\u80FD\u6253\u5F00\u8FD9\u4E2A\u94FE\u63A5",guestInviteNote:"\u540C\u4E00\u7F51\u7EDC\u91CC\u7684\u4EBA\u6253\u5F00\u94FE\u63A5\uFF0C\u5C31\u4EE5\u8FD9\u4E2A\u89D2\u8272\u52A0\u5165\u3002\u6240\u6709\u8005\u80FD\u770B\u5230\u8C01\u52A0\u5165\u4E86\uFF0C\u53EF\u4EE5\u6539\u89D2\u8272\u6216\u79FB\u51FA\u3002",copied:"\u5DF2\u590D\u5236",turnOn:"\u5F00\u542F",more:"\u66F4\u591A",linkOffNote:"\u5DF2\u5173\u95ED\uFF0C\u6CA1\u4EBA\u80FD\u7528\u5B83\u52A0\u5165",turnOnLink:"\u5F00\u542F\u94FE\u63A5",turnOffLink:"\u5173\u95ED\u94FE\u63A5",turnOffNote:"\u7528\u5B83\u52A0\u5165\u7684\u4EBA\u6682\u65F6\u65E0\u6CD5\u8BBF\u95EE",resetLink:"\u91CD\u7F6E\u94FE\u63A5",resetNote:"\u6362\u4E00\u4E2A\u65B0\u5730\u5740\uFF0C\u7528\u65E7\u94FE\u63A5\u52A0\u5165\u7684\u4EBA\u4F1A\u88AB\u79FB\u51FA",resetTitle:n=>`\u91CD\u7F6E\u300C${n}\u300D\u94FE\u63A5\uFF1F`,resetText:"\u65E7\u94FE\u63A5\u4F1A\u5931\u6548\uFF0C\u901A\u8FC7\u5B83\u52A0\u5165\u7684\u4EBA\u4E5F\u4F1A\u5931\u53BB\u8BBF\u95EE\u6743\u9650\u3002",cancel:"\u53D6\u6D88",failed:"\u6CA1\u80FD\u5B8C\u6210\uFF1A"}:{share:"Share",title:`Share this ${z.en}`,close:"Close",peopleWithAccess:"People with access",joinedPeople:"People who joined",generalAccess:"General access",inviteLinks:"Invite links",you:" (you)",thisComputer:"This computer",owner:"Owner",roleNames:{editor:"Editor",commenter:"Commenter",viewer:"Viewer"},linkTitles:{editor:"Can edit",commenter:"Can comment",viewer:"Can view"},roleNotes:{editor:"Edit and comment",commenter:O.reactions?"Comment and react, no edits":"Comment, no edits",viewer:"Read only"},changeRole:n=>`Change ${n}'s role`,linkOff:"Link off",online:"Online",seen:n=>`Seen ${n}`,paused:"Link off: no access until it is back on",none:"Nobody has joined yet. Send someone a link below.",remove:"Remove",removeTitle:n=>`Remove ${n}?`,removeText:`They lose access to this ${z.en}. They can join again with a link.`,onlyHere:"Only this computer",onlyHereNote:"Nobody else can open the links.",onLan:"Anyone on your network with a link",onLanNote:"People on the same Wi-Fi or LAN open it with a link; the link sets their role.",whereOff:"Only this computer can open these links.",whereOn:n=>`On this network at ${n}`,noAddress:"This computer has no local network address.",copyLink:"Copy link",onlyAccess:"Only people with access can open this link",guestInviteNote:"Whoever on your network opens one joins in that role. The owner sees who joined and can change or remove them.",copied:"Copied",turnOn:"Turn on",more:"More",linkOffNote:"Off: nobody can join with it",turnOnLink:"Turn on link",turnOffLink:"Turn off link",turnOffNote:"Whoever joined with it loses access until it is back on",resetLink:"Reset link",resetNote:"A new address; whoever joined with the old one is removed",resetTitle:n=>`Reset the "${n}" link?`,resetText:"The old link stops working and the people who joined with it lose access.",cancel:"Cancel",failed:"Could not do that: "},k={share:w('<circle cx="4" cy="8" r="2"/><circle cx="12" cy="3.5" r="2"/><circle cx="12" cy="12.5" r="2"/><path d="M5.8 7 10.2 4.5M5.8 9l4.4 2.5"/>',16),close:w('<path d="M4 4l8 8M12 4l-8 8"/>',18),chevron:w('<path d="M4.5 6.2 8 9.7l3.5-3.5"/>',14),check:w('<path d="M3 8.6 6.3 11.8 13 4.6"/>',18),trash:w('<path d="M2.6 4.2h10.8M6.3 4.2V2.7h3.4v1.5M4 4.2l.7 9.1h6.6l.7-9.1M6.7 6.7v4.2M9.3 6.7v4.2"/>',17),link:w('<path d="M6.8 9.2a2.5 2.5 0 0 0 3.5 0l2.3-2.3a2.5 2.5 0 0 0-3.5-3.5l-.8.8M9.2 6.8a2.5 2.5 0 0 0-3.5 0L3.4 9.1a2.5 2.5 0 0 0 3.5 3.5l.8-.8"/>',15),more:'<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><circle cx="3.5" cy="8" r="1.25"/><circle cx="8" cy="8" r="1.25"/><circle cx="12.5" cy="8" r="1.25"/></svg>',lock:w('<rect x="3.5" y="7" width="9" height="6.5" rx="1.6"/><path d="M5.6 7V5.2a2.4 2.4 0 0 1 4.8 0V7"/>',17),network:w('<path d="M1.8 6.3a9 9 0 0 1 12.4 0M4 8.7a5.8 5.8 0 0 1 8 0M6.3 11a2.5 2.5 0 0 1 3.4 0"/><circle cx="8" cy="13.2" r=".5" fill="currentColor"/>',17),editor:w('<path d="M10.4 2.9 13.1 5.6 5.9 12.8l-3.3.6.6-3.3z"/><path d="M9.1 4.2l2.7 2.7"/>',16),commenter:w('<path d="M3 3h10a1.2 1.2 0 0 1 1.2 1.2v5.6A1.2 1.2 0 0 1 13 11H7.2l-3.2 2.6V11H3a1.2 1.2 0 0 1-1.2-1.2V4.2A1.2 1.2 0 0 1 3 3z"/>',16),viewer:w('<path d="M1.5 8S3.9 3.6 8 3.6 14.5 8 14.5 8 12.1 12.4 8 12.4 1.5 8 1.5 8z"/><circle cx="8" cy="8" r="2"/>',16)};async function ce(n){let e=await fetch("/__share",n?{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}:{cache:"no-store"}),t=await e.json();if(!e.ok)throw new Error(t?.message??`HTTP ${e.status}`);return t}var F=class{host=r("span",{"data-baoyu-share":""});root=this.host.attachShadow({mode:"open"});wrap=r("div",{class:"wrap seat"});button=r("button",{class:"open float",type:"button","aria-haspopup":"dialog","aria-expanded":"false"});history=X();presence=le();look="float";layer=r("div",{"data-baoyu-share-layer":""});layerRoot=this.layer.attachShadow({mode:"open"});layerWrap=r("div",{class:"wrap"});pop=null;caret=r("div",{class:"caret"});menu=null;menuAnchor=null;menuJustClosed=null;asking=null;view=null;invites=null;error="";timer;copied=null;constructor(){this.root.append(r("style",{},E+U+oe),this.wrap),this.layerRoot.append(r("style",{},E),this.layerWrap),this.wrap.append(this.presence.node),this.history&&this.wrap.append(this.history.button),this.wrap.append(this.button),this.button.addEventListener("click",()=>this.pop?this.close():void this.open()),this.paintButton(),_&&ce().then(e=>{this.view=e,this.paintButton()},()=>{})}mount(){let e=()=>{let t=xe();if(!t){this.host.isConnected||(this.host.style.cssText="position:fixed;top:10px;right:120px;z-index:2147482000",document.body.append(this.host),this.setLook("float"));return}let[i,o,s]=t;i==="into"&&this.host.parentNode!==o&&o.append(this.host),i==="first"&&o.firstChild!==this.host&&o.prepend(this.host),i==="before"&&o.previousSibling!==this.host&&o.before(this.host),this.host.style.cssText="display:inline-flex;align-items:center",this.setLook(s),this.pop&&this.position()};e(),new MutationObserver(e).observe(document.body,{childList:!0,subtree:!0}),window.setInterval(e,1500)}setLook(e){e!==this.look&&(this.look=e,this.button.className=`open ${e}`,this.history?.setLook(e),this.presence.setLook(e),this.paintButton())}paintButton(){let e=_&&!!this.view?.lan;this.button.innerHTML=k.share,this.look==="tool"?(this.button.setAttribute("aria-label",p.share),this.button.title=e?`${p.share} \xB7 ${p.onLan}`:p.share):(this.button.removeAttribute("aria-label"),this.button.removeAttribute("title"),this.button.append(p.share)),e&&this.button.append(r("span",{class:"dot",title:p.onLan}))}async open(){if(this.pop)return;this.pop=r("div",{class:"pop",role:"dialog","aria-label":p.title}),this.layerWrap.append(this.pop,this.caret),document.body.append(this.layer),this.button.setAttribute("aria-expanded","true"),document.addEventListener("mousedown",this.onPointer,!0),window.addEventListener("keydown",this.onKey,!0),window.addEventListener("resize",this.position),window.addEventListener("scroll",this.position,!0),this.position();let e=_?()=>this.refresh():()=>this.refreshInvites();_||this.paintGuest(),await e(),this.timer=window.setInterval(()=>void e(),4e3)}close(){window.clearInterval(this.timer),document.removeEventListener("mousedown",this.onPointer,!0),window.removeEventListener("keydown",this.onKey,!0),window.removeEventListener("resize",this.position),window.removeEventListener("scroll",this.position,!0),this.closeMenu(),this.asking=null,this.pop?.remove(),this.pop=null,this.caret.remove(),this.layer.remove(),this.button.setAttribute("aria-expanded","false"),this.button.focus()}position=()=>{if(!this.pop)return;let e=window.innerWidth,t=window.innerHeight,i=this.button.getBoundingClientRect(),o=i.width>0&&i.bottom>0&&i.top<t,s=Math.min(460,e-24),c=o?i.right:e-16,l=Math.max(12,Math.min(c-s,e-s-12)),d=o?i.bottom+10:56;if(Object.assign(this.pop.style,{left:`${l}px`,top:`${d}px`,width:`${s}px`,maxHeight:`${Math.max(240,t-d-12)}px`}),o){let u=Math.max(l+18,Math.min(i.left+i.width/2-7,l+s-32));Object.assign(this.caret.style,{display:"",left:`${u}px`,top:`${d-7}px`})}else this.caret.style.display="none";this.menu&&this.menuAnchor&&this.placeMenu(this.menu,this.menuAnchor)};onPointer=e=>{let t=e.composedPath();this.menu&&!t.includes(this.menu)&&(this.menuJustClosed=this.menuAnchor,this.closeMenu(),setTimeout(()=>this.menuJustClosed=null,0)),!(!this.pop||t.includes(this.pop)||t.includes(this.button)||this.menu&&t.includes(this.menu))&&this.close()};onKey=e=>{if(e.key==="Escape")if(e.stopPropagation(),e.preventDefault(),this.asking)this.asking();else if(this.menu){let t=this.menuAnchor;this.closeMenu(),t?.focus()}else this.close()};async refresh(e){let t=JSON.stringify([this.view,this.error]);try{this.view=await ce(e),this.error=""}catch(i){this.error=p.failed+i.message}this.paintButton(),!(!e&&(this.menu||this.asking||this.pop?.firstChild&&JSON.stringify([this.view,this.error])===t))&&this.paint()}async refreshInvites(){let e=JSON.stringify([this.invites,this.error]);try{let t=await fetch("/__share/invite",{cache:"no-store"}),i=await t.json();if(!t.ok)throw new Error(i?.message??`HTTP ${t.status}`);this.invites=i.links,this.error=""}catch(t){this.error=p.failed+t.message}JSON.stringify([this.invites,this.error])!==e&&this.paintGuest()}openMenu(e,t){if(this.menuJustClosed===e)return;this.closeMenu();let i=r("div",{class:"menu",role:"menu"});for(let o of t){let s=r("button",{class:`item${o.danger?" danger":""}`,type:"button",role:o.checked===void 0?"menuitem":"menuitemradio"});o.checked!==void 0&&s.setAttribute("aria-checked",String(o.checked)),s.disabled=o.disabled===!0,s.append(r("span",{class:"who"},r("span",{class:"name"},o.label),...o.sub?[r("span",{class:"sub"},o.sub)]:[])),o.checked!==void 0&&s.append(r("span",{class:"tick",html:o.checked?k.check:""})),s.addEventListener("click",()=>{this.closeMenu(),e.focus({preventScroll:!0}),o.run()}),i.append(s)}i.addEventListener("keydown",o=>{let s=[...i.querySelectorAll("button:not(:disabled)")],c=s.indexOf(this.layerRoot.activeElement),l=d=>s[(d+s.length)%s.length]?.focus();if(o.key==="ArrowDown")l(c+1);else if(o.key==="ArrowUp")l(c-1);else if(o.key==="Home")l(0);else if(o.key==="End")l(-1);else if(o.key==="Tab")this.closeMenu();else return;o.preventDefault()}),this.menu=i,this.menuAnchor=e,e.setAttribute("aria-expanded","true"),this.layerWrap.append(i),this.placeMenu(i,e),(i.querySelector('[aria-checked="true"]:not(:disabled)')??i.querySelector("button:not(:disabled)"))?.focus({preventScroll:!0})}placeMenu(e,t){let i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),s=window.innerWidth,c=window.innerHeight,d=t.classList.contains("wide")?i.left:i.right-o.width;d=Math.max(12,Math.min(d,s-o.width-12));let u=i.bottom+6;u+o.height>c-12&&i.top-o.height-6>12&&(u=i.top-o.height-6),Object.assign(e.style,{left:`${d}px`,top:`${u}px`})}closeMenu(){this.menu?.remove(),this.menuAnchor?.setAttribute("aria-expanded","false"),this.menu=null,this.menuAnchor=null}ask(e,t,i){return new Promise(o=>{if(!this.pop)return o(!1);this.closeMenu();let s=r("div",{class:"ask",role:"alertdialog","aria-modal":"true","aria-label":e}),c=m("btn",{},"",p.cancel),l=m("btn danger",{},"",i),d=u=>{this.asking=null,s.remove(),o(u)};c.addEventListener("click",()=>d(!1)),l.addEventListener("click",()=>d(!0)),s.addEventListener("mousedown",u=>u.target===s&&d(!1)),s.append(r("div",{class:"ask-card"},r("h3",{},e),r("p",{},t),r("div",{class:"ask-row"},c,l))),this.asking=()=>d(!1),this.pop.append(s),c.focus()})}paint(){if(!this.pop||!this.view)return;let e=this.view,t=this.layerRoot.activeElement?.getAttribute("data-key"),i=this.pop.querySelector(".body")?.scrollTop??0,o=r("div",{class:"body"}),s=m("icon muted",{"aria-label":p.close,title:p.close,"data-key":"close"},k.close);s.addEventListener("click",()=>this.close()),o.append(r("div",{class:"head"},r("h2",{},e.title||p.title),s)),o.append(r("div",{class:"label"},p.peopleWithAccess));let c=O.name??"";o.append(r("div",{class:"row"},r("div",{class:"avatar",style:`background:${S("local"+c)}`},T(c)),r("div",{class:"who"},r("div",{class:"name"},c,r("span",{class:"faint"},p.you)),r("div",{class:"sub"},p.thisComputer)),r("span",{class:"select static",html:`<span>${p.owner}</span>${k.chevron}`}))),o.append(r("div",{class:"label"},p.joinedPeople)),e.guests.length||o.append(r("div",{class:"empty"},p.none));for(let h of[...e.guests].sort((f,g)=>Number(g.online)-Number(f.online)||(g.seen??g.joined).localeCompare(f.seen??f.joined))){let f=h.online?p.online:h.active?p.seen(K(h.seen??h.joined)):p.paused,g=m("select",{"aria-haspopup":"menu","aria-expanded":"false","aria-label":p.changeRole(h.name),"data-key":`role-${h.id}`},"",p.roleNames[h.role],k.chevron);g.addEventListener("click",()=>this.openMenu(g,de.map(L=>({label:p.roleNames[L],sub:e.links[L].on?void 0:p.linkOff,checked:L===h.role,disabled:!e.links[L].on,run:()=>L!==h.role&&void this.refresh({action:"role",guest:h.id,role:L})}))));let b=m("icon muted",{"aria-label":`${p.remove} ${h.name}`,title:p.remove,"data-key":`rm-${h.id}`},k.trash);b.addEventListener("click",async()=>{await this.ask(p.removeTitle(h.name),p.removeText,p.remove)&&this.refresh({action:"remove",guest:h.id})}),o.append(r("div",{class:`row${h.active?"":" paused"}`},r("div",{class:`avatar${h.online?" on":""}`,style:`background:${S(h.id)}`},T(h.name)),r("div",{class:"who"},r("div",{class:"name"},h.name),r("div",{class:`sub${h.online?" on":""}`},f)),g,b))}o.append(r("div",{class:"label"},p.generalAccess));let l=e.lan?e.addresses.length?p.whereOn(e.addresses.map(h=>`${h}:${e.port}`).join(" \xB7 ")):p.noAddress:p.whereOff,d=m("select wide",{"aria-haspopup":"menu","aria-expanded":"false","data-key":"lan"},"",e.lan?p.onLan:p.onlyHere,k.chevron);d.addEventListener("click",()=>this.openMenu(d,[{label:p.onlyHere,sub:p.onlyHereNote,checked:!e.lan,run:()=>e.lan&&void this.refresh({action:"lan",on:!1})},{label:p.onLan,sub:p.onLanNote,checked:e.lan,run:()=>!e.lan&&void this.refresh({action:"lan",on:!0})}])),o.append(r("div",{class:"row"},r("div",{class:"circle",html:e.lan?k.network:k.lock}),r("div",{class:"who"},d,r("div",{class:"sub multi"},l)))),o.append(r("div",{class:"label"},p.inviteLinks));for(let h of de){let f=e.links[h],g;f.on?g=this.copyButton(h,f.url):(g=m("pill",{"data-key":`copy-${h}`},"",p.turnOn),g.addEventListener("click",()=>void this.refresh({action:"link",role:h,on:!0})));let b=m("icon muted",{"aria-haspopup":"menu","aria-expanded":"false","aria-label":`${p.more}: ${p.linkTitles[h]}`,title:p.more,"data-key":`more-${h}`},k.more);b.addEventListener("click",()=>this.openMenu(b,[f.on?{label:p.turnOffLink,sub:p.turnOffNote,run:()=>void this.refresh({action:"link",role:h,on:!1})}:{label:p.turnOnLink,run:()=>void this.refresh({action:"link",role:h,on:!0})},{label:p.resetLink,sub:p.resetNote,danger:!0,run:async()=>{await this.ask(p.resetTitle(p.linkTitles[h]),p.resetText,p.resetLink)&&this.refresh({action:"reset",role:h})}}])),o.append(r("div",{class:`row${f.on?"":" off"}`,title:f.on?f.url:""},r("div",{class:"circle",html:k[h]}),r("div",{class:"who"},r("div",{class:"name"},p.linkTitles[h]),r("div",{class:"sub"},f.on?p.roleNotes[h]:p.linkOffNote)),g,b))}this.error&&o.append(r("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(o),o.scrollTop=i,this.position(),((t?o.querySelector(`[data-key="${t}"]`):null)??s).focus({preventScroll:!0})}paintGuest(){if(!this.pop)return;let e=this.layerRoot.activeElement?.getAttribute("data-key"),t=r("div",{class:"body"}),i=m("icon muted",{"aria-label":p.close,title:p.close,"data-key":"close"},k.close);if(i.addEventListener("click",()=>this.close()),t.append(r("div",{class:"head"},r("h2",{},O.title||document.title||p.title),i)),this.invites?.length){t.append(r("div",{class:"label"},p.inviteLinks));for(let{role:s,url:c}of this.invites)t.append(r("div",{class:"row",title:c},r("div",{class:"circle",html:k[s]}),r("div",{class:"who"},r("div",{class:"name"},p.linkTitles[s]),r("div",{class:"sub"},p.roleNotes[s])),this.copyButton(s,c)));t.append(r("div",{class:"hint"},p.guestInviteNote),r("div",{class:"rule"}))}t.append(r("div",{class:"foot"},r("div",{class:"note"},p.onlyAccess),this.copyButton("page",location.origin+location.pathname))),this.error&&t.append(r("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(t),this.position(),((e?t.querySelector(`[data-key="${e}"]`):null)??i).focus({preventScroll:!0})}copyButton(e,t){let i=this.copied===e,o=m(`pill${i?" done":""}`,{"data-key":`copy-${e}`},i?k.check:k.link,i?p.copied:p.copyLink),s=()=>_?this.paint():this.paintGuest();return o.addEventListener("click",async()=>{await G(t),this.copied=e,s(),setTimeout(()=>{this.copied===e&&(this.copied=null,!this.menu&&!this.asking&&s())},1600)}),o}};function xe(){let n=document.querySelector("[data-baoyu-share-seat]")??document.querySelector("[data-baoyu-comments]")?.shadowRoot?.querySelector("[data-baoyu-share-seat]");if(n)return["into",n,"header"];let e=document.querySelector('[data-testid="ldoc-comments-btn"]'),t=e?.closest(".ml-auto")??e?.parentElement?.parentElement;if(t)return["first",t,"header"];let i=document.querySelector("[data-baoyu-comments-seat]");if(i)return["before",i,"tool"];let o=document.querySelector("header.tb-root .tb-card-end");return o?["first",o,"bar"]:null}var pe=()=>new F().mount();document.readyState==="loading"?document.addEventListener("DOMContentLoaded",pe,{once:!0}):pe();