notemend 0.1.35 → 0.1.36

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,30 +1,30 @@
1
- import"./notemend.css";var ce={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function oe(n,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<8e3&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!ce.via){let m=window.__notemendEarly,g=!i.method||i.method==="GET"?m?.[n]:void 0;if(g){delete m[n];let b=await g;if(b)return b}return fetch(`/__devbar/${n}`,i)}let c=await ce.via(n,i);if(c.ok&&n.startsWith("comments")&&(i.method??"GET")==="GET"){let m=await c.json().catch(()=>{});m?.signed&&Object.assign(ce.signed,m.signed),c.json=()=>m===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(m)}return c}var wr=n=>ce.via?ce.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Vs=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),ct={getItem:n=>{try{return localStorage.getItem(n)}catch{return null}},setItem:(n,i)=>{try{localStorage.setItem(n,i)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}},bc=()=>ct.getItem("dt-resolved")==="0"&&ct.getItem("dt-archived")!=="1"?"comments?open=1":"comments";var $c=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null,xc=n=>{let i={};for(let c of n?.images||[]){let m=$c(c);m&&(i[m]=c)}return i},Ao={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},$r=/^(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,Wm=/^(png|jpe?g|webp|gif|webm)$/i,qa=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,Zt=(n,i)=>{let c=String(n??"");if(c.length<=i)return c;let m="";if(qa)for(let{segment:g}of qa.segment(c)){if(m.length+g.length>i)break;m+=g}else for(let g of c){if(m.length+g.length>i)break;m+=g}return m},zm=[["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"]],Ec=n=>{let i=String(n??"").split(".").pop().toLowerCase(),c=zm.find(([,,m])=>m.split(" ").includes(i));return c?{label:c[0],color:c[1]}:{label:"FILE",color:"#717171"}},xr=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),Vm=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((n,i)=>[n,["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]])),Mc=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>Vm[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),kc=n=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return i&&!$r.test(i[1])?i[1].toLowerCase():""};var Ho=n=>{let i=String(n??"");if(i.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!g)return null;let b=/;ext=([a-z0-9]{1,8})/i.exec(g[2])?.[1]?.toLowerCase()??Object.keys(Ao).find(L=>Ao[L]===g[1]);return b?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${b}`:null}let c=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(c))return null;let m=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(c);return m&&!Wm.test(m[2])?`${m[1]||"document"}.${m[2].toLowerCase()}`:null},an=n=>{let i=[{author:"you",text:n.text,at:n.createdAt,by:n.by,byName:n.byName,images:[],...n.reactions?{reactions:n.reactions}:{}},...n.note?[{author:"claude",text:n.note,at:n.updatedAt,images:[]}]:[],...(n.replies||[]).map(c=>({...c,images:[]}))];for(let c of n.images||[]){if($c(c))continue;let m=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(c)?.[1]?.slice(0,13)),g=0;i.forEach((b,L)=>{Date.parse(b.at)<=m&&(g=L)}),i[g].images.push(c)}return i.filter(c=>!c.deleted)},Lc=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],Sc=["\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 Gm=20,Tc=(n,i,c)=>{let m={...n||{}},g=m[i]||[];if(!g.length&&Object.keys(m).length>=Gm)return null;let b=g.includes(c)?g.filter(L=>L!==c):[...g,c];return b.length?m[i]=b:delete m[i],Object.keys(m).length?m:void 0},Ac=n=>n.nickname||n.name||n.email,Er="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",Km=new RegExp("^"+Er,"u"),Um=(n,i)=>{let c="@"+i.toLowerCase(),m=-1;for(let g=n.indexOf(c);g!==-1;g=n.indexOf(c,g+1))Km.test(n.slice(g+c.length))&&(m=g);return m};var Ym=/https?:\/\/[^\s<>"']+/g,yc=n=>{let i=n.filter(Boolean).pop();try{return i?decodeURIComponent(i):""}catch{return i}},Xm=n=>{let i;try{i=new URL(n)}catch{return{label:String(n),kind:"link"}}let c=i.hostname.replace(/^www\./,""),m=i.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(c))return{label:m[2]?`Figma \xB7 ${yc([m[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(c==="github.com"&&m.length){let[b,L,A,v]=m;return{label:`GitHub \xB7 ${L??b}${/^(pull|issues)$/.test(A??"")&&v?` #${v}`:""}`,kind:A==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(c))return{label:"Loom",kind:"link"};let g=yc(m);return{label:g?`${c} \xB7 ${g.length>32?Zt(g,31)+"\u2026":g}`:c,kind:"link"}},Mr=n=>{let i=String(n??""),c=[],m=0;for(let g of i.matchAll(Ym)){let b=g[0].replace(/[.,;:!?)\]]+$/,"");g.index>m&&c.push(i.slice(m,g.index)),c.push({url:b,...Xm(b)}),m=g.index+b.length}return m<i.length&&c.push(i.slice(m)),c},Hc=n=>Mr(n).map(i=>typeof i=="string"?i:i.label).join(""),vc={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},Cc=new Map,Nc=(n=[])=>{for(let i of n)i?.email&&Cc.set(i.email.toLowerCase(),i.agent_name?.trim()||"")},Zn=(n,i)=>i&&Cc.get(String(Lr(i)??i).toLowerCase())||"Agent",kr=n=>!n||n==="claude"?"via Claude Code":n==="agent"||!vc[n]?"":`via ${vc[n]}`,Da="3.6 3.6 10.8 10.8",Fa="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",Lr=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,Jt=n=>n==="claude"||Lr(n)!=null;var Jm=["new","approved","progress","review","waiting"],qe=n=>Jm.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":Jt(n?.assignee)?"approved":"new",It=n=>n?.client===!0||n?.shared===!0,Bc=(n,i,c="")=>`Duplicated from ${c?c==="you"?"your":`${c}\u2019s`:"a"} ${(i?It(i):!It(n))?"client":"studio"} thread`,Rc=n=>It(n)?"Duplicated for the client":"Mirrored to Team",Gs=n=>Number.isInteger(n?.from?.id)&&!It(n),Pc=(n="")=>`Mirrored from Client${n?` by ${n}`:""}`,To={new:"Received",progress:"In progress",review:"In progress",waiting:"In progress",done:"Fixed \u2014 please check"},Ic=(n,i=Date.now())=>n?.status==="done"?To.done:hn(n,i)||["progress","review","waiting"].includes(qe(n))?To.progress:To.new,Oc="Fixed \u2014 please check.",qc=n=>n?.status==="done"&&!It(n)&&Number.isInteger(n.from?.id)?n.from.id:null;var ja=["agent","claude","codex","gemini"];var Sr=(n,i=[])=>{let c=String(n||"").toLowerCase();return ja.some(m=>Um(c,m)!==-1)?"claude":null},Dc=(n,i=[],c="")=>{let m=String(n||"").replace(/^@/,"").toLowerCase();if(ja.includes(m))return"agent";let g=i.find(b=>[b.name,b.nickname,b.email].some(L=>L&&L.toLowerCase()===m));return g&&c&&g.email?.toLowerCase()===c.toLowerCase()?"you":"person"};var Zm=2*36e5,hn=(n,i=Date.now())=>n?.working&&n.status!=="done"&&i-Date.parse(n.working.at)<Zm?n.working:null;var Co=(n,i,c=Date.now())=>{let m=String(n?.by||n?.byName||"").toLowerCase();if(!m||i==="done")return null;let g=i==="claude"||Jt(n.assignee),b=g?hn(n,c)?.by||n.doneFor||n.handedBy||Lr(n.assignee)||m:n.assignee||"";return{writer:m,taker:String(b).toLowerCase(),claude:g}},Tr=n=>/@guest\.notemend\.com$/i.test(String(n||"")),Ee=(n,i=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":Jt(n.assignee)?"done":null;if(!Jt(n.assignee))return null;let c=an(n),m=c[c.length-1],g=hn(n,i);return c.length>1&&m.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(m.at))&&(!g||String(m.text??"").includes("?"))?"asks":g?g.step&&i-Date.parse(g.at)>Qm?"stuck":"working":n.working?"stuck":qe(n)==="approved"?"queued":null},Qm=10*6e4,wc=(n,i=Date.now())=>{let c=Math.floor((i-Date.parse(n??""))/6e4);return c>=1?c<60?`${c} min`:`${Math.floor(c/60)} h`:"now"},Ar=(n,i=31)=>{let c=qa?[...qa.segment(String(n??""))].map(b=>b.segment):[...String(n??"")];if(c.length<=i)return c.join("");let m=c.join("").match(/\.\w{1,8}$/)?.[0],g=m?m.length+3:0;return c.slice(0,i-1-g).join("")+"\u2026"+(g?c.slice(-g).join(""):"")},Hr=(n,i=Date.now())=>{let c=n?.status!=="done"?n?.working:null;return c?.at?{step:c.step?String(c.step):null,elapsed:wc(c.since??c.at,i),silent:wc(c.at,i),stale:!hn(n,i)}:null};var Fc=Fa.split("M").filter(Boolean).map(n=>{let i=n.match(/[\d.]+/g).map(Number),[c,m]=/H/.test(n)?[i[2],i[1]]:/V/.test(n)?[i[0],i[2]]:[i[2],i[3]];return{d:"M"+n,a:(Math.atan2(c-9,9-m)+2*Math.PI)%(2*Math.PI)}}).sort((n,i)=>n.a-i.a).map(n=>n.d);var jc=(n,i)=>{if(n.archivedAt)return!0;if(!i||n.status!=="done"||n.doneBy==="claude")return!1;let c=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(m=>!m.deleted).map(m=>Date.parse(m.at||"")||0));return!!c&&Date.now()-c>i*864e5},th=["uk","ru","en"],_c=n=>{try{let i=new Intl.DisplayNames([n],{type:"language"}).of(n)??n;return i[0].toUpperCase()+i.slice(1)}catch{return n}},Cr=n=>{try{return new Intl.DisplayNames(["en"],{type:"language"}).of(n)??n}catch{return n}},_a=n=>/[іїєґІЇЄҐ]/.test(n)?"uk":/[ыэъёЫЭЪЁ]/.test(n)?"ru":/\p{Script=Cyrillic}/u.test(n)?"":/\p{L}/u.test(n)&&!/[^\p{Script=Latin}\P{L}]/u.test(n)?"en":"",Wc=(n,i="en")=>{let c=_a(n),m=i.split("-")[0].toLowerCase();return[...new Set([m,...th])].filter(g=>g!==c)};async function zc(){let n=await oe("config");if(!n.ok)throw Object.assign(new Error(`config ${n.status}`),{said:n.status===401?await n.text().catch(()=>""):""});let i=await n.json();return i.breakpoints=i.breakpoints.map(c=>({...c,max:c.max??1/0})),Nc(i.team),i}var Vc=["iPhone","Android","Foldable","Tablet","Laptop & display"],No=[{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 f=n=>n.replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]),Qn=n=>n?new Date(n).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Br=(n,i=c=>new Date(c).toLocaleDateString("en",{day:"numeric",month:"short"}))=>new Date(n).toDateString()===new Date().toDateString()?new Date(n).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):i(n),ts='<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>',Me='<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>',es='<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>',Ln='<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>',Pn='<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>',Wa='<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>',za='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',gn='<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>',De=n=>`<svg viewBox="${Da}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${Fa}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Rr=(n,i)=>`<svg viewBox="${Da}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${Fc.map((c,m)=>`<path d="${c}" stroke-width="1.15" stroke-linecap="round"${m<i?"":' class="is-off"'}/>`).join("")}</svg>`,xt=(n,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${n}</svg>`,eh=n=>n.breakpoints.map(i=>["new","progress","review","waiting","done"].map(c=>`<b data-bp="${f(i.id)}" data-state="${c}" hidden>${xt(i.icon,11)}<i></i></b>`).join("")).join(""),Gc=(n,i,c,m)=>`<li${m?` draggable="true" data-route="${f(i.route)}"`:""}><a href="${/^\/(?![\/\\])/.test(i.route)?f(i.route):"#"}"${i.route===c?' aria-current="page"':""}>`+(m?'<i class="dt-grip" aria-hidden="true"></i>':"")+`<span class="dt-menu-label">${f(i.label)}</span><em class="dt-pages-n" hidden>${eh(n)}</em></a></li>`,nh='<svg viewBox="0 4 100 100" width="18" height="18" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',Bo=xt('<path d="M6 8l4 4 4-4" />',12),Nr='<rect x="3" y="4" width="14" height="12" rx="2" /><path d="M3 8h14" />',Kc='<circle cx="8" cy="7" r="3" /><path d="M2.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="M13.5 12.5l1.2 1.2 2.3-2.4" />',Pr={studio:Nr,clients:Kc};function Uc(n){let i=n.client?' style="display:none"':"",c=[...new Set(n.devices.map(T=>T.group))].map(T=>`<p class="dt-devices-group">${f(T)}</p>`+n.devices.filter(M=>M.group===T).map(M=>`<button type="button" data-device="${f(M.id)}" aria-pressed="false"${M.note?` title="${f(M.note)}"`:""}><span class="dt-menu-label">${f(M.label)}</span><em>${M.w}&times;${M.h}</em></button>`).join("")).join(""),m=Vc.map(T=>`<p class="dt-devices-group">${f(T)}</p>`+No.filter(M=>M.group===T).map(M=>`<button type="button" data-emu="${f(M.id)}" aria-pressed="false"><span class="dt-menu-label">${f(M.label)}</span><em>${M.w}&times;${M.h}</em></button>`).join("")).join(""),g=n.breakpoints.map(T=>`<button class="dt-icon dt-bp" type="button" data-bp="${f(T.id)}" aria-pressed="false" title="${f(T.label)}">${xt(T.icon,16)}</button>`).join(""),b="Real screens, the browser around the page. A thread goes to its width\u2019s breakpoint.",L="The page at the device\u2019s size. A thread goes to its breakpoint.",A=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),v="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
1
+ import"./notemend.css";var ae={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function ie(n,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<8e3&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!ae.via){let h=window.__notemendEarly,g=!i.method||i.method==="GET"?h?.[n]:void 0;if(g){delete h[n];let y=await g;if(y)return y}return fetch(`/__devbar/${n}`,i)}let c=await ae.via(n,i);if(c.ok&&n.startsWith("comments")&&(i.method??"GET")==="GET"){let h=await c.json().catch(()=>{});h?.signed&&Object.assign(ae.signed,h.signed),c.json=()=>h===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(h)}return c}var wr=n=>ae.via?ae.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Vs=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),ct={getItem:n=>{try{return localStorage.getItem(n)}catch{return null}},setItem:(n,i)=>{try{localStorage.setItem(n,i)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}},yc=()=>ct.getItem("dt-resolved")==="0"&&ct.getItem("dt-archived")!=="1"?"comments?open=1":"comments";var xc=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null,Ec=n=>{let i={};for(let c of n?.images||[]){let h=xc(c);h&&(i[h]=c)}return i},Ao={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},$r=/^(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,Vm=/^(png|jpe?g|webp|gif|webm)$/i,Da=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,Jt=(n,i)=>{let c=String(n??"");if(c.length<=i)return c;let h="";if(Da)for(let{segment:g}of Da.segment(c)){if(h.length+g.length>i)break;h+=g}else for(let g of c){if(h.length+g.length>i)break;h+=g}return h},Gm=[["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"]],Mc=n=>{let i=String(n??"").split(".").pop().toLowerCase(),c=Gm.find(([,,h])=>h.split(" ").includes(i));return c?{label:c[0],color:c[1]}:{label:"FILE",color:"#717171"}},xr=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),Km=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((n,i)=>[n,["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]])),kc=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>Km[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),Lc=n=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return i&&!$r.test(i[1])?i[1].toLowerCase():""};var Ho=n=>{let i=String(n??"");if(i.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!g)return null;let y=/;ext=([a-z0-9]{1,8})/i.exec(g[2])?.[1]?.toLowerCase()??Object.keys(Ao).find(S=>Ao[S]===g[1]);return y?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${y}`:null}let c=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(c))return null;let h=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(c);return h&&!Vm.test(h[2])?`${h[1]||"document"}.${h[2].toLowerCase()}`:null},an=n=>{let i=[{author:"you",text:n.text,at:n.createdAt,by:n.by,byName:n.byName,images:[],...n.reactions?{reactions:n.reactions}:{}},...n.note?[{author:"claude",text:n.note,at:n.updatedAt,images:[]}]:[],...(n.replies||[]).map(c=>({...c,images:[]}))];for(let c of n.images||[]){if(xc(c))continue;let h=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(c)?.[1]?.slice(0,13)),g=0;i.forEach((y,S)=>{Date.parse(y.at)<=h&&(g=S)}),i[g].images.push(c)}return i.filter(c=>!c.deleted)},Sc=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],Tc=["\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 Um=20,Ac=(n,i,c)=>{let h={...n||{}},g=h[i]||[];if(!g.length&&Object.keys(h).length>=Um)return null;let y=g.includes(c)?g.filter(S=>S!==c):[...g,c];return y.length?h[i]=y:delete h[i],Object.keys(h).length?h:void 0},Hc=n=>n.nickname||n.name||n.email,Er="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",Ym=new RegExp("^"+Er,"u"),Xm=(n,i)=>{let c="@"+i.toLowerCase(),h=-1;for(let g=n.indexOf(c);g!==-1;g=n.indexOf(c,g+1))Ym.test(n.slice(g+c.length))&&(h=g);return h};var Jm=/https?:\/\/[^\s<>"']+/g,vc=n=>{let i=n.filter(Boolean).pop();try{return i?decodeURIComponent(i):""}catch{return i}},Zm=n=>{let i;try{i=new URL(n)}catch{return{label:String(n),kind:"link"}}let c=i.hostname.replace(/^www\./,""),h=i.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(c))return{label:h[2]?`Figma \xB7 ${vc([h[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(c==="github.com"&&h.length){let[y,S,C,w]=h;return{label:`GitHub \xB7 ${S??y}${/^(pull|issues)$/.test(C??"")&&w?` #${w}`:""}`,kind:C==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(c))return{label:"Loom",kind:"link"};let g=vc(h);return{label:g?`${c} \xB7 ${g.length>32?Jt(g,31)+"\u2026":g}`:c,kind:"link"}},Mr=n=>{let i=String(n??""),c=[],h=0;for(let g of i.matchAll(Jm)){let y=g[0].replace(/[.,;:!?)\]]+$/,"");g.index>h&&c.push(i.slice(h,g.index)),c.push({url:y,...Zm(y)}),h=g.index+y.length}return h<i.length&&c.push(i.slice(h)),c},Cc=n=>Mr(n).map(i=>typeof i=="string"?i:i.label).join(""),wc={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},Nc=new Map,Bc=(n=[])=>{for(let i of n)i?.email&&Nc.set(i.email.toLowerCase(),i.agent_name?.trim()||"")},Zn=(n,i)=>i&&Nc.get(String(Lr(i)??i).toLowerCase())||"Agent",kr=n=>!n||n==="claude"?"via Claude Code":n==="agent"||!wc[n]?"":`via ${wc[n]}`,Fa="3.6 3.6 10.8 10.8",ja="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",Lr=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,Xt=n=>n==="claude"||Lr(n)!=null;var Qm=["new","approved","progress","review","waiting"],De=n=>Qm.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":Xt(n?.assignee)?"approved":"new",Bt=n=>n?.client===!0||n?.shared===!0,Rc=(n,i,c="")=>`Duplicated from ${c?c==="you"?"your":`${c}\u2019s`:"a"} ${(i?Bt(i):!Bt(n))?"client":"studio"} thread`,Pc=n=>Bt(n)?"Duplicated for the client":"Mirrored to Team",Gs=n=>Number.isInteger(n?.from?.id)&&!Bt(n),Ic=(n="")=>`Mirrored from Client${n?` by ${n}`:""}`,To={new:"Received",progress:"In progress",review:"In progress",waiting:"In progress",done:"Fixed \u2014 please check"},Oc=(n,i=Date.now())=>n?.status==="done"?To.done:hn(n,i)||["progress","review","waiting"].includes(De(n))?To.progress:To.new,qc="Fixed \u2014 please check.",Dc=n=>n?.status==="done"&&!Bt(n)&&Number.isInteger(n.from?.id)?n.from.id:null;var _a=["agent","claude","codex","gemini"];var Sr=(n,i=[])=>{let c=String(n||"").toLowerCase();return _a.some(h=>Xm(c,h)!==-1)?"claude":null},Fc=(n,i=[],c="")=>{let h=String(n||"").replace(/^@/,"").toLowerCase();if(_a.includes(h))return"agent";let g=i.find(y=>[y.name,y.nickname,y.email].some(S=>S&&S.toLowerCase()===h));return g&&c&&g.email?.toLowerCase()===c.toLowerCase()?"you":"person"};var th=2*36e5,hn=(n,i=Date.now())=>n?.working&&n.status!=="done"&&i-Date.parse(n.working.at)<th?n.working:null;var Co=(n,i,c=Date.now())=>{let h=String(n?.by||n?.byName||"").toLowerCase();if(!h||i==="done")return null;let g=i==="claude"||Xt(n.assignee),y=g?hn(n,c)?.by||n.doneFor||n.handedBy||Lr(n.assignee)||h:n.assignee||"";return{writer:h,taker:String(y).toLowerCase(),claude:g}},Tr=n=>/@guest\.notemend\.com$/i.test(String(n||"")),Ee=(n,i=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":Xt(n.assignee)?"done":null;if(!Xt(n.assignee))return null;let c=an(n),h=c[c.length-1],g=hn(n,i);return c.length>1&&h.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(h.at))&&(!g||String(h.text??"").includes("?"))?"asks":g?g.step&&i-Date.parse(g.at)>eh?"stuck":"working":n.working?"stuck":De(n)==="approved"?"queued":null},eh=10*6e4,$c=(n,i=Date.now())=>{let c=Math.floor((i-Date.parse(n??""))/6e4);return c>=1?c<60?`${c} min`:`${Math.floor(c/60)} h`:"now"},Ar=(n,i=31)=>{let c=Da?[...Da.segment(String(n??""))].map(y=>y.segment):[...String(n??"")];if(c.length<=i)return c.join("");let h=c.join("").match(/\.\w{1,8}$/)?.[0],g=h?h.length+3:0;return c.slice(0,i-1-g).join("")+"\u2026"+(g?c.slice(-g).join(""):"")},Hr=(n,i=Date.now())=>{let c=n?.status!=="done"?n?.working:null;return c?.at?{step:c.step?String(c.step):null,elapsed:$c(c.since??c.at,i),silent:$c(c.at,i),stale:!hn(n,i)}:null};var jc=ja.split("M").filter(Boolean).map(n=>{let i=n.match(/[\d.]+/g).map(Number),[c,h]=/H/.test(n)?[i[2],i[1]]:/V/.test(n)?[i[0],i[2]]:[i[2],i[3]];return{d:"M"+n,a:(Math.atan2(c-9,9-h)+2*Math.PI)%(2*Math.PI)}}).sort((n,i)=>n.a-i.a).map(n=>n.d);var _c=(n,i)=>{if(n.archivedAt)return!0;if(!i||n.status!=="done"||n.doneBy==="claude")return!1;let c=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(h=>!h.deleted).map(h=>Date.parse(h.at||"")||0));return!!c&&Date.now()-c>i*864e5},nh=["uk","ru","en"],Wc=n=>{try{let i=new Intl.DisplayNames([n],{type:"language"}).of(n)??n;return i[0].toUpperCase()+i.slice(1)}catch{return n}},Cr=n=>{try{return new Intl.DisplayNames(["en"],{type:"language"}).of(n)??n}catch{return n}},Wa=n=>/[іїєґІЇЄҐ]/.test(n)?"uk":/[ыэъёЫЭЪЁ]/.test(n)?"ru":/\p{Script=Cyrillic}/u.test(n)?"":/\p{L}/u.test(n)&&!/[^\p{Script=Latin}\P{L}]/u.test(n)?"en":"",zc=(n,i="en")=>{let c=Wa(n),h=i.split("-")[0].toLowerCase();return[...new Set([h,...nh])].filter(g=>g!==c)};async function Vc(){let n=await ie("config");if(!n.ok)throw Object.assign(new Error(`config ${n.status}`),{said:n.status===401?await n.text().catch(()=>""):""});let i=await n.json();return i.breakpoints=i.breakpoints.map(c=>({...c,max:c.max??1/0})),Bc(i.team),i}var Gc=["iPhone","Android","Foldable","Tablet","Laptop & display"],No=[{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 f=n=>n.replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i]),Qn=n=>n?new Date(n).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Br=(n,i=c=>new Date(c).toLocaleDateString("en",{day:"numeric",month:"short"}))=>new Date(n).toDateString()===new Date().toDateString()?new Date(n).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):i(n),ts='<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>',Me='<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>',es='<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>',kn='<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>',Pn='<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>',za='<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>',Va='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',gn='<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>',Fe=n=>`<svg viewBox="${Fa}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${ja}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Rr=(n,i)=>`<svg viewBox="${Fa}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${jc.map((c,h)=>`<path d="${c}" stroke-width="1.15" stroke-linecap="round"${h<i?"":' class="is-off"'}/>`).join("")}</svg>`,$t=(n,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${n}</svg>`,sh=n=>n.breakpoints.map(i=>["new","progress","review","waiting","done"].map(c=>`<b data-bp="${f(i.id)}" data-state="${c}" hidden>${$t(i.icon,11)}<i></i></b>`).join("")).join(""),Kc=(n,i,c,h)=>`<li${h?` draggable="true" data-route="${f(i.route)}"`:""}><a href="${/^\/(?![\/\\])/.test(i.route)?f(i.route):"#"}"${i.route===c?' aria-current="page"':""}>`+(h?'<i class="dt-grip" aria-hidden="true"></i>':"")+`<span class="dt-menu-label">${f(i.label)}</span><em class="dt-pages-n" hidden>${sh(n)}</em></a></li>`,oh='<svg viewBox="0 4 100 100" width="18" height="18" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',Bo=$t('<path d="M6 8l4 4 4-4" />',12),Nr='<rect x="3" y="4" width="14" height="12" rx="2" /><path d="M3 8h14" />',Uc='<circle cx="8" cy="7" r="3" /><path d="M2.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="M13.5 12.5l1.2 1.2 2.3-2.4" />',Pr={studio:Nr,clients:Uc};function Yc(n){let i=n.client?' style="display:none"':"",c=[...new Set(n.devices.map(A=>A.group))].map(A=>`<p class="dt-devices-group">${f(A)}</p>`+n.devices.filter(k=>k.group===A).map(k=>`<button type="button" data-device="${f(k.id)}" aria-pressed="false"${k.note?` title="${f(k.note)}"`:""}><span class="dt-menu-label">${f(k.label)}</span><em>${k.w}&times;${k.h}</em></button>`).join("")).join(""),h=Gc.map(A=>`<p class="dt-devices-group">${f(A)}</p>`+No.filter(k=>k.group===A).map(k=>`<button type="button" data-emu="${f(k.id)}" aria-pressed="false"><span class="dt-menu-label">${f(k.label)}</span><em>${k.w}&times;${k.h}</em></button>`).join("")).join(""),g=n.breakpoints.map(A=>`<button class="dt-icon dt-bp" type="button" data-bp="${f(A.id)}" aria-pressed="false" title="${f(A.label)}">${$t(A.icon,16)}</button>`).join(""),y="Real screens, the browser around the page. A thread goes to its width\u2019s breakpoint.",S="The page at the device\u2019s size. A thread goes to its breakpoint.",C=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),w="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
2
2
  <!-- The top strip (Figma Proposals 33 \xABW9\xBB, 10.11): the mark, the studio / the space \u2304 on the left,
3
3
  the address \u2014 the page list with its folders and search \u2014 in the middle, you and settings on the right.
4
4
  The bar below keeps the tools. It lies over the site and comes out at the top edge; pinned, it stays and moves the site (12.11). -->
5
5
  <div class="dt-strip" role="banner" aria-label="Notemend">
6
6
  <div class="dt-strip-side">
7
- <span class="dt-strip-mark">${nh}</span>
7
+ <span class="dt-strip-mark">${oh}</span>
8
8
  ${n.studioName?`<span class="dt-strip-studio">${f(n.studioName)}</span>`:""}
9
9
  <details class="dt-space" name="dt-menu" hidden>
10
- <summary data-tip="Switch space \xB7 M"><span class="dt-space-ic">${xt(Nr,14)}</span><span class="dt-space-name">Team</span>${Bo}</summary>
10
+ <summary data-tip="Switch space \xB7 M"><span class="dt-space-ic">${$t(Nr,14)}</span><span class="dt-space-name">Team</span>${Bo}</summary>
11
11
  <div class="dt-space-menu" role="menu" aria-label="Whose threads">
12
- <button type="button" role="menuitemradio" data-space="studio" aria-checked="true">${xt(Nr,14)}<span><b>Team</b><em>Only people in ${f(n.studioName||"your studio")}</em></span><i class="dt-space-n"></i></button>
13
- <button type="button" role="menuitemradio" data-space="clients" aria-checked="false">${xt(Kc,14)}<span><b>Client</b><em>Also visible to the client of this project</em></span><i class="dt-space-n"></i></button>
12
+ <button type="button" role="menuitemradio" data-space="studio" aria-checked="true">${$t(Nr,14)}<span><b>Team</b><em>Only people in ${f(n.studioName||"your studio")}</em></span><i class="dt-space-n"></i></button>
13
+ <button type="button" role="menuitemradio" data-space="clients" aria-checked="false">${$t(Uc,14)}<span><b>Client</b><em>Also visible to the client of this project</em></span><i class="dt-space-n"></i></button>
14
14
  </div>
15
15
  </details>
16
16
  </div>
17
17
  <details class="dt-pages" name="dt-menu">
18
18
  <summary aria-label="Pages">
19
- <span class="dt-pages-copy" role="button" tabindex="0" aria-label="Copy the page\u2019s link" data-tip="Copy link">${xt('<path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-.9.9M11.5 8.5a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l.9-.9" />',15)}</span>
19
+ <span class="dt-pages-copy" role="button" tabindex="0" aria-label="Copy the page\u2019s link" data-tip="Copy link">${$t('<path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-.9.9M11.5 8.5a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l.9-.9" />',15)}</span>
20
20
  <span class="dt-pages-addr"><span class="dt-pages-host">${f(location.host)}</span><span class="dt-pages-slash">/</span><span class="dt-pages-name"></span></span>
21
21
  <em class="dt-pages-here" hidden></em>${Bo}
22
22
  </summary>
23
23
  <div class="dt-pages-menu">
24
- <label class="dt-pages-find">${xt('<circle cx="9" cy="9" r="5.5" /><path d="m13.2 13.2 3.3 3.3" />',14)}<input type="search" placeholder="Search pages" aria-label="Search pages" /><kbd>/</kbd></label>
24
+ <label class="dt-pages-find">${$t('<circle cx="9" cy="9" r="5.5" /><path d="m13.2 13.2 3.3 3.3" />',14)}<input type="search" placeholder="Search pages" aria-label="Search pages" /><kbd>/</kbd></label>
25
25
  <ul class="dt-pages-list"></ul>
26
26
  <div class="dt-pages-hits" hidden></div>
27
- <div class="dt-pages-foot" hidden><button type="button" class="dt-folder-new">${xt('<path d="M10 4.5v11M4.5 10h11" />',14)}<span>New folder</span></button><p class="dt-sel-hint" hidden></p></div>
27
+ <div class="dt-pages-foot" hidden><button type="button" class="dt-folder-new">${$t('<path d="M10 4.5v11M4.5 10h11" />',14)}<span>New folder</span></button><p class="dt-sel-hint" hidden></p></div>
28
28
  </div>
29
29
  </details>
30
30
  <div class="dt-strip-side dt-strip-end">
@@ -32,36 +32,36 @@ import"./notemend.css";var ce={base:"",via:null,signed:{},live:!1,signOut:null,c
32
32
  <summary data-tip="You"><span class="dt-me-face"></span><span class="dt-me-name">${f(n.me?.name||n.me?.email||"")}</span>${Bo}</summary>
33
33
  <div class="dt-me-menu" role="menu">
34
34
  <p class="dt-set-who">Signed in as<b>${f(n.me?.email??"")}</b></p><hr>
35
- <a role="menuitem" class="dt-me-cab" target="_blank" rel="noopener" hidden>${xt('<path d="M11 3.5h5.5V9M16.5 3.5 9 11M14 11.5v4A1.5 1.5 0 0 1 12.5 17h-8A1.5 1.5 0 0 1 3 15.5v-8A1.5 1.5 0 0 1 4.5 6h4" />',14)}<span>Open the cabinet</span></a>
36
- <a role="menuitem" class="dt-me-acc" target="_blank" rel="noopener" hidden>${xt('<circle cx="7.5" cy="7" r="3" /><path d="M2 16.5c.5-2.8 2.6-4.5 5.5-4.5s5 1.7 5.5 4.5M13 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1.4.6 2.3 2 2.5 4.1" />',14)}<span>Account</span></a>
35
+ <a role="menuitem" class="dt-me-cab" target="_blank" rel="noopener" hidden>${$t('<path d="M11 3.5h5.5V9M16.5 3.5 9 11M14 11.5v4A1.5 1.5 0 0 1 12.5 17h-8A1.5 1.5 0 0 1 3 15.5v-8A1.5 1.5 0 0 1 4.5 6h4" />',14)}<span>Open the cabinet</span></a>
36
+ <a role="menuitem" class="dt-me-acc" target="_blank" rel="noopener" hidden>${$t('<circle cx="7.5" cy="7" r="3" /><path d="M2 16.5c.5-2.8 2.6-4.5 5.5-4.5s5 1.7 5.5 4.5M13 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1.4.6 2.3 2 2.5 4.1" />',14)}<span>Account</span></a>
37
37
  <hr data-set-out hidden>
38
- <button type="button" role="menuitem" data-set="out" hidden>${xt('<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>
38
+ <button type="button" role="menuitem" data-set="out" hidden>${$t('<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>
39
39
  </div>
40
40
  </details>
41
41
  <!-- settings (the top strip, beside \u2303; who you are and signing out moved to the profile): the keys (their list in the same menu, written by the script from
42
42
  the table that runs them), hiding the bar, signing out of a hosted bar -->
43
43
  <details class="dt-keys" name="dt-menu">
44
44
  <summary class="dt-icon" title="Settings">
45
- ${xt('<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>')}
45
+ ${$t('<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>')}
46
46
  </summary>
47
47
  <div class="dt-keys-menu">
48
48
  <div class="dt-set-main">
49
- ${n.client?"":`<button type="button" data-set="grid">${xt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />',14)}<span>Grid</span><em class="dt-set-hint">Auto</em>${xt('<path d="M8 5l5 5-5 5" />',12)}</button>`}
50
- <button type="button" data-set="custom">${xt('<rect x="3" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="3" y="11.5" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="11.5" width="5.5" height="5.5" rx="1.5" stroke-dasharray="2 1.6" />',14)}<span>Customize the bar</span></button>
51
- <button type="button" data-set="keys"${n.shortcuts?"":" hidden"}>${xt('<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>
52
- <button type="button" data-set="hide">${xt('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${n.shortcuts?"<kbd>\\</kbd>":""}</button>
49
+ ${n.client?"":`<button type="button" data-set="grid">${$t('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />',14)}<span>Grid</span><em class="dt-set-hint">Auto</em>${$t('<path d="M8 5l5 5-5 5" />',12)}</button>`}
50
+ <button type="button" data-set="custom">${$t('<rect x="3" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="3" y="11.5" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="11.5" width="5.5" height="5.5" rx="1.5" stroke-dasharray="2 1.6" />',14)}<span>Customize the bar</span></button>
51
+ <button type="button" data-set="keys"${n.shortcuts?"":" hidden"}>${$t('<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>
52
+ <button type="button" data-set="hide">${$t('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${n.shortcuts?"<kbd>\\</kbd>":""}</button>
53
53
  </div>
54
54
  <!-- the project's grid (Figma: Settings menu \u203A Pane=Grid \xB7 Custom / Grid \xB7 Auto), drawn by run.ts -->
55
55
  <div class="dt-set-grid" hidden></div>
56
56
  <div class="dt-set-keys" hidden>
57
- <button type="button" class="dt-set-back" data-set="back">${xt('<path d="M15.5 10h-11M9 5.5 4.5 10 9 14.5" />',13)}<span>Keyboard shortcuts</span></button>
57
+ <button type="button" class="dt-set-back" data-set="back">${$t('<path d="M15.5 10h-11M9 5.5 4.5 10 9 14.5" />',13)}<span>Keyboard shortcuts</span></button>
58
58
  <hr>
59
59
  <div class="dt-keys-list"></div>
60
60
  </div>
61
61
  </div>
62
62
  </details>
63
63
  <!-- the pin: kept out, the strip moves the site down; let go, it lies over the site and hides (Figma Proposals 44 \xB7 3) -->
64
- <button type="button" class="dt-icon dt-strip-pin" aria-pressed="false" aria-label="Keep the strip out" data-tip="Keep it out \u2014 moves the site">${xt('<g transform="scale(0.8333)" stroke-width="1.8"><path d="M12 17v5" /><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" /></g>',15)}</button>
64
+ <button type="button" class="dt-icon dt-strip-pin" aria-pressed="false" aria-label="Keep the strip out" data-tip="Keep it out \u2014 moves the site">${$t('<g transform="scale(0.8333)" stroke-width="1.8"><path d="M12 17v5" /><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" /></g>',15)}</button>
65
65
  </div>
66
66
  </div>
67
67
  <!-- at rest the strip is away: a grip at the top edge (the pointer at the edge, a tap on it, or \u21E7 brings the strip out) -->
@@ -72,49 +72,49 @@ import"./notemend.css";var ce={base:"",via:null,signed:{},live:!1,signOut:null,c
72
72
  ${n.client&&n.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(n.brand.logo)?`<img class="dt-brand" src="${f(n.brand.logo)}" alt="" />`:""}
73
73
  <div class="dt-group" role="group" aria-label="Inspect"${i}>
74
74
  <button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
75
- ${xt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
75
+ ${$t('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
76
76
  </button>
77
77
  <button class="dt-icon dt-pad-btn" type="button" aria-pressed="false" title="Spacing">
78
- ${xt('<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" />')}
78
+ ${$t('<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" />')}
79
79
  </button>
80
80
  <button class="dt-icon dt-size-btn" type="button" aria-pressed="false" title="Size">
81
- ${xt('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
81
+ ${$t('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
82
82
  </button>
83
83
  <button class="dt-icon dt-type-btn" type="button" aria-pressed="false" title="Typography">
84
- ${xt('<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" />')}
84
+ ${$t('<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" />')}
85
85
  </button>
86
86
  <button class="dt-icon dt-color-btn" type="button" aria-pressed="false" title="Color">
87
- ${xt('<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" />')}
87
+ ${$t('<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" />')}
88
88
  </button>
89
89
  <button class="dt-icon dt-contrast-btn" type="button" aria-pressed="false" title="Contrast">
90
- ${xt('<circle cx="10" cy="10" r="7" /><path d="M10 3a7 7 0 0 1 0 14z" fill="currentColor" />')}
90
+ ${$t('<circle cx="10" cy="10" r="7" /><path d="M10 3a7 7 0 0 1 0 14z" fill="currentColor" />')}
91
91
  </button>
92
92
  <!-- Figma \xABBar \xB7 Vision \xB7 4 Vision sheet\xBB: the view as six kinds of eyes, filled in by run.ts -->
93
93
  <details class="dt-vision" name="dt-menu">
94
94
  <summary class="dt-icon" title="Vision">
95
- ${xt('<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.5" />')}
95
+ ${$t('<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.5" />')}
96
96
  </summary>
97
97
  <div class="dt-sheet dt-vision-sheet"></div>
98
98
  </details>
99
99
  <button class="dt-icon dt-border-btn" type="button" aria-pressed="false" title="Border & radius">
100
- ${xt('<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" />')}
100
+ ${$t('<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" />')}
101
101
  </button>
102
102
  <button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${n.sanity?"":" hidden"}>
103
- ${xt('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
103
+ ${$t('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
104
104
  </button>
105
105
  </div>
106
106
 
107
107
  <div class="dt-group" role="group" aria-label="Threads">
108
108
  <button class="dt-icon dt-notes-btn" type="button" aria-pressed="false" title="Comment">
109
- ${xt('<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" />')}
109
+ ${$t('<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" />')}
110
110
  <span class="dt-notes-count" hidden></span>
111
111
  </button>
112
112
  <button class="dt-icon dt-history-btn" type="button" aria-pressed="false" title="Panel">
113
- ${xt('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
113
+ ${$t('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
114
114
  </button>
115
115
  <!-- resolved pins on or off: the switch is in the comments panel's head now; this one stays for the code that reads it -->
116
116
  <button class="dt-icon dt-resolved-btn" type="button" aria-pressed="true" title="Resolved" hidden style="display:none">
117
- ${xt('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
117
+ ${$t('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
118
118
  </button>
119
119
  </div>
120
120
 
@@ -123,20 +123,20 @@ import"./notemend.css";var ce={base:"",via:null,signed:{},live:!1,signOut:null,c
123
123
  <div class="dt-group dt-group--menus">
124
124
  <details class="dt-devices" name="dt-menu">
125
125
  <summary title="Devices">
126
- ${xt('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
126
+ ${$t('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
127
127
  <span class="dt-devices-name">Device</span>
128
128
  </summary>
129
129
  <div class="dt-devices-menu">
130
130
  <div class="dt-menu-tabs" role="tablist" aria-label="Device lists">
131
- <button type="button" role="tab" data-tab="preview" aria-selected="true" aria-description="${b}" data-tip="${b}">Preview</button>
132
- <button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${L}" data-tip="${L}">DevTools</button>
131
+ <button type="button" role="tab" data-tab="preview" aria-selected="true" aria-description="${y}" data-tip="${y}">Preview</button>
132
+ <button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${S}" data-tip="${S}">DevTools</button>
133
133
  </div>
134
134
  <div class="dt-menu-panel" role="tabpanel" data-panel="preview">
135
135
  ${c}
136
136
  </div>
137
137
  <div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
138
138
  <input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
139
- ${m}
139
+ ${h}
140
140
  </div>
141
141
  </div>
142
142
  </details>
@@ -155,14 +155,14 @@ import"./notemend.css";var ce={base:"",via:null,signed:{},live:!1,signOut:null,c
155
155
  <!-- push to Claude: one square tool in the agent's well \u2014 a press sends what waits for Claude; a right
156
156
  click or a long press picks pages and threads. Beside turbo, the studio's only, shown while there is any. -->
157
157
  <span class="dt-push" hidden${n.client?' style="display:none"':""}>
158
- <button class="dt-push-all" type="button" aria-label="Push to the agent"><svg viewBox="${Da}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${Fa}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
158
+ <button class="dt-push-all" type="button" aria-label="Push to the agent"><svg viewBox="${Fa}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${ja}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
159
159
  >
160
160
  <div class="dt-push-menu" hidden role="dialog" aria-label="What goes to the agent"></div>
161
161
  </span>
162
162
  <!-- turbo: a bolt in the agent's well beside push, always there for the studio \u2014 lit while
163
163
  an agent session takes comments, grey when none is listening or it is paused here -->
164
164
  <button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${n.client?" hidden":""}>
165
- <span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${xt('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
165
+ <span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${$t('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
166
166
  </button>
167
167
  </div>
168
168
 
@@ -174,14 +174,14 @@ import"./notemend.css";var ce={base:"",via:null,signed:{},live:!1,signOut:null,c
174
174
 
175
175
  <div class="dt-frame" hidden role="region" aria-label="Breakpoint preview">
176
176
  <div class="dt-stage">
177
- <span class="dt-frame-handle" data-edge="l" title="${v}"></span>
177
+ <span class="dt-frame-handle" data-edge="l" title="${w}"></span>
178
178
  <div class="dt-device">
179
179
  <div class="dt-shell"></div>
180
180
  <iframe title="Breakpoint preview"></iframe>
181
181
  <div class="dt-chrome" data-at="top"></div>
182
182
  <div class="dt-chrome" data-at="bottom"></div>
183
183
  </div>
184
- <span class="dt-frame-handle" data-edge="r" title="${v}"></span>
184
+ <span class="dt-frame-handle" data-edge="r" title="${w}"></span>
185
185
  </div>
186
186
  <div class="dt-ruler"></div>
187
187
  <span class="dt-frame-size"></span>
@@ -200,121 +200,121 @@ import"./notemend.css";var ce={base:"",via:null,signed:{},live:!1,signOut:null,c
200
200
  <div class="dt-notes-overlay" hidden role="region" aria-label="Threads on this page"></div>
201
201
  <!-- the clients' space: a frame round the page and its name in a notch at the top, with \xD7 back to the studio's -->
202
202
  <div class="dt-client-frame" aria-hidden="true"></div>
203
- <div class="dt-client-tab" inert aria-hidden="true">${xt('<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>Client space</span><button type="button" class="dt-client-x" aria-label="Back to Team" data-tip="Back to Team \xB7 M">${xt('<path d="M6 6l8 8M14 6l-8 8" />',10)}</button></div>
203
+ <div class="dt-client-tab" inert aria-hidden="true">${$t('<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>Client space</span><button type="button" class="dt-client-x" aria-label="Back to Team" data-tip="Back to Team \xB7 M">${$t('<path d="M6 6l8 8M14 6l-8 8" />',10)}</button></div>
204
204
  <div class="dt-grid-overlay" hidden>
205
205
  <div class="dt-grid-chip"><span></span><button type="button" hidden>Edit</button></div>
206
206
  <div class="${f(n.grid.container)} dt-overlay-container" aria-hidden="true">
207
- <div class="${f(n.grid.grid)} dt-overlay-grid">${A}</div>
207
+ <div class="${f(n.grid.grid)} dt-overlay-grid">${C}</div>
208
208
  </div>
209
209
  </div>
210
210
  <div class="dt-pad-overlay" hidden aria-hidden="true"></div>
211
- `)}var Ye=(n,i)=>{let c=i<=0?"":i>=1?"6,0.5 11.5,6 6,11.5 0.5,6":["6,6","6,0.5",...["11.5,6","6,11.5","0.5,6"].slice(0,Math.round(i*4))].join(" ");return`<svg class="dt-stage-icon" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${c?`<polygon points="${c}" fill="${n}"/>`:""}<rect x="1.75" y="1.75" width="8.5" height="8.5" rx="1.5" fill="none" stroke="${n}" stroke-width="1.5" transform="rotate(45 6 6)"/></svg>`};var Yc=[{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"/>'}],Xc=(n,i=14)=>`<svg viewBox="0 0 24 24" width="${i}" height="${i}" fill="none" stroke="${n.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n.icon}</svg>`,Ks=n=>Yc.find(i=>i.id===n)||Yc[0];var Bt=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",Jc={open:"Open",done:"Resolved",claude:"To check"};var Qt={ready:Promise.resolve(),toggle:(n,i)=>{Qt.ready.then(()=>document.documentElement.classList.toggle(n,i))},set:(n,i)=>{Qt.ready.then(()=>document.documentElement.style.setProperty(n,i))}};var sh=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Zc=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(sh,"$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 $s=[],Ir=n=>{if(n instanceof Error)return`${n.name}: ${n.message}`;if(typeof n=="string")return n;try{return JSON.stringify(n)??String(n)}catch{return String(n)}},oh=/ResizeObserver loop/,ws=(n,i)=>{if(oh.test(i))return;let c=Zt(Zc(i.replace(/\s+/g," ").trim()),500),m=$s.findIndex(g=>g.kind===n&&g.text.replace(/ ×\d+$/,"")===c);if(m>=0){let[g]=$s.splice(m,1),b=Number(/ ×(\d+)$/.exec(g.text)?.[1]??1)+1;$s.push({at:new Date().toISOString(),kind:n,text:`${c} \xD7${b}`});return}$s.push({at:new Date().toISOString(),kind:n,text:c}),$s.length>50&&$s.shift()},Qc=!1;function tu(n){if(Qc||typeof window>"u")return;Qc=!0;let i=console.error;console.error=(...g)=>{ws("console",g.map(Ir).join(" ")),i.apply(console,g)},addEventListener("error",g=>{if(g instanceof ErrorEvent)return ws("error",`${g.message}${g.filename?` (${g.filename}:${g.lineno})`:""}`);let b=g.target,L=b?.src||b?.href;L&&!n(L)&&ws("network",`${b.tagName?.toLowerCase()} ${L} did not load`)},!0),addEventListener("unhandledrejection",g=>ws("rejection",Ir(g.reason)));let c=window.fetch;window.fetch=async(g,b)=>{let L=typeof g=="string"?g:g instanceof URL?g.href:g.url,A=(b?.method||(g instanceof Request?g.method:"GET")).toUpperCase();try{let v=await c.call(window,g,b);return v.status>=400&&!n(L)&&ws("network",`${A} ${L} \u2192 ${v.status}`),v}catch(v){throw!n(L)&&v?.name!=="AbortError"&&ws("network",`${A} ${L} \u2192 no answer (${Ir(v)})`),v}};let m=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(g,b,...L){return this._nm=`${g.toUpperCase()} ${String(b)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(b))||ws("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),m.call(this,g,b,...L)}}var eu=(n=Date.now())=>$s.filter(i=>n-Date.parse(i.at)<10*6e4).slice(-20);function nu(n){let i=k=>{let w=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,H=k/w;return Math.round(H*10)%10===0?String(Math.round(H)):H.toFixed(1)},c=(k,w,H,D,O,wt="p")=>{if(H<=0||D<=0)return"";let Et=O!==""?`<span class="dt-pad-chip dt-pad-chip--${wt}" style="left:${k+H/2}px;top:${w+D/2}px">${O}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${wt}" style="left:${k}px;top:${w}px;width:${H}px;height:${D}px"></span>${Et}`},m=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],g="button, a, input, select, textarea, label, [role='button']",b=k=>{let w=k;for(let H=0;w&&H<6;H++,w=w.parentElement){if(w.matches(g))return w;let D=getComputedStyle(w);if(m.some(O=>parseFloat(D[O])>=2))return w}return k},L=(k,w)=>{let H=parseFloat(w.columnGap)||0,D=parseFloat(w.rowGap)||0;if(!(w.display.includes("flex")||w.display.includes("grid"))||!H&&!D)return"";let O=[...k.children].map(st=>st.getBoundingClientRect()).filter(st=>st.width||st.height),wt="",Et=(st,tt)=>i(Math.abs(st-tt)<=1?tt:st);for(let st=1;st<O.length;st++){let tt=O[st-1],lt=O[st];if(H&&lt.left>=tt.right-1){let ht=Math.max(tt.top,lt.top);wt+=c(tt.right,ht,lt.left-tt.right,Math.min(tt.bottom,lt.bottom)-ht,Et(lt.left-tt.right,H),"g")}else if(D&&lt.top>=tt.bottom-1){let ht=Math.min(tt.left,lt.left);wt+=c(ht,tt.bottom,Math.max(tt.right,lt.right)-ht,lt.top-tt.bottom,Et(lt.top-tt.bottom,D),"g")}}return wt},A=k=>`<span class="dt-pad-outline" style="left:${k.left}px;top:${k.top}px;width:${k.width}px;height:${k.height}px"></span>`,v=(k,w,H="")=>`<span class="dt-pad-tag" style="left:${w.left}px;top:${Math.max(2,w.top-22)}px">${k.tagName.toLowerCase()+(k.classList[0]?"."+k.classList[0]:"")}${H}</span>`,T=k=>{let w=k.getBoundingClientRect(),H=getComputedStyle(k),D=parseFloat(H.paddingTop),O=parseFloat(H.paddingRight),wt=parseFloat(H.paddingBottom),Et=parseFloat(H.paddingLeft),st=A(w);st+=c(w.left,w.top,w.width,D,D>=2?i(D):""),st+=c(w.left,w.bottom-wt,w.width,wt,wt>=2?i(wt):""),st+=c(w.left,w.top+D,Et,w.height-D-wt,Et>=2?i(Et):""),st+=c(w.right-O,w.top+D,O,w.height-D-wt,O>=2?i(O):"");let tt=parseFloat(H.marginTop),lt=parseFloat(H.marginRight),ht=parseFloat(H.marginBottom),Ct=parseFloat(H.marginLeft);st+=c(w.left,w.top-tt,w.width,tt,tt>=2?i(tt):"","m"),st+=c(w.left,w.bottom,w.width,ht,ht>=2?i(ht):"","m"),st+=c(w.left-Ct,w.top,Ct,w.height,Ct>=2?i(Ct):"","m"),st+=c(w.right,w.top,lt,w.height,lt>=2?i(lt):"","m"),st+=L(k,H);let $e=parseFloat(H.columnGap)||0,je=parseFloat(H.rowGap)||0,ke=(H.display.includes("flex")||H.display.includes("grid"))&&($e||je)?` \xB7 gap ${i($e)}${je&&je!==$e?"/"+i(je):""}`:"",Gt="",he=k.parentElement;if(k.matches(g)&&he){let ye=getComputedStyle(he);st+=L(he,ye);let _e=parseFloat(ye.columnGap)||parseFloat(ye.rowGap)||0;Gt=` \xB7 ${i(w.width)}\xD7${i(w.height)}${_e&&(ye.display.includes("flex")||ye.display.includes("grid"))?` \xB7 gap ${i(_e)} in its row`:""}`}let He=Gt?"":` \xB7 ${Math.round(parseFloat(i(w.width)))} \xD7 ${Math.round(parseFloat(i(w.height)))}`;n.innerHTML=st+v(k,w,He+ke+Gt)},M=k=>{let w=k.getBoundingClientRect();n.innerHTML=A(w).replace("dt-pad-outline","dt-pad-outline dt-size-line")+`<span class="dt-pad-chip dt-size-chip" style="left:${w.left+w.width/2}px;top:${w.bottom+6}px">${Math.round(parseFloat(i(w.width)))} \xD7 ${Math.round(parseFloat(i(w.height)))}</span>`},z=k=>{let w=(k.match(/[\d.]+/g)||[]).map(Number);if(w.length<3)return k;let H="#"+w.slice(0,3).map(D=>Math.round(D).toString(16).padStart(2,"0")).join("");return w[3]!==void 0&&w[3]<1?`${H} \xB7 ${Math.round(w[3]*100)}%`:H},at=null,X=()=>{if(at)return at;let k=getComputedStyle(document.documentElement),w=document.createElement("span");w.style.display="none",document.body.append(w);let H=[];for(let D of Array.from(k)){if(!D.startsWith("--"))continue;let O=k.getPropertyValue(D).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(O))continue;w.style.color="rgb(1, 2, 3)",w.style.color=O;let wt=getComputedStyle(w).color;wt&&wt!=="rgb(1, 2, 3)"&&H.push([wt,D])}return w.remove(),H.sort((D,O)=>D[1].length-O[1].length),at=H,H},Q=k=>X().find(([w])=>w===k)?.[1]??"",I=null,Tt=()=>{if(I)return I;let k=[],w=H=>{for(let D of Array.from(H))D instanceof CSSStyleRule?D.style.cssText.includes("var(--")&&k.push({sel:D.selectorText,style:D.style}):D instanceof CSSMediaRule?matchMedia(D.conditionText).matches&&w(D.cssRules):"cssRules"in D&&w(D.cssRules)};for(let H of Array.from(document.styleSheets))try{w(H.cssRules)}catch{}return I=k},_t={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(k=>[`border-${k}-color`,[`border-${k}-color`,"border-color",`border-${k}`,"border"]]))},At=(k,w)=>{let H=_t[w]??[w],D=w==="color";for(let O=k;O;O=D?O.parentElement:null){let wt=tt=>H.map(lt=>/var\(\s*(--[\w-]+)/.exec(tt.getPropertyValue(lt))?.[1]).find(Boolean),Et=O instanceof HTMLElement?wt(O.style):void 0;if(Et)return Et;let st="";for(let tt of Tt()){let lt=!1;try{lt=O.matches(tt.sel)}catch{}lt&&(st=wt(tt.style)||st)}if(st)return st;if(D&&O.parentElement&&getComputedStyle(O).color!==getComputedStyle(O.parentElement).color)break}return""},it=(k,w,H)=>{let D=getComputedStyle(k).getPropertyValue(w).trim();if(!D)return z(H);let O=document.createElement("span");if(O.style.display="none",O.style.color=D,!O.style.color)return z(H);document.body.append(O);let wt=getComputedStyle(O).color;return O.remove(),z(wt)},ft=(k,w,H)=>{let D=At(k,w);if(D)return`<b class="dt-var">${D}</b> <em>${it(k,D,H)}</em>`;let O=Q(H);return O?`<span title="Same value as ${O}; not written with it">\u2248 ${O}</span> <em>${z(H)}</em>`:z(H)},Dt=k=>`<i class="dt-type-sw" style="background:${k}"></i>`,Ft={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},Lt=k=>(k.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),ne=(k,w)=>k.slice(0,3).map((H,D)=>H*k[3]+w[D]*(1-k[3])).concat([1]),ue=k=>{let w=[];for(let H=k;H;H=H.parentElement){let D=getComputedStyle(H);if(D.backgroundImage!=="none")return null;let O=Lt(D.backgroundColor);if(O[3]>0&&(w.push(O),O[3]>=1))break}return w.reduceRight((H,D)=>ne(D,H),[255,255,255,1])},pe=k=>{let[w,H,D]=k.slice(0,3).map(O=>(O/=255,O<=.03928?O/12.92:((O+.055)/1.055)**2.4));return .2126*w+.7152*H+.0722*D},me=(k,w,H)=>{let D=ue(k);if(!D)return["Contrast","<em>on an image</em>"];let O=ne(Lt(w.color),D),[wt,Et]=[pe(O),pe(D)].sort((ht,Ct)=>Ct-ht),st=(wt+.05)/(Et+.05),tt=H>=24||H>=18.66&&Number(w.fontWeight)>=700,lt=st>=(tt?4.5:7)?"AAA":st>=(tt?3:4.5)?"AA":"fails AA";return["Contrast",`${st.toFixed(2)}:1 <em class="${lt==="fails AA"?"dt-type-bad":""}">${lt}${tt?" \xB7 large":""}</em>`]},fn=k=>{let w=k.getBoundingClientRect(),H=getComputedStyle(k),D=parseFloat(H.fontSize),O=H.lineHeight==="normal"?0:parseFloat(H.lineHeight),wt=parseFloat(H.letterSpacing)||0,Et=Ct=>`${(Ct*100).toFixed(1).replace(/\.0$/,"")}%`,st=[["Font",H.fontFamily.split(",")[0].replace(/["']/g,"")+(H.fontStyle!=="normal"?` ${H.fontStyle}`:"")],["Weight",`${Ft[H.fontWeight]??""} <em>${H.fontWeight}</em>`],["Size",`${i(D)}px`],["Line",O?`${Et(O/D)} <em>${i(O)}px</em>`:"normal"],["Letter",wt?`${Et(wt/D)} <em>${wt.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",Dt(H.color)+ft(k,"color",H.color)],me(k,H,D)],lt=w.bottom+150<innerHeight?w.bottom+8:Math.max(8,w.top-158),ht=Math.min(Math.max(8,w.left),innerWidth-210);n.innerHTML=A(w)+v(k,w)+`<div class="dt-type-card" style="left:${ht}px;top:${lt}px">${st.map(([Ct,$e])=>`<span class="dt-type-row"><b>${Ct}</b><span>${$e}</span></span>`).join("")}</div>`},zt=k=>k.every(w=>w===k[0])?k[0]:k[1]===k[3]&&k[0]===k[2]?`${k[0]} ${k[1]}`:k.join(" "),Fe=k=>/^rgba\(.*,\s*0\)$|^transparent$/.test(k),fe=(k,w,H,D="")=>{let O=20+H.length*21,Et=w.bottom+O+12<innerHeight?w.bottom+8:Math.max(8,w.top-O-8),st=Math.min(Math.max(8,w.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${w.left}px;top:${w.top}px;width:${w.width}px;height:${w.height}px${D?`;border-radius:${D}`:""}"></span>`+v(k,w)+`<div class="dt-type-card dt-style-card" style="left:${st}px;top:${Et}px">${H.map(([tt,lt])=>`<span class="dt-type-row"><b>${tt}</b><span>${lt}</span></span>`).join("")}</div>`},C=k=>{let w=getComputedStyle(k),H=[];w.backgroundImage!=="none"&&H.push(["Fill",`<em>${/gradient/.test(w.backgroundImage)?"gradient":"image"}</em>`]),Fe(w.backgroundColor)||H.push(["Fill",Dt(w.backgroundColor)+ft(k,"background-color",w.backgroundColor)]),k.textContent?.trim()&&H.push(["Text",Dt(w.color)+ft(k,"color",w.color)]),H.push(["Opacity",`${Math.round(Number(w.opacity)*100)}%`]),H.length||H.push(["Color","<em>no fill or text</em>"]),fe(k,k.getBoundingClientRect(),H)},yt=k=>{let w=getComputedStyle(k),H=[],D=["top","right","bottom","left"],O=D.map(Et=>parseFloat(w.getPropertyValue(`border-${Et}-width`))||0);if(O.some(Et=>Et>0)){let Et=D.filter((tt,lt)=>O[lt]>0);D.forEach((tt,lt)=>H.push([tt[0].toUpperCase()+tt.slice(1),`${i(O[lt])} <em>${w.getPropertyValue(`border-${tt}-style`)}</em>`]));let st=Et.map(tt=>w.getPropertyValue(`border-${tt}-color`));Et.forEach((tt,lt)=>{lt&&st[lt]===st[0]||H.push([lt?`\u21B3 ${tt}`:"Color",Dt(st[lt])+ft(k,`border-${tt}-color`,st[lt])])})}else H.push(["Width","<em>none</em>"]);let wt=["top-left","top-right","bottom-right","bottom-left"].map(Et=>{let[st,tt=st]=w.getPropertyValue(`border-${Et}-radius`).split(" "),lt=ht=>ht.endsWith("%")?ht:i(parseFloat(ht)||0);return st===tt?lt(st):`${lt(st)}/${lt(tt)}`});H.push(["Radius",zt(wt)]),fe(k,k.getBoundingClientRect(),H,w.borderRadius)},Rt=(k,w)=>{let[H,D]=[pe(k),pe(w)].sort((O,wt)=>wt-O);return(H+.05)/(D+.05)},Wt=k=>"#"+k.slice(0,3).map(w=>Math.round(w).toString(16).padStart(2,"0")).join(""),x=(k,w,H)=>{let[D,O,wt]=k.map(ke=>ke/255),Et=Math.max(D,O,wt),st=Math.min(D,O,wt),tt=(Et+st)/2,lt=Et-st,ht=lt?lt/(1-Math.abs(2*tt-1)):0,Ct=lt?Et===D?((O-wt)/lt%6+6)%6:Et===O?(wt-D)/lt+2:(D-O)/lt+4:0,$e=ke=>{let Gt=(1-Math.abs(2*ke-1))*ht,he=Gt*(1-Math.abs(Ct%2-1)),He=ke-Gt/2,[ye,_e,Ms]=Ct<1?[Gt,he,0]:Ct<2?[he,Gt,0]:Ct<3?[0,Gt,he]:Ct<4?[0,he,Gt]:Ct<5?[he,0,Gt]:[Gt,0,he];return[ye,_e,Ms].map(qn=>Math.min(255,Math.max(0,Math.round((qn+He)*255)))).concat([1])},je=pe(k)>=pe(w);for(let ke of je?[1,-1]:[-1,1]){let Gt=ke>0?1:0;if(Rt($e(Gt),w)<H)continue;let he=tt,He=Gt;for(let ye=0;ye<20;ye++){let _e=(he+He)/2;Rt($e(_e),w)>=H?He=_e:he=_e}return $e(He)}return null},E={half:'<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><circle cx="6" cy="6" r="4.5" fill="none" stroke="currentColor" stroke-width="0.9"/><path d="M6 1.5a4.5 4.5 0 0 1 0 9z" fill="currentColor"/></svg>',x:'<svg class="dt-ct-no" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M3 3l5 5M8 3l-5 5" stroke="currentColor" stroke-width="1.1" stroke-linecap="round"/></svg>',ok:'<svg class="dt-ct-ok" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M2.2 5.8 4.4 8l4.4-5" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"/></svg>',copy:'<svg viewBox="0 0 11 11" width="11" height="11" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="0.9"><rect x="4" y="4" width="6" height="6" rx="1.2"/><path d="M7 2.5V2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h.5"/></svg>'},N=k=>`${k.toFixed(1).replace(/\.0$/,"")} : 1`,S="",nt=null,G=!1,vt=k=>{k!==nt&&(nt=k,G=!1),S="";let w=k.getBoundingClientRect(),H=(k instanceof HTMLInputElement||k instanceof HTMLTextAreaElement)&&!k.value&&!!k.placeholder,D=getComputedStyle(k,H?"::placeholder":null),O=parseFloat(D.fontSize),wt=O>=24||O>=18.66&&Number(D.fontWeight)>=700,Et=ue(k),st=ht=>`<i class="dt-type-sw" style="background:${ht}"></i>`,tt;if(!k.textContent?.trim()&&!H&&!(k instanceof HTMLInputElement&&k.value))tt='<p class="dt-ct-note">Point at some text.</p>';else if(!Et)tt='<p class="dt-ct-note">It sits on an image or a gradient: there is no one colour behind it to measure.</p>';else{let ht=ne(Lt(D.color),Et),Ct=Rt(ht,Et),$e=wt?3:4.5,je=Ct>=7?["ok",E.ok+"AAA"]:Ct>=4.5?["ok",E.ok+"AA"]:Ct>=3?["warn","Large text only"]:["bad","Fails"],ke=`<div class="dt-ct-ratio"><b>${N(Ct)}</b><span class="dt-ct-chip dt-ct-chip--${je[0]}">${je[1]}</span></div>`;if(Ct>=7){tt=ke,n.innerHTML=A(w)+v(k,w,H?" \xB7 placeholder":"")+be(w,41,`<div class="dt-ct-card dt-ct-card--one">${tt}</div>`);return}let Gt=(He,ye)=>`<div class="dt-ct-check">${Ct>=ye?E.ok:E.x}<span>${He}</span><em>${N(ye).replace(".0","")}</em></div>`,he=Ct>=$e?null:x(ht,Et,$e);he&&(S=Wt(he)),tt=`<div class="dt-ct-pair"><div><span>Text</span><b>${st(Wt(ht))}${Wt(ht)}</b></div><div><span>Background</span><b>${st(Wt(Et))}${Wt(Et)}</b></div></div>`+ke+Gt("Body text \xB7 AA",4.5)+Gt("Large text \xB7 AA",3)+Gt("Body text \xB7 AAA",7)+(S?G?`<div class="dt-ct-fix dt-ct-fix--done">${E.ok}<span>Copied ${S}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${st(S)}${S}</b>${E.copy}</div>`:"")}let lt=`<div class="dt-ct-card"><div class="dt-ct-head">${E.half}<span>Contrast</span></div>${tt}</div>`;n.innerHTML=A(w)+v(k,w,H?" \xB7 placeholder":"")+be(w,210,lt)},be=(k,w,H)=>{let D=k.bottom+w+12<innerHeight?k.bottom+8:Math.max(8,k.top-w-8),O=Math.min(Math.max(8,k.left),innerWidth-260);return H.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${O}px;top:${D}px"`)};return{spacer:b,drawPads:T,drawSize:M,drawType:fn,drawColor:C,drawBorder:yt,drawContrast:vt,contrastFix:()=>S,markCopied:()=>{G=!0}}}var ae=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),su=(n,i,c=!1)=>{for(let m=i*4;;m*=4){let g=c?ae(n.slice(0,m)).replace(/\s+/g," "):ae(n.slice(0,m));if(g.length>=i||m>=n.length)return g}},Us=(n,i,c=!1)=>Zt(su(n,i,c),i),ou='[class^="dt-"],[class*=" dt-"],.devtools',In=n=>{let i=n;for(;i.parentElement&&i.parentElement!==document.body;)i=i.parentElement;return i.parentElement===document.body&&i.matches(ou)},Va=()=>{let n=null;return(i,c)=>(n||(n=new WeakMap,queueMicrotask(()=>{n=null})),n.has(i)||n.set(i,c()),n.get(i))},ah=()=>{let n=null;return(i,c)=>(n||(n=new Map,queueMicrotask(()=>{n=null})),n.has(i)||n.set(i,c()),n.get(i))};function au(){let n=(x,E)=>x?[...x.children].filter(N=>N.tagName.toUpperCase()===E.toUpperCase()&&!(x===document.body&&N.matches(ou))):[],i=x=>{let E=[],N=x;for(;N&&N.tagName!=="HTML"&&E.length<8;){if(N.id){E.unshift("#"+CSS.escape(N.id));break}let S=N.parentElement,nt=N.tagName.toLowerCase(),G=n(S,N.tagName),vt=S===document.body&&G.length>1?[...N.classList].find(be=>/^[\w-]+$/.test(be)&&G.filter(Vt=>Vt.classList.contains(be)).length===1):void 0;E.unshift(vt?`${nt}.${vt}`:G.length>1?`${nt}:nth-of-type(${G.indexOf(N)+1})`:nt),N=S}return E.join(">")},c=x=>{let E=x.split(">"),N=null;for(let[S,nt]of E.entries()){if(nt.startsWith("#")){if(S)return null;N=document.querySelector(nt);continue}let G=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec(nt);if(!G)return document.querySelector(x);if(!N){if(G[1]!=="body"||G[2]||G[3])return document.querySelector(x);N=document.body;continue}let vt=n(N,G[1].toUpperCase());if(N=(G[2]?vt.find(be=>be.classList.contains(G[2])):vt[G[3]?Number(G[3])-1:0])??null,!N)return null}return N},m=x=>x.replace(/\s+/g," ").trim(),g=Va(),b=(x,E)=>{if(!E)return!0;let[N,S]=g(x,()=>{let G=su(x.textContent||"",60);return[m(Zt(G,60)),m(G.slice(0,60))]}),nt=m(E);return N===nt||S===nt},L=(x,E)=>[x||"*",...(E||[]).map(N=>"."+CSS.escape(N))].join(""),A=ah(),v=x=>{let E=L(x.tag,x.classes);return A(E,()=>{try{return[...document.querySelectorAll(E)].filter(N=>!In(N))}catch{return[]}})},T=x=>{for(let E of x.classes??[]){let N=v({tag:x.tag,classes:[E]});if(N.length)return N}return v({tag:x.tag}).slice(0,400)},M=80,z=Va(),at=x=>z(x,()=>X(x)),X=x=>{let E=x.textContent||"",N=null;for(let S=x.parentElement,nt=0;S&&S!==document.body&&nt<4;S=S.parentElement,nt++){let G=S.textContent||"";if(G===E)continue;let vt=Us(G,M,!0);if(vt&&(vt!==Us(E,M,!0)||(N??=ae(E).replace(/\s+/g," "),ae(G).replace(/\s+/g," ")!==N)))return vt}return""},Q=x=>at(x),I=(x,E,N=120)=>Zt(ae(x.getAttribute(E)),N)||void 0,Tt=Va(),_t=x=>Tt(x,()=>At(x)),At=x=>{for(let E=x.parentElement,N=0;E&&E!==document.body&&N<4;E=E.parentElement,N++){let S=E.querySelector("h1,h2,h3,h4,h5,h6,[role=heading]");if(S&&S!==x&&!x.contains(S))return Us(S.textContent||"",60,!0)||void 0}},it=Va(),ft=x=>it(x,()=>Dt(x)),Dt=x=>{let E=N=>N?Us(N.textContent||"",30,!0):"";return(E(x.previousElementSibling)+"|"+E(x.nextElementSibling)).replace(/^\|$/,"")||void 0},Ft=/^data-(testid|test-id|test|qa|cy|id|key|slug|name|item)$/,Lt=x=>{let E=[...x.attributes].find(S=>Ft.test(S.name)&&S.value),N=(x.getAttribute("src")||x.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)||void 0;return Object.fromEntries(Object.entries({id:x.id?Zt(x.id,80):void 0,data:E?`${E.name}=${Zt(E.value,80)}`:void 0,aria:I(x,"aria-label"),alt:I(x,"alt"),title:I(x,"title"),src:N,href:I(x,"href"),head:_t(x),sib:ft(x)}).filter(([,S])=>S))},ne=(x,E)=>!E||at(x).startsWith(E),ue=new WeakMap,pe=x=>ue.get(x)??"found",me=x=>{let E=x.fp,N=null;try{N=c(x.selector)}catch{}let S=v(x),nt=S.length?S:T(x),G=new Set(nt.slice(0,400));if(N&&!In(N)&&G.add(N),E.id){let Ht=document.getElementById(E.id);Ht&&G.add(Ht)}if(E.data){let[Ht,k]=E.data.split(/=(.*)/s);try{document.querySelectorAll(`[${Ht}="${CSS.escape(k)}"]`).forEach(w=>G.add(w))}catch{}}let vt=null,be=null,Vt=0;for(let Ht of G){if(In(Ht))continue;let k=E.id&&Ht.id===E.id||E.data&&Ht.getAttribute(E.data.split("=")[0])===E.data.split(/=(.*)/s)[1]?35:0,w=ae(x.label)&&b(Ht,x.label)||E.aria&&I(Ht,"aria-label")===E.aria||E.alt&&I(Ht,"alt")===E.alt||E.title&&I(Ht,"title")===E.title||E.href&&I(Ht,"href")===E.href||E.src&&(Ht.getAttribute("src")||Ht.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)===E.src?25:0,H=E.head&&_t(Ht)===E.head||E.sib&&ft(Ht)===E.sib||x.ctx&&at(Ht).startsWith(x.ctx)?15:0,D=k+w+H,O=D+(Ht===N?40:0)+(x.nth!=null&&nt[x.nth]===Ht?5:0);D||(O=Math.min(O,39)),w&&(Vt++,be={el:Ht,score:O}),(!vt||O>vt.score)&&(vt={el:Ht,score:O})}return be&&Vt===1&&be.score<40&&(!vt||vt.score<40)?{el:be.el,score:40}:vt},fn=x=>{let E=zt(x),N=null;if(E){try{N=c(x.selector)}catch{}return ue.set(x,E===N?"found":"moved"),E}let S=x.fp?me(x):null;return S&&S.score>=40?(ue.set(x,S.score>=70?"moved":"probably"),S.el):(ue.set(x,"gone"),null)},zt=x=>{let E=null;try{E=c(x.selector)}catch{E=null}if(E&&In(E)&&(E=null),E&&b(E,x.label)&&ne(E,x.ctx))return E;let N=v(x),S=N.length?N:T(x),nt=ae(x.label)?S.filter(Vt=>b(Vt,x.label)):[],G=(x.ctx?nt.find(Vt=>ne(Vt,x.ctx)):nt.length===1?nt[0]:void 0)??(x.ctx&&!ae(x.label)?N.find(Vt=>ne(Vt,x.ctx)):void 0);if(G)return G;if(x.ctx&&nt.length===1&&m(ae(x.label)).length>=20)return nt[0];let vt=Vt=>Vt.split(">").slice(0,2).join(">"),be=Vt=>!x.ctx&&vt(i(Vt))===vt(x.selector);return ae(x.label)?E&&!x.ctx&&b(E,x.label)?E:nt.length===1&&be(nt[0])?nt[0]:null:E||(x.nth!=null?N[x.nth]??null:null)},Fe=x=>{let E=null;for(let N=x,S=x.parentElement;S&&S!==document.body&&getComputedStyle(N).position!=="fixed";N=S,S=S.parentElement){let nt=getComputedStyle(S);if(nt.overflowX==="visible"&&nt.overflowY==="visible")continue;let G=S.getBoundingClientRect();E=E?{l:Math.max(E.l,G.left),t:Math.max(E.t,G.top),r:Math.min(E.r,G.right),b:Math.min(E.b,G.bottom)}:{l:G.left,t:G.top,r:G.right,b:G.bottom}}return E},fe=x=>{let E=x.getBoundingClientRect();return(E.width>0||E.height>0)&&(!x.checkVisibility||x.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},C=x=>({...x,x:Math.min(Math.max(x.x,3),document.documentElement.clientWidth-30),y:x.y>=0&&x.y<19?19:x.y}),yt=(x,E)=>{let N=E;for(let S=E.parentElement;S&&S!==document.body;S=S.parentElement){if(!fe(S)){N=S;continue}let nt=E.getBoundingClientRect();if(nt.width||nt.height)return C({x:nt.left+nt.width*x.rx,y:nt.top+nt.height*x.ry,el:E,hidden:S,shut:N});let G=S.getBoundingClientRect();return C({x:G.left,y:G.top,el:E,hidden:S,shut:N})}return null},Rt=x=>{let E=x.opener?zt(x.opener):null;if(!E||!fe(E))return null;let N=E.getBoundingClientRect();return C({x:N.right-4,y:N.top+4,el:E,opener:E})};return{cssPath:i,poolOf:v,contextOf:Q,resolveEl:fn,anchorOf:(x,E=fn(x))=>{if(!E)return Rt(x);if(!fe(E))return Rt(x)??yt(x,E);let N=E.getBoundingClientRect(),S=N.left+N.width*x.rx,nt=N.top+N.height*x.ry,G=Fe(E);return G?S<G.l||S>G.r||nt<G.t||nt>G.b?null:{x:S,y:nt,el:E}:{x:S,y:nt,el:E}},anchorState:pe,fingerprintOf:Lt}}var iu=(n,i)=>`<svg class="dt-bars" viewBox="0 0 18 11" width="18" height="11" aria-hidden="true">${[0,1,2,3].map(c=>`<rect x="${c*5}" y="${6-c*2}" width="3" height="${5+c*2}" rx="1" fill="${c<n?i:"#fff"}" stroke="none"${c<n?"":' opacity="0.12"'}/>`).join("")}</svg>`;function ru(n,i,c){let m=document.createElement("div");m.className="dt-field-menu",m.setAttribute("role","listbox"),m.hidden=!0,document.body.append(m);for(let L of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])m.addEventListener(L,A=>A.stopPropagation());let g=null,b=()=>{m.hidden=!0,g=null};for(let L of n)L.addEventListener("mousedown",A=>{let v=A.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select");if(!v){m.contains(A.target)||b();return}if(A.preventDefault(),g===v){b();return}g=v;let T=v.classList.contains("dt-more-select"),M=I=>T?I.dataset.on!=null:I.selected,z=v.dataset.search;m.innerHTML=(z?`<label class="dt-field-search"><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg><input type="search" placeholder="${i(z)}" aria-label="${i(z)}" spellcheck="false"></label>`:"")+[...v.options].map((I,Tt)=>I.hidden?"":I.dataset.head!=null?`<p class="dt-field-head">${i(I.text)}${I.dataset.note?`<small>${i(I.dataset.note)}</small>`:""}</p>`:`${I.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${Tt}" aria-selected="${M(I)}"${I.disabled?" disabled":""}${I.dataset.hint?` data-tip="${i(I.dataset.hint)}" data-hint="${i(I.dataset.hint.toLowerCase())}"`:""}${I.dataset.danger!=null?' class="is-danger"':""}>${I.dataset.icon?I.dataset.icon:I.dataset.initial!=null?I.dataset.face?`<img class="dt-face" src="${i(I.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${i(I.dataset.initial)}</b>`:I.dataset.bare!=null?"":`<i style="background:${i(I.dataset.c||"#717171")}"></i>`}<span>${i(I.text)}</span>${I.dataset.note?`<small>${i(I.dataset.note)}</small>`:""}${M(I)?c:""}</button>${I.dataset.sepAfter!=null?"<hr>":""}`).join("")+(z?'<p class="dt-field-none" hidden></p>':""),m.classList.toggle("is-people",!!z);let at=v.parentElement.getBoundingClientRect(),X=z?v.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;m.style.left=`${X?X.left+4:at.left}px`,m.style.top=`${at.bottom+4}px`,m.style.minWidth=`${X?X.width-8:Math.max(200,at.width)}px`,m.style.width=X?`${X.width-8}px`:"",m.hidden=!1;for(let I of m.querySelectorAll("[data-hint]")){let Tt=I.querySelector("span");Tt.scrollWidth>Tt.clientWidth&&(I.dataset.tip=`${Tt.textContent} \xB7 ${I.dataset.tip}`)}let Q=m.getBoundingClientRect();(Q.bottom>innerHeight-8||z&&v.closest(".dt-note"))&&(m.style.top=`${Math.max(8,at.top-4-Q.height)}px`),Q.right>innerWidth-8&&(m.style.left=`${Math.max(8,at.right-Q.width)}px`),m.querySelector(".dt-field-search input")?.focus()});m.addEventListener("input",L=>{let A=L.target.value.trim().toLowerCase(),v=0;for(let M of m.querySelectorAll("[data-i]"))M.hidden=!!A&&!M.textContent.toLowerCase().includes(A)&&!M.dataset.hint?.includes(A),M.hidden||v++;for(let M of m.querySelectorAll("hr"))M.hidden=!!A;let T=m.querySelector(".dt-field-none");T&&(T.hidden=v>0,T.textContent=`No one matches \xAB${L.target.value.trim()}\xBB`)}),m.addEventListener("keydown",L=>{L.key!=="Enter"||!L.target.matches("input")||(L.preventDefault(),m.querySelector("[data-i]:not([hidden])")?.click())}),m.addEventListener("click",L=>{let A=L.target.closest("[data-i]");if(!A||!g)return;let v=g;b(),!(v.selectedIndex===Number(A.dataset.i)&&!v.classList.contains("dt-more-select"))&&(v.selectedIndex=Number(A.dataset.i),v.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",L=>{L.key==="Escape"&&!m.hidden&&(L.stopPropagation(),b())},!0),document.addEventListener("pointerdown",L=>{!m.hidden&&!m.contains(L.target)&&!L.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select")&&b()},!0),addEventListener("scroll",L=>{m.contains(L.target)||b()},!0)}var ns=()=>!matchMedia("(prefers-reduced-motion: reduce)").matches,On=n=>Promise.allSettled(n.getAnimations({subtree:!0}).filter(i=>i.effect?.getComputedTiming().iterations!==1/0).map(i=>i.finished)),Ro=new WeakMap,ss=(n,i)=>{let c=Ro.has(n);Ro.set(n,i),!c&&(n.setAttribute("data-leaving",""),On(n).then(()=>{let m=Ro.get(n);m&&(Ro.delete(n),n.removeAttribute("data-leaving"),m())}))},Po=n=>{Ro.delete(n),n.removeAttribute("data-leaving")},lu=n=>{let i=n.cloneNode(!0);for(let c of["id","data-id","data-draft","data-parked"])i.removeAttribute(c);i.setAttribute("data-ghost",""),i.setAttribute("aria-hidden","true"),i.inert=!0,n.after(i),On(i).then(()=>i.remove())},Io=(n,i)=>{n.removeAttribute("data-nudge"),n.offsetWidth,n.setAttribute("data-nudge",i),On(n).then(()=>{n.getAttribute("data-nudge")===i&&n.removeAttribute("data-nudge")})},du=n=>{let i=getComputedStyle(document.documentElement).getPropertyValue(n).trim(),c=i.indexOf(" ");return{duration:parseFloat(i)*(/^[\d.]+s$/.test(i.slice(0,c))?1e3:1),easing:i.slice(c+1)}},Ga=(n,i,c=1/0)=>{let m=n.hidden?0:Math.min(n.offsetHeight,c),g=n.hidden?"0":getComputedStyle(n).opacity;n.getAnimations().forEach(v=>v.cancel()),n.hidden=!1;let b=i?Math.min(n.scrollHeight,c):0,L=()=>{n.hidden=!i};if(!ns()||m===b)return L();let A=n.animate([{height:`${m}px`,opacity:g,overflow:"hidden"},{height:`${b}px`,opacity:i?1:0,overflow:"hidden"}],{...du(i?"--dt-smooth":"--dt-snappy"),fill:"forwards"});A.onfinish=()=>{L(),A.cancel()}},Or=(n,i,c,m,g)=>{if(n.getAnimations().forEach(L=>L.cancel()),!ns()||Math.abs(i-c)<1)return g();let b=n.animate([{height:`${i}px`,overflow:"hidden"},{height:`${c}px`,overflow:"hidden"}],{...du(m?"--dt-smooth":"--dt-snappy"),fill:"forwards"});b.onfinish=()=>{g(),b.cancel()}};var ih=".devtools, [class^='dt-'], [class*=' dt-']",rh=300,cu=null,uu=n=>{cu=n};function pu(){let n=document.createElement("div");n.className="dt-tipbox",n.setAttribute("role","tooltip"),n.id="dt-tipbox",n.hidden=!0,document.body.append(n);let i=null,c,m=0,g=T=>{let M=T.getAttribute("title");M!==null&&(T.removeAttribute("title"),T.hasAttribute("data-tip")||T.setAttribute("data-tip",M),!T.hasAttribute("aria-label")&&!T.textContent?.trim()&&T.setAttribute("aria-label",M))},b=T=>{let M=T?.closest?.("[data-tip], [title]");return M&&M.closest(ih)&&!M.closest(".dt-tipbox")?M:null},L=T=>{let M=T.getAttribute("data-tip");if(!M||T.getAttribute("aria-expanded")==="true")return A();let z=cu?.(T);n.classList.toggle("is-peek",!!z),z?n.innerHTML=z:n.textContent=M,Po(n),n.hidden=!1,n.style.left="0px",n.style.top="0px";let at=T.getBoundingClientRect(),X=n.getBoundingClientRect(),Q=6,I=8;if(z){let _t=at.right+8+X.width<=innerWidth-I;n.style.left=`${_t?at.right+8:Math.max(I,at.left-8-X.width)}px`,n.style.top=`${Math.min(Math.max(I,at.top-4),innerHeight-I-X.height)}px`,T.setAttribute("aria-describedby",n.id);return}let Tt=at.bottom+Q+X.height<=innerHeight-I;n.style.top=`${Tt?at.bottom+Q:Math.max(I,at.top-Q-X.height)}px`,n.style.left=`${Math.min(Math.max(I,at.left+at.width/2-X.width/2),innerWidth-I-X.width)}px`,n.classList.toggle("is-mono",T.classList.contains("dt-note-el")),T.setAttribute("aria-describedby",n.id)},A=()=>{clearTimeout(c),i&&!n.hidden&&(m=performance.now()+400),i?.removeAttribute("aria-describedby"),i=null,n.hidden||ss(n,()=>{n.hidden=!0})},v=T=>{T!==i&&(A(),g(T),i=T,performance.now()<m?L(T):c=setTimeout(()=>i===T&&L(T),rh))};document.addEventListener("pointerover",T=>{let M=b(T.target);M?v(M):i&&!i.contains(T.target)&&A()},!0),document.addEventListener("pointerout",T=>{i&&!i.contains(T.relatedTarget)&&A()},!0),document.addEventListener("focusin",T=>{let M=T.target,z=b(M);z&&M.matches(":focus-visible")&&v(z)},!0),document.addEventListener("focusout",A,!0),document.addEventListener("pointerdown",A,!0),document.addEventListener("keydown",T=>{T.key==="Escape"&&A()},!0),addEventListener("scroll",A,!0),new MutationObserver(()=>{i&&(!i.isConnected||i.getAttribute("aria-expanded")==="true")&&A()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-expanded"]})}var mt={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>'},qr=(n,i)=>n.toLocaleTimeString("en-US",i),Ka=n=>qr(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),lh={island:n=>({side:12,top:12,bottom:12,r:n.w>=430?62:55,body:n.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:n=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((n.w+32)*.12),extraH:18}),laptop:n=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((n.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function dh(n,i,c,m,g){let b=n.w+2*i.side,L=n.h+i.top+i.bottom,A=(c-b)/2,v=`<rect class="dt-shell-screen" x="${g}" y="${i.top}" width="${n.w}" height="${n.h}" rx="${i.r}"/>`,T="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let M=(z,at,X)=>`<rect class="dt-shell-btn" x="${z}" y="${at}" width="4" height="${X}" rx="2"/>`;T+=n.shell==="punch"?M(A+b-1,150,70)+M(A+b-1,240,44):M(A-3,120,28)+M(A-3,170,56)+M(A-3,236,56)+M(A+b-1,190,90),T+=`<rect class="dt-shell-body" x="${A}" y="0" width="${b}" height="${L}" rx="${i.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${A+3}" y="3" width="${b-6}" height="${L-6}" rx="${i.body-3}"/>`,n.shell==="home"&&(T+=`<rect class="dt-shell-slot" x="${c/2-26}" y="44" width="52" height="6" rx="3"/>`,T+=`<circle class="dt-shell-slot" cx="${c/2-48}" cy="47" r="5"/>`,T+=`<circle class="dt-shell-homebtn" cx="${c/2}" cy="${L-46}" r="28"/>`)}else if(n.shell==="tablet")T+=`<rect class="dt-shell-body dt-shell-body--light" x="${A}" y="0" width="${b}" height="${L}" rx="${i.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${A+4}" y="4" width="${b-8}" height="${L-8}" rx="${i.body-4}"/>`;else if(n.shell==="monitor"){let M=Math.round(b*.1);T+=`<path class="dt-shell-stand" d="M${c/2-M/2} ${L-2}h${M}l${M*.2} 84h${-M*1.4}z"/>`,T+=`<rect class="dt-shell-stand" x="${c/2-b*.15}" y="${L+80}" width="${b*.3}" height="14" rx="7"/>`,T+=`<rect class="dt-shell-body" x="${A}" y="0" width="${b}" height="${L}" rx="${i.body}"/>`}else{let M=b+(i.extraW??0),z=(c-M)/2,at=i.extraH??16;T+=`<path class="dt-shell-body" d="M${A} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${b-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${L}H${A}z"/>`,T+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${z} ${L}h${M}v${at-8}a8 8 0 0 1-8 8H${z+8}a8 8 0 0 1-8-8z"/>`,T+=`<rect class="dt-shell-lip" x="${c/2-b*.07}" y="${L}" width="${b*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${c} ${m}" width="${c}" height="${m}" aria-hidden="true">${T}${v}</svg>`}var ch={"safari-ios":n=>{let i=n.shell==="home"?20:n.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})},uh=({d:n,now:i,cutout:c},m)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${m}px"><span class="dt-sb-l">${mt.signal}${mt.wifi}</span><b>${Ka(i)}</b><span class="dt-sb-r">${mt.battery}</span></div>`;let g=c??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${m}px"><span class="dt-island" style="left:${g.x}px;top:${g.y}px;width:${g.width}px;height:${g.height}px"></span><b class="dt-sb-time" style="top:${g.y}px;height:${g.height}px">${Ka(i)}</b><span class="dt-sb-icons" style="top:${g.y}px;height:${g.height}px">${mt.signal}${mt.wifi}${mt.battery}</span></div>`},ph=({d:n,host:i,min:c},m)=>{let g=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return c?`<div class="dt-ios-bar is-min" style="height:${m}px"><span class="dt-ios-mini">${f(i)}</span>${g}</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" aria-label="Back" title="Back">${mt.back}</button><span class="dt-glass dt-ios-url"><span>${f(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${mt.reload}</button></span><span class="dt-glass dt-glass--round">${mt.dots}</span></div>${g}</div>`},mh=({now:n,min:i},c)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${qr(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${mt.wifi}${mt.signal}${mt.battery}</span></div>`+(i?"":`<div class="dt-and-bar"><span class="dt-and-url">${mt.tune}<span>${f(c)}</span></span><span class="dt-and-tabs">1</span>${mt.dotsV}</div>`),hh=()=>`<div class="dt-and-nav">${mt.recent}${mt.home}${mt.navBack}</div>`,gh=({now:n,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Ka(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${mt.wifi}${mt.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${mt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${mt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${mt.fwd}</button></span><span class="dt-ipad-url">${mt.lock}<span>${f(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${mt.reload}</button></span><span class="dt-bar-group">${mt.share}${mt.plus}${mt.tabs}</span></div>`,fh=({now:n,host:i},c)=>'<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>'+(c?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${mt.wifi}${mt.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})}&nbsp; ${Ka(n)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${mt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${mt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${mt.fwd}</button></span><span class="dt-mac-url">${mt.lock}<span>${f(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${mt.reload}</button></span><span class="dt-bar-group">${mt.share}${mt.plus}${mt.tabs}</span></div>`,bh=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,yh=({host:n,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${f(i||n)}</span>${mt.close}</span><span class="dt-win-new">${mt.plus}</span><span class="dt-win-ctrl">${mt.winMin}${mt.winMax}${mt.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${mt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${mt.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${mt.reload}</button></span><span class="dt-win-url">${mt.tune}<span>${f(n)}</span>${mt.star}</span><span class="dt-bar-group">${mt.user}${mt.dotsV}</span></div>`,vh=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,c)=>`<i style="--hue:${200+c*30}"></i>`).join("")}</span><span class="dt-win-tray">${mt.chevUp}${mt.wifi}${mt.volume}${mt.battery}<span class="dt-win-clock">${qr(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function mu(n,i){let c=lh[n.shell](n),m=n.w+2*c.side,g=n.h+c.top+c.bottom,b=m+(c.extraW??0),L=g+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?c.extraH??0:0),A=(b-m)/2+c.side,v=ch[n.browser](n),T=i.min?v.topMin??v.top:v.top,M=i.min?v.bottomMin??v.bottom:v.bottom,z={...i,d:n},at="",X="";switch(n.browser){case"safari-ios":at=uh(z,T),X=ph(z,M);break;case"chrome-android":at=mh(z,i.host),X=hh();break;case"safari-ipad":at=gh(z),X='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":at=fh(z,n.shell==="macbook"),X=bh();break;case"chrome-windows":at=yh(z),X=vh(z);break}return{footprint:{w:b,h:L},screen:{x:A,y:c.top,w:n.w,h:n.h,r:c.r,rb:c.rb??c.r},topH:T,bottomH:M,shell:dh(n,c,b,L,A),top:at,bottom:X,canMinimize:v.topMin!==void 0&&(v.topMin!==v.top||v.bottomMin!==v.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var xs=null;function qo(n){if(xs??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!xs||!n)return[0,0,0,0];xs.clearRect(0,0,1,1),xs.fillStyle="rgba(0, 0, 0, 0)",xs.fillStyle=n,xs.fillRect(0,0,1,1);let[i,c,m,g]=xs.getImageData(0,0,1,1).data;return[i,c,m,g/255]}var Oo=([n,i,c])=>`rgb(${n}, ${i}, ${c})`;function hu(n){let i=n.defaultView,c=X=>!X||qo(X)[3]===0,m=[n.body,n.documentElement].map(X=>X&&i.getComputedStyle(X).backgroundColor).find(X=>X&&!c(X)),[g,b,L,A]=m?qo(m):[255,255,255,1],v=[g,b,L].map(X=>Math.round(X*A+255*(1-A))),T=X=>{let[Q,I,Tt,_t]=qo(X);if(_t>=.75)return Oo([Q,I,Tt]);let At=(it,ft)=>Math.round(it*_t+ft*(1-_t));return Oo([At(Q,v[0]),At(I,v[1]),At(Tt,v[2])])},M=X=>{let Q=n.elementFromPoint(i.innerWidth/2,X);for(;Q&&Q!==n.documentElement;Q=Q.parentElement){let I=i.getComputedStyle(Q);if(I.position!=="fixed"&&I.position!=="sticky")continue;let Tt=Q.getBoundingClientRect().width>=i.innerWidth*.9,_t=I.backdropFilter&&I.backdropFilter!=="none";return Tt&&!_t&&!c(I.backgroundColor)?T(I.backgroundColor):null}return null},z=n.querySelector('meta[name="theme-color"]')?.content||"",at=z&&!c(z)?Oo(qo(z)):"";return{top:M(4)??Oo(v),bottom:M(i.innerHeight-4)??Oo(v),theme:at}}function Dr(n){let[i,c,m]=qo(n).map(g=>g/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4);return .2126*i+.7152*c+.0722*m>.4?"#000":"#fff"}function gu(n){let{cfg:i,inFrame:c,persist:m,frame:g,frameEl:b,devicesMenu:L,bpBtns:A,notesOverlay:v,WIDE:T,bpOf:M,currentBp:z,deviceById:at,notesOn:X,filter:Q,filterTo:I,dropFrameDrafts:Tt,putAway:_t,tellFrame:At,syncBpButtons:it,render:ft,reread:Dt}=n,Ft=i.breakpoints,Lt=document.querySelector(".dt-device"),ne=document.querySelector(".dt-shell"),ue=document.querySelector('.dt-chrome[data-at="top"]'),pe=document.querySelector('.dt-chrome[data-at="bottom"]'),me=document.querySelector(".dt-ruler"),fn=[...document.querySelectorAll(".dt-frame-handle")],zt=document.querySelector(".dt-frame-size"),Fe=document.querySelector(".dt-frame-rotate"),fe=document.querySelector(".dt-frame-bars"),C="overlay",yt="",Rt="dt-w",Wt="dt-canvas",x="dt-device",E=ct.getItem(Wt)==="1",N=ct.getItem(x)||"";N&&!at(N)&&(N="",ct.setItem(x,""));let S=Number(ct.getItem(Rt))||0,nt="dt-emu",G=(()=>{try{return JSON.parse(ct.getItem(nt)||"null")}catch{return null}})(),vt=()=>G?No.find(P=>P.id===G.id)??null:null,be=()=>{let P=vt();return P?G.turned?{w:P.h,h:P.w}:{w:P.w,h:P.h}:null},Vt=ct.getItem("dt-bars-min")==="1",Ht=P=>{G=P,m(nt,P?JSON.stringify(P):"")},k=P=>{zt.textContent=P,g.style.setProperty("--dt-badge-w",`${zt.offsetWidth}px`)},w=P=>{if(!P){me.innerHTML="";return}let F="";for(let U=0;U<=P;U+=50)F+=`<span class="dt-tick${U%200===0?" is-major":""}" style="left:${U}px"></span>`;for(let U of Ft)for(let Pt of[U.min,U.max])Pt>0&&Number.isFinite(Pt)&&Pt<=P&&(F+=`<span class="dt-edge" style="left:${Pt}px" title="${U.label} edge"></span>`);me.innerHTML=F,me.style.width=`${P}px`},H=()=>{let P=parseFloat(Lt.style.width)||0,F=parseFloat(Lt.style.height)||0;if(!P||!F){Lt.style.transform="",delete Lt.dataset.scaled;return}let U=N||G?Math.min(1,(innerWidth-80)/P,(innerHeight-120)/F):Math.min(1,(innerWidth-80)/P);Lt.style.transform=U<1?`scale(${U})`:"",Lt.dataset.scaled=U<1?String(Math.round(U*100)):""},D=P=>No.find(F=>F.w===P.w&&F.h===P.h&&F.cutout?.shape==="pill")?.cutout,O=()=>{try{return b.contentDocument}catch{return null}},wt=()=>O()?.title.split("\u2014").pop()?.trim()||"",Et=()=>{let P=O(),F=N?at(N):null;if(!P?.body||!F)return;let U=hu(P),Pt=F.browser==="chrome-android"?U.theme||"rgb(255, 255, 255)":U.top,Ut=F.browser==="chrome-android"?"rgb(255, 255, 255)":U.bottom;Lt.style.setProperty("--dt-top",Pt),Lt.style.setProperty("--dt-top-ink",Dr(Pt)),Lt.style.setProperty("--dt-bottom",Ut),Lt.style.setProperty("--dt-bottom-ink",Dr(Ut));let xe=ue.querySelector(".dt-win-tab > span");xe&&(xe.textContent=wt()||location.host)},st=0;b.addEventListener("load",()=>{let P=O();if(!P)return;let F=window.__notemendHosted;if(F&&!b.contentWindow?.__notemendHosted&&!P.querySelector(`script[src^="${F.base}/bar.js"]`)){let U=P.createElement("script");U.src=`${F.base}/bar.js`,U.dataset.project=F.project,P.head.append(U)}Et(),b.contentWindow?.addEventListener("scroll",()=>{st||(st=requestAnimationFrame(()=>{st=0,Et()}))},{passive:!0})});for(let P of[ue,pe])P.addEventListener("click",F=>{let U=F.target.closest("[data-nav]")?.dataset.nav;if(U)try{let Pt=b.contentWindow?.navigation;if(!O()||!Pt)throw new Error("foreign");U==="back"?Pt.canGoBack&&Pt.back():U==="fwd"?Pt.canGoForward&&Pt.forward():Pt.reload()}catch{(U==="reload"||U==="back")&&(b.src=location.href)}});fe.addEventListener("click",()=>{Vt=!Vt,m("dt-bars-min",Vt?"1":"0"),ht()});let tt=[],lt=P=>{for(let F of tt)F.inert=!1;tt=P?[...document.body.children].filter(F=>F instanceof HTMLElement&&!F.inert&&!F.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let F of tt)F.inert=!0},ht=()=>{if(c)return;let P=N?at(N)??null:null;if(N&&!P&&(N="",ct.setItem(x,"")),!P&&!E){let F="";try{let U=b.getAttribute("src")?b.contentWindow?.location:null;U?.origin===location.origin&&(F=U.pathname+U.search+U.hash)}catch{}if(g.hidden=!0,lt(!1),b.removeAttribute("src"),Qt.toggle("dt-framing",!1),v.hidden=!X(),me.innerHTML="",it(),Fe.hidden=!0,fe.hidden=!0,I(null),yt="",Tt(),it(),He(),F&&F!==location.pathname+location.search+location.hash){location.assign(F);return}Dt();return}if(g.hidden=!1,lt(!0),Qt.toggle("dt-framing",!0),v.hidden=!0,b.src||(b.src=location.href),P){let F=mu(P,{host:location.host,title:wt(),now:new Date,min:Vt,cutout:D(P)}),{screen:U}=F;g.dataset.mode="device",Lt.dataset.shell=P.shell,Lt.dataset.browser=P.browser,Lt.style.width=`${F.footprint.w}px`,Lt.style.height=`${F.footprint.h}px`,Lt.style.setProperty("--dt-r",`${U.r}px`),Lt.style.setProperty("--dt-rb",`${U.rb}px`),ne.innerHTML=F.shell;let Pt=(rt,ve,os,as)=>{rt.innerHTML=as,rt.style.cssText=`left:${U.x}px;top:${ve}px;width:${U.w}px;height:${os}px`};Pt(ue,U.y,F.topH,F.top),Pt(pe,U.y+U.h-F.bottomH,F.bottomH,F.bottom);let Ut=U.h-F.topH-F.bottomH;b.style.position="absolute",b.style.left=`${U.x}px`,b.style.top=`${U.y+F.topH}px`,b.style.width=`${U.w}px`,b.style.height=`${Ut}px`,me.innerHTML="";let xe=Vt&&F.canMinimize;C=F.scrollbar,yt=`${P.label}${xe?" \xB7 bars folded":""}`,I(M(P.w)),At({notes:X(),scrollbar:C,device:yt}),fe.hidden=!F.canMinimize,fe.setAttribute("aria-pressed",String(xe)),k(`${P.label} ${P.w}\xD7${P.h} \xB7 page ${P.w}\xD7${Ut}${xe?" \xB7 bars folded":""} \xB7 ${Ft.find(rt=>rt.id===Q())?.label??""}`),Et()}else{let F=be();F||Ht(null);let U=F?.w||S||Ft.find(xe=>xe.id===z()).ideal;S=U,g.dataset.mode="canvas",delete Lt.dataset.shell,delete Lt.dataset.browser,ne.innerHTML=ue.innerHTML=pe.innerHTML="",ue.style.cssText=pe.style.cssText="",fe.hidden=!0,C="overlay",Lt.style.width=`${U}px`,Lt.style.height=`${F?.h??innerHeight-84}px`,b.style.position="",b.style.left=b.style.top="",b.style.width="100%",b.style.height="100%",w(U),At({notes:X()});let Pt=Ft.find(xe=>xe.id===M(U)),Ut=vt();yt=Ut?`${Ut.label}${G?.turned?" \xB7 landscape":""}`:"",At({scrollbar:C,device:yt}),k(Ut&&F?`${Ut.label} \xB7 ${F.w}\xD7${F.h} \xB7 ${Pt.label}`:`${U}px \xB7 ${Pt.label}`),I(M(U))}Fe.hidden=!(vt()?.rotates&&!P),He(),H(),it(),Dt()},Ct=P=>{let F=Ft.find(U=>U.id===P);N="",ct.setItem(x,""),Ht(null),E=z()!==P,S=E?F.ideal:0,I(E?P:null),ct.setItem(Wt,E?"1":"0"),ct.setItem(Rt,String(S)),_t(),ht()};for(let P of A)P.addEventListener("click",()=>Ct(P.dataset.bp));for(let P of document.querySelectorAll("[data-device]"))P.addEventListener("click",()=>{N=P.dataset.device===N?"":P.dataset.device,ct.setItem(x,N),L.open=!1,ht()});for(let P of document.querySelectorAll("[data-emu]"))P.addEventListener("click",()=>{let F=G?.id===P.dataset.emu&&!N;N="",ct.setItem(x,""),Ht(F?null:{id:P.dataset.emu,turned:!1}),E=!F,S=0,ct.setItem(Wt,E?"1":"0"),I(null),_t(),L.open=!1,ht()});Fe.addEventListener("click",()=>{G&&(Ht({...G,turned:!G.turned}),_t(),ht())});let $e=[...L.querySelectorAll("[data-tab]")],je=[...L.querySelectorAll("[data-panel]")],ke=P=>{for(let F of $e)F.setAttribute("aria-selected",String(F.dataset.tab===P));for(let F of je)F.hidden=F.dataset.panel!==P;m("dt-devices-tab",P)};for(let P of $e)P.addEventListener("click",()=>ke(P.dataset.tab));ke(ct.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let Gt=L.querySelector(".dt-emu-search");Gt.addEventListener("input",()=>{let P=Gt.value.trim().toLowerCase(),F=null,U=!1,Pt=()=>{F&&(F.hidden=!U)};for(let Ut of Gt.parentElement.children){if(Ut.classList.contains("dt-devices-group")){Pt(),F=Ut,U=!1;continue}Ut.dataset.emu&&(Ut.hidden=!!P&&!Ut.textContent.toLowerCase().includes(P),U||=!Ut.hidden)}Pt()});let he=L.querySelector(".dt-devices-name");function He(){for(let F of L.querySelectorAll("[data-device]"))F.setAttribute("aria-pressed",String(F.dataset.device===N));let P=!N&&!g.hidden?G?.id:void 0;for(let F of L.querySelectorAll("[data-emu]"))F.setAttribute("aria-pressed",String(F.dataset.emu===P));he.textContent=N&&at(N)?.label||P&&vt()?.label||"Device"}let ye=P=>Ft.find(F=>F.id===P),_e=P=>{let F=ye(Q()??z());return Math.max(F.min||320,Math.min(Number.isFinite(F.max)?F.max:2560,Math.round(P)))};for(let P of fn){let F=P.dataset.edge==="l"?-1:1;P.addEventListener("pointerdown",U=>{if(N)return;U.preventDefault(),G&&(Ht(null),ht()),P.setPointerCapture(U.pointerId);let Pt=U.clientX,Ut=S,xe=Number(Lt.dataset.scaled||100)/100;g.dataset.dragging="1";let rt=os=>{S=_e(Ut+F*(os.clientX-Pt)*2/xe),Lt.style.width=`${S}px`,w(S),k(`${S}px \xB7 ${ye(M(S)).label}`),H()},ve=()=>{P.removeEventListener("pointermove",rt),P.removeEventListener("pointerup",ve),P.removeEventListener("pointercancel",ve),delete g.dataset.dragging,ct.setItem(Rt,String(S)),ht()};P.addEventListener("pointermove",rt),P.addEventListener("pointerup",ve),P.addEventListener("pointercancel",ve)}),P.addEventListener("dblclick",()=>{if(N)return;Ht(null);let U=ye(Q()??z()),Pt=[U.min||320,Number.isFinite(U.max)?U.max:U.ideal];S=Math.abs(S-Pt[0])<Math.abs(S-Pt[1])?Pt[0]:Pt[1],ct.setItem(Rt,String(S)),ht()})}let Ms=z(),qn=()=>{let P=Ft.find(F=>F.id===T);return E&&!N&&!G&&S===P.ideal&&innerWidth>=P.min};return addEventListener("resize",()=>{if(qn()){Ct(T);return}it(),z()!==Ms&&(Ms=z(),ft()),g.hidden||(!N&&!G&&(Lt.style.height=`${innerHeight-84}px`),H())}),{apply:ht,pickBp:Ct,look:()=>({scrollbar:C,device:yt}),restore:()=>{qn()?Ct(T):E||N?ht():He()}}}var fu='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="5" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.2" fill="currentColor" stroke="none"/></svg>',bu='<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>',wh='<svg viewBox="0 0 20 20" width="10" height="10" aria-hidden="true"><rect x="3" y="3" width="14" height="14" rx="3"/><path d="M10 3v14"/></svg>',$h='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function yu(n){let{bp:i,notes:c,breakpoints:m,bandOfNote:g,showResolved:b,showArchived:L,drafts:A,find:v}=n,T=c.filter(C=>g(C)===i),M=C=>[C.text,C.note,C.byName,...(C.replies??[]).filter(yt=>!yt.deleted).map(yt=>yt.text)].join(" ").toLowerCase(),z=C=>v.view==="me"?n.forMe(C):v.view==="agent"?n.forAgent(C):!0,at=C=>Date.parse(C.updatedAt||C.createdAt||"")||0,X=C=>Date.parse(C.createdAt||"")||0,Q=T.filter(C=>z(C)&&(!v.q||M(C).includes(v.q.trim().toLowerCase()))).sort((C,yt)=>v.sort==="old"?X(C)-X(yt):v.sort==="new"?X(yt)-X(C):(v.sort==="unread"?Number(n.unread(yt))-Number(n.unread(C)):0)||at(yt)-at(C)),I={open:[],claude:[],done:[],archived:[]};for(let C of Q)I[Bt(C)==="done"&&n.archived(C)?"archived":Bt(C)].push(C);let Tt=C=>{let yt=Bt(C),Rt=n.orphan(C),Wt=n.unread(C),x=n.picking&&n.pickable(C),E=!!x&&n.picking.has(C.id),N=n.mirror(C),S=Qn(C.updatedAt||C.createdAt),nt=N?`<i class="dt-hist-mirror"${N==="there"?` data-tip="In Team too \xB7 ${f(S)}"`:' data-tip="A client\u2019s thread, mirrored into Team"'}>${wh}Mirrored</i>`:"";return`<div class="dt-hist-row is-${yt}${yt==="done"?n.archived(C)?" is-archived":" is-resolved":""}${Rt?" is-orphan":""}${Wt?" is-unread":""}${n.menuFor===C.id?" is-menu":""}${E?" is-picked":""}${n.picking&&!x?` is-unpickable${N?" is-dim":""}`:""}">
212
- <button class="dt-hist-go" data-go="${C.id}" data-tip="${f(C.text.slice(0,80))}"${x?` role="checkbox" aria-checked="${E}"`:""}>
213
- ${x?`<span class="dt-hist-pick" aria-hidden="true"><i class="dt-hist-box">${E?Me:""}</i></span>`:n.marker(C)}
211
+ `)}var Ye=(n,i)=>{let c=i<=0?"":i>=1?"6,0.5 11.5,6 6,11.5 0.5,6":["6,6","6,0.5",...["11.5,6","6,11.5","0.5,6"].slice(0,Math.round(i*4))].join(" ");return`<svg class="dt-stage-icon" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${c?`<polygon points="${c}" fill="${n}"/>`:""}<rect x="1.75" y="1.75" width="8.5" height="8.5" rx="1.5" fill="none" stroke="${n}" stroke-width="1.5" transform="rotate(45 6 6)"/></svg>`};var Xc=[{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"/>'}],Jc=(n,i=14)=>`<svg viewBox="0 0 24 24" width="${i}" height="${i}" fill="none" stroke="${n.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n.icon}</svg>`,Ks=n=>Xc.find(i=>i.id===n)||Xc[0];var Ct=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",Zc={open:"Open",done:"Resolved",claude:"To check"};var Zt={ready:Promise.resolve(),toggle:(n,i)=>{Zt.ready.then(()=>document.documentElement.classList.toggle(n,i))},set:(n,i)=>{Zt.ready.then(()=>document.documentElement.style.setProperty(n,i))}};var ah=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Qc=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(ah,"$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 $s=[],Ir=n=>{if(n instanceof Error)return`${n.name}: ${n.message}`;if(typeof n=="string")return n;try{return JSON.stringify(n)??String(n)}catch{return String(n)}},ih=/ResizeObserver loop/,ws=(n,i)=>{if(ih.test(i))return;let c=Jt(Qc(i.replace(/\s+/g," ").trim()),500),h=$s.findIndex(g=>g.kind===n&&g.text.replace(/ ×\d+$/,"")===c);if(h>=0){let[g]=$s.splice(h,1),y=Number(/ ×(\d+)$/.exec(g.text)?.[1]??1)+1;$s.push({at:new Date().toISOString(),kind:n,text:`${c} \xD7${y}`});return}$s.push({at:new Date().toISOString(),kind:n,text:c}),$s.length>50&&$s.shift()},tu=!1;function eu(n){if(tu||typeof window>"u")return;tu=!0;let i=console.error;console.error=(...g)=>{ws("console",g.map(Ir).join(" ")),i.apply(console,g)},addEventListener("error",g=>{if(g instanceof ErrorEvent)return ws("error",`${g.message}${g.filename?` (${g.filename}:${g.lineno})`:""}`);let y=g.target,S=y?.src||y?.href;S&&!n(S)&&ws("network",`${y.tagName?.toLowerCase()} ${S} did not load`)},!0),addEventListener("unhandledrejection",g=>ws("rejection",Ir(g.reason)));let c=window.fetch;window.fetch=async(g,y)=>{let S=typeof g=="string"?g:g instanceof URL?g.href:g.url,C=(y?.method||(g instanceof Request?g.method:"GET")).toUpperCase();try{let w=await c.call(window,g,y);return w.status>=400&&!n(S)&&ws("network",`${C} ${S} \u2192 ${w.status}`),w}catch(w){throw!n(S)&&w?.name!=="AbortError"&&ws("network",`${C} ${S} \u2192 no answer (${Ir(w)})`),w}};let h=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(g,y,...S){return this._nm=`${g.toUpperCase()} ${String(y)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(y))||ws("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),h.call(this,g,y,...S)}}var nu=(n=Date.now())=>$s.filter(i=>n-Date.parse(i.at)<10*6e4).slice(-20);function su(n){let i=E=>{let x=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,H=E/x;return Math.round(H*10)%10===0?String(Math.round(H)):H.toFixed(1)},c=(E,x,H,q,D,ut="p")=>{if(H<=0||q<=0)return"";let Et=D!==""?`<span class="dt-pad-chip dt-pad-chip--${ut}" style="left:${E+H/2}px;top:${x+q/2}px">${D}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${ut}" style="left:${E}px;top:${x}px;width:${H}px;height:${q}px"></span>${Et}`},h=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],g="button, a, input, select, textarea, label, [role='button']",y=E=>{let x=E;for(let H=0;x&&H<6;H++,x=x.parentElement){if(x.matches(g))return x;let q=getComputedStyle(x);if(h.some(D=>parseFloat(q[D])>=2))return x}return E},S=(E,x)=>{let H=parseFloat(x.columnGap)||0,q=parseFloat(x.rowGap)||0;if(!(x.display.includes("flex")||x.display.includes("grid"))||!H&&!q)return"";let D=[...E.children].map(st=>st.getBoundingClientRect()).filter(st=>st.width||st.height),ut="",Et=(st,et)=>i(Math.abs(st-et)<=1?et:st);for(let st=1;st<D.length;st++){let et=D[st-1],rt=D[st];if(H&&rt.left>=et.right-1){let gt=Math.max(et.top,rt.top);ut+=c(et.right,gt,rt.left-et.right,Math.min(et.bottom,rt.bottom)-gt,Et(rt.left-et.right,H),"g")}else if(q&&rt.top>=et.bottom-1){let gt=Math.min(et.left,rt.left);ut+=c(gt,et.bottom,Math.max(et.right,rt.right)-gt,rt.top-et.bottom,Et(rt.top-et.bottom,q),"g")}}return ut},C=E=>`<span class="dt-pad-outline" style="left:${E.left}px;top:${E.top}px;width:${E.width}px;height:${E.height}px"></span>`,w=(E,x,H="")=>`<span class="dt-pad-tag" style="left:${x.left}px;top:${Math.max(2,x.top-22)}px">${E.tagName.toLowerCase()+(E.classList[0]?"."+E.classList[0]:"")}${H}</span>`,A=E=>{let x=E.getBoundingClientRect(),H=getComputedStyle(E),q=parseFloat(H.paddingTop),D=parseFloat(H.paddingRight),ut=parseFloat(H.paddingBottom),Et=parseFloat(H.paddingLeft),st=C(x);st+=c(x.left,x.top,x.width,q,q>=2?i(q):""),st+=c(x.left,x.bottom-ut,x.width,ut,ut>=2?i(ut):""),st+=c(x.left,x.top+q,Et,x.height-q-ut,Et>=2?i(Et):""),st+=c(x.right-D,x.top+q,D,x.height-q-ut,D>=2?i(D):"");let et=parseFloat(H.marginTop),rt=parseFloat(H.marginRight),gt=parseFloat(H.marginBottom),At=parseFloat(H.marginLeft);st+=c(x.left,x.top-et,x.width,et,et>=2?i(et):"","m"),st+=c(x.left,x.bottom,x.width,gt,gt>=2?i(gt):"","m"),st+=c(x.left-At,x.top,At,x.height,At>=2?i(At):"","m"),st+=c(x.right,x.top,rt,x.height,rt>=2?i(rt):"","m"),st+=S(E,H);let $e=parseFloat(H.columnGap)||0,je=parseFloat(H.rowGap)||0,ke=(H.display.includes("flex")||H.display.includes("grid"))&&($e||je)?` \xB7 gap ${i($e)}${je&&je!==$e?"/"+i(je):""}`:"",Vt="",he=E.parentElement;if(E.matches(g)&&he){let be=getComputedStyle(he);st+=S(he,be);let _e=parseFloat(be.columnGap)||parseFloat(be.rowGap)||0;Vt=` \xB7 ${i(x.width)}\xD7${i(x.height)}${_e&&(be.display.includes("flex")||be.display.includes("grid"))?` \xB7 gap ${i(_e)} in its row`:""}`}let He=Vt?"":` \xB7 ${Math.round(parseFloat(i(x.width)))} \xD7 ${Math.round(parseFloat(i(x.height)))}`;n.innerHTML=st+w(E,x,He+ke+Vt)},k=E=>{let x=E.getBoundingClientRect();n.innerHTML=C(x).replace("dt-pad-outline","dt-pad-outline dt-size-line")+`<span class="dt-pad-chip dt-size-chip" style="left:${x.left+x.width/2}px;top:${x.bottom+6}px">${Math.round(parseFloat(i(x.width)))} \xD7 ${Math.round(parseFloat(i(x.height)))}</span>`},z=E=>{let x=(E.match(/[\d.]+/g)||[]).map(Number);if(x.length<3)return E;let H="#"+x.slice(0,3).map(q=>Math.round(q).toString(16).padStart(2,"0")).join("");return x[3]!==void 0&&x[3]<1?`${H} \xB7 ${Math.round(x[3]*100)}%`:H},dt=null,J=()=>{if(dt)return dt;let E=getComputedStyle(document.documentElement),x=document.createElement("span");x.style.display="none",document.body.append(x);let H=[];for(let q of Array.from(E)){if(!q.startsWith("--"))continue;let D=E.getPropertyValue(q).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(D))continue;x.style.color="rgb(1, 2, 3)",x.style.color=D;let ut=getComputedStyle(x).color;ut&&ut!=="rgb(1, 2, 3)"&&H.push([ut,q])}return x.remove(),H.sort((q,D)=>q[1].length-D[1].length),dt=H,H},tt=E=>J().find(([x])=>x===E)?.[1]??"",F=null,xt=()=>{if(F)return F;let E=[],x=H=>{for(let q of Array.from(H))q instanceof CSSStyleRule?q.style.cssText.includes("var(--")&&E.push({sel:q.selectorText,style:q.style}):q instanceof CSSMediaRule?matchMedia(q.conditionText).matches&&x(q.cssRules):"cssRules"in q&&x(q.cssRules)};for(let H of Array.from(document.styleSheets))try{x(H.cssRules)}catch{}return F=E},Wt={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(E=>[`border-${E}-color`,[`border-${E}-color`,"border-color",`border-${E}`,"border"]]))},St=(E,x)=>{let H=Wt[x]??[x],q=x==="color";for(let D=E;D;D=q?D.parentElement:null){let ut=et=>H.map(rt=>/var\(\s*(--[\w-]+)/.exec(et.getPropertyValue(rt))?.[1]).find(Boolean),Et=D instanceof HTMLElement?ut(D.style):void 0;if(Et)return Et;let st="";for(let et of xt()){let rt=!1;try{rt=D.matches(et.sel)}catch{}rt&&(st=ut(et.style)||st)}if(st)return st;if(q&&D.parentElement&&getComputedStyle(D).color!==getComputedStyle(D.parentElement).color)break}return""},at=(E,x,H)=>{let q=getComputedStyle(E).getPropertyValue(x).trim();if(!q)return z(H);let D=document.createElement("span");if(D.style.display="none",D.style.color=q,!D.style.color)return z(H);document.body.append(D);let ut=getComputedStyle(D).color;return D.remove(),z(ut)},vt=(E,x,H)=>{let q=St(E,x);if(q)return`<b class="dt-var">${q}</b> <em>${at(E,q,H)}</em>`;let D=tt(H);return D?`<span title="Same value as ${D}; not written with it">\u2248 ${D}</span> <em>${z(H)}</em>`:z(H)},It=E=>`<i class="dt-type-sw" style="background:${E}"></i>`,qt={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},Lt=E=>(E.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),pe=(E,x)=>E.slice(0,3).map((H,q)=>H*E[3]+x[q]*(1-E[3])).concat([1]),fe=E=>{let x=[];for(let H=E;H;H=H.parentElement){let q=getComputedStyle(H);if(q.backgroundImage!=="none")return null;let D=Lt(q.backgroundColor);if(D[3]>0&&(x.push(D),D[3]>=1))break}return x.reduceRight((H,q)=>pe(q,H),[255,255,255,1])},Qt=E=>{let[x,H,q]=E.slice(0,3).map(D=>(D/=255,D<=.03928?D/12.92:((D+.055)/1.055)**2.4));return .2126*x+.7152*H+.0722*q},me=(E,x,H)=>{let q=fe(E);if(!q)return["Contrast","<em>on an image</em>"];let D=pe(Lt(x.color),q),[ut,Et]=[Qt(D),Qt(q)].sort((gt,At)=>At-gt),st=(ut+.05)/(Et+.05),et=H>=24||H>=18.66&&Number(x.fontWeight)>=700,rt=st>=(et?4.5:7)?"AAA":st>=(et?3:4.5)?"AA":"fails AA";return["Contrast",`${st.toFixed(2)}:1 <em class="${rt==="fails AA"?"dt-type-bad":""}">${rt}${et?" \xB7 large":""}</em>`]},Ln=E=>{let x=E.getBoundingClientRect(),H=getComputedStyle(E),q=parseFloat(H.fontSize),D=H.lineHeight==="normal"?0:parseFloat(H.lineHeight),ut=parseFloat(H.letterSpacing)||0,Et=At=>`${(At*100).toFixed(1).replace(/\.0$/,"")}%`,st=[["Font",H.fontFamily.split(",")[0].replace(/["']/g,"")+(H.fontStyle!=="normal"?` ${H.fontStyle}`:"")],["Weight",`${qt[H.fontWeight]??""} <em>${H.fontWeight}</em>`],["Size",`${i(q)}px`],["Line",D?`${Et(D/q)} <em>${i(D)}px</em>`:"normal"],["Letter",ut?`${Et(ut/q)} <em>${ut.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",It(H.color)+vt(E,"color",H.color)],me(E,H,q)],rt=x.bottom+150<innerHeight?x.bottom+8:Math.max(8,x.top-158),gt=Math.min(Math.max(8,x.left),innerWidth-210);n.innerHTML=C(x)+w(E,x)+`<div class="dt-type-card" style="left:${gt}px;top:${rt}px">${st.map(([At,$e])=>`<span class="dt-type-row"><b>${At}</b><span>${$e}</span></span>`).join("")}</div>`},zt=E=>E.every(x=>x===E[0])?E[0]:E[1]===E[3]&&E[0]===E[2]?`${E[0]} ${E[1]}`:E.join(" "),Re=E=>/^rgba\(.*,\s*0\)$|^transparent$/.test(E),we=(E,x,H,q="")=>{let D=20+H.length*21,Et=x.bottom+D+12<innerHeight?x.bottom+8:Math.max(8,x.top-D-8),st=Math.min(Math.max(8,x.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${x.left}px;top:${x.top}px;width:${x.width}px;height:${x.height}px${q?`;border-radius:${q}`:""}"></span>`+w(E,x)+`<div class="dt-type-card dt-style-card" style="left:${st}px;top:${Et}px">${H.map(([et,rt])=>`<span class="dt-type-row"><b>${et}</b><span>${rt}</span></span>`).join("")}</div>`},N=E=>{let x=getComputedStyle(E),H=[];x.backgroundImage!=="none"&&H.push(["Fill",`<em>${/gradient/.test(x.backgroundImage)?"gradient":"image"}</em>`]),Re(x.backgroundColor)||H.push(["Fill",It(x.backgroundColor)+vt(E,"background-color",x.backgroundColor)]),E.textContent?.trim()&&H.push(["Text",It(x.color)+vt(E,"color",x.color)]),H.push(["Opacity",`${Math.round(Number(x.opacity)*100)}%`]),H.length||H.push(["Color","<em>no fill or text</em>"]),we(E,E.getBoundingClientRect(),H)},ft=E=>{let x=getComputedStyle(E),H=[],q=["top","right","bottom","left"],D=q.map(Et=>parseFloat(x.getPropertyValue(`border-${Et}-width`))||0);if(D.some(Et=>Et>0)){let Et=q.filter((et,rt)=>D[rt]>0);q.forEach((et,rt)=>H.push([et[0].toUpperCase()+et.slice(1),`${i(D[rt])} <em>${x.getPropertyValue(`border-${et}-style`)}</em>`]));let st=Et.map(et=>x.getPropertyValue(`border-${et}-color`));Et.forEach((et,rt)=>{rt&&st[rt]===st[0]||H.push([rt?`\u21B3 ${et}`:"Color",It(st[rt])+vt(E,`border-${et}-color`,st[rt])])})}else H.push(["Width","<em>none</em>"]);let ut=["top-left","top-right","bottom-right","bottom-left"].map(Et=>{let[st,et=st]=x.getPropertyValue(`border-${Et}-radius`).split(" "),rt=gt=>gt.endsWith("%")?gt:i(parseFloat(gt)||0);return st===et?rt(st):`${rt(st)}/${rt(et)}`});H.push(["Radius",zt(ut)]),we(E,E.getBoundingClientRect(),H,x.borderRadius)},Rt=(E,x)=>{let[H,q]=[Qt(E),Qt(x)].sort((D,ut)=>ut-D);return(H+.05)/(q+.05)},jt=E=>"#"+E.slice(0,3).map(x=>Math.round(x).toString(16).padStart(2,"0")).join(""),ne=(E,x,H)=>{let[q,D,ut]=E.map(ke=>ke/255),Et=Math.max(q,D,ut),st=Math.min(q,D,ut),et=(Et+st)/2,rt=Et-st,gt=rt?rt/(1-Math.abs(2*et-1)):0,At=rt?Et===q?((D-ut)/rt%6+6)%6:Et===D?(ut-q)/rt+2:(q-D)/rt+4:0,$e=ke=>{let Vt=(1-Math.abs(2*ke-1))*gt,he=Vt*(1-Math.abs(At%2-1)),He=ke-Vt/2,[be,_e,Ms]=At<1?[Vt,he,0]:At<2?[he,Vt,0]:At<3?[0,Vt,he]:At<4?[0,he,Vt]:At<5?[he,0,Vt]:[Vt,0,he];return[be,_e,Ms].map(qn=>Math.min(255,Math.max(0,Math.round((qn+He)*255)))).concat([1])},je=Qt(E)>=Qt(x);for(let ke of je?[1,-1]:[-1,1]){let Vt=ke>0?1:0;if(Rt($e(Vt),x)<H)continue;let he=et,He=Vt;for(let be=0;be<20;be++){let _e=(he+He)/2;Rt($e(_e),x)>=H?He=_e:he=_e}return $e(He)}return null},$={half:'<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><circle cx="6" cy="6" r="4.5" fill="none" stroke="currentColor" stroke-width="0.9"/><path d="M6 1.5a4.5 4.5 0 0 1 0 9z" fill="currentColor"/></svg>',x:'<svg class="dt-ct-no" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M3 3l5 5M8 3l-5 5" stroke="currentColor" stroke-width="1.1" stroke-linecap="round"/></svg>',ok:'<svg class="dt-ct-ok" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M2.2 5.8 4.4 8l4.4-5" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"/></svg>',copy:'<svg viewBox="0 0 11 11" width="11" height="11" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="0.9"><rect x="4" y="4" width="6" height="6" rx="1.2"/><path d="M7 2.5V2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h.5"/></svg>'},M=E=>`${E.toFixed(1).replace(/\.0$/,"")} : 1`,L="",V=null,U=!1,G=E=>{E!==V&&(V=E,U=!1),L="";let x=E.getBoundingClientRect(),H=(E instanceof HTMLInputElement||E instanceof HTMLTextAreaElement)&&!E.value&&!!E.placeholder,q=getComputedStyle(E,H?"::placeholder":null),D=parseFloat(q.fontSize),ut=D>=24||D>=18.66&&Number(q.fontWeight)>=700,Et=fe(E),st=gt=>`<i class="dt-type-sw" style="background:${gt}"></i>`,et;if(!E.textContent?.trim()&&!H&&!(E instanceof HTMLInputElement&&E.value))et='<p class="dt-ct-note">Point at some text.</p>';else if(!Et)et='<p class="dt-ct-note">It sits on an image or a gradient: there is no one colour behind it to measure.</p>';else{let gt=pe(Lt(q.color),Et),At=Rt(gt,Et),$e=ut?3:4.5,je=At>=7?["ok",$.ok+"AAA"]:At>=4.5?["ok",$.ok+"AA"]:At>=3?["warn","Large text only"]:["bad","Fails"],ke=`<div class="dt-ct-ratio"><b>${M(At)}</b><span class="dt-ct-chip dt-ct-chip--${je[0]}">${je[1]}</span></div>`;if(At>=7){et=ke,n.innerHTML=C(x)+w(E,x,H?" \xB7 placeholder":"")+_t(x,41,`<div class="dt-ct-card dt-ct-card--one">${et}</div>`);return}let Vt=(He,be)=>`<div class="dt-ct-check">${At>=be?$.ok:$.x}<span>${He}</span><em>${M(be).replace(".0","")}</em></div>`,he=At>=$e?null:ne(gt,Et,$e);he&&(L=jt(he)),et=`<div class="dt-ct-pair"><div><span>Text</span><b>${st(jt(gt))}${jt(gt)}</b></div><div><span>Background</span><b>${st(jt(Et))}${jt(Et)}</b></div></div>`+ke+Vt("Body text \xB7 AA",4.5)+Vt("Large text \xB7 AA",3)+Vt("Body text \xB7 AAA",7)+(L?U?`<div class="dt-ct-fix dt-ct-fix--done">${$.ok}<span>Copied ${L}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${st(L)}${L}</b>${$.copy}</div>`:"")}let rt=`<div class="dt-ct-card"><div class="dt-ct-head">${$.half}<span>Contrast</span></div>${et}</div>`;n.innerHTML=C(x)+w(E,x,H?" \xB7 placeholder":"")+_t(x,210,rt)},_t=(E,x,H)=>{let q=E.bottom+x+12<innerHeight?E.bottom+8:Math.max(8,E.top-x-8),D=Math.min(Math.max(8,E.left),innerWidth-260);return H.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${D}px;top:${q}px"`)};return{spacer:y,drawPads:A,drawSize:k,drawType:Ln,drawColor:N,drawBorder:ft,drawContrast:G,contrastFix:()=>L,markCopied:()=>{U=!0}}}var re=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),ou=(n,i,c=!1)=>{for(let h=i*4;;h*=4){let g=c?re(n.slice(0,h)).replace(/\s+/g," "):re(n.slice(0,h));if(g.length>=i||h>=n.length)return g}},Us=(n,i,c=!1)=>Jt(ou(n,i,c),i),au='[class^="dt-"],[class*=" dt-"],.devtools',In=n=>{let i=n;for(;i.parentElement&&i.parentElement!==document.body;)i=i.parentElement;return i.parentElement===document.body&&i.matches(au)},Ro=()=>{let n=null;return(i,c)=>(n||(n=new WeakMap,queueMicrotask(()=>{n=null})),n.has(i)||n.set(i,c()),n.get(i))},rh=()=>{let n=null;return(i,c)=>(n||(n=new Map,queueMicrotask(()=>{n=null})),n.has(i)||n.set(i,c()),n.get(i))};function iu(){let n=Ro(),i=($,M)=>{if(!$)return[];let L=M.toUpperCase(),V=n($,()=>new Map),U=V.get(L);return U||V.set(L,U=[...$.children].filter(G=>G.tagName.toUpperCase()===L&&!($===document.body&&G.matches(au)))),U},c=$=>{let M=[],L=$;for(;L&&L.tagName!=="HTML"&&M.length<8;){if(L.id){M.unshift("#"+CSS.escape(L.id));break}let V=L.parentElement,U=L.tagName.toLowerCase(),G=i(V,L.tagName),_t=V===document.body&&G.length>1?[...L.classList].find(se=>/^[\w-]+$/.test(se)&&G.filter(Dt=>Dt.classList.contains(se)).length===1):void 0;M.unshift(_t?`${U}.${_t}`:G.length>1?`${U}:nth-of-type(${G.indexOf(L)+1})`:U),L=V}return M.join(">")},h=$=>{let M=$.split(">"),L=null;for(let[V,U]of M.entries()){if(U.startsWith("#")){if(V)return null;L=document.querySelector(U);continue}let G=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec(U);if(!G)return document.querySelector($);if(!L){if(G[1]!=="body"||G[2]||G[3])return document.querySelector($);L=document.body;continue}let _t=i(L,G[1].toUpperCase());if(L=(G[2]?_t.find(se=>se.classList.contains(G[2])):_t[G[3]?Number(G[3])-1:0])??null,!L)return null}return L},g=$=>$.replace(/\s+/g," ").trim(),y=Ro(),S=($,M)=>{if(!M)return!0;let[L,V]=y($,()=>{let G=ou($.textContent||"",60);return[g(Jt(G,60)),g(G.slice(0,60))]}),U=g(M);return L===U||V===U},C=($,M)=>[$||"*",...(M||[]).map(L=>"."+CSS.escape(L))].join(""),w=rh(),A=$=>{let M=C($.tag,$.classes);return w(M,()=>{try{return[...document.querySelectorAll(M)].filter(L=>!In(L))}catch{return[]}})},k=$=>{for(let M of $.classes??[]){let L=A({tag:$.tag,classes:[M]});if(L.length)return L}return A({tag:$.tag}).slice(0,400)},z=80,dt=Ro(),J=$=>dt($,()=>tt($)),tt=$=>{let M=$.textContent||"",L=null;for(let V=$.parentElement,U=0;V&&V!==document.body&&U<4;V=V.parentElement,U++){let G=V.textContent||"";if(G===M)continue;let _t=Us(G,z,!0);if(_t&&(_t!==Us(M,z,!0)||(L??=re(M).replace(/\s+/g," "),re(G).replace(/\s+/g," ")!==L)))return _t}return""},F=$=>J($),xt=($,M,L=120)=>Jt(re($.getAttribute(M)),L)||void 0,Wt=Ro(),St=$=>Wt($,()=>at($)),at=$=>{for(let M=$.parentElement,L=0;M&&M!==document.body&&L<4;M=M.parentElement,L++){let V=M.querySelector("h1,h2,h3,h4,h5,h6,[role=heading]");if(V&&V!==$&&!$.contains(V))return Us(V.textContent||"",60,!0)||void 0}},vt=Ro(),It=$=>vt($,()=>qt($)),qt=$=>{let M=L=>L?Us(L.textContent||"",30,!0):"";return(M($.previousElementSibling)+"|"+M($.nextElementSibling)).replace(/^\|$/,"")||void 0},Lt=/^data-(testid|test-id|test|qa|cy|id|key|slug|name|item)$/,pe=$=>{let M=[...$.attributes].find(V=>Lt.test(V.name)&&V.value),L=($.getAttribute("src")||$.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)||void 0;return Object.fromEntries(Object.entries({id:$.id?Jt($.id,80):void 0,data:M?`${M.name}=${Jt(M.value,80)}`:void 0,aria:xt($,"aria-label"),alt:xt($,"alt"),title:xt($,"title"),src:L,href:xt($,"href"),head:St($),sib:It($)}).filter(([,V])=>V))},fe=($,M)=>!M||J($).startsWith(M),Qt=new WeakMap,me=$=>Qt.get($)??"found",Ln=$=>{let M=$.fp,L=null;try{L=h($.selector)}catch{}let V=A($),U=V.length?V:k($),G=new Set(U.slice(0,400));if(L&&!In(L)&&G.add(L),M.id){let E=document.getElementById(M.id);E&&G.add(E)}if(M.data){let[E,x]=M.data.split(/=(.*)/s);try{document.querySelectorAll(`[${E}="${CSS.escape(x)}"]`).forEach(H=>G.add(H))}catch{}}let _t=null,se=null,Dt=0;for(let E of G){if(In(E))continue;let x=M.id&&E.id===M.id||M.data&&E.getAttribute(M.data.split("=")[0])===M.data.split(/=(.*)/s)[1]?35:0,H=re($.label)&&S(E,$.label)||M.aria&&xt(E,"aria-label")===M.aria||M.alt&&xt(E,"alt")===M.alt||M.title&&xt(E,"title")===M.title||M.href&&xt(E,"href")===M.href||M.src&&(E.getAttribute("src")||E.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)===M.src?25:0,q=M.head&&St(E)===M.head||M.sib&&It(E)===M.sib||$.ctx&&J(E).startsWith($.ctx)?15:0,D=x+H+q,ut=D+(E===L?40:0)+($.nth!=null&&U[$.nth]===E?5:0);D||(ut=Math.min(ut,39)),H&&(Dt++,se={el:E,score:ut}),(!_t||ut>_t.score)&&(_t={el:E,score:ut})}return se&&Dt===1&&se.score<40&&(!_t||_t.score<40)?{el:se.el,score:40}:_t},zt=$=>{let M=Re($),L=null;if(M){try{L=h($.selector)}catch{}return Qt.set($,M===L?"found":"moved"),M}let V=$.fp?Ln($):null;return V&&V.score>=40?(Qt.set($,V.score>=70?"moved":"probably"),V.el):(Qt.set($,"gone"),null)},Re=$=>{let M=null;try{M=h($.selector)}catch{M=null}if(M&&In(M)&&(M=null),M&&S(M,$.label)&&fe(M,$.ctx))return M;let L=A($),V=L.length?L:k($),U=re($.label)?V.filter(Dt=>S(Dt,$.label)):[],G=($.ctx?U.find(Dt=>fe(Dt,$.ctx)):U.length===1?U[0]:void 0)??($.ctx&&!re($.label)?L.find(Dt=>fe(Dt,$.ctx)):void 0);if(G)return G;if($.ctx&&U.length===1&&g(re($.label)).length>=20)return U[0];let _t=Dt=>Dt.split(">").slice(0,2).join(">"),se=Dt=>!$.ctx&&_t(c(Dt))===_t($.selector);return re($.label)?M&&!$.ctx&&S(M,$.label)?M:U.length===1&&se(U[0])?U[0]:null:M||($.nth!=null?L[$.nth]??null:null)},we=$=>{let M=null;for(let L=$,V=$.parentElement;V&&V!==document.body&&getComputedStyle(L).position!=="fixed";L=V,V=V.parentElement){let U=getComputedStyle(V);if(U.overflowX==="visible"&&U.overflowY==="visible")continue;let G=V.getBoundingClientRect();M=M?{l:Math.max(M.l,G.left),t:Math.max(M.t,G.top),r:Math.min(M.r,G.right),b:Math.min(M.b,G.bottom)}:{l:G.left,t:G.top,r:G.right,b:G.bottom}}return M},N=$=>{let M=$.getBoundingClientRect();return(M.width>0||M.height>0)&&(!$.checkVisibility||$.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},ft=$=>({...$,x:Math.min(Math.max($.x,3),document.documentElement.clientWidth-30),y:$.y>=0&&$.y<19?19:$.y}),Rt=($,M)=>{let L=M;for(let V=M.parentElement;V&&V!==document.body;V=V.parentElement){if(!N(V)){L=V;continue}let U=M.getBoundingClientRect();if(U.width||U.height)return ft({x:U.left+U.width*$.rx,y:U.top+U.height*$.ry,el:M,hidden:V,shut:L});let G=V.getBoundingClientRect();return ft({x:G.left,y:G.top,el:M,hidden:V,shut:L})}return null},jt=$=>{let M=$.opener?Re($.opener):null;if(!M||!N(M))return null;let L=M.getBoundingClientRect();return ft({x:L.right-4,y:L.top+4,el:M,opener:M})};return{cssPath:c,poolOf:A,contextOf:F,resolveEl:zt,anchorOf:($,M=zt($))=>{if(!M)return jt($);if(!N(M))return jt($)??Rt($,M);let L=M.getBoundingClientRect(),V=L.left+L.width*$.rx,U=L.top+L.height*$.ry,G=we(M);return G?V<G.l||V>G.r||U<G.t||U>G.b?null:{x:V,y:U,el:M}:{x:V,y:U,el:M}},anchorState:me,fingerprintOf:pe}}var ru=(n,i)=>`<svg class="dt-bars" viewBox="0 0 18 11" width="18" height="11" aria-hidden="true">${[0,1,2,3].map(c=>`<rect x="${c*5}" y="${6-c*2}" width="3" height="${5+c*2}" rx="1" fill="${c<n?i:"#fff"}" stroke="none"${c<n?"":' opacity="0.12"'}/>`).join("")}</svg>`;function lu(n,i,c){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,C=>C.stopPropagation());let g=null,y=()=>{h.hidden=!0,g=null};for(let S of n)S.addEventListener("mousedown",C=>{let w=C.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select");if(!w){h.contains(C.target)||y();return}if(C.preventDefault(),g===w){y();return}g=w;let A=w.classList.contains("dt-more-select"),k=F=>A?F.dataset.on!=null:F.selected,z=w.dataset.search;h.innerHTML=(z?`<label class="dt-field-search"><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg><input type="search" placeholder="${i(z)}" aria-label="${i(z)}" spellcheck="false"></label>`:"")+[...w.options].map((F,xt)=>F.hidden?"":F.dataset.head!=null?`<p class="dt-field-head">${i(F.text)}${F.dataset.note?`<small>${i(F.dataset.note)}</small>`:""}</p>`:`${F.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${xt}" aria-selected="${k(F)}"${F.disabled?" disabled":""}${F.dataset.hint?` data-tip="${i(F.dataset.hint)}" data-hint="${i(F.dataset.hint.toLowerCase())}"`:""}${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>`:F.dataset.bare!=null?"":`<i style="background:${i(F.dataset.c||"#717171")}"></i>`}<span>${i(F.text)}</span>${F.dataset.note?`<small>${i(F.dataset.note)}</small>`:""}${k(F)?c:""}</button>${F.dataset.sepAfter!=null?"<hr>":""}`).join("")+(z?'<p class="dt-field-none" hidden></p>':""),h.classList.toggle("is-people",!!z);let dt=w.parentElement.getBoundingClientRect(),J=z?w.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;h.style.left=`${J?J.left+4:dt.left}px`,h.style.top=`${dt.bottom+4}px`,h.style.minWidth=`${J?J.width-8:Math.max(200,dt.width)}px`,h.style.width=J?`${J.width-8}px`:"",h.hidden=!1;for(let F of h.querySelectorAll("[data-hint]")){let xt=F.querySelector("span");xt.scrollWidth>xt.clientWidth&&(F.dataset.tip=`${xt.textContent} \xB7 ${F.dataset.tip}`)}let tt=h.getBoundingClientRect();(tt.bottom>innerHeight-8||z&&w.closest(".dt-note"))&&(h.style.top=`${Math.max(8,dt.top-4-tt.height)}px`),tt.right>innerWidth-8&&(h.style.left=`${Math.max(8,dt.right-tt.width)}px`),h.querySelector(".dt-field-search input")?.focus()});h.addEventListener("input",S=>{let C=S.target.value.trim().toLowerCase(),w=0;for(let k of h.querySelectorAll("[data-i]"))k.hidden=!!C&&!k.textContent.toLowerCase().includes(C)&&!k.dataset.hint?.includes(C),k.hidden||w++;for(let k of h.querySelectorAll("hr"))k.hidden=!!C;let A=h.querySelector(".dt-field-none");A&&(A.hidden=w>0,A.textContent=`No one matches \xAB${S.target.value.trim()}\xBB`)}),h.addEventListener("keydown",S=>{S.key!=="Enter"||!S.target.matches("input")||(S.preventDefault(),h.querySelector("[data-i]:not([hidden])")?.click())}),h.addEventListener("click",S=>{let C=S.target.closest("[data-i]");if(!C||!g)return;let w=g;y(),!(w.selectedIndex===Number(C.dataset.i)&&!w.classList.contains("dt-more-select"))&&(w.selectedIndex=Number(C.dataset.i),w.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",S=>{S.key==="Escape"&&!h.hidden&&(S.stopPropagation(),y())},!0),document.addEventListener("pointerdown",S=>{!h.hidden&&!h.contains(S.target)&&!S.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select")&&y()},!0),addEventListener("scroll",S=>{h.contains(S.target)||y()},!0)}var ns=()=>!matchMedia("(prefers-reduced-motion: reduce)").matches,On=n=>Promise.allSettled(n.getAnimations({subtree:!0}).filter(i=>i.effect?.getComputedTiming().iterations!==1/0).map(i=>i.finished)),Po=new WeakMap,ss=(n,i)=>{let c=Po.has(n);Po.set(n,i),!c&&(n.setAttribute("data-leaving",""),On(n).then(()=>{let h=Po.get(n);h&&(Po.delete(n),n.removeAttribute("data-leaving"),h())}))},Io=n=>{Po.delete(n),n.removeAttribute("data-leaving")},du=n=>{let i=n.cloneNode(!0);for(let c of["id","data-id","data-draft","data-parked"])i.removeAttribute(c);i.setAttribute("data-ghost",""),i.setAttribute("aria-hidden","true"),i.inert=!0,n.after(i),On(i).then(()=>i.remove())},Oo=(n,i)=>{n.removeAttribute("data-nudge"),n.offsetWidth,n.setAttribute("data-nudge",i),On(n).then(()=>{n.getAttribute("data-nudge")===i&&n.removeAttribute("data-nudge")})},cu=n=>{let i=getComputedStyle(document.documentElement).getPropertyValue(n).trim(),c=i.indexOf(" ");return{duration:parseFloat(i)*(/^[\d.]+s$/.test(i.slice(0,c))?1e3:1),easing:i.slice(c+1)}},Ga=(n,i,c=1/0)=>{let h=n.hidden?0:Math.min(n.offsetHeight,c),g=n.hidden?"0":getComputedStyle(n).opacity;n.getAnimations().forEach(w=>w.cancel()),n.hidden=!1;let y=i?Math.min(n.scrollHeight,c):0,S=()=>{n.hidden=!i};if(!ns()||h===y)return S();let C=n.animate([{height:`${h}px`,opacity:g,overflow:"hidden"},{height:`${y}px`,opacity:i?1:0,overflow:"hidden"}],{...cu(i?"--dt-smooth":"--dt-snappy"),fill:"forwards"});C.onfinish=()=>{S(),C.cancel()}},Or=(n,i,c,h,g)=>{if(n.getAnimations().forEach(S=>S.cancel()),!ns()||Math.abs(i-c)<1)return g();let y=n.animate([{height:`${i}px`,overflow:"hidden"},{height:`${c}px`,overflow:"hidden"}],{...cu(h?"--dt-smooth":"--dt-snappy"),fill:"forwards"});y.onfinish=()=>{g(),y.cancel()}};var lh=".devtools, [class^='dt-'], [class*=' dt-']",dh=300,uu=null,pu=n=>{uu=n};function mu(){let n=document.createElement("div");n.className="dt-tipbox",n.setAttribute("role","tooltip"),n.id="dt-tipbox",n.hidden=!0,document.body.append(n);let i=null,c,h=0,g=A=>{let k=A.getAttribute("title");k!==null&&(A.removeAttribute("title"),A.hasAttribute("data-tip")||A.setAttribute("data-tip",k),!A.hasAttribute("aria-label")&&!A.textContent?.trim()&&A.setAttribute("aria-label",k))},y=A=>{let k=A?.closest?.("[data-tip], [title]");return k&&k.closest(lh)&&!k.closest(".dt-tipbox")?k:null},S=A=>{let k=A.getAttribute("data-tip");if(!k||A.getAttribute("aria-expanded")==="true")return C();let z=uu?.(A);n.classList.toggle("is-peek",!!z),z?n.innerHTML=z:n.textContent=k,Io(n),n.hidden=!1,n.style.left="0px",n.style.top="0px";let dt=A.getBoundingClientRect(),J=n.getBoundingClientRect(),tt=6,F=8;if(z){let Wt=dt.right+8+J.width<=innerWidth-F;n.style.left=`${Wt?dt.right+8:Math.max(F,dt.left-8-J.width)}px`,n.style.top=`${Math.min(Math.max(F,dt.top-4),innerHeight-F-J.height)}px`,A.setAttribute("aria-describedby",n.id);return}let xt=dt.bottom+tt+J.height<=innerHeight-F;n.style.top=`${xt?dt.bottom+tt:Math.max(F,dt.top-tt-J.height)}px`,n.style.left=`${Math.min(Math.max(F,dt.left+dt.width/2-J.width/2),innerWidth-F-J.width)}px`,n.classList.toggle("is-mono",A.classList.contains("dt-note-el")),A.setAttribute("aria-describedby",n.id)},C=()=>{clearTimeout(c),i&&!n.hidden&&(h=performance.now()+400),i?.removeAttribute("aria-describedby"),i=null,n.hidden||ss(n,()=>{n.hidden=!0})},w=A=>{A!==i&&(C(),g(A),i=A,performance.now()<h?S(A):c=setTimeout(()=>i===A&&S(A),dh))};document.addEventListener("pointerover",A=>{let k=y(A.target);k?w(k):i&&!i.contains(A.target)&&C()},!0),document.addEventListener("pointerout",A=>{i&&!i.contains(A.relatedTarget)&&C()},!0),document.addEventListener("focusin",A=>{let k=A.target,z=y(k);z&&k.matches(":focus-visible")&&w(z)},!0),document.addEventListener("focusout",C,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",A=>{A.key==="Escape"&&C()},!0),addEventListener("scroll",C,!0),new MutationObserver(()=>{i&&(!i.isConnected||i.getAttribute("aria-expanded")==="true")&&C()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-expanded"]})}var ht={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>'},qr=(n,i)=>n.toLocaleTimeString("en-US",i),Ka=n=>qr(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),ch={island:n=>({side:12,top:12,bottom:12,r:n.w>=430?62:55,body:n.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:n=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((n.w+32)*.12),extraH:18}),laptop:n=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((n.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function uh(n,i,c,h,g){let y=n.w+2*i.side,S=n.h+i.top+i.bottom,C=(c-y)/2,w=`<rect class="dt-shell-screen" x="${g}" y="${i.top}" width="${n.w}" height="${n.h}" rx="${i.r}"/>`,A="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let k=(z,dt,J)=>`<rect class="dt-shell-btn" x="${z}" y="${dt}" width="4" height="${J}" rx="2"/>`;A+=n.shell==="punch"?k(C+y-1,150,70)+k(C+y-1,240,44):k(C-3,120,28)+k(C-3,170,56)+k(C-3,236,56)+k(C+y-1,190,90),A+=`<rect class="dt-shell-body" x="${C}" y="0" width="${y}" height="${S}" rx="${i.body}"/>`,A+=`<rect class="dt-shell-bezel" x="${C+3}" y="3" width="${y-6}" height="${S-6}" rx="${i.body-3}"/>`,n.shell==="home"&&(A+=`<rect class="dt-shell-slot" x="${c/2-26}" y="44" width="52" height="6" rx="3"/>`,A+=`<circle class="dt-shell-slot" cx="${c/2-48}" cy="47" r="5"/>`,A+=`<circle class="dt-shell-homebtn" cx="${c/2}" cy="${S-46}" r="28"/>`)}else if(n.shell==="tablet")A+=`<rect class="dt-shell-body dt-shell-body--light" x="${C}" y="0" width="${y}" height="${S}" rx="${i.body}"/>`,A+=`<rect class="dt-shell-bezel" x="${C+4}" y="4" width="${y-8}" height="${S-8}" rx="${i.body-4}"/>`;else if(n.shell==="monitor"){let k=Math.round(y*.1);A+=`<path class="dt-shell-stand" d="M${c/2-k/2} ${S-2}h${k}l${k*.2} 84h${-k*1.4}z"/>`,A+=`<rect class="dt-shell-stand" x="${c/2-y*.15}" y="${S+80}" width="${y*.3}" height="14" rx="7"/>`,A+=`<rect class="dt-shell-body" x="${C}" y="0" width="${y}" height="${S}" rx="${i.body}"/>`}else{let k=y+(i.extraW??0),z=(c-k)/2,dt=i.extraH??16;A+=`<path class="dt-shell-body" d="M${C} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${y-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${S}H${C}z"/>`,A+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${z} ${S}h${k}v${dt-8}a8 8 0 0 1-8 8H${z+8}a8 8 0 0 1-8-8z"/>`,A+=`<rect class="dt-shell-lip" x="${c/2-y*.07}" y="${S}" width="${y*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${c} ${h}" width="${c}" height="${h}" aria-hidden="true">${A}${w}</svg>`}var ph={"safari-ios":n=>{let i=n.shell==="home"?20:n.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})},mh=({d:n,now:i,cutout:c},h)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${h}px"><span class="dt-sb-l">${ht.signal}${ht.wifi}</span><b>${Ka(i)}</b><span class="dt-sb-r">${ht.battery}</span></div>`;let g=c??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${h}px"><span class="dt-island" style="left:${g.x}px;top:${g.y}px;width:${g.width}px;height:${g.height}px"></span><b class="dt-sb-time" style="top:${g.y}px;height:${g.height}px">${Ka(i)}</b><span class="dt-sb-icons" style="top:${g.y}px;height:${g.height}px">${ht.signal}${ht.wifi}${ht.battery}</span></div>`},hh=({d:n,host:i,min:c},h)=>{let g=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return c?`<div class="dt-ios-bar is-min" style="height:${h}px"><span class="dt-ios-mini">${f(i)}</span>${g}</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">${ht.back}</button><span class="dt-glass dt-ios-url"><span>${f(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-glass dt-glass--round">${ht.dots}</span></div>${g}</div>`},gh=({now:n,min:i},c)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${qr(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${ht.wifi}${ht.signal}${ht.battery}</span></div>`+(i?"":`<div class="dt-and-bar"><span class="dt-and-url">${ht.tune}<span>${f(c)}</span></span><span class="dt-and-tabs">1</span>${ht.dotsV}</div>`),fh=()=>`<div class="dt-and-nav">${ht.recent}${ht.home}${ht.navBack}</div>`,bh=({now:n,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Ka(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${ht.wifi}${ht.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${ht.sidebar}<button data-nav="back" aria-label="Back" title="Back">${ht.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ht.fwd}</button></span><span class="dt-ipad-url">${ht.lock}<span>${f(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-bar-group">${ht.share}${ht.plus}${ht.tabs}</span></div>`,yh=({now:n,host:i},c)=>'<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>'+(c?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${ht.wifi}${ht.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})}&nbsp; ${Ka(n)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${ht.sidebar}<button data-nav="back" aria-label="Back" title="Back">${ht.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ht.fwd}</button></span><span class="dt-mac-url">${ht.lock}<span>${f(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-bar-group">${ht.share}${ht.plus}${ht.tabs}</span></div>`,vh=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,wh=({host:n,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${f(i||n)}</span>${ht.close}</span><span class="dt-win-new">${ht.plus}</span><span class="dt-win-ctrl">${ht.winMin}${ht.winMax}${ht.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${ht.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ht.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-win-url">${ht.tune}<span>${f(n)}</span>${ht.star}</span><span class="dt-bar-group">${ht.user}${ht.dotsV}</span></div>`,$h=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,c)=>`<i style="--hue:${200+c*30}"></i>`).join("")}</span><span class="dt-win-tray">${ht.chevUp}${ht.wifi}${ht.volume}${ht.battery}<span class="dt-win-clock">${qr(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function hu(n,i){let c=ch[n.shell](n),h=n.w+2*c.side,g=n.h+c.top+c.bottom,y=h+(c.extraW??0),S=g+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?c.extraH??0:0),C=(y-h)/2+c.side,w=ph[n.browser](n),A=i.min?w.topMin??w.top:w.top,k=i.min?w.bottomMin??w.bottom:w.bottom,z={...i,d:n},dt="",J="";switch(n.browser){case"safari-ios":dt=mh(z,A),J=hh(z,k);break;case"chrome-android":dt=gh(z,i.host),J=fh();break;case"safari-ipad":dt=bh(z),J='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":dt=yh(z,n.shell==="macbook"),J=vh();break;case"chrome-windows":dt=wh(z),J=$h(z);break}return{footprint:{w:y,h:S},screen:{x:C,y:c.top,w:n.w,h:n.h,r:c.r,rb:c.rb??c.r},topH:A,bottomH:k,shell:uh(n,c,y,S,C),top:dt,bottom:J,canMinimize:w.topMin!==void 0&&(w.topMin!==w.top||w.bottomMin!==w.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var xs=null;function Do(n){if(xs??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!xs||!n)return[0,0,0,0];xs.clearRect(0,0,1,1),xs.fillStyle="rgba(0, 0, 0, 0)",xs.fillStyle=n,xs.fillRect(0,0,1,1);let[i,c,h,g]=xs.getImageData(0,0,1,1).data;return[i,c,h,g/255]}var qo=([n,i,c])=>`rgb(${n}, ${i}, ${c})`;function gu(n){let i=n.defaultView,c=J=>!J||Do(J)[3]===0,h=[n.body,n.documentElement].map(J=>J&&i.getComputedStyle(J).backgroundColor).find(J=>J&&!c(J)),[g,y,S,C]=h?Do(h):[255,255,255,1],w=[g,y,S].map(J=>Math.round(J*C+255*(1-C))),A=J=>{let[tt,F,xt,Wt]=Do(J);if(Wt>=.75)return qo([tt,F,xt]);let St=(at,vt)=>Math.round(at*Wt+vt*(1-Wt));return qo([St(tt,w[0]),St(F,w[1]),St(xt,w[2])])},k=J=>{let tt=n.elementFromPoint(i.innerWidth/2,J);for(;tt&&tt!==n.documentElement;tt=tt.parentElement){let F=i.getComputedStyle(tt);if(F.position!=="fixed"&&F.position!=="sticky")continue;let xt=tt.getBoundingClientRect().width>=i.innerWidth*.9,Wt=F.backdropFilter&&F.backdropFilter!=="none";return xt&&!Wt&&!c(F.backgroundColor)?A(F.backgroundColor):null}return null},z=n.querySelector('meta[name="theme-color"]')?.content||"",dt=z&&!c(z)?qo(Do(z)):"";return{top:k(4)??qo(w),bottom:k(i.innerHeight-4)??qo(w),theme:dt}}function Dr(n){let[i,c,h]=Do(n).map(g=>g/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4);return .2126*i+.7152*c+.0722*h>.4?"#000":"#fff"}function fu(n){let{cfg:i,inFrame:c,persist:h,frame:g,frameEl:y,devicesMenu:S,bpBtns:C,notesOverlay:w,WIDE:A,bpOf:k,currentBp:z,deviceById:dt,notesOn:J,filter:tt,filterTo:F,dropFrameDrafts:xt,putAway:Wt,tellFrame:St,syncBpButtons:at,render:vt,reread:It}=n,qt=i.breakpoints,Lt=document.querySelector(".dt-device"),pe=document.querySelector(".dt-shell"),fe=document.querySelector('.dt-chrome[data-at="top"]'),Qt=document.querySelector('.dt-chrome[data-at="bottom"]'),me=document.querySelector(".dt-ruler"),Ln=[...document.querySelectorAll(".dt-frame-handle")],zt=document.querySelector(".dt-frame-size"),Re=document.querySelector(".dt-frame-rotate"),we=document.querySelector(".dt-frame-bars"),N="overlay",ft="",Rt="dt-w",jt="dt-canvas",ne="dt-device",$=ct.getItem(jt)==="1",M=ct.getItem(ne)||"";M&&!dt(M)&&(M="",ct.setItem(ne,""));let L=Number(ct.getItem(Rt))||0,V="dt-emu",U=(()=>{try{return JSON.parse(ct.getItem(V)||"null")}catch{return null}})(),G=()=>U?No.find(R=>R.id===U.id)??null:null,_t=()=>{let R=G();return R?U.turned?{w:R.h,h:R.w}:{w:R.w,h:R.h}:null},se=ct.getItem("dt-bars-min")==="1",Dt=R=>{U=R,h(V,R?JSON.stringify(R):"")},E=R=>{zt.textContent=R,g.style.setProperty("--dt-badge-w",`${zt.offsetWidth}px`)},x=R=>{if(!R){me.innerHTML="";return}let O="";for(let Y=0;Y<=R;Y+=50)O+=`<span class="dt-tick${Y%200===0?" is-major":""}" style="left:${Y}px"></span>`;for(let Y of qt)for(let Nt of[Y.min,Y.max])Nt>0&&Number.isFinite(Nt)&&Nt<=R&&(O+=`<span class="dt-edge" style="left:${Nt}px" title="${Y.label} edge"></span>`);me.innerHTML=O,me.style.width=`${R}px`},H=()=>{let R=parseFloat(Lt.style.width)||0,O=parseFloat(Lt.style.height)||0;if(!R||!O){Lt.style.transform="",delete Lt.dataset.scaled;return}let Y=M||U?Math.min(1,(innerWidth-80)/R,(innerHeight-120)/O):Math.min(1,(innerWidth-80)/R);Lt.style.transform=Y<1?`scale(${Y})`:"",Lt.dataset.scaled=Y<1?String(Math.round(Y*100)):""},q=R=>No.find(O=>O.w===R.w&&O.h===R.h&&O.cutout?.shape==="pill")?.cutout,D=()=>{try{return y.contentDocument}catch{return null}},ut=()=>D()?.title.split("\u2014").pop()?.trim()||"",Et=()=>{let R=D(),O=M?dt(M):null;if(!R?.body||!O)return;let Y=gu(R),Nt=O.browser==="chrome-android"?Y.theme||"rgb(255, 255, 255)":Y.top,Kt=O.browser==="chrome-android"?"rgb(255, 255, 255)":Y.bottom;Lt.style.setProperty("--dt-top",Nt),Lt.style.setProperty("--dt-top-ink",Dr(Nt)),Lt.style.setProperty("--dt-bottom",Kt),Lt.style.setProperty("--dt-bottom-ink",Dr(Kt));let xe=fe.querySelector(".dt-win-tab > span");xe&&(xe.textContent=ut()||location.host)},st=0;y.addEventListener("load",()=>{let R=D();if(!R)return;let O=window.__notemendHosted;if(O&&!y.contentWindow?.__notemendHosted&&!R.querySelector(`script[src^="${O.base}/bar.js"]`)){let Y=R.createElement("script");Y.src=`${O.base}/bar.js`,Y.dataset.project=O.project,R.head.append(Y)}Et(),y.contentWindow?.addEventListener("scroll",()=>{st||(st=requestAnimationFrame(()=>{st=0,Et()}))},{passive:!0})});for(let R of[fe,Qt])R.addEventListener("click",O=>{let Y=O.target.closest("[data-nav]")?.dataset.nav;if(Y)try{let Nt=y.contentWindow?.navigation;if(!D()||!Nt)throw new Error("foreign");Y==="back"?Nt.canGoBack&&Nt.back():Y==="fwd"?Nt.canGoForward&&Nt.forward():Nt.reload()}catch{(Y==="reload"||Y==="back")&&(y.src=location.href)}});we.addEventListener("click",()=>{se=!se,h("dt-bars-min",se?"1":"0"),gt()});let et=[],rt=R=>{for(let O of et)O.inert=!1;et=R?[...document.body.children].filter(O=>O instanceof HTMLElement&&!O.inert&&!O.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let O of et)O.inert=!0},gt=()=>{if(c)return;let R=M?dt(M)??null:null;if(M&&!R&&(M="",ct.setItem(ne,"")),!R&&!$){let O="";try{let Y=y.getAttribute("src")?y.contentWindow?.location:null;Y?.origin===location.origin&&(O=Y.pathname+Y.search+Y.hash)}catch{}if(g.hidden=!0,rt(!1),y.removeAttribute("src"),Zt.toggle("dt-framing",!1),w.hidden=!J(),me.innerHTML="",at(),Re.hidden=!0,we.hidden=!0,F(null),ft="",xt(),at(),He(),O&&O!==location.pathname+location.search+location.hash){location.assign(O);return}It();return}if(g.hidden=!1,rt(!0),Zt.toggle("dt-framing",!0),w.hidden=!0,y.src||(y.src=location.href),R){let O=hu(R,{host:location.host,title:ut(),now:new Date,min:se,cutout:q(R)}),{screen:Y}=O;g.dataset.mode="device",Lt.dataset.shell=R.shell,Lt.dataset.browser=R.browser,Lt.style.width=`${O.footprint.w}px`,Lt.style.height=`${O.footprint.h}px`,Lt.style.setProperty("--dt-r",`${Y.r}px`),Lt.style.setProperty("--dt-rb",`${Y.rb}px`),pe.innerHTML=O.shell;let Nt=(it,ye,os,as)=>{it.innerHTML=as,it.style.cssText=`left:${Y.x}px;top:${ye}px;width:${Y.w}px;height:${os}px`};Nt(fe,Y.y,O.topH,O.top),Nt(Qt,Y.y+Y.h-O.bottomH,O.bottomH,O.bottom);let Kt=Y.h-O.topH-O.bottomH;y.style.position="absolute",y.style.left=`${Y.x}px`,y.style.top=`${Y.y+O.topH}px`,y.style.width=`${Y.w}px`,y.style.height=`${Kt}px`,me.innerHTML="";let xe=se&&O.canMinimize;N=O.scrollbar,ft=`${R.label}${xe?" \xB7 bars folded":""}`,F(k(R.w)),St({notes:J(),scrollbar:N,device:ft}),we.hidden=!O.canMinimize,we.setAttribute("aria-pressed",String(xe)),E(`${R.label} ${R.w}\xD7${R.h} \xB7 page ${R.w}\xD7${Kt}${xe?" \xB7 bars folded":""} \xB7 ${qt.find(it=>it.id===tt())?.label??""}`),Et()}else{let O=_t();O||Dt(null);let Y=O?.w||L||qt.find(xe=>xe.id===z()).ideal;L=Y,g.dataset.mode="canvas",delete Lt.dataset.shell,delete Lt.dataset.browser,pe.innerHTML=fe.innerHTML=Qt.innerHTML="",fe.style.cssText=Qt.style.cssText="",we.hidden=!0,N="overlay",Lt.style.width=`${Y}px`,Lt.style.height=`${O?.h??innerHeight-84}px`,y.style.position="",y.style.left=y.style.top="",y.style.width="100%",y.style.height="100%",x(Y),St({notes:J()});let Nt=qt.find(xe=>xe.id===k(Y)),Kt=G();ft=Kt?`${Kt.label}${U?.turned?" \xB7 landscape":""}`:"",St({scrollbar:N,device:ft}),E(Kt&&O?`${Kt.label} \xB7 ${O.w}\xD7${O.h} \xB7 ${Nt.label}`:`${Y}px \xB7 ${Nt.label}`),F(k(Y))}Re.hidden=!(G()?.rotates&&!R),He(),H(),at(),It()},At=R=>{let O=qt.find(Y=>Y.id===R);M="",ct.setItem(ne,""),Dt(null),$=z()!==R,L=$?O.ideal:0,F($?R:null),ct.setItem(jt,$?"1":"0"),ct.setItem(Rt,String(L)),Wt(),gt()};for(let R of C)R.addEventListener("click",()=>At(R.dataset.bp));for(let R of document.querySelectorAll("[data-device]"))R.addEventListener("click",()=>{M=R.dataset.device===M?"":R.dataset.device,ct.setItem(ne,M),S.open=!1,gt()});for(let R of document.querySelectorAll("[data-emu]"))R.addEventListener("click",()=>{let O=U?.id===R.dataset.emu&&!M;M="",ct.setItem(ne,""),Dt(O?null:{id:R.dataset.emu,turned:!1}),$=!O,L=0,ct.setItem(jt,$?"1":"0"),F(null),Wt(),S.open=!1,gt()});Re.addEventListener("click",()=>{U&&(Dt({...U,turned:!U.turned}),Wt(),gt())});let $e=[...S.querySelectorAll("[data-tab]")],je=[...S.querySelectorAll("[data-panel]")],ke=R=>{for(let O of $e)O.setAttribute("aria-selected",String(O.dataset.tab===R));for(let O of je)O.hidden=O.dataset.panel!==R;h("dt-devices-tab",R)};for(let R of $e)R.addEventListener("click",()=>ke(R.dataset.tab));ke(ct.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let Vt=S.querySelector(".dt-emu-search");Vt.addEventListener("input",()=>{let R=Vt.value.trim().toLowerCase(),O=null,Y=!1,Nt=()=>{O&&(O.hidden=!Y)};for(let Kt of Vt.parentElement.children){if(Kt.classList.contains("dt-devices-group")){Nt(),O=Kt,Y=!1;continue}Kt.dataset.emu&&(Kt.hidden=!!R&&!Kt.textContent.toLowerCase().includes(R),Y||=!Kt.hidden)}Nt()});let he=S.querySelector(".dt-devices-name");function He(){for(let O of S.querySelectorAll("[data-device]"))O.setAttribute("aria-pressed",String(O.dataset.device===M));let R=!M&&!g.hidden?U?.id:void 0;for(let O of S.querySelectorAll("[data-emu]"))O.setAttribute("aria-pressed",String(O.dataset.emu===R));he.textContent=M&&dt(M)?.label||R&&G()?.label||"Device"}let be=R=>qt.find(O=>O.id===R),_e=R=>{let O=be(tt()??z());return Math.max(O.min||320,Math.min(Number.isFinite(O.max)?O.max:2560,Math.round(R)))};for(let R of Ln){let O=R.dataset.edge==="l"?-1:1;R.addEventListener("pointerdown",Y=>{if(M)return;Y.preventDefault(),U&&(Dt(null),gt()),R.setPointerCapture(Y.pointerId);let Nt=Y.clientX,Kt=L,xe=Number(Lt.dataset.scaled||100)/100;g.dataset.dragging="1";let it=os=>{L=_e(Kt+O*(os.clientX-Nt)*2/xe),Lt.style.width=`${L}px`,x(L),E(`${L}px \xB7 ${be(k(L)).label}`),H()},ye=()=>{R.removeEventListener("pointermove",it),R.removeEventListener("pointerup",ye),R.removeEventListener("pointercancel",ye),delete g.dataset.dragging,ct.setItem(Rt,String(L)),gt()};R.addEventListener("pointermove",it),R.addEventListener("pointerup",ye),R.addEventListener("pointercancel",ye)}),R.addEventListener("dblclick",()=>{if(M)return;Dt(null);let Y=be(tt()??z()),Nt=[Y.min||320,Number.isFinite(Y.max)?Y.max:Y.ideal];L=Math.abs(L-Nt[0])<Math.abs(L-Nt[1])?Nt[0]:Nt[1],ct.setItem(Rt,String(L)),gt()})}let Ms=z(),qn=()=>{let R=qt.find(O=>O.id===A);return $&&!M&&!U&&L===R.ideal&&innerWidth>=R.min};return addEventListener("resize",()=>{if(qn()){At(A);return}at(),z()!==Ms&&(Ms=z(),vt()),g.hidden||(!M&&!U&&(Lt.style.height=`${innerHeight-84}px`),H())}),{apply:gt,pickBp:At,look:()=>({scrollbar:N,device:ft}),restore:()=>{qn()?At(A):$||M?gt():He()}}}var bu='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="5" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.2" fill="currentColor" stroke="none"/></svg>',yu='<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>',xh='<svg viewBox="0 0 20 20" width="10" height="10" aria-hidden="true"><rect x="3" y="3" width="14" height="14" rx="3"/><path d="M10 3v14"/></svg>',Eh='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function vu(n){let{bp:i,notes:c,breakpoints:h,bandOfNote:g,showResolved:y,showArchived:S,drafts:C,find:w}=n,A=c.filter(N=>g(N)===i),k=N=>[N.text,N.note,N.byName,...(N.replies??[]).filter(ft=>!ft.deleted).map(ft=>ft.text)].join(" ").toLowerCase(),z=N=>w.view==="me"?n.forMe(N):w.view==="agent"?n.forAgent(N):!0,dt=N=>Date.parse(N.updatedAt||N.createdAt||"")||0,J=N=>Date.parse(N.createdAt||"")||0,tt=A.filter(N=>z(N)&&(!w.q||k(N).includes(w.q.trim().toLowerCase()))).sort((N,ft)=>w.sort==="old"?J(N)-J(ft):w.sort==="new"?J(ft)-J(N):(w.sort==="unread"?Number(n.unread(ft))-Number(n.unread(N)):0)||dt(ft)-dt(N)),F={open:[],claude:[],done:[],archived:[]};for(let N of tt)F[Ct(N)==="done"&&n.archived(N)?"archived":Ct(N)].push(N);let xt=N=>{let ft=Ct(N),Rt=n.orphan(N),jt=n.unread(N),ne=n.picking&&n.pickable(N),$=!!ne&&n.picking.has(N.id),M=n.mirror(N),L=Qn(N.updatedAt||N.createdAt),V=M?`<i class="dt-hist-mirror"${M==="there"?` data-tip="In Team too \xB7 ${f(L)}"`:' data-tip="A client\u2019s thread, mirrored into Team"'}>${xh}Mirrored</i>`:"";return`<div class="dt-hist-row is-${ft}${ft==="done"?n.archived(N)?" is-archived":" is-resolved":""}${Rt?" is-orphan":""}${jt?" is-unread":""}${n.menuFor===N.id?" is-menu":""}${$?" is-picked":""}${n.picking&&!ne?` is-unpickable${M?" is-dim":""}`:""}">
212
+ <button class="dt-hist-go" data-go="${N.id}" data-tip="${f(N.text.slice(0,80))}"${ne?` role="checkbox" aria-checked="${$}"`:""}>
213
+ ${ne?`<span class="dt-hist-pick" aria-hidden="true"><i class="dt-hist-box">${$?Me:""}</i></span>`:n.marker(N)}
214
214
  <span class="dt-hist-body">
215
- <span class="dt-hist-id"><b class="dt-hist-who">${f(C.byName||"You")}</b>${nt}${N==="there"?"":`<em>\xB7 ${S}</em>`}${Wt?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
216
- <span class="dt-hist-text">${f(Hc(C.text||C.note))}</span>${n.replied(C)}
215
+ <span class="dt-hist-id"><b class="dt-hist-who">${f(N.byName||"You")}</b>${V}${M==="there"?"":`<em>\xB7 ${L}</em>`}${jt?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
216
+ <span class="dt-hist-text">${f(Cc(N.text||N.note))}</span>${n.replied(N)}
217
217
  </span>
218
218
  </button>
219
- <span class="dt-note-tools dt-hist-tools">${n.tick(C)}${n.assign(C)}<button type="button" class="dt-hist-more" data-row-more="${C.id}" aria-label="More" aria-haspopup="menu" aria-expanded="${n.menuFor===C.id}">${fu}</button>${n.rowMenu(C)}</span>
220
- </div>`},_t=m.map(C=>{let yt=c.filter(Rt=>g(Rt)===C.id&&Bt(Rt)!=="done");return{band:C,open:yt.filter(Rt=>Bt(Rt)==="open").length,total:yt.length}}).filter(C=>C.total&&C.band.id!==i),At=_t.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${_t.map(({band:C,open:yt,total:Rt})=>{let Wt=`${C.label}: ${yt} open \xB7 ${Rt-yt} to check`;return`<button data-bp="${C.id}" data-state="${yt?"open":"claude"}" title="${Wt}" aria-label="${Wt}"
221
- ><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${C.icon}</svg><i>${Rt}</i></button>`}).join("")}</div>`:"",it=["open","claude","done","archived"],ft={...Jc,archived:"Archived"},Dt=(C,yt,Rt)=>`<button type="button" class="dt-hist-gfold" data-gfold="${C}" aria-expanded="${!n.shut(C)}"
222
- >${Ft[C]??""}${yt}<em>${Rt}</em><svg class="dt-hist-chev" viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${n.shut(C)?"m9 18 6-6-6-6":"m6 9 6 6 6-6"}"/></svg></button>`,Ft={open:Ye("#0d99ff",0),claude:Ye("#8e4ec6",.5),done:Ye("#30a46c",1),archived:Ye("#717171",1)},Lt=n.cap,ne=it.filter(C=>I[C].length&&(C==="done"?b:C==="archived"?L:!0)),ue=C=>`<div class="dt-hist-row is-draft">
223
- <button class="dt-hist-go" data-draft-go="${C.i}">
219
+ <span class="dt-note-tools dt-hist-tools">${n.tick(N)}${n.assign(N)}<button type="button" class="dt-hist-more" data-row-more="${N.id}" aria-label="More" aria-haspopup="menu" aria-expanded="${n.menuFor===N.id}">${bu}</button>${n.rowMenu(N)}</span>
220
+ </div>`},Wt=h.map(N=>{let ft=c.filter(Rt=>g(Rt)===N.id&&Ct(Rt)!=="done");return{band:N,open:ft.filter(Rt=>Ct(Rt)==="open").length,total:ft.length}}).filter(N=>N.total&&N.band.id!==i),St=Wt.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${Wt.map(({band:N,open:ft,total:Rt})=>{let jt=`${N.label}: ${ft} open \xB7 ${Rt-ft} to check`;return`<button data-bp="${N.id}" data-state="${ft?"open":"claude"}" title="${jt}" aria-label="${jt}"
221
+ ><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${N.icon}</svg><i>${Rt}</i></button>`}).join("")}</div>`:"",at=["open","claude","done","archived"],vt={...Zc,archived:"Archived"},It=(N,ft,Rt)=>`<button type="button" class="dt-hist-gfold" data-gfold="${N}" aria-expanded="${!n.shut(N)}"
222
+ >${qt[N]??""}${ft}<em>${Rt}</em><svg class="dt-hist-chev" viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${n.shut(N)?"m9 18 6-6-6-6":"m6 9 6 6 6-6"}"/></svg></button>`,qt={open:Ye("#0d99ff",0),claude:Ye("#8e4ec6",.5),done:Ye("#30a46c",1),archived:Ye("#717171",1)},Lt=n.cap,pe=at.filter(N=>F[N].length&&(N==="done"?y:N==="archived"?S:!0)),fe=N=>`<div class="dt-hist-row is-draft">
223
+ <button class="dt-hist-go" data-draft-go="${N.i}">
224
224
  ${n.draftFace||`<span class="dt-hist-n">${es}</span>`}
225
225
  <span class="dt-hist-body">
226
- <span class="dt-hist-id">${n.draftFace?`<b class="dt-hist-who">${f(n.draftName)}</b><em>\xB7 draft \xB7 ${f(C.el)}</em>`:f(C.el)}${C.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
227
- <span class="dt-hist-text">${C.text?f(C.text):`${C.shots} screenshot${C.shots===1?"":"s"}`}</span>
226
+ <span class="dt-hist-id">${n.draftFace?`<b class="dt-hist-who">${f(n.draftName)}</b><em>\xB7 draft \xB7 ${f(N.el)}</em>`:f(N.el)}${N.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
227
+ <span class="dt-hist-text">${N.text?f(N.text):`${N.shots} screenshot${N.shots===1?"":"s"}`}</span>
228
228
  </span>
229
229
  </button>${n.draftFace?`<span class="dt-hist-step" role="img" aria-label="Draft, not sent"><span class="dt-hist-n">${es}</span></span>`:""}
230
- <span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${C.i}" title="Discard this draft">${ts}</button></span></span>
231
- </div>`,pe=T.filter(C=>Bt(C)!=="done"),me=(C,yt,Rt,Wt,x)=>`<button type="button" role="menuitemradio" aria-checked="${Wt}" ${C}="${yt}"><i>${Wt?Me:""}</i><span>${Rt}</span>${x==null?"":`<em>${x}</em>`}</button>`,fn=()=>`<div class="dt-hist-find">
232
- <label class="dt-hist-search">${bu}<input type="search" data-hist-q placeholder="Search threads" aria-label="Search threads" value="${f(v.q)}" spellcheck="false">${v.q?`<button type="button" data-hist-clear aria-label="Clear search">${Pn}</button>`:'<kbd aria-hidden="true">/</kbd>'}</label>
233
- <button type="button" class="dt-tip-r dt-hist-filter${v.view!=="all"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${v.menu}" data-tip="Filter">${$h}</button>
234
- ${v.menu?`<div class="dt-hist-menu" role="menu">${me("data-hist-view","me","For me",v.view==="me",pe.filter(n.forMe).length)}${me("data-hist-view","agent","Agent",v.view==="agent",pe.filter(n.forAgent).length)}${me("data-hist-view","all","All",v.view==="all",pe.length)}</div>`:""}
235
- </div>`,zt=(C,yt,Rt,Wt)=>`<button type="button" role="menuitemcheckbox" ${C} aria-checked="${yt}"><span>${Rt}</span><kbd>${Wt}</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>`,Fe=C=>C.map(yt=>yt.id).join(","),fe=()=>`<div class="dt-hist-menu is-panel" role="menu">
236
- <button type="button" role="menuitem" data-read-all><span>Mark all as read</span></button>${I.open.length?`<button type="button" role="menuitem" data-resolve-all="${Fe(I.open)}"><span>Resolve all open</span><em>${I.open.length}</em></button>`:""}${n.mirrorAll.length?`<button type="button" role="menuitem" data-mirror-all="${n.mirrorAll.join(",")}"><span>Mirror all open to Team</span><em>${n.mirrorAll.length}</em></button>`:""}${n.archives&&I.done.length?`<button type="button" role="menuitem" data-archive-all="${Fe(I.done)}"><span>Archive all resolved</span><em>${I.done.length}</em></button>`:""}<hr>${zt("data-resolved",b,"Show resolved","R")}${n.archives?zt("data-archived",L,"Show archived","A"):""}<hr>
237
- <p class="dt-hist-menu-head">Sort</p>${me("data-hist-sort","new","Newest first",v.sort==="new")}${me("data-hist-sort","old","Oldest first",v.sort==="old")}${me("data-hist-sort","reply","Last reply",v.sort==="reply")}${me("data-hist-sort","unread","Unread first",v.sort==="unread")}</div>`;return`<div class="dt-hist-head">
230
+ <span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${N.i}" title="Discard this draft">${ts}</button></span></span>
231
+ </div>`,Qt=A.filter(N=>Ct(N)!=="done"),me=(N,ft,Rt,jt,ne)=>`<button type="button" role="menuitemradio" aria-checked="${jt}" ${N}="${ft}"><i>${jt?Me:""}</i><span>${Rt}</span>${ne==null?"":`<em>${ne}</em>`}</button>`,Ln=()=>`<div class="dt-hist-find">
232
+ <label class="dt-hist-search">${yu}<input type="search" data-hist-q placeholder="Search threads" aria-label="Search threads" value="${f(w.q)}" spellcheck="false">${w.q?`<button type="button" data-hist-clear aria-label="Clear search">${Pn}</button>`:'<kbd aria-hidden="true">/</kbd>'}</label>
233
+ <button type="button" class="dt-tip-r dt-hist-filter${w.view!=="all"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${w.menu}" data-tip="Filter">${Eh}</button>
234
+ ${w.menu?`<div class="dt-hist-menu" role="menu">${me("data-hist-view","me","For me",w.view==="me",Qt.filter(n.forMe).length)}${me("data-hist-view","agent","Agent",w.view==="agent",Qt.filter(n.forAgent).length)}${me("data-hist-view","all","All",w.view==="all",Qt.length)}</div>`:""}
235
+ </div>`,zt=(N,ft,Rt,jt)=>`<button type="button" role="menuitemcheckbox" ${N} aria-checked="${ft}"><span>${Rt}</span><kbd>${jt}</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>`,Re=N=>N.map(ft=>ft.id).join(","),we=()=>`<div class="dt-hist-menu is-panel" role="menu">
236
+ <button type="button" role="menuitem" data-read-all><span>Mark all as read</span></button>${F.open.length?`<button type="button" role="menuitem" data-resolve-all="${Re(F.open)}"><span>Resolve all open</span><em>${F.open.length}</em></button>`:""}${n.mirrorAll.length?`<button type="button" role="menuitem" data-mirror-all="${n.mirrorAll.join(",")}"><span>Mirror all open to Team</span><em>${n.mirrorAll.length}</em></button>`:""}${n.archives&&F.done.length?`<button type="button" role="menuitem" data-archive-all="${Re(F.done)}"><span>Archive all resolved</span><em>${F.done.length}</em></button>`:""}<hr>${zt("data-resolved",y,"Show resolved","R")}${n.archives?zt("data-archived",S,"Show archived","A"):""}<hr>
237
+ <p class="dt-hist-menu-head">Sort</p>${me("data-hist-sort","new","Newest first",w.sort==="new")}${me("data-hist-sort","old","Oldest first",w.sort==="old")}${me("data-hist-sort","reply","Last reply",w.sort==="reply")}${me("data-hist-sort","unread","Unread first",w.sort==="unread")}</div>`;return`<div class="dt-hist-head">
238
238
  <span class="dt-hist-here"
239
239
  ><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><rect x="2.5" y="3.5" width="15" height="13" rx="2"/><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5"/></svg></span>
240
240
  <span class="dt-hist-title">Threads</span>
241
241
  ${n.clients?'<span class="dt-hist-space"><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true"><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"/></svg>Client</span>':""}
242
- ${At}
242
+ ${St}
243
243
  ${n.checks&&!n.clients?`<button class="dt-review-btn" data-review aria-label="Check all ${n.checks} ${n.checks===1?"fix":"fixes"}" data-tip="${n.checks} ${n.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${n.checks}</button>`:""}
244
- <button class="dt-hist-refresh" data-hist-more aria-label="More" aria-haspopup="menu" aria-expanded="${v.more}">${fu}</button>${v.more&&!n.folded?fe():""}
244
+ <button class="dt-hist-refresh" data-hist-more aria-label="More" aria-haspopup="menu" aria-expanded="${w.more}">${bu}</button>${w.more&&!n.folded?we():""}
245
245
  <button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel" aria-expanded="${!n.folded}">
246
246
  <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>
247
247
  </button>
248
- </div>`+(n.folded?"":fn()+(ne.length||A.length?`<div class="dt-hist-list">${A.length?`<p class="dt-hist-group">${Dt("drafts","Drafts",A.length)}</p>${n.shut("drafts")?"":A.map(ue).join("")}`:""}${ne.map(C=>{if(n.shut(C))return`<p class="dt-hist-group">${Dt(C,ft[C],I[C].length)}</p>`;let yt=I[C].slice(0,Math.max(0,Lt));Lt-=yt.length;let Rt=I[C].slice(yt.length).find(x=>x.id===n.keep);Rt&&yt.push(Rt);let Wt=I[C].length-yt.length;return`<p class="dt-hist-group">${Dt(C,ft[C],I[C].length)}</p>${yt.map(Tt).join("")}${Wt?`<button type="button" class="dt-note-fold dt-hist-rest" data-hist-rows>${Wt} more in ${ft[C]}</button>`:""}`}).join("")}</div>`:v.q.trim()?`<div class="dt-hist-empty">${bu}<p>No threads match \xAB${f(v.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:v.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>':`<div class="dt-hist-empty is-blank"><i><svg viewBox="0 0 20 20" width="18" height="18" aria-hidden="true"><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-2zM10 6v5M7.5 8.5h5" stroke-linejoin="round"/></svg></i>${I.done.length||I.archived.length?"<b>Everything here is resolved.</b>":b?"<b>No threads at this breakpoint yet</b><p>Click anything on the page to leave one.</p>":"<b>Nothing open at this breakpoint</b><p>Resolved threads are hidden \u2014 \xABShow resolved\xBB below brings them back.</p>"}</div>`)+(n.picking?`<div class="dt-hist-foot is-picking" role="toolbar" aria-label="Selected threads"><span class="dt-hist-sel" aria-live="polite">${n.picking.size} selected</span
248
+ </div>`+(n.folded?"":Ln()+(pe.length||C.length?`<div class="dt-hist-list">${C.length?`<p class="dt-hist-group">${It("drafts","Drafts",C.length)}</p>${n.shut("drafts")?"":C.map(fe).join("")}`:""}${pe.map(N=>{if(n.shut(N))return`<p class="dt-hist-group">${It(N,vt[N],F[N].length)}</p>`;let ft=F[N].slice(0,Math.max(0,Lt));Lt-=ft.length;let Rt=F[N].slice(ft.length).find(ne=>ne.id===n.keep);Rt&&ft.push(Rt);let jt=F[N].length-ft.length;return`<p class="dt-hist-group">${It(N,vt[N],F[N].length)}</p>${ft.map(xt).join("")}${jt?`<button type="button" class="dt-note-fold dt-hist-rest" data-hist-rows>${jt} more in ${vt[N]}</button>`:""}`}).join("")}</div>`:w.q.trim()?`<div class="dt-hist-empty">${yu}<p>No threads match \xAB${f(w.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:w.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>':`<div class="dt-hist-empty is-blank"><i><svg viewBox="0 0 20 20" width="18" height="18" aria-hidden="true"><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-2zM10 6v5M7.5 8.5h5" stroke-linejoin="round"/></svg></i>${F.done.length||F.archived.length?"<b>Everything here is resolved.</b>":y?"<b>No threads at this breakpoint yet</b><p>Click anything on the page to leave one.</p>":"<b>Nothing open at this breakpoint</b><p>Resolved threads are hidden \u2014 \xABShow resolved\xBB below brings them back.</p>"}</div>`)+(n.picking?`<div class="dt-hist-foot is-picking" role="toolbar" aria-label="Selected threads"><span class="dt-hist-sel" aria-live="polite">${n.picking.size} selected</span
249
249
  ><button type="button" data-pick-mirror${n.picking.size?"":" disabled"}><kbd>M</kbd>Mirror to Team</button><button type="button" data-pick-cancel><kbd>Esc</kbd>Cancel</button></div>`:`<div class="dt-hist-foot">
250
- <button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${b}"
250
+ <button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${y}"
251
251
  ><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
252
252
  ><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
253
- <button class="dt-hist-resolved" data-archived role="switch" aria-checked="${L}"
254
- >${Ln}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
255
- </div>`))}function vu(n){let{inFrame:i,everything:c,route:m,open:g,settle:b,keepIn:L,toast:A,waits:v,approve:T}=n,M=it=>{let ft=c().find(Dt=>Dt.id===it);return!!ft&&v(ft)},z="nm-review",at=()=>{try{return JSON.parse(sessionStorage.getItem(z)||"null")}catch{return null}},X=it=>{try{it?sessionStorage.setItem(z,JSON.stringify(it)):sessionStorage.removeItem(z)}catch{}},Q=document.createElement("div");Q.className="dt-review",Q.setAttribute("role","region"),Q.setAttribute("aria-label","Checking fixes"),Q.hidden=!0,L(Q),i||document.body.append(Q);let I=()=>c().filter(v),Tt=()=>{let it=I().sort((ft,Dt)=>+(Dt.route===m())-+(ft.route===m())||String(ft.route).localeCompare(String(Dt.route))||ft.id-Dt.id).map(ft=>ft.id);it.length&&(X({ids:it,i:0}),_t())},_t=()=>{let it=at();if(!it||i){Q.hidden=!0;return}for(;it.i<it.ids.length&&!M(it.ids[it.i]);)it.i++;if(it.i>=it.ids.length){X(null),Q.hidden=!0,A("Every fix is checked.");return}X(it);let ft=c().find(Lt=>Lt.id===it.ids[it.i]);if(ft.route&&ft.route!==m()){location.assign(ft.route+location.search);return}g(ft);let Dt=it.ids.slice(0,it.i).some(M),Ft=it.ids.filter(M);Q.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
256
- <span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${Dt?"":" disabled"}>${Wa}</button>
257
- <span class="dt-review-n">${Ft.indexOf(ft.id)+1} of ${Ft.length}</span>
258
- <button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${za}</button></span>
253
+ <button class="dt-hist-resolved" data-archived role="switch" aria-checked="${S}"
254
+ >${kn}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
255
+ </div>`))}function wu(n){let{inFrame:i,everything:c,route:h,open:g,settle:y,keepIn:S,toast:C,waits:w,approve:A}=n,k=at=>{let vt=c().find(It=>It.id===at);return!!vt&&w(vt)},z="nm-review",dt=()=>{try{return JSON.parse(sessionStorage.getItem(z)||"null")}catch{return null}},J=at=>{try{at?sessionStorage.setItem(z,JSON.stringify(at)):sessionStorage.removeItem(z)}catch{}},tt=document.createElement("div");tt.className="dt-review",tt.setAttribute("role","region"),tt.setAttribute("aria-label","Checking fixes"),tt.hidden=!0,S(tt),i||document.body.append(tt);let F=()=>c().filter(w),xt=()=>{let at=F().sort((vt,It)=>+(It.route===h())-+(vt.route===h())||String(vt.route).localeCompare(String(It.route))||vt.id-It.id).map(vt=>vt.id);at.length&&(J({ids:at,i:0}),Wt())},Wt=()=>{let at=dt();if(!at||i){tt.hidden=!0;return}for(;at.i<at.ids.length&&!k(at.ids[at.i]);)at.i++;if(at.i>=at.ids.length){J(null),tt.hidden=!0,C("Every fix is checked.");return}J(at);let vt=c().find(Lt=>Lt.id===at.ids[at.i]);if(vt.route&&vt.route!==h()){location.assign(vt.route+location.search);return}g(vt);let It=at.ids.slice(0,at.i).some(k),qt=at.ids.filter(k);tt.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
256
+ <span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${It?"":" disabled"}>${za}</button>
257
+ <span class="dt-review-n">${qt.indexOf(vt.id)+1} of ${qt.length}</span>
258
+ <button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Va}</button></span>
259
259
  <button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${Me}</button>
260
260
  <button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${gn}</button>
261
- <button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Pn}</button>`,Q.hidden=!1};Q.addEventListener("click",async it=>{let ft=it.target.closest("[data-r]"),Dt=at();if(!ft||!Dt)return;if(ft.dataset.r==="stop"){X(null),Q.hidden=!0;return}if(ft.dataset.r==="prev"){At();return}let Ft=Dt.ids[Dt.i];X({...Dt,i:Dt.i+1});let Lt=c().find(ue=>ue.id===Ft),ne=ft.dataset.r==="ok"&&Lt?T(Lt):ft.dataset.r==="no"?b(Ft,!1):null;_t(),await ne});let At=()=>{let it=at();if(it){for(let ft=it.i-1;ft>=0;ft--)if(M(it.ids[ft])){X({...it,i:ft}),_t();return}}};return document.addEventListener("keydown",it=>{Q.hidden||it.metaKey||it.ctrlKey||it.altKey||it.key!=="ArrowLeft"&&it.key!=="ArrowRight"||it.target.closest?.("input, textarea, select, [contenteditable]")||(it.preventDefault(),it.key==="ArrowLeft"?At():Q.querySelector('[data-r="skip"]')?.click())}),{start:Tt,toCheck:I,resume:()=>{at()&&_t()}}}function wu(n,i){let c=null,m=null,g=document.querySelector(".dt-turbo"),b="/notemend:turbo",L=()=>{let A=!!c&&Date.now()-Date.parse(c.at)<18e4,v=A?c.mode==="push"?"push":m?.paused?"paused":"on":"none",T=A?Zn(c.agent):"",M=v==="none"?`Turbo is off. Run ${b} in Claude Code and threads for the agent are taken as they land \u2014 click to copy it`:v==="push"?`Push mode: ${T} takes threads when you press Push to the agent. For live, run ${b} instead`:v==="on"?`Turbo on: ${T} takes threads for the agent as they land \u2014 click to pause`:`Turbo paused: ${T} is listening but waits \u2014 click to resume`;g.dataset.state=v,g.dataset.tip=M,g.setAttribute("aria-label",M),g.setAttribute("aria-checked",String(v==="on")),n&&(g.hidden=!0)};return setInterval(L,3e4),g.addEventListener("click",async()=>{let A=g.dataset.state;if(A==="none"||A==="push"){await navigator.clipboard?.writeText(b).catch(()=>{}),i(`Copied ${b} \u2014 paste it in Claude Code`);return}let v=A==="on"?"off":"on";m={paused:v==="off"},L();try{let T=await oe("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:v})});if(!T.ok)throw new Error(String(T.status));i(v==="off"?"Turbo paused":"Turbo on")}catch{m={paused:v==="on"},L(),i("Could not switch turbo \u2014 try again")}}),A=>{c=A.listening??null,m=A.turbo??null,L()}}var xh=new Set(["data-wired","data-nudge"]),Eh=".dt-note",$u=n=>n instanceof Element&&n.hasAttribute("data-ghost"),Do=n=>{if(!(n instanceof Element))return null;let i=n.dataset;return i.msg?`m:${i.msg}`:i.id?`${n.tagName}:${n.classList[0]??""}:${i.id}`:"draft"in i?`${n.tagName}:draft`:i.parked?`${n.tagName}:parked:${i.parked}`:i.k?`${n.tagName}:k:${i.k}`:null},xu=(n,i)=>n.nodeType===i.nodeType&&n.nodeName===i.nodeName&&Do(n)===Do(i);function Mh(n,i){for(let{name:c}of[...n.attributes])!i.hasAttribute(c)&&!xh.has(c)&&n.removeAttribute(c);for(let{name:c,value:m}of i.attributes)n.getAttribute(c)!==m&&n.setAttribute(c,m);n instanceof HTMLInputElement&&i instanceof HTMLInputElement&&(n.checked!==i.checked&&(n.checked=i.checked),n!==document.activeElement&&n.value!==i.value&&(n.value=i.value))}function Eu(n,i){let c=[...n.childNodes].filter(v=>!$u(v)),m=new Map;for(let v of c){let T=Do(v);T&&m.set(T,v)}let g=new Set,b=0,L=[];for(let v of[...i.childNodes]){let T=Do(v),M=T?m.get(T):void 0;if(!T){for(;b<c.length&&(g.has(c[b])||Do(c[b]));)b++;b<c.length&&xu(c[b],v)&&(M=c[b++])}M&&!g.has(M)&&xu(M,v)?(g.add(M),kh(M,v),L.push(M)):L.push(v)}for(let v of c)g.has(v)||(v instanceof HTMLElement&&v.matches(Eh)&&lu(v),n.removeChild(v));let A=n.firstChild;for(let v of L){for(;A&&$u(A);)A=A.nextSibling;if(v===A){A=A.nextSibling;continue}n.insertBefore(v,A)}}function kh(n,i){if(n.nodeType===Node.TEXT_NODE||n.nodeType===Node.COMMENT_NODE){n.nodeValue!==i.nodeValue&&(n.nodeValue=i.nodeValue);return}if(!(!(n instanceof Element)||!(i instanceof Element))){if(Mh(n,i),n instanceof HTMLTextAreaElement){n!==document.activeElement&&n.value!==i.value&&(n.value=i.value);return}if(n instanceof SVGElement){n.innerHTML!==i.innerHTML&&(n.innerHTML=i.innerHTML);return}Eu(n,i),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==i.value&&(n.value=i.value)}}function Fr(n,i){let c=document.createElement("template");c.innerHTML=i,Eu(n,c.content)}function Mu(n,i,c=!1){let m=n.breakpoints,g=n.categories,b=(m.find(t=>!Number.isFinite(t.max))??m[0]).id,L=t=>m.find(e=>t>=e.min&&t<=e.max)?.id??b,A=(t,e)=>{let s=L(t);if(Vs||!matchMedia("(pointer: coarse)").matches)return s;let o=[...m].sort((l,d)=>l.min-d.min),a=e<500?L(767):(o[o.length-2]??o[0]).id,r=l=>o.findIndex(d=>d.id===l);return r(s)>r(a)?a:s},v=t=>t.breakpoint||b,T=t=>n.devices.find(e=>e.id===t),M=Vs,z=(t,e)=>{M||ct.setItem(t,e)},at=null,X=["stage","status","priority","assignee"],Q=t=>{let e=(at??j).find(a=>a.id===t.id),s=X.filter(a=>a in t||(a==="stage"||a==="status")&&("stage"in t||"status"in t)),o=e&&s.length&&!t.reply?Object.fromEntries(s.map(a=>[a,e[a]??null])):void 0;return oe("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(o?{...t,seen:o}:t)})},I=t=>t.replace(/\/+$/,"")||"/",Tt=I(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 _t=document.querySelector(".dt-grid-btn"),At=document.querySelector(".dt-grid-overlay"),it=At.querySelector(".dt-overlay-grid"),ft=At.querySelector(".dt-grid-chip"),Dt="dt-grid",Ft=n.projectGrid??null,Lt=()=>A(innerWidth,innerHeight),ne=()=>Ft?.mode==="custom"?Ft.widths?.[Lt()]??null:null,ue=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),pe=t=>ue(t).length,me=()=>{let t=At.hidden;t&&(At.style.visibility="hidden",At.hidden=!1);try{return fn()}finally{t&&(At.hidden=!0,At.style.visibility="")}},fn=()=>{let t=document.documentElement.clientWidth;At.classList.remove("is-auto");let e=getComputedStyle(it);if(e.display==="grid"&&pe(e)>1){let r=it.getBoundingClientRect();return{cols:pe(e),gap:Math.round(parseFloat(e.columnGap)||0),x:Math.round(r.left),w:Math.round(r.width),from:"site"}}let s=null,o=null;for(let r of[...document.body.querySelectorAll("*")].slice(0,3e3)){if(r.closest(Xs)||At.contains(r))continue;let l=r.getBoundingClientRect();if(!l.width||!l.height)continue;let d=getComputedStyle(r);if(d.maxWidth!=="none"&&l.left>0&&Math.abs(l.left-(t-l.right))<=2&&l.width>(s?.w??0)){let h=parseFloat(d.paddingLeft)||0;s={x:l.left+h,w:l.width-h-(parseFloat(d.paddingRight)||0)}}if(l.width<=(o?.w??0))continue;let u=d.display.endsWith("grid")?ue(d):[];if(u.length>1){if(!u.every($=>Math.abs($-u[0])<2))continue;let h=parseFloat(d.columnGap)||0;o={cols:u.length,gap:h,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:u.reduce(($,B)=>$+B,0)+h*(u.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let h=[...r.children].map(B=>B.getBoundingClientRect()).filter(B=>B.width&&B.height),$=h.filter(B=>Math.abs(B.top-h[0].top)<2).sort((B,_)=>B.left-_.left);$.length>1&&$.every(B=>Math.abs(B.width-$[0].width)<2)&&(o={cols:$.length,gap:Math.max(0,$[1].left-$[0].right),x:$[0].left,w:$.at(-1).right-$[0].left})}}let a=r=>({...r,gap:Math.round(r.gap),x:Math.round(r.x),w:Math.round(r.w)});return a(o?{...o,...s??{},from:"page"}:{cols:n.grid.columns,gap:innerWidth<768?16:24,...s??{x:24,w:t-48},from:"guess"})},zt=null,Fe=(t,e,s,o)=>{At.classList.add("is-auto"),it.children.length!==t&&(it.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),At.style.setProperty("--grid-x",`${s}px`),At.style.setProperty("--grid-w",`${o}px`),At.style.setProperty("--grid-gap",`${e}px`)},fe=()=>{let t=ne(),e=ft.querySelector("span");if(ft.querySelector("button").hidden=!t||M,t){let s=document.documentElement.clientWidth,o=Math.max(0,Math.min(t.max??1/0,s-2*t.margin));Fe(t.cols,t.gutter,(s-o)/2,o),e.textContent="Project grid \xB7";return}it.children.length!==n.grid.columns&&(it.innerHTML='<div class="dt-overlay-col"></div>'.repeat(n.grid.columns)),zt=me(),zt.from!=="site"&&Fe(zt.cols,zt.gap,zt.x,zt.w),e.textContent=zt.from==="guess"?`Guessed \xB7 ${zt.cols} \xD7 ${zt.w}`:`From the page \xB7 ${zt.cols} \xD7 ${zt.w} \xB7 gap ${zt.gap}`},C=()=>{ft.classList.remove("is-lifted");let t=ft.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();ft.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},yt=t=>{At.hidden=!t,t&&(fe(),C()),_t.setAttribute("aria-pressed",String(t)),z(Dt,t?"1":"0"),Ue({grid:t})};_t.addEventListener("click",()=>yt(At.hidden===!0)),addEventListener("resize",()=>{At.hidden||(fe(),C())});let Rt=document.querySelector(".dt-pages-name"),Wt=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:I(t.location.pathname),title:t.document.title}:null}catch{return null}},x=()=>{let t=document.querySelector(".dt-pages-here"),e=document.querySelector('.dt-pages-list a[aria-current="page"] .dt-pages-n');t&&(t.innerHTML=e?.innerHTML??"",t.hidden=!e||e.hidden,t.title=e?.title??"")},E=()=>{let e=Wt()?.route??Tt,s=null;for(let l of document.querySelectorAll(".dt-pages a"))I(new URL(l.href).pathname)===e?(l.setAttribute("aria-current","page"),s=l):l.removeAttribute("aria-current");x();let r=(s?.querySelector(".dt-menu-label")?.textContent?.trim()||e).trim().split(/\s+/);Rt.textContent=e==="/"?"":e.replace(/^\//,""),Rt.closest("summary").toggleAttribute("data-home",e==="/")},N=(!!n.gridAdmin||!!n.arrange)&&!n.client,S=(n.folders??[]).filter(t=>t&&typeof t.name=="string"&&Array.isArray(t.pages)),nt=new Set((()=>{try{return JSON.parse(ct.getItem("dt-folders-open")||"[]")}catch{return[]}})()),G=new Set((()=>{try{return JSON.parse(ct.getItem("dt-folders-closed")||"[]")}catch{return[]}})()),vt=document.querySelector(".dt-pages-list"),be=()=>E(),Vt=t=>xt(t?'<path d="M2.5 15.5V5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H15A1.5 1.5 0 0 1 16.5 7v1.5M2.5 15.5l2.2-6A1.5 1.5 0 0 1 6.1 8.5h11.2l-2.5 7z" />':'<path d="M2.5 5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H16A1.5 1.5 0 0 1 17.5 7v7.5A1.5 1.5 0 0 1 16 16H4a1.5 1.5 0 0 1-1.5-1.5z" />',14),Ht=()=>{let t=new Map(n.pages.map(d=>[d.route,d])),e=new Set(S.flatMap(d=>d.pages)),s=d=>Gc(n,d,Tt,N),o=d=>S.filter(u=>(u.parent&&S.some(h=>h.id===u.parent)?u.parent:null)===d),a=d=>d.pages.includes(Tt)||o(d.id).some(a),r=(d,u)=>s(d).replace("<li",`<li style="--d:${u}"`),l=(d,u)=>{let h=nt.has(d.id)||!G.has(d.id)&&a(d),$=d.pages.map(_=>t.get(_)).filter(_=>!!_),B=o(d.id);return`<li class="dt-folder" data-folder="${f(d.id)}" style="--d:${u}"${h?" data-open":""}${N?' draggable="true"':""}><div class="dt-folder-row" role="button" tabindex="0" aria-expanded="${h}">${Bo}${Vt(h)}<span class="dt-menu-label">${f(d.name)}</span><em class="dt-folder-n"></em>`+(N?`<button type="button" class="dt-folder-more" aria-label="Folder menu">${xt('<circle cx="5" cy="10" r="1" /><circle cx="10" cy="10" r="1" /><circle cx="15" cy="10" r="1" />',14)}</button>`:"")+`</div><ul${h?"":" hidden"}>${B.map(_=>l(_,u+1)).join("")}${$.map(_=>r(_,u+1)).join("")}${$.length||B.length?"":`<li class="dt-folder-empty" style="--d:${u+1}">Empty \u2014 drag pages here</li>`}</ul></li>`};vt.innerHTML=o(null).map(d=>l(d,0)).join("")+n.pages.filter(d=>!e.has(d.route)).map(d=>r(d,0)).join(""),document.querySelector(".dt-pages-foot").hidden=!N,be()};Ht();let k=document.querySelector(".dt-pages");k&&!k.querySelector("li")&&k.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let w=[...document.querySelectorAll(".devtools details, .dt-strip details")],H=!1,D=t=>ss(t,()=>{t.open=!1}),O=()=>{let t=w.filter(e=>e.open&&!e.hasAttribute("data-leaving"));for(let e of t)D(e);return t};for(let t of w)t.querySelector(":scope > summary")?.addEventListener("click",e=>{t.open&&t.hasAttribute("data-leaving")?(e.preventDefault(),Po(t)):t.open&&(e.preventDefault(),D(t))});document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=O();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{H=w.some(e=>e.open&&!e.contains(t.target))&&O().length>0},!0),addEventListener("blur",O);let wt=document.querySelector(".dt-pad-overlay"),Et="dt-inspect",st=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),tt=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-elsewhere",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),lt={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),contrast:document.querySelector(".dt-contrast-btn"),border:document.querySelector(".dt-border-btn")},ht="",Ct=0,{spacer:$e,drawPads:je,drawSize:ke,drawType:Gt,drawColor:he,drawBorder:He,drawContrast:ye,contrastFix:_e,markCopied:Ms}=nu(wt),qn=null,P=()=>{qn&&ht&&F(qn)},F=t=>{qn=t,!Ct&&(Ct=requestAnimationFrame(()=>{Ct=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(st)){wt.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),ht==="sizes"?ke(e):ht==="type"?Gt(e):ht==="color"?he(e):ht==="contrast"?ye(e):ht==="border"?He(e):je(t.altKey?e:$e(e))}))},U=t=>{ht=t;for(let[e,s]of Object.entries(lt))s.setAttribute("aria-pressed",String(e===t));z(Et,t),Ue({inspect:t}),wt.hidden=!t,wt.innerHTML="",t?(document.addEventListener("mousemove",F),addEventListener("scroll",P,!0),addEventListener("resize",P)):(document.removeEventListener("mousemove",F),removeEventListener("scroll",P,!0),removeEventListener("resize",P))};document.addEventListener("click",t=>{ht!=="contrast"||!_e()||t.target.closest?.(st)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(_e()).catch(()=>{}),Ms(),P())},!0);for(let[t,e]of Object.entries(lt))e.addEventListener("click",()=>{t!==ht&&sn(!1),U(ht===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Yt)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let s=o=>{M&&parent.postMessage({dt:!0,...o},location.origin)};ht?(U(""),s({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):At.hidden||(yt(!1),s({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let Pt=document.querySelector(".dt-notes-btn"),Ut=[...document.querySelectorAll(".dt-bp")],xe=document.querySelector(".dt-history-btn"),rt=document.querySelector(".dt-history"),ve=document.querySelector(".dt-elsewhere"),os=document.querySelector(".dt-studio-btn"),as=document.querySelector(".dt-devices"),is=document.querySelector(".dt-notes-hi"),Cu=is.querySelector(".dt-hi-box"),zr=is.querySelector(".dt-hi-tag"),Sn=document.querySelector(".dt-frame"),Xe=document.createElement("div");Xe.className="dt-spot",Xe.hidden=!0,Xe.setAttribute("aria-hidden","true"),document.body.append(Xe);let Nu=t=>{if(!t||!Yt){Xe.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;Xe.style.setProperty("--spot-x",`${e.left-s}px`),Xe.style.setProperty("--spot-y",`${e.top-s}px`),Xe.style.setProperty("--spot-w",`${e.width+s*2}px`),Xe.style.setProperty("--spot-h",`${e.height+s*2}px`),Xe.hidden&&(is.hidden=!0),Xe.hidden=!1},Ys=Sn.querySelector("iframe");Ys.addEventListener("load",E),new MutationObserver(E).observe(Sn,{attributes:!0,attributeFilter:["hidden"]});let Ua=document.querySelector(".dt-notes-count"),et=document.querySelector(".dt-notes-overlay"),Xs=".devtools, .dt-tab, .dt-strip, .dt-strip-tab, .dt-strip-grip, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Ya=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(Xs).forEach(Ya);let Vr="dt-notes",j=[],Yt=!1,Y=null,R=null,Xa=0,Re="",Bu=(t,e,s)=>{if(s>160&&s<innerHeight-120)return!1;let o=document.elementsFromPoint(e,s).find(a=>!In(a)&&a!==document.documentElement&&a!==document.body);if(!o||o===t||t.contains(o)||o.contains(t))return!1;for(let a=o;a&&a!==document.body;a=a.parentElement){let r=getComputedStyle(a).position;if(r==="fixed"||r==="sticky")return!a.contains(t)}return!1},Gr=new WeakSet,jo=null,_o=null,We={},Wo=" \xB7 hidden \u2014 inside something closed",zo=t=>{t.toggleAttribute("data-up",t.scrollTop>2),t.toggleAttribute("data-more",t.scrollTop+t.clientHeight<t.scrollHeight-2)};et.addEventListener("scroll",t=>{let e=t.target;e.classList?.contains("dt-note-thread")&&zo(e)},!0),et.addEventListener("load",t=>{let e=t.target.closest?.(".dt-note-thread");e&&zo(e)},!0),et.addEventListener("scroll",t=>{let e=t.target;if(!e.classList?.contains("dt-note-thread")||e.scrollTop+e.clientHeight<e.scrollHeight-4)return;let s=e.parentElement?.querySelector(".dt-new-below");s&&(delete We[s.dataset.id],s.remove())},!0);let Le=[],te=null,ze=[],Ru=10,Js=(t=R)=>!!(t&&((t.text?.trim().length??0)>=Ru||t.images?.length)),rn=()=>{R&&Js()&&ze.push(R),R=null},Kr=0,Zs=()=>{if(!Js()||performance.now()-Kr<4e3)return!0;Kr=performance.now();let t=et.querySelector(".dt-note[data-draft]");return t&&Io(t,"no"),t?.querySelector(".dt-note-input")?.focus(),Kt("Not sent \u2014 close again to keep it as a draft",2400),!1},bn=null,Ja=new Map,Za=null,Ur=()=>`dt-draft:${n.me?.email??""}:${Tt}${M?":canvas":""}`,Tn=Ur(),Vo=0,Qs=()=>{if(!R&&!ze.length&&!Re){ct.removeItem(Tn);return}let t={draft:R,parked:ze,reply:Re?{for:bn,text:Re}:null};try{localStorage.setItem(Tn,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(Tn,JSON.stringify({...t,draft:R&&e(R),parked:ze.map(e)}))}catch{}}},rs=()=>{clearTimeout(Vo),Vo=setTimeout(Qs,200)};addEventListener("pagehide",()=>{clearTimeout(Vo),Qs();try{sessionStorage.setItem(`nm-open:${Tn}`,Y==null?"":String(Y))}catch{}});let Ve=ct.getItem("dt-space")==="clients"?"clients":"studio",Je=()=>!!n.me&&!n.client,An=t=>!Je()||Ve==="clients"===It(t),Yr=["all","nobody","mine","others","resolved","claude","wrote","check"],Hn=Yr.find(t=>t===ct.getItem("dt-pinf"))??"all",Qa=()=>{},Go=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Ze=ct.getItem("dt-resolved")!=="0",yn=ct.getItem("dt-archived")==="1",Se=t=>jc(t,n.autoArchive),Ko=t=>Se(t)?yn:Bt(t)!=="done"||Ze,se={q:"",menu:!1,more:!1,view:["me","agent"].includes(ct.getItem("dt-view")??"")?ct.getItem("dt-view"):"all",sort:["old","reply","unread"].includes(ct.getItem("dt-sort")??"")?ct.getItem("dt-sort"):"new"},Dn=null,Uo=t=>bt.find(e=>e.from?.id===t.id&&Gs(e)),ti=t=>Gs(t)?bt.find(e=>e.id===t.from.id&&It(e)):void 0,Pe=null,Yo=null,Xo=()=>Je()&&Ve==="clients",ks=t=>Xo()&&It(t)&&Bt(t)==="open"&&!Uo(t),Jo='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="2.5"/><path d="M10 3.5v13"/></svg>',Pu=t=>{let e=n.client?void 0:ti(t);if(!e)return"";let s=Ic(e);return`<button type="button" class="dt-field dt-field--bare dt-field--client" data-act="open-orig" data-id="${e.id}" data-tip="What the client sees now \u2014 open their thread" aria-label="The client sees: ${f(s)}. Open their thread"><span class="dt-field-box"><svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true">${Pr.clients}</svg><span class="dt-field-label">Client \xB7 ${f(s)}</span><svg class="dt-field-ext" viewBox="0 0 24 24" width="11" height="11" aria-hidden="true"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg></span></button>`},Iu=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Ou=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],qu=()=>{let t=navigator.userAgent,e=r=>r.find(([l])=>l.test(t)),s=e(Iu),o=e(Ou),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},ei=()=>A(innerWidth,innerHeight),Xt=()=>Za??ei(),Xr=()=>{let t=Xt();for(let e of Ut)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:ni,poolOf:si,contextOf:oi,resolveEl:Du,anchorOf:Fu,anchorState:ju,fingerprintOf:Zo}=au(),Ls=new Map,Qo=()=>{Ls=new Map},Jr=t=>JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth,t.fp]),Qe=t=>{let e=Jr(t),s=Ls.get(e);return(s===void 0||s.el&&!s.el.isConnected)&&(s={el:Du(t),st:ju(t)},Ls.set(e,s)),s.el},ai=t=>(Qe(t),Ls.get(Jr(t))?.st??"found"),to=0,eo=null,ta="",Zr=()=>{to=Math.max(to,scrollY+innerHeight)},Qr=(t,e)=>e==="gone"&&(Zr(),to<document.documentElement.scrollHeight-1&&(!t.spot||t.spot.y>to));addEventListener("scroll",()=>{Zr(),eo!=null&&to>=eo-1&&(eo=null,setTimeout(()=>{Qo(),J(),Tm()},600))},{capture:!0,passive:!0});let _u=t=>{let e=ai(t);return(Qr(t,e)?"later":e)+(Ce(t)?"":" \xB7 no pin")},ii=null,tl=t=>{ii=t.id??null,scrollTo({top:t.spot?Math.max(0,t.spot.y-innerHeight/2):document.documentElement.scrollHeight,behavior:"smooth"})},ri=[];document.addEventListener("pointerdown",t=>{let e=t.target;e instanceof Element&&!In(e)&&!e.closest(".devtools")&&(ri=[ri.at(-1),{el:e,t:Date.now()}].filter(Boolean))},!0);let Wu='[role=menu],[role=listbox],[role=dialog],[role=tooltip],dialog,[popover],[aria-modal],[data-state="open"],[data-radix-popper-content-wrapper],details[open]>:not(summary)',zu=t=>{let e=[...ri].reverse().find(l=>!t.contains(l.el)&&!l.el.contains(t));if(!e||Date.now()-e.t>6e5)return null;let s=e.el.closest("button,a,[role=button],summary,[aria-haspopup],[aria-expanded],[aria-controls]");if(!s||!s.isConnected||s.contains(t)||t.contains(s)||In(s))return null;let o=t.closest(Wu);if(o?.contains(s)||!o&&s.getAttribute("aria-expanded")!=="true"&&!s.matches("summary,[aria-haspopup]"))return null;let a=s.tagName.toLowerCase(),r=[...s.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ni(s),tag:a,classes:r,nth:si({tag:a,classes:r}).indexOf(s),label:Zt(ae(s.textContent||""),60),ctx:oi(s),fp:Zo(s),rx:.5,ry:.5}},ea=new Map,Ce=t=>{ea.size||requestAnimationFrame(()=>ea.clear());let e=ea.get(t);return e===void 0&&(e=Fu(t,Qe(t)),ea.set(t,e)),e},el=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},na=[],li=t=>{for(let e of na)e.play();na=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),na.push(s))},di=()=>{if(R)return Qe(R);let t=Y!=null?j.find(s=>s.id===Y):null;if(!t)return null;let e=Ce(t);return e&&!e.hidden?Qe(t):null},nl="claude",Vu=()=>(n.client||Ve==="clients"?n.team??[]:da()).filter(t=>!Tr(t.email)),Gu=()=>Vu().filter(t=>t.email!==n.me?.email),no=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...Gu()],sl='<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>',ci=(t,e)=>{let s=e==="agent"?nl:e==="me"?n.me?.email??"":"";if(!t){if(!R)return;R.assignee=s,R.stage=Jt(s)?"approved":!R.stage||R.stage==="approved"?"new":R.stage,so(s),R.carried=!1,rs(),J();return}sa(t,s)},sa=(t,e)=>{let s=j.find(r=>r.id===t);if(s&&hn(s)&&!Jt(e)&&!confirm("The agent is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?qe(s):"new",a=Jt(e)?"approved":o==="approved"?"new":o;dn(r=>r.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>Q({id:t,assignee:e||null,stage:a}),Jt(e)?"Approving it for the agent":"Reassigning")},Ku=(t,e)=>{if(e&&ct.setItem("nm-for",e),!t){if(!R)return;R.assignee=e,R.stage==="approved"&&(R.stage="new"),so(e),R.carried=!1,rs(),J();return}sa(t,e)},Uu='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9M15.5 4v3.5H12" stroke-linecap="round" stroke-linejoin="round"/></svg>',so=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e&&!Jt(e)&&no().some(s=>s.email===e)?e:null}catch{return null}},ol=t=>Jt(t)?"#d97757":t?"#0d99ff":"#717171",vn=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],ln=t=>t?n.team?.find(e=>e.email===t):void 0,oa=t=>{let e=ae(t??"").split(/\s+/).filter(Boolean);return f(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},Fn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${f(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${oa(e)}</b>`,ui=t=>{let e=ln(t.by);return e||t.byName?Fn(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},Ie=t=>`var(--dt-avatar-${ln(t)?.avatar_hue??[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,wn=(t,e)=>{let s=ln(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return Fn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${Ie(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},al=()=>n.me?`${wn(n.me.email.toLowerCase(),{by:n.me.email,byName:n.me.name})}<i class="dt-pin-cut" aria-hidden="true">${es}</i>`:es,ls=new Map,pi=new Map,il=0,Yu=(t,e)=>{let s=e==="found"?null:e;n.client||M||t.id<=0||(t.anchor??null)===s||ls.get(t.id)===s||(ls.set(t.id,s),pi.set(t.id,s),clearTimeout(il),il=window.setTimeout(()=>{for(let[o,a]of pi){let r=j.find(d=>d.id===o),l=r?ai(r):"found";if(!r||(l==="found"?null:l)!==a){ls.delete(o);continue}Q({id:o,anchor:a}).then(d=>{if(d.ok){let u=j.find(h=>h.id===o);u&&(u.anchor=a)}}).catch(()=>ls.delete(o))}pi.clear()},4e3))},Xu=t=>{let e=!!Qe(t)?.getClientRects().length;return`<div class="dt-note-hidden dt-note-away"><b>${ao}<span>${e?"Scrolled out of view":"Hidden right now"}</span></b>${e?`<button type="button" data-act="show-el" data-id="${t.id}">Show it</button>`:""}</div>`},Ju=(t,e,s,o)=>{let a=(d,u,h=!1)=>`<button type="button" class="dt-lost-btn${h?" is-main":""}" data-act="${d}" data-id="${t.id}">${u}</button>`,r=(d,u,h)=>`<button type="button" class="dt-lost-btn dt-lost-ico" data-act="${d}" data-id="${t.id}" data-tip="${h}" aria-label="${h}">${u}</button>`,l=!n.client;if(o&&s==="later")return`<div class="dt-note-hidden dt-note-away"><b>${ao}<span>Further down the page</span></b><button type="button" data-act="go-spot" data-id="${t.id}">Show it</button></div>`;if(o&&s==="gone"){let d=xc(t).before,u=Bt(t)!=="open";return`<div class="dt-lost dt-lost--gone"><p>${u?"Not on the page now. The thread stays: answer or reopen it here.":d?"Not on the page now \u2014 here is how it looked. Pin it to something else, or close the thread.":"Not on the page now. Pin it to something else, or close the thread."}</p>${d?`<img class="dt-lost-shot" src="${f(wr(d.split("/").pop()))}" alt="How the element looked" loading="lazy">`:""}${u?"":`<span class="dt-lost-acts">${Is(t)?a("repin","Re-pin",!0):""}${r("lost-resolve",Me,"Resolve")}${l?r("archive",Ln,"Archive"):""}</span>`}</div>`}return e?.opener?`<div class="dt-note-hidden dt-note-away"><b>${ao}<span>In ${f(vo(e.opener))} \u2014 closed</span></b><button type="button" data-act="open-it" data-id="${t.id}">Show it</button></div>`:""},mi=(t,e)=>ln(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],aa={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},jn=(()=>{try{return JSON.parse(ct.getItem("dt-seen")||"{}")}catch{return{}}})(),hi=()=>z("dt-seen",JSON.stringify(jn)),rl=t=>{let e=an(t);if(!(t.id in jn))return jn[t.id]=e.length,hi(),!1;let s=e[e.length-1];return e.length>jn[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},ll=t=>{let e=an(t).length;jn[t.id]!==e&&(jn[t.id]=e,hi())},Zu=t=>{let e=ln(t);return e?` data-face="${f(e.avatar_url??"")}" data-initial="${oa(e.name||e.email)}"`:""},Qu=t=>n.client||It(t)||Bt(t)==="done"?"":pl(t,t.assignee??"",t.id),tp=t=>{let e=Bt(t)==="done";return`<button type="button" class="dt-hist-tick" data-act="${e?"reopen":"done"}" data-id="${t.id}" data-tip="${e?"Reopen":Bt(t)==="claude"?"Looks right \u2014 resolve":"Resolve"}" aria-label="${e?"Reopen":"Resolve"}">${e?gn:Me}</button>`},ep=t=>{let e=(t.replies??[]).filter(a=>!a.deleted);if(!e.length)return"";let s=[...new Set(e.map(a=>a.author==="claude"?"@agent":(a.by||"you").toLowerCase()))];return`<span class="dt-hist-replied"><span class="dt-hist-faces">${s.slice(0,3).map(a=>a==="@agent"?`<span class="dt-hist-face is-agent">${De(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Ie(a)}">${wn(a,t)}</span>`).join("")}${s.length>3?`<i>+${s.length-3}</i>`:""}</span>${e.length} ${e.length===1?"reply":"replies"}</span>`},np=t=>{if(Dn!==t.id)return"";let e=(l,d,u,h="")=>`<button type="button" role="menuitem" ${l} class="${h}"><i>${d}</i><span>${u}</span></button>`,s='<svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><circle cx="10" cy="10" r="2" fill="currentColor" stroke="none"/></svg>',o='<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="3"/><path d="m7 10.2 2.2 2.2L13.2 8"/></svg>',a=Se(t),r=!n.client;return`<div class="dt-hist-menu is-row" role="menu">${r&&!It(t)?`<div class="dt-hist-assign"><span>Assign</span>${ul(t.assignee??"",t.id)}</div><hr>`:""}${e(`data-row-unread="${t.id}"`,s,"Mark as unread")}${e(`data-row-link="${t.id}"`,wi,"Copy link")}${Xo()?e(`data-row-select="${t.id}"`,o,"Select")+(ks(t)?e(`data-row-mirror="${t.id}"`,Jo,"Mirror to Team"):""):""}${r&&Je()&&!t.client?e(`data-row-move="${t.id}"`,vi,It(t)?"Move to Team":"Move to Client"):""}${r||!As(t)?"<hr>":""}${r?e(`data-act="${a?"unarchive":"archive"}" data-id="${t.id}"`,a?gn:Ln,a?"Unarchive":"Archive"):""}${As(t)?"":e(`data-rm="${t.id}"`,ts,"Delete thread","is-danger")}</div>`},dl={queued:"#0d99ff",working:"#f5a623",asks:"#e93d82",stuck:"#e5402c",review:"#8e4ec6"};uu(t=>{if(t.matches(".dt-hist-go[data-go]")){let $=j.find(Ot=>Ot.id===Number(t.dataset.go)),B=$&&[...$.replies??[]].reverse().find(Ot=>!Ot.deleted);if(!$||!B)return null;let _=B.author==="claude",p=(B.by||"you").toLowerCase(),V=_?Nn($):B.by?B.by===n.me?.email?"You":vn(B.by):"You",Z=_?`<span class="dt-hist-face is-agent">${De(11)}</span>`:`<span class="dt-hist-face" style="--hue:${Ie(p)}">${wn(p,$)}</span>`,qt=(B.images?.length?'<span class="dt-peek-chip">Picture</span>':"")+(B.files?.length?'<span class="dt-peek-chip">File</span>':"")+(B.audio?'<span class="dt-peek-chip">Voice note</span>':"");return`<span class="dt-peek-head"><span class="dt-peek-people">${Z}</span><b>${f(V)}</b>${_?`<em>${f(kr(B.agent)||"")}</em>`:""}${B.editedAt?"<em>edited</em>":""}<em>${Qn(B.at)}</em></span>`+(B.text?`<span class="dt-peek-text is-reply">${f(Zt(B.text,320))}</span>`:"")+(qt?`<span class="dt-peek-files">${qt}</span>`:"")}if(Y!=null||!t.matches(".dt-pin[data-id]"))return null;let e=j.find($=>$.id===Number(t.dataset.id));if(!e)return null;let s=[...new Set([e.by,...(e.replies??[]).filter($=>$.author!=="claude").map($=>$.by)].filter(Boolean).map($=>$.toLowerCase()))].slice(0,3),o=Bt(e),a=n.client||It(e)||o==="done"?null:Ee(e),r=a&&dl[a]&&(Jt(e.assignee)||a==="review")?a:null,l=_n.find($=>$[0]===ds(e)),[d,u]=o==="done"?Se(e)?["#717171","Archived"]:["#30a46c","Resolved"]:r?[dl[r],`${Nn(e)}${gi(e)}`]:[l[2],l[1]],h=e.replies?.length??0;return`<span class="dt-peek-head">${s.length?`<span class="dt-peek-people">${s.map($=>`<span class="dt-hist-face" style="--hue:${Ie($)}">${wn($,e)}</span>`).join("")}</span>`:""}<b>${f(e.byName||"You")}</b><em>\xB7 ${Qn(e.createdAt)}</em></span><span class="dt-peek-text">${f(Zt(e.text,240))}</span><span class="dt-peek-foot">${Ye(d,o==="done"?1:0)}<span>${f(u)}${h?` \xB7 ${h} ${h===1?"reply":"replies"}`:""}</span></span>`});let gi=t=>{let e=Ee(t),s=Hr(t);return e==="working"?s?.step?` \xB7 ${Ar(s.step)} \xB7 ${s.elapsed}`:" is working":e==="stuck"?` went quiet \xB7 ${s?.silent??""}${s?.step?` \xB7 last: ${s.step}`:""}`:e==="queued"?" \xB7 queued \xB7 next run":e==="asks"?" asks you \xB7 answer in the thread":e==="review"?" fixed it \xB7 to check":""},sp=t=>{let e=ln(t);return e?Fn(e.avatar_url,e.name||e.email):""},cl=(t,e,s={})=>`<option value="${f(t)}"${s.dot?` data-c="${ol(t)}"`:""}${Zu(t||null)}${s.selected?" selected":""}>${f(e)}</option>`,ul=(t,e,s=!1)=>{let o=Jt(t),a=o?"":t,r=ln(a),l=r?r.avatar_url?`<img class="dt-owner-face" src="${f(r.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${Ie(a.toLowerCase())}" aria-hidden="true">${oa(r.name||r.email)}</b>`:a?bl:sl,d=a?r?.name||vn(a):"Anyone",u=B=>{let _=ln(B);return _?.avatar_url?`<img class="dt-menu-face" src="${f(_.avatar_url)}" alt="">`:`<b class="dt-menu-face" style="--hue:${Ie(B.toLowerCase())}">${[...oa(_?.name||B)][0]}</b>`},h=(B,_,p="")=>`<option value="${f(B)}" data-icon="${f(B?u(B):sl)}"${p?` data-hint="${f(p)}"`:""}${B===a?" selected":""}${B?"":" data-sep-after"}>${f(_)}</option>`,$=no();return`<label class="dt-owner${r?" has-face":""}${s?" is-compact":""}" data-tip="${o?"The agent has it \u2014 pick a person to hand it over":s?f(d):"Who takes it"}">${l}${s?"":`<span class="dt-owner-name">${f(d)}</span>`}${ia}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
262
- ${h("","Anyone")}${$.map(B=>h(B.email,B.email===n.me?.email?`Me \xB7 ${B.name||B.email}`:B.name||B.email,B.email)).join("")}${a&&!$.some(B=>B.email===a)?h(a,vn(a)):""}
263
- </select></label>`},op={queued:"queued",working:"working",asks:"asks you",stuck:"went quiet",review:"fixed it \u2014 to check",done:"done"},pl=(t,e,s,o=!1)=>{let a=t?Ee(t):Jt(e)?"queued":null,r=!!a&&(Jt(e)||a==="review"),l=o?"The agent does not work in the clients\u2019 space":r?"Take it back":"Give to the agent",d=r?`With the agent \u2014 ${op[a]??"queued"}. Take it back`:l;return`<button type="button" class="dt-claude-btn${r?" is-on":""}" data-act="claude"${s?` data-id="${s}"`:""}${r?` data-step="${a}" style="--step-c:${aa[a]??aa.queued}"`:""} aria-pressed="${r}" data-tip="${f(l)}" aria-label="${f(d)}"${o?" disabled":""}>${De(13)}</button>`},ml=t=>{if(!t){if(!R)return;ci(0,Jt(R.assignee)?"nobody":"agent");return}let e=j.find(o=>o.id===t);if(!e)return;let s=Ee(e);sa(t,Jt(e.assignee)||s==="review"?"":nl)},ap=t=>`<div class="dt-suggest dt-suggest--read"><del>${f(t.from)}</del><ins>${f(t.to)}</ins></div>`,hl=(t,e)=>{let s=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return f([s,ae(e??"")&&`\u201C${Zt(ae(e),80)}\u201D`].filter(Boolean).join(" \xB7 "))},ia='<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>',fi=(t,e,s=!1)=>{let o=Ks(t),a=r=>Xc(r).replace("<svg ",`<svg style="stroke:${r.color}" `);return s?`<span class="dt-field dt-field--bare dt-field--type"><span class="dt-field-box">${a(o)}<span class="dt-field-label">${f(o.label)}</span></span></span>`:`<label class="dt-field dt-field--bare dt-field--type" data-tip="Type: ${f(o.label)}"><span class="dt-field-box">${a(o)}<span class="dt-field-label">${f(o.label)}</span>${ia}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${g.map(r=>`<option value="${r.id}" data-c="${r.color}" data-icon="${f(a(r))}"${r.id===t?" selected":""}>${r.label}</option>`).join("")}</select></span></label>`},_n=[["new","New","#0d99ff",0],["progress","In progress","#f5a623",.25],["review","To check","#8e4ec6",.5],["waiting","Waiting","#e93d82",.75]],ds=t=>hn(t)||qe(t)==="progress"?"progress":qe(t)==="review"?"review":qe(t)==="waiting"?"waiting":"new",gl=(t,e)=>{if(e==="all")return!0;let s=Bt(t),o=Co(t,s),a=(n.me?.email??"").toLowerCase();return e==="nobody"?s!=="done"&&!!o&&!o.taker:e==="mine"?!!o&&o.taker===a:e==="others"?!!o&&!!o.taker&&o.taker!==a:e==="resolved"?s==="done":e==="claude"?!!o?.claude&&o.taker===a:e==="wrote"?!t.by||t.by.toLowerCase()===a:s==="claude"||s==="open"&&(Ee(t)==="review"||ds(t)==="review")},ra={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",done:"done"},Wn=[..._n,["done","Resolved","#30a46c",1]],ip=t=>{let e=Ee(t);return t.status==="done"&&e!=="review"?"done":e&&ra[e]?ra[e]:ds(t)},rp=t=>{let e=Ee(t),s=ip(t),[,,o,a]=Wn.find(l=>l[0]===s),r=!n.client&&ti(t)?l=>` data-note="${f(To[l])}"`:()=>"";return`<label class="dt-field" data-tip="${e&&ra[e]?"Follows the agent":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Ye(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${r("new")?'<option disabled data-head data-note="The client sees">Status</option>':""}${Wn.map(([l,d,u,h])=>`<option value="${l}" data-c="${u}" data-icon="${f(Ye(u,h))}"${r(l)}${l===s?" selected":""}>${d}</option>`).join("")}${n.client?"":`<option value="${Se(t)?"unarchive":"archive"}" data-sep data-icon="${f(Ln)}">${Se(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},la=(t,e,s)=>`<p class="dt-note-event"><span>${t}<b>${f(e)}</b>${s?`<time>${Br(s,Qn)}</time>`:""}</span></p>`,Ss=new Map,lp=(t,e,s=1/0)=>{let{reopenedAt:o,reopenedBy:a,movedAt:r,movedBy:l,movedFrom:d,repinnedAt:u,repinnedBy:h,repinnedFrom:$}=t,B=an(t),_=gt=>{let kt=Date.parse(gt),Nt=B.findIndex((Te,re)=>re>0&&!!Te.at&&Date.parse(Te.at)>kt);return Nt<0?B.length:Nt},p=gt=>gt?gt==="you"||gt===n.me?.email?"you":gt==="claude"?"the agent":vn(gt):"",V=[],Z=dp(t);if(Z&&V.push([Z.at?_(Z.at):0,la(Z.icon,Z.words,Z.time)]),r&&d&&V.push([_(r),la(bi,`Moved from ${d}${l?` by ${p(l)}`:""}`,r)]),u&&V.push([_(u),la(bi,`Re-pinned${h?` by ${p(h)}`:""}${$?` from ${$}`:""}`,u)]),o&&t.status!=="done"){let gt=p(a);V.push([_(o),la(gn,gt?`Reopened by ${gt}`:"Reopened",o)])}let qt=e.map(()=>!0);for(let[gt,kt]of V.sort((Nt,Te)=>Te[0]-Nt[0]))e.splice(gt,0,kt),qt.splice(gt,0,!1);let Ot=qt.flatMap((gt,kt)=>gt?[kt]:[]),ie=Ot.length-1-s;if(ie<2)return e.join("");let St=[...new Set(an(t).slice(1,1+ie).map(gt=>gt.author==="claude"?"@agent":(gt.by||n.me?.email||"you").toLowerCase()))].slice(0,3).map(gt=>gt==="@agent"?`<span class="dt-hist-face is-agent">${De(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Ie(gt)}">${wn(gt,t)}</span>`).join("");return[...e.slice(0,Ot[1]),`<button type="button" class="dt-note-fold" data-act="unfold" data-id="${t.id}"><span class="dt-hist-faces">${St}</span>${ie} more replies</button>`,...e.slice(Ot[Ot.length-s])].join("")},dp=t=>{let e=t.from;if(e){if(Gs(t))return{icon:Jo,words:Pc(t.mirroredBy?t.mirroredBy===n.me?.email?"you":(t.mirroredByName||vn(t.mirroredBy)).split(" ")[0]:""),at:null,time:t.createdAt};let o=bt.find(a=>a.id===e.id);return{icon:yi,words:Bc(t,o,o?.by?vn(o.by):""),at:null,time:t.createdAt}}if(n.client)return null;let s=bt.find(o=>o.from?.id===t.id);return s?{icon:Gs(s)?Jo:yi,words:Rc(s),at:s.createdAt??null,time:s.createdAt}:null},cp=(t,e)=>{let s=j.find(l=>l.id===t);if(!s)return;if(e==="done"){tn(t,!0);return}if(e==="archive"||e==="unarchive"){us(t,e==="archive");return}if(Jt(s.assignee)&&!It(s)){s.status==="done"?tn(t,!1):(Kt("Still with the agent \u2014 its step is the status; the agent button takes it back.",6e3),J());return}let a=e==="new"&&Jt(s.assignee)?"approved":e,r=s.status==="done"?{status:"open",doneBy:null}:{};dn(l=>l.map(d=>d.id===t?{...d,...r,stage:a}:d),()=>Q({id:t,...r,stage:a}),"Setting the status")},oo=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],up=(t,e)=>{let s=Math.max(0,oo.findIndex(d=>d[0]===t)),[,o,a,r]=oo[s],l=oo[(s+1)%oo.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}">${iu(r,a)}<span>${o}</span></button>`},fl=(t,e,s,o,a=!1,r=!1,l=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${n.client?"":up(t,s)}${l?"":fi(Ks(e).id,s,a)}</span>${n.client?"":`<span class="dt-who">${r?"":ul(o,s)}${pl(s?j.find(d=>d.id===s):void 0,o,s,r)}</span>`}</div>`,ao='<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>',pp=t=>{let e=ae(t?.querySelector("h1, h2, h3, h4, h5, h6")?.textContent??t?.innerText?.split(`
264
- `).find(s=>ae(s))??"");return e?e.length>30?`${Zt(e,30)}\u2026`:e:t?.tagName.toLowerCase()??""},bl='<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>',yl='<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>',bi='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5 4.5v5a3 3 0 0 0 3 3h7.5M12.5 9.5l3 3-3 3" stroke-linejoin="round"/></svg>',yi='<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>',vi='<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>',wi='<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>',vl=t=>{let e=(a,r,l,d="")=>`<option value="${a}" data-icon="${f(r)}"${d}>${l}</option>`,s=t&&Je()?It(t)?(Uo(t)?"":e("mirror",Jo,"Mirror to Team"))+(t.client?"":e("move",vi,"Move to Team")):e("dup",yi,"Duplicate for the client")+e("move",vi,"Move to Client"):"",o=t&&n.client&&t.status==="done"?e("reopen",gn,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${yl}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
261
+ <button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Pn}</button>`,tt.hidden=!1};tt.addEventListener("click",async at=>{let vt=at.target.closest("[data-r]"),It=dt();if(!vt||!It)return;if(vt.dataset.r==="stop"){J(null),tt.hidden=!0;return}if(vt.dataset.r==="prev"){St();return}let qt=It.ids[It.i];J({...It,i:It.i+1});let Lt=c().find(fe=>fe.id===qt),pe=vt.dataset.r==="ok"&&Lt?A(Lt):vt.dataset.r==="no"?y(qt,!1):null;Wt(),await pe});let St=()=>{let at=dt();if(at){for(let vt=at.i-1;vt>=0;vt--)if(k(at.ids[vt])){J({...at,i:vt}),Wt();return}}};return document.addEventListener("keydown",at=>{tt.hidden||at.metaKey||at.ctrlKey||at.altKey||at.key!=="ArrowLeft"&&at.key!=="ArrowRight"||at.target.closest?.("input, textarea, select, [contenteditable]")||(at.preventDefault(),at.key==="ArrowLeft"?St():tt.querySelector('[data-r="skip"]')?.click())}),{start:xt,toCheck:F,resume:()=>{dt()&&Wt()}}}function $u(n,i){let c=null,h=null,g=document.querySelector(".dt-turbo"),y="/notemend:turbo",S=()=>{let C=!!c&&Date.now()-Date.parse(c.at)<18e4,w=C?c.mode==="push"?"push":h?.paused?"paused":"on":"none",A=C?Zn(c.agent):"",k=w==="none"?`Turbo is off. Run ${y} in Claude Code and threads for the agent are taken as they land \u2014 click to copy it`:w==="push"?`Push mode: ${A} takes threads when you press Push to the agent. For live, run ${y} instead`:w==="on"?`Turbo on: ${A} takes threads for the agent as they land \u2014 click to pause`:`Turbo paused: ${A} is listening but waits \u2014 click to resume`;g.dataset.state=w,g.dataset.tip=k,g.setAttribute("aria-label",k),g.setAttribute("aria-checked",String(w==="on")),n&&(g.hidden=!0)};return setInterval(S,3e4),g.addEventListener("click",async()=>{let C=g.dataset.state;if(C==="none"||C==="push"){await navigator.clipboard?.writeText(y).catch(()=>{}),i(`Copied ${y} \u2014 paste it in Claude Code`);return}let w=C==="on"?"off":"on";h={paused:w==="off"},S();try{let A=await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:w})});if(!A.ok)throw new Error(String(A.status));i(w==="off"?"Turbo paused":"Turbo on")}catch{h={paused:w==="on"},S(),i("Could not switch turbo \u2014 try again")}}),C=>{c=C.listening??null,h=C.turbo??null,S()}}var Mh=new Set(["data-wired","data-nudge"]),kh=".dt-note",xu=n=>n instanceof Element&&n.hasAttribute("data-ghost"),Fo=n=>{if(!(n instanceof Element))return null;let i=n.dataset;return i.msg?`m:${i.msg}`:i.id?`${n.tagName}:${n.classList[0]??""}:${i.id}`:"draft"in i?`${n.tagName}:draft`:i.parked?`${n.tagName}:parked:${i.parked}`:i.k?`${n.tagName}:k:${i.k}`:null},Eu=(n,i)=>n.nodeType===i.nodeType&&n.nodeName===i.nodeName&&Fo(n)===Fo(i);function Lh(n,i){for(let{name:c}of[...n.attributes])!i.hasAttribute(c)&&!Mh.has(c)&&n.removeAttribute(c);for(let{name:c,value:h}of i.attributes)n.getAttribute(c)!==h&&n.setAttribute(c,h);n instanceof HTMLInputElement&&i instanceof HTMLInputElement&&(n.checked!==i.checked&&(n.checked=i.checked),n!==document.activeElement&&n.value!==i.value&&(n.value=i.value))}function Mu(n,i){let c=[...n.childNodes].filter(w=>!xu(w)),h=new Map;for(let w of c){let A=Fo(w);A&&h.set(A,w)}let g=new Set,y=0,S=[];for(let w of[...i.childNodes]){let A=Fo(w),k=A?h.get(A):void 0;if(!A){for(;y<c.length&&(g.has(c[y])||Fo(c[y]));)y++;y<c.length&&Eu(c[y],w)&&(k=c[y++])}k&&!g.has(k)&&Eu(k,w)?(g.add(k),Sh(k,w),S.push(k)):S.push(w)}for(let w of c)g.has(w)||(w instanceof HTMLElement&&w.matches(kh)&&du(w),n.removeChild(w));let C=n.firstChild;for(let w of S){for(;C&&xu(C);)C=C.nextSibling;if(w===C){C=C.nextSibling;continue}n.insertBefore(w,C)}}function Sh(n,i){if(n.nodeType===Node.TEXT_NODE||n.nodeType===Node.COMMENT_NODE){n.nodeValue!==i.nodeValue&&(n.nodeValue=i.nodeValue);return}if(!(!(n instanceof Element)||!(i instanceof Element))){if(Lh(n,i),n instanceof HTMLTextAreaElement){n!==document.activeElement&&n.value!==i.value&&(n.value=i.value);return}if(n instanceof SVGElement){n.innerHTML!==i.innerHTML&&(n.innerHTML=i.innerHTML);return}Mu(n,i),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==i.value&&(n.value=i.value)}}function Fr(n,i){let c=document.createElement("template");c.innerHTML=i,Mu(n,c.content)}function ku(n,i,c=!1){let h=n.breakpoints,g=n.categories,y=(h.find(t=>!Number.isFinite(t.max))??h[0]).id,S=t=>h.find(e=>t>=e.min&&t<=e.max)?.id??y,C=(t,e)=>{let s=S(t);if(Vs||!matchMedia("(pointer: coarse)").matches)return s;let o=[...h].sort((l,d)=>l.min-d.min),a=e<500?S(767):(o[o.length-2]??o[0]).id,r=l=>o.findIndex(d=>d.id===l);return r(s)>r(a)?a:s},w=t=>t.breakpoint||y,A=t=>n.devices.find(e=>e.id===t),k=Vs,z=(t,e)=>{k||ct.setItem(t,e)},dt=null,J=["stage","status","priority","assignee"],tt=t=>{let e=(dt??j).find(a=>a.id===t.id),s=J.filter(a=>a in t||(a==="stage"||a==="status")&&("stage"in t||"status"in t)),o=e&&s.length&&!t.reply?Object.fromEntries(s.map(a=>[a,e[a]??null])):void 0;return ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(o?{...t,seen:o}:t)})},F=t=>t.replace(/\/+$/,"")||"/",xt=F(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 Wt=document.querySelector(".dt-grid-btn"),St=document.querySelector(".dt-grid-overlay"),at=St.querySelector(".dt-overlay-grid"),vt=St.querySelector(".dt-grid-chip"),It="dt-grid",qt=n.projectGrid??null,Lt=()=>C(innerWidth,innerHeight),pe=()=>qt?.mode==="custom"?qt.widths?.[Lt()]??null:null,fe=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),Qt=t=>fe(t).length,me=()=>{let t=St.hidden;t&&(St.style.visibility="hidden",St.hidden=!1);try{return Ln()}finally{t&&(St.hidden=!0,St.style.visibility="")}},Ln=()=>{let t=document.documentElement.clientWidth;St.classList.remove("is-auto");let e=getComputedStyle(at);if(e.display==="grid"&&Qt(e)>1){let r=at.getBoundingClientRect();return{cols:Qt(e),gap:Math.round(parseFloat(e.columnGap)||0),x:Math.round(r.left),w:Math.round(r.width),from:"site"}}let s=null,o=null;for(let r of[...document.body.querySelectorAll("*")].slice(0,3e3)){if(r.closest(Xs)||St.contains(r))continue;let l=r.getBoundingClientRect();if(!l.width||!l.height)continue;let d=getComputedStyle(r);if(d.maxWidth!=="none"&&l.left>0&&Math.abs(l.left-(t-l.right))<=2&&l.width>(s?.w??0)){let u=parseFloat(d.paddingLeft)||0;s={x:l.left+u,w:l.width-u-(parseFloat(d.paddingRight)||0)}}if(l.width<=(o?.w??0))continue;let p=d.display.endsWith("grid")?fe(d):[];if(p.length>1){if(!p.every(b=>Math.abs(b-p[0])<2))continue;let u=parseFloat(d.columnGap)||0;o={cols:p.length,gap:u,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:p.reduce((b,T)=>b+T,0)+u*(p.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let u=[...r.children].map(T=>T.getBoundingClientRect()).filter(T=>T.width&&T.height),b=u.filter(T=>Math.abs(T.top-u[0].top)<2).sort((T,P)=>T.left-P.left);b.length>1&&b.every(T=>Math.abs(T.width-b[0].width)<2)&&(o={cols:b.length,gap:Math.max(0,b[1].left-b[0].right),x:b[0].left,w:b.at(-1).right-b[0].left})}}let a=r=>({...r,gap:Math.round(r.gap),x:Math.round(r.x),w:Math.round(r.w)});return a(o?{...o,...s??{},from:"page"}:{cols:n.grid.columns,gap:innerWidth<768?16:24,...s??{x:24,w:t-48},from:"guess"})},zt=null,Re=(t,e,s,o)=>{St.classList.add("is-auto"),at.children.length!==t&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),St.style.setProperty("--grid-x",`${s}px`),St.style.setProperty("--grid-w",`${o}px`),St.style.setProperty("--grid-gap",`${e}px`)},we=()=>{let t=pe(),e=vt.querySelector("span");if(vt.querySelector("button").hidden=!t||k,t){let s=document.documentElement.clientWidth,o=Math.max(0,Math.min(t.max??1/0,s-2*t.margin));Re(t.cols,t.gutter,(s-o)/2,o),e.textContent="Project grid \xB7";return}at.children.length!==n.grid.columns&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(n.grid.columns)),zt=me(),zt.from!=="site"&&Re(zt.cols,zt.gap,zt.x,zt.w),e.textContent=zt.from==="guess"?`Guessed \xB7 ${zt.cols} \xD7 ${zt.w}`:`From the page \xB7 ${zt.cols} \xD7 ${zt.w} \xB7 gap ${zt.gap}`},N=()=>{vt.classList.remove("is-lifted");let t=vt.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();vt.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},ft=t=>{St.hidden=!t,t&&(we(),N()),Wt.setAttribute("aria-pressed",String(t)),z(It,t?"1":"0"),Ue({grid:t})};Wt.addEventListener("click",()=>ft(St.hidden===!0)),addEventListener("resize",()=>{St.hidden||(we(),N())});let Rt=document.querySelector(".dt-pages-name"),jt=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:F(t.location.pathname),title:t.document.title}:null}catch{return null}},ne=()=>{let t=document.querySelector(".dt-pages-here"),e=document.querySelector('.dt-pages-list a[aria-current="page"] .dt-pages-n');t&&(t.innerHTML=e?.innerHTML??"",t.hidden=!e||e.hidden,t.title=e?.title??"")},$=()=>{let e=jt()?.route??xt,s=null;for(let l of document.querySelectorAll(".dt-pages a"))F(new URL(l.href).pathname)===e?(l.setAttribute("aria-current","page"),s=l):l.removeAttribute("aria-current");ne();let r=(s?.querySelector(".dt-menu-label")?.textContent?.trim()||e).trim().split(/\s+/);Rt.textContent=e==="/"?"":e.replace(/^\//,""),Rt.closest("summary").toggleAttribute("data-home",e==="/")},M=(!!n.gridAdmin||!!n.arrange)&&!n.client,L=(n.folders??[]).filter(t=>t&&typeof t.name=="string"&&Array.isArray(t.pages)),V=new Set((()=>{try{return JSON.parse(ct.getItem("dt-folders-open")||"[]")}catch{return[]}})()),U=new Set((()=>{try{return JSON.parse(ct.getItem("dt-folders-closed")||"[]")}catch{return[]}})()),G=document.querySelector(".dt-pages-list"),_t=()=>$(),se=t=>$t(t?'<path d="M2.5 15.5V5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H15A1.5 1.5 0 0 1 16.5 7v1.5M2.5 15.5l2.2-6A1.5 1.5 0 0 1 6.1 8.5h11.2l-2.5 7z" />':'<path d="M2.5 5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H16A1.5 1.5 0 0 1 17.5 7v7.5A1.5 1.5 0 0 1 16 16H4a1.5 1.5 0 0 1-1.5-1.5z" />',14),Dt=()=>{let t=new Map(n.pages.map(d=>[d.route,d])),e=new Set(L.flatMap(d=>d.pages)),s=d=>Kc(n,d,xt,M),o=d=>L.filter(p=>(p.parent&&L.some(u=>u.id===p.parent)?p.parent:null)===d),a=d=>d.pages.includes(xt)||o(d.id).some(a),r=(d,p)=>s(d).replace("<li",`<li style="--d:${p}"`),l=(d,p)=>{let u=V.has(d.id)||!U.has(d.id)&&a(d),b=d.pages.map(P=>t.get(P)).filter(P=>!!P),T=o(d.id);return`<li class="dt-folder" data-folder="${f(d.id)}" style="--d:${p}"${u?" data-open":""}${M?' draggable="true"':""}><div class="dt-folder-row" role="button" tabindex="0" aria-expanded="${u}">${Bo}${se(u)}<span class="dt-menu-label">${f(d.name)}</span><em class="dt-folder-n"></em>`+(M?`<button type="button" class="dt-folder-more" aria-label="Folder menu">${$t('<circle cx="5" cy="10" r="1" /><circle cx="10" cy="10" r="1" /><circle cx="15" cy="10" r="1" />',14)}</button>`:"")+`</div><ul${u?"":" hidden"}>${T.map(P=>l(P,p+1)).join("")}${b.map(P=>r(P,p+1)).join("")}${b.length||T.length?"":`<li class="dt-folder-empty" style="--d:${p+1}">Empty \u2014 drag pages here</li>`}</ul></li>`};G.innerHTML=o(null).map(d=>l(d,0)).join("")+n.pages.filter(d=>!e.has(d.route)).map(d=>r(d,0)).join(""),document.querySelector(".dt-pages-foot").hidden=!M,_t()};Dt();let E=document.querySelector(".dt-pages");E&&!E.querySelector("li")&&E.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let x=[...document.querySelectorAll(".devtools details, .dt-strip details")],H=!1,q=t=>ss(t,()=>{t.open=!1}),D=()=>{let t=x.filter(e=>e.open&&!e.hasAttribute("data-leaving"));for(let e of t)q(e);return t};for(let t of x)t.querySelector(":scope > summary")?.addEventListener("click",e=>{t.open&&t.hasAttribute("data-leaving")?(e.preventDefault(),Io(t)):t.open&&(e.preventDefault(),q(t))});document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=D();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{H=x.some(e=>e.open&&!e.contains(t.target))&&D().length>0},!0),addEventListener("blur",D);let ut=document.querySelector(".dt-pad-overlay"),Et="dt-inspect",st=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),et=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-elsewhere",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),rt={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),contrast:document.querySelector(".dt-contrast-btn"),border:document.querySelector(".dt-border-btn")},gt="",At=0,{spacer:$e,drawPads:je,drawSize:ke,drawType:Vt,drawColor:he,drawBorder:He,drawContrast:be,contrastFix:_e,markCopied:Ms}=su(ut),qn=null,R=()=>{qn&&gt&&O(qn)},O=t=>{qn=t,!At&&(At=requestAnimationFrame(()=>{At=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(st)){ut.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),gt==="sizes"?ke(e):gt==="type"?Vt(e):gt==="color"?he(e):gt==="contrast"?be(e):gt==="border"?He(e):je(t.altKey?e:$e(e))}))},Y=t=>{gt=t;for(let[e,s]of Object.entries(rt))s.setAttribute("aria-pressed",String(e===t));z(Et,t),Ue({inspect:t}),ut.hidden=!t,ut.innerHTML="",t?(document.addEventListener("mousemove",O),addEventListener("scroll",R,!0),addEventListener("resize",R)):(document.removeEventListener("mousemove",O),removeEventListener("scroll",R,!0),removeEventListener("resize",R))};document.addEventListener("click",t=>{gt!=="contrast"||!_e()||t.target.closest?.(st)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(_e()).catch(()=>{}),Ms(),R())},!0);for(let[t,e]of Object.entries(rt))e.addEventListener("click",()=>{t!==gt&&sn(!1),Y(gt===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Ut)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let s=o=>{k&&parent.postMessage({dt:!0,...o},location.origin)};gt?(Y(""),s({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):St.hidden||(ft(!1),s({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let Nt=document.querySelector(".dt-notes-btn"),Kt=[...document.querySelectorAll(".dt-bp")],xe=document.querySelector(".dt-history-btn"),it=document.querySelector(".dt-history"),ye=document.querySelector(".dt-elsewhere"),os=document.querySelector(".dt-studio-btn"),as=document.querySelector(".dt-devices"),is=document.querySelector(".dt-notes-hi"),Nu=is.querySelector(".dt-hi-box"),zr=is.querySelector(".dt-hi-tag"),Sn=document.querySelector(".dt-frame"),Xe=document.createElement("div");Xe.className="dt-spot",Xe.hidden=!0,Xe.setAttribute("aria-hidden","true"),document.body.append(Xe);let Bu=t=>{if(!t||!Ut){Xe.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;Xe.style.setProperty("--spot-x",`${e.left-s}px`),Xe.style.setProperty("--spot-y",`${e.top-s}px`),Xe.style.setProperty("--spot-w",`${e.width+s*2}px`),Xe.style.setProperty("--spot-h",`${e.height+s*2}px`),Xe.hidden&&(is.hidden=!0),Xe.hidden=!1},Ys=Sn.querySelector("iframe");Ys.addEventListener("load",$),new MutationObserver($).observe(Sn,{attributes:!0,attributeFilter:["hidden"]});let Ua=document.querySelector(".dt-notes-count"),nt=document.querySelector(".dt-notes-overlay"),Xs=".devtools, .dt-tab, .dt-strip, .dt-strip-tab, .dt-strip-grip, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Ya=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(Xs).forEach(Ya);let Vr="dt-notes",j=[],Ut=!1,X=null,B=null,Xa=0,Pe="",Ru=(t,e,s)=>{if(s>160&&s<innerHeight-120)return!1;let o=document.elementsFromPoint(e,s).find(a=>!In(a)&&a!==document.documentElement&&a!==document.body);if(!o||o===t||t.contains(o)||o.contains(t))return!1;for(let a=o;a&&a!==document.body;a=a.parentElement){let r=getComputedStyle(a).position;if(r==="fixed"||r==="sticky")return!a.contains(t)}return!1},Gr=new WeakSet,_o=null,Wo=null,We={},zo=" \xB7 hidden \u2014 inside something closed",Vo=t=>{t.toggleAttribute("data-up",t.scrollTop>2),t.toggleAttribute("data-more",t.scrollTop+t.clientHeight<t.scrollHeight-2)};nt.addEventListener("scroll",t=>{let e=t.target;e.classList?.contains("dt-note-thread")&&Vo(e)},!0),nt.addEventListener("load",t=>{let e=t.target.closest?.(".dt-note-thread");e&&Vo(e)},!0),nt.addEventListener("scroll",t=>{let e=t.target;if(!e.classList?.contains("dt-note-thread")||e.scrollTop+e.clientHeight<e.scrollHeight-4)return;let s=e.parentElement?.querySelector(".dt-new-below");s&&(delete We[s.dataset.id],s.remove())},!0);let Le=[],te=null,ze=[],Pu=10,Js=(t=B)=>!!(t&&((t.text?.trim().length??0)>=Pu||t.images?.length)),rn=()=>{B&&Js()&&ze.push(B),B=null},Kr=0,Zs=()=>{if(!Js()||performance.now()-Kr<4e3)return!0;Kr=performance.now();let t=nt.querySelector(".dt-note[data-draft]");return t&&Oo(t,"no"),t?.querySelector(".dt-note-input")?.focus(),Gt("Not sent \u2014 close again to keep it as a draft",2400),!1},fn=null,Ja=new Map,Za=null,Ur=()=>`dt-draft:${n.me?.email??""}:${xt}${k?":canvas":""}`,Tn=Ur(),Go=0,Qs=()=>{if(!B&&!ze.length&&!Pe){ct.removeItem(Tn);return}let t={draft:B,parked:ze,reply:Pe?{for:fn,text:Pe}:null};try{localStorage.setItem(Tn,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(Tn,JSON.stringify({...t,draft:B&&e(B),parked:ze.map(e)}))}catch{}}},rs=()=>{clearTimeout(Go),Go=setTimeout(Qs,200)};addEventListener("pagehide",()=>{clearTimeout(Go),Qs();try{sessionStorage.setItem(`nm-open:${Tn}`,X==null?"":String(X))}catch{}});let Ve=ct.getItem("dt-space")==="clients"?"clients":"studio",Je=()=>!!n.me&&!n.client,An=t=>!Je()||Ve==="clients"===Bt(t),Yr=["all","nobody","mine","others","resolved","claude","wrote","check"],Hn=Yr.find(t=>t===ct.getItem("dt-pinf"))??"all",Qa=()=>{},Ko=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Ze=ct.getItem("dt-resolved")!=="0",bn=ct.getItem("dt-archived")==="1",Se=t=>_c(t,n.autoArchive),Uo=t=>Se(t)?bn:Ct(t)!=="done"||Ze,oe={q:"",menu:!1,more:!1,view:["me","agent"].includes(ct.getItem("dt-view")??"")?ct.getItem("dt-view"):"all",sort:["old","reply","unread"].includes(ct.getItem("dt-sort")??"")?ct.getItem("dt-sort"):"new"},Dn=null,Yo=t=>yt.find(e=>e.from?.id===t.id&&Gs(e)),ti=t=>Gs(t)?yt.find(e=>e.id===t.from.id&&Bt(e)):void 0,Ie=null,Xo=null,Jo=()=>Je()&&Ve==="clients",ks=t=>Jo()&&Bt(t)&&Ct(t)==="open"&&!Yo(t),Zo='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="2.5"/><path d="M10 3.5v13"/></svg>',Iu=t=>{let e=n.client?void 0:ti(t);if(!e)return"";let s=Oc(e);return`<button type="button" class="dt-field dt-field--bare dt-field--client" data-act="open-orig" data-id="${e.id}" data-tip="What the client sees now \u2014 open their thread" aria-label="The client sees: ${f(s)}. Open their thread"><span class="dt-field-box"><svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true">${Pr.clients}</svg><span class="dt-field-label">Client \xB7 ${f(s)}</span><svg class="dt-field-ext" viewBox="0 0 24 24" width="11" height="11" aria-hidden="true"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg></span></button>`},Ou=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],qu=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Du=()=>{let t=navigator.userAgent,e=r=>r.find(([l])=>l.test(t)),s=e(Ou),o=e(qu),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},ei=()=>C(innerWidth,innerHeight),Yt=()=>Za??ei(),Xr=()=>{let t=Yt();for(let e of Kt)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:ni,poolOf:si,contextOf:oi,resolveEl:Fu,anchorOf:ju,anchorState:_u,fingerprintOf:Qo}=iu(),Ls=new Map,ta=()=>{Ls=new Map},Jr=t=>JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth,t.fp]),Qe=t=>{let e=Jr(t),s=Ls.get(e);return(s===void 0||s.el&&!s.el.isConnected)&&(s={el:Fu(t),st:_u(t)},Ls.set(e,s)),s.el},ai=t=>(Qe(t),Ls.get(Jr(t))?.st??"found"),to=0,eo=null,ea="",Zr=()=>{to=Math.max(to,scrollY+innerHeight)},Qr=(t,e)=>e==="gone"&&(Zr(),to<document.documentElement.scrollHeight-1&&(!t.spot||t.spot.y>to));addEventListener("scroll",()=>{Zr(),eo!=null&&to>=eo-1&&(eo=null,setTimeout(()=>{ta(),Z(),Am()},600))},{capture:!0,passive:!0});let Wu=t=>{let e=ai(t);return(Qr(t,e)?"later":e)+(Ce(t)?"":" \xB7 no pin")},ii=null,tl=t=>{ii=t.id??null,scrollTo({top:t.spot?Math.max(0,t.spot.y-innerHeight/2):document.documentElement.scrollHeight,behavior:"smooth"})},ri=[];document.addEventListener("pointerdown",t=>{let e=t.target;e instanceof Element&&!In(e)&&!e.closest(".devtools")&&(ri=[ri.at(-1),{el:e,t:Date.now()}].filter(Boolean))},!0);let zu='[role=menu],[role=listbox],[role=dialog],[role=tooltip],dialog,[popover],[aria-modal],[data-state="open"],[data-radix-popper-content-wrapper],details[open]>:not(summary)',Vu=t=>{let e=[...ri].reverse().find(l=>!t.contains(l.el)&&!l.el.contains(t));if(!e||Date.now()-e.t>6e5)return null;let s=e.el.closest("button,a,[role=button],summary,[aria-haspopup],[aria-expanded],[aria-controls]");if(!s||!s.isConnected||s.contains(t)||t.contains(s)||In(s))return null;let o=t.closest(zu);if(o?.contains(s)||!o&&s.getAttribute("aria-expanded")!=="true"&&!s.matches("summary,[aria-haspopup]"))return null;let a=s.tagName.toLowerCase(),r=[...s.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ni(s),tag:a,classes:r,nth:si({tag:a,classes:r}).indexOf(s),label:Jt(re(s.textContent||""),60),ctx:oi(s),fp:Qo(s),rx:.5,ry:.5}},na=new Map,Ce=t=>{na.size||requestAnimationFrame(()=>na.clear());let e=na.get(t);return e===void 0&&(e=ju(t,Qe(t)),na.set(t,e)),e},el=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},sa=[],li=t=>{for(let e of sa)e.play();sa=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),sa.push(s))},di=()=>{if(B)return Qe(B);let t=X!=null?j.find(s=>s.id===X):null;if(!t)return null;let e=Ce(t);return e&&!e.hidden?Qe(t):null},nl="claude",Gu=()=>(n.client||Ve==="clients"?n.team??[]:ca()).filter(t=>!Tr(t.email)),Ku=()=>Gu().filter(t=>t.email!==n.me?.email),no=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...Ku()],sl='<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>',ci=(t,e)=>{let s=e==="agent"?nl:e==="me"?n.me?.email??"":"";if(!t){if(!B)return;B.assignee=s,B.stage=Xt(s)?"approved":!B.stage||B.stage==="approved"?"new":B.stage,so(s),B.carried=!1,rs(),Z();return}oa(t,s)},oa=(t,e)=>{let s=j.find(r=>r.id===t);if(s&&hn(s)&&!Xt(e)&&!confirm("The agent is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?De(s):"new",a=Xt(e)?"approved":o==="approved"?"new":o;dn(r=>r.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>tt({id:t,assignee:e||null,stage:a}),Xt(e)?"Approving it for the agent":"Reassigning")},Uu=(t,e)=>{if(e&&ct.setItem("nm-for",e),!t){if(!B)return;B.assignee=e,B.stage==="approved"&&(B.stage="new"),so(e),B.carried=!1,rs(),Z();return}oa(t,e)},Yu='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9M15.5 4v3.5H12" stroke-linecap="round" stroke-linejoin="round"/></svg>',so=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e&&!Xt(e)&&no().some(s=>s.email===e)?e:null}catch{return null}},ol=t=>Xt(t)?"#d97757":t?"#0d99ff":"#717171",yn=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],ln=t=>t?n.team?.find(e=>e.email===t):void 0,aa=t=>{let e=re(t??"").split(/\s+/).filter(Boolean);return f(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},Fn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${f(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${aa(e)}</b>`,ui=t=>{let e=ln(t.by);return e||t.byName?Fn(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},Oe=t=>`var(--dt-avatar-${ln(t)?.avatar_hue??[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,vn=(t,e)=>{let s=ln(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return Fn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${Oe(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},al=()=>n.me?`${vn(n.me.email.toLowerCase(),{by:n.me.email,byName:n.me.name})}<i class="dt-pin-cut" aria-hidden="true">${es}</i>`:es,ls=new Map,pi=new Map,il=0,Xu=(t,e)=>{let s=e==="found"?null:e;n.client||k||t.id<=0||(t.anchor??null)===s||ls.get(t.id)===s||(ls.set(t.id,s),pi.set(t.id,s),clearTimeout(il),il=window.setTimeout(()=>{for(let[o,a]of pi){let r=j.find(d=>d.id===o),l=r?ai(r):"found";if(!r||(l==="found"?null:l)!==a){ls.delete(o);continue}tt({id:o,anchor:a}).then(d=>{if(d.ok){let p=j.find(u=>u.id===o);p&&(p.anchor=a)}}).catch(()=>ls.delete(o))}pi.clear()},4e3))},Ju=t=>{let e=!!Qe(t)?.getClientRects().length;return`<div class="dt-note-hidden dt-note-away"><b>${ao}<span>${e?"Scrolled out of view":"Hidden right now"}</span></b>${e?`<button type="button" data-act="show-el" data-id="${t.id}">Show it</button>`:""}</div>`},Zu=(t,e,s,o)=>{let a=(d,p,u=!1)=>`<button type="button" class="dt-lost-btn${u?" is-main":""}" data-act="${d}" data-id="${t.id}">${p}</button>`,r=(d,p,u)=>`<button type="button" class="dt-lost-btn dt-lost-ico" data-act="${d}" data-id="${t.id}" data-tip="${u}" aria-label="${u}">${p}</button>`,l=!n.client;if(o&&s==="later")return`<div class="dt-note-hidden dt-note-away"><b>${ao}<span>Further down the page</span></b><button type="button" data-act="go-spot" data-id="${t.id}">Show it</button></div>`;if(o&&s==="gone"){let d=Ec(t).before,p=Ct(t)!=="open";return`<div class="dt-lost dt-lost--gone"><p>${p?"Not on the page now. The thread stays: answer or reopen it here.":d?"Not on the page now \u2014 here is how it looked. Pin it to something else, or close the thread.":"Not on the page now. Pin it to something else, or close the thread."}</p>${d?`<img class="dt-lost-shot" src="${f(wr(d.split("/").pop()))}" alt="How the element looked" loading="lazy">`:""}${p?"":`<span class="dt-lost-acts">${Is(t)?a("repin","Re-pin",!0):""}${r("lost-resolve",Me,"Resolve")}${l?r("archive",kn,"Archive"):""}</span>`}</div>`}return e?.opener?`<div class="dt-note-hidden dt-note-away"><b>${ao}<span>In ${f(vo(e.opener))} \u2014 closed</span></b><button type="button" data-act="open-it" data-id="${t.id}">Show it</button></div>`:""},mi=(t,e)=>ln(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],ia={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},jn=(()=>{try{return JSON.parse(ct.getItem("dt-seen")||"{}")}catch{return{}}})(),hi=()=>z("dt-seen",JSON.stringify(jn)),rl=t=>{let e=an(t);if(!(t.id in jn))return jn[t.id]=e.length,hi(),!1;let s=e[e.length-1];return e.length>jn[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},ll=t=>{let e=an(t).length;jn[t.id]!==e&&(jn[t.id]=e,hi())},Qu=t=>{let e=ln(t);return e?` data-face="${f(e.avatar_url??"")}" data-initial="${aa(e.name||e.email)}"`:""},tp=t=>n.client||Bt(t)||Ct(t)==="done"?"":pl(t,t.assignee??"",t.id),ep=t=>{let e=Ct(t)==="done";return`<button type="button" class="dt-hist-tick" data-act="${e?"reopen":"done"}" data-id="${t.id}" data-tip="${e?"Reopen":Ct(t)==="claude"?"Looks right \u2014 resolve":"Resolve"}" aria-label="${e?"Reopen":"Resolve"}">${e?gn:Me}</button>`},np=t=>{let e=(t.replies??[]).filter(a=>!a.deleted);if(!e.length)return"";let s=[...new Set(e.map(a=>a.author==="claude"?"@agent":(a.by||"you").toLowerCase()))];return`<span class="dt-hist-replied"><span class="dt-hist-faces">${s.slice(0,3).map(a=>a==="@agent"?`<span class="dt-hist-face is-agent">${Fe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Oe(a)}">${vn(a,t)}</span>`).join("")}${s.length>3?`<i>+${s.length-3}</i>`:""}</span>${e.length} ${e.length===1?"reply":"replies"}</span>`},sp=t=>{if(Dn!==t.id)return"";let e=(l,d,p,u="")=>`<button type="button" role="menuitem" ${l} class="${u}"><i>${d}</i><span>${p}</span></button>`,s='<svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><circle cx="10" cy="10" r="2" fill="currentColor" stroke="none"/></svg>',o='<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="3"/><path d="m7 10.2 2.2 2.2L13.2 8"/></svg>',a=Se(t),r=!n.client;return`<div class="dt-hist-menu is-row" role="menu">${r&&!Bt(t)?`<div class="dt-hist-assign"><span>Assign</span>${ul(t.assignee??"",t.id)}</div><hr>`:""}${e(`data-row-unread="${t.id}"`,s,"Mark as unread")}${e(`data-row-link="${t.id}"`,wi,"Copy link")}${Jo()?e(`data-row-select="${t.id}"`,o,"Select")+(ks(t)?e(`data-row-mirror="${t.id}"`,Zo,"Mirror to Team"):""):""}${r&&Je()&&!t.client?e(`data-row-move="${t.id}"`,vi,Bt(t)?"Move to Team":"Move to Client"):""}${r||!As(t)?"<hr>":""}${r?e(`data-act="${a?"unarchive":"archive"}" data-id="${t.id}"`,a?gn:kn,a?"Unarchive":"Archive"):""}${As(t)?"":e(`data-rm="${t.id}"`,ts,"Delete thread","is-danger")}</div>`},dl={queued:"#0d99ff",working:"#f5a623",asks:"#e93d82",stuck:"#e5402c",review:"#8e4ec6"};pu(t=>{if(t.matches(".dt-hist-go[data-go]")){let b=j.find(Pt=>Pt.id===Number(t.dataset.go)),T=b&&[...b.replies??[]].reverse().find(Pt=>!Pt.deleted);if(!b||!T)return null;let P=T.author==="claude",m=(T.by||"you").toLowerCase(),_=P?Nn(b):T.by?T.by===n.me?.email?"You":yn(T.by):"You",Q=P?`<span class="dt-hist-face is-agent">${Fe(11)}</span>`:`<span class="dt-hist-face" style="--hue:${Oe(m)}">${vn(m,b)}</span>`,Ot=(T.images?.length?'<span class="dt-peek-chip">Picture</span>':"")+(T.files?.length?'<span class="dt-peek-chip">File</span>':"")+(T.audio?'<span class="dt-peek-chip">Voice note</span>':"");return`<span class="dt-peek-head"><span class="dt-peek-people">${Q}</span><b>${f(_)}</b>${P?`<em>${f(kr(T.agent)||"")}</em>`:""}${T.editedAt?"<em>edited</em>":""}<em>${Qn(T.at)}</em></span>`+(T.text?`<span class="dt-peek-text is-reply">${f(Jt(T.text,320))}</span>`:"")+(Ot?`<span class="dt-peek-files">${Ot}</span>`:"")}if(X!=null||!t.matches(".dt-pin[data-id]"))return null;let e=j.find(b=>b.id===Number(t.dataset.id));if(!e)return null;let s=[...new Set([e.by,...(e.replies??[]).filter(b=>b.author!=="claude").map(b=>b.by)].filter(Boolean).map(b=>b.toLowerCase()))].slice(0,3),o=Ct(e),a=n.client||Bt(e)||o==="done"?null:Ee(e),r=a&&dl[a]&&(Xt(e.assignee)||a==="review")?a:null,l=_n.find(b=>b[0]===ds(e)),[d,p]=o==="done"?Se(e)?["#717171","Archived"]:["#30a46c","Resolved"]:r?[dl[r],`${Nn(e)}${gi(e)}`]:[l[2],l[1]],u=e.replies?.length??0;return`<span class="dt-peek-head">${s.length?`<span class="dt-peek-people">${s.map(b=>`<span class="dt-hist-face" style="--hue:${Oe(b)}">${vn(b,e)}</span>`).join("")}</span>`:""}<b>${f(e.byName||"You")}</b><em>\xB7 ${Qn(e.createdAt)}</em></span><span class="dt-peek-text">${f(Jt(e.text,240))}</span><span class="dt-peek-foot">${Ye(d,o==="done"?1:0)}<span>${f(p)}${u?` \xB7 ${u} ${u===1?"reply":"replies"}`:""}</span></span>`});let gi=t=>{let e=Ee(t),s=Hr(t);return e==="working"?s?.step?` \xB7 ${Ar(s.step)} \xB7 ${s.elapsed}`:" is working":e==="stuck"?` went quiet \xB7 ${s?.silent??""}${s?.step?` \xB7 last: ${s.step}`:""}`:e==="queued"?" \xB7 queued \xB7 next run":e==="asks"?" asks you \xB7 answer in the thread":e==="review"?" fixed it \xB7 to check":""},op=t=>{let e=ln(t);return e?Fn(e.avatar_url,e.name||e.email):""},cl=(t,e,s={})=>`<option value="${f(t)}"${s.dot?` data-c="${ol(t)}"`:""}${Qu(t||null)}${s.selected?" selected":""}>${f(e)}</option>`,ul=(t,e,s=!1)=>{let o=Xt(t),a=o?"":t,r=ln(a),l=r?r.avatar_url?`<img class="dt-owner-face" src="${f(r.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${Oe(a.toLowerCase())}" aria-hidden="true">${aa(r.name||r.email)}</b>`:a?bl:sl,d=a?r?.name||yn(a):"Anyone",p=T=>{let P=ln(T);return P?.avatar_url?`<img class="dt-menu-face" src="${f(P.avatar_url)}" alt="">`:`<b class="dt-menu-face" style="--hue:${Oe(T.toLowerCase())}">${[...aa(P?.name||T)][0]}</b>`},u=(T,P,m="")=>`<option value="${f(T)}" data-icon="${f(T?p(T):sl)}"${m?` data-hint="${f(m)}"`:""}${T===a?" selected":""}${T?"":" data-sep-after"}>${f(P)}</option>`,b=no();return`<label class="dt-owner${r?" has-face":""}${s?" is-compact":""}" data-tip="${o?"The agent has it \u2014 pick a person to hand it over":s?f(d):"Who takes it"}">${l}${s?"":`<span class="dt-owner-name">${f(d)}</span>`}${ra}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
262
+ ${u("","Anyone")}${b.map(T=>u(T.email,T.email===n.me?.email?`Me \xB7 ${T.name||T.email}`:T.name||T.email,T.email)).join("")}${a&&!b.some(T=>T.email===a)?u(a,yn(a)):""}
263
+ </select></label>`},ap={queued:"queued",working:"working",asks:"asks you",stuck:"went quiet",review:"fixed it \u2014 to check",done:"done"},pl=(t,e,s,o=!1)=>{let a=t?Ee(t):Xt(e)?"queued":null,r=!!a&&(Xt(e)||a==="review"),l=o?"The agent does not work in the clients\u2019 space":r?"Take it back":"Give to the agent",d=r?`With the agent \u2014 ${ap[a]??"queued"}. Take it back`:l;return`<button type="button" class="dt-claude-btn${r?" is-on":""}" data-act="claude"${s?` data-id="${s}"`:""}${r?` data-step="${a}" style="--step-c:${ia[a]??ia.queued}"`:""} aria-pressed="${r}" data-tip="${f(l)}" aria-label="${f(d)}"${o?" disabled":""}>${Fe(13)}</button>`},ml=t=>{if(!t){if(!B)return;ci(0,Xt(B.assignee)?"nobody":"agent");return}let e=j.find(o=>o.id===t);if(!e)return;let s=Ee(e);oa(t,Xt(e.assignee)||s==="review"?"":nl)},ip=t=>`<div class="dt-suggest dt-suggest--read"><del>${f(t.from)}</del><ins>${f(t.to)}</ins></div>`,hl=(t,e)=>{let s=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return f([s,re(e??"")&&`\u201C${Jt(re(e),80)}\u201D`].filter(Boolean).join(" \xB7 "))},ra='<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>',fi=(t,e,s=!1)=>{let o=Ks(t),a=r=>Jc(r).replace("<svg ",`<svg style="stroke:${r.color}" `);return s?`<span class="dt-field dt-field--bare dt-field--type"><span class="dt-field-box">${a(o)}<span class="dt-field-label">${f(o.label)}</span></span></span>`:`<label class="dt-field dt-field--bare dt-field--type" data-tip="Type: ${f(o.label)}"><span class="dt-field-box">${a(o)}<span class="dt-field-label">${f(o.label)}</span>${ra}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${g.map(r=>`<option value="${r.id}" data-c="${r.color}" data-icon="${f(a(r))}"${r.id===t?" selected":""}>${r.label}</option>`).join("")}</select></span></label>`},_n=[["new","New","#0d99ff",0],["progress","In progress","#f5a623",.25],["review","To check","#8e4ec6",.5],["waiting","Waiting","#e93d82",.75]],ds=t=>hn(t)||De(t)==="progress"?"progress":De(t)==="review"?"review":De(t)==="waiting"?"waiting":"new",gl=(t,e)=>{if(e==="all")return!0;let s=Ct(t),o=Co(t,s),a=(n.me?.email??"").toLowerCase();return e==="nobody"?s!=="done"&&!!o&&!o.taker:e==="mine"?!!o&&o.taker===a:e==="others"?!!o&&!!o.taker&&o.taker!==a:e==="resolved"?s==="done":e==="claude"?!!o?.claude&&o.taker===a:e==="wrote"?!t.by||t.by.toLowerCase()===a:s==="claude"||s==="open"&&(Ee(t)==="review"||ds(t)==="review")},la={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",done:"done"},Wn=[..._n,["done","Resolved","#30a46c",1]],rp=t=>{let e=Ee(t);return t.status==="done"&&e!=="review"?"done":e&&la[e]?la[e]:ds(t)},lp=t=>{let e=Ee(t),s=rp(t),[,,o,a]=Wn.find(l=>l[0]===s),r=!n.client&&ti(t)?l=>` data-note="${f(To[l])}"`:()=>"";return`<label class="dt-field" data-tip="${e&&la[e]?"Follows the agent":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Ye(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${r("new")?'<option disabled data-head data-note="The client sees">Status</option>':""}${Wn.map(([l,d,p,u])=>`<option value="${l}" data-c="${p}" data-icon="${f(Ye(p,u))}"${r(l)}${l===s?" selected":""}>${d}</option>`).join("")}${n.client?"":`<option value="${Se(t)?"unarchive":"archive"}" data-sep data-icon="${f(kn)}">${Se(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},da=(t,e,s)=>`<p class="dt-note-event"><span>${t}<b>${f(e)}</b>${s?`<time>${Br(s,Qn)}</time>`:""}</span></p>`,Ss=new Map,dp=(t,e,s=1/0)=>{let{reopenedAt:o,reopenedBy:a,movedAt:r,movedBy:l,movedFrom:d,repinnedAt:p,repinnedBy:u,repinnedFrom:b}=t,T=an(t),P=bt=>{let kt=Date.parse(bt),Ht=T.findIndex((Te,de)=>de>0&&!!Te.at&&Date.parse(Te.at)>kt);return Ht<0?T.length:Ht},m=bt=>bt?bt==="you"||bt===n.me?.email?"you":bt==="claude"?"the agent":yn(bt):"",_=[],Q=cp(t);if(Q&&_.push([Q.at?P(Q.at):0,da(Q.icon,Q.words,Q.time)]),r&&d&&_.push([P(r),da(bi,`Moved from ${d}${l?` by ${m(l)}`:""}`,r)]),p&&_.push([P(p),da(bi,`Re-pinned${u?` by ${m(u)}`:""}${b?` from ${b}`:""}`,p)]),o&&t.status!=="done"){let bt=m(a);_.push([P(o),da(gn,bt?`Reopened by ${bt}`:"Reopened",o)])}let Ot=e.map(()=>!0);for(let[bt,kt]of _.sort((Ht,Te)=>Te[0]-Ht[0]))e.splice(bt,0,kt),Ot.splice(bt,0,!1);let Pt=Ot.flatMap((bt,kt)=>bt?[kt]:[]),le=Pt.length-1-s;if(le<2)return e.join("");let Tt=[...new Set(an(t).slice(1,1+le).map(bt=>bt.author==="claude"?"@agent":(bt.by||n.me?.email||"you").toLowerCase()))].slice(0,3).map(bt=>bt==="@agent"?`<span class="dt-hist-face is-agent">${Fe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Oe(bt)}">${vn(bt,t)}</span>`).join("");return[...e.slice(0,Pt[1]),`<button type="button" class="dt-note-fold" data-act="unfold" data-id="${t.id}"><span class="dt-hist-faces">${Tt}</span>${le} more replies</button>`,...e.slice(Pt[Pt.length-s])].join("")},cp=t=>{let e=t.from;if(e){if(Gs(t))return{icon:Zo,words:Ic(t.mirroredBy?t.mirroredBy===n.me?.email?"you":(t.mirroredByName||yn(t.mirroredBy)).split(" ")[0]:""),at:null,time:t.createdAt};let o=yt.find(a=>a.id===e.id);return{icon:yi,words:Rc(t,o,o?.by?yn(o.by):""),at:null,time:t.createdAt}}if(n.client)return null;let s=yt.find(o=>o.from?.id===t.id);return s?{icon:Gs(s)?Zo:yi,words:Pc(s),at:s.createdAt??null,time:s.createdAt}:null},up=(t,e)=>{let s=j.find(l=>l.id===t);if(!s)return;if(e==="done"){tn(t,!0);return}if(e==="archive"||e==="unarchive"){us(t,e==="archive");return}if(Xt(s.assignee)&&!Bt(s)){s.status==="done"?tn(t,!1):(Gt("Still with the agent \u2014 its step is the status; the agent button takes it back.",6e3),Z());return}let a=e==="new"&&Xt(s.assignee)?"approved":e,r=s.status==="done"?{status:"open",doneBy:null}:{};dn(l=>l.map(d=>d.id===t?{...d,...r,stage:a}:d),()=>tt({id:t,...r,stage:a}),"Setting the status")},oo=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],pp=(t,e)=>{let s=Math.max(0,oo.findIndex(d=>d[0]===t)),[,o,a,r]=oo[s],l=oo[(s+1)%oo.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}">${ru(r,a)}<span>${o}</span></button>`},fl=(t,e,s,o,a=!1,r=!1,l=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${n.client?"":pp(t,s)}${l?"":fi(Ks(e).id,s,a)}</span>${n.client?"":`<span class="dt-who">${r?"":ul(o,s)}${pl(s?j.find(d=>d.id===s):void 0,o,s,r)}</span>`}</div>`,ao='<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>',mp=t=>{let e=re(t?.querySelector("h1, h2, h3, h4, h5, h6")?.textContent??t?.innerText?.split(`
264
+ `).find(s=>re(s))??"");return e?e.length>30?`${Jt(e,30)}\u2026`:e:t?.tagName.toLowerCase()??""},bl='<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>',yl='<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>',bi='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5 4.5v5a3 3 0 0 0 3 3h7.5M12.5 9.5l3 3-3 3" stroke-linejoin="round"/></svg>',yi='<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>',vi='<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>',wi='<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>',vl=t=>{let e=(a,r,l,d="")=>`<option value="${a}" data-icon="${f(r)}"${d}>${l}</option>`,s=t&&Je()?Bt(t)?(Yo(t)?"":e("mirror",Zo,"Mirror to Team"))+(t.client?"":e("move",vi,"Move to Team")):e("dup",yi,"Duplicate for the client")+e("move",vi,"Move to Client"):"",o=t&&n.client&&t.status==="done"?e("reopen",gn,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${yl}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
265
265
  <option value="" hidden selected></option>
266
- ${s}${o}${t&&t.id>0&&Bt(t)==="open"&&Is(t)?e("repin",bi,"Re-pin"):""}${t?e("link",wi,"Copy link"):""}${t&&!n.client&&t.id>0?e(Se(t)?"unarchive":"archive",Ln,Se(t)?"Out of the archive":"Archive"):""}
266
+ ${s}${o}${t&&t.id>0&&Ct(t)==="open"&&Is(t)?e("repin",bi,"Re-pin"):""}${t?e("link",wi,"Copy link"):""}${t&&!n.client&&t.id>0?e(Se(t)?"unarchive":"archive",kn,Se(t)?"Out of the archive":"Archive"):""}
267
267
  ${e(t?"rm":"discard",ts,t?"Delete thread":"Discard draft",` data-danger${t?" data-sep":""}`)}
268
- </select></label>`},da=()=>n.studio?(n.team??[]).filter(t=>n.studio.includes(t.email)):[],wl=t=>{let e=t||n.lead||"",s=da();return!s.length||s.some(o=>o.email===e)?e:s[0].email},mp=t=>{let e=wl(t),s=da();if(!s.length)return"";let o=sp(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${ol(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
268
+ </select></label>`},ca=()=>n.studio?(n.team??[]).filter(t=>n.studio.includes(t.email)):[],wl=t=>{let e=t||n.lead||"",s=ca();return!s.length||s.some(o=>o.email===e)?e:s[0].email},hp=t=>{let e=wl(t),s=ca();if(!s.length)return"";let o=op(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${ol(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
269
269
  ${s.map(a=>cl(a.email,a.name||a.email,{dot:!0,selected:e===a.email})).join("")}
270
- </select></span></label>`},io='<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>',$l='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',hp='<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>',gp=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,fp=(t,e)=>{let s=t.closest(".dt-voice"),o=s.querySelector("audio"),a=s.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let d=s.querySelector(".dt-voice-track i"),u=s.querySelector(".dt-voice-time"),h=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${h()?Math.min(1,o.currentTime/h()):0})`,u.textContent=gp(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=hp,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=$l,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let d=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-d.left)/d.width))*o.duration);return}if(!o.paused){o.pause();return}et.querySelectorAll(".dt-voice audio").forEach(d=>{d!==o&&d.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}},$i=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),xl=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),ro=new Map,bp=t=>{if(!t.startsWith("data:"))return t;let e=ro.get(t);if(!e){let[s,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:s.slice(5).split(";")[0]})),ro.set(t,e),ro.size>8){let[a,r]=ro.entries().next().value;URL.revokeObjectURL(r),ro.delete(a)}}return e},yp=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${$l}</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="${bp(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">${Hp}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${io}</button>`}</span>`,xi=t=>t.length>30?`${Zt(t,17)}\u2026${[...t].slice(-11).join("")}`:t,vp=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`},Ei=t=>{let e=Ec(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},wp=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${Ei(e)}<span class="dt-file-text"><b>${f(xi(e))}</b>${o?"":`<small>${vp(t)}</small>`}</span>`;return`<span class="dt-file" title="${f(e)}">${o?`<a class="dt-file-open" href="${f(xr(e)?t:a)}"${xr(e)?' target="_blank" rel="noreferrer"':` download="${f(e)}"`}>${r}</a><a class="dt-tip-r dt-file-get" href="${f(a)}" download="${f(e)}" aria-label="Download ${f(e)}" data-tip="Download">${Ep}</a>`:`<span class="dt-file-open">${r}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${io}</button>`}</span>`},$p=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${f(s)}"><span class="dt-file-open">${Ei(s)}<span class="dt-file-text"><b>${f(xi(s))}</b><small>${f(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${io}</button></span>`},xp=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${f(s)}"><span class="dt-file-open">${Ei(s)}<span class="dt-file-text"><b>${f(xi(s))}</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">${io}</button></span>`},El=(t,e,s=t)=>t.startsWith(ca)?$p(t,e??""):t.startsWith(ki)?xp(t,e??""):Ho(s)?wp(t,Ho(s),e):$i(s)?yp(t,e):`<span class="dt-shot${xl(s)?" dt-shot--video":""}">${xl(s)?`<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">${io}</button>`}</span>`,Mi=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=wr(o);return El(a,e===void 0?void 0:`data-id="${e}" data-img="${f(o)}"`,o)}).join("")}</div>`:"",Ml=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>El(e,`data-i="${s}"`)).join("")}</div>`:"",Ep='<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>',Mp='<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>',ca="refused:\0",ki="big:\0",ua=new Map,Ts=t=>!t.startsWith(ki),kp='<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>',Lp='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Sp=90,Li=32,Tp=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",pa=!1,Ap=async(t,e)=>{if(pa||!t)return;let s=Number(t.dataset.id)||0;pa=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Kt("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),pa=!1,e.classList.remove("is-asking");let St=pt?.name;Kt(St==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":St==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":St==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${pt?.message||St||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let r=()=>et.querySelector(s?`.dt-note[data-id="${s}"] .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">${ts}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(Li)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${Lp}</button>`;let d=l.querySelector("b"),u=[...l.querySelectorAll(".dt-rec-wave i")],h=new AudioContext,$=h.createAnalyser();$.fftSize=512,h.createMediaStreamSource(a).connect($);let B=new Uint8Array($.fftSize),_=[],p=new MediaRecorder(a,{audioBitsPerSecond:32e3}),V=[],Z=Date.now(),qt=!0,Ot=setInterval(()=>{let pt=r();if(!pt){ie(!1);return}l.parentElement!==pt&&pt.appendChild(l),$.getByteTimeDomainData(B);let St=0;for(let Nt of B)St+=((Nt-128)/128)**2;_.push(Math.min(1,Math.sqrt(St/B.length)*4));let gt=_.slice(-Li);u.forEach((Nt,Te)=>{let re=gt[Te-(Li-gt.length)];Nt.style.transform=`scaleY(${Math.max(.1,re??0).toFixed(2)})`,Nt.classList.toggle("is-empty",re===void 0)});let kt=Math.floor((Date.now()-Z)/1e3);d.textContent=`${Math.floor(kt/60)}:${String(kt%60).padStart(2,"0")}`,kt>=Sp&&p.state!=="inactive"&&p.stop()},90),ie=pt=>{qt=pt,p.state!=="inactive"&&p.stop()};l.querySelector(".dt-rec-x").addEventListener("click",pt=>{pt.stopPropagation(),ie(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",pt=>{pt.stopPropagation(),ie(!0)}),l.addEventListener("keydown",pt=>{pt.key==="Escape"&&(pt.stopPropagation(),ie(!1))}),p.ondataavailable=pt=>{pt.data.size&&V.push(pt.data)},p.onstop=async()=>{if(clearInterval(Ot),a.getTracks().forEach(gt=>gt.stop()),h.close().catch(()=>{}),l.remove(),pa=!1,!qt)return;let pt=new Blob(V,{type:p.mimeType||"audio/webm"}),St=await new Promise(gt=>{let kt=new FileReader;kt.onload=()=>gt(String(kt.result)),kt.readAsDataURL(pt)});s?Le.push(St):R&&(R.images??=[]).push(St),J(),r()?.querySelector("textarea")?.focus()},p.start(1e3),r()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},kl="\u{1F3A4} Voice note",Hp='<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>',Cp=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?R?.images??[]:Le)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await oe("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){Kt(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())},$n=new Map,Si=new Map,Ti=async(t,e,s)=>{let o=`${t}:${e}`;if(Si.delete(o),!s){$n.delete(o),J();return}let a=j.find(u=>u.id===t),r=a&&an(a).find(u=>(u.at??"0")===e);if(!r?.text)return;$n.set(o,{to:s,text:null}),J();let l=await oe("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:s})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};$n.get(o)?.to===s&&(l?.ok&&d.text?$n.set(o,{to:s,text:d.text}):($n.delete(o),Si.set(o,s)),J())},Np=(t,e,s)=>{let o=$n.get(`${t}:${e}`),a=_a(s),r=(navigator.language||"en").split("-")[0].toLowerCase();return`<label class="dt-msg-edit dt-msg-lang${o?" is-on":""}" data-tip="Translate">${o?.text===null?`<span class="dt-tr-spin">${Bp}</span>`:Pp}<span aria-hidden="true">${ia}</span><select class="dt-lang-select" data-id="${t}" data-at="${f(e)}" aria-label="Translate"><option value="" hidden${o?"":" selected"}></option><option data-head disabled>${a?`Written in ${f(Cr(a))}`:"Translate into"}</option>${Wc(s,navigator.language||"en").map(l=>`<option value="${f(l)}" data-bare${l===r?' data-note="your language"':""}${o?.to===l?" selected":""}>${f(_c(l))}</option>`).join("")}<option value="orig" data-sep data-icon="${f(gn)}"${o?"":" disabled"}>Show original</option></select></label>`},Bp='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M10 3a7 7 0 1 0 7 7"/></svg>',Rp=(t,e,s)=>{let o=`${t}:${e}`,a=_a(s);if($n.get(o)?.text)return`<p class="dt-tr-note">Translated from ${a?f(Cr(a)):"another language"} \xB7 <button type="button" data-act="tr-orig" data-id="${t}" data-at="${f(e)}">Show original</button></p>`;let r=Si.get(o);return r?`<p class="dt-tr-note is-error" role="alert">Could not translate it \xB7 <button type="button" data-act="tr-retry" data-id="${t}" data-at="${f(e)}" data-to="${f(r)}">Try again</button></p>`:""},Pp='<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>',Ip='<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>',Ll='<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>',Ai=()=>n.me?.email??"you",Op=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,r])=>{let l=r.includes(Ai()),d=r.map(u=>u===Ai()?"You":vn(u)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${f(e)}" data-emoji="${f(a)}" aria-pressed="${l}" data-tip="${f(d)}" aria-label="${f(`${a} ${r.length}: ${d}`)}">${f(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="${f(e)}" data-tip="Add reaction" aria-label="Add reaction">${Ll}</button></div>`:""},Sl=(t,e,s)=>{ma();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",s.box?"Emoji":"React"),o.innerHTML=(e?Sc:Lc).map($=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${f($)}" aria-label="${f($)}">${f($)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${yl}</button>`),Cn={...s,btn:t},et.append(o);let a=t.getBoundingClientRect(),r=o.getBoundingClientRect(),l=6,d=8,u=a.top-l-r.height>=d;o.style.top=`${u?a.top-l-r.height:Math.min(a.bottom+l,innerHeight-d-r.height)}px`;let h=(t.closest(".dt-note")??t).getBoundingClientRect().right;o.style.left=`${Math.min(Math.max(d,h-r.width),innerWidth-d-r.width)}px`,o.querySelector("button")?.focus()},Cn=null,ma=()=>{et.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),Cn=null},qp=(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()},Tl=(t,e,s)=>{let o=a=>{let r=Tc(a.reactions,s,Ai());return r===null?a:{...a,reactions:r}};dn(a=>a.map(r=>r.id!==t?r:e?{...r,replies:r.replies?.map(l=>l.at===e?o(l):l)}:o(r)),()=>Q({id:t,react:{at:e,emoji:s}}),"The reaction")},Dp='<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>',Hi=1e4,Al=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
270
+ </select></span></label>`},io='<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>',$l='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',gp='<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>',fp=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,bp=(t,e)=>{let s=t.closest(".dt-voice"),o=s.querySelector("audio"),a=s.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let d=s.querySelector(".dt-voice-track i"),p=s.querySelector(".dt-voice-time"),u=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${u()?Math.min(1,o.currentTime/u()):0})`,p.textContent=fp(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=gp,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=$l,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let d=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-d.left)/d.width))*o.duration);return}if(!o.paused){o.pause();return}nt.querySelectorAll(".dt-voice audio").forEach(d=>{d!==o&&d.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}},$i=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),xl=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),ro=new Map,yp=t=>{if(!t.startsWith("data:"))return t;let e=ro.get(t);if(!e){let[s,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:s.slice(5).split(";")[0]})),ro.set(t,e),ro.size>8){let[a,r]=ro.entries().next().value;URL.revokeObjectURL(r),ro.delete(a)}}return e},vp=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${$l}</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="${yp(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">${Cp}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${io}</button>`}</span>`,xi=t=>t.length>30?`${Jt(t,17)}\u2026${[...t].slice(-11).join("")}`:t,wp=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`},Ei=t=>{let e=Mc(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},$p=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${Ei(e)}<span class="dt-file-text"><b>${f(xi(e))}</b>${o?"":`<small>${wp(t)}</small>`}</span>`;return`<span class="dt-file" title="${f(e)}">${o?`<a class="dt-file-open" href="${f(xr(e)?t:a)}"${xr(e)?' target="_blank" rel="noreferrer"':` download="${f(e)}"`}>${r}</a><a class="dt-tip-r dt-file-get" href="${f(a)}" download="${f(e)}" aria-label="Download ${f(e)}" data-tip="Download">${Mp}</a>`:`<span class="dt-file-open">${r}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${io}</button>`}</span>`},xp=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${f(s)}"><span class="dt-file-open">${Ei(s)}<span class="dt-file-text"><b>${f(xi(s))}</b><small>${f(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${io}</button></span>`},Ep=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${f(s)}"><span class="dt-file-open">${Ei(s)}<span class="dt-file-text"><b>${f(xi(s))}</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">${io}</button></span>`},El=(t,e,s=t)=>t.startsWith(ua)?xp(t,e??""):t.startsWith(ki)?Ep(t,e??""):Ho(s)?$p(t,Ho(s),e):$i(s)?vp(t,e):`<span class="dt-shot${xl(s)?" dt-shot--video":""}">${xl(s)?`<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">${io}</button>`}</span>`,Mi=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=wr(o);return El(a,e===void 0?void 0:`data-id="${e}" data-img="${f(o)}"`,o)}).join("")}</div>`:"",Ml=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>El(e,`data-i="${s}"`)).join("")}</div>`:"",Mp='<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>',kp='<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>',ua="refused:\0",ki="big:\0",pa=new Map,Ts=t=>!t.startsWith(ki),Lp='<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>',Sp='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Tp=90,Li=32,Ap=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",ma=!1,Hp=async(t,e)=>{if(ma||!t)return;let s=Number(t.dataset.id)||0;ma=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Gt("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(mt){clearTimeout(o),ma=!1,e.classList.remove("is-asking");let Tt=mt?.name;Gt(Tt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Tt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Tt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${mt?.message||Tt||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let r=()=>nt.querySelector(s?`.dt-note[data-id="${s}"] .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">${ts}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(Li)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${Sp}</button>`;let d=l.querySelector("b"),p=[...l.querySelectorAll(".dt-rec-wave i")],u=new AudioContext,b=u.createAnalyser();b.fftSize=512,u.createMediaStreamSource(a).connect(b);let T=new Uint8Array(b.fftSize),P=[],m=new MediaRecorder(a,{audioBitsPerSecond:32e3}),_=[],Q=Date.now(),Ot=!0,Pt=setInterval(()=>{let mt=r();if(!mt){le(!1);return}l.parentElement!==mt&&mt.appendChild(l),b.getByteTimeDomainData(T);let Tt=0;for(let Ht of T)Tt+=((Ht-128)/128)**2;P.push(Math.min(1,Math.sqrt(Tt/T.length)*4));let bt=P.slice(-Li);p.forEach((Ht,Te)=>{let de=bt[Te-(Li-bt.length)];Ht.style.transform=`scaleY(${Math.max(.1,de??0).toFixed(2)})`,Ht.classList.toggle("is-empty",de===void 0)});let kt=Math.floor((Date.now()-Q)/1e3);d.textContent=`${Math.floor(kt/60)}:${String(kt%60).padStart(2,"0")}`,kt>=Tp&&m.state!=="inactive"&&m.stop()},90),le=mt=>{Ot=mt,m.state!=="inactive"&&m.stop()};l.querySelector(".dt-rec-x").addEventListener("click",mt=>{mt.stopPropagation(),le(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",mt=>{mt.stopPropagation(),le(!0)}),l.addEventListener("keydown",mt=>{mt.key==="Escape"&&(mt.stopPropagation(),le(!1))}),m.ondataavailable=mt=>{mt.data.size&&_.push(mt.data)},m.onstop=async()=>{if(clearInterval(Pt),a.getTracks().forEach(bt=>bt.stop()),u.close().catch(()=>{}),l.remove(),ma=!1,!Ot)return;let mt=new Blob(_,{type:m.mimeType||"audio/webm"}),Tt=await new Promise(bt=>{let kt=new FileReader;kt.onload=()=>bt(String(kt.result)),kt.readAsDataURL(mt)});s?Le.push(Tt):B&&(B.images??=[]).push(Tt),Z(),r()?.querySelector("textarea")?.focus()},m.start(1e3),r()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},kl="\u{1F3A4} Voice note",Cp='<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>',Np=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?B?.images??[]:Le)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await ie("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){Gt(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())},wn=new Map,Si=new Map,Ti=async(t,e,s)=>{let o=`${t}:${e}`;if(Si.delete(o),!s){wn.delete(o),Z();return}let a=j.find(p=>p.id===t),r=a&&an(a).find(p=>(p.at??"0")===e);if(!r?.text)return;wn.set(o,{to:s,text:null}),Z();let l=await ie("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:s})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};wn.get(o)?.to===s&&(l?.ok&&d.text?wn.set(o,{to:s,text:d.text}):(wn.delete(o),Si.set(o,s)),Z())},Bp=(t,e,s)=>{let o=wn.get(`${t}:${e}`),a=Wa(s),r=(navigator.language||"en").split("-")[0].toLowerCase();return`<label class="dt-msg-edit dt-msg-lang${o?" is-on":""}" data-tip="Translate">${o?.text===null?`<span class="dt-tr-spin">${Rp}</span>`:Ip}<span aria-hidden="true">${ra}</span><select class="dt-lang-select" data-id="${t}" data-at="${f(e)}" aria-label="Translate"><option value="" hidden${o?"":" selected"}></option><option data-head disabled>${a?`Written in ${f(Cr(a))}`:"Translate into"}</option>${zc(s,navigator.language||"en").map(l=>`<option value="${f(l)}" data-bare${l===r?' data-note="your language"':""}${o?.to===l?" selected":""}>${f(Wc(l))}</option>`).join("")}<option value="orig" data-sep data-icon="${f(gn)}"${o?"":" disabled"}>Show original</option></select></label>`},Rp='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M10 3a7 7 0 1 0 7 7"/></svg>',Pp=(t,e,s)=>{let o=`${t}:${e}`,a=Wa(s);if(wn.get(o)?.text)return`<p class="dt-tr-note">Translated from ${a?f(Cr(a)):"another language"} \xB7 <button type="button" data-act="tr-orig" data-id="${t}" data-at="${f(e)}">Show original</button></p>`;let r=Si.get(o);return r?`<p class="dt-tr-note is-error" role="alert">Could not translate it \xB7 <button type="button" data-act="tr-retry" data-id="${t}" data-at="${f(e)}" data-to="${f(r)}">Try again</button></p>`:""},Ip='<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>',Op='<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>',Ll='<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>',Ai=()=>n.me?.email??"you",qp=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,r])=>{let l=r.includes(Ai()),d=r.map(p=>p===Ai()?"You":yn(p)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${f(e)}" data-emoji="${f(a)}" aria-pressed="${l}" data-tip="${f(d)}" aria-label="${f(`${a} ${r.length}: ${d}`)}">${f(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="${f(e)}" data-tip="Add reaction" aria-label="Add reaction">${Ll}</button></div>`:""},Sl=(t,e,s)=>{ha();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",s.box?"Emoji":"React"),o.innerHTML=(e?Tc:Sc).map(b=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${f(b)}" aria-label="${f(b)}">${f(b)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${yl}</button>`),Cn={...s,btn:t},nt.append(o);let a=t.getBoundingClientRect(),r=o.getBoundingClientRect(),l=6,d=8,p=a.top-l-r.height>=d;o.style.top=`${p?a.top-l-r.height:Math.min(a.bottom+l,innerHeight-d-r.height)}px`;let u=(t.closest(".dt-note")??t).getBoundingClientRect().right;o.style.left=`${Math.min(Math.max(d,u-r.width),innerWidth-d-r.width)}px`,o.querySelector("button")?.focus()},Cn=null,ha=()=>{nt.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),Cn=null},Dp=(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()},Tl=(t,e,s)=>{let o=a=>{let r=Ac(a.reactions,s,Ai());return r===null?a:{...a,reactions:r}};dn(a=>a.map(r=>r.id!==t?r:e?{...r,replies:r.replies?.map(l=>l.at===e?o(l):l)}:o(r)),()=>tt({id:t,react:{at:e,emoji:s}}),"The reaction")},Fp='<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>',Hi=1e4,Al=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
271
271
  <textarea class="${t}" rows="1" maxlength="${Hi}" aria-label="${e}" placeholder="${e}">${f(s)}</textarea>
272
272
  ${a}
273
273
  <div class="dt-compose-bar">
274
- <span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${Dp}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${Mp}</button>
275
- ${Tp()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${kp}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${Ip}</button></span>
274
+ <span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${Fp}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${kp}</button>
275
+ ${Ap()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${Lp}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${Op}</button></span>
276
276
  <button class="dt-send${s.trim()?" is-ready":""}" ${o} title="Send (Enter)"
277
277
  ><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>
278
278
  </div>
279
- </div></div>`,ha=(t,e,s)=>(t||/^[a-z][a-z0-9-]*/i.exec(s?.split(">").pop()?.trim()??"")?.[0]||"element")+(e?.[0]?"."+e[0]:""),Hl=()=>ze.map((t,e)=>({i:e,el:ha(t.tag,t.classes,t.selector),text:ae(t.text??""),shots:t.images?.length??0,orphan:!Ce(t)})),Ci=[],Cl="",Nn=t=>{let e=t.working;return Zn(e?.agent,e?.by??t.doneFor)},Fp=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`},ga=(t,e)=>{let s=t.working;return{queued:"Queued for the agent \u2014 it takes it on its next run",asks:`${Nn(t)} is waiting for your answer`,working:`${Nn(t)} is on it \xB7 ${Fp(s?.at)}`,stuck:`${Nn(t)} went quiet \u2014 its next run takes it again`,review:`To check \u2014 ${Zn(t.doneAgent,t.doneFor)} fixed it \xB7 click to reopen`,done:"Resolved"}[e]},jp=t=>{if(n.client||It(t))return"";let e=Ee(t);if(!e)return 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 the agent" aria-label="Hand to the agent">${Rr(13,0)}</button>`;let s=Rr(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${f(ga(t,e))}" aria-label="${f(ga(t,e))}">${s}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${f(ga(t,e))}" role="img" aria-label="${f(ga(t,e))}">${s}</span>`},As=t=>!!n.client&&!(n.me&&t.by===n.me.email),Nl=(t,e=!0,s=!0)=>{let o=Bt(t),a=o==="done",r=Se(t);return`${e?jp(t):""}<button data-act="${a?"reopen":"done"}" data-id="${t.id}"
280
- class="dt-note-resolve${a&&!r?" is-on":""}" title="${a?"Reopen":o==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${Me}</button>${n.client||!s?"":`<button data-act="${r?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${r?" is-on":""}" title="${r?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${Ln}</button>`}`},_p='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',Ni=new Map,Wp=(t,e)=>{let s=Ar(e,25),o=Ni.get(t);o?.now!==s&&Ni.set(t,{now:s,was:o?.now??"",at:performance.now()});let a=Ni.get(t),r=a.was&&performance.now()-a.at<160?a.was:"";return`<span class="dt-step-words">${r?`<span class="dt-step-was" data-k="was:${f(r)}" aria-hidden="true">${f(r)}</span>`:""}<span class="dt-step-now" data-k="${f(s)}"${s!==e?` data-tip="${f(e)}"`:""}>${f(s)}</span></span>`},zp=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!Se(t)){let h=t.confirmedBy?t.confirmedBy===n.me?.email?"you":vn(t.confirmedBy).split(" ")[0]:"",$=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${Ye(Wn[Wn.length-1][2],1)}<span class="dt-step-text"><b>${f(h?`Resolved by ${h}`:"Resolved")}${$?` \xB7 ${f(Br($))}`:""}</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">${gn}</button>`+(n.client?"</div>":`<button type="button" class="dt-step-act" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${Ln}</button></div>`)}if(n.client||It(t))return"";let e=Ee(t),s={act:"hand",v:"me",icon:bl,tip:n.me?"Take it myself":"Take it off the agent"},o=[{act:"sendback",icon:gn,tip:"Send it back \u2014 say what is wrong below"},{act:"accept",icon:Me,tip:"Looks right \u2014 mark it resolved",main:!0,label:"Looks right"}],a=Hr(t),r=!Jt(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":vn(t.assignee).split(" ")[0]:"",l=[a?.step&&`last: ${a.step}`,a?.stale&&"next run retries"].filter(Boolean).join(" \xB7 "),d=e==="queued"?{step:e,title:"With the agent \u2014 queued",sub:"Starts on the agent\u2019s next run",acts:[]}:e==="working"?a?.step?{step:e,title:"",now:a.step,time:a.elapsed,acts:[],live:!0}:{step:e,title:"With the agent \u2014 working",acts:[],live:!0}:e==="asks"?null:e==="stuck"?{step:e,title:`Silent for ${a?.silent??"a while"}`,sub:l&&l[0].toUpperCase()+l.slice(1),acts:[s]}:e==="review"?null:qe(t)==="review"&&r?{step:"review",title:`${r} ${r==="You"?"say":"says"} done`,acts:o}:null;if(!d)return"";let u=d.step==="review"?Ye(_n[2][2],_n[2][3]):`<i class="dt-step-mark">${De(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${u}${d.now?`${_p}<span class="dt-step-text" aria-live="polite"><b>${Wp(t.id,d.now)}</b></span>`:`<span class="dt-step-text"><b>${f(d.title)}</b>${d.sub?`<span>${f(d.sub)}</span>`:""}</span>`}${d.acts.map(h=>h.pick?`<label class="dt-step-act" data-tip="${f(h.tip)}">${h.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${f(h.tip)}"><option value="" selected hidden></option>${no().map($=>cl($.email,$.email===n.me?.email?`Me \xB7 ${$.name||$.email}`:$.name||$.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${h.main?" is-main":""}${h.label?" has-label":""}" data-act="${h.act}" data-id="${t.id}"${h.v?` data-v="${h.v}"`:""} data-tip="${f(h.tip)}" aria-label="${f(h.tip)}">${h.icon}${h.label?f(h.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},Vp=async(t,e,s)=>Q(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...s}),cs=0,Bl=()=>{},zn=t=>(cs++,t.finally(()=>{cs--,Bl()})),dn=async(t,e,s)=>{let o=j,a=bt;j=t(j),bt=t(bt),J();let r;at=o;try{r=e()}finally{at=null}let l=await zn(r).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let h=Gn([d.thread])[0];j=(cs?j:o).map(B=>h&&B.id===h.id?h:B),bt=(cs?bt:a).map(B=>h&&B.id===h.id?h:B),J();let $=d.by?d.by==="claude"?"The agent":vn(d.by):"Someone";Kt(`${$[0].toUpperCase()}${$.slice(1)} changed the ${d.field} just now`,6e3),nn();return}if(!l?.ok){cs?nn():(j=o,bt=a,J()),Kn(`${s} did not go through`,l);return}let u=Gn([await l.json().catch(()=>null)])[0];u&&(j=j.map(h=>h.id===u.id?u:h),bt=bt.map(h=>h.id===u.id?u:h),J()),nn()},Gp=t=>t?Jt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!It(t)&&!n.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},Rl=async(t,e)=>{let s=[];for(let o=0;o<t.length;o+=6)s.push(...await Promise.all(t.slice(o,o+6).map(e)));return s},tn=async(t,e)=>{let s=e?void 0:Gp(j.find(l=>l.id===t)??bt.find(l=>l.id===t));await dn(l=>l.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{confirmedBy:n.me?.email??null}:{...s,confirmedBy:null,reopenedAt:new Date().toISOString(),reopenedBy:n.me?.email??"you"}}:d),()=>Vp(t,e,s),e?"Resolving":"Reopening");let o=bt.find(l=>l.id===t),a=e?qc(o):null,r=a!=null&&bt.find(l=>l.id===a);r&&It(r)&&r.status!=="done"&&(await Q({id:r.id,reply:Oc,status:"done",doneBy:"you"}).catch(()=>null),nn())},us=async(t,e,s=!1)=>{let o=j.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await dn(r=>r.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?n.me?.email:void 0}:l),()=>Q({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!s&&Oe(`Archived #${t}`,()=>us(t,!1,!0))},Oe=(t,e,s="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${f(t)}</span><button type="button">${f(s)}</button>`,Ya(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>ss(o,()=>o.remove()),5e3)},fa=new Set,ba=new Set,lo=new Map,Pl=(t,e,s,o,a)=>{lo.get(t)?.(),s();let r=!1,l=()=>{r||(r=!0,clearTimeout(d),lo.delete(t),a())},d=window.setTimeout(l,5e3);lo.set(t,l),Oe(e,()=>{r||(r=!0,clearTimeout(d),lo.delete(t),o())})};addEventListener("pagehide",()=>{for(let t of[...lo.values()])t()});let Il=(t,e,s)=>!e||t.some(o=>o.id===e.id)?t:[...t.slice(0,s),e,...t.slice(s)],Bi=t=>{let e=j.find(r=>r.id===t),s=j.findIndex(r=>r.id===t),o=bt.find(r=>r.id===t),a=bt.findIndex(r=>r.id===t);Pl(`t${t}`,`Thread #${t} deleted`,()=>{fa.add(t),j=j.filter(r=>r.id!==t),bt=bt.filter(r=>r.id!==t),J()},()=>{fa.delete(t),j=Il(j,e,s),bt=Il(bt,o,a),J()},async()=>{let r=await zn(oe(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);fa.delete(t),r?.ok||Kn("Deleting did not go through",r),nn()})},Kp=(t,e)=>{let s=`${t}|${e}`,o=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=o(j)??o(bt);if(!a)return;let r=(l,d)=>l.map(u=>u.id!==t?u:{...u,replies:(u.replies??[]).map(h=>h.at===e?d(h):h)});Pl(`r${s}`,"Reply deleted",()=>{ba.add(s),j=r(j,l=>({...l,text:"",deleted:!0})),bt=r(bt,l=>({...l,text:"",deleted:!0})),J()},()=>{ba.delete(s),j=r(j,()=>a),bt=r(bt,()=>a),J()},async()=>{let l=await zn(Q({id:t,unsay:e})).catch(()=>null);ba.delete(s),l?.ok||Kn("Deleting the reply did not go through",l),nn()})},Hs=null,Ol=t=>Math.max(70,t*18),ql=t=>{let e=Bt(t),s=oo.find(o=>o[0]===t.priority)?.[3]??1;return(t.id===Y?-100:0)+(Se(t)?30:e==="done"?20:e==="claude"?10:0)-s},Up=(t,e)=>{let s=[];for(let a of t){let r=e.get(a.id);if(!r)continue;let l=s.find(d=>{let u=e.get(d[0].id);return Math.abs(u.x-r.x)<6&&Math.abs(u.y-r.y)<6});l?l.push(a):s.push([a])}let o=new Map;for(let a of s){if(a.length<2)continue;a.sort((u,h)=>ql(u)-ql(h)||h.id-u.id);let r=a.length,l=Ol(r),d=String(a[0].id);a.forEach((u,h)=>{let $=(-150+120*h/(r-1))*(Math.PI/180);o.set(u.id,{key:d,i:h,n:r,fx:Math.round(l*Math.cos($))-14,fy:Math.round(l*Math.sin($))+4})})}return o},Ri=t=>{if(Hs!==t){Hs=t;for(let e of et.querySelectorAll(".dt-pin[data-stack]"))e.classList.toggle("is-fanned",e.dataset.stack===t)}};document.addEventListener("pointermove",t=>{if(!Hs){let r=t.target?.closest?.(".dt-pin--stacktop");r&&t.pointerType==="mouse"&&Ri(r.dataset.stack);return}let e=et.querySelector(`.dt-pin--stacktop[data-stack="${Hs}"]`);if(!e){Hs=null;return}let s=parseFloat(e.style.left),o=parseFloat(e.style.top),a=Number(e.querySelector(".dt-pin-count")?.textContent)||2;Math.hypot(t.clientX-s,t.clientY-(o-40))>Ol(a)+36&&Ri(null)},{passive:!0}),et.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),Ri(e.dataset.stack))},!0);let Yp=(t,e)=>{let s=e||M||R?[]:m.filter(d=>d.id!==t).map(d=>({band:d,n:j.filter(u=>v(u)===d.id&&Ko(u)&&An(u)).length})).filter(d=>d.n).sort((d,u)=>u.n-d.n);if(ve.hidden=!s.length,!s.length)return;let[o,...a]=s,r=({band:d,n:u})=>`${u} ${u===1?"pin":"pins"} on ${d.label}`;ve.dataset.bp=o.band.id;let l=`${xt(o.band.icon,15)}<span>${f(r(o))}</span>${za}`;ve.dataset.html!==l&&(ve.innerHTML=l,ve.dataset.html=l),ve.dataset.tip=a.length?`Also ${a.map(r).join(", ")}`:`Switch to ${o.band.label}`,ve.setAttribute("aria-label",`${r(o)} \u2014 switch to ${o.band.label}`)};ve.addEventListener("click",()=>{ve.dataset.bp&&cr(ve.dataset.bp)});let Xp=t=>{let e=j.filter(a=>v(a)===t),s=e.filter(a=>Bt(a)==="open").length,o=e.filter(a=>Bt(a)==="claude").length;Ua.innerHTML=s?String(s):o?De(9):"\u2713",Ua.dataset.state=s?"open":o?"claude":"done",Ua.hidden=e.length===0},co=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t||(t.style.translate="",ps))return;let e=window.visualViewport,s=t.getBoundingClientRect(),o=s.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,s.top-8)}px`)},Dl=window.visualViewport?.height??innerHeight,Fl=()=>{let t=window.visualViewport?.height??innerHeight,e=t<Dl;if(Dl=t,!e||!et.querySelector(".dt-note"))return co();J();let s=document.activeElement?.closest(".dt-note.is-capped");s&&(s.scrollTop=s.scrollHeight)};window.visualViewport?.addEventListener("resize",Fl),addEventListener("resize",Fl),document.addEventListener("focusin",co),document.addEventListener("focusout",()=>setTimeout(co));let ya=()=>{let t=window.visualViewport;return Math.min(innerHeight,t?t.offsetTop+t.height:innerHeight,document.querySelector(".devtools:not([data-collapsed])")?.getBoundingClientRect().top??innerHeight)-8},Pi=!1,jl=null,Jp=()=>{if(Y===jl||(jl=Y,rt.hasAttribute("data-collapsed")&&!Pi))return;let t=Y!=null?j.find(o=>o.id===Y):void 0,e=t&&Ce(t),s=!1;if(e){rt.removeAttribute("data-collapsed");let o=rt.getBoundingClientRect();s=!!o.width&&e.x>o.left-12&&e.x<o.right&&(ps||e.y>o.top&&e.y<o.bottom)}Pi=s,rt.toggleAttribute("data-collapsed",s)},_l=t=>{let e=rt.hidden?null:rt.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},Wl=(t,e=ya())=>{if(t.style.marginTop="",ps)return;let s=parseFloat(getComputedStyle(t).marginTop)||0,o=t.getBoundingClientRect().bottom-e;o>0&&(t.style.marginTop=`${s-o}px`);let a=t.getBoundingClientRect().top;a<8&&(t.style.marginTop=`${(parseFloat(t.style.marginTop)||s)+8-a}px`)},Ii=t=>{let e=ya();for(let s of et.querySelectorAll(".dt-note")){let o=s.querySelector(".dt-note-thread");o&&o.scrollTop+o.clientHeight>=o.scrollHeight-4&&t.push(o);let a=s.scrollTop;delete s.dataset.flip,delete s.dataset.flipx,o?.style.removeProperty("max-height");for(let $ of["max-height","overflow-y","margin-top","translate"])s.style.removeProperty($);s.classList.remove("is-capped");let r=s.getBoundingClientRect(),l=r.top,d=e-l,u=l-28;if(r.bottom>e&&u>d&&(s.dataset.flip="1"),r.right>_l(r)-8&&(s.dataset.flipx="1"),s.style.marginLeft="",s.dataset.flipx&&innerWidth>=480){let $=s.getBoundingClientRect(),B=_l($);$.right>B-8&&(s.style.marginLeft=`${(parseFloat(getComputedStyle(s).marginLeft)||0)-($.right-B+8)}px`)}r=s.getBoundingClientRect();let h=s.dataset.flip?r.height-(e-8):r.bottom-e;h>0&&o&&(o.style.maxHeight=`${Math.max(40,o.clientHeight-h)}px`),s.getBoundingClientRect().height>e-8&&(Object.assign(s.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),s.classList.add("is-capped"),Gr.has(s)?s.scrollTop=a:(Gr.add(s),s.scrollTop=s.scrollHeight)),Wl(s,e)}for(let s of t)s.scrollTop=s.scrollHeight},zl=0,ps=!1,va=t=>{t?.target?.closest?.(Xs)||(clearTimeout(zl),zl=window.setTimeout(()=>{ps=!1,et.querySelector(".dt-note")&&(Ii([]),requestAnimationFrame(co),en())},ps?300:150))},J=()=>{for(let p of Object.keys(We))p!==String(Y)&&delete We[p];for(let p of Ss.keys())p!==Y&&Ss.delete(p);if(requestAnimationFrame(co),rs(),M){let p=Hl(),V=JSON.stringify(p);V!==Cl&&(Cl=V,parent.postMessage({dt:!0,drafts:p},location.origin))}if(Xr(),rt.toggleAttribute("data-yield",Y!=null||!!R),Y!==bn){bn!=null&&(Re||Le.length)?Ja.set(bn,{text:Re,images:[...Le]}):bn!=null&&Ja.delete(bn);let p=Y!=null?Ja.get(Y):void 0;Re=p?.text??"",Le=p?[...p.images]:[],bn=Y}te&&te.id!==Y&&(te=null);let t=Xt();if(Xp(t),Qa(),!Yt){et.innerHTML="",li(null),Xe.hidden=!0,ve.hidden=!0;return}let e=t;if(Y!=null&&!R){let p=j.find(V=>V.id===Y);p&&v(p)!==e&&(Y=null)}Jp();let s="",o=j.filter(p=>v(p)===e&&(Ko(p)&&An(p)||p.id===Y)),a=new Map(o.map(p=>[p.id,Ce(p)])),r=Up(o,a);ta="";for(let p of o){let V=a.get(p.id)??null,Z=r.get(p.id),qt=ai(p),Ot=Qr(p,qt)?"later":qt;Ot==="later"&&(eo=Math.min(eo??1/0,p.spot?.y??document.documentElement.scrollHeight)),p.id===Y&&(ta=Ot+(V?"":" \xB7 no pin"));let ie=!V&&!!p.spot&&Bt(p)==="open"&&Ot==="gone";if(!V&&!ie&&Y!==p.id)continue;let pt=Bt(p),St=!V,gt=V??(ie?{x:p.spot.x-scrollX,y:p.spot.y-scrollY}:{x:0,y:0});Ot!=="later"&&Yu(p,pt==="open"?Ot:"found"),ie&&(s+=`<button class="dt-pin dt-pin--ghost" data-id="${p.id}" aria-expanded="${Y===p.id}" aria-label="Thread ${p.id}, its element is gone" title="${f(Zt(p.text,80))} \xB7 its element is gone \u2014 click to see what it was" style="left:${gt.x}px;top:${gt.y}px"></button>`);let kt=Ks(p.category),Nt=hn(p),Te=pt==="done"?null:Ee(p),re=Te?aa[Te]??"":"",le=Co(p,pt),Rn=!!le&&!le.taker,de=!!le&&!!le.taker&&le.taker!==le.writer,Ne=pt==="done"?Co(p,"open"):null,Ia=!!Ne&&!Ne.claude&&!!Ne.taker&&Ne.taker!==Ne.writer,ko=re||_n.find(Mn=>Mn[0]===ds(p))[2],js=le?Rn?` \xB7 ${mi(le.writer,p)} \xB7 anyone can take it`:` \xB7 ${de?`${mi(le.writer,p)} \u2192 `:""}${mi(le.taker,p)}${le.claude?` \xB7 ${Nn(p)}${gi(p)}`:""}`:"";if(Y===p.id&&(Ss.has(p.id)||Ss.set(p.id,Math.max(2,an(p).length-(jn[p.id]??an(p).length))),ll(p)),St||(s+=`<button class="dt-pin dt-pin--${pt}${pt==="done"&&!Se(p)?" dt-pin--resolved":""}${le?` dt-pin--people${de?" dt-pin--pair":""}`:Ia?" dt-pin--people dt-pin--pair":re?" dt-pin--agent":""}${Nt?" dt-pin--working":""}${pt==="open"&&qe(p)==="review"?" dt-pin--review":""}${V?.hidden||V?.opener?" dt-pin--hidden":""}${V?.opener?" dt-pin--inside":""}${Y!==p.id&&!gl(p,Hn)?" dt-pin--dim":""}${Z?` dt-pin--stack${Z.i?"":" dt-pin--stacktop"}${Hs===Z.key?" is-fanned":""}`:""}" data-id="${p.id}"${Z?` data-stack="${Z.key}"`:""} aria-label="Thread ${p.id}, ${pt==="open"?"open":pt==="claude"?`resolved by ${f(Zn(p.doneAgent,p.doneFor))}`:"resolved"}${f(js.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!le&&re?`, with ${f(Nn(p))}`:""}${V?.hidden?Wo:""}" aria-expanded="${Y===p.id}"
281
- style="left:${gt.x}px;top:${gt.y}px;--cat:${kt.color};--ring:${ko};--hue:${Ie(p.by||p.byName||"")}${re?`;--step-c:${re}`:""}${qi.has(p.id)?`;--dt-page:${qi.get(p.id)}`:""}${Z?`;--fx:${Z.fx}px;--fy:${Z.fy}px`:""}"
282
- title="${f(Zt(p.text,80))} \xB7 ${kt.label}${le?f(js):Nt||Te==="queued"?` \xB7 ${f(Nn(p)+gi(p))}`:""}${pt==="claude"?` \xB7 resolved by ${f(Zn(p.doneAgent,p.doneFor))} \u2014 tick to confirm`:pt==="done"?" \xB7 resolved":""}${V?.hidden||V?.opener?Wo:""}${Is(p)?" \u2014 drag to move":""}"${Is(p)?" data-move":""}>${pt==="done"?Ne?`${wn(Ne.writer,p)}${Ia?wn(Ne.taker,p):""}<i class="dt-pin-cut" aria-hidden="true">${Me}</i>`:"\u2713":le?`${wn(le.writer,p)}${de?wn(le.taker,p):""}${le.claude?`<i class="dt-pin-claude" aria-hidden="true">${De(9)}</i>`:""}`:re?De(11):ui(p)}${Y!==p.id&&rl(p)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}${Z&&!Z.i?`<i class="dt-pin-count" aria-hidden="true">${Z.n}</i><i class="dt-pin-spot" aria-hidden="true"></i>`:""}</button><i class="dt-pin-eye" data-eye="${p.id}" aria-hidden="true" style="left:${gt.x}px;top:${gt.y}px"${V?.hidden||V?.opener?"":" hidden"}>${ao}</i>`),Y===p.id){let Mn=an(p),_s=Ee(p)==="review"&&!n.client?Mn.map($t=>$t.author).lastIndexOf("claude"):-1,Ws=Ee(p)==="asks"&&!n.client?Mn.length-1:-1;s+=`<div class="dt-note${St?" dt-note--orphan":""}" data-id="${p.id}" role="dialog" aria-label="Thread ${p.id}"
283
- style="left:${gt.x}px;top:${gt.y}px">
279
+ </div></div>`,ga=(t,e,s)=>(t||/^[a-z][a-z0-9-]*/i.exec(s?.split(">").pop()?.trim()??"")?.[0]||"element")+(e?.[0]?"."+e[0]:""),Hl=()=>ze.map((t,e)=>({i:e,el:ga(t.tag,t.classes,t.selector),text:re(t.text??""),shots:t.images?.length??0,orphan:!Ce(t)})),Ci=[],Cl="",Nn=t=>{let e=t.working;return Zn(e?.agent,e?.by??t.doneFor)},jp=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`},fa=(t,e)=>{let s=t.working;return{queued:"Queued for the agent \u2014 it takes it on its next run",asks:`${Nn(t)} is waiting for your answer`,working:`${Nn(t)} is on it \xB7 ${jp(s?.at)}`,stuck:`${Nn(t)} went quiet \u2014 its next run takes it again`,review:`To check \u2014 ${Zn(t.doneAgent,t.doneFor)} fixed it \xB7 click to reopen`,done:"Resolved"}[e]},_p=t=>{if(n.client||Bt(t))return"";let e=Ee(t);if(!e)return 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 the agent" aria-label="Hand to the agent">${Rr(13,0)}</button>`;let s=Rr(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${f(fa(t,e))}" aria-label="${f(fa(t,e))}">${s}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${f(fa(t,e))}" role="img" aria-label="${f(fa(t,e))}">${s}</span>`},As=t=>!!n.client&&!(n.me&&t.by===n.me.email),Nl=(t,e=!0,s=!0)=>{let o=Ct(t),a=o==="done",r=Se(t);return`${e?_p(t):""}<button data-act="${a?"reopen":"done"}" data-id="${t.id}"
280
+ class="dt-note-resolve${a&&!r?" is-on":""}" title="${a?"Reopen":o==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${Me}</button>${n.client||!s?"":`<button data-act="${r?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${r?" is-on":""}" title="${r?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${kn}</button>`}`},Wp='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',Ni=new Map,zp=(t,e)=>{let s=Ar(e,25),o=Ni.get(t);o?.now!==s&&Ni.set(t,{now:s,was:o?.now??"",at:performance.now()});let a=Ni.get(t),r=a.was&&performance.now()-a.at<160?a.was:"";return`<span class="dt-step-words">${r?`<span class="dt-step-was" data-k="was:${f(r)}" aria-hidden="true">${f(r)}</span>`:""}<span class="dt-step-now" data-k="${f(s)}"${s!==e?` data-tip="${f(e)}"`:""}>${f(s)}</span></span>`},Vp=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!Se(t)){let u=t.confirmedBy?t.confirmedBy===n.me?.email?"you":yn(t.confirmedBy).split(" ")[0]:"",b=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${Ye(Wn[Wn.length-1][2],1)}<span class="dt-step-text"><b>${f(u?`Resolved by ${u}`:"Resolved")}${b?` \xB7 ${f(Br(b))}`:""}</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">${gn}</button>`+(n.client?"</div>":`<button type="button" class="dt-step-act" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${kn}</button></div>`)}if(n.client||Bt(t))return"";let e=Ee(t),s={act:"hand",v:"me",icon:bl,tip:n.me?"Take it myself":"Take it off the agent"},o=[{act:"sendback",icon:gn,tip:"Send it back \u2014 say what is wrong below"},{act:"accept",icon:Me,tip:"Looks right \u2014 mark it resolved",main:!0,label:"Looks right"}],a=Hr(t),r=!Xt(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":yn(t.assignee).split(" ")[0]:"",l=[a?.step&&`last: ${a.step}`,a?.stale&&"next run retries"].filter(Boolean).join(" \xB7 "),d=e==="queued"?{step:e,title:"With the agent \u2014 queued",sub:"Starts on the agent\u2019s next run",acts:[]}:e==="working"?a?.step?{step:e,title:"",now:a.step,time:a.elapsed,acts:[],live:!0}:{step:e,title:"With the agent \u2014 working",acts:[],live:!0}:e==="asks"?null:e==="stuck"?{step:e,title:`Silent for ${a?.silent??"a while"}`,sub:l&&l[0].toUpperCase()+l.slice(1),acts:[s]}:e==="review"?null:De(t)==="review"&&r?{step:"review",title:`${r} ${r==="You"?"say":"says"} done`,acts:o}:null;if(!d)return"";let p=d.step==="review"?Ye(_n[2][2],_n[2][3]):`<i class="dt-step-mark">${Fe(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${p}${d.now?`${Wp}<span class="dt-step-text" aria-live="polite"><b>${zp(t.id,d.now)}</b></span>`:`<span class="dt-step-text"><b>${f(d.title)}</b>${d.sub?`<span>${f(d.sub)}</span>`:""}</span>`}${d.acts.map(u=>u.pick?`<label class="dt-step-act" data-tip="${f(u.tip)}">${u.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${f(u.tip)}"><option value="" selected hidden></option>${no().map(b=>cl(b.email,b.email===n.me?.email?`Me \xB7 ${b.name||b.email}`:b.name||b.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${u.main?" is-main":""}${u.label?" has-label":""}" data-act="${u.act}" data-id="${t.id}"${u.v?` data-v="${u.v}"`:""} data-tip="${f(u.tip)}" aria-label="${f(u.tip)}">${u.icon}${u.label?f(u.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},Gp=async(t,e,s)=>tt(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...s}),cs=0,Bl=()=>{},zn=t=>(cs++,t.finally(()=>{cs--,Bl()})),dn=async(t,e,s)=>{let o=j,a=yt;j=t(j),yt=t(yt),Z();let r;dt=o;try{r=e()}finally{dt=null}let l=await zn(r).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let u=Gn([d.thread])[0];j=(cs?j:o).map(T=>u&&T.id===u.id?u:T),yt=(cs?yt:a).map(T=>u&&T.id===u.id?u:T),Z();let b=d.by?d.by==="claude"?"The agent":yn(d.by):"Someone";Gt(`${b[0].toUpperCase()}${b.slice(1)} changed the ${d.field} just now`,6e3),nn();return}if(!l?.ok){cs?nn():(j=o,yt=a,Z()),Kn(`${s} did not go through`,l);return}let p=Gn([await l.json().catch(()=>null)])[0];p&&(j=j.map(u=>u.id===p.id?p:u),yt=yt.map(u=>u.id===p.id?p:u),Z()),nn()},Kp=t=>t?Xt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!Bt(t)&&!n.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},Rl=async(t,e)=>{let s=[];for(let o=0;o<t.length;o+=6)s.push(...await Promise.all(t.slice(o,o+6).map(e)));return s},tn=async(t,e)=>{let s=e?void 0:Kp(j.find(l=>l.id===t)??yt.find(l=>l.id===t));await dn(l=>l.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{confirmedBy:n.me?.email??null}:{...s,confirmedBy:null,reopenedAt:new Date().toISOString(),reopenedBy:n.me?.email??"you"}}:d),()=>Gp(t,e,s),e?"Resolving":"Reopening");let o=yt.find(l=>l.id===t),a=e?Dc(o):null,r=a!=null&&yt.find(l=>l.id===a);r&&Bt(r)&&r.status!=="done"&&(await tt({id:r.id,reply:qc,status:"done",doneBy:"you"}).catch(()=>null),nn())},us=async(t,e,s=!1)=>{let o=j.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await dn(r=>r.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?n.me?.email:void 0}:l),()=>tt({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!s&&qe(`Archived #${t}`,()=>us(t,!1,!0))},qe=(t,e,s="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${f(t)}</span><button type="button">${f(s)}</button>`,Ya(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>ss(o,()=>o.remove()),5e3)},ba=new Set,ya=new Set,lo=new Map,Pl=(t,e,s,o,a)=>{lo.get(t)?.(),s();let r=!1,l=()=>{r||(r=!0,clearTimeout(d),lo.delete(t),a())},d=window.setTimeout(l,5e3);lo.set(t,l),qe(e,()=>{r||(r=!0,clearTimeout(d),lo.delete(t),o())})};addEventListener("pagehide",()=>{for(let t of[...lo.values()])t()});let Il=(t,e,s)=>!e||t.some(o=>o.id===e.id)?t:[...t.slice(0,s),e,...t.slice(s)],Bi=t=>{let e=j.find(r=>r.id===t),s=j.findIndex(r=>r.id===t),o=yt.find(r=>r.id===t),a=yt.findIndex(r=>r.id===t);Pl(`t${t}`,`Thread #${t} deleted`,()=>{ba.add(t),j=j.filter(r=>r.id!==t),yt=yt.filter(r=>r.id!==t),Z()},()=>{ba.delete(t),j=Il(j,e,s),yt=Il(yt,o,a),Z()},async()=>{let r=await zn(ie(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);ba.delete(t),r?.ok||Kn("Deleting did not go through",r),nn()})},Up=(t,e)=>{let s=`${t}|${e}`,o=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=o(j)??o(yt);if(!a)return;let r=(l,d)=>l.map(p=>p.id!==t?p:{...p,replies:(p.replies??[]).map(u=>u.at===e?d(u):u)});Pl(`r${s}`,"Reply deleted",()=>{ya.add(s),j=r(j,l=>({...l,text:"",deleted:!0})),yt=r(yt,l=>({...l,text:"",deleted:!0})),Z()},()=>{ya.delete(s),j=r(j,()=>a),yt=r(yt,()=>a),Z()},async()=>{let l=await zn(tt({id:t,unsay:e})).catch(()=>null);ya.delete(s),l?.ok||Kn("Deleting the reply did not go through",l),nn()})},Hs=null,Ol=t=>Math.max(70,t*18),ql=t=>{let e=Ct(t),s=oo.find(o=>o[0]===t.priority)?.[3]??1;return(t.id===X?-100:0)+(Se(t)?30:e==="done"?20:e==="claude"?10:0)-s},Yp=(t,e)=>{let s=[];for(let a of t){let r=e.get(a.id);if(!r)continue;let l=s.find(d=>{let p=e.get(d[0].id);return Math.abs(p.x-r.x)<6&&Math.abs(p.y-r.y)<6});l?l.push(a):s.push([a])}let o=new Map;for(let a of s){if(a.length<2)continue;a.sort((p,u)=>ql(p)-ql(u)||u.id-p.id);let r=a.length,l=Ol(r),d=String(a[0].id);a.forEach((p,u)=>{let b=(-150+120*u/(r-1))*(Math.PI/180);o.set(p.id,{key:d,i:u,n:r,fx:Math.round(l*Math.cos(b))-14,fy:Math.round(l*Math.sin(b))+4})})}return o},Ri=t=>{if(Hs!==t){Hs=t;for(let e of nt.querySelectorAll(".dt-pin[data-stack]"))e.classList.toggle("is-fanned",e.dataset.stack===t)}};document.addEventListener("pointermove",t=>{if(!Hs){let r=t.target?.closest?.(".dt-pin--stacktop");r&&t.pointerType==="mouse"&&Ri(r.dataset.stack);return}let e=nt.querySelector(`.dt-pin--stacktop[data-stack="${Hs}"]`);if(!e){Hs=null;return}let s=parseFloat(e.style.left),o=parseFloat(e.style.top),a=Number(e.querySelector(".dt-pin-count")?.textContent)||2;Math.hypot(t.clientX-s,t.clientY-(o-40))>Ol(a)+36&&Ri(null)},{passive:!0}),nt.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),Ri(e.dataset.stack))},!0);let Xp=(t,e)=>{let s=e||k||B?[]:h.filter(d=>d.id!==t).map(d=>({band:d,n:j.filter(p=>w(p)===d.id&&Uo(p)&&An(p)).length})).filter(d=>d.n).sort((d,p)=>p.n-d.n);if(ye.hidden=!s.length,!s.length)return;let[o,...a]=s,r=({band:d,n:p})=>`${p} ${p===1?"pin":"pins"} on ${d.label}`;ye.dataset.bp=o.band.id;let l=`${$t(o.band.icon,15)}<span>${f(r(o))}</span>${Va}`;ye.dataset.html!==l&&(ye.innerHTML=l,ye.dataset.html=l),ye.dataset.tip=a.length?`Also ${a.map(r).join(", ")}`:`Switch to ${o.band.label}`,ye.setAttribute("aria-label",`${r(o)} \u2014 switch to ${o.band.label}`)};ye.addEventListener("click",()=>{ye.dataset.bp&&cr(ye.dataset.bp)});let Jp=t=>{let e=j.filter(a=>w(a)===t),s=e.filter(a=>Ct(a)==="open").length,o=e.filter(a=>Ct(a)==="claude").length;Ua.innerHTML=s?String(s):o?Fe(9):"\u2713",Ua.dataset.state=s?"open":o?"claude":"done",Ua.hidden=e.length===0},co=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t||(t.style.translate="",ps))return;let e=window.visualViewport,s=t.getBoundingClientRect(),o=s.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,s.top-8)}px`)},Dl=window.visualViewport?.height??innerHeight,Fl=()=>{let t=window.visualViewport?.height??innerHeight,e=t<Dl;if(Dl=t,!e||!nt.querySelector(".dt-note"))return co();Z();let s=document.activeElement?.closest(".dt-note.is-capped");s&&(s.scrollTop=s.scrollHeight)};window.visualViewport?.addEventListener("resize",Fl),addEventListener("resize",Fl),document.addEventListener("focusin",co),document.addEventListener("focusout",()=>setTimeout(co));let va=()=>{let t=window.visualViewport;return Math.min(innerHeight,t?t.offsetTop+t.height:innerHeight,document.querySelector(".devtools:not([data-collapsed])")?.getBoundingClientRect().top??innerHeight)-8},Pi=!1,jl=null,Zp=()=>{if(X===jl||(jl=X,it.hasAttribute("data-collapsed")&&!Pi))return;let t=X!=null?j.find(o=>o.id===X):void 0,e=t&&Ce(t),s=!1;if(e){it.removeAttribute("data-collapsed");let o=it.getBoundingClientRect();s=!!o.width&&e.x>o.left-12&&e.x<o.right&&(ps||e.y>o.top&&e.y<o.bottom)}Pi=s,it.toggleAttribute("data-collapsed",s)},_l=t=>{let e=it.hidden?null:it.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},Wl=(t,e=va())=>{if(t.style.marginTop="",ps)return;let s=parseFloat(getComputedStyle(t).marginTop)||0,o=t.getBoundingClientRect().bottom-e;o>0&&(t.style.marginTop=`${s-o}px`);let a=t.getBoundingClientRect().top;a<8&&(t.style.marginTop=`${(parseFloat(t.style.marginTop)||s)+8-a}px`)},Ii=t=>{let e=va();for(let s of nt.querySelectorAll(".dt-note")){let o=s.querySelector(".dt-note-thread");o&&o.scrollTop+o.clientHeight>=o.scrollHeight-4&&t.push(o);let a=s.scrollTop;delete s.dataset.flip,delete s.dataset.flipx,o?.style.removeProperty("max-height");for(let b of["max-height","overflow-y","margin-top","translate"])s.style.removeProperty(b);s.classList.remove("is-capped");let r=s.getBoundingClientRect(),l=r.top,d=e-l,p=l-28;if(r.bottom>e&&p>d&&(s.dataset.flip="1"),r.right>_l(r)-8&&(s.dataset.flipx="1"),s.style.marginLeft="",s.dataset.flipx&&innerWidth>=480){let b=s.getBoundingClientRect(),T=_l(b);b.right>T-8&&(s.style.marginLeft=`${(parseFloat(getComputedStyle(s).marginLeft)||0)-(b.right-T+8)}px`)}r=s.getBoundingClientRect();let u=s.dataset.flip?r.height-(e-8):r.bottom-e;u>0&&o&&(o.style.maxHeight=`${Math.max(40,o.clientHeight-u)}px`),s.getBoundingClientRect().height>e-8&&(Object.assign(s.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),s.classList.add("is-capped"),Gr.has(s)?s.scrollTop=a:(Gr.add(s),s.scrollTop=s.scrollHeight)),Wl(s,e)}for(let s of t)s.scrollTop=s.scrollHeight},zl=0,ps=!1,wa=t=>{t?.target?.closest?.(Xs)||(clearTimeout(zl),zl=window.setTimeout(()=>{ps=!1,nt.querySelector(".dt-note")&&(Ii([]),requestAnimationFrame(co),en())},ps?300:150))},Z=()=>{for(let m of Object.keys(We))m!==String(X)&&delete We[m];for(let m of Ss.keys())m!==X&&Ss.delete(m);if(requestAnimationFrame(co),rs(),k){let m=Hl(),_=JSON.stringify(m);_!==Cl&&(Cl=_,parent.postMessage({dt:!0,drafts:m},location.origin))}if(Xr(),it.toggleAttribute("data-yield",X!=null||!!B),X!==fn){fn!=null&&(Pe||Le.length)?Ja.set(fn,{text:Pe,images:[...Le]}):fn!=null&&Ja.delete(fn);let m=X!=null?Ja.get(X):void 0;Pe=m?.text??"",Le=m?[...m.images]:[],fn=X}te&&te.id!==X&&(te=null);let t=Yt();if(Jp(t),Qa(),!Ut){nt.innerHTML="",li(null),Xe.hidden=!0,ye.hidden=!0;return}let e=t;if(X!=null&&!B){let m=j.find(_=>_.id===X);m&&w(m)!==e&&(X=null)}Zp();let s="",o=j.filter(m=>w(m)===e&&(Uo(m)&&An(m)||m.id===X)),a=new Map(o.map(m=>[m.id,Ce(m)])),r=Yp(o,a);ea="";for(let m of o){let _=a.get(m.id)??null,Q=r.get(m.id),Ot=ai(m),Pt=Qr(m,Ot)?"later":Ot;Pt==="later"&&(eo=Math.min(eo??1/0,m.spot?.y??document.documentElement.scrollHeight)),m.id===X&&(ea=Pt+(_?"":" \xB7 no pin"));let le=!_&&!!m.spot&&Ct(m)==="open"&&Pt==="gone";if(!_&&!le&&X!==m.id)continue;let mt=Ct(m),Tt=!_,bt=_??(le?{x:m.spot.x-scrollX,y:m.spot.y-scrollY}:{x:0,y:0});Pt!=="later"&&Xu(m,mt==="open"?Pt:"found"),le&&(s+=`<button class="dt-pin dt-pin--ghost" data-id="${m.id}" aria-expanded="${X===m.id}" aria-label="Thread ${m.id}, its element is gone" title="${f(Jt(m.text,80))} \xB7 its element is gone \u2014 click to see what it was" style="left:${bt.x}px;top:${bt.y}px"></button>`);let kt=Ks(m.category),Ht=hn(m),Te=mt==="done"?null:Ee(m),de=Te?ia[Te]??"":"",ce=Co(m,mt),Rn=!!ce&&!ce.taker,ue=!!ce&&!!ce.taker&&ce.taker!==ce.writer,Ne=mt==="done"?Co(m,"open"):null,Oa=!!Ne&&!Ne.claude&&!!Ne.taker&&Ne.taker!==Ne.writer,ko=de||_n.find(En=>En[0]===ds(m))[2],js=ce?Rn?` \xB7 ${mi(ce.writer,m)} \xB7 anyone can take it`:` \xB7 ${ue?`${mi(ce.writer,m)} \u2192 `:""}${mi(ce.taker,m)}${ce.claude?` \xB7 ${Nn(m)}${gi(m)}`:""}`:"";if(X===m.id&&(Ss.has(m.id)||Ss.set(m.id,Math.max(2,an(m).length-(jn[m.id]??an(m).length))),ll(m)),Tt||(s+=`<button class="dt-pin dt-pin--${mt}${mt==="done"&&!Se(m)?" dt-pin--resolved":""}${ce?` dt-pin--people${ue?" dt-pin--pair":""}`:Oa?" dt-pin--people dt-pin--pair":de?" dt-pin--agent":""}${Ht?" dt-pin--working":""}${mt==="open"&&De(m)==="review"?" dt-pin--review":""}${_?.hidden||_?.opener?" dt-pin--hidden":""}${_?.opener?" dt-pin--inside":""}${X!==m.id&&!gl(m,Hn)?" dt-pin--dim":""}${Q?` dt-pin--stack${Q.i?"":" dt-pin--stacktop"}${Hs===Q.key?" is-fanned":""}`:""}" data-id="${m.id}"${Q?` data-stack="${Q.key}"`:""} aria-label="Thread ${m.id}, ${mt==="open"?"open":mt==="claude"?`resolved by ${f(Zn(m.doneAgent,m.doneFor))}`:"resolved"}${f(js.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!ce&&de?`, with ${f(Nn(m))}`:""}${_?.hidden?zo:""}" aria-expanded="${X===m.id}"
281
+ style="left:${bt.x}px;top:${bt.y}px;--cat:${kt.color};--ring:${ko};--hue:${Oe(m.by||m.byName||"")}${de?`;--step-c:${de}`:""}${qi.has(m.id)?`;--dt-page:${qi.get(m.id)}`:""}${Q?`;--fx:${Q.fx}px;--fy:${Q.fy}px`:""}"
282
+ title="${f(Jt(m.text,80))} \xB7 ${kt.label}${ce?f(js):Ht||Te==="queued"?` \xB7 ${f(Nn(m)+gi(m))}`:""}${mt==="claude"?` \xB7 resolved by ${f(Zn(m.doneAgent,m.doneFor))} \u2014 tick to confirm`:mt==="done"?" \xB7 resolved":""}${_?.hidden||_?.opener?zo:""}${Is(m)?" \u2014 drag to move":""}"${Is(m)?" data-move":""}>${mt==="done"?Ne?`${vn(Ne.writer,m)}${Oa?vn(Ne.taker,m):""}<i class="dt-pin-cut" aria-hidden="true">${Me}</i>`:"\u2713":ce?`${vn(ce.writer,m)}${ue?vn(ce.taker,m):""}${ce.claude?`<i class="dt-pin-claude" aria-hidden="true">${Fe(9)}</i>`:""}`:de?Fe(11):ui(m)}${X!==m.id&&rl(m)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}${Q&&!Q.i?`<i class="dt-pin-count" aria-hidden="true">${Q.n}</i><i class="dt-pin-spot" aria-hidden="true"></i>`:""}</button><i class="dt-pin-eye" data-eye="${m.id}" aria-hidden="true" style="left:${bt.x}px;top:${bt.y}px"${_?.hidden||_?.opener?"":" hidden"}>${ao}</i>`),X===m.id){let En=an(m),_s=Ee(m)==="review"&&!n.client?En.map(wt=>wt.author).lastIndexOf("claude"):-1,Ws=Ee(m)==="asks"&&!n.client?En.length-1:-1;s+=`<div class="dt-note${Tt?" dt-note--orphan":""}" data-id="${m.id}" role="dialog" aria-label="Thread ${m.id}"
283
+ style="left:${bt.x}px;top:${bt.y}px">
284
284
  <div class="dt-note-bar">
285
- ${p.id>0&&!(n.client||It(p))?`<span class="dt-note-num">#${p.id}</span>`:""}${p.by||p.byName?`<i class="dt-note-pin" style="--pin-c:${ko}" aria-hidden="true">${wn((p.by||p.byName||"").toLowerCase(),p)}</i>`:""}
286
- <span class="dt-note-el"${n.client?"":` data-tip="${hl(p.selector,p.label)}"`}>${n.client||It(p)?`Thread #${p.id>0?p.id:"\u2026"}`:f(ha(p.tag,p.classes,p.selector))}</span>
285
+ ${m.id>0&&!(n.client||Bt(m))?`<span class="dt-note-num">#${m.id}</span>`:""}${m.by||m.byName?`<i class="dt-note-pin" style="--pin-c:${ko}" aria-hidden="true">${vn((m.by||m.byName||"").toLowerCase(),m)}</i>`:""}
286
+ <span class="dt-note-el"${n.client?"":` data-tip="${hl(m.selector,m.label)}"`}>${n.client||Bt(m)?`Thread #${m.id>0?m.id:"\u2026"}`:f(ga(m.tag,m.classes,m.selector))}</span>
287
287
  <span class="dt-note-tools">
288
- ${Nl(p,!1,!1)}
288
+ ${Nl(m,!1,!1)}
289
289
  <i class="dt-note-sep"></i>
290
- ${As(p)?"":vl(p)}
291
- <button data-act="close" data-id="${p.id}" data-tip="Close" aria-label="Close">${Pn}</button>
290
+ ${As(m)?"":vl(m)}
291
+ <button data-act="close" data-id="${m.id}" data-tip="Close" aria-label="Close">${Pn}</button>
292
292
  </span>
293
293
  </div>
294
- ${Ju(p,V,Ot,St)}
295
- ${($t=>`<div class="dt-note-hidden"${V?.hidden?"":" hidden"}><b>${ao}<span>${$t?`In \xAB${f($t)}\xBB \u2014 closed`:"Hidden right now"}</span></b><button type="button" data-act="where" data-id="${p.id}">Show it</button></div>`)(pp(V?.shut&&V.shut!==V.el?V.shut:V?.hidden))}
296
- ${St&&Ot!=="gone"&&Ot!=="later"?Xu(p):""}
297
- ${(()=>{let $t=rp(p)+fi(Ks(p.category).id,p.id,As(p))+Pu(p)+(p.host&&p.host!==location.host?`<span class="dt-note-host" title="Written on ${f(p.host)}">${f(p.host)}</span>`:"");return $t?`<div class="dt-note-meta">${$t}</div>`:""})()}
294
+ ${Zu(m,_,Pt,Tt)}
295
+ ${(wt=>`<div class="dt-note-hidden"${_?.hidden?"":" hidden"}><b>${ao}<span>${wt?`In \xAB${f(wt)}\xBB \u2014 closed`:"Hidden right now"}</span></b><button type="button" data-act="where" data-id="${m.id}">Show it</button></div>`)(mp(_?.shut&&_.shut!==_.el?_.shut:_?.hidden))}
296
+ ${Tt&&Pt!=="gone"&&Pt!=="later"?Ju(m):""}
297
+ ${(()=>{let wt=lp(m)+fi(Ks(m.category).id,m.id,As(m))+Iu(m)+(m.host&&m.host!==location.host?`<span class="dt-note-host" title="Written on ${f(m.host)}">${f(m.host)}</span>`:"");return wt?`<div class="dt-note-meta">${wt}</div>`:""})()}
298
298
  <div class="dt-note-thread">
299
- ${lp(p,Mn.map(($t,Ae)=>{let vs=Ae===0?null:$t.at??null,pn=$t.author==="you"&&(!$t.by||$t.by===n.me?.email),Xn=pn&&te?.id===p.id&&te.at===vs,ee=n.team?.find(Mt=>Mt.email===$t.by),mn=$t.author==="claude"?Zn($t.agent,$t.by):pn?"You":ee?.name||$t.byName||$t.by||"You",Oa=$t.author==="claude"?`<span class="dt-msg-face dt-msg-ai">${De(11)}</span>`:(Mt=>Fn(ee?.avatar_url,ee?.name||$t.byName||(pn?n.me?.name:"")||$t.by||mn,"dt-msg-face").replace(/^<(img|b) /,`<$1 style="--hue:${Ie(Mt)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"))(($t.by||(pn?n.me?.email??"":"")||mn).toLowerCase()),Lo=`${p.id}:${$t.at??"0"}`,Jn=$n.get(Lo)?.text,zs=!pn&&n.voice&&$t.text?Np(p.id,$t.at??"0",$t.text):"",So=zs?Rp(p.id,$t.at??"0",$t.text):"",y=p.id<=0?null:Ae===0?"":p.replies?.some(Mt=>Mt.at===$t.at)?$t.at:null,q=y===null?"":Op(p.id,y,$t.reactions),K=y!==null&&!q?`<button class="dt-msg-edit" data-act="react-pick" data-id="${p.id}" data-at="${f(y)}" data-tip="Add reaction" aria-label="Add reaction">${Ll}</button>`:"",W=$t.author==="claude"?[kr($t.agent),$t.by&&$t.by!==n.me?.email?(ee?.name||$t.by).split(" ")[0]:""].filter(Boolean).join(" \xB7 "):"",ot=`<div class="dt-msg-head">${Oa}<b>${f(mn)}</b>${W?`<span class="dt-msg-sub">${f(W)}</span>`:""}<time>${Qn($t.at)}</time>${K}${zs}${pn&&!Xn?`<button class="dt-msg-edit" data-act="edit" data-id="${p.id}" data-at="${f(vs??"")}" title="Edit">${es}</button>${vs?`<button class="dt-msg-edit" data-act="unsay" data-id="${p.id}" data-at="${f(vs)}" title="Delete">${ts}</button>`:""}`:""}</div>`;return Ae===_s?`<div class="dt-msg dt-msg--done" data-msg="${p.id}:${f($t.at??"0")}"><div class="dt-msg-head">${Oa}<b>${f(mn)} fixed it</b><time>${Qn($t.at)}</time>${zs}</div><p${$n.get(Lo)?.text===null?' class="is-asking"':""}>${Nd(Jn||$t.text)}</p>${So}${Mi($t.images)}${q}
300
- <div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${p.id}">${Me}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${p.id}">${gn}Send back</button></div></div>`:Xn?`<div class="dt-msg">${ot}<div class="dt-compose">
299
+ ${dp(m,En.map((wt,Ae)=>{let vs=Ae===0?null:wt.at??null,pn=wt.author==="you"&&(!wt.by||wt.by===n.me?.email),Xn=pn&&te?.id===m.id&&te.at===vs,ee=n.team?.find(Mt=>Mt.email===wt.by),mn=wt.author==="claude"?Zn(wt.agent,wt.by):pn?"You":ee?.name||wt.byName||wt.by||"You",qa=wt.author==="claude"?`<span class="dt-msg-face dt-msg-ai">${Fe(11)}</span>`:(Mt=>Fn(ee?.avatar_url,ee?.name||wt.byName||(pn?n.me?.name:"")||wt.by||mn,"dt-msg-face").replace(/^<(img|b) /,`<$1 style="--hue:${Oe(Mt)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"))((wt.by||(pn?n.me?.email??"":"")||mn).toLowerCase()),Lo=`${m.id}:${wt.at??"0"}`,Jn=wn.get(Lo)?.text,zs=!pn&&n.voice&&wt.text?Bp(m.id,wt.at??"0",wt.text):"",So=zs?Pp(m.id,wt.at??"0",wt.text):"",v=m.id<=0?null:Ae===0?"":m.replies?.some(Mt=>Mt.at===wt.at)?wt.at:null,I=v===null?"":qp(m.id,v,wt.reactions),K=v!==null&&!I?`<button class="dt-msg-edit" data-act="react-pick" data-id="${m.id}" data-at="${f(v)}" data-tip="Add reaction" aria-label="Add reaction">${Ll}</button>`:"",W=wt.author==="claude"?[kr(wt.agent),wt.by&&wt.by!==n.me?.email?(ee?.name||wt.by).split(" ")[0]:""].filter(Boolean).join(" \xB7 "):"",ot=`<div class="dt-msg-head">${qa}<b>${f(mn)}</b>${W?`<span class="dt-msg-sub">${f(W)}</span>`:""}<time>${Qn(wt.at)}</time>${K}${zs}${pn&&!Xn?`<button class="dt-msg-edit" data-act="edit" data-id="${m.id}" data-at="${f(vs??"")}" title="Edit">${es}</button>${vs?`<button class="dt-msg-edit" data-act="unsay" data-id="${m.id}" data-at="${f(vs)}" title="Delete">${ts}</button>`:""}`:""}</div>`;return Ae===_s?`<div class="dt-msg dt-msg--done" data-msg="${m.id}:${f(wt.at??"0")}"><div class="dt-msg-head">${qa}<b>${f(mn)} fixed it</b><time>${Qn(wt.at)}</time>${zs}</div><p${wn.get(Lo)?.text===null?' class="is-asking"':""}>${Nd(Jn||wt.text)}</p>${So}${Mi(wt.images)}${I}
300
+ <div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${m.id}">${Me}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${m.id}">${gn}Send back</button></div></div>`:Xn?`<div class="dt-msg">${ot}<div class="dt-compose">
301
301
  <textarea class="dt-note-edit-input" rows="1" maxlength="${Hi}" aria-label="Edit the message">${f(te.text)}</textarea>
302
- ${Mi($t.images.filter(Mt=>!te.drop.includes(Mt.split("/").pop())),p.id)}
302
+ ${Mi(wt.images.filter(Mt=>!te.drop.includes(Mt.split("/").pop())),m.id)}
303
303
  <div class="dt-compose-bar">
304
304
  <button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
305
305
  <button class="dt-send${te.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${Me}</button>
306
306
  </div>
307
- </div></div>`:`<div class="dt-msg${pn?" dt-msg--mine":""}${Ae===Ws?" dt-msg--asks":""}" data-msg="${p.id}:${f($t.at??"0")}">${Ae===Ws?ot.replace(`<b>${f(mn)}</b>`,`<b>${f(mn)} asks</b>`):ot}<p${$n.get(Lo)?.text===null?' class="is-asking"':""}>${Nd(Jn||$t.text)}</p>${So}${Ae===0&&p.suggest?ap(p.suggest):""}${Mi($t.images)}${q}</div>`}),te?.id===p.id?1/0:(Ss.get(p.id)??2)+(_s===Mn.length-1||Ws>=0?1:0))}
307
+ </div></div>`:`<div class="dt-msg${pn?" dt-msg--mine":""}${Ae===Ws?" dt-msg--asks":""}" data-msg="${m.id}:${f(wt.at??"0")}">${Ae===Ws?ot.replace(`<b>${f(mn)}</b>`,`<b>${f(mn)} asks</b>`):ot}<p${wn.get(Lo)?.text===null?' class="is-asking"':""}>${Nd(Jn||wt.text)}</p>${So}${Ae===0&&m.suggest?ip(m.suggest):""}${Mi(wt.images)}${I}</div>`}),te?.id===m.id?1/0:(Ss.get(m.id)??2)+(_s===En.length-1||Ws>=0?1:0))}
308
308
  </div>
309
- ${We[p.id]?`<button type="button" class="dt-new-below" data-act="newbelow" data-id="${p.id}">${We[p.id]} new ${We[p.id]===1?"reply":"replies"} \u2193</button>`:""}
310
- ${zp(p)}
311
- ${Al("dt-note-reply-input",Ee(p)==="asks"?`Answer ${f(Nn(p))}`:"Reply",Re,`data-act="reply" data-id="${p.id}"`,Ml(Le))}
312
- ${fl(p.priority,p.category,p.id,p.assignee??"",As(p),It(p),!0)}
313
- </div>`}}ze.forEach((p,V)=>{let Z=Ce(p);Z&&(s+=`<button class="dt-pin dt-pin--draft" data-parked="${V}" data-act="draft-open" data-i="${V}"
314
- style="left:${Z.x}px;top:${Z.y}px" title="Draft, not sent \u2014 click to finish it">${al()}</button>`)});let l=R&&Ce(R);if(R){let p=l?.x??0,V=l?.y??0;s+=`${l?`<span class="dt-pin dt-pin--draft" data-draft style="left:${p}px;top:${V}px">${al()}</span>`:""}
315
- <div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${p}px;top:${V}px">
309
+ ${We[m.id]?`<button type="button" class="dt-new-below" data-act="newbelow" data-id="${m.id}">${We[m.id]} new ${We[m.id]===1?"reply":"replies"} \u2193</button>`:""}
310
+ ${Vp(m)}
311
+ ${Al("dt-note-reply-input",Ee(m)==="asks"?`Answer ${f(Nn(m))}`:"Reply",Pe,`data-act="reply" data-id="${m.id}"`,Ml(Le))}
312
+ ${fl(m.priority,m.category,m.id,m.assignee??"",As(m),Bt(m),!0)}
313
+ </div>`}}ze.forEach((m,_)=>{let Q=Ce(m);Q&&(s+=`<button class="dt-pin dt-pin--draft" data-parked="${_}" data-act="draft-open" data-i="${_}"
314
+ style="left:${Q.x}px;top:${Q.y}px" title="Draft, not sent \u2014 click to finish it">${al()}</button>`)});let l=B&&Ce(B);if(B){let m=l?.x??0,_=l?.y??0;s+=`${l?`<span class="dt-pin dt-pin--draft" data-draft style="left:${m}px;top:${_}px">${al()}</span>`:""}
315
+ <div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${m}px;top:${_}px">
316
316
  <div class="dt-note-bar">
317
- <span class="dt-note-el"${n.client?"":` data-tip="${hl(R.selector,R.label)}"`}>${n.client?"New thread":f(ha(R.tag,R.classes,R.selector))}</span>
317
+ <span class="dt-note-el"${n.client?"":` data-tip="${hl(B.selector,B.label)}"`}>${n.client?"New thread":f(ga(B.tag,B.classes,B.selector))}</span>
318
318
  ${Js()?'<span class="dt-note-draft">Draft</span>':""}
319
319
  <span class="dt-note-tools">
320
320
 
@@ -323,25 +323,25 @@ import"./notemend.css";var ce={base:"",via:null,signed:{},live:!1,signOut:null,c
323
323
  </span>
324
324
  </div>
325
325
  ${l?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
326
- ${(()=>{let Z=l?Qe(R):null,qt=Z&&j.find(Ot=>Ot.id>0&&Bt(Ot)==="open"&&Qe(Ot)===Z);return qt?`<p class="dt-note-twin">Already open here: \u201C${f(Zt(qt.text,60))}${qt.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${qt.id}">Open it</button></p>`:""})()}
327
- ${n.client?`<div class="dt-note-meta">${mp(R.assignee)}</div>`:""}
328
- ${R.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">${Pn}</button></span>
329
- <span class="dt-suggest-was">Now: <del>${f(Zt(R.suggest.from,160))}${R.suggest.from.length>160?"\u2026":""}</del></span>
330
- <textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${f(R.suggest.to)}</textarea>
326
+ ${(()=>{let Q=l?Qe(B):null,Ot=Q&&j.find(Pt=>Pt.id>0&&Ct(Pt)==="open"&&Qe(Pt)===Q);return Ot?`<p class="dt-note-twin">Already open here: \u201C${f(Jt(Ot.text,60))}${Ot.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${Ot.id}">Open it</button></p>`:""})()}
327
+ ${n.client?`<div class="dt-note-meta">${hp(B.assignee)}</div>`:""}
328
+ ${B.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">${Pn}</button></span>
329
+ <span class="dt-suggest-was">Now: <del>${f(Jt(B.suggest.from,160))}${B.suggest.from.length>160?"\u2026":""}</del></span>
330
+ <textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${f(B.suggest.to)}</textarea>
331
331
  <span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
332
- <div class="dt-note-meta dt-note-type">${fi(Ks(R.category).id,void 0,!1)}</div>
333
- ${Al("dt-note-input",R.suggest?"Why (optional)":"Comment",R.text??"",'data-act="save"',Ml(R.images))}
334
- ${R.carried&&R.assignee?`<p class="dt-carried">${Uu}<span>For ${f(ln(R.assignee)?.name||R.assignee.split("@")[0])} \xB7 from your last comment</span><button type="button" data-act="uncarry" aria-label="Don\u2019t carry it over" data-tip="Back to Anyone \u2014 and the next ones too">${Pn}</button></p>`:""}
335
- ${fl(R.priority,R.category,void 0,R.assignee??"",!1,!!R.shared,!0)}
336
- </div>`}let d=new Map([...et.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(p=>[p.closest(".dt-note").dataset.id,{top:p.scrollTop,end:p.scrollTop+p.clientHeight>=p.scrollHeight-4}])),u=new Set([...et.querySelectorAll("[data-msg]")].map(p=>p.dataset.msg)),h=et.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Yp(e,Sn.hidden?o.some(p=>!!a.get(p.id)):o.length>0),Fr(et,s),h&&!et.contains(document.activeElement)&&yo(".dt-note-reply-input");let $=[],B=[];for(let p of et.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let V=p.closest(".dt-note").dataset.id,Z=d.get(V);if(!Z){$.push(p),delete We[V],p.parentElement.querySelector(".dt-new-below")?.remove();continue}let qt=[...p.querySelectorAll("[data-msg]")].filter(pt=>!u.has(pt.dataset.msg));for(let pt of qt)pt.classList.add("dt-msg--new");let Ot=Z.end||String(_o)===V;Ot&&B.push(p),p.scrollTop=Ot?p.scrollHeight:Z.top;let ie=qt.filter(pt=>!pt.classList.contains("dt-msg--mine")).length;if(ie&&!Z.end&&String(_o)!==V){We[V]=(We[V]??0)+ie;let pt=We[V],St=p.parentElement.querySelector(".dt-new-below")??p.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(St.dataset,{act:"newbelow",id:V}),St.textContent=`${pt} new ${pt===1?"reply":"replies"} \u2193`}}for(let p of et.querySelectorAll(".dt-new-below")){let V=p.closest(".dt-note")?.querySelector(".dt-note-thread");(!V||V.scrollTop+V.clientHeight>=V.scrollHeight-4)&&(delete We[p.dataset.id],p.remove())}_o=null,Ii([...$,...B]),requestAnimationFrame(()=>et.querySelectorAll(".dt-note-thread").forEach(zo)),Y==null?jo=null:Y!==jo&&et.querySelector(`.dt-note[data-id="${Y}"]`)&&(jo=Y,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&yo(`.dt-note[data-id="${Y}"] .dt-note-reply-input`)),ge(e),li(di()),en();for(let p of et.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))or(p);let _=et.querySelector(".dt-note-input");_&&document.activeElement!==_&&(_.focus(),_.setSelectionRange(_.value.length,_.value.length))},Oi=0,Zp=()=>{Wi&&Yt&&!M&&sd();let t=!1,e=document.getAnimations().some(l=>l.playState==="running"),s=[],o=!1;for(let l of et.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(l.classList.contains("dt-note--orphan")||l.classList.contains("is-dragging"))continue;if(l.classList.contains("dt-pin--ghost")){let h=j.find($=>$.id===Number(l.dataset.id))?.spot;s.push([l,h?{x:h.x-scrollX,y:h.y-scrollY,el:document.body}:null]);continue}let d=j.find(h=>h.id===Number(l.dataset.id)),u=d&&Ce(d);s.push([l,u&&l.matches(".dt-pin")&&Bu(u.el,u.x,u.y)?null:u]),u&&e&&el(u.el)&&(t=!0)}for(let l of et.querySelectorAll("[data-draft], [data-parked]")){if(l.classList.contains("dt-note--orphan"))continue;let d=l.dataset.parked?ze[Number(l.dataset.parked)]:R;s.push([l,d?Ce(d):null])}let a=(l,d,u)=>{Math.abs(parseFloat(l.style.left)-d)<.05||(l.style.left=`${d}px`,o=!0),Math.abs(parseFloat(l.style.top)-u)<.05||(l.style.top=`${u}px`,o=!0)};for(let[l,d]of s){let u=l.nextElementSibling;if(!d){l.style.visibility!=="hidden"&&(l.style.visibility="hidden"),u?.matches(".dt-pin-eye")&&!u.hidden&&(u.hidden=!0);continue}if(l.style.visibility&&(l.style.visibility=""),a(l,d.x,d.y),l.matches(".dt-pin[data-id]")){let h=!!(d.hidden||d.opener);if(l.classList.contains("dt-pin--hidden")!==h){l.classList.toggle("dt-pin--hidden",h);for(let $ of["title","aria-label"]){let B=(l.getAttribute($)??"").replace(Wo,"");l.setAttribute($,h?B.replace(/( \u2014 drag to move)?$/,`${Wo}$1`):B)}}u?.matches(".dt-pin-eye")&&(u.hidden===h&&(u.hidden=!h),h&&a(u,d.x,d.y))}l.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!d.hidden)}if(!na.length&&(R||Y!=null)){let l=di();l&&e&&el(l)&&li(l)}let r=et.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(r.length){let l=ya();for(let d of r)d.style.visibility!=="hidden"&&Wl(d,l)}Nu(R||Y!=null?di():null),Oi=o?0:Oi+1,t&&en(),clearTimeout(Vl),Vl=window.setTimeout(Qp,150)},qi=new Map,Vl=0,Qp=()=>{let t=new Map,e=o=>{let a=[],r="";for(let l=o;l;l=l.parentElement){let d=t.get(l);if(d!==void 0){r=d;break}if(a.push(l),/^(IMG|VIDEO|CANVAS|PICTURE|IFRAME)$/.test(l.tagName)){r="var(--dt-bg)";break}let u=getComputedStyle(l);if(u.backgroundImage!=="none"){r="var(--dt-bg)";break}let h=u.backgroundColor.match(/[\d.]+/g);if(h&&(h[3]===void 0?1:+h[3])>=.9){r=u.backgroundColor;break}}r||="#fff";for(let l of a)t.set(l,r);return r},s=[];for(let o of et.querySelectorAll(".dt-pin[data-id]")){if(o.style.visibility==="hidden"||o.classList.contains("is-dragging"))continue;let a=o.getBoundingClientRect(),r=document.elementsFromPoint(a.x+a.width/2,a.y+a.height/2).find(l=>!In(l));r&&s.push([o,e(r)])}for(let[o,a]of s)qi.set(Number(o.dataset.id),a),o.style.setProperty("--dt-page",a)},Gl=t=>`dt-gfold:${n.project||location.host}:${t}`,ge=t=>{if(rt.hidden){rt.replaceChildren();return}if(rt.toggleAttribute("data-picking",!!Pe),Fr(rt,yu({bp:t,notes:j.filter(An),breakpoints:m,bandOfNote:v,orphan:e=>!Ce(e),statusTools:e=>Nl(e,!1),tick:tp,replied:ep,rowMenu:np,menuFor:Dn,showResolved:Ze,showArchived:yn,archived:Se,drafts:Sn.hidden?Hl():Ci,checks:M?0:$a.toCheck().length,clients:Je()&&Ve==="clients",marker:em,assign:Qu,mirror:e=>Je()?ti(e)?"here":It(e)&&Uo(e)?"there":"":"",picking:Pe,pickable:ks,mirrorAll:Xo()?j.filter(e=>An(e)&&v(e)===t&&ks(e)).map(e=>e.id):[],draftFace:n.me?`<span class="dt-hist-face" style="--hue:${Ie(n.me.email)}">${ui({by:n.me.email,byName:n.me.name})}</span>`:"",draftName:n.me?.name||"You",find:se,forMe:tm,forAgent:e=>!!Ee(e)&&Bt(e)!=="done",unread:rl,archives:!n.client,deletable:e=>!As(e),folded:rt.hasAttribute("data-collapsed"),shut:e=>ct.getItem(Gl(e))==="1",cap:Kl,keep:Y})),Cs){let e=rt.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Cs.at,Cs.at),Cs=null}},Cs=null,Kl=150,tm=t=>{if(Bt(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||Bt(t)==="claude"||qe(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return an(t).some(s=>s.text.toLowerCase().includes("@"+e))},em=t=>{let e=Ee(t),s=aa[e??""],o=Bt(t)==="done"?Se(t)?`<i class="dt-hist-badge is-archived">${Ln}</i>`:`<i class="dt-hist-badge is-done">${Me}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${De(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${_n.find(r=>r[0]===ds(t))[2]}"></i>`,a=ui(t)||Fn(void 0,t.byName||(t.by==="you"||!t.by?"You":t.by)).replace(/>([^<])[^<]*<\/b>$/,">$1</b>");return`<span class="dt-hist-face" style="--hue:${Ie(t.by||t.byName||"you")}">${a}</span>`},wa=t=>{Pi=!1;let e=rt.hasAttribute("data-collapsed");if(t===e||rt.hidden){rt.toggleAttribute("data-collapsed",t),J();return}let s=rt.querySelector(".dt-hist-head")?.offsetHeight??44;if(t){rt.setAttribute("data-folding",""),Or(rt,rt.offsetHeight,s,!1,()=>{rt.removeAttribute("data-folding"),rt.setAttribute("data-collapsed",""),J()});return}rt.removeAttribute("data-folding"),rt.removeAttribute("data-collapsed"),J(),Or(rt,s,rt.offsetHeight,!0,()=>{})},Ul=t=>{let e=[];for(let s=t.nextElementSibling;s&&s.classList.contains("dt-hist-row");s=s.nextElementSibling)e.push(s);return e},Yl=t=>{let e=document.createElement("div");return e.className="dt-hist-rows",t[0].before(e),e.append(...t),e},nm=t=>{let e=Gl(t),s=ct.getItem(e)==="1",o=rt.querySelector(".dt-hist-list"),a=o?.clientHeight??600,r=()=>rt.querySelector(`[data-gfold="${CSS.escape(t)}"]`)?.closest(".dt-hist-group");if(!s){let h=r(),$=h?Ul(h):[],B=()=>{z(e,"1"),ge(Xt())};if(!$.length||!ns())return B();let _=Yl($);Ga(_,!1,a),On(_).then(B);return}z(e,""),ge(Xt());let l=r(),d=l?Ul(l):[];if(!d.length||!ns())return;let u=Yl(d);u.hidden=!0,Ga(u,!0,a),On(u).then(()=>{u.isConnected&&(u.before(...u.children),u.remove())})};rt.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(se.q=e.value,Cs={at:e.selectionStart??e.value.length},ge(Xt()))}),rt.addEventListener("click",async t=>{let e=t.target;if(e.closest("[data-hist-more]")){se.more=!se.more,Dn=null,se.menu=!1,ge(Xt());return}let s=e.closest("[data-row-more]");if(s){let kt=Number(s.dataset.rowMore);Dn=Dn===kt?null:kt,se.more=!1,ge(Xt());return}if((se.more||Dn!=null)&&!e.closest(".dt-hist-menu")&&(se.more=!1,Dn=null,ge(Xt()),!e.closest("[data-go]"))||e.closest(".dt-hist-assign"))return;let o=()=>{se.more=!1,Dn=null};if(e.closest("[data-hist-rows]")){Kl+=300,ge(Xt());return}if(e.closest("[data-read-all]")){for(let kt of j)ll(kt);o(),ge(Xt());return}let a=e.closest("[data-resolve-all]");if(a){let kt=a.dataset.resolveAll.split(",").map(Number);o(),await Rl(kt,Nt=>tn(Nt,!0)),Oe(`Resolved ${kt.length}`,()=>Rl(kt,Nt=>tn(Nt,!1)));return}let r=e.closest("[data-row-unread]");if(r){let kt=Number(r.dataset.rowUnread);jn[kt]=Math.max(0,an(j.find(Nt=>Nt.id===kt)).length-1),hi(),o(),ge(Xt());return}let l=e.closest("[data-row-link]");if(l){o(),ge(Xt()),await navigator.clipboard?.writeText(`${location.origin}${location.pathname}#thread-${l.dataset.rowLink}`).catch(()=>null),Kt("Link copied");return}let d=e.closest("[data-row-select]");if(d){o();let kt=Number(d.dataset.rowSelect),Nt=j.find(Te=>Te.id===kt);Pe=new Set(Nt&&ks(Nt)?[kt]:[]),Yo=kt,ge(Xt());return}let u=e.closest("[data-row-mirror]");if(u){o(),ge(Xt()),await Ta([Number(u.dataset.rowMirror)]);return}let h=e.closest("[data-mirror-all]");if(h){o(),ge(Xt()),await Ta(h.dataset.mirrorAll.split(",").map(Number));return}if(e.closest("[data-pick-mirror]")){await Rd();return}if(e.closest("[data-pick-cancel]")){ir();return}let $=e.closest(".dt-hist-go[data-go]");if($&&Xo()&&(Pe||t.metaKey||t.ctrlKey||t.shiftKey)){t.preventDefault(),km(Number($.dataset.go),t.shiftKey);return}let B=e.closest("[data-row-move]");if(B){o(),await ar(Number(B.dataset.rowMove));return}if(e.closest(".dt-hist-menu.is-row [data-act], .dt-hist-menu.is-row [data-rm]")&&o(),rt.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){wa(!1);return}if(t.target.closest("[data-fold]")){wa(!rt.hasAttribute("data-collapsed"));return}let _=t.target.closest("[data-gfold]");if(_){nm(_.dataset.gfold);return}let p=t.target.closest(".dt-hist-bands [data-bp]");if(p){cr(p.dataset.bp);return}let V=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(V){V.dataset.histView?(se.view=V.dataset.histView,z("dt-view",se.view),se.menu=!1):V.dataset.histSort?(se.sort=V.dataset.histSort,z("dt-sort",se.sort),se.menu=!1,se.more=!1):V.hasAttribute("data-hist-clear")?(se.q="",Cs={at:0}):se.menu=!se.menu,ge(Xt());return}se.menu&&!t.target.closest(".dt-hist-menu")&&(se.menu=!1,ge(Xt()));let Z=t.target.closest("[data-draft-go], [data-draft-rm]");if(Z){let kt=Z.dataset.draftRm!==void 0,Nt=Number(kt?Z.dataset.draftRm:Z.dataset.draftGo);Sn.hidden?kt?Xl(Nt):Di(Nt):Ue(kt?{dropDraft:Nt}:{openDraft:Nt});return}let qt=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(e.closest(".dt-hist-menu.is-panel [data-resolved], .dt-hist-menu.is-panel [data-archived], .dt-hist-menu.is-panel [data-archive-all]")&&(se.more=!1),qt){await tn(Number(qt.dataset.id),qt.dataset.act==="done");return}let Ot=t.target.closest("[data-rm]");if(Ot){Y=null,Bi(Number(Ot.dataset.rm));return}if(t.target.closest("[data-review]")){$a.start();return}if(t.target.closest("[data-resolved]")){ji(!Ze);return}if(t.target.closest("[data-archived]")){_i(!yn);return}let ie=t.target.closest("[data-archive-all]");if(ie){let kt=ie.dataset.archiveAll.split(",").map(Number);for(let Nt of kt)await us(Nt,!0,!0);Oe(`Archived ${kt.length}`,()=>{for(let Nt of kt)us(Nt,!1,!0)});return}let pt=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(pt){await us(Number(pt.dataset.id),pt.dataset.act==="archive");return}let St=t.target.closest("[data-go]");if(!St)return;let gt=Number(St.dataset.go);if(!Sn.hidden){Ue({open:gt});return}ms(gt)});let ms=t=>{Y=t,jo=null,rn(),ps=!0,J();let e=j.find(a=>a.id===t),s=e&&Ce(e);if(s)scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"});else if(e){let a=Qe(e);a?a.scrollIntoView({block:"center",behavior:"smooth"}):tl(e)}let o=et.querySelector(`.dt-pin[data-id="${t}"]`);o&&Io(o,"land"),va()},Di=t=>{let[e]=ze.splice(t,1);if(!e)return;rn(),R=e,Y=null;let s=Ce(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),J()},Xl=t=>{ze.splice(t,1),J()},$a=vu({inFrame:M,everything:()=>bt,route:()=>Tt,settle:tn,keepIn:Ya,toast:t=>Kt(t),waits:t=>Bt(t)==="claude"||Bt(t)==="open"&&ds(t)==="review",approve:t=>tn(t.id,!0),open:t=>{if(Yt||sn(!0),v(t)!==Xt()){cr(v(t));for(let e of[600,1500])setTimeout(()=>Ue({open:t.id}),e)}else ms(t.id)}}),Jl=t=>{if(rt.hidden){t?.();return}ss(rt,()=>{rt.hidden=!0,t?.()})},Zl=()=>{Po(rt),rt.hidden=!1},sm=t=>{t?Zl():Jl(),xe.setAttribute("aria-pressed",String(t)),z("dt-history",t?"1":"0"),J()},Fi=document.querySelector(".dt-resolved-btn"),Vn=document.querySelector(".dt-space"),om=()=>{if(!Vn)return;Vn.hidden=!Je(),Vn.dataset.on=Ve;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Je()&&Ve==="clients"?(t.dataset.dtSpace="clients",e||(t.classList.add("dt-client-glow"),window.setTimeout(()=>t.classList.remove("dt-client-glow"),1700))):delete t.dataset.dtSpace;let s=document.querySelector(".dt-client-tab");s&&(s.inert=t.dataset.dtSpace!=="clients",s.ariaHidden=s.inert?"true":null);for(let o of Vn.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===Ve));let r=bt.filter(l=>!Se(l)&&Bt(l)!=="done"&&It(l)===(a==="clients")).length;o.querySelector(".dt-space-n").textContent=r?String(r):""}Vn.querySelector(".dt-space-name").textContent=Ve==="clients"?"Client":"Team",Vn.querySelector(".dt-space-ic").innerHTML=xt(Pr[Ve],14)},Ql=0,Ns=t=>{if(!Je()||t===Ve)return;let e=()=>{Ve=t,Pe=null,z("dt-space",t),Y!=null&&!An(j.find(a=>a.id===Y))&&(Y=null),rn(),hs(bt),J(),ge(Xt())},s=document.documentElement,o=++Ql;s.classList.add("dt-switching"),Promise.all([On(et),On(rt)]).then(()=>{o===Ql&&(e(),requestAnimationFrame(()=>s.classList.remove("dt-switching")))})};document.querySelector(".dt-client-x")?.addEventListener("click",()=>Ns("studio")),Vn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&(Vn.open=!1,Ns(e.dataset.space))});let Bs=document.querySelector(".dt-pinf"),Rs=Bs.querySelector(".dt-pinf-btn"),cn=Bs.querySelector(".dt-pinf-menu"),td={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My agent",wrote:"Written by me",check:"To check"},am=()=>j.filter(t=>v(t)===Xt()&&Ko(t)&&An(t)),uo=(t,e=!1)=>{cn.hidden=!t,Rs.setAttribute("aria-expanded",String(t)),t&&(Qa(),e&&cn.querySelector('[aria-checked="true"]')?.focus())};Qa=()=>{let t=am();if(Bs.hidden=!Je()||!t.length,Bs.hidden){cn.hidden=!0;return}let e=Object.fromEntries(Yr.map(h=>[h,t.filter($=>gl($,h)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",Ie(s)],["others","var(--dt-faint)"]];if(Rs.toggleAttribute("data-on",Hn!=="all"),Rs.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} anyone can take, ${e.mine} mine, ${e.others} everyone else's, ${e.resolved} resolved${Hn==="all"?"":`; showing ${td[Hn]}, ${e[Hn]}`}`),cn.hidden)return;let a=[...new Set(t.map(h=>Co(h,Bt(h))?.taker).filter(h=>!!h&&h!==s))].slice(0,2),r=h=>Fn(ln(h)?.avatar_url,ln(h)?.name||h,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${Ie(h)}" `),l={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:r(s),others:a.map(r).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">${De(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:Ye(_n[2][2],_n[2][3]),resolved:Ye(Wn[Wn.length-1][2],Wn[Wn.length-1][3])},d=(h,$)=>`<b class="dt-pinf-share"><i style="--c:${$};width:${Math.round(100*e[h]/e.all)}%"></i></b>`,u=(h,$="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${Hn===h}" data-pinf="${h}"><i class="dt-pinf-glyph">${l[h]}</i><span>${td[h]}</span>${$?d(h,$):""}<em>${e[h]}</em>${Me}</button>`;cn.innerHTML=`${u("all")}${o.map(([h,$])=>u(h,$)).join("")}${e.resolved||Hn==="resolved"?u("resolved"):""}<hr>${u("claude")}${u("wrote")}${u("check")}`},Rs.addEventListener("click",t=>uo(cn.hidden,t.detail===0)),cn.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(Hn=e.dataset.pinf,z("dt-pinf",Hn),uo(!1),Rs.focus(),Yt?J():sn(!0))}),cn.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),uo(!1),Rs.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...cn.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!cn.hidden&&!Bs.contains(t.target)&&uo(!1)},!0);let ji=t=>{Ze=t,Fi.setAttribute("aria-pressed",String(t)),z("dt-resolved",t?"1":"0"),Ue({resolved:t}),J(),gs(!0)},_i=t=>{yn=t,z("dt-archived",t?"1":"0"),Ue({archived:t}),J(),gs(!0)};Fi.addEventListener("click",()=>ji(!Ze)),Fi.setAttribute("aria-pressed",String(Ze)),xe.addEventListener("click",()=>{let t=rt.hidden||rt.hasAttribute("data-leaving");t&&!Yt&&sn(!0),t&&wa(!1),sm(t)});let en=()=>{Xa||!Yt||(Xa=requestAnimationFrame(()=>{Xa=0,Zp()}))},ed=`${Xs}, .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`,nd=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(ed))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(ed))},Wi=!1,sd=()=>{Wi=!1;let t=document.scrollingElement??document.documentElement,e=document.querySelector(".dt-room");if(t.scrollHeight-(e?.offsetHeight??0)<=t.clientHeight+1){e?.remove();return}let s=e??Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"});document.body.lastElementChild!==s&&document.body.append(s)},zi=0,Vi=!1,Gi=!1,od=0,im=()=>{if(!Yt)return!1;let t=new Set([...et.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].map(s=>Number(s.dataset.id))),e=Xt();return j.some(s=>!t.has(s.id)&&v(s)===e&&Ko(s)&&An(s)&&!!Ce(s))},rm=()=>Yt&&[...et.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=j.find(s=>s.id===Number(t.dataset.id));return!!e&&e.id!==Y&&!Qe(e)}),ad=new MutationObserver(t=>{if(Yt&&!M&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),Wi=!0}t.every(nd)||((Oi<3||t.some(e=>e.type!=="attributes"))&&en(),t.some(e=>e.type!=="attributes")?Vi=!0:t.some(e=>e.attributeName==="class")&&(Gi=!0),zi||(zi=window.setTimeout(()=>{if(zi=0,Vi)Qo();else if(Gi&&performance.now()-od>1e3){od=performance.now();for(let[s,o]of Ls)o.el||Ls.delete(s)}Vi=Gi=!1;let e=Y!=null?j.find(s=>s.id===Y):void 0;im()||rm()||e&&ta&&_u(e)!==ta?J():en()},150)))}),id=new ResizeObserver(()=>en()),rd=()=>{et.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&en()},bt=[],ld=()=>{},po=new Set,Ge={at:"",ids:[]},hs=t=>{bt=t,queueMicrotask(()=>ld());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={};for(let d of t){if(Se(d)||!An(d))continue;let u=Bt(d),h=Ee(d),$=u==="done"?"done":u==="claude"?"review":h&&ra[h]||ds(d),B=s[d.route??""]??={...e(),bands:{}};B[$]++;let _=v(d);(B.bands[_]??=e())[$]++}om();let o=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},r=d=>o.map(u=>[u,u==="done"&&!Ze?0:d[u]]),l=d=>r(d).reduce((u,[,h])=>u+h,0);for(let d of document.querySelectorAll(".dt-pages a")){let u=d.querySelector(".dt-pages-n");if(!u)continue;let h=s[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let _ of m){let p=h?.bands[_.id];for(let[V,Z]of r(p??e())){let qt=u.querySelector(`[data-bp="${_.id}"][data-state="${V}"]`);qt.hidden=!Z,Z&&(qt.querySelector("i").textContent=String(Z),qt.title=`${_.label}: ${Z} ${a[V]}`)}}let $=h?l(h):0;u.hidden=!$;let B=h?m.filter(_=>h.bands[_.id]&&l(h.bands[_.id])).map(_=>`${_.label} ${l(h.bands[_.id])}`).join(" \xB7 "):"";u.title=$?`${o.filter(_=>h[_]).map(_=>`${h[_]} ${a[_]}`).join(" \xB7 ")}
337
- ${B}`:"",d.dataset.n=String($)}for(let d of document.querySelectorAll(".dt-folder")){let u=d.querySelectorAll(":scope > ul li[data-route] > a").length,h=[...d.querySelectorAll("a[data-n]")].reduce((B,_)=>B+Number(_.dataset.n),0),$=d.querySelector(".dt-folder-n");$.textContent=u?String(u):"",$.title=`${u} ${u===1?"page":"pages"}${h?` \xB7 ${h} open ${h===1?"thread":"threads"}`:""}`}x()},Gn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!fa.has(Number(e.id))).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(s=>typeof s?.text=="string").map(s=>ba.has(`${Number(e.id)}|${s.at}`)?{...s,text:"",deleted:!0}:s):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[],...Gs(e)&&typeof e.from.by=="string"?{by:e.from.by,byName:typeof e.from.byName=="string"?e.from.byName:void 0,mirroredBy:e.by,mirroredByName:e.byName}:{}})),lm=wu(M,t=>Kt(t,2800,document.querySelector(".dt-turbo")??void 0)),Ke=document.querySelector(".dt-push"),xn=Ke.querySelector(".dt-push-menu"),En=new Set,mo=new Set([Tt]),xa=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",Ea=()=>n.client||M?[]:bt.filter(t=>t.status!=="done"&&Jt(t.assignee)&&!It(t)&&qe(t)==="approved"&&!hn(t)&&!Se(t)&&!po.has(t.id)),Ma=()=>Ea().filter(t=>!En.has(t.id)),dd=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?Me:""}</i>`,cd=()=>{let t=Ea(),e=[...new Set(t.map(o=>o.route??"/"))],s=Ma().length;xn.innerHTML=`<div class="dt-push-head">${De(14)}<b>Waiting for the agent</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=>!En.has(l.id)).length;return`<button type="button" class="dt-push-page${mo.has(o)?" is-open":""}" data-push-route="${f(o)}"><span data-push-fold="${f(o)}">${ia}</span>${dd(r>0,r>0&&r<a.length)}<span class="dt-push-route">${f(o)}</span><em>${a.length}</em></button>`+(mo.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${dd(!En.has(l.id))}<span><small>#${l.id}</small>${f(Zt(l.text,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>Send ${s} to the agent</button>`},ud=()=>["push","paused"].includes(xa()),Ki=()=>Ge.ids.filter(t=>{let e=bt.find(s=>s.id===t);return!!e&&e.status!=="done"&&qe(e)!=="review"&&(po.has(t)||!!hn(e)||qe(e)==="approved")}),pd="",dm=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Bn=()=>{let t=xa(),e=Ma().length,s=Ki(),o=Ge.ids.length-s.length,a=s.length>0&&ud();if(s.length&&(pd=Ge.at),!s.length&&Ge.ids.length&&Ge.at&&pd===Ge.at&&!dm(Ge.at)){try{sessionStorage.setItem("nm-batch-done",Ge.at)}catch{}bt.length&&Oe(`The agent finished ${Ge.ids.length} \u2014 check the fixes`,()=>$a.start(),"Check")}Ke.hidden=n.client||M||!e&&!Ke.matches(".is-sending, .is-sent");let r=Ke.querySelector(".dt-push-n");r.textContent=String(e),r.hidden=!e||Ke.classList.contains("is-sent"),Ke.querySelector(".dt-push-all").dataset.tip=a?`Push to the agent: it is on ${s.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 the agent: turbo is on \u2014 the agent takes each thread as it lands":t==="none"?`Push to the agent: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to the agent: ${e} ${e===1?"thread waits":"threads wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to the agent: nothing waits for the agent yet \u2014 mark threads for the agent, then send them here",(Ke.hidden||!Ea().length)&&(xn.hidden=!0),xn.hidden||cd()},md=async t=>{if(!t.length&&ud()){Kt("Nothing waits for the agent \u2014 mark threads for the agent first");return}if(xa()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Kt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(xa()==="on"){Kt("Turbo is on \u2014 the agent takes each thread as it lands");return}xn.hidden=!0;let e=t.map(o=>o.id);Ke.classList.add("is-sending");let s=await oe("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(Ke.classList.remove("is-sending"),!s?.ok){Kn("Could not send them to the agent",s),Bn();return}for(let o of e)po.add(o);Ke.classList.add("is-sent"),setTimeout(()=>{Ke.classList.remove("is-sent"),Bn()},700),Ge={at:Ge.ids.some(o=>Ki().includes(o))?Ge.at:new Date().toISOString(),ids:[...new Set([...Ki(),...e])]},Bn(),Oe(`${e.length} sent to the agent \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await oe("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)po.delete(o);Bn()}),nn()},ka=Ke.querySelector(".dt-push-all"),hd=0,Ui=!1,gd=()=>{xn.hidden=!1,cd()};ka.addEventListener("click",()=>{if(Ui){Ui=!1;return}md(Ma())}),ka.addEventListener("contextmenu",t=>{t.preventDefault(),xn.hidden?gd():xn.hidden=!0}),ka.addEventListener("pointerdown",t=>{t.button===0&&(hd=window.setTimeout(()=>{Ui=!0,gd()},500))});for(let t of["pointerup","pointerleave","pointercancel"])ka.addEventListener(t,()=>clearTimeout(hd));xn.addEventListener("click",t=>{let e=t.target,s=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"){md(Ma());return}if(r==="all")En.clear();else if(s){let l=s.dataset.pushFold;mo.has(l)?mo.delete(l):mo.add(l)}else if(o){let l=Ea().filter(u=>(u.route??"/")===o.dataset.pushRoute),d=l.some(u=>!En.has(u.id));for(let u of l)d?En.add(u.id):En.delete(u.id)}else if(a){let l=Number(a.dataset.pushId);En.has(l)?En.delete(l):En.add(l)}Bn()}),document.addEventListener("pointerdown",t=>{!xn.hidden&&!Ke.contains(t.target)&&(xn.hidden=!0)},!0),setInterval(Bn,3e4),ld=Bn;let fd=document.querySelector(".dt-turbo");fd&&new MutationObserver(Bn).observe(fd,{attributes:!0,attributeFilter:["data-state"]}),Bn();let ho="",Yi=!1,Ps="dt-threads",bd=String([ce.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Xi="",La=null,cm=t=>{M||t.version&&t.version===Xi||(La||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=La;La=null,Xi=e.version??"";let s=JSON.stringify({project:bd,body:e});s.length<2e6?ct.setItem(Ps,s):ct.removeItem(Ps)},{timeout:3e3}),La=t)},Ji=(t,e=!1)=>{ho=t.version??"",lm(t);let s=t.turbo;po=new Set(s?.push?.ids??[]),Ge={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=Gn(t.comments);if(e&&(Ze||yn)){let r=new Set(o.map(l=>l.id));o=[...o,...bt.filter(l=>Bt(l)==="done"&&!r.has(l.id))]}cm({...t,comments:o}),hs(o);let a=o.filter(r=>r.route===Tt);if(!(Go&&(j=a,yd()))){if(JSON.stringify(a)===JSON.stringify(j)){!rt.hidden&&!M&&J();return}j=a,J(),Ue({reload:!0})}},gs=async(t=!1)=>{let e=[t||!ho?"":`since=${ho}`,Ze||yn?"":"open=1"].filter(Boolean).join("&");try{let s=await oe(`comments${e?`?${e}`:""}`);s.status===200&&Ji(await s.json())}catch{}},go=!1,fs=async()=>{if(!document.hidden){if(Yi||cs){go=!0;return}Yi=!0,await gs(),Yi=!1,go&&(go=!1,fs())}};Bl=()=>{go&&!cs&&(go=!1,fs())};let yd=()=>{let t=Go&&j.find(e=>e.id===Go);return t?(Go=0,Je()&&!An(t)&&Ns(It(t)?"clients":"studio"),Yt||sn(!0),ms(t.id),!0):!1},Zi=()=>{j=bt.filter(t=>t.route===Tt),yd()||J()},Qi=0,tr=null,Sa=()=>{tr&&Yt&&er(tr)},er=t=>{tr=t,!Qi&&(Qi=requestAnimationFrame(()=>{Qi=0;let e=t.target;if(!Yt||e.closest(tt)){is.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(is.hidden=!1,!s)return;let o=s.getBoundingClientRect();Cu.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,zr.textContent=s.tagName.toLowerCase()+([...s.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...s.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,zr.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-16)}px`}))},vd=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),te){te=null,J();return}if(R){Zs()&&(rn(),J());return}if(Y!==null){Y=null,J();return}sn(!1)}},wd=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],fo=!1,bo=null,bs=document.createElement("div");bs.className="dt-repin-hint",bs.hidden=!0,bs.setAttribute("role","status"),bs.textContent="Click the new spot for this thread \xB7 Esc cancels",document.body.append(bs);let $d=()=>{bo=null,bs.hidden=!0,Qt.toggle("dt-repinning",!1)},xd=t=>{bo=t,Y=null,bs.hidden=!1,Qt.toggle("dt-repinning",!0),J()};document.addEventListener("keydown",t=>{t.key==="Escape"&&bo!=null&&(t.stopImmediatePropagation(),$d())},!0);let Ed=!1,Md=t=>{fo||(t.type==="pointerdown"&&(Ed=t.pointerType==="touch"),!t.target.closest?.(tt)&&t.stopPropagation())},kd=t=>{let e=t.target;Ed&&(!e.closest?.(tt)||e.closest?.(".dt-pin"))&&t.preventDefault()},Ld=t=>{!fo&&t.button===0&&t.target.closest?.(":disabled")&&nr(t)},nr=t=>{if(fo)return;let e=t.target;if(e.closest(tt))return;if(t.preventDefault(),t.stopPropagation(),H){H=!1;return}if(!getSelection()?.isCollapsed)return;let s=t.detail===0&&!t.clientX&&!t.clientY,o=document.activeElement;et.hidden=!0;let a=s?o&&o!==document.body&&!o.closest(tt)?o:e:document.elementFromPoint(t.clientX,t.clientY);if(et.hidden=!1,!a)return;if(bo!=null){let h=bo;$d();let $=a.getBoundingClientRect();Sm(h,a,s?$.left+$.width/2:t.clientX,s?$.top+$.height/2:t.clientY);return}if(!Zs())return;rn();let r=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(h=>!/^(astro|svelte|css)-/.test(h)).slice(0,2);R={selector:ni(a),tag:l,classes:d,nth:si({tag:l,classes:d}).indexOf(a),rx:r.width&&!s?(t.clientX-r.left)/r.width:.5,ry:r.height&&!s?(t.clientY-r.top)/r.height:.5,label:Zt(ae(a.textContent||""),60),ctx:oi(a),fp:Zo(a),spot:{x:Math.round((s?r.left+r.width/2:t.clientX)+scrollX),y:Math.round((s?r.top+r.height/2:t.clientY)+scrollY)},opener:zu(a),category:g[0].id,...Je()&&Ve==="clients"?{shared:!0}:{}};let u=n.client||R.shared?null:so();u&&(R.assignee=u,R.stage="new",R.carried=!0),Y=null,is.hidden=!0,J()},um=2200,pm=900*1024,mm=8*1024*1024,hm=3*1024*1024,gm=50*1024*1024,Kt=(t,e=2800,s)=>{let o=document.createElement("div");o.className="dt-toast",o.textContent=t;for(let a of document.querySelectorAll(".dt-toast:not(.dt-toast--undo)"))ss(a,()=>a.remove());if(document.body.append(o),s){let a=s.getBoundingClientRect(),r=o.offsetWidth/2;o.style.left=`${Math.min(Math.max(a.left+a.width/2,r+8),innerWidth-r-8)}px`}return setTimeout(()=>ss(o,()=>o.remove()),e),o},Sd=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),r=ua.get(o);if(ua.delete(o),!r){Kt(`${a} was not sent \u2014 attach it again`);continue}let l=Kt(`Uploading ${a}\u2026`,12e4),d=await oe("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:r.name,size:r.size})}).then(B=>B.ok?B.json():null).catch(()=>null),u=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:r}).catch(()=>null),h=u?.ok&&await Q({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!h||!h.ok){Kt(u===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let $=Gn([await h.json().catch(()=>null)])[0];$&&(j=j.map(B=>B.id===$.id?$:B),J()),Kt(`${a} sent`)}},Td=t=>{let e=t.filter(s=>s.startsWith(ca)).map(s=>s.split("\0"));return e.length&&Kt(e.length===1?`${e[0][1]} was not sent \u2014 ${e[0][2]}`:`${e.length} files were not sent: ${e.map(([,s,o])=>`${s} (${o})`).join(", ")}`,6e3),t.filter(s=>!s.startsWith(ca))},Kn=async(t,e)=>{if(!navigator.onLine){Kt(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let s="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{s=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{s=""}(s.length>160||s.startsWith("<"))&&(s="")}Kt(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},fm=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),bm=async t=>{let e=await createImageBitmap(t),s=Math.min(1,um/Math.max(e.width,e.height));if(s===1&&t.size<=pm)return e.close(),fm(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*s),o.height=Math.round(e.height*s),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},sr=async(t,e)=>{let s=[],o=(a,r)=>s.push(`${ca}${a}\0${r}`);for(let a of t){let r,l=kc(a.name)||Object.keys(Ao).find(d=>Ao[d]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,$r.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>gm){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>hm&&ce.via){let u=`${Date.now()}-${ua.size}`;ua.set(u,a),s.push(`${ki}${u}\0${a.name}\0${a.size}`);continue}let d=await new Promise((u,h)=>{let $=new FileReader;$.onload=()=>u(String($.result).split(",")[1]),$.onerror=h,$.readAsDataURL(a)}).catch(()=>"");d?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${Mc(a.name)||"file"};ext=${l};base64,${d}`):o(a.name,"Could not be read");continue}try{r=await bm(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>mm){o(a.name,"Too large even after shrinking");continue}s.push(r)}if(s.length){if(!Number(e?.dataset.id)){R&&((R.images??=[]).push(...s),J());return}Le.push(...s),J(),yo(".dt-note-reply-input")}},Ad=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);et.addEventListener("paste",t=>{let e=Ad(t.clipboardData?.items);e.length&&(t.preventDefault(),sr(e,t.target.closest(".dt-note")))}),et.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),et.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),et.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=Ad(t.dataTransfer?.items);s.length&&sr(s,e)});let yo=t=>{let e=et.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},Hd=()=>{yo(".dt-note-edit-input"),et.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},or=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=Hi-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},ym=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Cd=t=>{let s=t.closest(".dt-compose").querySelector(".dt-mentions");s?.remove();let o=ym(t);if(!o)return;let a=o[1].toLowerCase(),r=Y!=null?j.find(h=>h.id===Y):void 0,d=(n.client||R?.shared||r&&It(r)?n.team??[]:da()).filter(h=>!Tr(h.email)).filter(h=>h.email!==n.me?.email&&[h.name,h.nickname,h.email].some($=>$?.toLowerCase().startsWith(a))).slice(0,5);if(!d.length)return;t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(h=>`<button type="button" role="option" data-act="mention" data-handle="${f(Ac(h))}">${Fn(h.avatar_url,h.name||h.email)}<span class="dt-mention-who"><b>${f(h.name||h.email)}</b>${h.name?`<span>${f(h.email)}</span>`:""}</span></button>`)].map((h,$)=>h.replace('role="option"',`role="option" aria-selected="${$===0}"`)).join("")}</div>`);let u=t.nextElementSibling;s&&(u.style.animation="none"),u.getBoundingClientRect().top<8&&u.classList.add("is-below")},vm='<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>',wm='<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>',Nd=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...ja].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>f(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=e.length?new RegExp(`@(?:${e.join("|")})${Er}`,"giu"):null;return Mr(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${f(o.url)}" target="_blank" rel="noopener noreferrer" title="${f(o.url)}">${o.kind==="pr"?vm:wi}<span>${f(o.label)}</span>${wm}</a>`:s?f(o).replace(s,a=>{let r=Dc(a,n.team??[],n.me?.email);return`<span class="dt-at" data-kind="${r}">${r==="agent"?De(10):""}${a}</span>`}):f(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let s=document.createElement("div");for(let a=0;a<e.rangeCount;a++)s.append(e.getRangeAt(a).cloneContents());let o=s.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",s.textContent??""),t.preventDefault()}});let Bd=(t,e)=>{let s=t.selectionStart??t.value.length,o=t.value.slice(0,s).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(s)}`,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()};document.addEventListener("pointerdown",t=>{for(let e of et.querySelectorAll(".dt-mentions"))e.contains(t.target)||(e.closest(".dt-compose")?.querySelector("textarea")?.setAttribute("data-no-mention",""),e.remove())},!0);let $m=(t,e)=>{if(!t){R&&(R.category=e),J();return}dn(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>Q({id:t,category:e}),"Changing the type")};ru([et,rt],f,Me),rt.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&sa(Number(e.dataset.id),e.value)}),rt.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),ml(Number(e.dataset.id)))},!0);let xm=t=>It(t)?"studio":"clients",ar=async(t,e=!1)=>{let s=j.find(r=>r.id===t);if(!s||It(s)&&s.client)return;let o=!It(s);Y===t&&(Y=null);let a=o&&Jt(s.assignee)?{assignee:null,stage:"new"}:{};await dn(r=>r.map(l=>l.id===t?{...l,...a.stage?{assignee:void 0,stage:"new"}:{},shared:o||void 0,client:o?l.client:void 0}:l),()=>Q(o?{id:t,shared:o,...a}:{id:t,shared:!1,client:!1}),o?"Moving it to Client":"Moving it to Team"),hs(bt),e||Oe(o?"Moved to Client":"Moved to Team",()=>ar(t,!0))},Em=async t=>{let e=j.find(d=>d.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...It(e)?{}:{shared:!0}};for(let d of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[d]!=null&&(o[d]=s[d]);let a=await zn(oe("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Kn("The copy was not made",a);return}let r=Gn([await a.json().catch(()=>null)])[0];r&&(bt=[...bt,r],j=bt.filter(d=>d.route===Tt)),hs(bt),J(),nn();let l=xm(e);Oe(l==="clients"?"Duplicated for the client":"Duplicated to Team",()=>{r&&(Ns(l),ms(r.id))},"Open")},Mm=["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"],Ta=async t=>{let e=[],s=0;for(let o of t){let a=bt.find(h=>h.id===o);if(!a||!It(a)||Uo(a))continue;let r=a,l={text:a.text,from:{id:a.id}};for(let h of Mm)r[h]!=null&&(l[h]=r[h]);let d=await zn(oe("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(l)})).catch(()=>null);if(!d?.ok){Kn("Not mirrored",d);break}let u=Gn([await d.json().catch(()=>null)])[0];u&&(d.status===201?e.push(u):s++,bt=[...bt.filter(h=>h.id!==u.id),u])}if(j=bt.filter(o=>o.route===Tt),hs(bt),J(),nn(),!e.length){s&&Kt("Already mirrored");return}Oe(`${e.length} mirrored to Team`,async()=>{let o=new Set(e.map(a=>a.id));bt=bt.filter(a=>!o.has(a.id)),j=j.filter(a=>!o.has(a.id)),hs(bt),J();for(let a of o)await zn(oe(`comments?id=${a}`,{method:"DELETE"})).catch(()=>null);nn()})},ir=()=>{Pe=null,Yo=null,ge(Xt())},Rd=async()=>{let t=[...Pe??[]];ir(),t.length&&await Ta(t)},km=(t,e)=>{let s=j.find(o=>o.id===t);if(Pe??=new Set,s&&ks(s)){let o=[...rt.querySelectorAll(".dt-hist-go[data-go]")].map(l=>Number(l.dataset.go)),a=o.indexOf(Yo??t),r=o.indexOf(t);if(e&&a>=0&&r>=0)for(let l of o.slice(Math.min(a,r),Math.max(a,r)+1)){let d=j.find(u=>u.id===l);d&&ks(d)&&Pe.add(l)}else Pe.has(t)?Pe.delete(t):Pe.add(t);Yo=t}ge(Xt())};document.addEventListener("keydown",t=>{t.key==="Escape"&&Pe&&(t.stopImmediatePropagation(),t.preventDefault(),ir())},!0);let Lm=t=>{let e=new URL(location.href);e.searchParams.has("notemend")||(e.search=e.search?`${e.search}&notemend`:"?notemend"),e.hash=`thread-${t}`;let s=e.href;navigator.clipboard?.writeText(s).then(()=>Kt("Link copied"),()=>Kt(s,6e3))};et.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,u=Number(e.dataset.id)||0;e.value="",d==="dup"?Em(u):d==="mirror"?Ta([u]):d==="move"?ar(u):d==="repin"?xd(u):d==="link"?Lm(u):d==="reopen"?tn(u,!1):d==="archive"||d==="unarchive"?us(u,d==="archive"):d==="rm"?(Y=null,Bi(u)):d==="discard"&&(R=null,J());return}let s=t.target.closest(".dt-lang-select");if(s){Ti(Number(s.dataset.id),s.dataset.at,s.value==="orig"?null:s.value);return}let o=t.target.closest(".dt-cat-select");if(o){$m(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){cp(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-owner-select");if(r){Ku(Number(r.dataset.id)||0,r.value);return}let l=t.target.closest(".dt-for-select");if(l){if(ct.setItem("nm-for",l.value),n.client){R&&(R.assignee=l.value,so(l.value),J());return}ci(Number(l.dataset.id)||0,"person")}}),et.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&R?.suggest){R.suggest.to=e.value,rs(),or(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!s)return;s.removeAttribute("data-no-mention"),Cd(s),s.classList.contains("dt-note-input")?R&&(R.text=s.value):s.classList.contains("dt-note-edit-input")?te&&(te.text=s.value):Re=s.value,rs(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),or(s);let o=s.closest(".dt-note");o&&o.getBoundingClientRect().bottom>ya()&&(Ii([]),o.classList.contains("is-capped")&&(o.scrollTop=o.scrollHeight))}),et.addEventListener("keydown",t=>{if(t.key==="Escape"&&et.querySelector(".dt-emoji")){t.stopPropagation();let a=Cn?.box??Cn?.btn;ma(),a?.focus();return}let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let s=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!s()&&!e.hasAttribute("data-no-mention")&&Cd(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),Bd(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),e.setAttribute("data-no-mention",""),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let jt=null,Aa=!1;function Is(t){return!n.client||!!n.me&&t.by===n.me.email}let Pd=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},rr=Pd("dt-drag-box--home"),Id=Pd("dt-drag-box--to"),Od=()=>{let t=document.body.currentCSSZoom??1;for(let e of document.querySelectorAll(".dt-notes-overlay, .dt-notes-hi, .dt-spot, .dt-pad-overlay, .dt-drag-box"))e.style.zoom=t===1?"":String(1/t)};Od(),addEventListener("resize",Od);let Sm=async(t,e,s,o)=>{let a=j.find(h=>h.id===t);if(!a)return;let r={...lr(e,s,o),fp:Zo(e),spot:{x:Math.round(s+scrollX),y:Math.round(o+scrollY)}},l={selector:a.selector,tag:a.tag,classes:a.classes,nth:a.nth,label:a.label,ctx:a.ctx,rx:a.rx,ry:a.ry,fp:a.fp,spot:a.spot},d=`${ha(a.tag,a.classes,a.selector)}${ae(a.label)?` \xAB${Zt(ae(a.label),24)}\xBB`:""}`,u=(h,$,B)=>dn(_=>_.map(p=>p.id===t?{...p,...h,anchor:null,...$?{repinnedAt:new Date().toISOString(),repinnedBy:n.me?.email??"you",repinnedFrom:d}:{repinnedAt:null,repinnedBy:null,repinnedFrom:null}}:p),()=>Q({id:t,move:h,anchor:null,repin:$?d:!1}),B);ls.delete(t),await u(r,!0,"Re-pinning"),Oe(`Pinned to ${vo(e)}`,()=>{ls.delete(t),u(l,!1,"Putting the pin back")})},Tm=()=>{let t=ii;ii=null;let e=t!=null?j.find(d=>d.id===t):null,s=e&&Qe(e);if(!e||!s||(Y===e.id&&ms(e.id),e.spot||!Is(e)))return;let o=s.getBoundingClientRect(),a=o.left+o.width*e.rx,r=o.top+o.height*e.ry,l={...lr(s,a,r),fp:Zo(s),spot:{x:Math.round(a+scrollX),y:Math.round(r+scrollY)}};ls.delete(e.id),Q({id:e.id,move:l,anchor:null}).then(d=>{d.ok&&Object.assign(e,l,{anchor:null})}).catch(()=>{})},Am=t=>{let e=j.find(r=>r.id===t),s=e&&Ce(e)?.opener;if(!e||!s)return;fo=!0;let o=s.getBoundingClientRect(),a={bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2,button:0,view:window};try{for(let r of["pointerdown","mousedown","pointerup","mouseup","click"])s.dispatchEvent(new(r.startsWith("pointer")?PointerEvent:MouseEvent)(r,a))}finally{fo=!1}Y=null,setTimeout(()=>{Qo(),Y=t,J()},180)},vo=t=>{let e=Zt(ae(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},qd=(t,e,s="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,t.querySelector("span").textContent=s,t.hidden=!1},Hm=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(tt)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,Cm=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},lr=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),r=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ni(t),tag:a,classes:r,nth:si({tag:a,classes:r}).indexOf(t),label:Us(t.textContent||"",60),ctx:oi(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,(s-o.top)/o.height)):.5}},dr=()=>{jt&&(jt.on&&Io(jt.pin,"land"),jt.pin.classList.remove("is-dragging"),Qt.toggle("dt-dragging",!1),rr.hidden=Id.hidden=!0,jt=null,en())};et.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=j.find(o=>o.id===Number(e.dataset.id));!s||!Is(s)||(jt={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:Qe(s),to:null},e.setPointerCapture(t.pointerId))}),et.addEventListener("pointermove",t=>{if(!jt||!jt.on&&Math.hypot(t.clientX-jt.x0,t.clientY-jt.y0)<4)return;jt.on=!0,jt.pin.classList.add("is-dragging"),Qt.toggle("dt-dragging",!0),jt.pin.style.left=`${t.clientX}px`,jt.pin.style.top=`${t.clientY}px`,jt.to=jt.home&&Cm(jt.home,t.clientX,t.clientY)?jt.home:Hm(t.clientX,t.clientY);let e=jt.to&&jt.to!==jt.home;qd(rr,jt.home,e?"":jt.home?vo(jt.home):""),rr.classList.toggle("is-left",!!e),qd(Id,e?jt.to:null,e?`Move to ${vo(jt.to)}`:"")}),et.addEventListener("pointerup",async t=>{if(!jt)return;let e=jt;if(!e.on||!e.to){dr();return}Aa=!0,setTimeout(()=>{Aa=!1},0);let s=j.find(d=>d.id===e.id),o=lr(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(dr(),!s)return;let r={selector:s.selector,tag:s.tag,classes:s.classes,nth:s.nth,label:s.label,ctx:s.ctx,rx:s.rx,ry:s.ry},l=(d,u)=>dn(h=>h.map($=>$.id===e.id?{...$,...d}:$),()=>Q({id:e.id,move:d}),u);await l(o,"Moving the pin"),a&&Oe(`Moved to ${vo(e.to)}`,()=>l(r,"Putting the pin back"))}),et.addEventListener("click",t=>{Aa&&(t.stopImmediatePropagation(),t.preventDefault(),Aa=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&jt?.on&&(t.stopImmediatePropagation(),dr())},!0),et.addEventListener("click",async t=>{let e=t.target.closest("button"),s=Cn?.btn;if(e?.closest(".dt-emoji")||ma(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="open-orig"){Ns("clients"),ms(a);return}if(o==="react"){Tl(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&Sl(e,!1,o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&Cn){let r=Cn;Sl(r.btn,!0,r);return}if(o==="emoji"&&Cn){let r=Cn;ma(),r.box?qp(r.box,e.dataset.emoji):r.id&&Tl(r.id,r.at||null,e.dataset.emoji);return}if(o==="prio"){let r=e.dataset.v||null;a?dn(l=>l.map(d=>d.id===a?{...d,priority:r??void 0}:d),()=>Q({id:a,priority:r}),"Setting the priority"):R&&(R.priority=r??void 0,rs(),J());return}if(o==="mention"){let r=e.closest(".dt-compose")?.querySelector("textarea");r&&Bd(r,e.dataset.handle);return}if(!o){if(R&&!Zs())return;Y=Y===a?null:a,rn(),J(),ps&&va();return}if(o==="speak"){Ap(e.closest(".dt-note"),e);return}if(o==="voice-write"){Cp(e);return}if(o==="voice"||o==="voice-seek"){fp(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&&sr([...r.files],l)}),r.click();return}if(o==="unshot"){a?te&&te.drop.push(e.dataset.img):(e.closest("[data-draft]")?R?.images??[]:Le).splice(Number(e.dataset.i),1),J(),te&&Hd();return}if(o==="edit"){let r=j.find(u=>u.id===a),l=e.dataset.at||null,d=l?r?.replies?.find(u=>u.at===l)?.text:r?.text;if(d===void 0)return;te={id:a,at:l,text:d,drop:[]},J(),Hd();return}if(o==="edit-cancel"){te=null,J();return}if(o==="tr-orig"){Ti(a,e.dataset.at,null);return}if(o==="tr-retry"){Ti(a,e.dataset.at,e.dataset.to);return}if(o==="unsay"){let r=e.dataset.at;Kp(a,r);return}if(o==="edit-save"){let r=te;if(!r)return;let l=r.text.trim();if(!l){et.querySelector(".dt-note-edit-input")?.focus();return}te=null;let d=u=>r.drop.includes(u.split("/").pop());await dn(u=>u.map(h=>h.id!==r.id?h:{...h,...r.at==null?{text:l}:{replies:(h.replies??[]).map($=>$.at===r.at?{...$,text:l}:$)},images:(h.images??[]).filter($=>!d($))}),()=>Q({id:r.id,edit:{at:r.at,text:l},...r.drop.length?{removeImage:r.drop}:{}}).then(u=>(u.ok||(te=r),u),u=>{throw te=r,u}),"Saving the edit");return}if(o==="cancel"){Zs()&&(rn(),J());return}if(o==="twin"){if(!Zs())return;rn(),Y=Number(e.dataset.id),J();return}if(o==="discard"){R=null,J();return}if(o==="draft-open"){Di(Number(e.dataset.i));return}if(o==="close"){Y=null,J();return}if(o==="go-spot"){let r=j.find(l=>l.id===Number(e.dataset.id));r&&tl(r);return}if(o==="show-el"){let r=j.find(l=>l.id===Number(e.dataset.id));r&&Qe(r)?.scrollIntoView({block:"center",inline:"center",behavior:ns()?"smooth":"auto"});return}if(o==="where"){let r=j.find(_=>_.id===Number(e.dataset.id)),l=r&&Ce(r),d=l?.hidden;if(!d)return;let u=_=>{let p=_.getBoundingClientRect();return(p.width||p.height)&&_.checkVisibility?.()!==!1?p:null},h=l.shut instanceof HTMLElement?l.shut:null,$=h&&u(h);if(h&&!$){let _=h.getAttribute("style");h.setAttribute("style",`${_??""};display:block!important`),$=u(h),_==null?h.removeAttribute("style"):h.setAttribute("style",_)}$??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let B=document.createElement("div");B.className="dt-where",B.style.cssText=`left:${$.left}px;top:${$.top}px;width:${$.width}px;height:${$.height}px`,document.body.append(B),On(B).then(()=>B.remove());return}if(o==="unsuggest"&&R){R.suggest=null,J();return}if(o==="uncarry"&&R){R.assignee="",R.carried=!1,so(""),rs(),J();return}if(o==="save"){if(!R)return;R.images&&(R.images=Td(R.images));let r=(R.images??[]).filter(V=>!Ts(V)),l=R.suggest&&R.suggest.to.trim()!==R.suggest.from?{from:R.suggest.from,to:R.suggest.to.trim()}:null,d=et.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(R.images?.some($i)?kl:R.images?.some(V=>Ts(V)&&!Ho(V))?"See the attached image":R.images?.length?"See the attached file":"");if(!d){et.querySelector(".dt-note-input")?.focus();return}let u=R,h=n.client||u.shared===!0?null:Sr(d,no()),$={...u,images:u.images?.filter(Ts),route:Tt,text:d,suggest:l,assignee:n.client?wl(u.assignee)||void 0:h??(u.assignee||void 0),shared:n.client?!0:u.shared===!0,stage:n.client?"new":h?"approved":u.stage??(Jt(u.assignee)?"approved":"new"),breakpoint:ei(),browser:qu(),device:M?Dd:"",viewport:{w:innerWidth,h:innerHeight},logs:eu(),host:location.host},B={...u,id:-Date.now(),text:d,route:Tt,status:"open",note:"",doneBy:null,breakpoint:$.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:n.me?.email,byName:n.me?.name};j=[...j,B],R=null,J();let _=await zn(oe("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify($)})).catch(()=>null);if(!_?.ok){j=j.filter(V=>V!==B),rn(),R=u,J(),Kn("Thread was not saved",_);return}let p=Gn([await _.json().catch(()=>null)])[0];j=j.map(V=>V===B&&p?p:V),J(),p&&r.length&&Sd(p.id,r),nn();return}if(o==="reply"){let r=et.querySelector(".dt-note-reply-input");Le=Td(Le);let l=r.value.trim()||(Le.some($i)?kl:Le.some(Z=>Ts(Z)&&!Ho(Z))?"See the attached image":Le.length?"See the attached file":"");if(!l){r.focus();return}let d=Le;Re=l,bn=a,Qs(),Re="",Le=[],r.value="";let u=j,h=j.find(Z=>Z.id===a),$=n.client||It(h)?null:Sr(l,no()),B=$&&h&&($!==h.assignee||qe(h)!=="approved"||h.status==="done")?{assignee:$,stage:"approved",...h.status==="done"?{status:"open",doneBy:null}:{}}:{};j=j.map(Z=>Z.id===a?{...Z,...B,replies:[...Z.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:n.me?.email}]}:Z),_o=a,J();let _=await zn(Q({id:a,reply:l,images:d.filter(Ts),...B})).catch(()=>null);if(!_?.ok){j=u,Re=l,Le=d,J();let Z=et.querySelector(".dt-note-reply-input");Z&&!Z.value&&(Z.value=l);let qt=()=>et.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?Oe(`Reply was not sent${_?` (${_.status})`:""} \u2014 it is back in the box`,qt,"Retry"):Kn("Reply was not sent",_);return}Qs();let p=Gn([await _.json().catch(()=>null)])[0];p&&(j=j.map(Z=>Z.id===p.id?p:Z),J()),nn();let V=d.filter(Z=>!Ts(Z));V.length&&Sd(a,V);return}if(o==="unfold"){Ss.set(a,1/0),J();let r=et.querySelector(`.dt-note[data-id="${a}"] .dt-note-thread`);if(r){for(let l of r.querySelectorAll(".dt-msg--new"))l.classList.remove("dt-msg--new");r.scrollTop=r.scrollHeight,zo(r)}delete We[a],r?.parentElement?.querySelector(".dt-new-below")?.remove();return}if(o==="newbelow"){let r=e.closest(".dt-note")?.querySelector(".dt-note-thread");r?.scrollTo({top:r.scrollHeight,behavior:ns()?"smooth":"auto"}),delete We[a],e.remove();return}if(o==="hand"){ci(a,e.dataset.v);return}if(o==="repin"){xd(a);return}if(o==="open-it"){Am(a);return}if(o==="lost-resolve"){Y=null,await tn(a,!0);return}if(o==="claude"){ml(a);return}if(o==="sendback"){await tn(a,!1),yo(".dt-note-reply-input");return}if(o==="accept"){await tn(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(Y=null),await us(a,o==="archive");return}e.classList.contains("dt-step-act")||(Y=null),o==="rm"?await Bi(a):await tn(a,o==="done")});let Dd="",Ue=t=>{Sn.hidden||Ys.contentWindow?.postMessage({dt:!0,...t},location.origin)},Nm=()=>({notes:Yt,grid:!At.hidden,inspect:ht,resolved:Ze,archived:yn,...Fd.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(M&&e.projectGrid!==void 0){Ft=e.projectGrid,At.hidden||fe();return}if(!M&&t.source===Ys.contentWindow){if(e.key){pc(e.key[0],e.key[1])?.run();return}if(e.closeMenus){O();return}if(e.route){E();return}if(e.drafts){Ci=e.drafts,ge(Xt());return}}if(M&&typeof e.openDraft=="number"){Di(e.openDraft);return}if(M&&typeof e.dropDraft=="number"){Xl(e.dropDraft);return}if(M&&typeof e.device=="string"&&(Dd=e.device),M&&e.scrollbar&&Qt.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Ys.contentWindow){Ue(Nm());return}typeof e.notes=="boolean"&&e.notes!==Yt&&sn(e.notes,!1),typeof e.open=="number"&&ms(e.open),typeof e.grid=="boolean"&&e.grid===At.hidden&&yt(e.grid),typeof e.inspect=="string"&&e.inspect!==ht&&U(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Ze&&ji(e.resolved),typeof e.archived=="boolean"&&e.archived!==yn&&_i(e.archived),e.reload&&gs()});let nn=async()=>{await gs(),Ue({reload:!0}),M&&parent.postMessage({dt:!0,reload:!0},location.origin)},sn=(t,e=!0)=>{if(Yt=t,Pt.setAttribute("aria-pressed",String(t)),t?!M&&rt.hidden&&ct.getItem("dt-history")==="1"&&(Zl(),xe.setAttribute("aria-pressed","true")):(Jl(()=>{Yt||rt.replaceChildren()}),xe.setAttribute("aria-pressed","false")),z(Vr,t?"1":"0"),Ue({notes:t}),M&&e&&parent.postMessage({dt:!0,notes:t},location.origin),et.hidden=!t||!Sn.hidden,Qt.toggle("dt-noting",t),t&&!M?sd():document.querySelector(".dt-room")?.remove(),t){U(""),document.addEventListener("click",nr,!0),document.addEventListener("pointerup",Ld,!0);for(let s of wd)document.addEventListener(s,Md,!0);document.addEventListener("contextmenu",kd,!0),document.addEventListener("keydown",vd),document.addEventListener("mousemove",er),addEventListener("scroll",en,!0),addEventListener("scroll",Sa,!0),addEventListener("scroll",va,!0),addEventListener("resize",en),addEventListener("resize",Sa),addEventListener("pointerover",rd,!0),Qo(),ad.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),id.observe(document.body),Zi()}else{rn(),Y=null,document.removeEventListener("click",nr,!0),document.removeEventListener("pointerup",Ld,!0);for(let s of wd)document.removeEventListener(s,Md,!0);document.removeEventListener("contextmenu",kd,!0),document.removeEventListener("keydown",vd),document.removeEventListener("mousemove",er),is.hidden=!0,removeEventListener("scroll",en,!0),removeEventListener("scroll",Sa,!0),removeEventListener("scroll",va,!0),removeEventListener("resize",en),removeEventListener("resize",Sa),removeEventListener("pointerover",rd,!0),ad.disconnect(),id.disconnect(),et.innerHTML=""}},{pickBp:cr,...Fd}=gu({cfg:n,inFrame:M,persist:z,frame:Sn,frameEl:Ys,devicesMenu:as,bpBtns:Ut,notesOverlay:et,WIDE:b,bpOf:L,currentBp:ei,deviceById:T,notesOn:()=>Yt,filter:()=>Za,filterTo:t=>{Za=t},dropFrameDrafts:()=>{Ci=[]},putAway:()=>{Y=null,rn()},tellFrame:Ue,syncBpButtons:Xr,render:()=>J(),reread:()=>{Yt?Zi():J()}}),jd="dt-studio",_d=t=>{os.setAttribute("aria-pressed",String(t)),Qt.toggle("dt-no-studio",!t),z(jd,t?"1":"0")};os.addEventListener("click",()=>_d(os.getAttribute("aria-pressed")!=="true")),_d(ct.getItem(jd)!=="0"),Pt.addEventListener("click",()=>sn(!Yt));let we=document.querySelector(".devtools"),Os=document.querySelector(".dt-tab"),Wd=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-we.getBoundingClientRect().top)+12}px`);new ResizeObserver(Wd).observe(we),addEventListener("resize",Wd);let Bm=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),zd=()=>{we.removeAttribute("data-tight");let t=we.getBoundingClientRect().right,e=Bm(),s=!1;for(let o of we.children){let a=o.getBoundingClientRect();t=Math.max(t,a.right),e?.width&&e.left<a.right+8&&e.right>a.left-8&&e.top<a.bottom&&e.bottom>a.top&&(s=!0)}we.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||s)},Vd=0,ur=()=>{cancelAnimationFrame(Vd),Vd=requestAnimationFrame(zd)},Rm=new ResizeObserver(ur);for(let t of we.children)Rm.observe(t);addEventListener("resize",ur),zd();for(let t of[1500,4e3])setTimeout(ur,t);for(let t of w)t.addEventListener("toggle",()=>{let e=t.querySelector(":scope > :not(summary)");if(!e||(e.style.translate="",!t.open||rt.hidden||t.matches(".dt-keys")))return;let s=e.getBoundingClientRect(),o=rt.getBoundingClientRect();o.width&&s.right>o.left-8&&s.bottom>o.top&&s.top<o.bottom&&(e.style.translate=`${Math.round(o.left-8-s.right)}px 0`)});let Gd=t=>{we.toggleAttribute("data-collapsed",t),Os.toggleAttribute("data-collapsed",t),Os.setAttribute("aria-expanded",String(!t)),Os.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),we.inert=t,t&&O(),t&&Fs&&Ca(""),t&&Yt&&!R&&Y==null&&sn(!1),z("dt-collapsed",t?"1":"0")};Os.addEventListener("click",()=>Gd(!we.hasAttribute("data-collapsed")));let un=document.querySelector(".dt-keys"),Kd=un.querySelector(".dt-set-keys"),Pm=un.querySelector(".dt-set-main"),wo=un.querySelector(".dt-set-grid"),Ud=un.querySelector('[data-set="grid"] .dt-set-hint'),$o=t=>{if(Pm.hidden=t!=="main",Kd.hidden=t!=="keys",wo.hidden=t!=="grid",t==="grid"&&Dm(),Ud){let e=ne();Ud.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},pr=t=>$o(t?"keys":"main"),mr={desktop:{cols:12,gutter:24,margin:24,max:1200},tablet:{cols:8,gutter:16,margin:24,max:null},landscape:{cols:4,gutter:16,margin:16,max:null},portrait:{cols:4,gutter:16,margin:16,max:null}},xo={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},Im=["cols","gutter","margin","max"],Ha=(t,e)=>Math.min(xo[t][1],Math.max(xo[t][0],Math.round(e))),Om=()=>({...mr,...Ft?.widths}),hr=()=>!!n.project&&!!n.gridAdmin,Yd=()=>!At.hidden&&!ne()&&zt?zt:me(),qm=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},Dm=()=>{let t=hr(),e=Om(),s=Lt(),o=ne(),a=m.find(u=>u.id===s),r=(u,h)=>`<div class="dt-grid-row"><span>${u}</span><b>${h}</b></div>`,l=(ce.cabinet||n.cabinet)&&n.project?` <a href="${f(`${ce.cabinet||n.cabinet}/p/${n.project}?tab=settings`)}" target="_blank" rel="noopener">Also in the cabinet \u203A</a>`:"",d;if(o)d=`<p class="dt-grid-band">${f(a.label.toUpperCase())} \xB7 ${a.ideal} \u2014 this width</p>
338
- <div class="dt-grid-fields">${Im.map(u=>`<label><span>${u==="cols"?"Cols":u[0].toUpperCase()+u.slice(1)}</span>
339
- <input type="number" inputmode="numeric" step="1" min="${xo[u][0]}" max="${xo[u][1]}" data-grid-k="${u}" value="${o[u]??""}"${u==="max"?' placeholder="\u2014"':""}${t?"":" disabled"}></label>`).join("")}</div><hr>
340
- ${m.filter(u=>u.id!==s&&e[u.id]).map(u=>r(`${f(qm(u.label))} \xB7 ${u.ideal}`,`${e[u.id].cols} \xB7 ${e[u.id].gutter} \xB7 ${e[u.id].margin}`)).join("")}<hr>
341
- <p class="dt-grid-foot">${t?"Saved for the project \u2014 everyone sees it.":"Set by the project\u2019s admins."}${l}</p>`;else{let u=Yd();d=r(u.from==="guess"?"Guessed":"Read from the page",`${u.cols} \xD7 ${u.w}`)+r("Gap",String(u.gap))+r("Margin",String(u.x))}wo.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${Wa}<span>Grid</span></button><hr>`+(n.project?`<div class="dt-grid-from"><span>Columns from</span><div class="dt-seg" role="radiogroup" aria-label="Columns from">${["auto","custom"].map(u=>`<button type="button" role="radio" data-grid-mode="${u}" aria-checked="${u==="custom"==!!o}"${t?"":" disabled"}>${u==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},Xd=async(t,e)=>{let s=Ft,o=u=>{u&&!wo.hidden&&$o("grid"),At.hidden||fe(),Ue({projectGrid:Ft})};Ft=t(Ft),o(e);let a=await oe("config").then(u=>u.ok?u.json():null).catch(()=>null),r=t(a?a.projectGrid??null:s),l=await oe("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:r})}).catch(()=>null);if(l?.ok){Ft=(await l.json()).grid??null;return}let d=l?await l.text():"";Kt(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),Ft=s,o(!0)};if(wo.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!hr()||e==="custom"==!!ne())return;let s=Lt(),o=e==="custom"?Yd():null,a=document.documentElement.clientWidth,r=o&&{cols:Ha("cols",o.cols),gutter:Ha("gutter",o.gap),margin:Ha("margin",o.x),max:Math.abs(a-2*o.x-o.w)<=2?null:Ha("max",o.w)};Xd(l=>({mode:e,widths:{...mr,...l?.widths,...r?{[s]:r}:{}}}),!0)}),wo.addEventListener("change",t=>{let e=t.target,s=e.dataset.gridK,o=ne();if(!s||!o||!hr())return;let a=e.value.trim()===""?null:Number(e.value),[r,l]=xo[s];if(a===null?s!=="max":!Number.isInteger(a)||a<r||a>l){Kt(`${s==="cols"?"Cols":s[0].toUpperCase()+s.slice(1)} is ${r}\u2013${l}${s==="max"?" or empty":""}.`),e.value=String(o[s]??"");return}if(a===o[s])return;let d=Lt();Xd(u=>({mode:"custom",widths:{...mr,...u?.widths,[d]:{...u?.widths?.[d]??o,[s]:a}}}),!1)}),ft.querySelector("button").addEventListener("click",()=>{O(),un.open=!0,$o("grid")}),$o("main"),ce.signOut)for(let t of document.querySelectorAll('.dt-me [data-set="out"], .dt-me [data-set-out]'))t.hidden=!1;let gr=()=>{},Jd=()=>!1;Fm();function Fm(){let t=document.querySelector(".dt-strip"),e=document.querySelector(".dt-strip-grip"),s=document.documentElement;if(M){t.hidden=e.hidden=!0;return}let o=t.querySelector(".dt-strip-pin"),a=ct.getItem("dt-strip-pin")==="1",r=!1,l=!1,d=0,u=0,h=()=>l||!!t.querySelector("details[open]")||t.matches(":hover")||!!t.querySelector(":focus-visible"),$=y=>{r=y||a,r||(l=!1),t.classList.toggle("is-out",r),t.inert=!r,Qt.toggle("dt-strip-out",r)},B=()=>{clearTimeout(u),u=window.setTimeout(()=>{r&&!a&&!h()&&$(!1)},350)};gr=y=>{l=y&&!a,$(y)},Jd=()=>r,document.addEventListener("mousemove",y=>{a||(y.clientY<=3?r||(d||=window.setTimeout(()=>{d=0,$(!0)},140)):(clearTimeout(d),d=0,r&&y.clientY>40&&B()))}),s.addEventListener("mouseleave",()=>{clearTimeout(d),d=0,r&&B()}),t.addEventListener("toggle",()=>{r&&B()},!0),t.addEventListener("focusout",()=>{r&&B()}),e.addEventListener("click",()=>$(!0)),document.addEventListener("pointerdown",y=>{r&&!a&&!t.contains(y.target)&&y.target!==e&&(l=!1,O(),$(!1))});let _=y=>{if(a=y,ct.setItem("dt-strip-pin",y?"1":"0"),o.setAttribute("aria-pressed",String(y)),o.dataset.tip=y?"Let it hide \u2014 the site moves back":"Keep it out \u2014 moves the site",Qt.toggle("dt-strip-on",y),y)Z();else{for(let[q,K]of p)q.style.top=K;p.clear()}$(!0)};o.addEventListener("click",()=>_(!a)),document.addEventListener("keydown",y=>{y.key==="Escape"&&r&&!a&&!t.querySelector("details[open]")&&$(!1)});let p=new Map,V=y=>{let q=getComputedStyle(y);if(q.position!=="fixed"&&q.position!=="sticky")return null;let K=y.computedStyleMap?.().get("top")?.toString();if(K?K==="auto":q.top==="auto"||parseFloat(q.top)>parseFloat(q.bottom))return null;if(q.position==="sticky"){for(let W=y.parentElement;W&&W!==document.body;W=W.parentElement)if(getComputedStyle(W).overflowY!=="visible")return null}return`calc(${q.top} + 40px)`},Z=y=>{if(!a)return;for(let W of y??[])W.style.top=p.get(W)??"",p.delete(W);let K=(y??[...document.body.children].filter(W=>!/(^|\s)(dt-|devtools)/.test(String(W.className))).flatMap(W=>[W,...W.querySelectorAll("*")])).filter(W=>W.isConnected&&W.style&&!p.has(W)).map(W=>[W,V(W)]).filter(W=>W[1]);for(let[W,ot]of K)p.set(W,W.style.top),W.style.setProperty("top",ot,"important"),qt.observe(W,{attributes:!0,attributeFilter:["class"]})},qt=new MutationObserver(y=>Z([...new Set(y.map(q=>q.target))].filter(q=>p.has(q)))),Ot=0,ie=()=>{Ot||=window.setTimeout(()=>{Ot=0,Z()},500)};new MutationObserver(y=>{y.every(nd)||ie()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),addEventListener("resize",()=>{Z([...p.keys()]),ie()}),_(a),$(a);let pt=t.querySelector(".dt-me");if(n.me){pt.querySelector(".dt-me-face").innerHTML=Fn(n.me.avatar_url,n.me.name||n.me.email).replace(/^<(img|b) /,`<$1 style="--hue:${Ie(n.me.email.toLowerCase())}" `);let y=ce.cabinet||n.cabinet;if(y){let q=pt.querySelector(".dt-me-cab"),K=pt.querySelector(".dt-me-acc");q.href=n.project?`${y}/p/${n.project}`:y,q.hidden=!1,K.href=`${y}/settings?tab=account`,K.hidden=!1}}pt.addEventListener("click",y=>{let q=y.target.closest("[data-set], a");q&&(pt.open=!1,q.dataset.set==="out"&&confirm("Sign out of Notemend on this site?")&&(ct.removeItem(Ps),ce.signOut?.()))});let St=t.querySelector(".dt-pages"),gt=St.querySelector(".dt-pages-find input"),kt=St.querySelector(".dt-pages-hits"),Nt=St.querySelector(".dt-pages-foot");St.addEventListener("toggle",()=>{if(St.open){gt.value="",Te(),requestAnimationFrame(()=>gt.focus());let y=St.querySelector(".dt-pages-copy");y&&(delete y.dataset.copied,y.dataset.tip="Copy link")}});let Te=()=>{let y=gt.value.trim().toLowerCase();if(vt.hidden=!!y,kt.hidden=!y,Nt.classList.toggle("is-off",!!y),!y)return;let q=n.pages.filter(K=>K.label.toLowerCase().includes(y)||K.route.toLowerCase().includes(y)).slice(0,12);kt.innerHTML=q.length?`<ul>${q.map(K=>`<li><a href="${f(K.route)}"${K.route===Tt?' aria-current="page"':""}><span class="dt-menu-label">${f(K.label)}</span><em class="dt-pages-route">${f(K.route)}</em></a></li>`).join("")}</ul>`:`<p class="dt-pages-none">No page matches \u201C${f(gt.value.trim())}\u201D</p>`};gt.addEventListener("input",Te),gt.addEventListener("keydown",y=>{y.key==="Enter"&&(y.preventDefault(),kt.querySelector("a")?.click()),y.key==="Escape"&&gt.value&&(y.preventDefault(),y.stopPropagation(),gt.value="",Te())});let re=St.querySelector(".dt-pages-copy"),le=y=>{y.preventDefault(),y.stopPropagation(),y instanceof MouseEvent&&y.detail>0&&re.blur(),navigator.clipboard?.writeText(location.href.replace(/#.*$/,"")).catch(()=>null),re.dataset.copied="",re.dataset.tip="Link copied",clearTimeout(Number(re.dataset.t)),re.dataset.t=String(window.setTimeout(()=>{delete re.dataset.copied,re.dataset.tip="Copy link"},1600))};re.addEventListener("click",le),re.addEventListener("keydown",y=>{(y.key==="Enter"||y.key===" ")&&le(y)}),be=()=>{E(),hs(bt),N&&Mn()};let Rn=()=>{z("dt-folders-open",JSON.stringify([...nt])),z("dt-folders-closed",JSON.stringify([...G]))};if(vt.addEventListener("click",y=>{let q=y.target,K=q.closest(".dt-folder-more");if(K)return y.preventDefault(),Oa(K);let W=q.closest(".dt-folder-row");if(!W||W.querySelector("input"))return;let ot=W.parentElement,Mt=ot.dataset.folder,dt=!ot.hasAttribute("data-open");dt?(nt.add(Mt),G.delete(Mt)):(nt.delete(Mt),G.add(Mt)),Rn(),ot.toggleAttribute("data-open",dt),W.setAttribute("aria-expanded",String(dt)),W.children[1].outerHTML=Vt(dt),Ga(ot.querySelector(":scope > ul"),dt)}),vt.addEventListener("keydown",y=>{(y.key==="Enter"||y.key===" ")&&y.target.matches(".dt-folder-row")&&(y.preventDefault(),y.target.click())}),!N)return;let de=new Set,Ne="",Ia=y=>{let q=y.closest("li[data-route]");if(q)return`p:${q.dataset.route}`;let K=y.closest(".dt-folder:not(.dt-folder--site)");return K&&y.closest(".dt-folder-row")?`f:${K.dataset.folder}`:""},ko=()=>[...vt.querySelectorAll("li[data-route], .dt-folder:not(.dt-folder--site)")].filter(y=>y.matches(".dt-folder")||y.offsetParent).map(y=>y.dataset.route?`p:${y.dataset.route}`:`f:${y.dataset.folder}`),js=Nt.querySelector(".dt-sel-hint");function Mn(){for(let q of vt.querySelectorAll(".is-picked"))q.classList.remove("is-picked");for(let q of de)(q.startsWith("p:")?vt.querySelector(`li[data-route="${CSS.escape(q.slice(2))}"] > a`):vt.querySelector(`[data-folder="${CSS.escape(q.slice(2))}"] > .dt-folder-row`))?.classList.add("is-picked");let y=de.size;js.hidden=!y,js.innerHTML=y?`<b>${y} selected</b><button type="button" data-sel="group"><kbd>\u2318G</kbd> Group</button><button type="button" data-sel="ungroup"><kbd>\u2318\u21E7G</kbd> Ungroup</button>`:""}let _s=()=>{de.size&&(de.clear(),Ne="",Mn())};vt.addEventListener("click",y=>{let q=y,K=q.metaKey||q.ctrlKey,W=q.shiftKey,ot=Ia(y.target);if(!ot||!K&&!W){y.target.closest(".dt-folder-more")||_s();return}if(y.preventDefault(),y.stopImmediatePropagation(),W&&Ne){let Mt=ko(),dt=Mt.indexOf(Ne),ut=Mt.indexOf(ot);if(dt>=0&&ut>=0)for(let Be of Mt.slice(Math.min(dt,ut),Math.max(dt,ut)+1))de.add(Be)}else de.has(ot)?de.delete(ot):de.add(ot);Ne=ot,Mn()},!0),St.addEventListener("toggle",()=>{St.open||_s()});let Ws=()=>{let y=ko().filter(dt=>de.has(dt)&&dt.startsWith("p:")).map(dt=>dt.slice(2)),q=[...de].filter(dt=>dt.startsWith("f:")).map(dt=>dt.slice(2)).filter(dt=>!S.some(ut=>de.has(`f:${ut.id}`)&&pn(dt,ut.id)));if(!y.length&&!q.length)return;let K=new Set([...y.map(dt=>S.find(ut=>ut.pages.includes(dt))?.id??""),...q.map(dt=>S.find(ut=>ut.id===dt)?.parent??"")]),W=K.size===1&&[...K][0]||null,ot=Math.random().toString(36).slice(2,10),Mt=[{id:ot,name:"Untitled folder",pages:y,...W?{parent:W}:{}},...S.map(dt=>({...dt,pages:dt.pages.filter(ut=>!y.includes(ut)),...q.includes(dt.id)?{parent:ot}:{}}))];W&&(nt.add(W),G.delete(W)),de.clear(),Ne="",nt.add(ot),G.delete(ot),Rn(),Ae(Mt),Xn(ot,!1)};js.addEventListener("click",y=>{let q=y.target.closest("[data-sel]")?.dataset.sel;q==="group"&&Ws(),q==="ungroup"&&$t()});let $t=()=>{let y=new Set([...de].filter(W=>W.startsWith("f:")).map(W=>W.slice(2)));for(let W of de)if(W.startsWith("p:")){let ot=S.find(Mt=>Mt.pages.includes(W.slice(2)));ot&&y.add(ot.id)}if(!y.size)return;let q=S,K=S.filter(W=>y.has(W.id));de.clear(),Ne="",Ae(vs(S,y)),Oe(K.length===1?`Ungrouped \u201C${K[0].name}\u201D`:`Ungrouped ${K.length} folders`,()=>Ae(q))};document.addEventListener("keydown",y=>{if(!(!St.open||y.target?.closest?.("input:not(.dt-pages-find input), textarea"))){if(y.key==="Escape"&&de.size){y.preventDefault(),y.stopImmediatePropagation(),_s();return}(y.metaKey||y.ctrlKey)&&y.code==="KeyG"&&de.size&&(y.preventDefault(),y.stopImmediatePropagation(),y.shiftKey?$t():Ws())}},!0),vt.addEventListener("dblclick",y=>{let q=y.target.closest(".dt-folder:not(.dt-folder--site)");!q||y.target.closest(".dt-folder-more, input")||!y.target.closest(".dt-folder-row")||(y.preventDefault(),Xn(q.dataset.folder,!1))});let Ae=async y=>{let q=S;S=y,Ht();let K=await oe("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({folders:y})}).catch(()=>null);if(K?.ok){let ot=(await K.json()).folders??[];JSON.stringify(ot)!==JSON.stringify(S)&&(S=ot,Ht());return}let W=K?await K.text():"";Kt(K?(()=>{try{return JSON.parse(W).error}catch{return W}})()||"The folders were not saved.":"The folders were not saved \u2014 no connection."),S=q,Ht()},vs=(y,q)=>{let K=y.map(W=>({...W,pages:[...W.pages]}));for(let W of q){let ot=K.find(ut=>ut.id===W);if(!ot)continue;let Mt=ot.parent&&K.some(ut=>ut.id===ot.parent&&ut.id!==W)?ot.parent:null;K=K.filter(ut=>ut.id!==W).map(ut=>ut.parent===W?{...ut,parent:Mt}:ut);let dt=Mt?K.find(ut=>ut.id===Mt):null;if(dt)for(let ut of ot.pages)dt.pages.includes(ut)||dt.pages.push(ut)}return K.map(({parent:W,...ot})=>W?{...ot,parent:W}:ot)},pn=(y,q)=>{let K=S.find(W=>W.id===y);return!!K?.parent&&(K.parent===q||pn(K.parent,q))},Xn=(y,q)=>{let K=vt.querySelector(`[data-folder="${CSS.escape(y)}"] .dt-folder-row .dt-menu-label`);if(!K)return;let W=S.find(ut=>ut.id===y),ot=document.createElement("input");ot.className="dt-folder-name",ot.value=W.name,ot.maxLength=60,ot.setAttribute("aria-label","Folder name"),K.replaceWith(ot),ot.focus(),ot.select();let Mt=!1,dt=ut=>{if(Mt)return;Mt=!0;let Be=ot.value.trim();if(ut&&Be)return void Ae(S.map(kn=>kn.id===y?{...kn,name:Be}:kn));q&&(S=S.filter(kn=>kn.id!==y)),Ht()};ot.addEventListener("keydown",ut=>{ut.key==="Enter"&&(ut.preventDefault(),dt(!0)),ut.key==="Escape"&&(ut.preventDefault(),ut.stopPropagation(),dt(!1)),ut.stopPropagation()}),ot.addEventListener("blur",()=>dt(!0)),ot.addEventListener("click",ut=>ut.stopPropagation())};Nt.querySelector(".dt-folder-new").addEventListener("click",()=>{let y=Math.random().toString(36).slice(2,10);S=[{id:y,name:"Untitled folder",pages:[]},...S],nt.add(y),Rn(),Ht(),Xn(y,!0)});let ee=null,mn=()=>{ee?.remove(),ee=null};St.addEventListener("toggle",()=>{St.open||mn()});function Oa(y){mn();let q=y.closest(".dt-folder").dataset.folder,K=S.find(Mt=>Mt.id===q);ee=document.createElement("div"),ee.className="dt-folder-menu",ee.setAttribute("role","menu"),ee.innerHTML=`<button type="button" role="menuitem" data-do="rename">${es}<span>Rename</span></button><button type="button" role="menuitem" data-do="add">${xt('<path d="M10 4.5v11M4.5 10h11" />',13)}<span>Add pages\u2026</span></button><button type="button" role="menuitem" data-do="sub">${Vt(!1)}<span>New folder inside</span></button>`+(K.pages.length||S.some(Mt=>Mt.parent===K.id)?`<button type="button" role="menuitem" data-do="ungroup">${xt('<rect x="3" y="3" width="6" height="6" rx="1.5" /><rect x="11" y="11" width="6" height="6" rx="1.5" /><path d="M11 5.5h3.5V9M9 14.5H5.5V11" />',13)}<span>Ungroup</span></button>`:"")+`<button type="button" role="menuitem" data-do="delete" class="is-danger">${ts}<span>Delete folder</span></button>`,St.append(ee);let W=y.getBoundingClientRect(),ot=St.getBoundingClientRect();ee.style.left=`${W.right-ot.left+6}px`,ee.style.top=`${W.top-ot.top-4}px`,ee.addEventListener("click",Mt=>{let dt=Mt.target.closest("[data-do]")?.dataset.do;if(!dt)return;if(mn(),dt==="rename")return Xn(q,!1);if(dt==="add")return Lo(q,y);if(dt==="sub"){let Be=Math.random().toString(36).slice(2,10);return S=[{id:Be,name:"Untitled folder",pages:[],parent:q},...S],nt.add(q),nt.add(Be),G.delete(q),Rn(),Ht(),Xn(Be,!0)}let ut=S;Ae(vs(S,new Set([q]))),Oe(dt==="delete"?`Deleted \u201C${K.name}\u201D`:`Ungrouped \u201C${K.name}\u201D`,()=>Ae(ut))})}function Lo(y,q){mn();let K=S.find(dt=>dt.id===y),W=n.pages.filter(dt=>!K.pages.includes(dt.route));ee=document.createElement("div"),ee.className="dt-folder-menu dt-folder-add",ee.setAttribute("role","menu"),ee.innerHTML=`<p class="dt-pages-group">Add to ${f(K.name)}</p>`+(W.length?W.map(dt=>`<button type="button" role="menuitem" data-route="${f(dt.route)}"><span>${f(dt.label)}</span><em class="dt-pages-route">${f(dt.route)}</em></button>`).join(""):'<p class="dt-pages-none">Every page is in it</p>'),St.append(ee);let ot=q.getBoundingClientRect(),Mt=St.getBoundingClientRect();ee.style.left=`${ot.right-Mt.left+6}px`,ee.style.top=`${ot.top-Mt.top-4}px`,ee.addEventListener("click",dt=>{let ut=dt.target.closest("[data-route]");if(!ut)return;let Be=ut.dataset.route;ut.remove(),nt.add(y),G.delete(y),Rn(),Ae(S.map(kn=>({...kn,pages:kn.id===y?[...kn.pages.filter(vr=>vr!==Be),Be]:kn.pages.filter(vr=>vr!==Be)})))})}let Jn="";vt.addEventListener("dragstart",y=>{let q=y.target.closest("li[data-route], li.dt-folder");q&&(y.stopPropagation(),Jn=q.dataset.route??`f:${q.dataset.folder}`,q.classList.add("is-dragging"),y.dataTransfer?.setData("text/plain",Jn),y.dataTransfer&&(y.dataTransfer.effectAllowed="move"))});let zs=y=>y?.closest?.(".dt-folder:not(.dt-folder--site)")??null;vt.addEventListener("dragover",y=>{if(!Jn)return;y.preventDefault();let q=zs(y.target);for(let K of vt.querySelectorAll(".is-drop"))K!==q&&K.classList.remove("is-drop");q?.classList.add("is-drop"),vt.classList.toggle("is-drop-out",!q)}),vt.addEventListener("dragend",()=>{Jn="",vt.classList.remove("is-drop-out");for(let y of vt.querySelectorAll(".is-drop, .is-dragging"))y.classList.remove("is-drop","is-dragging")});let So=y=>requestAnimationFrame(()=>{let q=vt.querySelector(y);q&&(Io(q,"glow"),q.scrollIntoView({block:"nearest",behavior:ns()?"smooth":"auto"}))});vt.addEventListener("drop",y=>{y.preventDefault();let q=Jn,K=zs(y.target)?.dataset.folder;if(!q)return;if(q.startsWith("f:")){let Mt=q.slice(2);if(K===Mt||K&&pn(K,Mt))return;let dt=S.map(ut=>ut.id===Mt?{...ut,parent:K??null}:ut).map(({parent:ut,...Be})=>ut?{...Be,parent:ut}:Be);K&&(nt.add(K),G.delete(K),Rn()),JSON.stringify(dt)!==JSON.stringify(S)&&(Ae(dt),So(`[data-folder="${CSS.escape(Mt)}"] > .dt-folder-row`));return}let W=S.map(Mt=>({...Mt,pages:Mt.pages.filter(dt=>dt!==q)})),ot=K?W.find(Mt=>Mt.id===K):null;ot&&(ot.pages.push(q),nt.add(ot.id),Rn()),JSON.stringify(W)!==JSON.stringify(S)&&(Ae(W),So(`li[data-route="${CSS.escape(q)}"] > a`))})}un.querySelector("summary").addEventListener("click",()=>pr(!1));let Un=we.querySelector(".dt-vision"),qs=Un.querySelector(".dt-vision-sheet"),Eo=[{id:"",name:"Normal",hint:"",css:"none"},{id:"grey",name:"Greyscale",hint:"only light and dark",css:"grayscale(1)"},{id:"low",name:"Low vision",hint:"slightly blurred",css:"blur(2.5px)"},{id:"deut",name:"Deuteranopia",hint:"red\u2013green, most common",css:"url(#dt-deut)",m:"0.367322 0.860646 -0.227968 0 0 0.280085 0.672501 0.047413 0 0 -0.011820 0.042940 0.968881 0 0 0 0 0 1 0"},{id:"prot",name:"Protanopia",hint:"red\u2013green",css:"url(#dt-prot)",m:"0.152286 1.052583 -0.204868 0 0 0.114503 0.786281 0.099216 0 0 -0.003882 -0.048116 1.051998 0 0 0 0 0 1 0"},{id:"trit",name:"Tritanopia",hint:"blue\u2013yellow",css:"url(#dt-trit)",m:"1.255528 -0.076749 -0.178779 0 0 -0.078411 0.930809 0.147602 0 0 0.004733 0.691367 0.303900 0 0 0 0 0 1 0"}];document.body.insertAdjacentHTML("beforeend",`<svg class="dt-vision-defs" width="0" height="0" aria-hidden="true">${Eo.filter(t=>t.m).map(t=>`<filter id="dt-${t.id}" color-interpolation-filters="linearRGB"><feColorMatrix type="matrix" values="${t.m}"/></filter>`).join("")}</svg>`);let Zd=document.createElement("style");document.head.append(Zd);let Ds=document.createElement("div");Ds.className="dt-seeing",Ds.hidden=!0,we.append(Ds);let Fs="",Ca=t=>{Fs=t;let e=Eo.find(s=>s.id===t)??Eo[0];Zd.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",Un.toggleAttribute("data-on",!!t),Ds.hidden=!t,Ds.innerHTML=t?`${xt('<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.5" />',13)}<span>Seeing as ${e.name}</span><kbd>Esc</kbd><button type="button" aria-label="See the page as it is">${xt('<path d="M5 5l10 10M15 5 5 15" />',12)}</button>`:""};Ds.addEventListener("click",t=>{t.target.closest("button")&&Ca("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!Fs||t.defaultPrevented||mc(t.target)||(Ca(""),t.preventDefault())});let Na=null,fr=0,br=0,Qd=()=>{let t=Math.round((Date.now()-fr)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},tc=t=>{if(t==="none"){qs.className="dt-sheet dt-vision-sheet dt-vision-list",qs.innerHTML='<p class="dt-vision-title">See the page as</p>'+Eo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Fs}"><span>${s.name}</span>${s.id===Fs?xt('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${s.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;qs.className="dt-sheet dt-vision-sheet",qs.innerHTML=`<div class="dt-vision-head"><b>This view, six ways</b><span class="dt-vision-ago">${t==="taking"?"taking a snapshot\u2026":`snapshot \xB7 ${Qd()}`}</span><span class="dt-vision-grow"></span><span>Click one to see the page that way</span><button type="button" class="dt-icon dt-vision-again" data-tip="Take a new snapshot" aria-label="Take a new snapshot">${xt('<path d="M3.5 10a6.5 6.5 0 1 0 2-4.7M3.5 3.5v3.6h3.6" />')}</button></div><div class="dt-vision-grid">${Eo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Fs}"><span class="dt-vision-thumb">${Na&&t==="ready"?`<img src="${Na}" alt="" style="filter:${s.id==="low"?`blur(${(2.5*e*2).toFixed(2)}px)`:s.css}">`:""}</span><span>${s.name}</span></button>`).join("")}</div>`},yr=async()=>{let t=++br;tc("taking");let e=[document.body,document.documentElement].map(o=>getComputedStyle(o).backgroundColor).find(o=>o&&o!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(o))??"#fff",s=null;try{let{domToWebp:o}=await import("modern-screenshot");s=await Promise.race([o(document.body,{width:innerWidth,height:innerHeight,scale:460/innerWidth,quality:.75,timeout:4e3,backgroundColor:e,style:{transform:`translate(${-scrollX}px, ${-scrollY}px)`},filter:a=>!(a instanceof Element&&a.closest(`${Xs}, .dt-pad-overlay, .dt-grid-overlay, .dt-vision-defs, .dt-toast`))}),new Promise(a=>setTimeout(()=>a(null),4e3))])}catch{s=null}t!==br||!Un.open||(Na=s,fr=Date.now(),tc(s?"ready":"none"))},ec=0,nc=0,sc=()=>{clearTimeout(nc),nc=window.setTimeout(yr,400)};Un.addEventListener("toggle",()=>{if(clearInterval(ec),removeEventListener("scroll",sc,!0),!Un.open){br++;return}yr(),addEventListener("scroll",sc,!0),ec=window.setInterval(()=>{let t=qs.querySelector(".dt-vision-ago");t&&Na&&fr&&(t.textContent=`snapshot \xB7 ${Qd()}`)},1e3)}),qs.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void yr();let s=e.closest("[data-vision]");s&&(Ca(s.dataset.vision??""),Un.open=!1)});let Mo=we.querySelector(".dt-custom"),Ba=Mo.querySelector(".dt-custom-sheet"),oc="dt-hidden-tools",ac="dt-new-seen",ic=["contrast","vision"],rc=()=>{let t=(o,a,r)=>{let l=we.querySelector(a);return l?{id:o,el:l,name:r}:null},e=[t("grid",".dt-grid-btn","Grid"),t("pads",".dt-pad-btn","Spacing"),t("sizes",".dt-size-btn","Size"),t("type",".dt-type-btn","Typography"),t("color",".dt-color-btn","Color"),t("border",".dt-border-btn","Border"),t("contrast",".dt-contrast-btn","Contrast"),t("vision",".dt-vision","Vision")],s=[...Ut.map(o=>({id:`bp:${o.dataset.bp}`,el:o,name:(o.getAttribute("aria-label")??o.dataset.bp??"").replace(/^mobile\s+(\w)/i,(a,r)=>r.toUpperCase())})),{id:"devices",el:as,name:"Device menu"}];return[...n.client?[]:[{group:"Inspect",tools:e.filter(o=>!!o)}],{group:"Devices",tools:s}]},lc=t=>(ct.getItem(t)??"").split(",").filter(Boolean),Yn=new Set(lc(oc)),dc=()=>{for(let{tools:e}of rc())for(let s of e)s.el.toggleAttribute("data-off",Yn.has(s.id));Object.entries(lt).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&U("")},jm=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",cc=()=>{let t=lc(ac);Ba.innerHTML=rc().map(({group:e,tools:s})=>{let o=s.filter(a=>!Yn.has(a.id)).length;return`<p class="dt-custom-label"><b>${e}</b><span>${o} of ${s.length}</span></p><div class="dt-custom-well">${s.map(a=>`<button type="button" class="dt-custom-tile" data-tool="${f(a.id)}" aria-pressed="${!Yn.has(a.id)}">${jm(a.el)}<span>${f(a.name)}</span>${ic.includes(a.id)&&!t.includes(a.id)?'<i class="dt-custom-new">New</i>':""}</button>`).join("")}</div>`}).join("")+`<div class="dt-custom-foot"><button type="button" class="dt-custom-all"${Yn.size?"":" disabled"}>Show all</button><span></span><button type="button" class="dt-custom-done">Done</button></div>`};Ba.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){Mo.open=!1;return}e.closest(".dt-custom-all")&&Yn.clear();let s=e.closest("[data-tool]");if(s){let o=s.dataset.tool;Yn.delete(o)||Yn.add(o)}!s&&!e.closest(".dt-custom-all")||(z(oc,[...Yn].join(",")),dc(),cc(),Ba.querySelector(s?`[data-tool="${s.dataset.tool}"]`:".dt-custom-done")?.focus())}),Mo.addEventListener("toggle",()=>{Mo.open?(cc(),Ba.querySelector(".dt-custom-tile")?.focus()):z(ac,ic.join(","))}),dc(),un.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return pr(s==="keys");if(s==="grid")return $o("grid");un.open=!1,s==="custom"&&(Mo.open=!0),s==="hide"&&Os.click()});let on=t=>()=>we.querySelector(t)?.click(),uc=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},Ra=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:on(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:on(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:on(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>_i(!yn)},{group:"Threads",code:"Slash",hint:"/",label:"Search pages",run:()=>{let t=document.querySelector(".dt-strip"),e=t?.querySelector(".dt-pages");if(t&&!t.hidden&&e){O(),gr(!0),e.open=!0;return}document.querySelector(".dt-history")?.hasAttribute("hidden")&&on(".dt-history-btn")(),rt.hasAttribute("data-collapsed")&&wa(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Team / client",run:()=>Pe?void Rd():Ns(Ve==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Bs.hidden||uo(cn.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:on(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:on(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:on(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:on(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:on(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:on(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{Un.open=!Un.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:on(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:on(".dt-studio-btn")}]:[],...Ut.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:()=>{as.open=!as.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:uc(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:uc(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>Os.click()},{group:"View",code:"Backslash",shift:!0,hint:"\u21E7\\",label:"Top strip",run:()=>gr(!Jd())},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=un.open&&!Kd.hidden;un.open=!t,pr(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),pc=(t,e)=>Ra.find(s=>s.code===t&&!s.shift==!e&&!(s.el&&we.querySelector(s.el)?.closest("[data-off]"))&&!(s.code==="KeyD"&&as.hasAttribute("data-off"))),mc=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(n.shortcuts){for(let o of Ra){let a=o.el&&we.querySelector(o.el);a&&(a.dataset.tip=`${a.dataset.tip??o.label} \xB7 ${o.hint}`,a.setAttribute("aria-keyshortcuts",o.hint.startsWith("\u21E7")?`Shift+${o.hint.slice(1)}`:o.hint))}let t=(o,a)=>`<div class="dt-key-row"><span>${f(o)}</span><kbd>${f(a)}</kbd></div>`,e=(o,a)=>`<div class="dt-keys-col"><p class="dt-keys-group">${o}</p>${a}</div>`,s=[...new Set(Ra.map(o=>o.group))].map(o=>e(o,Ra.filter(a=>a.group===o).map(a=>t(a.label,a.hint)).join("")));if(s.push(e("In a comment",t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"))),un.querySelector(".dt-keys-list").innerHTML=`<div class="dt-keys-half">${s.slice(0,2).join("")}</div><div class="dt-keys-half">${s.slice(2).join("")}</div>`,document.addEventListener("keydown",o=>{if(o.repeat||o.isComposing||o.metaKey||o.ctrlKey||o.altKey||o.defaultPrevented||mc(o.composedPath()[0]??o.target))return;let a=pc(o.code,o.shiftKey);a&&setTimeout(()=>{o.defaultPrevented||(M?parent.postMessage({dt:!0,key:[o.code,o.shiftKey]},location.origin):a.run())})}),M){let o=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",o,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&o()})}}if(!M){Gd(ct.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>we.setAttribute("data-ready",""))),Fd.restore(),yt(ct.getItem(Dt)==="1");let t=ct.getItem(Et);t&&t in lt&&U(t),sn(ct.getItem(Vr)==="1"&&Tt!=="/connect")}let hc=()=>{try{let t=JSON.parse(ct.getItem(Tn)||"null");ze=(t?.parked??[]).filter(s=>Js(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};if(t?.draft&&e(t.draft.selector)?(R=t.draft,!Yt&&!M&&sn(!0)):Js(t?.draft)&&ze.push(t.draft),t?.reply?.text&&(Re=t.reply.text,bn=Y=t.reply.for??null),Y==null)try{Y=Number(sessionStorage.getItem(`nm-open:${Tn}`))||null,sessionStorage.removeItem(`nm-open:${Tn}`)}catch{}(R||ze.length||Re)&&J()}catch{ct.removeItem(Tn)}};hc();let gc=()=>setTimeout(()=>{let t=I(location.pathname);t!==Tt&&(clearTimeout(Vo),Qs(),Tt=t,M&&parent.postMessage({dt:!0,route:t},location.origin),Tn=Ur(),R=null,ze=[],Re="",bn=null,Y=null,te=null,j=[],Yt&&!M&&sn(!1),E(),hc(),Zi(),gs())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),gc()}}addEventListener("popstate",gc);try{let t=JSON.parse(ct.getItem(Ps)||"null");t?.project===bd&&t.body?(Xi=t.body.version??"",Ji(t.body),ho=""):t&&ct.removeItem(Ps)}catch{ct.removeItem(Ps)}i.then(async t=>{t.status===200&&Ji(await t.json(),!c)},()=>{}).then(()=>!c&&(Ze||yn)?gs(!0):void 0).then($a.resume),document.addEventListener("visibilitychange",()=>{document.hidden||fs()}),addEventListener("focus",fs),addEventListener("notemend:changed",()=>{M||fs()});let Pa=!1,ys=null,fc=()=>{if(!(M||ce.via||!("EventSource"in window))){if(document.hidden){ys?.close(),ys=null,Pa=!1;return}ys||(ys=new EventSource("/__devbar/events"),ys.onopen=()=>{Pa=!0},ys.onerror=()=>{Pa=!1},ys.onmessage=t=>{t.data!==ho&&fs()})}};fc(),document.addEventListener("visibilitychange",fc);let _m=0;M||setInterval(()=>{(!(ce.live||Pa)||++_m%6===0)&&fs()},2e4),setInterval(()=>{!document.hidden&&j.some(t=>hn(t))&&J()},3e4),M&&parent.postMessage({dt:!0,hello:!0},location.origin)}function ku(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,c=i.showModal,m=null,g=null,b=()=>{if(m){g?.disconnect(),g=null;for(let v of n)document.body.append(v);try{m.hidePopover()}catch{}m.remove(),m=null}},L=()=>{b();let v=document.querySelector("dialog:modal");v&&A(v)},A=v=>{b(),m=document.createElement("div"),m.className="dt-host",m.setAttribute("popover","manual"),m.append(...n),v.append(m);try{m.showPopover()}catch{}v.addEventListener("close",L,{once:!0}),g=new MutationObserver(()=>{v.isConnected||L()}),g.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){c.call(this),this.isConnected&&A(this)}}function jr(n,i,c,m=""){let g=document.createElement("div");g.className="nm-ask",g.setAttribute("style",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px","padding:6px 6px 6px 12px","background:#0e0d0c","color:#f2efec","border:1px solid rgba(255,255,255,.09)","border-radius:999px","box-shadow:0 10px 34px rgba(0,0,0,.5)","font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif"].join(";"));let b=document.createElement(n?"a":"span");b instanceof HTMLAnchorElement&&n&&(b.href=n,b.target=c,m&&(b.rel=m)),b.className="nm-ask-go",b.textContent=i;let L=document.createElement("style");return L.textContent=`.nm-ask{transition:border-color 120ms cubic-bezier(.22,1,.36,1)}
332
+ <div class="dt-note-meta dt-note-type">${fi(Ks(B.category).id,void 0,!1)}</div>
333
+ ${Al("dt-note-input",B.suggest?"Why (optional)":"Comment",B.text??"",'data-act="save"',Ml(B.images))}
334
+ ${B.carried&&B.assignee?`<p class="dt-carried">${Yu}<span>For ${f(ln(B.assignee)?.name||B.assignee.split("@")[0])} \xB7 from your last comment</span><button type="button" data-act="uncarry" aria-label="Don\u2019t carry it over" data-tip="Back to Anyone \u2014 and the next ones too">${Pn}</button></p>`:""}
335
+ ${fl(B.priority,B.category,void 0,B.assignee??"",!1,!!B.shared,!0)}
336
+ </div>`}let d=new Map([...nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(m=>[m.closest(".dt-note").dataset.id,{top:m.scrollTop,end:m.scrollTop+m.clientHeight>=m.scrollHeight-4}])),p=new Set([...nt.querySelectorAll("[data-msg]")].map(m=>m.dataset.msg)),u=nt.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Xp(e,Sn.hidden?o.some(m=>!!a.get(m.id)):o.length>0),Fr(nt,s),u&&!nt.contains(document.activeElement)&&yo(".dt-note-reply-input");let b=[],T=[];for(let m of nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let _=m.closest(".dt-note").dataset.id,Q=d.get(_);if(!Q){b.push(m),delete We[_],m.parentElement.querySelector(".dt-new-below")?.remove();continue}let Ot=[...m.querySelectorAll("[data-msg]")].filter(mt=>!p.has(mt.dataset.msg));for(let mt of Ot)mt.classList.add("dt-msg--new");let Pt=Q.end||String(Wo)===_;Pt&&T.push(m),m.scrollTop=Pt?m.scrollHeight:Q.top;let le=Ot.filter(mt=>!mt.classList.contains("dt-msg--mine")).length;if(le&&!Q.end&&String(Wo)!==_){We[_]=(We[_]??0)+le;let mt=We[_],Tt=m.parentElement.querySelector(".dt-new-below")??m.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Tt.dataset,{act:"newbelow",id:_}),Tt.textContent=`${mt} new ${mt===1?"reply":"replies"} \u2193`}}for(let m of nt.querySelectorAll(".dt-new-below")){let _=m.closest(".dt-note")?.querySelector(".dt-note-thread");(!_||_.scrollTop+_.clientHeight>=_.scrollHeight-4)&&(delete We[m.dataset.id],m.remove())}Wo=null,Ii([...b,...T]),requestAnimationFrame(()=>nt.querySelectorAll(".dt-note-thread").forEach(Vo)),X==null?_o=null:X!==_o&&nt.querySelector(`.dt-note[data-id="${X}"]`)&&(_o=X,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&yo(`.dt-note[data-id="${X}"] .dt-note-reply-input`)),ge(e),li(di()),en();for(let m of nt.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))or(m);let P=nt.querySelector(".dt-note-input");P&&document.activeElement!==P&&(P.focus(),P.setSelectionRange(P.value.length,P.value.length))},Oi=0,Qp=()=>{Wi&&Ut&&!k&&sd();let t=!1,e=document.getAnimations().some(u=>u.playState==="running"),s=[],o=!1,a=new Map(j.map(u=>[u.id,u])),r=400,l=(u,b)=>b>-r&&b<innerHeight+r&&u>-r&&u<innerWidth+r;for(let u of nt.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(u.classList.contains("dt-note--orphan")||u.classList.contains("is-dragging"))continue;if(u.classList.contains("dt-pin--ghost")){let P=a.get(Number(u.dataset.id))?.spot;s.push([u,P?{x:P.x-scrollX,y:P.y-scrollY,el:document.body}:null]);continue}let b=a.get(Number(u.dataset.id)),T=b&&Ce(b);s.push([u,T&&u.matches(".dt-pin")&&l(T.x,T.y)&&Ru(T.el,T.x,T.y)?null:T]),T&&e&&el(T.el)&&(t=!0)}for(let u of nt.querySelectorAll("[data-draft], [data-parked]")){if(u.classList.contains("dt-note--orphan"))continue;let b=u.dataset.parked?ze[Number(u.dataset.parked)]:B;s.push([u,b?Ce(b):null])}let d=(u,b,T)=>{Math.abs(parseFloat(u.style.left)-b)<.05||(u.style.left=`${b}px`,o=!0),Math.abs(parseFloat(u.style.top)-T)<.05||(u.style.top=`${T}px`,o=!0)};for(let[u,b]of s){if(b&&u.style.left&&!l(b.x,b.y)&&!l(parseFloat(u.style.left),parseFloat(u.style.top))&&u.matches(".dt-pin"))continue;let T=u.nextElementSibling;if(!b){u.style.visibility!=="hidden"&&(u.style.visibility="hidden"),T?.matches(".dt-pin-eye")&&!T.hidden&&(T.hidden=!0);continue}if(u.style.visibility&&(u.style.visibility=""),d(u,b.x,b.y),u.matches(".dt-pin[data-id]")){let P=!!(b.hidden||b.opener);if(u.classList.contains("dt-pin--hidden")!==P){u.classList.toggle("dt-pin--hidden",P);for(let m of["title","aria-label"]){let _=(u.getAttribute(m)??"").replace(zo,"");u.setAttribute(m,P?_.replace(/( \u2014 drag to move)?$/,`${zo}$1`):_)}}T?.matches(".dt-pin-eye")&&(T.hidden===P&&(T.hidden=!P),P&&d(T,b.x,b.y))}u.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!b.hidden)}if(!sa.length&&(B||X!=null)){let u=di();u&&e&&el(u)&&li(u)}let p=nt.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(p.length){let u=va();for(let b of p)b.style.visibility!=="hidden"&&Wl(b,u)}Bu(B||X!=null?di():null),Oi=o?0:Oi+1,t&&en(),clearTimeout(Vl),Vl=window.setTimeout(tm,150)},qi=new Map,Vl=0,tm=()=>{let t=new Map,e=o=>{let a=[],r="";for(let l=o;l;l=l.parentElement){let d=t.get(l);if(d!==void 0){r=d;break}if(a.push(l),/^(IMG|VIDEO|CANVAS|PICTURE|IFRAME)$/.test(l.tagName)){r="var(--dt-bg)";break}let p=getComputedStyle(l);if(p.backgroundImage!=="none"){r="var(--dt-bg)";break}let u=p.backgroundColor.match(/[\d.]+/g);if(u&&(u[3]===void 0?1:+u[3])>=.9){r=p.backgroundColor;break}}r||="#fff";for(let l of a)t.set(l,r);return r},s=[];for(let o of nt.querySelectorAll(".dt-pin[data-id]")){if(o.style.visibility==="hidden"||o.classList.contains("is-dragging"))continue;let a=o.getBoundingClientRect(),r=document.elementsFromPoint(a.x+a.width/2,a.y+a.height/2).find(l=>!In(l));r&&s.push([o,e(r)])}for(let[o,a]of s)qi.set(Number(o.dataset.id),a),o.style.setProperty("--dt-page",a)},Gl=t=>`dt-gfold:${n.project||location.host}:${t}`,ge=t=>{if(it.hidden){it.replaceChildren();return}if(it.toggleAttribute("data-picking",!!Ie),Fr(it,vu({bp:t,notes:j.filter(An),breakpoints:h,bandOfNote:w,orphan:e=>!Ce(e),statusTools:e=>Nl(e,!1),tick:ep,replied:np,rowMenu:sp,menuFor:Dn,showResolved:Ze,showArchived:bn,archived:Se,drafts:Sn.hidden?Hl():Ci,checks:k?0:xa.toCheck().length,clients:Je()&&Ve==="clients",marker:nm,assign:tp,mirror:e=>Je()?ti(e)?"here":Bt(e)&&Yo(e)?"there":"":"",picking:Ie,pickable:ks,mirrorAll:Jo()?j.filter(e=>An(e)&&w(e)===t&&ks(e)).map(e=>e.id):[],draftFace:n.me?`<span class="dt-hist-face" style="--hue:${Oe(n.me.email)}">${ui({by:n.me.email,byName:n.me.name})}</span>`:"",draftName:n.me?.name||"You",find:oe,forMe:em,forAgent:e=>!!Ee(e)&&Ct(e)!=="done",unread:rl,archives:!n.client,deletable:e=>!As(e),folded:it.hasAttribute("data-collapsed"),shut:e=>ct.getItem(Gl(e))==="1",cap:Kl,keep:X})),Cs){let e=it.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Cs.at,Cs.at),Cs=null}},Cs=null,Kl=150,em=t=>{if(Ct(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||Ct(t)==="claude"||De(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return an(t).some(s=>s.text.toLowerCase().includes("@"+e))},nm=t=>{let e=Ee(t),s=ia[e??""],o=Ct(t)==="done"?Se(t)?`<i class="dt-hist-badge is-archived">${kn}</i>`:`<i class="dt-hist-badge is-done">${Me}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${Fe(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${_n.find(r=>r[0]===ds(t))[2]}"></i>`,a=ui(t)||Fn(void 0,t.byName||(t.by==="you"||!t.by?"You":t.by)).replace(/>([^<])[^<]*<\/b>$/,">$1</b>");return`<span class="dt-hist-face" style="--hue:${Oe(t.by||t.byName||"you")}">${a}</span>`},$a=t=>{Pi=!1;let e=it.hasAttribute("data-collapsed");if(t===e||it.hidden){it.toggleAttribute("data-collapsed",t),Z();return}let s=it.querySelector(".dt-hist-head")?.offsetHeight??44;if(t){it.setAttribute("data-folding",""),Or(it,it.offsetHeight,s,!1,()=>{it.removeAttribute("data-folding"),it.setAttribute("data-collapsed",""),Z()});return}it.removeAttribute("data-folding"),it.removeAttribute("data-collapsed"),Z(),Or(it,s,it.offsetHeight,!0,()=>{})},Ul=t=>{let e=[];for(let s=t.nextElementSibling;s&&s.classList.contains("dt-hist-row");s=s.nextElementSibling)e.push(s);return e},Yl=t=>{let e=document.createElement("div");return e.className="dt-hist-rows",t[0].before(e),e.append(...t),e},sm=t=>{let e=Gl(t),s=ct.getItem(e)==="1",o=it.querySelector(".dt-hist-list"),a=o?.clientHeight??600,r=()=>it.querySelector(`[data-gfold="${CSS.escape(t)}"]`)?.closest(".dt-hist-group");if(!s){let u=r(),b=u?Ul(u):[],T=()=>{z(e,"1"),ge(Yt())};if(!b.length||!ns())return T();let P=Yl(b);Ga(P,!1,a),On(P).then(T);return}z(e,""),ge(Yt());let l=r(),d=l?Ul(l):[];if(!d.length||!ns())return;let p=Yl(d);p.hidden=!0,Ga(p,!0,a),On(p).then(()=>{p.isConnected&&(p.before(...p.children),p.remove())})};it.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(oe.q=e.value,Cs={at:e.selectionStart??e.value.length},ge(Yt()))}),it.addEventListener("click",async t=>{let e=t.target;if(e.closest("[data-hist-more]")){oe.more=!oe.more,Dn=null,oe.menu=!1,ge(Yt());return}let s=e.closest("[data-row-more]");if(s){let kt=Number(s.dataset.rowMore);Dn=Dn===kt?null:kt,oe.more=!1,ge(Yt());return}if((oe.more||Dn!=null)&&!e.closest(".dt-hist-menu")&&(oe.more=!1,Dn=null,ge(Yt()),!e.closest("[data-go]"))||e.closest(".dt-hist-assign"))return;let o=()=>{oe.more=!1,Dn=null};if(e.closest("[data-hist-rows]")){Kl+=300,ge(Yt());return}if(e.closest("[data-read-all]")){for(let kt of j)ll(kt);o(),ge(Yt());return}let a=e.closest("[data-resolve-all]");if(a){let kt=a.dataset.resolveAll.split(",").map(Number);o(),await Rl(kt,Ht=>tn(Ht,!0)),qe(`Resolved ${kt.length}`,()=>Rl(kt,Ht=>tn(Ht,!1)));return}let r=e.closest("[data-row-unread]");if(r){let kt=Number(r.dataset.rowUnread);jn[kt]=Math.max(0,an(j.find(Ht=>Ht.id===kt)).length-1),hi(),o(),ge(Yt());return}let l=e.closest("[data-row-link]");if(l){o(),ge(Yt()),await navigator.clipboard?.writeText(`${location.origin}${location.pathname}#thread-${l.dataset.rowLink}`).catch(()=>null),Gt("Link copied");return}let d=e.closest("[data-row-select]");if(d){o();let kt=Number(d.dataset.rowSelect),Ht=j.find(Te=>Te.id===kt);Ie=new Set(Ht&&ks(Ht)?[kt]:[]),Xo=kt,ge(Yt());return}let p=e.closest("[data-row-mirror]");if(p){o(),ge(Yt()),await Aa([Number(p.dataset.rowMirror)]);return}let u=e.closest("[data-mirror-all]");if(u){o(),ge(Yt()),await Aa(u.dataset.mirrorAll.split(",").map(Number));return}if(e.closest("[data-pick-mirror]")){await Rd();return}if(e.closest("[data-pick-cancel]")){ir();return}let b=e.closest(".dt-hist-go[data-go]");if(b&&Jo()&&(Ie||t.metaKey||t.ctrlKey||t.shiftKey)){t.preventDefault(),Lm(Number(b.dataset.go),t.shiftKey);return}let T=e.closest("[data-row-move]");if(T){o(),await ar(Number(T.dataset.rowMove));return}if(e.closest(".dt-hist-menu.is-row [data-act], .dt-hist-menu.is-row [data-rm]")&&o(),it.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){$a(!1);return}if(t.target.closest("[data-fold]")){$a(!it.hasAttribute("data-collapsed"));return}let P=t.target.closest("[data-gfold]");if(P){sm(P.dataset.gfold);return}let m=t.target.closest(".dt-hist-bands [data-bp]");if(m){cr(m.dataset.bp);return}let _=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(_){_.dataset.histView?(oe.view=_.dataset.histView,z("dt-view",oe.view),oe.menu=!1):_.dataset.histSort?(oe.sort=_.dataset.histSort,z("dt-sort",oe.sort),oe.menu=!1,oe.more=!1):_.hasAttribute("data-hist-clear")?(oe.q="",Cs={at:0}):oe.menu=!oe.menu,ge(Yt());return}oe.menu&&!t.target.closest(".dt-hist-menu")&&(oe.menu=!1,ge(Yt()));let Q=t.target.closest("[data-draft-go], [data-draft-rm]");if(Q){let kt=Q.dataset.draftRm!==void 0,Ht=Number(kt?Q.dataset.draftRm:Q.dataset.draftGo);Sn.hidden?kt?Xl(Ht):Di(Ht):Ue(kt?{dropDraft:Ht}:{openDraft:Ht});return}let Ot=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(e.closest(".dt-hist-menu.is-panel [data-resolved], .dt-hist-menu.is-panel [data-archived], .dt-hist-menu.is-panel [data-archive-all]")&&(oe.more=!1),Ot){await tn(Number(Ot.dataset.id),Ot.dataset.act==="done");return}let Pt=t.target.closest("[data-rm]");if(Pt){X=null,Bi(Number(Pt.dataset.rm));return}if(t.target.closest("[data-review]")){xa.start();return}if(t.target.closest("[data-resolved]")){ji(!Ze);return}if(t.target.closest("[data-archived]")){_i(!bn);return}let le=t.target.closest("[data-archive-all]");if(le){let kt=le.dataset.archiveAll.split(",").map(Number);for(let Ht of kt)await us(Ht,!0,!0);qe(`Archived ${kt.length}`,()=>{for(let Ht of kt)us(Ht,!1,!0)});return}let mt=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(mt){await us(Number(mt.dataset.id),mt.dataset.act==="archive");return}let Tt=t.target.closest("[data-go]");if(!Tt)return;let bt=Number(Tt.dataset.go);if(!Sn.hidden){Ue({open:bt});return}ms(bt)});let ms=t=>{X=t,_o=null,rn(),ps=!0,Z();let e=j.find(a=>a.id===t),s=e&&Ce(e);if(s)scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"});else if(e){let a=Qe(e);a?a.scrollIntoView({block:"center",behavior:"smooth"}):tl(e)}let o=nt.querySelector(`.dt-pin[data-id="${t}"]`);o&&Oo(o,"land"),wa()},Di=t=>{let[e]=ze.splice(t,1);if(!e)return;rn(),B=e,X=null;let s=Ce(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),Z()},Xl=t=>{ze.splice(t,1),Z()},xa=wu({inFrame:k,everything:()=>yt,route:()=>xt,settle:tn,keepIn:Ya,toast:t=>Gt(t),waits:t=>Ct(t)==="claude"||Ct(t)==="open"&&ds(t)==="review",approve:t=>tn(t.id,!0),open:t=>{if(Ut||sn(!0),w(t)!==Yt()){cr(w(t));for(let e of[600,1500])setTimeout(()=>Ue({open:t.id}),e)}else ms(t.id)}}),Jl=t=>{if(it.hidden){t?.();return}ss(it,()=>{it.hidden=!0,t?.()})},Zl=()=>{Io(it),it.hidden=!1},om=t=>{t?Zl():Jl(),xe.setAttribute("aria-pressed",String(t)),z("dt-history",t?"1":"0"),Z()},Fi=document.querySelector(".dt-resolved-btn"),Vn=document.querySelector(".dt-space"),am=()=>{if(!Vn)return;Vn.hidden=!Je(),Vn.dataset.on=Ve;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Je()&&Ve==="clients"?(t.dataset.dtSpace="clients",e||(t.classList.add("dt-client-glow"),window.setTimeout(()=>t.classList.remove("dt-client-glow"),1700))):delete t.dataset.dtSpace;let s=document.querySelector(".dt-client-tab");s&&(s.inert=t.dataset.dtSpace!=="clients",s.ariaHidden=s.inert?"true":null);for(let o of Vn.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===Ve));let r=yt.filter(l=>!Se(l)&&Ct(l)!=="done"&&Bt(l)===(a==="clients")).length;o.querySelector(".dt-space-n").textContent=r?String(r):""}Vn.querySelector(".dt-space-name").textContent=Ve==="clients"?"Client":"Team",Vn.querySelector(".dt-space-ic").innerHTML=$t(Pr[Ve],14)},Ql=0,Ns=t=>{if(!Je()||t===Ve)return;let e=()=>{Ve=t,Ie=null,z("dt-space",t),X!=null&&!An(j.find(a=>a.id===X))&&(X=null),rn(),hs(yt),Z(),ge(Yt())},s=document.documentElement,o=++Ql;s.classList.add("dt-switching"),Promise.all([On(nt),On(it)]).then(()=>{o===Ql&&(e(),requestAnimationFrame(()=>s.classList.remove("dt-switching")))})};document.querySelector(".dt-client-x")?.addEventListener("click",()=>Ns("studio")),Vn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&(Vn.open=!1,Ns(e.dataset.space))});let Bs=document.querySelector(".dt-pinf"),Rs=Bs.querySelector(".dt-pinf-btn"),cn=Bs.querySelector(".dt-pinf-menu"),td={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My agent",wrote:"Written by me",check:"To check"},im=()=>j.filter(t=>w(t)===Yt()&&Uo(t)&&An(t)),uo=(t,e=!1)=>{cn.hidden=!t,Rs.setAttribute("aria-expanded",String(t)),t&&(Qa(),e&&cn.querySelector('[aria-checked="true"]')?.focus())};Qa=()=>{let t=im();if(Bs.hidden=!Je()||!t.length,Bs.hidden){cn.hidden=!0;return}let e=Object.fromEntries(Yr.map(u=>[u,t.filter(b=>gl(b,u)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",Oe(s)],["others","var(--dt-faint)"]];if(Rs.toggleAttribute("data-on",Hn!=="all"),Rs.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} anyone can take, ${e.mine} mine, ${e.others} everyone else's, ${e.resolved} resolved${Hn==="all"?"":`; showing ${td[Hn]}, ${e[Hn]}`}`),cn.hidden)return;let a=[...new Set(t.map(u=>Co(u,Ct(u))?.taker).filter(u=>!!u&&u!==s))].slice(0,2),r=u=>Fn(ln(u)?.avatar_url,ln(u)?.name||u,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${Oe(u)}" `),l={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:r(s),others:a.map(r).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">${Fe(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:Ye(_n[2][2],_n[2][3]),resolved:Ye(Wn[Wn.length-1][2],Wn[Wn.length-1][3])},d=(u,b)=>`<b class="dt-pinf-share"><i style="--c:${b};width:${Math.round(100*e[u]/e.all)}%"></i></b>`,p=(u,b="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${Hn===u}" data-pinf="${u}"><i class="dt-pinf-glyph">${l[u]}</i><span>${td[u]}</span>${b?d(u,b):""}<em>${e[u]}</em>${Me}</button>`;cn.innerHTML=`${p("all")}${o.map(([u,b])=>p(u,b)).join("")}${e.resolved||Hn==="resolved"?p("resolved"):""}<hr>${p("claude")}${p("wrote")}${p("check")}`},Rs.addEventListener("click",t=>uo(cn.hidden,t.detail===0)),cn.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(Hn=e.dataset.pinf,z("dt-pinf",Hn),uo(!1),Rs.focus(),Ut?Z():sn(!0))}),cn.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),uo(!1),Rs.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...cn.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!cn.hidden&&!Bs.contains(t.target)&&uo(!1)},!0);let ji=t=>{Ze=t,Fi.setAttribute("aria-pressed",String(t)),z("dt-resolved",t?"1":"0"),Ue({resolved:t}),Z(),gs(!0)},_i=t=>{bn=t,z("dt-archived",t?"1":"0"),Ue({archived:t}),Z(),gs(!0)};Fi.addEventListener("click",()=>ji(!Ze)),Fi.setAttribute("aria-pressed",String(Ze)),xe.addEventListener("click",()=>{let t=it.hidden||it.hasAttribute("data-leaving");t&&!Ut&&sn(!0),t&&$a(!1),om(t)});let en=()=>{Xa||!Ut||(Xa=requestAnimationFrame(()=>{Xa=0,Qp()}))},ed=`${Xs}, .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`,nd=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(ed))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(ed))},Wi=!1,sd=()=>{Wi=!1;let t=document.scrollingElement??document.documentElement,e=document.querySelector(".dt-room");if(t.scrollHeight-(e?.offsetHeight??0)<=t.clientHeight+1){e?.remove();return}let s=e??Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"});document.body.lastElementChild!==s&&document.body.append(s)},zi=0,Vi=!1,Gi=!1,od=0,rm=()=>{if(!Ut)return!1;let t=new Set([...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].map(s=>Number(s.dataset.id))),e=Yt();return j.some(s=>!t.has(s.id)&&w(s)===e&&Uo(s)&&An(s)&&!!Ce(s))},lm=()=>Ut&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=j.find(s=>s.id===Number(t.dataset.id));return!!e&&e.id!==X&&!Qe(e)}),ad=new MutationObserver(t=>{if(Ut&&!k&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),Wi=!0}t.every(nd)||((Oi<3||t.some(e=>e.type!=="attributes"))&&en(),t.some(e=>e.type!=="attributes")?Vi=!0:t.some(e=>e.attributeName==="class")&&(Gi=!0),zi||(zi=window.setTimeout(()=>{if(zi=0,Vi)ta();else if(Gi&&performance.now()-od>1e3){od=performance.now();for(let[s,o]of Ls)o.el||Ls.delete(s)}Vi=Gi=!1;let e=X!=null?j.find(s=>s.id===X):void 0;rm()||lm()||e&&ea&&Wu(e)!==ea?Z():en()},150)))}),id=new ResizeObserver(()=>en()),rd=()=>{nt.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&en()},yt=[],ld=()=>{},po=new Set,Ge={at:"",ids:[]},hs=t=>{yt=t,queueMicrotask(()=>ld());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={};for(let d of t){if(Se(d)||!An(d))continue;let p=Ct(d),u=Ee(d),b=p==="done"?"done":p==="claude"?"review":u&&la[u]||ds(d),T=s[d.route??""]??={...e(),bands:{}};T[b]++;let P=w(d);(T.bands[P]??=e())[b]++}am();let o=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},r=d=>o.map(p=>[p,p==="done"&&!Ze?0:d[p]]),l=d=>r(d).reduce((p,[,u])=>p+u,0);for(let d of document.querySelectorAll(".dt-pages a")){let p=d.querySelector(".dt-pages-n");if(!p)continue;let u=s[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let P of h){let m=u?.bands[P.id];for(let[_,Q]of r(m??e())){let Ot=p.querySelector(`[data-bp="${P.id}"][data-state="${_}"]`);Ot.hidden=!Q,Q&&(Ot.querySelector("i").textContent=String(Q),Ot.title=`${P.label}: ${Q} ${a[_]}`)}}let b=u?l(u):0;p.hidden=!b;let T=u?h.filter(P=>u.bands[P.id]&&l(u.bands[P.id])).map(P=>`${P.label} ${l(u.bands[P.id])}`).join(" \xB7 "):"";p.title=b?`${o.filter(P=>u[P]).map(P=>`${u[P]} ${a[P]}`).join(" \xB7 ")}
337
+ ${T}`:"",d.dataset.n=String(b)}for(let d of document.querySelectorAll(".dt-folder")){let p=d.querySelectorAll(":scope > ul li[data-route] > a").length,u=[...d.querySelectorAll("a[data-n]")].reduce((T,P)=>T+Number(P.dataset.n),0),b=d.querySelector(".dt-folder-n");b.textContent=p?String(p):"",b.title=`${p} ${p===1?"page":"pages"}${u?` \xB7 ${u} open ${u===1?"thread":"threads"}`:""}`}ne()},Gn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!ba.has(Number(e.id))).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(s=>typeof s?.text=="string").map(s=>ya.has(`${Number(e.id)}|${s.at}`)?{...s,text:"",deleted:!0}:s):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[],...Gs(e)&&typeof e.from.by=="string"?{by:e.from.by,byName:typeof e.from.byName=="string"?e.from.byName:void 0,mirroredBy:e.by,mirroredByName:e.byName}:{}})),dm=$u(k,t=>Gt(t,2800,document.querySelector(".dt-turbo")??void 0)),Ke=document.querySelector(".dt-push"),$n=Ke.querySelector(".dt-push-menu"),xn=new Set,mo=new Set([xt]),Ea=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",Ma=()=>n.client||k?[]:yt.filter(t=>t.status!=="done"&&Xt(t.assignee)&&!Bt(t)&&De(t)==="approved"&&!hn(t)&&!Se(t)&&!po.has(t.id)),ka=()=>Ma().filter(t=>!xn.has(t.id)),dd=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?Me:""}</i>`,cd=()=>{let t=Ma(),e=[...new Set(t.map(o=>o.route??"/"))],s=ka().length;$n.innerHTML=`<div class="dt-push-head">${Fe(14)}<b>Waiting for the agent</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=>!xn.has(l.id)).length;return`<button type="button" class="dt-push-page${mo.has(o)?" is-open":""}" data-push-route="${f(o)}"><span data-push-fold="${f(o)}">${ra}</span>${dd(r>0,r>0&&r<a.length)}<span class="dt-push-route">${f(o)}</span><em>${a.length}</em></button>`+(mo.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${dd(!xn.has(l.id))}<span><small>#${l.id}</small>${f(Jt(l.text,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>Send ${s} to the agent</button>`},ud=()=>["push","paused"].includes(Ea()),Ki=()=>Ge.ids.filter(t=>{let e=yt.find(s=>s.id===t);return!!e&&e.status!=="done"&&De(e)!=="review"&&(po.has(t)||!!hn(e)||De(e)==="approved")}),pd="",cm=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Bn=()=>{let t=Ea(),e=ka().length,s=Ki(),o=Ge.ids.length-s.length,a=s.length>0&&ud();if(s.length&&(pd=Ge.at),!s.length&&Ge.ids.length&&Ge.at&&pd===Ge.at&&!cm(Ge.at)){try{sessionStorage.setItem("nm-batch-done",Ge.at)}catch{}yt.length&&qe(`The agent finished ${Ge.ids.length} \u2014 check the fixes`,()=>xa.start(),"Check")}Ke.hidden=n.client||k||!e&&!Ke.matches(".is-sending, .is-sent");let r=Ke.querySelector(".dt-push-n");r.textContent=String(e),r.hidden=!e||Ke.classList.contains("is-sent"),Ke.querySelector(".dt-push-all").dataset.tip=a?`Push to the agent: it is on ${s.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 the agent: turbo is on \u2014 the agent takes each thread as it lands":t==="none"?`Push to the agent: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to the agent: ${e} ${e===1?"thread waits":"threads wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to the agent: nothing waits for the agent yet \u2014 mark threads for the agent, then send them here",(Ke.hidden||!Ma().length)&&($n.hidden=!0),$n.hidden||cd()},md=async t=>{if(!t.length&&ud()){Gt("Nothing waits for the agent \u2014 mark threads for the agent first");return}if(Ea()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Gt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(Ea()==="on"){Gt("Turbo is on \u2014 the agent takes each thread as it lands");return}$n.hidden=!0;let e=t.map(o=>o.id);Ke.classList.add("is-sending");let s=await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(Ke.classList.remove("is-sending"),!s?.ok){Kn("Could not send them to the agent",s),Bn();return}for(let o of e)po.add(o);Ke.classList.add("is-sent"),setTimeout(()=>{Ke.classList.remove("is-sent"),Bn()},700),Ge={at:Ge.ids.some(o=>Ki().includes(o))?Ge.at:new Date().toISOString(),ids:[...new Set([...Ki(),...e])]},Bn(),qe(`${e.length} sent to the agent \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)po.delete(o);Bn()}),nn()},La=Ke.querySelector(".dt-push-all"),hd=0,Ui=!1,gd=()=>{$n.hidden=!1,cd()};La.addEventListener("click",()=>{if(Ui){Ui=!1;return}md(ka())}),La.addEventListener("contextmenu",t=>{t.preventDefault(),$n.hidden?gd():$n.hidden=!0}),La.addEventListener("pointerdown",t=>{t.button===0&&(hd=window.setTimeout(()=>{Ui=!0,gd()},500))});for(let t of["pointerup","pointerleave","pointercancel"])La.addEventListener(t,()=>clearTimeout(hd));$n.addEventListener("click",t=>{let e=t.target,s=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"){md(ka());return}if(r==="all")xn.clear();else if(s){let l=s.dataset.pushFold;mo.has(l)?mo.delete(l):mo.add(l)}else if(o){let l=Ma().filter(p=>(p.route??"/")===o.dataset.pushRoute),d=l.some(p=>!xn.has(p.id));for(let p of l)d?xn.add(p.id):xn.delete(p.id)}else if(a){let l=Number(a.dataset.pushId);xn.has(l)?xn.delete(l):xn.add(l)}Bn()}),document.addEventListener("pointerdown",t=>{!$n.hidden&&!Ke.contains(t.target)&&($n.hidden=!0)},!0),setInterval(Bn,3e4),ld=Bn;let fd=document.querySelector(".dt-turbo");fd&&new MutationObserver(Bn).observe(fd,{attributes:!0,attributeFilter:["data-state"]}),Bn();let ho="",Yi=!1,Ps="dt-threads",bd=String([ae.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Xi="",Sa=null,um=t=>{k||t.version&&t.version===Xi||(Sa||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=Sa;Sa=null,Xi=e.version??"";let s=JSON.stringify({project:bd,body:e});s.length<2e6?ct.setItem(Ps,s):ct.removeItem(Ps)},{timeout:3e3}),Sa=t)},Ji=(t,e=!1)=>{ho=t.version??"",dm(t);let s=t.turbo;po=new Set(s?.push?.ids??[]),Ge={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=Gn(t.comments);if(e&&(Ze||bn)){let r=new Set(o.map(l=>l.id));o=[...o,...yt.filter(l=>Ct(l)==="done"&&!r.has(l.id))]}um({...t,comments:o}),hs(o);let a=o.filter(r=>r.route===xt);if(!(Ko&&(j=a,yd()))){if(JSON.stringify(a)===JSON.stringify(j)){!it.hidden&&!k&&Z();return}j=a,Z(),Ue({reload:!0})}},gs=async(t=!1)=>{let e=[t||!ho?"":`since=${ho}`,Ze||bn?"":"open=1"].filter(Boolean).join("&");try{let s=await ie(`comments${e?`?${e}`:""}`);s.status===200&&Ji(await s.json())}catch{}},go=!1,fs=async()=>{if(!document.hidden){if(Yi||cs){go=!0;return}Yi=!0,await gs(),Yi=!1,go&&(go=!1,fs())}};Bl=()=>{go&&!cs&&(go=!1,fs())};let yd=()=>{let t=Ko&&j.find(e=>e.id===Ko);return t?(Ko=0,Je()&&!An(t)&&Ns(Bt(t)?"clients":"studio"),Ut||sn(!0),ms(t.id),!0):!1},Zi=()=>{j=yt.filter(t=>t.route===xt),yd()||Z()},Qi=0,tr=null,Ta=()=>{tr&&Ut&&er(tr)},er=t=>{tr=t,!Qi&&(Qi=requestAnimationFrame(()=>{Qi=0;let e=t.target;if(!Ut||e.closest(et)){is.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(is.hidden=!1,!s)return;let o=s.getBoundingClientRect();Nu.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,zr.textContent=s.tagName.toLowerCase()+([...s.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...s.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,zr.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-16)}px`}))},vd=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),te){te=null,Z();return}if(B){Zs()&&(rn(),Z());return}if(X!==null){X=null,Z();return}sn(!1)}},wd=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],fo=!1,bo=null,bs=document.createElement("div");bs.className="dt-repin-hint",bs.hidden=!0,bs.setAttribute("role","status"),bs.textContent="Click the new spot for this thread \xB7 Esc cancels",document.body.append(bs);let $d=()=>{bo=null,bs.hidden=!0,Zt.toggle("dt-repinning",!1)},xd=t=>{bo=t,X=null,bs.hidden=!1,Zt.toggle("dt-repinning",!0),Z()};document.addEventListener("keydown",t=>{t.key==="Escape"&&bo!=null&&(t.stopImmediatePropagation(),$d())},!0);let Ed=!1,Md=t=>{fo||(t.type==="pointerdown"&&(Ed=t.pointerType==="touch"),!t.target.closest?.(et)&&t.stopPropagation())},kd=t=>{let e=t.target;Ed&&(!e.closest?.(et)||e.closest?.(".dt-pin"))&&t.preventDefault()},Ld=t=>{!fo&&t.button===0&&t.target.closest?.(":disabled")&&nr(t)},nr=t=>{if(fo)return;let e=t.target;if(e.closest(et))return;if(t.preventDefault(),t.stopPropagation(),H){H=!1;return}if(!getSelection()?.isCollapsed)return;let s=t.detail===0&&!t.clientX&&!t.clientY,o=document.activeElement;nt.hidden=!0;let a=s?o&&o!==document.body&&!o.closest(et)?o:e:document.elementFromPoint(t.clientX,t.clientY);if(nt.hidden=!1,!a)return;if(bo!=null){let u=bo;$d();let b=a.getBoundingClientRect();Tm(u,a,s?b.left+b.width/2:t.clientX,s?b.top+b.height/2:t.clientY);return}if(!Zs())return;rn();let r=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(u=>!/^(astro|svelte|css)-/.test(u)).slice(0,2);B={selector:ni(a),tag:l,classes:d,nth:si({tag:l,classes:d}).indexOf(a),rx:r.width&&!s?(t.clientX-r.left)/r.width:.5,ry:r.height&&!s?(t.clientY-r.top)/r.height:.5,label:Jt(re(a.textContent||""),60),ctx:oi(a),fp:Qo(a),spot:{x:Math.round((s?r.left+r.width/2:t.clientX)+scrollX),y:Math.round((s?r.top+r.height/2:t.clientY)+scrollY)},opener:Vu(a),category:g[0].id,...Je()&&Ve==="clients"?{shared:!0}:{}};let p=n.client||B.shared?null:so();p&&(B.assignee=p,B.stage="new",B.carried=!0),X=null,is.hidden=!0,Z()},pm=2200,mm=900*1024,hm=8*1024*1024,gm=3*1024*1024,fm=50*1024*1024,Gt=(t,e=2800,s)=>{let o=document.createElement("div");o.className="dt-toast",o.textContent=t;for(let a of document.querySelectorAll(".dt-toast:not(.dt-toast--undo)"))ss(a,()=>a.remove());if(document.body.append(o),s){let a=s.getBoundingClientRect(),r=o.offsetWidth/2;o.style.left=`${Math.min(Math.max(a.left+a.width/2,r+8),innerWidth-r-8)}px`}return setTimeout(()=>ss(o,()=>o.remove()),e),o},Sd=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),r=pa.get(o);if(pa.delete(o),!r){Gt(`${a} was not sent \u2014 attach it again`);continue}let l=Gt(`Uploading ${a}\u2026`,12e4),d=await ie("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:r.name,size:r.size})}).then(T=>T.ok?T.json():null).catch(()=>null),p=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:r}).catch(()=>null),u=p?.ok&&await tt({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!u||!u.ok){Gt(p===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let b=Gn([await u.json().catch(()=>null)])[0];b&&(j=j.map(T=>T.id===b.id?b:T),Z()),Gt(`${a} sent`)}},Td=t=>{let e=t.filter(s=>s.startsWith(ua)).map(s=>s.split("\0"));return e.length&&Gt(e.length===1?`${e[0][1]} was not sent \u2014 ${e[0][2]}`:`${e.length} files were not sent: ${e.map(([,s,o])=>`${s} (${o})`).join(", ")}`,6e3),t.filter(s=>!s.startsWith(ua))},Kn=async(t,e)=>{if(!navigator.onLine){Gt(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let s="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{s=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{s=""}(s.length>160||s.startsWith("<"))&&(s="")}Gt(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},bm=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),ym=async t=>{let e=await createImageBitmap(t),s=Math.min(1,pm/Math.max(e.width,e.height));if(s===1&&t.size<=mm)return e.close(),bm(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*s),o.height=Math.round(e.height*s),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},sr=async(t,e)=>{let s=[],o=(a,r)=>s.push(`${ua}${a}\0${r}`);for(let a of t){let r,l=Lc(a.name)||Object.keys(Ao).find(d=>Ao[d]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,$r.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>fm){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>gm&&ae.via){let p=`${Date.now()}-${pa.size}`;pa.set(p,a),s.push(`${ki}${p}\0${a.name}\0${a.size}`);continue}let d=await new Promise((p,u)=>{let b=new FileReader;b.onload=()=>p(String(b.result).split(",")[1]),b.onerror=u,b.readAsDataURL(a)}).catch(()=>"");d?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${kc(a.name)||"file"};ext=${l};base64,${d}`):o(a.name,"Could not be read");continue}try{r=await ym(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>hm){o(a.name,"Too large even after shrinking");continue}s.push(r)}if(s.length){if(!Number(e?.dataset.id)){B&&((B.images??=[]).push(...s),Z());return}Le.push(...s),Z(),yo(".dt-note-reply-input")}},Ad=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);nt.addEventListener("paste",t=>{let e=Ad(t.clipboardData?.items);e.length&&(t.preventDefault(),sr(e,t.target.closest(".dt-note")))}),nt.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),nt.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),nt.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=Ad(t.dataTransfer?.items);s.length&&sr(s,e)});let yo=t=>{let e=nt.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},Hd=()=>{yo(".dt-note-edit-input"),nt.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},or=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=Hi-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},vm=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Cd=t=>{let s=t.closest(".dt-compose").querySelector(".dt-mentions");s?.remove();let o=vm(t);if(!o)return;let a=o[1].toLowerCase(),r=X!=null?j.find(u=>u.id===X):void 0,d=(n.client||B?.shared||r&&Bt(r)?n.team??[]:ca()).filter(u=>!Tr(u.email)).filter(u=>u.email!==n.me?.email&&[u.name,u.nickname,u.email].some(b=>b?.toLowerCase().startsWith(a))).slice(0,5);if(!d.length)return;t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(u=>`<button type="button" role="option" data-act="mention" data-handle="${f(Hc(u))}">${Fn(u.avatar_url,u.name||u.email)}<span class="dt-mention-who"><b>${f(u.name||u.email)}</b>${u.name?`<span>${f(u.email)}</span>`:""}</span></button>`)].map((u,b)=>u.replace('role="option"',`role="option" aria-selected="${b===0}"`)).join("")}</div>`);let p=t.nextElementSibling;s&&(p.style.animation="none"),p.getBoundingClientRect().top<8&&p.classList.add("is-below")},wm='<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>',$m='<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>',Nd=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),..._a].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>f(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=e.length?new RegExp(`@(?:${e.join("|")})${Er}`,"giu"):null;return Mr(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${f(o.url)}" target="_blank" rel="noopener noreferrer" title="${f(o.url)}">${o.kind==="pr"?wm:wi}<span>${f(o.label)}</span>${$m}</a>`:s?f(o).replace(s,a=>{let r=Fc(a,n.team??[],n.me?.email);return`<span class="dt-at" data-kind="${r}">${r==="agent"?Fe(10):""}${a}</span>`}):f(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let s=document.createElement("div");for(let a=0;a<e.rangeCount;a++)s.append(e.getRangeAt(a).cloneContents());let o=s.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",s.textContent??""),t.preventDefault()}});let Bd=(t,e)=>{let s=t.selectionStart??t.value.length,o=t.value.slice(0,s).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(s)}`,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()};document.addEventListener("pointerdown",t=>{for(let e of nt.querySelectorAll(".dt-mentions"))e.contains(t.target)||(e.closest(".dt-compose")?.querySelector("textarea")?.setAttribute("data-no-mention",""),e.remove())},!0);let xm=(t,e)=>{if(!t){B&&(B.category=e),Z();return}dn(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>tt({id:t,category:e}),"Changing the type")};lu([nt,it],f,Me),it.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&oa(Number(e.dataset.id),e.value)}),it.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),ml(Number(e.dataset.id)))},!0);let Em=t=>Bt(t)?"studio":"clients",ar=async(t,e=!1)=>{let s=j.find(r=>r.id===t);if(!s||Bt(s)&&s.client)return;let o=!Bt(s);X===t&&(X=null);let a=o&&Xt(s.assignee)?{assignee:null,stage:"new"}:{};await dn(r=>r.map(l=>l.id===t?{...l,...a.stage?{assignee:void 0,stage:"new"}:{},shared:o||void 0,client:o?l.client:void 0}:l),()=>tt(o?{id:t,shared:o,...a}:{id:t,shared:!1,client:!1}),o?"Moving it to Client":"Moving it to Team"),hs(yt),e||qe(o?"Moved to Client":"Moved to Team",()=>ar(t,!0))},Mm=async t=>{let e=j.find(d=>d.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...Bt(e)?{}:{shared:!0}};for(let d of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[d]!=null&&(o[d]=s[d]);let a=await zn(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Kn("The copy was not made",a);return}let r=Gn([await a.json().catch(()=>null)])[0];r&&(yt=[...yt,r],j=yt.filter(d=>d.route===xt)),hs(yt),Z(),nn();let l=Em(e);qe(l==="clients"?"Duplicated for the client":"Duplicated to Team",()=>{r&&(Ns(l),ms(r.id))},"Open")},km=["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"],Aa=async t=>{let e=[],s=0;for(let o of t){let a=yt.find(u=>u.id===o);if(!a||!Bt(a)||Yo(a))continue;let r=a,l={text:a.text,from:{id:a.id}};for(let u of km)r[u]!=null&&(l[u]=r[u]);let d=await zn(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(l)})).catch(()=>null);if(!d?.ok){Kn("Not mirrored",d);break}let p=Gn([await d.json().catch(()=>null)])[0];p&&(d.status===201?e.push(p):s++,yt=[...yt.filter(u=>u.id!==p.id),p])}if(j=yt.filter(o=>o.route===xt),hs(yt),Z(),nn(),!e.length){s&&Gt("Already mirrored");return}qe(`${e.length} mirrored to Team`,async()=>{let o=new Set(e.map(a=>a.id));yt=yt.filter(a=>!o.has(a.id)),j=j.filter(a=>!o.has(a.id)),hs(yt),Z();for(let a of o)await zn(ie(`comments?id=${a}`,{method:"DELETE"})).catch(()=>null);nn()})},ir=()=>{Ie=null,Xo=null,ge(Yt())},Rd=async()=>{let t=[...Ie??[]];ir(),t.length&&await Aa(t)},Lm=(t,e)=>{let s=j.find(o=>o.id===t);if(Ie??=new Set,s&&ks(s)){let o=[...it.querySelectorAll(".dt-hist-go[data-go]")].map(l=>Number(l.dataset.go)),a=o.indexOf(Xo??t),r=o.indexOf(t);if(e&&a>=0&&r>=0)for(let l of o.slice(Math.min(a,r),Math.max(a,r)+1)){let d=j.find(p=>p.id===l);d&&ks(d)&&Ie.add(l)}else Ie.has(t)?Ie.delete(t):Ie.add(t);Xo=t}ge(Yt())};document.addEventListener("keydown",t=>{t.key==="Escape"&&Ie&&(t.stopImmediatePropagation(),t.preventDefault(),ir())},!0);let Sm=t=>{let e=new URL(location.href);e.searchParams.has("notemend")||(e.search=e.search?`${e.search}&notemend`:"?notemend"),e.hash=`thread-${t}`;let s=e.href;navigator.clipboard?.writeText(s).then(()=>Gt("Link copied"),()=>Gt(s,6e3))};nt.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,p=Number(e.dataset.id)||0;e.value="",d==="dup"?Mm(p):d==="mirror"?Aa([p]):d==="move"?ar(p):d==="repin"?xd(p):d==="link"?Sm(p):d==="reopen"?tn(p,!1):d==="archive"||d==="unarchive"?us(p,d==="archive"):d==="rm"?(X=null,Bi(p)):d==="discard"&&(B=null,Z());return}let s=t.target.closest(".dt-lang-select");if(s){Ti(Number(s.dataset.id),s.dataset.at,s.value==="orig"?null:s.value);return}let o=t.target.closest(".dt-cat-select");if(o){xm(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){up(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-owner-select");if(r){Uu(Number(r.dataset.id)||0,r.value);return}let l=t.target.closest(".dt-for-select");if(l){if(ct.setItem("nm-for",l.value),n.client){B&&(B.assignee=l.value,so(l.value),Z());return}ci(Number(l.dataset.id)||0,"person")}}),nt.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&B?.suggest){B.suggest.to=e.value,rs(),or(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!s)return;s.removeAttribute("data-no-mention"),Cd(s),s.classList.contains("dt-note-input")?B&&(B.text=s.value):s.classList.contains("dt-note-edit-input")?te&&(te.text=s.value):Pe=s.value,rs(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),or(s);let o=s.closest(".dt-note");o&&o.getBoundingClientRect().bottom>va()&&(Ii([]),o.classList.contains("is-capped")&&(o.scrollTop=o.scrollHeight))}),nt.addEventListener("keydown",t=>{if(t.key==="Escape"&&nt.querySelector(".dt-emoji")){t.stopPropagation();let a=Cn?.box??Cn?.btn;ha(),a?.focus();return}let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let s=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!s()&&!e.hasAttribute("data-no-mention")&&Cd(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),Bd(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),e.setAttribute("data-no-mention",""),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let Ft=null,Ha=!1;function Is(t){return!n.client||!!n.me&&t.by===n.me.email}let Pd=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},rr=Pd("dt-drag-box--home"),Id=Pd("dt-drag-box--to"),Od=()=>{let t=document.body.currentCSSZoom??1;for(let e of document.querySelectorAll(".dt-notes-overlay, .dt-notes-hi, .dt-spot, .dt-pad-overlay, .dt-drag-box"))e.style.zoom=t===1?"":String(1/t)};Od(),addEventListener("resize",Od);let Tm=async(t,e,s,o)=>{let a=j.find(u=>u.id===t);if(!a)return;let r={...lr(e,s,o),fp:Qo(e),spot:{x:Math.round(s+scrollX),y:Math.round(o+scrollY)}},l={selector:a.selector,tag:a.tag,classes:a.classes,nth:a.nth,label:a.label,ctx:a.ctx,rx:a.rx,ry:a.ry,fp:a.fp,spot:a.spot},d=`${ga(a.tag,a.classes,a.selector)}${re(a.label)?` \xAB${Jt(re(a.label),24)}\xBB`:""}`,p=(u,b,T)=>dn(P=>P.map(m=>m.id===t?{...m,...u,anchor:null,...b?{repinnedAt:new Date().toISOString(),repinnedBy:n.me?.email??"you",repinnedFrom:d}:{repinnedAt:null,repinnedBy:null,repinnedFrom:null}}:m),()=>tt({id:t,move:u,anchor:null,repin:b?d:!1}),T);ls.delete(t),await p(r,!0,"Re-pinning"),qe(`Pinned to ${vo(e)}`,()=>{ls.delete(t),p(l,!1,"Putting the pin back")})},Am=()=>{let t=ii;ii=null;let e=t!=null?j.find(d=>d.id===t):null,s=e&&Qe(e);if(!e||!s||(X===e.id&&ms(e.id),e.spot||!Is(e)))return;let o=s.getBoundingClientRect(),a=o.left+o.width*e.rx,r=o.top+o.height*e.ry,l={...lr(s,a,r),fp:Qo(s),spot:{x:Math.round(a+scrollX),y:Math.round(r+scrollY)}};ls.delete(e.id),tt({id:e.id,move:l,anchor:null}).then(d=>{d.ok&&Object.assign(e,l,{anchor:null})}).catch(()=>{})},Hm=t=>{let e=j.find(r=>r.id===t),s=e&&Ce(e)?.opener;if(!e||!s)return;fo=!0;let o=s.getBoundingClientRect(),a={bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2,button:0,view:window};try{for(let r of["pointerdown","mousedown","pointerup","mouseup","click"])s.dispatchEvent(new(r.startsWith("pointer")?PointerEvent:MouseEvent)(r,a))}finally{fo=!1}X=null,setTimeout(()=>{ta(),X=t,Z()},180)},vo=t=>{let e=Jt(re(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},qd=(t,e,s="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,t.querySelector("span").textContent=s,t.hidden=!1},Cm=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(et)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,Nm=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},lr=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),r=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ni(t),tag:a,classes:r,nth:si({tag:a,classes:r}).indexOf(t),label:Us(t.textContent||"",60),ctx:oi(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,(s-o.top)/o.height)):.5}},dr=()=>{Ft&&(Ft.on&&Oo(Ft.pin,"land"),Ft.pin.classList.remove("is-dragging"),Zt.toggle("dt-dragging",!1),rr.hidden=Id.hidden=!0,Ft=null,en())};nt.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=j.find(o=>o.id===Number(e.dataset.id));!s||!Is(s)||(Ft={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:Qe(s),to:null},e.setPointerCapture(t.pointerId))}),nt.addEventListener("pointermove",t=>{if(!Ft||!Ft.on&&Math.hypot(t.clientX-Ft.x0,t.clientY-Ft.y0)<4)return;Ft.on=!0,Ft.pin.classList.add("is-dragging"),Zt.toggle("dt-dragging",!0),Ft.pin.style.left=`${t.clientX}px`,Ft.pin.style.top=`${t.clientY}px`,Ft.to=Ft.home&&Nm(Ft.home,t.clientX,t.clientY)?Ft.home:Cm(t.clientX,t.clientY);let e=Ft.to&&Ft.to!==Ft.home;qd(rr,Ft.home,e?"":Ft.home?vo(Ft.home):""),rr.classList.toggle("is-left",!!e),qd(Id,e?Ft.to:null,e?`Move to ${vo(Ft.to)}`:"")}),nt.addEventListener("pointerup",async t=>{if(!Ft)return;let e=Ft;if(!e.on||!e.to){dr();return}Ha=!0,setTimeout(()=>{Ha=!1},0);let s=j.find(d=>d.id===e.id),o=lr(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(dr(),!s)return;let r={selector:s.selector,tag:s.tag,classes:s.classes,nth:s.nth,label:s.label,ctx:s.ctx,rx:s.rx,ry:s.ry},l=(d,p)=>dn(u=>u.map(b=>b.id===e.id?{...b,...d}:b),()=>tt({id:e.id,move:d}),p);await l(o,"Moving the pin"),a&&qe(`Moved to ${vo(e.to)}`,()=>l(r,"Putting the pin back"))}),nt.addEventListener("click",t=>{Ha&&(t.stopImmediatePropagation(),t.preventDefault(),Ha=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&Ft?.on&&(t.stopImmediatePropagation(),dr())},!0),nt.addEventListener("click",async t=>{let e=t.target.closest("button"),s=Cn?.btn;if(e?.closest(".dt-emoji")||ha(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="open-orig"){Ns("clients"),ms(a);return}if(o==="react"){Tl(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&Sl(e,!1,o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&Cn){let r=Cn;Sl(r.btn,!0,r);return}if(o==="emoji"&&Cn){let r=Cn;ha(),r.box?Dp(r.box,e.dataset.emoji):r.id&&Tl(r.id,r.at||null,e.dataset.emoji);return}if(o==="prio"){let r=e.dataset.v||null;a?dn(l=>l.map(d=>d.id===a?{...d,priority:r??void 0}:d),()=>tt({id:a,priority:r}),"Setting the priority"):B&&(B.priority=r??void 0,rs(),Z());return}if(o==="mention"){let r=e.closest(".dt-compose")?.querySelector("textarea");r&&Bd(r,e.dataset.handle);return}if(!o){if(B&&!Zs())return;X=X===a?null:a,rn(),Z(),ps&&wa();return}if(o==="speak"){Hp(e.closest(".dt-note"),e);return}if(o==="voice-write"){Np(e);return}if(o==="voice"||o==="voice-seek"){bp(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&&sr([...r.files],l)}),r.click();return}if(o==="unshot"){a?te&&te.drop.push(e.dataset.img):(e.closest("[data-draft]")?B?.images??[]:Le).splice(Number(e.dataset.i),1),Z(),te&&Hd();return}if(o==="edit"){let r=j.find(p=>p.id===a),l=e.dataset.at||null,d=l?r?.replies?.find(p=>p.at===l)?.text:r?.text;if(d===void 0)return;te={id:a,at:l,text:d,drop:[]},Z(),Hd();return}if(o==="edit-cancel"){te=null,Z();return}if(o==="tr-orig"){Ti(a,e.dataset.at,null);return}if(o==="tr-retry"){Ti(a,e.dataset.at,e.dataset.to);return}if(o==="unsay"){let r=e.dataset.at;Up(a,r);return}if(o==="edit-save"){let r=te;if(!r)return;let l=r.text.trim();if(!l){nt.querySelector(".dt-note-edit-input")?.focus();return}te=null;let d=p=>r.drop.includes(p.split("/").pop());await dn(p=>p.map(u=>u.id!==r.id?u:{...u,...r.at==null?{text:l}:{replies:(u.replies??[]).map(b=>b.at===r.at?{...b,text:l}:b)},images:(u.images??[]).filter(b=>!d(b))}),()=>tt({id:r.id,edit:{at:r.at,text:l},...r.drop.length?{removeImage:r.drop}:{}}).then(p=>(p.ok||(te=r),p),p=>{throw te=r,p}),"Saving the edit");return}if(o==="cancel"){Zs()&&(rn(),Z());return}if(o==="twin"){if(!Zs())return;rn(),X=Number(e.dataset.id),Z();return}if(o==="discard"){B=null,Z();return}if(o==="draft-open"){Di(Number(e.dataset.i));return}if(o==="close"){X=null,Z();return}if(o==="go-spot"){let r=j.find(l=>l.id===Number(e.dataset.id));r&&tl(r);return}if(o==="show-el"){let r=j.find(l=>l.id===Number(e.dataset.id));r&&Qe(r)?.scrollIntoView({block:"center",inline:"center",behavior:ns()?"smooth":"auto"});return}if(o==="where"){let r=j.find(P=>P.id===Number(e.dataset.id)),l=r&&Ce(r),d=l?.hidden;if(!d)return;let p=P=>{let m=P.getBoundingClientRect();return(m.width||m.height)&&P.checkVisibility?.()!==!1?m:null},u=l.shut instanceof HTMLElement?l.shut:null,b=u&&p(u);if(u&&!b){let P=u.getAttribute("style");u.setAttribute("style",`${P??""};display:block!important`),b=p(u),P==null?u.removeAttribute("style"):u.setAttribute("style",P)}b??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let T=document.createElement("div");T.className="dt-where",T.style.cssText=`left:${b.left}px;top:${b.top}px;width:${b.width}px;height:${b.height}px`,document.body.append(T),On(T).then(()=>T.remove());return}if(o==="unsuggest"&&B){B.suggest=null,Z();return}if(o==="uncarry"&&B){B.assignee="",B.carried=!1,so(""),rs(),Z();return}if(o==="save"){if(!B)return;B.images&&(B.images=Td(B.images));let r=(B.images??[]).filter(_=>!Ts(_)),l=B.suggest&&B.suggest.to.trim()!==B.suggest.from?{from:B.suggest.from,to:B.suggest.to.trim()}:null,d=nt.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(B.images?.some($i)?kl:B.images?.some(_=>Ts(_)&&!Ho(_))?"See the attached image":B.images?.length?"See the attached file":"");if(!d){nt.querySelector(".dt-note-input")?.focus();return}let p=B,u=n.client||p.shared===!0?null:Sr(d,no()),b={...p,images:p.images?.filter(Ts),route:xt,text:d,suggest:l,assignee:n.client?wl(p.assignee)||void 0:u??(p.assignee||void 0),shared:n.client?!0:p.shared===!0,stage:n.client?"new":u?"approved":p.stage??(Xt(p.assignee)?"approved":"new"),breakpoint:ei(),browser:Du(),device:k?Dd:"",viewport:{w:innerWidth,h:innerHeight},logs:nu(),host:location.host},T={...p,id:-Date.now(),text:d,route:xt,status:"open",note:"",doneBy:null,breakpoint:b.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:n.me?.email,byName:n.me?.name};j=[...j,T],B=null,Z();let P=await zn(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b)})).catch(()=>null);if(!P?.ok){j=j.filter(_=>_!==T),rn(),B=p,Z(),Kn("Thread was not saved",P);return}let m=Gn([await P.json().catch(()=>null)])[0];j=j.map(_=>_===T&&m?m:_),Z(),m&&r.length&&Sd(m.id,r),nn();return}if(o==="reply"){let r=nt.querySelector(".dt-note-reply-input");Le=Td(Le);let l=r.value.trim()||(Le.some($i)?kl:Le.some(Q=>Ts(Q)&&!Ho(Q))?"See the attached image":Le.length?"See the attached file":"");if(!l){r.focus();return}let d=Le;Pe=l,fn=a,Qs(),Pe="",Le=[],r.value="";let p=j,u=j.find(Q=>Q.id===a),b=n.client||Bt(u)?null:Sr(l,no()),T=b&&u&&(b!==u.assignee||De(u)!=="approved"||u.status==="done")?{assignee:b,stage:"approved",...u.status==="done"?{status:"open",doneBy:null}:{}}:{};j=j.map(Q=>Q.id===a?{...Q,...T,replies:[...Q.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:n.me?.email}]}:Q),Wo=a,Z();let P=await zn(tt({id:a,reply:l,images:d.filter(Ts),...T})).catch(()=>null);if(!P?.ok){j=p,Pe=l,Le=d,Z();let Q=nt.querySelector(".dt-note-reply-input");Q&&!Q.value&&(Q.value=l);let Ot=()=>nt.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?qe(`Reply was not sent${P?` (${P.status})`:""} \u2014 it is back in the box`,Ot,"Retry"):Kn("Reply was not sent",P);return}Qs();let m=Gn([await P.json().catch(()=>null)])[0];m&&(j=j.map(Q=>Q.id===m.id?m:Q),Z()),nn();let _=d.filter(Q=>!Ts(Q));_.length&&Sd(a,_);return}if(o==="unfold"){Ss.set(a,1/0),Z();let r=nt.querySelector(`.dt-note[data-id="${a}"] .dt-note-thread`);if(r){for(let l of r.querySelectorAll(".dt-msg--new"))l.classList.remove("dt-msg--new");r.scrollTop=r.scrollHeight,Vo(r)}delete We[a],r?.parentElement?.querySelector(".dt-new-below")?.remove();return}if(o==="newbelow"){let r=e.closest(".dt-note")?.querySelector(".dt-note-thread");r?.scrollTo({top:r.scrollHeight,behavior:ns()?"smooth":"auto"}),delete We[a],e.remove();return}if(o==="hand"){ci(a,e.dataset.v);return}if(o==="repin"){xd(a);return}if(o==="open-it"){Hm(a);return}if(o==="lost-resolve"){X=null,await tn(a,!0);return}if(o==="claude"){ml(a);return}if(o==="sendback"){await tn(a,!1),yo(".dt-note-reply-input");return}if(o==="accept"){await tn(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(X=null),await us(a,o==="archive");return}e.classList.contains("dt-step-act")||(X=null),o==="rm"?await Bi(a):await tn(a,o==="done")});let Dd="",Ue=t=>{Sn.hidden||Ys.contentWindow?.postMessage({dt:!0,...t},location.origin)},Bm=()=>({notes:Ut,grid:!St.hidden,inspect:gt,resolved:Ze,archived:bn,...Fd.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(k&&e.projectGrid!==void 0){qt=e.projectGrid,St.hidden||we();return}if(!k&&t.source===Ys.contentWindow){if(e.key){pc(e.key[0],e.key[1])?.run();return}if(e.closeMenus){D();return}if(e.route){$();return}if(e.drafts){Ci=e.drafts,ge(Yt());return}}if(k&&typeof e.openDraft=="number"){Di(e.openDraft);return}if(k&&typeof e.dropDraft=="number"){Xl(e.dropDraft);return}if(k&&typeof e.device=="string"&&(Dd=e.device),k&&e.scrollbar&&Zt.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Ys.contentWindow){Ue(Bm());return}typeof e.notes=="boolean"&&e.notes!==Ut&&sn(e.notes,!1),typeof e.open=="number"&&ms(e.open),typeof e.grid=="boolean"&&e.grid===St.hidden&&ft(e.grid),typeof e.inspect=="string"&&e.inspect!==gt&&Y(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Ze&&ji(e.resolved),typeof e.archived=="boolean"&&e.archived!==bn&&_i(e.archived),e.reload&&gs()});let nn=async()=>{await gs(),Ue({reload:!0}),k&&parent.postMessage({dt:!0,reload:!0},location.origin)},sn=(t,e=!0)=>{if(Ut=t,Nt.setAttribute("aria-pressed",String(t)),t?!k&&it.hidden&&ct.getItem("dt-history")==="1"&&(Zl(),xe.setAttribute("aria-pressed","true")):(Jl(()=>{Ut||it.replaceChildren()}),xe.setAttribute("aria-pressed","false")),z(Vr,t?"1":"0"),Ue({notes:t}),k&&e&&parent.postMessage({dt:!0,notes:t},location.origin),nt.hidden=!t||!Sn.hidden,Zt.toggle("dt-noting",t),t&&!k?sd():document.querySelector(".dt-room")?.remove(),t){Y(""),document.addEventListener("click",nr,!0),document.addEventListener("pointerup",Ld,!0);for(let s of wd)document.addEventListener(s,Md,!0);document.addEventListener("contextmenu",kd,!0),document.addEventListener("keydown",vd),document.addEventListener("mousemove",er),addEventListener("scroll",en,!0),addEventListener("scroll",Ta,!0),addEventListener("scroll",wa,!0),addEventListener("resize",en),addEventListener("resize",Ta),addEventListener("pointerover",rd,!0),ta(),ad.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),id.observe(document.body),Zi()}else{rn(),X=null,document.removeEventListener("click",nr,!0),document.removeEventListener("pointerup",Ld,!0);for(let s of wd)document.removeEventListener(s,Md,!0);document.removeEventListener("contextmenu",kd,!0),document.removeEventListener("keydown",vd),document.removeEventListener("mousemove",er),is.hidden=!0,removeEventListener("scroll",en,!0),removeEventListener("scroll",Ta,!0),removeEventListener("scroll",wa,!0),removeEventListener("resize",en),removeEventListener("resize",Ta),removeEventListener("pointerover",rd,!0),ad.disconnect(),id.disconnect(),nt.innerHTML=""}},{pickBp:cr,...Fd}=fu({cfg:n,inFrame:k,persist:z,frame:Sn,frameEl:Ys,devicesMenu:as,bpBtns:Kt,notesOverlay:nt,WIDE:y,bpOf:S,currentBp:ei,deviceById:A,notesOn:()=>Ut,filter:()=>Za,filterTo:t=>{Za=t},dropFrameDrafts:()=>{Ci=[]},putAway:()=>{X=null,rn()},tellFrame:Ue,syncBpButtons:Xr,render:()=>Z(),reread:()=>{Ut?Zi():Z()}}),jd="dt-studio",_d=t=>{os.setAttribute("aria-pressed",String(t)),Zt.toggle("dt-no-studio",!t),z(jd,t?"1":"0")};os.addEventListener("click",()=>_d(os.getAttribute("aria-pressed")!=="true")),_d(ct.getItem(jd)!=="0"),Nt.addEventListener("click",()=>sn(!Ut));let ve=document.querySelector(".devtools"),Os=document.querySelector(".dt-tab"),Wd=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-ve.getBoundingClientRect().top)+12}px`);new ResizeObserver(Wd).observe(ve),addEventListener("resize",Wd);let Rm=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),zd=()=>{ve.removeAttribute("data-tight");let t=ve.getBoundingClientRect().right,e=Rm(),s=!1;for(let o of ve.children){let a=o.getBoundingClientRect();t=Math.max(t,a.right),e?.width&&e.left<a.right+8&&e.right>a.left-8&&e.top<a.bottom&&e.bottom>a.top&&(s=!0)}ve.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||s)},Vd=0,ur=()=>{cancelAnimationFrame(Vd),Vd=requestAnimationFrame(zd)},Pm=new ResizeObserver(ur);for(let t of ve.children)Pm.observe(t);addEventListener("resize",ur),zd();for(let t of[1500,4e3])setTimeout(ur,t);for(let t of x)t.addEventListener("toggle",()=>{let e=t.querySelector(":scope > :not(summary)");if(!e||(e.style.translate="",!t.open||it.hidden||t.matches(".dt-keys")))return;let s=e.getBoundingClientRect(),o=it.getBoundingClientRect();o.width&&s.right>o.left-8&&s.bottom>o.top&&s.top<o.bottom&&(e.style.translate=`${Math.round(o.left-8-s.right)}px 0`)});let Gd=t=>{ve.toggleAttribute("data-collapsed",t),Os.toggleAttribute("data-collapsed",t),Os.setAttribute("aria-expanded",String(!t)),Os.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),ve.inert=t,t&&D(),t&&Fs&&Na(""),t&&Ut&&!B&&X==null&&sn(!1),z("dt-collapsed",t?"1":"0")};Os.addEventListener("click",()=>Gd(!ve.hasAttribute("data-collapsed")));let un=document.querySelector(".dt-keys"),Kd=un.querySelector(".dt-set-keys"),Im=un.querySelector(".dt-set-main"),wo=un.querySelector(".dt-set-grid"),Ud=un.querySelector('[data-set="grid"] .dt-set-hint'),$o=t=>{if(Im.hidden=t!=="main",Kd.hidden=t!=="keys",wo.hidden=t!=="grid",t==="grid"&&Fm(),Ud){let e=pe();Ud.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},pr=t=>$o(t?"keys":"main"),mr={desktop:{cols:12,gutter:24,margin:24,max:1200},tablet:{cols:8,gutter:16,margin:24,max:null},landscape:{cols:4,gutter:16,margin:16,max:null},portrait:{cols:4,gutter:16,margin:16,max:null}},xo={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},Om=["cols","gutter","margin","max"],Ca=(t,e)=>Math.min(xo[t][1],Math.max(xo[t][0],Math.round(e))),qm=()=>({...mr,...qt?.widths}),hr=()=>!!n.project&&!!n.gridAdmin,Yd=()=>!St.hidden&&!pe()&&zt?zt:me(),Dm=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},Fm=()=>{let t=hr(),e=qm(),s=Lt(),o=pe(),a=h.find(p=>p.id===s),r=(p,u)=>`<div class="dt-grid-row"><span>${p}</span><b>${u}</b></div>`,l=(ae.cabinet||n.cabinet)&&n.project?` <a href="${f(`${ae.cabinet||n.cabinet}/p/${n.project}?tab=settings`)}" target="_blank" rel="noopener">Also in the cabinet \u203A</a>`:"",d;if(o)d=`<p class="dt-grid-band">${f(a.label.toUpperCase())} \xB7 ${a.ideal} \u2014 this width</p>
338
+ <div class="dt-grid-fields">${Om.map(p=>`<label><span>${p==="cols"?"Cols":p[0].toUpperCase()+p.slice(1)}</span>
339
+ <input type="number" inputmode="numeric" step="1" min="${xo[p][0]}" max="${xo[p][1]}" data-grid-k="${p}" value="${o[p]??""}"${p==="max"?' placeholder="\u2014"':""}${t?"":" disabled"}></label>`).join("")}</div><hr>
340
+ ${h.filter(p=>p.id!==s&&e[p.id]).map(p=>r(`${f(Dm(p.label))} \xB7 ${p.ideal}`,`${e[p.id].cols} \xB7 ${e[p.id].gutter} \xB7 ${e[p.id].margin}`)).join("")}<hr>
341
+ <p class="dt-grid-foot">${t?"Saved for the project \u2014 everyone sees it.":"Set by the project\u2019s admins."}${l}</p>`;else{let p=Yd();d=r(p.from==="guess"?"Guessed":"Read from the page",`${p.cols} \xD7 ${p.w}`)+r("Gap",String(p.gap))+r("Margin",String(p.x))}wo.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${za}<span>Grid</span></button><hr>`+(n.project?`<div class="dt-grid-from"><span>Columns from</span><div class="dt-seg" role="radiogroup" aria-label="Columns from">${["auto","custom"].map(p=>`<button type="button" role="radio" data-grid-mode="${p}" aria-checked="${p==="custom"==!!o}"${t?"":" disabled"}>${p==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},Xd=async(t,e)=>{let s=qt,o=p=>{p&&!wo.hidden&&$o("grid"),St.hidden||we(),Ue({projectGrid:qt})};qt=t(qt),o(e);let a=await ie("config").then(p=>p.ok?p.json():null).catch(()=>null),r=t(a?a.projectGrid??null:s),l=await ie("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:r})}).catch(()=>null);if(l?.ok){qt=(await l.json()).grid??null;return}let d=l?await l.text():"";Gt(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),qt=s,o(!0)};if(wo.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!hr()||e==="custom"==!!pe())return;let s=Lt(),o=e==="custom"?Yd():null,a=document.documentElement.clientWidth,r=o&&{cols:Ca("cols",o.cols),gutter:Ca("gutter",o.gap),margin:Ca("margin",o.x),max:Math.abs(a-2*o.x-o.w)<=2?null:Ca("max",o.w)};Xd(l=>({mode:e,widths:{...mr,...l?.widths,...r?{[s]:r}:{}}}),!0)}),wo.addEventListener("change",t=>{let e=t.target,s=e.dataset.gridK,o=pe();if(!s||!o||!hr())return;let a=e.value.trim()===""?null:Number(e.value),[r,l]=xo[s];if(a===null?s!=="max":!Number.isInteger(a)||a<r||a>l){Gt(`${s==="cols"?"Cols":s[0].toUpperCase()+s.slice(1)} is ${r}\u2013${l}${s==="max"?" or empty":""}.`),e.value=String(o[s]??"");return}if(a===o[s])return;let d=Lt();Xd(p=>({mode:"custom",widths:{...mr,...p?.widths,[d]:{...p?.widths?.[d]??o,[s]:a}}}),!1)}),vt.querySelector("button").addEventListener("click",()=>{D(),un.open=!0,$o("grid")}),$o("main"),ae.signOut)for(let t of document.querySelectorAll('.dt-me [data-set="out"], .dt-me [data-set-out]'))t.hidden=!1;let gr=()=>{},Jd=()=>!1;jm();function jm(){let t=document.querySelector(".dt-strip"),e=document.querySelector(".dt-strip-grip"),s=document.documentElement;if(k){t.hidden=e.hidden=!0;return}let o=t.querySelector(".dt-strip-pin"),a=ct.getItem("dt-strip-pin")==="1",r=!1,l=!1,d=0,p=0,u=()=>l||!!t.querySelector("details[open]")||t.matches(":hover")||!!t.querySelector(":focus-visible"),b=v=>{r=v||a,r||(l=!1),t.classList.toggle("is-out",r),t.inert=!r,Zt.toggle("dt-strip-out",r)},T=()=>{clearTimeout(p),p=window.setTimeout(()=>{r&&!a&&!u()&&b(!1)},350)};gr=v=>{l=v&&!a,b(v)},Jd=()=>r,document.addEventListener("mousemove",v=>{a||(v.clientY<=3?r||(d||=window.setTimeout(()=>{d=0,b(!0)},140)):(clearTimeout(d),d=0,r&&v.clientY>40&&T()))}),s.addEventListener("mouseleave",()=>{clearTimeout(d),d=0,r&&T()}),t.addEventListener("toggle",()=>{r&&T()},!0),t.addEventListener("focusout",()=>{r&&T()}),e.addEventListener("click",()=>b(!0)),document.addEventListener("pointerdown",v=>{r&&!a&&!t.contains(v.target)&&v.target!==e&&(l=!1,D(),b(!1))});let P=v=>{if(a=v,ct.setItem("dt-strip-pin",v?"1":"0"),o.setAttribute("aria-pressed",String(v)),o.dataset.tip=v?"Let it hide \u2014 the site moves back":"Keep it out \u2014 moves the site",Zt.toggle("dt-strip-on",v),v)Q();else{for(let[I,K]of m)I.style.top=K;m.clear()}b(!0)};o.addEventListener("click",()=>P(!a)),document.addEventListener("keydown",v=>{v.key==="Escape"&&r&&!a&&!t.querySelector("details[open]")&&b(!1)});let m=new Map,_=v=>{let I=getComputedStyle(v);if(I.position!=="fixed"&&I.position!=="sticky")return null;let K=v.computedStyleMap?.().get("top")?.toString();if(K?K==="auto":I.top==="auto"||parseFloat(I.top)>parseFloat(I.bottom))return null;if(I.position==="sticky"){for(let W=v.parentElement;W&&W!==document.body;W=W.parentElement)if(getComputedStyle(W).overflowY!=="visible")return null}return`calc(${I.top} + 40px)`},Q=v=>{if(!a)return;for(let W of v??[])W.style.top=m.get(W)??"",m.delete(W);let K=(v??[...document.body.children].filter(W=>!/(^|\s)(dt-|devtools)/.test(String(W.className))).flatMap(W=>[W,...W.querySelectorAll("*")])).filter(W=>W.isConnected&&W.style&&!m.has(W)).map(W=>[W,_(W)]).filter(W=>W[1]);for(let[W,ot]of K)m.set(W,W.style.top),W.style.setProperty("top",ot,"important"),Ot.observe(W,{attributes:!0,attributeFilter:["class"]})},Ot=new MutationObserver(v=>Q([...new Set(v.map(I=>I.target))].filter(I=>m.has(I)))),Pt=0,le=()=>{Pt||=window.setTimeout(()=>{Pt=0,Q()},500)};new MutationObserver(v=>{v.every(nd)||le()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),addEventListener("resize",()=>{Q([...m.keys()]),le()}),P(a),b(a);let mt=t.querySelector(".dt-me");if(n.me){mt.querySelector(".dt-me-face").innerHTML=Fn(n.me.avatar_url,n.me.name||n.me.email).replace(/^<(img|b) /,`<$1 style="--hue:${Oe(n.me.email.toLowerCase())}" `);let v=ae.cabinet||n.cabinet;if(v){let I=mt.querySelector(".dt-me-cab"),K=mt.querySelector(".dt-me-acc");I.href=n.project?`${v}/p/${n.project}`:v,I.hidden=!1,K.href=`${v}/settings?tab=account`,K.hidden=!1}}mt.addEventListener("click",v=>{let I=v.target.closest("[data-set], a");I&&(mt.open=!1,I.dataset.set==="out"&&confirm("Sign out of Notemend on this site?")&&(ct.removeItem(Ps),ae.signOut?.()))});let Tt=t.querySelector(".dt-pages"),bt=Tt.querySelector(".dt-pages-find input"),kt=Tt.querySelector(".dt-pages-hits"),Ht=Tt.querySelector(".dt-pages-foot");Tt.addEventListener("toggle",()=>{if(Tt.open){bt.value="",Te(),requestAnimationFrame(()=>bt.focus());let v=Tt.querySelector(".dt-pages-copy");v&&(delete v.dataset.copied,v.dataset.tip="Copy link")}});let Te=()=>{let v=bt.value.trim().toLowerCase();if(G.hidden=!!v,kt.hidden=!v,Ht.classList.toggle("is-off",!!v),!v)return;let I=n.pages.filter(K=>K.label.toLowerCase().includes(v)||K.route.toLowerCase().includes(v)).slice(0,12);kt.innerHTML=I.length?`<ul>${I.map(K=>`<li><a href="${f(K.route)}"${K.route===xt?' aria-current="page"':""}><span class="dt-menu-label">${f(K.label)}</span><em class="dt-pages-route">${f(K.route)}</em></a></li>`).join("")}</ul>`:`<p class="dt-pages-none">No page matches \u201C${f(bt.value.trim())}\u201D</p>`};bt.addEventListener("input",Te),bt.addEventListener("keydown",v=>{v.key==="Enter"&&(v.preventDefault(),kt.querySelector("a")?.click()),v.key==="Escape"&&bt.value&&(v.preventDefault(),v.stopPropagation(),bt.value="",Te())});let de=Tt.querySelector(".dt-pages-copy"),ce=v=>{v.preventDefault(),v.stopPropagation(),v instanceof MouseEvent&&v.detail>0&&de.blur(),navigator.clipboard?.writeText(location.href.replace(/#.*$/,"")).catch(()=>null),de.dataset.copied="",de.dataset.tip="Link copied",clearTimeout(Number(de.dataset.t)),de.dataset.t=String(window.setTimeout(()=>{delete de.dataset.copied,de.dataset.tip="Copy link"},1600))};de.addEventListener("click",ce),de.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&ce(v)}),_t=()=>{$(),hs(yt),M&&En()};let Rn=()=>{z("dt-folders-open",JSON.stringify([...V])),z("dt-folders-closed",JSON.stringify([...U]))};if(G.addEventListener("click",v=>{let I=v.target,K=I.closest(".dt-folder-more");if(K)return v.preventDefault(),qa(K);let W=I.closest(".dt-folder-row");if(!W||W.querySelector("input"))return;let ot=W.parentElement,Mt=ot.dataset.folder,lt=!ot.hasAttribute("data-open");lt?(V.add(Mt),U.delete(Mt)):(V.delete(Mt),U.add(Mt)),Rn(),ot.toggleAttribute("data-open",lt),W.setAttribute("aria-expanded",String(lt)),W.children[1].outerHTML=se(lt),Ga(ot.querySelector(":scope > ul"),lt)}),G.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&v.target.matches(".dt-folder-row")&&(v.preventDefault(),v.target.click())}),!M)return;let ue=new Set,Ne="",Oa=v=>{let I=v.closest("li[data-route]");if(I)return`p:${I.dataset.route}`;let K=v.closest(".dt-folder:not(.dt-folder--site)");return K&&v.closest(".dt-folder-row")?`f:${K.dataset.folder}`:""},ko=()=>[...G.querySelectorAll("li[data-route], .dt-folder:not(.dt-folder--site)")].filter(v=>v.matches(".dt-folder")||v.offsetParent).map(v=>v.dataset.route?`p:${v.dataset.route}`:`f:${v.dataset.folder}`),js=Ht.querySelector(".dt-sel-hint");function En(){for(let I of G.querySelectorAll(".is-picked"))I.classList.remove("is-picked");for(let I of ue)(I.startsWith("p:")?G.querySelector(`li[data-route="${CSS.escape(I.slice(2))}"] > a`):G.querySelector(`[data-folder="${CSS.escape(I.slice(2))}"] > .dt-folder-row`))?.classList.add("is-picked");let v=ue.size;js.hidden=!v,js.innerHTML=v?`<b>${v} selected</b><button type="button" data-sel="group"><kbd>\u2318G</kbd> Group</button><button type="button" data-sel="ungroup"><kbd>\u2318\u21E7G</kbd> Ungroup</button>`:""}let _s=()=>{ue.size&&(ue.clear(),Ne="",En())};G.addEventListener("click",v=>{let I=v,K=I.metaKey||I.ctrlKey,W=I.shiftKey,ot=Oa(v.target);if(!ot||!K&&!W){v.target.closest(".dt-folder-more")||_s();return}if(v.preventDefault(),v.stopImmediatePropagation(),W&&Ne){let Mt=ko(),lt=Mt.indexOf(Ne),pt=Mt.indexOf(ot);if(lt>=0&&pt>=0)for(let Be of Mt.slice(Math.min(lt,pt),Math.max(lt,pt)+1))ue.add(Be)}else ue.has(ot)?ue.delete(ot):ue.add(ot);Ne=ot,En()},!0),Tt.addEventListener("toggle",()=>{Tt.open||_s()});let Ws=()=>{let v=ko().filter(lt=>ue.has(lt)&&lt.startsWith("p:")).map(lt=>lt.slice(2)),I=[...ue].filter(lt=>lt.startsWith("f:")).map(lt=>lt.slice(2)).filter(lt=>!L.some(pt=>ue.has(`f:${pt.id}`)&&pn(lt,pt.id)));if(!v.length&&!I.length)return;let K=new Set([...v.map(lt=>L.find(pt=>pt.pages.includes(lt))?.id??""),...I.map(lt=>L.find(pt=>pt.id===lt)?.parent??"")]),W=K.size===1&&[...K][0]||null,ot=Math.random().toString(36).slice(2,10),Mt=[{id:ot,name:"Untitled folder",pages:v,...W?{parent:W}:{}},...L.map(lt=>({...lt,pages:lt.pages.filter(pt=>!v.includes(pt)),...I.includes(lt.id)?{parent:ot}:{}}))];W&&(V.add(W),U.delete(W)),ue.clear(),Ne="",V.add(ot),U.delete(ot),Rn(),Ae(Mt),Xn(ot,!1)};js.addEventListener("click",v=>{let I=v.target.closest("[data-sel]")?.dataset.sel;I==="group"&&Ws(),I==="ungroup"&&wt()});let wt=()=>{let v=new Set([...ue].filter(W=>W.startsWith("f:")).map(W=>W.slice(2)));for(let W of ue)if(W.startsWith("p:")){let ot=L.find(Mt=>Mt.pages.includes(W.slice(2)));ot&&v.add(ot.id)}if(!v.size)return;let I=L,K=L.filter(W=>v.has(W.id));ue.clear(),Ne="",Ae(vs(L,v)),qe(K.length===1?`Ungrouped \u201C${K[0].name}\u201D`:`Ungrouped ${K.length} folders`,()=>Ae(I))};document.addEventListener("keydown",v=>{if(!(!Tt.open||v.target?.closest?.("input:not(.dt-pages-find input), textarea"))){if(v.key==="Escape"&&ue.size){v.preventDefault(),v.stopImmediatePropagation(),_s();return}(v.metaKey||v.ctrlKey)&&v.code==="KeyG"&&ue.size&&(v.preventDefault(),v.stopImmediatePropagation(),v.shiftKey?wt():Ws())}},!0),G.addEventListener("dblclick",v=>{let I=v.target.closest(".dt-folder:not(.dt-folder--site)");!I||v.target.closest(".dt-folder-more, input")||!v.target.closest(".dt-folder-row")||(v.preventDefault(),Xn(I.dataset.folder,!1))});let Ae=async v=>{let I=L;L=v,Dt();let K=await ie("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({folders:v})}).catch(()=>null);if(K?.ok){let ot=(await K.json()).folders??[];JSON.stringify(ot)!==JSON.stringify(L)&&(L=ot,Dt());return}let W=K?await K.text():"";Gt(K?(()=>{try{return JSON.parse(W).error}catch{return W}})()||"The folders were not saved.":"The folders were not saved \u2014 no connection."),L=I,Dt()},vs=(v,I)=>{let K=v.map(W=>({...W,pages:[...W.pages]}));for(let W of I){let ot=K.find(pt=>pt.id===W);if(!ot)continue;let Mt=ot.parent&&K.some(pt=>pt.id===ot.parent&&pt.id!==W)?ot.parent:null;K=K.filter(pt=>pt.id!==W).map(pt=>pt.parent===W?{...pt,parent:Mt}:pt);let lt=Mt?K.find(pt=>pt.id===Mt):null;if(lt)for(let pt of ot.pages)lt.pages.includes(pt)||lt.pages.push(pt)}return K.map(({parent:W,...ot})=>W?{...ot,parent:W}:ot)},pn=(v,I)=>{let K=L.find(W=>W.id===v);return!!K?.parent&&(K.parent===I||pn(K.parent,I))},Xn=(v,I)=>{let K=G.querySelector(`[data-folder="${CSS.escape(v)}"] .dt-folder-row .dt-menu-label`);if(!K)return;let W=L.find(pt=>pt.id===v),ot=document.createElement("input");ot.className="dt-folder-name",ot.value=W.name,ot.maxLength=60,ot.setAttribute("aria-label","Folder name"),K.replaceWith(ot),ot.focus(),ot.select();let Mt=!1,lt=pt=>{if(Mt)return;Mt=!0;let Be=ot.value.trim();if(pt&&Be)return void Ae(L.map(Mn=>Mn.id===v?{...Mn,name:Be}:Mn));I&&(L=L.filter(Mn=>Mn.id!==v)),Dt()};ot.addEventListener("keydown",pt=>{pt.key==="Enter"&&(pt.preventDefault(),lt(!0)),pt.key==="Escape"&&(pt.preventDefault(),pt.stopPropagation(),lt(!1)),pt.stopPropagation()}),ot.addEventListener("blur",()=>lt(!0)),ot.addEventListener("click",pt=>pt.stopPropagation())};Ht.querySelector(".dt-folder-new").addEventListener("click",()=>{let v=Math.random().toString(36).slice(2,10);L=[{id:v,name:"Untitled folder",pages:[]},...L],V.add(v),Rn(),Dt(),Xn(v,!0)});let ee=null,mn=()=>{ee?.remove(),ee=null};Tt.addEventListener("toggle",()=>{Tt.open||mn()});function qa(v){mn();let I=v.closest(".dt-folder").dataset.folder,K=L.find(Mt=>Mt.id===I);ee=document.createElement("div"),ee.className="dt-folder-menu",ee.setAttribute("role","menu"),ee.innerHTML=`<button type="button" role="menuitem" data-do="rename">${es}<span>Rename</span></button><button type="button" role="menuitem" data-do="add">${$t('<path d="M10 4.5v11M4.5 10h11" />',13)}<span>Add pages\u2026</span></button><button type="button" role="menuitem" data-do="sub">${se(!1)}<span>New folder inside</span></button>`+(K.pages.length||L.some(Mt=>Mt.parent===K.id)?`<button type="button" role="menuitem" data-do="ungroup">${$t('<rect x="3" y="3" width="6" height="6" rx="1.5" /><rect x="11" y="11" width="6" height="6" rx="1.5" /><path d="M11 5.5h3.5V9M9 14.5H5.5V11" />',13)}<span>Ungroup</span></button>`:"")+`<button type="button" role="menuitem" data-do="delete" class="is-danger">${ts}<span>Delete folder</span></button>`,Tt.append(ee);let W=v.getBoundingClientRect(),ot=Tt.getBoundingClientRect();ee.style.left=`${W.right-ot.left+6}px`,ee.style.top=`${W.top-ot.top-4}px`,ee.addEventListener("click",Mt=>{let lt=Mt.target.closest("[data-do]")?.dataset.do;if(!lt)return;if(mn(),lt==="rename")return Xn(I,!1);if(lt==="add")return Lo(I,v);if(lt==="sub"){let Be=Math.random().toString(36).slice(2,10);return L=[{id:Be,name:"Untitled folder",pages:[],parent:I},...L],V.add(I),V.add(Be),U.delete(I),Rn(),Dt(),Xn(Be,!0)}let pt=L;Ae(vs(L,new Set([I]))),qe(lt==="delete"?`Deleted \u201C${K.name}\u201D`:`Ungrouped \u201C${K.name}\u201D`,()=>Ae(pt))})}function Lo(v,I){mn();let K=L.find(lt=>lt.id===v),W=n.pages.filter(lt=>!K.pages.includes(lt.route));ee=document.createElement("div"),ee.className="dt-folder-menu dt-folder-add",ee.setAttribute("role","menu"),ee.innerHTML=`<p class="dt-pages-group">Add to ${f(K.name)}</p>`+(W.length?W.map(lt=>`<button type="button" role="menuitem" data-route="${f(lt.route)}"><span>${f(lt.label)}</span><em class="dt-pages-route">${f(lt.route)}</em></button>`).join(""):'<p class="dt-pages-none">Every page is in it</p>'),Tt.append(ee);let ot=I.getBoundingClientRect(),Mt=Tt.getBoundingClientRect();ee.style.left=`${ot.right-Mt.left+6}px`,ee.style.top=`${ot.top-Mt.top-4}px`,ee.addEventListener("click",lt=>{let pt=lt.target.closest("[data-route]");if(!pt)return;let Be=pt.dataset.route;pt.remove(),V.add(v),U.delete(v),Rn(),Ae(L.map(Mn=>({...Mn,pages:Mn.id===v?[...Mn.pages.filter(vr=>vr!==Be),Be]:Mn.pages.filter(vr=>vr!==Be)})))})}let Jn="";G.addEventListener("dragstart",v=>{let I=v.target.closest("li[data-route], li.dt-folder");I&&(v.stopPropagation(),Jn=I.dataset.route??`f:${I.dataset.folder}`,I.classList.add("is-dragging"),v.dataTransfer?.setData("text/plain",Jn),v.dataTransfer&&(v.dataTransfer.effectAllowed="move"))});let zs=v=>v?.closest?.(".dt-folder:not(.dt-folder--site)")??null;G.addEventListener("dragover",v=>{if(!Jn)return;v.preventDefault();let I=zs(v.target);for(let K of G.querySelectorAll(".is-drop"))K!==I&&K.classList.remove("is-drop");I?.classList.add("is-drop"),G.classList.toggle("is-drop-out",!I)}),G.addEventListener("dragend",()=>{Jn="",G.classList.remove("is-drop-out");for(let v of G.querySelectorAll(".is-drop, .is-dragging"))v.classList.remove("is-drop","is-dragging")});let So=v=>requestAnimationFrame(()=>{let I=G.querySelector(v);I&&(Oo(I,"glow"),I.scrollIntoView({block:"nearest",behavior:ns()?"smooth":"auto"}))});G.addEventListener("drop",v=>{v.preventDefault();let I=Jn,K=zs(v.target)?.dataset.folder;if(!I)return;if(I.startsWith("f:")){let Mt=I.slice(2);if(K===Mt||K&&pn(K,Mt))return;let lt=L.map(pt=>pt.id===Mt?{...pt,parent:K??null}:pt).map(({parent:pt,...Be})=>pt?{...Be,parent:pt}:Be);K&&(V.add(K),U.delete(K),Rn()),JSON.stringify(lt)!==JSON.stringify(L)&&(Ae(lt),So(`[data-folder="${CSS.escape(Mt)}"] > .dt-folder-row`));return}let W=L.map(Mt=>({...Mt,pages:Mt.pages.filter(lt=>lt!==I)})),ot=K?W.find(Mt=>Mt.id===K):null;ot&&(ot.pages.push(I),V.add(ot.id),Rn()),JSON.stringify(W)!==JSON.stringify(L)&&(Ae(W),So(`li[data-route="${CSS.escape(I)}"] > a`))})}un.querySelector("summary").addEventListener("click",()=>pr(!1));let Un=ve.querySelector(".dt-vision"),qs=Un.querySelector(".dt-vision-sheet"),Eo=[{id:"",name:"Normal",hint:"",css:"none"},{id:"grey",name:"Greyscale",hint:"only light and dark",css:"grayscale(1)"},{id:"low",name:"Low vision",hint:"slightly blurred",css:"blur(2.5px)"},{id:"deut",name:"Deuteranopia",hint:"red\u2013green, most common",css:"url(#dt-deut)",m:"0.367322 0.860646 -0.227968 0 0 0.280085 0.672501 0.047413 0 0 -0.011820 0.042940 0.968881 0 0 0 0 0 1 0"},{id:"prot",name:"Protanopia",hint:"red\u2013green",css:"url(#dt-prot)",m:"0.152286 1.052583 -0.204868 0 0 0.114503 0.786281 0.099216 0 0 -0.003882 -0.048116 1.051998 0 0 0 0 0 1 0"},{id:"trit",name:"Tritanopia",hint:"blue\u2013yellow",css:"url(#dt-trit)",m:"1.255528 -0.076749 -0.178779 0 0 -0.078411 0.930809 0.147602 0 0 0.004733 0.691367 0.303900 0 0 0 0 0 1 0"}];document.body.insertAdjacentHTML("beforeend",`<svg class="dt-vision-defs" width="0" height="0" aria-hidden="true">${Eo.filter(t=>t.m).map(t=>`<filter id="dt-${t.id}" color-interpolation-filters="linearRGB"><feColorMatrix type="matrix" values="${t.m}"/></filter>`).join("")}</svg>`);let Zd=document.createElement("style");document.head.append(Zd);let Ds=document.createElement("div");Ds.className="dt-seeing",Ds.hidden=!0,ve.append(Ds);let Fs="",Na=t=>{Fs=t;let e=Eo.find(s=>s.id===t)??Eo[0];Zd.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",Un.toggleAttribute("data-on",!!t),Ds.hidden=!t,Ds.innerHTML=t?`${$t('<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.5" />',13)}<span>Seeing as ${e.name}</span><kbd>Esc</kbd><button type="button" aria-label="See the page as it is">${$t('<path d="M5 5l10 10M15 5 5 15" />',12)}</button>`:""};Ds.addEventListener("click",t=>{t.target.closest("button")&&Na("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!Fs||t.defaultPrevented||mc(t.target)||(Na(""),t.preventDefault())});let Ba=null,fr=0,br=0,Qd=()=>{let t=Math.round((Date.now()-fr)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},tc=t=>{if(t==="none"){qs.className="dt-sheet dt-vision-sheet dt-vision-list",qs.innerHTML='<p class="dt-vision-title">See the page as</p>'+Eo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Fs}"><span>${s.name}</span>${s.id===Fs?$t('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${s.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;qs.className="dt-sheet dt-vision-sheet",qs.innerHTML=`<div class="dt-vision-head"><b>This view, six ways</b><span class="dt-vision-ago">${t==="taking"?"taking a snapshot\u2026":`snapshot \xB7 ${Qd()}`}</span><span class="dt-vision-grow"></span><span>Click one to see the page that way</span><button type="button" class="dt-icon dt-vision-again" data-tip="Take a new snapshot" aria-label="Take a new snapshot">${$t('<path d="M3.5 10a6.5 6.5 0 1 0 2-4.7M3.5 3.5v3.6h3.6" />')}</button></div><div class="dt-vision-grid">${Eo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Fs}"><span class="dt-vision-thumb">${Ba&&t==="ready"?`<img src="${Ba}" alt="" style="filter:${s.id==="low"?`blur(${(2.5*e*2).toFixed(2)}px)`:s.css}">`:""}</span><span>${s.name}</span></button>`).join("")}</div>`},yr=async()=>{let t=++br;tc("taking");let e=[document.body,document.documentElement].map(o=>getComputedStyle(o).backgroundColor).find(o=>o&&o!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(o))??"#fff",s=null;try{let{domToWebp:o}=await import("modern-screenshot");s=await Promise.race([o(document.body,{width:innerWidth,height:innerHeight,scale:460/innerWidth,quality:.75,timeout:4e3,backgroundColor:e,style:{transform:`translate(${-scrollX}px, ${-scrollY}px)`},filter:a=>!(a instanceof Element&&a.closest(`${Xs}, .dt-pad-overlay, .dt-grid-overlay, .dt-vision-defs, .dt-toast`))}),new Promise(a=>setTimeout(()=>a(null),4e3))])}catch{s=null}t!==br||!Un.open||(Ba=s,fr=Date.now(),tc(s?"ready":"none"))},ec=0,nc=0,sc=()=>{clearTimeout(nc),nc=window.setTimeout(yr,400)};Un.addEventListener("toggle",()=>{if(clearInterval(ec),removeEventListener("scroll",sc,!0),!Un.open){br++;return}yr(),addEventListener("scroll",sc,!0),ec=window.setInterval(()=>{let t=qs.querySelector(".dt-vision-ago");t&&Ba&&fr&&(t.textContent=`snapshot \xB7 ${Qd()}`)},1e3)}),qs.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void yr();let s=e.closest("[data-vision]");s&&(Na(s.dataset.vision??""),Un.open=!1)});let Mo=ve.querySelector(".dt-custom"),Ra=Mo.querySelector(".dt-custom-sheet"),oc="dt-hidden-tools",ac="dt-new-seen",ic=["contrast","vision"],rc=()=>{let t=(o,a,r)=>{let l=ve.querySelector(a);return l?{id:o,el:l,name:r}:null},e=[t("grid",".dt-grid-btn","Grid"),t("pads",".dt-pad-btn","Spacing"),t("sizes",".dt-size-btn","Size"),t("type",".dt-type-btn","Typography"),t("color",".dt-color-btn","Color"),t("border",".dt-border-btn","Border"),t("contrast",".dt-contrast-btn","Contrast"),t("vision",".dt-vision","Vision")],s=[...Kt.map(o=>({id:`bp:${o.dataset.bp}`,el:o,name:(o.getAttribute("aria-label")??o.dataset.bp??"").replace(/^mobile\s+(\w)/i,(a,r)=>r.toUpperCase())})),{id:"devices",el:as,name:"Device menu"}];return[...n.client?[]:[{group:"Inspect",tools:e.filter(o=>!!o)}],{group:"Devices",tools:s}]},lc=t=>(ct.getItem(t)??"").split(",").filter(Boolean),Yn=new Set(lc(oc)),dc=()=>{for(let{tools:e}of rc())for(let s of e)s.el.toggleAttribute("data-off",Yn.has(s.id));Object.entries(rt).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&Y("")},_m=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",cc=()=>{let t=lc(ac);Ra.innerHTML=rc().map(({group:e,tools:s})=>{let o=s.filter(a=>!Yn.has(a.id)).length;return`<p class="dt-custom-label"><b>${e}</b><span>${o} of ${s.length}</span></p><div class="dt-custom-well">${s.map(a=>`<button type="button" class="dt-custom-tile" data-tool="${f(a.id)}" aria-pressed="${!Yn.has(a.id)}">${_m(a.el)}<span>${f(a.name)}</span>${ic.includes(a.id)&&!t.includes(a.id)?'<i class="dt-custom-new">New</i>':""}</button>`).join("")}</div>`}).join("")+`<div class="dt-custom-foot"><button type="button" class="dt-custom-all"${Yn.size?"":" disabled"}>Show all</button><span></span><button type="button" class="dt-custom-done">Done</button></div>`};Ra.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){Mo.open=!1;return}e.closest(".dt-custom-all")&&Yn.clear();let s=e.closest("[data-tool]");if(s){let o=s.dataset.tool;Yn.delete(o)||Yn.add(o)}!s&&!e.closest(".dt-custom-all")||(z(oc,[...Yn].join(",")),dc(),cc(),Ra.querySelector(s?`[data-tool="${s.dataset.tool}"]`:".dt-custom-done")?.focus())}),Mo.addEventListener("toggle",()=>{Mo.open?(cc(),Ra.querySelector(".dt-custom-tile")?.focus()):z(ac,ic.join(","))}),dc(),un.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return pr(s==="keys");if(s==="grid")return $o("grid");un.open=!1,s==="custom"&&(Mo.open=!0),s==="hide"&&Os.click()});let on=t=>()=>ve.querySelector(t)?.click(),uc=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},Pa=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:on(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:on(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:on(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>_i(!bn)},{group:"Threads",code:"Slash",hint:"/",label:"Search pages",run:()=>{let t=document.querySelector(".dt-strip"),e=t?.querySelector(".dt-pages");if(t&&!t.hidden&&e){D(),gr(!0),e.open=!0;return}document.querySelector(".dt-history")?.hasAttribute("hidden")&&on(".dt-history-btn")(),it.hasAttribute("data-collapsed")&&$a(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Team / client",run:()=>Ie?void Rd():Ns(Ve==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Bs.hidden||uo(cn.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:on(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:on(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:on(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:on(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:on(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:on(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{Un.open=!Un.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:on(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:on(".dt-studio-btn")}]:[],...Kt.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:()=>{as.open=!as.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:uc(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:uc(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>Os.click()},{group:"View",code:"Backslash",shift:!0,hint:"\u21E7\\",label:"Top strip",run:()=>gr(!Jd())},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=un.open&&!Kd.hidden;un.open=!t,pr(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),pc=(t,e)=>Pa.find(s=>s.code===t&&!s.shift==!e&&!(s.el&&ve.querySelector(s.el)?.closest("[data-off]"))&&!(s.code==="KeyD"&&as.hasAttribute("data-off"))),mc=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(n.shortcuts){for(let o of Pa){let a=o.el&&ve.querySelector(o.el);a&&(a.dataset.tip=`${a.dataset.tip??o.label} \xB7 ${o.hint}`,a.setAttribute("aria-keyshortcuts",o.hint.startsWith("\u21E7")?`Shift+${o.hint.slice(1)}`:o.hint))}let t=(o,a)=>`<div class="dt-key-row"><span>${f(o)}</span><kbd>${f(a)}</kbd></div>`,e=(o,a)=>`<div class="dt-keys-col"><p class="dt-keys-group">${o}</p>${a}</div>`,s=[...new Set(Pa.map(o=>o.group))].map(o=>e(o,Pa.filter(a=>a.group===o).map(a=>t(a.label,a.hint)).join("")));if(s.push(e("In a comment",t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"))),un.querySelector(".dt-keys-list").innerHTML=`<div class="dt-keys-half">${s.slice(0,2).join("")}</div><div class="dt-keys-half">${s.slice(2).join("")}</div>`,document.addEventListener("keydown",o=>{if(o.repeat||o.isComposing||o.metaKey||o.ctrlKey||o.altKey||o.defaultPrevented||mc(o.composedPath()[0]??o.target))return;let a=pc(o.code,o.shiftKey);a&&setTimeout(()=>{o.defaultPrevented||(k?parent.postMessage({dt:!0,key:[o.code,o.shiftKey]},location.origin):a.run())})}),k){let o=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",o,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&o()})}}if(!k){Gd(ct.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>ve.setAttribute("data-ready",""))),Fd.restore(),ft(ct.getItem(It)==="1");let t=ct.getItem(Et);t&&t in rt&&Y(t),sn(ct.getItem(Vr)==="1"&&xt!=="/connect")}let hc=()=>{try{let t=JSON.parse(ct.getItem(Tn)||"null");ze=(t?.parked??[]).filter(s=>Js(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};if(t?.draft&&e(t.draft.selector)?(B=t.draft,!Ut&&!k&&sn(!0)):Js(t?.draft)&&ze.push(t.draft),t?.reply?.text&&(Pe=t.reply.text,fn=X=t.reply.for??null),X==null)try{X=Number(sessionStorage.getItem(`nm-open:${Tn}`))||null,sessionStorage.removeItem(`nm-open:${Tn}`)}catch{}(B||ze.length||Pe)&&Z()}catch{ct.removeItem(Tn)}};hc();let gc=()=>setTimeout(()=>{let t=F(location.pathname);t!==xt&&(clearTimeout(Go),Qs(),xt=t,k&&parent.postMessage({dt:!0,route:t},location.origin),Tn=Ur(),B=null,ze=[],Pe="",fn=null,X=null,te=null,j=[],Ut&&!k&&sn(!1),$(),hc(),Zi(),gs())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),gc()}}addEventListener("popstate",gc);try{let t=JSON.parse(ct.getItem(Ps)||"null");t?.project===bd&&t.body?(Xi=t.body.version??"",Ji(t.body),ho=""):t&&ct.removeItem(Ps)}catch{ct.removeItem(Ps)}i.then(async t=>{t.status===200&&Ji(await t.json(),!c)},()=>{}).then(()=>!c&&(Ze||bn)?gs(!0):void 0).then(xa.resume),document.addEventListener("visibilitychange",()=>{document.hidden||fs()}),addEventListener("focus",fs),addEventListener("notemend:changed",()=>{k||fs()});let Ia=!1,ys=null,fc=()=>{if(!(k||ae.via||!("EventSource"in window))){if(document.hidden){ys?.close(),ys=null,Ia=!1;return}ys||(ys=new EventSource("/__devbar/events"),ys.onopen=()=>{Ia=!0},ys.onerror=()=>{Ia=!1},ys.onmessage=t=>{t.data!==ho&&fs()})}};fc(),document.addEventListener("visibilitychange",fc);let bc=0,Wm=()=>{k||ae.via||document.hidden||Date.now()-bc<1e4||(bc=Date.now(),fetch("/__devbar/active",{method:"POST",keepalive:!0}).catch(()=>{}))};for(let t of["pointerdown","pointermove","keydown","wheel"])addEventListener(t,Wm,{passive:!0,capture:!0});let zm=0;k||setInterval(()=>{(!(ae.live||Ia)||++zm%6===0)&&fs()},2e4),setInterval(()=>{!document.hidden&&j.some(t=>hn(t))&&Z()},3e4),k&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Lu(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,c=i.showModal,h=null,g=null,y=()=>{if(h){g?.disconnect(),g=null;for(let w of n)document.body.append(w);try{h.hidePopover()}catch{}h.remove(),h=null}},S=()=>{y();let w=document.querySelector("dialog:modal");w&&C(w)},C=w=>{y(),h=document.createElement("div"),h.className="dt-host",h.setAttribute("popover","manual"),h.append(...n),w.append(h);try{h.showPopover()}catch{}w.addEventListener("close",S,{once:!0}),g=new MutationObserver(()=>{w.isConnected||S()}),g.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){c.call(this),this.isConnected&&C(this)}}function jr(n,i,c,h=""){let g=document.createElement("div");g.className="nm-ask",g.setAttribute("style",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px","padding:6px 6px 6px 12px","background:#0e0d0c","color:#f2efec","border:1px solid rgba(255,255,255,.09)","border-radius:999px","box-shadow:0 10px 34px rgba(0,0,0,.5)","font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif"].join(";"));let y=document.createElement(n?"a":"span");y instanceof HTMLAnchorElement&&n&&(y.href=n,y.target=c,h&&(y.rel=h)),y.className="nm-ask-go",y.textContent=i;let S=document.createElement("style");return S.textContent=`.nm-ask{transition:border-color 120ms cubic-bezier(.22,1,.36,1)}
342
342
  .nm-ask:has(a.nm-ask-go:hover){border-color:rgba(255,255,255,.14)!important}
343
343
  .nm-ask-go{transition:background-color 120ms cubic-bezier(.22,1,.36,1),transform 120ms cubic-bezier(.22,1,.36,1)}
344
344
  a.nm-ask-go:hover{background:#ff7a33!important}
345
345
  a.nm-ask-go:active{background:#d94d00!important;transform:translateY(1px)}
346
346
  .nm-ask-go:focus-visible{outline:2px solid #ff6a1a;outline-offset:2px}
347
- @media (prefers-reduced-motion:reduce){.nm-ask,.nm-ask-go{transition:none}}`,b.setAttribute("style",`display:inline-flex;align-items:center;height:28px;padding:0 12px;border-radius:999px;background:${n?"#ff6a1a;color:#1a0800":"rgba(255,255,255,.08);color:#f2efec"};font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif;letter-spacing:-.01em;text-decoration:none;cursor:${n?"pointer":"default"}`),g.innerHTML='<svg role="img" aria-label="Notemend" width="16" height="16" viewBox="0 4 100 100" style="display:block;flex:none"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',g.append(L,b),document.body.append(g),{pill:g,link:b}}function Lu(n){let i=window;if(i.__notemend)return;i.__notemend=!0,tu(g=>g.includes("/__devbar/")||!!ce.base&&g.startsWith(ce.base)),Qt.ready=new Promise(g=>{if(!("__next_f"in self))return g();let b=0,L=()=>Object.keys(document.documentElement).some(A=>A.startsWith("__reactFiber$"))||++b>330?g():setTimeout(L,30);L()}),Qt.toggle("dt-in-frame",Vs),Qt.toggle("dt-strip-on",!Vs&&ct.getItem("dt-strip-pin")==="1");let c=bc(),m=oe(c);zc().then(async g=>{await n,Qt.set("--dt-z",String(g.zIndex));let b=g.client?g.brand?.color:null;if(b&&/^#[0-9a-f]{6}$/i.test(b)){let[T,M,z]=[1,3,5].map(at=>parseInt(b.slice(at,at+2),16)/255);Qt.set("--dt-accent",b),Qt.set("--dt-accent-ink",.2126*T+.7152*M+.0722*z>.55?"#000000":"#ffffff")}Uc(g);let L="",A=()=>{let T=document.body.currentCSSZoom??1,M=T>0&&Math.abs(T-1)>.001?String(1/T):"1";M!==L&&(L=M,Qt.set("--dt-unzoom",M))};A();let v=new MutationObserver(A);for(let T of[document.documentElement,document.body])v.observe(T,{attributes:!0,attributeFilter:["style","class"]});addEventListener("resize",A),Mu(g,m,c==="comments"),pu(),ku([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-tipbox"].map(T=>document.querySelector(T)).filter(T=>!!T))}).catch(g=>{console.warn("[notemend] not started:",g),Qt.toggle("dt-strip-on",!1);let b=window.__notemendHosted;ce.via&&String(g).includes("config 403")&&b?.ask&&(ce.refused=!0,b.ask("You\u2019re not in this project \u2014 sign in as someone else")),!ce.via&&String(g).includes("config 401")&&Lh(String(g.said??""))})}function Lh(n){if(/link/i.test(n)&&!/sign in/i.test(n)){jr(null,"Link this site to comment: npx notemend link <project-id>","");return}let{link:i}=jr("/__devbar/signin","Sign in to comment","notemend-signin"),c=0;i.addEventListener("click",()=>{clearInterval(c),c=window.setInterval(async()=>{let m=await fetch("/__devbar/signin?code=1").then(g=>g.json()).catch(()=>null);if(m?.done){clearInterval(c),location.reload();return}m?.code&&(i.textContent=`Allow code ${m.code} in the cabinet tab`)},1500)})}var Su=window,Es=class extends Error{},Tu=n=>new Set([...n.querySelectorAll("script")].filter(i=>!i.src.includes("/@vite/client")).map(i=>i.src?`src:${i.getAttribute("src").replace(/[?&]t=\d+/,"")}`:`inline:${i.textContent}`)),Au=(n,i)=>{let c=Tu(n);return[...Tu(i)].some(m=>!c.has(m))};function Sh(n,i){let c=[],m=n.firstChild;for(let g of i){let b=m;for(;b&&!(b.nodeName===g.nodeName&&(!(g instanceof Element)||!g.id||b.id===g.id));)b=b.nextSibling;c.push(b),b&&(m=b.nextSibling)}return c}function Th(n,i,c){for(let{name:m,value:g}of c.attributes){let b=i.getAttribute(m);if(b!==g)if(m==="class"&&b!=null){let L=new Set(b.split(/\s+/)),A=new Set(g.split(/\s+/));for(let v of L)v&&!A.has(v)&&n.classList.remove(v);for(let v of A)v&&!L.has(v)&&n.classList.add(v)}else n.setAttribute(m,g)}for(let{name:m}of i.attributes)c.hasAttribute(m)||n.removeAttribute(m)}function Hu(n,i,c){if(i.isEqualNode(c))return;if(i.nodeType!==Node.ELEMENT_NODE||c.nodeType!==Node.ELEMENT_NODE||i.nodeName!==c.nodeName||c.nodeName==="ASTRO-ISLAND"){if(i.nodeType===Node.TEXT_NODE&&c.nodeType===Node.TEXT_NODE){n.nodeValue=c.nodeValue;return}n.parentNode.replaceChild(document.importNode(c,!0),n);return}Th(n,i,c);let m=[...i.childNodes],g=[...c.childNodes],b=Sh(n,m),L=0,A=0;for(;L<m.length&&L<g.length&&m[L].isEqualNode(g[L]);)L++;for(;A<m.length-L&&A<g.length-L&&m[m.length-1-A].isEqualNode(g[g.length-1-A]);)A++;let v=m.slice(L,m.length-A),T=g.slice(L,g.length-A);if(v.length===T.length&&v.every((X,Q)=>X.nodeName===T[Q].nodeName)){v.forEach((X,Q)=>{let I=b[L+Q];if(!I)throw new Es;Hu(I,X,T[Q])});return}let M=A?b[m.length-A]:null,z=L?b[L-1]:null;if(A&&!M||L&&!z)throw new Es;for(let X of b.slice(L,m.length-A))X?.parentNode?.removeChild(X);let at=M??(z?z.nextSibling:n.firstChild);for(let X of T)n.insertBefore(document.importNode(X,!0),at)}function Ah(n){for(let i of n.head.querySelectorAll("style, link[rel=stylesheet]")){let c=i.getAttribute("data-vite-dev-id"),m=i.getAttribute("href"),g=[...document.head.querySelectorAll("style, link[rel=stylesheet]")].find(b=>c?b.getAttribute("data-vite-dev-id")===c:m?b.getAttribute("href")===m:b.textContent===i.textContent);g?c&&i.tagName==="STYLE"&&g.textContent!==i.textContent&&(g.textContent=i.textContent):document.head.append(document.importNode(i,!0))}n.title&&n.title!==document.title&&(document.title=n.title)}var Fo=null,_r=!1;function Wr(){return Fo?(_r=!0,Fo):(Fo=(async()=>{try{let n=Su.__notemendPage,i=await fetch(location.href,{cache:"no-store",headers:{accept:"text/html"}});if(!n||!i.ok||!(i.headers.get("content-type")??"").includes("html"))throw new Es;let c=new DOMParser().parseFromString(await i.text(),"text/html");if(Au(n,c.body)||Au(document.head,c.head))throw new Es;Ah(c),Hu(document.body,n,c.body),Su.__notemendPage=c.body,document.querySelector('meta[name="astro-view-transitions-enabled"]')&&(document.dispatchEvent(new Event("astro:after-swap")),document.dispatchEvent(new Event("astro:page-load")))}catch(n){n instanceof Es||console.warn("[notemend] refresh in place failed, reloading:",n),location.reload()}finally{Fo=null,_r&&(_r=!1,Wr())}})(),Fo)}Lu();import.meta.hot&&import.meta.hot.accept(()=>location.reload());import.meta.hot?.on&&import.meta.hot.on("notemend:refresh",()=>{import.meta.hot?.send?.("notemend:refreshed"),Wr()});
347
+ @media (prefers-reduced-motion:reduce){.nm-ask,.nm-ask-go{transition:none}}`,y.setAttribute("style",`display:inline-flex;align-items:center;height:28px;padding:0 12px;border-radius:999px;background:${n?"#ff6a1a;color:#1a0800":"rgba(255,255,255,.08);color:#f2efec"};font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif;letter-spacing:-.01em;text-decoration:none;cursor:${n?"pointer":"default"}`),g.innerHTML='<svg role="img" aria-label="Notemend" width="16" height="16" viewBox="0 4 100 100" style="display:block;flex:none"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',g.append(S,y),document.body.append(g),{pill:g,link:y}}function Su(n){let i=window;if(i.__notemend)return;i.__notemend=!0,eu(g=>g.includes("/__devbar/")||!!ae.base&&g.startsWith(ae.base)),Zt.ready=new Promise(g=>{if(!("__next_f"in self))return g();let y=0,S=()=>Object.keys(document.documentElement).some(C=>C.startsWith("__reactFiber$"))||++y>330?g():setTimeout(S,30);S()}),Zt.toggle("dt-in-frame",Vs),Zt.toggle("dt-strip-on",!Vs&&ct.getItem("dt-strip-pin")==="1");let c=yc(),h=ie(c);Vc().then(async g=>{await n,Zt.set("--dt-z",String(g.zIndex));let y=g.client?g.brand?.color:null;if(y&&/^#[0-9a-f]{6}$/i.test(y)){let[A,k,z]=[1,3,5].map(dt=>parseInt(y.slice(dt,dt+2),16)/255);Zt.set("--dt-accent",y),Zt.set("--dt-accent-ink",.2126*A+.7152*k+.0722*z>.55?"#000000":"#ffffff")}Yc(g);let S="",C=()=>{let A=document.body.currentCSSZoom??1,k=A>0&&Math.abs(A-1)>.001?String(1/A):"1";k!==S&&(S=k,Zt.set("--dt-unzoom",k))};C();let w=new MutationObserver(C);for(let A of[document.documentElement,document.body])w.observe(A,{attributes:!0,attributeFilter:["style","class"]});addEventListener("resize",C),ku(g,h,c==="comments"),mu(),Lu([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-tipbox"].map(A=>document.querySelector(A)).filter(A=>!!A))}).catch(g=>{console.warn("[notemend] not started:",g),Zt.toggle("dt-strip-on",!1);let y=window.__notemendHosted;ae.via&&String(g).includes("config 403")&&y?.ask&&(ae.refused=!0,y.ask("You\u2019re not in this project \u2014 sign in as someone else")),!ae.via&&String(g).includes("config 401")&&Th(String(g.said??""))})}function Th(n){if(/link/i.test(n)&&!/sign in/i.test(n)){jr(null,"Link this site to comment: npx notemend link <project-id>","");return}let{link:i}=jr("/__devbar/signin","Sign in to comment","notemend-signin"),c=0;i.addEventListener("click",()=>{clearInterval(c),c=window.setInterval(async()=>{let h=await fetch("/__devbar/signin?code=1").then(g=>g.json()).catch(()=>null);if(h?.done){clearInterval(c),location.reload();return}h?.code&&(i.textContent=`Allow code ${h.code} in the cabinet tab`)},1500)})}var Tu=window,Es=class extends Error{},Au=n=>new Set([...n.querySelectorAll("script")].filter(i=>!i.src.includes("/@vite/client")).map(i=>i.src?`src:${i.getAttribute("src").replace(/[?&]t=\d+/,"")}`:`inline:${i.textContent}`)),Hu=(n,i)=>{let c=Au(n);return[...Au(i)].some(h=>!c.has(h))};function Ah(n,i){let c=[],h=n.firstChild;for(let g of i){let y=h;for(;y&&!(y.nodeName===g.nodeName&&(!(g instanceof Element)||!g.id||y.id===g.id));)y=y.nextSibling;c.push(y),y&&(h=y.nextSibling)}return c}function Hh(n,i,c){for(let{name:h,value:g}of c.attributes){let y=i.getAttribute(h);if(y!==g)if(h==="class"&&y!=null){let S=new Set(y.split(/\s+/)),C=new Set(g.split(/\s+/));for(let w of S)w&&!C.has(w)&&n.classList.remove(w);for(let w of C)w&&!S.has(w)&&n.classList.add(w)}else n.setAttribute(h,g)}for(let{name:h}of i.attributes)c.hasAttribute(h)||n.removeAttribute(h)}function Cu(n,i,c){if(i.isEqualNode(c))return;if(i.nodeType!==Node.ELEMENT_NODE||c.nodeType!==Node.ELEMENT_NODE||i.nodeName!==c.nodeName||c.nodeName==="ASTRO-ISLAND"){if(i.nodeType===Node.TEXT_NODE&&c.nodeType===Node.TEXT_NODE){n.nodeValue=c.nodeValue;return}n.parentNode.replaceChild(document.importNode(c,!0),n);return}Hh(n,i,c);let h=[...i.childNodes],g=[...c.childNodes],y=Ah(n,h),S=0,C=0;for(;S<h.length&&S<g.length&&h[S].isEqualNode(g[S]);)S++;for(;C<h.length-S&&C<g.length-S&&h[h.length-1-C].isEqualNode(g[g.length-1-C]);)C++;let w=h.slice(S,h.length-C),A=g.slice(S,g.length-C);if(w.length===A.length&&w.every((J,tt)=>J.nodeName===A[tt].nodeName)){w.forEach((J,tt)=>{let F=y[S+tt];if(!F)throw new Es;Cu(F,J,A[tt])});return}let k=C?y[h.length-C]:null,z=S?y[S-1]:null;if(C&&!k||S&&!z)throw new Es;for(let J of y.slice(S,h.length-C))J?.parentNode?.removeChild(J);let dt=k??(z?z.nextSibling:n.firstChild);for(let J of A)n.insertBefore(document.importNode(J,!0),dt)}function Ch(n){for(let i of n.head.querySelectorAll("style, link[rel=stylesheet]")){let c=i.getAttribute("data-vite-dev-id"),h=i.getAttribute("href"),g=[...document.head.querySelectorAll("style, link[rel=stylesheet]")].find(y=>c?y.getAttribute("data-vite-dev-id")===c:h?y.getAttribute("href")===h:y.textContent===i.textContent);g?c&&i.tagName==="STYLE"&&g.textContent!==i.textContent&&(g.textContent=i.textContent):document.head.append(document.importNode(i,!0))}n.title&&n.title!==document.title&&(document.title=n.title)}var jo=null,_r=!1;function Wr(){return jo?(_r=!0,jo):(jo=(async()=>{try{let n=Tu.__notemendPage,i=await fetch(location.href,{cache:"no-store",headers:{accept:"text/html"}});if(!n||!i.ok||!(i.headers.get("content-type")??"").includes("html"))throw new Es;let c=new DOMParser().parseFromString(await i.text(),"text/html");if(Hu(n,c.body)||Hu(document.head,c.head))throw new Es;Ch(c),Cu(document.body,n,c.body),Tu.__notemendPage=c.body,document.querySelector('meta[name="astro-view-transitions-enabled"]')&&(document.dispatchEvent(new Event("astro:after-swap")),document.dispatchEvent(new Event("astro:page-load")))}catch(n){n instanceof Es||console.warn("[notemend] refresh in place failed, reloading:",n),location.reload()}finally{jo=null,_r&&(_r=!1,Wr())}})(),jo)}Su();import.meta.hot&&import.meta.hot.accept(()=>location.reload());import.meta.hot?.on&&import.meta.hot.on("notemend:refresh",()=>{import.meta.hot?.send?.("notemend:refreshed"),Wr()});