notemend 0.1.20 → 0.1.21

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.
@@ -1 +0,0 @@
1
- const v=t=>t.replace(/[&<>"]/g,s=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[s]),a={signal:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><rect x="1" y="12" width="3.2" height="5" rx="1"/><rect x="5.6" y="9" width="3.2" height="8" rx="1"/><rect x="10.2" y="6" width="3.2" height="11" rx="1"/><rect x="14.8" y="3" width="3.2" height="14" rx="1"/></svg>',wifi:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><path d="M10 16.6 7.4 13.8a3.7 3.7 0 0 1 5.2 0z"/><path d="M4.8 11.1a7.4 7.4 0 0 1 10.4 0l-1.3 1.4a5.5 5.5 0 0 0-7.8 0z"/><path d="M2.2 8.3a11.1 11.1 0 0 1 15.6 0l-1.3 1.4a9.2 9.2 0 0 0-13 0z"/></svg>',battery:'<svg viewBox="0 0 28 14" class="dt-i dt-i--batt"><rect x="1" y="1" width="23" height="12" rx="3.5" fill="none" stroke="currentColor" stroke-opacity=".4"/><rect x="3" y="3" width="17" height="8" rx="2" fill="currentColor"/><path d="M26 5v4a2 2 0 0 0 0-4z" fill="currentColor" fill-opacity=".4"/></svg>',back:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4 6.5 10l6 6"/></svg>',fwd:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M7.5 4l6 6-6 6"/></svg>',reload:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9"/><path d="M14.2 3.2v3.2H11"/></svg>',dots:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="4.5" cy="10" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="15.5" cy="10" r="1.6"/></svg>',dotsV:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="4.5" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="10" cy="15.5" r="1.6"/></svg>',share:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 12.5V2.8M6.8 5.8 10 2.6l3.2 3.2"/><path d="M6.5 8.5H5a1.5 1.5 0 0 0-1.5 1.5v6A1.5 1.5 0 0 0 5 17.5h10a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 15 8.5h-1.5"/></svg>',plus:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 4v12M4 10h12"/></svg>',tabs:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="3" y="6" width="11" height="11" rx="2"/><path d="M6 3.5h8.5A2.5 2.5 0 0 1 17 6v8.5"/></svg>',sidebar:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="2.5" y="4" width="15" height="12" rx="2"/><path d="M8 4v12"/></svg>',lock:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="9" width="10" height="8" rx="1.8"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/></svg>',tune:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3 6.5h8M15 6.5h2M3 13.5h2M9 13.5h8"/><circle cx="13" cy="6.5" r="2"/><circle cx="7" cy="13.5" r="2"/></svg>',star:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m10 3 2.1 4.4 4.8.6-3.5 3.3.9 4.7L10 13.7 5.7 16l.9-4.7L3.1 8l4.8-.6z" stroke-linejoin="round"/></svg>',user:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="10" r="8" fill-opacity=".25"/><circle cx="10" cy="8" r="3"/><path d="M4.8 15.3a6 6 0 0 1 10.4 0 7.9 7.9 0 0 1-10.4 0z"/></svg>',recent:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5.5 5v10M10 5v10M14.5 5v10"/></svg>',home:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="4.5" y="4.5" width="11" height="11" rx="3.5"/></svg>',navBack:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4.5 7 10l5.5 5.5"/></svg>',close:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m5.5 5.5 9 9m0-9-9 9"/></svg>',winMin:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5 10h10"/></svg>',winMax:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="5" width="10" height="10" rx="1.5"/></svg>',chevUp:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m6 12 4-4 4 4"/></svg>',volume:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3.5 8v4h3l4 3.5v-11l-4 3.5z" stroke-linejoin="round"/><path d="M13.5 7.5a3.5 3.5 0 0 1 0 5"/></svg>'},B=(t,s)=>t.toLocaleTimeString("en-US",s),k=t=>B(t,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),D={island:t=>({side:12,top:12,bottom:12,r:t.w>=430?62:55,body:t.w>=430?74:67,extraW:6}),home:()=>({side:18,top:92,bottom:92,r:0,body:56,extraW:6}),punch:()=>({side:9,top:9,bottom:9,r:34,body:43,extraW:6}),tablet:()=>({side:26,top:26,bottom:26,r:18,body:44}),macbook:t=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((t.w+32)*.12),extraH:18}),laptop:t=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((t.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function S(t,s,e,h,n){const i=t.w+2*s.side,b=t.h+s.top+s.bottom,c=(e-i)/2,d=`<rect class="dt-shell-screen" x="${n}" y="${s.top}" width="${t.w}" height="${t.h}" rx="${s.r}"/>`;let r="";if(t.shell==="island"||t.shell==="home"||t.shell==="punch"){const l=(p,m,o)=>`<rect class="dt-shell-btn" x="${p}" y="${m}" width="4" height="${o}" rx="2"/>`;r+=t.shell==="punch"?l(c+i-1,150,70)+l(c+i-1,240,44):l(c-3,120,28)+l(c-3,170,56)+l(c-3,236,56)+l(c+i-1,190,90),r+=`<rect class="dt-shell-body" x="${c}" y="0" width="${i}" height="${b}" rx="${s.body}"/>`,r+=`<rect class="dt-shell-bezel" x="${c+3}" y="3" width="${i-6}" height="${b-6}" rx="${s.body-3}"/>`,t.shell==="home"&&(r+=`<rect class="dt-shell-slot" x="${e/2-26}" y="44" width="52" height="6" rx="3"/>`,r+=`<circle class="dt-shell-slot" cx="${e/2-48}" cy="47" r="5"/>`,r+=`<circle class="dt-shell-homebtn" cx="${e/2}" cy="${b-46}" r="28"/>`)}else if(t.shell==="tablet")r+=`<rect class="dt-shell-body dt-shell-body--light" x="${c}" y="0" width="${i}" height="${b}" rx="${s.body}"/>`,r+=`<rect class="dt-shell-bezel" x="${c+4}" y="4" width="${i-8}" height="${b-8}" rx="${s.body-4}"/>`;else if(t.shell==="monitor"){const l=Math.round(i*.1);r+=`<path class="dt-shell-stand" d="M${e/2-l/2} ${b-2}h${l}l${l*.2} 84h${-l*1.4}z"/>`,r+=`<rect class="dt-shell-stand" x="${e/2-i*.15}" y="${b+80}" width="${i*.3}" height="14" rx="7"/>`,r+=`<rect class="dt-shell-body" x="${c}" y="0" width="${i}" height="${b}" rx="${s.body}"/>`}else{const l=i+(s.extraW??0),p=(e-l)/2,m=s.extraH??16;r+=`<path class="dt-shell-body" d="M${c} ${s.body}a${s.body} ${s.body} 0 0 1 ${s.body} ${-s.body}h${i-2*s.body}a${s.body} ${s.body} 0 0 1 ${s.body} ${s.body}V${b}H${c}z"/>`,r+=`<path class="dt-shell-base${t.shell==="macbook"?" dt-shell-base--silver":""}" d="M${p} ${b}h${l}v${m-8}a8 8 0 0 1-8 8H${p+8}a8 8 0 0 1-8-8z"/>`,r+=`<rect class="dt-shell-lip" x="${e/2-i*.07}" y="${b}" width="${i*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${e} ${h}" width="${e}" height="${h}" aria-hidden="true">${r}${d}</svg>`}const z={"safari-ios":t=>{const s=t.shell==="home"?20:t.w>=400?62:59;return{top:s,bottom:98,topMin:s,bottomMin:58}},"chrome-android":()=>({top:92,bottom:48,topMin:36,bottomMin:48}),"safari-ipad":()=>({top:74,bottom:20}),"safari-mac":()=>({top:85,bottom:59}),"chrome-windows":()=>({top:87,bottom:48})},W=({d:t,now:s,cutout:e},h)=>{if(t.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${h}px"><span class="dt-sb-l">${a.signal}${a.wifi}</span><b>${k(s)}</b><span class="dt-sb-r">${a.battery}</span></div>`;const n=e??{x:(t.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${h}px"><span class="dt-island" style="left:${n.x}px;top:${n.y}px;width:${n.width}px;height:${n.height}px"></span><b class="dt-sb-time" style="top:${n.y}px;height:${n.height}px">${k(s)}</b><span class="dt-sb-icons" style="top:${n.y}px;height:${n.height}px">${a.signal}${a.wifi}${a.battery}</span></div>`},F=({d:t,host:s,min:e},h)=>{const n=t.shell==="home"?"":'<i class="dt-home-ind"></i>';return e?`<div class="dt-ios-bar is-min" style="height:${h}px"><span class="dt-ios-mini">${v(s)}</span>${n}</div>`:`<div class="dt-ios-bar" style="height:${h}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back">${a.back}</button><span class="dt-glass dt-ios-url"><span>${v(s)}</span><button data-nav="reload">${a.reload}</button></span><span class="dt-glass dt-glass--round">${a.dots}</span></div>${n}</div>`},R=({now:t,min:s},e)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${B(t,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${a.wifi}${a.signal}${a.battery}</span></div>`+(s?"":`<div class="dt-and-bar"><span class="dt-and-url">${a.tune}<span>${v(e)}</span></span><span class="dt-and-tabs">1</span>${a.dotsV}</div>`),L=()=>`<div class="dt-and-nav">${a.recent}${a.home}${a.navBack}</div>`,T=({now:t,host:s})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${k(t)} ${t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${a.wifi}${a.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${a.sidebar}<button data-nav="back">${a.back}</button><button data-nav="fwd">${a.fwd}</button></span><span class="dt-ipad-url">${a.lock}<span>${v(s)}</span><button data-nav="reload">${a.reload}</button></span><span class="dt-bar-group">${a.share}${a.plus}${a.tabs}</span></div>`,V=({now:t,host:s},e)=>'<div class="dt-mac-menu"><span class="dt-mac-apps"><b>Safari</b><span>File</span><span>Edit</span><span>View</span><span>History</span><span>Bookmarks</span><span>Window</span><span>Help</span></span>'+(e?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${a.wifi}${a.battery}<span>${t.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})}&nbsp; ${k(t)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${a.sidebar}<button data-nav="back">${a.back}</button><button data-nav="fwd">${a.fwd}</button></span><span class="dt-mac-url">${a.lock}<span>${v(s)}</span><button data-nav="reload">${a.reload}</button></span><span class="dt-bar-group">${a.share}${a.plus}${a.tabs}</span></div>`,E=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(t,s)=>`<i style="--hue:${s*40}"></i>`).join("")}</span></div>`,A=({host:t,title:s})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${v(s||t)}</span>${a.close}</span><span class="dt-win-new">${a.plus}</span><span class="dt-win-ctrl">${a.winMin}${a.winMax}${a.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back">${a.back}</button><button data-nav="fwd">${a.fwd}</button><button data-nav="reload">${a.reload}</button></span><span class="dt-win-url">${a.tune}<span>${v(t)}</span>${a.star}</span><span class="dt-bar-group">${a.user}${a.dotsV}</span></div>`,U=({now:t})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(s,e)=>`<i style="--hue:${200+e*30}"></i>`).join("")}</span><span class="dt-win-tray">${a.chevUp}${a.wifi}${a.volume}${a.battery}<span class="dt-win-clock">${B(t,{hour:"numeric",minute:"2-digit"})}<br>${t.toLocaleDateString("en-US")}</span></span></div>`;function j(t,s){const e=D[t.shell](t),h=t.w+2*e.side,n=t.h+e.top+e.bottom,i=h+(e.extraW??0),b=n+(t.shell==="monitor"||t.shell==="macbook"||t.shell==="laptop"?e.extraH??0:0),c=(i-h)/2+e.side,d=z[t.browser](t),r=s.min?d.topMin??d.top:d.top,l=s.min?d.bottomMin??d.bottom:d.bottom,p={...s,d:t};let m="",o="";switch(t.browser){case"safari-ios":m=W(p,r),o=F(p,l);break;case"chrome-android":m=R(p,s.host),o=L();break;case"safari-ipad":m=T(p),o='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":m=V(p,t.shell==="macbook"),o=E();break;case"chrome-windows":m=A(p),o=U(p);break}return{footprint:{w:i,h:b},screen:{x:c,y:e.top,w:t.w,h:t.h,r:e.r,rb:e.rb??e.r},topH:r,bottomH:l,shell:S(t,e,i,b,c),top:m,bottom:o,canMinimize:d.topMin!==void 0&&(d.topMin!==d.top||d.bottomMin!==d.bottom),scrollbar:t.browser==="chrome-windows"?"classic":"overlay"}}let g=null;function y(t){if(g??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!g||!t)return[0,0,0,0];g.clearRect(0,0,1,1),g.fillStyle="rgba(0, 0, 0, 0)",g.fillStyle=t,g.fillRect(0,0,1,1);const[s,e,h,n]=g.getImageData(0,0,1,1).data;return[s,e,h,n/255]}const w=([t,s,e])=>`rgb(${t}, ${s}, ${e})`;function O(t){const s=t.defaultView,e=o=>!o||y(o)[3]===0,h=[t.body,t.documentElement].map(o=>o&&s.getComputedStyle(o).backgroundColor).find(o=>o&&!e(o)),[n,i,b,c]=h?y(h):[255,255,255,1],d=[n,i,b].map(o=>Math.round(o*c+255*(1-c))),r=o=>{const[u,$,M,x]=y(o);if(x>=.75)return w([u,$,M]);const f=(C,H)=>Math.round(C*x+H*(1-x));return w([f(u,d[0]),f($,d[1]),f(M,d[2])])},l=o=>{let u=t.elementFromPoint(s.innerWidth/2,o);for(;u&&u!==t.documentElement;u=u.parentElement){const $=s.getComputedStyle(u);if($.position!=="fixed"&&$.position!=="sticky")continue;const M=u.getBoundingClientRect().width>=s.innerWidth*.9,x=$.backdropFilter&&$.backdropFilter!=="none";return M&&!x&&!e($.backgroundColor)?r($.backgroundColor):null}return null},p=t.querySelector('meta[name="theme-color"]')?.content||"",m=p&&!e(p)?w(y(p)):"";return{top:l(4)??w(d),bottom:l(s.innerHeight-4)??w(d),theme:m}}function q(t){const[s,e,h]=y(t).map(n=>n/255).map(n=>n<=.04045?n/12.92:((n+.055)/1.055)**2.4);return .2126*s+.7152*e+.0722*h>.4?"#000":"#fff"}export{j as drawDevice,q as inkFor,O as pageTints,y as rgbaOf};
@@ -1 +0,0 @@
1
- const f=(u,a)=>`<svg class="dt-bars" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${[0,1,2,3].map(i=>`<rect x="${.5+i*3}" y="${8.5-i*2.5}" width="2" height="${3+i*2.5}" rx="0.6" fill="${a}" stroke="none" opacity="${i<u?1:.28}"/>`).join("")}</svg>`;function g(u,a,i){const t=document.createElement("div");t.className="dt-field-menu",t.setAttribute("role","listbox"),t.hidden=!0,document.body.append(t);for(const n of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])t.addEventListener(n,s=>s.stopPropagation());let o=null;const d=()=>{t.hidden=!0,o=null};u.addEventListener("mousedown",n=>{const s=n.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!s){t.contains(n.target)||d();return}if(n.preventDefault(),o===s){d();return}o=s;const l=s.classList.contains("dt-more-select"),m=e=>l?e.dataset.on!=null:e.selected;t.innerHTML=[...s.options].map((e,p)=>e.hidden?"":`${e.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${p}" aria-selected="${m(e)}"${e.dataset.danger!=null?' class="is-danger"':""}>${e.dataset.icon?e.dataset.icon:e.dataset.initial!=null?e.dataset.face?`<img class="dt-face" src="${a(e.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${a(e.dataset.initial)}</b>`:`<i style="background:${a(e.dataset.c||"#717171")}"></i>`}<span>${a(e.text)}</span>${e.dataset.hint?`<small>${a(e.dataset.hint)}</small>`:""}${m(e)?i:""}</button>`).join("");const r=s.parentElement.getBoundingClientRect();t.style.left=`${r.left}px`,t.style.top=`${r.bottom+4}px`,t.style.minWidth=`${r.width}px`,t.hidden=!1;const c=t.getBoundingClientRect();c.bottom>innerHeight-8&&(t.style.top=`${r.top-4-c.height}px`),c.right>innerWidth-8&&(t.style.left=`${Math.max(8,r.right-c.width)}px`)}),t.addEventListener("click",n=>{const s=n.target.closest("[data-i]");if(!s||!o)return;const l=o;d(),!(l.selectedIndex===Number(s.dataset.i)&&!l.classList.contains("dt-more-select"))&&(l.selectedIndex=Number(s.dataset.i),l.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",n=>{n.key==="Escape"&&!t.hidden&&(n.stopPropagation(),d())},!0),document.addEventListener("pointerdown",n=>{!t.hidden&&!t.contains(n.target)&&!n.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&d()},!0),addEventListener("scroll",n=>{t.contains(n.target)||d()},!0)}export{f as bars,g as fieldMenus};
@@ -1 +0,0 @@
1
- function J(h){const p=o=>{const t=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,e=o/t;return Math.round(e*10)%10===0?String(Math.round(e)):e.toFixed(1)},d=(o,t,e,n,r,c="p")=>{if(e<=0||n<=0)return"";const a=r!==""?`<span class="dt-pad-chip dt-pad-chip--${c}" style="left:${o+e/2}px;top:${t+n/2}px">${r}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${c}" style="left:${o}px;top:${t}px;width:${e}px;height:${n}px"></span>${a}`},L=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],T=o=>{let t=o;for(let e=0;t&&e<6;e++,t=t.parentElement){const n=getComputedStyle(t);if(L.some(r=>parseFloat(n[r])>=2))return t}return o},B=(o,t)=>{const e=parseFloat(t.columnGap)||0,n=parseFloat(t.rowGap)||0;if(!(t.display.includes("flex")||t.display.includes("grid"))||!e&&!n)return"";const r=[...o.children].map(a=>a.getBoundingClientRect()).filter(a=>a.width||a.height);let c="";for(let a=1;a<r.length;a++){const s=r[a-1],l=r[a];if(e&&l.left>=s.right-1){const i=Math.max(s.top,l.top);c+=d(s.right,i,l.left-s.right,Math.min(s.bottom,l.bottom)-i,p(e),"g")}else if(n&&l.top>=s.bottom-1){const i=Math.min(s.left,l.left);c+=d(i,s.bottom,Math.max(s.right,l.right)-i,l.top-s.bottom,p(n),"g")}}return c},x=o=>`<span class="dt-pad-outline" style="left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px"></span>`,f=(o,t,e="")=>`<span class="dt-pad-tag" style="left:${t.left}px;top:${Math.max(2,t.top-22)}px">${o.tagName.toLowerCase()+(o.classList[0]?"."+o.classList[0]:"")}${e}</span>`,A=o=>{const t=o.getBoundingClientRect(),e=getComputedStyle(o),n=parseFloat(e.paddingTop),r=parseFloat(e.paddingRight),c=parseFloat(e.paddingBottom),a=parseFloat(e.paddingLeft);let s=x(t);s+=d(t.left,t.top,t.width,n,n>=2?p(n):""),s+=d(t.left,t.bottom-c,t.width,c,c>=2?p(c):""),s+=d(t.left,t.top+n,a,t.height-n-c,a>=2?p(a):""),s+=d(t.right-r,t.top+n,r,t.height-n-c,r>=2?p(r):"");const l=parseFloat(e.marginTop),i=parseFloat(e.marginRight),m=parseFloat(e.marginBottom),g=parseFloat(e.marginLeft);s+=d(t.left,t.top-l,t.width,l,l>=2?p(l):"","m"),s+=d(t.left,t.bottom,t.width,m,m>=2?p(m):"","m"),s+=d(t.left-g,t.top,g,t.height,g>=2?p(g):"","m"),s+=d(t.right,t.top,i,t.height,i>=2?p(i):"","m"),s+=B(o,e);const u=parseFloat(e.columnGap)||0,y=parseFloat(e.rowGap)||0,Z=(e.display.includes("flex")||e.display.includes("grid"))&&(u||y)?` \xB7 gap ${p(u)}${y&&y!==u?"/"+p(y):""}`:"";h.innerHTML=s+f(o,t,Z)},H=o=>{const t=o.getBoundingClientRect();h.innerHTML=x(t)+`<span class="dt-pad-chip" style="left:${t.left+t.width/2}px;top:${t.top+t.height/2}px">${p(t.width)} \xD7 ${p(t.height)}</span>`+f(o,t)},S=o=>{const t=(o.match(/[\d.]+/g)||[]).map(Number);if(t.length<3)return o;const e="#"+t.slice(0,3).map(n=>Math.round(n).toString(16).padStart(2,"0")).join("");return t[3]!==void 0&&t[3]<1?`${e} \xB7 ${Math.round(t[3]*100)}%`:e};let w=null;const W=()=>{if(w)return w;const o=getComputedStyle(document.documentElement),t=document.createElement("span");t.style.display="none",document.body.append(t);const e=[];for(const n of Array.from(o)){if(!n.startsWith("--"))continue;const r=o.getPropertyValue(n).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(r))continue;t.style.color="rgb(1, 2, 3)",t.style.color=r;const c=getComputedStyle(t).color;c&&c!=="rgb(1, 2, 3)"&&e.push([c,n])}return t.remove(),e.sort((n,r)=>n[1].length-r[1].length),w=e,e},G=o=>W().find(([t])=>t===o)?.[1]??"";let C=null;const V=()=>{if(C)return C;const o=[],t=e=>{for(const n of Array.from(e))n instanceof CSSStyleRule?n.style.cssText.includes("var(--")&&o.push({sel:n.selectorText,style:n.style}):n instanceof CSSMediaRule?matchMedia(n.conditionText).matches&&t(n.cssRules):"cssRules"in n&&t(n.cssRules)};for(const e of Array.from(document.styleSheets))try{t(e.cssRules)}catch{}return C=o},D={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(o=>[`border-${o}-color`,[`border-${o}-color`,"border-color",`border-${o}`,"border"]]))},N=(o,t)=>{const e=D[t]??[t],n=t==="color";for(let r=o;r;r=n?r.parentElement:null){const c=l=>e.map(i=>/var\(\s*(--[\w-]+)/.exec(l.getPropertyValue(i))?.[1]).find(Boolean),a=r instanceof HTMLElement?c(r.style):void 0;if(a)return a;let s="";for(const l of V()){let i=!1;try{i=r.matches(l.sel)}catch{}i&&(s=c(l.style)||s)}if(s)return s;if(n&&r.parentElement&&getComputedStyle(r).color!==getComputedStyle(r.parentElement).color)break}return""},b=(o,t,e)=>{const n=N(o,t);if(n)return`<b class="dt-var">${n}</b> <em>${S(e)}</em>`;const r=G(e);return r?`<span title="Same value as ${r}; not written with it">\u2248 ${r}</span> <em>${S(e)}</em>`:S(e)},$=o=>`<i class="dt-type-sw" style="background:${o}"></i>`,P={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},R=o=>(o.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),E=(o,t)=>o.slice(0,3).map((e,n)=>e*o[3]+t[n]*(1-o[3])).concat([1]),z=o=>{const t=[];for(let e=o;e;e=e.parentElement){const n=getComputedStyle(e);if(n.backgroundImage!=="none")return null;const r=R(n.backgroundColor);if(r[3]>0&&(t.push(r),r[3]>=1))break}return t.reduceRight((e,n)=>E(n,e),[255,255,255,1])},M=o=>{const[t,e,n]=o.slice(0,3).map(r=>(r/=255,r<=.03928?r/12.92:((r+.055)/1.055)**2.4));return .2126*t+.7152*e+.0722*n},I=(o,t,e)=>{const n=z(o);if(!n)return["Contrast","<em>on an image</em>"];const r=E(R(t.color),n),[c,a]=[M(r),M(n)].sort((m,g)=>g-m),s=(c+.05)/(a+.05),l=e>=24||e>=18.66&&Number(t.fontWeight)>=700,i=s>=(l?4.5:7)?"AAA":s>=(l?3:4.5)?"AA":"fails AA";return["Contrast",`${s.toFixed(2)}:1 <em class="${i==="fails AA"?"dt-type-bad":""}">${i}${l?" \xB7 large":""}</em>`]},j=o=>{const t=o.getBoundingClientRect(),e=getComputedStyle(o),n=parseFloat(e.fontSize),r=e.lineHeight==="normal"?0:parseFloat(e.lineHeight),c=parseFloat(e.letterSpacing)||0,a=g=>`${(g*100).toFixed(1).replace(/\.0$/,"")}%`,s=[["Font",e.fontFamily.split(",")[0].replace(/["']/g,"")+(e.fontStyle!=="normal"?` ${e.fontStyle}`:"")],["Weight",`${P[e.fontWeight]??""} <em>${e.fontWeight}</em>`],["Size",`${p(n)}px`],["Line",r?`${a(r/n)} <em>${p(r)}px</em>`:"normal"],["Letter",c?`${a(c/n)} <em>${c.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",$(e.color)+b(o,"color",e.color)],I(o,e,n)],i=t.bottom+150<innerHeight?t.bottom+8:Math.max(8,t.top-158),m=Math.min(Math.max(8,t.left),innerWidth-210);h.innerHTML=x(t)+f(o,t)+`<div class="dt-type-card" style="left:${m}px;top:${i}px">${s.map(([g,u])=>`<span class="dt-type-row"><b>${g}</b><span>${u}</span></span>`).join("")}</div>`},F=o=>o.every(t=>t===o[0])?o[0]:o[1]===o[3]&&o[0]===o[2]?`${o[0]} ${o[1]}`:o.join(" "),O=o=>/^rgba\(.*,\s*0\)$|^transparent$/.test(o),k=(o,t,e,n="")=>{const r=16+e.length*18,a=t.bottom+r+12<innerHeight?t.bottom+8:Math.max(8,t.top-r-8),s=Math.min(Math.max(8,t.left),innerWidth-230);h.innerHTML=`<span class="dt-pad-outline" style="left:${t.left}px;top:${t.top}px;width:${t.width}px;height:${t.height}px${n?`;border-radius:${n}`:""}"></span>`+f(o,t)+`<div class="dt-type-card dt-style-card" style="left:${s}px;top:${a}px">${e.map(([l,i])=>`<span class="dt-type-row"><b>${l}</b><span>${i}</span></span>`).join("")}</div>`};return{spacer:T,drawPads:A,drawSize:H,drawType:j,drawColor:o=>{const t=getComputedStyle(o),e=[];t.backgroundImage!=="none"&&e.push(["Fill",`<em>${/gradient/.test(t.backgroundImage)?"gradient":"image"}</em>`]),O(t.backgroundColor)||e.push(["Fill",$(t.backgroundColor)+b(o,"background-color",t.backgroundColor)]),o.textContent?.trim()&&e.push(["Text",$(t.color)+b(o,"color",t.color)]),Number(t.opacity)<1&&e.push(["Opacity",`${Math.round(Number(t.opacity)*100)}%`]),e.length||e.push(["Color","<em>no fill or text</em>"]),k(o,o.getBoundingClientRect(),e)},drawBorder:o=>{const t=getComputedStyle(o),e=[],n=["top","right","bottom","left"],r=n.map(a=>parseFloat(t.getPropertyValue(`border-${a}-width`))||0);if(r.some(a=>a>0)){const a=n.filter((l,i)=>r[i]>0);e.push(["Width",`${F(r.map(p))} <em>${t.getPropertyValue(`border-${a[0]}-style`)}</em>`]);const s=a.map(l=>t.getPropertyValue(`border-${l}-color`));a.forEach((l,i)=>{i&&s[i]===s[0]||e.push([i?`\u21B3 ${l}`:"Color",$(s[i])+b(o,`border-${l}-color`,s[i])])})}else e.push(["Width","<em>none</em>"]);const c=["top-left","top-right","bottom-right","bottom-left"].map(a=>{const[s,l=s]=t.getPropertyValue(`border-${a}-radius`).split(" "),i=m=>m.endsWith("%")?m:p(parseFloat(m)||0);return s===l?i(s):`${i(s)}/${i(l)}`});e.push(["Radius",F(c)]),k(o,o.getBoundingClientRect(),e,t.borderRadius)}}}export{J as inspectors};
@@ -1 +0,0 @@
1
- import{mask as w}from"../store/mask.mjs";const a=[],c=e=>{if(e instanceof Error)return`${e.name}: ${e.message}`;if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}},s=(e,i)=>{a.push({at:new Date().toISOString(),kind:e,text:w(i.replace(/\s+/g," ").trim()).slice(0,500)}),a.length>50&&a.shift()};let g=!1;function d(e){if(g||typeof window>"u")return;g=!0;const i=console.error;console.error=(...t)=>{s("console",t.map(c).join(" ")),i.apply(console,t)},addEventListener("error",t=>{if(t instanceof ErrorEvent)return s("error",`${t.message}${t.filename?` (${t.filename}:${t.lineno})`:""}`);const n=t.target,r=n?.src||n?.href;r&&!e(r)&&s("network",`${n.tagName?.toLowerCase()} ${r} did not load`)},!0),addEventListener("unhandledrejection",t=>s("rejection",c(t.reason)));const l=window.fetch;window.fetch=async(t,n)=>{const r=typeof t=="string"?t:t instanceof URL?t.href:t.url,f=(n?.method||(t instanceof Request?t.method:"GET")).toUpperCase();try{const o=await l.call(window,t,n);return o.status>=400&&!e(r)&&s("network",`${f} ${r} \u2192 ${o.status}`),o}catch(o){throw!e(r)&&o?.name!=="AbortError"&&s("network",`${f} ${r} \u2192 no answer (${c(o)})`),o}};const u=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(t,n,...r){return this._nm=`${t.toUpperCase()} ${String(n)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(e(String(n))||s("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),u.call(this,t,n,...r)}}const p=(e=Date.now())=>a.filter(i=>e-Date.parse(i.at)<10*6e4).slice(-20);export{p as recentLogs,d as watchLogs};
@@ -1,128 +0,0 @@
1
- import{DEVTOOLS_DEVICES as b,DEVTOOLS_GROUPS as m}from"../devtools-devices.mjs";import{AI_BOX as l,AI_RAYS as g,AI_RAYS_CW as $}from"../store/thread.mjs";const s=t=>t.replace(/[&<>"]/g,d=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[d]),M=t=>t?new Date(t).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",x='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M8 6V4.2h4V6M6.6 6l.55 9.8h5.7L13.4 6"/></svg>',f='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.8 10.4 8.2 13.8l7-7.6" stroke-linejoin="round"/></svg>',k='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M12.6 4.4l3 3-8.4 8.4H4.2v-3z" stroke-linejoin="round"/></svg>',j='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.4 5.4l9.2 9.2M14.6 5.4l-9.2 9.2"/></svg>',B='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M12 5l-5 5 5 5" stroke-linejoin="round"/></svg>',C='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',S='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.5 8.5h7.5a3.5 3.5 0 0 1 0 7H8.5M7.5 5.5l-3 3 3 3" stroke-linejoin="round"/></svg>',A=t=>`<svg viewBox="${l}" width="${t}" height="${t}" aria-hidden="true" class="dt-claude"><path d="${g}" stroke-width="1.15" stroke-linecap="round"/></svg>`,D=(t,d)=>`<svg viewBox="${l}" width="${t}" height="${t}" aria-hidden="true" class="dt-claude dt-claude--fill">${$.map((n,o)=>`<path d="${n}" stroke-width="1.15" stroke-linecap="round"${o<d?"":' class="is-off"'}/>`).join("")}</svg>`,i=(t,d=15)=>`<svg viewBox="0 0 20 20" width="${d}" height="${d}" aria-hidden="true">${t}</svg>`;function T(t){const d=location.pathname.replace(/\/$/,"")||"/",n=t.client?' style="display:none"':"",o=t.breakpoints.map(a=>["new","progress","review","waiting","accepted","done"].map(e=>`<b data-bp="${s(a.id)}" data-state="${e}" hidden>${i(a.icon,11)}<i></i></b>`).join("")).join(""),h=t.groups.map(a=>`<li class="dt-pages-group">${s(a)}</li>`+t.pages.filter(e=>e.group===a).map(e=>`<li><a href="${/^\/(?![\/\\])/.test(e.route)?s(e.route):"#"}"${e.route===d?' aria-current="page"':""}><span class="dt-menu-label">${s(e.label)}</span><em class="dt-pages-n" hidden>${o}</em></a></li>`).join("")).join(""),p=[...new Set(t.devices.map(a=>a.group))].map(a=>`<p class="dt-devices-group">${s(a)}</p>`+t.devices.filter(e=>e.group===a).map(e=>`<button type="button" data-device="${s(e.id)}" aria-pressed="false"${e.note?` title="${s(e.note)}"`:""}><span class="dt-menu-label">${s(e.label)}</span><em>${e.w}&times;${e.h}</em></button>`).join("")).join(""),c=m.map(a=>`<p class="dt-devices-group">${s(a)}</p>`+b.filter(e=>e.group===a).map(e=>`<button type="button" data-emu="${s(e.id)}" aria-pressed="false"><span class="dt-menu-label">${s(e.label)}</span><em>${e.w}&times;${e.h}</em></button>`).join("")).join(""),u=t.breakpoints.map(a=>`<button class="dt-icon dt-bp" type="button" data-bp="${s(a.id)}" aria-pressed="false" title="${s(a.label)}">${i(a.icon,16)}</button>`).join(""),v=Array.from({length:t.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),r="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
2
- <!-- One bar, bottom-centre: pages | inspectors | comments | breakpoints \xB7 devices. -->
3
- <div class="devtools">
4
- ${t.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(t.brand.logo)?`<img class="dt-brand" src="${s(t.brand.logo)}" alt="" />`:""}
5
- <div class="dt-group dt-group--menus">
6
- <details class="dt-pages" name="dt-menu">
7
- <summary aria-label="Pages" title="Pages">
8
- ${i('<rect x="4.5" y="2.5" width="11" height="15" rx="1.5" /><path d="M7.5 6.6h5M7.5 10h5M7.5 13.4h3" />')}
9
- <span class="dt-pages-name">${s(d)}</span>
10
- </summary>
11
- <ul>${h}</ul>
12
- </details>
13
- </div>
14
-
15
- <div class="dt-group" role="group" aria-label="Inspect"${n}>
16
- <button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
17
- ${i('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
18
- </button>
19
- <button class="dt-icon dt-pad-btn" type="button" aria-pressed="false" title="Spacing">
20
- ${i('<rect x="2.5" y="2.5" width="15" height="15" rx="1.5" /><rect x="6.5" y="6.5" width="7" height="7" rx="1" stroke-dasharray="2 2" />')}
21
- </button>
22
- <button class="dt-icon dt-size-btn" type="button" aria-pressed="false" title="Size">
23
- ${i('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
24
- </button>
25
- <button class="dt-icon dt-type-btn" type="button" aria-pressed="false" title="Typography">
26
- ${i('<path d="M2.5 15.5 6.5 5l4 10.5M3.9 12.6h5.2M15 4.5v11M13.2 6.3 15 4.5l1.8 1.8M13.2 13.7 15 15.5l1.8-1.8" />')}
27
- </button>
28
- <button class="dt-icon dt-color-btn" type="button" aria-pressed="false" title="Color">
29
- ${i('<path d="M10 3c2.9 3.4 4.6 5.9 4.6 8.2a4.6 4.6 0 0 1-9.2 0C5.4 8.9 7.1 6.4 10 3z" />')}
30
- </button>
31
- <button class="dt-icon dt-border-btn" type="button" aria-pressed="false" title="Border & radius">
32
- ${i('<path d="M3.5 16.5V8a4.5 4.5 0 0 1 4.5-4.5h8.5" /><path d="M16.5 8v8.5H8" stroke-dasharray="1.6 2.2" />')}
33
- </button>
34
- <button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${t.sanity?"":" hidden"}>
35
- ${i('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
36
- </button>
37
- </div>
38
-
39
- <div class="dt-group" role="group" aria-label="Comments">
40
- <button class="dt-icon dt-notes-btn" type="button" aria-pressed="false" title="Comment">
41
- ${i('<path d="M4 3.5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9.5L5.5 16.5v-3H4a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2z" stroke-linejoin="round" />')}
42
- <span class="dt-notes-count" hidden></span>
43
- </button>
44
- <button class="dt-icon dt-history-btn" type="button" aria-pressed="false" title="Panel">
45
- ${i('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
46
- </button>
47
- <!-- resolved pins on or off: the switch is in the comments panel's head now; this one stays for the code that reads it -->
48
- <button class="dt-icon dt-resolved-btn" type="button" aria-pressed="true" title="Resolved" hidden style="display:none">
49
- ${i('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
50
- </button>
51
- </div>
52
-
53
- <div class="dt-group dt-bps" role="group" aria-label="Breakpoint">${u}</div>
54
-
55
- <div class="dt-group dt-group--menus">
56
- <details class="dt-devices" name="dt-menu">
57
- <summary title="Devices">
58
- ${i('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
59
- <span class="dt-devices-name">Device</span>
60
- </summary>
61
- <div class="dt-devices-menu">
62
- <div class="dt-menu-tabs" role="tablist" aria-label="Device lists">
63
- <button type="button" role="tab" data-tab="preview" aria-selected="true">Preview</button>
64
- <button type="button" role="tab" data-tab="devtools" aria-selected="false">DevTools</button>
65
- </div>
66
- <div class="dt-menu-panel" role="tabpanel" data-panel="preview">
67
- <p class="dt-menu-note">The screens most visitors use, with the browser around the page. Comments go to the breakpoint its width falls in, with the device named.</p>
68
- ${p}
69
- </div>
70
- <div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
71
- <p class="dt-menu-note">Opens the canvas at the device's size. Comments go to its breakpoint.</p>
72
- <input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
73
- ${c}
74
- </div>
75
- </div>
76
- </details>
77
- <!-- the list is written by the script, from the same table that runs the keys -->
78
- <details class="dt-keys" name="dt-menu"${t.shortcuts?"":" hidden"}>
79
- <summary class="dt-icon" title="Shortcuts">
80
- ${i('<rect x="2" y="5" width="16" height="10" rx="2" /><path d="M5.5 8.5h.01M8.5 8.5h.01M11.5 8.5h.01M14.5 8.5h.01M6.5 12h7" />')}
81
- </summary>
82
- <div class="dt-keys-menu"></div>
83
- </details>
84
- </div>
85
- <!-- turbo: its own round button beside the bar, always there for the studio \u2014 lit while
86
- an agent session takes comments, grey when none is listening or it is paused here -->
87
- <button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${t.client?" hidden":""}>
88
- <span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${i('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
89
- </button>
90
- </div>
91
-
92
- <!-- The handle under the bar, on the window's bottom edge. Its own element, not the
93
- bar's child: it stays put while the bar slides away. -->
94
- <button class="dt-tab" type="button" aria-expanded="true" aria-label="Hide the bar">
95
- <svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M5.5 8 10 12.5 14.5 8" /></svg>
96
- </button>
97
-
98
- <div class="dt-frame" hidden role="region" aria-label="Breakpoint preview">
99
- <div class="dt-stage">
100
- <span class="dt-frame-handle" data-edge="l" title="${r}"></span>
101
- <div class="dt-device">
102
- <div class="dt-shell"></div>
103
- <iframe title="Breakpoint preview"></iframe>
104
- <div class="dt-chrome" data-at="top"></div>
105
- <div class="dt-chrome" data-at="bottom"></div>
106
- </div>
107
- <span class="dt-frame-handle" data-edge="r" title="${r}"></span>
108
- </div>
109
- <div class="dt-ruler"></div>
110
- <span class="dt-frame-size"></span>
111
- <button class="dt-frame-bars dt-frame-btn" type="button" hidden title="Browser bars: shown / folded on scroll">
112
- <svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3v14M6.5 6.5 10 3l3.5 3.5M6.5 13.5 10 17l3.5-3.5" /></svg>
113
- </button>
114
- <button class="dt-frame-rotate dt-frame-btn" type="button" hidden title="Rotate">
115
- <svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M14.5 5.5A6.5 6.5 0 1 0 16.5 10" /><path d="M16.8 3.6v3.4h-3.4" /></svg>
116
- </button>
117
- </div>
118
-
119
- <aside class="dt-history" hidden aria-label="Comment history"></aside>
120
- <div class="dt-notes-hi" hidden aria-hidden="true"><span class="dt-hi-box"></span><span class="dt-hi-tag"></span></div>
121
- <div class="dt-notes-overlay" hidden role="region" aria-label="Comments on this page"></div>
122
- <div class="dt-grid-overlay" hidden aria-hidden="true">
123
- <div class="${s(t.grid.container)} dt-overlay-container">
124
- <div class="${s(t.grid.grid)} dt-overlay-grid">${v}</div>
125
- </div>
126
- </div>
127
- <div class="dt-pad-overlay" hidden aria-hidden="true"></div>
128
- `)}export{D as AGENT_MARK,A as CLAUDE_MARK,j as CROSS,C as NEXT,k as PENCIL,B as PREV,f as TICK,x as TRASH,S as UNDO,s as esc,T as mount,M as stamp};
@@ -1,43 +0,0 @@
1
- import{categoryOf as P}from"../store/categories.mjs";import{stateOf as l,STATE_LABEL as U}from"../store/status.mjs";import{agentName as H}from"../store/thread.mjs";import{CLAUDE_MARK as K,CROSS as G,PENCIL as _,TICK as R,TRASH as C,esc as i,stamp as V}from"./markup";const N='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg>',z='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function Z(a){const{bp:h,notes:m,breakpoints:$,bandOfNote:v,whoseAgent:w,statusTools:S,showResolved:f,drafts:p,find:s}=a,g=m.filter(t=>v(t)===h),B=new Map(g.map((t,e)=>[t.id,e+1])),M=t=>[t.text,t.note,t.byName,...(t.replies??[]).filter(e=>!e.deleted).map(e=>e.text)].join(" ").toLowerCase(),q=t=>s.view==="me"?a.forMe(t):s.view==="agent"?a.forAgent(t):!0,y=t=>Date.parse(t.updatedAt||t.createdAt||"")||0,D=g.filter(t=>q(t)&&(!s.q||M(t).includes(s.q.trim().toLowerCase()))).sort((t,e)=>(s.sort==="unread"?Number(a.unread(e))-Number(a.unread(t)):0)||y(e)-y(t)),o={open:[],claude:[],done:[]};for(const t of D)o[l(t)].push(t);const E=t=>{const e=(t.replies??[]).filter(I=>!I.deleted),n=e.length+(t.note?1:0),c=P(t.category),d=l(t),j=d==="claude",A=a.orphan(t),u=e.length?e[e.length-1]:t.note?{author:"claude",text:t.note}:{author:"you",text:t.text};return`<div class="dt-hist-row is-${d}${A?" is-orphan":""}">
2
- <button class="dt-hist-go" data-go="${t.id}">
3
- ${a.marker(t)}
4
- <span class="dt-hist-body">
5
- <span class="dt-hist-id">#${B.get(t.id)}<em>${c.label}</em>${j?`<b class="dt-hist-claude" data-unmark="${t.id}" role="button" tabindex="0" title="Resolved by ${i(w(t.doneAgent,t.doneFor))} \u2014 click to clear: back to open">${K(9)}${i(H(t.doneAgent))}<i aria-hidden="true">\xD7</i></b>`:""}${A?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
6
- <span class="dt-hist-text">${u.author==="claude"?`<b>${i(w(u.agent,u.by))}:</b> `:""}${i(u.text)}</span>
7
- <span class="dt-hist-meta">${V(t.updatedAt||t.createdAt)}${t.device?` \xB7 ${i(t.device)}`:t.browser?` \xB7 ${i(t.browser)}`:""}${n?` \xB7 ${n} repl${n===1?"y":"ies"}`:""}</span>
8
- </span>
9
- </button>
10
- <span class="dt-note-tools dt-hist-tools">${S(t)}<i class="dt-note-sep"></i
11
- ><button data-rm="${t.id}" title="Delete this comment">${C}</button></span>
12
- </div>`},x=$.find(t=>t.id===h),T=$.map(t=>{const e=m.filter(n=>v(n)===t.id&&l(n)!=="done");return{band:t,open:e.filter(n=>l(n)==="open").length,total:e.length}}).filter(t=>t.total&&t.band.id!==h),F=T.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${T.map(({band:t,open:e,total:n})=>`<button data-bp="${t.id}" data-state="${e?"open":"claude"}"
13
- title="${t.label}: ${e} open \xB7 ${n-e} to check"
14
- ><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${t.icon}</svg><i>${n}</i></button>`).join("")}</div>`:"",k=["open","claude","done"].filter(t=>o[t].length&&(t!=="done"||f)),O=t=>`<div class="dt-hist-row is-draft">
15
- <button class="dt-hist-go" data-draft-go="${t.i}">
16
- <span class="dt-hist-n">${_}</span>
17
- <span class="dt-hist-body">
18
- <span class="dt-hist-id">${i(t.el)}${t.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
19
- <span class="dt-hist-text">${t.text?i(t.text):`${t.shots} screenshot${t.shots===1?"":"s"}`}</span>
20
- </span>
21
- </button>
22
- <span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${t.i}" title="Discard this draft">${C}</button></span>
23
- </div>`,b=g.filter(t=>l(t)!=="done"),r=(t,e,n,c,d)=>`<button type="button" role="menuitemradio" aria-checked="${c}" ${t}="${e}"><i>${c?R:""}</i><span>${n}</span>${d==null?"":`<em>${d}</em>`}</button>`,L=()=>`<div class="dt-hist-find">
24
- <label class="dt-hist-search">${N}<input type="search" data-hist-q placeholder="Search comments" aria-label="Search comments" value="${i(s.q)}" spellcheck="false">${s.q?`<button type="button" data-hist-clear aria-label="Clear search">${G}</button>`:""}</label>
25
- <button type="button" class="dt-hist-filter${s.view!=="all"||s.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${s.menu}" data-tip="Filter">${z}</button>
26
- ${s.menu?`<div class="dt-hist-menu" role="menu">${r("data-hist-view","me","For me",s.view==="me",b.filter(a.forMe).length)}${r("data-hist-view","agent","Agent",s.view==="agent",b.filter(a.forAgent).length)}${r("data-hist-view","all","All",s.view==="all",b.length)}<hr>${r("data-hist-sort","new","Newest",s.sort==="new")}${r("data-hist-sort","unread","Unread first",s.sort==="unread")}</div>`:""}
27
- </div>`;return`<div class="dt-hist-head">
28
- <span class="dt-hist-here" title="${x?.label??h}"
29
- ><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true">${x?.icon??""}</svg></span>
30
- <span class="dt-hist-title">Comments</span>
31
- ${F}
32
- ${a.checks?`<button class="dt-review-btn" data-review aria-label="Check all ${a.checks} ${a.checks===1?"fix":"fixes"}" data-tip="${a.checks} ${a.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${R}${a.checks}</button>`:""}
33
- <button class="dt-hist-refresh" data-refresh aria-label="Reload comments from the file">
34
- <svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M16 10a6 6 0 1 1-1.8-4.3"/><path d="M16.3 3.4v3.4h-3.4"/></svg>
35
- </button>
36
- <button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel">
37
- <svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.5 8.5 10 12.5l4.5-4"/></svg>
38
- </button>
39
- </div>`+L()+(k.length||p.length?`<div class="dt-hist-list">${p.length?`<p class="dt-hist-group">Drafts<em>${p.length}</em></p>${p.map(O).join("")}`:""}${k.map(t=>`<p class="dt-hist-group">${U[t]}<em>${o[t].length}</em></p>`+o[t].map(E).join("")).join("")}</div>`:s.q.trim()?`<div class="dt-hist-empty">${N}<p>No comments match \xAB${i(s.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:s.view!=="all"?'<div class="dt-hist-empty"><p>Nothing in this view at this breakpoint.</p><button data-hist-view="all">Show all</button></div>':`<p class="dt-hist-empty">${o.done.length?"Everything here is resolved.":"No comments at this breakpoint yet. Click anything on the page to leave one."}</p>`)+`<div class="dt-hist-foot">
40
- <button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${f}"
41
- ><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="10" r="7.5"/><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round"/></svg
42
- ><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
43
- </div>`}export{Z as historyHtml};
@@ -1,7 +0,0 @@
1
- import{stateOf as l}from"../store/status.mjs";import{CROSS as E,NEXT as R,PREV as S,TICK as T,UNDO as x}from"./markup";function $(g){const{inFrame:f,everything:a,route:u,open:h,settle:v,keepIn:k,toast:w}=g,c="nm-review",o=()=>{try{return JSON.parse(sessionStorage.getItem(c)||"null")}catch{return null}},s=e=>{try{e?sessionStorage.setItem(c,JSON.stringify(e)):sessionStorage.removeItem(c)}catch{}},r=document.createElement("div");r.className="dt-review",r.setAttribute("role","region"),r.setAttribute("aria-label","Checking fixes"),r.hidden=!0,k(r),f||document.body.append(r);const m=()=>a().filter(e=>l(e)==="claude"),y=()=>{const e=m().sort((t,i)=>+(i.route===u())-+(t.route===u())||String(t.route).localeCompare(String(i.route))||t.id-i.id).map(t=>t.id);e.length&&(s({ids:e,i:0}),d())},d=()=>{const e=o();if(!e||f){r.hidden=!0;return}for(;e.i<e.ids.length&&l(a().find(n=>n.id===e.ids[e.i])??{status:"done"})!=="claude";)e.i++;if(e.i>=e.ids.length){s(null),r.hidden=!0,w("Every fix is checked.");return}s(e);const t=a().find(n=>n.id===e.ids[e.i]);if(t.route&&t.route!==u()){location.assign(t.route+location.search);return}h(t);const i=e.ids.slice(0,e.i).some(n=>l(a().find(p=>p.id===n)??{status:"done"})==="claude");r.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
2
- <span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${i?"":" disabled"}>${S}</button>
3
- <span class="dt-review-n">${e.i+1} of ${e.ids.length}</span>
4
- <button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${R}</button></span>
5
- <button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${T}</button>
6
- <button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${x}</button>
7
- <button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${E}</button>`,r.hidden=!1};r.addEventListener("click",async e=>{const t=e.target.closest("[data-r]"),i=o();if(!t||!i)return;if(t.dataset.r==="stop"){s(null),r.hidden=!0;return}if(t.dataset.r==="prev"){b();return}const n=i.ids[i.i];s({...i,i:i.i+1});const p=t.dataset.r==="ok"?v(n,!0):t.dataset.r==="no"?v(n,!1):null;d(),await p});const b=()=>{const e=o();if(e){for(let t=e.i-1;t>=0;t--)if(l(a().find(i=>i.id===e.ids[t])??{status:"done"})==="claude"){s({...e,i:t}),d();return}}};return document.addEventListener("keydown",e=>{r.hidden||e.metaKey||e.ctrlKey||e.altKey||e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||e.target.closest?.("input, textarea, select, [contenteditable]")||(e.preventDefault(),e.key==="ArrowLeft"?b():r.querySelector('[data-r="skip"]')?.click())}),{start:y,toCheck:m,resume:()=>{o()&&d()}}}export{$ as review};
package/src/client/run.js DELETED
@@ -1,73 +0,0 @@
1
- import{categoryIcon as As,categoryOf as le}from"../store/categories.mjs";import{stateOf as B}from"../store/status.mjs";import{DOCS as Rt,agentHandles as Hs,agentMentioned as Ns,agentName as ro,agentOwner as lo,agentStep as V,docOf as Cs,docSlug as co,handleOf as uo,held as po,stageOf as G,threadOf as Bt,toAgent as I,workingOn as Qe}from"../store/thread.mjs";import{api as ot,canvasCopy as mo,host as go,imageUrl as fo,local as M}from"./api";import{recentLogs as ho}from"./logs";import{inspectors as bo}from"./inspect";import{anchors as yo,clean as It}from"./anchor";import{bars as vo,fieldMenus as $o}from"./field-menu";import{AGENT_MARK as qs,CLAUDE_MARK as ut,CROSS as Ze,PENCIL as Os,TICK as Tt,TRASH as tn,UNDO as en,esc as p,stamp as Rs}from"./markup";import{canvas as wo}from"./canvas";import{historyHtml as Eo}from"./panel";import{review as So}from"./review";import{turbo as To}from"./turbo";function Do(c){const pt=c.breakpoints,nn=c.categories,de=(pt.find(t=>!Number.isFinite(t.max))??pt[0]).id,sn=t=>pt.find(e=>t>=e.min&&t<=e.max)?.id??de,tt=t=>t.breakpoint||de,Bs=t=>c.devices.find(e=>e.id===t),S=mo,q=(t,e)=>{S||M.setItem(t,e)},D=t=>ot("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),ce=t=>t.replace(/\/+$/,"")||"/";let P=ce(location.pathname);for(const t of document.querySelectorAll(".devtools .dt-icon[title]"))t.dataset.tip=t.title,t.getAttribute("aria-label")||t.setAttribute("aria-label",t.title),t.removeAttribute("title");const an=document.querySelector(".dt-grid-btn"),Dt=document.querySelector(".dt-grid-overlay"),on="dt-grid",ue=t=>{Dt.hidden=!t,an.setAttribute("aria-pressed",String(t)),q(on,t?"1":"0"),R({grid:t})};an.addEventListener("click",()=>ue(Dt.hidden===!0));const rn=document.querySelector(".dt-pages-name"),ln=()=>{let t=null;for(const s of document.querySelectorAll(".dt-pages a"))ce(new URL(s.href).pathname)===P?(s.setAttribute("aria-current","page"),t=s):s.removeAttribute("aria-current");const e=document.title.split("\u2014").pop()?.trim(),n=t?.querySelector(".dt-menu-label")?.textContent?.trim();rn.textContent=n||e||rn.textContent};ln();const dn=[...document.querySelectorAll(".devtools details")];let pe=!1;const Lt=()=>{const t=dn.filter(e=>e.open);for(const e of t)e.open=!1;return t};document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;const[e]=Lt();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{pe=dn.some(e=>e.open&&!e.contains(t.target))&&Lt().length>0},!0),addEventListener("blur",Lt);const Pt=document.querySelector(".dt-pad-overlay"),cn="dt-inspect",Is=[".devtools",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...c.ignore].join(", "),me=[".devtools",".dt-notes-overlay",".dt-history",".dt-frame",".dt-review",".dt-field-menu",'[aria-modal="true"]',...c.ignore].join(", "),ge={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),border:document.querySelector(".dt-border-btn")};let X="",fe=0;const{spacer:Ds,drawPads:Ps,drawSize:Fs,drawType:js,drawColor:_s,drawBorder:Ks}=bo(Pt),un=t=>{fe||(fe=requestAnimationFrame(()=>{fe=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(Is)){Pt.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),X==="sizes"?Fs(e):X==="type"?js(e):X==="color"?_s(e):X==="border"?Ks(e):Ps(t.altKey?e:Ds(e))}))},Ft=t=>{X=t;for(const[e,n]of Object.entries(ge))n.setAttribute("aria-pressed",String(e===t));q(cn,t),R({inspect:t}),Pt.hidden=!t,Pt.innerHTML="",t?document.addEventListener("mousemove",un):document.removeEventListener("mousemove",un)};for(const[t,e]of Object.entries(ge))e.addEventListener("click",()=>{t!==X&&nt(!1),Ft(X===t?"":t)});const pn=document.querySelector(".dt-notes-btn"),he=[...document.querySelectorAll(".dt-bp")],jt=document.querySelector(".dt-history-btn"),x=document.querySelector(".dt-history"),be=document.querySelector(".dt-studio-btn"),ye=document.querySelector(".dt-devices"),mt=document.querySelector(".dt-notes-hi"),Ws=mt.querySelector(".dt-hi-box"),mn=mt.querySelector(".dt-hi-tag"),it=document.querySelector(".dt-frame"),_t=it.querySelector("iframe"),ve=document.querySelector(".dt-notes-count"),b=document.querySelector(".dt-notes-overlay"),$e=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame",gn=t=>{for(const e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,n=>n.stopPropagation())};document.querySelectorAll($e).forEach(gn);const fn="dt-notes";let y=[],A=!1,$=null,d=null,we=0,O="",F=[],T=null,H=[];const Kt=(t=d)=>!!(t&&(t.text?.trim()||t.images?.length)),j=()=>{d&&Kt()&&H.push(d),d=null};let Mt=null,Ee=null;const hn=()=>`dt-draft:${P}${S?":canvas":""}`;let gt=hn(),Wt=0;const Se=()=>{if(!d&&!H.length&&!O){M.removeItem(gt);return}const t={draft:d,parked:H,reply:O?{for:Mt,text:O}:null};try{localStorage.setItem(gt,JSON.stringify(t))}catch{const e=n=>({...n,images:void 0});try{localStorage.setItem(gt,JSON.stringify({...t,draft:d&&e(d),parked:H.map(e)}))}catch{}}},rt=()=>{clearTimeout(Wt),Wt=setTimeout(Se,200)};addEventListener("pagehide",()=>{clearTimeout(Wt),Se()});let J=M.getItem("dt-resolved")!=="0";const N={q:"",menu:!1,view:["me","agent"].includes(M.getItem("dt-view")??"")?M.getItem("dt-view"):"all",sort:M.getItem("dt-sort")==="unread"?"unread":"new"},Us=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],zs=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Ys=()=>{const t=navigator.userAgent,e=i=>i.find(([o])=>o.test(t)),n=e(Us),s=e(zs),a=n?n[0].exec(t)?.[1]:null;return[n?`${n[1]}${a?" "+a:""}`:"unknown browser",s?.[1]].filter(Boolean).join(" \xB7 ")},Te=()=>sn(innerWidth),lt=()=>Ee??Te(),bn=()=>{const t=lt();for(const e of he)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:Vs,poolOf:Gs,contextOf:Xs,resolveEl:Js,anchorOf:Qs}=yo();let Le=new WeakMap;const yn=()=>{Le=new WeakMap},Q=t=>{let e=Le.get(t);return(e===void 0||e&&!e.isConnected)&&(e=Js(t),Le.set(t,e)),e},Ut=new Map,_=t=>{Ut.size||requestAnimationFrame(()=>Ut.clear());let e=Ut.get(t);return e===void 0&&(e=Qs(t,Q(t)),Ut.set(t,e)),e},vn=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(n=>n.playState==="running"))return!0;return!1};let zt=[];const Me=t=>{for(const e of zt)e.play();zt=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(const n of e.getAnimations())n.playState==="running"&&(n.pause(),zt.push(n))},$n=()=>{if(d)return Q(d);const t=$!=null?y.find(n=>n.id===$):null;if(!t)return null;const e=_(t);return e&&!e.off?Q(t):null},Zs="claude",ta=()=>(c.team??[]).filter(t=>t.email!==c.me?.email),ft=()=>[...c.me?(c.team??[]).filter(t=>t.email===c.me.email):[],...ta()],wn='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="10" cy="10" r="6.5" stroke-dasharray="2.4 2.4"/></svg>',ea=(t,e,n=!1)=>{const s=I(t)?"agent":t?"person":"nobody",a=xt(s==="person"?t:En()),i=[["person",a?Vt(a.avatar_url,a.name||a.email):Zt,s==="person"?`${Yt(t)==="you"?"You":Yt(t)} \u2014 pick someone else`:a?`Give it to ${a.email===c.me?.email?"me":a.name||a.email}`:"A person"],["nobody",wn,"Anyone \u2014 nobody has taken it yet"],["agent",ut(12),n?"Waits for the studio to approve it":s==="agent"?"Claude does it":"Give it to Claude"]],o=e!=null?y.find(u=>u.id===e):void 0,l=s==="agent"&&o?ke[V(o)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${l?` style="--step-c:${l}"`:""}>${i.filter(([u])=>u!=="person"||s==="person"||ft().length).map(([u,m,r])=>u===s?`<span class="dt-hand-stop dt-hand-stop--${u} is-on" role="radio" aria-checked="true" data-tip="${p(r)}" aria-label="${p(r)}">${u==="person"?ra(t,e):m}</span>`:`<button type="button" class="dt-hand-stop dt-hand-stop--${u}" role="radio" aria-checked="false" data-act="hand" data-v="${u}"${e?` data-id="${e}"`:""} data-tip="${p(r)}" aria-label="${p(r)}"${u==="agent"&&n?" disabled":""}>${m}</button>`).join("")}</span>`},En=()=>{const t=aa();return t&&!I(t)&&ft().some(e=>e.email===t)?t:ft()[0]?.email??""},na=()=>{const t=b.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},Sn="cubic-bezier(0.32, 0.72, 0, 1)",Tn=t=>{const e=b.querySelector(".dt-hand .dt-hand-stop.is-on");if(!t||!e||matchMedia("(prefers-reduced-motion: reduce)").matches)return;const n=e.getBoundingClientRect(),s=document.createElement("span");s.className="dt-hand dt-hand-ghost",s.style.cssText=`left:${t.rect.left}px;top:${t.rect.top}px;width:${t.rect.width}px;height:${t.rect.height}px`,t.ghost.querySelectorAll("select").forEach(a=>a.tabIndex=-1),s.append(t.ghost),b.append(s),s.animate([{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(()=>s.remove(),()=>s.remove()),Ie=performance.now()+480,e.animate([{transform:`translateX(${t.rect.left-n.left}px)`,width:`${t.rect.width}px`},{transform:"none",width:`${n.width}px`}],{duration:460,easing:Sn});for(const a of e.children)a.animate([{opacity:0,transform:"scale(0.92)",filter:"blur(3px)"},{opacity:0,transform:"scale(0.92)",filter:"blur(3px)",offset:.4},{opacity:1,transform:"none",filter:"blur(0)"}],{duration:460,easing:Sn});for(const a of e.parentElement?.querySelectorAll("button.dt-hand-stop")??[])a.animate([{opacity:0},{opacity:1}],{duration:300,delay:140,easing:"ease-out",fill:"backwards"})},sa=(t,e)=>{const n=Ie>performance.now()?void 0:na(),s=e==="agent"?Zs:e==="person"?En():e==="me"?c.me?.email??"":"";if(!t){if(!d)return;d.assignee=s,d.stage=I(s)?"approved":!d.stage||d.stage==="approved"?"new":d.stage,e==="person"&&M.setItem("nm-for",s),rt(),f(),Tn(n);return}const a=y.find(l=>l.id===t);if(a&&Qe(a)&&!I(s)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;const i=a?G(a):"new",o=I(s)?"approved":i==="approved"?"new":i;W(l=>l.map(u=>u.id===t?{...u,assignee:s||void 0,stage:o}:u),()=>D({id:t,assignee:s||null,stage:o}),I(s)?"Approving it for the agent":"Reassigning"),Tn(n)},aa=()=>M.getItem("nm-for")??"",kt=t=>I(t)?"#d97757":t?"#0d99ff":"#717171",Yt=t=>t===c.me?.email?"you":c.team?.find(e=>e.email===t)?.name||t.split("@")[0],xt=t=>t?c.team?.find(e=>e.email===t):void 0,Ln=t=>{const e=It(t??"").split(/\s+/).filter(Boolean);return p(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},Vt=(t,e,n="dt-face")=>t?`<img class="${n}" src="${p(t)}" alt="">`:`<b class="${n}" aria-hidden="true">${Ln(e)}</b>`,Mn=t=>{const e=xt(t.by);return e||t.byName?Vt(e?.avatar_url,e?.name||t.byName||t.by):""},kn=t=>`var(--dt-avatar-${[...t].reduce((e,n)=>e*31+n.charCodeAt(0)>>>0,7)%8+1})`,ke={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},ht=(()=>{try{return JSON.parse(M.getItem("dt-seen")||"{}")}catch{return{}}})(),xn=()=>q("dt-seen",JSON.stringify(ht)),An=t=>{const e=Bt(t);if(!(t.id in ht))return ht[t.id]=e.length,xn(),!1;const n=e[e.length-1];return e.length>ht[t.id]&&!(n?.author==="you"&&(!n.by||n.by===c.me?.email))},oa=t=>{const e=Bt(t).length;ht[t.id]!==e&&(ht[t.id]=e,xn())},xe=t=>{const e=xt(t);return e?` data-face="${p(e.avatar_url??"")}" data-initial="${Ln(e.name||e.email)}"`:""},dt=(t,e)=>ro(t),Hn=t=>{const e=xt(t);return e?Vt(e.avatar_url,e.name||e.email):""},ia=t=>{const e=xt(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${p(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${ut(12)}</b>`},ra=(t,e)=>{const n=(a,i)=>`<option value="${p(a)}" data-c="${kt(a)}"${xe(a||null)}${t===a?" selected":""}>${p(i)}</option>`,s=(c.team??[]).filter(a=>a.email!==c.me?.email);return`<label class="dt-field dt-field--knob"><span class="dt-field-box dt-field-box--face" style="--cat:${kt(t)}">${Hn(t||null)||Zt}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
2
- ${c.me?n(c.me.email,`Me \xB7 ${c.me.name||c.me.email}`):""}
3
- ${s.map(a=>n(a.email,a.name||a.email)).join("")}${t&&t!==c.me?.email&&!s.some(a=>a.email===t)?n(t,Yt(t)):""}
4
- </select></span></label>`},la=t=>`<div class="dt-suggest dt-suggest--read"><del>${p(t.from)}</del><ins>${p(t.to)}</ins></div>`,Nn=(t,e)=>{const n=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return p([n,It(e??"")&&`\u201C${It(e).slice(0,80)}\u201D`].filter(Boolean).join(" \xB7 "))},da='<svg class="dt-chev" viewBox="0 0 12 12" width="9" height="9" aria-hidden="true"><path d="M3 4.5 6 7.5 9 4.5"/></svg>',ca=(t,e)=>{const n=le(t);return`<label class="dt-field dt-field--bare" data-tip="Type: ${p(n.label)}"><span class="dt-field-box">${As(n)}<span class="dt-field-label">${p(n.label)}</span>${da}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${nn.map(s=>`<option value="${s.id}" data-c="${s.color}" data-icon="${p(As(s))}"${s.id===t?" selected":""}>${s.label}</option>`).join("")}</select></span></label>`},Ae=[["new","New","#0d99ff",.25],["progress","In progress","#f5a623",.5],["review","Needs review","#8e4ec6",.75],["waiting","Waiting","#e93d82",.875],["accepted","Accepted","#30a46c",.95]],Cn=(t,e)=>{const s=2*Math.PI*e,a=8+3.3*Math.sin(s),i=8-3.3*Math.cos(s),o=`<path d="M8 8V${8-3.3}A${3.3} ${3.3} 0 ${e>.5?1:0} 1 ${a.toFixed(2)} ${i.toFixed(2)}Z" fill="${t}"/>`;return`<svg class="dt-stage-icon" viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><rect x="3.2" y="3.2" width="9.6" height="9.6" rx="2.4" transform="rotate(45 8 8)" fill="none" stroke="${t}" stroke-width="1.5"/>${o}</svg>`},Gt=t=>G(t)==="accepted"?"accepted":Qe(t)||G(t)==="progress"?"progress":G(t)==="review"?"review":G(t)==="waiting"?"waiting":"new",Xt={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",held:"new",done:"accepted"},qn=[...Ae,["done","Resolved","#30a46c",1]],ua=t=>{const e=V(t),n=t.status==="done"&&e!=="review"?"done":e&&Xt[e]?Xt[e]:Gt(t),[,,s,a]=qn.find(i=>i[0]===n);return`<label class="dt-field" data-tip="${e&&Xt[e]?"Follows Claude \u2014 or pick one":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${s}">${Cn(s,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${qn.map(([i,o,l,u])=>`<option value="${i}" data-c="${l}" data-icon="${p(Cn(l,u))}"${i===n?" selected":""}>${o}</option>`).join("")}</select></span></label>`},On=(t,e)=>{const n=y.find(i=>i.id===t);if(!n)return;if(e==="done"){bt(t,!0);return}const s=e==="new"?I(n.assignee)?"approved":"new":e,a=n.status==="done"?{status:"open",doneBy:null}:{};W(i=>i.map(o=>o.id===t?{...o,...a,stage:s}:o),()=>D({id:t,...a,stage:s}),"Setting the status")},Jt=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],pa=(t,e)=>{const n=Math.max(0,Jt.findIndex(l=>l[0]===t)),[,s,a,i]=Jt[n],o=Jt[(n+1)%Jt.length];return`<button type="button" class="dt-prio" style="--cat:${a}" data-act="prio" data-v="${o[0]}"${e?` data-id="${e}"`:""} data-tip="Priority: ${s} \u2014 click for ${o[1]}" aria-label="Priority ${s}">${vo(i,a)}<span>${s}</span></button>`},Qt=()=>!!c.me&&/@guest\.notemend\.com$/i.test(c.me.email),Rn=(t,e,n,s,a=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${c.client?"":pa(t,n)}${ca(le(e).id,n)}</span>${c.client||Qt()?"":ea(s,n,a)}</div>`,Zt='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="6.8" r="3"/><path d="M4.2 16.5c.6-3 3-4.8 5.8-4.8s5.2 1.8 5.8 4.8" stroke-linejoin="round"/></svg>',ma='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="8.5" cy="6.8" r="3"/><path d="M2.8 16.5c.6-3 3-4.8 5.7-4.8 1.3 0 2.5.4 3.5 1.1M15.5 11v5M13 13.5h5" stroke-linejoin="round"/></svg>',ga='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="6.8" r="3"/><path d="M4.2 16.5c.6-3 3-4.8 5.8-4.8s5.2 1.8 5.8 4.8" stroke-linejoin="round"/><path d="M3.5 3.5l13 13"/></svg>',fa='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="5" cy="10" r="1.1" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.1" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.1" fill="currentColor" stroke="none"/></svg>',Bn=(t,e)=>`<label class="dt-more" data-tip="More"><span aria-hidden="true">${fa}</span><select class="dt-more-select"${e?` data-id="${e}"`:""} aria-label="More">
5
- <option value="" hidden selected></option>
6
- ${c.client?"":`<option value="team" data-icon="${p(ga)}"${t?"":" data-on"}>Team only</option>
7
- <option value="client" data-icon="${p(Zt)}"${t?" data-on":""}>Team and client</option>`}
8
- <option value="${e?"rm":"discard"}" data-icon="${p(tn)}" data-danger${c.client?"":" data-sep"}>${e?"Delete thread":"Discard draft"}</option>
9
- </select></label>`,In='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z"/><circle cx="10" cy="10" r="2.3"/></svg>',ha=()=>(c.team??[]).filter(t=>!c.studio||c.studio.includes(t.email)),ba=t=>{const e=t||c.lead||"",n=ha();if(!n.length)return"";const s=Hn(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${s?" dt-field-box--face":""}" style="--cat:${kt(e||"x@x")}">${s}<select class="dt-for-select" aria-label="Who this is for">
10
- ${n.map(a=>`<option value="${p(a.email)}" data-c="${kt(a.email)}"${xe(a.email)}${e===a.email?" selected":""}>${p(a.name||a.email)}</option>`).join("")}
11
- </select></span></label>`},He='<svg viewBox="0 0 20 20" width="9" height="9" aria-hidden="true"><path d="M5.5 5.5l9 9M14.5 5.5l-9 9"/></svg>',Dn='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',ya='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M2.5 1.5h2.5v9H2.5zM7 1.5h2.5v9H7z"/></svg>',va=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,$a=(t,e)=>{const n=t.closest(".dt-voice"),s=n.querySelector("audio"),a=n.querySelector(".dt-voice-play");if(!s.dataset.wired){s.dataset.wired="1";const l=n.querySelector(".dt-voice-track i"),u=n.querySelector(".dt-voice-time"),m=()=>Number.isFinite(s.duration)?s.duration:0;s.addEventListener("timeupdate",()=>{l.style.transform=`scaleX(${m()?Math.min(1,s.currentTime/m()):0})`,u.textContent=va(s.currentTime)}),s.addEventListener("play",()=>{a.innerHTML=ya,a.setAttribute("aria-label","Pause"),n.classList.add("is-playing")}),s.addEventListener("pause",()=>{a.innerHTML=Dn,a.setAttribute("aria-label","Play the voice note"),n.classList.remove("is-playing")}),s.addEventListener("ended",()=>{s.currentTime=0})}const i=()=>{if(e){const l=n.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(s.duration)&&(s.currentTime=Math.max(0,Math.min(1,(e.clientX-l.left)/l.width))*s.duration);return}if(!s.paused){s.pause();return}b.querySelectorAll(".dt-voice audio").forEach(l=>{l!==s&&l.pause()}),s.play().catch(()=>{})};if(Number.isFinite(s.duration)||s.readyState<1){s.readyState<1?s.addEventListener("loadedmetadata",()=>Number.isFinite(s.duration)?i():o(),{once:!0}):i();return}o();function o(){s.addEventListener("timeupdate",()=>{s.currentTime=0,i()},{once:!0}),s.currentTime=1e9}},Ne=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),Pn=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),At=new Map,wa=t=>{if(!t.startsWith("data:"))return t;let e=At.get(t);if(!e){const[n,s]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(s),a=>a.charCodeAt(0))],{type:n.slice(5).split(";")[0]})),At.set(t,e),At.size>8){const[a,i]=At.entries().next().value;URL.revokeObjectURL(i),At.delete(a)}}return e},Ea=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${Dn}</button><button type="button" class="dt-voice-track" data-act="voice-seek" aria-label="Jump"><i></i></button><span class="dt-voice-time">0:00</span><audio src="${wa(t)}" preload="metadata"></audio>${e===void 0?"":`<button class="dt-voice-rm" data-act="voice-write" ${e} aria-label="Write it out" title="Write it out \u2014 its words go in the box">${Aa}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${He}</button>`}</span>`,Sa=(t,e,n)=>`<span class="dt-shot dt-doc">${t.startsWith("data:")?`<span class="dt-doc-name">${_n}${p(e)}</span>`:`<a class="dt-doc-name" href="${t}" target="_blank" rel="noreferrer">${_n}${p(e)}</a>`}${n===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${n} aria-label="Remove">${He}</button>`}</span>`,Fn=(t,e,n=t)=>Cs(n)?Sa(t,Cs(n),e):Ne(n)?Ea(t,e):`<span class="dt-shot${Pn(n)?" dt-shot--video":""}">${Pn(n)?`<video src="${t}" controls preload="metadata" playsinline></video>`:`<a href="${t}" target="_blank"><img src="${t}" alt="" loading="lazy" /></a>`}${e===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${e} aria-label="Remove">${He}</button>`}</span>`,Ce=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(n=>{const s=n.split("/").pop(),a=fo(s);return Fn(a,e===void 0?void 0:`data-id="${e}" data-img="${p(s)}"`,s)}).join("")}</div>`:"",jn=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,n)=>Fn(e,`data-i="${n}"`)).join("")}</div>`:"",_n='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M11.5 2.5H6a1.5 1.5 0 0 0-1.5 1.5v12A1.5 1.5 0 0 0 6 17.5h8a1.5 1.5 0 0 0 1.5-1.5V6.5z"/><path d="M11.5 2.5v4h4"/></svg>',Ta='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="7.5" y="3" width="5" height="9" rx="2.5"/><path d="M5 9.5a5 5 0 0 0 10 0M10 14.5V17"/></svg>',La='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Ma=90,qe=32,ka=()=>!!c.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u";let te=!1;const xa=async(t,e)=>{if(te||!t)return;const n=Number(t.dataset.id)||0;te=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let s;try{s=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(E){te=!1,e.classList.remove("is-asking");const k=E?.name;C(k==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":k==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":k==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${E?.message||k||"unknown error"}`);return}e.classList.remove("is-asking");const a=()=>b.querySelector(n?`.dt-note[data-id="${n}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),i=document.createElement("div");i.className="dt-rec",i.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${tn}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(qe)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${La}</button>`;const o=i.querySelector("b"),l=[...i.querySelectorAll(".dt-rec-wave i")],u=new AudioContext,m=u.createAnalyser();m.fftSize=512,u.createMediaStreamSource(s).connect(m);const r=new Uint8Array(m.fftSize),h=[],g=new MediaRecorder(s,{audioBitsPerSecond:32e3}),w=[],L=Date.now();let z=!0;const Y=setInterval(()=>{const E=a();E&&i.parentElement!==E&&E.appendChild(i),m.getByteTimeDomainData(r);let k=0;for(const at of r)k+=((at-128)/128)**2;h.push(Math.min(1,Math.sqrt(k/r.length)*4));const st=h.slice(-qe);l.forEach((at,St)=>{const ct=st[St-(qe-st.length)];at.style.transform=`scaleY(${Math.max(.1,ct??0).toFixed(2)})`,at.classList.toggle("is-empty",ct===void 0)});const v=Math.floor((Date.now()-L)/1e3);o.textContent=`${Math.floor(v/60)}:${String(v%60).padStart(2,"0")}`,v>=Ma&&g.state!=="inactive"&&g.stop()},90),Et=E=>{z=E,g.state!=="inactive"&&g.stop()};i.querySelector(".dt-rec-x").addEventListener("click",E=>{E.stopPropagation(),Et(!1)}),i.querySelector(".dt-rec-done").addEventListener("click",E=>{E.stopPropagation(),Et(!0)}),i.addEventListener("keydown",E=>{E.key==="Escape"&&(E.stopPropagation(),Et(!1))}),g.ondataavailable=E=>{E.data.size&&w.push(E.data)},g.onstop=async()=>{if(clearInterval(Y),s.getTracks().forEach(st=>st.stop()),u.close().catch(()=>{}),i.remove(),te=!1,!z)return;const E=new Blob(w,{type:g.mimeType||"audio/webm"}),k=await new Promise(st=>{const v=new FileReader;v.onload=()=>st(String(v.result)),v.readAsDataURL(E)});n?F.push(k):d&&(d.images??=[]).push(k),f(),a()?.querySelector("textarea")?.focus()},g.start(1e3),a()?.appendChild(i),i.querySelector(".dt-rec-done").focus()},Kn="\u{1F3A4} Voice note",Aa='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><rect x="2.5" y="4.5" width="15" height="11" rx="2"/><path d="M6 11.5h3M11 11.5h3M6 8.5h8"/></svg>',Ha=async t=>{const e=t.closest(".dt-note"),s=(e?.hasAttribute("data-draft")?d?.images??[]:F)[Number(t.dataset.i)];if(!s||t.classList.contains("is-asking"))return;t.classList.add("is-asking");const a=await ot("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:s})}).catch(()=>null),i=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!i.text){C(i.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}const o=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");o&&(o.value=o.value.trim()?`${o.value.trimEnd()} ${i.text}`:i.text,o.dispatchEvent(new Event("input",{bubbles:!0})),o.focus())},Z=new Map,Na=async(t,e)=>{const n=`${t}:${e}`;if(Z.has(n)){Z.delete(n),f();return}const s=y.find(l=>l.id===t),a=s&&Bt(s).find(l=>(l.at??"0")===e);if(!a?.text)return;Z.set(n,null),f();const i=await ot("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:a.text,to:navigator.language||"en"})}).catch(()=>null),o=i?await i.json().catch(()=>({})):{};Z.has(n)&&(i?.ok&&o.text?Z.set(n,o.text):(Z.delete(n),C(o.error||"Could not translate it \u2014 try again.")),f())},Ca='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M3 5h8M7 3v2m2 0c-.6 3.2-2.8 6-6 7.5M5.5 8.5c.8 1.6 2.2 2.9 4 3.8M10.5 17l3.25-7.5L17 17m-5.5-2h4.5"/></svg>',qa='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="3" y="4" width="14" height="12" rx="2"/><circle cx="7.5" cy="8.5" r="1.4"/><path d="m3.5 14.5 4-4 3 3 2-2 4 4"/></svg>',Wn=(t,e,n,s,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
12
- <textarea class="${t}" rows="1" placeholder="${e}">${p(n)}</textarea>
13
- ${a}
14
- <div class="dt-compose-bar">
15
- <span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a screenshot, a PDF or a Word file \u2014 or paste or drop one">${qa}</button>
16
- ${ka()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${Ta}</button>`:""}</span>
17
- <button class="dt-send${n.trim()?" is-ready":""}" ${s} title="Send (Enter)"
18
- ><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 15.5v-11M5.5 9 10 4.5 14.5 9"/></svg></button>
19
- </div>
20
- </div></div>`,Oe=(t,e)=>(t||"element")+(e?.[0]?"."+e[0]:""),Un=()=>H.map((t,e)=>({i:e,el:Oe(t.tag,t.classes),text:It(t.text??""),shots:t.images?.length??0,orphan:!_(t)}));let Re=[],zn="";const K=t=>{const e=t.working;return dt(e?.agent,e?.by??lo(t.assignee))},Yn=t=>{const e=Math.max(1,Math.round((Date.now()-Date.parse(t??""))/6e4)||1);return e<60?`${e} min`:`${Math.round(e/60)} h`},ee=(t,e)=>{const n=t.working;return{held:"From a guest \u2014 waits for the studio to approve it",queued:`Queued for ${K(t)} \u2014 it takes it on its next run`,asks:`${K(t)} is waiting for your answer`,working:`${K(t)} is on it \xB7 ${Yn(n?.at)}`,stuck:`${K(t)} went quiet \u2014 its next run takes it again`,review:`Resolved by ${dt(t.doneAgent,t.doneFor)} \u2014 click to clear`,done:"Resolved"}[e]},Oa=t=>{const e=V(t);if(!e)return c.client||Qt()||t.status==="done"?"":`<button class="dt-note-state dt-step--none" data-act="hand" data-v="agent" data-id="${t.id}" data-tip="Hand to Claude" aria-label="Hand to Claude">${qs(13,0)}</button>`;const n=qs(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${p(ee(t,e))}" aria-label="${p(ee(t,e))}">${n}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${p(ee(t,e))}" role="img" aria-label="${p(ee(t,e))}">${n}</span>`},Vn=t=>{const e=B(t),n=e==="done";return`${Oa(t)}<button data-act="${n?"reopen":"done"}" data-id="${t.id}"
21
- class="dt-note-resolve${n?" is-on":""}" title="${n?"Reopen":e==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${Tt}</button>`},Ra=t=>t?new Date(t).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}):"",Ba=t=>{if(c.client)return"";const e=V(t),n={act:"hand",v:"me",icon:Zt,tip:c.me?"Take it myself":"Take it off Claude"},s={act:"reopen",icon:en,tip:"Reopen"},a=[{act:"accept",icon:Tt,tip:"Looks right \u2014 accept it",main:!0},{act:"sendback",icon:en,tip:"Send it back \u2014 say what is wrong below"}],i=t.working,o=!I(t.assignee)&&t.assignee?t.assignee===c.me?.email?"You":Yt(t.assignee):"",l=e==="queued"?{step:e,title:`Queued for ${K(t)}`,acts:[n]}:e==="working"?{step:e,title:`${K(t)} is working`,acts:[n],live:!0}:e==="asks"?{step:e,title:`${K(t)} asks`,acts:[]}:e==="stuck"?{step:e,title:`${K(t)} silent for ${Yn(i?.at)}`,acts:[n]}:e==="review"?null:t.status!=="done"&&G(t)==="accepted"?{step:"done",title:`Accepted${t.acceptedAt?` \xB7 ${Ra(t.acceptedAt)}`:""}`,acts:[{...s,act:"sendback",tip:"Send it back"}]}:G(t)==="review"&&o?{step:"review",title:`${o} ${o==="You"?"say":"says"} done \u2014 check it`,acts:a}:!e&&!t.assignee&&t.status!=="done"&&c.me&&!Qt()?{step:"anyone",title:"Unassigned",acts:[{act:"hand",v:"me",icon:Tt,tip:"Take it myself"},{act:"hand",v:"agent",icon:ut(13),tip:`Give it to ${K(t)}`},{act:"give",icon:ma,tip:"Give it to someone",pick:!0}]}:null;return l?`<div class="dt-step dt-step--${l.step}">${l.step==="anyone"?wn:""}<span class="dt-step-text"><b>${p(l.title)}</b></span>${l.acts.map(u=>u.pick?`<label class="dt-step-act" data-tip="${p(u.tip)}">${u.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${p(u.tip)}"><option value="" selected hidden></option>${ft().map(m=>`<option value="${p(m.email)}"${xe(m.email)}>${p(m.email===c.me?.email?`Me \xB7 ${m.name||m.email}`:m.name||m.email)}</option>`).join("")}</select></label>`:`<button type="button" class="dt-step-act${u.main?" is-main":""}" data-act="${u.act}" data-id="${t.id}"${u.v?` data-v="${u.v}"`:""} data-tip="${p(u.tip)}" aria-label="${p(u.tip)}">${u.icon}</button>`).join("")}${l.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`:""},Ia=async(t,e)=>{const n=e?y.find(a=>a.id===t):void 0,s=n?await ze(Q(n)):null;return D(e?{id:t,status:"done",doneBy:"you",...s?{after:s}:{}}:{id:t,status:"open",doneBy:null,stage:Gn(y.find(a=>a.id===t))})},W=async(t,e,n)=>{const s=y,a=vt;y=t(y),vt=t(vt),f();const i=await e().catch(()=>null);if(!i?.ok){y=s,vt=a,f(),C(`${n} did not go through${i?` (${i.status})`:""}.`);return}oe()},Gn=t=>t?I(t.assignee)?"approved":t.assignee?"progress":"new":"new",bt=(t,e)=>W(n=>n.map(s=>s.id===t?{...s,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{stage:Gn(s),reopenedAt:new Date().toISOString()}}:s),()=>Ia(t,e),e?"Resolving":"Reopening"),Be=t=>W(e=>e.filter(n=>n.id!==t),()=>ot(`comments?id=${t}`,{method:"DELETE"}),"Deleting"),Da=t=>{const e=y.filter(a=>tt(a)===t),n=e.filter(a=>B(a)==="open").length,s=e.filter(a=>B(a)==="claude").length;ve.innerHTML=n?String(n):s?ut(9):"\u2713",ve.dataset.state=n?"open":s?"claude":"done",ve.hidden=e.length===0};let Ie=0,Xn;const f=()=>{const t=Ie-performance.now();if(t>0){clearTimeout(Xn),Xn=setTimeout(f,t);return}if(rt(),S){const r=Un(),h=JSON.stringify(r);h!==zn&&(zn=h,parent.postMessage({dt:!0,drafts:r},location.origin))}bn(),$!==Mt&&(O="",F=[],Mt=$),T&&T.id!==$&&(T=null);const e=lt();if(Da(e),!A){b.innerHTML="",Me(null);return}const n=e;let s="";const a=y.filter(r=>tt(r)===n&&(J||B(r)!=="done"||r.id===$));for(const r of a){const h=_(r);if(!h&&$!==r.id)continue;const g=B(r),w=!h,L=h??{x:0,y:0},z=le(r.category),Y=Qe(r),Et=g==="done"?null:V(r),E=Et?ke[Et]??"":"";if($===r.id&&oa(r),w||(s+=`<button class="dt-pin dt-pin--${g}${E?" dt-pin--agent":""}${Y?" dt-pin--working":""}${g==="open"&&G(r)==="review"?" dt-pin--review":""}" data-id="${r.id}"${h?.off?` data-off="${h.off}"`:""} aria-label="Comment ${r.id}, ${g==="open"?"open":g==="claude"?`resolved by ${p(dt(r.doneAgent,r.doneFor))}`:"resolved"}" aria-expanded="${$===r.id}"
22
- style="left:${L.x}px;top:${L.y}px;--cat:${z.color};--ring:${Ae.find(k=>k[0]===Gt(r))[2]};--hue:${kn(r.by||r.byName||"")}${E?`;--step-c:${E}`:""}"
23
- title="${p(r.text.slice(0,80))} \xB7 ${z.label}${Y?` \xB7 ${p(dt(Y.agent,Y.by))} is on it`:""}${g==="claude"?` \xB7 resolved by ${p(dt(r.doneAgent,r.doneFor))} \u2014 tick to confirm`:g==="done"?" \xB7 resolved":""}">${g==="done"?"\u2713":E?ut(11):Mn(r)}${g!=="done"&&$!==r.id&&An(r)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}</button>`),$===r.id){const k=Bt(r),st=V(r)==="review"&&!c.client?k.map(v=>v.author).lastIndexOf("claude"):-1;s+=`<div class="dt-note${w?" dt-note--orphan":""}" data-id="${r.id}" role="dialog" aria-label="Comment ${r.id}"
24
- style="left:${L.x}px;top:${L.y}px">
25
- <div class="dt-note-bar">
26
- <span class="dt-note-el"${c.client?"":` data-tip="${Nn(r.selector,r.label)}"`}>${c.client?`Comment #${Fa(r)}`:p(Oe(r.tag,r.classes))}</span>
27
- <span class="dt-note-tools">
28
- ${!c.client&&r.shared?`<span class="dt-note-eye" data-tip="The client sees this thread" role="img" aria-label="The client sees this thread">${In}</span>`:""}
29
- ${Vn(r)}
30
- <i class="dt-note-sep"></i>
31
- ${Bn(r.shared,r.id)}
32
- <button data-act="close" data-id="${r.id}" data-tip="Close" aria-label="Close">${Ze}</button>
33
- </span>
34
- </div>
35
- ${w?'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>':""}
36
- ${(()=>{const v=(c.client?"":ua(r))+(r.host&&r.host!==location.host?`<span class="dt-note-host" title="Written on ${p(r.host)}">${p(r.host)}</span>`:"");return v?`<div class="dt-note-meta">${v}</div>`:""})()}
37
- <div class="dt-note-thread">
38
- ${k.map((v,at)=>{const St=at===0?null:v.at??null,ct=v.author==="you"&&(!v.by||v.by===c.me?.email),Ts=ct&&T?.id===r.id&&T.at===St,Ot=c.team?.find(Je=>Je.email===v.by),Ls=v.author==="claude"?dt(v.agent,v.by):ct?"You":Ot?.name||v.byName||v.by||"You",Ms=v.author==="claude"?Ot?.agent_avatar_url?`<img class="dt-msg-face" src="${p(Ot.agent_avatar_url)}" alt="">`:`<span class="dt-msg-face dt-msg-ai">${ut(11)}</span>`:Ot?.avatar_url?`<img class="dt-msg-face" src="${p(Ot.avatar_url)}" alt="">`:"",Xe=`${r.id}:${v.at??"0"}`,re=Z.get(Xe),ks=!ct&&c.voice&&v.text?`<button class="dt-msg-edit${Z.has(Xe)?" is-on":""}" data-act="translate" data-id="${r.id}" data-at="${p(v.at??"0")}" title="${Z.has(Xe)?"Show the original":"Translate into your language"}">${Ca}</button>`:"",xs=`<div class="dt-msg-head">${Ms}<b>${p(Ls)}</b><time>${Rs(v.at)}</time>${ks}${ct&&!Ts?`<button class="dt-msg-edit" data-act="edit" data-id="${r.id}" data-at="${p(St??"")}" title="Edit">${Os}</button>${St?`<button class="dt-msg-edit" data-act="unsay" data-id="${r.id}" data-at="${p(St)}" title="Delete">${tn}</button>`:""}`:""}</div>`;return at===st?`<div class="dt-msg dt-msg--done" data-msg="${r.id}:${p(v.at??"0")}"><div class="dt-msg-head">${Ms}<b>${p(Ls)} fixed it</b><time>${Rs(v.at)}</time>${ks}</div><p${re===null?' class="is-asking"':""}>${ps(re||v.text)}</p>${Ce(v.images)}
39
- <div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${r.id}">${Tt}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${r.id}">${en}Send back</button></div></div>`:Ts?`<div class="dt-msg">${xs}<div class="dt-compose">
40
- <textarea class="dt-note-edit-input" rows="1">${p(T.text)}</textarea>
41
- ${Ce(v.images.filter(Je=>!T.drop.includes(Je.split("/").pop())),r.id)}
42
- <div class="dt-compose-bar">
43
- <button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
44
- <button class="dt-send${T.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${Tt}</button>
45
- </div>
46
- </div></div>`:`<div class="dt-msg" data-msg="${r.id}:${p(v.at??"0")}">${xs}<p${re===null?' class="is-asking"':""}>${ps(re||v.text)}</p>${at===0&&r.suggest?la(r.suggest):""}${Ce(v.images)}</div>`}).join("")}
47
- </div>
48
- ${Ba(r)}
49
- ${Wn("dt-note-reply-input",V(r)==="asks"?`Answer ${p(K(r))}`:"Reply",O,`data-act="reply" data-id="${r.id}"`,jn(F))}
50
- ${Rn(r.priority,r.category,r.id,r.assignee??"",po(r))}
51
- </div>`}}H.forEach((r,h)=>{const g=_(r);g&&(s+=`<button class="dt-pin dt-pin--draft" data-parked="${h}" data-act="draft-open" data-i="${h}"
52
- style="left:${g.x}px;top:${g.y}px" title="Draft, not sent \u2014 click to finish it">${Os}</button>`)});const i=d&&_(d);if(d){const r=i?.x??0,h=i?.y??0;s+=`${i?`<span class="dt-pin dt-pin--draft" data-draft style="left:${r}px;top:${h}px"></span>`:""}
53
- <div class="dt-note${i?"":" dt-note--orphan"}" data-draft style="left:${r}px;top:${h}px">
54
- <div class="dt-note-bar">
55
- <span class="dt-note-el"${c.client?"":` data-tip="${Nn(d.selector,d.label)}"`}>${c.client?"New comment":p(Oe(d.tag,d.classes))}</span>
56
- ${Kt()?'<span class="dt-note-draft">Draft</span>':""}
57
- <span class="dt-note-tools">
58
- ${!c.client&&d.shared?`<span class="dt-note-eye" data-tip="The client will see this thread" role="img" aria-label="The client will see this thread">${In}</span>`:""}
59
- ${Bn(d.shared)}
60
- <button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${Ze}</button>
61
- </span>
62
- </div>
63
- ${i?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
64
- ${(()=>{const g=i?Q(d):null,w=g&&y.find(L=>L.id>0&&B(L)==="open"&&Q(L)===g);return w?`<p class="dt-note-twin">Already open here: \u201C${p(w.text.slice(0,60))}${w.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${w.id}">Open it</button></p>`:""})()}
65
- ${c.client?`<div class="dt-note-meta">${ba(d.assignee)}</div>`:""}
66
- ${d.suggest?`<div class="dt-suggest"><span class="dt-suggest-head">New wording for this text<button data-act="unsuggest" title="Keep the text as it is">${Ze}</button></span>
67
- <span class="dt-suggest-was">Now: <del>${p(d.suggest.from.slice(0,160))}${d.suggest.from.length>160?"\u2026":""}</del></span>
68
- <textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${p(d.suggest.to)}</textarea>
69
- <span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
70
- ${Wn("dt-note-input",d.suggest?"Why (optional)":"Comment",d.text??"",'data-act="save"',jn(d.images))}
71
- ${Rn(d.priority,d.category,void 0,d.assignee??"")}
72
- </div>`}const o=new Map([...b.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(r=>[r.closest(".dt-note").dataset.id,{top:r.scrollTop,end:r.scrollTop+r.clientHeight>=r.scrollHeight-4}])),l=new Set([...b.querySelectorAll("[data-msg]")].map(r=>r.dataset.msg)),u=b.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");b.innerHTML=s,u&&ae(".dt-note-reply-input");for(const r of b.querySelectorAll(".dt-note[data-id] .dt-note-thread")){const h=r.closest(".dt-note").dataset.id,g=o.get(h);if(!g)continue;const w=[...r.querySelectorAll("[data-msg]")].filter(L=>!l.has(L.dataset.msg));for(const L of w)L.classList.add("dt-msg--new");r.scrollTop=g.end&&w.length?r.scrollHeight:g.top}for(const r of b.querySelectorAll(".dt-note")){const h=r.getBoundingClientRect();h.bottom>innerHeight-8&&(r.dataset.flip="1"),h.right>innerWidth-8&&(r.dataset.flipx="1")}Ht(n),Me($n()),et();for(const r of b.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Ve(r);const m=b.querySelector(".dt-note-input");m&&(m.focus(),m.setSelectionRange(m.value.length,m.value.length))},Pa=()=>{let t=!1;const e=[];for(const n of b.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(n.classList.contains("dt-note--orphan"))continue;const s=y.find(i=>i.id===Number(n.dataset.id)),a=s&&_(s);e.push([n,a]),a&&vn(a.el)&&(t=!0)}for(const n of b.querySelectorAll("[data-draft], [data-parked]")){if(n.classList.contains("dt-note--orphan"))continue;const s=n.dataset.parked?H[Number(n.dataset.parked)]:d;e.push([n,s?_(s):null])}for(const[n,s]of e){if(!s){n.style.visibility="hidden";continue}n.style.visibility="",n.style.left=`${s.x}px`,n.style.top=`${s.y}px`,n.matches(".dt-pin[data-id]")&&(s.off?n.dataset.off=s.off:delete n.dataset.off)}if(!zt.length&&(d||$!=null)){const n=$n();n&&vn(n)&&Me(n)}t&&et()},Fa=t=>y.filter(e=>tt(e)===tt(t)).findIndex(e=>e.id===t.id)+1,Ht=t=>{if(!x.hidden&&(x.innerHTML=Eo({bp:t,notes:y,breakpoints:pt,bandOfNote:tt,orphan:e=>!_(e),whoseAgent:dt,statusTools:Vn,showResolved:J,drafts:it.hidden?Un():Re,checks:S?0:je.toCheck().length,marker:_a,find:N,forMe:ja,forAgent:e=>!!V(e)&&B(e)!=="done",unread:An}),yt)){const e=x.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(yt.at,yt.at),yt=null}};let yt=null;const ja=t=>{if(B(t)==="done"||!c.me)return!1;if(t.assignee===c.me.email||B(t)==="claude"||G(t)==="review"&&t.assignee!==c.me.email)return!0;const e=(c.me.name||c.me.email).split(/[\s@]/)[0].toLowerCase();return Bt(t).some(n=>n.text.toLowerCase().includes("@"+e))},_a=t=>{if(B(t)==="done")return'<span class="dt-hist-n"></span>';const n=ke[V(t)??""];if(n)return`<span class="dt-hist-face dt-hist-face--agent" style="--step-c:${n}">${ut(10)}</span>`;const s=Mn(t);return s?`<span class="dt-hist-face" style="--ring:${Ae.find(a=>a[0]===Gt(t))[2]};--hue:${kn(t.by||t.byName||"")}">${s}</span>`:`<span class="dt-hist-n" style="--cat:${le(t.category).color}"></span>`},De=t=>x.toggleAttribute("data-collapsed",t);x.addEventListener("input",t=>{const e=t.target.closest("[data-hist-q]");e&&(N.q=e.value,yt={at:e.selectionStart??e.value.length},Ht(lt()))}),x.addEventListener("click",async t=>{const e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await oe(),setTimeout(()=>delete e.dataset.spin,500);return}if(x.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){De(!1);return}if(t.target.closest("[data-fold]")){De(!x.hasAttribute("data-collapsed"));return}const n=t.target.closest(".dt-hist-bands [data-bp]");if(n){fs(n.dataset.bp);return}const s=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(s){s.dataset.histView?(N.view=s.dataset.histView,q("dt-view",N.view),N.menu=!1):s.dataset.histSort?(N.sort=s.dataset.histSort,q("dt-sort",N.sort),N.menu=!1):s.hasAttribute("data-hist-clear")?(N.q="",yt={at:0}):N.menu=!N.menu,Ht(lt());return}N.menu&&!t.target.closest(".dt-hist-menu")&&(N.menu=!1,Ht(lt()));const a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){const r=a.dataset.draftRm!==void 0,h=Number(r?a.dataset.draftRm:a.dataset.draftGo);it.hidden?r?Jn(h):Fe(h):R(r?{dropDraft:h}:{openDraft:h});return}const i=t.target.closest("[data-unmark]");if(i){t.stopPropagation(),await bt(Number(i.dataset.unmark),!1);return}const o=t.target.closest(".dt-hist-tools [data-act]");if(o){await bt(Number(o.dataset.id),o.dataset.act==="done");return}const l=t.target.closest("[data-rm]");if(l){$=null,await Be(Number(l.dataset.rm));return}if(t.target.closest("[data-review]")){je.start();return}if(t.target.closest("[data-resolved]")){Ke(!J);return}const u=t.target.closest("[data-go]");if(!u)return;const m=Number(u.dataset.go);if(!it.hidden){R({open:m});return}Pe(m)});const Pe=t=>{$=t,j(),f();const e=y.find(s=>s.id===t),n=e&&_(e);n?scrollTo({top:scrollY+n.y-innerHeight/2,behavior:"smooth"}):e&&Q(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||b.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},Fe=t=>{const[e]=H.splice(t,1);if(!e)return;j(),d=e,$=null;const n=_(e);n&&(n.y<0||n.y>innerHeight)&&scrollTo({top:scrollY+n.y-innerHeight/3,behavior:"instant"}),f()},Jn=t=>{H.splice(t,1),f()},je=So({inFrame:S,everything:()=>vt,route:()=>P,settle:bt,keepIn:gn,toast:t=>C(t),open:t=>{if(A||nt(!0),tt(t)!==lt()){fs(tt(t));for(const e of[600,1500])setTimeout(()=>R({open:t.id}),e)}else Pe(t.id)}}),Ka=t=>{x.hidden=!t,jt.setAttribute("aria-pressed",String(t)),q("dt-history",t?"1":"0"),f()},_e=document.querySelector(".dt-resolved-btn"),Ke=t=>{J=t,_e.setAttribute("aria-pressed",String(t)),q("dt-resolved",t?"1":"0"),R({resolved:t}),f(),ne()};_e.addEventListener("click",()=>Ke(!J)),_e.setAttribute("aria-pressed",String(J)),jt.addEventListener("click",()=>{const t=x.hidden===!0;t&&!A&&nt(!0),t&&De(!1),Ka(t)});const et=()=>{we||!A||(we=requestAnimationFrame(()=>{we=0,Pa()}))},Qn=`${$e}, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,Wa=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Qn))return!0;const n=[...t.addedNodes,...t.removedNodes];return n.length>0&&n.every(s=>s instanceof Element&&s.matches(Qn))},Zn=new MutationObserver(t=>{t.every(Wa)||(yn(),et())}),ts=new ResizeObserver(()=>et());let vt=[];const es=t=>{vt=t;const e=()=>({new:0,progress:0,review:0,waiting:0,accepted:0,done:0}),n={};for(const l of t){const u=B(l),m=V(l),r=u==="done"?"done":u==="claude"?"review":m&&Xt[m]||Gt(l),h=n[l.route??""]??={...e(),bands:{}};h[r]++;const g=tt(l);(h.bands[g]??=e())[r]++}const s=["new","progress","review","waiting","accepted","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",accepted:"accepted",done:"resolved"},i=l=>s.map(u=>[u,u==="done"&&!J?0:l[u]]),o=l=>i(l).reduce((u,[,m])=>u+m,0);for(const l of document.querySelectorAll(".dt-pages a")){const u=l.querySelector(".dt-pages-n");if(!u)continue;const m=n[new URL(l.href).pathname.replace(/\/+$/,"")||"/"];for(const g of pt){const w=m?.bands[g.id];for(const[L,z]of i(w??e())){const Y=u.querySelector(`[data-bp="${g.id}"][data-state="${L}"]`);Y.hidden=!z,z&&(Y.querySelector("i").textContent=String(z),Y.title=`${g.label}: ${z} ${a[L]}`)}}const r=m?o(m):0;u.hidden=!r;const h=m?pt.filter(g=>m.bands[g.id]&&o(m.bands[g.id])).map(g=>`${g.label} ${o(m.bands[g.id])}`).join(" \xB7 "):"";u.title=r?`${s.filter(g=>m[g]).map(g=>`${m[g]} ${a[g]}`).join(" \xB7 ")}
73
- ${h}`:""}},Nt=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string").map(e=>({...e,id:Number(e.id),rx:Number(e.rx)||0,ry:Number(e.ry)||0,route:typeof e.route=="string"&&/^\/(?![\/\\])/.test(e.route)?e.route:"/",replies:Array.isArray(e.replies)?e.replies.filter(n=>typeof n?.text=="string"):[],images:Array.isArray(e.images)?e.images.filter(n=>typeof n=="string"):[]})),ne=async()=>{try{es(Nt((await(await ot("comments")).json()).comments)),!x.hidden&&!S&&f()}catch{}},ns=To(S,t=>C(t));let se="",We=!1;const Ct=async()=>{if(!(document.hidden||We)){We=!0;try{const t=await ot(`comments${se?`?since=${se}`:""}`);if(t.status!==200)return;const e=await t.json();se=e.version??"",ns(e);const n=Nt(e.comments);es(n);const s=n.filter(a=>a.route===P);if(JSON.stringify(s)===JSON.stringify(y))return;if(b.contains(document.activeElement)&&document.activeElement.matches("textarea, input")){se="",setTimeout(Ct,5e3);return}y=s,f(),R({reload:!0})}catch{}finally{We=!1}}},$t=async()=>{const t=P;let e=[];try{const s=await(await ot(`comments?route=${encodeURIComponent(t)}`)).json();e=Nt(s.comments),ns(s)}catch{}t===P&&(y=e,f())};let Ue=0;const ss=t=>{Ue||(Ue=requestAnimationFrame(()=>{Ue=0;const e=t.target;if(!A||e.closest(me)){mt.hidden=!0;return}const n=document.elementFromPoint(t.clientX,t.clientY);if(mt.hidden=!1,!n)return;const s=n.getBoundingClientRect();Ws.style.cssText=`left:${s.left}px;top:${s.top}px;width:${s.width}px;height:${s.height}px`,mn.textContent=n.tagName.toLowerCase()+([...n.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...n.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(s.width)}\xD7${Math.round(s.height)}`,mn.style.cssText=`left:${s.left}px;top:${Math.max(2,s.top-20)}px`}))},as=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),T){T=null,f();return}if(d){j(),f();return}if($!==null){$=null,f();return}nt(!1)}},os=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],is=t=>{t.target.closest?.(me)||t.stopPropagation()},rs=t=>{if(t.target.closest(me))return;if(t.preventDefault(),t.stopPropagation(),pe){pe=!1;return}if(!getSelection()?.isCollapsed)return;b.hidden=!0;const n=document.elementFromPoint(t.clientX,t.clientY);if(b.hidden=!1,!n)return;j();const s=n.getBoundingClientRect(),a=n.tagName.toLowerCase(),i=[...n.classList].filter(o=>!/^(astro|svelte|css)-/.test(o)).slice(0,2);d={selector:Vs(n),tag:a,classes:i,nth:Gs({tag:a,classes:i}).indexOf(n),rx:s.width?(t.clientX-s.left)/s.width:.5,ry:s.height?(t.clientY-s.top)/s.height:.5,label:It(n.textContent||"").slice(0,60),ctx:Xs(n),category:nn[0].id},ds.set(d,Xa().then(()=>ze(n))),$=null,mt.hidden=!0,f()},Ua=2200,za=900*1024,ls=8*1024*1024,Ya=3*1024*1024,Va=1200,Ga=1600,ze=async t=>{let e=t instanceof HTMLElement?t:null;for(let a=0;e&&a<4&&e.parentElement&&e.parentElement!==document.body;a++){const i=e.getBoundingClientRect();if(i.width>=360&&i.height>=140)break;e=e.parentElement}const n=e?.getBoundingClientRect();if(!e||!n?.width||!n.height)return null;let s="";for(let a=e;a&&!s;a=a.parentElement){const i=getComputedStyle(a).backgroundColor;i&&i!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(i)&&(s=i)}if(!s){const[a,i,o]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);s=.299*a+.587*i+.114*o>140?"#111":"#fff"}try{const{domToWebp:a}=await import("modern-screenshot"),i=Math.min(1,Va/n.width,Ga/n.height),o=await Promise.race([a(e,{scale:i,quality:.8,timeout:4e3,backgroundColor:s,filter:l=>!(l instanceof Element&&l.closest($e))}),new Promise(l=>setTimeout(()=>l(null),8e3))]);return o&&o.length<ls?o:null}catch{return null}},ds=new WeakMap,Xa=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),C=t=>{const e=document.createElement("div");e.className="dt-toast",e.textContent=t,document.body.append(e),setTimeout(()=>e.remove(),2800)},Ja=t=>new Promise(e=>{const n=new FileReader;n.onload=()=>e(String(n.result)),n.readAsDataURL(t)}),Qa=async t=>{const e=await createImageBitmap(t),n=Math.min(1,Ua/Math.max(e.width,e.height));if(n===1&&t.size<=za)return e.close(),Ja(t);const s=document.createElement("canvas");return s.width=Math.round(e.width*n),s.height=Math.round(e.height*n),s.getContext("2d").drawImage(e,0,0,s.width,s.height),e.close(),s.toDataURL("image/jpeg",.85)},Ye=async(t,e)=>{const n=[];for(const s of t){let a;const i=Object.keys(Rt).find(o=>Rt[o]===s.type||s.name.toLowerCase().endsWith(`.${o}`));if(i){if(s.size>Ya){C(`${s.name} is over 3 MB \u2014 send a link to it instead.`);continue}const o=await new Promise((l,u)=>{const m=new FileReader;m.onload=()=>l(String(m.result).split(",")[1]),m.onerror=u,m.readAsDataURL(s)}).catch(()=>"");o?n.push(`data:${Rt[i]};name=${co(s.name)||"document"};base64,${o}`):C(`${s.name} could not be read.`);continue}try{a=await Qa(s)}catch{C("That image could not be read.");continue}if(a.length>ls){C("Screenshot is too large even after shrinking.");continue}n.push(a)}if(n.length){if(!Number(e?.dataset.id)){d&&((d.images??=[]).push(...n),f());return}F.push(...n),f(),ae(".dt-note-reply-input")}},cs=t=>[...t??[]].filter(e=>e.kind==="file"&&(e.type.startsWith("image/")||Object.values(Rt).includes(e.type))).map(e=>e.getAsFile()).filter(Boolean);b.addEventListener("paste",t=>{const e=cs(t.clipboardData?.items);e.length&&(t.preventDefault(),Ye(e,t.target.closest(".dt-note")))}),b.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),b.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),b.addEventListener("drop",t=>{const e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");const n=cs(t.dataTransfer?.items);n.length&&Ye(n,e)});const ae=t=>{const e=b.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},us=()=>{ae(".dt-note-edit-input"),b.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Ve=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden"},Za=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),to=()=>c.client||Qt()?[]:Hs(),eo=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();const n=Za(t);if(!n)return;const s=n[1].toLowerCase(),a=(c.team??[]).filter(o=>[o.name,o.nickname,o.email].some(l=>l?.toLowerCase().startsWith(s))).slice(0,5),i=to().filter(o=>o.handle.toLowerCase().startsWith(s)||!!s&&"agent".startsWith(s)||!!s&&"claude".startsWith(s)).slice(0,4);!a.length&&!i.length||t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...a.map(o=>`<button type="button" role="option" data-act="mention" data-handle="${p(uo(o))}">${Vt(o.avatar_url,o.name||o.email)}<span class="dt-mention-who"><b>${p(o.name||o.email)}</b>${o.name?`<span>${p(o.email)}</span>`:""}</span></button>`),...i.map(o=>`<button type="button" role="option" data-act="mention" data-handle="${p(o.handle)}">${ia(o.owner)}<span class="dt-mention-who"><b>${p(o.handle)}</b><span>${o.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((o,l)=>o.replace('role="option"',`role="option" aria-selected="${l===0}"`)).join("")}</div>`)},ps=t=>{const e=[...(c.team??[]).flatMap(s=>[s.name,s.nickname,s.email]),...Hs().map(s=>s.handle)].filter(s=>!!s).sort((s,a)=>a.length-s.length).map(s=>p(s).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=p(t);return e.length?n.replace(new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"),s=>`<span class="dt-at">${s}</span>`):n},ms=(t,e)=>{const n=t.selectionStart??t.value.length,s=t.value.slice(0,n).lastIndexOf("@");t.value=`${t.value.slice(0,s)}@${e} ${t.value.slice(n)}`,t.selectionStart=t.selectionEnd=s+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},no=(t,e)=>{if(!t){d&&(d.category=e),f();return}W(n=>n.map(s=>s.id===t?{...s,category:e}:s),()=>D({id:t,category:e}),"Changing the type")};$o(b,p,Tt);const so=(t,e)=>{t?W(n=>n.map(s=>s.id===t?{...s,shared:e||void 0}:s),()=>D({id:t,shared:e}),e?"Sharing with the client":"Keeping it to the team"):d&&(d.shared=e||void 0,rt(),f())};b.addEventListener("change",t=>{const e=t.target.closest(".dt-more-select");if(e){const o=e.value,l=Number(e.dataset.id)||0;e.value="",o==="team"||o==="client"?so(l,o==="client"):o==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?($=null,Be(l)):o==="discard"&&(d=null,f());return}const n=t.target.closest(".dt-cat-select");if(n){no(Number(n.dataset.id)||0,n.value);return}const s=t.target.closest(".dt-status-select");if(s){On(Number(s.dataset.id),s.value);return}const a=t.target.closest(".dt-for-select");if(!a)return;a.parentElement?.style.setProperty("--cat",kt(a.value));const i=Number(a.dataset.id);if(i){const o=a.value||null;W(l=>l.map(u=>u.id===i?{...u,assignee:o??void 0}:u),()=>D({id:i,assignee:o}),"Reassigning");return}d&&(d.assignee=a.value,M.setItem("nm-for",a.value),rt())}),b.addEventListener("input",t=>{const e=t.target.closest(".dt-suggest-input");if(e&&d?.suggest){d.suggest.to=e.value,rt(),Ve(e);return}const n=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");n&&(eo(n),n.classList.contains("dt-note-input")?d&&(d.text=n.value):n.classList.contains("dt-note-edit-input")?T&&(T.text=n.value):O=n.value,rt(),n.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",n.value.trim()!==""),Ve(n))}),b.addEventListener("keydown",t=>{const e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;const n=e.closest(".dt-compose")?.querySelector(".dt-mentions button");if(n&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),ms(e,n.dataset.handle);return}if(n&&t.key==="Escape"){t.stopPropagation(),n.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())}),b.addEventListener("click",async t=>{const e=t.target.closest("button");if(!e)return;const n=e.dataset.act,s=Number(e.dataset.id);if(n==="prio"){const a=e.dataset.v||null;s?W(i=>i.map(o=>o.id===s?{...o,priority:a??void 0}:o),()=>D({id:s,priority:a}),"Setting the priority"):d&&(d.priority=a??void 0,rt(),f());return}if(n==="mention"){const a=e.closest(".dt-compose")?.querySelector("textarea");a&&ms(a,e.dataset.handle);return}if(!n){if($=$===s?null:s,$!=null&&e.dataset.off){const a=y.find(o=>o.id===s);(a&&Q(a))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}j(),f();return}if(n==="speak"){xa(e.closest(".dt-note"),e);return}if(n==="voice-write"){Ha(e);return}if(n==="voice"||n==="voice-seek"){$a(e,n==="voice-seek"?t:null);return}if(n==="attach"){const a=Object.assign(document.createElement("input"),{type:"file",accept:`image/*,.pdf,.doc,.docx,${Object.values(Rt)}`,multiple:!0}),i=e.closest(".dt-note");a.addEventListener("change",()=>{a.files?.length&&Ye([...a.files],i)}),a.click();return}if(n==="unshot"){s?T&&T.drop.push(e.dataset.img):(e.closest("[data-draft]")?d?.images??[]:F).splice(Number(e.dataset.i),1),f(),T&&us();return}if(n==="edit"){const a=y.find(l=>l.id===s),i=e.dataset.at||null,o=i?a?.replies?.find(l=>l.at===i)?.text:a?.text;if(o===void 0)return;T={id:s,at:i,text:o,drop:[]},f(),us();return}if(n==="edit-cancel"){T=null,f();return}if(n==="translate"){Na(s,e.dataset.at);return}if(n==="unsay"){const a=e.dataset.at;if(!confirm("Delete this reply?"))return;await W(i=>i.map(o=>o.id!==s?o:{...o,replies:(o.replies??[]).map(l=>l.at===a?{...l,text:"",deleted:!0}:l)}),()=>D({id:s,unsay:a}),"Deleting the reply");return}if(n==="edit-save"){const a=T;if(!a)return;const i=a.text.trim();if(!i){b.querySelector(".dt-note-edit-input")?.focus();return}T=null;const o=l=>a.drop.includes(l.split("/").pop());await W(l=>l.map(u=>u.id!==a.id?u:{...u,...a.at==null?{text:i}:{replies:(u.replies??[]).map(m=>m.at===a.at?{...m,text:i}:m)},images:(u.images??[]).filter(m=>!o(m))}),()=>D({id:a.id,edit:{at:a.at,text:i},...a.drop.length?{removeImage:a.drop}:{}}).then(l=>(l.ok||(T=a),l),l=>{throw T=a,l}),"Saving the edit");return}if(n==="cancel"){j(),f();return}if(n==="twin"){j(),$=Number(e.dataset.id),f();return}if(n==="discard"){d=null,f();return}if(n==="draft-open"){Fe(Number(e.dataset.i));return}if(n==="close"){$=null,f();return}if(n==="unsuggest"&&d){d.suggest=null,f();return}if(n==="save"){if(!d)return;const a=d.suggest&&d.suggest.to.trim()!==d.suggest.from?{from:d.suggest.from,to:d.suggest.to.trim()}:null,i=b.querySelector(".dt-note-input").value.trim()||(a?"Change the text":"")||(d.images?.some(Ne)?Kn:"");if(!i){b.querySelector(".dt-note-input")?.focus();return}const o=d,l=c.client?null:Ns(i,ft()),u=ds.get(o)??ze(Q(o)),m={...o,route:P,text:i,suggest:a,assignee:c.client?o.assignee||c.lead||void 0:l??(o.assignee||void 0),shared:c.client?!0:o.shared===!0,stage:c.client?"new":l?"approved":o.stage??(I(o.assignee)?"approved":"new"),breakpoint:Te(),browser:Ys(),device:S?gs:"",viewport:{w:innerWidth,h:innerHeight},logs:ho(),host:location.host},r={...o,id:-Date.now(),text:i,route:P,status:"open",note:"",doneBy:null,breakpoint:m.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...a?{suggest:a}:{},by:c.me?.email,byName:c.me?.name};y=[...y,r],d=null,f();const h=await u,g=await ot("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...m,...h?{before:h}:{}})}).catch(()=>null);if(!g?.ok){y=y.filter(L=>L!==r),j(),d=o,f(),C(`Comment was not saved${g?` (${g.status})`:""}.`);return}const w=Nt([await g.json().catch(()=>null)])[0];y=y.map(L=>L===r&&w?w:L),f(),oe();return}if(n==="reply"){const a=b.querySelector(".dt-note-reply-input"),i=a.value.trim()||(F.some(Ne)?Kn:"");if(!i){a.focus();return}const o=F;O="",F=[];const l=y,u=c.client?null:Ns(i,ft()),m=y.find(w=>w.id===s),r=u&&m&&(u!==m.assignee||G(m)!=="approved"||m.status==="done")?{assignee:u,stage:"approved",...m.status==="done"?{status:"open",doneBy:null}:{}}:{};y=y.map(w=>w.id===s?{...w,...r,replies:[...w.replies??[],{author:"you",text:i,at:new Date().toISOString(),by:c.me?.email}]}:w),f();const h=await D({id:s,reply:i,images:o,...r}).catch(()=>null);if(!h?.ok){y=l,O=i,F=o,f(),C(`Reply was not sent${h?` (${h.status})`:""}.`);return}const g=Nt([await h.json().catch(()=>null)])[0];g&&(y=y.map(w=>w.id===g.id?g:w),f()),oe();return}if(n==="hand"){sa(s,e.dataset.v);return}if(n==="sendback"){await bt(s,!1),ae(".dt-note-reply-input");return}if(n==="accept"){On(s,"accepted");return}e.classList.contains("dt-step-act")||($=null),n==="rm"?await Be(s):await bt(s,n==="done")});let gs="";const R=t=>{it.hidden||_t.contentWindow?.postMessage({dt:!0,...t},location.origin)},ao=()=>({notes:A,grid:!Dt.hidden,inspect:X,resolved:J,...hs.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;const e=t.data;if(!S&&t.source===_t.contentWindow){if(e.key){ws(e.key[0],e.key[1])?.run();return}if(e.closeMenus){Lt();return}if(e.drafts){Re=e.drafts,Ht(lt());return}}if(S&&typeof e.openDraft=="number"){Fe(e.openDraft);return}if(S&&typeof e.dropDraft=="number"){Jn(e.dropDraft);return}if(S&&typeof e.device=="string"&&(gs=e.device),S&&e.scrollbar&&document.documentElement.classList.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===_t.contentWindow){R(ao());return}typeof e.notes=="boolean"&&e.notes!==A&&nt(e.notes,!1),typeof e.open=="number"&&Pe(e.open),typeof e.grid=="boolean"&&e.grid===Dt.hidden&&ue(e.grid),typeof e.inspect=="string"&&e.inspect!==X&&Ft(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==J&&Ke(e.resolved),e.reload&&($t(),ne())});const oe=async()=>{await $t(),ne(),R({reload:!0}),S&&parent.postMessage({dt:!0,reload:!0},location.origin)},nt=(t,e=!0)=>{if(A=t,pn.setAttribute("aria-pressed",String(t)),t?!S&&x.hidden&&M.getItem("dt-history")!=="0"&&(x.hidden=!1,jt.setAttribute("aria-pressed","true")):(x.hidden=!0,jt.setAttribute("aria-pressed","false")),q(fn,t?"1":"0"),R({notes:t}),S&&e&&parent.postMessage({dt:!0,notes:t},location.origin),b.hidden=!t||!it.hidden,document.documentElement.classList.toggle("dt-noting",t),t){Ft(""),document.addEventListener("click",rs,!0);for(const n of os)document.addEventListener(n,is,!0);document.addEventListener("keydown",as),document.addEventListener("mousemove",ss),addEventListener("scroll",et,!0),addEventListener("resize",et),yn(),Zn.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),ts.observe(document.body),$t()}else{j(),$=null,document.removeEventListener("click",rs,!0);for(const n of os)document.removeEventListener(n,is,!0);document.removeEventListener("keydown",as),document.removeEventListener("mousemove",ss),mt.hidden=!0,removeEventListener("scroll",et,!0),removeEventListener("resize",et),Zn.disconnect(),ts.disconnect(),b.innerHTML=""}},{pickBp:fs,...hs}=wo({cfg:c,inFrame:S,persist:q,frame:it,frameEl:_t,devicesMenu:ye,bpBtns:he,notesOverlay:b,WIDE:de,bpOf:sn,currentBp:Te,deviceById:Bs,notesOn:()=>A,filter:()=>Ee,filterTo:t=>{Ee=t},dropFrameDrafts:()=>{Re=[]},putAway:()=>{$=null,j()},tellFrame:R,syncBpButtons:bn,render:()=>f(),reread:()=>{A?$t():f()}}),bs="dt-studio",ys=t=>{be.setAttribute("aria-pressed",String(t)),document.documentElement.classList.toggle("dt-no-studio",!t),q(bs,t?"1":"0")};be.addEventListener("click",()=>ys(be.getAttribute("aria-pressed")!=="true")),ys(M.getItem(bs)!=="0"),pn.addEventListener("click",()=>nt(!A));const wt=document.querySelector(".devtools"),qt=document.querySelector(".dt-tab"),vs=t=>{wt.toggleAttribute("data-collapsed",t),qt.toggleAttribute("data-collapsed",t),qt.setAttribute("aria-expanded",String(!t)),qt.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(const e of wt.querySelectorAll(".dt-group"))e.inert=t;t&&Lt(),q("dt-collapsed",t?"1":"0")};qt.addEventListener("click",()=>vs(!wt.hasAttribute("data-collapsed")));const Ge=document.querySelector(".dt-keys"),U=t=>()=>wt.querySelector(t)?.click(),$s=t=>()=>{const e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(n=>n.hasAttribute("aria-current"))+t]?.click()},ie=[{group:"Comments",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:U(".dt-notes-btn")},{group:"Comments",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Comments panel",el:".dt-history-btn",run:U(".dt-history-btn")},{group:"Comments",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:U(".dt-resolved-btn")},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:U(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:U(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:U(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:U(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:U(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:U(".dt-border-btn")},...c.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:U(".dt-studio-btn")}]:[],...he.slice(0,9).map((t,e)=>({group:"Breakpoints",code:`Digit${e+1}`,hint:String(e+1),label:t.dataset.tip??t.title,el:`.dt-bp[data-bp="${t.dataset.bp}"]`,run:()=>t.click()})),{group:"View",code:"KeyD",hint:"D",label:"Devices",run:()=>{ye.open=!ye.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:$s(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:$s(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>qt.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"This list",el:".dt-keys summary",run:()=>{Ge.open=!Ge.open}}].filter(t=>!c.client||t.group!=="Inspect"),ws=(t,e)=>ie.find(n=>n.code===t&&!n.shift==!e),oo=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||!!t.closest('[role="menu"], [role="listbox"], [role="dialog"][aria-modal="true"], [role="combobox"]'));if(c.shortcuts){for(const e of ie){const n=e.el&&wt.querySelector(e.el);n&&(n.dataset.tip=`${n.dataset.tip??e.label} \xB7 ${e.hint}`,n.setAttribute("aria-keyshortcuts",e.hint.startsWith("\u21E7")?`Shift+${e.hint.slice(1)}`:e.hint))}const t=(e,n)=>`<div class="dt-key-row"><span>${p(e)}</span><kbd>${p(n)}</kbd></div>`;if(Ge.querySelector(".dt-keys-menu").innerHTML='<p class="dt-menu-note">One key, no modifier, in any keyboard layout. Not while you type.</p>'+[...new Set(ie.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+ie.filter(n=>n.group===e).map(n=>t(n.label,n.hint)).join("")).join("")+'<p class="dt-devices-group">In a comment</p>'+t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"),document.addEventListener("keydown",e=>{if(e.repeat||e.isComposing||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||oo(e.target))return;const n=ws(e.code,e.shiftKey);n&&(e.preventDefault(),S?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):n.run())}),S){const e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",n=>{n.key==="Escape"&&e()})}}if(!S){vs(M.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>wt.setAttribute("data-ready",""))),hs.restore(),ue(M.getItem(on)==="1");const t=M.getItem(cn);t&&t in ge&&Ft(t),nt(M.getItem(fn)==="1")}const Es=()=>{try{const t=JSON.parse(M.getItem(gt)||"null");H=(t?.parked??[]).filter(e=>Kt(e)),t?.draft&&document.querySelector(t.draft.selector)?(d=t.draft,!A&&!S&&nt(!0)):Kt(t?.draft)&&H.push(t.draft),t?.reply?.text&&(O=t.reply.text,Mt=$=t.reply.for??null),(d||H.length||O)&&f()}catch{M.removeItem(gt)}};Es();const Ss=()=>setTimeout(()=>{const t=ce(location.pathname);t!==P&&(clearTimeout(Wt),Se(),P=t,gt=hn(),d=null,H=[],O="",Mt=null,$=null,T=null,y=[],ln(),Es(),$t())});for(const t of["pushState","replaceState"]){const e=window.history[t];window.history[t]=function(...n){e.apply(this,n),Ss()}}addEventListener("popstate",Ss),A||$t(),ne().then(je.resume),document.addEventListener("visibilitychange",()=>{document.hidden||Ct()}),addEventListener("focus",Ct),addEventListener("notemend:changed",()=>{S||Ct()});let io=0;S||setInterval(()=>{(!go.live||++io%6===0)&&Ct()},2e4),S&&parent.postMessage({dt:!0,hello:!0},location.origin)}export{Do as run};
@@ -1 +0,0 @@
1
- function u(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;const l=HTMLDialogElement.prototype,c=l.showModal;let e=null,o=null;const s=()=>{if(e){o?.disconnect(),o=null;for(const t of n)document.body.append(t);try{e.hidePopover()}catch{}e.remove(),e=null}},r=()=>{s();const t=document.querySelector("dialog:modal");t&&i(t)},i=t=>{s(),e=document.createElement("div"),e.className="dt-host",e.setAttribute("popover","manual"),e.append(...n),t.append(e);try{e.showPopover()}catch{}t.addEventListener("close",r,{once:!0}),o=new MutationObserver(()=>{t.isConnected||r()}),o.observe(document.documentElement,{childList:!0,subtree:!0})};l.showModal=function(){c.call(this),this.isConnected&&i(this)}}export{u as keepAboveModals};
@@ -1 +0,0 @@
1
- import{agentName as d}from"../store/thread.mjs";import{api as p}from"./api";function f(c,r){let a=null,i=null;const e=document.querySelector(".dt-turbo"),u="/notemend:turbo",s=()=>{const n=!!a&&Date.now()-Date.parse(a.at)<18e4,t=n?i?.paused?"paused":"on":"none",o=n?d(a.agent):"",l=t==="none"?`Turbo is off. Run ${u} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:t==="on"?`Turbo on: ${o} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${o} is listening but waits \u2014 click to resume`;e.dataset.state=t,e.dataset.tip=l,e.setAttribute("aria-label",l),e.setAttribute("aria-checked",String(t==="on")),c&&(e.hidden=!0)};return setInterval(s,3e4),e.addEventListener("click",async()=>{const n=e.dataset.state;if(n==="none"){await navigator.clipboard?.writeText(u).catch(()=>{}),r(`Copied ${u} \u2014 paste it in Claude Code`);return}const t=n==="on"?"off":"on";i={paused:t==="off"},s();try{const o=await p("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:t})});if(!o.ok)throw new Error(String(o.status));r(t==="off"?"Turbo paused":"Turbo on")}catch{i={paused:t==="on"},s(),r("Could not switch turbo \u2014 try again")}}),n=>{a=n.listening??null,i=n.turbo??null,s()}}export{f as turbo};
package/src/hosted-app.js DELETED
@@ -1 +0,0 @@
1
- import{host as a}from"./client/api";import{start as l}from"./client/boot";const s=window.__notemendHosted,{project:c,base:m,cabinet:p,bridge:d}=s;let g=0;const r=new Map;function _(t,e){const i=++g,u=typeof e.body=="string"?e.body:void 0;return d.contentWindow.postMessage({type:"notemend:call",id:i,path:t,init:{method:e.method,headers:e.headers,body:u}},p),new Promise(y=>r.set(i,n=>y(new Response(n.status===204?null:n.body,{status:n.status,headers:n.ctype?{"content-type":n.ctype}:{}}))))}addEventListener("message",t=>{const e=t.data;if(!(!d||t.source!==d.contentWindow||t.origin!==p||e?.project!==c)){if(e.type==="notemend:reply"){r.get(e.id)?.(e),r.delete(e.id);return}if(e.type==="notemend:changed"){dispatchEvent(new Event("notemend:changed"));return}e.type==="notemend:live"&&(a.live=!!e.on)}}),Object.assign(a,{base:m,via:s.outer?.via??_,live:s.live}),s.framed||(window.__notemendBar={project:c,via:_});const o=document.createElement("link");o.rel="stylesheet",o.href=`${m}/bar.css?v=${typeof __BAR_CSS_V__=="string"?__BAR_CSS_V__:""}`,o.onload=o.onerror=()=>l(),document.head.append(o);