notemend 0.1.24 → 0.1.26

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,61 +1,61 @@
1
- import"./notemend.css";var Yt={base:"",via:null,signed:{},live:!1,signOut:null};async function At(s,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<6e4&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!Yt.via)return fetch(`/__devbar/${s}`,i);let d=await Yt.via(s,i);if(d.ok&&s.startsWith("comments")&&(i.method??"GET")==="GET"){let m=await d.clone().json().catch(()=>null);m?.signed&&Object.assign(Yt.signed,m.signed)}return d}var Ea=s=>Yt.via?Yt.signed[s]??"":`/__devbar/image?name=${encodeURIComponent(s)}`,On=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),et={getItem:s=>{try{return localStorage.getItem(s)}catch{return null}},setItem:(s,i)=>{try{localStorage.setItem(s,i)}catch{}},removeItem:s=>{try{localStorage.removeItem(s)}catch{}}};async function Ma(){let s=await At("config");if(!s.ok)throw new Error(`config ${s.status}`);let i=await s.json();return i.breakpoints=i.breakpoints.map(d=>({...d,max:d.max??1/0})),i}var ka=["iPhone","Android","Foldable","Tablet","Laptop & display"],rn=[{id:"iphone-se",label:"iPhone SE",group:"iPhone",w:375,h:667,dpr:2,rotates:!0,mobile:!0},{id:"iphone-xr",label:"iPhone XR",group:"iPhone",w:414,h:896,dpr:2,rotates:!0,mobile:!0,insets:{left:0,top:44,right:0,bottom:34},cutout:{shape:"notch",x:92,y:0,width:231,height:33,"upper-radius":6,"lower-radius":25}},{id:"iphone-12-pro",label:"iPhone 12 Pro",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:90,y:0,width:210,height:32,"upper-radius":6,"lower-radius":23}},{id:"iphone-14",label:"iPhone 14",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-plus",label:"iPhone 14 Plus",group:"iPhone",w:428,h:926,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:133,y:0,width:161,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-pro",label:"iPhone 14 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-14-pro-max",label:"iPhone 14 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15",label:"iPhone 15",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-plus",label:"iPhone 15 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro",label:"iPhone 15 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16e",label:"iPhone 16e",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-16",label:"iPhone 16",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-plus",label:"iPhone 16 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro",label:"iPhone 16 Pro",group:"iPhone",w:402,h:874,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:139,y:14,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro-max",label:"iPhone 16 Pro Max",group:"iPhone",w:440,h:956,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:158,y:14,width:125,height:37,"border-radius":19}},{id:"jiophone-2",label:"JioPhone 2",group:"Android",w:240,h:320,dpr:1,rotates:!0,mobile:!0},{id:"pixel-7",label:"Pixel 7",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:52,right:0,bottom:0},cutout:{shape:"circle",x:183,y:0,width:55,height:52,cx:206,cy:26,radius:13}},{id:"pixel-8",label:"Pixel 8",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:182,y:0,width:46,height:50,cx:206,cy:25,radius:14}},{id:"pixel-8-pro",label:"Pixel 8 Pro",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:37,height:50,cx:224,cy:25,radius:14}},{id:"pixel-8a",label:"Pixel 8a",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:46,right:0,bottom:0},cutout:{shape:"circle",x:185,y:0,width:42,height:46,cx:206,cy:26,radius:13}},{id:"pixel-9",label:"Pixel 9",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"pixel-9-pro",label:"Pixel 9 Pro",group:"Android",w:427,h:952,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:68,right:0,bottom:0},cutout:{shape:"circle",x:195,y:0,width:36,height:68,cx:213,cy:34,radius:16}},{id:"pixel-9-pro-xl",label:"Pixel 9 Pro XL",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:66,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:38,height:66,cx:224,cy:33,radius:16}},{id:"pixel-10",label:"Pixel 10",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"samsung-galaxy-s8",label:"Samsung Galaxy S8+",group:"Android",w:360,h:740,dpr:4,rotates:!0,mobile:!0},{id:"samsung-galaxy-a55",label:"Samsung Galaxy A55",group:"Android",w:360,h:800,dpr:2.25,rotates:!0,mobile:!0},{id:"samsung-galaxy-s20-ultra",label:"Samsung Galaxy S20 Ultra",group:"Android",w:412,h:915,dpr:3.5,rotates:!0,mobile:!0},{id:"samsung-galaxy-a51-71",label:"Samsung Galaxy A51/71",group:"Android",w:412,h:914,dpr:2.625,rotates:!0,mobile:!0},{id:"facebook-on-android",label:"Facebook on Android",group:"Android",w:412,h:892,dpr:3.5,rotates:!0,mobile:!0},{id:"moto-g4",label:"Moto G4",group:"Android",w:360,h:640,dpr:3,rotates:!0,mobile:!0},{id:"moto-g-power",label:"Moto G Power",group:"Android",w:412,h:823,dpr:1.75,rotates:!0,mobile:!0},{id:"surface-duo",label:"Surface Duo",group:"Foldable",w:540,h:720,dpr:2.5,rotates:!0,mobile:!0},{id:"pixel-9-pro-fold",label:"Pixel 9 Pro Fold",group:"Foldable",w:412,h:922,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-6",label:"Galaxy Z Fold 6",group:"Foldable",w:412,h:968,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-5",label:"Galaxy Z Fold 5",group:"Foldable",w:344,h:882,dpr:2.625,rotates:!0,mobile:!0},{id:"asus-zenbook-fold",label:"Asus Zenbook Fold",group:"Foldable",w:853,h:1280,dpr:1.5,rotates:!0,mobile:!1},{id:"ipad-mini",label:"iPad Mini",group:"Tablet",w:768,h:1024,dpr:2,rotates:!0,mobile:!0},{id:"ipad-pro-13",label:"iPad Pro 13",group:"Tablet",w:1032,h:1376,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-7",label:"Surface Pro 7",group:"Tablet",w:912,h:1368,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-10",label:"Surface Pro 10",group:"Tablet",w:960,h:1440,dpr:2,rotates:!0,mobile:!0},{id:"galaxy-tab-s4",label:"Galaxy Tab S4",group:"Tablet",w:712,h:1138,dpr:2.25,rotates:!0,mobile:!0},{id:"nest-hub-max",label:"Nest Hub Max",group:"Laptop & display",w:1280,h:800,dpr:2,rotates:!1,mobile:!0},{id:"laptop-with-touch",label:"Laptop with touch",group:"Laptop & display",w:1280,h:950,dpr:1,rotates:!1,mobile:!1},{id:"laptop-with-hidpi-screen",label:"Laptop with HiDPI screen",group:"Laptop & display",w:1440,h:900,dpr:2,rotates:!1,mobile:!1},{id:"laptop-with-mdpi-screen",label:"Laptop with MDPI screen",group:"Laptop & display",w:1280,h:800,dpr:1,rotates:!1,mobile:!1}];var Mr=s=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(s))?.[1]??null;var ln={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},Bs=/^(exe|msi|msp|dmg|pkg|mpkg|app|sh|bash|zsh|command|bat|cmd|com|scr|cpl|ps1|psm1|vbs|vbe|js[e]?|wsf|wsh|hta|jar|apk|ipa|deb|rpm|bin|run|reg|lnk|inf|gadget|appimage)$/i,kr=/^(png|jpe?g|webp|gif|webm)$/i,Lr=[["PDF","#e5484d","pdf"],["DOC","#0d99ff","doc docx rtf odt pages"],["XLS","#30a46c","xls xlsx csv tsv numbers ods"],["PPT","#f76b15","ppt pptx key odp"],["ZIP","#ffb224","zip rar 7z tar gz tgz bz2"],["FIG","#7c6cf2","fig sketch psd ai xd indd eps"],["TXT","#12a594","txt md json html htm css ts tsx jsx xml yml yaml svg log"],["MP3","#d6409f","mp3 wav m4a ogg flac aac"],["MP4","#e93d82","mp4 mov avi mkv m4v"]],La=s=>{let i=String(s??"").split(".").pop().toLowerCase(),d=Lr.find(([,,m])=>m.split(" ").includes(i));return d?{label:d[0],color:d[1]}:{label:"FILE",color:"#717171"}},Ns=s=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(s??"").split("?")[0]),Sr=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((s,i)=>[s,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][i]])),Sa=s=>String(s??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>Sr[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),Ta=s=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(s??""));return i&&!Bs.test(i[1])?i[1].toLowerCase():""},dn=s=>{let i=String(s??"");if(i.startsWith("data:")){let p=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!p)return null;let $=/;ext=([a-z0-9]{1,8})/i.exec(p[2])?.[1]?.toLowerCase()??Object.keys(ln).find(k=>ln[k]===p[1]);return $?`${/;name=([\w-]+)/.exec(p[2])?.[1]||"document"}.${$}`:null}let d=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(d))return null;let m=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(d);return m&&!kr.test(m[2])?`${m[1]||"document"}.${m[2].toLowerCase()}`:null},Be=s=>{let i=[{author:"you",text:s.text,at:s.createdAt,by:s.by,byName:s.byName,images:[]},...s.note?[{author:"claude",text:s.note,at:s.updatedAt,images:[]}]:[],...(s.replies||[]).map(d=>({...d,images:[]}))];for(let d of s.images||[]){if(Mr(d))continue;let m=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(d)?.[1]),p=0;i.forEach(($,k)=>{Date.parse($.at)<=m&&(p=k)}),i[p].images.push(d)}return i.filter(d=>!d.deleted)},Ca=s=>s.nickname||s.name||s.email,Tr=(s,i)=>{let d="@"+i.toLowerCase(),m=-1;for(let p=s.indexOf(d);p!==-1;p=s.indexOf(d,p+1))/[\p{L}\p{N}_.-]/u.test(s[p+d.length]??"")||(m=p);return m};var Cr={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},Ue=s=>Cr[s]||(s?"AI agent":"Claude"),Dn="3.6 3.6 10.8 10.8",qn="M10.116 9H13.883M9.966 9.558L12.222 10.86M9.558 9.966L11.441 13.228M9 10.116V12.72M8.442 9.966L6.559 13.228M8.034 9.558L5.778 10.86M7.884 9H4.118M8.034 8.442L5.778 7.14M8.442 8.034L6.559 4.772M9 7.884V5.28M9.558 8.034L11.441 4.772M9.966 8.442L12.222 7.14",Ps=s=>typeof s=="string"&&s.startsWith("agent:")?s.slice(6):null,$t=s=>s==="claude"||Ps(s)!=null;var Ar=["new","approved","progress","review","waiting","accepted"],Ht=s=>Ar.includes(s?.stage)?s.stage:$t(s?.assignee)?"approved":"new";var Fn=()=>[{assignee:"claude",handle:"Claude",owner:null}],Rs=(s,i=[])=>{let d=String(s||"").toLowerCase(),m=null,p=-1;for(let $ of Fn()){let k=Tr(d,$.handle);k>p&&(p=k,m=$.assignee)}return m};var Hr=2*36e5,Ne=(s,i=Date.now())=>s?.working&&s.status!=="done"&&i-Date.parse(s.working.at)<Hr?s.working:null,Br=s=>/@guest\.notemend\.com$/i.test(String(s||"")),Is=s=>Br(s.by)&&!s.approvedBy,Qt=(s,i=Date.now())=>{if(!s)return null;if(s.status==="done")return s.doneBy==="claude"?"review":$t(s.assignee)?"done":null;if(s.stage==="accepted")return $t(s.assignee)?"done":null;if(Is(s))return"held";if(!$t(s.assignee))return null;let d=Be(s),m=d[d.length-1];return d.length>1&&m.author==="claude"&&!(s.reopenedAt&&Date.parse(s.reopenedAt)>=Date.parse(m.at))?"asks":Ne(s,i)?"working":s.working?"stuck":Ht(s)==="approved"?"queued":null};var Aa=qn.split("M").filter(Boolean).map(s=>{let i=s.match(/[\d.]+/g).map(Number),[d,m]=/H/.test(s)?[i[2],i[1]]:/V/.test(s)?[i[0],i[2]]:[i[2],i[3]];return{d:"M"+s,a:(Math.atan2(d-9,9-m)+2*Math.PI)%(2*Math.PI)}}).sort((s,i)=>s.a-i.a).map(s=>s.d);var Ha=(s,i)=>{if(s.archivedAt)return!0;if(!i||s.status!=="done"||s.doneBy==="claude")return!1;let d=Math.max(Date.parse(s.confirmedAt||s.updatedAt||"")||0,...(s.replies||[]).filter(m=>!m.deleted).map(m=>Date.parse(m.at||"")||0));return!!d&&Date.now()-d>i*864e5};var h=s=>s.replace(/[&<>"]/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[i]),cn=s=>s?new Date(s).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Pe='<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>',Wt='<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>',un='<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>',ye='<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>',Ba='<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>',Na='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',Re='<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>',Xt=s=>`<svg viewBox="${Dn}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude"><path d="${qn}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Os=(s,i)=>`<svg viewBox="${Dn}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude dt-claude--fill">${Aa.map((d,m)=>`<path d="${d}" stroke-width="1.15" stroke-linecap="round"${m<i?"":' class="is-off"'}/>`).join("")}</svg>`,vt=(s,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${s}</svg>`;function Pa(s){let i=location.pathname.replace(/\/$/,"")||"/",d=s.client?' style="display:none"':"",m=s.breakpoints.map(x=>["new","progress","review","waiting","accepted","done"].map(H=>`<b data-bp="${h(x.id)}" data-state="${H}" hidden>${vt(x.icon,11)}<i></i></b>`).join("")).join(""),p=s.groups.map(x=>`<li class="dt-pages-group">${h(x)}</li>`+s.pages.filter(H=>H.group===x).map(H=>`<li><a href="${/^\/(?![\/\\])/.test(H.route)?h(H.route):"#"}"${H.route===i?' aria-current="page"':""}><span class="dt-menu-label">${h(H.label)}</span><em class="dt-pages-n" hidden>${m}</em></a></li>`).join("")).join(""),$=[...new Set(s.devices.map(x=>x.group))].map(x=>`<p class="dt-devices-group">${h(x)}</p>`+s.devices.filter(H=>H.group===x).map(H=>`<button type="button" data-device="${h(H.id)}" aria-pressed="false"${H.note?` title="${h(H.note)}"`:""}><span class="dt-menu-label">${h(H.label)}</span><em>${H.w}&times;${H.h}</em></button>`).join("")).join(""),k=ka.map(x=>`<p class="dt-devices-group">${h(x)}</p>`+rn.filter(H=>H.group===x).map(H=>`<button type="button" data-emu="${h(H.id)}" aria-pressed="false"><span class="dt-menu-label">${h(H.label)}</span><em>${H.w}&times;${H.h}</em></button>`).join("")).join(""),N=s.breakpoints.map(x=>`<button class="dt-icon dt-bp" type="button" data-bp="${h(x.id)}" aria-pressed="false" title="${h(x.label)}">${vt(x.icon,16)}</button>`).join(""),w=Array.from({length:s.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),q="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
1
+ import"./notemend.css";var Yt={base:"",via:null,signed:{},live:!1,signOut:null};async function At(s,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<6e4&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!Yt.via)return fetch(`/__devbar/${s}`,i);let d=await Yt.via(s,i);if(d.ok&&s.startsWith("comments")&&(i.method??"GET")==="GET"){let h=await d.clone().json().catch(()=>null);h?.signed&&Object.assign(Yt.signed,h.signed)}return d}var Ei=s=>Yt.via?Yt.signed[s]??"":`/__devbar/image?name=${encodeURIComponent(s)}`,ys=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),ot={getItem:s=>{try{return localStorage.getItem(s)}catch{return null}},setItem:(s,i)=>{try{localStorage.setItem(s,i)}catch{}},removeItem:s=>{try{localStorage.removeItem(s)}catch{}}};async function Mi(){let s=await At("config");if(!s.ok)throw new Error(`config ${s.status}`);let i=await s.json();return i.breakpoints=i.breakpoints.map(d=>({...d,max:d.max??1/0})),i}var ki=["iPhone","Android","Foldable","Tablet","Laptop & display"],On=[{id:"iphone-se",label:"iPhone SE",group:"iPhone",w:375,h:667,dpr:2,rotates:!0,mobile:!0},{id:"iphone-xr",label:"iPhone XR",group:"iPhone",w:414,h:896,dpr:2,rotates:!0,mobile:!0,insets:{left:0,top:44,right:0,bottom:34},cutout:{shape:"notch",x:92,y:0,width:231,height:33,"upper-radius":6,"lower-radius":25}},{id:"iphone-12-pro",label:"iPhone 12 Pro",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:90,y:0,width:210,height:32,"upper-radius":6,"lower-radius":23}},{id:"iphone-14",label:"iPhone 14",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-plus",label:"iPhone 14 Plus",group:"iPhone",w:428,h:926,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:133,y:0,width:161,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-pro",label:"iPhone 14 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-14-pro-max",label:"iPhone 14 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15",label:"iPhone 15",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-plus",label:"iPhone 15 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro",label:"iPhone 15 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16e",label:"iPhone 16e",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-16",label:"iPhone 16",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-plus",label:"iPhone 16 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro",label:"iPhone 16 Pro",group:"iPhone",w:402,h:874,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:139,y:14,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro-max",label:"iPhone 16 Pro Max",group:"iPhone",w:440,h:956,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:158,y:14,width:125,height:37,"border-radius":19}},{id:"jiophone-2",label:"JioPhone 2",group:"Android",w:240,h:320,dpr:1,rotates:!0,mobile:!0},{id:"pixel-7",label:"Pixel 7",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:52,right:0,bottom:0},cutout:{shape:"circle",x:183,y:0,width:55,height:52,cx:206,cy:26,radius:13}},{id:"pixel-8",label:"Pixel 8",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:182,y:0,width:46,height:50,cx:206,cy:25,radius:14}},{id:"pixel-8-pro",label:"Pixel 8 Pro",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:37,height:50,cx:224,cy:25,radius:14}},{id:"pixel-8a",label:"Pixel 8a",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:46,right:0,bottom:0},cutout:{shape:"circle",x:185,y:0,width:42,height:46,cx:206,cy:26,radius:13}},{id:"pixel-9",label:"Pixel 9",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"pixel-9-pro",label:"Pixel 9 Pro",group:"Android",w:427,h:952,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:68,right:0,bottom:0},cutout:{shape:"circle",x:195,y:0,width:36,height:68,cx:213,cy:34,radius:16}},{id:"pixel-9-pro-xl",label:"Pixel 9 Pro XL",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:66,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:38,height:66,cx:224,cy:33,radius:16}},{id:"pixel-10",label:"Pixel 10",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"samsung-galaxy-s8",label:"Samsung Galaxy S8+",group:"Android",w:360,h:740,dpr:4,rotates:!0,mobile:!0},{id:"samsung-galaxy-a55",label:"Samsung Galaxy A55",group:"Android",w:360,h:800,dpr:2.25,rotates:!0,mobile:!0},{id:"samsung-galaxy-s20-ultra",label:"Samsung Galaxy S20 Ultra",group:"Android",w:412,h:915,dpr:3.5,rotates:!0,mobile:!0},{id:"samsung-galaxy-a51-71",label:"Samsung Galaxy A51/71",group:"Android",w:412,h:914,dpr:2.625,rotates:!0,mobile:!0},{id:"facebook-on-android",label:"Facebook on Android",group:"Android",w:412,h:892,dpr:3.5,rotates:!0,mobile:!0},{id:"moto-g4",label:"Moto G4",group:"Android",w:360,h:640,dpr:3,rotates:!0,mobile:!0},{id:"moto-g-power",label:"Moto G Power",group:"Android",w:412,h:823,dpr:1.75,rotates:!0,mobile:!0},{id:"surface-duo",label:"Surface Duo",group:"Foldable",w:540,h:720,dpr:2.5,rotates:!0,mobile:!0},{id:"pixel-9-pro-fold",label:"Pixel 9 Pro Fold",group:"Foldable",w:412,h:922,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-6",label:"Galaxy Z Fold 6",group:"Foldable",w:412,h:968,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-5",label:"Galaxy Z Fold 5",group:"Foldable",w:344,h:882,dpr:2.625,rotates:!0,mobile:!0},{id:"asus-zenbook-fold",label:"Asus Zenbook Fold",group:"Foldable",w:853,h:1280,dpr:1.5,rotates:!0,mobile:!1},{id:"ipad-mini",label:"iPad Mini",group:"Tablet",w:768,h:1024,dpr:2,rotates:!0,mobile:!0},{id:"ipad-pro-13",label:"iPad Pro 13",group:"Tablet",w:1032,h:1376,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-7",label:"Surface Pro 7",group:"Tablet",w:912,h:1368,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-10",label:"Surface Pro 10",group:"Tablet",w:960,h:1440,dpr:2,rotates:!0,mobile:!0},{id:"galaxy-tab-s4",label:"Galaxy Tab S4",group:"Tablet",w:712,h:1138,dpr:2.25,rotates:!0,mobile:!0},{id:"nest-hub-max",label:"Nest Hub Max",group:"Laptop & display",w:1280,h:800,dpr:2,rotates:!1,mobile:!0},{id:"laptop-with-touch",label:"Laptop with touch",group:"Laptop & display",w:1280,h:950,dpr:1,rotates:!1,mobile:!1},{id:"laptop-with-hidpi-screen",label:"Laptop with HiDPI screen",group:"Laptop & display",w:1440,h:900,dpr:2,rotates:!1,mobile:!1},{id:"laptop-with-mdpi-screen",label:"Laptop with MDPI screen",group:"Laptop & display",w:1280,h:800,dpr:1,rotates:!1,mobile:!1}];var Wl=s=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(s))?.[1]??null;var Dn={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},ko=/^(exe|msi|msp|dmg|pkg|mpkg|app|sh|bash|zsh|command|bat|cmd|com|scr|cpl|ps1|psm1|vbs|vbe|js[e]?|wsf|wsh|hta|jar|apk|ipa|deb|rpm|bin|run|reg|lnk|inf|gadget|appimage)$/i,_l=/^(png|jpe?g|webp|gif|webm)$/i,zl=[["PDF","#e5484d","pdf"],["DOC","#0d99ff","doc docx rtf odt pages"],["XLS","#30a46c","xls xlsx csv tsv numbers ods"],["PPT","#f76b15","ppt pptx key odp"],["ZIP","#ffb224","zip rar 7z tar gz tgz bz2"],["FIG","#7c6cf2","fig sketch psd ai xd indd eps"],["TXT","#12a594","txt md json html htm css ts tsx jsx xml yml yaml svg log"],["MP3","#d6409f","mp3 wav m4a ogg flac aac"],["MP4","#e93d82","mp4 mov avi mkv m4v"]],Si=s=>{let i=String(s??"").split(".").pop().toLowerCase(),d=zl.find(([,,h])=>h.split(" ").includes(i));return d?{label:d[0],color:d[1]}:{label:"FILE",color:"#717171"}},Lo=s=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(s??"").split("?")[0]),Vl=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((s,i)=>[s,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][i]])),Ti=s=>String(s??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>Vl[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),Ai=s=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(s??""));return i&&!ko.test(i[1])?i[1].toLowerCase():""},qn=s=>{let i=String(s??"");if(i.startsWith("data:")){let m=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!m)return null;let v=/;ext=([a-z0-9]{1,8})/i.exec(m[2])?.[1]?.toLowerCase()??Object.keys(Dn).find(S=>Dn[S]===m[1]);return v?`${/;name=([\w-]+)/.exec(m[2])?.[1]||"document"}.${v}`:null}let d=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(d))return null;let h=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(d);return h&&!_l.test(h[2])?`${h[1]||"document"}.${h[2].toLowerCase()}`:null},Oe=s=>{let i=[{author:"you",text:s.text,at:s.createdAt,by:s.by,byName:s.byName,images:[],...s.reactions?{reactions:s.reactions}:{}},...s.note?[{author:"claude",text:s.note,at:s.updatedAt,images:[]}]:[],...(s.replies||[]).map(d=>({...d,images:[]}))];for(let d of s.images||[]){if(Wl(d))continue;let h=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(d)?.[1]),m=0;i.forEach((v,S)=>{Date.parse(v.at)<=h&&(m=S)}),i[m].images.push(d)}return i.filter(d=>!d.deleted)},Ci=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],Hi=["\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u{1F44C}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4AF}","\u{1F680}","\u{1F600}","\u{1F602}","\u{1F60A}","\u{1F60D}","\u{1F914}","\u{1F605}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62E}","\u{1F648}","\u{1F92F}","\u{1F62C}","\u{1F643}","\u{1F440}","\u{1F4A1}","\u{1F4CC}","\u{1F41B}","\u{1F3A8}","\u2615"];var Ul=20,Bi=(s,i,d)=>{let h={...s||{}},m=h[i]||[];if(!m.length&&Object.keys(h).length>=Ul)return null;let v=m.includes(d)?m.filter(S=>S!==d):[...m,d];return v.length?h[i]=v:delete h[i],Object.keys(h).length?h:void 0},Ni=s=>s.nickname||s.name||s.email,Kl=(s,i)=>{let d="@"+i.toLowerCase(),h=-1;for(let m=s.indexOf(d);m!==-1;m=s.indexOf(d,m+1))/[\p{L}\p{N}_.-]/u.test(s[m+d.length]??"")||(h=m);return h};var Gl=/https?:\/\/[^\s<>"']+/g,Li=s=>{let i=s.filter(Boolean).pop();try{return i?decodeURIComponent(i):""}catch{return i}},Yl=s=>{let i;try{i=new URL(s)}catch{return{label:String(s),kind:"link"}}let d=i.hostname.replace(/^www\./,""),h=i.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(d))return{label:h[2]?`Figma \xB7 ${Li([h[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(d==="github.com"&&h.length){let[v,S,H,b]=h;return{label:`GitHub \xB7 ${S??v}${/^(pull|issues)$/.test(H??"")&&b?` #${b}`:""}`,kind:H==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(d))return{label:"Loom",kind:"link"};let m=Li(h);return{label:m?`${d} \xB7 ${m.length>32?m.slice(0,31)+"\u2026":m}`:d,kind:"link"}},So=s=>{let i=String(s??""),d=[],h=0;for(let m of i.matchAll(Gl)){let v=m[0].replace(/[.,;:!?)\]]+$/,"");m.index>h&&d.push(i.slice(h,m.index)),d.push({url:v,...Yl(v)}),h=m.index+v.length}return h<i.length&&d.push(i.slice(h)),d},Ri=s=>So(s).map(i=>typeof i=="string"?i:i.label).join(""),Xl={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},fn=s=>Xl[s]||(s?"AI agent":"Claude"),vs="3.6 3.6 10.8 10.8",ws="M10.116 9H13.883M9.966 9.558L12.222 10.86M9.558 9.966L11.441 13.228M9 10.116V12.72M8.442 9.966L6.559 13.228M8.034 9.558L5.778 10.86M7.884 9H4.118M8.034 8.442L5.778 7.14M8.442 8.034L6.559 4.772M9 7.884V5.28M9.558 8.034L11.441 4.772M9.966 8.442L12.222 7.14",$s=s=>typeof s=="string"&&s.startsWith("agent:")?s.slice(6):null,kt=s=>s==="claude"||$s(s)!=null;var Jl=["new","approved","progress","review","waiting"],Xt=s=>Jl.includes(s?.stage)?s.stage:s?.stage==="accepted"?"review":kt(s?.assignee)?"approved":"new",$t=s=>s?.client===!0||s?.shared===!0;var xs=()=>[{assignee:"claude",handle:"Claude",owner:null}],To=(s,i=[])=>{let d=String(s||"").toLowerCase(),h=null,m=-1;for(let v of xs()){let S=Kl(d,v.handle);S>m&&(m=S,h=v.assignee)}return h};var Zl=2*36e5,De=(s,i=Date.now())=>s?.working&&s.status!=="done"&&i-Date.parse(s.working.at)<Zl?s.working:null,Es=(s,i,d=Date.now())=>{let h=String(s?.by||s?.byName||"").toLowerCase();if(!h||i==="done")return null;let m=i==="claude"||kt(s.assignee),v=Ms(s)?"":m?De(s,d)?.by||s.doneFor||s.handedBy||$s(s.assignee)||h:s.assignee||"";return{writer:h,taker:String(v).toLowerCase(),claude:m}},Ql=s=>/@guest\.notemend\.com$/i.test(String(s||"")),Ms=s=>Ql(s.by)&&!s.approvedBy,ne=(s,i=Date.now())=>{if(!s)return null;if(s.status==="done")return s.doneBy==="claude"?"review":kt(s.assignee)?"done":null;if(Ms(s))return"held";if(!kt(s.assignee))return null;let d=Oe(s),h=d[d.length-1];return d.length>1&&h.author==="claude"&&!(s.reopenedAt&&Date.parse(s.reopenedAt)>=Date.parse(h.at))?"asks":De(s,i)?"working":s.working?"stuck":Xt(s)==="approved"?"queued":null};var Pi=ws.split("M").filter(Boolean).map(s=>{let i=s.match(/[\d.]+/g).map(Number),[d,h]=/H/.test(s)?[i[2],i[1]]:/V/.test(s)?[i[0],i[2]]:[i[2],i[3]];return{d:"M"+s,a:(Math.atan2(d-9,9-h)+2*Math.PI)%(2*Math.PI)}}).sort((s,i)=>s.a-i.a).map(s=>s.d);var Ii=(s,i)=>{if(s.archivedAt)return!0;if(!i||s.status!=="done"||s.doneBy==="claude")return!1;let d=Math.max(Date.parse(s.confirmedAt||s.updatedAt||"")||0,...(s.replies||[]).filter(h=>!h.deleted).map(h=>Date.parse(h.at||"")||0));return!!d&&Date.now()-d>i*864e5};var g=s=>s.replace(/[&<>"]/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[i]),Je=s=>s?new Date(s).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Ze='<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>',qt='<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>',Fn='<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>',qe='<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>',Oi='<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>',Di='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',Ae='<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>',zt=s=>`<svg viewBox="${vs}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude"><path d="${ws}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Ao=(s,i)=>`<svg viewBox="${vs}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude dt-claude--fill">${Pi.map((d,h)=>`<path d="${d}" stroke-width="1.15" stroke-linecap="round"${h<i?"":' class="is-off"'}/>`).join("")}</svg>`,yt=(s,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${s}</svg>`;function qi(s){let i=location.pathname.replace(/\/$/,"")||"/",d=s.client?' style="display:none"':"",h=s.breakpoints.map(y=>["new","progress","review","waiting","done"].map(B=>`<b data-bp="${g(y.id)}" data-state="${B}" hidden>${yt(y.icon,11)}<i></i></b>`).join("")).join(""),m=s.groups.map(y=>`<li class="dt-pages-group">${g(y)}</li>`+s.pages.filter(B=>B.group===y).map(B=>`<li><a href="${/^\/(?![\/\\])/.test(B.route)?g(B.route):"#"}"${B.route===i?' aria-current="page"':""}><span class="dt-menu-label">${g(B.label)}</span><em class="dt-pages-n" hidden>${h}</em></a></li>`).join("")).join(""),v=[...new Set(s.devices.map(y=>y.group))].map(y=>`<p class="dt-devices-group">${g(y)}</p>`+s.devices.filter(B=>B.group===y).map(B=>`<button type="button" data-device="${g(B.id)}" aria-pressed="false"${B.note?` title="${g(B.note)}"`:""}><span class="dt-menu-label">${g(B.label)}</span><em>${B.w}&times;${B.h}</em></button>`).join("")).join(""),S=ki.map(y=>`<p class="dt-devices-group">${g(y)}</p>`+On.filter(B=>B.group===y).map(B=>`<button type="button" data-emu="${g(B.id)}" aria-pressed="false"><span class="dt-menu-label">${g(B.label)}</span><em>${B.w}&times;${B.h}</em></button>`).join("")).join(""),H=s.breakpoints.map(y=>`<button class="dt-icon dt-bp" type="button" data-bp="${g(y.id)}" aria-pressed="false" title="${g(y.label)}">${yt(y.icon,16)}</button>`).join(""),b=Array.from({length:s.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),k="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
2
2
  <!-- One bar, bottom-centre: pages | inspectors | comments | breakpoints \xB7 devices. -->
3
3
  <div class="devtools">
4
- ${s.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(s.brand.logo)?`<img class="dt-brand" src="${h(s.brand.logo)}" alt="" />`:""}
4
+ ${s.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(s.brand.logo)?`<img class="dt-brand" src="${g(s.brand.logo)}" alt="" />`:""}
5
5
  <div class="dt-group dt-group--menus">
6
6
  <details class="dt-pages" name="dt-menu">
7
7
  <summary aria-label="Pages" title="Pages">
8
- ${vt('<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">${h(i)}</span>
8
+ ${yt('<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">${g(i)}</span>
10
10
  </summary>
11
- <ul>${p}</ul>
11
+ <ul>${m}</ul>
12
12
  </details>
13
13
  </div>
14
14
 
15
15
  <div class="dt-group" role="group" aria-label="Inspect"${d}>
16
16
  <button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
17
- ${vt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
17
+ ${yt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
18
18
  </button>
19
19
  <button class="dt-icon dt-pad-btn" type="button" aria-pressed="false" title="Spacing">
20
- ${vt('<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" />')}
20
+ ${yt('<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
21
  </button>
22
22
  <button class="dt-icon dt-size-btn" type="button" aria-pressed="false" title="Size">
23
- ${vt('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
23
+ ${yt('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
24
24
  </button>
25
25
  <button class="dt-icon dt-type-btn" type="button" aria-pressed="false" title="Typography">
26
- ${vt('<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" />')}
26
+ ${yt('<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
27
  </button>
28
28
  <button class="dt-icon dt-color-btn" type="button" aria-pressed="false" title="Color">
29
- ${vt('<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" />')}
29
+ ${yt('<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
30
  </button>
31
31
  <button class="dt-icon dt-border-btn" type="button" aria-pressed="false" title="Border & radius">
32
- ${vt('<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" />')}
32
+ ${yt('<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
33
  </button>
34
34
  <button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${s.sanity?"":" hidden"}>
35
- ${vt('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
35
+ ${yt('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
36
36
  </button>
37
37
  </div>
38
38
 
39
39
  <div class="dt-group" role="group" aria-label="Comments">
40
40
  <button class="dt-icon dt-notes-btn" type="button" aria-pressed="false" title="Comment">
41
- ${vt('<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" />')}
41
+ ${yt('<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
42
  <span class="dt-notes-count" hidden></span>
43
43
  </button>
44
44
  <button class="dt-icon dt-history-btn" type="button" aria-pressed="false" title="Panel">
45
- ${vt('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
45
+ ${yt('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
46
46
  </button>
47
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
48
  <button class="dt-icon dt-resolved-btn" type="button" aria-pressed="true" title="Resolved" hidden style="display:none">
49
- ${vt('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
49
+ ${yt('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
50
50
  </button>
51
51
  </div>
52
52
 
53
- <div class="dt-group dt-bps" role="group" aria-label="Breakpoint">${N}</div>
53
+ <div class="dt-group dt-bps" role="group" aria-label="Screen size">${H}</div>
54
54
 
55
55
  <div class="dt-group dt-group--menus">
56
56
  <details class="dt-devices" name="dt-menu">
57
57
  <summary title="Devices">
58
- ${vt('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
58
+ ${yt('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
59
59
  <span class="dt-devices-name">Device</span>
60
60
  </summary>
61
61
  <div class="dt-devices-menu">
@@ -65,12 +65,12 @@ import"./notemend.css";var Yt={base:"",via:null,signed:{},live:!1,signOut:null};
65
65
  </div>
66
66
  <div class="dt-menu-panel" role="tabpanel" data-panel="preview">
67
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
- ${$}
68
+ ${v}
69
69
  </div>
70
70
  <div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
71
71
  <p class="dt-menu-note">Opens the canvas at the device's size. Comments go to its breakpoint.</p>
72
72
  <input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
73
- ${k}
73
+ ${S}
74
74
  </div>
75
75
  </div>
76
76
  </details>
@@ -78,35 +78,50 @@ import"./notemend.css";var Yt={base:"",via:null,signed:{},live:!1,signOut:null};
78
78
  the table that runs them), hiding the bar, signing out of a hosted bar -->
79
79
  <details class="dt-keys" name="dt-menu">
80
80
  <summary class="dt-icon" title="Settings">
81
- ${vt('<g transform="scale(0.8333)" stroke-width="1.8"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /><circle cx="12" cy="12" r="3" /></g>')}
81
+ ${yt('<g transform="scale(0.8333)" stroke-width="1.8"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /><circle cx="12" cy="12" r="3" /></g>')}
82
82
  </summary>
83
83
  <div class="dt-keys-menu">
84
84
  <div class="dt-set-main">
85
- ${s.me?.email?`<p class="dt-set-who">Signed in as<b>${h(s.me.email)}</b></p><hr>`:""}
86
- <button type="button" data-set="keys"${s.shortcuts?"":" hidden"}>${vt('<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" />',14)}<span>Keyboard shortcuts</span><kbd>?</kbd></button>
87
- <button type="button" data-set="hide">${vt('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${s.shortcuts?"<kbd>\\</kbd>":""}</button>
85
+ ${s.me?.email?`<p class="dt-set-who">Signed in as<b>${g(s.me.email)}</b></p><hr>`:""}
86
+ <button type="button" data-set="keys"${s.shortcuts?"":" hidden"}>${yt('<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" />',14)}<span>Keyboard shortcuts</span><kbd>?</kbd></button>
87
+ <button type="button" data-set="hide">${yt('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${s.shortcuts?"<kbd>\\</kbd>":""}</button>
88
88
  <hr data-set-out hidden>
89
- <button type="button" data-set="out" hidden>${vt('<path d="M8 3.5H5a1.5 1.5 0 0 0-1.5 1.5v10A1.5 1.5 0 0 0 5 16.5h3M12.5 13.5 16 10l-3.5-3.5M16 10H8" />',14)}<span>Sign out</span></button>
89
+ <button type="button" data-set="out" hidden>${yt('<path d="M8 3.5H5a1.5 1.5 0 0 0-1.5 1.5v10A1.5 1.5 0 0 0 5 16.5h3M12.5 13.5 16 10l-3.5-3.5M16 10H8" />',14)}<span>Sign out</span></button>
90
90
  </div>
91
91
  <div class="dt-set-keys" hidden>
92
- <button type="button" class="dt-set-back" data-set="back">${vt('<path d="M12 5l-5 5 5 5" />',13)}<span>Keyboard shortcuts</span></button>
92
+ <button type="button" class="dt-set-back" data-set="back">${yt('<path d="M12 5l-5 5 5 5" />',13)}<span>Keyboard shortcuts</span></button>
93
93
  <hr>
94
94
  <div class="dt-keys-list"></div>
95
95
  </div>
96
96
  </div>
97
97
  </details>
98
98
  </div>
99
+ <!-- the two spaces: the studio's threads and its clients' \u2014 a pill of its own left of the bar
100
+ (Figma: Bar components \u203A Space switch), the card's handoff way: both marks inside, a knob
101
+ sliding under the one in use, each with its open count as a badge (M switches). The studio's only. -->
102
+ <span class="dt-space" role="radiogroup" aria-label="Whose threads" hidden>
103
+ <i class="dt-space-knob" aria-hidden="true"></i>
104
+ <button type="button" class="dt-space-btn" data-space="studio" role="radio" aria-checked="true" data-tip="Studio \xB7 M">${yt('<rect x="3.5" y="4.5" width="13" height="11" rx="2" /><path d="M3.5 8h13" />',15)}<b class="dt-space-n" hidden>0</b></button>
105
+ <button type="button" class="dt-space-btn" data-space="clients" role="radio" aria-checked="false" data-tip="Clients \xB7 M">${yt('<circle cx="9" cy="7" r="3" /><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M14.5 12.5l1.2 1.2 2.3-2.4" />',15)}<b class="dt-space-n" hidden>0</b></button>
106
+ </span>
107
+ <!-- pin filters: a ring after the spaces pill (Figma: Bar components \u203A Pin filter, Pin filter menu) \u2014 its
108
+ rim a chart of whose this page's pins are, the count in the middle; its menu filters them and the
109
+ rest dim (F). The studio's only, as the pill is. -->
110
+ <span class="dt-pinf" hidden>
111
+ <button type="button" class="dt-pinf-btn" aria-haspopup="menu" aria-expanded="false" data-tip="Show pins \xB7 F"><svg viewBox="0 0 40 40" aria-hidden="true"><circle class="dt-pinf-track" cx="20" cy="20" r="11.75"/><g class="dt-pinf-arcs" transform="rotate(-90 20 20)"></g></svg><b class="dt-pinf-n">0</b></button>
112
+ <div class="dt-pinf-menu" role="menu" aria-label="Show pins" hidden></div>
113
+ </span>
99
114
  <!-- push to Claude: one round button \u2014 a press sends what waits for Claude; a right click or a
100
115
  long press picks pages and threads. Beside turbo, the studio's only, shown while there is any. -->
101
116
  <span class="dt-push" hidden${s.client?' style="display:none"':""}>
102
- <button class="dt-push-all" type="button" aria-label="Push to Claude"><svg viewBox="${Dn}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${qn}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
117
+ <button class="dt-push-all" type="button" aria-label="Push to Claude"><svg viewBox="${vs}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${ws}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
103
118
  >
104
119
  <div class="dt-push-menu" hidden role="dialog" aria-label="What goes to Claude"></div>
105
120
  </span>
106
121
  <!-- turbo: its own round button beside the bar, always there for the studio \u2014 lit while
107
122
  an agent session takes comments, grey when none is listening or it is paused here -->
108
123
  <button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${s.client?" hidden":""}>
109
- <span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${vt('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
124
+ <span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${yt('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
110
125
  </button>
111
126
  </div>
112
127
 
@@ -118,14 +133,14 @@ import"./notemend.css";var Yt={base:"",via:null,signed:{},live:!1,signOut:null};
118
133
 
119
134
  <div class="dt-frame" hidden role="region" aria-label="Breakpoint preview">
120
135
  <div class="dt-stage">
121
- <span class="dt-frame-handle" data-edge="l" title="${q}"></span>
136
+ <span class="dt-frame-handle" data-edge="l" title="${k}"></span>
122
137
  <div class="dt-device">
123
138
  <div class="dt-shell"></div>
124
139
  <iframe title="Breakpoint preview"></iframe>
125
140
  <div class="dt-chrome" data-at="top"></div>
126
141
  <div class="dt-chrome" data-at="bottom"></div>
127
142
  </div>
128
- <span class="dt-frame-handle" data-edge="r" title="${q}"></span>
143
+ <span class="dt-frame-handle" data-edge="r" title="${k}"></span>
129
144
  </div>
130
145
  <div class="dt-ruler"></div>
131
146
  <span class="dt-frame-size"></span>
@@ -140,134 +155,135 @@ import"./notemend.css";var Yt={base:"",via:null,signed:{},live:!1,signOut:null};
140
155
  <aside class="dt-history" hidden aria-label="Comment history"></aside>
141
156
  <div class="dt-notes-hi" hidden aria-hidden="true"><span class="dt-hi-box"></span><span class="dt-hi-tag"></span></div>
142
157
  <div class="dt-notes-overlay" hidden role="region" aria-label="Comments on this page"></div>
158
+ <!-- the clients' space: a frame round the page and its name in a notch at the top, with \xD7 back to the studio's -->
159
+ <div class="dt-client-frame" aria-hidden="true"></div>
160
+ <div class="dt-client-tab">${yt('<circle cx="9" cy="7" r="3" /><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M14.5 12.5l1.2 1.2 2.3-2.4" />',13)}<span>Clients space</span><button type="button" class="dt-client-x" aria-label="Back to the studio's space" data-tip="Back to the studio\u2019s space \xB7 M">${yt('<path d="M6 6l8 8M14 6l-8 8" />',10)}</button></div>
143
161
  <div class="dt-grid-overlay" hidden aria-hidden="true">
144
- <div class="${h(s.grid.container)} dt-overlay-container">
145
- <div class="${h(s.grid.grid)} dt-overlay-grid">${w}</div>
162
+ <div class="${g(s.grid.container)} dt-overlay-container">
163
+ <div class="${g(s.grid.grid)} dt-overlay-grid">${b}</div>
146
164
  </div>
147
165
  </div>
148
166
  <div class="dt-pad-overlay" hidden aria-hidden="true"></div>
149
- `)}var Ra=[{id:"general",label:"General",color:"#0d99ff",icon:'<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect x="3" y="14" width="7" height="7" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/>'},{id:"bug",label:"Bug",color:"#e5484d",icon:'<path d="m8 2 1.88 1.88M14.12 3.88 16 2M9 7.13v-1a3 3 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6M12 20v-9M6.53 9C4.6 8.8 3 7.1 3 5M6 13H2M3 21c0-2.1 1.7-3.9 3.8-4M20.97 5c0 2.1-1.6 3.8-3.5 4M22 13h-4M17.2 17c2.1.1 3.8 1.9 3.8 4"/>'},{id:"text",label:"Text",color:"#f5c451",icon:'<path d="M4 7V4h16v3M9 20h6M12 4v16"/>'},{id:"motion",label:"Motion",color:"#a475f9",icon:'<path d="M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2M9.6 4.6A2 2 0 1 1 11 8H2M12.6 19.4A2 2 0 1 0 14 16H2"/>'},{id:"design",label:"Design",color:"#d6409f",icon:'<path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.97 6.01 17.46 2 12 2z"/><circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/>'},{id:"content",label:"Content",color:"#30a46c",icon:'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4M10 9H8M16 13H8M16 17H8"/>'}],Ds=(s,i=14)=>`<svg viewBox="0 0 24 24" width="${i}" height="${i}" fill="none" stroke="${s.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${s.icon}</svg>`,Ie=s=>Ra.find(i=>i.id===s)||Ra[0];var pt=s=>s.status!=="done"?"open":s.doneBy==="claude"?"claude":"done",Ia={open:"Open",done:"Resolved",claude:"Resolved by an agent"};var Bt={ready:Promise.resolve(),toggle:(s,i)=>{Bt.ready.then(()=>document.documentElement.classList.toggle(s,i))},set:(s,i)=>{Bt.ready.then(()=>document.documentElement.style.setProperty(s,i))}};var Nr=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Oa=s=>String(s??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(Nr,"$1\u2022\u2022\u2022").replace(/\b(Bearer|Basic|Token)\s+[\w.~+/=-]+/gi,"$1 \u2022\u2022\u2022").replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/g,"\u2022\u2022\u2022");var jn=[],qs=s=>{if(s instanceof Error)return`${s.name}: ${s.message}`;if(typeof s=="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}},Oe=(s,i)=>{jn.push({at:new Date().toISOString(),kind:s,text:Oa(i.replace(/\s+/g," ").trim()).slice(0,500)}),jn.length>50&&jn.shift()},Da=!1;function qa(s){if(Da||typeof window>"u")return;Da=!0;let i=console.error;console.error=(...p)=>{Oe("console",p.map(qs).join(" ")),i.apply(console,p)},addEventListener("error",p=>{if(p instanceof ErrorEvent)return Oe("error",`${p.message}${p.filename?` (${p.filename}:${p.lineno})`:""}`);let $=p.target,k=$?.src||$?.href;k&&!s(k)&&Oe("network",`${$.tagName?.toLowerCase()} ${k} did not load`)},!0),addEventListener("unhandledrejection",p=>Oe("rejection",qs(p.reason)));let d=window.fetch;window.fetch=async(p,$)=>{let k=typeof p=="string"?p:p instanceof URL?p.href:p.url,N=($?.method||(p instanceof Request?p.method:"GET")).toUpperCase();try{let w=await d.call(window,p,$);return w.status>=400&&!s(k)&&Oe("network",`${N} ${k} \u2192 ${w.status}`),w}catch(w){throw!s(k)&&w?.name!=="AbortError"&&Oe("network",`${N} ${k} \u2192 no answer (${qs(w)})`),w}};let m=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(p,$,...k){return this._nm=`${p.toUpperCase()} ${String($)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(s(String($))||Oe("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),m.call(this,p,$,...k)}}var Fa=(s=Date.now())=>jn.filter(i=>s-Date.parse(i.at)<10*6e4).slice(-20);function ja(s){let i=f=>{let c=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,y=f/c;return Math.round(y*10)%10===0?String(Math.round(y)):y.toFixed(1)},d=(f,c,y,A,B,J="p")=>{if(y<=0||A<=0)return"";let O=B!==""?`<span class="dt-pad-chip dt-pad-chip--${J}" style="left:${f+y/2}px;top:${c+A/2}px">${B}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${J}" style="left:${f}px;top:${c}px;width:${y}px;height:${A}px"></span>${O}`},m=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],p=f=>{let c=f;for(let y=0;c&&y<6;y++,c=c.parentElement){let A=getComputedStyle(c);if(m.some(B=>parseFloat(A[B])>=2))return c}return f},$=(f,c)=>{let y=parseFloat(c.columnGap)||0,A=parseFloat(c.rowGap)||0;if(!(c.display.includes("flex")||c.display.includes("grid"))||!y&&!A)return"";let B=[...f.children].map(O=>O.getBoundingClientRect()).filter(O=>O.width||O.height),J="";for(let O=1;O<B.length;O++){let P=B[O-1],j=B[O];if(y&&j.left>=P.right-1){let V=Math.max(P.top,j.top);J+=d(P.right,V,j.left-P.right,Math.min(P.bottom,j.bottom)-V,i(y),"g")}else if(A&&j.top>=P.bottom-1){let V=Math.min(P.left,j.left);J+=d(V,P.bottom,Math.max(P.right,j.right)-V,j.top-P.bottom,i(A),"g")}}return J},k=f=>`<span class="dt-pad-outline" style="left:${f.left}px;top:${f.top}px;width:${f.width}px;height:${f.height}px"></span>`,N=(f,c,y="")=>`<span class="dt-pad-tag" style="left:${c.left}px;top:${Math.max(2,c.top-22)}px">${f.tagName.toLowerCase()+(f.classList[0]?"."+f.classList[0]:"")}${y}</span>`,w=f=>{let c=f.getBoundingClientRect(),y=getComputedStyle(f),A=parseFloat(y.paddingTop),B=parseFloat(y.paddingRight),J=parseFloat(y.paddingBottom),O=parseFloat(y.paddingLeft),P=k(c);P+=d(c.left,c.top,c.width,A,A>=2?i(A):""),P+=d(c.left,c.bottom-J,c.width,J,J>=2?i(J):""),P+=d(c.left,c.top+A,O,c.height-A-J,O>=2?i(O):""),P+=d(c.right-B,c.top+A,B,c.height-A-J,B>=2?i(B):"");let j=parseFloat(y.marginTop),V=parseFloat(y.marginRight),bt=parseFloat(y.marginBottom),ft=parseFloat(y.marginLeft);P+=d(c.left,c.top-j,c.width,j,j>=2?i(j):"","m"),P+=d(c.left,c.bottom,c.width,bt,bt>=2?i(bt):"","m"),P+=d(c.left-ft,c.top,ft,c.height,ft>=2?i(ft):"","m"),P+=d(c.right,c.top,V,c.height,V>=2?i(V):"","m"),P+=$(f,y);let Ot=parseFloat(y.columnGap)||0,Pt=parseFloat(y.rowGap)||0,Dt=(y.display.includes("flex")||y.display.includes("grid"))&&(Ot||Pt)?` \xB7 gap ${i(Ot)}${Pt&&Pt!==Ot?"/"+i(Pt):""}`:"";s.innerHTML=P+N(f,c,Dt)},q=f=>{let c=f.getBoundingClientRect();s.innerHTML=k(c)+`<span class="dt-pad-chip" style="left:${c.left+c.width/2}px;top:${c.top+c.height/2}px">${i(c.width)} \xD7 ${i(c.height)}</span>`+N(f,c)},x=f=>{let c=(f.match(/[\d.]+/g)||[]).map(Number);if(c.length<3)return f;let y="#"+c.slice(0,3).map(A=>Math.round(A).toString(16).padStart(2,"0")).join("");return c[3]!==void 0&&c[3]<1?`${y} \xB7 ${Math.round(c[3]*100)}%`:y},H=null,L=()=>{if(H)return H;let f=getComputedStyle(document.documentElement),c=document.createElement("span");c.style.display="none",document.body.append(c);let y=[];for(let A of Array.from(f)){if(!A.startsWith("--"))continue;let B=f.getPropertyValue(A).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(B))continue;c.style.color="rgb(1, 2, 3)",c.style.color=B;let J=getComputedStyle(c).color;J&&J!=="rgb(1, 2, 3)"&&y.push([J,A])}return c.remove(),y.sort((A,B)=>A[1].length-B[1].length),H=y,y},b=f=>L().find(([c])=>c===f)?.[1]??"",T=null,_=()=>{if(T)return T;let f=[],c=y=>{for(let A of Array.from(y))A instanceof CSSStyleRule?A.style.cssText.includes("var(--")&&f.push({sel:A.selectorText,style:A.style}):A instanceof CSSMediaRule?matchMedia(A.conditionText).matches&&c(A.cssRules):"cssRules"in A&&c(A.cssRules)};for(let y of Array.from(document.styleSheets))try{c(y.cssRules)}catch{}return T=f},X={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(f=>[`border-${f}-color`,[`border-${f}-color`,"border-color",`border-${f}`,"border"]]))},W=(f,c)=>{let y=X[c]??[c],A=c==="color";for(let B=f;B;B=A?B.parentElement:null){let J=j=>y.map(V=>/var\(\s*(--[\w-]+)/.exec(j.getPropertyValue(V))?.[1]).find(Boolean),O=B instanceof HTMLElement?J(B.style):void 0;if(O)return O;let P="";for(let j of _()){let V=!1;try{V=B.matches(j.sel)}catch{}V&&(P=J(j.style)||P)}if(P)return P;if(A&&B.parentElement&&getComputedStyle(B).color!==getComputedStyle(B.parentElement).color)break}return""},ct=(f,c,y)=>{let A=W(f,c);if(A)return`<b class="dt-var">${A}</b> <em>${x(y)}</em>`;let B=b(y);return B?`<span title="Same value as ${B}; not written with it">\u2248 ${B}</span> <em>${x(y)}</em>`:x(y)},F=f=>`<i class="dt-type-sw" style="background:${f}"></i>`,Q={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},it=f=>(f.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),ht=(f,c)=>f.slice(0,3).map((y,A)=>y*f[3]+c[A]*(1-f[3])).concat([1]),nt=f=>{let c=[];for(let y=f;y;y=y.parentElement){let A=getComputedStyle(y);if(A.backgroundImage!=="none")return null;let B=it(A.backgroundColor);if(B[3]>0&&(c.push(B),B[3]>=1))break}return c.reduceRight((y,A)=>ht(A,y),[255,255,255,1])},Jt=f=>{let[c,y,A]=f.slice(0,3).map(B=>(B/=255,B<=.03928?B/12.92:((B+.055)/1.055)**2.4));return .2126*c+.7152*y+.0722*A},yt=(f,c,y)=>{let A=nt(f);if(!A)return["Contrast","<em>on an image</em>"];let B=ht(it(c.color),A),[J,O]=[Jt(B),Jt(A)].sort((bt,ft)=>ft-bt),P=(J+.05)/(O+.05),j=y>=24||y>=18.66&&Number(c.fontWeight)>=700,V=P>=(j?4.5:7)?"AAA":P>=(j?3:4.5)?"AA":"fails AA";return["Contrast",`${P.toFixed(2)}:1 <em class="${V==="fails AA"?"dt-type-bad":""}">${V}${j?" \xB7 large":""}</em>`]},Mt=f=>{let c=f.getBoundingClientRect(),y=getComputedStyle(f),A=parseFloat(y.fontSize),B=y.lineHeight==="normal"?0:parseFloat(y.lineHeight),J=parseFloat(y.letterSpacing)||0,O=ft=>`${(ft*100).toFixed(1).replace(/\.0$/,"")}%`,P=[["Font",y.fontFamily.split(",")[0].replace(/["']/g,"")+(y.fontStyle!=="normal"?` ${y.fontStyle}`:"")],["Weight",`${Q[y.fontWeight]??""} <em>${y.fontWeight}</em>`],["Size",`${i(A)}px`],["Line",B?`${O(B/A)} <em>${i(B)}px</em>`:"normal"],["Letter",J?`${O(J/A)} <em>${J.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",F(y.color)+ct(f,"color",y.color)],yt(f,y,A)],V=c.bottom+150<innerHeight?c.bottom+8:Math.max(8,c.top-158),bt=Math.min(Math.max(8,c.left),innerWidth-210);s.innerHTML=k(c)+N(f,c)+`<div class="dt-type-card" style="left:${bt}px;top:${V}px">${P.map(([ft,Ot])=>`<span class="dt-type-row"><b>${ft}</b><span>${Ot}</span></span>`).join("")}</div>`},mt=f=>f.every(c=>c===f[0])?f[0]:f[1]===f[3]&&f[0]===f[2]?`${f[0]} ${f[1]}`:f.join(" "),E=f=>/^rgba\(.*,\s*0\)$|^transparent$/.test(f),at=(f,c,y,A="")=>{let B=16+y.length*18,O=c.bottom+B+12<innerHeight?c.bottom+8:Math.max(8,c.top-B-8),P=Math.min(Math.max(8,c.left),innerWidth-230);s.innerHTML=`<span class="dt-pad-outline" style="left:${c.left}px;top:${c.top}px;width:${c.width}px;height:${c.height}px${A?`;border-radius:${A}`:""}"></span>`+N(f,c)+`<div class="dt-type-card dt-style-card" style="left:${P}px;top:${O}px">${y.map(([j,V])=>`<span class="dt-type-row"><b>${j}</b><span>${V}</span></span>`).join("")}</div>`};return{spacer:p,drawPads:w,drawSize:q,drawType:Mt,drawColor:f=>{let c=getComputedStyle(f),y=[];c.backgroundImage!=="none"&&y.push(["Fill",`<em>${/gradient/.test(c.backgroundImage)?"gradient":"image"}</em>`]),E(c.backgroundColor)||y.push(["Fill",F(c.backgroundColor)+ct(f,"background-color",c.backgroundColor)]),f.textContent?.trim()&&y.push(["Text",F(c.color)+ct(f,"color",c.color)]),Number(c.opacity)<1&&y.push(["Opacity",`${Math.round(Number(c.opacity)*100)}%`]),y.length||y.push(["Color","<em>no fill or text</em>"]),at(f,f.getBoundingClientRect(),y)},drawBorder:f=>{let c=getComputedStyle(f),y=[],A=["top","right","bottom","left"],B=A.map(O=>parseFloat(c.getPropertyValue(`border-${O}-width`))||0);if(B.some(O=>O>0)){let O=A.filter((j,V)=>B[V]>0);y.push(["Width",`${mt(B.map(i))} <em>${c.getPropertyValue(`border-${O[0]}-style`)}</em>`]);let P=O.map(j=>c.getPropertyValue(`border-${j}-color`));O.forEach((j,V)=>{V&&P[V]===P[0]||y.push([V?`\u21B3 ${j}`:"Color",F(P[V])+ct(f,`border-${j}-color`,P[V])])})}else y.push(["Width","<em>none</em>"]);let J=["top-left","top-right","bottom-right","bottom-left"].map(O=>{let[P,j=P]=c.getPropertyValue(`border-${O}-radius`).split(" "),V=bt=>bt.endsWith("%")?bt:i(parseFloat(bt)||0);return P===j?V(P):`${V(P)}/${V(j)}`});y.push(["Radius",mt(J)]),at(f,f.getBoundingClientRect(),y,c.borderRadius)}}}var Nt=s=>(s??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim();function _a(){let s=L=>{let b=[],T=L;for(;T&&T.tagName!=="HTML"&&b.length<8;){if(T.id){b.unshift("#"+CSS.escape(T.id));break}let _=T.parentElement,X=T.tagName.toLowerCase(),W=_?[..._.children].filter(ct=>ct.tagName===T.tagName):[];b.unshift(W.length>1?`${X}:nth-of-type(${W.indexOf(T)+1})`:X),T=_}return b.join(">")},i=(L,b)=>!b||Nt(L.textContent||"").slice(0,60)===b,d=(L,b)=>[L||"*",...(b||[]).map(T=>"."+CSS.escape(T))].join(""),m=L=>{try{return[...document.querySelectorAll(d(L.tag,L.classes))]}catch{return[]}},p=L=>{let b=Nt(L.textContent||"").replace(/\s+/g," ");for(let T=L.parentElement,_=0;T&&T!==document.body&&_<4;T=T.parentElement,_++){let X=Nt(T.textContent||"").replace(/\s+/g," ");if(X&&X!==b)return X}return""},$=L=>p(L).slice(0,80),k=(L,b)=>!b||p(L).startsWith(b),N=L=>{let b=null;try{b=document.querySelector(L.selector)}catch{b=null}if(b&&i(b,L.label)&&k(b,L.ctx))return b;let T=m(L),_=Nt(L.label)?T.filter(W=>i(W,L.label)):[];return(_.find(W=>k(W,L.ctx))??T.find(W=>L.ctx&&k(W,L.ctx)&&!Nt(L.label)))||_[0]||(b&&i(b,L.label)?b:null)||(L.nth!=null?T[L.nth]:null)||T[0]||b},w=L=>{let b=null;for(let T=L,_=L.parentElement;_&&_!==document.body&&getComputedStyle(T).position!=="fixed";T=_,_=_.parentElement){let X=getComputedStyle(_);if(X.overflowX==="visible"&&X.overflowY==="visible")continue;let W=_.getBoundingClientRect();b=b?{l:Math.max(b.l,W.left),t:Math.max(b.t,W.top),r:Math.min(b.r,W.right),b:Math.min(b.b,W.bottom)}:{l:W.left,t:W.top,r:W.right,b:W.bottom}}return b},q=L=>{let b=L.getBoundingClientRect();return(b.width>0||b.height>0)&&(!L.checkVisibility||L.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},x=(L,b)=>{for(let T=b.parentElement;T&&T!==document.body;T=T.parentElement){if(!q(T))continue;let _=b.getBoundingClientRect();if(_.width||_.height)return{x:_.left+_.width*L.rx,y:_.top+_.height*L.ry,off:"",el:b,hidden:T};let X=T.getBoundingClientRect();return{x:X.left,y:X.top,off:"",el:b,hidden:T}}return null};return{cssPath:s,poolOf:m,contextOf:$,resolveEl:N,anchorOf:(L,b=N(L))=>{if(!b)return null;if(!q(b))return x(L,b);let T=b.getBoundingClientRect(),_=T.left+T.width*L.rx,X=T.top+T.height*L.ry,W=w(b);if(!W)return{x:_,y:X,off:"",el:b};if(W.r-W.l<18||W.b-W.t<18)return null;let ct=Math.min(Math.max(_,W.l),W.r-18),F=Math.min(Math.max(X,W.t+18),W.b),Q=_<W.l?"l":_>W.r-18?"r":X<W.t+18?"t":X>W.b?"b":"";return{x:ct,y:F,off:Q,el:b}}}}var Wa=(s,i)=>`<svg class="dt-bars" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${[0,1,2,3].map(d=>`<rect x="${.5+d*3}" y="${8.5-d*2.5}" width="2" height="${3+d*2.5}" rx="0.6" fill="${i}" stroke="none" opacity="${d<s?1:.28}"/>`).join("")}</svg>`;function za(s,i,d){let m=document.createElement("div");m.className="dt-field-menu",m.setAttribute("role","listbox"),m.hidden=!0,document.body.append(m);for(let k of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])m.addEventListener(k,N=>N.stopPropagation());let p=null,$=()=>{m.hidden=!0,p=null};for(let k of s)k.addEventListener("mousedown",N=>{let w=N.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!w){m.contains(N.target)||$();return}if(N.preventDefault(),p===w){$();return}p=w;let q=w.classList.contains("dt-more-select"),x=b=>q?b.dataset.on!=null:b.selected;m.innerHTML=[...w.options].map((b,T)=>b.hidden?"":`${b.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${T}" aria-selected="${x(b)}"${b.dataset.danger!=null?' class="is-danger"':""}>${b.dataset.icon?b.dataset.icon:b.dataset.initial!=null?b.dataset.face?`<img class="dt-face" src="${i(b.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${i(b.dataset.initial)}</b>`:`<i style="background:${i(b.dataset.c||"#717171")}"></i>`}<span>${i(b.text)}</span>${b.dataset.hint?`<small>${i(b.dataset.hint)}</small>`:""}${x(b)?d:""}</button>`).join("");let H=w.parentElement.getBoundingClientRect();m.style.left=`${H.left}px`,m.style.top=`${H.bottom+4}px`,m.style.minWidth=`${H.width}px`,m.hidden=!1;let L=m.getBoundingClientRect();L.bottom>innerHeight-8&&(m.style.top=`${H.top-4-L.height}px`),L.right>innerWidth-8&&(m.style.left=`${Math.max(8,H.right-L.width)}px`)});m.addEventListener("click",k=>{let N=k.target.closest("[data-i]");if(!N||!p)return;let w=p;$(),!(w.selectedIndex===Number(N.dataset.i)&&!w.classList.contains("dt-more-select"))&&(w.selectedIndex=Number(N.dataset.i),w.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",k=>{k.key==="Escape"&&!m.hidden&&(k.stopPropagation(),$())},!0),document.addEventListener("pointerdown",k=>{!m.hidden&&!m.contains(k.target)&&!k.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&$()},!0),addEventListener("scroll",k=>{m.contains(k.target)||$()},!0)}var qe=s=>s.replace(/[&<>"]/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[i]),z={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>'},Fs=(s,i)=>s.toLocaleTimeString("en-US",i),_n=s=>Fs(s,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),Pr={island:s=>({side:12,top:12,bottom:12,r:s.w>=430?62:55,body:s.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:s=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((s.w+32)*.12),extraH:18}),laptop:s=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((s.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function Rr(s,i,d,m,p){let $=s.w+2*i.side,k=s.h+i.top+i.bottom,N=(d-$)/2,w=`<rect class="dt-shell-screen" x="${p}" y="${i.top}" width="${s.w}" height="${s.h}" rx="${i.r}"/>`,q="";if(s.shell==="island"||s.shell==="home"||s.shell==="punch"){let x=(H,L,b)=>`<rect class="dt-shell-btn" x="${H}" y="${L}" width="4" height="${b}" rx="2"/>`;q+=s.shell==="punch"?x(N+$-1,150,70)+x(N+$-1,240,44):x(N-3,120,28)+x(N-3,170,56)+x(N-3,236,56)+x(N+$-1,190,90),q+=`<rect class="dt-shell-body" x="${N}" y="0" width="${$}" height="${k}" rx="${i.body}"/>`,q+=`<rect class="dt-shell-bezel" x="${N+3}" y="3" width="${$-6}" height="${k-6}" rx="${i.body-3}"/>`,s.shell==="home"&&(q+=`<rect class="dt-shell-slot" x="${d/2-26}" y="44" width="52" height="6" rx="3"/>`,q+=`<circle class="dt-shell-slot" cx="${d/2-48}" cy="47" r="5"/>`,q+=`<circle class="dt-shell-homebtn" cx="${d/2}" cy="${k-46}" r="28"/>`)}else if(s.shell==="tablet")q+=`<rect class="dt-shell-body dt-shell-body--light" x="${N}" y="0" width="${$}" height="${k}" rx="${i.body}"/>`,q+=`<rect class="dt-shell-bezel" x="${N+4}" y="4" width="${$-8}" height="${k-8}" rx="${i.body-4}"/>`;else if(s.shell==="monitor"){let x=Math.round($*.1);q+=`<path class="dt-shell-stand" d="M${d/2-x/2} ${k-2}h${x}l${x*.2} 84h${-x*1.4}z"/>`,q+=`<rect class="dt-shell-stand" x="${d/2-$*.15}" y="${k+80}" width="${$*.3}" height="14" rx="7"/>`,q+=`<rect class="dt-shell-body" x="${N}" y="0" width="${$}" height="${k}" rx="${i.body}"/>`}else{let x=$+(i.extraW??0),H=(d-x)/2,L=i.extraH??16;q+=`<path class="dt-shell-body" d="M${N} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${$-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${k}H${N}z"/>`,q+=`<path class="dt-shell-base${s.shell==="macbook"?" dt-shell-base--silver":""}" d="M${H} ${k}h${x}v${L-8}a8 8 0 0 1-8 8H${H+8}a8 8 0 0 1-8-8z"/>`,q+=`<rect class="dt-shell-lip" x="${d/2-$*.07}" y="${k}" width="${$*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${d} ${m}" width="${d}" height="${m}" aria-hidden="true">${q}${w}</svg>`}var Ir={"safari-ios":s=>{let i=s.shell==="home"?20:s.w>=400?62:59;return{top:i,bottom:98,topMin:i,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})},Or=({d:s,now:i,cutout:d},m)=>{if(s.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${m}px"><span class="dt-sb-l">${z.signal}${z.wifi}</span><b>${_n(i)}</b><span class="dt-sb-r">${z.battery}</span></div>`;let p=d??{x:(s.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${m}px"><span class="dt-island" style="left:${p.x}px;top:${p.y}px;width:${p.width}px;height:${p.height}px"></span><b class="dt-sb-time" style="top:${p.y}px;height:${p.height}px">${_n(i)}</b><span class="dt-sb-icons" style="top:${p.y}px;height:${p.height}px">${z.signal}${z.wifi}${z.battery}</span></div>`},Dr=({d:s,host:i,min:d},m)=>{let p=s.shell==="home"?"":'<i class="dt-home-ind"></i>';return d?`<div class="dt-ios-bar is-min" style="height:${m}px"><span class="dt-ios-mini">${qe(i)}</span>${p}</div>`:`<div class="dt-ios-bar" style="height:${m}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back">${z.back}</button><span class="dt-glass dt-ios-url"><span>${qe(i)}</span><button data-nav="reload">${z.reload}</button></span><span class="dt-glass dt-glass--round">${z.dots}</span></div>${p}</div>`},qr=({now:s,min:i},d)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Fs(s,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${z.wifi}${z.signal}${z.battery}</span></div>`+(i?"":`<div class="dt-and-bar"><span class="dt-and-url">${z.tune}<span>${qe(d)}</span></span><span class="dt-and-tabs">1</span>${z.dotsV}</div>`),Fr=()=>`<div class="dt-and-nav">${z.recent}${z.home}${z.navBack}</div>`,jr=({now:s,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${_n(s)} ${s.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${z.wifi}${z.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${z.sidebar}<button data-nav="back">${z.back}</button><button data-nav="fwd">${z.fwd}</button></span><span class="dt-ipad-url">${z.lock}<span>${qe(i)}</span><button data-nav="reload">${z.reload}</button></span><span class="dt-bar-group">${z.share}${z.plus}${z.tabs}</span></div>`,_r=({now:s,host:i},d)=>'<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>'+(d?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${z.wifi}${z.battery}<span>${s.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})}&nbsp; ${_n(s)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${z.sidebar}<button data-nav="back">${z.back}</button><button data-nav="fwd">${z.fwd}</button></span><span class="dt-mac-url">${z.lock}<span>${qe(i)}</span><button data-nav="reload">${z.reload}</button></span><span class="dt-bar-group">${z.share}${z.plus}${z.tabs}</span></div>`,Wr=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(s,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,zr=({host:s,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${qe(i||s)}</span>${z.close}</span><span class="dt-win-new">${z.plus}</span><span class="dt-win-ctrl">${z.winMin}${z.winMax}${z.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back">${z.back}</button><button data-nav="fwd">${z.fwd}</button><button data-nav="reload">${z.reload}</button></span><span class="dt-win-url">${z.tune}<span>${qe(s)}</span>${z.star}</span><span class="dt-bar-group">${z.user}${z.dotsV}</span></div>`,Vr=({now:s})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,d)=>`<i style="--hue:${200+d*30}"></i>`).join("")}</span><span class="dt-win-tray">${z.chevUp}${z.wifi}${z.volume}${z.battery}<span class="dt-win-clock">${Fs(s,{hour:"numeric",minute:"2-digit"})}<br>${s.toLocaleDateString("en-US")}</span></span></div>`;function Va(s,i){let d=Pr[s.shell](s),m=s.w+2*d.side,p=s.h+d.top+d.bottom,$=m+(d.extraW??0),k=p+(s.shell==="monitor"||s.shell==="macbook"||s.shell==="laptop"?d.extraH??0:0),N=($-m)/2+d.side,w=Ir[s.browser](s),q=i.min?w.topMin??w.top:w.top,x=i.min?w.bottomMin??w.bottom:w.bottom,H={...i,d:s},L="",b="";switch(s.browser){case"safari-ios":L=Or(H,q),b=Dr(H,x);break;case"chrome-android":L=qr(H,i.host),b=Fr();break;case"safari-ipad":L=jr(H),b='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":L=_r(H,s.shell==="macbook"),b=Wr();break;case"chrome-windows":L=zr(H),b=Vr(H);break}return{footprint:{w:$,h:k},screen:{x:N,y:d.top,w:s.w,h:s.h,r:d.r,rb:d.rb??d.r},topH:q,bottomH:x,shell:Rr(s,d,$,k,N),top:L,bottom:b,canMinimize:w.topMin!==void 0&&(w.topMin!==w.top||w.bottomMin!==w.bottom),scrollbar:s.browser==="chrome-windows"?"classic":"overlay"}}var De=null;function hn(s){if(De??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!De||!s)return[0,0,0,0];De.clearRect(0,0,1,1),De.fillStyle="rgba(0, 0, 0, 0)",De.fillStyle=s,De.fillRect(0,0,1,1);let[i,d,m,p]=De.getImageData(0,0,1,1).data;return[i,d,m,p/255]}var pn=([s,i,d])=>`rgb(${s}, ${i}, ${d})`;function Ka(s){let i=s.defaultView,d=b=>!b||hn(b)[3]===0,m=[s.body,s.documentElement].map(b=>b&&i.getComputedStyle(b).backgroundColor).find(b=>b&&!d(b)),[p,$,k,N]=m?hn(m):[255,255,255,1],w=[p,$,k].map(b=>Math.round(b*N+255*(1-N))),q=b=>{let[T,_,X,W]=hn(b);if(W>=.75)return pn([T,_,X]);let ct=(F,Q)=>Math.round(F*W+Q*(1-W));return pn([ct(T,w[0]),ct(_,w[1]),ct(X,w[2])])},x=b=>{let T=s.elementFromPoint(i.innerWidth/2,b);for(;T&&T!==s.documentElement;T=T.parentElement){let _=i.getComputedStyle(T);if(_.position!=="fixed"&&_.position!=="sticky")continue;let X=T.getBoundingClientRect().width>=i.innerWidth*.9,W=_.backdropFilter&&_.backdropFilter!=="none";return X&&!W&&!d(_.backgroundColor)?q(_.backgroundColor):null}return null},H=s.querySelector('meta[name="theme-color"]')?.content||"",L=H&&!d(H)?pn(hn(H)):"";return{top:x(4)??pn(w),bottom:x(i.innerHeight-4)??pn(w),theme:L}}function js(s){let[i,d,m]=hn(s).map(p=>p/255).map(p=>p<=.04045?p/12.92:((p+.055)/1.055)**2.4);return .2126*i+.7152*d+.0722*m>.4?"#000":"#fff"}function Ua(s){let{cfg:i,inFrame:d,persist:m,frame:p,frameEl:$,devicesMenu:k,bpBtns:N,notesOverlay:w,WIDE:q,bpOf:x,currentBp:H,deviceById:L,notesOn:b,filter:T,filterTo:_,dropFrameDrafts:X,putAway:W,tellFrame:ct,syncBpButtons:F,render:Q,reread:it}=s,ht=i.breakpoints,nt=document.querySelector(".dt-device"),Jt=document.querySelector(".dt-shell"),yt=document.querySelector('.dt-chrome[data-at="top"]'),Mt=document.querySelector('.dt-chrome[data-at="bottom"]'),mt=document.querySelector(".dt-ruler"),E=[...document.querySelectorAll(".dt-frame-handle")],at=document.querySelector(".dt-frame-size"),gt=document.querySelector(".dt-frame-rotate"),It=document.querySelector(".dt-frame-bars"),f="overlay",c="",y="dt-w",A="dt-canvas",B="dt-device",J=et.getItem(A)==="1",O=et.getItem(B)||"";O&&!L(O)&&(O="",et.setItem(B,""));let P=Number(et.getItem(y))||0,j="dt-emu",V=(()=>{try{return JSON.parse(et.getItem(j)||"null")}catch{return null}})(),bt=()=>V?rn.find(v=>v.id===V.id)??null:null,ft=()=>{let v=bt();return v?V.turned?{w:v.h,h:v.w}:{w:v.w,h:v.h}:null},Ot=et.getItem("dt-bars-min")==="1",Pt=v=>{V=v,m(j,v?JSON.stringify(v):"")},Dt=v=>{at.textContent=v,p.style.setProperty("--dt-badge-w",`${at.offsetWidth}px`)},Lt=v=>{if(!v){mt.innerHTML="";return}let C="";for(let I=0;I<=v;I+=50)C+=`<span class="dt-tick${I%200===0?" is-major":""}" style="left:${I}px"></span>`;for(let I of ht)for(let ot of[I.min,I.max])ot>0&&Number.isFinite(ot)&&ot<=v&&(C+=`<span class="dt-edge" style="left:${ot}px" title="${I.label} edge"></span>`);mt.innerHTML=C,mt.style.width=`${v}px`},Ge=()=>{let v=parseFloat(nt.style.width)||0,C=parseFloat(nt.style.height)||0;if(!v||!C){nt.style.transform="",delete nt.dataset.scaled;return}let I=O||V?Math.min(1,(innerWidth-80)/v,(innerHeight-120)/C):Math.min(1,(innerWidth-80)/v);nt.style.transform=I<1?`scale(${I})`:"",nt.dataset.scaled=I<1?String(Math.round(I*100)):""},Fe=v=>rn.find(C=>C.w===v.w&&C.h===v.h&&C.cutout?.shape==="pill")?.cutout,he=()=>{try{return $.contentDocument}catch{return null}},U=()=>he()?.title.split("\u2014").pop()?.trim()||"",we=()=>{let v=he(),C=O?L(O):null;if(!v?.body||!C)return;let I=Ka(v),ot=C.browser==="chrome-android"?I.theme||"rgb(255, 255, 255)":I.top,dt=C.browser==="chrome-android"?"rgb(255, 255, 255)":I.bottom;nt.style.setProperty("--dt-top",ot),nt.style.setProperty("--dt-top-ink",js(ot)),nt.style.setProperty("--dt-bottom",dt),nt.style.setProperty("--dt-bottom-ink",js(dt));let xt=yt.querySelector(".dt-win-tab > span");xt&&(xt.textContent=U()||location.host)},$e=0;$.addEventListener("load",()=>{let v=he();if(!v)return;let C=window.__notemendHosted;if(C&&!$.contentWindow?.__notemendHosted&&!v.querySelector(`script[src^="${C.base}/bar.js"]`)){let I=v.createElement("script");I.src=`${C.base}/bar.js`,I.dataset.project=C.project,v.head.append(I)}we(),$.contentWindow?.addEventListener("scroll",()=>{$e||($e=requestAnimationFrame(()=>{$e=0,we()}))},{passive:!0})});for(let v of[yt,Mt])v.addEventListener("click",C=>{let I=C.target.closest("[data-nav]")?.dataset.nav;if(I)try{let ot=$.contentWindow?.navigation;if(!he()||!ot)throw new Error("foreign");I==="back"?ot.canGoBack&&ot.back():I==="fwd"?ot.canGoForward&&ot.forward():ot.reload()}catch{(I==="reload"||I==="back")&&($.src=location.href)}});It.addEventListener("click",()=>{Ot=!Ot,m("dt-bars-min",Ot?"1":"0"),qt()});let qt=()=>{if(d)return;let v=O?L(O)??null:null;if(O&&!v&&(O="",et.setItem(B,"")),!v&&!J){p.hidden=!0,$.removeAttribute("src"),Bt.toggle("dt-framing",!1),w.hidden=!b(),mt.innerHTML="",F(),gt.hidden=!0,It.hidden=!0,_(null),c="",X(),F(),wt(),it();return}if(p.hidden=!1,Bt.toggle("dt-framing",!0),w.hidden=!0,$.src||($.src=location.href),v){let C=Va(v,{host:location.host,title:U(),now:new Date,min:Ot,cutout:Fe(v)}),{screen:I}=C;p.dataset.mode="device",nt.dataset.shell=v.shell,nt.dataset.browser=v.browser,nt.style.width=`${C.footprint.w}px`,nt.style.height=`${C.footprint.h}px`,nt.style.setProperty("--dt-r",`${I.r}px`),nt.style.setProperty("--dt-rb",`${I.rb}px`),Jt.innerHTML=C.shell;let ot=(Zt,Rt,Tt,te)=>{Zt.innerHTML=te,Zt.style.cssText=`left:${I.x}px;top:${Rt}px;width:${I.w}px;height:${Tt}px`};ot(yt,I.y,C.topH,C.top),ot(Mt,I.y+I.h-C.bottomH,C.bottomH,C.bottom);let dt=I.h-C.topH-C.bottomH;$.style.position="absolute",$.style.left=`${I.x}px`,$.style.top=`${I.y+C.topH}px`,$.style.width=`${I.w}px`,$.style.height=`${dt}px`,mt.innerHTML="";let xt=Ot&&C.canMinimize;f=C.scrollbar,c=`${v.label}${xt?" \xB7 bars folded":""}`,_(x(v.w)),ct({notes:b(),scrollbar:f,device:c}),It.hidden=!C.canMinimize,It.setAttribute("aria-pressed",String(xt)),Dt(`${v.label} \xB7 page ${v.w}\xD7${dt} of ${v.w}\xD7${v.h}${xt?" \xB7 bars folded":""} \xB7 ${ht.find(Zt=>Zt.id===T())?.label??""}`),we()}else{let C=ft();C||Pt(null);let I=C?.w||P||ht.find(xt=>xt.id===H()).ideal;P=I,p.dataset.mode="canvas",delete nt.dataset.shell,delete nt.dataset.browser,Jt.innerHTML=yt.innerHTML=Mt.innerHTML="",yt.style.cssText=Mt.style.cssText="",It.hidden=!0,f="overlay",nt.style.width=`${I}px`,nt.style.height=`${C?.h??innerHeight-84}px`,$.style.position="",$.style.left=$.style.top="",$.style.width="100%",$.style.height="100%",Lt(I),ct({notes:b()});let ot=ht.find(xt=>xt.id===x(I)),dt=bt();c=dt?`${dt.label}${V?.turned?" \xB7 landscape":""}`:"",ct({scrollbar:f,device:c}),Dt(dt&&C?`${dt.label} \xB7 ${C.w}\xD7${C.h} \xB7 ${ot.label}`:`${I}px \xB7 ${ot.label}`),_(x(I))}gt.hidden=!(bt()?.rotates&&!v),wt(),Ge(),F(),it()},Y=v=>{let C=ht.find(I=>I.id===v);O="",et.setItem(B,""),Pt(null),J=v!==q,P=J?C.ideal:0,_(J?v:null),et.setItem(A,J?"1":"0"),et.setItem(y,String(P)),W(),qt()};for(let v of N)v.addEventListener("click",()=>Y(v.dataset.bp));for(let v of document.querySelectorAll("[data-device]"))v.addEventListener("click",()=>{O=v.dataset.device===O?"":v.dataset.device,et.setItem(B,O),k.open=!1,qt()});for(let v of document.querySelectorAll("[data-emu]"))v.addEventListener("click",()=>{let C=V?.id===v.dataset.emu&&!O;O="",et.setItem(B,""),Pt(C?null:{id:v.dataset.emu,turned:!1}),J=!C,P=0,et.setItem(A,J?"1":"0"),_(null),W(),k.open=!1,qt()});gt.addEventListener("click",()=>{V&&(Pt({...V,turned:!V.turned}),W(),qt())});let kt=[...k.querySelectorAll("[data-tab]")],st=[...k.querySelectorAll("[data-panel]")],M=v=>{for(let C of kt)C.setAttribute("aria-selected",String(C.dataset.tab===v));for(let C of st)C.hidden=C.dataset.panel!==v;m("dt-devices-tab",v)};for(let v of kt)v.addEventListener("click",()=>M(v.dataset.tab));M(et.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let xe=k.querySelector(".dt-emu-search");xe.addEventListener("input",()=>{let v=xe.value.trim().toLowerCase(),C=null,I=!1,ot=()=>{C&&(C.hidden=!I)};for(let dt of xe.parentElement.children){if(dt.classList.contains("dt-devices-group")){ot(),C=dt,I=!1;continue}dt.dataset.emu&&(dt.hidden=!!v&&!dt.textContent.toLowerCase().includes(v),I||=!dt.hidden)}ot()});let Ft=k.querySelector(".dt-devices-name");function wt(){for(let C of k.querySelectorAll("[data-device]"))C.setAttribute("aria-pressed",String(C.dataset.device===O));let v=!O&&!p.hidden?V?.id:void 0;for(let C of k.querySelectorAll("[data-emu]"))C.setAttribute("aria-pressed",String(C.dataset.emu===v));Ft.textContent=O&&L(O)?.label||v&&bt()?.label||"Device"}let lt=v=>ht.find(C=>C.id===v),St=v=>{let C=lt(T()??H());return Math.max(C.min||320,Math.min(Number.isFinite(C.max)?C.max:2560,Math.round(v)))};for(let v of E){let C=v.dataset.edge==="l"?-1:1;v.addEventListener("pointerdown",I=>{if(O)return;I.preventDefault(),V&&(Pt(null),qt()),v.setPointerCapture(I.pointerId);let ot=I.clientX,dt=P,xt=Number(nt.dataset.scaled||100)/100;p.dataset.dragging="1";let Zt=Tt=>{P=St(dt+C*(Tt.clientX-ot)*2/xt),nt.style.width=`${P}px`,Lt(P),Dt(`${P}px \xB7 ${lt(x(P)).label}`),Ge()},Rt=()=>{v.removeEventListener("pointermove",Zt),v.removeEventListener("pointerup",Rt),v.removeEventListener("pointercancel",Rt),delete p.dataset.dragging,et.setItem(y,String(P)),qt()};v.addEventListener("pointermove",Zt),v.addEventListener("pointerup",Rt),v.addEventListener("pointercancel",Rt)}),v.addEventListener("dblclick",()=>{if(O)return;Pt(null);let I=lt(T()??H()),ot=[I.min||320,Number.isFinite(I.max)?I.max:I.ideal];P=Math.abs(P-ot[0])<Math.abs(P-ot[1])?ot[0]:ot[1],et.setItem(y,String(P)),qt()})}let Ee=H();return addEventListener("resize",()=>{F(),H()!==Ee&&(Ee=H(),Q()),p.hidden||(!O&&!V&&(nt.style.height=`${innerHeight-84}px`),Ge())}),{apply:qt,pickBp:Y,look:()=>({scrollbar:f,device:c}),restore:()=>{J||O?qt():wt()}}}var Ga='<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>',Ya='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',Kr='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function Xa(s){let{bp:i,notes:d,breakpoints:m,bandOfNote:p,whoseAgent:$,statusTools:k,showResolved:N,showArchived:w,drafts:q,find:x}=s,H=d.filter(E=>p(E)===i),L=E=>[E.text,E.note,E.byName,...(E.replies??[]).filter(at=>!at.deleted).map(at=>at.text)].join(" ").toLowerCase(),b=E=>x.view==="me"?s.forMe(E):x.view==="agent"?s.forAgent(E):!0,T=E=>Date.parse(E.updatedAt||E.createdAt||"")||0,_=H.filter(E=>b(E)&&(!x.q||L(E).includes(x.q.trim().toLowerCase()))).sort((E,at)=>(x.sort==="unread"?Number(s.unread(at))-Number(s.unread(E)):0)||T(at)-T(E)),X={open:[],claude:[],done:[],archived:[]};for(let E of _)X[pt(E)==="done"&&s.archived(E)?"archived":pt(E)].push(E);let W=E=>{let at=(E.replies??[]).filter(B=>!B.deleted),gt=at.length+(E.note?1:0),It=Ie(E.category),f=pt(E),c=f==="claude",y=s.orphan(E),A=at.length?at[at.length-1]:E.note?{author:"claude",text:E.note}:{author:"you",text:E.text};return`<div class="dt-hist-row is-${f}${f==="done"?s.archived(E)?" is-archived":" is-resolved":""}${y?" is-orphan":""}">
167
+ `)}var Fi=[{id:"general",label:"General",color:"#0d99ff",icon:'<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect x="3" y="14" width="7" height="7" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/>'},{id:"bug",label:"Bug",color:"#e5484d",icon:'<path d="m8 2 1.88 1.88M14.12 3.88 16 2M9 7.13v-1a3 3 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6M12 20v-9M6.53 9C4.6 8.8 3 7.1 3 5M6 13H2M3 21c0-2.1 1.7-3.9 3.8-4M20.97 5c0 2.1-1.6 3.8-3.5 4M22 13h-4M17.2 17c2.1.1 3.8 1.9 3.8 4"/>'},{id:"text",label:"Text",color:"#f5c451",icon:'<path d="M4 7V4h16v3M9 20h6M12 4v16"/>'},{id:"motion",label:"Motion",color:"#a475f9",icon:'<path d="M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2M9.6 4.6A2 2 0 1 1 11 8H2M12.6 19.4A2 2 0 1 0 14 16H2"/>'},{id:"design",label:"Design",color:"#d6409f",icon:'<path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.97 6.01 17.46 2 12 2z"/><circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/>'},{id:"content",label:"Content",color:"#30a46c",icon:'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4M10 9H8M16 13H8M16 17H8"/>'}],bn=(s,i=14)=>`<svg viewBox="0 0 24 24" width="${i}" height="${i}" fill="none" stroke="${s.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${s.icon}</svg>`,Qe=s=>Fi.find(i=>i.id===s)||Fi[0];var ht=s=>s.status!=="done"?"open":s.doneBy==="claude"?"claude":"done",ji={open:"Open",done:"Resolved",claude:"To check"};var Ft={ready:Promise.resolve(),toggle:(s,i)=>{Ft.ready.then(()=>document.documentElement.classList.toggle(s,i))},set:(s,i)=>{Ft.ready.then(()=>document.documentElement.style.setProperty(s,i))}};var td=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Wi=s=>String(s??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(td,"$1\u2022\u2022\u2022").replace(/\b(Bearer|Basic|Token)\s+[\w.~+/=-]+/gi,"$1 \u2022\u2022\u2022").replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/g,"\u2022\u2022\u2022");var ks=[],Co=s=>{if(s instanceof Error)return`${s.name}: ${s.message}`;if(typeof s=="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}},tn=(s,i)=>{ks.push({at:new Date().toISOString(),kind:s,text:Wi(i.replace(/\s+/g," ").trim()).slice(0,500)}),ks.length>50&&ks.shift()},_i=!1;function zi(s){if(_i||typeof window>"u")return;_i=!0;let i=console.error;console.error=(...m)=>{tn("console",m.map(Co).join(" ")),i.apply(console,m)},addEventListener("error",m=>{if(m instanceof ErrorEvent)return tn("error",`${m.message}${m.filename?` (${m.filename}:${m.lineno})`:""}`);let v=m.target,S=v?.src||v?.href;S&&!s(S)&&tn("network",`${v.tagName?.toLowerCase()} ${S} did not load`)},!0),addEventListener("unhandledrejection",m=>tn("rejection",Co(m.reason)));let d=window.fetch;window.fetch=async(m,v)=>{let S=typeof m=="string"?m:m instanceof URL?m.href:m.url,H=(v?.method||(m instanceof Request?m.method:"GET")).toUpperCase();try{let b=await d.call(window,m,v);return b.status>=400&&!s(S)&&tn("network",`${H} ${S} \u2192 ${b.status}`),b}catch(b){throw!s(S)&&b?.name!=="AbortError"&&tn("network",`${H} ${S} \u2192 no answer (${Co(b)})`),b}};let h=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(m,v,...S){return this._nm=`${m.toUpperCase()} ${String(v)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(s(String(v))||tn("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),h.call(this,m,v,...S)}}var Vi=(s=Date.now())=>ks.filter(i=>s-Date.parse(i.at)<10*6e4).slice(-20);function Ui(s){let i=$=>{let p=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,x=$/p;return Math.round(x*10)%10===0?String(Math.round(x)):x.toFixed(1)},d=($,p,x,N,R,W="p")=>{if(x<=0||N<=0)return"";let z=R!==""?`<span class="dt-pad-chip dt-pad-chip--${W}" style="left:${$+x/2}px;top:${p+N/2}px">${R}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${W}" style="left:${$}px;top:${p}px;width:${x}px;height:${N}px"></span>${z}`},h=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],m="button, a, input, select, textarea, label, [role='button']",v=$=>{let p=$;for(let x=0;p&&x<6;x++,p=p.parentElement){if(p.matches(m))return p;let N=getComputedStyle(p);if(h.some(R=>parseFloat(N[R])>=2))return p}return $},S=($,p)=>{let x=parseFloat(p.columnGap)||0,N=parseFloat(p.rowGap)||0;if(!(p.display.includes("flex")||p.display.includes("grid"))||!x&&!N)return"";let R=[...$.children].map(z=>z.getBoundingClientRect()).filter(z=>z.width||z.height),W="";for(let z=1;z<R.length;z++){let Y=R[z-1],q=R[z];if(x&&q.left>=Y.right-1){let nt=Math.max(Y.top,q.top);W+=d(Y.right,nt,q.left-Y.right,Math.min(Y.bottom,q.bottom)-nt,i(x),"g")}else if(N&&q.top>=Y.bottom-1){let nt=Math.min(Y.left,q.left);W+=d(nt,Y.bottom,Math.max(Y.right,q.right)-nt,q.top-Y.bottom,i(N),"g")}}return W},H=$=>`<span class="dt-pad-outline" style="left:${$.left}px;top:${$.top}px;width:${$.width}px;height:${$.height}px"></span>`,b=($,p,x="")=>`<span class="dt-pad-tag" style="left:${p.left}px;top:${Math.max(2,p.top-22)}px">${$.tagName.toLowerCase()+($.classList[0]?"."+$.classList[0]:"")}${x}</span>`,k=$=>{let p=$.getBoundingClientRect(),x=getComputedStyle($),N=parseFloat(x.paddingTop),R=parseFloat(x.paddingRight),W=parseFloat(x.paddingBottom),z=parseFloat(x.paddingLeft),Y=H(p);Y+=d(p.left,p.top,p.width,N,N>=2?i(N):""),Y+=d(p.left,p.bottom-W,p.width,W,W>=2?i(W):""),Y+=d(p.left,p.top+N,z,p.height-N-W,z>=2?i(z):""),Y+=d(p.right-R,p.top+N,R,p.height-N-W,R>=2?i(R):"");let q=parseFloat(x.marginTop),nt=parseFloat(x.marginRight),St=parseFloat(x.marginBottom),bt=parseFloat(x.marginLeft);Y+=d(p.left,p.top-q,p.width,q,q>=2?i(q):"","m"),Y+=d(p.left,p.bottom,p.width,St,St>=2?i(St):"","m"),Y+=d(p.left-bt,p.top,bt,p.height,bt>=2?i(bt):"","m"),Y+=d(p.right,p.top,nt,p.height,nt>=2?i(nt):"","m"),Y+=S($,x);let jt=parseFloat(x.columnGap)||0,oe=parseFloat(x.rowGap)||0,Jt=(x.display.includes("flex")||x.display.includes("grid"))&&(jt||oe)?` \xB7 gap ${i(jt)}${oe&&oe!==jt?"/"+i(oe):""}`:"",xt="",Fe=$.parentElement;if($.matches(m)&&Fe){let Ot=getComputedStyle(Fe);Y+=S(Fe,Ot);let we=parseFloat(Ot.columnGap)||parseFloat(Ot.rowGap)||0;xt=` \xB7 ${i(p.width)}\xD7${i(p.height)}${we&&(Ot.display.includes("flex")||Ot.display.includes("grid"))?` \xB7 gap ${i(we)} in its row`:""}`}s.innerHTML=Y+b($,p,Jt+xt)},y=$=>{let p=$.getBoundingClientRect();s.innerHTML=H(p)+`<span class="dt-pad-chip" style="left:${p.left+p.width/2}px;top:${p.top+p.height/2}px">${i(p.width)} \xD7 ${i(p.height)}</span>`+b($,p)},B=$=>{let p=($.match(/[\d.]+/g)||[]).map(Number);if(p.length<3)return $;let x="#"+p.slice(0,3).map(N=>Math.round(N).toString(16).padStart(2,"0")).join("");return p[3]!==void 0&&p[3]<1?`${x} \xB7 ${Math.round(p[3]*100)}%`:x},Z=null,F=()=>{if(Z)return Z;let $=getComputedStyle(document.documentElement),p=document.createElement("span");p.style.display="none",document.body.append(p);let x=[];for(let N of Array.from($)){if(!N.startsWith("--"))continue;let R=$.getPropertyValue(N).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(R))continue;p.style.color="rgb(1, 2, 3)",p.style.color=R;let W=getComputedStyle(p).color;W&&W!=="rgb(1, 2, 3)"&&x.push([W,N])}return p.remove(),x.sort((N,R)=>N[1].length-R[1].length),Z=x,x},w=$=>F().find(([p])=>p===$)?.[1]??"",A=null,D=()=>{if(A)return A;let $=[],p=x=>{for(let N of Array.from(x))N instanceof CSSStyleRule?N.style.cssText.includes("var(--")&&$.push({sel:N.selectorText,style:N.style}):N instanceof CSSMediaRule?matchMedia(N.conditionText).matches&&p(N.cssRules):"cssRules"in N&&p(N.cssRules)};for(let x of Array.from(document.styleSheets))try{p(x.cssRules)}catch{}return A=$},G={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map($=>[`border-${$}-color`,[`border-${$}-color`,"border-color",`border-${$}`,"border"]]))},et=($,p)=>{let x=G[p]??[p],N=p==="color";for(let R=$;R;R=N?R.parentElement:null){let W=q=>x.map(nt=>/var\(\s*(--[\w-]+)/.exec(q.getPropertyValue(nt))?.[1]).find(Boolean),z=R instanceof HTMLElement?W(R.style):void 0;if(z)return z;let Y="";for(let q of D()){let nt=!1;try{nt=R.matches(q.sel)}catch{}nt&&(Y=W(q.style)||Y)}if(Y)return Y;if(N&&R.parentElement&&getComputedStyle(R).color!==getComputedStyle(R.parentElement).color)break}return""},L=($,p,x)=>{let N=et($,p);if(N)return`<b class="dt-var">${N}</b> <em>${B(x)}</em>`;let R=w(x);return R?`<span title="Same value as ${R}; not written with it">\u2248 ${R}</span> <em>${B(x)}</em>`:B(x)},st=$=>`<i class="dt-type-sw" style="background:${$}"></i>`,ut={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},mt=$=>($.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),at=($,p)=>$.slice(0,3).map((x,N)=>x*$[3]+p[N]*(1-$[3])).concat([1]),se=$=>{let p=[];for(let x=$;x;x=x.parentElement){let N=getComputedStyle(x);if(N.backgroundImage!=="none")return null;let R=mt(N.backgroundColor);if(R[3]>0&&(p.push(R),R[3]>=1))break}return p.reduceRight((x,N)=>at(N,x),[255,255,255,1])},Ct=$=>{let[p,x,N]=$.slice(0,3).map(R=>(R/=255,R<=.03928?R/12.92:((R+.055)/1.055)**2.4));return .2126*p+.7152*x+.0722*N},Lt=($,p,x)=>{let N=se($);if(!N)return["Contrast","<em>on an image</em>"];let R=at(mt(p.color),N),[W,z]=[Ct(R),Ct(N)].sort((St,bt)=>bt-St),Y=(W+.05)/(z+.05),q=x>=24||x>=18.66&&Number(p.fontWeight)>=700,nt=Y>=(q?4.5:7)?"AAA":Y>=(q?3:4.5)?"AA":"fails AA";return["Contrast",`${Y.toFixed(2)}:1 <em class="${nt==="fails AA"?"dt-type-bad":""}">${nt}${q?" \xB7 large":""}</em>`]},Vt=$=>{let p=$.getBoundingClientRect(),x=getComputedStyle($),N=parseFloat(x.fontSize),R=x.lineHeight==="normal"?0:parseFloat(x.lineHeight),W=parseFloat(x.letterSpacing)||0,z=bt=>`${(bt*100).toFixed(1).replace(/\.0$/,"")}%`,Y=[["Font",x.fontFamily.split(",")[0].replace(/["']/g,"")+(x.fontStyle!=="normal"?` ${x.fontStyle}`:"")],["Weight",`${ut[x.fontWeight]??""} <em>${x.fontWeight}</em>`],["Size",`${i(N)}px`],["Line",R?`${z(R/N)} <em>${i(R)}px</em>`:"normal"],["Letter",W?`${z(W/N)} <em>${W.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",st(x.color)+L($,"color",x.color)],Lt($,x,N)],nt=p.bottom+150<innerHeight?p.bottom+8:Math.max(8,p.top-158),St=Math.min(Math.max(8,p.left),innerWidth-210);s.innerHTML=H(p)+b($,p)+`<div class="dt-type-card" style="left:${St}px;top:${nt}px">${Y.map(([bt,jt])=>`<span class="dt-type-row"><b>${bt}</b><span>${jt}</span></span>`).join("")}</div>`},E=$=>$.every(p=>p===$[0])?$[0]:$[1]===$[3]&&$[0]===$[2]?`${$[0]} ${$[1]}`:$.join(" "),lt=$=>/^rgba\(.*,\s*0\)$|^transparent$/.test($),vt=($,p,x,N="")=>{let R=16+x.length*18,z=p.bottom+R+12<innerHeight?p.bottom+8:Math.max(8,p.top-R-8),Y=Math.min(Math.max(8,p.left),innerWidth-230);s.innerHTML=`<span class="dt-pad-outline" style="left:${p.left}px;top:${p.top}px;width:${p.width}px;height:${p.height}px${N?`;border-radius:${N}`:""}"></span>`+b($,p)+`<div class="dt-type-card dt-style-card" style="left:${Y}px;top:${z}px">${x.map(([q,nt])=>`<span class="dt-type-row"><b>${q}</b><span>${nt}</span></span>`).join("")}</div>`};return{spacer:v,drawPads:k,drawSize:y,drawType:Vt,drawColor:$=>{let p=getComputedStyle($),x=[];p.backgroundImage!=="none"&&x.push(["Fill",`<em>${/gradient/.test(p.backgroundImage)?"gradient":"image"}</em>`]),lt(p.backgroundColor)||x.push(["Fill",st(p.backgroundColor)+L($,"background-color",p.backgroundColor)]),$.textContent?.trim()&&x.push(["Text",st(p.color)+L($,"color",p.color)]),Number(p.opacity)<1&&x.push(["Opacity",`${Math.round(Number(p.opacity)*100)}%`]),x.length||x.push(["Color","<em>no fill or text</em>"]),vt($,$.getBoundingClientRect(),x)},drawBorder:$=>{let p=getComputedStyle($),x=[],N=["top","right","bottom","left"],R=N.map(z=>parseFloat(p.getPropertyValue(`border-${z}-width`))||0);if(R.some(z=>z>0)){let z=N.filter((q,nt)=>R[nt]>0);x.push(["Width",`${E(R.map(i))} <em>${p.getPropertyValue(`border-${z[0]}-style`)}</em>`]);let Y=z.map(q=>p.getPropertyValue(`border-${q}-color`));z.forEach((q,nt)=>{nt&&Y[nt]===Y[0]||x.push([nt?`\u21B3 ${q}`:"Color",st(Y[nt])+L($,`border-${q}-color`,Y[nt])])})}else x.push(["Width","<em>none</em>"]);let W=["top-left","top-right","bottom-right","bottom-left"].map(z=>{let[Y,q=Y]=p.getPropertyValue(`border-${z}-radius`).split(" "),nt=St=>St.endsWith("%")?St:i(parseFloat(St)||0);return Y===q?nt(Y):`${nt(Y)}/${nt(q)}`});x.push(["Radius",E(W)]),vt($,$.getBoundingClientRect(),x,p.borderRadius)}}}var Pt=s=>(s??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),Gi='[class^="dt-"],[class*=" dt-"],.devtools',Ki=s=>{let i=s;for(;i.parentElement&&i.parentElement!==document.body;)i=i.parentElement;return i.parentElement===document.body&&i.matches(Gi)};function Yi(){let s=(w,A)=>w?[...w.children].filter(D=>D.tagName===A&&!(w===document.body&&D.matches(Gi))):[],i=w=>{let A=[],D=w;for(;D&&D.tagName!=="HTML"&&A.length<8;){if(D.id){A.unshift("#"+CSS.escape(D.id));break}let G=D.parentElement,et=D.tagName.toLowerCase(),L=s(G,D.tagName);A.unshift(L.length>1?`${et}:nth-of-type(${L.indexOf(D)+1})`:et),D=G}return A.join(">")},d=w=>{let A=w.split(">"),D=null;for(let[G,et]of A.entries()){if(et.startsWith("#")){if(G)return null;D=document.querySelector(et);continue}let L=/^([a-z][a-z0-9-]*)(?::nth-of-type\((\d+)\))?$/.exec(et);if(!L)return document.querySelector(w);if(!D){if(L[1]!=="body"||L[2])return document.querySelector(w);D=document.body;continue}if(D=s(D,L[1].toUpperCase())[L[2]?Number(L[2])-1:0]??null,!D)return null}return D},h=(w,A)=>!A||Pt(w.textContent||"").slice(0,60)===A,m=(w,A)=>[w||"*",...(A||[]).map(D=>"."+CSS.escape(D))].join(""),v=w=>{try{return[...document.querySelectorAll(m(w.tag,w.classes))].filter(A=>!Ki(A))}catch{return[]}},S=w=>{let A=Pt(w.textContent||"").replace(/\s+/g," ");for(let D=w.parentElement,G=0;D&&D!==document.body&&G<4;D=D.parentElement,G++){let et=Pt(D.textContent||"").replace(/\s+/g," ");if(et&&et!==A)return et}return""},H=w=>S(w).slice(0,80),b=(w,A)=>!A||S(w).startsWith(A),k=w=>{let A=null;try{A=d(w.selector)}catch{A=null}if(A&&Ki(A)&&(A=null),A&&h(A,w.label)&&b(A,w.ctx))return A;let D=v(w),G=Pt(w.label)?D.filter(L=>h(L,w.label)):[],et=G.find(L=>b(L,w.ctx))??D.find(L=>w.ctx&&b(L,w.ctx)&&!Pt(w.label));return et||(Pt(w.label)?A&&h(A,w.label)?A:G.length===1?G[0]:null:A||(w.nth!=null?D[w.nth]??null:null))},y=w=>{let A=null;for(let D=w,G=w.parentElement;G&&G!==document.body&&getComputedStyle(D).position!=="fixed";D=G,G=G.parentElement){let et=getComputedStyle(G);if(et.overflowX==="visible"&&et.overflowY==="visible")continue;let L=G.getBoundingClientRect();A=A?{l:Math.max(A.l,L.left),t:Math.max(A.t,L.top),r:Math.min(A.r,L.right),b:Math.min(A.b,L.bottom)}:{l:L.left,t:L.top,r:L.right,b:L.bottom}}return A},B=w=>{let A=w.getBoundingClientRect();return(A.width>0||A.height>0)&&(!w.checkVisibility||w.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},Z=(w,A)=>{for(let D=A.parentElement;D&&D!==document.body;D=D.parentElement){if(!B(D))continue;let G=A.getBoundingClientRect();if(G.width||G.height)return{x:G.left+G.width*w.rx,y:G.top+G.height*w.ry,off:"",el:A,hidden:D};let et=D.getBoundingClientRect();return{x:et.left,y:et.top,off:"",el:A,hidden:D}}return null};return{cssPath:i,poolOf:v,contextOf:H,resolveEl:k,anchorOf:(w,A=k(w))=>{if(!A)return null;if(!B(A))return Z(w,A);let D=A.getBoundingClientRect(),G=D.left+D.width*w.rx,et=D.top+D.height*w.ry,L=y(A);if(!L)return{x:G,y:et,off:"",el:A};if(L.r-L.l<18||L.b-L.t<18)return null;let st=Math.min(Math.max(G,L.l),L.r-18),ut=Math.min(Math.max(et,L.t+18),L.b),mt=G<L.l?"l":G>L.r-18?"r":et<L.t+18?"t":et>L.b?"b":"";return{x:st,y:ut,off:mt,el:A}}}}var Xi=(s,i)=>`<svg class="dt-bars" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${[0,1,2,3].map(d=>`<rect x="${.5+d*3}" y="${8.5-d*2.5}" width="2" height="${3+d*2.5}" rx="0.6" fill="${i}" stroke="none" opacity="${d<s?1:.28}"/>`).join("")}</svg>`;function Ji(s,i,d){let h=document.createElement("div");h.className="dt-field-menu",h.setAttribute("role","listbox"),h.hidden=!0,document.body.append(h);for(let S of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])h.addEventListener(S,H=>H.stopPropagation());let m=null,v=()=>{h.hidden=!0,m=null};for(let S of s)S.addEventListener("mousedown",H=>{let b=H.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!b){h.contains(H.target)||v();return}if(H.preventDefault(),m===b){v();return}m=b;let k=b.classList.contains("dt-more-select"),y=F=>k?F.dataset.on!=null:F.selected;h.innerHTML=[...b.options].map((F,w)=>F.hidden?"":`${F.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${w}" aria-selected="${y(F)}"${F.dataset.danger!=null?' class="is-danger"':""}>${F.dataset.icon?F.dataset.icon:F.dataset.initial!=null?F.dataset.face?`<img class="dt-face" src="${i(F.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${i(F.dataset.initial)}</b>`:`<i style="background:${i(F.dataset.c||"#717171")}"></i>`}<span>${i(F.text)}</span>${F.dataset.hint?`<small>${i(F.dataset.hint)}</small>`:""}${y(F)?d:""}</button>`).join("");let B=b.parentElement.getBoundingClientRect();h.style.left=`${B.left}px`,h.style.top=`${B.bottom+4}px`,h.style.minWidth=`${B.width}px`,h.hidden=!1;let Z=h.getBoundingClientRect();Z.bottom>innerHeight-8&&(h.style.top=`${B.top-4-Z.height}px`),Z.right>innerWidth-8&&(h.style.left=`${Math.max(8,B.right-Z.width)}px`)});h.addEventListener("click",S=>{let H=S.target.closest("[data-i]");if(!H||!m)return;let b=m;v(),!(b.selectedIndex===Number(H.dataset.i)&&!b.classList.contains("dt-more-select"))&&(b.selectedIndex=Number(H.dataset.i),b.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",S=>{S.key==="Escape"&&!h.hidden&&(S.stopPropagation(),v())},!0),document.addEventListener("pointerdown",S=>{!h.hidden&&!h.contains(S.target)&&!S.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&v()},!0),addEventListener("scroll",S=>{h.contains(S.target)||v()},!0)}var nn=s=>s.replace(/[&<>"]/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[i]),X={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>'},Ho=(s,i)=>s.toLocaleTimeString("en-US",i),Ls=s=>Ho(s,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),ed={island:s=>({side:12,top:12,bottom:12,r:s.w>=430?62:55,body:s.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:s=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((s.w+32)*.12),extraH:18}),laptop:s=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((s.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function nd(s,i,d,h,m){let v=s.w+2*i.side,S=s.h+i.top+i.bottom,H=(d-v)/2,b=`<rect class="dt-shell-screen" x="${m}" y="${i.top}" width="${s.w}" height="${s.h}" rx="${i.r}"/>`,k="";if(s.shell==="island"||s.shell==="home"||s.shell==="punch"){let y=(B,Z,F)=>`<rect class="dt-shell-btn" x="${B}" y="${Z}" width="4" height="${F}" rx="2"/>`;k+=s.shell==="punch"?y(H+v-1,150,70)+y(H+v-1,240,44):y(H-3,120,28)+y(H-3,170,56)+y(H-3,236,56)+y(H+v-1,190,90),k+=`<rect class="dt-shell-body" x="${H}" y="0" width="${v}" height="${S}" rx="${i.body}"/>`,k+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${v-6}" height="${S-6}" rx="${i.body-3}"/>`,s.shell==="home"&&(k+=`<rect class="dt-shell-slot" x="${d/2-26}" y="44" width="52" height="6" rx="3"/>`,k+=`<circle class="dt-shell-slot" cx="${d/2-48}" cy="47" r="5"/>`,k+=`<circle class="dt-shell-homebtn" cx="${d/2}" cy="${S-46}" r="28"/>`)}else if(s.shell==="tablet")k+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${v}" height="${S}" rx="${i.body}"/>`,k+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${v-8}" height="${S-8}" rx="${i.body-4}"/>`;else if(s.shell==="monitor"){let y=Math.round(v*.1);k+=`<path class="dt-shell-stand" d="M${d/2-y/2} ${S-2}h${y}l${y*.2} 84h${-y*1.4}z"/>`,k+=`<rect class="dt-shell-stand" x="${d/2-v*.15}" y="${S+80}" width="${v*.3}" height="14" rx="7"/>`,k+=`<rect class="dt-shell-body" x="${H}" y="0" width="${v}" height="${S}" rx="${i.body}"/>`}else{let y=v+(i.extraW??0),B=(d-y)/2,Z=i.extraH??16;k+=`<path class="dt-shell-body" d="M${H} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${v-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${S}H${H}z"/>`,k+=`<path class="dt-shell-base${s.shell==="macbook"?" dt-shell-base--silver":""}" d="M${B} ${S}h${y}v${Z-8}a8 8 0 0 1-8 8H${B+8}a8 8 0 0 1-8-8z"/>`,k+=`<rect class="dt-shell-lip" x="${d/2-v*.07}" y="${S}" width="${v*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${d} ${h}" width="${d}" height="${h}" aria-hidden="true">${k}${b}</svg>`}var sd={"safari-ios":s=>{let i=s.shell==="home"?20:s.w>=400?62:59;return{top:i,bottom:98,topMin:i,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})},od=({d:s,now:i,cutout:d},h)=>{if(s.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${h}px"><span class="dt-sb-l">${X.signal}${X.wifi}</span><b>${Ls(i)}</b><span class="dt-sb-r">${X.battery}</span></div>`;let m=d??{x:(s.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${h}px"><span class="dt-island" style="left:${m.x}px;top:${m.y}px;width:${m.width}px;height:${m.height}px"></span><b class="dt-sb-time" style="top:${m.y}px;height:${m.height}px">${Ls(i)}</b><span class="dt-sb-icons" style="top:${m.y}px;height:${m.height}px">${X.signal}${X.wifi}${X.battery}</span></div>`},ad=({d:s,host:i,min:d},h)=>{let m=s.shell==="home"?"":'<i class="dt-home-ind"></i>';return d?`<div class="dt-ios-bar is-min" style="height:${h}px"><span class="dt-ios-mini">${nn(i)}</span>${m}</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" aria-label="Back" title="Back">${X.back}</button><span class="dt-glass dt-ios-url"><span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${X.reload}</button></span><span class="dt-glass dt-glass--round">${X.dots}</span></div>${m}</div>`},id=({now:s,min:i},d)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Ho(s,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${X.wifi}${X.signal}${X.battery}</span></div>`+(i?"":`<div class="dt-and-bar"><span class="dt-and-url">${X.tune}<span>${nn(d)}</span></span><span class="dt-and-tabs">1</span>${X.dotsV}</div>`),rd=()=>`<div class="dt-and-nav">${X.recent}${X.home}${X.navBack}</div>`,ld=({now:s,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Ls(s)} ${s.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${X.wifi}${X.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${X.sidebar}<button data-nav="back" aria-label="Back" title="Back">${X.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${X.fwd}</button></span><span class="dt-ipad-url">${X.lock}<span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${X.reload}</button></span><span class="dt-bar-group">${X.share}${X.plus}${X.tabs}</span></div>`,dd=({now:s,host:i},d)=>'<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>'+(d?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${X.wifi}${X.battery}<span>${s.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})}&nbsp; ${Ls(s)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${X.sidebar}<button data-nav="back" aria-label="Back" title="Back">${X.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${X.fwd}</button></span><span class="dt-mac-url">${X.lock}<span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${X.reload}</button></span><span class="dt-bar-group">${X.share}${X.plus}${X.tabs}</span></div>`,cd=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(s,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,ud=({host:s,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${nn(i||s)}</span>${X.close}</span><span class="dt-win-new">${X.plus}</span><span class="dt-win-ctrl">${X.winMin}${X.winMax}${X.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${X.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${X.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${X.reload}</button></span><span class="dt-win-url">${X.tune}<span>${nn(s)}</span>${X.star}</span><span class="dt-bar-group">${X.user}${X.dotsV}</span></div>`,pd=({now:s})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,d)=>`<i style="--hue:${200+d*30}"></i>`).join("")}</span><span class="dt-win-tray">${X.chevUp}${X.wifi}${X.volume}${X.battery}<span class="dt-win-clock">${Ho(s,{hour:"numeric",minute:"2-digit"})}<br>${s.toLocaleDateString("en-US")}</span></span></div>`;function Zi(s,i){let d=ed[s.shell](s),h=s.w+2*d.side,m=s.h+d.top+d.bottom,v=h+(d.extraW??0),S=m+(s.shell==="monitor"||s.shell==="macbook"||s.shell==="laptop"?d.extraH??0:0),H=(v-h)/2+d.side,b=sd[s.browser](s),k=i.min?b.topMin??b.top:b.top,y=i.min?b.bottomMin??b.bottom:b.bottom,B={...i,d:s},Z="",F="";switch(s.browser){case"safari-ios":Z=od(B,k),F=ad(B,y);break;case"chrome-android":Z=id(B,i.host),F=rd();break;case"safari-ipad":Z=ld(B),F='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":Z=dd(B,s.shell==="macbook"),F=cd();break;case"chrome-windows":Z=ud(B),F=pd(B);break}return{footprint:{w:v,h:S},screen:{x:H,y:d.top,w:s.w,h:s.h,r:d.r,rb:d.rb??d.r},topH:k,bottomH:y,shell:nd(s,d,v,S,H),top:Z,bottom:F,canMinimize:b.topMin!==void 0&&(b.topMin!==b.top||b.bottomMin!==b.bottom),scrollbar:s.browser==="chrome-windows"?"classic":"overlay"}}var en=null;function Wn(s){if(en??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!en||!s)return[0,0,0,0];en.clearRect(0,0,1,1),en.fillStyle="rgba(0, 0, 0, 0)",en.fillStyle=s,en.fillRect(0,0,1,1);let[i,d,h,m]=en.getImageData(0,0,1,1).data;return[i,d,h,m/255]}var jn=([s,i,d])=>`rgb(${s}, ${i}, ${d})`;function Qi(s){let i=s.defaultView,d=F=>!F||Wn(F)[3]===0,h=[s.body,s.documentElement].map(F=>F&&i.getComputedStyle(F).backgroundColor).find(F=>F&&!d(F)),[m,v,S,H]=h?Wn(h):[255,255,255,1],b=[m,v,S].map(F=>Math.round(F*H+255*(1-H))),k=F=>{let[w,A,D,G]=Wn(F);if(G>=.75)return jn([w,A,D]);let et=(L,st)=>Math.round(L*G+st*(1-G));return jn([et(w,b[0]),et(A,b[1]),et(D,b[2])])},y=F=>{let w=s.elementFromPoint(i.innerWidth/2,F);for(;w&&w!==s.documentElement;w=w.parentElement){let A=i.getComputedStyle(w);if(A.position!=="fixed"&&A.position!=="sticky")continue;let D=w.getBoundingClientRect().width>=i.innerWidth*.9,G=A.backdropFilter&&A.backdropFilter!=="none";return D&&!G&&!d(A.backgroundColor)?k(A.backgroundColor):null}return null},B=s.querySelector('meta[name="theme-color"]')?.content||"",Z=B&&!d(B)?jn(Wn(B)):"";return{top:y(4)??jn(b),bottom:y(i.innerHeight-4)??jn(b),theme:Z}}function Bo(s){let[i,d,h]=Wn(s).map(m=>m/255).map(m=>m<=.04045?m/12.92:((m+.055)/1.055)**2.4);return .2126*i+.7152*d+.0722*h>.4?"#000":"#fff"}function tr(s){let{cfg:i,inFrame:d,persist:h,frame:m,frameEl:v,devicesMenu:S,bpBtns:H,notesOverlay:b,WIDE:k,bpOf:y,currentBp:B,deviceById:Z,notesOn:F,filter:w,filterTo:A,dropFrameDrafts:D,putAway:G,tellFrame:et,syncBpButtons:L,render:st,reread:ut}=s,mt=i.breakpoints,at=document.querySelector(".dt-device"),se=document.querySelector(".dt-shell"),Ct=document.querySelector('.dt-chrome[data-at="top"]'),Lt=document.querySelector('.dt-chrome[data-at="bottom"]'),Vt=document.querySelector(".dt-ruler"),E=[...document.querySelectorAll(".dt-frame-handle")],lt=document.querySelector(".dt-frame-size"),vt=document.querySelector(".dt-frame-rotate"),It=document.querySelector(".dt-frame-bars"),Ut="overlay",$="",p="dt-w",x="dt-canvas",N="dt-device",R=ot.getItem(x)==="1",W=ot.getItem(N)||"";W&&!Z(W)&&(W="",ot.setItem(N,""));let z=Number(ot.getItem(p))||0,Y="dt-emu",q=(()=>{try{return JSON.parse(ot.getItem(Y)||"null")}catch{return null}})(),nt=()=>q?On.find(M=>M.id===q.id)??null:null,St=()=>{let M=nt();return M?q.turned?{w:M.h,h:M.w}:{w:M.w,h:M.h}:null},bt=ot.getItem("dt-bars-min")==="1",jt=M=>{q=M,h(Y,M?JSON.stringify(M):"")},oe=M=>{lt.textContent=M,m.style.setProperty("--dt-badge-w",`${lt.offsetWidth}px`)},Jt=M=>{if(!M){Vt.innerHTML="";return}let C="";for(let O=0;O<=M;O+=50)C+=`<span class="dt-tick${O%200===0?" is-major":""}" style="left:${O}px"></span>`;for(let O of mt)for(let it of[O.min,O.max])it>0&&Number.isFinite(it)&&it<=M&&(C+=`<span class="dt-edge" style="left:${it}px" title="${O.label} edge"></span>`);Vt.innerHTML=C,Vt.style.width=`${M}px`},xt=()=>{let M=parseFloat(at.style.width)||0,C=parseFloat(at.style.height)||0;if(!M||!C){at.style.transform="",delete at.dataset.scaled;return}let O=W||q?Math.min(1,(innerWidth-80)/M,(innerHeight-120)/C):Math.min(1,(innerWidth-80)/M);at.style.transform=O<1?`scale(${O})`:"",at.dataset.scaled=O<1?String(Math.round(O*100)):""},Fe=M=>On.find(C=>C.w===M.w&&C.h===M.h&&C.cutout?.shape==="pill")?.cutout,Ot=()=>{try{return v.contentDocument}catch{return null}},we=()=>Ot()?.title.split("\u2014").pop()?.trim()||"",J=()=>{let M=Ot(),C=W?Z(W):null;if(!M?.body||!C)return;let O=Qi(M),it=C.browser==="chrome-android"?O.theme||"rgb(255, 255, 255)":O.top,ft=C.browser==="chrome-android"?"rgb(255, 255, 255)":O.bottom;at.style.setProperty("--dt-top",it),at.style.setProperty("--dt-top-ink",Bo(it)),at.style.setProperty("--dt-bottom",ft),at.style.setProperty("--dt-bottom-ink",Bo(ft));let Et=Ct.querySelector(".dt-win-tab > span");Et&&(Et.textContent=we()||location.host)},Ce=0;v.addEventListener("load",()=>{let M=Ot();if(!M)return;let C=window.__notemendHosted;if(C&&!v.contentWindow?.__notemendHosted&&!M.querySelector(`script[src^="${C.base}/bar.js"]`)){let O=M.createElement("script");O.src=`${C.base}/bar.js`,O.dataset.project=C.project,M.head.append(O)}J(),v.contentWindow?.addEventListener("scroll",()=>{Ce||(Ce=requestAnimationFrame(()=>{Ce=0,J()}))},{passive:!0})});for(let M of[Ct,Lt])M.addEventListener("click",C=>{let O=C.target.closest("[data-nav]")?.dataset.nav;if(O)try{let it=v.contentWindow?.navigation;if(!Ot()||!it)throw new Error("foreign");O==="back"?it.canGoBack&&it.back():O==="fwd"?it.canGoForward&&it.forward():it.reload()}catch{(O==="reload"||O==="back")&&(v.src=location.href)}});It.addEventListener("click",()=>{bt=!bt,h("dt-bars-min",bt?"1":"0"),Wt()});let Wt=()=>{if(d)return;let M=W?Z(W)??null:null;if(W&&!M&&(W="",ot.setItem(N,"")),!M&&!R){m.hidden=!0,v.removeAttribute("src"),Ft.toggle("dt-framing",!1),b.hidden=!F(),Vt.innerHTML="",L(),vt.hidden=!0,It.hidden=!0,A(null),$="",D(),L(),Ht(),ut();return}if(m.hidden=!1,Ft.toggle("dt-framing",!0),b.hidden=!0,v.src||(v.src=location.href),M){let C=Zi(M,{host:location.host,title:we(),now:new Date,min:bt,cutout:Fe(M)}),{screen:O}=C;m.dataset.mode="device",at.dataset.shell=M.shell,at.dataset.browser=M.browser,at.style.width=`${C.footprint.w}px`,at.style.height=`${C.footprint.h}px`,at.style.setProperty("--dt-r",`${O.r}px`),at.style.setProperty("--dt-rb",`${O.rb}px`),se.innerHTML=C.shell;let it=(ae,$e,ue,sn)=>{ae.innerHTML=sn,ae.style.cssText=`left:${O.x}px;top:${$e}px;width:${O.w}px;height:${ue}px`};it(Ct,O.y,C.topH,C.top),it(Lt,O.y+O.h-C.bottomH,C.bottomH,C.bottom);let ft=O.h-C.topH-C.bottomH;v.style.position="absolute",v.style.left=`${O.x}px`,v.style.top=`${O.y+C.topH}px`,v.style.width=`${O.w}px`,v.style.height=`${ft}px`,Vt.innerHTML="";let Et=bt&&C.canMinimize;Ut=C.scrollbar,$=`${M.label}${Et?" \xB7 bars folded":""}`,A(y(M.w)),et({notes:F(),scrollbar:Ut,device:$}),It.hidden=!C.canMinimize,It.setAttribute("aria-pressed",String(Et)),oe(`${M.label} \xB7 page ${M.w}\xD7${ft} of ${M.w}\xD7${M.h}${Et?" \xB7 bars folded":""} \xB7 ${mt.find(ae=>ae.id===w())?.label??""}`),J()}else{let C=St();C||jt(null);let O=C?.w||z||mt.find(Et=>Et.id===B()).ideal;z=O,m.dataset.mode="canvas",delete at.dataset.shell,delete at.dataset.browser,se.innerHTML=Ct.innerHTML=Lt.innerHTML="",Ct.style.cssText=Lt.style.cssText="",It.hidden=!0,Ut="overlay",at.style.width=`${O}px`,at.style.height=`${C?.h??innerHeight-84}px`,v.style.position="",v.style.left=v.style.top="",v.style.width="100%",v.style.height="100%",Jt(O),et({notes:F()});let it=mt.find(Et=>Et.id===y(O)),ft=nt();$=ft?`${ft.label}${q?.turned?" \xB7 landscape":""}`:"",et({scrollbar:Ut,device:$}),oe(ft&&C?`${ft.label} \xB7 ${C.w}\xD7${C.h} \xB7 ${it.label}`:`${O}px \xB7 ${it.label}`),A(y(O))}vt.hidden=!(nt()?.rotates&&!M),Ht(),xt(),L(),ut()},je=M=>{let C=mt.find(O=>O.id===M);W="",ot.setItem(N,""),jt(null),R=M!==k||innerWidth<C.min,z=R?C.ideal:0,A(R?M:null),ot.setItem(x,R?"1":"0"),ot.setItem(p,String(z)),G(),Wt()};for(let M of H)M.addEventListener("click",()=>je(M.dataset.bp));for(let M of document.querySelectorAll("[data-device]"))M.addEventListener("click",()=>{W=M.dataset.device===W?"":M.dataset.device,ot.setItem(N,W),S.open=!1,Wt()});for(let M of document.querySelectorAll("[data-emu]"))M.addEventListener("click",()=>{let C=q?.id===M.dataset.emu&&!W;W="",ot.setItem(N,""),jt(C?null:{id:M.dataset.emu,turned:!1}),R=!C,z=0,ot.setItem(x,R?"1":"0"),A(null),G(),S.open=!1,Wt()});vt.addEventListener("click",()=>{q&&(jt({...q,turned:!q.turned}),G(),Wt())});let V=[...S.querySelectorAll("[data-tab]")],Tt=[...S.querySelectorAll("[data-panel]")],tt=M=>{for(let C of V)C.setAttribute("aria-selected",String(C.dataset.tab===M));for(let C of Tt)C.hidden=C.dataset.panel!==M;h("dt-devices-tab",M)};for(let M of V)M.addEventListener("click",()=>tt(M.dataset.tab));tt(ot.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let T=S.querySelector(".dt-emu-search");T.addEventListener("input",()=>{let M=T.value.trim().toLowerCase(),C=null,O=!1,it=()=>{C&&(C.hidden=!O)};for(let ft of T.parentElement.children){if(ft.classList.contains("dt-devices-group")){it(),C=ft,O=!1;continue}ft.dataset.emu&&(ft.hidden=!!M&&!ft.textContent.toLowerCase().includes(M),O||=!ft.hidden)}it()});let yn=S.querySelector(".dt-devices-name");function Ht(){for(let C of S.querySelectorAll("[data-device]"))C.setAttribute("aria-pressed",String(C.dataset.device===W));let M=!W&&!m.hidden?q?.id:void 0;for(let C of S.querySelectorAll("[data-emu]"))C.setAttribute("aria-pressed",String(C.dataset.emu===M));yn.textContent=W&&Z(W)?.label||M&&nt()?.label||"Device"}let We=M=>mt.find(C=>C.id===M),Bt=M=>{let C=We(w()??B());return Math.max(C.min||320,Math.min(Number.isFinite(C.max)?C.max:2560,Math.round(M)))};for(let M of E){let C=M.dataset.edge==="l"?-1:1;M.addEventListener("pointerdown",O=>{if(W)return;O.preventDefault(),q&&(jt(null),Wt()),M.setPointerCapture(O.pointerId);let it=O.clientX,ft=z,Et=Number(at.dataset.scaled||100)/100;m.dataset.dragging="1";let ae=ue=>{z=Bt(ft+C*(ue.clientX-it)*2/Et),at.style.width=`${z}px`,Jt(z),oe(`${z}px \xB7 ${We(y(z)).label}`),xt()},$e=()=>{M.removeEventListener("pointermove",ae),M.removeEventListener("pointerup",$e),M.removeEventListener("pointercancel",$e),delete m.dataset.dragging,ot.setItem(p,String(z)),Wt()};M.addEventListener("pointermove",ae),M.addEventListener("pointerup",$e),M.addEventListener("pointercancel",$e)}),M.addEventListener("dblclick",()=>{if(W)return;jt(null);let O=We(w()??B()),it=[O.min||320,Number.isFinite(O.max)?O.max:O.ideal];z=Math.abs(z-it[0])<Math.abs(z-it[1])?it[0]:it[1],ot.setItem(p,String(z)),Wt()})}let gt=B(),Nt=()=>{let M=mt.find(C=>C.id===k);return R&&!W&&!q&&z===M.ideal&&innerWidth>=M.min};return addEventListener("resize",()=>{if(Nt()){je(k);return}L(),B()!==gt&&(gt=B(),st()),m.hidden||(!W&&!q&&(at.style.height=`${innerHeight-84}px`),xt())}),{apply:Wt,pickBp:je,look:()=>({scrollbar:Ut,device:$}),restore:()=>{Nt()?je(k):R||W?Wt():Ht()}}}var er='<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>',nr='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',hd='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function sr(s){let{bp:i,notes:d,breakpoints:h,bandOfNote:m,whoseAgent:v,statusTools:S,showResolved:H,showArchived:b,drafts:k,find:y}=s,B=d.filter(E=>m(E)===i),Z=E=>[E.text,E.note,E.byName,...(E.replies??[]).filter(lt=>!lt.deleted).map(lt=>lt.text)].join(" ").toLowerCase(),F=E=>y.view==="me"?s.forMe(E):y.view==="agent"?s.forAgent(E):!0,w=E=>Date.parse(E.updatedAt||E.createdAt||"")||0,A=B.filter(E=>F(E)&&(!y.q||Z(E).includes(y.q.trim().toLowerCase()))).sort((E,lt)=>(y.sort==="unread"?Number(s.unread(lt))-Number(s.unread(E)):0)||w(lt)-w(E)),D={open:[],claude:[],done:[],archived:[]};for(let E of A)D[ht(E)==="done"&&s.archived(E)?"archived":ht(E)].push(E);let G=E=>{let lt=(E.replies??[]).filter(R=>!R.deleted),vt=Qe(E.category),It=ht(E),Ut=It==="claude"&&!s.agentless(E),$=s.orphan(E),p=lt.length?lt[lt.length-1]:E.note?{author:"claude",text:E.note}:{author:"you",text:E.text},x=(R,W)=>R.by&&W.by?R.by===W.by:R.byName===W.byName,N=s.unread(E);return`<div class="dt-hist-row is-${It}${It==="done"?s.archived(E)?" is-archived":" is-resolved":""}${$?" is-orphan":""}${N?" is-unread":""}">
150
168
  <button class="dt-hist-go" data-go="${E.id}">
151
169
  ${s.marker(E)}
152
170
  <span class="dt-hist-body">
153
- <span class="dt-hist-id">#${E.id>0?E.id:"\u2026"}<em>${It.label}</em>${c?`<b class="dt-hist-claude" data-unmark="${E.id}" role="button" tabindex="0" title="Resolved by ${h($(E.doneAgent,E.doneFor))} \u2014 click to clear: back to open">${Xt(9)}${h(Ue(E.doneAgent))}<i aria-hidden="true">\xD7</i></b>`:""}${y?'<b class="dt-hist-orphan" title="The element is not on this page any more">gone</b>':s.hiddenNow(E)?'<b class="dt-hist-orphan is-hidden" title="Inside a menu or a popup that is closed now \u2014 open it and the pin moves onto it">hidden</b>':""}</span>
154
- <span class="dt-hist-text">${A.author==="claude"?`<b>${h($(A.agent,A.by))}:</b> `:""}${h(A.text)}</span>
155
- <span class="dt-hist-meta">${cn(E.updatedAt||E.createdAt)}${E.device?` \xB7 ${h(E.device)}`:E.browser?` \xB7 ${h(E.browser)}`:""}${gt?` \xB7 ${gt} repl${gt===1?"y":"ies"}`:""}</span>
171
+ <span class="dt-hist-id"><b class="dt-hist-who">${g(E.byName||"You")}</b><i class="dt-hist-type" style="color:${vt.color}" data-tip="${g(vt.label)}">${bn(vt)}</i><em>#${E.id>0?E.id:"\u2026"} \xB7 ${Je(E.updatedAt||E.createdAt)}</em>${Ut?`<b class="dt-hist-claude" data-unmark="${E.id}" role="button" tabindex="0" title="To check \u2014 ${g(v(E.doneAgent,E.doneFor))} fixed it \xB7 click to reopen">${zt(9)}${g(fn(E.doneAgent))}<i aria-hidden="true">\xD7</i></b>`:""}${$?'<b class="dt-hist-orphan" title="The element is not on this page any more">gone</b>':s.hiddenNow(E)?'<b class="dt-hist-orphan is-hidden" title="Inside a menu or a popup that is closed now \u2014 open it and the pin moves onto it">hidden</b>':""}${N?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
172
+ <span class="dt-hist-text">${p.author==="claude"?`<b>${g(v(p.agent,p.by))}:</b> `:lt.length&&!x(p,E)?`<b class="dt-hist-by">${g(p.byName||"Someone")}:</b> `:""}${g(Ri(p.text))}</span>
156
173
  </span>
157
174
  </button>
158
- <span class="dt-note-tools dt-hist-tools">${s.assign(E)}${k(E)}<i class="dt-note-sep"></i
159
- ><button data-rm="${E.id}" title="Delete this comment">${Pe}</button></span>
160
- </div>`},ct=m.find(E=>E.id===i),F=m.map(E=>{let at=d.filter(gt=>p(gt)===E.id&&pt(gt)!=="done");return{band:E,open:at.filter(gt=>pt(gt)==="open").length,total:at.length}}).filter(E=>E.total&&E.band.id!==i),Q=F.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${F.map(({band:E,open:at,total:gt})=>`<button data-bp="${E.id}" data-state="${at?"open":"claude"}"
161
- title="${E.label}: ${at} open \xB7 ${gt-at} to check"
162
- ><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${E.icon}</svg><i>${gt}</i></button>`).join("")}</div>`:"",it=["open","claude","done","archived"],ht={...Ia,archived:"Archived"},nt=it.filter(E=>X[E].length&&(E==="done"?N:E==="archived"?w:!0)),Jt=E=>`<div class="dt-hist-row is-draft">
175
+ <span class="dt-note-tools dt-hist-tools">${s.assign(E)}${S(E)}<i class="dt-note-sep"></i
176
+ ><button data-rm="${E.id}" title="Delete this comment">${Ze}</button></span>
177
+ </div>`},et=h.find(E=>E.id===i),L=h.map(E=>{let lt=d.filter(vt=>m(vt)===E.id&&ht(vt)!=="done");return{band:E,open:lt.filter(vt=>ht(vt)==="open").length,total:lt.length}}).filter(E=>E.total&&E.band.id!==i),st=L.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${L.map(({band:E,open:lt,total:vt})=>`<button data-bp="${E.id}" data-state="${lt?"open":"claude"}"
178
+ title="${E.label}: ${lt} open \xB7 ${vt-lt} to check"
179
+ ><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${E.icon}</svg><i>${vt}</i></button>`).join("")}</div>`:"",ut=["open","claude","done","archived"],mt={...ji,archived:"Archived"},at=ut.filter(E=>D[E].length&&(E==="done"?H:E==="archived"?b:!0)),se=E=>`<div class="dt-hist-row is-draft">
163
180
  <button class="dt-hist-go" data-draft-go="${E.i}">
164
- <span class="dt-hist-n">${un}</span>
181
+ <span class="dt-hist-n">${Fn}</span>
165
182
  <span class="dt-hist-body">
166
- <span class="dt-hist-id">${h(E.el)}${E.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
167
- <span class="dt-hist-text">${E.text?h(E.text):`${E.shots} screenshot${E.shots===1?"":"s"}`}</span>
183
+ <span class="dt-hist-id">${g(E.el)}${E.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
184
+ <span class="dt-hist-text">${E.text?g(E.text):`${E.shots} screenshot${E.shots===1?"":"s"}`}</span>
168
185
  </span>
169
186
  </button>
170
- <span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${E.i}" title="Discard this draft">${Pe}</button></span>
171
- </div>`,yt=H.filter(E=>pt(E)!=="done"),Mt=(E,at,gt,It,f)=>`<button type="button" role="menuitemradio" aria-checked="${It}" ${E}="${at}"><i>${It?Wt:""}</i><span>${gt}</span>${f==null?"":`<em>${f}</em>`}</button>`,mt=()=>`<div class="dt-hist-find">
172
- <label class="dt-hist-search">${Ga}<input type="search" data-hist-q placeholder="Search comments" aria-label="Search comments" value="${h(x.q)}" spellcheck="false">${x.q?`<button type="button" data-hist-clear aria-label="Clear search">${ye}</button>`:""}</label>
173
- <button type="button" class="dt-hist-filter${x.view!=="all"||x.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${x.menu}" data-tip="Filter">${Kr}</button>
174
- ${x.menu?`<div class="dt-hist-menu" role="menu">${Mt("data-hist-view","me","For me",x.view==="me",yt.filter(s.forMe).length)}${Mt("data-hist-view","agent","Agent",x.view==="agent",yt.filter(s.forAgent).length)}${Mt("data-hist-view","all","All",x.view==="all",yt.length)}<hr>${Mt("data-hist-sort","new","Newest",x.sort==="new")}${Mt("data-hist-sort","unread","Unread first",x.sort==="unread")}</div>`:""}
187
+ <span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${E.i}" title="Discard this draft">${Ze}</button></span>
188
+ </div>`,Ct=B.filter(E=>ht(E)!=="done"),Lt=(E,lt,vt,It,Ut)=>`<button type="button" role="menuitemradio" aria-checked="${It}" ${E}="${lt}"><i>${It?qt:""}</i><span>${vt}</span>${Ut==null?"":`<em>${Ut}</em>`}</button>`,Vt=()=>`<div class="dt-hist-find">
189
+ <label class="dt-hist-search">${er}<input type="search" data-hist-q placeholder="Search comments" aria-label="Search comments" value="${g(y.q)}" spellcheck="false">${y.q?`<button type="button" data-hist-clear aria-label="Clear search">${qe}</button>`:""}</label>
190
+ <button type="button" class="dt-tip-r dt-hist-filter${y.view!=="all"||y.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${y.menu}" data-tip="Filter">${hd}</button>
191
+ ${y.menu?`<div class="dt-hist-menu" role="menu">${Lt("data-hist-view","me","For me",y.view==="me",Ct.filter(s.forMe).length)}${Lt("data-hist-view","agent","Agent",y.view==="agent",Ct.filter(s.forAgent).length)}${Lt("data-hist-view","all","All",y.view==="all",Ct.length)}<hr>${Lt("data-hist-sort","new","Newest",y.sort==="new")}${Lt("data-hist-sort","unread","Unread first",y.sort==="unread")}</div>`:""}
175
192
  </div>`;return`<div class="dt-hist-head">
176
- <span class="dt-hist-here" title="${ct?.label??i}"
177
- ><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true">${ct?.icon??""}</svg></span>
178
- <span class="dt-hist-title">Comments</span>
179
- ${Q}
180
- ${s.checks?`<button class="dt-review-btn" data-review aria-label="Check all ${s.checks} ${s.checks===1?"fix":"fixes"}" data-tip="${s.checks} ${s.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${Wt}${s.checks}</button>`:""}
181
- <button class="dt-hist-refresh" data-refresh aria-label="Reload comments from the file">
193
+ <span class="dt-hist-here" title="${et?.label??i}"
194
+ ><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true">${et?.icon??""}</svg></span>
195
+ <span class="dt-hist-title">Threads</span>
196
+ ${st}
197
+ ${s.checks?`<button class="dt-review-btn" data-review aria-label="Check all ${s.checks} ${s.checks===1?"fix":"fixes"}" data-tip="${s.checks} ${s.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${qt}${s.checks}</button>`:""}
198
+ <button class="dt-hist-refresh" data-refresh aria-label="Load the latest comments">
182
199
  <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>
183
200
  </button>
184
201
  <button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel">
185
202
  <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>
186
203
  </button>
187
- </div>`+mt()+(nt.length||q.length?`<div class="dt-hist-list">${q.length?`<p class="dt-hist-group">Drafts<em>${q.length}</em></p>${q.map(Jt).join("")}`:""}${nt.map(E=>`<p class="dt-hist-group">${ht[E]}<em>${X[E].length}</em>${E==="done"?`<button type="button" class="dt-hist-archive-all" data-archive-all="${X.done.map(at=>at.id).join(",")}" data-tip="Archive every resolved thread here">${Ya}Archive all</button>`:""}</p>`+X[E].map(W).join("")).join("")}</div>`:x.q.trim()?`<div class="dt-hist-empty">${Ga}<p>No comments match \xAB${h(x.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:x.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">${X.done.length||X.archived.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">
188
- <button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${N}"
204
+ </div>`+Vt()+(at.length||k.length?`<div class="dt-hist-list">${k.length?`<p class="dt-hist-group">Drafts<em>${k.length}</em></p>${k.map(se).join("")}`:""}${at.map(E=>`<p class="dt-hist-group">${mt[E]}<em>${D[E].length}</em>${E==="done"&&s.archives?`<button type="button" class="dt-tip-r dt-hist-archive-all" data-archive-all="${D.done.map(lt=>lt.id).join(",")}" data-tip="Archive every resolved thread here">${nr}Archive all</button>`:""}</p>`+D[E].map(G).join("")).join("")}</div>`:y.q.trim()?`<div class="dt-hist-empty">${er}<p>No comments match \xAB${g(y.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:y.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">${D.done.length||D.archived.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">
205
+ <button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${H}"
189
206
  ><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
190
207
  ><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
191
- <button class="dt-hist-resolved" data-archived role="switch" aria-checked="${w}"
192
- >${Ya}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
193
- </div>`}function Ja(s){let{inFrame:i,everything:d,route:m,open:p,settle:$,keepIn:k,toast:N,waits:w,approve:q}=s,x=F=>{let Q=d().find(it=>it.id===F);return!!Q&&w(Q)},H="nm-review",L=()=>{try{return JSON.parse(sessionStorage.getItem(H)||"null")}catch{return null}},b=F=>{try{F?sessionStorage.setItem(H,JSON.stringify(F)):sessionStorage.removeItem(H)}catch{}},T=document.createElement("div");T.className="dt-review",T.setAttribute("role","region"),T.setAttribute("aria-label","Checking fixes"),T.hidden=!0,k(T),i||document.body.append(T);let _=()=>d().filter(w),X=()=>{let F=_().sort((Q,it)=>+(it.route===m())-+(Q.route===m())||String(Q.route).localeCompare(String(it.route))||Q.id-it.id).map(Q=>Q.id);F.length&&(b({ids:F,i:0}),W())},W=()=>{let F=L();if(!F||i){T.hidden=!0;return}for(;F.i<F.ids.length&&!x(F.ids[F.i]);)F.i++;if(F.i>=F.ids.length){b(null),T.hidden=!0,N("Every fix is checked.");return}b(F);let Q=d().find(ht=>ht.id===F.ids[F.i]);if(Q.route&&Q.route!==m()){location.assign(Q.route+location.search);return}p(Q);let it=F.ids.slice(0,F.i).some(x);T.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
194
- <span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${it?"":" disabled"}>${Ba}</button>
195
- <span class="dt-review-n">${F.i+1} of ${F.ids.length}</span>
196
- <button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Na}</button></span>
197
- <button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${Wt}</button>
198
- <button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${Re}</button>
199
- <button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${ye}</button>`,T.hidden=!1};T.addEventListener("click",async F=>{let Q=F.target.closest("[data-r]"),it=L();if(!Q||!it)return;if(Q.dataset.r==="stop"){b(null),T.hidden=!0;return}if(Q.dataset.r==="prev"){ct();return}let ht=it.ids[it.i];b({...it,i:it.i+1});let nt=d().find(yt=>yt.id===ht),Jt=Q.dataset.r==="ok"&&nt?q(nt):Q.dataset.r==="no"?$(ht,!1):null;W(),await Jt});let ct=()=>{let F=L();if(F){for(let Q=F.i-1;Q>=0;Q--)if(x(F.ids[Q])){b({...F,i:Q}),W();return}}};return document.addEventListener("keydown",F=>{T.hidden||F.metaKey||F.ctrlKey||F.altKey||F.key!=="ArrowLeft"&&F.key!=="ArrowRight"||F.target.closest?.("input, textarea, select, [contenteditable]")||(F.preventDefault(),F.key==="ArrowLeft"?ct():T.querySelector('[data-r="skip"]')?.click())}),{start:X,toCheck:_,resume:()=>{L()&&W()}}}function Za(s,i){let d=null,m=null,p=document.querySelector(".dt-turbo"),$="/notemend:turbo",k=()=>{let N=!!d&&Date.now()-Date.parse(d.at)<18e4,w=N?d.mode==="push"?"push":m?.paused?"paused":"on":"none",q=N?Ue(d.agent):"",x=w==="none"?`Turbo is off. Run ${$} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:w==="push"?`Push mode: ${q} takes comments when you press Push to Claude. For live, run ${$} instead`:w==="on"?`Turbo on: ${q} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${q} is listening but waits \u2014 click to resume`;p.dataset.state=w,p.dataset.tip=x,p.setAttribute("aria-label",x),p.setAttribute("aria-checked",String(w==="on")),s&&(p.hidden=!0)};return setInterval(k,3e4),p.addEventListener("click",async()=>{let N=p.dataset.state;if(N==="none"||N==="push"){await navigator.clipboard?.writeText($).catch(()=>{}),i(`Copied ${$} \u2014 paste it in Claude Code`);return}let w=N==="on"?"off":"on";m={paused:w==="off"},k();try{let q=await At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:w})});if(!q.ok)throw new Error(String(q.status));i(w==="off"?"Turbo paused":"Turbo on")}catch{m={paused:w==="on"},k(),i("Could not switch turbo \u2014 try again")}}),N=>{d=N.listening??null,m=N.turbo??null,k()}}function Qa(s,i){let d=s.breakpoints,m=s.categories,p=(d.find(t=>!Number.isFinite(t.max))??d[0]).id,$=t=>d.find(e=>t>=e.min&&t<=e.max)?.id??p,k=t=>t.breakpoint||p,N=t=>s.devices.find(e=>e.id===t),w=On,q=(t,e)=>{w||et.setItem(t,e)},x=t=>At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),H=t=>t.replace(/\/+$/,"")||"/",L=H(location.pathname);for(let 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");let b=document.querySelector(".dt-grid-btn"),T=document.querySelector(".dt-grid-overlay"),_="dt-grid",X=t=>{T.hidden=!t,b.setAttribute("aria-pressed",String(t)),q(_,t?"1":"0"),Gt({grid:t})};b.addEventListener("click",()=>X(T.hidden===!0));let W=document.querySelector(".dt-pages-name"),ct=()=>{let t=null;for(let r of document.querySelectorAll(".dt-pages a"))H(new URL(r.href).pathname)===L?(r.setAttribute("aria-current","page"),t=r):r.removeAttribute("aria-current");let e=document.title.split("\u2014").pop()?.trim(),o=t?.querySelector(".dt-menu-label")?.textContent?.trim()||e||W.textContent||"",a=o.trim().split(/\s+/);W.textContent=a.length>3?`${a.slice(0,3).join(" ")}\u2026`:o,W.title=a.length>3?o:""};ct();let F=[...document.querySelectorAll(".devtools details")],Q=!1,it=()=>{let t=F.filter(e=>e.open);for(let e of t)e.open=!1;return t};document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=it();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{Q=F.some(e=>e.open&&!e.contains(t.target))&&it().length>0},!0),addEventListener("blur",it);let ht=document.querySelector(".dt-pad-overlay"),nt="dt-inspect",Jt=[".devtools",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...s.ignore].join(", "),yt=[".devtools",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-review",".dt-field-menu",".dt-toast",".dt-drag-box",'[aria-modal="true"]',...s.ignore].join(", "),Mt={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")},mt="",E=0,{spacer:at,drawPads:gt,drawSize:It,drawType:f,drawColor:c,drawBorder:y}=ja(ht),A=t=>{E||(E=requestAnimationFrame(()=>{E=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(Jt)){ht.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),mt==="sizes"?It(e):mt==="type"?f(e):mt==="color"?c(e):mt==="border"?y(e):gt(t.altKey?e:at(e))}))},B=t=>{mt=t;for(let[e,n]of Object.entries(Mt))n.setAttribute("aria-pressed",String(e===t));q(nt,t),Gt({inspect:t}),ht.hidden=!t,ht.innerHTML="",t?document.addEventListener("mousemove",A):document.removeEventListener("mousemove",A)};for(let[t,e]of Object.entries(Mt))e.addEventListener("click",()=>{t!==mt&&ge(!1),B(mt===t?"":t)});let J=document.querySelector(".dt-notes-btn"),O=[...document.querySelectorAll(".dt-bp")],P=document.querySelector(".dt-history-btn"),j=document.querySelector(".dt-history"),V=document.querySelector(".dt-studio-btn"),bt=document.querySelector(".dt-devices"),ft=document.querySelector(".dt-notes-hi"),Ot=ft.querySelector(".dt-hi-box"),Pt=ft.querySelector(".dt-hi-tag"),Dt=document.querySelector(".dt-frame"),Lt=document.createElement("div");Lt.className="dt-spot",Lt.hidden=!0,Lt.setAttribute("aria-hidden","true"),document.body.append(Lt);let Ge=t=>{if(!t||!kt){Lt.hidden=!0;return}let e=t.getBoundingClientRect(),n=6;Lt.style.setProperty("--spot-x",`${e.left-n}px`),Lt.style.setProperty("--spot-y",`${e.top-n}px`),Lt.style.setProperty("--spot-w",`${e.width+n*2}px`),Lt.style.setProperty("--spot-h",`${e.height+n*2}px`),Lt.hidden&&(ft.hidden=!0),Lt.hidden=!1},Fe=Dt.querySelector("iframe"),he=document.querySelector(".dt-notes-count"),U=document.querySelector(".dt-notes-overlay"),we=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame",$e=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,n=>n.stopPropagation())};document.querySelectorAll(we).forEach($e);let qt="dt-notes",Y=[],kt=!1,st=null,M=null,xe=0,Ft="",wt=[],lt=null,St=[],Ee=(t=M)=>!!(t&&(t.text?.trim()||t.images?.length)),v=()=>{M&&Ee()&&St.push(M),M=null},C=null,I=null,ot=()=>`dt-draft:${L}${w?":canvas":""}`,dt=ot(),xt=0,Zt=()=>{if(!M&&!St.length&&!Ft){et.removeItem(dt);return}let t={draft:M,parked:St,reply:Ft?{for:C,text:Ft}:null};try{localStorage.setItem(dt,JSON.stringify(t))}catch{let e=n=>({...n,images:void 0});try{localStorage.setItem(dt,JSON.stringify({...t,draft:M&&e(M),parked:St.map(e)}))}catch{}}},Rt=()=>{clearTimeout(xt),xt=setTimeout(Zt,200)};addEventListener("pagehide",()=>{clearTimeout(xt),Zt()});let Tt=et.getItem("dt-resolved")!=="0",te=et.getItem("dt-archived")==="1",ee=t=>Ha(t,s.autoArchive),ni=t=>pt(t)!=="done"||(ee(t)?te:Tt),jt={q:"",menu:!1,view:["me","agent"].includes(et.getItem("dt-view")??"")?et.getItem("dt-view"):"all",sort:et.getItem("dt-sort")==="unread"?"unread":"new"},si=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],oi=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],ai=()=>{let t=navigator.userAgent,e=r=>r.find(([l])=>l.test(t)),n=e(si),o=e(oi),a=n?n[0].exec(t)?.[1]:null;return[n?`${n[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},Wn=()=>$(innerWidth),Me=()=>I??Wn(),_s=()=>{let t=Me();for(let e of O)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:Ws,poolOf:zs,contextOf:Vs,resolveEl:ii,anchorOf:ri}=_a(),zn=new WeakMap,Ks=()=>{zn=new WeakMap},ne=t=>{let e=zn.get(t);return(e===void 0||e&&!e.isConnected)&&(e=ii(t),zn.set(t,e)),e},mn=new Map,zt=t=>{mn.size||requestAnimationFrame(()=>mn.clear());let e=mn.get(t);return e===void 0&&(e=ri(t,ne(t)),mn.set(t,e)),e},Us=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(n=>n.playState==="running"))return!0;return!1},gn=[],Vn=t=>{for(let e of gn)e.play();gn=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let n of e.getAnimations())n.playState==="running"&&(n.pause(),gn.push(n))},Kn=()=>{if(M)return ne(M);let t=st!=null?Y.find(n=>n.id===st):null;if(!t)return null;let e=zt(t);return e&&!e.off&&!e.hidden?ne(t):null},Un="claude",li=()=>(s.team??[]).filter(t=>t.email!==s.me?.email),ke=()=>[...s.me?(s.team??[]).filter(t=>t.email===s.me.email):[],...li()],Gs='<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>',Ys=(t,e,n=!1)=>{let o=$t(t)?"agent":t?"person":"nobody",a=Je(o==="person"?t:Gn()),r=[["person",a?bn(a.avatar_url,a.name||a.email):wn,o==="person"?`${Xe(t)==="you"?"You":Xe(t)} \u2014 pick someone else`:a?`Give it to ${a.email===s.me?.email?"me":a.name||a.email}`:"A person"],["nobody",Gs,"Anyone \u2014 nobody has taken it yet"],["agent",Xt(12),n?"Waits for the studio to approve it":o==="agent"?"Claude does it":"Give it to Claude"]],l=e!=null?Y.find(S=>S.id===e):void 0,g=o==="agent"&&l?Jn[Qt(l)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${g?` style="--step-c:${g}"`:""}>${r.filter(([S])=>S!=="person"||o==="person"||ke().length).map(([S,R,u])=>S===o?`<span class="dt-hand-stop dt-hand-stop--${S} is-on" role="radio" aria-checked="true" data-tip="${h(u)}" aria-label="${h(u)}">${S==="person"?mi(t,e):R}</span>`:`<button type="button" class="dt-hand-stop dt-hand-stop--${S}" role="radio" aria-checked="false" data-act="hand" data-v="${S}"${e?` data-id="${e}"`:""} data-tip="${h(u)}" aria-label="${h(u)}"${S==="agent"&&n?" disabled":""}>${R}</button>`).join("")}</span>`},Gn=()=>{let t=ui();return t&&!$t(t)&&ke().some(e=>e.email===t)?t:ke()[0]?.email??""},di=()=>{let t=U.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},Xs="cubic-bezier(0.32, 0.72, 0, 1)",Js=t=>{let e=U.querySelector(".dt-hand .dt-hand-stop.is-on");if(!t||!e||matchMedia("(prefers-reduced-motion: reduce)").matches)return;let n=e.getBoundingClientRect(),o=document.createElement("span");o.className="dt-hand dt-hand-ghost",o.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),o.append(t.ghost),U.append(o),o.animate([{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(()=>o.remove(),()=>o.remove()),ds=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:Xs});for(let 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:Xs});for(let a of e.parentElement?.querySelectorAll("button.dt-hand-stop")??[])a.animate([{opacity:0},{opacity:1}],{duration:300,delay:140,easing:"ease-out",fill:"backwards"})},ci=(t,e)=>{let n=ds>performance.now()?void 0:di(),o=e==="agent"?Un:e==="person"?Gn():e==="me"?s.me?.email??"":"";if(!t){if(!M)return;M.assignee=o,M.stage=$t(o)?"approved":!M.stage||M.stage==="approved"?"new":M.stage,e==="person"&&et.setItem("nm-for",o),Xn(o),Rt(),G(),Js(n);return}Yn(t,o),Js(n)},Yn=(t,e)=>{let n=Y.find(r=>r.id===t);if(n&&Ne(n)&&!$t(e)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=n?Ht(n):"new",a=$t(e)?"approved":o==="approved"?"new":o;Vt(r=>r.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>x({id:t,assignee:e||null,stage:a}),$t(e)?"Approving it for the agent":"Reassigning")},ui=()=>et.getItem("nm-for")??"",Xn=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e!==null&&(e===""||e===Un||ke().some(n=>n.email===e))?e:null}catch{return null}},Ye=t=>$t(t)?"#d97757":t?"#0d99ff":"#717171",Xe=t=>t===s.me?.email?"you":s.team?.find(e=>e.email===t)?.name||t.split("@")[0],Je=t=>t?s.team?.find(e=>e.email===t):void 0,Zs=t=>{let e=Nt(t??"").split(/\s+/).filter(Boolean);return h(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},bn=(t,e,n="dt-face")=>t?`<img class="${n}" src="${h(t)}" alt="">`:`<b class="${n}" aria-hidden="true">${Zs(e)}</b>`,Qs=t=>{let e=Je(t.by);return e||t.byName?bn(e?.avatar_url,e?.name||t.byName||t.by):""},to=t=>`var(--dt-avatar-${[...t].reduce((e,n)=>e*31+n.charCodeAt(0)>>>0,7)%8+1})`,Jn={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},je=(()=>{try{return JSON.parse(et.getItem("dt-seen")||"{}")}catch{return{}}})(),eo=()=>q("dt-seen",JSON.stringify(je)),no=t=>{let e=Be(t);if(!(t.id in je))return je[t.id]=e.length,eo(),!1;let n=e[e.length-1];return e.length>je[t.id]&&!(n?.author==="you"&&(!n.by||n.by===s.me?.email))},pi=t=>{let e=Be(t).length;je[t.id]!==e&&(je[t.id]=e,eo())},Zn=t=>{let e=Je(t);return e?` data-face="${h(e.avatar_url??"")}" data-initial="${Zs(e.name||e.email)}"`:""},so=t=>s.client||me()||pt(t)==="done"?"":`<span class="dt-hist-hand">${Ys(t.assignee??"",t.id)}</span>`,Le=(t,e)=>Ue(t),oo=t=>{let e=Je(t);return e?bn(e.avatar_url,e.name||e.email):""},hi=t=>{let e=Je(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${h(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${Xt(12)}</b>`},mi=(t,e)=>{let n=(a,r)=>`<option value="${h(a)}" data-c="${Ye(a)}"${Zn(a||null)}${t===a?" selected":""}>${h(r)}</option>`,o=(s.team??[]).filter(a=>a.email!==s.me?.email);return`<label class="dt-field dt-field--knob"><span class="dt-field-box dt-field-box--face" style="--cat:${Ye(t)}">${oo(t||null)||wn}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
208
+ <button class="dt-hist-resolved" data-archived role="switch" aria-checked="${b}"
209
+ >${nr}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
210
+ </div>`}function or(s){let{inFrame:i,everything:d,route:h,open:m,settle:v,keepIn:S,toast:H,waits:b,approve:k}=s,y=L=>{let st=d().find(ut=>ut.id===L);return!!st&&b(st)},B="nm-review",Z=()=>{try{return JSON.parse(sessionStorage.getItem(B)||"null")}catch{return null}},F=L=>{try{L?sessionStorage.setItem(B,JSON.stringify(L)):sessionStorage.removeItem(B)}catch{}},w=document.createElement("div");w.className="dt-review",w.setAttribute("role","region"),w.setAttribute("aria-label","Checking fixes"),w.hidden=!0,S(w),i||document.body.append(w);let A=()=>d().filter(b),D=()=>{let L=A().sort((st,ut)=>+(ut.route===h())-+(st.route===h())||String(st.route).localeCompare(String(ut.route))||st.id-ut.id).map(st=>st.id);L.length&&(F({ids:L,i:0}),G())},G=()=>{let L=Z();if(!L||i){w.hidden=!0;return}for(;L.i<L.ids.length&&!y(L.ids[L.i]);)L.i++;if(L.i>=L.ids.length){F(null),w.hidden=!0,H("Every fix is checked.");return}F(L);let st=d().find(mt=>mt.id===L.ids[L.i]);if(st.route&&st.route!==h()){location.assign(st.route+location.search);return}m(st);let ut=L.ids.slice(0,L.i).some(y);w.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
211
+ <span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${ut?"":" disabled"}>${Oi}</button>
212
+ <span class="dt-review-n">${L.i+1} of ${L.ids.length}</span>
213
+ <button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Di}</button></span>
214
+ <button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${qt}</button>
215
+ <button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${Ae}</button>
216
+ <button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${qe}</button>`,w.hidden=!1};w.addEventListener("click",async L=>{let st=L.target.closest("[data-r]"),ut=Z();if(!st||!ut)return;if(st.dataset.r==="stop"){F(null),w.hidden=!0;return}if(st.dataset.r==="prev"){et();return}let mt=ut.ids[ut.i];F({...ut,i:ut.i+1});let at=d().find(Ct=>Ct.id===mt),se=st.dataset.r==="ok"&&at?k(at):st.dataset.r==="no"?v(mt,!1):null;G(),await se});let et=()=>{let L=Z();if(L){for(let st=L.i-1;st>=0;st--)if(y(L.ids[st])){F({...L,i:st}),G();return}}};return document.addEventListener("keydown",L=>{w.hidden||L.metaKey||L.ctrlKey||L.altKey||L.key!=="ArrowLeft"&&L.key!=="ArrowRight"||L.target.closest?.("input, textarea, select, [contenteditable]")||(L.preventDefault(),L.key==="ArrowLeft"?et():w.querySelector('[data-r="skip"]')?.click())}),{start:D,toCheck:A,resume:()=>{Z()&&G()}}}function ar(s,i){let d=null,h=null,m=document.querySelector(".dt-turbo"),v="/notemend:turbo",S=()=>{let H=!!d&&Date.now()-Date.parse(d.at)<18e4,b=H?d.mode==="push"?"push":h?.paused?"paused":"on":"none",k=H?fn(d.agent):"",y=b==="none"?`Turbo is off. Run ${v} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:b==="push"?`Push mode: ${k} takes comments when you press Push to Claude. For live, run ${v} instead`:b==="on"?`Turbo on: ${k} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${k} is listening but waits \u2014 click to resume`;m.dataset.state=b,m.dataset.tip=y,m.setAttribute("aria-label",y),m.setAttribute("aria-checked",String(b==="on")),s&&(m.hidden=!0)};return setInterval(S,3e4),m.addEventListener("click",async()=>{let H=m.dataset.state;if(H==="none"||H==="push"){await navigator.clipboard?.writeText(v).catch(()=>{}),i(`Copied ${v} \u2014 paste it in Claude Code`);return}let b=H==="on"?"off":"on";h={paused:b==="off"},S();try{let k=await At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:b})});if(!k.ok)throw new Error(String(k.status));i(b==="off"?"Turbo paused":"Turbo on")}catch{h={paused:b==="on"},S(),i("Could not switch turbo \u2014 try again")}}),H=>{d=H.listening??null,h=H.turbo??null,S()}}function ir(s,i){let d=s.breakpoints,h=s.categories,m=(d.find(t=>!Number.isFinite(t.max))??d[0]).id,v=t=>d.find(e=>t>=e.min&&t<=e.max)?.id??m,S=t=>t.breakpoint||m,H=t=>s.devices.find(e=>e.id===t),b=ys,k=(t,e)=>{b||ot.setItem(t,e)},y=t=>At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),B=t=>t.replace(/\/+$/,"")||"/",Z=B(location.pathname);for(let 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");let F=document.querySelector(".dt-grid-btn"),w=document.querySelector(".dt-grid-overlay"),A="dt-grid",D=()=>{let t=w.querySelector(".dt-overlay-grid");if(w.classList.remove("is-auto"),getComputedStyle(t).display==="grid")return;let e=0,n=0;for(let o of[...document.body.querySelectorAll("*")].slice(0,600)){if(o.closest(Ce))continue;let a=getComputedStyle(o);if(a.maxWidth==="none"||a.marginLeft!==a.marginRight||parseFloat(a.marginLeft)<=0)continue;let r=o.getBoundingClientRect();r.width>e&&(e=r.width,n=r.left)}e||(n=24,e=innerWidth-48),w.classList.add("is-auto"),w.style.setProperty("--grid-x",`${n}px`),w.style.setProperty("--grid-w",`${e}px`),w.style.setProperty("--grid-gap",innerWidth<768?"16px":"24px")},G=t=>{w.hidden=!t,t&&D(),F.setAttribute("aria-pressed",String(t)),k(A,t?"1":"0"),ee({grid:t})};F.addEventListener("click",()=>G(w.hidden===!0)),addEventListener("resize",()=>{w.hidden||D()});let et=document.querySelector(".dt-pages-name"),L=()=>{let t=null;for(let r of document.querySelectorAll(".dt-pages a"))B(new URL(r.href).pathname)===Z?(r.setAttribute("aria-current","page"),t=r):r.removeAttribute("aria-current");let e=document.title.split("\u2014").pop()?.trim(),o=t?.querySelector(".dt-menu-label")?.textContent?.trim()||e||et.textContent||"",a=o.trim().split(/\s+/);et.textContent=a.length>3?`${a.slice(0,3).join(" ")}\u2026`:o,et.title=a.length>3?o:""};L();let st=[...document.querySelectorAll(".devtools details")],ut=!1,mt=()=>{let t=st.filter(e=>e.open);for(let e of t)e.open=!1;return t};document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=mt();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{ut=st.some(e=>e.open&&!e.contains(t.target))&&mt().length>0},!0),addEventListener("blur",mt);let at=document.querySelector(".dt-pad-overlay"),se="dt-inspect",Ct=[".devtools",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...s.ignore].join(", "),Lt=[".devtools",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-drag-box",'[aria-modal="true"]',...s.ignore].join(", "),Vt={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")},E="",lt=0,{spacer:vt,drawPads:It,drawSize:Ut,drawType:$,drawColor:p,drawBorder:x}=Ui(at),N=t=>{lt||(lt=requestAnimationFrame(()=>{lt=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(Ct)){at.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),E==="sizes"?Ut(e):E==="type"?$(e):E==="color"?p(e):E==="border"?x(e):It(t.altKey?e:vt(e))}))},R=t=>{E=t;for(let[e,n]of Object.entries(Vt))n.setAttribute("aria-pressed",String(e===t));k(se,t),ee({inspect:t}),at.hidden=!t,at.innerHTML="",t?document.addEventListener("mousemove",N):document.removeEventListener("mousemove",N)};for(let[t,e]of Object.entries(Vt))e.addEventListener("click",()=>{t!==E&&ye(!1),R(E===t?"":t)});let W=document.querySelector(".dt-notes-btn"),z=[...document.querySelectorAll(".dt-bp")],Y=document.querySelector(".dt-history-btn"),q=document.querySelector(".dt-history"),nt=document.querySelector(".dt-studio-btn"),St=document.querySelector(".dt-devices"),bt=document.querySelector(".dt-notes-hi"),jt=bt.querySelector(".dt-hi-box"),oe=bt.querySelector(".dt-hi-tag"),Jt=document.querySelector(".dt-frame"),xt=document.createElement("div");xt.className="dt-spot",xt.hidden=!0,xt.setAttribute("aria-hidden","true"),document.body.append(xt);let Fe=t=>{if(!t||!Tt){xt.hidden=!0;return}let e=t.getBoundingClientRect(),n=6;xt.style.setProperty("--spot-x",`${e.left-n}px`),xt.style.setProperty("--spot-y",`${e.top-n}px`),xt.style.setProperty("--spot-w",`${e.width+n*2}px`),xt.style.setProperty("--spot-h",`${e.height+n*2}px`),xt.hidden&&(bt.hidden=!0),xt.hidden=!1},Ot=Jt.querySelector("iframe"),we=document.querySelector(".dt-notes-count"),J=document.querySelector(".dt-notes-overlay"),Ce=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Wt=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,n=>n.stopPropagation())};document.querySelectorAll(Ce).forEach(Wt);let je="dt-notes",V=[],Tt=!1,tt=null,T=null,yn=0,Ht="",We=null,Bt=[],gt=null,Nt=[],M=10,C=(t=T)=>!!(t&&((t.text?.trim().length??0)>=M||t.images?.length)),O=()=>{T&&C()&&Nt.push(T),T=null},it=0,ft=()=>{if(!C()||performance.now()-it<4e3)return!0;it=performance.now();let t=J.querySelector(".dt-note[data-draft]");return t&&!matchMedia("(prefers-reduced-motion: reduce)").matches&&t.animate([0,-6,6,-4,4,0].map(e=>({transform:`translateX(${e}px)`})),{duration:320,easing:"ease-out",composite:"add"}),t?.querySelector(".dt-note-input")?.focus(),Mt("Not sent \u2014 close again to keep it as a draft",2400),!1},Et=null,ae=null,$e=()=>`dt-draft:${s.me?.email??""}:${Z}${b?":canvas":""}`,ue=$e(),sn=0,vn=()=>{if(!T&&!Nt.length&&!Ht){ot.removeItem(ue);return}let t={draft:T,parked:Nt,reply:Ht?{for:Et,text:Ht}:null};try{localStorage.setItem(ue,JSON.stringify(t))}catch{let e=n=>({...n,images:void 0});try{localStorage.setItem(ue,JSON.stringify({...t,draft:T&&e(T),parked:Nt.map(e)}))}catch{}}},wn=()=>{clearTimeout(sn),sn=setTimeout(vn,200)};addEventListener("pagehide",()=>{clearTimeout(sn),vn()});let He=ot.getItem("dt-space")==="clients"?"clients":"studio",Be=()=>!!s.me&&!s.client,on=t=>!Be()||He==="clients"===$t(t),No=["all","nobody","mine","others","claude","wrote","check"],pe=No.find(t=>t===ot.getItem("dt-pinf"))??"all",Ss=()=>{},_n=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,ie=ot.getItem("dt-resolved")!=="0",Ne=ot.getItem("dt-archived")==="1",re=t=>Ii(t,s.autoArchive),Ro=t=>ht(t)!=="done"||(re(t)?Ne:ie),Kt={q:"",menu:!1,view:["me","agent"].includes(ot.getItem("dt-view")??"")?ot.getItem("dt-view"):"all",sort:ot.getItem("dt-sort")==="unread"?"unread":"new"},cr=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],ur=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],pr=()=>{let t=navigator.userAgent,e=r=>r.find(([l])=>l.test(t)),n=e(cr),o=e(ur),a=n?n[0].exec(t)?.[1]:null;return[n?`${n[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},Ts=()=>v(innerWidth),xe=()=>ae??Ts(),Po=()=>{let t=xe();for(let e of z)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:Io,poolOf:Oo,contextOf:Do,resolveEl:hr,anchorOf:mr}=Yi(),As=new WeakMap,qo=()=>{As=new WeakMap},he=t=>{let e=As.get(t);return(e===void 0||e&&!e.isConnected)&&(e=hr(t),As.set(t,e)),e},zn=new Map,Zt=t=>{zn.size||requestAnimationFrame(()=>zn.clear());let e=zn.get(t);return e===void 0&&(e=mr(t,he(t)),zn.set(t,e)),e},Fo=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(n=>n.playState==="running"))return!0;return!1},Vn=[],Cs=t=>{for(let e of Vn)e.play();Vn=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let n of e.getAnimations())n.playState==="running"&&(n.pause(),Vn.push(n))},Hs=()=>{if(T)return he(T);let t=tt!=null?V.find(n=>n.id===tt):null;if(!t)return null;let e=Zt(t);return e&&!e.off&&!e.hidden?he(t):null},Bs="claude",gr=()=>(s.team??[]).filter(t=>t.email!==s.me?.email),_e=()=>[...s.me?(s.team??[]).filter(t=>t.email===s.me.email):[],...gr()],jo='<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>',Wo=(t,e,n=!1)=>{let o=kt(t)?"agent":t?"person":"nobody",a=Ee(o==="person"?t:Ns()),r=[["person",a?an(a.avatar_url,a.name||a.email):Fs,o==="person"?`${ze(t)==="you"?"You":ze(t)} \u2014 pick someone else`:a?`Give it to ${a.email===s.me?.email?"me":a.name||a.email}`:"A person"],["nobody",jo,"Anyone \u2014 nobody has taken it yet"],["agent",zt(12),n?"Waits for the studio to approve it":o==="agent"?"Claude does it":"Give it to Claude"]],l=e!=null?V.find(u=>u.id===e):void 0,f=o==="agent"&&l?Os[ne(l)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${f?` style="--step-c:${f}"`:""}>${r.filter(([u])=>u!=="person"||o==="person"||_e().length).map(([u,P,j])=>u===o?`<span class="dt-hand-stop dt-hand-stop--${u} is-on" role="radio" aria-checked="true" data-tip="${g(j)}" aria-label="${g(j)}">${u==="person"?wr(t,e):P}</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="${g(j)}" aria-label="${g(j)}"${u==="agent"&&n?" disabled":""}>${P}</button>`).join("")}</span>`},Ns=()=>{let t=br();return t&&!kt(t)&&_e().some(e=>e.email===t)?t:_e()[0]?.email??""},fr=()=>{let t=J.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},_o="cubic-bezier(0.32, 0.72, 0, 1)",zo=t=>{let e=J.querySelector(".dt-hand .dt-hand-stop.is-on");if(!t||!e||matchMedia("(prefers-reduced-motion: reduce)").matches)return;let n=e.getBoundingClientRect(),o=document.createElement("span");o.className="dt-hand dt-hand-ghost",o.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),o.append(t.ghost),J.append(o),o.animate([{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(()=>o.remove(),()=>o.remove()),eo=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:_o});for(let 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:_o});for(let a of e.parentElement?.querySelectorAll("button.dt-hand-stop")??[])a.animate([{opacity:0},{opacity:1}],{duration:300,delay:140,easing:"ease-out",fill:"backwards"})},Vo=(t,e)=>{let n=eo>performance.now()?void 0:fr(),o=e==="agent"?Bs:e==="person"?Ns():e==="me"?s.me?.email??"":"";if(!t){if(!T)return;T.assignee=o,T.stage=kt(o)?"approved":!T.stage||T.stage==="approved"?"new":T.stage,e==="person"&&ot.setItem("nm-for",o),Ps(o),wn(),Q(),zo(n);return}Rs(t,o),zo(n)},Rs=(t,e)=>{let n=V.find(r=>r.id===t);if(n&&De(n)&&!kt(e)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=n?Xt(n):"new",a=kt(e)?"approved":o==="approved"?"new":o;Qt(r=>r.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>y({id:t,assignee:e||null,stage:a}),kt(e)?"Approving it for the agent":"Reassigning")},br=()=>ot.getItem("nm-for")??"",Ps=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e!==null&&(e===""||e===Bs||_e().some(n=>n.email===e))?e:null}catch{return null}},Un=t=>kt(t)?"#d97757":t?"#0d99ff":"#717171",ze=t=>t===s.me?.email?"you":s.team?.find(e=>e.email===t)?.name||t.split("@")[0],Ee=t=>t?s.team?.find(e=>e.email===t):void 0,Uo=t=>{let e=Pt(t??"").split(/\s+/).filter(Boolean);return g(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},an=(t,e,n="dt-face")=>t?`<img class="${n}" src="${g(t)}" alt="">`:`<b class="${n}" aria-hidden="true">${Uo(e)}</b>`,Ko=t=>{let e=Ee(t.by);return e||t.byName?an(e?.avatar_url,e?.name||t.byName||t.by):""},$n=t=>`var(--dt-avatar-${[...t].reduce((e,n)=>e*31+n.charCodeAt(0)>>>0,7)%8+1})`,Go=(t,e)=>{let n=Ee(t),o=n?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return an(n?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${$n(t)}" `)},Is=(t,e)=>Ee(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],Os={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},rn=(()=>{try{return JSON.parse(ot.getItem("dt-seen")||"{}")}catch{return{}}})(),Yo=()=>k("dt-seen",JSON.stringify(rn)),Xo=t=>{let e=Oe(t);if(!(t.id in rn))return rn[t.id]=e.length,Yo(),!1;let n=e[e.length-1];return e.length>rn[t.id]&&!(n?.author==="you"&&(!n.by||n.by===s.me?.email))},yr=t=>{let e=Oe(t).length;rn[t.id]!==e&&(rn[t.id]=e,Yo())},Ds=t=>{let e=Ee(t);return e?` data-face="${g(e.avatar_url??"")}" data-initial="${Uo(e.name||e.email)}"`:""},Jo=t=>s.client||_t()||$t(t)||ht(t)==="done"?"":`<span class="dt-hist-hand">${Wo(t.assignee??"",t.id)}</span>`,Ve=(t,e)=>fn(t),Zo=t=>{let e=Ee(t);return e?an(e.avatar_url,e.name||e.email):""},vr=t=>{let e=Ee(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${g(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${zt(12)}</b>`},wr=(t,e)=>{let n=(a,r)=>`<option value="${g(a)}" data-c="${Un(a)}"${Ds(a||null)}${t===a?" selected":""}>${g(r)}</option>`,o=(s.team??[]).filter(a=>a.email!==s.me?.email);return`<label class="dt-field dt-field--knob"><span class="dt-field-box dt-field-box--face" style="--cat:${Un(t)}">${Zo(t||null)||Fs}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
200
217
  ${s.me?n(s.me.email,`Me \xB7 ${s.me.name||s.me.email}`):""}
201
- ${o.map(a=>n(a.email,a.name||a.email)).join("")}${t&&t!==s.me?.email&&!o.some(a=>a.email===t)?n(t,Xe(t)):""}
202
- </select></span></label>`},gi=t=>`<div class="dt-suggest dt-suggest--read"><del>${h(t.from)}</del><ins>${h(t.to)}</ins></div>`,ao=(t,e)=>{let n=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return h([n,Nt(e??"")&&`\u201C${Nt(e).slice(0,80)}\u201D`].filter(Boolean).join(" \xB7 "))},io='<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>',bi=(t,e)=>{let n=Ie(t);return`<label class="dt-field dt-field--bare" data-tip="Type: ${h(n.label)}"><span class="dt-field-box">${Ds(n)}<span class="dt-field-label">${h(n.label)}</span>${io}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${m.map(o=>`<option value="${o.id}" data-c="${o.color}" data-icon="${h(Ds(o))}"${o.id===t?" selected":""}>${o.label}</option>`).join("")}</select></span></label>`},Qn=[["new","New","#0d99ff",.25],["progress","In progress","#f5a623",.5],["review","Needs review","#8e4ec6",.75],["waiting","Waiting","#e93d82",.875],["accepted","Accepted","#30a46c",.95]],ro=(t,e)=>{let o=2*Math.PI*e,a=8+3.3*Math.sin(o),r=8-3.3*Math.cos(o),l=`<path d="M8 8V${8-3.3}A${3.3} ${3.3} 0 ${e>.5?1:0} 1 ${a.toFixed(2)} ${r.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"/>${l}</svg>`},fn=t=>Ht(t)==="accepted"?"accepted":Ne(t)||Ht(t)==="progress"?"progress":Ht(t)==="review"?"review":Ht(t)==="waiting"?"waiting":"new",vn={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",held:"new",done:"accepted"},lo=[...Qn,["done","Resolved","#30a46c",1]],fi=t=>{let e=Qt(t),n=t.status==="done"&&e!=="review"?"done":e&&vn[e]?vn[e]:fn(t),[,,o,a]=lo.find(r=>r[0]===n);return`<label class="dt-field" data-tip="${e&&vn[e]?"Follows Claude \u2014 or pick one":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${ro(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${lo.map(([r,l,g,S])=>`<option value="${r}" data-c="${g}" data-icon="${h(ro(g,S))}"${r===n?" selected":""}>${l}</option>`).join("")}${`<option value="${ee(t)?"unarchive":"archive"}" data-sep data-icon="${h(ns)}">${ee(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},co=(t,e)=>{let n=Y.find(r=>r.id===t);if(!n)return;if(e==="done"){Se(t,!0);return}if(e==="archive"||e==="unarchive"){Te(t,e==="archive");return}let o=e==="new"?$t(n.assignee)?"approved":"new":e,a=n.status==="done"?{status:"open",doneBy:null}:{};Vt(r=>r.map(l=>l.id===t?{...l,...a,stage:o}:l),()=>x({id:t,...a,stage:o}),"Setting the status")},yn=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],vi=(t,e)=>{let n=Math.max(0,yn.findIndex(g=>g[0]===t)),[,o,a,r]=yn[n],l=yn[(n+1)%yn.length];return`<button type="button" class="dt-prio" style="--cat:${a}" data-act="prio" data-v="${l[0]}"${e?` data-id="${e}"`:""} data-tip="Priority: ${o} \u2014 click for ${l[1]}" aria-label="Priority ${o}">${Wa(r,a)}<span>${o}</span></button>`},me=()=>!!s.me&&/@guest\.notemend\.com$/i.test(s.me.email),uo=(t,e,n,o,a=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${s.client?"":vi(t,n)}${bi(Ie(e).id,n)}</span>${s.client||me()?"":Ys(o,n,a)}</div>`,yi='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M3 3l14 14M8.6 5.2A7.6 7.6 0 0 1 10 5c4.5 0 7.5 5 7.5 5a12.6 12.6 0 0 1-2.3 2.8M5.6 6.6A12.4 12.4 0 0 0 2.5 10s3 5 7.5 5c1.4 0 2.6-.4 3.7-1" stroke-linejoin="round"/></svg>',wi=t=>{let e=Nt(t?.innerText?.split(`
203
- `).find(n=>Nt(n))??"");return e?e.length>30?`${e.slice(0,30)}\u2026`:e:t?.tagName.toLowerCase()??""},wn='<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>',$i='<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>',xi='<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>',Ei='<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>',po=(t,e)=>`<label class="dt-more" data-tip="More"><span aria-hidden="true">${Ei}</span><select class="dt-more-select"${e?` data-id="${e}"`:""} aria-label="More">
218
+ ${o.map(a=>n(a.email,a.name||a.email)).join("")}${t&&t!==s.me?.email&&!o.some(a=>a.email===t)?n(t,ze(t)):""}
219
+ </select></span></label>`},$r=t=>`<div class="dt-suggest dt-suggest--read"><del>${g(t.from)}</del><ins>${g(t.to)}</ins></div>`,Qo=(t,e)=>{let n=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return g([n,Pt(e??"")&&`\u201C${Pt(e).slice(0,80)}\u201D`].filter(Boolean).join(" \xB7 "))},ta='<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>',xr=(t,e,n=!1)=>{let o=Qe(t);return n?`<span class="dt-field dt-field--bare"><span class="dt-field-box">${bn(o)}<span class="dt-field-label">${g(o.label)}</span></span></span>`:`<label class="dt-field dt-field--bare" data-tip="Type: ${g(o.label)}"><span class="dt-field-box">${bn(o)}<span class="dt-field-label">${g(o.label)}</span>${ta}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${h.map(a=>`<option value="${a.id}" data-c="${a.color}" data-icon="${g(bn(a))}"${a.id===t?" selected":""}>${a.label}</option>`).join("")}</select></span></label>`},xn=[["new","New","#0d99ff",.25],["progress","In progress","#f5a623",.5],["review","To check","#8e4ec6",.75],["waiting","Waiting","#e93d82",.875]],Kn=(t,e)=>{let o=2*Math.PI*e,a=8+3.3*Math.sin(o),r=8-3.3*Math.cos(o),l=`<path d="M8 8V${8-3.3}A${3.3} ${3.3} 0 ${e>.5?1:0} 1 ${a.toFixed(2)} ${r.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"/>${l}</svg>`},ln=t=>De(t)||Xt(t)==="progress"?"progress":Xt(t)==="review"?"review":Xt(t)==="waiting"?"waiting":"new",ea=(t,e)=>{if(e==="all")return!0;let n=ht(t),o=Es(t,n),a=(s.me?.email??"").toLowerCase();return e==="nobody"?!!o&&!o.taker:e==="mine"?!!o&&o.taker===a:e==="others"?!!o&&!!o.taker&&o.taker!==a:e==="claude"?!!o?.claude&&o.taker===a:e==="wrote"?(t.by??"").toLowerCase()===a:n==="claude"||n==="open"&&(ne(t)==="review"||ln(t)==="review")},Gn={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",held:"new",done:"done"},qs=[...xn,["done","Resolved","#30a46c",1]],Er=t=>{let e=ne(t),n=t.status==="done"&&e!=="review"?"done":e&&Gn[e]?Gn[e]:ln(t),[,,o,a]=qs.find(r=>r[0]===n);return`<label class="dt-field" data-tip="${e&&Gn[e]?"Follows Claude \u2014 or pick one":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Kn(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${qs.map(([r,l,f,u])=>`<option value="${r}" data-c="${f}" data-icon="${g(Kn(f,u))}"${r===n?" selected":""}>${l}</option>`).join("")}${s.client?"":`<option value="${re(t)?"unarchive":"archive"}" data-sep data-icon="${g(Xn)}">${re(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},Mr=(t,e)=>{let{reopenedAt:n,reopenedBy:o}=t;if(!n||t.status==="done")return e.join("");let a=Date.parse(n),r=Oe(t).findIndex((f,u)=>u>0&&!!f.at&&Date.parse(f.at)>a),l=o?o==="you"||o===s.me?.email?"you":o==="claude"?"Claude":ze(o):"";return e.splice(r<0?e.length:r,0,`<p class="dt-note-event">${Ae}${g(l?`Reopened by ${l}`:"Reopened")} \xB7 ${Je(n)}</p>`),e.join("")},kr=t=>{let e=t.from,n=a=>`<p class="dt-note-from">${js}${a}</p>`;return e?n($t(t)?"Duplicated from a studio thread":"Duplicated from a client thread"):s.client?"":wt.find(a=>a.from?.id===t.id)?n($t(t)?"Duplicated to the workspace":"Duplicated for the client"):""},Lr=t=>{let e=t.status==="done"?"done":ln(t),[,n,o,a]=qs.find(r=>r[0]===e);return`<span class="dt-field"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Kn(o,a)}<span class="dt-field-label">${n}</span></span></span>`},Sr=(t,e)=>{let n=V.find(r=>r.id===t);if(!n)return;if(e==="done"){Le(t,!0);return}if(e==="archive"||e==="unarchive"){Ue(t,e==="archive");return}let o=e==="new"?kt(n.assignee)?"approved":"new":e,a=n.status==="done"?{status:"open",doneBy:null}:{};Qt(r=>r.map(l=>l.id===t?{...l,...a,stage:o}:l),()=>y({id:t,...a,stage:o}),"Setting the status")},Yn=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],Tr=(t,e)=>{let n=Math.max(0,Yn.findIndex(f=>f[0]===t)),[,o,a,r]=Yn[n],l=Yn[(n+1)%Yn.length];return`<button type="button" class="dt-prio" style="--cat:${a}" data-act="prio" data-v="${l[0]}"${e?` data-id="${e}"`:""} data-tip="Priority: ${o} \u2014 click for ${l[1]}" aria-label="Priority ${o}">${Xi(r,a)}<span>${o}</span></button>`},_t=()=>!!s.me&&/@guest\.notemend\.com$/i.test(s.me.email),na=(t,e,n,o,a=!1,r=!1,l=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${s.client?"":Tr(t,n)}${xr(Qe(e).id,n,r)}</span>${s.client||_t()||l?"":Wo(o,n,a)}</div>`,Ar='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M3 3l14 14M8.6 5.2A7.6 7.6 0 0 1 10 5c4.5 0 7.5 5 7.5 5a12.6 12.6 0 0 1-2.3 2.8M5.6 6.6A12.4 12.4 0 0 0 2.5 10s3 5 7.5 5c1.4 0 2.6-.4 3.7-1" stroke-linejoin="round"/></svg>',Cr=t=>{let e=Pt(t?.innerText?.split(`
220
+ `).find(n=>Pt(n))??"");return e?e.length>30?`${e.slice(0,30)}\u2026`:e:t?.tagName.toLowerCase()??""},Fs='<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>',Hr='<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>',sa='<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>',js='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="7" y="7" width="9.5" height="9.5" rx="2"/><path d="M13 7V5a1.5 1.5 0 0 0-1.5-1.5h-6A1.5 1.5 0 0 0 4 5v6a1.5 1.5 0 0 0 1.5 1.5H7"/></svg>',oa='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 7h11M12 4l3 3-3 3M16 13H5M8 10l-3 3 3 3"/></svg>',aa='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2l-.9.9"/><path d="M11.5 8.5a3 3 0 0 0-4.2 0L5 10.8A3 3 0 0 0 9.2 15l.9-.9"/></svg>',ia=t=>{let e=(a,r,l,f="")=>`<option value="${a}" data-icon="${g(r)}"${f}>${l}</option>`,n=t&&Be()?$t(t)?e("dup",js,"Duplicate to workspace")+(t.client?"":e("move",oa,"Move to workspace")):e("dup",js,"Duplicate for the client")+e("move",oa,"Move to clients"):"",o=t&&s.client&&t.status==="done"?e("reopen",Ae,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${sa}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
204
221
  <option value="" hidden selected></option>
205
- ${s.client?"":`<option value="team" data-icon="${h(xi)}"${t?"":" data-on"}>Team only</option>
206
- <option value="client" data-icon="${h(wn)}"${t?" data-on":""}>Team and client</option>`}
207
- <option value="${e?"rm":"discard"}" data-icon="${h(Pe)}" data-danger${s.client?"":" data-sep"}>${e?"Delete thread":"Discard draft"}</option>
208
- </select></label>`,ho='<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>',mo=()=>(s.team??[]).filter(t=>!s.studio||s.studio.includes(t.email)),go=t=>{let e=t||s.lead||"",n=mo();return!n.length||n.some(o=>o.email===e)?e:n[0].email},Mi=t=>{let e=go(t),n=mo();if(!n.length)return"";let o=oo(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${Ye(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
209
- ${n.map(a=>`<option value="${h(a.email)}" data-c="${Ye(a.email)}"${Zn(a.email)}${e===a.email?" selected":""}>${h(a.name||a.email)}</option>`).join("")}
210
- </select></span></label>`},$n='<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>',bo='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',ki='<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>',Li=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,Si=(t,e)=>{let n=t.closest(".dt-voice"),o=n.querySelector("audio"),a=n.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let g=n.querySelector(".dt-voice-track i"),S=n.querySelector(".dt-voice-time"),R=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{g.style.transform=`scaleX(${R()?Math.min(1,o.currentTime/R()):0})`,S.textContent=Li(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=ki,a.setAttribute("aria-label","Pause"),n.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=bo,a.setAttribute("aria-label","Play the voice note"),n.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let g=n.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-g.left)/g.width))*o.duration);return}if(!o.paused){o.pause();return}U.querySelectorAll(".dt-voice audio").forEach(g=>{g!==o&&g.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?r():l(),{once:!0}):r();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,r()},{once:!0}),o.currentTime=1e9}},ts=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),fo=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Ze=new Map,Ti=t=>{if(!t.startsWith("data:"))return t;let e=Ze.get(t);if(!e){let[n,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:n.slice(5).split(";")[0]})),Ze.set(t,e),Ze.size>8){let[a,r]=Ze.entries().next().value;URL.revokeObjectURL(r),Ze.delete(a)}}return e},Ci=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${bo}</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="${Ti(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">${Fi}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${$n}</button>`}</span>`,vo=t=>t.length>30?`${t.slice(0,17)}\u2026${t.slice(-11)}`:t,Ai=t=>{if(!t.startsWith("data:"))return"";let e=Math.round((t.length-t.indexOf(",")-1)*3/4);return e<1024*1024?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`},yo=t=>{let e=La(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},Hi=(t,e,n)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${yo(e)}<span class="dt-file-text"><b>${h(vo(e))}</b>${o?"":`<small>${Ai(t)}</small>`}</span>`;return`<span class="dt-file" title="${h(e)}">${o?`<a class="dt-file-open" href="${h(Ns(e)?t:a)}"${Ns(e)?' target="_blank" rel="noreferrer"':` download="${h(e)}"`}>${r}</a><a class="dt-file-get" href="${h(a)}" download="${h(e)}" aria-label="Download ${h(e)}" data-tip="Download">${Ni}</a>`:`<span class="dt-file-open">${r}</span>`}${n===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${n} aria-label="Remove">${$n}</button>`}</span>`},Bi=(t,e)=>{let[,n,o]=t.split("\0");return`<span class="dt-file is-refused" title="${h(n)}"><span class="dt-file-open">${yo(n)}<span class="dt-file-text"><b>${h(vo(n))}</b><small>${h(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${$n}</button></span>`},wo=(t,e,n=t)=>t.startsWith(xn)?Bi(t,e??""):dn(n)?Hi(t,dn(n),e):ts(n)?Ci(t,e):`<span class="dt-shot${fo(n)?" dt-shot--video":""}">${fo(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">${$n}</button>`}</span>`,es=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(n=>{let o=n.split("/").pop(),a=Ea(o);return wo(a,e===void 0?void 0:`data-id="${e}" data-img="${h(o)}"`,o)}).join("")}</div>`:"",$o=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,n)=>wo(e,`data-i="${n}"`)).join("")}</div>`:"",ns='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',Ni='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3.5v9M6 9l4 4 4-4M4 16.5h12" stroke-linejoin="round"/></svg>',Pi='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><path d="M16 9.5 9.9 15.6a3.6 3.6 0 0 1-5.1-5.1l6.6-6.6a2.4 2.4 0 0 1 3.4 3.4l-6.6 6.6a1.2 1.2 0 0 1-1.7-1.7L12.4 6.3" stroke-linejoin="round"/></svg>',xn="refused:\0",Ur='<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>',Ri='<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>',Ii='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Oi=90,ss=32,Di=()=>!!s.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",En=!1,qi=async(t,e)=>{if(En||!t)return;let n=Number(t.dataset.id)||0;En=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o;try{o=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(ut){En=!1,e.classList.remove("is-asking");let Ct=ut?.name;ue(Ct==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Ct==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Ct==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${ut?.message||Ct||"unknown error"}`);return}e.classList.remove("is-asking");let a=()=>U.querySelector(n?`.dt-note[data-id="${n}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),r=document.createElement("div");r.className="dt-rec",r.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${Pe}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(ss)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${Ii}</button>`;let l=r.querySelector("b"),g=[...r.querySelectorAll(".dt-rec-wave i")],S=new AudioContext,R=S.createAnalyser();R.fftSize=512,S.createMediaStreamSource(o).connect(R);let u=new Uint8Array(R.fftSize),Z=[],D=new MediaRecorder(o,{audioBitsPerSecond:32e3}),K=[],Et=Date.now(),le=!0,de=setInterval(()=>{let ut=a();ut&&r.parentElement!==ut&&ut.appendChild(r),R.getByteTimeDomainData(u);let Ct=0;for(let ve of u)Ct+=((ve-128)/128)**2;Z.push(Math.min(1,Math.sqrt(Ct/u.length)*4));let fe=Z.slice(-ss);g.forEach((ve,Ke)=>{let He=fe[Ke-(ss-fe.length)];ve.style.transform=`scaleY(${Math.max(.1,He??0).toFixed(2)})`,ve.classList.toggle("is-empty",He===void 0)});let tt=Math.floor((Date.now()-Et)/1e3);l.textContent=`${Math.floor(tt/60)}:${String(tt%60).padStart(2,"0")}`,tt>=Oi&&D.state!=="inactive"&&D.stop()},90),Ve=ut=>{le=ut,D.state!=="inactive"&&D.stop()};r.querySelector(".dt-rec-x").addEventListener("click",ut=>{ut.stopPropagation(),Ve(!1)}),r.querySelector(".dt-rec-done").addEventListener("click",ut=>{ut.stopPropagation(),Ve(!0)}),r.addEventListener("keydown",ut=>{ut.key==="Escape"&&(ut.stopPropagation(),Ve(!1))}),D.ondataavailable=ut=>{ut.data.size&&K.push(ut.data)},D.onstop=async()=>{if(clearInterval(de),o.getTracks().forEach(fe=>fe.stop()),S.close().catch(()=>{}),r.remove(),En=!1,!le)return;let ut=new Blob(K,{type:D.mimeType||"audio/webm"}),Ct=await new Promise(fe=>{let tt=new FileReader;tt.onload=()=>fe(String(tt.result)),tt.readAsDataURL(ut)});n?wt.push(Ct):M&&(M.images??=[]).push(Ct),G(),a()?.querySelector("textarea")?.focus()},D.start(1e3),a()?.appendChild(r),r.querySelector(".dt-rec-done").focus()},xo="\u{1F3A4} Voice note",Fi='<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>',ji=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?M?.images??[]:wt)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await At("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),r=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!r.text){ue(r.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${r.text}`:r.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},ce=new Map,Eo=async(t,e,n)=>{let o=`${t}:${e}`;if(!n&&ce.has(o)){ce.delete(o),G();return}let a=Y.find(S=>S.id===t),r=a&&Be(a).find(S=>(S.at??"0")===e);if(!r?.text)return;ce.set(o,null),G();let l=await At("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:n||navigator.language||"en"})}).catch(()=>null),g=l?await l.json().catch(()=>({})):{};ce.has(o)&&(l?.ok&&g.text?ce.set(o,g.text):(ce.delete(o),ue(g.error||"Could not translate it \u2014 try again.")),G())},_i=["uk","ru","en"],Wi=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},zi=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${io}</span><select class="dt-lang-select" data-id="${t}" data-at="${h(e)}" aria-label="Translate into"><option value="" selected hidden></option>${_i.map(n=>`<option value="${h(n)}">${h(Wi(n))}</option>`).join("")}</select></label>`,Vi='<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>',Ki='<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>',Mo=(t,e,n,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
211
- <textarea class="${t}" rows="1" placeholder="${e}">${h(n)}</textarea>
222
+ ${n}${o}${t?e("link",aa,"Copy link"):""}
223
+ ${e(t?"rm":"discard",Ze,t?"Delete thread":"Discard draft",` data-danger${t?" data-sep":""}`)}
224
+ </select></label>`},Ws=()=>(s.team??[]).filter(t=>!s.studio||s.studio.includes(t.email)),ra=t=>{let e=t||s.lead||"",n=Ws();return!n.length||n.some(o=>o.email===e)?e:n[0].email},Br=t=>{let e=ra(t),n=Ws();if(!n.length)return"";let o=Zo(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${Un(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
225
+ ${n.map(a=>`<option value="${g(a.email)}" data-c="${Un(a.email)}"${Ds(a.email)}${e===a.email?" selected":""}>${g(a.name||a.email)}</option>`).join("")}
226
+ </select></span></label>`},En='<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>',la='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',Nr='<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>',Rr=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,Pr=(t,e)=>{let n=t.closest(".dt-voice"),o=n.querySelector("audio"),a=n.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let f=n.querySelector(".dt-voice-track i"),u=n.querySelector(".dt-voice-time"),P=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{f.style.transform=`scaleX(${P()?Math.min(1,o.currentTime/P()):0})`,u.textContent=Rr(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=Nr,a.setAttribute("aria-label","Pause"),n.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=la,a.setAttribute("aria-label","Play the voice note"),n.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let f=n.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-f.left)/f.width))*o.duration);return}if(!o.paused){o.pause();return}J.querySelectorAll(".dt-voice audio").forEach(f=>{f!==o&&f.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?r():l(),{once:!0}):r();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,r()},{once:!0}),o.currentTime=1e9}},_s=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),da=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Mn=new Map,Ir=t=>{if(!t.startsWith("data:"))return t;let e=Mn.get(t);if(!e){let[n,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:n.slice(5).split(";")[0]})),Mn.set(t,e),Mn.size>8){let[a,r]=Mn.entries().next().value;URL.revokeObjectURL(r),Mn.delete(a)}}return e},Or=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${la}</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="${Ir(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">${Yr}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${En}</button>`}</span>`,zs=t=>t.length>30?`${t.slice(0,17)}\u2026${t.slice(-11)}`:t,Dr=t=>{if(!t.startsWith("data:"))return"";let e=Math.round((t.length-t.indexOf(",")-1)*3/4);return e<1024*1024?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`},Vs=t=>{let e=Si(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},qr=(t,e,n)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${Vs(e)}<span class="dt-file-text"><b>${g(zs(e))}</b>${o?"":`<small>${Dr(t)}</small>`}</span>`;return`<span class="dt-file" title="${g(e)}">${o?`<a class="dt-file-open" href="${g(Lo(e)?t:a)}"${Lo(e)?' target="_blank" rel="noreferrer"':` download="${g(e)}"`}>${r}</a><a class="dt-tip-r dt-file-get" href="${g(a)}" download="${g(e)}" aria-label="Download ${g(e)}" data-tip="Download">${Wr}</a>`:`<span class="dt-file-open">${r}</span>`}${n===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${n} aria-label="Remove">${En}</button>`}</span>`},Fr=(t,e)=>{let[,n,o]=t.split("\0");return`<span class="dt-file is-refused" title="${g(n)}"><span class="dt-file-open">${Vs(n)}<span class="dt-file-text"><b>${g(zs(n))}</b><small>${g(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${En}</button></span>`},jr=(t,e)=>{let[,,n,o]=t.split("\0");return`<span class="dt-file" title="${g(n)}"><span class="dt-file-open">${Vs(n)}<span class="dt-file-text"><b>${g(zs(n))}</b><small>${(Number(o)/1024/1024).toFixed(1)} MB \u2014 uploads when you send</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${En}</button></span>`},ca=(t,e,n=t)=>t.startsWith(Jn)?Fr(t,e??""):t.startsWith(Ks)?jr(t,e??""):qn(n)?qr(t,qn(n),e):_s(n)?Or(t,e):`<span class="dt-shot${da(n)?" dt-shot--video":""}">${da(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">${En}</button>`}</span>`,Us=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(n=>{let o=n.split("/").pop(),a=Ei(o);return ca(a,e===void 0?void 0:`data-id="${e}" data-img="${g(o)}"`,o)}).join("")}</div>`:"",ua=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,n)=>ca(e,`data-i="${n}"`)).join("")}</div>`:"",Xn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',Wr='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3.5v9M6 9l4 4 4-4M4 16.5h12" stroke-linejoin="round"/></svg>',_r='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><path d="M16 9.5 9.9 15.6a3.6 3.6 0 0 1-5.1-5.1l6.6-6.6a2.4 2.4 0 0 1 3.4 3.4l-6.6 6.6a1.2 1.2 0 0 1-1.7-1.7L12.4 6.3" stroke-linejoin="round"/></svg>',Jn="refused:\0",Ks="big:\0",Zn=new Map,dn=t=>!t.startsWith(Ks),gd='<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>',zr='<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>',Vr='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Ur=90,Gs=32,Kr=()=>!!s.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",Qn=!1,Gr=async(t,e)=>{if(Qn||!t)return;let n=Number(t.dataset.id)||0;Qn=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Mt("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(pt){clearTimeout(o),Qn=!1,e.classList.remove("is-asking");let dt=pt?.name;Mt(dt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":dt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":dt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${pt?.message||dt||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let r=()=>J.querySelector(n?`.dt-note[data-id="${n}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),l=document.createElement("div");l.className="dt-rec",l.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${Ze}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(Gs)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${Vr}</button>`;let f=l.querySelector("b"),u=[...l.querySelectorAll(".dt-rec-wave i")],P=new AudioContext,j=P.createAnalyser();j.fftSize=512,P.createMediaStreamSource(a).connect(j);let c=new Uint8Array(j.fftSize),U=[],I=new MediaRecorder(a,{audioBitsPerSecond:32e3}),K=[],_=Date.now(),Rt=!0,Dt=setInterval(()=>{let pt=r();pt&&l.parentElement!==pt&&pt.appendChild(l),j.getByteTimeDomainData(c);let dt=0;for(let gn of c)dt+=((gn-128)/128)**2;U.push(Math.min(1,Math.sqrt(dt/c.length)*4));let Te=U.slice(-Gs);u.forEach((gn,xo)=>{let Xe=Te[xo-(Gs-Te.length)];gn.style.transform=`scaleY(${Math.max(.1,Xe??0).toFixed(2)})`,gn.classList.toggle("is-empty",Xe===void 0)});let ce=Math.floor((Date.now()-_)/1e3);f.textContent=`${Math.floor(ce/60)}:${String(ce%60).padStart(2,"0")}`,ce>=Ur&&I.state!=="inactive"&&I.stop()},90),de=pt=>{Rt=pt,I.state!=="inactive"&&I.stop()};l.querySelector(".dt-rec-x").addEventListener("click",pt=>{pt.stopPropagation(),de(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",pt=>{pt.stopPropagation(),de(!0)}),l.addEventListener("keydown",pt=>{pt.key==="Escape"&&(pt.stopPropagation(),de(!1))}),I.ondataavailable=pt=>{pt.data.size&&K.push(pt.data)},I.onstop=async()=>{if(clearInterval(Dt),a.getTracks().forEach(Te=>Te.stop()),P.close().catch(()=>{}),l.remove(),Qn=!1,!Rt)return;let pt=new Blob(K,{type:I.mimeType||"audio/webm"}),dt=await new Promise(Te=>{let ce=new FileReader;ce.onload=()=>Te(String(ce.result)),ce.readAsDataURL(pt)});n?Bt.push(dt):T&&(T.images??=[]).push(dt),Q(),r()?.querySelector("textarea")?.focus()},I.start(1e3),r()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},pa="\u{1F3A4} Voice note",Yr='<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>',Xr=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?T?.images??[]:Bt)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await At("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),r=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!r.text){Mt(r.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${r.text}`:r.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},Me=new Map,ha=async(t,e,n)=>{let o=`${t}:${e}`;if(!n&&Me.has(o)){Me.delete(o),Q();return}let a=V.find(u=>u.id===t),r=a&&Oe(a).find(u=>(u.at??"0")===e);if(!r?.text)return;Me.set(o,null),Q();let l=await At("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:n||navigator.language||"en"})}).catch(()=>null),f=l?await l.json().catch(()=>({})):{};Me.has(o)&&(l?.ok&&f.text?Me.set(o,f.text):(Me.delete(o),Mt(f.error||"Could not translate it \u2014 try again.")),Q())},Jr=["uk","ru","en"],Zr=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},Qr=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${ta}</span><select class="dt-lang-select" data-id="${t}" data-at="${g(e)}" aria-label="Translate into"><option value="" selected hidden></option>${Jr.map(n=>`<option value="${g(n)}">${g(Zr(n))}</option>`).join("")}</select></label>`,tl='<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>',el='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/></svg>',ma='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M15.9 9.3a6.5 6.5 0 1 1-5.2-5.7"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/><path d="M15.5 2.5v4.5M13.25 4.75h4.5"/></svg>',Ys=()=>s.me?.email??"you",nl=(t,e,n)=>{let o=Object.entries(n??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,r])=>{let l=r.includes(Ys()),f=r.map(u=>u===Ys()?"You":ze(u)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${g(e)}" data-emoji="${g(a)}" aria-pressed="${l}" data-tip="${g(f)}" aria-label="${g(`${a} ${r.length}: ${f}`)}">${g(a)}<span>${r.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${g(e)}" data-tip="Add reaction" aria-label="Add reaction">${ma}</button></div>`:""},ga=(t,e,n)=>{ts();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",n.box?"Emoji":"React"),o.innerHTML=(e?Hi:Ci).map(P=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${g(P)}" aria-label="${g(P)}">${g(P)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${sa}</button>`),ke={...n,btn:t},J.append(o);let a=t.getBoundingClientRect(),r=o.getBoundingClientRect(),l=6,f=8,u=a.bottom+l+r.height<=innerHeight-f;o.style.top=`${u?a.bottom+l:Math.max(f,a.top-l-r.height)}px`,o.style.left=`${Math.min(Math.max(f,a.right-r.width),innerWidth-f-r.width)}px`,o.querySelector("button")?.focus()},ke=null,ts=()=>{J.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),ke=null},sl=(t,e)=>{t.setRangeText(e,t.selectionStart??t.value.length,t.selectionEnd??t.value.length,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},fa=(t,e,n)=>{let o=a=>{let r=Bi(a.reactions,n,Ys());return r===null?a:{...a,reactions:r}};Qt(a=>a.map(r=>r.id!==t?r:e?{...r,replies:r.replies?.map(l=>l.at===e?o(l):l)}:o(r)),()=>y({id:t,react:{at:e,emoji:n}}),"The reaction")},ol='<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>',Xs=1e4,ba=(t,e,n,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
227
+ <textarea class="${t}" rows="1" maxlength="${Xs}" aria-label="${e}" placeholder="${e}">${g(n)}</textarea>
212
228
  ${a}
213
229
  <div class="dt-compose-bar">
214
- <span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${Ki}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 3 MB">${Pi}</button>
215
- ${Di()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${Ri}</button>`:""}</span>
230
+ <span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${ol}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${_r}</button>
231
+ ${Kr()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${zr}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${el}</button></span>
216
232
  <button class="dt-send${n.trim()?" is-ready":""}" ${o} title="Send (Enter)"
217
233
  ><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>
218
234
  </div>
219
- </div></div>`,os=(t,e)=>(t||"element")+(e?.[0]?"."+e[0]:""),ko=()=>St.map((t,e)=>({i:e,el:os(t.tag,t.classes),text:Nt(t.text??""),shots:t.images?.length??0,orphan:!zt(t)})),as=[],Lo="",se=t=>{let e=t.working;return Le(e?.agent,e?.by??Ps(t.assignee))},So=t=>{let e=Math.max(1,Math.round((Date.now()-Date.parse(t??""))/6e4)||1);return e<60?`${e} min`:`${Math.round(e/60)} h`},Mn=(t,e)=>{let n=t.working;return{held:"From a guest \u2014 waits for the studio to approve it",queued:`Queued for ${se(t)} \u2014 it takes it on its next run`,asks:`${se(t)} is waiting for your answer`,working:`${se(t)} is on it \xB7 ${So(n?.at)}`,stuck:`${se(t)} went quiet \u2014 its next run takes it again`,review:`Resolved by ${Le(t.doneAgent,t.doneFor)} \u2014 click to clear`,done:"Resolved"}[e]},Ui=t=>{let e=Qt(t);if(!e)return s.client||me()||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">${Os(13,0)}</button>`;let n=Os(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${h(Mn(t,e))}" aria-label="${h(Mn(t,e))}">${n}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${h(Mn(t,e))}" role="img" aria-label="${h(Mn(t,e))}">${n}</span>`},To=(t,e=!0)=>{let n=pt(t),o=n==="done",a=ee(t);return`${e?Ui(t):""}<button data-act="${o?"reopen":"done"}" data-id="${t.id}"
220
- class="dt-note-resolve${o&&!a?" is-on":""}" title="${o?"Reopen":n==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${Wt}</button><button data-act="${a?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${a?" is-on":""}" title="${a?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${ns}</button>`},Gi=t=>t?new Date(t).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}):"",Yi=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!ee(t)){let S=t.confirmedBy?t.confirmedBy===s.me?.email?"you":Xe(t.confirmedBy):"";return`<div class="dt-step dt-step--resolved"><span class="dt-step-text"><b>${h(S?`Resolved by ${S} \u2014 check it`:"Resolved \u2014 check it")}</b></span><button type="button" class="dt-step-act" data-act="reopen" data-id="${t.id}" data-tip="Reopen \u2014 not right yet" aria-label="Reopen">${Re}</button><button type="button" class="dt-step-act is-main" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${ns}</button></div>`}if(s.client)return"";let e=Qt(t),n={act:"hand",v:"me",icon:wn,tip:s.me?"Take it myself":"Take it off Claude"},o={act:"reopen",icon:Re,tip:"Reopen"},a=[{act:"accept",icon:Wt,tip:"Looks right \u2014 accept it",main:!0},{act:"sendback",icon:Re,tip:"Send it back \u2014 say what is wrong below"}],r=t.working,l=!$t(t.assignee)&&t.assignee?t.assignee===s.me?.email?"You":Xe(t.assignee):"",g=e==="queued"?{step:e,title:`Queued for ${se(t)}`,acts:[n]}:e==="working"?{step:e,title:`${se(t)} is working`,acts:[n],live:!0}:e==="asks"?{step:e,title:`${se(t)} asks`,acts:[]}:e==="stuck"?{step:e,title:`${se(t)} silent for ${So(r?.at)}`,acts:[n]}:e==="review"?null:t.status!=="done"&&Ht(t)==="accepted"?{step:"done",title:`Accepted${t.acceptedAt?` \xB7 ${Gi(t.acceptedAt)}`:""}`,acts:[{...o,act:"sendback",tip:"Send it back"}]}:Ht(t)==="review"&&l?{step:"review",title:`${l} ${l==="You"?"say":"says"} done \u2014 check it`,acts:a}:!e&&!t.assignee&&t.status!=="done"&&s.me&&!me()?{step:"anyone",title:"Unassigned",acts:[{act:"hand",v:"me",icon:Wt,tip:"Take it myself"},{act:"hand",v:"agent",icon:Xt(13),tip:`Give it to ${se(t)}`},{act:"give",icon:$i,tip:"Give it to someone",pick:!0}]}:null;return g?`<div class="dt-step dt-step--${g.step}">${g.step==="anyone"?Gs:""}<span class="dt-step-text"><b>${h(g.title)}</b></span>${g.acts.map(S=>S.pick?`<label class="dt-step-act" data-tip="${h(S.tip)}">${S.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${h(S.tip)}"><option value="" selected hidden></option>${ke().map(R=>`<option value="${h(R.email)}"${Zn(R.email)}>${h(R.email===s.me?.email?`Me \xB7 ${R.name||R.email}`:R.name||R.email)}</option>`).join("")}</select></label>`:`<button type="button" class="dt-step-act${S.main?" is-main":""}" data-act="${S.act}" data-id="${t.id}"${S.v?` data-v="${S.v}"`:""} data-tip="${h(S.tip)}" aria-label="${h(S.tip)}">${S.icon}</button>`).join("")}${g.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`:""},Xi=async(t,e)=>{let n=e?Y.find(a=>a.id===t):void 0,o=await x(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,stage:Co(Y.find(a=>a.id===t))});return o.ok&&n&&xs(ne(n)).then(a=>{a&&x({id:t,after:a})}),o},is=0,rs=t=>(is++,t.finally(()=>{is--})),Vt=async(t,e,n)=>{let o=Y,a=Kt;Y=t(Y),Kt=t(Kt),G();let r=await rs(e()).catch(()=>null);if(!r?.ok){Y=o,Kt=a,G(),Bn(`${n} did not go through`,r);return}let l=Ln([await r.json().catch(()=>null)])[0];l&&(Y=Y.map(g=>g.id===l.id?l:g),Kt=Kt.map(g=>g.id===l.id?l:g),G()),on()},Co=t=>t?$t(t.assignee)?"approved":t.assignee?"progress":"new":"new",Se=(t,e)=>Vt(n=>n.map(o=>o.id===t?{...o,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{stage:Co(o),reopenedAt:new Date().toISOString()}}:o),()=>Xi(t,e),e?"Resolving":"Reopening"),Te=async(t,e,n=!1)=>{let o=Y.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await Vt(r=>r.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?s.me?.email:void 0}:l),()=>x({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!n&&Qe(`Archived #${t}`,()=>Te(t,!1,!0))},Qe=(t,e,n="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${h(t)}</span><button type="button">${h(n)}</button>`,$e(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>o.remove(),5e3)},ls=t=>Vt(e=>e.filter(n=>n.id!==t),()=>At(`comments?id=${t}`,{method:"DELETE"}),"Deleting"),Ji=t=>{let e=Y.filter(a=>k(a)===t),n=e.filter(a=>pt(a)==="open").length,o=e.filter(a=>pt(a)==="claude").length;he.innerHTML=n?String(n):o?Xt(9):"\u2713",he.dataset.state=n?"open":o?"claude":"done",he.hidden=e.length===0},ds=0,Ao,tn=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t)return;t.style.translate="";let e=window.visualViewport,n=t.getBoundingClientRect(),o=n.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,n.top-8)}px`)};window.visualViewport?.addEventListener("resize",tn),addEventListener("resize",tn),document.addEventListener("focusin",tn),document.addEventListener("focusout",()=>setTimeout(tn));let G=()=>{requestAnimationFrame(tn);let t=ds-performance.now();if(t>0){clearTimeout(Ao),Ao=setTimeout(G,t);return}if(Rt(),w){let u=ko(),Z=JSON.stringify(u);Z!==Lo&&(Lo=Z,parent.postMessage({dt:!0,drafts:u},location.origin))}_s(),j.toggleAttribute("data-yield",st!=null||!!M),st!==C&&(Ft="",wt=[],C=st),lt&&lt.id!==st&&(lt=null);let e=Me();if(Ji(e),!kt){U.innerHTML="",Vn(null),Lt.hidden=!0;return}let n=e,o="",a=Y.filter(u=>k(u)===n&&(ni(u)||u.id===st));for(let u of a){let Z=zt(u);if(!Z&&st!==u.id)continue;let D=pt(u),K=!Z,Et=Z??{x:0,y:0},le=Ie(u.category),de=Ne(u),Ve=D==="done"?null:Qt(u),ut=Ve?Jn[Ve]??"":"";if(st===u.id&&pi(u),K||(o+=`<button class="dt-pin dt-pin--${D}${D==="done"&&!ee(u)?" dt-pin--resolved":""}${ut?" dt-pin--agent":""}${de?" dt-pin--working":""}${D==="open"&&Ht(u)==="review"?" dt-pin--review":""}${Z?.hidden?" dt-pin--hidden":""}" data-id="${u.id}"${Z?.off?` data-off="${Z.off}"`:""} aria-label="Comment ${u.id}, ${D==="open"?"open":D==="claude"?`resolved by ${h(Le(u.doneAgent,u.doneFor))}`:"resolved"}" aria-expanded="${st===u.id}"
221
- style="left:${Et.x}px;top:${Et.y}px;--cat:${le.color};--ring:${Qn.find(Ct=>Ct[0]===fn(u))[2]};--hue:${to(u.by||u.byName||"")}${ut?`;--step-c:${ut}`:""}"
222
- title="${h(u.text.slice(0,80))} \xB7 ${le.label}${de?` \xB7 ${h(Le(de.agent,de.by))} is on it`:""}${D==="claude"?` \xB7 resolved by ${h(Le(u.doneAgent,u.doneFor))} \u2014 tick to confirm`:D==="done"?" \xB7 resolved":""}${ks(u)?" \u2014 drag to move":""}"${ks(u)?" data-move":""}>${D==="done"?"\u2713":ut?Xt(11):Qs(u)}${D!=="done"&&st!==u.id&&no(u)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}</button>`),st===u.id){let Ct=Be(u),fe=Qt(u)==="review"&&!s.client?Ct.map(tt=>tt.author).lastIndexOf("claude"):-1;o+=`<div class="dt-note${K?" dt-note--orphan":""}" data-id="${u.id}" role="dialog" aria-label="Comment ${u.id}"
223
- style="left:${Et.x}px;top:${Et.y}px">
235
+ </div></div>`,Js=(t,e)=>(t||"element")+(e?.[0]?"."+e[0]:""),ya=()=>Nt.map((t,e)=>({i:e,el:Js(t.tag,t.classes),text:Pt(t.text??""),shots:t.images?.length??0,orphan:!Zt(t)})),Zs=[],va="",me=t=>{let e=t.working;return Ve(e?.agent,e?.by??$s(t.assignee))},wa=t=>{let e=Math.max(1,Math.round((Date.now()-Date.parse(t??""))/6e4)||1);return e<60?`${e} min`:`${Math.round(e/60)} h`},es=(t,e)=>{let n=t.working;return{held:"From a guest \u2014 waits for the studio to approve it",queued:`Queued for ${me(t)} \u2014 it takes it on its next run`,asks:`${me(t)} is waiting for your answer`,working:`${me(t)} is on it \xB7 ${wa(n?.at)}`,stuck:`${me(t)} went quiet \u2014 its next run takes it again`,review:`To check \u2014 ${Ve(t.doneAgent,t.doneFor)} fixed it \xB7 click to reopen`,done:"Resolved"}[e]},$a=t=>{if(s.client||_t()||$t(t))return"";let e=ne(t);if(!e)return s.client||_t()||t.status==="done"||$t(t)?"":`<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">${Ao(13,0)}</button>`;let n=Ao(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${g(es(t,e))}" aria-label="${g(es(t,e))}">${n}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${g(es(t,e))}" role="img" aria-label="${g(es(t,e))}">${n}</span>`},kn=t=>!!s.client&&!(s.me&&t.by===s.me.email),xa=(t,e=!0)=>{if(kn(t))return e?$a(t):"";let n=ht(t),o=n==="done",a=re(t);return`${e?$a(t):""}<button data-act="${o?"reopen":"done"}" data-id="${t.id}"
236
+ class="dt-note-resolve${o&&!a?" is-on":""}" title="${o?"Reopen":n==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${qt}</button>${s.client||_t()?"":`<button data-act="${a?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${a?" is-on":""}" title="${a?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${Xn}</button>`}`},al=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!re(t)&&!kn(t)){let u=t.confirmedBy?t.confirmedBy===s.me?.email?"you":ze(t.confirmedBy):"",P=t.confirmedAt;return`<div class="dt-step dt-step--resolved"><span class="dt-step-text"><b>${g(u?`Resolved by ${u}`:"Resolved")}</b>${P?` \xB7 ${Je(P)}`:""}</span><button type="button" class="dt-step-act" data-act="reopen" data-id="${t.id}" data-tip="Reopen \u2014 not right yet" aria-label="Reopen">${Ae}</button>`+(s.client?"</div>":`<button type="button" class="dt-step-act is-main" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${Xn}</button></div>`)}if(s.client||$t(t))return"";let e=ne(t),n={act:"hand",v:"me",icon:Fs,tip:s.me?"Take it myself":"Take it off Claude"},o={act:"reopen",icon:Ae,tip:"Reopen"},a=[{act:"accept",icon:qt,tip:"Looks right \u2014 mark it resolved",main:!0},{act:"sendback",icon:Ae,tip:"Send it back \u2014 say what is wrong below"}],r=t.working,l=!kt(t.assignee)&&t.assignee?t.assignee===s.me?.email?"You":ze(t.assignee):"",f=e==="queued"?{step:e,title:`With ${me(t)} \u2014 queued`,acts:[n]}:e==="working"?{step:e,title:`With ${me(t)} \u2014 working`,acts:[n],live:!0}:e==="asks"?{step:e,title:`With ${me(t)} \u2014 it asks you`,acts:[]}:e==="stuck"?{step:e,title:`With ${me(t)} \u2014 silent for ${wa(r?.at)}`,acts:[n]}:e==="review"?null:Xt(t)==="review"&&l?{step:"review",title:`To check \u2014 ${l} ${l==="You"?"say":"says"} done`,acts:a}:!e&&!t.assignee&&t.status!=="done"&&s.me&&!_t()?{step:"anyone",title:"Anyone",acts:[{act:"hand",v:"me",icon:qt,tip:"Take it myself"},{act:"hand",v:"agent",icon:zt(13),tip:`Give it to ${me(t)}`},{act:"give",icon:Hr,tip:"Give it to someone",pick:!0}]}:null;return f?`<div class="dt-step dt-step--${f.step}">${f.step==="anyone"?jo:""}<span class="dt-step-text"><b>${g(f.title)}</b></span>${f.acts.map(u=>u.pick?`<label class="dt-step-act" data-tip="${g(u.tip)}">${u.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${g(u.tip)}"><option value="" selected hidden></option>${_e().map(P=>`<option value="${g(P.email)}"${Ds(P.email)}>${g(P.email===s.me?.email?`Me \xB7 ${P.name||P.email}`:P.name||P.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="${g(u.tip)}" aria-label="${g(u.tip)}">${u.icon}</button>`).join("")}${f.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`:""},il=async(t,e)=>{let n=e?V.find(a=>a.id===t):void 0,o=await y(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,stage:Ea(V.find(a=>a.id===t))});return o.ok&&n&&mo(he(n)).then(a=>{a&&y({id:t,after:a})}),o},Qs=0,ns=t=>(Qs++,t.finally(()=>{Qs--})),Qt=async(t,e,n)=>{let o=V,a=wt;V=t(V),wt=t(wt),Q();let r=await ns(e()).catch(()=>null);if(!r?.ok){V=o,wt=a,Q(),Rn(`${n} did not go through`,r);return}let l=pn([await r.json().catch(()=>null)])[0];l&&(V=V.map(f=>f.id===l.id?l:f),wt=wt.map(f=>f.id===l.id?l:f),Q()),Ye()},Ea=t=>t?kt(t.assignee)?"approved":t.assignee?"progress":"new":"new",Le=async(t,e)=>{await Qt(r=>r.map(l=>l.id===t?{...l,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{stage:Ea(l),reopenedAt:new Date().toISOString(),reopenedBy:s.me?.email??"you"}}:l),()=>il(t,e),e?"Resolving":"Reopening");let n=wt.find(r=>r.id===t),o=n?.from,a=o&&wt.find(r=>r.id===o.id);e&&n?.status==="done"&&a&&$t(a)&&!$t(n)&&a.status!=="done"&&(await y({id:a.id,reply:"Fixed \u2014 please check.",status:"done",doneBy:"you"}).catch(()=>null),Ye())},Ue=async(t,e,n=!1)=>{let o=V.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await Qt(r=>r.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?s.me?.email:void 0}:l),()=>y({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!n&&Re(`Archived #${t}`,()=>Ue(t,!1,!0))},Re=(t,e,n="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${g(t)}</span><button type="button">${g(n)}</button>`,Wt(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>o.remove(),5e3)},to=t=>Qt(e=>e.filter(n=>n.id!==t),()=>At(`comments?id=${t}`,{method:"DELETE"}),"Deleting"),rl=t=>{let e=V.filter(a=>S(a)===t),n=e.filter(a=>ht(a)==="open").length,o=e.filter(a=>ht(a)==="claude").length;we.innerHTML=n?String(n):o?zt(9):"\u2713",we.dataset.state=n?"open":o?"claude":"done",we.hidden=e.length===0},eo=0,Ma,Ln=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t)return;t.style.translate="";let e=window.visualViewport,n=t.getBoundingClientRect(),o=n.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,n.top-8)}px`)};window.visualViewport?.addEventListener("resize",Ln),addEventListener("resize",Ln),document.addEventListener("focusin",Ln),document.addEventListener("focusout",()=>setTimeout(Ln));let Q=()=>{requestAnimationFrame(Ln);let t=eo-performance.now();if(t>0){clearTimeout(Ma),Ma=setTimeout(Q,t);return}if(wn(),b){let c=ya(),U=JSON.stringify(c);U!==va&&(va=U,parent.postMessage({dt:!0,drafts:c},location.origin))}Po(),q.toggleAttribute("data-yield",tt!=null||!!T),tt!==Et&&(Ht="",Bt=[],Et=tt),gt&&gt.id!==tt&&(gt=null);let e=xe();if(rl(e),Ss(),!Tt){J.innerHTML="",Cs(null),xt.hidden=!0;return}let n=e;if(tt!=null&&!T){let c=V.find(U=>U.id===tt);c&&S(c)!==n&&(tt=null)}let o="",a=V.filter(c=>S(c)===n&&(Ro(c)&&on(c)||c.id===tt));for(let c of a){let U=Zt(c);if(!U&&tt!==c.id)continue;let I=ht(c),K=!U,_=U??{x:0,y:0},Rt=Qe(c.category),Dt=De(c),de=I==="done"?null:ne(c),pt=de?Os[de]??"":"",dt=Es(c,I),Te=!!dt&&!dt.taker,ce=!!dt&&!!dt.taker&&dt.taker!==dt.writer,gn=pt||xn.find(Xe=>Xe[0]===ln(c))[2],xo=dt?Te?` \xB7 ${Is(dt.writer,c)} \xB7 nobody has it yet`:` \xB7 ${ce?`${Is(dt.writer,c)} \u2192 `:""}${Is(dt.taker,c)}${dt.claude?` \xB7 Claude${Dt?" is working":de==="asks"?" asks":de==="review"||I==="claude"?" fixed it":""}`:""}`:"";if(tt===c.id&&yr(c),K||(o+=`<button class="dt-pin dt-pin--${I}${I==="done"&&!re(c)?" dt-pin--resolved":""}${dt?` dt-pin--people${Te?" dt-pin--nobody":""}${ce?" dt-pin--pair":""}`:pt?" dt-pin--agent":""}${Dt?" dt-pin--working":""}${I==="open"&&Xt(c)==="review"?" dt-pin--review":""}${U?.hidden?" dt-pin--hidden":""}${tt!==c.id&&!ea(c,pe)?" dt-pin--dim":""}" data-id="${c.id}"${U?.off?` data-off="${U.off}"`:""} aria-label="Comment ${c.id}, ${I==="open"?"open":I==="claude"?`resolved by ${g(Ve(c.doneAgent,c.doneFor))}`:"resolved"}" aria-expanded="${tt===c.id}"
237
+ style="left:${_.x}px;top:${_.y}px;--cat:${Rt.color};--ring:${gn};--hue:${$n(c.by||c.byName||"")}${pt?`;--step-c:${pt}`:""}"
238
+ title="${g(c.text.slice(0,80))} \xB7 ${Rt.label}${dt?g(xo):Dt?` \xB7 ${g(Ve(Dt.agent,Dt.by))} is on it`:""}${I==="claude"?` \xB7 resolved by ${g(Ve(c.doneAgent,c.doneFor))} \u2014 tick to confirm`:I==="done"?" \xB7 resolved":""}${bo(c)?" \u2014 drag to move":""}"${bo(c)?" data-move":""}>${I==="done"?"\u2713":dt?`${Go(dt.writer,c)}${ce?Go(dt.taker,c):""}${dt.claude?`<i class="dt-pin-claude" aria-hidden="true">${zt(8)}</i>`:""}`:pt?zt(11):Ko(c)}${I!=="done"&&tt!==c.id&&Xo(c)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}</button>`),tt===c.id){let Xe=Oe(c),Fl=ne(c)==="review"&&!s.client?Xe.map(rt=>rt.author).lastIndexOf("claude"):-1;o+=`<div class="dt-note${K?" dt-note--orphan":""}" data-id="${c.id}" role="dialog" aria-label="Comment ${c.id}"
239
+ style="left:${_.x}px;top:${_.y}px">
224
240
  <div class="dt-note-bar">
225
- <span class="dt-note-el"${s.client?"":` data-tip="${ao(u.selector,u.label)}"`}>${s.client?`Comment #${u.id>0?u.id:"\u2026"}`:h(os(u.tag,u.classes))}</span>
241
+ <span class="dt-note-el"${s.client?"":` data-tip="${Qo(c.selector,c.label)}"`}>${s.client?`Comment #${c.id>0?c.id:"\u2026"}`:g(Js(c.tag,c.classes))}</span>
226
242
  <span class="dt-note-tools">
227
- ${!s.client&&u.shared?`<span class="dt-note-eye" data-tip="The client sees this thread" role="img" aria-label="The client sees this thread">${ho}</span>`:""}
228
- ${To(u)}
243
+ ${xa(c)}
229
244
  <i class="dt-note-sep"></i>
230
- ${po(u.shared,u.id)}
231
- <button data-act="close" data-id="${u.id}" data-tip="Close" aria-label="Close">${ye}</button>
245
+ ${kn(c)?"":ia(c)}
246
+ <button data-act="close" data-id="${c.id}" data-tip="Close" aria-label="Close">${qe}</button>
232
247
  </span>
233
248
  </div>
234
249
  ${K?'<p class="dt-note-orphan">Not on this page any more \u2014 the element was removed or changed since. The thread stays: answer or resolve it here.</p>':""}
235
- <div class="dt-note-hidden"${Z?.hidden?"":" hidden"}>${yi}<p><b>Hidden right now</b>It sits inside \xAB${h(wi(Z?.hidden))}\xBB, which is closed. Open it on the page and the pin moves onto the spot.</p><button type="button" data-act="where" data-id="${u.id}">Show where</button></div>
236
- ${(()=>{let tt=(s.client?"":fi(u))+(u.host&&u.host!==location.host?`<span class="dt-note-host" title="Written on ${h(u.host)}">${h(u.host)}</span>`:"");return tt?`<div class="dt-note-meta">${tt}</div>`:""})()}
250
+ <div class="dt-note-hidden"${U?.hidden?"":" hidden"}>${Ar}<p><b>Hidden right now</b>It sits inside \xAB${g(Cr(U?.hidden))}\xBB, which is closed. Open it on the page and the pin moves onto the spot.</p><button type="button" data-act="where" data-id="${c.id}">Show where</button></div>
251
+ ${(()=>{let rt=(kn(c)||_t()?Lr(c):Er(c))+(c.host&&c.host!==location.host?`<span class="dt-note-host" title="Written on ${g(c.host)}">${g(c.host)}</span>`:"");return rt?`<div class="dt-note-meta">${rt}</div>`:""})()}
252
+ ${kr(c)}
237
253
  <div class="dt-note-thread">
238
- ${Ct.map((tt,ve)=>{let Ke=ve===0?null:tt.at??null,He=tt.author==="you"&&(!tt.by||tt.by===s.me?.email),va=He&&lt?.id===u.id&&lt.at===Ke,an=s.team?.find(Hs=>Hs.email===tt.by),ya=tt.author==="claude"?Le(tt.agent,tt.by):He?"You":an?.name||tt.byName||tt.by||"You",wa=tt.author==="claude"?an?.agent_avatar_url?`<img class="dt-msg-face" src="${h(an.agent_avatar_url)}" alt="">`:`<span class="dt-msg-face dt-msg-ai">${Xt(11)}</span>`:an?.avatar_url?`<img class="dt-msg-face" src="${h(an.avatar_url)}" alt="">`:"",As=`${u.id}:${tt.at??"0"}`,In=ce.get(As),$a=!He&&s.voice&&tt.text?`<button class="dt-msg-edit${ce.has(As)?" is-on":""}" data-act="translate" data-id="${u.id}" data-at="${h(tt.at??"0")}" title="${ce.has(As)?"Show the original":"Translate into your language"}">${Vi}</button>${zi(u.id,tt.at??"0")}`:"",xa=`<div class="dt-msg-head">${wa}<b>${h(ya)}</b><time>${cn(tt.at)}</time>${$a}${He&&!va?`<button class="dt-msg-edit" data-act="edit" data-id="${u.id}" data-at="${h(Ke??"")}" title="Edit">${un}</button>${Ke?`<button class="dt-msg-edit" data-act="unsay" data-id="${u.id}" data-at="${h(Ke)}" title="Delete">${Pe}</button>`:""}`:""}</div>`;return ve===fe?`<div class="dt-msg dt-msg--done" data-msg="${u.id}:${h(tt.at??"0")}"><div class="dt-msg-head">${wa}<b>${h(ya)} fixed it</b><time>${cn(tt.at)}</time>${$a}</div><p${In===null?' class="is-asking"':""}>${ea(In||tt.text)}</p>${es(tt.images)}
239
- <div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${u.id}">${Wt}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${u.id}">${Re}Send back</button></div></div>`:va?`<div class="dt-msg">${xa}<div class="dt-compose">
240
- <textarea class="dt-note-edit-input" rows="1">${h(lt.text)}</textarea>
241
- ${es(tt.images.filter(Hs=>!lt.drop.includes(Hs.split("/").pop())),u.id)}
254
+ ${Mr(c,Xe.map((rt,hs)=>{let ms=hs===0?null:rt.at??null,gs=rt.author==="you"&&(!rt.by||rt.by===s.me?.email),yi=gs&&gt?.id===c.id&&gt.at===ms,Pn=s.team?.find(In=>In.email===rt.by),vi=rt.author==="claude"?Ve(rt.agent,rt.by):gs?"You":Pn?.name||rt.byName||rt.by||"You",wi=rt.author==="claude"?Pn?.agent_avatar_url?`<img class="dt-msg-face" src="${g(Pn.agent_avatar_url)}" alt="">`:`<span class="dt-msg-face dt-msg-ai">${zt(11)}</span>`:Pn?.avatar_url?`<img class="dt-msg-face" src="${g(Pn.avatar_url)}" alt="">`:"",Eo=`${c.id}:${rt.at??"0"}`,fs=Me.get(Eo),$i=!gs&&s.voice&&rt.text?`<button class="dt-msg-edit${Me.has(Eo)?" is-on":""}" data-act="translate" data-id="${c.id}" data-at="${g(rt.at??"0")}" title="${Me.has(Eo)?"Show the original":"Translate into your language"}">${tl}</button>${Qr(c.id,rt.at??"0")}`:"",bs=c.id<=0?null:hs===0?"":c.replies?.some(In=>In.at===rt.at)?rt.at:null,Mo=bs===null?"":nl(c.id,bs,rt.reactions),jl=bs!==null&&!Mo?`<button class="dt-msg-edit" data-act="react-pick" data-id="${c.id}" data-at="${g(bs)}" data-tip="Add reaction" aria-label="Add reaction">${ma}</button>`:"",xi=`<div class="dt-msg-head">${wi}<b>${g(vi)}</b><time>${Je(rt.at)}</time>${jl}${$i}${gs&&!yi?`<button class="dt-msg-edit" data-act="edit" data-id="${c.id}" data-at="${g(ms??"")}" title="Edit">${Fn}</button>${ms?`<button class="dt-msg-edit" data-act="unsay" data-id="${c.id}" data-at="${g(ms)}" title="Delete">${Ze}</button>`:""}`:""}</div>`;return hs===Fl?`<div class="dt-msg dt-msg--done" data-msg="${c.id}:${g(rt.at??"0")}"><div class="dt-msg-head">${wi}<b>${g(vi)} fixed it</b><time>${Je(rt.at)}</time>${$i}</div><p${fs===null?' class="is-asking"':""}>${ti(fs||rt.text)}</p>${Us(rt.images)}${Mo}
255
+ <div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${c.id}">${qt}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${c.id}">${Ae}Send back</button></div></div>`:yi?`<div class="dt-msg">${xi}<div class="dt-compose">
256
+ <textarea class="dt-note-edit-input" rows="1" maxlength="${Xs}" aria-label="Edit the message">${g(gt.text)}</textarea>
257
+ ${Us(rt.images.filter(In=>!gt.drop.includes(In.split("/").pop())),c.id)}
242
258
  <div class="dt-compose-bar">
243
259
  <button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
244
- <button class="dt-send${lt.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${Wt}</button>
260
+ <button class="dt-send${gt.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${qt}</button>
245
261
  </div>
246
- </div></div>`:`<div class="dt-msg" data-msg="${u.id}:${h(tt.at??"0")}">${xa}<p${In===null?' class="is-asking"':""}>${ea(In||tt.text)}</p>${ve===0&&u.suggest?gi(u.suggest):""}${es(tt.images)}</div>`}).join("")}
262
+ </div></div>`:`<div class="dt-msg" data-msg="${c.id}:${g(rt.at??"0")}">${xi}<p${fs===null?' class="is-asking"':""}>${ti(fs||rt.text)}</p>${hs===0&&c.suggest?$r(c.suggest):""}${Us(rt.images)}${Mo}</div>`}))}
247
263
  </div>
248
- ${Yi(u)}
249
- ${Mo("dt-note-reply-input",Qt(u)==="asks"?`Answer ${h(se(u))}`:"Reply",Ft,`data-act="reply" data-id="${u.id}"`,$o(wt))}
250
- ${uo(u.priority,u.category,u.id,u.assignee??"",Is(u))}
251
- </div>`}}St.forEach((u,Z)=>{let D=zt(u);D&&(o+=`<button class="dt-pin dt-pin--draft" data-parked="${Z}" data-act="draft-open" data-i="${Z}"
252
- style="left:${D.x}px;top:${D.y}px" title="Draft, not sent \u2014 click to finish it">${un}</button>`)});let r=M&&zt(M);if(M){let u=r?.x??0,Z=r?.y??0;o+=`${r?`<span class="dt-pin dt-pin--draft" data-draft style="left:${u}px;top:${Z}px"></span>`:""}
253
- <div class="dt-note${r?"":" dt-note--orphan"}" data-draft style="left:${u}px;top:${Z}px">
264
+ ${al(c)}
265
+ ${ba("dt-note-reply-input",ne(c)==="asks"?`Answer ${g(me(c))}`:"Reply",Ht,`data-act="reply" data-id="${c.id}"`,ua(Bt))}
266
+ ${na(c.priority,c.category,c.id,c.assignee??"",Ms(c),kn(c),$t(c))}
267
+ </div>`}}Nt.forEach((c,U)=>{let I=Zt(c);I&&(o+=`<button class="dt-pin dt-pin--draft" data-parked="${U}" data-act="draft-open" data-i="${U}"
268
+ style="left:${I.x}px;top:${I.y}px" title="Draft, not sent \u2014 click to finish it">${Fn}</button>`)});let r=T&&Zt(T);if(T){let c=r?.x??0,U=r?.y??0;o+=`${r?`<span class="dt-pin dt-pin--draft" data-draft style="left:${c}px;top:${U}px"></span>`:""}
269
+ <div class="dt-note${r?"":" dt-note--orphan"}" data-draft style="left:${c}px;top:${U}px">
254
270
  <div class="dt-note-bar">
255
- <span class="dt-note-el"${s.client?"":` data-tip="${ao(M.selector,M.label)}"`}>${s.client?"New comment":h(os(M.tag,M.classes))}</span>
256
- ${Ee()?'<span class="dt-note-draft">Draft</span>':""}
271
+ <span class="dt-note-el"${s.client?"":` data-tip="${Qo(T.selector,T.label)}"`}>${s.client?"New comment":g(Js(T.tag,T.classes))}</span>
272
+ ${C()?'<span class="dt-note-draft">Draft</span>':""}
257
273
  <span class="dt-note-tools">
258
- ${!s.client&&M.shared?`<span class="dt-note-eye" data-tip="The client will see this thread" role="img" aria-label="The client will see this thread">${ho}</span>`:""}
259
- ${po(M.shared)}
260
- <button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${ye}</button>
274
+
275
+ ${ia()}
276
+ <button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${qe}</button>
261
277
  </span>
262
278
  </div>
263
279
  ${r?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
264
- ${(()=>{let D=r?ne(M):null,K=D&&Y.find(Et=>Et.id>0&&pt(Et)==="open"&&ne(Et)===D);return K?`<p class="dt-note-twin">Already open here: \u201C${h(K.text.slice(0,60))}${K.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${K.id}">Open it</button></p>`:""})()}
265
- ${s.client?`<div class="dt-note-meta">${Mi(M.assignee)}</div>`:""}
266
- ${M.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">${ye}</button></span>
267
- <span class="dt-suggest-was">Now: <del>${h(M.suggest.from.slice(0,160))}${M.suggest.from.length>160?"\u2026":""}</del></span>
268
- <textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${h(M.suggest.to)}</textarea>
280
+ ${(()=>{let I=r?he(T):null,K=I&&V.find(_=>_.id>0&&ht(_)==="open"&&he(_)===I);return K?`<p class="dt-note-twin">Already open here: \u201C${g(K.text.slice(0,60))}${K.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${K.id}">Open it</button></p>`:""})()}
281
+ ${s.client?`<div class="dt-note-meta">${Br(T.assignee)}</div>`:""}
282
+ ${T.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">${qe}</button></span>
283
+ <span class="dt-suggest-was">Now: <del>${g(T.suggest.from.slice(0,160))}${T.suggest.from.length>160?"\u2026":""}</del></span>
284
+ <textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${g(T.suggest.to)}</textarea>
269
285
  <span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
270
- ${Mo("dt-note-input",M.suggest?"Why (optional)":"Comment",M.text??"",'data-act="save"',$o(M.images))}
271
- ${uo(M.priority,M.category,void 0,M.assignee??"")}
272
- </div>`}let l=new Map([...U.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(u=>[u.closest(".dt-note").dataset.id,{top:u.scrollTop,end:u.scrollTop+u.clientHeight>=u.scrollHeight-4}])),g=new Set([...U.querySelectorAll("[data-msg]")].map(u=>u.dataset.msg)),S=U.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");U.innerHTML=o,S&&Nn(".dt-note-reply-input");for(let u of U.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let Z=u.closest(".dt-note").dataset.id,D=l.get(Z);if(!D)continue;let K=[...u.querySelectorAll("[data-msg]")].filter(Et=>!g.has(Et.dataset.msg));for(let Et of K)Et.classList.add("dt-msg--new");u.scrollTop=D.end&&K.length?u.scrollHeight:D.top}for(let u of U.querySelectorAll(".dt-note")){let Z=u.getBoundingClientRect();Z.bottom>innerHeight-8&&(u.dataset.flip="1"),Z.right>innerWidth-8&&(u.dataset.flipx="1")}en(n),Vn(Kn()),oe();for(let u of U.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Ms(u);let R=U.querySelector(".dt-note-input");R&&(R.focus(),R.setSelectionRange(R.value.length,R.value.length))},Zi=()=>{let t=!1,e=[];for(let n of U.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(n.classList.contains("dt-note--orphan")||n.classList.contains("is-dragging"))continue;let o=Y.find(r=>r.id===Number(n.dataset.id)),a=o&&zt(o);e.push([n,a]),a&&Us(a.el)&&(t=!0)}for(let n of U.querySelectorAll("[data-draft], [data-parked]")){if(n.classList.contains("dt-note--orphan"))continue;let o=n.dataset.parked?St[Number(n.dataset.parked)]:M;e.push([n,o?zt(o):null])}for(let[n,o]of e){if(!o){n.style.visibility="hidden";continue}n.style.visibility="",n.style.left=`${o.x}px`,n.style.top=`${o.y}px`,n.matches(".dt-pin[data-id]")&&(o.off?n.dataset.off=o.off:delete n.dataset.off,n.classList.toggle("dt-pin--hidden",!!o.hidden)),n.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!o.hidden)}if(!gn.length&&(M||st!=null)){let n=Kn();n&&Us(n)&&Vn(n)}Ge(M||st!=null?Kn():null),t&&oe()},en=t=>{if(!j.hidden&&(j.innerHTML=Xa({bp:t,notes:Y,breakpoints:d,bandOfNote:k,orphan:e=>!zt(e),hiddenNow:e=>!!zt(e)?.hidden,whoseAgent:Le,statusTools:e=>To(e,!so(e)),showResolved:Tt,showArchived:te,archived:ee,drafts:Dt.hidden?ko():as,checks:w?0:kn.toCheck().length,marker:tr,assign:so,find:jt,forMe:Qi,forAgent:e=>!!Qt(e)&&pt(e)!=="done",unread:no}),_e)){let e=j.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(_e.at,_e.at),_e=null}},_e=null,Qi=t=>{if(pt(t)==="done"||!s.me)return!1;if(t.assignee===s.me.email||pt(t)==="claude"||Ht(t)==="review"&&t.assignee!==s.me.email)return!0;let e=(s.me.name||s.me.email).split(/[\s@]/)[0].toLowerCase();return Be(t).some(n=>n.text.toLowerCase().includes("@"+e))},tr=t=>{if(pt(t)==="done")return'<span class="dt-hist-n"></span>';let n=Jn[Qt(t)??""];if(n)return`<span class="dt-hist-face dt-hist-face--agent" style="--step-c:${n}">${Xt(10)}</span>`;let o=Qs(t);return o?`<span class="dt-hist-face" style="--ring:${Qn.find(a=>a[0]===fn(t))[2]};--hue:${to(t.by||t.byName||"")}">${o}</span>`:`<span class="dt-hist-n" style="--cat:${Ie(t.category).color}"></span>`},cs=t=>j.toggleAttribute("data-collapsed",t);j.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(jt.q=e.value,_e={at:e.selectionStart??e.value.length},en(Me()))}),j.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await on(),setTimeout(()=>delete e.dataset.spin,500);return}if(j.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){cs(!1);return}if(t.target.closest("[data-fold]")){cs(!j.hasAttribute("data-collapsed"));return}let n=t.target.closest(".dt-hist-bands [data-bp]");if(n){ra(n.dataset.bp);return}let o=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(o){o.dataset.histView?(jt.view=o.dataset.histView,q("dt-view",jt.view),jt.menu=!1):o.dataset.histSort?(jt.sort=o.dataset.histSort,q("dt-sort",jt.sort),jt.menu=!1):o.hasAttribute("data-hist-clear")?(jt.q="",_e={at:0}):jt.menu=!jt.menu,en(Me());return}jt.menu&&!t.target.closest(".dt-hist-menu")&&(jt.menu=!1,en(Me()));let a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){let D=a.dataset.draftRm!==void 0,K=Number(D?a.dataset.draftRm:a.dataset.draftGo);Dt.hidden?D?Ho(K):ps(K):Gt(D?{dropDraft:K}:{openDraft:K});return}let r=t.target.closest("[data-unmark]");if(r){t.stopPropagation(),await Se(Number(r.dataset.unmark),!1);return}let l=t.target.closest(".dt-hist-tools [data-act]");if(l){await Se(Number(l.dataset.id),l.dataset.act==="done");return}let g=t.target.closest("[data-rm]");if(g){st=null,await ls(Number(g.dataset.rm));return}if(t.target.closest("[data-review]")){kn.start();return}if(t.target.closest("[data-resolved]")){ms(!Tt);return}if(t.target.closest("[data-archived]")){gs(!te);return}let S=t.target.closest("[data-archive-all]");if(S){let D=S.dataset.archiveAll.split(",").map(Number);for(let K of D)await Te(K,!0,!0);Qe(`Archived ${D.length}`,()=>{for(let K of D)Te(K,!1,!0)});return}let R=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(R){await Te(Number(R.dataset.id),R.dataset.act==="archive");return}let u=t.target.closest("[data-go]");if(!u)return;let Z=Number(u.dataset.go);if(!Dt.hidden){Gt({open:Z});return}us(Z)});let us=t=>{st=t,v(),G();let e=Y.find(o=>o.id===t),n=e&&zt(e);n?scrollTo({top:scrollY+n.y-innerHeight/2,behavior:"smooth"}):e&&ne(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||U.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},ps=t=>{let[e]=St.splice(t,1);if(!e)return;v(),M=e,st=null;let n=zt(e);n&&(n.y<0||n.y>innerHeight)&&scrollTo({top:scrollY+n.y-innerHeight/3,behavior:"instant"}),G()},Ho=t=>{St.splice(t,1),G()},kn=Ja({inFrame:w,everything:()=>Kt,route:()=>L,settle:Se,keepIn:$e,toast:t=>ue(t),waits:t=>pt(t)==="claude"||pt(t)==="done"&&!ee(t),approve:t=>pt(t)==="claude"?Se(t.id,!0):Te(t.id,!0,!0),open:t=>{if(kt||ge(!0),k(t)!==Me()){ra(k(t));for(let e of[600,1500])setTimeout(()=>Gt({open:t.id}),e)}else us(t.id)}}),er=t=>{j.hidden=!t,P.setAttribute("aria-pressed",String(t)),q("dt-history",t?"1":"0"),G()},hs=document.querySelector(".dt-resolved-btn"),ms=t=>{Tt=t,hs.setAttribute("aria-pressed",String(t)),q("dt-resolved",t?"1":"0"),Gt({resolved:t}),G(),Ae(!0)},gs=t=>{te=t,q("dt-archived",t?"1":"0"),Gt({archived:t}),G(),Ae(!0)};hs.addEventListener("click",()=>ms(!Tt)),hs.setAttribute("aria-pressed",String(Tt)),P.addEventListener("click",()=>{let t=j.hidden===!0;t&&!kt&&ge(!0),t&&cs(!1),er(t)});let oe=()=>{xe||!kt||(xe=requestAnimationFrame(()=>{xe=0,Zi()}))},Bo=`${we}, .dt-where, .dt-spot, .dt-drag-box, .dt-room, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,nr=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Bo))return!0;let n=[...t.addedNodes,...t.removedNodes];return n.length>0&&n.every(o=>o instanceof Element&&o.matches(Bo))},No=new MutationObserver(t=>{t.every(nr)||(Ks(),oe())}),Po=new ResizeObserver(()=>oe()),Ro=()=>{U.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&oe()},Kt=[],Io=()=>{},nn=new Set,_t={at:"",ids:[]},sr=t=>{Kt=t,queueMicrotask(()=>Io());let e=()=>({new:0,progress:0,review:0,waiting:0,accepted:0,done:0}),n={};for(let g of t){if(ee(g))continue;let S=pt(g),R=Qt(g),u=S==="done"?"done":S==="claude"?"review":R&&vn[R]||fn(g),Z=n[g.route??""]??={...e(),bands:{}};Z[u]++;let D=k(g);(Z.bands[D]??=e())[u]++}let o=["new","progress","review","waiting","accepted","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",accepted:"accepted",done:"resolved"},r=g=>o.map(S=>[S,S==="done"&&!Tt?0:g[S]]),l=g=>r(g).reduce((S,[,R])=>S+R,0);for(let g of document.querySelectorAll(".dt-pages a")){let S=g.querySelector(".dt-pages-n");if(!S)continue;let R=n[new URL(g.href).pathname.replace(/\/+$/,"")||"/"];for(let D of d){let K=R?.bands[D.id];for(let[Et,le]of r(K??e())){let de=S.querySelector(`[data-bp="${D.id}"][data-state="${Et}"]`);de.hidden=!le,le&&(de.querySelector("i").textContent=String(le),de.title=`${D.label}: ${le} ${a[Et]}`)}}let u=R?l(R):0;S.hidden=!u;let Z=R?d.filter(D=>R.bands[D.id]&&l(R.bands[D.id])).map(D=>`${D.label} ${l(R.bands[D.id])}`).join(" \xB7 "):"";S.title=u?`${o.filter(D=>R[D]).map(D=>`${R[D]} ${a[D]}`).join(" \xB7 ")}
273
- ${Z}`:""}},Ln=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"):[]})),or=Za(w,t=>ue(t)),Ut=document.querySelector(".dt-push"),ae=Ut.querySelector(".dt-push-menu"),ie=new Set,We=new Set,Sn=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",Tn=()=>s.client||me()||w?[]:Kt.filter(t=>t.status!=="done"&&$t(t.assignee)&&Ht(t)==="approved"&&!Ne(t)&&!ee(t)&&!nn.has(t.id)),Cn=()=>Tn().filter(t=>!ie.has(t.id)),Oo=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?Wt:""}</i>`,Do=()=>{let t=Tn(),e=[...new Set(t.map(o=>o.route??"/"))],n=Cn().length;ae.innerHTML=`<div class="dt-push-head">${Xt(14)}<b>Waiting for Claude</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),r=a.filter(l=>!ie.has(l.id)).length;return`<button type="button" class="dt-push-page${We.has(o)?" is-open":""}" data-push-route="${h(o)}"><span data-push-fold="${h(o)}">${We.has(o)?"\u25BE":"\u25B8"}</span>${Oo(r>0,r>0&&r<a.length)}<span class="dt-push-route">${h(o)}</span><em>${a.length}</em></button>`+(We.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${Oo(!ie.has(l.id))}<span><small>#${l.id}</small>${h(l.text.slice(0,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${n?"":" disabled"}>${Xt(13)}Send ${n} to Claude</button>`},bs=()=>["push","paused"].includes(Sn()),fs=()=>_t.ids.filter(t=>{let e=Kt.find(n=>n.id===t);return!!e&&e.status!=="done"&&Ht(e)!=="review"&&(nn.has(t)||!!Ne(e)||Ht(e)==="approved")}),qo="",ar=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Ce=()=>{let t=Sn(),e=Cn().length,n=fs(),o=_t.ids.length-n.length,a=n.length>0&&bs();if(Ut.classList.toggle("is-working",a),n.length&&(qo=_t.at),!n.length&&_t.ids.length&&_t.at&&qo===_t.at&&!ar(_t.at)){try{sessionStorage.setItem("nm-batch-done",_t.at)}catch{}Kt.length&&Qe(`Claude finished ${_t.ids.length} \u2014 check the fixes`,()=>kn.start(),"Check")}Ut.hidden=s.client||me()||w,Ut.classList.toggle("is-live",bs()),Ut.classList.toggle("is-quiet",t==="on");let r=Ut.querySelector(".dt-push-n");r.textContent=String(a?n.length:e),r.hidden=a?!1:!e||t==="on",Ut.querySelector(".dt-push-all").dataset.tip=a?`Push to Claude: Claude is on ${n.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to Claude: turbo is on \u2014 Claude takes each comment as it lands":t==="none"?`Push to Claude: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to Claude: ${e} ${e===1?"comment waits":"comments wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to Claude: nothing waits for Claude yet \u2014 mark comments for Claude, then send them here",document.querySelector(".devtools")?.style.setProperty("--dt-push-w",Ut.hidden?"0px":`${Ut.offsetWidth+8}px`),(Ut.hidden||!Tn().length)&&(ae.hidden=!0),ae.hidden||Do()},Fo=async t=>{if(!t.length&&bs()){ue("Nothing waits for Claude \u2014 mark comments for Claude first");return}if(Sn()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),ue("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(Sn()==="on"){ue("Turbo is on \u2014 Claude takes each comment as it lands");return}ae.hidden=!0;let e=t.map(o=>o.id),n=await At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(!n?.ok){Bn("Could not send them to Claude",n);return}for(let o of e)nn.add(o);_t={at:_t.ids.some(o=>fs().includes(o))?_t.at:new Date().toISOString(),ids:[...new Set([...fs(),...e])]},Ce(),Qe(`${e.length} sent to Claude \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)nn.delete(o);Ce()}),on()},An=Ut.querySelector(".dt-push-all"),jo=0,vs=!1,_o=()=>{ae.hidden=!1,Do()};An.addEventListener("click",()=>{if(vs){vs=!1;return}Fo(Cn())}),An.addEventListener("contextmenu",t=>{t.preventDefault(),ae.hidden?_o():ae.hidden=!0}),An.addEventListener("pointerdown",t=>{t.button===0&&(jo=window.setTimeout(()=>{vs=!0,_o()},500))});for(let t of["pointerup","pointerleave","pointercancel"])An.addEventListener(t,()=>clearTimeout(jo));ae.addEventListener("click",t=>{let e=t.target,n=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),r=e.closest("[data-push]")?.dataset.push;if(r==="send"){Fo(Cn());return}if(r==="all")ie.clear();else if(n){let l=n.dataset.pushFold;We.has(l)?We.delete(l):We.add(l)}else if(o){let l=Tn().filter(S=>(S.route??"/")===o.dataset.pushRoute),g=l.some(S=>!ie.has(S.id));for(let S of l)g?ie.add(S.id):ie.delete(S.id)}else if(a){let l=Number(a.dataset.pushId);ie.has(l)?ie.delete(l):ie.add(l)}Ce()}),document.addEventListener("pointerdown",t=>{!ae.hidden&&!Ut.contains(t.target)&&(ae.hidden=!0)},!0),setInterval(Ce,3e4),Io=Ce;let Wo=document.querySelector(".dt-turbo");Wo&&new MutationObserver(Ce).observe(Wo,{attributes:!0,attributeFilter:["data-state"]}),Ce();let Hn="",ys=!1,zo=t=>{Hn=t.version??"",or(t);let e=t.turbo;nn=new Set(e?.push?.ids??[]),_t={at:e?.batch?.at??"",ids:e?.batch?.ids??[]};let n=Ln(t.comments);sr(n);let o=n.filter(a=>a.route===L);if(JSON.stringify(o)===JSON.stringify(Y)){!j.hidden&&!w&&G();return}if(U.contains(document.activeElement)&&document.activeElement.matches("textarea, input")){Hn="",setTimeout(sn,5e3);return}Y=o,G(),Gt({reload:!0})},Ae=async(t=!1)=>{let e=[t||!Hn?"":`since=${Hn}`,Tt||te?"":"open=1"].filter(Boolean).join("&");try{let n=await At(`comments${e?`?${e}`:""}`);n.status===200&&zo(await n.json())}catch{}},sn=async()=>{document.hidden||ys||is||(ys=!0,await Ae(),ys=!1)},ws=()=>{Y=Kt.filter(t=>t.route===L),G()},$s=0,Vo=t=>{$s||($s=requestAnimationFrame(()=>{$s=0;let e=t.target;if(!kt||e.closest(yt)){ft.hidden=!0;return}let n=document.elementFromPoint(t.clientX,t.clientY);if(ft.hidden=!1,!n)return;let o=n.getBoundingClientRect();Ot.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,Pt.textContent=n.tagName.toLowerCase()+([...n.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...n.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,Pt.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-20)}px`}))},Ko=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),lt){lt=null,G();return}if(M){v(),G();return}if(st!==null){st=null,G();return}ge(!1)}},Uo=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],Go=t=>{t.target.closest?.(yt)||t.stopPropagation()},Yo=t=>{if(t.target.closest(yt))return;if(t.preventDefault(),t.stopPropagation(),Q){Q=!1;return}if(!getSelection()?.isCollapsed)return;U.hidden=!0;let n=document.elementFromPoint(t.clientX,t.clientY);if(U.hidden=!1,!n)return;v();let o=n.getBoundingClientRect(),a=n.tagName.toLowerCase(),r=[...n.classList].filter(g=>!/^(astro|svelte|css)-/.test(g)).slice(0,2);M={selector:Ws(n),tag:a,classes:r,nth:zs({tag:a,classes:r}).indexOf(n),rx:o.width?(t.clientX-o.left)/o.width:.5,ry:o.height?(t.clientY-o.top)/o.height:.5,label:Nt(n.textContent||"").slice(0,60),ctx:Vs(n),category:m[0].id};let l=s.client||me()?null:Xn();l&&(M.assignee=l,M.stage=$t(l)?"approved":"new"),Jo.set(M,ur().then(()=>xs(n))),st=null,ft.hidden=!0,G()},ir=2200,rr=900*1024,Xo=8*1024*1024,lr=3*1024*1024,dr=1200,cr=1600,xs=async t=>{let e=t instanceof HTMLElement?t:null;for(let a=0;e&&a<4&&e.parentElement&&e.parentElement!==document.body;a++){let r=e.getBoundingClientRect();if(r.width>=360&&r.height>=140)break;e=e.parentElement}let n=e?.getBoundingClientRect();if(!e||!n?.width||!n.height)return null;let o="";for(let a=e;a&&!o;a=a.parentElement){let r=getComputedStyle(a).backgroundColor;r&&r!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(r)&&(o=r)}if(!o){let[a,r,l]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);o=.299*a+.587*r+.114*l>140?"#111":"#fff"}try{let{domToWebp:a}=await import("modern-screenshot"),r=Math.min(1,dr/n.width,cr/n.height),l=await Promise.race([a(e,{scale:r,quality:.8,timeout:4e3,backgroundColor:o,filter:g=>!(g instanceof Element&&g.closest(we))}),new Promise(g=>setTimeout(()=>g(null),8e3))]);return l&&l.length<Xo?l:null}catch{return null}},Jo=new WeakMap,ur=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),ue=(t,e=2800)=>{let n=document.createElement("div");n.className="dt-toast",n.textContent=t,document.body.append(n),setTimeout(()=>n.remove(),e)},Bn=(t,e)=>ue(navigator.onLine?`${t}${e?` (${e.status})`:""}.`:`${t} \u2014 you are offline. Try again once you are back online.`,6e3),pr=t=>new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result)),n.readAsDataURL(t)}),hr=async t=>{let e=await createImageBitmap(t),n=Math.min(1,ir/Math.max(e.width,e.height));if(n===1&&t.size<=rr)return e.close(),pr(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*n),o.height=Math.round(e.height*n),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},Es=async(t,e)=>{let n=[],o=(a,r)=>n.push(`${xn}${a}\0${r}`);for(let a of t){let r,l=Ta(a.name)||Object.keys(ln).find(g=>ln[g]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,Bs.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>lr){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 3 MB from the bar`);continue}let g=await new Promise((S,R)=>{let u=new FileReader;u.onload=()=>S(String(u.result).split(",")[1]),u.onerror=R,u.readAsDataURL(a)}).catch(()=>"");g?n.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${Sa(a.name)||"file"};ext=${l};base64,${g}`):o(a.name,"Could not be read");continue}try{r=await hr(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>Xo){o(a.name,"Too large even after shrinking");continue}n.push(r)}if(n.length){if(!Number(e?.dataset.id)){M&&((M.images??=[]).push(...n),G());return}wt.push(...n),G(),Nn(".dt-note-reply-input")}},Zo=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);U.addEventListener("paste",t=>{let e=Zo(t.clipboardData?.items);e.length&&(t.preventDefault(),Es(e,t.target.closest(".dt-note")))}),U.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),U.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),U.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let n=Zo(t.dataTransfer?.items);n.length&&Es(n,e)});let Nn=t=>{let e=U.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},Qo=()=>{Nn(".dt-note-edit-input"),U.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Ms=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden"},mr=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),gr=()=>s.client||me()?[]:Fn(),ta=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();let n=mr(t);if(!n)return;let o=n[1].toLowerCase(),a=(s.team??[]).filter(l=>[l.name,l.nickname,l.email].some(g=>g?.toLowerCase().startsWith(o))).slice(0,5),r=gr().filter(l=>l.handle.toLowerCase().startsWith(o)||!!o&&"agent".startsWith(o)||!!o&&"claude".startsWith(o)).slice(0,4);!a.length&&!r.length||t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...a.map(l=>`<button type="button" role="option" data-act="mention" data-handle="${h(Ca(l))}">${bn(l.avatar_url,l.name||l.email)}<span class="dt-mention-who"><b>${h(l.name||l.email)}</b>${l.name?`<span>${h(l.email)}</span>`:""}</span></button>`),...r.map(l=>`<button type="button" role="option" data-act="mention" data-handle="${h(l.handle)}">${hi(l.owner)}<span class="dt-mention-who"><b>${h(l.handle)}</b><span>${l.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((l,g)=>l.replace('role="option"',`role="option" aria-selected="${g===0}"`)).join("")}</div>`)},ea=t=>{let e=[...(s.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...Fn().map(o=>o.handle)].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>h(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=h(t);return e.length?n.replace(new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"),o=>`<span class="dt-at">${o}</span>`):n},na=(t,e)=>{let n=t.selectionStart??t.value.length,o=t.value.slice(0,n).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(n)}`,t.selectionStart=t.selectionEnd=o+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},br=(t,e)=>{if(!t){M&&(M.category=e),G();return}Vt(n=>n.map(o=>o.id===t?{...o,category:e}:o),()=>x({id:t,category:e}),"Changing the type")};za([U,j],h,Wt),j.addEventListener("change",t=>{let e=t.target.closest(".dt-for-select[data-id]");e&&Yn(Number(e.dataset.id),e.value)}),j.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-hand [data-act="hand"]');if(!e)return;t.stopPropagation();let n=e.dataset.v;Yn(Number(e.dataset.id),n==="agent"?Un:n==="person"?Gn():"")},!0);let fr=(t,e)=>{t?Vt(n=>n.map(o=>o.id===t?{...o,shared:e||void 0}:o),()=>x({id:t,shared:e}),e?"Sharing with the client":"Keeping it to the team"):M&&(M.shared=e||void 0,Rt(),G())};U.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let g=e.value,S=Number(e.dataset.id)||0;e.value="",g==="team"||g==="client"?fr(S,g==="client"):g==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?(st=null,ls(S)):g==="discard"&&(M=null,G());return}let n=t.target.closest(".dt-lang-select");if(n){Eo(Number(n.dataset.id),n.dataset.at,n.value);return}let o=t.target.closest(".dt-cat-select");if(o){br(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){co(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-for-select");if(!r)return;r.parentElement?.style.setProperty("--cat",Ye(r.value));let l=Number(r.dataset.id);if(l){let g=r.value||null;Vt(S=>S.map(R=>R.id===l?{...R,assignee:g??void 0}:R),()=>x({id:l,assignee:g}),"Reassigning");return}M&&(M.assignee=r.value,et.setItem("nm-for",r.value),Xn(r.value),Rt())}),U.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&M?.suggest){M.suggest.to=e.value,Rt(),Ms(e);return}let n=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");n&&(ta(n),n.classList.contains("dt-note-input")?M&&(M.text=n.value):n.classList.contains("dt-note-edit-input")?lt&&(lt.text=n.value):Ft=n.value,Rt(),n.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",n.value.trim()!==""),Ms(n))}),U.addEventListener("keydown",t=>{let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let n=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!n()&&ta(e);let o=n();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),na(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let rt=null,Pn=!1;function ks(t){return!s.client||!!s.me&&t.by===s.me.email}let sa=t=>{let e=document.createElement("div");return e.className=`dt-drag-box ${t}`,e.hidden=!0,e.innerHTML="<span></span>",document.body.append(e),e},Ls=sa("dt-drag-box--home"),oa=sa("dt-drag-box--to"),Ss=t=>{let e=Nt(t.textContent||"").replace(/\s+/g," ").slice(0,24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},aa=(t,e,n="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left-3}px;top:${o.top-3}px;width:${o.width+6}px;height:${o.height+6}px`,t.querySelector("span").textContent=n,t.hidden=!1},vr=(t,e)=>document.elementsFromPoint(t,e).find(n=>!n.closest(yt)&&!n.closest(".dt-drag-box")&&n!==document.documentElement&&n!==document.body)??null,yr=(t,e,n)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&n>=o.top&&n<=o.bottom},wr=(t,e,n)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),r=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:Ws(t),tag:a,classes:r,nth:zs({tag:a,classes:r}).indexOf(t),label:Nt(t.textContent||"").slice(0,60),ctx:Vs(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(n-o.top)/o.height)):.5}},Ts=()=>{rt&&(rt.pin.classList.remove("is-dragging"),Ls.hidden=oa.hidden=!0,rt=null,oe())};U.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let n=Y.find(o=>o.id===Number(e.dataset.id));!n||!ks(n)||(rt={id:n.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:ne(n),to:null},e.setPointerCapture(t.pointerId))}),U.addEventListener("pointermove",t=>{if(!rt||!rt.on&&Math.hypot(t.clientX-rt.x0,t.clientY-rt.y0)<4)return;rt.on=!0,rt.pin.classList.add("is-dragging"),rt.pin.style.left=`${t.clientX}px`,rt.pin.style.top=`${t.clientY}px`,rt.to=rt.home&&yr(rt.home,t.clientX,t.clientY)?rt.home:vr(t.clientX,t.clientY);let e=rt.to&&rt.to!==rt.home;aa(Ls,rt.home,e?"":rt.home?Ss(rt.home):""),Ls.classList.toggle("is-left",!!e),aa(oa,e?rt.to:null,e?`Move to ${Ss(rt.to)}`:"")}),U.addEventListener("pointerup",async t=>{if(!rt)return;let e=rt;if(!e.on||!e.to){Ts();return}Pn=!0,setTimeout(()=>{Pn=!1},0);let n=Y.find(g=>g.id===e.id),o=wr(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(Ts(),!n)return;let r={selector:n.selector,tag:n.tag,classes:n.classes,nth:n.nth,label:n.label,ctx:n.ctx,rx:n.rx,ry:n.ry},l=(g,S)=>Vt(R=>R.map(u=>u.id===e.id?{...u,...g}:u),()=>x({id:e.id,move:g}),S);await l(o,"Moving the pin"),a&&Qe(`Moved to ${Ss(e.to)}`,()=>l(r,"Putting the pin back"))}),U.addEventListener("click",t=>{Pn&&(t.stopImmediatePropagation(),t.preventDefault(),Pn=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&rt?.on&&(t.stopImmediatePropagation(),Ts())},!0),U.addEventListener("click",async t=>{let e=t.target.closest("button");if(!e)return;let n=e.dataset.act,o=Number(e.dataset.id);if(n==="prio"){let a=e.dataset.v||null;o?Vt(r=>r.map(l=>l.id===o?{...l,priority:a??void 0}:l),()=>x({id:o,priority:a}),"Setting the priority"):M&&(M.priority=a??void 0,Rt(),G());return}if(n==="mention"){let a=e.closest(".dt-compose")?.querySelector("textarea");a&&na(a,e.dataset.handle);return}if(!n){if(st=st===o?null:o,st!=null&&e.dataset.off){let a=Y.find(l=>l.id===o);(a&&ne(a))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}v(),G();return}if(n==="speak"){qi(e.closest(".dt-note"),e);return}if(n==="voice-write"){ji(e);return}if(n==="voice"||n==="voice-seek"){Si(e,n==="voice-seek"?t:null);return}if(n==="attach"||n==="attach-file"){let a=Object.assign(document.createElement("input"),{type:"file",accept:n==="attach"?"image/*":"",multiple:!0}),r=e.closest(".dt-note");a.addEventListener("change",()=>{a.files?.length&&Es([...a.files],r)}),a.click();return}if(n==="unshot"){o?lt&&lt.drop.push(e.dataset.img):(e.closest("[data-draft]")?M?.images??[]:wt).splice(Number(e.dataset.i),1),G(),lt&&Qo();return}if(n==="edit"){let a=Y.find(g=>g.id===o),r=e.dataset.at||null,l=r?a?.replies?.find(g=>g.at===r)?.text:a?.text;if(l===void 0)return;lt={id:o,at:r,text:l,drop:[]},G(),Qo();return}if(n==="edit-cancel"){lt=null,G();return}if(n==="translate"){Eo(o,e.dataset.at);return}if(n==="unsay"){let a=e.dataset.at;if(!confirm("Delete this reply?"))return;await Vt(r=>r.map(l=>l.id!==o?l:{...l,replies:(l.replies??[]).map(g=>g.at===a?{...g,text:"",deleted:!0}:g)}),()=>x({id:o,unsay:a}),"Deleting the reply");return}if(n==="edit-save"){let a=lt;if(!a)return;let r=a.text.trim();if(!r){U.querySelector(".dt-note-edit-input")?.focus();return}lt=null;let l=g=>a.drop.includes(g.split("/").pop());await Vt(g=>g.map(S=>S.id!==a.id?S:{...S,...a.at==null?{text:r}:{replies:(S.replies??[]).map(R=>R.at===a.at?{...R,text:r}:R)},images:(S.images??[]).filter(R=>!l(R))}),()=>x({id:a.id,edit:{at:a.at,text:r},...a.drop.length?{removeImage:a.drop}:{}}).then(g=>(g.ok||(lt=a),g),g=>{throw lt=a,g}),"Saving the edit");return}if(n==="cancel"){v(),G();return}if(n==="twin"){v(),st=Number(e.dataset.id),G();return}if(n==="discard"){M=null,G();return}if(n==="draft-open"){ps(Number(e.dataset.i));return}if(n==="close"){st=null,G();return}if(n==="where"){let a=Y.find(S=>S.id===Number(e.dataset.id)),r=a&&zt(a)?.hidden;if(!r)return;let l=r.getBoundingClientRect();r.scrollIntoView({block:"nearest",behavior:"smooth"});let g=document.createElement("div");g.className="dt-where",g.style.cssText=`left:${l.left}px;top:${l.top}px;width:${l.width}px;height:${l.height}px`,document.body.append(g),g.animate([{opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.75},{opacity:0}],1600).finished.finally(()=>g.remove());return}if(n==="unsuggest"&&M){M.suggest=null,G();return}if(n==="save"){if(!M)return;M.images&&(M.images=M.images.filter(K=>!K.startsWith(xn)));let a=M.suggest&&M.suggest.to.trim()!==M.suggest.from?{from:M.suggest.from,to:M.suggest.to.trim()}:null,r=U.querySelector(".dt-note-input").value.trim()||(a?"Change the text":"")||(M.images?.some(ts)?xo:M.images?.some(K=>!dn(K))?"See the attached image":M.images?.length?"See the attached file":"");if(!r){U.querySelector(".dt-note-input")?.focus();return}let l=M,g=s.client?null:Rs(r,ke()),S=Jo.get(l)??xs(ne(l)),R={...l,route:L,text:r,suggest:a,assignee:s.client?go(l.assignee)||void 0:g??(l.assignee||void 0),shared:s.client?!0:l.shared===!0,stage:s.client?"new":g?"approved":l.stage??($t(l.assignee)?"approved":"new"),breakpoint:Wn(),browser:ai(),device:w?ia:"",viewport:{w:innerWidth,h:innerHeight},logs:Fa(),host:location.host},u={...l,id:-Date.now(),text:r,route:L,status:"open",note:"",doneBy:null,breakpoint:R.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...a?{suggest:a}:{},by:s.me?.email,byName:s.me?.name};Y=[...Y,u],M=null,G();let Z=await rs(At("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(R)})).catch(()=>null);if(!Z?.ok){Y=Y.filter(K=>K!==u),v(),M=l,G(),Bn("Comment was not saved",Z);return}let D=Ln([await Z.json().catch(()=>null)])[0];Y=Y.map(K=>K===u&&D?D:K),G(),D&&S.then(K=>{K&&x({id:D.id,before:K})}),on();return}if(n==="reply"){let a=U.querySelector(".dt-note-reply-input");wt=wt.filter(K=>!K.startsWith(xn));let r=a.value.trim()||(wt.some(ts)?xo:wt.some(K=>!dn(K))?"See the attached image":wt.length?"See the attached file":"");if(!r){a.focus();return}let l=wt;Ft="",wt=[];let g=Y,S=s.client?null:Rs(r,ke()),R=Y.find(K=>K.id===o),u=S&&R&&(S!==R.assignee||Ht(R)!=="approved"||R.status==="done")?{assignee:S,stage:"approved",...R.status==="done"?{status:"open",doneBy:null}:{}}:{};Y=Y.map(K=>K.id===o?{...K,...u,replies:[...K.replies??[],{author:"you",text:r,at:new Date().toISOString(),by:s.me?.email}]}:K),G();let Z=await rs(x({id:o,reply:r,images:l,...u})).catch(()=>null);if(!Z?.ok){Y=g,Ft=r,wt=l,G(),Bn("Reply was not sent",Z);return}let D=Ln([await Z.json().catch(()=>null)])[0];D&&(Y=Y.map(K=>K.id===D.id?D:K),G()),on();return}if(n==="hand"){ci(o,e.dataset.v);return}if(n==="sendback"){await Se(o,!1),Nn(".dt-note-reply-input");return}if(n==="accept"){co(o,"accepted");return}if(n==="archive"||n==="unarchive"){n==="archive"&&!e.classList.contains("dt-step-act")&&(st=null),await Te(o,n==="archive");return}e.classList.contains("dt-step-act")||(st=null),n==="rm"?await ls(o):await Se(o,n==="done")});let ia="",Gt=t=>{Dt.hidden||Fe.contentWindow?.postMessage({dt:!0,...t},location.origin)},$r=()=>({notes:kt,grid:!T.hidden,inspect:mt,resolved:Tt,archived:te,...la.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(!w&&t.source===Fe.contentWindow){if(e.key){ga(e.key[0],e.key[1])?.run();return}if(e.closeMenus){it();return}if(e.drafts){as=e.drafts,en(Me());return}}if(w&&typeof e.openDraft=="number"){ps(e.openDraft);return}if(w&&typeof e.dropDraft=="number"){Ho(e.dropDraft);return}if(w&&typeof e.device=="string"&&(ia=e.device),w&&e.scrollbar&&Bt.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Fe.contentWindow){Gt($r());return}typeof e.notes=="boolean"&&e.notes!==kt&&ge(e.notes,!1),typeof e.open=="number"&&us(e.open),typeof e.grid=="boolean"&&e.grid===T.hidden&&X(e.grid),typeof e.inspect=="string"&&e.inspect!==mt&&B(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Tt&&ms(e.resolved),typeof e.archived=="boolean"&&e.archived!==te&&gs(e.archived),e.reload&&Ae()});let on=async()=>{await Ae(),Gt({reload:!0}),w&&parent.postMessage({dt:!0,reload:!0},location.origin)},ge=(t,e=!0)=>{if(kt=t,J.setAttribute("aria-pressed",String(t)),t?!w&&j.hidden&&et.getItem("dt-history")!=="0"&&(j.hidden=!1,P.setAttribute("aria-pressed","true")):(j.hidden=!0,P.setAttribute("aria-pressed","false")),q(qt,t?"1":"0"),Gt({notes:t}),w&&e&&parent.postMessage({dt:!0,notes:t},location.origin),U.hidden=!t||!Dt.hidden,Bt.toggle("dt-noting",t),t&&!document.querySelector(".dt-room")?document.body.append(Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"})):t||document.querySelector(".dt-room")?.remove(),t){B(""),document.addEventListener("click",Yo,!0);for(let n of Uo)document.addEventListener(n,Go,!0);document.addEventListener("keydown",Ko),document.addEventListener("mousemove",Vo),addEventListener("scroll",oe,!0),addEventListener("resize",oe),addEventListener("pointerover",Ro,!0),Ks(),No.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),Po.observe(document.body),ws()}else{v(),st=null,document.removeEventListener("click",Yo,!0);for(let n of Uo)document.removeEventListener(n,Go,!0);document.removeEventListener("keydown",Ko),document.removeEventListener("mousemove",Vo),ft.hidden=!0,removeEventListener("scroll",oe,!0),removeEventListener("resize",oe),removeEventListener("pointerover",Ro,!0),No.disconnect(),Po.disconnect(),U.innerHTML=""}},{pickBp:ra,...la}=Ua({cfg:s,inFrame:w,persist:q,frame:Dt,frameEl:Fe,devicesMenu:bt,bpBtns:O,notesOverlay:U,WIDE:p,bpOf:$,currentBp:Wn,deviceById:N,notesOn:()=>kt,filter:()=>I,filterTo:t=>{I=t},dropFrameDrafts:()=>{as=[]},putAway:()=>{st=null,v()},tellFrame:Gt,syncBpButtons:_s,render:()=>G(),reread:()=>{kt?ws():G()}}),da="dt-studio",ca=t=>{V.setAttribute("aria-pressed",String(t)),Bt.toggle("dt-no-studio",!t),q(da,t?"1":"0")};V.addEventListener("click",()=>ca(V.getAttribute("aria-pressed")!=="true")),ca(et.getItem(da)!=="0"),J.addEventListener("click",()=>ge(!kt));let be=document.querySelector(".devtools"),ze=document.querySelector(".dt-tab"),ua=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-be.getBoundingClientRect().top)+12}px`);new ResizeObserver(ua).observe(be),addEventListener("resize",ua);let pa=t=>{be.toggleAttribute("data-collapsed",t),ze.toggleAttribute("data-collapsed",t),ze.setAttribute("aria-expanded",String(!t)),ze.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(let e of be.querySelectorAll(".dt-group"))e.inert=t;t&&it(),q("dt-collapsed",t?"1":"0")};ze.addEventListener("click",()=>pa(!be.hasAttribute("data-collapsed")));let pe=document.querySelector(".dt-keys"),ha=pe.querySelector(".dt-set-keys"),Cs=t=>{ha.hidden=!t,pe.querySelector(".dt-set-main").hidden=t};if(Yt.signOut)for(let t of pe.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;pe.querySelector("summary").addEventListener("click",()=>Cs(!1)),pe.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let n=e.dataset.set;if(n==="keys"||n==="back")return Cs(n==="keys");pe.open=!1,n==="hide"&&ze.click(),n==="out"&&confirm("Sign out of Notemend on this site?")&&Yt.signOut?.()});let re=t=>()=>be.querySelector(t)?.click(),ma=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(n=>n.hasAttribute("aria-current"))+t]?.click()},Rn=[{group:"Comments",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:re(".dt-notes-btn")},{group:"Comments",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Comments panel",el:".dt-history-btn",run:re(".dt-history-btn")},{group:"Comments",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:re(".dt-resolved-btn")},{group:"Comments",code:"KeyA",hint:"A",label:"Show archived",run:()=>gs(!te)},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:re(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:re(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:re(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:re(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:re(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:re(".dt-border-btn")},...s.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:re(".dt-studio-btn")}]:[],...O.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:()=>{bt.open=!bt.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:ma(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:ma(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>ze.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=pe.open&&!ha.hidden;pe.open=!t,Cs(!t)}}].filter(t=>!s.client||t.group!=="Inspect"),ga=(t,e)=>Rn.find(n=>n.code===t&&!n.shift==!e),xr=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(s.shortcuts){for(let e of Rn){let n=e.el&&be.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))}let t=(e,n)=>`<div class="dt-key-row"><span>${h(e)}</span><kbd>${h(n)}</kbd></div>`;if(pe.querySelector(".dt-keys-list").innerHTML='<p class="dt-menu-note">One key, no modifier, in any keyboard layout. Not while you type.</p>'+[...new Set(Rn.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+Rn.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||xr(e.target))return;let n=ga(e.code,e.shiftKey);n&&(e.preventDefault(),w?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):n.run())}),w){let e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",n=>{n.key==="Escape"&&e()})}}if(!w){pa(et.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>be.setAttribute("data-ready",""))),la.restore(),X(et.getItem(_)==="1");let t=et.getItem(nt);t&&t in Mt&&B(t),ge(et.getItem(qt)==="1")}let ba=()=>{try{let t=JSON.parse(et.getItem(dt)||"null");St=(t?.parked??[]).filter(e=>Ee(e)),t?.draft&&document.querySelector(t.draft.selector)?(M=t.draft,!kt&&!w&&ge(!0)):Ee(t?.draft)&&St.push(t.draft),t?.reply?.text&&(Ft=t.reply.text,C=st=t.reply.for??null),(M||St.length||Ft)&&G()}catch{et.removeItem(dt)}};ba();let fa=()=>setTimeout(()=>{let t=H(location.pathname);t!==L&&(clearTimeout(xt),Zt(),L=t,dt=ot(),M=null,St=[],Ft="",C=null,st=null,lt=null,Y=[],ct(),ba(),ws(),Ae())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...n){e.apply(this,n),fa()}}addEventListener("popstate",fa),i.then(async t=>{t.status===200&&zo(await t.json())},()=>{}).then(()=>Tt?Ae(!0):void 0).then(kn.resume),document.addEventListener("visibilitychange",()=>{document.hidden||sn()}),addEventListener("focus",sn),addEventListener("notemend:changed",()=>{w||sn()});let Er=0;w||setInterval(()=>{(!Yt.live||++Er%6===0)&&sn()},2e4),w&&parent.postMessage({dt:!0,hello:!0},location.origin)}function ti(s){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,d=i.showModal,m=null,p=null,$=()=>{if(m){p?.disconnect(),p=null;for(let w of s)document.body.append(w);try{m.hidePopover()}catch{}m.remove(),m=null}},k=()=>{$();let w=document.querySelector("dialog:modal");w&&N(w)},N=w=>{$(),m=document.createElement("div"),m.className="dt-host",m.setAttribute("popover","manual"),m.append(...s),w.append(m);try{m.showPopover()}catch{}w.addEventListener("close",k,{once:!0}),p=new MutationObserver(()=>{w.isConnected||k()}),p.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){d.call(this),this.isConnected&&N(this)}}function ei(){let s=window;if(s.__notemend)return;s.__notemend=!0,qa(d=>d.includes("/__devbar/")||!!Yt.base&&d.startsWith(Yt.base)),Bt.ready=new Promise(d=>{if(!("__next_f"in self))return d();let m=0,p=()=>Object.keys(document.documentElement).some($=>$.startsWith("__reactFiber$"))||++m>330?d():setTimeout(p,30);p()}),Bt.toggle("dt-in-frame",On);let i=At("comments?open=1");Ma().then(d=>{Bt.set("--dt-z",String(d.zIndex));let m=d.brand?.color;if(m&&/^#[0-9a-f]{6}$/i.test(m)){let[p,$,k]=[1,3,5].map(N=>parseInt(m.slice(N,N+2),16)/255);Bt.set("--dt-accent",m),Bt.set("--dt-accent-ink",.2126*p+.7152*$+.0722*k>.55?"#000000":"#ffffff")}Pa(d),Qa(d,i),ti([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab"].map(p=>document.querySelector(p)).filter(p=>!!p))}).catch(d=>console.warn("[notemend] not started:",d))}ei();import.meta.hot&&import.meta.hot.accept(()=>location.reload());
286
+ ${ba("dt-note-input",T.suggest?"Why (optional)":"Comment",T.text??"",'data-act="save"',ua(T.images))}
287
+ ${na(T.priority,T.category,void 0,T.assignee??"",!1,!1,!!T.shared)}
288
+ </div>`}let l=new Map([...J.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(c=>[c.closest(".dt-note").dataset.id,{top:c.scrollTop,end:c.scrollTop+c.clientHeight>=c.scrollHeight-4}])),f=new Set([...J.querySelectorAll("[data-msg]")].map(c=>c.dataset.msg)),u=J.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");J.innerHTML=o,u&&cs(".dt-note-reply-input");for(let c of J.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let U=c.closest(".dt-note").dataset.id,I=l.get(U);if(!I)continue;let K=[...c.querySelectorAll("[data-msg]")].filter(_=>!f.has(_.dataset.msg));for(let _ of K)_.classList.add("dt-msg--new");c.scrollTop=I.end&&K.length||String(We)===U?c.scrollHeight:I.top}We=null;let P=Math.min(innerHeight,document.querySelector(".devtools")?.getBoundingClientRect().top??innerHeight)-8;for(let c of J.querySelectorAll(".dt-note")){let U=c.getBoundingClientRect(),I=U.top,K=P-I,_=I-32;U.bottom>P&&_>K&&(c.dataset.flip="1"),U.right>innerWidth-8&&(c.dataset.flipx="1"),U=c.getBoundingClientRect();let Rt=c.dataset.flip?8-U.top:U.bottom-P,Dt=c.querySelector(".dt-note-thread");Rt>0&&Dt&&(Dt.style.maxHeight=`${Math.max(40,Dt.clientHeight-Rt)}px`);let de=c.getBoundingClientRect().top;c.dataset.flip&&de<8&&(c.style.marginTop=`${8-de}px`)}cn(n),Cs(Hs()),ge();for(let c of J.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))fo(c);let j=J.querySelector(".dt-note-input");j&&(j.focus(),j.setSelectionRange(j.value.length,j.value.length))},ll=()=>{let t=!1,e=[];for(let n of J.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(n.classList.contains("dt-note--orphan")||n.classList.contains("is-dragging"))continue;let o=V.find(r=>r.id===Number(n.dataset.id)),a=o&&Zt(o);e.push([n,a]),a&&Fo(a.el)&&(t=!0)}for(let n of J.querySelectorAll("[data-draft], [data-parked]")){if(n.classList.contains("dt-note--orphan"))continue;let o=n.dataset.parked?Nt[Number(n.dataset.parked)]:T;e.push([n,o?Zt(o):null])}for(let[n,o]of e){if(!o){n.style.visibility="hidden";continue}n.style.visibility="",n.style.left=`${o.x}px`,n.style.top=`${o.y}px`,n.matches(".dt-pin[data-id]")&&(o.off?n.dataset.off=o.off:delete n.dataset.off,n.classList.toggle("dt-pin--hidden",!!o.hidden)),n.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!o.hidden)}if(!Vn.length&&(T||tt!=null)){let n=Hs();n&&Fo(n)&&Cs(n)}Fe(T||tt!=null?Hs():null),t&&ge()},cn=t=>{if(!q.hidden&&(q.innerHTML=sr({bp:t,notes:V.filter(on),breakpoints:d,bandOfNote:S,orphan:e=>!Zt(e),hiddenNow:e=>!!Zt(e)?.hidden,whoseAgent:Ve,statusTools:e=>xa(e,!Jo(e)),showResolved:ie,showArchived:Ne,archived:re,drafts:Jt.hidden?ya():Zs,checks:b?0:ss.toCheck().length,marker:cl,assign:Jo,find:Kt,forMe:dl,forAgent:e=>!!ne(e)&&ht(e)!=="done",unread:Xo,agentless:e=>s.client||_t()||$t(e),archives:!s.client&&!_t()}),un)){let e=q.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(un.at,un.at),un=null}},un=null,dl=t=>{if(ht(t)==="done"||!s.me)return!1;if(t.assignee===s.me.email||ht(t)==="claude"||Xt(t)==="review"&&t.assignee!==s.me.email)return!0;let e=(s.me.name||s.me.email).split(/[\s@]/)[0].toLowerCase();return Oe(t).some(n=>n.text.toLowerCase().includes("@"+e))},cl=t=>{let e=ne(t),n=Os[e??""],o=ht(t)==="done"?re(t)?`<i class="dt-hist-badge is-archived">${Xn}</i>`:`<i class="dt-hist-badge is-done">${qt}</i>`:n?`<i class="dt-hist-badge" style="--b:${n}">${zt(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${xn.find(r=>r[0]===ln(t))[2]}"></i>`,a=Ko(t);return a?`<span class="dt-hist-face" style="--hue:${$n(t.by||t.byName||"")}">${a}${o}</span>`:`<span class="dt-hist-n" style="--cat:${Qe(t.category).color}">${o}</span>`},no=t=>q.toggleAttribute("data-collapsed",t);q.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(Kt.q=e.value,un={at:e.selectionStart??e.value.length},cn(xe()))}),q.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await Ye(),setTimeout(()=>delete e.dataset.spin,500);return}if(q.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){no(!1);return}if(t.target.closest("[data-fold]")){no(!q.hasAttribute("data-collapsed"));return}let n=t.target.closest(".dt-hist-bands [data-bp]");if(n){ri(n.dataset.bp);return}let o=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(o){o.dataset.histView?(Kt.view=o.dataset.histView,k("dt-view",Kt.view),Kt.menu=!1):o.dataset.histSort?(Kt.sort=o.dataset.histSort,k("dt-sort",Kt.sort),Kt.menu=!1):o.hasAttribute("data-hist-clear")?(Kt.q="",un={at:0}):Kt.menu=!Kt.menu,cn(xe());return}Kt.menu&&!t.target.closest(".dt-hist-menu")&&(Kt.menu=!1,cn(xe()));let a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){let U=a.dataset.draftRm!==void 0,I=Number(U?a.dataset.draftRm:a.dataset.draftGo);Jt.hidden?U?ka(I):so(I):ee(U?{dropDraft:I}:{openDraft:I});return}let r=t.target.closest("[data-unmark]");if(r){t.stopPropagation(),await Le(Number(r.dataset.unmark),!1);return}let l=t.target.closest(".dt-hist-tools [data-act]");if(l){await Le(Number(l.dataset.id),l.dataset.act==="done");return}let f=t.target.closest("[data-rm]");if(f){tt=null,await to(Number(f.dataset.rm));return}if(t.target.closest("[data-review]")){ss.start();return}if(t.target.closest("[data-resolved]")){ao(!ie);return}if(t.target.closest("[data-archived]")){io(!Ne);return}let u=t.target.closest("[data-archive-all]");if(u){let U=u.dataset.archiveAll.split(",").map(Number);for(let I of U)await Ue(I,!0,!0);Re(`Archived ${U.length}`,()=>{for(let I of U)Ue(I,!1,!0)});return}let P=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(P){await Ue(Number(P.dataset.id),P.dataset.act==="archive");return}let j=t.target.closest("[data-go]");if(!j)return;let c=Number(j.dataset.go);if(!Jt.hidden){ee({open:c});return}Sn(c)});let Sn=t=>{tt=t,O(),Q();let e=V.find(o=>o.id===t),n=e&&Zt(e);n?scrollTo({top:scrollY+n.y-innerHeight/2,behavior:"smooth"}):e&&he(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||J.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},so=t=>{let[e]=Nt.splice(t,1);if(!e)return;O(),T=e,tt=null;let n=Zt(e);n&&(n.y<0||n.y>innerHeight)&&scrollTo({top:scrollY+n.y-innerHeight/3,behavior:"instant"}),Q()},ka=t=>{Nt.splice(t,1),Q()},ss=or({inFrame:b,everything:()=>wt,route:()=>Z,settle:Le,keepIn:Wt,toast:t=>Mt(t),waits:t=>ht(t)==="claude"||ht(t)==="done"&&!re(t),approve:t=>ht(t)==="claude"?Le(t.id,!0):Ue(t.id,!0,!0),open:t=>{if(Tt||ye(!0),S(t)!==xe()){ri(S(t));for(let e of[600,1500])setTimeout(()=>ee({open:t.id}),e)}else Sn(t.id)}}),ul=t=>{q.hidden=!t,Y.setAttribute("aria-pressed",String(t)),k("dt-history",t?"1":"0"),Q()},oo=document.querySelector(".dt-resolved-btn"),Tn=document.querySelector(".dt-space"),pl=t=>{if(!Tn)return;Tn.hidden=!Be(),Tn.dataset.on=He;let e=document.documentElement,n=e.dataset.dtSpace==="clients";Be()&&He==="clients"?(e.dataset.dtSpace="clients",n||(e.classList.add("dt-client-glow"),window.setTimeout(()=>e.classList.remove("dt-client-glow"),1700))):delete e.dataset.dtSpace;for(let o of Tn.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===He));let r=o.querySelector(".dt-space-n");r.textContent=String(t[a]),r.hidden=!t[a]}},La=0,An=t=>{if(!Be()||t===He)return;let e=()=>{He=t,k("dt-space",t),tt!=null&&!on(V.find(o=>o.id===tt))&&(tt=null),O(),os(wt),Q(),cn(xe())};if(matchMedia("(prefers-reduced-motion: reduce)").matches)return e();let n=document.documentElement;n.classList.add("dt-switching"),clearTimeout(La),La=window.setTimeout(()=>{e(),requestAnimationFrame(()=>n.classList.remove("dt-switching"))},120)};document.querySelector(".dt-client-x")?.addEventListener("click",()=>An("studio")),Tn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&An(e.dataset.space)});let Pe=document.querySelector(".dt-pinf"),Cn=Pe.querySelector(".dt-pinf-btn"),le=Pe.querySelector(".dt-pinf-menu"),Sa={all:"All",nobody:"Nobody has it",mine:"Mine",others:"Everyone else",claude:"My Claude",wrote:"Written by me",check:"To check"},hl=()=>V.filter(t=>S(t)===xe()&&Ro(t)&&on(t)),Hn=(t,e=!1)=>{le.hidden=!t,Cn.setAttribute("aria-expanded",String(t)),t&&(Ss(),e&&le.querySelector('[aria-checked="true"]')?.focus())};Ss=()=>{let t=hl();if(Pe.hidden=!Be()||!t.length,Pe.hidden){le.hidden=!0;return}let e=Object.fromEntries(No.map(K=>[K,t.filter(_=>ea(_,K)).length])),n=(s.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",$n(n)],["others","var(--dt-faint)"]],a=11.75,r=.42,l=2*Math.PI*a,f=0,u="";for(let[K,_]of o){let Rt=2*Math.PI*e[K]/e.all;e[K]&&(u+=`<circle cx="20" cy="20" r="${a}" stroke="${_}" stroke-dasharray="${Math.max(.01,(Rt-r)*a).toFixed(2)} ${l.toFixed(2)}" stroke-dashoffset="${(-(f+r/2)*a).toFixed(2)}"${pe===K?' class="is-on"':pe!=="all"?' class="is-off"':""}/>`),f+=Rt}if(Pe.querySelector(".dt-pinf-arcs").innerHTML=u,Pe.querySelector(".dt-pinf-n").textContent=String(e[pe]),Cn.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} nobody has, ${e.mine} mine, ${e.others} everyone else's${pe==="all"?"":`; showing ${Sa[pe]}, ${e[pe]}`}`),le.hidden)return;let P=[...new Set(t.map(K=>Es(K,ht(K))?.taker).filter(K=>!!K&&K!==n))].slice(0,2),j=K=>an(Ee(K)?.avatar_url,Ee(K)?.name||K,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${$n(K)}" `),c={all:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 3 3 6.5 10 10l7-3.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5"/></svg>',nobody:'<svg viewBox="0 0 16 16" width="16" height="16"><circle cx="8" cy="8" r="7" stroke="var(--dt-new)" stroke-width="1.5" stroke-dasharray="2.5 2"/></svg>',mine:j(n),others:P.map(j).join("")||'<svg viewBox="0 0 20 20" width="14" height="14"><circle cx="8" cy="7" r="3"/><path d="M3 16.5c.5-2.8 2.5-4.5 5-4.5s4.5 1.7 5 4.5M13.5 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1 .9 1.6 2.3 1.8 4.1"/></svg>',claude:`<i class="dt-pinf-claude">${zt(10)}</i>`,wrote:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 16.5h6.5M13.4 3.9a1.8 1.8 0 0 1 2.6 2.6L7.4 15.1 4 16l.9-3.4z"/></svg>',check:Kn(xn[2][2],xn[2][3])},U=(K,_)=>`<b class="dt-pinf-share"><i style="--c:${_};width:${Math.round(100*e[K]/e.all)}%"></i></b>`,I=(K,_="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${pe===K}" data-pinf="${K}"><i class="dt-pinf-glyph">${c[K]}</i><span>${Sa[K]}</span>${_?U(K,_):""}<em>${e[K]}</em>${qt}</button>`;le.innerHTML=`<div class="dt-pinf-head"><b>SHOW</b>${e.all} on this page</div>${I("all")}${o.map(([K,_])=>I(K,_)).join("")}<hr>${I("claude")}${I("wrote")}${I("check")}${s.shortcuts?'<div class="dt-pinf-foot"><kbd>F</kbd>opens it \xB7 the rest dim, not hidden</div>':""}`},Cn.addEventListener("click",t=>Hn(le.hidden,t.detail===0)),le.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(pe=e.dataset.pinf,k("dt-pinf",pe),Hn(!1),Cn.focus(),Tt?Q():ye(!0))}),le.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),Hn(!1),Cn.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...le.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!le.hidden&&!Pe.contains(t.target)&&Hn(!1)},!0);let ao=t=>{ie=t,oo.setAttribute("aria-pressed",String(t)),k("dt-resolved",t?"1":"0"),ee({resolved:t}),Q(),Ge(!0)},io=t=>{Ne=t,k("dt-archived",t?"1":"0"),ee({archived:t}),Q(),Ge(!0)};oo.addEventListener("click",()=>ao(!ie)),oo.setAttribute("aria-pressed",String(ie)),Y.addEventListener("click",()=>{let t=q.hidden===!0;t&&!Tt&&ye(!0),t&&no(!1),ul(t)});let ge=()=>{yn||!Tt||(yn=requestAnimationFrame(()=>{yn=0,ll()}))},Ta=`${Ce}, .dt-where, .dt-spot, .dt-drag-box, .dt-room, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,ml=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Ta))return!0;let n=[...t.addedNodes,...t.removedNodes];return n.length>0&&n.every(o=>o instanceof Element&&o.matches(Ta))},Aa=new MutationObserver(t=>{t.every(ml)||(qo(),ge())}),Ca=new ResizeObserver(()=>ge()),Ha=()=>{J.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&ge()},wt=[],Ba=()=>{},Bn=new Set,Gt={at:"",ids:[]},os=t=>{wt=t,queueMicrotask(()=>Ba());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),n={},o={studio:0,clients:0};for(let u of t){if(re(u)||(ht(u)!=="done"&&o[$t(u)?"clients":"studio"]++,!on(u)))continue;let P=ht(u),j=ne(u),c=P==="done"?"done":P==="claude"?"review":j&&Gn[j]||ln(u),U=n[u.route??""]??={...e(),bands:{}};U[c]++;let I=S(u);(U.bands[I]??=e())[c]++}pl(o);let a=["new","progress","review","waiting","done"],r={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},l=u=>a.map(P=>[P,P==="done"&&!ie?0:u[P]]),f=u=>l(u).reduce((P,[,j])=>P+j,0);for(let u of document.querySelectorAll(".dt-pages a")){let P=u.querySelector(".dt-pages-n");if(!P)continue;let j=n[new URL(u.href).pathname.replace(/\/+$/,"")||"/"];for(let I of d){let K=j?.bands[I.id];for(let[_,Rt]of l(K??e())){let Dt=P.querySelector(`[data-bp="${I.id}"][data-state="${_}"]`);Dt.hidden=!Rt,Rt&&(Dt.querySelector("i").textContent=String(Rt),Dt.title=`${I.label}: ${Rt} ${r[_]}`)}}let c=j?f(j):0;P.hidden=!c;let U=j?d.filter(I=>j.bands[I.id]&&f(j.bands[I.id])).map(I=>`${I.label} ${f(j.bands[I.id])}`).join(" \xB7 "):"";P.title=c?`${a.filter(I=>j[I]).map(I=>`${j[I]} ${r[I]}`).join(" \xB7 ")}
289
+ ${U}`:""}},pn=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"):[]})),gl=ar(b,t=>Mt(t)),te=document.querySelector(".dt-push"),fe=te.querySelector(".dt-push-menu"),be=new Set,hn=new Set,as=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",is=()=>s.client||_t()||b?[]:wt.filter(t=>t.status!=="done"&&kt(t.assignee)&&Xt(t)==="approved"&&!De(t)&&!re(t)&&!Bn.has(t.id)),rs=()=>is().filter(t=>!be.has(t.id)),Na=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?qt:""}</i>`,Ra=()=>{let t=is(),e=[...new Set(t.map(o=>o.route??"/"))],n=rs().length;fe.innerHTML=`<div class="dt-push-head">${zt(14)}<b>Waiting for Claude</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),r=a.filter(l=>!be.has(l.id)).length;return`<button type="button" class="dt-push-page${hn.has(o)?" is-open":""}" data-push-route="${g(o)}"><span data-push-fold="${g(o)}">${hn.has(o)?"\u25BE":"\u25B8"}</span>${Na(r>0,r>0&&r<a.length)}<span class="dt-push-route">${g(o)}</span><em>${a.length}</em></button>`+(hn.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${Na(!be.has(l.id))}<span><small>#${l.id}</small>${g(l.text.slice(0,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${n?"":" disabled"}>${zt(13)}Send ${n} to Claude</button>`},ro=()=>["push","paused"].includes(as()),lo=()=>Gt.ids.filter(t=>{let e=wt.find(n=>n.id===t);return!!e&&e.status!=="done"&&Xt(e)!=="review"&&(Bn.has(t)||!!De(e)||Xt(e)==="approved")}),Pa="",fl=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Ke=()=>{let t=as(),e=rs().length,n=lo(),o=Gt.ids.length-n.length,a=n.length>0&&ro();if(te.classList.toggle("is-working",a),n.length&&(Pa=Gt.at),!n.length&&Gt.ids.length&&Gt.at&&Pa===Gt.at&&!fl(Gt.at)){try{sessionStorage.setItem("nm-batch-done",Gt.at)}catch{}wt.length&&Re(`Claude finished ${Gt.ids.length} \u2014 check the fixes`,()=>ss.start(),"Check")}te.hidden=s.client||_t()||b,te.classList.toggle("is-live",ro()),te.classList.toggle("is-quiet",t==="on");let r=te.querySelector(".dt-push-n");r.textContent=String(a?n.length:e),r.hidden=a?!1:!e||t==="on",te.querySelector(".dt-push-all").dataset.tip=a?`Push to Claude: Claude is on ${n.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to Claude: turbo is on \u2014 Claude takes each comment as it lands":t==="none"?`Push to Claude: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to Claude: ${e} ${e===1?"comment waits":"comments wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to Claude: nothing waits for Claude yet \u2014 mark comments for Claude, then send them here",document.querySelector(".devtools")?.style.setProperty("--dt-push-w",te.hidden?"0px":`${te.offsetWidth+8}px`),(te.hidden||!is().length)&&(fe.hidden=!0),fe.hidden||Ra()},Ia=async t=>{if(!t.length&&ro()){Mt("Nothing waits for Claude \u2014 mark comments for Claude first");return}if(as()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Mt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(as()==="on"){Mt("Turbo is on \u2014 Claude takes each comment as it lands");return}fe.hidden=!0;let e=t.map(o=>o.id),n=await At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(!n?.ok){Rn("Could not send them to Claude",n);return}for(let o of e)Bn.add(o);Gt={at:Gt.ids.some(o=>lo().includes(o))?Gt.at:new Date().toISOString(),ids:[...new Set([...lo(),...e])]},Ke(),Re(`${e.length} sent to Claude \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)Bn.delete(o);Ke()}),Ye()},ls=te.querySelector(".dt-push-all"),Oa=0,co=!1,Da=()=>{fe.hidden=!1,Ra()};ls.addEventListener("click",()=>{if(co){co=!1;return}Ia(rs())}),ls.addEventListener("contextmenu",t=>{t.preventDefault(),fe.hidden?Da():fe.hidden=!0}),ls.addEventListener("pointerdown",t=>{t.button===0&&(Oa=window.setTimeout(()=>{co=!0,Da()},500))});for(let t of["pointerup","pointerleave","pointercancel"])ls.addEventListener(t,()=>clearTimeout(Oa));fe.addEventListener("click",t=>{let e=t.target,n=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),r=e.closest("[data-push]")?.dataset.push;if(r==="send"){Ia(rs());return}if(r==="all")be.clear();else if(n){let l=n.dataset.pushFold;hn.has(l)?hn.delete(l):hn.add(l)}else if(o){let l=is().filter(u=>(u.route??"/")===o.dataset.pushRoute),f=l.some(u=>!be.has(u.id));for(let u of l)f?be.add(u.id):be.delete(u.id)}else if(a){let l=Number(a.dataset.pushId);be.has(l)?be.delete(l):be.add(l)}Ke()}),document.addEventListener("pointerdown",t=>{!fe.hidden&&!te.contains(t.target)&&(fe.hidden=!0)},!0),setInterval(Ke,3e4),Ba=Ke;let qa=document.querySelector(".dt-turbo");qa&&new MutationObserver(Ke).observe(qa,{attributes:!0,attributeFilter:["data-state"]}),Ke();let ds="",uo=!1,Fa=t=>{ds=t.version??"",gl(t);let e=t.turbo;Bn=new Set(e?.push?.ids??[]),Gt={at:e?.batch?.at??"",ids:e?.batch?.ids??[]};let n=pn(t.comments);os(n);let o=n.filter(a=>a.route===Z);if(!(_n&&(V=o,ja()))){if(JSON.stringify(o)===JSON.stringify(V)){!q.hidden&&!b&&Q();return}if(J.contains(document.activeElement)&&document.activeElement.matches("textarea, input")){ds="",setTimeout(Nn,5e3);return}V=o,Q(),ee({reload:!0})}},Ge=async(t=!1)=>{let e=[t||!ds?"":`since=${ds}`,ie||Ne?"":"open=1"].filter(Boolean).join("&");try{let n=await At(`comments${e?`?${e}`:""}`);n.status===200&&Fa(await n.json())}catch{}},Nn=async()=>{document.hidden||uo||Qs||(uo=!0,await Ge(),uo=!1)},ja=()=>{let t=_n&&V.find(e=>e.id===_n);return t?(_n=0,Be()&&!on(t)&&An($t(t)?"clients":"studio"),Tt||ye(!0),Sn(t.id),!0):!1},po=()=>{V=wt.filter(t=>t.route===Z),ja()||Q()},ho=0,Wa=t=>{ho||(ho=requestAnimationFrame(()=>{ho=0;let e=t.target;if(!Tt||e.closest(Lt)){bt.hidden=!0;return}let n=document.elementFromPoint(t.clientX,t.clientY);if(bt.hidden=!1,!n)return;let o=n.getBoundingClientRect();jt.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,oe.textContent=n.tagName.toLowerCase()+([...n.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...n.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,oe.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-20)}px`}))},_a=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),gt){gt=null,Q();return}if(T){ft()&&(O(),Q());return}if(tt!==null){tt=null,Q();return}ye(!1)}},za=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],Va=t=>{t.target.closest?.(Lt)||t.stopPropagation()},Ua=t=>{if(t.target.closest(Lt))return;if(t.preventDefault(),t.stopPropagation(),ut){ut=!1;return}if(!getSelection()?.isCollapsed)return;J.hidden=!0;let n=document.elementFromPoint(t.clientX,t.clientY);if(J.hidden=!1,!n||!ft())return;O();let o=n.getBoundingClientRect(),a=n.tagName.toLowerCase(),r=[...n.classList].filter(f=>!/^(astro|svelte|css)-/.test(f)).slice(0,2);T={selector:Io(n),tag:a,classes:r,nth:Oo({tag:a,classes:r}).indexOf(n),rx:o.width?(t.clientX-o.left)/o.width:.5,ry:o.height?(t.clientY-o.top)/o.height:.5,label:Pt(n.textContent||"").slice(0,60),ctx:Do(n),category:h[0].id,...Be()&&He==="clients"?{shared:!0}:{}};let l=s.client||_t()||T.shared?null:Ps();l&&(T.assignee=l,T.stage=kt(l)?"approved":"new"),Ga.set(T,El().then(()=>mo(n))),tt=null,bt.hidden=!0,Q()},bl=2200,yl=900*1024,Ka=8*1024*1024,vl=3*1024*1024,wl=50*1024*1024,$l=1200,xl=1600,mo=async t=>{let e=t instanceof HTMLElement?t:null;for(let a=0;e&&a<4&&e.parentElement&&e.parentElement!==document.body;a++){let r=e.getBoundingClientRect();if(r.width>=360&&r.height>=140)break;e=e.parentElement}let n=e?.getBoundingClientRect();if(!e||!n?.width||!n.height)return null;let o="";for(let a=e;a&&!o;a=a.parentElement){let r=getComputedStyle(a).backgroundColor;r&&r!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(r)&&(o=r)}if(!o){let[a,r,l]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);o=.299*a+.587*r+.114*l>140?"#111":"#fff"}try{let{domToWebp:a}=await import("modern-screenshot"),r=Math.min(1,$l/n.width,xl/n.height),l=await Promise.race([a(e,{scale:r,quality:.8,timeout:4e3,backgroundColor:o,filter:f=>!(f instanceof Element&&f.closest(Ce))}),new Promise(f=>setTimeout(()=>f(null),8e3))]);return l&&l.length<Ka?l:null}catch{return null}},Ga=new WeakMap,El=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Mt=(t,e=2800)=>{let n=document.createElement("div");return n.className="dt-toast",n.textContent=t,document.body.append(n),setTimeout(()=>n.remove(),e),n},Ya=async(t,e)=>{for(let n of e){let[,o,a]=n.split("\0"),r=Zn.get(o);if(Zn.delete(o),!r){Mt(`${a} was not sent \u2014 attach it again`);continue}let l=Mt(`Uploading ${a}\u2026`,12e4),f=await At("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:r.name,size:r.size})}).then(c=>c.ok?c.json():null).catch(()=>null),u=f&&await fetch(f.url,{method:"PUT",headers:{"content-type":f.type,"x-upsert":"false"},body:r}).catch(()=>null),P=u?.ok&&await y({id:t,uploaded:[f.name]}).catch(()=>null);if(l.remove(),!P||!P.ok){Mt(u===null&&f?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let j=pn([await P.json().catch(()=>null)])[0];j&&(V=V.map(c=>c.id===j.id?j:c),Q()),Mt(`${a} sent`)}},Xa=t=>{let e=t.filter(n=>n.startsWith(Jn)).length;return e&&Mt(e===1?"One file was left out \u2014 its chip said why":`${e} files were left out \u2014 their chips said why`,4e3),t.filter(n=>!n.startsWith(Jn))},Rn=async(t,e)=>{if(!navigator.onLine){Mt(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let n="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{n=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{n=""}(n.length>160||n.startsWith("<"))&&(n="")}Mt(n?`${t}: ${n.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},Ml=t=>new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result)),n.readAsDataURL(t)}),kl=async t=>{let e=await createImageBitmap(t),n=Math.min(1,bl/Math.max(e.width,e.height));if(n===1&&t.size<=yl)return e.close(),Ml(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*n),o.height=Math.round(e.height*n),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},go=async(t,e)=>{let n=[],o=(a,r)=>n.push(`${Jn}${a}\0${r}`);for(let a of t){let r,l=Ai(a.name)||Object.keys(Dn).find(f=>Dn[f]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,ko.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>wl){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>vl&&Yt.via){let u=`${Date.now()}-${Zn.size}`;Zn.set(u,a),n.push(`${Ks}${u}\0${a.name}\0${a.size}`);continue}let f=await new Promise((u,P)=>{let j=new FileReader;j.onload=()=>u(String(j.result).split(",")[1]),j.onerror=P,j.readAsDataURL(a)}).catch(()=>"");f?n.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${Ti(a.name)||"file"};ext=${l};base64,${f}`):o(a.name,"Could not be read");continue}try{r=await kl(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>Ka){o(a.name,"Too large even after shrinking");continue}n.push(r)}if(n.length){if(!Number(e?.dataset.id)){T&&((T.images??=[]).push(...n),Q());return}Bt.push(...n),Q(),cs(".dt-note-reply-input")}},Ja=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);J.addEventListener("paste",t=>{let e=Ja(t.clipboardData?.items);e.length&&(t.preventDefault(),go(e,t.target.closest(".dt-note")))}),J.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),J.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),J.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let n=Ja(t.dataTransfer?.items);n.length&&go(n,e)});let cs=t=>{let e=J.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},Za=()=>{cs(".dt-note-edit-input"),J.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},fo=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden";let e=Xs-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},Ll=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Sl=()=>s.client||_t()||T?.shared||tt!=null&&$t(V.find(t=>t.id===tt))?[]:xs(),Qa=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();let n=Ll(t);if(!n)return;let o=n[1].toLowerCase(),a=tt!=null?V.find(u=>u.id===tt):void 0,l=(s.client||_t()||T?.shared||a&&$t(a)?s.team??[]:Ws()).filter(u=>[u.name,u.nickname,u.email].some(P=>P?.toLowerCase().startsWith(o))).slice(0,5),f=Sl().filter(u=>u.handle.toLowerCase().startsWith(o)||!!o&&"agent".startsWith(o)||!!o&&"claude".startsWith(o)).slice(0,4);!l.length&&!f.length||t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...l.map(u=>`<button type="button" role="option" data-act="mention" data-handle="${g(Ni(u))}">${an(u.avatar_url,u.name||u.email)}<span class="dt-mention-who"><b>${g(u.name||u.email)}</b>${u.name?`<span>${g(u.email)}</span>`:""}</span></button>`),...f.map(u=>`<button type="button" role="option" data-act="mention" data-handle="${g(u.handle)}">${vr(u.owner)}<span class="dt-mention-who"><b>${g(u.handle)}</b><span>${u.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((u,P)=>u.replace('role="option"',`role="option" aria-selected="${P===0}"`)).join("")}</div>`)},Tl='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="5.5" cy="5" r="1.8"/><circle cx="5.5" cy="15" r="1.8"/><circle cx="14.5" cy="15" r="1.8"/><path d="M5.5 6.8v6.4M14.5 13.2V8.5a2 2 0 0 0-2-2H9.5M11 4.8 9.3 6.5 11 8.2"/></svg>',Al='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true" class="dt-link-out"><path d="M11 4h5v5M16 4l-7 7M14 11.5V15a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3.5"/></svg>',ti=t=>{let e=[...(s.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...xs().map(o=>o.handle)].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>g(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=e.length?new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"):null;return So(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${g(o.url)}" target="_blank" rel="noopener noreferrer" title="${g(o.url)}">${o.kind==="pr"?Tl:aa}<span>${g(o.label)}</span>${Al}</a>`:n?g(o).replace(n,a=>`<span class="dt-at">${a}</span>`):g(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let n=document.createElement("div");for(let a=0;a<e.rangeCount;a++)n.append(e.getRangeAt(a).cloneContents());let o=n.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",n.textContent??""),t.preventDefault()}});let ei=(t,e)=>{let n=t.selectionStart??t.value.length,o=t.value.slice(0,n).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(n)}`,t.selectionStart=t.selectionEnd=o+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},Cl=(t,e)=>{if(!t){T&&(T.category=e),Q();return}Qt(n=>n.map(o=>o.id===t?{...o,category:e}:o),()=>y({id:t,category:e}),"Changing the type")};Ji([J,q],g,qt),q.addEventListener("change",t=>{let e=t.target.closest(".dt-for-select[data-id]");e&&Rs(Number(e.dataset.id),e.value)}),q.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-hand [data-act="hand"]');if(!e)return;t.stopPropagation();let n=e.dataset.v;Rs(Number(e.dataset.id),n==="agent"?Bs:n==="person"?Ns():"")},!0);let Hl=t=>$t(t)?"studio":"clients",ni=async(t,e=!1)=>{let n=V.find(a=>a.id===t);if(!n||$t(n)&&n.client)return;let o=!$t(n);tt===t&&(tt=null),await Qt(a=>a.map(r=>r.id===t?{...r,shared:o||void 0,client:o?r.client:void 0}:r),()=>y(o?{id:t,shared:o}:{id:t,shared:!1,client:!1}),o?"Moving it to clients":"Moving it to the workspace"),os(wt),e||Re(o?"Moved to clients":"Moved to the workspace",()=>ni(t,!0))},Bl=async t=>{let e=V.find(f=>f.id===t);if(!e)return;let n=e,o={text:e.text,from:{id:e.id},...$t(e)?{}:{shared:!0}};for(let f of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])n[f]!=null&&(o[f]=n[f]);let a=await ns(At("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Rn("The copy was not made",a);return}let r=pn([await a.json().catch(()=>null)])[0];r&&(wt=[...wt,r],V=wt.filter(f=>f.route===Z)),os(wt),Q(),Ye();let l=Hl(e);Re(l==="clients"?"Duplicated for the client":"Duplicated to the workspace",()=>{r&&(An(l),Sn(r.id))},"Open")},Nl=t=>{let e=`${location.origin}${location.pathname}?notemend#thread-${t}`;navigator.clipboard?.writeText(e).then(()=>Mt("Link copied"),()=>Mt(e,6e3))};J.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let l=e.value,f=Number(e.dataset.id)||0;e.value="",l==="dup"?Bl(f):l==="move"?ni(f):l==="link"?Nl(f):l==="reopen"?Le(f,!1):l==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?(tt=null,to(f)):l==="discard"&&(T=null,Q());return}let n=t.target.closest(".dt-lang-select");if(n){ha(Number(n.dataset.id),n.dataset.at,n.value);return}let o=t.target.closest(".dt-cat-select");if(o){Cl(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){Sr(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-for-select");if(r){if(ot.setItem("nm-for",r.value),s.client){T&&(T.assignee=r.value,Ps(r.value),Q());return}Vo(Number(r.dataset.id)||0,"person")}}),J.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&T?.suggest){T.suggest.to=e.value,wn(),fo(e);return}let n=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");n&&(Qa(n),n.classList.contains("dt-note-input")?T&&(T.text=n.value):n.classList.contains("dt-note-edit-input")?gt&&(gt.text=n.value):Ht=n.value,wn(),n.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",n.value.trim()!==""),fo(n))}),J.addEventListener("keydown",t=>{if(t.key==="Escape"&&J.querySelector(".dt-emoji")){t.stopPropagation();let a=ke?.box??ke?.btn;ts(),a?.focus();return}let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let n=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!n()&&Qa(e);let o=n();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),ei(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let ct=null,us=!1;function bo(t){return!s.client||!!s.me&&t.by===s.me.email}let si=t=>{let e=document.createElement("div");return e.className=`dt-drag-box ${t}`,e.hidden=!0,e.innerHTML="<span></span>",document.body.append(e),e},yo=si("dt-drag-box--home"),oi=si("dt-drag-box--to"),vo=t=>{let e=Pt(t.textContent||"").replace(/\s+/g," ").slice(0,24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},ai=(t,e,n="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left-3}px;top:${o.top-3}px;width:${o.width+6}px;height:${o.height+6}px`,t.querySelector("span").textContent=n,t.hidden=!1},Rl=(t,e)=>document.elementsFromPoint(t,e).find(n=>!n.closest(Lt)&&!n.closest(".dt-drag-box")&&n!==document.documentElement&&n!==document.body)??null,Pl=(t,e,n)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&n>=o.top&&n<=o.bottom},Il=(t,e,n)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),r=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:Io(t),tag:a,classes:r,nth:Oo({tag:a,classes:r}).indexOf(t),label:Pt(t.textContent||"").slice(0,60),ctx:Do(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(n-o.top)/o.height)):.5}},wo=()=>{ct&&(ct.pin.classList.remove("is-dragging"),yo.hidden=oi.hidden=!0,ct=null,ge())};J.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let n=V.find(o=>o.id===Number(e.dataset.id));!n||!bo(n)||(ct={id:n.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:he(n),to:null},e.setPointerCapture(t.pointerId))}),J.addEventListener("pointermove",t=>{if(!ct||!ct.on&&Math.hypot(t.clientX-ct.x0,t.clientY-ct.y0)<4)return;ct.on=!0,ct.pin.classList.add("is-dragging"),ct.pin.style.left=`${t.clientX}px`,ct.pin.style.top=`${t.clientY}px`,ct.to=ct.home&&Pl(ct.home,t.clientX,t.clientY)?ct.home:Rl(t.clientX,t.clientY);let e=ct.to&&ct.to!==ct.home;ai(yo,ct.home,e?"":ct.home?vo(ct.home):""),yo.classList.toggle("is-left",!!e),ai(oi,e?ct.to:null,e?`Move to ${vo(ct.to)}`:"")}),J.addEventListener("pointerup",async t=>{if(!ct)return;let e=ct;if(!e.on||!e.to){wo();return}us=!0,setTimeout(()=>{us=!1},0);let n=V.find(f=>f.id===e.id),o=Il(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(wo(),!n)return;let r={selector:n.selector,tag:n.tag,classes:n.classes,nth:n.nth,label:n.label,ctx:n.ctx,rx:n.rx,ry:n.ry},l=(f,u)=>Qt(P=>P.map(j=>j.id===e.id?{...j,...f}:j),()=>y({id:e.id,move:f}),u);await l(o,"Moving the pin"),a&&Re(`Moved to ${vo(e.to)}`,()=>l(r,"Putting the pin back"))}),J.addEventListener("click",t=>{us&&(t.stopImmediatePropagation(),t.preventDefault(),us=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&ct?.on&&(t.stopImmediatePropagation(),wo())},!0),J.addEventListener("click",async t=>{let e=t.target.closest("button"),n=ke?.btn;if(e?.closest(".dt-emoji")||ts(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="react"){fa(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){n!==e&&ga(e,o==="emoji-pick",o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&ke){let r=ke;ga(r.btn,!0,r);return}if(o==="emoji"&&ke){let r=ke;ts(),r.box?sl(r.box,e.dataset.emoji):r.id&&fa(r.id,r.at||null,e.dataset.emoji);return}if(o==="prio"){let r=e.dataset.v||null;a?Qt(l=>l.map(f=>f.id===a?{...f,priority:r??void 0}:f),()=>y({id:a,priority:r}),"Setting the priority"):T&&(T.priority=r??void 0,wn(),Q());return}if(o==="mention"){let r=e.closest(".dt-compose")?.querySelector("textarea");r&&ei(r,e.dataset.handle);return}if(!o){if(T&&!ft())return;if(tt=tt===a?null:a,tt!=null&&e.dataset.off){let r=V.find(f=>f.id===a);(r&&he(r))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}O(),Q();return}if(o==="speak"){Gr(e.closest(".dt-note"),e);return}if(o==="voice-write"){Xr(e);return}if(o==="voice"||o==="voice-seek"){Pr(e,o==="voice-seek"?t:null);return}if(o==="attach"||o==="attach-file"){let r=Object.assign(document.createElement("input"),{type:"file",accept:o==="attach"?"image/*":"",multiple:!0}),l=e.closest(".dt-note");r.addEventListener("change",()=>{r.files?.length&&go([...r.files],l)}),r.click();return}if(o==="unshot"){a?gt&&gt.drop.push(e.dataset.img):(e.closest("[data-draft]")?T?.images??[]:Bt).splice(Number(e.dataset.i),1),Q(),gt&&Za();return}if(o==="edit"){let r=V.find(u=>u.id===a),l=e.dataset.at||null,f=l?r?.replies?.find(u=>u.at===l)?.text:r?.text;if(f===void 0)return;gt={id:a,at:l,text:f,drop:[]},Q(),Za();return}if(o==="edit-cancel"){gt=null,Q();return}if(o==="translate"){ha(a,e.dataset.at);return}if(o==="unsay"){let r=e.dataset.at;if(!confirm("Delete this reply?"))return;await Qt(l=>l.map(f=>f.id!==a?f:{...f,replies:(f.replies??[]).map(u=>u.at===r?{...u,text:"",deleted:!0}:u)}),()=>y({id:a,unsay:r}),"Deleting the reply");return}if(o==="edit-save"){let r=gt;if(!r)return;let l=r.text.trim();if(!l){J.querySelector(".dt-note-edit-input")?.focus();return}gt=null;let f=u=>r.drop.includes(u.split("/").pop());await Qt(u=>u.map(P=>P.id!==r.id?P:{...P,...r.at==null?{text:l}:{replies:(P.replies??[]).map(j=>j.at===r.at?{...j,text:l}:j)},images:(P.images??[]).filter(j=>!f(j))}),()=>y({id:r.id,edit:{at:r.at,text:l},...r.drop.length?{removeImage:r.drop}:{}}).then(u=>(u.ok||(gt=r),u),u=>{throw gt=r,u}),"Saving the edit");return}if(o==="cancel"){ft()&&(O(),Q());return}if(o==="twin"){if(!ft())return;O(),tt=Number(e.dataset.id),Q();return}if(o==="discard"){T=null,Q();return}if(o==="draft-open"){so(Number(e.dataset.i));return}if(o==="close"){tt=null,Q();return}if(o==="where"){let r=V.find(P=>P.id===Number(e.dataset.id)),l=r&&Zt(r)?.hidden;if(!l)return;let f=l.getBoundingClientRect();l.scrollIntoView({block:"nearest",behavior:"smooth"});let u=document.createElement("div");u.className="dt-where",u.style.cssText=`left:${f.left}px;top:${f.top}px;width:${f.width}px;height:${f.height}px`,document.body.append(u),u.animate([{opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.75},{opacity:0}],1600).finished.finally(()=>u.remove());return}if(o==="unsuggest"&&T){T.suggest=null,Q();return}if(o==="save"){if(!T)return;T.images&&(T.images=Xa(T.images));let r=(T.images??[]).filter(_=>!dn(_)),l=T.suggest&&T.suggest.to.trim()!==T.suggest.from?{from:T.suggest.from,to:T.suggest.to.trim()}:null,f=J.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(T.images?.some(_s)?pa:T.images?.some(_=>dn(_)&&!qn(_))?"See the attached image":T.images?.length?"See the attached file":"");if(!f){J.querySelector(".dt-note-input")?.focus();return}let u=T,P=s.client?null:To(f,_e()),j=Ga.get(u)??mo(he(u)),c={...u,images:u.images?.filter(dn),route:Z,text:f,suggest:l,assignee:s.client?ra(u.assignee)||void 0:P??(u.assignee||void 0),shared:s.client?!0:u.shared===!0,stage:s.client?"new":P?"approved":u.stage??(kt(u.assignee)?"approved":"new"),breakpoint:Ts(),browser:pr(),device:b?ii:"",viewport:{w:innerWidth,h:innerHeight},logs:Vi(),host:location.host},U={...u,id:-Date.now(),text:f,route:Z,status:"open",note:"",doneBy:null,breakpoint:c.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:s.me?.email,byName:s.me?.name};V=[...V,U],T=null,Q();let I=await ns(At("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)})).catch(()=>null);if(!I?.ok){V=V.filter(_=>_!==U),O(),T=u,Q(),Rn("Comment was not saved",I);return}let K=pn([await I.json().catch(()=>null)])[0];V=V.map(_=>_===U&&K?K:_),Q(),K&&j.then(_=>{_&&y({id:K.id,before:_})}),K&&r.length&&Ya(K.id,r),Ye();return}if(o==="reply"){let r=J.querySelector(".dt-note-reply-input");Bt=Xa(Bt);let l=r.value.trim()||(Bt.some(_s)?pa:Bt.some(_=>dn(_)&&!qn(_))?"See the attached image":Bt.length?"See the attached file":"");if(!l){r.focus();return}let f=Bt;Ht=l,Et=a,vn(),Ht="",Bt=[];let u=V,P=s.client?null:To(l,_e()),j=V.find(_=>_.id===a),c=P&&j&&(P!==j.assignee||Xt(j)!=="approved"||j.status==="done")?{assignee:P,stage:"approved",...j.status==="done"?{status:"open",doneBy:null}:{}}:{};V=V.map(_=>_.id===a?{..._,...c,replies:[..._.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:s.me?.email}]}:_),We=a,Q();let U=await ns(y({id:a,reply:l,images:f.filter(dn),...c})).catch(()=>null);if(!U?.ok){V=u,Ht=l,Bt=f,Q();let _=()=>J.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?Re(`Reply was not sent${U?` (${U.status})`:""} \u2014 it is back in the box`,_,"Retry"):Rn("Reply was not sent",U);return}vn();let I=pn([await U.json().catch(()=>null)])[0];I&&(V=V.map(_=>_.id===I.id?I:_),Q()),Ye();let K=f.filter(_=>!dn(_));K.length&&Ya(a,K);return}if(o==="hand"){Vo(a,e.dataset.v);return}if(o==="sendback"){await Le(a,!1),cs(".dt-note-reply-input");return}if(o==="accept"){await Le(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(tt=null),await Ue(a,o==="archive");return}e.classList.contains("dt-step-act")||(tt=null),o==="rm"?await to(a):await Le(a,o==="done")});let ii="",ee=t=>{Jt.hidden||Ot.contentWindow?.postMessage({dt:!0,...t},location.origin)},Ol=()=>({notes:Tt,grid:!w.hidden,inspect:E,resolved:ie,archived:Ne,...li.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(!b&&t.source===Ot.contentWindow){if(e.key){gi(e.key[0],e.key[1])?.run();return}if(e.closeMenus){mt();return}if(e.drafts){Zs=e.drafts,cn(xe());return}}if(b&&typeof e.openDraft=="number"){so(e.openDraft);return}if(b&&typeof e.dropDraft=="number"){ka(e.dropDraft);return}if(b&&typeof e.device=="string"&&(ii=e.device),b&&e.scrollbar&&Ft.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Ot.contentWindow){ee(Ol());return}typeof e.notes=="boolean"&&e.notes!==Tt&&ye(e.notes,!1),typeof e.open=="number"&&Sn(e.open),typeof e.grid=="boolean"&&e.grid===w.hidden&&G(e.grid),typeof e.inspect=="string"&&e.inspect!==E&&R(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==ie&&ao(e.resolved),typeof e.archived=="boolean"&&e.archived!==Ne&&io(e.archived),e.reload&&Ge()});let Ye=async()=>{await Ge(),ee({reload:!0}),b&&parent.postMessage({dt:!0,reload:!0},location.origin)},ye=(t,e=!0)=>{if(Tt=t,W.setAttribute("aria-pressed",String(t)),t?!b&&q.hidden&&ot.getItem("dt-history")!=="0"&&(q.hidden=!1,Y.setAttribute("aria-pressed","true")):(q.hidden=!0,Y.setAttribute("aria-pressed","false")),k(je,t?"1":"0"),ee({notes:t}),b&&e&&parent.postMessage({dt:!0,notes:t},location.origin),J.hidden=!t||!Jt.hidden,Ft.toggle("dt-noting",t),t&&!document.querySelector(".dt-room")?document.body.append(Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"})):t||document.querySelector(".dt-room")?.remove(),t){R(""),document.addEventListener("click",Ua,!0);for(let n of za)document.addEventListener(n,Va,!0);document.addEventListener("keydown",_a),document.addEventListener("mousemove",Wa),addEventListener("scroll",ge,!0),addEventListener("resize",ge),addEventListener("pointerover",Ha,!0),qo(),Aa.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),Ca.observe(document.body),po()}else{O(),tt=null,document.removeEventListener("click",Ua,!0);for(let n of za)document.removeEventListener(n,Va,!0);document.removeEventListener("keydown",_a),document.removeEventListener("mousemove",Wa),bt.hidden=!0,removeEventListener("scroll",ge,!0),removeEventListener("resize",ge),removeEventListener("pointerover",Ha,!0),Aa.disconnect(),Ca.disconnect(),J.innerHTML=""}},{pickBp:ri,...li}=tr({cfg:s,inFrame:b,persist:k,frame:Jt,frameEl:Ot,devicesMenu:St,bpBtns:z,notesOverlay:J,WIDE:m,bpOf:v,currentBp:Ts,deviceById:H,notesOn:()=>Tt,filter:()=>ae,filterTo:t=>{ae=t},dropFrameDrafts:()=>{Zs=[]},putAway:()=>{tt=null,O()},tellFrame:ee,syncBpButtons:Po,render:()=>Q(),reread:()=>{Tt?po():Q()}}),di="dt-studio",ci=t=>{nt.setAttribute("aria-pressed",String(t)),Ft.toggle("dt-no-studio",!t),k(di,t?"1":"0")};nt.addEventListener("click",()=>ci(nt.getAttribute("aria-pressed")!=="true")),ci(ot.getItem(di)!=="0"),W.addEventListener("click",()=>ye(!Tt));let Ie=document.querySelector(".devtools"),mn=document.querySelector(".dt-tab"),ui=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-Ie.getBoundingClientRect().top)+12}px`);new ResizeObserver(ui).observe(Ie),addEventListener("resize",ui);let pi=t=>{Ie.toggleAttribute("data-collapsed",t),mn.toggleAttribute("data-collapsed",t),mn.setAttribute("aria-expanded",String(!t)),mn.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(let e of Ie.querySelectorAll(".dt-group"))e.inert=t;t&&mt(),k("dt-collapsed",t?"1":"0")};mn.addEventListener("click",()=>pi(!Ie.hasAttribute("data-collapsed")));let Se=document.querySelector(".dt-keys"),hi=Se.querySelector(".dt-set-keys"),$o=t=>{hi.hidden=!t,Se.querySelector(".dt-set-main").hidden=t};if(Yt.signOut)for(let t of Se.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;Se.querySelector("summary").addEventListener("click",()=>$o(!1)),Se.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let n=e.dataset.set;if(n==="keys"||n==="back")return $o(n==="keys");Se.open=!1,n==="hide"&&mn.click(),n==="out"&&confirm("Sign out of Notemend on this site?")&&Yt.signOut?.()});let ve=t=>()=>Ie.querySelector(t)?.click(),mi=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(n=>n.hasAttribute("aria-current"))+t]?.click()},ps=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:ve(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:ve(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:ve(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>io(!Ne)},{group:"Threads",code:"KeyM",hint:"M",label:"Studio / clients",run:()=>An(He==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Pe.hidden||Hn(le.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:ve(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:ve(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:ve(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:ve(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:ve(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:ve(".dt-border-btn")},...s.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:ve(".dt-studio-btn")}]:[],...z.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:()=>{St.open=!St.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:mi(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:mi(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>mn.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=Se.open&&!hi.hidden;Se.open=!t,$o(!t)}}].filter(t=>!s.client||t.group!=="Inspect"),gi=(t,e)=>ps.find(n=>n.code===t&&!n.shift==!e),Dl=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(s.shortcuts){for(let e of ps){let n=e.el&&Ie.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))}let t=(e,n)=>`<div class="dt-key-row"><span>${g(e)}</span><kbd>${g(n)}</kbd></div>`;if(Se.querySelector(".dt-keys-list").innerHTML='<p class="dt-menu-note">One key, no modifier, in any keyboard layout. Not while you type.</p>'+[...new Set(ps.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+ps.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||Dl(e.target))return;let n=gi(e.code,e.shiftKey);n&&(e.preventDefault(),b?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):n.run())}),b){let e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",n=>{n.key==="Escape"&&e()})}}if(!b){pi(ot.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>Ie.setAttribute("data-ready",""))),li.restore(),G(ot.getItem(A)==="1");let t=ot.getItem(se);t&&t in Vt&&R(t),ye(ot.getItem(je)==="1")}let fi=()=>{try{let t=JSON.parse(ot.getItem(ue)||"null");Nt=(t?.parked??[]).filter(e=>C(e)),t?.draft&&document.querySelector(t.draft.selector)?(T=t.draft,!Tt&&!b&&ye(!0)):C(t?.draft)&&Nt.push(t.draft),t?.reply?.text&&(Ht=t.reply.text,Et=tt=t.reply.for??null),(T||Nt.length||Ht)&&Q()}catch{ot.removeItem(ue)}};fi();let bi=()=>setTimeout(()=>{let t=B(location.pathname);t!==Z&&(clearTimeout(sn),vn(),Z=t,ue=$e(),T=null,Nt=[],Ht="",Et=null,tt=null,gt=null,V=[],L(),fi(),po(),Ge())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...n){e.apply(this,n),bi()}}addEventListener("popstate",bi),i.then(async t=>{t.status===200&&Fa(await t.json())},()=>{}).then(()=>ie?Ge(!0):void 0).then(ss.resume),document.addEventListener("visibilitychange",()=>{document.hidden||Nn()}),addEventListener("focus",Nn),addEventListener("notemend:changed",()=>{b||Nn()});let ql=0;b||setInterval(()=>{(!Yt.live||++ql%6===0)&&Nn()},2e4),b&&parent.postMessage({dt:!0,hello:!0},location.origin)}function rr(s){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,d=i.showModal,h=null,m=null,v=()=>{if(h){m?.disconnect(),m=null;for(let b of s)document.body.append(b);try{h.hidePopover()}catch{}h.remove(),h=null}},S=()=>{v();let b=document.querySelector("dialog:modal");b&&H(b)},H=b=>{v(),h=document.createElement("div"),h.className="dt-host",h.setAttribute("popover","manual"),h.append(...s),b.append(h);try{h.showPopover()}catch{}b.addEventListener("close",S,{once:!0}),m=new MutationObserver(()=>{b.isConnected||S()}),m.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){d.call(this),this.isConnected&&H(this)}}var md=".devtools, [class^='dt-'], [class*=' dt-']";function lr(){let s=document.createElement("div");s.className="dt-tipbox",s.setAttribute("role","tooltip"),s.id="dt-tipbox",s.hidden=!0,document.body.append(s);let i=null,d,h=0,m=k=>{let y=k.getAttribute("title");y!==null&&(k.removeAttribute("title"),k.hasAttribute("data-tip")||k.setAttribute("data-tip",y),!k.hasAttribute("aria-label")&&!k.textContent?.trim()&&k.setAttribute("aria-label",y))},v=k=>{let y=k?.closest?.("[data-tip], [title]");return y&&y.closest(md)&&!y.closest(".dt-tipbox")?y:null},S=k=>{let y=k.getAttribute("data-tip");if(!y||k.getAttribute("aria-expanded")==="true")return H();s.textContent=y,s.hidden=!1;let B=k.getBoundingClientRect(),Z=s.getBoundingClientRect(),F=6,w=8,A=B.bottom+F+Z.height<=innerHeight-w;s.style.top=`${A?B.bottom+F:Math.max(w,B.top-F-Z.height)}px`,s.style.left=`${Math.min(Math.max(w,B.left+B.width/2-Z.width/2),innerWidth-w-Z.width)}px`,s.classList.toggle("is-mono",k.classList.contains("dt-note-el")),k.setAttribute("aria-describedby",s.id)},H=()=>{clearTimeout(d),i&&!s.hidden&&(h=performance.now()+400),i?.removeAttribute("aria-describedby"),i=null,s.hidden=!0},b=k=>{k!==i&&(H(),m(k),i=k,performance.now()<h?S(k):d=setTimeout(()=>i===k&&S(k),300))};document.addEventListener("pointerover",k=>{let y=v(k.target);y?b(y):i&&!i.contains(k.target)&&H()},!0),document.addEventListener("pointerout",k=>{i&&!i.contains(k.relatedTarget)&&H()},!0),document.addEventListener("focusin",k=>{let y=v(k.target);y&&k.target.matches(":focus-visible")&&b(y)},!0),document.addEventListener("focusout",H,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("keydown",k=>{k.key==="Escape"&&H()},!0),addEventListener("scroll",H,!0),new MutationObserver(()=>{i&&!i.isConnected&&H()}).observe(document.body,{childList:!0,subtree:!0})}function dr(){let s=window;if(s.__notemend)return;s.__notemend=!0,zi(d=>d.includes("/__devbar/")||!!Yt.base&&d.startsWith(Yt.base)),Ft.ready=new Promise(d=>{if(!("__next_f"in self))return d();let h=0,m=()=>Object.keys(document.documentElement).some(v=>v.startsWith("__reactFiber$"))||++h>330?d():setTimeout(m,30);m()}),Ft.toggle("dt-in-frame",ys);let i=At("comments?open=1");Mi().then(d=>{Ft.set("--dt-z",String(d.zIndex));let h=d.brand?.color;if(h&&/^#[0-9a-f]{6}$/i.test(h)){let[m,v,S]=[1,3,5].map(H=>parseInt(h.slice(H,H+2),16)/255);Ft.set("--dt-accent",h),Ft.set("--dt-accent-ink",.2126*m+.7152*v+.0722*S>.55?"#000000":"#ffffff")}qi(d),ir(d,i),lr(),rr([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-tipbox"].map(m=>document.querySelector(m)).filter(m=>!!m))}).catch(d=>console.warn("[notemend] not started:",d))}dr();import.meta.hot&&import.meta.hot.accept(()=>location.reload());