dsh-claude-design 2.9.0 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -1,4 +1,4 @@
1
- // dsh-claude-design 2.9.0: built from baoyu-design.
1
+ // dsh-claude-design 2.9.1: built from baoyu-design.
2
2
  window.__ModuleLoader__.load({
3
3
  id: "dsh-claude-design",
4
4
  factory: (require) => {
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // dsh-claude-design 2.9.0: built from baoyu-design.
1
+ // dsh-claude-design 2.9.1: built from baoyu-design.
2
2
  var define_PLUGIN_default = { name: "claude-design", provider: "dsh-claude-design", skills: [{ name: "claude-design", description: "Make and revise designs in the Design (canvas) artifact format (project/canvas.json plus one .dc.html Design Component file per artboard) as local files, then open them in a local canvas editor where the user can view the artboards side by side, retype copy and adjust tweaks. Use when the user asks for an editable canvas of artboards in this format, names claude-design or the Design (canvas) type, or wants to revise a folder that holds project/canvas.json. Not for a one-off HTML prototype or a design exploration outside this format.", comments: true }] };
3
3
 
4
4
  import { spawn as spawn2 } from "node:child_process";
@@ -625,7 +625,7 @@ function bashStdout(result) {
625
625
  return text || null;
626
626
  }
627
627
  function openedEditor(script, exec, result) {
628
- if (exec.name !== "bash" || exec.agent === void 0 || result.isError) return null;
628
+ if (exec.name !== "bash" && exec.name !== "pwsh" || exec.agent === void 0 || result.isError) return null;
629
629
  const args = exec.arguments;
630
630
  const command = args?.command;
631
631
  if (typeof command !== "string" || args?.run_in_background === true) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-claude-design",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "DeepSeek Harness plugin: the claude-design skill from baoyu-design. The agent writes canvases of artboards as files and opens them in a local canvas editor.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -2822,7 +2822,7 @@ async function writeZip(entries, write) {
2822
2822
  for (const entry of entries) {
2823
2823
  let data;
2824
2824
  try {
2825
- data = await fsp2.readFile(entry.file);
2825
+ data = entry.data ?? await fsp2.readFile(entry.file);
2826
2826
  } catch (error) {
2827
2827
  if (error.code === "ENOENT") continue;
2828
2828
  throw error;
@@ -85,11 +85,11 @@ h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 600; letter
85
85
  .toast p { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }
86
86
  .toast .path { margin-top: 4px; font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--fg); user-select: text; -webkit-user-select: text; overflow-wrap: anywhere; }
87
87
  .toast.err p { color: var(--danger); }
88
- `;function V(){if(/\bElectron\/\d/.test(navigator.userAgent))return!0;if(window.top===window)return!1;try{return window.top.location.origin!==location.origin}catch{return!0}}function F(t){let e=/filename\*=UTF-8''([^;]+)/i.exec(t??"");if(e)try{return decodeURIComponent(e[1])}catch{}return/filename="([^"]+)"/i.exec(t??"")?.[1]??""}async function q(t){let e=await t.json().catch(()=>null);if(!t.ok||!e||typeof e.path!="string")throw new Error(e?.message||`HTTP ${t.status}`);return e}var W=class{layer=o("div",{"data-baoyu-save-layer":""});wrap=o("div",{class:"wrap"});node=null;timer;constructor(){this.layer.attachShadow({mode:"open"}).append(o("style",{},E+Ce),this.wrap)}saved(e,n=N.hint){this.show([o("p",{},N.saved(e.name)),o("div",{class:"path"},e.shown),o("div",{class:"hint"},n)],!1)}failed(e){this.show([o("p",{},e)],!0)}show(e,n){this.layer.isConnected||document.body.append(this.layer),window.clearTimeout(this.timer),this.node?.remove();let i=o("div",{class:`toast${n?" err":""}`,role:n?"alert":"status","data-baoyu-save-toast":""},...e);this.wrap.append(i),this.node=i,this.timer=window.setTimeout(()=>{i.remove(),this.node===i&&(this.node=null)},n?1e4:12e3)}},He=null;function U(){return He??=new W}async function Ne(t,e){return q(await fetch(`${Oe}?name=${encodeURIComponent(e)}`,{method:"POST",body:t,headers:{"Content-Type":t.type||"application/octet-stream"}}))}function _e(t){for(let e of t.composedPath())if(e instanceof HTMLAnchorElement&&e.hasAttribute("download")&&e.href)return e;return null}function ze(t){try{let e=new URL(t.href,location.href);return e.protocol==="blob:"||e.protocol==="data:"||e.origin===location.origin}catch{return!1}}function ce(t){if(!V())return!1;let e=U(),n=async(a,c,u={})=>{try{let f=await Ne(a,c);return u.quiet||e.saved(f),f}catch(f){throw u.quiet||e.failed(N.failed(c,f instanceof Error?f.message:String(f))),f}},i=a=>{let c=a.getAttribute("download")??"",u=a.href,f=fetch(u,{cache:"no-store"});(async()=>{let h=c||"download",g;try{let m=await f;if(!m.ok)throw new Error(`HTTP ${m.status}`);h=c||F(m.headers.get("Content-Disposition"))||"download",g=await m.blob()}catch(m){return e.failed(N.failed(h,m instanceof Error?m.message:String(m)))}await n(g,h).catch(()=>{})})()},r=a=>a!==null&&(!t||ze(a)),s=a=>{t?i(a):e.failed(N.guest)};window.addEventListener("click",a=>{let c=_e(a);a.defaultPrevented||!r(c)||(a.preventDefault(),s(c))},!0);let p=HTMLAnchorElement.prototype.click;return HTMLAnchorElement.prototype.click=function(){if(!this.isConnected&&this.hasAttribute("download")&&this.href&&r(this))return s(this);p.call(this)},t&&(window.__baoyuSave=n),!0}var J="/__share/archive",je={label:"Whole folder (.zip)",description:"Everything here, to back up or move"},R=y?{started:t=>`\u5F00\u59CB\u4E0B\u8F7D ${t}`,hint:"\u6574\u4E2A\u6587\u4EF6\u5939\u6253\u6210\u4E86\u4E00\u4E2A zip\uFF0C\u53EF\u4EE5\u5907\u4EFD\u3001\u6362\u7535\u8111\u6216\u53D1\u7ED9\u522B\u4EBA\u3002\u89E3\u538B\u540E\u7528\u540C\u4E00\u4E2A skill \u6253\u5F00\u5C31\u80FD\u63A5\u7740\u7528\uFF1B\u5206\u4EAB\u94FE\u63A5\u548C\u8FD9\u53F0\u7535\u8111\u4E0A\u7684\u670D\u52A1\u5668\u72B6\u6001\u4E0D\u5728\u91CC\u9762\u3002",beside:"\u8FD9\u4E2A\u6D4F\u89C8\u5668\u4E0D\u80FD\u4E0B\u8F7D\u6587\u4EF6\uFF0Czip \u5B58\u5728\u4E86\u6587\u4EF6\u5939\u65C1\u8FB9\u3002\u89E3\u538B\u540E\u7528\u540C\u4E00\u4E2A skill \u6253\u5F00\u5C31\u80FD\u63A5\u7740\u7528\u3002",tooLarge:"\u6587\u4EF6\u5939\u8D85\u8FC7\u4E86 zip \u7684\u4E0A\u9650\uFF084 GiB \u6216 65535 \u4E2A\u6587\u4EF6\uFF09\uFF0C\u8BF7\u76F4\u63A5\u590D\u5236\u6587\u4EF6\u5939\u3002",failed:"\u6CA1\u80FD\u6253\u5305\uFF1A"}:{started:t=>`Downloading ${t}`,hint:"The whole folder in one zip, to back up, move to another computer or send to someone. Unzip it and open it with the same skill to carry on; share links and this computer's server state are left out.",beside:"This browser doesn't download files, so the zip went beside the folder. Unzip it and open it with the same skill to carry on.",tooLarge:"The folder is over what a zip holds (4 GiB or 65,535 files): copy the folder itself instead.",failed:"Could not zip the folder: "},Be=`
88
+ `;function V(){if(/\bElectron\/\d/.test(navigator.userAgent))return!0;if(window.top===window)return!1;try{return window.top.location.origin!==location.origin}catch{return!0}}function F(t){let e=/filename\*=UTF-8''([^;]+)/i.exec(t??"");if(e)try{return decodeURIComponent(e[1])}catch{}return/filename="([^"]+)"/i.exec(t??"")?.[1]??""}async function q(t){let e=await t.json().catch(()=>null);if(!t.ok||!e||typeof e.path!="string")throw new Error(e?.message||`HTTP ${t.status}`);return e}var Y=class{layer=o("div",{"data-baoyu-save-layer":""});wrap=o("div",{class:"wrap"});node=null;timer;constructor(){this.layer.attachShadow({mode:"open"}).append(o("style",{},E+Ce),this.wrap)}saved(e,n=N.hint){this.show([o("p",{},N.saved(e.name)),o("div",{class:"path"},e.shown),o("div",{class:"hint"},n)],!1)}failed(e){this.show([o("p",{},e)],!0)}show(e,n){this.layer.isConnected||document.body.append(this.layer),window.clearTimeout(this.timer),this.node?.remove();let i=o("div",{class:`toast${n?" err":""}`,role:n?"alert":"status","data-baoyu-save-toast":""},...e);this.wrap.append(i),this.node=i,this.timer=window.setTimeout(()=>{i.remove(),this.node===i&&(this.node=null)},n?1e4:12e3)}},He=null;function U(){return He??=new Y}async function Ne(t,e){return q(await fetch(`${Oe}?name=${encodeURIComponent(e)}`,{method:"POST",body:t,headers:{"Content-Type":t.type||"application/octet-stream"}}))}function _e(t){for(let e of t.composedPath())if(e instanceof HTMLAnchorElement&&e.hasAttribute("download")&&e.href)return e;return null}function ze(t){try{let e=new URL(t.href,location.href);return e.protocol==="blob:"||e.protocol==="data:"||e.origin===location.origin}catch{return!1}}function ce(t){if(!V())return!1;let e=U(),n=async(a,c,u={})=>{try{let f=await Ne(a,c);return u.quiet||e.saved(f),f}catch(f){throw u.quiet||e.failed(N.failed(c,f instanceof Error?f.message:String(f))),f}},i=a=>{let c=a.getAttribute("download")??"",u=a.href,f=fetch(u,{cache:"no-store"});(async()=>{let h=c||"download",g;try{let m=await f;if(!m.ok)throw new Error(`HTTP ${m.status}`);h=c||F(m.headers.get("Content-Disposition"))||"download",g=await m.blob()}catch(m){return e.failed(N.failed(h,m instanceof Error?m.message:String(m)))}await n(g,h).catch(()=>{})})()},r=a=>a!==null&&(!t||ze(a)),s=a=>{t?i(a):e.failed(N.guest)};window.addEventListener("click",a=>{let c=_e(a);a.defaultPrevented||!r(c)||(a.preventDefault(),s(c))},!0);let p=HTMLAnchorElement.prototype.click;return HTMLAnchorElement.prototype.click=function(){if(!this.isConnected&&this.hasAttribute("download")&&this.href&&r(this))return s(this);p.call(this)},t&&(window.__baoyuSave=n),!0}var J="/__share/archive",je={label:"Whole folder (.zip)",description:"Everything here, to back up or move"},R=y?{started:t=>`\u5F00\u59CB\u4E0B\u8F7D ${t}`,hint:"\u6574\u4E2A\u6587\u4EF6\u5939\u6253\u6210\u4E86\u4E00\u4E2A zip\uFF0C\u53EF\u4EE5\u5907\u4EFD\u3001\u6362\u7535\u8111\u6216\u53D1\u7ED9\u522B\u4EBA\u3002\u89E3\u538B\u540E\u7528\u540C\u4E00\u4E2A skill \u6253\u5F00\u5C31\u80FD\u63A5\u7740\u7528\uFF1B\u5206\u4EAB\u94FE\u63A5\u548C\u8FD9\u53F0\u7535\u8111\u4E0A\u7684\u670D\u52A1\u5668\u72B6\u6001\u4E0D\u5728\u91CC\u9762\u3002",beside:"\u8FD9\u4E2A\u6D4F\u89C8\u5668\u4E0D\u80FD\u4E0B\u8F7D\u6587\u4EF6\uFF0Czip \u5B58\u5728\u4E86\u6587\u4EF6\u5939\u65C1\u8FB9\u3002\u89E3\u538B\u540E\u7528\u540C\u4E00\u4E2A skill \u6253\u5F00\u5C31\u80FD\u63A5\u7740\u7528\u3002",tooLarge:"\u6587\u4EF6\u5939\u8D85\u8FC7\u4E86 zip \u7684\u4E0A\u9650\uFF084 GiB \u6216 65535 \u4E2A\u6587\u4EF6\uFF09\uFF0C\u8BF7\u76F4\u63A5\u590D\u5236\u6587\u4EF6\u5939\u3002",failed:"\u6CA1\u80FD\u6253\u5305\uFF1A"}:{started:t=>`Downloading ${t}`,hint:"The whole folder in one zip, to back up, move to another computer or send to someone. Unzip it and open it with the same skill to carry on; share links and this computer's server state are left out.",beside:"This browser doesn't download files, so the zip went beside the folder. Unzip it and open it with the same skill to carry on.",tooLarge:"The folder is over what a zip holds (4 GiB or 65,535 files): copy the folder itself instead.",failed:"Could not zip the folder: "},Be=`
89
89
  .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; }
90
90
  .toast p { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }
91
91
  .toast.err p { color: var(--danger); }
92
- `,K=o("div",{"data-baoyu-archive-layer":""}),Ie=K.attachShadow({mode:"open"}),ue=o("div",{class:"wrap"});Ie.append(o("style",{},E+Be),ue);var D=null,pe,G=!1;function he(t,e,n=!1){window.clearTimeout(pe),D?.remove();let i=o("div",{class:`toast${n?" err":""}`,role:"status"},o("p",{},t));e&&i.append(o("div",{class:"hint"},e)),ue.append(i),K.isConnected||document.body.append(K),D=i,pe=window.setTimeout(()=>{i.remove(),D===i&&(D=null)},n?8e3:6e3)}async function De(){if(!G){G=!0;try{if(V()){let n=await q(await fetch(J,{method:"POST"}));U().saved(n,R.beside);return}let t=await fetch(J,{method:"HEAD",cache:"no-store"});if(!t.ok)throw new Error(t.status===413?R.tooLarge:`${R.failed}HTTP ${t.status}`);let e=o("a",{href:J,download:"",style:"display:none"});document.body.append(e),e.click(),e.remove(),he(R.started(F(t.headers.get("Content-Disposition"))||"folder.zip"),R.hint)}catch(t){let e=t instanceof Error?t.message:String(t);he(e.startsWith(R.failed)||e===R.tooLarge?e:`${R.failed}${e}`,"",!0)}finally{G=!1}}}function ge(t){let e=window;t&&!e.__baoyuHistory?.preview&&(e.__baoyuArchive={...je,download:De})}var $={html:b('<path d="M5.5 4.5 2 8l3.5 3.5M10.5 4.5 14 8l-3.5 3.5"/>',18),pdf:'<svg viewBox="0 0 22 22" width="22" height="22" aria-hidden="true"><rect width="22" height="22" rx="5" fill="#e0342b"/><text x="11" y="14.6" text-anchor="middle" font-size="8" font-weight="700" font-family="ui-sans-serif, system-ui, sans-serif" fill="#fff">PDF</text></svg>',image:b('<rect x="2.2" y="2.8" width="11.6" height="10.4" rx="1.8"/><circle cx="5.7" cy="6.2" r="1.1"/><path d="m2.6 11.6 3.2-3 2.4 2.2 2-1.8 3.2 3"/>',18),slides:b('<rect x="2" y="2.8" width="12" height="8" rx="1.2"/><path d="M8 10.8v2.6M5.6 13.4h4.8"/>',18),video:b('<rect x="2" y="3.4" width="12" height="9.2" rx="1.8"/><path d="m6.7 6 3.2 2-3.2 2z"/>',18),text:b('<path d="M4 1.9h5.2L12.4 5v9.1H4z"/><path d="M9 2v3.2h3.3M6 8.2h4.4M6 10.8h4.4"/>',18),folder:b('<path d="M2 4.6c0-.7.5-1.2 1.2-1.2h2.9l1.4 1.5h5.3c.7 0 1.2.5 1.2 1.2v6.1c0 .7-.5 1.2-1.2 1.2H3.2c-.7 0-1.2-.5-1.2-1.2z"/>',18),file:b('<path d="M4 1.9h5.2L12.4 5v9.1H4z"/><path d="M9 2v3.2h3.3"/>',18),download:b('<path d="M8 2.6v7.5M4.9 7.2 8 10.3l3.1-3.1M2.8 13.2h10.4"/>',18),chevron:b('<path d="M6 3.5 10.5 8 6 12.5"/>',16)};function Ye(t){return/folder/i.test(t)?$.folder:/pdf/i.test(t)?$.pdf:/powerpoint|pptx/i.test(t)?$.slides:/png|image/i.test(t)?$.image:/html|web page/i.test(t)?$.html:/video|gif/i.test(t)?$.video:/markdown/i.test(t)?$.text:$.file}var fe=`
92
+ `,K=o("div",{"data-baoyu-archive-layer":""}),Ie=K.attachShadow({mode:"open"}),ue=o("div",{class:"wrap"});Ie.append(o("style",{},E+Be),ue);var D=null,pe,G=!1;function he(t,e,n=!1){window.clearTimeout(pe),D?.remove();let i=o("div",{class:`toast${n?" err":""}`,role:"status"},o("p",{},t));e&&i.append(o("div",{class:"hint"},e)),ue.append(i),K.isConnected||document.body.append(K),D=i,pe=window.setTimeout(()=>{i.remove(),D===i&&(D=null)},n?8e3:6e3)}async function De(){if(!G){G=!0;try{if(V()){let n=await q(await fetch(J,{method:"POST"}));U().saved(n,R.beside);return}let t=await fetch(J,{method:"HEAD",cache:"no-store"});if(!t.ok)throw new Error(t.status===413?R.tooLarge:`${R.failed}HTTP ${t.status}`);let e=o("a",{href:J,download:"",style:"display:none"});document.body.append(e),e.click(),e.remove(),he(R.started(F(t.headers.get("Content-Disposition"))||"folder.zip"),R.hint)}catch(t){let e=t instanceof Error?t.message:String(t);he(e.startsWith(R.failed)||e===R.tooLarge?e:`${R.failed}${e}`,"",!0)}finally{G=!1}}}function ge(t){let e=window;t&&!e.__baoyuHistory?.preview&&(e.__baoyuArchive={...je,download:De})}var $={html:b('<path d="M5.5 4.5 2 8l3.5 3.5M10.5 4.5 14 8l-3.5 3.5"/>',18),pdf:'<svg viewBox="0 0 22 22" width="22" height="22" aria-hidden="true"><rect width="22" height="22" rx="5" fill="#e0342b"/><text x="11" y="14.6" text-anchor="middle" font-size="8" font-weight="700" font-family="ui-sans-serif, system-ui, sans-serif" fill="#fff">PDF</text></svg>',word:'<svg viewBox="0 0 22 22" width="22" height="22" aria-hidden="true"><rect width="22" height="22" rx="5" fill="#2b579a"/><text x="11" y="15.4" text-anchor="middle" font-size="11" font-weight="700" font-family="ui-sans-serif, system-ui, sans-serif" fill="#fff">W</text></svg>',image:b('<rect x="2.2" y="2.8" width="11.6" height="10.4" rx="1.8"/><circle cx="5.7" cy="6.2" r="1.1"/><path d="m2.6 11.6 3.2-3 2.4 2.2 2-1.8 3.2 3"/>',18),slides:b('<rect x="2" y="2.8" width="12" height="8" rx="1.2"/><path d="M8 10.8v2.6M5.6 13.4h4.8"/>',18),video:b('<rect x="2" y="3.4" width="12" height="9.2" rx="1.8"/><path d="m6.7 6 3.2 2-3.2 2z"/>',18),text:b('<path d="M4 1.9h5.2L12.4 5v9.1H4z"/><path d="M9 2v3.2h3.3M6 8.2h4.4M6 10.8h4.4"/>',18),folder:b('<path d="M2 4.6c0-.7.5-1.2 1.2-1.2h2.9l1.4 1.5h5.3c.7 0 1.2.5 1.2 1.2v6.1c0 .7-.5 1.2-1.2 1.2H3.2c-.7 0-1.2-.5-1.2-1.2z"/>',18),file:b('<path d="M4 1.9h5.2L12.4 5v9.1H4z"/><path d="M9 2v3.2h3.3"/>',18),download:b('<path d="M8 2.6v7.5M4.9 7.2 8 10.3l3.1-3.1M2.8 13.2h10.4"/>',18),chevron:b('<path d="M6 3.5 10.5 8 6 12.5"/>',16)};function We(t){return/folder/i.test(t)?$.folder:/pdf/i.test(t)?$.pdf:/word|docx/i.test(t)?$.word:/powerpoint|pptx/i.test(t)?$.slides:/png|image/i.test(t)?$.image:/html|web page/i.test(t)?$.html:/video|gif/i.test(t)?$.video:/markdown/i.test(t)?$.text:$.file}var fe=`
93
93
  .tabs { display: flex; gap: 2px; padding: 2px; margin-top: 10px; background: var(--soft); border-radius: 10px; }
94
94
  .tab { flex: 1; height: 28px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-weight: 500; font-size: 13.5px; }
95
95
  .tab[aria-selected="true"] { background: var(--bg); border-color: var(--line); }
@@ -110,14 +110,14 @@ h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 600; letter
110
110
  .format .sub { white-space: normal; }
111
111
  .tile { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; }
112
112
  .format > svg { color: var(--muted); }
113
- `;function X(){let t=window,e=t.__baoyuArchive;return[...t.__baoyuExports?.()??[],...e?[{label:e.label,description:e.description,run:()=>void e.download()}]:[]]}function me(t,e){let n=o("div",{class:"formats"});for(let i of t){let r=o("button",{class:"format",type:"button","data-baoyu-export-item":"","data-key":`format-${i.label}`},o("span",{class:"tile",html:Ye(i.label)}),o("span",{class:"who"},o("span",{class:"name"},i.label),...i.description?[o("span",{class:"sub"},i.description)]:[]));r.insertAdjacentHTML("beforeend",i.more?$.chevron:$.download),r.disabled=i.disabled===!0,i.disabled&&i.disabledReason&&(r.title=i.disabledReason),r.addEventListener("click",()=>e(i)),n.append(r)}return n}var l=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:t=>`\u6062\u590D\u81EA ${t} \u7684\u7248\u672C`,restoredPart:t=>`\u90E8\u5206\u6062\u590D\u81EA ${t} \u7684\u7248\u672C`,overwrote:t=>`\u8986\u76D6\u4E86 ${t} \u7684\u4FEE\u6539`,replaced:t=>`\u6362\u6389\u4E86 ${t} \u521A\u8BBE\u7684\u5185\u5BB9`,ops:{added:"\u65B0\u589E",edited:"\u4FEE\u6539",deleted:"\u5220\u9664"},more:t=>`\u7B49 ${t} \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:t=>`\u6240\u6709\u5185\u5BB9\u56DE\u5230 ${t} \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:(t,e)=>`\u300C${t}\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:t=>`\u2026 ${t} \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:(t,e,n)=>`${t} \u4FDD\u5B58\u300C${e}\u300D\u65F6\uFF0C\u8986\u76D6\u4E86\u4F60 ${n} \u7684\u4FEE\u6539\u3002`,overwroteYou:(t,e,n)=>`\u4F60\u4FDD\u5B58\u300C${e}\u300D\u65F6\uFF0C\u8986\u76D6\u4E86 ${t} ${n} \u7684\u4FEE\u6539\u3002`,softOver:(t,e,n)=>`${t} \u7D27\u63A5\u7740\u4E5F\u6539\u4E86\u300C${e}\u300D\uFF0C\u6362\u6389\u4E86\u4F60 ${n} \u8BBE\u7684\u5185\u5BB9\u3002`,deletedBack:(t,e,n)=>`\u4F60 ${n} \u5220\u6389\u4E86\u300C${e}\u300D\uFF0C${t} \u53C8\u6539\u4E86\u5B83\uFF0C\u5B83\u56DE\u6765\u4E86\u3002`,removedOver:(t,e,n)=>`${t} \u5220\u6389\u4E86\u300C${e}\u300D\uFF0C\u4F60 ${n} \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:(t,e)=>`\u300C${t}\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:(t,e)=>`\u300C${t}\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:t=>`\u300C${t}\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:t=>` ${t} `,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:(t,e)=>`\u6B63\u5728\u770B ${t} \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:t=>`Restored from ${t}`,restoredPart:t=>`Partly restored from ${t}`,overwrote:t=>`Saved over ${t}'s change`,replaced:t=>`Replaced what ${t} had just set`,ops:{added:"Added",edited:"Edited",deleted:"Deleted"},more:t=>`+${t} more`,changes:"Changes",preview:"Preview",restore:"Restore this version",restoreTitle:"Restore this version?",restoreText:t=>`Everything goes back to how it was at ${t}. What is there now stays in the history as a version you can restore.`,restoreOne:"Restore just this",restoreOneTitle:"Restore just this part?",restoreOneText:(t,e)=>`\u201C${t}\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:t=>`\u2026 ${t} unchanged lines`,truncated:"There are more changes than shown here.",noChange:"No changes to the content.",needsLook:"Needs a look",overwritten:(t,e,n)=>`${t} saved \u201C${e}\u201D over your change from ${n}.`,overwroteYou:(t,e,n)=>`You saved \u201C${e}\u201D over ${t}\u2019s change from ${n}.`,softOver:(t,e,n)=>`${t} changed \u201C${e}\u201D right after you and replaced what you set at ${n}.`,deletedBack:(t,e,n)=>`You deleted \u201C${e}\u201D at ${n}; ${t} changed it, so it is back.`,removedOver:(t,e,n)=>`${t} deleted \u201C${e}\u201D, and your change from ${n} with it.`,compare:"Compare",bringBack:"Bring back",bringBackTitle:"Bring back what was saved over?",bringBackText:(t,e)=>`\u201C${t}\u201D goes back to ${e} content from before it was saved over. What is there now stays in the history.`,bringBackPart:(t,e)=>`What was replaced in \u201C${t}\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:t=>`\u201C${t}\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:t=>`${t}\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:(t,e)=>`Viewing the version from ${t} \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: "},P={history:b('<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:b('<path d="M4 4l8 8M12 4l-8 8"/>',18),back:b('<path d="M9.8 3.6 5.4 8l4.4 4.4"/>',18),robot:b(I,16),flag:b('<path d="M4 13.8V2.6M4 3h7.2l-1.6 2.6L11.2 8.2H4"/>',15)},ve=`
113
+ `;function X(){let t=window,e=t.__baoyuArchive;return[...t.__baoyuExports?.()??[],...e?[{label:e.label,description:e.description,run:()=>void e.download()}]:[]]}function me(t,e){let n=o("div",{class:"formats"});for(let i of t){let r=o("button",{class:"format",type:"button","data-baoyu-export-item":"","data-key":`format-${i.label}`},o("span",{class:"tile",html:We(i.label)}),o("span",{class:"who"},o("span",{class:"name"},i.label),...i.description?[o("span",{class:"sub"},i.description)]:[]));r.insertAdjacentHTML("beforeend",i.more?$.chevron:$.download),r.disabled=i.disabled===!0,i.disabled&&i.disabledReason&&(r.title=i.disabledReason),r.addEventListener("click",()=>e(i)),n.append(r)}return n}var l=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:t=>`\u6062\u590D\u81EA ${t} \u7684\u7248\u672C`,restoredPart:t=>`\u90E8\u5206\u6062\u590D\u81EA ${t} \u7684\u7248\u672C`,overwrote:t=>`\u8986\u76D6\u4E86 ${t} \u7684\u4FEE\u6539`,replaced:t=>`\u6362\u6389\u4E86 ${t} \u521A\u8BBE\u7684\u5185\u5BB9`,ops:{added:"\u65B0\u589E",edited:"\u4FEE\u6539",deleted:"\u5220\u9664"},more:t=>`\u7B49 ${t} \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:t=>`\u6240\u6709\u5185\u5BB9\u56DE\u5230 ${t} \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:(t,e)=>`\u300C${t}\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:t=>`\u2026 ${t} \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:(t,e,n)=>`${t} \u4FDD\u5B58\u300C${e}\u300D\u65F6\uFF0C\u8986\u76D6\u4E86\u4F60 ${n} \u7684\u4FEE\u6539\u3002`,overwroteYou:(t,e,n)=>`\u4F60\u4FDD\u5B58\u300C${e}\u300D\u65F6\uFF0C\u8986\u76D6\u4E86 ${t} ${n} \u7684\u4FEE\u6539\u3002`,softOver:(t,e,n)=>`${t} \u7D27\u63A5\u7740\u4E5F\u6539\u4E86\u300C${e}\u300D\uFF0C\u6362\u6389\u4E86\u4F60 ${n} \u8BBE\u7684\u5185\u5BB9\u3002`,deletedBack:(t,e,n)=>`\u4F60 ${n} \u5220\u6389\u4E86\u300C${e}\u300D\uFF0C${t} \u53C8\u6539\u4E86\u5B83\uFF0C\u5B83\u56DE\u6765\u4E86\u3002`,removedOver:(t,e,n)=>`${t} \u5220\u6389\u4E86\u300C${e}\u300D\uFF0C\u4F60 ${n} \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:(t,e)=>`\u300C${t}\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:(t,e)=>`\u300C${t}\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:t=>`\u300C${t}\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:t=>` ${t} `,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:(t,e)=>`\u6B63\u5728\u770B ${t} \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:t=>`Restored from ${t}`,restoredPart:t=>`Partly restored from ${t}`,overwrote:t=>`Saved over ${t}'s change`,replaced:t=>`Replaced what ${t} had just set`,ops:{added:"Added",edited:"Edited",deleted:"Deleted"},more:t=>`+${t} more`,changes:"Changes",preview:"Preview",restore:"Restore this version",restoreTitle:"Restore this version?",restoreText:t=>`Everything goes back to how it was at ${t}. What is there now stays in the history as a version you can restore.`,restoreOne:"Restore just this",restoreOneTitle:"Restore just this part?",restoreOneText:(t,e)=>`\u201C${t}\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:t=>`\u2026 ${t} unchanged lines`,truncated:"There are more changes than shown here.",noChange:"No changes to the content.",needsLook:"Needs a look",overwritten:(t,e,n)=>`${t} saved \u201C${e}\u201D over your change from ${n}.`,overwroteYou:(t,e,n)=>`You saved \u201C${e}\u201D over ${t}\u2019s change from ${n}.`,softOver:(t,e,n)=>`${t} changed \u201C${e}\u201D right after you and replaced what you set at ${n}.`,deletedBack:(t,e,n)=>`You deleted \u201C${e}\u201D at ${n}; ${t} changed it, so it is back.`,removedOver:(t,e,n)=>`${t} deleted \u201C${e}\u201D, and your change from ${n} with it.`,compare:"Compare",bringBack:"Bring back",bringBackTitle:"Bring back what was saved over?",bringBackText:(t,e)=>`\u201C${t}\u201D goes back to ${e} content from before it was saved over. What is there now stays in the history.`,bringBackPart:(t,e)=>`What was replaced in \u201C${t}\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:t=>`\u201C${t}\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:t=>`${t}\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:(t,e)=>`Viewing the version from ${t} \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: "},P={history:b('<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:b('<path d="M4 4l8 8M12 4l-8 8"/>',18),back:b('<path d="M9.8 3.6 5.4 8l4.4 4.4"/>',18),robot:b(I,16),flag:b('<path d="M4 13.8V2.6M4 3h7.2l-1.6 2.6L11.2 8.2H4"/>',15)},ve=`
114
114
  .wrap.seat { display: inline-flex; align-items: center; gap: 2px; }
115
115
  .open.only { padding: 0; width: 28px; justify-content: center; }
116
116
  .open.bar.only { width: 24px; }
117
117
  .open.float.only { width: 32px; }
118
118
  .open.only .dot { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; }
119
119
  .open.tool.only .dot { top: 2px; right: 2px; width: 5px; height: 5px; }
120
- `,We=`
120
+ `,Ye=`
121
121
  .ver { display: flex; gap: 12px; margin: 0 -10px; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
122
122
  .ver:hover, .ver.opened { background: var(--soft); }
123
123
  .ver .who { display: flex; flex-direction: column; gap: 2px; }
@@ -178,7 +178,7 @@ h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 600; letter
178
178
  .banner .btn:hover { background: color-mix(in srgb, var(--bg) 26%, transparent); }
179
179
  .banner .btn.primary { background: var(--bg); color: var(--fg); }
180
180
  @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%; } }
181
- `,T=t=>y?t.zh:t.en;function Q(t){let e=new Date(t),n=new Date,i=s=>new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),r=Math.round((i(n)-i(e))/864e5);return r===0?l.today:r===1?l.yesterday:e.toLocaleDateString(y?"zh-CN":"en",{month:"short",day:"numeric",...e.getFullYear()===n.getFullYear()?{}:{year:"numeric"}})}var O=t=>new Date(t).toLocaleTimeString(y?"zh-CN":"en",{hour:"2-digit",minute:"2-digit"}),A=t=>`${Q(t)} ${O(t)}`,Ve=t=>O(t.first)===O(t.at)?O(t.at):`${O(t.first)}\u2013${O(t.at)}`;async function _(t,e){let n=await fetch(t,e===void 0?{cache:"no-store"}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),i=await n.json().catch(()=>null);if(!n.ok){let r=i;throw Object.assign(new Error(r?.message??`HTTP ${n.status}`),{code:r?.code})}return i}var Z=class{button=o("button",{class:"open float only",type:"button","aria-haspopup":"dialog","aria-expanded":"false","aria-label":l.title,title:l.title});boot;look="float";layer=o("div",{"data-baoyu-history-layer":""});layerRoot=this.layer.attachShadow({mode:"open"});layerWrap=o("div",{class:"wrap"});pop=null;caret=o("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(o("style",{},E+We),this.layerWrap),this.button.insertAdjacentHTML("beforeend",P.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=o("div",{class:"pop",role:"dialog","aria-label":l.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,n=window.innerHeight,i=this.button.getBoundingClientRect(),r=i.width>0&&i.bottom>0&&i.top<n,s=Math.min(480,e-24),p=r?i.right:e-16,a=Math.max(12,Math.min(p-s,e-s-12)),c=r?i.bottom+10:56;if(Object.assign(this.pop.style,{left:`${a}px`,top:`${c}px`,width:`${s}px`,maxHeight:`${Math.max(240,n-c-12)}px`}),r){let u=Math.max(a+18,Math.min(i.left+i.width/2-7,a+s-32));Object.assign(this.caret.style,{display:"",left:`${u}px`,top:`${c-7}px`})}else this.caret.style.display="none"};onPointer=e=>{let n=e.composedPath();!this.pop||n.includes(this.pop)||n.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 _(`${this.boot.base}__history`),this.error=""}catch(n){this.error=l.failed+n.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(o("span",{class:"dot",style:"background:#d97706"}))}go(e){this.screen=e,this.diff=null,this.paint(),e.kind==="diff"&&_(e.url).then(n=>{this.screen===e&&(this.diff=n,this.paint())},n=>{this.screen===e&&(this.error=l.failed+n.message,this.paint())})}async act(e,n,i){this.busy=!0;try{return await _(e,n),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(r){return r.code==="changed"&&this.screen.kind==="diff"?(this.error="",this.go({...this.screen,note:l.changedSince}),!1):(this.error=l.failed+r.message,this.paint(),!1)}finally{this.busy=!1}}restore(e,n){let i=A(e.at),r=n?e.files.find(s=>s.path===n):void 0;this.ask(r?l.restoreOneTitle:l.restoreTitle,r?l.restoreOneText(T(r.label),i):l.restoreText(i),l.restoreGo).then(s=>s&&this.act(`${this.boot.base}__history/${e.n}/restore`,n?{paths:[n]}:{},l.done.restored))}bringBack(e){let n=e.kind==="overwritten"?l.yours:l.theirs(e.lostBy==="agent"?l.claude:e.lostName),i=e.part?l.bringBackPart:l.bringBackText,r=this.screen.kind==="diff"&&this.screen.notice?.id===e.id&&this.diff&&"now"in this.diff?{now:this.diff.now}:{},s=p=>a=>a&&this.act(`${this.boot.base}__history/notice/${e.id}/recover`,r,p);e.deleted?this.ask(l.deleteAgainTitle,l.deleteAgainText(T(e.label)),l.deleteAgain).then(s(l.done.deleted)):this.ask(l.bringBackTitle,i(T(e.label),n),l.bringBack).then(s(l.done.brought))}async dismiss(e){try{let{notices:n}=await _(`${this.boot.base}__history/notices`,{dismiss:e.id});this.data&&(this.data.notices=n),this.mark(n.length)}catch(n){this.error=l.failed+n.message}this.screen.kind==="diff"&&(this.screen={kind:"list"}),this.paint()}ask(e,n,i){return new Promise(r=>{if(!this.pop)return r(!1);let s=o("div",{class:"ask",role:"alertdialog","aria-modal":"true","aria-label":e}),p=v("btn",{},"",l.cancel),a=v("btn primary",{},"",i),c=u=>{this.asking=null,s.remove(),r(u)};p.addEventListener("click",()=>c(!1)),a.addEventListener("click",()=>c(!0)),s.addEventListener("mousedown",u=>u.target===s&&c(!1)),s.append(o("div",{class:"ask-card"},o("h3",{},e),o("p",{},n),o("div",{class:"ask-row"},p,a))),this.asking=()=>c(!1),this.pop.append(s),a.focus()})}paint(){if(!this.pop)return;let e=this.pop.querySelector(".body")?.scrollTop??0,n=o("div",{class:"body"});this.screen.kind==="diff"?this.paintDiff(n,this.screen):this.paintList(n),this.error&&n.append(o("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(n),this.screen.kind==="list"&&(n.scrollTop=e),this.position()}paintList(e){let n=v("icon muted",{"aria-label":l.close,title:l.close},P.close);n.addEventListener("click",()=>this.close()),e.append(o("div",{class:"head"},o("h2",{},l.title),n));let i=this.data;if(!i){e.append(o("div",{class:"empty"},l.loading));return}if(i.notices.length){e.append(o("div",{class:"label"},l.needsLook));for(let s of i.notices)e.append(this.noticeCard(s,i.canRestore))}i.rows.length||e.append(o("div",{class:"empty"},l.empty));let r="";for(let s of i.rows){let p=Q(s.at);p!==r&&(r=p,e.append(o("div",{class:"label"},p))),e.append(this.versionRow(s,i))}e.append(o("div",{class:"note"},i.canRestore?l.namesNote:`${l.viewOnly} ${l.namesNote}`))}who(e,n){if(e.by==="agent")return{name:l.claude,avatar:o("div",{class:"avatar small agent",html:P.robot})};if(e.by==="system")return{name:l.start,avatar:o("div",{class:"avatar small start",html:P.flag})};let i=e.userId===n;return{name:`${e.name}${i?l.you:""}`,avatar:o("div",{class:"avatar small",style:`background:${H(e.userId??e.name)}`},S(e.name))}}versionRow(e,n){let{name:i,avatar:r}=this.who(e,n.me),s=this.opened.has(e.n),p=e.files.map(g=>e.by==="system"||g.op==="edited"?T(g.label):`${l.ops[g.op]} ${T(g.label)}`),a=e.by==="system"&&!s?l.startSub:p.length>3?`${p.slice(0,3).join(y?"\u3001":", ")} ${l.more(p.length-3)}`:p.join(y?"\u3001":", "),c=o("div",{class:"badges"});if(e.current&&c.append(o("span",{class:"badge cur"},l.current)),e.restoredFrom!==void 0){let g=n.rows.find(L=>L.n===e.restoredFrom),m=g?A(g.at):`#${e.restoredFrom}`;c.append(o("span",{class:"badge"},e.restoredPart?l.restoredPart(m):l.restoredFrom(m)))}for(let g of e.overwrote??[])c.append(o("span",{class:"badge warn",title:T(g.label)},g.soft?l.replaced(g.by==="agent"?l.claude:g.name):l.overwrote(g.by==="agent"?l.claude:g.name)));let u=o("div",{class:"who"},o("div",{class:"top"},o("span",{class:"name"},i),o("span",{class:"when"},Ve(e))),...s?[]:[o("div",{class:"sub"},e.by==="agent"&&!p.length?l.claudeSub:a)],...c.childElementCount?[c]:[]),f=o("div",{class:`ver${s?" opened":""}`,role:"button",tabindex:"0","aria-expanded":String(s)},r,u),h=g=>{g.target.closest("button")||(s?this.opened.delete(e.n):this.opened.add(e.n),this.paint())};if(f.addEventListener("click",h),f.addEventListener("keydown",g=>(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),h(g))),s){let g=o("div",{class:"files"});for(let k of e.files){let se=v("link",{},"",l.changes);se.addEventListener("click",()=>this.go({kind:"diff",url:`${this.boot.base}__history/${e.n}/diff?path=${encodeURIComponent(k.path)}`,title:T(k.label),sub:`${i} \xB7 ${A(e.at)}`,...n.canRestore&&!e.current?{restore:{n:e.n,path:k.path,when:A(e.at)}}:{}})),g.append(o("div",{class:"file"},o("span",{class:`op ${k.op}`},l.ops[k.op]),o("span",{class:"fname",title:T(k.label)},T(k.label)),se))}u.append(g);let m=o("div",{class:"actions"}),L=v("btn small",{},"",l.preview);if(L.addEventListener("click",()=>window.open(e.preview,"_blank","noopener")),m.append(L),n.canRestore&&!e.current){let k=v("btn small primary",{},"",l.restore);k.addEventListener("click",()=>this.restore(e)),m.append(k)}u.append(m)}return f}noticeText(e){let n=e.lostAt??e.at,i=Q(n)===l.today?O(n):A(n);if(e.kind==="overwrote")return l.overwroteYou(e.lostBy==="agent"?l.claude:e.lostName,T(e.label),i);let r=e.by==="agent"?l.claude:e.name;return e.deleted?l.deletedBack(r,T(e.label),i):e.removed?l.removedOver(r,T(e.label),i):e.soft?l.softOver(r,T(e.label),i):l.overwritten(r,T(e.label),i)}noticeScreen(e){return{kind:"diff",url:`${this.boot.base}__history/notice/${e.id}/diff`,title:T(e.label),sub:this.noticeText(e),legend:e.deleted?l.deleteLegend:l.legend,notice:e}}noticeCard(e,n){let i=v("btn small",{},"",l.compare);i.addEventListener("click",()=>this.go(this.noticeScreen(e)));let r=v("btn small",{},"",l.dismiss);r.addEventListener("click",()=>void this.dismiss(e));let s=o("div",{class:"actions"},i);if(n){let p=v("btn small primary",{},"",e.deleted?l.deleteAgain:l.bringBack);p.addEventListener("click",()=>this.bringBack(e)),s.append(p)}return s.append(r),o("div",{class:"notice"},o("p",{},this.noticeText(e)),o("span",{class:"when"},A(e.at)),s)}paintDiff(e,n){let i=v("icon muted",{"aria-label":l.back,title:l.back},P.back);i.addEventListener("click",()=>this.go({kind:"list"}));let r=v("icon muted",{"aria-label":l.close,title:l.close},P.close);r.addEventListener("click",()=>this.close());let s=this.diff,p=s&&!s.binary&&!s.tooLarge&&!s.missing?o("span",{class:"tally"},o("span",{class:"a"},`+${s.added}`),o("span",{class:"r"},`\u2212${s.removed}`)):null;e.append(o("div",{class:"dhead"},i,o("h2",{},n.title),...p?[p]:[],r)),e.append(o("div",{class:"sub multi"},n.sub)),n.legend&&e.append(o("div",{class:"hint"},n.legend)),n.note&&e.append(o("div",{class:"hint note"},n.note));let a=o("div",{class:"actions"});if(n.restore){let f=n.restore,h=v("btn small primary",{},"",l.restoreOne);h.addEventListener("click",()=>{let g=this.data?.rows.find(m=>m.n===f.n);g&&this.restore(g,f.path)}),a.append(h)}if(n.notice){let f=n.notice;if(this.data?.canRestore){let g=v("btn small primary",{},"",f.deleted?l.deleteAgain:l.bringBack);g.addEventListener("click",()=>this.bringBack(f)),a.append(g)}let h=v("btn small",{},"",l.dismiss);h.addEventListener("click",()=>void this.dismiss(f)),a.append(h)}if(a.childElementCount&&e.append(a),!s){e.append(o("div",{class:"empty"},l.loading));return}if(s.missing||s.binary||s.tooLarge){e.append(o("div",{class:"empty"},s.missing?l.missing:s.binary?l.binary:l.tooLarge));return}if(!s.lines.some(([f])=>f==="+"||f==="-")){e.append(o("div",{class:"empty"},l.noChange));return}let c=o("div",{class:"diff"}),u=Fe(s.lines);s.lines.forEach(([f,h],g)=>{if(f==="~"){c.append(o("div",{class:"dl skip"},l.skipped(h)));return}let m=u.get(g),L=m?o("span",{},h.slice(0,m[0]),o("mark",{},h.slice(m[0],m[1])),h.slice(m[1])):o("span",{},h||" ");c.append(o("div",{class:`dl${f==="+"?" add":f==="-"?" del":""}`},o("span",{class:"k"},f===" "?"":f==="-"?"\u2212":"+"),L))}),s.truncated&&c.append(o("div",{class:"dl skip"},l.truncated)),e.append(c)}watchNotices(){let e=async()=>{if(!document.hidden)try{let{notices:n}=await _(`${this.boot.base}__history/notices`);if(this.mark(n.length),this.pop)return;let i=n.find(r=>!this.toasted.has(r.id));for(let r of n)this.toasted.add(r.id);i&&this.noticeToast(i)}catch{}};e(),window.setInterval(()=>void e(),5e3)}noticeToast(e){this.hideToast();let n=v("btn small primary",{},"",l.compare);n.addEventListener("click",()=>{this.hideToast(),this.open().then(()=>{let p=this.data?.notices.find(a=>a.id===e.id)??e;this.go(this.noticeScreen(p))})});let i=v("btn small",{},"",l.later);i.addEventListener("click",()=>this.hideToast());let r=v("icon muted",{"aria-label":l.close,title:l.close,style:"margin:-6px -6px 0 0"},P.close);r.addEventListener("click",()=>this.hideToast());let s=o("div",{class:"toast",role:"status"},o("div",{class:"head"},o("p",{style:"flex:1"},this.noticeText(e)),r),o("div",{class:"actions"},n,i));this.toastNode=s,this.layerWrap.append(s)}toast(e){this.hideToast();let n=o("div",{class:"toast plain",role:"status"},o("p",{},e));this.toastNode=n,this.layerWrap.append(n),this.toastTimer=window.setTimeout(()=>this.hideToast(),2400)}hideToast(){window.clearTimeout(this.toastTimer),this.toastNode?.remove(),this.toastNode=null}banner(e){let n=e.by==="agent"?l.claude:e.by==="system"?l.start:e.name,i=o("div",{class:"banner",role:"status"},o("span",{class:"text"},e.current?l.bannerCurrent:l.bannerAt(A(e.at),n)),o("span",{class:"ro"},`\xB7 ${l.readOnly}`));if(this.boot.canRestore&&!e.current){let s=v("btn primary",{},"",l.restoreThis);s.addEventListener("click",async()=>{await this.open();let p=this.data?.rows.find(a=>a.n===e.n);p&&this.restore(p)}),i.append(s)}let r=v("btn",{},"",l.backToCurrent);r.addEventListener("click",()=>location.href=e.current_url),i.append(r),this.layerWrap.append(i)}};function Fe(t){let e=new Map;for(let n=0;n<t.length;){if(t[n][0]!=="-"){n++;continue}let i=n;for(;i<t.length&&t[i][0]==="-";)i++;let r=i;for(;r<t.length&&t[r][0]==="+";)r++;if(r-i===i-n)for(let s=0;s<i-n;s++){let p=t[n+s][1],a=t[i+s][1],c=0;for(;c<p.length&&c<a.length&&p[c]===a[c];)c++;let u=0;for(;u<p.length-c&&u<a.length-c&&p[p.length-1-u]===a[a.length-1-u];)u++;c+u<Math.min(p.length,a.length)*.3||(e.set(n+s,[c,p.length-u]),e.set(i+s,[c,a.length-u]))}n=r}return e}function be(){let t=window.__baoyuHistory;return t&&typeof t.base=="string"?new Z(t):null}var dt=Object.freeze([]);function we(t){let e=!1,n=()=>{e||(e=!0,t())};typeof requestAnimationFrame=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&requestAnimationFrame(n),setTimeout(n,typeof document<"u"&&document.visibilityState==="visible"?100:16)}var z=["#785ee8","#dc3c3d","#019c7f","#fbb315","#ce447d","#10a122","#257de0","#d25f25"],ee="#d25f25",qe=3e4,ye=5*6e4,Ue=5e3,te=3,w=y?{here:"\u6B64\u523B\u5728\u8FD9\u91CC",nobody:"\u53EA\u6709\u4F60\u5728\u770B",agent:"Agent",changed:t=>`\u521A\u6539\u4E86${t}`,slide:(t,e)=>`\u7B2C ${t} \u9875${e?` \xB7 ${e}`:""}`,board:t=>`\u5728\u300C${t}\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:t=>`${t} \u6B63\u5728\u6539\u8FD9\u4E00\u9875`,hintEditBoard:(t,e)=>`${t} \u6B63\u5728\u6539\u300C${e}\u300D`,hintAgent:"Agent \u521A\u6539\u4E86\u8FD9\u4E00\u9875",more:t=>`\u8FD8\u6709 ${t} \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:t=>`Just changed ${t}`,slide:(t,e)=>`Slide ${t}${e?` \xB7 ${e}`:""}`,board:t=>`On ${t}`,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:t=>`${t} is editing this slide`,hintEditBoard:(t,e)=>`${t} is editing ${e}`,hintAgent:"Agent just changed this slide",more:t=>`${t} 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."},xe={robot:b(I,12),go:b('<path d="M6 3.8 10.2 8 6 12.2"/>',14)},Le=`
181
+ `,T=t=>y?t.zh:t.en;function Q(t){let e=new Date(t),n=new Date,i=s=>new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),r=Math.round((i(n)-i(e))/864e5);return r===0?l.today:r===1?l.yesterday:e.toLocaleDateString(y?"zh-CN":"en",{month:"short",day:"numeric",...e.getFullYear()===n.getFullYear()?{}:{year:"numeric"}})}var O=t=>new Date(t).toLocaleTimeString(y?"zh-CN":"en",{hour:"2-digit",minute:"2-digit"}),A=t=>`${Q(t)} ${O(t)}`,Ve=t=>O(t.first)===O(t.at)?O(t.at):`${O(t.first)}\u2013${O(t.at)}`;async function _(t,e){let n=await fetch(t,e===void 0?{cache:"no-store"}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),i=await n.json().catch(()=>null);if(!n.ok){let r=i;throw Object.assign(new Error(r?.message??`HTTP ${n.status}`),{code:r?.code})}return i}var Z=class{button=o("button",{class:"open float only",type:"button","aria-haspopup":"dialog","aria-expanded":"false","aria-label":l.title,title:l.title});boot;look="float";layer=o("div",{"data-baoyu-history-layer":""});layerRoot=this.layer.attachShadow({mode:"open"});layerWrap=o("div",{class:"wrap"});pop=null;caret=o("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(o("style",{},E+Ye),this.layerWrap),this.button.insertAdjacentHTML("beforeend",P.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=o("div",{class:"pop",role:"dialog","aria-label":l.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,n=window.innerHeight,i=this.button.getBoundingClientRect(),r=i.width>0&&i.bottom>0&&i.top<n,s=Math.min(480,e-24),p=r?i.right:e-16,a=Math.max(12,Math.min(p-s,e-s-12)),c=r?i.bottom+10:56;if(Object.assign(this.pop.style,{left:`${a}px`,top:`${c}px`,width:`${s}px`,maxHeight:`${Math.max(240,n-c-12)}px`}),r){let u=Math.max(a+18,Math.min(i.left+i.width/2-7,a+s-32));Object.assign(this.caret.style,{display:"",left:`${u}px`,top:`${c-7}px`})}else this.caret.style.display="none"};onPointer=e=>{let n=e.composedPath();!this.pop||n.includes(this.pop)||n.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 _(`${this.boot.base}__history`),this.error=""}catch(n){this.error=l.failed+n.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(o("span",{class:"dot",style:"background:#d97706"}))}go(e){this.screen=e,this.diff=null,this.paint(),e.kind==="diff"&&_(e.url).then(n=>{this.screen===e&&(this.diff=n,this.paint())},n=>{this.screen===e&&(this.error=l.failed+n.message,this.paint())})}async act(e,n,i){this.busy=!0;try{return await _(e,n),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(r){return r.code==="changed"&&this.screen.kind==="diff"?(this.error="",this.go({...this.screen,note:l.changedSince}),!1):(this.error=l.failed+r.message,this.paint(),!1)}finally{this.busy=!1}}restore(e,n){let i=A(e.at),r=n?e.files.find(s=>s.path===n):void 0;this.ask(r?l.restoreOneTitle:l.restoreTitle,r?l.restoreOneText(T(r.label),i):l.restoreText(i),l.restoreGo).then(s=>s&&this.act(`${this.boot.base}__history/${e.n}/restore`,n?{paths:[n]}:{},l.done.restored))}bringBack(e){let n=e.kind==="overwritten"?l.yours:l.theirs(e.lostBy==="agent"?l.claude:e.lostName),i=e.part?l.bringBackPart:l.bringBackText,r=this.screen.kind==="diff"&&this.screen.notice?.id===e.id&&this.diff&&"now"in this.diff?{now:this.diff.now}:{},s=p=>a=>a&&this.act(`${this.boot.base}__history/notice/${e.id}/recover`,r,p);e.deleted?this.ask(l.deleteAgainTitle,l.deleteAgainText(T(e.label)),l.deleteAgain).then(s(l.done.deleted)):this.ask(l.bringBackTitle,i(T(e.label),n),l.bringBack).then(s(l.done.brought))}async dismiss(e){try{let{notices:n}=await _(`${this.boot.base}__history/notices`,{dismiss:e.id});this.data&&(this.data.notices=n),this.mark(n.length)}catch(n){this.error=l.failed+n.message}this.screen.kind==="diff"&&(this.screen={kind:"list"}),this.paint()}ask(e,n,i){return new Promise(r=>{if(!this.pop)return r(!1);let s=o("div",{class:"ask",role:"alertdialog","aria-modal":"true","aria-label":e}),p=v("btn",{},"",l.cancel),a=v("btn primary",{},"",i),c=u=>{this.asking=null,s.remove(),r(u)};p.addEventListener("click",()=>c(!1)),a.addEventListener("click",()=>c(!0)),s.addEventListener("mousedown",u=>u.target===s&&c(!1)),s.append(o("div",{class:"ask-card"},o("h3",{},e),o("p",{},n),o("div",{class:"ask-row"},p,a))),this.asking=()=>c(!1),this.pop.append(s),a.focus()})}paint(){if(!this.pop)return;let e=this.pop.querySelector(".body")?.scrollTop??0,n=o("div",{class:"body"});this.screen.kind==="diff"?this.paintDiff(n,this.screen):this.paintList(n),this.error&&n.append(o("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(n),this.screen.kind==="list"&&(n.scrollTop=e),this.position()}paintList(e){let n=v("icon muted",{"aria-label":l.close,title:l.close},P.close);n.addEventListener("click",()=>this.close()),e.append(o("div",{class:"head"},o("h2",{},l.title),n));let i=this.data;if(!i){e.append(o("div",{class:"empty"},l.loading));return}if(i.notices.length){e.append(o("div",{class:"label"},l.needsLook));for(let s of i.notices)e.append(this.noticeCard(s,i.canRestore))}i.rows.length||e.append(o("div",{class:"empty"},l.empty));let r="";for(let s of i.rows){let p=Q(s.at);p!==r&&(r=p,e.append(o("div",{class:"label"},p))),e.append(this.versionRow(s,i))}e.append(o("div",{class:"note"},i.canRestore?l.namesNote:`${l.viewOnly} ${l.namesNote}`))}who(e,n){if(e.by==="agent")return{name:l.claude,avatar:o("div",{class:"avatar small agent",html:P.robot})};if(e.by==="system")return{name:l.start,avatar:o("div",{class:"avatar small start",html:P.flag})};let i=e.userId===n;return{name:`${e.name}${i?l.you:""}`,avatar:o("div",{class:"avatar small",style:`background:${H(e.userId??e.name)}`},S(e.name))}}versionRow(e,n){let{name:i,avatar:r}=this.who(e,n.me),s=this.opened.has(e.n),p=e.files.map(g=>e.by==="system"||g.op==="edited"?T(g.label):`${l.ops[g.op]} ${T(g.label)}`),a=e.by==="system"&&!s?l.startSub:p.length>3?`${p.slice(0,3).join(y?"\u3001":", ")} ${l.more(p.length-3)}`:p.join(y?"\u3001":", "),c=o("div",{class:"badges"});if(e.current&&c.append(o("span",{class:"badge cur"},l.current)),e.restoredFrom!==void 0){let g=n.rows.find(L=>L.n===e.restoredFrom),m=g?A(g.at):`#${e.restoredFrom}`;c.append(o("span",{class:"badge"},e.restoredPart?l.restoredPart(m):l.restoredFrom(m)))}for(let g of e.overwrote??[])c.append(o("span",{class:"badge warn",title:T(g.label)},g.soft?l.replaced(g.by==="agent"?l.claude:g.name):l.overwrote(g.by==="agent"?l.claude:g.name)));let u=o("div",{class:"who"},o("div",{class:"top"},o("span",{class:"name"},i),o("span",{class:"when"},Ve(e))),...s?[]:[o("div",{class:"sub"},e.by==="agent"&&!p.length?l.claudeSub:a)],...c.childElementCount?[c]:[]),f=o("div",{class:`ver${s?" opened":""}`,role:"button",tabindex:"0","aria-expanded":String(s)},r,u),h=g=>{g.target.closest("button")||(s?this.opened.delete(e.n):this.opened.add(e.n),this.paint())};if(f.addEventListener("click",h),f.addEventListener("keydown",g=>(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),h(g))),s){let g=o("div",{class:"files"});for(let k of e.files){let se=v("link",{},"",l.changes);se.addEventListener("click",()=>this.go({kind:"diff",url:`${this.boot.base}__history/${e.n}/diff?path=${encodeURIComponent(k.path)}`,title:T(k.label),sub:`${i} \xB7 ${A(e.at)}`,...n.canRestore&&!e.current?{restore:{n:e.n,path:k.path,when:A(e.at)}}:{}})),g.append(o("div",{class:"file"},o("span",{class:`op ${k.op}`},l.ops[k.op]),o("span",{class:"fname",title:T(k.label)},T(k.label)),se))}u.append(g);let m=o("div",{class:"actions"}),L=v("btn small",{},"",l.preview);if(L.addEventListener("click",()=>window.open(e.preview,"_blank","noopener")),m.append(L),n.canRestore&&!e.current){let k=v("btn small primary",{},"",l.restore);k.addEventListener("click",()=>this.restore(e)),m.append(k)}u.append(m)}return f}noticeText(e){let n=e.lostAt??e.at,i=Q(n)===l.today?O(n):A(n);if(e.kind==="overwrote")return l.overwroteYou(e.lostBy==="agent"?l.claude:e.lostName,T(e.label),i);let r=e.by==="agent"?l.claude:e.name;return e.deleted?l.deletedBack(r,T(e.label),i):e.removed?l.removedOver(r,T(e.label),i):e.soft?l.softOver(r,T(e.label),i):l.overwritten(r,T(e.label),i)}noticeScreen(e){return{kind:"diff",url:`${this.boot.base}__history/notice/${e.id}/diff`,title:T(e.label),sub:this.noticeText(e),legend:e.deleted?l.deleteLegend:l.legend,notice:e}}noticeCard(e,n){let i=v("btn small",{},"",l.compare);i.addEventListener("click",()=>this.go(this.noticeScreen(e)));let r=v("btn small",{},"",l.dismiss);r.addEventListener("click",()=>void this.dismiss(e));let s=o("div",{class:"actions"},i);if(n){let p=v("btn small primary",{},"",e.deleted?l.deleteAgain:l.bringBack);p.addEventListener("click",()=>this.bringBack(e)),s.append(p)}return s.append(r),o("div",{class:"notice"},o("p",{},this.noticeText(e)),o("span",{class:"when"},A(e.at)),s)}paintDiff(e,n){let i=v("icon muted",{"aria-label":l.back,title:l.back},P.back);i.addEventListener("click",()=>this.go({kind:"list"}));let r=v("icon muted",{"aria-label":l.close,title:l.close},P.close);r.addEventListener("click",()=>this.close());let s=this.diff,p=s&&!s.binary&&!s.tooLarge&&!s.missing?o("span",{class:"tally"},o("span",{class:"a"},`+${s.added}`),o("span",{class:"r"},`\u2212${s.removed}`)):null;e.append(o("div",{class:"dhead"},i,o("h2",{},n.title),...p?[p]:[],r)),e.append(o("div",{class:"sub multi"},n.sub)),n.legend&&e.append(o("div",{class:"hint"},n.legend)),n.note&&e.append(o("div",{class:"hint note"},n.note));let a=o("div",{class:"actions"});if(n.restore){let f=n.restore,h=v("btn small primary",{},"",l.restoreOne);h.addEventListener("click",()=>{let g=this.data?.rows.find(m=>m.n===f.n);g&&this.restore(g,f.path)}),a.append(h)}if(n.notice){let f=n.notice;if(this.data?.canRestore){let g=v("btn small primary",{},"",f.deleted?l.deleteAgain:l.bringBack);g.addEventListener("click",()=>this.bringBack(f)),a.append(g)}let h=v("btn small",{},"",l.dismiss);h.addEventListener("click",()=>void this.dismiss(f)),a.append(h)}if(a.childElementCount&&e.append(a),!s){e.append(o("div",{class:"empty"},l.loading));return}if(s.missing||s.binary||s.tooLarge){e.append(o("div",{class:"empty"},s.missing?l.missing:s.binary?l.binary:l.tooLarge));return}if(!s.lines.some(([f])=>f==="+"||f==="-")){e.append(o("div",{class:"empty"},l.noChange));return}let c=o("div",{class:"diff"}),u=Fe(s.lines);s.lines.forEach(([f,h],g)=>{if(f==="~"){c.append(o("div",{class:"dl skip"},l.skipped(h)));return}let m=u.get(g),L=m?o("span",{},h.slice(0,m[0]),o("mark",{},h.slice(m[0],m[1])),h.slice(m[1])):o("span",{},h||" ");c.append(o("div",{class:`dl${f==="+"?" add":f==="-"?" del":""}`},o("span",{class:"k"},f===" "?"":f==="-"?"\u2212":"+"),L))}),s.truncated&&c.append(o("div",{class:"dl skip"},l.truncated)),e.append(c)}watchNotices(){let e=async()=>{if(!document.hidden)try{let{notices:n}=await _(`${this.boot.base}__history/notices`);if(this.mark(n.length),this.pop)return;let i=n.find(r=>!this.toasted.has(r.id));for(let r of n)this.toasted.add(r.id);i&&this.noticeToast(i)}catch{}};e(),window.setInterval(()=>void e(),5e3)}noticeToast(e){this.hideToast();let n=v("btn small primary",{},"",l.compare);n.addEventListener("click",()=>{this.hideToast(),this.open().then(()=>{let p=this.data?.notices.find(a=>a.id===e.id)??e;this.go(this.noticeScreen(p))})});let i=v("btn small",{},"",l.later);i.addEventListener("click",()=>this.hideToast());let r=v("icon muted",{"aria-label":l.close,title:l.close,style:"margin:-6px -6px 0 0"},P.close);r.addEventListener("click",()=>this.hideToast());let s=o("div",{class:"toast",role:"status"},o("div",{class:"head"},o("p",{style:"flex:1"},this.noticeText(e)),r),o("div",{class:"actions"},n,i));this.toastNode=s,this.layerWrap.append(s)}toast(e){this.hideToast();let n=o("div",{class:"toast plain",role:"status"},o("p",{},e));this.toastNode=n,this.layerWrap.append(n),this.toastTimer=window.setTimeout(()=>this.hideToast(),2400)}hideToast(){window.clearTimeout(this.toastTimer),this.toastNode?.remove(),this.toastNode=null}banner(e){let n=e.by==="agent"?l.claude:e.by==="system"?l.start:e.name,i=o("div",{class:"banner",role:"status"},o("span",{class:"text"},e.current?l.bannerCurrent:l.bannerAt(A(e.at),n)),o("span",{class:"ro"},`\xB7 ${l.readOnly}`));if(this.boot.canRestore&&!e.current){let s=v("btn primary",{},"",l.restoreThis);s.addEventListener("click",async()=>{await this.open();let p=this.data?.rows.find(a=>a.n===e.n);p&&this.restore(p)}),i.append(s)}let r=v("btn",{},"",l.backToCurrent);r.addEventListener("click",()=>location.href=e.current_url),i.append(r),this.layerWrap.append(i)}};function Fe(t){let e=new Map;for(let n=0;n<t.length;){if(t[n][0]!=="-"){n++;continue}let i=n;for(;i<t.length&&t[i][0]==="-";)i++;let r=i;for(;r<t.length&&t[r][0]==="+";)r++;if(r-i===i-n)for(let s=0;s<i-n;s++){let p=t[n+s][1],a=t[i+s][1],c=0;for(;c<p.length&&c<a.length&&p[c]===a[c];)c++;let u=0;for(;u<p.length-c&&u<a.length-c&&p[p.length-1-u]===a[a.length-1-u];)u++;c+u<Math.min(p.length,a.length)*.3||(e.set(n+s,[c,p.length-u]),e.set(i+s,[c,a.length-u]))}n=r}return e}function be(){let t=window.__baoyuHistory;return t&&typeof t.base=="string"?new Z(t):null}var dt=Object.freeze([]);function we(t){let e=!1,n=()=>{e||(e=!0,t())};typeof requestAnimationFrame=="function"&&typeof document<"u"&&document.visibilityState==="visible"&&requestAnimationFrame(n),setTimeout(n,typeof document<"u"&&document.visibilityState==="visible"?100:16)}var z=["#785ee8","#dc3c3d","#019c7f","#fbb315","#ce447d","#10a122","#257de0","#d25f25"],ee="#d25f25",qe=3e4,ye=5*6e4,Ue=5e3,te=3,w=y?{here:"\u6B64\u523B\u5728\u8FD9\u91CC",nobody:"\u53EA\u6709\u4F60\u5728\u770B",agent:"Agent",changed:t=>`\u521A\u6539\u4E86${t}`,slide:(t,e)=>`\u7B2C ${t} \u9875${e?` \xB7 ${e}`:""}`,board:t=>`\u5728\u300C${t}\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:t=>`${t} \u6B63\u5728\u6539\u8FD9\u4E00\u9875`,hintEditBoard:(t,e)=>`${t} \u6B63\u5728\u6539\u300C${e}\u300D`,hintAgent:"Agent \u521A\u6539\u4E86\u8FD9\u4E00\u9875",more:t=>`\u8FD8\u6709 ${t} \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:t=>`Just changed ${t}`,slide:(t,e)=>`Slide ${t}${e?` \xB7 ${e}`:""}`,board:t=>`On ${t}`,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:t=>`${t} is editing this slide`,hintEditBoard:(t,e)=>`${t} is editing ${e}`,hintAgent:"Agent just changed this slide",more:t=>`${t} 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."},xe={robot:b(I,12),go:b('<path d="M6 3.8 10.2 8 6 12.2"/>',14)},Le=`
182
182
  .av { position: relative; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 600; letter-spacing: .01em; line-height: 1; }
183
183
  .av svg { width: 60%; height: 60%; }
184
184
  .av.idle { opacity: .45; }
@@ -205,4 +205,4 @@ button.peer:hover { background: var(--soft); }
205
205
  .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; }
206
206
  .hint-note .av { width: 22px; height: 22px; font-size: 10.5px; }
207
207
  @keyframes hint-in { from { opacity: 0; transform: translateY(-4px); } }
208
- `,B=t=>{let e=t.presence.context;return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null},j=t=>typeof t=="string"?t:typeof t=="object"&&t!==null&&typeof t.text=="string"?t.text:"",Ge=t=>{let e=t.presence.who,n=typeof e?.c=="string"?e.c.toLowerCase():"";if(z.includes(n)&&(t.kind==="agent"||n!==ee))return n;if(t.kind==="agent")return ee;let i=0;for(let s=0;s<t.by.length;s++)i=i*31+t.by.charCodeAt(s)>>>0;let r=i%z.length;return z[r]===ee&&(r=(r+1)%z.length),z[r]},Ke=t=>{let[e=0,n=0,i=0]=[1,3,5].map(r=>{let s=parseInt(t.slice(r,r+2),16)/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4});return 1.05/(.2126*e+.7152*n+.0722*i+.05)<3?"#0b0b0b":"#ffffff"},ne=(t,e)=>{if(t.agent||e-t.at>qe)return!1;let n=B(t.latest);if(!n||n.mode!==void 0&&n.mode!=="edit"&&n.mode!=="focused"&&n.mode!=="canvas")return!1;let i=n.selection;return Array.isArray(i)?i.length>0:Array.isArray(n.selected)&&n.selected.length>0},$e=(t,e)=>{let n=t[e];return Array.isArray(n)?n.filter(i=>typeof i=="string"):[]},Me=t=>{let e=Array.isArray(t.selected)?t.selected.find(n=>typeof n=="string"&&n.includes("#")):void 0;return e?e.slice(0,e.indexOf("#")):$e(t,"selectedArtboards")[0]??""},ke=t=>{let e=t.replace(/\.dc\.html$/,"");try{e=decodeURIComponent(e)}catch{}return e.slice(e.lastIndexOf("/")+1)||e},Re=t=>typeof t.page=="string"?t.page:"",Te=t=>{let e=t&&B(t);if(!e)return null;if(typeof e.slideId=="string"&&e.slideId)return`slide:${e.slideId}`;if(Array.isArray(e.visibleArtboards)){let n=Me(e);return n?`board:${Re(e)}:${n}`:null}return null},Xe=t=>{let e=t&&B(t);return e?typeof e.slideId=="string"&&e.slideId?new Set([`slide:${e.slideId}`]):new Set($e(e,"visibleArtboards").map(n=>`board:${Re(e)}:${n}`)):new Set},ie=class{node=o("button",{class:"open peers float",type:"button","aria-haspopup":"dialog","aria-expanded":"false",hidden:""});presence=null;people=[];seen=new Map;look="float";layer=o("div",{"data-baoyu-presence-layer":""});layerRoot=this.layer.attachShadow({mode:"open"});layerWrap=o("div",{class:"wrap"});pop=null;caret=o("div",{class:"caret"});hint=null;hintTimer;hinted=new Map;frame=!1;constructor(){this.layerRoot.append(o("style",{},E+Le+Je),this.layerWrap),this.node.addEventListener("click",()=>this.pop?this.close():this.open());let e=()=>{let n=window.__baoyuPresence;!n||n===this.presence||(this.presence=n,n.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,we(()=>{this.frame=!1,this.update()}))}update(){let e=this.presence;if(!e)return;let n=Date.now(),i=e.peers(),r=new Set;for(let a of i){r.add(a.peer);let c=JSON.stringify(a.presence),u=this.seen.get(a.peer);(!u||u.json!==c)&&this.seen.set(a.peer,{json:c,at:n})}for(let a of this.seen.keys())r.has(a)||this.seen.delete(a);let s=new Map;for(let a of i){let c=a.kind==="agent";if(!c&&a.by===e.me.by)continue;let u=c?"agent":a.by,f=this.seen.get(a.peer)?.at??n,h=s.get(u);h&&h.at>=f||s.set(u,{key:u,name:c?w.agent:a.name||"?",role:a.role??"",agent:c,color:Ge(a),latest:a,at:f})}this.people=[...s.values()].sort((a,c)=>Number(c.agent)-Number(a.agent)||c.at-a.at);let p=i.find(a=>a.peer===e.me.peer);this.paintSeat(n),this.pop&&this.paintList(n),this.checkHint(Xe(p),n)}avatar(e,n,i=""){let r=!e.agent&&n-e.at>ye,s=ne(e,n),p=o("span",{class:`av${r?" idle":""}${s?" editing":""}${i?` ${i}`:""}`,style:`background:${e.color};color:${Ke(e.color)};--c:${e.color}`});return e.agent?p.innerHTML=xe.robot:p.textContent=S(e.name),p}paintSeat(e){let n=this.people;if(this.node.hidden=n.length===0,!n.length){this.pop&&this.close();return}let i=o("span",{class:"stack"});for(let p of n.slice(0,te))i.append(this.avatar(p,e));this.node.replaceChildren(i),n.length>te&&this.node.append(o("span",{class:"plus"},`+${n.length-te}`));let r=n.map(p=>p.name),s=`${w.here}: ${r.slice(0,5).join(y?"\u3001":", ")}${r.length>5?y?` ${w.more(r.length-5)}`:`, ${w.more(r.length-5)}`:""}`;this.node.setAttribute("aria-label",s),this.node.title=s}whereOf(e,n){let i=e.latest,r=B(i),s=typeof r?.slideId=="string"?r.slideId:"",p=s?document.querySelector(`[role="option"][data-slide-id="${CSS.escape(s)}"]`):null;if(e.agent){let u=i.presence.where,f=typeof(y?u?.zh:u?.en)=="string"?String(y?u.zh:u.en):"";return{text:f?w.changed(f):w.open,editing:!1,slide:p}}let a=ne(e,n),c="";if(r?.mode==="present")c=w.presenting;else if(r?.mode==="grid")c=w.overview;else if(typeof r?.slideIndex=="number"&&r.slideIndex>0)c=w.slide(r.slideIndex,j(r.slideTitle));else if(r&&Array.isArray(r.visibleArtboards)){let u=Me(r);c=u?w.board(ke(u)):j(r.pageName)?w.board(j(r.pageName)):w.canvas}else j(r?.pageName)?c=w.board(j(r?.pageName)):c=w.open;return!a&&n-e.at>ye&&(c+=` \xB7 ${w.idle}`),{text:c,editing:a,slide:r?.mode==="present"?null:p}}open(){this.pop||!this.people.length||(this.pop=o("div",{class:"pop",role:"dialog","aria-label":w.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 n=o("div",{class:"body"},o("div",{class:"head"},o("h2",{},w.here)));this.people.length||n.append(o("div",{class:"empty"},w.nobody));for(let i of this.people){let r=this.whereOf(i,e),s=o("div",{class:"sub"},r.text);r.editing&&s.append(" \xB7 ",o("span",{class:"on"},w.editing));let p=o("div",{class:"name"},i.name),a=i.agent?"":w.roles[i.role]??"";a&&p.append(o("span",{class:"role"},a));let c=o("div",{class:"who"},p,s),u=r.slide?o("button",{class:"peer",type:"button",title:w.go}):o("div",{class:"peer"});if(u.append(this.avatar(i,e),c),r.slide){let f=r.slide;u.insertAdjacentHTML("beforeend",`<span class="go">${xe.go}</span>`),u.addEventListener("click",()=>{f.click(),f.scrollIntoView({block:"nearest"}),this.close()})}n.append(u)}this.presence?.peers().some(i=>i.kind!=="agent"&&B(i))&&n.append(o("div",{class:"hint"},w.note)),this.pop.replaceChildren(n),this.position()}position=()=>{if(!this.pop)return;let e=window.innerWidth,n=window.innerHeight,i=this.node.getBoundingClientRect(),r=i.width>0&&i.bottom>0&&i.top<n,s=Math.min(320,e-24),p=r?i.right+40:e-16,a=Math.max(12,Math.min(p-s,e-s-12)),c=r?i.bottom+10:56;if(Object.assign(this.pop.style,{left:`${a}px`,top:`${c}px`,width:`${s}px`,maxHeight:`${Math.max(200,n-c-12)}px`}),r){let u=Math.max(a+18,Math.min(i.left+i.width/2-7,a+s-32));Object.assign(this.caret.style,{display:"",left:`${u}px`,top:`${c-7}px`})}else this.caret.style.display="none"};onPointer=e=>{let n=e.composedPath();!this.pop||n.includes(this.pop)||n.includes(this.node)||this.close()};onKey=e=>{e.key==="Escape"&&(e.stopPropagation(),e.preventDefault(),this.close(),this.node.focus())};checkHint(e,n){for(let i of this.hinted.keys())this.people.some(r=>r.key===i&&Te(r.latest)===this.hinted.get(i))||this.hinted.delete(i);if(e.size)for(let i of this.people){let r=Te(i.latest);if(!(!r||!e.has(r)||this.hinted.get(i.key)===r)&&!(!i.agent&&!ne(i,n))){this.hinted.set(i.key,r),this.showHint(i,n,r);return}}}showHint(e,n,i){window.clearTimeout(this.hintTimer),this.hint?.remove();let r=this.node.getBoundingClientRect();if(!r.width)return;this.layer.isConnected||document.body.append(this.layer);let s=o("div",{class:"hint-note",role:"status"},this.avatar(e,n),o("span",{},e.agent?w.hintAgent:i.startsWith("board:")?w.hintEditBoard(e.name,ke(i.slice(i.indexOf(":",6)+1))):w.hintEdit(e.name)));this.layerWrap.append(s);let p=s.getBoundingClientRect().width;Object.assign(s.style,{top:`${r.bottom+10}px`,left:`${Math.max(12,Math.min(r.right-p,window.innerWidth-p-12))}px`}),this.hint=s,this.hintTimer=window.setTimeout(()=>{s.remove(),this.hint===s&&(this.hint=null)},Ue)}};function Se(){return new ie}var C=window.__baoyuShare??{},M=C.role==="owner";ce(M);ge(M);var Y=C.noun??{en:"artifact",zh:"\u5185\u5BB9",zhThis:"\u8FD9\u4EFD\u5185\u5BB9"},oe=["editor","commenter","viewer"],d=y?{share:"\u5206\u4EAB",export:"\u5BFC\u51FA",sendTitle:"\u8981\u53D1\u7ED9\u522B\u4EBA\uFF1F",sendText:"\u53D1\u94FE\u63A5\u800C\u4E0D\u662F\u6587\u4EF6\uFF0C\u5BF9\u65B9\u770B\u5230\u7684\u59CB\u7EC8\u662F\u6700\u65B0\u7248\u672C\u3002",invitePeople:"\u9080\u8BF7",joinAs:t=>`\u6253\u5F00\u8FD9\u4E2A\u94FE\u63A5\u7684\u4EBA\u4EE5\u300C${t}\u300D\u8EAB\u4EFD\u52A0\u5165\u3002\u8981\u7ED9\u522B\u7684\u89D2\u8272\uFF0C\u70B9\u300C\u9080\u8BF7\u300D\u3002`,noLinks:"\u94FE\u63A5\u90FD\u5173\u7740\u3002\u70B9\u300C\u9080\u8BF7\u300D\u5F00\u542F\u4E00\u4E2A\u3002",title:`\u5206\u4EAB${Y.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:C.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:t=>`\u66F4\u6539\u300C${t}\u300D\u7684\u89D2\u8272`,linkOff:"\u94FE\u63A5\u5DF2\u5173\u95ED",online:"\u5728\u7EBF",seen:t=>`${t}\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:t=>`\u79FB\u51FA\u300C${t}\u300D\uFF1F`,removeText:`\u5BF9\u65B9\u5C06\u65E0\u6CD5\u518D\u8BBF\u95EE${Y.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:"\u73B0\u5728\u53EA\u6709\u8FD9\u53F0\u7535\u8111\u80FD\u6253\u5F00\u3002\u590D\u5236\u94FE\u63A5\u4F1A\u628A\u5B83\u5F00\u653E\u5230\u5C40\u57DF\u7F51\u3002",whereOn:t=>`\u5C40\u57DF\u7F51\u5730\u5740\uFF1A${t}`,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",copyTailnet:"\u590D\u5236 Tailscale \u94FE\u63A5",copyTailnetNote:t=>`\u7ED9\u540C\u4E00 tailnet \u91CC\u4E0D\u5728\u8FD9\u4E2A\u7F51\u7EDC\u7684\u4EBA\uFF08${t}\uFF09`,onTailnet:t=>`Tailscale\uFF1A${t}\uFF0C\u540C\u4E00 tailnet \u7684\u4EBA\u5728\u522B\u7684\u7F51\u7EDC\u4E5F\u80FD\u6253\u5F00\uFF08\u590D\u5236\u5728\u94FE\u63A5\u7684\u300C\u66F4\u591A\u300D\u91CC\uFF09`,plainHttp:"\u8FD9\u662F\u660E\u6587 HTTP\uFF1A\u540C\u4E00\u7F51\u7EDC\u91CC\u7684\u4EBA\u53EF\u80FD\u770B\u5230\u4F20\u8F93\u7684\u5185\u5BB9\u3002\u94FE\u63A5\u5C31\u662F\u6743\u9650\uFF1A\u62FF\u5230\u94FE\u63A5\u7684\u4EBA\u5C31\u6709\u5B83\u7684\u89D2\u8272\uFF0C\u53EA\u53D1\u7ED9\u8BE5\u6709\u7684\u4EBA\uFF1B\u4F20\u51FA\u53BB\u4E86\u5C31\u91CD\u7F6E\u94FE\u63A5\u3002",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:t=>`\u91CD\u7F6E\u300C${t}\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",export:"Export",sendTitle:"Sending this to someone?",sendText:"Share the link instead of a file and they will always have the latest changes.",invitePeople:"Invite people",joinAs:t=>`People who open this link join as ${t.toLowerCase()}. Invite people to give another role.`,noLinks:"All the links are off. Invite people to turn one on.",title:`Share this ${Y.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:C.reactions?"Comment and react, no edits":"Comment, no edits",viewer:"Read only"},changeRole:t=>`Change ${t}'s role`,linkOff:"Link off",online:"Online",seen:t=>`Seen ${t}`,paused:"Link off: no access until it is back on",none:"Nobody has joined yet. Send someone a link below.",remove:"Remove",removeTitle:t=>`Remove ${t}?`,removeText:`They lose access to this ${Y.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 for now. Copying one opens this to your network.",whereOn:t=>`On this network at ${t}`,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",copyTailnet:"Copy Tailscale link",copyTailnetNote:t=>`For people on your tailnet, off this network (${t})`,onTailnet:t=>`Tailscale: ${t}, for people on your tailnet from any network (copy it from a link's More menu)`,plainHttp:"This is plain HTTP: others on the network can read what passes. A link is the permission: whoever has it gets its role, so send it only to the people meant to have it, and reset a link that went further.",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:t=>`Reset the "${t}" link?`,resetText:"The old link stops working and the people who joined with it lose access.",cancel:"Cancel",failed:"Could not do that: "},x={share:b('<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:b('<path d="M4 4l8 8M12 4l-8 8"/>',18),chevron:b('<path d="M4.5 6.2 8 9.7l3.5-3.5"/>',14),check:b('<path d="M3 8.6 6.3 11.8 13 4.6"/>',18),trash:b('<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:b('<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:b('<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:b('<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:b('<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:b('<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),people:b('<circle cx="6" cy="5.4" r="2.4"/><path d="M1.8 13.4c.3-2.5 2-3.9 4.2-3.9s3.9 1.4 4.2 3.9M10.4 3.3a2.4 2.4 0 0 1 0 4.2M12 9.9c1.2.5 2 1.7 2.2 3.5"/>',16),viewer:b('<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 Pe(t){let e=await fetch("/__share",t?{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}:{cache:"no-store"}),n=await e.json();if(!e.ok)throw new Error(n?.message??`HTTP ${e.status}`);return n}var re=class{host=o("span",{"data-baoyu-share":""});root=this.host.attachShadow({mode:"open"});wrap=o("div",{class:"wrap seat"});button=o("button",{class:"open float",type:"button","aria-haspopup":"dialog","aria-expanded":"false"});history=be();presence=Se();look="float";layer=o("div",{"data-baoyu-share-layer":""});layerRoot=this.layer.attachShadow({mode:"open"});layerWrap=o("div",{class:"wrap"});pop=null;caret=o("div",{class:"caret"});menu=null;menuAnchor=null;menuJustClosed=null;asking=null;view=null;invites=null;error="";timer;tab="share";copied=null;constructor(){this.root.append(o("style",{},E+ve+Ee),this.wrap),this.layerRoot.append(o("style",{},E+fe),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(),M&&Pe().then(e=>{this.view=e,this.paintButton()},()=>{})}mount(){let e=()=>{let n=Qe();if(!n){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,r,s]=n;i==="into"&&this.host.parentNode!==r&&r.append(this.host),i==="first"&&r.firstChild!==this.host&&r.prepend(this.host),i==="before"&&r.previousSibling!==this.host&&r.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=M&&!!this.view?.lan;this.button.innerHTML=x.share,this.look==="tool"?(this.button.setAttribute("aria-label",d.share),this.button.title=e?`${d.share} \xB7 ${d.onLan}`:d.share):(this.button.removeAttribute("aria-label"),this.button.removeAttribute("title"),this.button.append(d.share)),e&&this.button.append(o("span",{class:"dot",title:d.onLan}))}async open(){if(this.pop)return;this.pop=o("div",{class:"pop",role:"dialog","aria-label":d.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=M?()=>this.refresh():()=>this.refreshInvites();M||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.tab="share",this.caret.remove(),this.layer.remove(),this.button.setAttribute("aria-expanded","false"),this.button.focus()}position=()=>{if(!this.pop)return;let e=window.innerWidth,n=window.innerHeight,i=this.button.getBoundingClientRect(),r=i.width>0&&i.bottom>0&&i.top<n,s=Math.min(460,e-24),p=r?i.right:e-16,a=Math.max(12,Math.min(p-s,e-s-12)),c=r?i.bottom+10:56;if(Object.assign(this.pop.style,{left:`${a}px`,top:`${c}px`,width:`${s}px`,maxHeight:`${Math.max(240,n-c-12)}px`}),r){let u=Math.max(a+18,Math.min(i.left+i.width/2-7,a+s-32));Object.assign(this.caret.style,{display:"",left:`${u}px`,top:`${c-7}px`})}else this.caret.style.display="none";this.menu&&this.menuAnchor&&this.placeMenu(this.menu,this.menuAnchor)};onPointer=e=>{let n=e.composedPath();this.menu&&!n.includes(this.menu)&&(this.menuJustClosed=this.menuAnchor,this.closeMenu(),setTimeout(()=>this.menuJustClosed=null,0)),!(!this.pop||n.includes(this.pop)||n.includes(this.button)||this.menu&&n.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 n=this.menuAnchor;this.closeMenu(),n?.focus()}else this.close()};async refresh(e){let n=JSON.stringify([this.view,this.error]);try{this.view=await Pe(e),this.error=""}catch(i){this.error=d.failed+i.message}this.paintButton(),!(!e&&(this.menu||this.asking||this.pop?.firstChild&&JSON.stringify([this.view,this.error])===n))&&this.paint()}async refreshInvites(){let e=JSON.stringify([this.invites,this.error]);try{let n=await fetch("/__share/invite",{cache:"no-store"}),i=await n.json();if(!n.ok)throw new Error(i?.message??`HTTP ${n.status}`);this.invites=i.links,this.error=""}catch(n){this.error=d.failed+n.message}JSON.stringify([this.invites,this.error])!==e&&this.paintGuest()}openMenu(e,n){if(this.menuJustClosed===e)return;this.closeMenu();let i=o("div",{class:"menu",role:"menu"});for(let r of n){let s=o("button",{class:`item${r.danger?" danger":""}`,type:"button",role:r.checked===void 0?"menuitem":"menuitemradio"});r.checked!==void 0&&s.setAttribute("aria-checked",String(r.checked)),s.disabled=r.disabled===!0,s.append(o("span",{class:"who"},o("span",{class:"name"},r.label),...r.sub?[o("span",{class:"sub"},r.sub)]:[])),r.checked!==void 0&&s.append(o("span",{class:"tick",html:r.checked?x.check:""})),s.addEventListener("click",()=>{this.closeMenu(),e.focus({preventScroll:!0}),r.run()}),i.append(s)}i.addEventListener("keydown",r=>{let s=[...i.querySelectorAll("button:not(:disabled)")],p=s.indexOf(this.layerRoot.activeElement),a=c=>s[(c+s.length)%s.length]?.focus();if(r.key==="ArrowDown")a(p+1);else if(r.key==="ArrowUp")a(p-1);else if(r.key==="Home")a(0);else if(r.key==="End")a(-1);else if(r.key==="Tab")this.closeMenu();else return;r.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,n){let i=n.getBoundingClientRect(),r=e.getBoundingClientRect(),s=window.innerWidth,p=window.innerHeight,c=n.classList.contains("wide")?i.left:i.right-r.width;c=Math.max(12,Math.min(c,s-r.width-12));let u=i.bottom+6;u+r.height>p-12&&i.top-r.height-6>12&&(u=i.top-r.height-6),Object.assign(e.style,{left:`${c}px`,top:`${u}px`})}closeMenu(){this.menu?.remove(),this.menuAnchor?.setAttribute("aria-expanded","false"),this.menu=null,this.menuAnchor=null}ask(e,n,i){return new Promise(r=>{if(!this.pop)return r(!1);this.closeMenu();let s=o("div",{class:"ask",role:"alertdialog","aria-modal":"true","aria-label":e}),p=v("btn",{},"",d.cancel),a=v("btn danger",{},"",i),c=u=>{this.asking=null,s.remove(),r(u)};p.addEventListener("click",()=>c(!1)),a.addEventListener("click",()=>c(!0)),s.addEventListener("mousedown",u=>u.target===s&&c(!1)),s.append(o("div",{class:"ask-card"},o("h3",{},e),o("p",{},n),o("div",{class:"ask-row"},p,a))),this.asking=()=>c(!1),this.pop.append(s),p.focus()})}paint(){if(!this.pop||!this.view)return;let e=this.view;if(this.tab==="export")return this.paintExport(e.title||d.title);let n=this.layerRoot.activeElement?.getAttribute("data-key"),i=this.pop.querySelector(".body")?.scrollTop??0,r=o("div",{class:"body"}),s=v("icon muted",{"aria-label":d.close,title:d.close,"data-key":"close"},x.close);s.addEventListener("click",()=>this.close()),r.append(o("div",{class:"head"},o("h2",{},e.title||d.title),s),...this.tabs()),r.append(o("div",{class:"label"},d.peopleWithAccess));let p=C.name??"";r.append(o("div",{class:"row"},o("div",{class:"avatar",style:`background:${H("local"+p)}`},S(p)),o("div",{class:"who"},o("div",{class:"name"},p,o("span",{class:"faint"},d.you)),o("div",{class:"sub"},d.thisComputer)),o("span",{class:"select static",html:`<span>${d.owner}</span>${x.chevron}`}))),r.append(o("div",{class:"label"},d.joinedPeople)),e.guests.length||r.append(o("div",{class:"empty"},d.none));for(let h of[...e.guests].sort((g,m)=>Number(m.online)-Number(g.online)||(m.seen??m.joined).localeCompare(g.seen??g.joined))){let g=h.online?d.online:h.active?d.seen(le(h.seen??h.joined)):d.paused,m=v("select",{"aria-haspopup":"menu","aria-expanded":"false","aria-label":d.changeRole(h.name),"data-key":`role-${h.id}`},"",d.roleNames[h.role],x.chevron);m.addEventListener("click",()=>this.openMenu(m,oe.map(k=>({label:d.roleNames[k],sub:e.links[k].on?void 0:d.linkOff,checked:k===h.role,disabled:!e.links[k].on,run:()=>k!==h.role&&void this.refresh({action:"role",guest:h.id,role:k})}))));let L=v("icon muted",{"aria-label":`${d.remove} ${h.name}`,title:d.remove,"data-key":`rm-${h.id}`},x.trash);L.addEventListener("click",async()=>{await this.ask(d.removeTitle(h.name),d.removeText,d.remove)&&this.refresh({action:"remove",guest:h.id})}),r.append(o("div",{class:`row${h.active?"":" paused"}`},o("div",{class:`avatar${h.online?" on":""}`,style:`background:${H(h.id)}`},S(h.name)),o("div",{class:"who"},o("div",{class:"name"},h.name),o("div",{class:`sub${h.online?" on":""}`},g)),m,L))}r.append(o("div",{class:"label"},d.generalAccess));let a=e.addresses.filter(h=>h!==e.tailnet?.address),c=e.lan?e.addresses.length?d.whereOn((a.length?a:e.addresses).map(h=>`${h}:${e.port}`).join(" \xB7 ")):d.noAddress:d.whereOff,u=v("select wide",{"aria-haspopup":"menu","aria-expanded":"false","data-key":"lan"},"",e.lan?d.onLan:d.onlyHere,x.chevron);u.addEventListener("click",()=>this.openMenu(u,[{label:d.onlyHere,sub:d.onlyHereNote,checked:!e.lan,run:()=>e.lan&&void this.refresh({action:"lan",on:!1})},{label:d.onLan,sub:d.onLanNote,checked:e.lan,run:()=>!e.lan&&void this.refresh({action:"lan",on:!0})}])),r.append(o("div",{class:"row"},o("div",{class:"circle",html:e.lan?x.network:x.lock}),o("div",{class:"who"},u,o("div",{class:"sub multi"},c),...e.lan&&e.tailnet?[o("div",{class:"sub multi"},d.onTailnet(`${e.tailnet.address}:${e.port}`))]:[]))),r.append(o("div",{class:"label"},d.inviteLinks));for(let h of oe){let g=e.links[h],m;g.on?m=this.copyButton(h,g.networkUrl??g.url):(m=v("pill",{"data-key":`copy-${h}`},"",d.turnOn),m.addEventListener("click",()=>void this.refresh({action:"link",role:h,on:!0})));let L=v("icon muted",{"aria-haspopup":"menu","aria-expanded":"false","aria-label":`${d.more}: ${d.linkTitles[h]}`,title:d.more,"data-key":`more-${h}`},x.more);L.addEventListener("click",()=>this.openMenu(L,[...g.on&&e.lan&&e.tailnet?[{label:d.copyTailnet,sub:d.copyTailnetNote(e.tailnet.address),run:()=>void this.copyUrl(h,e.tailnet.links[h].url)}]:[],g.on?{label:d.turnOffLink,sub:d.turnOffNote,run:()=>void this.refresh({action:"link",role:h,on:!1})}:{label:d.turnOnLink,run:()=>void this.refresh({action:"link",role:h,on:!0})},{label:d.resetLink,sub:d.resetNote,danger:!0,run:async()=>{await this.ask(d.resetTitle(d.linkTitles[h]),d.resetText,d.resetLink)&&this.refresh({action:"reset",role:h})}}])),r.append(o("div",{class:`row${g.on?"":" off"}`,title:g.on?g.networkUrl??g.url:""},o("div",{class:"circle",html:x[h]}),o("div",{class:"who"},o("div",{class:"name"},d.linkTitles[h]),o("div",{class:"sub"},g.on?d.roleNotes[h]:d.linkOffNote)),m,L))}e.lan&&r.append(o("div",{class:"hint","data-baoyu-share-security":""},d.plainHttp)),this.error&&r.append(o("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(r),r.scrollTop=i,this.position(),((n?r.querySelector(`[data-key="${n}"]`):null)??s).focus({preventScroll:!0})}paintGuest(){if(!this.pop)return;let e=this.layerRoot.activeElement?.getAttribute("data-key"),n=o("div",{class:"body"}),i=v("icon muted",{"aria-label":d.close,title:d.close,"data-key":"close"},x.close);if(i.addEventListener("click",()=>this.close()),n.append(o("div",{class:"head"},o("h2",{},C.title||document.title||d.title),i)),this.invites?.length){n.append(o("div",{class:"label"},d.inviteLinks));for(let{role:s,url:p}of this.invites)n.append(o("div",{class:"row",title:p},o("div",{class:"circle",html:x[s]}),o("div",{class:"who"},o("div",{class:"name"},d.linkTitles[s]),o("div",{class:"sub"},d.roleNotes[s])),this.copyButton(s,p)));n.append(o("div",{class:"hint"},d.guestInviteNote),o("div",{class:"hint","data-baoyu-share-security":""},d.plainHttp),o("div",{class:"rule"}))}n.append(o("div",{class:"foot"},o("div",{class:"note"},d.onlyAccess),this.copyButton("page",location.origin+location.pathname))),this.error&&n.append(o("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(n),this.position(),((e?n.querySelector(`[data-key="${e}"]`):null)??i).focus({preventScroll:!0})}tabs(){if(!M||!X().length)return[];let e=(n,i)=>{let r=v("tab",{role:"tab","aria-selected":String(this.tab===n),"data-key":`tab-${n}`},"",i);return r.addEventListener("click",()=>this.showTab(n)),r};return[o("div",{class:"tabs",role:"tablist"},e("share",d.share),e("export",d.export))]}showTab(e){this.tab!==e&&(this.tab=e,this.pop?.querySelector(".body")?.scrollTo(0,0),this.paint())}paintExport(e){if(!this.pop)return;let n=this.layerRoot.activeElement?.getAttribute("data-key"),i=o("div",{class:"body"}),r=v("icon muted",{"aria-label":d.close,title:d.close,"data-key":"close"},x.close);r.addEventListener("click",()=>this.close()),i.append(o("div",{class:"head"},o("h2",{},e),r),...this.tabs());let s=o("div",{class:"send-row"}),p=this.view,a=[...oe].reverse().find(h=>p.links[h].on);s.append(this.inviteButton()),a&&s.append(this.copyButton(a,p.links[a].networkUrl??p.links[a].url));let c=a?p.lan?d.joinAs(d.roleNames[a]):d.whereOff:d.noLinks,u=o("div",{class:"send"},o("div",{class:"who"},o("h3",{},d.sendTitle),o("p",{},d.sendText),s,o("div",{class:"note"},c)));u.insertAdjacentHTML("afterbegin",x.people),i.append(u,me(X(),h=>{this.close(),h.run()})),this.error&&i.append(o("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(i),this.position(),((n?i.querySelector(`[data-key="${CSS.escape(n)}"]`):null)??r).focus({preventScroll:!0})}inviteButton(){let e=v("primary",{"data-key":"invite"},x.people,d.invitePeople);return e.addEventListener("click",()=>this.showTab("share")),e}copyButton(e,n){let i=this.copied===e,r=v(`pill${i?" done":""}`,{"data-key":`copy-${e}`},i?x.check:x.link,i?d.copied:d.copyLink);return r.addEventListener("click",()=>void this.copyUrl(e,n)),r}async copyUrl(e,n){let i=()=>M?this.paint():this.paintGuest();await de(n),this.copied=e,i(),M&&!this.view?.lan&&this.refresh({action:"lan",on:!0}),setTimeout(()=>{this.copied===e&&(this.copied=null,!this.menu&&!this.asking&&i())},1600)}};function Qe(){let t=document.querySelector("[data-baoyu-share-seat]")??document.querySelector("[data-baoyu-comments]")?.shadowRoot?.querySelector("[data-baoyu-share-seat]");if(t)return["into",t,"header"];let e=document.querySelector('[data-testid="ldoc-comments-btn"]'),n=e?.closest(".ml-auto")??e?.parentElement?.parentElement;if(n)return["first",n,"header"];let i=document.querySelector("[data-baoyu-comments-seat]");if(i)return["before",i,"tool"];let r=document.querySelector("header.tb-root .tb-card-end");return r?["first",r,"bar"]:null}var Ae=()=>new re().mount();document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ae,{once:!0}):Ae();
208
+ `,B=t=>{let e=t.presence.context;return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null},j=t=>typeof t=="string"?t:typeof t=="object"&&t!==null&&typeof t.text=="string"?t.text:"",Ge=t=>{let e=t.presence.who,n=typeof e?.c=="string"?e.c.toLowerCase():"";if(z.includes(n)&&(t.kind==="agent"||n!==ee))return n;if(t.kind==="agent")return ee;let i=0;for(let s=0;s<t.by.length;s++)i=i*31+t.by.charCodeAt(s)>>>0;let r=i%z.length;return z[r]===ee&&(r=(r+1)%z.length),z[r]},Ke=t=>{let[e=0,n=0,i=0]=[1,3,5].map(r=>{let s=parseInt(t.slice(r,r+2),16)/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4});return 1.05/(.2126*e+.7152*n+.0722*i+.05)<3?"#0b0b0b":"#ffffff"},ne=(t,e)=>{if(t.agent||e-t.at>qe)return!1;let n=B(t.latest);if(!n||n.mode!==void 0&&n.mode!=="edit"&&n.mode!=="focused"&&n.mode!=="canvas")return!1;let i=n.selection;return Array.isArray(i)?i.length>0:Array.isArray(n.selected)&&n.selected.length>0},$e=(t,e)=>{let n=t[e];return Array.isArray(n)?n.filter(i=>typeof i=="string"):[]},Me=t=>{let e=Array.isArray(t.selected)?t.selected.find(n=>typeof n=="string"&&n.includes("#")):void 0;return e?e.slice(0,e.indexOf("#")):$e(t,"selectedArtboards")[0]??""},ke=t=>{let e=t.replace(/\.dc\.html$/,"");try{e=decodeURIComponent(e)}catch{}return e.slice(e.lastIndexOf("/")+1)||e},Re=t=>typeof t.page=="string"?t.page:"",Te=t=>{let e=t&&B(t);if(!e)return null;if(typeof e.slideId=="string"&&e.slideId)return`slide:${e.slideId}`;if(Array.isArray(e.visibleArtboards)){let n=Me(e);return n?`board:${Re(e)}:${n}`:null}return null},Xe=t=>{let e=t&&B(t);return e?typeof e.slideId=="string"&&e.slideId?new Set([`slide:${e.slideId}`]):new Set($e(e,"visibleArtboards").map(n=>`board:${Re(e)}:${n}`)):new Set},ie=class{node=o("button",{class:"open peers float",type:"button","aria-haspopup":"dialog","aria-expanded":"false",hidden:""});presence=null;people=[];seen=new Map;look="float";layer=o("div",{"data-baoyu-presence-layer":""});layerRoot=this.layer.attachShadow({mode:"open"});layerWrap=o("div",{class:"wrap"});pop=null;caret=o("div",{class:"caret"});hint=null;hintTimer;hinted=new Map;frame=!1;constructor(){this.layerRoot.append(o("style",{},E+Le+Je),this.layerWrap),this.node.addEventListener("click",()=>this.pop?this.close():this.open());let e=()=>{let n=window.__baoyuPresence;!n||n===this.presence||(this.presence=n,n.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,we(()=>{this.frame=!1,this.update()}))}update(){let e=this.presence;if(!e)return;let n=Date.now(),i=e.peers(),r=new Set;for(let a of i){r.add(a.peer);let c=JSON.stringify(a.presence),u=this.seen.get(a.peer);(!u||u.json!==c)&&this.seen.set(a.peer,{json:c,at:n})}for(let a of this.seen.keys())r.has(a)||this.seen.delete(a);let s=new Map;for(let a of i){let c=a.kind==="agent";if(!c&&a.by===e.me.by)continue;let u=c?"agent":a.by,f=this.seen.get(a.peer)?.at??n,h=s.get(u);h&&h.at>=f||s.set(u,{key:u,name:c?w.agent:a.name||"?",role:a.role??"",agent:c,color:Ge(a),latest:a,at:f})}this.people=[...s.values()].sort((a,c)=>Number(c.agent)-Number(a.agent)||c.at-a.at);let p=i.find(a=>a.peer===e.me.peer);this.paintSeat(n),this.pop&&this.paintList(n),this.checkHint(Xe(p),n)}avatar(e,n,i=""){let r=!e.agent&&n-e.at>ye,s=ne(e,n),p=o("span",{class:`av${r?" idle":""}${s?" editing":""}${i?` ${i}`:""}`,style:`background:${e.color};color:${Ke(e.color)};--c:${e.color}`});return e.agent?p.innerHTML=xe.robot:p.textContent=S(e.name),p}paintSeat(e){let n=this.people;if(this.node.hidden=n.length===0,!n.length){this.pop&&this.close();return}let i=o("span",{class:"stack"});for(let p of n.slice(0,te))i.append(this.avatar(p,e));this.node.replaceChildren(i),n.length>te&&this.node.append(o("span",{class:"plus"},`+${n.length-te}`));let r=n.map(p=>p.name),s=`${w.here}: ${r.slice(0,5).join(y?"\u3001":", ")}${r.length>5?y?` ${w.more(r.length-5)}`:`, ${w.more(r.length-5)}`:""}`;this.node.setAttribute("aria-label",s),this.node.title=s}whereOf(e,n){let i=e.latest,r=B(i),s=typeof r?.slideId=="string"?r.slideId:"",p=s?document.querySelector(`[role="option"][data-slide-id="${CSS.escape(s)}"]`):null;if(e.agent){let u=i.presence.where,f=typeof(y?u?.zh:u?.en)=="string"?String(y?u.zh:u.en):"";return{text:f?w.changed(f):w.open,editing:!1,slide:p}}let a=ne(e,n),c="";if(r?.mode==="present")c=w.presenting;else if(r?.mode==="grid")c=w.overview;else if(typeof r?.slideIndex=="number"&&r.slideIndex>0)c=w.slide(r.slideIndex,j(r.slideTitle));else if(r&&Array.isArray(r.visibleArtboards)){let u=Me(r);c=u?w.board(ke(u)):j(r.pageName)?w.board(j(r.pageName)):w.canvas}else j(r?.pageName)?c=w.board(j(r?.pageName)):c=w.open;return!a&&n-e.at>ye&&(c+=` \xB7 ${w.idle}`),{text:c,editing:a,slide:r?.mode==="present"?null:p}}open(){this.pop||!this.people.length||(this.pop=o("div",{class:"pop",role:"dialog","aria-label":w.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 n=o("div",{class:"body"},o("div",{class:"head"},o("h2",{},w.here)));this.people.length||n.append(o("div",{class:"empty"},w.nobody));for(let i of this.people){let r=this.whereOf(i,e),s=o("div",{class:"sub"},r.text);r.editing&&s.append(" \xB7 ",o("span",{class:"on"},w.editing));let p=o("div",{class:"name"},i.name),a=i.agent?"":w.roles[i.role]??"";a&&p.append(o("span",{class:"role"},a));let c=o("div",{class:"who"},p,s),u=r.slide?o("button",{class:"peer",type:"button",title:w.go}):o("div",{class:"peer"});if(u.append(this.avatar(i,e),c),r.slide){let f=r.slide;u.insertAdjacentHTML("beforeend",`<span class="go">${xe.go}</span>`),u.addEventListener("click",()=>{f.click(),f.scrollIntoView({block:"nearest"}),this.close()})}n.append(u)}this.presence?.peers().some(i=>i.kind!=="agent"&&B(i))&&n.append(o("div",{class:"hint"},w.note)),this.pop.replaceChildren(n),this.position()}position=()=>{if(!this.pop)return;let e=window.innerWidth,n=window.innerHeight,i=this.node.getBoundingClientRect(),r=i.width>0&&i.bottom>0&&i.top<n,s=Math.min(320,e-24),p=r?i.right+40:e-16,a=Math.max(12,Math.min(p-s,e-s-12)),c=r?i.bottom+10:56;if(Object.assign(this.pop.style,{left:`${a}px`,top:`${c}px`,width:`${s}px`,maxHeight:`${Math.max(200,n-c-12)}px`}),r){let u=Math.max(a+18,Math.min(i.left+i.width/2-7,a+s-32));Object.assign(this.caret.style,{display:"",left:`${u}px`,top:`${c-7}px`})}else this.caret.style.display="none"};onPointer=e=>{let n=e.composedPath();!this.pop||n.includes(this.pop)||n.includes(this.node)||this.close()};onKey=e=>{e.key==="Escape"&&(e.stopPropagation(),e.preventDefault(),this.close(),this.node.focus())};checkHint(e,n){for(let i of this.hinted.keys())this.people.some(r=>r.key===i&&Te(r.latest)===this.hinted.get(i))||this.hinted.delete(i);if(e.size)for(let i of this.people){let r=Te(i.latest);if(!(!r||!e.has(r)||this.hinted.get(i.key)===r)&&!(!i.agent&&!ne(i,n))){this.hinted.set(i.key,r),this.showHint(i,n,r);return}}}showHint(e,n,i){window.clearTimeout(this.hintTimer),this.hint?.remove();let r=this.node.getBoundingClientRect();if(!r.width)return;this.layer.isConnected||document.body.append(this.layer);let s=o("div",{class:"hint-note",role:"status"},this.avatar(e,n),o("span",{},e.agent?w.hintAgent:i.startsWith("board:")?w.hintEditBoard(e.name,ke(i.slice(i.indexOf(":",6)+1))):w.hintEdit(e.name)));this.layerWrap.append(s);let p=s.getBoundingClientRect().width;Object.assign(s.style,{top:`${r.bottom+10}px`,left:`${Math.max(12,Math.min(r.right-p,window.innerWidth-p-12))}px`}),this.hint=s,this.hintTimer=window.setTimeout(()=>{s.remove(),this.hint===s&&(this.hint=null)},Ue)}};function Se(){return new ie}var C=window.__baoyuShare??{},M=C.role==="owner";ce(M);ge(M);var W=C.noun??{en:"artifact",zh:"\u5185\u5BB9",zhThis:"\u8FD9\u4EFD\u5185\u5BB9"},oe=["editor","commenter","viewer"],d=y?{share:"\u5206\u4EAB",export:"\u5BFC\u51FA",sendTitle:"\u8981\u53D1\u7ED9\u522B\u4EBA\uFF1F",sendText:"\u53D1\u94FE\u63A5\u800C\u4E0D\u662F\u6587\u4EF6\uFF0C\u5BF9\u65B9\u770B\u5230\u7684\u59CB\u7EC8\u662F\u6700\u65B0\u7248\u672C\u3002",invitePeople:"\u9080\u8BF7",joinAs:t=>`\u6253\u5F00\u8FD9\u4E2A\u94FE\u63A5\u7684\u4EBA\u4EE5\u300C${t}\u300D\u8EAB\u4EFD\u52A0\u5165\u3002\u8981\u7ED9\u522B\u7684\u89D2\u8272\uFF0C\u70B9\u300C\u9080\u8BF7\u300D\u3002`,noLinks:"\u94FE\u63A5\u90FD\u5173\u7740\u3002\u70B9\u300C\u9080\u8BF7\u300D\u5F00\u542F\u4E00\u4E2A\u3002",title:`\u5206\u4EAB${W.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:C.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:t=>`\u66F4\u6539\u300C${t}\u300D\u7684\u89D2\u8272`,linkOff:"\u94FE\u63A5\u5DF2\u5173\u95ED",online:"\u5728\u7EBF",seen:t=>`${t}\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:t=>`\u79FB\u51FA\u300C${t}\u300D\uFF1F`,removeText:`\u5BF9\u65B9\u5C06\u65E0\u6CD5\u518D\u8BBF\u95EE${W.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:"\u73B0\u5728\u53EA\u6709\u8FD9\u53F0\u7535\u8111\u80FD\u6253\u5F00\u3002\u590D\u5236\u94FE\u63A5\u4F1A\u628A\u5B83\u5F00\u653E\u5230\u5C40\u57DF\u7F51\u3002",whereOn:t=>`\u5C40\u57DF\u7F51\u5730\u5740\uFF1A${t}`,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",copyTailnet:"\u590D\u5236 Tailscale \u94FE\u63A5",copyTailnetNote:t=>`\u7ED9\u540C\u4E00 tailnet \u91CC\u4E0D\u5728\u8FD9\u4E2A\u7F51\u7EDC\u7684\u4EBA\uFF08${t}\uFF09`,onTailnet:t=>`Tailscale\uFF1A${t}\uFF0C\u540C\u4E00 tailnet \u7684\u4EBA\u5728\u522B\u7684\u7F51\u7EDC\u4E5F\u80FD\u6253\u5F00\uFF08\u590D\u5236\u5728\u94FE\u63A5\u7684\u300C\u66F4\u591A\u300D\u91CC\uFF09`,plainHttp:"\u8FD9\u662F\u660E\u6587 HTTP\uFF1A\u540C\u4E00\u7F51\u7EDC\u91CC\u7684\u4EBA\u53EF\u80FD\u770B\u5230\u4F20\u8F93\u7684\u5185\u5BB9\u3002\u94FE\u63A5\u5C31\u662F\u6743\u9650\uFF1A\u62FF\u5230\u94FE\u63A5\u7684\u4EBA\u5C31\u6709\u5B83\u7684\u89D2\u8272\uFF0C\u53EA\u53D1\u7ED9\u8BE5\u6709\u7684\u4EBA\uFF1B\u4F20\u51FA\u53BB\u4E86\u5C31\u91CD\u7F6E\u94FE\u63A5\u3002",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:t=>`\u91CD\u7F6E\u300C${t}\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",export:"Export",sendTitle:"Sending this to someone?",sendText:"Share the link instead of a file and they will always have the latest changes.",invitePeople:"Invite people",joinAs:t=>`People who open this link join as ${t.toLowerCase()}. Invite people to give another role.`,noLinks:"All the links are off. Invite people to turn one on.",title:`Share this ${W.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:C.reactions?"Comment and react, no edits":"Comment, no edits",viewer:"Read only"},changeRole:t=>`Change ${t}'s role`,linkOff:"Link off",online:"Online",seen:t=>`Seen ${t}`,paused:"Link off: no access until it is back on",none:"Nobody has joined yet. Send someone a link below.",remove:"Remove",removeTitle:t=>`Remove ${t}?`,removeText:`They lose access to this ${W.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 for now. Copying one opens this to your network.",whereOn:t=>`On this network at ${t}`,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",copyTailnet:"Copy Tailscale link",copyTailnetNote:t=>`For people on your tailnet, off this network (${t})`,onTailnet:t=>`Tailscale: ${t}, for people on your tailnet from any network (copy it from a link's More menu)`,plainHttp:"This is plain HTTP: others on the network can read what passes. A link is the permission: whoever has it gets its role, so send it only to the people meant to have it, and reset a link that went further.",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:t=>`Reset the "${t}" link?`,resetText:"The old link stops working and the people who joined with it lose access.",cancel:"Cancel",failed:"Could not do that: "},x={share:b('<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:b('<path d="M4 4l8 8M12 4l-8 8"/>',18),chevron:b('<path d="M4.5 6.2 8 9.7l3.5-3.5"/>',14),check:b('<path d="M3 8.6 6.3 11.8 13 4.6"/>',18),trash:b('<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:b('<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:b('<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:b('<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:b('<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:b('<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),people:b('<circle cx="6" cy="5.4" r="2.4"/><path d="M1.8 13.4c.3-2.5 2-3.9 4.2-3.9s3.9 1.4 4.2 3.9M10.4 3.3a2.4 2.4 0 0 1 0 4.2M12 9.9c1.2.5 2 1.7 2.2 3.5"/>',16),viewer:b('<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 Pe(t){let e=await fetch("/__share",t?{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}:{cache:"no-store"}),n=await e.json();if(!e.ok)throw new Error(n?.message??`HTTP ${e.status}`);return n}var re=class{host=o("span",{"data-baoyu-share":""});root=this.host.attachShadow({mode:"open"});wrap=o("div",{class:"wrap seat"});button=o("button",{class:"open float",type:"button","aria-haspopup":"dialog","aria-expanded":"false"});history=be();presence=Se();look="float";layer=o("div",{"data-baoyu-share-layer":""});layerRoot=this.layer.attachShadow({mode:"open"});layerWrap=o("div",{class:"wrap"});pop=null;caret=o("div",{class:"caret"});menu=null;menuAnchor=null;menuJustClosed=null;asking=null;view=null;invites=null;error="";timer;tab="share";copied=null;constructor(){this.root.append(o("style",{},E+ve+Ee),this.wrap),this.layerRoot.append(o("style",{},E+fe),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(),M&&Pe().then(e=>{this.view=e,this.paintButton()},()=>{})}mount(){let e=()=>{let n=Qe();if(!n){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,r,s]=n;i==="into"&&this.host.parentNode!==r&&r.append(this.host),i==="first"&&r.firstChild!==this.host&&r.prepend(this.host),i==="before"&&r.previousSibling!==this.host&&r.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=M&&!!this.view?.lan;this.button.innerHTML=x.share,this.look==="tool"?(this.button.setAttribute("aria-label",d.share),this.button.title=e?`${d.share} \xB7 ${d.onLan}`:d.share):(this.button.removeAttribute("aria-label"),this.button.removeAttribute("title"),this.button.append(d.share)),e&&this.button.append(o("span",{class:"dot",title:d.onLan}))}async open(){if(this.pop)return;this.pop=o("div",{class:"pop",role:"dialog","aria-label":d.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=M?()=>this.refresh():()=>this.refreshInvites();M||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.tab="share",this.caret.remove(),this.layer.remove(),this.button.setAttribute("aria-expanded","false"),this.button.focus()}position=()=>{if(!this.pop)return;let e=window.innerWidth,n=window.innerHeight,i=this.button.getBoundingClientRect(),r=i.width>0&&i.bottom>0&&i.top<n,s=Math.min(460,e-24),p=r?i.right:e-16,a=Math.max(12,Math.min(p-s,e-s-12)),c=r?i.bottom+10:56;if(Object.assign(this.pop.style,{left:`${a}px`,top:`${c}px`,width:`${s}px`,maxHeight:`${Math.max(240,n-c-12)}px`}),r){let u=Math.max(a+18,Math.min(i.left+i.width/2-7,a+s-32));Object.assign(this.caret.style,{display:"",left:`${u}px`,top:`${c-7}px`})}else this.caret.style.display="none";this.menu&&this.menuAnchor&&this.placeMenu(this.menu,this.menuAnchor)};onPointer=e=>{let n=e.composedPath();this.menu&&!n.includes(this.menu)&&(this.menuJustClosed=this.menuAnchor,this.closeMenu(),setTimeout(()=>this.menuJustClosed=null,0)),!(!this.pop||n.includes(this.pop)||n.includes(this.button)||this.menu&&n.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 n=this.menuAnchor;this.closeMenu(),n?.focus()}else this.close()};async refresh(e){let n=JSON.stringify([this.view,this.error]);try{this.view=await Pe(e),this.error=""}catch(i){this.error=d.failed+i.message}this.paintButton(),!(!e&&(this.menu||this.asking||this.pop?.firstChild&&JSON.stringify([this.view,this.error])===n))&&this.paint()}async refreshInvites(){let e=JSON.stringify([this.invites,this.error]);try{let n=await fetch("/__share/invite",{cache:"no-store"}),i=await n.json();if(!n.ok)throw new Error(i?.message??`HTTP ${n.status}`);this.invites=i.links,this.error=""}catch(n){this.error=d.failed+n.message}JSON.stringify([this.invites,this.error])!==e&&this.paintGuest()}openMenu(e,n){if(this.menuJustClosed===e)return;this.closeMenu();let i=o("div",{class:"menu",role:"menu"});for(let r of n){let s=o("button",{class:`item${r.danger?" danger":""}`,type:"button",role:r.checked===void 0?"menuitem":"menuitemradio"});r.checked!==void 0&&s.setAttribute("aria-checked",String(r.checked)),s.disabled=r.disabled===!0,s.append(o("span",{class:"who"},o("span",{class:"name"},r.label),...r.sub?[o("span",{class:"sub"},r.sub)]:[])),r.checked!==void 0&&s.append(o("span",{class:"tick",html:r.checked?x.check:""})),s.addEventListener("click",()=>{this.closeMenu(),e.focus({preventScroll:!0}),r.run()}),i.append(s)}i.addEventListener("keydown",r=>{let s=[...i.querySelectorAll("button:not(:disabled)")],p=s.indexOf(this.layerRoot.activeElement),a=c=>s[(c+s.length)%s.length]?.focus();if(r.key==="ArrowDown")a(p+1);else if(r.key==="ArrowUp")a(p-1);else if(r.key==="Home")a(0);else if(r.key==="End")a(-1);else if(r.key==="Tab")this.closeMenu();else return;r.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,n){let i=n.getBoundingClientRect(),r=e.getBoundingClientRect(),s=window.innerWidth,p=window.innerHeight,c=n.classList.contains("wide")?i.left:i.right-r.width;c=Math.max(12,Math.min(c,s-r.width-12));let u=i.bottom+6;u+r.height>p-12&&i.top-r.height-6>12&&(u=i.top-r.height-6),Object.assign(e.style,{left:`${c}px`,top:`${u}px`})}closeMenu(){this.menu?.remove(),this.menuAnchor?.setAttribute("aria-expanded","false"),this.menu=null,this.menuAnchor=null}ask(e,n,i){return new Promise(r=>{if(!this.pop)return r(!1);this.closeMenu();let s=o("div",{class:"ask",role:"alertdialog","aria-modal":"true","aria-label":e}),p=v("btn",{},"",d.cancel),a=v("btn danger",{},"",i),c=u=>{this.asking=null,s.remove(),r(u)};p.addEventListener("click",()=>c(!1)),a.addEventListener("click",()=>c(!0)),s.addEventListener("mousedown",u=>u.target===s&&c(!1)),s.append(o("div",{class:"ask-card"},o("h3",{},e),o("p",{},n),o("div",{class:"ask-row"},p,a))),this.asking=()=>c(!1),this.pop.append(s),p.focus()})}paint(){if(!this.pop||!this.view)return;let e=this.view;if(this.tab==="export")return this.paintExport(e.title||d.title);let n=this.layerRoot.activeElement?.getAttribute("data-key"),i=this.pop.querySelector(".body")?.scrollTop??0,r=o("div",{class:"body"}),s=v("icon muted",{"aria-label":d.close,title:d.close,"data-key":"close"},x.close);s.addEventListener("click",()=>this.close()),r.append(o("div",{class:"head"},o("h2",{},e.title||d.title),s),...this.tabs()),r.append(o("div",{class:"label"},d.peopleWithAccess));let p=C.name??"";r.append(o("div",{class:"row"},o("div",{class:"avatar",style:`background:${H("local"+p)}`},S(p)),o("div",{class:"who"},o("div",{class:"name"},p,o("span",{class:"faint"},d.you)),o("div",{class:"sub"},d.thisComputer)),o("span",{class:"select static",html:`<span>${d.owner}</span>${x.chevron}`}))),r.append(o("div",{class:"label"},d.joinedPeople)),e.guests.length||r.append(o("div",{class:"empty"},d.none));for(let h of[...e.guests].sort((g,m)=>Number(m.online)-Number(g.online)||(m.seen??m.joined).localeCompare(g.seen??g.joined))){let g=h.online?d.online:h.active?d.seen(le(h.seen??h.joined)):d.paused,m=v("select",{"aria-haspopup":"menu","aria-expanded":"false","aria-label":d.changeRole(h.name),"data-key":`role-${h.id}`},"",d.roleNames[h.role],x.chevron);m.addEventListener("click",()=>this.openMenu(m,oe.map(k=>({label:d.roleNames[k],sub:e.links[k].on?void 0:d.linkOff,checked:k===h.role,disabled:!e.links[k].on,run:()=>k!==h.role&&void this.refresh({action:"role",guest:h.id,role:k})}))));let L=v("icon muted",{"aria-label":`${d.remove} ${h.name}`,title:d.remove,"data-key":`rm-${h.id}`},x.trash);L.addEventListener("click",async()=>{await this.ask(d.removeTitle(h.name),d.removeText,d.remove)&&this.refresh({action:"remove",guest:h.id})}),r.append(o("div",{class:`row${h.active?"":" paused"}`},o("div",{class:`avatar${h.online?" on":""}`,style:`background:${H(h.id)}`},S(h.name)),o("div",{class:"who"},o("div",{class:"name"},h.name),o("div",{class:`sub${h.online?" on":""}`},g)),m,L))}r.append(o("div",{class:"label"},d.generalAccess));let a=e.addresses.filter(h=>h!==e.tailnet?.address),c=e.lan?e.addresses.length?d.whereOn((a.length?a:e.addresses).map(h=>`${h}:${e.port}`).join(" \xB7 ")):d.noAddress:d.whereOff,u=v("select wide",{"aria-haspopup":"menu","aria-expanded":"false","data-key":"lan"},"",e.lan?d.onLan:d.onlyHere,x.chevron);u.addEventListener("click",()=>this.openMenu(u,[{label:d.onlyHere,sub:d.onlyHereNote,checked:!e.lan,run:()=>e.lan&&void this.refresh({action:"lan",on:!1})},{label:d.onLan,sub:d.onLanNote,checked:e.lan,run:()=>!e.lan&&void this.refresh({action:"lan",on:!0})}])),r.append(o("div",{class:"row"},o("div",{class:"circle",html:e.lan?x.network:x.lock}),o("div",{class:"who"},u,o("div",{class:"sub multi"},c),...e.lan&&e.tailnet?[o("div",{class:"sub multi"},d.onTailnet(`${e.tailnet.address}:${e.port}`))]:[]))),r.append(o("div",{class:"label"},d.inviteLinks));for(let h of oe){let g=e.links[h],m;g.on?m=this.copyButton(h,g.networkUrl??g.url):(m=v("pill",{"data-key":`copy-${h}`},"",d.turnOn),m.addEventListener("click",()=>void this.refresh({action:"link",role:h,on:!0})));let L=v("icon muted",{"aria-haspopup":"menu","aria-expanded":"false","aria-label":`${d.more}: ${d.linkTitles[h]}`,title:d.more,"data-key":`more-${h}`},x.more);L.addEventListener("click",()=>this.openMenu(L,[...g.on&&e.lan&&e.tailnet?[{label:d.copyTailnet,sub:d.copyTailnetNote(e.tailnet.address),run:()=>void this.copyUrl(h,e.tailnet.links[h].url)}]:[],g.on?{label:d.turnOffLink,sub:d.turnOffNote,run:()=>void this.refresh({action:"link",role:h,on:!1})}:{label:d.turnOnLink,run:()=>void this.refresh({action:"link",role:h,on:!0})},{label:d.resetLink,sub:d.resetNote,danger:!0,run:async()=>{await this.ask(d.resetTitle(d.linkTitles[h]),d.resetText,d.resetLink)&&this.refresh({action:"reset",role:h})}}])),r.append(o("div",{class:`row${g.on?"":" off"}`,title:g.on?g.networkUrl??g.url:""},o("div",{class:"circle",html:x[h]}),o("div",{class:"who"},o("div",{class:"name"},d.linkTitles[h]),o("div",{class:"sub"},g.on?d.roleNotes[h]:d.linkOffNote)),m,L))}e.lan&&r.append(o("div",{class:"hint","data-baoyu-share-security":""},d.plainHttp)),this.error&&r.append(o("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(r),r.scrollTop=i,this.position(),((n?r.querySelector(`[data-key="${n}"]`):null)??s).focus({preventScroll:!0})}paintGuest(){if(!this.pop)return;let e=this.layerRoot.activeElement?.getAttribute("data-key"),n=o("div",{class:"body"}),i=v("icon muted",{"aria-label":d.close,title:d.close,"data-key":"close"},x.close);if(i.addEventListener("click",()=>this.close()),n.append(o("div",{class:"head"},o("h2",{},C.title||document.title||d.title),i)),this.invites?.length){n.append(o("div",{class:"label"},d.inviteLinks));for(let{role:s,url:p}of this.invites)n.append(o("div",{class:"row",title:p},o("div",{class:"circle",html:x[s]}),o("div",{class:"who"},o("div",{class:"name"},d.linkTitles[s]),o("div",{class:"sub"},d.roleNotes[s])),this.copyButton(s,p)));n.append(o("div",{class:"hint"},d.guestInviteNote),o("div",{class:"hint","data-baoyu-share-security":""},d.plainHttp),o("div",{class:"rule"}))}n.append(o("div",{class:"foot"},o("div",{class:"note"},d.onlyAccess),this.copyButton("page",location.origin+location.pathname))),this.error&&n.append(o("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(n),this.position(),((e?n.querySelector(`[data-key="${e}"]`):null)??i).focus({preventScroll:!0})}tabs(){if(!M||!X().length)return[];let e=(n,i)=>{let r=v("tab",{role:"tab","aria-selected":String(this.tab===n),"data-key":`tab-${n}`},"",i);return r.addEventListener("click",()=>this.showTab(n)),r};return[o("div",{class:"tabs",role:"tablist"},e("share",d.share),e("export",d.export))]}showTab(e){this.tab!==e&&(this.tab=e,this.pop?.querySelector(".body")?.scrollTo(0,0),this.paint())}paintExport(e){if(!this.pop)return;let n=this.layerRoot.activeElement?.getAttribute("data-key"),i=o("div",{class:"body"}),r=v("icon muted",{"aria-label":d.close,title:d.close,"data-key":"close"},x.close);r.addEventListener("click",()=>this.close()),i.append(o("div",{class:"head"},o("h2",{},e),r),...this.tabs());let s=o("div",{class:"send-row"}),p=this.view,a=[...oe].reverse().find(h=>p.links[h].on);s.append(this.inviteButton()),a&&s.append(this.copyButton(a,p.links[a].networkUrl??p.links[a].url));let c=a?p.lan?d.joinAs(d.roleNames[a]):d.whereOff:d.noLinks,u=o("div",{class:"send"},o("div",{class:"who"},o("h3",{},d.sendTitle),o("p",{},d.sendText),s,o("div",{class:"note"},c)));u.insertAdjacentHTML("afterbegin",x.people),i.append(u,me(X(),h=>{this.close(),h.run()})),this.error&&i.append(o("div",{class:"err",role:"alert"},this.error)),this.pop.replaceChildren(i),this.position(),((n?i.querySelector(`[data-key="${CSS.escape(n)}"]`):null)??r).focus({preventScroll:!0})}inviteButton(){let e=v("primary",{"data-key":"invite"},x.people,d.invitePeople);return e.addEventListener("click",()=>this.showTab("share")),e}copyButton(e,n){let i=this.copied===e,r=v(`pill${i?" done":""}`,{"data-key":`copy-${e}`},i?x.check:x.link,i?d.copied:d.copyLink);return r.addEventListener("click",()=>void this.copyUrl(e,n)),r}async copyUrl(e,n){let i=()=>M?this.paint():this.paintGuest();await de(n),this.copied=e,i(),M&&!this.view?.lan&&this.refresh({action:"lan",on:!0}),setTimeout(()=>{this.copied===e&&(this.copied=null,!this.menu&&!this.asking&&i())},1600)}};function Qe(){let t=document.querySelector("[data-baoyu-share-seat]")??document.querySelector("[data-baoyu-comments]")?.shadowRoot?.querySelector("[data-baoyu-share-seat]");if(t)return["into",t,"header"];let e=document.querySelector('[data-testid="ldoc-comments-btn"]'),n=e?.closest(".ml-auto")??e?.parentElement?.parentElement;if(n)return["first",n,"header"];let i=document.querySelector("[data-baoyu-comments-seat]");if(i)return["before",i,"tool"];let r=document.querySelector("header.tb-root .tb-card-end");return r?["first",r,"bar"]:null}var Ae=()=>new re().mount();document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Ae,{once:!0}):Ae();
@@ -2917,7 +2917,7 @@ async function writeZip(entries, write) {
2917
2917
  for (const entry of entries) {
2918
2918
  let data;
2919
2919
  try {
2920
- data = await fsp2.readFile(entry.file);
2920
+ data = entry.data ?? await fsp2.readFile(entry.file);
2921
2921
  } catch (error) {
2922
2922
  if (error.code === "ENOENT") continue;
2923
2923
  throw error;