@leonidstern/labit 0.6.2 → 0.6.3-edge.3.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/CHANGELOG.md +15 -0
- package/README.md +1 -1
- package/api/_schema.mjs +29 -0
- package/api/lab-comments.mjs +26 -10
- package/dist/{chunk-XZUZQFBJ.mjs → chunk-AVPXXSFF.mjs} +7 -1
- package/dist/{chunk-LNYMIFDQ.mjs → chunk-QTMKKULT.mjs} +1 -1
- package/dist/{commands-LAQNMF2X.mjs → commands-L2RJ7R5W.mjs} +19 -5
- package/dist/local.mjs +173 -58
- package/dist/{mcp-4UPGXLZR.mjs → mcp-CNZISCIA.mjs} +8 -5
- package/package.json +1 -1
- package/public/_lab/comments.js +14 -14
- package/skills/labit/SKILL.md +1 -1
package/public/_lab/comments.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
(()=>{var Gn=':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:#24a046}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:not(.resolved,.done){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 .cnt:not(.zero){color:#24a046}.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}.pin .agentmark{width:60%;height:60%;display:block}.more-menu .trying-head{margin:4px 10px 2px;padding-top:6px;border-top:var(--_hair);font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--_muted)}.more-menu button.trying{justify-content:flex-start;gap:8px;white-space:normal}.more-menu button.trying .box{width:1em;color:var(--_muted)}.more-menu button.trying[aria-checked=true] .box{color:var(--_fg)}.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:not(.resolved,.done) .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:not(.resolved,.done){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}.msg .rule{display:block;margin-top:6px;font-size:12px;opacity:.8;letter-spacing:0;line-height:1.35}.msg .rule b{display:inline;margin:0 6px 0 0;font-size:11px;font-weight:600;opacity:.7;text-transform:uppercase;letter-spacing:.04em}.msg .rule button.btn{margin-left:8px;font-size:11px;padding:0;color:inherit;opacity:.6;text-decoration:underline;text-underline-offset:2px}.msg button.offer{display:inline;padding:0;font:inherit;letter-spacing:inherit;line-height:inherit;color:inherit;opacity:1;pointer-events:auto}.msg :is(.stamp,.stamp-room).offering>:not(.offer){display:none}.msg .stamp.offering{opacity:1}.msg button.offer .tm{opacity:.55}.msg button.offer .tick{color:#24a046}.msg button.offer .tick svg{width:9px;height:9px;vertical-align:top;margin-top:.5px}.msg button :is(svg,svg *){color:inherit}';var pe,oo,ze,ao;function ro(e){({host:pe,layer:oo,el:ze,store:ao}=e)}function so(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 a=e.localName,o=1;for(let s=e.previousElementSibling;s;s=s.previousElementSibling)s.localName===a&&o++;n.unshift(`${a}:nth-of-type(${o})`),e=e.parentElement}return n.length?(n[0].startsWith("#")?"":"body > ")+n.join(" > "):"body"}var bt=()=>Math.max(document.documentElement.scrollWidth,1),Oe=e=>Math.min(Math.max(e,0),1),X=(e,n)=>(e||"").replace(/\s+/g," ").trim().slice(0,n);function Fe(e){if(!e||e.startsWith("data:"))return"";try{let n=new URL(e,location.href),a=n.searchParams.get("href")||n.searchParams.get("url");if(a&&/\/_(image|vercel\/image|next\/image)/.test(n.pathname))return Fe(a);let o=n.pathname.split("/").filter(Boolean).map(decodeURIComponent),s=o.pop()||"";return/^w?\d+(x\d+)?\.\w+$/i.test(s)&&o.length&&(s=o.pop()),s.replace(/\.(avif|webp|jpe?g|png|gif|svg|mp4|webm|mov)$/i,"").replace(/[._-][A-Za-z0-9_-]{8}$/,"")}catch{return""}}var gn=e=>{let n=e.currentSrc||e.getAttribute("src")||"";if(n&&!n.startsWith("data:"))return new URL(n,location.href).href;let a=e.dataset?.src||(e.getAttribute("srcset")||e.dataset?.srcset||"").split(/\s+/)[0];return a?new URL(a,location.href).href:""};function It(e,n,a,o,s,r){if(!s||!r||!n.width||!n.height)return null;let p=getComputedStyle(e),i=p.objectFit||"fill",c=(p.objectPosition||"50% 50%").split(/\s+/).map(x=>x.endsWith("%")?parseFloat(x)/100:{left:0,top:0,right:1,bottom:1}[x]??.5),d=n.width/s,k=n.height/r,u={cover:Math.max(d,k),contain:Math.min(d,k),none:1,"scale-down":Math.min(1,d,k)}[i],m=s*(u??d),b=r*(u??k),h=(n.width-m)*(c[0]??.5),v=(n.height-b)*(c[1]??c[0]??.5);return{fit:i,nw:s,nh:r,imgX:Oe((a-n.left-h)/m),imgY:Oe((o-n.top-v)/b)}}function Wt(e){let n=e.naturalWidth,a=e.naturalHeight,o=[e.srcset,...[...e.closest("picture")?.querySelectorAll("source")||[]].map(s=>s.srcset)].filter(Boolean);for(let s of o)for(let r of s.split(/,\s+/)){let[p,i="1x"]=r.trim().split(/\s+/),c="";try{c=new URL(p,location.href).href}catch{}if(!p||c!==e.currentSrc||!n)continue;let d=parseFloat(i);if(i.endsWith("w")&&d)return{nw:Math.round(d),nh:Math.round(d*a/n)};if(i.endsWith("x")&&d)return{nw:Math.round(n*d),nh:Math.round(a*d)}}return{nw:n,nh:a}}var ta=/^[A-Z][A-Za-z0-9]{2,}$/,na=/(Provider|Context|Consumer|Boundary|Slot|Portal|Fragment|Presence|Scope|Trap|Root)$/,Qn=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(" "),ht=e=>/^[a-z-]+:\/\//i.test(e)?decodeURIComponent(e.replace(/^[a-z-]+:\/\/\/?(\.\/)?/i,"/").replace(/^\/[^/]*:\d+/,"").split("?")[0]).replace(/^\/(@fs)?/,"").replace(/^\(app-pages-browser\)\/\.?\/?/,""):e;function io(e){let n=(i,c=0)=>c>3?"":typeof i=="function"?i.displayName||i.name||"":i&&typeof i=="object"?i.displayName||n(i.render||i.type,c+1):"",a=i=>ta.test(i)&&!na.test(i),o=i=>{let c=i?._debugSource;if(c?.fileName)return`${ht(String(c.fileName))}:${c.lineNumber||0}`;let d=i?._debugStack?.stack;if(typeof d!="string")return"";for(let k of d.split(`
|
|
2
|
-
`).slice(1)){let u=/((?:https?|webpack-internal|file):\/\/[^\s()]+?):(\d+):\d+\)?\s*$/.exec(
|
|
3
|
-
`))&&
|
|
1
|
+
(()=>{var to=':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)}}button.pin.arrive:before{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;animation:lab-sent .7s ease-out both;animation-delay:inherit}@keyframes lab-sent{0%{box-shadow:0 0 #34c759bf}to{box-shadow:0 0 0 16px #34c75900}}.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:#24a046}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:not(.resolved,.done){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 .cnt:not(.zero){color:#24a046}.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}.pin .agentmark{width:60%;height:60%;display:block}.more-menu .trying-head{margin:4px 10px 2px;padding-top:6px;border-top:var(--_hair);font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--_muted)}.more-menu button.trying{justify-content:flex-start;gap:8px;white-space:normal}.more-menu button.trying .box{width:1em;color:var(--_muted)}.more-menu button.trying[aria-checked=true] .box{color:var(--_fg)}.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:not(.resolved,.done) .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:not(.resolved,.done){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}.msg .rule{display:block;margin-top:6px;font-size:12px;opacity:.8;letter-spacing:0;line-height:1.35}.msg .rule b{display:inline;margin:0 6px 0 0;font-size:11px;font-weight:600;opacity:.7;text-transform:uppercase;letter-spacing:.04em}.msg .rule button.btn{margin-left:8px;font-size:11px;padding:0;color:inherit;opacity:.6;text-decoration:underline;text-underline-offset:2px}.msg button.offer{display:inline;padding:0;font:inherit;letter-spacing:inherit;line-height:inherit;color:inherit;opacity:1;pointer-events:auto}.msg :is(.stamp,.stamp-room).offering>:not(.offer){display:none}.msg .stamp.offering{opacity:1}.msg button.offer .tm{opacity:.55}.msg button.offer .tick{color:#24a046}.msg button.offer .tick svg{width:9px;height:9px;vertical-align:top;margin-top:.5px}.msg button :is(svg,svg *){color:inherit}';var le,io,Ae,lo;function co(e){({host:le,layer:io,el:Ae,store:lo}=e)}var la=/[:«»]|^_r_\w+_$|[-_](?=[a-z0-9]*\d[a-z])[a-z0-9]{5,}$/i,wt=e=>la.test(e||""),ca=["data-testid","data-lab","data-comment-target"];function po(e){let n=[];for(;e&&e.nodeType===1&&e!==document.body&&e!==document.documentElement;){let a=ca.find(p=>e.getAttribute(p)),o=a&&`[${a}="${CSS.escape(e.getAttribute(a))}"]`;if(o&&document.querySelectorAll(o).length===1){n.unshift(o);break}if(e.id&&!wt(e.id)&&document.querySelectorAll(`#${CSS.escape(e.id)}`).length===1){n.unshift(`#${CSS.escape(e.id)}`);break}let s=e.localName,l=1;for(let p=e.previousElementSibling;p;p=p.previousElementSibling)p.localName===s&&l++;n.unshift(`${s}:nth-of-type(${l})`),e=e.parentElement}return n.length?(/^[#[]/.test(n[0])?"":"body > ")+n.join(" > "):"body"}var xt=()=>Math.max(document.documentElement.scrollWidth,1),ze=e=>Math.min(Math.max(e,0),1),X=(e,n)=>(e||"").replace(/\s+/g," ").trim().slice(0,n);function Ke(e){if(!e||e.startsWith("data:"))return"";try{let n=new URL(e,location.href),a=n.searchParams.get("href")||n.searchParams.get("url");if(a&&/\/_(image|vercel\/image|next\/image)/.test(n.pathname))return Ke(a);let o=n.pathname.split("/").filter(Boolean).map(decodeURIComponent),s=o.pop()||"";return/^w?\d+(x\d+)?\.\w+$/i.test(s)&&o.length&&(s=o.pop()),s.replace(/\.(avif|webp|jpe?g|png|gif|svg|mp4|webm|mov)$/i,"").replace(/[._-][A-Za-z0-9_-]{8}$/,"")}catch{return""}}var xn=e=>{let n=e.currentSrc||e.getAttribute("src")||"";if(n&&!n.startsWith("data:"))return new URL(n,location.href).href;let a=e.dataset?.src||(e.getAttribute("srcset")||e.dataset?.srcset||"").split(/\s+/)[0];return a?new URL(a,location.href).href:""};function Wt(e,n,a,o,s,l){if(!s||!l||!n.width||!n.height)return null;let p=getComputedStyle(e),r=p.objectFit||"fill",i=(p.objectPosition||"50% 50%").split(/\s+/).map(y=>y.endsWith("%")?parseFloat(y)/100:{left:0,top:0,right:1,bottom:1}[y]??.5),d=n.width/s,w=n.height/l,u={cover:Math.max(d,w),contain:Math.min(d,w),none:1,"scale-down":Math.min(1,d,w)}[r],m=s*(u??d),b=l*(u??w),h=(n.width-m)*(i[0]??.5),k=(n.height-b)*(i[1]??i[0]??.5);return{fit:r,nw:s,nh:l,imgX:ze((a-n.left-h)/m),imgY:ze((o-n.top-k)/b)}}function Ft(e){let n=e.naturalWidth,a=e.naturalHeight,o=[e.srcset,...[...e.closest("picture")?.querySelectorAll("source")||[]].map(s=>s.srcset)].filter(Boolean);for(let s of o)for(let l of s.split(/,\s+/)){let[p,r="1x"]=l.trim().split(/\s+/),i="";try{i=new URL(p,location.href).href}catch{}if(!p||i!==e.currentSrc||!n)continue;let d=parseFloat(r);if(r.endsWith("w")&&d)return{nw:Math.round(d),nh:Math.round(d*a/n)};if(r.endsWith("x")&&d)return{nw:Math.round(n*d),nh:Math.round(a*d)}}return{nw:n,nh:a}}var da=/^[A-Z][A-Za-z0-9]{2,}$/,pa=/(Provider|Context|Consumer|Boundary|Slot|Portal|Fragment|Presence|Scope|Trap|Root)$/,no=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(" "),bt=e=>/^[a-z-]+:\/\//i.test(e)?decodeURIComponent(e.replace(/^[a-z-]+:\/\/\/?(\.\/)?/i,"/").replace(/^\/[^/]*:\d+/,"").split("?")[0]).replace(/^\/(@fs)?/,"").replace(/^\(app-pages-browser\)\/\.?\/?/,""):e;function uo(e){let n=(r,i=0)=>i>3?"":typeof r=="function"?r.displayName||r.name||"":r&&typeof r=="object"?r.displayName||n(r.render||r.type,i+1):"",a=r=>da.test(r)&&!pa.test(r),o=r=>{let i=r?._debugSource;if(i?.fileName)return`${bt(String(i.fileName))}:${i.lineNumber||0}`;let d=r?._debugStack?.stack;if(typeof d!="string")return"";for(let w of d.split(`
|
|
2
|
+
`).slice(1)){let u=/((?:https?|webpack-internal|file):\/\/[^\s()]+?):(\d+):\d+\)?\s*$/.exec(w);if(u&&!/node_modules|react-dom|react-jsx|jsx-dev-runtime|react-server|scheduler/.test(u[1]))return`${bt(u[1])} (line ${u[2]} as served, may differ from the source)`}return""},s=Object.keys(e).find(r=>r.startsWith("__reactFiber$"));if(s){let r=e[s],i=[],d="";for(let w=r?.return,u=0;w&&i.length<2&&u<80;w=w.return,u++){if(typeof w.type=="string")continue;let m=n(w.type);if(!a(m))continue;i.length||(d=o(w));let b=no(w.memoizedProps);i.push(b?`${m} ${b}`:m)}return i.length?{component:i.length>1?`${i[0]} (in ${i[1]})`:i[0],source:o(r)||void 0,usedAt:d||void 0}:o(r)?{source:o(r)}:{}}let l=e.__vueParentComponent;if(l?.type){let r=l.type.name||l.type.__name||(l.type.__file||"").replace(/^.*\//,"").replace(/\.vue$/,""),i=l.parent?.type,d=i&&(i.name||i.__name),w=no(l.props);return{component:`${r}${w?" "+w:""}${d?` (in ${d})`:""}`,source:l.type.__file?bt(l.type.__file):void 0,usedAt:i?.__file?bt(i.__file):void 0}}let p=e.__svelte_meta?.loc;return p?.file?{component:p.file.replace(/^.*\//,"").replace(/\.svelte$/,""),source:`${bt(p.file)}:${p.line??0}`}:{}}function mo(e){let n=getComputedStyle(e),a=new Map,o="rgb(1, 2, 3)",s=document.createElement("i");s.style.cssText=`display:none;color:${o}`;let l=s.appendChild(document.createElement("i"));document.body.append(s);for(let i of[...getComputedStyle(document.documentElement)].filter(d=>d.startsWith("--")).slice(0,400)){l.style.color="",l.style.color=`var(${i})`;let d=getComputedStyle(l).color;d&&d!==o&&!a.has(d)&&a.set(d,i)}s.remove();let p=i=>a.has(i)?`${a.get(i)} ${i}`:i,r=[];return/^(transparent|rgba\(0, 0, 0, 0\))$/.test(n.backgroundColor)||r.push(`fill ${p(n.backgroundColor)}`),r.push(`text ${p(n.color)} ${n.fontSize}/${n.fontWeight}`),parseFloat(n.borderTopLeftRadius)&&r.push(`radius ${n.borderTopLeftRadius}`),X(r.join(", "),200)}function ua(e,n,a){let o=getComputedStyle(e).transform;if(!o||o==="none")return null;let s=new DOMMatrix(o);if(s.isIdentity)return null;let l=e.offsetWidth||e.getBoundingClientRect().width,p=e.offsetHeight||e.getBoundingClientRect().height,[r,i]=getComputedStyle(e).transformOrigin.split(" ").map(parseFloat),d=(h,k)=>s.transformPoint(new DOMPoint(h-r,k-i)),w=[d(0,0),d(l,0),d(0,p),d(l,p)],u=e.getBoundingClientRect(),m={x:u.left-Math.min(...w.map(h=>h.x)),y:u.top-Math.min(...w.map(h=>h.y))},b=s.inverse().transformPoint(new DOMPoint(n-m.x,a-m.y));return{rect:{left:0,top:0,width:l,height:p},x:b.x+r,y:b.y+i}}function ma(e,n,a,o){let s=e.getBoundingClientRect(),l=(e.getAttribute("preserveAspectRatio")||"xMidYMid meet").split(/\s+/),p=(i,d)=>{if(!i||!d||!s.width||!s.height)return;let[w,u]=[s.width,s.height];if(l[0]!=="none"){let k=(l[1]==="slice"?Math.max:Math.min)(s.width/i,s.height/d);[w,u]=[i*k,d*k]}let m=(k,y)=>k==="Min"?0:k==="Max"?y:y/2,b=l[0]==="none"?0:m(l[0].slice(1,4),s.width-w),h=l[0]==="none"?0:m(l[0].slice(5,8),s.height-u);Object.assign(n,{nw:i,nh:d,imgX:ze((a-s.left-b)/w),imgY:ze((o-s.top-h)/u)})},r=new Image;r.onload=()=>p(r.naturalWidth,r.naturalHeight),r.src=n.src,r.complete&&p(r.naturalWidth,r.naturalHeight)}function fa(e,n,a,o,s){let l=e.getBoundingClientRect(),p=getComputedStyle(e),r=m=>m.split(/,(?![^(]*\))/).map(b=>b.trim()),i=Math.max(0,r(p.backgroundImage).findIndex(m=>m.includes(n))),d=m=>{let b=r(m);return b[i%b.length]},w=(m,b)=>{if(!m||!b||!l.width||!l.height)return;let h=d(p.backgroundSize),k=m,y=b;if(h==="cover"||h==="contain"){let O=(h==="cover"?Math.max:Math.min)(l.width/m,l.height/b);k=m*O,y=b*O}else if(h!=="auto"&&h!=="auto auto"){let[O,B="auto"]=h.split(/\s+/),J=(q,P)=>q.endsWith("%")?parseFloat(q)/100*P:parseFloat(q);k=O==="auto"?NaN:J(O,l.width),y=B==="auto"?NaN:J(B,l.height),Number.isNaN(k)&&Number.isNaN(y)?[k,y]=[m,b]:Number.isNaN(k)?k=y*m/b:Number.isNaN(y)&&(y=k*b/m)}let[f="50%",E="50%"]=d(p.backgroundPosition).split(/\s+/),S=(O,B)=>O.endsWith("%")?parseFloat(O)/100*B:parseFloat(O)||0,L=S(f,l.width-k),C=S(E,l.height-y);Object.assign(a,{nw:m,nh:b,fit:`background ${h}`,imgX:ze((o-l.left-L)/k),imgY:ze((s-l.top-C)/y)})},u=new Image;u.onload=()=>w(u.naturalWidth,u.naturalHeight),u.src=n,u.complete&&w(u.naturalWidth,u.naturalHeight)}function ga(e,n){let a=[...e.children].filter(p=>p!==le&&p.getBoundingClientRect().height>0),o=null,s=null;for(let p of a){let r=p.getBoundingClientRect();if(r.bottom<=n)o=p;else if(r.top>=n&&!s)s=p;else if(r.top<n&&r.bottom>n)return null}let l=p=>{if(!p)return;let r=p.matches("h1, h2, h3, h4, h5, h6")?p:p.querySelector("h1, h2, h3, h4, h5, h6");return X(`${tt(p)} "${X((r||p).textContent,60)}"`,160)};return o||s?{above:l(o),below:l(s)}:null}function fo(e){for(let n=e;n;n=n.parentElement){let a=getComputedStyle(n).backgroundColor.match(/rgba?\(([\d.]+),\s*([\d.]+),\s*([\d.]+)(?:,\s*([\d.]+))?/);if(!a||a[4]!==void 0&&parseFloat(a[4])<.5)continue;let[o,s,l]=[a[1],a[2],a[3]].map(Number),p="#"+[o,s,l].map(r=>Math.round(r).toString(16).padStart(2,"0")).join("");return{scheme:.2126*o+.7152*s+.0722*l<128?"dark":"light",background:p}}return{scheme:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}}function ha(e,n,a=[]){let o=null,s=0;if(document.caretPositionFromPoint){let S=a.length?document.caretPositionFromPoint(e,n,{shadowRoots:a}):document.caretPositionFromPoint(e,n);S&&(o=S.offsetNode,s=S.offset)}else if(document.caretRangeFromPoint){let S=document.caretRangeFromPoint(e,n);S&&(o=S.startContainer,s=S.startOffset)}if(!o||o.nodeType!==3||!o.data.trim())return null;let l=document.createRange();if(l.selectNodeContents(o),![...l.getClientRects()].some(S=>e>=S.left-4&&e<=S.right+4&&n>=S.top-4&&n<=S.bottom+4))return null;let r=o.data,i=s,d=s,w=/[\u0e00-\u0e7f\u3040-\u30ff\u3400-\u9fff\uac00-\ud7af\uf900-\ufaff]/.test(r)&&typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(o.parentElement?.closest("[lang]")?.lang||void 0,{granularity:"word"}):null;if(w){for(let S of w.segment(r))if(s>=S.index&&s<=S.index+S.segment.length&&S.segment.trim()&&(i=S.index,d=S.index+S.segment.length,s<d))break}else{for(;i>0&&/\S/.test(r[i-1]);)i--;for(;d<r.length&&/\S/.test(r[d]);)d++}let m=(o.parentElement?.closest("p, li, h1, h2, h3, h4, h5, h6, td, th, figcaption, blockquote, a, button, label, span, div")||o.parentElement)?.textContent||r,b=m.slice(0,m.indexOf(r)+i),h=m.slice(m.indexOf(r)+d),k=S=>S.replace(/\s+/g," "),y={exact:X(r.slice(i,d),80),prefix:k(b.slice(-80)).replace(/^\s+/,"").slice(-40),suffix:k(h.slice(0,80)).replace(/\s+$/,"").slice(0,40)},f=o.parentElement?.closest("pre, [data-file]")||(getComputedStyle(o.parentElement).whiteSpace.startsWith("pre")?o.parentElement:null),E=!f&&o.parentElement?.closest('table[data-file], table[class*="code" i]');if(f||E){let S=f||E,L=document.createRange();L.setStart(S,0),L.setEnd(o,s);let C=L.toString(),O=S.textContent,B=[...S.querySelectorAll("br, tr")];if((S.localName==="table"||!O.includes(`
|
|
3
|
+
`))&&B.length){let P=S.querySelectorAll("br").length?[...S.querySelectorAll("br")]:[...S.querySelectorAll("tr")].slice(0,-1),F=P.filter(H=>H.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING&&!H.contains(o)).length,V=document.createRange();F?V.setStartAfter(P[F-1]):V.setStart(S,0),P[F]?V.setEndBefore(P[F]):V.setEnd(S,S.childNodes.length);let oe=S.querySelectorAll("br").length?null:o.parentElement?.closest("tr");y.line=X((oe?oe.textContent:V.toString()).trim(),200),y.lineNo=F+1,y.lines=P.length+(S.querySelectorAll("br").length?0:1)}else{let P=C.lastIndexOf(`
|
|
4
4
|
`)+1,F=O.indexOf(`
|
|
5
|
-
`,
|
|
6
|
-
`).length,
|
|
7
|
-
`).length}let Q=o.parentElement?.closest("tr, [data-line], [data-line-number]");if(Q){let B=Q.matches("[data-line], [data-line-number]")?Q:Q.querySelector("[data-line], [data-line-number]"),F=B?.getAttribute("data-line")||B?.getAttribute("data-line-number")||[...Q.children].map(J=>J.textContent.trim()).find(J=>/^\d+$/.test(J));F&&/^\d+$/.test(F)&&(x.pageLineNo=Number(F))}let D=E.closest("[data-file]")?.getAttribute("data-file")||E.getAttribute("title")||E.getAttribute("aria-label")||"";for(let B=E.parentElement,F=0;!D.trim()&&B&&B!==document.body&&F<3;B=B.parentElement,F++)D=B.querySelector(':scope > figcaption, :scope > [class*="title" i]')?.textContent||"";D.trim()&&(x.label=X(D.trim(),120))}return x}function tt(e){let n=[...e.attributes].filter(a=>/^(id|class|alt|role|aria-label|href|data-[\w-]+)$/.test(a.name)).map(a=>`${a.name}="${X(a.value,60)}"`);return`<${e.localName}${n.length?` ${n.join(" ")}`:""}>`.slice(0,200)}function eo(e,n){if(!n)return!0;let a=/^<([\w-]+)/.exec(n)?.[1];if(e.localName!==a||(/ id="([^"]*)"/.exec(n)?.[1]||"")!==X(e.id||"",60))return!1;let s=(/ class="([^"]*)"/.exec(n)?.[1]||"").split(/\s+/).filter(r=>r&&r!=="\u2026"&&!r.endsWith("\u2026"));return!s.length||s.some(r=>e.classList.contains(r))}function Ke(e,n){let a=document.elementsFromPoint(e,n).filter(h=>h!==pe&&h!==document.documentElement),o=[],s=null;for(let h=a[0];h?.shadowRoot&&!pe.contains(h)&&o.length<5;h=a[0]){s||=h,o.push(h.shadowRoot);let v=h.shadowRoot.elementsFromPoint(e,n).filter(x=>x!==h);if(!v.length)break;a=[...v,...a]}let r=a[0]?.closest("[data-comment-target]")||a[0]||document.body,p=r.getBoundingClientRect(),i={selector:so(r),x:p.width?(e-p.left)/p.width:0,y:p.height?(n-p.top)/p.height:0,docX:(e+scrollX)/bt(),docY:n+scrollY,width:innerWidth,height:innerHeight,dpr:Math.round((devicePixelRatio||1)*100)/100,element:tt(r),eh:Math.round(p.height)},c=X(r.textContent,200);c&&r!==document.body&&(r.textContent||"").length<400&&(i.text=X(c,80));let d=r.parentElement?.closest("[id], [data-lab]");d&&(i.inside=d.dataset.lab?`[data-lab="${d.dataset.lab}"]`:`#${d.id}`);let k=null;for(let h of document.querySelectorAll("h1, h2, h3"))(h.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING||h.contains(r))&&(k=h);k&&(i.section=X(k.textContent,100)),s&&(i.shadow=tt(s));for(let[h,v]of Object.entries(io(r)))v&&(i[h]=X(v,200));r!==document.body&&(i.looks=lo(r));let u=r.closest?.("select");u&&u.selectedIndex>=0&&(i.chosen=X(`${u.selectedIndex+1} of ${u.options.length}: "${u.options[u.selectedIndex].text}"`,120));for(let h of[r,r.parentElement])if(!(!h||h===document.body)){for(let v of["::before","::after"]){let x=getComputedStyle(h,v).content,g=x&&x.match(/^"(.+)"$/);if(g&&g[1].trim()){i.cssText=X(`"${g[1]}" from ${v} of ${tt(h)}`,160);break}}if(i.cssText)break}let m=document.querySelector('meta[name="lab-build"]')?.content;m&&(i.build=X(m,40));let b=a.slice(0,5).find(h=>/^(img|video|canvas|svg|image)$/.test(h.localName)&&!pe.contains(h));if(b?.localName==="image"&&b.namespaceURI==="http://www.w3.org/2000/svg")i.kind="image",i.src=new URL(b.getAttribute("href")||b.getAttribute("xlink:href")||"",location.href).href,i.file=Fe(i.src),aa(b,i,e,n);else if(b){let h=b.getBoundingClientRect();if(i.kind=b.localName==="img"?"image":b.localName,b.localName==="img"||b.localName==="video"){let v=b,x=b;i.src=gn(b),i.file=Fe(i.src),v.alt&&(i.alt=X(v.alt,120));let g=oa(b,e,n),[_,E,$]=g?[g.rect,g.x,g.y]:[h,e,n],T=b.localName==="img"?It(b,_,E,$,Wt(b).nw,Wt(b).nh):It(b,_,E,$,x.videoWidth,x.videoHeight);if(T&&Object.assign(i,T),g&&(i.transform=X(getComputedStyle(b).transform,80)),b.localName==="img"&&/\.(gif|webp|apng)(\?|#|$)/i.test(v.currentSrc||v.src)){let O=performance.getEntriesByName(v.currentSrc||v.src)[0],I=O?(performance.now()-O.responseEnd)/1e3:performance.now()/1e3;i.shownFor=Math.round(I*10)/10}b.localName==="video"&&(i.time=Math.round(x.currentTime*10)/10,Number.isFinite(x.duration)&&(i.duration=Math.round(x.duration*10)/10),!i.file&&x.poster&&(i.file=Fe(x.poster)))}else i.time=Math.round(performance.now()/100)/10,i.imgX=Oe((e-h.left)/(h.width||1)),i.imgY=Oe((n-h.top)/(h.height||1)),i.nw=Math.round(h.width),i.nh=Math.round(h.height)}else{let h=ia(e,n,o);if(h)i.kind="text",i.quote=h;else{for(let v=r,x=0;v&&v!==document.documentElement&&x<4;v=v.parentElement,x++){let g=getComputedStyle(v).backgroundImage.match(/url\(["']?(.+?)["']?\)/);if(g){i.kind="background",i.src=new URL(g[1],location.href).href,i.file=Fe(i.src),ra(v,i.src,i,e,n);break}}if(i.kind||="element",i.kind==="element"){let v=sa(r,n);v&&Object.assign(i,{gapAbove:v.above,gapBelow:v.below})}}}Object.assign(i,co(r));for(let h=r;h&&h!==document.body&&h!==document.documentElement;h=h.parentElement)if(h.id){i.block=h.id;break}return i}function po(e){let n=null;try{n=e.selector?document.querySelector(e.selector):null}catch{}let a=v=>{if(!v)return!1;if(e.file&&/^(image|video)$/.test(e.kind)){let x=v.closest?.("img, video")||v;return Fe(gn(x))===e.file}if(e.element&&!eo(v,e.element))return!1;if(e.quote?.exact){let x=(v.textContent||"").replace(/\s+/g,""),g=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 x.includes(g)&&(g.length>=16||!_&&!E||x.includes(_+g)||x.includes(g+E))}return!0},o=X(e.text,400),s=v=>{let x=null;for(let g of document.querySelectorAll("h1, h2, h3"))(g.compareDocumentPosition(v)&Node.DOCUMENT_POSITION_FOLLOWING||g.contains(v))&&(x=g);return x?X(x.textContent,100):""},r=v=>String(v||"").replace(/\s+/g,""),p=r(e.zoneText).slice(0,30),i=v=>e.quote?.exact?!0:o?X(v.textContent,400).startsWith(o.slice(0,40)):p?r(v.textContent).includes(p):e.section?s(v)===e.section:!0,c=n&&n!==document.body&&a(n)?n:null;if(c&&i(c))return c;if(e.file&&/^(image|video)$/.test(e.kind))return[...document.querySelectorAll("img, video")].find(v=>Fe(gn(v))===e.file)||null;let d=/^<([\w-]+)/.exec(e.element||"")?.[1];if(!d||d==="body"||d==="html")return c;let k=v=>X(v,400),u=null,m=-1,b=1/0,h=[...document.querySelectorAll(d)].slice(0,400).filter(v=>!pe.contains(v)&&eo(v,e.element));for(let v of h){let x=k(v.textContent),g=0;if(e.quote?.exact&&a(v)&&(g+=4),o&&x===o&&(g+=4),p&&r(v.textContent).includes(p)?g+=4:o&&x.startsWith(o.slice(0,40))&&(g+=2),!g&&h.length>1)continue;g&&e.section&&s(v)===e.section&&(g+=2);let _=Math.abs(v.getBoundingClientRect().top+scrollY-(e.docY||0));(g>m||g===m&&_<b)&&([u,m,b]=[v,g,_])}return m>0||!c?u:c}var Ht=null;function la(e){let n=/^(?:…)?(.*?)\[([^\]]+)\](.*?)(?:…)?$/s.exec(e.text||"");if(!n)return null;let a=n[1].replace(/\s+/g," ").slice(-24),o=n[2];if(!Ht||performance.now()-Ht.at>400){let d=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:m=>pe.contains(m.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),k="",u=[];for(let m=d.nextNode();m;m=d.nextNode()){let b=m.data.replace(/\s+/g," ");for(let h=0;h<b.length;h++)u.push([m,h]);k+=b}Ht={at:performance.now(),text:k,map:u}}let{text:s,map:r}=Ht,p=s.indexOf(a+o);if(p<0)return{gone:!0};p+=a.length;let i=document.createRange();try{i.setStart(...r[p]),i.setEnd(r[p+o.length-1][0],r[p+o.length-1][1]+1)}catch{return{gone:!0}}let c=i.getBoundingClientRect();return c.width||c.height?{left:c.left+scrollX+Math.min(6,c.width/2),top:c.top+scrollY+c.height/2}:{gone:!0}}var xt={at:-1/0,y:0},yt=(e,n=0)=>{if(performance.now()-xt.at>300){let a=[...document.body.children].filter(o=>o!==pe&&!pe.contains(o)).map(o=>o.getBoundingClientRect().bottom+scrollY);xt={at:performance.now(),y:Math.max(innerHeight,...a)}}return Math.max(0,Math.min(e,xt.y-n-40))},to=(e,n)=>({left:e.left+(n.pinX?e.width:0),top:e.top+(n.pinY?e.height:0)}),no=10,ca=30;function da(e){let n=s=>Math.max(no,Math.round(s.left+scrollX-ca)),a=String(e?.selector||"").split(" > ");for(;a.length>1;){a.pop();let s=null;try{s=document.querySelector(a.join(" > "))}catch{}if(!s||/^(html|body)$/.test(s.localName)||pe.contains(s))continue;let r=s.getBoundingClientRect();if(r.width)return n(r)}let o=[...document.body.children].filter(s=>s!==pe&&!pe.contains(s)).map(s=>s.getBoundingClientRect()).filter(s=>s.width&&s.height);return o.length?n({left:Math.min(...o.map(s=>s.left))}):no}function je(e){let n=pa(e);return n.moved?{...n,left:da(e)}:n}function pa(e){let n=po(e);if(n&&!e.zw&&!e.docW&&/^(html|body|main)$/.test(n.localName)&&/\[[^\]]+\]/.test(e.text||"")){let r=la(e);if(r&&!r.gone)return{left:r.left,top:r.top,zone:null};if(r?.gone)return{left:e.docX*bt(),top:yt(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*bt(),top:yt(e.docY),zone:null,moved:!0};if(n){let r=n.getBoundingClientRect();if(r.width||r.height){let p=r.left+scrollX+e.x*r.width,i=e.zw&&Number.isFinite(e.oy)&&e.docH&&r.height>2*e.docH,c=r.top+scrollY+(i?e.oy:e.y*r.height),d=e.zw?{left:p,top:c,width:e.zw*r.width,height:i?e.docH:e.zh*r.height}:null;return d?{...to(d,e),zone:d}:{left:p,top:c,zone:d}}}let a=e.docX*bt(),o=yt(e.docY,e.docH||0),s=e.docW?{left:a,top:o,width:e.docW,height:e.docH}:null;return s?{...to(s,e),zone:s,moved:!!e.selector&&e.selector!=="body"}:{left:a,top:o,zone:s,moved:!!e.selector&&e.selector!=="body"}}function ua(e){let n=e?.quote,a=n?.exact?po(e):null;if(!a)return null;let o=n.exact.replace(/\s+/g,""),s=(n.prefix||"").replace(/\s+/g,"").slice(-12);for(let r=0;a&&r<4;a=a.parentElement,r++){let p="",i=[],c=document.createTreeWalker(a,NodeFilter.SHOW_TEXT);for(let k=c.nextNode();k;k=c.nextNode())for(let u=0;u<k.data.length;u++)/\s/.test(k.data[u])||(p+=k.data[u],i.push([k,u]));let d=null;for(let k=p.indexOf(o);k!==-1;k=p.indexOf(o,k+1)){let u=document.createRange();u.setStart(...i[k]);let[m,b]=i[k+o.length-1];if(u.setEnd(m,b+1),!s||p.slice(0,k).endsWith(s))return u;d||=u}if(d)return d}return null}var uo=(e,n)=>{let a=ze("b",{},String(e||"").replace(/\s*·\s*session\s+\S+$/i,""));return n&&a.append(ze("span",{class:"mark done",role:"img","aria-label":"done"},"\u2713")),a},hn=!1,vt=()=>hn&&ao.get("lab-hold")==="1",ma=e=>{let n=document.getElementById(e);return!!n&&!n.closest("[data-lab-comments]")},fa=e=>{let n=[],a=0;for(let o of e.matchAll(/\bhttps?:\/\/[^\s<>"']*[^\s<>"'.,;:!?)\]]|(?<![\w&/#])#([A-Za-z][\w:.-]*[\w])/g)){if(o[1]&&!ma(o[1]))continue;o.index>a&&n.push(document.createTextNode(e.slice(a,o.index)));let s=o[1]?ze("a",{href:`#${o[1]}`,class:"link"},o[0]):ze("a",{href:o[0],target:"_blank",rel:"noopener noreferrer",class:"link"},o[0]);s.addEventListener("click",r=>{r.stopPropagation(),o[1]&&(r.preventDefault(),dispatchEvent(new CustomEvent("lab-goto",{detail:o[1]})))}),n.push(s),a=o.index+o[0].length}return a<e.length&&n.push(document.createTextNode(e.slice(a))),n},ga=e=>e.split(/(?<=[.!?])\s+(?=["'([]?[A-Z0-9])/),mo=e=>{let n=[];for(let[a,o]of String(e||"").trim().split(/\n\s*\n/).entries()){let s=o.split(`
|
|
8
|
-
`);if(s.length===1&&o.length>240){let
|
|
9
|
-
${r}`:n.push({text:r,gap:a>0&&p===0||!!c})})}return n.map(a=>{let o=ze("span",{class:`p${a.li?" li":""}${a.gap?" gap":""}`});return a.li&&o.append(ze("span",{class:"mk"},a.li)),o.append(...fa(a.text)),o})},ha=typeof Highlight=="function"&&!!CSS.highlights,Ft=e=>{if(!ha)return;let n=e&&ua(e);n?CSS.highlights.set("lab-quote",new Highlight(n)):CSS.highlights.delete("lab-quote")},bn=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},Kt=(e,n)=>{if(!e)return;let a=bn(n);return Object.assign(a.style,{left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`}),oo.append(a),a};function fo({x0:e,y0:n,x1:a,y1:o}){let s=Math.min(e,a),r=Math.min(n,o),p=Math.max(e,a),i=Math.max(n,o),c=Ke((s+p)/2,(r+i)/2),d=document.elementsFromPoint((s+p)/2,(r+i)/2).find($=>$!==pe&&!pe.contains($)),k=Math.max(1,(p-s)*(i-r)),u=$=>Math.max(0,Math.min($.right,p)-Math.max($.left,s))*Math.max(0,Math.min($.bottom,i)-Math.max($.top,r))/k>=.8;for(;d&&d!==document.body&&!u(d.getBoundingClientRect());)d=d.parentElement;d||=document.body;let m=d.getBoundingClientRect();Object.assign(c,{selector:d===document.body?"body":so(d),element:tt(d),x:m.width?(s-m.left)/m.width:0,y:m.height?(r-m.top)/m.height:0,zw:m.width?(p-s)/m.width:0,zh:m.height?(i-r)/m.height:0,oy:Math.round(r-m.top),docX:(s+scrollX)/bt(),docY:r+scrollY,docW:Math.round(p-s),docH:Math.round(i-r),pinX:a>=e?1:0,pinY:o>=n?1:0}),Object.assign(c,co(d)),c.kind==="text"&&(delete c.quote,c.kind="element");let b=d===document.body?"":X(d.textContent,200);b&&(d.textContent||"").length<400?c.text=X(b,80):delete c.text,d!==document.body&&(c.looks=lo(d));let h=[],v=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),x=document.createRange();for(let $=v.nextNode();$&&h.length<80;$=v.nextNode()){if(pe.contains($))continue;let T=$.parentElement?.getBoundingClientRect();if(!(!T||T.bottom<r||T.top>i||T.right<s||T.left>p))for(let O of $.data.matchAll(/\S+/g)){x.setStart($,O.index),x.setEnd($,O.index+O[0].length);let I=x.getBoundingClientRect(),Q=(I.left+I.right)/2,D=(I.top+I.bottom)/2;I.width&&Q>=s&&Q<=p&&D>=r&&D<=i&&h.push(O[0])}}let g=X(h.join(" "),300);g&&(c.zoneText=g);let _=[],E=d.querySelectorAll("*");for(let $=0;$<E.length&&$<3e3;$++){let T=E[$];if(pe.contains(T)||_.some(I=>I.contains(T)))continue;let O=T.getBoundingClientRect();O.width<8||O.height<8||O.left<s-4||O.right>p+4||O.top<r-4||O.bottom>i+4||_.push(T)}if(_.length&&(c.zoneItems=_.slice(0,5).map($=>{let T=io($),O=X($.textContent,50);return X([tt($),O&&`"${O}"`,T.component,T.source&&`written at ${T.source}`,T.usedAt&&`used at ${T.usedAt}`].filter(Boolean).join(" \xB7 "),500)}),_.length>5&&c.zoneItems.push(`and ${_.length-5} more`)),/^(img|video)$/.test(d.localName)){let $=d.localName==="img"?Wt(d).nw:d.videoWidth,T=d.localName==="img"?Wt(d).nh:d.videoHeight,O=It(d,m,s,r,$,T),I=It(d,m,p,i,$,T);O&&I&&Object.assign(c,{imgX:O.imgX,imgY:O.imgY,imgX2:I.imgX,imgY2:I.imgY})}else(c.kind==="image"||c.kind==="video")&&(delete c.imgX,delete c.imgY,c.kind="element");return c}var ba=()=>window.__lab||null;function jt(e){let n=ba();n&&(n.writing=Math.max(0,e),n.writing||n.flush())}var wt;function go(e){wt=e}var Ne=new Set,Yt=new Set,ho=()=>Ne.size>0,xa=e=>{e.value.trim()?Ne.add(e):Ne.delete(e),jt(Ne.size),wt?.whileWriting?.()},ya='<i class="arr" aria-hidden="true"></i>';function xn({placeholder:e,onSubmit:n,autofocus:a=!1,empty:o="",nameFirst:s=!1,draftKey:r=""}){let{el:p,store:i,root:c,refreshPinCursor:d,syncReads:k,rememberMe:u}=wt,m=p("div",{class:"composer"}),b=p("div",{class:"box"}),h=p("textarea",{placeholder:e,maxlength:"2000",rows:"1","aria-label":e,enterkeyhint:"send",autocomplete:"off",autocorrect:"off",spellcheck:"false",writingsuggestions:"false"}),v=p("label",{class:"who"}),x=p("span",{},"as"),g=p("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(g.value=i.get("lab-name"),r&&!Yt.has(r)){let H=i.get(r);H&&(h.value=H,queueMicrotask(()=>I()))}let _=()=>{r&&i.set(r,h.value.trim()?h.value:"")},E=()=>{Ne.delete(h),jt(Ne.size),wt?.whileWriting?.(),r&&i.set(r,"")};v.append(x,g);let $=p("button",{class:"send",type:"button","aria-label":"send"});$.addEventListener("pointerdown",H=>H.preventDefault()),$.addEventListener("mousedown",H=>H.preventDefault()),$.innerHTML=ya;let T=p("div",{class:"error"});b.append(h,p("div",{class:"line"}),v,$),m.append(b,T),b.addEventListener("click",H=>{H.target!==b&&!H.target.classList?.contains("line")||(h.focus({preventScroll:!0}),h.setSelectionRange(h.value.length,h.value.length))});let O=null;for(let H of[h,g])H.addEventListener("touchstart",se=>O={x:se.touches[0].clientX,y:se.touches[0].clientY},{passive:!0}),H.addEventListener("touchend",se=>{let ae=se.changedTouches[0];!O||Math.hypot(ae.clientX-O.x,ae.clientY-O.y)>10||c.activeElement===H||(se.preventDefault(),H.focus({preventScroll:!0}),H.setSelectionRange(H.value.length,H.value.length))},{passive:!1});let I=()=>{let H=s||h.value.length>0||c.activeElement===g||!!T.textContent,se=H!==b.classList.contains("open")&&!i.get("lab-name")&&b.isConnected&&!matchMedia("(prefers-reduced-motion: reduce)").matches,ae=se&&{arrow:$.getBoundingClientRect(),height:b.getBoundingClientRect().height},U=!!i.get("lab-name");if(b.classList.toggle("one",U),b.classList.toggle("open",H),x.hidden=!g.value.trim(),U&&!CSS.supports?.("field-sizing","content")&&(g.style.width=`${Math.max(2,g.value.length+1)}ch`),$.classList.toggle("ready",!!((h.value.trim()||o)&&g.value.trim())),xa(h),h.style.height="auto",h.style.height=`${h.scrollHeight}px`,se){let xe=$.getBoundingClientRect(),ye={duration:220,easing:"cubic-bezier(.2, .7, .3, 1)"};$.animate([{transform:`translate(${ae.arrow.left-xe.left}px, ${ae.arrow.top-xe.top}px)`},{transform:"none"}],ye),b.style.overflow="hidden",b.animate([{height:`${ae.height}px`},{height:`${b.getBoundingClientRect().height}px`}],ye).onfinish=()=>b.style.overflow=""}},Q=!1,D=async()=>{if(Q)return;let H=h.value.trim()||o;if(!H)return h.focus();if(!g.value.trim())return b.classList.add("open"),g.focus();i.set("lab-name",g.value.trim()),u(g.value.trim()),d(),k(),$.classList.remove("sent"),$.offsetWidth,$.classList.add("sent"),Q=!0;let se=h.value;r&&Yt.add(r),T.textContent="",T.classList.remove("wait");let ae=setTimeout(()=>{T.textContent="sending\u2026 it goes as soon as the lab is back",T.classList.add("wait")},1500);try{let U=await n(g.value.trim(),H);E(),r&&Yt.delete(r),clearTimeout(ae),T.textContent="",T.classList.remove("wait"),U?.keep&&(h.value="",I())}catch(U){clearTimeout(ae),T.classList.remove("wait"),T.textContent=U.message,r&&Yt.delete(r),h.value=se,_(),I()}Q=!1},B=H=>{H.key==="Enter"&&!H.shiftKey&&!H.isComposing&&(H.preventDefault(),D())};h.addEventListener("input",I),h.addEventListener("input",_),new MutationObserver(()=>{m.isConnected||(Ne.delete(h),jt(Ne.size),wt?.whileWriting?.())}).observe(document.documentElement,{childList:!0,subtree:!0}),g.addEventListener("input",I),g.addEventListener("blur",()=>setTimeout(I,0)),h.addEventListener("keydown",B),g.addEventListener("keydown",B);let F=0;$.addEventListener("touchend",H=>{H.preventDefault(),F=Date.now(),D()},{passive:!1}),$.addEventListener("click",()=>{Date.now()-F<700||D()}),$.addEventListener("mousedown",H=>H.preventDefault()),requestAnimationFrame(I);let J=s?g:h;s&&g.setAttribute("data-first","");let oe=()=>J.focus({preventScroll:!0});return a&&queueMicrotask(()=>J.isConnected?oe():setTimeout(oe,0)),m}var bo;function xo(e){bo=e}var yo=e=>{let n=e.anchor||{},a=n.quote?.exact||"",o=null;try{o=!a&&n.selector?document.querySelector(n.selector):null}catch{}for(let s=0;o&&o!==document.body&&s<5;o=o.parentElement,s++){let r=o.innerText?.replace(/\s+/g," ").trim()||"";if(r.length>=12){a=r;break}}return a=(a||n.text||n.section||"").replace(/\s+/g," ").trim(),a?`"${a.length>40?`${a.slice(0,39)}\u2026`:a}"`:""},vo=(e,n,a="")=>{let{el:o,mine:s,repliesOf:r,workState:p}=bo,i=new Date(e.createdAt),c=i.toDateString()===new Date().toDateString()?i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):i.toLocaleDateString([],{day:"numeric",month:"short"}),d=o("span",{class:"stamp"});if(d.append(o("span",{class:"tm"},a+c)),s(e)&&!e.session){let k=n?[n,...r(n.id)]:[e],u=!k.some(b=>!b.session&&b.createdAt>e.createdAt),m=k.some(b=>b.session&&b.createdAt>e.createdAt)||!!(n?.resolved&&u);if(!m&&u&&n&&p(n)[0]==="now")d.classList.add("busy"),d.append(o("span",{class:"ring",role:"img","aria-label":"the agent is on it"}));else if(m)d.classList.add("ans"),d.append(o("span",{class:"tick",role:"img","aria-label":"answered"},"\u2713"));else{let b=n?.handedAt&&n.handedAt>=e.createdAt;d.append(o("span",{class:`tick${b?" got":""}`,role:"img","aria-label":b?"delivered to the agent":"sent"},b?"\u2713\u2713":"\u2713"))}}return d};var S;function wo(e){S=e}var va=e=>!!e.closest?.(".handle, .tabs"),wa=(e,n)=>e.composedPath().find(a=>a instanceof HTMLElement&&n.contains(a)&&(a.localName==="textarea"||/auto|scroll/.test(getComputedStyle(a).overflowY))),kt="cubic-bezier(.32,.72,0,1)",ka=["top","bottom","height","max-height","transform","transition","animation","pointer-events","opacity","transform-origin"],yn={x:0,y:0,at:-1e9};function vn(e,n){let a=n||(performance.now()-yn.at<1500?yn:null);if(!a)return e.style.removeProperty("--lab-from");e.style.setProperty("--lab-from",`${Math.round(a.x-e.offsetLeft)}px ${Math.round(a.y-e.offsetTop)}px`)}var Ut=null;function ko(){!S.coarse||!S.host.hasAttribute("data-kb")||S.still.matches||(Ut??=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"}),Ut.isConnected||S.root.append(Ut),Ut.focus({preventScroll:!0}))}function wn(e,n=0,a){let o=a?360:n||200,s=n?"linear":"cubic-bezier(.4, 0, .9, .4)",r=0;try{r=new DOMMatrixReadOnly(getComputedStyle(e).transform).m42||0}catch{}let p=e.getBoundingClientRect(),i=p.top-r,c=getComputedStyle(S.scrim).opacity;for(let[m,b]of[["top",`${i}px`],["bottom","auto"],["height",`${p.height}px`],["max-height","none"],["animation","none"],["transition","none"],["transform",a?"":`translateY(${r}px)`],["pointer-events","none"]])e.style.setProperty(m,b,"important");S.host.setAttribute("data-leaving",""),S.scrim.style.transition="none",S.scrim.style.opacity=c;let d=()=>S.root.activeElement?.blur();a?setTimeout(d,o):d();let u=(a?null:S.root.querySelector(e.classList.contains("card")?".pin.open":e.classList.contains("float")?".pin.draft":"none"))?.getBoundingClientRect();if(u&&vn(e,{x:u.left+u.width/2,y:u.top+u.height/2}),e.offsetHeight,a){e.style.setProperty("transform-origin","50% 50%","important");let m=a.x-(p.left+p.width/2),b=a.y-(i+p.height/2),h=()=>{e.animate([{transform:"none"},{transform:`translate(${m}px, ${b}px) scale(${22/p.width}, ${22/p.height})`}],{duration:o,easing:kt,fill:"forwards"}),e.animate([{opacity:1},{opacity:1,offset:.7},{opacity:0}],{duration:o,fill:"forwards"})};requestAnimationFrame(()=>requestAnimationFrame(h))}else n?(e.style.setProperty("transition",`transform ${o}ms ${s}`,"important"),e.style.setProperty("transform",`translateY(${Math.max(p.height,innerHeight-i)+8}px)`,"important")):(e.style.setProperty("transition",`transform ${o}ms ${s}, opacity ${o}ms ease-in`,"important"),e.style.setProperty("transform",`translateY(${r}px) scale(.3)`,"important"),e.style.setProperty("opacity","0","important"));return S.scrim.style.transition=`opacity ${o}ms ${s}`,S.scrim.style.opacity="0",a?o+120:o}function kn(e){for(let n of ka)e.style.removeProperty(n);S.host.removeAttribute("data-leaving"),S.scrim.style.opacity=S.scrim.style.transition=""}function Xt(e,n,a=0){if(!S.coarse||!e||S.still.matches)return n();let o=wn(e,a);S.bar.style.transition=`transform ${o}ms cubic-bezier(.2, .6, .4, 1), opacity ${o}ms`,S.host.style.setProperty("--lab-p","1"),setTimeout(()=>{n(),kn(e),S.bar.style.transition="",S.host.style.removeProperty("--lab-p")},o)}function So(){let e=S.root.querySelector(".float:not(.out)"),n=S.root.querySelector(".pin.draft");if(!S.coarse||!e||!n||!S.vv)return;let a=innerHeight-S.vv.height,o=a>60?a:S.S.kbSeen||Math.round(innerHeight*.42),s=innerHeight-o-e.offsetHeight-8,r=n.getBoundingClientRect(),p=56;if(!(r.top<p||r.bottom>s-16))return;let i=Math.max(0,scrollY+(r.top+r.bottom)/2-(p+s)/2);S.S.revealed={from:scrollY,to:i},Zt(i)}function Sn(){let e=S.S.revealed;S.S.revealed=null,e&&S.coarse&&Math.abs(scrollY-e.to)<40&&Zt(e.from)}function Zt(e){if(S.coarse){let n=document.documentElement,a=parseFloat(n.style.getPropertyValue("--lab-room"))||0,o=Math.max(0,Math.ceil(e+innerHeight-(n.scrollHeight-a)));n.style.setProperty("--lab-room",`${o}px`),n.classList.toggle("lab-room",o>0)}scrollTo({top:Math.max(0,e),behavior:S.still.matches?"auto":"smooth"})}function En(){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(),En()},S.S.backWatcher=n}catch{}}function St(e,n,a=!1){if(!S.coarse)return;let o=0,s=-1e9,r=-1e9;e.addEventListener("scroll",()=>s=performance.now(),{capture:!0,passive:!0}),e.addEventListener("click",g=>{performance.now()-r<200&&(g.preventDefault(),g.stopPropagation())},!0),e.addEventListener("focusin",g=>{performance.now()-r<200&&g.target.localName==="textarea"&&g.target.blur()});let p=0,i=0,c=0,d=0,k=null,u=null,m=null,b=!1,h=g=>{if(b=g.currentTarget===S.scrim,b&&S.openSheet()!==e)return void(u="off");let _=g.touches[0];p=_.clientX,i=_.clientY,c=d=o=0,k={y:i,at:g.timeStamp},m=b?null:wa(g,e),u=g.touches.length>1||m?.localName==="textarea"?"off":null};e.addEventListener("touchstart",h,{passive:!0}),S.scrim.addEventListener("touchstart",h,{passive:!0});let v=g=>{if(b!==(g.currentTarget===S.scrim))return;let _=g.touches[0];if(u==="off"&&m&&m.localName!=="textarea"&&g.touches.length===1&&g.cancelable&&m.scrollTop<=0&&_.clientY>k.y+1&&(u="drag",i=_.clientY,d=0,k={y:_.clientY,at:g.timeStamp}),u==="off")return void(k={y:_.clientY,at:g.timeStamp});if(u==="hold")return g.preventDefault();if(!u){let T=_.clientY-i,O=_.clientX-p;if(!T&&!O)return;let I=Math.abs(O)>Math.abs(T),Q=!I&&T>0&&i-e.getBoundingClientRect().top<e.offsetHeight*.25;if(b?u=I?"hold":"drag":va(g.target)?u=I&&g.target.closest(".tabs")?"off":"drag":Q&&m?.localName!=="textarea"?u="drag":m?u=!I&&T>0&&m.scrollTop<=0&&performance.now()-s>100?"drag":"off":u=I?"hold":"drag",S.S.dbg?.(`touch ${String(g.target.className||g.target.localName).slice(0,20)} at ${Math.round(i-e.getBoundingClientRect().top)}/${e.offsetHeight} down${Math.round(T)} \u2192 ${u}${g.cancelable?"":" (not cancelable)"}${m?` box${Math.round(m.scrollTop)}`:""}`),u==="off")return;if(u==="hold")return g.preventDefault()}g.preventDefault(),o=_.clientY-i;let E=e.offsetHeight||400;c=o>=0?o:-(1-1/(-o*.55/E+1))*E,g.timeStamp>k.at&&(d=.8*((_.clientY-k.y)/(g.timeStamp-k.at))+.2*d),k={y:_.clientY,at:g.timeStamp},e.style.transition=S.scrim.style.transition="none",e.style.transform=`translateY(${c}px)`;let $=Math.min(1,Math.max(0,c/Math.max(100,innerHeight-(e.getBoundingClientRect().top-c))));S.scrim.style.opacity=String(1-$),S.bar.style.transition="none",S.host.style.setProperty("--lab-p",String($))};e.addEventListener("touchmove",v,{passive:!1}),S.scrim.addEventListener("touchmove",v,{passive:!1});let x=g=>{if(b!==(g.currentTarget===S.scrim))return;let _=u;if(u=null,_==="drag"&&(S.S.sheetDraggedAt=performance.now()),_!=="drag")return;r=performance.now(),g.timeStamp-k.at>80&&(d=0);let E=e.offsetHeight||innerHeight,$=()=>{e.style.transition=`transform 380ms ${kt}, height 380ms ${kt}`,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(a&&!e.classList.contains("full")&&(o<-40||d<-.4))return e.classList.add("full"),e.classList.contains("card")&&(S.S.cardFull=!0),$();if(a&&e.classList.contains("full")&&d<1.2&&(o>60||d>.4))return e.classList.remove("full"),e.classList.contains("card")&&(S.S.cardFull=!1),$();let T=c+Math.max(0,d)*499;if(S.S.dbg?.(`let go: moved ${Math.round(c)} speed ${d.toFixed(2)} rest ${Math.round(T)} of half ${Math.round(E/2)} \u2192 ${d>-.1&&T>E/2?"close":"stay"}`),d>-.1&&T>E/2)return Xt(e,n,Math.min(320,Math.max(140,(innerHeight-e.getBoundingClientRect().top)/Math.max(d,1.2))));e.style.transition=`transform 380ms ${kt}`,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",x),S.scrim.addEventListener("touchend",x),S.scrim.addEventListener("touchcancel",x),e.addEventListener("touchcancel",x)}function Eo(){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 a="",o=()=>{let s=Math.abs(S.vv.scale-1)>.01,r=e.getBoundingClientRect(),p=S.root.activeElement||document.activeElement,i=/^(textarea|input|select)$/.test(p?.localName||"")||!!p?.isContentEditable,c=s||!i?0:S.vv.offsetTop,d=(c?c+r.top:0)+S.vv.height,k=s?0:Math.max(0,Math.round(r.bottom-d)),u=s?0:Math.max(0,Math.round(d-r.bottom)),m=s?0:Math.round(S.vv.height),b=S.host.hasAttribute("data-sheet"),h=`${k} ${m} ${u} ${b} ${scrollY} ${Math.round(c)}`;if(h===a){let E=b?S.openSheet():null;E?.offsetHeight&&!E.style.transform&&Object.assign(o,{sheet:E,top:E.offsetTop});return}a=h,S.host.style.setProperty("--lab-kb",`${k}px`),S.host.style.setProperty("--lab-top",`${Math.round(c)}px`),m?S.host.style.setProperty("--lab-vh",`${m}px`):S.host.style.removeProperty("--lab-vh"),S.host.toggleAttribute("data-kb",k>60),n.style.display=b&&u?"block":"none",n.style.top=`${Math.round(scrollY+r.bottom)}px`,n.style.height=`${u}px`;let v=b?S.openSheet():null,x=Math.abs((o.vh||m)-m)>60||o.kbUp!==k>60,g=v&&v===o.sheet&&x&&!v.style.transform&&!S.still.matches;g&&(v.style.transition="none",v.offsetHeight);let _=v?v.offsetTop:null;g&&Math.abs(o.top-_)<=8&&(v.style.transition=""),g&&Math.abs(o.top-_)>8&&(v.style.transform=`translateY(${o.top-_}px)`,v.offsetHeight,v.style.transition=`transform 340ms ${kt}`,v.style.transform="",clearTimeout(o.done),o.done=setTimeout(()=>!v.style.transform&&(v.style.transition=""),360)),Object.assign(o,{vh:m,kbUp:k>60},v?.offsetHeight?{sheet:v,top:_}:{sheet:null}),k>60&&(S.S.kbSeen=k)};if(S.S.refit=o,S.root.addEventListener("focusin",()=>setTimeout(o,50)),S.root.addEventListener("focusout",()=>setTimeout(o,50)),S.vv.addEventListener("resize",o),S.vv.addEventListener("scroll",o),addEventListener("pointerdown",s=>yn={x:s.clientX,y:s.clientY,at:performance.now()},{capture:!0,passive:!0}),o(),globalThis.__LAB_DEBUG__!==!1&&/[?&]kbdebug\b/.test(location.search)){let s=[],r=performance.now(),p=0,i=k=>{let u=S.openSheet(),m=u?.getBoundingClientRect();s.push(`${Math.round(performance.now()-r)} ${k} h${Math.round(S.vv.height)} top${Math.round(S.vv.offsetTop)} in${innerHeight} kb${S.host.hasAttribute("data-kb")?1:0}`+(m?` sheet${Math.round(m.top)}/${Math.round(m.height)}${u.getAnimations().length?" anim":""}`:"")+` [${[...document.getAnimations(),...S.root.getAnimations()].map(b=>b.animationName||b.transitionProperty||"js").slice(0,6).join(",")}] scrim${getComputedStyle(S.scrim).opacity.slice(0,4)} scroll${Math.round(scrollY)}`)},c=k=>{i(k);let u=performance.now()+1500,m="",b=()=>{let h=s.length;i("f");let v=s[s.length-1].replace(/^\d+ f /,"");v===m&&(s.length=h),m=v,performance.now()<u&&requestAnimationFrame(b)};requestAnimationFrame(b)};S.root.addEventListener("focusin",()=>(r=performance.now(),c("focus")));let d=()=>{clearTimeout(p),p=setTimeout(async()=>{let k=s.join(`
|
|
10
|
-
`);s=[];for(let u=0;u<k.length;u+=1900)await S.send({name:"kb-log",text:k.slice(u,u+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"),r=performance.now(),c("blur"),d()}),S.S.dbg=k=>{s.push(`${Math.round(performance.now()-r)} ${k}`),d()},S.vv.addEventListener("resize",()=>{c("resize"),s.length>1&&d()})}}}var f;function $o(e){f=e}var nt=(e,n=!1)=>{f.S.stepping=!!f.S.openId,f.S.keepKeys=f.S.stepping&&(n||f.root.activeElement?.localName==="textarea"),f.S.openId=e.id,f.S.draft=null,f.coarse&&(f.S.listOpen=!1),f.render();let a=f.position(e.anchor||{}).top,o=a-Math.max(40,f.coarse&&f.S.openCard?.isConnected?(innerHeight-f.S.openCard.offsetHeight)/2:innerHeight/3);if(!f.coarse&&f.S.openCard?.isConnected){let r=f.S.openCard.getBoundingClientRect().bottom+scrollY-a+28;o=r<=innerHeight-80?a-28-(innerHeight-r)/2:a-40}Zt(o)};function Ye(){let e=f.threads();f.listBtn.hidden=!f.S.on||!f.coarse&&!e.length&&!f.held().length,f.goBtn.hidden=!f.S.on,f.goBtn.firstElementChild||f.goBtn.replaceChildren(f.el("span",{class:"gp"},"go"),f.el("kbd",{"aria-hidden":"true"},[f.KEYS.comment,f.KEYS.go,f.KEYS.zoom,f.KEYS.pointer].join("/"))),f.goFace(),f.goBtn.classList.toggle("on",(f.S.goMode||!!f.S.zoomMode)&&!f.S.cursorMode),f.goBtn.classList.toggle("cursor",f.S.cursorMode),f.goBtn.setAttribute("aria-pressed",String((f.S.goMode||!!f.S.zoomMode)&&!f.S.cursorMode));let n=e.filter(c=>!f.isPage(c)).reduce((c,d)=>c+f.unread(d).length,0);if(f.listBtn.replaceChildren(document.createTextNode(n?`list \xB7 ${n} new`:"list"),f.el("kbd",{"aria-hidden":"true"},"l")),f.newPrev.hidden=f.newNext.hidden=!f.S.on||!e.some(c=>!f.isPage(c)&&f.unread(c).length),!f.LIST_WINDOW){f.newPrev.hidden=f.newNext.hidden=!0,f.listBtn.hidden=!f.S.on,f.listBtn.replaceChildren(f.coarse?"new":f.keyLabel("new",f.KEYS.next),f.el("b",{class:`cnt${n?"":" zero"}`},String(n))),f.listBtn.setAttribute("aria-label",`next new comment, ${n} new`),f.listBtn.setAttribute("aria-keyshortcuts",f.KEYS.next),f.listBtn.title="next new comment: W, or Control-D while typing (Shift for the one before)",f.listBtn.disabled=!n,f.listBtn.classList.toggle("quiet",!n);let c=e.filter(d=>!f.isPage(d)&&(d.resolved||Re(d)[0]==="done")&&!f.unread(d).length).length;f.doneBtn.hidden=!f.S.on,f.doneBtn.disabled=!c&&!f.S.showDone,f.doneBtn.classList.toggle("quiet",f.doneBtn.disabled),f.doneBtn.replaceChildren(f.S.showDone?`hide done \xB7 ${c}`:`show done \xB7 ${c}`,f.el("kbd",{"aria-hidden":"true"},f.KEYS.done)),f.doneBtn.setAttribute("aria-keyshortcuts",f.KEYS.done)}f.placeBar();let a=e.reduce((c,d)=>c+f.unread(d).length,0);(!f.tabTitle.base||!document.title.startsWith("("))&&(f.tabTitle.base=document.title.replace(/^\(\d+\) /,""));let o=a?`(${a}) ${f.tabTitle.base}`:f.tabTitle.base;document.title!==o&&(document.title=o),f.listBtn.classList.toggle("has-new",n>0);let s=f.held().length;if(f.sendBtn.hidden=!s,f.sendBtn.textContent=`send ${s} draft${s===1?"":"s"}`,f.listEl.hidden=!f.S.on||!f.S.listOpen,f.listEl.hidden)return;for(let c of f.listEl.querySelectorAll("[data-f]"))c.classList.toggle("on",c.dataset.f===f.S.filter);let r=e.filter(c=>!f.isPage(c)&&f.unread(c).length).length;f.listEl.querySelector('[data-f="new"]').textContent=r?`new \xB7 ${r}`:"new";for(let c of["work","resolved","mine"])f.$(`[data-f="${c}"]`,f.listEl).hidden=!0;f.holdBtn.hidden=!f.DRAFT_MODE;let p=e.filter(c=>!f.isPage(c)&&(c.resolved||Re(c)[0]==="done")&&!f.unread(c).length).length;if(f.showDoneBtn.hidden=!p,f.showDoneBtn.textContent=f.S.showDone?`hide done \xB7 ${p}`:`show done \xB7 ${p}`,f.holdBtn.classList.toggle("on",f.drafting()),f.S.filter==="work")return f.listEl.querySelector(".items").replaceChildren(...Sa());let i=f.listed().map(c=>{let d=f.el("button",{class:`it${f.S.openId===c.id?" cur":""}`,type:"button"});return d.append(document.createTextNode(`${c.resolved?"\u2713":f.numberOf(c)} ${c.text.replace(/\s+/g," ").slice(0,70)} `),...f.onWhat(c)?[f.el("span",{},`on ${f.onWhat(c)} `)]:[],f.el("span",{},`\xB7 ${c.name}${!c.resolved&&f.isDone(c)?" \xB7 \u2705 done":""}`),...f.unread(c).length?[" ",f.el("span",{class:"tag"},`${f.unread(c).length} new`)]:[]),d.addEventListener("click",()=>nt(c)),d});f.listEl.querySelector(".items").replaceChildren(...i.length?i:[f.el("div",{class:"none"},"nothing here")])}var Re=e=>{let n=[e,...f.repliesOf(e.id)],a=n.filter(r=>!r.session).map(r=>r.createdAt).sort().at(-1)||"",o=n.filter(r=>r.session).sort((r,p)=>r.createdAt.localeCompare(p.createdAt)).at(-1),s=o&&o.createdAt>a;return e.resolved||s&&/^done\b/i.test(o.text)?["done",s?o.createdAt:e.createdAt]:s&&/^on it\b/i.test(o.text)?["now",o.createdAt]:!s&&e.handedAt&&e.handedAt>=a?["now",e.handedAt]:s?[null,""]:["next",a]};function Sa(){let e=new Date().toDateString(),n=[],a=[],o=[];for(let i of f.S.comments.filter(c=>!c.parent)){let[c,d]=Re(i);c==="now"?n.push([i,d]):c==="next"?a.push([i,d]):c==="done"&&new Date(d).toDateString()===e&&o.push([i,d])}let s=([i,c],d)=>{let k=f.el("button",{class:`it${f.S.openId===i.id?" cur":""}`,type:"button"});return k.append(document.createTextNode(`${f.isPage(i)?"chat":i.resolved?"\u2713":f.numberOf(i)} ${i.text.replace(/\s+/g," ").slice(0,70)} `),f.el("span",{},`\xB7 ${d(c)}`)),k.addEventListener("click",()=>f.isPage(i)?(f.S.chatOpen=!0,f.S.listOpen=!1,f.render()):nt(i)),k},r=(i,c,d,k=!1)=>c.length?[f.el("div",{class:"group"},`${i} \xB7 ${c.length}`),...c.sort((u,m)=>(k?-1:1)*u[1].localeCompare(m[1])).map(u=>s(u,d))]:[],p=[...r("Now",n,i=>`on it ${f.ago(i)}`.replace("on it just now","just started")),...r("Next",a,i=>`sent ${f.ago(i)} ago`.replace("just now ago","just now")),...r("Done today",o,i=>new Date(i).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),!0)];return p.length?p:[f.el("div",{class:"none"},"nothing in progress on this page")]}var ot=e=>{let n=f.threads().filter(c=>!f.isPage(c)&&f.unread(c).length);if(!n.length)return;let a=c=>f.position(c.anchor||{}).top;n.sort((c,d)=>a(c)-a(d));let o=f.S.openId&&f.threads().find(c=>c.id===f.S.openId),s=o?a(o):null,r=s==null?-1:n.findIndex(c=>a(c)>s),p=n.findIndex(c=>c.id===f.S.openId),i=p>=0?(p+e+n.length)%n.length:s==null?e>0?0:n.length-1:e>0?r<0?0:r:((r<0?n.length:r)-1+n.length)%n.length;f.S.chatOpen=!1,nt(n[i],!f.coarse)};var M;function Lo(e){M=e}var $n=(e,n)=>{let a=n.cloneNode(!0);a.classList.replace("stamp","stamp-room"),a.setAttribute("aria-hidden","true");for(let s of a.querySelectorAll("[role]"))s.removeAttribute("role");([...e.children].reverse().find(s=>s.classList?.contains("p"))||e).append(a),e.append(n)};function Jt(){let e=new Map(M.S.comments.map(m=>[m.id,m])),n=M.S.comments.filter(m=>M.isPage(m)||m.parent&&M.isPage(e.get(m.parent)||{})).sort((m,b)=>m.createdAt.localeCompare(b.createdAt)).slice(-150);M.S.on&&M.S.chatOpen&&M.chatEl.hidden&&(M.S.newFrom=n.find(M.isNew)?.id||null),M.S.chatOpen||(M.S.newFrom=null),M.S.on&&M.S.chatOpen&&M.markSeen(n.filter(M.isNew));let a=n.filter(M.isNew).length;M.chatBtn.hidden=!M.S.on;{let m=M.chatBtn.querySelector(".mark");for(;M.chatBtn.lastChild&&M.chatBtn.lastChild!==m;)M.chatBtn.lastChild.remove();M.chatBtn.append(M.coarse?"chat":M.keyLabel("chat",M.KEYS.chat),M.el("b",{class:`cnt${a?"":" zero"}`},String(a))),M.chatBtn.setAttribute("aria-label",`chat, ${a} new`),M.chatBtn.setAttribute("aria-keyshortcuts",M.KEYS.chat)}M.chatBtn.classList.toggle("has-new",a>0),M.placeBar();let o=M.chatEl.hidden;if(M.chatEl.hidden=!M.S.on||!M.S.chatOpen,M.chatEl.hidden&&M.chatEl.classList.remove("full"),M.chatEl.hidden&&M.chatEl.contains(M.root.activeElement)&&M.root.activeElement.blur(),M.chatEl.hidden)return;let s=M.$(".msgs",M.chatEl),r=o||s.scrollHeight-s.scrollTop-s.clientHeight<48,p=new Set(o?[]:[...s.children].map(m=>m.dataset.id)),i=new Map([...s.children].filter(m=>m.dataset.id).map(m=>[m.dataset.id,m])),c=m=>{let b=i.get(m.dataset?.id);return b&&b.outerHTML.replace(" fresh","")===m.outerHTML?b:m};M.patchKids(s,n.flatMap(m=>{let b=m.parent?e.get(m.parent):m,h=M.el("div",{class:`msg${M.mine(m)&&!m.session?" mine":""}${b&&M.S.replyTo===b.id?" to":""}${p.size&&!p.has(m.id)?" fresh":""}`,"data-id":m.id,...M.agentOf(m)?{"data-agent":M.agentOf(m)}:{}});if(h.append(M.nameLine(m.name,!1)),m.parent&&b){let v=M.el("div",{class:"quote"});v.append(M.el("b",{},String(b.name||"").replace(/\s*·\s*session\s+\S+$/i,"")),document.createTextNode(b.text.replace(/\s+/g," ").slice(0,90))),v.addEventListener("click",x=>{x.stopPropagation();let g=M.$(".msgs",M.chatEl),_=M.$(`[data-id="${b.id}"]`,g);_&&(g.scrollTo({top:_.offsetTop-g.offsetTop-12,behavior:M.still.matches?"auto":"smooth"}),_.animate?.([{boxShadow:"0 0 0 2px rgb(52,199,89)"},{boxShadow:"0 0 0 0 transparent"}],{duration:900}))}),h.append(v)}return h.append(...M.readable(m.text)),$n(h,M.stampOf(m,b)),m.id===M.S.newFrom&&m!==n[0]?[M.el("div",{class:"newline"},"new"),h]:[h]}).map(c));let d=M.$(".replying",M.chatEl),k=M.S.replyTo&&e.get(M.S.replyTo);if(d.hidden=!k,k){let m=M.el("button",{type:"button",title:"about the page instead"},"\u2715");m.addEventListener("click",()=>(M.S.replyTo=null,Jt())),d.replaceChildren(document.createTextNode(`\u21A9 ${k.name}: ${k.text.replace(/\s+/g," ").slice(0,40)}`),m)}s.firstChild||s.append(M.el("div",{class:"none"},"say something about the page as a whole"));let u=M.chatEl.querySelector(".chat");u.firstChild||u.append(M.composer({placeholder:"message",draftKey:`lab-typing:${M.S.page}:chat`,onSubmit:async(m,b)=>{let{comment:h}=await M.send(M.S.replyTo?{name:m,text:b,parent:M.S.replyTo}:{name:m,text:b,anchor:{kind:"page",width:innerWidth,height:innerHeight,dpr:devicePixelRatio||1}}),v=M.S.replyTo&&M.S.comments.find(x=>x.id===M.S.replyTo);return v?.resolved&&(v.resolved=!1),M.S.replyTo=null,M.S.comments.push(h),M.markSeen([h]),s.scrollTop=s.scrollHeight,M.render(),{keep:!0}}})),u.querySelector("textarea").placeholder=k?"reply":"message",r&&(s.scrollTop=s.scrollHeight)}var C;function _o(e){C=e}function Ln(e,n,a){C.layer.append(e);let o=e.offsetWidth,s=scrollX+document.documentElement.clientWidth-o-12;e.style.left=`${Math.max(scrollX+12,Math.min(n-14,s))}px`;let r=e.offsetHeight,p=a+10+r>C.contentEnd();e.style.top=`${p?Math.max(scrollY+8,a-40-r):a+10}px`,e.style.transformOrigin=p?"14px 100%":""}function Co(e,n,a){C.layer.append(e);let o=e.offsetWidth,s=scrollX+document.documentElement.clientWidth-12,r=e.offsetHeight,p=C.contentEnd();n+36+o<=s?(e.style.left=`${n+36}px`,e.style.top=`${Math.min(a-37,p-r-8)}px`):(e.style.left=`${Math.max(scrollX+12,Math.min(n-14,s-o))}px`,e.style.top=`${a+10+r>p?Math.max(scrollY+8,a-40-r):a+10}px`)}function Mo(e,n){e.addEventListener("pointerdown",a=>{if(a.button!==0)return;let o=e.getBoundingClientRect(),s={dx:a.clientX-o.left,dy:a.clientY-o.bottom},r={x:a.clientX,y:a.clientY,sx:scrollX,sy:scrollY,left:parseFloat(e.style.left),top:parseFloat(e.style.top)},p=!1,i=a;C.S.grabbing=!0,e.setPointerCapture(a.pointerId);let c=()=>{e.style.left=`${r.left+i.clientX-r.x+scrollX-r.sx}px`,e.style.top=`${r.top+i.clientY-r.y+scrollY-r.sy}px`},d=m=>{i=m,!(!p&&Math.hypot(m.clientX-r.x,m.clientY-r.y)<5)&&(p=!0,e.classList.add("dragging"),c())},k=()=>p&&c();addEventListener("scroll",k,!0),C.S.dropDrag=()=>{removeEventListener("scroll",k,!0),C.S.dropDrag=null};let u=async m=>{if(e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",u),e.removeEventListener("lostpointercapture",u),C.S.dropDrag?.(),!C.S.grabbing||(C.S.grabbing=!1,!p))return;e.dataset.dragged="1",setTimeout(()=>delete e.dataset.dragged,0);let b=m.clientX-s.dx,h=m.clientY-s.dy,v=document.elementsFromPoint(b,h).find(g=>g!==C.host);if(m.type==="pointercancel"||b<0||h<0||b>innerWidth||h>innerHeight||v?.closest(C.OFF))return C.render();let x=n.anchor;n.anchor={...C.anchorAt(b,h),...x?.zoom?{zoom:x.zoom}:{}},C.render();try{let{comment:g}=await C.send({action:"move",id:n.id,anchor:n.anchor,edit:C.store.get(`lab-edit:${n.id}`)||void 0});Object.assign(n,g)}catch{n.anchor=x,C.render()}};e.addEventListener("pointermove",d),e.addEventListener("pointerup",u),e.addEventListener("pointercancel",u),e.addEventListener("lostpointercapture",u)})}function To(e,n=new Set,a=!1){let o=C.el("div",{class:"card"}),s=C.el("div",{class:"body"}),r=C.el("div",{class:"foot"});o.append(C.el("div",{class:"handle"}),s,r),o.addEventListener("click",x=>x.stopPropagation()),s.classList.add("msgs");let p=!0;s.addEventListener("scroll",()=>p=s.scrollHeight-s.scrollTop-s.clientHeight<48,{passive:!0}),"ResizeObserver"in window&&new ResizeObserver(()=>p&&(s.scrollTop=s.scrollHeight)).observe(s),r.addEventListener("focusin",x=>{x.target.localName==="textarea"&&(p=!0,s.scrollTop=s.scrollHeight)});let i='<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 1.5l1.7 4.8L14.5 8l-4.8 1.7L8 14.5l-1.7-4.8L1.5 8l4.8-1.7z"/></svg>',c=x=>{let g=[e,...C.repliesOf(e.id)],_=g.slice(g.indexOf(x)+1).find(T=>T.session);if(!_?.suggest||_.suggestDone||_.rule)return null;let E=C.el("button",{class:"btn offer",type:"button",title:_.suggest});E.append(C.el("span",{class:"tm"},"rule?"));let $=C.el("span",{class:"tick"});return $.innerHTML=i,E.append($),E.addEventListener("click",async()=>{if(!(await fetch("/_lab/rule",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({page:C.S.page,id:_.id,action:"keep"})}).catch(()=>null))?.ok)return void(E.lastChild.textContent="failed, try again");_.suggestDone="kept",_.rule=_.suggest;for(let O of o.querySelectorAll(`.msg[data-id="${x.id}"] .offering`))O.classList.remove("offering");o.querySelectorAll(`.msg[data-id="${x.id}"] .offer`).forEach(O=>O.remove()),o.querySelector(`.msg[data-id="${_.id}"]`)?.append(d(_))}),E},d=x=>{let g=C.el("span",{class:"rule"});if(x.ruleUndone)return g.append(C.el("b",{},"rule removed")),g;let _=C.el("button",{class:"btn",type:"button"},"undo");return _.addEventListener("click",async()=>{if(!(await fetch("/_lab/rule",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({page:C.S.page,id:x.id})}).catch(()=>null))?.ok)return void(_.textContent="failed, try again");x.ruleUndone=!0,g.replaceWith(d(x))}),g.append(C.el("b",{},"rule"),document.createTextNode(x.rule),_),g},k=x=>{let g=C.el("div",{class:`item msg${C.mine(x)&&!x.session?" mine":""}`,"data-id":x.id,...C.agentOf(x)?{"data-agent":C.agentOf(x)}:{}});g.append(C.nameLine(x.name,!1));let _=x.to&&C.repliesOf(e.id).find(T=>T.id===x.to);if(_){let T=C.el("span",{class:"quote"});T.append(C.el("b",{},String(_.name||"").replace(/\s*·\s*session\s+\S+$/i,"")),document.createTextNode(_.text.replace(/\s+/g," ").slice(0,90))),T.addEventListener("click",()=>o.querySelector(`.msg[data-id="${_.id}"]`)?.scrollIntoView({block:"center",behavior:C.still.matches?"auto":"smooth"})),g.append(T)}g.append(...C.readable(x.text)),x.session&&x.rule&&g.append(d(x));let E=C.stampOf(x,e,x===e&&!e.resolved?`#${C.numberOf(e)} \xB7 `:""),$=!x.session&&c(x);return $&&(E.classList.add("offering"),E.prepend($)),C.stamped(g,E),g},u=new Set,m=[e,...C.repliesOf(e.id)],b=m.find(x=>n.has(x.id));for(let x of m)x===b&&x!==e&&s.append(C.el("div",{class:"newline"},"new")),s.append(k(x)),u.add(x.id);o.sync=()=>{let x=s.scrollHeight-s.scrollTop-s.clientHeight<48;for(let g of C.repliesOf(e.id)){if(u.has(g.id))continue;let _=o.querySelectorAll(".item"),E=k(g);E.classList.add("fresh"),_[_.length-1].after(E),u.add(g.id),C.markSeen([g])}x&&(s.scrollTop=s.scrollHeight)};let h=C.store.get(`lab-edit:${e.id}`),v=null;if(C.S.isAdmin||h){v=C.el("div",{class:"row acts"});let x=C.el("button",{class:"btn",type:"button"},e.resolved?"reopen":"resolve"),g=O=>O.textContent="failed, try again";x.addEventListener("click",async()=>{try{let O=!e.resolved,{comment:I}=await C.send({action:e.resolved?"reopen":"resolve",id:e.id,...h?{edit:h}:{}});if(Object.assign(e,I),O&&C.S.openId===e.id)return C.S.closeFast=!0,C.S.openId=null,C.render();C.render()}catch{g(x)}});let _=C.el("button",{class:"btn",type:"button"},"delete"),E=C.el("button",{class:"btn danger",type:"button"},"delete"),$=C.el("button",{class:"btn",type:"button"},"cancel"),T=()=>{v.replaceChildren(x,_),_.focus()};_.addEventListener("click",()=>{v.replaceChildren(C.el("span",{class:"ask"},C.repliesOf(e.id).length?"delete thread?":"delete comment?"),E,$),$.focus()}),$.addEventListener("click",T),v.addEventListener("keydown",O=>{O.key==="Escape"&&E.isConnected&&(O.stopPropagation(),T())}),E.addEventListener("click",async()=>{try{await C.send({action:"delete",id:e.id})}catch{return g(E)}C.S.comments=C.S.comments.filter(O=>O.id!==e.id&&O.parent!==e.id),C.S.openId=null,C.render()}),v.append(...C.S.isAdmin?[x,_]:[x]),s.append(v)}if(C.coarse){let x=$=>C.position($.anchor||{}).top,g=x(e),_=C.threads().filter($=>!C.isPage($)&&$.id!==e.id&&C.unread($).length).map($=>[$,x($)]);_.sort(($,T)=>($[1]>g?0:1)-(T[1]>g?0:1)||$[1]-T[1]);let E=C.el("div",{class:"row nav"});if(_.length){let $=C.el("button",{class:"btn",type:"button"},`new \xB7 ${_.length} \u203A`);$.addEventListener("pointerdown",T=>T.preventDefault()),$.addEventListener("click",()=>C.goTo(_[0][0])),E.append($)}v&&E.append(v),E.firstChild&&o.insertBefore(E,s)}return r.append(C.composer({placeholder:"reply",autofocus:a,draftKey:`lab-typing:${C.S.page}:${e.id}`,onSubmit:async(x,g)=>{let{comment:_}=await C.send({name:x,text:g,parent:e.id});if(C.S.comments.push(_),C.markSeen([_]),e.resolved){e.resolved=!1,C.render();let T=C.S.openCard?.querySelector(".body");return T&&(T.scrollTop=T.scrollHeight),C.S.openCard?.querySelector("textarea")?.focus({preventScroll:!0}),{keep:!0}}u.add(_.id);let E=o.querySelectorAll(".item"),$=k(_);return $.classList.add("fresh"),E[E.length-1].after($),s.scrollTop=s.scrollHeight,{keep:!0}}})),o}var q;function Ao(e){q=e}function zo(){if(q.script?.dataset.live){let Xe=function(y){{if(y.widget&&q.script.dataset.widget&&y.widget!==q.script.dataset.widget||(y.lab&&q.script.dataset.lab&&y.lab!==q.script.dataset.lab&&(q.script.dataset.lab=y.lab,q.script.dataset.version=String(y.files),h=y.hot,m=y.comments,H(),q.load()),String(y.files)!==q.script.dataset.version))return r();h!==null&&y.hot!==h&&(y.hot-h>1?se([{kind:"html"},{kind:"css",path:""}]):se(y.hotFiles||[])),h=y.hot,m!==null&&y.comments!==m&&q.loadChanges(m),m=y.comments,y.reads!==b&&(b=y.reads,q.syncReads());let A=y.session,P=A?y.mode||"listening":"away",W=ce=>Object.assign(document.createElement("span"),{textContent:ce}),N=A?.model?`${A.agent||"Claude"} \xB7 ${A.model}`:A?.agent||"Claude",K=A&&A.name!==(A.agent||"Claude")?[W(`(${A.name})`)]:[];P==="listening"?c.replaceChildren(W("talking to"),N,...K):P==="working"?c.replaceChildren(N,W("is working"),...K):c.replaceChildren(W("no agent listening")),p.classList.toggle("idle",P==="away"),p.classList.toggle("working",P==="working"),q.listBtn.dataset.agent=P,q.chatBtn.dataset.agent=P,q.coarse&&!q.chatBtn.querySelector(".mark")&&q.chatBtn.insertAdjacentHTML("afterbegin",i),q.coarse&&(q.chatBtn.title=p.textContent),p.setAttribute("aria-label",p.textContent),A?.url&&P!=="away"?Object.assign(p,{href:A.url,target:"_blank"}):p.removeAttribute("href"),p.title=P==="away"?"Ask your agent to run: npx @leonidstern/labit wait":A?.resume||"",p.hidden=!1}},e="lab-scroll:"+location.pathname;try{let y=JSON.parse(sessionStorage.getItem(e)||"null");y!==null&&(sessionStorage.removeItem(e),y.open&&(q.S.openId=y.open),y.list&&(q.S.listOpen=!0,q.S.filter=["new","open","resolved","mine"].includes(y.filter)?y.filter:q.S.filter),y.chat&&(q.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 a=()=>q.S.draft||q.S.grabbing||q.S.openId||q.S.chatOpen||q.S.listOpen||q.coarse&&/^(textarea|input)$/.test(q.root.activeElement?.localName||"")||[...q.root.querySelectorAll("textarea")].some(y=>y.value.trim())||performance.now()-n<1500,o=!1,s=0,r=()=>{if(document.hidden)return void(o=!0);if(a()){s||(s=setTimeout(()=>(s=0,r()),500));return}try{sessionStorage.setItem(e,JSON.stringify({y:scrollY,open:q.S.openId,list:q.S.listOpen,filter:q.S.filter,chat:q.S.chatOpen}))}catch{}location.reload()},p=document.createElement("a");p.className="listener";let i='<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>';p.innerHTML=i+'<div class="lbl"></div>';let c=p.querySelector(".lbl");p.hidden=!0,q.root.querySelector(".left").prepend(p),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 d=null,k=0,u=y=>{c.replaceChildren(Object.assign(document.createElement("span"),{textContent:y})),p.setAttribute("aria-label",y),p.classList.add("idle"),p.classList.remove("working"),p.hidden=!1},m=null,b=null,h=null,v=y=>{let A=[...document.querySelectorAll('link[rel~="stylesheet"][href]:not([data-lab-swap])')].filter(W=>new URL(W.href,location.href).origin===location.origin),P=A.filter(W=>y.includes(decodeURIComponent(new URL(W.href,location.href).pathname)));for(let W of P.length?P:A){let N=new URL(W.href,location.href);N.searchParams.set("lab-v",Date.now().toString(36));let K=W.cloneNode();K.href=N.href,K.dataset.labSwap="";let ce=N.pathname;K.addEventListener("load",()=>{for(let j of document.querySelectorAll('link[rel~="stylesheet"][href]'))j!==K&&new URL(j.href,location.href).pathname===ce&&j.remove();delete K.dataset.labSwap},{once:!0}),K.addEventListener("error",()=>K.remove(),{once:!0}),W.after(K)}},x=y=>{let A=new URL(y,location.href);return A.searchParams.set("lab-v",Date.now().toString(36)),A.href},g=(y,A)=>{try{let P=new URL(y,location.href);return P.origin===location.origin&&A.includes(decodeURIComponent(P.pathname))}catch{return!1}},_=y=>{let A=0;for(let P of document.querySelectorAll('img, source, video[poster], image, use, link[rel~="icon"]')){if(q.host.contains(P))continue;for(let N of["src","href","poster","xlink:href"]){let K=P.getAttribute(N);if(!K||!g(K.split("#")[0],y))continue;let ce=x(K.split("#")[0]),j=new Image;j.src=ce,(j.decode?j.decode():Promise.resolve()).catch(()=>{}).finally(()=>P.setAttribute(N,ce+(K.includes("#")?K.slice(K.indexOf("#")):""))),A++}let W=P.getAttribute("srcset");W&&W.split(",").some(N=>g(N.trim().split(/\s+/)[0],y))&&(P.setAttribute("srcset",W.split(",").map(N=>{let[K,...ce]=N.trim().split(/\s+/);return[g(K,y)?x(K):K,...ce].join(" ")}).join(", ")),A++)}A||v([])},E=y=>{for(let A of document.styleSheets){let P;try{P=A.cssRules}catch{continue}for(let W of P||[]){if(!(W instanceof CSSFontFaceRule))continue;let N=W.style.getPropertyValue("src"),K=A.href||location.href;if(!/url\(/.test(N)||![...N.matchAll(/url\(["']?([^"')]+)/g)].some(te=>g(new URL(te[1],K).href,y)))continue;let ce=N.replace(/url\(["']?([^"')]+)["']?\)/g,(te,G)=>g(new URL(G,K).href,y)?`url("${x(new URL(G,K).href)}")`:te),j=te=>W.style.getPropertyValue(te)||void 0;try{new FontFace(j("font-family").replace(/^["']|["']$/g,""),ce,{weight:j("font-weight"),style:j("font-style"),stretch:j("font-stretch"),unicodeRange:j("unicode-range"),display:j("font-display")}).load().then(G=>document.fonts.add(G)).catch(()=>{})}catch{}}}},$=()=>new Set([q.fonts,q.pinCursorStyle]),T=y=>[...y.querySelectorAll("script")].filter(A=>!/\/_lab\/comments\.js/.test(A.getAttribute("src")||"")).map(A=>A.getAttribute("src")||A.textContent),O=y=>[...y.querySelectorAll('link[rel~="stylesheet"]')].map(A=>{try{return new URL(A.getAttribute("href"),location.href).pathname}catch{return""}}),I=y=>y===q.host||y.nodeType===1&&y.localName==="script",Q=(y,A)=>y.nodeType===A.nodeType&&y.nodeName===A.nodeName&&(y.nodeType!==1||(y.id||"")===(A.id||"")),D=(y,A)=>Q(y,A)&&(y.nodeType===1?!!y.id||y.getAttribute("class")===A.getAttribute("class"):y.nodeType!==3||y.data===A.data),B=(y,A)=>{let P=[...y.childNodes].filter(j=>!I(j)),W=[...A.childNodes].filter(j=>!(j.nodeType===1&&j.localName==="script")),N=0,K=null,ce=j=>{let te=document.importNode(j,!0);return y.insertBefore(te,K?K.nextSibling:P[N]||y.firstChild),te};W.forEach((j,te)=>{let G=P[N];if(!G)return void(K=ce(j));if(D(G,j))return K=F(G,j),void N++;if(W.slice(te+1,te+8).some(ie=>D(G,ie)))return void(K=ce(j));let me=P.slice(N+1,N+8).findIndex(ie=>D(ie,j));if(me>=0){for(let ie of P.slice(N,N+1+me))ie.remove();return N+=me+1,K=F(P[N],j),void N++}K=F(G,j),N++});for(let j of P.slice(N))j.remove()},F=(y,A)=>{if(y.nodeType!==A.nodeType||y.nodeName!==A.nodeName||y.nodeType===1&&(y.id||"")!==(A.id||"")){let P=document.importNode(A,!0);return y.replaceWith(P),P}if(y.nodeType===3||y.nodeType===8)return y.data!==A.data&&(y.data=A.data),y;if(y.nodeType!==1)return y;for(let{name:P}of Array.from(y.attributes))!A.hasAttribute(P)&&!(P==="open"&&/^(details|dialog)$/.test(y.localName))&&y.removeAttribute(P);for(let{name:P,value:W}of Array.from(A.attributes))y.getAttribute(P)!==W&&y.setAttribute(P,W);return y===document.activeElement||y.shadowRoot||/^(iframe|canvas|video|audio|textarea|select|input)$/.test(y.localName)||B(y,A),y},J=()=>T(document).length>0,oe=0,H=async()=>{if(J())return r();let y=++oe;try{let A=await fetch(location.href,{cache:"no-store",headers:{accept:"text/html"}});if(!A.ok)return r();let P=await A.text();if(y!==oe)return;let W=new DOMParser().parseFromString(P,"text/html");if(T(W).join(`
|
|
11
|
-
`)!==
|
|
5
|
+
`,C.length);y.line=X(O.slice(P,F<0?void 0:F).trim(),200),y.lineNo=C.split(`
|
|
6
|
+
`).length,y.lines=O.replace(/\n$/,"").split(`
|
|
7
|
+
`).length}let J=o.parentElement?.closest("tr, [data-line], [data-line-number]");if(J){let P=J.matches("[data-line], [data-line-number]")?J:J.querySelector("[data-line], [data-line-number]"),F=P?.getAttribute("data-line")||P?.getAttribute("data-line-number")||[...J.children].map(V=>V.textContent.trim()).find(V=>/^\d+$/.test(V));F&&/^\d+$/.test(F)&&(y.pageLineNo=Number(F))}let q=S.closest("[data-file]")?.getAttribute("data-file")||S.getAttribute("title")||S.getAttribute("aria-label")||"";for(let P=S.parentElement,F=0;!q.trim()&&P&&P!==document.body&&F<3;P=P.parentElement,F++)q=P.querySelector(':scope > figcaption, :scope > [class*="title" i]')?.textContent||"";q.trim()&&(y.label=X(q.trim(),120))}return y}function tt(e){let n=[...e.attributes].filter(a=>/^(id|class|alt|role|aria-label|href|data-[\w-]+)$/.test(a.name)).map(a=>[a.name,a.name==="class"?a.value.split(/\s+/).filter(o=>o&&!wt(o)).join(" "):a.name==="id"&&wt(a.value)?"":a.value]).filter(([a,o])=>o||!/^(id|class)$/.test(a)).map(([a,o])=>`${a}="${X(o,60)}"`);return`<${e.localName}${n.length?` ${n.join(" ")}`:""}>`.slice(0,200)}function oo(e,n){if(!n)return!0;let a=/^<([\w-]+)/.exec(n)?.[1];if(e.localName!==a)return!1;let o=p=>wt(p)?"":p||"",s=/ id="([^"]*)"/.exec(n)?.[1];if(o(s)!==o(X(e.id||"",60)))return!1;let l=(/ class="([^"]*)"/.exec(n)?.[1]||"").split(/\s+/).filter(p=>p&&p!=="\u2026"&&!p.endsWith("\u2026")&&!wt(p));return!l.length||l.some(p=>e.classList.contains(p))}function je(e,n){let a=document.elementsFromPoint(e,n).filter(h=>h!==le&&h!==document.documentElement),o=[],s=null;for(let h=a[0];h?.shadowRoot&&!le.contains(h)&&o.length<5;h=a[0]){s||=h,o.push(h.shadowRoot);let k=h.shadowRoot.elementsFromPoint(e,n).filter(y=>y!==h);if(!k.length)break;a=[...k,...a]}let l=a[0]?.closest("[data-comment-target]")||a[0]||document.body,p=l.getBoundingClientRect(),r={selector:po(l),x:p.width?(e-p.left)/p.width:0,y:p.height?(n-p.top)/p.height:0,docX:(e+scrollX)/xt(),docY:n+scrollY,width:innerWidth,height:innerHeight,dpr:Math.round((devicePixelRatio||1)*100)/100,element:tt(l),eh:Math.round(p.height)},i=X(l.textContent,200);i&&l!==document.body&&(l.textContent||"").length<400&&(r.text=X(i,80));let d=l.parentElement?.closest("[id], [data-lab]");d&&(r.inside=d.dataset.lab?`[data-lab="${d.dataset.lab}"]`:`#${d.id}`);let w=null;for(let h of document.querySelectorAll("h1, h2, h3"))(h.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_FOLLOWING||h.contains(l))&&(w=h);w&&(r.section=X(w.textContent,100)),s&&(r.shadow=tt(s));for(let[h,k]of Object.entries(uo(l)))k&&(r[h]=X(k,200));l!==document.body&&(r.looks=mo(l));let u=l.closest?.("select");u&&u.selectedIndex>=0&&(r.chosen=X(`${u.selectedIndex+1} of ${u.options.length}: "${u.options[u.selectedIndex].text}"`,120));for(let h of[l,l.parentElement])if(!(!h||h===document.body)){for(let k of["::before","::after"]){let y=getComputedStyle(h,k).content,f=y&&y.match(/^"(.+)"$/);if(f&&f[1].trim()){r.cssText=X(`"${f[1]}" from ${k} of ${tt(h)}`,160);break}}if(r.cssText)break}let m=document.querySelector('meta[name="lab-build"]')?.content;m&&(r.build=X(m,40));let b=a.slice(0,5).find(h=>/^(img|video|canvas|svg|image)$/.test(h.localName)&&!le.contains(h));if(b?.localName==="image"&&b.namespaceURI==="http://www.w3.org/2000/svg")r.kind="image",r.src=new URL(b.getAttribute("href")||b.getAttribute("xlink:href")||"",location.href).href,r.file=Ke(r.src),ma(b,r,e,n);else if(b){let h=b.getBoundingClientRect();if(r.kind=b.localName==="img"?"image":b.localName,b.localName==="img"||b.localName==="video"){let k=b,y=b;r.src=xn(b),r.file=Ke(r.src),k.alt&&(r.alt=X(k.alt,120));let f=ua(b,e,n),[E,S,L]=f?[f.rect,f.x,f.y]:[h,e,n],C=b.localName==="img"?Wt(b,E,S,L,Ft(b).nw,Ft(b).nh):Wt(b,E,S,L,y.videoWidth,y.videoHeight);if(C&&Object.assign(r,C),f&&(r.transform=X(getComputedStyle(b).transform,80)),b.localName==="img"&&/\.(gif|webp|apng)(\?|#|$)/i.test(k.currentSrc||k.src)){let O=performance.getEntriesByName(k.currentSrc||k.src)[0],B=O?(performance.now()-O.responseEnd)/1e3:performance.now()/1e3;r.shownFor=Math.round(B*10)/10}b.localName==="video"&&(r.time=Math.round(y.currentTime*10)/10,Number.isFinite(y.duration)&&(r.duration=Math.round(y.duration*10)/10),!r.file&&y.poster&&(r.file=Ke(y.poster)))}else r.time=Math.round(performance.now()/100)/10,r.imgX=ze((e-h.left)/(h.width||1)),r.imgY=ze((n-h.top)/(h.height||1)),r.nw=Math.round(h.width),r.nh=Math.round(h.height)}else{let h=ha(e,n,o);if(h)r.kind="text",r.quote=h;else{for(let k=l,y=0;k&&k!==document.documentElement&&y<4;k=k.parentElement,y++){let f=getComputedStyle(k).backgroundImage.match(/url\(["']?(.+?)["']?\)/);if(f){r.kind="background",r.src=new URL(f[1],location.href).href,r.file=Ke(r.src),fa(k,r.src,r,e,n);break}}if(r.kind||="element",r.kind==="element"){let k=ga(l,n);k&&Object.assign(r,{gapAbove:k.above,gapBelow:k.below})}}}Object.assign(r,fo(l));for(let h=l;h&&h!==document.body&&h!==document.documentElement;h=h.parentElement)if(h.id){r.block=h.id;break}return r}function go(e){let n=null;try{n=e.selector?document.querySelector(e.selector):null}catch{}let a=f=>{if(!f)return!1;if(e.file&&/^(image|video)$/.test(e.kind)){let E=f.closest?.("img, video")||f;return Ke(xn(E))===e.file}if(e.element&&!oo(f,e.element))return!1;if(e.quote?.exact){let E=(f.textContent||"").replace(/\s+/g,""),S=e.quote.exact.replace(/\s+/g,"").slice(0,24),L=(e.quote.prefix||"").replace(/\s+/g,"").slice(-10),C=(e.quote.suffix||"").replace(/\s+/g,"").slice(0,10);return E.includes(S)&&(S.length>=16||!L&&!C||E.includes(L+S)||E.includes(S+C))}return!0},o=X(e.text,400),s=f=>{let E=null;for(let S of document.querySelectorAll("h1, h2, h3"))(S.compareDocumentPosition(f)&Node.DOCUMENT_POSITION_FOLLOWING||S.contains(f))&&(E=S);return E?X(E.textContent,100):""},l=f=>String(f||"").replace(/\s+/g,""),p=l(e.zoneText).slice(0,30),r=f=>e.quote?.exact?!0:o?X(f.textContent,400).startsWith(o.slice(0,40)):p?l(f.textContent).includes(p):e.section?s(f)===e.section:!0,i=n&&n!==document.body&&a(n)?n:null;if(i&&r(i))return i;if(e.file&&/^(image|video)$/.test(e.kind))return[...document.querySelectorAll("img, video")].find(f=>Ke(xn(f))===e.file)||null;let d=/^<([\w-]+)/.exec(e.element||"")?.[1];if(!d||d==="body"||d==="html")return i;let w=f=>X(f,400),u=f=>!le.contains(f)&&oo(f,e.element),m=f=>{let E=null,S=-1,L=1/0;for(let C of f){let O=w(C.textContent),B=0;if(e.quote?.exact&&a(C)&&(B+=4),o&&O===o&&(B+=4),p&&l(C.textContent).includes(p)?B+=4:o&&O.startsWith(o.slice(0,40))&&(B+=2),!B&&f.length>1)continue;B&&e.section&&s(C)===e.section&&(B+=2);let J=Math.abs(C.getBoundingClientRect().top+scrollY-(e.docY||0));(B>S||B===S&&J<L)&&([E,S,L]=[C,B,J])}return{found:E,best:S}},b=[];for(let f of[e.inside,e.block&&`#${e.block}`]){let E=f?f.startsWith("#")?document.getElementById(f.slice(1)):(()=>{try{return document.querySelector(f)}catch{return null}})():null;E&&E!==document.body&&!le.contains(E)&&!b.includes(E)&&b.push(E)}b.sort((f,E)=>f.contains(E)?1:E.contains(f)?-1:0);for(let f of b){let{found:E,best:S}=m([f,...f.querySelectorAll(d)].slice(0,400).filter(L=>L.localName===d&&u(L)));if(S>0)return E}let h=[...document.querySelectorAll(d)].slice(0,400).filter(u),{found:k,best:y}=m(h);return y>0||!i?k:h.length>1?null:i}var ba=/\[[^\]]+\]/,Ht=null;function xa(e,n){if(e.quote?.exact){let w=Kt(e,n,!0);return w?ho(w,e,n.getBoundingClientRect())||{gone:!0}:{gone:!0}}let a=/^(?:…)?(.*?)\[([^\]]+)\](.*?)(?:…)?$/s.exec(e.text||"");if(!a)return null;let o=a[1].replace(/\s+/g," ").slice(-24),s=a[2];if(!Ht||performance.now()-Ht.at>400){let w=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:b=>le.contains(b.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),u="",m=[];for(let b=w.nextNode();b;b=w.nextNode()){let h=b.data.replace(/\s+/g," ");for(let k=0;k<h.length;k++)m.push([b,k]);u+=h}Ht={at:performance.now(),text:u,map:m}}let{text:l,map:p}=Ht,r=l.indexOf(o+s);if(r<0)return{gone:!0};r+=o.length;let i=document.createRange();try{i.setStart(...p[r]),i.setEnd(p[r+s.length-1][0],p[r+s.length-1][1]+1)}catch{return{gone:!0}}let d=i.getBoundingClientRect();return d.width||d.height?{left:d.left+scrollX+Math.min(6,d.width/2),top:d.top+scrollY+d.height/2}:{gone:!0}}var yt={at:-1/0,y:0},vt=(e,n=0)=>{if(performance.now()-yt.at>300){let a=[...document.body.children].filter(o=>o!==le&&!le.contains(o)).map(o=>o.getBoundingClientRect().bottom+scrollY);yt={at:performance.now(),y:Math.max(innerHeight,...a)}}return Math.max(0,Math.min(e,yt.y-n-40))},ao=(e,n)=>({left:e.left+(n.pinX?e.width:0),top:e.top+(n.pinY?e.height:0)}),ro=10,ya=30;function va(e){let n=s=>Math.max(ro,Math.round(s.left+scrollX-ya)),a=String(e?.selector||"").split(" > ");for(;a.length>1;){a.pop();let s=null;try{s=document.querySelector(a.join(" > "))}catch{}if(!s||/^(html|body)$/.test(s.localName)||le.contains(s))continue;let l=s.getBoundingClientRect();if(l.width)return n(l)}let o=[...document.body.children].filter(s=>s!==le&&!le.contains(s)).map(s=>s.getBoundingClientRect()).filter(s=>s.width&&s.height);return o.length?n({left:Math.min(...o.map(s=>s.left))}):ro}function Ye(e){let n=wa(e);return n.moved?{...n,left:va(e)}:n}function ho(e,n,a){let o=[...e.getClientRects()].filter(d=>d.width||d.height);if(!o.length)return null;let s=a.left+(n.x||0)*a.width,l=a.top+(n.y||0)*a.height,p=(d,w,u)=>Math.min(Math.max(d,w),u),r=d=>Math.hypot(s-p(s,d.left,d.right),l-p(l,d.top,d.bottom)),i=o[o.length-1];for(let d of o)r(d)<r(i)&&(i=d);return{left:p(s,i.left,i.right)+scrollX,top:p(l,i.top,i.bottom)+scrollY}}function wa(e){let n=go(e),a=e.quote?.exact||ba.test(e.text||""),o=n||(a&&/^<(body|html)[\s>]/.test(e.element||"")?document.body:null),s=o&&!e.zw&&!e.docW&&/^(html|body|main)$/.test(o.localName);if(s&&a){let i=xa(e,o);if(i&&!i.gone)return{left:i.left,top:i.top,zone:null};if(i?.gone)return{left:e.docX*xt(),top:vt(e.docY),zone:null,moved:!0}}if(s&&e.eh&&!a&&Math.abs(n.getBoundingClientRect().height-e.eh)>40)return{left:e.docX*xt(),top:vt(e.docY),zone:null,moved:!0};if(n){let i=n.getBoundingClientRect(),d=e.kind==="text"&&!e.zw&&e.quote?.exact?Kt(e,n):null,w=d&&ho(d,e,i);if(w)return{...w,zone:null};if(i.width||i.height){let u=i.left+scrollX+e.x*i.width,m=e.zw&&Number.isFinite(e.oy)&&e.docH&&i.height>2*e.docH,b=i.top+scrollY+(m?e.oy:e.y*i.height),h=e.zw?{left:u,top:b,width:e.zw*i.width,height:m?e.docH:e.zh*i.height}:null;return h?{...ao(h,e),zone:h}:{left:u,top:b,zone:h}}}let l=e.docX*xt(),p=vt(e.docY,e.docH||0),r=e.docW?{left:l,top:p,width:e.docW,height:e.docH}:null;return r?{...ao(r,e),zone:r,moved:!!e.selector&&e.selector!=="body"}:{left:l,top:p,zone:r,moved:!!e.selector&&e.selector!=="body"}}var so=new WeakMap;function ka(e,n=!1){let a=so.get(e);if(a&&!n&&performance.now()-a.when<400)return a;let o="",s=[],l=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:r=>le.contains(r.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(let r=l.nextNode();r;r=l.nextNode())for(let i=0;i<r.data.length;i++)/\s/.test(r.data[i])||(o+=r.data[i],s.push([r,i]));let p={when:performance.now(),text:o,at:s};return so.set(e,p),p}function Kt(e,n=null,a=!1,o=!1){let s=e?.quote,l=s?.exact?n||go(e):null;if(!l)return null;let p=s.exact.replace(/\s+/g,"");if(!p)return null;let r=(s.prefix||"").replace(/\s+/g,"").slice(-12),i=!1;for(let d=l,w=0;d&&w<4;d=d.parentElement,w++){let{text:u,at:m}=ka(d,o),b=null;for(let h=u.indexOf(p);h!==-1;h=u.indexOf(p,h+1)){let k=document.createRange();try{k.setStart(...m[h]);let[y,f]=m[h+p.length-1];k.setEnd(y,f+1)}catch{}if(k.toString().replace(/\s+/g,"")!==p){i=!0;continue}if(!r||u.slice(0,h).endsWith(r))return k;b||=k}if(b&&!a)return b}return i&&!o?Kt(e,l,a,!0):null}var bo=(e,n)=>{let a=Ae("b",{},String(e||"").replace(/\s*·\s*session\s+\S+$/i,""));return n&&a.append(Ae("span",{class:"mark done",role:"img","aria-label":"done"},"\u2713")),a},yn=!1,kt=()=>yn&&lo.get("lab-hold")==="1",Sa=e=>{let n=document.getElementById(e);return!!n&&!n.closest("[data-lab-comments]")},Ea=e=>{let n=[],a=0;for(let o of e.matchAll(/\bhttps?:\/\/[^\s<>"']*[^\s<>"'.,;:!?)\]]|(?<![\w&/#])#([A-Za-z][\w:.-]*[\w])/g)){if(o[1]&&!Sa(o[1]))continue;o.index>a&&n.push(document.createTextNode(e.slice(a,o.index)));let s=o[1]?Ae("a",{href:`#${o[1]}`,class:"link"},o[0]):Ae("a",{href:o[0],target:"_blank",rel:"noopener noreferrer",class:"link"},o[0]);s.addEventListener("click",l=>{l.stopPropagation(),o[1]&&(l.preventDefault(),dispatchEvent(new CustomEvent("lab-goto",{detail:o[1]})))}),n.push(s),a=o.index+o[0].length}return a<e.length&&n.push(document.createTextNode(e.slice(a))),n},$a=e=>e.split(/(?<=[.!?])\s+(?=["'([]?[A-Z0-9])/),xo=e=>{let n=[];for(let[a,o]of String(e||"").trim().split(/\n\s*\n/).entries()){let s=o.split(`
|
|
8
|
+
`);if(s.length===1&&o.length>240){let l=$a(o);for(let p=0;p<l.length;p+=2)n.push({text:l.slice(p,p+2).join(" "),gap:a>0||p>0});continue}s.forEach((l,p)=>{let r=/^\s*(?:[-•*]|\d+[.)])\s+/.exec(l),i=p>0?n.at(-1):null;r?n.push({li:/\d/.test(r[0])?r[0].trim():"\u2022",text:l.slice(r[0].length),gap:a>0&&p===0}):i&&!i.li?i.text+=`
|
|
9
|
+
${l}`:n.push({text:l,gap:a>0&&p===0||!!i})})}return n.map(a=>{let o=Ae("span",{class:`p${a.li?" li":""}${a.gap?" gap":""}`});return a.li&&o.append(Ae("span",{class:"mk"},a.li)),o.append(...Ea(a.text)),o})},La=typeof Highlight=="function"&&!!CSS.highlights,jt=e=>{if(!La)return;let n=e&&Kt(e);n?CSS.highlights.set("lab-quote",new Highlight(n)):CSS.highlights.delete("lab-quote")},vn=e=>{let n=Ae("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},Yt=(e,n)=>{if(!e)return;let a=vn(n);return Object.assign(a.style,{left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`}),io.append(a),a};function yo({x0:e,y0:n,x1:a,y1:o}){let s=Math.min(e,a),l=Math.min(n,o),p=Math.max(e,a),r=Math.max(n,o),i=je((s+p)/2,(l+r)/2),d=document.elementsFromPoint((s+p)/2,(l+r)/2).find(L=>L!==le&&!le.contains(L)),w=Math.max(1,(p-s)*(r-l)),u=L=>Math.max(0,Math.min(L.right,p)-Math.max(L.left,s))*Math.max(0,Math.min(L.bottom,r)-Math.max(L.top,l))/w>=.8;for(;d&&d!==document.body&&!u(d.getBoundingClientRect());)d=d.parentElement;d||=document.body;let m=d.getBoundingClientRect();Object.assign(i,{selector:d===document.body?"body":po(d),element:tt(d),x:m.width?(s-m.left)/m.width:0,y:m.height?(l-m.top)/m.height:0,zw:m.width?(p-s)/m.width:0,zh:m.height?(r-l)/m.height:0,oy:Math.round(l-m.top),docX:(s+scrollX)/xt(),docY:l+scrollY,docW:Math.round(p-s),docH:Math.round(r-l),pinX:a>=e?1:0,pinY:o>=n?1:0}),Object.assign(i,fo(d)),i.kind==="text"&&(delete i.quote,i.kind="element");let b=d===document.body?"":X(d.textContent,200);b&&(d.textContent||"").length<400?i.text=X(b,80):delete i.text,d!==document.body&&(i.looks=mo(d));let h=[],k=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),y=document.createRange();for(let L=k.nextNode();L&&h.length<80;L=k.nextNode()){if(le.contains(L))continue;let C=L.parentElement?.getBoundingClientRect();if(!(!C||C.bottom<l||C.top>r||C.right<s||C.left>p))for(let O of L.data.matchAll(/\S+/g)){y.setStart(L,O.index),y.setEnd(L,O.index+O[0].length);let B=y.getBoundingClientRect(),J=(B.left+B.right)/2,q=(B.top+B.bottom)/2;B.width&&J>=s&&J<=p&&q>=l&&q<=r&&h.push(O[0])}}let f=X(h.join(" "),300);f&&(i.zoneText=f);let E=[],S=d.querySelectorAll("*");for(let L=0;L<S.length&&L<3e3;L++){let C=S[L];if(le.contains(C)||E.some(B=>B.contains(C)))continue;let O=C.getBoundingClientRect();O.width<8||O.height<8||O.left<s-4||O.right>p+4||O.top<l-4||O.bottom>r+4||E.push(C)}if(E.length&&(i.zoneItems=E.slice(0,5).map(L=>{let C=uo(L),O=X(L.textContent,50);return X([tt(L),O&&`"${O}"`,C.component,C.source&&`written at ${C.source}`,C.usedAt&&`used at ${C.usedAt}`].filter(Boolean).join(" \xB7 "),500)}),E.length>5&&i.zoneItems.push(`and ${E.length-5} more`)),/^(img|video)$/.test(d.localName)){let L=d.localName==="img"?Ft(d).nw:d.videoWidth,C=d.localName==="img"?Ft(d).nh:d.videoHeight,O=Wt(d,m,s,l,L,C),B=Wt(d,m,p,r,L,C);O&&B&&Object.assign(i,{imgX:O.imgX,imgY:O.imgY,imgX2:B.imgX,imgY2:B.imgY})}else(i.kind==="image"||i.kind==="video")&&(delete i.imgX,delete i.imgY,i.kind="element");return i}var _a=()=>window.__lab||null;function Ut(e){let n=_a();n&&(n.writing=Math.max(0,e),n.writing||n.flush())}var St;function vo(e){St=e}var Oe=new Set,Xt=new Set,wo=()=>Oe.size>0,Ca=e=>{e.value.trim()?Oe.add(e):Oe.delete(e),Ut(Oe.size),St?.whileWriting?.()},Ma='<i class="arr" aria-hidden="true"></i>';function wn({placeholder:e,onSubmit:n,autofocus:a=!1,empty:o="",nameFirst:s=!1,draftKey:l=""}){let{el:p,store:r,root:i,refreshPinCursor:d,syncReads:w,rememberMe:u}=St,m=p("div",{class:"composer"}),b=p("div",{class:"box"}),h=p("textarea",{placeholder:e,maxlength:"2000",rows:"1","aria-label":e,enterkeyhint:"send",autocomplete:"off",autocorrect:"off",spellcheck:"false",writingsuggestions:"false"}),k=p("label",{class:"who"}),y=p("span",{},"as"),f=p("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(f.value=r.get("lab-name"),l&&!Xt.has(l)){let H=r.get(l);H&&(h.value=H,queueMicrotask(()=>B()))}let E=()=>{l&&r.set(l,h.value.trim()?h.value:"")},S=()=>{Oe.delete(h),Ut(Oe.size),St?.whileWriting?.(),l&&r.set(l,"")};k.append(y,f);let L=p("button",{class:"send",type:"button","aria-label":"send"});L.addEventListener("pointerdown",H=>H.preventDefault()),L.addEventListener("mousedown",H=>H.preventDefault()),L.innerHTML=Ma;let C=p("div",{class:"error"});b.append(h,p("div",{class:"line"}),k,L),m.append(b,C),b.addEventListener("click",H=>{H.target!==b&&!H.target.classList?.contains("line")||(h.focus({preventScroll:!0}),h.setSelectionRange(h.value.length,h.value.length))});let O=null;for(let H of[h,f])H.addEventListener("touchstart",re=>O={x:re.touches[0].clientX,y:re.touches[0].clientY},{passive:!0}),H.addEventListener("touchend",re=>{let ae=re.changedTouches[0];!O||Math.hypot(ae.clientX-O.x,ae.clientY-O.y)>10||i.activeElement===H||(re.preventDefault(),H.focus({preventScroll:!0}),H.setSelectionRange(H.value.length,H.value.length))},{passive:!1});let B=()=>{let H=s||h.value.length>0||i.activeElement===f||!!C.textContent,re=H!==b.classList.contains("open")&&!r.get("lab-name")&&b.isConnected&&!matchMedia("(prefers-reduced-motion: reduce)").matches,ae=re&&{arrow:L.getBoundingClientRect(),height:b.getBoundingClientRect().height},U=!!r.get("lab-name");if(b.classList.toggle("one",U),b.classList.toggle("open",H),y.hidden=!f.value.trim(),U&&!CSS.supports?.("field-sizing","content")&&(f.style.width=`${Math.max(2,f.value.length+1)}ch`),L.classList.toggle("ready",!!((h.value.trim()||o)&&f.value.trim())),Ca(h),h.style.height="auto",h.style.height=`${h.scrollHeight}px`,re){let xe=L.getBoundingClientRect(),ye={duration:220,easing:"cubic-bezier(.2, .7, .3, 1)"};L.animate([{transform:`translate(${ae.arrow.left-xe.left}px, ${ae.arrow.top-xe.top}px)`},{transform:"none"}],ye),b.style.overflow="hidden",b.animate([{height:`${ae.height}px`},{height:`${b.getBoundingClientRect().height}px`}],ye).onfinish=()=>b.style.overflow=""}},J=!1,q=async()=>{if(J)return;let H=h.value.trim()||o;if(!H)return h.focus();if(!f.value.trim())return b.classList.add("open"),f.focus();r.set("lab-name",f.value.trim()),u(f.value.trim()),d(),w(),L.classList.remove("sent"),L.offsetWidth,L.classList.add("sent"),J=!0;let re=h.value;l&&Xt.add(l),C.textContent="",C.classList.remove("wait");let ae=setTimeout(()=>{C.textContent="sending\u2026 it goes as soon as the lab is back",C.classList.add("wait")},1500);try{let U=await n(f.value.trim(),H);S(),l&&Xt.delete(l),clearTimeout(ae),C.textContent="",C.classList.remove("wait"),U?.keep&&(h.value="",B())}catch(U){clearTimeout(ae),C.classList.remove("wait"),C.textContent=U.message,l&&Xt.delete(l),h.value=re,E(),B()}J=!1},P=H=>{H.key==="Enter"&&!H.shiftKey&&!H.isComposing&&(H.preventDefault(),q())};h.addEventListener("input",B),h.addEventListener("input",E),new MutationObserver(()=>{m.isConnected||(Oe.delete(h),Ut(Oe.size),St?.whileWriting?.())}).observe(document.documentElement,{childList:!0,subtree:!0}),f.addEventListener("input",B),f.addEventListener("blur",()=>setTimeout(B,0)),h.addEventListener("keydown",P),f.addEventListener("keydown",P);let F=0;L.addEventListener("touchend",H=>{H.preventDefault(),F=Date.now(),q()},{passive:!1}),L.addEventListener("click",()=>{Date.now()-F<700||q()}),L.addEventListener("mousedown",H=>H.preventDefault()),requestAnimationFrame(B);let V=s?f:h;s&&f.setAttribute("data-first","");let oe=()=>V.focus({preventScroll:!0});return a&&queueMicrotask(()=>V.isConnected?oe():setTimeout(oe,0)),m}var ko;function So(e){ko=e}var Eo=e=>{let n=e.anchor||{},a=n.quote?.exact||"",o=null;try{o=!a&&n.selector?document.querySelector(n.selector):null}catch{}for(let s=0;o&&o!==document.body&&s<5;o=o.parentElement,s++){let l=o.innerText?.replace(/\s+/g," ").trim()||"";if(l.length>=12){a=l;break}}return a=(a||n.text||n.section||"").replace(/\s+/g," ").trim(),a?`"${a.length>40?`${a.slice(0,39)}\u2026`:a}"`:""},$o=(e,n,a="")=>{let{el:o,mine:s,repliesOf:l,workState:p}=ko,r=new Date(e.createdAt),i=r.toDateString()===new Date().toDateString()?r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):r.toLocaleDateString([],{day:"numeric",month:"short"}),d=o("span",{class:"stamp"});if(d.append(o("span",{class:"tm"},a+i)),s(e)&&!e.session){let w=n?[n,...l(n.id)]:[e],u=!w.some(b=>!b.session&&b.createdAt>e.createdAt),m=w.some(b=>b.session&&b.createdAt>e.createdAt)||!!(n?.resolved&&u);if(!m&&u&&n&&p(n)[0]==="now")d.classList.add("busy"),d.append(o("span",{class:"ring",role:"img","aria-label":"the agent is on it"}));else if(m)d.classList.add("ans"),d.append(o("span",{class:"tick",role:"img","aria-label":"answered"},"\u2713"));else{let b=n?.handedAt&&n.handedAt>=e.createdAt;d.append(o("span",{class:`tick${b?" got":""}`,role:"img","aria-label":b?"delivered to the agent":"sent"},b?"\u2713\u2713":"\u2713"))}}return d};var $;function Lo(e){$=e}var Ta=e=>!!e.closest?.(".handle, .tabs"),Aa=(e,n)=>e.composedPath().find(a=>a instanceof HTMLElement&&n.contains(a)&&(a.localName==="textarea"||/auto|scroll/.test(getComputedStyle(a).overflowY))),Jt="cubic-bezier(.32,.72,0,1)",za=["top","bottom","height","max-height","transform","transition","animation","pointer-events","opacity","transform-origin"],kn={x:0,y:0,at:-1e9};function Sn(e,n){let a=n||(performance.now()-kn.at<1500?kn:null);if(!a)return e.style.removeProperty("--lab-from");e.style.setProperty("--lab-from",`${Math.round(a.x-e.offsetLeft)}px ${Math.round(a.y-e.offsetTop)}px`)}var Zt=null;function _o(){!$.coarse||!$.host.hasAttribute("data-kb")||$.still.matches||(Zt??=$.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"}),Zt.isConnected||$.root.append(Zt),Zt.focus({preventScroll:!0}))}function En(e,n=0,a=!1){let o=a?240:n||200,s=n?"linear":"cubic-bezier(.4, 0, .9, .4)",l=0;try{l=new DOMMatrixReadOnly(getComputedStyle(e).transform).m42||0}catch{}let p=e.getBoundingClientRect(),r=p.top-l,i=getComputedStyle($.scrim).opacity;for(let[b,h]of[["top",`${r}px`],["bottom","auto"],["height",`${p.height}px`],["max-height","none"],["animation","none"],["transition","none"],["transform",`translateY(${l}px)`],["pointer-events","none"]])e.style.setProperty(b,h,"important");$.host.setAttribute("data-leaving",""),$.scrim.style.transition="none",$.scrim.style.opacity=i;let d=()=>$.root.activeElement?.blur();a?setTimeout(d,o):d();let u=(a?null:$.root.querySelector(e.classList.contains("card")?".pin.open":e.classList.contains("float")?".pin.draft":"none"))?.getBoundingClientRect();u&&Sn(e,{x:u.left+u.width/2,y:u.top+u.height/2}),e.offsetHeight;let m=()=>{e.style.setProperty("transition",`transform ${o}ms ${a?"cubic-bezier(.4, 0, 1, 1)":s}`,"important"),e.style.setProperty("transform",`translateY(${Math.max(p.height,innerHeight-r)+8}px)`,"important")};return a?requestAnimationFrame(()=>requestAnimationFrame(m)):n?m():(e.style.setProperty("transition",`transform ${o}ms ${s}, opacity ${o}ms ease-in`,"important"),e.style.setProperty("transform",`translateY(${l}px) scale(.3)`,"important"),e.style.setProperty("opacity","0","important")),$.scrim.style.transition=`opacity ${o}ms ${s}`,$.scrim.style.opacity="0",a?o+40:o}function $n(e){for(let n of za)e.style.removeProperty(n);$.host.removeAttribute("data-leaving"),$.scrim.style.opacity=$.scrim.style.transition=""}function Vt(e,n,a=0){if(!$.coarse||!e||$.still.matches)return n();let o=En(e,a);$.bar.style.transition=`transform ${o}ms cubic-bezier(.2, .6, .4, 1), opacity ${o}ms`,$.host.style.setProperty("--lab-p","1"),setTimeout(()=>{n(),$n(e),$.bar.style.transition="",$.host.style.removeProperty("--lab-p")},o)}function Co(){let e=$.root.querySelector(".float:not(.out)"),n=$.root.querySelector(".pin.draft");if(!$.coarse||!e||!n||!$.vv)return;let a=innerHeight-$.vv.height,o=a>60?a:$.S.kbSeen||Math.round(innerHeight*.42),s=innerHeight-o-e.offsetHeight-8,l=n.getBoundingClientRect(),p=56;if(!(l.top<p||l.bottom>s-16))return;let r=Math.max(0,scrollY+(l.top+l.bottom)/2-(p+s)/2);$.S.revealed={from:scrollY,to:r},Gt(r)}function Ln(){let e=$.S.revealed;$.S.revealed=null,e&&$.coarse&&Math.abs(scrollY-e.to)<40&&Gt(e.from)}function Gt(e){if($.coarse){let n=document.documentElement,a=parseFloat(n.style.getPropertyValue("--lab-room"))||0,o=Math.max(0,Math.ceil(e+innerHeight-(n.scrollHeight-a)));n.style.setProperty("--lab-room",`${o}px`),n.classList.toggle("lab-room",o>0)}scrollTo({top:Math.max(0,e),behavior:$.still.matches?"auto":"smooth"})}function _n(){let e=matchMedia("(pointer: coarse)").matches&&$.host.hasAttribute("data-sheet");if(!e&&$.S.backWatcher){let n=$.S.backWatcher;$.S.backWatcher=null,n.destroy()}if(e&&!$.S.backWatcher&&"CloseWatcher"in window)try{let n=new window.CloseWatcher;n.onclose=()=>{$.S.backWatcher===n&&($.S.backWatcher=null),$.closeOrNudge(),_n()},$.S.backWatcher=n}catch{}}function Et(e,n,a=!1){if(!$.coarse)return;let o=0,s=-1e9,l=-1e9;e.addEventListener("scroll",()=>s=performance.now(),{capture:!0,passive:!0}),e.addEventListener("click",f=>{performance.now()-l<200&&(f.preventDefault(),f.stopPropagation())},!0),e.addEventListener("focusin",f=>{performance.now()-l<200&&f.target.localName==="textarea"&&f.target.blur()});let p=0,r=0,i=0,d=0,w=null,u=null,m=null,b=!1,h=f=>{if(b=f.currentTarget===$.scrim,b&&$.openSheet()!==e)return void(u="off");let E=f.touches[0];p=E.clientX,r=E.clientY,i=d=o=0,w={y:r,at:f.timeStamp},m=b?null:Aa(f,e),u=f.touches.length>1||m?.localName==="textarea"?"off":null};e.addEventListener("touchstart",h,{passive:!0}),$.scrim.addEventListener("touchstart",h,{passive:!0});let k=f=>{if(b!==(f.currentTarget===$.scrim))return;let E=f.touches[0];if(u==="off"&&m&&m.localName!=="textarea"&&f.touches.length===1&&f.cancelable&&m.scrollTop<=0&&E.clientY>w.y+1&&(u="drag",r=E.clientY,d=0,w={y:E.clientY,at:f.timeStamp}),u==="off")return void(w={y:E.clientY,at:f.timeStamp});if(u==="hold")return f.preventDefault();if(!u){let C=E.clientY-r,O=E.clientX-p;if(!C&&!O)return;let B=Math.abs(O)>Math.abs(C),J=!B&&C>0&&r-e.getBoundingClientRect().top<e.offsetHeight*.25;if(b?u=B?"hold":"drag":Ta(f.target)?u=B&&f.target.closest(".tabs")?"off":"drag":J&&m?.localName!=="textarea"?u="drag":m?u=!B&&C>0&&m.scrollTop<=0&&performance.now()-s>100?"drag":"off":u=B?"hold":"drag",$.S.dbg?.(`touch ${String(f.target.className||f.target.localName).slice(0,20)} at ${Math.round(r-e.getBoundingClientRect().top)}/${e.offsetHeight} down${Math.round(C)} \u2192 ${u}${f.cancelable?"":" (not cancelable)"}${m?` box${Math.round(m.scrollTop)}`:""}`),u==="off")return;if(u==="hold")return f.preventDefault()}f.preventDefault(),o=E.clientY-r;let S=e.offsetHeight||400;i=o>=0?o:-(1-1/(-o*.55/S+1))*S,f.timeStamp>w.at&&(d=.8*((E.clientY-w.y)/(f.timeStamp-w.at))+.2*d),w={y:E.clientY,at:f.timeStamp},e.style.transition=$.scrim.style.transition="none",e.style.transform=`translateY(${i}px)`;let L=Math.min(1,Math.max(0,i/Math.max(100,innerHeight-(e.getBoundingClientRect().top-i))));$.scrim.style.opacity=String(1-L),$.bar.style.transition="none",$.host.style.setProperty("--lab-p",String(L))};e.addEventListener("touchmove",k,{passive:!1}),$.scrim.addEventListener("touchmove",k,{passive:!1});let y=f=>{if(b!==(f.currentTarget===$.scrim))return;let E=u;if(u=null,E==="drag"&&($.S.sheetDraggedAt=performance.now()),E!=="drag")return;l=performance.now(),f.timeStamp-w.at>80&&(d=0);let S=e.offsetHeight||innerHeight,L=()=>{e.style.transition=`transform 380ms ${Jt}, height 380ms ${Jt}`,$.scrim.style.transition="opacity 300ms",e.style.transform=$.scrim.style.opacity="",$.bar.style.transition="",$.host.style.removeProperty("--lab-p"),setTimeout(()=>e.style.transition=$.scrim.style.transition="",400)};if(a&&!e.classList.contains("full")&&(o<-40||d<-.4))return e.classList.add("full"),e.classList.contains("card")&&($.S.cardFull=!0),L();if(a&&e.classList.contains("full")&&d<1.2&&(o>60||d>.4))return e.classList.remove("full"),e.classList.contains("card")&&($.S.cardFull=!1),L();let C=i+Math.max(0,d)*499;if($.S.dbg?.(`let go: moved ${Math.round(i)} speed ${d.toFixed(2)} rest ${Math.round(C)} of half ${Math.round(S/2)} \u2192 ${d>-.1&&C>S/2?"close":"stay"}`),d>-.1&&C>S/2)return Vt(e,n,Math.min(320,Math.max(140,(innerHeight-e.getBoundingClientRect().top)/Math.max(d,1.2))));e.style.transition=`transform 380ms ${Jt}`,$.scrim.style.transition="opacity 300ms",e.style.transform=$.scrim.style.opacity="",$.bar.style.transition="",$.host.style.removeProperty("--lab-p"),setTimeout(()=>e.style.transition=$.scrim.style.transition="",400)};e.addEventListener("touchend",y),$.scrim.addEventListener("touchend",y),$.scrim.addEventListener("touchcancel",y),e.addEventListener("touchcancel",y)}function Mo(){if($.coarse&&$.vv){let e=$.el("i",{style:"position:fixed;top:0;bottom:0;left:0;width:0;visibility:hidden;pointer-events:none"}),n=$.el("i",{style:"position:absolute;left:0;width:100vw;display:none;background:var(--_bg);z-index:3;pointer-events:none"});$.root.append(e,n);let a="",o=()=>{let s=Math.abs($.vv.scale-1)>.01,l=e.getBoundingClientRect(),p=$.root.activeElement||document.activeElement,r=/^(textarea|input|select)$/.test(p?.localName||"")||!!p?.isContentEditable,i=s||!r?0:$.vv.offsetTop,d=(i?i+l.top:0)+$.vv.height,w=s?0:Math.max(0,Math.round(l.bottom-d)),u=s?0:Math.max(0,Math.round(d-l.bottom)),m=s?0:Math.round($.vv.height),b=$.host.hasAttribute("data-sheet"),h=`${w} ${m} ${u} ${b} ${scrollY} ${Math.round(i)}`;if(h===a){let S=b?$.openSheet():null;S?.offsetHeight&&!S.style.transform&&Object.assign(o,{sheet:S,top:S.offsetTop});return}a=h,$.host.style.setProperty("--lab-kb",`${w}px`),$.host.style.setProperty("--lab-top",`${Math.round(i)}px`),m?$.host.style.setProperty("--lab-vh",`${m}px`):$.host.style.removeProperty("--lab-vh"),$.host.toggleAttribute("data-kb",w>60),n.style.display=b&&u?"block":"none",n.style.top=`${Math.round(scrollY+l.bottom)}px`,n.style.height=`${u}px`;let k=b?$.openSheet():null,y=Math.abs((o.vh||m)-m)>60||o.kbUp!==w>60,f=k&&k===o.sheet&&y&&!k.style.transform&&!$.still.matches;f&&(k.style.transition="none",k.offsetHeight);let E=k?k.offsetTop:null;f&&Math.abs(o.top-E)<=8&&(k.style.transition=""),f&&Math.abs(o.top-E)>8&&(k.style.transform=`translateY(${o.top-E}px)`,k.offsetHeight,k.style.transition=`transform 340ms ${Jt}`,k.style.transform="",clearTimeout(o.done),o.done=setTimeout(()=>!k.style.transform&&(k.style.transition=""),360)),Object.assign(o,{vh:m,kbUp:w>60},k?.offsetHeight?{sheet:k,top:E}:{sheet:null}),w>60&&($.S.kbSeen=w)};if($.S.refit=o,$.root.addEventListener("focusin",()=>setTimeout(o,50)),$.root.addEventListener("focusout",()=>setTimeout(o,50)),$.vv.addEventListener("resize",o),$.vv.addEventListener("scroll",o),addEventListener("pointerdown",s=>kn={x:s.clientX,y:s.clientY,at:performance.now()},{capture:!0,passive:!0}),o(),globalThis.__LAB_DEBUG__!==!1&&/[?&]kbdebug\b/.test(location.search)){let s=[],l=performance.now(),p=0,r=w=>{let u=$.openSheet(),m=u?.getBoundingClientRect();s.push(`${Math.round(performance.now()-l)} ${w} h${Math.round($.vv.height)} top${Math.round($.vv.offsetTop)} in${innerHeight} kb${$.host.hasAttribute("data-kb")?1:0}`+(m?` sheet${Math.round(m.top)}/${Math.round(m.height)}${u.getAnimations().length?" anim":""}`:"")+` [${[...document.getAnimations(),...$.root.getAnimations()].map(b=>b.animationName||b.transitionProperty||"js").slice(0,6).join(",")}] scrim${getComputedStyle($.scrim).opacity.slice(0,4)} scroll${Math.round(scrollY)}`)},i=w=>{r(w);let u=performance.now()+1500,m="",b=()=>{let h=s.length;r("f");let k=s[s.length-1].replace(/^\d+ f /,"");k===m&&(s.length=h),m=k,performance.now()<u&&requestAnimationFrame(b)};requestAnimationFrame(b)};$.root.addEventListener("focusin",()=>(l=performance.now(),i("focus")));let d=()=>{clearTimeout(p),p=setTimeout(async()=>{let w=s.join(`
|
|
10
|
+
`);s=[];for(let u=0;u<w.length;u+=1900)await $.send({name:"kb-log",text:w.slice(u,u+1900),anchor:{kind:"page",selector:"body",x:0,y:0,docX:0,docY:0,width:innerWidth}}).catch(()=>{})},2e3)};$.root.addEventListener("focusout",()=>{s.push("--- let go"),l=performance.now(),i("blur"),d()}),$.S.dbg=w=>{s.push(`${Math.round(performance.now()-l)} ${w}`),d()},$.vv.addEventListener("resize",()=>{i("resize"),s.length>1&&d()})}}}var g;function To(e){g=e}var nt=(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 a=g.position(e.anchor||{}).top,o=a-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 l=g.S.openCard.getBoundingClientRect().bottom+scrollY-a+28;o=l<=innerHeight-80?a-28-(innerHeight-l)/2:a-40}Gt(o)};function Ue(){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"},[g.KEYS.comment,g.KEYS.go,g.KEYS.zoom,g.KEYS.pointer].join("/"))),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(i=>!g.isPage(i)).reduce((i,d)=>i+g.unread(d).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(i=>!g.isPage(i)&&g.unread(i).length),!g.LIST_WINDOW){g.newPrev.hidden=g.newNext.hidden=!0,g.listBtn.hidden=!g.S.on,g.listBtn.replaceChildren(g.coarse?"new":g.keyLabel("new",g.KEYS.next),g.el("b",{class:`cnt${n?"":" zero"}`},String(n))),g.listBtn.setAttribute("aria-label",`next new comment, ${n} new`),g.listBtn.setAttribute("aria-keyshortcuts",g.KEYS.next),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 i=e.filter(d=>!g.isPage(d)&&(d.resolved||Ne(d)[0]==="done")&&!g.unread(d).length).length;g.doneBtn.hidden=!g.S.on,g.doneBtn.disabled=!i&&!g.S.showDone,g.doneBtn.classList.toggle("quiet",g.doneBtn.disabled),g.doneBtn.replaceChildren(g.S.showDone?`hide done \xB7 ${i}`:`show done \xB7 ${i}`,g.el("kbd",{"aria-hidden":"true"},g.KEYS.done)),g.doneBtn.setAttribute("aria-keyshortcuts",g.KEYS.done)}g.placeBar();let a=e.reduce((i,d)=>i+g.unread(d).length,0);(!g.tabTitle.base||!document.title.startsWith("("))&&(g.tabTitle.base=document.title.replace(/^\(\d+\) /,""));let o=a?`(${a}) ${g.tabTitle.base}`:g.tabTitle.base;document.title!==o&&(document.title=o),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 i of g.listEl.querySelectorAll("[data-f]"))i.classList.toggle("on",i.dataset.f===g.S.filter);let l=e.filter(i=>!g.isPage(i)&&g.unread(i).length).length;g.listEl.querySelector('[data-f="new"]').textContent=l?`new \xB7 ${l}`:"new";for(let i of["work","resolved","mine"])g.$(`[data-f="${i}"]`,g.listEl).hidden=!0;g.holdBtn.hidden=!g.DRAFT_MODE;let p=e.filter(i=>!g.isPage(i)&&(i.resolved||Ne(i)[0]==="done")&&!g.unread(i).length).length;if(g.showDoneBtn.hidden=!p,g.showDoneBtn.textContent=g.S.showDone?`hide done \xB7 ${p}`:`show done \xB7 ${p}`,g.holdBtn.classList.toggle("on",g.drafting()),g.S.filter==="work")return g.listEl.querySelector(".items").replaceChildren(...Oa());let r=g.listed().map(i=>{let d=g.el("button",{class:`it${g.S.openId===i.id?" cur":""}`,type:"button"});return d.append(document.createTextNode(`${i.resolved?"\u2713":g.numberOf(i)} ${i.text.replace(/\s+/g," ").slice(0,70)} `),...g.onWhat(i)?[g.el("span",{},`on ${g.onWhat(i)} `)]:[],g.el("span",{},`\xB7 ${i.name}${!i.resolved&&g.isDone(i)?" \xB7 \u2705 done":""}`),...g.unread(i).length?[" ",g.el("span",{class:"tag"},`${g.unread(i).length} new`)]:[]),d.addEventListener("click",()=>nt(i)),d});g.listEl.querySelector(".items").replaceChildren(...r.length?r:[g.el("div",{class:"none"},"nothing here")])}var Ne=e=>{let n=[e,...g.repliesOf(e.id)],a=n.filter(p=>!p.session).map(p=>p.createdAt).sort().at(-1)||"",o=n.filter(p=>p.session).sort((p,r)=>p.createdAt.localeCompare(r.createdAt)).at(-1),s=o&&o.createdAt>a,l=s&&(o.intent||(/^done\b/i.test(o.text)?"done":/^on it\b/i.test(o.text)?"working":""));return e.resolved||l==="done"?["done",s?o.createdAt:e.createdAt]:l==="working"?["now",o.createdAt]:!s&&e.handedAt&&e.handedAt>=a?["now",e.handedAt]:s?[null,""]:["next",a]};function Oa(){let e=new Date().toDateString(),n=[],a=[],o=[];for(let r of g.S.comments.filter(i=>!i.parent)){let[i,d]=Ne(r);i==="now"?n.push([r,d]):i==="next"?a.push([r,d]):i==="done"&&new Date(d).toDateString()===e&&o.push([r,d])}let s=([r,i],d)=>{let w=g.el("button",{class:`it${g.S.openId===r.id?" cur":""}`,type:"button"});return w.append(document.createTextNode(`${g.isPage(r)?"chat":r.resolved?"\u2713":g.numberOf(r)} ${r.text.replace(/\s+/g," ").slice(0,70)} `),g.el("span",{},`\xB7 ${d(i)}`)),w.addEventListener("click",()=>g.isPage(r)?(g.S.chatOpen=!0,g.S.listOpen=!1,g.render()):nt(r)),w},l=(r,i,d,w=!1)=>i.length?[g.el("div",{class:"group"},`${r} \xB7 ${i.length}`),...i.sort((u,m)=>(w?-1:1)*u[1].localeCompare(m[1])).map(u=>s(u,d))]:[],p=[...l("Now",n,r=>`on it ${g.ago(r)}`.replace("on it just now","just started")),...l("Next",a,r=>`sent ${g.ago(r)} ago`.replace("just now ago","just now")),...l("Done today",o,r=>new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),!0)];return p.length?p:[g.el("div",{class:"none"},"nothing in progress on this page")]}var ot=e=>{let n=g.threads().filter(i=>!g.isPage(i)&&g.unread(i).length);if(!n.length)return;let a=i=>g.position(i.anchor||{}).top;n.sort((i,d)=>a(i)-a(d));let o=g.S.openId&&g.threads().find(i=>i.id===g.S.openId),s=o?a(o):null,l=s==null?-1:n.findIndex(i=>a(i)>s),p=n.findIndex(i=>i.id===g.S.openId),r=p>=0?(p+e+n.length)%n.length:s==null?e>0?0:n.length-1:e>0?l<0?0:l:((l<0?n.length:l)-1+n.length)%n.length;g.S.chatOpen=!1,nt(n[r],!g.coarse)};var T;function Ao(e){T=e}var Cn=(e,n)=>{let a=n.cloneNode(!0);a.classList.replace("stamp","stamp-room"),a.setAttribute("aria-hidden","true");for(let s of a.querySelectorAll("[role]"))s.removeAttribute("role");([...e.children].reverse().find(s=>s.classList?.contains("p"))||e).append(a),e.append(n)};function Qt(){let e=new Map(T.S.comments.map(m=>[m.id,m])),n=T.S.comments.filter(m=>T.isPage(m)||m.parent&&T.isPage(e.get(m.parent)||{})).sort((m,b)=>m.createdAt.localeCompare(b.createdAt)).slice(-150);T.S.on&&T.S.chatOpen&&T.chatEl.hidden&&(T.S.newFrom=n.find(T.isNew)?.id||null),T.S.chatOpen||(T.S.newFrom=null),T.S.on&&T.S.chatOpen&&T.markSeen(n.filter(T.isNew));let a=n.filter(T.isNew).length;T.chatBtn.hidden=!T.S.on;{let m=T.chatBtn.querySelector(".mark");for(;T.chatBtn.lastChild&&T.chatBtn.lastChild!==m;)T.chatBtn.lastChild.remove();T.chatBtn.append(T.coarse?"chat":T.keyLabel("chat",T.KEYS.chat),T.el("b",{class:`cnt${a?"":" zero"}`},String(a))),T.chatBtn.setAttribute("aria-label",`chat, ${a} new`),T.chatBtn.setAttribute("aria-keyshortcuts",T.KEYS.chat)}T.chatBtn.classList.toggle("has-new",a>0),T.placeBar();let o=T.chatEl.hidden;if(T.chatEl.hidden=!T.S.on||!T.S.chatOpen,T.chatEl.hidden&&T.chatEl.classList.remove("full"),T.chatEl.hidden&&T.chatEl.contains(T.root.activeElement)&&T.root.activeElement.blur(),T.chatEl.hidden)return;let s=T.$(".msgs",T.chatEl),l=o||s.scrollHeight-s.scrollTop-s.clientHeight<48,p=new Set(o?[]:[...s.children].map(m=>m.dataset.id)),r=new Map([...s.children].filter(m=>m.dataset.id).map(m=>[m.dataset.id,m])),i=m=>{let b=r.get(m.dataset?.id);return b&&b.outerHTML.replace(" fresh","")===m.outerHTML?b:m};T.patchKids(s,n.flatMap(m=>{let b=m.parent?e.get(m.parent):m,h=T.el("div",{class:`msg${T.mine(m)&&!m.session?" mine":""}${b&&T.S.replyTo===b.id?" to":""}${p.size&&!p.has(m.id)?" fresh":""}`,"data-id":m.id,...T.agentOf(m)?{"data-agent":T.agentOf(m)}:{}});if(h.append(T.nameLine(m.name,!1)),m.parent&&b){let k=T.el("div",{class:"quote"});k.append(T.el("b",{},String(b.name||"").replace(/\s*·\s*session\s+\S+$/i,"")),document.createTextNode(b.text.replace(/\s+/g," ").slice(0,90))),k.addEventListener("click",y=>{y.stopPropagation();let f=T.$(".msgs",T.chatEl),E=T.$(`[data-id="${b.id}"]`,f);E&&(f.scrollTo({top:E.offsetTop-f.offsetTop-12,behavior:T.still.matches?"auto":"smooth"}),E.animate?.([{boxShadow:"0 0 0 2px rgb(52,199,89)"},{boxShadow:"0 0 0 0 transparent"}],{duration:900}))}),h.append(k)}return h.append(...T.readable(m.text)),Cn(h,T.stampOf(m,b)),m.id===T.S.newFrom&&m!==n[0]?[T.el("div",{class:"newline"},"new"),h]:[h]}).map(i));let d=T.$(".replying",T.chatEl),w=T.S.replyTo&&e.get(T.S.replyTo);if(d.hidden=!w,w){let m=T.el("button",{type:"button",title:"about the page instead"},"\u2715");m.addEventListener("click",()=>(T.S.replyTo=null,Qt())),d.replaceChildren(document.createTextNode(`\u21A9 ${w.name}: ${w.text.replace(/\s+/g," ").slice(0,40)}`),m)}s.firstChild||s.append(T.el("div",{class:"none"},"say something about the page as a whole"));let u=T.chatEl.querySelector(".chat");u.firstChild||u.append(T.composer({placeholder:"message",draftKey:`lab-typing:${T.S.page}:chat`,onSubmit:async(m,b)=>{let{comment:h}=await T.send(T.S.replyTo?{name:m,text:b,parent:T.S.replyTo}:{name:m,text:b,anchor:{kind:"page",width:innerWidth,height:innerHeight,dpr:devicePixelRatio||1}}),k=T.S.replyTo&&T.S.comments.find(y=>y.id===T.S.replyTo);return k?.resolved&&(k.resolved=!1),T.S.replyTo=null,T.S.comments.push(h),T.markSeen([h]),s.scrollTop=s.scrollHeight,T.render(),{keep:!0}}})),u.querySelector("textarea").placeholder=w?"reply":"message",l&&(s.scrollTop=s.scrollHeight)}var M;function zo(e){M=e}function Mn(e,n,a){M.layer.append(e);let o=e.offsetWidth,s=scrollX+document.documentElement.clientWidth-o-12;e.style.left=`${Math.max(scrollX+12,Math.min(n-14,s))}px`;let l=e.offsetHeight,p=a+10+l>M.contentEnd();e.style.top=`${p?Math.max(scrollY+8,a-40-l):a+10}px`,e.style.transformOrigin=p?"14px 100%":""}function Oo(e,n,a){M.layer.append(e);let o=e.offsetWidth,s=scrollX+document.documentElement.clientWidth-12,l=e.offsetHeight,p=M.contentEnd();n+36+o<=s?(e.style.left=`${n+36}px`,e.style.top=`${Math.min(a-37,p-l-8)}px`):(e.style.left=`${Math.max(scrollX+12,Math.min(n-14,s-o))}px`,e.style.top=`${a+10+l>p?Math.max(scrollY+8,a-40-l):a+10}px`)}function No(e,n){e.addEventListener("pointerdown",a=>{if(a.button!==0)return;let o=e.getBoundingClientRect(),s={dx:a.clientX-o.left,dy:a.clientY-o.bottom},l={x:a.clientX,y:a.clientY,sx:scrollX,sy:scrollY,left:parseFloat(e.style.left),top:parseFloat(e.style.top)},p=!1,r=a;M.S.grabbing=!0,e.setPointerCapture(a.pointerId);let i=()=>{e.style.left=`${l.left+r.clientX-l.x+scrollX-l.sx}px`,e.style.top=`${l.top+r.clientY-l.y+scrollY-l.sy}px`},d=m=>{r=m,!(!p&&Math.hypot(m.clientX-l.x,m.clientY-l.y)<5)&&(p=!0,e.classList.add("dragging"),i())},w=()=>p&&i();addEventListener("scroll",w,!0),M.S.dropDrag=()=>{removeEventListener("scroll",w,!0),M.S.dropDrag=null};let u=async m=>{if(e.removeEventListener("pointermove",d),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",u),e.removeEventListener("lostpointercapture",u),M.S.dropDrag?.(),!M.S.grabbing||(M.S.grabbing=!1,!p))return;e.dataset.dragged="1",setTimeout(()=>delete e.dataset.dragged,0);let b=m.clientX-s.dx,h=m.clientY-s.dy,k=document.elementsFromPoint(b,h).find(f=>f!==M.host);if(m.type==="pointercancel"||b<0||h<0||b>innerWidth||h>innerHeight||k?.closest(M.OFF))return M.render();let y=n.anchor;n.anchor={...M.anchorAt(b,h),...y?.zoom?{zoom:y.zoom}:{}},M.render();try{let{comment:f}=await M.send({action:"move",id:n.id,anchor:n.anchor,edit:M.store.get(`lab-edit:${n.id}`)||void 0});Object.assign(n,f)}catch{n.anchor=y,M.render()}};e.addEventListener("pointermove",d),e.addEventListener("pointerup",u),e.addEventListener("pointercancel",u),e.addEventListener("lostpointercapture",u)})}function Ro(e,n=new Set,a=!1){let o=M.el("div",{class:"card"}),s=M.el("div",{class:"body"}),l=M.el("div",{class:"foot"});o.append(M.el("div",{class:"handle"}),s,l),o.addEventListener("click",y=>y.stopPropagation()),s.classList.add("msgs");let p=!0;s.addEventListener("scroll",()=>p=s.scrollHeight-s.scrollTop-s.clientHeight<48,{passive:!0}),"ResizeObserver"in window&&new ResizeObserver(()=>p&&(s.scrollTop=s.scrollHeight)).observe(s),l.addEventListener("focusin",y=>{y.target.localName==="textarea"&&(p=!0,s.scrollTop=s.scrollHeight)});let r='<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 1.5l1.7 4.8L14.5 8l-4.8 1.7L8 14.5l-1.7-4.8L1.5 8l4.8-1.7z"/></svg>',i=y=>{let f=[e,...M.repliesOf(e.id)],E=f.slice(f.indexOf(y)+1).find(C=>C.session);if(!E?.suggest||E.suggestDone||E.rule)return null;let S=M.el("button",{class:"btn offer",type:"button",title:E.suggest});S.append(M.el("span",{class:"tm"},"rule?"));let L=M.el("span",{class:"tick"});return L.innerHTML=r,S.append(L),S.addEventListener("click",async()=>{if(!(await fetch("/_lab/rule",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({page:M.S.page,id:E.id,action:"keep"})}).catch(()=>null))?.ok)return void(S.lastChild.textContent="failed, try again");E.suggestDone="kept",E.rule=E.suggest;for(let O of o.querySelectorAll(`.msg[data-id="${y.id}"] .offering`))O.classList.remove("offering");o.querySelectorAll(`.msg[data-id="${y.id}"] .offer`).forEach(O=>O.remove()),o.querySelector(`.msg[data-id="${E.id}"]`)?.append(d(E))}),S},d=y=>{let f=M.el("span",{class:"rule"});if(y.ruleUndone)return f.append(M.el("b",{},"rule removed")),f;let E=M.el("button",{class:"btn",type:"button"},"undo");return E.addEventListener("click",async()=>{if(!(await fetch("/_lab/rule",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({page:M.S.page,id:y.id})}).catch(()=>null))?.ok)return void(E.textContent="failed, try again");y.ruleUndone=!0,f.replaceWith(d(y))}),f.append(M.el("b",{},"rule"),document.createTextNode(y.rule),E),f},w=y=>{let f=M.el("div",{class:`item msg${M.mine(y)&&!y.session?" mine":""}`,"data-id":y.id,...M.agentOf(y)?{"data-agent":M.agentOf(y)}:{}});f.append(M.nameLine(y.name,!1));let E=y.to&&M.repliesOf(e.id).find(C=>C.id===y.to);if(E){let C=M.el("span",{class:"quote"});C.append(M.el("b",{},String(E.name||"").replace(/\s*·\s*session\s+\S+$/i,"")),document.createTextNode(E.text.replace(/\s+/g," ").slice(0,90))),C.addEventListener("click",()=>o.querySelector(`.msg[data-id="${E.id}"]`)?.scrollIntoView({block:"center",behavior:M.still.matches?"auto":"smooth"})),f.append(C)}f.append(...M.readable(y.text)),y.session&&y.rule&&f.append(d(y));let S=M.stampOf(y,e,y===e&&!e.resolved?`#${M.numberOf(e)} \xB7 `:""),L=!y.session&&i(y);return L&&(S.classList.add("offering"),S.prepend(L)),M.stamped(f,S),f},u=new Set,m=[e,...M.repliesOf(e.id)],b=m.find(y=>n.has(y.id));for(let y of m)y===b&&y!==e&&s.append(M.el("div",{class:"newline"},"new")),s.append(w(y)),u.add(y.id);o.sync=()=>{let y=s.scrollHeight-s.scrollTop-s.clientHeight<48;for(let f of M.repliesOf(e.id)){if(u.has(f.id))continue;let E=o.querySelectorAll(".item"),S=w(f);S.classList.add("fresh"),E[E.length-1].after(S),u.add(f.id),M.markSeen([f])}y&&(s.scrollTop=s.scrollHeight)};let h=M.store.get(`lab-edit:${e.id}`),k=null;if(M.S.isAdmin||h){k=M.el("div",{class:"row acts"});let y=M.el("button",{class:"btn",type:"button"},e.resolved?"reopen":"resolve"),f=O=>O.textContent="failed, try again";y.addEventListener("click",async()=>{try{let O=!e.resolved,{comment:B}=await M.send({action:e.resolved?"reopen":"resolve",id:e.id,...h?{edit:h}:{}});if(Object.assign(e,B),O&&M.S.openId===e.id)return M.S.closeFast=!0,M.S.openId=null,M.render();M.render()}catch{f(y)}});let E=M.el("button",{class:"btn",type:"button"},"delete"),S=M.el("button",{class:"btn danger",type:"button"},"delete"),L=M.el("button",{class:"btn",type:"button"},"cancel"),C=()=>{k.replaceChildren(y,E),E.focus()};E.addEventListener("click",()=>{k.replaceChildren(M.el("span",{class:"ask"},M.repliesOf(e.id).length?"delete thread?":"delete comment?"),S,L),L.focus()}),L.addEventListener("click",C),k.addEventListener("keydown",O=>{O.key==="Escape"&&S.isConnected&&(O.stopPropagation(),C())}),S.addEventListener("click",async()=>{try{await M.send({action:"delete",id:e.id})}catch{return f(S)}M.S.comments=M.S.comments.filter(O=>O.id!==e.id&&O.parent!==e.id),M.S.openId=null,M.render()}),k.append(...M.S.isAdmin?[y,E]:[y]),s.append(k)}if(M.coarse){let y=L=>M.position(L.anchor||{}).top,f=y(e),E=M.threads().filter(L=>!M.isPage(L)&&L.id!==e.id&&M.unread(L).length).map(L=>[L,y(L)]);E.sort((L,C)=>(L[1]>f?0:1)-(C[1]>f?0:1)||L[1]-C[1]);let S=M.el("div",{class:"row nav"});if(E.length){let L=M.el("button",{class:"btn",type:"button"},`new \xB7 ${E.length} \u203A`);L.addEventListener("pointerdown",C=>C.preventDefault()),L.addEventListener("click",()=>M.goTo(E[0][0])),S.append(L)}k&&S.append(k),S.firstChild&&o.insertBefore(S,s)}return l.append(M.composer({placeholder:"reply",autofocus:a,draftKey:`lab-typing:${M.S.page}:${e.id}`,onSubmit:async(y,f)=>{let{comment:E}=await M.send({name:y,text:f,parent:e.id});if(M.S.comments.push(E),M.markSeen([E]),e.resolved){e.resolved=!1,M.render();let C=M.S.openCard?.querySelector(".body");return C&&(C.scrollTop=C.scrollHeight),M.S.openCard?.querySelector("textarea")?.focus({preventScroll:!0}),{keep:!0}}u.add(E.id);let S=o.querySelectorAll(".item"),L=w(E);return L.classList.add("fresh"),S[S.length-1].after(L),s.scrollTop=s.scrollHeight,{keep:!0}}})),o}var I;function Bo(e){I=e}function Po(){if(I.script?.dataset.live){let Ze=function(x){{if(x.widget&&I.script.dataset.widget&&x.widget!==I.script.dataset.widget||(x.lab&&I.script.dataset.lab&&x.lab!==I.script.dataset.lab&&(I.script.dataset.lab=x.lab,I.script.dataset.version=String(x.files),h=x.hot,m=x.comments,H(),I.load()),String(x.files)!==I.script.dataset.version))return l();h!==null&&x.hot!==h&&(x.hot-h>1?re([{kind:"html"},{kind:"css",path:""}]):re(x.hotFiles||[])),h=x.hot,m!==null&&x.comments!==m&&I.loadChanges(m),m=x.comments,x.reads!==b&&(b=x.reads,I.syncReads());let A=x.session,D=A?x.mode||"listening":"away",W=ce=>Object.assign(document.createElement("span"),{textContent:ce}),N=A?.model?`${A.agent||"Claude"} \xB7 ${A.model}`:A?.agent||"Claude",K=A&&A.name!==(A.agent||"Claude")?[W(`(${A.name})`)]:[];D==="listening"?i.replaceChildren(W("talking to"),N,...K):D==="working"?i.replaceChildren(N,W("is working"),...K):i.replaceChildren(W("no agent listening")),p.classList.toggle("idle",D==="away"),p.classList.toggle("working",D==="working"),I.listBtn.dataset.agent=D,I.chatBtn.dataset.agent=D,I.coarse&&!I.chatBtn.querySelector(".mark")&&I.chatBtn.insertAdjacentHTML("afterbegin",r),I.coarse&&(I.chatBtn.title=p.textContent),p.setAttribute("aria-label",p.textContent),A?.url&&D!=="away"?Object.assign(p,{href:A.url,target:"_blank"}):p.removeAttribute("href"),p.title=D==="away"?"Ask your agent to run: npx @leonidstern/labit wait":A?.resume||"",p.hidden=!1}},e="lab-scroll:"+location.pathname;try{let x=JSON.parse(sessionStorage.getItem(e)||"null");x!==null&&(sessionStorage.removeItem(e),x.open&&(I.S.openId=x.open),x.list&&(I.S.listOpen=!0,I.S.filter=["new","open","resolved","mine"].includes(x.filter)?x.filter:I.S.filter),x.chat&&(I.S.chatOpen=!0),addEventListener("load",()=>scrollTo(0,+(x.y??x))))}catch{}let n=0;for(let x of["pointerdown","keydown","wheel","touchstart"])addEventListener(x,()=>n=performance.now(),{capture:!0,passive:!0});let a=()=>I.S.draft||I.S.grabbing||I.S.openId||I.S.chatOpen||I.S.listOpen||I.coarse&&/^(textarea|input)$/.test(I.root.activeElement?.localName||"")||[...I.root.querySelectorAll("textarea")].some(x=>x.value.trim())||performance.now()-n<1500,o=!1,s=0,l=()=>{if(document.hidden)return void(o=!0);if(a()){s||(s=setTimeout(()=>(s=0,l()),500));return}try{sessionStorage.setItem(e,JSON.stringify({y:scrollY,open:I.S.openId,list:I.S.listOpen,filter:I.S.filter,chat:I.S.chatOpen}))}catch{}location.reload()},p=document.createElement("a");p.className="listener";let r='<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>';p.innerHTML=r+'<div class="lbl"></div>';let i=p.querySelector(".lbl");p.hidden=!0,I.root.querySelector(".left").prepend(p),document.querySelector('link[rel~="icon"]')||fetch("/favicon.ico",{method:"HEAD"}).then(x=>x.ok&&(x.headers.get("content-type")||"").startsWith("image/")).catch(()=>!1).then(x=>{x||document.querySelector('link[rel~="icon"]')||document.head.append(Object.assign(document.createElement("link"),{rel:"icon",href:"/_lab/favicon.svg"}))});let d=null,w=0,u=x=>{i.replaceChildren(Object.assign(document.createElement("span"),{textContent:x})),p.setAttribute("aria-label",x),p.classList.add("idle"),p.classList.remove("working"),p.hidden=!1},m=null,b=null,h=null,k=x=>{let A=[...document.querySelectorAll('link[rel~="stylesheet"][href]:not([data-lab-swap])')].filter(W=>new URL(W.href,location.href).origin===location.origin),D=A.filter(W=>x.includes(decodeURIComponent(new URL(W.href,location.href).pathname)));for(let W of D.length?D:A){let N=new URL(W.href,location.href);N.searchParams.set("lab-v",Date.now().toString(36));let K=W.cloneNode();K.href=N.href,K.dataset.labSwap="";let ce=N.pathname;K.addEventListener("load",()=>{for(let j of document.querySelectorAll('link[rel~="stylesheet"][href]'))j!==K&&new URL(j.href,location.href).pathname===ce&&j.remove();delete K.dataset.labSwap},{once:!0}),K.addEventListener("error",()=>K.remove(),{once:!0}),W.after(K)}},y=x=>{let A=new URL(x,location.href);return A.searchParams.set("lab-v",Date.now().toString(36)),A.href},f=(x,A)=>{try{let D=new URL(x,location.href);return D.origin===location.origin&&A.includes(decodeURIComponent(D.pathname))}catch{return!1}},E=x=>{let A=0;for(let D of document.querySelectorAll('img, source, video[poster], image, use, link[rel~="icon"]')){if(I.host.contains(D))continue;for(let N of["src","href","poster","xlink:href"]){let K=D.getAttribute(N);if(!K||!f(K.split("#")[0],x))continue;let ce=y(K.split("#")[0]),j=new Image;j.src=ce,(j.decode?j.decode():Promise.resolve()).catch(()=>{}).finally(()=>D.setAttribute(N,ce+(K.includes("#")?K.slice(K.indexOf("#")):""))),A++}let W=D.getAttribute("srcset");W&&W.split(",").some(N=>f(N.trim().split(/\s+/)[0],x))&&(D.setAttribute("srcset",W.split(",").map(N=>{let[K,...ce]=N.trim().split(/\s+/);return[f(K,x)?y(K):K,...ce].join(" ")}).join(", ")),A++)}A||k([])},S=x=>{for(let A of document.styleSheets){let D;try{D=A.cssRules}catch{continue}for(let W of D||[]){if(!(W instanceof CSSFontFaceRule))continue;let N=W.style.getPropertyValue("src"),K=A.href||location.href;if(!/url\(/.test(N)||![...N.matchAll(/url\(["']?([^"')]+)/g)].some(ne=>f(new URL(ne[1],K).href,x)))continue;let ce=N.replace(/url\(["']?([^"')]+)["']?\)/g,(ne,Q)=>f(new URL(Q,K).href,x)?`url("${y(new URL(Q,K).href)}")`:ne),j=ne=>W.style.getPropertyValue(ne)||void 0;try{new FontFace(j("font-family").replace(/^["']|["']$/g,""),ce,{weight:j("font-weight"),style:j("font-style"),stretch:j("font-stretch"),unicodeRange:j("unicode-range"),display:j("font-display")}).load().then(Q=>document.fonts.add(Q)).catch(()=>{})}catch{}}}},L=()=>new Set([I.fonts,I.pinCursorStyle]),C=x=>[...x.querySelectorAll("script")].filter(A=>!/\/_lab\/comments\.js/.test(A.getAttribute("src")||"")).map(A=>A.getAttribute("src")||A.textContent),O=x=>[...x.querySelectorAll('link[rel~="stylesheet"]')].map(A=>{try{return new URL(A.getAttribute("href"),location.href).pathname}catch{return""}}),B=x=>x===I.host||x.nodeType===1&&x.localName==="script",J=(x,A)=>x.nodeType===A.nodeType&&x.nodeName===A.nodeName&&(x.nodeType!==1||(x.id||"")===(A.id||"")),q=(x,A)=>J(x,A)&&(x.nodeType===1?!!x.id||x.getAttribute("class")===A.getAttribute("class"):x.nodeType!==3||x.data===A.data),P=(x,A)=>{let D=[...x.childNodes].filter(j=>!B(j)),W=[...A.childNodes].filter(j=>!(j.nodeType===1&&j.localName==="script")),N=0,K=null,ce=j=>{let ne=document.importNode(j,!0);return x.insertBefore(ne,K?K.nextSibling:D[N]||x.firstChild),ne};W.forEach((j,ne)=>{let Q=D[N];if(!Q)return void(K=ce(j));if(q(Q,j))return K=F(Q,j),void N++;if(W.slice(ne+1,ne+8).some(se=>q(Q,se)))return void(K=ce(j));let fe=D.slice(N+1,N+8).findIndex(se=>q(se,j));if(fe>=0){for(let se of D.slice(N,N+1+fe))se.remove();return N+=fe+1,K=F(D[N],j),void N++}K=F(Q,j),N++});for(let j of D.slice(N))j.remove()},F=(x,A)=>{if(x.nodeType!==A.nodeType||x.nodeName!==A.nodeName||x.nodeType===1&&(x.id||"")!==(A.id||"")){let D=document.importNode(A,!0);return x.replaceWith(D),D}if(x.nodeType===3||x.nodeType===8)return x.data!==A.data&&(x.data=A.data),x;if(x.nodeType!==1)return x;for(let{name:D}of Array.from(x.attributes))!A.hasAttribute(D)&&!(D==="open"&&/^(details|dialog)$/.test(x.localName))&&x.removeAttribute(D);for(let{name:D,value:W}of Array.from(A.attributes))x.getAttribute(D)!==W&&x.setAttribute(D,W);return x===document.activeElement||x.shadowRoot||/^(iframe|canvas|video|audio|textarea|select|input)$/.test(x.localName)||P(x,A),x},V=()=>C(document).length>0,oe=0,H=async()=>{if(V())return l();let x=++oe;try{let A=await fetch(location.href,{cache:"no-store",headers:{accept:"text/html"}});if(!A.ok)return l();let D=await A.text();if(x!==oe)return;let W=new DOMParser().parseFromString(D,"text/html");if(C(W).join(`
|
|
11
|
+
`)!==C(document).join(`
|
|
12
12
|
`)||O(W).join(`
|
|
13
13
|
`)!==O(document).join(`
|
|
14
|
-
`))return
|
|
14
|
+
`))return l();let N=null;for(let ne of[Math.min(innerHeight/3,240),innerHeight/2,80]){let Q=document.elementFromPoint(innerWidth/2,ne);if(Q&&Q!==document.body&&Q!==document.documentElement&&!I.host.contains(Q)&&Q!==I.host){N=Q;break}}let K=N?.getBoundingClientRect().top,ce=()=>{W.title!==I.tabTitle.base&&(I.tabTitle.base=W.title,document.title=W.title,I.drawList());let ne=L(),Q=[...document.head.querySelectorAll("style")].filter(se=>!ne.has(se)),fe=[...W.head.querySelectorAll("style")];fe.forEach((se,Pe)=>Q[Pe]?Q[Pe].textContent!==se.textContent&&(Q[Pe].textContent=se.textContent):document.head.append(document.importNode(se,!0)));for(let se of Q.slice(fe.length))se.remove();if(P(document.body,W.body),N?.isConnected){let se=N.getBoundingClientRect().top-K;Math.abs(se)>1&&scrollBy(0,se)}I.reflow(),I.drawZoom()},j=()=>{try{ce()}catch{l()}};document.startViewTransition&&!I.still.matches?document.startViewTransition(j):j()}catch{l()}},re=x=>{let A=W=>x.filter(N=>N.kind===W).map(N=>N.path),D=decodeURIComponent(location.pathname).replace(/\/$/,"/index").replace(/\.html?$/i,"");A("html").some(W=>!W||W.replace(/\.html?$/i,"")===D)&&H(),A("css").length&&k(A("css")),A("img").length&&E(A("img")),A("font").length&&S(A("font"))},ae=Math.random().toString(36).slice(2,12),U="BroadcastChannel"in window?new BroadcastChannel("labit-live"):null,xe=!!(U&&navigator.locks),ye=!xe,he=null,Xe=null,Re=x=>{w=Date.now(),Xe=x,Ze(x)};U&&(U.onmessage=({data:x})=>{x.t==="hello"&&d&&Xe&&U.postMessage({t:"state",v:Xe}),!d&&(x.t==="state"&&Re(x.v),x.t==="beat"&&(w=Date.now()),x.t==="down"&&u("reconnecting"))});let _e=()=>{d||(d=new EventSource(`${I.script.dataset.live}?tab=${ae}`),w=Date.now(),d.addEventListener("beat",()=>{w=Date.now(),ye&&U?.postMessage({t:"beat"})}),d.onerror=()=>{u("reconnecting"),ye&&U?.postMessage({t:"down"})},d.onmessage=x=>{let A=JSON.parse(x.data);Re(A),ye&&U?.postMessage({t:"state",v:A})})},Be=()=>navigator.locks.request("labit-live",()=>new Promise(x=>{he=x,ye=!0,_e()}));document.addEventListener("visibilitychange",()=>{if(!document.hidden){if(o)return l();Je()}}),addEventListener("pagehide",()=>{d?.close(),d=null,he?.(),he=null,ye=!xe,fetch(I.script.dataset.live.replace(/live$/,"bye"),{method:"POST",keepalive:!0,headers:{"content-type":"application/json"},body:JSON.stringify({tab:ae})}).catch(()=>{})}),addEventListener("pageshow",x=>x.persisted&&Ve());let at=Date.now(),tn=()=>{d?.close(),d=null,u("reconnecting"),_e()},Je=(x=!1)=>{let A=Date.now()-w>4e4;d&&(x||A)?tn():!d&&A?_e():!d&&x&&U?.postMessage({t:"hello"})};setInterval(()=>{let x=Date.now(),A=x-at>2e4;at=x,document.hidden||Je(A)},5e3),addEventListener("online",()=>!document.hidden&&Je(!0));let Ve=()=>{if(!xe)return _e();w=Date.now(),Be(),U.postMessage({t:"hello"})};Ve()}}var we;function Do(e){we=e}function $t(e){let n=document.createElement("span");n.className="zi",n.setAttribute("aria-hidden","true");let a=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="${a}"/></svg>`,n}var en=[];function Tn(e,n){en.push({block:e,dir:n,at:Date.now()})}var Na=(e,n)=>{let a=document.querySelector(`[data-zoom="${n}"][data-zoom-of="${CSS.escape(e)}"]`);return a&&!we.host.contains(a)?a:null};function An(e){let n=e.getBoundingClientRect(),a=matchMedia("(prefers-reduced-motion: reduce)").matches;scrollTo({top:Math.max(0,n.top+scrollY-24),behavior:a?"auto":"smooth"});let o="2px solid rgb(52, 199, 89)";e.animate([{outline:o,outlineOffset:"4px"},{outline:o,outlineOffset:"4px",offset:.7},{outline:"2px solid transparent",outlineOffset:"4px"}],{duration:2e3})}function zn(){for(let e=en.length-1;e>=0;e--){let n=en[e],a=Na(n.block,n.dir);(a||Date.now()-n.at>30*6e4)&&en.splice(e,1),a&&requestAnimationFrame(()=>An(a))}}function Le(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 qo(e,n){return e.key==="Escape"?(Le(""),!0):!1}function Io(){try{let e=sessionStorage.getItem("lab-zoom");we.S.zoomMode=e==="in"||e==="out"?e:""}catch{we.S.zoomMode=""}}var On=e=>e==="out"?"zoom out: the bigger picture":"zoom in: dive deeper";/*!
|
|
15
15
|
* lab comments: anyone with the link clicks anywhere on a lab page to pin a comment. No login, just a name.
|
|
16
16
|
* https://github.com/leonidstern/labit · MIT
|
|
17
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
|
|
@@ -21,8 +21,8 @@ ${r}`:n.push({text:r,gap:a>0&&p===0||!!c})})}return n.map(a=>{let o=ze("span",{c
|
|
|
21
21
|
* The layer only turns on when the page is opened on the host the script is loaded from (or data-host),
|
|
22
22
|
* so the deployment's own address and local dev stay clean. data-enable="always" turns it on everywhere.
|
|
23
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 F},get API(){return d},get headers(){return
|
|
25
|
-
<style>${
|
|
24
|
+
*/(()=>{let e={dbg:null},n={get $(){return F},get API(){return d},get headers(){return ne},get DRAFT_MODE(){return yn},get LIST_WINDOW(){return at},get OFF(){return ge},get S(){return e},get agentOf(){return j},get ago(){return Vo},get anchorAt(){return je},get bar(){return re},get chatBtn(){return W},get chatEl(){return D},get closeOrNudge(){return Xn},get coarse(){return ee},get composer(){return wn},get contentEnd(){return ea},get doneBtn(){return _e},get drafting(){return kt},get drawList(){return Ue},get el(){return N},get fonts(){return ue},get goBtn(){return he},get goFace(){return rn},get goTo(){return nt},get held(){return lt},get holdBtn(){return A},get host(){return q},get isDone(){return Xo},get isNew(){return Dn},get isPage(){return Bn},get keyWord(){return an},get KEYS(){return o},get keyLabel(){return p},get layer(){return V},get listBtn(){return ye},get listEl(){return x},get listed(){return Uo},get load(){return fe},get loadChanges(){return se},get markSeen(){return dt},get mine(){return Tt},get nameLine(){return bo},get newNext(){return Je},get newPrev(){return Xe},get numberOf(){return sn},get onWhat(){return Eo},get openSheet(){return Un},get patchKids(){return K},get pinCursorStyle(){return ht},get placeBar(){return Jo},get position(){return Ye},get readable(){return xo},get reflow(){return Pt},get drawZoom(){return zn},get refreshPinCursor(){return gn},get setCursor(){return nn},get recheck(){return Ce},get render(){return Y},get repliesOf(){return pn},get root(){return P},get scrim(){return mn},get script(){return a},get send(){return De},get sendBtn(){return Ve},get showDoneBtn(){return Re},get stampOf(){return $o},get stamped(){return Cn},get still(){return zt},get store(){return u},get syncReads(){return dn},get tabTitle(){return tn},get threads(){return it},get unread(){return ct},get vv(){return ra}};Bo(n),Do(n),To(n),Ao(n),zo(n),Lo(n);let a=document.currentScript,o={toggle:"m",comment:"1",go:"2",zoom:"3",pointer:"4",chat:"c",next:"w",pause:"p",done:"d",reply:"r",resolve:"e"};try{Object.assign(o,JSON.parse(a?.dataset.keys||"{}"))}catch{}let s=t=>{let c=/^(Digit|Numpad)(\d)$/.exec(t.code||"");return c?c[2]:/^[a-z]$/i.test(t.key||"")?t.key.toLowerCase():/^Key[A-Z]$/.test(t.code||"")?t.code.slice(3).toLowerCase():""},l=t=>Object.keys(o).find(c=>o[c]===s(t))||"",p=(t,c)=>{let v=t.indexOf(c);return v>=0?an(t.slice(0,v),c,t.slice(v+1)):an(`${t} `,c,"")},r=a?.dataset.host||(a?.src?new URL(a.src,location.href).hostname:location.hostname);if(!(location.hostname===r||a?.dataset.enable==="always")||window.__labComments)return;window.__labComments=!0;let d=a?.dataset.api||"/_lab/api/comments",w=()=>a?.dataset.page||location.pathname.replace(/\/+$/,"")||"/";e.page=w();let u={get:t=>{try{return localStorage.getItem(t)||""}catch{return""}},set:(t,c)=>{try{localStorage.setItem(t,c)}catch{}}},m=a?.dataset.me||"";m&&!u.get("lab-name")&&u.set("lab-name",m);let b=a?.dataset.live?a.dataset.live.replace(/live$/,"me"):"",h=(()=>{try{return JSON.parse(a?.dataset.flags||"{}")}catch{return{}}})(),k=a?.dataset.live?a.dataset.live.replace(/live$/,"flags"):"",y=t=>h[t]?.on===!0,f=m,E=t=>{!b||!t||t===f||(f=t,fetch(b,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t})}).catch(()=>{}))},S=t=>t.split(".").length===3?t.split(".")[1]:"",L=new URLSearchParams(location.hash.slice(1)).get("lab-admin")||new URLSearchParams(location.search).get("lab-admin");if(L){let t=S(L);u.set(t?`lab-admin:${t}`:"lab-admin",L);let c=new URL(location.href);c.searchParams.delete("lab-admin"),/lab-admin=/.test(c.hash)&&(c.hash=""),history.replaceState(null,"",c)}let C=a?.dataset.admin||u.get(`lab-admin:${e.page.split("/")[1]||""}`)||u.get("lab-admin:*")||u.get("lab-admin");e.comments=[],e.isAdmin=!1,e.on=u.get("lab-on")?u.get("lab-on")==="1":a?.dataset.on==="1",e.openId=null,e.closeFast=!1,e.cardFull=!1,e.draft=null;let O=()=>`lab-spot:${e.page}`,B=t=>u.set(O(),t?JSON.stringify(t):""),J=()=>{try{return JSON.parse(u.get(O())||"null")}catch{return null}},q=document.createElement("div");q.setAttribute("data-lab-comments",""),q.style.cssText="position:absolute;top:0;left:0;width:0;height:0;z-index:2147483000;";let P=q.attachShadow({mode:"open"});P.innerHTML=`
|
|
25
|
+
<style>${to}</style>
|
|
26
26
|
<div class="scrim"></div>
|
|
27
27
|
<div class="layer"></div>
|
|
28
28
|
<button class="sel-chip" type="button" hidden>Comment</button>
|
|
@@ -43,4 +43,4 @@ ${r}`:n.push({text:r,gap:a>0&&p===0||!!c})})}return n.map(a=>{let o=ze("span",{c
|
|
|
43
43
|
<button class="toggle" type="button"></button>
|
|
44
44
|
<button class="secondary more" type="button" hidden aria-label="more options" aria-expanded="false" aria-controls="lab-more">\u22EF</button>
|
|
45
45
|
</div>
|
|
46
|
-
<div class="more-menu" id="lab-more" hidden></div>`;let F=(t,l=B)=>l.querySelector(t),J=F(".layer"),oe=F(".hint");matchMedia("(pointer: coarse)").matches&&(oe.textContent="hold to comment");let H=F(".toggle"),se=B.querySelector(".bar"),ae=F(".more"),U=F(".more-menu"),xe=F(".copy-all"),ye=F(".list-btn"),he=F(".go-btn"),Ue=F(".new-prev"),Be=F(".show-done"),Ce=F(".done-btn"),Pe=F(".pause-btn"),Xe=F(".over-btn"),at=!1,Gt={base:""};e.showDone=u.get("lab-show-done")==="1";let Ze=F(".new-next"),Je=F(".send-all"),y=F(".list"),A=F(".hold",y),P=F(".chatwin"),W=B.querySelector(".chat-btn");e.listOpen=!1,e.filter="open",e.refit=()=>{},e.chatOpen=!1;let N=(t,l={},w)=>{let z=document.createElement(t);for(let[R,Z]of Object.entries(l))z.setAttribute(R,Z);return w instanceof Node?z.append(w):w!=null&&(z.textContent=w),z};ro({host:D,layer:J,el:N,store:u}),go({el:N,store:u,root:B,refreshPinCursor:()=>un(),syncReads:()=>sn(),rememberMe:_,whileWriting:()=>$t()}),xo({el:N,mine:t=>Mt(t),repliesOf:t=>ln(t),workState:t=>Re(t)});function K(t,l){let w=new Set(l);for(let R of Array.from(t.childNodes))w.has(R)||R.remove();let z=t.firstChild;for(let R of l)R===z?z=z.nextSibling:t.insertBefore(R,z)}let ce=["claude","codex","cursor","gemini","antigravity","copilot","amp","opencode"],j=t=>{if(!t?.session)return"";let l=String(t.session.kind||t.name||"").trim().split(/\W/)[0].toLowerCase();return ce.includes(l)?l==="antigravity"?"gemini":l:""},te=()=>({"content-type":"application/json",...T?{"x-lab-admin":T}:{}});e.gone=!1,e.loaded=!1,e.retried=!1;let G=()=>!!B.activeElement||[...B.querySelectorAll("textarea")].some(t=>t.value.trim());async function me(){try{let t=await fetch(`${d}?page=${encodeURIComponent(e.page)}`,{headers:te(),cache:"no-store"});if(t.status===404&&!e.loaded&&a?.dataset.enable!=="always"){if(!e.retried){e.retried=!0,setTimeout(me,1500);return}e.gone=!0,e.on=!1,document.documentElement.classList.remove("lab-pinning"),D.remove(),ue.remove();return}if(!t.ok)throw new Error(String(t.status));let l=await t.json();if(e.comments=l.comments||[],e.isAdmin=!!l.admin,!e.loaded&&!e.openId){let w=e.comments.find(z=>!z.parent&&u.get(`lab-typing:${e.page}:${z.id}`));w?e.openId=w.id:!e.draft&&u.get(`lab-typing:${e.page}:new`)&&Q()&&(e.draft={anchor:Q()})}e.loaded=!0}catch{}De()}async function ie(t){try{let l=new URL("/_lab/api/changes",new URL(d,location.href));l.search=String(new URLSearchParams({page:e.page,since:String(t)}));let w=await fetch(l,{cache:"no-store"}),z=w.ok?await w.json():{full:!0};if(z.full||!e.loaded)return me();let R=new Set(z.del),Z=new Map(z.set.map(V=>[V.id,V]));e.comments=e.comments.filter(V=>!R.has(V.id)).map(V=>Z.get(V.id)||V);let de=new Set(e.comments.map(V=>V.id));for(let V of z.set)de.has(V.id)||e.comments.push(V);e.comments.sort((V,Ee)=>V.createdAt.localeCompare(Ee.createdAt))}catch{return me()}De()}function De(){!G()&&!e.grabbing?Y():(e.openCard?.isConnected&&e.openCard.sync(),e.chatOpen&&Jt(),Ye())}e.goMode=u.get("lab-go")==="1",e.cursorMode=u.get("lab-cursor")==="1",e.overControls=u.get("lab-over")==="1";let An=()=>{Xe.textContent=e.overControls?"controls keep clicks":"pin over controls",Xe.setAttribute("aria-pressed",String(e.overControls))},Bo=t=>{e.overControls=t,u.set("lab-over",t?"1":""),An(),e.ctlTarget=null,e.recheckCtl?.(),$t()};An();let $t=()=>{let t=e.on&&!e.cursorMode&&!ho();document.documentElement.classList.toggle("lab-pinning",t),document.documentElement.classList.toggle("lab-go",t&&e.goMode&&!e.zoomMode),Me()},Qt=t=>{t&&e.zoomMode&&_e(""),e.cursorMode=t,u.set("lab-cursor",t?"1":""),he.classList.toggle("cursor",t),he.classList.toggle("on",e.goMode&&!t),nn(),$t()},en=t=>{e.cursorMode&&Qt(!1),e.zoomMode&&_e(""),e.goMode=t,queueMicrotask(nn),u.set("lab-go",t?"1":""),he.classList.toggle("on",t),he.setAttribute("aria-pressed",String(t&&!e.cursorMode)),document.documentElement.classList.toggle("lab-go",e.on&&t),ke.classList.toggle("go",t),Me()};function Lt(t){let l=u.get("lab-name").trim(),w=e.zoomMode;if(w&&(t={...t,zoom:w}),!e.goMode&&!w||!l)return e.draft={anchor:t,go:e.goMode&&!w},I(t),Y();let z=w?Tn(w):"go";if(vt())return u.set(_t(),JSON.stringify([...it(),{name:l,text:z,anchor:t}])),Y();Ve({name:l,text:z,anchor:t}).then(({comment:R,edit:Z})=>{Z&&u.set(`lab-edit:${R.id}`,Z),e.comments.push(R),ct([R]),e.posted=R.id,w&&t.block&&_n(t.block,w),Y()}).catch(()=>(e.draft={anchor:t},I(t),Y()))}async function Ve(t){let l=null;!t.action&&!t.nonce&&(t={...t,nonce:Math.random().toString(36).slice(2)+Date.now().toString(36)});for(let z=0;!l;z++)try{l=await fetch(d,{method:"POST",headers:te(),body:JSON.stringify({page:e.page,...t})})}catch{if(z>=150)throw new Error("couldn't reach the lab; your text is still here");await new Promise(R=>setTimeout(R,2e3))}let w=await l.json().catch(()=>({}));if(!l.ok)throw new Error(w.error||`could not save (${l.status})`);return w.comment&&!t.parent&&!t.action&&t.anchor?.kind!=="page"&&Ge.push(w.comment.id),w}let Ge=[];async function Po(){let t=Ge.pop(),l=t&&e.comments.find(z=>z.id===t);if(!l)return;let w=u.get(`lab-edit:${t}`);try{if(e.isAdmin)await Ve({action:"delete",id:t}),e.comments=e.comments.filter(z=>z.id!==t&&z.parent!==t);else if(w){let{comment:z}=await Ve({action:"resolve",id:t,edit:w});Object.assign(l,z)}else return void Ge.push(t)}catch{return void Ge.push(t)}e.openId===t&&(e.openId=null),Y(),zn(`took back ${l.anchor?.zoom?"a zoom":/^go$/i.test(l.text.trim())?"a go":"a pin"} \xB7 ${Ge.length?"again for the one before":"nothing more to take back"}`)}let rt={was:void 0,t:void 0};function zn(t){rt.was??=oe.textContent,oe.textContent=t,oe.hidden=!1,clearTimeout(rt.t),rt.t=setTimeout(()=>{oe.hidden=!0,oe.textContent=rt.was,rt.was=void 0},1800)}let Do=()=>new URL("/_lab/agent"+e.page,new URL(d,location.href)).href;async function qo(t,l){let w=await t;try{await navigator.clipboard.writeText(w)}catch{let R=document.createElement("textarea");R.value=w,R.style.cssText="position:fixed;opacity:0;",document.body.append(R),R.select(),document.execCommand("copy"),R.remove()}if(U.contains(l))return zn("link copied");let z=l.textContent;l.style.width=`${l.getBoundingClientRect().width}px`,l.style.justifyContent="center",l.textContent="copied",setTimeout(()=>{l.textContent=z,l.style.width=l.style.justifyContent=""},1400)}let st=()=>e.comments.filter(t=>!t.parent),_t=()=>`lab-held:${e.page}`,it=()=>{try{return JSON.parse(u.get(_t())||"[]")}catch{return[]}},Ho=()=>st().filter(t=>t.anchor?.kind!=="page").filter(t=>e.filter==="new"?lt(t).length:e.filter==="open"?!t.resolved:e.filter==="resolved"?t.resolved:Mt(t)).sort((t,l)=>t.createdAt.localeCompare(l.createdAt)),On=t=>t.anchor?.kind==="page";e.stepping=!1,e.keepKeys=!1;let Io=t=>t.resolved||Re(t)[0]==="done",tn=(t,l,w)=>{let z=N("span",{class:"kw"});return z.append(t,N("span",{class:"mn","aria-hidden":"true"},`(${l})`),w),z},Ct=null,Wo=()=>{if(Ct)return Ct;let t=Object.keys(h);if(!t.length||!T||!v)return Ct=[];let l=N("div",{class:"trying-head"},"trying"),w=t.map(z=>{let R=N("button",{class:"trying",type:"button",role:"switch","aria-checked":String(x(z))});return R.append(N("span",{class:"box","aria-hidden":"true"},x(z)?"\u2611":"\u2610"),h[z].name),R.addEventListener("click",async()=>{let Z=!x(z);h[z].on=Z,R.setAttribute("aria-checked",String(Z)),R.querySelector(".box").textContent=Z?"\u2611":"\u2610";try{await fetch(v,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({flag:z,on:Z})})}catch{}}),R});return Ct=[l,...w]};function Fo(){let t=e.on?[Ce,Pe,Xe,xe,H,...Wo()]:[];for(let w of t)w.parentNode!==U&&U.append(w);!e.on&&H.parentNode!==se&&se.insertBefore(H,ae),e.on||B.querySelector(".left").append(xe),ae.hidden=!e.on,!e.on&&!U.hidden&&ut(!1);let l=!0;for(let w of se.children)w.classList.toggle("first",l&&!w.hidden),w.hidden||(l=!1)}function nn(){let t=he.querySelector(".gp");t&&t.replaceChildren(...e.zoomMode?[Et(e.zoomMode),...matchMedia("(pointer: coarse)").matches?[]:[N("span",{class:"zw"},e.zoomMode)]]:[!e.goMode&&!e.cursorMode?dt(u.get("lab-name"))||"+":"go"]),he.setAttribute("aria-label",`a click places: ${e.zoomMode?`a zoom ${e.zoomMode}`:e.cursorMode?"nothing (pointer)":e.goMode?"go":"a comment"}`),he.setAttribute("aria-keyshortcuts",[o.comment,o.go,o.zoom,o.pointer].join(" "))}let Ko=t=>{let l=Math.max(0,Math.round((Date.now()-new Date(t).getTime())/6e4));return l<1?"just now":l<60?`${l} min`:`${Math.floor(l/60)} h ${l%60} min`};e.replyTo=null,e.newFrom=null;let on=t=>e.comments.filter(l=>!l.parent&&!l.resolved).sort((l,w)=>l.createdAt.localeCompare(w.createdAt)).indexOf(t)+1,an=()=>`lab-seen:${e.page}`,Nn=()=>new Set(u.get(an()).split(",").filter(Boolean));e.seen=Nn();let rn=t=>String(t||"").replace(/\s+/g," ").trim().toLowerCase(),Mt=t=>rn(t.name)&&rn(t.name)===rn(u.get("lab-name"))||!!u.get(`lab-edit:${t.id}`),Rn=t=>!e.seen.has(t.id)&&!Mt(t),lt=t=>[t,...ln(t.id)].filter(Rn),ct=t=>{let l=t.filter(w=>!e.seen.has(w.id)).map(w=>w.id);for(let w of t)e.seen.add(w.id);u.set(an(),[...e.seen].join(",")),l.length&&Bn(l)},Tt=a?.dataset.live?a.dataset.live.replace(/live$/,"api/reads"):"",Bn=t=>{let l=u.get("lab-name").trim();!Tt||!l||!t.length||fetch(Tt,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:l,page:e.page,ids:t})}).catch(()=>{})};async function sn(){let t=u.get("lab-name").trim();if(!Tt||!t)return;let l=e.page;try{let{ids:w}=await(await fetch(`${Tt}?name=${encodeURIComponent(t)}&page=${encodeURIComponent(l)}`,{cache:"no-store"})).json();if(l!==e.page)return;let z=new Set(w),R=[...e.seen].filter(de=>!z.has(de)),Z=w.filter(de=>!e.seen.has(de));if(R.length&&Bn(R),!Z.length)return;for(let de of Z)e.seen.add(de);u.set(an(),[...e.seen].join(",")),De()}catch{}}let ln=t=>e.comments.filter(l=>l.parent===t),dt=t=>[...String(t||"").trim()][0]?.toUpperCase()||"",jo=()=>{let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("viewBox","0 0 64 64"),t.setAttribute("class","agentmark"),t.setAttribute("aria-hidden","true"),t.innerHTML='<g transform="translate(-1 -.5)" fill="currentColor"><path d="M18.9 24.67L24.4 3h11.5L31.28 21.2A22.8 22.8 0 0 0 18.9 24.67Z"/><path 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 cx="31" cy="45" r="6.2" fill="var(--_bg)"/></g>',t},Yo=t=>!!t.session||t.from==="agent",Uo=()=>(yt(0),xt.y);e.shown=null,e.posted=null;let At=matchMedia("(prefers-reduced-motion: reduce)"),pt=new Map;e.faces=new Map,e.dropDrag=null;function Y(){e.grabbing=!1,e.dropDrag?.();let t=J.querySelector(".card:not(.out), .float:not(.out)"),l=e.stepping&&re&&t?t.offsetHeight:0,w=t?.querySelector(".body"),z=w?w.scrollTop:null,R=w?w.scrollHeight-w.scrollTop-w.clientHeight<48:!1,Z=new Map(e.on?st().filter(L=>L.anchor?.kind!=="page").map(L=>[L.id,je(L.anchor||{})]):[]);J.replaceChildren(),pt.clear();let de=e.on?e.draft||e.openId:null,V=de!==e.shown,Ee=V?" in":"",Te=null,et=()=>{if(e.closeFast&&!de&&t){e.closeFast=!1,t.inert=!0,J.append(t);let L=()=>t.remove();At.matches||!t.animate?L():t.animate([{opacity:1},{opacity:0}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(L,L)}else if(re&&!de&&e.shown&&t&&!At.matches&&!t.style.transform){t.classList.remove("in"),t.classList.add("out"),t.inert=!0,J.append(t);let L=e.posted&&pt.get(e.posted),ne=L?.getBoundingClientRect();L&&(L.style.animationDelay="250ms");let $e=wn(t,0,ne&&{x:ne.left+ne.width/2,y:ne.top+ne.height/2});setTimeout(()=>(t.remove(),kn(t),t.classList.contains("float")&&Sn()),$e)}if(re&&t?.classList.contains("float")&&!t.classList.contains("out")&&!B.querySelector(".float:not(.out)")&&setTimeout(Sn,320),re){let L=B.querySelector(".card:not(.out), .float:not(.out)")||(e.listOpen?y:e.chatOpen?P:null),ne=L&&(e.draft?"draft":e.openId||(e.listOpen?"list":e.chatOpen?"chat":""));L&&ne!==e.sheetKey&&vn(L),e.sheetKey=ne,V&&e.draft&&requestAnimationFrame(So)}Ft(Te),e.shown=de,e.posted=null},He=st(),Dt=He.filter(L=>!L.resolved&&L.anchor?.kind!=="page").length,qt=He.filter(L=>!L.resolved&&L.anchor?.kind!=="page").reduce((L,ne)=>L+lt(ne).length,0);if(H.replaceChildren(document.createTextNode((e.on?"hide comments":Dt?`comments \xB7 ${Dt}`:"comments")+(!e.on&&qt?` \xB7 ${qt} new`:"")),N("kbd",{"aria-hidden":"true"},o.toggle)),H.classList.toggle("secondary",e.on),D.toggleAttribute("data-sheet",!!(e.on&&(e.draft||e.openId||e.listOpen||e.chatOpen))),re&&V&&de&&(D.setAttribute("data-opening",""),requestAnimationFrame(()=>requestAnimationFrame(()=>D.removeAttribute("data-opening")))),document.documentElement.classList.toggle("lab-sheet",D.hasAttribute("data-sheet")),En(),e.refit(),$t(),xe.hidden=!e.on||!e.isAdmin||He.every(L=>L.resolved),Ye(),Jt(),Mn(),!e.on)return et();for(let L of it()){let{left:ne,top:$e}=je(L.anchor),be=N("div",{class:"pin held",title:`${L.name}: ${L.text} \xB7 draft, not sent yet`},dt(L.name));be.style.left=`${ne}px`,be.style.top=`${$e}px`,J.append(be)}if(He.forEach(L=>{if(On(L)||!e.showDone&&e.openId!==L.id&&(L.resolved||Re(L)[0]==="done")&&!lt(L).length)return;let{left:ne,top:$e,moved:be,zone:ee}=Z.get(L.id)||je(L.anchor||{});e.openId===L.id&&Kt(ee,`saved${Ee}`);let ve=lt(L),Ae=!ee&&(e.isAdmin||u.get(`lab-edit:${L.id}`)),[Se]=Re(L),le=N("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":""}${be?" moved":""}${e.posted===L.id?" in":""}${Ae?" grab":""}${e.openId===L.id?" open":""}`,type:"button",title:`${L.resolved?"":`${on(L)} \xB7 `}${L.name}${be?" \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?"":` ${on(L)}`} by ${L.name}${Se==="now"?", agent working on it":Se==="done"||L.resolved?", done":""}${ve.length?`, ${ve.length} new`:""}${be?", moved":""}`},Se==="done"||L.resolved?"\u2713":/^go$/i.test(L.text.trim())?"go":L.anchor?.zoom?Et(String(L.anchor.zoom).startsWith("in")?"in":"out"):x("agentPins")&&Yo(L)?jo():dt(L.name)),Ie=`${Se}${L.resolved?" resolved":""}${ve.length?" new":""}`,We=e.faces.get(L.id);e.faces.set(L.id,Ie);let fn=We!==void 0&&We!==Ie&&!At.matches;if(fn&&le.classList.add("swap"),Se==="now"?le.append(N("i",{class:`ring${fn&&!We.startsWith("now")?" come":""}`,"aria-hidden":"true"})):fn&&We.startsWith("now")&&le.append(N("i",{class:"ring gone","aria-hidden":"true"})),re&&le.append(N("i",{class:"hit","aria-hidden":"true"})),le.style.left=`${ne}px`,le.style.top=`${$e}px`,Ae&&Mo(le,L),!re&&ee&&e.openId!==L.id){let ge=null;le.addEventListener("pointerenter",()=>ge=Kt(ee,"saved")),le.addEventListener("pointerleave",()=>(ge?.remove(),ge=null))}else!re&&L.anchor?.quote&&!ee&&(le.addEventListener("pointerenter",()=>Ft(L.anchor)),le.addEventListener("pointerleave",()=>Ft(Te)));if(le.addEventListener("click",ge=>{if(ge.stopPropagation(),!le.dataset.dragged){if(re&&e.openId!==L.id)return nt(L);e.openId=e.openId===L.id?null:L.id,e.draft=null,Y()}}),J.append(le),pt.set(L.id,le),e.openId===L.id){let ge=To(L,new Set(ve.map(Le=>Le.id)),V&&(re?e.keepKeys:!e.stepping||e.keepKeys));if(e.openCard=ge,V&&!e.stepping&&ge.classList.add("in"),l&&(ge.style.minHeight=`min(${l}px, var(--_sheet-max))`),e.stepping=e.keepKeys=!1,Ln(ge,ee?ne+14:ne,ee?ee.top+ee.height:$e),!V&&z!=null){let Le=ge.querySelector(".body");Le.scrollTop=R?Le.scrollHeight:z}else if(V){let Le=ge.querySelector(".body"),Vn=re?null:Le.querySelector(".fresh, .newline");Le.scrollTop=Vn?Vn.offsetTop-Le.offsetTop-8:Le.scrollHeight}re&&e.cardFull&&ge.classList.add("full"),St(ge,()=>(e.openId=null,e.cardFull=!1,Y()),!0),ct(ve),ve.length&&Ye(),Te=ee?null:L.anchor}}),e.draft){let{anchor:L}=e.draft,{left:ne,top:$e,zone:be}=je(L);Kt(be,"draft"),Te=be?null:L;let ee=L.zoom,ve=N("div",{class:`pin draft${ee?" zoom":""}${Ee}`},ee?Et(ee):dt(u.get("lab-name")));ve.style.left=`${ne}px`,ve.style.top=`${$e}px`,J.append(ve);let Ae=N("div",{class:`float${Ee}`});Ae.append(N("div",{class:"handle"}),xn({placeholder:ee==="in"?"zoom in: what to go deeper into (or just send)":ee==="out"?"zoom out: what to see around it (or just send)":e.draft.go?"go":"add a comment",empty:ee?Tn(ee):e.draft.go?"go":"",nameFirst:!!(e.draft.go||ee),autofocus:!0,draftKey:`lab-typing:${e.page}:new`,onSubmit:async(Se,le)=>{if(vt())return u.set(_t(),JSON.stringify([...it(),{name:Se,text:le,anchor:L}])),e.draft=null,I(null),Y();let{comment:Ie,edit:We}=await Ve({name:Se,text:le,anchor:L});We&&u.set(`lab-edit:${Ie.id}`,We),ee&&L.block&&_n(L.block,ee),e.comments.push(Ie),ct([Ie]),e.draft=null,I(null),e.openId=null,e.posted=Ie.id,ko(),Y()}})),St(Ae,()=>(e.draft=null,I(null),Y())),be?Ln(Ae,ne+14,be.top+be.height):Co(Ae,ne,$e)}et()}e.grabbing=!1,e.openCard=null;let re=matchMedia("(pointer: coarse)").matches,Pn=()=>{u.get("lab-hint-seen")!=="1"&&(oe.hidden=!1,u.set("lab-hint-seen","1"),setTimeout(()=>oe.hidden=!0,5e3))},Dn=t=>{e.on=t,e.on?Me():ke.classList.remove("show"),u.set("lab-on",e.on?"1":"0"),e.on&&Pn(),e.draft=null,e.openId=null,Y()};H.addEventListener("click",()=>Dn(!e.on));function ut(t,l=!1){U.hidden=!t,ae.setAttribute("aria-expanded",String(t)),t?[...U.querySelectorAll("button")].find(w=>!w.hidden&&!w.disabled)?.focus({preventScroll:!0}):l&&ae.focus({preventScroll:!0})}ae.addEventListener("click",t=>{t.stopPropagation(),ut(U.hidden)}),U.addEventListener("click",()=>setTimeout(()=>ut(!1,!0),0)),addEventListener("pointerdown",t=>{!U.hidden&&!t.composedPath().some(l=>l===U||l===ae)&&ut(!1)},!0),addEventListener("keydown",t=>{t.key==="Escape"&&!U.hidden&&(ut(!1,!0),t.stopPropagation())},!0),he.addEventListener("click",()=>{if(e.zoomMode==="in")return _e("out");if(e.zoomMode==="out")return _e(""),en(!1);if(e.goMode&&!e.cursorMode)return _e("in");en(!0)}),Ue.addEventListener("click",()=>ot(-1)),Ce.addEventListener("click",()=>Be.click()),e.paused=null;let Xo=t=>{let l=t.effect?.target;return!!l&&l.getRootNode()!==B},qn=()=>{for(let t of document.getAnimations())!Xo(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))};Xe.addEventListener("click",()=>Bo(!e.overControls)),Pe.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(qn,100)},qn();Pe.textContent=e.paused?"play motion":"pause motion",Pe.setAttribute("aria-pressed",String(!!e.paused))}),Be.addEventListener("click",()=>{e.showDone=!e.showDone,u.set("lab-show-done",e.showDone?"1":""),Y()}),Ze.addEventListener("click",()=>ot(1));let zt=()=>{e.on||(e.on=!0,u.set("lab-on","1"))};xe.addEventListener("click",()=>qo(Do(),xe)),addEventListener("lab-goto",t=>{let l=document.getElementById(t.detail);l&&(re&&(e.openId=null,e.chatOpen=!1,e.listOpen=!1,Y()),setTimeout(()=>Cn(l),re?60:0))}),ye.addEventListener("click",()=>at?(e.listOpen=!e.listOpen,e.listOpen&&(e.filter="new"),e.chatOpen=!1,oe.hidden=!0,Y()):ot(1)),y.querySelector(".x").addEventListener("click",()=>Xt(y,()=>(e.listOpen=!1,Y()))),W.addEventListener("click",()=>{e.chatOpen=!e.chatOpen,e.listOpen=!1,e.chatOpen&&!re&&(e.openId=null,e.draft&&!B.querySelector(".float textarea")?.value.trim()&&(e.draft=null)),oe.hidden=!0,Y(),e.chatOpen&&!re&&P.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 l=t.composedPath();if(!(l.includes(P)||l.includes(W))){if(e.chatOpen=!1,l.includes(D))return void addEventListener("click",()=>Y(),{once:!0});e.closingClick=!0,Y()}},!0),addEventListener("click",t=>{e.closingClick&&(e.closingClick=!1,t.preventDefault(),t.stopImmediatePropagation())},!0);for(let t of y.querySelectorAll("[data-f]"))t.addEventListener("click",()=>(e.filter=t.dataset.f,Ye()));A.addEventListener("click",()=>(u.set("lab-hold",vt()?"":"1"),Ye())),Je.addEventListener("click",async()=>{let t=it();for(let l=0;l<t.length;l++)try{let{comment:w,edit:z}=await Ve(t[l]);z&&u.set(`lab-edit:${w.id}`,z),e.comments.push(w),ct([w]),u.set(_t(),JSON.stringify(t.slice(l+1)))}catch{Je.textContent="send failed, try again";return}Y()});let Qe=t=>t.composedPath().some(l=>l instanceof HTMLElement&&(l.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(l.tagName)));document.addEventListener("keydown",t=>{if(e.gone)return;let l=document.activeElement?.localName.includes("-")&&document.activeElement!==D;if(r(t)==="toggle"&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&!Qe(t)&&!l){t.preventDefault(),Dn(!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")&&!Qe(t)&&!l&&Ge.length)return t.preventDefault(),void Po();if(e.on&&t.ctrlKey&&!t.metaKey&&!t.altKey&&t.code==="KeyD"&&!(Qe(t)&&!t.composedPath().includes(D))){t.preventDefault();let R=B.querySelector(".card textarea, .float textarea");return R?.value.trim()?R.closest(".card, .float")?.animate([{transform:"none"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"none"}],{duration:260}):ot(t.shiftKey?-1:1)}let w=r(t);if(e.on&&["comment","go","zoom","pointer"].includes(w)&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&!Qe(t)&&!l){if(t.preventDefault(),w==="zoom")return _e(e.zoomMode==="in"?"out":"in");e.zoomMode&&_e(""),w==="pointer"?Qt(!0):en(w==="go");return}let z=/^[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&&!Qe(t)&&!l&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&No(t,z))return t.preventDefault();if(e.on&&!Qe(t)&&!l&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&["pause","chat","next","done","reply","resolve"].includes(w)){let R=w;if(t.preventDefault(),R==="pause")return Pe.click();if(R==="chat")return W.click();if(R==="next")return ot(t.shiftKey?-1:1);if(R==="done")return Be.click();R==="reply"&&e.openId?B.querySelector(".card textarea")?.focus({preventScroll:!0}):R==="resolve"&&e.openId&&e.isAdmin&&[...B.querySelectorAll(".card .btn")].find(Z=>/^(resolve|reopen)$/.test(Z.textContent))?.click();return}t.key==="Escape"&&(e.draft||e.openId)?(e.draft=null,e.openId=null,Y()):t.key==="Escape"&&(e.chatOpen||e.listOpen)&&(e.chatOpen?e.chatOpen=!1:e.listOpen=!1,Y())});let Hn='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]',In=t=>document.documentElement.classList.toggle("lab-ctl",!e.overControls&&!D.contains(t)&&t!==D&&Ot(t));e.recheckCtl=()=>e.mouse&&In(document.elementFromPoint(e.mouse.x,e.mouse.y));let Ot=t=>{if(e.overControls)return!1;for(let l=t instanceof Element?t:null;l&&l!==document.body&&l!==document.documentElement;l=l.parentElement)if(l.matches(Hn)||getComputedStyle(l).cursor==="pointer")return!0;return!1},fe="[data-uncommentable]";e.drag=null,e.afterDrag=!1,e.liveZone=null,e.zoneFrame=0;let Nt=12,Zo=()=>{if(e.zoneFrame=0,!e.drag?.active||!e.liveZone)return;let t=(z,R)=>{let Z=Math.max(Math.abs(R-z),Nt);return{start:(z+R)/2-Z/2,size:Z}},l=t(e.drag.x0,e.drag.x1),w=t(e.drag.y0,e.drag.y1);e.liveZone.style.transform=`translate3d(${l.start+scrollX}px, ${w.start+scrollY}px, 0)`,e.liveZone.style.width=`${l.size}px`,e.liveZone.style.height=`${w.size}px`},Wn=()=>!!e.draft&&[...B.querySelectorAll(".float textarea")].some(t=>t.value.trim());function Jo(t){!e.on&&!t.altKey||e.cursorMode&&!t.altKey||Wn()||t.button!==0||t.pointerType==="touch"||t.metaKey||t.ctrlKey||t.shiftKey||t.composedPath().includes(D)||!t.altKey&&Ot(t.target)||t.target instanceof Element&&t.target.closest(fe)||(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||Wn()||t.button!==0||t.pointerType==="touch"||t.metaKey||t.ctrlKey||t.shiftKey||t.composedPath().includes(D)||!t.altKey&&Ot(t.target)||t.target instanceof Element&&t.target.closest(fe)||(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=bn("draft live"),J.append(e.liveZone)),e.drag.active&&(t.preventDefault(),e.zoneFrame||=requestAnimationFrame(Zo)))},!0);let cn=t=>{if(!e.drag)return;let l=e.drag;if(e.drag=null,document.documentElement.classList.remove("lab-dragging"),cancelAnimationFrame(e.zoneFrame),e.zoneFrame=0,e.liveZone?.remove(),e.liveZone=null,!(!l.active||t.type==="pointercancel")){e.afterDrag=!0,setTimeout(()=>e.afterDrag=!1,0),getSelection?.()?.removeAllRanges();for(let[w,z]of[["x0","x1"],["y0","y1"]]){if(Math.abs(l[z]-l[w])>=Nt)continue;let R=(l[w]+l[z])/2;l[w]=R-Nt/2,l[z]=R+Nt/2}zt(),e.openId=null,Lt(fo(l))}};document.addEventListener("pointerup",cn,!0),document.addEventListener("pointercancel",cn,!0),document.addEventListener("dragstart",t=>{let l=e.on&&t.target instanceof Element&&t.target.closest("img, video")&&!t.composedPath().includes(D);(e.drag||l)&&t.preventDefault()},!0),document.addEventListener("click",t=>{e.afterDrag&&(t.preventDefault(),t.stopPropagation())},!0);let Fn=t=>t.altKey&&!t.metaKey&&!t.ctrlKey&&t.button===0&&!t.composedPath().includes(D)&&!(t.target instanceof Element&&t.target.closest(fe));for(let t of["pointerdown","mousedown","pointerup","mouseup"])addEventListener(t,l=>{Fn(l)&&(l.preventDefault(),l.stopImmediatePropagation(),t==="pointerdown"&&Jo(l),t==="pointerup"&&cn(l))},!0);addEventListener("click",t=>{Fn(t)&&(t.preventDefault(),t.stopImmediatePropagation(),e.afterDrag||Un(t))},!0),e.ctlClick=!1,addEventListener("click",t=>e.ctlClick=Ot(t.target),!0),document.addEventListener("click",t=>Un(t)),e.lastTouch=0,e.pinnedByHold=!1;let mt=B.querySelector(".sel-chip"),dn=B.querySelector(".scrim"),Kn=()=>B.querySelector(".card:not(.out), .float:not(.out)")||(e.listOpen?y:e.chatOpen?P:null),Vo=()=>{e.draft=null,e.openId=null,e.listOpen=!1,e.chatOpen=!1,Y()},jn=()=>{let t=Kn();if(![...B.querySelectorAll("textarea")].some(l=>l.value.trim()&&!P.contains(l)))return Xt(t,Vo);t?.animate?.([{transform:"none"},{transform:"translateY(12px)"},{transform:"none"}],{duration:260,easing:"ease-out"})};e.sheetDraggedAt=-1e9,dn.addEventListener("click",()=>performance.now()-e.sheetDraggedAt>300&&jn()),dn.addEventListener("touchmove",t=>t.preventDefault(),{passive:!1}),e.backWatcher=null;let Go=window.visualViewport;Eo();let qe=F(".msgs",P);e.stick=!0,qe.addEventListener("scroll",()=>e.stick=qe.scrollHeight-qe.scrollTop-qe.clientHeight<48,{passive:!0}),"ResizeObserver"in window&&new ResizeObserver(()=>e.stick&&(qe.scrollTop=qe.scrollHeight)).observe(qe),St(y,()=>(e.listOpen=!1,Y())),St(P,()=>(e.chatOpen=!1,Y()),!0),e.press=null;let ft=()=>e.press&&(clearTimeout(e.press.timer),e.press=null),Rt=t=>{let l=document.documentElement;if(t)return l.classList.add("lab-press");l.classList.contains("lab-press")&&requestAnimationFrame(()=>{l.classList.remove("lab-press");let w=window.CSS?.highlights?.get("lab-quote");w&&CSS.highlights.set("lab-quote",new Highlight(...w))})};document.addEventListener("pointerdown",t=>{if(ft(),e.pinnedByHold=!1,t.pointerType==="touch"&&(e.lastTouch=Date.now()),t.pointerType!=="touch"||e.draft||!(t.target instanceof Element)||t.composedPath().includes(D)||t.target.closest(fe))return;let{clientX:l,clientY:w}=t;Rt(!0),e.press={x:l,y:w,timer:setTimeout(()=>{e.press=null,e.pinnedByHold=!0,navigator.vibrate?.(8),getSelection?.()?.removeAllRanges(),e.afterDrag=!0,setTimeout(()=>e.afterDrag=!1,800),zt(),e.openId=null,Lt(Ke(l,w))},400)}},!0),document.addEventListener("pointermove",t=>e.press&&Math.hypot(t.clientX-e.press.x,t.clientY-e.press.y)>10&&ft(),!0),document.addEventListener("pointerup",t=>{t.pointerType==="touch"&&(e.lastTouch=Date.now()),ft(),Rt(!1),e.pinnedByHold&&(B.querySelector(".float [data-first]")||B.querySelector(".float textarea"))?.focus({preventScroll:!0})},!0),document.addEventListener("touchend",t=>{Rt(!1),e.pinnedByHold&&(e.pinnedByHold=!1,t.preventDefault(),(B.querySelector(".float [data-first]")||B.querySelector(".float textarea"))?.focus({preventScroll:!0}))},{capture:!0,passive:!1}),document.addEventListener("pointercancel",()=>(ft(),Rt(!1)),!0),addEventListener("scroll",ft,{passive:!0,capture:!0}),document.addEventListener("contextmenu",t=>(e.press||e.afterDrag)&&t.preventDefault(),!0),e.selRect=null,document.addEventListener("selectionchange",()=>{let t=getSelection?.(),l=t?.rangeCount&&t.getRangeAt(0),w=String(t||"").trim(),z=l&&D.contains(l.commonAncestorContainer);if(e.selRect=re&&e.on&&!e.draft&&w&&l&&!z?l.getClientRects()[0]||l.getBoundingClientRect():null,mt.hidden=!e.selRect,!e.selRect)return;let R=e.selRect.bottom+52<innerHeight;mt.style.left=`${Math.min(Math.max(e.selRect.left+e.selRect.width/2,60),innerWidth-60)}px`,mt.style.top=`${R?e.selRect.bottom+10:Math.max(e.selRect.top-46,8)}px`});let Yn=()=>{let t=getSelection?.(),l=t?.rangeCount&&t.getRangeAt(0),w=String(t||"").replace(/\s+/g," ").trim();if(!l||!w||D.contains(l.commonAncestorContainer))return!1;let z=l.getClientRects(),R=z[0]||l.getBoundingClientRect(),Z=z[z.length-1]||R,de=l.startContainer.nodeType===1?l.startContainer:l.startContainer.parentElement,V=l.endContainer.nodeType===1?l.endContainer:l.endContainer.parentElement,Ee=de&&(de===V||de.contains(V))?Ke(Math.max(Z.left,Z.right-2),Z.top+Z.height/2):Ke(R.left+2,R.top+R.height/2),Te=l.commonAncestorContainer,et=(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,He=(Dt,qt)=>{let L=document.createRange();return L.setStart(...Dt),L.setEnd(...qt),String(L).replace(/\s+/g," ")};return Ee.kind="text",Ee.quote={exact:X(w,300),prefix:He([et,0],[l.startContainer,l.startOffset]).replace(/^\s+/,"").slice(-40),suffix:He([l.endContainer,l.endOffset],[et,et.childNodes.length]).replace(/\s+$/,"").slice(0,40)},t.removeAllRanges(),mt.hidden=!0,zt(),e.openId=null,Lt(Ee),!0};mt.addEventListener("click",t=>{t.stopPropagation(),e.selRect&&Yn()}),document.addEventListener("mouseup",t=>{e.on&&!e.cursorMode&&!e.draft&&t.shiftKey&&t.button===0&&!t.composedPath().includes(D)&&setTimeout(Yn,0)},!0);function Un(t){if(!t.composedPath().includes(D)){if(e.draft||e.openId){if([...B.querySelectorAll("textarea")].some(l=>l.value.trim()))return;e.draft=null,e.openId=null,Y();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(fe)||String(getSelection?.()||"").trim()||(zt(),Lt(Ke(t.clientX,t.clientY)))}}}let Qo=()=>{let t=st().filter(w=>w.anchor?.kind!=="page");if(!e.on||e.openId||t.length!==pt.size)return Y();let l=t.map(w=>[pt.get(w.id),je(w.anchor||{})]);if(l.some(([w])=>!w))return Y();for(let[w,{left:z,top:R,moved:Z}]of l)w.style.left=`${z}px`,w.style.top=`${R}px`,w.classList.toggle("moved",!!Z)};e.frame=0;let Bt=()=>{cancelAnimationFrame(e.frame),e.frame=requestAnimationFrame(()=>{e.draft||B.activeElement||e.grabbing||Qo()})};addEventListener("resize",Bt),addEventListener("scroll",t=>t.target!==document&&!D.contains(t.target)&&Bt(),{capture:!0,passive:!0});let pn=()=>{e.gone||(!D.isConnected&&document.body&&document.body.append(D),ue.isConnected||document.head.append(ue),gt.isConnected||document.head.append(gt),k()!==e.page&&(e.page=k(),e.seen=Nn(),sn(),e.comments=[],e.draft=null,e.openId=null,Y(),me()))};for(let t of["pushState","replaceState"]){let l=history[t];history[t]=function(...w){let z=l.apply(this,w);return queueMicrotask(pn),z}}addEventListener("popstate",pn),document.addEventListener("astro:after-swap",pn),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&!e.draft&&!B.activeElement&&me()}),"ResizeObserver"in window&&new ResizeObserver(Bt).observe(document.body);let ue=document.createElement("style");a?.dataset.fontUrl&&(ue.textContent=`@font-face{font-family:'lab comments';font-display:swap;src:url('${new URL(a.dataset.fontUrl,a.src||location.href)}') format('woff2');}`);let Xn=a?.dataset.fontUrl?"lab comments":a?.dataset.font;Xn&&D.style.setProperty("--lab-font",`'${Xn.replace(/'/g,"")}', system-ui, sans-serif`);let gt=document.createElement("style"),ke=N("div",{class:"ptr","aria-hidden":"true"});ke.append(N("span",{class:"ini"},"+"),N("span",{class:"tick"},"go")),B.append(ke),e.mouse=null;let Zn=(t,l,w)=>{let z=!!w&&w!==D&&!D.contains(w)&&getComputedStyle(w).cursor==="none";ke.classList.toggle("show",z),ke.classList.toggle("go",e.goMode&&!e.zoomMode),ke.style.transform=`translate(${t-1}px, ${l-27}px)`},Me=()=>e.mouse&&requestAnimationFrame(()=>e.mouse&&Zn(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 l=t.composedPath()[0];l!==e.ctlTarget&&(e.ctlTarget=l,In(l)),Zn(t.clientX,t.clientY,l instanceof Element?l:null)},{capture:!0,passive:!0}),addEventListener("scroll",Me,{capture:!0,passive:!0}),addEventListener("keydown",t=>(t.key==="Shift"||t.key==="Alt")&&Me(),!0),addEventListener("keyup",t=>(t.key==="Shift"||t.key==="Alt")&&Me(),!0),document.documentElement.addEventListener("mouseleave",()=>(e.mouse=null,ke.classList.remove("show"))),addEventListener("blur",()=>(e.mouse=null,ke.classList.remove("show"))),e.cursorKey="";function un(){let t=e.zoomMode?`zoom-${e.zoomMode}`:(dt(u.get("lab-name"))||"+").replace(/[<>&'"]/g,"");if(t===e.cursorKey)return;e.cursorKey=t,ke.querySelector(".ini").replaceChildren(e.zoomMode?Et(e.zoomMode):t);let l=`:not(${Hn}, a *, button *, label *, [role="button"] *, [contenteditable], [contenteditable] *, ${fe}, ${fe} *, [data-lab-comments])`,w="dialog, dialog *, [popover], [popover] *, :fullscreen, :fullscreen *";gt.textContent=`@layer lab-pointer { html.lab-pinning:not(.lab-shift, .lab-ctl) body, html.lab-pinning:not(.lab-shift, .lab-ctl) body *${l} { 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 *${l}:not(${w}) { cursor: none; } html.lab-pinning body :is([contenteditable], [contenteditable] *) { cursor: text; } html.lab-pinning body :is(${fe}, ${fe} *) { cursor: auto; } }html.lab-alt body, html.lab-alt body *:not([data-lab-comments], [data-lab-comments] *, ${fe}, ${fe} *) { cursor: crosshair !important; }html.lab-drawn.lab-alt body, html.lab-drawn.lab-alt body *:not([data-lab-comments], [data-lab-comments] *, ${fe}, ${fe} *, ${w}) { cursor: none !important; }html.lab-go:not(.lab-drawn) body, html.lab-go:not(.lab-drawn) body * { cursor: copy !important; }`}ue.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 mn=t=>{clearTimeout(e.shiftOff),t.shiftKey?document.documentElement.classList.add("lab-shift"):e.shiftOff=setTimeout(()=>(document.documentElement.classList.remove("lab-shift"),Me()),400)};addEventListener("keydown",mn,!0),addEventListener("keyup",mn,!0),addEventListener("pointerdown",t=>{if(t.shiftKey)return mn(t);clearTimeout(e.shiftOff),document.documentElement.classList.remove("lab-shift")},!0),addEventListener("blur",()=>document.documentElement.classList.remove("lab-shift")),ue.textContent+="html.lab-dragging, html.lab-dragging * { user-select: none !important; -webkit-user-select: none !important; cursor: crosshair !important; }",ue.textContent+="html.lab-sheet, html.lab-sheet body { overscroll-behavior-y: none; }",ue.textContent+='@property --lab-arc { syntax: "<percentage>"; inherits: false; initial-value: 66%; }',ue.textContent+="html.lab-room body::after { content: ''; display: block; height: var(--lab-room, 0px); }",addEventListener("scroll",()=>{let t=document.documentElement,l=parseFloat(t.style.getPropertyValue("--lab-room"))||0;if(!l||D.hasAttribute("data-sheet"))return;let w=Math.max(0,Math.ceil(scrollY+innerHeight-(t.scrollHeight-l)));w>=l||(t.style.setProperty("--lab-room",`${w}px`),w||t.classList.remove("lab-room"))},{passive:!0}),ue.textContent+="@media (pointer: coarse) { html.lab-sheet, html.lab-sheet body { overflow: hidden; } }",ue.textContent+="html.lab-pinning body, html.lab-pinning body * { -webkit-touch-callout: none; }",ue.textContent+="@media (pointer: coarse) { html.lab-pinning.lab-press 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 Pt=t=>document.documentElement.classList.toggle("lab-alt",!!t);addEventListener("keydown",t=>t.key==="Alt"&&Pt(!0),!0),addEventListener("keyup",t=>t.key==="Alt"&&Pt(!1),!0),addEventListener("pointermove",t=>Pt(t.altKey),{capture:!0,passive:!0}),addEventListener("blur",()=>Pt(!1));let Jn=()=>{document.head.append(ue,gt),un(),e.on&&Pn(),document.body.append(D);let t="background-color: rgba(52, 199, 89, .3); color: inherit;";ue.textContent+=`html.lab-pinning ::selection { ${t} } ::highlight(lab-quote) { ${t} }`,me()};document.body?Jn():document.addEventListener("DOMContentLoaded",Jn),Ro(),zo()})();})();
|
|
46
|
+
<div class="more-menu" id="lab-more" hidden></div>`;let F=(t,c=P)=>c.querySelector(t),V=F(".layer"),oe=F(".hint");matchMedia("(pointer: coarse)").matches&&(oe.textContent="hold to comment");let H=F(".toggle"),re=P.querySelector(".bar"),ae=F(".more"),U=F(".more-menu"),xe=F(".copy-all"),ye=F(".list-btn"),he=F(".go-btn"),Xe=F(".new-prev"),Re=F(".show-done"),_e=F(".done-btn"),Be=F(".pause-btn"),Ze=F(".over-btn"),at=!1,tn={base:""};e.showDone=u.get("lab-show-done")==="1";let Je=F(".new-next"),Ve=F(".send-all"),x=F(".list"),A=F(".hold",x),D=F(".chatwin"),W=P.querySelector(".chat-btn");e.listOpen=!1,e.filter="open",e.refit=()=>{},e.chatOpen=!1;let N=(t,c={},v)=>{let z=document.createElement(t);for(let[R,Z]of Object.entries(c))z.setAttribute(R,Z);return v instanceof Node?z.append(v):v!=null&&(z.textContent=v),z};co({host:q,layer:V,el:N,store:u}),vo({el:N,store:u,root:P,refreshPinCursor:()=>gn(),syncReads:()=>dn(),rememberMe:E,whileWriting:()=>rt()}),So({el:N,mine:t=>Tt(t),repliesOf:t=>pn(t),workState:t=>Ne(t)});function K(t,c){let v=new Set(c);for(let R of Array.from(t.childNodes))v.has(R)||R.remove();let z=t.firstChild;for(let R of c)R===z?z=z.nextSibling:t.insertBefore(R,z)}let ce=["claude","codex","cursor","gemini","antigravity","copilot","amp","opencode"],j=t=>{if(!t?.session)return"";let c=String(t.session.kind||t.name||"").trim().split(/\W/)[0].toLowerCase();return ce.includes(c)?c==="antigravity"?"gemini":c:""},ne=()=>({"content-type":"application/json",...C?{"x-lab-admin":C}:{}});e.gone=!1,e.loaded=!1,e.retried=!1;let Q=()=>!!P.activeElement||[...P.querySelectorAll("textarea")].some(t=>t.value.trim());async function fe(){try{let t=await fetch(`${d}?page=${encodeURIComponent(e.page)}`,{headers:ne(),cache:"no-store"});if(t.status===404&&!e.loaded&&a?.dataset.enable!=="always"){if(!e.retried){e.retried=!0,setTimeout(fe,1500);return}e.gone=!0,e.on=!1,document.documentElement.classList.remove("lab-pinning"),q.remove(),ue.remove();return}if(!t.ok)throw new Error(String(t.status));let c=await t.json();if(e.comments=c.comments||[],e.isAdmin=!!c.admin,!e.loaded&&!e.openId){let v=e.comments.find(z=>!z.parent&&u.get(`lab-typing:${e.page}:${z.id}`));v?e.openId=v.id:!e.draft&&u.get(`lab-typing:${e.page}:new`)&&J()&&(e.draft={anchor:J()})}e.loaded=!0}catch{}Pe()}async function se(t){try{let c=new URL("/_lab/api/changes",new URL(d,location.href));c.search=String(new URLSearchParams({page:e.page,since:String(t)}));let v=await fetch(c,{cache:"no-store"}),z=v.ok?await v.json():{full:!0};if(z.full||!e.loaded)return fe();let R=new Set(z.del),Z=new Map(z.set.map(G=>[G.id,G]));e.comments=e.comments.filter(G=>!R.has(G.id)).map(G=>Z.get(G.id)||G);let de=new Set(e.comments.map(G=>G.id));for(let G of z.set)de.has(G.id)||e.comments.push(G);e.comments.sort((G,Ee)=>G.createdAt.localeCompare(Ee.createdAt))}catch{return fe()}Pe()}function Pe(){!Q()&&!e.grabbing?Y():(e.openCard?.isConnected&&e.openCard.sync(),e.chatOpen&&Qt(),Ue())}e.goMode=u.get("lab-go")==="1",e.cursorMode=u.get("lab-cursor")==="1",e.overControls=u.get("lab-over")==="1";let Ho=/Mac|iP(hone|ad|od)/.test(navigator.platform)?"\u2325":"alt",Nn=()=>{Ze.replaceChildren(e.overControls?"controls keep clicks":"pin over controls",...e.overControls?[]:[N("kbd",{"aria-hidden":"true"},`${Ho} click`)]),Ze.setAttribute("aria-pressed",String(e.overControls))},Wo=t=>{e.overControls=t,u.set("lab-over",t?"1":""),Nn(),rt(),e.ctlTarget=null,e.recheckCtl?.(),rt()};Nn();let rt=()=>{let t=e.on&&!e.cursorMode&&!wo();document.documentElement.classList.toggle("lab-pinning",t),document.documentElement.classList.toggle("lab-go",t&&e.goMode&&!e.zoomMode),document.documentElement.classList.toggle("lab-over",t&&e.overControls),Ce()},nn=t=>{t&&e.zoomMode&&Le(""),e.cursorMode=t,u.set("lab-cursor",t?"1":""),he.classList.toggle("cursor",t),he.classList.toggle("on",e.goMode&&!t),rn(),rt()},on=t=>{e.cursorMode&&nn(!1),e.zoomMode&&Le(""),e.goMode=t,queueMicrotask(rn),u.set("lab-go",t?"1":""),he.classList.toggle("on",t),he.setAttribute("aria-pressed",String(t&&!e.cursorMode)),document.documentElement.classList.toggle("lab-go",e.on&&t),ke.classList.toggle("go",t),Ce()};function Lt(t){let c=u.get("lab-name").trim(),v=e.zoomMode;if(v&&(t={...t,zoom:v}),!e.goMode&&!v||!c)return e.draft={anchor:t,go:e.goMode&&!v},B(t),Y();let z=v?On(v):"go";if(kt())return u.set(Ct(),JSON.stringify([...lt(),{name:c,text:z,anchor:t}])),Y();De({name:c,text:z,anchor:t}).then(({comment:R,edit:Z})=>{Z&&u.set(`lab-edit:${R.id}`,Z),e.comments.push(R),dt([R]),e.posted=R.id,v&&t.block&&Tn(t.block,v),Y()}).catch(()=>(e.draft={anchor:t},B(t),Y()))}async function De(t){let c=null;!t.action&&!t.nonce&&(t={...t,nonce:Math.random().toString(36).slice(2)+Date.now().toString(36)});for(let z=0;!c;z++)try{c=await fetch(d,{method:"POST",headers:ne(),body:JSON.stringify({page:e.page,...t})})}catch{if(z>=150)throw new Error("couldn't reach the lab; your text is still here");await new Promise(R=>setTimeout(R,2e3))}let v=await c.json().catch(()=>({}));if(!c.ok)throw new Error(v.error||`could not save (${c.status})`);return v.comment&&!t.parent&&!t.action&&t.anchor?.kind!=="page"&&Ge.push(v.comment.id),v}let Ge=[];async function Fo(){let t=Ge.pop(),c=t&&e.comments.find(z=>z.id===t);if(!c)return;let v=u.get(`lab-edit:${t}`);try{if(e.isAdmin)await De({action:"delete",id:t}),e.comments=e.comments.filter(z=>z.id!==t&&z.parent!==t);else if(v){let{comment:z}=await De({action:"resolve",id:t,edit:v});Object.assign(c,z)}else return void Ge.push(t)}catch{return void Ge.push(t)}e.openId===t&&(e.openId=null),Y(),_t(`took back ${c.anchor?.zoom?"a zoom":/^go$/i.test(c.text.trim())?"a go":"a pin"} \xB7 ${Ge.length?"again for the one before":"nothing more to take back"}`)}let Rn=t=>e.isAdmin||!!u.get(`lab-edit:${t.id}`);function Ko(t){let c=u.get(`lab-edit:${t.id}`),v=!!t.resolved;De({action:v?"reopen":"resolve",id:t.id,...c?{edit:c}:{}}).then(({comment:z})=>{Object.assign(t,z),!v&&e.openId===t.id&&(e.closeFast=!0,e.openId=null),Y(),_t(v?"open again":"resolved")},()=>_t("couldn't save that, try again"))}let st={was:void 0,t:void 0};function _t(t){st.was??=oe.textContent,oe.textContent=t,oe.hidden=!1,clearTimeout(st.t),st.t=setTimeout(()=>{oe.hidden=!0,oe.textContent=st.was,st.was=void 0},1800)}let jo=()=>new URL("/_lab/agent"+e.page,new URL(d,location.href)).href;async function Yo(t,c){let v=await t;try{await navigator.clipboard.writeText(v)}catch{let R=document.createElement("textarea");R.value=v,R.style.cssText="position:fixed;opacity:0;",document.body.append(R),R.select(),document.execCommand("copy"),R.remove()}if(U.contains(c))return _t("link copied");let z=c.textContent;c.style.width=`${c.getBoundingClientRect().width}px`,c.style.justifyContent="center",c.textContent="copied",setTimeout(()=>{c.textContent=z,c.style.width=c.style.justifyContent=""},1400)}let it=()=>e.comments.filter(t=>!t.parent),Ct=()=>`lab-held:${e.page}`,lt=()=>{try{return JSON.parse(u.get(Ct())||"[]")}catch{return[]}},Uo=()=>it().filter(t=>t.anchor?.kind!=="page").filter(t=>e.filter==="new"?ct(t).length:e.filter==="open"?!t.resolved:e.filter==="resolved"?t.resolved:Tt(t)).sort((t,c)=>t.createdAt.localeCompare(c.createdAt)),Bn=t=>t.anchor?.kind==="page";e.stepping=!1,e.keepKeys=!1;let Xo=t=>t.resolved||Ne(t)[0]==="done",an=(t,c,v)=>{let z=N("span",{class:"kw"});return z.append(t,N("span",{class:"mn","aria-hidden":"true"},`(${c})`),v),z},Mt=null,Zo=()=>{if(Mt)return Mt;let t=Object.keys(h);if(!t.length||!C||!k)return Mt=[];let c=N("div",{class:"trying-head"},"trying"),v=t.map(z=>{let R=N("button",{class:"trying",type:"button",role:"switch","aria-checked":String(y(z))});return R.append(N("span",{class:"box","aria-hidden":"true"},y(z)?"\u2611":"\u2610"),h[z].name),R.addEventListener("click",async()=>{let Z=!y(z);h[z].on=Z,R.setAttribute("aria-checked",String(Z)),R.querySelector(".box").textContent=Z?"\u2611":"\u2610";try{await fetch(k,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({flag:z,on:Z})})}catch{}}),R});return Mt=[c,...v]};function Jo(){let t=e.on?[_e,Be,Ze,xe,H,...Zo()]:[];for(let v of t)v.parentNode!==U&&U.append(v);!e.on&&H.parentNode!==re&&re.insertBefore(H,ae),e.on||P.querySelector(".left").append(xe),ae.hidden=!e.on,!e.on&&!U.hidden&&mt(!1);let c=!0;for(let v of re.children)v.classList.toggle("first",c&&!v.hidden),v.hidden||(c=!1)}function rn(){let t=he.querySelector(".gp");t&&t.replaceChildren(...e.zoomMode?[$t(e.zoomMode),...matchMedia("(pointer: coarse)").matches?[]:[N("span",{class:"zw"},e.zoomMode)]]:[!e.goMode&&!e.cursorMode?pt(u.get("lab-name"))||"+":"go"]),he.setAttribute("aria-label",`a click places: ${e.zoomMode?`a zoom ${e.zoomMode}`:e.cursorMode?"nothing (pointer)":e.goMode?"go":"a comment"}`),he.setAttribute("aria-keyshortcuts",[o.comment,o.go,o.zoom,o.pointer].join(" "))}let Vo=t=>{let c=Math.max(0,Math.round((Date.now()-new Date(t).getTime())/6e4));return c<1?"just now":c<60?`${c} min`:`${Math.floor(c/60)} h ${c%60} min`};e.replyTo=null,e.newFrom=null;let sn=t=>e.comments.filter(c=>!c.parent&&!c.resolved).sort((c,v)=>c.createdAt.localeCompare(v.createdAt)).indexOf(t)+1,ln=()=>`lab-seen:${e.page}`,Pn=()=>new Set(u.get(ln()).split(",").filter(Boolean));e.seen=Pn();let cn=t=>String(t||"").replace(/\s+/g," ").trim().toLowerCase(),Tt=t=>cn(t.name)&&cn(t.name)===cn(u.get("lab-name"))||!!u.get(`lab-edit:${t.id}`),Dn=t=>!e.seen.has(t.id)&&!Tt(t),ct=t=>[t,...pn(t.id)].filter(Dn),dt=t=>{let c=t.filter(v=>!e.seen.has(v.id)).map(v=>v.id);for(let v of t)e.seen.add(v.id);u.set(ln(),[...e.seen].join(",")),c.length&&qn(c)},At=a?.dataset.live?a.dataset.live.replace(/live$/,"api/reads"):"",qn=t=>{let c=u.get("lab-name").trim();!At||!c||!t.length||fetch(At,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:c,page:e.page,ids:t})}).catch(()=>{})};async function dn(){let t=u.get("lab-name").trim();if(!At||!t)return;let c=e.page;try{let{ids:v}=await(await fetch(`${At}?name=${encodeURIComponent(t)}&page=${encodeURIComponent(c)}`,{cache:"no-store"})).json();if(c!==e.page)return;let z=new Set(v),R=[...e.seen].filter(de=>!z.has(de)),Z=v.filter(de=>!e.seen.has(de));if(R.length&&qn(R),!Z.length)return;for(let de of Z)e.seen.add(de);u.set(ln(),[...e.seen].join(",")),Pe()}catch{}}let pn=t=>e.comments.filter(c=>c.parent===t),pt=t=>[...String(t||"").trim()][0]?.toUpperCase()||"",Go=()=>{let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("viewBox","0 0 64 64"),t.setAttribute("class","agentmark"),t.setAttribute("aria-hidden","true"),t.innerHTML='<g transform="translate(-1 -.5)" fill="currentColor"><path d="M18.9 24.67L24.4 3h11.5L31.28 21.2A22.8 22.8 0 0 0 18.9 24.67Z"/><path 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 cx="31" cy="45" r="6.2" fill="var(--_bg)"/></g>',t},Qo=t=>!!t.session||t.from==="agent",ea=()=>(vt(0),yt.y);e.shown=null,e.posted=null;let zt=matchMedia("(prefers-reduced-motion: reduce)"),ut=new Map;e.faces=new Map,e.dropDrag=null;function Y(){e.grabbing=!1,e.dropDrag?.();let t=V.querySelector(".card:not(.out), .float:not(.out)"),c=e.stepping&&ee&&t?t.offsetHeight:0,v=t?.querySelector(".body"),z=v?v.scrollTop:null,R=v?v.scrollHeight-v.scrollTop-v.clientHeight<48:!1,Z=new Map(e.on?it().filter(_=>_.anchor?.kind!=="page").map(_=>[_.id,Ye(_.anchor||{})]):[]);V.replaceChildren(),ut.clear();let de=e.on?e.draft||e.openId:null,G=de!==e.shown,Ee=G?" in":"",Me=null,et=()=>{if(e.closeFast&&!de&&t){e.closeFast=!1,t.inert=!0,V.append(t);let _=()=>t.remove();zt.matches||!t.animate?_():t.animate([{opacity:1},{opacity:0}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(_,_)}else if(ee&&!de&&e.shown&&t&&!zt.matches&&!t.style.transform){t.classList.remove("in"),t.classList.add("out"),t.inert=!0,V.append(t);let _=e.posted&&ut.get(e.posted);_&&(_.style.animationDelay="130ms");let pe=En(t,0,!!_);setTimeout(()=>(t.remove(),$n(t),t.classList.contains("float")&&Ln()),pe)}if(ee&&t?.classList.contains("float")&&!t.classList.contains("out")&&!P.querySelector(".float:not(.out)")&&setTimeout(Ln,320),ee){let _=P.querySelector(".card:not(.out), .float:not(.out)")||(e.listOpen?x:e.chatOpen?D:null),pe=_&&(e.draft?"draft":e.openId||(e.listOpen?"list":e.chatOpen?"chat":""));_&&pe!==e.sheetKey&&Sn(_),e.sheetKey=pe,G&&e.draft&&requestAnimationFrame(Co)}jt(Me),e.shown=de,e.posted=null},Ie=it(),qt=Ie.filter(_=>!_.resolved&&_.anchor?.kind!=="page").length,It=Ie.filter(_=>!_.resolved&&_.anchor?.kind!=="page").reduce((_,pe)=>_+ct(pe).length,0);if(H.replaceChildren(document.createTextNode((e.on?"hide comments":qt?`comments \xB7 ${qt}`:"comments")+(!e.on&&It?` \xB7 ${It} new`:"")),N("kbd",{"aria-hidden":"true"},o.toggle)),H.classList.toggle("secondary",e.on),q.toggleAttribute("data-sheet",!!(e.on&&(e.draft||e.openId||e.listOpen||e.chatOpen))),ee&&G&&de&&(q.setAttribute("data-opening",""),requestAnimationFrame(()=>requestAnimationFrame(()=>q.removeAttribute("data-opening")))),document.documentElement.classList.toggle("lab-sheet",q.hasAttribute("data-sheet")),_n(),e.refit(),rt(),xe.hidden=!e.on||!e.isAdmin||Ie.every(_=>_.resolved),Ue(),Qt(),zn(),!e.on)return et();for(let _ of lt()){let{left:pe,top:He}=Ye(_.anchor),be=N("div",{class:"pin held",title:`${_.name}: ${_.text} \xB7 draft, not sent yet`},pt(_.name));be.style.left=`${pe}px`,be.style.top=`${He}px`,V.append(be)}if(Ie.forEach(_=>{if(Bn(_)||!e.showDone&&e.openId!==_.id&&(_.resolved||Ne(_)[0]==="done")&&!ct(_).length)return;let{left:pe,top:He,moved:be,zone:te}=Z.get(_.id)||Ye(_.anchor||{});e.openId===_.id&&Yt(te,`saved${Ee}`);let ve=ct(_),Te=!te&&(e.isAdmin||u.get(`lab-edit:${_.id}`)),[Se]=Ne(_),ie=N("button",{class:`pin${/^go$/i.test(_.text.trim())?" go":""}${_.anchor?.zoom?" zoom":""}${_.resolved?" resolved":""}${Se==="done"?" done":""}${Se==="now"?" working":""}${ve.length?" new":""}${be?" moved":""}${e.posted===_.id?ee?" arrive":" in":""}${Te?" grab":""}${e.openId===_.id?" open":""}`,type:"button",title:`${_.resolved?"":`${sn(_)} \xB7 `}${_.name}${be?" \xB7 the spot it was pinned to has changed":""}${Te?" \xB7 drag to move":""}${!ee&&Rn(_)?` \xB7 option-click to ${_.resolved?"open it again":"resolve"}`:""}`,"aria-label":`${/^go$/i.test(_.text.trim())?"go":_.anchor?.zoom?`zoom ${_.anchor.zoom}`:"comment"}${_.resolved?"":` ${sn(_)}`} by ${_.name}${Se==="now"?", agent working on it":Se==="done"||_.resolved?", done":""}${ve.length?`, ${ve.length} new`:""}${be?", moved":""}`},Se==="done"||_.resolved?"\u2713":/^go$/i.test(_.text.trim())?"go":_.anchor?.zoom?$t(String(_.anchor.zoom).startsWith("in")?"in":"out"):y("agentPins")&&Qo(_)?Go():pt(_.name)),We=`${Se}${_.resolved?" resolved":""}${ve.length?" new":""}`,Fe=e.faces.get(_.id);e.faces.set(_.id,We);let bn=Fe!==void 0&&Fe!==We&&!zt.matches;if(bn&&ie.classList.add("swap"),Se==="now"?ie.append(N("i",{class:`ring${bn&&!Fe.startsWith("now")?" come":""}`,"aria-hidden":"true"})):bn&&Fe.startsWith("now")&&ie.append(N("i",{class:"ring gone","aria-hidden":"true"})),ee&&ie.append(N("i",{class:"hit","aria-hidden":"true"})),ie.style.left=`${pe}px`,ie.style.top=`${He}px`,Te&&No(ie,_),!ee&&te&&e.openId!==_.id){let me=null;ie.addEventListener("pointerenter",()=>me=Yt(te,"saved")),ie.addEventListener("pointerleave",()=>(me?.remove(),me=null))}else!ee&&_.anchor?.quote&&!te&&(ie.addEventListener("pointerenter",()=>jt(_.anchor)),ie.addEventListener("pointerleave",()=>jt(Me)));if(ie.addEventListener("click",me=>{if(me.stopPropagation(),!ie.dataset.dragged){if(me.altKey&&Rn(_))return Ko(_);if(ee&&e.openId!==_.id)return nt(_);e.openId=e.openId===_.id?null:_.id,e.draft=null,Y()}}),V.append(ie),ut.set(_.id,ie),e.openId===_.id){let me=Ro(_,new Set(ve.map($e=>$e.id)),G&&(ee?e.keepKeys:!e.stepping||e.keepKeys));if(e.openCard=me,G&&!e.stepping&&me.classList.add("in"),c&&(me.style.minHeight=`min(${c}px, var(--_sheet-max))`),e.stepping=e.keepKeys=!1,Mn(me,te?pe+14:pe,te?te.top+te.height:He),!G&&z!=null){let $e=me.querySelector(".body");$e.scrollTop=R?$e.scrollHeight:z}else if(G){let $e=me.querySelector(".body"),eo=ee?null:$e.querySelector(".fresh, .newline");$e.scrollTop=eo?eo.offsetTop-$e.offsetTop-8:$e.scrollHeight}ee&&e.cardFull&&me.classList.add("full"),Et(me,()=>(e.openId=null,e.cardFull=!1,Y()),!0),dt(ve),ve.length&&Ue(),Me=te?null:_.anchor}}),e.draft){let{anchor:_}=e.draft,{left:pe,top:He,zone:be}=Ye(_);Yt(be,"draft"),Me=be?null:_;let te=_.zoom,ve=N("div",{class:`pin draft${te?" zoom":""}${Ee}`},te?$t(te):pt(u.get("lab-name")));ve.style.left=`${pe}px`,ve.style.top=`${He}px`,V.append(ve);let Te=N("div",{class:`float${Ee}`});Te.append(N("div",{class:"handle"}),wn({placeholder:te==="in"?"zoom in: what to go deeper into (or just send)":te==="out"?"zoom out: what to see around it (or just send)":e.draft.go?"go":"add a comment",empty:te?On(te):e.draft.go?"go":"",nameFirst:!!(e.draft.go||te),autofocus:!0,draftKey:`lab-typing:${e.page}:new`,onSubmit:async(Se,ie)=>{if(kt())return u.set(Ct(),JSON.stringify([...lt(),{name:Se,text:ie,anchor:_}])),e.draft=null,B(null),Y();let{comment:We,edit:Fe}=await De({name:Se,text:ie,anchor:_});Fe&&u.set(`lab-edit:${We.id}`,Fe),te&&_.block&&Tn(_.block,te),e.comments.push(We),dt([We]),e.draft=null,B(null),e.openId=null,e.posted=We.id,_o(),Y()}})),Et(Te,()=>(e.draft=null,B(null),Y())),be?Mn(Te,pe+14,be.top+be.height):Oo(Te,pe,He)}et()}e.grabbing=!1,e.openCard=null;let ee=matchMedia("(pointer: coarse)").matches,In=()=>{u.get("lab-hint-seen")!=="1"&&(oe.hidden=!1,u.set("lab-hint-seen","1"),setTimeout(()=>oe.hidden=!0,5e3))},Hn=t=>{e.on=t,e.on?Ce():ke.classList.remove("show"),u.set("lab-on",e.on?"1":"0"),e.on&&In(),e.draft=null,e.openId=null,Y()};H.addEventListener("click",()=>Hn(!e.on));function mt(t,c=!1){U.hidden=!t,ae.setAttribute("aria-expanded",String(t)),t?[...U.querySelectorAll("button")].find(v=>!v.hidden&&!v.disabled)?.focus({preventScroll:!0}):c&&ae.focus({preventScroll:!0})}ae.addEventListener("click",t=>{t.stopPropagation(),mt(U.hidden)}),U.addEventListener("click",()=>setTimeout(()=>mt(!1,!0),0)),addEventListener("pointerdown",t=>{!U.hidden&&!t.composedPath().some(c=>c===U||c===ae)&&mt(!1)},!0),addEventListener("keydown",t=>{t.key==="Escape"&&!U.hidden&&(mt(!1,!0),t.stopPropagation())},!0),he.addEventListener("click",()=>{if(e.zoomMode==="in")return Le("out");if(e.zoomMode==="out")return Le(""),on(!1);if(e.goMode&&!e.cursorMode)return Le("in");on(!0)}),Xe.addEventListener("click",()=>ot(-1)),_e.addEventListener("click",()=>Re.click()),e.paused=null;let ta=t=>{let c=t.effect?.target;return!!c&&c.getRootNode()!==P},Wn=()=>{for(let t of document.getAnimations())!ta(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))};Ze.addEventListener("click",()=>Wo(!e.overControls)),Be.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(Wn,100)},Wn();Be.textContent=e.paused?"play motion":"pause motion",Be.setAttribute("aria-pressed",String(!!e.paused))}),Re.addEventListener("click",()=>{e.showDone=!e.showDone,u.set("lab-show-done",e.showDone?"1":""),Y()}),Je.addEventListener("click",()=>ot(1));let Ot=()=>{e.on||(e.on=!0,u.set("lab-on","1"))};xe.addEventListener("click",()=>Yo(jo(),xe)),addEventListener("lab-goto",t=>{let c=document.getElementById(t.detail);c&&(ee&&(e.openId=null,e.chatOpen=!1,e.listOpen=!1,Y()),setTimeout(()=>An(c),ee?60:0))}),ye.addEventListener("click",()=>at?(e.listOpen=!e.listOpen,e.listOpen&&(e.filter="new"),e.chatOpen=!1,oe.hidden=!0,Y()):ot(1)),x.querySelector(".x").addEventListener("click",()=>Vt(x,()=>(e.listOpen=!1,Y()))),W.addEventListener("click",()=>{e.chatOpen=!e.chatOpen,e.listOpen=!1,e.chatOpen&&!ee&&(e.openId=null,e.draft&&!P.querySelector(".float textarea")?.value.trim()&&(e.draft=null)),oe.hidden=!0,Y(),e.chatOpen&&!ee&&D.querySelector(".chat textarea")?.focus({preventScroll:!0})}),e.closingClick=!1,document.addEventListener("pointerdown",t=>{if(e.closingClick=!1,ee||!e.chatOpen||t.button!==0)return;let c=t.composedPath();if(!(c.includes(D)||c.includes(W))){if(e.chatOpen=!1,c.includes(q))return void addEventListener("click",()=>Y(),{once:!0});e.closingClick=!0,Y()}},!0),addEventListener("click",t=>{e.closingClick&&(e.closingClick=!1,t.preventDefault(),t.stopImmediatePropagation())},!0);for(let t of x.querySelectorAll("[data-f]"))t.addEventListener("click",()=>(e.filter=t.dataset.f,Ue()));A.addEventListener("click",()=>(u.set("lab-hold",kt()?"":"1"),Ue())),Ve.addEventListener("click",async()=>{let t=lt();for(let c=0;c<t.length;c++)try{let{comment:v,edit:z}=await De(t[c]);z&&u.set(`lab-edit:${v.id}`,z),e.comments.push(v),dt([v]),u.set(Ct(),JSON.stringify(t.slice(c+1)))}catch{Ve.textContent="send failed, try again";return}Y()});let Qe=t=>t.composedPath().some(c=>c instanceof HTMLElement&&(c.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(c.tagName)));document.addEventListener("keydown",t=>{if(e.gone)return;let c=document.activeElement?.localName.includes("-")&&document.activeElement!==q;if(l(t)==="toggle"&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&!Qe(t)&&!c){t.preventDefault(),Hn(!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")&&!Qe(t)&&!c&&Ge.length)return t.preventDefault(),void Fo();if(e.on&&t.ctrlKey&&!t.metaKey&&!t.altKey&&t.code==="KeyD"&&!(Qe(t)&&!t.composedPath().includes(q))){t.preventDefault();let R=P.querySelector(".card textarea, .float textarea");return R?.value.trim()?R.closest(".card, .float")?.animate([{transform:"none"},{transform:"translateX(-6px)"},{transform:"translateX(6px)"},{transform:"none"}],{duration:260}):ot(t.shiftKey?-1:1)}let v=l(t);if(e.on&&["comment","go","zoom","pointer"].includes(v)&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&!Qe(t)&&!c){if(t.preventDefault(),v==="zoom")return Le(e.zoomMode==="in"?"out":"in");e.zoomMode&&Le(""),v==="pointer"?nn(!0):on(v==="go");return}let z=/^[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&&!Qe(t)&&!c&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&qo(t,z))return t.preventDefault();if(e.on&&!Qe(t)&&!c&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.repeat&&["pause","chat","next","done","reply","resolve"].includes(v)){let R=v;if(t.preventDefault(),R==="pause")return Be.click();if(R==="chat")return W.click();if(R==="next")return ot(t.shiftKey?-1:1);if(R==="done")return Re.click();R==="reply"&&e.openId?P.querySelector(".card textarea")?.focus({preventScroll:!0}):R==="resolve"&&e.openId&&e.isAdmin&&[...P.querySelectorAll(".card .btn")].find(Z=>/^(resolve|reopen)$/.test(Z.textContent))?.click();return}t.key==="Escape"&&(e.draft||e.openId)?(e.draft=null,e.openId=null,Y()):t.key==="Escape"&&(e.chatOpen||e.listOpen)&&(e.chatOpen?e.chatOpen=!1:e.listOpen=!1,Y())});let Fn='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]',Kn=t=>document.documentElement.classList.toggle("lab-ctl",!e.overControls&&!q.contains(t)&&t!==q&&Nt(t));e.recheckCtl=()=>e.mouse&&Kn(document.elementFromPoint(e.mouse.x,e.mouse.y));let Nt=t=>{if(e.overControls)return!1;for(let c=t instanceof Element?t:null;c&&c!==document.body&&c!==document.documentElement;c=c.parentElement)if(c.matches(Fn)||getComputedStyle(c).cursor==="pointer")return!0;return!1},ge="[data-uncommentable]";e.drag=null,e.afterDrag=!1,e.liveZone=null,e.zoneFrame=0;let Rt=12,na=()=>{if(e.zoneFrame=0,!e.drag?.active||!e.liveZone)return;let t=(z,R)=>{let Z=Math.max(Math.abs(R-z),Rt);return{start:(z+R)/2-Z/2,size:Z}},c=t(e.drag.x0,e.drag.x1),v=t(e.drag.y0,e.drag.y1);e.liveZone.style.transform=`translate3d(${c.start+scrollX}px, ${v.start+scrollY}px, 0)`,e.liveZone.style.width=`${c.size}px`,e.liveZone.style.height=`${v.size}px`},jn=()=>!!e.draft&&[...P.querySelectorAll(".float textarea")].some(t=>t.value.trim());function oa(t){!e.on&&!t.altKey||e.cursorMode&&!t.altKey||jn()||t.button!==0||t.pointerType==="touch"||t.metaKey||t.ctrlKey||t.shiftKey||t.composedPath().includes(q)||!t.altKey&&Nt(t.target)||t.target instanceof Element&&t.target.closest(ge)||(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||jn()||t.button!==0||t.pointerType==="touch"||t.metaKey||t.ctrlKey||t.shiftKey||t.composedPath().includes(q)||!t.altKey&&Nt(t.target)||t.target instanceof Element&&t.target.closest(ge)||(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=vn("draft live"),V.append(e.liveZone)),e.drag.active&&(t.preventDefault(),e.zoneFrame||=requestAnimationFrame(na)))},!0);let un=t=>{if(!e.drag)return;let c=e.drag;if(e.drag=null,document.documentElement.classList.remove("lab-dragging"),cancelAnimationFrame(e.zoneFrame),e.zoneFrame=0,e.liveZone?.remove(),e.liveZone=null,!(!c.active||t.type==="pointercancel")){e.afterDrag=!0,setTimeout(()=>e.afterDrag=!1,0),getSelection?.()?.removeAllRanges();for(let[v,z]of[["x0","x1"],["y0","y1"]]){if(Math.abs(c[z]-c[v])>=Rt)continue;let R=(c[v]+c[z])/2;c[v]=R-Rt/2,c[z]=R+Rt/2}Ot(),e.openId=null,Lt(yo(c))}};document.addEventListener("pointerup",un,!0),document.addEventListener("pointercancel",un,!0),document.addEventListener("dragstart",t=>{let c=e.on&&t.target instanceof Element&&t.target.closest("img, video")&&!t.composedPath().includes(q);(e.drag||c)&&t.preventDefault()},!0),document.addEventListener("click",t=>{e.afterDrag&&(t.preventDefault(),t.stopPropagation())},!0);let Yn=t=>t.altKey&&!t.metaKey&&!t.ctrlKey&&t.button===0&&!t.composedPath().includes(q)&&!(t.target instanceof Element&&t.target.closest(ge));for(let t of["pointerdown","mousedown","pointerup","mouseup"])addEventListener(t,c=>{Yn(c)&&(c.preventDefault(),c.stopImmediatePropagation(),t==="pointerdown"&&oa(c),t==="pointerup"&&un(c))},!0);addEventListener("click",t=>{Yn(t)&&(t.preventDefault(),t.stopImmediatePropagation(),e.afterDrag||Jn(t))},!0),e.ctlClick=!1,addEventListener("click",t=>e.ctlClick=Nt(t.target),!0),document.addEventListener("click",t=>Jn(t)),e.lastTouch=0,e.pinnedByHold=!1;let ft=P.querySelector(".sel-chip"),mn=P.querySelector(".scrim"),Un=()=>P.querySelector(".card:not(.out), .float:not(.out)")||(e.listOpen?x:e.chatOpen?D:null),aa=()=>{e.draft=null,e.openId=null,e.listOpen=!1,e.chatOpen=!1,Y()},Xn=()=>{let t=Un();if(![...P.querySelectorAll("textarea")].some(c=>c.value.trim()&&!D.contains(c)))return Vt(t,aa);t?.animate?.([{transform:"none"},{transform:"translateY(12px)"},{transform:"none"}],{duration:260,easing:"ease-out"})};e.sheetDraggedAt=-1e9,mn.addEventListener("click",()=>performance.now()-e.sheetDraggedAt>300&&Xn()),mn.addEventListener("touchmove",t=>t.preventDefault(),{passive:!1}),e.backWatcher=null;let ra=window.visualViewport;Mo();let qe=F(".msgs",D);e.stick=!0,qe.addEventListener("scroll",()=>e.stick=qe.scrollHeight-qe.scrollTop-qe.clientHeight<48,{passive:!0}),"ResizeObserver"in window&&new ResizeObserver(()=>e.stick&&(qe.scrollTop=qe.scrollHeight)).observe(qe),Et(x,()=>(e.listOpen=!1,Y())),Et(D,()=>(e.chatOpen=!1,Y()),!0),e.press=null;let gt=()=>e.press&&(clearTimeout(e.press.timer),e.press=null),Bt=t=>{let c=document.documentElement;if(t)return c.classList.add("lab-press");c.classList.contains("lab-press")&&requestAnimationFrame(()=>{c.classList.remove("lab-press");let v=window.CSS?.highlights?.get("lab-quote");v&&CSS.highlights.set("lab-quote",new Highlight(...v))})};document.addEventListener("pointerdown",t=>{if(gt(),e.pinnedByHold=!1,t.pointerType==="touch"&&(e.lastTouch=Date.now()),t.pointerType!=="touch"||e.draft||!(t.target instanceof Element)||t.composedPath().includes(q)||t.target.closest(ge))return;let{clientX:c,clientY:v}=t;Bt(!0),e.press={x:c,y:v,timer:setTimeout(()=>{e.press=null,e.pinnedByHold=!0,navigator.vibrate?.(8),getSelection?.()?.removeAllRanges(),e.afterDrag=!0,setTimeout(()=>e.afterDrag=!1,800),Ot(),e.openId=null,Lt(je(c,v))},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()),gt(),Bt(!1),e.pinnedByHold&&(P.querySelector(".float [data-first]")||P.querySelector(".float textarea"))?.focus({preventScroll:!0})},!0),document.addEventListener("touchend",t=>{Bt(!1),e.pinnedByHold&&(e.pinnedByHold=!1,t.preventDefault(),(P.querySelector(".float [data-first]")||P.querySelector(".float textarea"))?.focus({preventScroll:!0}))},{capture:!0,passive:!1}),document.addEventListener("pointercancel",()=>(gt(),Bt(!1)),!0),addEventListener("scroll",gt,{passive:!0,capture:!0}),document.addEventListener("contextmenu",t=>(e.press||e.afterDrag)&&t.preventDefault(),!0),e.selRect=null,document.addEventListener("selectionchange",()=>{let t=getSelection?.(),c=t?.rangeCount&&t.getRangeAt(0),v=String(t||"").trim(),z=c&&q.contains(c.commonAncestorContainer);if(e.selRect=ee&&e.on&&!e.draft&&v&&c&&!z?c.getClientRects()[0]||c.getBoundingClientRect():null,ft.hidden=!e.selRect,!e.selRect)return;let R=e.selRect.bottom+52<innerHeight;ft.style.left=`${Math.min(Math.max(e.selRect.left+e.selRect.width/2,60),innerWidth-60)}px`,ft.style.top=`${R?e.selRect.bottom+10:Math.max(e.selRect.top-46,8)}px`});let Zn=()=>{let t=getSelection?.(),c=t?.rangeCount&&t.getRangeAt(0),v=String(t||"").replace(/\s+/g," ").trim();if(!c||!v||q.contains(c.commonAncestorContainer))return!1;let z=c.getClientRects(),R=z[0]||c.getBoundingClientRect(),Z=z[z.length-1]||R,de=c.startContainer.nodeType===1?c.startContainer:c.startContainer.parentElement,G=c.endContainer.nodeType===1?c.endContainer:c.endContainer.parentElement,Ee=de&&(de===G||de.contains(G))?je(Math.max(Z.left,Z.right-2),Z.top+Z.height/2):je(R.left+2,R.top+R.height/2),Me=c.commonAncestorContainer,et=(Me.nodeType===1?Me:Me.parentElement)?.closest("p, li, h1, h2, h3, h4, h5, h6, td, th, figcaption, blockquote, pre, section, article, div")||document.body,Ie=(qt,It)=>{let _=document.createRange();return _.setStart(...qt),_.setEnd(...It),String(_).replace(/\s+/g," ")};return Ee.kind="text",Ee.quote={exact:X(v,300),prefix:Ie([et,0],[c.startContainer,c.startOffset]).replace(/^\s+/,"").slice(-40),suffix:Ie([c.endContainer,c.endOffset],[et,et.childNodes.length]).replace(/\s+$/,"").slice(0,40)},t.removeAllRanges(),ft.hidden=!0,Ot(),e.openId=null,Lt(Ee),!0};ft.addEventListener("click",t=>{t.stopPropagation(),e.selRect&&Zn()}),document.addEventListener("mouseup",t=>{e.on&&!e.cursorMode&&!e.draft&&t.shiftKey&&t.button===0&&!t.composedPath().includes(q)&&setTimeout(Zn,0)},!0);function Jn(t){if(!t.composedPath().includes(q)){if(e.draft||e.openId){if([...P.querySelectorAll("textarea")].some(c=>c.value.trim()))return;e.draft=null,e.openId=null,Y();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(ge)||String(getSelection?.()||"").trim()||(Ot(),Lt(je(t.clientX,t.clientY)))}}}let sa=()=>{let t=it().filter(v=>v.anchor?.kind!=="page");if(!e.on||e.openId||t.length!==ut.size)return Y();let c=t.map(v=>[ut.get(v.id),Ye(v.anchor||{})]);if(c.some(([v])=>!v))return Y();for(let[v,{left:z,top:R,moved:Z}]of c)v.style.left=`${z}px`,v.style.top=`${R}px`,v.classList.toggle("moved",!!Z)};e.frame=0;let Pt=()=>{cancelAnimationFrame(e.frame),e.frame=requestAnimationFrame(()=>{e.draft||P.activeElement||e.grabbing||sa()})};addEventListener("resize",Pt),addEventListener("scroll",t=>t.target!==document&&!q.contains(t.target)&&Pt(),{capture:!0,passive:!0});let fn=()=>{e.gone||(!q.isConnected&&document.body&&document.body.append(q),ue.isConnected||document.head.append(ue),ht.isConnected||document.head.append(ht),w()!==e.page&&(e.page=w(),e.seen=Pn(),dn(),e.comments=[],e.draft=null,e.openId=null,Y(),fe()))};for(let t of["pushState","replaceState"]){let c=history[t];history[t]=function(...v){let z=c.apply(this,v);return queueMicrotask(fn),z}}addEventListener("popstate",fn),document.addEventListener("astro:after-swap",fn),document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&!e.draft&&!P.activeElement&&fe()}),"ResizeObserver"in window&&new ResizeObserver(Pt).observe(document.body);let ue=document.createElement("style");a?.dataset.fontUrl&&(ue.textContent=`@font-face{font-family:'lab comments';font-display:swap;src:url('${new URL(a.dataset.fontUrl,a.src||location.href)}') format('woff2');}`);let Vn=a?.dataset.fontUrl?"lab comments":a?.dataset.font;Vn&&q.style.setProperty("--lab-font",`'${Vn.replace(/'/g,"")}', system-ui, sans-serif`);let ht=document.createElement("style"),ke=N("div",{class:"ptr","aria-hidden":"true"});ke.append(N("span",{class:"ini"},"+"),N("span",{class:"tick"},"go")),P.append(ke),e.mouse=null;let Gn=(t,c,v)=>{let z=!!v&&v!==q&&!q.contains(v)&&getComputedStyle(v).cursor==="none";ke.classList.toggle("show",z),ke.classList.toggle("go",e.goMode&&!e.zoomMode),ke.style.transform=`translate(${t-1}px, ${c-27}px)`},Ce=()=>e.mouse&&requestAnimationFrame(()=>e.mouse&&Gn(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 c=t.composedPath()[0];c!==e.ctlTarget&&(e.ctlTarget=c,Kn(c)),Gn(t.clientX,t.clientY,c instanceof Element?c: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 gn(){let t=e.zoomMode?`zoom-${e.zoomMode}`:(pt(u.get("lab-name"))||"+").replace(/[<>&'"]/g,"");if(t===e.cursorKey)return;e.cursorKey=t,ke.querySelector(".ini").replaceChildren(e.zoomMode?$t(e.zoomMode):t);let c=`:not(${Fn}, a *, button *, label *, [role="button"] *, [contenteditable], [contenteditable] *, ${ge}, ${ge} *, [data-lab-comments])`,v="dialog, dialog *, [popover], [popover] *, :fullscreen, :fullscreen *";ht.textContent=`@layer lab-pointer { html.lab-pinning:not(.lab-shift, .lab-ctl) body, html.lab-pinning:not(.lab-shift, .lab-ctl) body *${c} { 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 *${c}:not(${v}) { cursor: none; } html.lab-pinning body :is([contenteditable], [contenteditable] *) { cursor: text; } html.lab-pinning body :is(${ge}, ${ge} *) { cursor: auto; } }html:is(.lab-alt, .lab-over:not(.lab-shift)) body, html:is(.lab-alt, .lab-over:not(.lab-shift)) body *:not([data-lab-comments], [data-lab-comments] *, ${ge}, ${ge} *) { cursor: crosshair !important; }html.lab-drawn:is(.lab-alt, .lab-over:not(.lab-shift)) body, html.lab-drawn:is(.lab-alt, .lab-over:not(.lab-shift)) body *:not([data-lab-comments], [data-lab-comments] *, ${ge}, ${ge} *, ${v}) { cursor: none !important; }html.lab-go:not(.lab-drawn) body, html.lab-go:not(.lab-drawn) body * { cursor: copy !important; }`}ue.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 hn=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",hn,!0),addEventListener("keyup",hn,!0),addEventListener("pointerdown",t=>{if(t.shiftKey)return hn(t);clearTimeout(e.shiftOff),document.documentElement.classList.remove("lab-shift")},!0),addEventListener("blur",()=>document.documentElement.classList.remove("lab-shift")),ue.textContent+="html.lab-dragging, html.lab-dragging * { user-select: none !important; -webkit-user-select: none !important; cursor: crosshair !important; }",ue.textContent+="html.lab-sheet, html.lab-sheet body { overscroll-behavior-y: none; }",ue.textContent+='@property --lab-arc { syntax: "<percentage>"; inherits: false; initial-value: 66%; }',ue.textContent+="html.lab-room body::after { content: ''; display: block; height: var(--lab-room, 0px); }",addEventListener("scroll",()=>{let t=document.documentElement,c=parseFloat(t.style.getPropertyValue("--lab-room"))||0;if(!c||q.hasAttribute("data-sheet"))return;let v=Math.max(0,Math.ceil(scrollY+innerHeight-(t.scrollHeight-c)));v>=c||(t.style.setProperty("--lab-room",`${v}px`),v||t.classList.remove("lab-room"))},{passive:!0}),ue.textContent+="@media (pointer: coarse) { html.lab-sheet, html.lab-sheet body { overflow: hidden; } }",ue.textContent+="html.lab-pinning body, html.lab-pinning body * { -webkit-touch-callout: none; }",ue.textContent+="@media (pointer: coarse) { html.lab-pinning.lab-press 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 Dt=t=>document.documentElement.classList.toggle("lab-alt",!!t);addEventListener("keydown",t=>t.key==="Alt"&&Dt(!0),!0),addEventListener("keyup",t=>t.key==="Alt"&&Dt(!1),!0),addEventListener("pointermove",t=>Dt(t.altKey),{capture:!0,passive:!0}),addEventListener("blur",()=>Dt(!1));let Qn=()=>{document.head.append(ue,ht),gn(),e.on&&In(),document.body.append(q);let t="background-color: rgba(52, 199, 89, .3); color: inherit;";ue.textContent+=`html.lab-pinning ::selection { ${t} } ::highlight(lab-quote) { ${t} }`,fe()};document.body?Qn():document.addEventListener("DOMContentLoaded",Qn),Io(),Po()})();})();
|