@leonidstern/labit 0.0.0-stage → 0.6.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/.claude-plugin/marketplace.json +14 -0
- package/.claude-plugin/plugin.json +12 -0
- package/CHANGELOG.md +282 -0
- package/LICENSE +21 -0
- package/README.md +46 -2
- package/api/lab-comments.mjs +439 -0
- package/dist/chunk-T4IF6ZJQ.mjs +106 -0
- package/dist/commands-BPVIWBCF.mjs +255 -0
- package/dist/devserver-KCLPMBNL.mjs +56 -0
- package/dist/local.mjs +1487 -0
- package/dist/mcp-BKU67CST.mjs +192 -0
- package/dist/proxy-FLFZV6EI.mjs +74 -0
- package/package.json +49 -4
- package/public/_lab/comments.js +46 -0
- package/public/_lab/favicon.svg +1 -0
- package/public/_lab/lab.css +129 -0
- package/skills/labit/SKILL.md +57 -0
- package/skills/labit/zoom.md +29 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
(()=>{var qn=':host{all:initial;--_bg: var(--lab-bg, #fff);--_fg: var(--lab-fg, #141414);--_accent: var(--lab-accent, #141414);--_accent-fg: var(--lab-accent-fg, #fff);--_radius: var(--lab-radius, 12px);--_r-s: 6px ;--_soft: var(--lab-soft, rgba(0,0,0,.05));--_hover: var(--lab-hover, rgba(0,0,0,.1));--_line: var(--lab-line, rgba(0,0,0,.15));--_edge: var(--lab-edge, #c7c7cc);--_muted: var(--lab-muted, rgba(0,0,0,.5));--_hair: .5px solid color-mix(in srgb, var(--_fg) 16%, transparent);--_shadow: 0 0 0 .5px color-mix(in srgb, var(--_fg) 14%, transparent), 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.08);--_ease: cubic-bezier(.2, .8, .2, 1)}@media(prefers-color-scheme:dark){:host{--_bg: var(--lab-bg, #1c1c1e);--_fg: var(--lab-fg, #f4f4f5);--_accent: var(--lab-accent, #f4f4f5);--_accent-fg: var(--lab-accent-fg, #141414);--_soft: var(--lab-soft, rgba(255,255,255,.05));--_hover: var(--lab-hover, rgba(255,255,255,.1));--_line: var(--lab-line, rgba(255,255,255,.15));--_edge: var(--lab-edge, #48484a);--_muted: var(--lab-muted, rgba(255,255,255,.5));--_shadow: 0 0 0 1px color-mix(in srgb, var(--_fg) 16%, transparent), 0 10px 32px rgba(0,0,0,.5)}}*{box-sizing:border-box;font-family:var(--lab-font, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:14px;line-height:1.4;font-weight:400;color:var(--_fg);letter-spacing:-.011em;font-feature-settings:var(--lab-font-features, normal);font-synthesis:none;font-optical-sizing:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;caret-color:var(--_accent);-webkit-tap-highlight-color:transparent}::selection{background:color-mix(in srgb,var(--_accent) 38%,transparent);color:var(--_fg)}button:focus-visible{outline:2px solid var(--_accent);outline-offset:2px}.layer{position:absolute;top:0;left:0;width:0;height:0}.pin{position:absolute;width:28px;height:28px;margin:-28px 0 0;border-radius:14px 14px 14px 2px;background:var(--_bg);border:0;box-shadow:0 0 0 1px var(--_edge),0 2px 8px #00000029;display:grid;place-items:center;cursor:pointer;padding:0;color:var(--_fg);font-size:12px;font-weight:500;font-variant-numeric:tabular-nums;letter-spacing:0;transform-origin:0 100%;transition:transform .16s var(--_ease),box-shadow .16s var(--_ease),opacity .16s}button.pin:hover,button.pin.open{transform:scale(1.08);box-shadow:0 0 0 1.5px #24a046,0 4px 14px #0003}button.pin:active{transform:scale(.96)}.pin.in{animation:lab-pin .26s var(--_ease)}.pin.arrive{animation:lab-arrive .46s cubic-bezier(.34,1.56,.64,1) both}@keyframes lab-arrive{0%{opacity:0;transform:scale(.7)}}.pin.swap{animation:lab-swap .36s cubic-bezier(.3,.7,.4,1.25)}@keyframes lab-swap{0%{transform:scale(.72);opacity:.35}}.pin .ring.gone{animation:lab-gone .3s ease-in forwards}@keyframes lab-gone{to{opacity:0}}button.pin.in:before{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;animation:lab-halo .9s cubic-bezier(.2,.7,.3,1) forwards}.pin.resolved{color:var(--_muted)}button.pin.go{background:var(--_bg);color:#24a046;font-size:11px;font-weight:600;letter-spacing:.006em;box-shadow:inset 0 0 0 1.5px #24a046,0 2px 8px #00000029}button.pin.go.done{background:#24a046;color:#fff;box-shadow:0 0 0 .5px color-mix(in srgb,var(--_fg) 22%,transparent),0 2px 8px #00000029}button.pin.done:not(.go){color:#24a046}.pin.moved{opacity:.5;scale:.8}button.pin.moved:hover,button.pin.moved.open{opacity:1}.pin.grab{touch-action:none}button.pin.dragging{cursor:grabbing;transform:scale(1.1);opacity:1;box-shadow:0 0 0 .5px color-mix(in srgb,var(--_fg) 30%,transparent),0 8px 20px #00000038}.zone{position:absolute;background:none;border-radius:var(--_radius);pointer-events:none}.zone svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}.zone rect{fill:none;stroke-linecap:round;stroke-dasharray:0 4;rx:var(--lab-radius, 12px);ry:var(--lab-radius, 12px)}.zone rect.ring{display:none}.zone rect.dots{stroke:#34c759;stroke-width:1.5}.zone.live{left:0;top:0;will-change:transform,width,height;animation:lab-fade .12s ease-out}.pin .ring{position:absolute;inset:-4px;border-radius:18px 18px 18px 6px;padding:2px;overflow:hidden;pointer-events:none;-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0)}.ring:before{content:"";position:absolute;inset:-50%;will-change:transform;background:conic-gradient(rgb(52,199,89) 0 var(--lab-arc, 66%),rgba(52,199,89,.22) var(--lab-arc, 66%) 100%);animation:lab-turn 1.2s linear infinite}@keyframes lab-turn{to{transform:rotate(360deg)}}.pin .ring.come:before{animation:lab-draw .4s ease-out,lab-turn 1.2s linear infinite}@keyframes lab-draw{0%{--lab-arc: 0%}}.ptr{position:fixed;left:0;top:0;width:28px;height:28px;border-radius:14px 14px 14px 2px;corner-shape:round;background:var(--_bg);box-shadow:0 0 0 .5px color-mix(in srgb,var(--_fg) 30%,transparent),0 2px 6px #0000002e;display:grid;place-items:center;pointer-events:none;z-index:2147483647;opacity:0;will-change:transform;transition:opacity .12s ease-out,background-color .16s ease-out}.ptr.show{opacity:1}.ptr span{grid-area:1 / 1;font-size:12px;letter-spacing:0;font-weight:600;line-height:1;transition:opacity .16s ease-out,transform .16s ease-out}.ptr .tick{opacity:0;transform:scale(.5);color:#fff;font-size:11px;letter-spacing:.006em}.ptr.go{background:#24a046}.ptr.go .ini{opacity:0;transform:scale(.5)}.ptr.go .tick{opacity:1;transform:none}.pin.new:after{content:"";position:absolute;top:-4px;right:-4px;width:9px;height:9px;border-radius:50%;background:var(--_fg);box-shadow:0 0 0 2px var(--_bg)}.dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--_accent);margin:0 6px 1px 0}.card{position:absolute;width:320px;max-width:calc(100vw - 24px);background:var(--_bg);border-radius:var(--_radius);box-shadow:var(--_shadow);padding:12px 14px 14px;transform-origin:14px 0;z-index:1;display:flex;flex-direction:column;max-height:min(460px,62vh)}.card>.body{flex:0 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;margin-right:-8px;padding-right:8px}.card>.foot{flex:none}.card.in,.float.in{animation:lab-in .18s var(--_ease)}.card.out,.float.out{animation:lab-out .14s ease-in forwards;pointer-events:none}.item{display:grid;row-gap:3px}.item+.item{margin-top:14px}.msg.item{display:block}.msg.item+.msg.item{margin-top:0}.meta{display:flex;align-items:baseline;gap:.5em;font-size:12px;color:var(--_muted);margin:0;white-space:nowrap;letter-spacing:0;font-variant-numeric:tabular-nums}.meta b{font-weight:500;font-size:13px;letter-spacing:-.006em;min-width:0;overflow:hidden;text-overflow:ellipsis}.meta .dot{flex:none;align-self:center;margin:0}.meta .ago{white-space:nowrap}.text{white-space:pre-wrap;overflow-wrap:anywhere;text-wrap:pretty}.row{display:flex;gap:12px;justify-content:flex-start;align-items:center;margin-top:8px}.card .row:not(.nav){justify-content:flex-end;gap:10px}.card .row:not(.nav) button.btn{font-size:12px;letter-spacing:0}button.btn{border:0;padding:2px 0;cursor:pointer;background:none;color:var(--_muted);font-size:12px;letter-spacing:0;border-radius:var(--_r-s);transition:color .12s}button.btn:hover{color:var(--_fg)}button.btn.danger,button.btn.danger:hover{color:#e5484d}.row .ask{white-space:nowrap;color:var(--_fg);font-size:12px;letter-spacing:0;padding:2px 0;animation:lab-fade .12s ease-out}.float{position:absolute;width:320px;max-width:calc(100vw - 24px);transform-origin:0 20px;z-index:1}.card .composer{margin-top:6px}.card>.body>.row:not(.nav){margin-right:7px}.box{display:grid;grid-template-columns:1fr auto;grid-template-areas:"text send";align-items:center;column-gap:8px;border-radius:var(--_radius);padding:7px 7px 7px 14px;margin:0;transition:box-shadow .15s;background:var(--_box-bg, var(--_soft));box-shadow:var(--_box-edge, none)}.float{--_box-bg: var(--_bg);--_box-edge: 0 0 0 1px var(--_edge), 0 1px 2px rgba(0,0,0,.06), 0 8px 26px rgba(0,0,0,.14)}.box.open{grid-template-areas:"text text" "line line" "who send";row-gap:8px;padding:7px 7px 8px 14px}.box textarea{grid-area:text;width:100%;border:0;background:none;padding:2px 0;line-height:20px;margin:0;resize:none;min-height:0;max-height:200px;overflow-y:auto;outline:none;display:block}.box textarea::placeholder,.who input::placeholder{color:var(--_muted);opacity:1}.line{grid-area:line;height:0;border-top:var(--_hair);margin:0 -7px 0 -14px;display:none}.who{grid-area:who;display:none;align-items:baseline;gap:4px;min-width:0;font-size:13px;color:var(--_muted);letter-spacing:-.006em}.who *{font-size:13px;letter-spacing:-.006em}.who span{color:var(--_muted)}.who input{flex:1;min-width:0;border:0;background:none;padding:0;margin:0;outline:none;color:var(--_muted);text-overflow:ellipsis}.who input:focus{color:var(--_fg)}.box.open .line{display:block;animation:lab-fade .16s ease-out}.box.open .who{display:flex;animation:lab-fade .16s ease-out}.box.one,.box.one.open{grid-template-columns:minmax(0,1fr) auto auto;grid-template-areas:"text who send";align-items:end;row-gap:0;padding:7px 7px 7px 14px}.box.one .line{display:none!important}.box.one .who{align-self:end;line-height:20px;padding-bottom:2px;max-width:40%}.box.one .who input{flex:none;field-sizing:content;min-width:2ch;max-width:9em}.send{grid-area:send;width:24px;height:24px;border-radius:50%;border:0;padding:0;cursor:pointer;background:var(--_hover);color:var(--_muted);display:grid;place-items:center;transition:background .15s,color .15s,transform .15s var(--_ease)}.send.ready:hover{transform:scale(1.06)}.send.ready:active{transform:scale(.94)}.send.ready{background:var(--_accent);color:var(--_accent-fg);animation:lab-ready .16s ease-out}@keyframes lab-ready{50%{transform:scale(1.08)}}.send .arr{display:block;position:relative;left:-1px;width:12px;height:11px;background:currentColor;clip-path:polygon(0 42%,100% 0,66% 100%,46% 60%)}.send *{color:inherit}.error{color:#e5484d;font-size:12px;padding:6px 8px 0;letter-spacing:0}.error:empty{display:none}.error.wait{color:var(--_muted)}.bar{position:fixed;right:16px;bottom:16px;display:flex;gap:8px;align-items:center}.bar button{border:0;border-radius:var(--_radius);padding:9px 14px;cursor:pointer;background:var(--_bg);color:var(--_fg);box-shadow:var(--_shadow);font-size:13px;font-weight:500;display:inline-flex;gap:8px;align-items:center;letter-spacing:-.006em;font-variant-numeric:tabular-nums;white-space:nowrap;transition:color .15s,transform .15s var(--_ease)}.bar button:active{transform:scale(.97)}.list{position:fixed;right:16px;bottom:66px;width:min(340px,calc(100vw - 32px));max-height:min(60vh,460px);overflow:hidden;display:flex;flex-direction:column;background:var(--_bg);color:var(--_fg);border-radius:var(--_radius);box-shadow:var(--_shadow);font-size:13px;letter-spacing:-.006em}.list .tabs{display:flex;flex-wrap:wrap;gap:2px;flex:none;padding:12px 8px 6px}.list .items,.msgs{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}.list .items{padding:0 6px 6px}.list .tabs button{border:0;border-radius:var(--_r-s);padding:4px 8px;white-space:nowrap;background:none;color:var(--_muted);cursor:pointer;font:inherit}.list .tabs button.on{background:var(--_fg);color:var(--_bg)}.list .tabs .hold{margin-left:auto}.list .it{display:block;width:100%;text-align:left;border:0;background:none;color:inherit;padding:7px 8px;border-radius:var(--_r-s);cursor:pointer;font:inherit}.list .it:hover,.list .it.cur{background:var(--_hover)}.list .it{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.list .it span,.list .none{color:var(--_muted)}.list .it .tag{display:inline-block;padding:0 7px;border-radius:var(--_r-s);background:var(--_accent);color:var(--_accent-fg);font-size:12px;letter-spacing:0;font-weight:600;line-height:18px;vertical-align:1px;white-space:nowrap}.list .none{padding:8px}*{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--_fg) 24%,transparent) transparent}@supports not (scrollbar-width: thin){::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--_fg) 24%,transparent);border-radius:999px}}.list .group{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--_muted);padding:10px 8px 2px}.pin.held{border:1.5px dashed var(--_muted);opacity:.85}.list .tabs .show-done{color:var(--_muted)}.chatwin .tabs b{display:none}.list .tabs .x{margin-left:auto;flex:none;width:26px;height:26px;padding:0;border-radius:50%;display:grid;place-items:center;font-size:0;color:var(--_muted);background:transparent}.list .tabs .x:before,.list .tabs .x:after{content:"";grid-area:1 / 1;width:12px;height:1.6px;border-radius:1px;background:currentColor;transform:rotate(45deg)}.list .tabs .x:after{transform:rotate(-45deg)}.list .tabs .x:hover{color:var(--_fg)}.list .tabs .x:focus-visible{outline:2px solid var(--_accent);outline-offset:1px}.chatwin .chat{flex:none;background:var(--_bg);padding:6px 6px 8px}.chatwin .replying{flex:none}.chatwin .tabs b{padding:4px 8px;font-weight:600;margin-right:auto}.msgs{display:flex;flex-direction:column;gap:8px;padding:4px 10px 8px;overflow-x:hidden}.msgs>:first-child{margin-top:auto}.fresh{animation:lab-rise .2s var(--_ease)}.send.sent .arr{animation:lab-fly .32s var(--_ease)}@keyframes lab-rise{0%{opacity:0;transform:translateY(6px)}}@keyframes lab-fly{45%{transform:translate(9px,-9px) scale(.6);opacity:0}46%{transform:translate(-7px,7px) scale(.6);opacity:0}}.msg{max-width:85%;padding:7px 10px;border-radius:var(--_radius);background:var(--_soft);align-self:flex-start}.msg.mine{align-self:flex-end;background:color-mix(in srgb,rgb(52,199,89) 15%,var(--_bg));color:var(--_fg)}.msg b{display:block;font-size:12px;letter-spacing:0;font-weight:600;opacity:.7;margin-bottom:1px}.msg[data-agent=claude]{--_brand: #d97757}.msg[data-agent=codex]{--_brand: #10a37f}.msg[data-agent=cursor]{--_brand: #8a8a8e}.msg[data-agent=gemini]{--_brand: #4285f4}.msg[data-agent=copilot]{--_brand: #8957e5}.msg[data-agent=amp]{--_brand: #f34e3f}.msg[data-agent=opencode]{--_brand: #8a8a8e}.msg[data-agent]{background:color-mix(in srgb,var(--_brand) 11%,var(--_bg))}.msg[data-agent]>b{color:var(--_brand);opacity:1}.msg.mine b{display:none}.msg{position:relative}.mark{font-weight:400;font-size:11px;letter-spacing:.006em;color:var(--_muted);margin-left:6px;white-space:nowrap}.mark.done{color:#24a046;font-weight:600;font-size:12px;letter-spacing:0}.msg .quote{display:block;border-left:2px solid rgb(52,199,89);padding:1px 0 1px 8px;margin:3px 0 5px;font-size:12px;letter-spacing:0;line-height:1.35;color:var(--_muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.msg .quote b{display:block;font-size:12px;letter-spacing:0;font-weight:600;color:#24a046;opacity:1;margin:0}.mine .mark{color:inherit;opacity:.7}a.link{color:inherit;text-decoration:underline;text-underline-offset:2px;overflow-wrap:anywhere}.msg.to{box-shadow:0 0 0 2px var(--_accent)}.msg .p{display:block;white-space:pre-wrap;overflow-wrap:anywhere;text-wrap:pretty}.msg .p.gap{margin-top:6px}.msg .p.li{padding-left:14px;text-indent:-14px}.msg .p.li .mk{display:inline-block;width:14px;text-indent:0;opacity:.6}.msg i{display:block;font-style:normal;font-size:12px;letter-spacing:0;opacity:.7;margin-bottom:1px}.msg b,.msg i{color:inherit}.msg .stamp{text-indent:0;color:inherit;position:absolute;right:10px;bottom:6px;font-size:10px;letter-spacing:.012em;line-height:1;opacity:.55;font-variant-numeric:tabular-nums}.msg .stamp-room{text-indent:0;visibility:hidden;display:inline-block;margin-left:10px;font-size:10px;letter-spacing:.012em;line-height:1;height:10px;white-space:nowrap}.msg .stamp-room *{font-size:inherit}.msg .tick{color:inherit;margin-left:4px;letter-spacing:-.34em;font-size:10px}.msg .tick.got{font-weight:600}.msg .stamp:is(.busy,.ans){opacity:1}.msg .stamp:is(.busy,.ans) .tm{opacity:.55}.msg .stamp .tm{font-size:inherit;line-height:inherit;color:inherit}.msg :is(.stamp,.stamp-room) .ring{position:relative;display:inline-block;width:9px;height:9px;margin-left:5px;vertical-align:-1px;border-radius:50%;overflow:hidden;-webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 1.6px),#000 calc(100% - 1.5px));mask:radial-gradient(farthest-side,transparent calc(100% - 1.6px),#000 calc(100% - 1.5px))}.msg .stamp.ans .tick{color:#24a046;letter-spacing:0;font-weight:600}.msg :is(.stamp,.stamp-room) .tick{display:inline-block;width:12px;height:10px;line-height:10px;text-align:center;margin-left:4px;vertical-align:top}.msg :is(.stamp,.stamp-room) .ring{margin:.5px 1.5px 0 5.5px;vertical-align:top}.msg .stamp{height:10px}.replying{display:flex;gap:6px;align-items:center;font-size:12px;letter-spacing:0;color:var(--_muted);padding:2px 6px}.replying button{border:0;background:none;color:inherit;cursor:pointer;margin-left:auto;font:inherit}.bar button *{color:inherit;font-weight:inherit}.bar .toggle:not(.secondary):before{content:"";width:7px;height:7px;border-radius:50%;background:var(--_accent)}.bar button.secondary{color:var(--_muted)}.bar button.secondary.has-new{color:var(--_fg);font-weight:600}.bar button.go-btn.on{color:#fff;background:#24a046}.bar .new-prev,.bar .new-next{padding:9px 11px;font-size:15px;letter-spacing:-.016em;line-height:1;color:var(--_fg)}.bar .list-btn,.bar .done-btn{font-variant-numeric:tabular-nums;min-width:4.6em;justify-content:center}.bar button.quiet{opacity:.45;cursor:default;box-shadow:var(--_shadow)}.bar button.go-btn.on kbd{color:#fff!important}.newline{display:flex;align-items:center;gap:8px;font-size:12px;letter-spacing:0;font-weight:500;color:var(--_muted)}.newline:before,.newline:after{content:"";flex:1;height:1px;background:currentColor;opacity:.35}.left{position:fixed;left:16px;bottom:16px;display:flex;gap:8px;align-items:center}.left .copy-all{border:0;border-radius:var(--_radius);padding:9px 14px;cursor:pointer;background:var(--_bg);color:var(--_muted);box-shadow:var(--_shadow);font:inherit;font-size:13px;letter-spacing:-.006em;font-weight:500;white-space:nowrap}.listener{display:inline-flex;gap:6px;align-items:center;padding:9px 14px;border-radius:var(--_radius);background:var(--_bg);color:var(--_fg);box-shadow:var(--_shadow);font-size:13px;letter-spacing:-.006em;text-decoration:none;white-space:nowrap}.listener span{color:var(--_muted)}.listener .lbl{display:contents}.mark{width:16px;height:16px;flex:none;overflow:visible;fill:var(--_accent)}.mark .eye{fill:var(--_bg)}.listener .mark{margin:-2px 0 -1px -3px}.listener.idle .mark{fill:var(--_muted);opacity:.5}.listener.working .mark{fill:#24a046}.mark :is(.e1,.e2,.eye){transform-box:fill-box;transform-origin:35% 100%}.mark .eye{transform-origin:50% 50%}.listener:not(.idle,.working) .mark .eye{animation:lab-blink 3.2s ease-in-out infinite}.listener.working .mark :is(.e1,.e2){animation:lab-twitch 2.4s ease-in-out infinite}.listener.working .mark .e2{animation-delay:.18s}@keyframes lab-blink{0%,88%,to{transform:scaleY(1)}92%,96%{transform:scaleY(.08)}}@keyframes lab-twitch{0%,62%,to{transform:rotate(0)}70%{transform:rotate(-9deg)}80%{transform:rotate(5deg)}90%{transform:rotate(-3deg)}}.listener{cursor:default}kbd{font-size:10px;letter-spacing:.012em;line-height:17px;min-width:0;padding:0 1px;text-align:center;background:none;color:var(--_muted)!important;opacity:.45;transition:opacity .15s}.bar:hover kbd{opacity:.75}.bar button kbd{margin-left:-4px}.bar button.go-btn kbd{font-size:inherit;line-height:inherit;opacity:1;margin-left:0}@media all{.bar{gap:0;background:var(--_bg);border-radius:var(--_radius);box-shadow:var(--_shadow);overflow:hidden}.bar>button{box-shadow:inset .5px 0 0 var(--_line);border-radius:0;background:none;padding:8px 12px;gap:6px}.bar>button.first{box-shadow:none}@media(hover:hover)and (pointer:fine){.bar>button:not(:disabled):hover{background:var(--_soft)}.bar>button:active{background:var(--_soft)}}.bar>.more[aria-expanded=true]{background:var(--_soft)}.bar>button:active{transform:none}.bar>button.quiet{opacity:1;box-shadow:inset .5px 0 0 var(--_line);color:var(--_muted)}.bar>button.quiet.first{box-shadow:none}.bar .list-btn,.bar .done-btn{min-width:0}.bar .mn{color:var(--_muted);font-weight:400}.bar>button.secondary,.bar>button.secondary.has-new{color:var(--_muted);font-weight:500}.bar .chat-btn,.bar .list-btn{align-items:baseline}.bar .cnt{font-size:12px;letter-spacing:0;font-weight:400;line-height:16px;text-align:center;background:none;color:var(--_fg);font-variant-numeric:tabular-nums}.bar .cnt.zero{color:var(--_muted)}.bar button.go-btn.on{background:none;color:var(--_fg)}.bar button.go-btn.on kbd{color:var(--_muted)!important}.gp{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:11px 11px 11px 2px;font-size:10px;letter-spacing:.012em;font-weight:600;color:#24a046;box-shadow:inset 0 0 0 1.25px #24a046;transition:background-color .2s,color .2s}.go-btn.on .gp{background:#24a046;color:#fff}.go-btn:not(.on):not(.cursor) .gp{color:var(--_fg);background:var(--_bg);box-shadow:inset 0 0 0 1px var(--_edge);font-size:10px;letter-spacing:.012em}.go-btn.cursor .gp{color:transparent;background:var(--_bg);box-shadow:inset 0 0 0 1px var(--_edge);position:relative}.go-btn.cursor .gp:after{content:"off";position:absolute;inset:0;display:grid;place-items:center;color:var(--_muted);font-size:10px;font-weight:600;letter-spacing:0}.more{font-size:15px!important;letter-spacing:.05em}.more-menu{position:fixed;right:16px;bottom:60px;display:grid;min-width:180px;padding:4px;background:var(--_bg);border-radius:var(--_radius);box-shadow:var(--_shadow);animation:lab-fade .12s ease-out}.more-menu[hidden]{display:none}.more-menu button{border:0;background:none;text-align:left;font:inherit;font-size:13px;letter-spacing:-.006em;color:var(--_fg);padding:7px 10px;border-radius:var(--_r-s);cursor:pointer;display:flex;justify-content:space-between;align-items:center;gap:12px;white-space:nowrap}.more-menu button:hover:not(:disabled){background:var(--_soft)}.more-menu button:disabled{color:var(--_muted);cursor:default}.more-menu button[hidden]{display:none}.more-menu kbd{margin:0}}kbd:before{content:"("}kbd:after{content:")"}.hint{position:fixed;left:50%;bottom:64px;transform:translate(-50%);background:var(--_bg);color:var(--_muted);box-shadow:var(--_shadow);padding:8px 14px;border-radius:var(--_radius);font-size:13px;pointer-events:none;white-space:nowrap;letter-spacing:-.006em;animation:lab-fade .2s ease-out}@media(pointer:coarse){.box textarea,.who input{font-size:16px;letter-spacing:-.019em}kbd{display:none}.box textarea{line-height:22px;padding:7px 0}.box.one .who{line-height:22px;padding-bottom:7px}}@keyframes lab-fade{0%{opacity:0}}@keyframes lab-in{0%{transform:translateY(4px) scale(.98)}}@keyframes lab-out{to{opacity:0;transform:translateY(2px) scale(.985)}}@supports (corner-shape: squircle){:host{--_radius: calc(var(--lab-radius, 12px) * 1.8);--_r-s: 11px}*,*:before,*:after{corner-shape:squircle}.pin,.pin .ring,.pin.new:after,.dot,.send,.list .tabs .x,.bar .toggle:not(.secondary):before,.msg :is(.stamp,.stamp-room) .ring,.gp{corner-shape:round}}@keyframes lab-pin{0%{transform:scale(1.1)}}@keyframes lab-halo{0%{box-shadow:0 0 color-mix(in srgb,var(--_fg) 12%,transparent)}to{box-shadow:0 0 0 16px color-mix(in srgb,var(--_fg) 0%,transparent)}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important}}@media(max-width:480px){kbd{display:none}}.handle{display:none}@media(pointer:coarse)and (max-width:560px),(pointer:coarse)and (max-height:500px){:host{--_safe: env(safe-area-inset-bottom, 0px);--_kb: var(--lab-kb, 0px);--_sheet-max: calc(min(72dvh, var(--lab-vh, 100dvh) - 24px) + var(--_kb));--_pb: calc(12px + var(--_safe) + var(--_kb))}:host([data-kb]){--_safe: 0px;--_kb: 0px;--_pb: 10px}:host([data-kb]) :is(.card,.list:not([hidden])){top:var(--lab-top, 0px)!important;bottom:auto!important;height:var(--lab-vh, 100dvh)!important;max-height:none!important;border-radius:0}:host([data-kb]) .float{top:auto!important;bottom:var(--lab-kb, 0px)!important;height:auto!important;border-radius:var(--_radius) var(--_radius) 0 0}.card,.float{position:fixed;left:0!important;right:0;top:auto!important;bottom:0;width:auto;max-width:none;max-height:var(--_sheet-max);display:flex;flex-direction:column;border-radius:var(--_radius) var(--_radius) 0 0;padding:8px 0 0;z-index:3}.card:after,.float:after,.list:after{content:"";position:absolute;left:0;right:0;top:100%;height:100vh;background:var(--_bg)}.card>.body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 12px 4px;margin-right:0}.card{height:var(--_sheet-max)}.card>.foot,.float>.composer{flex:none;padding:0 12px var(--_pb)}.card>.foot{margin-top:0;padding-top:6px}.card .composer{margin-top:0}.card>.nav{flex:none;margin:-6px 0 0;padding:0 12px;gap:20px}.card .nav .btn{font-size:14px;letter-spacing:-.011em;padding:0 2px;min-height:44px;display:inline-flex;align-items:center}.card .nav{gap:16px}.card .nav{flex-wrap:wrap;row-gap:0}.card .nav .acts{margin:0 0 0 auto;gap:20px}.box.one .who span{font-size:16px;letter-spacing:-.019em}.card .nav .acts button.btn{font-size:14px;letter-spacing:-.011em}.float{background:var(--_bg);box-shadow:var(--_shadow)}.handle{display:block;flex:none;height:86px;margin-top:-68px;touch-action:none;position:relative}.list .tabs{position:relative}.handle:after,.list .tabs:after{content:"";position:absolute;left:50%;top:68px;width:36px;height:4px;margin-left:-18px;border-radius:2px;background:color-mix(in srgb,var(--_fg) 18%,transparent);pointer-events:none}.list .tabs:after{top:8px}.list .tabs:before{content:"";position:absolute;left:0;right:0;top:-60px;height:60px}.list .tabs{touch-action:pan-x}.chatwin .tabs{touch-action:none}.list .items,.msgs,.card>.body{touch-action:pan-y}.list .tabs .x{display:none}:host([data-sheet]) :is(.hint,.listener,.left){visibility:hidden}.bar{transition:transform .34s cubic-bezier(.32,.72,0,1),opacity .2s}:host([data-sheet]) .bar{transform:translateY(calc((100% + 16px + env(safe-area-inset-bottom,0px)) * (1 - var(--lab-p, 0))));opacity:var(--lab-p, 0);pointer-events:none;transition:transform .24s cubic-bezier(.4,0,1,1),opacity .2s .04s}:host([data-sheet]) .bar button{pointer-events:none}:host([data-sheet]) .scrim{display:block;animation:lab-fade .22s ease-out}:host([data-opening]) :is(.card.in,.float.in,.scrim){animation-play-state:paused}:host([data-leaving]) .scrim{display:block}.list{left:0;right:0;bottom:0!important;width:auto;max-height:var(--_sheet-max);overflow:visible;border-radius:var(--_radius) var(--_radius) 0 0;font-size:15px;letter-spacing:-.016em;z-index:3}.chatwin{height:var(--_sheet-max);transition:height .38s cubic-bezier(.32,.72,0,1)}.chatwin.full,.card.full{height:calc(var(--lab-vh, 100dvh) - env(safe-area-inset-top,0px) - 10px + var(--_kb));max-height:none}.card{transition:height .38s cubic-bezier(.32,.72,0,1)}.list .tabs{flex-wrap:nowrap;overflow-x:auto;padding:18px 12px 8px;border-radius:var(--_radius) var(--_radius) 0 0;background:var(--_bg)}.list .items{padding:0 12px calc(10px + var(--_safe))}.chatwin .msgs{padding:4px 12px 8px}.chatwin .tabs{padding:18px 12px 0}.chatwin .chat{padding:6px 12px var(--_pb)}.chatwin .msgs{margin-bottom:calc(-56px - var(--_pb));padding-bottom:calc(64px + var(--_pb))}.card>.body{margin-bottom:calc(-56px - var(--_pb));padding-bottom:calc(64px + var(--_pb))}.chatwin .msgs{-webkit-mask-image:linear-gradient(#000 calc(100% - 60px - var(--_pb)),rgba(0,0,0,.12) calc(100% - var(--_pb)));mask-image:linear-gradient(#000 calc(100% - 60px - var(--_pb)),#0000001f calc(100% - var(--_pb)))}.card>.body{-webkit-mask-image:linear-gradient(#000 calc(100% - 60px - var(--_pb)),rgba(0,0,0,.12) calc(100% - var(--_pb)));mask-image:linear-gradient(#000 calc(100% - 60px - var(--_pb)),#0000001f calc(100% - var(--_pb)))}.chatwin .chat,.card>.foot{position:relative;z-index:1;background:none}:host{--_box-bg: color-mix(in srgb, var(--_bg) 72%, transparent);--_box-edge: inset 0 0 0 .5px color-mix(in srgb, var(--_fg) 16%, transparent), 0 4px 18px rgba(0, 0, 0, .08)}.float{--_box-bg: inherit;--_box-edge: inherit}.box{-webkit-backdrop-filter:blur(18px) saturate(1.8);backdrop-filter:blur(18px) saturate(1.8)}.list .it{padding:11px 8px}.pin{scale:.8}.pin .hit{display:block;position:absolute;inset:-14px;border-radius:50%}.pin.moved .hit{inset:-21px}.msg .p{font-size:15px;letter-spacing:-.016em;line-height:21px}.msg .quote{font-size:14px;letter-spacing:-.011em}.msg b,.msg .quote b{font-size:12px;letter-spacing:0}.pin.moved{scale:.64}.bar>button{padding:12px 14px;min-height:44px}.more-menu{bottom:72px;min-width:200px}.more-menu button{padding:11px 12px;font-size:15px;letter-spacing:-.016em}}.scrim{cursor:pointer;display:none;position:fixed;inset:-50vh 0;background:#0006;z-index:2;touch-action:none}.sel-chip{position:fixed;transform:translate(-50%);border:0;border-radius:var(--_radius);padding:8px 14px;background:var(--_fg);color:var(--_bg);font:500 14px/1 var(--_font, inherit);box-shadow:var(--_shadow);z-index:4}@media(pointer:coarse)and (max-width:560px),(pointer:coarse)and (max-height:500px){.listener{display:none!important}.bar{bottom:16px!important}.hint{bottom:64px!important}.chat-btn .mark{align-self:center;width:13px;height:13px;margin:0 -2.5px 0 -2px;translate:0 -1.5px}.chat-btn[data-agent=away] .mark{fill:var(--_muted);opacity:.5}.chat-btn[data-agent=working] .mark{fill:#24a046}.chat-btn[data-agent=listening] .mark .eye{animation:lab-blink 3.2s ease-in-out infinite}.chat-btn[data-agent=working] .mark :is(.e1,.e2){animation:lab-twitch 2.4s ease-in-out infinite}.chat-btn[data-agent=working] .mark .e2{animation-delay:.18s}.send{width:36px;height:36px}.send .arr{width:17px;height:15px;margin:auto}}@media(max-width:560px){.bar{bottom:64px}.hint{bottom:112px}.list{bottom:114px}}[hidden]{display:none!important}@media(pointer:coarse)and (max-width:560px),(pointer:coarse)and (max-height:500px){:host{--_gap: 8px;--_card-r: 30px}.card,.float,.list{left:var(--_gap)!important;right:var(--_gap);bottom:var(--_gap)!important;border-radius:var(--_card-r)!important;background:var(--_bg);box-shadow:0 0 0 .5px color-mix(in srgb,var(--_fg) 10%,transparent),0 12px 40px #0000002e;transform-origin:var(--lab-from, 50% 100%)}.list .tabs{border-radius:var(--_card-r) var(--_card-r) 0 0}.card:after,.float:after,.list:after{content:none}:host([data-kb]) :is(.card,.list:not([hidden])){top:calc(var(--lab-top, 0px) + var(--_gap))!important;height:calc(var(--lab-vh, 100dvh) - 2 * var(--_gap))!important}:host([data-kb]) .float{bottom:calc(var(--lab-kb, 0px) + var(--_gap))!important}.chatwin.full,.card.full{height:calc(var(--lab-vh, 100dvh) - env(safe-area-inset-top,0px) - 10px - var(--_gap) + var(--_kb))}.scrim{background:transparent}.card.in,.float.in,.list:not([hidden]){animation:lab-card-in .3s cubic-bezier(.2,.9,.25,1)}}@keyframes lab-card-in{0%{transform:scale(.3);opacity:0}40%{opacity:1}}.zi{display:inline-flex;align-items:center;justify-content:center}.zi svg{width:13px;height:13px;display:block}.go-btn .gp:has(.zw){display:inline-flex;align-items:center;gap:4px;width:auto;padding:0 8px 0 6px;border-radius:11px}.go-btn .gp .zw{line-height:1}';var de,Kn,ze,Yn;function Un(e){({host:de,layer:Kn,el:ze,store:Yn}=e)}function Xn(e){let n=[];for(;e&&e.nodeType===1&&e!==document.body&&e!==document.documentElement;){if(e.id&&document.querySelectorAll(`#${CSS.escape(e.id)}`).length===1){n.unshift(`#${CSS.escape(e.id)}`);break}let r=e.localName,i=1;for(let s=e.previousElementSibling;s;s=s.previousElementSibling)s.localName===r&&i++;n.unshift(`${r}:nth-of-type(${i})`),e=e.parentElement}return n.length?(n[0].startsWith("#")?"":"body > ")+n.join(" > "):"body"}var ut=()=>Math.max(document.documentElement.scrollWidth,1),Oe=e=>Math.min(Math.max(e,0),1),K=(e,n)=>(e||"").replace(/\s+/g," ").trim().slice(0,n);function qe(e){if(!e||e.startsWith("data:"))return"";try{let n=new URL(e,location.href),r=n.searchParams.get("href")||n.searchParams.get("url");if(r&&/\/_(image|vercel\/image|next\/image)/.test(n.pathname))return qe(r);let i=n.pathname.split("/").filter(Boolean).map(decodeURIComponent),s=i.pop()||"";return/^w?\d+(x\d+)?\.\w+$/i.test(s)&&i.length&&(s=i.pop()),s.replace(/\.(avif|webp|jpe?g|png|gif|svg|mp4|webm|mov)$/i,"").replace(/[._-][A-Za-z0-9_-]{8}$/,"")}catch{return""}}var on=e=>{let n=e.currentSrc||e.getAttribute("src")||"";if(n&&!n.startsWith("data:"))return new URL(n,location.href).href;let r=e.dataset?.src||(e.getAttribute("srcset")||e.dataset?.srcset||"").split(/\s+/)[0];return r?new URL(r,location.href).href:""};function Ot(e,n,r,i,s,a){if(!s||!a||!n.width||!n.height)return null;let u=getComputedStyle(e),o=u.objectFit||"fill",l=(u.objectPosition||"50% 50%").split(/\s+/).map(w=>w.endsWith("%")?parseFloat(w)/100:{left:0,top:0,right:1,bottom:1}[w]??.5),p=n.width/s,v=n.height/a,x={cover:Math.max(p,v),contain:Math.min(p,v),none:1,"scale-down":Math.min(1,p,v)}[o],c=s*(x??p),f=a*(x??v),m=(n.width-c)*(l[0]??.5),h=(n.height-f)*(l[1]??l[0]??.5);return{fit:o,nw:s,nh:a,imgX:Oe((r-n.left-m)/c),imgY:Oe((i-n.top-h)/f)}}function Nt(e){let n=e.naturalWidth,r=e.naturalHeight,i=[e.srcset,...[...e.closest("picture")?.querySelectorAll("source")||[]].map(s=>s.srcset)].filter(Boolean);for(let s of i)for(let a of s.split(/,\s+/)){let[u,o="1x"]=a.trim().split(/\s+/),l="";try{l=new URL(u,location.href).href}catch{}if(!u||l!==e.currentSrc||!n)continue;let p=parseFloat(o);if(o.endsWith("w")&&p)return{nw:Math.round(p),nh:Math.round(p*r/n)};if(o.endsWith("x")&&p)return{nw:Math.round(n*p),nh:Math.round(r*p)}}return{nw:n,nh:r}}var qo=/^[A-Z][A-Za-z0-9]{2,}$/,Ho=/(Provider|Context|Consumer|Boundary|Slot|Portal|Fragment|Presence|Scope|Trap|Root)$/,Hn=e=>["variant","size","tone","intent","kind"].flatMap(n=>(typeof e?.[n]=="string"||typeof e?.[n]=="number")&&/^[\w.-]{1,20}$/.test(String(e[n]))?[`${n}=${e[n]}`]:[]).join(" "),pt=e=>/^[a-z-]+:\/\//i.test(e)?decodeURIComponent(e.replace(/^[a-z-]+:\/\/\/?(\.\/)?/i,"/").replace(/^\/[^/]*:\d+/,"").split("?")[0]).replace(/^\/(@fs)?/,"").replace(/^\(app-pages-browser\)\/\.?\/?/,""):e;function Zn(e){let n=(o,l=0)=>l>3?"":typeof o=="function"?o.displayName||o.name||"":o&&typeof o=="object"?o.displayName||n(o.render||o.type,l+1):"",r=o=>qo.test(o)&&!Ho.test(o),i=o=>{let l=o?._debugSource;if(l?.fileName)return`${pt(String(l.fileName))}:${l.lineNumber||0}`;let p=o?._debugStack?.stack;if(typeof p!="string")return"";for(let v of p.split(`
|
|
2
|
+
`).slice(1)){let x=/((?:https?|webpack-internal|file):\/\/[^\s()]+?):(\d+):\d+\)?\s*$/.exec(v);if(x&&!/node_modules|react-dom|react-jsx|jsx-dev-runtime|react-server|scheduler/.test(x[1]))return`${pt(x[1])} (line ${x[2]} as served, may differ from the source)`}return""},s=Object.keys(e).find(o=>o.startsWith("__reactFiber$"));if(s){let o=e[s],l=[],p="";for(let v=o?.return,x=0;v&&l.length<2&&x<80;v=v.return,x++){if(typeof v.type=="string")continue;let c=n(v.type);if(!r(c))continue;l.length||(p=i(v));let f=Hn(v.memoizedProps);l.push(f?`${c} ${f}`:c)}return l.length?{component:l.length>1?`${l[0]} (in ${l[1]})`:l[0],source:i(o)||void 0,usedAt:p||void 0}:i(o)?{source:i(o)}:{}}let a=e.__vueParentComponent;if(a?.type){let o=a.type.name||a.type.__name||(a.type.__file||"").replace(/^.*\//,"").replace(/\.vue$/,""),l=a.parent?.type,p=l&&(l.name||l.__name),v=Hn(a.props);return{component:`${o}${v?" "+v:""}${p?` (in ${p})`:""}`,source:a.type.__file?pt(a.type.__file):void 0,usedAt:l?.__file?pt(l.__file):void 0}}let u=e.__svelte_meta?.loc;return u?.file?{component:u.file.replace(/^.*\//,"").replace(/\.svelte$/,""),source:`${pt(u.file)}:${u.line??0}`}:{}}function Vn(e){let n=getComputedStyle(e),r=new Map,i="rgb(1, 2, 3)",s=document.createElement("i");s.style.cssText=`display:none;color:${i}`;let a=s.appendChild(document.createElement("i"));document.body.append(s);for(let l of[...getComputedStyle(document.documentElement)].filter(p=>p.startsWith("--")).slice(0,400)){a.style.color="",a.style.color=`var(${l})`;let p=getComputedStyle(a).color;p&&p!==i&&!r.has(p)&&r.set(p,l)}s.remove();let u=l=>r.has(l)?`${r.get(l)} ${l}`:l,o=[];return/^(transparent|rgba\(0, 0, 0, 0\))$/.test(n.backgroundColor)||o.push(`fill ${u(n.backgroundColor)}`),o.push(`text ${u(n.color)} ${n.fontSize}/${n.fontWeight}`),parseFloat(n.borderTopLeftRadius)&&o.push(`radius ${n.borderTopLeftRadius}`),K(o.join(", "),200)}function Wo(e,n,r){let i=getComputedStyle(e).transform;if(!i||i==="none")return null;let s=new DOMMatrix(i);if(s.isIdentity)return null;let a=e.offsetWidth||e.getBoundingClientRect().width,u=e.offsetHeight||e.getBoundingClientRect().height,[o,l]=getComputedStyle(e).transformOrigin.split(" ").map(parseFloat),p=(m,h)=>s.transformPoint(new DOMPoint(m-o,h-l)),v=[p(0,0),p(a,0),p(0,u),p(a,u)],x=e.getBoundingClientRect(),c={x:x.left-Math.min(...v.map(m=>m.x)),y:x.top-Math.min(...v.map(m=>m.y))},f=s.inverse().transformPoint(new DOMPoint(n-c.x,r-c.y));return{rect:{left:0,top:0,width:a,height:u},x:f.x+o,y:f.y+l}}function Fo(e,n,r,i){let s=e.getBoundingClientRect(),a=(e.getAttribute("preserveAspectRatio")||"xMidYMid meet").split(/\s+/),u=(l,p)=>{if(!l||!p||!s.width||!s.height)return;let[v,x]=[s.width,s.height];if(a[0]!=="none"){let h=(a[1]==="slice"?Math.max:Math.min)(s.width/l,s.height/p);[v,x]=[l*h,p*h]}let c=(h,w)=>h==="Min"?0:h==="Max"?w:w/2,f=a[0]==="none"?0:c(a[0].slice(1,4),s.width-v),m=a[0]==="none"?0:c(a[0].slice(5,8),s.height-x);Object.assign(n,{nw:l,nh:p,imgX:Oe((r-s.left-f)/v),imgY:Oe((i-s.top-m)/x)})},o=new Image;o.onload=()=>u(o.naturalWidth,o.naturalHeight),o.src=n.src,o.complete&&u(o.naturalWidth,o.naturalHeight)}function jo(e,n,r,i,s){let a=e.getBoundingClientRect(),u=getComputedStyle(e),o=c=>c.split(/,(?![^(]*\))/).map(f=>f.trim()),l=Math.max(0,o(u.backgroundImage).findIndex(c=>c.includes(n))),p=c=>{let f=o(c);return f[l%f.length]},v=(c,f)=>{if(!c||!f||!a.width||!a.height)return;let m=p(u.backgroundSize),h=c,w=f;if(m==="cover"||m==="contain"){let O=(m==="cover"?Math.max:Math.min)(a.width/c,a.height/f);h=c*O,w=f*O}else if(m!=="auto"&&m!=="auto auto"){let[O,P="auto"]=m.split(/\s+/),V=(X,F)=>X.endsWith("%")?parseFloat(X)/100*F:parseFloat(X);h=O==="auto"?NaN:V(O,a.width),w=P==="auto"?NaN:V(P,a.height),Number.isNaN(h)&&Number.isNaN(w)?[h,w]=[c,f]:Number.isNaN(h)?h=w*c/f:Number.isNaN(w)&&(w=h*f/c)}let[b="50%",$="50%"]=p(u.backgroundPosition).split(/\s+/),E=(O,P)=>O.endsWith("%")?parseFloat(O)/100*P:parseFloat(O)||0,M=E(b,a.width-h),z=E($,a.height-w);Object.assign(r,{nw:c,nh:f,fit:`background ${m}`,imgX:Oe((i-a.left-M)/h),imgY:Oe((s-a.top-z)/w)})},x=new Image;x.onload=()=>v(x.naturalWidth,x.naturalHeight),x.src=n,x.complete&&v(x.naturalWidth,x.naturalHeight)}function Ko(e,n){let r=[...e.children].filter(u=>u!==de&&u.getBoundingClientRect().height>0),i=null,s=null;for(let u of r){let o=u.getBoundingClientRect();if(o.bottom<=n)i=u;else if(o.top>=n&&!s)s=u;else if(o.top<n&&o.bottom>n)return null}let a=u=>{if(!u)return;let o=u.matches("h1, h2, h3, h4, h5, h6")?u:u.querySelector("h1, h2, h3, h4, h5, h6");return K(`${Ze(u)} "${K((o||u).textContent,60)}"`,160)};return i||s?{above:a(i),below:a(s)}:null}function Gn(e){for(let n=e;n;n=n.parentElement){let r=getComputedStyle(n).backgroundColor.match(/rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)(?:,\s*([\d.]+))?/);if(!r||r[4]!==void 0&&parseFloat(r[4])<.5)continue;let[i,s,a]=[r[1],r[2],r[3]].map(Number),u="#"+[i,s,a].map(o=>Math.round(o).toString(16).padStart(2,"0")).join("");return{scheme:.2126*i+.7152*s+.0722*a<128?"dark":"light",background:u}}return{scheme:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}}function Yo(e,n,r=[]){let i=null,s=0;if(document.caretPositionFromPoint){let E=r.length?document.caretPositionFromPoint(e,n,{shadowRoots:r}):document.caretPositionFromPoint(e,n);E&&(i=E.offsetNode,s=E.offset)}else if(document.caretRangeFromPoint){let E=document.caretRangeFromPoint(e,n);E&&(i=E.startContainer,s=E.startOffset)}if(!i||i.nodeType!==3||!i.data.trim())return null;let a=document.createRange();if(a.selectNodeContents(i),![...a.getClientRects()].some(E=>e>=E.left-4&&e<=E.right+4&&n>=E.top-4&&n<=E.bottom+4))return null;let o=i.data,l=s,p=s,v=/[\u0e00-\u0e7f\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af\uf900-\ufaff]/.test(o)&&typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(i.parentElement?.closest("[lang]")?.lang||void 0,{granularity:"word"}):null;if(v){for(let E of v.segment(o))if(s>=E.index&&s<=E.index+E.segment.length&&E.segment.trim()&&(l=E.index,p=E.index+E.segment.length,s<p))break}else{for(;l>0&&/\S/.test(o[l-1]);)l--;for(;p<o.length&&/\S/.test(o[p]);)p++}let c=(i.parentElement?.closest("p, li, h1, h2, h3, h4, h5, h6, td, th, figcaption, blockquote, a, button, label, span, div")||i.parentElement)?.textContent||o,f=c.slice(0,c.indexOf(o)+l),m=c.slice(c.indexOf(o)+p),h=E=>E.replace(/\s+/g," "),w={exact:K(o.slice(l,p),80),prefix:h(f.slice(-80)).replace(/^\s+/,"").slice(-40),suffix:h(m.slice(0,80)).replace(/\s+$/,"").slice(0,40)},b=i.parentElement?.closest("pre, [data-file]")||(getComputedStyle(i.parentElement).whiteSpace.startsWith("pre")?i.parentElement:null),$=!b&&i.parentElement?.closest('table[data-file], table[class*="code" i]');if(b||$){let E=b||$,M=document.createRange();M.setStart(E,0),M.setEnd(i,s);let z=M.toString(),O=E.textContent,P=[...E.querySelectorAll("br, tr")];if((E.localName==="table"||!O.includes(`
|
|
3
|
+
`))&&P.length){let F=E.querySelectorAll("br").length?[...E.querySelectorAll("br")]:[...E.querySelectorAll("tr")].slice(0,-1),Y=F.filter(I=>I.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING&&!I.contains(i)).length,se=document.createRange();Y?se.setStartAfter(F[Y-1]):se.setStart(E,0),F[Y]?se.setEndBefore(F[Y]):se.setEnd(E,E.childNodes.length);let ee=E.querySelectorAll("br").length?null:i.parentElement?.closest("tr");w.line=K((ee?ee.textContent:se.toString()).trim(),200),w.lineNo=Y+1,w.lines=F.length+(E.querySelectorAll("br").length?0:1)}else{let F=z.lastIndexOf(`
|
|
4
|
+
`)+1,Y=O.indexOf(`
|
|
5
|
+
`,z.length);w.line=K(O.slice(F,Y<0?void 0:Y).trim(),200),w.lineNo=z.split(`
|
|
6
|
+
`).length,w.lines=O.replace(/\n$/,"").split(`
|
|
7
|
+
`).length}let V=i.parentElement?.closest("tr, [data-line], [data-line-number]");if(V){let F=V.matches("[data-line], [data-line-number]")?V:V.querySelector("[data-line], [data-line-number]"),Y=F?.getAttribute("data-line")||F?.getAttribute("data-line-number")||[...V.children].map(se=>se.textContent.trim()).find(se=>/^\d+$/.test(se));Y&&/^\d+$/.test(Y)&&(w.pageLineNo=Number(Y))}let X=E.closest("[data-file]")?.getAttribute("data-file")||E.getAttribute("title")||E.getAttribute("aria-label")||"";for(let F=E.parentElement,Y=0;!X.trim()&&F&&F!==document.body&&Y<3;F=F.parentElement,Y++)X=F.querySelector(':scope > figcaption, :scope > [class*="title" i]')?.textContent||"";X.trim()&&(w.label=K(X.trim(),120))}return w}function Ze(e){let n=[...e.attributes].filter(r=>/^(id|class|alt|role|aria-label|href|data-[\w-]+)$/.test(r.name)).map(r=>`${r.name}="${K(r.value,60)}"`);return`<${e.localName}${n.length?` ${n.join(" ")}`:""}>`.slice(0,200)}function Wn(e,n){if(!n)return!0;let r=/^<([\w-]+)/.exec(n)?.[1];if(e.localName!==r||(/ id="([^"]*)"/.exec(n)?.[1]||"")!==K(e.id||"",60))return!1;let s=(/ class="([^"]*)"/.exec(n)?.[1]||"").split(/\s+/).filter(a=>a&&a!=="\u2026"&&!a.endsWith("\u2026"));return!s.length||s.some(a=>e.classList.contains(a))}function He(e,n){let r=document.elementsFromPoint(e,n).filter(m=>m!==de&&m!==document.documentElement),i=[],s=null;for(let m=r[0];m?.shadowRoot&&!de.contains(m)&&i.length<5;m=r[0]){s||=m,i.push(m.shadowRoot);let h=m.shadowRoot.elementsFromPoint(e,n).filter(w=>w!==m);if(!h.length)break;r=[...h,...r]}let a=r[0]?.closest("[data-comment-target]")||r[0]||document.body,u=a.getBoundingClientRect(),o={selector:Xn(a),x:u.width?(e-u.left)/u.width:0,y:u.height?(n-u.top)/u.height:0,docX:(e+scrollX)/ut(),docY:n+scrollY,width:innerWidth,height:innerHeight,dpr:Math.round((devicePixelRatio||1)*100)/100,element:Ze(a),eh:Math.round(u.height)},l=K(a.textContent,200);l&&a!==document.body&&(a.textContent||"").length<400&&(o.text=K(l,80));let p=a.parentElement?.closest("[id], [data-lab]");p&&(o.inside=p.dataset.lab?`[data-lab="${p.dataset.lab}"]`:`#${p.id}`);let v=null;for(let m of document.querySelectorAll("h1, h2, h3"))(m.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING||m.contains(a))&&(v=m);v&&(o.section=K(v.textContent,100)),s&&(o.shadow=Ze(s));for(let[m,h]of Object.entries(Zn(a)))h&&(o[m]=K(h,200));a!==document.body&&(o.looks=Vn(a));let x=a.closest?.("select");x&&x.selectedIndex>=0&&(o.chosen=K(`${x.selectedIndex+1} of ${x.options.length}: "${x.options[x.selectedIndex].text}"`,120));for(let m of[a,a.parentElement])if(!(!m||m===document.body)){for(let h of["::before","::after"]){let w=getComputedStyle(m,h).content,b=w&&w.match(/^"(.+)"$/);if(b&&b[1].trim()){o.cssText=K(`"${b[1]}" from ${h} of ${Ze(m)}`,160);break}}if(o.cssText)break}let c=document.querySelector('meta[name="lab-build"]')?.content;c&&(o.build=K(c,40));let f=r.slice(0,5).find(m=>/^(img|video|canvas|svg|image)$/.test(m.localName)&&!de.contains(m));if(f?.localName==="image"&&f.namespaceURI==="http://www.w3.org/2000/svg")o.kind="image",o.src=new URL(f.getAttribute("href")||f.getAttribute("xlink:href")||"",location.href).href,o.file=qe(o.src),Fo(f,o,e,n);else if(f){let m=f.getBoundingClientRect();if(o.kind=f.localName==="img"?"image":f.localName,f.localName==="img"||f.localName==="video"){let h=f,w=f;o.src=on(f),o.file=qe(o.src),h.alt&&(o.alt=K(h.alt,120));let b=Wo(f,e,n),[$,E,M]=b?[b.rect,b.x,b.y]:[m,e,n],z=f.localName==="img"?Ot(f,$,E,M,Nt(f).nw,Nt(f).nh):Ot(f,$,E,M,w.videoWidth,w.videoHeight);if(z&&Object.assign(o,z),b&&(o.transform=K(getComputedStyle(f).transform,80)),f.localName==="img"&&/\.(gif|webp|apng)(\?|#|$)/i.test(h.currentSrc||h.src)){let O=performance.getEntriesByName(h.currentSrc||h.src)[0],P=O?(performance.now()-O.responseEnd)/1e3:performance.now()/1e3;o.shownFor=Math.round(P*10)/10}f.localName==="video"&&(o.time=Math.round(w.currentTime*10)/10,Number.isFinite(w.duration)&&(o.duration=Math.round(w.duration*10)/10),!o.file&&w.poster&&(o.file=qe(w.poster)))}else o.time=Math.round(performance.now()/100)/10,o.imgX=Oe((e-m.left)/(m.width||1)),o.imgY=Oe((n-m.top)/(m.height||1)),o.nw=Math.round(m.width),o.nh=Math.round(m.height)}else{let m=Yo(e,n,i);if(m)o.kind="text",o.quote=m;else{for(let h=a,w=0;h&&h!==document.documentElement&&w<4;h=h.parentElement,w++){let b=getComputedStyle(h).backgroundImage.match(/url\(["']?(.+?)["']?\)/);if(b){o.kind="background",o.src=new URL(b[1],location.href).href,o.file=qe(o.src),jo(h,o.src,o,e,n);break}}if(o.kind||="element",o.kind==="element"){let h=Ko(a,n);h&&Object.assign(o,{gapAbove:h.above,gapBelow:h.below})}}}Object.assign(o,Gn(a));for(let m=a;m&&m!==document.body&&m!==document.documentElement;m=m.parentElement)if(m.id){o.block=m.id;break}return o}function Jn(e){let n=null;try{n=e.selector?document.querySelector(e.selector):null}catch{}let r=h=>{if(!h)return!1;if(e.file&&/^(image|video)$/.test(e.kind)){let w=h.closest?.("img, video")||h;return qe(on(w))===e.file}if(e.element&&!Wn(h,e.element))return!1;if(e.quote?.exact){let w=(h.textContent||"").replace(/\s+/g,""),b=e.quote.exact.replace(/\s+/g,"").slice(0,24),$=(e.quote.prefix||"").replace(/\s+/g,"").slice(-10),E=(e.quote.suffix||"").replace(/\s+/g,"").slice(0,10);return w.includes(b)&&(b.length>=16||!$&&!E||w.includes($+b)||w.includes(b+E))}return!0},i=K(e.text,400),s=h=>{let w=null;for(let b of document.querySelectorAll("h1, h2, h3"))(b.compareDocumentPosition(h)&Node.DOCUMENT_POSITION_FOLLOWING||b.contains(h))&&(w=b);return w?K(w.textContent,100):""},a=h=>String(h||"").replace(/\s+/g,""),u=a(e.zoneText).slice(0,30),o=h=>e.quote?.exact?!0:i?K(h.textContent,400).startsWith(i.slice(0,40)):u?a(h.textContent).includes(u):e.section?s(h)===e.section:!0,l=n&&n!==document.body&&r(n)?n:null;if(l&&o(l))return l;if(e.file&&/^(image|video)$/.test(e.kind))return[...document.querySelectorAll("img, video")].find(h=>qe(on(h))===e.file)||null;let p=/^<([\w-]+)/.exec(e.element||"")?.[1];if(!p||p==="body"||p==="html")return l;let v=h=>K(h,400),x=null,c=-1,f=1/0,m=[...document.querySelectorAll(p)].slice(0,400).filter(h=>!de.contains(h)&&Wn(h,e.element));for(let h of m){let w=v(h.textContent),b=0;if(e.quote?.exact&&r(h)&&(b+=4),i&&w===i&&(b+=4),u&&a(h.textContent).includes(u)?b+=4:i&&w.startsWith(i.slice(0,40))&&(b+=2),!b&&m.length>1)continue;b&&e.section&&s(h)===e.section&&(b+=2);let $=Math.abs(h.getBoundingClientRect().top+scrollY-(e.docY||0));(b>c||b===c&&$<f)&&([x,c,f]=[h,b,$])}return c>0||!l?x:l}var zt=null;function Uo(e){let n=/^(?:…)?(.*?)\[([^\]]+)\](.*?)(?:…)?$/s.exec(e.text||"");if(!n)return null;let r=n[1].replace(/\s+/g," ").slice(-24),i=n[2];if(!zt||performance.now()-zt.at>400){let p=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:c=>de.contains(c.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),v="",x=[];for(let c=p.nextNode();c;c=p.nextNode()){let f=c.data.replace(/\s+/g," ");for(let m=0;m<f.length;m++)x.push([c,m]);v+=f}zt={at:performance.now(),text:v,map:x}}let{text:s,map:a}=zt,u=s.indexOf(r+i);if(u<0)return{gone:!0};u+=r.length;let o=document.createRange();try{o.setStart(...a[u]),o.setEnd(a[u+i.length-1][0],a[u+i.length-1][1]+1)}catch{return{gone:!0}}let l=o.getBoundingClientRect();return l.width||l.height?{left:l.left+scrollX+Math.min(6,l.width/2),top:l.top+scrollY+l.height/2}:{gone:!0}}var mt={at:-1/0,y:0},ft=(e,n=0)=>{if(performance.now()-mt.at>300){let r=[...document.body.children].filter(i=>i!==de&&!de.contains(i)).map(i=>i.getBoundingClientRect().bottom+scrollY);mt={at:performance.now(),y:Math.max(innerHeight,...r)}}return Math.max(0,Math.min(e,mt.y-n-40))},Fn=(e,n)=>({left:e.left+(n.pinX?e.width:0),top:e.top+(n.pinY?e.height:0)}),jn=10,Xo=30;function Zo(e){let n=s=>Math.max(jn,Math.round(s.left+scrollX-Xo)),r=String(e?.selector||"").split(" > ");for(;r.length>1;){r.pop();let s=null;try{s=document.querySelector(r.join(" > "))}catch{}if(!s||/^(html|body)$/.test(s.localName)||de.contains(s))continue;let a=s.getBoundingClientRect();if(a.width)return n(a)}let i=[...document.body.children].filter(s=>s!==de&&!de.contains(s)).map(s=>s.getBoundingClientRect()).filter(s=>s.width&&s.height);return i.length?n({left:Math.min(...i.map(s=>s.left))}):jn}function We(e){let n=Vo(e);return n.moved?{...n,left:Zo(e)}:n}function Vo(e){let n=Jn(e);if(n&&!e.zw&&!e.docW&&/^(html|body|main)$/.test(n.localName)&&/\[[^\]]+\]/.test(e.text||"")){let a=Uo(e);if(a&&!a.gone)return{left:a.left,top:a.top,zone:null};if(a?.gone)return{left:e.docX*ut(),top:ft(e.docY),zone:null,moved:!0}}if(n&&e.eh&&!e.zw&&!e.docW&&/^(html|body|main)$/.test(n.localName)&&!/\[[^\]]+\]/.test(e.text||"")&&Math.abs(n.getBoundingClientRect().height-e.eh)>40)return{left:e.docX*ut(),top:ft(e.docY),zone:null,moved:!0};if(n){let a=n.getBoundingClientRect();if(a.width||a.height){let u=a.left+scrollX+e.x*a.width,o=e.zw&&Number.isFinite(e.oy)&&e.docH&&a.height>2*e.docH,l=a.top+scrollY+(o?e.oy:e.y*a.height),p=e.zw?{left:u,top:l,width:e.zw*a.width,height:o?e.docH:e.zh*a.height}:null;return p?{...Fn(p,e),zone:p}:{left:u,top:l,zone:p}}}let r=e.docX*ut(),i=ft(e.docY,e.docH||0),s=e.docW?{left:r,top:i,width:e.docW,height:e.docH}:null;return s?{...Fn(s,e),zone:s,moved:!!e.selector&&e.selector!=="body"}:{left:r,top:i,zone:s,moved:!!e.selector&&e.selector!=="body"}}function Go(e){let n=e?.quote,r=n?.exact?Jn(e):null;if(!r)return null;let i=n.exact.replace(/\s+/g,""),s=(n.prefix||"").replace(/\s+/g,"").slice(-12);for(let a=0;r&&a<4;r=r.parentElement,a++){let u="",o=[],l=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);for(let v=l.nextNode();v;v=l.nextNode())for(let x=0;x<v.data.length;x++)/\s/.test(v.data[x])||(u+=v.data[x],o.push([v,x]));let p=null;for(let v=u.indexOf(i);v!==-1;v=u.indexOf(i,v+1)){let x=document.createRange();x.setStart(...o[v]);let[c,f]=o[v+i.length-1];if(x.setEnd(c,f+1),!s||u.slice(0,v).endsWith(s))return x;p||=x}if(p)return p}return null}var Qn=(e,n)=>{let r=ze("b",{},String(e||"").replace(/\s*·\s*session\s+\S+$/i,""));return n&&r.append(ze("span",{class:"mark done",role:"img","aria-label":"done"},"\u2713")),r},an=!1,gt=()=>an&&Yn.get("lab-hold")==="1",Jo=e=>{let n=document.getElementById(e);return!!n&&!n.closest("[data-lab-comments]")},Qo=e=>{let n=[],r=0;for(let i of e.matchAll(/\bhttps?:\/\/[^\s<>"']*[^\s<>"'.,;:!?)\]]|(?<![\w&/#])#([A-Za-z][\w:.-]*[\w])/g)){if(i[1]&&!Jo(i[1]))continue;i.index>r&&n.push(document.createTextNode(e.slice(r,i.index)));let s=i[1]?ze("a",{href:`#${i[1]}`,class:"link"},i[0]):ze("a",{href:i[0],target:"_blank",rel:"noopener noreferrer",class:"link"},i[0]);s.addEventListener("click",a=>{a.stopPropagation(),i[1]&&(a.preventDefault(),dispatchEvent(new CustomEvent("lab-goto",{detail:i[1]})))}),n.push(s),r=i.index+i[0].length}return r<e.length&&n.push(document.createTextNode(e.slice(r))),n},ea=e=>e.split(/(?<=[.!?])\s+(?=["'([]?[A-Z0-9])/),eo=e=>{let n=[];for(let[r,i]of String(e||"").trim().split(/\n\s*\n/).entries()){let s=i.split(`
|
|
8
|
+
`);if(s.length===1&&i.length>240){let a=ea(i);for(let u=0;u<a.length;u+=2)n.push({text:a.slice(u,u+2).join(" "),gap:r>0||u>0});continue}s.forEach((a,u)=>{let o=/^\s*(?:[-•*]|\d+[.)])\s+/.exec(a),l=u>0?n.at(-1):null;o?n.push({li:/\d/.test(o[0])?o[0].trim():"\u2022",text:a.slice(o[0].length),gap:r>0&&u===0}):l&&!l.li?l.text+=`
|
|
9
|
+
${a}`:n.push({text:a,gap:r>0&&u===0||!!l})})}return n.map(r=>{let i=ze("span",{class:`p${r.li?" li":""}${r.gap?" gap":""}`});return r.li&&i.append(ze("span",{class:"mk"},r.li)),i.append(...Qo(r.text)),i})},ta=typeof Highlight=="function"&&!!CSS.highlights,Rt=e=>{if(!ta)return;let n=e&&Go(e);n?CSS.highlights.set("lab-quote",new Highlight(n)):CSS.highlights.delete("lab-quote")},rn=e=>{let n=ze("div",{class:`zone ${e}`});return n.innerHTML='<svg aria-hidden="true"><rect class="ring" width="100%" height="100%"/><rect class="dots" width="100%" height="100%"/></svg>',n},Bt=(e,n)=>{if(!e)return;let r=rn(n);return Object.assign(r.style,{left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`}),Kn.append(r),r};function to({x0:e,y0:n,x1:r,y1:i}){let s=Math.min(e,r),a=Math.min(n,i),u=Math.max(e,r),o=Math.max(n,i),l=He((s+u)/2,(a+o)/2),p=document.elementsFromPoint((s+u)/2,(a+o)/2).find(M=>M!==de&&!de.contains(M)),v=Math.max(1,(u-s)*(o-a)),x=M=>Math.max(0,Math.min(M.right,u)-Math.max(M.left,s))*Math.max(0,Math.min(M.bottom,o)-Math.max(M.top,a))/v>=.8;for(;p&&p!==document.body&&!x(p.getBoundingClientRect());)p=p.parentElement;p||=document.body;let c=p.getBoundingClientRect();Object.assign(l,{selector:p===document.body?"body":Xn(p),element:Ze(p),x:c.width?(s-c.left)/c.width:0,y:c.height?(a-c.top)/c.height:0,zw:c.width?(u-s)/c.width:0,zh:c.height?(o-a)/c.height:0,oy:Math.round(a-c.top),docX:(s+scrollX)/ut(),docY:a+scrollY,docW:Math.round(u-s),docH:Math.round(o-a),pinX:r>=e?1:0,pinY:i>=n?1:0}),Object.assign(l,Gn(p)),l.kind==="text"&&(delete l.quote,l.kind="element");let f=p===document.body?"":K(p.textContent,200);f&&(p.textContent||"").length<400?l.text=K(f,80):delete l.text,p!==document.body&&(l.looks=Vn(p));let m=[],h=document.createTreeWalker(p,NodeFilter.SHOW_TEXT),w=document.createRange();for(let M=h.nextNode();M&&m.length<80;M=h.nextNode()){if(de.contains(M))continue;let z=M.parentElement?.getBoundingClientRect();if(!(!z||z.bottom<a||z.top>o||z.right<s||z.left>u))for(let O of M.data.matchAll(/\S+/g)){w.setStart(M,O.index),w.setEnd(M,O.index+O[0].length);let P=w.getBoundingClientRect(),V=(P.left+P.right)/2,X=(P.top+P.bottom)/2;P.width&&V>=s&&V<=u&&X>=a&&X<=o&&m.push(O[0])}}let b=K(m.join(" "),300);b&&(l.zoneText=b);let $=[],E=p.querySelectorAll("*");for(let M=0;M<E.length&&M<3e3;M++){let z=E[M];if(de.contains(z)||$.some(P=>P.contains(z)))continue;let O=z.getBoundingClientRect();O.width<8||O.height<8||O.left<s-4||O.right>u+4||O.top<a-4||O.bottom>o+4||$.push(z)}if($.length&&(l.zoneItems=$.slice(0,5).map(M=>{let z=Zn(M),O=K(M.textContent,50);return K([Ze(M),O&&`"${O}"`,z.component,z.source&&`written at ${z.source}`,z.usedAt&&`used at ${z.usedAt}`].filter(Boolean).join(" \xB7 "),500)}),$.length>5&&l.zoneItems.push(`and ${$.length-5} more`)),/^(img|video)$/.test(p.localName)){let M=p.localName==="img"?Nt(p).nw:p.videoWidth,z=p.localName==="img"?Nt(p).nh:p.videoHeight,O=Ot(p,c,s,a,M,z),P=Ot(p,c,u,o,M,z);O&&P&&Object.assign(l,{imgX:O.imgX,imgY:O.imgY,imgX2:P.imgX,imgY2:P.imgY})}else(l.kind==="image"||l.kind==="video")&&(delete l.imgX,delete l.imgY,l.kind="element");return l}var na=()=>window.__lab||null;function Pt(e){let n=na();n&&(n.writing=Math.max(0,e),n.writing||n.flush())}var ht;function no(e){ht=e}var Ne=new Set,Dt=new Set,oo=()=>Ne.size>0,oa=e=>{e.value.trim()?Ne.add(e):Ne.delete(e),Pt(Ne.size),ht?.whileWriting?.()},aa='<i class="arr" aria-hidden="true"></i>';function sn({placeholder:e,onSubmit:n,autofocus:r=!1,empty:i="",nameFirst:s=!1,draftKey:a=""}){let{el:u,store:o,root:l,refreshPinCursor:p,syncReads:v,rememberMe:x}=ht,c=u("div",{class:"composer"}),f=u("div",{class:"box"}),m=u("textarea",{placeholder:e,maxlength:"2000",rows:"1","aria-label":e,enterkeyhint:"send",autocomplete:"off",autocorrect:"off",spellcheck:"false",writingsuggestions:"false"}),h=u("label",{class:"who"}),w=u("span",{},"as"),b=u("input",{type:"text",name:"search-lab-who",placeholder:"your name",maxlength:"60",enterkeyhint:"send",autocomplete:"off",autocorrect:"off",autocapitalize:"words",spellcheck:"false",writingsuggestions:"false","data-1p-ignore":"","data-lpignore":"true"});if(b.value=o.get("lab-name"),a&&!Dt.has(a)){let I=o.get(a);I&&(m.value=I,queueMicrotask(()=>P()))}let $=()=>{a&&o.set(a,m.value.trim()?m.value:"")},E=()=>{Ne.delete(m),Pt(Ne.size),ht?.whileWriting?.(),a&&o.set(a,"")};h.append(w,b);let M=u("button",{class:"send",type:"button","aria-label":"send"});M.addEventListener("pointerdown",I=>I.preventDefault()),M.addEventListener("mousedown",I=>I.preventDefault()),M.innerHTML=aa;let z=u("div",{class:"error"});f.append(m,u("div",{class:"line"}),h,M),c.append(f,z),f.addEventListener("click",I=>{I.target!==f&&!I.target.classList?.contains("line")||(m.focus({preventScroll:!0}),m.setSelectionRange(m.value.length,m.value.length))});let O=null;for(let I of[m,b])I.addEventListener("touchstart",te=>O={x:te.touches[0].clientX,y:te.touches[0].clientY},{passive:!0}),I.addEventListener("touchend",te=>{let le=te.changedTouches[0];!O||Math.hypot(le.clientX-O.x,le.clientY-O.y)>10||l.activeElement===I||(te.preventDefault(),I.focus({preventScroll:!0}),I.setSelectionRange(I.value.length,I.value.length))},{passive:!1});let P=()=>{let I=s||m.value.length>0||l.activeElement===b||!!z.textContent,te=I!==f.classList.contains("open")&&!o.get("lab-name")&&f.isConnected&&!matchMedia("(prefers-reduced-motion: reduce)").matches,le=te&&{arrow:M.getBoundingClientRect(),height:f.getBoundingClientRect().height},ne=!!o.get("lab-name");if(f.classList.toggle("one",ne),f.classList.toggle("open",I),w.hidden=!b.value.trim(),ne&&!CSS.supports?.("field-sizing","content")&&(b.style.width=`${Math.max(2,b.value.length+1)}ch`),M.classList.toggle("ready",!!((m.value.trim()||i)&&b.value.trim())),oa(m),m.style.height="auto",m.style.height=`${m.scrollHeight}px`,te){let be=M.getBoundingClientRect(),Be={duration:220,easing:"cubic-bezier(.2, .7, .3, 1)"};M.animate([{transform:`translate(${le.arrow.left-be.left}px, ${le.arrow.top-be.top}px)`},{transform:"none"}],Be),f.style.overflow="hidden",f.animate([{height:`${le.height}px`},{height:`${f.getBoundingClientRect().height}px`}],Be).onfinish=()=>f.style.overflow=""}},V=!1,X=async()=>{if(V)return;let I=m.value.trim()||i;if(!I)return m.focus();if(!b.value.trim())return f.classList.add("open"),b.focus();o.set("lab-name",b.value.trim()),x(b.value.trim()),p(),v(),M.classList.remove("sent"),M.offsetWidth,M.classList.add("sent"),V=!0;let te=m.value;a&&Dt.add(a),z.textContent="",z.classList.remove("wait");let le=setTimeout(()=>{z.textContent="sending\u2026 it goes as soon as the lab is back",z.classList.add("wait")},1500);try{let ne=await n(b.value.trim(),I);E(),a&&Dt.delete(a),clearTimeout(le),z.textContent="",z.classList.remove("wait"),ne?.keep&&(m.value="",P())}catch(ne){clearTimeout(le),z.classList.remove("wait"),z.textContent=ne.message,a&&Dt.delete(a),m.value=te,$(),P()}V=!1},F=I=>{I.key==="Enter"&&!I.shiftKey&&!I.isComposing&&(I.preventDefault(),X())};m.addEventListener("input",P),m.addEventListener("input",$),new MutationObserver(()=>{c.isConnected||(Ne.delete(m),Pt(Ne.size),ht?.whileWriting?.())}).observe(document.documentElement,{childList:!0,subtree:!0}),b.addEventListener("input",P),b.addEventListener("blur",()=>setTimeout(P,0)),m.addEventListener("keydown",F),b.addEventListener("keydown",F);let Y=0;M.addEventListener("touchend",I=>{I.preventDefault(),Y=Date.now(),X()},{passive:!1}),M.addEventListener("click",()=>{Date.now()-Y<700||X()}),M.addEventListener("mousedown",I=>I.preventDefault()),requestAnimationFrame(P);let se=s?b:m;s&&b.setAttribute("data-first","");let ee=()=>se.focus({preventScroll:!0});return r&&queueMicrotask(()=>se.isConnected?ee():setTimeout(ee,0)),c}var ao;function ro(e){ao=e}var io=e=>{let n=e.anchor||{},r=n.quote?.exact||"",i=null;try{i=!r&&n.selector?document.querySelector(n.selector):null}catch{}for(let s=0;i&&i!==document.body&&s<5;i=i.parentElement,s++){let a=i.innerText?.replace(/\s+/g," ").trim()||"";if(a.length>=12){r=a;break}}return r=(r||n.text||n.section||"").replace(/\s+/g," ").trim(),r?`"${r.length>40?`${r.slice(0,39)}\u2026`:r}"`:""},so=(e,n,r="")=>{let{el:i,mine:s,repliesOf:a,workState:u}=ao,o=new Date(e.createdAt),l=o.toDateString()===new Date().toDateString()?o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):o.toLocaleDateString([],{day:"numeric",month:"short"}),p=i("span",{class:"stamp"});if(p.append(i("span",{class:"tm"},r+l)),s(e)&&!e.session){let v=n?[n,...a(n.id)]:[e],x=v.some(f=>f.session&&f.createdAt>e.createdAt),c=!v.some(f=>!f.session&&f.createdAt>e.createdAt);if(!x&&c&&n&&u(n)[0]==="now")p.classList.add("busy"),p.append(i("span",{class:"ring",role:"img","aria-label":"the agent is on it"}));else if(x)p.classList.add("ans"),p.append(i("span",{class:"tick",role:"img","aria-label":"answered"},"\u2713"));else{let f=n?.handedAt&&n.handedAt>=e.createdAt;p.append(i("span",{class:`tick${f?" got":""}`,role:"img","aria-label":f?"delivered to the agent":"sent"},f?"\u2713\u2713":"\u2713"))}}return p};var S;function lo(e){S=e}var ra=e=>!!e.closest?.(".handle, .tabs"),ia=(e,n)=>e.composedPath().find(r=>r instanceof HTMLElement&&n.contains(r)&&(r.localName==="textarea"||/auto|scroll/.test(getComputedStyle(r).overflowY))),bt="cubic-bezier(.32,.72,0,1)",sa=["top","bottom","height","max-height","transform","transition","animation","pointer-events","opacity","transform-origin"],ln={x:0,y:0,at:-1e9};function cn(e,n){let r=n||(performance.now()-ln.at<1500?ln:null);if(!r)return e.style.removeProperty("--lab-from");e.style.setProperty("--lab-from",`${Math.round(r.x-e.offsetLeft)}px ${Math.round(r.y-e.offsetTop)}px`)}var It=null;function co(){!S.coarse||!S.host.hasAttribute("data-kb")||S.still.matches||(It??=S.el("input",{"aria-hidden":"true",tabindex:"-1",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",writingsuggestions:"false",style:"position:fixed;top:0;left:-200px;width:1px;height:1px;opacity:0;font-size:16px;pointer-events:none"}),It.isConnected||S.root.append(It),It.focus({preventScroll:!0}))}function dn(e,n=0,r){let i=r?360:n||200,s=n?"linear":"cubic-bezier(.4, 0, .9, .4)",a=0;try{a=new DOMMatrixReadOnly(getComputedStyle(e).transform).m42||0}catch{}let u=e.getBoundingClientRect(),o=u.top-a,l=getComputedStyle(S.scrim).opacity;for(let[c,f]of[["top",`${o}px`],["bottom","auto"],["height",`${u.height}px`],["max-height","none"],["animation","none"],["transition","none"],["transform",r?"":`translateY(${a}px)`],["pointer-events","none"]])e.style.setProperty(c,f,"important");S.host.setAttribute("data-leaving",""),S.scrim.style.transition="none",S.scrim.style.opacity=l;let p=()=>S.root.activeElement?.blur();r?setTimeout(p,i):p();let x=(r?null:S.root.querySelector(e.classList.contains("card")?".pin.open":e.classList.contains("float")?".pin.draft":"none"))?.getBoundingClientRect();if(x&&cn(e,{x:x.left+x.width/2,y:x.top+x.height/2}),e.offsetHeight,r){e.style.setProperty("transform-origin","50% 50%","important");let c=r.x-(u.left+u.width/2),f=r.y-(o+u.height/2),m=()=>{e.animate([{transform:"none"},{transform:`translate(${c}px, ${f}px) scale(${22/u.width}, ${22/u.height})`}],{duration:i,easing:bt,fill:"forwards"}),e.animate([{opacity:1},{opacity:1,offset:.7},{opacity:0}],{duration:i,fill:"forwards"})};requestAnimationFrame(()=>requestAnimationFrame(m))}else n?(e.style.setProperty("transition",`transform ${i}ms ${s}`,"important"),e.style.setProperty("transform",`translateY(${Math.max(u.height,innerHeight-o)+8}px)`,"important")):(e.style.setProperty("transition",`transform ${i}ms ${s}, opacity ${i}ms ease-in`,"important"),e.style.setProperty("transform",`translateY(${a}px) scale(.3)`,"important"),e.style.setProperty("opacity","0","important"));return S.scrim.style.transition=`opacity ${i}ms ${s}`,S.scrim.style.opacity="0",r?i+120:i}function pn(e){for(let n of sa)e.style.removeProperty(n);S.host.removeAttribute("data-leaving"),S.scrim.style.opacity=S.scrim.style.transition=""}function qt(e,n,r=0){if(!S.coarse||!e||S.still.matches)return n();let i=dn(e,r);S.bar.style.transition=`transform ${i}ms cubic-bezier(.2, .6, .4, 1), opacity ${i}ms`,S.host.style.setProperty("--lab-p","1"),setTimeout(()=>{n(),pn(e),S.bar.style.transition="",S.host.style.removeProperty("--lab-p")},i)}function po(){let e=S.root.querySelector(".float:not(.out)"),n=S.root.querySelector(".pin.draft");if(!S.coarse||!e||!n||!S.vv)return;let r=innerHeight-S.vv.height,i=r>60?r:S.S.kbSeen||Math.round(innerHeight*.42),s=innerHeight-i-e.offsetHeight-8,a=n.getBoundingClientRect(),u=56;(a.top<u||a.bottom>s-16)&&un(scrollY+(a.top+a.bottom)/2-(u+s)/2)}function un(e){if(S.coarse){let n=document.documentElement,r=parseFloat(n.style.getPropertyValue("--lab-room"))||0,i=Math.max(0,Math.ceil(e+innerHeight-(n.scrollHeight-r)));n.style.setProperty("--lab-room",`${i}px`),n.classList.toggle("lab-room",i>0)}scrollTo({top:Math.max(0,e),behavior:S.still.matches?"auto":"smooth"})}function mn(){let e=matchMedia("(pointer: coarse)").matches&&S.host.hasAttribute("data-sheet");if(!e&&S.S.backWatcher){let n=S.S.backWatcher;S.S.backWatcher=null,n.destroy()}if(e&&!S.S.backWatcher&&"CloseWatcher"in window)try{let n=new window.CloseWatcher;n.onclose=()=>{S.S.backWatcher===n&&(S.S.backWatcher=null),S.closeOrNudge(),mn()},S.S.backWatcher=n}catch{}}function xt(e,n,r=!1){if(!S.coarse)return;let i=0,s=-1e9,a=-1e9;e.addEventListener("scroll",()=>s=performance.now(),{capture:!0,passive:!0}),e.addEventListener("click",b=>{performance.now()-a<200&&(b.preventDefault(),b.stopPropagation())},!0),e.addEventListener("focusin",b=>{performance.now()-a<200&&b.target.localName==="textarea"&&b.target.blur()});let u=0,o=0,l=0,p=0,v=null,x=null,c=null,f=!1,m=b=>{if(f=b.currentTarget===S.scrim,f&&S.openSheet()!==e)return void(x="off");let $=b.touches[0];u=$.clientX,o=$.clientY,l=p=i=0,v={y:o,at:b.timeStamp},c=f?null:ia(b,e),x=b.touches.length>1||c?.localName==="textarea"?"off":null};e.addEventListener("touchstart",m,{passive:!0}),S.scrim.addEventListener("touchstart",m,{passive:!0});let h=b=>{if(f!==(b.currentTarget===S.scrim))return;let $=b.touches[0];if(x==="off"&&c&&c.localName!=="textarea"&&b.touches.length===1&&b.cancelable&&c.scrollTop<=0&&$.clientY>v.y+1&&(x="drag",o=$.clientY,p=0,v={y:$.clientY,at:b.timeStamp}),x==="off")return void(v={y:$.clientY,at:b.timeStamp});if(x==="hold")return b.preventDefault();if(!x){let z=$.clientY-o,O=$.clientX-u;if(!z&&!O)return;let P=Math.abs(O)>Math.abs(z),V=!P&&z>0&&o-e.getBoundingClientRect().top<e.offsetHeight*.25;if(f?x=P?"hold":"drag":ra(b.target)?x=P&&b.target.closest(".tabs")?"off":"drag":V&&c?.localName!=="textarea"?x="drag":c?x=!P&&z>0&&c.scrollTop<=0&&performance.now()-s>100?"drag":"off":x=P?"hold":"drag",S.S.dbg?.(`touch ${String(b.target.className||b.target.localName).slice(0,20)} at ${Math.round(o-e.getBoundingClientRect().top)}/${e.offsetHeight} down${Math.round(z)} \u2192 ${x}${b.cancelable?"":" (not cancelable)"}${c?` box${Math.round(c.scrollTop)}`:""}`),x==="off")return;if(x==="hold")return b.preventDefault()}b.preventDefault(),i=$.clientY-o;let E=e.offsetHeight||400;l=i>=0?i:-(1-1/(-i*.55/E+1))*E,b.timeStamp>v.at&&(p=.8*(($.clientY-v.y)/(b.timeStamp-v.at))+.2*p),v={y:$.clientY,at:b.timeStamp},e.style.transition=S.scrim.style.transition="none",e.style.transform=`translateY(${l}px)`;let M=Math.min(1,Math.max(0,l/Math.max(100,innerHeight-(e.getBoundingClientRect().top-l))));S.scrim.style.opacity=String(1-M),S.bar.style.transition="none",S.host.style.setProperty("--lab-p",String(M))};e.addEventListener("touchmove",h,{passive:!1}),S.scrim.addEventListener("touchmove",h,{passive:!1});let w=b=>{if(f!==(b.currentTarget===S.scrim))return;let $=x;if(x=null,$==="drag"&&(S.S.sheetDraggedAt=performance.now()),$!=="drag")return;a=performance.now(),b.timeStamp-v.at>80&&(p=0);let E=e.offsetHeight||innerHeight,M=()=>{e.style.transition=`transform 380ms ${bt}, height 380ms ${bt}`,S.scrim.style.transition="opacity 300ms",e.style.transform=S.scrim.style.opacity="",S.bar.style.transition="",S.host.style.removeProperty("--lab-p"),setTimeout(()=>e.style.transition=S.scrim.style.transition="",400)};if(r&&!e.classList.contains("full")&&(i<-40||p<-.4))return e.classList.add("full"),e.classList.contains("card")&&(S.S.cardFull=!0),M();if(r&&e.classList.contains("full")&&p<1.2&&(i>60||p>.4))return e.classList.remove("full"),e.classList.contains("card")&&(S.S.cardFull=!1),M();let z=l+Math.max(0,p)*499;if(S.S.dbg?.(`let go: moved ${Math.round(l)} speed ${p.toFixed(2)} rest ${Math.round(z)} of half ${Math.round(E/2)} \u2192 ${p>-.1&&z>E/2?"close":"stay"}`),p>-.1&&z>E/2)return qt(e,n,Math.min(320,Math.max(140,(innerHeight-e.getBoundingClientRect().top)/Math.max(p,1.2))));e.style.transition=`transform 380ms ${bt}`,S.scrim.style.transition="opacity 300ms",e.style.transform=S.scrim.style.opacity="",S.bar.style.transition="",S.host.style.removeProperty("--lab-p"),setTimeout(()=>e.style.transition=S.scrim.style.transition="",400)};e.addEventListener("touchend",w),S.scrim.addEventListener("touchend",w),S.scrim.addEventListener("touchcancel",w),e.addEventListener("touchcancel",w)}function uo(){if(S.coarse&&S.vv){let e=S.el("i",{style:"position:fixed;top:0;bottom:0;left:0;width:0;visibility:hidden;pointer-events:none"}),n=S.el("i",{style:"position:absolute;left:0;width:100vw;display:none;background:var(--_bg);z-index:3;pointer-events:none"});S.root.append(e,n);let r="",i=()=>{let s=Math.abs(S.vv.scale-1)>.01,a=e.getBoundingClientRect(),u=S.root.activeElement||document.activeElement,o=/^(textarea|input|select)$/.test(u?.localName||"")||!!u?.isContentEditable,l=s||!o?0:S.vv.offsetTop,p=(l?l+a.top:0)+S.vv.height,v=s?0:Math.max(0,Math.round(a.bottom-p)),x=s?0:Math.max(0,Math.round(p-a.bottom)),c=s?0:Math.round(S.vv.height),f=S.host.hasAttribute("data-sheet"),m=`${v} ${c} ${x} ${f} ${scrollY} ${Math.round(l)}`;if(m===r){let E=f?S.openSheet():null;E?.offsetHeight&&!E.style.transform&&Object.assign(i,{sheet:E,top:E.offsetTop});return}r=m,S.host.style.setProperty("--lab-kb",`${v}px`),S.host.style.setProperty("--lab-top",`${Math.round(l)}px`),c?S.host.style.setProperty("--lab-vh",`${c}px`):S.host.style.removeProperty("--lab-vh"),S.host.toggleAttribute("data-kb",v>60),n.style.display=f&&x?"block":"none",n.style.top=`${Math.round(scrollY+a.bottom)}px`,n.style.height=`${x}px`;let h=f?S.openSheet():null,w=Math.abs((i.vh||c)-c)>60||i.kbUp!==v>60,b=h&&h===i.sheet&&w&&!h.style.transform&&!S.still.matches;b&&(h.style.transition="none",h.offsetHeight);let $=h?h.offsetTop:null;b&&Math.abs(i.top-$)<=8&&(h.style.transition=""),b&&Math.abs(i.top-$)>8&&(h.style.transform=`translateY(${i.top-$}px)`,h.offsetHeight,h.style.transition=`transform 340ms ${bt}`,h.style.transform="",clearTimeout(i.done),i.done=setTimeout(()=>!h.style.transform&&(h.style.transition=""),360)),Object.assign(i,{vh:c,kbUp:v>60},h?.offsetHeight?{sheet:h,top:$}:{sheet:null}),v>60&&(S.S.kbSeen=v)};if(S.S.refit=i,S.root.addEventListener("focusin",()=>setTimeout(i,50)),S.root.addEventListener("focusout",()=>setTimeout(i,50)),S.vv.addEventListener("resize",i),S.vv.addEventListener("scroll",i),addEventListener("pointerdown",s=>ln={x:s.clientX,y:s.clientY,at:performance.now()},{capture:!0,passive:!0}),i(),globalThis.__LAB_DEBUG__!==!1&&/[?&]kbdebug\b/.test(location.search)){let s=[],a=performance.now(),u=0,o=v=>{let x=S.openSheet(),c=x?.getBoundingClientRect();s.push(`${Math.round(performance.now()-a)} ${v} h${Math.round(S.vv.height)} top${Math.round(S.vv.offsetTop)} in${innerHeight} kb${S.host.hasAttribute("data-kb")?1:0}`+(c?` sheet${Math.round(c.top)}/${Math.round(c.height)}${x.getAnimations().length?" anim":""}`:"")+` [${[...document.getAnimations(),...S.root.getAnimations()].map(f=>f.animationName||f.transitionProperty||"js").slice(0,6).join(",")}] scrim${getComputedStyle(S.scrim).opacity.slice(0,4)} scroll${Math.round(scrollY)}`)},l=v=>{o(v);let x=performance.now()+1500,c="",f=()=>{let m=s.length;o("f");let h=s[s.length-1].replace(/^\d+ f /,"");h===c&&(s.length=m),c=h,performance.now()<x&&requestAnimationFrame(f)};requestAnimationFrame(f)};S.root.addEventListener("focusin",()=>(a=performance.now(),l("focus")));let p=()=>{clearTimeout(u),u=setTimeout(async()=>{let v=s.join(`
|
|
10
|
+
`);s=[];for(let x=0;x<v.length;x+=1900)await S.send({name:"kb-log",text:v.slice(x,x+1900),anchor:{kind:"page",selector:"body",x:0,y:0,docX:0,docY:0,width:innerWidth}}).catch(()=>{})},2e3)};S.root.addEventListener("focusout",()=>{s.push("--- let go"),a=performance.now(),l("blur"),p()}),S.S.dbg=v=>{s.push(`${Math.round(performance.now()-a)} ${v}`),p()},S.vv.addEventListener("resize",()=>{l("resize"),s.length>1&&p()})}}}var g;function mo(e){g=e}var Ve=(e,n=!1)=>{g.S.stepping=!!g.S.openId,g.S.keepKeys=g.S.stepping&&(n||g.root.activeElement?.localName==="textarea"),g.S.openId=e.id,g.S.draft=null,g.coarse&&(g.S.listOpen=!1),g.render();let r=g.position(e.anchor||{}).top,i=r-Math.max(40,g.coarse&&g.S.openCard?.isConnected?(innerHeight-g.S.openCard.offsetHeight)/2:innerHeight/3);if(!g.coarse&&g.S.openCard?.isConnected){let a=g.S.openCard.getBoundingClientRect().bottom+scrollY-r+28;i=a<=innerHeight-80?r-28-(innerHeight-a)/2:r-40}un(i)};function Fe(){let e=g.threads();g.listBtn.hidden=!g.S.on||!g.coarse&&!e.length&&!g.held().length,g.goBtn.hidden=!g.S.on,g.goBtn.firstElementChild||g.goBtn.replaceChildren(g.el("span",{class:"gp"},"go"),g.el("kbd",{"aria-hidden":"true"},"1/2/3/4")),g.goFace(),g.goBtn.classList.toggle("on",(g.S.goMode||!!g.S.zoomMode)&&!g.S.cursorMode),g.goBtn.classList.toggle("cursor",g.S.cursorMode),g.goBtn.setAttribute("aria-pressed",String((g.S.goMode||!!g.S.zoomMode)&&!g.S.cursorMode));let n=e.filter(l=>!g.isPage(l)).reduce((l,p)=>l+g.unread(p).length,0);if(g.listBtn.replaceChildren(document.createTextNode(n?`list \xB7 ${n} new`:"list"),g.el("kbd",{"aria-hidden":"true"},"l")),g.newPrev.hidden=g.newNext.hidden=!g.S.on||!e.some(l=>!g.isPage(l)&&g.unread(l).length),!g.LIST_WINDOW){g.newPrev.hidden=g.newNext.hidden=!0,g.listBtn.hidden=!g.S.on,g.listBtn.replaceChildren(g.coarse?"new":g.keyWord("ne","w",""),g.el("b",{class:`cnt${n?"":" zero"}`},String(n))),g.listBtn.setAttribute("aria-label",`next new comment, ${n} new`),g.listBtn.setAttribute("aria-keyshortcuts","w"),g.listBtn.title="next new comment: W, or Control-D while typing (Shift for the one before)",g.listBtn.disabled=!n,g.listBtn.classList.toggle("quiet",!n);let l=e.filter(p=>!g.isPage(p)&&(p.resolved||Re(p)[0]==="done")&&!g.unread(p).length).length;g.doneBtn.hidden=!g.S.on,g.doneBtn.disabled=!l&&!g.S.showDone,g.doneBtn.classList.toggle("quiet",g.doneBtn.disabled),g.doneBtn.replaceChildren(g.S.showDone?`hide done \xB7 ${l}`:`show done \xB7 ${l}`,g.el("kbd",{"aria-hidden":"true"},"d")),g.doneBtn.setAttribute("aria-keyshortcuts","d")}g.placeBar();let r=e.reduce((l,p)=>l+g.unread(p).length,0);(!g.tabTitle.base||!document.title.startsWith("("))&&(g.tabTitle.base=document.title.replace(/^\(\d+\) /,""));let i=r?`(${r}) ${g.tabTitle.base}`:g.tabTitle.base;document.title!==i&&(document.title=i),g.listBtn.classList.toggle("has-new",n>0);let s=g.held().length;if(g.sendBtn.hidden=!s,g.sendBtn.textContent=`send ${s} draft${s===1?"":"s"}`,g.listEl.hidden=!g.S.on||!g.S.listOpen,g.listEl.hidden)return;for(let l of g.listEl.querySelectorAll("[data-f]"))l.classList.toggle("on",l.dataset.f===g.S.filter);let a=e.filter(l=>!g.isPage(l)&&g.unread(l).length).length;g.listEl.querySelector('[data-f="new"]').textContent=a?`new \xB7 ${a}`:"new";for(let l of["work","resolved","mine"])g.$(`[data-f="${l}"]`,g.listEl).hidden=!0;g.holdBtn.hidden=!g.DRAFT_MODE;let u=e.filter(l=>!g.isPage(l)&&(l.resolved||Re(l)[0]==="done")&&!g.unread(l).length).length;if(g.showDoneBtn.hidden=!u,g.showDoneBtn.textContent=g.S.showDone?`hide done \xB7 ${u}`:`show done \xB7 ${u}`,g.holdBtn.classList.toggle("on",g.drafting()),g.S.filter==="work")return g.listEl.querySelector(".items").replaceChildren(...la());let o=g.listed().map(l=>{let p=g.el("button",{class:`it${g.S.openId===l.id?" cur":""}`,type:"button"});return p.append(document.createTextNode(`${l.resolved?"\u2713":g.numberOf(l)} ${l.text.replace(/\s+/g," ").slice(0,70)} `),...g.onWhat(l)?[g.el("span",{},`on ${g.onWhat(l)} `)]:[],g.el("span",{},`\xB7 ${l.name}${!l.resolved&&g.isDone(l)?" \xB7 \u2705 done":""}`),...g.unread(l).length?[" ",g.el("span",{class:"tag"},`${g.unread(l).length} new`)]:[]),p.addEventListener("click",()=>Ve(l)),p});g.listEl.querySelector(".items").replaceChildren(...o.length?o:[g.el("div",{class:"none"},"nothing here")])}var Re=e=>{let n=[e,...g.repliesOf(e.id)],r=n.filter(a=>!a.session).map(a=>a.createdAt).sort().at(-1)||"",i=n.filter(a=>a.session).sort((a,u)=>a.createdAt.localeCompare(u.createdAt)).at(-1),s=i&&i.createdAt>r;return e.resolved||s&&/^done\b/i.test(i.text)?["done",s?i.createdAt:e.createdAt]:s&&/^on it\b/i.test(i.text)?["now",i.createdAt]:!s&&e.handedAt&&e.handedAt>=r?["now",e.handedAt]:s?[null,""]:["next",r]};function la(){let e=new Date().toDateString(),n=[],r=[],i=[];for(let o of g.S.comments.filter(l=>!l.parent)){let[l,p]=Re(o);l==="now"?n.push([o,p]):l==="next"?r.push([o,p]):l==="done"&&new Date(p).toDateString()===e&&i.push([o,p])}let s=([o,l],p)=>{let v=g.el("button",{class:`it${g.S.openId===o.id?" cur":""}`,type:"button"});return v.append(document.createTextNode(`${g.isPage(o)?"chat":o.resolved?"\u2713":g.numberOf(o)} ${o.text.replace(/\s+/g," ").slice(0,70)} `),g.el("span",{},`\xB7 ${p(l)}`)),v.addEventListener("click",()=>g.isPage(o)?(g.S.chatOpen=!0,g.S.listOpen=!1,g.render()):Ve(o)),v},a=(o,l,p,v=!1)=>l.length?[g.el("div",{class:"group"},`${o} \xB7 ${l.length}`),...l.sort((x,c)=>(v?-1:1)*x[1].localeCompare(c[1])).map(x=>s(x,p))]:[],u=[...a("Now",n,o=>`on it ${g.ago(o)}`.replace("on it just now","just started")),...a("Next",r,o=>`sent ${g.ago(o)} ago`.replace("just now ago","just now")),...a("Done today",i,o=>new Date(o).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),!0)];return u.length?u:[g.el("div",{class:"none"},"nothing in progress on this page")]}var Ge=e=>{let n=g.threads().filter(l=>!g.isPage(l)&&g.unread(l).length);if(!n.length)return;let r=l=>g.position(l.anchor||{}).top;n.sort((l,p)=>r(l)-r(p));let i=g.S.openId&&g.threads().find(l=>l.id===g.S.openId),s=i?r(i):null,a=s==null?-1:n.findIndex(l=>r(l)>s),u=n.findIndex(l=>l.id===g.S.openId),o=u>=0?(u+e+n.length)%n.length:s==null?e>0?0:n.length-1:e>0?a<0?0:a:((a<0?n.length:a)-1+n.length)%n.length;g.S.chatOpen=!1,Ve(n[o],!g.coarse)};var C;function fo(e){C=e}var fn=(e,n)=>{let r=n.cloneNode(!0);r.className="stamp-room",r.setAttribute("aria-hidden","true");for(let s of r.querySelectorAll("[role]"))s.removeAttribute("role");([...e.children].reverse().find(s=>s.classList?.contains("p"))||e).append(r),e.append(n)};function Ht(){let e=new Map(C.S.comments.map(c=>[c.id,c])),n=C.S.comments.filter(c=>C.isPage(c)||c.parent&&C.isPage(e.get(c.parent)||{})).sort((c,f)=>c.createdAt.localeCompare(f.createdAt)).slice(-150);C.S.on&&C.S.chatOpen&&C.chatEl.hidden&&(C.S.newFrom=n.find(C.isNew)?.id||null),C.S.chatOpen||(C.S.newFrom=null),C.S.on&&C.S.chatOpen&&C.markSeen(n.filter(C.isNew));let r=n.filter(C.isNew).length;C.chatBtn.hidden=!C.S.on;{let c=C.chatBtn.querySelector(".mark");for(;C.chatBtn.lastChild&&C.chatBtn.lastChild!==c;)C.chatBtn.lastChild.remove();C.chatBtn.append(C.coarse?"chat":C.keyWord("","c","hat"),C.el("b",{class:`cnt${r?"":" zero"}`},String(r))),C.chatBtn.setAttribute("aria-label",`chat, ${r} new`),C.chatBtn.setAttribute("aria-keyshortcuts","c")}C.chatBtn.classList.toggle("has-new",r>0),C.placeBar();let i=C.chatEl.hidden;if(C.chatEl.hidden=!C.S.on||!C.S.chatOpen,C.chatEl.hidden&&C.chatEl.classList.remove("full"),C.chatEl.hidden&&C.chatEl.contains(C.root.activeElement)&&C.root.activeElement.blur(),C.chatEl.hidden)return;let s=C.$(".msgs",C.chatEl),a=i||s.scrollHeight-s.scrollTop-s.clientHeight<48,u=new Set(i?[]:[...s.children].map(c=>c.dataset.id)),o=new Map([...s.children].filter(c=>c.dataset.id).map(c=>[c.dataset.id,c])),l=c=>{let f=o.get(c.dataset?.id);return f&&f.outerHTML.replace(" fresh","")===c.outerHTML?f:c};C.patchKids(s,n.flatMap(c=>{let f=c.parent?e.get(c.parent):c,m=C.el("div",{class:`msg${C.mine(c)&&!c.session?" mine":""}${f&&C.S.replyTo===f.id?" to":""}${u.size&&!u.has(c.id)?" fresh":""}`,"data-id":c.id,...C.agentOf(c)?{"data-agent":C.agentOf(c)}:{}});if(m.append(C.nameLine(c.name,!1)),c.parent&&f){let h=C.el("div",{class:"quote"});h.append(C.el("b",{},String(f.name||"").replace(/\s*·\s*session\s+\S+$/i,"")),document.createTextNode(f.text.replace(/\s+/g," ").slice(0,90))),h.addEventListener("click",w=>{w.stopPropagation();let b=C.$(".msgs",C.chatEl),$=C.$(`[data-id="${f.id}"]`,b);$&&(b.scrollTo({top:$.offsetTop-b.offsetTop-12,behavior:C.still.matches?"auto":"smooth"}),$.animate?.([{boxShadow:"0 0 0 2px rgb(52,199,89)"},{boxShadow:"0 0 0 0 transparent"}],{duration:900}))}),m.append(h)}return m.append(...C.readable(c.text)),fn(m,C.stampOf(c,f)),c.id===C.S.newFrom&&c!==n[0]?[C.el("div",{class:"newline"},"new"),m]:[m]}).map(l));let p=C.$(".replying",C.chatEl),v=C.S.replyTo&&e.get(C.S.replyTo);if(p.hidden=!v,v){let c=C.el("button",{type:"button",title:"about the page instead"},"\u2715");c.addEventListener("click",()=>(C.S.replyTo=null,Ht())),p.replaceChildren(document.createTextNode(`\u21A9 ${v.name}: ${v.text.replace(/\s+/g," ").slice(0,40)}`),c)}s.firstChild||s.append(C.el("div",{class:"none"},"say something about the page as a whole"));let x=C.chatEl.querySelector(".chat");x.firstChild||x.append(C.composer({placeholder:"message",draftKey:`lab-typing:${C.S.page}:chat`,onSubmit:async(c,f)=>{let{comment:m}=await C.send(C.S.replyTo?{name:c,text:f,parent:C.S.replyTo}:{name:c,text:f,anchor:{kind:"page",width:innerWidth,height:innerHeight,dpr:devicePixelRatio||1}}),h=C.S.replyTo&&C.S.comments.find(w=>w.id===C.S.replyTo);return h?.resolved&&(h.resolved=!1),C.S.replyTo=null,C.S.comments.push(m),C.markSeen([m]),s.scrollTop=s.scrollHeight,C.render(),{keep:!0}}})),x.querySelector("textarea").placeholder=v?"reply":"message",a&&(s.scrollTop=s.scrollHeight)}var A;function go(e){A=e}function gn(e,n,r){A.layer.append(e);let i=e.offsetWidth,s=scrollX+document.documentElement.clientWidth-i-12;e.style.left=`${Math.max(scrollX+12,Math.min(n-14,s))}px`;let a=e.offsetHeight,u=r+10+a>A.contentEnd();e.style.top=`${u?Math.max(scrollY+8,r-40-a):r+10}px`,e.style.transformOrigin=u?"14px 100%":""}function ho(e,n,r){A.layer.append(e);let i=e.offsetWidth,s=scrollX+document.documentElement.clientWidth-12,a=e.offsetHeight,u=A.contentEnd();n+36+i<=s?(e.style.left=`${n+36}px`,e.style.top=`${Math.min(r-37,u-a-8)}px`):(e.style.left=`${Math.max(scrollX+12,Math.min(n-14,s-i))}px`,e.style.top=`${r+10+a>u?Math.max(scrollY+8,r-40-a):r+10}px`)}function bo(e,n){e.addEventListener("pointerdown",r=>{if(r.button!==0)return;let i=e.getBoundingClientRect(),s={dx:r.clientX-i.left,dy:r.clientY-i.bottom},a={x:r.clientX,y:r.clientY,sx:scrollX,sy:scrollY,left:parseFloat(e.style.left),top:parseFloat(e.style.top)},u=!1,o=r;A.S.grabbing=!0,e.setPointerCapture(r.pointerId);let l=()=>{e.style.left=`${a.left+o.clientX-a.x+scrollX-a.sx}px`,e.style.top=`${a.top+o.clientY-a.y+scrollY-a.sy}px`},p=c=>{o=c,!(!u&&Math.hypot(c.clientX-a.x,c.clientY-a.y)<5)&&(u=!0,e.classList.add("dragging"),l())},v=()=>u&&l();addEventListener("scroll",v,!0),A.S.dropDrag=()=>{removeEventListener("scroll",v,!0),A.S.dropDrag=null};let x=async c=>{if(e.removeEventListener("pointermove",p),e.removeEventListener("pointerup",x),e.removeEventListener("pointercancel",x),e.removeEventListener("lostpointercapture",x),A.S.dropDrag?.(),!A.S.grabbing||(A.S.grabbing=!1,!u))return;e.dataset.dragged="1",setTimeout(()=>delete e.dataset.dragged,0);let f=c.clientX-s.dx,m=c.clientY-s.dy,h=document.elementsFromPoint(f,m).find(b=>b!==A.host);if(c.type==="pointercancel"||f<0||m<0||f>innerWidth||m>innerHeight||h?.closest(A.OFF))return A.render();let w=n.anchor;n.anchor={...A.anchorAt(f,m),...w?.zoom?{zoom:w.zoom}:{}},A.render();try{let{comment:b}=await A.send({action:"move",id:n.id,anchor:n.anchor,edit:A.store.get(`lab-edit:${n.id}`)||void 0});Object.assign(n,b)}catch{n.anchor=w,A.render()}};e.addEventListener("pointermove",p),e.addEventListener("pointerup",x),e.addEventListener("pointercancel",x),e.addEventListener("lostpointercapture",x)})}function xo(e,n=new Set,r=!1){let i=A.el("div",{class:"card"}),s=A.el("div",{class:"body"}),a=A.el("div",{class:"foot"});i.append(A.el("div",{class:"handle"}),s,a),i.addEventListener("click",c=>c.stopPropagation()),s.classList.add("msgs");let u=c=>{let f=A.el("div",{class:`item msg${A.mine(c)&&!c.session?" mine":""}`,"data-id":c.id,...A.agentOf(c)?{"data-agent":A.agentOf(c)}:{}});return f.append(A.nameLine(c.name,!1),...A.readable(c.text)),A.stamped(f,A.stampOf(c,e,c===e&&!e.resolved?`#${A.numberOf(e)} \xB7 `:"")),f},o=new Set,l=[e,...A.repliesOf(e.id)],p=l.find(c=>n.has(c.id));for(let c of l)c===p&&c!==e&&s.append(A.el("div",{class:"newline"},"new")),s.append(u(c)),o.add(c.id);i.sync=()=>{for(let c of A.repliesOf(e.id)){if(o.has(c.id))continue;let f=i.querySelectorAll(".item"),m=u(c);m.classList.add("fresh"),f[f.length-1].after(m),o.add(c.id),A.markSeen([c])}};let v=A.store.get(`lab-edit:${e.id}`),x=null;if(A.S.isAdmin||v){x=A.el("div",{class:"row acts"});let c=A.el("button",{class:"btn",type:"button"},e.resolved?"reopen":"resolve"),f=$=>$.textContent="failed, try again";c.addEventListener("click",async()=>{try{let $=!e.resolved,{comment:E}=await A.send({action:e.resolved?"reopen":"resolve",id:e.id,...v?{edit:v}:{}});if(Object.assign(e,E),$&&A.S.openId===e.id)return A.S.closeFast=!0,A.S.openId=null,A.render();A.render()}catch{f(c)}});let m=A.el("button",{class:"btn",type:"button"},"delete"),h=A.el("button",{class:"btn danger",type:"button"},"delete"),w=A.el("button",{class:"btn",type:"button"},"cancel"),b=()=>{x.replaceChildren(c,m),m.focus()};m.addEventListener("click",()=>{x.replaceChildren(A.el("span",{class:"ask"},A.repliesOf(e.id).length?"delete thread?":"delete comment?"),h,w),w.focus()}),w.addEventListener("click",b),x.addEventListener("keydown",$=>{$.key==="Escape"&&h.isConnected&&($.stopPropagation(),b())}),h.addEventListener("click",async()=>{try{await A.send({action:"delete",id:e.id})}catch{return f(h)}A.S.comments=A.S.comments.filter($=>$.id!==e.id&&$.parent!==e.id),A.S.openId=null,A.render()}),x.append(...A.S.isAdmin?[c,m]:[c]),s.append(x)}if(A.coarse){let c=w=>A.position(w.anchor||{}).top,f=c(e),m=A.threads().filter(w=>!A.isPage(w)&&w.id!==e.id&&A.unread(w).length).map(w=>[w,c(w)]);m.sort((w,b)=>(w[1]>f?0:1)-(b[1]>f?0:1)||w[1]-b[1]);let h=A.el("div",{class:"row nav"});if(m.length){let w=A.el("button",{class:"btn",type:"button"},`new \xB7 ${m.length} \u203A`);w.addEventListener("pointerdown",b=>b.preventDefault()),w.addEventListener("click",()=>A.goTo(m[0][0])),h.append(w)}x&&h.append(x),h.firstChild&&i.insertBefore(h,s)}return a.append(A.composer({placeholder:"reply",autofocus:r,draftKey:`lab-typing:${A.S.page}:${e.id}`,onSubmit:async(c,f)=>{let{comment:m}=await A.send({name:c,text:f,parent:e.id});if(A.S.comments.push(m),A.markSeen([m]),e.resolved){e.resolved=!1,A.render();let b=A.S.openCard?.querySelector(".body");return b&&(b.scrollTop=b.scrollHeight),A.S.openCard?.querySelector("textarea")?.focus({preventScroll:!0}),{keep:!0}}o.add(m.id);let h=i.querySelectorAll(".item"),w=u(m);return w.classList.add("fresh"),h[h.length-1].after(w),s.scrollTop=s.scrollHeight,{keep:!0}}})),i}var N;function yo(e){N=e}function vo(){if(N.script?.dataset.live){let xe=function(y){{if(y.widget&&N.script.dataset.widget&&y.widget!==N.script.dataset.widget||(y.lab&&N.script.dataset.lab&&y.lab!==N.script.dataset.lab&&(N.script.dataset.lab=y.lab,N.script.dataset.version=String(y.files),m=y.hot,c=y.comments,I(),N.load()),String(y.files)!==N.script.dataset.version))return a();m!==null&&y.hot!==m&&(y.hot-m>1?te([{kind:"html"},{kind:"css",path:""}]):te(y.hotFiles||[])),m=y.hot,c!==null&&y.comments!==c&&N.loadChanges(c),c=y.comments,y.reads!==f&&(f=y.reads,N.syncReads());let _=y.session,B=_?y.mode||"listening":"away",q=ce=>Object.assign(document.createElement("span"),{textContent:ce}),H=_?.model?`${_.agent||"Claude"} \xB7 ${_.model}`:_?.agent||"Claude",W=_&&_.name!==(_.agent||"Claude")?[q(`(${_.name})`)]:[];B==="listening"?l.replaceChildren(q("talking to"),H,...W):B==="working"?l.replaceChildren(H,q("is working"),...W):l.replaceChildren(q("no agent listening")),u.classList.toggle("idle",B==="away"),u.classList.toggle("working",B==="working"),N.listBtn.dataset.agent=B,N.chatBtn.dataset.agent=B,N.coarse&&!N.chatBtn.querySelector(".mark")&&N.chatBtn.insertAdjacentHTML("afterbegin",o),N.coarse&&(N.chatBtn.title=u.textContent),u.setAttribute("aria-label",u.textContent),_?.url&&B!=="away"?Object.assign(u,{href:_.url,target:"_blank"}):u.removeAttribute("href"),u.title=B==="away"?"Ask your agent to run: npx @leonidstern/labit wait":_?.resume||"",u.hidden=!1}},e="lab-scroll:"+location.pathname;try{let y=JSON.parse(sessionStorage.getItem(e)||"null");y!==null&&(sessionStorage.removeItem(e),y.open&&(N.S.openId=y.open),y.list&&(N.S.listOpen=!0,N.S.filter=["new","open","resolved","mine"].includes(y.filter)?y.filter:N.S.filter),y.chat&&(N.S.chatOpen=!0),addEventListener("load",()=>scrollTo(0,+(y.y??y))))}catch{}let n=0;for(let y of["pointerdown","keydown","wheel","touchstart"])addEventListener(y,()=>n=performance.now(),{capture:!0,passive:!0});let r=()=>N.S.draft||N.S.grabbing||N.S.openId||N.S.chatOpen||N.S.listOpen||N.coarse&&/^(textarea|input)$/.test(N.root.activeElement?.localName||"")||[...N.root.querySelectorAll("textarea")].some(y=>y.value.trim())||performance.now()-n<1500,i=!1,s=0,a=()=>{if(document.hidden)return void(i=!0);if(r()){s||(s=setTimeout(()=>(s=0,a()),500));return}try{sessionStorage.setItem(e,JSON.stringify({y:scrollY,open:N.S.openId,list:N.S.listOpen,filter:N.S.filter,chat:N.S.chatOpen}))}catch{}location.reload()},u=document.createElement("a");u.className="listener";let o='<svg class="mark" viewBox="0 0 64 64" aria-hidden="true"><g transform="translate(-1 -.5)"><path class="e1" d="M18.9 24.67L24.4 3h11.5L31.28 21.2A22.8 22.8 0 0 0 18.9 24.67Z"/><path class="e2" d="M37.07 22.02L41.9 3h11.5L47.1 27.85A22.8 22.8 0 0 0 37.07 22.02Z"/><path d="M31 26a18 18 0 0 1 18 18 18 18 0 0 1-18 18H15.57a2.57 2.57 0 0 1-2.57-2.57V44A18 18 0 0 1 31 26Z"/><circle class="eye" cx="31" cy="45" r="6.2"/></g></svg>';u.innerHTML=o+'<div class="lbl"></div>';let l=u.querySelector(".lbl");u.hidden=!0,N.root.querySelector(".left").prepend(u),document.querySelector('link[rel~="icon"]')||fetch("/favicon.ico",{method:"HEAD"}).then(y=>y.ok&&(y.headers.get("content-type")||"").startsWith("image/")).catch(()=>!1).then(y=>{y||document.querySelector('link[rel~="icon"]')||document.head.append(Object.assign(document.createElement("link"),{rel:"icon",href:"/_lab/favicon.svg"}))});let p=null,v=0,x=y=>{l.replaceChildren(Object.assign(document.createElement("span"),{textContent:y})),u.setAttribute("aria-label",y),u.classList.add("idle"),u.classList.remove("working"),u.hidden=!1},c=null,f=null,m=null,h=y=>{let _=[...document.querySelectorAll('link[rel~="stylesheet"][href]:not([data-lab-swap])')].filter(q=>new URL(q.href,location.href).origin===location.origin),B=_.filter(q=>y.includes(decodeURIComponent(new URL(q.href,location.href).pathname)));for(let q of B.length?B:_){let H=new URL(q.href,location.href);H.searchParams.set("lab-v",Date.now().toString(36));let W=q.cloneNode();W.href=H.href,W.dataset.labSwap="";let ce=H.pathname;W.addEventListener("load",()=>{for(let D of document.querySelectorAll('link[rel~="stylesheet"][href]'))D!==W&&new URL(D.href,location.href).pathname===ce&&D.remove();delete W.dataset.labSwap},{once:!0}),W.addEventListener("error",()=>W.remove(),{once:!0}),q.after(W)}},w=y=>{let _=new URL(y,location.href);return _.searchParams.set("lab-v",Date.now().toString(36)),_.href},b=(y,_)=>{try{let B=new URL(y,location.href);return B.origin===location.origin&&_.includes(decodeURIComponent(B.pathname))}catch{return!1}},$=y=>{let _=0;for(let B of document.querySelectorAll('img, source, video[poster], image, use, link[rel~="icon"]')){if(N.host.contains(B))continue;for(let H of["src","href","poster","xlink:href"]){let W=B.getAttribute(H);if(!W||!b(W.split("#")[0],y))continue;let ce=w(W.split("#")[0]),D=new Image;D.src=ce,(D.decode?D.decode():Promise.resolve()).catch(()=>{}).finally(()=>B.setAttribute(H,ce+(W.includes("#")?W.slice(W.indexOf("#")):""))),_++}let q=B.getAttribute("srcset");q&&q.split(",").some(H=>b(H.trim().split(/\s+/)[0],y))&&(B.setAttribute("srcset",q.split(",").map(H=>{let[W,...ce]=H.trim().split(/\s+/);return[b(W,y)?w(W):W,...ce].join(" ")}).join(", ")),_++)}_||h([])},E=y=>{for(let _ of document.styleSheets){let B;try{B=_.cssRules}catch{continue}for(let q of B||[]){if(!(q instanceof CSSFontFaceRule))continue;let H=q.style.getPropertyValue("src"),W=_.href||location.href;if(!/url\(/.test(H)||![...H.matchAll(/url\(["']?([^"')]+)/g)].some(oe=>b(new URL(oe[1],W).href,y)))continue;let ce=H.replace(/url\(["']?([^"')]+)["']?\)/g,(oe,Z)=>b(new URL(Z,W).href,y)?`url("${w(new URL(Z,W).href)}")`:oe),D=oe=>q.style.getPropertyValue(oe)||void 0;try{new FontFace(D("font-family").replace(/^["']|["']$/g,""),ce,{weight:D("font-weight"),style:D("font-style"),stretch:D("font-stretch"),unicodeRange:D("unicode-range"),display:D("font-display")}).load().then(Z=>document.fonts.add(Z)).catch(()=>{})}catch{}}}},M=()=>new Set([N.fonts,N.pinCursorStyle]),z=y=>[...y.querySelectorAll("script")].filter(_=>!/\/_lab\/comments\.js/.test(_.getAttribute("src")||"")).map(_=>_.getAttribute("src")||_.textContent),O=y=>[...y.querySelectorAll('link[rel~="stylesheet"]')].map(_=>{try{return new URL(_.getAttribute("href"),location.href).pathname}catch{return""}}),P=y=>y===N.host||y.nodeType===1&&y.localName==="script",V=(y,_)=>y.nodeType===_.nodeType&&y.nodeName===_.nodeName&&(y.nodeType!==1||(y.id||"")===(_.id||"")),X=(y,_)=>V(y,_)&&(y.nodeType===1?!!y.id||y.getAttribute("class")===_.getAttribute("class"):y.nodeType!==3||y.data===_.data),F=(y,_)=>{let B=[...y.childNodes].filter(D=>!P(D)),q=[..._.childNodes].filter(D=>!(D.nodeType===1&&D.localName==="script")),H=0,W=null,ce=D=>{let oe=document.importNode(D,!0);return y.insertBefore(oe,W?W.nextSibling:B[H]||y.firstChild),oe};q.forEach((D,oe)=>{let Z=B[H];if(!Z)return void(W=ce(D));if(X(Z,D))return W=Y(Z,D),void H++;if(q.slice(oe+1,oe+8).some(ae=>X(Z,ae)))return void(W=ce(D));let Ee=B.slice(H+1,H+8).findIndex(ae=>X(ae,D));if(Ee>=0){for(let ae of B.slice(H,H+1+Ee))ae.remove();return H+=Ee+1,W=Y(B[H],D),void H++}W=Y(Z,D),H++});for(let D of B.slice(H))D.remove()},Y=(y,_)=>{if(y.nodeType!==_.nodeType||y.nodeName!==_.nodeName||y.nodeType===1&&(y.id||"")!==(_.id||"")){let B=document.importNode(_,!0);return y.replaceWith(B),B}if(y.nodeType===3||y.nodeType===8)return y.data!==_.data&&(y.data=_.data),y;if(y.nodeType!==1)return y;for(let{name:B}of Array.from(y.attributes))!_.hasAttribute(B)&&!(B==="open"&&/^(details|dialog)$/.test(y.localName))&&y.removeAttribute(B);for(let{name:B,value:q}of Array.from(_.attributes))y.getAttribute(B)!==q&&y.setAttribute(B,q);return y===document.activeElement||y.shadowRoot||/^(iframe|canvas|video|audio|textarea|select|input)$/.test(y.localName)||F(y,_),y},se=()=>z(document).length>0,ee=0,I=async()=>{if(se())return a();let y=++ee;try{let _=await fetch(location.href,{cache:"no-store",headers:{accept:"text/html"}});if(!_.ok)return a();let B=await _.text();if(y!==ee)return;let q=new DOMParser().parseFromString(B,"text/html");if(z(q).join(`
|
|
11
|
+
`)!==z(document).join(`
|
|
12
|
+
`)||O(q).join(`
|
|
13
|
+
`)!==O(document).join(`
|
|
14
|
+
`))return a();let H=null;for(let oe of[Math.min(innerHeight/3,240),innerHeight/2,80]){let Z=document.elementFromPoint(innerWidth/2,oe);if(Z&&Z!==document.body&&Z!==document.documentElement&&!N.host.contains(Z)&&Z!==N.host){H=Z;break}}let W=H?.getBoundingClientRect().top,ce=()=>{q.title!==N.tabTitle.base&&(N.tabTitle.base=q.title,document.title=q.title,N.drawList());let oe=M(),Z=[...document.head.querySelectorAll("style")].filter(ae=>!oe.has(ae)),Ee=[...q.head.querySelectorAll("style")];Ee.forEach((ae,_e)=>Z[_e]?Z[_e].textContent!==ae.textContent&&(Z[_e].textContent=ae.textContent):document.head.append(document.importNode(ae,!0)));for(let ae of Z.slice(Ee.length))ae.remove();if(F(document.body,q.body),H?.isConnected){let ae=H.getBoundingClientRect().top-W;Math.abs(ae)>1&&scrollBy(0,ae)}N.reflow(),N.drawZoom()},D=()=>{try{ce()}catch{a()}};document.startViewTransition&&!N.still.matches?document.startViewTransition(D):D()}catch{a()}},te=y=>{let _=q=>y.filter(H=>H.kind===q).map(H=>H.path),B=decodeURIComponent(location.pathname).replace(/\/$/,"/index").replace(/\.html?$/i,"");_("html").some(q=>!q||q.replace(/\.html?$/i,"")===B)&&I(),_("css").length&&h(_("css")),_("img").length&&$(_("img")),_("font").length&&E(_("font"))},le=Math.random().toString(36).slice(2,12),ne=0,be=0,Be=async()=>{try{xe(await(await fetch(`${N.script.dataset.live.replace(/live$/,"state")}?tab=${le}`,{cache:"no-store"})).json())}catch{}},vt=()=>{clearTimeout(be),be=setTimeout(()=>{p?.close(),p=null,clearInterval(ne),ne=setInterval(Be,2e4)},3e4)},wt=()=>{clearTimeout(be),clearInterval(ne),ne=0,Le()},Le=()=>{p||(p=new EventSource(`${N.script.dataset.live}?tab=${le}`),v=Date.now(),p.addEventListener("beat",()=>v=Date.now()),p.onerror=()=>x("reconnecting"),p.onmessage=y=>{v=Date.now(),xe(JSON.parse(y.data))})};document.addEventListener("visibilitychange",()=>{if(document.hidden)return vt();if(i)return a();wt()}),addEventListener("pagehide",()=>{p?.close(),p=null,fetch(N.script.dataset.live.replace(/live$/,"bye"),{method:"POST",keepalive:!0,headers:{"content-type":"application/json"},body:JSON.stringify({tab:le})}).catch(()=>{})}),addEventListener("pageshow",y=>y.persisted&&Le());let Je=Date.now(),ye=()=>{p?.close(),p=null,x("reconnecting"),Le()};setInterval(()=>{let y=Date.now(),_=y-Je>2e4;Je=y,!document.hidden&&(_||p&&y-v>4e4)&&ye()},5e3),addEventListener("online",()=>!document.hidden&&ye()),Le(),document.hidden&&vt()}}var we;function wo(e){we=e}function yt(e){let n=document.createElement("span");n.className="zi",n.setAttribute("aria-hidden","true");let r=e==="in"?"M14 2 9.5 6.5M9.5 3.2v3.3h3.3M2 14l4.5-4.5M6.5 12.8V9.5H3.2":"M9.5 6.5 14 2M10.7 2H14v3.3M6.5 9.5 2 14M2 10.7V14h3.3";return n.innerHTML=`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="${r}"/></svg>`,n}var Wt=[];function hn(e,n){Wt.push({block:e,dir:n,at:Date.now()})}var ca=(e,n)=>{let r=document.querySelector(`[data-zoom="${n}"][data-zoom-of="${CSS.escape(e)}"]`);return r&&!we.host.contains(r)?r:null};function bn(e){let n=e.getBoundingClientRect(),r=matchMedia("(prefers-reduced-motion: reduce)").matches;scrollTo({top:Math.max(0,n.top+scrollY-24),behavior:r?"auto":"smooth"});let i="2px solid rgb(52, 199, 89)";e.animate([{outline:i,outlineOffset:"4px"},{outline:i,outlineOffset:"4px",offset:.7},{outline:"2px solid transparent",outlineOffset:"4px"}],{duration:2e3})}function xn(){for(let e=Wt.length-1;e>=0;e--){let n=Wt[e],r=ca(n.block,n.dir);(r||Date.now()-n.at>30*6e4)&&Wt.splice(e,1),r&&requestAnimationFrame(()=>bn(r))}}function $e(e){e&&we.S.cursorMode&&we.setCursor(!1),we.S.zoomMode=e;try{sessionStorage.setItem("lab-zoom",e)}catch{}we.refreshPinCursor(),we.goFace(),we.recheck(),we.render()}function ko(e,n){return e.key==="Escape"?($e(""),!0):!1}function So(){try{let e=sessionStorage.getItem("lab-zoom");we.S.zoomMode=e==="in"||e==="out"?e:""}catch{we.S.zoomMode=""}}var yn=e=>e==="out"?"zoom out: the bigger picture":"zoom in: dive deeper";/*!
|
|
15
|
+
* lab comments: anyone with the link clicks anywhere on a lab page to pin a comment. No login, just a name.
|
|
16
|
+
* https://github.com/leonidstern/labit · MIT
|
|
17
|
+
* Comments are off by default; the bar button or c turns them on (remembered per browser). When on, click anywhere that isn't a link or control to pin one (alt/option-click pins on those too). c (or the bar button) hides
|
|
18
|
+
* and shows them; esc or a click outside closes an open comment. Dragging (mouse/pen) marks an area instead of a point.
|
|
19
|
+
* Include on a page served through your lab domain:
|
|
20
|
+
* <script src="https://lab.example.com/_lab/comments.js" defer><\/script>
|
|
21
|
+
* The layer only turns on when the page is opened on the host the script is loaded from (or data-host),
|
|
22
|
+
* so the deployment's own address and local dev stay clean. data-enable="always" turns it on everywhere.
|
|
23
|
+
* Admin (resolve / delete / copy agent link): open any page once with ?lab-admin=<LAB_COMMENTS_ADMIN_TOKEN>; it is kept in this browser.
|
|
24
|
+
*/(()=>{let e={dbg:null},n={get $(){return M},get API(){return a},get headers(){return W},get DRAFT_MODE(){return an},get LIST_WINDOW(){return Be},get OFF(){return me},get S(){return e},get agentOf(){return H},get ago(){return Ao},get anchorAt(){return He},get bar(){return V},get chatBtn(){return y},get chatEl(){return ye},get closeOrNudge(){return On},get coarse(){return re},get composer(){return sn},get contentEnd(){return zo},get doneBtn(){return le},get drafting(){return gt},get drawList(){return Fe},get el(){return _},get fonts(){return pe},get goBtn(){return ee},get goFace(){return Kt},get goTo(){return Ve},get held(){return tt},get holdBtn(){return Je},get host(){return $},get isDone(){return Co},get isNew(){return Sn},get isPage(){return wn},get keyWord(){return Mo},get layer(){return z},get listBtn(){return se},get listEl(){return xe},get listed(){return _o},get load(){return D},get loadChanges(){return oe},get markSeen(){return ot},get mine(){return Et},get nameLine(){return Qn},get newNext(){return wt},get newPrev(){return I},get numberOf(){return Yt},get onWhat(){return io},get openSheet(){return zn},get patchKids(){return B},get pinCursorStyle(){return ct},get placeBar(){return To},get position(){return We},get readable(){return eo},get reflow(){return Tt},get drawZoom(){return xn},get refreshPinCursor(){return en},get setCursor(){return Ft},get recheck(){return Ce},get render(){return j},get repliesOf(){return Vt},get root(){return E},get scrim(){return Jt},get script(){return r},get send(){return je},get sendBtn(){return Le},get showDoneBtn(){return te},get stampOf(){return so},get stamped(){return fn},get still(){return Lt},get store(){return o},get syncReads(){return Zt},get tabTitle(){return vt},get threads(){return et},get unread(){return nt},get vv(){return Po}};yo(n),wo(n),mo(n),fo(n),go(n),lo(n);let r=document.currentScript,i=r?.dataset.host||(r?.src?new URL(r.src,location.href).hostname:location.hostname);if(!(location.hostname===i||r?.dataset.enable==="always")||window.__labComments)return;window.__labComments=!0;let a=r?.dataset.api||"/_lab/api/comments",u=()=>r?.dataset.page||location.pathname.replace(/\/+$/,"")||"/";e.page=u();let o={get:t=>{try{return localStorage.getItem(t)||""}catch{return""}},set:(t,d)=>{try{localStorage.setItem(t,d)}catch{}}},l=r?.dataset.me||"";l&&!o.get("lab-name")&&o.set("lab-name",l);let p=r?.dataset.live?r.dataset.live.replace(/live$/,"me"):"",v=l,x=t=>{!p||!t||t===v||(v=t,fetch(p,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t})}).catch(()=>{}))},c=t=>t.split(".").length===3?t.split(".")[1]:"",f=new URLSearchParams(location.hash.slice(1)).get("lab-admin")||new URLSearchParams(location.search).get("lab-admin");if(f){let t=c(f);o.set(t?`lab-admin:${t}`:"lab-admin",f);let d=new URL(location.href);d.searchParams.delete("lab-admin"),/lab-admin=/.test(d.hash)&&(d.hash=""),history.replaceState(null,"",d)}let m=r?.dataset.admin||o.get(`lab-admin:${e.page.split("/")[1]||""}`)||o.get("lab-admin:*")||o.get("lab-admin");e.comments=[],e.isAdmin=!1,e.on=o.get("lab-on")?o.get("lab-on")==="1":r?.dataset.on==="1",e.openId=null,e.closeFast=!1,e.cardFull=!1,e.draft=null;let h=()=>`lab-spot:${e.page}`,w=t=>o.set(h(),t?JSON.stringify(t):""),b=()=>{try{return JSON.parse(o.get(h())||"null")}catch{return null}},$=document.createElement("div");$.setAttribute("data-lab-comments",""),$.style.cssText="position:absolute;top:0;left:0;width:0;height:0;z-index:2147483000;";let E=$.attachShadow({mode:"open"});E.innerHTML=`
|
|
25
|
+
<style>${qn}</style>
|
|
26
|
+
<div class="scrim"></div>
|
|
27
|
+
<div class="layer"></div>
|
|
28
|
+
<button class="sel-chip" type="button" hidden>Comment</button>
|
|
29
|
+
<div class="hint" role="status" hidden>click to comment \xB7 drag to mark an area \xB7 shift-drag to quote words \xB7 c chat \xB7 w new \xB7 1 comment \xB7 2 go \xB7 3 in, 3 again out \xB7 4 pointer \xB7 p pause \xB7 m hide</div>
|
|
30
|
+
<div class="list" hidden><div class="tabs"><button type="button" data-f="new">new</button><button type="button" data-f="open">open</button><button type="button" data-f="work">work</button><button type="button" data-f="resolved">resolved</button><button type="button" data-f="mine">mine</button><button type="button" class="show-done" title="show or hide done pins on the page"></button><button type="button" class="hold" title="new pins wait here as drafts; send them together">draft mode</button><button type="button" class="x" aria-label="close">\u2715</button></div><div class="items"></div></div>
|
|
31
|
+
<div class="list chatwin" hidden><div class="tabs"><b>chat</b></div><div class="msgs"></div><div class="replying" hidden></div><div class="chat"></div></div>
|
|
32
|
+
<div class="left"><button class="secondary copy-all" type="button" hidden>copy link</button></div>
|
|
33
|
+
<div class="bar">
|
|
34
|
+
<button class="secondary send-all" type="button" hidden></button>
|
|
35
|
+
<button class="secondary chat-btn" type="button" hidden title="chat (C)">chat</button>
|
|
36
|
+
<button class="secondary new-prev" type="button" hidden aria-label="previous new comment">\u2039</button>
|
|
37
|
+
<button class="secondary list-btn" type="button" hidden>list</button>
|
|
38
|
+
<button class="secondary new-next" type="button" hidden aria-label="next new comment">\u203A</button>
|
|
39
|
+
<button class="secondary done-btn" type="button" hidden title="show or hide done pins on the page"></button>
|
|
40
|
+
<button class="secondary pause-btn" type="button" aria-pressed="false" title="stop everything that moves on the page, to pin a moment (p)">pause motion</button>
|
|
41
|
+
<button class="secondary over-btn" type="button" aria-pressed="false" title="a click on the page's own links and buttons places a comment too, instead of being theirs (option-click always does)">pin over controls</button>
|
|
42
|
+
<button class="secondary go-btn" type="button" hidden title="tap: comment \u2192 go \u2192 zoom in \u2192 zoom out \xB7 keys: 1 comment \xB7 2 go: every click approves what it's on \xB7 3 zoom in, 3 again zoom out: ask the agent for a deeper look or the bigger picture \xB7 4 pointer: clicks are the page's own">go</button>
|
|
43
|
+
<button class="toggle" type="button"></button>
|
|
44
|
+
<button class="secondary more" type="button" hidden aria-label="more options" aria-expanded="false" aria-controls="lab-more">\u22EF</button>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="more-menu" id="lab-more" hidden></div>`;let M=(t,d=E)=>d.querySelector(t),z=M(".layer"),O=M(".hint");matchMedia("(pointer: coarse)").matches&&(O.textContent="hold to comment");let P=M(".toggle"),V=E.querySelector(".bar"),X=M(".more"),F=M(".more-menu"),Y=M(".copy-all"),se=M(".list-btn"),ee=M(".go-btn"),I=M(".new-prev"),te=M(".show-done"),le=M(".done-btn"),ne=M(".pause-btn"),be=M(".over-btn"),Be=!1,vt={base:""};e.showDone=o.get("lab-show-done")==="1";let wt=M(".new-next"),Le=M(".send-all"),xe=M(".list"),Je=M(".hold",xe),ye=M(".chatwin"),y=E.querySelector(".chat-btn");e.listOpen=!1,e.filter="open",e.refit=()=>{},e.chatOpen=!1;let _=(t,d={},k)=>{let T=document.createElement(t);for(let[R,U]of Object.entries(d))T.setAttribute(R,U);return k instanceof Node?T.append(k):k!=null&&(T.textContent=k),T};Un({host:$,layer:z,el:_,store:o}),no({el:_,store:o,root:E,refreshPinCursor:()=>en(),syncReads:()=>Zt(),rememberMe:x,whileWriting:()=>_e()}),ro({el:_,mine:t=>Et(t),repliesOf:t=>Vt(t),workState:t=>Re(t)});function B(t,d){let k=new Set(d);for(let R of Array.from(t.childNodes))k.has(R)||R.remove();let T=t.firstChild;for(let R of d)R===T?T=T.nextSibling:t.insertBefore(R,T)}let q=["claude","codex","cursor","gemini","antigravity","copilot","amp","opencode"],H=t=>{if(!t?.session)return"";let d=String(t.session.kind||t.name||"").trim().split(/\W/)[0].toLowerCase();return q.includes(d)?d==="antigravity"?"gemini":d:""},W=()=>({"content-type":"application/json",...m?{"x-lab-admin":m}:{}});e.gone=!1,e.loaded=!1,e.retried=!1;let ce=()=>!!E.activeElement||[...E.querySelectorAll("textarea")].some(t=>t.value.trim());async function D(){try{let t=await fetch(`${a}?page=${encodeURIComponent(e.page)}`,{headers:W(),cache:"no-store"});if(t.status===404&&!e.loaded&&r?.dataset.enable!=="always"){if(!e.retried){e.retried=!0,setTimeout(D,1500);return}e.gone=!0,e.on=!1,document.documentElement.classList.remove("lab-pinning"),$.remove(),pe.remove();return}if(!t.ok)throw new Error(String(t.status));let d=await t.json();if(e.comments=d.comments||[],e.isAdmin=!!d.admin,!e.loaded&&!e.openId){let k=e.comments.find(T=>!T.parent&&o.get(`lab-typing:${e.page}:${T.id}`));k?e.openId=k.id:!e.draft&&o.get(`lab-typing:${e.page}:new`)&&b()&&(e.draft={anchor:b()})}e.loaded=!0}catch{}Z()}async function oe(t){try{let d=new URL("/_lab/api/changes",new URL(a,location.href));d.search=String(new URLSearchParams({page:e.page,since:String(t)}));let k=await fetch(d,{cache:"no-store"}),T=k.ok?await k.json():{full:!0};if(T.full||!e.loaded)return D();let R=new Set(T.del),U=new Map(T.set.map(G=>[G.id,G]));e.comments=e.comments.filter(G=>!R.has(G.id)).map(G=>U.get(G.id)||G);let ue=new Set(e.comments.map(G=>G.id));for(let G of T.set)ue.has(G.id)||e.comments.push(G);e.comments.sort((G,Me)=>G.createdAt.localeCompare(Me.createdAt))}catch{return D()}Z()}function Z(){!ce()&&!e.grabbing?j():(e.openCard?.isConnected&&e.openCard.sync(),e.chatOpen&&Ht(),Fe())}e.goMode=o.get("lab-go")==="1",e.cursorMode=o.get("lab-cursor")==="1",e.overControls=o.get("lab-over")==="1";let Ee=()=>{be.textContent=e.overControls?"controls keep clicks":"pin over controls",be.setAttribute("aria-pressed",String(e.overControls))},ae=t=>{e.overControls=t,o.set("lab-over",t?"1":""),Ee(),e.ctlTarget=null,e.recheckCtl?.(),_e()};Ee();let _e=()=>{let t=e.on&&!e.cursorMode&&!oo();document.documentElement.classList.toggle("lab-pinning",t),document.documentElement.classList.toggle("lab-go",t&&e.goMode&&!e.zoomMode),Ce()},Ft=t=>{t&&e.zoomMode&&$e(""),e.cursorMode=t,o.set("lab-cursor",t?"1":""),ee.classList.toggle("cursor",t),ee.classList.toggle("on",e.goMode&&!t),Kt(),_e()},jt=t=>{e.cursorMode&&Ft(!1),e.zoomMode&&$e(""),e.goMode=t,queueMicrotask(Kt),o.set("lab-go",t?"1":""),ee.classList.toggle("on",t),ee.setAttribute("aria-pressed",String(t&&!e.cursorMode)),document.documentElement.classList.toggle("lab-go",e.on&&t),ke.classList.toggle("go",t),Ce()};function kt(t){let d=o.get("lab-name").trim(),k=e.zoomMode;if(k&&(t={...t,zoom:k}),!e.goMode&&!k||!d)return e.draft={anchor:t,go:e.goMode&&!k},w(t),j();let T=k?yn(k):"go";if(gt())return o.set(St(),JSON.stringify([...tt(),{name:d,text:T,anchor:t}])),j();je({name:d,text:T,anchor:t}).then(({comment:R,edit:U})=>{U&&o.set(`lab-edit:${R.id}`,U),e.comments.push(R),ot([R]),e.posted=R.id,k&&t.block&&hn(t.block,k),j()}).catch(()=>(e.draft={anchor:t},w(t),j()))}async function je(t){let d=null;!t.action&&!t.nonce&&(t={...t,nonce:Math.random().toString(36).slice(2)+Date.now().toString(36)});for(let T=0;!d;T++)try{d=await fetch(a,{method:"POST",headers:W(),body:JSON.stringify({page:e.page,...t})})}catch{if(T>=150)throw new Error("couldn't reach the lab; your text is still here");await new Promise(R=>setTimeout(R,2e3))}let k=await d.json().catch(()=>({}));if(!d.ok)throw new Error(k.error||`could not save (${d.status})`);return k.comment&&!t.parent&&!t.action&&t.anchor?.kind!=="page"&&Ke.push(k.comment.id),k}let Ke=[];async function Eo(){let t=Ke.pop(),d=t&&e.comments.find(T=>T.id===t);if(!d)return;let k=o.get(`lab-edit:${t}`);try{if(e.isAdmin)await je({action:"delete",id:t}),e.comments=e.comments.filter(T=>T.id!==t&&T.parent!==t);else if(k){let{comment:T}=await je({action:"resolve",id:t,edit:k});Object.assign(d,T)}else return void Ke.push(t)}catch{return void Ke.push(t)}e.openId===t&&(e.openId=null),j(),vn(`took back ${d.anchor?.zoom?"a zoom":/^go$/i.test(d.text.trim())?"a go":"a pin"} \xB7 ${Ke.length?"again for the one before":"nothing more to take back"}`)}let Qe={was:void 0,t:void 0};function vn(t){Qe.was??=O.textContent,O.textContent=t,O.hidden=!1,clearTimeout(Qe.t),Qe.t=setTimeout(()=>{O.hidden=!0,O.textContent=Qe.was,Qe.was=void 0},1800)}let $o=()=>new URL("/_lab/agent"+e.page,new URL(a,location.href)).href;async function Lo(t,d){let k=await t;try{await navigator.clipboard.writeText(k)}catch{let R=document.createElement("textarea");R.value=k,R.style.cssText="position:fixed;opacity:0;",document.body.append(R),R.select(),document.execCommand("copy"),R.remove()}if(F.contains(d))return vn("link copied");let T=d.textContent;d.style.width=`${d.getBoundingClientRect().width}px`,d.style.justifyContent="center",d.textContent="copied",setTimeout(()=>{d.textContent=T,d.style.width=d.style.justifyContent=""},1400)}let et=()=>e.comments.filter(t=>!t.parent),St=()=>`lab-held:${e.page}`,tt=()=>{try{return JSON.parse(o.get(St())||"[]")}catch{return[]}},_o=()=>et().filter(t=>t.anchor?.kind!=="page").filter(t=>e.filter==="new"?nt(t).length:e.filter==="open"?!t.resolved:e.filter==="resolved"?t.resolved:Et(t)).sort((t,d)=>t.createdAt.localeCompare(d.createdAt)),wn=t=>t.anchor?.kind==="page";e.stepping=!1,e.keepKeys=!1;let Co=t=>t.resolved||Re(t)[0]==="done",Mo=(t,d,k)=>{let T=_("span",{class:"kw"});return T.append(t,_("span",{class:"mn","aria-hidden":"true"},`(${d})`),k),T};function To(){let t=e.on?[le,ne,be,Y,P]:[];for(let k of t)k.parentNode!==F&&F.append(k);!e.on&&P.parentNode!==V&&V.insertBefore(P,X),e.on||E.querySelector(".left").append(Y),X.hidden=!e.on,!e.on&&!F.hidden&&it(!1);let d=!0;for(let k of V.children)k.classList.toggle("first",d&&!k.hidden),k.hidden||(d=!1)}function Kt(){let t=ee.querySelector(".gp");t&&t.replaceChildren(...e.zoomMode?[yt(e.zoomMode),...matchMedia("(pointer: coarse)").matches?[]:[_("span",{class:"zw"},e.zoomMode)]]:[!e.goMode&&!e.cursorMode?at(o.get("lab-name"))||"+":"go"]),ee.setAttribute("aria-label",`a click places: ${e.zoomMode?`a zoom ${e.zoomMode}`:e.cursorMode?"nothing (pointer)":e.goMode?"go":"a comment"}`),ee.setAttribute("aria-keyshortcuts","1 2 3 4")}let Ao=t=>{let d=Math.max(0,Math.round((Date.now()-new Date(t).getTime())/6e4));return d<1?"just now":d<60?`${d} min`:`${Math.floor(d/60)} h ${d%60} min`};e.replyTo=null,e.newFrom=null;let Yt=t=>e.comments.filter(d=>!d.parent&&!d.resolved).sort((d,k)=>d.createdAt.localeCompare(k.createdAt)).indexOf(t)+1,Ut=()=>`lab-seen:${e.page}`,kn=()=>new Set(o.get(Ut()).split(",").filter(Boolean));e.seen=kn();let Xt=t=>String(t||"").replace(/\s+/g," ").trim().toLowerCase(),Et=t=>Xt(t.name)&&Xt(t.name)===Xt(o.get("lab-name"))||!!o.get(`lab-edit:${t.id}`),Sn=t=>!e.seen.has(t.id)&&!Et(t),nt=t=>[t,...Vt(t.id)].filter(Sn),ot=t=>{let d=t.filter(k=>!e.seen.has(k.id)).map(k=>k.id);for(let k of t)e.seen.add(k.id);o.set(Ut(),[...e.seen].join(",")),d.length&&En(d)},$t=r?.dataset.live?r.dataset.live.replace(/live$/,"api/reads"):"",En=t=>{let d=o.get("lab-name").trim();!$t||!d||!t.length||fetch($t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:d,page:e.page,ids:t})}).catch(()=>{})};async function Zt(){let t=o.get("lab-name").trim();if(!$t||!t)return;let d=e.page;try{let{ids:k}=await(await fetch(`${$t}?name=${encodeURIComponent(t)}&page=${encodeURIComponent(d)}`,{cache:"no-store"})).json();if(d!==e.page)return;let T=new Set(k),R=[...e.seen].filter(ue=>!T.has(ue)),U=k.filter(ue=>!e.seen.has(ue));if(R.length&&En(R),!U.length)return;for(let ue of U)e.seen.add(ue);o.set(Ut(),[...e.seen].join(",")),Z()}catch{}}let Vt=t=>e.comments.filter(d=>d.parent===t),at=t=>[...String(t||"").trim()][0]?.toUpperCase()||"",zo=()=>(ft(0),mt.y);e.shown=null,e.posted=null;let Lt=matchMedia("(prefers-reduced-motion: reduce)"),rt=new Map;e.faces=new Map,e.dropDrag=null;function j(){e.grabbing=!1,e.dropDrag?.();let t=z.querySelector(".card:not(.out), .float:not(.out)"),d=e.stepping&&re&&t?t.offsetHeight:0,k=t?t.querySelector(".body")?.scrollTop??null:null,T=new Map(e.on?et().filter(L=>L.anchor?.kind!=="page").map(L=>[L.id,We(L.anchor||{})]):[]);z.replaceChildren(),rt.clear();let R=e.on?e.draft||e.openId:null,U=R!==e.shown,ue=U?" in":"",G=null,Me=()=>{if(e.closeFast&&!R&&t){e.closeFast=!1,t.inert=!0,z.append(t);let L=()=>t.remove();Lt.matches||!t.animate?L():t.animate([{opacity:1},{opacity:0}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(L,L)}else if(re&&!R&&e.shown&&t&&!Lt.matches&&!t.style.transform){t.classList.remove("in"),t.classList.add("out"),t.inert=!0,z.append(t);let L=e.posted&&rt.get(e.posted),J=L?.getBoundingClientRect();L&&(L.style.animationDelay="250ms");let ge=dn(t,0,J&&{x:J.left+J.width/2,y:J.top+J.height/2});setTimeout(()=>(t.remove(),pn(t)),ge)}if(re){let L=E.querySelector(".card:not(.out), .float:not(.out)")||(e.listOpen?xe:e.chatOpen?ye:null),J=L&&(e.draft?"draft":e.openId||(e.listOpen?"list":e.chatOpen?"chat":""));L&&J!==e.sheetKey&&cn(L),e.sheetKey=J,U&&e.draft&&requestAnimationFrame(po)}Rt(G),e.shown=R,e.posted=null},Te=et(),Ue=Te.filter(L=>!L.resolved&&L.anchor?.kind!=="page").length,dt=Te.filter(L=>!L.resolved&&L.anchor?.kind!=="page").reduce((L,J)=>L+nt(J).length,0);if(P.replaceChildren(document.createTextNode((e.on?"hide comments":Ue?`comments \xB7 ${Ue}`:"comments")+(!e.on&&dt?` \xB7 ${dt} new`:"")),_("kbd",{"aria-hidden":"true"},"m")),P.classList.toggle("secondary",e.on),$.toggleAttribute("data-sheet",!!(e.on&&(e.draft||e.openId||e.listOpen||e.chatOpen))),re&&U&&R&&($.setAttribute("data-opening",""),requestAnimationFrame(()=>requestAnimationFrame(()=>$.removeAttribute("data-opening")))),document.documentElement.classList.toggle("lab-sheet",$.hasAttribute("data-sheet")),mn(),e.refit(),_e(),Y.hidden=!e.on||!e.isAdmin||Te.every(L=>L.resolved),Fe(),Ht(),xn(),!e.on)return Me();for(let L of tt()){let{left:J,top:ge}=We(L.anchor),he=_("div",{class:"pin held",title:`${L.name}: ${L.text} \xB7 draft, not sent yet`},at(L.name));he.style.left=`${J}px`,he.style.top=`${ge}px`,z.append(he)}if(Te.forEach(L=>{if(wn(L)||!e.showDone&&e.openId!==L.id&&(L.resolved||Re(L)[0]==="done")&&!nt(L).length)return;let{left:J,top:ge,moved:he,zone:Q}=T.get(L.id)||We(L.anchor||{});e.openId===L.id&&Bt(Q,`saved${ue}`);let ve=nt(L),Ae=!Q&&(e.isAdmin||o.get(`lab-edit:${L.id}`)),[Se]=Re(L),ie=_("button",{class:`pin${/^go$/i.test(L.text.trim())?" go":""}${L.anchor?.zoom?" zoom":""}${L.resolved?" resolved":""}${Se==="done"?" done":""}${Se==="now"?" working":""}${ve.length?" new":""}${he?" moved":""}${e.posted===L.id?" in":""}${Ae?" grab":""}${e.openId===L.id?" open":""}`,type:"button",title:`${L.resolved?"":`${Yt(L)} \xB7 `}${L.name}${he?" \xB7 the spot it was pinned to has changed":""}${Ae?" \xB7 drag to move":""}`,"aria-label":`${/^go$/i.test(L.text.trim())?"go":L.anchor?.zoom?`zoom ${L.anchor.zoom}`:"comment"}${L.resolved?"":` ${Yt(L)}`} by ${L.name}${Se==="now"?", agent working on it":Se==="done"||L.resolved?", done":""}${ve.length?`, ${ve.length} new`:""}${he?", moved":""}`},/^go$/i.test(L.text.trim())?"go":Se==="done"||L.resolved?"\u2713":L.anchor?.zoom?yt(String(L.anchor.zoom).startsWith("in")?"in":"out"):at(L.name)),De=`${Se}${L.resolved?" resolved":""}${ve.length?" new":""}`,Ie=e.faces.get(L.id);e.faces.set(L.id,De);let nn=Ie!==void 0&&Ie!==De&&!Lt.matches;if(nn&&ie.classList.add("swap"),Se==="now"?ie.append(_("i",{class:`ring${nn&&!Ie.startsWith("now")?" come":""}`,"aria-hidden":"true"})):nn&&Ie.startsWith("now")&&ie.append(_("i",{class:"ring gone","aria-hidden":"true"})),re&&ie.append(_("i",{class:"hit","aria-hidden":"true"})),ie.style.left=`${J}px`,ie.style.top=`${ge}px`,Ae&&bo(ie,L),!re&&Q&&e.openId!==L.id){let fe=null;ie.addEventListener("pointerenter",()=>fe=Bt(Q,"saved")),ie.addEventListener("pointerleave",()=>(fe?.remove(),fe=null))}else!re&&L.anchor?.quote&&!Q&&(ie.addEventListener("pointerenter",()=>Rt(L.anchor)),ie.addEventListener("pointerleave",()=>Rt(G)));if(ie.addEventListener("click",fe=>{if(fe.stopPropagation(),!ie.dataset.dragged){if(re&&e.openId!==L.id)return Ve(L);e.openId=e.openId===L.id?null:L.id,e.draft=null,j()}}),z.append(ie),rt.set(L.id,ie),e.openId===L.id){let fe=xo(L,new Set(ve.map(Xe=>Xe.id)),U&&(re?e.keepKeys:!e.stepping||e.keepKeys));if(e.openCard=fe,U&&!e.stepping&&fe.classList.add("in"),d&&(fe.style.minHeight=`min(${d}px, var(--_sheet-max))`),e.stepping=e.keepKeys=!1,gn(fe,Q?J+14:J,Q?Q.top+Q.height:ge),!U&&k!=null)fe.querySelector(".body").scrollTop=k;else if(U){let Xe=fe.querySelector(".body"),In=re?null:Xe.querySelector(".fresh, .newline");Xe.scrollTop=In?In.offsetTop-Xe.offsetTop-8:Xe.scrollHeight}re&&e.cardFull&&fe.classList.add("full"),xt(fe,()=>(e.openId=null,e.cardFull=!1,j()),!0),ot(ve),ve.length&&Fe(),G=Q?null:L.anchor}}),e.draft){let{anchor:L}=e.draft,{left:J,top:ge,zone:he}=We(L);Bt(he,"draft"),G=he?null:L;let Q=L.zoom,ve=_("div",{class:`pin draft${Q?" zoom":""}${ue}`},Q?yt(Q):at(o.get("lab-name")));ve.style.left=`${J}px`,ve.style.top=`${ge}px`,z.append(ve);let Ae=_("div",{class:`float${ue}`});Ae.append(_("div",{class:"handle"}),sn({placeholder:Q==="in"?"zoom in: what to go deeper into (or just send)":Q==="out"?"zoom out: what to see around it (or just send)":e.draft.go?"go":"add a comment",empty:Q?yn(Q):e.draft.go?"go":"",nameFirst:!!(e.draft.go||Q),autofocus:!0,draftKey:`lab-typing:${e.page}:new`,onSubmit:async(Se,ie)=>{if(gt())return o.set(St(),JSON.stringify([...tt(),{name:Se,text:ie,anchor:L}])),e.draft=null,w(null),j();let{comment:De,edit:Ie}=await je({name:Se,text:ie,anchor:L});Ie&&o.set(`lab-edit:${De.id}`,Ie),Q&&L.block&&hn(L.block,Q),e.comments.push(De),ot([De]),e.draft=null,w(null),e.openId=null,e.posted=De.id,co(),j()}})),xt(Ae,()=>(e.draft=null,w(null),j())),he?gn(Ae,J+14,he.top+he.height):ho(Ae,J,ge)}Me()}e.grabbing=!1,e.openCard=null;let re=matchMedia("(pointer: coarse)").matches,$n=()=>{o.get("lab-hint-seen")!=="1"&&(O.hidden=!1,o.set("lab-hint-seen","1"),setTimeout(()=>O.hidden=!0,5e3))},Ln=t=>{e.on=t,e.on?Ce():ke.classList.remove("show"),o.set("lab-on",e.on?"1":"0"),e.on&&$n(),e.draft=null,e.openId=null,j()};P.addEventListener("click",()=>Ln(!e.on));function it(t,d=!1){F.hidden=!t,X.setAttribute("aria-expanded",String(t)),t?[...F.querySelectorAll("button")].find(k=>!k.hidden&&!k.disabled)?.focus({preventScroll:!0}):d&&X.focus({preventScroll:!0})}X.addEventListener("click",t=>{t.stopPropagation(),it(F.hidden)}),F.addEventListener("click",()=>setTimeout(()=>it(!1,!0),0)),addEventListener("pointerdown",t=>{!F.hidden&&!t.composedPath().some(d=>d===F||d===X)&&it(!1)},!0),addEventListener("keydown",t=>{t.key==="Escape"&&!F.hidden&&(it(!1,!0),t.stopPropagation())},!0),ee.addEventListener("click",()=>{if(e.zoomMode==="in")return $e("out");if(e.zoomMode==="out")return $e(""),jt(!1);if(e.goMode&&!e.cursorMode)return $e("in");jt(!0)}),I.addEventListener("click",()=>Ge(-1)),le.addEventListener("click",()=>te.click()),e.paused=null;let Oo=t=>{let d=t.effect?.target;return!!d&&d.getRootNode()!==E},_n=()=>{for(let t of document.getAnimations())!Oo(t)||t.playState!=="running"||(t.pause(),e.paused.anims.add(t));for(let t of document.querySelectorAll("video"))t.paused||(t.pause(),e.paused.videos.add(t))};be.addEventListener("click",()=>ae(!e.overControls)),ne.addEventListener("click",()=>{if(e.paused){clearInterval(e.paused.timer);for(let t of e.paused.anims)t.play();for(let t of e.paused.videos)t.play().catch(()=>{});e.paused=null}else e.paused={anims:new Set,videos:new Set,timer:setInterval(_n,100)},_n();ne.textContent=e.paused?"play motion":"pause motion",ne.setAttribute("aria-pressed",String(!!e.paused))}),te.addEventListener("click",()=>{e.showDone=!e.showDone,o.set("lab-show-done",e.showDone?"1":""),j()}),wt.addEventListener("click",()=>Ge(1));let _t=()=>{e.on||(e.on=!0,o.set("lab-on","1"))};Y.addEventListener("click",()=>Lo($o(),Y)),addEventListener("lab-goto",t=>{let d=document.getElementById(t.detail);d&&(re&&(e.openId=null,e.chatOpen=!1,e.listOpen=!1,j()),setTimeout(()=>bn(d),re?60:0))}),se.addEventListener("click",()=>Be?(e.listOpen=!e.listOpen,e.listOpen&&(e.filter="new"),e.chatOpen=!1,O.hidden=!0,j()):Ge(1)),xe.querySelector(".x").addEventListener("click",()=>qt(xe,()=>(e.listOpen=!1,j()))),y.addEventListener("click",()=>{e.chatOpen=!e.chatOpen,e.listOpen=!1,e.chatOpen&&!re&&(e.openId=null,e.draft&&!E.querySelector(".float textarea")?.value.trim()&&(e.draft=null)),O.hidden=!0,j(),e.chatOpen&&!re&&ye.querySelector(".chat textarea")?.focus({preventScroll:!0})}),e.closingClick=!1,document.addEventListener("pointerdown",t=>{if(e.closingClick=!1,re||!e.chatOpen||t.button!==0)return;let d=t.composedPath();if(!(d.includes(ye)||d.includes(y))){if(e.chatOpen=!1,d.includes($))return void addEventListener("click",()=>j(),{once:!0});e.closingClick=!0,j()}},!0),addEventListener("click",t=>{e.closingClick&&(e.closingClick=!1,t.preventDefault(),t.stopImmediatePropagation())},!0);for(let t of xe.querySelectorAll("[data-f]"))t.addEventListener("click",()=>(e.filter=t.dataset.f,Fe()));Je.addEventListener("click",()=>(o.set("lab-hold",gt()?"":"1"),Fe())),Le.addEventListener("click",async()=>{let t=tt();for(let d=0;d<t.length;d++)try{let{comment:k,edit:T}=await je(t[d]);T&&o.set(`lab-edit:${k.id}`,T),e.comments.push(k),ot([k]),o.set(St(),JSON.stringify(t.slice(d+1)))}catch{Le.textContent="send failed, try again";return}j()});let Ye=t=>t.composedPath().some(d=>d instanceof HTMLElement&&(d.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(d.tagName)));document.addEventListener("keydown",t=>{if(e.gone)return;let d=document.activeElement?.localName.includes("-")&&document.activeElement!==$;if((t.key==="m"||t.key==="M"||t.code==="KeyM")&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&!Ye(t)&&!d){t.preventDefault(),Ln(!e.on);return}if(e.on&&(t.metaKey||t.ctrlKey)&&!t.shiftKey&&!t.altKey&&(/^z$/i.test(t.key||"")||!/^[a-z]$/i.test(t.key||"")&&t.code==="KeyZ")&&!Ye(t)&&!d&&Ke.length)return t.preventDefault(),void Eo();if(e.on&&t.ctrlKey&&!t.metaKey&&!t.altKey&&t.code==="KeyD"&&!(Ye(t)&&!t.composedPath().includes($))){t.preventDefault();let T=E.querySelector(".card textarea, .float textarea");return T?.value.trim()?T.closest(".card, .float")?.animate([{transform:"none"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"none"}],{duration:260}):Ge(t.shiftKey?-1:1)}if(e.on&&/^(Digit|Numpad)[1234]$/.test(t.code||"")&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&!Ye(t)&&!d){t.preventDefault();let T=t.code.slice(-1);if(T==="3")return $e(e.zoomMode==="in"?"out":"in");e.zoomMode&&$e(""),T==="4"?Ft(!0):jt(T==="2");return}let k=/^[a-z]$/i.test(t.key||"")?t.key.toLowerCase():/^Key[A-Z]$/.test(t.code||"")?t.code.slice(3).toLowerCase():"";if(e.on&&e.zoomMode&&!e.draft&&!e.openId&&!Ye(t)&&!d&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&ko(t,k))return t.preventDefault();if(e.on&&!Ye(t)&&!d&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&/^[cwredp]$/.test(k)){let T=k;if(t.preventDefault(),T==="p")return ne.click();if(T==="c")return y.click();if(T==="w")return Ge(t.shiftKey?-1:1);if(T==="d")return te.click();T==="r"&&e.openId?E.querySelector(".card textarea")?.focus({preventScroll:!0}):T==="e"&&e.openId&&e.isAdmin&&[...E.querySelectorAll(".card .btn")].find(R=>/^(resolve|reopen)$/.test(R.textContent))?.click();return}t.key==="Escape"&&(e.draft||e.openId)?(e.draft=null,e.openId=null,j()):t.key==="Escape"&&(e.chatOpen||e.listOpen)&&(e.chatOpen?e.chatOpen=!1:e.listOpen=!1,j())});let Cn='a, button, input, textarea, select, label, summary, video[controls], audio, iframe, [contenteditable], [role="button"], [role="link"], [role="tab"], [role="menuitem"], [role="option"], [role="checkbox"], [role="switch"], [tabindex]:not([tabindex="-1"]), [onclick]',Mn=t=>document.documentElement.classList.toggle("lab-ctl",!e.overControls&&!$.contains(t)&&t!==$&&Ct(t));e.recheckCtl=()=>e.mouse&&Mn(document.elementFromPoint(e.mouse.x,e.mouse.y));let Ct=t=>{if(e.overControls)return!1;for(let d=t instanceof Element?t:null;d&&d!==document.body&&d!==document.documentElement;d=d.parentElement)if(d.matches(Cn)||getComputedStyle(d).cursor==="pointer")return!0;return!1},me="[data-uncommentable]";e.drag=null,e.afterDrag=!1,e.liveZone=null,e.zoneFrame=0;let Mt=12,No=()=>{if(e.zoneFrame=0,!e.drag?.active||!e.liveZone)return;let t=(T,R)=>{let U=Math.max(Math.abs(R-T),Mt);return{start:(T+R)/2-U/2,size:U}},d=t(e.drag.x0,e.drag.x1),k=t(e.drag.y0,e.drag.y1);e.liveZone.style.transform=`translate3d(${d.start+scrollX}px, ${k.start+scrollY}px, 0)`,e.liveZone.style.width=`${d.size}px`,e.liveZone.style.height=`${k.size}px`},Tn=()=>!!e.draft&&[...E.querySelectorAll(".float textarea")].some(t=>t.value.trim());function Ro(t){!e.on&&!t.altKey||e.cursorMode&&!t.altKey||Tn()||t.button!==0||t.pointerType==="touch"||t.metaKey||t.ctrlKey||t.shiftKey||t.composedPath().includes($)||!t.altKey&&Ct(t.target)||t.target instanceof Element&&t.target.closest(me)||(e.drag={x0:t.clientX,y0:t.clientY,x1:t.clientX,y1:t.clientY,active:!1})}document.addEventListener("pointerdown",t=>{t.altKey||!e.on&&!t.altKey||e.cursorMode&&!t.altKey||Tn()||t.button!==0||t.pointerType==="touch"||t.metaKey||t.ctrlKey||t.shiftKey||t.composedPath().includes($)||!t.altKey&&Ct(t.target)||t.target instanceof Element&&t.target.closest(me)||(e.drag={x0:t.clientX,y0:t.clientY,x1:t.clientX,y1:t.clientY,active:!1})},!0),document.addEventListener("pointermove",t=>{e.drag&&(e.drag.x1=t.clientX,e.drag.y1=t.clientY,!e.drag.active&&Math.hypot(e.drag.x1-e.drag.x0,e.drag.y1-e.drag.y0)>8&&(e.drag.active=!0,getSelection?.()?.removeAllRanges(),document.documentElement.classList.add("lab-dragging"),e.liveZone=rn("draft live"),z.append(e.liveZone)),e.drag.active&&(t.preventDefault(),e.zoneFrame||=requestAnimationFrame(No)))},!0);let Gt=t=>{if(!e.drag)return;let d=e.drag;if(e.drag=null,document.documentElement.classList.remove("lab-dragging"),cancelAnimationFrame(e.zoneFrame),e.zoneFrame=0,e.liveZone?.remove(),e.liveZone=null,!(!d.active||t.type==="pointercancel")){e.afterDrag=!0,setTimeout(()=>e.afterDrag=!1,0),getSelection?.()?.removeAllRanges();for(let[k,T]of[["x0","x1"],["y0","y1"]]){if(Math.abs(d[T]-d[k])>=Mt)continue;let R=(d[k]+d[T])/2;d[k]=R-Mt/2,d[T]=R+Mt/2}_t(),e.openId=null,kt(to(d))}};document.addEventListener("pointerup",Gt,!0),document.addEventListener("pointercancel",Gt,!0),document.addEventListener("dragstart",t=>{let d=e.on&&t.target instanceof Element&&t.target.closest("img, video")&&!t.composedPath().includes($);(e.drag||d)&&t.preventDefault()},!0),document.addEventListener("click",t=>{e.afterDrag&&(t.preventDefault(),t.stopPropagation())},!0);let An=t=>t.altKey&&!t.metaKey&&!t.ctrlKey&&t.button===0&&!t.composedPath().includes($)&&!(t.target instanceof Element&&t.target.closest(me));for(let t of["pointerdown","mousedown","pointerup","mouseup"])addEventListener(t,d=>{An(d)&&(d.preventDefault(),d.stopImmediatePropagation(),t==="pointerdown"&&Ro(d),t==="pointerup"&&Gt(d))},!0);addEventListener("click",t=>{An(t)&&(t.preventDefault(),t.stopImmediatePropagation(),e.afterDrag||Rn(t))},!0),e.ctlClick=!1,addEventListener("click",t=>e.ctlClick=Ct(t.target),!0),document.addEventListener("click",t=>Rn(t)),e.lastTouch=0,e.pinnedByHold=!1;let st=E.querySelector(".sel-chip"),Jt=E.querySelector(".scrim"),zn=()=>E.querySelector(".card:not(.out), .float:not(.out)")||(e.listOpen?xe:e.chatOpen?ye:null),Bo=()=>{e.draft=null,e.openId=null,e.listOpen=!1,e.chatOpen=!1,j()},On=()=>{let t=zn();if(![...E.querySelectorAll("textarea")].some(d=>d.value.trim()&&!ye.contains(d)))return qt(t,Bo);t?.animate?.([{transform:"none"},{transform:"translateY(12px)"},{transform:"none"}],{duration:260,easing:"ease-out"})};e.sheetDraggedAt=-1e9,Jt.addEventListener("click",()=>performance.now()-e.sheetDraggedAt>300&&On()),Jt.addEventListener("touchmove",t=>t.preventDefault(),{passive:!1}),e.backWatcher=null;let Po=window.visualViewport;uo();let Pe=M(".msgs",ye);e.stick=!0,Pe.addEventListener("scroll",()=>e.stick=Pe.scrollHeight-Pe.scrollTop-Pe.clientHeight<48,{passive:!0}),"ResizeObserver"in window&&new ResizeObserver(()=>e.stick&&(Pe.scrollTop=Pe.scrollHeight)).observe(Pe),xt(xe,()=>(e.listOpen=!1,j())),xt(ye,()=>(e.chatOpen=!1,j()),!0),e.press=null;let lt=()=>e.press&&(clearTimeout(e.press.timer),e.press=null);document.addEventListener("pointerdown",t=>{if(lt(),e.pinnedByHold=!1,t.pointerType==="touch"&&(e.lastTouch=Date.now()),t.pointerType!=="touch"||e.draft||!(t.target instanceof Element)||t.composedPath().includes($)||t.target.closest(me))return;let{clientX:d,clientY:k}=t;e.press={x:d,y:k,timer:setTimeout(()=>{e.press=null,e.pinnedByHold=!0,navigator.vibrate?.(8),getSelection?.()?.removeAllRanges(),e.afterDrag=!0,setTimeout(()=>e.afterDrag=!1,800),_t(),e.openId=null,kt(He(d,k))},400)}},!0),document.addEventListener("pointermove",t=>e.press&&Math.hypot(t.clientX-e.press.x,t.clientY-e.press.y)>10&<(),!0),document.addEventListener("pointerup",t=>{t.pointerType==="touch"&&(e.lastTouch=Date.now()),lt(),e.pinnedByHold&&(E.querySelector(".float [data-first]")||E.querySelector(".float textarea"))?.focus({preventScroll:!0})},!0),document.addEventListener("touchend",t=>{e.pinnedByHold&&(e.pinnedByHold=!1,t.preventDefault(),(E.querySelector(".float [data-first]")||E.querySelector(".float textarea"))?.focus({preventScroll:!0}))},{capture:!0,passive:!1}),document.addEventListener("pointercancel",lt,!0),addEventListener("scroll",lt,{passive:!0,capture:!0}),document.addEventListener("contextmenu",t=>(e.press||e.afterDrag)&&t.preventDefault(),!0),e.selRect=null,document.addEventListener("selectionchange",()=>{let t=getSelection?.(),d=t?.rangeCount&&t.getRangeAt(0),k=String(t||"").trim(),T=d&&$.contains(d.commonAncestorContainer);if(e.selRect=re&&e.on&&!e.draft&&k&&d&&!T?d.getClientRects()[0]||d.getBoundingClientRect():null,st.hidden=!e.selRect,!e.selRect)return;let R=e.selRect.bottom+52<innerHeight;st.style.left=`${Math.min(Math.max(e.selRect.left+e.selRect.width/2,60),innerWidth-60)}px`,st.style.top=`${R?e.selRect.bottom+10:Math.max(e.selRect.top-46,8)}px`});let Nn=()=>{let t=getSelection?.(),d=t?.rangeCount&&t.getRangeAt(0),k=String(t||"").replace(/\s+/g," ").trim();if(!d||!k||$.contains(d.commonAncestorContainer))return!1;let T=d.getClientRects(),R=T[0]||d.getBoundingClientRect(),U=T[T.length-1]||R,ue=d.startContainer.nodeType===1?d.startContainer:d.startContainer.parentElement,G=d.endContainer.nodeType===1?d.endContainer:d.endContainer.parentElement,Me=ue&&(ue===G||ue.contains(G))?He(Math.max(U.left,U.right-2),U.top+U.height/2):He(R.left+2,R.top+R.height/2),Te=d.commonAncestorContainer,Ue=(Te.nodeType===1?Te:Te.parentElement)?.closest("p, li, h1, h2, h3, h4, h5, h6, td, th, figcaption, blockquote, pre, section, article, div")||document.body,dt=(L,J)=>{let ge=document.createRange();return ge.setStart(...L),ge.setEnd(...J),String(ge).replace(/\s+/g," ")};return Me.kind="text",Me.quote={exact:K(k,300),prefix:dt([Ue,0],[d.startContainer,d.startOffset]).replace(/^\s+/,"").slice(-40),suffix:dt([d.endContainer,d.endOffset],[Ue,Ue.childNodes.length]).replace(/\s+$/,"").slice(0,40)},t.removeAllRanges(),st.hidden=!0,_t(),e.openId=null,kt(Me),!0};st.addEventListener("click",t=>{t.stopPropagation(),e.selRect&&Nn()}),document.addEventListener("mouseup",t=>{e.on&&!e.cursorMode&&!e.draft&&t.shiftKey&&t.button===0&&!t.composedPath().includes($)&&setTimeout(Nn,0)},!0);function Rn(t){if(!t.composedPath().includes($)){if(e.draft||e.openId){if([...E.querySelectorAll("textarea")].some(d=>d.value.trim()))return;e.draft=null,e.openId=null,j();return}if(!(!e.on&&!t.altKey||e.cursorMode&&!t.altKey||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey)&&!(e.lastTouch&&Date.now()-e.lastTouch<800)){if(t.altKey)t.preventDefault();else if(t.defaultPrevented||e.ctlClick)return;t.target instanceof Element&&t.target.closest(me)||String(getSelection?.()||"").trim()||(_t(),kt(He(t.clientX,t.clientY)))}}}let Do=()=>{let t=et().filter(k=>k.anchor?.kind!=="page");if(!e.on||e.openId||t.length!==rt.size)return j();let d=t.map(k=>[rt.get(k.id),We(k.anchor||{})]);if(d.some(([k])=>!k))return j();for(let[k,{left:T,top:R,moved:U}]of d)k.style.left=`${T}px`,k.style.top=`${R}px`,k.classList.toggle("moved",!!U)};e.frame=0;let Tt=()=>{cancelAnimationFrame(e.frame),e.frame=requestAnimationFrame(()=>{e.draft||E.activeElement||e.grabbing||Do()})};addEventListener("resize",Tt),addEventListener("scroll",t=>t.target!==document&&!$.contains(t.target)&&Tt(),{capture:!0,passive:!0});let Qt=()=>{e.gone||(!$.isConnected&&document.body&&document.body.append($),pe.isConnected||document.head.append(pe),ct.isConnected||document.head.append(ct),u()!==e.page&&(e.page=u(),e.seen=kn(),Zt(),e.comments=[],e.draft=null,e.openId=null,j(),D()))};for(let t of["pushState","replaceState"]){let d=history[t];history[t]=function(...k){let T=d.apply(this,k);return queueMicrotask(Qt),T}}addEventListener("popstate",Qt),document.addEventListener("astro:after-swap",Qt),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&!e.draft&&!E.activeElement&&D()}),"ResizeObserver"in window&&new ResizeObserver(Tt).observe(document.body);let pe=document.createElement("style");r?.dataset.fontUrl&&(pe.textContent=`@font-face{font-family:'lab comments';font-display:swap;src:url('${new URL(r.dataset.fontUrl,r.src||location.href)}') format('woff2');}`);let Bn=r?.dataset.fontUrl?"lab comments":r?.dataset.font;Bn&&$.style.setProperty("--lab-font",`'${Bn.replace(/'/g,"")}', system-ui, sans-serif`);let ct=document.createElement("style"),ke=_("div",{class:"ptr","aria-hidden":"true"});ke.append(_("span",{class:"ini"},"+"),_("span",{class:"tick"},"go")),E.append(ke),e.mouse=null;let Pn=(t,d,k)=>{let T=!!k&&k!==$&&!$.contains(k)&&getComputedStyle(k).cursor==="none";ke.classList.toggle("show",T),ke.classList.toggle("go",e.goMode&&!e.zoomMode),ke.style.transform=`translate(${t-1}px, ${d-27}px)`},Ce=()=>e.mouse&&requestAnimationFrame(()=>e.mouse&&Pn(e.mouse.x,e.mouse.y,document.elementFromPoint(e.mouse.x,e.mouse.y)));addEventListener("pointermove",t=>{if(t.pointerType!=="mouse")return;document.documentElement.classList.add("lab-drawn"),e.mouse={x:t.clientX,y:t.clientY};let d=t.composedPath()[0];d!==e.ctlTarget&&(e.ctlTarget=d,Mn(d)),Pn(t.clientX,t.clientY,d instanceof Element?d:null)},{capture:!0,passive:!0}),addEventListener("scroll",Ce,{capture:!0,passive:!0}),addEventListener("keydown",t=>(t.key==="Shift"||t.key==="Alt")&&Ce(),!0),addEventListener("keyup",t=>(t.key==="Shift"||t.key==="Alt")&&Ce(),!0),document.documentElement.addEventListener("mouseleave",()=>(e.mouse=null,ke.classList.remove("show"))),addEventListener("blur",()=>(e.mouse=null,ke.classList.remove("show"))),e.cursorKey="";function en(){let t=e.zoomMode?`zoom-${e.zoomMode}`:(at(o.get("lab-name"))||"+").replace(/[<>&'"]/g,"");if(t===e.cursorKey)return;e.cursorKey=t,ke.querySelector(".ini").replaceChildren(e.zoomMode?yt(e.zoomMode):t);let d=`:not(${Cn}, a *, button *, label *, [role="button"] *, [contenteditable], [contenteditable] *, ${me}, ${me} *, [data-lab-comments])`,k="dialog, dialog *, [popover], [popover] *, :fullscreen, :fullscreen *";ct.textContent=`@layer lab-pointer { html.lab-pinning:not(.lab-shift, .lab-ctl) body, html.lab-pinning:not(.lab-shift, .lab-ctl) body *${d} { cursor: crosshair; } html.lab-drawn.lab-pinning:not(.lab-shift, .lab-ctl):not(.lab-dragging) body, html.lab-drawn.lab-pinning:not(.lab-shift, .lab-ctl):not(.lab-dragging) body *${d}:not(${k}) { cursor: none; } html.lab-pinning body :is([contenteditable], [contenteditable] *) { cursor: text; } html.lab-pinning body :is(${me}, ${me} *) { cursor: auto; } }html.lab-alt body, html.lab-alt body *:not([data-lab-comments], [data-lab-comments] *, ${me}, ${me} *) { cursor: crosshair !important; }html.lab-drawn.lab-alt body, html.lab-drawn.lab-alt body *:not([data-lab-comments], [data-lab-comments] *, ${me}, ${me} *, ${k}) { cursor: none !important; }html.lab-go:not(.lab-drawn) body, html.lab-go:not(.lab-drawn) body * { cursor: copy !important; }`}pe.textContent+="@media (pointer: fine) { html.lab-pinning:not(.lab-shift) body > :not([data-lab-comments]), html.lab-pinning:not(.lab-shift) body > :not([data-lab-comments]) :not(input, textarea, select, [contenteditable], [contenteditable] *) { -webkit-user-select: none; user-select: none; } }",e.shiftOff=0;let tn=t=>{clearTimeout(e.shiftOff),t.shiftKey?document.documentElement.classList.add("lab-shift"):e.shiftOff=setTimeout(()=>(document.documentElement.classList.remove("lab-shift"),Ce()),400)};addEventListener("keydown",tn,!0),addEventListener("keyup",tn,!0),addEventListener("pointerdown",t=>{if(t.shiftKey)return tn(t);clearTimeout(e.shiftOff),document.documentElement.classList.remove("lab-shift")},!0),addEventListener("blur",()=>document.documentElement.classList.remove("lab-shift")),pe.textContent+="html.lab-dragging, html.lab-dragging * { user-select: none !important; -webkit-user-select: none !important; cursor: crosshair !important; }",pe.textContent+="html.lab-sheet, html.lab-sheet body { overscroll-behavior-y: none; }",pe.textContent+='@property --lab-arc { syntax: "<percentage>"; inherits: false; initial-value: 66%; }',pe.textContent+="html.lab-room body::after { content: ''; display: block; height: var(--lab-room, 0px); }",addEventListener("scroll",()=>{let t=document.documentElement,d=parseFloat(t.style.getPropertyValue("--lab-room"))||0;if(!d||$.hasAttribute("data-sheet"))return;let k=Math.max(0,Math.ceil(scrollY+innerHeight-(t.scrollHeight-d)));k>=d||(t.style.setProperty("--lab-room",`${k}px`),k||t.classList.remove("lab-room"))},{passive:!0}),pe.textContent+="@media (pointer: coarse) { html.lab-sheet, html.lab-sheet body { overflow: hidden; } }",pe.textContent+="html.lab-pinning body, html.lab-pinning body * { -webkit-touch-callout: none; }",pe.textContent+="@media (pointer: coarse) { html.lab-pinning body > :not([data-lab-comments]) { -webkit-user-select: none; user-select: none; } html.lab-pinning body > :not([data-lab-comments]), html.lab-pinning body > :not([data-lab-comments]) * { -webkit-user-drag: none; } }";let At=t=>document.documentElement.classList.toggle("lab-alt",!!t);addEventListener("keydown",t=>t.key==="Alt"&&At(!0),!0),addEventListener("keyup",t=>t.key==="Alt"&&At(!1),!0),addEventListener("pointermove",t=>At(t.altKey),{capture:!0,passive:!0}),addEventListener("blur",()=>At(!1));let Dn=()=>{document.head.append(pe,ct),en(),e.on&&$n(),document.body.append($);let t="background-color: rgba(52, 199, 89, .3); color: inherit;";pe.textContent+=`html.lab-pinning ::selection { ${t} } ::highlight(lab-quote) { ${t} }`,D()};document.body?Dn():document.addEventListener("DOMContentLoaded",Dn),So(),vo()})();})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><style>path{fill:#141414}@media (prefers-color-scheme:dark){path{fill:#f4f4f5}}</style><path transform="translate(-1 -.5)" fill-rule="evenodd" d="M18.9 24.67L24.4 3h11.5L31.28 21.2A22.8 22.8 0 0 0 18.9 24.67ZM37.07 22.02L41.9 3h11.5L47.1 27.85A22.8 22.8 0 0 0 37.07 22.02ZM31 26a18 18 0 0 1 18 18 18 18 0 0 1-18 18H15.57a2.57 2.57 0 0 1-2.57-2.57V44A18 18 0 0 1 31 26ZM24.8 45a6.2 6.2 0 1 0 12.4 0a6.2 6.2 0 1 0-12.4 0Z"/></svg>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/* The lab's design system: the comment widget and every lab page (the page list, "not found", pages an agent makes
|
|
2
|
+
for the lab) share these. Served at /_lab/lab.css. The --lab-* names are the widget's own theme hooks, so a page that
|
|
3
|
+
sets them themes the widget too.
|
|
4
|
+
|
|
5
|
+
Colour: white, black and green, with 4 see-through steps each (primitives, as in Cooking), and named uses that point at them.
|
|
6
|
+
Corners: two in all, 6 px small (keys, code, rows, pills), 12 px boxes and buttons; circles only for dots.
|
|
7
|
+
Type: the system font, 15 px text, 13 px small, 11 px caps labels; one weight for text, 600 for titles.
|
|
8
|
+
Depth: a hairline ring and a soft shadow, no borders. */
|
|
9
|
+
:root {
|
|
10
|
+
/* Base colours (primitives): white and black, and see-through steps of each (4 a scheme, as Cooking does), plus the
|
|
11
|
+
green and its own 4 steps. Fills are a wash of black on light, of white on dark, so they sit right on any surface. */
|
|
12
|
+
--lab-white: #ffffff;
|
|
13
|
+
--lab-ink: #141414;
|
|
14
|
+
--lab-paper-dark: #1c1c1e;
|
|
15
|
+
--lab-black: #000000;
|
|
16
|
+
--lab-black-1: rgba(0, 0, 0, .05); /* light: page wash, soft fills */
|
|
17
|
+
--lab-black-2: rgba(0, 0, 0, .10); /* light: hover */
|
|
18
|
+
--lab-black-3: rgba(0, 0, 0, .15); /* light: separators */
|
|
19
|
+
--lab-black-4: rgba(0, 0, 0, .50); /* light: secondary text */
|
|
20
|
+
--lab-white-1: rgba(255, 255, 255, .05); /* dark: soft fills */
|
|
21
|
+
--lab-white-2: rgba(255, 255, 255, .10); /* dark: hover */
|
|
22
|
+
--lab-white-3: rgba(255, 255, 255, .15); /* dark: separators */
|
|
23
|
+
--lab-white-4: rgba(255, 255, 255, .50); /* dark: secondary text */
|
|
24
|
+
--lab-green-1: rgba(52, 199, 89, .15); /* soft green: your bubbles, rec pills */
|
|
25
|
+
--lab-green-2: rgba(52, 199, 89, .30); /* hover on green */
|
|
26
|
+
--lab-green-3: rgba(52, 199, 89, .50); /* outlines, dots */
|
|
27
|
+
--lab-green-4: rgb(36, 160, 70); /* green: go, done, picks (dark: #34c759) */
|
|
28
|
+
|
|
29
|
+
/* What things use (semantic), light. Dark only re-points these. */
|
|
30
|
+
--lab-bg: var(--lab-white); /* boxes */
|
|
31
|
+
--lab-fg: var(--lab-ink); /* text */
|
|
32
|
+
--lab-page: #f2f2f2; /* the page behind boxes: white under black-1 (5%), solid so nothing shows through */
|
|
33
|
+
--lab-muted: var(--lab-black-4); /* secondary text */
|
|
34
|
+
--lab-line: var(--lab-black-3); /* dividers, drawn as a hairline */
|
|
35
|
+
--lab-hair: .5px solid var(--lab-line); /* one device pixel on a Retina screen, as Apple's separators */
|
|
36
|
+
--lab-soft: var(--lab-black-1); /* keys, other people's bubbles, boxes to type in */
|
|
37
|
+
--lab-hover: var(--lab-black-2); /* hover on rows and buttons */
|
|
38
|
+
--lab-green: var(--lab-green-4); /* go, done, picks */
|
|
39
|
+
--lab-green-soft: var(--lab-green-1); /* your bubbles, rec pills */
|
|
40
|
+
--lab-shadow: 0 0 0 .5px rgba(20, 20, 20, .14), 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .08);
|
|
41
|
+
--lab-r-s: 6px;
|
|
42
|
+
--lab-radius: 12px;
|
|
43
|
+
/* What boxes and small parts actually use: the same sizes, as Apple's continuous corners where the browser has them (below). */
|
|
44
|
+
--lab-corner: var(--lab-radius);
|
|
45
|
+
--lab-corner-s: var(--lab-r-s);
|
|
46
|
+
--lab-font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
47
|
+
--lab-mono: ui-monospace, 'SF Mono', Menlo, monospace;
|
|
48
|
+
color-scheme: light;
|
|
49
|
+
}
|
|
50
|
+
@media (prefers-color-scheme: dark) {
|
|
51
|
+
:root:not([data-theme='light']) {
|
|
52
|
+
--lab-bg: var(--lab-paper-dark); --lab-fg: #f4f4f5; --lab-page: var(--lab-black); --lab-muted: var(--lab-white-4);
|
|
53
|
+
--lab-line: var(--lab-white-3); --lab-soft: var(--lab-white-1); --lab-hover: var(--lab-white-2); --lab-green: #34c759; --lab-green-soft: var(--lab-green-1);
|
|
54
|
+
--lab-shadow: 0 0 0 1px rgba(244, 244, 245, .16), 0 10px 32px rgba(0, 0, 0, .5);
|
|
55
|
+
color-scheme: dark;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
:root[data-theme='dark'] {
|
|
59
|
+
--lab-bg: var(--lab-paper-dark); --lab-fg: #f4f4f5; --lab-page: var(--lab-black); --lab-muted: var(--lab-white-4);
|
|
60
|
+
--lab-line: var(--lab-white-3); --lab-soft: var(--lab-white-1); --lab-hover: var(--lab-white-2); --lab-green: #34c759; --lab-green-soft: var(--lab-green-1);
|
|
61
|
+
--lab-shadow: 0 0 0 1px rgba(244, 244, 245, .16), 0 10px 32px rgba(0, 0, 0, .5);
|
|
62
|
+
color-scheme: dark;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Base */
|
|
66
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
67
|
+
body.lab {
|
|
68
|
+
margin: 0; background: var(--lab-page); color: var(--lab-fg); font: 15px/1.45 var(--lab-font);
|
|
69
|
+
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
70
|
+
padding: 24px max(16px, env(safe-area-inset-right, 0px)) 96px max(16px, env(safe-area-inset-left, 0px));
|
|
71
|
+
}
|
|
72
|
+
.lab main, .lab-main { max-width: 680px; margin: 0 auto; display: grid; gap: 20px; }
|
|
73
|
+
.lab h1 { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
|
|
74
|
+
.lab h2 { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--lab-muted); margin: 0 0 8px; }
|
|
75
|
+
.lab p { margin: 0; }
|
|
76
|
+
.lab a { color: inherit; text-underline-offset: 2px; }
|
|
77
|
+
/* The lab's own screens open with the mark and the name. */
|
|
78
|
+
.lab-brand { justify-self: start; display: inline-flex; align-items: center; gap: 7px; font-size: 17px; font-weight: 600; letter-spacing: -.03em; color: inherit; text-decoration: none; }
|
|
79
|
+
.lab-brand svg { margin-top: -2px; }
|
|
80
|
+
.lab-muted, .lab .lede { color: var(--lab-muted); }
|
|
81
|
+
.lab .lede { margin-top: 6px; }
|
|
82
|
+
.lab-small { font-size: 13px; }
|
|
83
|
+
|
|
84
|
+
/* A box: white, 12 px corners, hairline ring and soft shadow. */
|
|
85
|
+
.lab-box { background: var(--lab-bg); box-shadow: var(--lab-shadow); border-radius: var(--lab-corner); padding: 14px 16px; }
|
|
86
|
+
|
|
87
|
+
/* Pills: small corners, 11 px, quiet grey; green for a pick or a go. */
|
|
88
|
+
.lab-pill { display: inline-block; font-size: 11px; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: var(--lab-corner-s);
|
|
89
|
+
background: var(--lab-soft); color: var(--lab-muted); white-space: nowrap; }
|
|
90
|
+
.lab-pill.go { background: var(--lab-green-soft); color: var(--lab-green); }
|
|
91
|
+
|
|
92
|
+
/* Buttons, as in the widget's bar. */
|
|
93
|
+
.lab-button { border: 0; border-radius: var(--lab-corner); padding: 9px 14px; cursor: pointer; background: var(--lab-bg); color: var(--lab-fg);
|
|
94
|
+
box-shadow: var(--lab-shadow); font: 500 13px var(--lab-font); white-space: nowrap; }
|
|
95
|
+
.lab-button.go { background: var(--lab-green); color: #fff; }
|
|
96
|
+
|
|
97
|
+
/* Keys and code: small corners on the soft grey. */
|
|
98
|
+
.lab kbd, .lab code { font: 12.5px var(--lab-mono); background: var(--lab-soft); padding: 1px 5px; border-radius: var(--lab-corner-s); }
|
|
99
|
+
|
|
100
|
+
/* A list of rows inside a box (the page list, the widget's list). */
|
|
101
|
+
.lab-rows { list-style: none; margin: 0; padding: 6px; }
|
|
102
|
+
.lab-rows a { display: flex; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: var(--lab-corner-s); text-decoration: none; }
|
|
103
|
+
.lab-rows a:hover { background: var(--lab-hover); }
|
|
104
|
+
.lab-rows .lab-muted { font-size: 13px; }
|
|
105
|
+
/* The page list: title and when it changed on one line, the file under it; open comments as a green count. */
|
|
106
|
+
.lab-pages a { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 1px; align-items: baseline; padding: 9px 10px; }
|
|
107
|
+
.lab-page-t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
108
|
+
.lab-page-f { grid-column: 1; font-size: 12.5px; color: var(--lab-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
109
|
+
.lab-page-m { grid-row: 1; grid-column: 2; display: inline-flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--lab-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
110
|
+
.lab-page-m b { font-weight: 600; color: var(--lab-green); }
|
|
111
|
+
.lab-filter { width: 100%; box-sizing: border-box; margin: 0; padding: 9px 12px; border: 0; border-radius: var(--lab-corner); background: var(--lab-soft); color: inherit; font: inherit; outline: none; }
|
|
112
|
+
.lab-filter:focus { box-shadow: 0 0 0 2px var(--lab-green-soft); }
|
|
113
|
+
.lab-hint { font-size: 13px; margin: 0; }
|
|
114
|
+
|
|
115
|
+
/* Tables */
|
|
116
|
+
.lab-table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
117
|
+
.lab-table th, .lab-table td { text-align: left; padding: 7px 10px; border-bottom: var(--lab-hair); vertical-align: top; }
|
|
118
|
+
.lab-table tr:last-child td { border-bottom: 0; }
|
|
119
|
+
.lab-table th { color: var(--lab-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
|
|
120
|
+
.lab-button.go kbd { background: rgba(255, 255, 255, .22); color: #fff; }
|
|
121
|
+
|
|
122
|
+
/* Apple's continuous corners (squircle) in Safari 26 and Chrome: a squircle needs about 1.8 times the radius to look the
|
|
123
|
+
same size. */
|
|
124
|
+
@supports (corner-shape: squircle) {
|
|
125
|
+
:root { --lab-corner: calc(var(--lab-radius) * 1.8); --lab-corner-s: 11px; }
|
|
126
|
+
body.lab * { corner-shape: squircle; }
|
|
127
|
+
/* The pin keeps its teardrop. */
|
|
128
|
+
body.lab .pin { corner-shape: round; }
|
|
129
|
+
}
|