notemend 0.1.31 → 0.1.34

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,16 +1,16 @@
1
- import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function ae(n,r={}){if(r.method&&r.method!=="GET"&&typeof r.body=="string"&&r.body.length<8e3&&r.keepalive===void 0&&(r={...r,keepalive:!0}),!de.via){let m=window.__notemendEarly,g=!r.method||r.method==="GET"?m?.[n]:void 0;if(g){delete m[n];let b=await g;if(b)return b}return fetch(`/__devbar/${n}`,r)}let u=await de.via(n,r);if(u.ok&&n.startsWith("comments")&&(r.method??"GET")==="GET"){let m=await u.json().catch(()=>{});m?.signed&&Object.assign(de.signed,m.signed),u.json=()=>m===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(m)}return u}var rr=n=>de.via?de.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Rs=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),mt={getItem:n=>{try{return localStorage.getItem(n)}catch{return null}},setItem:(n,r)=>{try{localStorage.setItem(n,r)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}},lc=()=>mt.getItem("dt-resolved")==="0"&&mt.getItem("dt-archived")!=="1"?"comments?open=1":"comments";var pc=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null,mc=n=>{let r={};for(let u of n?.images||[]){let m=pc(u);m&&(r[m]=u)}return r},bo={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},lr=/^(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,Fm=/^(png|jpe?g|webp|gif|webm)$/i,ka=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,Zt=(n,r)=>{let u=String(n??"");if(u.length<=r)return u;let m="";if(ka)for(let{segment:g}of ka.segment(u)){if(m.length+g.length>r)break;m+=g}else for(let g of u){if(m.length+g.length>r)break;m+=g}return m},jm=[["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"]],hc=n=>{let r=String(n??"").split(".").pop().toLowerCase(),u=jm.find(([,,m])=>m.split(" ").includes(r));return u?{label:u[0],color:u[1]}:{label:"FILE",color:"#717171"}},dr=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),_m=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,r)=>[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",""][r]])),gc=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,r=>_m[r]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),fc=n=>{let r=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return r&&!lr.test(r[1])?r[1].toLowerCase():""};var yo=n=>{let r=String(n??"");if(r.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(r);if(!g)return null;let b=/;ext=([a-z0-9]{1,8})/i.exec(g[2])?.[1]?.toLowerCase()??Object.keys(bo).find(E=>bo[E]===g[1]);return b?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${b}`:null}let u=r.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(u))return null;let m=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(u);return m&&!Fm.test(m[2])?`${m[1]||"document"}.${m[2].toLowerCase()}`:null},en=n=>{let r=[{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(u=>({...u,images:[]}))];for(let u of n.images||[]){if(pc(u))continue;let m=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(u)?.[1]?.slice(0,13)),g=0;r.forEach((b,E)=>{Date.parse(b.at)<=m&&(g=E)}),r[g].images.push(u)}return r.filter(u=>!u.deleted)},bc=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],yc=["\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 Wm=20,vc=(n,r,u)=>{let m={...n||{}},g=m[r]||[];if(!g.length&&Object.keys(m).length>=Wm)return null;let b=g.includes(u)?g.filter(E=>E!==u):[...g,u];return b.length?m[r]=b:delete m[r],Object.keys(m).length?m:void 0},wc=n=>n.nickname||n.name||n.email,cr="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",zm=new RegExp("^"+cr,"u"),Vm=(n,r)=>{let u="@"+r.toLowerCase(),m=-1;for(let g=n.indexOf(u);g!==-1;g=n.indexOf(u,g+1))zm.test(n.slice(g+u.length))&&(m=g);return m};var Gm=/https?:\/\/[^\s<>"']+/g,dc=n=>{let r=n.filter(Boolean).pop();try{return r?decodeURIComponent(r):""}catch{return r}},Km=n=>{let r;try{r=new URL(n)}catch{return{label:String(n),kind:"link"}}let u=r.hostname.replace(/^www\./,""),m=r.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(u))return{label:m[2]?`Figma \xB7 ${dc([m[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(u==="github.com"&&m.length){let[b,E,H,y]=m;return{label:`GitHub \xB7 ${E??b}${/^(pull|issues)$/.test(H??"")&&y?` #${y}`:""}`,kind:H==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(u))return{label:"Loom",kind:"link"};let g=dc(m);return{label:g?`${u} \xB7 ${g.length>32?Zt(g,31)+"\u2026":g}`:u,kind:"link"}},ur=n=>{let r=String(n??""),u=[],m=0;for(let g of r.matchAll(Gm)){let b=g[0].replace(/[.,;:!?)\]]+$/,"");g.index>m&&u.push(r.slice(m,g.index)),u.push({url:b,...Km(b)}),m=g.index+b.length}return m<r.length&&u.push(r.slice(m)),u},$c=n=>ur(n).map(r=>typeof r=="string"?r:r.label).join(""),cc={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},xc=new Map,Ec=(n=[])=>{for(let r of n)r?.email&&xc.set(r.email.toLowerCase(),r.agent_name?.trim()||"")},Wn=(n,r)=>r&&xc.get(String(mr(r)??r).toLowerCase())||"Agent",pr=n=>!n||n==="claude"?"via Claude Code":n==="agent"||!cc[n]?"":`via ${cc[n]}`,La="3.6 3.6 10.8 10.8",Sa="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",mr=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,Jt=n=>n==="claude"||mr(n)!=null;var Um=["new","approved","progress","review","waiting"],Re=n=>Um.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":Jt(n?.assignee)?"approved":"new",qt=n=>n?.client===!0||n?.shared===!0,Mc=(n,r,u="")=>`Duplicated from ${u?u==="you"?"your":`${u}\u2019s`:"a"} ${(r?qt(r):!qt(n))?"client":"studio"} thread`,kc=n=>qt(n)?"Duplicated for the client":"Mirrored to Team",Ps=n=>Number.isInteger(n?.from?.id)&&!qt(n),Lc=(n="")=>`Mirrored from Client${n?` by ${n}`:""}`,fo={new:"Received",progress:"In progress",review:"In progress",waiting:"In progress",done:"Fixed \u2014 please check"},Sc=(n,r=Date.now())=>n?.status==="done"?fo.done:ln(n,r)||["progress","review","waiting"].includes(Re(n))?fo.progress:fo.new,Tc="Fixed \u2014 please check.",Ac=n=>n?.status==="done"&&!qt(n)&&Number.isInteger(n.from?.id)?n.from.id:null;var Ta=["agent","claude","codex","gemini"];var hr=(n,r=[])=>{let u=String(n||"").toLowerCase();return Ta.some(m=>Vm(u,m)!==-1)?"claude":null},Hc=(n,r=[],u="")=>{let m=String(n||"").replace(/^@/,"").toLowerCase();if(Ta.includes(m))return"agent";let g=r.find(b=>[b.name,b.nickname,b.email].some(E=>E&&E.toLowerCase()===m));return g&&u&&g.email?.toLowerCase()===u.toLowerCase()?"you":"person"};var Ym=2*36e5,ln=(n,r=Date.now())=>n?.working&&n.status!=="done"&&r-Date.parse(n.working.at)<Ym?n.working:null;var vo=(n,r,u=Date.now())=>{let m=String(n?.by||n?.byName||"").toLowerCase();if(!m||r==="done")return null;let g=r==="claude"||Jt(n.assignee),b=g?ln(n,u)?.by||n.doneFor||n.handedBy||mr(n.assignee)||m:n.assignee||"";return{writer:m,taker:String(b).toLowerCase(),claude:g}},gr=n=>/@guest\.notemend\.com$/i.test(String(n||"")),we=(n,r=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 u=en(n),m=u[u.length-1],g=ln(n,r);return u.length>1&&m.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(m.at))&&(!g||String(m.text??"").includes("?"))?"asks":g?g.step&&r-Date.parse(g.at)>Xm?"stuck":"working":n.working?"stuck":Re(n)==="approved"?"queued":null},Xm=10*6e4,uc=(n,r=Date.now())=>{let u=Math.floor((r-Date.parse(n??""))/6e4);return u>=1?u<60?`${u} min`:`${Math.floor(u/60)} h`:"now"},fr=(n,r=31)=>{let u=ka?[...ka.segment(String(n??""))].map(b=>b.segment):[...String(n??"")];if(u.length<=r)return u.join("");let m=u.join("").match(/\.\w{1,8}$/)?.[0],g=m?m.length+3:0;return u.slice(0,r-1-g).join("")+"\u2026"+(g?u.slice(-g).join(""):"")},br=(n,r=Date.now())=>{let u=n?.status!=="done"?n?.working:null;return u?.at?{step:u.step?String(u.step):null,elapsed:uc(u.since??u.at,r),silent:uc(u.at,r),stale:!ln(n,r)}:null};var Cc=Sa.split("M").filter(Boolean).map(n=>{let r=n.match(/[\d.]+/g).map(Number),[u,m]=/H/.test(n)?[r[2],r[1]]:/V/.test(n)?[r[0],r[2]]:[r[2],r[3]];return{d:"M"+n,a:(Math.atan2(u-9,9-m)+2*Math.PI)%(2*Math.PI)}}).sort((n,r)=>n.a-r.a).map(n=>n.d);var Nc=(n,r)=>{if(n.archivedAt)return!0;if(!r||n.status!=="done"||n.doneBy==="claude")return!1;let u=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(m=>!m.deleted).map(m=>Date.parse(m.at||"")||0));return!!u&&Date.now()-u>r*864e5},Jm=["uk","ru","en"],Bc=n=>{try{let r=new Intl.DisplayNames([n],{type:"language"}).of(n)??n;return r[0].toUpperCase()+r.slice(1)}catch{return n}},yr=n=>{try{return new Intl.DisplayNames(["en"],{type:"language"}).of(n)??n}catch{return n}},Aa=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":"",Rc=(n,r="en")=>{let u=Aa(n),m=r.split("-")[0].toLowerCase();return[...new Set([m,...Jm])].filter(g=>g!==u)};async function Pc(){let n=await ae("config");if(!n.ok)throw Object.assign(new Error(`config ${n.status}`),{said:n.status===401?await n.text().catch(()=>""):""});let r=await n.json();return r.breakpoints=r.breakpoints.map(u=>({...u,max:u.max??1/0})),Ec(r.team),r}var Ic=["iPhone","Android","Foldable","Tablet","Laptop & display"],wo=[{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,r=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[r]),zn=n=>n?new Date(n).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",wr=(n,r=u=>new Date(u).toLocaleDateString("en",{day:"numeric",month:"short"}))=>new Date(n).toDateString()===new Date().toDateString()?new Date(n).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):r(n),Vn='<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>',$e='<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>',Gn='<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>',yn='<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>',Sn='<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>',Ha='<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>',Ca='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',dn='<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>',Pe=n=>`<svg viewBox="${La}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${Sa}" stroke-width="1.15" stroke-linecap="round"/></svg>`,$r=(n,r)=>`<svg viewBox="${La}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${Cc.map((u,m)=>`<path d="${u}" stroke-width="1.15" stroke-linecap="round"${m<r?"":' class="is-off"'}/>`).join("")}</svg>`,xt=(n,r=15)=>`<svg viewBox="0 0 20 20" width="${r}" height="${r}" aria-hidden="true">${n}</svg>`,Zm=n=>n.breakpoints.map(r=>["new","progress","review","waiting","done"].map(u=>`<b data-bp="${f(r.id)}" data-state="${u}" hidden>${xt(r.icon,11)}<i></i></b>`).join("")).join(""),Oc=(n,r,u,m)=>`<li${m?` draggable="true" data-route="${f(r.route)}"`:""}><a href="${/^\/(?![\/\\])/.test(r.route)?f(r.route):"#"}"${r.route===u?' aria-current="page"':""}>`+(m?'<i class="dt-grip" aria-hidden="true"></i>':"")+`<span class="dt-menu-label">${f(r.label)}</span><em class="dt-pages-n" hidden>${Zm(n)}</em></a></li>`,Qm='<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>',$o=xt('<path d="M6 8l4 4 4-4" />',12),vr='<rect x="3" y="4" width="14" height="12" rx="2" /><path d="M3 8h14" />',qc='<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" />',xr={studio:vr,clients:qc};function Dc(n){let r=n.client?' style="display:none"':"",u=[...new Set(n.devices.map(T=>T.group))].map(T=>`<p class="dt-devices-group">${f(T)}</p>`+n.devices.filter(x=>x.group===T).map(x=>`<button type="button" data-device="${f(x.id)}" aria-pressed="false"${x.note?` title="${f(x.note)}"`:""}><span class="dt-menu-label">${f(x.label)}</span><em>${x.w}&times;${x.h}</em></button>`).join("")).join(""),m=Ic.map(T=>`<p class="dt-devices-group">${f(T)}</p>`+wo.filter(x=>x.group===T).map(x=>`<button type="button" data-emu="${f(x.id)}" aria-pressed="false"><span class="dt-menu-label">${f(x.label)}</span><em>${x.w}&times;${x.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.",E="The page at the device\u2019s size. A thread goes to its breakpoint.",H=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),y="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
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",`
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
- The bar below keeps the tools. It does not fold (10.11). -->
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">${Qm}</span>
7
+ <span class="dt-strip-mark">${nh}</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(vr,14)}</span><span class="dt-space-name">Team</span>${$o}</summary>
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>
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(vr,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(qc,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">${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>
14
14
  </div>
15
15
  </details>
16
16
  </div>
@@ -18,7 +18,7 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
18
18
  <summary aria-label="Pages">
19
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>
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
- <em class="dt-pages-here" hidden></em>${$o}
21
+ <em class="dt-pages-here" hidden></em>${Bo}
22
22
  </summary>
23
23
  <div class="dt-pages-menu">
24
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>
@@ -29,7 +29,7 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
29
29
  </details>
30
30
  <div class="dt-strip-side dt-strip-end">
31
31
  <details class="dt-me" name="dt-menu"${n.me?"":" hidden"}>
32
- <summary data-tip="You"><span class="dt-me-face"></span><span class="dt-me-name">${f(n.me?.name||n.me?.email||"")}</span>${$o}</summary>
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
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>
@@ -60,13 +60,17 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
60
60
  </div>
61
61
  </div>
62
62
  </details>
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>
63
65
  </div>
64
66
  </div>
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) -->
68
+ <button type="button" class="dt-strip-grip" aria-label="Show the Notemend strip"></button>
65
69
 
66
70
  <!-- One bar, bottom-centre: inspectors | comments | breakpoints \xB7 devices. -->
67
71
  <div class="devtools">
68
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="" />`:""}
69
- <div class="dt-group" role="group" aria-label="Inspect"${r}>
73
+ <div class="dt-group" role="group" aria-label="Inspect"${i}>
70
74
  <button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
71
75
  ${xt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
72
76
  </button>
@@ -125,10 +129,10 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
125
129
  <div class="dt-devices-menu">
126
130
  <div class="dt-menu-tabs" role="tablist" aria-label="Device lists">
127
131
  <button type="button" role="tab" data-tab="preview" aria-selected="true" aria-description="${b}" data-tip="${b}">Preview</button>
128
- <button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${E}" data-tip="${E}">DevTools</button>
132
+ <button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${L}" data-tip="${L}">DevTools</button>
129
133
  </div>
130
134
  <div class="dt-menu-panel" role="tabpanel" data-panel="preview">
131
- ${u}
135
+ ${c}
132
136
  </div>
133
137
  <div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
134
138
  <input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
@@ -151,7 +155,7 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
151
155
  <!-- push to Claude: one square tool in the agent's well \u2014 a press sends what waits for Claude; a right
152
156
  click or a long press picks pages and threads. Beside turbo, the studio's only, shown while there is any. -->
153
157
  <span class="dt-push" hidden${n.client?' style="display:none"':""}>
154
- <button class="dt-push-all" type="button" aria-label="Push to the agent"><svg viewBox="${La}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${Sa}" 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="${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
155
159
  >
156
160
  <div class="dt-push-menu" hidden role="dialog" aria-label="What goes to the agent"></div>
157
161
  </span>
@@ -170,14 +174,14 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
170
174
 
171
175
  <div class="dt-frame" hidden role="region" aria-label="Breakpoint preview">
172
176
  <div class="dt-stage">
173
- <span class="dt-frame-handle" data-edge="l" title="${y}"></span>
177
+ <span class="dt-frame-handle" data-edge="l" title="${v}"></span>
174
178
  <div class="dt-device">
175
179
  <div class="dt-shell"></div>
176
180
  <iframe title="Breakpoint preview"></iframe>
177
181
  <div class="dt-chrome" data-at="top"></div>
178
182
  <div class="dt-chrome" data-at="bottom"></div>
179
183
  </div>
180
- <span class="dt-frame-handle" data-edge="r" title="${y}"></span>
184
+ <span class="dt-frame-handle" data-edge="r" title="${v}"></span>
181
185
  </div>
182
186
  <div class="dt-ruler"></div>
183
187
  <span class="dt-frame-size"></span>
@@ -200,144 +204,144 @@ import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,c
200
204
  <div class="dt-grid-overlay" hidden>
201
205
  <div class="dt-grid-chip"><span></span><button type="button" hidden>Edit</button></div>
202
206
  <div class="${f(n.grid.container)} dt-overlay-container" aria-hidden="true">
203
- <div class="${f(n.grid.grid)} dt-overlay-grid">${H}</div>
207
+ <div class="${f(n.grid.grid)} dt-overlay-grid">${A}</div>
204
208
  </div>
205
209
  </div>
206
210
  <div class="dt-pad-overlay" hidden aria-hidden="true"></div>
207
- `)}var Ve=(n,r)=>{let u=r<=0?"":r>=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(r*4))].join(" ");return`<svg class="dt-stage-icon" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${u?`<polygon points="${u}" 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 Fc=[{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,r=14)=>`<svg viewBox="0 0 24 24" width="${r}" height="${r}" fill="none" stroke="${n.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n.icon}</svg>`,Is=n=>Fc.find(r=>r.id===n)||Fc[0];var Dt=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",_c={open:"Open",done:"Resolved",claude:"To check"};var ee={ready:Promise.resolve(),toggle:(n,r)=>{ee.ready.then(()=>document.documentElement.classList.toggle(n,r))},set:(n,r)=>{ee.ready.then(()=>document.documentElement.style.setProperty(n,r))}};var th=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Wc=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(th,"$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 ps=[],Er=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)}},eh=/ResizeObserver loop/,us=(n,r)=>{if(eh.test(r))return;let u=Zt(Wc(r.replace(/\s+/g," ").trim()),500),m=ps.findIndex(g=>g.kind===n&&g.text.replace(/ ×\d+$/,"")===u);if(m>=0){let[g]=ps.splice(m,1),b=Number(/ ×(\d+)$/.exec(g.text)?.[1]??1)+1;ps.push({at:new Date().toISOString(),kind:n,text:`${u} \xD7${b}`});return}ps.push({at:new Date().toISOString(),kind:n,text:u}),ps.length>50&&ps.shift()},zc=!1;function Vc(n){if(zc||typeof window>"u")return;zc=!0;let r=console.error;console.error=(...g)=>{us("console",g.map(Er).join(" ")),r.apply(console,g)},addEventListener("error",g=>{if(g instanceof ErrorEvent)return us("error",`${g.message}${g.filename?` (${g.filename}:${g.lineno})`:""}`);let b=g.target,E=b?.src||b?.href;E&&!n(E)&&us("network",`${b.tagName?.toLowerCase()} ${E} did not load`)},!0),addEventListener("unhandledrejection",g=>us("rejection",Er(g.reason)));let u=window.fetch;window.fetch=async(g,b)=>{let E=typeof g=="string"?g:g instanceof URL?g.href:g.url,H=(b?.method||(g instanceof Request?g.method:"GET")).toUpperCase();try{let y=await u.call(window,g,b);return y.status>=400&&!n(E)&&us("network",`${H} ${E} \u2192 ${y.status}`),y}catch(y){throw!n(E)&&y?.name!=="AbortError"&&us("network",`${H} ${E} \u2192 no answer (${Er(y)})`),y}};let m=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(g,b,...E){return this._nm=`${g.toUpperCase()} ${String(b)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(b))||us("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),m.call(this,g,b,...E)}}var Gc=(n=Date.now())=>ps.filter(r=>n-Date.parse(r.at)<10*6e4).slice(-20);function Kc(n){let r=L=>{let w=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,C=L/w;return Math.round(C*10)%10===0?String(Math.round(C)):C.toFixed(1)},u=(L,w,C,q,F,wt="p")=>{if(C<=0||q<=0)return"";let $t=F!==""?`<span class="dt-pad-chip dt-pad-chip--${wt}" style="left:${L+C/2}px;top:${w+q/2}px">${F}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${wt}" style="left:${L}px;top:${w}px;width:${C}px;height:${q}px"></span>${$t}`},m=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],g="button, a, input, select, textarea, label, [role='button']",b=L=>{let w=L;for(let C=0;w&&C<6;C++,w=w.parentElement){if(w.matches(g))return w;let q=getComputedStyle(w);if(m.some(F=>parseFloat(q[F])>=2))return w}return L},E=(L,w)=>{let C=parseFloat(w.columnGap)||0,q=parseFloat(w.rowGap)||0;if(!(w.display.includes("flex")||w.display.includes("grid"))||!C&&!q)return"";let F=[...L.children].map(ot=>ot.getBoundingClientRect()).filter(ot=>ot.width||ot.height),wt="",$t=(ot,et)=>r(Math.abs(ot-et)<=1?et:ot);for(let ot=1;ot<F.length;ot++){let et=F[ot-1],ct=F[ot];if(C&&ct.left>=et.right-1){let ft=Math.max(et.top,ct.top);wt+=u(et.right,ft,ct.left-et.right,Math.min(et.bottom,ct.bottom)-ft,$t(ct.left-et.right,C),"g")}else if(q&&ct.top>=et.bottom-1){let ft=Math.min(et.left,ct.left);wt+=u(ft,et.bottom,Math.max(et.right,ct.right)-ft,ct.top-et.bottom,$t(ct.top-et.bottom,q),"g")}}return wt},H=L=>`<span class="dt-pad-outline" style="left:${L.left}px;top:${L.top}px;width:${L.width}px;height:${L.height}px"></span>`,y=(L,w,C="")=>`<span class="dt-pad-tag" style="left:${w.left}px;top:${Math.max(2,w.top-22)}px">${L.tagName.toLowerCase()+(L.classList[0]?"."+L.classList[0]:"")}${C}</span>`,T=L=>{let w=L.getBoundingClientRect(),C=getComputedStyle(L),q=parseFloat(C.paddingTop),F=parseFloat(C.paddingRight),wt=parseFloat(C.paddingBottom),$t=parseFloat(C.paddingLeft),ot=H(w);ot+=u(w.left,w.top,w.width,q,q>=2?r(q):""),ot+=u(w.left,w.bottom-wt,w.width,wt,wt>=2?r(wt):""),ot+=u(w.left,w.top+q,$t,w.height-q-wt,$t>=2?r($t):""),ot+=u(w.right-F,w.top+q,F,w.height-q-wt,F>=2?r(F):"");let et=parseFloat(C.marginTop),ct=parseFloat(C.marginRight),ft=parseFloat(C.marginBottom),Nt=parseFloat(C.marginLeft);ot+=u(w.left,w.top-et,w.width,et,et>=2?r(et):"","m"),ot+=u(w.left,w.bottom,w.width,ft,ft>=2?r(ft):"","m"),ot+=u(w.left-Nt,w.top,Nt,w.height,Nt>=2?r(Nt):"","m"),ot+=u(w.right,w.top,ct,w.height,ct>=2?r(ct):"","m"),ot+=E(L,C);let ye=parseFloat(C.columnGap)||0,Ie=parseFloat(C.rowGap)||0,xe=(C.display.includes("flex")||C.display.includes("grid"))&&(ye||Ie)?` \xB7 gap ${r(ye)}${Ie&&Ie!==ye?"/"+r(Ie):""}`:"",Gt="",ce=L.parentElement;if(L.matches(g)&&ce){let he=getComputedStyle(ce);ot+=E(ce,he);let Oe=parseFloat(he.columnGap)||parseFloat(he.rowGap)||0;Gt=` \xB7 ${r(w.width)}\xD7${r(w.height)}${Oe&&(he.display.includes("flex")||he.display.includes("grid"))?` \xB7 gap ${r(Oe)} in its row`:""}`}let Se=Gt?"":` \xB7 ${Math.round(parseFloat(r(w.width)))} \xD7 ${Math.round(parseFloat(r(w.height)))}`;n.innerHTML=ot+y(L,w,Se+xe+Gt)},x=L=>{let w=L.getBoundingClientRect();n.innerHTML=H(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(r(w.width)))} \xD7 ${Math.round(parseFloat(r(w.height)))}</span>`},D=L=>{let w=(L.match(/[\d.]+/g)||[]).map(Number);if(w.length<3)return L;let C="#"+w.slice(0,3).map(q=>Math.round(q).toString(16).padStart(2,"0")).join("");return w[3]!==void 0&&w[3]<1?`${C} \xB7 ${Math.round(w[3]*100)}%`:C},dt=null,J=()=>{if(dt)return dt;let L=getComputedStyle(document.documentElement),w=document.createElement("span");w.style.display="none",document.body.append(w);let C=[];for(let q of Array.from(L)){if(!q.startsWith("--"))continue;let F=L.getPropertyValue(q).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(F))continue;w.style.color="rgb(1, 2, 3)",w.style.color=F;let wt=getComputedStyle(w).color;wt&&wt!=="rgb(1, 2, 3)"&&C.push([wt,q])}return w.remove(),C.sort((q,F)=>q[1].length-F[1].length),dt=C,C},tt=L=>J().find(([w])=>w===L)?.[1]??"",O=null,St=()=>{if(O)return O;let L=[],w=C=>{for(let q of Array.from(C))q instanceof CSSStyleRule?q.style.cssText.includes("var(--")&&L.push({sel:q.selectorText,style:q.style}):q instanceof CSSMediaRule?matchMedia(q.conditionText).matches&&w(q.cssRules):"cssRules"in q&&w(q.cssRules)};for(let C of Array.from(document.styleSheets))try{w(C.cssRules)}catch{}return O=L},zt={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(L=>[`border-${L}-color`,[`border-${L}-color`,"border-color",`border-${L}`,"border"]]))},Tt=(L,w)=>{let C=zt[w]??[w],q=w==="color";for(let F=L;F;F=q?F.parentElement:null){let wt=et=>C.map(ct=>/var\(\s*(--[\w-]+)/.exec(et.getPropertyValue(ct))?.[1]).find(Boolean),$t=F instanceof HTMLElement?wt(F.style):void 0;if($t)return $t;let ot="";for(let et of St()){let ct=!1;try{ct=F.matches(et.sel)}catch{}ct&&(ot=wt(et.style)||ot)}if(ot)return ot;if(q&&F.parentElement&&getComputedStyle(F).color!==getComputedStyle(F.parentElement).color)break}return""},it=(L,w,C)=>{let q=getComputedStyle(L).getPropertyValue(w).trim();if(!q)return D(C);let F=document.createElement("span");if(F.style.display="none",F.style.color=q,!F.style.color)return D(C);document.body.append(F);let wt=getComputedStyle(F).color;return F.remove(),D(wt)},yt=(L,w,C)=>{let q=Tt(L,w);if(q)return`<b class="dt-var">${q}</b> <em>${it(L,q,C)}</em>`;let F=tt(C);return F?`<span title="Same value as ${F}; not written with it">\u2248 ${F}</span> <em>${D(C)}</em>`:D(C)},Ft=L=>`<i class="dt-type-sw" style="background:${L}"></i>`,Wt={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},Et=L=>(L.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),ne=(L,w)=>L.slice(0,3).map((C,q)=>C*L[3]+w[q]*(1-L[3])).concat([1]),be=L=>{let w=[];for(let C=L;C;C=C.parentElement){let q=getComputedStyle(C);if(q.backgroundImage!=="none")return null;let F=Et(q.backgroundColor);if(F[3]>0&&(w.push(F),F[3]>=1))break}return w.reduceRight((C,q)=>ne(q,C),[255,255,255,1])},re=L=>{let[w,C,q]=L.slice(0,3).map(F=>(F/=255,F<=.03928?F/12.92:((F+.055)/1.055)**2.4));return .2126*w+.7152*C+.0722*q},me=(L,w,C)=>{let q=be(L);if(!q)return["Contrast","<em>on an image</em>"];let F=ne(Et(w.color),q),[wt,$t]=[re(F),re(q)].sort((ft,Nt)=>Nt-ft),ot=(wt+.05)/($t+.05),et=C>=24||C>=18.66&&Number(w.fontWeight)>=700,ct=ot>=(et?4.5:7)?"AAA":ot>=(et?3:4.5)?"AA":"fails AA";return["Contrast",`${ot.toFixed(2)}:1 <em class="${ct==="fails AA"?"dt-type-bad":""}">${ct}${et?" \xB7 large":""}</em>`]},S=L=>{let w=L.getBoundingClientRect(),C=getComputedStyle(L),q=parseFloat(C.fontSize),F=C.lineHeight==="normal"?0:parseFloat(C.lineHeight),wt=parseFloat(C.letterSpacing)||0,$t=Nt=>`${(Nt*100).toFixed(1).replace(/\.0$/,"")}%`,ot=[["Font",C.fontFamily.split(",")[0].replace(/["']/g,"")+(C.fontStyle!=="normal"?` ${C.fontStyle}`:"")],["Weight",`${Wt[C.fontWeight]??""} <em>${C.fontWeight}</em>`],["Size",`${r(q)}px`],["Line",F?`${$t(F/q)} <em>${r(F)}px</em>`:"normal"],["Letter",wt?`${$t(wt/q)} <em>${wt.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",Ft(C.color)+yt(L,"color",C.color)],me(L,C,q)],ct=w.bottom+150<innerHeight?w.bottom+8:Math.max(8,w.top-158),ft=Math.min(Math.max(8,w.left),innerWidth-210);n.innerHTML=H(w)+y(L,w)+`<div class="dt-type-card" style="left:${ft}px;top:${ct}px">${ot.map(([Nt,ye])=>`<span class="dt-type-row"><b>${Nt}</b><span>${ye}</span></span>`).join("")}</div>`},k=L=>L.every(w=>w===L[0])?L[0]:L[1]===L[3]&&L[0]===L[2]?`${L[0]} ${L[1]}`:L.join(" "),W=L=>/^rgba\(.*,\s*0\)$|^transparent$/.test(L),U=(L,w,C,q="")=>{let F=20+C.length*21,$t=w.bottom+F+12<innerHeight?w.bottom+8:Math.max(8,w.top-F-8),ot=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${q?`;border-radius:${q}`:""}"></span>`+y(L,w)+`<div class="dt-type-card dt-style-card" style="left:${ot}px;top:${$t}px">${C.map(([et,ct])=>`<span class="dt-type-row"><b>${et}</b><span>${ct}</span></span>`).join("")}</div>`},$=L=>{let w=getComputedStyle(L),C=[];w.backgroundImage!=="none"&&C.push(["Fill",`<em>${/gradient/.test(w.backgroundImage)?"gradient":"image"}</em>`]),W(w.backgroundColor)||C.push(["Fill",Ft(w.backgroundColor)+yt(L,"background-color",w.backgroundColor)]),L.textContent?.trim()&&C.push(["Text",Ft(w.color)+yt(L,"color",w.color)]),C.push(["Opacity",`${Math.round(Number(w.opacity)*100)}%`]),C.length||C.push(["Color","<em>no fill or text</em>"]),U(L,L.getBoundingClientRect(),C)},I=L=>{let w=getComputedStyle(L),C=[],q=["top","right","bottom","left"],F=q.map($t=>parseFloat(w.getPropertyValue(`border-${$t}-width`))||0);if(F.some($t=>$t>0)){let $t=q.filter((et,ct)=>F[ct]>0);q.forEach((et,ct)=>C.push([et[0].toUpperCase()+et.slice(1),`${r(F[ct])} <em>${w.getPropertyValue(`border-${et}-style`)}</em>`]));let ot=$t.map(et=>w.getPropertyValue(`border-${et}-color`));$t.forEach((et,ct)=>{ct&&ot[ct]===ot[0]||C.push([ct?`\u21B3 ${et}`:"Color",Ft(ot[ct])+yt(L,`border-${et}-color`,ot[ct])])})}else C.push(["Width","<em>none</em>"]);let wt=["top-left","top-right","bottom-right","bottom-left"].map($t=>{let[ot,et=ot]=w.getPropertyValue(`border-${$t}-radius`).split(" "),ct=ft=>ft.endsWith("%")?ft:r(parseFloat(ft)||0);return ot===et?ct(ot):`${ct(ot)}/${ct(et)}`});C.push(["Radius",k(wt)]),U(L,L.getBoundingClientRect(),C,w.borderRadius)},ht=(L,w)=>{let[C,q]=[re(L),re(w)].sort((F,wt)=>wt-F);return(C+.05)/(q+.05)},At=L=>"#"+L.slice(0,3).map(w=>Math.round(w).toString(16).padStart(2,"0")).join(""),Ht=(L,w,C)=>{let[q,F,wt]=L.map(xe=>xe/255),$t=Math.max(q,F,wt),ot=Math.min(q,F,wt),et=($t+ot)/2,ct=$t-ot,ft=ct?ct/(1-Math.abs(2*et-1)):0,Nt=ct?$t===q?((F-wt)/ct%6+6)%6:$t===F?(wt-q)/ct+2:(q-F)/ct+4:0,ye=xe=>{let Gt=(1-Math.abs(2*xe-1))*ft,ce=Gt*(1-Math.abs(Nt%2-1)),Se=xe-Gt/2,[he,Oe,gs]=Nt<1?[Gt,ce,0]:Nt<2?[ce,Gt,0]:Nt<3?[0,Gt,ce]:Nt<4?[0,ce,Gt]:Nt<5?[ce,0,Gt]:[Gt,0,ce];return[he,Oe,gs].map(Hn=>Math.min(255,Math.max(0,Math.round((Hn+Se)*255)))).concat([1])},Ie=re(L)>=re(w);for(let xe of Ie?[1,-1]:[-1,1]){let Gt=xe>0?1:0;if(ht(ye(Gt),w)<C)continue;let ce=et,Se=Gt;for(let he=0;he<20;he++){let Oe=(ce+Se)/2;ht(ye(Oe),w)>=C?Se=Oe:ce=Oe}return ye(Se)}return null},gt={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>'},Mt=L=>`${L.toFixed(1).replace(/\.0$/,"")} : 1`,Q="",se=null,jt=!1,Rt=L=>{L!==se&&(se=L,jt=!1),Q="";let w=L.getBoundingClientRect(),C=(L instanceof HTMLInputElement||L instanceof HTMLTextAreaElement)&&!L.value&&!!L.placeholder,q=getComputedStyle(L,C?"::placeholder":null),F=parseFloat(q.fontSize),wt=F>=24||F>=18.66&&Number(q.fontWeight)>=700,$t=be(L),ot=ft=>`<i class="dt-type-sw" style="background:${ft}"></i>`,et;if(!L.textContent?.trim()&&!C&&!(L instanceof HTMLInputElement&&L.value))et='<p class="dt-ct-note">Point at some text.</p>';else if(!$t)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 ft=ne(Et(q.color),$t),Nt=ht(ft,$t),ye=wt?3:4.5,Ie=Nt>=7?["ok",gt.ok+"AAA"]:Nt>=4.5?["ok",gt.ok+"AA"]:Nt>=3?["warn","Large text only"]:["bad","Fails"],xe=`<div class="dt-ct-ratio"><b>${Mt(Nt)}</b><span class="dt-ct-chip dt-ct-chip--${Ie[0]}">${Ie[1]}</span></div>`;if(Nt>=7){et=xe,n.innerHTML=H(w)+y(L,w,C?" \xB7 placeholder":"")+Yn(w,41,`<div class="dt-ct-card dt-ct-card--one">${et}</div>`);return}let Gt=(Se,he)=>`<div class="dt-ct-check">${Nt>=he?gt.ok:gt.x}<span>${Se}</span><em>${Mt(he).replace(".0","")}</em></div>`,ce=Nt>=ye?null:Ht(ft,$t,ye);ce&&(Q=At(ce)),et=`<div class="dt-ct-pair"><div><span>Text</span><b>${ot(At(ft))}${At(ft)}</b></div><div><span>Background</span><b>${ot(At($t))}${At($t)}</b></div></div>`+xe+Gt("Body text \xB7 AA",4.5)+Gt("Large text \xB7 AA",3)+Gt("Body text \xB7 AAA",7)+(Q?jt?`<div class="dt-ct-fix dt-ct-fix--done">${gt.ok}<span>Copied ${Q}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${ot(Q)}${Q}</b>${gt.copy}</div>`:"")}let ct=`<div class="dt-ct-card"><div class="dt-ct-head">${gt.half}<span>Contrast</span></div>${et}</div>`;n.innerHTML=H(w)+y(L,w,C?" \xB7 placeholder":"")+Yn(w,210,ct)},Yn=(L,w,C)=>{let q=L.bottom+w+12<innerHeight?L.bottom+8:Math.max(8,L.top-w-8),F=Math.min(Math.max(8,L.left),innerWidth-260);return C.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${F}px;top:${q}px"`)};return{spacer:b,drawPads:T,drawSize:x,drawType:S,drawColor:$,drawBorder:I,drawContrast:Rt,contrastFix:()=>Q,markCopied:()=>{jt=!0}}}var ie=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),Uc=(n,r,u=!1)=>{for(let m=r*4;;m*=4){let g=u?ie(n.slice(0,m)).replace(/\s+/g," "):ie(n.slice(0,m));if(g.length>=r||m>=n.length)return g}},Os=(n,r,u=!1)=>Zt(Uc(n,r,u),r),Yc='[class^="dt-"],[class*=" dt-"],.devtools',Tn=n=>{let r=n;for(;r.parentElement&&r.parentElement!==document.body;)r=r.parentElement;return r.parentElement===document.body&&r.matches(Yc)};function Xc(){let n=(S,k)=>S?[...S.children].filter(W=>W.tagName.toUpperCase()===k.toUpperCase()&&!(S===document.body&&W.matches(Yc))):[],r=S=>{let k=[],W=S;for(;W&&W.tagName!=="HTML"&&k.length<8;){if(W.id){k.unshift("#"+CSS.escape(W.id));break}let U=W.parentElement,$=W.tagName.toLowerCase(),I=n(U,W.tagName),ht=U===document.body&&I.length>1?[...W.classList].find(At=>/^[\w-]+$/.test(At)&&I.filter(Ht=>Ht.classList.contains(At)).length===1):void 0;k.unshift(ht?`${$}.${ht}`:I.length>1?`${$}:nth-of-type(${I.indexOf(W)+1})`:$),W=U}return k.join(">")},u=S=>{let k=S.split(">"),W=null;for(let[U,$]of k.entries()){if($.startsWith("#")){if(U)return null;W=document.querySelector($);continue}let I=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec($);if(!I)return document.querySelector(S);if(!W){if(I[1]!=="body"||I[2]||I[3])return document.querySelector(S);W=document.body;continue}let ht=n(W,I[1].toUpperCase());if(W=(I[2]?ht.find(At=>At.classList.contains(I[2])):ht[I[3]?Number(I[3])-1:0])??null,!W)return null}return W},m=S=>S.replace(/\s+/g," ").trim(),g=(S,k)=>{if(!k)return!0;let W=Uc(S.textContent||"",60),U=m(k);return m(Zt(W,60))===U||m(W.slice(0,60))===U},b=(S,k)=>[S||"*",...(k||[]).map(W=>"."+CSS.escape(W))].join(""),E=S=>{try{return[...document.querySelectorAll(b(S.tag,S.classes))].filter(k=>!Tn(k))}catch{return[]}},H=S=>{for(let k of S.classes??[]){let W=E({tag:S.tag,classes:[k]});if(W.length)return W}return E({tag:S.tag}).slice(0,400)},T=S=>{let k=S.textContent||"",W=null;for(let U=S.parentElement,$=0;U&&U!==document.body&&$<4;U=U.parentElement,$++){let I=U.textContent||"";if(I===k)continue;let ht=Os(I,80,!0);if(ht&&(ht!==Os(k,80,!0)||(W??=ie(k).replace(/\s+/g," "),ie(I).replace(/\s+/g," ")!==W)))return ht}return""},x=S=>T(S),D=(S,k,W=120)=>Zt(ie(S.getAttribute(k)),W)||void 0,dt=S=>{for(let k=S.parentElement,W=0;k&&k!==document.body&&W<4;k=k.parentElement,W++){let U=k.querySelector("h1,h2,h3,h4,h5,h6,[role=heading]");if(U&&U!==S&&!S.contains(U))return Os(U.textContent||"",60,!0)||void 0}},J=S=>{let k=W=>W?Os(W.textContent||"",30,!0):"";return(k(S.previousElementSibling)+"|"+k(S.nextElementSibling)).replace(/^\|$/,"")||void 0},tt=/^data-(testid|test-id|test|qa|cy|id|key|slug|name|item)$/,O=S=>{let k=[...S.attributes].find(U=>tt.test(U.name)&&U.value),W=(S.getAttribute("src")||S.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)||void 0;return Object.fromEntries(Object.entries({id:S.id?Zt(S.id,80):void 0,data:k?`${k.name}=${Zt(k.value,80)}`:void 0,aria:D(S,"aria-label"),alt:D(S,"alt"),title:D(S,"title"),src:W,href:D(S,"href"),head:dt(S),sib:J(S)}).filter(([,U])=>U))},St=(S,k)=>!k||T(S).startsWith(k),zt=new WeakMap,Tt=S=>zt.get(S)??"found",it=S=>{let k=S.fp,W=null;try{W=u(S.selector)}catch{}let U=E(S),$=U.length?U:H(S),I=new Set($.slice(0,400));if(W&&!Tn(W)&&I.add(W),k.id){let gt=document.getElementById(k.id);gt&&I.add(gt)}if(k.data){let[gt,Mt]=k.data.split(/=(.*)/s);try{document.querySelectorAll(`[${gt}="${CSS.escape(Mt)}"]`).forEach(Q=>I.add(Q))}catch{}}let ht=null,At=null,Ht=0;for(let gt of I){if(Tn(gt))continue;let Mt=k.id&&gt.id===k.id||k.data&&gt.getAttribute(k.data.split("=")[0])===k.data.split(/=(.*)/s)[1]?35:0,Q=ie(S.label)&&g(gt,S.label)||k.aria&&D(gt,"aria-label")===k.aria||k.alt&&D(gt,"alt")===k.alt||k.title&&D(gt,"title")===k.title||k.href&&D(gt,"href")===k.href||k.src&&(gt.getAttribute("src")||gt.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)===k.src?25:0,se=k.head&&dt(gt)===k.head||k.sib&&J(gt)===k.sib||S.ctx&&T(gt).startsWith(S.ctx)?15:0,jt=Mt+Q+se,Rt=jt+(gt===W?40:0)+(S.nth!=null&&$[S.nth]===gt?5:0);jt||(Rt=Math.min(Rt,39)),Q&&(Ht++,At={el:gt,score:Rt}),(!ht||Rt>ht.score)&&(ht={el:gt,score:Rt})}return At&&Ht===1&&At.score<40&&(!ht||ht.score<40)?{el:At.el,score:40}:ht},yt=S=>{let k=Ft(S),W=null;if(k){try{W=u(S.selector)}catch{}return zt.set(S,k===W?"found":"moved"),k}let U=S.fp?it(S):null;return U&&U.score>=40?(zt.set(S,U.score>=70?"moved":"probably"),U.el):(zt.set(S,"gone"),null)},Ft=S=>{let k=null;try{k=u(S.selector)}catch{k=null}if(k&&Tn(k)&&(k=null),k&&g(k,S.label)&&St(k,S.ctx))return k;let W=E(S),U=W.length?W:H(S),$=ie(S.label)?U.filter(Ht=>g(Ht,S.label)):[],I=(S.ctx?$.find(Ht=>St(Ht,S.ctx)):$.length===1?$[0]:void 0)??(S.ctx&&!ie(S.label)?W.find(Ht=>St(Ht,S.ctx)):void 0);if(I)return I;if(S.ctx&&$.length===1&&m(ie(S.label)).length>=20)return $[0];let ht=Ht=>Ht.split(">").slice(0,2).join(">"),At=Ht=>!S.ctx&&ht(r(Ht))===ht(S.selector);return ie(S.label)?k&&!S.ctx&&g(k,S.label)?k:$.length===1&&At($[0])?$[0]:null:k||(S.nth!=null?W[S.nth]??null:null)},Wt=S=>{let k=null;for(let W=S,U=S.parentElement;U&&U!==document.body&&getComputedStyle(W).position!=="fixed";W=U,U=U.parentElement){let $=getComputedStyle(U);if($.overflowX==="visible"&&$.overflowY==="visible")continue;let I=U.getBoundingClientRect();k=k?{l:Math.max(k.l,I.left),t:Math.max(k.t,I.top),r:Math.min(k.r,I.right),b:Math.min(k.b,I.bottom)}:{l:I.left,t:I.top,r:I.right,b:I.bottom}}return k},Et=S=>{let k=S.getBoundingClientRect();return(k.width>0||k.height>0)&&(!S.checkVisibility||S.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},ne=S=>({...S,x:Math.min(Math.max(S.x,3),document.documentElement.clientWidth-30),y:S.y>=0&&S.y<19?19:S.y}),be=(S,k)=>{let W=k;for(let U=k.parentElement;U&&U!==document.body;U=U.parentElement){if(!Et(U)){W=U;continue}let $=k.getBoundingClientRect();if($.width||$.height)return ne({x:$.left+$.width*S.rx,y:$.top+$.height*S.ry,el:k,hidden:U,shut:W});let I=U.getBoundingClientRect();return ne({x:I.left,y:I.top,el:k,hidden:U,shut:W})}return null},re=S=>{let k=S.opener?Ft(S.opener):null;if(!k||!Et(k))return null;let W=k.getBoundingClientRect();return ne({x:W.right-4,y:W.top+4,el:k,opener:k})};return{cssPath:r,poolOf:E,contextOf:x,resolveEl:yt,anchorOf:(S,k=yt(S))=>{if(!k)return re(S);if(!Et(k))return re(S)??be(S,k);let W=k.getBoundingClientRect(),U=W.left+W.width*S.rx,$=W.top+W.height*S.ry,I=Wt(k);return I?U<I.l||U>I.r||$<I.t||$>I.b?null:{x:U,y:$,el:k}:{x:U,y:$,el:k}},anchorState:Tt,fingerprintOf:O}}var Jc=(n,r)=>`<svg class="dt-bars" viewBox="0 0 18 11" width="18" height="11" aria-hidden="true">${[0,1,2,3].map(u=>`<rect x="${u*5}" y="${6-u*2}" width="3" height="${5+u*2}" rx="1" fill="${u<n?r:"#fff"}" stroke="none"${u<n?"":' opacity="0.12"'}/>`).join("")}</svg>`;function Zc(n,r,u){let m=document.createElement("div");m.className="dt-field-menu",m.setAttribute("role","listbox"),m.hidden=!0,document.body.append(m);for(let E of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])m.addEventListener(E,H=>H.stopPropagation());let g=null,b=()=>{m.hidden=!0,g=null};for(let E of n)E.addEventListener("mousedown",H=>{let y=H.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select");if(!y){m.contains(H.target)||b();return}if(H.preventDefault(),g===y){b();return}g=y;let T=y.classList.contains("dt-more-select"),x=O=>T?O.dataset.on!=null:O.selected,D=y.dataset.search;m.innerHTML=(D?`<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="${r(D)}" aria-label="${r(D)}" spellcheck="false"></label>`:"")+[...y.options].map((O,St)=>O.hidden?"":O.dataset.head!=null?`<p class="dt-field-head">${r(O.text)}${O.dataset.note?`<small>${r(O.dataset.note)}</small>`:""}</p>`:`${O.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${St}" aria-selected="${x(O)}"${O.disabled?" disabled":""}${O.dataset.hint?` data-tip="${r(O.dataset.hint)}" data-hint="${r(O.dataset.hint.toLowerCase())}"`:""}${O.dataset.danger!=null?' class="is-danger"':""}>${O.dataset.icon?O.dataset.icon:O.dataset.initial!=null?O.dataset.face?`<img class="dt-face" src="${r(O.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${r(O.dataset.initial)}</b>`:O.dataset.bare!=null?"":`<i style="background:${r(O.dataset.c||"#717171")}"></i>`}<span>${r(O.text)}</span>${O.dataset.note?`<small>${r(O.dataset.note)}</small>`:""}${x(O)?u:""}</button>${O.dataset.sepAfter!=null?"<hr>":""}`).join("")+(D?'<p class="dt-field-none" hidden></p>':""),m.classList.toggle("is-people",!!D);let dt=y.parentElement.getBoundingClientRect(),J=D?y.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;m.style.left=`${J?J.left+4:dt.left}px`,m.style.top=`${dt.bottom+4}px`,m.style.minWidth=`${J?J.width-8:Math.max(200,dt.width)}px`,m.style.width=J?`${J.width-8}px`:"",m.hidden=!1;for(let O of m.querySelectorAll("[data-hint]")){let St=O.querySelector("span");St.scrollWidth>St.clientWidth&&(O.dataset.tip=`${St.textContent} \xB7 ${O.dataset.tip}`)}let tt=m.getBoundingClientRect();(tt.bottom>innerHeight-8||D&&y.closest(".dt-note"))&&(m.style.top=`${Math.max(8,dt.top-4-tt.height)}px`),tt.right>innerWidth-8&&(m.style.left=`${Math.max(8,dt.right-tt.width)}px`),m.querySelector(".dt-field-search input")?.focus()});m.addEventListener("input",E=>{let H=E.target.value.trim().toLowerCase(),y=0;for(let x of m.querySelectorAll("[data-i]"))x.hidden=!!H&&!x.textContent.toLowerCase().includes(H)&&!x.dataset.hint?.includes(H),x.hidden||y++;for(let x of m.querySelectorAll("hr"))x.hidden=!!H;let T=m.querySelector(".dt-field-none");T&&(T.hidden=y>0,T.textContent=`No one matches \xAB${E.target.value.trim()}\xBB`)}),m.addEventListener("keydown",E=>{E.key!=="Enter"||!E.target.matches("input")||(E.preventDefault(),m.querySelector("[data-i]:not([hidden])")?.click())}),m.addEventListener("click",E=>{let H=E.target.closest("[data-i]");if(!H||!g)return;let y=g;b(),!(y.selectedIndex===Number(H.dataset.i)&&!y.classList.contains("dt-more-select"))&&(y.selectedIndex=Number(H.dataset.i),y.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",E=>{E.key==="Escape"&&!m.hidden&&(E.stopPropagation(),b())},!0),document.addEventListener("pointerdown",E=>{!m.hidden&&!m.contains(E.target)&&!E.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select")&&b()},!0),addEventListener("scroll",E=>{m.contains(E.target)||b()},!0)}var Kn=()=>!matchMedia("(prefers-reduced-motion: reduce)").matches,An=n=>Promise.allSettled(n.getAnimations({subtree:!0}).filter(r=>r.effect?.getComputedTiming().iterations!==1/0).map(r=>r.finished)),xo=new WeakMap,Un=(n,r)=>{let u=xo.has(n);xo.set(n,r),!u&&(n.setAttribute("data-leaving",""),An(n).then(()=>{let m=xo.get(n);m&&(xo.delete(n),n.removeAttribute("data-leaving"),m())}))},Eo=n=>{xo.delete(n),n.removeAttribute("data-leaving")},Qc=n=>{let r=n.cloneNode(!0);for(let u of["id","data-id","data-draft","data-parked"])r.removeAttribute(u);r.setAttribute("data-ghost",""),r.setAttribute("aria-hidden","true"),r.inert=!0,n.after(r),An(r).then(()=>r.remove())},Mo=(n,r)=>{n.removeAttribute("data-nudge"),n.offsetWidth,n.setAttribute("data-nudge",r),An(n).then(()=>{n.getAttribute("data-nudge")===r&&n.removeAttribute("data-nudge")})},tu=n=>{let r=getComputedStyle(document.documentElement).getPropertyValue(n).trim(),u=r.indexOf(" ");return{duration:parseFloat(r)*(/^[\d.]+s$/.test(r.slice(0,u))?1e3:1),easing:r.slice(u+1)}},Na=(n,r,u=1/0)=>{let m=n.hidden?0:Math.min(n.offsetHeight,u),g=n.hidden?"0":getComputedStyle(n).opacity;n.getAnimations().forEach(y=>y.cancel()),n.hidden=!1;let b=r?Math.min(n.scrollHeight,u):0,E=()=>{n.hidden=!r};if(!Kn()||m===b)return E();let H=n.animate([{height:`${m}px`,opacity:g,overflow:"hidden"},{height:`${b}px`,opacity:r?1:0,overflow:"hidden"}],{...tu(r?"--dt-smooth":"--dt-snappy"),fill:"forwards"});H.onfinish=()=>{E(),H.cancel()}},Mr=(n,r,u,m,g)=>{if(n.getAnimations().forEach(E=>E.cancel()),!Kn()||Math.abs(r-u)<1)return g();let b=n.animate([{height:`${r}px`,overflow:"hidden"},{height:`${u}px`,overflow:"hidden"}],{...tu(m?"--dt-smooth":"--dt-snappy"),fill:"forwards"});b.onfinish=()=>{g(),b.cancel()}};var nh=".devtools, [class^='dt-'], [class*=' dt-']",sh=300,eu=null,nu=n=>{eu=n};function su(){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 r=null,u,m=0,g=T=>{let x=T.getAttribute("title");x!==null&&(T.removeAttribute("title"),T.hasAttribute("data-tip")||T.setAttribute("data-tip",x),!T.hasAttribute("aria-label")&&!T.textContent?.trim()&&T.setAttribute("aria-label",x))},b=T=>{let x=T?.closest?.("[data-tip], [title]");return x&&x.closest(nh)&&!x.closest(".dt-tipbox")?x:null},E=T=>{let x=T.getAttribute("data-tip");if(!x||T.getAttribute("aria-expanded")==="true")return H();let D=eu?.(T);n.classList.toggle("is-peek",!!D),D?n.innerHTML=D:n.textContent=x,Eo(n),n.hidden=!1,n.style.left="0px",n.style.top="0px";let dt=T.getBoundingClientRect(),J=n.getBoundingClientRect(),tt=6,O=8;if(D){let zt=dt.right+8+J.width<=innerWidth-O;n.style.left=`${zt?dt.right+8:Math.max(O,dt.left-8-J.width)}px`,n.style.top=`${Math.min(Math.max(O,dt.top-4),innerHeight-O-J.height)}px`,T.setAttribute("aria-describedby",n.id);return}let St=dt.bottom+tt+J.height<=innerHeight-O;n.style.top=`${St?dt.bottom+tt:Math.max(O,dt.top-tt-J.height)}px`,n.style.left=`${Math.min(Math.max(O,dt.left+dt.width/2-J.width/2),innerWidth-O-J.width)}px`,n.classList.toggle("is-mono",T.classList.contains("dt-note-el")),T.setAttribute("aria-describedby",n.id)},H=()=>{clearTimeout(u),r&&!n.hidden&&(m=performance.now()+400),r?.removeAttribute("aria-describedby"),r=null,n.hidden||Un(n,()=>{n.hidden=!0})},y=T=>{T!==r&&(H(),g(T),r=T,performance.now()<m?E(T):u=setTimeout(()=>r===T&&E(T),sh))};document.addEventListener("pointerover",T=>{let x=b(T.target);x?y(x):r&&!r.contains(T.target)&&H()},!0),document.addEventListener("pointerout",T=>{r&&!r.contains(T.relatedTarget)&&H()},!0),document.addEventListener("focusin",T=>{let x=T.target,D=b(x);D&&x.matches(":focus-visible")&&y(D)},!0),document.addEventListener("focusout",H,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("keydown",T=>{T.key==="Escape"&&H()},!0),addEventListener("scroll",H,!0),new MutationObserver(()=>{r&&(!r.isConnected||r.getAttribute("aria-expanded")==="true")&&H()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-expanded"]})}var pt={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>'},kr=(n,r)=>n.toLocaleTimeString("en-US",r),Ba=n=>kr(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),oh={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 ah(n,r,u,m,g){let b=n.w+2*r.side,E=n.h+r.top+r.bottom,H=(u-b)/2,y=`<rect class="dt-shell-screen" x="${g}" y="${r.top}" width="${n.w}" height="${n.h}" rx="${r.r}"/>`,T="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let x=(D,dt,J)=>`<rect class="dt-shell-btn" x="${D}" y="${dt}" width="4" height="${J}" rx="2"/>`;T+=n.shell==="punch"?x(H+b-1,150,70)+x(H+b-1,240,44):x(H-3,120,28)+x(H-3,170,56)+x(H-3,236,56)+x(H+b-1,190,90),T+=`<rect class="dt-shell-body" x="${H}" y="0" width="${b}" height="${E}" rx="${r.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${b-6}" height="${E-6}" rx="${r.body-3}"/>`,n.shell==="home"&&(T+=`<rect class="dt-shell-slot" x="${u/2-26}" y="44" width="52" height="6" rx="3"/>`,T+=`<circle class="dt-shell-slot" cx="${u/2-48}" cy="47" r="5"/>`,T+=`<circle class="dt-shell-homebtn" cx="${u/2}" cy="${E-46}" r="28"/>`)}else if(n.shell==="tablet")T+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${b}" height="${E}" rx="${r.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${b-8}" height="${E-8}" rx="${r.body-4}"/>`;else if(n.shell==="monitor"){let x=Math.round(b*.1);T+=`<path class="dt-shell-stand" d="M${u/2-x/2} ${E-2}h${x}l${x*.2} 84h${-x*1.4}z"/>`,T+=`<rect class="dt-shell-stand" x="${u/2-b*.15}" y="${E+80}" width="${b*.3}" height="14" rx="7"/>`,T+=`<rect class="dt-shell-body" x="${H}" y="0" width="${b}" height="${E}" rx="${r.body}"/>`}else{let x=b+(r.extraW??0),D=(u-x)/2,dt=r.extraH??16;T+=`<path class="dt-shell-body" d="M${H} ${r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${-r.body}h${b-2*r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${r.body}V${E}H${H}z"/>`,T+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${D} ${E}h${x}v${dt-8}a8 8 0 0 1-8 8H${D+8}a8 8 0 0 1-8-8z"/>`,T+=`<rect class="dt-shell-lip" x="${u/2-b*.07}" y="${E}" width="${b*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${u} ${m}" width="${u}" height="${m}" aria-hidden="true">${T}${y}</svg>`}var ih={"safari-ios":n=>{let r=n.shell==="home"?20:n.w>=400?62:59;return{top:r,bottom:98,topMin:r,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})},rh=({d:n,now:r,cutout:u},m)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${m}px"><span class="dt-sb-l">${pt.signal}${pt.wifi}</span><b>${Ba(r)}</b><span class="dt-sb-r">${pt.battery}</span></div>`;let g=u??{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">${Ba(r)}</b><span class="dt-sb-icons" style="top:${g.y}px;height:${g.height}px">${pt.signal}${pt.wifi}${pt.battery}</span></div>`},lh=({d:n,host:r,min:u},m)=>{let g=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return u?`<div class="dt-ios-bar is-min" style="height:${m}px"><span class="dt-ios-mini">${f(r)}</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">${pt.back}</button><span class="dt-glass dt-ios-url"><span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-glass dt-glass--round">${pt.dots}</span></div>${g}</div>`},dh=({now:n,min:r},u)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${kr(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${pt.wifi}${pt.signal}${pt.battery}</span></div>`+(r?"":`<div class="dt-and-bar"><span class="dt-and-url">${pt.tune}<span>${f(u)}</span></span><span class="dt-and-tabs">1</span>${pt.dotsV}</div>`),ch=()=>`<div class="dt-and-nav">${pt.recent}${pt.home}${pt.navBack}</div>`,uh=({now:n,host:r})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Ba(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${pt.wifi}${pt.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${pt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${pt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${pt.fwd}</button></span><span class="dt-ipad-url">${pt.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-bar-group">${pt.share}${pt.plus}${pt.tabs}</span></div>`,ph=({now:n,host:r},u)=>'<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>'+(u?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${pt.wifi}${pt.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})}&nbsp; ${Ba(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">${pt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${pt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${pt.fwd}</button></span><span class="dt-mac-url">${pt.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-bar-group">${pt.share}${pt.plus}${pt.tabs}</span></div>`,mh=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,r)=>`<i style="--hue:${r*40}"></i>`).join("")}</span></div>`,hh=({host:n,title:r})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${f(r||n)}</span>${pt.close}</span><span class="dt-win-new">${pt.plus}</span><span class="dt-win-ctrl">${pt.winMin}${pt.winMax}${pt.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${pt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${pt.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-win-url">${pt.tune}<span>${f(n)}</span>${pt.star}</span><span class="dt-bar-group">${pt.user}${pt.dotsV}</span></div>`,gh=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(r,u)=>`<i style="--hue:${200+u*30}"></i>`).join("")}</span><span class="dt-win-tray">${pt.chevUp}${pt.wifi}${pt.volume}${pt.battery}<span class="dt-win-clock">${kr(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function ou(n,r){let u=oh[n.shell](n),m=n.w+2*u.side,g=n.h+u.top+u.bottom,b=m+(u.extraW??0),E=g+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?u.extraH??0:0),H=(b-m)/2+u.side,y=ih[n.browser](n),T=r.min?y.topMin??y.top:y.top,x=r.min?y.bottomMin??y.bottom:y.bottom,D={...r,d:n},dt="",J="";switch(n.browser){case"safari-ios":dt=rh(D,T),J=lh(D,x);break;case"chrome-android":dt=dh(D,r.host),J=ch();break;case"safari-ipad":dt=uh(D),J='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":dt=ph(D,n.shell==="macbook"),J=mh();break;case"chrome-windows":dt=hh(D),J=gh(D);break}return{footprint:{w:b,h:E},screen:{x:H,y:u.top,w:n.w,h:n.h,r:u.r,rb:u.rb??u.r},topH:T,bottomH:x,shell:ah(n,u,b,E,H),top:dt,bottom:J,canMinimize:y.topMin!==void 0&&(y.topMin!==y.top||y.bottomMin!==y.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var ms=null;function Lo(n){if(ms??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!ms||!n)return[0,0,0,0];ms.clearRect(0,0,1,1),ms.fillStyle="rgba(0, 0, 0, 0)",ms.fillStyle=n,ms.fillRect(0,0,1,1);let[r,u,m,g]=ms.getImageData(0,0,1,1).data;return[r,u,m,g/255]}var ko=([n,r,u])=>`rgb(${n}, ${r}, ${u})`;function au(n){let r=n.defaultView,u=J=>!J||Lo(J)[3]===0,m=[n.body,n.documentElement].map(J=>J&&r.getComputedStyle(J).backgroundColor).find(J=>J&&!u(J)),[g,b,E,H]=m?Lo(m):[255,255,255,1],y=[g,b,E].map(J=>Math.round(J*H+255*(1-H))),T=J=>{let[tt,O,St,zt]=Lo(J);if(zt>=.75)return ko([tt,O,St]);let Tt=(it,yt)=>Math.round(it*zt+yt*(1-zt));return ko([Tt(tt,y[0]),Tt(O,y[1]),Tt(St,y[2])])},x=J=>{let tt=n.elementFromPoint(r.innerWidth/2,J);for(;tt&&tt!==n.documentElement;tt=tt.parentElement){let O=r.getComputedStyle(tt);if(O.position!=="fixed"&&O.position!=="sticky")continue;let St=tt.getBoundingClientRect().width>=r.innerWidth*.9,zt=O.backdropFilter&&O.backdropFilter!=="none";return St&&!zt&&!u(O.backgroundColor)?T(O.backgroundColor):null}return null},D=n.querySelector('meta[name="theme-color"]')?.content||"",dt=D&&!u(D)?ko(Lo(D)):"";return{top:x(4)??ko(y),bottom:x(r.innerHeight-4)??ko(y),theme:dt}}function Lr(n){let[r,u,m]=Lo(n).map(g=>g/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4);return .2126*r+.7152*u+.0722*m>.4?"#000":"#fff"}function iu(n){let{cfg:r,inFrame:u,persist:m,frame:g,frameEl:b,devicesMenu:E,bpBtns:H,notesOverlay:y,WIDE:T,bpOf:x,currentBp:D,deviceById:dt,notesOn:J,filter:tt,filterTo:O,dropFrameDrafts:St,putAway:zt,tellFrame:Tt,syncBpButtons:it,render:yt,reread:Ft}=n,Wt=r.breakpoints,Et=document.querySelector(".dt-device"),ne=document.querySelector(".dt-shell"),be=document.querySelector('.dt-chrome[data-at="top"]'),re=document.querySelector('.dt-chrome[data-at="bottom"]'),me=document.querySelector(".dt-ruler"),S=[...document.querySelectorAll(".dt-frame-handle")],k=document.querySelector(".dt-frame-size"),W=document.querySelector(".dt-frame-rotate"),U=document.querySelector(".dt-frame-bars"),$="overlay",I="",ht="dt-w",At="dt-canvas",Ht="dt-device",gt=mt.getItem(At)==="1",Mt=mt.getItem(Ht)||"";Mt&&!dt(Mt)&&(Mt="",mt.setItem(Ht,""));let Q=Number(mt.getItem(ht))||0,se="dt-emu",jt=(()=>{try{return JSON.parse(mt.getItem(se)||"null")}catch{return null}})(),Rt=()=>jt?wo.find(B=>B.id===jt.id)??null:null,Yn=()=>{let B=Rt();return B?jt.turned?{w:B.h,h:B.w}:{w:B.w,h:B.h}:null},cn=mt.getItem("dt-bars-min")==="1",Le=B=>{jt=B,m(se,B?JSON.stringify(B):"")},L=B=>{k.textContent=B,g.style.setProperty("--dt-badge-w",`${k.offsetWidth}px`)},w=B=>{if(!B){me.innerHTML="";return}let P="";for(let Y=0;Y<=B;Y+=50)P+=`<span class="dt-tick${Y%200===0?" is-major":""}" style="left:${Y}px"></span>`;for(let Y of Wt)for(let Pt of[Y.min,Y.max])Pt>0&&Number.isFinite(Pt)&&Pt<=B&&(P+=`<span class="dt-edge" style="left:${Pt}px" title="${Y.label} edge"></span>`);me.innerHTML=P,me.style.width=`${B}px`},C=()=>{let B=parseFloat(Et.style.width)||0,P=parseFloat(Et.style.height)||0;if(!B||!P){Et.style.transform="",delete Et.dataset.scaled;return}let Y=Mt||jt?Math.min(1,(innerWidth-80)/B,(innerHeight-120)/P):Math.min(1,(innerWidth-80)/B);Et.style.transform=Y<1?`scale(${Y})`:"",Et.dataset.scaled=Y<1?String(Math.round(Y*100)):""},q=B=>wo.find(P=>P.w===B.w&&P.h===B.h&&P.cutout?.shape==="pill")?.cutout,F=()=>{try{return b.contentDocument}catch{return null}},wt=()=>F()?.title.split("\u2014").pop()?.trim()||"",$t=()=>{let B=F(),P=Mt?dt(Mt):null;if(!B?.body||!P)return;let Y=au(B),Pt=P.browser==="chrome-android"?Y.theme||"rgb(255, 255, 255)":Y.top,Yt=P.browser==="chrome-android"?"rgb(255, 255, 255)":Y.bottom;Et.style.setProperty("--dt-top",Pt),Et.style.setProperty("--dt-top-ink",Lr(Pt)),Et.style.setProperty("--dt-bottom",Yt),Et.style.setProperty("--dt-bottom-ink",Lr(Yt));let ve=be.querySelector(".dt-win-tab > span");ve&&(ve.textContent=wt()||location.host)},ot=0;b.addEventListener("load",()=>{let B=F();if(!B)return;let P=window.__notemendHosted;if(P&&!b.contentWindow?.__notemendHosted&&!B.querySelector(`script[src^="${P.base}/bar.js"]`)){let Y=B.createElement("script");Y.src=`${P.base}/bar.js`,Y.dataset.project=P.project,B.head.append(Y)}$t(),b.contentWindow?.addEventListener("scroll",()=>{ot||(ot=requestAnimationFrame(()=>{ot=0,$t()}))},{passive:!0})});for(let B of[be,re])B.addEventListener("click",P=>{let Y=P.target.closest("[data-nav]")?.dataset.nav;if(Y)try{let Pt=b.contentWindow?.navigation;if(!F()||!Pt)throw new Error("foreign");Y==="back"?Pt.canGoBack&&Pt.back():Y==="fwd"?Pt.canGoForward&&Pt.forward():Pt.reload()}catch{(Y==="reload"||Y==="back")&&(b.src=location.href)}});U.addEventListener("click",()=>{cn=!cn,m("dt-bars-min",cn?"1":"0"),ft()});let et=[],ct=B=>{for(let P of et)P.inert=!1;et=B?[...document.body.children].filter(P=>P instanceof HTMLElement&&!P.inert&&!P.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let P of et)P.inert=!0},ft=()=>{if(u)return;let B=Mt?dt(Mt)??null:null;if(Mt&&!B&&(Mt="",mt.setItem(Ht,"")),!B&&!gt){let P="";try{let Y=b.getAttribute("src")?b.contentWindow?.location:null;Y?.origin===location.origin&&(P=Y.pathname+Y.search+Y.hash)}catch{}if(g.hidden=!0,ct(!1),b.removeAttribute("src"),ee.toggle("dt-framing",!1),y.hidden=!J(),me.innerHTML="",it(),W.hidden=!0,U.hidden=!0,O(null),I="",St(),it(),Se(),P&&P!==location.pathname+location.search+location.hash){location.assign(P);return}Ft();return}if(g.hidden=!1,ct(!0),ee.toggle("dt-framing",!0),y.hidden=!0,b.src||(b.src=location.href),B){let P=ou(B,{host:location.host,title:wt(),now:new Date,min:cn,cutout:q(B)}),{screen:Y}=P;g.dataset.mode="device",Et.dataset.shell=B.shell,Et.dataset.browser=B.browser,Et.style.width=`${P.footprint.w}px`,Et.style.height=`${P.footprint.h}px`,Et.style.setProperty("--dt-r",`${Y.r}px`),Et.style.setProperty("--dt-rb",`${Y.rb}px`),ne.innerHTML=P.shell;let Pt=(rt,ge,Xn,Jn)=>{rt.innerHTML=Jn,rt.style.cssText=`left:${Y.x}px;top:${ge}px;width:${Y.w}px;height:${Xn}px`};Pt(be,Y.y,P.topH,P.top),Pt(re,Y.y+Y.h-P.bottomH,P.bottomH,P.bottom);let Yt=Y.h-P.topH-P.bottomH;b.style.position="absolute",b.style.left=`${Y.x}px`,b.style.top=`${Y.y+P.topH}px`,b.style.width=`${Y.w}px`,b.style.height=`${Yt}px`,me.innerHTML="";let ve=cn&&P.canMinimize;$=P.scrollbar,I=`${B.label}${ve?" \xB7 bars folded":""}`,O(x(B.w)),Tt({notes:J(),scrollbar:$,device:I}),U.hidden=!P.canMinimize,U.setAttribute("aria-pressed",String(ve)),L(`${B.label} ${B.w}\xD7${B.h} \xB7 page ${B.w}\xD7${Yt}${ve?" \xB7 bars folded":""} \xB7 ${Wt.find(rt=>rt.id===tt())?.label??""}`),$t()}else{let P=Yn();P||Le(null);let Y=P?.w||Q||Wt.find(ve=>ve.id===D()).ideal;Q=Y,g.dataset.mode="canvas",delete Et.dataset.shell,delete Et.dataset.browser,ne.innerHTML=be.innerHTML=re.innerHTML="",be.style.cssText=re.style.cssText="",U.hidden=!0,$="overlay",Et.style.width=`${Y}px`,Et.style.height=`${P?.h??innerHeight-84}px`,b.style.position="",b.style.left=b.style.top="",b.style.width="100%",b.style.height="100%",w(Y),Tt({notes:J()});let Pt=Wt.find(ve=>ve.id===x(Y)),Yt=Rt();I=Yt?`${Yt.label}${jt?.turned?" \xB7 landscape":""}`:"",Tt({scrollbar:$,device:I}),L(Yt&&P?`${Yt.label} \xB7 ${P.w}\xD7${P.h} \xB7 ${Pt.label}`:`${Y}px \xB7 ${Pt.label}`),O(x(Y))}W.hidden=!(Rt()?.rotates&&!B),Se(),C(),it(),Ft()},Nt=B=>{let P=Wt.find(Y=>Y.id===B);Mt="",mt.setItem(Ht,""),Le(null),gt=D()!==B,Q=gt?P.ideal:0,O(gt?B:null),mt.setItem(At,gt?"1":"0"),mt.setItem(ht,String(Q)),zt(),ft()};for(let B of H)B.addEventListener("click",()=>Nt(B.dataset.bp));for(let B of document.querySelectorAll("[data-device]"))B.addEventListener("click",()=>{Mt=B.dataset.device===Mt?"":B.dataset.device,mt.setItem(Ht,Mt),E.open=!1,ft()});for(let B of document.querySelectorAll("[data-emu]"))B.addEventListener("click",()=>{let P=jt?.id===B.dataset.emu&&!Mt;Mt="",mt.setItem(Ht,""),Le(P?null:{id:B.dataset.emu,turned:!1}),gt=!P,Q=0,mt.setItem(At,gt?"1":"0"),O(null),zt(),E.open=!1,ft()});W.addEventListener("click",()=>{jt&&(Le({...jt,turned:!jt.turned}),zt(),ft())});let ye=[...E.querySelectorAll("[data-tab]")],Ie=[...E.querySelectorAll("[data-panel]")],xe=B=>{for(let P of ye)P.setAttribute("aria-selected",String(P.dataset.tab===B));for(let P of Ie)P.hidden=P.dataset.panel!==B;m("dt-devices-tab",B)};for(let B of ye)B.addEventListener("click",()=>xe(B.dataset.tab));xe(mt.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let Gt=E.querySelector(".dt-emu-search");Gt.addEventListener("input",()=>{let B=Gt.value.trim().toLowerCase(),P=null,Y=!1,Pt=()=>{P&&(P.hidden=!Y)};for(let Yt of Gt.parentElement.children){if(Yt.classList.contains("dt-devices-group")){Pt(),P=Yt,Y=!1;continue}Yt.dataset.emu&&(Yt.hidden=!!B&&!Yt.textContent.toLowerCase().includes(B),Y||=!Yt.hidden)}Pt()});let ce=E.querySelector(".dt-devices-name");function Se(){for(let P of E.querySelectorAll("[data-device]"))P.setAttribute("aria-pressed",String(P.dataset.device===Mt));let B=!Mt&&!g.hidden?jt?.id:void 0;for(let P of E.querySelectorAll("[data-emu]"))P.setAttribute("aria-pressed",String(P.dataset.emu===B));ce.textContent=Mt&&dt(Mt)?.label||B&&Rt()?.label||"Device"}let he=B=>Wt.find(P=>P.id===B),Oe=B=>{let P=he(tt()??D());return Math.max(P.min||320,Math.min(Number.isFinite(P.max)?P.max:2560,Math.round(B)))};for(let B of S){let P=B.dataset.edge==="l"?-1:1;B.addEventListener("pointerdown",Y=>{if(Mt)return;Y.preventDefault(),jt&&(Le(null),ft()),B.setPointerCapture(Y.pointerId);let Pt=Y.clientX,Yt=Q,ve=Number(Et.dataset.scaled||100)/100;g.dataset.dragging="1";let rt=Xn=>{Q=Oe(Yt+P*(Xn.clientX-Pt)*2/ve),Et.style.width=`${Q}px`,w(Q),L(`${Q}px \xB7 ${he(x(Q)).label}`),C()},ge=()=>{B.removeEventListener("pointermove",rt),B.removeEventListener("pointerup",ge),B.removeEventListener("pointercancel",ge),delete g.dataset.dragging,mt.setItem(ht,String(Q)),ft()};B.addEventListener("pointermove",rt),B.addEventListener("pointerup",ge),B.addEventListener("pointercancel",ge)}),B.addEventListener("dblclick",()=>{if(Mt)return;Le(null);let Y=he(tt()??D()),Pt=[Y.min||320,Number.isFinite(Y.max)?Y.max:Y.ideal];Q=Math.abs(Q-Pt[0])<Math.abs(Q-Pt[1])?Pt[0]:Pt[1],mt.setItem(ht,String(Q)),ft()})}let gs=D(),Hn=()=>{let B=Wt.find(P=>P.id===T);return gt&&!Mt&&!jt&&Q===B.ideal&&innerWidth>=B.min};return addEventListener("resize",()=>{if(Hn()){Nt(T);return}it(),D()!==gs&&(gs=D(),yt()),g.hidden||(!Mt&&!jt&&(Et.style.height=`${innerHeight-84}px`),C())}),{apply:ft,pickBp:Nt,look:()=>({scrollbar:$,device:I}),restore:()=>{Hn()?Nt(T):gt||Mt?ft():Se()}}}var ru='<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>',lu='<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>',fh='<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>',bh='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function du(n){let{bp:r,notes:u,breakpoints:m,bandOfNote:g,showResolved:b,showArchived:E,drafts:H,find:y}=n,T=u.filter($=>g($)===r),x=$=>[$.text,$.note,$.byName,...($.replies??[]).filter(I=>!I.deleted).map(I=>I.text)].join(" ").toLowerCase(),D=$=>y.view==="me"?n.forMe($):y.view==="agent"?n.forAgent($):!0,dt=$=>Date.parse($.updatedAt||$.createdAt||"")||0,J=$=>Date.parse($.createdAt||"")||0,tt=T.filter($=>D($)&&(!y.q||x($).includes(y.q.trim().toLowerCase()))).sort(($,I)=>y.sort==="old"?J($)-J(I):y.sort==="new"?J(I)-J($):(y.sort==="unread"?Number(n.unread(I))-Number(n.unread($)):0)||dt(I)-dt($)),O={open:[],claude:[],done:[],archived:[]};for(let $ of tt)O[Dt($)==="done"&&n.archived($)?"archived":Dt($)].push($);let St=$=>{let I=Dt($),ht=n.orphan($),At=n.unread($),Ht=n.picking&&n.pickable($),gt=!!Ht&&n.picking.has($.id),Mt=n.mirror($),Q=zn($.updatedAt||$.createdAt),se=Mt?`<i class="dt-hist-mirror"${Mt==="there"?` data-tip="In Team too \xB7 ${f(Q)}"`:' data-tip="A client\u2019s thread, mirrored into Team"'}>${fh}Mirrored</i>`:"";return`<div class="dt-hist-row is-${I}${I==="done"?n.archived($)?" is-archived":" is-resolved":""}${ht?" is-orphan":""}${At?" is-unread":""}${n.menuFor===$.id?" is-menu":""}${gt?" is-picked":""}${n.picking&&!Ht?` is-unpickable${Mt?" is-dim":""}`:""}">
208
- <button class="dt-hist-go" data-go="${$.id}" data-tip="${f($.text.slice(0,80))}"${Ht?` role="checkbox" aria-checked="${gt}"`:""}>
209
- ${Ht?`<span class="dt-hist-pick" aria-hidden="true"><i class="dt-hist-box">${gt?$e:""}</i></span>`:n.marker($)}
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)}
210
214
  <span class="dt-hist-body">
211
- <span class="dt-hist-id"><b class="dt-hist-who">${f($.byName||"You")}</b>${se}${Mt==="there"?"":`<em>\xB7 ${Q}</em>`}${At?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
212
- <span class="dt-hist-text">${f($c($.text||$.note))}</span>${n.replied($)}
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)}
213
217
  </span>
214
218
  </button>
215
- <span class="dt-note-tools dt-hist-tools">${n.tick($)}${n.assign($)}<button type="button" class="dt-hist-more" data-row-more="${$.id}" aria-label="More" aria-haspopup="menu" aria-expanded="${n.menuFor===$.id}">${ru}</button>${n.rowMenu($)}</span>
216
- </div>`},zt=m.map($=>{let I=u.filter(ht=>g(ht)===$.id&&Dt(ht)!=="done");return{band:$,open:I.filter(ht=>Dt(ht)==="open").length,total:I.length}}).filter($=>$.total&&$.band.id!==r),Tt=zt.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${zt.map(({band:$,open:I,total:ht})=>{let At=`${$.label}: ${I} open \xB7 ${ht-I} to check`;return`<button data-bp="${$.id}" data-state="${I?"open":"claude"}" title="${At}" aria-label="${At}"
217
- ><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${$.icon}</svg><i>${ht}</i></button>`}).join("")}</div>`:"",it=["open","claude","done","archived"],yt={..._c,archived:"Archived"},Ft=($,I,ht)=>`<button type="button" class="dt-hist-gfold" data-gfold="${$}" aria-expanded="${!n.shut($)}"
218
- >${Wt[$]??""}${I}<em>${ht}</em><svg class="dt-hist-chev" viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${n.shut($)?"m9 18 6-6-6-6":"m6 9 6 6 6-6"}"/></svg></button>`,Wt={open:Ve("#0d99ff",0),claude:Ve("#8e4ec6",.5),done:Ve("#30a46c",1),archived:Ve("#717171",1)},Et=n.cap,ne=it.filter($=>O[$].length&&($==="done"?b:$==="archived"?E:!0)),be=$=>`<div class="dt-hist-row is-draft">
219
- <button class="dt-hist-go" data-draft-go="${$.i}">
220
- ${n.draftFace||`<span class="dt-hist-n">${Gn}</span>`}
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}">
224
+ ${n.draftFace||`<span class="dt-hist-n">${es}</span>`}
221
225
  <span class="dt-hist-body">
222
- <span class="dt-hist-id">${n.draftFace?`<b class="dt-hist-who">${f(n.draftName)}</b><em>\xB7 draft \xB7 ${f($.el)}</em>`:f($.el)}${$.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
223
- <span class="dt-hist-text">${$.text?f($.text):`${$.shots} screenshot${$.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(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>
224
228
  </span>
225
- </button>${n.draftFace?`<span class="dt-hist-step" role="img" aria-label="Draft, not sent"><span class="dt-hist-n">${Gn}</span></span>`:""}
226
- <span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${$.i}" title="Discard this draft">${Vn}</button></span></span>
227
- </div>`,re=T.filter($=>Dt($)!=="done"),me=($,I,ht,At,Ht)=>`<button type="button" role="menuitemradio" aria-checked="${At}" ${$}="${I}"><i>${At?$e:""}</i><span>${ht}</span>${Ht==null?"":`<em>${Ht}</em>`}</button>`,S=()=>`<div class="dt-hist-find">
228
- <label class="dt-hist-search">${lu}<input type="search" data-hist-q placeholder="Search threads" aria-label="Search threads" value="${f(y.q)}" spellcheck="false">${y.q?`<button type="button" data-hist-clear aria-label="Clear search">${Sn}</button>`:'<kbd aria-hidden="true">/</kbd>'}</label>
229
- <button type="button" class="dt-tip-r dt-hist-filter${y.view!=="all"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${y.menu}" data-tip="Filter">${bh}</button>
230
- ${y.menu?`<div class="dt-hist-menu" role="menu">${me("data-hist-view","me","For me",y.view==="me",re.filter(n.forMe).length)}${me("data-hist-view","agent","Agent",y.view==="agent",re.filter(n.forAgent).length)}${me("data-hist-view","all","All",y.view==="all",re.length)}</div>`:""}
231
- </div>`,k=($,I,ht,At)=>`<button type="button" role="menuitemcheckbox" ${$} aria-checked="${I}"><span>${ht}</span><kbd>${At}</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>`,W=$=>$.map(I=>I.id).join(","),U=()=>`<div class="dt-hist-menu is-panel" role="menu">
232
- <button type="button" role="menuitem" data-read-all><span>Mark all as read</span></button>${O.open.length?`<button type="button" role="menuitem" data-resolve-all="${W(O.open)}"><span>Resolve all open</span><em>${O.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&&O.done.length?`<button type="button" role="menuitem" data-archive-all="${W(O.done)}"><span>Archive all resolved</span><em>${O.done.length}</em></button>`:""}<hr>${k("data-resolved",b,"Show resolved","R")}${n.archives?k("data-archived",E,"Show archived","A"):""}<hr>
233
- <p class="dt-hist-menu-head">Sort</p>${me("data-hist-sort","new","Newest first",y.sort==="new")}${me("data-hist-sort","old","Oldest first",y.sort==="old")}${me("data-hist-sort","reply","Last reply",y.sort==="reply")}${me("data-hist-sort","unread","Unread first",y.sort==="unread")}</div>`;return`<div class="dt-hist-head">
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">
234
238
  <span class="dt-hist-here"
235
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>
236
240
  <span class="dt-hist-title">Threads</span>
237
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>':""}
238
- ${Tt}
242
+ ${At}
239
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>`:""}
240
- <button class="dt-hist-refresh" data-hist-more aria-label="More" aria-haspopup="menu" aria-expanded="${y.more}">${ru}</button>${y.more&&!n.folded?U():""}
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():""}
241
245
  <button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel" aria-expanded="${!n.folded}">
242
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>
243
247
  </button>
244
- </div>`+(n.folded?"":S()+(ne.length||H.length?`<div class="dt-hist-list">${H.length?`<p class="dt-hist-group">${Ft("drafts","Drafts",H.length)}</p>${n.shut("drafts")?"":H.map(be).join("")}`:""}${ne.map($=>{if(n.shut($))return`<p class="dt-hist-group">${Ft($,yt[$],O[$].length)}</p>`;let I=O[$].slice(0,Math.max(0,Et));Et-=I.length;let ht=O[$].slice(I.length).find(Ht=>Ht.id===n.keep);ht&&I.push(ht);let At=O[$].length-I.length;return`<p class="dt-hist-group">${Ft($,yt[$],O[$].length)}</p>${I.map(St).join("")}${At?`<button type="button" class="dt-note-fold dt-hist-rest" data-hist-rows>${At} more in ${yt[$]}</button>`:""}`}).join("")}</div>`:y.q.trim()?`<div class="dt-hist-empty">${lu}<p>No threads match \xAB${f(y.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:y.view!=="all"?'<div class="dt-hist-empty"><p>Nothing in this view at this breakpoint.</p><button data-hist-view="all">Show all</button></div>':`<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>${O.done.length||O.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?"":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
245
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">
246
250
  <button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${b}"
247
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
248
252
  ><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
249
- <button class="dt-hist-resolved" data-archived role="switch" aria-checked="${E}"
250
- >${yn}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
251
- </div>`))}function cu(n){let{inFrame:r,everything:u,route:m,open:g,settle:b,keepIn:E,toast:H,waits:y,approve:T}=n,x=it=>{let yt=u().find(Ft=>Ft.id===it);return!!yt&&y(yt)},D="nm-review",dt=()=>{try{return JSON.parse(sessionStorage.getItem(D)||"null")}catch{return null}},J=it=>{try{it?sessionStorage.setItem(D,JSON.stringify(it)):sessionStorage.removeItem(D)}catch{}},tt=document.createElement("div");tt.className="dt-review",tt.setAttribute("role","region"),tt.setAttribute("aria-label","Checking fixes"),tt.hidden=!0,E(tt),r||document.body.append(tt);let O=()=>u().filter(y),St=()=>{let it=O().sort((yt,Ft)=>+(Ft.route===m())-+(yt.route===m())||String(yt.route).localeCompare(String(Ft.route))||yt.id-Ft.id).map(yt=>yt.id);it.length&&(J({ids:it,i:0}),zt())},zt=()=>{let it=dt();if(!it||r){tt.hidden=!0;return}for(;it.i<it.ids.length&&!x(it.ids[it.i]);)it.i++;if(it.i>=it.ids.length){J(null),tt.hidden=!0,H("Every fix is checked.");return}J(it);let yt=u().find(Et=>Et.id===it.ids[it.i]);if(yt.route&&yt.route!==m()){location.assign(yt.route+location.search);return}g(yt);let Ft=it.ids.slice(0,it.i).some(x),Wt=it.ids.filter(x);tt.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
252
- <span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${Ft?"":" disabled"}>${Ha}</button>
253
- <span class="dt-review-n">${Wt.indexOf(yt.id)+1} of ${Wt.length}</span>
254
- <button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Ca}</button></span>
255
- <button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${$e}</button>
256
- <button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${dn}</button>
257
- <button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Sn}</button>`,tt.hidden=!1};tt.addEventListener("click",async it=>{let yt=it.target.closest("[data-r]"),Ft=dt();if(!yt||!Ft)return;if(yt.dataset.r==="stop"){J(null),tt.hidden=!0;return}if(yt.dataset.r==="prev"){Tt();return}let Wt=Ft.ids[Ft.i];J({...Ft,i:Ft.i+1});let Et=u().find(be=>be.id===Wt),ne=yt.dataset.r==="ok"&&Et?T(Et):yt.dataset.r==="no"?b(Wt,!1):null;zt(),await ne});let Tt=()=>{let it=dt();if(it){for(let yt=it.i-1;yt>=0;yt--)if(x(it.ids[yt])){J({...it,i:yt}),zt();return}}};return document.addEventListener("keydown",it=>{tt.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"?Tt():tt.querySelector('[data-r="skip"]')?.click())}),{start:St,toCheck:O,resume:()=>{dt()&&zt()}}}function uu(n,r){let u=null,m=null,g=document.querySelector(".dt-turbo"),b="/notemend:turbo",E=()=>{let H=!!u&&Date.now()-Date.parse(u.at)<18e4,y=H?u.mode==="push"?"push":m?.paused?"paused":"on":"none",T=H?Wn(u.agent):"",x=y==="none"?`Turbo is off. Run ${b} in Claude Code and threads for the agent are taken as they land \u2014 click to copy it`:y==="push"?`Push mode: ${T} takes threads when you press Push to the agent. For live, run ${b} instead`:y==="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=y,g.dataset.tip=x,g.setAttribute("aria-label",x),g.setAttribute("aria-checked",String(y==="on")),n&&(g.hidden=!0)};return setInterval(E,3e4),g.addEventListener("click",async()=>{let H=g.dataset.state;if(H==="none"||H==="push"){await navigator.clipboard?.writeText(b).catch(()=>{}),r(`Copied ${b} \u2014 paste it in Claude Code`);return}let y=H==="on"?"off":"on";m={paused:y==="off"},E();try{let T=await ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:y})});if(!T.ok)throw new Error(String(T.status));r(y==="off"?"Turbo paused":"Turbo on")}catch{m={paused:y==="on"},E(),r("Could not switch turbo \u2014 try again")}}),H=>{u=H.listening??null,m=H.turbo??null,E()}}var yh=new Set(["data-wired","data-nudge"]),vh=".dt-note",pu=n=>n instanceof Element&&n.hasAttribute("data-ghost"),So=n=>{if(!(n instanceof Element))return null;let r=n.dataset;return r.msg?`m:${r.msg}`:r.id?`${n.tagName}:${n.classList[0]??""}:${r.id}`:"draft"in r?`${n.tagName}:draft`:r.parked?`${n.tagName}:parked:${r.parked}`:r.k?`${n.tagName}:k:${r.k}`:null},mu=(n,r)=>n.nodeType===r.nodeType&&n.nodeName===r.nodeName&&So(n)===So(r);function wh(n,r){for(let{name:u}of[...n.attributes])!r.hasAttribute(u)&&!yh.has(u)&&n.removeAttribute(u);for(let{name:u,value:m}of r.attributes)n.getAttribute(u)!==m&&n.setAttribute(u,m);n instanceof HTMLInputElement&&r instanceof HTMLInputElement&&(n.checked!==r.checked&&(n.checked=r.checked),n!==document.activeElement&&n.value!==r.value&&(n.value=r.value))}function hu(n,r){let u=[...n.childNodes].filter(y=>!pu(y)),m=new Map;for(let y of u){let T=So(y);T&&m.set(T,y)}let g=new Set,b=0,E=[];for(let y of[...r.childNodes]){let T=So(y),x=T?m.get(T):void 0;if(!T){for(;b<u.length&&(g.has(u[b])||So(u[b]));)b++;b<u.length&&mu(u[b],y)&&(x=u[b++])}x&&!g.has(x)&&mu(x,y)?(g.add(x),$h(x,y),E.push(x)):E.push(y)}for(let y of u)g.has(y)||(y instanceof HTMLElement&&y.matches(vh)&&Qc(y),n.removeChild(y));let H=n.firstChild;for(let y of E){for(;H&&pu(H);)H=H.nextSibling;if(y===H){H=H.nextSibling;continue}n.insertBefore(y,H)}}function $h(n,r){if(n.nodeType===Node.TEXT_NODE||n.nodeType===Node.COMMENT_NODE){n.nodeValue!==r.nodeValue&&(n.nodeValue=r.nodeValue);return}if(!(!(n instanceof Element)||!(r instanceof Element))){if(wh(n,r),n instanceof HTMLTextAreaElement){n!==document.activeElement&&n.value!==r.value&&(n.value=r.value);return}if(n instanceof SVGElement){n.innerHTML!==r.innerHTML&&(n.innerHTML=r.innerHTML);return}hu(n,r),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==r.value&&(n.value=r.value)}}function Sr(n,r){let u=document.createElement("template");u.innerHTML=r,hu(n,u.content)}function gu(n,r,u=!1){let m=n.breakpoints,g=n.categories,b=(m.find(t=>!Number.isFinite(t.max))??m[0]).id,E=t=>m.find(e=>t>=e.min&&t<=e.max)?.id??b,H=(t,e)=>{let s=E(t);if(Rs||!matchMedia("(pointer: coarse)").matches)return s;let o=[...m].sort((l,d)=>l.min-d.min),a=e<500?E(767):(o[o.length-2]??o[0]).id,i=l=>o.findIndex(d=>d.id===l);return i(s)>i(a)?a:s},y=t=>t.breakpoint||b,T=t=>n.devices.find(e=>e.id===t),x=Rs,D=(t,e)=>{x||mt.setItem(t,e)},dt=null,J=["stage","status","priority","assignee"],tt=t=>{let e=(dt??R).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 ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(o?{...t,seen:o}:t)})},O=t=>t.replace(/\/+$/,"")||"/",St=O(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 zt=document.querySelector(".dt-grid-btn"),Tt=document.querySelector(".dt-grid-overlay"),it=Tt.querySelector(".dt-overlay-grid"),yt=Tt.querySelector(".dt-grid-chip"),Ft="dt-grid",Wt=n.projectGrid??null,Et=()=>H(innerWidth,innerHeight),ne=()=>Wt?.mode==="custom"?Wt.widths?.[Et()]??null:null,be=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),re=t=>be(t).length,me=()=>{let t=Tt.hidden;t&&(Tt.style.visibility="hidden",Tt.hidden=!1);try{return S()}finally{t&&(Tt.hidden=!0,Tt.style.visibility="")}},S=()=>{let t=document.documentElement.clientWidth;Tt.classList.remove("is-auto");let e=getComputedStyle(it);if(e.display==="grid"&&re(e)>1){let i=it.getBoundingClientRect();return{cols:re(e),gap:Math.round(parseFloat(e.columnGap)||0),x:Math.round(i.left),w:Math.round(i.width),from:"site"}}let s=null,o=null;for(let i of[...document.body.querySelectorAll("*")].slice(0,3e3)){if(i.closest(fs)||Tt.contains(i))continue;let l=i.getBoundingClientRect();if(!l.width||!l.height)continue;let d=getComputedStyle(i);if(d.maxWidth!=="none"&&l.left>0&&Math.abs(l.left-(t-l.right))<=2&&l.width>(s?.w??0)){let p=parseFloat(d.paddingLeft)||0;s={x:l.left+p,w:l.width-p-(parseFloat(d.paddingRight)||0)}}if(l.width<=(o?.w??0))continue;let c=d.display.endsWith("grid")?be(d):[];if(c.length>1){if(!c.every(v=>Math.abs(v-c[0])<2))continue;let p=parseFloat(d.columnGap)||0;o={cols:c.length,gap:p,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:c.reduce((v,A)=>v+A,0)+p*(c.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let p=[...i.children].map(A=>A.getBoundingClientRect()).filter(A=>A.width&&A.height),v=p.filter(A=>Math.abs(A.top-p[0].top)<2).sort((A,j)=>A.left-j.left);v.length>1&&v.every(A=>Math.abs(A.width-v[0].width)<2)&&(o={cols:v.length,gap:Math.max(0,v[1].left-v[0].right),x:v[0].left,w:v.at(-1).right-v[0].left})}}let a=i=>({...i,gap:Math.round(i.gap),x:Math.round(i.x),w:Math.round(i.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"})},k=null,W=(t,e,s,o)=>{Tt.classList.add("is-auto"),it.children.length!==t&&(it.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),Tt.style.setProperty("--grid-x",`${s}px`),Tt.style.setProperty("--grid-w",`${o}px`),Tt.style.setProperty("--grid-gap",`${e}px`)},U=()=>{let t=ne(),e=yt.querySelector("span");if(yt.querySelector("button").hidden=!t||x,t){let s=document.documentElement.clientWidth,o=Math.max(0,Math.min(t.max??1/0,s-2*t.margin));W(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)),k=me(),k.from!=="site"&&W(k.cols,k.gap,k.x,k.w),e.textContent=k.from==="guess"?`Guessed \xB7 ${k.cols} \xD7 ${k.w}`:`From the page \xB7 ${k.cols} \xD7 ${k.w} \xB7 gap ${k.gap}`},$=()=>{yt.classList.remove("is-lifted");let t=yt.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();yt.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},I=t=>{Tt.hidden=!t,t&&(U(),$()),zt.setAttribute("aria-pressed",String(t)),D(Ft,t?"1":"0"),We({grid:t})};zt.addEventListener("click",()=>I(Tt.hidden===!0)),addEventListener("resize",()=>{Tt.hidden||(U(),$())});let ht=document.querySelector(".dt-pages-name"),At=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:O(t.location.pathname),title:t.document.title}:null}catch{return null}},Ht=()=>{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??"")},gt=()=>{let e=At()?.route??St,s=null;for(let l of document.querySelectorAll(".dt-pages a"))O(new URL(l.href).pathname)===e?(l.setAttribute("aria-current","page"),s=l):l.removeAttribute("aria-current");Ht();let i=(s?.querySelector(".dt-menu-label")?.textContent?.trim()||e).trim().split(/\s+/);ht.textContent=e==="/"?"":e.replace(/^\//,""),ht.closest("summary").toggleAttribute("data-home",e==="/")},Mt=(!!n.gridAdmin||!!n.arrange)&&!n.client,Q=(n.folders??[]).filter(t=>t&&typeof t.name=="string"&&Array.isArray(t.pages)),se=new Set((()=>{try{return JSON.parse(mt.getItem("dt-folders-open")||"[]")}catch{return[]}})()),jt=new Set((()=>{try{return JSON.parse(mt.getItem("dt-folders-closed")||"[]")}catch{return[]}})()),Rt=document.querySelector(".dt-pages-list"),Yn=()=>gt(),cn=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),Le=()=>{let t=new Map(n.pages.map(d=>[d.route,d])),e=new Set(Q.flatMap(d=>d.pages)),s=d=>Oc(n,d,St,Mt),o=d=>Q.filter(c=>(c.parent&&Q.some(p=>p.id===c.parent)?c.parent:null)===d),a=d=>d.pages.includes(St)||o(d.id).some(a),i=(d,c)=>s(d).replace("<li",`<li style="--d:${c}"`),l=(d,c)=>{let p=se.has(d.id)||!jt.has(d.id)&&a(d),v=d.pages.map(j=>t.get(j)).filter(j=>!!j),A=o(d.id);return`<li class="dt-folder" data-folder="${f(d.id)}" style="--d:${c}"${p?" data-open":""}${Mt?' draggable="true"':""}><div class="dt-folder-row" role="button" tabindex="0" aria-expanded="${p}">${$o}${cn(p)}<span class="dt-menu-label">${f(d.name)}</span><em class="dt-folder-n"></em>`+(Mt?`<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${p?"":" hidden"}>${A.map(j=>l(j,c+1)).join("")}${v.map(j=>i(j,c+1)).join("")}${v.length||A.length?"":`<li class="dt-folder-empty" style="--d:${c+1}">Empty \u2014 drag pages here</li>`}</ul></li>`};Rt.innerHTML=o(null).map(d=>l(d,0)).join("")+n.pages.filter(d=>!e.has(d.route)).map(d=>i(d,0)).join(""),document.querySelector(".dt-pages-foot").hidden=!Mt,Yn()};Le();let L=document.querySelector(".dt-pages");L&&!L.querySelector("li")&&L.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let w=[...document.querySelectorAll(".devtools details, .dt-strip details")],C=!1,q=t=>Un(t,()=>{t.open=!1}),F=()=>{let t=w.filter(e=>e.open&&!e.hasAttribute("data-leaving"));for(let e of t)q(e);return t};for(let t of w)t.querySelector(":scope > summary")?.addEventListener("click",e=>{t.open&&t.hasAttribute("data-leaving")?(e.preventDefault(),Eo(t)):t.open&&(e.preventDefault(),q(t))});document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=F();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{C=w.some(e=>e.open&&!e.contains(t.target))&&F().length>0},!0),addEventListener("blur",F);let wt=document.querySelector(".dt-pad-overlay"),$t="dt-inspect",ot=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".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-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(", "),ct={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")},ft="",Nt=0,{spacer:ye,drawPads:Ie,drawSize:xe,drawType:Gt,drawColor:ce,drawBorder:Se,drawContrast:he,contrastFix:Oe,markCopied:gs}=Kc(wt),Hn=null,B=()=>{Hn&&ft&&P(Hn)},P=t=>{Hn=t,!Nt&&(Nt=requestAnimationFrame(()=>{Nt=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(ot)){wt.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),ft==="sizes"?xe(e):ft==="type"?Gt(e):ft==="color"?ce(e):ft==="contrast"?he(e):ft==="border"?Se(e):Ie(t.altKey?e:ye(e))}))},Y=t=>{ft=t;for(let[e,s]of Object.entries(ct))s.setAttribute("aria-pressed",String(e===t));D($t,t),We({inspect:t}),wt.hidden=!t,wt.innerHTML="",t?(document.addEventListener("mousemove",P),addEventListener("scroll",B,!0),addEventListener("resize",B)):(document.removeEventListener("mousemove",P),removeEventListener("scroll",B,!0),removeEventListener("resize",B))};document.addEventListener("click",t=>{ft!=="contrast"||!Oe()||t.target.closest?.(ot)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(Oe()).catch(()=>{}),gs(),B())},!0);for(let[t,e]of Object.entries(ct))e.addEventListener("click",()=>{t!==ft&&Qe(!1),Y(ft===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Kt)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let s=o=>{x&&parent.postMessage({dt:!0,...o},location.origin)};ft?(Y(""),s({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):Tt.hidden||(I(!1),s({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let Pt=document.querySelector(".dt-notes-btn"),Yt=[...document.querySelectorAll(".dt-bp")],ve=document.querySelector(".dt-history-btn"),rt=document.querySelector(".dt-history"),ge=document.querySelector(".dt-elsewhere"),Xn=document.querySelector(".dt-studio-btn"),Jn=document.querySelector(".dt-devices"),Zn=document.querySelector(".dt-notes-hi"),xu=Zn.querySelector(".dt-hi-box"),Cr=Zn.querySelector(".dt-hi-tag"),vn=document.querySelector(".dt-frame"),Ge=document.createElement("div");Ge.className="dt-spot",Ge.hidden=!0,Ge.setAttribute("aria-hidden","true"),document.body.append(Ge);let Eu=t=>{if(!t||!Kt){Ge.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;Ge.style.setProperty("--spot-x",`${e.left-s}px`),Ge.style.setProperty("--spot-y",`${e.top-s}px`),Ge.style.setProperty("--spot-w",`${e.width+s*2}px`),Ge.style.setProperty("--spot-h",`${e.height+s*2}px`),Ge.hidden&&(Zn.hidden=!0),Ge.hidden=!1},qs=vn.querySelector("iframe");qs.addEventListener("load",gt),new MutationObserver(gt).observe(vn,{attributes:!0,attributeFilter:["hidden"]});let Ra=document.querySelector(".dt-notes-count"),nt=document.querySelector(".dt-notes-overlay"),fs=".devtools, .dt-tab, .dt-strip, .dt-strip-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Pa=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(fs).forEach(Pa);let Nr="dt-notes",R=[],Kt=!1,X=null,N=null,Ia=0,Ae="",Mu=(t,e,s)=>{if(s>160&&s<innerHeight-120)return!1;let o=document.elementsFromPoint(e,s).find(a=>!Tn(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 i=getComputedStyle(a).position;if(i==="fixed"||i==="sticky")return!a.contains(t)}return!1},Br=new WeakSet,Ao=null,Ho=null,qe={},Co=" \xB7 hidden \u2014 inside something closed",No=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")&&No(e)},!0),nt.addEventListener("load",t=>{let e=t.target.closest?.(".dt-note-thread");e&&No(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 qe[s.dataset.id],s.remove())},!0);let Ee=[],Qt=null,De=[],ku=10,Ds=(t=N)=>!!(t&&((t.text?.trim().length??0)>=ku||t.images?.length)),nn=()=>{N&&Ds()&&De.push(N),N=null},Rr=0,Fs=()=>{if(!Ds()||performance.now()-Rr<4e3)return!0;Rr=performance.now();let t=nt.querySelector(".dt-note[data-draft]");return t&&Mo(t,"no"),t?.querySelector(".dt-note-input")?.focus(),Ut("Not sent \u2014 close again to keep it as a draft",2400),!1},un=null,Oa=new Map,qa=null,Pr=()=>`dt-draft:${n.me?.email??""}:${St}${x?":canvas":""}`,wn=Pr(),Bo=0,js=()=>{if(!N&&!De.length&&!Ae){mt.removeItem(wn);return}let t={draft:N,parked:De,reply:Ae?{for:un,text:Ae}:null};try{localStorage.setItem(wn,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(wn,JSON.stringify({...t,draft:N&&e(N),parked:De.map(e)}))}catch{}}},Qn=()=>{clearTimeout(Bo),Bo=setTimeout(js,200)};addEventListener("pagehide",()=>{clearTimeout(Bo),js();try{sessionStorage.setItem(`nm-open:${wn}`,X==null?"":String(X))}catch{}});let Fe=mt.getItem("dt-space")==="clients"?"clients":"studio",Ke=()=>!!n.me&&!n.client,$n=t=>!Ke()||Fe==="clients"===qt(t),Ir=["all","nobody","mine","others","resolved","claude","wrote","check"],xn=Ir.find(t=>t===mt.getItem("dt-pinf"))??"all",Da=()=>{},Ro=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Ue=mt.getItem("dt-resolved")!=="0",pn=mt.getItem("dt-archived")==="1",Me=t=>Nc(t,n.autoArchive),Po=t=>Me(t)?pn:Dt(t)!=="done"||Ue,oe={q:"",menu:!1,more:!1,view:["me","agent"].includes(mt.getItem("dt-view")??"")?mt.getItem("dt-view"):"all",sort:["old","reply","unread"].includes(mt.getItem("dt-sort")??"")?mt.getItem("dt-sort"):"new"},Cn=null,Io=t=>vt.find(e=>e.from?.id===t.id&&Ps(e)),Fa=t=>Ps(t)?vt.find(e=>e.id===t.from.id&&qt(e)):void 0,He=null,Oo=null,qo=()=>Ke()&&Fe==="clients",bs=t=>qo()&&qt(t)&&Dt(t)==="open"&&!Io(t),Do='<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>',Lu=t=>{let e=n.client?void 0:Fa(t);if(!e)return"";let s=Sc(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">${xr.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>`},Su=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Tu=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Au=()=>{let t=navigator.userAgent,e=i=>i.find(([l])=>l.test(t)),s=e(Su),o=e(Tu),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},ja=()=>H(innerWidth,innerHeight),Xt=()=>qa??ja(),Or=()=>{let t=Xt();for(let e of Yt)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:_a,poolOf:Wa,contextOf:za,resolveEl:Hu,anchorOf:Cu,anchorState:Nu,fingerprintOf:Fo}=Xc(),ys=new Map,_s=()=>{ys=new Map},qr=t=>JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth,t.fp]),Ce=t=>{let e=qr(t),s=ys.get(e);return(s===void 0||s.el&&!s.el.isConnected)&&(s={el:Hu(t),st:Nu(t)},ys.set(e,s)),s.el},jo=t=>(Ce(t),ys.get(qr(t))?.st??"found"),Ws=0,zs=null,_o="",Dr=()=>{Ws=Math.max(Ws,scrollY+innerHeight)},Fr=(t,e)=>e==="gone"&&!!t.spot&&(Dr(),t.spot.y>Ws&&Ws<document.documentElement.scrollHeight-1);addEventListener("scroll",()=>{Dr(),zs!=null&&Ws>=zs&&(zs=null,setTimeout(()=>{_s(),Z()},600))},{capture:!0,passive:!0});let Bu=t=>{let e=jo(t);return(Fr(t,e)?"later":e)+(Te(t)?"":" \xB7 no pin")},jr=t=>{t.spot&&scrollTo({top:Math.max(0,t.spot.y-innerHeight/2),behavior:"smooth"})},Va=[];document.addEventListener("pointerdown",t=>{let e=t.target;e instanceof Element&&!Tn(e)&&!e.closest(".devtools")&&(Va=[Va.at(-1),{el:e,t:Date.now()}].filter(Boolean))},!0);let Ru='[role=menu],[role=listbox],[role=dialog],[role=tooltip],dialog,[popover],[aria-modal],[data-state="open"],[data-radix-popper-content-wrapper],details[open]>:not(summary)',Pu=t=>{let e=[...Va].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)||Tn(s))return null;let o=t.closest(Ru);if(o?.contains(s)||!o&&s.getAttribute("aria-expanded")!=="true"&&!s.matches("summary,[aria-haspopup]"))return null;let a=s.tagName.toLowerCase(),i=[...s.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:_a(s),tag:a,classes:i,nth:Wa({tag:a,classes:i}).indexOf(s),label:Zt(ie(s.textContent||""),60),ctx:za(s),fp:Fo(s),rx:.5,ry:.5}},Wo=new Map,Te=t=>{Wo.size||requestAnimationFrame(()=>Wo.clear());let e=Wo.get(t);return e===void 0&&(e=Cu(t,Ce(t)),Wo.set(t,e)),e},_r=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},zo=[],Ga=t=>{for(let e of zo)e.play();zo=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),zo.push(s))},Ka=()=>{if(N)return Ce(N);let t=X!=null?R.find(s=>s.id===X):null;if(!t)return null;let e=Te(t);return e&&!e.hidden?Ce(t):null},Wr="claude",Iu=()=>(n.client||Fe==="clients"?n.team??[]:Jo()).filter(t=>!gr(t.email)),Ou=()=>Iu().filter(t=>t.email!==n.me?.email),Vs=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...Ou()],zr='<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>',Ua=(t,e)=>{let s=e==="agent"?Wr:e==="me"?n.me?.email??"":"";if(!t){if(!N)return;N.assignee=s,N.stage=Jt(s)?"approved":!N.stage||N.stage==="approved"?"new":N.stage,Gs(s),N.carried=!1,Qn(),Z();return}Vo(t,s)},Vo=(t,e)=>{let s=R.find(i=>i.id===t);if(s&&ln(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?Re(s):"new",a=Jt(e)?"approved":o==="approved"?"new":o;Ye(i=>i.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>tt({id:t,assignee:e||null,stage:a}),Jt(e)?"Approving it for the agent":"Reassigning")},qu=(t,e)=>{if(e&&mt.setItem("nm-for",e),!t){if(!N)return;N.assignee=e,N.stage==="approved"&&(N.stage="new"),Gs(e),N.carried=!1,Qn(),Z();return}Vo(t,e)},Du='<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>',Gs=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)&&Vs().some(s=>s.email===e)?e:null}catch{return null}},Vr=t=>Jt(t)?"#d97757":t?"#0d99ff":"#717171",mn=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],sn=t=>t?n.team?.find(e=>e.email===t):void 0,Go=t=>{let e=ie(t??"").split(/\s+/).filter(Boolean);return f(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},Nn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${f(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${Go(e)}</b>`,Ya=t=>{let e=sn(t.by);return e||t.byName?Nn(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},Ne=t=>`var(--dt-avatar-${sn(t)?.avatar_hue??[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,hn=(t,e)=>{let s=sn(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return Nn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${Ne(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},Gr=()=>n.me?`${hn(n.me.email.toLowerCase(),{by:n.me.email,byName:n.me.name})}<i class="dt-pin-cut" aria-hidden="true">${Gn}</i>`:Gn,ts=new Map,Xa=new Map,Kr=0,Fu=(t,e)=>{let s=e==="found"?null:e;n.client||x||t.id<=0||(t.anchor??null)===s||ts.get(t.id)===s||(ts.set(t.id,s),Xa.set(t.id,s),clearTimeout(Kr),Kr=window.setTimeout(()=>{for(let[o,a]of Xa){let i=R.find(d=>d.id===o),l=i?jo(i):"found";if(!i||(l==="found"?null:l)!==a){ts.delete(o);continue}tt({id:o,anchor:a}).then(d=>{if(d.ok){let c=R.find(p=>p.id===o);c&&(c.anchor=a)}}).catch(()=>ts.delete(o))}Xa.clear()},4e3))},ju=t=>{let e=!!Ce(t)?.getClientRects().length;return`<div class="dt-note-hidden dt-note-away"><b>${Xo}<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>`},_u=(t,e,s,o)=>{let a=(d,c,p=!1)=>`<button type="button" class="dt-lost-btn${p?" is-main":""}" data-act="${d}" data-id="${t.id}">${c}</button>`,i=(d,c,p)=>`<button type="button" class="dt-lost-btn dt-lost-ico" data-act="${d}" data-id="${t.id}" data-tip="${p}" aria-label="${p}">${c}</button>`,l=!n.client;if(o&&s==="later")return`<div class="dt-note-hidden dt-note-away"><b>${Xo}<span>Not on the page yet</span></b><button type="button" data-act="go-spot" data-id="${t.id}">Go to its place</button></div>`;if(o&&s==="gone"){let d=mc(t).before,c=Dt(t)!=="open";return`<div class="dt-lost dt-lost--gone"><p>${t.spot&&!c?"Its element is gone \u2014 here is how it looked. Pin it to something else, or close the thread.":"Not on this page any more \u2014 the element was removed or changed since. The thread stays: answer or resolve it here."}</p>${d?`<img class="dt-lost-shot" src="${f(rr(d.split("/").pop()))}" alt="How the element looked" loading="lazy">`:""}${c?"":`<span class="dt-lost-acts">${ro(t)?a("repin","Re-pin",!0):""}${i("lost-resolve",$e,"Resolve")}${l?i("archive",yn,"Archive"):""}</span>`}</div>`}return s==="probably"?`<div class="dt-lost dt-lost--maybe"><p>The page changed since \u2014 is this still its element?</p><span class="dt-lost-acts">${ro(t)?a("pin-yes","Yes, it\u2019s this",!0)+a("repin","Re-pin"):""}</span></div>`:e?.opener?`<div class="dt-lost dt-lost--inside"><p>Inside ${f(lo(e.opener))} \u2014 closed now.</p><span class="dt-lost-acts">${a("open-it","Open it",!0)}</span></div>`:""},Ja=(t,e)=>sn(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],Ko={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},Bn=(()=>{try{return JSON.parse(mt.getItem("dt-seen")||"{}")}catch{return{}}})(),Za=()=>D("dt-seen",JSON.stringify(Bn)),Ur=t=>{let e=en(t);if(!(t.id in Bn))return Bn[t.id]=e.length,Za(),!1;let s=e[e.length-1];return e.length>Bn[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},Yr=t=>{let e=en(t).length;Bn[t.id]!==e&&(Bn[t.id]=e,Za())},Wu=t=>{let e=sn(t);return e?` data-face="${f(e.avatar_url??"")}" data-initial="${Go(e.name||e.email)}"`:""},zu=t=>n.client||qt(t)||Dt(t)==="done"?"":Qr(t,t.assignee??"",t.id),Vu=t=>{let e=Dt(t)==="done";return`<button type="button" class="dt-hist-tick" data-act="${e?"reopen":"done"}" data-id="${t.id}" data-tip="${e?"Reopen":Dt(t)==="claude"?"Looks right \u2014 resolve":"Resolve"}" aria-label="${e?"Reopen":"Resolve"}">${e?dn:$e}</button>`},Gu=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">${Pe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Ne(a)}">${hn(a,t)}</span>`).join("")}${s.length>3?`<i>+${s.length-3}</i>`:""}</span>${e.length} ${e.length===1?"reply":"replies"}</span>`},Ku=t=>{if(Cn!==t.id)return"";let e=(l,d,c,p="")=>`<button type="button" role="menuitem" ${l} class="${p}"><i>${d}</i><span>${c}</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=Me(t),i=!n.client;return`<div class="dt-hist-menu is-row" role="menu">${i&&!qt(t)?`<div class="dt-hist-assign"><span>Assign</span>${Zr(t.assignee??"",t.id)}</div><hr>`:""}${e(`data-row-unread="${t.id}"`,s,"Mark as unread")}${e(`data-row-link="${t.id}"`,si,"Copy link")}${qo()?e(`data-row-select="${t.id}"`,o,"Select")+(bs(t)?e(`data-row-mirror="${t.id}"`,Do,"Mirror to Team"):""):""}${i&&Ke()&&!t.client?e(`data-row-move="${t.id}"`,ni,qt(t)?"Move to Team":"Move to Client"):""}${i||!$s(t)?"<hr>":""}${i?e(`data-act="${a?"unarchive":"archive"}" data-id="${t.id}"`,a?dn:yn,a?"Unarchive":"Archive"):""}${$s(t)?"":e(`data-rm="${t.id}"`,Vn,"Delete thread","is-danger")}</div>`},Xr={queued:"#0d99ff",working:"#f5a623",asks:"#e93d82",stuck:"#e5402c",review:"#8e4ec6"};nu(t=>{if(t.matches(".dt-hist-go[data-go]")){let v=R.find(Bt=>Bt.id===Number(t.dataset.go)),A=v&&[...v.replies??[]].reverse().find(Bt=>!Bt.deleted);if(!v||!A)return null;let j=A.author==="claude",h=(A.by||"you").toLowerCase(),G=j?Mn(v):A.by?A.by===n.me?.email?"You":mn(A.by):"You",z=j?`<span class="dt-hist-face is-agent">${Pe(11)}</span>`:`<span class="dt-hist-face" style="--hue:${Ne(h)}">${hn(h,v)}</span>`,It=(A.images?.length?'<span class="dt-peek-chip">Picture</span>':"")+(A.files?.length?'<span class="dt-peek-chip">File</span>':"")+(A.audio?'<span class="dt-peek-chip">Voice note</span>':"");return`<span class="dt-peek-head"><span class="dt-peek-people">${z}</span><b>${f(G)}</b>${j?`<em>${f(pr(A.agent)||"")}</em>`:""}${A.editedAt?"<em>edited</em>":""}<em>${zn(A.at)}</em></span>`+(A.text?`<span class="dt-peek-text is-reply">${f(Zt(A.text,320))}</span>`:"")+(It?`<span class="dt-peek-files">${It}</span>`:"")}if(X!=null||!t.matches(".dt-pin[data-id]"))return null;let e=R.find(v=>v.id===Number(t.dataset.id));if(!e)return null;let s=[...new Set([e.by,...(e.replies??[]).filter(v=>v.author!=="claude").map(v=>v.by)].filter(Boolean).map(v=>v.toLowerCase()))].slice(0,3),o=Dt(e),a=n.client||qt(e)||o==="done"?null:we(e),i=a&&Xr[a]&&(Jt(e.assignee)||a==="review")?a:null,l=Rn.find(v=>v[0]===es(e)),[d,c]=o==="done"?Me(e)?["#717171","Archived"]:["#30a46c","Resolved"]:i?[Xr[i],`${Mn(e)}${Qa(e)}`]:[l[2],l[1]],p=e.replies?.length??0;return`<span class="dt-peek-head">${s.length?`<span class="dt-peek-people">${s.map(v=>`<span class="dt-hist-face" style="--hue:${Ne(v)}">${hn(v,e)}</span>`).join("")}</span>`:""}<b>${f(e.byName||"You")}</b><em>\xB7 ${zn(e.createdAt)}</em></span><span class="dt-peek-text">${f(Zt(e.text,240))}</span><span class="dt-peek-foot">${Ve(d,o==="done"?1:0)}<span>${f(c)}${p?` \xB7 ${p} ${p===1?"reply":"replies"}`:""}</span></span>`});let Qa=t=>{let e=we(t),s=br(t);return e==="working"?s?.step?` \xB7 ${fr(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":""},Uu=t=>{let e=sn(t);return e?Nn(e.avatar_url,e.name||e.email):""},Jr=(t,e,s={})=>`<option value="${f(t)}"${s.dot?` data-c="${Vr(t)}"`:""}${Wu(t||null)}${s.selected?" selected":""}>${f(e)}</option>`,Zr=(t,e,s=!1)=>{let o=Jt(t),a=o?"":t,i=sn(a),l=i?i.avatar_url?`<img class="dt-owner-face" src="${f(i.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${Ne(a.toLowerCase())}" aria-hidden="true">${Go(i.name||i.email)}</b>`:a?ol:zr,d=a?i?.name||mn(a):"Anyone",c=A=>{let j=sn(A);return j?.avatar_url?`<img class="dt-menu-face" src="${f(j.avatar_url)}" alt="">`:`<b class="dt-menu-face" style="--hue:${Ne(A.toLowerCase())}">${[...Go(j?.name||A)][0]}</b>`},p=(A,j,h="")=>`<option value="${f(A)}" data-icon="${f(A?c(A):zr)}"${h?` data-hint="${f(h)}"`:""}${A===a?" selected":""}${A?"":" data-sep-after"}>${f(j)}</option>`,v=Vs();return`<label class="dt-owner${i?" 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>`}${Ks}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
258
- ${p("","Anyone")}${v.map(A=>p(A.email,A.email===n.me?.email?`Me \xB7 ${A.name||A.email}`:A.name||A.email,A.email)).join("")}${a&&!v.some(A=>A.email===a)?p(a,mn(a)):""}
259
- </select></label>`},Yu={queued:"queued",working:"working",asks:"asks you",stuck:"went quiet",review:"fixed it \u2014 to check",done:"done"},Qr=(t,e,s,o=!1)=>{let a=t?we(t):Jt(e)?"queued":null,i=!!a&&(Jt(e)||a==="review"),l=o?"The agent does not work in the clients\u2019 space":i?"Take it back":"Give to the agent",d=i?`With the agent \u2014 ${Yu[a]??"queued"}. Take it back`:l;return`<button type="button" class="dt-claude-btn${i?" is-on":""}" data-act="claude"${s?` data-id="${s}"`:""}${i?` data-step="${a}" style="--step-c:${Ko[a]??Ko.queued}"`:""} aria-pressed="${i}" data-tip="${f(l)}" aria-label="${f(d)}"${o?" disabled":""}>${Pe(13)}</button>`},tl=t=>{if(!t){if(!N)return;Ua(0,Jt(N.assignee)?"nobody":"agent");return}let e=R.find(o=>o.id===t);if(!e)return;let s=we(e);Vo(t,Jt(e.assignee)||s==="review"?"":Wr)},Xu=t=>`<div class="dt-suggest dt-suggest--read"><del>${f(t.from)}</del><ins>${f(t.to)}</ins></div>`,el=(t,e)=>{let s=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return f([s,ie(e??"")&&`\u201C${Zt(ie(e),80)}\u201D`].filter(Boolean).join(" \xB7 "))},Ks='<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>',ti=(t,e,s=!1)=>{let o=Is(t),a=i=>jc(i).replace("<svg ",`<svg style="stroke:${i.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>${Ks}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${g.map(i=>`<option value="${i.id}" data-c="${i.color}" data-icon="${f(a(i))}"${i.id===t?" selected":""}>${i.label}</option>`).join("")}</select></span></label>`},Rn=[["new","New","#0d99ff",0],["progress","In progress","#f5a623",.25],["review","To check","#8e4ec6",.5],["waiting","Waiting","#e93d82",.75]],es=t=>ln(t)||Re(t)==="progress"?"progress":Re(t)==="review"?"review":Re(t)==="waiting"?"waiting":"new",nl=(t,e)=>{if(e==="all")return!0;let s=Dt(t),o=vo(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"&&(we(t)==="review"||es(t)==="review")},Uo={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",done:"done"},Pn=[...Rn,["done","Resolved","#30a46c",1]],Ju=t=>{let e=we(t);return t.status==="done"&&e!=="review"?"done":e&&Uo[e]?Uo[e]:es(t)},Zu=t=>{let e=we(t),s=Ju(t),[,,o,a]=Pn.find(l=>l[0]===s),i=!n.client&&Fa(t)?l=>` data-note="${f(fo[l])}"`:()=>"";return`<label class="dt-field" data-tip="${e&&Uo[e]?"Follows the agent":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Ve(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${i("new")?'<option disabled data-head data-note="The client sees">Status</option>':""}${Pn.map(([l,d,c,p])=>`<option value="${l}" data-c="${c}" data-icon="${f(Ve(c,p))}"${i(l)}${l===s?" selected":""}>${d}</option>`).join("")}${n.client?"":`<option value="${Me(t)?"unarchive":"archive"}" data-sep data-icon="${f(yn)}">${Me(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},Yo=(t,e,s)=>`<p class="dt-note-event"><span>${t}<b>${f(e)}</b>${s?`<time>${wr(s,zn)}</time>`:""}</span></p>`,vs=new Map,Qu=(t,e,s=1/0)=>{let{reopenedAt:o,reopenedBy:a,movedAt:i,movedBy:l,movedFrom:d,repinnedAt:c,repinnedBy:p,repinnedFrom:v}=t,A=en(t),j=kt=>{let Lt=Date.parse(kt),Ct=A.findIndex((_t,ke)=>ke>0&&!!_t.at&&Date.parse(_t.at)>Lt);return Ct<0?A.length:Ct},h=kt=>kt?kt==="you"||kt===n.me?.email?"you":kt==="claude"?"the agent":mn(kt):"",G=[],z=tp(t);if(z&&G.push([z.at?j(z.at):0,Yo(z.icon,z.words,z.time)]),i&&d&&G.push([j(i),Yo(il,`Moved from ${d}${l?` by ${h(l)}`:""}`,i)]),c&&G.push([j(c),Yo(il,`Re-pinned${p?` by ${h(p)}`:""}${v?` from ${v}`:""}`,c)]),o&&t.status!=="done"){let kt=h(a);G.push([j(o),Yo(dn,kt?`Reopened by ${kt}`:"Reopened",o)])}let It=e.map(()=>!0);for(let[kt,Lt]of G.sort((Ct,_t)=>_t[0]-Ct[0]))e.splice(kt,0,Lt),It.splice(kt,0,!1);let Bt=It.flatMap((kt,Lt)=>kt?[Lt]:[]),le=Bt.length-1-s;if(le<2)return e.join("");let Ot=[...new Set(en(t).slice(1,1+le).map(kt=>kt.author==="claude"?"@agent":(kt.by||n.me?.email||"you").toLowerCase()))].slice(0,3).map(kt=>kt==="@agent"?`<span class="dt-hist-face is-agent">${Pe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Ne(kt)}">${hn(kt,t)}</span>`).join("");return[...e.slice(0,Bt[1]),`<button type="button" class="dt-note-fold" data-act="unfold" data-id="${t.id}"><span class="dt-hist-faces">${Ot}</span>${le} more replies</button>`,...e.slice(Bt[Bt.length-s])].join("")},tp=t=>{let e=t.from;if(e){if(Ps(t))return{icon:Do,words:Lc(t.mirroredBy?t.mirroredBy===n.me?.email?"you":(t.mirroredByName||mn(t.mirroredBy)).split(" ")[0]:""),at:null,time:t.createdAt};let o=vt.find(a=>a.id===e.id);return{icon:ei,words:Mc(t,o,o?.by?mn(o.by):""),at:null,time:t.createdAt}}if(n.client)return null;let s=vt.find(o=>o.from?.id===t.id);return s?{icon:Ps(s)?Do:ei,words:kc(s),at:s.createdAt??null,time:s.createdAt}:null},ep=(t,e)=>{let s=R.find(l=>l.id===t);if(!s)return;if(e==="done"){Xe(t,!0);return}if(e==="archive"||e==="unarchive"){ss(t,e==="archive");return}if(Jt(s.assignee)&&!qt(s)){s.status==="done"?Xe(t,!1):(Ut("Still with the agent \u2014 its step is the status; the agent button takes it back.",6e3),Z());return}let a=e==="new"&&Jt(s.assignee)?"approved":e,i=s.status==="done"?{status:"open",doneBy:null}:{};Ye(l=>l.map(d=>d.id===t?{...d,...i,stage:a}:d),()=>tt({id:t,...i,stage:a}),"Setting the status")},Us=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],np=(t,e)=>{let s=Math.max(0,Us.findIndex(d=>d[0]===t)),[,o,a,i]=Us[s],l=Us[(s+1)%Us.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}">${Jc(i,a)}<span>${o}</span></button>`},sl=(t,e,s,o,a=!1,i=!1,l=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${n.client?"":np(t,s)}${l?"":ti(Is(e).id,s,a)}</span>${n.client?"":`<span class="dt-who">${i?"":Zr(o,s)}${Qr(s?R.find(d=>d.id===s):void 0,o,s,i)}</span>`}</div>`,Xo='<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>',sp=t=>{let e=ie(t?.querySelector("h1, h2, h3, h4, h5, h6")?.textContent??t?.innerText?.split(`
260
- `).find(s=>ie(s))??"");return e?e.length>30?`${Zt(e,30)}\u2026`:e:t?.tagName.toLowerCase()??""},ol='<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>',al='<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>',il='<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>',ei='<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>',ni='<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>',si='<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>',rl=t=>{let e=(a,i,l,d="")=>`<option value="${a}" data-icon="${f(i)}"${d}>${l}</option>`,s=t&&Ke()?qt(t)?(Io(t)?"":e("mirror",Do,"Mirror to Team"))+(t.client?"":e("move",ni,"Move to Team")):e("dup",ei,"Duplicate for the client")+e("move",ni,"Move to Client"):"",o=t&&n.client&&t.status==="done"?e("reopen",dn,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${al}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
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>
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
+ <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
265
  <option value="" hidden selected></option>
262
- ${s}${o}${t?e("link",si,"Copy link"):""}${t&&!n.client&&t.id>0?e(Me(t)?"unarchive":"archive",yn,Me(t)?"Out of the archive":"Archive"):""}
263
- ${e(t?"rm":"discard",Vn,t?"Delete thread":"Discard draft",` data-danger${t?" data-sep":""}`)}
264
- </select></label>`},Jo=()=>n.studio?(n.team??[]).filter(t=>n.studio.includes(t.email)):[],ll=t=>{let e=t||n.lead||"",s=Jo();return!s.length||s.some(o=>o.email===e)?e:s[0].email},op=t=>{let e=ll(t),s=Jo();if(!s.length)return"";let o=Uu(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${Vr(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
265
- ${s.map(a=>Jr(a.email,a.name||a.email,{dot:!0,selected:e===a.email})).join("")}
266
- </select></span></label>`},Ys='<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>',dl='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',ap='<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>',ip=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,rp=(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"),c=s.querySelector(".dt-voice-time"),p=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${p()?Math.min(1,o.currentTime/p()):0})`,c.textContent=ip(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=ap,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=dl,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let i=()=>{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)?i():l(),{once:!0}):i();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,i()},{once:!0}),o.currentTime=1e9}},oi=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),cl=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Xs=new Map,lp=t=>{if(!t.startsWith("data:"))return t;let e=Xs.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]})),Xs.set(t,e),Xs.size>8){let[a,i]=Xs.entries().next().value;URL.revokeObjectURL(i),Xs.delete(a)}}return e},dp=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${dl}</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="${lp(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">${$p}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${Ys}</button>`}</span>`,ai=t=>t.length>30?`${Zt(t,17)}\u2026${[...t].slice(-11).join("")}`:t,cp=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`},ii=t=>{let e=hc(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},up=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",i=`${ii(e)}<span class="dt-file-text"><b>${f(ai(e))}</b>${o?"":`<small>${cp(t)}</small>`}</span>`;return`<span class="dt-file" title="${f(e)}">${o?`<a class="dt-file-open" href="${f(dr(e)?t:a)}"${dr(e)?' target="_blank" rel="noreferrer"':` download="${f(e)}"`}>${i}</a><a class="dt-tip-r dt-file-get" href="${f(a)}" download="${f(e)}" aria-label="Download ${f(e)}" data-tip="Download">${hp}</a>`:`<span class="dt-file-open">${i}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${Ys}</button>`}</span>`},pp=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${f(s)}"><span class="dt-file-open">${ii(s)}<span class="dt-file-text"><b>${f(ai(s))}</b><small>${f(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${Ys}</button></span>`},mp=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${f(s)}"><span class="dt-file-open">${ii(s)}<span class="dt-file-text"><b>${f(ai(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">${Ys}</button></span>`},ul=(t,e,s=t)=>t.startsWith(Zo)?pp(t,e??""):t.startsWith(li)?mp(t,e??""):yo(s)?up(t,yo(s),e):oi(s)?dp(t,e):`<span class="dt-shot${cl(s)?" dt-shot--video":""}">${cl(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">${Ys}</button>`}</span>`,ri=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=rr(o);return ul(a,e===void 0?void 0:`data-id="${e}" data-img="${f(o)}"`,o)}).join("")}</div>`:"",pl=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>ul(e,`data-i="${s}"`)).join("")}</div>`:"",hp='<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>',gp='<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>',Zo="refused:\0",li="big:\0",Qo=new Map,ws=t=>!t.startsWith(li),fp='<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>',bp='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',yp=90,di=32,vp=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",ta=!1,wp=async(t,e)=>{if(ta||!t)return;let s=Number(t.dataset.id)||0;ta=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Ut("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(bt){clearTimeout(o),ta=!1,e.classList.remove("is-asking");let Ot=bt?.name;Ut(Ot==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Ot==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Ot==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${bt?.message||Ot||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let i=()=>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">${Vn}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(di)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${bp}</button>`;let d=l.querySelector("b"),c=[...l.querySelectorAll(".dt-rec-wave i")],p=new AudioContext,v=p.createAnalyser();v.fftSize=512,p.createMediaStreamSource(a).connect(v);let A=new Uint8Array(v.fftSize),j=[],h=new MediaRecorder(a,{audioBitsPerSecond:32e3}),G=[],z=Date.now(),It=!0,Bt=setInterval(()=>{let bt=i();if(!bt){le(!1);return}l.parentElement!==bt&&bt.appendChild(l),v.getByteTimeDomainData(A);let Ot=0;for(let Ct of A)Ot+=((Ct-128)/128)**2;j.push(Math.min(1,Math.sqrt(Ot/A.length)*4));let kt=j.slice(-di);c.forEach((Ct,_t)=>{let ke=kt[_t-(di-kt.length)];Ct.style.transform=`scaleY(${Math.max(.1,ke??0).toFixed(2)})`,Ct.classList.toggle("is-empty",ke===void 0)});let Lt=Math.floor((Date.now()-z)/1e3);d.textContent=`${Math.floor(Lt/60)}:${String(Lt%60).padStart(2,"0")}`,Lt>=yp&&h.state!=="inactive"&&h.stop()},90),le=bt=>{It=bt,h.state!=="inactive"&&h.stop()};l.querySelector(".dt-rec-x").addEventListener("click",bt=>{bt.stopPropagation(),le(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",bt=>{bt.stopPropagation(),le(!0)}),l.addEventListener("keydown",bt=>{bt.key==="Escape"&&(bt.stopPropagation(),le(!1))}),h.ondataavailable=bt=>{bt.data.size&&G.push(bt.data)},h.onstop=async()=>{if(clearInterval(Bt),a.getTracks().forEach(kt=>kt.stop()),p.close().catch(()=>{}),l.remove(),ta=!1,!It)return;let bt=new Blob(G,{type:h.mimeType||"audio/webm"}),Ot=await new Promise(kt=>{let Lt=new FileReader;Lt.onload=()=>kt(String(Lt.result)),Lt.readAsDataURL(bt)});s?Ee.push(Ot):N&&(N.images??=[]).push(Ot),Z(),i()?.querySelector("textarea")?.focus()},h.start(1e3),i()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},ml="\u{1F3A4} Voice note",$p='<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>',xp=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?N?.images??[]:Ee)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await ae("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),i=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!i.text){Ut(i.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()} ${i.text}`:i.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},gn=new Map,ci=new Map,ui=async(t,e,s)=>{let o=`${t}:${e}`;if(ci.delete(o),!s){gn.delete(o),Z();return}let a=R.find(c=>c.id===t),i=a&&en(a).find(c=>(c.at??"0")===e);if(!i?.text)return;gn.set(o,{to:s,text:null}),Z();let l=await ae("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:i.text,to:s})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};gn.get(o)?.to===s&&(l?.ok&&d.text?gn.set(o,{to:s,text:d.text}):(gn.delete(o),ci.set(o,s)),Z())},Ep=(t,e,s)=>{let o=gn.get(`${t}:${e}`),a=Aa(s),i=(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">${Mp}</span>`:Lp}<span aria-hidden="true">${Ks}</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(yr(a))}`:"Translate into"}</option>${Rc(s,navigator.language||"en").map(l=>`<option value="${f(l)}" data-bare${l===i?' data-note="your language"':""}${o?.to===l?" selected":""}>${f(Bc(l))}</option>`).join("")}<option value="orig" data-sep data-icon="${f(dn)}"${o?"":" disabled"}>Show original</option></select></label>`},Mp='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M10 3a7 7 0 1 0 7 7"/></svg>',kp=(t,e,s)=>{let o=`${t}:${e}`,a=Aa(s);if(gn.get(o)?.text)return`<p class="dt-tr-note">Translated from ${a?f(yr(a)):"another language"} \xB7 <button type="button" data-act="tr-orig" data-id="${t}" data-at="${f(e)}">Show original</button></p>`;let i=ci.get(o);return i?`<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(i)}">Try again</button></p>`:""},Lp='<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>',Sp='<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>',hl='<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>',pi=()=>n.me?.email??"you",Tp=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,i])=>{let l=i.includes(pi()),d=i.map(c=>c===pi()?"You":mn(c)).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} ${i.length}: ${d}`)}">${f(a)}<span>${i.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">${hl}</button></div>`:""},gl=(t,e,s)=>{ea();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?yc:bc).map(v=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${f(v)}" aria-label="${f(v)}">${f(v)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${al}</button>`),En={...s,btn:t},nt.append(o);let a=t.getBoundingClientRect(),i=o.getBoundingClientRect(),l=6,d=8,c=a.top-l-i.height>=d;o.style.top=`${c?a.top-l-i.height:Math.min(a.bottom+l,innerHeight-d-i.height)}px`;let p=(t.closest(".dt-note")??t).getBoundingClientRect().right;o.style.left=`${Math.min(Math.max(d,p-i.width),innerWidth-d-i.width)}px`,o.querySelector("button")?.focus()},En=null,ea=()=>{nt.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),En=null},Ap=(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()},fl=(t,e,s)=>{let o=a=>{let i=vc(a.reactions,s,pi());return i===null?a:{...a,reactions:i}};Ye(a=>a.map(i=>i.id!==t?i:e?{...i,replies:i.replies?.map(l=>l.at===e?o(l):l)}:o(i)),()=>tt({id:t,react:{at:e,emoji:s}}),"The reaction")},Hp='<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>',mi=1e4,bl=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
267
- <textarea class="${t}" rows="1" maxlength="${mi}" aria-label="${e}" placeholder="${e}">${f(s)}</textarea>
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"):""}
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">
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">
271
+ <textarea class="${t}" rows="1" maxlength="${Hi}" aria-label="${e}" placeholder="${e}">${f(s)}</textarea>
268
272
  ${a}
269
273
  <div class="dt-compose-bar">
270
- <span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${Hp}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${gp}</button>
271
- ${vp()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${fp}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${Sp}</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">${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>
272
276
  <button class="dt-send${s.trim()?" is-ready":""}" ${o} title="Send (Enter)"
273
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>
274
278
  </div>
275
- </div></div>`,na=(t,e,s)=>(t||/^[a-z][a-z0-9-]*/i.exec(s?.split(">").pop()?.trim()??"")?.[0]||"element")+(e?.[0]?"."+e[0]:""),yl=()=>De.map((t,e)=>({i:e,el:na(t.tag,t.classes,t.selector),text:ie(t.text??""),shots:t.images?.length??0,orphan:!Te(t)})),hi=[],vl="",Mn=t=>{let e=t.working;return Wn(e?.agent,e?.by??t.doneFor)},Cp=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`},sa=(t,e)=>{let s=t.working;return{queued:"Queued for the agent \u2014 it takes it on its next run",asks:`${Mn(t)} is waiting for your answer`,working:`${Mn(t)} is on it \xB7 ${Cp(s?.at)}`,stuck:`${Mn(t)} went quiet \u2014 its next run takes it again`,review:`To check \u2014 ${Wn(t.doneAgent,t.doneFor)} fixed it \xB7 click to reopen`,done:"Resolved"}[e]},Np=t=>{if(n.client||qt(t))return"";let e=we(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">${$r(13,0)}</button>`;let s=$r(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${f(sa(t,e))}" aria-label="${f(sa(t,e))}">${s}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${f(sa(t,e))}" role="img" aria-label="${f(sa(t,e))}">${s}</span>`},$s=t=>!!n.client&&!(n.me&&t.by===n.me.email),wl=(t,e=!0,s=!0)=>{let o=Dt(t),a=o==="done",i=Me(t);return`${e?Np(t):""}<button data-act="${a?"reopen":"done"}" data-id="${t.id}"
276
- class="dt-note-resolve${a&&!i?" is-on":""}" title="${a?"Reopen":o==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${$e}</button>${n.client||!s?"":`<button data-act="${i?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${i?" is-on":""}" title="${i?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${yn}</button>`}`},Bp='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',gi=new Map,Rp=(t,e)=>{let s=fr(e,25),o=gi.get(t);o?.now!==s&&gi.set(t,{now:s,was:o?.now??"",at:performance.now()});let a=gi.get(t),i=a.was&&performance.now()-a.at<160?a.was:"";return`<span class="dt-step-words">${i?`<span class="dt-step-was" data-k="was:${f(i)}" aria-hidden="true">${f(i)}</span>`:""}<span class="dt-step-now" data-k="${f(s)}"${s!==e?` data-tip="${f(e)}"`:""}>${f(s)}</span></span>`},Pp=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!Me(t)){let p=t.confirmedBy?t.confirmedBy===n.me?.email?"you":mn(t.confirmedBy).split(" ")[0]:"",v=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${Ve(Pn[Pn.length-1][2],1)}<span class="dt-step-text"><b>${f(p?`Resolved by ${p}`:"Resolved")}${v?` \xB7 ${f(wr(v))}`:""}</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">${dn}</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">${yn}</button></div>`)}if(n.client||qt(t))return"";let e=we(t),s={act:"hand",v:"me",icon:ol,tip:n.me?"Take it myself":"Take it off the agent"},o=[{act:"sendback",icon:dn,tip:"Send it back \u2014 say what is wrong below"},{act:"accept",icon:$e,tip:"Looks right \u2014 mark it resolved",main:!0,label:"Looks right"}],a=br(t),i=!Jt(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":mn(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:Re(t)==="review"&&i?{step:"review",title:`${i} ${i==="You"?"say":"says"} done`,acts:o}:null;if(!d)return"";let c=d.step==="review"?Ve(Rn[2][2],Rn[2][3]):`<i class="dt-step-mark">${Pe(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${c}${d.now?`${Bp}<span class="dt-step-text" aria-live="polite"><b>${Rp(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(p=>p.pick?`<label class="dt-step-act" data-tip="${f(p.tip)}">${p.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${f(p.tip)}"><option value="" selected hidden></option>${Vs().map(v=>Jr(v.email,v.email===n.me?.email?`Me \xB7 ${v.name||v.email}`:v.name||v.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${p.main?" is-main":""}${p.label?" has-label":""}" data-act="${p.act}" data-id="${t.id}"${p.v?` data-v="${p.v}"`:""} data-tip="${f(p.tip)}" aria-label="${f(p.tip)}">${p.icon}${p.label?f(p.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},Ip=async(t,e,s)=>{let o=e?R.find(i=>i.id===t):void 0,a=await tt(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...s});return a.ok&&o&&Fi(Ce(o)).then(i=>{i&&tt({id:t,after:i.url})}),a},ns=0,$l=()=>{},In=t=>(ns++,t.finally(()=>{ns--,$l()})),Ye=async(t,e,s)=>{let o=R,a=vt;R=t(R),vt=t(vt),Z();let i;dt=o;try{i=e()}finally{dt=null}let l=await In(i).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let p=qn([d.thread])[0];R=(ns?R:o).map(A=>p&&A.id===p.id?p:A),vt=(ns?vt:a).map(A=>p&&A.id===p.id?p:A),Z();let v=d.by?d.by==="claude"?"The agent":mn(d.by):"Someone";Ut(`${v[0].toUpperCase()}${v.slice(1)} changed the ${d.field} just now`,6e3),Ze();return}if(!l?.ok){ns?Ze():(R=o,vt=a,Z()),Dn(`${s} did not go through`,l);return}let c=qn([await l.json().catch(()=>null)])[0];c&&(R=R.map(p=>p.id===c.id?c:p),vt=vt.map(p=>p.id===c.id?c:p),Z()),Ze()},Op=t=>t?Jt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!qt(t)&&!n.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},xl=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},Xe=async(t,e)=>{let s=e?void 0:Op(R.find(l=>l.id===t)??vt.find(l=>l.id===t));await Ye(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),()=>Ip(t,e,s),e?"Resolving":"Reopening");let o=vt.find(l=>l.id===t),a=e?Ac(o):null,i=a!=null&&vt.find(l=>l.id===a);i&&qt(i)&&i.status!=="done"&&(await tt({id:i.id,reply:Tc,status:"done",doneBy:"you"}).catch(()=>null),Ze())},ss=async(t,e,s=!1)=>{let o=R.find(i=>i.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await Ye(i=>i.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&&Be(`Archived #${t}`,()=>ss(t,!1,!0))},Be=(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>`,Pa(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>Un(o,()=>o.remove()),5e3)},oa=new Set,aa=new Set,Js=new Map,El=(t,e,s,o,a)=>{Js.get(t)?.(),s();let i=!1,l=()=>{i||(i=!0,clearTimeout(d),Js.delete(t),a())},d=window.setTimeout(l,5e3);Js.set(t,l),Be(e,()=>{i||(i=!0,clearTimeout(d),Js.delete(t),o())})};addEventListener("pagehide",()=>{for(let t of[...Js.values()])t()});let Ml=(t,e,s)=>!e||t.some(o=>o.id===e.id)?t:[...t.slice(0,s),e,...t.slice(s)],fi=t=>{let e=R.find(i=>i.id===t),s=R.findIndex(i=>i.id===t),o=vt.find(i=>i.id===t),a=vt.findIndex(i=>i.id===t);El(`t${t}`,`Thread #${t} deleted`,()=>{oa.add(t),R=R.filter(i=>i.id!==t),vt=vt.filter(i=>i.id!==t),Z()},()=>{oa.delete(t),R=Ml(R,e,s),vt=Ml(vt,o,a),Z()},async()=>{let i=await In(ae(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);oa.delete(t),i?.ok||Dn("Deleting did not go through",i),Ze()})},qp=(t,e)=>{let s=`${t}|${e}`,o=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=o(R)??o(vt);if(!a)return;let i=(l,d)=>l.map(c=>c.id!==t?c:{...c,replies:(c.replies??[]).map(p=>p.at===e?d(p):p)});El(`r${s}`,"Reply deleted",()=>{aa.add(s),R=i(R,l=>({...l,text:"",deleted:!0})),vt=i(vt,l=>({...l,text:"",deleted:!0})),Z()},()=>{aa.delete(s),R=i(R,()=>a),vt=i(vt,()=>a),Z()},async()=>{let l=await In(tt({id:t,unsay:e})).catch(()=>null);aa.delete(s),l?.ok||Dn("Deleting the reply did not go through",l),Ze()})},xs=null,kl=t=>Math.max(70,t*18),Ll=t=>{let e=Dt(t),s=Us.find(o=>o[0]===t.priority)?.[3]??1;return(t.id===X?-100:0)+(Me(t)?30:e==="done"?20:e==="claude"?10:0)-s},Dp=(t,e)=>{let s=[];for(let a of t){let i=e.get(a.id);if(!i)continue;let l=s.find(d=>{let c=e.get(d[0].id);return Math.abs(c.x-i.x)<6&&Math.abs(c.y-i.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((c,p)=>Ll(c)-Ll(p)||p.id-c.id);let i=a.length,l=kl(i),d=String(a[0].id);a.forEach((c,p)=>{let v=(-150+120*p/(i-1))*(Math.PI/180);o.set(c.id,{key:d,i:p,n:i,fx:Math.round(l*Math.cos(v))-14,fy:Math.round(l*Math.sin(v))+4})})}return o},bi=t=>{if(xs!==t){xs=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(!xs){let i=t.target?.closest?.(".dt-pin--stacktop");i&&t.pointerType==="mouse"&&bi(i.dataset.stack);return}let e=nt.querySelector(`.dt-pin--stacktop[data-stack="${xs}"]`);if(!e){xs=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))>kl(a)+36&&bi(null)},{passive:!0}),nt.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),bi(e.dataset.stack))},!0);let Fp=(t,e)=>{let s=e||x||N?[]:m.filter(d=>d.id!==t).map(d=>({band:d,n:R.filter(c=>y(c)===d.id&&Po(c)&&$n(c)).length})).filter(d=>d.n).sort((d,c)=>c.n-d.n);if(ge.hidden=!s.length,!s.length)return;let[o,...a]=s,i=({band:d,n:c})=>`${c} ${c===1?"pin":"pins"} on ${d.label}`;ge.dataset.bp=o.band.id;let l=`${xt(o.band.icon,15)}<span>${f(i(o))}</span>${Ca}`;ge.dataset.html!==l&&(ge.innerHTML=l,ge.dataset.html=l),ge.dataset.tip=a.length?`Also ${a.map(i).join(", ")}`:`Switch to ${o.band.label}`,ge.setAttribute("aria-label",`${i(o)} \u2014 switch to ${o.band.label}`)};ge.addEventListener("click",()=>{ge.dataset.bp&&Ui(ge.dataset.bp)});let jp=t=>{let e=R.filter(a=>y(a)===t),s=e.filter(a=>Dt(a)==="open").length,o=e.filter(a=>Dt(a)==="claude").length;Ra.innerHTML=s?String(s):o?Pe(9):"\u2713",Ra.dataset.state=s?"open":o?"claude":"done",Ra.hidden=e.length===0},Zs=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t||(t.style.translate="",os))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`)},Sl=window.visualViewport?.height??innerHeight,Tl=()=>{let t=window.visualViewport?.height??innerHeight,e=t<Sl;if(Sl=t,!e||!nt.querySelector(".dt-note"))return Zs();Z();let s=document.activeElement?.closest(".dt-note.is-capped");s&&(s.scrollTop=s.scrollHeight)};window.visualViewport?.addEventListener("resize",Tl),addEventListener("resize",Tl),document.addEventListener("focusin",Zs),document.addEventListener("focusout",()=>setTimeout(Zs));let ia=()=>{let t=window.visualViewport;return Math.min(innerHeight,t?t.offsetTop+t.height:innerHeight,document.querySelector(".devtools:not([data-collapsed])")?.getBoundingClientRect().top??innerHeight)-8},yi=!1,Al=null,_p=()=>{if(X===Al||(Al=X,rt.hasAttribute("data-collapsed")&&!yi))return;let t=X!=null?R.find(o=>o.id===X):void 0,e=t&&Te(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&&(os||e.y>o.top&&e.y<o.bottom)}yi=s,rt.toggleAttribute("data-collapsed",s)},Hl=t=>{let e=rt.hidden?null:rt.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},Cl=(t,e=ia())=>{if(t.style.marginTop="",os)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`)},vi=t=>{let e=ia();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 v of["max-height","overflow-y","margin-top","translate"])s.style.removeProperty(v);s.classList.remove("is-capped");let i=s.getBoundingClientRect(),l=i.top,d=e-l,c=l-28;if(i.bottom>e&&c>d&&(s.dataset.flip="1"),i.right>Hl(i)-8&&(s.dataset.flipx="1"),s.style.marginLeft="",s.dataset.flipx&&innerWidth>=480){let v=s.getBoundingClientRect(),A=Hl(v);v.right>A-8&&(s.style.marginLeft=`${(parseFloat(getComputedStyle(s).marginLeft)||0)-(v.right-A+8)}px`)}i=s.getBoundingClientRect();let p=s.dataset.flip?i.height-(e-8):i.bottom-e;p>0&&o&&(o.style.maxHeight=`${Math.max(40,o.clientHeight-p)}px`),s.getBoundingClientRect().height>e-8&&(Object.assign(s.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),s.classList.add("is-capped"),Br.has(s)?s.scrollTop=a:(Br.add(s),s.scrollTop=s.scrollHeight)),Cl(s,e)}for(let s of t)s.scrollTop=s.scrollHeight},Nl=0,os=!1,ra=t=>{t?.target?.closest?.(fs)||(clearTimeout(Nl),Nl=window.setTimeout(()=>{os=!1,nt.querySelector(".dt-note")&&(vi([]),requestAnimationFrame(Zs),Je())},os?300:150))},Z=()=>{for(let h of Object.keys(qe))h!==String(X)&&delete qe[h];for(let h of vs.keys())h!==X&&vs.delete(h);if(requestAnimationFrame(Zs),Qn(),x){let h=yl(),G=JSON.stringify(h);G!==vl&&(vl=G,parent.postMessage({dt:!0,drafts:h},location.origin))}if(Or(),rt.toggleAttribute("data-yield",X!=null||!!N),X!==un){un!=null&&(Ae||Ee.length)?Oa.set(un,{text:Ae,images:[...Ee]}):un!=null&&Oa.delete(un);let h=X!=null?Oa.get(X):void 0;Ae=h?.text??"",Ee=h?[...h.images]:[],un=X}Qt&&Qt.id!==X&&(Qt=null);let t=Xt();if(jp(t),Da(),!Kt){nt.innerHTML="",Ga(null),Ge.hidden=!0,ge.hidden=!0;return}let e=t;if(X!=null&&!N){let h=R.find(G=>G.id===X);h&&y(h)!==e&&(X=null)}_p();let s="",o=R.filter(h=>y(h)===e&&(Po(h)&&$n(h)||h.id===X)),a=new Map(o.map(h=>[h.id,Te(h)])),i=Dp(o,a);_o="";for(let h of o){let G=a.get(h.id)??null,z=i.get(h.id),It=jo(h),Bt=Fr(h,It)?"later":It;Bt==="later"&&(zs=Math.min(zs??1/0,h.spot.y)),h.id===X&&(_o=Bt+(G?"":" \xB7 no pin"));let le=!G&&!!h.spot&&Dt(h)==="open"&&Bt==="gone";if(!G&&!le&&X!==h.id)continue;let bt=Dt(h),Ot=!G,kt=G??(le?{x:h.spot.x-scrollX,y:h.spot.y-scrollY}:{x:0,y:0});Bt!=="later"&&Fu(h,bt==="open"?Bt:"found"),le&&(s+=`<button class="dt-pin dt-pin--ghost" data-id="${h.id}" aria-expanded="${X===h.id}" aria-label="Thread ${h.id}, its element is gone" title="${f(Zt(h.text,80))} \xB7 its element is gone \u2014 click to see what it was" style="left:${kt.x}px;top:${kt.y}px"></button>`);let Lt=Is(h.category),Ct=ln(h),_t=bt==="done"?null:we(h),ke=_t?Ko[_t]??"":"",pe=vo(h,bt),nr=!!pe&&!pe.taker,Ln=!!pe&&!!pe.taker&&pe.taker!==pe.writer,rn=bt==="done"?vo(h,"open"):null,go=!!rn&&!rn.claude&&!!rn.taker&&rn.taker!==rn.writer,M=ke||Rn.find(K=>K[0]===es(h))[2],V=pe?nr?` \xB7 ${Ja(pe.writer,h)} \xB7 anyone can take it`:` \xB7 ${Ln?`${Ja(pe.writer,h)} \u2192 `:""}${Ja(pe.taker,h)}${pe.claude?` \xB7 ${Mn(h)}${Qa(h)}`:""}`:"";if(X===h.id&&(vs.has(h.id)||vs.set(h.id,Math.max(2,en(h).length-(Bn[h.id]??en(h).length))),Yr(h)),Ot||(s+=`<button class="dt-pin dt-pin--${bt}${bt==="done"&&!Me(h)?" dt-pin--resolved":""}${pe?` dt-pin--people${Ln?" dt-pin--pair":""}`:go?" dt-pin--people dt-pin--pair":ke?" dt-pin--agent":""}${Ct?" dt-pin--working":""}${bt==="open"&&Re(h)==="review"?" dt-pin--review":""}${G?.hidden?" dt-pin--hidden":""}${Bt==="probably"?" dt-pin--probably":""}${G?.opener?" dt-pin--inside":""}${X!==h.id&&!nl(h,xn)?" dt-pin--dim":""}${z?` dt-pin--stack${z.i?"":" dt-pin--stacktop"}${xs===z.key?" is-fanned":""}`:""}" data-id="${h.id}"${z?` data-stack="${z.key}"`:""} aria-label="Thread ${h.id}, ${bt==="open"?"open":bt==="claude"?`resolved by ${f(Wn(h.doneAgent,h.doneFor))}`:"resolved"}${f(V.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!pe&&ke?`, with ${f(Mn(h))}`:""}${G?.hidden?Co:""}" aria-expanded="${X===h.id}"
277
- style="left:${kt.x}px;top:${kt.y}px;--cat:${Lt.color};--ring:${M};--hue:${Ne(h.by||h.byName||"")}${ke?`;--step-c:${ke}`:""}${$i.has(h.id)?`;--dt-page:${$i.get(h.id)}`:""}${z?`;--fx:${z.fx}px;--fy:${z.fy}px`:""}"
278
- title="${f(Zt(h.text,80))} \xB7 ${Lt.label}${pe?f(V):Ct||_t==="queued"?` \xB7 ${f(Mn(h)+Qa(h))}`:""}${bt==="claude"?` \xB7 resolved by ${f(Wn(h.doneAgent,h.doneFor))} \u2014 tick to confirm`:bt==="done"?" \xB7 resolved":""}${G?.hidden?Co:""}${ro(h)?" \u2014 drag to move":""}"${ro(h)?" data-move":""}>${bt==="done"?rn?`${hn(rn.writer,h)}${go?hn(rn.taker,h):""}<i class="dt-pin-cut" aria-hidden="true">${$e}</i>`:"\u2713":pe?`${hn(pe.writer,h)}${Ln?hn(pe.taker,h):""}${pe.claude?`<i class="dt-pin-claude" aria-hidden="true">${Pe(9)}</i>`:""}`:ke?Pe(11):Ya(h)}${X!==h.id&&Ur(h)?'<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>`:""}${G?.opener?'<i class="dt-pin-inside" aria-hidden="true"></i>':""}</button><i class="dt-pin-eye" data-eye="${h.id}" aria-hidden="true" style="left:${kt.x}px;top:${kt.y}px"${G?.hidden?"":" hidden"}>${Xo}</i>`),X===h.id){let K=en(h),ut=we(h)==="review"&&!n.client?K.map(_=>_.author).lastIndexOf("claude"):-1,lt=we(h)==="asks"&&!n.client?K.length-1:-1;s+=`<div class="dt-note${Ot?" dt-note--orphan":""}" data-id="${h.id}" role="dialog" aria-label="Thread ${h.id}"
279
- style="left:${kt.x}px;top:${kt.y}px">
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">
280
284
  <div class="dt-note-bar">
281
- ${h.id>0&&!(n.client||qt(h))?`<span class="dt-note-num">#${h.id}</span>`:""}${h.by||h.byName?`<i class="dt-note-pin" style="--pin-c:${M}" aria-hidden="true">${hn((h.by||h.byName||"").toLowerCase(),h)}</i>`:""}
282
- <span class="dt-note-el"${n.client?"":` data-tip="${el(h.selector,h.label)}"`}>${n.client||qt(h)?`Thread #${h.id>0?h.id:"\u2026"}`:f(na(h.tag,h.classes,h.selector))}</span>
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>
283
287
  <span class="dt-note-tools">
284
- ${wl(h,!1,!1)}
288
+ ${Nl(p,!1,!1)}
285
289
  <i class="dt-note-sep"></i>
286
- ${$s(h)?"":rl(h)}
287
- <button data-act="close" data-id="${h.id}" data-tip="Close" aria-label="Close">${Sn}</button>
290
+ ${As(p)?"":vl(p)}
291
+ <button data-act="close" data-id="${p.id}" data-tip="Close" aria-label="Close">${Pn}</button>
288
292
  </span>
289
293
  </div>
290
- ${_u(h,G,Bt,Ot)}
291
- ${(_=>`<div class="dt-note-hidden"${G?.hidden?"":" hidden"}><b>${Xo}<span>${_?`Hidden in \xAB${f(_)}\xBB`:"Hidden right now"}</span></b><button type="button" data-act="where" data-id="${h.id}">Show where</button><button type="button" class="dt-note-hidden-more" data-act="hidden-why" aria-expanded="false" aria-label="Why" data-tip="Why">${Ks}</button><p hidden>It sits inside ${_?`\xAB${f(_)}\xBB`:"something"}, which is closed. Open it on the page and the pin moves onto the spot.</p></div>`)(sp(G?.shut&&G.shut!==G.el?G.shut:G?.hidden))}
292
- ${Ot&&Bt!=="gone"&&Bt!=="later"?ju(h):""}
293
- ${(()=>{let _=Zu(h)+ti(Is(h.category).id,h.id,$s(h))+Lu(h)+(h.host&&h.host!==location.host?`<span class="dt-note-host" title="Written on ${f(h.host)}">${f(h.host)}</span>`:"");return _?`<div class="dt-note-meta">${_}</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
298
  <div class="dt-note-thread">
295
- ${Qu(h,K.map((_,st)=>{let at=st===0?null:_.at??null,te=_.author==="you"&&(!_.by||_.by===n.me?.email),ze=te&&Qt?.id===h.id&&Qt.at===at,_n=n.team?.find(cs=>cs.email===_.by),Bs=_.author==="claude"?Wn(_.agent,_.by):te?"You":_n?.name||_.byName||_.by||"You",oc=_.author==="claude"?`<span class="dt-msg-face dt-msg-ai">${Pe(11)}</span>`:(cs=>Nn(_n?.avatar_url,_n?.name||_.byName||(te?n.me?.name:"")||_.by||Bs,"dt-msg-face").replace(/^<(img|b) /,`<$1 style="--hue:${Ne(cs)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"))((_.by||(te?n.me?.email??"":"")||Bs).toLowerCase()),sr=`${h.id}:${_.at??"0"}`,ac=gn.get(sr)?.text,or=!te&&n.voice&&_.text?Ep(h.id,_.at??"0",_.text):"",ic=or?kp(h.id,_.at??"0",_.text):"",Ma=h.id<=0?null:st===0?"":h.replies?.some(cs=>cs.at===_.at)?_.at:null,ar=Ma===null?"":Tp(h.id,Ma,_.reactions),Dm=Ma!==null&&!ar?`<button class="dt-msg-edit" data-act="react-pick" data-id="${h.id}" data-at="${f(Ma)}" data-tip="Add reaction" aria-label="Add reaction">${hl}</button>`:"",rc=_.author==="claude"?[pr(_.agent),_.by&&_.by!==n.me?.email?(_n?.name||_.by).split(" ")[0]:""].filter(Boolean).join(" \xB7 "):"",ir=`<div class="dt-msg-head">${oc}<b>${f(Bs)}</b>${rc?`<span class="dt-msg-sub">${f(rc)}</span>`:""}<time>${zn(_.at)}</time>${Dm}${or}${te&&!ze?`<button class="dt-msg-edit" data-act="edit" data-id="${h.id}" data-at="${f(at??"")}" title="Edit">${Gn}</button>${at?`<button class="dt-msg-edit" data-act="unsay" data-id="${h.id}" data-at="${f(at)}" title="Delete">${Vn}</button>`:""}`:""}</div>`;return st===ut?`<div class="dt-msg dt-msg--done" data-msg="${h.id}:${f(_.at??"0")}"><div class="dt-msg-head">${oc}<b>${f(Bs)} fixed it</b><time>${zn(_.at)}</time>${or}</div><p${gn.get(sr)?.text===null?' class="is-asking"':""}>${wd(ac||_.text)}</p>${ic}${ri(_.images)}${ar}
296
- <div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${h.id}">${$e}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${h.id}">${dn}Send back</button></div></div>`:ze?`<div class="dt-msg">${ir}<div class="dt-compose">
297
- <textarea class="dt-note-edit-input" rows="1" maxlength="${mi}" aria-label="Edit the message">${f(Qt.text)}</textarea>
298
- ${ri(_.images.filter(cs=>!Qt.drop.includes(cs.split("/").pop())),h.id)}
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">
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)}
299
303
  <div class="dt-compose-bar">
300
304
  <button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
301
- <button class="dt-send${Qt.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${$e}</button>
305
+ <button class="dt-send${te.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${Me}</button>
302
306
  </div>
303
- </div></div>`:`<div class="dt-msg${te?" dt-msg--mine":""}${st===lt?" dt-msg--asks":""}" data-msg="${h.id}:${f(_.at??"0")}">${st===lt?ir.replace(`<b>${f(Bs)}</b>`,`<b>${f(Bs)} asks</b>`):ir}<p${gn.get(sr)?.text===null?' class="is-asking"':""}>${wd(ac||_.text)}</p>${ic}${st===0&&h.suggest?Xu(h.suggest):""}${ri(_.images)}${ar}</div>`}),Qt?.id===h.id?1/0:(vs.get(h.id)??2)+(ut===K.length-1||lt>=0?1:0))}
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))}
304
308
  </div>
305
- ${qe[h.id]?`<button type="button" class="dt-new-below" data-act="newbelow" data-id="${h.id}">${qe[h.id]} new ${qe[h.id]===1?"reply":"replies"} \u2193</button>`:""}
306
- ${Pp(h)}
307
- ${bl("dt-note-reply-input",we(h)==="asks"?`Answer ${f(Mn(h))}`:"Reply",Ae,`data-act="reply" data-id="${h.id}"`,pl(Ee))}
308
- ${sl(h.priority,h.category,h.id,h.assignee??"",$s(h),qt(h),!0)}
309
- </div>`}}De.forEach((h,G)=>{let z=Te(h);z&&(s+=`<button class="dt-pin dt-pin--draft" data-parked="${G}" data-act="draft-open" data-i="${G}"
310
- style="left:${z.x}px;top:${z.y}px" title="Draft, not sent \u2014 click to finish it">${Gr()}</button>`)});let l=N&&Te(N);if(N){let h=l?.x??0,G=l?.y??0;s+=`${l?`<span class="dt-pin dt-pin--draft" data-draft style="left:${h}px;top:${G}px">${Gr()}</span>`:""}
311
- <div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${h}px;top:${G}px">
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">
312
316
  <div class="dt-note-bar">
313
- <span class="dt-note-el"${n.client?"":` data-tip="${el(N.selector,N.label)}"`}>${n.client?"New thread":f(na(N.tag,N.classes,N.selector))}</span>
314
- ${Ds()?'<span class="dt-note-draft">Draft</span>':""}
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>
318
+ ${Js()?'<span class="dt-note-draft">Draft</span>':""}
315
319
  <span class="dt-note-tools">
316
320
 
317
- ${rl()}
318
- <button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${Sn}</button>
321
+ ${vl()}
322
+ <button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${Pn}</button>
319
323
  </span>
320
324
  </div>
321
325
  ${l?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
322
- ${(()=>{let z=l?Ce(N):null,It=z&&R.find(Bt=>Bt.id>0&&Dt(Bt)==="open"&&Ce(Bt)===z);return It?`<p class="dt-note-twin">Already open here: \u201C${f(Zt(It.text,60))}${It.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${It.id}">Open it</button></p>`:""})()}
323
- ${n.client?`<div class="dt-note-meta">${op(N.assignee)}</div>`:""}
324
- ${N.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">${Sn}</button></span>
325
- <span class="dt-suggest-was">Now: <del>${f(Zt(N.suggest.from,160))}${N.suggest.from.length>160?"\u2026":""}</del></span>
326
- <textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${f(N.suggest.to)}</textarea>
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>
327
331
  <span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
328
- <div class="dt-note-meta dt-note-type">${ti(Is(N.category).id,void 0,!1)}</div>
329
- ${bl("dt-note-input",N.suggest?"Why (optional)":"Comment",N.text??"",'data-act="save"',pl(N.images))}
330
- ${N.carried&&N.assignee?`<p class="dt-carried">${Du}<span>For ${f(sn(N.assignee)?.name||N.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">${Sn}</button></p>`:""}
331
- ${sl(N.priority,N.category,void 0,N.assignee??"",!1,!!N.shared,!0)}
332
- </div>`}let d=new Map([...nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(h=>[h.closest(".dt-note").dataset.id,{top:h.scrollTop,end:h.scrollTop+h.clientHeight>=h.scrollHeight-4}])),c=new Set([...nt.querySelectorAll("[data-msg]")].map(h=>h.dataset.msg)),p=nt.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Fp(e,vn.hidden?o.some(h=>!!a.get(h.id)):o.length>0),Sr(nt,s),p&&!nt.contains(document.activeElement)&&io(".dt-note-reply-input");let v=[],A=[];for(let h of nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let G=h.closest(".dt-note").dataset.id,z=d.get(G);if(!z){v.push(h),delete qe[G],h.parentElement.querySelector(".dt-new-below")?.remove();continue}let It=[...h.querySelectorAll("[data-msg]")].filter(bt=>!c.has(bt.dataset.msg));for(let bt of It)bt.classList.add("dt-msg--new");let Bt=z.end||String(Ho)===G;Bt&&A.push(h),h.scrollTop=Bt?h.scrollHeight:z.top;let le=It.filter(bt=>!bt.classList.contains("dt-msg--mine")).length;if(le&&!z.end&&String(Ho)!==G){qe[G]=(qe[G]??0)+le;let bt=qe[G],Ot=h.parentElement.querySelector(".dt-new-below")??h.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Ot.dataset,{act:"newbelow",id:G}),Ot.textContent=`${bt} new ${bt===1?"reply":"replies"} \u2193`}}for(let h of nt.querySelectorAll(".dt-new-below")){let G=h.closest(".dt-note")?.querySelector(".dt-note-thread");(!G||G.scrollTop+G.clientHeight>=G.scrollHeight-4)&&(delete qe[h.dataset.id],h.remove())}Ho=null,vi([...v,...A]),requestAnimationFrame(()=>nt.querySelectorAll(".dt-note-thread").forEach(No)),X==null?Ao=null:X!==Ao&&nt.querySelector(`.dt-note[data-id="${X}"]`)&&(Ao=X,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&io(`.dt-note[data-id="${X}"] .dt-note-reply-input`)),ue(e),Ga(Ka()),Je();for(let h of nt.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))_i(h);let j=nt.querySelector(".dt-note-input");j&&document.activeElement!==j&&(j.focus(),j.setSelectionRange(j.value.length,j.value.length))},wi=0,Wp=()=>{Li&&Kt&&!x&&zl();let t=!1,e=document.getAnimations().some(l=>l.playState==="running"),s=[],o=!1;for(let l of nt.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 p=R.find(v=>v.id===Number(l.dataset.id))?.spot;s.push([l,p?{x:p.x-scrollX,y:p.y-scrollY,el:document.body}:null]);continue}let d=R.find(p=>p.id===Number(l.dataset.id)),c=d&&Te(d);s.push([l,c&&l.matches(".dt-pin")&&Mu(c.el,c.x,c.y)?null:c]),c&&e&&_r(c.el)&&(t=!0)}for(let l of nt.querySelectorAll("[data-draft], [data-parked]")){if(l.classList.contains("dt-note--orphan"))continue;let d=l.dataset.parked?De[Number(l.dataset.parked)]:N;s.push([l,d?Te(d):null])}let a=(l,d,c)=>{Math.abs(parseFloat(l.style.left)-d)<.05||(l.style.left=`${d}px`,o=!0),Math.abs(parseFloat(l.style.top)-c)<.05||(l.style.top=`${c}px`,o=!0)};for(let[l,d]of s){let c=l.nextElementSibling;if(!d){l.style.visibility!=="hidden"&&(l.style.visibility="hidden"),c?.matches(".dt-pin-eye")&&!c.hidden&&(c.hidden=!0);continue}if(l.style.visibility&&(l.style.visibility=""),a(l,d.x,d.y),l.matches(".dt-pin[data-id]")){if(l.classList.contains("dt-pin--hidden")!==!!d.hidden){l.classList.toggle("dt-pin--hidden",!!d.hidden);for(let p of["title","aria-label"]){let v=(l.getAttribute(p)??"").replace(Co,"");l.setAttribute(p,d.hidden?v.replace(/( \u2014 drag to move)?$/,`${Co}$1`):v)}}c?.matches(".dt-pin-eye")&&(c.hidden!==!d.hidden&&(c.hidden=!d.hidden),d.hidden&&a(c,d.x,d.y))}l.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!d.hidden)}if(!zo.length&&(N||X!=null)){let l=Ka();l&&e&&_r(l)&&Ga(l)}let i=nt.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(i.length){let l=ia();for(let d of i)d.style.visibility!=="hidden"&&Cl(d,l)}Eu(N||X!=null?Ka():null),wi=o?0:wi+1,t&&Je(),clearTimeout(Bl),Bl=window.setTimeout(zp,150)},$i=new Map,Bl=0,zp=()=>{let t=new Map,e=o=>{let a=[],i="";for(let l=o;l;l=l.parentElement){let d=t.get(l);if(d!==void 0){i=d;break}if(a.push(l),/^(IMG|VIDEO|CANVAS|PICTURE|IFRAME)$/.test(l.tagName)){i="var(--dt-bg)";break}let c=getComputedStyle(l);if(c.backgroundImage!=="none"){i="var(--dt-bg)";break}let p=c.backgroundColor.match(/[\d.]+/g);if(p&&(p[3]===void 0?1:+p[3])>=.9){i=c.backgroundColor;break}}i||="#fff";for(let l of a)t.set(l,i);return i},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(),i=document.elementsFromPoint(a.x+a.width/2,a.y+a.height/2).find(l=>!Tn(l));i&&s.push([o,e(i)])}for(let[o,a]of s)$i.set(Number(o.dataset.id),a),o.style.setProperty("--dt-page",a)},Rl=t=>`dt-gfold:${n.project||location.host}:${t}`,ue=t=>{if(rt.hidden){rt.replaceChildren();return}if(rt.toggleAttribute("data-picking",!!He),Sr(rt,du({bp:t,notes:R.filter($n),breakpoints:m,bandOfNote:y,orphan:e=>!Te(e),statusTools:e=>wl(e,!1),tick:Vu,replied:Gu,rowMenu:Ku,menuFor:Cn,showResolved:Ue,showArchived:pn,archived:Me,drafts:vn.hidden?yl():hi,checks:x?0:da.toCheck().length,clients:Ke()&&Fe==="clients",marker:Gp,assign:zu,mirror:e=>Ke()?Fa(e)?"here":qt(e)&&Io(e)?"there":"":"",picking:He,pickable:bs,mirrorAll:qo()?R.filter(e=>$n(e)&&y(e)===t&&bs(e)).map(e=>e.id):[],draftFace:n.me?`<span class="dt-hist-face" style="--hue:${Ne(n.me.email)}">${Ya({by:n.me.email,byName:n.me.name})}</span>`:"",draftName:n.me?.name||"You",find:oe,forMe:Vp,forAgent:e=>!!we(e)&&Dt(e)!=="done",unread:Ur,archives:!n.client,deletable:e=>!$s(e),folded:rt.hasAttribute("data-collapsed"),shut:e=>mt.getItem(Rl(e))==="1",cap:Pl,keep:X})),Es){let e=rt.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Es.at,Es.at),Es=null}},Es=null,Pl=150,Vp=t=>{if(Dt(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||Dt(t)==="claude"||Re(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return en(t).some(s=>s.text.toLowerCase().includes("@"+e))},Gp=t=>{let e=we(t),s=Ko[e??""],o=Dt(t)==="done"?Me(t)?`<i class="dt-hist-badge is-archived">${yn}</i>`:`<i class="dt-hist-badge is-done">${$e}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${Pe(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${Rn.find(i=>i[0]===es(t))[2]}"></i>`,a=Ya(t)||Nn(void 0,t.byName||(t.by==="you"||!t.by?"You":t.by)).replace(/>([^<])[^<]*<\/b>$/,">$1</b>");return`<span class="dt-hist-face" style="--hue:${Ne(t.by||t.byName||"you")}">${a}</span>`},la=t=>{yi=!1;let e=rt.hasAttribute("data-collapsed");if(t===e||rt.hidden){rt.toggleAttribute("data-collapsed",t),Z();return}let s=rt.querySelector(".dt-hist-head")?.offsetHeight??44;if(t){rt.setAttribute("data-folding",""),Mr(rt,rt.offsetHeight,s,!1,()=>{rt.removeAttribute("data-folding"),rt.setAttribute("data-collapsed",""),Z()});return}rt.removeAttribute("data-folding"),rt.removeAttribute("data-collapsed"),Z(),Mr(rt,s,rt.offsetHeight,!0,()=>{})},Il=t=>{let e=[];for(let s=t.nextElementSibling;s&&s.classList.contains("dt-hist-row");s=s.nextElementSibling)e.push(s);return e},Ol=t=>{let e=document.createElement("div");return e.className="dt-hist-rows",t[0].before(e),e.append(...t),e},Kp=t=>{let e=Rl(t),s=mt.getItem(e)==="1",o=rt.querySelector(".dt-hist-list"),a=o?.clientHeight??600,i=()=>rt.querySelector(`[data-gfold="${CSS.escape(t)}"]`)?.closest(".dt-hist-group");if(!s){let p=i(),v=p?Il(p):[],A=()=>{D(e,"1"),ue(Xt())};if(!v.length||!Kn())return A();let j=Ol(v);Na(j,!1,a),An(j).then(A);return}D(e,""),ue(Xt());let l=i(),d=l?Il(l):[];if(!d.length||!Kn())return;let c=Ol(d);c.hidden=!0,Na(c,!0,a),An(c).then(()=>{c.isConnected&&(c.before(...c.children),c.remove())})};rt.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(oe.q=e.value,Es={at:e.selectionStart??e.value.length},ue(Xt()))}),rt.addEventListener("click",async t=>{let e=t.target;if(e.closest("[data-hist-more]")){oe.more=!oe.more,Cn=null,oe.menu=!1,ue(Xt());return}let s=e.closest("[data-row-more]");if(s){let Lt=Number(s.dataset.rowMore);Cn=Cn===Lt?null:Lt,oe.more=!1,ue(Xt());return}if((oe.more||Cn!=null)&&!e.closest(".dt-hist-menu")&&(oe.more=!1,Cn=null,ue(Xt()),!e.closest("[data-go]"))||e.closest(".dt-hist-assign"))return;let o=()=>{oe.more=!1,Cn=null};if(e.closest("[data-hist-rows]")){Pl+=300,ue(Xt());return}if(e.closest("[data-read-all]")){for(let Lt of R)Yr(Lt);o(),ue(Xt());return}let a=e.closest("[data-resolve-all]");if(a){let Lt=a.dataset.resolveAll.split(",").map(Number);o(),await xl(Lt,Ct=>Xe(Ct,!0)),Be(`Resolved ${Lt.length}`,()=>xl(Lt,Ct=>Xe(Ct,!1)));return}let i=e.closest("[data-row-unread]");if(i){let Lt=Number(i.dataset.rowUnread);Bn[Lt]=Math.max(0,en(R.find(Ct=>Ct.id===Lt)).length-1),Za(),o(),ue(Xt());return}let l=e.closest("[data-row-link]");if(l){o(),ue(Xt()),await navigator.clipboard?.writeText(`${location.origin}${location.pathname}#thread-${l.dataset.rowLink}`).catch(()=>null),Ut("Link copied");return}let d=e.closest("[data-row-select]");if(d){o();let Lt=Number(d.dataset.rowSelect),Ct=R.find(_t=>_t.id===Lt);He=new Set(Ct&&bs(Ct)?[Lt]:[]),Oo=Lt,ue(Xt());return}let c=e.closest("[data-row-mirror]");if(c){o(),ue(Xt()),await fa([Number(c.dataset.rowMirror)]);return}let p=e.closest("[data-mirror-all]");if(p){o(),ue(Xt()),await fa(p.dataset.mirrorAll.split(",").map(Number));return}if(e.closest("[data-pick-mirror]")){await xd();return}if(e.closest("[data-pick-cancel]")){zi();return}let v=e.closest(".dt-hist-go[data-go]");if(v&&qo()&&(He||t.metaKey||t.ctrlKey||t.shiftKey)){t.preventDefault(),$m(Number(v.dataset.go),t.shiftKey);return}let A=e.closest("[data-row-move]");if(A){o(),await Wi(Number(A.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")){la(!1);return}if(t.target.closest("[data-fold]")){la(!rt.hasAttribute("data-collapsed"));return}let j=t.target.closest("[data-gfold]");if(j){Kp(j.dataset.gfold);return}let h=t.target.closest(".dt-hist-bands [data-bp]");if(h){Ui(h.dataset.bp);return}let G=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(G){G.dataset.histView?(oe.view=G.dataset.histView,D("dt-view",oe.view),oe.menu=!1):G.dataset.histSort?(oe.sort=G.dataset.histSort,D("dt-sort",oe.sort),oe.menu=!1,oe.more=!1):G.hasAttribute("data-hist-clear")?(oe.q="",Es={at:0}):oe.menu=!oe.menu,ue(Xt());return}oe.menu&&!t.target.closest(".dt-hist-menu")&&(oe.menu=!1,ue(Xt()));let z=t.target.closest("[data-draft-go], [data-draft-rm]");if(z){let Lt=z.dataset.draftRm!==void 0,Ct=Number(Lt?z.dataset.draftRm:z.dataset.draftGo);vn.hidden?Lt?ql(Ct):xi(Ct):We(Lt?{dropDraft:Ct}:{openDraft:Ct});return}let It=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),It){await Xe(Number(It.dataset.id),It.dataset.act==="done");return}let Bt=t.target.closest("[data-rm]");if(Bt){X=null,fi(Number(Bt.dataset.rm));return}if(t.target.closest("[data-review]")){da.start();return}if(t.target.closest("[data-resolved]")){Mi(!Ue);return}if(t.target.closest("[data-archived]")){ki(!pn);return}let le=t.target.closest("[data-archive-all]");if(le){let Lt=le.dataset.archiveAll.split(",").map(Number);for(let Ct of Lt)await ss(Ct,!0,!0);Be(`Archived ${Lt.length}`,()=>{for(let Ct of Lt)ss(Ct,!1,!0)});return}let bt=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(bt){await ss(Number(bt.dataset.id),bt.dataset.act==="archive");return}let Ot=t.target.closest("[data-go]");if(!Ot)return;let kt=Number(Ot.dataset.go);if(!vn.hidden){We({open:kt});return}Ms(kt)});let Ms=t=>{X=t,Ao=null,nn(),os=!0,Z();let e=R.find(a=>a.id===t),s=e&&Te(e);if(s)scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"});else if(e){let a=Ce(e);a?a.scrollIntoView({block:"center",behavior:"smooth"}):jr(e)}let o=nt.querySelector(`.dt-pin[data-id="${t}"]`);o&&Mo(o,"land"),ra()},xi=t=>{let[e]=De.splice(t,1);if(!e)return;nn(),N=e,X=null;let s=Te(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),Z()},ql=t=>{De.splice(t,1),Z()},da=cu({inFrame:x,everything:()=>vt,route:()=>St,settle:Xe,keepIn:Pa,toast:t=>Ut(t),waits:t=>Dt(t)==="claude"||Dt(t)==="open"&&es(t)==="review",approve:t=>Xe(t.id,!0),open:t=>{if(Kt||Qe(!0),y(t)!==Xt()){Ui(y(t));for(let e of[600,1500])setTimeout(()=>We({open:t.id}),e)}else Ms(t.id)}}),Dl=t=>{if(rt.hidden){t?.();return}Un(rt,()=>{rt.hidden=!0,t?.()})},Fl=()=>{Eo(rt),rt.hidden=!1},Up=t=>{t?Fl():Dl(),ve.setAttribute("aria-pressed",String(t)),D("dt-history",t?"1":"0"),Z()},Ei=document.querySelector(".dt-resolved-btn"),On=document.querySelector(".dt-space"),Yp=()=>{if(!On)return;On.hidden=!Ke(),On.dataset.on=Fe;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Ke()&&Fe==="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 On.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===Fe));let i=vt.filter(l=>!Me(l)&&Dt(l)!=="done"&&qt(l)===(a==="clients")).length;o.querySelector(".dt-space-n").textContent=i?String(i):""}On.querySelector(".dt-space-name").textContent=Fe==="clients"?"Client":"Team",On.querySelector(".dt-space-ic").innerHTML=xt(xr[Fe],14)},jl=0,ks=t=>{if(!Ke()||t===Fe)return;let e=()=>{Fe=t,He=null,D("dt-space",t),X!=null&&!$n(R.find(a=>a.id===X))&&(X=null),nn(),as(vt),Z(),ue(Xt())},s=document.documentElement,o=++jl;s.classList.add("dt-switching"),Promise.all([An(nt),An(rt)]).then(()=>{o===jl&&(e(),requestAnimationFrame(()=>s.classList.remove("dt-switching")))})};document.querySelector(".dt-client-x")?.addEventListener("click",()=>ks("studio")),On?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&(On.open=!1,ks(e.dataset.space))});let Ls=document.querySelector(".dt-pinf"),Ss=Ls.querySelector(".dt-pinf-btn"),on=Ls.querySelector(".dt-pinf-menu"),_l={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My agent",wrote:"Written by me",check:"To check"},Xp=()=>R.filter(t=>y(t)===Xt()&&Po(t)&&$n(t)),Qs=(t,e=!1)=>{on.hidden=!t,Ss.setAttribute("aria-expanded",String(t)),t&&(Da(),e&&on.querySelector('[aria-checked="true"]')?.focus())};Da=()=>{let t=Xp();if(Ls.hidden=!Ke()||!t.length,Ls.hidden){on.hidden=!0;return}let e=Object.fromEntries(Ir.map(p=>[p,t.filter(v=>nl(v,p)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",Ne(s)],["others","var(--dt-faint)"]];if(Ss.toggleAttribute("data-on",xn!=="all"),Ss.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${xn==="all"?"":`; showing ${_l[xn]}, ${e[xn]}`}`),on.hidden)return;let a=[...new Set(t.map(p=>vo(p,Dt(p))?.taker).filter(p=>!!p&&p!==s))].slice(0,2),i=p=>Nn(sn(p)?.avatar_url,sn(p)?.name||p,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${Ne(p)}" `),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:i(s),others:a.map(i).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">${Pe(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:Ve(Rn[2][2],Rn[2][3]),resolved:Ve(Pn[Pn.length-1][2],Pn[Pn.length-1][3])},d=(p,v)=>`<b class="dt-pinf-share"><i style="--c:${v};width:${Math.round(100*e[p]/e.all)}%"></i></b>`,c=(p,v="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${xn===p}" data-pinf="${p}"><i class="dt-pinf-glyph">${l[p]}</i><span>${_l[p]}</span>${v?d(p,v):""}<em>${e[p]}</em>${$e}</button>`;on.innerHTML=`${c("all")}${o.map(([p,v])=>c(p,v)).join("")}${e.resolved||xn==="resolved"?c("resolved"):""}<hr>${c("claude")}${c("wrote")}${c("check")}`},Ss.addEventListener("click",t=>Qs(on.hidden,t.detail===0)),on.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(xn=e.dataset.pinf,D("dt-pinf",xn),Qs(!1),Ss.focus(),Kt?Z():Qe(!0))}),on.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),Qs(!1),Ss.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...on.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!on.hidden&&!Ls.contains(t.target)&&Qs(!1)},!0);let Mi=t=>{Ue=t,Ei.setAttribute("aria-pressed",String(t)),D("dt-resolved",t?"1":"0"),We({resolved:t}),Z(),is(!0)},ki=t=>{pn=t,D("dt-archived",t?"1":"0"),We({archived:t}),Z(),is(!0)};Ei.addEventListener("click",()=>Mi(!Ue)),Ei.setAttribute("aria-pressed",String(Ue)),ve.addEventListener("click",()=>{let t=rt.hidden||rt.hasAttribute("data-leaving");t&&!Kt&&Qe(!0),t&&la(!1),Up(t)});let Je=()=>{Ia||!Kt||(Ia=requestAnimationFrame(()=>{Ia=0,Wp()}))},Wl=`${fs}, .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`,Jp=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Wl))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(Wl))},Li=!1,zl=()=>{Li=!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)},Si=0,Ti=!1,Ai=!1,Vl=0,Zp=()=>{if(!Kt)return!1;let t=new Set([...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].map(s=>Number(s.dataset.id))),e=Xt();return R.some(s=>!t.has(s.id)&&y(s)===e&&Po(s)&&$n(s)&&!!Te(s))},Qp=()=>Kt&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=R.find(s=>s.id===Number(t.dataset.id));return!!e&&e.id!==X&&!Ce(e)}),tm=()=>Kt&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=R.find(s=>s.id===Number(t.dataset.id));return!!e&&jo(e)==="probably"!==t.classList.contains("dt-pin--probably")}),Gl=new MutationObserver(t=>{if(Kt&&!x&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),Li=!0}t.every(Jp)||((wi<3||t.some(e=>e.type!=="attributes"))&&Je(),t.some(e=>e.type!=="attributes")?Ti=!0:t.some(e=>e.attributeName==="class")&&(Ai=!0),Si||(Si=window.setTimeout(()=>{if(Si=0,Ti)_s();else if(Ai&&performance.now()-Vl>1e3){Vl=performance.now();for(let[s,o]of ys)o.el||ys.delete(s)}Ti=Ai=!1;let e=X!=null?R.find(s=>s.id===X):void 0;Zp()||Qp()||tm()||e&&_o&&Bu(e)!==_o?Z():Je()},150)))}),Kl=new ResizeObserver(()=>Je()),Ul=()=>{nt.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&Je()},vt=[],Yl=()=>{},to=new Set,je={at:"",ids:[]},as=t=>{vt=t,queueMicrotask(()=>Yl());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={};for(let d of t){if(Me(d)||!$n(d))continue;let c=Dt(d),p=we(d),v=c==="done"?"done":c==="claude"?"review":p&&Uo[p]||es(d),A=s[d.route??""]??={...e(),bands:{}};A[v]++;let j=y(d);(A.bands[j]??=e())[v]++}Yp();let o=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},i=d=>o.map(c=>[c,c==="done"&&!Ue?0:d[c]]),l=d=>i(d).reduce((c,[,p])=>c+p,0);for(let d of document.querySelectorAll(".dt-pages a")){let c=d.querySelector(".dt-pages-n");if(!c)continue;let p=s[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let j of m){let h=p?.bands[j.id];for(let[G,z]of i(h??e())){let It=c.querySelector(`[data-bp="${j.id}"][data-state="${G}"]`);It.hidden=!z,z&&(It.querySelector("i").textContent=String(z),It.title=`${j.label}: ${z} ${a[G]}`)}}let v=p?l(p):0;c.hidden=!v;let A=p?m.filter(j=>p.bands[j.id]&&l(p.bands[j.id])).map(j=>`${j.label} ${l(p.bands[j.id])}`).join(" \xB7 "):"";c.title=v?`${o.filter(j=>p[j]).map(j=>`${p[j]} ${a[j]}`).join(" \xB7 ")}
333
- ${A}`:"",d.dataset.n=String(v)}for(let d of document.querySelectorAll(".dt-folder")){let c=d.querySelectorAll(":scope > ul li[data-route] > a").length,p=[...d.querySelectorAll("a[data-n]")].reduce((A,j)=>A+Number(j.dataset.n),0),v=d.querySelector(".dt-folder-n");v.textContent=c?String(c):"",v.title=`${c} ${c===1?"page":"pages"}${p?` \xB7 ${p} open ${p===1?"thread":"threads"}`:""}`}Ht()},qn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!oa.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=>aa.has(`${Number(e.id)}|${s.at}`)?{...s,text:"",deleted:!0}:s):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[],...Ps(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}:{}})),em=uu(x,t=>Ut(t,2800,document.querySelector(".dt-turbo")??void 0)),_e=document.querySelector(".dt-push"),fn=_e.querySelector(".dt-push-menu"),bn=new Set,eo=new Set([St]),ca=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",ua=()=>n.client||x?[]:vt.filter(t=>t.status!=="done"&&Jt(t.assignee)&&!qt(t)&&Re(t)==="approved"&&!ln(t)&&!Me(t)&&!to.has(t.id)),pa=()=>ua().filter(t=>!bn.has(t.id)),Xl=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?$e:""}</i>`,Jl=()=>{let t=ua(),e=[...new Set(t.map(o=>o.route??"/"))],s=pa().length;fn.innerHTML=`<div class="dt-push-head">${Pe(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),i=a.filter(l=>!bn.has(l.id)).length;return`<button type="button" class="dt-push-page${eo.has(o)?" is-open":""}" data-push-route="${f(o)}"><span data-push-fold="${f(o)}">${Ks}</span>${Xl(i>0,i>0&&i<a.length)}<span class="dt-push-route">${f(o)}</span><em>${a.length}</em></button>`+(eo.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${Xl(!bn.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>`},Zl=()=>["push","paused"].includes(ca()),Hi=()=>je.ids.filter(t=>{let e=vt.find(s=>s.id===t);return!!e&&e.status!=="done"&&Re(e)!=="review"&&(to.has(t)||!!ln(e)||Re(e)==="approved")}),Ql="",nm=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},kn=()=>{let t=ca(),e=pa().length,s=Hi(),o=je.ids.length-s.length,a=s.length>0&&Zl();if(s.length&&(Ql=je.at),!s.length&&je.ids.length&&je.at&&Ql===je.at&&!nm(je.at)){try{sessionStorage.setItem("nm-batch-done",je.at)}catch{}vt.length&&Be(`The agent finished ${je.ids.length} \u2014 check the fixes`,()=>da.start(),"Check")}_e.hidden=n.client||x||!e&&!_e.matches(".is-sending, .is-sent");let i=_e.querySelector(".dt-push-n");i.textContent=String(e),i.hidden=!e||_e.classList.contains("is-sent"),_e.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",(_e.hidden||!ua().length)&&(fn.hidden=!0),fn.hidden||Jl()},td=async t=>{if(!t.length&&Zl()){Ut("Nothing waits for the agent \u2014 mark threads for the agent first");return}if(ca()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Ut("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(ca()==="on"){Ut("Turbo is on \u2014 the agent takes each thread as it lands");return}fn.hidden=!0;let e=t.map(o=>o.id);_e.classList.add("is-sending");let s=await ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(_e.classList.remove("is-sending"),!s?.ok){Dn("Could not send them to the agent",s),kn();return}for(let o of e)to.add(o);_e.classList.add("is-sent"),setTimeout(()=>{_e.classList.remove("is-sent"),kn()},700),je={at:je.ids.some(o=>Hi().includes(o))?je.at:new Date().toISOString(),ids:[...new Set([...Hi(),...e])]},kn(),Be(`${e.length} sent to the agent \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)to.delete(o);kn()}),Ze()},ma=_e.querySelector(".dt-push-all"),ed=0,Ci=!1,nd=()=>{fn.hidden=!1,Jl()};ma.addEventListener("click",()=>{if(Ci){Ci=!1;return}td(pa())}),ma.addEventListener("contextmenu",t=>{t.preventDefault(),fn.hidden?nd():fn.hidden=!0}),ma.addEventListener("pointerdown",t=>{t.button===0&&(ed=window.setTimeout(()=>{Ci=!0,nd()},500))});for(let t of["pointerup","pointerleave","pointercancel"])ma.addEventListener(t,()=>clearTimeout(ed));fn.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]"),i=e.closest("[data-push]")?.dataset.push;if(i==="send"){td(pa());return}if(i==="all")bn.clear();else if(s){let l=s.dataset.pushFold;eo.has(l)?eo.delete(l):eo.add(l)}else if(o){let l=ua().filter(c=>(c.route??"/")===o.dataset.pushRoute),d=l.some(c=>!bn.has(c.id));for(let c of l)d?bn.add(c.id):bn.delete(c.id)}else if(a){let l=Number(a.dataset.pushId);bn.has(l)?bn.delete(l):bn.add(l)}kn()}),document.addEventListener("pointerdown",t=>{!fn.hidden&&!_e.contains(t.target)&&(fn.hidden=!0)},!0),setInterval(kn,3e4),Yl=kn;let sd=document.querySelector(".dt-turbo");sd&&new MutationObserver(kn).observe(sd,{attributes:!0,attributeFilter:["data-state"]}),kn();let no="",Ni=!1,Ts="dt-threads",od=String([de.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Bi="",ha=null,sm=t=>{x||t.version&&t.version===Bi||(ha||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=ha;ha=null,Bi=e.version??"";let s=JSON.stringify({project:od,body:e});s.length<2e6?mt.setItem(Ts,s):mt.removeItem(Ts)},{timeout:3e3}),ha=t)},Ri=(t,e=!1)=>{no=t.version??"",em(t);let s=t.turbo;to=new Set(s?.push?.ids??[]),je={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=qn(t.comments);if(e&&(Ue||pn)){let i=new Set(o.map(l=>l.id));o=[...o,...vt.filter(l=>Dt(l)==="done"&&!i.has(l.id))]}sm({...t,comments:o}),as(o);let a=o.filter(i=>i.route===St);if(!(Ro&&(R=a,ad()))){if(JSON.stringify(a)===JSON.stringify(R)){!rt.hidden&&!x&&Z();return}R=a,Z(),We({reload:!0})}},is=async(t=!1)=>{let e=[t||!no?"":`since=${no}`,Ue||pn?"":"open=1"].filter(Boolean).join("&");try{let s=await ae(`comments${e?`?${e}`:""}`);s.status===200&&Ri(await s.json())}catch{}},so=!1,rs=async()=>{if(!document.hidden){if(Ni||ns){so=!0;return}Ni=!0,await is(),Ni=!1,so&&(so=!1,rs())}};$l=()=>{so&&!ns&&(so=!1,rs())};let ad=()=>{let t=Ro&&R.find(e=>e.id===Ro);return t?(Ro=0,Ke()&&!$n(t)&&ks(qt(t)?"clients":"studio"),Kt||Qe(!0),Ms(t.id),!0):!1},Pi=()=>{R=vt.filter(t=>t.route===St),ad()||Z()},Ii=0,Oi=null,ga=()=>{Oi&&Kt&&qi(Oi)},qi=t=>{Oi=t,!Ii&&(Ii=requestAnimationFrame(()=>{Ii=0;let e=t.target;if(!Kt||e.closest(et)){Zn.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(Zn.hidden=!1,!s)return;let o=s.getBoundingClientRect();xu.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,Cr.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)}`,Cr.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-16)}px`}))},id=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),Qt){Qt=null,Z();return}if(N){Fs()&&(nn(),Z());return}if(X!==null){X=null,Z();return}Qe(!1)}},rd=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],oo=!1,ao=null,ls=document.createElement("div");ls.className="dt-repin-hint",ls.hidden=!0,ls.setAttribute("role","status"),ls.textContent="Click the new spot for this thread \xB7 Esc cancels",document.body.append(ls);let ld=()=>{ao=null,ls.hidden=!0,ee.toggle("dt-repinning",!1)},om=t=>{ao=t,X=null,ls.hidden=!1,ee.toggle("dt-repinning",!0),Z()};document.addEventListener("keydown",t=>{t.key==="Escape"&&ao!=null&&(t.stopImmediatePropagation(),ld())},!0);let dd=!1,cd=t=>{oo||(t.type==="pointerdown"&&(dd=t.pointerType==="touch"),!t.target.closest?.(et)&&t.stopPropagation())},ud=t=>{let e=t.target;dd&&(!e.closest?.(et)||e.closest?.(".dt-pin"))&&t.preventDefault()},pd=t=>{!oo&&t.button===0&&t.target.closest?.(":disabled")&&Di(t)},Di=t=>{if(oo)return;let e=t.target;if(e.closest(et))return;if(t.preventDefault(),t.stopPropagation(),C){C=!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(ao!=null){let p=ao;ld();let v=a.getBoundingClientRect();Em(p,a,s?v.left+v.width/2:t.clientX,s?v.top+v.height/2:t.clientY);return}if(!Fs())return;nn();let i=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(p=>!/^(astro|svelte|css)-/.test(p)).slice(0,2);N={selector:_a(a),tag:l,classes:d,nth:Wa({tag:l,classes:d}).indexOf(a),rx:i.width&&!s?(t.clientX-i.left)/i.width:.5,ry:i.height&&!s?(t.clientY-i.top)/i.height:.5,label:Zt(ie(a.textContent||""),60),ctx:za(a),fp:Fo(a),spot:{x:Math.round((s?i.left+i.width/2:t.clientX)+scrollX),y:Math.round((s?i.top+i.height/2:t.clientY)+scrollY)},opener:Pu(a),category:g[0].id,...Ke()&&Fe==="clients"?{shared:!0}:{}};let c=n.client||N.shared?null:Gs();c&&(N.assignee=c,N.stage="new",N.carried=!0),hd.set(N,um().then(()=>Fi(a))),X=null,Zn.hidden=!0,Z()},am=2200,im=900*1024,md=8*1024*1024,rm=3*1024*1024,lm=50*1024*1024,dm=1200,cm=1600,Fi=async t=>{let e=t instanceof HTMLElement?t:null;for(let l=0;e&&l<4&&e.parentElement&&e.parentElement!==document.body;l++){let d=e.getBoundingClientRect();if(d.width>=360&&d.height>=140)break;e=e.parentElement}let s=e?.getBoundingClientRect();if(!e||!s?.width||!s.height)return null;let o=t?.getBoundingClientRect(),a=o&&o.width&&o.height?{x:(o.left-s.left)/s.width,y:(o.top-s.top)/s.height,w:o.width/s.width,h:o.height/s.height}:null,i="";for(let l=e;l&&!i;l=l.parentElement){let d=getComputedStyle(l).backgroundColor;d&&d!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(d)&&(i=d)}if(!i){let[l,d,c]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);i=.299*l+.587*d+.114*c>140?"#111":"#fff"}try{let{domToWebp:l}=await import("modern-screenshot"),d=Math.min(1,dm/s.width,cm/s.height),c=await Promise.race([l(e,{scale:d,quality:.8,timeout:4e3,backgroundColor:i,filter:p=>!(p instanceof Element&&p.closest(fs))}),new Promise(p=>setTimeout(()=>p(null),8e3))]);return c&&c.length<md?{url:c,box:a}:null}catch{return null}},hd=new WeakMap,um=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Ut=(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)"))Un(a,()=>a.remove());if(document.body.append(o),s){let a=s.getBoundingClientRect(),i=o.offsetWidth/2;o.style.left=`${Math.min(Math.max(a.left+a.width/2,i+8),innerWidth-i-8)}px`}return setTimeout(()=>Un(o,()=>o.remove()),e),o},gd=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),i=Qo.get(o);if(Qo.delete(o),!i){Ut(`${a} was not sent \u2014 attach it again`);continue}let l=Ut(`Uploading ${a}\u2026`,12e4),d=await ae("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:i.name,size:i.size})}).then(A=>A.ok?A.json():null).catch(()=>null),c=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:i}).catch(()=>null),p=c?.ok&&await tt({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!p||!p.ok){Ut(c===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let v=qn([await p.json().catch(()=>null)])[0];v&&(R=R.map(A=>A.id===v.id?v:A),Z()),Ut(`${a} sent`)}},fd=t=>{let e=t.filter(s=>s.startsWith(Zo)).map(s=>s.split("\0"));return e.length&&Ut(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(Zo))},Dn=async(t,e)=>{if(!navigator.onLine){Ut(`${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="")}Ut(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},pm=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),mm=async t=>{let e=await createImageBitmap(t),s=Math.min(1,am/Math.max(e.width,e.height));if(s===1&&t.size<=im)return e.close(),pm(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)},ji=async(t,e)=>{let s=[],o=(a,i)=>s.push(`${Zo}${a}\0${i}`);for(let a of t){let i,l=fc(a.name)||Object.keys(bo).find(d=>bo[d]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,lr.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>lm){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>rm&&de.via){let c=`${Date.now()}-${Qo.size}`;Qo.set(c,a),s.push(`${li}${c}\0${a.name}\0${a.size}`);continue}let d=await new Promise((c,p)=>{let v=new FileReader;v.onload=()=>c(String(v.result).split(",")[1]),v.onerror=p,v.readAsDataURL(a)}).catch(()=>"");d?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${gc(a.name)||"file"};ext=${l};base64,${d}`):o(a.name,"Could not be read");continue}try{i=await mm(a)}catch{o(a.name,"This picture could not be read");continue}if(i.length>md){o(a.name,"Too large even after shrinking");continue}s.push(i)}if(s.length){if(!Number(e?.dataset.id)){N&&((N.images??=[]).push(...s),Z());return}Ee.push(...s),Z(),io(".dt-note-reply-input")}},bd=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);nt.addEventListener("paste",t=>{let e=bd(t.clipboardData?.items);e.length&&(t.preventDefault(),ji(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=bd(t.dataTransfer?.items);s.length&&ji(s,e)});let io=t=>{let e=nt.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},yd=()=>{io(".dt-note-edit-input"),nt.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},_i=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=mi-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},hm=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),vd=t=>{let s=t.closest(".dt-compose").querySelector(".dt-mentions");s?.remove();let o=hm(t);if(!o)return;let a=o[1].toLowerCase(),i=X!=null?R.find(p=>p.id===X):void 0,d=(n.client||N?.shared||i&&qt(i)?n.team??[]:Jo()).filter(p=>!gr(p.email)).filter(p=>p.email!==n.me?.email&&[p.name,p.nickname,p.email].some(v=>v?.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(p=>`<button type="button" role="option" data-act="mention" data-handle="${f(wc(p))}">${Nn(p.avatar_url,p.name||p.email)}<span class="dt-mention-who"><b>${f(p.name||p.email)}</b>${p.name?`<span>${f(p.email)}</span>`:""}</span></button>`)].map((p,v)=>p.replace('role="option"',`role="option" aria-selected="${v===0}"`)).join("")}</div>`);let c=t.nextElementSibling;s&&(c.style.animation="none"),c.getBoundingClientRect().top<8&&c.classList.add("is-below")},gm='<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>',fm='<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>',wd=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...Ta].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>f(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=e.length?new RegExp(`@(?:${e.join("|")})${cr}`,"giu"):null;return ur(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"?gm:si}<span>${f(o.label)}</span>${fm}</a>`:s?f(o).replace(s,a=>{let i=Hc(a,n.team??[],n.me?.email);return`<span class="dt-at" data-kind="${i}">${i==="agent"?Pe(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 $d=(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 bm=(t,e)=>{if(!t){N&&(N.category=e),Z();return}Ye(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>tt({id:t,category:e}),"Changing the type")};Zc([nt,rt],f,$e),rt.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&Vo(Number(e.dataset.id),e.value)}),rt.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),tl(Number(e.dataset.id)))},!0);let ym=t=>qt(t)?"studio":"clients",Wi=async(t,e=!1)=>{let s=R.find(i=>i.id===t);if(!s||qt(s)&&s.client)return;let o=!qt(s);X===t&&(X=null);let a=o&&Jt(s.assignee)?{assignee:null,stage:"new"}:{};await Ye(i=>i.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"),as(vt),e||Be(o?"Moved to Client":"Moved to Team",()=>Wi(t,!0))},vm=async t=>{let e=R.find(d=>d.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...qt(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 In(ae("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Dn("The copy was not made",a);return}let i=qn([await a.json().catch(()=>null)])[0];i&&(vt=[...vt,i],R=vt.filter(d=>d.route===St)),as(vt),Z(),Ze();let l=ym(e);Be(l==="clients"?"Duplicated for the client":"Duplicated to Team",()=>{i&&(ks(l),Ms(i.id))},"Open")},wm=["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"],fa=async t=>{let e=[],s=0;for(let o of t){let a=vt.find(p=>p.id===o);if(!a||!qt(a)||Io(a))continue;let i=a,l={text:a.text,from:{id:a.id}};for(let p of wm)i[p]!=null&&(l[p]=i[p]);let d=await In(ae("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(l)})).catch(()=>null);if(!d?.ok){Dn("Not mirrored",d);break}let c=qn([await d.json().catch(()=>null)])[0];c&&(d.status===201?e.push(c):s++,vt=[...vt.filter(p=>p.id!==c.id),c])}if(R=vt.filter(o=>o.route===St),as(vt),Z(),Ze(),!e.length){s&&Ut("Already mirrored");return}Be(`${e.length} mirrored to Team`,async()=>{let o=new Set(e.map(a=>a.id));vt=vt.filter(a=>!o.has(a.id)),R=R.filter(a=>!o.has(a.id)),as(vt),Z();for(let a of o)await In(ae(`comments?id=${a}`,{method:"DELETE"})).catch(()=>null);Ze()})},zi=()=>{He=null,Oo=null,ue(Xt())},xd=async()=>{let t=[...He??[]];zi(),t.length&&await fa(t)},$m=(t,e)=>{let s=R.find(o=>o.id===t);if(He??=new Set,s&&bs(s)){let o=[...rt.querySelectorAll(".dt-hist-go[data-go]")].map(l=>Number(l.dataset.go)),a=o.indexOf(Oo??t),i=o.indexOf(t);if(e&&a>=0&&i>=0)for(let l of o.slice(Math.min(a,i),Math.max(a,i)+1)){let d=R.find(c=>c.id===l);d&&bs(d)&&He.add(l)}else He.has(t)?He.delete(t):He.add(t);Oo=t}ue(Xt())};document.addEventListener("keydown",t=>{t.key==="Escape"&&He&&(t.stopImmediatePropagation(),t.preventDefault(),zi())},!0);let xm=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(()=>Ut("Link copied"),()=>Ut(s,6e3))};nt.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,c=Number(e.dataset.id)||0;e.value="",d==="dup"?vm(c):d==="mirror"?fa([c]):d==="move"?Wi(c):d==="link"?xm(c):d==="reopen"?Xe(c,!1):d==="archive"||d==="unarchive"?ss(c,d==="archive"):d==="rm"?(X=null,fi(c)):d==="discard"&&(N=null,Z());return}let s=t.target.closest(".dt-lang-select");if(s){ui(Number(s.dataset.id),s.dataset.at,s.value==="orig"?null:s.value);return}let o=t.target.closest(".dt-cat-select");if(o){bm(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){ep(Number(a.dataset.id),a.value);return}let i=t.target.closest(".dt-owner-select");if(i){qu(Number(i.dataset.id)||0,i.value);return}let l=t.target.closest(".dt-for-select");if(l){if(mt.setItem("nm-for",l.value),n.client){N&&(N.assignee=l.value,Gs(l.value),Z());return}Ua(Number(l.dataset.id)||0,"person")}}),nt.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&N?.suggest){N.suggest.to=e.value,Qn(),_i(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"),vd(s),s.classList.contains("dt-note-input")?N&&(N.text=s.value):s.classList.contains("dt-note-edit-input")?Qt&&(Qt.text=s.value):Ae=s.value,Qn(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),_i(s);let o=s.closest(".dt-note");o&&o.getBoundingClientRect().bottom>ia()&&(vi([]),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=En?.box??En?.btn;ea(),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")&&vd(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),$d(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 Vt=null,ba=!1;function ro(t){return!n.client||!!n.me&&t.by===n.me.email}let Ed=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},Vi=Ed("dt-drag-box--home"),Md=Ed("dt-drag-box--to"),kd=()=>{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)};kd(),addEventListener("resize",kd);let Em=async(t,e,s,o)=>{let a=R.find(p=>p.id===t);if(!a)return;let i={...Gi(e,s,o),fp:Fo(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=`${na(a.tag,a.classes,a.selector)}${ie(a.label)?` \xAB${Zt(ie(a.label),24)}\xBB`:""}`,c=(p,v,A)=>Ye(j=>j.map(h=>h.id===t?{...h,...p,anchor:null,...v?{repinnedAt:new Date().toISOString(),repinnedBy:n.me?.email??"you",repinnedFrom:d}:{repinnedAt:null,repinnedBy:null,repinnedFrom:null}}:h),()=>tt({id:t,move:p,anchor:null,repin:v?d:!1}),A);ts.delete(t),await c(i,!0,"Re-pinning"),Be(`Pinned to ${lo(e)}`,()=>{ts.delete(t),c(l,!1,"Putting the pin back")})},Mm=async t=>{let e=R.find(i=>i.id===t),s=e&&Ce(e);if(!e||!s)return;let o=s.getBoundingClientRect(),a={...Gi(s,o.left+o.width*e.rx,o.top+o.height*e.ry),fp:Fo(s)};ts.delete(t),await Ye(i=>i.map(l=>l.id===t?{...l,...a,anchor:null}:l),()=>tt({id:t,move:a,anchor:null}),"Keeping the pin here"),_s(),Z()},km=t=>{let e=R.find(i=>i.id===t),s=e&&Te(e)?.opener;if(!e||!s)return;oo=!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 i of["pointerdown","mousedown","pointerup","mouseup","click"])s.dispatchEvent(new(i.startsWith("pointer")?PointerEvent:MouseEvent)(i,a))}finally{oo=!1}X=null,setTimeout(()=>{_s(),X=t,Z()},180)},lo=t=>{let e=Zt(ie(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Ld=(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},Lm=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(et)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,Sm=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},Gi=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),i=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:_a(t),tag:a,classes:i,nth:Wa({tag:a,classes:i}).indexOf(t),label:Os(t.textContent||"",60),ctx:za(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}},Ki=()=>{Vt&&(Vt.on&&Mo(Vt.pin,"land"),Vt.pin.classList.remove("is-dragging"),ee.toggle("dt-dragging",!1),Vi.hidden=Md.hidden=!0,Vt=null,Je())};nt.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=R.find(o=>o.id===Number(e.dataset.id));!s||!ro(s)||(Vt={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:Ce(s),to:null},e.setPointerCapture(t.pointerId))}),nt.addEventListener("pointermove",t=>{if(!Vt||!Vt.on&&Math.hypot(t.clientX-Vt.x0,t.clientY-Vt.y0)<4)return;Vt.on=!0,Vt.pin.classList.add("is-dragging"),ee.toggle("dt-dragging",!0),Vt.pin.style.left=`${t.clientX}px`,Vt.pin.style.top=`${t.clientY}px`,Vt.to=Vt.home&&Sm(Vt.home,t.clientX,t.clientY)?Vt.home:Lm(t.clientX,t.clientY);let e=Vt.to&&Vt.to!==Vt.home;Ld(Vi,Vt.home,e?"":Vt.home?lo(Vt.home):""),Vi.classList.toggle("is-left",!!e),Ld(Md,e?Vt.to:null,e?`Move to ${lo(Vt.to)}`:"")}),nt.addEventListener("pointerup",async t=>{if(!Vt)return;let e=Vt;if(!e.on||!e.to){Ki();return}ba=!0,setTimeout(()=>{ba=!1},0);let s=R.find(d=>d.id===e.id),o=Gi(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(Ki(),!s)return;let i={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,c)=>Ye(p=>p.map(v=>v.id===e.id?{...v,...d}:v),()=>tt({id:e.id,move:d}),c);await l(o,"Moving the pin"),a&&Be(`Moved to ${lo(e.to)}`,()=>l(i,"Putting the pin back"))}),nt.addEventListener("click",t=>{ba&&(t.stopImmediatePropagation(),t.preventDefault(),ba=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&Vt?.on&&(t.stopImmediatePropagation(),Ki())},!0),nt.addEventListener("click",async t=>{let e=t.target.closest("button"),s=En?.btn;if(e?.closest(".dt-emoji")||ea(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="open-orig"){ks("clients"),Ms(a);return}if(o==="react"){fl(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&gl(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"&&En){let i=En;gl(i.btn,!0,i);return}if(o==="emoji"&&En){let i=En;ea(),i.box?Ap(i.box,e.dataset.emoji):i.id&&fl(i.id,i.at||null,e.dataset.emoji);return}if(o==="prio"){let i=e.dataset.v||null;a?Ye(l=>l.map(d=>d.id===a?{...d,priority:i??void 0}:d),()=>tt({id:a,priority:i}),"Setting the priority"):N&&(N.priority=i??void 0,Qn(),Z());return}if(o==="mention"){let i=e.closest(".dt-compose")?.querySelector("textarea");i&&$d(i,e.dataset.handle);return}if(!o){if(N&&!Fs())return;X=X===a?null:a,nn(),Z(),os&&ra();return}if(o==="speak"){wp(e.closest(".dt-note"),e);return}if(o==="voice-write"){xp(e);return}if(o==="voice"||o==="voice-seek"){rp(e,o==="voice-seek"?t:null);return}if(o==="attach"||o==="attach-file"){let i=Object.assign(document.createElement("input"),{type:"file",accept:o==="attach"?"image/*":"",multiple:!0}),l=e.closest(".dt-note");i.addEventListener("change",()=>{i.files?.length&&ji([...i.files],l)}),i.click();return}if(o==="unshot"){a?Qt&&Qt.drop.push(e.dataset.img):(e.closest("[data-draft]")?N?.images??[]:Ee).splice(Number(e.dataset.i),1),Z(),Qt&&yd();return}if(o==="edit"){let i=R.find(c=>c.id===a),l=e.dataset.at||null,d=l?i?.replies?.find(c=>c.at===l)?.text:i?.text;if(d===void 0)return;Qt={id:a,at:l,text:d,drop:[]},Z(),yd();return}if(o==="edit-cancel"){Qt=null,Z();return}if(o==="tr-orig"){ui(a,e.dataset.at,null);return}if(o==="tr-retry"){ui(a,e.dataset.at,e.dataset.to);return}if(o==="unsay"){let i=e.dataset.at;qp(a,i);return}if(o==="edit-save"){let i=Qt;if(!i)return;let l=i.text.trim();if(!l){nt.querySelector(".dt-note-edit-input")?.focus();return}Qt=null;let d=c=>i.drop.includes(c.split("/").pop());await Ye(c=>c.map(p=>p.id!==i.id?p:{...p,...i.at==null?{text:l}:{replies:(p.replies??[]).map(v=>v.at===i.at?{...v,text:l}:v)},images:(p.images??[]).filter(v=>!d(v))}),()=>tt({id:i.id,edit:{at:i.at,text:l},...i.drop.length?{removeImage:i.drop}:{}}).then(c=>(c.ok||(Qt=i),c),c=>{throw Qt=i,c}),"Saving the edit");return}if(o==="cancel"){Fs()&&(nn(),Z());return}if(o==="twin"){if(!Fs())return;nn(),X=Number(e.dataset.id),Z();return}if(o==="discard"){N=null,Z();return}if(o==="draft-open"){xi(Number(e.dataset.i));return}if(o==="close"){X=null,Z();return}if(o==="hidden-why"){let i=e.getAttribute("aria-expanded")!=="true";e.setAttribute("aria-expanded",String(i)),e.parentElement.querySelector("p").hidden=!i;return}if(o==="go-spot"){let i=R.find(l=>l.id===Number(e.dataset.id));i&&jr(i);return}if(o==="show-el"){let i=R.find(l=>l.id===Number(e.dataset.id));i&&Ce(i)?.scrollIntoView({block:"center",inline:"center",behavior:Kn()?"smooth":"auto"});return}if(o==="where"){let i=R.find(j=>j.id===Number(e.dataset.id)),l=i&&Te(i),d=l?.hidden;if(!d)return;let c=j=>{let h=j.getBoundingClientRect();return(h.width||h.height)&&j.checkVisibility?.()!==!1?h:null},p=l.shut instanceof HTMLElement?l.shut:null,v=p&&c(p);if(p&&!v){let j=p.getAttribute("style");p.setAttribute("style",`${j??""};display:block!important`),v=c(p),j==null?p.removeAttribute("style"):p.setAttribute("style",j)}v??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let A=document.createElement("div");A.className="dt-where",A.style.cssText=`left:${v.left}px;top:${v.top}px;width:${v.width}px;height:${v.height}px`,document.body.append(A),An(A).then(()=>A.remove());return}if(o==="unsuggest"&&N){N.suggest=null,Z();return}if(o==="uncarry"&&N){N.assignee="",N.carried=!1,Gs(""),Qn(),Z();return}if(o==="save"){if(!N)return;N.images&&(N.images=fd(N.images));let i=(N.images??[]).filter(z=>!ws(z)),l=N.suggest&&N.suggest.to.trim()!==N.suggest.from?{from:N.suggest.from,to:N.suggest.to.trim()}:null,d=nt.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(N.images?.some(oi)?ml:N.images?.some(z=>ws(z)&&!yo(z))?"See the attached image":N.images?.length?"See the attached file":"");if(!d){nt.querySelector(".dt-note-input")?.focus();return}let c=N,p=n.client||c.shared===!0?null:hr(d,Vs()),v=hd.get(c)??Fi(Ce(c)),A={...c,images:c.images?.filter(ws),route:St,text:d,suggest:l,assignee:n.client?ll(c.assignee)||void 0:p??(c.assignee||void 0),shared:n.client?!0:c.shared===!0,stage:n.client?"new":p?"approved":c.stage??(Jt(c.assignee)?"approved":"new"),breakpoint:ja(),browser:Au(),device:x?Sd:"",viewport:{w:innerWidth,h:innerHeight},logs:Gc(),host:location.host},j={...c,id:-Date.now(),text:d,route:St,status:"open",note:"",doneBy:null,breakpoint:A.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:n.me?.email,byName:n.me?.name};R=[...R,j],N=null,Z();let h=await In(ae("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(A)})).catch(()=>null);if(!h?.ok){R=R.filter(z=>z!==j),nn(),N=c,Z(),Dn("Thread was not saved",h);return}let G=qn([await h.json().catch(()=>null)])[0];R=R.map(z=>z===j&&G?G:z),Z(),G&&v.then(z=>{z&&tt({id:G.id,before:z.url,box:z.box})}),G&&i.length&&gd(G.id,i),Ze();return}if(o==="reply"){let i=nt.querySelector(".dt-note-reply-input");Ee=fd(Ee);let l=i.value.trim()||(Ee.some(oi)?ml:Ee.some(z=>ws(z)&&!yo(z))?"See the attached image":Ee.length?"See the attached file":"");if(!l){i.focus();return}let d=Ee;Ae=l,un=a,js(),Ae="",Ee=[],i.value="";let c=R,p=R.find(z=>z.id===a),v=n.client||qt(p)?null:hr(l,Vs()),A=v&&p&&(v!==p.assignee||Re(p)!=="approved"||p.status==="done")?{assignee:v,stage:"approved",...p.status==="done"?{status:"open",doneBy:null}:{}}:{};R=R.map(z=>z.id===a?{...z,...A,replies:[...z.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:n.me?.email}]}:z),Ho=a,Z();let j=await In(tt({id:a,reply:l,images:d.filter(ws),...A})).catch(()=>null);if(!j?.ok){R=c,Ae=l,Ee=d,Z();let z=nt.querySelector(".dt-note-reply-input");z&&!z.value&&(z.value=l);let It=()=>nt.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?Be(`Reply was not sent${j?` (${j.status})`:""} \u2014 it is back in the box`,It,"Retry"):Dn("Reply was not sent",j);return}js();let h=qn([await j.json().catch(()=>null)])[0];h&&(R=R.map(z=>z.id===h.id?h:z),Z()),Ze();let G=d.filter(z=>!ws(z));G.length&&gd(a,G);return}if(o==="unfold"){vs.set(a,1/0),Z();let i=nt.querySelector(`.dt-note[data-id="${a}"] .dt-note-thread`);if(i){for(let l of i.querySelectorAll(".dt-msg--new"))l.classList.remove("dt-msg--new");i.scrollTop=i.scrollHeight,No(i)}delete qe[a],i?.parentElement?.querySelector(".dt-new-below")?.remove();return}if(o==="newbelow"){let i=e.closest(".dt-note")?.querySelector(".dt-note-thread");i?.scrollTo({top:i.scrollHeight,behavior:Kn()?"smooth":"auto"}),delete qe[a],e.remove();return}if(o==="hand"){Ua(a,e.dataset.v);return}if(o==="repin"){om(a);return}if(o==="pin-yes"){await Mm(a);return}if(o==="open-it"){km(a);return}if(o==="lost-resolve"){X=null,await Xe(a,!0);return}if(o==="claude"){tl(a);return}if(o==="sendback"){await Xe(a,!1),io(".dt-note-reply-input");return}if(o==="accept"){await Xe(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(X=null),await ss(a,o==="archive");return}e.classList.contains("dt-step-act")||(X=null),o==="rm"?await fi(a):await Xe(a,o==="done")});let Sd="",We=t=>{vn.hidden||qs.contentWindow?.postMessage({dt:!0,...t},location.origin)},Tm=()=>({notes:Kt,grid:!Tt.hidden,inspect:ft,resolved:Ue,archived:pn,...Td.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(x&&e.projectGrid!==void 0){Wt=e.projectGrid,Tt.hidden||U();return}if(!x&&t.source===qs.contentWindow){if(e.key){Qd(e.key[0],e.key[1])?.run();return}if(e.closeMenus){F();return}if(e.route){gt();return}if(e.drafts){hi=e.drafts,ue(Xt());return}}if(x&&typeof e.openDraft=="number"){xi(e.openDraft);return}if(x&&typeof e.dropDraft=="number"){ql(e.dropDraft);return}if(x&&typeof e.device=="string"&&(Sd=e.device),x&&e.scrollbar&&ee.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===qs.contentWindow){We(Tm());return}typeof e.notes=="boolean"&&e.notes!==Kt&&Qe(e.notes,!1),typeof e.open=="number"&&Ms(e.open),typeof e.grid=="boolean"&&e.grid===Tt.hidden&&I(e.grid),typeof e.inspect=="string"&&e.inspect!==ft&&Y(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Ue&&Mi(e.resolved),typeof e.archived=="boolean"&&e.archived!==pn&&ki(e.archived),e.reload&&is()});let Ze=async()=>{await is(),We({reload:!0}),x&&parent.postMessage({dt:!0,reload:!0},location.origin)},Qe=(t,e=!0)=>{if(Kt=t,Pt.setAttribute("aria-pressed",String(t)),t?!x&&rt.hidden&&mt.getItem("dt-history")==="1"&&(Fl(),ve.setAttribute("aria-pressed","true")):(Dl(()=>{Kt||rt.replaceChildren()}),ve.setAttribute("aria-pressed","false")),D(Nr,t?"1":"0"),We({notes:t}),x&&e&&parent.postMessage({dt:!0,notes:t},location.origin),nt.hidden=!t||!vn.hidden,ee.toggle("dt-noting",t),t&&!x?zl():document.querySelector(".dt-room")?.remove(),t){Y(""),document.addEventListener("click",Di,!0),document.addEventListener("pointerup",pd,!0);for(let s of rd)document.addEventListener(s,cd,!0);document.addEventListener("contextmenu",ud,!0),document.addEventListener("keydown",id),document.addEventListener("mousemove",qi),addEventListener("scroll",Je,!0),addEventListener("scroll",ga,!0),addEventListener("scroll",ra,!0),addEventListener("resize",Je),addEventListener("resize",ga),addEventListener("pointerover",Ul,!0),_s(),Gl.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),Kl.observe(document.body),Pi()}else{nn(),X=null,document.removeEventListener("click",Di,!0),document.removeEventListener("pointerup",pd,!0);for(let s of rd)document.removeEventListener(s,cd,!0);document.removeEventListener("contextmenu",ud,!0),document.removeEventListener("keydown",id),document.removeEventListener("mousemove",qi),Zn.hidden=!0,removeEventListener("scroll",Je,!0),removeEventListener("scroll",ga,!0),removeEventListener("scroll",ra,!0),removeEventListener("resize",Je),removeEventListener("resize",ga),removeEventListener("pointerover",Ul,!0),Gl.disconnect(),Kl.disconnect(),nt.innerHTML=""}},{pickBp:Ui,...Td}=iu({cfg:n,inFrame:x,persist:D,frame:vn,frameEl:qs,devicesMenu:Jn,bpBtns:Yt,notesOverlay:nt,WIDE:b,bpOf:E,currentBp:ja,deviceById:T,notesOn:()=>Kt,filter:()=>qa,filterTo:t=>{qa=t},dropFrameDrafts:()=>{hi=[]},putAway:()=>{X=null,nn()},tellFrame:We,syncBpButtons:Or,render:()=>Z(),reread:()=>{Kt?Pi():Z()}}),Ad="dt-studio",Hd=t=>{Xn.setAttribute("aria-pressed",String(t)),ee.toggle("dt-no-studio",!t),D(Ad,t?"1":"0")};Xn.addEventListener("click",()=>Hd(Xn.getAttribute("aria-pressed")!=="true")),Hd(mt.getItem(Ad)!=="0"),Pt.addEventListener("click",()=>Qe(!Kt));let fe=document.querySelector(".devtools"),As=document.querySelector(".dt-tab"),Cd=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-fe.getBoundingClientRect().top)+12}px`);new ResizeObserver(Cd).observe(fe),addEventListener("resize",Cd);let Am=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),Nd=()=>{fe.removeAttribute("data-tight");let t=fe.getBoundingClientRect().right,e=Am(),s=!1;for(let o of fe.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)}fe.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||s)},Bd=0,Yi=()=>{cancelAnimationFrame(Bd),Bd=requestAnimationFrame(Nd)},Hm=new ResizeObserver(Yi);for(let t of fe.children)Hm.observe(t);addEventListener("resize",Yi),Nd();for(let t of[1500,4e3])setTimeout(Yi,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))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 Rd=t=>{fe.toggleAttribute("data-collapsed",t),As.toggleAttribute("data-collapsed",t),As.setAttribute("aria-expanded",String(!t)),As.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),fe.inert=t,t&&F(),t&&Ns&&va(""),t&&Kt&&!N&&X==null&&Qe(!1),D("dt-collapsed",t?"1":"0")};As.addEventListener("click",()=>Rd(!fe.hasAttribute("data-collapsed")));let an=document.querySelector(".dt-keys"),Pd=an.querySelector(".dt-set-keys"),Cm=an.querySelector(".dt-set-main"),co=an.querySelector(".dt-set-grid"),Id=an.querySelector('[data-set="grid"] .dt-set-hint'),uo=t=>{if(Cm.hidden=t!=="main",Pd.hidden=t!=="keys",co.hidden=t!=="grid",t==="grid"&&Pm(),Id){let e=ne();Id.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},Xi=t=>uo(t?"keys":"main"),Ji={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}},po={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},Nm=["cols","gutter","margin","max"],ya=(t,e)=>Math.min(po[t][1],Math.max(po[t][0],Math.round(e))),Bm=()=>({...Ji,...Wt?.widths}),Zi=()=>!!n.project&&!!n.gridAdmin,Od=()=>!Tt.hidden&&!ne()&&k?k:me(),Rm=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},Pm=()=>{let t=Zi(),e=Bm(),s=Et(),o=ne(),a=m.find(c=>c.id===s),i=(c,p)=>`<div class="dt-grid-row"><span>${c}</span><b>${p}</b></div>`,l=(de.cabinet||n.cabinet)&&n.project?` <a href="${f(`${de.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>
334
- <div class="dt-grid-fields">${Nm.map(c=>`<label><span>${c==="cols"?"Cols":c[0].toUpperCase()+c.slice(1)}</span>
335
- <input type="number" inputmode="numeric" step="1" min="${po[c][0]}" max="${po[c][1]}" data-grid-k="${c}" value="${o[c]??""}"${c==="max"?' placeholder="\u2014"':""}${t?"":" disabled"}></label>`).join("")}</div><hr>
336
- ${m.filter(c=>c.id!==s&&e[c.id]).map(c=>i(`${f(Rm(c.label))} \xB7 ${c.ideal}`,`${e[c.id].cols} \xB7 ${e[c.id].gutter} \xB7 ${e[c.id].margin}`)).join("")}<hr>
337
- <p class="dt-grid-foot">${t?"Saved for the project \u2014 everyone sees it.":"Set by the project\u2019s admins."}${l}</p>`;else{let c=Od();d=i(c.from==="guess"?"Guessed":"Read from the page",`${c.cols} \xD7 ${c.w}`)+i("Gap",String(c.gap))+i("Margin",String(c.x))}co.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${Ha}<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(c=>`<button type="button" role="radio" data-grid-mode="${c}" aria-checked="${c==="custom"==!!o}"${t?"":" disabled"}>${c==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},qd=async(t,e)=>{let s=Wt,o=c=>{c&&!co.hidden&&uo("grid"),Tt.hidden||U(),We({projectGrid:Wt})};Wt=t(Wt),o(e);let a=await ae("config").then(c=>c.ok?c.json():null).catch(()=>null),i=t(a?a.projectGrid??null:s),l=await ae("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:i})}).catch(()=>null);if(l?.ok){Wt=(await l.json()).grid??null;return}let d=l?await l.text():"";Ut(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),Wt=s,o(!0)};if(co.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!Zi()||e==="custom"==!!ne())return;let s=Et(),o=e==="custom"?Od():null,a=document.documentElement.clientWidth,i=o&&{cols:ya("cols",o.cols),gutter:ya("gutter",o.gap),margin:ya("margin",o.x),max:Math.abs(a-2*o.x-o.w)<=2?null:ya("max",o.w)};qd(l=>({mode:e,widths:{...Ji,...l?.widths,...i?{[s]:i}:{}}}),!0)}),co.addEventListener("change",t=>{let e=t.target,s=e.dataset.gridK,o=ne();if(!s||!o||!Zi())return;let a=e.value.trim()===""?null:Number(e.value),[i,l]=po[s];if(a===null?s!=="max":!Number.isInteger(a)||a<i||a>l){Ut(`${s==="cols"?"Cols":s[0].toUpperCase()+s.slice(1)} is ${i}\u2013${l}${s==="max"?" or empty":""}.`),e.value=String(o[s]??"");return}if(a===o[s])return;let d=Et();qd(c=>({mode:"custom",widths:{...Ji,...c?.widths,[d]:{...c?.widths?.[d]??o,[s]:a}}}),!1)}),yt.querySelector("button").addEventListener("click",()=>{F(),an.open=!0,uo("grid")}),uo("main"),de.signOut)for(let t of document.querySelectorAll('.dt-me [data-set="out"], .dt-me [data-set-out]'))t.hidden=!1;Im();function Im(){let t=document.querySelector(".dt-strip"),e=document.documentElement;if(x){t.hidden=!0;return}ee.toggle("dt-strip-on",!0);let s=t.querySelector(".dt-me");if(n.me){s.querySelector(".dt-me-face").innerHTML=Nn(n.me.avatar_url,n.me.name||n.me.email).replace(/^<(img|b) /,`<$1 style="--hue:${Ne(n.me.email.toLowerCase())}" `);let M=de.cabinet||n.cabinet;if(M){let V=s.querySelector(".dt-me-cab"),K=s.querySelector(".dt-me-acc");V.href=n.project?`${M}/p/${n.project}`:M,V.hidden=!1,K.href=`${M}/settings?tab=account`,K.hidden=!1}}s.addEventListener("click",M=>{let V=M.target.closest("[data-set], a");V&&(s.open=!1,V.dataset.set==="out"&&confirm("Sign out of Notemend on this site?")&&(mt.removeItem(Ts),de.signOut?.()))});let o=t.querySelector(".dt-pages"),a=o.querySelector(".dt-pages-find input"),i=o.querySelector(".dt-pages-hits"),l=o.querySelector(".dt-pages-foot");o.addEventListener("toggle",()=>{if(o.open){a.value="",d(),requestAnimationFrame(()=>a.focus());let M=o.querySelector(".dt-pages-copy");M&&(delete M.dataset.copied,M.dataset.tip="Copy link")}});let d=()=>{let M=a.value.trim().toLowerCase();if(Rt.hidden=!!M,i.hidden=!M,l.classList.toggle("is-off",!!M),!M)return;let V=n.pages.filter(K=>K.label.toLowerCase().includes(M)||K.route.toLowerCase().includes(M)).slice(0,12);i.innerHTML=V.length?`<ul>${V.map(K=>`<li><a href="${f(K.route)}"${K.route===St?' 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(a.value.trim())}\u201D</p>`};a.addEventListener("input",d),a.addEventListener("keydown",M=>{M.key==="Enter"&&(M.preventDefault(),i.querySelector("a")?.click()),M.key==="Escape"&&a.value&&(M.preventDefault(),M.stopPropagation(),a.value="",d())});let c=o.querySelector(".dt-pages-copy"),p=M=>{M.preventDefault(),M.stopPropagation(),M instanceof MouseEvent&&M.detail>0&&c.blur(),navigator.clipboard?.writeText(location.href.replace(/#.*$/,"")).catch(()=>null),c.dataset.copied="",c.dataset.tip="Link copied",clearTimeout(Number(c.dataset.t)),c.dataset.t=String(window.setTimeout(()=>{delete c.dataset.copied,c.dataset.tip="Copy link"},1600))};c.addEventListener("click",p),c.addEventListener("keydown",M=>{(M.key==="Enter"||M.key===" ")&&p(M)}),Yn=()=>{gt(),as(vt),Mt&&It()};let v=()=>{D("dt-folders-open",JSON.stringify([...se])),D("dt-folders-closed",JSON.stringify([...jt]))};if(Rt.addEventListener("click",M=>{let V=M.target,K=V.closest(".dt-folder-more");if(K)return M.preventDefault(),pe(K);let ut=V.closest(".dt-folder-row");if(!ut||ut.querySelector("input"))return;let lt=ut.parentElement,_=lt.dataset.folder,st=!lt.hasAttribute("data-open");st?(se.add(_),jt.delete(_)):(se.delete(_),jt.add(_)),v(),lt.toggleAttribute("data-open",st),ut.setAttribute("aria-expanded",String(st)),ut.children[1].outerHTML=cn(st),Na(lt.querySelector(":scope > ul"),st)}),Rt.addEventListener("keydown",M=>{(M.key==="Enter"||M.key===" ")&&M.target.matches(".dt-folder-row")&&(M.preventDefault(),M.target.click())}),!Mt)return;let A=new Set,j="",h=M=>{let V=M.closest("li[data-route]");if(V)return`p:${V.dataset.route}`;let K=M.closest(".dt-folder:not(.dt-folder--site)");return K&&M.closest(".dt-folder-row")?`f:${K.dataset.folder}`:""},G=()=>[...Rt.querySelectorAll("li[data-route], .dt-folder:not(.dt-folder--site)")].filter(M=>M.matches(".dt-folder")||M.offsetParent).map(M=>M.dataset.route?`p:${M.dataset.route}`:`f:${M.dataset.folder}`),z=l.querySelector(".dt-sel-hint");function It(){for(let V of Rt.querySelectorAll(".is-picked"))V.classList.remove("is-picked");for(let V of A)(V.startsWith("p:")?Rt.querySelector(`li[data-route="${CSS.escape(V.slice(2))}"] > a`):Rt.querySelector(`[data-folder="${CSS.escape(V.slice(2))}"] > .dt-folder-row`))?.classList.add("is-picked");let M=A.size;z.hidden=!M,z.innerHTML=M?`<b>${M} 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 Bt=()=>{A.size&&(A.clear(),j="",It())};Rt.addEventListener("click",M=>{let V=M,K=V.metaKey||V.ctrlKey,ut=V.shiftKey,lt=h(M.target);if(!lt||!K&&!ut){M.target.closest(".dt-folder-more")||Bt();return}if(M.preventDefault(),M.stopImmediatePropagation(),ut&&j){let _=G(),st=_.indexOf(j),at=_.indexOf(lt);if(st>=0&&at>=0)for(let te of _.slice(Math.min(st,at),Math.max(st,at)+1))A.add(te)}else A.has(lt)?A.delete(lt):A.add(lt);j=lt,It()},!0),o.addEventListener("toggle",()=>{o.open||Bt()});let le=()=>{let M=G().filter(st=>A.has(st)&&st.startsWith("p:")).map(st=>st.slice(2)),V=[...A].filter(st=>st.startsWith("f:")).map(st=>st.slice(2)).filter(st=>!Q.some(at=>A.has(`f:${at.id}`)&&Lt(st,at.id)));if(!M.length&&!V.length)return;let K=new Set([...M.map(st=>Q.find(at=>at.pages.includes(st))?.id??""),...V.map(st=>Q.find(at=>at.id===st)?.parent??"")]),ut=K.size===1&&[...K][0]||null,lt=Math.random().toString(36).slice(2,10),_=[{id:lt,name:"Untitled folder",pages:M,...ut?{parent:ut}:{}},...Q.map(st=>({...st,pages:st.pages.filter(at=>!M.includes(at)),...V.includes(st.id)?{parent:lt}:{}}))];ut&&(se.add(ut),jt.delete(ut)),A.clear(),j="",se.add(lt),jt.delete(lt),v(),Ot(_),Ct(lt,!1)};z.addEventListener("click",M=>{let V=M.target.closest("[data-sel]")?.dataset.sel;V==="group"&&le(),V==="ungroup"&&bt()});let bt=()=>{let M=new Set([...A].filter(ut=>ut.startsWith("f:")).map(ut=>ut.slice(2)));for(let ut of A)if(ut.startsWith("p:")){let lt=Q.find(_=>_.pages.includes(ut.slice(2)));lt&&M.add(lt.id)}if(!M.size)return;let V=Q,K=Q.filter(ut=>M.has(ut.id));A.clear(),j="",Ot(kt(Q,M)),Be(K.length===1?`Ungrouped \u201C${K[0].name}\u201D`:`Ungrouped ${K.length} folders`,()=>Ot(V))};document.addEventListener("keydown",M=>{if(!(!o.open||M.target?.closest?.("input:not(.dt-pages-find input), textarea"))){if(M.key==="Escape"&&A.size){M.preventDefault(),M.stopImmediatePropagation(),Bt();return}(M.metaKey||M.ctrlKey)&&M.code==="KeyG"&&A.size&&(M.preventDefault(),M.stopImmediatePropagation(),M.shiftKey?bt():le())}},!0),Rt.addEventListener("dblclick",M=>{let V=M.target.closest(".dt-folder:not(.dt-folder--site)");!V||M.target.closest(".dt-folder-more, input")||!M.target.closest(".dt-folder-row")||(M.preventDefault(),Ct(V.dataset.folder,!1))});let Ot=async M=>{let V=Q;Q=M,Le();let K=await ae("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({folders:M})}).catch(()=>null);if(K?.ok){let lt=(await K.json()).folders??[];JSON.stringify(lt)!==JSON.stringify(Q)&&(Q=lt,Le());return}let ut=K?await K.text():"";Ut(K?(()=>{try{return JSON.parse(ut).error}catch{return ut}})()||"The folders were not saved.":"The folders were not saved \u2014 no connection."),Q=V,Le()},kt=(M,V)=>{let K=M.map(ut=>({...ut,pages:[...ut.pages]}));for(let ut of V){let lt=K.find(at=>at.id===ut);if(!lt)continue;let _=lt.parent&&K.some(at=>at.id===lt.parent&&at.id!==ut)?lt.parent:null;K=K.filter(at=>at.id!==ut).map(at=>at.parent===ut?{...at,parent:_}:at);let st=_?K.find(at=>at.id===_):null;if(st)for(let at of lt.pages)st.pages.includes(at)||st.pages.push(at)}return K.map(({parent:ut,...lt})=>ut?{...lt,parent:ut}:lt)},Lt=(M,V)=>{let K=Q.find(ut=>ut.id===M);return!!K?.parent&&(K.parent===V||Lt(K.parent,V))},Ct=(M,V)=>{let K=Rt.querySelector(`[data-folder="${CSS.escape(M)}"] .dt-folder-row .dt-menu-label`);if(!K)return;let ut=Q.find(at=>at.id===M),lt=document.createElement("input");lt.className="dt-folder-name",lt.value=ut.name,lt.maxLength=60,lt.setAttribute("aria-label","Folder name"),K.replaceWith(lt),lt.focus(),lt.select();let _=!1,st=at=>{if(_)return;_=!0;let te=lt.value.trim();if(at&&te)return void Ot(Q.map(ze=>ze.id===M?{...ze,name:te}:ze));V&&(Q=Q.filter(ze=>ze.id!==M)),Le()};lt.addEventListener("keydown",at=>{at.key==="Enter"&&(at.preventDefault(),st(!0)),at.key==="Escape"&&(at.preventDefault(),at.stopPropagation(),st(!1)),at.stopPropagation()}),lt.addEventListener("blur",()=>st(!0)),lt.addEventListener("click",at=>at.stopPropagation())};l.querySelector(".dt-folder-new").addEventListener("click",()=>{let M=Math.random().toString(36).slice(2,10);Q=[{id:M,name:"Untitled folder",pages:[]},...Q],se.add(M),v(),Le(),Ct(M,!0)});let _t=null,ke=()=>{_t?.remove(),_t=null};o.addEventListener("toggle",()=>{o.open||ke()});function pe(M){ke();let V=M.closest(".dt-folder").dataset.folder,K=Q.find(_=>_.id===V);_t=document.createElement("div"),_t.className="dt-folder-menu",_t.setAttribute("role","menu"),_t.innerHTML=`<button type="button" role="menuitem" data-do="rename">${Gn}<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">${cn(!1)}<span>New folder inside</span></button>`+(K.pages.length||Q.some(_=>_.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">${Vn}<span>Delete folder</span></button>`,o.append(_t);let ut=M.getBoundingClientRect(),lt=o.getBoundingClientRect();_t.style.left=`${ut.right-lt.left+6}px`,_t.style.top=`${ut.top-lt.top-4}px`,_t.addEventListener("click",_=>{let st=_.target.closest("[data-do]")?.dataset.do;if(!st)return;if(ke(),st==="rename")return Ct(V,!1);if(st==="add")return nr(V,M);if(st==="sub"){let te=Math.random().toString(36).slice(2,10);return Q=[{id:te,name:"Untitled folder",pages:[],parent:V},...Q],se.add(V),se.add(te),jt.delete(V),v(),Le(),Ct(te,!0)}let at=Q;Ot(kt(Q,new Set([V]))),Be(st==="delete"?`Deleted \u201C${K.name}\u201D`:`Ungrouped \u201C${K.name}\u201D`,()=>Ot(at))})}function nr(M,V){ke();let K=Q.find(st=>st.id===M),ut=n.pages.filter(st=>!K.pages.includes(st.route));_t=document.createElement("div"),_t.className="dt-folder-menu dt-folder-add",_t.setAttribute("role","menu"),_t.innerHTML=`<p class="dt-pages-group">Add to ${f(K.name)}</p>`+(ut.length?ut.map(st=>`<button type="button" role="menuitem" data-route="${f(st.route)}"><span>${f(st.label)}</span><em class="dt-pages-route">${f(st.route)}</em></button>`).join(""):'<p class="dt-pages-none">Every page is in it</p>'),o.append(_t);let lt=V.getBoundingClientRect(),_=o.getBoundingClientRect();_t.style.left=`${lt.right-_.left+6}px`,_t.style.top=`${lt.top-_.top-4}px`,_t.addEventListener("click",st=>{let at=st.target.closest("[data-route]");if(!at)return;let te=at.dataset.route;at.remove(),se.add(M),jt.delete(M),v(),Ot(Q.map(ze=>({...ze,pages:ze.id===M?[...ze.pages.filter(_n=>_n!==te),te]:ze.pages.filter(_n=>_n!==te)})))})}let Ln="";Rt.addEventListener("dragstart",M=>{let V=M.target.closest("li[data-route], li.dt-folder");V&&(M.stopPropagation(),Ln=V.dataset.route??`f:${V.dataset.folder}`,V.classList.add("is-dragging"),M.dataTransfer?.setData("text/plain",Ln),M.dataTransfer&&(M.dataTransfer.effectAllowed="move"))});let rn=M=>M?.closest?.(".dt-folder:not(.dt-folder--site)")??null;Rt.addEventListener("dragover",M=>{if(!Ln)return;M.preventDefault();let V=rn(M.target);for(let K of Rt.querySelectorAll(".is-drop"))K!==V&&K.classList.remove("is-drop");V?.classList.add("is-drop"),Rt.classList.toggle("is-drop-out",!V)}),Rt.addEventListener("dragend",()=>{Ln="",Rt.classList.remove("is-drop-out");for(let M of Rt.querySelectorAll(".is-drop, .is-dragging"))M.classList.remove("is-drop","is-dragging")});let go=M=>requestAnimationFrame(()=>{let V=Rt.querySelector(M);V&&(Mo(V,"glow"),V.scrollIntoView({block:"nearest",behavior:Kn()?"smooth":"auto"}))});Rt.addEventListener("drop",M=>{M.preventDefault();let V=Ln,K=rn(M.target)?.dataset.folder;if(!V)return;if(V.startsWith("f:")){let _=V.slice(2);if(K===_||K&&Lt(K,_))return;let st=Q.map(at=>at.id===_?{...at,parent:K??null}:at).map(({parent:at,...te})=>at?{...te,parent:at}:te);K&&(se.add(K),jt.delete(K),v()),JSON.stringify(st)!==JSON.stringify(Q)&&(Ot(st),go(`[data-folder="${CSS.escape(_)}"] > .dt-folder-row`));return}let ut=Q.map(_=>({..._,pages:_.pages.filter(st=>st!==V)})),lt=K?ut.find(_=>_.id===K):null;lt&&(lt.pages.push(V),se.add(lt.id),v()),JSON.stringify(ut)!==JSON.stringify(Q)&&(Ot(ut),go(`li[data-route="${CSS.escape(V)}"] > a`))})}an.querySelector("summary").addEventListener("click",()=>Xi(!1));let Fn=fe.querySelector(".dt-vision"),Hs=Fn.querySelector(".dt-vision-sheet"),mo=[{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">${mo.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 Dd=document.createElement("style");document.head.append(Dd);let Cs=document.createElement("div");Cs.className="dt-seeing",Cs.hidden=!0,fe.append(Cs);let Ns="",va=t=>{Ns=t;let e=mo.find(s=>s.id===t)??mo[0];Dd.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",Fn.toggleAttribute("data-on",!!t),Cs.hidden=!t,Cs.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>`:""};Cs.addEventListener("click",t=>{t.target.closest("button")&&va("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!Ns||t.defaultPrevented||tc(t.target)||(va(""),t.preventDefault())});let wa=null,Qi=0,tr=0,Fd=()=>{let t=Math.round((Date.now()-Qi)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},jd=t=>{if(t==="none"){Hs.className="dt-sheet dt-vision-sheet dt-vision-list",Hs.innerHTML='<p class="dt-vision-title">See the page as</p>'+mo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Ns}"><span>${s.name}</span>${s.id===Ns?xt('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${s.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;Hs.className="dt-sheet dt-vision-sheet",Hs.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 ${Fd()}`}</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">${mo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Ns}"><span class="dt-vision-thumb">${wa&&t==="ready"?`<img src="${wa}" alt="" style="filter:${s.id==="low"?`blur(${(2.5*e*2).toFixed(2)}px)`:s.css}">`:""}</span><span>${s.name}</span></button>`).join("")}</div>`},er=async()=>{let t=++tr;jd("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(`${fs}, .dt-pad-overlay, .dt-grid-overlay, .dt-vision-defs, .dt-toast`))}),new Promise(a=>setTimeout(()=>a(null),4e3))])}catch{s=null}t!==tr||!Fn.open||(wa=s,Qi=Date.now(),jd(s?"ready":"none"))},_d=0,Wd=0,zd=()=>{clearTimeout(Wd),Wd=window.setTimeout(er,400)};Fn.addEventListener("toggle",()=>{if(clearInterval(_d),removeEventListener("scroll",zd,!0),!Fn.open){tr++;return}er(),addEventListener("scroll",zd,!0),_d=window.setInterval(()=>{let t=Hs.querySelector(".dt-vision-ago");t&&wa&&Qi&&(t.textContent=`snapshot \xB7 ${Fd()}`)},1e3)}),Hs.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void er();let s=e.closest("[data-vision]");s&&(va(s.dataset.vision??""),Fn.open=!1)});let ho=fe.querySelector(".dt-custom"),$a=ho.querySelector(".dt-custom-sheet"),Vd="dt-hidden-tools",Gd="dt-new-seen",Kd=["contrast","vision"],Ud=()=>{let t=(o,a,i)=>{let l=fe.querySelector(a);return l?{id:o,el:l,name:i}: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=[...Yt.map(o=>({id:`bp:${o.dataset.bp}`,el:o,name:(o.getAttribute("aria-label")??o.dataset.bp??"").replace(/^mobile\s+(\w)/i,(a,i)=>i.toUpperCase())})),{id:"devices",el:Jn,name:"Device menu"}];return[...n.client?[]:[{group:"Inspect",tools:e.filter(o=>!!o)}],{group:"Devices",tools:s}]},Yd=t=>(mt.getItem(t)??"").split(",").filter(Boolean),jn=new Set(Yd(Vd)),Xd=()=>{for(let{tools:e}of Ud())for(let s of e)s.el.toggleAttribute("data-off",jn.has(s.id));Object.entries(ct).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&Y("")},Om=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",Jd=()=>{let t=Yd(Gd);$a.innerHTML=Ud().map(({group:e,tools:s})=>{let o=s.filter(a=>!jn.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="${!jn.has(a.id)}">${Om(a.el)}<span>${f(a.name)}</span>${Kd.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"${jn.size?"":" disabled"}>Show all</button><span></span><button type="button" class="dt-custom-done">Done</button></div>`};$a.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){ho.open=!1;return}e.closest(".dt-custom-all")&&jn.clear();let s=e.closest("[data-tool]");if(s){let o=s.dataset.tool;jn.delete(o)||jn.add(o)}!s&&!e.closest(".dt-custom-all")||(D(Vd,[...jn].join(",")),Xd(),Jd(),$a.querySelector(s?`[data-tool="${s.dataset.tool}"]`:".dt-custom-done")?.focus())}),ho.addEventListener("toggle",()=>{ho.open?(Jd(),$a.querySelector(".dt-custom-tile")?.focus()):D(Gd,Kd.join(","))}),Xd(),an.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return Xi(s==="keys");if(s==="grid")return uo("grid");an.open=!1,s==="custom"&&(ho.open=!0),s==="hide"&&As.click()});let tn=t=>()=>fe.querySelector(t)?.click(),Zd=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},xa=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:tn(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:tn(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:tn(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>ki(!pn)},{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){F(),e.open=!0;return}document.querySelector(".dt-history")?.hasAttribute("hidden")&&tn(".dt-history-btn")(),rt.hasAttribute("data-collapsed")&&la(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Team / client",run:()=>He?void xd():ks(Fe==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Ls.hidden||Qs(on.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:tn(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:tn(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:tn(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:tn(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:tn(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:tn(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{Fn.open=!Fn.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:tn(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:tn(".dt-studio-btn")}]:[],...Yt.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:()=>{Jn.open=!Jn.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:Zd(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:Zd(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>As.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=an.open&&!Pd.hidden;an.open=!t,Xi(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),Qd=(t,e)=>xa.find(s=>s.code===t&&!s.shift==!e&&!(s.el&&fe.querySelector(s.el)?.closest("[data-off]"))&&!(s.code==="KeyD"&&Jn.hasAttribute("data-off"))),tc=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 xa){let a=o.el&&fe.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(xa.map(o=>o.group))].map(o=>e(o,xa.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"))),an.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||tc(o.composedPath()[0]??o.target))return;let a=Qd(o.code,o.shiftKey);a&&setTimeout(()=>{o.defaultPrevented||(x?parent.postMessage({dt:!0,key:[o.code,o.shiftKey]},location.origin):a.run())})}),x){let o=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",o,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&o()})}}if(!x){Rd(mt.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>fe.setAttribute("data-ready",""))),Td.restore(),I(mt.getItem(Ft)==="1");let t=mt.getItem($t);t&&t in ct&&Y(t),Qe(mt.getItem(Nr)==="1"&&St!=="/connect")}let ec=()=>{try{let t=JSON.parse(mt.getItem(wn)||"null");De=(t?.parked??[]).filter(s=>Ds(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};if(t?.draft&&e(t.draft.selector)?(N=t.draft,!Kt&&!x&&Qe(!0)):Ds(t?.draft)&&De.push(t.draft),t?.reply?.text&&(Ae=t.reply.text,un=X=t.reply.for??null),X==null)try{X=Number(sessionStorage.getItem(`nm-open:${wn}`))||null,sessionStorage.removeItem(`nm-open:${wn}`)}catch{}(N||De.length||Ae)&&Z()}catch{mt.removeItem(wn)}};ec();let nc=()=>setTimeout(()=>{let t=O(location.pathname);t!==St&&(clearTimeout(Bo),js(),St=t,x&&parent.postMessage({dt:!0,route:t},location.origin),wn=Pr(),N=null,De=[],Ae="",un=null,X=null,Qt=null,R=[],Kt&&!x&&Qe(!1),gt(),ec(),Pi(),is())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),nc()}}addEventListener("popstate",nc);try{let t=JSON.parse(mt.getItem(Ts)||"null");t?.project===od&&t.body?(Bi=t.body.version??"",Ri(t.body),no=""):t&&mt.removeItem(Ts)}catch{mt.removeItem(Ts)}r.then(async t=>{t.status===200&&Ri(await t.json(),!u)},()=>{}).then(()=>!u&&(Ue||pn)?is(!0):void 0).then(da.resume),document.addEventListener("visibilitychange",()=>{document.hidden||rs()}),addEventListener("focus",rs),addEventListener("notemend:changed",()=>{x||rs()});let Ea=!1,ds=null,sc=()=>{if(!(x||de.via||!("EventSource"in window))){if(document.hidden){ds?.close(),ds=null,Ea=!1;return}ds||(ds=new EventSource("/__devbar/events"),ds.onopen=()=>{Ea=!0},ds.onerror=()=>{Ea=!1},ds.onmessage=t=>{t.data!==no&&rs()})}};sc(),document.addEventListener("visibilitychange",sc);let qm=0;x||setInterval(()=>{(!(de.live||Ea)||++qm%6===0)&&rs()},2e4),setInterval(()=>{!document.hidden&&R.some(t=>ln(t))&&Z()},3e4),x&&parent.postMessage({dt:!0,hello:!0},location.origin)}function fu(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let r=HTMLDialogElement.prototype,u=r.showModal,m=null,g=null,b=()=>{if(m){g?.disconnect(),g=null;for(let y of n)document.body.append(y);try{m.hidePopover()}catch{}m.remove(),m=null}},E=()=>{b();let y=document.querySelector("dialog:modal");y&&H(y)},H=y=>{b(),m=document.createElement("div"),m.className="dt-host",m.setAttribute("popover","manual"),m.append(...n),y.append(m);try{m.showPopover()}catch{}y.addEventListener("close",E,{once:!0}),g=new MutationObserver(()=>{y.isConnected||E()}),g.observe(document.documentElement,{childList:!0,subtree:!0})};r.showModal=function(){u.call(this),this.isConnected&&H(this)}}function Tr(n,r,u,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=u,m&&(b.rel=m)),b.className="nm-ask-go",b.textContent=r;let E=document.createElement("style");return E.textContent=`.nm-ask{transition:border-color 120ms cubic-bezier(.22,1,.36,1)}
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)}
338
342
  .nm-ask:has(a.nm-ask-go:hover){border-color:rgba(255,255,255,.14)!important}
339
343
  .nm-ask-go{transition:background-color 120ms cubic-bezier(.22,1,.36,1),transform 120ms cubic-bezier(.22,1,.36,1)}
340
344
  a.nm-ask-go:hover{background:#ff7a33!important}
341
345
  a.nm-ask-go:active{background:#d94d00!important;transform:translateY(1px)}
342
346
  .nm-ask-go:focus-visible{outline:2px solid #ff6a1a;outline-offset:2px}
343
- @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(E,b),document.body.append(g),{pill:g,link:b}}function bu(n){let r=window;if(r.__notemend)return;r.__notemend=!0,Vc(g=>g.includes("/__devbar/")||!!de.base&&g.startsWith(de.base)),ee.ready=new Promise(g=>{if(!("__next_f"in self))return g();let b=0,E=()=>Object.keys(document.documentElement).some(H=>H.startsWith("__reactFiber$"))||++b>330?g():setTimeout(E,30);E()}),ee.toggle("dt-in-frame",Rs),ee.toggle("dt-strip-on",!Rs);let u=lc(),m=ae(u);Pc().then(async g=>{await n,ee.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,x,D]=[1,3,5].map(dt=>parseInt(b.slice(dt,dt+2),16)/255);ee.set("--dt-accent",b),ee.set("--dt-accent-ink",.2126*T+.7152*x+.0722*D>.55?"#000000":"#ffffff")}Dc(g);let E="",H=()=>{let T=document.body.currentCSSZoom??1,x=T>0&&Math.abs(T-1)>.001?String(1/T):"1";x!==E&&(E=x,ee.set("--dt-unzoom",x))};H();let y=new MutationObserver(H);for(let T of[document.documentElement,document.body])y.observe(T,{attributes:!0,attributeFilter:["style","class"]});addEventListener("resize",H),gu(g,m,u==="comments"),su(),fu([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-tipbox"].map(T=>document.querySelector(T)).filter(T=>!!T))}).catch(g=>{console.warn("[notemend] not started:",g),ee.toggle("dt-strip-on",!1);let b=window.__notemendHosted;de.via&&String(g).includes("config 403")&&b?.ask&&(de.refused=!0,b.ask("You\u2019re not in this project \u2014 sign in as someone else")),!de.via&&String(g).includes("config 401")&&xh(String(g.said??""))})}function xh(n){if(/link/i.test(n)&&!/sign in/i.test(n)){Tr(null,"Link this site to comment: npx notemend link <project-id>","");return}let{link:r}=Tr("/__devbar/signin","Sign in to comment","notemend-signin"),u=0;r.addEventListener("click",()=>{clearInterval(u),u=window.setInterval(async()=>{let m=await fetch("/__devbar/signin?code=1").then(g=>g.json()).catch(()=>null);if(m?.done){clearInterval(u),location.reload();return}m?.code&&(r.textContent=`Allow code ${m.code} in the cabinet tab`)},1500)})}var yu=window,hs=class extends Error{},vu=n=>new Set([...n.querySelectorAll("script")].filter(r=>!r.src.includes("/@vite/client")).map(r=>r.src?`src:${r.getAttribute("src").replace(/[?&]t=\d+/,"")}`:`inline:${r.textContent}`)),wu=(n,r)=>{let u=vu(n);return[...vu(r)].some(m=>!u.has(m))};function Eh(n,r){let u=[],m=n.firstChild;for(let g of r){let b=m;for(;b&&!(b.nodeName===g.nodeName&&(!(g instanceof Element)||!g.id||b.id===g.id));)b=b.nextSibling;u.push(b),b&&(m=b.nextSibling)}return u}function Mh(n,r,u){for(let{name:m,value:g}of u.attributes){let b=r.getAttribute(m);if(b!==g)if(m==="class"&&b!=null){let E=new Set(b.split(/\s+/)),H=new Set(g.split(/\s+/));for(let y of E)y&&!H.has(y)&&n.classList.remove(y);for(let y of H)y&&!E.has(y)&&n.classList.add(y)}else n.setAttribute(m,g)}for(let{name:m}of r.attributes)u.hasAttribute(m)||n.removeAttribute(m)}function $u(n,r,u){if(r.isEqualNode(u))return;if(r.nodeType!==Node.ELEMENT_NODE||u.nodeType!==Node.ELEMENT_NODE||r.nodeName!==u.nodeName||u.nodeName==="ASTRO-ISLAND"){if(r.nodeType===Node.TEXT_NODE&&u.nodeType===Node.TEXT_NODE){n.nodeValue=u.nodeValue;return}n.parentNode.replaceChild(document.importNode(u,!0),n);return}Mh(n,r,u);let m=[...r.childNodes],g=[...u.childNodes],b=Eh(n,m),E=0,H=0;for(;E<m.length&&E<g.length&&m[E].isEqualNode(g[E]);)E++;for(;H<m.length-E&&H<g.length-E&&m[m.length-1-H].isEqualNode(g[g.length-1-H]);)H++;let y=m.slice(E,m.length-H),T=g.slice(E,g.length-H);if(y.length===T.length&&y.every((J,tt)=>J.nodeName===T[tt].nodeName)){y.forEach((J,tt)=>{let O=b[E+tt];if(!O)throw new hs;$u(O,J,T[tt])});return}let x=H?b[m.length-H]:null,D=E?b[E-1]:null;if(H&&!x||E&&!D)throw new hs;for(let J of b.slice(E,m.length-H))J?.parentNode?.removeChild(J);let dt=x??(D?D.nextSibling:n.firstChild);for(let J of T)n.insertBefore(document.importNode(J,!0),dt)}function kh(n){for(let r of n.head.querySelectorAll("style, link[rel=stylesheet]")){let u=r.getAttribute("data-vite-dev-id"),m=r.getAttribute("href"),g=[...document.head.querySelectorAll("style, link[rel=stylesheet]")].find(b=>u?b.getAttribute("data-vite-dev-id")===u:m?b.getAttribute("href")===m:b.textContent===r.textContent);g?u&&r.tagName==="STYLE"&&g.textContent!==r.textContent&&(g.textContent=r.textContent):document.head.append(document.importNode(r,!0))}n.title&&n.title!==document.title&&(document.title=n.title)}var To=null,Ar=!1;function Hr(){return To?(Ar=!0,To):(To=(async()=>{try{let n=yu.__notemendPage,r=await fetch(location.href,{cache:"no-store",headers:{accept:"text/html"}});if(!n||!r.ok||!(r.headers.get("content-type")??"").includes("html"))throw new hs;let u=new DOMParser().parseFromString(await r.text(),"text/html");if(wu(n,u.body)||wu(document.head,u.head))throw new hs;kh(u),$u(document.body,n,u.body),yu.__notemendPage=u.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 hs||console.warn("[notemend] refresh in place failed, reloading:",n),location.reload()}finally{To=null,Ar&&(Ar=!1,Hr())}})(),To)}bu();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"),Hr()});
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()});