notemend 0.1.36 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/bin/mcp.mjs +2 -2
- package/package.json +1 -1
- package/src/client/index.js +70 -70
- package/src/client/notemend.css +1 -1
package/src/client/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import"./notemend.css";var ae={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function ie(n,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<8e3&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!ae.via){let h=window.__notemendEarly,g=!i.method||i.method==="GET"?h?.[n]:void 0;if(g){delete h[n];let y=await g;if(y)return y}return fetch(`/__devbar/${n}`,i)}let c=await ae.via(n,i);if(c.ok&&n.startsWith("comments")&&(i.method??"GET")==="GET"){let h=await c.json().catch(()=>{});h?.signed&&Object.assign(ae.signed,h.signed),c.json=()=>h===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(h)}return c}var wr=n=>ae.via?ae.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Vs=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),ct={getItem:n=>{try{return localStorage.getItem(n)}catch{return null}},setItem:(n,i)=>{try{localStorage.setItem(n,i)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}},yc=()=>ct.getItem("dt-resolved")==="0"&&ct.getItem("dt-archived")!=="1"?"comments?open=1":"comments";var xc=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null,Ec=n=>{let i={};for(let c of n?.images||[]){let h=xc(c);h&&(i[h]=c)}return i},Ao={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},$r=/^(exe|msi|msp|dmg|pkg|mpkg|app|sh|bash|zsh|command|bat|cmd|com|scr|cpl|ps1|psm1|vbs|vbe|js[e]?|wsf|wsh|hta|jar|apk|ipa|deb|rpm|bin|run|reg|lnk|inf|gadget|appimage)$/i,Vm=/^(png|jpe?g|webp|gif|webm)$/i,Da=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,Jt=(n,i)=>{let c=String(n??"");if(c.length<=i)return c;let h="";if(Da)for(let{segment:g}of Da.segment(c)){if(h.length+g.length>i)break;h+=g}else for(let g of c){if(h.length+g.length>i)break;h+=g}return h},Gm=[["PDF","#e5484d","pdf"],["DOC","#0d99ff","doc docx rtf odt pages"],["XLS","#30a46c","xls xlsx csv tsv numbers ods"],["PPT","#f76b15","ppt pptx key odp"],["ZIP","#ffb224","zip rar 7z tar gz tgz bz2"],["FIG","#7c6cf2","fig sketch psd ai xd indd eps"],["TXT","#12a594","txt md json html htm css ts tsx jsx xml yml yaml svg log"],["MP3","#d6409f","mp3 wav m4a ogg flac aac"],["MP4","#e93d82","mp4 mov avi mkv m4v"]],Mc=n=>{let i=String(n??"").split(".").pop().toLowerCase(),c=Gm.find(([,,h])=>h.split(" ").includes(i));return c?{label:c[0],color:c[1]}:{label:"FILE",color:"#717171"}},xr=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),Km=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((n,i)=>[n,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][i]])),kc=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>Km[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),Lc=n=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return i&&!$r.test(i[1])?i[1].toLowerCase():""};var Ho=n=>{let i=String(n??"");if(i.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!g)return null;let y=/;ext=([a-z0-9]{1,8})/i.exec(g[2])?.[1]?.toLowerCase()??Object.keys(Ao).find(S=>Ao[S]===g[1]);return y?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${y}`:null}let c=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(c))return null;let h=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(c);return h&&!Vm.test(h[2])?`${h[1]||"document"}.${h[2].toLowerCase()}`:null},an=n=>{let i=[{author:"you",text:n.text,at:n.createdAt,by:n.by,byName:n.byName,images:[],...n.reactions?{reactions:n.reactions}:{}},...n.note?[{author:"claude",text:n.note,at:n.updatedAt,images:[]}]:[],...(n.replies||[]).map(c=>({...c,images:[]}))];for(let c of n.images||[]){if(xc(c))continue;let h=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(c)?.[1]?.slice(0,13)),g=0;i.forEach((y,S)=>{Date.parse(y.at)<=h&&(g=S)}),i[g].images.push(c)}return i.filter(c=>!c.deleted)},Sc=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],Tc=["\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u{1F44C}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4AF}","\u{1F680}","\u{1F600}","\u{1F602}","\u{1F60A}","\u{1F60D}","\u{1F914}","\u{1F605}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62E}","\u{1F648}","\u{1F92F}","\u{1F62C}","\u{1F643}","\u{1F440}","\u{1F4A1}","\u{1F4CC}","\u{1F41B}","\u{1F3A8}","\u2615"];var Um=20,Ac=(n,i,c)=>{let h={...n||{}},g=h[i]||[];if(!g.length&&Object.keys(h).length>=Um)return null;let y=g.includes(c)?g.filter(S=>S!==c):[...g,c];return y.length?h[i]=y:delete h[i],Object.keys(h).length?h:void 0},Hc=n=>n.nickname||n.name||n.email,Er="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",Ym=new RegExp("^"+Er,"u"),Xm=(n,i)=>{let c="@"+i.toLowerCase(),h=-1;for(let g=n.indexOf(c);g!==-1;g=n.indexOf(c,g+1))Ym.test(n.slice(g+c.length))&&(h=g);return h};var Jm=/https?:\/\/[^\s<>"']+/g,vc=n=>{let i=n.filter(Boolean).pop();try{return i?decodeURIComponent(i):""}catch{return i}},Zm=n=>{let i;try{i=new URL(n)}catch{return{label:String(n),kind:"link"}}let c=i.hostname.replace(/^www\./,""),h=i.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(c))return{label:h[2]?`Figma \xB7 ${vc([h[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(c==="github.com"&&h.length){let[y,S,C,w]=h;return{label:`GitHub \xB7 ${S??y}${/^(pull|issues)$/.test(C??"")&&w?` #${w}`:""}`,kind:C==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(c))return{label:"Loom",kind:"link"};let g=vc(h);return{label:g?`${c} \xB7 ${g.length>32?Jt(g,31)+"\u2026":g}`:c,kind:"link"}},Mr=n=>{let i=String(n??""),c=[],h=0;for(let g of i.matchAll(Jm)){let y=g[0].replace(/[.,;:!?)\]]+$/,"");g.index>h&&c.push(i.slice(h,g.index)),c.push({url:y,...Zm(y)}),h=g.index+y.length}return h<i.length&&c.push(i.slice(h)),c},Cc=n=>Mr(n).map(i=>typeof i=="string"?i:i.label).join(""),wc={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},Nc=new Map,Bc=(n=[])=>{for(let i of n)i?.email&&Nc.set(i.email.toLowerCase(),i.agent_name?.trim()||"")},Zn=(n,i)=>i&&Nc.get(String(Lr(i)??i).toLowerCase())||"Agent",kr=n=>!n||n==="claude"?"via Claude Code":n==="agent"||!wc[n]?"":`via ${wc[n]}`,Fa="3.6 3.6 10.8 10.8",ja="M10.116 9H13.883M9.966 9.558L12.222 10.86M9.558 9.966L11.441 13.228M9 10.116V12.72M8.442 9.966L6.559 13.228M8.034 9.558L5.778 10.86M7.884 9H4.118M8.034 8.442L5.778 7.14M8.442 8.034L6.559 4.772M9 7.884V5.28M9.558 8.034L11.441 4.772M9.966 8.442L12.222 7.14",Lr=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,Xt=n=>n==="claude"||Lr(n)!=null;var Qm=["new","approved","progress","review","waiting"],De=n=>Qm.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":Xt(n?.assignee)?"approved":"new",Bt=n=>n?.client===!0||n?.shared===!0,Rc=(n,i,c="")=>`Duplicated from ${c?c==="you"?"your":`${c}\u2019s`:"a"} ${(i?Bt(i):!Bt(n))?"client":"studio"} thread`,Pc=n=>Bt(n)?"Duplicated for the client":"Mirrored to Team",Gs=n=>Number.isInteger(n?.from?.id)&&!Bt(n),Ic=(n="")=>`Mirrored from Client${n?` by ${n}`:""}`,To={new:"Received",progress:"In progress",review:"In progress",waiting:"In progress",done:"Fixed \u2014 please check"},Oc=(n,i=Date.now())=>n?.status==="done"?To.done:hn(n,i)||["progress","review","waiting"].includes(De(n))?To.progress:To.new,qc="Fixed \u2014 please check.",Dc=n=>n?.status==="done"&&!Bt(n)&&Number.isInteger(n.from?.id)?n.from.id:null;var _a=["agent","claude","codex","gemini"];var Sr=(n,i=[])=>{let c=String(n||"").toLowerCase();return _a.some(h=>Xm(c,h)!==-1)?"claude":null},Fc=(n,i=[],c="")=>{let h=String(n||"").replace(/^@/,"").toLowerCase();if(_a.includes(h))return"agent";let g=i.find(y=>[y.name,y.nickname,y.email].some(S=>S&&S.toLowerCase()===h));return g&&c&&g.email?.toLowerCase()===c.toLowerCase()?"you":"person"};var th=2*36e5,hn=(n,i=Date.now())=>n?.working&&n.status!=="done"&&i-Date.parse(n.working.at)<th?n.working:null;var Co=(n,i,c=Date.now())=>{let h=String(n?.by||n?.byName||"").toLowerCase();if(!h||i==="done")return null;let g=i==="claude"||Xt(n.assignee),y=g?hn(n,c)?.by||n.doneFor||n.handedBy||Lr(n.assignee)||h:n.assignee||"";return{writer:h,taker:String(y).toLowerCase(),claude:g}},Tr=n=>/@guest\.notemend\.com$/i.test(String(n||"")),Ee=(n,i=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":Xt(n.assignee)?"done":null;if(!Xt(n.assignee))return null;let c=an(n),h=c[c.length-1],g=hn(n,i);return c.length>1&&h.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(h.at))&&(!g||String(h.text??"").includes("?"))?"asks":g?g.step&&i-Date.parse(g.at)>eh?"stuck":"working":n.working?"stuck":De(n)==="approved"?"queued":null},eh=10*6e4,$c=(n,i=Date.now())=>{let c=Math.floor((i-Date.parse(n??""))/6e4);return c>=1?c<60?`${c} min`:`${Math.floor(c/60)} h`:"now"},Ar=(n,i=31)=>{let c=Da?[...Da.segment(String(n??""))].map(y=>y.segment):[...String(n??"")];if(c.length<=i)return c.join("");let h=c.join("").match(/\.\w{1,8}$/)?.[0],g=h?h.length+3:0;return c.slice(0,i-1-g).join("")+"\u2026"+(g?c.slice(-g).join(""):"")},Hr=(n,i=Date.now())=>{let c=n?.status!=="done"?n?.working:null;return c?.at?{step:c.step?String(c.step):null,elapsed:$c(c.since??c.at,i),silent:$c(c.at,i),stale:!hn(n,i)}:null};var jc=ja.split("M").filter(Boolean).map(n=>{let i=n.match(/[\d.]+/g).map(Number),[c,h]=/H/.test(n)?[i[2],i[1]]:/V/.test(n)?[i[0],i[2]]:[i[2],i[3]];return{d:"M"+n,a:(Math.atan2(c-9,9-h)+2*Math.PI)%(2*Math.PI)}}).sort((n,i)=>n.a-i.a).map(n=>n.d);var _c=(n,i)=>{if(n.archivedAt)return!0;if(!i||n.status!=="done"||n.doneBy==="claude")return!1;let c=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(h=>!h.deleted).map(h=>Date.parse(h.at||"")||0));return!!c&&Date.now()-c>i*864e5},nh=["uk","ru","en"],Wc=n=>{try{let i=new Intl.DisplayNames([n],{type:"language"}).of(n)??n;return i[0].toUpperCase()+i.slice(1)}catch{return n}},Cr=n=>{try{return new Intl.DisplayNames(["en"],{type:"language"}).of(n)??n}catch{return n}},Wa=n=>/[іїєґІЇЄҐ]/.test(n)?"uk":/[ыэъёЫЭЪЁ]/.test(n)?"ru":/\p{Script=Cyrillic}/u.test(n)?"":/\p{L}/u.test(n)&&!/[^\p{Script=Latin}\P{L}]/u.test(n)?"en":"",zc=(n,i="en")=>{let c=Wa(n),h=i.split("-")[0].toLowerCase();return[...new Set([h,...nh])].filter(g=>g!==c)};async function Vc(){let n=await ie("config");if(!n.ok)throw Object.assign(new Error(`config ${n.status}`),{said:n.status===401?await n.text().catch(()=>""):""});let i=await n.json();return i.breakpoints=i.breakpoints.map(c=>({...c,max:c.max??1/0})),Bc(i.team),i}var Gc=["iPhone","Android","Foldable","Tablet","Laptop & display"],No=[{id:"iphone-se",label:"iPhone SE",group:"iPhone",w:375,h:667,dpr:2,rotates:!0,mobile:!0},{id:"iphone-xr",label:"iPhone XR",group:"iPhone",w:414,h:896,dpr:2,rotates:!0,mobile:!0,insets:{left:0,top:44,right:0,bottom:34},cutout:{shape:"notch",x:92,y:0,width:231,height:33,"upper-radius":6,"lower-radius":25}},{id:"iphone-12-pro",label:"iPhone 12 Pro",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:90,y:0,width:210,height:32,"upper-radius":6,"lower-radius":23}},{id:"iphone-14",label:"iPhone 14",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-plus",label:"iPhone 14 Plus",group:"iPhone",w:428,h:926,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:133,y:0,width:161,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-pro",label:"iPhone 14 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-14-pro-max",label:"iPhone 14 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15",label:"iPhone 15",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-plus",label:"iPhone 15 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro",label:"iPhone 15 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16e",label:"iPhone 16e",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-16",label:"iPhone 16",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-plus",label:"iPhone 16 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro",label:"iPhone 16 Pro",group:"iPhone",w:402,h:874,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:139,y:14,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro-max",label:"iPhone 16 Pro Max",group:"iPhone",w:440,h:956,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:158,y:14,width:125,height:37,"border-radius":19}},{id:"jiophone-2",label:"JioPhone 2",group:"Android",w:240,h:320,dpr:1,rotates:!0,mobile:!0},{id:"pixel-7",label:"Pixel 7",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:52,right:0,bottom:0},cutout:{shape:"circle",x:183,y:0,width:55,height:52,cx:206,cy:26,radius:13}},{id:"pixel-8",label:"Pixel 8",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:182,y:0,width:46,height:50,cx:206,cy:25,radius:14}},{id:"pixel-8-pro",label:"Pixel 8 Pro",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:37,height:50,cx:224,cy:25,radius:14}},{id:"pixel-8a",label:"Pixel 8a",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:46,right:0,bottom:0},cutout:{shape:"circle",x:185,y:0,width:42,height:46,cx:206,cy:26,radius:13}},{id:"pixel-9",label:"Pixel 9",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"pixel-9-pro",label:"Pixel 9 Pro",group:"Android",w:427,h:952,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:68,right:0,bottom:0},cutout:{shape:"circle",x:195,y:0,width:36,height:68,cx:213,cy:34,radius:16}},{id:"pixel-9-pro-xl",label:"Pixel 9 Pro XL",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:66,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:38,height:66,cx:224,cy:33,radius:16}},{id:"pixel-10",label:"Pixel 10",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"samsung-galaxy-s8",label:"Samsung Galaxy S8+",group:"Android",w:360,h:740,dpr:4,rotates:!0,mobile:!0},{id:"samsung-galaxy-a55",label:"Samsung Galaxy A55",group:"Android",w:360,h:800,dpr:2.25,rotates:!0,mobile:!0},{id:"samsung-galaxy-s20-ultra",label:"Samsung Galaxy S20 Ultra",group:"Android",w:412,h:915,dpr:3.5,rotates:!0,mobile:!0},{id:"samsung-galaxy-a51-71",label:"Samsung Galaxy A51/71",group:"Android",w:412,h:914,dpr:2.625,rotates:!0,mobile:!0},{id:"facebook-on-android",label:"Facebook on Android",group:"Android",w:412,h:892,dpr:3.5,rotates:!0,mobile:!0},{id:"moto-g4",label:"Moto G4",group:"Android",w:360,h:640,dpr:3,rotates:!0,mobile:!0},{id:"moto-g-power",label:"Moto G Power",group:"Android",w:412,h:823,dpr:1.75,rotates:!0,mobile:!0},{id:"surface-duo",label:"Surface Duo",group:"Foldable",w:540,h:720,dpr:2.5,rotates:!0,mobile:!0},{id:"pixel-9-pro-fold",label:"Pixel 9 Pro Fold",group:"Foldable",w:412,h:922,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-6",label:"Galaxy Z Fold 6",group:"Foldable",w:412,h:968,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-5",label:"Galaxy Z Fold 5",group:"Foldable",w:344,h:882,dpr:2.625,rotates:!0,mobile:!0},{id:"asus-zenbook-fold",label:"Asus Zenbook Fold",group:"Foldable",w:853,h:1280,dpr:1.5,rotates:!0,mobile:!1},{id:"ipad-mini",label:"iPad Mini",group:"Tablet",w:768,h:1024,dpr:2,rotates:!0,mobile:!0},{id:"ipad-pro-13",label:"iPad Pro 13",group:"Tablet",w:1032,h:1376,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-7",label:"Surface Pro 7",group:"Tablet",w:912,h:1368,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-10",label:"Surface Pro 10",group:"Tablet",w:960,h:1440,dpr:2,rotates:!0,mobile:!0},{id:"galaxy-tab-s4",label:"Galaxy Tab S4",group:"Tablet",w:712,h:1138,dpr:2.25,rotates:!0,mobile:!0},{id:"nest-hub-max",label:"Nest Hub Max",group:"Laptop & display",w:1280,h:800,dpr:2,rotates:!1,mobile:!0},{id:"laptop-with-touch",label:"Laptop with touch",group:"Laptop & display",w:1280,h:950,dpr:1,rotates:!1,mobile:!1},{id:"laptop-with-hidpi-screen",label:"Laptop with HiDPI screen",group:"Laptop & display",w:1440,h:900,dpr:2,rotates:!1,mobile:!1},{id:"laptop-with-mdpi-screen",label:"Laptop with MDPI screen",group:"Laptop & display",w:1280,h:800,dpr:1,rotates:!1,mobile:!1}];var f=n=>n.replace(/[&<>"']/g,i=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[i]),Qn=n=>n?new Date(n).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Br=(n,i=c=>new Date(c).toLocaleDateString("en",{day:"numeric",month:"short"}))=>new Date(n).toDateString()===new Date().toDateString()?new Date(n).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):i(n),ts='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M8 6V4.2h4V6M6.6 6l.55 9.8h5.7L13.4 6"/></svg>',Me='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.8 10.4 8.2 13.8l7-7.6" stroke-linejoin="round"/></svg>',es='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M12.6 4.4l3 3-8.4 8.4H4.2v-3z" stroke-linejoin="round"/></svg>',kn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',Pn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.4 5.4l9.2 9.2M14.6 5.4l-9.2 9.2"/></svg>',za='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M12 5l-5 5 5 5" stroke-linejoin="round"/></svg>',Va='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',gn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.5 8.5h7.5a3.5 3.5 0 0 1 0 7H8.5M7.5 5.5l-3 3 3 3" stroke-linejoin="round"/></svg>',Fe=n=>`<svg viewBox="${Fa}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${ja}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Rr=(n,i)=>`<svg viewBox="${Fa}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${jc.map((c,h)=>`<path d="${c}" stroke-width="1.15" stroke-linecap="round"${h<i?"":' class="is-off"'}/>`).join("")}</svg>`,$t=(n,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${n}</svg>`,sh=n=>n.breakpoints.map(i=>["new","progress","review","waiting","done"].map(c=>`<b data-bp="${f(i.id)}" data-state="${c}" hidden>${$t(i.icon,11)}<i></i></b>`).join("")).join(""),Kc=(n,i,c,h)=>`<li${h?` draggable="true" data-route="${f(i.route)}"`:""}><a href="${/^\/(?![\/\\])/.test(i.route)?f(i.route):"#"}"${i.route===c?' aria-current="page"':""}>`+(h?'<i class="dt-grip" aria-hidden="true"></i>':"")+`<span class="dt-menu-label">${f(i.label)}</span><em class="dt-pages-n" hidden>${sh(n)}</em></a></li>`,oh='<svg viewBox="0 4 100 100" width="18" height="18" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',Bo=$t('<path d="M6 8l4 4 4-4" />',12),Nr='<rect x="3" y="4" width="14" height="12" rx="2" /><path d="M3 8h14" />',Uc='<circle cx="8" cy="7" r="3" /><path d="M2.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M13.5 12.5l1.2 1.2 2.3-2.4" />',Pr={studio:Nr,clients:Uc};function Yc(n){let i=n.client?' style="display:none"':"",c=[...new Set(n.devices.map(A=>A.group))].map(A=>`<p class="dt-devices-group">${f(A)}</p>`+n.devices.filter(k=>k.group===A).map(k=>`<button type="button" data-device="${f(k.id)}" aria-pressed="false"${k.note?` title="${f(k.note)}"`:""}><span class="dt-menu-label">${f(k.label)}</span><em>${k.w}×${k.h}</em></button>`).join("")).join(""),h=Gc.map(A=>`<p class="dt-devices-group">${f(A)}</p>`+No.filter(k=>k.group===A).map(k=>`<button type="button" data-emu="${f(k.id)}" aria-pressed="false"><span class="dt-menu-label">${f(k.label)}</span><em>${k.w}×${k.h}</em></button>`).join("")).join(""),g=n.breakpoints.map(A=>`<button class="dt-icon dt-bp" type="button" data-bp="${f(A.id)}" aria-pressed="false" title="${f(A.label)}">${$t(A.icon,16)}</button>`).join(""),y="Real screens, the browser around the page. A thread goes to its width\u2019s breakpoint.",S="The page at the device\u2019s size. A thread goes to its breakpoint.",C=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),w="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
1
|
+
import"./notemend.css";var ae={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function ie(n,r={}){if(r.method&&r.method!=="GET"&&typeof r.body=="string"&&r.body.length<8e3&&r.keepalive===void 0&&(r={...r,keepalive:!0}),!ae.via){let h=window.__notemendEarly,g=!r.method||r.method==="GET"?h?.[n]:void 0;if(g){delete h[n];let y=await g;if(y)return y}return fetch(`/__devbar/${n}`,r)}let c=await ae.via(n,r);if(c.ok&&n.startsWith("comments")&&(r.method??"GET")==="GET"){let h=await c.json().catch(()=>{});h?.signed&&Object.assign(ae.signed,h.signed),c.json=()=>h===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(h)}return c}var wr=n=>ae.via?ae.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Gs=(()=>{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,r)=>{try{localStorage.setItem(n,r)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}},wc=()=>ct.getItem("dt-resolved")==="0"&&ct.getItem("dt-archived")!=="1"?"comments?open=1":"comments";var Mc=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null,kc=n=>{let r={};for(let c of n?.images||[]){let h=Mc(c);h&&(r[h]=c)}return r},Ho={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,Km=/^(png|jpe?g|webp|gif|webm)$/i,Fa=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,Jt=(n,r)=>{let c=String(n??"");if(c.length<=r)return c;let h="";if(Fa)for(let{segment:g}of Fa.segment(c)){if(h.length+g.length>r)break;h+=g}else for(let g of c){if(h.length+g.length>r)break;h+=g}return h},Um=[["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"]],Lc=n=>{let r=String(n??"").split(".").pop().toLowerCase(),c=Um.find(([,,h])=>h.split(" ").includes(r));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]),Ym=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]])),Sc=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,r=>Ym[r]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),Tc=n=>{let r=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return r&&!$r.test(r[1])?r[1].toLowerCase():""};var Co=n=>{let r=String(n??"");if(r.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(r);if(!g)return null;let y=/;ext=([a-z0-9]{1,8})/i.exec(g[2])?.[1]?.toLowerCase()??Object.keys(Ho).find(T=>Ho[T]===g[1]);return y?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${y}`:null}let c=r.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(c))return null;let h=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(c);return h&&!Km.test(h[2])?`${h[1]||"document"}.${h[2].toLowerCase()}`:null},an=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(c=>({...c,images:[]}))];for(let c of n.images||[]){if(Mc(c))continue;let h=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(c)?.[1]?.slice(0,13)),g=0;r.forEach((y,T)=>{Date.parse(y.at)<=h&&(g=T)}),r[g].images.push(c)}return r.filter(c=>!c.deleted)},Ac=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],Hc=["\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 Xm=20,Cc=(n,r,c)=>{let h={...n||{}},g=h[r]||[];if(!g.length&&Object.keys(h).length>=Xm)return null;let y=g.includes(c)?g.filter(T=>T!==c):[...g,c];return y.length?h[r]=y:delete h[r],Object.keys(h).length?h:void 0},Nc=n=>n.nickname||n.name||n.email,Er="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",Jm=new RegExp("^"+Er,"u"),Zm=(n,r)=>{let c="@"+r.toLowerCase(),h=-1;for(let g=n.indexOf(c);g!==-1;g=n.indexOf(c,g+1))Jm.test(n.slice(g+c.length))&&(h=g);return h};var Qm=/https?:\/\/[^\s<>"']+/g,$c=n=>{let r=n.filter(Boolean).pop();try{return r?decodeURIComponent(r):""}catch{return r}},th=n=>{let r;try{r=new URL(n)}catch{return{label:String(n),kind:"link"}}let c=r.hostname.replace(/^www\./,""),h=r.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(c))return{label:h[2]?`Figma \xB7 ${$c([h[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(c==="github.com"&&h.length){let[y,T,C,w]=h;return{label:`GitHub \xB7 ${T??y}${/^(pull|issues)$/.test(C??"")&&w?` #${w}`:""}`,kind:C==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(c))return{label:"Loom",kind:"link"};let g=$c(h);return{label:g?`${c} \xB7 ${g.length>32?Jt(g,31)+"\u2026":g}`:c,kind:"link"}},Mr=n=>{let r=String(n??""),c=[],h=0;for(let g of r.matchAll(Qm)){let y=g[0].replace(/[.,;:!?)\]]+$/,"");g.index>h&&c.push(r.slice(h,g.index)),c.push({url:y,...th(y)}),h=g.index+y.length}return h<r.length&&c.push(r.slice(h)),c},Bc=n=>Mr(n).map(r=>typeof r=="string"?r:r.label).join(""),xc={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},Rc=new Map,Pc=(n=[])=>{for(let r of n)r?.email&&Rc.set(r.email.toLowerCase(),r.agent_name?.trim()||"")},Zn=(n,r)=>r&&Rc.get(String(Lr(r)??r).toLowerCase())||"Agent",kr=n=>!n||n==="claude"?"via Claude Code":n==="agent"||!xc[n]?"":`via ${xc[n]}`,ja="3.6 3.6 10.8 10.8",_a="M10.116 9H13.883M9.966 9.558L12.222 10.86M9.558 9.966L11.441 13.228M9 10.116V12.72M8.442 9.966L6.559 13.228M8.034 9.558L5.778 10.86M7.884 9H4.118M8.034 8.442L5.778 7.14M8.442 8.034L6.559 4.772M9 7.884V5.28M9.558 8.034L11.441 4.772M9.966 8.442L12.222 7.14",Lr=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,Xt=n=>n==="claude"||Lr(n)!=null;var eh=["new","approved","progress","review","waiting"],De=n=>eh.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":Xt(n?.assignee)?"approved":"new",Bt=n=>n?.client===!0||n?.shared===!0,Ic=(n,r,c="")=>`Duplicated from ${c?c==="you"?"your":`${c}\u2019s`:"a"} ${(r?Bt(r):!Bt(n))?"client":"studio"} thread`,Oc=n=>Bt(n)?"Duplicated for the client":"Mirrored to Team",Ks=n=>Number.isInteger(n?.from?.id)&&!Bt(n),qc=(n="")=>`Mirrored from Client${n?` by ${n}`:""}`,Ao={new:"Received",progress:"In progress",review:"In progress",waiting:"In progress",done:"Fixed \u2014 please check"},Dc=(n,r=Date.now())=>n?.status==="done"?Ao.done:hn(n,r)||["progress","review","waiting"].includes(De(n))?Ao.progress:Ao.new,Fc="Fixed \u2014 please check.",jc=n=>n?.status==="done"&&!Bt(n)&&Number.isInteger(n.from?.id)?n.from.id:null;var Wa=["agent","claude","codex","gemini"];var Sr=(n,r=[])=>{let c=String(n||"").toLowerCase();return Wa.some(h=>Zm(c,h)!==-1)?"claude":null},_c=(n,r=[],c="")=>{let h=String(n||"").replace(/^@/,"").toLowerCase();if(Wa.includes(h))return"agent";let g=r.find(y=>[y.name,y.nickname,y.email].some(T=>T&&T.toLowerCase()===h));return g&&c&&g.email?.toLowerCase()===c.toLowerCase()?"you":"person"};var nh=2*36e5,hn=(n,r=Date.now())=>n?.working&&n.status!=="done"&&r-Date.parse(n.working.at)<nh?n.working:null;var No=(n,r,c=Date.now())=>{let h=String(n?.by||n?.byName||"").toLowerCase();if(!h||r==="done")return null;let g=r==="claude"||Xt(n.assignee),y=g?hn(n,c)?.by||n.doneFor||n.handedBy||Lr(n.assignee)||h:n.assignee||"";return{writer:h,taker:String(y).toLowerCase(),claude:g}},Tr=n=>/@guest\.notemend\.com$/i.test(String(n||"")),Ee=(n,r=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":Xt(n.assignee)?"done":null;if(!Xt(n.assignee))return null;let c=an(n),h=c[c.length-1],g=hn(n,r);return c.length>1&&h.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(h.at))&&(!g||String(h.text??"").includes("?"))?"asks":g?g.step&&r-Date.parse(g.at)>sh?"stuck":"working":n.working?"stuck":De(n)==="approved"?"queued":null},sh=10*6e4,Ec=(n,r=Date.now())=>{let c=Math.floor((r-Date.parse(n??""))/6e4);return c>=1?c<60?`${c} min`:`${Math.floor(c/60)} h`:"now"},Ar=(n,r=31)=>{let c=Fa?[...Fa.segment(String(n??""))].map(y=>y.segment):[...String(n??"")];if(c.length<=r)return c.join("");let h=c.join("").match(/\.\w{1,8}$/)?.[0],g=h?h.length+3:0;return c.slice(0,r-1-g).join("")+"\u2026"+(g?c.slice(-g).join(""):"")},Hr=(n,r=Date.now())=>{let c=n?.status!=="done"?n?.working:null;return c?.at?{step:c.step?String(c.step):null,elapsed:Ec(c.since??c.at,r),silent:Ec(c.at,r),stale:!hn(n,r)}:null};var Wc=_a.split("M").filter(Boolean).map(n=>{let r=n.match(/[\d.]+/g).map(Number),[c,h]=/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(c-9,9-h)+2*Math.PI)%(2*Math.PI)}}).sort((n,r)=>n.a-r.a).map(n=>n.d);var zc=(n,r)=>{if(n.archivedAt)return!0;if(!r||n.status!=="done"||n.doneBy==="claude")return!1;let c=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(h=>!h.deleted).map(h=>Date.parse(h.at||"")||0));return!!c&&Date.now()-c>r*864e5},oh=["uk","ru","en"],Vc=n=>{try{let r=new Intl.DisplayNames([n],{type:"language"}).of(n)??n;return r[0].toUpperCase()+r.slice(1)}catch{return n}},Cr=n=>{try{return new Intl.DisplayNames(["en"],{type:"language"}).of(n)??n}catch{return n}},za=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":"",Gc=(n,r="en")=>{let c=za(n),h=r.split("-")[0].toLowerCase();return[...new Set([h,...oh])].filter(g=>g!==c)};async function Kc(){let n=await ie("config");if(!n.ok)throw Object.assign(new Error(`config ${n.status}`),{said:n.status===401?await n.text().catch(()=>""):""});let r=await n.json();return r.breakpoints=r.breakpoints.map(c=>({...c,max:c.max??1/0})),Pc(r.team),r}var Uc=["iPhone","Android","Foldable","Tablet","Laptop & display"],Bo=[{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=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r]),Qn=n=>n?new Date(n).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Br=(n,r=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"}):r(n),ts='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M8 6V4.2h4V6M6.6 6l.55 9.8h5.7L13.4 6"/></svg>',Me='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.8 10.4 8.2 13.8l7-7.6" stroke-linejoin="round"/></svg>',es='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M12.6 4.4l3 3-8.4 8.4H4.2v-3z" stroke-linejoin="round"/></svg>',kn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',Pn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.4 5.4l9.2 9.2M14.6 5.4l-9.2 9.2"/></svg>',Va='<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>',Ga='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',gn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.5 8.5h7.5a3.5 3.5 0 0 1 0 7H8.5M7.5 5.5l-3 3 3 3" stroke-linejoin="round"/></svg>',Fe=n=>`<svg viewBox="${ja}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${_a}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Rr=(n,r)=>`<svg viewBox="${ja}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${Wc.map((c,h)=>`<path d="${c}" stroke-width="1.15" stroke-linecap="round"${h<r?"":' class="is-off"'}/>`).join("")}</svg>`,$t=(n,r=15)=>`<svg viewBox="0 0 20 20" width="${r}" height="${r}" aria-hidden="true">${n}</svg>`,ah=n=>n.breakpoints.map(r=>["new","progress","review","waiting","done"].map(c=>`<b data-bp="${f(r.id)}" data-state="${c}" hidden>${$t(r.icon,11)}<i></i></b>`).join("")).join(""),Yc=(n,r,c,h)=>`<li${h?` draggable="true" data-route="${f(r.route)}"`:""}><a href="${/^\/(?![\/\\])/.test(r.route)?f(r.route):"#"}"${r.route===c?' aria-current="page"':""}>`+(h?'<i class="dt-grip" aria-hidden="true"></i>':"")+`<span class="dt-menu-label">${f(r.label)}</span><em class="dt-pages-n" hidden>${ah(n)}</em></a></li>`,ih='<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>',Ro=$t('<path d="M6 8l4 4 4-4" />',12),Nr='<rect x="3" y="4" width="14" height="12" rx="2" /><path d="M3 8h14" />',Xc='<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:Xc};function Jc(n){let r=n.client?' style="display:none"':"",c=[...new Set(n.devices.map(A=>A.group))].map(A=>`<p class="dt-devices-group">${f(A)}</p>`+n.devices.filter(k=>k.group===A).map(k=>`<button type="button" data-device="${f(k.id)}" aria-pressed="false"${k.note?` title="${f(k.note)}"`:""}><span class="dt-menu-label">${f(k.label)}</span><em>${k.w}×${k.h}</em></button>`).join("")).join(""),h=Uc.map(A=>`<p class="dt-devices-group">${f(A)}</p>`+Bo.filter(k=>k.group===A).map(k=>`<button type="button" data-emu="${f(k.id)}" aria-pressed="false"><span class="dt-menu-label">${f(k.label)}</span><em>${k.w}×${k.h}</em></button>`).join("")).join(""),g=n.breakpoints.map(A=>`<button class="dt-icon dt-bp" type="button" data-bp="${f(A.id)}" aria-pressed="false" title="${f(A.label)}">${$t(A.icon,16)}</button>`).join(""),y="Real screens, the browser around the page. A thread goes to its width\u2019s breakpoint.",T="The page at the device\u2019s size. A thread goes to its breakpoint.",C=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),w="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
2
2
|
<!-- The top strip (Figma Proposals 33 \xABW9\xBB, 10.11): the mark, the studio / the space \u2304 on the left,
|
|
3
3
|
the address \u2014 the page list with its folders and search \u2014 in the middle, you and settings on the right.
|
|
4
4
|
The bar below keeps the tools. It lies over the site and comes out at the top edge; pinned, it stays and moves the site (12.11). -->
|
|
5
5
|
<div class="dt-strip" role="banner" aria-label="Notemend">
|
|
6
6
|
<div class="dt-strip-side">
|
|
7
|
-
<span class="dt-strip-mark">${
|
|
7
|
+
<span class="dt-strip-mark">${ih}</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">${$t(Nr,14)}</span><span class="dt-space-name">Team</span>${
|
|
10
|
+
<summary data-tip="Switch space \xB7 M"><span class="dt-space-ic">${$t(Nr,14)}</span><span class="dt-space-name">Team</span>${Ro}</summary>
|
|
11
11
|
<div class="dt-space-menu" role="menu" aria-label="Whose threads">
|
|
12
12
|
<button type="button" role="menuitemradio" data-space="studio" aria-checked="true">${$t(Nr,14)}<span><b>Team</b><em>Only people in ${f(n.studioName||"your studio")}</em></span><i class="dt-space-n"></i></button>
|
|
13
|
-
<button type="button" role="menuitemradio" data-space="clients" aria-checked="false">${$t(
|
|
13
|
+
<button type="button" role="menuitemradio" data-space="clients" aria-checked="false">${$t(Xc,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 ae={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">${$t('<path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-.9.9M11.5 8.5a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l.9-.9" />',15)}</span>
|
|
20
20
|
<span class="dt-pages-addr"><span class="dt-pages-host">${f(location.host)}</span><span class="dt-pages-slash">/</span><span class="dt-pages-name"></span></span>
|
|
21
|
-
<em class="dt-pages-here" hidden></em>${
|
|
21
|
+
<em class="dt-pages-here" hidden></em>${Ro}
|
|
22
22
|
</summary>
|
|
23
23
|
<div class="dt-pages-menu">
|
|
24
24
|
<label class="dt-pages-find">${$t('<circle cx="9" cy="9" r="5.5" /><path d="m13.2 13.2 3.3 3.3" />',14)}<input type="search" placeholder="Search pages" aria-label="Search pages" /><kbd>/</kbd></label>
|
|
@@ -29,7 +29,7 @@ import"./notemend.css";var ae={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>${
|
|
32
|
+
<summary data-tip="You"><span class="dt-me-face"></span><span class="dt-me-name">${f(n.me?.name||n.me?.email||"")}</span>${Ro}</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>${$t('<path d="M11 3.5h5.5V9M16.5 3.5 9 11M14 11.5v4A1.5 1.5 0 0 1 12.5 17h-8A1.5 1.5 0 0 1 3 15.5v-8A1.5 1.5 0 0 1 4.5 6h4" />',14)}<span>Open the cabinet</span></a>
|
|
@@ -70,7 +70,7 @@ import"./notemend.css";var ae={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
70
70
|
<!-- One bar, bottom-centre: inspectors | comments | breakpoints \xB7 devices. -->
|
|
71
71
|
<div class="devtools">
|
|
72
72
|
${n.client&&n.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(n.brand.logo)?`<img class="dt-brand" src="${f(n.brand.logo)}" alt="" />`:""}
|
|
73
|
-
<div class="dt-group" role="group" aria-label="Inspect"${
|
|
73
|
+
<div class="dt-group" role="group" aria-label="Inspect"${r}>
|
|
74
74
|
<button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
|
|
75
75
|
${$t('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
|
|
76
76
|
</button>
|
|
@@ -129,7 +129,7 @@ import"./notemend.css";var ae={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
129
129
|
<div class="dt-devices-menu">
|
|
130
130
|
<div class="dt-menu-tabs" role="tablist" aria-label="Device lists">
|
|
131
131
|
<button type="button" role="tab" data-tab="preview" aria-selected="true" aria-description="${y}" data-tip="${y}">Preview</button>
|
|
132
|
-
<button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${
|
|
132
|
+
<button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${T}" data-tip="${T}">DevTools</button>
|
|
133
133
|
</div>
|
|
134
134
|
<div class="dt-menu-panel" role="tabpanel" data-panel="preview">
|
|
135
135
|
${c}
|
|
@@ -155,7 +155,7 @@ import"./notemend.css";var ae={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
155
155
|
<!-- push to Claude: one square tool in the agent's well \u2014 a press sends what waits for Claude; a right
|
|
156
156
|
click or a long press picks pages and threads. Beside turbo, the studio's only, shown while there is any. -->
|
|
157
157
|
<span class="dt-push" hidden${n.client?' style="display:none"':""}>
|
|
158
|
-
<button class="dt-push-all" type="button" aria-label="Push to the agent"><svg viewBox="${
|
|
158
|
+
<button class="dt-push-all" type="button" aria-label="Push to the agent"><svg viewBox="${ja}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${_a}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
|
|
159
159
|
>
|
|
160
160
|
<div class="dt-push-menu" hidden role="dialog" aria-label="What goes to the agent"></div>
|
|
161
161
|
</span>
|
|
@@ -208,18 +208,18 @@ import"./notemend.css";var ae={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
208
208
|
</div>
|
|
209
209
|
</div>
|
|
210
210
|
<div class="dt-pad-overlay" hidden aria-hidden="true"></div>
|
|
211
|
-
`)}var Ye=(n,i)=>{let c=i<=0?"":i>=1?"6,0.5 11.5,6 6,11.5 0.5,6":["6,6","6,0.5",...["11.5,6","6,11.5","0.5,6"].slice(0,Math.round(i*4))].join(" ");return`<svg class="dt-stage-icon" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${c?`<polygon points="${c}" fill="${n}"/>`:""}<rect x="1.75" y="1.75" width="8.5" height="8.5" rx="1.5" fill="none" stroke="${n}" stroke-width="1.5" transform="rotate(45 6 6)"/></svg>`};var Xc=[{id:"general",label:"General",color:"#0d99ff",icon:'<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect x="3" y="14" width="7" height="7" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/>'},{id:"bug",label:"Bug",color:"#e5484d",icon:'<path d="m8 2 1.88 1.88M14.12 3.88 16 2M9 7.13v-1a3 3 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6M12 20v-9M6.53 9C4.6 8.8 3 7.1 3 5M6 13H2M3 21c0-2.1 1.7-3.9 3.8-4M20.97 5c0 2.1-1.6 3.8-3.5 4M22 13h-4M17.2 17c2.1.1 3.8 1.9 3.8 4"/>'},{id:"text",label:"Text",color:"#f5c451",icon:'<path d="M4 7V4h16v3M9 20h6M12 4v16"/>'},{id:"motion",label:"Motion",color:"#a475f9",icon:'<path d="M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2M9.6 4.6A2 2 0 1 1 11 8H2M12.6 19.4A2 2 0 1 0 14 16H2"/>'},{id:"design",label:"Design",color:"#d6409f",icon:'<path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.97 6.01 17.46 2 12 2z"/><circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/>'},{id:"content",label:"Content",color:"#30a46c",icon:'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4M10 9H8M16 13H8M16 17H8"/>'}],Jc=(n,i=14)=>`<svg viewBox="0 0 24 24" width="${i}" height="${i}" fill="none" stroke="${n.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n.icon}</svg>`,Ks=n=>Xc.find(i=>i.id===n)||Xc[0];var Ct=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",Zc={open:"Open",done:"Resolved",claude:"To check"};var Zt={ready:Promise.resolve(),toggle:(n,i)=>{Zt.ready.then(()=>document.documentElement.classList.toggle(n,i))},set:(n,i)=>{Zt.ready.then(()=>document.documentElement.style.setProperty(n,i))}};var ah=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Qc=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(ah,"$1\u2022\u2022\u2022").replace(/\b(Bearer|Basic|Token)\s+[\w.~+/=-]+/gi,"$1 \u2022\u2022\u2022").replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/g,"\u2022\u2022\u2022");var $s=[],Ir=n=>{if(n instanceof Error)return`${n.name}: ${n.message}`;if(typeof n=="string")return n;try{return JSON.stringify(n)??String(n)}catch{return String(n)}},ih=/ResizeObserver loop/,ws=(n,i)=>{if(ih.test(i))return;let c=Jt(Qc(i.replace(/\s+/g," ").trim()),500),h=$s.findIndex(g=>g.kind===n&&g.text.replace(/ ×\d+$/,"")===c);if(h>=0){let[g]=$s.splice(h,1),y=Number(/ ×(\d+)$/.exec(g.text)?.[1]??1)+1;$s.push({at:new Date().toISOString(),kind:n,text:`${c} \xD7${y}`});return}$s.push({at:new Date().toISOString(),kind:n,text:c}),$s.length>50&&$s.shift()},tu=!1;function eu(n){if(tu||typeof window>"u")return;tu=!0;let i=console.error;console.error=(...g)=>{ws("console",g.map(Ir).join(" ")),i.apply(console,g)},addEventListener("error",g=>{if(g instanceof ErrorEvent)return ws("error",`${g.message}${g.filename?` (${g.filename}:${g.lineno})`:""}`);let y=g.target,S=y?.src||y?.href;S&&!n(S)&&ws("network",`${y.tagName?.toLowerCase()} ${S} did not load`)},!0),addEventListener("unhandledrejection",g=>ws("rejection",Ir(g.reason)));let c=window.fetch;window.fetch=async(g,y)=>{let S=typeof g=="string"?g:g instanceof URL?g.href:g.url,C=(y?.method||(g instanceof Request?g.method:"GET")).toUpperCase();try{let w=await c.call(window,g,y);return w.status>=400&&!n(S)&&ws("network",`${C} ${S} \u2192 ${w.status}`),w}catch(w){throw!n(S)&&w?.name!=="AbortError"&&ws("network",`${C} ${S} \u2192 no answer (${Ir(w)})`),w}};let h=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(g,y,...S){return this._nm=`${g.toUpperCase()} ${String(y)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(y))||ws("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),h.call(this,g,y,...S)}}var nu=(n=Date.now())=>$s.filter(i=>n-Date.parse(i.at)<10*6e4).slice(-20);function su(n){let i=E=>{let x=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,H=E/x;return Math.round(H*10)%10===0?String(Math.round(H)):H.toFixed(1)},c=(E,x,H,q,D,ut="p")=>{if(H<=0||q<=0)return"";let Et=D!==""?`<span class="dt-pad-chip dt-pad-chip--${ut}" style="left:${E+H/2}px;top:${x+q/2}px">${D}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${ut}" style="left:${E}px;top:${x}px;width:${H}px;height:${q}px"></span>${Et}`},h=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],g="button, a, input, select, textarea, label, [role='button']",y=E=>{let x=E;for(let H=0;x&&H<6;H++,x=x.parentElement){if(x.matches(g))return x;let q=getComputedStyle(x);if(h.some(D=>parseFloat(q[D])>=2))return x}return E},S=(E,x)=>{let H=parseFloat(x.columnGap)||0,q=parseFloat(x.rowGap)||0;if(!(x.display.includes("flex")||x.display.includes("grid"))||!H&&!q)return"";let D=[...E.children].map(st=>st.getBoundingClientRect()).filter(st=>st.width||st.height),ut="",Et=(st,et)=>i(Math.abs(st-et)<=1?et:st);for(let st=1;st<D.length;st++){let et=D[st-1],rt=D[st];if(H&&rt.left>=et.right-1){let gt=Math.max(et.top,rt.top);ut+=c(et.right,gt,rt.left-et.right,Math.min(et.bottom,rt.bottom)-gt,Et(rt.left-et.right,H),"g")}else if(q&&rt.top>=et.bottom-1){let gt=Math.min(et.left,rt.left);ut+=c(gt,et.bottom,Math.max(et.right,rt.right)-gt,rt.top-et.bottom,Et(rt.top-et.bottom,q),"g")}}return ut},C=E=>`<span class="dt-pad-outline" style="left:${E.left}px;top:${E.top}px;width:${E.width}px;height:${E.height}px"></span>`,w=(E,x,H="")=>`<span class="dt-pad-tag" style="left:${x.left}px;top:${Math.max(2,x.top-22)}px">${E.tagName.toLowerCase()+(E.classList[0]?"."+E.classList[0]:"")}${H}</span>`,A=E=>{let x=E.getBoundingClientRect(),H=getComputedStyle(E),q=parseFloat(H.paddingTop),D=parseFloat(H.paddingRight),ut=parseFloat(H.paddingBottom),Et=parseFloat(H.paddingLeft),st=C(x);st+=c(x.left,x.top,x.width,q,q>=2?i(q):""),st+=c(x.left,x.bottom-ut,x.width,ut,ut>=2?i(ut):""),st+=c(x.left,x.top+q,Et,x.height-q-ut,Et>=2?i(Et):""),st+=c(x.right-D,x.top+q,D,x.height-q-ut,D>=2?i(D):"");let et=parseFloat(H.marginTop),rt=parseFloat(H.marginRight),gt=parseFloat(H.marginBottom),At=parseFloat(H.marginLeft);st+=c(x.left,x.top-et,x.width,et,et>=2?i(et):"","m"),st+=c(x.left,x.bottom,x.width,gt,gt>=2?i(gt):"","m"),st+=c(x.left-At,x.top,At,x.height,At>=2?i(At):"","m"),st+=c(x.right,x.top,rt,x.height,rt>=2?i(rt):"","m"),st+=S(E,H);let $e=parseFloat(H.columnGap)||0,je=parseFloat(H.rowGap)||0,ke=(H.display.includes("flex")||H.display.includes("grid"))&&($e||je)?` \xB7 gap ${i($e)}${je&&je!==$e?"/"+i(je):""}`:"",Vt="",he=E.parentElement;if(E.matches(g)&&he){let be=getComputedStyle(he);st+=S(he,be);let _e=parseFloat(be.columnGap)||parseFloat(be.rowGap)||0;Vt=` \xB7 ${i(x.width)}\xD7${i(x.height)}${_e&&(be.display.includes("flex")||be.display.includes("grid"))?` \xB7 gap ${i(_e)} in its row`:""}`}let He=Vt?"":` \xB7 ${Math.round(parseFloat(i(x.width)))} \xD7 ${Math.round(parseFloat(i(x.height)))}`;n.innerHTML=st+w(E,x,He+ke+Vt)},k=E=>{let x=E.getBoundingClientRect();n.innerHTML=C(x).replace("dt-pad-outline","dt-pad-outline dt-size-line")+`<span class="dt-pad-chip dt-size-chip" style="left:${x.left+x.width/2}px;top:${x.bottom+6}px">${Math.round(parseFloat(i(x.width)))} \xD7 ${Math.round(parseFloat(i(x.height)))}</span>`},z=E=>{let x=(E.match(/[\d.]+/g)||[]).map(Number);if(x.length<3)return E;let H="#"+x.slice(0,3).map(q=>Math.round(q).toString(16).padStart(2,"0")).join("");return x[3]!==void 0&&x[3]<1?`${H} \xB7 ${Math.round(x[3]*100)}%`:H},dt=null,J=()=>{if(dt)return dt;let E=getComputedStyle(document.documentElement),x=document.createElement("span");x.style.display="none",document.body.append(x);let H=[];for(let q of Array.from(E)){if(!q.startsWith("--"))continue;let D=E.getPropertyValue(q).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(D))continue;x.style.color="rgb(1, 2, 3)",x.style.color=D;let ut=getComputedStyle(x).color;ut&&ut!=="rgb(1, 2, 3)"&&H.push([ut,q])}return x.remove(),H.sort((q,D)=>q[1].length-D[1].length),dt=H,H},tt=E=>J().find(([x])=>x===E)?.[1]??"",F=null,xt=()=>{if(F)return F;let E=[],x=H=>{for(let q of Array.from(H))q instanceof CSSStyleRule?q.style.cssText.includes("var(--")&&E.push({sel:q.selectorText,style:q.style}):q instanceof CSSMediaRule?matchMedia(q.conditionText).matches&&x(q.cssRules):"cssRules"in q&&x(q.cssRules)};for(let H of Array.from(document.styleSheets))try{x(H.cssRules)}catch{}return F=E},Wt={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(E=>[`border-${E}-color`,[`border-${E}-color`,"border-color",`border-${E}`,"border"]]))},St=(E,x)=>{let H=Wt[x]??[x],q=x==="color";for(let D=E;D;D=q?D.parentElement:null){let ut=et=>H.map(rt=>/var\(\s*(--[\w-]+)/.exec(et.getPropertyValue(rt))?.[1]).find(Boolean),Et=D instanceof HTMLElement?ut(D.style):void 0;if(Et)return Et;let st="";for(let et of xt()){let rt=!1;try{rt=D.matches(et.sel)}catch{}rt&&(st=ut(et.style)||st)}if(st)return st;if(q&&D.parentElement&&getComputedStyle(D).color!==getComputedStyle(D.parentElement).color)break}return""},at=(E,x,H)=>{let q=getComputedStyle(E).getPropertyValue(x).trim();if(!q)return z(H);let D=document.createElement("span");if(D.style.display="none",D.style.color=q,!D.style.color)return z(H);document.body.append(D);let ut=getComputedStyle(D).color;return D.remove(),z(ut)},vt=(E,x,H)=>{let q=St(E,x);if(q)return`<b class="dt-var">${q}</b> <em>${at(E,q,H)}</em>`;let D=tt(H);return D?`<span title="Same value as ${D}; not written with it">\u2248 ${D}</span> <em>${z(H)}</em>`:z(H)},It=E=>`<i class="dt-type-sw" style="background:${E}"></i>`,qt={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},Lt=E=>(E.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),pe=(E,x)=>E.slice(0,3).map((H,q)=>H*E[3]+x[q]*(1-E[3])).concat([1]),fe=E=>{let x=[];for(let H=E;H;H=H.parentElement){let q=getComputedStyle(H);if(q.backgroundImage!=="none")return null;let D=Lt(q.backgroundColor);if(D[3]>0&&(x.push(D),D[3]>=1))break}return x.reduceRight((H,q)=>pe(q,H),[255,255,255,1])},Qt=E=>{let[x,H,q]=E.slice(0,3).map(D=>(D/=255,D<=.03928?D/12.92:((D+.055)/1.055)**2.4));return .2126*x+.7152*H+.0722*q},me=(E,x,H)=>{let q=fe(E);if(!q)return["Contrast","<em>on an image</em>"];let D=pe(Lt(x.color),q),[ut,Et]=[Qt(D),Qt(q)].sort((gt,At)=>At-gt),st=(ut+.05)/(Et+.05),et=H>=24||H>=18.66&&Number(x.fontWeight)>=700,rt=st>=(et?4.5:7)?"AAA":st>=(et?3:4.5)?"AA":"fails AA";return["Contrast",`${st.toFixed(2)}:1 <em class="${rt==="fails AA"?"dt-type-bad":""}">${rt}${et?" \xB7 large":""}</em>`]},Ln=E=>{let x=E.getBoundingClientRect(),H=getComputedStyle(E),q=parseFloat(H.fontSize),D=H.lineHeight==="normal"?0:parseFloat(H.lineHeight),ut=parseFloat(H.letterSpacing)||0,Et=At=>`${(At*100).toFixed(1).replace(/\.0$/,"")}%`,st=[["Font",H.fontFamily.split(",")[0].replace(/["']/g,"")+(H.fontStyle!=="normal"?` ${H.fontStyle}`:"")],["Weight",`${qt[H.fontWeight]??""} <em>${H.fontWeight}</em>`],["Size",`${i(q)}px`],["Line",D?`${Et(D/q)} <em>${i(D)}px</em>`:"normal"],["Letter",ut?`${Et(ut/q)} <em>${ut.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",It(H.color)+vt(E,"color",H.color)],me(E,H,q)],rt=x.bottom+150<innerHeight?x.bottom+8:Math.max(8,x.top-158),gt=Math.min(Math.max(8,x.left),innerWidth-210);n.innerHTML=C(x)+w(E,x)+`<div class="dt-type-card" style="left:${gt}px;top:${rt}px">${st.map(([At,$e])=>`<span class="dt-type-row"><b>${At}</b><span>${$e}</span></span>`).join("")}</div>`},zt=E=>E.every(x=>x===E[0])?E[0]:E[1]===E[3]&&E[0]===E[2]?`${E[0]} ${E[1]}`:E.join(" "),Re=E=>/^rgba\(.*,\s*0\)$|^transparent$/.test(E),we=(E,x,H,q="")=>{let D=20+H.length*21,Et=x.bottom+D+12<innerHeight?x.bottom+8:Math.max(8,x.top-D-8),st=Math.min(Math.max(8,x.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${x.left}px;top:${x.top}px;width:${x.width}px;height:${x.height}px${q?`;border-radius:${q}`:""}"></span>`+w(E,x)+`<div class="dt-type-card dt-style-card" style="left:${st}px;top:${Et}px">${H.map(([et,rt])=>`<span class="dt-type-row"><b>${et}</b><span>${rt}</span></span>`).join("")}</div>`},N=E=>{let x=getComputedStyle(E),H=[];x.backgroundImage!=="none"&&H.push(["Fill",`<em>${/gradient/.test(x.backgroundImage)?"gradient":"image"}</em>`]),Re(x.backgroundColor)||H.push(["Fill",It(x.backgroundColor)+vt(E,"background-color",x.backgroundColor)]),E.textContent?.trim()&&H.push(["Text",It(x.color)+vt(E,"color",x.color)]),H.push(["Opacity",`${Math.round(Number(x.opacity)*100)}%`]),H.length||H.push(["Color","<em>no fill or text</em>"]),we(E,E.getBoundingClientRect(),H)},ft=E=>{let x=getComputedStyle(E),H=[],q=["top","right","bottom","left"],D=q.map(Et=>parseFloat(x.getPropertyValue(`border-${Et}-width`))||0);if(D.some(Et=>Et>0)){let Et=q.filter((et,rt)=>D[rt]>0);q.forEach((et,rt)=>H.push([et[0].toUpperCase()+et.slice(1),`${i(D[rt])} <em>${x.getPropertyValue(`border-${et}-style`)}</em>`]));let st=Et.map(et=>x.getPropertyValue(`border-${et}-color`));Et.forEach((et,rt)=>{rt&&st[rt]===st[0]||H.push([rt?`\u21B3 ${et}`:"Color",It(st[rt])+vt(E,`border-${et}-color`,st[rt])])})}else H.push(["Width","<em>none</em>"]);let ut=["top-left","top-right","bottom-right","bottom-left"].map(Et=>{let[st,et=st]=x.getPropertyValue(`border-${Et}-radius`).split(" "),rt=gt=>gt.endsWith("%")?gt:i(parseFloat(gt)||0);return st===et?rt(st):`${rt(st)}/${rt(et)}`});H.push(["Radius",zt(ut)]),we(E,E.getBoundingClientRect(),H,x.borderRadius)},Rt=(E,x)=>{let[H,q]=[Qt(E),Qt(x)].sort((D,ut)=>ut-D);return(H+.05)/(q+.05)},jt=E=>"#"+E.slice(0,3).map(x=>Math.round(x).toString(16).padStart(2,"0")).join(""),ne=(E,x,H)=>{let[q,D,ut]=E.map(ke=>ke/255),Et=Math.max(q,D,ut),st=Math.min(q,D,ut),et=(Et+st)/2,rt=Et-st,gt=rt?rt/(1-Math.abs(2*et-1)):0,At=rt?Et===q?((D-ut)/rt%6+6)%6:Et===D?(ut-q)/rt+2:(q-D)/rt+4:0,$e=ke=>{let Vt=(1-Math.abs(2*ke-1))*gt,he=Vt*(1-Math.abs(At%2-1)),He=ke-Vt/2,[be,_e,Ms]=At<1?[Vt,he,0]:At<2?[he,Vt,0]:At<3?[0,Vt,he]:At<4?[0,he,Vt]:At<5?[he,0,Vt]:[Vt,0,he];return[be,_e,Ms].map(qn=>Math.min(255,Math.max(0,Math.round((qn+He)*255)))).concat([1])},je=Qt(E)>=Qt(x);for(let ke of je?[1,-1]:[-1,1]){let Vt=ke>0?1:0;if(Rt($e(Vt),x)<H)continue;let he=et,He=Vt;for(let be=0;be<20;be++){let _e=(he+He)/2;Rt($e(_e),x)>=H?He=_e:he=_e}return $e(He)}return null},$={half:'<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><circle cx="6" cy="6" r="4.5" fill="none" stroke="currentColor" stroke-width="0.9"/><path d="M6 1.5a4.5 4.5 0 0 1 0 9z" fill="currentColor"/></svg>',x:'<svg class="dt-ct-no" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M3 3l5 5M8 3l-5 5" stroke="currentColor" stroke-width="1.1" stroke-linecap="round"/></svg>',ok:'<svg class="dt-ct-ok" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M2.2 5.8 4.4 8l4.4-5" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"/></svg>',copy:'<svg viewBox="0 0 11 11" width="11" height="11" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="0.9"><rect x="4" y="4" width="6" height="6" rx="1.2"/><path d="M7 2.5V2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h.5"/></svg>'},M=E=>`${E.toFixed(1).replace(/\.0$/,"")} : 1`,L="",V=null,U=!1,G=E=>{E!==V&&(V=E,U=!1),L="";let x=E.getBoundingClientRect(),H=(E instanceof HTMLInputElement||E instanceof HTMLTextAreaElement)&&!E.value&&!!E.placeholder,q=getComputedStyle(E,H?"::placeholder":null),D=parseFloat(q.fontSize),ut=D>=24||D>=18.66&&Number(q.fontWeight)>=700,Et=fe(E),st=gt=>`<i class="dt-type-sw" style="background:${gt}"></i>`,et;if(!E.textContent?.trim()&&!H&&!(E instanceof HTMLInputElement&&E.value))et='<p class="dt-ct-note">Point at some text.</p>';else if(!Et)et='<p class="dt-ct-note">It sits on an image or a gradient: there is no one colour behind it to measure.</p>';else{let gt=pe(Lt(q.color),Et),At=Rt(gt,Et),$e=ut?3:4.5,je=At>=7?["ok",$.ok+"AAA"]:At>=4.5?["ok",$.ok+"AA"]:At>=3?["warn","Large text only"]:["bad","Fails"],ke=`<div class="dt-ct-ratio"><b>${M(At)}</b><span class="dt-ct-chip dt-ct-chip--${je[0]}">${je[1]}</span></div>`;if(At>=7){et=ke,n.innerHTML=C(x)+w(E,x,H?" \xB7 placeholder":"")+_t(x,41,`<div class="dt-ct-card dt-ct-card--one">${et}</div>`);return}let Vt=(He,be)=>`<div class="dt-ct-check">${At>=be?$.ok:$.x}<span>${He}</span><em>${M(be).replace(".0","")}</em></div>`,he=At>=$e?null:ne(gt,Et,$e);he&&(L=jt(he)),et=`<div class="dt-ct-pair"><div><span>Text</span><b>${st(jt(gt))}${jt(gt)}</b></div><div><span>Background</span><b>${st(jt(Et))}${jt(Et)}</b></div></div>`+ke+Vt("Body text \xB7 AA",4.5)+Vt("Large text \xB7 AA",3)+Vt("Body text \xB7 AAA",7)+(L?U?`<div class="dt-ct-fix dt-ct-fix--done">${$.ok}<span>Copied ${L}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${st(L)}${L}</b>${$.copy}</div>`:"")}let rt=`<div class="dt-ct-card"><div class="dt-ct-head">${$.half}<span>Contrast</span></div>${et}</div>`;n.innerHTML=C(x)+w(E,x,H?" \xB7 placeholder":"")+_t(x,210,rt)},_t=(E,x,H)=>{let q=E.bottom+x+12<innerHeight?E.bottom+8:Math.max(8,E.top-x-8),D=Math.min(Math.max(8,E.left),innerWidth-260);return H.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${D}px;top:${q}px"`)};return{spacer:y,drawPads:A,drawSize:k,drawType:Ln,drawColor:N,drawBorder:ft,drawContrast:G,contrastFix:()=>L,markCopied:()=>{U=!0}}}var re=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),ou=(n,i,c=!1)=>{for(let h=i*4;;h*=4){let g=c?re(n.slice(0,h)).replace(/\s+/g," "):re(n.slice(0,h));if(g.length>=i||h>=n.length)return g}},Us=(n,i,c=!1)=>Jt(ou(n,i,c),i),au='[class^="dt-"],[class*=" dt-"],.devtools',In=n=>{let i=n;for(;i.parentElement&&i.parentElement!==document.body;)i=i.parentElement;return i.parentElement===document.body&&i.matches(au)},Ro=()=>{let n=null;return(i,c)=>(n||(n=new WeakMap,queueMicrotask(()=>{n=null})),n.has(i)||n.set(i,c()),n.get(i))},rh=()=>{let n=null;return(i,c)=>(n||(n=new Map,queueMicrotask(()=>{n=null})),n.has(i)||n.set(i,c()),n.get(i))};function iu(){let n=Ro(),i=($,M)=>{if(!$)return[];let L=M.toUpperCase(),V=n($,()=>new Map),U=V.get(L);return U||V.set(L,U=[...$.children].filter(G=>G.tagName.toUpperCase()===L&&!($===document.body&&G.matches(au)))),U},c=$=>{let M=[],L=$;for(;L&&L.tagName!=="HTML"&&M.length<8;){if(L.id){M.unshift("#"+CSS.escape(L.id));break}let V=L.parentElement,U=L.tagName.toLowerCase(),G=i(V,L.tagName),_t=V===document.body&&G.length>1?[...L.classList].find(se=>/^[\w-]+$/.test(se)&&G.filter(Dt=>Dt.classList.contains(se)).length===1):void 0;M.unshift(_t?`${U}.${_t}`:G.length>1?`${U}:nth-of-type(${G.indexOf(L)+1})`:U),L=V}return M.join(">")},h=$=>{let M=$.split(">"),L=null;for(let[V,U]of M.entries()){if(U.startsWith("#")){if(V)return null;L=document.querySelector(U);continue}let G=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec(U);if(!G)return document.querySelector($);if(!L){if(G[1]!=="body"||G[2]||G[3])return document.querySelector($);L=document.body;continue}let _t=i(L,G[1].toUpperCase());if(L=(G[2]?_t.find(se=>se.classList.contains(G[2])):_t[G[3]?Number(G[3])-1:0])??null,!L)return null}return L},g=$=>$.replace(/\s+/g," ").trim(),y=Ro(),S=($,M)=>{if(!M)return!0;let[L,V]=y($,()=>{let G=ou($.textContent||"",60);return[g(Jt(G,60)),g(G.slice(0,60))]}),U=g(M);return L===U||V===U},C=($,M)=>[$||"*",...(M||[]).map(L=>"."+CSS.escape(L))].join(""),w=rh(),A=$=>{let M=C($.tag,$.classes);return w(M,()=>{try{return[...document.querySelectorAll(M)].filter(L=>!In(L))}catch{return[]}})},k=$=>{for(let M of $.classes??[]){let L=A({tag:$.tag,classes:[M]});if(L.length)return L}return A({tag:$.tag}).slice(0,400)},z=80,dt=Ro(),J=$=>dt($,()=>tt($)),tt=$=>{let M=$.textContent||"",L=null;for(let V=$.parentElement,U=0;V&&V!==document.body&&U<4;V=V.parentElement,U++){let G=V.textContent||"";if(G===M)continue;let _t=Us(G,z,!0);if(_t&&(_t!==Us(M,z,!0)||(L??=re(M).replace(/\s+/g," "),re(G).replace(/\s+/g," ")!==L)))return _t}return""},F=$=>J($),xt=($,M,L=120)=>Jt(re($.getAttribute(M)),L)||void 0,Wt=Ro(),St=$=>Wt($,()=>at($)),at=$=>{for(let M=$.parentElement,L=0;M&&M!==document.body&&L<4;M=M.parentElement,L++){let V=M.querySelector("h1,h2,h3,h4,h5,h6,[role=heading]");if(V&&V!==$&&!$.contains(V))return Us(V.textContent||"",60,!0)||void 0}},vt=Ro(),It=$=>vt($,()=>qt($)),qt=$=>{let M=L=>L?Us(L.textContent||"",30,!0):"";return(M($.previousElementSibling)+"|"+M($.nextElementSibling)).replace(/^\|$/,"")||void 0},Lt=/^data-(testid|test-id|test|qa|cy|id|key|slug|name|item)$/,pe=$=>{let M=[...$.attributes].find(V=>Lt.test(V.name)&&V.value),L=($.getAttribute("src")||$.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)||void 0;return Object.fromEntries(Object.entries({id:$.id?Jt($.id,80):void 0,data:M?`${M.name}=${Jt(M.value,80)}`:void 0,aria:xt($,"aria-label"),alt:xt($,"alt"),title:xt($,"title"),src:L,href:xt($,"href"),head:St($),sib:It($)}).filter(([,V])=>V))},fe=($,M)=>!M||J($).startsWith(M),Qt=new WeakMap,me=$=>Qt.get($)??"found",Ln=$=>{let M=$.fp,L=null;try{L=h($.selector)}catch{}let V=A($),U=V.length?V:k($),G=new Set(U.slice(0,400));if(L&&!In(L)&&G.add(L),M.id){let E=document.getElementById(M.id);E&&G.add(E)}if(M.data){let[E,x]=M.data.split(/=(.*)/s);try{document.querySelectorAll(`[${E}="${CSS.escape(x)}"]`).forEach(H=>G.add(H))}catch{}}let _t=null,se=null,Dt=0;for(let E of G){if(In(E))continue;let x=M.id&&E.id===M.id||M.data&&E.getAttribute(M.data.split("=")[0])===M.data.split(/=(.*)/s)[1]?35:0,H=re($.label)&&S(E,$.label)||M.aria&&xt(E,"aria-label")===M.aria||M.alt&&xt(E,"alt")===M.alt||M.title&&xt(E,"title")===M.title||M.href&&xt(E,"href")===M.href||M.src&&(E.getAttribute("src")||E.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)===M.src?25:0,q=M.head&&St(E)===M.head||M.sib&&It(E)===M.sib||$.ctx&&J(E).startsWith($.ctx)?15:0,D=x+H+q,ut=D+(E===L?40:0)+($.nth!=null&&U[$.nth]===E?5:0);D||(ut=Math.min(ut,39)),H&&(Dt++,se={el:E,score:ut}),(!_t||ut>_t.score)&&(_t={el:E,score:ut})}return se&&Dt===1&&se.score<40&&(!_t||_t.score<40)?{el:se.el,score:40}:_t},zt=$=>{let M=Re($),L=null;if(M){try{L=h($.selector)}catch{}return Qt.set($,M===L?"found":"moved"),M}let V=$.fp?Ln($):null;return V&&V.score>=40?(Qt.set($,V.score>=70?"moved":"probably"),V.el):(Qt.set($,"gone"),null)},Re=$=>{let M=null;try{M=h($.selector)}catch{M=null}if(M&&In(M)&&(M=null),M&&S(M,$.label)&&fe(M,$.ctx))return M;let L=A($),V=L.length?L:k($),U=re($.label)?V.filter(Dt=>S(Dt,$.label)):[],G=($.ctx?U.find(Dt=>fe(Dt,$.ctx)):U.length===1?U[0]:void 0)??($.ctx&&!re($.label)?L.find(Dt=>fe(Dt,$.ctx)):void 0);if(G)return G;if($.ctx&&U.length===1&&g(re($.label)).length>=20)return U[0];let _t=Dt=>Dt.split(">").slice(0,2).join(">"),se=Dt=>!$.ctx&&_t(c(Dt))===_t($.selector);return re($.label)?M&&!$.ctx&&S(M,$.label)?M:U.length===1&&se(U[0])?U[0]:null:M||($.nth!=null?L[$.nth]??null:null)},we=$=>{let M=null;for(let L=$,V=$.parentElement;V&&V!==document.body&&getComputedStyle(L).position!=="fixed";L=V,V=V.parentElement){let U=getComputedStyle(V);if(U.overflowX==="visible"&&U.overflowY==="visible")continue;let G=V.getBoundingClientRect();M=M?{l:Math.max(M.l,G.left),t:Math.max(M.t,G.top),r:Math.min(M.r,G.right),b:Math.min(M.b,G.bottom)}:{l:G.left,t:G.top,r:G.right,b:G.bottom}}return M},N=$=>{let M=$.getBoundingClientRect();return(M.width>0||M.height>0)&&(!$.checkVisibility||$.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},ft=$=>({...$,x:Math.min(Math.max($.x,3),document.documentElement.clientWidth-30),y:$.y>=0&&$.y<19?19:$.y}),Rt=($,M)=>{let L=M;for(let V=M.parentElement;V&&V!==document.body;V=V.parentElement){if(!N(V)){L=V;continue}let U=M.getBoundingClientRect();if(U.width||U.height)return ft({x:U.left+U.width*$.rx,y:U.top+U.height*$.ry,el:M,hidden:V,shut:L});let G=V.getBoundingClientRect();return ft({x:G.left,y:G.top,el:M,hidden:V,shut:L})}return null},jt=$=>{let M=$.opener?Re($.opener):null;if(!M||!N(M))return null;let L=M.getBoundingClientRect();return ft({x:L.right-4,y:L.top+4,el:M,opener:M})};return{cssPath:c,poolOf:A,contextOf:F,resolveEl:zt,anchorOf:($,M=zt($))=>{if(!M)return jt($);if(!N(M))return jt($)??Rt($,M);let L=M.getBoundingClientRect(),V=L.left+L.width*$.rx,U=L.top+L.height*$.ry,G=we(M);return G?V<G.l||V>G.r||U<G.t||U>G.b?null:{x:V,y:U,el:M}:{x:V,y:U,el:M}},anchorState:me,fingerprintOf:pe}}var ru=(n,i)=>`<svg class="dt-bars" viewBox="0 0 18 11" width="18" height="11" aria-hidden="true">${[0,1,2,3].map(c=>`<rect x="${c*5}" y="${6-c*2}" width="3" height="${5+c*2}" rx="1" fill="${c<n?i:"#fff"}" stroke="none"${c<n?"":' opacity="0.12"'}/>`).join("")}</svg>`;function lu(n,i,c){let h=document.createElement("div");h.className="dt-field-menu",h.setAttribute("role","listbox"),h.hidden=!0,document.body.append(h);for(let S of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])h.addEventListener(S,C=>C.stopPropagation());let g=null,y=()=>{h.hidden=!0,g=null};for(let S of n)S.addEventListener("mousedown",C=>{let w=C.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select");if(!w){h.contains(C.target)||y();return}if(C.preventDefault(),g===w){y();return}g=w;let A=w.classList.contains("dt-more-select"),k=F=>A?F.dataset.on!=null:F.selected,z=w.dataset.search;h.innerHTML=(z?`<label class="dt-field-search"><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg><input type="search" placeholder="${i(z)}" aria-label="${i(z)}" spellcheck="false"></label>`:"")+[...w.options].map((F,xt)=>F.hidden?"":F.dataset.head!=null?`<p class="dt-field-head">${i(F.text)}${F.dataset.note?`<small>${i(F.dataset.note)}</small>`:""}</p>`:`${F.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${xt}" aria-selected="${k(F)}"${F.disabled?" disabled":""}${F.dataset.hint?` data-tip="${i(F.dataset.hint)}" data-hint="${i(F.dataset.hint.toLowerCase())}"`:""}${F.dataset.danger!=null?' class="is-danger"':""}>${F.dataset.icon?F.dataset.icon:F.dataset.initial!=null?F.dataset.face?`<img class="dt-face" src="${i(F.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${i(F.dataset.initial)}</b>`:F.dataset.bare!=null?"":`<i style="background:${i(F.dataset.c||"#717171")}"></i>`}<span>${i(F.text)}</span>${F.dataset.note?`<small>${i(F.dataset.note)}</small>`:""}${k(F)?c:""}</button>${F.dataset.sepAfter!=null?"<hr>":""}`).join("")+(z?'<p class="dt-field-none" hidden></p>':""),h.classList.toggle("is-people",!!z);let dt=w.parentElement.getBoundingClientRect(),J=z?w.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;h.style.left=`${J?J.left+4:dt.left}px`,h.style.top=`${dt.bottom+4}px`,h.style.minWidth=`${J?J.width-8:Math.max(200,dt.width)}px`,h.style.width=J?`${J.width-8}px`:"",h.hidden=!1;for(let F of h.querySelectorAll("[data-hint]")){let xt=F.querySelector("span");xt.scrollWidth>xt.clientWidth&&(F.dataset.tip=`${xt.textContent} \xB7 ${F.dataset.tip}`)}let tt=h.getBoundingClientRect();(tt.bottom>innerHeight-8||z&&w.closest(".dt-note"))&&(h.style.top=`${Math.max(8,dt.top-4-tt.height)}px`),tt.right>innerWidth-8&&(h.style.left=`${Math.max(8,dt.right-tt.width)}px`),h.querySelector(".dt-field-search input")?.focus()});h.addEventListener("input",S=>{let C=S.target.value.trim().toLowerCase(),w=0;for(let k of h.querySelectorAll("[data-i]"))k.hidden=!!C&&!k.textContent.toLowerCase().includes(C)&&!k.dataset.hint?.includes(C),k.hidden||w++;for(let k of h.querySelectorAll("hr"))k.hidden=!!C;let A=h.querySelector(".dt-field-none");A&&(A.hidden=w>0,A.textContent=`No one matches \xAB${S.target.value.trim()}\xBB`)}),h.addEventListener("keydown",S=>{S.key!=="Enter"||!S.target.matches("input")||(S.preventDefault(),h.querySelector("[data-i]:not([hidden])")?.click())}),h.addEventListener("click",S=>{let C=S.target.closest("[data-i]");if(!C||!g)return;let w=g;y(),!(w.selectedIndex===Number(C.dataset.i)&&!w.classList.contains("dt-more-select"))&&(w.selectedIndex=Number(C.dataset.i),w.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",S=>{S.key==="Escape"&&!h.hidden&&(S.stopPropagation(),y())},!0),document.addEventListener("pointerdown",S=>{!h.hidden&&!h.contains(S.target)&&!S.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select")&&y()},!0),addEventListener("scroll",S=>{h.contains(S.target)||y()},!0)}var ns=()=>!matchMedia("(prefers-reduced-motion: reduce)").matches,On=n=>Promise.allSettled(n.getAnimations({subtree:!0}).filter(i=>i.effect?.getComputedTiming().iterations!==1/0).map(i=>i.finished)),Po=new WeakMap,ss=(n,i)=>{let c=Po.has(n);Po.set(n,i),!c&&(n.setAttribute("data-leaving",""),On(n).then(()=>{let h=Po.get(n);h&&(Po.delete(n),n.removeAttribute("data-leaving"),h())}))},Io=n=>{Po.delete(n),n.removeAttribute("data-leaving")},du=n=>{let i=n.cloneNode(!0);for(let c of["id","data-id","data-draft","data-parked"])i.removeAttribute(c);i.setAttribute("data-ghost",""),i.setAttribute("aria-hidden","true"),i.inert=!0,n.after(i),On(i).then(()=>i.remove())},Oo=(n,i)=>{n.removeAttribute("data-nudge"),n.offsetWidth,n.setAttribute("data-nudge",i),On(n).then(()=>{n.getAttribute("data-nudge")===i&&n.removeAttribute("data-nudge")})},cu=n=>{let i=getComputedStyle(document.documentElement).getPropertyValue(n).trim(),c=i.indexOf(" ");return{duration:parseFloat(i)*(/^[\d.]+s$/.test(i.slice(0,c))?1e3:1),easing:i.slice(c+1)}},Ga=(n,i,c=1/0)=>{let h=n.hidden?0:Math.min(n.offsetHeight,c),g=n.hidden?"0":getComputedStyle(n).opacity;n.getAnimations().forEach(w=>w.cancel()),n.hidden=!1;let y=i?Math.min(n.scrollHeight,c):0,S=()=>{n.hidden=!i};if(!ns()||h===y)return S();let C=n.animate([{height:`${h}px`,opacity:g,overflow:"hidden"},{height:`${y}px`,opacity:i?1:0,overflow:"hidden"}],{...cu(i?"--dt-smooth":"--dt-snappy"),fill:"forwards"});C.onfinish=()=>{S(),C.cancel()}},Or=(n,i,c,h,g)=>{if(n.getAnimations().forEach(S=>S.cancel()),!ns()||Math.abs(i-c)<1)return g();let y=n.animate([{height:`${i}px`,overflow:"hidden"},{height:`${c}px`,overflow:"hidden"}],{...cu(h?"--dt-smooth":"--dt-snappy"),fill:"forwards"});y.onfinish=()=>{g(),y.cancel()}};var lh=".devtools, [class^='dt-'], [class*=' dt-']",dh=300,uu=null,pu=n=>{uu=n};function mu(){let n=document.createElement("div");n.className="dt-tipbox",n.setAttribute("role","tooltip"),n.id="dt-tipbox",n.hidden=!0,document.body.append(n);let i=null,c,h=0,g=A=>{let k=A.getAttribute("title");k!==null&&(A.removeAttribute("title"),A.hasAttribute("data-tip")||A.setAttribute("data-tip",k),!A.hasAttribute("aria-label")&&!A.textContent?.trim()&&A.setAttribute("aria-label",k))},y=A=>{let k=A?.closest?.("[data-tip], [title]");return k&&k.closest(lh)&&!k.closest(".dt-tipbox")?k:null},S=A=>{let k=A.getAttribute("data-tip");if(!k||A.getAttribute("aria-expanded")==="true")return C();let z=uu?.(A);n.classList.toggle("is-peek",!!z),z?n.innerHTML=z:n.textContent=k,Io(n),n.hidden=!1,n.style.left="0px",n.style.top="0px";let dt=A.getBoundingClientRect(),J=n.getBoundingClientRect(),tt=6,F=8;if(z){let Wt=dt.right+8+J.width<=innerWidth-F;n.style.left=`${Wt?dt.right+8:Math.max(F,dt.left-8-J.width)}px`,n.style.top=`${Math.min(Math.max(F,dt.top-4),innerHeight-F-J.height)}px`,A.setAttribute("aria-describedby",n.id);return}let xt=dt.bottom+tt+J.height<=innerHeight-F;n.style.top=`${xt?dt.bottom+tt:Math.max(F,dt.top-tt-J.height)}px`,n.style.left=`${Math.min(Math.max(F,dt.left+dt.width/2-J.width/2),innerWidth-F-J.width)}px`,n.classList.toggle("is-mono",A.classList.contains("dt-note-el")),A.setAttribute("aria-describedby",n.id)},C=()=>{clearTimeout(c),i&&!n.hidden&&(h=performance.now()+400),i?.removeAttribute("aria-describedby"),i=null,n.hidden||ss(n,()=>{n.hidden=!0})},w=A=>{A!==i&&(C(),g(A),i=A,performance.now()<h?S(A):c=setTimeout(()=>i===A&&S(A),dh))};document.addEventListener("pointerover",A=>{let k=y(A.target);k?w(k):i&&!i.contains(A.target)&&C()},!0),document.addEventListener("pointerout",A=>{i&&!i.contains(A.relatedTarget)&&C()},!0),document.addEventListener("focusin",A=>{let k=A.target,z=y(k);z&&k.matches(":focus-visible")&&w(z)},!0),document.addEventListener("focusout",C,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",A=>{A.key==="Escape"&&C()},!0),addEventListener("scroll",C,!0),new MutationObserver(()=>{i&&(!i.isConnected||i.getAttribute("aria-expanded")==="true")&&C()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-expanded"]})}var ht={signal:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><rect x="1" y="12" width="3.2" height="5" rx="1"/><rect x="5.6" y="9" width="3.2" height="8" rx="1"/><rect x="10.2" y="6" width="3.2" height="11" rx="1"/><rect x="14.8" y="3" width="3.2" height="14" rx="1"/></svg>',wifi:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><path d="M10 16.6 7.4 13.8a3.7 3.7 0 0 1 5.2 0z"/><path d="M4.8 11.1a7.4 7.4 0 0 1 10.4 0l-1.3 1.4a5.5 5.5 0 0 0-7.8 0z"/><path d="M2.2 8.3a11.1 11.1 0 0 1 15.6 0l-1.3 1.4a9.2 9.2 0 0 0-13 0z"/></svg>',battery:'<svg viewBox="0 0 28 14" class="dt-i dt-i--batt"><rect x="1" y="1" width="23" height="12" rx="3.5" fill="none" stroke="currentColor" stroke-opacity=".4"/><rect x="3" y="3" width="17" height="8" rx="2" fill="currentColor"/><path d="M26 5v4a2 2 0 0 0 0-4z" fill="currentColor" fill-opacity=".4"/></svg>',back:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4 6.5 10l6 6"/></svg>',fwd:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M7.5 4l6 6-6 6"/></svg>',reload:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9"/><path d="M14.2 3.2v3.2H11"/></svg>',dots:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="4.5" cy="10" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="15.5" cy="10" r="1.6"/></svg>',dotsV:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="4.5" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="10" cy="15.5" r="1.6"/></svg>',share:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 12.5V2.8M6.8 5.8 10 2.6l3.2 3.2"/><path d="M6.5 8.5H5a1.5 1.5 0 0 0-1.5 1.5v6A1.5 1.5 0 0 0 5 17.5h10a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 15 8.5h-1.5"/></svg>',plus:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 4v12M4 10h12"/></svg>',tabs:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="3" y="6" width="11" height="11" rx="2"/><path d="M6 3.5h8.5A2.5 2.5 0 0 1 17 6v8.5"/></svg>',sidebar:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="2.5" y="4" width="15" height="12" rx="2"/><path d="M8 4v12"/></svg>',lock:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="9" width="10" height="8" rx="1.8"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/></svg>',tune:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3 6.5h8M15 6.5h2M3 13.5h2M9 13.5h8"/><circle cx="13" cy="6.5" r="2"/><circle cx="7" cy="13.5" r="2"/></svg>',star:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m10 3 2.1 4.4 4.8.6-3.5 3.3.9 4.7L10 13.7 5.7 16l.9-4.7L3.1 8l4.8-.6z" stroke-linejoin="round"/></svg>',user:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="10" r="8" fill-opacity=".25"/><circle cx="10" cy="8" r="3"/><path d="M4.8 15.3a6 6 0 0 1 10.4 0 7.9 7.9 0 0 1-10.4 0z"/></svg>',recent:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5.5 5v10M10 5v10M14.5 5v10"/></svg>',home:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="4.5" y="4.5" width="11" height="11" rx="3.5"/></svg>',navBack:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4.5 7 10l5.5 5.5"/></svg>',close:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m5.5 5.5 9 9m0-9-9 9"/></svg>',winMin:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5 10h10"/></svg>',winMax:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="5" width="10" height="10" rx="1.5"/></svg>',chevUp:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m6 12 4-4 4 4"/></svg>',volume:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3.5 8v4h3l4 3.5v-11l-4 3.5z" stroke-linejoin="round"/><path d="M13.5 7.5a3.5 3.5 0 0 1 0 5"/></svg>'},qr=(n,i)=>n.toLocaleTimeString("en-US",i),Ka=n=>qr(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),ch={island:n=>({side:12,top:12,bottom:12,r:n.w>=430?62:55,body:n.w>=430?74:67,extraW:6}),home:()=>({side:18,top:92,bottom:92,r:0,body:56,extraW:6}),punch:()=>({side:9,top:9,bottom:9,r:34,body:43,extraW:6}),tablet:()=>({side:26,top:26,bottom:26,r:18,body:44}),macbook:n=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((n.w+32)*.12),extraH:18}),laptop:n=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((n.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function uh(n,i,c,h,g){let y=n.w+2*i.side,S=n.h+i.top+i.bottom,C=(c-y)/2,w=`<rect class="dt-shell-screen" x="${g}" y="${i.top}" width="${n.w}" height="${n.h}" rx="${i.r}"/>`,A="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let k=(z,dt,J)=>`<rect class="dt-shell-btn" x="${z}" y="${dt}" width="4" height="${J}" rx="2"/>`;A+=n.shell==="punch"?k(C+y-1,150,70)+k(C+y-1,240,44):k(C-3,120,28)+k(C-3,170,56)+k(C-3,236,56)+k(C+y-1,190,90),A+=`<rect class="dt-shell-body" x="${C}" y="0" width="${y}" height="${S}" rx="${i.body}"/>`,A+=`<rect class="dt-shell-bezel" x="${C+3}" y="3" width="${y-6}" height="${S-6}" rx="${i.body-3}"/>`,n.shell==="home"&&(A+=`<rect class="dt-shell-slot" x="${c/2-26}" y="44" width="52" height="6" rx="3"/>`,A+=`<circle class="dt-shell-slot" cx="${c/2-48}" cy="47" r="5"/>`,A+=`<circle class="dt-shell-homebtn" cx="${c/2}" cy="${S-46}" r="28"/>`)}else if(n.shell==="tablet")A+=`<rect class="dt-shell-body dt-shell-body--light" x="${C}" y="0" width="${y}" height="${S}" rx="${i.body}"/>`,A+=`<rect class="dt-shell-bezel" x="${C+4}" y="4" width="${y-8}" height="${S-8}" rx="${i.body-4}"/>`;else if(n.shell==="monitor"){let k=Math.round(y*.1);A+=`<path class="dt-shell-stand" d="M${c/2-k/2} ${S-2}h${k}l${k*.2} 84h${-k*1.4}z"/>`,A+=`<rect class="dt-shell-stand" x="${c/2-y*.15}" y="${S+80}" width="${y*.3}" height="14" rx="7"/>`,A+=`<rect class="dt-shell-body" x="${C}" y="0" width="${y}" height="${S}" rx="${i.body}"/>`}else{let k=y+(i.extraW??0),z=(c-k)/2,dt=i.extraH??16;A+=`<path class="dt-shell-body" d="M${C} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${y-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${S}H${C}z"/>`,A+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${z} ${S}h${k}v${dt-8}a8 8 0 0 1-8 8H${z+8}a8 8 0 0 1-8-8z"/>`,A+=`<rect class="dt-shell-lip" x="${c/2-y*.07}" y="${S}" width="${y*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${c} ${h}" width="${c}" height="${h}" aria-hidden="true">${A}${w}</svg>`}var ph={"safari-ios":n=>{let i=n.shell==="home"?20:n.w>=400?62:59;return{top:i,bottom:98,topMin:i,bottomMin:58}},"chrome-android":()=>({top:92,bottom:48,topMin:36,bottomMin:48}),"safari-ipad":()=>({top:74,bottom:20}),"safari-mac":()=>({top:85,bottom:59}),"chrome-windows":()=>({top:87,bottom:48})},mh=({d:n,now:i,cutout:c},h)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${h}px"><span class="dt-sb-l">${ht.signal}${ht.wifi}</span><b>${Ka(i)}</b><span class="dt-sb-r">${ht.battery}</span></div>`;let g=c??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${h}px"><span class="dt-island" style="left:${g.x}px;top:${g.y}px;width:${g.width}px;height:${g.height}px"></span><b class="dt-sb-time" style="top:${g.y}px;height:${g.height}px">${Ka(i)}</b><span class="dt-sb-icons" style="top:${g.y}px;height:${g.height}px">${ht.signal}${ht.wifi}${ht.battery}</span></div>`},hh=({d:n,host:i,min:c},h)=>{let g=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return c?`<div class="dt-ios-bar is-min" style="height:${h}px"><span class="dt-ios-mini">${f(i)}</span>${g}</div>`:`<div class="dt-ios-bar" style="height:${h}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${ht.back}</button><span class="dt-glass dt-ios-url"><span>${f(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-glass dt-glass--round">${ht.dots}</span></div>${g}</div>`},gh=({now:n,min:i},c)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${qr(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${ht.wifi}${ht.signal}${ht.battery}</span></div>`+(i?"":`<div class="dt-and-bar"><span class="dt-and-url">${ht.tune}<span>${f(c)}</span></span><span class="dt-and-tabs">1</span>${ht.dotsV}</div>`),fh=()=>`<div class="dt-and-nav">${ht.recent}${ht.home}${ht.navBack}</div>`,bh=({now:n,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Ka(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${ht.wifi}${ht.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${ht.sidebar}<button data-nav="back" aria-label="Back" title="Back">${ht.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ht.fwd}</button></span><span class="dt-ipad-url">${ht.lock}<span>${f(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-bar-group">${ht.share}${ht.plus}${ht.tabs}</span></div>`,yh=({now:n,host:i},c)=>'<div class="dt-mac-menu"><span class="dt-mac-apps"><b>Safari</b><span>File</span><span>Edit</span><span>View</span><span>History</span><span>Bookmarks</span><span>Window</span><span>Help</span></span>'+(c?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${ht.wifi}${ht.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${Ka(n)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${ht.sidebar}<button data-nav="back" aria-label="Back" title="Back">${ht.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ht.fwd}</button></span><span class="dt-mac-url">${ht.lock}<span>${f(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-bar-group">${ht.share}${ht.plus}${ht.tabs}</span></div>`,vh=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,wh=({host:n,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${f(i||n)}</span>${ht.close}</span><span class="dt-win-new">${ht.plus}</span><span class="dt-win-ctrl">${ht.winMin}${ht.winMax}${ht.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${ht.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ht.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-win-url">${ht.tune}<span>${f(n)}</span>${ht.star}</span><span class="dt-bar-group">${ht.user}${ht.dotsV}</span></div>`,$h=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,c)=>`<i style="--hue:${200+c*30}"></i>`).join("")}</span><span class="dt-win-tray">${ht.chevUp}${ht.wifi}${ht.volume}${ht.battery}<span class="dt-win-clock">${qr(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function hu(n,i){let c=ch[n.shell](n),h=n.w+2*c.side,g=n.h+c.top+c.bottom,y=h+(c.extraW??0),S=g+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?c.extraH??0:0),C=(y-h)/2+c.side,w=ph[n.browser](n),A=i.min?w.topMin??w.top:w.top,k=i.min?w.bottomMin??w.bottom:w.bottom,z={...i,d:n},dt="",J="";switch(n.browser){case"safari-ios":dt=mh(z,A),J=hh(z,k);break;case"chrome-android":dt=gh(z,i.host),J=fh();break;case"safari-ipad":dt=bh(z),J='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":dt=yh(z,n.shell==="macbook"),J=vh();break;case"chrome-windows":dt=wh(z),J=$h(z);break}return{footprint:{w:y,h:S},screen:{x:C,y:c.top,w:n.w,h:n.h,r:c.r,rb:c.rb??c.r},topH:A,bottomH:k,shell:uh(n,c,y,S,C),top:dt,bottom:J,canMinimize:w.topMin!==void 0&&(w.topMin!==w.top||w.bottomMin!==w.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var xs=null;function Do(n){if(xs??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!xs||!n)return[0,0,0,0];xs.clearRect(0,0,1,1),xs.fillStyle="rgba(0, 0, 0, 0)",xs.fillStyle=n,xs.fillRect(0,0,1,1);let[i,c,h,g]=xs.getImageData(0,0,1,1).data;return[i,c,h,g/255]}var qo=([n,i,c])=>`rgb(${n}, ${i}, ${c})`;function gu(n){let i=n.defaultView,c=J=>!J||Do(J)[3]===0,h=[n.body,n.documentElement].map(J=>J&&i.getComputedStyle(J).backgroundColor).find(J=>J&&!c(J)),[g,y,S,C]=h?Do(h):[255,255,255,1],w=[g,y,S].map(J=>Math.round(J*C+255*(1-C))),A=J=>{let[tt,F,xt,Wt]=Do(J);if(Wt>=.75)return qo([tt,F,xt]);let St=(at,vt)=>Math.round(at*Wt+vt*(1-Wt));return qo([St(tt,w[0]),St(F,w[1]),St(xt,w[2])])},k=J=>{let tt=n.elementFromPoint(i.innerWidth/2,J);for(;tt&&tt!==n.documentElement;tt=tt.parentElement){let F=i.getComputedStyle(tt);if(F.position!=="fixed"&&F.position!=="sticky")continue;let xt=tt.getBoundingClientRect().width>=i.innerWidth*.9,Wt=F.backdropFilter&&F.backdropFilter!=="none";return xt&&!Wt&&!c(F.backgroundColor)?A(F.backgroundColor):null}return null},z=n.querySelector('meta[name="theme-color"]')?.content||"",dt=z&&!c(z)?qo(Do(z)):"";return{top:k(4)??qo(w),bottom:k(i.innerHeight-4)??qo(w),theme:dt}}function Dr(n){let[i,c,h]=Do(n).map(g=>g/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4);return .2126*i+.7152*c+.0722*h>.4?"#000":"#fff"}function fu(n){let{cfg:i,inFrame:c,persist:h,frame:g,frameEl:y,devicesMenu:S,bpBtns:C,notesOverlay:w,WIDE:A,bpOf:k,currentBp:z,deviceById:dt,notesOn:J,filter:tt,filterTo:F,dropFrameDrafts:xt,putAway:Wt,tellFrame:St,syncBpButtons:at,render:vt,reread:It}=n,qt=i.breakpoints,Lt=document.querySelector(".dt-device"),pe=document.querySelector(".dt-shell"),fe=document.querySelector('.dt-chrome[data-at="top"]'),Qt=document.querySelector('.dt-chrome[data-at="bottom"]'),me=document.querySelector(".dt-ruler"),Ln=[...document.querySelectorAll(".dt-frame-handle")],zt=document.querySelector(".dt-frame-size"),Re=document.querySelector(".dt-frame-rotate"),we=document.querySelector(".dt-frame-bars"),N="overlay",ft="",Rt="dt-w",jt="dt-canvas",ne="dt-device",$=ct.getItem(jt)==="1",M=ct.getItem(ne)||"";M&&!dt(M)&&(M="",ct.setItem(ne,""));let L=Number(ct.getItem(Rt))||0,V="dt-emu",U=(()=>{try{return JSON.parse(ct.getItem(V)||"null")}catch{return null}})(),G=()=>U?No.find(R=>R.id===U.id)??null:null,_t=()=>{let R=G();return R?U.turned?{w:R.h,h:R.w}:{w:R.w,h:R.h}:null},se=ct.getItem("dt-bars-min")==="1",Dt=R=>{U=R,h(V,R?JSON.stringify(R):"")},E=R=>{zt.textContent=R,g.style.setProperty("--dt-badge-w",`${zt.offsetWidth}px`)},x=R=>{if(!R){me.innerHTML="";return}let O="";for(let Y=0;Y<=R;Y+=50)O+=`<span class="dt-tick${Y%200===0?" is-major":""}" style="left:${Y}px"></span>`;for(let Y of qt)for(let Nt of[Y.min,Y.max])Nt>0&&Number.isFinite(Nt)&&Nt<=R&&(O+=`<span class="dt-edge" style="left:${Nt}px" title="${Y.label} edge"></span>`);me.innerHTML=O,me.style.width=`${R}px`},H=()=>{let R=parseFloat(Lt.style.width)||0,O=parseFloat(Lt.style.height)||0;if(!R||!O){Lt.style.transform="",delete Lt.dataset.scaled;return}let Y=M||U?Math.min(1,(innerWidth-80)/R,(innerHeight-120)/O):Math.min(1,(innerWidth-80)/R);Lt.style.transform=Y<1?`scale(${Y})`:"",Lt.dataset.scaled=Y<1?String(Math.round(Y*100)):""},q=R=>No.find(O=>O.w===R.w&&O.h===R.h&&O.cutout?.shape==="pill")?.cutout,D=()=>{try{return y.contentDocument}catch{return null}},ut=()=>D()?.title.split("\u2014").pop()?.trim()||"",Et=()=>{let R=D(),O=M?dt(M):null;if(!R?.body||!O)return;let Y=gu(R),Nt=O.browser==="chrome-android"?Y.theme||"rgb(255, 255, 255)":Y.top,Kt=O.browser==="chrome-android"?"rgb(255, 255, 255)":Y.bottom;Lt.style.setProperty("--dt-top",Nt),Lt.style.setProperty("--dt-top-ink",Dr(Nt)),Lt.style.setProperty("--dt-bottom",Kt),Lt.style.setProperty("--dt-bottom-ink",Dr(Kt));let xe=fe.querySelector(".dt-win-tab > span");xe&&(xe.textContent=ut()||location.host)},st=0;y.addEventListener("load",()=>{let R=D();if(!R)return;let O=window.__notemendHosted;if(O&&!y.contentWindow?.__notemendHosted&&!R.querySelector(`script[src^="${O.base}/bar.js"]`)){let Y=R.createElement("script");Y.src=`${O.base}/bar.js`,Y.dataset.project=O.project,R.head.append(Y)}Et(),y.contentWindow?.addEventListener("scroll",()=>{st||(st=requestAnimationFrame(()=>{st=0,Et()}))},{passive:!0})});for(let R of[fe,Qt])R.addEventListener("click",O=>{let Y=O.target.closest("[data-nav]")?.dataset.nav;if(Y)try{let Nt=y.contentWindow?.navigation;if(!D()||!Nt)throw new Error("foreign");Y==="back"?Nt.canGoBack&&Nt.back():Y==="fwd"?Nt.canGoForward&&Nt.forward():Nt.reload()}catch{(Y==="reload"||Y==="back")&&(y.src=location.href)}});we.addEventListener("click",()=>{se=!se,h("dt-bars-min",se?"1":"0"),gt()});let et=[],rt=R=>{for(let O of et)O.inert=!1;et=R?[...document.body.children].filter(O=>O instanceof HTMLElement&&!O.inert&&!O.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let O of et)O.inert=!0},gt=()=>{if(c)return;let R=M?dt(M)??null:null;if(M&&!R&&(M="",ct.setItem(ne,"")),!R&&!$){let O="";try{let Y=y.getAttribute("src")?y.contentWindow?.location:null;Y?.origin===location.origin&&(O=Y.pathname+Y.search+Y.hash)}catch{}if(g.hidden=!0,rt(!1),y.removeAttribute("src"),Zt.toggle("dt-framing",!1),w.hidden=!J(),me.innerHTML="",at(),Re.hidden=!0,we.hidden=!0,F(null),ft="",xt(),at(),He(),O&&O!==location.pathname+location.search+location.hash){location.assign(O);return}It();return}if(g.hidden=!1,rt(!0),Zt.toggle("dt-framing",!0),w.hidden=!0,y.src||(y.src=location.href),R){let O=hu(R,{host:location.host,title:ut(),now:new Date,min:se,cutout:q(R)}),{screen:Y}=O;g.dataset.mode="device",Lt.dataset.shell=R.shell,Lt.dataset.browser=R.browser,Lt.style.width=`${O.footprint.w}px`,Lt.style.height=`${O.footprint.h}px`,Lt.style.setProperty("--dt-r",`${Y.r}px`),Lt.style.setProperty("--dt-rb",`${Y.rb}px`),pe.innerHTML=O.shell;let Nt=(it,ye,os,as)=>{it.innerHTML=as,it.style.cssText=`left:${Y.x}px;top:${ye}px;width:${Y.w}px;height:${os}px`};Nt(fe,Y.y,O.topH,O.top),Nt(Qt,Y.y+Y.h-O.bottomH,O.bottomH,O.bottom);let Kt=Y.h-O.topH-O.bottomH;y.style.position="absolute",y.style.left=`${Y.x}px`,y.style.top=`${Y.y+O.topH}px`,y.style.width=`${Y.w}px`,y.style.height=`${Kt}px`,me.innerHTML="";let xe=se&&O.canMinimize;N=O.scrollbar,ft=`${R.label}${xe?" \xB7 bars folded":""}`,F(k(R.w)),St({notes:J(),scrollbar:N,device:ft}),we.hidden=!O.canMinimize,we.setAttribute("aria-pressed",String(xe)),E(`${R.label} ${R.w}\xD7${R.h} \xB7 page ${R.w}\xD7${Kt}${xe?" \xB7 bars folded":""} \xB7 ${qt.find(it=>it.id===tt())?.label??""}`),Et()}else{let O=_t();O||Dt(null);let Y=O?.w||L||qt.find(xe=>xe.id===z()).ideal;L=Y,g.dataset.mode="canvas",delete Lt.dataset.shell,delete Lt.dataset.browser,pe.innerHTML=fe.innerHTML=Qt.innerHTML="",fe.style.cssText=Qt.style.cssText="",we.hidden=!0,N="overlay",Lt.style.width=`${Y}px`,Lt.style.height=`${O?.h??innerHeight-84}px`,y.style.position="",y.style.left=y.style.top="",y.style.width="100%",y.style.height="100%",x(Y),St({notes:J()});let Nt=qt.find(xe=>xe.id===k(Y)),Kt=G();ft=Kt?`${Kt.label}${U?.turned?" \xB7 landscape":""}`:"",St({scrollbar:N,device:ft}),E(Kt&&O?`${Kt.label} \xB7 ${O.w}\xD7${O.h} \xB7 ${Nt.label}`:`${Y}px \xB7 ${Nt.label}`),F(k(Y))}Re.hidden=!(G()?.rotates&&!R),He(),H(),at(),It()},At=R=>{let O=qt.find(Y=>Y.id===R);M="",ct.setItem(ne,""),Dt(null),$=z()!==R,L=$?O.ideal:0,F($?R:null),ct.setItem(jt,$?"1":"0"),ct.setItem(Rt,String(L)),Wt(),gt()};for(let R of C)R.addEventListener("click",()=>At(R.dataset.bp));for(let R of document.querySelectorAll("[data-device]"))R.addEventListener("click",()=>{M=R.dataset.device===M?"":R.dataset.device,ct.setItem(ne,M),S.open=!1,gt()});for(let R of document.querySelectorAll("[data-emu]"))R.addEventListener("click",()=>{let O=U?.id===R.dataset.emu&&!M;M="",ct.setItem(ne,""),Dt(O?null:{id:R.dataset.emu,turned:!1}),$=!O,L=0,ct.setItem(jt,$?"1":"0"),F(null),Wt(),S.open=!1,gt()});Re.addEventListener("click",()=>{U&&(Dt({...U,turned:!U.turned}),Wt(),gt())});let $e=[...S.querySelectorAll("[data-tab]")],je=[...S.querySelectorAll("[data-panel]")],ke=R=>{for(let O of $e)O.setAttribute("aria-selected",String(O.dataset.tab===R));for(let O of je)O.hidden=O.dataset.panel!==R;h("dt-devices-tab",R)};for(let R of $e)R.addEventListener("click",()=>ke(R.dataset.tab));ke(ct.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let Vt=S.querySelector(".dt-emu-search");Vt.addEventListener("input",()=>{let R=Vt.value.trim().toLowerCase(),O=null,Y=!1,Nt=()=>{O&&(O.hidden=!Y)};for(let Kt of Vt.parentElement.children){if(Kt.classList.contains("dt-devices-group")){Nt(),O=Kt,Y=!1;continue}Kt.dataset.emu&&(Kt.hidden=!!R&&!Kt.textContent.toLowerCase().includes(R),Y||=!Kt.hidden)}Nt()});let he=S.querySelector(".dt-devices-name");function He(){for(let O of S.querySelectorAll("[data-device]"))O.setAttribute("aria-pressed",String(O.dataset.device===M));let R=!M&&!g.hidden?U?.id:void 0;for(let O of S.querySelectorAll("[data-emu]"))O.setAttribute("aria-pressed",String(O.dataset.emu===R));he.textContent=M&&dt(M)?.label||R&&G()?.label||"Device"}let be=R=>qt.find(O=>O.id===R),_e=R=>{let O=be(tt()??z());return Math.max(O.min||320,Math.min(Number.isFinite(O.max)?O.max:2560,Math.round(R)))};for(let R of Ln){let O=R.dataset.edge==="l"?-1:1;R.addEventListener("pointerdown",Y=>{if(M)return;Y.preventDefault(),U&&(Dt(null),gt()),R.setPointerCapture(Y.pointerId);let Nt=Y.clientX,Kt=L,xe=Number(Lt.dataset.scaled||100)/100;g.dataset.dragging="1";let it=os=>{L=_e(Kt+O*(os.clientX-Nt)*2/xe),Lt.style.width=`${L}px`,x(L),E(`${L}px \xB7 ${be(k(L)).label}`),H()},ye=()=>{R.removeEventListener("pointermove",it),R.removeEventListener("pointerup",ye),R.removeEventListener("pointercancel",ye),delete g.dataset.dragging,ct.setItem(Rt,String(L)),gt()};R.addEventListener("pointermove",it),R.addEventListener("pointerup",ye),R.addEventListener("pointercancel",ye)}),R.addEventListener("dblclick",()=>{if(M)return;Dt(null);let Y=be(tt()??z()),Nt=[Y.min||320,Number.isFinite(Y.max)?Y.max:Y.ideal];L=Math.abs(L-Nt[0])<Math.abs(L-Nt[1])?Nt[0]:Nt[1],ct.setItem(Rt,String(L)),gt()})}let Ms=z(),qn=()=>{let R=qt.find(O=>O.id===A);return $&&!M&&!U&&L===R.ideal&&innerWidth>=R.min};return addEventListener("resize",()=>{if(qn()){At(A);return}at(),z()!==Ms&&(Ms=z(),vt()),g.hidden||(!M&&!U&&(Lt.style.height=`${innerHeight-84}px`),H())}),{apply:gt,pickBp:At,look:()=>({scrollbar:N,device:ft}),restore:()=>{qn()?At(A):$||M?gt():He()}}}var bu='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="5" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.2" fill="currentColor" stroke="none"/></svg>',yu='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg>',xh='<svg viewBox="0 0 20 20" width="10" height="10" aria-hidden="true"><rect x="3" y="3" width="14" height="14" rx="3"/><path d="M10 3v14"/></svg>',Eh='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function vu(n){let{bp:i,notes:c,breakpoints:h,bandOfNote:g,showResolved:y,showArchived:S,drafts:C,find:w}=n,A=c.filter(N=>g(N)===i),k=N=>[N.text,N.note,N.byName,...(N.replies??[]).filter(ft=>!ft.deleted).map(ft=>ft.text)].join(" ").toLowerCase(),z=N=>w.view==="me"?n.forMe(N):w.view==="agent"?n.forAgent(N):!0,dt=N=>Date.parse(N.updatedAt||N.createdAt||"")||0,J=N=>Date.parse(N.createdAt||"")||0,tt=A.filter(N=>z(N)&&(!w.q||k(N).includes(w.q.trim().toLowerCase()))).sort((N,ft)=>w.sort==="old"?J(N)-J(ft):w.sort==="new"?J(ft)-J(N):(w.sort==="unread"?Number(n.unread(ft))-Number(n.unread(N)):0)||dt(ft)-dt(N)),F={open:[],claude:[],done:[],archived:[]};for(let N of tt)F[Ct(N)==="done"&&n.archived(N)?"archived":Ct(N)].push(N);let xt=N=>{let ft=Ct(N),Rt=n.orphan(N),jt=n.unread(N),ne=n.picking&&n.pickable(N),$=!!ne&&n.picking.has(N.id),M=n.mirror(N),L=Qn(N.updatedAt||N.createdAt),V=M?`<i class="dt-hist-mirror"${M==="there"?` data-tip="In Team too \xB7 ${f(L)}"`:' data-tip="A client\u2019s thread, mirrored into Team"'}>${xh}Mirrored</i>`:"";return`<div class="dt-hist-row is-${ft}${ft==="done"?n.archived(N)?" is-archived":" is-resolved":""}${Rt?" is-orphan":""}${jt?" is-unread":""}${n.menuFor===N.id?" is-menu":""}${$?" is-picked":""}${n.picking&&!ne?` is-unpickable${M?" is-dim":""}`:""}">
|
|
211
|
+
`)}var Xe=(n,r)=>{let c=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">${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 Zc=[{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"/>'}],Qc=(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>`,Us=n=>Zc.find(r=>r.id===n)||Zc[0];var Ct=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",tu={open:"Open",done:"Resolved",claude:"To check"};var Zt={ready:Promise.resolve(),toggle:(n,r)=>{Zt.ready.then(()=>document.documentElement.classList.toggle(n,r))},set:(n,r)=>{Zt.ready.then(()=>document.documentElement.style.setProperty(n,r))}};var rh=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,eu=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(rh,"$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)}},lh=/ResizeObserver loop/,ws=(n,r)=>{if(lh.test(r))return;let c=Jt(eu(r.replace(/\s+/g," ").trim()),500),h=$s.findIndex(g=>g.kind===n&&g.text.replace(/ ×\d+$/,"")===c);if(h>=0){let[g]=$s.splice(h,1),y=Number(/ ×(\d+)$/.exec(g.text)?.[1]??1)+1;$s.push({at:new Date().toISOString(),kind:n,text:`${c} \xD7${y}`});return}$s.push({at:new Date().toISOString(),kind:n,text:c}),$s.length>50&&$s.shift()},nu=!1;function su(n){if(nu||typeof window>"u")return;nu=!0;let r=console.error;console.error=(...g)=>{ws("console",g.map(Ir).join(" ")),r.apply(console,g)},addEventListener("error",g=>{if(g instanceof ErrorEvent)return ws("error",`${g.message}${g.filename?` (${g.filename}:${g.lineno})`:""}`);let y=g.target,T=y?.src||y?.href;T&&!n(T)&&ws("network",`${y.tagName?.toLowerCase()} ${T} did not load`)},!0),addEventListener("unhandledrejection",g=>ws("rejection",Ir(g.reason)));let c=window.fetch;window.fetch=async(g,y)=>{let T=typeof g=="string"?g:g instanceof URL?g.href:g.url,C=(y?.method||(g instanceof Request?g.method:"GET")).toUpperCase();try{let w=await c.call(window,g,y);return w.status>=400&&!n(T)&&ws("network",`${C} ${T} \u2192 ${w.status}`),w}catch(w){throw!n(T)&&w?.name!=="AbortError"&&ws("network",`${C} ${T} \u2192 no answer (${Ir(w)})`),w}};let h=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(g,y,...T){return this._nm=`${g.toUpperCase()} ${String(y)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(y))||ws("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),h.call(this,g,y,...T)}}var ou=(n=Date.now())=>$s.filter(r=>n-Date.parse(r.at)<10*6e4).slice(-20);function au(n){let r=E=>{let x=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,H=E/x;return Math.round(H*10)%10===0?String(Math.round(H)):H.toFixed(1)},c=(E,x,H,q,D,ut="p")=>{if(H<=0||q<=0)return"";let Et=D!==""?`<span class="dt-pad-chip dt-pad-chip--${ut}" style="left:${E+H/2}px;top:${x+q/2}px">${D}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${ut}" style="left:${E}px;top:${x}px;width:${H}px;height:${q}px"></span>${Et}`},h=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],g="button, a, input, select, textarea, label, [role='button']",y=E=>{let x=E;for(let H=0;x&&H<6;H++,x=x.parentElement){if(x.matches(g))return x;let q=getComputedStyle(x);if(h.some(D=>parseFloat(q[D])>=2))return x}return E},T=(E,x)=>{let H=parseFloat(x.columnGap)||0,q=parseFloat(x.rowGap)||0;if(!(x.display.includes("flex")||x.display.includes("grid"))||!H&&!q)return"";let D=[...E.children].map(st=>st.getBoundingClientRect()).filter(st=>st.width||st.height),ut="",Et=(st,et)=>r(Math.abs(st-et)<=1?et:st);for(let st=1;st<D.length;st++){let et=D[st-1],rt=D[st];if(H&&rt.left>=et.right-1){let gt=Math.max(et.top,rt.top);ut+=c(et.right,gt,rt.left-et.right,Math.min(et.bottom,rt.bottom)-gt,Et(rt.left-et.right,H),"g")}else if(q&&rt.top>=et.bottom-1){let gt=Math.min(et.left,rt.left);ut+=c(gt,et.bottom,Math.max(et.right,rt.right)-gt,rt.top-et.bottom,Et(rt.top-et.bottom,q),"g")}}return ut},C=E=>`<span class="dt-pad-outline" style="left:${E.left}px;top:${E.top}px;width:${E.width}px;height:${E.height}px"></span>`,w=(E,x,H="")=>`<span class="dt-pad-tag" style="left:${x.left}px;top:${Math.max(2,x.top-22)}px">${E.tagName.toLowerCase()+(E.classList[0]?"."+E.classList[0]:"")}${H}</span>`,A=E=>{let x=E.getBoundingClientRect(),H=getComputedStyle(E),q=parseFloat(H.paddingTop),D=parseFloat(H.paddingRight),ut=parseFloat(H.paddingBottom),Et=parseFloat(H.paddingLeft),st=C(x);st+=c(x.left,x.top,x.width,q,q>=2?r(q):""),st+=c(x.left,x.bottom-ut,x.width,ut,ut>=2?r(ut):""),st+=c(x.left,x.top+q,Et,x.height-q-ut,Et>=2?r(Et):""),st+=c(x.right-D,x.top+q,D,x.height-q-ut,D>=2?r(D):"");let et=parseFloat(H.marginTop),rt=parseFloat(H.marginRight),gt=parseFloat(H.marginBottom),At=parseFloat(H.marginLeft);st+=c(x.left,x.top-et,x.width,et,et>=2?r(et):"","m"),st+=c(x.left,x.bottom,x.width,gt,gt>=2?r(gt):"","m"),st+=c(x.left-At,x.top,At,x.height,At>=2?r(At):"","m"),st+=c(x.right,x.top,rt,x.height,rt>=2?r(rt):"","m"),st+=T(E,H);let $e=parseFloat(H.columnGap)||0,je=parseFloat(H.rowGap)||0,ke=(H.display.includes("flex")||H.display.includes("grid"))&&($e||je)?` \xB7 gap ${r($e)}${je&&je!==$e?"/"+r(je):""}`:"",Gt="",he=E.parentElement;if(E.matches(g)&&he){let be=getComputedStyle(he);st+=T(he,be);let _e=parseFloat(be.columnGap)||parseFloat(be.rowGap)||0;Gt=` \xB7 ${r(x.width)}\xD7${r(x.height)}${_e&&(be.display.includes("flex")||be.display.includes("grid"))?` \xB7 gap ${r(_e)} in its row`:""}`}let He=Gt?"":` \xB7 ${Math.round(parseFloat(r(x.width)))} \xD7 ${Math.round(parseFloat(r(x.height)))}`;n.innerHTML=st+w(E,x,He+ke+Gt)},k=E=>{let x=E.getBoundingClientRect();n.innerHTML=C(x).replace("dt-pad-outline","dt-pad-outline dt-size-line")+`<span class="dt-pad-chip dt-size-chip" style="left:${x.left+x.width/2}px;top:${x.bottom+6}px">${Math.round(parseFloat(r(x.width)))} \xD7 ${Math.round(parseFloat(r(x.height)))}</span>`},z=E=>{let x=(E.match(/[\d.]+/g)||[]).map(Number);if(x.length<3)return E;let H="#"+x.slice(0,3).map(q=>Math.round(q).toString(16).padStart(2,"0")).join("");return x[3]!==void 0&&x[3]<1?`${H} \xB7 ${Math.round(x[3]*100)}%`:H},dt=null,J=()=>{if(dt)return dt;let E=getComputedStyle(document.documentElement),x=document.createElement("span");x.style.display="none",document.body.append(x);let H=[];for(let q of Array.from(E)){if(!q.startsWith("--"))continue;let D=E.getPropertyValue(q).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(D))continue;x.style.color="rgb(1, 2, 3)",x.style.color=D;let ut=getComputedStyle(x).color;ut&&ut!=="rgb(1, 2, 3)"&&H.push([ut,q])}return x.remove(),H.sort((q,D)=>q[1].length-D[1].length),dt=H,H},tt=E=>J().find(([x])=>x===E)?.[1]??"",F=null,xt=()=>{if(F)return F;let E=[],x=H=>{for(let q of Array.from(H))q instanceof CSSStyleRule?q.style.cssText.includes("var(--")&&E.push({sel:q.selectorText,style:q.style}):q instanceof CSSMediaRule?matchMedia(q.conditionText).matches&&x(q.cssRules):"cssRules"in q&&x(q.cssRules)};for(let H of Array.from(document.styleSheets))try{x(H.cssRules)}catch{}return F=E},Wt={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(E=>[`border-${E}-color`,[`border-${E}-color`,"border-color",`border-${E}`,"border"]]))},St=(E,x)=>{let H=Wt[x]??[x],q=x==="color";for(let D=E;D;D=q?D.parentElement:null){let ut=et=>H.map(rt=>/var\(\s*(--[\w-]+)/.exec(et.getPropertyValue(rt))?.[1]).find(Boolean),Et=D instanceof HTMLElement?ut(D.style):void 0;if(Et)return Et;let st="";for(let et of xt()){let rt=!1;try{rt=D.matches(et.sel)}catch{}rt&&(st=ut(et.style)||st)}if(st)return st;if(q&&D.parentElement&&getComputedStyle(D).color!==getComputedStyle(D.parentElement).color)break}return""},at=(E,x,H)=>{let q=getComputedStyle(E).getPropertyValue(x).trim();if(!q)return z(H);let D=document.createElement("span");if(D.style.display="none",D.style.color=q,!D.style.color)return z(H);document.body.append(D);let ut=getComputedStyle(D).color;return D.remove(),z(ut)},vt=(E,x,H)=>{let q=St(E,x);if(q)return`<b class="dt-var">${q}</b> <em>${at(E,q,H)}</em>`;let D=tt(H);return D?`<span title="Same value as ${D}; not written with it">\u2248 ${D}</span> <em>${z(H)}</em>`:z(H)},It=E=>`<i class="dt-type-sw" style="background:${E}"></i>`,qt={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},Lt=E=>(E.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),pe=(E,x)=>E.slice(0,3).map((H,q)=>H*E[3]+x[q]*(1-E[3])).concat([1]),fe=E=>{let x=[];for(let H=E;H;H=H.parentElement){let q=getComputedStyle(H);if(q.backgroundImage!=="none")return null;let D=Lt(q.backgroundColor);if(D[3]>0&&(x.push(D),D[3]>=1))break}return x.reduceRight((H,q)=>pe(q,H),[255,255,255,1])},Qt=E=>{let[x,H,q]=E.slice(0,3).map(D=>(D/=255,D<=.03928?D/12.92:((D+.055)/1.055)**2.4));return .2126*x+.7152*H+.0722*q},me=(E,x,H)=>{let q=fe(E);if(!q)return["Contrast","<em>on an image</em>"];let D=pe(Lt(x.color),q),[ut,Et]=[Qt(D),Qt(q)].sort((gt,At)=>At-gt),st=(ut+.05)/(Et+.05),et=H>=24||H>=18.66&&Number(x.fontWeight)>=700,rt=st>=(et?4.5:7)?"AAA":st>=(et?3:4.5)?"AA":"fails AA";return["Contrast",`${st.toFixed(2)}:1 <em class="${rt==="fails AA"?"dt-type-bad":""}">${rt}${et?" \xB7 large":""}</em>`]},Ln=E=>{let x=E.getBoundingClientRect(),H=getComputedStyle(E),q=parseFloat(H.fontSize),D=H.lineHeight==="normal"?0:parseFloat(H.lineHeight),ut=parseFloat(H.letterSpacing)||0,Et=At=>`${(At*100).toFixed(1).replace(/\.0$/,"")}%`,st=[["Font",H.fontFamily.split(",")[0].replace(/["']/g,"")+(H.fontStyle!=="normal"?` ${H.fontStyle}`:"")],["Weight",`${qt[H.fontWeight]??""} <em>${H.fontWeight}</em>`],["Size",`${r(q)}px`],["Line",D?`${Et(D/q)} <em>${r(D)}px</em>`:"normal"],["Letter",ut?`${Et(ut/q)} <em>${ut.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",It(H.color)+vt(E,"color",H.color)],me(E,H,q)],rt=x.bottom+150<innerHeight?x.bottom+8:Math.max(8,x.top-158),gt=Math.min(Math.max(8,x.left),innerWidth-210);n.innerHTML=C(x)+w(E,x)+`<div class="dt-type-card" style="left:${gt}px;top:${rt}px">${st.map(([At,$e])=>`<span class="dt-type-row"><b>${At}</b><span>${$e}</span></span>`).join("")}</div>`},Vt=E=>E.every(x=>x===E[0])?E[0]:E[1]===E[3]&&E[0]===E[2]?`${E[0]} ${E[1]}`:E.join(" "),Re=E=>/^rgba\(.*,\s*0\)$|^transparent$/.test(E),we=(E,x,H,q="")=>{let D=20+H.length*21,Et=x.bottom+D+12<innerHeight?x.bottom+8:Math.max(8,x.top-D-8),st=Math.min(Math.max(8,x.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${x.left}px;top:${x.top}px;width:${x.width}px;height:${x.height}px${q?`;border-radius:${q}`:""}"></span>`+w(E,x)+`<div class="dt-type-card dt-style-card" style="left:${st}px;top:${Et}px">${H.map(([et,rt])=>`<span class="dt-type-row"><b>${et}</b><span>${rt}</span></span>`).join("")}</div>`},N=E=>{let x=getComputedStyle(E),H=[];x.backgroundImage!=="none"&&H.push(["Fill",`<em>${/gradient/.test(x.backgroundImage)?"gradient":"image"}</em>`]),Re(x.backgroundColor)||H.push(["Fill",It(x.backgroundColor)+vt(E,"background-color",x.backgroundColor)]),E.textContent?.trim()&&H.push(["Text",It(x.color)+vt(E,"color",x.color)]),H.push(["Opacity",`${Math.round(Number(x.opacity)*100)}%`]),H.length||H.push(["Color","<em>no fill or text</em>"]),we(E,E.getBoundingClientRect(),H)},ft=E=>{let x=getComputedStyle(E),H=[],q=["top","right","bottom","left"],D=q.map(Et=>parseFloat(x.getPropertyValue(`border-${Et}-width`))||0);if(D.some(Et=>Et>0)){let Et=q.filter((et,rt)=>D[rt]>0);q.forEach((et,rt)=>H.push([et[0].toUpperCase()+et.slice(1),`${r(D[rt])} <em>${x.getPropertyValue(`border-${et}-style`)}</em>`]));let st=Et.map(et=>x.getPropertyValue(`border-${et}-color`));Et.forEach((et,rt)=>{rt&&st[rt]===st[0]||H.push([rt?`\u21B3 ${et}`:"Color",It(st[rt])+vt(E,`border-${et}-color`,st[rt])])})}else H.push(["Width","<em>none</em>"]);let ut=["top-left","top-right","bottom-right","bottom-left"].map(Et=>{let[st,et=st]=x.getPropertyValue(`border-${Et}-radius`).split(" "),rt=gt=>gt.endsWith("%")?gt:r(parseFloat(gt)||0);return st===et?rt(st):`${rt(st)}/${rt(et)}`});H.push(["Radius",Vt(ut)]),we(E,E.getBoundingClientRect(),H,x.borderRadius)},Rt=(E,x)=>{let[H,q]=[Qt(E),Qt(x)].sort((D,ut)=>ut-D);return(H+.05)/(q+.05)},jt=E=>"#"+E.slice(0,3).map(x=>Math.round(x).toString(16).padStart(2,"0")).join(""),ne=(E,x,H)=>{let[q,D,ut]=E.map(ke=>ke/255),Et=Math.max(q,D,ut),st=Math.min(q,D,ut),et=(Et+st)/2,rt=Et-st,gt=rt?rt/(1-Math.abs(2*et-1)):0,At=rt?Et===q?((D-ut)/rt%6+6)%6:Et===D?(ut-q)/rt+2:(q-D)/rt+4:0,$e=ke=>{let Gt=(1-Math.abs(2*ke-1))*gt,he=Gt*(1-Math.abs(At%2-1)),He=ke-Gt/2,[be,_e,Ms]=At<1?[Gt,he,0]:At<2?[he,Gt,0]:At<3?[0,Gt,he]:At<4?[0,he,Gt]:At<5?[he,0,Gt]:[Gt,0,he];return[be,_e,Ms].map(qn=>Math.min(255,Math.max(0,Math.round((qn+He)*255)))).concat([1])},je=Qt(E)>=Qt(x);for(let ke of je?[1,-1]:[-1,1]){let Gt=ke>0?1:0;if(Rt($e(Gt),x)<H)continue;let he=et,He=Gt;for(let be=0;be<20;be++){let _e=(he+He)/2;Rt($e(_e),x)>=H?He=_e:he=_e}return $e(He)}return null},$={half:'<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><circle cx="6" cy="6" r="4.5" fill="none" stroke="currentColor" stroke-width="0.9"/><path d="M6 1.5a4.5 4.5 0 0 1 0 9z" fill="currentColor"/></svg>',x:'<svg class="dt-ct-no" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M3 3l5 5M8 3l-5 5" stroke="currentColor" stroke-width="1.1" stroke-linecap="round"/></svg>',ok:'<svg class="dt-ct-ok" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M2.2 5.8 4.4 8l4.4-5" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"/></svg>',copy:'<svg viewBox="0 0 11 11" width="11" height="11" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="0.9"><rect x="4" y="4" width="6" height="6" rx="1.2"/><path d="M7 2.5V2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h.5"/></svg>'},M=E=>`${E.toFixed(1).replace(/\.0$/,"")} : 1`,L="",V=null,U=!1,G=E=>{E!==V&&(V=E,U=!1),L="";let x=E.getBoundingClientRect(),H=(E instanceof HTMLInputElement||E instanceof HTMLTextAreaElement)&&!E.value&&!!E.placeholder,q=getComputedStyle(E,H?"::placeholder":null),D=parseFloat(q.fontSize),ut=D>=24||D>=18.66&&Number(q.fontWeight)>=700,Et=fe(E),st=gt=>`<i class="dt-type-sw" style="background:${gt}"></i>`,et;if(!E.textContent?.trim()&&!H&&!(E instanceof HTMLInputElement&&E.value))et='<p class="dt-ct-note">Point at some text.</p>';else if(!Et)et='<p class="dt-ct-note">It sits on an image or a gradient: there is no one colour behind it to measure.</p>';else{let gt=pe(Lt(q.color),Et),At=Rt(gt,Et),$e=ut?3:4.5,je=At>=7?["ok",$.ok+"AAA"]:At>=4.5?["ok",$.ok+"AA"]:At>=3?["warn","Large text only"]:["bad","Fails"],ke=`<div class="dt-ct-ratio"><b>${M(At)}</b><span class="dt-ct-chip dt-ct-chip--${je[0]}">${je[1]}</span></div>`;if(At>=7){et=ke,n.innerHTML=C(x)+w(E,x,H?" \xB7 placeholder":"")+_t(x,41,`<div class="dt-ct-card dt-ct-card--one">${et}</div>`);return}let Gt=(He,be)=>`<div class="dt-ct-check">${At>=be?$.ok:$.x}<span>${He}</span><em>${M(be).replace(".0","")}</em></div>`,he=At>=$e?null:ne(gt,Et,$e);he&&(L=jt(he)),et=`<div class="dt-ct-pair"><div><span>Text</span><b>${st(jt(gt))}${jt(gt)}</b></div><div><span>Background</span><b>${st(jt(Et))}${jt(Et)}</b></div></div>`+ke+Gt("Body text \xB7 AA",4.5)+Gt("Large text \xB7 AA",3)+Gt("Body text \xB7 AAA",7)+(L?U?`<div class="dt-ct-fix dt-ct-fix--done">${$.ok}<span>Copied ${L}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${st(L)}${L}</b>${$.copy}</div>`:"")}let rt=`<div class="dt-ct-card"><div class="dt-ct-head">${$.half}<span>Contrast</span></div>${et}</div>`;n.innerHTML=C(x)+w(E,x,H?" \xB7 placeholder":"")+_t(x,210,rt)},_t=(E,x,H)=>{let q=E.bottom+x+12<innerHeight?E.bottom+8:Math.max(8,E.top-x-8),D=Math.min(Math.max(8,E.left),innerWidth-260);return H.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${D}px;top:${q}px"`)};return{spacer:y,drawPads:A,drawSize:k,drawType:Ln,drawColor:N,drawBorder:ft,drawContrast:G,contrastFix:()=>L,markCopied:()=>{U=!0}}}var re=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),iu=(n,r,c=!1)=>{for(let h=r*4;;h*=4){let g=c?re(n.slice(0,h)).replace(/\s+/g," "):re(n.slice(0,h));if(g.length>=r||h>=n.length)return g}},Ys=(n,r,c=!1)=>Jt(iu(n,r,c),r),ru='[class^="dt-"],[class*=" dt-"],.devtools',In=n=>{let r=n;for(;r.parentElement&&r.parentElement!==document.body;)r=r.parentElement;return r.parentElement===document.body&&r.matches(ru)},Po=()=>{let n=null;return(r,c)=>(n||(n=new WeakMap,queueMicrotask(()=>{n=null})),n.has(r)||n.set(r,c()),n.get(r))},dh=()=>{let n=null;return(r,c)=>(n||(n=new Map,queueMicrotask(()=>{n=null})),n.has(r)||n.set(r,c()),n.get(r))};function lu(){let n=Po(),r=($,M)=>{if(!$)return[];let L=M.toUpperCase(),V=n($,()=>new Map),U=V.get(L);return U||V.set(L,U=[...$.children].filter(G=>G.tagName.toUpperCase()===L&&!($===document.body&&G.matches(ru)))),U},c=$=>{let M=[],L=$;for(;L&&L.tagName!=="HTML"&&M.length<8;){if(L.id){M.unshift("#"+CSS.escape(L.id));break}let V=L.parentElement,U=L.tagName.toLowerCase(),G=r(V,L.tagName),_t=V===document.body&&G.length>1?[...L.classList].find(se=>/^[\w-]+$/.test(se)&&G.filter(Dt=>Dt.classList.contains(se)).length===1):void 0;M.unshift(_t?`${U}.${_t}`:G.length>1?`${U}:nth-of-type(${G.indexOf(L)+1})`:U),L=V}return M.join(">")},h=$=>{let M=$.split(">"),L=null;for(let[V,U]of M.entries()){if(U.startsWith("#")){if(V)return null;L=document.querySelector(U);continue}let G=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec(U);if(!G)return document.querySelector($);if(!L){if(G[1]!=="body"||G[2]||G[3])return document.querySelector($);L=document.body;continue}let _t=r(L,G[1].toUpperCase());if(L=(G[2]?_t.find(se=>se.classList.contains(G[2])):_t[G[3]?Number(G[3])-1:0])??null,!L)return null}return L},g=$=>$.replace(/\s+/g," ").trim(),y=Po(),T=($,M)=>{if(!M)return!0;let[L,V]=y($,()=>{let G=iu($.textContent||"",60);return[g(Jt(G,60)),g(G.slice(0,60))]}),U=g(M);return L===U||V===U},C=($,M)=>[$||"*",...(M||[]).map(L=>"."+CSS.escape(L))].join(""),w=dh(),A=$=>{let M=C($.tag,$.classes);return w(M,()=>{try{return[...document.querySelectorAll(M)].filter(L=>!In(L))}catch{return[]}})},k=$=>{for(let M of $.classes??[]){let L=A({tag:$.tag,classes:[M]});if(L.length)return L}return A({tag:$.tag}).slice(0,400)},z=80,dt=Po(),J=$=>dt($,()=>tt($)),tt=$=>{let M=$.textContent||"",L=null;for(let V=$.parentElement,U=0;V&&V!==document.body&&U<4;V=V.parentElement,U++){let G=V.textContent||"";if(G===M)continue;let _t=Ys(G,z,!0);if(_t&&(_t!==Ys(M,z,!0)||(L??=re(M).replace(/\s+/g," "),re(G).replace(/\s+/g," ")!==L)))return _t}return""},F=$=>J($),xt=($,M,L=120)=>Jt(re($.getAttribute(M)),L)||void 0,Wt=Po(),St=$=>Wt($,()=>at($)),at=$=>{for(let M=$.parentElement,L=0;M&&M!==document.body&&L<4;M=M.parentElement,L++){let V=M.querySelector("h1,h2,h3,h4,h5,h6,[role=heading]");if(V&&V!==$&&!$.contains(V))return Ys(V.textContent||"",60,!0)||void 0}},vt=Po(),It=$=>vt($,()=>qt($)),qt=$=>{let M=L=>L?Ys(L.textContent||"",30,!0):"";return(M($.previousElementSibling)+"|"+M($.nextElementSibling)).replace(/^\|$/,"")||void 0},Lt=/^data-(testid|test-id|test|qa|cy|id|key|slug|name|item)$/,pe=$=>{let M=[...$.attributes].find(V=>Lt.test(V.name)&&V.value),L=($.getAttribute("src")||$.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)||void 0;return Object.fromEntries(Object.entries({id:$.id?Jt($.id,80):void 0,data:M?`${M.name}=${Jt(M.value,80)}`:void 0,aria:xt($,"aria-label"),alt:xt($,"alt"),title:xt($,"title"),src:L,href:xt($,"href"),head:St($),sib:It($)}).filter(([,V])=>V))},fe=($,M)=>!M||J($).startsWith(M),Qt=new WeakMap,me=$=>Qt.get($)??"found",Ln=$=>{let M=$.fp,L=null;try{L=h($.selector)}catch{}let V=A($),U=V.length?V:k($),G=new Set(U.slice(0,400));if(L&&!In(L)&&G.add(L),M.id){let E=document.getElementById(M.id);E&&G.add(E)}if(M.data){let[E,x]=M.data.split(/=(.*)/s);try{document.querySelectorAll(`[${E}="${CSS.escape(x)}"]`).forEach(H=>G.add(H))}catch{}}let _t=null,se=null,Dt=0;for(let E of G){if(In(E))continue;let x=M.id&&E.id===M.id||M.data&&E.getAttribute(M.data.split("=")[0])===M.data.split(/=(.*)/s)[1]?35:0,H=re($.label)&&T(E,$.label)||M.aria&&xt(E,"aria-label")===M.aria||M.alt&&xt(E,"alt")===M.alt||M.title&&xt(E,"title")===M.title||M.href&&xt(E,"href")===M.href||M.src&&(E.getAttribute("src")||E.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)===M.src?25:0,q=M.head&&St(E)===M.head||M.sib&&It(E)===M.sib||$.ctx&&J(E).startsWith($.ctx)?15:0,D=x+H+q,ut=D+(E===L?40:0)+($.nth!=null&&U[$.nth]===E?5:0);D||(ut=Math.min(ut,39)),H&&(Dt++,se={el:E,score:ut}),(!_t||ut>_t.score)&&(_t={el:E,score:ut})}return se&&Dt===1&&se.score<40&&(!_t||_t.score<40)?{el:se.el,score:40}:_t},Vt=$=>{let M=Re($),L=null;if(M){try{L=h($.selector)}catch{}return Qt.set($,M===L?"found":"moved"),M}let V=$.fp?Ln($):null;return V&&V.score>=40?(Qt.set($,V.score>=70?"moved":"probably"),V.el):(Qt.set($,"gone"),null)},Re=$=>{let M=null;try{M=h($.selector)}catch{M=null}if(M&&In(M)&&(M=null),M&&T(M,$.label)&&fe(M,$.ctx))return M;let L=A($),V=L.length?L:k($),U=re($.label)?V.filter(Dt=>T(Dt,$.label)):[],G=($.ctx?U.find(Dt=>fe(Dt,$.ctx)):U.length===1?U[0]:void 0)??($.ctx&&!re($.label)?L.find(Dt=>fe(Dt,$.ctx)):void 0);if(G)return G;if($.ctx&&U.length===1&&g(re($.label)).length>=20)return U[0];let _t=Dt=>Dt.split(">").slice(0,2).join(">"),se=Dt=>!$.ctx&&_t(c(Dt))===_t($.selector);return re($.label)?M&&!$.ctx&&T(M,$.label)?M:U.length===1&&se(U[0])?U[0]:null:M||($.nth!=null?L[$.nth]??null:null)},we=$=>{let M=null;for(let L=$,V=$.parentElement;V&&V!==document.body&&getComputedStyle(L).position!=="fixed";L=V,V=V.parentElement){let U=getComputedStyle(V);if(U.overflowX==="visible"&&U.overflowY==="visible")continue;let G=V.getBoundingClientRect();M=M?{l:Math.max(M.l,G.left),t:Math.max(M.t,G.top),r:Math.min(M.r,G.right),b:Math.min(M.b,G.bottom)}:{l:G.left,t:G.top,r:G.right,b:G.bottom}}return M},N=$=>{let M=$.getBoundingClientRect();return(M.width>0||M.height>0)&&(!$.checkVisibility||$.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},ft=$=>({...$,x:Math.min(Math.max($.x,3),document.documentElement.clientWidth-30),y:$.y>=0&&$.y<19?19:$.y}),Rt=($,M)=>{let L=M;for(let V=M.parentElement;V&&V!==document.body;V=V.parentElement){if(!N(V)){L=V;continue}let U=M.getBoundingClientRect();if(U.width||U.height)return ft({x:U.left+U.width*$.rx,y:U.top+U.height*$.ry,el:M,hidden:V,shut:L});let G=V.getBoundingClientRect();return ft({x:G.left,y:G.top,el:M,hidden:V,shut:L})}return null},jt=$=>{let M=$.opener?Re($.opener):null;if(!M||!N(M))return null;let L=M.getBoundingClientRect();return ft({x:L.right-4,y:L.top+4,el:M,opener:M})};return{cssPath:c,poolOf:A,contextOf:F,resolveEl:Vt,anchorOf:($,M=Vt($))=>{if(!M)return jt($);if(!N(M))return jt($)??Rt($,M);let L=M.getBoundingClientRect(),V=L.left+L.width*$.rx,U=L.top+L.height*$.ry,G=we(M);return G?V<G.l||V>G.r||U<G.t||U>G.b?null:{x:V,y:U,el:M}:{x:V,y:U,el:M}},anchorState:me,fingerprintOf:pe}}var du=(n,r)=>`<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?r:"#fff"}" stroke="none"${c<n?"":' opacity="0.12"'}/>`).join("")}</svg>`;function cu(n,r,c){let h=document.createElement("div");h.className="dt-field-menu",h.setAttribute("role","listbox"),h.hidden=!0,document.body.append(h);for(let T of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])h.addEventListener(T,C=>C.stopPropagation());let g=null,y=()=>{h.hidden=!0,g=null};for(let T of n)T.addEventListener("mousedown",C=>{let w=C.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select");if(!w){h.contains(C.target)||y();return}if(C.preventDefault(),g===w){y();return}g=w;let A=w.classList.contains("dt-more-select"),k=F=>A?F.dataset.on!=null:F.selected,z=w.dataset.search;h.innerHTML=(z?`<label class="dt-field-search"><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg><input type="search" placeholder="${r(z)}" aria-label="${r(z)}" spellcheck="false"></label>`:"")+[...w.options].map((F,xt)=>F.hidden?"":F.dataset.head!=null?`<p class="dt-field-head">${r(F.text)}${F.dataset.note?`<small>${r(F.dataset.note)}</small>`:""}</p>`:`${F.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${xt}" aria-selected="${k(F)}"${F.disabled?" disabled":""}${F.dataset.hint?` data-tip="${r(F.dataset.hint)}" data-hint="${r(F.dataset.hint.toLowerCase())}"`:""}${F.dataset.danger!=null?' class="is-danger"':""}>${F.dataset.icon?F.dataset.icon:F.dataset.initial!=null?F.dataset.face?`<img class="dt-face" src="${r(F.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${r(F.dataset.initial)}</b>`:F.dataset.bare!=null?"":`<i style="background:${r(F.dataset.c||"#717171")}"></i>`}<span>${r(F.text)}</span>${F.dataset.note?`<small>${r(F.dataset.note)}</small>`:""}${k(F)?c:""}</button>${F.dataset.sepAfter!=null?"<hr>":""}`).join("")+(z?'<p class="dt-field-none" hidden></p>':""),h.classList.toggle("is-people",!!z);let dt=w.parentElement.getBoundingClientRect(),J=z?w.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;h.style.left=`${J?J.left+4:dt.left}px`,h.style.top=`${dt.bottom+4}px`,h.style.minWidth=`${J?J.width-8:Math.max(200,dt.width)}px`,h.style.width=J?`${J.width-8}px`:"",h.hidden=!1;for(let F of h.querySelectorAll("[data-hint]")){let xt=F.querySelector("span");xt.scrollWidth>xt.clientWidth&&(F.dataset.tip=`${xt.textContent} \xB7 ${F.dataset.tip}`)}let tt=h.getBoundingClientRect();(tt.bottom>innerHeight-8||z&&w.closest(".dt-note"))&&(h.style.top=`${Math.max(8,dt.top-4-tt.height)}px`),tt.right>innerWidth-8&&(h.style.left=`${Math.max(8,dt.right-tt.width)}px`),h.querySelector(".dt-field-search input")?.focus()});h.addEventListener("input",T=>{let C=T.target.value.trim().toLowerCase(),w=0;for(let k of h.querySelectorAll("[data-i]"))k.hidden=!!C&&!k.textContent.toLowerCase().includes(C)&&!k.dataset.hint?.includes(C),k.hidden||w++;for(let k of h.querySelectorAll("hr"))k.hidden=!!C;let A=h.querySelector(".dt-field-none");A&&(A.hidden=w>0,A.textContent=`No one matches \xAB${T.target.value.trim()}\xBB`)}),h.addEventListener("keydown",T=>{T.key!=="Enter"||!T.target.matches("input")||(T.preventDefault(),h.querySelector("[data-i]:not([hidden])")?.click())}),h.addEventListener("click",T=>{let C=T.target.closest("[data-i]");if(!C||!g)return;let w=g;y(),!(w.selectedIndex===Number(C.dataset.i)&&!w.classList.contains("dt-more-select"))&&(w.selectedIndex=Number(C.dataset.i),w.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",T=>{T.key==="Escape"&&!h.hidden&&(T.stopPropagation(),y())},!0),document.addEventListener("pointerdown",T=>{!h.hidden&&!h.contains(T.target)&&!T.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select")&&y()},!0),addEventListener("scroll",T=>{h.contains(T.target)||y()},!0)}var ns=()=>!matchMedia("(prefers-reduced-motion: reduce)").matches,On=n=>Promise.allSettled(n.getAnimations({subtree:!0}).filter(r=>r.effect?.getComputedTiming().iterations!==1/0).map(r=>r.finished)),Io=new WeakMap,ss=(n,r)=>{let c=Io.has(n);Io.set(n,r),!c&&(n.setAttribute("data-leaving",""),On(n).then(()=>{let h=Io.get(n);h&&(Io.delete(n),n.removeAttribute("data-leaving"),h())}))},Oo=n=>{Io.delete(n),n.removeAttribute("data-leaving")},uu=n=>{let r=n.cloneNode(!0);for(let c of["id","data-id","data-draft","data-parked"])r.removeAttribute(c);r.setAttribute("data-ghost",""),r.setAttribute("aria-hidden","true"),r.inert=!0,n.after(r),On(r).then(()=>r.remove())},qo=(n,r)=>{n.removeAttribute("data-nudge"),n.offsetWidth,n.setAttribute("data-nudge",r),On(n).then(()=>{n.getAttribute("data-nudge")===r&&n.removeAttribute("data-nudge")})},pu=n=>{let r=getComputedStyle(document.documentElement).getPropertyValue(n).trim(),c=r.indexOf(" ");return{duration:parseFloat(r)*(/^[\d.]+s$/.test(r.slice(0,c))?1e3:1),easing:r.slice(c+1)}},Ka=(n,r,c=1/0)=>{let h=n.hidden?0:Math.min(n.offsetHeight,c),g=n.hidden?"0":getComputedStyle(n).opacity;n.getAnimations().forEach(w=>w.cancel()),n.hidden=!1;let y=r?Math.min(n.scrollHeight,c):0,T=()=>{n.hidden=!r};if(!ns()||h===y)return T();let C=n.animate([{height:`${h}px`,opacity:g,overflow:"hidden"},{height:`${y}px`,opacity:r?1:0,overflow:"hidden"}],{...pu(r?"--dt-smooth":"--dt-snappy"),fill:"forwards"});C.onfinish=()=>{T(),C.cancel()}},Or=(n,r,c,h,g)=>{if(n.getAnimations().forEach(T=>T.cancel()),!ns()||Math.abs(r-c)<1)return g();let y=n.animate([{height:`${r}px`,overflow:"hidden"},{height:`${c}px`,overflow:"hidden"}],{...pu(h?"--dt-smooth":"--dt-snappy"),fill:"forwards"});y.onfinish=()=>{g(),y.cancel()}};var ch=".devtools, [class^='dt-'], [class*=' dt-']",uh=300,mu=null,hu=n=>{mu=n};function gu(){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,c,h=0,g=A=>{let k=A.getAttribute("title");k!==null&&(A.removeAttribute("title"),A.hasAttribute("data-tip")||A.setAttribute("data-tip",k),!A.hasAttribute("aria-label")&&!A.textContent?.trim()&&A.setAttribute("aria-label",k))},y=A=>{let k=A?.closest?.("[data-tip], [title]");return k&&k.closest(ch)&&!k.closest(".dt-tipbox")?k:null},T=A=>{let k=A.getAttribute("data-tip");if(!k||A.getAttribute("aria-expanded")==="true")return C();let z=mu?.(A);n.classList.toggle("is-peek",!!z),z?n.innerHTML=z:n.textContent=k,Oo(n),n.hidden=!1,n.style.left="0px",n.style.top="0px";let dt=A.getBoundingClientRect(),J=n.getBoundingClientRect(),tt=6,F=8;if(z){let Wt=dt.right+8+J.width<=innerWidth-F;n.style.left=`${Wt?dt.right+8:Math.max(F,dt.left-8-J.width)}px`,n.style.top=`${Math.min(Math.max(F,dt.top-4),innerHeight-F-J.height)}px`,A.setAttribute("aria-describedby",n.id);return}let xt=dt.bottom+tt+J.height<=innerHeight-F;n.style.top=`${xt?dt.bottom+tt:Math.max(F,dt.top-tt-J.height)}px`,n.style.left=`${Math.min(Math.max(F,dt.left+dt.width/2-J.width/2),innerWidth-F-J.width)}px`,n.classList.toggle("is-mono",A.classList.contains("dt-note-el")),A.setAttribute("aria-describedby",n.id)},C=()=>{clearTimeout(c),r&&!n.hidden&&(h=performance.now()+400),r?.removeAttribute("aria-describedby"),r=null,n.hidden||ss(n,()=>{n.hidden=!0})},w=A=>{A!==r&&(C(),g(A),r=A,performance.now()<h?T(A):c=setTimeout(()=>r===A&&T(A),uh))};document.addEventListener("pointerover",A=>{let k=y(A.target);k?w(k):r&&!r.contains(A.target)&&C()},!0),document.addEventListener("pointerout",A=>{r&&!r.contains(A.relatedTarget)&&C()},!0),document.addEventListener("focusin",A=>{let k=A.target,z=y(k);z&&k.matches(":focus-visible")&&w(z)},!0),document.addEventListener("focusout",C,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("keydown",A=>{A.key==="Escape"&&C()},!0),addEventListener("scroll",C,!0),new MutationObserver(()=>{r&&(!r.isConnected||r.getAttribute("aria-expanded")==="true")&&C()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-expanded"]})}var ht={signal:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><rect x="1" y="12" width="3.2" height="5" rx="1"/><rect x="5.6" y="9" width="3.2" height="8" rx="1"/><rect x="10.2" y="6" width="3.2" height="11" rx="1"/><rect x="14.8" y="3" width="3.2" height="14" rx="1"/></svg>',wifi:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><path d="M10 16.6 7.4 13.8a3.7 3.7 0 0 1 5.2 0z"/><path d="M4.8 11.1a7.4 7.4 0 0 1 10.4 0l-1.3 1.4a5.5 5.5 0 0 0-7.8 0z"/><path d="M2.2 8.3a11.1 11.1 0 0 1 15.6 0l-1.3 1.4a9.2 9.2 0 0 0-13 0z"/></svg>',battery:'<svg viewBox="0 0 28 14" class="dt-i dt-i--batt"><rect x="1" y="1" width="23" height="12" rx="3.5" fill="none" stroke="currentColor" stroke-opacity=".4"/><rect x="3" y="3" width="17" height="8" rx="2" fill="currentColor"/><path d="M26 5v4a2 2 0 0 0 0-4z" fill="currentColor" fill-opacity=".4"/></svg>',back:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4 6.5 10l6 6"/></svg>',fwd:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M7.5 4l6 6-6 6"/></svg>',reload:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9"/><path d="M14.2 3.2v3.2H11"/></svg>',dots:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="4.5" cy="10" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="15.5" cy="10" r="1.6"/></svg>',dotsV:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="4.5" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="10" cy="15.5" r="1.6"/></svg>',share:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 12.5V2.8M6.8 5.8 10 2.6l3.2 3.2"/><path d="M6.5 8.5H5a1.5 1.5 0 0 0-1.5 1.5v6A1.5 1.5 0 0 0 5 17.5h10a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 15 8.5h-1.5"/></svg>',plus:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 4v12M4 10h12"/></svg>',tabs:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="3" y="6" width="11" height="11" rx="2"/><path d="M6 3.5h8.5A2.5 2.5 0 0 1 17 6v8.5"/></svg>',sidebar:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="2.5" y="4" width="15" height="12" rx="2"/><path d="M8 4v12"/></svg>',lock:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="9" width="10" height="8" rx="1.8"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/></svg>',tune:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3 6.5h8M15 6.5h2M3 13.5h2M9 13.5h8"/><circle cx="13" cy="6.5" r="2"/><circle cx="7" cy="13.5" r="2"/></svg>',star:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m10 3 2.1 4.4 4.8.6-3.5 3.3.9 4.7L10 13.7 5.7 16l.9-4.7L3.1 8l4.8-.6z" stroke-linejoin="round"/></svg>',user:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="10" r="8" fill-opacity=".25"/><circle cx="10" cy="8" r="3"/><path d="M4.8 15.3a6 6 0 0 1 10.4 0 7.9 7.9 0 0 1-10.4 0z"/></svg>',recent:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5.5 5v10M10 5v10M14.5 5v10"/></svg>',home:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="4.5" y="4.5" width="11" height="11" rx="3.5"/></svg>',navBack:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4.5 7 10l5.5 5.5"/></svg>',close:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m5.5 5.5 9 9m0-9-9 9"/></svg>',winMin:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5 10h10"/></svg>',winMax:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="5" width="10" height="10" rx="1.5"/></svg>',chevUp:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m6 12 4-4 4 4"/></svg>',volume:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3.5 8v4h3l4 3.5v-11l-4 3.5z" stroke-linejoin="round"/><path d="M13.5 7.5a3.5 3.5 0 0 1 0 5"/></svg>'},qr=(n,r)=>n.toLocaleTimeString("en-US",r),Ua=n=>qr(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),ph={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 mh(n,r,c,h,g){let y=n.w+2*r.side,T=n.h+r.top+r.bottom,C=(c-y)/2,w=`<rect class="dt-shell-screen" x="${g}" y="${r.top}" width="${n.w}" height="${n.h}" rx="${r.r}"/>`,A="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let k=(z,dt,J)=>`<rect class="dt-shell-btn" x="${z}" y="${dt}" width="4" height="${J}" rx="2"/>`;A+=n.shell==="punch"?k(C+y-1,150,70)+k(C+y-1,240,44):k(C-3,120,28)+k(C-3,170,56)+k(C-3,236,56)+k(C+y-1,190,90),A+=`<rect class="dt-shell-body" x="${C}" y="0" width="${y}" height="${T}" rx="${r.body}"/>`,A+=`<rect class="dt-shell-bezel" x="${C+3}" y="3" width="${y-6}" height="${T-6}" rx="${r.body-3}"/>`,n.shell==="home"&&(A+=`<rect class="dt-shell-slot" x="${c/2-26}" y="44" width="52" height="6" rx="3"/>`,A+=`<circle class="dt-shell-slot" cx="${c/2-48}" cy="47" r="5"/>`,A+=`<circle class="dt-shell-homebtn" cx="${c/2}" cy="${T-46}" r="28"/>`)}else if(n.shell==="tablet")A+=`<rect class="dt-shell-body dt-shell-body--light" x="${C}" y="0" width="${y}" height="${T}" rx="${r.body}"/>`,A+=`<rect class="dt-shell-bezel" x="${C+4}" y="4" width="${y-8}" height="${T-8}" rx="${r.body-4}"/>`;else if(n.shell==="monitor"){let k=Math.round(y*.1);A+=`<path class="dt-shell-stand" d="M${c/2-k/2} ${T-2}h${k}l${k*.2} 84h${-k*1.4}z"/>`,A+=`<rect class="dt-shell-stand" x="${c/2-y*.15}" y="${T+80}" width="${y*.3}" height="14" rx="7"/>`,A+=`<rect class="dt-shell-body" x="${C}" y="0" width="${y}" height="${T}" rx="${r.body}"/>`}else{let k=y+(r.extraW??0),z=(c-k)/2,dt=r.extraH??16;A+=`<path class="dt-shell-body" d="M${C} ${r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${-r.body}h${y-2*r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${r.body}V${T}H${C}z"/>`,A+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${z} ${T}h${k}v${dt-8}a8 8 0 0 1-8 8H${z+8}a8 8 0 0 1-8-8z"/>`,A+=`<rect class="dt-shell-lip" x="${c/2-y*.07}" y="${T}" width="${y*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${c} ${h}" width="${c}" height="${h}" aria-hidden="true">${A}${w}</svg>`}var hh={"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})},gh=({d:n,now:r,cutout:c},h)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${h}px"><span class="dt-sb-l">${ht.signal}${ht.wifi}</span><b>${Ua(r)}</b><span class="dt-sb-r">${ht.battery}</span></div>`;let g=c??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${h}px"><span class="dt-island" style="left:${g.x}px;top:${g.y}px;width:${g.width}px;height:${g.height}px"></span><b class="dt-sb-time" style="top:${g.y}px;height:${g.height}px">${Ua(r)}</b><span class="dt-sb-icons" style="top:${g.y}px;height:${g.height}px">${ht.signal}${ht.wifi}${ht.battery}</span></div>`},fh=({d:n,host:r,min:c},h)=>{let g=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return c?`<div class="dt-ios-bar is-min" style="height:${h}px"><span class="dt-ios-mini">${f(r)}</span>${g}</div>`:`<div class="dt-ios-bar" style="height:${h}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${ht.back}</button><span class="dt-glass dt-ios-url"><span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-glass dt-glass--round">${ht.dots}</span></div>${g}</div>`},bh=({now:n,min:r},c)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${qr(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${ht.wifi}${ht.signal}${ht.battery}</span></div>`+(r?"":`<div class="dt-and-bar"><span class="dt-and-url">${ht.tune}<span>${f(c)}</span></span><span class="dt-and-tabs">1</span>${ht.dotsV}</div>`),yh=()=>`<div class="dt-and-nav">${ht.recent}${ht.home}${ht.navBack}</div>`,vh=({now:n,host:r})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Ua(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${ht.wifi}${ht.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${ht.sidebar}<button data-nav="back" aria-label="Back" title="Back">${ht.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ht.fwd}</button></span><span class="dt-ipad-url">${ht.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-bar-group">${ht.share}${ht.plus}${ht.tabs}</span></div>`,wh=({now:n,host:r},c)=>'<div class="dt-mac-menu"><span class="dt-mac-apps"><b>Safari</b><span>File</span><span>Edit</span><span>View</span><span>History</span><span>Bookmarks</span><span>Window</span><span>Help</span></span>'+(c?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${ht.wifi}${ht.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${Ua(n)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${ht.sidebar}<button data-nav="back" aria-label="Back" title="Back">${ht.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ht.fwd}</button></span><span class="dt-mac-url">${ht.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-bar-group">${ht.share}${ht.plus}${ht.tabs}</span></div>`,$h=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,r)=>`<i style="--hue:${r*40}"></i>`).join("")}</span></div>`,xh=({host:n,title:r})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${f(r||n)}</span>${ht.close}</span><span class="dt-win-new">${ht.plus}</span><span class="dt-win-ctrl">${ht.winMin}${ht.winMax}${ht.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${ht.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${ht.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${ht.reload}</button></span><span class="dt-win-url">${ht.tune}<span>${f(n)}</span>${ht.star}</span><span class="dt-bar-group">${ht.user}${ht.dotsV}</span></div>`,Eh=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(r,c)=>`<i style="--hue:${200+c*30}"></i>`).join("")}</span><span class="dt-win-tray">${ht.chevUp}${ht.wifi}${ht.volume}${ht.battery}<span class="dt-win-clock">${qr(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function fu(n,r){let c=ph[n.shell](n),h=n.w+2*c.side,g=n.h+c.top+c.bottom,y=h+(c.extraW??0),T=g+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?c.extraH??0:0),C=(y-h)/2+c.side,w=hh[n.browser](n),A=r.min?w.topMin??w.top:w.top,k=r.min?w.bottomMin??w.bottom:w.bottom,z={...r,d:n},dt="",J="";switch(n.browser){case"safari-ios":dt=gh(z,A),J=fh(z,k);break;case"chrome-android":dt=bh(z,r.host),J=yh();break;case"safari-ipad":dt=vh(z),J='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":dt=wh(z,n.shell==="macbook"),J=$h();break;case"chrome-windows":dt=xh(z),J=Eh(z);break}return{footprint:{w:y,h:T},screen:{x:C,y:c.top,w:n.w,h:n.h,r:c.r,rb:c.rb??c.r},topH:A,bottomH:k,shell:mh(n,c,y,T,C),top:dt,bottom:J,canMinimize:w.topMin!==void 0&&(w.topMin!==w.top||w.bottomMin!==w.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var xs=null;function Fo(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[r,c,h,g]=xs.getImageData(0,0,1,1).data;return[r,c,h,g/255]}var Do=([n,r,c])=>`rgb(${n}, ${r}, ${c})`;function bu(n){let r=n.defaultView,c=J=>!J||Fo(J)[3]===0,h=[n.body,n.documentElement].map(J=>J&&r.getComputedStyle(J).backgroundColor).find(J=>J&&!c(J)),[g,y,T,C]=h?Fo(h):[255,255,255,1],w=[g,y,T].map(J=>Math.round(J*C+255*(1-C))),A=J=>{let[tt,F,xt,Wt]=Fo(J);if(Wt>=.75)return Do([tt,F,xt]);let St=(at,vt)=>Math.round(at*Wt+vt*(1-Wt));return Do([St(tt,w[0]),St(F,w[1]),St(xt,w[2])])},k=J=>{let tt=n.elementFromPoint(r.innerWidth/2,J);for(;tt&&tt!==n.documentElement;tt=tt.parentElement){let F=r.getComputedStyle(tt);if(F.position!=="fixed"&&F.position!=="sticky")continue;let xt=tt.getBoundingClientRect().width>=r.innerWidth*.9,Wt=F.backdropFilter&&F.backdropFilter!=="none";return xt&&!Wt&&!c(F.backgroundColor)?A(F.backgroundColor):null}return null},z=n.querySelector('meta[name="theme-color"]')?.content||"",dt=z&&!c(z)?Do(Fo(z)):"";return{top:k(4)??Do(w),bottom:k(r.innerHeight-4)??Do(w),theme:dt}}function Dr(n){let[r,c,h]=Fo(n).map(g=>g/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4);return .2126*r+.7152*c+.0722*h>.4?"#000":"#fff"}function yu(n){let{cfg:r,inFrame:c,persist:h,frame:g,frameEl:y,devicesMenu:T,bpBtns:C,notesOverlay:w,WIDE:A,bpOf:k,currentBp:z,deviceById:dt,notesOn:J,filter:tt,filterTo:F,dropFrameDrafts:xt,putAway:Wt,tellFrame:St,syncBpButtons:at,render:vt,reread:It}=n,qt=r.breakpoints,Lt=document.querySelector(".dt-device"),pe=document.querySelector(".dt-shell"),fe=document.querySelector('.dt-chrome[data-at="top"]'),Qt=document.querySelector('.dt-chrome[data-at="bottom"]'),me=document.querySelector(".dt-ruler"),Ln=[...document.querySelectorAll(".dt-frame-handle")],Vt=document.querySelector(".dt-frame-size"),Re=document.querySelector(".dt-frame-rotate"),we=document.querySelector(".dt-frame-bars"),N="overlay",ft="",Rt="dt-w",jt="dt-canvas",ne="dt-device",$=ct.getItem(jt)==="1",M=ct.getItem(ne)||"";M&&!dt(M)&&(M="",ct.setItem(ne,""));let L=Number(ct.getItem(Rt))||0,V="dt-emu",U=(()=>{try{return JSON.parse(ct.getItem(V)||"null")}catch{return null}})(),G=()=>U?Bo.find(R=>R.id===U.id)??null:null,_t=()=>{let R=G();return R?U.turned?{w:R.h,h:R.w}:{w:R.w,h:R.h}:null},se=ct.getItem("dt-bars-min")==="1",Dt=R=>{U=R,h(V,R?JSON.stringify(R):"")},E=R=>{Vt.textContent=R,g.style.setProperty("--dt-badge-w",`${Vt.offsetWidth}px`)},x=R=>{if(!R){me.innerHTML="";return}let O="";for(let Y=0;Y<=R;Y+=50)O+=`<span class="dt-tick${Y%200===0?" is-major":""}" style="left:${Y}px"></span>`;for(let Y of qt)for(let Nt of[Y.min,Y.max])Nt>0&&Number.isFinite(Nt)&&Nt<=R&&(O+=`<span class="dt-edge" style="left:${Nt}px" title="${Y.label} edge"></span>`);me.innerHTML=O,me.style.width=`${R}px`},H=()=>{let R=parseFloat(Lt.style.width)||0,O=parseFloat(Lt.style.height)||0;if(!R||!O){Lt.style.transform="",delete Lt.dataset.scaled;return}let Y=M||U?Math.min(1,(innerWidth-80)/R,(innerHeight-120)/O):Math.min(1,(innerWidth-80)/R);Lt.style.transform=Y<1?`scale(${Y})`:"",Lt.dataset.scaled=Y<1?String(Math.round(Y*100)):""},q=R=>Bo.find(O=>O.w===R.w&&O.h===R.h&&O.cutout?.shape==="pill")?.cutout,D=()=>{try{return y.contentDocument}catch{return null}},ut=()=>D()?.title.split("\u2014").pop()?.trim()||"",Et=()=>{let R=D(),O=M?dt(M):null;if(!R?.body||!O)return;let Y=bu(R),Nt=O.browser==="chrome-android"?Y.theme||"rgb(255, 255, 255)":Y.top,Kt=O.browser==="chrome-android"?"rgb(255, 255, 255)":Y.bottom;Lt.style.setProperty("--dt-top",Nt),Lt.style.setProperty("--dt-top-ink",Dr(Nt)),Lt.style.setProperty("--dt-bottom",Kt),Lt.style.setProperty("--dt-bottom-ink",Dr(Kt));let xe=fe.querySelector(".dt-win-tab > span");xe&&(xe.textContent=ut()||location.host)},st=0;y.addEventListener("load",()=>{let R=D();if(!R)return;let O=window.__notemendHosted;if(O&&!y.contentWindow?.__notemendHosted&&!R.querySelector(`script[src^="${O.base}/bar.js"]`)){let Y=R.createElement("script");Y.src=`${O.base}/bar.js`,Y.dataset.project=O.project,R.head.append(Y)}Et(),y.contentWindow?.addEventListener("scroll",()=>{st||(st=requestAnimationFrame(()=>{st=0,Et()}))},{passive:!0})});for(let R of[fe,Qt])R.addEventListener("click",O=>{let Y=O.target.closest("[data-nav]")?.dataset.nav;if(Y)try{let Nt=y.contentWindow?.navigation;if(!D()||!Nt)throw new Error("foreign");Y==="back"?Nt.canGoBack&&Nt.back():Y==="fwd"?Nt.canGoForward&&Nt.forward():Nt.reload()}catch{(Y==="reload"||Y==="back")&&(y.src=location.href)}});we.addEventListener("click",()=>{se=!se,h("dt-bars-min",se?"1":"0"),gt()});let et=[],rt=R=>{for(let O of et)O.inert=!1;et=R?[...document.body.children].filter(O=>O instanceof HTMLElement&&!O.inert&&!O.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let O of et)O.inert=!0},gt=()=>{if(c)return;let R=M?dt(M)??null:null;if(M&&!R&&(M="",ct.setItem(ne,"")),!R&&!$){let O="";try{let Y=y.getAttribute("src")?y.contentWindow?.location:null;Y?.origin===location.origin&&(O=Y.pathname+Y.search+Y.hash)}catch{}if(g.hidden=!0,rt(!1),y.removeAttribute("src"),Zt.toggle("dt-framing",!1),w.hidden=!J(),me.innerHTML="",at(),Re.hidden=!0,we.hidden=!0,F(null),ft="",xt(),at(),He(),O&&O!==location.pathname+location.search+location.hash){location.assign(O);return}It();return}if(g.hidden=!1,rt(!0),Zt.toggle("dt-framing",!0),w.hidden=!0,y.src||(y.src=location.href),R){let O=fu(R,{host:location.host,title:ut(),now:new Date,min:se,cutout:q(R)}),{screen:Y}=O;g.dataset.mode="device",Lt.dataset.shell=R.shell,Lt.dataset.browser=R.browser,Lt.style.width=`${O.footprint.w}px`,Lt.style.height=`${O.footprint.h}px`,Lt.style.setProperty("--dt-r",`${Y.r}px`),Lt.style.setProperty("--dt-rb",`${Y.rb}px`),pe.innerHTML=O.shell;let Nt=(it,ye,os,as)=>{it.innerHTML=as,it.style.cssText=`left:${Y.x}px;top:${ye}px;width:${Y.w}px;height:${os}px`};Nt(fe,Y.y,O.topH,O.top),Nt(Qt,Y.y+Y.h-O.bottomH,O.bottomH,O.bottom);let Kt=Y.h-O.topH-O.bottomH;y.style.position="absolute",y.style.left=`${Y.x}px`,y.style.top=`${Y.y+O.topH}px`,y.style.width=`${Y.w}px`,y.style.height=`${Kt}px`,me.innerHTML="";let xe=se&&O.canMinimize;N=O.scrollbar,ft=`${R.label}${xe?" \xB7 bars folded":""}`,F(k(R.w)),St({notes:J(),scrollbar:N,device:ft}),we.hidden=!O.canMinimize,we.setAttribute("aria-pressed",String(xe)),E(`${R.label} ${R.w}\xD7${R.h} \xB7 page ${R.w}\xD7${Kt}${xe?" \xB7 bars folded":""} \xB7 ${qt.find(it=>it.id===tt())?.label??""}`),Et()}else{let O=_t();O||Dt(null);let Y=O?.w||L||qt.find(xe=>xe.id===z()).ideal;L=Y,g.dataset.mode="canvas",delete Lt.dataset.shell,delete Lt.dataset.browser,pe.innerHTML=fe.innerHTML=Qt.innerHTML="",fe.style.cssText=Qt.style.cssText="",we.hidden=!0,N="overlay",Lt.style.width=`${Y}px`,Lt.style.height=`${O?.h??innerHeight-84}px`,y.style.position="",y.style.left=y.style.top="",y.style.width="100%",y.style.height="100%",x(Y),St({notes:J()});let Nt=qt.find(xe=>xe.id===k(Y)),Kt=G();ft=Kt?`${Kt.label}${U?.turned?" \xB7 landscape":""}`:"",St({scrollbar:N,device:ft}),E(Kt&&O?`${Kt.label} \xB7 ${O.w}\xD7${O.h} \xB7 ${Nt.label}`:`${Y}px \xB7 ${Nt.label}`),F(k(Y))}Re.hidden=!(G()?.rotates&&!R),He(),H(),at(),It()},At=R=>{let O=qt.find(Y=>Y.id===R);M="",ct.setItem(ne,""),Dt(null),$=z()!==R,L=$?O.ideal:0,F($?R:null),ct.setItem(jt,$?"1":"0"),ct.setItem(Rt,String(L)),Wt(),gt()};for(let R of C)R.addEventListener("click",()=>At(R.dataset.bp));for(let R of document.querySelectorAll("[data-device]"))R.addEventListener("click",()=>{M=R.dataset.device===M?"":R.dataset.device,ct.setItem(ne,M),T.open=!1,gt()});for(let R of document.querySelectorAll("[data-emu]"))R.addEventListener("click",()=>{let O=U?.id===R.dataset.emu&&!M;M="",ct.setItem(ne,""),Dt(O?null:{id:R.dataset.emu,turned:!1}),$=!O,L=0,ct.setItem(jt,$?"1":"0"),F(null),Wt(),T.open=!1,gt()});Re.addEventListener("click",()=>{U&&(Dt({...U,turned:!U.turned}),Wt(),gt())});let $e=[...T.querySelectorAll("[data-tab]")],je=[...T.querySelectorAll("[data-panel]")],ke=R=>{for(let O of $e)O.setAttribute("aria-selected",String(O.dataset.tab===R));for(let O of je)O.hidden=O.dataset.panel!==R;h("dt-devices-tab",R)};for(let R of $e)R.addEventListener("click",()=>ke(R.dataset.tab));ke(ct.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let Gt=T.querySelector(".dt-emu-search");Gt.addEventListener("input",()=>{let R=Gt.value.trim().toLowerCase(),O=null,Y=!1,Nt=()=>{O&&(O.hidden=!Y)};for(let Kt of Gt.parentElement.children){if(Kt.classList.contains("dt-devices-group")){Nt(),O=Kt,Y=!1;continue}Kt.dataset.emu&&(Kt.hidden=!!R&&!Kt.textContent.toLowerCase().includes(R),Y||=!Kt.hidden)}Nt()});let he=T.querySelector(".dt-devices-name");function He(){for(let O of T.querySelectorAll("[data-device]"))O.setAttribute("aria-pressed",String(O.dataset.device===M));let R=!M&&!g.hidden?U?.id:void 0;for(let O of T.querySelectorAll("[data-emu]"))O.setAttribute("aria-pressed",String(O.dataset.emu===R));he.textContent=M&&dt(M)?.label||R&&G()?.label||"Device"}let be=R=>qt.find(O=>O.id===R),_e=R=>{let O=be(tt()??z());return Math.max(O.min||320,Math.min(Number.isFinite(O.max)?O.max:2560,Math.round(R)))};for(let R of Ln){let O=R.dataset.edge==="l"?-1:1;R.addEventListener("pointerdown",Y=>{if(M)return;Y.preventDefault(),U&&(Dt(null),gt()),R.setPointerCapture(Y.pointerId);let Nt=Y.clientX,Kt=L,xe=Number(Lt.dataset.scaled||100)/100;g.dataset.dragging="1";let it=os=>{L=_e(Kt+O*(os.clientX-Nt)*2/xe),Lt.style.width=`${L}px`,x(L),E(`${L}px \xB7 ${be(k(L)).label}`),H()},ye=()=>{R.removeEventListener("pointermove",it),R.removeEventListener("pointerup",ye),R.removeEventListener("pointercancel",ye),delete g.dataset.dragging,ct.setItem(Rt,String(L)),gt()};R.addEventListener("pointermove",it),R.addEventListener("pointerup",ye),R.addEventListener("pointercancel",ye)}),R.addEventListener("dblclick",()=>{if(M)return;Dt(null);let Y=be(tt()??z()),Nt=[Y.min||320,Number.isFinite(Y.max)?Y.max:Y.ideal];L=Math.abs(L-Nt[0])<Math.abs(L-Nt[1])?Nt[0]:Nt[1],ct.setItem(Rt,String(L)),gt()})}let Ms=z(),qn=()=>{let R=qt.find(O=>O.id===A);return $&&!M&&!U&&L===R.ideal&&innerWidth>=R.min};return addEventListener("resize",()=>{if(qn()){At(A);return}at(),z()!==Ms&&(Ms=z(),vt()),g.hidden||(!M&&!U&&(Lt.style.height=`${innerHeight-84}px`),H())}),{apply:gt,pickBp:At,look:()=>({scrollbar:N,device:ft}),restore:()=>{qn()?At(A):$||M?gt():He()}}}var vu='<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>',wu='<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>',Mh='<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>',kh='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function $u(n){let{bp:r,notes:c,breakpoints:h,bandOfNote:g,showResolved:y,showArchived:T,drafts:C,find:w}=n,A=c.filter(N=>g(N)===r),k=N=>[N.text,N.note,N.byName,...(N.replies??[]).filter(ft=>!ft.deleted).map(ft=>ft.text)].join(" ").toLowerCase(),z=N=>w.view==="me"?n.forMe(N):w.view==="agent"?n.forAgent(N):!0,dt=N=>Date.parse(N.updatedAt||N.createdAt||"")||0,J=N=>Date.parse(N.createdAt||"")||0,tt=A.filter(N=>z(N)&&(!w.q||k(N).includes(w.q.trim().toLowerCase()))).sort((N,ft)=>w.sort==="old"?J(N)-J(ft):w.sort==="new"?J(ft)-J(N):(w.sort==="unread"?Number(n.unread(ft))-Number(n.unread(N)):0)||dt(ft)-dt(N)),F={open:[],claude:[],done:[],archived:[]};for(let N of tt)F[Ct(N)==="done"&&n.archived(N)?"archived":Ct(N)].push(N);let xt=N=>{let ft=Ct(N),Rt=n.orphan(N),jt=n.unread(N),ne=n.picking&&n.pickable(N),$=!!ne&&n.picking.has(N.id),M=n.mirror(N),L=Qn(N.updatedAt||N.createdAt),V=M?`<i class="dt-hist-mirror"${M==="there"?` data-tip="In Team too \xB7 ${f(L)}"`:' data-tip="A client\u2019s thread, mirrored into Team"'}>${Mh}Mirrored</i>`:"";return`<div class="dt-hist-row is-${ft}${ft==="done"?n.archived(N)?" is-archived":" is-resolved":""}${Rt?" is-orphan":""}${jt?" is-unread":""}${n.menuFor===N.id?" is-menu":""}${$?" is-picked":""}${n.picking&&!ne?` is-unpickable${M?" is-dim":""}`:""}">
|
|
212
212
|
<button class="dt-hist-go" data-go="${N.id}" data-tip="${f(N.text.slice(0,80))}"${ne?` role="checkbox" aria-checked="${$}"`:""}>
|
|
213
213
|
${ne?`<span class="dt-hist-pick" aria-hidden="true"><i class="dt-hist-box">${$?Me:""}</i></span>`:n.marker(N)}
|
|
214
214
|
<span class="dt-hist-body">
|
|
215
215
|
<span class="dt-hist-id"><b class="dt-hist-who">${f(N.byName||"You")}</b>${V}${M==="there"?"":`<em>\xB7 ${L}</em>`}${jt?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
|
|
216
|
-
<span class="dt-hist-text">${f(
|
|
216
|
+
<span class="dt-hist-text">${f(Bc(N.text||N.note))}</span>${n.replied(N)}
|
|
217
217
|
</span>
|
|
218
218
|
</button>
|
|
219
|
-
<span class="dt-note-tools dt-hist-tools">${n.tick(N)}${n.assign(N)}<button type="button" class="dt-hist-more" data-row-more="${N.id}" aria-label="More" aria-haspopup="menu" aria-expanded="${n.menuFor===N.id}">${
|
|
220
|
-
</div>`},Wt=h.map(N=>{let ft=c.filter(Rt=>g(Rt)===N.id&&Ct(Rt)!=="done");return{band:N,open:ft.filter(Rt=>Ct(Rt)==="open").length,total:ft.length}}).filter(N=>N.total&&N.band.id!==
|
|
221
|
-
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${N.icon}</svg><i>${Rt}</i></button>`}).join("")}</div>`:"",at=["open","claude","done","archived"],vt={...
|
|
222
|
-
>${qt[N]??""}${ft}<em>${Rt}</em><svg class="dt-hist-chev" viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${n.shut(N)?"m9 18 6-6-6-6":"m6 9 6 6 6-6"}"/></svg></button>`,qt={open:
|
|
219
|
+
<span class="dt-note-tools dt-hist-tools">${n.tick(N)}${n.assign(N)}<button type="button" class="dt-hist-more" data-row-more="${N.id}" aria-label="More" aria-haspopup="menu" aria-expanded="${n.menuFor===N.id}">${vu}</button>${n.rowMenu(N)}</span>
|
|
220
|
+
</div>`},Wt=h.map(N=>{let ft=c.filter(Rt=>g(Rt)===N.id&&Ct(Rt)!=="done");return{band:N,open:ft.filter(Rt=>Ct(Rt)==="open").length,total:ft.length}}).filter(N=>N.total&&N.band.id!==r),St=Wt.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${Wt.map(({band:N,open:ft,total:Rt})=>{let jt=`${N.label}: ${ft} open \xB7 ${Rt-ft} to check`;return`<button data-bp="${N.id}" data-state="${ft?"open":"claude"}" title="${jt}" aria-label="${jt}"
|
|
221
|
+
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${N.icon}</svg><i>${Rt}</i></button>`}).join("")}</div>`:"",at=["open","claude","done","archived"],vt={...tu,archived:"Archived"},It=(N,ft,Rt)=>`<button type="button" class="dt-hist-gfold" data-gfold="${N}" aria-expanded="${!n.shut(N)}"
|
|
222
|
+
>${qt[N]??""}${ft}<em>${Rt}</em><svg class="dt-hist-chev" viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${n.shut(N)?"m9 18 6-6-6-6":"m6 9 6 6 6-6"}"/></svg></button>`,qt={open:Xe("#0d99ff",0),claude:Xe("#8e4ec6",.5),done:Xe("#30a46c",1),archived:Xe("#717171",1)},Lt=n.cap,pe=at.filter(N=>F[N].length&&(N==="done"?y:N==="archived"?T:!0)),fe=N=>`<div class="dt-hist-row is-draft">
|
|
223
223
|
<button class="dt-hist-go" data-draft-go="${N.i}">
|
|
224
224
|
${n.draftFace||`<span class="dt-hist-n">${es}</span>`}
|
|
225
225
|
<span class="dt-hist-body">
|
|
@@ -229,11 +229,11 @@ import"./notemend.css";var ae={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
229
229
|
</button>${n.draftFace?`<span class="dt-hist-step" role="img" aria-label="Draft, not sent"><span class="dt-hist-n">${es}</span></span>`:""}
|
|
230
230
|
<span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${N.i}" title="Discard this draft">${ts}</button></span></span>
|
|
231
231
|
</div>`,Qt=A.filter(N=>Ct(N)!=="done"),me=(N,ft,Rt,jt,ne)=>`<button type="button" role="menuitemradio" aria-checked="${jt}" ${N}="${ft}"><i>${jt?Me:""}</i><span>${Rt}</span>${ne==null?"":`<em>${ne}</em>`}</button>`,Ln=()=>`<div class="dt-hist-find">
|
|
232
|
-
<label class="dt-hist-search">${
|
|
233
|
-
<button type="button" class="dt-tip-r dt-hist-filter${w.view!=="all"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${w.menu}" data-tip="Filter">${
|
|
232
|
+
<label class="dt-hist-search">${wu}<input type="search" data-hist-q placeholder="Search threads" aria-label="Search threads" value="${f(w.q)}" spellcheck="false">${w.q?`<button type="button" data-hist-clear aria-label="Clear search">${Pn}</button>`:'<kbd aria-hidden="true">/</kbd>'}</label>
|
|
233
|
+
<button type="button" class="dt-tip-r dt-hist-filter${w.view!=="all"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${w.menu}" data-tip="Filter">${kh}</button>
|
|
234
234
|
${w.menu?`<div class="dt-hist-menu" role="menu">${me("data-hist-view","me","For me",w.view==="me",Qt.filter(n.forMe).length)}${me("data-hist-view","agent","Agent",w.view==="agent",Qt.filter(n.forAgent).length)}${me("data-hist-view","all","All",w.view==="all",Qt.length)}</div>`:""}
|
|
235
|
-
</div>`,
|
|
236
|
-
<button type="button" role="menuitem" data-read-all><span>Mark all as read</span></button>${F.open.length?`<button type="button" role="menuitem" data-resolve-all="${Re(F.open)}"><span>Resolve all open</span><em>${F.open.length}</em></button>`:""}${n.mirrorAll.length?`<button type="button" role="menuitem" data-mirror-all="${n.mirrorAll.join(",")}"><span>Mirror all open to Team</span><em>${n.mirrorAll.length}</em></button>`:""}${n.archives&&F.done.length?`<button type="button" role="menuitem" data-archive-all="${Re(F.done)}"><span>Archive all resolved</span><em>${F.done.length}</em></button>`:""}<hr>${
|
|
235
|
+
</div>`,Vt=(N,ft,Rt,jt)=>`<button type="button" role="menuitemcheckbox" ${N} aria-checked="${ft}"><span>${Rt}</span><kbd>${jt}</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>`,Re=N=>N.map(ft=>ft.id).join(","),we=()=>`<div class="dt-hist-menu is-panel" role="menu">
|
|
236
|
+
<button type="button" role="menuitem" data-read-all><span>Mark all as read</span></button>${F.open.length?`<button type="button" role="menuitem" data-resolve-all="${Re(F.open)}"><span>Resolve all open</span><em>${F.open.length}</em></button>`:""}${n.mirrorAll.length?`<button type="button" role="menuitem" data-mirror-all="${n.mirrorAll.join(",")}"><span>Mirror all open to Team</span><em>${n.mirrorAll.length}</em></button>`:""}${n.archives&&F.done.length?`<button type="button" role="menuitem" data-archive-all="${Re(F.done)}"><span>Archive all resolved</span><em>${F.done.length}</em></button>`:""}<hr>${Vt("data-resolved",y,"Show resolved","R")}${n.archives?Vt("data-archived",T,"Show archived","A"):""}<hr>
|
|
237
237
|
<p class="dt-hist-menu-head">Sort</p>${me("data-hist-sort","new","Newest first",w.sort==="new")}${me("data-hist-sort","old","Oldest first",w.sort==="old")}${me("data-hist-sort","reply","Last reply",w.sort==="reply")}${me("data-hist-sort","unread","Unread first",w.sort==="unread")}</div>`;return`<div class="dt-hist-head">
|
|
238
238
|
<span class="dt-hist-here"
|
|
239
239
|
><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><rect x="2.5" y="3.5" width="15" height="13" rx="2"/><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5"/></svg></span>
|
|
@@ -241,107 +241,107 @@ import"./notemend.css";var ae={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
241
241
|
${n.clients?'<span class="dt-hist-space"><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true"><circle cx="9" cy="7" r="3"/><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9"/><path d="M14.5 12.5l1.2 1.2 2.3-2.4"/></svg>Client</span>':""}
|
|
242
242
|
${St}
|
|
243
243
|
${n.checks&&!n.clients?`<button class="dt-review-btn" data-review aria-label="Check all ${n.checks} ${n.checks===1?"fix":"fixes"}" data-tip="${n.checks} ${n.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${n.checks}</button>`:""}
|
|
244
|
-
<button class="dt-hist-refresh" data-hist-more aria-label="More" aria-haspopup="menu" aria-expanded="${w.more}">${
|
|
244
|
+
<button class="dt-hist-refresh" data-hist-more aria-label="More" aria-haspopup="menu" aria-expanded="${w.more}">${vu}</button>${w.more&&!n.folded?we():""}
|
|
245
245
|
<button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel" aria-expanded="${!n.folded}">
|
|
246
246
|
<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.5 8.5 10 12.5l4.5-4"/></svg>
|
|
247
247
|
</button>
|
|
248
|
-
</div>`+(n.folded?"":Ln()+(pe.length||C.length?`<div class="dt-hist-list">${C.length?`<p class="dt-hist-group">${It("drafts","Drafts",C.length)}</p>${n.shut("drafts")?"":C.map(fe).join("")}`:""}${pe.map(N=>{if(n.shut(N))return`<p class="dt-hist-group">${It(N,vt[N],F[N].length)}</p>`;let ft=F[N].slice(0,Math.max(0,Lt));Lt-=ft.length;let Rt=F[N].slice(ft.length).find(ne=>ne.id===n.keep);Rt&&ft.push(Rt);let jt=F[N].length-ft.length;return`<p class="dt-hist-group">${It(N,vt[N],F[N].length)}</p>${ft.map(xt).join("")}${jt?`<button type="button" class="dt-note-fold dt-hist-rest" data-hist-rows>${jt} more in ${vt[N]}</button>`:""}`}).join("")}</div>`:w.q.trim()?`<div class="dt-hist-empty">${
|
|
248
|
+
</div>`+(n.folded?"":Ln()+(pe.length||C.length?`<div class="dt-hist-list">${C.length?`<p class="dt-hist-group">${It("drafts","Drafts",C.length)}</p>${n.shut("drafts")?"":C.map(fe).join("")}`:""}${pe.map(N=>{if(n.shut(N))return`<p class="dt-hist-group">${It(N,vt[N],F[N].length)}</p>`;let ft=F[N].slice(0,Math.max(0,Lt));Lt-=ft.length;let Rt=F[N].slice(ft.length).find(ne=>ne.id===n.keep);Rt&&ft.push(Rt);let jt=F[N].length-ft.length;return`<p class="dt-hist-group">${It(N,vt[N],F[N].length)}</p>${ft.map(xt).join("")}${jt?`<button type="button" class="dt-note-fold dt-hist-rest" data-hist-rows>${jt} more in ${vt[N]}</button>`:""}`}).join("")}</div>`:w.q.trim()?`<div class="dt-hist-empty">${wu}<p>No threads match \xAB${f(w.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:w.view!=="all"?'<div class="dt-hist-empty"><p>Nothing in this view at this breakpoint.</p><button data-hist-view="all">Show all</button></div>':`<div class="dt-hist-empty is-blank"><i><svg viewBox="0 0 20 20" width="18" height="18" aria-hidden="true"><path d="M4 3.5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9.5L5.5 16.5v-3H4a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM10 6v5M7.5 8.5h5" stroke-linejoin="round"/></svg></i>${F.done.length||F.archived.length?"<b>Everything here is resolved.</b>":y?"<b>No threads at this breakpoint yet</b><p>Click anything on the page to leave one.</p>":"<b>Nothing open at this breakpoint</b><p>Resolved threads are hidden \u2014 \xABShow resolved\xBB below brings them back.</p>"}</div>`)+(n.picking?`<div class="dt-hist-foot is-picking" role="toolbar" aria-label="Selected threads"><span class="dt-hist-sel" aria-live="polite">${n.picking.size} selected</span
|
|
249
249
|
><button type="button" data-pick-mirror${n.picking.size?"":" disabled"}><kbd>M</kbd>Mirror to Team</button><button type="button" data-pick-cancel><kbd>Esc</kbd>Cancel</button></div>`:`<div class="dt-hist-foot">
|
|
250
250
|
<button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${y}"
|
|
251
251
|
><svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="10" r="7.5"/><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round"/></svg
|
|
252
252
|
><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
253
|
-
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${
|
|
253
|
+
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${T}"
|
|
254
254
|
>${kn}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
255
|
-
</div>`))}function
|
|
256
|
-
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${It?"":" disabled"}>${
|
|
255
|
+
</div>`))}function xu(n){let{inFrame:r,everything:c,route:h,open:g,settle:y,keepIn:T,toast:C,waits:w,approve:A}=n,k=at=>{let vt=c().find(It=>It.id===at);return!!vt&&w(vt)},z="nm-review",dt=()=>{try{return JSON.parse(sessionStorage.getItem(z)||"null")}catch{return null}},J=at=>{try{at?sessionStorage.setItem(z,JSON.stringify(at)):sessionStorage.removeItem(z)}catch{}},tt=document.createElement("div");tt.className="dt-review",tt.setAttribute("role","region"),tt.setAttribute("aria-label","Checking fixes"),tt.hidden=!0,T(tt),r||document.body.append(tt);let F=()=>c().filter(w),xt=()=>{let at=F().sort((vt,It)=>+(It.route===h())-+(vt.route===h())||String(vt.route).localeCompare(String(It.route))||vt.id-It.id).map(vt=>vt.id);at.length&&(J({ids:at,i:0}),Wt())},Wt=()=>{let at=dt();if(!at||r){tt.hidden=!0;return}for(;at.i<at.ids.length&&!k(at.ids[at.i]);)at.i++;if(at.i>=at.ids.length){J(null),tt.hidden=!0,C("Every fix is checked.");return}J(at);let vt=c().find(Lt=>Lt.id===at.ids[at.i]);if(vt.route&&vt.route!==h()){location.assign(vt.route+location.search);return}g(vt);let It=at.ids.slice(0,at.i).some(k),qt=at.ids.filter(k);tt.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
|
|
256
|
+
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${It?"":" disabled"}>${Va}</button>
|
|
257
257
|
<span class="dt-review-n">${qt.indexOf(vt.id)+1} of ${qt.length}</span>
|
|
258
|
-
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${
|
|
258
|
+
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Ga}</button></span>
|
|
259
259
|
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${Me}</button>
|
|
260
260
|
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${gn}</button>
|
|
261
|
-
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Pn}</button>`,tt.hidden=!1};tt.addEventListener("click",async at=>{let vt=at.target.closest("[data-r]"),It=dt();if(!vt||!It)return;if(vt.dataset.r==="stop"){J(null),tt.hidden=!0;return}if(vt.dataset.r==="prev"){St();return}let qt=It.ids[It.i];J({...It,i:It.i+1});let Lt=c().find(fe=>fe.id===qt),pe=vt.dataset.r==="ok"&&Lt?A(Lt):vt.dataset.r==="no"?y(qt,!1):null;Wt(),await pe});let St=()=>{let at=dt();if(at){for(let vt=at.i-1;vt>=0;vt--)if(k(at.ids[vt])){J({...at,i:vt}),Wt();return}}};return document.addEventListener("keydown",at=>{tt.hidden||at.metaKey||at.ctrlKey||at.altKey||at.key!=="ArrowLeft"&&at.key!=="ArrowRight"||at.target.closest?.("input, textarea, select, [contenteditable]")||(at.preventDefault(),at.key==="ArrowLeft"?St():tt.querySelector('[data-r="skip"]')?.click())}),{start:xt,toCheck:F,resume:()=>{dt()&&Wt()}}}function $u(n,i){let c=null,h=null,g=document.querySelector(".dt-turbo"),y="/notemend:turbo",S=()=>{let C=!!c&&Date.now()-Date.parse(c.at)<18e4,w=C?c.mode==="push"?"push":h?.paused?"paused":"on":"none",A=C?Zn(c.agent):"",k=w==="none"?`Turbo is off. Run ${y} in Claude Code and threads for the agent are taken as they land \u2014 click to copy it`:w==="push"?`Push mode: ${A} takes threads when you press Push to the agent. For live, run ${y} instead`:w==="on"?`Turbo on: ${A} takes threads for the agent as they land \u2014 click to pause`:`Turbo paused: ${A} is listening but waits \u2014 click to resume`;g.dataset.state=w,g.dataset.tip=k,g.setAttribute("aria-label",k),g.setAttribute("aria-checked",String(w==="on")),n&&(g.hidden=!0)};return setInterval(S,3e4),g.addEventListener("click",async()=>{let C=g.dataset.state;if(C==="none"||C==="push"){await navigator.clipboard?.writeText(y).catch(()=>{}),i(`Copied ${y} \u2014 paste it in Claude Code`);return}let w=C==="on"?"off":"on";h={paused:w==="off"},S();try{let A=await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:w})});if(!A.ok)throw new Error(String(A.status));i(w==="off"?"Turbo paused":"Turbo on")}catch{h={paused:w==="on"},S(),i("Could not switch turbo \u2014 try again")}}),C=>{c=C.listening??null,h=C.turbo??null,S()}}var Mh=new Set(["data-wired","data-nudge"]),kh=".dt-note",xu=n=>n instanceof Element&&n.hasAttribute("data-ghost"),Fo=n=>{if(!(n instanceof Element))return null;let i=n.dataset;return i.msg?`m:${i.msg}`:i.id?`${n.tagName}:${n.classList[0]??""}:${i.id}`:"draft"in i?`${n.tagName}:draft`:i.parked?`${n.tagName}:parked:${i.parked}`:i.k?`${n.tagName}:k:${i.k}`:null},Eu=(n,i)=>n.nodeType===i.nodeType&&n.nodeName===i.nodeName&&Fo(n)===Fo(i);function Lh(n,i){for(let{name:c}of[...n.attributes])!i.hasAttribute(c)&&!Mh.has(c)&&n.removeAttribute(c);for(let{name:c,value:h}of i.attributes)n.getAttribute(c)!==h&&n.setAttribute(c,h);n instanceof HTMLInputElement&&i instanceof HTMLInputElement&&(n.checked!==i.checked&&(n.checked=i.checked),n!==document.activeElement&&n.value!==i.value&&(n.value=i.value))}function Mu(n,i){let c=[...n.childNodes].filter(w=>!xu(w)),h=new Map;for(let w of c){let A=Fo(w);A&&h.set(A,w)}let g=new Set,y=0,S=[];for(let w of[...i.childNodes]){let A=Fo(w),k=A?h.get(A):void 0;if(!A){for(;y<c.length&&(g.has(c[y])||Fo(c[y]));)y++;y<c.length&&Eu(c[y],w)&&(k=c[y++])}k&&!g.has(k)&&Eu(k,w)?(g.add(k),Sh(k,w),S.push(k)):S.push(w)}for(let w of c)g.has(w)||(w instanceof HTMLElement&&w.matches(kh)&&du(w),n.removeChild(w));let C=n.firstChild;for(let w of S){for(;C&&xu(C);)C=C.nextSibling;if(w===C){C=C.nextSibling;continue}n.insertBefore(w,C)}}function Sh(n,i){if(n.nodeType===Node.TEXT_NODE||n.nodeType===Node.COMMENT_NODE){n.nodeValue!==i.nodeValue&&(n.nodeValue=i.nodeValue);return}if(!(!(n instanceof Element)||!(i instanceof Element))){if(Lh(n,i),n instanceof HTMLTextAreaElement){n!==document.activeElement&&n.value!==i.value&&(n.value=i.value);return}if(n instanceof SVGElement){n.innerHTML!==i.innerHTML&&(n.innerHTML=i.innerHTML);return}Mu(n,i),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==i.value&&(n.value=i.value)}}function Fr(n,i){let c=document.createElement("template");c.innerHTML=i,Mu(n,c.content)}function ku(n,i,c=!1){let h=n.breakpoints,g=n.categories,y=(h.find(t=>!Number.isFinite(t.max))??h[0]).id,S=t=>h.find(e=>t>=e.min&&t<=e.max)?.id??y,C=(t,e)=>{let s=S(t);if(Vs||!matchMedia("(pointer: coarse)").matches)return s;let o=[...h].sort((l,d)=>l.min-d.min),a=e<500?S(767):(o[o.length-2]??o[0]).id,r=l=>o.findIndex(d=>d.id===l);return r(s)>r(a)?a:s},w=t=>t.breakpoint||y,A=t=>n.devices.find(e=>e.id===t),k=Vs,z=(t,e)=>{k||ct.setItem(t,e)},dt=null,J=["stage","status","priority","assignee"],tt=t=>{let e=(dt??j).find(a=>a.id===t.id),s=J.filter(a=>a in t||(a==="stage"||a==="status")&&("stage"in t||"status"in t)),o=e&&s.length&&!t.reply?Object.fromEntries(s.map(a=>[a,e[a]??null])):void 0;return ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(o?{...t,seen:o}:t)})},F=t=>t.replace(/\/+$/,"")||"/",xt=F(location.pathname);for(let t of document.querySelectorAll(".devtools .dt-icon[title]"))t.dataset.tip=t.title,t.getAttribute("aria-label")||t.setAttribute("aria-label",t.title),t.removeAttribute("title");let Wt=document.querySelector(".dt-grid-btn"),St=document.querySelector(".dt-grid-overlay"),at=St.querySelector(".dt-overlay-grid"),vt=St.querySelector(".dt-grid-chip"),It="dt-grid",qt=n.projectGrid??null,Lt=()=>C(innerWidth,innerHeight),pe=()=>qt?.mode==="custom"?qt.widths?.[Lt()]??null:null,fe=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),Qt=t=>fe(t).length,me=()=>{let t=St.hidden;t&&(St.style.visibility="hidden",St.hidden=!1);try{return Ln()}finally{t&&(St.hidden=!0,St.style.visibility="")}},Ln=()=>{let t=document.documentElement.clientWidth;St.classList.remove("is-auto");let e=getComputedStyle(at);if(e.display==="grid"&&Qt(e)>1){let r=at.getBoundingClientRect();return{cols:Qt(e),gap:Math.round(parseFloat(e.columnGap)||0),x:Math.round(r.left),w:Math.round(r.width),from:"site"}}let s=null,o=null;for(let r of[...document.body.querySelectorAll("*")].slice(0,3e3)){if(r.closest(Xs)||St.contains(r))continue;let l=r.getBoundingClientRect();if(!l.width||!l.height)continue;let d=getComputedStyle(r);if(d.maxWidth!=="none"&&l.left>0&&Math.abs(l.left-(t-l.right))<=2&&l.width>(s?.w??0)){let u=parseFloat(d.paddingLeft)||0;s={x:l.left+u,w:l.width-u-(parseFloat(d.paddingRight)||0)}}if(l.width<=(o?.w??0))continue;let p=d.display.endsWith("grid")?fe(d):[];if(p.length>1){if(!p.every(b=>Math.abs(b-p[0])<2))continue;let u=parseFloat(d.columnGap)||0;o={cols:p.length,gap:u,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:p.reduce((b,T)=>b+T,0)+u*(p.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let u=[...r.children].map(T=>T.getBoundingClientRect()).filter(T=>T.width&&T.height),b=u.filter(T=>Math.abs(T.top-u[0].top)<2).sort((T,P)=>T.left-P.left);b.length>1&&b.every(T=>Math.abs(T.width-b[0].width)<2)&&(o={cols:b.length,gap:Math.max(0,b[1].left-b[0].right),x:b[0].left,w:b.at(-1).right-b[0].left})}}let a=r=>({...r,gap:Math.round(r.gap),x:Math.round(r.x),w:Math.round(r.w)});return a(o?{...o,...s??{},from:"page"}:{cols:n.grid.columns,gap:innerWidth<768?16:24,...s??{x:24,w:t-48},from:"guess"})},zt=null,Re=(t,e,s,o)=>{St.classList.add("is-auto"),at.children.length!==t&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),St.style.setProperty("--grid-x",`${s}px`),St.style.setProperty("--grid-w",`${o}px`),St.style.setProperty("--grid-gap",`${e}px`)},we=()=>{let t=pe(),e=vt.querySelector("span");if(vt.querySelector("button").hidden=!t||k,t){let s=document.documentElement.clientWidth,o=Math.max(0,Math.min(t.max??1/0,s-2*t.margin));Re(t.cols,t.gutter,(s-o)/2,o),e.textContent="Project grid \xB7";return}at.children.length!==n.grid.columns&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(n.grid.columns)),zt=me(),zt.from!=="site"&&Re(zt.cols,zt.gap,zt.x,zt.w),e.textContent=zt.from==="guess"?`Guessed \xB7 ${zt.cols} \xD7 ${zt.w}`:`From the page \xB7 ${zt.cols} \xD7 ${zt.w} \xB7 gap ${zt.gap}`},N=()=>{vt.classList.remove("is-lifted");let t=vt.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();vt.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},ft=t=>{St.hidden=!t,t&&(we(),N()),Wt.setAttribute("aria-pressed",String(t)),z(It,t?"1":"0"),Ue({grid:t})};Wt.addEventListener("click",()=>ft(St.hidden===!0)),addEventListener("resize",()=>{St.hidden||(we(),N())});let Rt=document.querySelector(".dt-pages-name"),jt=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:F(t.location.pathname),title:t.document.title}:null}catch{return null}},ne=()=>{let t=document.querySelector(".dt-pages-here"),e=document.querySelector('.dt-pages-list a[aria-current="page"] .dt-pages-n');t&&(t.innerHTML=e?.innerHTML??"",t.hidden=!e||e.hidden,t.title=e?.title??"")},$=()=>{let e=jt()?.route??xt,s=null;for(let l of document.querySelectorAll(".dt-pages a"))F(new URL(l.href).pathname)===e?(l.setAttribute("aria-current","page"),s=l):l.removeAttribute("aria-current");ne();let r=(s?.querySelector(".dt-menu-label")?.textContent?.trim()||e).trim().split(/\s+/);Rt.textContent=e==="/"?"":e.replace(/^\//,""),Rt.closest("summary").toggleAttribute("data-home",e==="/")},M=(!!n.gridAdmin||!!n.arrange)&&!n.client,L=(n.folders??[]).filter(t=>t&&typeof t.name=="string"&&Array.isArray(t.pages)),V=new Set((()=>{try{return JSON.parse(ct.getItem("dt-folders-open")||"[]")}catch{return[]}})()),U=new Set((()=>{try{return JSON.parse(ct.getItem("dt-folders-closed")||"[]")}catch{return[]}})()),G=document.querySelector(".dt-pages-list"),_t=()=>$(),se=t=>$t(t?'<path d="M2.5 15.5V5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H15A1.5 1.5 0 0 1 16.5 7v1.5M2.5 15.5l2.2-6A1.5 1.5 0 0 1 6.1 8.5h11.2l-2.5 7z" />':'<path d="M2.5 5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H16A1.5 1.5 0 0 1 17.5 7v7.5A1.5 1.5 0 0 1 16 16H4a1.5 1.5 0 0 1-1.5-1.5z" />',14),Dt=()=>{let t=new Map(n.pages.map(d=>[d.route,d])),e=new Set(L.flatMap(d=>d.pages)),s=d=>Kc(n,d,xt,M),o=d=>L.filter(p=>(p.parent&&L.some(u=>u.id===p.parent)?p.parent:null)===d),a=d=>d.pages.includes(xt)||o(d.id).some(a),r=(d,p)=>s(d).replace("<li",`<li style="--d:${p}"`),l=(d,p)=>{let u=V.has(d.id)||!U.has(d.id)&&a(d),b=d.pages.map(P=>t.get(P)).filter(P=>!!P),T=o(d.id);return`<li class="dt-folder" data-folder="${f(d.id)}" style="--d:${p}"${u?" data-open":""}${M?' draggable="true"':""}><div class="dt-folder-row" role="button" tabindex="0" aria-expanded="${u}">${Bo}${se(u)}<span class="dt-menu-label">${f(d.name)}</span><em class="dt-folder-n"></em>`+(M?`<button type="button" class="dt-folder-more" aria-label="Folder menu">${$t('<circle cx="5" cy="10" r="1" /><circle cx="10" cy="10" r="1" /><circle cx="15" cy="10" r="1" />',14)}</button>`:"")+`</div><ul${u?"":" hidden"}>${T.map(P=>l(P,p+1)).join("")}${b.map(P=>r(P,p+1)).join("")}${b.length||T.length?"":`<li class="dt-folder-empty" style="--d:${p+1}">Empty \u2014 drag pages here</li>`}</ul></li>`};G.innerHTML=o(null).map(d=>l(d,0)).join("")+n.pages.filter(d=>!e.has(d.route)).map(d=>r(d,0)).join(""),document.querySelector(".dt-pages-foot").hidden=!M,_t()};Dt();let E=document.querySelector(".dt-pages");E&&!E.querySelector("li")&&E.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let x=[...document.querySelectorAll(".devtools details, .dt-strip details")],H=!1,q=t=>ss(t,()=>{t.open=!1}),D=()=>{let t=x.filter(e=>e.open&&!e.hasAttribute("data-leaving"));for(let e of t)q(e);return t};for(let t of x)t.querySelector(":scope > summary")?.addEventListener("click",e=>{t.open&&t.hasAttribute("data-leaving")?(e.preventDefault(),Io(t)):t.open&&(e.preventDefault(),q(t))});document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=D();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{H=x.some(e=>e.open&&!e.contains(t.target))&&D().length>0},!0),addEventListener("blur",D);let ut=document.querySelector(".dt-pad-overlay"),Et="dt-inspect",st=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),et=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-elsewhere",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),rt={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),contrast:document.querySelector(".dt-contrast-btn"),border:document.querySelector(".dt-border-btn")},gt="",At=0,{spacer:$e,drawPads:je,drawSize:ke,drawType:Vt,drawColor:he,drawBorder:He,drawContrast:be,contrastFix:_e,markCopied:Ms}=su(ut),qn=null,R=()=>{qn&>&&O(qn)},O=t=>{qn=t,!At&&(At=requestAnimationFrame(()=>{At=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(st)){ut.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),gt==="sizes"?ke(e):gt==="type"?Vt(e):gt==="color"?he(e):gt==="contrast"?be(e):gt==="border"?He(e):je(t.altKey?e:$e(e))}))},Y=t=>{gt=t;for(let[e,s]of Object.entries(rt))s.setAttribute("aria-pressed",String(e===t));z(Et,t),Ue({inspect:t}),ut.hidden=!t,ut.innerHTML="",t?(document.addEventListener("mousemove",O),addEventListener("scroll",R,!0),addEventListener("resize",R)):(document.removeEventListener("mousemove",O),removeEventListener("scroll",R,!0),removeEventListener("resize",R))};document.addEventListener("click",t=>{gt!=="contrast"||!_e()||t.target.closest?.(st)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(_e()).catch(()=>{}),Ms(),R())},!0);for(let[t,e]of Object.entries(rt))e.addEventListener("click",()=>{t!==gt&&sn(!1),Y(gt===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Ut)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let s=o=>{k&&parent.postMessage({dt:!0,...o},location.origin)};gt?(Y(""),s({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):St.hidden||(ft(!1),s({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let Nt=document.querySelector(".dt-notes-btn"),Kt=[...document.querySelectorAll(".dt-bp")],xe=document.querySelector(".dt-history-btn"),it=document.querySelector(".dt-history"),ye=document.querySelector(".dt-elsewhere"),os=document.querySelector(".dt-studio-btn"),as=document.querySelector(".dt-devices"),is=document.querySelector(".dt-notes-hi"),Nu=is.querySelector(".dt-hi-box"),zr=is.querySelector(".dt-hi-tag"),Sn=document.querySelector(".dt-frame"),Xe=document.createElement("div");Xe.className="dt-spot",Xe.hidden=!0,Xe.setAttribute("aria-hidden","true"),document.body.append(Xe);let Bu=t=>{if(!t||!Ut){Xe.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;Xe.style.setProperty("--spot-x",`${e.left-s}px`),Xe.style.setProperty("--spot-y",`${e.top-s}px`),Xe.style.setProperty("--spot-w",`${e.width+s*2}px`),Xe.style.setProperty("--spot-h",`${e.height+s*2}px`),Xe.hidden&&(is.hidden=!0),Xe.hidden=!1},Ys=Sn.querySelector("iframe");Ys.addEventListener("load",$),new MutationObserver($).observe(Sn,{attributes:!0,attributeFilter:["hidden"]});let Ua=document.querySelector(".dt-notes-count"),nt=document.querySelector(".dt-notes-overlay"),Xs=".devtools, .dt-tab, .dt-strip, .dt-strip-tab, .dt-strip-grip, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Ya=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(Xs).forEach(Ya);let Vr="dt-notes",j=[],Ut=!1,X=null,B=null,Xa=0,Pe="",Ru=(t,e,s)=>{if(s>160&&s<innerHeight-120)return!1;let o=document.elementsFromPoint(e,s).find(a=>!In(a)&&a!==document.documentElement&&a!==document.body);if(!o||o===t||t.contains(o)||o.contains(t))return!1;for(let a=o;a&&a!==document.body;a=a.parentElement){let r=getComputedStyle(a).position;if(r==="fixed"||r==="sticky")return!a.contains(t)}return!1},Gr=new WeakSet,_o=null,Wo=null,We={},zo=" \xB7 hidden \u2014 inside something closed",Vo=t=>{t.toggleAttribute("data-up",t.scrollTop>2),t.toggleAttribute("data-more",t.scrollTop+t.clientHeight<t.scrollHeight-2)};nt.addEventListener("scroll",t=>{let e=t.target;e.classList?.contains("dt-note-thread")&&Vo(e)},!0),nt.addEventListener("load",t=>{let e=t.target.closest?.(".dt-note-thread");e&&Vo(e)},!0),nt.addEventListener("scroll",t=>{let e=t.target;if(!e.classList?.contains("dt-note-thread")||e.scrollTop+e.clientHeight<e.scrollHeight-4)return;let s=e.parentElement?.querySelector(".dt-new-below");s&&(delete We[s.dataset.id],s.remove())},!0);let Le=[],te=null,ze=[],Pu=10,Js=(t=B)=>!!(t&&((t.text?.trim().length??0)>=Pu||t.images?.length)),rn=()=>{B&&Js()&&ze.push(B),B=null},Kr=0,Zs=()=>{if(!Js()||performance.now()-Kr<4e3)return!0;Kr=performance.now();let t=nt.querySelector(".dt-note[data-draft]");return t&&Oo(t,"no"),t?.querySelector(".dt-note-input")?.focus(),Gt("Not sent \u2014 close again to keep it as a draft",2400),!1},fn=null,Ja=new Map,Za=null,Ur=()=>`dt-draft:${n.me?.email??""}:${xt}${k?":canvas":""}`,Tn=Ur(),Go=0,Qs=()=>{if(!B&&!ze.length&&!Pe){ct.removeItem(Tn);return}let t={draft:B,parked:ze,reply:Pe?{for:fn,text:Pe}:null};try{localStorage.setItem(Tn,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(Tn,JSON.stringify({...t,draft:B&&e(B),parked:ze.map(e)}))}catch{}}},rs=()=>{clearTimeout(Go),Go=setTimeout(Qs,200)};addEventListener("pagehide",()=>{clearTimeout(Go),Qs();try{sessionStorage.setItem(`nm-open:${Tn}`,X==null?"":String(X))}catch{}});let Ve=ct.getItem("dt-space")==="clients"?"clients":"studio",Je=()=>!!n.me&&!n.client,An=t=>!Je()||Ve==="clients"===Bt(t),Yr=["all","nobody","mine","others","resolved","claude","wrote","check"],Hn=Yr.find(t=>t===ct.getItem("dt-pinf"))??"all",Qa=()=>{},Ko=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Ze=ct.getItem("dt-resolved")!=="0",bn=ct.getItem("dt-archived")==="1",Se=t=>_c(t,n.autoArchive),Uo=t=>Se(t)?bn:Ct(t)!=="done"||Ze,oe={q:"",menu:!1,more:!1,view:["me","agent"].includes(ct.getItem("dt-view")??"")?ct.getItem("dt-view"):"all",sort:["old","reply","unread"].includes(ct.getItem("dt-sort")??"")?ct.getItem("dt-sort"):"new"},Dn=null,Yo=t=>yt.find(e=>e.from?.id===t.id&&Gs(e)),ti=t=>Gs(t)?yt.find(e=>e.id===t.from.id&&Bt(e)):void 0,Ie=null,Xo=null,Jo=()=>Je()&&Ve==="clients",ks=t=>Jo()&&Bt(t)&&Ct(t)==="open"&&!Yo(t),Zo='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="2.5"/><path d="M10 3.5v13"/></svg>',Iu=t=>{let e=n.client?void 0:ti(t);if(!e)return"";let s=Oc(e);return`<button type="button" class="dt-field dt-field--bare dt-field--client" data-act="open-orig" data-id="${e.id}" data-tip="What the client sees now \u2014 open their thread" aria-label="The client sees: ${f(s)}. Open their thread"><span class="dt-field-box"><svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true">${Pr.clients}</svg><span class="dt-field-label">Client \xB7 ${f(s)}</span><svg class="dt-field-ext" viewBox="0 0 24 24" width="11" height="11" aria-hidden="true"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg></span></button>`},Ou=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],qu=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Du=()=>{let t=navigator.userAgent,e=r=>r.find(([l])=>l.test(t)),s=e(Ou),o=e(qu),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},ei=()=>C(innerWidth,innerHeight),Yt=()=>Za??ei(),Xr=()=>{let t=Yt();for(let e of Kt)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:ni,poolOf:si,contextOf:oi,resolveEl:Fu,anchorOf:ju,anchorState:_u,fingerprintOf:Qo}=iu(),Ls=new Map,ta=()=>{Ls=new Map},Jr=t=>JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth,t.fp]),Qe=t=>{let e=Jr(t),s=Ls.get(e);return(s===void 0||s.el&&!s.el.isConnected)&&(s={el:Fu(t),st:_u(t)},Ls.set(e,s)),s.el},ai=t=>(Qe(t),Ls.get(Jr(t))?.st??"found"),to=0,eo=null,ea="",Zr=()=>{to=Math.max(to,scrollY+innerHeight)},Qr=(t,e)=>e==="gone"&&(Zr(),to<document.documentElement.scrollHeight-1&&(!t.spot||t.spot.y>to));addEventListener("scroll",()=>{Zr(),eo!=null&&to>=eo-1&&(eo=null,setTimeout(()=>{ta(),Z(),Am()},600))},{capture:!0,passive:!0});let Wu=t=>{let e=ai(t);return(Qr(t,e)?"later":e)+(Ce(t)?"":" \xB7 no pin")},ii=null,tl=t=>{ii=t.id??null,scrollTo({top:t.spot?Math.max(0,t.spot.y-innerHeight/2):document.documentElement.scrollHeight,behavior:"smooth"})},ri=[];document.addEventListener("pointerdown",t=>{let e=t.target;e instanceof Element&&!In(e)&&!e.closest(".devtools")&&(ri=[ri.at(-1),{el:e,t:Date.now()}].filter(Boolean))},!0);let zu='[role=menu],[role=listbox],[role=dialog],[role=tooltip],dialog,[popover],[aria-modal],[data-state="open"],[data-radix-popper-content-wrapper],details[open]>:not(summary)',Vu=t=>{let e=[...ri].reverse().find(l=>!t.contains(l.el)&&!l.el.contains(t));if(!e||Date.now()-e.t>6e5)return null;let s=e.el.closest("button,a,[role=button],summary,[aria-haspopup],[aria-expanded],[aria-controls]");if(!s||!s.isConnected||s.contains(t)||t.contains(s)||In(s))return null;let o=t.closest(zu);if(o?.contains(s)||!o&&s.getAttribute("aria-expanded")!=="true"&&!s.matches("summary,[aria-haspopup]"))return null;let a=s.tagName.toLowerCase(),r=[...s.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ni(s),tag:a,classes:r,nth:si({tag:a,classes:r}).indexOf(s),label:Jt(re(s.textContent||""),60),ctx:oi(s),fp:Qo(s),rx:.5,ry:.5}},na=new Map,Ce=t=>{na.size||requestAnimationFrame(()=>na.clear());let e=na.get(t);return e===void 0&&(e=ju(t,Qe(t)),na.set(t,e)),e},el=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},sa=[],li=t=>{for(let e of sa)e.play();sa=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),sa.push(s))},di=()=>{if(B)return Qe(B);let t=X!=null?j.find(s=>s.id===X):null;if(!t)return null;let e=Ce(t);return e&&!e.hidden?Qe(t):null},nl="claude",Gu=()=>(n.client||Ve==="clients"?n.team??[]:ca()).filter(t=>!Tr(t.email)),Ku=()=>Gu().filter(t=>t.email!==n.me?.email),no=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...Ku()],sl='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="10" cy="10" r="6.5" stroke-dasharray="2.4 2.4"/></svg>',ci=(t,e)=>{let s=e==="agent"?nl:e==="me"?n.me?.email??"":"";if(!t){if(!B)return;B.assignee=s,B.stage=Xt(s)?"approved":!B.stage||B.stage==="approved"?"new":B.stage,so(s),B.carried=!1,rs(),Z();return}oa(t,s)},oa=(t,e)=>{let s=j.find(r=>r.id===t);if(s&&hn(s)&&!Xt(e)&&!confirm("The agent is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?De(s):"new",a=Xt(e)?"approved":o==="approved"?"new":o;dn(r=>r.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>tt({id:t,assignee:e||null,stage:a}),Xt(e)?"Approving it for the agent":"Reassigning")},Uu=(t,e)=>{if(e&&ct.setItem("nm-for",e),!t){if(!B)return;B.assignee=e,B.stage==="approved"&&(B.stage="new"),so(e),B.carried=!1,rs(),Z();return}oa(t,e)},Yu='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9M15.5 4v3.5H12" stroke-linecap="round" stroke-linejoin="round"/></svg>',so=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e&&!Xt(e)&&no().some(s=>s.email===e)?e:null}catch{return null}},ol=t=>Xt(t)?"#d97757":t?"#0d99ff":"#717171",yn=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],ln=t=>t?n.team?.find(e=>e.email===t):void 0,aa=t=>{let e=re(t??"").split(/\s+/).filter(Boolean);return f(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},Fn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${f(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${aa(e)}</b>`,ui=t=>{let e=ln(t.by);return e||t.byName?Fn(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},Oe=t=>`var(--dt-avatar-${ln(t)?.avatar_hue??[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,vn=(t,e)=>{let s=ln(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return Fn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${Oe(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},al=()=>n.me?`${vn(n.me.email.toLowerCase(),{by:n.me.email,byName:n.me.name})}<i class="dt-pin-cut" aria-hidden="true">${es}</i>`:es,ls=new Map,pi=new Map,il=0,Xu=(t,e)=>{let s=e==="found"?null:e;n.client||k||t.id<=0||(t.anchor??null)===s||ls.get(t.id)===s||(ls.set(t.id,s),pi.set(t.id,s),clearTimeout(il),il=window.setTimeout(()=>{for(let[o,a]of pi){let r=j.find(d=>d.id===o),l=r?ai(r):"found";if(!r||(l==="found"?null:l)!==a){ls.delete(o);continue}tt({id:o,anchor:a}).then(d=>{if(d.ok){let p=j.find(u=>u.id===o);p&&(p.anchor=a)}}).catch(()=>ls.delete(o))}pi.clear()},4e3))},Ju=t=>{let e=!!Qe(t)?.getClientRects().length;return`<div class="dt-note-hidden dt-note-away"><b>${ao}<span>${e?"Scrolled out of view":"Hidden right now"}</span></b>${e?`<button type="button" data-act="show-el" data-id="${t.id}">Show it</button>`:""}</div>`},Zu=(t,e,s,o)=>{let a=(d,p,u=!1)=>`<button type="button" class="dt-lost-btn${u?" is-main":""}" data-act="${d}" data-id="${t.id}">${p}</button>`,r=(d,p,u)=>`<button type="button" class="dt-lost-btn dt-lost-ico" data-act="${d}" data-id="${t.id}" data-tip="${u}" aria-label="${u}">${p}</button>`,l=!n.client;if(o&&s==="later")return`<div class="dt-note-hidden dt-note-away"><b>${ao}<span>Further down the page</span></b><button type="button" data-act="go-spot" data-id="${t.id}">Show it</button></div>`;if(o&&s==="gone"){let d=Ec(t).before,p=Ct(t)!=="open";return`<div class="dt-lost dt-lost--gone"><p>${p?"Not on the page now. The thread stays: answer or reopen it here.":d?"Not on the page now \u2014 here is how it looked. Pin it to something else, or close the thread.":"Not on the page now. Pin it to something else, or close the thread."}</p>${d?`<img class="dt-lost-shot" src="${f(wr(d.split("/").pop()))}" alt="How the element looked" loading="lazy">`:""}${p?"":`<span class="dt-lost-acts">${Is(t)?a("repin","Re-pin",!0):""}${r("lost-resolve",Me,"Resolve")}${l?r("archive",kn,"Archive"):""}</span>`}</div>`}return e?.opener?`<div class="dt-note-hidden dt-note-away"><b>${ao}<span>In ${f(vo(e.opener))} \u2014 closed</span></b><button type="button" data-act="open-it" data-id="${t.id}">Show it</button></div>`:""},mi=(t,e)=>ln(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],ia={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},jn=(()=>{try{return JSON.parse(ct.getItem("dt-seen")||"{}")}catch{return{}}})(),hi=()=>z("dt-seen",JSON.stringify(jn)),rl=t=>{let e=an(t);if(!(t.id in jn))return jn[t.id]=e.length,hi(),!1;let s=e[e.length-1];return e.length>jn[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},ll=t=>{let e=an(t).length;jn[t.id]!==e&&(jn[t.id]=e,hi())},Qu=t=>{let e=ln(t);return e?` data-face="${f(e.avatar_url??"")}" data-initial="${aa(e.name||e.email)}"`:""},tp=t=>n.client||Bt(t)||Ct(t)==="done"?"":pl(t,t.assignee??"",t.id),ep=t=>{let e=Ct(t)==="done";return`<button type="button" class="dt-hist-tick" data-act="${e?"reopen":"done"}" data-id="${t.id}" data-tip="${e?"Reopen":Ct(t)==="claude"?"Looks right \u2014 resolve":"Resolve"}" aria-label="${e?"Reopen":"Resolve"}">${e?gn:Me}</button>`},np=t=>{let e=(t.replies??[]).filter(a=>!a.deleted);if(!e.length)return"";let s=[...new Set(e.map(a=>a.author==="claude"?"@agent":(a.by||"you").toLowerCase()))];return`<span class="dt-hist-replied"><span class="dt-hist-faces">${s.slice(0,3).map(a=>a==="@agent"?`<span class="dt-hist-face is-agent">${Fe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Oe(a)}">${vn(a,t)}</span>`).join("")}${s.length>3?`<i>+${s.length-3}</i>`:""}</span>${e.length} ${e.length===1?"reply":"replies"}</span>`},sp=t=>{if(Dn!==t.id)return"";let e=(l,d,p,u="")=>`<button type="button" role="menuitem" ${l} class="${u}"><i>${d}</i><span>${p}</span></button>`,s='<svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><circle cx="10" cy="10" r="2" fill="currentColor" stroke="none"/></svg>',o='<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="3"/><path d="m7 10.2 2.2 2.2L13.2 8"/></svg>',a=Se(t),r=!n.client;return`<div class="dt-hist-menu is-row" role="menu">${r&&!Bt(t)?`<div class="dt-hist-assign"><span>Assign</span>${ul(t.assignee??"",t.id)}</div><hr>`:""}${e(`data-row-unread="${t.id}"`,s,"Mark as unread")}${e(`data-row-link="${t.id}"`,wi,"Copy link")}${Jo()?e(`data-row-select="${t.id}"`,o,"Select")+(ks(t)?e(`data-row-mirror="${t.id}"`,Zo,"Mirror to Team"):""):""}${r&&Je()&&!t.client?e(`data-row-move="${t.id}"`,vi,Bt(t)?"Move to Team":"Move to Client"):""}${r||!As(t)?"<hr>":""}${r?e(`data-act="${a?"unarchive":"archive"}" data-id="${t.id}"`,a?gn:kn,a?"Unarchive":"Archive"):""}${As(t)?"":e(`data-rm="${t.id}"`,ts,"Delete thread","is-danger")}</div>`},dl={queued:"#0d99ff",working:"#f5a623",asks:"#e93d82",stuck:"#e5402c",review:"#8e4ec6"};pu(t=>{if(t.matches(".dt-hist-go[data-go]")){let b=j.find(Pt=>Pt.id===Number(t.dataset.go)),T=b&&[...b.replies??[]].reverse().find(Pt=>!Pt.deleted);if(!b||!T)return null;let P=T.author==="claude",m=(T.by||"you").toLowerCase(),_=P?Nn(b):T.by?T.by===n.me?.email?"You":yn(T.by):"You",Q=P?`<span class="dt-hist-face is-agent">${Fe(11)}</span>`:`<span class="dt-hist-face" style="--hue:${Oe(m)}">${vn(m,b)}</span>`,Ot=(T.images?.length?'<span class="dt-peek-chip">Picture</span>':"")+(T.files?.length?'<span class="dt-peek-chip">File</span>':"")+(T.audio?'<span class="dt-peek-chip">Voice note</span>':"");return`<span class="dt-peek-head"><span class="dt-peek-people">${Q}</span><b>${f(_)}</b>${P?`<em>${f(kr(T.agent)||"")}</em>`:""}${T.editedAt?"<em>edited</em>":""}<em>${Qn(T.at)}</em></span>`+(T.text?`<span class="dt-peek-text is-reply">${f(Jt(T.text,320))}</span>`:"")+(Ot?`<span class="dt-peek-files">${Ot}</span>`:"")}if(X!=null||!t.matches(".dt-pin[data-id]"))return null;let e=j.find(b=>b.id===Number(t.dataset.id));if(!e)return null;let s=[...new Set([e.by,...(e.replies??[]).filter(b=>b.author!=="claude").map(b=>b.by)].filter(Boolean).map(b=>b.toLowerCase()))].slice(0,3),o=Ct(e),a=n.client||Bt(e)||o==="done"?null:Ee(e),r=a&&dl[a]&&(Xt(e.assignee)||a==="review")?a:null,l=_n.find(b=>b[0]===ds(e)),[d,p]=o==="done"?Se(e)?["#717171","Archived"]:["#30a46c","Resolved"]:r?[dl[r],`${Nn(e)}${gi(e)}`]:[l[2],l[1]],u=e.replies?.length??0;return`<span class="dt-peek-head">${s.length?`<span class="dt-peek-people">${s.map(b=>`<span class="dt-hist-face" style="--hue:${Oe(b)}">${vn(b,e)}</span>`).join("")}</span>`:""}<b>${f(e.byName||"You")}</b><em>\xB7 ${Qn(e.createdAt)}</em></span><span class="dt-peek-text">${f(Jt(e.text,240))}</span><span class="dt-peek-foot">${Ye(d,o==="done"?1:0)}<span>${f(p)}${u?` \xB7 ${u} ${u===1?"reply":"replies"}`:""}</span></span>`});let gi=t=>{let e=Ee(t),s=Hr(t);return e==="working"?s?.step?` \xB7 ${Ar(s.step)} \xB7 ${s.elapsed}`:" is working":e==="stuck"?` went quiet \xB7 ${s?.silent??""}${s?.step?` \xB7 last: ${s.step}`:""}`:e==="queued"?" \xB7 queued \xB7 next run":e==="asks"?" asks you \xB7 answer in the thread":e==="review"?" fixed it \xB7 to check":""},op=t=>{let e=ln(t);return e?Fn(e.avatar_url,e.name||e.email):""},cl=(t,e,s={})=>`<option value="${f(t)}"${s.dot?` data-c="${ol(t)}"`:""}${Qu(t||null)}${s.selected?" selected":""}>${f(e)}</option>`,ul=(t,e,s=!1)=>{let o=Xt(t),a=o?"":t,r=ln(a),l=r?r.avatar_url?`<img class="dt-owner-face" src="${f(r.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${Oe(a.toLowerCase())}" aria-hidden="true">${aa(r.name||r.email)}</b>`:a?bl:sl,d=a?r?.name||yn(a):"Anyone",p=T=>{let P=ln(T);return P?.avatar_url?`<img class="dt-menu-face" src="${f(P.avatar_url)}" alt="">`:`<b class="dt-menu-face" style="--hue:${Oe(T.toLowerCase())}">${[...aa(P?.name||T)][0]}</b>`},u=(T,P,m="")=>`<option value="${f(T)}" data-icon="${f(T?p(T):sl)}"${m?` data-hint="${f(m)}"`:""}${T===a?" selected":""}${T?"":" data-sep-after"}>${f(P)}</option>`,b=no();return`<label class="dt-owner${r?" has-face":""}${s?" is-compact":""}" data-tip="${o?"The agent has it \u2014 pick a person to hand it over":s?f(d):"Who takes it"}">${l}${s?"":`<span class="dt-owner-name">${f(d)}</span>`}${ra}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
|
|
262
|
-
${u("","Anyone")}${b.map(
|
|
263
|
-
</select></label>`},
|
|
264
|
-
`).find(s=>re(s))??"");return e?e.length>30?`${Jt(e,30)}\u2026`:e:t?.tagName.toLowerCase()??""},
|
|
261
|
+
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Pn}</button>`,tt.hidden=!1};tt.addEventListener("click",async at=>{let vt=at.target.closest("[data-r]"),It=dt();if(!vt||!It)return;if(vt.dataset.r==="stop"){J(null),tt.hidden=!0;return}if(vt.dataset.r==="prev"){St();return}let qt=It.ids[It.i];J({...It,i:It.i+1});let Lt=c().find(fe=>fe.id===qt),pe=vt.dataset.r==="ok"&&Lt?A(Lt):vt.dataset.r==="no"?y(qt,!1):null;Wt(),await pe});let St=()=>{let at=dt();if(at){for(let vt=at.i-1;vt>=0;vt--)if(k(at.ids[vt])){J({...at,i:vt}),Wt();return}}};return document.addEventListener("keydown",at=>{tt.hidden||at.metaKey||at.ctrlKey||at.altKey||at.key!=="ArrowLeft"&&at.key!=="ArrowRight"||at.target.closest?.("input, textarea, select, [contenteditable]")||(at.preventDefault(),at.key==="ArrowLeft"?St():tt.querySelector('[data-r="skip"]')?.click())}),{start:xt,toCheck:F,resume:()=>{dt()&&Wt()}}}function Eu(n,r){let c=null,h=null,g=document.querySelector(".dt-turbo"),y="/notemend:turbo",T=()=>{let C=!!c&&Date.now()-Date.parse(c.at)<18e4,w=C?c.mode==="push"?"push":h?.paused?"paused":"on":"none",A=C?Zn(c.agent):"",k=w==="none"?`Turbo is off. Run ${y} in Claude Code and threads for the agent are taken as they land \u2014 click to copy it`:w==="push"?`Push mode: ${A} takes threads when you press Push to the agent. For live, run ${y} instead`:w==="on"?`Turbo on: ${A} takes threads for the agent as they land \u2014 click to pause`:`Turbo paused: ${A} is listening but waits \u2014 click to resume`;g.dataset.state=w,g.dataset.tip=k,g.setAttribute("aria-label",k),g.setAttribute("aria-checked",String(w==="on")),n&&(g.hidden=!0)};return setInterval(T,3e4),g.addEventListener("click",async()=>{let C=g.dataset.state;if(C==="none"||C==="push"){await navigator.clipboard?.writeText(y).catch(()=>{}),r(`Copied ${y} \u2014 paste it in Claude Code`);return}let w=C==="on"?"off":"on";h={paused:w==="off"},T();try{let A=await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:w})});if(!A.ok)throw new Error(String(A.status));r(w==="off"?"Turbo paused":"Turbo on")}catch{h={paused:w==="on"},T(),r("Could not switch turbo \u2014 try again")}}),C=>{c=C.listening??null,h=C.turbo??null,T()}}var Lh=new Set(["data-wired","data-nudge"]),Sh=".dt-note",Mu=n=>n instanceof Element&&n.hasAttribute("data-ghost"),jo=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},ku=(n,r)=>n.nodeType===r.nodeType&&n.nodeName===r.nodeName&&jo(n)===jo(r);function Th(n,r){for(let{name:c}of[...n.attributes])!r.hasAttribute(c)&&!Lh.has(c)&&n.removeAttribute(c);for(let{name:c,value:h}of r.attributes)n.getAttribute(c)!==h&&n.setAttribute(c,h);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 Lu(n,r){let c=[...n.childNodes].filter(w=>!Mu(w)),h=new Map;for(let w of c){let A=jo(w);A&&h.set(A,w)}let g=new Set,y=0,T=[];for(let w of[...r.childNodes]){let A=jo(w),k=A?h.get(A):void 0;if(!A){for(;y<c.length&&(g.has(c[y])||jo(c[y]));)y++;y<c.length&&ku(c[y],w)&&(k=c[y++])}k&&!g.has(k)&&ku(k,w)?(g.add(k),Ah(k,w),T.push(k)):T.push(w)}for(let w of c)g.has(w)||(w instanceof HTMLElement&&w.matches(Sh)&&uu(w),n.removeChild(w));let C=n.firstChild;for(let w of T){for(;C&&Mu(C);)C=C.nextSibling;if(w===C){C=C.nextSibling;continue}n.insertBefore(w,C)}}function Ah(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(Th(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}Lu(n,r),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==r.value&&(n.value=r.value)}}function Fr(n,r){let c=document.createElement("template");c.innerHTML=r,Lu(n,c.content)}function Su(n,r,c=!1){let h=n.breakpoints,g=n.categories,y=(h.find(t=>!Number.isFinite(t.max))??h[0]).id,T=t=>h.find(e=>t>=e.min&&t<=e.max)?.id??y,C=(t,e)=>{let s=T(t);if(Gs||!matchMedia("(pointer: coarse)").matches)return s;let o=[...h].sort((l,d)=>l.min-d.min),a=e<500?T(767):(o[o.length-2]??o[0]).id,i=l=>o.findIndex(d=>d.id===l);return i(s)>i(a)?a:s},w=t=>t.breakpoint||y,A=t=>n.devices.find(e=>e.id===t),k=Gs,z=(t,e)=>{k||ct.setItem(t,e)},dt=null,J=["stage","status","priority","assignee"],tt=t=>{let e=(dt??j).find(a=>a.id===t.id),s=J.filter(a=>a in t||(a==="stage"||a==="status")&&("stage"in t||"status"in t)),o=e&&s.length&&!t.reply?Object.fromEntries(s.map(a=>[a,e[a]??null])):void 0;return ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(o?{...t,seen:o}:t)})},F=t=>t.replace(/\/+$/,"")||"/",xt=F(location.pathname);for(let t of document.querySelectorAll(".devtools .dt-icon[title]"))t.dataset.tip=t.title,t.getAttribute("aria-label")||t.setAttribute("aria-label",t.title),t.removeAttribute("title");let Wt=document.querySelector(".dt-grid-btn"),St=document.querySelector(".dt-grid-overlay"),at=St.querySelector(".dt-overlay-grid"),vt=St.querySelector(".dt-grid-chip"),It="dt-grid",qt=n.projectGrid??null,Lt=()=>C(innerWidth,innerHeight),pe=()=>qt?.mode==="custom"?qt.widths?.[Lt()]??null:null,fe=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),Qt=t=>fe(t).length,me=()=>{let t=St.hidden;t&&(St.style.visibility="hidden",St.hidden=!1);try{return Ln()}finally{t&&(St.hidden=!0,St.style.visibility="")}},Ln=()=>{let t=document.documentElement.clientWidth;St.classList.remove("is-auto");let e=getComputedStyle(at);if(e.display==="grid"&&Qt(e)>1){let i=at.getBoundingClientRect();return{cols:Qt(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(Js)||St.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 u=parseFloat(d.paddingLeft)||0;s={x:l.left+u,w:l.width-u-(parseFloat(d.paddingRight)||0)}}if(l.width<=(o?.w??0))continue;let p=d.display.endsWith("grid")?fe(d):[];if(p.length>1){if(!p.every(b=>Math.abs(b-p[0])<2))continue;let u=parseFloat(d.columnGap)||0;o={cols:p.length,gap:u,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:p.reduce((b,S)=>b+S,0)+u*(p.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let u=[...i.children].map(S=>S.getBoundingClientRect()).filter(S=>S.width&&S.height),b=u.filter(S=>Math.abs(S.top-u[0].top)<2).sort((S,P)=>S.left-P.left);b.length>1&&b.every(S=>Math.abs(S.width-b[0].width)<2)&&(o={cols:b.length,gap:Math.max(0,b[1].left-b[0].right),x:b[0].left,w:b.at(-1).right-b[0].left})}}let a=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"})},Vt=null,Re=(t,e,s,o)=>{St.classList.add("is-auto"),at.children.length!==t&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),St.style.setProperty("--grid-x",`${s}px`),St.style.setProperty("--grid-w",`${o}px`),St.style.setProperty("--grid-gap",`${e}px`)},we=()=>{let t=pe(),e=vt.querySelector("span");if(vt.querySelector("button").hidden=!t||k,t){let s=document.documentElement.clientWidth,o=Math.max(0,Math.min(t.max??1/0,s-2*t.margin));Re(t.cols,t.gutter,(s-o)/2,o),e.textContent="Project grid \xB7";return}at.children.length!==n.grid.columns&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(n.grid.columns)),Vt=me(),Vt.from!=="site"&&Re(Vt.cols,Vt.gap,Vt.x,Vt.w),e.textContent=Vt.from==="guess"?`Guessed \xB7 ${Vt.cols} \xD7 ${Vt.w}`:`From the page \xB7 ${Vt.cols} \xD7 ${Vt.w} \xB7 gap ${Vt.gap}`},N=()=>{vt.classList.remove("is-lifted");let t=vt.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();vt.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},ft=t=>{St.hidden=!t,t&&(we(),N()),Wt.setAttribute("aria-pressed",String(t)),z(It,t?"1":"0"),Ye({grid:t})};Wt.addEventListener("click",()=>ft(St.hidden===!0)),addEventListener("resize",()=>{St.hidden||(we(),N())});let Rt=document.querySelector(".dt-pages-name"),jt=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:F(t.location.pathname),title:t.document.title}:null}catch{return null}},ne=()=>{let t=document.querySelector(".dt-pages-here"),e=document.querySelector('.dt-pages-list a[aria-current="page"] .dt-pages-n');t&&(t.innerHTML=e?.innerHTML??"",t.hidden=!e||e.hidden,t.title=e?.title??"")},$=()=>{let e=jt()?.route??xt,s=null;for(let l of document.querySelectorAll(".dt-pages a"))F(new URL(l.href).pathname)===e?(l.setAttribute("aria-current","page"),s=l):l.removeAttribute("aria-current");ne();let i=(s?.querySelector(".dt-menu-label")?.textContent?.trim()||e).trim().split(/\s+/);Rt.textContent=e==="/"?"":e.replace(/^\//,""),Rt.closest("summary").toggleAttribute("data-home",e==="/")},M=(!!n.gridAdmin||!!n.arrange)&&!n.client,L=(n.folders??[]).filter(t=>t&&typeof t.name=="string"&&Array.isArray(t.pages)),V=new Set((()=>{try{return JSON.parse(ct.getItem("dt-folders-open")||"[]")}catch{return[]}})()),U=new Set((()=>{try{return JSON.parse(ct.getItem("dt-folders-closed")||"[]")}catch{return[]}})()),G=document.querySelector(".dt-pages-list"),_t=()=>$(),se=t=>$t(t?'<path d="M2.5 15.5V5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H15A1.5 1.5 0 0 1 16.5 7v1.5M2.5 15.5l2.2-6A1.5 1.5 0 0 1 6.1 8.5h11.2l-2.5 7z" />':'<path d="M2.5 5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H16A1.5 1.5 0 0 1 17.5 7v7.5A1.5 1.5 0 0 1 16 16H4a1.5 1.5 0 0 1-1.5-1.5z" />',14),Dt=()=>{let t=new Map(n.pages.map(d=>[d.route,d])),e=new Set(L.flatMap(d=>d.pages)),s=d=>Yc(n,d,xt,M),o=d=>L.filter(p=>(p.parent&&L.some(u=>u.id===p.parent)?p.parent:null)===d),a=d=>d.pages.includes(xt)||o(d.id).some(a),i=(d,p)=>s(d).replace("<li",`<li style="--d:${p}"`),l=(d,p)=>{let u=V.has(d.id)||!U.has(d.id)&&a(d),b=d.pages.map(P=>t.get(P)).filter(P=>!!P),S=o(d.id);return`<li class="dt-folder" data-folder="${f(d.id)}" style="--d:${p}"${u?" data-open":""}${M?' draggable="true"':""}><div class="dt-folder-row" role="button" tabindex="0" aria-expanded="${u}">${Ro}${se(u)}<span class="dt-menu-label">${f(d.name)}</span><em class="dt-folder-n"></em>`+(M?`<button type="button" class="dt-folder-more" aria-label="Folder menu">${$t('<circle cx="5" cy="10" r="1" /><circle cx="10" cy="10" r="1" /><circle cx="15" cy="10" r="1" />',14)}</button>`:"")+`</div><ul${u?"":" hidden"}>${S.map(P=>l(P,p+1)).join("")}${b.map(P=>i(P,p+1)).join("")}${b.length||S.length?"":`<li class="dt-folder-empty" style="--d:${p+1}">Empty \u2014 drag pages here</li>`}</ul></li>`};G.innerHTML=o(null).map(d=>l(d,0)).join("")+n.pages.filter(d=>!e.has(d.route)).map(d=>i(d,0)).join(""),document.querySelector(".dt-pages-foot").hidden=!M,_t()};Dt();let E=document.querySelector(".dt-pages");E&&!E.querySelector("li")&&E.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let x=[...document.querySelectorAll(".devtools details, .dt-strip details")],H=!1,q=t=>ss(t,()=>{t.open=!1}),D=()=>{let t=x.filter(e=>e.open&&!e.hasAttribute("data-leaving"));for(let e of t)q(e);return t};for(let t of x)t.querySelector(":scope > summary")?.addEventListener("click",e=>{t.open&&t.hasAttribute("data-leaving")?(e.preventDefault(),Oo(t)):t.open&&(e.preventDefault(),q(t))});document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=D();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{H=x.some(e=>e.open&&!e.contains(t.target))&&D().length>0},!0),addEventListener("blur",D);let ut=document.querySelector(".dt-pad-overlay"),Et="dt-inspect",st=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),et=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-elsewhere",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),rt={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),contrast:document.querySelector(".dt-contrast-btn"),border:document.querySelector(".dt-border-btn")},gt="",At=0,{spacer:$e,drawPads:je,drawSize:ke,drawType:Gt,drawColor:he,drawBorder:He,drawContrast:be,contrastFix:_e,markCopied:Ms}=au(ut),qn=null,R=()=>{qn&>&&O(qn)},O=t=>{qn=t,!At&&(At=requestAnimationFrame(()=>{At=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(st)){ut.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),gt==="sizes"?ke(e):gt==="type"?Gt(e):gt==="color"?he(e):gt==="contrast"?be(e):gt==="border"?He(e):je(t.altKey?e:$e(e))}))},Y=t=>{gt=t;for(let[e,s]of Object.entries(rt))s.setAttribute("aria-pressed",String(e===t));z(Et,t),Ye({inspect:t}),ut.hidden=!t,ut.innerHTML="",t?(document.addEventListener("mousemove",O),addEventListener("scroll",R,!0),addEventListener("resize",R)):(document.removeEventListener("mousemove",O),removeEventListener("scroll",R,!0),removeEventListener("resize",R))};document.addEventListener("click",t=>{gt!=="contrast"||!_e()||t.target.closest?.(st)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(_e()).catch(()=>{}),Ms(),R())},!0);for(let[t,e]of Object.entries(rt))e.addEventListener("click",()=>{t!==gt&&sn(!1),Y(gt===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Ut)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let s=o=>{k&&parent.postMessage({dt:!0,...o},location.origin)};gt?(Y(""),s({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):St.hidden||(ft(!1),s({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let Nt=document.querySelector(".dt-notes-btn"),Kt=[...document.querySelectorAll(".dt-bp")],xe=document.querySelector(".dt-history-btn"),it=document.querySelector(".dt-history"),ye=document.querySelector(".dt-elsewhere"),os=document.querySelector(".dt-studio-btn"),as=document.querySelector(".dt-devices"),is=document.querySelector(".dt-notes-hi"),Ru=is.querySelector(".dt-hi-box"),zr=is.querySelector(".dt-hi-tag"),Sn=document.querySelector(".dt-frame"),Je=document.createElement("div");Je.className="dt-spot",Je.hidden=!0,Je.setAttribute("aria-hidden","true"),document.body.append(Je);let Pu=t=>{if(!t||!Ut){Je.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;Je.style.setProperty("--spot-x",`${e.left-s}px`),Je.style.setProperty("--spot-y",`${e.top-s}px`),Je.style.setProperty("--spot-w",`${e.width+s*2}px`),Je.style.setProperty("--spot-h",`${e.height+s*2}px`),Je.hidden&&(is.hidden=!0),Je.hidden=!1},Xs=Sn.querySelector("iframe");Xs.addEventListener("load",$),new MutationObserver($).observe(Sn,{attributes:!0,attributeFilter:["hidden"]});let Ya=document.querySelector(".dt-notes-count"),nt=document.querySelector(".dt-notes-overlay"),Js=".devtools, .dt-tab, .dt-strip, .dt-strip-tab, .dt-strip-grip, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Xa=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(Js).forEach(Xa);let Vr="dt-notes",j=[],Ut=!1,X=null,B=null,Ja=0,Pe="",Iu=(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 i=getComputedStyle(a).position;if(i==="fixed"||i==="sticky")return!a.contains(t)}return!1},Gr=new WeakSet,Wo=null,zo=null,We={},Vo=" \xB7 hidden \u2014 inside something closed",Go=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")&&Go(e)},!0),nt.addEventListener("load",t=>{let e=t.target.closest?.(".dt-note-thread");e&&Go(e)},!0),nt.addEventListener("scroll",t=>{let e=t.target;if(!e.classList?.contains("dt-note-thread")||e.scrollTop+e.clientHeight<e.scrollHeight-4)return;let s=e.parentElement?.querySelector(".dt-new-below");s&&(delete We[s.dataset.id],s.remove())},!0);let Le=[],te=null,ze=[],Ou=10,Zs=(t=B)=>!!(t&&((t.text?.trim().length??0)>=Ou||t.images?.length)),rn=()=>{B&&Zs()&&ze.push(B),B=null},Kr=0,Qs=()=>{if(!Zs()||performance.now()-Kr<4e3)return!0;Kr=performance.now();let t=nt.querySelector(".dt-note[data-draft]");return t&&qo(t,"no"),t?.querySelector(".dt-note-input")?.focus(),zt("Not sent \u2014 close again to keep it as a draft",2400),!1},fn=null,Za=new Map,Qa=null,Ur=()=>`dt-draft:${n.me?.email??""}:${xt}${k?":canvas":""}`,Tn=Ur(),Ko=0,to=()=>{if(!B&&!ze.length&&!Pe){ct.removeItem(Tn);return}let t={draft:B,parked:ze,reply:Pe?{for:fn,text:Pe}:null};try{localStorage.setItem(Tn,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(Tn,JSON.stringify({...t,draft:B&&e(B),parked:ze.map(e)}))}catch{}}},rs=()=>{clearTimeout(Ko),Ko=setTimeout(to,200)};addEventListener("pagehide",()=>{clearTimeout(Ko),to();try{sessionStorage.setItem(`nm-open:${Tn}`,X==null?"":String(X))}catch{}});let Ve=ct.getItem("dt-space")==="clients"?"clients":"studio",Ze=()=>!!n.me&&!n.client,An=t=>!Ze()||Ve==="clients"===Bt(t),Yr=["all","nobody","mine","others","resolved","claude","wrote","check"],Hn=Yr.find(t=>t===ct.getItem("dt-pinf"))??"all",ti=()=>{},Uo=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Qe=ct.getItem("dt-resolved")!=="0",bn=ct.getItem("dt-archived")==="1",Se=t=>zc(t,n.autoArchive),Yo=t=>Se(t)?bn:Ct(t)!=="done"||Qe,oe={q:"",menu:!1,more:!1,view:["me","agent"].includes(ct.getItem("dt-view")??"")?ct.getItem("dt-view"):"all",sort:["old","reply","unread"].includes(ct.getItem("dt-sort")??"")?ct.getItem("dt-sort"):"new"},Dn=null,Xo=t=>yt.find(e=>e.from?.id===t.id&&Ks(e)),Jo=t=>Ks(t)?yt.find(e=>e.id===t.from.id&&Bt(e)):void 0,Xr=t=>{let e=Jo(t);return!!e&&e.status!=="done"},Jr="Nothing to fix \u2014 close it in Team, the client\u2019s thread stays open",Ie=null,Zo=null,Qo=()=>Ze()&&Ve==="clients",ks=t=>Qo()&&Bt(t)&&Ct(t)==="open"&&!Xo(t),Ls='<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>',qu=t=>{let e=n.client?void 0:Jo(t);if(!e)return"";let s=Dc(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>`},Du=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Fu=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],ju=()=>{let t=navigator.userAgent,e=i=>i.find(([l])=>l.test(t)),s=e(Du),o=e(Fu),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},ei=()=>C(innerWidth,innerHeight),Yt=()=>Qa??ei(),Zr=()=>{let t=Yt();for(let e of Kt)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:ni,poolOf:si,contextOf:oi,resolveEl:_u,anchorOf:Wu,anchorState:zu,fingerprintOf:ta}=lu(),Ss=new Map,ea=()=>{Ss=new Map},Qr=t=>JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth,t.fp]),tn=t=>{let e=Qr(t),s=Ss.get(e);return(s===void 0||s.el&&!s.el.isConnected)&&(s={el:_u(t),st:zu(t)},Ss.set(e,s)),s.el},ai=t=>(tn(t),Ss.get(Qr(t))?.st??"found"),eo=0,no=null,na="",tl=()=>{eo=Math.max(eo,scrollY+innerHeight)},el=(t,e)=>e==="gone"&&(tl(),eo<document.documentElement.scrollHeight-1&&(!t.spot||t.spot.y>eo));addEventListener("scroll",()=>{tl(),no!=null&&eo>=no-1&&(no=null,setTimeout(()=>{ea(),Z(),Cm()},600))},{capture:!0,passive:!0});let Vu=t=>{let e=ai(t);return(el(t,e)?"later":e)+(Ce(t)?"":" \xB7 no pin")},ii=null,nl=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 Gu='[role=menu],[role=listbox],[role=dialog],[role=tooltip],dialog,[popover],[aria-modal],[data-state="open"],[data-radix-popper-content-wrapper],details[open]>:not(summary)',Ku=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(Gu);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:ni(s),tag:a,classes:i,nth:si({tag:a,classes:i}).indexOf(s),label:Jt(re(s.textContent||""),60),ctx:oi(s),fp:ta(s),rx:.5,ry:.5}},sa=new Map,Ce=t=>{sa.size||requestAnimationFrame(()=>sa.clear());let e=sa.get(t);return e===void 0&&(e=Wu(t,tn(t)),sa.set(t,e)),e},sl=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},oa=[],li=t=>{for(let e of oa)e.play();oa=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),oa.push(s))},di=()=>{if(B)return tn(B);let t=X!=null?j.find(s=>s.id===X):null;if(!t)return null;let e=Ce(t);return e&&!e.hidden?tn(t):null},ol="claude",Uu=()=>(n.client||Ve==="clients"?n.team??[]:ua()).filter(t=>!Tr(t.email)),Yu=()=>Uu().filter(t=>t.email!==n.me?.email),so=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...Yu()],al='<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"?ol:e==="me"?n.me?.email??"":"";if(!t){if(!B)return;B.assignee=s,B.stage=Xt(s)?"approved":!B.stage||B.stage==="approved"?"new":B.stage,oo(s),B.carried=!1,rs(),Z();return}aa(t,s)},aa=(t,e)=>{let s=j.find(i=>i.id===t);if(s&&hn(s)&&!Xt(e)&&!confirm("The agent is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?De(s):"new",a=Xt(e)?"approved":o==="approved"?"new":o;dn(i=>i.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>tt({id:t,assignee:e||null,stage:a}),Xt(e)?"Approving it for the agent":"Reassigning")},Xu=(t,e)=>{if(e&&ct.setItem("nm-for",e),!t){if(!B)return;B.assignee=e,B.stage==="approved"&&(B.stage="new"),oo(e),B.carried=!1,rs(),Z();return}aa(t,e)},Ju='<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>',oo=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e&&!Xt(e)&&so().some(s=>s.email===e)?e:null}catch{return null}},il=t=>Xt(t)?"#d97757":t?"#0d99ff":"#717171",yn=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],ln=t=>t?n.team?.find(e=>e.email===t):void 0,ia=t=>{let e=re(t??"").split(/\s+/).filter(Boolean);return f(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},Fn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${f(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${ia(e)}</b>`,ui=t=>{let e=ln(t.by);return e||t.byName?Fn(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},Oe=t=>`var(--dt-avatar-${ln(t)?.avatar_hue??[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,vn=(t,e)=>{let s=ln(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return Fn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${Oe(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},rl=()=>n.me?`${vn(n.me.email.toLowerCase(),{by:n.me.email,byName:n.me.name})}<i class="dt-pin-cut" aria-hidden="true">${es}</i>`:es,ls=new Map,pi=new Map,ll=0,Zu=(t,e)=>{let s=e==="found"?null:e;n.client||k||t.id<=0||(t.anchor??null)===s||ls.get(t.id)===s||(ls.set(t.id,s),pi.set(t.id,s),clearTimeout(ll),ll=window.setTimeout(()=>{for(let[o,a]of pi){let i=j.find(d=>d.id===o),l=i?ai(i):"found";if(!i||(l==="found"?null:l)!==a){ls.delete(o);continue}tt({id:o,anchor:a}).then(d=>{if(d.ok){let p=j.find(u=>u.id===o);p&&(p.anchor=a)}}).catch(()=>ls.delete(o))}pi.clear()},4e3))},Qu=t=>{let e=!!tn(t)?.getClientRects().length;return`<div class="dt-note-hidden dt-note-away"><b>${io}<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>`},tp=(t,e,s,o)=>{let a=(d,p,u=!1)=>`<button type="button" class="dt-lost-btn${u?" is-main":""}" data-act="${d}" data-id="${t.id}">${p}</button>`,i=(d,p,u)=>`<button type="button" class="dt-lost-btn dt-lost-ico" data-act="${d}" data-id="${t.id}" data-tip="${u}" aria-label="${u}">${p}</button>`,l=!n.client;if(o&&s==="later")return`<div class="dt-note-hidden dt-note-away"><b>${io}<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=kc(t).before,p=Ct(t)!=="open";return`<div class="dt-lost dt-lost--gone"><p>${p?"Not on the page now. The thread stays: answer or reopen it here.":d?"Not on the page now \u2014 here is how it looked. Pin it to something else, or close the thread.":"Not on the page now. Pin it to something else, or close the thread."}</p>${d?`<img class="dt-lost-shot" src="${f(wr(d.split("/").pop()))}" alt="How the element looked" loading="lazy">`:""}${p?"":`<span class="dt-lost-acts">${Os(t)?a("repin","Re-pin",!0):""}${i("lost-resolve",Me,"Resolve")}${l?i("archive",kn,"Archive"):""}</span>`}</div>`}return e?.opener?`<div class="dt-note-hidden dt-note-away"><b>${io}<span>In ${f(wo(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],ra={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)),dl=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))},cl=t=>{let e=an(t).length;jn[t.id]!==e&&(jn[t.id]=e,hi())},ep=t=>{let e=ln(t);return e?` data-face="${f(e.avatar_url??"")}" data-initial="${ia(e.name||e.email)}"`:""},np=t=>n.client||Bt(t)||Ct(t)==="done"?"":hl(t,t.assignee??"",t.id),sp=t=>{let e=Ct(t)==="done";return`<button type="button" class="dt-hist-tick" data-act="${e?"reopen":"done"}" data-id="${t.id}" data-tip="${e?"Reopen":Ct(t)==="claude"?"Looks right \u2014 resolve":"Resolve"}" aria-label="${e?"Reopen":"Resolve"}">${e?gn:Me}</button>`},op=t=>{let e=(t.replies??[]).filter(a=>!a.deleted);if(!e.length)return"";let s=[...new Set(e.map(a=>a.author==="claude"?"@agent":(a.by||"you").toLowerCase()))];return`<span class="dt-hist-replied"><span class="dt-hist-faces">${s.slice(0,3).map(a=>a==="@agent"?`<span class="dt-hist-face is-agent">${Fe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Oe(a)}">${vn(a,t)}</span>`).join("")}${s.length>3?`<i>+${s.length-3}</i>`:""}</span>${e.length} ${e.length===1?"reply":"replies"}</span>`},ap=t=>{if(Dn!==t.id)return"";let e=(l,d,p,u="")=>`<button type="button" role="menuitem" ${l} class="${u}"><i>${d}</i><span>${p}</span></button>`,s='<svg viewBox="0 0 20 20" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><circle cx="10" cy="10" r="2" fill="currentColor" stroke="none"/></svg>',o='<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="3"/><path d="m7 10.2 2.2 2.2L13.2 8"/></svg>',a=Se(t),i=!n.client;return`<div class="dt-hist-menu is-row" role="menu">${i&&!Bt(t)?`<div class="dt-hist-assign"><span>Assign</span>${ml(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")}${Qo()?e(`data-row-select="${t.id}"`,o,"Select")+(ks(t)?e(`data-row-mirror="${t.id}"`,Ls,"Mirror to Team"):""):""}${i&&Ze()&&!t.client?e(`data-row-move="${t.id}"`,vi,Bt(t)?"Move to Team":"Move to Client"):""}${i||!Hs(t)?"<hr>":""}${i?e(`data-act="${a?"unarchive":"archive"}" data-id="${t.id}"`,a?gn:kn,a?"Unarchive":"Archive"):""}${Hs(t)?"":e(`data-rm="${t.id}"`,ts,"Delete thread","is-danger")}</div>`},ul={queued:"#0d99ff",working:"#f5a623",asks:"#e93d82",stuck:"#e5402c",review:"#8e4ec6"};hu(t=>{if(t.matches(".dt-hist-go[data-go]")){let b=j.find(Pt=>Pt.id===Number(t.dataset.go)),S=b&&[...b.replies??[]].reverse().find(Pt=>!Pt.deleted);if(!b||!S)return null;let P=S.author==="claude",m=(S.by||"you").toLowerCase(),_=P?Nn(b):S.by?S.by===n.me?.email?"You":yn(S.by):"You",Q=P?`<span class="dt-hist-face is-agent">${Fe(11)}</span>`:`<span class="dt-hist-face" style="--hue:${Oe(m)}">${vn(m,b)}</span>`,Ot=(S.images?.length?'<span class="dt-peek-chip">Picture</span>':"")+(S.files?.length?'<span class="dt-peek-chip">File</span>':"")+(S.audio?'<span class="dt-peek-chip">Voice note</span>':"");return`<span class="dt-peek-head"><span class="dt-peek-people">${Q}</span><b>${f(_)}</b>${P?`<em>${f(kr(S.agent)||"")}</em>`:""}${S.editedAt?"<em>edited</em>":""}<em>${Qn(S.at)}</em></span>`+(S.text?`<span class="dt-peek-text is-reply">${f(Jt(S.text,320))}</span>`:"")+(Ot?`<span class="dt-peek-files">${Ot}</span>`:"")}if(X!=null||!t.matches(".dt-pin[data-id]"))return null;let e=j.find(b=>b.id===Number(t.dataset.id));if(!e)return null;let s=[...new Set([e.by,...(e.replies??[]).filter(b=>b.author!=="claude").map(b=>b.by)].filter(Boolean).map(b=>b.toLowerCase()))].slice(0,3),o=Ct(e),a=n.client||Bt(e)||o==="done"?null:Ee(e),i=a&&ul[a]&&(Xt(e.assignee)||a==="review")?a:null,l=_n.find(b=>b[0]===ds(e)),[d,p]=o==="done"?Se(e)?["#717171","Archived"]:["#30a46c","Resolved"]:i?[ul[i],`${Nn(e)}${gi(e)}`]:[l[2],l[1]],u=e.replies?.length??0;return`<span class="dt-peek-head">${s.length?`<span class="dt-peek-people">${s.map(b=>`<span class="dt-hist-face" style="--hue:${Oe(b)}">${vn(b,e)}</span>`).join("")}</span>`:""}<b>${f(e.byName||"You")}</b><em>\xB7 ${Qn(e.createdAt)}</em></span><span class="dt-peek-text">${f(Jt(e.text,240))}</span><span class="dt-peek-foot">${Xe(d,o==="done"?1:0)}<span>${f(p)}${u?` \xB7 ${u} ${u===1?"reply":"replies"}`:""}</span></span>`});let gi=t=>{let e=Ee(t),s=Hr(t);return e==="working"?s?.step?` \xB7 ${Ar(s.step)} \xB7 ${s.elapsed}`:" is working":e==="stuck"?` went quiet \xB7 ${s?.silent??""}${s?.step?` \xB7 last: ${s.step}`:""}`:e==="queued"?" \xB7 queued \xB7 next run":e==="asks"?" asks you \xB7 answer in the thread":e==="review"?" fixed it \xB7 to check":""},ip=t=>{let e=ln(t);return e?Fn(e.avatar_url,e.name||e.email):""},pl=(t,e,s={})=>`<option value="${f(t)}"${s.dot?` data-c="${il(t)}"`:""}${ep(t||null)}${s.selected?" selected":""}>${f(e)}</option>`,ml=(t,e,s=!1)=>{let o=Xt(t),a=o?"":t,i=ln(a),l=i?i.avatar_url?`<img class="dt-owner-face" src="${f(i.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${Oe(a.toLowerCase())}" aria-hidden="true">${ia(i.name||i.email)}</b>`:a?vl:al,d=a?i?.name||yn(a):"Anyone",p=S=>{let P=ln(S);return P?.avatar_url?`<img class="dt-menu-face" src="${f(P.avatar_url)}" alt="">`:`<b class="dt-menu-face" style="--hue:${Oe(S.toLowerCase())}">${[...ia(P?.name||S)][0]}</b>`},u=(S,P,m="")=>`<option value="${f(S)}" data-icon="${f(S?p(S):al)}"${m?` data-hint="${f(m)}"`:""}${S===a?" selected":""}${S?"":" data-sep-after"}>${f(P)}</option>`,b=so();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>`}${la}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
|
|
262
|
+
${u("","Anyone")}${b.map(S=>u(S.email,S.email===n.me?.email?`Me \xB7 ${S.name||S.email}`:S.name||S.email,S.email)).join("")}${a&&!b.some(S=>S.email===a)?u(a,yn(a)):""}
|
|
263
|
+
</select></label>`},rp={queued:"queued",working:"working",asks:"asks you",stuck:"went quiet",review:"fixed it \u2014 to check",done:"done"},hl=(t,e,s,o=!1)=>{let a=t?Ee(t):Xt(e)?"queued":null,i=!!a&&(Xt(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 ${rp[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:${ra[a]??ra.queued}"`:""} aria-pressed="${i}" data-tip="${f(l)}" aria-label="${f(d)}"${o?" disabled":""}>${Fe(13)}</button>`},gl=t=>{if(!t){if(!B)return;ci(0,Xt(B.assignee)?"nobody":"agent");return}let e=j.find(o=>o.id===t);if(!e)return;let s=Ee(e);aa(t,Xt(e.assignee)||s==="review"?"":ol)},lp=t=>`<div class="dt-suggest dt-suggest--read"><del>${f(t.from)}</del><ins>${f(t.to)}</ins></div>`,fl=(t,e)=>{let s=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return f([s,re(e??"")&&`\u201C${Jt(re(e),80)}\u201D`].filter(Boolean).join(" \xB7 "))},la='<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=Us(t),a=i=>Qc(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>${la}<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>`},_n=[["new","New","#0d99ff",0],["progress","In progress","#f5a623",.25],["review","To check","#8e4ec6",.5],["waiting","Waiting","#e93d82",.75]],ds=t=>hn(t)||De(t)==="progress"?"progress":De(t)==="review"?"review":De(t)==="waiting"?"waiting":"new",bl=(t,e)=>{if(e==="all")return!0;let s=Ct(t),o=No(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")},da={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",done:"done"},Wn=[..._n,["done","Resolved","#30a46c",1]],dp=t=>{let e=Ee(t);return t.status==="done"&&e!=="review"?"done":e&&da[e]?da[e]:ds(t)},cp=t=>{let e=Ee(t),s=dp(t),[,,o,a]=Wn.find(l=>l[0]===s),i=!n.client&&Jo(t)?l=>` data-note="${f(Ao[l])}"`:()=>"";return`<label class="dt-field" data-tip="${e&&da[e]?"Follows the agent":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Xe(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>':""}${Wn.map(([l,d,p,u])=>`<option value="${l}" data-c="${p}" data-icon="${f(Xe(p,u))}"${i(l)}${l===s?" selected":""}>${d}</option>`).join("")}${n.client?"":`<option value="${Se(t)?"unarchive":"archive"}" data-sep data-icon="${f(kn)}">${Se(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},ca=(t,e,s)=>`<p class="dt-note-event"><span>${t}<b>${f(e)}</b>${s?`<time>${Br(s,Qn)}</time>`:""}</span></p>`,Ts=new Map,up=(t,e,s=1/0)=>{let{reopenedAt:o,reopenedBy:a,movedAt:i,movedBy:l,movedFrom:d,repinnedAt:p,repinnedBy:u,repinnedFrom:b}=t,S=an(t),P=bt=>{let kt=Date.parse(bt),Ht=S.findIndex((Te,de)=>de>0&&!!Te.at&&Date.parse(Te.at)>kt);return Ht<0?S.length:Ht},m=bt=>bt?bt==="you"||bt===n.me?.email?"you":bt==="claude"?"the agent":yn(bt):"",_=[],Q=pp(t);if(Q&&_.push([Q.at?P(Q.at):0,ca(Q.icon,Q.words,Q.time)]),i&&d&&_.push([P(i),ca(bi,`Moved from ${d}${l?` by ${m(l)}`:""}`,i)]),p&&_.push([P(p),ca(bi,`Re-pinned${u?` by ${m(u)}`:""}${b?` from ${b}`:""}`,p)]),o&&t.status!=="done"){let bt=m(a);_.push([P(o),ca(gn,bt?`Reopened by ${bt}`:"Reopened",o)])}let Ot=e.map(()=>!0);for(let[bt,kt]of _.sort((Ht,Te)=>Te[0]-Ht[0]))e.splice(bt,0,kt),Ot.splice(bt,0,!1);let Pt=Ot.flatMap((bt,kt)=>bt?[kt]:[]),le=Pt.length-1-s;if(le<2)return e.join("");let Tt=[...new Set(an(t).slice(1,1+le).map(bt=>bt.author==="claude"?"@agent":(bt.by||n.me?.email||"you").toLowerCase()))].slice(0,3).map(bt=>bt==="@agent"?`<span class="dt-hist-face is-agent">${Fe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Oe(bt)}">${vn(bt,t)}</span>`).join("");return[...e.slice(0,Pt[1]),`<button type="button" class="dt-note-fold" data-act="unfold" data-id="${t.id}"><span class="dt-hist-faces">${Tt}</span>${le} more replies</button>`,...e.slice(Pt[Pt.length-s])].join("")},pp=t=>{let e=t.from;if(e){if(Ks(t))return{icon:Ls,words:qc(t.mirroredBy?t.mirroredBy===n.me?.email?"you":(t.mirroredByName||yn(t.mirroredBy)).split(" ")[0]:""),at:null,time:t.createdAt};let o=yt.find(a=>a.id===e.id);return{icon:yi,words:Ic(t,o,o?.by?yn(o.by):""),at:null,time:t.createdAt}}if(n.client)return null;let s=yt.find(o=>o.from?.id===t.id);return s?{icon:Ks(s)?Ls:yi,words:Oc(s),at:s.createdAt??null,time:s.createdAt}:null},mp=(t,e)=>{let s=j.find(l=>l.id===t);if(!s)return;if(e==="done"){Ge(t,!0);return}if(e==="archive"||e==="unarchive"){us(t,e==="archive");return}if(Xt(s.assignee)&&!Bt(s)){s.status==="done"?Ge(t,!1):(zt("Still with the agent \u2014 its step is the status; the agent button takes it back.",6e3),Z());return}let a=e==="new"&&Xt(s.assignee)?"approved":e,i=s.status==="done"?{status:"open",doneBy:null}:{};dn(l=>l.map(d=>d.id===t?{...d,...i,stage:a}:d),()=>tt({id:t,...i,stage:a}),"Setting the status")},ao=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],hp=(t,e)=>{let s=Math.max(0,ao.findIndex(d=>d[0]===t)),[,o,a,i]=ao[s],l=ao[(s+1)%ao.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}">${du(i,a)}<span>${o}</span></button>`},yl=(t,e,s,o,a=!1,i=!1,l=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${n.client?"":hp(t,s)}${l?"":fi(Us(e).id,s,a)}</span>${n.client?"":`<span class="dt-who">${i?"":ml(o,s)}${hl(s?j.find(d=>d.id===s):void 0,o,s,i)}</span>`}</div>`,io='<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>',gp=t=>{let e=re(t?.querySelector("h1, h2, h3, h4, h5, h6")?.textContent??t?.innerText?.split(`
|
|
264
|
+
`).find(s=>re(s))??"");return e?e.length>30?`${Jt(e,30)}\u2026`:e:t?.tagName.toLowerCase()??""},vl='<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>',wl='<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>',$l=t=>{let e=(a,i,l,d="")=>`<option value="${a}" data-icon="${f(i)}"${d}>${l}</option>`,s=t&&Ze()?Bt(t)?(Xo(t)?"":e("mirror",Ls,"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">${wl}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
|
|
265
265
|
<option value="" hidden selected></option>
|
|
266
|
-
${s}${o}${t&&t.id>0&&Ct(t)==="open"&&
|
|
266
|
+
${s}${o}${t&&t.id>0&&Ct(t)==="open"&&Os(t)?e("repin",bi,"Re-pin"):""}${t?e("link",wi,"Copy link"):""}${t&&!n.client&&t.id>0?e(Se(t)?"unarchive":"archive",kn,Se(t)?"Out of the archive":"Archive"):""}
|
|
267
267
|
${e(t?"rm":"discard",ts,t?"Delete thread":"Discard draft",` data-danger${t?" data-sep":""}`)}
|
|
268
|
-
</select></label>`},
|
|
269
|
-
${s.map(a=>
|
|
270
|
-
</select></span></label>`},io='<svg viewBox="0 0 20 20" width="9" height="9" aria-hidden="true"><path d="M5.5 5.5l9 9M14.5 5.5l-9 9"/></svg>',$l='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',gp='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M2.5 1.5h2.5v9H2.5zM7 1.5h2.5v9H7z"/></svg>',fp=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,bp=(t,e)=>{let s=t.closest(".dt-voice"),o=s.querySelector("audio"),a=s.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let d=s.querySelector(".dt-voice-track i"),p=s.querySelector(".dt-voice-time"),u=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${u()?Math.min(1,o.currentTime/u()):0})`,p.textContent=fp(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=gp,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=$l,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let d=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-d.left)/d.width))*o.duration);return}if(!o.paused){o.pause();return}nt.querySelectorAll(".dt-voice audio").forEach(d=>{d!==o&&d.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?r():l(),{once:!0}):r();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,r()},{once:!0}),o.currentTime=1e9}},$i=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),xl=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),ro=new Map,yp=t=>{if(!t.startsWith("data:"))return t;let e=ro.get(t);if(!e){let[s,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:s.slice(5).split(";")[0]})),ro.set(t,e),ro.size>8){let[a,r]=ro.entries().next().value;URL.revokeObjectURL(r),ro.delete(a)}}return e},vp=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${$l}</button><button type="button" class="dt-voice-track" data-act="voice-seek" aria-label="Jump"><i></i></button><span class="dt-voice-time">0:00</span><audio src="${yp(t)}" preload="metadata"></audio>${e===void 0?"":`<button class="dt-voice-rm" data-act="voice-write" ${e} aria-label="Write it out" title="Write it out \u2014 its words go in the box">${Cp}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${io}</button>`}</span>`,xi=t=>t.length>30?`${Jt(t,17)}\u2026${[...t].slice(-11).join("")}`:t,wp=t=>{if(!t.startsWith("data:"))return"";let e=Math.round((t.length-t.indexOf(",")-1)*3/4);return e<1024*1024?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`},Ei=t=>{let e=Mc(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},$p=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${Ei(e)}<span class="dt-file-text"><b>${f(xi(e))}</b>${o?"":`<small>${wp(t)}</small>`}</span>`;return`<span class="dt-file" title="${f(e)}">${o?`<a class="dt-file-open" href="${f(xr(e)?t:a)}"${xr(e)?' target="_blank" rel="noreferrer"':` download="${f(e)}"`}>${r}</a><a class="dt-tip-r dt-file-get" href="${f(a)}" download="${f(e)}" aria-label="Download ${f(e)}" data-tip="Download">${Mp}</a>`:`<span class="dt-file-open">${r}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${io}</button>`}</span>`},xp=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${f(s)}"><span class="dt-file-open">${Ei(s)}<span class="dt-file-text"><b>${f(xi(s))}</b><small>${f(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${io}</button></span>`},Ep=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${f(s)}"><span class="dt-file-open">${Ei(s)}<span class="dt-file-text"><b>${f(xi(s))}</b><small>${(Number(o)/1024/1024).toFixed(1)} MB \u2014 uploads when you send</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${io}</button></span>`},El=(t,e,s=t)=>t.startsWith(ua)?xp(t,e??""):t.startsWith(ki)?Ep(t,e??""):Ho(s)?$p(t,Ho(s),e):$i(s)?vp(t,e):`<span class="dt-shot${xl(s)?" dt-shot--video":""}">${xl(s)?`<video src="${t}" controls preload="metadata" playsinline></video>`:`<a href="${t}" target="_blank"><img src="${t}" alt="" loading="lazy" /></a>`}${e===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${e} aria-label="Remove">${io}</button>`}</span>`,Mi=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=wr(o);return El(a,e===void 0?void 0:`data-id="${e}" data-img="${f(o)}"`,o)}).join("")}</div>`:"",Ml=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>El(e,`data-i="${s}"`)).join("")}</div>`:"",Mp='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3.5v9M6 9l4 4 4-4M4 16.5h12" stroke-linejoin="round"/></svg>',kp='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><path d="M16 9.5 9.9 15.6a3.6 3.6 0 0 1-5.1-5.1l6.6-6.6a2.4 2.4 0 0 1 3.4 3.4l-6.6 6.6a1.2 1.2 0 0 1-1.7-1.7L12.4 6.3" stroke-linejoin="round"/></svg>',ua="refused:\0",ki="big:\0",pa=new Map,Ts=t=>!t.startsWith(ki),Lp='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="7.5" y="3" width="5" height="9" rx="2.5"/><path d="M5 9.5a5 5 0 0 0 10 0M10 14.5V17"/></svg>',Sp='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Tp=90,Li=32,Ap=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",ma=!1,Hp=async(t,e)=>{if(ma||!t)return;let s=Number(t.dataset.id)||0;ma=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Gt("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(mt){clearTimeout(o),ma=!1,e.classList.remove("is-asking");let Tt=mt?.name;Gt(Tt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Tt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Tt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${mt?.message||Tt||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let r=()=>nt.querySelector(s?`.dt-note[data-id="${s}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),l=document.createElement("div");l.className="dt-rec",l.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${ts}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(Li)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${Sp}</button>`;let d=l.querySelector("b"),p=[...l.querySelectorAll(".dt-rec-wave i")],u=new AudioContext,b=u.createAnalyser();b.fftSize=512,u.createMediaStreamSource(a).connect(b);let T=new Uint8Array(b.fftSize),P=[],m=new MediaRecorder(a,{audioBitsPerSecond:32e3}),_=[],Q=Date.now(),Ot=!0,Pt=setInterval(()=>{let mt=r();if(!mt){le(!1);return}l.parentElement!==mt&&mt.appendChild(l),b.getByteTimeDomainData(T);let Tt=0;for(let Ht of T)Tt+=((Ht-128)/128)**2;P.push(Math.min(1,Math.sqrt(Tt/T.length)*4));let bt=P.slice(-Li);p.forEach((Ht,Te)=>{let de=bt[Te-(Li-bt.length)];Ht.style.transform=`scaleY(${Math.max(.1,de??0).toFixed(2)})`,Ht.classList.toggle("is-empty",de===void 0)});let kt=Math.floor((Date.now()-Q)/1e3);d.textContent=`${Math.floor(kt/60)}:${String(kt%60).padStart(2,"0")}`,kt>=Tp&&m.state!=="inactive"&&m.stop()},90),le=mt=>{Ot=mt,m.state!=="inactive"&&m.stop()};l.querySelector(".dt-rec-x").addEventListener("click",mt=>{mt.stopPropagation(),le(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",mt=>{mt.stopPropagation(),le(!0)}),l.addEventListener("keydown",mt=>{mt.key==="Escape"&&(mt.stopPropagation(),le(!1))}),m.ondataavailable=mt=>{mt.data.size&&_.push(mt.data)},m.onstop=async()=>{if(clearInterval(Pt),a.getTracks().forEach(bt=>bt.stop()),u.close().catch(()=>{}),l.remove(),ma=!1,!Ot)return;let mt=new Blob(_,{type:m.mimeType||"audio/webm"}),Tt=await new Promise(bt=>{let kt=new FileReader;kt.onload=()=>bt(String(kt.result)),kt.readAsDataURL(mt)});s?Le.push(Tt):B&&(B.images??=[]).push(Tt),Z(),r()?.querySelector("textarea")?.focus()},m.start(1e3),r()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},kl="\u{1F3A4} Voice note",Cp='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><rect x="2.5" y="4.5" width="15" height="11" rx="2"/><path d="M6 11.5h3M11 11.5h3M6 8.5h8"/></svg>',Np=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?B?.images??[]:Le)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await ie("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),r=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!r.text){Gt(r.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${r.text}`:r.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},wn=new Map,Si=new Map,Ti=async(t,e,s)=>{let o=`${t}:${e}`;if(Si.delete(o),!s){wn.delete(o),Z();return}let a=j.find(p=>p.id===t),r=a&&an(a).find(p=>(p.at??"0")===e);if(!r?.text)return;wn.set(o,{to:s,text:null}),Z();let l=await ie("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:s})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};wn.get(o)?.to===s&&(l?.ok&&d.text?wn.set(o,{to:s,text:d.text}):(wn.delete(o),Si.set(o,s)),Z())},Bp=(t,e,s)=>{let o=wn.get(`${t}:${e}`),a=Wa(s),r=(navigator.language||"en").split("-")[0].toLowerCase();return`<label class="dt-msg-edit dt-msg-lang${o?" is-on":""}" data-tip="Translate">${o?.text===null?`<span class="dt-tr-spin">${Rp}</span>`:Ip}<span aria-hidden="true">${ra}</span><select class="dt-lang-select" data-id="${t}" data-at="${f(e)}" aria-label="Translate"><option value="" hidden${o?"":" selected"}></option><option data-head disabled>${a?`Written in ${f(Cr(a))}`:"Translate into"}</option>${zc(s,navigator.language||"en").map(l=>`<option value="${f(l)}" data-bare${l===r?' data-note="your language"':""}${o?.to===l?" selected":""}>${f(Wc(l))}</option>`).join("")}<option value="orig" data-sep data-icon="${f(gn)}"${o?"":" disabled"}>Show original</option></select></label>`},Rp='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M10 3a7 7 0 1 0 7 7"/></svg>',Pp=(t,e,s)=>{let o=`${t}:${e}`,a=Wa(s);if(wn.get(o)?.text)return`<p class="dt-tr-note">Translated from ${a?f(Cr(a)):"another language"} \xB7 <button type="button" data-act="tr-orig" data-id="${t}" data-at="${f(e)}">Show original</button></p>`;let r=Si.get(o);return r?`<p class="dt-tr-note is-error" role="alert">Could not translate it \xB7 <button type="button" data-act="tr-retry" data-id="${t}" data-at="${f(e)}" data-to="${f(r)}">Try again</button></p>`:""},Ip='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M3 5h8M7 3v2m2 0c-.6 3.2-2.8 6-6 7.5M5.5 8.5c.8 1.6 2.2 2.9 4 3.8M10.5 17l3.25-7.5L17 17m-5.5-2h4.5"/></svg>',Op='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/></svg>',Ll='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M15.9 9.3a6.5 6.5 0 1 1-5.2-5.7"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/><path d="M15.5 2.5v4.5M13.25 4.75h4.5"/></svg>',Ai=()=>n.me?.email??"you",qp=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,r])=>{let l=r.includes(Ai()),d=r.map(p=>p===Ai()?"You":yn(p)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${f(e)}" data-emoji="${f(a)}" aria-pressed="${l}" data-tip="${f(d)}" aria-label="${f(`${a} ${r.length}: ${d}`)}">${f(a)}<span>${r.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${f(e)}" data-tip="Add reaction" aria-label="Add reaction">${Ll}</button></div>`:""},Sl=(t,e,s)=>{ha();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",s.box?"Emoji":"React"),o.innerHTML=(e?Tc:Sc).map(b=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${f(b)}" aria-label="${f(b)}">${f(b)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${yl}</button>`),Cn={...s,btn:t},nt.append(o);let a=t.getBoundingClientRect(),r=o.getBoundingClientRect(),l=6,d=8,p=a.top-l-r.height>=d;o.style.top=`${p?a.top-l-r.height:Math.min(a.bottom+l,innerHeight-d-r.height)}px`;let u=(t.closest(".dt-note")??t).getBoundingClientRect().right;o.style.left=`${Math.min(Math.max(d,u-r.width),innerWidth-d-r.width)}px`,o.querySelector("button")?.focus()},Cn=null,ha=()=>{nt.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),Cn=null},Dp=(t,e)=>{t.setRangeText(e,t.selectionStart??t.value.length,t.selectionEnd??t.value.length,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},Tl=(t,e,s)=>{let o=a=>{let r=Ac(a.reactions,s,Ai());return r===null?a:{...a,reactions:r}};dn(a=>a.map(r=>r.id!==t?r:e?{...r,replies:r.replies?.map(l=>l.at===e?o(l):l)}:o(r)),()=>tt({id:t,react:{at:e,emoji:s}}),"The reaction")},Fp='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="3" y="4" width="14" height="12" rx="2"/><circle cx="7.5" cy="8.5" r="1.4"/><path d="m3.5 14.5 4-4 3 3 2-2 4 4"/></svg>',Hi=1e4,Al=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
268
|
+
</select></label>`},ua=()=>n.studio?(n.team??[]).filter(t=>n.studio.includes(t.email)):[],xl=t=>{let e=t||n.lead||"",s=ua();return!s.length||s.some(o=>o.email===e)?e:s[0].email},fp=t=>{let e=xl(t),s=ua();if(!s.length)return"";let o=ip(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${il(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
|
|
269
|
+
${s.map(a=>pl(a.email,a.name||a.email,{dot:!0,selected:e===a.email})).join("")}
|
|
270
|
+
</select></span></label>`},ro='<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>',El='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',bp='<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>',yp=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,vp=(t,e)=>{let s=t.closest(".dt-voice"),o=s.querySelector("audio"),a=s.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let d=s.querySelector(".dt-voice-track i"),p=s.querySelector(".dt-voice-time"),u=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${u()?Math.min(1,o.currentTime/u()):0})`,p.textContent=yp(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=bp,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=El,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}},$i=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),Ml=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),lo=new Map,wp=t=>{if(!t.startsWith("data:"))return t;let e=lo.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]})),lo.set(t,e),lo.size>8){let[a,i]=lo.entries().next().value;URL.revokeObjectURL(i),lo.delete(a)}}return e},$p=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${El}</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="${wp(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">${Bp}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${ro}</button>`}</span>`,xi=t=>t.length>30?`${Jt(t,17)}\u2026${[...t].slice(-11).join("")}`:t,xp=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=Lc(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},Ep=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",i=`${Ei(e)}<span class="dt-file-text"><b>${f(xi(e))}</b>${o?"":`<small>${xp(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)}"`}>${i}</a><a class="dt-tip-r dt-file-get" href="${f(a)}" download="${f(e)}" aria-label="Download ${f(e)}" data-tip="Download">${Lp}</a>`:`<span class="dt-file-open">${i}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${ro}</button>`}</span>`},Mp=(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">${ro}</button></span>`},kp=(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">${ro}</button></span>`},kl=(t,e,s=t)=>t.startsWith(pa)?Mp(t,e??""):t.startsWith(ki)?kp(t,e??""):Co(s)?Ep(t,Co(s),e):$i(s)?$p(t,e):`<span class="dt-shot${Ml(s)?" dt-shot--video":""}">${Ml(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">${ro}</button>`}</span>`,Mi=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=wr(o);return kl(a,e===void 0?void 0:`data-id="${e}" data-img="${f(o)}"`,o)}).join("")}</div>`:"",Ll=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>kl(e,`data-i="${s}"`)).join("")}</div>`:"",Lp='<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>',Sp='<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>',pa="refused:\0",ki="big:\0",ma=new Map,As=t=>!t.startsWith(ki),Tp='<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>',Ap='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Hp=90,Li=32,Cp=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",ha=!1,Np=async(t,e)=>{if(ha||!t)return;let s=Number(t.dataset.id)||0;ha=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>zt("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(mt){clearTimeout(o),ha=!1,e.classList.remove("is-asking");let Tt=mt?.name;zt(Tt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Tt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Tt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${mt?.message||Tt||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let 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">${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">${Ap}</button>`;let d=l.querySelector("b"),p=[...l.querySelectorAll(".dt-rec-wave i")],u=new AudioContext,b=u.createAnalyser();b.fftSize=512,u.createMediaStreamSource(a).connect(b);let S=new Uint8Array(b.fftSize),P=[],m=new MediaRecorder(a,{audioBitsPerSecond:32e3}),_=[],Q=Date.now(),Ot=!0,Pt=setInterval(()=>{let mt=i();if(!mt){le(!1);return}l.parentElement!==mt&&mt.appendChild(l),b.getByteTimeDomainData(S);let Tt=0;for(let Ht of S)Tt+=((Ht-128)/128)**2;P.push(Math.min(1,Math.sqrt(Tt/S.length)*4));let bt=P.slice(-Li);p.forEach((Ht,Te)=>{let de=bt[Te-(Li-bt.length)];Ht.style.transform=`scaleY(${Math.max(.1,de??0).toFixed(2)})`,Ht.classList.toggle("is-empty",de===void 0)});let kt=Math.floor((Date.now()-Q)/1e3);d.textContent=`${Math.floor(kt/60)}:${String(kt%60).padStart(2,"0")}`,kt>=Hp&&m.state!=="inactive"&&m.stop()},90),le=mt=>{Ot=mt,m.state!=="inactive"&&m.stop()};l.querySelector(".dt-rec-x").addEventListener("click",mt=>{mt.stopPropagation(),le(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",mt=>{mt.stopPropagation(),le(!0)}),l.addEventListener("keydown",mt=>{mt.key==="Escape"&&(mt.stopPropagation(),le(!1))}),m.ondataavailable=mt=>{mt.data.size&&_.push(mt.data)},m.onstop=async()=>{if(clearInterval(Pt),a.getTracks().forEach(bt=>bt.stop()),u.close().catch(()=>{}),l.remove(),ha=!1,!Ot)return;let mt=new Blob(_,{type:m.mimeType||"audio/webm"}),Tt=await new Promise(bt=>{let kt=new FileReader;kt.onload=()=>bt(String(kt.result)),kt.readAsDataURL(mt)});s?Le.push(Tt):B&&(B.images??=[]).push(Tt),Z(),i()?.querySelector("textarea")?.focus()},m.start(1e3),i()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},Sl="\u{1F3A4} Voice note",Bp='<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>',Rp=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?B?.images??[]:Le)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await ie("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),i=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!i.text){zt(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())},wn=new Map,Si=new Map,Ti=async(t,e,s)=>{let o=`${t}:${e}`;if(Si.delete(o),!s){wn.delete(o),Z();return}let a=j.find(p=>p.id===t),i=a&&an(a).find(p=>(p.at??"0")===e);if(!i?.text)return;wn.set(o,{to:s,text:null}),Z();let l=await ie("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:i.text,to:s})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};wn.get(o)?.to===s&&(l?.ok&&d.text?wn.set(o,{to:s,text:d.text}):(wn.delete(o),Si.set(o,s)),Z())},Pp=(t,e,s)=>{let o=wn.get(`${t}:${e}`),a=za(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">${Ip}</span>`:qp}<span aria-hidden="true">${la}</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>${Gc(s,navigator.language||"en").map(l=>`<option value="${f(l)}" data-bare${l===i?' data-note="your language"':""}${o?.to===l?" selected":""}>${f(Vc(l))}</option>`).join("")}<option value="orig" data-sep data-icon="${f(gn)}"${o?"":" disabled"}>Show original</option></select></label>`},Ip='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M10 3a7 7 0 1 0 7 7"/></svg>',Op=(t,e,s)=>{let o=`${t}:${e}`,a=za(s);if(wn.get(o)?.text)return`<p class="dt-tr-note">Translated from ${a?f(Cr(a)):"another language"} \xB7 <button type="button" data-act="tr-orig" data-id="${t}" data-at="${f(e)}">Show original</button></p>`;let i=Si.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>`:""},qp='<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>',Dp='<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>',Tl='<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",Fp=(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(Ai()),d=i.map(p=>p===Ai()?"You":yn(p)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${f(e)}" data-emoji="${f(a)}" aria-pressed="${l}" data-tip="${f(d)}" aria-label="${f(`${a} ${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">${Tl}</button></div>`:""},Al=(t,e,s)=>{ga();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?Hc:Ac).map(b=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${f(b)}" aria-label="${f(b)}">${f(b)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${wl}</button>`),Cn={...s,btn:t},nt.append(o);let a=t.getBoundingClientRect(),i=o.getBoundingClientRect(),l=6,d=8,p=a.top-l-i.height>=d;o.style.top=`${p?a.top-l-i.height:Math.min(a.bottom+l,innerHeight-d-i.height)}px`;let u=(t.closest(".dt-note")??t).getBoundingClientRect().right;o.style.left=`${Math.min(Math.max(d,u-i.width),innerWidth-d-i.width)}px`,o.querySelector("button")?.focus()},Cn=null,ga=()=>{nt.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),Cn=null},jp=(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()},Hl=(t,e,s)=>{let o=a=>{let i=Cc(a.reactions,s,Ai());return i===null?a:{...a,reactions:i}};dn(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")},_p='<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,Cl=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
271
271
|
<textarea class="${t}" rows="1" maxlength="${Hi}" aria-label="${e}" placeholder="${e}">${f(s)}</textarea>
|
|
272
272
|
${a}
|
|
273
273
|
<div class="dt-compose-bar">
|
|
274
|
-
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${
|
|
275
|
-
${
|
|
274
|
+
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${_p}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${Sp}</button>
|
|
275
|
+
${Cp()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${Tp}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${Dp}</button></span>
|
|
276
276
|
<button class="dt-send${s.trim()?" is-ready":""}" ${o} title="Send (Enter)"
|
|
277
277
|
><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 15.5v-11M5.5 9 10 4.5 14.5 9"/></svg></button>
|
|
278
278
|
</div>
|
|
279
|
-
</div></div>`,
|
|
280
|
-
class="dt-note-resolve${a&&!r?" is-on":""}" title="${a?"Reopen":o==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${Me}</button>${n.client||!s?"":`<button data-act="${r?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${r?" is-on":""}" title="${r?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${kn}</button>`}`},Wp='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',Ni=new Map,zp=(t,e)=>{let s=Ar(e,25),o=Ni.get(t);o?.now!==s&&Ni.set(t,{now:s,was:o?.now??"",at:performance.now()});let a=Ni.get(t),r=a.was&&performance.now()-a.at<160?a.was:"";return`<span class="dt-step-words">${r?`<span class="dt-step-was" data-k="was:${f(r)}" aria-hidden="true">${f(r)}</span>`:""}<span class="dt-step-now" data-k="${f(s)}"${s!==e?` data-tip="${f(e)}"`:""}>${f(s)}</span></span>`},Vp=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!Se(t)){let u=t.confirmedBy?t.confirmedBy===n.me?.email?"you":yn(t.confirmedBy).split(" ")[0]:"",b=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${Ye(Wn[Wn.length-1][2],1)}<span class="dt-step-text"><b>${f(u?`Resolved by ${u}`:"Resolved")}${b?` \xB7 ${f(Br(b))}`:""}</b></span><button type="button" class="dt-step-act" data-act="reopen" data-id="${t.id}" data-tip="Reopen \u2014 not right yet" aria-label="Reopen">${gn}</button>`+(n.client?"</div>":`<button type="button" class="dt-step-act" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${kn}</button></div>`)}if(n.client||Bt(t))return"";let e=Ee(t),s={act:"hand",v:"me",icon:bl,tip:n.me?"Take it myself":"Take it off the agent"},o=[{act:"sendback",icon:gn,tip:"Send it back \u2014 say what is wrong below"},{act:"accept",icon:Me,tip:"Looks right \u2014 mark it resolved",main:!0,label:"Looks right"}],a=Hr(t),r=!Xt(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":yn(t.assignee).split(" ")[0]:"",l=[a?.step&&`last: ${a.step}`,a?.stale&&"next run retries"].filter(Boolean).join(" \xB7 "),d=e==="queued"?{step:e,title:"With the agent \u2014 queued",sub:"Starts on the agent\u2019s next run",acts:[]}:e==="working"?a?.step?{step:e,title:"",now:a.step,time:a.elapsed,acts:[],live:!0}:{step:e,title:"With the agent \u2014 working",acts:[],live:!0}:e==="asks"?null:e==="stuck"?{step:e,title:`Silent for ${a?.silent??"a while"}`,sub:l&&l[0].toUpperCase()+l.slice(1),acts:[s]}:e==="review"?null:De(t)==="review"&&r?{step:"review",title:`${r} ${r==="You"?"say":"says"} done`,acts:o}:null;if(!d)return"";let p=d.step==="review"?Ye(_n[2][2],_n[2][3]):`<i class="dt-step-mark">${Fe(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${p}${d.now?`${Wp}<span class="dt-step-text" aria-live="polite"><b>${zp(t.id,d.now)}</b></span>`:`<span class="dt-step-text"><b>${f(d.title)}</b>${d.sub?`<span>${f(d.sub)}</span>`:""}</span>`}${d.acts.map(u=>u.pick?`<label class="dt-step-act" data-tip="${f(u.tip)}">${u.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${f(u.tip)}"><option value="" selected hidden></option>${no().map(b=>cl(b.email,b.email===n.me?.email?`Me \xB7 ${b.name||b.email}`:b.name||b.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${u.main?" is-main":""}${u.label?" has-label":""}" data-act="${u.act}" data-id="${t.id}"${u.v?` data-v="${u.v}"`:""} data-tip="${f(u.tip)}" aria-label="${f(u.tip)}">${u.icon}${u.label?f(u.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},Gp=async(t,e,s)=>tt(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...s}),cs=0,Bl=()=>{},zn=t=>(cs++,t.finally(()=>{cs--,Bl()})),dn=async(t,e,s)=>{let o=j,a=yt;j=t(j),yt=t(yt),Z();let r;dt=o;try{r=e()}finally{dt=null}let l=await zn(r).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let u=Gn([d.thread])[0];j=(cs?j:o).map(T=>u&&T.id===u.id?u:T),yt=(cs?yt:a).map(T=>u&&T.id===u.id?u:T),Z();let b=d.by?d.by==="claude"?"The agent":yn(d.by):"Someone";Gt(`${b[0].toUpperCase()}${b.slice(1)} changed the ${d.field} just now`,6e3),nn();return}if(!l?.ok){cs?nn():(j=o,yt=a,Z()),Kn(`${s} did not go through`,l);return}let p=Gn([await l.json().catch(()=>null)])[0];p&&(j=j.map(u=>u.id===p.id?p:u),yt=yt.map(u=>u.id===p.id?p:u),Z()),nn()},Kp=t=>t?Xt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!Bt(t)&&!n.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},Rl=async(t,e)=>{let s=[];for(let o=0;o<t.length;o+=6)s.push(...await Promise.all(t.slice(o,o+6).map(e)));return s},tn=async(t,e)=>{let s=e?void 0:Kp(j.find(l=>l.id===t)??yt.find(l=>l.id===t));await dn(l=>l.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{confirmedBy:n.me?.email??null}:{...s,confirmedBy:null,reopenedAt:new Date().toISOString(),reopenedBy:n.me?.email??"you"}}:d),()=>Gp(t,e,s),e?"Resolving":"Reopening");let o=yt.find(l=>l.id===t),a=e?Dc(o):null,r=a!=null&&yt.find(l=>l.id===a);r&&Bt(r)&&r.status!=="done"&&(await tt({id:r.id,reply:qc,status:"done",doneBy:"you"}).catch(()=>null),nn())},us=async(t,e,s=!1)=>{let o=j.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await dn(r=>r.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?n.me?.email:void 0}:l),()=>tt({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!s&&qe(`Archived #${t}`,()=>us(t,!1,!0))},qe=(t,e,s="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${f(t)}</span><button type="button">${f(s)}</button>`,Ya(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>ss(o,()=>o.remove()),5e3)},ba=new Set,ya=new Set,lo=new Map,Pl=(t,e,s,o,a)=>{lo.get(t)?.(),s();let r=!1,l=()=>{r||(r=!0,clearTimeout(d),lo.delete(t),a())},d=window.setTimeout(l,5e3);lo.set(t,l),qe(e,()=>{r||(r=!0,clearTimeout(d),lo.delete(t),o())})};addEventListener("pagehide",()=>{for(let t of[...lo.values()])t()});let Il=(t,e,s)=>!e||t.some(o=>o.id===e.id)?t:[...t.slice(0,s),e,...t.slice(s)],Bi=t=>{let e=j.find(r=>r.id===t),s=j.findIndex(r=>r.id===t),o=yt.find(r=>r.id===t),a=yt.findIndex(r=>r.id===t);Pl(`t${t}`,`Thread #${t} deleted`,()=>{ba.add(t),j=j.filter(r=>r.id!==t),yt=yt.filter(r=>r.id!==t),Z()},()=>{ba.delete(t),j=Il(j,e,s),yt=Il(yt,o,a),Z()},async()=>{let r=await zn(ie(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);ba.delete(t),r?.ok||Kn("Deleting did not go through",r),nn()})},Up=(t,e)=>{let s=`${t}|${e}`,o=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=o(j)??o(yt);if(!a)return;let r=(l,d)=>l.map(p=>p.id!==t?p:{...p,replies:(p.replies??[]).map(u=>u.at===e?d(u):u)});Pl(`r${s}`,"Reply deleted",()=>{ya.add(s),j=r(j,l=>({...l,text:"",deleted:!0})),yt=r(yt,l=>({...l,text:"",deleted:!0})),Z()},()=>{ya.delete(s),j=r(j,()=>a),yt=r(yt,()=>a),Z()},async()=>{let l=await zn(tt({id:t,unsay:e})).catch(()=>null);ya.delete(s),l?.ok||Kn("Deleting the reply did not go through",l),nn()})},Hs=null,Ol=t=>Math.max(70,t*18),ql=t=>{let e=Ct(t),s=oo.find(o=>o[0]===t.priority)?.[3]??1;return(t.id===X?-100:0)+(Se(t)?30:e==="done"?20:e==="claude"?10:0)-s},Yp=(t,e)=>{let s=[];for(let a of t){let r=e.get(a.id);if(!r)continue;let l=s.find(d=>{let p=e.get(d[0].id);return Math.abs(p.x-r.x)<6&&Math.abs(p.y-r.y)<6});l?l.push(a):s.push([a])}let o=new Map;for(let a of s){if(a.length<2)continue;a.sort((p,u)=>ql(p)-ql(u)||u.id-p.id);let r=a.length,l=Ol(r),d=String(a[0].id);a.forEach((p,u)=>{let b=(-150+120*u/(r-1))*(Math.PI/180);o.set(p.id,{key:d,i:u,n:r,fx:Math.round(l*Math.cos(b))-14,fy:Math.round(l*Math.sin(b))+4})})}return o},Ri=t=>{if(Hs!==t){Hs=t;for(let e of nt.querySelectorAll(".dt-pin[data-stack]"))e.classList.toggle("is-fanned",e.dataset.stack===t)}};document.addEventListener("pointermove",t=>{if(!Hs){let r=t.target?.closest?.(".dt-pin--stacktop");r&&t.pointerType==="mouse"&&Ri(r.dataset.stack);return}let e=nt.querySelector(`.dt-pin--stacktop[data-stack="${Hs}"]`);if(!e){Hs=null;return}let s=parseFloat(e.style.left),o=parseFloat(e.style.top),a=Number(e.querySelector(".dt-pin-count")?.textContent)||2;Math.hypot(t.clientX-s,t.clientY-(o-40))>Ol(a)+36&&Ri(null)},{passive:!0}),nt.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),Ri(e.dataset.stack))},!0);let Xp=(t,e)=>{let s=e||k||B?[]:h.filter(d=>d.id!==t).map(d=>({band:d,n:j.filter(p=>w(p)===d.id&&Uo(p)&&An(p)).length})).filter(d=>d.n).sort((d,p)=>p.n-d.n);if(ye.hidden=!s.length,!s.length)return;let[o,...a]=s,r=({band:d,n:p})=>`${p} ${p===1?"pin":"pins"} on ${d.label}`;ye.dataset.bp=o.band.id;let l=`${$t(o.band.icon,15)}<span>${f(r(o))}</span>${Va}`;ye.dataset.html!==l&&(ye.innerHTML=l,ye.dataset.html=l),ye.dataset.tip=a.length?`Also ${a.map(r).join(", ")}`:`Switch to ${o.band.label}`,ye.setAttribute("aria-label",`${r(o)} \u2014 switch to ${o.band.label}`)};ye.addEventListener("click",()=>{ye.dataset.bp&&cr(ye.dataset.bp)});let Jp=t=>{let e=j.filter(a=>w(a)===t),s=e.filter(a=>Ct(a)==="open").length,o=e.filter(a=>Ct(a)==="claude").length;Ua.innerHTML=s?String(s):o?Fe(9):"\u2713",Ua.dataset.state=s?"open":o?"claude":"done",Ua.hidden=e.length===0},co=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t||(t.style.translate="",ps))return;let e=window.visualViewport,s=t.getBoundingClientRect(),o=s.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,s.top-8)}px`)},Dl=window.visualViewport?.height??innerHeight,Fl=()=>{let t=window.visualViewport?.height??innerHeight,e=t<Dl;if(Dl=t,!e||!nt.querySelector(".dt-note"))return co();Z();let s=document.activeElement?.closest(".dt-note.is-capped");s&&(s.scrollTop=s.scrollHeight)};window.visualViewport?.addEventListener("resize",Fl),addEventListener("resize",Fl),document.addEventListener("focusin",co),document.addEventListener("focusout",()=>setTimeout(co));let va=()=>{let t=window.visualViewport;return Math.min(innerHeight,t?t.offsetTop+t.height:innerHeight,document.querySelector(".devtools:not([data-collapsed])")?.getBoundingClientRect().top??innerHeight)-8},Pi=!1,jl=null,Zp=()=>{if(X===jl||(jl=X,it.hasAttribute("data-collapsed")&&!Pi))return;let t=X!=null?j.find(o=>o.id===X):void 0,e=t&&Ce(t),s=!1;if(e){it.removeAttribute("data-collapsed");let o=it.getBoundingClientRect();s=!!o.width&&e.x>o.left-12&&e.x<o.right&&(ps||e.y>o.top&&e.y<o.bottom)}Pi=s,it.toggleAttribute("data-collapsed",s)},_l=t=>{let e=it.hidden?null:it.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},Wl=(t,e=va())=>{if(t.style.marginTop="",ps)return;let s=parseFloat(getComputedStyle(t).marginTop)||0,o=t.getBoundingClientRect().bottom-e;o>0&&(t.style.marginTop=`${s-o}px`);let a=t.getBoundingClientRect().top;a<8&&(t.style.marginTop=`${(parseFloat(t.style.marginTop)||s)+8-a}px`)},Ii=t=>{let e=va();for(let s of nt.querySelectorAll(".dt-note")){let o=s.querySelector(".dt-note-thread");o&&o.scrollTop+o.clientHeight>=o.scrollHeight-4&&t.push(o);let a=s.scrollTop;delete s.dataset.flip,delete s.dataset.flipx,o?.style.removeProperty("max-height");for(let b of["max-height","overflow-y","margin-top","translate"])s.style.removeProperty(b);s.classList.remove("is-capped");let r=s.getBoundingClientRect(),l=r.top,d=e-l,p=l-28;if(r.bottom>e&&p>d&&(s.dataset.flip="1"),r.right>_l(r)-8&&(s.dataset.flipx="1"),s.style.marginLeft="",s.dataset.flipx&&innerWidth>=480){let b=s.getBoundingClientRect(),T=_l(b);b.right>T-8&&(s.style.marginLeft=`${(parseFloat(getComputedStyle(s).marginLeft)||0)-(b.right-T+8)}px`)}r=s.getBoundingClientRect();let u=s.dataset.flip?r.height-(e-8):r.bottom-e;u>0&&o&&(o.style.maxHeight=`${Math.max(40,o.clientHeight-u)}px`),s.getBoundingClientRect().height>e-8&&(Object.assign(s.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),s.classList.add("is-capped"),Gr.has(s)?s.scrollTop=a:(Gr.add(s),s.scrollTop=s.scrollHeight)),Wl(s,e)}for(let s of t)s.scrollTop=s.scrollHeight},zl=0,ps=!1,wa=t=>{t?.target?.closest?.(Xs)||(clearTimeout(zl),zl=window.setTimeout(()=>{ps=!1,nt.querySelector(".dt-note")&&(Ii([]),requestAnimationFrame(co),en())},ps?300:150))},Z=()=>{for(let m of Object.keys(We))m!==String(X)&&delete We[m];for(let m of Ss.keys())m!==X&&Ss.delete(m);if(requestAnimationFrame(co),rs(),k){let m=Hl(),_=JSON.stringify(m);_!==Cl&&(Cl=_,parent.postMessage({dt:!0,drafts:m},location.origin))}if(Xr(),it.toggleAttribute("data-yield",X!=null||!!B),X!==fn){fn!=null&&(Pe||Le.length)?Ja.set(fn,{text:Pe,images:[...Le]}):fn!=null&&Ja.delete(fn);let m=X!=null?Ja.get(X):void 0;Pe=m?.text??"",Le=m?[...m.images]:[],fn=X}te&&te.id!==X&&(te=null);let t=Yt();if(Jp(t),Qa(),!Ut){nt.innerHTML="",li(null),Xe.hidden=!0,ye.hidden=!0;return}let e=t;if(X!=null&&!B){let m=j.find(_=>_.id===X);m&&w(m)!==e&&(X=null)}Zp();let s="",o=j.filter(m=>w(m)===e&&(Uo(m)&&An(m)||m.id===X)),a=new Map(o.map(m=>[m.id,Ce(m)])),r=Yp(o,a);ea="";for(let m of o){let _=a.get(m.id)??null,Q=r.get(m.id),Ot=ai(m),Pt=Qr(m,Ot)?"later":Ot;Pt==="later"&&(eo=Math.min(eo??1/0,m.spot?.y??document.documentElement.scrollHeight)),m.id===X&&(ea=Pt+(_?"":" \xB7 no pin"));let le=!_&&!!m.spot&&Ct(m)==="open"&&Pt==="gone";if(!_&&!le&&X!==m.id)continue;let mt=Ct(m),Tt=!_,bt=_??(le?{x:m.spot.x-scrollX,y:m.spot.y-scrollY}:{x:0,y:0});Pt!=="later"&&Xu(m,mt==="open"?Pt:"found"),le&&(s+=`<button class="dt-pin dt-pin--ghost" data-id="${m.id}" aria-expanded="${X===m.id}" aria-label="Thread ${m.id}, its element is gone" title="${f(Jt(m.text,80))} \xB7 its element is gone \u2014 click to see what it was" style="left:${bt.x}px;top:${bt.y}px"></button>`);let kt=Ks(m.category),Ht=hn(m),Te=mt==="done"?null:Ee(m),de=Te?ia[Te]??"":"",ce=Co(m,mt),Rn=!!ce&&!ce.taker,ue=!!ce&&!!ce.taker&&ce.taker!==ce.writer,Ne=mt==="done"?Co(m,"open"):null,Oa=!!Ne&&!Ne.claude&&!!Ne.taker&&Ne.taker!==Ne.writer,ko=de||_n.find(En=>En[0]===ds(m))[2],js=ce?Rn?` \xB7 ${mi(ce.writer,m)} \xB7 anyone can take it`:` \xB7 ${ue?`${mi(ce.writer,m)} \u2192 `:""}${mi(ce.taker,m)}${ce.claude?` \xB7 ${Nn(m)}${gi(m)}`:""}`:"";if(X===m.id&&(Ss.has(m.id)||Ss.set(m.id,Math.max(2,an(m).length-(jn[m.id]??an(m).length))),ll(m)),Tt||(s+=`<button class="dt-pin dt-pin--${mt}${mt==="done"&&!Se(m)?" dt-pin--resolved":""}${ce?` dt-pin--people${ue?" dt-pin--pair":""}`:Oa?" dt-pin--people dt-pin--pair":de?" dt-pin--agent":""}${Ht?" dt-pin--working":""}${mt==="open"&&De(m)==="review"?" dt-pin--review":""}${_?.hidden||_?.opener?" dt-pin--hidden":""}${_?.opener?" dt-pin--inside":""}${X!==m.id&&!gl(m,Hn)?" dt-pin--dim":""}${Q?` dt-pin--stack${Q.i?"":" dt-pin--stacktop"}${Hs===Q.key?" is-fanned":""}`:""}" data-id="${m.id}"${Q?` data-stack="${Q.key}"`:""} aria-label="Thread ${m.id}, ${mt==="open"?"open":mt==="claude"?`resolved by ${f(Zn(m.doneAgent,m.doneFor))}`:"resolved"}${f(js.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!ce&&de?`, with ${f(Nn(m))}`:""}${_?.hidden?zo:""}" aria-expanded="${X===m.id}"
|
|
281
|
-
style="left:${bt.x}px;top:${bt.y}px;--cat:${kt.color};--ring:${
|
|
282
|
-
title="${f(Jt(m.text,80))} \xB7 ${kt.label}${ce?f(
|
|
279
|
+
</div></div>`,fa=(t,e,s)=>(t||/^[a-z][a-z0-9-]*/i.exec(s?.split(">").pop()?.trim()??"")?.[0]||"element")+(e?.[0]?"."+e[0]:""),Nl=()=>ze.map((t,e)=>({i:e,el:fa(t.tag,t.classes,t.selector),text:re(t.text??""),shots:t.images?.length??0,orphan:!Ce(t)})),Ci=[],Bl="",Nn=t=>{let e=t.working;return Zn(e?.agent,e?.by??t.doneFor)},Wp=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`},ba=(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 ${Wp(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]},zp=t=>{if(n.client||Bt(t))return"";let e=Ee(t);if(!e)return t.status==="done"?"":`<button class="dt-note-state dt-step--none" data-act="hand" data-v="agent" data-id="${t.id}" data-tip="Hand to the agent" aria-label="Hand to the agent">${Rr(13,0)}</button>`;let s=Rr(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${f(ba(t,e))}" aria-label="${f(ba(t,e))}">${s}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${f(ba(t,e))}" role="img" aria-label="${f(ba(t,e))}">${s}</span>`},Hs=t=>!!n.client&&!(n.me&&t.by===n.me.email),Rl=(t,e=!0,s=!0)=>{let o=Ct(t),a=o==="done",i=Se(t);return`${e?zp(t):""}<button data-act="${a?"reopen":"done"}" data-id="${t.id}"
|
|
280
|
+
class="dt-note-resolve${a&&!i?" is-on":""}" title="${a?"Reopen":o==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${Me}</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"}">${kn}</button>`}`},Vp='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',Ni=new Map,Gp=(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),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>`},Kp=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!Se(t)){let u=t.confirmedBy?t.confirmedBy===n.me?.email?"you":yn(t.confirmedBy).split(" ")[0]:"",b=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${Xe(Wn[Wn.length-1][2],1)}<span class="dt-step-text"><b>${f(u?`Resolved by ${u}`:"Resolved")}${b?` \xB7 ${f(Br(b))}`:""}</b></span><button type="button" class="dt-step-act" data-act="reopen" data-id="${t.id}" data-tip="Reopen \u2014 not right yet" aria-label="Reopen">${gn}</button>`+(n.client?"</div>":`<button type="button" class="dt-step-act" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${kn}</button></div>`)}if(n.client||Bt(t))return"";let e=Ee(t),s={act:"hand",v:"me",icon:vl,tip:n.me?"Take it myself":"Take it off the agent"},o=[...Xr(t)?[{act:"accept-quiet",icon:Ls,tip:Jr}]:[],{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),i=!Xt(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":yn(t.assignee).split(" ")[0]:"",l=[a?.step&&`last: ${a.step}`,a?.stale&&"next run retries"].filter(Boolean).join(" \xB7 "),d=e==="queued"?{step:e,title:"With the agent \u2014 queued",sub:"Starts on the agent\u2019s next run",acts:[]}:e==="working"?a?.step?{step:e,title:"",now:a.step,time:a.elapsed,acts:[],live:!0}:{step:e,title:"With the agent \u2014 working",acts:[],live:!0}:e==="asks"?null:e==="stuck"?{step:e,title:`Silent for ${a?.silent??"a while"}`,sub:l&&l[0].toUpperCase()+l.slice(1),acts:[s]}:e==="review"?null:De(t)==="review"&&i?{step:"review",title:`${i} ${i==="You"?"say":"says"} done`,acts:o}:null;if(!d)return"";let p=d.step==="review"?Xe(_n[2][2],_n[2][3]):`<i class="dt-step-mark">${Fe(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${p}${d.now?`${Vp}<span class="dt-step-text" aria-live="polite"><b>${Gp(t.id,d.now)}</b></span>`:`<span class="dt-step-text"><b>${f(d.title)}</b>${d.sub?`<span>${f(d.sub)}</span>`:""}</span>`}${d.acts.map(u=>u.pick?`<label class="dt-step-act" data-tip="${f(u.tip)}">${u.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${f(u.tip)}"><option value="" selected hidden></option>${so().map(b=>pl(b.email,b.email===n.me?.email?`Me \xB7 ${b.name||b.email}`:b.name||b.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${u.main?" is-main":""}${u.label?" has-label":""}" data-act="${u.act}" data-id="${t.id}"${u.v?` data-v="${u.v}"`:""} data-tip="${f(u.tip)}" aria-label="${f(u.tip)}">${u.icon}${u.label?f(u.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},Up=async(t,e,s)=>tt(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...s}),cs=0,Pl=()=>{},zn=t=>(cs++,t.finally(()=>{cs--,Pl()})),dn=async(t,e,s)=>{let o=j,a=yt;j=t(j),yt=t(yt),Z();let i;dt=o;try{i=e()}finally{dt=null}let l=await zn(i).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let u=Gn([d.thread])[0];j=(cs?j:o).map(S=>u&&S.id===u.id?u:S),yt=(cs?yt:a).map(S=>u&&S.id===u.id?u:S),Z();let b=d.by?d.by==="claude"?"The agent":yn(d.by):"Someone";zt(`${b[0].toUpperCase()}${b.slice(1)} changed the ${d.field} just now`,6e3),nn();return}if(!l?.ok){cs?nn():(j=o,yt=a,Z()),Kn(`${s} did not go through`,l);return}let p=Gn([await l.json().catch(()=>null)])[0];p&&(j=j.map(u=>u.id===p.id?p:u),yt=yt.map(u=>u.id===p.id?p:u),Z()),nn()},Yp=t=>t?Xt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!Bt(t)&&!n.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},Il=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},Ge=async(t,e,s=!0)=>{let o=e?void 0:Yp(j.find(d=>d.id===t)??yt.find(d=>d.id===t));await dn(d=>d.map(p=>p.id===t?{...p,status:e?"done":"open",doneBy:e?"you":null,...e?{confirmedBy:n.me?.email??null}:{...o,confirmedBy:null,reopenedAt:new Date().toISOString(),reopenedBy:n.me?.email??"you"}}:p),()=>Up(t,e,o),e?"Resolving":"Reopening");let a=yt.find(d=>d.id===t),i=e&&s?jc(a):null,l=i!=null&&yt.find(d=>d.id===i);l&&Bt(l)&&l.status!=="done"&&(await tt({id:l.id,reply:Fc,status:"done",doneBy:"you"}).catch(()=>null),nn())},us=async(t,e,s=!1)=>{let o=j.find(i=>i.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await dn(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&&qe(`Archived #${t}`,()=>us(t,!1,!0))},qe=(t,e,s="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${f(t)}</span><button type="button">${f(s)}</button>`,Xa(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>ss(o,()=>o.remove()),5e3)},ya=new Set,va=new Set,co=new Map,Ol=(t,e,s,o,a)=>{co.get(t)?.(),s();let i=!1,l=()=>{i||(i=!0,clearTimeout(d),co.delete(t),a())},d=window.setTimeout(l,5e3);co.set(t,l),qe(e,()=>{i||(i=!0,clearTimeout(d),co.delete(t),o())})};addEventListener("pagehide",()=>{for(let t of[...co.values()])t()});let ql=(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(i=>i.id===t),s=j.findIndex(i=>i.id===t),o=yt.find(i=>i.id===t),a=yt.findIndex(i=>i.id===t);Ol(`t${t}`,`Thread #${t} deleted`,()=>{ya.add(t),j=j.filter(i=>i.id!==t),yt=yt.filter(i=>i.id!==t),Z()},()=>{ya.delete(t),j=ql(j,e,s),yt=ql(yt,o,a),Z()},async()=>{let i=await zn(ie(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);ya.delete(t),i?.ok||Kn("Deleting did not go through",i),nn()})},Xp=(t,e)=>{let s=`${t}|${e}`,o=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=o(j)??o(yt);if(!a)return;let i=(l,d)=>l.map(p=>p.id!==t?p:{...p,replies:(p.replies??[]).map(u=>u.at===e?d(u):u)});Ol(`r${s}`,"Reply deleted",()=>{va.add(s),j=i(j,l=>({...l,text:"",deleted:!0})),yt=i(yt,l=>({...l,text:"",deleted:!0})),Z()},()=>{va.delete(s),j=i(j,()=>a),yt=i(yt,()=>a),Z()},async()=>{let l=await zn(tt({id:t,unsay:e})).catch(()=>null);va.delete(s),l?.ok||Kn("Deleting the reply did not go through",l),nn()})},Cs=null,Dl=t=>Math.max(70,t*18),Fl=t=>{let e=Ct(t),s=ao.find(o=>o[0]===t.priority)?.[3]??1;return(t.id===X?-100:0)+(Se(t)?30:e==="done"?20:e==="claude"?10:0)-s},Jp=(t,e)=>{let s=[];for(let a of t){let i=e.get(a.id);if(!i)continue;let l=s.find(d=>{let p=e.get(d[0].id);return Math.abs(p.x-i.x)<6&&Math.abs(p.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((p,u)=>Fl(p)-Fl(u)||u.id-p.id);let i=a.length,l=Dl(i),d=String(a[0].id);a.forEach((p,u)=>{let b=(-150+120*u/(i-1))*(Math.PI/180);o.set(p.id,{key:d,i:u,n:i,fx:Math.round(l*Math.cos(b))-14,fy:Math.round(l*Math.sin(b))+4})})}return o},Ri=t=>{if(Cs!==t){Cs=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(!Cs){let i=t.target?.closest?.(".dt-pin--stacktop");i&&t.pointerType==="mouse"&&Ri(i.dataset.stack);return}let e=nt.querySelector(`.dt-pin--stacktop[data-stack="${Cs}"]`);if(!e){Cs=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))>Dl(a)+36&&Ri(null)},{passive:!0}),nt.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),Ri(e.dataset.stack))},!0);let Zp=(t,e)=>{let s=e||k||B?[]:h.filter(d=>d.id!==t).map(d=>({band:d,n:j.filter(p=>w(p)===d.id&&Yo(p)&&An(p)).length})).filter(d=>d.n).sort((d,p)=>p.n-d.n);if(ye.hidden=!s.length,!s.length)return;let[o,...a]=s,i=({band:d,n:p})=>`${p} ${p===1?"pin":"pins"} on ${d.label}`;ye.dataset.bp=o.band.id;let l=`${$t(o.band.icon,15)}<span>${f(i(o))}</span>${Ga}`;ye.dataset.html!==l&&(ye.innerHTML=l,ye.dataset.html=l),ye.dataset.tip=a.length?`Also ${a.map(i).join(", ")}`:`Switch to ${o.band.label}`,ye.setAttribute("aria-label",`${i(o)} \u2014 switch to ${o.band.label}`)};ye.addEventListener("click",()=>{ye.dataset.bp&&cr(ye.dataset.bp)});let Qp=t=>{let e=j.filter(a=>w(a)===t),s=e.filter(a=>Ct(a)==="open").length,o=e.filter(a=>Ct(a)==="claude").length;Ya.innerHTML=s?String(s):o?Fe(9):"\u2713",Ya.dataset.state=s?"open":o?"claude":"done",Ya.hidden=e.length===0},uo=()=>{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`)},jl=window.visualViewport?.height??innerHeight,_l=()=>{let t=window.visualViewport?.height??innerHeight,e=t<jl;if(jl=t,!e||!nt.querySelector(".dt-note"))return uo();Z();let s=document.activeElement?.closest(".dt-note.is-capped");s&&(s.scrollTop=s.scrollHeight)};window.visualViewport?.addEventListener("resize",_l),addEventListener("resize",_l),document.addEventListener("focusin",uo),document.addEventListener("focusout",()=>setTimeout(uo));let wa=()=>{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,Wl=null,tm=()=>{if(X===Wl||(Wl=X,it.hasAttribute("data-collapsed")&&!Pi))return;let t=X!=null?j.find(o=>o.id===X):void 0,e=t&&Ce(t),s=!1;if(e){it.removeAttribute("data-collapsed");let o=it.getBoundingClientRect();s=!!o.width&&e.x>o.left-12&&e.x<o.right&&(ps||e.y>o.top&&e.y<o.bottom)}Pi=s,it.toggleAttribute("data-collapsed",s)},zl=t=>{let e=it.hidden?null:it.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},Vl=(t,e=wa())=>{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=wa();for(let s of nt.querySelectorAll(".dt-note")){let o=s.querySelector(".dt-note-thread");o&&o.scrollTop+o.clientHeight>=o.scrollHeight-4&&t.push(o);let a=s.scrollTop;delete s.dataset.flip,delete s.dataset.flipx,o?.style.removeProperty("max-height");for(let b of["max-height","overflow-y","margin-top","translate"])s.style.removeProperty(b);s.classList.remove("is-capped");let i=s.getBoundingClientRect(),l=i.top,d=e-l,p=l-28;if(i.bottom>e&&p>d&&(s.dataset.flip="1"),i.right>zl(i)-8&&(s.dataset.flipx="1"),s.style.marginLeft="",s.dataset.flipx&&innerWidth>=480){let b=s.getBoundingClientRect(),S=zl(b);b.right>S-8&&(s.style.marginLeft=`${(parseFloat(getComputedStyle(s).marginLeft)||0)-(b.right-S+8)}px`)}i=s.getBoundingClientRect();let u=s.dataset.flip?i.height-(e-8):i.bottom-e;u>0&&o&&(o.style.maxHeight=`${Math.max(40,o.clientHeight-u)}px`),s.getBoundingClientRect().height>e-8&&(Object.assign(s.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),s.classList.add("is-capped"),Gr.has(s)?s.scrollTop=a:(Gr.add(s),s.scrollTop=s.scrollHeight)),Vl(s,e)}for(let s of t)s.scrollTop=s.scrollHeight},Gl=0,ps=!1,$a=t=>{t?.target?.closest?.(Js)||(clearTimeout(Gl),Gl=window.setTimeout(()=>{ps=!1,nt.querySelector(".dt-note")&&(Ii([]),requestAnimationFrame(uo),en())},ps?300:150))},Z=()=>{for(let m of Object.keys(We))m!==String(X)&&delete We[m];for(let m of Ts.keys())m!==X&&Ts.delete(m);if(requestAnimationFrame(uo),rs(),k){let m=Nl(),_=JSON.stringify(m);_!==Bl&&(Bl=_,parent.postMessage({dt:!0,drafts:m},location.origin))}if(Zr(),it.toggleAttribute("data-yield",X!=null||!!B),X!==fn){fn!=null&&(Pe||Le.length)?Za.set(fn,{text:Pe,images:[...Le]}):fn!=null&&Za.delete(fn);let m=X!=null?Za.get(X):void 0;Pe=m?.text??"",Le=m?[...m.images]:[],fn=X}te&&te.id!==X&&(te=null);let t=Yt();if(Qp(t),ti(),!Ut){nt.innerHTML="",li(null),Je.hidden=!0,ye.hidden=!0;return}let e=t;if(X!=null&&!B){let m=j.find(_=>_.id===X);m&&w(m)!==e&&(X=null)}tm();let s="",o=j.filter(m=>w(m)===e&&(Yo(m)&&An(m)||m.id===X)),a=new Map(o.map(m=>[m.id,Ce(m)])),i=Jp(o,a);na="";for(let m of o){let _=a.get(m.id)??null,Q=i.get(m.id),Ot=ai(m),Pt=el(m,Ot)?"later":Ot;Pt==="later"&&(no=Math.min(no??1/0,m.spot?.y??document.documentElement.scrollHeight)),m.id===X&&(na=Pt+(_?"":" \xB7 no pin"));let le=!_&&!!m.spot&&Ct(m)==="open"&&Pt==="gone";if(!_&&!le&&X!==m.id)continue;let mt=Ct(m),Tt=!_,bt=_??(le?{x:m.spot.x-scrollX,y:m.spot.y-scrollY}:{x:0,y:0});Pt!=="later"&&Zu(m,mt==="open"?Pt:"found"),le&&(s+=`<button class="dt-pin dt-pin--ghost" data-id="${m.id}" aria-expanded="${X===m.id}" aria-label="Thread ${m.id}, its element is gone" title="${f(Jt(m.text,80))} \xB7 its element is gone \u2014 click to see what it was" style="left:${bt.x}px;top:${bt.y}px"></button>`);let kt=Us(m.category),Ht=hn(m),Te=mt==="done"?null:Ee(m),de=Te?ra[Te]??"":"",ce=No(m,mt),Rn=!!ce&&!ce.taker,ue=!!ce&&!!ce.taker&&ce.taker!==ce.writer,Ne=mt==="done"?No(m,"open"):null,qa=!!Ne&&!Ne.claude&&!!Ne.taker&&Ne.taker!==Ne.writer,Lo=de||_n.find(En=>En[0]===ds(m))[2],_s=ce?Rn?` \xB7 ${mi(ce.writer,m)} \xB7 anyone can take it`:` \xB7 ${ue?`${mi(ce.writer,m)} \u2192 `:""}${mi(ce.taker,m)}${ce.claude?` \xB7 ${Nn(m)}${gi(m)}`:""}`:"";if(X===m.id&&(Ts.has(m.id)||Ts.set(m.id,Math.max(2,an(m).length-(jn[m.id]??an(m).length))),cl(m)),Tt||(s+=`<button class="dt-pin dt-pin--${mt}${mt==="done"&&!Se(m)?" dt-pin--resolved":""}${ce?` dt-pin--people${ue?" dt-pin--pair":""}`:qa?" dt-pin--people dt-pin--pair":de?" dt-pin--agent":""}${Ht?" dt-pin--working":""}${mt==="open"&&De(m)==="review"?" dt-pin--review":""}${_?.hidden||_?.opener?" dt-pin--hidden":""}${_?.opener?" dt-pin--inside":""}${X!==m.id&&!bl(m,Hn)?" dt-pin--dim":""}${Q?` dt-pin--stack${Q.i?"":" dt-pin--stacktop"}${Cs===Q.key?" is-fanned":""}`:""}" data-id="${m.id}"${Q?` data-stack="${Q.key}"`:""} aria-label="Thread ${m.id}, ${mt==="open"?"open":mt==="claude"?`resolved by ${f(Zn(m.doneAgent,m.doneFor))}`:"resolved"}${f(_s.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!ce&&de?`, with ${f(Nn(m))}`:""}${_?.hidden?Vo:""}" aria-expanded="${X===m.id}"
|
|
281
|
+
style="left:${bt.x}px;top:${bt.y}px;--cat:${kt.color};--ring:${Lo};--hue:${Oe(m.by||m.byName||"")}${de?`;--step-c:${de}`:""}${qi.has(m.id)?`;--dt-page:${qi.get(m.id)}`:""}${Q?`;--fx:${Q.fx}px;--fy:${Q.fy}px`:""}"
|
|
282
|
+
title="${f(Jt(m.text,80))} \xB7 ${kt.label}${ce?f(_s):Ht||Te==="queued"?` \xB7 ${f(Nn(m)+gi(m))}`:""}${mt==="claude"?` \xB7 resolved by ${f(Zn(m.doneAgent,m.doneFor))} \u2014 tick to confirm`:mt==="done"?" \xB7 resolved":""}${_?.hidden||_?.opener?Vo:""}${Os(m)?" \u2014 drag to move":""}"${Os(m)?" data-move":""}>${mt==="done"?Ne?`${vn(Ne.writer,m)}${qa?vn(Ne.taker,m):""}<i class="dt-pin-cut" aria-hidden="true">${Me}</i>`:"\u2713":ce?`${vn(ce.writer,m)}${ue?vn(ce.taker,m):""}${ce.claude?`<i class="dt-pin-claude" aria-hidden="true">${Fe(9)}</i>`:""}`:de?Fe(11):ui(m)}${X!==m.id&&dl(m)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}${Q&&!Q.i?`<i class="dt-pin-count" aria-hidden="true">${Q.n}</i><i class="dt-pin-spot" aria-hidden="true"></i>`:""}</button><i class="dt-pin-eye" data-eye="${m.id}" aria-hidden="true" style="left:${bt.x}px;top:${bt.y}px"${_?.hidden||_?.opener?"":" hidden"}>${io}</i>`),X===m.id){let En=an(m),Ws=Ee(m)==="review"&&!n.client?En.map(wt=>wt.author).lastIndexOf("claude"):-1,zs=Ee(m)==="asks"&&!n.client?En.length-1:-1;s+=`<div class="dt-note${Tt?" dt-note--orphan":""}" data-id="${m.id}" role="dialog" aria-label="Thread ${m.id}"
|
|
283
283
|
style="left:${bt.x}px;top:${bt.y}px">
|
|
284
284
|
<div class="dt-note-bar">
|
|
285
|
-
${m.id>0&&!(n.client||Bt(m))?`<span class="dt-note-num">#${m.id}</span>`:""}${m.by||m.byName?`<i class="dt-note-pin" style="--pin-c:${
|
|
286
|
-
<span class="dt-note-el"${n.client?"":` data-tip="${
|
|
285
|
+
${m.id>0&&!(n.client||Bt(m))?`<span class="dt-note-num">#${m.id}</span>`:""}${m.by||m.byName?`<i class="dt-note-pin" style="--pin-c:${Lo}" aria-hidden="true">${vn((m.by||m.byName||"").toLowerCase(),m)}</i>`:""}
|
|
286
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${fl(m.selector,m.label)}"`}>${n.client||Bt(m)?`Thread #${m.id>0?m.id:"\u2026"}`:f(fa(m.tag,m.classes,m.selector))}</span>
|
|
287
287
|
<span class="dt-note-tools">
|
|
288
|
-
${
|
|
288
|
+
${Rl(m,!1,!1)}
|
|
289
289
|
<i class="dt-note-sep"></i>
|
|
290
|
-
${
|
|
290
|
+
${Hs(m)?"":$l(m)}
|
|
291
291
|
<button data-act="close" data-id="${m.id}" data-tip="Close" aria-label="Close">${Pn}</button>
|
|
292
292
|
</span>
|
|
293
293
|
</div>
|
|
294
|
-
${
|
|
295
|
-
${(wt=>`<div class="dt-note-hidden"${_?.hidden?"":" hidden"}><b>${
|
|
296
|
-
${Tt&&Pt!=="gone"&&Pt!=="later"?
|
|
297
|
-
${(()=>{let wt=
|
|
294
|
+
${tp(m,_,Pt,Tt)}
|
|
295
|
+
${(wt=>`<div class="dt-note-hidden"${_?.hidden?"":" hidden"}><b>${io}<span>${wt?`In \xAB${f(wt)}\xBB \u2014 closed`:"Hidden right now"}</span></b><button type="button" data-act="where" data-id="${m.id}">Show it</button></div>`)(gp(_?.shut&&_.shut!==_.el?_.shut:_?.hidden))}
|
|
296
|
+
${Tt&&Pt!=="gone"&&Pt!=="later"?Qu(m):""}
|
|
297
|
+
${(()=>{let wt=cp(m)+fi(Us(m.category).id,m.id,Hs(m))+qu(m)+(m.host&&m.host!==location.host?`<span class="dt-note-host" title="Written on ${f(m.host)}">${f(m.host)}</span>`:"");return wt?`<div class="dt-note-meta">${wt}</div>`:""})()}
|
|
298
298
|
<div class="dt-note-thread">
|
|
299
|
-
${
|
|
300
|
-
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${m.id}">${Me}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${m.id}">${gn}Send back</button
|
|
299
|
+
${up(m,En.map((wt,Ae)=>{let vs=Ae===0?null:wt.at??null,pn=wt.author==="you"&&(!wt.by||wt.by===n.me?.email),Xn=pn&&te?.id===m.id&&te.at===vs,ee=n.team?.find(Mt=>Mt.email===wt.by),mn=wt.author==="claude"?Zn(wt.agent,wt.by):pn?"You":ee?.name||wt.byName||wt.by||"You",Da=wt.author==="claude"?`<span class="dt-msg-face dt-msg-ai">${Fe(11)}</span>`:(Mt=>Fn(ee?.avatar_url,ee?.name||wt.byName||(pn?n.me?.name:"")||wt.by||mn,"dt-msg-face").replace(/^<(img|b) /,`<$1 style="--hue:${Oe(Mt)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"))((wt.by||(pn?n.me?.email??"":"")||mn).toLowerCase()),So=`${m.id}:${wt.at??"0"}`,Jn=wn.get(So)?.text,Vs=!pn&&n.voice&&wt.text?Pp(m.id,wt.at??"0",wt.text):"",To=Vs?Op(m.id,wt.at??"0",wt.text):"",v=m.id<=0?null:Ae===0?"":m.replies?.some(Mt=>Mt.at===wt.at)?wt.at:null,I=v===null?"":Fp(m.id,v,wt.reactions),K=v!==null&&!I?`<button class="dt-msg-edit" data-act="react-pick" data-id="${m.id}" data-at="${f(v)}" data-tip="Add reaction" aria-label="Add reaction">${Tl}</button>`:"",W=wt.author==="claude"?[kr(wt.agent),wt.by&&wt.by!==n.me?.email?(ee?.name||wt.by).split(" ")[0]:""].filter(Boolean).join(" \xB7 "):"",ot=`<div class="dt-msg-head">${Da}<b>${f(mn)}</b>${W?`<span class="dt-msg-sub">${f(W)}</span>`:""}<time>${Qn(wt.at)}</time>${K}${Vs}${pn&&!Xn?`<button class="dt-msg-edit" data-act="edit" data-id="${m.id}" data-at="${f(vs??"")}" title="Edit">${es}</button>${vs?`<button class="dt-msg-edit" data-act="unsay" data-id="${m.id}" data-at="${f(vs)}" title="Delete">${ts}</button>`:""}`:""}</div>`;return Ae===Ws?`<div class="dt-msg dt-msg--done" data-msg="${m.id}:${f(wt.at??"0")}"><div class="dt-msg-head">${Da}<b>${f(mn)} fixed it</b><time>${Qn(wt.at)}</time>${Vs}</div><p${wn.get(So)?.text===null?' class="is-asking"':""}>${Rd(Jn||wt.text)}</p>${To}${Mi(wt.images)}${I}
|
|
300
|
+
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${m.id}">${Me}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${m.id}">${gn}Send back</button>${Xr(m)?`<button type="button" class="dt-done-act" data-act="accept-quiet" data-id="${m.id}" data-tip="${Jr}">${Ls}Nothing to fix</button>`:""}</div></div>`:Xn?`<div class="dt-msg">${ot}<div class="dt-compose">
|
|
301
301
|
<textarea class="dt-note-edit-input" rows="1" maxlength="${Hi}" aria-label="Edit the message">${f(te.text)}</textarea>
|
|
302
302
|
${Mi(wt.images.filter(Mt=>!te.drop.includes(Mt.split("/").pop())),m.id)}
|
|
303
303
|
<div class="dt-compose-bar">
|
|
304
304
|
<button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
|
|
305
305
|
<button class="dt-send${te.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${Me}</button>
|
|
306
306
|
</div>
|
|
307
|
-
</div></div>`:`<div class="dt-msg${pn?" dt-msg--mine":""}${Ae===
|
|
307
|
+
</div></div>`:`<div class="dt-msg${pn?" dt-msg--mine":""}${Ae===zs?" dt-msg--asks":""}" data-msg="${m.id}:${f(wt.at??"0")}">${Ae===zs?ot.replace(`<b>${f(mn)}</b>`,`<b>${f(mn)} asks</b>`):ot}<p${wn.get(So)?.text===null?' class="is-asking"':""}>${Rd(Jn||wt.text)}</p>${To}${Ae===0&&m.suggest?lp(m.suggest):""}${Mi(wt.images)}${I}</div>`}),te?.id===m.id?1/0:(Ts.get(m.id)??2)+(Ws===En.length-1||zs>=0?1:0))}
|
|
308
308
|
</div>
|
|
309
309
|
${We[m.id]?`<button type="button" class="dt-new-below" data-act="newbelow" data-id="${m.id}">${We[m.id]} new ${We[m.id]===1?"reply":"replies"} \u2193</button>`:""}
|
|
310
|
-
${
|
|
311
|
-
${
|
|
312
|
-
${
|
|
310
|
+
${Kp(m)}
|
|
311
|
+
${Cl("dt-note-reply-input",Ee(m)==="asks"?`Answer ${f(Nn(m))}`:"Reply",Pe,`data-act="reply" data-id="${m.id}"`,Ll(Le))}
|
|
312
|
+
${yl(m.priority,m.category,m.id,m.assignee??"",Hs(m),Bt(m),!0)}
|
|
313
313
|
</div>`}}ze.forEach((m,_)=>{let Q=Ce(m);Q&&(s+=`<button class="dt-pin dt-pin--draft" data-parked="${_}" data-act="draft-open" data-i="${_}"
|
|
314
|
-
style="left:${Q.x}px;top:${Q.y}px" title="Draft, not sent \u2014 click to finish it">${
|
|
314
|
+
style="left:${Q.x}px;top:${Q.y}px" title="Draft, not sent \u2014 click to finish it">${rl()}</button>`)});let l=B&&Ce(B);if(B){let m=l?.x??0,_=l?.y??0;s+=`${l?`<span class="dt-pin dt-pin--draft" data-draft style="left:${m}px;top:${_}px">${rl()}</span>`:""}
|
|
315
315
|
<div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${m}px;top:${_}px">
|
|
316
316
|
<div class="dt-note-bar">
|
|
317
|
-
<span class="dt-note-el"${n.client?"":` data-tip="${
|
|
318
|
-
${
|
|
317
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${fl(B.selector,B.label)}"`}>${n.client?"New thread":f(fa(B.tag,B.classes,B.selector))}</span>
|
|
318
|
+
${Zs()?'<span class="dt-note-draft">Draft</span>':""}
|
|
319
319
|
<span class="dt-note-tools">
|
|
320
320
|
|
|
321
|
-
${
|
|
321
|
+
${$l()}
|
|
322
322
|
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${Pn}</button>
|
|
323
323
|
</span>
|
|
324
324
|
</div>
|
|
325
325
|
${l?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
|
|
326
|
-
${(()=>{let Q=l?
|
|
327
|
-
${n.client?`<div class="dt-note-meta">${
|
|
326
|
+
${(()=>{let Q=l?tn(B):null,Ot=Q&&j.find(Pt=>Pt.id>0&&Ct(Pt)==="open"&&tn(Pt)===Q);return Ot?`<p class="dt-note-twin">Already open here: \u201C${f(Jt(Ot.text,60))}${Ot.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${Ot.id}">Open it</button></p>`:""})()}
|
|
327
|
+
${n.client?`<div class="dt-note-meta">${fp(B.assignee)}</div>`:""}
|
|
328
328
|
${B.suggest?`<div class="dt-suggest"><span class="dt-suggest-head">New wording for this text<button data-act="unsuggest" title="Keep the text as it is">${Pn}</button></span>
|
|
329
329
|
<span class="dt-suggest-was">Now: <del>${f(Jt(B.suggest.from,160))}${B.suggest.from.length>160?"\u2026":""}</del></span>
|
|
330
330
|
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${f(B.suggest.to)}</textarea>
|
|
331
331
|
<span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
|
|
332
|
-
<div class="dt-note-meta dt-note-type">${fi(
|
|
333
|
-
${
|
|
334
|
-
${B.carried&&B.assignee?`<p class="dt-carried">${
|
|
335
|
-
${
|
|
336
|
-
</div>`}let d=new Map([...nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(m=>[m.closest(".dt-note").dataset.id,{top:m.scrollTop,end:m.scrollTop+m.clientHeight>=m.scrollHeight-4}])),p=new Set([...nt.querySelectorAll("[data-msg]")].map(m=>m.dataset.msg)),u=nt.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Xp(e,Sn.hidden?o.some(m=>!!a.get(m.id)):o.length>0),Fr(nt,s),u&&!nt.contains(document.activeElement)&&yo(".dt-note-reply-input");let b=[],T=[];for(let m of nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let _=m.closest(".dt-note").dataset.id,Q=d.get(_);if(!Q){b.push(m),delete We[_],m.parentElement.querySelector(".dt-new-below")?.remove();continue}let Ot=[...m.querySelectorAll("[data-msg]")].filter(mt=>!p.has(mt.dataset.msg));for(let mt of Ot)mt.classList.add("dt-msg--new");let Pt=Q.end||String(Wo)===_;Pt&&T.push(m),m.scrollTop=Pt?m.scrollHeight:Q.top;let le=Ot.filter(mt=>!mt.classList.contains("dt-msg--mine")).length;if(le&&!Q.end&&String(Wo)!==_){We[_]=(We[_]??0)+le;let mt=We[_],Tt=m.parentElement.querySelector(".dt-new-below")??m.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Tt.dataset,{act:"newbelow",id:_}),Tt.textContent=`${mt} new ${mt===1?"reply":"replies"} \u2193`}}for(let m of nt.querySelectorAll(".dt-new-below")){let _=m.closest(".dt-note")?.querySelector(".dt-note-thread");(!_||_.scrollTop+_.clientHeight>=_.scrollHeight-4)&&(delete We[m.dataset.id],m.remove())}Wo=null,Ii([...b,...T]),requestAnimationFrame(()=>nt.querySelectorAll(".dt-note-thread").forEach(Vo)),X==null?_o=null:X!==_o&&nt.querySelector(`.dt-note[data-id="${X}"]`)&&(_o=X,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&yo(`.dt-note[data-id="${X}"] .dt-note-reply-input`)),ge(e),li(di()),en();for(let m of nt.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))or(m);let P=nt.querySelector(".dt-note-input");P&&document.activeElement!==P&&(P.focus(),P.setSelectionRange(P.value.length,P.value.length))},Oi=0,Qp=()=>{Wi&&Ut&&!k&&sd();let t=!1,e=document.getAnimations().some(u=>u.playState==="running"),s=[],o=!1,a=new Map(j.map(u=>[u.id,u])),r=400,l=(u,b)=>b>-r&&b<innerHeight+r&&u>-r&&u<innerWidth+r;for(let u of nt.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(u.classList.contains("dt-note--orphan")||u.classList.contains("is-dragging"))continue;if(u.classList.contains("dt-pin--ghost")){let P=a.get(Number(u.dataset.id))?.spot;s.push([u,P?{x:P.x-scrollX,y:P.y-scrollY,el:document.body}:null]);continue}let b=a.get(Number(u.dataset.id)),T=b&&Ce(b);s.push([u,T&&u.matches(".dt-pin")&&l(T.x,T.y)&&Ru(T.el,T.x,T.y)?null:T]),T&&e&&el(T.el)&&(t=!0)}for(let u of nt.querySelectorAll("[data-draft], [data-parked]")){if(u.classList.contains("dt-note--orphan"))continue;let b=u.dataset.parked?ze[Number(u.dataset.parked)]:B;s.push([u,b?Ce(b):null])}let d=(u,b,T)=>{Math.abs(parseFloat(u.style.left)-b)<.05||(u.style.left=`${b}px`,o=!0),Math.abs(parseFloat(u.style.top)-T)<.05||(u.style.top=`${T}px`,o=!0)};for(let[u,b]of s){if(b&&u.style.left&&!l(b.x,b.y)&&!l(parseFloat(u.style.left),parseFloat(u.style.top))&&u.matches(".dt-pin"))continue;let T=u.nextElementSibling;if(!b){u.style.visibility!=="hidden"&&(u.style.visibility="hidden"),T?.matches(".dt-pin-eye")&&!T.hidden&&(T.hidden=!0);continue}if(u.style.visibility&&(u.style.visibility=""),d(u,b.x,b.y),u.matches(".dt-pin[data-id]")){let P=!!(b.hidden||b.opener);if(u.classList.contains("dt-pin--hidden")!==P){u.classList.toggle("dt-pin--hidden",P);for(let m of["title","aria-label"]){let _=(u.getAttribute(m)??"").replace(zo,"");u.setAttribute(m,P?_.replace(/( \u2014 drag to move)?$/,`${zo}$1`):_)}}T?.matches(".dt-pin-eye")&&(T.hidden===P&&(T.hidden=!P),P&&d(T,b.x,b.y))}u.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!b.hidden)}if(!sa.length&&(B||X!=null)){let u=di();u&&e&&el(u)&&li(u)}let p=nt.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(p.length){let u=va();for(let b of p)b.style.visibility!=="hidden"&&Wl(b,u)}Bu(B||X!=null?di():null),Oi=o?0:Oi+1,t&&en(),clearTimeout(Vl),Vl=window.setTimeout(tm,150)},qi=new Map,Vl=0,tm=()=>{let t=new Map,e=o=>{let a=[],r="";for(let l=o;l;l=l.parentElement){let d=t.get(l);if(d!==void 0){r=d;break}if(a.push(l),/^(IMG|VIDEO|CANVAS|PICTURE|IFRAME)$/.test(l.tagName)){r="var(--dt-bg)";break}let p=getComputedStyle(l);if(p.backgroundImage!=="none"){r="var(--dt-bg)";break}let u=p.backgroundColor.match(/[\d.]+/g);if(u&&(u[3]===void 0?1:+u[3])>=.9){r=p.backgroundColor;break}}r||="#fff";for(let l of a)t.set(l,r);return r},s=[];for(let o of nt.querySelectorAll(".dt-pin[data-id]")){if(o.style.visibility==="hidden"||o.classList.contains("is-dragging"))continue;let a=o.getBoundingClientRect(),r=document.elementsFromPoint(a.x+a.width/2,a.y+a.height/2).find(l=>!In(l));r&&s.push([o,e(r)])}for(let[o,a]of s)qi.set(Number(o.dataset.id),a),o.style.setProperty("--dt-page",a)},Gl=t=>`dt-gfold:${n.project||location.host}:${t}`,ge=t=>{if(it.hidden){it.replaceChildren();return}if(it.toggleAttribute("data-picking",!!Ie),Fr(it,vu({bp:t,notes:j.filter(An),breakpoints:h,bandOfNote:w,orphan:e=>!Ce(e),statusTools:e=>Nl(e,!1),tick:ep,replied:np,rowMenu:sp,menuFor:Dn,showResolved:Ze,showArchived:bn,archived:Se,drafts:Sn.hidden?Hl():Ci,checks:k?0:xa.toCheck().length,clients:Je()&&Ve==="clients",marker:nm,assign:tp,mirror:e=>Je()?ti(e)?"here":Bt(e)&&Yo(e)?"there":"":"",picking:Ie,pickable:ks,mirrorAll:Jo()?j.filter(e=>An(e)&&w(e)===t&&ks(e)).map(e=>e.id):[],draftFace:n.me?`<span class="dt-hist-face" style="--hue:${Oe(n.me.email)}">${ui({by:n.me.email,byName:n.me.name})}</span>`:"",draftName:n.me?.name||"You",find:oe,forMe:em,forAgent:e=>!!Ee(e)&&Ct(e)!=="done",unread:rl,archives:!n.client,deletable:e=>!As(e),folded:it.hasAttribute("data-collapsed"),shut:e=>ct.getItem(Gl(e))==="1",cap:Kl,keep:X})),Cs){let e=it.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Cs.at,Cs.at),Cs=null}},Cs=null,Kl=150,em=t=>{if(Ct(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||Ct(t)==="claude"||De(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return an(t).some(s=>s.text.toLowerCase().includes("@"+e))},nm=t=>{let e=Ee(t),s=ia[e??""],o=Ct(t)==="done"?Se(t)?`<i class="dt-hist-badge is-archived">${kn}</i>`:`<i class="dt-hist-badge is-done">${Me}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${Fe(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${_n.find(r=>r[0]===ds(t))[2]}"></i>`,a=ui(t)||Fn(void 0,t.byName||(t.by==="you"||!t.by?"You":t.by)).replace(/>([^<])[^<]*<\/b>$/,">$1</b>");return`<span class="dt-hist-face" style="--hue:${Oe(t.by||t.byName||"you")}">${a}</span>`},$a=t=>{Pi=!1;let e=it.hasAttribute("data-collapsed");if(t===e||it.hidden){it.toggleAttribute("data-collapsed",t),Z();return}let s=it.querySelector(".dt-hist-head")?.offsetHeight??44;if(t){it.setAttribute("data-folding",""),Or(it,it.offsetHeight,s,!1,()=>{it.removeAttribute("data-folding"),it.setAttribute("data-collapsed",""),Z()});return}it.removeAttribute("data-folding"),it.removeAttribute("data-collapsed"),Z(),Or(it,s,it.offsetHeight,!0,()=>{})},Ul=t=>{let e=[];for(let s=t.nextElementSibling;s&&s.classList.contains("dt-hist-row");s=s.nextElementSibling)e.push(s);return e},Yl=t=>{let e=document.createElement("div");return e.className="dt-hist-rows",t[0].before(e),e.append(...t),e},sm=t=>{let e=Gl(t),s=ct.getItem(e)==="1",o=it.querySelector(".dt-hist-list"),a=o?.clientHeight??600,r=()=>it.querySelector(`[data-gfold="${CSS.escape(t)}"]`)?.closest(".dt-hist-group");if(!s){let u=r(),b=u?Ul(u):[],T=()=>{z(e,"1"),ge(Yt())};if(!b.length||!ns())return T();let P=Yl(b);Ga(P,!1,a),On(P).then(T);return}z(e,""),ge(Yt());let l=r(),d=l?Ul(l):[];if(!d.length||!ns())return;let p=Yl(d);p.hidden=!0,Ga(p,!0,a),On(p).then(()=>{p.isConnected&&(p.before(...p.children),p.remove())})};it.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(oe.q=e.value,Cs={at:e.selectionStart??e.value.length},ge(Yt()))}),it.addEventListener("click",async t=>{let e=t.target;if(e.closest("[data-hist-more]")){oe.more=!oe.more,Dn=null,oe.menu=!1,ge(Yt());return}let s=e.closest("[data-row-more]");if(s){let kt=Number(s.dataset.rowMore);Dn=Dn===kt?null:kt,oe.more=!1,ge(Yt());return}if((oe.more||Dn!=null)&&!e.closest(".dt-hist-menu")&&(oe.more=!1,Dn=null,ge(Yt()),!e.closest("[data-go]"))||e.closest(".dt-hist-assign"))return;let o=()=>{oe.more=!1,Dn=null};if(e.closest("[data-hist-rows]")){Kl+=300,ge(Yt());return}if(e.closest("[data-read-all]")){for(let kt of j)ll(kt);o(),ge(Yt());return}let a=e.closest("[data-resolve-all]");if(a){let kt=a.dataset.resolveAll.split(",").map(Number);o(),await Rl(kt,Ht=>tn(Ht,!0)),qe(`Resolved ${kt.length}`,()=>Rl(kt,Ht=>tn(Ht,!1)));return}let r=e.closest("[data-row-unread]");if(r){let kt=Number(r.dataset.rowUnread);jn[kt]=Math.max(0,an(j.find(Ht=>Ht.id===kt)).length-1),hi(),o(),ge(Yt());return}let l=e.closest("[data-row-link]");if(l){o(),ge(Yt()),await navigator.clipboard?.writeText(`${location.origin}${location.pathname}#thread-${l.dataset.rowLink}`).catch(()=>null),Gt("Link copied");return}let d=e.closest("[data-row-select]");if(d){o();let kt=Number(d.dataset.rowSelect),Ht=j.find(Te=>Te.id===kt);Ie=new Set(Ht&&ks(Ht)?[kt]:[]),Xo=kt,ge(Yt());return}let p=e.closest("[data-row-mirror]");if(p){o(),ge(Yt()),await Aa([Number(p.dataset.rowMirror)]);return}let u=e.closest("[data-mirror-all]");if(u){o(),ge(Yt()),await Aa(u.dataset.mirrorAll.split(",").map(Number));return}if(e.closest("[data-pick-mirror]")){await Rd();return}if(e.closest("[data-pick-cancel]")){ir();return}let b=e.closest(".dt-hist-go[data-go]");if(b&&Jo()&&(Ie||t.metaKey||t.ctrlKey||t.shiftKey)){t.preventDefault(),Lm(Number(b.dataset.go),t.shiftKey);return}let T=e.closest("[data-row-move]");if(T){o(),await ar(Number(T.dataset.rowMove));return}if(e.closest(".dt-hist-menu.is-row [data-act], .dt-hist-menu.is-row [data-rm]")&&o(),it.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){$a(!1);return}if(t.target.closest("[data-fold]")){$a(!it.hasAttribute("data-collapsed"));return}let P=t.target.closest("[data-gfold]");if(P){sm(P.dataset.gfold);return}let m=t.target.closest(".dt-hist-bands [data-bp]");if(m){cr(m.dataset.bp);return}let _=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(_){_.dataset.histView?(oe.view=_.dataset.histView,z("dt-view",oe.view),oe.menu=!1):_.dataset.histSort?(oe.sort=_.dataset.histSort,z("dt-sort",oe.sort),oe.menu=!1,oe.more=!1):_.hasAttribute("data-hist-clear")?(oe.q="",Cs={at:0}):oe.menu=!oe.menu,ge(Yt());return}oe.menu&&!t.target.closest(".dt-hist-menu")&&(oe.menu=!1,ge(Yt()));let Q=t.target.closest("[data-draft-go], [data-draft-rm]");if(Q){let kt=Q.dataset.draftRm!==void 0,Ht=Number(kt?Q.dataset.draftRm:Q.dataset.draftGo);Sn.hidden?kt?Xl(Ht):Di(Ht):Ue(kt?{dropDraft:Ht}:{openDraft:Ht});return}let Ot=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(e.closest(".dt-hist-menu.is-panel [data-resolved], .dt-hist-menu.is-panel [data-archived], .dt-hist-menu.is-panel [data-archive-all]")&&(oe.more=!1),Ot){await tn(Number(Ot.dataset.id),Ot.dataset.act==="done");return}let Pt=t.target.closest("[data-rm]");if(Pt){X=null,Bi(Number(Pt.dataset.rm));return}if(t.target.closest("[data-review]")){xa.start();return}if(t.target.closest("[data-resolved]")){ji(!Ze);return}if(t.target.closest("[data-archived]")){_i(!bn);return}let le=t.target.closest("[data-archive-all]");if(le){let kt=le.dataset.archiveAll.split(",").map(Number);for(let Ht of kt)await us(Ht,!0,!0);qe(`Archived ${kt.length}`,()=>{for(let Ht of kt)us(Ht,!1,!0)});return}let mt=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(mt){await us(Number(mt.dataset.id),mt.dataset.act==="archive");return}let Tt=t.target.closest("[data-go]");if(!Tt)return;let bt=Number(Tt.dataset.go);if(!Sn.hidden){Ue({open:bt});return}ms(bt)});let ms=t=>{X=t,_o=null,rn(),ps=!0,Z();let e=j.find(a=>a.id===t),s=e&&Ce(e);if(s)scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"});else if(e){let a=Qe(e);a?a.scrollIntoView({block:"center",behavior:"smooth"}):tl(e)}let o=nt.querySelector(`.dt-pin[data-id="${t}"]`);o&&Oo(o,"land"),wa()},Di=t=>{let[e]=ze.splice(t,1);if(!e)return;rn(),B=e,X=null;let s=Ce(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),Z()},Xl=t=>{ze.splice(t,1),Z()},xa=wu({inFrame:k,everything:()=>yt,route:()=>xt,settle:tn,keepIn:Ya,toast:t=>Gt(t),waits:t=>Ct(t)==="claude"||Ct(t)==="open"&&ds(t)==="review",approve:t=>tn(t.id,!0),open:t=>{if(Ut||sn(!0),w(t)!==Yt()){cr(w(t));for(let e of[600,1500])setTimeout(()=>Ue({open:t.id}),e)}else ms(t.id)}}),Jl=t=>{if(it.hidden){t?.();return}ss(it,()=>{it.hidden=!0,t?.()})},Zl=()=>{Io(it),it.hidden=!1},om=t=>{t?Zl():Jl(),xe.setAttribute("aria-pressed",String(t)),z("dt-history",t?"1":"0"),Z()},Fi=document.querySelector(".dt-resolved-btn"),Vn=document.querySelector(".dt-space"),am=()=>{if(!Vn)return;Vn.hidden=!Je(),Vn.dataset.on=Ve;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Je()&&Ve==="clients"?(t.dataset.dtSpace="clients",e||(t.classList.add("dt-client-glow"),window.setTimeout(()=>t.classList.remove("dt-client-glow"),1700))):delete t.dataset.dtSpace;let s=document.querySelector(".dt-client-tab");s&&(s.inert=t.dataset.dtSpace!=="clients",s.ariaHidden=s.inert?"true":null);for(let o of Vn.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===Ve));let r=yt.filter(l=>!Se(l)&&Ct(l)!=="done"&&Bt(l)===(a==="clients")).length;o.querySelector(".dt-space-n").textContent=r?String(r):""}Vn.querySelector(".dt-space-name").textContent=Ve==="clients"?"Client":"Team",Vn.querySelector(".dt-space-ic").innerHTML=$t(Pr[Ve],14)},Ql=0,Ns=t=>{if(!Je()||t===Ve)return;let e=()=>{Ve=t,Ie=null,z("dt-space",t),X!=null&&!An(j.find(a=>a.id===X))&&(X=null),rn(),hs(yt),Z(),ge(Yt())},s=document.documentElement,o=++Ql;s.classList.add("dt-switching"),Promise.all([On(nt),On(it)]).then(()=>{o===Ql&&(e(),requestAnimationFrame(()=>s.classList.remove("dt-switching")))})};document.querySelector(".dt-client-x")?.addEventListener("click",()=>Ns("studio")),Vn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&(Vn.open=!1,Ns(e.dataset.space))});let Bs=document.querySelector(".dt-pinf"),Rs=Bs.querySelector(".dt-pinf-btn"),cn=Bs.querySelector(".dt-pinf-menu"),td={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My agent",wrote:"Written by me",check:"To check"},im=()=>j.filter(t=>w(t)===Yt()&&Uo(t)&&An(t)),uo=(t,e=!1)=>{cn.hidden=!t,Rs.setAttribute("aria-expanded",String(t)),t&&(Qa(),e&&cn.querySelector('[aria-checked="true"]')?.focus())};Qa=()=>{let t=im();if(Bs.hidden=!Je()||!t.length,Bs.hidden){cn.hidden=!0;return}let e=Object.fromEntries(Yr.map(u=>[u,t.filter(b=>gl(b,u)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",Oe(s)],["others","var(--dt-faint)"]];if(Rs.toggleAttribute("data-on",Hn!=="all"),Rs.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} anyone can take, ${e.mine} mine, ${e.others} everyone else's, ${e.resolved} resolved${Hn==="all"?"":`; showing ${td[Hn]}, ${e[Hn]}`}`),cn.hidden)return;let a=[...new Set(t.map(u=>Co(u,Ct(u))?.taker).filter(u=>!!u&&u!==s))].slice(0,2),r=u=>Fn(ln(u)?.avatar_url,ln(u)?.name||u,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${Oe(u)}" `),l={all:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 3 3 6.5 10 10l7-3.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5"/></svg>',nobody:'<svg viewBox="0 0 16 16" width="16" height="16"><circle cx="8" cy="8" r="7" stroke="var(--dt-new)" stroke-width="1.5" stroke-dasharray="2.5 2"/></svg>',mine:r(s),others:a.map(r).join("")||'<svg viewBox="0 0 20 20" width="14" height="14"><circle cx="8" cy="7" r="3"/><path d="M3 16.5c.5-2.8 2.5-4.5 5-4.5s4.5 1.7 5 4.5M13.5 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1 .9 1.6 2.3 1.8 4.1"/></svg>',claude:`<i class="dt-pinf-claude">${Fe(10)}</i>`,wrote:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 16.5h6.5M13.4 3.9a1.8 1.8 0 0 1 2.6 2.6L7.4 15.1 4 16l.9-3.4z"/></svg>',check:Ye(_n[2][2],_n[2][3]),resolved:Ye(Wn[Wn.length-1][2],Wn[Wn.length-1][3])},d=(u,b)=>`<b class="dt-pinf-share"><i style="--c:${b};width:${Math.round(100*e[u]/e.all)}%"></i></b>`,p=(u,b="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${Hn===u}" data-pinf="${u}"><i class="dt-pinf-glyph">${l[u]}</i><span>${td[u]}</span>${b?d(u,b):""}<em>${e[u]}</em>${Me}</button>`;cn.innerHTML=`${p("all")}${o.map(([u,b])=>p(u,b)).join("")}${e.resolved||Hn==="resolved"?p("resolved"):""}<hr>${p("claude")}${p("wrote")}${p("check")}`},Rs.addEventListener("click",t=>uo(cn.hidden,t.detail===0)),cn.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(Hn=e.dataset.pinf,z("dt-pinf",Hn),uo(!1),Rs.focus(),Ut?Z():sn(!0))}),cn.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),uo(!1),Rs.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...cn.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!cn.hidden&&!Bs.contains(t.target)&&uo(!1)},!0);let ji=t=>{Ze=t,Fi.setAttribute("aria-pressed",String(t)),z("dt-resolved",t?"1":"0"),Ue({resolved:t}),Z(),gs(!0)},_i=t=>{bn=t,z("dt-archived",t?"1":"0"),Ue({archived:t}),Z(),gs(!0)};Fi.addEventListener("click",()=>ji(!Ze)),Fi.setAttribute("aria-pressed",String(Ze)),xe.addEventListener("click",()=>{let t=it.hidden||it.hasAttribute("data-leaving");t&&!Ut&&sn(!0),t&&$a(!1),om(t)});let en=()=>{Xa||!Ut||(Xa=requestAnimationFrame(()=>{Xa=0,Qp()}))},ed=`${Xs}, .dt-where, .dt-spot, .dt-drag-box, .dt-room, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,nd=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(ed))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(ed))},Wi=!1,sd=()=>{Wi=!1;let t=document.scrollingElement??document.documentElement,e=document.querySelector(".dt-room");if(t.scrollHeight-(e?.offsetHeight??0)<=t.clientHeight+1){e?.remove();return}let s=e??Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"});document.body.lastElementChild!==s&&document.body.append(s)},zi=0,Vi=!1,Gi=!1,od=0,rm=()=>{if(!Ut)return!1;let t=new Set([...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].map(s=>Number(s.dataset.id))),e=Yt();return j.some(s=>!t.has(s.id)&&w(s)===e&&Uo(s)&&An(s)&&!!Ce(s))},lm=()=>Ut&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=j.find(s=>s.id===Number(t.dataset.id));return!!e&&e.id!==X&&!Qe(e)}),ad=new MutationObserver(t=>{if(Ut&&!k&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),Wi=!0}t.every(nd)||((Oi<3||t.some(e=>e.type!=="attributes"))&&en(),t.some(e=>e.type!=="attributes")?Vi=!0:t.some(e=>e.attributeName==="class")&&(Gi=!0),zi||(zi=window.setTimeout(()=>{if(zi=0,Vi)ta();else if(Gi&&performance.now()-od>1e3){od=performance.now();for(let[s,o]of Ls)o.el||Ls.delete(s)}Vi=Gi=!1;let e=X!=null?j.find(s=>s.id===X):void 0;rm()||lm()||e&&ea&&Wu(e)!==ea?Z():en()},150)))}),id=new ResizeObserver(()=>en()),rd=()=>{nt.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&en()},yt=[],ld=()=>{},po=new Set,Ge={at:"",ids:[]},hs=t=>{yt=t,queueMicrotask(()=>ld());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={};for(let d of t){if(Se(d)||!An(d))continue;let p=Ct(d),u=Ee(d),b=p==="done"?"done":p==="claude"?"review":u&&la[u]||ds(d),T=s[d.route??""]??={...e(),bands:{}};T[b]++;let P=w(d);(T.bands[P]??=e())[b]++}am();let o=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},r=d=>o.map(p=>[p,p==="done"&&!Ze?0:d[p]]),l=d=>r(d).reduce((p,[,u])=>p+u,0);for(let d of document.querySelectorAll(".dt-pages a")){let p=d.querySelector(".dt-pages-n");if(!p)continue;let u=s[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let P of h){let m=u?.bands[P.id];for(let[_,Q]of r(m??e())){let Ot=p.querySelector(`[data-bp="${P.id}"][data-state="${_}"]`);Ot.hidden=!Q,Q&&(Ot.querySelector("i").textContent=String(Q),Ot.title=`${P.label}: ${Q} ${a[_]}`)}}let b=u?l(u):0;p.hidden=!b;let T=u?h.filter(P=>u.bands[P.id]&&l(u.bands[P.id])).map(P=>`${P.label} ${l(u.bands[P.id])}`).join(" \xB7 "):"";p.title=b?`${o.filter(P=>u[P]).map(P=>`${u[P]} ${a[P]}`).join(" \xB7 ")}
|
|
337
|
-
${T}`:"",d.dataset.n=String(b)}for(let d of document.querySelectorAll(".dt-folder")){let p=d.querySelectorAll(":scope > ul li[data-route] > a").length,u=[...d.querySelectorAll("a[data-n]")].reduce((T,P)=>T+Number(P.dataset.n),0),b=d.querySelector(".dt-folder-n");b.textContent=p?String(p):"",b.title=`${p} ${p===1?"page":"pages"}${u?` \xB7 ${u} open ${u===1?"thread":"threads"}`:""}`}ne()},Gn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!ba.has(Number(e.id))).map(e=>({...e,id:Number(e.id),rx:Number(e.rx)||0,ry:Number(e.ry)||0,route:typeof e.route=="string"&&/^\/(?![\/\\])/.test(e.route)?e.route:"/",replies:Array.isArray(e.replies)?e.replies.filter(s=>typeof s?.text=="string").map(s=>ya.has(`${Number(e.id)}|${s.at}`)?{...s,text:"",deleted:!0}:s):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[],...Gs(e)&&typeof e.from.by=="string"?{by:e.from.by,byName:typeof e.from.byName=="string"?e.from.byName:void 0,mirroredBy:e.by,mirroredByName:e.byName}:{}})),dm=$u(k,t=>Gt(t,2800,document.querySelector(".dt-turbo")??void 0)),Ke=document.querySelector(".dt-push"),$n=Ke.querySelector(".dt-push-menu"),xn=new Set,mo=new Set([xt]),Ea=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",Ma=()=>n.client||k?[]:yt.filter(t=>t.status!=="done"&&Xt(t.assignee)&&!Bt(t)&&De(t)==="approved"&&!hn(t)&&!Se(t)&&!po.has(t.id)),ka=()=>Ma().filter(t=>!xn.has(t.id)),dd=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?Me:""}</i>`,cd=()=>{let t=Ma(),e=[...new Set(t.map(o=>o.route??"/"))],s=ka().length;$n.innerHTML=`<div class="dt-push-head">${Fe(14)}<b>Waiting for the agent</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),r=a.filter(l=>!xn.has(l.id)).length;return`<button type="button" class="dt-push-page${mo.has(o)?" is-open":""}" data-push-route="${f(o)}"><span data-push-fold="${f(o)}">${ra}</span>${dd(r>0,r>0&&r<a.length)}<span class="dt-push-route">${f(o)}</span><em>${a.length}</em></button>`+(mo.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${dd(!xn.has(l.id))}<span><small>#${l.id}</small>${f(Jt(l.text,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>Send ${s} to the agent</button>`},ud=()=>["push","paused"].includes(Ea()),Ki=()=>Ge.ids.filter(t=>{let e=yt.find(s=>s.id===t);return!!e&&e.status!=="done"&&De(e)!=="review"&&(po.has(t)||!!hn(e)||De(e)==="approved")}),pd="",cm=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Bn=()=>{let t=Ea(),e=ka().length,s=Ki(),o=Ge.ids.length-s.length,a=s.length>0&&ud();if(s.length&&(pd=Ge.at),!s.length&&Ge.ids.length&&Ge.at&&pd===Ge.at&&!cm(Ge.at)){try{sessionStorage.setItem("nm-batch-done",Ge.at)}catch{}yt.length&&qe(`The agent finished ${Ge.ids.length} \u2014 check the fixes`,()=>xa.start(),"Check")}Ke.hidden=n.client||k||!e&&!Ke.matches(".is-sending, .is-sent");let r=Ke.querySelector(".dt-push-n");r.textContent=String(e),r.hidden=!e||Ke.classList.contains("is-sent"),Ke.querySelector(".dt-push-all").dataset.tip=a?`Push to the agent: it is on ${s.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to the agent: turbo is on \u2014 the agent takes each thread as it lands":t==="none"?`Push to the agent: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to the agent: ${e} ${e===1?"thread waits":"threads wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to the agent: nothing waits for the agent yet \u2014 mark threads for the agent, then send them here",(Ke.hidden||!Ma().length)&&($n.hidden=!0),$n.hidden||cd()},md=async t=>{if(!t.length&&ud()){Gt("Nothing waits for the agent \u2014 mark threads for the agent first");return}if(Ea()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Gt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(Ea()==="on"){Gt("Turbo is on \u2014 the agent takes each thread as it lands");return}$n.hidden=!0;let e=t.map(o=>o.id);Ke.classList.add("is-sending");let s=await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(Ke.classList.remove("is-sending"),!s?.ok){Kn("Could not send them to the agent",s),Bn();return}for(let o of e)po.add(o);Ke.classList.add("is-sent"),setTimeout(()=>{Ke.classList.remove("is-sent"),Bn()},700),Ge={at:Ge.ids.some(o=>Ki().includes(o))?Ge.at:new Date().toISOString(),ids:[...new Set([...Ki(),...e])]},Bn(),qe(`${e.length} sent to the agent \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)po.delete(o);Bn()}),nn()},La=Ke.querySelector(".dt-push-all"),hd=0,Ui=!1,gd=()=>{$n.hidden=!1,cd()};La.addEventListener("click",()=>{if(Ui){Ui=!1;return}md(ka())}),La.addEventListener("contextmenu",t=>{t.preventDefault(),$n.hidden?gd():$n.hidden=!0}),La.addEventListener("pointerdown",t=>{t.button===0&&(hd=window.setTimeout(()=>{Ui=!0,gd()},500))});for(let t of["pointerup","pointerleave","pointercancel"])La.addEventListener(t,()=>clearTimeout(hd));$n.addEventListener("click",t=>{let e=t.target,s=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),r=e.closest("[data-push]")?.dataset.push;if(r==="send"){md(ka());return}if(r==="all")xn.clear();else if(s){let l=s.dataset.pushFold;mo.has(l)?mo.delete(l):mo.add(l)}else if(o){let l=Ma().filter(p=>(p.route??"/")===o.dataset.pushRoute),d=l.some(p=>!xn.has(p.id));for(let p of l)d?xn.add(p.id):xn.delete(p.id)}else if(a){let l=Number(a.dataset.pushId);xn.has(l)?xn.delete(l):xn.add(l)}Bn()}),document.addEventListener("pointerdown",t=>{!$n.hidden&&!Ke.contains(t.target)&&($n.hidden=!0)},!0),setInterval(Bn,3e4),ld=Bn;let fd=document.querySelector(".dt-turbo");fd&&new MutationObserver(Bn).observe(fd,{attributes:!0,attributeFilter:["data-state"]}),Bn();let ho="",Yi=!1,Ps="dt-threads",bd=String([ae.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Xi="",Sa=null,um=t=>{k||t.version&&t.version===Xi||(Sa||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=Sa;Sa=null,Xi=e.version??"";let s=JSON.stringify({project:bd,body:e});s.length<2e6?ct.setItem(Ps,s):ct.removeItem(Ps)},{timeout:3e3}),Sa=t)},Ji=(t,e=!1)=>{ho=t.version??"",dm(t);let s=t.turbo;po=new Set(s?.push?.ids??[]),Ge={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=Gn(t.comments);if(e&&(Ze||bn)){let r=new Set(o.map(l=>l.id));o=[...o,...yt.filter(l=>Ct(l)==="done"&&!r.has(l.id))]}um({...t,comments:o}),hs(o);let a=o.filter(r=>r.route===xt);if(!(Ko&&(j=a,yd()))){if(JSON.stringify(a)===JSON.stringify(j)){!it.hidden&&!k&&Z();return}j=a,Z(),Ue({reload:!0})}},gs=async(t=!1)=>{let e=[t||!ho?"":`since=${ho}`,Ze||bn?"":"open=1"].filter(Boolean).join("&");try{let s=await ie(`comments${e?`?${e}`:""}`);s.status===200&&Ji(await s.json())}catch{}},go=!1,fs=async()=>{if(!document.hidden){if(Yi||cs){go=!0;return}Yi=!0,await gs(),Yi=!1,go&&(go=!1,fs())}};Bl=()=>{go&&!cs&&(go=!1,fs())};let yd=()=>{let t=Ko&&j.find(e=>e.id===Ko);return t?(Ko=0,Je()&&!An(t)&&Ns(Bt(t)?"clients":"studio"),Ut||sn(!0),ms(t.id),!0):!1},Zi=()=>{j=yt.filter(t=>t.route===xt),yd()||Z()},Qi=0,tr=null,Ta=()=>{tr&&Ut&&er(tr)},er=t=>{tr=t,!Qi&&(Qi=requestAnimationFrame(()=>{Qi=0;let e=t.target;if(!Ut||e.closest(et)){is.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(is.hidden=!1,!s)return;let o=s.getBoundingClientRect();Nu.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,zr.textContent=s.tagName.toLowerCase()+([...s.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...s.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,zr.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-16)}px`}))},vd=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),te){te=null,Z();return}if(B){Zs()&&(rn(),Z());return}if(X!==null){X=null,Z();return}sn(!1)}},wd=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],fo=!1,bo=null,bs=document.createElement("div");bs.className="dt-repin-hint",bs.hidden=!0,bs.setAttribute("role","status"),bs.textContent="Click the new spot for this thread \xB7 Esc cancels",document.body.append(bs);let $d=()=>{bo=null,bs.hidden=!0,Zt.toggle("dt-repinning",!1)},xd=t=>{bo=t,X=null,bs.hidden=!1,Zt.toggle("dt-repinning",!0),Z()};document.addEventListener("keydown",t=>{t.key==="Escape"&&bo!=null&&(t.stopImmediatePropagation(),$d())},!0);let Ed=!1,Md=t=>{fo||(t.type==="pointerdown"&&(Ed=t.pointerType==="touch"),!t.target.closest?.(et)&&t.stopPropagation())},kd=t=>{let e=t.target;Ed&&(!e.closest?.(et)||e.closest?.(".dt-pin"))&&t.preventDefault()},Ld=t=>{!fo&&t.button===0&&t.target.closest?.(":disabled")&&nr(t)},nr=t=>{if(fo)return;let e=t.target;if(e.closest(et))return;if(t.preventDefault(),t.stopPropagation(),H){H=!1;return}if(!getSelection()?.isCollapsed)return;let s=t.detail===0&&!t.clientX&&!t.clientY,o=document.activeElement;nt.hidden=!0;let a=s?o&&o!==document.body&&!o.closest(et)?o:e:document.elementFromPoint(t.clientX,t.clientY);if(nt.hidden=!1,!a)return;if(bo!=null){let u=bo;$d();let b=a.getBoundingClientRect();Tm(u,a,s?b.left+b.width/2:t.clientX,s?b.top+b.height/2:t.clientY);return}if(!Zs())return;rn();let r=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(u=>!/^(astro|svelte|css)-/.test(u)).slice(0,2);B={selector:ni(a),tag:l,classes:d,nth:si({tag:l,classes:d}).indexOf(a),rx:r.width&&!s?(t.clientX-r.left)/r.width:.5,ry:r.height&&!s?(t.clientY-r.top)/r.height:.5,label:Jt(re(a.textContent||""),60),ctx:oi(a),fp:Qo(a),spot:{x:Math.round((s?r.left+r.width/2:t.clientX)+scrollX),y:Math.round((s?r.top+r.height/2:t.clientY)+scrollY)},opener:Vu(a),category:g[0].id,...Je()&&Ve==="clients"?{shared:!0}:{}};let p=n.client||B.shared?null:so();p&&(B.assignee=p,B.stage="new",B.carried=!0),X=null,is.hidden=!0,Z()},pm=2200,mm=900*1024,hm=8*1024*1024,gm=3*1024*1024,fm=50*1024*1024,Gt=(t,e=2800,s)=>{let o=document.createElement("div");o.className="dt-toast",o.textContent=t;for(let a of document.querySelectorAll(".dt-toast:not(.dt-toast--undo)"))ss(a,()=>a.remove());if(document.body.append(o),s){let a=s.getBoundingClientRect(),r=o.offsetWidth/2;o.style.left=`${Math.min(Math.max(a.left+a.width/2,r+8),innerWidth-r-8)}px`}return setTimeout(()=>ss(o,()=>o.remove()),e),o},Sd=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),r=pa.get(o);if(pa.delete(o),!r){Gt(`${a} was not sent \u2014 attach it again`);continue}let l=Gt(`Uploading ${a}\u2026`,12e4),d=await ie("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:r.name,size:r.size})}).then(T=>T.ok?T.json():null).catch(()=>null),p=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:r}).catch(()=>null),u=p?.ok&&await tt({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!u||!u.ok){Gt(p===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let b=Gn([await u.json().catch(()=>null)])[0];b&&(j=j.map(T=>T.id===b.id?b:T),Z()),Gt(`${a} sent`)}},Td=t=>{let e=t.filter(s=>s.startsWith(ua)).map(s=>s.split("\0"));return e.length&&Gt(e.length===1?`${e[0][1]} was not sent \u2014 ${e[0][2]}`:`${e.length} files were not sent: ${e.map(([,s,o])=>`${s} (${o})`).join(", ")}`,6e3),t.filter(s=>!s.startsWith(ua))},Kn=async(t,e)=>{if(!navigator.onLine){Gt(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let s="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{s=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{s=""}(s.length>160||s.startsWith("<"))&&(s="")}Gt(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},bm=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),ym=async t=>{let e=await createImageBitmap(t),s=Math.min(1,pm/Math.max(e.width,e.height));if(s===1&&t.size<=mm)return e.close(),bm(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*s),o.height=Math.round(e.height*s),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},sr=async(t,e)=>{let s=[],o=(a,r)=>s.push(`${ua}${a}\0${r}`);for(let a of t){let r,l=Lc(a.name)||Object.keys(Ao).find(d=>Ao[d]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,$r.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>fm){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>gm&&ae.via){let p=`${Date.now()}-${pa.size}`;pa.set(p,a),s.push(`${ki}${p}\0${a.name}\0${a.size}`);continue}let d=await new Promise((p,u)=>{let b=new FileReader;b.onload=()=>p(String(b.result).split(",")[1]),b.onerror=u,b.readAsDataURL(a)}).catch(()=>"");d?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${kc(a.name)||"file"};ext=${l};base64,${d}`):o(a.name,"Could not be read");continue}try{r=await ym(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>hm){o(a.name,"Too large even after shrinking");continue}s.push(r)}if(s.length){if(!Number(e?.dataset.id)){B&&((B.images??=[]).push(...s),Z());return}Le.push(...s),Z(),yo(".dt-note-reply-input")}},Ad=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);nt.addEventListener("paste",t=>{let e=Ad(t.clipboardData?.items);e.length&&(t.preventDefault(),sr(e,t.target.closest(".dt-note")))}),nt.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),nt.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),nt.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=Ad(t.dataTransfer?.items);s.length&&sr(s,e)});let yo=t=>{let e=nt.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},Hd=()=>{yo(".dt-note-edit-input"),nt.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},or=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden";let e=Hi-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},vm=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Cd=t=>{let s=t.closest(".dt-compose").querySelector(".dt-mentions");s?.remove();let o=vm(t);if(!o)return;let a=o[1].toLowerCase(),r=X!=null?j.find(u=>u.id===X):void 0,d=(n.client||B?.shared||r&&Bt(r)?n.team??[]:ca()).filter(u=>!Tr(u.email)).filter(u=>u.email!==n.me?.email&&[u.name,u.nickname,u.email].some(b=>b?.toLowerCase().startsWith(a))).slice(0,5);if(!d.length)return;t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(u=>`<button type="button" role="option" data-act="mention" data-handle="${f(Hc(u))}">${Fn(u.avatar_url,u.name||u.email)}<span class="dt-mention-who"><b>${f(u.name||u.email)}</b>${u.name?`<span>${f(u.email)}</span>`:""}</span></button>`)].map((u,b)=>u.replace('role="option"',`role="option" aria-selected="${b===0}"`)).join("")}</div>`);let p=t.nextElementSibling;s&&(p.style.animation="none"),p.getBoundingClientRect().top<8&&p.classList.add("is-below")},wm='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="5.5" cy="5" r="1.8"/><circle cx="5.5" cy="15" r="1.8"/><circle cx="14.5" cy="15" r="1.8"/><path d="M5.5 6.8v6.4M14.5 13.2V8.5a2 2 0 0 0-2-2H9.5M11 4.8 9.3 6.5 11 8.2"/></svg>',$m='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true" class="dt-link-out"><path d="M11 4h5v5M16 4l-7 7M14 11.5V15a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3.5"/></svg>',Nd=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),..._a].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>f(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=e.length?new RegExp(`@(?:${e.join("|")})${Er}`,"giu"):null;return Mr(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${f(o.url)}" target="_blank" rel="noopener noreferrer" title="${f(o.url)}">${o.kind==="pr"?wm:wi}<span>${f(o.label)}</span>${$m}</a>`:s?f(o).replace(s,a=>{let r=Fc(a,n.team??[],n.me?.email);return`<span class="dt-at" data-kind="${r}">${r==="agent"?Fe(10):""}${a}</span>`}):f(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let s=document.createElement("div");for(let a=0;a<e.rangeCount;a++)s.append(e.getRangeAt(a).cloneContents());let o=s.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",s.textContent??""),t.preventDefault()}});let Bd=(t,e)=>{let s=t.selectionStart??t.value.length,o=t.value.slice(0,s).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(s)}`,t.selectionStart=t.selectionEnd=o+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()};document.addEventListener("pointerdown",t=>{for(let e of nt.querySelectorAll(".dt-mentions"))e.contains(t.target)||(e.closest(".dt-compose")?.querySelector("textarea")?.setAttribute("data-no-mention",""),e.remove())},!0);let xm=(t,e)=>{if(!t){B&&(B.category=e),Z();return}dn(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>tt({id:t,category:e}),"Changing the type")};lu([nt,it],f,Me),it.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&oa(Number(e.dataset.id),e.value)}),it.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),ml(Number(e.dataset.id)))},!0);let Em=t=>Bt(t)?"studio":"clients",ar=async(t,e=!1)=>{let s=j.find(r=>r.id===t);if(!s||Bt(s)&&s.client)return;let o=!Bt(s);X===t&&(X=null);let a=o&&Xt(s.assignee)?{assignee:null,stage:"new"}:{};await dn(r=>r.map(l=>l.id===t?{...l,...a.stage?{assignee:void 0,stage:"new"}:{},shared:o||void 0,client:o?l.client:void 0}:l),()=>tt(o?{id:t,shared:o,...a}:{id:t,shared:!1,client:!1}),o?"Moving it to Client":"Moving it to Team"),hs(yt),e||qe(o?"Moved to Client":"Moved to Team",()=>ar(t,!0))},Mm=async t=>{let e=j.find(d=>d.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...Bt(e)?{}:{shared:!0}};for(let d of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[d]!=null&&(o[d]=s[d]);let a=await zn(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Kn("The copy was not made",a);return}let r=Gn([await a.json().catch(()=>null)])[0];r&&(yt=[...yt,r],j=yt.filter(d=>d.route===xt)),hs(yt),Z(),nn();let l=Em(e);qe(l==="clients"?"Duplicated for the client":"Duplicated to Team",()=>{r&&(Ns(l),ms(r.id))},"Open")},km=["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"],Aa=async t=>{let e=[],s=0;for(let o of t){let a=yt.find(u=>u.id===o);if(!a||!Bt(a)||Yo(a))continue;let r=a,l={text:a.text,from:{id:a.id}};for(let u of km)r[u]!=null&&(l[u]=r[u]);let d=await zn(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(l)})).catch(()=>null);if(!d?.ok){Kn("Not mirrored",d);break}let p=Gn([await d.json().catch(()=>null)])[0];p&&(d.status===201?e.push(p):s++,yt=[...yt.filter(u=>u.id!==p.id),p])}if(j=yt.filter(o=>o.route===xt),hs(yt),Z(),nn(),!e.length){s&&Gt("Already mirrored");return}qe(`${e.length} mirrored to Team`,async()=>{let o=new Set(e.map(a=>a.id));yt=yt.filter(a=>!o.has(a.id)),j=j.filter(a=>!o.has(a.id)),hs(yt),Z();for(let a of o)await zn(ie(`comments?id=${a}`,{method:"DELETE"})).catch(()=>null);nn()})},ir=()=>{Ie=null,Xo=null,ge(Yt())},Rd=async()=>{let t=[...Ie??[]];ir(),t.length&&await Aa(t)},Lm=(t,e)=>{let s=j.find(o=>o.id===t);if(Ie??=new Set,s&&ks(s)){let o=[...it.querySelectorAll(".dt-hist-go[data-go]")].map(l=>Number(l.dataset.go)),a=o.indexOf(Xo??t),r=o.indexOf(t);if(e&&a>=0&&r>=0)for(let l of o.slice(Math.min(a,r),Math.max(a,r)+1)){let d=j.find(p=>p.id===l);d&&ks(d)&&Ie.add(l)}else Ie.has(t)?Ie.delete(t):Ie.add(t);Xo=t}ge(Yt())};document.addEventListener("keydown",t=>{t.key==="Escape"&&Ie&&(t.stopImmediatePropagation(),t.preventDefault(),ir())},!0);let Sm=t=>{let e=new URL(location.href);e.searchParams.has("notemend")||(e.search=e.search?`${e.search}¬emend`:"?notemend"),e.hash=`thread-${t}`;let s=e.href;navigator.clipboard?.writeText(s).then(()=>Gt("Link copied"),()=>Gt(s,6e3))};nt.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,p=Number(e.dataset.id)||0;e.value="",d==="dup"?Mm(p):d==="mirror"?Aa([p]):d==="move"?ar(p):d==="repin"?xd(p):d==="link"?Sm(p):d==="reopen"?tn(p,!1):d==="archive"||d==="unarchive"?us(p,d==="archive"):d==="rm"?(X=null,Bi(p)):d==="discard"&&(B=null,Z());return}let s=t.target.closest(".dt-lang-select");if(s){Ti(Number(s.dataset.id),s.dataset.at,s.value==="orig"?null:s.value);return}let o=t.target.closest(".dt-cat-select");if(o){xm(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){up(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-owner-select");if(r){Uu(Number(r.dataset.id)||0,r.value);return}let l=t.target.closest(".dt-for-select");if(l){if(ct.setItem("nm-for",l.value),n.client){B&&(B.assignee=l.value,so(l.value),Z());return}ci(Number(l.dataset.id)||0,"person")}}),nt.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&B?.suggest){B.suggest.to=e.value,rs(),or(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!s)return;s.removeAttribute("data-no-mention"),Cd(s),s.classList.contains("dt-note-input")?B&&(B.text=s.value):s.classList.contains("dt-note-edit-input")?te&&(te.text=s.value):Pe=s.value,rs(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),or(s);let o=s.closest(".dt-note");o&&o.getBoundingClientRect().bottom>va()&&(Ii([]),o.classList.contains("is-capped")&&(o.scrollTop=o.scrollHeight))}),nt.addEventListener("keydown",t=>{if(t.key==="Escape"&&nt.querySelector(".dt-emoji")){t.stopPropagation();let a=Cn?.box??Cn?.btn;ha(),a?.focus();return}let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let s=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!s()&&!e.hasAttribute("data-no-mention")&&Cd(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),Bd(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),e.setAttribute("data-no-mention",""),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let Ft=null,Ha=!1;function Is(t){return!n.client||!!n.me&&t.by===n.me.email}let Pd=t=>{let e=document.createElement("div");return e.className=`dt-drag-box ${t}`,e.hidden=!0,e.innerHTML="<span></span>",document.body.append(e),e},rr=Pd("dt-drag-box--home"),Id=Pd("dt-drag-box--to"),Od=()=>{let t=document.body.currentCSSZoom??1;for(let e of document.querySelectorAll(".dt-notes-overlay, .dt-notes-hi, .dt-spot, .dt-pad-overlay, .dt-drag-box"))e.style.zoom=t===1?"":String(1/t)};Od(),addEventListener("resize",Od);let Tm=async(t,e,s,o)=>{let a=j.find(u=>u.id===t);if(!a)return;let r={...lr(e,s,o),fp:Qo(e),spot:{x:Math.round(s+scrollX),y:Math.round(o+scrollY)}},l={selector:a.selector,tag:a.tag,classes:a.classes,nth:a.nth,label:a.label,ctx:a.ctx,rx:a.rx,ry:a.ry,fp:a.fp,spot:a.spot},d=`${ga(a.tag,a.classes,a.selector)}${re(a.label)?` \xAB${Jt(re(a.label),24)}\xBB`:""}`,p=(u,b,T)=>dn(P=>P.map(m=>m.id===t?{...m,...u,anchor:null,...b?{repinnedAt:new Date().toISOString(),repinnedBy:n.me?.email??"you",repinnedFrom:d}:{repinnedAt:null,repinnedBy:null,repinnedFrom:null}}:m),()=>tt({id:t,move:u,anchor:null,repin:b?d:!1}),T);ls.delete(t),await p(r,!0,"Re-pinning"),qe(`Pinned to ${vo(e)}`,()=>{ls.delete(t),p(l,!1,"Putting the pin back")})},Am=()=>{let t=ii;ii=null;let e=t!=null?j.find(d=>d.id===t):null,s=e&&Qe(e);if(!e||!s||(X===e.id&&ms(e.id),e.spot||!Is(e)))return;let o=s.getBoundingClientRect(),a=o.left+o.width*e.rx,r=o.top+o.height*e.ry,l={...lr(s,a,r),fp:Qo(s),spot:{x:Math.round(a+scrollX),y:Math.round(r+scrollY)}};ls.delete(e.id),tt({id:e.id,move:l,anchor:null}).then(d=>{d.ok&&Object.assign(e,l,{anchor:null})}).catch(()=>{})},Hm=t=>{let e=j.find(r=>r.id===t),s=e&&Ce(e)?.opener;if(!e||!s)return;fo=!0;let o=s.getBoundingClientRect(),a={bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2,button:0,view:window};try{for(let r of["pointerdown","mousedown","pointerup","mouseup","click"])s.dispatchEvent(new(r.startsWith("pointer")?PointerEvent:MouseEvent)(r,a))}finally{fo=!1}X=null,setTimeout(()=>{ta(),X=t,Z()},180)},vo=t=>{let e=Jt(re(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},qd=(t,e,s="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,t.querySelector("span").textContent=s,t.hidden=!1},Cm=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(et)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,Nm=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},lr=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),r=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ni(t),tag:a,classes:r,nth:si({tag:a,classes:r}).indexOf(t),label:Us(t.textContent||"",60),ctx:oi(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(s-o.top)/o.height)):.5}},dr=()=>{Ft&&(Ft.on&&Oo(Ft.pin,"land"),Ft.pin.classList.remove("is-dragging"),Zt.toggle("dt-dragging",!1),rr.hidden=Id.hidden=!0,Ft=null,en())};nt.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=j.find(o=>o.id===Number(e.dataset.id));!s||!Is(s)||(Ft={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:Qe(s),to:null},e.setPointerCapture(t.pointerId))}),nt.addEventListener("pointermove",t=>{if(!Ft||!Ft.on&&Math.hypot(t.clientX-Ft.x0,t.clientY-Ft.y0)<4)return;Ft.on=!0,Ft.pin.classList.add("is-dragging"),Zt.toggle("dt-dragging",!0),Ft.pin.style.left=`${t.clientX}px`,Ft.pin.style.top=`${t.clientY}px`,Ft.to=Ft.home&&Nm(Ft.home,t.clientX,t.clientY)?Ft.home:Cm(t.clientX,t.clientY);let e=Ft.to&&Ft.to!==Ft.home;qd(rr,Ft.home,e?"":Ft.home?vo(Ft.home):""),rr.classList.toggle("is-left",!!e),qd(Id,e?Ft.to:null,e?`Move to ${vo(Ft.to)}`:"")}),nt.addEventListener("pointerup",async t=>{if(!Ft)return;let e=Ft;if(!e.on||!e.to){dr();return}Ha=!0,setTimeout(()=>{Ha=!1},0);let s=j.find(d=>d.id===e.id),o=lr(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(dr(),!s)return;let r={selector:s.selector,tag:s.tag,classes:s.classes,nth:s.nth,label:s.label,ctx:s.ctx,rx:s.rx,ry:s.ry},l=(d,p)=>dn(u=>u.map(b=>b.id===e.id?{...b,...d}:b),()=>tt({id:e.id,move:d}),p);await l(o,"Moving the pin"),a&&qe(`Moved to ${vo(e.to)}`,()=>l(r,"Putting the pin back"))}),nt.addEventListener("click",t=>{Ha&&(t.stopImmediatePropagation(),t.preventDefault(),Ha=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&Ft?.on&&(t.stopImmediatePropagation(),dr())},!0),nt.addEventListener("click",async t=>{let e=t.target.closest("button"),s=Cn?.btn;if(e?.closest(".dt-emoji")||ha(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="open-orig"){Ns("clients"),ms(a);return}if(o==="react"){Tl(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&Sl(e,!1,o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&Cn){let r=Cn;Sl(r.btn,!0,r);return}if(o==="emoji"&&Cn){let r=Cn;ha(),r.box?Dp(r.box,e.dataset.emoji):r.id&&Tl(r.id,r.at||null,e.dataset.emoji);return}if(o==="prio"){let r=e.dataset.v||null;a?dn(l=>l.map(d=>d.id===a?{...d,priority:r??void 0}:d),()=>tt({id:a,priority:r}),"Setting the priority"):B&&(B.priority=r??void 0,rs(),Z());return}if(o==="mention"){let r=e.closest(".dt-compose")?.querySelector("textarea");r&&Bd(r,e.dataset.handle);return}if(!o){if(B&&!Zs())return;X=X===a?null:a,rn(),Z(),ps&&wa();return}if(o==="speak"){Hp(e.closest(".dt-note"),e);return}if(o==="voice-write"){Np(e);return}if(o==="voice"||o==="voice-seek"){bp(e,o==="voice-seek"?t:null);return}if(o==="attach"||o==="attach-file"){let r=Object.assign(document.createElement("input"),{type:"file",accept:o==="attach"?"image/*":"",multiple:!0}),l=e.closest(".dt-note");r.addEventListener("change",()=>{r.files?.length&&sr([...r.files],l)}),r.click();return}if(o==="unshot"){a?te&&te.drop.push(e.dataset.img):(e.closest("[data-draft]")?B?.images??[]:Le).splice(Number(e.dataset.i),1),Z(),te&&Hd();return}if(o==="edit"){let r=j.find(p=>p.id===a),l=e.dataset.at||null,d=l?r?.replies?.find(p=>p.at===l)?.text:r?.text;if(d===void 0)return;te={id:a,at:l,text:d,drop:[]},Z(),Hd();return}if(o==="edit-cancel"){te=null,Z();return}if(o==="tr-orig"){Ti(a,e.dataset.at,null);return}if(o==="tr-retry"){Ti(a,e.dataset.at,e.dataset.to);return}if(o==="unsay"){let r=e.dataset.at;Up(a,r);return}if(o==="edit-save"){let r=te;if(!r)return;let l=r.text.trim();if(!l){nt.querySelector(".dt-note-edit-input")?.focus();return}te=null;let d=p=>r.drop.includes(p.split("/").pop());await dn(p=>p.map(u=>u.id!==r.id?u:{...u,...r.at==null?{text:l}:{replies:(u.replies??[]).map(b=>b.at===r.at?{...b,text:l}:b)},images:(u.images??[]).filter(b=>!d(b))}),()=>tt({id:r.id,edit:{at:r.at,text:l},...r.drop.length?{removeImage:r.drop}:{}}).then(p=>(p.ok||(te=r),p),p=>{throw te=r,p}),"Saving the edit");return}if(o==="cancel"){Zs()&&(rn(),Z());return}if(o==="twin"){if(!Zs())return;rn(),X=Number(e.dataset.id),Z();return}if(o==="discard"){B=null,Z();return}if(o==="draft-open"){Di(Number(e.dataset.i));return}if(o==="close"){X=null,Z();return}if(o==="go-spot"){let r=j.find(l=>l.id===Number(e.dataset.id));r&&tl(r);return}if(o==="show-el"){let r=j.find(l=>l.id===Number(e.dataset.id));r&&Qe(r)?.scrollIntoView({block:"center",inline:"center",behavior:ns()?"smooth":"auto"});return}if(o==="where"){let r=j.find(P=>P.id===Number(e.dataset.id)),l=r&&Ce(r),d=l?.hidden;if(!d)return;let p=P=>{let m=P.getBoundingClientRect();return(m.width||m.height)&&P.checkVisibility?.()!==!1?m:null},u=l.shut instanceof HTMLElement?l.shut:null,b=u&&p(u);if(u&&!b){let P=u.getAttribute("style");u.setAttribute("style",`${P??""};display:block!important`),b=p(u),P==null?u.removeAttribute("style"):u.setAttribute("style",P)}b??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let T=document.createElement("div");T.className="dt-where",T.style.cssText=`left:${b.left}px;top:${b.top}px;width:${b.width}px;height:${b.height}px`,document.body.append(T),On(T).then(()=>T.remove());return}if(o==="unsuggest"&&B){B.suggest=null,Z();return}if(o==="uncarry"&&B){B.assignee="",B.carried=!1,so(""),rs(),Z();return}if(o==="save"){if(!B)return;B.images&&(B.images=Td(B.images));let r=(B.images??[]).filter(_=>!Ts(_)),l=B.suggest&&B.suggest.to.trim()!==B.suggest.from?{from:B.suggest.from,to:B.suggest.to.trim()}:null,d=nt.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(B.images?.some($i)?kl:B.images?.some(_=>Ts(_)&&!Ho(_))?"See the attached image":B.images?.length?"See the attached file":"");if(!d){nt.querySelector(".dt-note-input")?.focus();return}let p=B,u=n.client||p.shared===!0?null:Sr(d,no()),b={...p,images:p.images?.filter(Ts),route:xt,text:d,suggest:l,assignee:n.client?wl(p.assignee)||void 0:u??(p.assignee||void 0),shared:n.client?!0:p.shared===!0,stage:n.client?"new":u?"approved":p.stage??(Xt(p.assignee)?"approved":"new"),breakpoint:ei(),browser:Du(),device:k?Dd:"",viewport:{w:innerWidth,h:innerHeight},logs:nu(),host:location.host},T={...p,id:-Date.now(),text:d,route:xt,status:"open",note:"",doneBy:null,breakpoint:b.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:n.me?.email,byName:n.me?.name};j=[...j,T],B=null,Z();let P=await zn(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b)})).catch(()=>null);if(!P?.ok){j=j.filter(_=>_!==T),rn(),B=p,Z(),Kn("Thread was not saved",P);return}let m=Gn([await P.json().catch(()=>null)])[0];j=j.map(_=>_===T&&m?m:_),Z(),m&&r.length&&Sd(m.id,r),nn();return}if(o==="reply"){let r=nt.querySelector(".dt-note-reply-input");Le=Td(Le);let l=r.value.trim()||(Le.some($i)?kl:Le.some(Q=>Ts(Q)&&!Ho(Q))?"See the attached image":Le.length?"See the attached file":"");if(!l){r.focus();return}let d=Le;Pe=l,fn=a,Qs(),Pe="",Le=[],r.value="";let p=j,u=j.find(Q=>Q.id===a),b=n.client||Bt(u)?null:Sr(l,no()),T=b&&u&&(b!==u.assignee||De(u)!=="approved"||u.status==="done")?{assignee:b,stage:"approved",...u.status==="done"?{status:"open",doneBy:null}:{}}:{};j=j.map(Q=>Q.id===a?{...Q,...T,replies:[...Q.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:n.me?.email}]}:Q),Wo=a,Z();let P=await zn(tt({id:a,reply:l,images:d.filter(Ts),...T})).catch(()=>null);if(!P?.ok){j=p,Pe=l,Le=d,Z();let Q=nt.querySelector(".dt-note-reply-input");Q&&!Q.value&&(Q.value=l);let Ot=()=>nt.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?qe(`Reply was not sent${P?` (${P.status})`:""} \u2014 it is back in the box`,Ot,"Retry"):Kn("Reply was not sent",P);return}Qs();let m=Gn([await P.json().catch(()=>null)])[0];m&&(j=j.map(Q=>Q.id===m.id?m:Q),Z()),nn();let _=d.filter(Q=>!Ts(Q));_.length&&Sd(a,_);return}if(o==="unfold"){Ss.set(a,1/0),Z();let r=nt.querySelector(`.dt-note[data-id="${a}"] .dt-note-thread`);if(r){for(let l of r.querySelectorAll(".dt-msg--new"))l.classList.remove("dt-msg--new");r.scrollTop=r.scrollHeight,Vo(r)}delete We[a],r?.parentElement?.querySelector(".dt-new-below")?.remove();return}if(o==="newbelow"){let r=e.closest(".dt-note")?.querySelector(".dt-note-thread");r?.scrollTo({top:r.scrollHeight,behavior:ns()?"smooth":"auto"}),delete We[a],e.remove();return}if(o==="hand"){ci(a,e.dataset.v);return}if(o==="repin"){xd(a);return}if(o==="open-it"){Hm(a);return}if(o==="lost-resolve"){X=null,await tn(a,!0);return}if(o==="claude"){ml(a);return}if(o==="sendback"){await tn(a,!1),yo(".dt-note-reply-input");return}if(o==="accept"){await tn(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(X=null),await us(a,o==="archive");return}e.classList.contains("dt-step-act")||(X=null),o==="rm"?await Bi(a):await tn(a,o==="done")});let Dd="",Ue=t=>{Sn.hidden||Ys.contentWindow?.postMessage({dt:!0,...t},location.origin)},Bm=()=>({notes:Ut,grid:!St.hidden,inspect:gt,resolved:Ze,archived:bn,...Fd.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(k&&e.projectGrid!==void 0){qt=e.projectGrid,St.hidden||we();return}if(!k&&t.source===Ys.contentWindow){if(e.key){pc(e.key[0],e.key[1])?.run();return}if(e.closeMenus){D();return}if(e.route){$();return}if(e.drafts){Ci=e.drafts,ge(Yt());return}}if(k&&typeof e.openDraft=="number"){Di(e.openDraft);return}if(k&&typeof e.dropDraft=="number"){Xl(e.dropDraft);return}if(k&&typeof e.device=="string"&&(Dd=e.device),k&&e.scrollbar&&Zt.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Ys.contentWindow){Ue(Bm());return}typeof e.notes=="boolean"&&e.notes!==Ut&&sn(e.notes,!1),typeof e.open=="number"&&ms(e.open),typeof e.grid=="boolean"&&e.grid===St.hidden&&ft(e.grid),typeof e.inspect=="string"&&e.inspect!==gt&&Y(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Ze&&ji(e.resolved),typeof e.archived=="boolean"&&e.archived!==bn&&_i(e.archived),e.reload&&gs()});let nn=async()=>{await gs(),Ue({reload:!0}),k&&parent.postMessage({dt:!0,reload:!0},location.origin)},sn=(t,e=!0)=>{if(Ut=t,Nt.setAttribute("aria-pressed",String(t)),t?!k&&it.hidden&&ct.getItem("dt-history")==="1"&&(Zl(),xe.setAttribute("aria-pressed","true")):(Jl(()=>{Ut||it.replaceChildren()}),xe.setAttribute("aria-pressed","false")),z(Vr,t?"1":"0"),Ue({notes:t}),k&&e&&parent.postMessage({dt:!0,notes:t},location.origin),nt.hidden=!t||!Sn.hidden,Zt.toggle("dt-noting",t),t&&!k?sd():document.querySelector(".dt-room")?.remove(),t){Y(""),document.addEventListener("click",nr,!0),document.addEventListener("pointerup",Ld,!0);for(let s of wd)document.addEventListener(s,Md,!0);document.addEventListener("contextmenu",kd,!0),document.addEventListener("keydown",vd),document.addEventListener("mousemove",er),addEventListener("scroll",en,!0),addEventListener("scroll",Ta,!0),addEventListener("scroll",wa,!0),addEventListener("resize",en),addEventListener("resize",Ta),addEventListener("pointerover",rd,!0),ta(),ad.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),id.observe(document.body),Zi()}else{rn(),X=null,document.removeEventListener("click",nr,!0),document.removeEventListener("pointerup",Ld,!0);for(let s of wd)document.removeEventListener(s,Md,!0);document.removeEventListener("contextmenu",kd,!0),document.removeEventListener("keydown",vd),document.removeEventListener("mousemove",er),is.hidden=!0,removeEventListener("scroll",en,!0),removeEventListener("scroll",Ta,!0),removeEventListener("scroll",wa,!0),removeEventListener("resize",en),removeEventListener("resize",Ta),removeEventListener("pointerover",rd,!0),ad.disconnect(),id.disconnect(),nt.innerHTML=""}},{pickBp:cr,...Fd}=fu({cfg:n,inFrame:k,persist:z,frame:Sn,frameEl:Ys,devicesMenu:as,bpBtns:Kt,notesOverlay:nt,WIDE:y,bpOf:S,currentBp:ei,deviceById:A,notesOn:()=>Ut,filter:()=>Za,filterTo:t=>{Za=t},dropFrameDrafts:()=>{Ci=[]},putAway:()=>{X=null,rn()},tellFrame:Ue,syncBpButtons:Xr,render:()=>Z(),reread:()=>{Ut?Zi():Z()}}),jd="dt-studio",_d=t=>{os.setAttribute("aria-pressed",String(t)),Zt.toggle("dt-no-studio",!t),z(jd,t?"1":"0")};os.addEventListener("click",()=>_d(os.getAttribute("aria-pressed")!=="true")),_d(ct.getItem(jd)!=="0"),Nt.addEventListener("click",()=>sn(!Ut));let ve=document.querySelector(".devtools"),Os=document.querySelector(".dt-tab"),Wd=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-ve.getBoundingClientRect().top)+12}px`);new ResizeObserver(Wd).observe(ve),addEventListener("resize",Wd);let Rm=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),zd=()=>{ve.removeAttribute("data-tight");let t=ve.getBoundingClientRect().right,e=Rm(),s=!1;for(let o of ve.children){let a=o.getBoundingClientRect();t=Math.max(t,a.right),e?.width&&e.left<a.right+8&&e.right>a.left-8&&e.top<a.bottom&&e.bottom>a.top&&(s=!0)}ve.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||s)},Vd=0,ur=()=>{cancelAnimationFrame(Vd),Vd=requestAnimationFrame(zd)},Pm=new ResizeObserver(ur);for(let t of ve.children)Pm.observe(t);addEventListener("resize",ur),zd();for(let t of[1500,4e3])setTimeout(ur,t);for(let t of x)t.addEventListener("toggle",()=>{let e=t.querySelector(":scope > :not(summary)");if(!e||(e.style.translate="",!t.open||it.hidden||t.matches(".dt-keys")))return;let s=e.getBoundingClientRect(),o=it.getBoundingClientRect();o.width&&s.right>o.left-8&&s.bottom>o.top&&s.top<o.bottom&&(e.style.translate=`${Math.round(o.left-8-s.right)}px 0`)});let Gd=t=>{ve.toggleAttribute("data-collapsed",t),Os.toggleAttribute("data-collapsed",t),Os.setAttribute("aria-expanded",String(!t)),Os.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),ve.inert=t,t&&D(),t&&Fs&&Na(""),t&&Ut&&!B&&X==null&&sn(!1),z("dt-collapsed",t?"1":"0")};Os.addEventListener("click",()=>Gd(!ve.hasAttribute("data-collapsed")));let un=document.querySelector(".dt-keys"),Kd=un.querySelector(".dt-set-keys"),Im=un.querySelector(".dt-set-main"),wo=un.querySelector(".dt-set-grid"),Ud=un.querySelector('[data-set="grid"] .dt-set-hint'),$o=t=>{if(Im.hidden=t!=="main",Kd.hidden=t!=="keys",wo.hidden=t!=="grid",t==="grid"&&Fm(),Ud){let e=pe();Ud.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},pr=t=>$o(t?"keys":"main"),mr={desktop:{cols:12,gutter:24,margin:24,max:1200},tablet:{cols:8,gutter:16,margin:24,max:null},landscape:{cols:4,gutter:16,margin:16,max:null},portrait:{cols:4,gutter:16,margin:16,max:null}},xo={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},Om=["cols","gutter","margin","max"],Ca=(t,e)=>Math.min(xo[t][1],Math.max(xo[t][0],Math.round(e))),qm=()=>({...mr,...qt?.widths}),hr=()=>!!n.project&&!!n.gridAdmin,Yd=()=>!St.hidden&&!pe()&&zt?zt:me(),Dm=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},Fm=()=>{let t=hr(),e=qm(),s=Lt(),o=pe(),a=h.find(p=>p.id===s),r=(p,u)=>`<div class="dt-grid-row"><span>${p}</span><b>${u}</b></div>`,l=(ae.cabinet||n.cabinet)&&n.project?` <a href="${f(`${ae.cabinet||n.cabinet}/p/${n.project}?tab=settings`)}" target="_blank" rel="noopener">Also in the cabinet \u203A</a>`:"",d;if(o)d=`<p class="dt-grid-band">${f(a.label.toUpperCase())} \xB7 ${a.ideal} \u2014 this width</p>
|
|
338
|
-
<div class="dt-grid-fields">${
|
|
339
|
-
<input type="number" inputmode="numeric" step="1" min="${
|
|
340
|
-
${h.filter(p=>p.id!==s&&e[p.id]).map(p=>
|
|
341
|
-
<p class="dt-grid-foot">${t?"Saved for the project \u2014 everyone sees it.":"Set by the project\u2019s admins."}${l}</p>`;else{let p=Yd();d=r(p.from==="guess"?"Guessed":"Read from the page",`${p.cols} \xD7 ${p.w}`)+r("Gap",String(p.gap))+r("Margin",String(p.x))}wo.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${za}<span>Grid</span></button><hr>`+(n.project?`<div class="dt-grid-from"><span>Columns from</span><div class="dt-seg" role="radiogroup" aria-label="Columns from">${["auto","custom"].map(p=>`<button type="button" role="radio" data-grid-mode="${p}" aria-checked="${p==="custom"==!!o}"${t?"":" disabled"}>${p==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},Xd=async(t,e)=>{let s=qt,o=p=>{p&&!wo.hidden&&$o("grid"),St.hidden||we(),Ue({projectGrid:qt})};qt=t(qt),o(e);let a=await ie("config").then(p=>p.ok?p.json():null).catch(()=>null),r=t(a?a.projectGrid??null:s),l=await ie("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:r})}).catch(()=>null);if(l?.ok){qt=(await l.json()).grid??null;return}let d=l?await l.text():"";Gt(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),qt=s,o(!0)};if(wo.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!hr()||e==="custom"==!!pe())return;let s=Lt(),o=e==="custom"?Yd():null,a=document.documentElement.clientWidth,r=o&&{cols:Ca("cols",o.cols),gutter:Ca("gutter",o.gap),margin:Ca("margin",o.x),max:Math.abs(a-2*o.x-o.w)<=2?null:Ca("max",o.w)};Xd(l=>({mode:e,widths:{...mr,...l?.widths,...r?{[s]:r}:{}}}),!0)}),wo.addEventListener("change",t=>{let e=t.target,s=e.dataset.gridK,o=pe();if(!s||!o||!hr())return;let a=e.value.trim()===""?null:Number(e.value),[r,l]=xo[s];if(a===null?s!=="max":!Number.isInteger(a)||a<r||a>l){Gt(`${s==="cols"?"Cols":s[0].toUpperCase()+s.slice(1)} is ${r}\u2013${l}${s==="max"?" or empty":""}.`),e.value=String(o[s]??"");return}if(a===o[s])return;let d=Lt();Xd(p=>({mode:"custom",widths:{...mr,...p?.widths,[d]:{...p?.widths?.[d]??o,[s]:a}}}),!1)}),vt.querySelector("button").addEventListener("click",()=>{D(),un.open=!0,$o("grid")}),$o("main"),ae.signOut)for(let t of document.querySelectorAll('.dt-me [data-set="out"], .dt-me [data-set-out]'))t.hidden=!1;let gr=()=>{},Jd=()=>!1;jm();function jm(){let t=document.querySelector(".dt-strip"),e=document.querySelector(".dt-strip-grip"),s=document.documentElement;if(k){t.hidden=e.hidden=!0;return}let o=t.querySelector(".dt-strip-pin"),a=ct.getItem("dt-strip-pin")==="1",r=!1,l=!1,d=0,p=0,u=()=>l||!!t.querySelector("details[open]")||t.matches(":hover")||!!t.querySelector(":focus-visible"),b=v=>{r=v||a,r||(l=!1),t.classList.toggle("is-out",r),t.inert=!r,Zt.toggle("dt-strip-out",r)},T=()=>{clearTimeout(p),p=window.setTimeout(()=>{r&&!a&&!u()&&b(!1)},350)};gr=v=>{l=v&&!a,b(v)},Jd=()=>r,document.addEventListener("mousemove",v=>{a||(v.clientY<=3?r||(d||=window.setTimeout(()=>{d=0,b(!0)},140)):(clearTimeout(d),d=0,r&&v.clientY>40&&T()))}),s.addEventListener("mouseleave",()=>{clearTimeout(d),d=0,r&&T()}),t.addEventListener("toggle",()=>{r&&T()},!0),t.addEventListener("focusout",()=>{r&&T()}),e.addEventListener("click",()=>b(!0)),document.addEventListener("pointerdown",v=>{r&&!a&&!t.contains(v.target)&&v.target!==e&&(l=!1,D(),b(!1))});let P=v=>{if(a=v,ct.setItem("dt-strip-pin",v?"1":"0"),o.setAttribute("aria-pressed",String(v)),o.dataset.tip=v?"Let it hide \u2014 the site moves back":"Keep it out \u2014 moves the site",Zt.toggle("dt-strip-on",v),v)Q();else{for(let[I,K]of m)I.style.top=K;m.clear()}b(!0)};o.addEventListener("click",()=>P(!a)),document.addEventListener("keydown",v=>{v.key==="Escape"&&r&&!a&&!t.querySelector("details[open]")&&b(!1)});let m=new Map,_=v=>{let I=getComputedStyle(v);if(I.position!=="fixed"&&I.position!=="sticky")return null;let K=v.computedStyleMap?.().get("top")?.toString();if(K?K==="auto":I.top==="auto"||parseFloat(I.top)>parseFloat(I.bottom))return null;if(I.position==="sticky"){for(let W=v.parentElement;W&&W!==document.body;W=W.parentElement)if(getComputedStyle(W).overflowY!=="visible")return null}return`calc(${I.top} + 40px)`},Q=v=>{if(!a)return;for(let W of v??[])W.style.top=m.get(W)??"",m.delete(W);let K=(v??[...document.body.children].filter(W=>!/(^|\s)(dt-|devtools)/.test(String(W.className))).flatMap(W=>[W,...W.querySelectorAll("*")])).filter(W=>W.isConnected&&W.style&&!m.has(W)).map(W=>[W,_(W)]).filter(W=>W[1]);for(let[W,ot]of K)m.set(W,W.style.top),W.style.setProperty("top",ot,"important"),Ot.observe(W,{attributes:!0,attributeFilter:["class"]})},Ot=new MutationObserver(v=>Q([...new Set(v.map(I=>I.target))].filter(I=>m.has(I)))),Pt=0,le=()=>{Pt||=window.setTimeout(()=>{Pt=0,Q()},500)};new MutationObserver(v=>{v.every(nd)||le()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),addEventListener("resize",()=>{Q([...m.keys()]),le()}),P(a),b(a);let mt=t.querySelector(".dt-me");if(n.me){mt.querySelector(".dt-me-face").innerHTML=Fn(n.me.avatar_url,n.me.name||n.me.email).replace(/^<(img|b) /,`<$1 style="--hue:${Oe(n.me.email.toLowerCase())}" `);let v=ae.cabinet||n.cabinet;if(v){let I=mt.querySelector(".dt-me-cab"),K=mt.querySelector(".dt-me-acc");I.href=n.project?`${v}/p/${n.project}`:v,I.hidden=!1,K.href=`${v}/settings?tab=account`,K.hidden=!1}}mt.addEventListener("click",v=>{let I=v.target.closest("[data-set], a");I&&(mt.open=!1,I.dataset.set==="out"&&confirm("Sign out of Notemend on this site?")&&(ct.removeItem(Ps),ae.signOut?.()))});let Tt=t.querySelector(".dt-pages"),bt=Tt.querySelector(".dt-pages-find input"),kt=Tt.querySelector(".dt-pages-hits"),Ht=Tt.querySelector(".dt-pages-foot");Tt.addEventListener("toggle",()=>{if(Tt.open){bt.value="",Te(),requestAnimationFrame(()=>bt.focus());let v=Tt.querySelector(".dt-pages-copy");v&&(delete v.dataset.copied,v.dataset.tip="Copy link")}});let Te=()=>{let v=bt.value.trim().toLowerCase();if(G.hidden=!!v,kt.hidden=!v,Ht.classList.toggle("is-off",!!v),!v)return;let I=n.pages.filter(K=>K.label.toLowerCase().includes(v)||K.route.toLowerCase().includes(v)).slice(0,12);kt.innerHTML=I.length?`<ul>${I.map(K=>`<li><a href="${f(K.route)}"${K.route===xt?' aria-current="page"':""}><span class="dt-menu-label">${f(K.label)}</span><em class="dt-pages-route">${f(K.route)}</em></a></li>`).join("")}</ul>`:`<p class="dt-pages-none">No page matches \u201C${f(bt.value.trim())}\u201D</p>`};bt.addEventListener("input",Te),bt.addEventListener("keydown",v=>{v.key==="Enter"&&(v.preventDefault(),kt.querySelector("a")?.click()),v.key==="Escape"&&bt.value&&(v.preventDefault(),v.stopPropagation(),bt.value="",Te())});let de=Tt.querySelector(".dt-pages-copy"),ce=v=>{v.preventDefault(),v.stopPropagation(),v instanceof MouseEvent&&v.detail>0&&de.blur(),navigator.clipboard?.writeText(location.href.replace(/#.*$/,"")).catch(()=>null),de.dataset.copied="",de.dataset.tip="Link copied",clearTimeout(Number(de.dataset.t)),de.dataset.t=String(window.setTimeout(()=>{delete de.dataset.copied,de.dataset.tip="Copy link"},1600))};de.addEventListener("click",ce),de.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&ce(v)}),_t=()=>{$(),hs(yt),M&&En()};let Rn=()=>{z("dt-folders-open",JSON.stringify([...V])),z("dt-folders-closed",JSON.stringify([...U]))};if(G.addEventListener("click",v=>{let I=v.target,K=I.closest(".dt-folder-more");if(K)return v.preventDefault(),qa(K);let W=I.closest(".dt-folder-row");if(!W||W.querySelector("input"))return;let ot=W.parentElement,Mt=ot.dataset.folder,lt=!ot.hasAttribute("data-open");lt?(V.add(Mt),U.delete(Mt)):(V.delete(Mt),U.add(Mt)),Rn(),ot.toggleAttribute("data-open",lt),W.setAttribute("aria-expanded",String(lt)),W.children[1].outerHTML=se(lt),Ga(ot.querySelector(":scope > ul"),lt)}),G.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&v.target.matches(".dt-folder-row")&&(v.preventDefault(),v.target.click())}),!M)return;let ue=new Set,Ne="",Oa=v=>{let I=v.closest("li[data-route]");if(I)return`p:${I.dataset.route}`;let K=v.closest(".dt-folder:not(.dt-folder--site)");return K&&v.closest(".dt-folder-row")?`f:${K.dataset.folder}`:""},ko=()=>[...G.querySelectorAll("li[data-route], .dt-folder:not(.dt-folder--site)")].filter(v=>v.matches(".dt-folder")||v.offsetParent).map(v=>v.dataset.route?`p:${v.dataset.route}`:`f:${v.dataset.folder}`),js=Ht.querySelector(".dt-sel-hint");function En(){for(let I of G.querySelectorAll(".is-picked"))I.classList.remove("is-picked");for(let I of ue)(I.startsWith("p:")?G.querySelector(`li[data-route="${CSS.escape(I.slice(2))}"] > a`):G.querySelector(`[data-folder="${CSS.escape(I.slice(2))}"] > .dt-folder-row`))?.classList.add("is-picked");let v=ue.size;js.hidden=!v,js.innerHTML=v?`<b>${v} selected</b><button type="button" data-sel="group"><kbd>\u2318G</kbd> Group</button><button type="button" data-sel="ungroup"><kbd>\u2318\u21E7G</kbd> Ungroup</button>`:""}let _s=()=>{ue.size&&(ue.clear(),Ne="",En())};G.addEventListener("click",v=>{let I=v,K=I.metaKey||I.ctrlKey,W=I.shiftKey,ot=Oa(v.target);if(!ot||!K&&!W){v.target.closest(".dt-folder-more")||_s();return}if(v.preventDefault(),v.stopImmediatePropagation(),W&&Ne){let Mt=ko(),lt=Mt.indexOf(Ne),pt=Mt.indexOf(ot);if(lt>=0&&pt>=0)for(let Be of Mt.slice(Math.min(lt,pt),Math.max(lt,pt)+1))ue.add(Be)}else ue.has(ot)?ue.delete(ot):ue.add(ot);Ne=ot,En()},!0),Tt.addEventListener("toggle",()=>{Tt.open||_s()});let Ws=()=>{let v=ko().filter(lt=>ue.has(lt)&<.startsWith("p:")).map(lt=>lt.slice(2)),I=[...ue].filter(lt=>lt.startsWith("f:")).map(lt=>lt.slice(2)).filter(lt=>!L.some(pt=>ue.has(`f:${pt.id}`)&&pn(lt,pt.id)));if(!v.length&&!I.length)return;let K=new Set([...v.map(lt=>L.find(pt=>pt.pages.includes(lt))?.id??""),...I.map(lt=>L.find(pt=>pt.id===lt)?.parent??"")]),W=K.size===1&&[...K][0]||null,ot=Math.random().toString(36).slice(2,10),Mt=[{id:ot,name:"Untitled folder",pages:v,...W?{parent:W}:{}},...L.map(lt=>({...lt,pages:lt.pages.filter(pt=>!v.includes(pt)),...I.includes(lt.id)?{parent:ot}:{}}))];W&&(V.add(W),U.delete(W)),ue.clear(),Ne="",V.add(ot),U.delete(ot),Rn(),Ae(Mt),Xn(ot,!1)};js.addEventListener("click",v=>{let I=v.target.closest("[data-sel]")?.dataset.sel;I==="group"&&Ws(),I==="ungroup"&&wt()});let wt=()=>{let v=new Set([...ue].filter(W=>W.startsWith("f:")).map(W=>W.slice(2)));for(let W of ue)if(W.startsWith("p:")){let ot=L.find(Mt=>Mt.pages.includes(W.slice(2)));ot&&v.add(ot.id)}if(!v.size)return;let I=L,K=L.filter(W=>v.has(W.id));ue.clear(),Ne="",Ae(vs(L,v)),qe(K.length===1?`Ungrouped \u201C${K[0].name}\u201D`:`Ungrouped ${K.length} folders`,()=>Ae(I))};document.addEventListener("keydown",v=>{if(!(!Tt.open||v.target?.closest?.("input:not(.dt-pages-find input), textarea"))){if(v.key==="Escape"&&ue.size){v.preventDefault(),v.stopImmediatePropagation(),_s();return}(v.metaKey||v.ctrlKey)&&v.code==="KeyG"&&ue.size&&(v.preventDefault(),v.stopImmediatePropagation(),v.shiftKey?wt():Ws())}},!0),G.addEventListener("dblclick",v=>{let I=v.target.closest(".dt-folder:not(.dt-folder--site)");!I||v.target.closest(".dt-folder-more, input")||!v.target.closest(".dt-folder-row")||(v.preventDefault(),Xn(I.dataset.folder,!1))});let Ae=async v=>{let I=L;L=v,Dt();let K=await ie("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({folders:v})}).catch(()=>null);if(K?.ok){let ot=(await K.json()).folders??[];JSON.stringify(ot)!==JSON.stringify(L)&&(L=ot,Dt());return}let W=K?await K.text():"";Gt(K?(()=>{try{return JSON.parse(W).error}catch{return W}})()||"The folders were not saved.":"The folders were not saved \u2014 no connection."),L=I,Dt()},vs=(v,I)=>{let K=v.map(W=>({...W,pages:[...W.pages]}));for(let W of I){let ot=K.find(pt=>pt.id===W);if(!ot)continue;let Mt=ot.parent&&K.some(pt=>pt.id===ot.parent&&pt.id!==W)?ot.parent:null;K=K.filter(pt=>pt.id!==W).map(pt=>pt.parent===W?{...pt,parent:Mt}:pt);let lt=Mt?K.find(pt=>pt.id===Mt):null;if(lt)for(let pt of ot.pages)lt.pages.includes(pt)||lt.pages.push(pt)}return K.map(({parent:W,...ot})=>W?{...ot,parent:W}:ot)},pn=(v,I)=>{let K=L.find(W=>W.id===v);return!!K?.parent&&(K.parent===I||pn(K.parent,I))},Xn=(v,I)=>{let K=G.querySelector(`[data-folder="${CSS.escape(v)}"] .dt-folder-row .dt-menu-label`);if(!K)return;let W=L.find(pt=>pt.id===v),ot=document.createElement("input");ot.className="dt-folder-name",ot.value=W.name,ot.maxLength=60,ot.setAttribute("aria-label","Folder name"),K.replaceWith(ot),ot.focus(),ot.select();let Mt=!1,lt=pt=>{if(Mt)return;Mt=!0;let Be=ot.value.trim();if(pt&&Be)return void Ae(L.map(Mn=>Mn.id===v?{...Mn,name:Be}:Mn));I&&(L=L.filter(Mn=>Mn.id!==v)),Dt()};ot.addEventListener("keydown",pt=>{pt.key==="Enter"&&(pt.preventDefault(),lt(!0)),pt.key==="Escape"&&(pt.preventDefault(),pt.stopPropagation(),lt(!1)),pt.stopPropagation()}),ot.addEventListener("blur",()=>lt(!0)),ot.addEventListener("click",pt=>pt.stopPropagation())};Ht.querySelector(".dt-folder-new").addEventListener("click",()=>{let v=Math.random().toString(36).slice(2,10);L=[{id:v,name:"Untitled folder",pages:[]},...L],V.add(v),Rn(),Dt(),Xn(v,!0)});let ee=null,mn=()=>{ee?.remove(),ee=null};Tt.addEventListener("toggle",()=>{Tt.open||mn()});function qa(v){mn();let I=v.closest(".dt-folder").dataset.folder,K=L.find(Mt=>Mt.id===I);ee=document.createElement("div"),ee.className="dt-folder-menu",ee.setAttribute("role","menu"),ee.innerHTML=`<button type="button" role="menuitem" data-do="rename">${es}<span>Rename</span></button><button type="button" role="menuitem" data-do="add">${$t('<path d="M10 4.5v11M4.5 10h11" />',13)}<span>Add pages\u2026</span></button><button type="button" role="menuitem" data-do="sub">${se(!1)}<span>New folder inside</span></button>`+(K.pages.length||L.some(Mt=>Mt.parent===K.id)?`<button type="button" role="menuitem" data-do="ungroup">${$t('<rect x="3" y="3" width="6" height="6" rx="1.5" /><rect x="11" y="11" width="6" height="6" rx="1.5" /><path d="M11 5.5h3.5V9M9 14.5H5.5V11" />',13)}<span>Ungroup</span></button>`:"")+`<button type="button" role="menuitem" data-do="delete" class="is-danger">${ts}<span>Delete folder</span></button>`,Tt.append(ee);let W=v.getBoundingClientRect(),ot=Tt.getBoundingClientRect();ee.style.left=`${W.right-ot.left+6}px`,ee.style.top=`${W.top-ot.top-4}px`,ee.addEventListener("click",Mt=>{let lt=Mt.target.closest("[data-do]")?.dataset.do;if(!lt)return;if(mn(),lt==="rename")return Xn(I,!1);if(lt==="add")return Lo(I,v);if(lt==="sub"){let Be=Math.random().toString(36).slice(2,10);return L=[{id:Be,name:"Untitled folder",pages:[],parent:I},...L],V.add(I),V.add(Be),U.delete(I),Rn(),Dt(),Xn(Be,!0)}let pt=L;Ae(vs(L,new Set([I]))),qe(lt==="delete"?`Deleted \u201C${K.name}\u201D`:`Ungrouped \u201C${K.name}\u201D`,()=>Ae(pt))})}function Lo(v,I){mn();let K=L.find(lt=>lt.id===v),W=n.pages.filter(lt=>!K.pages.includes(lt.route));ee=document.createElement("div"),ee.className="dt-folder-menu dt-folder-add",ee.setAttribute("role","menu"),ee.innerHTML=`<p class="dt-pages-group">Add to ${f(K.name)}</p>`+(W.length?W.map(lt=>`<button type="button" role="menuitem" data-route="${f(lt.route)}"><span>${f(lt.label)}</span><em class="dt-pages-route">${f(lt.route)}</em></button>`).join(""):'<p class="dt-pages-none">Every page is in it</p>'),Tt.append(ee);let ot=I.getBoundingClientRect(),Mt=Tt.getBoundingClientRect();ee.style.left=`${ot.right-Mt.left+6}px`,ee.style.top=`${ot.top-Mt.top-4}px`,ee.addEventListener("click",lt=>{let pt=lt.target.closest("[data-route]");if(!pt)return;let Be=pt.dataset.route;pt.remove(),V.add(v),U.delete(v),Rn(),Ae(L.map(Mn=>({...Mn,pages:Mn.id===v?[...Mn.pages.filter(vr=>vr!==Be),Be]:Mn.pages.filter(vr=>vr!==Be)})))})}let Jn="";G.addEventListener("dragstart",v=>{let I=v.target.closest("li[data-route], li.dt-folder");I&&(v.stopPropagation(),Jn=I.dataset.route??`f:${I.dataset.folder}`,I.classList.add("is-dragging"),v.dataTransfer?.setData("text/plain",Jn),v.dataTransfer&&(v.dataTransfer.effectAllowed="move"))});let zs=v=>v?.closest?.(".dt-folder:not(.dt-folder--site)")??null;G.addEventListener("dragover",v=>{if(!Jn)return;v.preventDefault();let I=zs(v.target);for(let K of G.querySelectorAll(".is-drop"))K!==I&&K.classList.remove("is-drop");I?.classList.add("is-drop"),G.classList.toggle("is-drop-out",!I)}),G.addEventListener("dragend",()=>{Jn="",G.classList.remove("is-drop-out");for(let v of G.querySelectorAll(".is-drop, .is-dragging"))v.classList.remove("is-drop","is-dragging")});let So=v=>requestAnimationFrame(()=>{let I=G.querySelector(v);I&&(Oo(I,"glow"),I.scrollIntoView({block:"nearest",behavior:ns()?"smooth":"auto"}))});G.addEventListener("drop",v=>{v.preventDefault();let I=Jn,K=zs(v.target)?.dataset.folder;if(!I)return;if(I.startsWith("f:")){let Mt=I.slice(2);if(K===Mt||K&&pn(K,Mt))return;let lt=L.map(pt=>pt.id===Mt?{...pt,parent:K??null}:pt).map(({parent:pt,...Be})=>pt?{...Be,parent:pt}:Be);K&&(V.add(K),U.delete(K),Rn()),JSON.stringify(lt)!==JSON.stringify(L)&&(Ae(lt),So(`[data-folder="${CSS.escape(Mt)}"] > .dt-folder-row`));return}let W=L.map(Mt=>({...Mt,pages:Mt.pages.filter(lt=>lt!==I)})),ot=K?W.find(Mt=>Mt.id===K):null;ot&&(ot.pages.push(I),V.add(ot.id),Rn()),JSON.stringify(W)!==JSON.stringify(L)&&(Ae(W),So(`li[data-route="${CSS.escape(I)}"] > a`))})}un.querySelector("summary").addEventListener("click",()=>pr(!1));let Un=ve.querySelector(".dt-vision"),qs=Un.querySelector(".dt-vision-sheet"),Eo=[{id:"",name:"Normal",hint:"",css:"none"},{id:"grey",name:"Greyscale",hint:"only light and dark",css:"grayscale(1)"},{id:"low",name:"Low vision",hint:"slightly blurred",css:"blur(2.5px)"},{id:"deut",name:"Deuteranopia",hint:"red\u2013green, most common",css:"url(#dt-deut)",m:"0.367322 0.860646 -0.227968 0 0 0.280085 0.672501 0.047413 0 0 -0.011820 0.042940 0.968881 0 0 0 0 0 1 0"},{id:"prot",name:"Protanopia",hint:"red\u2013green",css:"url(#dt-prot)",m:"0.152286 1.052583 -0.204868 0 0 0.114503 0.786281 0.099216 0 0 -0.003882 -0.048116 1.051998 0 0 0 0 0 1 0"},{id:"trit",name:"Tritanopia",hint:"blue\u2013yellow",css:"url(#dt-trit)",m:"1.255528 -0.076749 -0.178779 0 0 -0.078411 0.930809 0.147602 0 0 0.004733 0.691367 0.303900 0 0 0 0 0 1 0"}];document.body.insertAdjacentHTML("beforeend",`<svg class="dt-vision-defs" width="0" height="0" aria-hidden="true">${Eo.filter(t=>t.m).map(t=>`<filter id="dt-${t.id}" color-interpolation-filters="linearRGB"><feColorMatrix type="matrix" values="${t.m}"/></filter>`).join("")}</svg>`);let Zd=document.createElement("style");document.head.append(Zd);let Ds=document.createElement("div");Ds.className="dt-seeing",Ds.hidden=!0,ve.append(Ds);let Fs="",Na=t=>{Fs=t;let e=Eo.find(s=>s.id===t)??Eo[0];Zd.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",Un.toggleAttribute("data-on",!!t),Ds.hidden=!t,Ds.innerHTML=t?`${$t('<path d="M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z" /><circle cx="10" cy="10" r="2.5" />',13)}<span>Seeing as ${e.name}</span><kbd>Esc</kbd><button type="button" aria-label="See the page as it is">${$t('<path d="M5 5l10 10M15 5 5 15" />',12)}</button>`:""};Ds.addEventListener("click",t=>{t.target.closest("button")&&Na("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!Fs||t.defaultPrevented||mc(t.target)||(Na(""),t.preventDefault())});let Ba=null,fr=0,br=0,Qd=()=>{let t=Math.round((Date.now()-fr)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},tc=t=>{if(t==="none"){qs.className="dt-sheet dt-vision-sheet dt-vision-list",qs.innerHTML='<p class="dt-vision-title">See the page as</p>'+Eo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Fs}"><span>${s.name}</span>${s.id===Fs?$t('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${s.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;qs.className="dt-sheet dt-vision-sheet",qs.innerHTML=`<div class="dt-vision-head"><b>This view, six ways</b><span class="dt-vision-ago">${t==="taking"?"taking a snapshot\u2026":`snapshot \xB7 ${Qd()}`}</span><span class="dt-vision-grow"></span><span>Click one to see the page that way</span><button type="button" class="dt-icon dt-vision-again" data-tip="Take a new snapshot" aria-label="Take a new snapshot">${$t('<path d="M3.5 10a6.5 6.5 0 1 0 2-4.7M3.5 3.5v3.6h3.6" />')}</button></div><div class="dt-vision-grid">${Eo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Fs}"><span class="dt-vision-thumb">${Ba&&t==="ready"?`<img src="${Ba}" alt="" style="filter:${s.id==="low"?`blur(${(2.5*e*2).toFixed(2)}px)`:s.css}">`:""}</span><span>${s.name}</span></button>`).join("")}</div>`},yr=async()=>{let t=++br;tc("taking");let e=[document.body,document.documentElement].map(o=>getComputedStyle(o).backgroundColor).find(o=>o&&o!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(o))??"#fff",s=null;try{let{domToWebp:o}=await import("modern-screenshot");s=await Promise.race([o(document.body,{width:innerWidth,height:innerHeight,scale:460/innerWidth,quality:.75,timeout:4e3,backgroundColor:e,style:{transform:`translate(${-scrollX}px, ${-scrollY}px)`},filter:a=>!(a instanceof Element&&a.closest(`${Xs}, .dt-pad-overlay, .dt-grid-overlay, .dt-vision-defs, .dt-toast`))}),new Promise(a=>setTimeout(()=>a(null),4e3))])}catch{s=null}t!==br||!Un.open||(Ba=s,fr=Date.now(),tc(s?"ready":"none"))},ec=0,nc=0,sc=()=>{clearTimeout(nc),nc=window.setTimeout(yr,400)};Un.addEventListener("toggle",()=>{if(clearInterval(ec),removeEventListener("scroll",sc,!0),!Un.open){br++;return}yr(),addEventListener("scroll",sc,!0),ec=window.setInterval(()=>{let t=qs.querySelector(".dt-vision-ago");t&&Ba&&fr&&(t.textContent=`snapshot \xB7 ${Qd()}`)},1e3)}),qs.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void yr();let s=e.closest("[data-vision]");s&&(Na(s.dataset.vision??""),Un.open=!1)});let Mo=ve.querySelector(".dt-custom"),Ra=Mo.querySelector(".dt-custom-sheet"),oc="dt-hidden-tools",ac="dt-new-seen",ic=["contrast","vision"],rc=()=>{let t=(o,a,r)=>{let l=ve.querySelector(a);return l?{id:o,el:l,name:r}:null},e=[t("grid",".dt-grid-btn","Grid"),t("pads",".dt-pad-btn","Spacing"),t("sizes",".dt-size-btn","Size"),t("type",".dt-type-btn","Typography"),t("color",".dt-color-btn","Color"),t("border",".dt-border-btn","Border"),t("contrast",".dt-contrast-btn","Contrast"),t("vision",".dt-vision","Vision")],s=[...Kt.map(o=>({id:`bp:${o.dataset.bp}`,el:o,name:(o.getAttribute("aria-label")??o.dataset.bp??"").replace(/^mobile\s+(\w)/i,(a,r)=>r.toUpperCase())})),{id:"devices",el:as,name:"Device menu"}];return[...n.client?[]:[{group:"Inspect",tools:e.filter(o=>!!o)}],{group:"Devices",tools:s}]},lc=t=>(ct.getItem(t)??"").split(",").filter(Boolean),Yn=new Set(lc(oc)),dc=()=>{for(let{tools:e}of rc())for(let s of e)s.el.toggleAttribute("data-off",Yn.has(s.id));Object.entries(rt).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&Y("")},_m=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",cc=()=>{let t=lc(ac);Ra.innerHTML=rc().map(({group:e,tools:s})=>{let o=s.filter(a=>!Yn.has(a.id)).length;return`<p class="dt-custom-label"><b>${e}</b><span>${o} of ${s.length}</span></p><div class="dt-custom-well">${s.map(a=>`<button type="button" class="dt-custom-tile" data-tool="${f(a.id)}" aria-pressed="${!Yn.has(a.id)}">${_m(a.el)}<span>${f(a.name)}</span>${ic.includes(a.id)&&!t.includes(a.id)?'<i class="dt-custom-new">New</i>':""}</button>`).join("")}</div>`}).join("")+`<div class="dt-custom-foot"><button type="button" class="dt-custom-all"${Yn.size?"":" disabled"}>Show all</button><span></span><button type="button" class="dt-custom-done">Done</button></div>`};Ra.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){Mo.open=!1;return}e.closest(".dt-custom-all")&&Yn.clear();let s=e.closest("[data-tool]");if(s){let o=s.dataset.tool;Yn.delete(o)||Yn.add(o)}!s&&!e.closest(".dt-custom-all")||(z(oc,[...Yn].join(",")),dc(),cc(),Ra.querySelector(s?`[data-tool="${s.dataset.tool}"]`:".dt-custom-done")?.focus())}),Mo.addEventListener("toggle",()=>{Mo.open?(cc(),Ra.querySelector(".dt-custom-tile")?.focus()):z(ac,ic.join(","))}),dc(),un.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return pr(s==="keys");if(s==="grid")return $o("grid");un.open=!1,s==="custom"&&(Mo.open=!0),s==="hide"&&Os.click()});let on=t=>()=>ve.querySelector(t)?.click(),uc=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},Pa=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:on(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:on(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:on(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>_i(!bn)},{group:"Threads",code:"Slash",hint:"/",label:"Search pages",run:()=>{let t=document.querySelector(".dt-strip"),e=t?.querySelector(".dt-pages");if(t&&!t.hidden&&e){D(),gr(!0),e.open=!0;return}document.querySelector(".dt-history")?.hasAttribute("hidden")&&on(".dt-history-btn")(),it.hasAttribute("data-collapsed")&&$a(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Team / client",run:()=>Ie?void Rd():Ns(Ve==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Bs.hidden||uo(cn.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:on(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:on(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:on(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:on(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:on(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:on(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{Un.open=!Un.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:on(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:on(".dt-studio-btn")}]:[],...Kt.slice(0,9).map((t,e)=>({group:"Breakpoints",code:`Digit${e+1}`,hint:String(e+1),label:t.dataset.tip??t.title,el:`.dt-bp[data-bp="${t.dataset.bp}"]`,run:()=>t.click()})),{group:"View",code:"KeyD",hint:"D",label:"Devices",run:()=>{as.open=!as.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:uc(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:uc(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>Os.click()},{group:"View",code:"Backslash",shift:!0,hint:"\u21E7\\",label:"Top strip",run:()=>gr(!Jd())},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=un.open&&!Kd.hidden;un.open=!t,pr(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),pc=(t,e)=>Pa.find(s=>s.code===t&&!s.shift==!e&&!(s.el&&ve.querySelector(s.el)?.closest("[data-off]"))&&!(s.code==="KeyD"&&as.hasAttribute("data-off"))),mc=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||!!t.closest('[role="menu"], [role="listbox"], [role="dialog"][aria-modal="true"], [role="combobox"]'));if(n.shortcuts){for(let o of Pa){let a=o.el&&ve.querySelector(o.el);a&&(a.dataset.tip=`${a.dataset.tip??o.label} \xB7 ${o.hint}`,a.setAttribute("aria-keyshortcuts",o.hint.startsWith("\u21E7")?`Shift+${o.hint.slice(1)}`:o.hint))}let t=(o,a)=>`<div class="dt-key-row"><span>${f(o)}</span><kbd>${f(a)}</kbd></div>`,e=(o,a)=>`<div class="dt-keys-col"><p class="dt-keys-group">${o}</p>${a}</div>`,s=[...new Set(Pa.map(o=>o.group))].map(o=>e(o,Pa.filter(a=>a.group===o).map(a=>t(a.label,a.hint)).join("")));if(s.push(e("In a comment",t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"))),un.querySelector(".dt-keys-list").innerHTML=`<div class="dt-keys-half">${s.slice(0,2).join("")}</div><div class="dt-keys-half">${s.slice(2).join("")}</div>`,document.addEventListener("keydown",o=>{if(o.repeat||o.isComposing||o.metaKey||o.ctrlKey||o.altKey||o.defaultPrevented||mc(o.composedPath()[0]??o.target))return;let a=pc(o.code,o.shiftKey);a&&setTimeout(()=>{o.defaultPrevented||(k?parent.postMessage({dt:!0,key:[o.code,o.shiftKey]},location.origin):a.run())})}),k){let o=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",o,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&o()})}}if(!k){Gd(ct.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>ve.setAttribute("data-ready",""))),Fd.restore(),ft(ct.getItem(It)==="1");let t=ct.getItem(Et);t&&t in rt&&Y(t),sn(ct.getItem(Vr)==="1"&&xt!=="/connect")}let hc=()=>{try{let t=JSON.parse(ct.getItem(Tn)||"null");ze=(t?.parked??[]).filter(s=>Js(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};if(t?.draft&&e(t.draft.selector)?(B=t.draft,!Ut&&!k&&sn(!0)):Js(t?.draft)&&ze.push(t.draft),t?.reply?.text&&(Pe=t.reply.text,fn=X=t.reply.for??null),X==null)try{X=Number(sessionStorage.getItem(`nm-open:${Tn}`))||null,sessionStorage.removeItem(`nm-open:${Tn}`)}catch{}(B||ze.length||Pe)&&Z()}catch{ct.removeItem(Tn)}};hc();let gc=()=>setTimeout(()=>{let t=F(location.pathname);t!==xt&&(clearTimeout(Go),Qs(),xt=t,k&&parent.postMessage({dt:!0,route:t},location.origin),Tn=Ur(),B=null,ze=[],Pe="",fn=null,X=null,te=null,j=[],Ut&&!k&&sn(!1),$(),hc(),Zi(),gs())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),gc()}}addEventListener("popstate",gc);try{let t=JSON.parse(ct.getItem(Ps)||"null");t?.project===bd&&t.body?(Xi=t.body.version??"",Ji(t.body),ho=""):t&&ct.removeItem(Ps)}catch{ct.removeItem(Ps)}i.then(async t=>{t.status===200&&Ji(await t.json(),!c)},()=>{}).then(()=>!c&&(Ze||bn)?gs(!0):void 0).then(xa.resume),document.addEventListener("visibilitychange",()=>{document.hidden||fs()}),addEventListener("focus",fs),addEventListener("notemend:changed",()=>{k||fs()});let Ia=!1,ys=null,fc=()=>{if(!(k||ae.via||!("EventSource"in window))){if(document.hidden){ys?.close(),ys=null,Ia=!1;return}ys||(ys=new EventSource("/__devbar/events"),ys.onopen=()=>{Ia=!0},ys.onerror=()=>{Ia=!1},ys.onmessage=t=>{t.data!==ho&&fs()})}};fc(),document.addEventListener("visibilitychange",fc);let bc=0,Wm=()=>{k||ae.via||document.hidden||Date.now()-bc<1e4||(bc=Date.now(),fetch("/__devbar/active",{method:"POST",keepalive:!0}).catch(()=>{}))};for(let t of["pointerdown","pointermove","keydown","wheel"])addEventListener(t,Wm,{passive:!0,capture:!0});let zm=0;k||setInterval(()=>{(!(ae.live||Ia)||++zm%6===0)&&fs()},2e4),setInterval(()=>{!document.hidden&&j.some(t=>hn(t))&&Z()},3e4),k&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Lu(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,c=i.showModal,h=null,g=null,y=()=>{if(h){g?.disconnect(),g=null;for(let w of n)document.body.append(w);try{h.hidePopover()}catch{}h.remove(),h=null}},S=()=>{y();let w=document.querySelector("dialog:modal");w&&C(w)},C=w=>{y(),h=document.createElement("div"),h.className="dt-host",h.setAttribute("popover","manual"),h.append(...n),w.append(h);try{h.showPopover()}catch{}w.addEventListener("close",S,{once:!0}),g=new MutationObserver(()=>{w.isConnected||S()}),g.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){c.call(this),this.isConnected&&C(this)}}function jr(n,i,c,h=""){let g=document.createElement("div");g.className="nm-ask",g.setAttribute("style",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px","padding:6px 6px 6px 12px","background:#0e0d0c","color:#f2efec","border:1px solid rgba(255,255,255,.09)","border-radius:999px","box-shadow:0 10px 34px rgba(0,0,0,.5)","font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif"].join(";"));let y=document.createElement(n?"a":"span");y instanceof HTMLAnchorElement&&n&&(y.href=n,y.target=c,h&&(y.rel=h)),y.className="nm-ask-go",y.textContent=i;let S=document.createElement("style");return S.textContent=`.nm-ask{transition:border-color 120ms cubic-bezier(.22,1,.36,1)}
|
|
332
|
+
<div class="dt-note-meta dt-note-type">${fi(Us(B.category).id,void 0,!1)}</div>
|
|
333
|
+
${Cl("dt-note-input",B.suggest?"Why (optional)":"Comment",B.text??"",'data-act="save"',Ll(B.images))}
|
|
334
|
+
${B.carried&&B.assignee?`<p class="dt-carried">${Ju}<span>For ${f(ln(B.assignee)?.name||B.assignee.split("@")[0])} \xB7 from your last comment</span><button type="button" data-act="uncarry" aria-label="Don\u2019t carry it over" data-tip="Back to Anyone \u2014 and the next ones too">${Pn}</button></p>`:""}
|
|
335
|
+
${yl(B.priority,B.category,void 0,B.assignee??"",!1,!!B.shared,!0)}
|
|
336
|
+
</div>`}let d=new Map([...nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(m=>[m.closest(".dt-note").dataset.id,{top:m.scrollTop,end:m.scrollTop+m.clientHeight>=m.scrollHeight-4}])),p=new Set([...nt.querySelectorAll("[data-msg]")].map(m=>m.dataset.msg)),u=nt.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Zp(e,Sn.hidden?o.some(m=>!!a.get(m.id)):o.length>0),Fr(nt,s),u&&!nt.contains(document.activeElement)&&vo(".dt-note-reply-input");let b=[],S=[];for(let m of nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let _=m.closest(".dt-note").dataset.id,Q=d.get(_);if(!Q){b.push(m),delete We[_],m.parentElement.querySelector(".dt-new-below")?.remove();continue}let Ot=[...m.querySelectorAll("[data-msg]")].filter(mt=>!p.has(mt.dataset.msg));for(let mt of Ot)mt.classList.add("dt-msg--new");let Pt=Q.end||String(zo)===_;Pt&&S.push(m),m.scrollTop=Pt?m.scrollHeight:Q.top;let le=Ot.filter(mt=>!mt.classList.contains("dt-msg--mine")).length;if(le&&!Q.end&&String(zo)!==_){We[_]=(We[_]??0)+le;let mt=We[_],Tt=m.parentElement.querySelector(".dt-new-below")??m.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Tt.dataset,{act:"newbelow",id:_}),Tt.textContent=`${mt} new ${mt===1?"reply":"replies"} \u2193`}}for(let m of nt.querySelectorAll(".dt-new-below")){let _=m.closest(".dt-note")?.querySelector(".dt-note-thread");(!_||_.scrollTop+_.clientHeight>=_.scrollHeight-4)&&(delete We[m.dataset.id],m.remove())}zo=null,Ii([...b,...S]),requestAnimationFrame(()=>nt.querySelectorAll(".dt-note-thread").forEach(Go)),X==null?Wo=null:X!==Wo&&nt.querySelector(`.dt-note[data-id="${X}"]`)&&(Wo=X,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&vo(`.dt-note[data-id="${X}"] .dt-note-reply-input`)),ge(e),li(di()),en();for(let m of nt.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))or(m);let P=nt.querySelector(".dt-note-input");P&&document.activeElement!==P&&(P.focus(),P.setSelectionRange(P.value.length,P.value.length))},Oi=0,em=()=>{Wi&&Ut&&!k&&ad();let t=!1,e=document.getAnimations().some(u=>u.playState==="running"),s=[],o=!1,a=new Map(j.map(u=>[u.id,u])),i=400,l=(u,b)=>b>-i&&b<innerHeight+i&&u>-i&&u<innerWidth+i;for(let u of nt.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(u.classList.contains("dt-note--orphan")||u.classList.contains("is-dragging"))continue;if(u.classList.contains("dt-pin--ghost")){let P=a.get(Number(u.dataset.id))?.spot;s.push([u,P?{x:P.x-scrollX,y:P.y-scrollY,el:document.body}:null]);continue}let b=a.get(Number(u.dataset.id)),S=b&&Ce(b);s.push([u,S&&u.matches(".dt-pin")&&l(S.x,S.y)&&Iu(S.el,S.x,S.y)?null:S]),S&&e&&sl(S.el)&&(t=!0)}for(let u of nt.querySelectorAll("[data-draft], [data-parked]")){if(u.classList.contains("dt-note--orphan"))continue;let b=u.dataset.parked?ze[Number(u.dataset.parked)]:B;s.push([u,b?Ce(b):null])}let d=(u,b,S)=>{Math.abs(parseFloat(u.style.left)-b)<.05||(u.style.left=`${b}px`,o=!0),Math.abs(parseFloat(u.style.top)-S)<.05||(u.style.top=`${S}px`,o=!0)};for(let[u,b]of s){if(b&&u.style.left&&!l(b.x,b.y)&&!l(parseFloat(u.style.left),parseFloat(u.style.top))&&u.matches(".dt-pin"))continue;let S=u.nextElementSibling;if(!b){u.style.visibility!=="hidden"&&(u.style.visibility="hidden"),S?.matches(".dt-pin-eye")&&!S.hidden&&(S.hidden=!0);continue}if(u.style.visibility&&(u.style.visibility=""),d(u,b.x,b.y),u.matches(".dt-pin[data-id]")){let P=!!(b.hidden||b.opener);if(u.classList.contains("dt-pin--hidden")!==P){u.classList.toggle("dt-pin--hidden",P);for(let m of["title","aria-label"]){let _=(u.getAttribute(m)??"").replace(Vo,"");u.setAttribute(m,P?_.replace(/( \u2014 drag to move)?$/,`${Vo}$1`):_)}}S?.matches(".dt-pin-eye")&&(S.hidden===P&&(S.hidden=!P),P&&d(S,b.x,b.y))}u.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!b.hidden)}if(!oa.length&&(B||X!=null)){let u=di();u&&e&&sl(u)&&li(u)}let p=nt.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(p.length){let u=wa();for(let b of p)b.style.visibility!=="hidden"&&Vl(b,u)}Pu(B||X!=null?di():null),Oi=o?0:Oi+1,t&&en(),clearTimeout(Kl),Kl=window.setTimeout(nm,150)},qi=new Map,Kl=0,nm=()=>{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 p=getComputedStyle(l);if(p.backgroundImage!=="none"){i="var(--dt-bg)";break}let u=p.backgroundColor.match(/[\d.]+/g);if(u&&(u[3]===void 0?1:+u[3])>=.9){i=p.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=>!In(l));i&&s.push([o,e(i)])}for(let[o,a]of s)qi.set(Number(o.dataset.id),a),o.style.setProperty("--dt-page",a)},Ul=t=>`dt-gfold:${n.project||location.host}:${t}`,ge=t=>{if(it.hidden){it.replaceChildren();return}if(it.toggleAttribute("data-picking",!!Ie),Fr(it,$u({bp:t,notes:j.filter(An),breakpoints:h,bandOfNote:w,orphan:e=>!Ce(e),statusTools:e=>Rl(e,!1),tick:sp,replied:op,rowMenu:ap,menuFor:Dn,showResolved:Qe,showArchived:bn,archived:Se,drafts:Sn.hidden?Nl():Ci,checks:k?0:Ea.toCheck().length,clients:Ze()&&Ve==="clients",marker:om,assign:np,mirror:e=>Ze()?Jo(e)?"here":Bt(e)&&Xo(e)?"there":"":"",picking:Ie,pickable:ks,mirrorAll:Qo()?j.filter(e=>An(e)&&w(e)===t&&ks(e)).map(e=>e.id):[],draftFace:n.me?`<span class="dt-hist-face" style="--hue:${Oe(n.me.email)}">${ui({by:n.me.email,byName:n.me.name})}</span>`:"",draftName:n.me?.name||"You",find:oe,forMe:sm,forAgent:e=>!!Ee(e)&&Ct(e)!=="done",unread:dl,archives:!n.client,deletable:e=>!Hs(e),folded:it.hasAttribute("data-collapsed"),shut:e=>ct.getItem(Ul(e))==="1",cap:Yl,keep:X})),Ns){let e=it.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Ns.at,Ns.at),Ns=null}},Ns=null,Yl=150,sm=t=>{if(Ct(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||Ct(t)==="claude"||De(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return an(t).some(s=>s.text.toLowerCase().includes("@"+e))},om=t=>{let e=Ee(t),s=ra[e??""],o=Ct(t)==="done"?Se(t)?`<i class="dt-hist-badge is-archived">${kn}</i>`:`<i class="dt-hist-badge is-done">${Me}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${Fe(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${_n.find(i=>i[0]===ds(t))[2]}"></i>`,a=ui(t)||Fn(void 0,t.byName||(t.by==="you"||!t.by?"You":t.by)).replace(/>([^<])[^<]*<\/b>$/,">$1</b>");return`<span class="dt-hist-face" style="--hue:${Oe(t.by||t.byName||"you")}">${a}</span>`},xa=t=>{Pi=!1;let e=it.hasAttribute("data-collapsed");if(t===e||it.hidden){it.toggleAttribute("data-collapsed",t),Z();return}let s=it.querySelector(".dt-hist-head")?.offsetHeight??44;if(t){it.setAttribute("data-folding",""),Or(it,it.offsetHeight,s,!1,()=>{it.removeAttribute("data-folding"),it.setAttribute("data-collapsed",""),Z()});return}it.removeAttribute("data-folding"),it.removeAttribute("data-collapsed"),Z(),Or(it,s,it.offsetHeight,!0,()=>{})},Xl=t=>{let e=[];for(let s=t.nextElementSibling;s&&s.classList.contains("dt-hist-row");s=s.nextElementSibling)e.push(s);return e},Jl=t=>{let e=document.createElement("div");return e.className="dt-hist-rows",t[0].before(e),e.append(...t),e},am=t=>{let e=Ul(t),s=ct.getItem(e)==="1",o=it.querySelector(".dt-hist-list"),a=o?.clientHeight??600,i=()=>it.querySelector(`[data-gfold="${CSS.escape(t)}"]`)?.closest(".dt-hist-group");if(!s){let u=i(),b=u?Xl(u):[],S=()=>{z(e,"1"),ge(Yt())};if(!b.length||!ns())return S();let P=Jl(b);Ka(P,!1,a),On(P).then(S);return}z(e,""),ge(Yt());let l=i(),d=l?Xl(l):[];if(!d.length||!ns())return;let p=Jl(d);p.hidden=!0,Ka(p,!0,a),On(p).then(()=>{p.isConnected&&(p.before(...p.children),p.remove())})};it.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(oe.q=e.value,Ns={at:e.selectionStart??e.value.length},ge(Yt()))}),it.addEventListener("click",async t=>{let e=t.target;if(e.closest("[data-hist-more]")){oe.more=!oe.more,Dn=null,oe.menu=!1,ge(Yt());return}let s=e.closest("[data-row-more]");if(s){let kt=Number(s.dataset.rowMore);Dn=Dn===kt?null:kt,oe.more=!1,ge(Yt());return}if((oe.more||Dn!=null)&&!e.closest(".dt-hist-menu")&&(oe.more=!1,Dn=null,ge(Yt()),!e.closest("[data-go]"))||e.closest(".dt-hist-assign"))return;let o=()=>{oe.more=!1,Dn=null};if(e.closest("[data-hist-rows]")){Yl+=300,ge(Yt());return}if(e.closest("[data-read-all]")){for(let kt of j)cl(kt);o(),ge(Yt());return}let a=e.closest("[data-resolve-all]");if(a){let kt=a.dataset.resolveAll.split(",").map(Number);o(),await Il(kt,Ht=>Ge(Ht,!0)),qe(`Resolved ${kt.length}`,()=>Il(kt,Ht=>Ge(Ht,!1)));return}let i=e.closest("[data-row-unread]");if(i){let kt=Number(i.dataset.rowUnread);jn[kt]=Math.max(0,an(j.find(Ht=>Ht.id===kt)).length-1),hi(),o(),ge(Yt());return}let l=e.closest("[data-row-link]");if(l){o(),ge(Yt()),await navigator.clipboard?.writeText(`${location.origin}${location.pathname}#thread-${l.dataset.rowLink}`).catch(()=>null),zt("Link copied");return}let d=e.closest("[data-row-select]");if(d){o();let kt=Number(d.dataset.rowSelect),Ht=j.find(Te=>Te.id===kt);Ie=new Set(Ht&&ks(Ht)?[kt]:[]),Zo=kt,ge(Yt());return}let p=e.closest("[data-row-mirror]");if(p){o(),ge(Yt()),await Ha([Number(p.dataset.rowMirror)]);return}let u=e.closest("[data-mirror-all]");if(u){o(),ge(Yt()),await Ha(u.dataset.mirrorAll.split(",").map(Number));return}if(e.closest("[data-pick-mirror]")){await Id();return}if(e.closest("[data-pick-cancel]")){ir();return}let b=e.closest(".dt-hist-go[data-go]");if(b&&Qo()&&(Ie||t.metaKey||t.ctrlKey||t.shiftKey)){t.preventDefault(),Tm(Number(b.dataset.go),t.shiftKey);return}let S=e.closest("[data-row-move]");if(S){o(),await ar(Number(S.dataset.rowMove));return}if(e.closest(".dt-hist-menu.is-row [data-act], .dt-hist-menu.is-row [data-rm]")&&o(),it.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){xa(!1);return}if(t.target.closest("[data-fold]")){xa(!it.hasAttribute("data-collapsed"));return}let P=t.target.closest("[data-gfold]");if(P){am(P.dataset.gfold);return}let m=t.target.closest(".dt-hist-bands [data-bp]");if(m){cr(m.dataset.bp);return}let _=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(_){_.dataset.histView?(oe.view=_.dataset.histView,z("dt-view",oe.view),oe.menu=!1):_.dataset.histSort?(oe.sort=_.dataset.histSort,z("dt-sort",oe.sort),oe.menu=!1,oe.more=!1):_.hasAttribute("data-hist-clear")?(oe.q="",Ns={at:0}):oe.menu=!oe.menu,ge(Yt());return}oe.menu&&!t.target.closest(".dt-hist-menu")&&(oe.menu=!1,ge(Yt()));let Q=t.target.closest("[data-draft-go], [data-draft-rm]");if(Q){let kt=Q.dataset.draftRm!==void 0,Ht=Number(kt?Q.dataset.draftRm:Q.dataset.draftGo);Sn.hidden?kt?Zl(Ht):Di(Ht):Ye(kt?{dropDraft:Ht}:{openDraft:Ht});return}let Ot=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(e.closest(".dt-hist-menu.is-panel [data-resolved], .dt-hist-menu.is-panel [data-archived], .dt-hist-menu.is-panel [data-archive-all]")&&(oe.more=!1),Ot){await Ge(Number(Ot.dataset.id),Ot.dataset.act==="done");return}let Pt=t.target.closest("[data-rm]");if(Pt){X=null,Bi(Number(Pt.dataset.rm));return}if(t.target.closest("[data-review]")){Ea.start();return}if(t.target.closest("[data-resolved]")){ji(!Qe);return}if(t.target.closest("[data-archived]")){_i(!bn);return}let le=t.target.closest("[data-archive-all]");if(le){let kt=le.dataset.archiveAll.split(",").map(Number);for(let Ht of kt)await us(Ht,!0,!0);qe(`Archived ${kt.length}`,()=>{for(let Ht of kt)us(Ht,!1,!0)});return}let mt=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(mt){await us(Number(mt.dataset.id),mt.dataset.act==="archive");return}let Tt=t.target.closest("[data-go]");if(!Tt)return;let bt=Number(Tt.dataset.go);if(!Sn.hidden){Ye({open:bt});return}ms(bt)});let ms=t=>{X=t,Wo=null,rn(),ps=!0,Z();let e=j.find(a=>a.id===t),s=e&&Ce(e);if(s)scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"});else if(e){let a=tn(e);a?a.scrollIntoView({block:"center",behavior:"smooth"}):nl(e)}let o=nt.querySelector(`.dt-pin[data-id="${t}"]`);o&&qo(o,"land"),$a()},Di=t=>{let[e]=ze.splice(t,1);if(!e)return;rn(),B=e,X=null;let s=Ce(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),Z()},Zl=t=>{ze.splice(t,1),Z()},Ea=xu({inFrame:k,everything:()=>yt,route:()=>xt,settle:Ge,keepIn:Xa,toast:t=>zt(t),waits:t=>Ct(t)==="claude"||Ct(t)==="open"&&ds(t)==="review",approve:t=>Ge(t.id,!0),open:t=>{if(Ut||sn(!0),w(t)!==Yt()){cr(w(t));for(let e of[600,1500])setTimeout(()=>Ye({open:t.id}),e)}else ms(t.id)}}),Ql=t=>{if(it.hidden){t?.();return}ss(it,()=>{it.hidden=!0,t?.()})},td=()=>{Oo(it),it.hidden=!1},im=t=>{t?td():Ql(),xe.setAttribute("aria-pressed",String(t)),z("dt-history",t?"1":"0"),Z()},Fi=document.querySelector(".dt-resolved-btn"),Vn=document.querySelector(".dt-space"),rm=()=>{if(!Vn)return;Vn.hidden=!Ze(),Vn.dataset.on=Ve;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Ze()&&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 i=yt.filter(l=>!Se(l)&&Ct(l)!=="done"&&Bt(l)===(a==="clients")).length;o.querySelector(".dt-space-n").textContent=i?String(i):""}Vn.querySelector(".dt-space-name").textContent=Ve==="clients"?"Client":"Team",Vn.querySelector(".dt-space-ic").innerHTML=$t(Pr[Ve],14)},ed=0,Bs=t=>{if(!Ze()||t===Ve)return;let e=()=>{Ve=t,Ie=null,z("dt-space",t),X!=null&&!An(j.find(a=>a.id===X))&&(X=null),rn(),hs(yt),Z(),ge(Yt())},s=document.documentElement,o=++ed;s.classList.add("dt-switching"),Promise.all([On(nt),On(it)]).then(()=>{o===ed&&(e(),requestAnimationFrame(()=>s.classList.remove("dt-switching")))})};document.querySelector(".dt-client-x")?.addEventListener("click",()=>Bs("studio")),Vn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&(Vn.open=!1,Bs(e.dataset.space))});let Rs=document.querySelector(".dt-pinf"),Ps=Rs.querySelector(".dt-pinf-btn"),cn=Rs.querySelector(".dt-pinf-menu"),nd={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My agent",wrote:"Written by me",check:"To check"},lm=()=>j.filter(t=>w(t)===Yt()&&Yo(t)&&An(t)),po=(t,e=!1)=>{cn.hidden=!t,Ps.setAttribute("aria-expanded",String(t)),t&&(ti(),e&&cn.querySelector('[aria-checked="true"]')?.focus())};ti=()=>{let t=lm();if(Rs.hidden=!Ze()||!t.length,Rs.hidden){cn.hidden=!0;return}let e=Object.fromEntries(Yr.map(u=>[u,t.filter(b=>bl(b,u)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",Oe(s)],["others","var(--dt-faint)"]];if(Ps.toggleAttribute("data-on",Hn!=="all"),Ps.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 ${nd[Hn]}, ${e[Hn]}`}`),cn.hidden)return;let a=[...new Set(t.map(u=>No(u,Ct(u))?.taker).filter(u=>!!u&&u!==s))].slice(0,2),i=u=>Fn(ln(u)?.avatar_url,ln(u)?.name||u,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${Oe(u)}" `),l={all:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 3 3 6.5 10 10l7-3.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5"/></svg>',nobody:'<svg viewBox="0 0 16 16" width="16" height="16"><circle cx="8" cy="8" r="7" stroke="var(--dt-new)" stroke-width="1.5" stroke-dasharray="2.5 2"/></svg>',mine: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">${Fe(10)}</i>`,wrote:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 16.5h6.5M13.4 3.9a1.8 1.8 0 0 1 2.6 2.6L7.4 15.1 4 16l.9-3.4z"/></svg>',check:Xe(_n[2][2],_n[2][3]),resolved:Xe(Wn[Wn.length-1][2],Wn[Wn.length-1][3])},d=(u,b)=>`<b class="dt-pinf-share"><i style="--c:${b};width:${Math.round(100*e[u]/e.all)}%"></i></b>`,p=(u,b="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${Hn===u}" data-pinf="${u}"><i class="dt-pinf-glyph">${l[u]}</i><span>${nd[u]}</span>${b?d(u,b):""}<em>${e[u]}</em>${Me}</button>`;cn.innerHTML=`${p("all")}${o.map(([u,b])=>p(u,b)).join("")}${e.resolved||Hn==="resolved"?p("resolved"):""}<hr>${p("claude")}${p("wrote")}${p("check")}`},Ps.addEventListener("click",t=>po(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),po(!1),Ps.focus(),Ut?Z():sn(!0))}),cn.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),po(!1),Ps.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&&!Rs.contains(t.target)&&po(!1)},!0);let ji=t=>{Qe=t,Fi.setAttribute("aria-pressed",String(t)),z("dt-resolved",t?"1":"0"),Ye({resolved:t}),Z(),gs(!0)},_i=t=>{bn=t,z("dt-archived",t?"1":"0"),Ye({archived:t}),Z(),gs(!0)};Fi.addEventListener("click",()=>ji(!Qe)),Fi.setAttribute("aria-pressed",String(Qe)),xe.addEventListener("click",()=>{let t=it.hidden||it.hasAttribute("data-leaving");t&&!Ut&&sn(!0),t&&xa(!1),im(t)});let en=()=>{Ja||!Ut||(Ja=requestAnimationFrame(()=>{Ja=0,em()}))},sd=`${Js}, .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`,od=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(sd))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(sd))},Wi=!1,ad=()=>{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,id=0,dm=()=>{if(!Ut)return!1;let t=new Set([...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].map(s=>Number(s.dataset.id))),e=Yt();return j.some(s=>!t.has(s.id)&&w(s)===e&&Yo(s)&&An(s)&&!!Ce(s))},cm=()=>Ut&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=j.find(s=>s.id===Number(t.dataset.id));return!!e&&e.id!==X&&!tn(e)}),rd=new MutationObserver(t=>{if(Ut&&!k&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),Wi=!0}t.every(od)||((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)ea();else if(Gi&&performance.now()-id>1e3){id=performance.now();for(let[s,o]of Ss)o.el||Ss.delete(s)}Vi=Gi=!1;let e=X!=null?j.find(s=>s.id===X):void 0;dm()||cm()||e&&na&&Vu(e)!==na?Z():en()},150)))}),ld=new ResizeObserver(()=>en()),dd=()=>{nt.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&en()},yt=[],cd=()=>{},mo=new Set,Ke={at:"",ids:[]},hs=t=>{yt=t,queueMicrotask(()=>cd());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={};for(let d of t){if(Se(d)||!An(d))continue;let p=Ct(d),u=Ee(d),b=p==="done"?"done":p==="claude"?"review":u&&da[u]||ds(d),S=s[d.route??""]??={...e(),bands:{}};S[b]++;let P=w(d);(S.bands[P]??=e())[b]++}rm();let o=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},i=d=>o.map(p=>[p,p==="done"&&!Qe?0:d[p]]),l=d=>i(d).reduce((p,[,u])=>p+u,0);for(let d of document.querySelectorAll(".dt-pages a")){let p=d.querySelector(".dt-pages-n");if(!p)continue;let u=s[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let P of h){let m=u?.bands[P.id];for(let[_,Q]of i(m??e())){let Ot=p.querySelector(`[data-bp="${P.id}"][data-state="${_}"]`);Ot.hidden=!Q,Q&&(Ot.querySelector("i").textContent=String(Q),Ot.title=`${P.label}: ${Q} ${a[_]}`)}}let b=u?l(u):0;p.hidden=!b;let S=u?h.filter(P=>u.bands[P.id]&&l(u.bands[P.id])).map(P=>`${P.label} ${l(u.bands[P.id])}`).join(" \xB7 "):"";p.title=b?`${o.filter(P=>u[P]).map(P=>`${u[P]} ${a[P]}`).join(" \xB7 ")}
|
|
337
|
+
${S}`:"",d.dataset.n=String(b)}for(let d of document.querySelectorAll(".dt-folder")){let p=d.querySelectorAll(":scope > ul li[data-route] > a").length,u=[...d.querySelectorAll("a[data-n]")].reduce((S,P)=>S+Number(P.dataset.n),0),b=d.querySelector(".dt-folder-n");b.textContent=p?String(p):"",b.title=`${p} ${p===1?"page":"pages"}${u?` \xB7 ${u} open ${u===1?"thread":"threads"}`:""}`}ne()},Gn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!ya.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=>va.has(`${Number(e.id)}|${s.at}`)?{...s,text:"",deleted:!0}:s):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[],...Ks(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}:{}})),um=Eu(k,t=>zt(t,2800,document.querySelector(".dt-turbo")??void 0)),Ue=document.querySelector(".dt-push"),$n=Ue.querySelector(".dt-push-menu"),xn=new Set,ho=new Set([xt]),Ma=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",ka=()=>n.client||k?[]:yt.filter(t=>t.status!=="done"&&Xt(t.assignee)&&!Bt(t)&&De(t)==="approved"&&!hn(t)&&!Se(t)&&!mo.has(t.id)),La=()=>ka().filter(t=>!xn.has(t.id)),ud=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?Me:""}</i>`,pd=()=>{let t=ka(),e=[...new Set(t.map(o=>o.route??"/"))],s=La().length;$n.innerHTML=`<div class="dt-push-head">${Fe(14)}<b>Waiting for the agent</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),i=a.filter(l=>!xn.has(l.id)).length;return`<button type="button" class="dt-push-page${ho.has(o)?" is-open":""}" data-push-route="${f(o)}"><span data-push-fold="${f(o)}">${la}</span>${ud(i>0,i>0&&i<a.length)}<span class="dt-push-route">${f(o)}</span><em>${a.length}</em></button>`+(ho.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${ud(!xn.has(l.id))}<span><small>#${l.id}</small>${f(Jt(l.text,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>Send ${s} to the agent</button>`},md=()=>["push","paused"].includes(Ma()),Ki=()=>Ke.ids.filter(t=>{let e=yt.find(s=>s.id===t);return!!e&&e.status!=="done"&&De(e)!=="review"&&(mo.has(t)||!!hn(e)||De(e)==="approved")}),hd="",pm=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Bn=()=>{let t=Ma(),e=La().length,s=Ki(),o=Ke.ids.length-s.length,a=s.length>0&&md();if(s.length&&(hd=Ke.at),!s.length&&Ke.ids.length&&Ke.at&&hd===Ke.at&&!pm(Ke.at)){try{sessionStorage.setItem("nm-batch-done",Ke.at)}catch{}yt.length&&qe(`The agent finished ${Ke.ids.length} \u2014 check the fixes`,()=>Ea.start(),"Check")}Ue.hidden=n.client||k||!e&&!Ue.matches(".is-sending, .is-sent");let i=Ue.querySelector(".dt-push-n");i.textContent=String(e),i.hidden=!e||Ue.classList.contains("is-sent"),Ue.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",(Ue.hidden||!ka().length)&&($n.hidden=!0),$n.hidden||pd()},gd=async t=>{if(!t.length&&md()){zt("Nothing waits for the agent \u2014 mark threads for the agent first");return}if(Ma()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),zt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(Ma()==="on"){zt("Turbo is on \u2014 the agent takes each thread as it lands");return}$n.hidden=!0;let e=t.map(o=>o.id);Ue.classList.add("is-sending");let s=await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(Ue.classList.remove("is-sending"),!s?.ok){Kn("Could not send them to the agent",s),Bn();return}for(let o of e)mo.add(o);Ue.classList.add("is-sent"),setTimeout(()=>{Ue.classList.remove("is-sent"),Bn()},700),Ke={at:Ke.ids.some(o=>Ki().includes(o))?Ke.at:new Date().toISOString(),ids:[...new Set([...Ki(),...e])]},Bn(),qe(`${e.length} sent to the agent \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await ie("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)mo.delete(o);Bn()}),nn()},Sa=Ue.querySelector(".dt-push-all"),fd=0,Ui=!1,bd=()=>{$n.hidden=!1,pd()};Sa.addEventListener("click",()=>{if(Ui){Ui=!1;return}gd(La())}),Sa.addEventListener("contextmenu",t=>{t.preventDefault(),$n.hidden?bd():$n.hidden=!0}),Sa.addEventListener("pointerdown",t=>{t.button===0&&(fd=window.setTimeout(()=>{Ui=!0,bd()},500))});for(let t of["pointerup","pointerleave","pointercancel"])Sa.addEventListener(t,()=>clearTimeout(fd));$n.addEventListener("click",t=>{let e=t.target,s=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),i=e.closest("[data-push]")?.dataset.push;if(i==="send"){gd(La());return}if(i==="all")xn.clear();else if(s){let l=s.dataset.pushFold;ho.has(l)?ho.delete(l):ho.add(l)}else if(o){let l=ka().filter(p=>(p.route??"/")===o.dataset.pushRoute),d=l.some(p=>!xn.has(p.id));for(let p of l)d?xn.add(p.id):xn.delete(p.id)}else if(a){let l=Number(a.dataset.pushId);xn.has(l)?xn.delete(l):xn.add(l)}Bn()}),document.addEventListener("pointerdown",t=>{!$n.hidden&&!Ue.contains(t.target)&&($n.hidden=!0)},!0),setInterval(Bn,3e4),cd=Bn;let yd=document.querySelector(".dt-turbo");yd&&new MutationObserver(Bn).observe(yd,{attributes:!0,attributeFilter:["data-state"]}),Bn();let go="",Yi=!1,Is="dt-threads",vd=String([ae.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Xi="",Ta=null,mm=t=>{k||t.version&&t.version===Xi||(Ta||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=Ta;Ta=null,Xi=e.version??"";let s=JSON.stringify({project:vd,body:e});s.length<2e6?ct.setItem(Is,s):ct.removeItem(Is)},{timeout:3e3}),Ta=t)},Ji=(t,e=!1)=>{go=t.version??"",um(t);let s=t.turbo;mo=new Set(s?.push?.ids??[]),Ke={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=Gn(t.comments);if(e&&(Qe||bn)){let i=new Set(o.map(l=>l.id));o=[...o,...yt.filter(l=>Ct(l)==="done"&&!i.has(l.id))]}mm({...t,comments:o}),hs(o);let a=o.filter(i=>i.route===xt);if(!(Uo&&(j=a,wd()))){if(JSON.stringify(a)===JSON.stringify(j)){!it.hidden&&!k&&Z();return}j=a,Z(),Ye({reload:!0})}},gs=async(t=!1)=>{let e=[t||!go?"":`since=${go}`,Qe||bn?"":"open=1"].filter(Boolean).join("&");try{let s=await ie(`comments${e?`?${e}`:""}`);s.status===200&&Ji(await s.json())}catch{}},fo=!1,fs=async()=>{if(!document.hidden){if(Yi||cs){fo=!0;return}Yi=!0,await gs(),Yi=!1,fo&&(fo=!1,fs())}};Pl=()=>{fo&&!cs&&(fo=!1,fs())};let wd=()=>{let t=Uo&&j.find(e=>e.id===Uo);return t?(Uo=0,Ze()&&!An(t)&&Bs(Bt(t)?"clients":"studio"),Ut||sn(!0),ms(t.id),!0):!1},Zi=()=>{j=yt.filter(t=>t.route===xt),wd()||Z()},Qi=0,tr=null,Aa=()=>{tr&&Ut&&er(tr)},er=t=>{tr=t,!Qi&&(Qi=requestAnimationFrame(()=>{Qi=0;let e=t.target;if(!Ut||e.closest(et)){is.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(is.hidden=!1,!s)return;let o=s.getBoundingClientRect();Ru.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`}))},$d=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),te){te=null,Z();return}if(B){Qs()&&(rn(),Z());return}if(X!==null){X=null,Z();return}sn(!1)}},xd=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],bo=!1,yo=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 Ed=()=>{yo=null,bs.hidden=!0,Zt.toggle("dt-repinning",!1)},Md=t=>{yo=t,X=null,bs.hidden=!1,Zt.toggle("dt-repinning",!0),Z()};document.addEventListener("keydown",t=>{t.key==="Escape"&&yo!=null&&(t.stopImmediatePropagation(),Ed())},!0);let kd=!1,Ld=t=>{bo||(t.type==="pointerdown"&&(kd=t.pointerType==="touch"),!t.target.closest?.(et)&&t.stopPropagation())},Sd=t=>{let e=t.target;kd&&(!e.closest?.(et)||e.closest?.(".dt-pin"))&&t.preventDefault()},Td=t=>{!bo&&t.button===0&&t.target.closest?.(":disabled")&&nr(t)},nr=t=>{if(bo)return;let e=t.target;if(e.closest(et))return;if(t.preventDefault(),t.stopPropagation(),H){H=!1;return}if(!getSelection()?.isCollapsed)return;let s=t.detail===0&&!t.clientX&&!t.clientY,o=document.activeElement;nt.hidden=!0;let a=s?o&&o!==document.body&&!o.closest(et)?o:e:document.elementFromPoint(t.clientX,t.clientY);if(nt.hidden=!1,!a)return;if(yo!=null){let u=yo;Ed();let b=a.getBoundingClientRect();Hm(u,a,s?b.left+b.width/2:t.clientX,s?b.top+b.height/2:t.clientY);return}if(!Qs())return;rn();let i=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(u=>!/^(astro|svelte|css)-/.test(u)).slice(0,2);B={selector:ni(a),tag:l,classes:d,nth:si({tag:l,classes:d}).indexOf(a),rx:i.width&&!s?(t.clientX-i.left)/i.width:.5,ry:i.height&&!s?(t.clientY-i.top)/i.height:.5,label:Jt(re(a.textContent||""),60),ctx:oi(a),fp:ta(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:Ku(a),category:g[0].id,...Ze()&&Ve==="clients"?{shared:!0}:{}};let p=n.client||B.shared?null:oo();p&&(B.assignee=p,B.stage="new",B.carried=!0),X=null,is.hidden=!0,Z()},hm=2200,gm=900*1024,fm=8*1024*1024,bm=3*1024*1024,ym=50*1024*1024,zt=(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(),i=o.offsetWidth/2;o.style.left=`${Math.min(Math.max(a.left+a.width/2,i+8),innerWidth-i-8)}px`}return setTimeout(()=>ss(o,()=>o.remove()),e),o},Ad=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),i=ma.get(o);if(ma.delete(o),!i){zt(`${a} was not sent \u2014 attach it again`);continue}let l=zt(`Uploading ${a}\u2026`,12e4),d=await ie("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:i.name,size:i.size})}).then(S=>S.ok?S.json():null).catch(()=>null),p=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:i}).catch(()=>null),u=p?.ok&&await tt({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!u||!u.ok){zt(p===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let b=Gn([await u.json().catch(()=>null)])[0];b&&(j=j.map(S=>S.id===b.id?b:S),Z()),zt(`${a} sent`)}},Hd=t=>{let e=t.filter(s=>s.startsWith(pa)).map(s=>s.split("\0"));return e.length&&zt(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(pa))},Kn=async(t,e)=>{if(!navigator.onLine){zt(`${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="")}zt(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},vm=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),wm=async t=>{let e=await createImageBitmap(t),s=Math.min(1,hm/Math.max(e.width,e.height));if(s===1&&t.size<=gm)return e.close(),vm(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,i)=>s.push(`${pa}${a}\0${i}`);for(let a of t){let i,l=Tc(a.name)||Object.keys(Ho).find(d=>Ho[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>ym){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>bm&&ae.via){let p=`${Date.now()}-${ma.size}`;ma.set(p,a),s.push(`${ki}${p}\0${a.name}\0${a.size}`);continue}let d=await new Promise((p,u)=>{let b=new FileReader;b.onload=()=>p(String(b.result).split(",")[1]),b.onerror=u,b.readAsDataURL(a)}).catch(()=>"");d?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${Sc(a.name)||"file"};ext=${l};base64,${d}`):o(a.name,"Could not be read");continue}try{i=await wm(a)}catch{o(a.name,"This picture could not be read");continue}if(i.length>fm){o(a.name,"Too large even after shrinking");continue}s.push(i)}if(s.length){if(!Number(e?.dataset.id)){B&&((B.images??=[]).push(...s),Z());return}Le.push(...s),Z(),vo(".dt-note-reply-input")}},Cd=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);nt.addEventListener("paste",t=>{let e=Cd(t.clipboardData?.items);e.length&&(t.preventDefault(),sr(e,t.target.closest(".dt-note")))}),nt.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),nt.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),nt.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=Cd(t.dataTransfer?.items);s.length&&sr(s,e)});let vo=t=>{let e=nt.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},Nd=()=>{vo(".dt-note-edit-input"),nt.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},or=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden";let e=Hi-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},$m=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Bd=t=>{let s=t.closest(".dt-compose").querySelector(".dt-mentions");s?.remove();let o=$m(t);if(!o)return;let a=o[1].toLowerCase(),i=X!=null?j.find(u=>u.id===X):void 0,d=(n.client||B?.shared||i&&Bt(i)?n.team??[]:ua()).filter(u=>!Tr(u.email)).filter(u=>u.email!==n.me?.email&&[u.name,u.nickname,u.email].some(b=>b?.toLowerCase().startsWith(a))).slice(0,5);if(!d.length)return;t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(u=>`<button type="button" role="option" data-act="mention" data-handle="${f(Nc(u))}">${Fn(u.avatar_url,u.name||u.email)}<span class="dt-mention-who"><b>${f(u.name||u.email)}</b>${u.name?`<span>${f(u.email)}</span>`:""}</span></button>`)].map((u,b)=>u.replace('role="option"',`role="option" aria-selected="${b===0}"`)).join("")}</div>`);let p=t.nextElementSibling;s&&(p.style.animation="none"),p.getBoundingClientRect().top<8&&p.classList.add("is-below")},xm='<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>',Em='<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>',Rd=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...Wa].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"?xm:wi}<span>${f(o.label)}</span>${Em}</a>`:s?f(o).replace(s,a=>{let i=_c(a,n.team??[],n.me?.email);return`<span class="dt-at" data-kind="${i}">${i==="agent"?Fe(10):""}${a}</span>`}):f(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let s=document.createElement("div");for(let a=0;a<e.rangeCount;a++)s.append(e.getRangeAt(a).cloneContents());let o=s.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",s.textContent??""),t.preventDefault()}});let Pd=(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 Mm=(t,e)=>{if(!t){B&&(B.category=e),Z();return}dn(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>tt({id:t,category:e}),"Changing the type")};cu([nt,it],f,Me),it.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&aa(Number(e.dataset.id),e.value)}),it.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),gl(Number(e.dataset.id)))},!0);let km=t=>Bt(t)?"studio":"clients",ar=async(t,e=!1)=>{let s=j.find(i=>i.id===t);if(!s||Bt(s)&&s.client)return;let o=!Bt(s);X===t&&(X=null);let a=o&&Xt(s.assignee)?{assignee:null,stage:"new"}:{};await dn(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"),hs(yt),e||qe(o?"Moved to Client":"Moved to Team",()=>ar(t,!0))},Lm=async t=>{let e=j.find(d=>d.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...Bt(e)?{}:{shared:!0}};for(let d of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[d]!=null&&(o[d]=s[d]);let a=await zn(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Kn("The copy was not made",a);return}let i=Gn([await a.json().catch(()=>null)])[0];i&&(yt=[...yt,i],j=yt.filter(d=>d.route===xt)),hs(yt),Z(),nn();let l=km(e);qe(l==="clients"?"Duplicated for the client":"Duplicated to Team",()=>{i&&(Bs(l),ms(i.id))},"Open")},Sm=["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"],Ha=async t=>{let e=[],s=0,o=t.length>1?zt(`Mirroring 1 of ${t.length}\u2026`,3e5):null;for(let[a,i]of t.entries()){o&&(o.textContent=`Mirroring ${a+1} of ${t.length}\u2026`);let l=yt.find(S=>S.id===i);if(!l||!Bt(l)||Xo(l))continue;let d=l,p={text:l.text,from:{id:l.id}};for(let S of Sm)d[S]!=null&&(p[S]=d[S]);let u=await zn(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(p)})).catch(()=>null);if(!u?.ok){Kn("Not mirrored",u);break}let b=Gn([await u.json().catch(()=>null)])[0];b&&(u.status===201?e.push(b):s++,yt=[...yt.filter(S=>S.id!==b.id),b])}if(o?.remove(),j=yt.filter(a=>a.route===xt),hs(yt),Z(),nn(),!e.length){s&&zt("Already mirrored");return}qe(`${e.length} mirrored to Team`,async()=>{let a=new Set(e.map(i=>i.id));yt=yt.filter(i=>!a.has(i.id)),j=j.filter(i=>!a.has(i.id)),hs(yt),Z();for(let i of a)await zn(ie(`comments?id=${i}`,{method:"DELETE"})).catch(()=>null);nn()})},ir=()=>{Ie=null,Zo=null,ge(Yt())},Id=async()=>{let t=[...Ie??[]];ir(),t.length&&await Ha(t)},Tm=(t,e)=>{let s=j.find(o=>o.id===t);if(Ie??=new Set,s&&ks(s)){let o=[...it.querySelectorAll(".dt-hist-go[data-go]")].map(l=>Number(l.dataset.go)),a=o.indexOf(Zo??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=j.find(p=>p.id===l);d&&ks(d)&&Ie.add(l)}else Ie.has(t)?Ie.delete(t):Ie.add(t);Zo=t}ge(Yt())};document.addEventListener("keydown",t=>{t.key==="Escape"&&Ie&&(t.stopImmediatePropagation(),t.preventDefault(),ir())},!0);let Am=t=>{let e=new URL(location.href);e.searchParams.has("notemend")||(e.search=e.search?`${e.search}¬emend`:"?notemend"),e.hash=`thread-${t}`;let s=e.href;navigator.clipboard?.writeText(s).then(()=>zt("Link copied"),()=>zt(s,6e3))};nt.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,p=Number(e.dataset.id)||0;e.value="",d==="dup"?Lm(p):d==="mirror"?Ha([p]):d==="move"?ar(p):d==="repin"?Md(p):d==="link"?Am(p):d==="reopen"?Ge(p,!1):d==="archive"||d==="unarchive"?us(p,d==="archive"):d==="rm"?(X=null,Bi(p)):d==="discard"&&(B=null,Z());return}let s=t.target.closest(".dt-lang-select");if(s){Ti(Number(s.dataset.id),s.dataset.at,s.value==="orig"?null:s.value);return}let o=t.target.closest(".dt-cat-select");if(o){Mm(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){mp(Number(a.dataset.id),a.value);return}let i=t.target.closest(".dt-owner-select");if(i){Xu(Number(i.dataset.id)||0,i.value);return}let l=t.target.closest(".dt-for-select");if(l){if(ct.setItem("nm-for",l.value),n.client){B&&(B.assignee=l.value,oo(l.value),Z());return}ci(Number(l.dataset.id)||0,"person")}}),nt.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&B?.suggest){B.suggest.to=e.value,rs(),or(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!s)return;s.removeAttribute("data-no-mention"),Bd(s),s.classList.contains("dt-note-input")?B&&(B.text=s.value):s.classList.contains("dt-note-edit-input")?te&&(te.text=s.value):Pe=s.value,rs(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),or(s);let o=s.closest(".dt-note");o&&o.getBoundingClientRect().bottom>wa()&&(Ii([]),o.classList.contains("is-capped")&&(o.scrollTop=o.scrollHeight))}),nt.addEventListener("keydown",t=>{if(t.key==="Escape"&&nt.querySelector(".dt-emoji")){t.stopPropagation();let a=Cn?.box??Cn?.btn;ga(),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")&&Bd(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),Pd(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),e.setAttribute("data-no-mention",""),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let Ft=null,Ca=!1;function Os(t){return!n.client||!!n.me&&t.by===n.me.email}let Od=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=Od("dt-drag-box--home"),qd=Od("dt-drag-box--to"),Dd=()=>{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)};Dd(),addEventListener("resize",Dd);let Hm=async(t,e,s,o)=>{let a=j.find(u=>u.id===t);if(!a)return;let i={...lr(e,s,o),fp:ta(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=`${fa(a.tag,a.classes,a.selector)}${re(a.label)?` \xAB${Jt(re(a.label),24)}\xBB`:""}`,p=(u,b,S)=>dn(P=>P.map(m=>m.id===t?{...m,...u,anchor:null,...b?{repinnedAt:new Date().toISOString(),repinnedBy:n.me?.email??"you",repinnedFrom:d}:{repinnedAt:null,repinnedBy:null,repinnedFrom:null}}:m),()=>tt({id:t,move:u,anchor:null,repin:b?d:!1}),S);ls.delete(t),await p(i,!0,"Re-pinning"),qe(`Pinned to ${wo(e)}`,()=>{ls.delete(t),p(l,!1,"Putting the pin back")})},Cm=()=>{let t=ii;ii=null;let e=t!=null?j.find(d=>d.id===t):null,s=e&&tn(e);if(!e||!s||(X===e.id&&ms(e.id),e.spot||!Os(e)))return;let o=s.getBoundingClientRect(),a=o.left+o.width*e.rx,i=o.top+o.height*e.ry,l={...lr(s,a,i),fp:ta(s),spot:{x:Math.round(a+scrollX),y:Math.round(i+scrollY)}};ls.delete(e.id),tt({id:e.id,move:l,anchor:null}).then(d=>{d.ok&&Object.assign(e,l,{anchor:null})}).catch(()=>{})},Nm=t=>{let e=j.find(i=>i.id===t),s=e&&Ce(e)?.opener;if(!e||!s)return;bo=!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{bo=!1}X=null,setTimeout(()=>{ea(),X=t,Z()},180)},wo=t=>{let e=Jt(re(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Fd=(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},Bm=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(et)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,Rm=(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(),i=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ni(t),tag:a,classes:i,nth:si({tag:a,classes:i}).indexOf(t),label:Ys(t.textContent||"",60),ctx:oi(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(s-o.top)/o.height)):.5}},dr=()=>{Ft&&(Ft.on&&qo(Ft.pin,"land"),Ft.pin.classList.remove("is-dragging"),Zt.toggle("dt-dragging",!1),rr.hidden=qd.hidden=!0,Ft=null,en())};nt.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=j.find(o=>o.id===Number(e.dataset.id));!s||!Os(s)||(Ft={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:tn(s),to:null},e.setPointerCapture(t.pointerId))}),nt.addEventListener("pointermove",t=>{if(!Ft||!Ft.on&&Math.hypot(t.clientX-Ft.x0,t.clientY-Ft.y0)<4)return;Ft.on=!0,Ft.pin.classList.add("is-dragging"),Zt.toggle("dt-dragging",!0),Ft.pin.style.left=`${t.clientX}px`,Ft.pin.style.top=`${t.clientY}px`,Ft.to=Ft.home&&Rm(Ft.home,t.clientX,t.clientY)?Ft.home:Bm(t.clientX,t.clientY);let e=Ft.to&&Ft.to!==Ft.home;Fd(rr,Ft.home,e?"":Ft.home?wo(Ft.home):""),rr.classList.toggle("is-left",!!e),Fd(qd,e?Ft.to:null,e?`Move to ${wo(Ft.to)}`:"")}),nt.addEventListener("pointerup",async t=>{if(!Ft)return;let e=Ft;if(!e.on||!e.to){dr();return}Ca=!0,setTimeout(()=>{Ca=!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 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,p)=>dn(u=>u.map(b=>b.id===e.id?{...b,...d}:b),()=>tt({id:e.id,move:d}),p);await l(o,"Moving the pin"),a&&qe(`Moved to ${wo(e.to)}`,()=>l(i,"Putting the pin back"))}),nt.addEventListener("click",t=>{Ca&&(t.stopImmediatePropagation(),t.preventDefault(),Ca=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&Ft?.on&&(t.stopImmediatePropagation(),dr())},!0),nt.addEventListener("click",async t=>{let e=t.target.closest("button"),s=Cn?.btn;if(e?.closest(".dt-emoji")||ga(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="open-orig"){Bs("clients"),ms(a);return}if(o==="react"){Hl(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&Al(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 i=Cn;Al(i.btn,!0,i);return}if(o==="emoji"&&Cn){let i=Cn;ga(),i.box?jp(i.box,e.dataset.emoji):i.id&&Hl(i.id,i.at||null,e.dataset.emoji);return}if(o==="prio"){let i=e.dataset.v||null;a?dn(l=>l.map(d=>d.id===a?{...d,priority:i??void 0}:d),()=>tt({id:a,priority:i}),"Setting the priority"):B&&(B.priority=i??void 0,rs(),Z());return}if(o==="mention"){let i=e.closest(".dt-compose")?.querySelector("textarea");i&&Pd(i,e.dataset.handle);return}if(!o){if(B&&!Qs())return;X=X===a?null:a,rn(),Z(),ps&&$a();return}if(o==="speak"){Np(e.closest(".dt-note"),e);return}if(o==="voice-write"){Rp(e);return}if(o==="voice"||o==="voice-seek"){vp(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&&sr([...i.files],l)}),i.click();return}if(o==="unshot"){a?te&&te.drop.push(e.dataset.img):(e.closest("[data-draft]")?B?.images??[]:Le).splice(Number(e.dataset.i),1),Z(),te&&Nd();return}if(o==="edit"){let i=j.find(p=>p.id===a),l=e.dataset.at||null,d=l?i?.replies?.find(p=>p.at===l)?.text:i?.text;if(d===void 0)return;te={id:a,at:l,text:d,drop:[]},Z(),Nd();return}if(o==="edit-cancel"){te=null,Z();return}if(o==="tr-orig"){Ti(a,e.dataset.at,null);return}if(o==="tr-retry"){Ti(a,e.dataset.at,e.dataset.to);return}if(o==="unsay"){let i=e.dataset.at;Xp(a,i);return}if(o==="edit-save"){let i=te;if(!i)return;let l=i.text.trim();if(!l){nt.querySelector(".dt-note-edit-input")?.focus();return}te=null;let d=p=>i.drop.includes(p.split("/").pop());await dn(p=>p.map(u=>u.id!==i.id?u:{...u,...i.at==null?{text:l}:{replies:(u.replies??[]).map(b=>b.at===i.at?{...b,text:l}:b)},images:(u.images??[]).filter(b=>!d(b))}),()=>tt({id:i.id,edit:{at:i.at,text:l},...i.drop.length?{removeImage:i.drop}:{}}).then(p=>(p.ok||(te=i),p),p=>{throw te=i,p}),"Saving the edit");return}if(o==="cancel"){Qs()&&(rn(),Z());return}if(o==="twin"){if(!Qs())return;rn(),X=Number(e.dataset.id),Z();return}if(o==="discard"){B=null,Z();return}if(o==="draft-open"){Di(Number(e.dataset.i));return}if(o==="close"){X=null,Z();return}if(o==="go-spot"){let i=j.find(l=>l.id===Number(e.dataset.id));i&&nl(i);return}if(o==="show-el"){let i=j.find(l=>l.id===Number(e.dataset.id));i&&tn(i)?.scrollIntoView({block:"center",inline:"center",behavior:ns()?"smooth":"auto"});return}if(o==="where"){let i=j.find(P=>P.id===Number(e.dataset.id)),l=i&&Ce(i),d=l?.hidden;if(!d)return;let p=P=>{let m=P.getBoundingClientRect();return(m.width||m.height)&&P.checkVisibility?.()!==!1?m:null},u=l.shut instanceof HTMLElement?l.shut:null,b=u&&p(u);if(u&&!b){let P=u.getAttribute("style");u.setAttribute("style",`${P??""};display:block!important`),b=p(u),P==null?u.removeAttribute("style"):u.setAttribute("style",P)}b??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let S=document.createElement("div");S.className="dt-where",S.style.cssText=`left:${b.left}px;top:${b.top}px;width:${b.width}px;height:${b.height}px`,document.body.append(S),On(S).then(()=>S.remove());return}if(o==="unsuggest"&&B){B.suggest=null,Z();return}if(o==="uncarry"&&B){B.assignee="",B.carried=!1,oo(""),rs(),Z();return}if(o==="save"){if(!B)return;B.images&&(B.images=Hd(B.images));let i=(B.images??[]).filter(_=>!As(_)),l=B.suggest&&B.suggest.to.trim()!==B.suggest.from?{from:B.suggest.from,to:B.suggest.to.trim()}:null,d=nt.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(B.images?.some($i)?Sl:B.images?.some(_=>As(_)&&!Co(_))?"See the attached image":B.images?.length?"See the attached file":"");if(!d){nt.querySelector(".dt-note-input")?.focus();return}let p=B,u=n.client||p.shared===!0?null:Sr(d,so()),b={...p,images:p.images?.filter(As),route:xt,text:d,suggest:l,assignee:n.client?xl(p.assignee)||void 0:u??(p.assignee||void 0),shared:n.client?!0:p.shared===!0,stage:n.client?"new":u?"approved":p.stage??(Xt(p.assignee)?"approved":"new"),breakpoint:ei(),browser:ju(),device:k?jd:"",viewport:{w:innerWidth,h:innerHeight},logs:ou(),host:location.host},S={...p,id:-Date.now(),text:d,route:xt,status:"open",note:"",doneBy:null,breakpoint:b.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:n.me?.email,byName:n.me?.name};j=[...j,S],B=null,Z();let P=await zn(ie("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b)})).catch(()=>null);if(!P?.ok){j=j.filter(_=>_!==S),rn(),B=p,Z(),Kn("Thread was not saved",P);return}let m=Gn([await P.json().catch(()=>null)])[0];j=j.map(_=>_===S&&m?m:_),Z(),m&&i.length&&Ad(m.id,i),nn();return}if(o==="reply"){let i=nt.querySelector(".dt-note-reply-input");Le=Hd(Le);let l=i.value.trim()||(Le.some($i)?Sl:Le.some(Q=>As(Q)&&!Co(Q))?"See the attached image":Le.length?"See the attached file":"");if(!l){i.focus();return}let d=Le;Pe=l,fn=a,to(),Pe="",Le=[],i.value="";let p=j,u=j.find(Q=>Q.id===a),b=n.client||Bt(u)?null:Sr(l,so()),S=b&&u&&(b!==u.assignee||De(u)!=="approved"||u.status==="done")?{assignee:b,stage:"approved",...u.status==="done"?{status:"open",doneBy:null}:{}}:{};j=j.map(Q=>Q.id===a?{...Q,...S,replies:[...Q.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:n.me?.email}]}:Q),zo=a,Z();let P=await zn(tt({id:a,reply:l,images:d.filter(As),...S})).catch(()=>null);if(!P?.ok){j=p,Pe=l,Le=d,Z();let Q=nt.querySelector(".dt-note-reply-input");Q&&!Q.value&&(Q.value=l);let Ot=()=>nt.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?qe(`Reply was not sent${P?` (${P.status})`:""} \u2014 it is back in the box`,Ot,"Retry"):Kn("Reply was not sent",P);return}to();let m=Gn([await P.json().catch(()=>null)])[0];m&&(j=j.map(Q=>Q.id===m.id?m:Q),Z()),nn();let _=d.filter(Q=>!As(Q));_.length&&Ad(a,_);return}if(o==="unfold"){Ts.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,Go(i)}delete We[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:ns()?"smooth":"auto"}),delete We[a],e.remove();return}if(o==="hand"){ci(a,e.dataset.v);return}if(o==="repin"){Md(a);return}if(o==="open-it"){Nm(a);return}if(o==="lost-resolve"){X=null,await Ge(a,!0);return}if(o==="claude"){gl(a);return}if(o==="sendback"){await Ge(a,!1),vo(".dt-note-reply-input");return}if(o==="accept"){await Ge(a,!0);return}if(o==="accept-quiet"){await Ge(a,!0,!1);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(X=null),await us(a,o==="archive");return}e.classList.contains("dt-step-act")||(X=null),o==="rm"?await Bi(a):await Ge(a,o==="done")});let jd="",Ye=t=>{Sn.hidden||Xs.contentWindow?.postMessage({dt:!0,...t},location.origin)},Pm=()=>({notes:Ut,grid:!St.hidden,inspect:gt,resolved:Qe,archived:bn,..._d.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(k&&e.projectGrid!==void 0){qt=e.projectGrid,St.hidden||we();return}if(!k&&t.source===Xs.contentWindow){if(e.key){hc(e.key[0],e.key[1])?.run();return}if(e.closeMenus){D();return}if(e.route){$();return}if(e.drafts){Ci=e.drafts,ge(Yt());return}}if(k&&typeof e.openDraft=="number"){Di(e.openDraft);return}if(k&&typeof e.dropDraft=="number"){Zl(e.dropDraft);return}if(k&&typeof e.device=="string"&&(jd=e.device),k&&e.scrollbar&&Zt.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Xs.contentWindow){Ye(Pm());return}typeof e.notes=="boolean"&&e.notes!==Ut&&sn(e.notes,!1),typeof e.open=="number"&&ms(e.open),typeof e.grid=="boolean"&&e.grid===St.hidden&&ft(e.grid),typeof e.inspect=="string"&&e.inspect!==gt&&Y(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Qe&&ji(e.resolved),typeof e.archived=="boolean"&&e.archived!==bn&&_i(e.archived),e.reload&&gs()});let nn=async()=>{await gs(),Ye({reload:!0}),k&&parent.postMessage({dt:!0,reload:!0},location.origin)},sn=(t,e=!0)=>{if(Ut=t,Nt.setAttribute("aria-pressed",String(t)),t?!k&&it.hidden&&ct.getItem("dt-history")==="1"&&(td(),xe.setAttribute("aria-pressed","true")):(Ql(()=>{Ut||it.replaceChildren()}),xe.setAttribute("aria-pressed","false")),z(Vr,t?"1":"0"),Ye({notes:t}),k&&e&&parent.postMessage({dt:!0,notes:t},location.origin),nt.hidden=!t||!Sn.hidden,Zt.toggle("dt-noting",t),t&&!k?ad():document.querySelector(".dt-room")?.remove(),t){Y(""),document.addEventListener("click",nr,!0),document.addEventListener("pointerup",Td,!0);for(let s of xd)document.addEventListener(s,Ld,!0);document.addEventListener("contextmenu",Sd,!0),document.addEventListener("keydown",$d),document.addEventListener("mousemove",er),addEventListener("scroll",en,!0),addEventListener("scroll",Aa,!0),addEventListener("scroll",$a,!0),addEventListener("resize",en),addEventListener("resize",Aa),addEventListener("pointerover",dd,!0),ea(),rd.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),ld.observe(document.body),Zi()}else{rn(),X=null,document.removeEventListener("click",nr,!0),document.removeEventListener("pointerup",Td,!0);for(let s of xd)document.removeEventListener(s,Ld,!0);document.removeEventListener("contextmenu",Sd,!0),document.removeEventListener("keydown",$d),document.removeEventListener("mousemove",er),is.hidden=!0,removeEventListener("scroll",en,!0),removeEventListener("scroll",Aa,!0),removeEventListener("scroll",$a,!0),removeEventListener("resize",en),removeEventListener("resize",Aa),removeEventListener("pointerover",dd,!0),rd.disconnect(),ld.disconnect(),nt.innerHTML=""}},{pickBp:cr,..._d}=yu({cfg:n,inFrame:k,persist:z,frame:Sn,frameEl:Xs,devicesMenu:as,bpBtns:Kt,notesOverlay:nt,WIDE:y,bpOf:T,currentBp:ei,deviceById:A,notesOn:()=>Ut,filter:()=>Qa,filterTo:t=>{Qa=t},dropFrameDrafts:()=>{Ci=[]},putAway:()=>{X=null,rn()},tellFrame:Ye,syncBpButtons:Zr,render:()=>Z(),reread:()=>{Ut?Zi():Z()}}),Wd="dt-studio",zd=t=>{os.setAttribute("aria-pressed",String(t)),Zt.toggle("dt-no-studio",!t),z(Wd,t?"1":"0")};os.addEventListener("click",()=>zd(os.getAttribute("aria-pressed")!=="true")),zd(ct.getItem(Wd)!=="0"),Nt.addEventListener("click",()=>sn(!Ut));let ve=document.querySelector(".devtools"),qs=document.querySelector(".dt-tab"),Vd=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-ve.getBoundingClientRect().top)+12}px`);new ResizeObserver(Vd).observe(ve),addEventListener("resize",Vd);let Im=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),Gd=()=>{ve.removeAttribute("data-tight");let t=ve.getBoundingClientRect().right,e=Im(),s=!1;for(let o of ve.children){let a=o.getBoundingClientRect();t=Math.max(t,a.right),e?.width&&e.left<a.right+8&&e.right>a.left-8&&e.top<a.bottom&&e.bottom>a.top&&(s=!0)}ve.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||s)},Kd=0,ur=()=>{cancelAnimationFrame(Kd),Kd=requestAnimationFrame(Gd)},Om=new ResizeObserver(ur);for(let t of ve.children)Om.observe(t);addEventListener("resize",ur),Gd();for(let t of[1500,4e3])setTimeout(ur,t);for(let t of x)t.addEventListener("toggle",()=>{let e=t.querySelector(":scope > :not(summary)");if(!e||(e.style.translate="",!t.open||it.hidden||t.matches(".dt-keys")))return;let s=e.getBoundingClientRect(),o=it.getBoundingClientRect();o.width&&s.right>o.left-8&&s.bottom>o.top&&s.top<o.bottom&&(e.style.translate=`${Math.round(o.left-8-s.right)}px 0`)});let Ud=t=>{ve.toggleAttribute("data-collapsed",t),qs.toggleAttribute("data-collapsed",t),qs.setAttribute("aria-expanded",String(!t)),qs.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),ve.inert=t,t&&D(),t&&js&&Ba(""),t&&Ut&&!B&&X==null&&sn(!1),z("dt-collapsed",t?"1":"0")};qs.addEventListener("click",()=>Ud(!ve.hasAttribute("data-collapsed")));let un=document.querySelector(".dt-keys"),Yd=un.querySelector(".dt-set-keys"),qm=un.querySelector(".dt-set-main"),$o=un.querySelector(".dt-set-grid"),Xd=un.querySelector('[data-set="grid"] .dt-set-hint'),xo=t=>{if(qm.hidden=t!=="main",Yd.hidden=t!=="keys",$o.hidden=t!=="grid",t==="grid"&&_m(),Xd){let e=pe();Xd.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},pr=t=>xo(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}},Eo={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},Dm=["cols","gutter","margin","max"],Na=(t,e)=>Math.min(Eo[t][1],Math.max(Eo[t][0],Math.round(e))),Fm=()=>({...mr,...qt?.widths}),hr=()=>!!n.project&&!!n.gridAdmin,Jd=()=>!St.hidden&&!pe()&&Vt?Vt:me(),jm=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},_m=()=>{let t=hr(),e=Fm(),s=Lt(),o=pe(),a=h.find(p=>p.id===s),i=(p,u)=>`<div class="dt-grid-row"><span>${p}</span><b>${u}</b></div>`,l=(ae.cabinet||n.cabinet)&&n.project?` <a href="${f(`${ae.cabinet||n.cabinet}/p/${n.project}?tab=settings`)}" target="_blank" rel="noopener">Also in the cabinet \u203A</a>`:"",d;if(o)d=`<p class="dt-grid-band">${f(a.label.toUpperCase())} \xB7 ${a.ideal} \u2014 this width</p>
|
|
338
|
+
<div class="dt-grid-fields">${Dm.map(p=>`<label><span>${p==="cols"?"Cols":p[0].toUpperCase()+p.slice(1)}</span>
|
|
339
|
+
<input type="number" inputmode="numeric" step="1" min="${Eo[p][0]}" max="${Eo[p][1]}" data-grid-k="${p}" value="${o[p]??""}"${p==="max"?' placeholder="\u2014"':""}${t?"":" disabled"}></label>`).join("")}</div><hr>
|
|
340
|
+
${h.filter(p=>p.id!==s&&e[p.id]).map(p=>i(`${f(jm(p.label))} \xB7 ${p.ideal}`,`${e[p.id].cols} \xB7 ${e[p.id].gutter} \xB7 ${e[p.id].margin}`)).join("")}<hr>
|
|
341
|
+
<p class="dt-grid-foot">${t?"Saved for the project \u2014 everyone sees it.":"Set by the project\u2019s admins."}${l}</p>`;else{let p=Jd();d=i(p.from==="guess"?"Guessed":"Read from the page",`${p.cols} \xD7 ${p.w}`)+i("Gap",String(p.gap))+i("Margin",String(p.x))}$o.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${Va}<span>Grid</span></button><hr>`+(n.project?`<div class="dt-grid-from"><span>Columns from</span><div class="dt-seg" role="radiogroup" aria-label="Columns from">${["auto","custom"].map(p=>`<button type="button" role="radio" data-grid-mode="${p}" aria-checked="${p==="custom"==!!o}"${t?"":" disabled"}>${p==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},Zd=async(t,e)=>{let s=qt,o=p=>{p&&!$o.hidden&&xo("grid"),St.hidden||we(),Ye({projectGrid:qt})};qt=t(qt),o(e);let a=await ie("config").then(p=>p.ok?p.json():null).catch(()=>null),i=t(a?a.projectGrid??null:s),l=await ie("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:i})}).catch(()=>null);if(l?.ok){qt=(await l.json()).grid??null;return}let d=l?await l.text():"";zt(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),qt=s,o(!0)};if($o.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!hr()||e==="custom"==!!pe())return;let s=Lt(),o=e==="custom"?Jd():null,a=document.documentElement.clientWidth,i=o&&{cols:Na("cols",o.cols),gutter:Na("gutter",o.gap),margin:Na("margin",o.x),max:Math.abs(a-2*o.x-o.w)<=2?null:Na("max",o.w)};Zd(l=>({mode:e,widths:{...mr,...l?.widths,...i?{[s]:i}:{}}}),!0)}),$o.addEventListener("change",t=>{let e=t.target,s=e.dataset.gridK,o=pe();if(!s||!o||!hr())return;let a=e.value.trim()===""?null:Number(e.value),[i,l]=Eo[s];if(a===null?s!=="max":!Number.isInteger(a)||a<i||a>l){zt(`${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=Lt();Zd(p=>({mode:"custom",widths:{...mr,...p?.widths,[d]:{...p?.widths?.[d]??o,[s]:a}}}),!1)}),vt.querySelector("button").addEventListener("click",()=>{D(),un.open=!0,xo("grid")}),xo("main"),ae.signOut)for(let t of document.querySelectorAll('.dt-me [data-set="out"], .dt-me [data-set-out]'))t.hidden=!1;let gr=()=>{},Qd=()=>!1;Wm();function Wm(){let t=document.querySelector(".dt-strip"),e=document.querySelector(".dt-strip-grip"),s=document.documentElement;if(k){t.hidden=e.hidden=!0;return}let o=t.querySelector(".dt-strip-pin"),a=ct.getItem("dt-strip-pin")==="1",i=!1,l=!1,d=0,p=0,u=()=>l||!!t.querySelector("details[open]")||t.matches(":hover")||!!t.querySelector(":focus-visible"),b=v=>{i=v||a,i||(l=!1),t.classList.toggle("is-out",i),t.inert=!i,Zt.toggle("dt-strip-out",i)},S=()=>{clearTimeout(p),p=window.setTimeout(()=>{i&&!a&&!u()&&b(!1)},350)};gr=v=>{l=v&&!a,b(v)},Qd=()=>i,document.addEventListener("mousemove",v=>{a||(v.clientY<=3?i||(d||=window.setTimeout(()=>{d=0,b(!0)},140)):(clearTimeout(d),d=0,i&&v.clientY>40&&S()))}),s.addEventListener("mouseleave",()=>{clearTimeout(d),d=0,i&&S()}),t.addEventListener("toggle",()=>{i&&S()},!0),t.addEventListener("focusout",()=>{i&&S()}),e.addEventListener("click",()=>b(!0)),document.addEventListener("pointerdown",v=>{i&&!a&&!t.contains(v.target)&&v.target!==e&&(l=!1,D(),b(!1))});let P=v=>{if(a=v,ct.setItem("dt-strip-pin",v?"1":"0"),o.setAttribute("aria-pressed",String(v)),o.dataset.tip=v?"Let it hide \u2014 the site moves back":"Keep it out \u2014 moves the site",Zt.toggle("dt-strip-on",v),v)Q();else{for(let[I,K]of m)I.style.top=K;m.clear()}b(!0)};o.addEventListener("click",()=>P(!a)),document.addEventListener("keydown",v=>{v.key==="Escape"&&i&&!a&&!t.querySelector("details[open]")&&b(!1)});let m=new Map,_=v=>{let I=getComputedStyle(v);if(I.position!=="fixed"&&I.position!=="sticky")return null;let K=v.computedStyleMap?.().get("top")?.toString();if(K?K==="auto":I.top==="auto"||parseFloat(I.top)>parseFloat(I.bottom))return null;if(I.position==="sticky"){for(let W=v.parentElement;W&&W!==document.body;W=W.parentElement)if(getComputedStyle(W).overflowY!=="visible")return null}return`calc(${I.top} + 40px)`},Q=v=>{if(!a)return;for(let W of v??[])W.style.top=m.get(W)??"",m.delete(W);let K=(v??[...document.body.children].filter(W=>!/(^|\s)(dt-|devtools)/.test(String(W.className))).flatMap(W=>[W,...W.querySelectorAll("*")])).filter(W=>W.isConnected&&W.style&&!m.has(W)).map(W=>[W,_(W)]).filter(W=>W[1]);for(let[W,ot]of K)m.set(W,W.style.top),W.style.setProperty("top",ot,"important"),Ot.observe(W,{attributes:!0,attributeFilter:["class"]})},Ot=new MutationObserver(v=>Q([...new Set(v.map(I=>I.target))].filter(I=>m.has(I)))),Pt=0,le=()=>{Pt||=window.setTimeout(()=>{Pt=0,Q()},500)};new MutationObserver(v=>{v.every(od)||le()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),addEventListener("resize",()=>{Q([...m.keys()]),le()}),P(a),b(a);let mt=t.querySelector(".dt-me");if(n.me){mt.querySelector(".dt-me-face").innerHTML=Fn(n.me.avatar_url,n.me.name||n.me.email).replace(/^<(img|b) /,`<$1 style="--hue:${Oe(n.me.email.toLowerCase())}" `);let v=ae.cabinet||n.cabinet;if(v){let I=mt.querySelector(".dt-me-cab"),K=mt.querySelector(".dt-me-acc");I.href=n.project?`${v}/p/${n.project}`:v,I.hidden=!1,K.href=`${v}/settings?tab=account`,K.hidden=!1}}mt.addEventListener("click",v=>{let I=v.target.closest("[data-set], a");I&&(mt.open=!1,I.dataset.set==="out"&&confirm("Sign out of Notemend on this site?")&&(ct.removeItem(Is),ae.signOut?.()))});let Tt=t.querySelector(".dt-pages"),bt=Tt.querySelector(".dt-pages-find input"),kt=Tt.querySelector(".dt-pages-hits"),Ht=Tt.querySelector(".dt-pages-foot");Tt.addEventListener("toggle",()=>{if(Tt.open){bt.value="",Te(),requestAnimationFrame(()=>bt.focus());let v=Tt.querySelector(".dt-pages-copy");v&&(delete v.dataset.copied,v.dataset.tip="Copy link")}});let Te=()=>{let v=bt.value.trim().toLowerCase();if(G.hidden=!!v,kt.hidden=!v,Ht.classList.toggle("is-off",!!v),!v)return;let I=n.pages.filter(K=>K.label.toLowerCase().includes(v)||K.route.toLowerCase().includes(v)).slice(0,12);kt.innerHTML=I.length?`<ul>${I.map(K=>`<li><a href="${f(K.route)}"${K.route===xt?' aria-current="page"':""}><span class="dt-menu-label">${f(K.label)}</span><em class="dt-pages-route">${f(K.route)}</em></a></li>`).join("")}</ul>`:`<p class="dt-pages-none">No page matches \u201C${f(bt.value.trim())}\u201D</p>`};bt.addEventListener("input",Te),bt.addEventListener("keydown",v=>{v.key==="Enter"&&(v.preventDefault(),kt.querySelector("a")?.click()),v.key==="Escape"&&bt.value&&(v.preventDefault(),v.stopPropagation(),bt.value="",Te())});let de=Tt.querySelector(".dt-pages-copy"),ce=v=>{v.preventDefault(),v.stopPropagation(),v instanceof MouseEvent&&v.detail>0&&de.blur(),navigator.clipboard?.writeText(location.href.replace(/#.*$/,"")).catch(()=>null),de.dataset.copied="",de.dataset.tip="Link copied",clearTimeout(Number(de.dataset.t)),de.dataset.t=String(window.setTimeout(()=>{delete de.dataset.copied,de.dataset.tip="Copy link"},1600))};de.addEventListener("click",ce),de.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&ce(v)}),_t=()=>{$(),hs(yt),M&&En()};let Rn=()=>{z("dt-folders-open",JSON.stringify([...V])),z("dt-folders-closed",JSON.stringify([...U]))};if(G.addEventListener("click",v=>{let I=v.target,K=I.closest(".dt-folder-more");if(K)return v.preventDefault(),Da(K);let W=I.closest(".dt-folder-row");if(!W||W.querySelector("input"))return;let ot=W.parentElement,Mt=ot.dataset.folder,lt=!ot.hasAttribute("data-open");lt?(V.add(Mt),U.delete(Mt)):(V.delete(Mt),U.add(Mt)),Rn(),ot.toggleAttribute("data-open",lt),W.setAttribute("aria-expanded",String(lt)),W.children[1].outerHTML=se(lt),Ka(ot.querySelector(":scope > ul"),lt)}),G.addEventListener("keydown",v=>{(v.key==="Enter"||v.key===" ")&&v.target.matches(".dt-folder-row")&&(v.preventDefault(),v.target.click())}),!M)return;let ue=new Set,Ne="",qa=v=>{let I=v.closest("li[data-route]");if(I)return`p:${I.dataset.route}`;let K=v.closest(".dt-folder:not(.dt-folder--site)");return K&&v.closest(".dt-folder-row")?`f:${K.dataset.folder}`:""},Lo=()=>[...G.querySelectorAll("li[data-route], .dt-folder:not(.dt-folder--site)")].filter(v=>v.matches(".dt-folder")||v.offsetParent).map(v=>v.dataset.route?`p:${v.dataset.route}`:`f:${v.dataset.folder}`),_s=Ht.querySelector(".dt-sel-hint");function En(){for(let I of G.querySelectorAll(".is-picked"))I.classList.remove("is-picked");for(let I of ue)(I.startsWith("p:")?G.querySelector(`li[data-route="${CSS.escape(I.slice(2))}"] > a`):G.querySelector(`[data-folder="${CSS.escape(I.slice(2))}"] > .dt-folder-row`))?.classList.add("is-picked");let v=ue.size;_s.hidden=!v,_s.innerHTML=v?`<b>${v} selected</b><button type="button" data-sel="group"><kbd>\u2318G</kbd> Group</button><button type="button" data-sel="ungroup"><kbd>\u2318\u21E7G</kbd> Ungroup</button>`:""}let Ws=()=>{ue.size&&(ue.clear(),Ne="",En())};G.addEventListener("click",v=>{let I=v,K=I.metaKey||I.ctrlKey,W=I.shiftKey,ot=qa(v.target);if(!ot||!K&&!W){v.target.closest(".dt-folder-more")||Ws();return}if(v.preventDefault(),v.stopImmediatePropagation(),W&&Ne){let Mt=Lo(),lt=Mt.indexOf(Ne),pt=Mt.indexOf(ot);if(lt>=0&&pt>=0)for(let Be of Mt.slice(Math.min(lt,pt),Math.max(lt,pt)+1))ue.add(Be)}else ue.has(ot)?ue.delete(ot):ue.add(ot);Ne=ot,En()},!0),Tt.addEventListener("toggle",()=>{Tt.open||Ws()});let zs=()=>{let v=Lo().filter(lt=>ue.has(lt)&<.startsWith("p:")).map(lt=>lt.slice(2)),I=[...ue].filter(lt=>lt.startsWith("f:")).map(lt=>lt.slice(2)).filter(lt=>!L.some(pt=>ue.has(`f:${pt.id}`)&&pn(lt,pt.id)));if(!v.length&&!I.length)return;let K=new Set([...v.map(lt=>L.find(pt=>pt.pages.includes(lt))?.id??""),...I.map(lt=>L.find(pt=>pt.id===lt)?.parent??"")]),W=K.size===1&&[...K][0]||null,ot=Math.random().toString(36).slice(2,10),Mt=[{id:ot,name:"Untitled folder",pages:v,...W?{parent:W}:{}},...L.map(lt=>({...lt,pages:lt.pages.filter(pt=>!v.includes(pt)),...I.includes(lt.id)?{parent:ot}:{}}))];W&&(V.add(W),U.delete(W)),ue.clear(),Ne="",V.add(ot),U.delete(ot),Rn(),Ae(Mt),Xn(ot,!1)};_s.addEventListener("click",v=>{let I=v.target.closest("[data-sel]")?.dataset.sel;I==="group"&&zs(),I==="ungroup"&&wt()});let wt=()=>{let v=new Set([...ue].filter(W=>W.startsWith("f:")).map(W=>W.slice(2)));for(let W of ue)if(W.startsWith("p:")){let ot=L.find(Mt=>Mt.pages.includes(W.slice(2)));ot&&v.add(ot.id)}if(!v.size)return;let I=L,K=L.filter(W=>v.has(W.id));ue.clear(),Ne="",Ae(vs(L,v)),qe(K.length===1?`Ungrouped \u201C${K[0].name}\u201D`:`Ungrouped ${K.length} folders`,()=>Ae(I))};document.addEventListener("keydown",v=>{if(!(!Tt.open||v.target?.closest?.("input:not(.dt-pages-find input), textarea"))){if(v.key==="Escape"&&ue.size){v.preventDefault(),v.stopImmediatePropagation(),Ws();return}(v.metaKey||v.ctrlKey)&&v.code==="KeyG"&&ue.size&&(v.preventDefault(),v.stopImmediatePropagation(),v.shiftKey?wt():zs())}},!0),G.addEventListener("dblclick",v=>{let I=v.target.closest(".dt-folder:not(.dt-folder--site)");!I||v.target.closest(".dt-folder-more, input")||!v.target.closest(".dt-folder-row")||(v.preventDefault(),Xn(I.dataset.folder,!1))});let Ae=async v=>{let I=L;L=v,Dt();let K=await ie("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({folders:v})}).catch(()=>null);if(K?.ok){let ot=(await K.json()).folders??[];JSON.stringify(ot)!==JSON.stringify(L)&&(L=ot,Dt());return}let W=K?await K.text():"";zt(K?(()=>{try{return JSON.parse(W).error}catch{return W}})()||"The folders were not saved.":"The folders were not saved \u2014 no connection."),L=I,Dt()},vs=(v,I)=>{let K=v.map(W=>({...W,pages:[...W.pages]}));for(let W of I){let ot=K.find(pt=>pt.id===W);if(!ot)continue;let Mt=ot.parent&&K.some(pt=>pt.id===ot.parent&&pt.id!==W)?ot.parent:null;K=K.filter(pt=>pt.id!==W).map(pt=>pt.parent===W?{...pt,parent:Mt}:pt);let lt=Mt?K.find(pt=>pt.id===Mt):null;if(lt)for(let pt of ot.pages)lt.pages.includes(pt)||lt.pages.push(pt)}return K.map(({parent:W,...ot})=>W?{...ot,parent:W}:ot)},pn=(v,I)=>{let K=L.find(W=>W.id===v);return!!K?.parent&&(K.parent===I||pn(K.parent,I))},Xn=(v,I)=>{let K=G.querySelector(`[data-folder="${CSS.escape(v)}"] .dt-folder-row .dt-menu-label`);if(!K)return;let W=L.find(pt=>pt.id===v),ot=document.createElement("input");ot.className="dt-folder-name",ot.value=W.name,ot.maxLength=60,ot.setAttribute("aria-label","Folder name"),K.replaceWith(ot),ot.focus(),ot.select();let Mt=!1,lt=pt=>{if(Mt)return;Mt=!0;let Be=ot.value.trim();if(pt&&Be)return void Ae(L.map(Mn=>Mn.id===v?{...Mn,name:Be}:Mn));I&&(L=L.filter(Mn=>Mn.id!==v)),Dt()};ot.addEventListener("keydown",pt=>{pt.key==="Enter"&&(pt.preventDefault(),lt(!0)),pt.key==="Escape"&&(pt.preventDefault(),pt.stopPropagation(),lt(!1)),pt.stopPropagation()}),ot.addEventListener("blur",()=>lt(!0)),ot.addEventListener("click",pt=>pt.stopPropagation())};Ht.querySelector(".dt-folder-new").addEventListener("click",()=>{let v=Math.random().toString(36).slice(2,10);L=[{id:v,name:"Untitled folder",pages:[]},...L],V.add(v),Rn(),Dt(),Xn(v,!0)});let ee=null,mn=()=>{ee?.remove(),ee=null};Tt.addEventListener("toggle",()=>{Tt.open||mn()});function Da(v){mn();let I=v.closest(".dt-folder").dataset.folder,K=L.find(Mt=>Mt.id===I);ee=document.createElement("div"),ee.className="dt-folder-menu",ee.setAttribute("role","menu"),ee.innerHTML=`<button type="button" role="menuitem" data-do="rename">${es}<span>Rename</span></button><button type="button" role="menuitem" data-do="add">${$t('<path d="M10 4.5v11M4.5 10h11" />',13)}<span>Add pages\u2026</span></button><button type="button" role="menuitem" data-do="sub">${se(!1)}<span>New folder inside</span></button>`+(K.pages.length||L.some(Mt=>Mt.parent===K.id)?`<button type="button" role="menuitem" data-do="ungroup">${$t('<rect x="3" y="3" width="6" height="6" rx="1.5" /><rect x="11" y="11" width="6" height="6" rx="1.5" /><path d="M11 5.5h3.5V9M9 14.5H5.5V11" />',13)}<span>Ungroup</span></button>`:"")+`<button type="button" role="menuitem" data-do="delete" class="is-danger">${ts}<span>Delete folder</span></button>`,Tt.append(ee);let W=v.getBoundingClientRect(),ot=Tt.getBoundingClientRect();ee.style.left=`${W.right-ot.left+6}px`,ee.style.top=`${W.top-ot.top-4}px`,ee.addEventListener("click",Mt=>{let lt=Mt.target.closest("[data-do]")?.dataset.do;if(!lt)return;if(mn(),lt==="rename")return Xn(I,!1);if(lt==="add")return So(I,v);if(lt==="sub"){let Be=Math.random().toString(36).slice(2,10);return L=[{id:Be,name:"Untitled folder",pages:[],parent:I},...L],V.add(I),V.add(Be),U.delete(I),Rn(),Dt(),Xn(Be,!0)}let pt=L;Ae(vs(L,new Set([I]))),qe(lt==="delete"?`Deleted \u201C${K.name}\u201D`:`Ungrouped \u201C${K.name}\u201D`,()=>Ae(pt))})}function So(v,I){mn();let K=L.find(lt=>lt.id===v),W=n.pages.filter(lt=>!K.pages.includes(lt.route));ee=document.createElement("div"),ee.className="dt-folder-menu dt-folder-add",ee.setAttribute("role","menu"),ee.innerHTML=`<p class="dt-pages-group">Add to ${f(K.name)}</p>`+(W.length?W.map(lt=>`<button type="button" role="menuitem" data-route="${f(lt.route)}"><span>${f(lt.label)}</span><em class="dt-pages-route">${f(lt.route)}</em></button>`).join(""):'<p class="dt-pages-none">Every page is in it</p>'),Tt.append(ee);let ot=I.getBoundingClientRect(),Mt=Tt.getBoundingClientRect();ee.style.left=`${ot.right-Mt.left+6}px`,ee.style.top=`${ot.top-Mt.top-4}px`,ee.addEventListener("click",lt=>{let pt=lt.target.closest("[data-route]");if(!pt)return;let Be=pt.dataset.route;pt.remove(),V.add(v),U.delete(v),Rn(),Ae(L.map(Mn=>({...Mn,pages:Mn.id===v?[...Mn.pages.filter(vr=>vr!==Be),Be]:Mn.pages.filter(vr=>vr!==Be)})))})}let Jn="";G.addEventListener("dragstart",v=>{let I=v.target.closest("li[data-route], li.dt-folder");I&&(v.stopPropagation(),Jn=I.dataset.route??`f:${I.dataset.folder}`,I.classList.add("is-dragging"),v.dataTransfer?.setData("text/plain",Jn),v.dataTransfer&&(v.dataTransfer.effectAllowed="move"))});let Vs=v=>v?.closest?.(".dt-folder:not(.dt-folder--site)")??null;G.addEventListener("dragover",v=>{if(!Jn)return;v.preventDefault();let I=Vs(v.target);for(let K of G.querySelectorAll(".is-drop"))K!==I&&K.classList.remove("is-drop");I?.classList.add("is-drop"),G.classList.toggle("is-drop-out",!I)}),G.addEventListener("dragend",()=>{Jn="",G.classList.remove("is-drop-out");for(let v of G.querySelectorAll(".is-drop, .is-dragging"))v.classList.remove("is-drop","is-dragging")});let To=v=>requestAnimationFrame(()=>{let I=G.querySelector(v);I&&(qo(I,"glow"),I.scrollIntoView({block:"nearest",behavior:ns()?"smooth":"auto"}))});G.addEventListener("drop",v=>{v.preventDefault();let I=Jn,K=Vs(v.target)?.dataset.folder;if(!I)return;if(I.startsWith("f:")){let Mt=I.slice(2);if(K===Mt||K&&pn(K,Mt))return;let lt=L.map(pt=>pt.id===Mt?{...pt,parent:K??null}:pt).map(({parent:pt,...Be})=>pt?{...Be,parent:pt}:Be);K&&(V.add(K),U.delete(K),Rn()),JSON.stringify(lt)!==JSON.stringify(L)&&(Ae(lt),To(`[data-folder="${CSS.escape(Mt)}"] > .dt-folder-row`));return}let W=L.map(Mt=>({...Mt,pages:Mt.pages.filter(lt=>lt!==I)})),ot=K?W.find(Mt=>Mt.id===K):null;ot&&(ot.pages.push(I),V.add(ot.id),Rn()),JSON.stringify(W)!==JSON.stringify(L)&&(Ae(W),To(`li[data-route="${CSS.escape(I)}"] > a`))})}un.querySelector("summary").addEventListener("click",()=>pr(!1));let Un=ve.querySelector(".dt-vision"),Ds=Un.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 tc=document.createElement("style");document.head.append(tc);let Fs=document.createElement("div");Fs.className="dt-seeing",Fs.hidden=!0,ve.append(Fs);let js="",Ba=t=>{js=t;let e=Mo.find(s=>s.id===t)??Mo[0];tc.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",Un.toggleAttribute("data-on",!!t),Fs.hidden=!t,Fs.innerHTML=t?`${$t('<path d="M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z" /><circle cx="10" cy="10" r="2.5" />',13)}<span>Seeing as ${e.name}</span><kbd>Esc</kbd><button type="button" aria-label="See the page as it is">${$t('<path d="M5 5l10 10M15 5 5 15" />',12)}</button>`:""};Fs.addEventListener("click",t=>{t.target.closest("button")&&Ba("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!js||t.defaultPrevented||gc(t.target)||(Ba(""),t.preventDefault())});let Ra=null,fr=0,br=0,ec=()=>{let t=Math.round((Date.now()-fr)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},nc=t=>{if(t==="none"){Ds.className="dt-sheet dt-vision-sheet dt-vision-list",Ds.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===js}"><span>${s.name}</span>${s.id===js?$t('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${s.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;Ds.className="dt-sheet dt-vision-sheet",Ds.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 ${ec()}`}</span><span class="dt-vision-grow"></span><span>Click one to see the page that way</span><button type="button" class="dt-icon dt-vision-again" data-tip="Take a new snapshot" aria-label="Take a new snapshot">${$t('<path d="M3.5 10a6.5 6.5 0 1 0 2-4.7M3.5 3.5v3.6h3.6" />')}</button></div><div class="dt-vision-grid">${Mo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===js}"><span class="dt-vision-thumb">${Ra&&t==="ready"?`<img src="${Ra}" 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;nc("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(`${Js}, .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||(Ra=s,fr=Date.now(),nc(s?"ready":"none"))},sc=0,oc=0,ac=()=>{clearTimeout(oc),oc=window.setTimeout(yr,400)};Un.addEventListener("toggle",()=>{if(clearInterval(sc),removeEventListener("scroll",ac,!0),!Un.open){br++;return}yr(),addEventListener("scroll",ac,!0),sc=window.setInterval(()=>{let t=Ds.querySelector(".dt-vision-ago");t&&Ra&&fr&&(t.textContent=`snapshot \xB7 ${ec()}`)},1e3)}),Ds.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void yr();let s=e.closest("[data-vision]");s&&(Ba(s.dataset.vision??""),Un.open=!1)});let ko=ve.querySelector(".dt-custom"),Pa=ko.querySelector(".dt-custom-sheet"),ic="dt-hidden-tools",rc="dt-new-seen",lc=["contrast","vision"],dc=()=>{let t=(o,a,i)=>{let l=ve.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=[...Kt.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:as,name:"Device menu"}];return[...n.client?[]:[{group:"Inspect",tools:e.filter(o=>!!o)}],{group:"Devices",tools:s}]},cc=t=>(ct.getItem(t)??"").split(",").filter(Boolean),Yn=new Set(cc(ic)),uc=()=>{for(let{tools:e}of dc())for(let s of e)s.el.toggleAttribute("data-off",Yn.has(s.id));Object.entries(rt).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&Y("")},zm=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",pc=()=>{let t=cc(rc);Pa.innerHTML=dc().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)}">${zm(a.el)}<span>${f(a.name)}</span>${lc.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>`};Pa.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){ko.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(ic,[...Yn].join(",")),uc(),pc(),Pa.querySelector(s?`[data-tool="${s.dataset.tool}"]`:".dt-custom-done")?.focus())}),ko.addEventListener("toggle",()=>{ko.open?(pc(),Pa.querySelector(".dt-custom-tile")?.focus()):z(rc,lc.join(","))}),uc(),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 xo("grid");un.open=!1,s==="custom"&&(ko.open=!0),s==="hide"&&qs.click()});let on=t=>()=>ve.querySelector(t)?.click(),mc=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},Ia=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:on(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:on(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:on(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>_i(!bn)},{group:"Threads",code:"Slash",hint:"/",label:"Search pages",run:()=>{let t=document.querySelector(".dt-strip"),e=t?.querySelector(".dt-pages");if(t&&!t.hidden&&e){D(),gr(!0),e.open=!0;return}document.querySelector(".dt-history")?.hasAttribute("hidden")&&on(".dt-history-btn")(),it.hasAttribute("data-collapsed")&&xa(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Team / client",run:()=>Ie?void Id():Bs(Ve==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Rs.hidden||po(cn.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:on(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:on(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:on(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:on(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:on(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:on(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{Un.open=!Un.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:on(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:on(".dt-studio-btn")}]:[],...Kt.slice(0,9).map((t,e)=>({group:"Breakpoints",code:`Digit${e+1}`,hint:String(e+1),label:t.dataset.tip??t.title,el:`.dt-bp[data-bp="${t.dataset.bp}"]`,run:()=>t.click()})),{group:"View",code:"KeyD",hint:"D",label:"Devices",run:()=>{as.open=!as.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:mc(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:mc(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>qs.click()},{group:"View",code:"Backslash",shift:!0,hint:"\u21E7\\",label:"Top strip",run:()=>gr(!Qd())},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=un.open&&!Yd.hidden;un.open=!t,pr(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),hc=(t,e)=>Ia.find(s=>s.code===t&&!s.shift==!e&&!(s.el&&ve.querySelector(s.el)?.closest("[data-off]"))&&!(s.code==="KeyD"&&as.hasAttribute("data-off"))),gc=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 Ia){let a=o.el&&ve.querySelector(o.el);a&&(a.dataset.tip=`${a.dataset.tip??o.label} \xB7 ${o.hint}`,a.setAttribute("aria-keyshortcuts",o.hint.startsWith("\u21E7")?`Shift+${o.hint.slice(1)}`:o.hint))}let t=(o,a)=>`<div class="dt-key-row"><span>${f(o)}</span><kbd>${f(a)}</kbd></div>`,e=(o,a)=>`<div class="dt-keys-col"><p class="dt-keys-group">${o}</p>${a}</div>`,s=[...new Set(Ia.map(o=>o.group))].map(o=>e(o,Ia.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||gc(o.composedPath()[0]??o.target))return;let a=hc(o.code,o.shiftKey);a&&setTimeout(()=>{o.defaultPrevented||(k?parent.postMessage({dt:!0,key:[o.code,o.shiftKey]},location.origin):a.run())})}),k){let o=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",o,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&o()})}}if(!k){Ud(ct.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>ve.setAttribute("data-ready",""))),_d.restore(),ft(ct.getItem(It)==="1");let t=ct.getItem(Et);t&&t in rt&&Y(t),sn(ct.getItem(Vr)==="1"&&xt!=="/connect")}let fc=()=>{try{let t=JSON.parse(ct.getItem(Tn)||"null");ze=(t?.parked??[]).filter(s=>Zs(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};if(t?.draft&&e(t.draft.selector)?(B=t.draft,!Ut&&!k&&sn(!0)):Zs(t?.draft)&&ze.push(t.draft),t?.reply?.text&&(Pe=t.reply.text,fn=X=t.reply.for??null),X==null)try{X=Number(sessionStorage.getItem(`nm-open:${Tn}`))||null,sessionStorage.removeItem(`nm-open:${Tn}`)}catch{}(B||ze.length||Pe)&&Z()}catch{ct.removeItem(Tn)}};fc();let bc=()=>setTimeout(()=>{let t=F(location.pathname);t!==xt&&(clearTimeout(Ko),to(),xt=t,k&&parent.postMessage({dt:!0,route:t},location.origin),Tn=Ur(),B=null,ze=[],Pe="",fn=null,X=null,te=null,j=[],Ut&&!k&&sn(!1),$(),fc(),Zi(),gs())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),bc()}}addEventListener("popstate",bc);try{let t=JSON.parse(ct.getItem(Is)||"null");t?.project===vd&&t.body?(Xi=t.body.version??"",Ji(t.body),go=""):t&&ct.removeItem(Is)}catch{ct.removeItem(Is)}r.then(async t=>{t.status===200&&Ji(await t.json(),!c)},()=>{}).then(()=>!c&&(Qe||bn)?gs(!0):void 0).then(Ea.resume),document.addEventListener("visibilitychange",()=>{document.hidden||fs()}),addEventListener("focus",fs),addEventListener("notemend:changed",()=>{k||fs()});let Oa=!1,ys=null,yc=()=>{if(!(k||ae.via||!("EventSource"in window))){if(document.hidden){ys?.close(),ys=null,Oa=!1;return}ys||(ys=new EventSource("/__devbar/events"),ys.onopen=()=>{Oa=!0},ys.onerror=()=>{Oa=!1},ys.onmessage=t=>{t.data!==go&&fs()})}};yc(),document.addEventListener("visibilitychange",yc);let vc=0,Vm=()=>{k||ae.via||document.hidden||Date.now()-vc<1e4||(vc=Date.now(),fetch("/__devbar/active",{method:"POST",keepalive:!0}).catch(()=>{}))};for(let t of["pointerdown","pointermove","keydown","wheel"])addEventListener(t,Vm,{passive:!0,capture:!0});let Gm=0;k||setInterval(()=>{(!(ae.live||Oa)||++Gm%6===0)&&fs()},2e4),setInterval(()=>{!document.hidden&&j.some(t=>hn(t))&&Z()},3e4),k&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Tu(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let r=HTMLDialogElement.prototype,c=r.showModal,h=null,g=null,y=()=>{if(h){g?.disconnect(),g=null;for(let w of n)document.body.append(w);try{h.hidePopover()}catch{}h.remove(),h=null}},T=()=>{y();let w=document.querySelector("dialog:modal");w&&C(w)},C=w=>{y(),h=document.createElement("div"),h.className="dt-host",h.setAttribute("popover","manual"),h.append(...n),w.append(h);try{h.showPopover()}catch{}w.addEventListener("close",T,{once:!0}),g=new MutationObserver(()=>{w.isConnected||T()}),g.observe(document.documentElement,{childList:!0,subtree:!0})};r.showModal=function(){c.call(this),this.isConnected&&C(this)}}function jr(n,r,c,h=""){let g=document.createElement("div");g.className="nm-ask",g.setAttribute("style",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px","padding:6px 6px 6px 12px","background:#0e0d0c","color:#f2efec","border:1px solid rgba(255,255,255,.09)","border-radius:999px","box-shadow:0 10px 34px rgba(0,0,0,.5)","font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif"].join(";"));let y=document.createElement(n?"a":"span");y instanceof HTMLAnchorElement&&n&&(y.href=n,y.target=c,h&&(y.rel=h)),y.className="nm-ask-go",y.textContent=r;let T=document.createElement("style");return T.textContent=`.nm-ask{transition:border-color 120ms cubic-bezier(.22,1,.36,1)}
|
|
342
342
|
.nm-ask:has(a.nm-ask-go:hover){border-color:rgba(255,255,255,.14)!important}
|
|
343
343
|
.nm-ask-go{transition:background-color 120ms cubic-bezier(.22,1,.36,1),transform 120ms cubic-bezier(.22,1,.36,1)}
|
|
344
344
|
a.nm-ask-go:hover{background:#ff7a33!important}
|
|
345
345
|
a.nm-ask-go:active{background:#d94d00!important;transform:translateY(1px)}
|
|
346
346
|
.nm-ask-go:focus-visible{outline:2px solid #ff6a1a;outline-offset:2px}
|
|
347
|
-
@media (prefers-reduced-motion:reduce){.nm-ask,.nm-ask-go{transition:none}}`,y.setAttribute("style",`display:inline-flex;align-items:center;height:28px;padding:0 12px;border-radius:999px;background:${n?"#ff6a1a;color:#1a0800":"rgba(255,255,255,.08);color:#f2efec"};font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif;letter-spacing:-.01em;text-decoration:none;cursor:${n?"pointer":"default"}`),g.innerHTML='<svg role="img" aria-label="Notemend" width="16" height="16" viewBox="0 4 100 100" style="display:block;flex:none"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',g.append(
|
|
347
|
+
@media (prefers-reduced-motion:reduce){.nm-ask,.nm-ask-go{transition:none}}`,y.setAttribute("style",`display:inline-flex;align-items:center;height:28px;padding:0 12px;border-radius:999px;background:${n?"#ff6a1a;color:#1a0800":"rgba(255,255,255,.08);color:#f2efec"};font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif;letter-spacing:-.01em;text-decoration:none;cursor:${n?"pointer":"default"}`),g.innerHTML='<svg role="img" aria-label="Notemend" width="16" height="16" viewBox="0 4 100 100" style="display:block;flex:none"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',g.append(T,y),document.body.append(g),{pill:g,link:y}}function Au(n){let r=window;if(r.__notemend)return;r.__notemend=!0,su(g=>g.includes("/__devbar/")||!!ae.base&&g.startsWith(ae.base)),Zt.ready=new Promise(g=>{if(!("__next_f"in self))return g();let y=0,T=()=>Object.keys(document.documentElement).some(C=>C.startsWith("__reactFiber$"))||++y>330?g():setTimeout(T,30);T()}),Zt.toggle("dt-in-frame",Gs),Zt.toggle("dt-strip-on",!Gs&&ct.getItem("dt-strip-pin")==="1");let c=wc(),h=ie(c);Kc().then(async g=>{await n,Zt.set("--dt-z",String(g.zIndex));let y=g.client?g.brand?.color:null;if(y&&/^#[0-9a-f]{6}$/i.test(y)){let[A,k,z]=[1,3,5].map(dt=>parseInt(y.slice(dt,dt+2),16)/255);Zt.set("--dt-accent",y),Zt.set("--dt-accent-ink",.2126*A+.7152*k+.0722*z>.55?"#000000":"#ffffff")}Jc(g);let T="",C=()=>{let A=document.body.currentCSSZoom??1,k=A>0&&Math.abs(A-1)>.001?String(1/A):"1";k!==T&&(T=k,Zt.set("--dt-unzoom",k))};C();let w=new MutationObserver(C);for(let A of[document.documentElement,document.body])w.observe(A,{attributes:!0,attributeFilter:["style","class"]});addEventListener("resize",C),Su(g,h,c==="comments"),gu(),Tu([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-strip-grip",".dt-tipbox"].map(A=>document.querySelector(A)).filter(A=>!!A))}).catch(g=>{console.warn("[notemend] not started:",g),Zt.toggle("dt-strip-on",!1);let y=window.__notemendHosted;ae.via&&String(g).includes("config 403")&&y?.ask&&(ae.refused=!0,y.ask("You\u2019re not in this project \u2014 sign in as someone else")),!ae.via&&String(g).includes("config 401")&&Hh(String(g.said??""))})}function Hh(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:r}=jr("/__devbar/signin","Sign in to comment","notemend-signin"),c=0;r.addEventListener("click",()=>{clearInterval(c),c=window.setInterval(async()=>{let h=await fetch("/__devbar/signin?code=1").then(g=>g.json()).catch(()=>null);if(h?.done){clearInterval(c),location.reload();return}h?.code&&(r.textContent=`Allow code ${h.code} in the cabinet tab`)},1500)})}var Hu=window,Es=class extends Error{},Cu=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}`)),Nu=(n,r)=>{let c=Cu(n);return[...Cu(r)].some(h=>!c.has(h))};function Ch(n,r){let c=[],h=n.firstChild;for(let g of r){let y=h;for(;y&&!(y.nodeName===g.nodeName&&(!(g instanceof Element)||!g.id||y.id===g.id));)y=y.nextSibling;c.push(y),y&&(h=y.nextSibling)}return c}function Nh(n,r,c){for(let{name:h,value:g}of c.attributes){let y=r.getAttribute(h);if(y!==g)if(h==="class"&&y!=null){let T=new Set(y.split(/\s+/)),C=new Set(g.split(/\s+/));for(let w of T)w&&!C.has(w)&&n.classList.remove(w);for(let w of C)w&&!T.has(w)&&n.classList.add(w)}else n.setAttribute(h,g)}for(let{name:h}of r.attributes)c.hasAttribute(h)||n.removeAttribute(h)}function Bu(n,r,c){if(r.isEqualNode(c))return;if(r.nodeType!==Node.ELEMENT_NODE||c.nodeType!==Node.ELEMENT_NODE||r.nodeName!==c.nodeName||c.nodeName==="ASTRO-ISLAND"){if(r.nodeType===Node.TEXT_NODE&&c.nodeType===Node.TEXT_NODE){n.nodeValue=c.nodeValue;return}n.parentNode.replaceChild(document.importNode(c,!0),n);return}Nh(n,r,c);let h=[...r.childNodes],g=[...c.childNodes],y=Ch(n,h),T=0,C=0;for(;T<h.length&&T<g.length&&h[T].isEqualNode(g[T]);)T++;for(;C<h.length-T&&C<g.length-T&&h[h.length-1-C].isEqualNode(g[g.length-1-C]);)C++;let w=h.slice(T,h.length-C),A=g.slice(T,g.length-C);if(w.length===A.length&&w.every((J,tt)=>J.nodeName===A[tt].nodeName)){w.forEach((J,tt)=>{let F=y[T+tt];if(!F)throw new Es;Bu(F,J,A[tt])});return}let k=C?y[h.length-C]:null,z=T?y[T-1]:null;if(C&&!k||T&&!z)throw new Es;for(let J of y.slice(T,h.length-C))J?.parentNode?.removeChild(J);let dt=k??(z?z.nextSibling:n.firstChild);for(let J of A)n.insertBefore(document.importNode(J,!0),dt)}function Bh(n){for(let r of n.head.querySelectorAll("style, link[rel=stylesheet]")){let c=r.getAttribute("data-vite-dev-id"),h=r.getAttribute("href"),g=[...document.head.querySelectorAll("style, link[rel=stylesheet]")].find(y=>c?y.getAttribute("data-vite-dev-id")===c:h?y.getAttribute("href")===h:y.textContent===r.textContent);g?c&&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 _o=null,_r=!1;function Wr(){return _o?(_r=!0,_o):(_o=(async()=>{try{let n=Hu.__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 Es;let c=new DOMParser().parseFromString(await r.text(),"text/html");if(Nu(n,c.body)||Nu(document.head,c.head))throw new Es;Bh(c),Bu(document.body,n,c.body),Hu.__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{_o=null,_r&&(_r=!1,Wr())}})(),_o)}Au();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()});
|