notemend 0.1.27 → 0.1.29
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/README.md +23 -15
- package/bin/init.mjs +23 -23
- package/bin/notemend.mjs +15 -16
- package/bin/step.mjs +1 -1
- package/hooks/hooks.json +3 -0
- package/package.json +1 -1
- package/src/client/index.js +176 -148
- package/src/client/notemend.css +1 -1
- package/src/integration.mjs +1 -1
- package/src/next.mjs +1 -1
- package/src/server/middleware.mjs +4 -4
- package/src/store/cloud.mjs +3 -3
- package/src/store/comments.mjs +3 -3
- package/src/store/thread.mjs +1 -1
- package/store.d.ts +7 -5
- package/thread.d.ts +60 -10
package/src/client/index.js
CHANGED
|
@@ -1,52 +1,62 @@
|
|
|
1
|
-
import"./notemend.css";var Dt={base:"",via:null,signed:{},live:!1,signOut:null};async function Ct(n,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<8e3&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!Dt.via){let u=window.__notemendEarly,p=!i.method||i.method==="GET"?u?.[n]:void 0;if(p){delete u[n];let v=await p;if(v)return v}return fetch(`/__devbar/${n}`,i)}let l=await Dt.via(n,i);if(l.ok&&n.startsWith("comments")&&(i.method??"GET")==="GET"){let u=await l.clone().json().catch(()=>null);u?.signed&&Object.assign(Dt.signed,u.signed)}return l}var Gi=n=>Dt.via?Dt.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Ns=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),st={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{}}};async function Yi(){let n=await Ct("config");if(!n.ok)throw new Error(`config ${n.status}`);let i=await n.json();return i.breakpoints=i.breakpoints.map(l=>({...l,max:l.max??1/0})),i}var Xi=["iPhone","Android","Foldable","Tablet","Laptop & display"],_n=[{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 md=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null;var Wn={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},_o=/^(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,gd=/^(png|jpe?g|webp|gif|webm)$/i,fd=[["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"]],Zi=n=>{let i=String(n??"").split(".").pop().toLowerCase(),l=fd.find(([,,u])=>u.split(" ").includes(i));return l?{label:l[0],color:l[1]}:{label:"FILE",color:"#717171"}},Wo=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),bd=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]])),Qi=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>bd[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),tr=n=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return i&&!_o.test(i[1])?i[1].toLowerCase():""},zn=n=>{let i=String(n??"");if(i.startsWith("data:")){let p=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!p)return null;let v=/;ext=([a-z0-9]{1,8})/i.exec(p[2])?.[1]?.toLowerCase()??Object.keys(Wn).find(k=>Wn[k]===p[1]);return v?`${/;name=([\w-]+)/.exec(p[2])?.[1]||"document"}.${v}`:null}let l=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(l))return null;let u=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(l);return u&&!gd.test(u[2])?`${u[1]||"document"}.${u[2].toLowerCase()}`:null},Se=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(l=>({...l,images:[]}))];for(let l of n.images||[]){if(md(l))continue;let u=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(l)?.[1]),p=0;i.forEach((v,k)=>{Date.parse(v.at)<=u&&(p=k)}),i[p].images.push(l)}return i.filter(l=>!l.deleted)},er=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],nr=["\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 yd=20,sr=(n,i,l)=>{let u={...n||{}},p=u[i]||[];if(!p.length&&Object.keys(u).length>=yd)return null;let v=p.includes(l)?p.filter(k=>k!==l):[...p,l];return v.length?u[i]=v:delete u[i],Object.keys(u).length?u:void 0},or=n=>n.nickname||n.name||n.email,vd=(n,i)=>{let l="@"+i.toLowerCase(),u=-1;for(let p=n.indexOf(l);p!==-1;p=n.indexOf(l,p+1))/[\p{L}\p{N}_.-]/u.test(n[p+l.length]??"")||(u=p);return u};var wd=/https?:\/\/[^\s<>"']+/g,Ji=n=>{let i=n.filter(Boolean).pop();try{return i?decodeURIComponent(i):""}catch{return i}},$d=n=>{let i;try{i=new URL(n)}catch{return{label:String(n),kind:"link"}}let l=i.hostname.replace(/^www\./,""),u=i.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(l))return{label:u[2]?`Figma \xB7 ${Ji([u[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(l==="github.com"&&u.length){let[v,k,H,f]=u;return{label:`GitHub \xB7 ${k??v}${/^(pull|issues)$/.test(H??"")&&f?` #${f}`:""}`,kind:H==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(l))return{label:"Loom",kind:"link"};let p=Ji(u);return{label:p?`${l} \xB7 ${p.length>32?p.slice(0,31)+"\u2026":p}`:l,kind:"link"}},zo=n=>{let i=String(n??""),l=[],u=0;for(let p of i.matchAll(wd)){let v=p[0].replace(/[.,;:!?)\]]+$/,"");p.index>u&&l.push(i.slice(u,p.index)),l.push({url:v,...$d(v)}),u=p.index+v.length}return u<i.length&&l.push(i.slice(u)),l},ar=n=>zo(n).map(i=>typeof i=="string"?i:i.label).join(""),xd={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},vn=n=>xd[n]||(n?"AI agent":"Claude"),Bs="3.6 3.6 10.8 10.8",Rs="M10.116 9H13.883M9.966 9.558L12.222 10.86M9.558 9.966L11.441 13.228M9 10.116V12.72M8.442 9.966L6.559 13.228M8.034 9.558L5.778 10.86M7.884 9H4.118M8.034 8.442L5.778 7.14M8.442 8.034L6.559 4.772M9 7.884V5.28M9.558 8.034L11.441 4.772M9.966 8.442L12.222 7.14",Ps=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,At=n=>n==="claude"||Ps(n)!=null;var Ed=["new","approved","progress","review","waiting"],Jt=n=>Ed.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":At(n?.assignee)?"approved":"new",Mt=n=>n?.client===!0||n?.shared===!0;var Os=()=>[{assignee:"claude",handle:"Claude",owner:null}],Vo=(n,i=[])=>{let l=String(n||"").toLowerCase(),u=null,p=-1;for(let v of Os()){let k=vd(l,v.handle);k>p&&(p=k,u=v.assignee)}return u};var Md=2*36e5,Re=(n,i=Date.now())=>n?.working&&n.status!=="done"&&i-Date.parse(n.working.at)<Md?n.working:null,Is=(n,i,l=Date.now())=>{let u=String(n?.by||n?.byName||"").toLowerCase();if(!u||i==="done")return null;let p=i==="claude"||At(n.assignee),v=Ds(n)?"":p?Re(n,l)?.by||n.doneFor||n.handedBy||Ps(n.assignee)||u:n.assignee||"";return{writer:u,taker:String(v).toLowerCase(),claude:p}},kd=n=>/@guest\.notemend\.com$/i.test(String(n||"")),Ds=n=>kd(n.by)&&!n.approvedBy,se=(n,i=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":At(n.assignee)?"done":null;if(Ds(n))return"held";if(!At(n.assignee))return null;let l=Se(n),u=l[l.length-1];return l.length>1&&u.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(u.at))?"asks":Re(n,i)?"working":n.working?"stuck":Jt(n)==="approved"?"queued":null};var ir=Rs.split("M").filter(Boolean).map(n=>{let i=n.match(/[\d.]+/g).map(Number),[l,u]=/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(l-9,9-u)+2*Math.PI)%(2*Math.PI)}}).sort((n,i)=>n.a-i.a).map(n=>n.d);var rr=(n,i)=>{if(n.archivedAt)return!0;if(!i||n.status!=="done"||n.doneBy==="claude")return!1;let l=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(u=>!u.deleted).map(u=>Date.parse(u.at||"")||0));return!!l&&Date.now()-l>i*864e5};var g=n=>n.replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]),Je=n=>n?new Date(n).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Ze='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M8 6V4.2h4V6M6.6 6l.55 9.8h5.7L13.4 6"/></svg>',qt='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.8 10.4 8.2 13.8l7-7.6" stroke-linejoin="round"/></svg>',Vn='<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>',Pe='<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>',lr='<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>',dr='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',Te='<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>',Wt=n=>`<svg viewBox="${Bs}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${Rs}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Ko=(n,i)=>`<svg viewBox="${Bs}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${ir.map((l,u)=>`<path d="${l}" stroke-width="1.15" stroke-linecap="round"${u<i?"":' class="is-off"'}/>`).join("")}</svg>`,yt=(n,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${n}</svg>`;function cr(n){let i=location.pathname.replace(/\/$/,"")||"/",l=n.client?' style="display:none"':"",u=n.breakpoints.map(y=>["new","progress","review","waiting","done"].map(R=>`<b data-bp="${g(y.id)}" data-state="${R}" hidden>${yt(y.icon,11)}<i></i></b>`).join("")).join(""),p=n.groups.map(y=>`<li class="dt-pages-group">${g(y)}</li>`+n.pages.filter(R=>R.group===y).map(R=>`<li><a href="${/^\/(?![\/\\])/.test(R.route)?g(R.route):"#"}"${R.route===i?' aria-current="page"':""}><span class="dt-menu-label">${g(R.label)}</span><em class="dt-pages-n" hidden>${u}</em></a></li>`).join("")).join(""),v=[...new Set(n.devices.map(y=>y.group))].map(y=>`<p class="dt-devices-group">${g(y)}</p>`+n.devices.filter(R=>R.group===y).map(R=>`<button type="button" data-device="${g(R.id)}" aria-pressed="false"${R.note?` title="${g(R.note)}"`:""}><span class="dt-menu-label">${g(R.label)}</span><em>${R.w}×${R.h}</em></button>`).join("")).join(""),k=Xi.map(y=>`<p class="dt-devices-group">${g(y)}</p>`+_n.filter(R=>R.group===y).map(R=>`<button type="button" data-emu="${g(R.id)}" aria-pressed="false"><span class="dt-menu-label">${g(R.label)}</span><em>${R.w}×${R.h}</em></button>`).join("")).join(""),H=n.breakpoints.map(y=>`<button class="dt-icon dt-bp" type="button" data-bp="${g(y.id)}" aria-pressed="false" title="${g(y.label)}">${yt(y.icon,16)}</button>`).join(""),f=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),$="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
1
|
+
import"./notemend.css";var Xt={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function Qt(s,r={}){if(r.method&&r.method!=="GET"&&typeof r.body=="string"&&r.body.length<8e3&&r.keepalive===void 0&&(r={...r,keepalive:!0}),!Xt.via){let m=window.__notemendEarly,g=!r.method||r.method==="GET"?m?.[s]:void 0;if(g){delete m[s];let $=await g;if($)return $}return fetch(`/__devbar/${s}`,r)}let c=await Xt.via(s,r);if(c.ok&&s.startsWith("comments")&&(r.method??"GET")==="GET"){let m=await c.json().catch(()=>{});m?.signed&&Object.assign(Xt.signed,m.signed),c.json=()=>m===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(m)}return c}var mi=s=>Xt.via?Xt.signed[s]??"":`/__devbar/image?name=${encodeURIComponent(s)}`,Is=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),st={getItem:s=>{try{return localStorage.getItem(s)}catch{return null}},setItem:(s,r)=>{try{localStorage.setItem(s,r)}catch{}},removeItem:s=>{try{localStorage.removeItem(s)}catch{}}},id=()=>st.getItem("dt-resolved")==="0"&&st.getItem("dt-archived")!=="1"?"comments?open=1":"comments";var cd=s=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(s))?.[1]??null,ud=s=>{let r={};for(let c of s?.images||[]){let m=cd(c);m&&(r[m]=c)}return r},Os={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},gi=/^(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,wp=/^(png|jpe?g|webp|gif|webm)$/i,Fo=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,Ot=(s,r)=>{let c=String(s??"");if(c.length<=r)return c;let m="";if(Fo)for(let{segment:g}of Fo.segment(c)){if(m.length+g.length>r)break;m+=g}else for(let g of c){if(m.length+g.length>r)break;m+=g}return m},$p=[["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"]],pd=s=>{let r=String(s??"").split(".").pop().toLowerCase(),c=$p.find(([,,m])=>m.split(" ").includes(r));return c?{label:c[0],color:c[1]}:{label:"FILE",color:"#717171"}},fi=s=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(s??"").split("?")[0]),xp=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((s,r)=>[s,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][r]])),hd=s=>String(s??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,r=>xp[r]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),md=s=>{let r=/\.([a-z0-9]{1,8})$/i.exec(String(s??""));return r&&!gi.test(r[1])?r[1].toLowerCase():""};var Ds=s=>{let r=String(s??"");if(r.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(r);if(!g)return null;let $=/;ext=([a-z0-9]{1,8})/i.exec(g[2])?.[1]?.toLowerCase()??Object.keys(Os).find(T=>Os[T]===g[1]);return $?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${$}`:null}let c=r.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(c))return null;let m=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(c);return m&&!wp.test(m[2])?`${m[1]||"document"}.${m[2].toLowerCase()}`:null},vn=s=>{let r=[{author:"you",text:s.text,at:s.createdAt,by:s.by,byName:s.byName,images:[],...s.reactions?{reactions:s.reactions}:{}},...s.note?[{author:"claude",text:s.note,at:s.updatedAt,images:[]}]:[],...(s.replies||[]).map(c=>({...c,images:[]}))];for(let c of s.images||[]){if(cd(c))continue;let m=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(c)?.[1]?.slice(0,13)),g=0;r.forEach(($,T)=>{Date.parse($.at)<=m&&(g=T)}),r[g].images.push(c)}return r.filter(c=>!c.deleted)},gd=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],fd=["\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 Ep=20,bd=(s,r,c)=>{let m={...s||{}},g=m[r]||[];if(!g.length&&Object.keys(m).length>=Ep)return null;let $=g.includes(c)?g.filter(T=>T!==c):[...g,c];return $.length?m[r]=$:delete m[r],Object.keys(m).length?m:void 0},yd=s=>s.nickname||s.name||s.email,bi="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",Mp=new RegExp("^"+bi,"u"),kp=(s,r)=>{let c="@"+r.toLowerCase(),m=-1;for(let g=s.indexOf(c);g!==-1;g=s.indexOf(c,g+1))Mp.test(s.slice(g+c.length))&&(m=g);return m};var Lp=/https?:\/\/[^\s<>"']+/g,rd=s=>{let r=s.filter(Boolean).pop();try{return r?decodeURIComponent(r):""}catch{return r}},Sp=s=>{let r;try{r=new URL(s)}catch{return{label:String(s),kind:"link"}}let c=r.hostname.replace(/^www\./,""),m=r.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(c))return{label:m[2]?`Figma \xB7 ${rd([m[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(c==="github.com"&&m.length){let[$,T,H,M]=m;return{label:`GitHub \xB7 ${T??$}${/^(pull|issues)$/.test(H??"")&&M?` #${M}`:""}`,kind:H==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(c))return{label:"Loom",kind:"link"};let g=rd(m);return{label:g?`${c} \xB7 ${g.length>32?Ot(g,31)+"\u2026":g}`:c,kind:"link"}},yi=s=>{let r=String(s??""),c=[],m=0;for(let g of r.matchAll(Lp)){let $=g[0].replace(/[.,;:!?)\]]+$/,"");g.index>m&&c.push(r.slice(m,g.index)),c.push({url:$,...Sp($)}),m=g.index+$.length}return m<r.length&&c.push(r.slice(m)),c},vd=s=>yi(s).map(r=>typeof r=="string"?r:r.label).join(""),ld={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},wd=new Map,$d=(s=[])=>{for(let r of s)r?.email&&wd.set(r.email.toLowerCase(),r.agent_name?.trim()||"")},wn=(s,r)=>r&&wd.get(String(vi(r)??r).toLowerCase())||"Agent",xd=s=>!s||s==="claude"?"via Claude Code":s==="agent"||!ld[s]?"":`via ${ld[s]}`,jo="3.6 3.6 10.8 10.8",Wo="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",vi=s=>typeof s=="string"&&s.startsWith("agent:")?s.slice(6):null,Rt=s=>s==="claude"||vi(s)!=null;var Tp=["new","approved","progress","review","waiting"],ve=s=>Tp.includes(s?.stage)?s.stage:s?.stage==="accepted"?"review":Rt(s?.assignee)?"approved":"new",Nt=s=>s?.client===!0||s?.shared===!0,Ed=(s,r,c="")=>`Duplicated from ${c?c==="you"?"your":`${c}\u2019s`:"a"} ${(r?Nt(r):!Nt(s))?"client":"studio"} thread`,Md=s=>Nt(s)?"Duplicated for the client":"Duplicated to the workspace",kd="Fixed \u2014 please check.",Ld=s=>s?.status==="done"&&!Nt(s)&&Number.isInteger(s.from?.id)?s.from.id:null;var qs=["agent","claude","codex","gemini"],Sd=()=>[{assignee:"claude",handle:"agent",owner:null}],wi=(s,r=[])=>{let c=String(s||"").toLowerCase();return qs.some(m=>kp(c,m)!==-1)?"claude":null},Td=(s,r=[],c="")=>{let m=String(s||"").replace(/^@/,"").toLowerCase();if(qs.includes(m))return"agent";let g=r.find($=>[$.name,$.nickname,$.email].some(T=>T&&T.toLowerCase()===m));return g&&c&&g.email?.toLowerCase()===c.toLowerCase()?"you":"person"};var Ap=2*36e5,Ke=(s,r=Date.now())=>s?.working&&s.status!=="done"&&r-Date.parse(s.working.at)<Ap?s.working:null;var Fs=(s,r,c=Date.now())=>{let m=String(s?.by||s?.byName||"").toLowerCase();if(!m||r==="done")return null;let g=r==="claude"||Rt(s.assignee),$=g?Ke(s,c)?.by||s.doneFor||s.handedBy||vi(s.assignee)||m:s.assignee||"";return{writer:m,taker:String($).toLowerCase(),claude:g}},$i=s=>/@guest\.notemend\.com$/i.test(String(s||"")),ne=(s,r=Date.now())=>{if(!s)return null;if(s.status==="done")return s.doneBy==="claude"?"review":Rt(s.assignee)?"done":null;if(!Rt(s.assignee))return null;let c=vn(s),m=c[c.length-1],g=Ke(s,r);return c.length>1&&m.author==="claude"&&!(s.reopenedAt&&Date.parse(s.reopenedAt)>=Date.parse(m.at))&&(!g||String(m.text??"").includes("?"))?"asks":g?g.step&&r-Date.parse(g.at)>Cp?"stuck":"working":s.working?"stuck":ve(s)==="approved"?"queued":null},Cp=10*6e4,dd=(s,r=Date.now())=>{let c=Math.floor((r-Date.parse(s??""))/6e4);return c>=1?c<60?`${c} min`:`${Math.floor(c/60)} h`:"now"},xi=(s,r=31)=>{let c=Fo?[...Fo.segment(String(s??""))].map($=>$.segment):[...String(s??"")];if(c.length<=r)return c.join("");let m=c.join("").match(/\.\w{1,8}$/)?.[0],g=m?m.length+3:0;return c.slice(0,r-1-g).join("")+"\u2026"+(g?c.slice(-g).join(""):"")},Ei=(s,r=Date.now())=>{let c=s?.status!=="done"?s?.working:null;return c?.at?{step:c.step?String(c.step):null,elapsed:dd(c.since??c.at,r),silent:dd(c.at,r),stale:!Ke(s,r)}:null};var Ad=Wo.split("M").filter(Boolean).map(s=>{let r=s.match(/[\d.]+/g).map(Number),[c,m]=/H/.test(s)?[r[2],r[1]]:/V/.test(s)?[r[0],r[2]]:[r[2],r[3]];return{d:"M"+s,a:(Math.atan2(c-9,9-m)+2*Math.PI)%(2*Math.PI)}}).sort((s,r)=>s.a-r.a).map(s=>s.d);var Cd=(s,r)=>{if(s.archivedAt)return!0;if(!r||s.status!=="done"||s.doneBy==="claude")return!1;let c=Math.max(Date.parse(s.confirmedAt||s.updatedAt||"")||0,...(s.replies||[]).filter(m=>!m.deleted).map(m=>Date.parse(m.at||"")||0));return!!c&&Date.now()-c>r*864e5},Hp=["uk","ru","en"],Hd=s=>{try{let r=new Intl.DisplayNames([s],{type:"language"}).of(s)??s;return r[0].toUpperCase()+r.slice(1)}catch{return s}},Mi=s=>{try{return new Intl.DisplayNames(["en"],{type:"language"}).of(s)??s}catch{return s}},_o=s=>/[іїєґІЇЄҐ]/.test(s)?"uk":/[ыэъёЫЭЪЁ]/.test(s)?"ru":/\p{Script=Cyrillic}/u.test(s)?"":/\p{L}/u.test(s)&&!/[^\p{Script=Latin}\P{L}]/u.test(s)?"en":"",Nd=(s,r="en")=>{let c=_o(s),m=r.split("-")[0].toLowerCase();return[...new Set([m,...Hp])].filter(g=>g!==c)};async function Bd(){let s=await Qt("config");if(!s.ok)throw Object.assign(new Error(`config ${s.status}`),{said:s.status===401?await s.text().catch(()=>""):""});let r=await s.json();return r.breakpoints=r.breakpoints.map(c=>({...c,max:c.max??1/0})),$d(r.team),r}var Rd=["iPhone","Android","Foldable","Tablet","Laptop & display"],js=[{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 b=s=>s.replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r]),nn=s=>s?new Date(s).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Ws=(s,r=c=>new Date(c).toLocaleDateString("en",{day:"numeric",month:"short"}))=>new Date(s).toDateString()===new Date().toDateString()?new Date(s).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):r(s),In='<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>',re='<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>',On='<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>',sn='<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>',on='<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>',zo='<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>',Go='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',an='<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>',we=s=>`<svg viewBox="${jo}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude"><path d="${Wo}" stroke-width="1.15" stroke-linecap="round"/></svg>`,ki=(s,r)=>`<svg viewBox="${jo}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude dt-claude--fill">${Ad.map((c,m)=>`<path d="${c}" stroke-width="1.15" stroke-linecap="round"${m<r?"":' class="is-off"'}/>`).join("")}</svg>`,$t=(s,r=15)=>`<svg viewBox="0 0 20 20" width="${r}" height="${r}" aria-hidden="true">${s}</svg>`;function Pd(s){let r=location.pathname.replace(/\/$/,"")||"/",c=s.client?' style="display:none"':"",m=s.breakpoints.map(j=>["new","progress","review","waiting","done"].map(I=>`<b data-bp="${b(j.id)}" data-state="${I}" hidden>${$t(j.icon,11)}<i></i></b>`).join("")).join(""),g=s.groups.map(j=>`<li class="dt-pages-group">${b(j)}</li>`+s.pages.filter(I=>I.group===j).map(I=>`<li><a href="${/^\/(?![\/\\])/.test(I.route)?b(I.route):"#"}"${I.route===r?' aria-current="page"':""}><span class="dt-menu-label">${b(I.label)}</span><em class="dt-pages-n" hidden>${m}</em></a></li>`).join("")).join(""),$=[...new Set(s.devices.map(j=>j.group))].map(j=>`<p class="dt-devices-group">${b(j)}</p>`+s.devices.filter(I=>I.group===j).map(I=>`<button type="button" data-device="${b(I.id)}" aria-pressed="false"${I.note?` title="${b(I.note)}"`:""}><span class="dt-menu-label">${b(I.label)}</span><em>${I.w}×${I.h}</em></button>`).join("")).join(""),T=Rd.map(j=>`<p class="dt-devices-group">${b(j)}</p>`+js.filter(I=>I.group===j).map(I=>`<button type="button" data-emu="${b(I.id)}" aria-pressed="false"><span class="dt-menu-label">${b(I.label)}</span><em>${I.w}×${I.h}</em></button>`).join("")).join(""),H=s.breakpoints.map(j=>`<button class="dt-icon dt-bp" type="button" data-bp="${b(j.id)}" aria-pressed="false" title="${b(j.label)}">${$t(j.icon,16)}</button>`).join(""),M="Real screens, the browser around the page. A thread goes to its width\u2019s breakpoint.",k="The page at the device\u2019s size. A thread goes to its breakpoint.",x=Array.from({length:s.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),F="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
2
2
|
<!-- One bar, bottom-centre: pages | inspectors | comments | breakpoints \xB7 devices. -->
|
|
3
3
|
<div class="devtools">
|
|
4
|
-
${
|
|
4
|
+
${s.client&&s.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(s.brand.logo)?`<img class="dt-brand" src="${b(s.brand.logo)}" alt="" />`:""}
|
|
5
5
|
<div class="dt-group dt-group--menus">
|
|
6
6
|
<details class="dt-pages" name="dt-menu">
|
|
7
7
|
<summary aria-label="Pages" title="Pages">
|
|
8
|
-
${
|
|
9
|
-
<span class="dt-pages-name">${
|
|
8
|
+
${$t('<rect x="4.5" y="2.5" width="11" height="15" rx="1.5" /><path d="M7.5 6.6h5M7.5 10h5M7.5 13.4h3" />')}
|
|
9
|
+
<span class="dt-pages-name">${b(r)}</span>
|
|
10
10
|
</summary>
|
|
11
|
-
<ul>${
|
|
11
|
+
<ul>${g}</ul>
|
|
12
12
|
</details>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
<div class="dt-group" role="group" aria-label="Inspect"${
|
|
15
|
+
<div class="dt-group" role="group" aria-label="Inspect"${c}>
|
|
16
16
|
<button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
|
|
17
|
-
${
|
|
17
|
+
${$t('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
|
|
18
18
|
</button>
|
|
19
19
|
<button class="dt-icon dt-pad-btn" type="button" aria-pressed="false" title="Spacing">
|
|
20
|
-
${
|
|
20
|
+
${$t('<rect x="2.5" y="2.5" width="15" height="15" rx="1.5" /><rect x="6.5" y="6.5" width="7" height="7" rx="1" stroke-dasharray="2 2" />')}
|
|
21
21
|
</button>
|
|
22
22
|
<button class="dt-icon dt-size-btn" type="button" aria-pressed="false" title="Size">
|
|
23
|
-
${
|
|
23
|
+
${$t('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
|
|
24
24
|
</button>
|
|
25
25
|
<button class="dt-icon dt-type-btn" type="button" aria-pressed="false" title="Typography">
|
|
26
|
-
${
|
|
26
|
+
${$t('<path d="M2.5 15.5 6.5 5l4 10.5M3.9 12.6h5.2M15 4.5v11M13.2 6.3 15 4.5l1.8 1.8M13.2 13.7 15 15.5l1.8-1.8" />')}
|
|
27
27
|
</button>
|
|
28
28
|
<button class="dt-icon dt-color-btn" type="button" aria-pressed="false" title="Color">
|
|
29
|
-
${
|
|
29
|
+
${$t('<path d="M10 3c2.9 3.4 4.6 5.9 4.6 8.2a4.6 4.6 0 0 1-9.2 0C5.4 8.9 7.1 6.4 10 3z" />')}
|
|
30
30
|
</button>
|
|
31
|
+
<button class="dt-icon dt-contrast-btn" type="button" aria-pressed="false" title="Contrast">
|
|
32
|
+
${$t('<circle cx="10" cy="10" r="7" /><path d="M10 3a7 7 0 0 1 0 14z" fill="currentColor" />')}
|
|
33
|
+
</button>
|
|
34
|
+
<!-- Figma \xABBar \xB7 Vision \xB7 4 Vision sheet\xBB: the view as six kinds of eyes, filled in by run.ts -->
|
|
35
|
+
<details class="dt-vision" name="dt-menu">
|
|
36
|
+
<summary class="dt-icon" title="Vision">
|
|
37
|
+
${$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" />')}
|
|
38
|
+
</summary>
|
|
39
|
+
<div class="dt-sheet dt-vision-sheet"></div>
|
|
40
|
+
</details>
|
|
31
41
|
<button class="dt-icon dt-border-btn" type="button" aria-pressed="false" title="Border & radius">
|
|
32
|
-
${
|
|
42
|
+
${$t('<path d="M3.5 16.5V8a4.5 4.5 0 0 1 4.5-4.5h8.5" /><path d="M16.5 8v8.5H8" stroke-dasharray="1.6 2.2" />')}
|
|
33
43
|
</button>
|
|
34
|
-
<button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${
|
|
35
|
-
${
|
|
44
|
+
<button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${s.sanity?"":" hidden"}>
|
|
45
|
+
${$t('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
|
|
36
46
|
</button>
|
|
37
47
|
</div>
|
|
38
48
|
|
|
39
|
-
<div class="dt-group" role="group" aria-label="
|
|
49
|
+
<div class="dt-group" role="group" aria-label="Threads">
|
|
40
50
|
<button class="dt-icon dt-notes-btn" type="button" aria-pressed="false" title="Comment">
|
|
41
|
-
${
|
|
51
|
+
${$t('<path d="M4 3.5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9.5L5.5 16.5v-3H4a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2z" stroke-linejoin="round" />')}
|
|
42
52
|
<span class="dt-notes-count" hidden></span>
|
|
43
53
|
</button>
|
|
44
54
|
<button class="dt-icon dt-history-btn" type="button" aria-pressed="false" title="Panel">
|
|
45
|
-
${
|
|
55
|
+
${$t('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
|
|
46
56
|
</button>
|
|
47
57
|
<!-- resolved pins on or off: the switch is in the comments panel's head now; this one stays for the code that reads it -->
|
|
48
58
|
<button class="dt-icon dt-resolved-btn" type="button" aria-pressed="true" title="Resolved" hidden style="display:none">
|
|
49
|
-
${
|
|
59
|
+
${$t('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
|
|
50
60
|
</button>
|
|
51
61
|
</div>
|
|
52
62
|
|
|
@@ -55,22 +65,20 @@ import"./notemend.css";var Dt={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
55
65
|
<div class="dt-group dt-group--menus">
|
|
56
66
|
<details class="dt-devices" name="dt-menu">
|
|
57
67
|
<summary title="Devices">
|
|
58
|
-
${
|
|
68
|
+
${$t('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
|
|
59
69
|
<span class="dt-devices-name">Device</span>
|
|
60
70
|
</summary>
|
|
61
71
|
<div class="dt-devices-menu">
|
|
62
72
|
<div class="dt-menu-tabs" role="tablist" aria-label="Device lists">
|
|
63
|
-
<button type="button" role="tab" data-tab="preview" aria-selected="true">Preview</button>
|
|
64
|
-
<button type="button" role="tab" data-tab="devtools" aria-selected="false">DevTools</button>
|
|
73
|
+
<button type="button" role="tab" data-tab="preview" aria-selected="true" aria-description="${M}" data-tip="${M}">Preview</button>
|
|
74
|
+
<button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${k}" data-tip="${k}">DevTools</button>
|
|
65
75
|
</div>
|
|
66
76
|
<div class="dt-menu-panel" role="tabpanel" data-panel="preview">
|
|
67
|
-
|
|
68
|
-
${v}
|
|
77
|
+
${$}
|
|
69
78
|
</div>
|
|
70
79
|
<div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
|
|
71
|
-
<p class="dt-menu-note">Opens the canvas at the device's size. Comments go to its breakpoint.</p>
|
|
72
80
|
<input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
|
|
73
|
-
${
|
|
81
|
+
${T}
|
|
74
82
|
</div>
|
|
75
83
|
</div>
|
|
76
84
|
</details>
|
|
@@ -78,50 +86,56 @@ import"./notemend.css";var Dt={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
78
86
|
the table that runs them), hiding the bar, signing out of a hosted bar -->
|
|
79
87
|
<details class="dt-keys" name="dt-menu">
|
|
80
88
|
<summary class="dt-icon" title="Settings">
|
|
81
|
-
${
|
|
89
|
+
${$t('<g transform="scale(0.8333)" stroke-width="1.8"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /><circle cx="12" cy="12" r="3" /></g>')}
|
|
82
90
|
</summary>
|
|
83
91
|
<div class="dt-keys-menu">
|
|
84
92
|
<div class="dt-set-main">
|
|
85
|
-
${
|
|
86
|
-
|
|
87
|
-
<button type="button" data-set="
|
|
93
|
+
${s.me?.email?`<p class="dt-set-who">Signed in as<b>${b(s.me.email)}</b></p><hr>`:""}
|
|
94
|
+
${s.client?"":`<button type="button" data-set="grid">${$t('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />',14)}<span>Grid</span><em class="dt-set-hint">Auto</em>${$t('<path d="M8 5l5 5-5 5" />',12)}</button>`}
|
|
95
|
+
<button type="button" data-set="custom">${$t('<rect x="3" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="3" y="11.5" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="11.5" width="5.5" height="5.5" rx="1.5" stroke-dasharray="2 1.6" />',14)}<span>Customize the bar</span></button>
|
|
96
|
+
<button type="button" data-set="keys"${s.shortcuts?"":" hidden"}>${$t('<rect x="2" y="5" width="16" height="10" rx="2" /><path d="M5.5 8.5h.01M8.5 8.5h.01M11.5 8.5h.01M14.5 8.5h.01M6.5 12h7" />',14)}<span>Keyboard shortcuts</span><kbd>?</kbd></button>
|
|
97
|
+
<button type="button" data-set="hide">${$t('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${s.shortcuts?"<kbd>\\</kbd>":""}</button>
|
|
88
98
|
<hr data-set-out hidden>
|
|
89
|
-
<button type="button" data-set="out" hidden>${
|
|
99
|
+
<button type="button" data-set="out" hidden>${$t('<path d="M8 3.5H5a1.5 1.5 0 0 0-1.5 1.5v10A1.5 1.5 0 0 0 5 16.5h3M12.5 13.5 16 10l-3.5-3.5M16 10H8" />',14)}<span>Sign out</span></button>
|
|
90
100
|
</div>
|
|
101
|
+
<!-- the project's grid (Figma: Settings menu \u203A Pane=Grid \xB7 Custom / Grid \xB7 Auto), drawn by run.ts -->
|
|
102
|
+
<div class="dt-set-grid" hidden></div>
|
|
91
103
|
<div class="dt-set-keys" hidden>
|
|
92
|
-
<button type="button" class="dt-set-back" data-set="back">${
|
|
104
|
+
<button type="button" class="dt-set-back" data-set="back">${$t('<path d="M15.5 10h-11M9 5.5 4.5 10 9 14.5" />',13)}<span>Keyboard shortcuts</span></button>
|
|
93
105
|
<hr>
|
|
94
106
|
<div class="dt-keys-list"></div>
|
|
95
107
|
</div>
|
|
96
108
|
</div>
|
|
97
109
|
</details>
|
|
110
|
+
<!-- Figma \xABCustomize \xB7 5 Square wells\xBB: which extra tools the bar shows; opened from Settings, drawn by run.ts -->
|
|
111
|
+
<details class="dt-custom" name="dt-menu">
|
|
112
|
+
<summary hidden></summary>
|
|
113
|
+
<div class="dt-sheet dt-custom-sheet" role="dialog" aria-label="Customize the bar"></div>
|
|
114
|
+
</details>
|
|
98
115
|
</div>
|
|
99
|
-
<!-- the two spaces: the studio's threads and its clients' \u2014
|
|
100
|
-
(
|
|
101
|
-
sliding under the one in use, each with its open count as a badge (M switches). The studio's only. -->
|
|
116
|
+
<!-- the two spaces: the studio's threads and its clients' \u2014 two words in the bar's first well, the one
|
|
117
|
+
in use raised (M switches). No counts on it (Figma \xABBar \xB7 Idle\xBB). The studio's only. -->
|
|
102
118
|
<span class="dt-space" role="radiogroup" aria-label="Whose threads" hidden>
|
|
103
|
-
<
|
|
104
|
-
<button type="button" class="dt-space-btn" data-space="
|
|
105
|
-
<button type="button" class="dt-space-btn" data-space="clients" role="radio" aria-checked="false" data-tip="Clients \xB7 M">${yt('<circle cx="9" cy="7" r="3" /><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M14.5 12.5l1.2 1.2 2.3-2.4" />',15)}<b class="dt-space-n" hidden>0</b></button>
|
|
119
|
+
<button type="button" class="dt-space-btn" data-space="studio" role="radio" aria-checked="true" data-tip="Workspace \xB7 M"><span>Workspace</span></button>
|
|
120
|
+
<button type="button" class="dt-space-btn" data-space="clients" role="radio" aria-checked="false" data-tip="Clients \xB7 M"><span>Clients</span></button>
|
|
106
121
|
</span>
|
|
107
|
-
<!-- pin filters: a
|
|
108
|
-
|
|
109
|
-
rest dim (F). The studio's only, as the pill is. -->
|
|
122
|
+
<!-- pin filters: a funnel after the spaces pill, in the page's well (Figma \xABBar \xB7 Idle\xBB: icon/bar/filter) \u2014
|
|
123
|
+
its menu has the counts, filters the pins and the rest dim (F). The studio's only, as the pill is. -->
|
|
110
124
|
<span class="dt-pinf" hidden>
|
|
111
|
-
<button type="button" class="dt-pinf-btn" aria-haspopup="menu" aria-expanded="false" data-tip="Show pins \xB7 F"><svg viewBox="0 0
|
|
125
|
+
<button type="button" class="dt-pinf-btn" aria-haspopup="menu" aria-expanded="false" data-tip="Show pins \xB7 F"><svg viewBox="0 0 15 15" width="15" height="15" aria-hidden="true"><path d="M3 4.5h9M4.875 7.5h5.25M6.75 10.5h1.5"/></svg></button>
|
|
112
126
|
<div class="dt-pinf-menu" role="menu" aria-label="Show pins" hidden></div>
|
|
113
127
|
</span>
|
|
114
|
-
<!-- push to Claude: one
|
|
115
|
-
long press picks pages and threads. Beside turbo, the studio's only, shown while there is any. -->
|
|
116
|
-
<span class="dt-push" hidden${
|
|
117
|
-
<button class="dt-push-all" type="button" aria-label="Push to
|
|
128
|
+
<!-- push to Claude: one square tool in the agent's well \u2014 a press sends what waits for Claude; a right
|
|
129
|
+
click or a long press picks pages and threads. Beside turbo, the studio's only, shown while there is any. -->
|
|
130
|
+
<span class="dt-push" hidden${s.client?' style="display:none"':""}>
|
|
131
|
+
<button class="dt-push-all" type="button" aria-label="Push to the agent"><svg viewBox="${jo}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${Wo}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
|
|
118
132
|
>
|
|
119
|
-
<div class="dt-push-menu" hidden role="dialog" aria-label="What goes to
|
|
133
|
+
<div class="dt-push-menu" hidden role="dialog" aria-label="What goes to the agent"></div>
|
|
120
134
|
</span>
|
|
121
|
-
<!-- turbo:
|
|
135
|
+
<!-- turbo: a bolt in the agent's well beside push, always there for the studio \u2014 lit while
|
|
122
136
|
an agent session takes comments, grey when none is listening or it is paused here -->
|
|
123
|
-
<button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${
|
|
124
|
-
<span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${
|
|
137
|
+
<button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${s.client?" hidden":""}>
|
|
138
|
+
<span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${$t('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
|
|
125
139
|
</button>
|
|
126
140
|
</div>
|
|
127
141
|
|
|
@@ -133,14 +147,14 @@ import"./notemend.css";var Dt={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
133
147
|
|
|
134
148
|
<div class="dt-frame" hidden role="region" aria-label="Breakpoint preview">
|
|
135
149
|
<div class="dt-stage">
|
|
136
|
-
<span class="dt-frame-handle" data-edge="l" title="${
|
|
150
|
+
<span class="dt-frame-handle" data-edge="l" title="${F}"></span>
|
|
137
151
|
<div class="dt-device">
|
|
138
152
|
<div class="dt-shell"></div>
|
|
139
153
|
<iframe title="Breakpoint preview"></iframe>
|
|
140
154
|
<div class="dt-chrome" data-at="top"></div>
|
|
141
155
|
<div class="dt-chrome" data-at="bottom"></div>
|
|
142
156
|
</div>
|
|
143
|
-
<span class="dt-frame-handle" data-edge="r" title="${
|
|
157
|
+
<span class="dt-frame-handle" data-edge="r" title="${F}"></span>
|
|
144
158
|
</div>
|
|
145
159
|
<div class="dt-ruler"></div>
|
|
146
160
|
<span class="dt-frame-size"></span>
|
|
@@ -152,139 +166,153 @@ import"./notemend.css";var Dt={base:"",via:null,signed:{},live:!1,signOut:null};
|
|
|
152
166
|
</button>
|
|
153
167
|
</div>
|
|
154
168
|
|
|
155
|
-
<aside class="dt-history" hidden aria-label="
|
|
169
|
+
<aside class="dt-history" hidden aria-label="Threads"></aside>
|
|
170
|
+
<!-- this page's pins are on another width and none here: the way to them (UX 30.10 \u203A 02) -->
|
|
171
|
+
<button type="button" class="dt-elsewhere" hidden></button>
|
|
156
172
|
<div class="dt-notes-hi" hidden aria-hidden="true"><span class="dt-hi-box"></span><span class="dt-hi-tag"></span></div>
|
|
157
|
-
<div class="dt-notes-overlay" hidden role="region" aria-label="
|
|
173
|
+
<div class="dt-notes-overlay" hidden role="region" aria-label="Threads on this page"></div>
|
|
158
174
|
<!-- the clients' space: a frame round the page and its name in a notch at the top, with \xD7 back to the studio's -->
|
|
159
175
|
<div class="dt-client-frame" aria-hidden="true"></div>
|
|
160
|
-
<div class="dt-client-tab">${
|
|
161
|
-
<div class="dt-grid-overlay" hidden
|
|
162
|
-
<div class="
|
|
163
|
-
|
|
176
|
+
<div class="dt-client-tab" inert aria-hidden="true">${$t('<circle cx="9" cy="7" r="3" /><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M14.5 12.5l1.2 1.2 2.3-2.4" />',13)}<span>Clients space</span><button type="button" class="dt-client-x" aria-label="Back to the workspace" data-tip="Back to the workspace \xB7 M">${$t('<path d="M6 6l8 8M14 6l-8 8" />',10)}</button></div>
|
|
177
|
+
<div class="dt-grid-overlay" hidden>
|
|
178
|
+
<div class="dt-grid-chip"><span></span><button type="button" hidden>Edit</button></div>
|
|
179
|
+
<div class="${b(s.grid.container)} dt-overlay-container" aria-hidden="true">
|
|
180
|
+
<div class="${b(s.grid.grid)} dt-overlay-grid">${x}</div>
|
|
164
181
|
</div>
|
|
165
182
|
</div>
|
|
166
183
|
<div class="dt-pad-overlay" hidden aria-hidden="true"></div>
|
|
167
|
-
`)}var ur=[{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"/>'}],wn=(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>`,Qe=n=>ur.find(i=>i.id===n)||ur[0];var bt=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",pr={open:"Open",done:"Resolved",claude:"To check"};var Ft={ready:Promise.resolve(),toggle:(n,i)=>{Ft.ready.then(()=>document.documentElement.classList.toggle(n,i))},set:(n,i)=>{Ft.ready.then(()=>document.documentElement.style.setProperty(n,i))}};var Ld=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,hr=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(Ld,"$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 $n=[],Uo=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)}},Sd=/ResizeObserver loop (completed with undelivered notifications|limit exceeded)/,tn=(n,i)=>{if(Sd.test(i))return;let l=hr(i.replace(/\s+/g," ").trim()).slice(0,500),u=$n[$n.length-1];if(u&&u.kind===n&&u.text.replace(/ ×\d+$/,"")===l){let p=Number(/ ×(\d+)$/.exec(u.text)?.[1]??1)+1;u.text=`${l} \xD7${p}`,u.at=new Date().toISOString();return}$n.push({at:new Date().toISOString(),kind:n,text:l}),$n.length>50&&$n.shift()},mr=!1;function gr(n){if(mr||typeof window>"u")return;mr=!0;let i=console.error;console.error=(...p)=>{tn("console",p.map(Uo).join(" ")),i.apply(console,p)},addEventListener("error",p=>{if(p instanceof ErrorEvent)return tn("error",`${p.message}${p.filename?` (${p.filename}:${p.lineno})`:""}`);let v=p.target,k=v?.src||v?.href;k&&!n(k)&&tn("network",`${v.tagName?.toLowerCase()} ${k} did not load`)},!0),addEventListener("unhandledrejection",p=>tn("rejection",Uo(p.reason)));let l=window.fetch;window.fetch=async(p,v)=>{let k=typeof p=="string"?p:p instanceof URL?p.href:p.url,H=(v?.method||(p instanceof Request?p.method:"GET")).toUpperCase();try{let f=await l.call(window,p,v);return f.status>=400&&!n(k)&&tn("network",`${H} ${k} \u2192 ${f.status}`),f}catch(f){throw!n(k)&&f?.name!=="AbortError"&&tn("network",`${H} ${k} \u2192 no answer (${Uo(f)})`),f}};let u=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(p,v,...k){return this._nm=`${p.toUpperCase()} ${String(v)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(v))||tn("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),u.call(this,p,v,...k)}}var fr=(n=Date.now())=>$n.filter(i=>n-Date.parse(i.at)<10*6e4).slice(-20);function br(n){let i=w=>{let m=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,M=w/m;return Math.round(M*10)%10===0?String(Math.round(M)):M.toFixed(1)},l=(w,m,M,B,D,z="p")=>{if(M<=0||B<=0)return"";let U=D!==""?`<span class="dt-pad-chip dt-pad-chip--${z}" style="left:${w+M/2}px;top:${m+B/2}px">${D}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${z}" style="left:${w}px;top:${m}px;width:${M}px;height:${B}px"></span>${U}`},u=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],p="button, a, input, select, textarea, label, [role='button']",v=w=>{let m=w;for(let M=0;m&&M<6;M++,m=m.parentElement){if(m.matches(p))return m;let B=getComputedStyle(m);if(u.some(D=>parseFloat(B[D])>=2))return m}return w},k=(w,m)=>{let M=parseFloat(m.columnGap)||0,B=parseFloat(m.rowGap)||0;if(!(m.display.includes("flex")||m.display.includes("grid"))||!M&&!B)return"";let D=[...w.children].map(U=>U.getBoundingClientRect()).filter(U=>U.width||U.height),z="";for(let U=1;U<D.length;U++){let tt=D[U-1],X=D[U];if(M&&X.left>=tt.right-1){let at=Math.max(tt.top,X.top);z+=l(tt.right,at,X.left-tt.right,Math.min(tt.bottom,X.bottom)-at,i(M),"g")}else if(B&&X.top>=tt.bottom-1){let at=Math.min(tt.left,X.left);z+=l(at,tt.bottom,Math.max(tt.right,X.right)-at,X.top-tt.bottom,i(B),"g")}}return z},H=w=>`<span class="dt-pad-outline" style="left:${w.left}px;top:${w.top}px;width:${w.width}px;height:${w.height}px"></span>`,f=(w,m,M="")=>`<span class="dt-pad-tag" style="left:${m.left}px;top:${Math.max(2,m.top-22)}px">${w.tagName.toLowerCase()+(w.classList[0]?"."+w.classList[0]:"")}${M}</span>`,$=w=>{let m=w.getBoundingClientRect(),M=getComputedStyle(w),B=parseFloat(M.paddingTop),D=parseFloat(M.paddingRight),z=parseFloat(M.paddingBottom),U=parseFloat(M.paddingLeft),tt=H(m);tt+=l(m.left,m.top,m.width,B,B>=2?i(B):""),tt+=l(m.left,m.bottom-z,m.width,z,z>=2?i(z):""),tt+=l(m.left,m.top+B,U,m.height-B-z,U>=2?i(U):""),tt+=l(m.right-D,m.top+B,D,m.height-B-z,D>=2?i(D):"");let X=parseFloat(M.marginTop),at=parseFloat(M.marginRight),ct=parseFloat(M.marginBottom),kt=parseFloat(M.marginLeft);tt+=l(m.left,m.top-X,m.width,X,X>=2?i(X):"","m"),tt+=l(m.left,m.bottom,m.width,ct,ct>=2?i(ct):"","m"),tt+=l(m.left-kt,m.top,kt,m.height,kt>=2?i(kt):"","m"),tt+=l(m.right,m.top,at,m.height,at>=2?i(at):"","m"),tt+=k(w,M);let Nt=parseFloat(M.columnGap)||0,Bt=parseFloat(M.rowGap)||0,sn=(M.display.includes("flex")||M.display.includes("grid"))&&(Nt||Bt)?` \xB7 gap ${i(Nt)}${Bt&&Bt!==Nt?"/"+i(Bt):""}`:"",fe="",Kt=w.parentElement;if(w.matches(p)&&Kt){let vt=getComputedStyle(Kt);tt+=k(Kt,vt);let Oe=parseFloat(vt.columnGap)||parseFloat(vt.rowGap)||0;fe=` \xB7 ${i(m.width)}\xD7${i(m.height)}${Oe&&(vt.display.includes("flex")||vt.display.includes("grid"))?` \xB7 gap ${i(Oe)} in its row`:""}`}n.innerHTML=tt+f(w,m,sn+fe)},y=w=>{let m=w.getBoundingClientRect();n.innerHTML=H(m)+`<span class="dt-pad-chip" style="left:${m.left+m.width/2}px;top:${m.top+m.height/2}px">${i(m.width)} \xD7 ${i(m.height)}</span>`+f(w,m)},R=w=>{let m=(w.match(/[\d.]+/g)||[]).map(Number);if(m.length<3)return w;let M="#"+m.slice(0,3).map(B=>Math.round(B).toString(16).padStart(2,"0")).join("");return m[3]!==void 0&&m[3]<1?`${M} \xB7 ${Math.round(m[3]*100)}%`:M},Q=null,_=()=>{if(Q)return Q;let w=getComputedStyle(document.documentElement),m=document.createElement("span");m.style.display="none",document.body.append(m);let M=[];for(let B of Array.from(w)){if(!B.startsWith("--"))continue;let D=w.getPropertyValue(B).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(D))continue;m.style.color="rgb(1, 2, 3)",m.style.color=D;let z=getComputedStyle(m).color;z&&z!=="rgb(1, 2, 3)"&&M.push([z,B])}return m.remove(),M.sort((B,D)=>B[1].length-D[1].length),Q=M,M},Y=w=>_().find(([m])=>m===w)?.[1]??"",ht=null,P=()=>{if(ht)return ht;let w=[],m=M=>{for(let B of Array.from(M))B instanceof CSSStyleRule?B.style.cssText.includes("var(--")&&w.push({sel:B.selectorText,style:B.style}):B instanceof CSSMediaRule?matchMedia(B.conditionText).matches&&m(B.cssRules):"cssRules"in B&&m(B.cssRules)};for(let M of Array.from(document.styleSheets))try{m(M.cssRules)}catch{}return ht=w},A={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(w=>[`border-${w}-color`,[`border-${w}-color`,"border-color",`border-${w}`,"border"]]))},W=(w,m)=>{let M=A[m]??[m],B=m==="color";for(let D=w;D;D=B?D.parentElement:null){let z=X=>M.map(at=>/var\(\s*(--[\w-]+)/.exec(X.getPropertyValue(at))?.[1]).find(Boolean),U=D instanceof HTMLElement?z(D.style):void 0;if(U)return U;let tt="";for(let X of P()){let at=!1;try{at=D.matches(X.sel)}catch{}at&&(tt=z(X.style)||tt)}if(tt)return tt;if(B&&D.parentElement&&getComputedStyle(D).color!==getComputedStyle(D.parentElement).color)break}return""},L=(w,m,M)=>{let B=W(w,m);if(B)return`<b class="dt-var">${B}</b> <em>${R(M)}</em>`;let D=Y(M);return D?`<span title="Same value as ${D}; not written with it">\u2248 ${D}</span> <em>${R(M)}</em>`:R(M)},j=w=>`<i class="dt-type-sw" style="background:${w}"></i>`,I={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},rt=w=>(w.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),ot=(w,m)=>w.slice(0,3).map((M,B)=>M*w[3]+m[B]*(1-w[3])).concat([1]),Pt=w=>{let m=[];for(let M=w;M;M=M.parentElement){let B=getComputedStyle(M);if(B.backgroundImage!=="none")return null;let D=rt(B.backgroundColor);if(D[3]>0&&(m.push(D),D[3]>=1))break}return m.reduceRight((M,B)=>ot(B,M),[255,255,255,1])},Ht=w=>{let[m,M,B]=w.slice(0,3).map(D=>(D/=255,D<=.03928?D/12.92:((D+.055)/1.055)**2.4));return .2126*m+.7152*M+.0722*B},St=(w,m,M)=>{let B=Pt(w);if(!B)return["Contrast","<em>on an image</em>"];let D=ot(rt(m.color),B),[z,U]=[Ht(D),Ht(B)].sort((ct,kt)=>kt-ct),tt=(z+.05)/(U+.05),X=M>=24||M>=18.66&&Number(m.fontWeight)>=700,at=tt>=(X?4.5:7)?"AAA":tt>=(X?3:4.5)?"AA":"fails AA";return["Contrast",`${tt.toFixed(2)}:1 <em class="${at==="fails AA"?"dt-type-bad":""}">${at}${X?" \xB7 large":""}</em>`]},zt=w=>{let m=w.getBoundingClientRect(),M=getComputedStyle(w),B=parseFloat(M.fontSize),D=M.lineHeight==="normal"?0:parseFloat(M.lineHeight),z=parseFloat(M.letterSpacing)||0,U=kt=>`${(kt*100).toFixed(1).replace(/\.0$/,"")}%`,tt=[["Font",M.fontFamily.split(",")[0].replace(/["']/g,"")+(M.fontStyle!=="normal"?` ${M.fontStyle}`:"")],["Weight",`${I[M.fontWeight]??""} <em>${M.fontWeight}</em>`],["Size",`${i(B)}px`],["Line",D?`${U(D/B)} <em>${i(D)}px</em>`:"normal"],["Letter",z?`${U(z/B)} <em>${z.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",j(M.color)+L(w,"color",M.color)],St(w,M,B)],at=m.bottom+150<innerHeight?m.bottom+8:Math.max(8,m.top-158),ct=Math.min(Math.max(8,m.left),innerWidth-210);n.innerHTML=H(m)+f(w,m)+`<div class="dt-type-card" style="left:${ct}px;top:${at}px">${tt.map(([kt,Nt])=>`<span class="dt-type-row"><b>${kt}</b><span>${Nt}</span></span>`).join("")}</div>`},E=w=>w.every(m=>m===w[0])?w[0]:w[1]===w[3]&&w[0]===w[2]?`${w[0]} ${w[1]}`:w.join(" "),pt=w=>/^rgba\(.*,\s*0\)$|^transparent$/.test(w),wt=(w,m,M,B="")=>{let D=16+M.length*18,U=m.bottom+D+12<innerHeight?m.bottom+8:Math.max(8,m.top-D-8),tt=Math.min(Math.max(8,m.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${m.left}px;top:${m.top}px;width:${m.width}px;height:${m.height}px${B?`;border-radius:${B}`:""}"></span>`+f(w,m)+`<div class="dt-type-card dt-style-card" style="left:${tt}px;top:${U}px">${M.map(([X,at])=>`<span class="dt-type-row"><b>${X}</b><span>${at}</span></span>`).join("")}</div>`};return{spacer:v,drawPads:$,drawSize:y,drawType:zt,drawColor:w=>{let m=getComputedStyle(w),M=[];m.backgroundImage!=="none"&&M.push(["Fill",`<em>${/gradient/.test(m.backgroundImage)?"gradient":"image"}</em>`]),pt(m.backgroundColor)||M.push(["Fill",j(m.backgroundColor)+L(w,"background-color",m.backgroundColor)]),w.textContent?.trim()&&M.push(["Text",j(m.color)+L(w,"color",m.color)]),Number(m.opacity)<1&&M.push(["Opacity",`${Math.round(Number(m.opacity)*100)}%`]),M.length||M.push(["Color","<em>no fill or text</em>"]),wt(w,w.getBoundingClientRect(),M)},drawBorder:w=>{let m=getComputedStyle(w),M=[],B=["top","right","bottom","left"],D=B.map(U=>parseFloat(m.getPropertyValue(`border-${U}-width`))||0);if(D.some(U=>U>0)){let U=B.filter((X,at)=>D[at]>0);M.push(["Width",`${E(D.map(i))} <em>${m.getPropertyValue(`border-${U[0]}-style`)}</em>`]);let tt=U.map(X=>m.getPropertyValue(`border-${X}-color`));U.forEach((X,at)=>{at&&tt[at]===tt[0]||M.push([at?`\u21B3 ${X}`:"Color",j(tt[at])+L(w,`border-${X}-color`,tt[at])])})}else M.push(["Width","<em>none</em>"]);let z=["top-left","top-right","bottom-right","bottom-left"].map(U=>{let[tt,X=tt]=m.getPropertyValue(`border-${U}-radius`).split(" "),at=ct=>ct.endsWith("%")?ct:i(parseFloat(ct)||0);return tt===X?at(tt):`${at(tt)}/${at(X)}`});M.push(["Radius",E(z)]),wt(w,w.getBoundingClientRect(),M,m.borderRadius)}}}var Rt=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),Kn=(n,i,l=!1)=>{for(let u=i*4;;u*=4){let p=l?Rt(n.slice(0,u)).replace(/\s+/g," "):Rt(n.slice(0,u));if(p.length>=i||u>=n.length)return p.slice(0,i)}},yr='[class^="dt-"],[class*=" dt-"],.devtools',qs=n=>{let i=n;for(;i.parentElement&&i.parentElement!==document.body;)i=i.parentElement;return i.parentElement===document.body&&i.matches(yr)};function vr(){let n=(P,A)=>P?[...P.children].filter(W=>W.tagName.toUpperCase()===A.toUpperCase()&&!(P===document.body&&W.matches(yr))):[],i=P=>{let A=[],W=P;for(;W&&W.tagName!=="HTML"&&A.length<8;){if(W.id){A.unshift("#"+CSS.escape(W.id));break}let L=W.parentElement,j=W.tagName.toLowerCase(),I=n(L,W.tagName),rt=L===document.body&&I.length>1?[...W.classList].find(ot=>/^[\w-]+$/.test(ot)&&I.filter(Pt=>Pt.classList.contains(ot)).length===1):void 0;A.unshift(rt?`${j}.${rt}`:I.length>1?`${j}:nth-of-type(${I.indexOf(W)+1})`:j),W=L}return A.join(">")},l=P=>{let A=P.split(">"),W=null;for(let[L,j]of A.entries()){if(j.startsWith("#")){if(L)return null;W=document.querySelector(j);continue}let I=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec(j);if(!I)return document.querySelector(P);if(!W){if(I[1]!=="body"||I[2]||I[3])return document.querySelector(P);W=document.body;continue}let rt=n(W,I[1].toUpperCase());if(W=(I[2]?rt.find(ot=>ot.classList.contains(I[2])):rt[I[3]?Number(I[3])-1:0])??null,!W)return null}return W},u=P=>P.replace(/\s+/g," ").trim(),p=(P,A)=>!A||u(Kn(P.textContent||"",60))===u(A),v=(P,A)=>[P||"*",...(A||[]).map(W=>"."+CSS.escape(W))].join(""),k=P=>{try{return[...document.querySelectorAll(v(P.tag,P.classes))].filter(A=>!qs(A))}catch{return[]}},f=P=>{let A=P.textContent||"",W=null;for(let L=P.parentElement,j=0;L&&L!==document.body&&j<4;L=L.parentElement,j++){let I=L.textContent||"";if(I===A)continue;let rt=Kn(I,80,!0);if(rt&&(rt!==Kn(A,80,!0)||(W??=Rt(A).replace(/\s+/g," "),Rt(I).replace(/\s+/g," ")!==W)))return rt}return""},$=P=>f(P),y=(P,A)=>!A||f(P).startsWith(A),R=P=>{let A=null;try{A=l(P.selector)}catch{A=null}if(A&&qs(A)&&(A=null),A&&p(A,P.label)&&y(A,P.ctx))return A;let W=k(P),L=Rt(P.label)?W.filter(I=>p(I,P.label)):[],j=L.find(I=>y(I,P.ctx))??W.find(I=>P.ctx&&y(I,P.ctx)&&!Rt(P.label));return j||(Rt(P.label)?A&&!P.ctx&&p(A,P.label)?A:L.length===1?L[0]:null:A||(P.nth!=null?W[P.nth]??null:null))},Q=P=>{let A=null;for(let W=P,L=P.parentElement;L&&L!==document.body&&getComputedStyle(W).position!=="fixed";W=L,L=L.parentElement){let j=getComputedStyle(L);if(j.overflowX==="visible"&&j.overflowY==="visible")continue;let I=L.getBoundingClientRect();A=A?{l:Math.max(A.l,I.left),t:Math.max(A.t,I.top),r:Math.min(A.r,I.right),b:Math.min(A.b,I.bottom)}:{l:I.left,t:I.top,r:I.right,b:I.bottom}}return A},_=P=>{let A=P.getBoundingClientRect();return(A.width>0||A.height>0)&&(!P.checkVisibility||P.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},Y=(P,A)=>{let W=A;for(let L=A.parentElement;L&&L!==document.body;L=L.parentElement){if(!_(L)){W=L;continue}let j=A.getBoundingClientRect();if(j.width||j.height)return{x:j.left+j.width*P.rx,y:j.top+j.height*P.ry,off:"",el:A,hidden:L,shut:W};let I=L.getBoundingClientRect();return{x:I.left,y:I.top,off:"",el:A,hidden:L,shut:W}}return null};return{cssPath:i,poolOf:k,contextOf:$,resolveEl:R,anchorOf:(P,A=R(P))=>{if(!A)return null;if(!_(A))return Y(P,A);let W=A.getBoundingClientRect(),L=W.left+W.width*P.rx,j=W.top+W.height*P.ry,I=Q(A);if(!I)return{x:L,y:j,off:"",el:A};if(I.r-I.l<18||I.b-I.t<18)return null;let rt=Math.min(Math.max(L,I.l),I.r-18),ot=Math.min(Math.max(j,I.t+18),I.b),Pt=L<I.l?"l":L>I.r-18?"r":j<I.t+18?"t":j>I.b?"b":"";return{x:rt,y:ot,off:Pt,el:A}}}}var wr=(n,i)=>`<svg class="dt-bars" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${[0,1,2,3].map(l=>`<rect x="${.5+l*3}" y="${8.5-l*2.5}" width="2" height="${3+l*2.5}" rx="0.6" fill="${i}" stroke="none" opacity="${l<n?1:.28}"/>`).join("")}</svg>`;function $r(n,i,l){let u=document.createElement("div");u.className="dt-field-menu",u.setAttribute("role","listbox"),u.hidden=!0,document.body.append(u);for(let k of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])u.addEventListener(k,H=>H.stopPropagation());let p=null,v=()=>{u.hidden=!0,p=null};for(let k of n)k.addEventListener("mousedown",H=>{let f=H.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!f){u.contains(H.target)||v();return}if(H.preventDefault(),p===f){v();return}p=f;let $=f.classList.contains("dt-more-select"),y=_=>$?_.dataset.on!=null:_.selected;u.innerHTML=[...f.options].map((_,Y)=>_.hidden?"":`${_.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${Y}" aria-selected="${y(_)}"${_.dataset.danger!=null?' class="is-danger"':""}>${_.dataset.icon?_.dataset.icon:_.dataset.initial!=null?_.dataset.face?`<img class="dt-face" src="${i(_.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${i(_.dataset.initial)}</b>`:`<i style="background:${i(_.dataset.c||"#717171")}"></i>`}<span>${i(_.text)}</span>${_.dataset.hint?`<small>${i(_.dataset.hint)}</small>`:""}${y(_)?l:""}</button>`).join("");let R=f.parentElement.getBoundingClientRect();u.style.left=`${R.left}px`,u.style.top=`${R.bottom+4}px`,u.style.minWidth=`${R.width}px`,u.hidden=!1;let Q=u.getBoundingClientRect();Q.bottom>innerHeight-8&&(u.style.top=`${R.top-4-Q.height}px`),Q.right>innerWidth-8&&(u.style.left=`${Math.max(8,R.right-Q.width)}px`)});u.addEventListener("click",k=>{let H=k.target.closest("[data-i]");if(!H||!p)return;let f=p;v(),!(f.selectedIndex===Number(H.dataset.i)&&!f.classList.contains("dt-more-select"))&&(f.selectedIndex=Number(H.dataset.i),f.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",k=>{k.key==="Escape"&&!u.hidden&&(k.stopPropagation(),v())},!0),document.addEventListener("pointerdown",k=>{!u.hidden&&!u.contains(k.target)&&!k.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&v()},!0),addEventListener("scroll",k=>{u.contains(k.target)||v()},!0)}var nn=n=>n.replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]),Z={signal:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><rect x="1" y="12" width="3.2" height="5" rx="1"/><rect x="5.6" y="9" width="3.2" height="8" rx="1"/><rect x="10.2" y="6" width="3.2" height="11" rx="1"/><rect x="14.8" y="3" width="3.2" height="14" rx="1"/></svg>',wifi:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><path d="M10 16.6 7.4 13.8a3.7 3.7 0 0 1 5.2 0z"/><path d="M4.8 11.1a7.4 7.4 0 0 1 10.4 0l-1.3 1.4a5.5 5.5 0 0 0-7.8 0z"/><path d="M2.2 8.3a11.1 11.1 0 0 1 15.6 0l-1.3 1.4a9.2 9.2 0 0 0-13 0z"/></svg>',battery:'<svg viewBox="0 0 28 14" class="dt-i dt-i--batt"><rect x="1" y="1" width="23" height="12" rx="3.5" fill="none" stroke="currentColor" stroke-opacity=".4"/><rect x="3" y="3" width="17" height="8" rx="2" fill="currentColor"/><path d="M26 5v4a2 2 0 0 0 0-4z" fill="currentColor" fill-opacity=".4"/></svg>',back:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4 6.5 10l6 6"/></svg>',fwd:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M7.5 4l6 6-6 6"/></svg>',reload:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9"/><path d="M14.2 3.2v3.2H11"/></svg>',dots:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="4.5" cy="10" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="15.5" cy="10" r="1.6"/></svg>',dotsV:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="4.5" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="10" cy="15.5" r="1.6"/></svg>',share:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 12.5V2.8M6.8 5.8 10 2.6l3.2 3.2"/><path d="M6.5 8.5H5a1.5 1.5 0 0 0-1.5 1.5v6A1.5 1.5 0 0 0 5 17.5h10a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 15 8.5h-1.5"/></svg>',plus:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 4v12M4 10h12"/></svg>',tabs:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="3" y="6" width="11" height="11" rx="2"/><path d="M6 3.5h8.5A2.5 2.5 0 0 1 17 6v8.5"/></svg>',sidebar:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="2.5" y="4" width="15" height="12" rx="2"/><path d="M8 4v12"/></svg>',lock:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="9" width="10" height="8" rx="1.8"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/></svg>',tune:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3 6.5h8M15 6.5h2M3 13.5h2M9 13.5h8"/><circle cx="13" cy="6.5" r="2"/><circle cx="7" cy="13.5" r="2"/></svg>',star:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m10 3 2.1 4.4 4.8.6-3.5 3.3.9 4.7L10 13.7 5.7 16l.9-4.7L3.1 8l4.8-.6z" stroke-linejoin="round"/></svg>',user:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="10" r="8" fill-opacity=".25"/><circle cx="10" cy="8" r="3"/><path d="M4.8 15.3a6 6 0 0 1 10.4 0 7.9 7.9 0 0 1-10.4 0z"/></svg>',recent:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5.5 5v10M10 5v10M14.5 5v10"/></svg>',home:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="4.5" y="4.5" width="11" height="11" rx="3.5"/></svg>',navBack:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4.5 7 10l5.5 5.5"/></svg>',close:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m5.5 5.5 9 9m0-9-9 9"/></svg>',winMin:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5 10h10"/></svg>',winMax:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="5" width="10" height="10" rx="1.5"/></svg>',chevUp:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m6 12 4-4 4 4"/></svg>',volume:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3.5 8v4h3l4 3.5v-11l-4 3.5z" stroke-linejoin="round"/><path d="M13.5 7.5a3.5 3.5 0 0 1 0 5"/></svg>'},Go=(n,i)=>n.toLocaleTimeString("en-US",i),Fs=n=>Go(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),Td={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 Ad(n,i,l,u,p){let v=n.w+2*i.side,k=n.h+i.top+i.bottom,H=(l-v)/2,f=`<rect class="dt-shell-screen" x="${p}" y="${i.top}" width="${n.w}" height="${n.h}" rx="${i.r}"/>`,$="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let y=(R,Q,_)=>`<rect class="dt-shell-btn" x="${R}" y="${Q}" width="4" height="${_}" rx="2"/>`;$+=n.shell==="punch"?y(H+v-1,150,70)+y(H+v-1,240,44):y(H-3,120,28)+y(H-3,170,56)+y(H-3,236,56)+y(H+v-1,190,90),$+=`<rect class="dt-shell-body" x="${H}" y="0" width="${v}" height="${k}" rx="${i.body}"/>`,$+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${v-6}" height="${k-6}" rx="${i.body-3}"/>`,n.shell==="home"&&($+=`<rect class="dt-shell-slot" x="${l/2-26}" y="44" width="52" height="6" rx="3"/>`,$+=`<circle class="dt-shell-slot" cx="${l/2-48}" cy="47" r="5"/>`,$+=`<circle class="dt-shell-homebtn" cx="${l/2}" cy="${k-46}" r="28"/>`)}else if(n.shell==="tablet")$+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${v}" height="${k}" rx="${i.body}"/>`,$+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${v-8}" height="${k-8}" rx="${i.body-4}"/>`;else if(n.shell==="monitor"){let y=Math.round(v*.1);$+=`<path class="dt-shell-stand" d="M${l/2-y/2} ${k-2}h${y}l${y*.2} 84h${-y*1.4}z"/>`,$+=`<rect class="dt-shell-stand" x="${l/2-v*.15}" y="${k+80}" width="${v*.3}" height="14" rx="7"/>`,$+=`<rect class="dt-shell-body" x="${H}" y="0" width="${v}" height="${k}" rx="${i.body}"/>`}else{let y=v+(i.extraW??0),R=(l-y)/2,Q=i.extraH??16;$+=`<path class="dt-shell-body" d="M${H} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${v-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${k}H${H}z"/>`,$+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${R} ${k}h${y}v${Q-8}a8 8 0 0 1-8 8H${R+8}a8 8 0 0 1-8-8z"/>`,$+=`<rect class="dt-shell-lip" x="${l/2-v*.07}" y="${k}" width="${v*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${l} ${u}" width="${l}" height="${u}" aria-hidden="true">${$}${f}</svg>`}var Cd={"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})},Hd=({d:n,now:i,cutout:l},u)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${u}px"><span class="dt-sb-l">${Z.signal}${Z.wifi}</span><b>${Fs(i)}</b><span class="dt-sb-r">${Z.battery}</span></div>`;let p=l??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${u}px"><span class="dt-island" style="left:${p.x}px;top:${p.y}px;width:${p.width}px;height:${p.height}px"></span><b class="dt-sb-time" style="top:${p.y}px;height:${p.height}px">${Fs(i)}</b><span class="dt-sb-icons" style="top:${p.y}px;height:${p.height}px">${Z.signal}${Z.wifi}${Z.battery}</span></div>`},Nd=({d:n,host:i,min:l},u)=>{let p=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return l?`<div class="dt-ios-bar is-min" style="height:${u}px"><span class="dt-ios-mini">${nn(i)}</span>${p}</div>`:`<div class="dt-ios-bar" style="height:${u}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${Z.back}</button><span class="dt-glass dt-ios-url"><span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${Z.reload}</button></span><span class="dt-glass dt-glass--round">${Z.dots}</span></div>${p}</div>`},Bd=({now:n,min:i},l)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Go(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${Z.wifi}${Z.signal}${Z.battery}</span></div>`+(i?"":`<div class="dt-and-bar"><span class="dt-and-url">${Z.tune}<span>${nn(l)}</span></span><span class="dt-and-tabs">1</span>${Z.dotsV}</div>`),Rd=()=>`<div class="dt-and-nav">${Z.recent}${Z.home}${Z.navBack}</div>`,Pd=({now:n,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Fs(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${Z.wifi}${Z.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${Z.sidebar}<button data-nav="back" aria-label="Back" title="Back">${Z.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${Z.fwd}</button></span><span class="dt-ipad-url">${Z.lock}<span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${Z.reload}</button></span><span class="dt-bar-group">${Z.share}${Z.plus}${Z.tabs}</span></div>`,Od=({now:n,host:i},l)=>'<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>'+(l?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${Z.wifi}${Z.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${Fs(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">${Z.sidebar}<button data-nav="back" aria-label="Back" title="Back">${Z.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${Z.fwd}</button></span><span class="dt-mac-url">${Z.lock}<span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${Z.reload}</button></span><span class="dt-bar-group">${Z.share}${Z.plus}${Z.tabs}</span></div>`,Id=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,Dd=({host:n,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${nn(i||n)}</span>${Z.close}</span><span class="dt-win-new">${Z.plus}</span><span class="dt-win-ctrl">${Z.winMin}${Z.winMax}${Z.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${Z.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${Z.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${Z.reload}</button></span><span class="dt-win-url">${Z.tune}<span>${nn(n)}</span>${Z.star}</span><span class="dt-bar-group">${Z.user}${Z.dotsV}</span></div>`,qd=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,l)=>`<i style="--hue:${200+l*30}"></i>`).join("")}</span><span class="dt-win-tray">${Z.chevUp}${Z.wifi}${Z.volume}${Z.battery}<span class="dt-win-clock">${Go(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function xr(n,i){let l=Td[n.shell](n),u=n.w+2*l.side,p=n.h+l.top+l.bottom,v=u+(l.extraW??0),k=p+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?l.extraH??0:0),H=(v-u)/2+l.side,f=Cd[n.browser](n),$=i.min?f.topMin??f.top:f.top,y=i.min?f.bottomMin??f.bottom:f.bottom,R={...i,d:n},Q="",_="";switch(n.browser){case"safari-ios":Q=Hd(R,$),_=Nd(R,y);break;case"chrome-android":Q=Bd(R,i.host),_=Rd();break;case"safari-ipad":Q=Pd(R),_='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":Q=Od(R,n.shell==="macbook"),_=Id();break;case"chrome-windows":Q=Dd(R),_=qd(R);break}return{footprint:{w:v,h:k},screen:{x:H,y:l.top,w:n.w,h:n.h,r:l.r,rb:l.rb??l.r},topH:$,bottomH:y,shell:Ad(n,l,v,k,H),top:Q,bottom:_,canMinimize:f.topMin!==void 0&&(f.topMin!==f.top||f.bottomMin!==f.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var en=null;function Gn(n){if(en??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!en||!n)return[0,0,0,0];en.clearRect(0,0,1,1),en.fillStyle="rgba(0, 0, 0, 0)",en.fillStyle=n,en.fillRect(0,0,1,1);let[i,l,u,p]=en.getImageData(0,0,1,1).data;return[i,l,u,p/255]}var Un=([n,i,l])=>`rgb(${n}, ${i}, ${l})`;function Er(n){let i=n.defaultView,l=_=>!_||Gn(_)[3]===0,u=[n.body,n.documentElement].map(_=>_&&i.getComputedStyle(_).backgroundColor).find(_=>_&&!l(_)),[p,v,k,H]=u?Gn(u):[255,255,255,1],f=[p,v,k].map(_=>Math.round(_*H+255*(1-H))),$=_=>{let[Y,ht,P,A]=Gn(_);if(A>=.75)return Un([Y,ht,P]);let W=(L,j)=>Math.round(L*A+j*(1-A));return Un([W(Y,f[0]),W(ht,f[1]),W(P,f[2])])},y=_=>{let Y=n.elementFromPoint(i.innerWidth/2,_);for(;Y&&Y!==n.documentElement;Y=Y.parentElement){let ht=i.getComputedStyle(Y);if(ht.position!=="fixed"&&ht.position!=="sticky")continue;let P=Y.getBoundingClientRect().width>=i.innerWidth*.9,A=ht.backdropFilter&&ht.backdropFilter!=="none";return P&&!A&&!l(ht.backgroundColor)?$(ht.backgroundColor):null}return null},R=n.querySelector('meta[name="theme-color"]')?.content||"",Q=R&&!l(R)?Un(Gn(R)):"";return{top:y(4)??Un(f),bottom:y(i.innerHeight-4)??Un(f),theme:Q}}function Yo(n){let[i,l,u]=Gn(n).map(p=>p/255).map(p=>p<=.04045?p/12.92:((p+.055)/1.055)**2.4);return .2126*i+.7152*l+.0722*u>.4?"#000":"#fff"}function Mr(n){let{cfg:i,inFrame:l,persist:u,frame:p,frameEl:v,devicesMenu:k,bpBtns:H,notesOverlay:f,WIDE:$,bpOf:y,currentBp:R,deviceById:Q,notesOn:_,filter:Y,filterTo:ht,dropFrameDrafts:P,putAway:A,tellFrame:W,syncBpButtons:L,render:j,reread:I}=n,rt=i.breakpoints,ot=document.querySelector(".dt-device"),Pt=document.querySelector(".dt-shell"),Ht=document.querySelector('.dt-chrome[data-at="top"]'),St=document.querySelector('.dt-chrome[data-at="bottom"]'),zt=document.querySelector(".dt-ruler"),E=[...document.querySelectorAll(".dt-frame-handle")],pt=document.querySelector(".dt-frame-size"),wt=document.querySelector(".dt-frame-rotate"),Ot=document.querySelector(".dt-frame-bars"),Vt="overlay",w="",m="dt-w",M="dt-canvas",B="dt-device",D=st.getItem(M)==="1",z=st.getItem(B)||"";z&&!Q(z)&&(z="",st.setItem(B,""));let U=Number(st.getItem(m))||0,tt="dt-emu",X=(()=>{try{return JSON.parse(st.getItem(tt)||"null")}catch{return null}})(),at=()=>X?_n.find(x=>x.id===X.id)??null:null,ct=()=>{let x=at();return x?X.turned?{w:x.h,h:x.w}:{w:x.w,h:x.h}:null},kt=st.getItem("dt-bars-min")==="1",Nt=x=>{X=x,u(tt,x?JSON.stringify(x):"")},Bt=x=>{pt.textContent=x,p.style.setProperty("--dt-badge-w",`${pt.offsetWidth}px`)},sn=x=>{if(!x){zt.innerHTML="";return}let T="";for(let O=0;O<=x;O+=50)T+=`<span class="dt-tick${O%200===0?" is-major":""}" style="left:${O}px"></span>`;for(let O of rt)for(let J of[O.min,O.max])J>0&&Number.isFinite(J)&&J<=x&&(T+=`<span class="dt-edge" style="left:${J}px" title="${O.label} edge"></span>`);zt.innerHTML=T,zt.style.width=`${x}px`},fe=()=>{let x=parseFloat(ot.style.width)||0,T=parseFloat(ot.style.height)||0;if(!x||!T){ot.style.transform="",delete ot.dataset.scaled;return}let O=z||X?Math.min(1,(innerWidth-80)/x,(innerHeight-120)/T):Math.min(1,(innerWidth-80)/x);ot.style.transform=O<1?`scale(${O})`:"",ot.dataset.scaled=O<1?String(Math.round(O*100)):""},Kt=x=>_n.find(T=>T.w===x.w&&T.h===x.h&&T.cutout?.shape==="pill")?.cutout,vt=()=>{try{return v.contentDocument}catch{return null}},Oe=()=>vt()?.title.split("\u2014").pop()?.trim()||"",Ae=()=>{let x=vt(),T=z?Q(z):null;if(!x?.body||!T)return;let O=Er(x),J=T.browser==="chrome-android"?O.theme||"rgb(255, 255, 255)":O.top,dt=T.browser==="chrome-android"?"rgb(255, 255, 255)":O.bottom;ot.style.setProperty("--dt-top",J),ot.style.setProperty("--dt-top-ink",Yo(J)),ot.style.setProperty("--dt-bottom",dt),ot.style.setProperty("--dt-bottom-ink",Yo(dt));let _t=Ht.querySelector(".dt-win-tab > span");_t&&(_t.textContent=Oe()||location.host)},Ie=0;v.addEventListener("load",()=>{let x=vt();if(!x)return;let T=window.__notemendHosted;if(T&&!v.contentWindow?.__notemendHosted&&!x.querySelector(`script[src^="${T.base}/bar.js"]`)){let O=x.createElement("script");O.src=`${T.base}/bar.js`,O.dataset.project=T.project,x.head.append(O)}Ae(),v.contentWindow?.addEventListener("scroll",()=>{Ie||(Ie=requestAnimationFrame(()=>{Ie=0,Ae()}))},{passive:!0})});for(let x of[Ht,St])x.addEventListener("click",T=>{let O=T.target.closest("[data-nav]")?.dataset.nav;if(O)try{let J=v.contentWindow?.navigation;if(!vt()||!J)throw new Error("foreign");O==="back"?J.canGoBack&&J.back():O==="fwd"?J.canGoForward&&J.forward():J.reload()}catch{(O==="reload"||O==="back")&&(v.src=location.href)}});Ot.addEventListener("click",()=>{kt=!kt,u("dt-bars-min",kt?"1":"0"),K()});let K=()=>{if(l)return;let x=z?Q(z)??null:null;if(z&&!x&&(z="",st.setItem(B,"")),!x&&!D){p.hidden=!0,v.removeAttribute("src"),Ft.toggle("dt-framing",!1),f.hidden=!_(),zt.innerHTML="",L(),wt.hidden=!0,Ot.hidden=!0,ht(null),w="",P(),L(),S(),I();return}if(p.hidden=!1,Ft.toggle("dt-framing",!0),f.hidden=!0,v.src||(v.src=location.href),x){let T=xr(x,{host:location.host,title:Oe(),now:new Date,min:kt,cutout:Kt(x)}),{screen:O}=T;p.dataset.mode="device",ot.dataset.shell=x.shell,ot.dataset.browser=x.browser,ot.style.width=`${T.footprint.w}px`,ot.style.height=`${T.footprint.h}px`,ot.style.setProperty("--dt-r",`${O.r}px`),ot.style.setProperty("--dt-rb",`${O.rb}px`),Pt.innerHTML=T.shell;let J=(Ut,Tt,an,qe)=>{Ut.innerHTML=qe,Ut.style.cssText=`left:${O.x}px;top:${Tt}px;width:${O.w}px;height:${an}px`};J(Ht,O.y,T.topH,T.top),J(St,O.y+O.h-T.bottomH,T.bottomH,T.bottom);let dt=O.h-T.topH-T.bottomH;v.style.position="absolute",v.style.left=`${O.x}px`,v.style.top=`${O.y+T.topH}px`,v.style.width=`${O.w}px`,v.style.height=`${dt}px`,zt.innerHTML="";let _t=kt&&T.canMinimize;Vt=T.scrollbar,w=`${x.label}${_t?" \xB7 bars folded":""}`,ht(y(x.w)),W({notes:_(),scrollbar:Vt,device:w}),Ot.hidden=!T.canMinimize,Ot.setAttribute("aria-pressed",String(_t)),Bt(`${x.label} \xB7 page ${x.w}\xD7${dt} of ${x.w}\xD7${x.h}${_t?" \xB7 bars folded":""} \xB7 ${rt.find(Ut=>Ut.id===Y())?.label??""}`),Ae()}else{let T=ct();T||Nt(null);let O=T?.w||U||rt.find(_t=>_t.id===R()).ideal;U=O,p.dataset.mode="canvas",delete ot.dataset.shell,delete ot.dataset.browser,Pt.innerHTML=Ht.innerHTML=St.innerHTML="",Ht.style.cssText=St.style.cssText="",Ot.hidden=!0,Vt="overlay",ot.style.width=`${O}px`,ot.style.height=`${T?.h??innerHeight-84}px`,v.style.position="",v.style.left=v.style.top="",v.style.width="100%",v.style.height="100%",sn(O),W({notes:_()});let J=rt.find(_t=>_t.id===y(O)),dt=at();w=dt?`${dt.label}${X?.turned?" \xB7 landscape":""}`:"",W({scrollbar:Vt,device:w}),Bt(dt&&T?`${dt.label} \xB7 ${T.w}\xD7${T.h} \xB7 ${J.label}`:`${O}px \xB7 ${J.label}`),ht(y(O))}wt.hidden=!(at()?.rotates&&!x),S(),fe(),L(),I()},be=x=>{let T=rt.find(O=>O.id===x);z="",st.setItem(B,""),Nt(null),D=!(y(innerWidth)===x||x===$&&innerWidth>=T.min),U=D?T.ideal:0,ht(D?x:null),st.setItem(M,D?"1":"0"),st.setItem(m,String(U)),A(),K()};for(let x of H)x.addEventListener("click",()=>be(x.dataset.bp));for(let x of document.querySelectorAll("[data-device]"))x.addEventListener("click",()=>{z=x.dataset.device===z?"":x.dataset.device,st.setItem(B,z),k.open=!1,K()});for(let x of document.querySelectorAll("[data-emu]"))x.addEventListener("click",()=>{let T=X?.id===x.dataset.emu&&!z;z="",st.setItem(B,""),Nt(T?null:{id:x.dataset.emu,turned:!1}),D=!T,U=0,st.setItem(M,D?"1":"0"),ht(null),A(),k.open=!1,K()});wt.addEventListener("click",()=>{X&&(Nt({...X,turned:!X.turned}),A(),K())});let on=[...k.querySelectorAll("[data-tab]")],Xn=[...k.querySelectorAll("[data-panel]")],G=x=>{for(let T of on)T.setAttribute("aria-selected",String(T.dataset.tab===x));for(let T of Xn)T.hidden=T.dataset.panel!==x;u("dt-devices-tab",x)};for(let x of on)x.addEventListener("click",()=>G(x.dataset.tab));G(st.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let $t=k.querySelector(".dt-emu-search");$t.addEventListener("input",()=>{let x=$t.value.trim().toLowerCase(),T=null,O=!1,J=()=>{T&&(T.hidden=!O)};for(let dt of $t.parentElement.children){if(dt.classList.contains("dt-devices-group")){J(),T=dt,O=!1;continue}dt.dataset.emu&&(dt.hidden=!!x&&!dt.textContent.toLowerCase().includes(x),O||=!dt.hidden)}J()});let nt=k.querySelector(".dt-devices-name");function S(){for(let T of k.querySelectorAll("[data-device]"))T.setAttribute("aria-pressed",String(T.dataset.device===z));let x=!z&&!p.hidden?X?.id:void 0;for(let T of k.querySelectorAll("[data-emu]"))T.setAttribute("aria-pressed",String(T.dataset.emu===x));nt.textContent=z&&Q(z)?.label||x&&at()?.label||"Device"}let De=x=>rt.find(T=>T.id===x),jt=x=>{let T=De(Y()??R());return Math.max(T.min||320,Math.min(Number.isFinite(T.max)?T.max:2560,Math.round(x)))};for(let x of E){let T=x.dataset.edge==="l"?-1:1;x.addEventListener("pointerdown",O=>{if(z)return;O.preventDefault(),X&&(Nt(null),K()),x.setPointerCapture(O.pointerId);let J=O.clientX,dt=U,_t=Number(ot.dataset.scaled||100)/100;p.dataset.dragging="1";let Ut=an=>{U=jt(dt+T*(an.clientX-J)*2/_t),ot.style.width=`${U}px`,sn(U),Bt(`${U}px \xB7 ${De(y(U)).label}`),fe()},Tt=()=>{x.removeEventListener("pointermove",Ut),x.removeEventListener("pointerup",Tt),x.removeEventListener("pointercancel",Tt),delete p.dataset.dragging,st.setItem(m,String(U)),K()};x.addEventListener("pointermove",Ut),x.addEventListener("pointerup",Tt),x.addEventListener("pointercancel",Tt)}),x.addEventListener("dblclick",()=>{if(z)return;Nt(null);let O=De(Y()??R()),J=[O.min||320,Number.isFinite(O.max)?O.max:O.ideal];U=Math.abs(U-J[0])<Math.abs(U-J[1])?J[0]:J[1],st.setItem(m,String(U)),K()})}let Jn=R(),xn=()=>{let x=rt.find(T=>T.id===$);return D&&!z&&!X&&U===x.ideal&&innerWidth>=x.min};return addEventListener("resize",()=>{if(xn()){be($);return}L(),R()!==Jn&&(Jn=R(),j()),p.hidden||(!z&&!X&&(ot.style.height=`${innerHeight-84}px`),fe())}),{apply:K,pickBp:be,look:()=>({scrollbar:Vt,device:w}),restore:()=>{xn()?be($):D||z?K():S()}}}var kr='<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>',Lr='<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>',Fd='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function Sr(n){let{bp:i,notes:l,breakpoints:u,bandOfNote:p,whoseAgent:v,statusTools:k,showResolved:H,showArchived:f,drafts:$,find:y}=n,R=l.filter(E=>p(E)===i),Q=E=>[E.text,E.note,E.byName,...(E.replies??[]).filter(pt=>!pt.deleted).map(pt=>pt.text)].join(" ").toLowerCase(),_=E=>y.view==="me"?n.forMe(E):y.view==="agent"?n.forAgent(E):!0,Y=E=>Date.parse(E.updatedAt||E.createdAt||"")||0,ht=R.filter(E=>_(E)&&(!y.q||Q(E).includes(y.q.trim().toLowerCase()))).sort((E,pt)=>(y.sort==="unread"?Number(n.unread(pt))-Number(n.unread(E)):0)||Y(pt)-Y(E)),P={open:[],claude:[],done:[],archived:[]};for(let E of ht)P[bt(E)==="done"&&n.archived(E)?"archived":bt(E)].push(E);let A=E=>{let pt=(E.replies??[]).filter(D=>!D.deleted),wt=Qe(E.category),Ot=bt(E),Vt=Ot==="claude"&&!n.agentless(E),w=n.orphan(E),m=pt.length?pt[pt.length-1]:E.note?{author:"claude",text:E.note}:{author:"you",text:E.text},M=(D,z)=>D.by&&z.by?D.by===z.by:D.byName===z.byName,B=n.unread(E);return`<div class="dt-hist-row is-${Ot}${Ot==="done"?n.archived(E)?" is-archived":" is-resolved":""}${w?" is-orphan":""}${B?" is-unread":""}">
|
|
168
|
-
<button class="dt-hist-go" data-go="${
|
|
169
|
-
${
|
|
184
|
+
`)}var $e=(s,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="${s}"/>`:""}<rect x="1.75" y="1.75" width="8.5" height="8.5" rx="1.5" fill="none" stroke="${s}" stroke-width="1.5" transform="rotate(45 6 6)"/></svg>`};var Id=[{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"/>'}],Vo=(s,r=14)=>`<svg viewBox="0 0 24 24" width="${r}" height="${r}" fill="none" stroke="${s.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${s.icon}</svg>`,Dn=s=>Id.find(r=>r.id===s)||Id[0];var kt=s=>s.status!=="done"?"open":s.doneBy==="claude"?"claude":"done",Od={open:"Open",done:"Resolved",claude:"To check"};var Jt={ready:Promise.resolve(),toggle:(s,r)=>{Jt.ready.then(()=>document.documentElement.classList.toggle(s,r))},set:(s,r)=>{Jt.ready.then(()=>document.documentElement.style.setProperty(s,r))}};var Np=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Dd=s=>String(s??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(Np,"$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 Fn=[],Li=s=>{if(s instanceof Error)return`${s.name}: ${s.message}`;if(typeof s=="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}},Bp=/ResizeObserver loop/,qn=(s,r)=>{if(Bp.test(r))return;let c=Ot(Dd(r.replace(/\s+/g," ").trim()),500),m=Fn.findIndex(g=>g.kind===s&&g.text.replace(/ ×\d+$/,"")===c);if(m>=0){let[g]=Fn.splice(m,1),$=Number(/ ×(\d+)$/.exec(g.text)?.[1]??1)+1;Fn.push({at:new Date().toISOString(),kind:s,text:`${c} \xD7${$}`});return}Fn.push({at:new Date().toISOString(),kind:s,text:c}),Fn.length>50&&Fn.shift()},qd=!1;function Fd(s){if(qd||typeof window>"u")return;qd=!0;let r=console.error;console.error=(...g)=>{qn("console",g.map(Li).join(" ")),r.apply(console,g)},addEventListener("error",g=>{if(g instanceof ErrorEvent)return qn("error",`${g.message}${g.filename?` (${g.filename}:${g.lineno})`:""}`);let $=g.target,T=$?.src||$?.href;T&&!s(T)&&qn("network",`${$.tagName?.toLowerCase()} ${T} did not load`)},!0),addEventListener("unhandledrejection",g=>qn("rejection",Li(g.reason)));let c=window.fetch;window.fetch=async(g,$)=>{let T=typeof g=="string"?g:g instanceof URL?g.href:g.url,H=($?.method||(g instanceof Request?g.method:"GET")).toUpperCase();try{let M=await c.call(window,g,$);return M.status>=400&&!s(T)&&qn("network",`${H} ${T} \u2192 ${M.status}`),M}catch(M){throw!s(T)&&M?.name!=="AbortError"&&qn("network",`${H} ${T} \u2192 no answer (${Li(M)})`),M}};let m=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(g,$,...T){return this._nm=`${g.toUpperCase()} ${String($)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(s(String($))||qn("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),m.call(this,g,$,...T)}}var jd=(s=Date.now())=>Fn.filter(r=>s-Date.parse(r.at)<10*6e4).slice(-20);function Wd(s){let r=w=>{let y=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,L=w/y;return Math.round(L*10)%10===0?String(Math.round(L)):L.toFixed(1)},c=(w,y,L,B,O,rt="p")=>{if(L<=0||B<=0)return"";let lt=O!==""?`<span class="dt-pad-chip dt-pad-chip--${rt}" style="left:${w+L/2}px;top:${y+B/2}px">${O}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${rt}" style="left:${w}px;top:${y}px;width:${L}px;height:${B}px"></span>${lt}`},m=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],g="button, a, input, select, textarea, label, [role='button']",$=w=>{let y=w;for(let L=0;y&&L<6;L++,y=y.parentElement){if(y.matches(g))return y;let B=getComputedStyle(y);if(m.some(O=>parseFloat(B[O])>=2))return y}return w},T=(w,y)=>{let L=parseFloat(y.columnGap)||0,B=parseFloat(y.rowGap)||0;if(!(y.display.includes("flex")||y.display.includes("grid"))||!L&&!B)return"";let O=[...w.children].map(Q=>Q.getBoundingClientRect()).filter(Q=>Q.width||Q.height),rt="",lt=(Q,J)=>r(Math.abs(Q-J)<=1?J:Q);for(let Q=1;Q<O.length;Q++){let J=O[Q-1],tt=O[Q];if(L&&tt.left>=J.right-1){let ht=Math.max(J.top,tt.top);rt+=c(J.right,ht,tt.left-J.right,Math.min(J.bottom,tt.bottom)-ht,lt(tt.left-J.right,L),"g")}else if(B&&tt.top>=J.bottom-1){let ht=Math.min(J.left,tt.left);rt+=c(ht,J.bottom,Math.max(J.right,tt.right)-ht,tt.top-J.bottom,lt(tt.top-J.bottom,B),"g")}}return rt},H=w=>`<span class="dt-pad-outline" style="left:${w.left}px;top:${w.top}px;width:${w.width}px;height:${w.height}px"></span>`,M=(w,y,L="")=>`<span class="dt-pad-tag" style="left:${y.left}px;top:${Math.max(2,y.top-22)}px">${w.tagName.toLowerCase()+(w.classList[0]?"."+w.classList[0]:"")}${L}</span>`,k=w=>{let y=w.getBoundingClientRect(),L=getComputedStyle(w),B=parseFloat(L.paddingTop),O=parseFloat(L.paddingRight),rt=parseFloat(L.paddingBottom),lt=parseFloat(L.paddingLeft),Q=H(y);Q+=c(y.left,y.top,y.width,B,B>=2?r(B):""),Q+=c(y.left,y.bottom-rt,y.width,rt,rt>=2?r(rt):""),Q+=c(y.left,y.top+B,lt,y.height-B-rt,lt>=2?r(lt):""),Q+=c(y.right-O,y.top+B,O,y.height-B-rt,O>=2?r(O):"");let J=parseFloat(L.marginTop),tt=parseFloat(L.marginRight),ht=parseFloat(L.marginBottom),vt=parseFloat(L.marginLeft);Q+=c(y.left,y.top-J,y.width,J,J>=2?r(J):"","m"),Q+=c(y.left,y.bottom,y.width,ht,ht>=2?r(ht):"","m"),Q+=c(y.left-vt,y.top,vt,y.height,vt>=2?r(vt):"","m"),Q+=c(y.right,y.top,tt,y.height,tt>=2?r(tt):"","m"),Q+=T(w,L);let Gt=parseFloat(L.columnGap)||0,ie=parseFloat(L.rowGap)||0,Vt=(L.display.includes("flex")||L.display.includes("grid"))&&(Gt||ie)?` \xB7 gap ${r(Gt)}${ie&&ie!==Gt?"/"+r(ie):""}`:"",Ct="",It=w.parentElement;if(w.matches(g)&&It){let ot=getComputedStyle(It);Q+=T(It,ot);let qt=parseFloat(ot.columnGap)||parseFloat(ot.rowGap)||0;Ct=` \xB7 ${r(y.width)}\xD7${r(y.height)}${qt&&(ot.display.includes("flex")||ot.display.includes("grid"))?` \xB7 gap ${r(qt)} in its row`:""}`}let te=Ct?"":` \xB7 ${Math.round(parseFloat(r(y.width)))} \xD7 ${Math.round(parseFloat(r(y.height)))}`;s.innerHTML=Q+M(w,y,te+Vt+Ct)},x=w=>{let y=w.getBoundingClientRect();s.innerHTML=H(y).replace("dt-pad-outline","dt-pad-outline dt-size-line")+`<span class="dt-pad-chip dt-size-chip" style="left:${y.left+y.width/2}px;top:${y.bottom+6}px">${Math.round(parseFloat(r(y.width)))} \xD7 ${Math.round(parseFloat(r(y.height)))}</span>`},F=w=>{let y=(w.match(/[\d.]+/g)||[]).map(Number);if(y.length<3)return w;let L="#"+y.slice(0,3).map(B=>Math.round(B).toString(16).padStart(2,"0")).join("");return y[3]!==void 0&&y[3]<1?`${L} \xB7 ${Math.round(y[3]*100)}%`:L},j=null,I=()=>{if(j)return j;let w=getComputedStyle(document.documentElement),y=document.createElement("span");y.style.display="none",document.body.append(y);let L=[];for(let B of Array.from(w)){if(!B.startsWith("--"))continue;let O=w.getPropertyValue(B).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(O))continue;y.style.color="rgb(1, 2, 3)",y.style.color=O;let rt=getComputedStyle(y).color;rt&&rt!=="rgb(1, 2, 3)"&&L.push([rt,B])}return y.remove(),L.sort((B,O)=>B[1].length-O[1].length),j=L,L},Y=w=>I().find(([y])=>y===w)?.[1]??"",q=null,mt=()=>{if(q)return q;let w=[],y=L=>{for(let B of Array.from(L))B instanceof CSSStyleRule?B.style.cssText.includes("var(--")&&w.push({sel:B.selectorText,style:B.style}):B instanceof CSSMediaRule?matchMedia(B.conditionText).matches&&y(B.cssRules):"cssRules"in B&&y(B.cssRules)};for(let L of Array.from(document.styleSheets))try{y(L.cssRules)}catch{}return q=w},At={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(w=>[`border-${w}-color`,[`border-${w}-color`,"border-color",`border-${w}`,"border"]]))},pt=(w,y)=>{let L=At[y]??[y],B=y==="color";for(let O=w;O;O=B?O.parentElement:null){let rt=J=>L.map(tt=>/var\(\s*(--[\w-]+)/.exec(J.getPropertyValue(tt))?.[1]).find(Boolean),lt=O instanceof HTMLElement?rt(O.style):void 0;if(lt)return lt;let Q="";for(let J of mt()){let tt=!1;try{tt=O.matches(J.sel)}catch{}tt&&(Q=rt(J.style)||Q)}if(Q)return Q;if(B&&O.parentElement&&getComputedStyle(O).color!==getComputedStyle(O.parentElement).color)break}return""},Z=(w,y,L)=>{let B=getComputedStyle(w).getPropertyValue(y).trim();if(!B)return F(L);let O=document.createElement("span");if(O.style.display="none",O.style.color=B,!O.style.color)return F(L);document.body.append(O);let rt=getComputedStyle(O).color;return O.remove(),F(rt)},it=(w,y,L)=>{let B=pt(w,y);if(B)return`<b class="dt-var">${B}</b> <em>${Z(w,B,L)}</em>`;let O=Y(L);return O?`<span title="Same value as ${O}; not written with it">\u2248 ${O}</span> <em>${F(L)}</em>`:F(L)},Lt=w=>`<i class="dt-type-sw" style="background:${w}"></i>`,Et={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},dt=w=>(w.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),Zt=(w,y)=>w.slice(0,3).map((L,B)=>L*w[3]+y[B]*(1-w[3])).concat([1]),Yt=w=>{let y=[];for(let L=w;L;L=L.parentElement){let B=getComputedStyle(L);if(B.backgroundImage!=="none")return null;let O=dt(B.backgroundColor);if(O[3]>0&&(y.push(O),O[3]>=1))break}return y.reduceRight((L,B)=>Zt(B,L),[255,255,255,1])},zt=w=>{let[y,L,B]=w.slice(0,3).map(O=>(O/=255,O<=.03928?O/12.92:((O+.055)/1.055)**2.4));return .2126*y+.7152*L+.0722*B},E=(w,y,L)=>{let B=Yt(w);if(!B)return["Contrast","<em>on an image</em>"];let O=Zt(dt(y.color),B),[rt,lt]=[zt(O),zt(B)].sort((ht,vt)=>vt-ht),Q=(rt+.05)/(lt+.05),J=L>=24||L>=18.66&&Number(y.fontWeight)>=700,tt=Q>=(J?4.5:7)?"AAA":Q>=(J?3:4.5)?"AA":"fails AA";return["Contrast",`${Q.toFixed(2)}:1 <em class="${tt==="fails AA"?"dt-type-bad":""}">${tt}${J?" \xB7 large":""}</em>`]},h=w=>{let y=w.getBoundingClientRect(),L=getComputedStyle(w),B=parseFloat(L.fontSize),O=L.lineHeight==="normal"?0:parseFloat(L.lineHeight),rt=parseFloat(L.letterSpacing)||0,lt=vt=>`${(vt*100).toFixed(1).replace(/\.0$/,"")}%`,Q=[["Font",L.fontFamily.split(",")[0].replace(/["']/g,"")+(L.fontStyle!=="normal"?` ${L.fontStyle}`:"")],["Weight",`${Et[L.fontWeight]??""} <em>${L.fontWeight}</em>`],["Size",`${r(B)}px`],["Line",O?`${lt(O/B)} <em>${r(O)}px</em>`:"normal"],["Letter",rt?`${lt(rt/B)} <em>${rt.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",Lt(L.color)+it(w,"color",L.color)],E(w,L,B)],tt=y.bottom+150<innerHeight?y.bottom+8:Math.max(8,y.top-158),ht=Math.min(Math.max(8,y.left),innerWidth-210);s.innerHTML=H(y)+M(w,y)+`<div class="dt-type-card" style="left:${ht}px;top:${tt}px">${Q.map(([vt,Gt])=>`<span class="dt-type-row"><b>${vt}</b><span>${Gt}</span></span>`).join("")}</div>`},S=w=>w.every(y=>y===w[0])?w[0]:w[1]===w[3]&&w[0]===w[2]?`${w[0]} ${w[1]}`:w.join(" "),R=w=>/^rgba\(.*,\s*0\)$|^transparent$/.test(w),et=(w,y,L,B="")=>{let O=20+L.length*21,lt=y.bottom+O+12<innerHeight?y.bottom+8:Math.max(8,y.top-O-8),Q=Math.min(Math.max(8,y.left),innerWidth-230);s.innerHTML=`<span class="dt-pad-outline" style="left:${y.left}px;top:${y.top}px;width:${y.width}px;height:${y.height}px${B?`;border-radius:${B}`:""}"></span>`+M(w,y)+`<div class="dt-type-card dt-style-card" style="left:${Q}px;top:${lt}px">${L.map(([J,tt])=>`<span class="dt-type-row"><b>${J}</b><span>${tt}</span></span>`).join("")}</div>`},X=w=>{let y=getComputedStyle(w),L=[];y.backgroundImage!=="none"&&L.push(["Fill",`<em>${/gradient/.test(y.backgroundImage)?"gradient":"image"}</em>`]),R(y.backgroundColor)||L.push(["Fill",Lt(y.backgroundColor)+it(w,"background-color",y.backgroundColor)]),w.textContent?.trim()&&L.push(["Text",Lt(y.color)+it(w,"color",y.color)]),L.push(["Opacity",`${Math.round(Number(y.opacity)*100)}%`]),L.length||L.push(["Color","<em>no fill or text</em>"]),et(w,w.getBoundingClientRect(),L)},bt=w=>{let y=getComputedStyle(w),L=[],B=["top","right","bottom","left"],O=B.map(lt=>parseFloat(y.getPropertyValue(`border-${lt}-width`))||0);if(O.some(lt=>lt>0)){let lt=B.filter((J,tt)=>O[tt]>0);B.forEach((J,tt)=>L.push([J[0].toUpperCase()+J.slice(1),`${r(O[tt])} <em>${y.getPropertyValue(`border-${J}-style`)}</em>`]));let Q=lt.map(J=>y.getPropertyValue(`border-${J}-color`));lt.forEach((J,tt)=>{tt&&Q[tt]===Q[0]||L.push([tt?`\u21B3 ${J}`:"Color",Lt(Q[tt])+it(w,`border-${J}-color`,Q[tt])])})}else L.push(["Width","<em>none</em>"]);let rt=["top-left","top-right","bottom-right","bottom-left"].map(lt=>{let[Q,J=Q]=y.getPropertyValue(`border-${lt}-radius`).split(" "),tt=ht=>ht.endsWith("%")?ht:r(parseFloat(ht)||0);return Q===J?tt(Q):`${tt(Q)}/${tt(J)}`});L.push(["Radius",S(rt)]),et(w,w.getBoundingClientRect(),L,y.borderRadius)},yt=(w,y)=>{let[L,B]=[zt(w),zt(y)].sort((O,rt)=>rt-O);return(L+.05)/(B+.05)},Dt=w=>"#"+w.slice(0,3).map(y=>Math.round(y).toString(16).padStart(2,"0")).join(""),ct=(w,y,L)=>{let[B,O,rt]=w.map(Vt=>Vt/255),lt=Math.max(B,O,rt),Q=Math.min(B,O,rt),J=(lt+Q)/2,tt=lt-Q,ht=tt?tt/(1-Math.abs(2*J-1)):0,vt=tt?lt===B?((O-rt)/tt%6+6)%6:lt===O?(rt-B)/tt+2:(B-O)/tt+4:0,Gt=Vt=>{let Ct=(1-Math.abs(2*Vt-1))*ht,It=Ct*(1-Math.abs(vt%2-1)),te=Vt-Ct/2,[ot,qt,ln]=vt<1?[Ct,It,0]:vt<2?[It,Ct,0]:vt<3?[0,Ct,It]:vt<4?[0,It,Ct]:vt<5?[It,0,Ct]:[Ct,0,It];return[ot,qt,ln].map(Pe=>Math.min(255,Math.max(0,Math.round((Pe+te)*255)))).concat([1])},ie=zt(w)>=zt(y);for(let Vt of ie?[1,-1]:[-1,1]){let Ct=Vt>0?1:0;if(yt(Gt(Ct),y)<L)continue;let It=J,te=Ct;for(let ot=0;ot<20;ot++){let qt=(It+te)/2;yt(Gt(qt),y)>=L?te=qt:It=qt}return Gt(te)}return null},Bt={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>'},gt=w=>`${w.toFixed(1).replace(/\.0$/,"")} : 1`,Mt="",ae=null,St=!1,Ye=w=>{w!==ae&&(ae=w,St=!1),Mt="";let y=w.getBoundingClientRect(),L=(w instanceof HTMLInputElement||w instanceof HTMLTextAreaElement)&&!w.value&&!!w.placeholder,B=getComputedStyle(w,L?"::placeholder":null),O=parseFloat(B.fontSize),rt=O>=24||O>=18.66&&Number(B.fontWeight)>=700,lt=Yt(w),Q=ht=>`<i class="dt-type-sw" style="background:${ht}"></i>`,J;if(!w.textContent?.trim()&&!L&&!(w instanceof HTMLInputElement&&w.value))J='<p class="dt-ct-note">Point at some text.</p>';else if(!lt)J='<p class="dt-ct-note">It sits on an image or a gradient: there is no one colour behind it to measure.</p>';else{let ht=Zt(dt(B.color),lt),vt=yt(ht,lt),Gt=rt?3:4.5,ie=vt>=7?["ok",Bt.ok+"AAA"]:vt>=4.5?["ok",Bt.ok+"AA"]:vt>=3?["warn","Large text only"]:["bad","Fails"],Vt=`<div class="dt-ct-ratio"><b>${gt(vt)}</b><span class="dt-ct-chip dt-ct-chip--${ie[0]}">${ie[1]}</span></div>`;if(vt>=7){J=Vt,s.innerHTML=H(y)+M(w,y,L?" \xB7 placeholder":"")+$n(y,41,`<div class="dt-ct-card dt-ct-card--one">${J}</div>`);return}let Ct=(te,ot)=>`<div class="dt-ct-check">${vt>=ot?Bt.ok:Bt.x}<span>${te}</span><em>${gt(ot).replace(".0","")}</em></div>`,It=vt>=Gt?null:ct(ht,lt,Gt);It&&(Mt=Dt(It)),J=`<div class="dt-ct-pair"><div><span>Text</span><b>${Q(Dt(ht))}${Dt(ht)}</b></div><div><span>Background</span><b>${Q(Dt(lt))}${Dt(lt)}</b></div></div>`+Vt+Ct("Body text \xB7 AA",4.5)+Ct("Large text \xB7 AA",3)+Ct("Body text \xB7 AAA",7)+(Mt?St?`<div class="dt-ct-fix dt-ct-fix--done">${Bt.ok}<span>Copied ${Mt}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${Q(Mt)}${Mt}</b>${Bt.copy}</div>`:"")}let tt=`<div class="dt-ct-card"><div class="dt-ct-head">${Bt.half}<span>Contrast</span></div>${J}</div>`;s.innerHTML=H(y)+M(w,y,L?" \xB7 placeholder":"")+$n(y,210,tt)},$n=(w,y,L)=>{let B=w.bottom+y+12<innerHeight?w.bottom+8:Math.max(8,w.top-y-8),O=Math.min(Math.max(8,w.left),innerWidth-260);return L.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${O}px;top:${B}px"`)};return{spacer:$,drawPads:k,drawSize:x,drawType:h,drawColor:X,drawBorder:bt,drawContrast:Ye,contrastFix:()=>Mt,markCopied:()=>{St=!0}}}var Kt=s=>(s??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),_d=(s,r,c=!1)=>{for(let m=r*4;;m*=4){let g=c?Kt(s.slice(0,m)).replace(/\s+/g," "):Kt(s.slice(0,m));if(g.length>=r||m>=s.length)return g}},as=(s,r,c=!1)=>Ot(_d(s,r,c),r),zd='[class^="dt-"],[class*=" dt-"],.devtools',rn=s=>{let r=s;for(;r.parentElement&&r.parentElement!==document.body;)r=r.parentElement;return r.parentElement===document.body&&r.matches(zd)};function Gd(){let s=(E,h)=>E?[...E.children].filter(S=>S.tagName.toUpperCase()===h.toUpperCase()&&!(E===document.body&&S.matches(zd))):[],r=E=>{let h=[],S=E;for(;S&&S.tagName!=="HTML"&&h.length<8;){if(S.id){h.unshift("#"+CSS.escape(S.id));break}let R=S.parentElement,et=S.tagName.toLowerCase(),X=s(R,S.tagName),bt=R===document.body&&X.length>1?[...S.classList].find(yt=>/^[\w-]+$/.test(yt)&&X.filter(Dt=>Dt.classList.contains(yt)).length===1):void 0;h.unshift(bt?`${et}.${bt}`:X.length>1?`${et}:nth-of-type(${X.indexOf(S)+1})`:et),S=R}return h.join(">")},c=E=>{let h=E.split(">"),S=null;for(let[R,et]of h.entries()){if(et.startsWith("#")){if(R)return null;S=document.querySelector(et);continue}let X=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec(et);if(!X)return document.querySelector(E);if(!S){if(X[1]!=="body"||X[2]||X[3])return document.querySelector(E);S=document.body;continue}let bt=s(S,X[1].toUpperCase());if(S=(X[2]?bt.find(yt=>yt.classList.contains(X[2])):bt[X[3]?Number(X[3])-1:0])??null,!S)return null}return S},m=E=>E.replace(/\s+/g," ").trim(),g=(E,h)=>{if(!h)return!0;let S=_d(E.textContent||"",60),R=m(h);return m(Ot(S,60))===R||m(S.slice(0,60))===R},$=(E,h)=>[E||"*",...(h||[]).map(S=>"."+CSS.escape(S))].join(""),T=E=>{try{return[...document.querySelectorAll($(E.tag,E.classes))].filter(h=>!rn(h))}catch{return[]}},M=E=>{let h=E.textContent||"",S=null;for(let R=E.parentElement,et=0;R&&R!==document.body&&et<4;R=R.parentElement,et++){let X=R.textContent||"";if(X===h)continue;let bt=as(X,80,!0);if(bt&&(bt!==as(h,80,!0)||(S??=Kt(h).replace(/\s+/g," "),Kt(X).replace(/\s+/g," ")!==S)))return bt}return""},k=E=>M(E),x=(E,h,S=120)=>Ot(Kt(E.getAttribute(h)),S)||void 0,F=E=>{for(let h=E.parentElement,S=0;h&&h!==document.body&&S<4;h=h.parentElement,S++){let R=h.querySelector("h1,h2,h3,h4,h5,h6,[role=heading]");if(R&&R!==E&&!E.contains(R))return as(R.textContent||"",60,!0)||void 0}},j=E=>{let h=S=>S?as(S.textContent||"",30,!0):"";return(h(E.previousElementSibling)+"|"+h(E.nextElementSibling)).replace(/^\|$/,"")||void 0},I=/^data-(testid|test-id|test|qa|cy|id|key|slug|name|item)$/,Y=E=>{let h=[...E.attributes].find(R=>I.test(R.name)&&R.value),S=(E.getAttribute("src")||E.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)||void 0;return Object.fromEntries(Object.entries({id:E.id?Ot(E.id,80):void 0,data:h?`${h.name}=${Ot(h.value,80)}`:void 0,aria:x(E,"aria-label"),alt:x(E,"alt"),title:x(E,"title"),src:S,href:x(E,"href"),head:F(E),sib:j(E)}).filter(([,R])=>R))},q=(E,h)=>!h||M(E).startsWith(h),mt=new WeakMap,At=E=>mt.get(E)??"found",pt=E=>{let h=E.fp,S=null;try{S=c(E.selector)}catch{}let R=T(E),et=R.length?R:T({tag:E.tag}),X=new Set(et.slice(0,400));if(S&&!rn(S)&&X.add(S),h.id){let ct=document.getElementById(h.id);ct&&X.add(ct)}if(h.data){let[ct,Bt]=h.data.split(/=(.*)/s);try{document.querySelectorAll(`[${ct}="${CSS.escape(Bt)}"]`).forEach(gt=>X.add(gt))}catch{}}let bt=null,yt=null,Dt=0;for(let ct of X){if(rn(ct))continue;let Bt=h.id&&ct.id===h.id||h.data&&ct.getAttribute(h.data.split("=")[0])===h.data.split(/=(.*)/s)[1]?35:0,gt=Kt(E.label)&&g(ct,E.label)||h.aria&&x(ct,"aria-label")===h.aria||h.alt&&x(ct,"alt")===h.alt||h.title&&x(ct,"title")===h.title||h.href&&x(ct,"href")===h.href||h.src&&(ct.getAttribute("src")||ct.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)===h.src?25:0,Mt=h.head&&F(ct)===h.head||h.sib&&j(ct)===h.sib||E.ctx&&M(ct).startsWith(E.ctx)?15:0,ae=Bt+gt+Mt,St=ae+(ct===S?40:0)+(E.nth!=null&&et[E.nth]===ct?5:0);ae||(St=Math.min(St,39)),gt&&(Dt++,yt={el:ct,score:St}),(!bt||St>bt.score)&&(bt={el:ct,score:St})}return yt&&Dt===1&&yt.score<40&&(!bt||bt.score<40)?{el:yt.el,score:40}:bt},Z=E=>{let h=it(E),S=null;if(h){try{S=c(E.selector)}catch{}return mt.set(E,h===S?"found":"moved"),h}let R=E.fp?pt(E):null;return R&&R.score>=40?(mt.set(E,R.score>=70?"moved":"probably"),R.el):(mt.set(E,"gone"),null)},it=E=>{let h=null;try{h=c(E.selector)}catch{h=null}if(h&&rn(h)&&(h=null),h&&g(h,E.label)&&q(h,E.ctx))return h;let S=T(E),R=Kt(E.label)?S.filter(yt=>g(yt,E.label)):[],et=(E.ctx?R.find(yt=>q(yt,E.ctx)):R.length===1?R[0]:void 0)??S.find(yt=>E.ctx&&q(yt,E.ctx)&&!Kt(E.label));if(et)return et;let X=yt=>yt.split(">").slice(0,2).join(">"),bt=yt=>!E.ctx&&X(r(yt))===X(E.selector);return Kt(E.label)?h&&!E.ctx&&g(h,E.label)?h:R.length===1&&bt(R[0])?R[0]:null:h||(E.nth!=null?S[E.nth]??null:null)},Lt=E=>{let h=null;for(let S=E,R=E.parentElement;R&&R!==document.body&&getComputedStyle(S).position!=="fixed";S=R,R=R.parentElement){let et=getComputedStyle(R);if(et.overflowX==="visible"&&et.overflowY==="visible")continue;let X=R.getBoundingClientRect();h=h?{l:Math.max(h.l,X.left),t:Math.max(h.t,X.top),r:Math.min(h.r,X.right),b:Math.min(h.b,X.bottom)}:{l:X.left,t:X.top,r:X.right,b:X.bottom}}return h},Et=E=>{let h=E.getBoundingClientRect();return(h.width>0||h.height>0)&&(!E.checkVisibility||E.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},dt=E=>({...E,x:Math.min(Math.max(E.x,3),document.documentElement.clientWidth-30),y:E.y>=0&&E.y<19?19:E.y}),Zt=(E,h)=>{let S=h;for(let R=h.parentElement;R&&R!==document.body;R=R.parentElement){if(!Et(R)){S=R;continue}let et=h.getBoundingClientRect();if(et.width||et.height)return dt({x:et.left+et.width*E.rx,y:et.top+et.height*E.ry,el:h,hidden:R,shut:S});let X=R.getBoundingClientRect();return dt({x:X.left,y:X.top,el:h,hidden:R,shut:S})}return null},Yt=E=>{let h=E.opener?it(E.opener):null;if(!h||!Et(h))return null;let S=h.getBoundingClientRect();return dt({x:S.right-4,y:S.top+4,el:h,opener:h})};return{cssPath:r,poolOf:T,contextOf:k,resolveEl:Z,anchorOf:(E,h=Z(E))=>{if(!h)return Yt(E);if(!Et(h))return Yt(E)??Zt(E,h);let S=h.getBoundingClientRect(),R=S.left+S.width*E.rx,et=S.top+S.height*E.ry,X=Lt(h);return X?R<X.l||R>X.r||et<X.t||et>X.b?null:{x:R,y:et,el:h}:{x:R,y:et,el:h}},anchorState:At,fingerprintOf:Y}}var Vd=(s,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<s?r:"#fff"}" stroke="none"${c<s?"":' opacity="0.12"'}/>`).join("")}</svg>`;function Ud(s,r,c){let m=document.createElement("div");m.className="dt-field-menu",m.setAttribute("role","listbox"),m.hidden=!0,document.body.append(m);for(let T of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])m.addEventListener(T,H=>H.stopPropagation());let g=null,$=()=>{m.hidden=!0,g=null};for(let T of s)T.addEventListener("mousedown",H=>{let M=H.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select");if(!M){m.contains(H.target)||$();return}if(H.preventDefault(),g===M){$();return}g=M;let k=M.classList.contains("dt-more-select"),x=q=>k?q.dataset.on!=null:q.selected,F=M.dataset.search;m.innerHTML=(F?`<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(F)}" aria-label="${r(F)}" spellcheck="false"></label>`:"")+[...M.options].map((q,mt)=>q.hidden?"":q.dataset.head!=null?`<p class="dt-field-head">${r(q.text)}</p>`:`${q.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${mt}" aria-selected="${x(q)}"${q.disabled?" disabled":""}${q.dataset.hint?` data-tip="${r(q.dataset.hint)}" data-hint="${r(q.dataset.hint.toLowerCase())}"`:""}${q.dataset.danger!=null?' class="is-danger"':""}>${q.dataset.icon?q.dataset.icon:q.dataset.initial!=null?q.dataset.face?`<img class="dt-face" src="${r(q.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${r(q.dataset.initial)}</b>`:q.dataset.bare!=null?"":`<i style="background:${r(q.dataset.c||"#717171")}"></i>`}<span>${r(q.text)}</span>${q.dataset.note?`<small>${r(q.dataset.note)}</small>`:""}${x(q)?c:""}</button>${q.dataset.sepAfter!=null?"<hr>":""}`).join("")+(F?'<p class="dt-field-none" hidden></p>':""),m.classList.toggle("is-people",!!F);let j=M.parentElement.getBoundingClientRect(),I=F?M.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;m.style.left=`${I?I.left+4:j.left}px`,m.style.top=`${j.bottom+4}px`,m.style.minWidth=`${I?I.width-8:Math.max(200,j.width)}px`,m.style.width=I?`${I.width-8}px`:"",m.hidden=!1;for(let q of m.querySelectorAll("[data-hint]")){let mt=q.querySelector("span");mt.scrollWidth>mt.clientWidth&&(q.dataset.tip=`${mt.textContent} \xB7 ${q.dataset.tip}`)}let Y=m.getBoundingClientRect();(Y.bottom>innerHeight-8||F&&M.closest(".dt-note"))&&(m.style.top=`${Math.max(8,j.top-4-Y.height)}px`),Y.right>innerWidth-8&&(m.style.left=`${Math.max(8,j.right-Y.width)}px`),m.querySelector(".dt-field-search input")?.focus()});m.addEventListener("input",T=>{let H=T.target.value.trim().toLowerCase(),M=0;for(let x of m.querySelectorAll("[data-i]"))x.hidden=!!H&&!x.textContent.toLowerCase().includes(H)&&!x.dataset.hint?.includes(H),x.hidden||M++;for(let x of m.querySelectorAll("hr"))x.hidden=!!H;let k=m.querySelector(".dt-field-none");k&&(k.hidden=M>0,k.textContent=`No one matches \xAB${T.target.value.trim()}\xBB`)}),m.addEventListener("keydown",T=>{T.key!=="Enter"||!T.target.matches("input")||(T.preventDefault(),m.querySelector("[data-i]:not([hidden])")?.click())}),m.addEventListener("click",T=>{let H=T.target.closest("[data-i]");if(!H||!g)return;let M=g;$(),!(M.selectedIndex===Number(H.dataset.i)&&!M.classList.contains("dt-more-select"))&&(M.selectedIndex=Number(H.dataset.i),M.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",T=>{T.key==="Escape"&&!m.hidden&&(T.stopPropagation(),$())},!0),document.addEventListener("pointerdown",T=>{!m.hidden&&!m.contains(T.target)&&!T.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select")&&$()},!0),addEventListener("scroll",T=>{m.contains(T.target)||$()},!0)}var Rp=".devtools, [class^='dt-'], [class*=' dt-']";var Kd=null,Yd=s=>{Kd=s};function Xd(){let s=document.createElement("div");s.className="dt-tipbox",s.setAttribute("role","tooltip"),s.id="dt-tipbox",s.hidden=!0,document.body.append(s);let r=null,c,m=0,g=k=>{let x=k.getAttribute("title");x!==null&&(k.removeAttribute("title"),k.hasAttribute("data-tip")||k.setAttribute("data-tip",x),!k.hasAttribute("aria-label")&&!k.textContent?.trim()&&k.setAttribute("aria-label",x))},$=k=>{let x=k?.closest?.("[data-tip], [title]");return x&&x.closest(Rp)&&!x.closest(".dt-tipbox")?x:null},T=k=>{let x=k.getAttribute("data-tip");if(!x||k.getAttribute("aria-expanded")==="true")return H();let F=Kd?.(k);s.classList.toggle("is-peek",!!F),F?s.innerHTML=F:s.textContent=x,s.hidden=!1;let j=k.getBoundingClientRect(),I=s.getBoundingClientRect(),Y=6,q=8;if(F){let At=j.right+8+I.width<=innerWidth-q;s.style.left=`${At?j.right+8:Math.max(q,j.left-8-I.width)}px`,s.style.top=`${Math.min(Math.max(q,j.top-4),innerHeight-q-I.height)}px`,k.setAttribute("aria-describedby",s.id);return}let mt=j.bottom+Y+I.height<=innerHeight-q;s.style.top=`${mt?j.bottom+Y:Math.max(q,j.top-Y-I.height)}px`,s.style.left=`${Math.min(Math.max(q,j.left+j.width/2-I.width/2),innerWidth-q-I.width)}px`,s.classList.toggle("is-mono",k.classList.contains("dt-note-el")),k.setAttribute("aria-describedby",s.id)},H=()=>{clearTimeout(c),r&&!s.hidden&&(m=performance.now()+400),r?.removeAttribute("aria-describedby"),r=null,s.hidden=!0},M=k=>{k!==r&&(H(),g(k),r=k,performance.now()<m?T(k):c=setTimeout(()=>r===k&&T(k),300))};document.addEventListener("pointerover",k=>{let x=$(k.target);x?M(x):r&&!r.contains(k.target)&&H()},!0),document.addEventListener("pointerout",k=>{r&&!r.contains(k.relatedTarget)&&H()},!0),document.addEventListener("focusin",k=>{let x=k.target,F=$(x);F&&x.matches(":focus-visible")&&M(F)},!0),document.addEventListener("focusout",H,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("keydown",k=>{k.key==="Escape"&&H()},!0),addEventListener("scroll",H,!0),new MutationObserver(()=>{r&&(!r.isConnected||r.getAttribute("aria-expanded")==="true")&&H()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-expanded"]})}var nt={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>'},Si=(s,r)=>s.toLocaleTimeString("en-US",r),Uo=s=>Si(s,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),Pp={island:s=>({side:12,top:12,bottom:12,r:s.w>=430?62:55,body:s.w>=430?74:67,extraW:6}),home:()=>({side:18,top:92,bottom:92,r:0,body:56,extraW:6}),punch:()=>({side:9,top:9,bottom:9,r:34,body:43,extraW:6}),tablet:()=>({side:26,top:26,bottom:26,r:18,body:44}),macbook:s=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((s.w+32)*.12),extraH:18}),laptop:s=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((s.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function Ip(s,r,c,m,g){let $=s.w+2*r.side,T=s.h+r.top+r.bottom,H=(c-$)/2,M=`<rect class="dt-shell-screen" x="${g}" y="${r.top}" width="${s.w}" height="${s.h}" rx="${r.r}"/>`,k="";if(s.shell==="island"||s.shell==="home"||s.shell==="punch"){let x=(F,j,I)=>`<rect class="dt-shell-btn" x="${F}" y="${j}" width="4" height="${I}" rx="2"/>`;k+=s.shell==="punch"?x(H+$-1,150,70)+x(H+$-1,240,44):x(H-3,120,28)+x(H-3,170,56)+x(H-3,236,56)+x(H+$-1,190,90),k+=`<rect class="dt-shell-body" x="${H}" y="0" width="${$}" height="${T}" rx="${r.body}"/>`,k+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${$-6}" height="${T-6}" rx="${r.body-3}"/>`,s.shell==="home"&&(k+=`<rect class="dt-shell-slot" x="${c/2-26}" y="44" width="52" height="6" rx="3"/>`,k+=`<circle class="dt-shell-slot" cx="${c/2-48}" cy="47" r="5"/>`,k+=`<circle class="dt-shell-homebtn" cx="${c/2}" cy="${T-46}" r="28"/>`)}else if(s.shell==="tablet")k+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${$}" height="${T}" rx="${r.body}"/>`,k+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${$-8}" height="${T-8}" rx="${r.body-4}"/>`;else if(s.shell==="monitor"){let x=Math.round($*.1);k+=`<path class="dt-shell-stand" d="M${c/2-x/2} ${T-2}h${x}l${x*.2} 84h${-x*1.4}z"/>`,k+=`<rect class="dt-shell-stand" x="${c/2-$*.15}" y="${T+80}" width="${$*.3}" height="14" rx="7"/>`,k+=`<rect class="dt-shell-body" x="${H}" y="0" width="${$}" height="${T}" rx="${r.body}"/>`}else{let x=$+(r.extraW??0),F=(c-x)/2,j=r.extraH??16;k+=`<path class="dt-shell-body" d="M${H} ${r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${-r.body}h${$-2*r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${r.body}V${T}H${H}z"/>`,k+=`<path class="dt-shell-base${s.shell==="macbook"?" dt-shell-base--silver":""}" d="M${F} ${T}h${x}v${j-8}a8 8 0 0 1-8 8H${F+8}a8 8 0 0 1-8-8z"/>`,k+=`<rect class="dt-shell-lip" x="${c/2-$*.07}" y="${T}" width="${$*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${c} ${m}" width="${c}" height="${m}" aria-hidden="true">${k}${M}</svg>`}var Op={"safari-ios":s=>{let r=s.shell==="home"?20:s.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})},Dp=({d:s,now:r,cutout:c},m)=>{if(s.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${m}px"><span class="dt-sb-l">${nt.signal}${nt.wifi}</span><b>${Uo(r)}</b><span class="dt-sb-r">${nt.battery}</span></div>`;let g=c??{x:(s.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${m}px"><span class="dt-island" style="left:${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">${Uo(r)}</b><span class="dt-sb-icons" style="top:${g.y}px;height:${g.height}px">${nt.signal}${nt.wifi}${nt.battery}</span></div>`},qp=({d:s,host:r,min:c},m)=>{let g=s.shell==="home"?"":'<i class="dt-home-ind"></i>';return c?`<div class="dt-ios-bar is-min" style="height:${m}px"><span class="dt-ios-mini">${b(r)}</span>${g}</div>`:`<div class="dt-ios-bar" style="height:${m}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${nt.back}</button><span class="dt-glass dt-ios-url"><span>${b(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${nt.reload}</button></span><span class="dt-glass dt-glass--round">${nt.dots}</span></div>${g}</div>`},Fp=({now:s,min:r},c)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Si(s,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${nt.wifi}${nt.signal}${nt.battery}</span></div>`+(r?"":`<div class="dt-and-bar"><span class="dt-and-url">${nt.tune}<span>${b(c)}</span></span><span class="dt-and-tabs">1</span>${nt.dotsV}</div>`),jp=()=>`<div class="dt-and-nav">${nt.recent}${nt.home}${nt.navBack}</div>`,Wp=({now:s,host:r})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Uo(s)} ${s.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${nt.wifi}${nt.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${nt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${nt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${nt.fwd}</button></span><span class="dt-ipad-url">${nt.lock}<span>${b(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${nt.reload}</button></span><span class="dt-bar-group">${nt.share}${nt.plus}${nt.tabs}</span></div>`,_p=({now:s,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">${nt.wifi}${nt.battery}<span>${s.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${Uo(s)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${nt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${nt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${nt.fwd}</button></span><span class="dt-mac-url">${nt.lock}<span>${b(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${nt.reload}</button></span><span class="dt-bar-group">${nt.share}${nt.plus}${nt.tabs}</span></div>`,zp=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(s,r)=>`<i style="--hue:${r*40}"></i>`).join("")}</span></div>`,Gp=({host:s,title:r})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${b(r||s)}</span>${nt.close}</span><span class="dt-win-new">${nt.plus}</span><span class="dt-win-ctrl">${nt.winMin}${nt.winMax}${nt.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${nt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${nt.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${nt.reload}</button></span><span class="dt-win-url">${nt.tune}<span>${b(s)}</span>${nt.star}</span><span class="dt-bar-group">${nt.user}${nt.dotsV}</span></div>`,Vp=({now:s})=>`<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">${nt.chevUp}${nt.wifi}${nt.volume}${nt.battery}<span class="dt-win-clock">${Si(s,{hour:"numeric",minute:"2-digit"})}<br>${s.toLocaleDateString("en-US")}</span></span></div>`;function Jd(s,r){let c=Pp[s.shell](s),m=s.w+2*c.side,g=s.h+c.top+c.bottom,$=m+(c.extraW??0),T=g+(s.shell==="monitor"||s.shell==="macbook"||s.shell==="laptop"?c.extraH??0:0),H=($-m)/2+c.side,M=Op[s.browser](s),k=r.min?M.topMin??M.top:M.top,x=r.min?M.bottomMin??M.bottom:M.bottom,F={...r,d:s},j="",I="";switch(s.browser){case"safari-ios":j=Dp(F,k),I=qp(F,x);break;case"chrome-android":j=Fp(F,r.host),I=jp();break;case"safari-ipad":j=Wp(F),I='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":j=_p(F,s.shell==="macbook"),I=zp();break;case"chrome-windows":j=Gp(F),I=Vp(F);break}return{footprint:{w:$,h:T},screen:{x:H,y:c.top,w:s.w,h:s.h,r:c.r,rb:c.rb??c.r},topH:k,bottomH:x,shell:Ip(s,c,$,T,H),top:j,bottom:I,canMinimize:M.topMin!==void 0&&(M.topMin!==M.top||M.bottomMin!==M.bottom),scrollbar:s.browser==="chrome-windows"?"classic":"overlay"}}var jn=null;function zs(s){if(jn??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!jn||!s)return[0,0,0,0];jn.clearRect(0,0,1,1),jn.fillStyle="rgba(0, 0, 0, 0)",jn.fillStyle=s,jn.fillRect(0,0,1,1);let[r,c,m,g]=jn.getImageData(0,0,1,1).data;return[r,c,m,g/255]}var _s=([s,r,c])=>`rgb(${s}, ${r}, ${c})`;function Zd(s){let r=s.defaultView,c=I=>!I||zs(I)[3]===0,m=[s.body,s.documentElement].map(I=>I&&r.getComputedStyle(I).backgroundColor).find(I=>I&&!c(I)),[g,$,T,H]=m?zs(m):[255,255,255,1],M=[g,$,T].map(I=>Math.round(I*H+255*(1-H))),k=I=>{let[Y,q,mt,At]=zs(I);if(At>=.75)return _s([Y,q,mt]);let pt=(Z,it)=>Math.round(Z*At+it*(1-At));return _s([pt(Y,M[0]),pt(q,M[1]),pt(mt,M[2])])},x=I=>{let Y=s.elementFromPoint(r.innerWidth/2,I);for(;Y&&Y!==s.documentElement;Y=Y.parentElement){let q=r.getComputedStyle(Y);if(q.position!=="fixed"&&q.position!=="sticky")continue;let mt=Y.getBoundingClientRect().width>=r.innerWidth*.9,At=q.backdropFilter&&q.backdropFilter!=="none";return mt&&!At&&!c(q.backgroundColor)?k(q.backgroundColor):null}return null},F=s.querySelector('meta[name="theme-color"]')?.content||"",j=F&&!c(F)?_s(zs(F)):"";return{top:x(4)??_s(M),bottom:x(r.innerHeight-4)??_s(M),theme:j}}function Ti(s){let[r,c,m]=zs(s).map(g=>g/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4);return .2126*r+.7152*c+.0722*m>.4?"#000":"#fff"}function Qd(s){let{cfg:r,inFrame:c,persist:m,frame:g,frameEl:$,devicesMenu:T,bpBtns:H,notesOverlay:M,WIDE:k,bpOf:x,currentBp:F,deviceById:j,notesOn:I,filter:Y,filterTo:q,dropFrameDrafts:mt,putAway:At,tellFrame:pt,syncBpButtons:Z,render:it,reread:Lt}=s,Et=r.breakpoints,dt=document.querySelector(".dt-device"),Zt=document.querySelector(".dt-shell"),Yt=document.querySelector('.dt-chrome[data-at="top"]'),zt=document.querySelector('.dt-chrome[data-at="bottom"]'),E=document.querySelector(".dt-ruler"),h=[...document.querySelectorAll(".dt-frame-handle")],S=document.querySelector(".dt-frame-size"),R=document.querySelector(".dt-frame-rotate"),et=document.querySelector(".dt-frame-bars"),X="overlay",bt="",yt="dt-w",Dt="dt-canvas",ct="dt-device",Bt=st.getItem(Dt)==="1",gt=st.getItem(ct)||"";gt&&!j(gt)&&(gt="",st.setItem(ct,""));let Mt=Number(st.getItem(yt))||0,ae="dt-emu",St=(()=>{try{return JSON.parse(st.getItem(ae)||"null")}catch{return null}})(),Ye=()=>St?js.find(C=>C.id===St.id)??null:null,$n=()=>{let C=Ye();return C?St.turned?{w:C.h,h:C.w}:{w:C.w,h:C.h}:null},pe=st.getItem("dt-bars-min")==="1",xe=C=>{St=C,m(ae,C?JSON.stringify(C):"")},w=C=>{S.textContent=C,g.style.setProperty("--dt-badge-w",`${S.offsetWidth}px`)},y=C=>{if(!C){E.innerHTML="";return}let N="";for(let _=0;_<=C;_+=50)N+=`<span class="dt-tick${_%200===0?" is-major":""}" style="left:${_}px"></span>`;for(let _ of Et)for(let ut of[_.min,_.max])ut>0&&Number.isFinite(ut)&&ut<=C&&(N+=`<span class="dt-edge" style="left:${ut}px" title="${_.label} edge"></span>`);E.innerHTML=N,E.style.width=`${C}px`},L=()=>{let C=parseFloat(dt.style.width)||0,N=parseFloat(dt.style.height)||0;if(!C||!N){dt.style.transform="",delete dt.dataset.scaled;return}let _=gt||St?Math.min(1,(innerWidth-80)/C,(innerHeight-120)/N):Math.min(1,(innerWidth-80)/C);dt.style.transform=_<1?`scale(${_})`:"",dt.dataset.scaled=_<1?String(Math.round(_*100)):""},B=C=>js.find(N=>N.w===C.w&&N.h===C.h&&N.cutout?.shape==="pill")?.cutout,O=()=>{try{return $.contentDocument}catch{return null}},rt=()=>O()?.title.split("\u2014").pop()?.trim()||"",lt=()=>{let C=O(),N=gt?j(gt):null;if(!C?.body||!N)return;let _=Zd(C),ut=N.browser==="chrome-android"?_.theme||"rgb(255, 255, 255)":_.top,xt=N.browser==="chrome-android"?"rgb(255, 255, 255)":_.bottom;dt.style.setProperty("--dt-top",ut),dt.style.setProperty("--dt-top-ink",Ti(ut)),dt.style.setProperty("--dt-bottom",xt),dt.style.setProperty("--dt-bottom-ink",Ti(xt));let le=Yt.querySelector(".dt-win-tab > span");le&&(le.textContent=rt()||location.host)},Q=0;$.addEventListener("load",()=>{let C=O();if(!C)return;let N=window.__notemendHosted;if(N&&!$.contentWindow?.__notemendHosted&&!C.querySelector(`script[src^="${N.base}/bar.js"]`)){let _=C.createElement("script");_.src=`${N.base}/bar.js`,_.dataset.project=N.project,C.head.append(_)}lt(),$.contentWindow?.addEventListener("scroll",()=>{Q||(Q=requestAnimationFrame(()=>{Q=0,lt()}))},{passive:!0})});for(let C of[Yt,zt])C.addEventListener("click",N=>{let _=N.target.closest("[data-nav]")?.dataset.nav;if(_)try{let ut=$.contentWindow?.navigation;if(!O()||!ut)throw new Error("foreign");_==="back"?ut.canGoBack&&ut.back():_==="fwd"?ut.canGoForward&&ut.forward():ut.reload()}catch{(_==="reload"||_==="back")&&($.src=location.href)}});et.addEventListener("click",()=>{pe=!pe,m("dt-bars-min",pe?"1":"0"),ht()});let J=[],tt=C=>{for(let N of J)N.inert=!1;J=C?[...document.body.children].filter(N=>N instanceof HTMLElement&&!N.inert&&!N.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let N of J)N.inert=!0},ht=()=>{if(c)return;let C=gt?j(gt)??null:null;if(gt&&!C&&(gt="",st.setItem(ct,"")),!C&&!Bt){let N="";try{let _=$.getAttribute("src")?$.contentWindow?.location:null;_?.origin===location.origin&&(N=_.pathname+_.search+_.hash)}catch{}if(g.hidden=!0,tt(!1),$.removeAttribute("src"),Jt.toggle("dt-framing",!1),M.hidden=!I(),E.innerHTML="",Z(),R.hidden=!0,et.hidden=!0,q(null),bt="",mt(),Z(),te(),N&&N!==location.pathname+location.search+location.hash){location.assign(N);return}Lt();return}if(g.hidden=!1,tt(!0),Jt.toggle("dt-framing",!0),M.hidden=!0,$.src||($.src=location.href),C){let N=Jd(C,{host:location.host,title:rt(),now:new Date,min:pe,cutout:B(C)}),{screen:_}=N;g.dataset.mode="device",dt.dataset.shell=C.shell,dt.dataset.browser=C.browser,dt.style.width=`${N.footprint.w}px`,dt.style.height=`${N.footprint.h}px`,dt.style.setProperty("--dt-r",`${_.r}px`),dt.style.setProperty("--dt-rb",`${_.rb}px`),Zt.innerHTML=N.shell;let ut=(he,Ie,G,dn)=>{he.innerHTML=dn,he.style.cssText=`left:${_.x}px;top:${Ie}px;width:${_.w}px;height:${G}px`};ut(Yt,_.y,N.topH,N.top),ut(zt,_.y+_.h-N.bottomH,N.bottomH,N.bottom);let xt=_.h-N.topH-N.bottomH;$.style.position="absolute",$.style.left=`${_.x}px`,$.style.top=`${_.y+N.topH}px`,$.style.width=`${_.w}px`,$.style.height=`${xt}px`,E.innerHTML="";let le=pe&&N.canMinimize;X=N.scrollbar,bt=`${C.label}${le?" \xB7 bars folded":""}`,q(x(C.w)),pt({notes:I(),scrollbar:X,device:bt}),et.hidden=!N.canMinimize,et.setAttribute("aria-pressed",String(le)),w(`${C.label} ${C.w}\xD7${C.h} \xB7 page ${C.w}\xD7${xt}${le?" \xB7 bars folded":""} \xB7 ${Et.find(he=>he.id===Y())?.label??""}`),lt()}else{let N=$n();N||xe(null);let _=N?.w||Mt||Et.find(le=>le.id===F()).ideal;Mt=_,g.dataset.mode="canvas",delete dt.dataset.shell,delete dt.dataset.browser,Zt.innerHTML=Yt.innerHTML=zt.innerHTML="",Yt.style.cssText=zt.style.cssText="",et.hidden=!0,X="overlay",dt.style.width=`${_}px`,dt.style.height=`${N?.h??innerHeight-84}px`,$.style.position="",$.style.left=$.style.top="",$.style.width="100%",$.style.height="100%",y(_),pt({notes:I()});let ut=Et.find(le=>le.id===x(_)),xt=Ye();bt=xt?`${xt.label}${St?.turned?" \xB7 landscape":""}`:"",pt({scrollbar:X,device:bt}),w(xt&&N?`${xt.label} \xB7 ${N.w}\xD7${N.h} \xB7 ${ut.label}`:`${_}px \xB7 ${ut.label}`),q(x(_))}R.hidden=!(Ye()?.rotates&&!C),te(),L(),Z(),Lt()},vt=C=>{let N=Et.find(_=>_.id===C);gt="",st.setItem(ct,""),xe(null),Bt=F()!==C,Mt=Bt?N.ideal:0,q(Bt?C:null),st.setItem(Dt,Bt?"1":"0"),st.setItem(yt,String(Mt)),At(),ht()};for(let C of H)C.addEventListener("click",()=>vt(C.dataset.bp));for(let C of document.querySelectorAll("[data-device]"))C.addEventListener("click",()=>{gt=C.dataset.device===gt?"":C.dataset.device,st.setItem(ct,gt),T.open=!1,ht()});for(let C of document.querySelectorAll("[data-emu]"))C.addEventListener("click",()=>{let N=St?.id===C.dataset.emu&&!gt;gt="",st.setItem(ct,""),xe(N?null:{id:C.dataset.emu,turned:!1}),Bt=!N,Mt=0,st.setItem(Dt,Bt?"1":"0"),q(null),At(),T.open=!1,ht()});R.addEventListener("click",()=>{St&&(xe({...St,turned:!St.turned}),At(),ht())});let Gt=[...T.querySelectorAll("[data-tab]")],ie=[...T.querySelectorAll("[data-panel]")],Vt=C=>{for(let N of Gt)N.setAttribute("aria-selected",String(N.dataset.tab===C));for(let N of ie)N.hidden=N.dataset.panel!==C;m("dt-devices-tab",C)};for(let C of Gt)C.addEventListener("click",()=>Vt(C.dataset.tab));Vt(st.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let Ct=T.querySelector(".dt-emu-search");Ct.addEventListener("input",()=>{let C=Ct.value.trim().toLowerCase(),N=null,_=!1,ut=()=>{N&&(N.hidden=!_)};for(let xt of Ct.parentElement.children){if(xt.classList.contains("dt-devices-group")){ut(),N=xt,_=!1;continue}xt.dataset.emu&&(xt.hidden=!!C&&!xt.textContent.toLowerCase().includes(C),_||=!xt.hidden)}ut()});let It=T.querySelector(".dt-devices-name");function te(){for(let N of T.querySelectorAll("[data-device]"))N.setAttribute("aria-pressed",String(N.dataset.device===gt));let C=!gt&&!g.hidden?St?.id:void 0;for(let N of T.querySelectorAll("[data-emu]"))N.setAttribute("aria-pressed",String(N.dataset.emu===C));It.textContent=gt&&j(gt)?.label||C&&Ye()?.label||"Device"}let ot=C=>Et.find(N=>N.id===C),qt=C=>{let N=ot(Y()??F());return Math.max(N.min||320,Math.min(Number.isFinite(N.max)?N.max:2560,Math.round(C)))};for(let C of h){let N=C.dataset.edge==="l"?-1:1;C.addEventListener("pointerdown",_=>{if(gt)return;_.preventDefault(),St&&(xe(null),ht()),C.setPointerCapture(_.pointerId);let ut=_.clientX,xt=Mt,le=Number(dt.dataset.scaled||100)/100;g.dataset.dragging="1";let he=G=>{Mt=qt(xt+N*(G.clientX-ut)*2/le),dt.style.width=`${Mt}px`,y(Mt),w(`${Mt}px \xB7 ${ot(x(Mt)).label}`),L()},Ie=()=>{C.removeEventListener("pointermove",he),C.removeEventListener("pointerup",Ie),C.removeEventListener("pointercancel",Ie),delete g.dataset.dragging,st.setItem(yt,String(Mt)),ht()};C.addEventListener("pointermove",he),C.addEventListener("pointerup",Ie),C.addEventListener("pointercancel",Ie)}),C.addEventListener("dblclick",()=>{if(gt)return;xe(null);let _=ot(Y()??F()),ut=[_.min||320,Number.isFinite(_.max)?_.max:_.ideal];Mt=Math.abs(Mt-ut[0])<Math.abs(Mt-ut[1])?ut[0]:ut[1],st.setItem(yt,String(Mt)),ht()})}let ln=F(),Pe=()=>{let C=Et.find(N=>N.id===k);return Bt&&!gt&&!St&&Mt===C.ideal&&innerWidth>=C.min};return addEventListener("resize",()=>{if(Pe()){vt(k);return}Z(),F()!==ln&&(ln=F(),it()),g.hidden||(!gt&&!St&&(dt.style.height=`${innerHeight-84}px`),L())}),{apply:ht,pickBp:vt,look:()=>({scrollbar:X,device:bt}),restore:()=>{Pe()?vt(k):Bt||gt?ht():te()}}}var tc='<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>',Up='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function ec(s){let{bp:r,notes:c,breakpoints:m,bandOfNote:g,statusTools:$,showResolved:T,showArchived:H,drafts:M,find:k}=s,x=c.filter(h=>g(h)===r),F=h=>[h.text,h.note,h.byName,...(h.replies??[]).filter(S=>!S.deleted).map(S=>S.text)].join(" ").toLowerCase(),j=h=>k.view==="me"?s.forMe(h):k.view==="agent"?s.forAgent(h):!0,I=h=>Date.parse(h.updatedAt||h.createdAt||"")||0,Y=x.filter(h=>j(h)&&(!k.q||F(h).includes(k.q.trim().toLowerCase()))).sort((h,S)=>(k.sort==="unread"?Number(s.unread(S))-Number(s.unread(h)):0)||I(S)-I(h)),q={open:[],claude:[],done:[],archived:[]};for(let h of Y)q[kt(h)==="done"&&s.archived(h)?"archived":kt(h)].push(h);let mt=h=>{let S=(h.replies??[]).filter(Dt=>!Dt.deleted),R=kt(h),et=s.orphan(h),X=S.length?S[S.length-1]:h.note?{author:"claude",text:h.note}:{author:"you",text:h.text},bt=(Dt,ct)=>Dt.by&&ct.by?Dt.by===ct.by:Dt.byName===ct.byName,yt=s.unread(h);return`<div class="dt-hist-row is-${R}${R==="done"?s.archived(h)?" is-archived":" is-resolved":""}${et?" is-orphan":""}${yt?" is-unread":""}">
|
|
185
|
+
<button class="dt-hist-go" data-go="${h.id}">
|
|
186
|
+
${s.marker(h)}
|
|
170
187
|
<span class="dt-hist-body">
|
|
171
|
-
<span class="dt-hist-id"><b class="dt-hist-who">${
|
|
172
|
-
<span class="dt-hist-text">${
|
|
188
|
+
<span class="dt-hist-id"><b class="dt-hist-who">${b(h.byName||"You")}</b><em>\xB7 ${nn(h.updatedAt||h.createdAt)}</em>${yt?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
|
|
189
|
+
<span class="dt-hist-text">${X.author!=="claude"&&S.length&&!bt(X,h)?`<b class="dt-hist-by">${b(X.byName||"Someone")}:</b> `:""}${b(vd(X.text))}</span>
|
|
173
190
|
</span>
|
|
174
191
|
</button>
|
|
175
|
-
<span class="dt-note-tools dt-hist-tools">${
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
<span class="dt-hist-n">${Vn}</span>
|
|
192
|
+
${s.step(h)}<span class="dt-note-tools dt-hist-tools">${s.assign(h)}<span class="dt-hist-well">${$(h)}${s.deletable(h)?`<button data-rm="${h.id}" title="Delete this thread">${In}</button>`:""}</span></span>
|
|
193
|
+
</div>`},At=m.map(h=>{let S=c.filter(R=>g(R)===h.id&&kt(R)!=="done");return{band:h,open:S.filter(R=>kt(R)==="open").length,total:S.length}}).filter(h=>h.total&&h.band.id!==r),pt=At.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${At.map(({band:h,open:S,total:R})=>{let et=`${h.label}: ${S} open \xB7 ${R-S} to check`;return`<button data-bp="${h.id}" data-state="${S?"open":"claude"}" title="${et}" aria-label="${et}"
|
|
194
|
+
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${h.icon}</svg><i>${R}</i></button>`}).join("")}</div>`:"",Z=["open","claude","done","archived"],it={...Od,archived:"Archived"},Lt=(h,S,R)=>`<button type="button" class="dt-hist-gfold" data-gfold="${h}" aria-expanded="${!s.shut(h)}"
|
|
195
|
+
><svg viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${s.shut(h)?"m9 18 6-6-6-6":"m6 9 6 6 6-6"}"/></svg>${Et[h]??""}${S}<em>${R}</em></button>`,Et={open:$e("#0d99ff",0),claude:$e("#8e4ec6",.5),done:$e("#30a46c",1)},dt=Z.filter(h=>q[h].length&&(h==="done"?T:h==="archived"?H:!0)),Zt=h=>`<div class="dt-hist-row is-draft">
|
|
196
|
+
<button class="dt-hist-go" data-draft-go="${h.i}">
|
|
197
|
+
${s.draftFace||`<span class="dt-hist-n">${On}</span>`}
|
|
182
198
|
<span class="dt-hist-body">
|
|
183
|
-
<span class="dt-hist-id">${
|
|
184
|
-
<span class="dt-hist-text">${
|
|
199
|
+
<span class="dt-hist-id">${s.draftFace?`<b class="dt-hist-who">${b(s.draftName)}</b><em>\xB7 draft \xB7 ${b(h.el)}</em>`:b(h.el)}${h.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
|
|
200
|
+
<span class="dt-hist-text">${h.text?b(h.text):`${h.shots} screenshot${h.shots===1?"":"s"}`}</span>
|
|
185
201
|
</span>
|
|
186
|
-
</button
|
|
187
|
-
<span class="dt-note-tools dt-hist-tools"><button data-draft-rm="${
|
|
188
|
-
</div>`,
|
|
189
|
-
<label class="dt-hist-search">${
|
|
190
|
-
<button type="button" class="dt-tip-r dt-hist-filter${
|
|
191
|
-
${
|
|
202
|
+
</button>${s.draftFace?`<span class="dt-hist-step" role="img" aria-label="Draft, not sent"><span class="dt-hist-n">${On}</span></span>`:""}
|
|
203
|
+
<span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${h.i}" title="Discard this draft">${In}</button></span></span>
|
|
204
|
+
</div>`,Yt=x.filter(h=>kt(h)!=="done"),zt=(h,S,R,et,X)=>`<button type="button" role="menuitemradio" aria-checked="${et}" ${h}="${S}"><i>${et?re:""}</i><span>${R}</span>${X==null?"":`<em>${X}</em>`}</button>`,E=()=>`<div class="dt-hist-find">
|
|
205
|
+
<label class="dt-hist-search">${tc}<input type="search" data-hist-q placeholder="Search threads" aria-label="Search threads" value="${b(k.q)}" spellcheck="false">${k.q?`<button type="button" data-hist-clear aria-label="Clear search">${on}</button>`:'<kbd aria-hidden="true">/</kbd>'}</label>
|
|
206
|
+
<button type="button" class="dt-tip-r dt-hist-filter${k.view!=="all"||k.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${k.menu}" data-tip="Filter">${Up}</button>
|
|
207
|
+
${k.menu?`<div class="dt-hist-menu" role="menu">${zt("data-hist-view","me","For me",k.view==="me",Yt.filter(s.forMe).length)}${zt("data-hist-view","agent","Agent",k.view==="agent",Yt.filter(s.forAgent).length)}${zt("data-hist-view","all","All",k.view==="all",Yt.length)}<hr>${zt("data-hist-sort","new","Newest",k.sort==="new")}${zt("data-hist-sort","unread","Unread first",k.sort==="unread")}</div>`:""}
|
|
192
208
|
</div>`;return`<div class="dt-hist-head">
|
|
193
|
-
<span class="dt-hist-here"
|
|
194
|
-
><svg viewBox="0 0 20 20" width="
|
|
209
|
+
<span class="dt-hist-here"
|
|
210
|
+
><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>
|
|
195
211
|
<span class="dt-hist-title">Threads</span>
|
|
196
|
-
${
|
|
197
|
-
${
|
|
198
|
-
|
|
199
|
-
|
|
212
|
+
${s.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>Clients</span>':""}
|
|
213
|
+
${pt}
|
|
214
|
+
${s.checks&&!s.clients?`<button class="dt-review-btn" data-review aria-label="Check all ${s.checks} ${s.checks===1?"fix":"fixes"}" data-tip="${s.checks} ${s.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${s.checks}</button>`:""}
|
|
215
|
+
<button class="dt-hist-refresh" data-refresh aria-label="Load the latest threads">
|
|
216
|
+
<svg viewBox="0 0 24 24" width="13" height="13" aria-hidden="true"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></svg>
|
|
200
217
|
</button>
|
|
201
|
-
<button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel">
|
|
218
|
+
<button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel" aria-expanded="${!s.folded}">
|
|
202
219
|
<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>
|
|
203
220
|
</button>
|
|
204
|
-
</div>`+
|
|
205
|
-
<button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${
|
|
221
|
+
</div>`+(s.folded?"":E()+(dt.length||M.length?`<div class="dt-hist-list">${M.length?`<p class="dt-hist-group">${Lt("drafts","Drafts",M.length)}</p>${s.shut("drafts")?"":M.map(Zt).join("")}`:""}${dt.map(h=>`<p class="dt-hist-group">${Lt(h,it[h],q[h].length)}${h==="done"&&s.archives?`<button type="button" class="dt-tip-r dt-hist-archive-all" data-archive-all="${q.done.map(S=>S.id).join(",")}" data-tip="Archive every resolved thread here">${sn}Archive all</button>`:""}</p>`+(s.shut(h)?"":q[h].map(mt).join(""))).join("")}</div>`:k.q.trim()?`<div class="dt-hist-empty">${tc}<p>No threads match \xAB${b(k.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:k.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>${q.done.length||q.archived.length?"<b>Everything here is resolved.</b>":"<b>No threads at this breakpoint yet</b><p>Click anything on the page to leave one.</p>"}</div>`)+`<div class="dt-hist-foot">
|
|
222
|
+
<button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${T}"
|
|
206
223
|
><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
|
|
207
224
|
><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
208
|
-
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${
|
|
209
|
-
>${
|
|
210
|
-
</div>`}function
|
|
211
|
-
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${
|
|
212
|
-
<span class="dt-review-n">${
|
|
213
|
-
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${
|
|
214
|
-
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${
|
|
215
|
-
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${
|
|
216
|
-
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Pe}</button>`,Y.hidden=!1};Y.addEventListener("click",async L=>{let j=L.target.closest("[data-r]"),I=Q();if(!j||!I)return;if(j.dataset.r==="stop"){_(null),Y.hidden=!0;return}if(j.dataset.r==="prev"){W();return}let rt=I.ids[I.i];_({...I,i:I.i+1});let ot=l().find(Ht=>Ht.id===rt),Pt=j.dataset.r==="ok"&&ot?$(ot):j.dataset.r==="no"?v(rt,!1):null;A(),await Pt});let W=()=>{let L=Q();if(L){for(let j=L.i-1;j>=0;j--)if(y(L.ids[j])){_({...L,i:j}),A();return}}};return document.addEventListener("keydown",L=>{Y.hidden||L.metaKey||L.ctrlKey||L.altKey||L.key!=="ArrowLeft"&&L.key!=="ArrowRight"||L.target.closest?.("input, textarea, select, [contenteditable]")||(L.preventDefault(),L.key==="ArrowLeft"?W():Y.querySelector('[data-r="skip"]')?.click())}),{start:P,toCheck:ht,resume:()=>{Q()&&A()}}}function Ar(n,i){let l=null,u=null,p=document.querySelector(".dt-turbo"),v="/notemend:turbo",k=()=>{let H=!!l&&Date.now()-Date.parse(l.at)<18e4,f=H?l.mode==="push"?"push":u?.paused?"paused":"on":"none",$=H?vn(l.agent):"",y=f==="none"?`Turbo is off. Run ${v} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:f==="push"?`Push mode: ${$} takes comments when you press Push to Claude. For live, run ${v} instead`:f==="on"?`Turbo on: ${$} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${$} is listening but waits \u2014 click to resume`;p.dataset.state=f,p.dataset.tip=y,p.setAttribute("aria-label",y),p.setAttribute("aria-checked",String(f==="on")),n&&(p.hidden=!0)};return setInterval(k,3e4),p.addEventListener("click",async()=>{let H=p.dataset.state;if(H==="none"||H==="push"){await navigator.clipboard?.writeText(v).catch(()=>{}),i(`Copied ${v} \u2014 paste it in Claude Code`);return}let f=H==="on"?"off":"on";u={paused:f==="off"},k();try{let $=await Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:f})});if(!$.ok)throw new Error(String($.status));i(f==="off"?"Turbo paused":"Turbo on")}catch{u={paused:f==="on"},k(),i("Could not switch turbo \u2014 try again")}}),H=>{l=H.listening??null,u=H.turbo??null,k()}}var jd=new Set(["data-wired"]),Yn=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}`:null},Cr=(n,i)=>n.nodeType===i.nodeType&&n.nodeName===i.nodeName&&Yn(n)===Yn(i);function _d(n,i){for(let{name:l}of[...n.attributes])!i.hasAttribute(l)&&!jd.has(l)&&n.removeAttribute(l);for(let{name:l,value:u}of i.attributes)n.getAttribute(l)!==u&&n.setAttribute(l,u);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 Hr(n,i){let l=[...n.childNodes],u=new Map;for(let f of l){let $=Yn(f);$&&u.set($,f)}let p=new Set,v=0,k=[];for(let f of[...i.childNodes]){let $=Yn(f),y=$?u.get($):void 0;if(!$){for(;v<l.length&&(p.has(l[v])||Yn(l[v]));)v++;v<l.length&&Cr(l[v],f)&&(y=l[v++])}y&&!p.has(y)&&Cr(y,f)?(p.add(y),Wd(y,f),k.push(y)):k.push(f)}for(let f of l)p.has(f)||n.removeChild(f);let H=n.firstChild;for(let f of k){if(f===H){H=H.nextSibling;continue}n.insertBefore(f,H)}}function Wd(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(_d(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}Hr(n,i),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==i.value&&(n.value=i.value)}}function Xo(n,i){let l=document.createElement("template");l.innerHTML=i,Hr(n,l.content)}function Nr(n,i){let l=n.breakpoints,u=n.categories,p=(l.find(t=>!Number.isFinite(t.max))??l[0]).id,v=t=>l.find(e=>t>=e.min&&t<=e.max)?.id??p,k=t=>t.breakpoint||p,H=t=>n.devices.find(e=>e.id===t),f=Ns,$=(t,e)=>{f||st.setItem(t,e)},y=t=>Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),R=t=>t.replace(/\/+$/,"")||"/",Q=R(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 _=document.querySelector(".dt-grid-btn"),Y=document.querySelector(".dt-grid-overlay"),ht="dt-grid",P=()=>{let t=Y.querySelector(".dt-overlay-grid");if(Y.classList.remove("is-auto"),getComputedStyle(t).display==="grid")return;let e=0,s=0;for(let o of[...document.body.querySelectorAll("*")].slice(0,600)){if(o.closest(be)||getComputedStyle(o).maxWidth==="none")continue;let a=o.getBoundingClientRect();a.left<=0||Math.abs(a.left-(document.documentElement.clientWidth-a.right))>2||a.width>e&&(e=a.width,s=a.left)}e||(s=24,e=innerWidth-48),Y.classList.add("is-auto"),Y.style.setProperty("--grid-x",`${s}px`),Y.style.setProperty("--grid-w",`${e}px`),Y.style.setProperty("--grid-gap",innerWidth<768?"16px":"24px")},A=t=>{Y.hidden=!t,t&&P(),_.setAttribute("aria-pressed",String(t)),$(ht,t?"1":"0"),ee({grid:t})};_.addEventListener("click",()=>A(Y.hidden===!0)),addEventListener("resize",()=>{Y.hidden||P()});let W=document.querySelector(".dt-pages-name"),L=()=>{let t=null;for(let r of document.querySelectorAll(".dt-pages a"))R(new URL(r.href).pathname)===Q?(r.setAttribute("aria-current","page"),t=r):r.removeAttribute("aria-current");let e=document.title.split("\u2014").pop()?.trim(),o=t?.querySelector(".dt-menu-label")?.textContent?.trim()||e||W.textContent||"",a=o.trim().split(/\s+/);W.textContent=a.length>3?`${a.slice(0,3).join(" ")}\u2026`:o,a.length>3?W.title=o:W.removeAttribute("title")};L();let j=[...document.querySelectorAll(".devtools details")],I=!1,rt=()=>{let t=j.filter(e=>e.open);for(let e of t)e.open=!1;return t};document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=rt();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{I=j.some(e=>e.open&&!e.contains(t.target))&&rt().length>0},!0),addEventListener("blur",rt);let ot=document.querySelector(".dt-pad-overlay"),Pt="dt-inspect",Ht=[".devtools",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),St=[".devtools",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),zt={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),border:document.querySelector(".dt-border-btn")},E="",pt=0,{spacer:wt,drawPads:Ot,drawSize:Vt,drawType:w,drawColor:m,drawBorder:M}=br(ot),B=null,D=()=>{B&&E&&z(B)},z=t=>{B=t,!pt&&(pt=requestAnimationFrame(()=>{pt=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(Ht)){ot.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),E==="sizes"?Vt(e):E==="type"?w(e):E==="color"?m(e):E==="border"?M(e):Ot(t.altKey?e:wt(e))}))},U=t=>{E=t;for(let[e,s]of Object.entries(zt))s.setAttribute("aria-pressed",String(e===t));$(Pt,t),ee({inspect:t}),ot.hidden=!t,ot.innerHTML="",t?(document.addEventListener("mousemove",z),addEventListener("scroll",D,!0)):(document.removeEventListener("mousemove",z),removeEventListener("scroll",D,!0))};for(let[t,e]of Object.entries(zt))e.addEventListener("click",()=>{t!==E&&he(!1),U(E===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||$t)return;let e=t.target;e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??"")||(E?(U(""),t.preventDefault()):Y.hidden||(A(!1),t.preventDefault()))});let tt=document.querySelector(".dt-notes-btn"),X=[...document.querySelectorAll(".dt-bp")],at=document.querySelector(".dt-history-btn"),ct=document.querySelector(".dt-history"),kt=document.querySelector(".dt-studio-btn"),Nt=document.querySelector(".dt-devices"),Bt=document.querySelector(".dt-notes-hi"),sn=Bt.querySelector(".dt-hi-box"),fe=Bt.querySelector(".dt-hi-tag"),Kt=document.querySelector(".dt-frame"),vt=document.createElement("div");vt.className="dt-spot",vt.hidden=!0,vt.setAttribute("aria-hidden","true"),document.body.append(vt);let Oe=t=>{if(!t||!$t){vt.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;vt.style.setProperty("--spot-x",`${e.left-s}px`),vt.style.setProperty("--spot-y",`${e.top-s}px`),vt.style.setProperty("--spot-w",`${e.width+s*2}px`),vt.style.setProperty("--spot-h",`${e.height+s*2}px`),vt.hidden&&(Bt.hidden=!0),vt.hidden=!1},Ae=Kt.querySelector("iframe"),Ie=document.querySelector(".dt-notes-count"),K=document.querySelector(".dt-notes-overlay"),be=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",on=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(be).forEach(on);let Xn="dt-notes",G=[],$t=!1,nt=null,S=null,De=0,jt="",Jn=(t,e,s)=>{if(s>160&&s<innerHeight-120)return!1;let o=document.elementsFromPoint(e,s).find(a=>!qs(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},xn=new WeakSet,x=null,T={};K.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 T[s.dataset.id],s.remove())},!0);let O=[],J=null,dt=[],_t=10,Ut=(t=S)=>!!(t&&((t.text?.trim().length??0)>=_t||t.images?.length)),Tt=()=>{S&&Ut()&&dt.push(S),S=null},an=0,qe=()=>{if(!Ut()||performance.now()-an<4e3)return!0;an=performance.now();let t=K.querySelector(".dt-note[data-draft]");return t&&!matchMedia("(prefers-reduced-motion: reduce)").matches&&t.animate([0,-6,6,-4,4,0].map(e=>({transform:`translateX(${e}px)`})),{duration:320,easing:"ease-out",composite:"add"}),t?.querySelector(".dt-note-input")?.focus(),Lt("Not sent \u2014 close again to keep it as a draft",2400),!1},rn=null,js=null,Jo=()=>`dt-draft:${n.me?.email??""}:${Q}${f?":canvas":""}`,ln=Jo(),Zn=0,En=()=>{if(!S&&!dt.length&&!jt){st.removeItem(ln);return}let t={draft:S,parked:dt,reply:jt?{for:rn,text:jt}:null};try{localStorage.setItem(ln,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(ln,JSON.stringify({...t,draft:S&&e(S),parked:dt.map(e)}))}catch{}}},Mn=()=>{clearTimeout(Zn),Zn=setTimeout(En,200)};addEventListener("pagehide",()=>{clearTimeout(Zn),En()});let ye=st.getItem("dt-space")==="clients"?"clients":"studio",Ce=()=>!!n.me&&!n.client,dn=t=>!Ce()||ye==="clients"===Mt(t),Zo=["all","nobody","mine","others","claude","wrote","check"],le=Zo.find(t=>t===st.getItem("dt-pinf"))??"all",_s=()=>{},Qn=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Zt=st.getItem("dt-resolved")!=="0",ve=st.getItem("dt-archived")==="1",oe=t=>rr(t,n.autoArchive),Qo=t=>oe(t)?ve:bt(t)!=="done"||Zt,Gt={q:"",menu:!1,view:["me","agent"].includes(st.getItem("dt-view")??"")?st.getItem("dt-view"):"all",sort:st.getItem("dt-sort")==="unread"?"unread":"new"},Or=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Ir=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Dr=()=>{let t=navigator.userAgent,e=r=>r.find(([d])=>d.test(t)),s=e(Or),o=e(Ir),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},Ws=()=>v(innerWidth),we=()=>js??Ws(),ta=()=>{let t=we();for(let e of X)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:ea,poolOf:na,contextOf:sa,resolveEl:qr,anchorOf:Fr}=vr(),zs=new Map,oa=()=>{zs=new Map},de=t=>{let e=JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth]),s=zs.get(e);return(s===void 0||s&&!s.isConnected)&&(s=qr(t),zs.set(e,s)),s},ts=new Map,Qt=t=>{ts.size||requestAnimationFrame(()=>ts.clear());let e=ts.get(t);return e===void 0&&(e=Fr(t,de(t)),ts.set(t,e)),e},aa=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},es=[],Vs=t=>{for(let e of es)e.play();es=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),es.push(s))},Ks=()=>{if(S)return de(S);let t=nt!=null?G.find(s=>s.id===nt):null;if(!t)return null;let e=Qt(t);return e&&!e.off&&!e.hidden?de(t):null},Us="claude",ia=()=>n.client||It()||ye==="clients"?n.team??[]:is(),jr=()=>ia().filter(t=>t.email!==n.me?.email),Fe=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...jr()],ra='<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>',la=(t,e,s=!1)=>{let o=At(t)?"agent":t?"person":"nobody",a=$e(o==="person"?t:Gs()),r=[["person",a?cn(a.avatar_url,a.name||a.email):no,o==="person"?`${je(t)==="you"?"You":je(t)} \u2014 pick someone else`:a?`Give it to ${a.email===n.me?.email?"me":a.name||a.email}`:"A person"],["nobody",ra,"Anyone \u2014 nobody has taken it yet"],["agent",Wt(12),s?"Waits for the studio to approve it":o==="agent"?"Claude does it":"Give it to Claude"]],d=e!=null?G.find(h=>h.id===e):void 0,b=o==="agent"&&d?Zs[se(d)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${b?` style="--step-c:${b}"`:""}>${r.filter(([h])=>h!=="person"||o==="person"||Fe().length).map(([h,N,V])=>h===o?`<span class="dt-hand-stop dt-hand-stop--${h} is-on" role="radio" aria-checked="true" data-tip="${g(V)}" aria-label="${g(V)}">${h==="person"?Kr(t,e):N}</span>`:`<button type="button" class="dt-hand-stop dt-hand-stop--${h}" role="radio" aria-checked="false" data-act="hand" data-v="${h}"${e?` data-id="${e}"`:""} data-tip="${g(V)}" aria-label="${g(V)}"${h==="agent"&&s?" disabled":""}>${N}</button>`).join("")}</span>`},Gs=()=>{let t=Wr();return t&&!At(t)&&Fe().some(e=>e.email===t)?t:Fe()[0]?.email??""},_r=()=>{let t=K.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},da="cubic-bezier(0.32, 0.72, 0, 1)",ca=t=>{let e=K.querySelector(".dt-hand .dt-hand-stop.is-on");if(!t||!e||matchMedia("(prefers-reduced-motion: reduce)").matches)return;let s=e.getBoundingClientRect(),o=document.createElement("span");o.className="dt-hand dt-hand-ghost",o.style.cssText=`left:${t.rect.left}px;top:${t.rect.top}px;width:${t.rect.width}px;height:${t.rect.height}px`,t.ghost.querySelectorAll("select").forEach(a=>a.tabIndex=-1),o.append(t.ghost),K.append(o),o.animate([{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(()=>o.remove(),()=>o.remove()),fo=performance.now()+480,e.animate([{transform:`translateX(${t.rect.left-s.left}px)`,width:`${t.rect.width}px`},{transform:"none",width:`${s.width}px`}],{duration:460,easing:da});for(let a of e.children)a.animate([{opacity:0,transform:"scale(0.92)",filter:"blur(3px)"},{opacity:0,transform:"scale(0.92)",filter:"blur(3px)",offset:.4},{opacity:1,transform:"none",filter:"blur(0)"}],{duration:460,easing:da});for(let a of e.parentElement?.querySelectorAll("button.dt-hand-stop")??[])a.animate([{opacity:0},{opacity:1}],{duration:300,delay:140,easing:"ease-out",fill:"backwards"})},ua=(t,e)=>{let s=fo>performance.now()?void 0:_r(),o=e==="agent"?Us:e==="person"?Gs():e==="me"?n.me?.email??"":"";if(!t){if(!S)return;S.assignee=o,S.stage=At(o)?"approved":!S.stage||S.stage==="approved"?"new":S.stage,e==="person"&&st.setItem("nm-for",o),Xs(o),Mn(),et(),ca(s);return}Ys(t,o),ca(s)},Ys=(t,e)=>{let s=G.find(r=>r.id===t);if(s&&Re(s)&&!At(e)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?Jt(s):"new",a=At(e)?"approved":o==="approved"?"new":o;te(r=>r.map(d=>d.id===t?{...d,assignee:e||void 0,stage:a}:d),()=>y({id:t,assignee:e||null,stage:a}),At(e)?"Approving it for the agent":"Reassigning")},Wr=()=>st.getItem("nm-for")??"",Xs=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e!==null&&(e===""||e===Us||Fe().some(s=>s.email===e))?e:null}catch{return null}},ns=t=>At(t)?"#d97757":t?"#0d99ff":"#717171",je=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],$e=t=>t?n.team?.find(e=>e.email===t):void 0,pa=t=>{let e=Rt(t??"").split(/\s+/).filter(Boolean);return g(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},cn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${g(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${pa(e)}</b>`,ha=t=>{let e=$e(t.by);return e||t.byName?cn(e?.avatar_url,e?.name||t.byName||t.by):""},kn=t=>`var(--dt-avatar-${[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,ma=(t,e)=>{let s=$e(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return cn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${kn(t)}" `)},Js=(t,e)=>$e(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],Zs={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},_e=(()=>{try{return JSON.parse(st.getItem("dt-seen")||"{}")}catch{return{}}})(),ga=()=>$("dt-seen",JSON.stringify(_e)),Qs=t=>{let e=Se(t);if(!(t.id in _e))return _e[t.id]=e.length,ga(),!1;let s=e[e.length-1];return e.length>_e[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},zr=t=>{let e=Se(t).length;_e[t.id]!==e&&(_e[t.id]=e,ga())},to=t=>{let e=$e(t);return e?` data-face="${g(e.avatar_url??"")}" data-initial="${pa(e.name||e.email)}"`:""},fa=t=>n.client||It()||Mt(t)||bt(t)==="done"?"":`<span class="dt-hist-hand">${la(t.assignee??"",t.id)}</span>`,We=(t,e)=>vn(t),ba=t=>{let e=$e(t);return e?cn(e.avatar_url,e.name||e.email):""},Vr=t=>{let e=$e(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${g(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${Wt(12)}</b>`},Kr=(t,e)=>{let s=(a,r)=>`<option value="${g(a)}" data-c="${ns(a)}"${to(a||null)}${t===a?" selected":""}>${g(r)}</option>`,o=ia().filter(a=>a.email!==n.me?.email);return`<label class="dt-field dt-field--knob"><span class="dt-field-box dt-field-box--face" style="--cat:${ns(t)}">${ba(t||null)||no}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
|
|
217
|
-
${
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
`).find(s=>Rt(s))??"");return e?e.length>30?`${e.slice(0,30)}\u2026`:e:t?.tagName.toLowerCase()??""},no='<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>',nl='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="8.5" cy="6.8" r="3"/><path d="M2.8 16.5c.6-3 3-4.8 5.7-4.8 1.3 0 2.5.4 3.5 1.1M15.5 11v5M13 13.5h5" stroke-linejoin="round"/></svg>',Ea='<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>',so='<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>',Ma='<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>',ka='<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>',La=t=>{let e=(a,r,d,b="")=>`<option value="${a}" data-icon="${g(r)}"${b}>${d}</option>`,s=t&&Ce()?Mt(t)?e("dup",so,"Duplicate to workspace")+(t.client?"":e("move",Ma,"Move to workspace")):e("dup",so,"Duplicate for the client")+e("move",Ma,"Move to clients"):"",o=t&&n.client&&t.status==="done"?e("reopen",Te,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${Ea}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
|
|
225
|
+
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${H}"
|
|
226
|
+
>${sn}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
227
|
+
</div>`)}function nc(s){let{inFrame:r,everything:c,route:m,open:g,settle:$,keepIn:T,toast:H,waits:M,approve:k}=s,x=Z=>{let it=c().find(Lt=>Lt.id===Z);return!!it&&M(it)},F="nm-review",j=()=>{try{return JSON.parse(sessionStorage.getItem(F)||"null")}catch{return null}},I=Z=>{try{Z?sessionStorage.setItem(F,JSON.stringify(Z)):sessionStorage.removeItem(F)}catch{}},Y=document.createElement("div");Y.className="dt-review",Y.setAttribute("role","region"),Y.setAttribute("aria-label","Checking fixes"),Y.hidden=!0,T(Y),r||document.body.append(Y);let q=()=>c().filter(M),mt=()=>{let Z=q().sort((it,Lt)=>+(Lt.route===m())-+(it.route===m())||String(it.route).localeCompare(String(Lt.route))||it.id-Lt.id).map(it=>it.id);Z.length&&(I({ids:Z,i:0}),At())},At=()=>{let Z=j();if(!Z||r){Y.hidden=!0;return}for(;Z.i<Z.ids.length&&!x(Z.ids[Z.i]);)Z.i++;if(Z.i>=Z.ids.length){I(null),Y.hidden=!0,H("Every fix is checked.");return}I(Z);let it=c().find(Et=>Et.id===Z.ids[Z.i]);if(it.route&&it.route!==m()){location.assign(it.route+location.search);return}g(it);let Lt=Z.ids.slice(0,Z.i).some(x);Y.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
|
|
228
|
+
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${Lt?"":" disabled"}>${zo}</button>
|
|
229
|
+
<span class="dt-review-n">${Z.i+1} of ${Z.ids.length}</span>
|
|
230
|
+
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Go}</button></span>
|
|
231
|
+
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${re}</button>
|
|
232
|
+
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${an}</button>
|
|
233
|
+
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${on}</button>`,Y.hidden=!1};Y.addEventListener("click",async Z=>{let it=Z.target.closest("[data-r]"),Lt=j();if(!it||!Lt)return;if(it.dataset.r==="stop"){I(null),Y.hidden=!0;return}if(it.dataset.r==="prev"){pt();return}let Et=Lt.ids[Lt.i];I({...Lt,i:Lt.i+1});let dt=c().find(Yt=>Yt.id===Et),Zt=it.dataset.r==="ok"&&dt?k(dt):it.dataset.r==="no"?$(Et,!1):null;At(),await Zt});let pt=()=>{let Z=j();if(Z){for(let it=Z.i-1;it>=0;it--)if(x(Z.ids[it])){I({...Z,i:it}),At();return}}};return document.addEventListener("keydown",Z=>{Y.hidden||Z.metaKey||Z.ctrlKey||Z.altKey||Z.key!=="ArrowLeft"&&Z.key!=="ArrowRight"||Z.target.closest?.("input, textarea, select, [contenteditable]")||(Z.preventDefault(),Z.key==="ArrowLeft"?pt():Y.querySelector('[data-r="skip"]')?.click())}),{start:mt,toCheck:q,resume:()=>{j()&&At()}}}function sc(s,r){let c=null,m=null,g=document.querySelector(".dt-turbo"),$="/notemend:turbo",T=()=>{let H=!!c&&Date.now()-Date.parse(c.at)<18e4,M=H?c.mode==="push"?"push":m?.paused?"paused":"on":"none",k=H?wn(c.agent):"",x=M==="none"?`Turbo is off. Run ${$} in Claude Code and threads for the agent are taken as they land \u2014 click to copy it`:M==="push"?`Push mode: ${k} takes threads when you press Push to the agent. For live, run ${$} instead`:M==="on"?`Turbo on: ${k} takes threads for the agent as they land \u2014 click to pause`:`Turbo paused: ${k} is listening but waits \u2014 click to resume`;g.dataset.state=M,g.dataset.tip=x,g.setAttribute("aria-label",x),g.setAttribute("aria-checked",String(M==="on")),s&&(g.hidden=!0)};return setInterval(T,3e4),g.addEventListener("click",async()=>{let H=g.dataset.state;if(H==="none"||H==="push"){await navigator.clipboard?.writeText($).catch(()=>{}),r(`Copied ${$} \u2014 paste it in Claude Code`);return}let M=H==="on"?"off":"on";m={paused:M==="off"},T();try{let k=await Qt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:M})});if(!k.ok)throw new Error(String(k.status));r(M==="off"?"Turbo paused":"Turbo on")}catch{m={paused:M==="on"},T(),r("Could not switch turbo \u2014 try again")}}),H=>{c=H.listening??null,m=H.turbo??null,T()}}var Kp=new Set(["data-wired"]),Gs=s=>{if(!(s instanceof Element))return null;let r=s.dataset;return r.msg?`m:${r.msg}`:r.id?`${s.tagName}:${s.classList[0]??""}:${r.id}`:"draft"in r?`${s.tagName}:draft`:r.parked?`${s.tagName}:parked:${r.parked}`:r.k?`${s.tagName}:k:${r.k}`:null},oc=(s,r)=>s.nodeType===r.nodeType&&s.nodeName===r.nodeName&&Gs(s)===Gs(r);function Yp(s,r){for(let{name:c}of[...s.attributes])!r.hasAttribute(c)&&!Kp.has(c)&&s.removeAttribute(c);for(let{name:c,value:m}of r.attributes)s.getAttribute(c)!==m&&s.setAttribute(c,m);s instanceof HTMLInputElement&&r instanceof HTMLInputElement&&(s.checked!==r.checked&&(s.checked=r.checked),s!==document.activeElement&&s.value!==r.value&&(s.value=r.value))}function ac(s,r){let c=[...s.childNodes],m=new Map;for(let M of c){let k=Gs(M);k&&m.set(k,M)}let g=new Set,$=0,T=[];for(let M of[...r.childNodes]){let k=Gs(M),x=k?m.get(k):void 0;if(!k){for(;$<c.length&&(g.has(c[$])||Gs(c[$]));)$++;$<c.length&&oc(c[$],M)&&(x=c[$++])}x&&!g.has(x)&&oc(x,M)?(g.add(x),Xp(x,M),T.push(x)):T.push(M)}for(let M of c)g.has(M)||s.removeChild(M);let H=s.firstChild;for(let M of T){if(M===H){H=H.nextSibling;continue}s.insertBefore(M,H)}}function Xp(s,r){if(s.nodeType===Node.TEXT_NODE||s.nodeType===Node.COMMENT_NODE){s.nodeValue!==r.nodeValue&&(s.nodeValue=r.nodeValue);return}if(!(!(s instanceof Element)||!(r instanceof Element))){if(Yp(s,r),s instanceof HTMLTextAreaElement){s!==document.activeElement&&s.value!==r.value&&(s.value=r.value);return}if(s instanceof SVGElement){s.innerHTML!==r.innerHTML&&(s.innerHTML=r.innerHTML);return}ac(s,r),s instanceof HTMLSelectElement&&s!==document.activeElement&&s.value!==r.value&&(s.value=r.value)}}function Ai(s,r){let c=document.createElement("template");c.innerHTML=r,ac(s,c.content)}function ic(s,r,c=!1){let m=s.breakpoints,g=s.categories,$=(m.find(t=>!Number.isFinite(t.max))??m[0]).id,T=t=>m.find(e=>t>=e.min&&t<=e.max)?.id??$,H=(t,e)=>{let n=T(t);if(Is||!matchMedia("(pointer: coarse)").matches)return n;let o=[...m].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(n)>i(a)?a:n},M=t=>t.breakpoint||$,k=t=>s.devices.find(e=>e.id===t),x=Is,F=(t,e)=>{x||st.setItem(t,e)},j=null,I=["stage","status","priority","assignee"],Y=t=>{let e=(j??D).find(a=>a.id===t.id),n=I.filter(a=>a in t||(a==="stage"||a==="status")&&("stage"in t||"status"in t)),o=e&&n.length&&!t.reply?Object.fromEntries(n.map(a=>[a,e[a]??null])):void 0;return Qt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(o?{...t,seen:o}:t)})},q=t=>t.replace(/\/+$/,"")||"/",mt=q(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 At=document.querySelector(".dt-grid-btn"),pt=document.querySelector(".dt-grid-overlay"),Z=pt.querySelector(".dt-overlay-grid"),it=pt.querySelector(".dt-grid-chip"),Lt="dt-grid",Et=s.projectGrid??null,dt=()=>H(innerWidth,innerHeight),Zt=()=>Et?.mode==="custom"?Et.widths?.[dt()]??null:null,Yt=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),zt=t=>Yt(t).length,E=()=>{let t=pt.hidden;t&&(pt.style.visibility="hidden",pt.hidden=!1);try{return h()}finally{t&&(pt.hidden=!0,pt.style.visibility="")}},h=()=>{let t=document.documentElement.clientWidth;pt.classList.remove("is-auto");let e=getComputedStyle(Z);if(e.display==="grid"&&zt(e)>1){let i=Z.getBoundingClientRect();return{cols:zt(e),gap:Math.round(parseFloat(e.columnGap)||0),x:Math.round(i.left),w:Math.round(i.width),from:"site"}}let n=null,o=null;for(let i of[...document.body.querySelectorAll("*")].slice(0,3e3)){if(i.closest(dn)||pt.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>(n?.w??0)){let f=parseFloat(d.paddingLeft)||0;n={x:l.left+f,w:l.width-f-(parseFloat(d.paddingRight)||0)}}if(l.width<=(o?.w??0))continue;let u=d.display.endsWith("grid")?Yt(d):[];if(u.length>1){if(!u.every(v=>Math.abs(v-u[0])<2))continue;let f=parseFloat(d.columnGap)||0;o={cols:u.length,gap:f,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:u.reduce((v,P)=>v+P,0)+f*(u.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let f=[...i.children].map(P=>P.getBoundingClientRect()).filter(P=>P.width&&P.height),v=f.filter(P=>Math.abs(P.top-f[0].top)<2).sort((P,V)=>P.left-V.left);v.length>1&&v.every(P=>Math.abs(P.width-v[0].width)<2)&&(o={cols:v.length,gap:Math.max(0,v[1].left-v[0].right),x:v[0].left,w:v.at(-1).right-v[0].left})}}let a=i=>({...i,gap:Math.round(i.gap),x:Math.round(i.x),w:Math.round(i.w)});return a(o?{...o,...n??{},from:"page"}:{cols:s.grid.columns,gap:innerWidth<768?16:24,...n??{x:24,w:t-48},from:"guess"})},S=null,R=(t,e,n,o)=>{pt.classList.add("is-auto"),Z.children.length!==t&&(Z.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),pt.style.setProperty("--grid-x",`${n}px`),pt.style.setProperty("--grid-w",`${o}px`),pt.style.setProperty("--grid-gap",`${e}px`)},et=()=>{let t=Zt(),e=it.querySelector("span");if(it.querySelector("button").hidden=!t||x,t){let n=document.documentElement.clientWidth,o=Math.max(0,Math.min(t.max??1/0,n-2*t.margin));R(t.cols,t.gutter,(n-o)/2,o),e.textContent="Project grid \xB7";return}Z.children.length!==s.grid.columns&&(Z.innerHTML='<div class="dt-overlay-col"></div>'.repeat(s.grid.columns)),S=E(),S.from!=="site"&&R(S.cols,S.gap,S.x,S.w),e.textContent=S.from==="guess"?`Guessed \xB7 ${S.cols} \xD7 ${S.w}`:`From the page \xB7 ${S.cols} \xD7 ${S.w} \xB7 gap ${S.gap}`},X=()=>{it.classList.remove("is-lifted");let t=it.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();it.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},bt=t=>{pt.hidden=!t,t&&(et(),X()),At.setAttribute("aria-pressed",String(t)),F(Lt,t?"1":"0"),ye({grid:t})};At.addEventListener("click",()=>bt(pt.hidden===!0)),addEventListener("resize",()=>{pt.hidden||(et(),X())});let yt=document.querySelector(".dt-pages-name"),Dt=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:q(t.location.pathname),title:t.document.title}:null}catch{return null}},ct=()=>{let e=Dt()?.route??mt,n=null;for(let l of document.querySelectorAll(".dt-pages a"))q(new URL(l.href).pathname)===e?(l.setAttribute("aria-current","page"),n=l):l.removeAttribute("aria-current");let a=n?.querySelector(".dt-menu-label")?.textContent?.trim()||e,i=a.trim().split(/\s+/);yt.textContent=i.length>3?`${i.slice(0,3).join(" ")}\u2026`:a,i.length>3?yt.title=a:yt.removeAttribute("title")};ct();let Bt=document.querySelector(".dt-pages");Bt&&!Bt.querySelector("li")&&Bt.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let gt=[...document.querySelectorAll(".devtools details")],Mt=!1,ae=()=>{let t=gt.filter(e=>e.open);for(let e of t)e.open=!1;return t};document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=ae();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{Mt=gt.some(e=>e.open&&!e.contains(t.target))&&ae().length>0},!0),addEventListener("blur",ae);let St=document.querySelector(".dt-pad-overlay"),Ye="dt-inspect",$n=[".devtools",".dt-tab",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...s.ignore].join(", "),pe=[".devtools",".dt-tab",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-elsewhere",".dt-drag-box",'[aria-modal="true"]',...s.ignore].join(", "),xe={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")},w="",y=0,{spacer:L,drawPads:B,drawSize:O,drawType:rt,drawColor:lt,drawBorder:Q,drawContrast:J,contrastFix:tt,markCopied:ht}=Wd(St),vt=null,Gt=()=>{vt&&w&&ie(vt)},ie=t=>{vt=t,!y&&(y=requestAnimationFrame(()=>{y=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest($n)){St.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),w==="sizes"?O(e):w==="type"?rt(e):w==="color"?lt(e):w==="contrast"?J(e):w==="border"?Q(e):B(t.altKey?e:L(e))}))},Vt=t=>{w=t;for(let[e,n]of Object.entries(xe))n.setAttribute("aria-pressed",String(e===t));F(Ye,t),ye({inspect:t}),St.hidden=!t,St.innerHTML="",t?(document.addEventListener("mousemove",ie),addEventListener("scroll",Gt,!0),addEventListener("resize",Gt)):(document.removeEventListener("mousemove",ie),removeEventListener("scroll",Gt,!0),removeEventListener("resize",Gt))};document.addEventListener("click",t=>{w!=="contrast"||!tt()||t.target.closest?.($n)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(tt()).catch(()=>{}),ht(),Gt())},!0);for(let[t,e]of Object.entries(xe))e.addEventListener("click",()=>{t!==w&&Te(!1),Vt(w===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Pt)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let n=o=>{x&&parent.postMessage({dt:!0,...o},location.origin)};w?(Vt(""),n({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):pt.hidden||(bt(!1),n({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let Ct=document.querySelector(".dt-notes-btn"),It=[...document.querySelectorAll(".dt-bp")],te=document.querySelector(".dt-history-btn"),ot=document.querySelector(".dt-history"),qt=document.querySelector(".dt-elsewhere"),ln=document.querySelector(".dt-studio-btn"),Pe=document.querySelector(".dt-devices"),C=document.querySelector(".dt-notes-hi"),N=C.querySelector(".dt-hi-box"),_=C.querySelector(".dt-hi-tag"),ut=document.querySelector(".dt-frame"),xt=document.createElement("div");xt.className="dt-spot",xt.hidden=!0,xt.setAttribute("aria-hidden","true"),document.body.append(xt);let le=t=>{if(!t||!Pt){xt.hidden=!0;return}let e=t.getBoundingClientRect(),n=6;xt.style.setProperty("--spot-x",`${e.left-n}px`),xt.style.setProperty("--spot-y",`${e.top-n}px`),xt.style.setProperty("--spot-w",`${e.width+n*2}px`),xt.style.setProperty("--spot-h",`${e.height+n*2}px`),xt.hidden&&(C.hidden=!0),xt.hidden=!1},he=ut.querySelector("iframe");he.addEventListener("load",ct),new MutationObserver(ct).observe(ut,{attributes:!0,attributeFilter:["hidden"]});let Ie=document.querySelector(".dt-notes-count"),G=document.querySelector(".dt-notes-overlay"),dn=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Ko=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,n=>n.stopPropagation())};document.querySelectorAll(dn).forEach(Ko);let Hi="dt-notes",D=[],Pt=!1,U=null,A=null,Yo=0,de="",dc=(t,e,n)=>{if(n>160&&n<innerHeight-120)return!1;let o=document.elementsFromPoint(e,n).find(a=>!rn(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},Ni=new WeakSet,Vs=null,Us=null,Ee={},Ks=" \xB7 hidden \u2014 inside something closed",Xo=t=>{t.toggleAttribute("data-up",t.scrollTop>2),t.toggleAttribute("data-more",t.scrollTop+t.clientHeight<t.scrollHeight-2)};G.addEventListener("scroll",t=>{let e=t.target;e.classList?.contains("dt-note-thread")&&Xo(e)},!0),G.addEventListener("load",t=>{let e=t.target.closest?.(".dt-note-thread");e&&Xo(e)},!0),G.addEventListener("scroll",t=>{let e=t.target;if(!e.classList?.contains("dt-note-thread")||e.scrollTop+e.clientHeight<e.scrollHeight-4)return;let n=e.parentElement?.querySelector(".dt-new-below");n&&(delete Ee[n.dataset.id],n.remove())},!0);let oe=[],Ft=null,me=[],cc=10,is=(t=A)=>!!(t&&((t.text?.trim().length??0)>=cc||t.images?.length)),He=()=>{A&&is()&&me.push(A),A=null},Bi=0,rs=()=>{if(!is()||performance.now()-Bi<4e3)return!0;Bi=performance.now();let t=G.querySelector(".dt-note[data-draft]");return t&&!matchMedia("(prefers-reduced-motion: reduce)").matches&&t.animate([0,-6,6,-4,4,0].map(e=>({transform:`translateX(${e}px)`})),{duration:320,easing:"ease-out",composite:"add"}),t?.querySelector(".dt-note-input")?.focus(),jt("Not sent \u2014 close again to keep it as a draft",2400),!1},Oe=null,Jo=new Map,Zo=null,Ri=()=>`dt-draft:${s.me?.email??""}:${mt}${x?":canvas":""}`,Wn=Ri(),Ys=0,ls=()=>{if(!A&&!me.length&&!de){st.removeItem(Wn);return}let t={draft:A,parked:me,reply:de?{for:Oe,text:de}:null};try{localStorage.setItem(Wn,JSON.stringify(t))}catch{let e=n=>({...n,images:void 0});try{localStorage.setItem(Wn,JSON.stringify({...t,draft:A&&e(A),parked:me.map(e)}))}catch{}}},xn=()=>{clearTimeout(Ys),Ys=setTimeout(ls,200)};addEventListener("pagehide",()=>{clearTimeout(Ys),ls()});let De=st.getItem("dt-space")==="clients"?"clients":"studio",Xe=()=>!!s.me&&!s.client,cn=t=>!Xe()||De==="clients"===Nt(t),Pi=["all","nobody","mine","others","resolved","claude","wrote","check"],Je=Pi.find(t=>t===st.getItem("dt-pinf"))??"all",Qo=()=>{},Xs=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Me=st.getItem("dt-resolved")!=="0",qe=st.getItem("dt-archived")==="1",ce=t=>Cd(t,s.autoArchive),Js=t=>ce(t)?qe:kt(t)!=="done"||Me,ge={q:"",menu:!1,view:["me","agent"].includes(st.getItem("dt-view")??"")?st.getItem("dt-view"):"all",sort:st.getItem("dt-sort")==="unread"?"unread":"new"},uc=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],pc=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],hc=()=>{let t=navigator.userAgent,e=i=>i.find(([l])=>l.test(t)),n=e(uc),o=e(pc),a=n?n[0].exec(t)?.[1]:null;return[n?`${n[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},ta=()=>H(innerWidth,innerHeight),Ne=()=>Zo??ta(),Ii=()=>{let t=Ne();for(let e of It)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:ea,poolOf:na,contextOf:sa,resolveEl:mc,anchorOf:gc,anchorState:fc,fingerprintOf:Zs}=Gd(),Qs=new Map,to=()=>{Qs=new Map},Oi=t=>JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth,t.fp]),ke=t=>{let e=Oi(t),n=Qs.get(e);return(n===void 0||n.el&&!n.el.isConnected)&&(n={el:mc(t),st:fc(t)},Qs.set(e,n)),n.el},oa=t=>(ke(t),Qs.get(Oi(t))?.st??"found"),aa=[];document.addEventListener("pointerdown",t=>{let e=t.target;e instanceof Element&&!rn(e)&&!e.closest(".devtools")&&(aa=[aa.at(-1),{el:e,t:Date.now()}].filter(Boolean))},!0);let bc='[role=menu],[role=listbox],[role=dialog],[role=tooltip],dialog,[popover],[aria-modal],[data-state="open"],[data-radix-popper-content-wrapper],details[open]>:not(summary)',yc=t=>{let e=[...aa].reverse().find(l=>!t.contains(l.el)&&!l.el.contains(t));if(!e||Date.now()-e.t>6e5)return null;let n=e.el.closest("button,a,[role=button],summary,[aria-haspopup],[aria-expanded],[aria-controls]");if(!n||!n.isConnected||n.contains(t)||t.contains(n)||rn(n))return null;let o=t.closest(bc);if(o?.contains(n)||!o&&n.getAttribute("aria-expanded")!=="true"&&!n.matches("summary,[aria-haspopup]"))return null;let a=n.tagName.toLowerCase(),i=[...n.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ea(n),tag:a,classes:i,nth:na({tag:a,classes:i}).indexOf(n),label:Ot(Kt(n.textContent||""),60),ctx:sa(n),fp:Zs(n),rx:.5,ry:.5}},eo=new Map,ue=t=>{eo.size||requestAnimationFrame(()=>eo.clear());let e=eo.get(t);return e===void 0&&(e=gc(t,ke(t)),eo.set(t,e)),e},Di=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(n=>n.playState==="running"))return!0;return!1},no=[],ia=t=>{for(let e of no)e.play();no=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let n of e.getAnimations())n.playState==="running"&&(n.pause(),no.push(n))},ra=()=>{if(A)return ke(A);let t=U!=null?D.find(n=>n.id===U):null;if(!t)return null;let e=ue(t);return e&&!e.hidden?ke(t):null},qi="claude",vc=()=>(s.client||De==="clients"?s.team??[]:lo()).filter(t=>!$i(t.email)),wc=()=>vc().filter(t=>t.email!==s.me?.email),ds=()=>[...s.me?(s.team??[]).filter(t=>t.email===s.me.email):[],...wc()],Fi='<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>',la=(t,e)=>{let n=e==="agent"?qi:e==="me"?s.me?.email??"":"";if(!t){if(!A)return;A.assignee=n,A.stage=Rt(n)?"approved":!A.stage||A.stage==="approved"?"new":A.stage,cs(n),A.carried=!1,xn(),K();return}so(t,n)},so=(t,e)=>{let n=D.find(i=>i.id===t);if(n&&Ke(n)&&!Rt(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=n?ve(n):"new",a=Rt(e)?"approved":o==="approved"?"new":o;Le(i=>i.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>Y({id:t,assignee:e||null,stage:a}),Rt(e)?"Approving it for the agent":"Reassigning")},$c=(t,e)=>{if(e&&st.setItem("nm-for",e),!t){if(!A)return;A.assignee=e,A.stage==="approved"&&(A.stage="new"),cs(e),A.carried=!1,xn(),K();return}so(t,e)},Zp=()=>st.getItem("nm-for")??"",xc='<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>',cs=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e&&!Rt(e)&&ds().some(n=>n.email===e)?e:null}catch{return null}},ji=t=>Rt(t)?"#d97757":t?"#0d99ff":"#717171",un=t=>t===s.me?.email?"you":s.team?.find(e=>e.email===t)?.name||t.split("@")[0],Be=t=>t?s.team?.find(e=>e.email===t):void 0,oo=t=>{let e=Kt(t??"").split(/\s+/).filter(Boolean);return b(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},_n=(t,e,n="dt-face")=>t?`<img class="${n}" src="${b(t)}" alt="">`:`<b class="${n}" aria-hidden="true">${oo(e)}</b>`,da=t=>{let e=Be(t.by);return e||t.byName?_n(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},Fe=t=>`var(--dt-avatar-${Be(t)?.avatar_hue??[...t].reduce((e,n)=>e*31+n.charCodeAt(0)>>>0,7)%8+1})`,zn=(t,e)=>{let n=Be(t),o=n?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return _n(n?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${Fe(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},Wi=()=>s.me?`${zn(s.me.email.toLowerCase(),{by:s.me.email,byName:s.me.name})}<i class="dt-pin-cut" aria-hidden="true">${On}</i>`:On,En=new Map,ca=new Map,_i=0,Ec=(t,e)=>{let n=e==="found"?null:e;s.client||x||t.id<=0||(t.anchor??null)===n||En.get(t.id)===n||(En.set(t.id,n),ca.set(t.id,n),clearTimeout(_i),_i=window.setTimeout(()=>{for(let[o,a]of ca){let i=D.find(d=>d.id===o),l=i?oa(i):"found";if(!i||(l==="found"?null:l)!==a){En.delete(o);continue}Y({id:o,anchor:a}).then(d=>{if(d.ok){let u=D.find(f=>f.id===o);u&&(u.anchor=a)}}).catch(()=>En.delete(o))}ca.clear()},4e3))},Mc=(t,e,n,o)=>{let a=(d,u,f=!1)=>`<button type="button" class="dt-lost-btn${f?" is-main":""}" data-act="${d}" data-id="${t.id}">${u}</button>`,i=(d,u,f)=>`<button type="button" class="dt-lost-btn dt-lost-ico" data-act="${d}" data-id="${t.id}" data-tip="${f}" aria-label="${f}">${u}</button>`,l=!s.client;if(o){let d=ud(t).before,u=kt(t)!=="open";return`<div class="dt-lost dt-lost--gone"><p>${t.spot&&!u?"Its element is gone \u2014 here is how it looked. Pin it to something else, or close the thread.":"Not on this page any more \u2014 the element was removed or changed since. The thread stays: answer or resolve it here."}</p>${d?`<img class="dt-lost-shot" src="${b(mi(d.split("/").pop()))}" alt="How the element looked" loading="lazy">`:""}${u?"":`<span class="dt-lost-acts">${Ts(t)?a("repin","Re-pin",!0):""}${i("lost-resolve",re,"Resolve")}${l?i("archive",sn,"Archive"):""}</span>`}</div>`}return n==="probably"?`<div class="dt-lost dt-lost--maybe"><p>The page changed since \u2014 is this still its element?</p><span class="dt-lost-acts">${Ts(t)?a("pin-yes","Yes, it\u2019s this",!0)+a("repin","Re-pin"):""}</span></div>`:e?.opener?`<div class="dt-lost dt-lost--inside"><p>Inside ${b(As(e.opener))} \u2014 closed now.</p><span class="dt-lost-acts">${a("open-it","Open it",!0)}</span></div>`:""},ua=(t,e)=>Be(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],ao={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},Gn=(()=>{try{return JSON.parse(st.getItem("dt-seen")||"{}")}catch{return{}}})(),zi=()=>F("dt-seen",JSON.stringify(Gn)),Gi=t=>{let e=vn(t);if(!(t.id in Gn))return Gn[t.id]=e.length,zi(),!1;let n=e[e.length-1];return e.length>Gn[t.id]&&!(n?.author==="you"&&(!n.by||n.by===s.me?.email))},kc=t=>{let e=vn(t).length;Gn[t.id]!==e&&(Gn[t.id]=e,zi())},Lc=t=>{let e=Be(t);return e?` data-face="${b(e.avatar_url??"")}" data-initial="${oo(e.name||e.email)}"`:""},Sc=t=>s.client||Nt(t)||kt(t)==="done"?"":`<span class="dt-hist-well">${Ui(t.assignee??"",t.id,!0)}${Yi(t,t.assignee??"",t.id)}</span>`,io={queued:"#0d99ff",working:"#f5a623",asks:"#e93d82",stuck:"#e5402c",review:"#8e4ec6"},Tc=t=>{let e=kt(t),n=s.client||Nt(t)||e==="done"?null:ne(t),o=n&&io[n]&&(Rt(t.assignee)||n==="review")?n:null,a=Ze.find(d=>d[0]===Mn(t)),[i,l]=e==="done"?ce(t)?["#717171","Archived"]:["#30a46c","Resolved"]:o?[io[o],`With the agent \u2014 ${Ki[o]}`]:[a[2],a[1]];return`<span class="dt-hist-step" role="img" aria-label="${b(l)}">${$e(i,e==="done"?1:0)}${o?`<i class="dt-hist-mark" style="color:${i}">${we(12)}</i>`:""}</span>`};Yd(t=>{if(U!=null||!t.matches(".dt-pin[data-id]"))return null;let e=D.find(v=>v.id===Number(t.dataset.id));if(!e)return null;let n=[...new Set([e.by,...(e.replies??[]).filter(v=>v.author!=="claude").map(v=>v.by)].filter(Boolean).map(v=>v.toLowerCase()))].slice(0,3),o=kt(e),a=s.client||Nt(e)||o==="done"?null:ne(e),i=a&&io[a]&&(Rt(e.assignee)||a==="review")?a:null,l=Ze.find(v=>v[0]===Mn(e)),[d,u]=o==="done"?ce(e)?["#717171","Archived"]:["#30a46c","Resolved"]:i?[io[i],`${hn(e)}${pa(e)}`]:[l[2],l[1]],f=e.replies?.length??0;return`<span class="dt-peek-head">${n.length?`<span class="dt-peek-people">${n.map(v=>`<span class="dt-hist-face" style="--hue:${Fe(v)}">${zn(v,e)}</span>`).join("")}</span>`:""}<b>${b(e.byName||"You")}</b><em>\xB7 ${nn(e.createdAt)}</em></span><span class="dt-peek-text">${b(Ot(e.text,240))}</span><span class="dt-peek-foot">${$e(d,o==="done"?1:0)}<span>${b(u)}${f?` \xB7 ${f} ${f===1?"reply":"replies"}`:""}</span></span>`});let pa=t=>{let e=ne(t),n=Ei(t);return e==="working"?n?.step?` \xB7 ${xi(n.step)} \xB7 ${n.elapsed}`:" is working":e==="stuck"?` went quiet \xB7 ${n?.silent??""}${n?.step?` \xB7 last: ${n.step}`:""}`:e==="queued"?" \xB7 queued \xB7 next run":e==="asks"?" asks you \xB7 answer in the thread":e==="review"?" fixed it \xB7 to check":""},Ac=t=>{let e=Be(t);return e?_n(e.avatar_url,e.name||e.email):""},Cc=t=>`<b class="dt-face dt-face--ai" aria-hidden="true">${we(12)}</b>`,Vi=(t,e,n={})=>`<option value="${b(t)}"${n.dot?` data-c="${ji(t)}"`:""}${Lc(t||null)}${n.selected?" selected":""}>${b(e)}</option>`,Ui=(t,e,n=!1)=>{let o=Rt(t),a=o?"":t,i=Be(a),l=i?i.avatar_url?`<img class="dt-owner-face" src="${b(i.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${Fe(a.toLowerCase())}" aria-hidden="true">${oo(i.name||i.email)}</b>`:a?er:Fi,d=a?i?.name||un(a):"Anyone",u=P=>`<b class="dt-menu-face" style="--hue:${Fe(P.toLowerCase())}">${[...oo(Be(P)?.name||P)][0]}</b>`,f=(P,V,p="")=>`<option value="${b(P)}" data-icon="${b(P?u(P):Fi)}"${p?` data-hint="${b(p)}"`:""}${P===a?" selected":""}${P?"":" data-sep-after"}>${b(V)}</option>`,v=ds();return`<label class="dt-owner${i?" has-face":""}${n?" is-compact":""}" data-tip="${o?"The agent has it \u2014 pick a person to hand it over":n?b(d):"Who takes it"}">${l}${n?"":`<span class="dt-owner-name">${b(d)}</span>`}${us}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
|
|
234
|
+
${f("","Anyone")}${v.map(P=>f(P.email,P.email===s.me?.email?`Me \xB7 ${P.name||P.email}`:P.name||P.email,P.email)).join("")}${a&&!v.some(P=>P.email===a)?f(a,un(a)):""}
|
|
235
|
+
</select></label>`},Ki={queued:"queued",working:"working",asks:"asks you",stuck:"went quiet",review:"fixed it \u2014 to check",done:"done"},Yi=(t,e,n,o=!1)=>{let a=t?ne(t):Rt(e)?"queued":null,i=!!a&&(Rt(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 ${Ki[a]??"queued"}. Take it back`:l;return`<button type="button" class="dt-claude-btn${i?" is-on":""}" data-act="claude"${n?` data-id="${n}"`:""}${i?` data-step="${a}" style="--step-c:${ao[a]??ao.queued}"`:""} aria-pressed="${i}" data-tip="${b(l)}" aria-label="${b(d)}"${o?" disabled":""}>${we(13)}</button>`},Xi=t=>{if(!t){if(!A)return;la(0,Rt(A.assignee)?"nobody":"agent");return}let e=D.find(o=>o.id===t);if(!e)return;let n=ne(e);so(t,Rt(e.assignee)||n==="review"?"":qi)},Hc=t=>`<div class="dt-suggest dt-suggest--read"><del>${b(t.from)}</del><ins>${b(t.to)}</ins></div>`,Ji=(t,e)=>{let n=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return b([n,Kt(e??"")&&`\u201C${Ot(Kt(e),80)}\u201D`].filter(Boolean).join(" \xB7 "))},us='<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>',ha=(t,e,n=!1)=>{let o=Dn(t);return n?`<span class="dt-field dt-field--bare dt-field--type"><span class="dt-field-box">${Vo(o)}<span class="dt-field-label">${b(o.label)}</span></span></span>`:`<label class="dt-field dt-field--bare dt-field--type" data-tip="Type: ${b(o.label)}"><span class="dt-field-box">${Vo(o)}<span class="dt-field-label">${b(o.label)}</span>${us}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${g.map(a=>`<option value="${a.id}" data-c="${a.color}" data-icon="${b(Vo(a))}"${a.id===t?" selected":""}>${a.label}</option>`).join("")}</select></span></label>`},Ze=[["new","New","#0d99ff",0],["progress","In progress","#f5a623",.25],["review","To check","#8e4ec6",.5],["waiting","Waiting","#e93d82",.75]],Mn=t=>Ke(t)||ve(t)==="progress"?"progress":ve(t)==="review"?"review":ve(t)==="waiting"?"waiting":"new",Zi=(t,e)=>{if(e==="all")return!0;let n=kt(t),o=Fs(t,n),a=(s.me?.email??"").toLowerCase();return e==="nobody"?n!=="done"&&!!o&&!o.taker:e==="mine"?!!o&&o.taker===a:e==="others"?!!o&&!!o.taker&&o.taker!==a:e==="resolved"?n==="done":e==="claude"?!!o?.claude&&o.taker===a:e==="wrote"?!t.by||t.by.toLowerCase()===a:n==="claude"||n==="open"&&(ne(t)==="review"||Mn(t)==="review")},ro={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",done:"done"},pn=[...Ze,["done","Resolved","#30a46c",1]],Nc=t=>{let e=ne(t);return t.status==="done"&&e!=="review"?"done":e&&ro[e]?ro[e]:Mn(t)},Bc=t=>{let e=ne(t),n=Nc(t),[,,o,a]=pn.find(i=>i[0]===n);return`<label class="dt-field" data-tip="${e&&ro[e]?"Follows the agent":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${$e(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${pn.map(([i,l,d,u])=>`<option value="${i}" data-c="${d}" data-icon="${b($e(d,u))}"${i===n?" selected":""}>${l}</option>`).join("")}${s.client?"":`<option value="${ce(t)?"unarchive":"archive"}" data-sep data-icon="${b(sn)}">${ce(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},Rc=(t,e)=>{let{reopenedAt:n,reopenedBy:o,movedAt:a,movedBy:i,movedFrom:l,repinnedAt:d,repinnedBy:u,repinnedFrom:f}=t,v=vn(t),P=W=>{let z=Date.parse(W),Ht=v.findIndex((se,Wt)=>Wt>0&&!!se.at&&Date.parse(se.at)>z);return Ht<0?v.length:Ht},V=W=>W?W==="you"||W===s.me?.email?"you":W==="claude"?"the agent":un(W):"",p=[];if(a&&l&&p.push([P(a),`<p class="dt-note-event">${sr}${b(`Moved from ${l}${i?` by ${V(i)}`:""}`)} \xB7 ${Ws(a,nn)}</p>`]),d&&p.push([P(d),`<p class="dt-note-event">${sr}${b(`Re-pinned${u?` by ${V(u)}`:""}${f?` from ${f}`:""}`)} \xB7 ${Ws(d,nn)}</p>`]),n&&t.status!=="done"){let W=V(o);p.push([P(n),`<p class="dt-note-event">${an}${b(W?`Reopened by ${W}`:"Reopened")} \xB7 ${Ws(n,nn)}</p>`])}for(let[W,z]of p.sort((Ht,se)=>se[0]-Ht[0]))e.splice(W,0,z);return e.join("")},Pc=t=>{let e=t.from,n=a=>`<p class="dt-note-from">${ma}${a}</p>`;if(e){let a=ft.find(i=>i.id===e.id);return n(Ed(t,a,a?.by?un(a.by):""))}if(s.client)return"";let o=ft.find(a=>a.from?.id===t.id);return o?n(Md(o)):""},Ic=(t,e)=>{let n=D.find(l=>l.id===t);if(!n)return;if(e==="done"){We(t,!0);return}if(e==="archive"||e==="unarchive"){kn(t,e==="archive");return}if(Rt(n.assignee)&&!Nt(n)){n.status==="done"?We(t,!1):(jt("Still with the agent \u2014 its step is the status; the agent button takes it back.",6e3),K());return}let a=e==="new"&&Rt(n.assignee)?"approved":e,i=n.status==="done"?{status:"open",doneBy:null}:{};Le(l=>l.map(d=>d.id===t?{...d,...i,stage:a}:d),()=>Y({id:t,...i,stage:a}),"Setting the status")},ps=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],Oc=(t,e)=>{let n=Math.max(0,ps.findIndex(d=>d[0]===t)),[,o,a,i]=ps[n],l=ps[(n+1)%ps.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}">${Vd(i,a)}<span>${o}</span></button>`},Qi=(t,e,n,o,a=!1,i=!1,l=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${s.client?"":Oc(t,n)}${l?"":ha(Dn(e).id,n,a)}</span>${s.client?"":`<span class="dt-who">${i?"":Ui(o,n)}${Yi(n?D.find(d=>d.id===n):void 0,o,n,i)}</span>`}</div>`,tr='<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>',Dc=t=>{let e=Kt(t?.querySelector("h1, h2, h3, h4, h5, h6")?.textContent??t?.innerText?.split(`
|
|
236
|
+
`).find(n=>Kt(n))??"");return e?e.length>30?`${Ot(e,30)}\u2026`:e:t?.tagName.toLowerCase()??""},er='<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>',nr='<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>',sr='<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>',ma='<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>',or='<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>',ar='<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>',ir=t=>{let e=(a,i,l,d="")=>`<option value="${a}" data-icon="${b(i)}"${d}>${l}</option>`,n=t&&Xe()?Nt(t)?e("dup",ma,"Duplicate to workspace")+(t.client?"":e("move",or,"Move to workspace")):e("dup",ma,"Duplicate for the client")+e("move",or,"Move to clients"):"",o=t&&s.client&&t.status==="done"?e("reopen",an,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${nr}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
|
|
221
237
|
<option value="" hidden selected></option>
|
|
222
|
-
${
|
|
223
|
-
${e(t?"rm":"discard",
|
|
224
|
-
</select></label>`},
|
|
225
|
-
${
|
|
226
|
-
</select></span></label>`},Sn='<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>',Ta='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',ol='<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>',al=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,il=(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 b=s.querySelector(".dt-voice-track i"),h=s.querySelector(".dt-voice-time"),N=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{b.style.transform=`scaleX(${N()?Math.min(1,o.currentTime/N()):0})`,h.textContent=al(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=ol,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=Ta,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let b=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*o.duration);return}if(!o.paused){o.pause();return}K.querySelectorAll(".dt-voice audio").forEach(b=>{b!==o&&b.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?r():d(),{once:!0}):r();return}d();function d(){o.addEventListener("timeupdate",()=>{o.currentTime=0,r()},{once:!0}),o.currentTime=1e9}},oo=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),Aa=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Tn=new Map,rl=t=>{if(!t.startsWith("data:"))return t;let e=Tn.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]})),Tn.set(t,e),Tn.size>8){let[a,r]=Tn.entries().next().value;URL.revokeObjectURL(r),Tn.delete(a)}}return e},ll=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${Ta}</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="${rl(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">${wl}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${Sn}</button>`}</span>`,ao=t=>t.length>30?`${t.slice(0,17)}\u2026${t.slice(-11)}`:t,dl=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`},io=t=>{let e=Zi(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},cl=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${io(e)}<span class="dt-file-text"><b>${g(ao(e))}</b>${o?"":`<small>${dl(t)}</small>`}</span>`;return`<span class="dt-file" title="${g(e)}">${o?`<a class="dt-file-open" href="${g(Wo(e)?t:a)}"${Wo(e)?' target="_blank" rel="noreferrer"':` download="${g(e)}"`}>${r}</a><a class="dt-tip-r dt-file-get" href="${g(a)}" download="${g(e)}" aria-label="Download ${g(e)}" data-tip="Download">${hl}</a>`:`<span class="dt-file-open">${r}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${Sn}</button>`}</span>`},ul=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${g(s)}"><span class="dt-file-open">${io(s)}<span class="dt-file-text"><b>${g(ao(s))}</b><small>${g(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${Sn}</button></span>`},pl=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${g(s)}"><span class="dt-file-open">${io(s)}<span class="dt-file-text"><b>${g(ao(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">${Sn}</button></span>`},Ca=(t,e,s=t)=>t.startsWith(ls)?ul(t,e??""):t.startsWith(lo)?pl(t,e??""):zn(s)?cl(t,zn(s),e):oo(s)?ll(t,e):`<span class="dt-shot${Aa(s)?" dt-shot--video":""}">${Aa(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">${Sn}</button>`}</span>`,ro=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=Gi(o);return Ca(a,e===void 0?void 0:`data-id="${e}" data-img="${g(o)}"`,o)}).join("")}</div>`:"",Ha=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>Ca(e,`data-i="${s}"`)).join("")}</div>`:"",rs='<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>',hl='<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>',ml='<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>',ls="refused:\0",lo="big:\0",ds=new Map,pn=t=>!t.startsWith(lo),Vd='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M11.5 2.5H6a1.5 1.5 0 0 0-1.5 1.5v12A1.5 1.5 0 0 0 6 17.5h8a1.5 1.5 0 0 0 1.5-1.5V6.5z"/><path d="M11.5 2.5v4h4"/></svg>',gl='<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>',fl='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',bl=90,co=32,yl=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",cs=!1,vl=async(t,e)=>{if(cs||!t)return;let s=Number(t.dataset.id)||0;cs=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Lt("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),cs=!1,e.classList.remove("is-asking");let gt=mt?.name;Lt(gt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":gt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":gt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${mt?.message||gt||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let r=()=>K.querySelector(s?`.dt-note[data-id="${s}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),d=document.createElement("div");d.className="dt-rec",d.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${Ze}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(co)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${fl}</button>`;let b=d.querySelector("b"),h=[...d.querySelectorAll(".dt-rec-wave i")],N=new AudioContext,V=N.createAnalyser();V.fftSize=512,N.createMediaStreamSource(a).connect(V);let c=new Uint8Array(V.fftSize),F=[],q=new MediaRecorder(a,{audioBitsPerSecond:32e3}),lt=[],C=Date.now(),it=!0,Et=setInterval(()=>{let mt=r();if(!mt){ne(!1);return}d.parentElement!==mt&&mt.appendChild(d),V.getByteTimeDomainData(c);let gt=0;for(let yn of c)gt+=((yn-128)/128)**2;F.push(Math.min(1,Math.sqrt(gt/c.length)*4));let Le=F.slice(-co);h.forEach((yn,Ls)=>{let ge=Le[Ls-(co-Le.length)];yn.style.transform=`scaleY(${Math.max(.1,ge??0).toFixed(2)})`,yn.classList.toggle("is-empty",ge===void 0)});let re=Math.floor((Date.now()-C)/1e3);b.textContent=`${Math.floor(re/60)}:${String(re%60).padStart(2,"0")}`,re>=bl&&q.state!=="inactive"&&q.stop()},90),ne=mt=>{it=mt,q.state!=="inactive"&&q.stop()};d.querySelector(".dt-rec-x").addEventListener("click",mt=>{mt.stopPropagation(),ne(!1)}),d.querySelector(".dt-rec-done").addEventListener("click",mt=>{mt.stopPropagation(),ne(!0)}),d.addEventListener("keydown",mt=>{mt.key==="Escape"&&(mt.stopPropagation(),ne(!1))}),q.ondataavailable=mt=>{mt.data.size&<.push(mt.data)},q.onstop=async()=>{if(clearInterval(Et),a.getTracks().forEach(Le=>Le.stop()),N.close().catch(()=>{}),d.remove(),cs=!1,!it)return;let mt=new Blob(lt,{type:q.mimeType||"audio/webm"}),gt=await new Promise(Le=>{let re=new FileReader;re.onload=()=>Le(String(re.result)),re.readAsDataURL(mt)});s?O.push(gt):S&&(S.images??=[]).push(gt),et(),r()?.querySelector("textarea")?.focus()},q.start(1e3),r()?.appendChild(d),d.querySelector(".dt-rec-done").focus()},Na="\u{1F3A4} Voice note",wl='<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>',$l=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?S?.images??[]:O)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await Ct("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){Lt(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 d=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");d&&(d.value=d.value.trim()?`${d.value.trimEnd()} ${r.text}`:r.text,d.dispatchEvent(new Event("input",{bubbles:!0})),d.focus())},xe=new Map,Ba=async(t,e,s)=>{let o=`${t}:${e}`;if(!s&&xe.has(o)){xe.delete(o),et();return}let a=G.find(h=>h.id===t),r=a&&Se(a).find(h=>(h.at??"0")===e);if(!r?.text)return;xe.set(o,null),et();let d=await Ct("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:s||navigator.language||"en"})}).catch(()=>null),b=d?await d.json().catch(()=>({})):{};xe.has(o)&&(d?.ok&&b.text?xe.set(o,b.text):(xe.delete(o),Lt(b.error||"Could not translate it \u2014 try again.")),et())},xl=["uk","ru","en"],El=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},Ml=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${va}</span><select class="dt-lang-select" data-id="${t}" data-at="${g(e)}" aria-label="Translate into"><option value="" selected hidden></option>${xl.map(s=>`<option value="${g(s)}">${g(El(s))}</option>`).join("")}</select></label>`,kl='<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>',Ll='<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>',Ra='<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>',uo=()=>n.me?.email??"you",Sl=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,r])=>{let d=r.includes(uo()),b=r.map(h=>h===uo()?"You":je(h)).join(", ");return`<button type="button" class="dt-react${d?" is-mine":""}" data-act="react" data-id="${t}" data-at="${g(e)}" data-emoji="${g(a)}" aria-pressed="${d}" data-tip="${g(b)}" aria-label="${g(`${a} ${r.length}: ${b}`)}">${g(a)}<span>${r.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${g(e)}" data-tip="Add reaction" aria-label="Add reaction">${Ra}</button></div>`:""},Pa=(t,e,s)=>{us();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?nr:er).map(N=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${g(N)}" aria-label="${g(N)}">${g(N)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${Ea}</button>`),Ee={...s,btn:t},K.append(o);let a=t.getBoundingClientRect(),r=o.getBoundingClientRect(),d=6,b=8,h=a.bottom+d+r.height<=innerHeight-b;o.style.top=`${h?a.bottom+d:Math.max(b,a.top-d-r.height)}px`,o.style.left=`${Math.min(Math.max(b,a.right-r.width),innerWidth-b-r.width)}px`,o.querySelector("button")?.focus()},Ee=null,us=()=>{K.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),Ee=null},Tl=(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()},Oa=(t,e,s)=>{let o=a=>{let r=sr(a.reactions,s,uo());return r===null?a:{...a,reactions:r}};te(a=>a.map(r=>r.id!==t?r:e?{...r,replies:r.replies?.map(d=>d.at===e?o(d):d)}:o(r)),()=>y({id:t,react:{at:e,emoji:s}}),"The reaction")},Al='<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>',po=1e4,Ia=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
227
|
-
<textarea class="${t}" rows="1" maxlength="${
|
|
238
|
+
${n}${o}${t?e("link",ar,"Copy link"):""}
|
|
239
|
+
${e(t?"rm":"discard",In,t?"Delete thread":"Discard draft",` data-danger${t?" data-sep":""}`)}
|
|
240
|
+
</select></label>`},lo=()=>s.studio?(s.team??[]).filter(t=>s.studio.includes(t.email)):[],rr=t=>{let e=t||s.lead||"",n=lo();return!n.length||n.some(o=>o.email===e)?e:n[0].email},qc=t=>{let e=rr(t),n=lo();if(!n.length)return"";let o=Ac(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${ji(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
|
|
241
|
+
${n.map(a=>Vi(a.email,a.name||a.email,{dot:!0,selected:e===a.email})).join("")}
|
|
242
|
+
</select></span></label>`},hs='<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>',lr='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',Fc='<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>',jc=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,Wc=(t,e)=>{let n=t.closest(".dt-voice"),o=n.querySelector("audio"),a=n.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let d=n.querySelector(".dt-voice-track i"),u=n.querySelector(".dt-voice-time"),f=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${f()?Math.min(1,o.currentTime/f()):0})`,u.textContent=jc(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=Fc,a.setAttribute("aria-label","Pause"),n.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=lr,a.setAttribute("aria-label","Play the voice note"),n.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let i=()=>{if(e){let d=n.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}G.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}},ga=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),dr=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),ms=new Map,_c=t=>{if(!t.startsWith("data:"))return t;let e=ms.get(t);if(!e){let[n,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:n.slice(5).split(";")[0]})),ms.set(t,e),ms.size>8){let[a,i]=ms.entries().next().value;URL.revokeObjectURL(i),ms.delete(a)}}return e},zc=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${lr}</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="${_c(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">${nu}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${hs}</button>`}</span>`,fa=t=>t.length>30?`${Ot(t,17)}\u2026${[...t].slice(-11).join("")}`:t,Gc=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`},ba=t=>{let e=pd(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},Vc=(t,e,n)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",i=`${ba(e)}<span class="dt-file-text"><b>${b(fa(e))}</b>${o?"":`<small>${Gc(t)}</small>`}</span>`;return`<span class="dt-file" title="${b(e)}">${o?`<a class="dt-file-open" href="${b(fi(e)?t:a)}"${fi(e)?' target="_blank" rel="noreferrer"':` download="${b(e)}"`}>${i}</a><a class="dt-tip-r dt-file-get" href="${b(a)}" download="${b(e)}" aria-label="Download ${b(e)}" data-tip="Download">${Yc}</a>`:`<span class="dt-file-open">${i}</span>`}${n===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${n} aria-label="Remove">${hs}</button>`}</span>`},Uc=(t,e)=>{let[,n,o]=t.split("\0");return`<span class="dt-file is-refused" title="${b(n)}"><span class="dt-file-open">${ba(n)}<span class="dt-file-text"><b>${b(fa(n))}</b><small>${b(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${hs}</button></span>`},Kc=(t,e)=>{let[,,n,o]=t.split("\0");return`<span class="dt-file" title="${b(n)}"><span class="dt-file-open">${ba(n)}<span class="dt-file-text"><b>${b(fa(n))}</b><small>${(Number(o)/1024/1024).toFixed(1)} MB \u2014 uploads when you send</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${hs}</button></span>`},cr=(t,e,n=t)=>t.startsWith(co)?Uc(t,e??""):t.startsWith(va)?Kc(t,e??""):Ds(n)?Vc(t,Ds(n),e):ga(n)?zc(t,e):`<span class="dt-shot${dr(n)?" dt-shot--video":""}">${dr(n)?`<video src="${t}" controls preload="metadata" playsinline></video>`:`<a href="${t}" target="_blank"><img src="${t}" alt="" loading="lazy" /></a>`}${e===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${e} aria-label="Remove">${hs}</button>`}</span>`,ya=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(n=>{let o=n.split("/").pop(),a=mi(o);return cr(a,e===void 0?void 0:`data-id="${e}" data-img="${b(o)}"`,o)}).join("")}</div>`:"",ur=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,n)=>cr(e,`data-i="${n}"`)).join("")}</div>`:"",Yc='<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>',Xc='<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>',co="refused:\0",va="big:\0",uo=new Map,Vn=t=>!t.startsWith(va),Jc='<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>',Zc='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Qc=90,wa=32,tu=()=>!!s.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",po=!1,eu=async(t,e)=>{if(po||!t)return;let n=Number(t.dataset.id)||0;po=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>jt("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(wt){clearTimeout(o),po=!1,e.classList.remove("is-asking");let _t=wt?.name;jt(_t==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":_t==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":_t==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${wt?.message||_t||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let i=()=>G.querySelector(n?`.dt-note[data-id="${n}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),l=document.createElement("div");l.className="dt-rec",l.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${In}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(wa)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${Zc}</button>`;let d=l.querySelector("b"),u=[...l.querySelectorAll(".dt-rec-wave i")],f=new AudioContext,v=f.createAnalyser();v.fftSize=512,f.createMediaStreamSource(a).connect(v);let P=new Uint8Array(v.fftSize),V=[],p=new MediaRecorder(a,{audioBitsPerSecond:32e3}),W=[],z=Date.now(),Ht=!0,se=setInterval(()=>{let wt=i();if(!wt){Wt(!1);return}l.parentElement!==wt&&wt.appendChild(l),v.getByteTimeDomainData(P);let _t=0;for(let fn of P)_t+=((fn-128)/128)**2;V.push(Math.min(1,Math.sqrt(_t/P.length)*4));let en=V.slice(-wa);u.forEach((fn,bn)=>{let Ut=en[bn-(wa-en.length)];fn.style.transform=`scaleY(${Math.max(.1,Ut??0).toFixed(2)})`,fn.classList.toggle("is-empty",Ut===void 0)});let Ue=Math.floor((Date.now()-z)/1e3);d.textContent=`${Math.floor(Ue/60)}:${String(Ue%60).padStart(2,"0")}`,Ue>=Qc&&p.state!=="inactive"&&p.stop()},90),Wt=wt=>{Ht=wt,p.state!=="inactive"&&p.stop()};l.querySelector(".dt-rec-x").addEventListener("click",wt=>{wt.stopPropagation(),Wt(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",wt=>{wt.stopPropagation(),Wt(!0)}),l.addEventListener("keydown",wt=>{wt.key==="Escape"&&(wt.stopPropagation(),Wt(!1))}),p.ondataavailable=wt=>{wt.data.size&&W.push(wt.data)},p.onstop=async()=>{if(clearInterval(se),a.getTracks().forEach(en=>en.stop()),f.close().catch(()=>{}),l.remove(),po=!1,!Ht)return;let wt=new Blob(W,{type:p.mimeType||"audio/webm"}),_t=await new Promise(en=>{let Ue=new FileReader;Ue.onload=()=>en(String(Ue.result)),Ue.readAsDataURL(wt)});n?oe.push(_t):A&&(A.images??=[]).push(_t),K(),i()?.querySelector("textarea")?.focus()},p.start(1e3),i()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},pr="\u{1F3A4} Voice note",nu='<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>',su=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?A?.images??[]:oe)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await Qt("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){jt(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())},je=new Map,$a=new Map,xa=async(t,e,n)=>{let o=`${t}:${e}`;if($a.delete(o),!n){je.delete(o),K();return}let a=D.find(u=>u.id===t),i=a&&vn(a).find(u=>(u.at??"0")===e);if(!i?.text)return;je.set(o,{to:n,text:null}),K();let l=await Qt("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:i.text,to:n})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};je.get(o)?.to===n&&(l?.ok&&d.text?je.set(o,{to:n,text:d.text}):(je.delete(o),$a.set(o,n)),K())},ou=(t,e,n)=>{let o=je.get(`${t}:${e}`),a=_o(n),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">${au}</span>`:ru}<span aria-hidden="true">${us}</span><select class="dt-lang-select" data-id="${t}" data-at="${b(e)}" aria-label="Translate"><option value="" hidden${o?"":" selected"}></option><option data-head disabled>${a?`Written in ${b(Mi(a))}`:"Translate into"}</option>${Nd(n,navigator.language||"en").map(l=>`<option value="${b(l)}" data-bare${l===i?' data-note="your language"':""}${o?.to===l?" selected":""}>${b(Hd(l))}</option>`).join("")}<option value="orig" data-sep data-icon="${b(an)}"${o?"":" disabled"}>Show original</option></select></label>`},au='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M10 3a7 7 0 1 0 7 7"/></svg>',iu=(t,e,n)=>{let o=`${t}:${e}`,a=_o(n);if(je.get(o)?.text)return`<p class="dt-tr-note">Translated from ${a?b(Mi(a)):"another language"} \xB7 <button type="button" data-act="tr-orig" data-id="${t}" data-at="${b(e)}">Show original</button></p>`;let i=$a.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="${b(e)}" data-to="${b(i)}">Try again</button></p>`:""},ru='<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>',lu='<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>',hr='<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>',Ea=()=>s.me?.email??"you",du=(t,e,n)=>{let o=Object.entries(n??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,i])=>{let l=i.includes(Ea()),d=i.map(u=>u===Ea()?"You":un(u)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${b(e)}" data-emoji="${b(a)}" aria-pressed="${l}" data-tip="${b(d)}" aria-label="${b(`${a} ${i.length}: ${d}`)}">${b(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="${b(e)}" data-tip="Add reaction" aria-label="Add reaction">${hr}</button></div>`:""},mr=(t,e,n)=>{ho();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",n.box?"Emoji":"React"),o.innerHTML=(e?fd:gd).map(v=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${b(v)}" aria-label="${b(v)}">${b(v)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${nr}</button>`),Qe={...n,btn:t},G.append(o);let a=t.getBoundingClientRect(),i=o.getBoundingClientRect(),l=6,d=8,u=a.top-l-i.height>=d;o.style.top=`${u?a.top-l-i.height:Math.min(a.bottom+l,innerHeight-d-i.height)}px`;let f=(t.closest(".dt-note")??t).getBoundingClientRect().right;o.style.left=`${Math.min(Math.max(d,f-i.width),innerWidth-d-i.width)}px`,o.querySelector("button")?.focus()},Qe=null,ho=()=>{G.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),Qe=null},cu=(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()},gr=(t,e,n)=>{let o=a=>{let i=bd(a.reactions,n,Ea());return i===null?a:{...a,reactions:i}};Le(a=>a.map(i=>i.id!==t?i:e?{...i,replies:i.replies?.map(l=>l.at===e?o(l):l)}:o(i)),()=>Y({id:t,react:{at:e,emoji:n}}),"The reaction")},uu='<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>',Ma=1e4,fr=(t,e,n,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
243
|
+
<textarea class="${t}" rows="1" maxlength="${Ma}" aria-label="${e}" placeholder="${e}">${b(n)}</textarea>
|
|
228
244
|
${a}
|
|
229
245
|
<div class="dt-compose-bar">
|
|
230
|
-
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${
|
|
231
|
-
${
|
|
232
|
-
<button class="dt-send${
|
|
246
|
+
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${uu}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${Xc}</button>
|
|
247
|
+
${tu()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${Jc}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${lu}</button></span>
|
|
248
|
+
<button class="dt-send${n.trim()?" is-ready":""}" ${o} title="Send (Enter)"
|
|
233
249
|
><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>
|
|
234
250
|
</div>
|
|
235
|
-
</div></div>`,
|
|
236
|
-
class="dt-note-resolve${o&&!a?" is-on":""}" title="${o?"Reopen":s==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${qt}</button>${n.client||It()?"":`<button data-act="${a?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${a?" is-on":""}" title="${a?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${rs}</button>`}`},Cl=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!oe(t)&&!An(t)){let h=t.confirmedBy?t.confirmedBy===n.me?.email?"you":je(t.confirmedBy):"",N=t.confirmedAt;return`<div class="dt-step dt-step--resolved"><span class="dt-step-text"><b>${g(h?`Resolved by ${h}`:"Resolved")}</b>${N?` \xB7 ${Je(N)}`:""}</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">${Te}</button>`+(n.client?"</div>":`<button type="button" class="dt-step-act is-main" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${rs}</button></div>`)}if(n.client||Mt(t))return"";let e=se(t),s={act:"hand",v:"me",icon:no,tip:n.me?"Take it myself":"Take it off Claude"},o={act:"reopen",icon:Te,tip:"Reopen"},a=[{act:"accept",icon:qt,tip:"Looks right \u2014 mark it resolved",main:!0},{act:"sendback",icon:Te,tip:"Send it back \u2014 say what is wrong below"}],r=t.working,d=!At(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":je(t.assignee):"",b=e==="queued"?{step:e,title:`With ${ae(t)} \u2014 queued`,acts:[s]}:e==="working"?{step:e,title:`With ${ae(t)} \u2014 working`,acts:[s],live:!0}:e==="asks"?{step:e,title:`With ${ae(t)} \u2014 it asks you`,acts:[]}:e==="stuck"?{step:e,title:`With ${ae(t)} \u2014 silent for ${Fa(r?.at)}`,acts:[s]}:e==="review"?null:Jt(t)==="review"&&d?{step:"review",title:`To check \u2014 ${d} ${d==="You"?"say":"says"} done`,acts:a}:!e&&!t.assignee&&t.status!=="done"&&n.me&&!It()?{step:"anyone",title:"Anyone",acts:[{act:"hand",v:"me",icon:qt,tip:"Take it myself"},{act:"hand",v:"agent",icon:Wt(13),tip:`Give it to ${ae(t)}`},{act:"give",icon:nl,tip:"Give it to someone",pick:!0}]}:null;return b?`<div class="dt-step dt-step--${b.step}">${b.step==="anyone"?ra:""}<span class="dt-step-text"><b>${g(b.title)}</b></span>${b.acts.map(h=>h.pick?`<label class="dt-step-act" data-tip="${g(h.tip)}">${h.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${g(h.tip)}"><option value="" selected hidden></option>${Fe().map(N=>`<option value="${g(N.email)}"${to(N.email)}>${g(N.email===n.me?.email?`Me \xB7 ${N.name||N.email}`:N.name||N.email)}</option>`).join("")}</select></label>`:`<button type="button" class="dt-step-act${h.main?" is-main":""}" data-act="${h.act}" data-id="${t.id}"${h.v?` data-v="${h.v}"`:""} data-tip="${g(h.tip)}" aria-label="${g(h.tip)}">${h.icon}</button>`).join("")}${b.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`:""},Hl=async(t,e)=>{let s=e?G.find(a=>a.id===t):void 0,o=await y(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,stage:za(G.find(a=>a.id===t))});return o.ok&&s&&No(de(s)).then(a=>{a&&y({id:t,after:a})}),o},hs=0,Wa=()=>{},ms=t=>(hs++,t.finally(()=>{hs--,Wa()})),te=async(t,e,s)=>{let o=G,a=xt;G=t(G),xt=t(xt),et();let r=await ms(e()).catch(()=>null);if(!r?.ok){G=o,xt=a,et(),qn(`${s} did not go through`,r);return}let d=gn([await r.json().catch(()=>null)])[0];d&&(G=G.map(b=>b.id===d.id?d:b),xt=xt.map(b=>b.id===d.id?d:b),et()),Ge()},za=t=>t?At(t.assignee)?"approved":t.assignee?"progress":"new":"new",Me=async(t,e)=>{await te(r=>r.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{stage:za(d),reopenedAt:new Date().toISOString(),reopenedBy:n.me?.email??"you"}}:d),()=>Hl(t,e),e?"Resolving":"Reopening");let s=xt.find(r=>r.id===t),o=s?.from,a=o&&xt.find(r=>r.id===o.id);e&&s?.status==="done"&&a&&Mt(a)&&!Mt(s)&&a.status!=="done"&&(await y({id:a.id,reply:"Fixed \u2014 please check.",status:"done",doneBy:"you"}).catch(()=>null),Ge())},ze=async(t,e,s=!1)=>{let o=G.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await te(r=>r.map(d=>d.id===t?{...d,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?n.me?.email:void 0}:d),()=>y({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!s&&He(`Archived #${t}`,()=>ze(t,!1,!0))},He=(t,e,s="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${g(t)}</span><button type="button">${g(s)}</button>`,on(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>o.remove(),5e3)},go=t=>te(e=>e.filter(s=>s.id!==t),()=>Ct(`comments?id=${t}`,{method:"DELETE"}),"Deleting"),Nl=t=>{let e=G.filter(a=>k(a)===t),s=e.filter(a=>bt(a)==="open").length,o=e.filter(a=>bt(a)==="claude").length;Ie.innerHTML=s?String(s):o?Wt(9):"\u2713",Ie.dataset.state=s?"open":o?"claude":"done",Ie.hidden=e.length===0},fo=0,Va,Cn=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t)return;t.style.translate="";let e=window.visualViewport,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`)};window.visualViewport?.addEventListener("resize",Cn),addEventListener("resize",Cn),document.addEventListener("focusin",Cn),document.addEventListener("focusout",()=>setTimeout(Cn));let et=()=>{for(let c of Object.keys(T))c!==String(nt)&&delete T[c];requestAnimationFrame(Cn);let t=fo-performance.now();if(t>0){clearTimeout(Va),Va=setTimeout(et,t);return}if(Mn(),f){let c=Da(),F=JSON.stringify(c);F!==qa&&(qa=F,parent.postMessage({dt:!0,drafts:c},location.origin))}ta(),ct.toggleAttribute("data-yield",nt!=null||!!S),nt!==rn&&(jt="",O=[],rn=nt),J&&J.id!==nt&&(J=null);let e=we();if(Nl(e),_s(),!$t){K.innerHTML="",Vs(null),vt.hidden=!0;return}let s=e;if(nt!=null&&!S){let c=G.find(F=>F.id===nt);c&&k(c)!==s&&(nt=null)}let o="",a=G.filter(c=>k(c)===s&&(Qo(c)&&dn(c)||c.id===nt));for(let c of a){let F=Qt(c);if(!F&&nt!==c.id)continue;let q=bt(c),lt=!F,C=F??{x:0,y:0},it=Qe(c.category),Et=Re(c),ne=q==="done"?null:se(c),mt=ne?Zs[ne]??"":"",gt=Is(c,q),Le=!!gt&&!gt.taker,re=!!gt&&!!gt.taker&>.taker!==gt.writer,yn=mt||Ln.find(ge=>ge[0]===un(c))[2],Ls=gt?Le?` \xB7 ${Js(gt.writer,c)} \xB7 nobody has it yet`:` \xB7 ${re?`${Js(gt.writer,c)} \u2192 `:""}${Js(gt.taker,c)}${gt.claude?` \xB7 Claude${Et?" is working":ne==="asks"?" asks":ne==="review"||q==="claude"?" fixed it":""}`:""}`:"";if(nt===c.id){let ge=Qs(c)?Se(c).length-_e[c.id]:0;ge>0&&(T[c.id]=ge),zr(c)}if(lt||(o+=`<button class="dt-pin dt-pin--${q}${q==="done"&&!oe(c)?" dt-pin--resolved":""}${gt?` dt-pin--people${Le?" dt-pin--nobody":""}${re?" dt-pin--pair":""}`:mt?" dt-pin--agent":""}${Et?" dt-pin--working":""}${q==="open"&&Jt(c)==="review"?" dt-pin--review":""}${F?.hidden?" dt-pin--hidden":""}${nt!==c.id&&!wa(c,le)?" dt-pin--dim":""}" data-id="${c.id}"${F?.off?` data-off="${F.off}"`:""} aria-label="Comment ${c.id}, ${q==="open"?"open":q==="claude"?`resolved by ${g(We(c.doneAgent,c.doneFor))}`:"resolved"}${g(Ls.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!gt&&mt?`, with ${g(ae(c))}`:""}" aria-expanded="${nt===c.id}"
|
|
237
|
-
style="left:${
|
|
238
|
-
title="${
|
|
239
|
-
style="left:${
|
|
251
|
+
</div></div>`,mo=(t,e,n)=>(t||/^[a-z][a-z0-9-]*/i.exec(n?.split(">").pop()?.trim()??"")?.[0]||"element")+(e?.[0]?"."+e[0]:""),br=()=>me.map((t,e)=>({i:e,el:mo(t.tag,t.classes,t.selector),text:Kt(t.text??""),shots:t.images?.length??0,orphan:!ue(t)})),ka=[],yr="",hn=t=>{let e=t.working;return wn(e?.agent,e?.by??t.doneFor)},pu=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`},go=(t,e)=>{let n=t.working;return{queued:"Queued for the agent \u2014 it takes it on its next run",asks:`${hn(t)} is waiting for your answer`,working:`${hn(t)} is on it \xB7 ${pu(n?.at)}`,stuck:`${hn(t)} went quiet \u2014 its next run takes it again`,review:`To check \u2014 ${wn(t.doneAgent,t.doneFor)} fixed it \xB7 click to reopen`,done:"Resolved"}[e]},hu=t=>{if(s.client||Nt(t))return"";let e=ne(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">${ki(13,0)}</button>`;let n=ki(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${b(go(t,e))}" aria-label="${b(go(t,e))}">${n}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${b(go(t,e))}" role="img" aria-label="${b(go(t,e))}">${n}</span>`},fo=t=>!!s.client&&!(s.me&&t.by===s.me.email),vr=(t,e=!0)=>{let n=kt(t),o=n==="done",a=ce(t);return`${e?hu(t):""}<button data-act="${o?"reopen":"done"}" data-id="${t.id}"
|
|
252
|
+
class="dt-note-resolve${o&&!a?" is-on":""}" title="${o?"Reopen":n==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${re}</button>${s.client?"":`<button data-act="${a?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${a?" is-on":""}" title="${a?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${sn}</button>`}`},mu='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',La=new Map,gu=(t,e)=>{let n=xi(e,25),o=La.get(t);o?.now!==n&&La.set(t,{now:n,was:o?.now??"",at:performance.now()});let a=La.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:${b(i)}" aria-hidden="true">${b(i)}</span>`:""}<span class="dt-step-now" data-k="${b(n)}"${n!==e?` data-tip="${b(e)}"`:""}>${b(n)}</span></span>`},fu=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!ce(t)){let f=t.confirmedBy?t.confirmedBy===s.me?.email?"you":un(t.confirmedBy).split(" ")[0]:"",v=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${$e(pn[pn.length-1][2],1)}<span class="dt-step-text"><b>${b(f?`Resolved by ${f}`:"Resolved")}${v?` \xB7 ${b(Ws(v))}`:""}</b></span><button type="button" class="dt-step-act" data-act="reopen" data-id="${t.id}" data-tip="Reopen \u2014 not right yet" aria-label="Reopen">${an}</button>`+(s.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">${sn}</button></div>`)}if(s.client||Nt(t))return"";let e=ne(t),n={act:"hand",v:"me",icon:er,tip:s.me?"Take it myself":"Take it off the agent"},o=[{act:"sendback",icon:an,tip:"Send it back \u2014 say what is wrong below"},{act:"accept",icon:re,tip:"Looks right \u2014 mark it resolved",main:!0,label:"Looks right"}],a=Ei(t),i=!Rt(t.assignee)&&t.assignee?t.assignee===s.me?.email?"You":un(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:[n]}:e==="review"?null:ve(t)==="review"&&i?{step:"review",title:`${i} ${i==="You"?"say":"says"} done`,acts:o}:null;if(!d)return"";let u=d.step==="review"?$e(Ze[2][2],Ze[2][3]):`<i class="dt-step-mark">${we(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${u}${d.now?`${mu}<span class="dt-step-text" aria-live="polite"><b>${gu(t.id,d.now)}<i class="dt-step-time">${b(d.time??"")}</i></b></span>`:`<span class="dt-step-text"><b>${b(d.title)}</b>${d.sub?`<span>${b(d.sub)}</span>`:""}</span>`}${d.acts.map(f=>f.pick?`<label class="dt-step-act" data-tip="${b(f.tip)}">${f.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${b(f.tip)}"><option value="" selected hidden></option>${ds().map(v=>Vi(v.email,v.email===s.me?.email?`Me \xB7 ${v.name||v.email}`:v.name||v.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${f.main?" is-main":""}${f.label?" has-label":""}" data-act="${f.act}" data-id="${t.id}"${f.v?` data-v="${f.v}"`:""} data-tip="${b(f.tip)}" aria-label="${b(f.tip)}">${f.icon}${f.label?b(f.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},bu=async(t,e,n)=>{let o=e?D.find(i=>i.id===t):void 0,a=await Y(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...n});return a.ok&&o&&Ya(ke(o)).then(i=>{i&&Y({id:t,after:i.url})}),a},bo=0,wr=()=>{},Un=t=>(bo++,t.finally(()=>{bo--,wr()})),Le=async(t,e,n)=>{let o=D,a=ft;D=t(D),ft=t(ft),K();let i;j=o;try{i=e()}finally{j=null}let l=await Un(i).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let f=Tn([d.thread])[0];D=o.map(P=>f&&P.id===f.id?f:P),ft=a.map(P=>f&&P.id===f.id?f:P),K();let v=d.by?d.by==="claude"?"The agent":un(d.by):"Someone";jt(`${v[0].toUpperCase()}${v.slice(1)} changed the ${d.field} just now`,6e3),Ve();return}if(!l?.ok){D=o,ft=a,K(),Nn(`${n} did not go through`,l);return}let u=Tn([await l.json().catch(()=>null)])[0];u&&(D=D.map(f=>f.id===u.id?u:f),ft=ft.map(f=>f.id===u.id?u:f),K()),Ve()},yu=t=>t?Rt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!Nt(t)&&!s.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},We=async(t,e)=>{let n=e?void 0:yu(D.find(l=>l.id===t)??ft.find(l=>l.id===t));await Le(l=>l.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{...n,reopenedAt:new Date().toISOString(),reopenedBy:s.me?.email??"you"}}:d),()=>bu(t,e,n),e?"Resolving":"Reopening");let o=ft.find(l=>l.id===t),a=e?Ld(o):null,i=a!=null&&ft.find(l=>l.id===a);i&&Nt(i)&&i.status!=="done"&&(await Y({id:i.id,reply:kd,status:"done",doneBy:"you"}).catch(()=>null),Ve())},kn=async(t,e,n=!1)=>{let o=D.find(i=>i.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await Le(i=>i.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?s.me?.email:void 0}:l),()=>Y({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!n&&_e(`Archived #${t}`,()=>kn(t,!1,!0))},_e=(t,e,n="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${b(t)}</span><button type="button">${b(n)}</button>`,Ko(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>o.remove(),5e3)},yo=new Set,vo=new Set,gs=new Map,$r=(t,e,n,o,a)=>{gs.get(t)?.(),n();let i=!1,l=()=>{i||(i=!0,clearTimeout(d),gs.delete(t),a())},d=window.setTimeout(l,5e3);gs.set(t,l),_e(e,()=>{i||(i=!0,clearTimeout(d),gs.delete(t),o())})};addEventListener("pagehide",()=>{for(let t of[...gs.values()])t()});let xr=(t,e,n)=>!e||t.some(o=>o.id===e.id)?t:[...t.slice(0,n),e,...t.slice(n)],Sa=t=>{let e=D.find(i=>i.id===t),n=D.findIndex(i=>i.id===t),o=ft.find(i=>i.id===t),a=ft.findIndex(i=>i.id===t);$r(`t${t}`,`Thread #${t} deleted`,()=>{yo.add(t),D=D.filter(i=>i.id!==t),ft=ft.filter(i=>i.id!==t),K()},()=>{yo.delete(t),D=xr(D,e,n),ft=xr(ft,o,a),K()},async()=>{let i=await Un(Qt(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);yo.delete(t),i?.ok||Nn("Deleting did not go through",i),Ve()})},vu=(t,e)=>{let n=`${t}|${e}`,o=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=o(D)??o(ft);if(!a)return;let i=(l,d)=>l.map(u=>u.id!==t?u:{...u,replies:(u.replies??[]).map(f=>f.at===e?d(f):f)});$r(`r${n}`,"Reply deleted",()=>{vo.add(n),D=i(D,l=>({...l,text:"",deleted:!0})),ft=i(ft,l=>({...l,text:"",deleted:!0})),K()},()=>{vo.delete(n),D=i(D,()=>a),ft=i(ft,()=>a),K()},async()=>{let l=await Un(Y({id:t,unsay:e})).catch(()=>null);vo.delete(n),l?.ok||Nn("Deleting the reply did not go through",l),Ve()})},Kn=null,Er=t=>Math.max(70,t*18),Mr=t=>{let e=kt(t),n=ps.find(o=>o[0]===t.priority)?.[3]??1;return(t.id===U?-100:0)+(ce(t)?30:e==="done"?20:e==="claude"?10:0)-n},wu=(t,e)=>{let n=[];for(let a of t){let i=e.get(a.id);if(!i)continue;let l=n.find(d=>{let u=e.get(d[0].id);return Math.abs(u.x-i.x)<6&&Math.abs(u.y-i.y)<6});l?l.push(a):n.push([a])}let o=new Map;for(let a of n){if(a.length<2)continue;a.sort((u,f)=>Mr(u)-Mr(f)||f.id-u.id);let i=a.length,l=Er(i),d=String(a[0].id);a.forEach((u,f)=>{let v=(-150+120*f/(i-1))*(Math.PI/180);o.set(u.id,{key:d,i:f,n:i,fx:Math.round(l*Math.cos(v))-14,fy:Math.round(l*Math.sin(v))+4})})}return o},Ta=t=>{if(Kn!==t){Kn=t;for(let e of G.querySelectorAll(".dt-pin[data-stack]"))e.classList.toggle("is-fanned",e.dataset.stack===t)}};document.addEventListener("pointermove",t=>{if(!Kn){let i=t.target?.closest?.(".dt-pin--stacktop");i&&t.pointerType==="mouse"&&Ta(i.dataset.stack);return}let e=G.querySelector(`.dt-pin--stacktop[data-stack="${Kn}"]`);if(!e){Kn=null;return}let n=parseFloat(e.style.left),o=parseFloat(e.style.top),a=Number(e.querySelector(".dt-pin-count")?.textContent)||2;Math.hypot(t.clientX-n,t.clientY-(o-40))>Er(a)+36&&Ta(null)},{passive:!0}),G.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),Ta(e.dataset.stack))},!0);let $u=(t,e)=>{let n=e||x||A?[]:m.filter(d=>d.id!==t).map(d=>({band:d,n:D.filter(u=>M(u)===d.id&&Js(u)&&cn(u)).length})).filter(d=>d.n).sort((d,u)=>u.n-d.n);if(qt.hidden=!n.length,!n.length)return;let[o,...a]=n,i=({band:d,n:u})=>`${u} ${u===1?"pin":"pins"} on ${d.label}`;qt.dataset.bp=o.band.id;let l=`${$t(o.band.icon,15)}<span>${b(i(o))}</span>${Go}`;qt.dataset.html!==l&&(qt.innerHTML=l,qt.dataset.html=l),qt.dataset.tip=a.length?`Also ${a.map(i).join(", ")}`:`Switch to ${o.band.label}`,qt.setAttribute("aria-label",`${i(o)} \u2014 switch to ${o.band.label}`)};qt.addEventListener("click",()=>{qt.dataset.bp&&ei(qt.dataset.bp)});let xu=t=>{let e=D.filter(a=>M(a)===t),n=e.filter(a=>kt(a)==="open").length,o=e.filter(a=>kt(a)==="claude").length;Ie.innerHTML=n?String(n):o?we(9):"\u2713",Ie.dataset.state=n?"open":o?"claude":"done",Ie.hidden=e.length===0},fs=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t||(t.style.translate="",Ln))return;let e=window.visualViewport,n=t.getBoundingClientRect(),o=n.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,n.top-8)}px`)},kr=window.visualViewport?.height??innerHeight,Lr=()=>{let t=window.visualViewport?.height??innerHeight,e=t<kr;if(kr=t,!e||!G.querySelector(".dt-note"))return fs();K();let n=document.activeElement?.closest(".dt-note.is-capped");n&&(n.scrollTop=n.scrollHeight)};window.visualViewport?.addEventListener("resize",Lr),addEventListener("resize",Lr),document.addEventListener("focusin",fs),document.addEventListener("focusout",()=>setTimeout(fs));let Aa=()=>{let t=window.visualViewport;return Math.min(innerHeight,t?t.offsetTop+t.height:innerHeight,document.querySelector(".devtools")?.getBoundingClientRect().top??innerHeight)-8},Ca=!1,Sr=null,Eu=()=>{if(U===Sr||(Sr=U,ot.hasAttribute("data-collapsed")&&!Ca))return;let t=U!=null?D.find(o=>o.id===U):void 0,e=t&&ue(t),n=!1;if(e){ot.removeAttribute("data-collapsed");let o=ot.getBoundingClientRect();n=!!o.width&&e.x>o.left-12&&e.x<o.right&&(Ln||e.y>o.top&&e.y<o.bottom)}Ca=n,ot.toggleAttribute("data-collapsed",n)},Tr=t=>{let e=ot.hidden?null:ot.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},Ar=(t,e=Aa())=>{if(t.style.marginTop="",Ln)return;let n=parseFloat(getComputedStyle(t).marginTop)||0,o=t.getBoundingClientRect().bottom-e;o>0&&(t.style.marginTop=`${n-o}px`);let a=t.getBoundingClientRect().top;a<8&&(t.style.marginTop=`${(parseFloat(t.style.marginTop)||n)+8-a}px`)},Cr=t=>{let e=Aa();for(let n of G.querySelectorAll(".dt-note")){let o=n.querySelector(".dt-note-thread");o&&o.scrollTop+o.clientHeight>=o.scrollHeight-4&&t.push(o);let a=n.scrollTop;delete n.dataset.flip,delete n.dataset.flipx,o?.style.removeProperty("max-height");for(let v of["max-height","overflow-y","margin-top","translate"])n.style.removeProperty(v);n.classList.remove("is-capped");let i=n.getBoundingClientRect(),l=i.top,d=e-l,u=l-28;if(i.bottom>e&&u>d&&(n.dataset.flip="1"),i.right>Tr(i)-8&&(n.dataset.flipx="1"),n.style.marginLeft="",n.dataset.flipx&&innerWidth>=480){let v=n.getBoundingClientRect(),P=Tr(v);v.right>P-8&&(n.style.marginLeft=`${(parseFloat(getComputedStyle(n).marginLeft)||0)-(v.right-P+8)}px`)}i=n.getBoundingClientRect();let f=n.dataset.flip?i.height-(e-8):i.bottom-e;f>0&&o&&(o.style.maxHeight=`${Math.max(40,o.clientHeight-f)}px`),n.getBoundingClientRect().height>e-8&&(Object.assign(n.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),n.classList.add("is-capped"),Ni.has(n)?n.scrollTop=a:(Ni.add(n),n.scrollTop=n.scrollHeight)),Ar(n,e)}for(let n of t)n.scrollTop=n.scrollHeight},Hr=0,Ln=!1,wo=t=>{t?.target?.closest?.(dn)||(clearTimeout(Hr),Hr=window.setTimeout(()=>{Ln=!1,G.querySelector(".dt-note")&&(Cr([]),requestAnimationFrame(fs),Se())},Ln?300:150))},K=()=>{for(let p of Object.keys(Ee))p!==String(U)&&delete Ee[p];if(requestAnimationFrame(fs),xn(),x){let p=br(),W=JSON.stringify(p);W!==yr&&(yr=W,parent.postMessage({dt:!0,drafts:p},location.origin))}if(Ii(),ot.toggleAttribute("data-yield",U!=null||!!A),U!==Oe){Oe!=null&&(de||oe.length)?Jo.set(Oe,{text:de,images:[...oe]}):Oe!=null&&Jo.delete(Oe);let p=U!=null?Jo.get(U):void 0;de=p?.text??"",oe=p?[...p.images]:[],Oe=U}Ft&&Ft.id!==U&&(Ft=null);let t=Ne();if(xu(t),Qo(),!Pt){G.innerHTML="",ia(null),xt.hidden=!0,qt.hidden=!0;return}let e=t;if(U!=null&&!A){let p=D.find(W=>W.id===U);p&&M(p)!==e&&(U=null)}Eu();let n="",o=D.filter(p=>M(p)===e&&(Js(p)&&cn(p)||p.id===U)),a=new Map(o.map(p=>[p.id,ue(p)])),i=wu(o,a);for(let p of o){let W=a.get(p.id)??null,z=i.get(p.id),Ht=oa(p),se=!W&&!!p.spot&&kt(p)==="open"&&Ht==="gone";if(!W&&!se&&U!==p.id)continue;let Wt=kt(p),wt=!W,_t=W??(se?{x:p.spot.x-scrollX,y:p.spot.y-scrollY}:{x:0,y:0});Ec(p,Wt==="open"?Ht:"found"),se&&(n+=`<button class="dt-pin dt-pin--ghost" data-id="${p.id}" aria-expanded="${U===p.id}" aria-label="Thread ${p.id}, its element is gone" title="${b(Ot(p.text,80))} \xB7 its element is gone \u2014 click to see what it was" style="left:${_t.x}px;top:${_t.y}px"></button>`);let en=Dn(p.category),Ue=Ke(p),fn=Wt==="done"?null:ne(p),bn=fn?ao[fn]??"":"",Ut=Fs(p,Wt),Jl=!!Ut&&!Ut.taker,di=!!Ut&&!!Ut.taker&&Ut.taker!==Ut.writer,yn=Wt==="done"?Fs(p,"open"):null,Zl=!!yn&&!yn.claude&&!!yn.taker&&yn.taker!==yn.writer,bp=bn||Ze.find(Ps=>Ps[0]===Mn(p))[2],Ql=Ut?Jl?` \xB7 ${ua(Ut.writer,p)} \xB7 anyone can take it`:` \xB7 ${di?`${ua(Ut.writer,p)} \u2192 `:""}${ua(Ut.taker,p)}${Ut.claude?` \xB7 ${hn(p)}${pa(p)}`:""}`:"";if(U===p.id&&kc(p),wt||(n+=`<button class="dt-pin dt-pin--${Wt}${Wt==="done"&&!ce(p)?" dt-pin--resolved":""}${Ut?` dt-pin--people${Jl?" dt-pin--nobody":""}${di?" dt-pin--pair":""}`:Zl?" dt-pin--people dt-pin--pair":bn?" dt-pin--agent":""}${Ue?" dt-pin--working":""}${Wt==="open"&&ve(p)==="review"?" dt-pin--review":""}${W?.hidden?" dt-pin--hidden":""}${Ht==="probably"?" dt-pin--probably":""}${W?.opener?" dt-pin--inside":""}${U!==p.id&&!Zi(p,Je)?" dt-pin--dim":""}${z?` dt-pin--stack${z.i?"":" dt-pin--stacktop"}${Kn===z.key?" is-fanned":""}`:""}" data-id="${p.id}"${z?` data-stack="${z.key}"`:""} aria-label="Thread ${p.id}, ${Wt==="open"?"open":Wt==="claude"?`resolved by ${b(wn(p.doneAgent,p.doneFor))}`:"resolved"}${b(Ql.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!Ut&&bn?`, with ${b(hn(p))}`:""}${W?.hidden?Ks:""}" aria-expanded="${U===p.id}"
|
|
253
|
+
style="left:${_t.x}px;top:${_t.y}px;--cat:${en.color};--ring:${bp};--hue:${Fe(p.by||p.byName||"")}${bn?`;--step-c:${bn}`:""}${Ha.has(p.id)?`;--dt-page:${Ha.get(p.id)}`:""}${z?`;--fx:${z.fx}px;--fy:${z.fy}px`:""}"
|
|
254
|
+
title="${b(Ot(p.text,80))} \xB7 ${en.label}${Ut?b(Ql):Ue||fn==="queued"?` \xB7 ${b(hn(p)+pa(p))}`:""}${Wt==="claude"?` \xB7 resolved by ${b(wn(p.doneAgent,p.doneFor))} \u2014 tick to confirm`:Wt==="done"?" \xB7 resolved":""}${W?.hidden?Ks:""}${Ts(p)?" \u2014 drag to move":""}"${Ts(p)?" data-move":""}>${Wt==="done"?yn?`${zn(yn.writer,p)}${Zl?zn(yn.taker,p):""}<i class="dt-pin-cut" aria-hidden="true">${re}</i>`:"\u2713":Ut?`${zn(Ut.writer,p)}${di?zn(Ut.taker,p):""}${Ut.claude?`<i class="dt-pin-claude" aria-hidden="true">${we(9)}</i>`:""}`:bn?we(11):da(p)}${U!==p.id&&Gi(p)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}${z&&!z.i?`<i class="dt-pin-count" aria-hidden="true">${z.n}</i><i class="dt-pin-spot" aria-hidden="true"></i>`:""}${W?.opener?'<i class="dt-pin-inside" aria-hidden="true"></i>':""}</button><i class="dt-pin-eye" data-eye="${p.id}" aria-hidden="true" style="left:${_t.x}px;top:${_t.y}px"${W?.hidden?"":" hidden"}>${tr}</i>`),U===p.id){let Ps=vn(p),yp=ne(p)==="review"&&!s.client?Ps.map(at=>at.author).lastIndexOf("claude"):-1,td=ne(p)==="asks"&&!s.client?Ps.length-1:-1;n+=`<div class="dt-note${wt?" dt-note--orphan":""}" data-id="${p.id}" role="dialog" aria-label="Thread ${p.id}"
|
|
255
|
+
style="left:${_t.x}px;top:${_t.y}px">
|
|
240
256
|
<div class="dt-note-bar">
|
|
241
|
-
<span class="dt-note-el"${
|
|
257
|
+
<span class="dt-note-el"${s.client?"":` data-tip="${Ji(p.selector,p.label)}"`}>${s.client||Nt(p)?`Thread #${p.id>0?p.id:"\u2026"}`:b(mo(p.tag,p.classes,p.selector))}</span>
|
|
242
258
|
<span class="dt-note-tools">
|
|
243
|
-
${
|
|
259
|
+
${vr(p,!1)}
|
|
244
260
|
<i class="dt-note-sep"></i>
|
|
245
|
-
${
|
|
246
|
-
<button data-act="close" data-id="${
|
|
261
|
+
${fo(p)?"":ir(p)}
|
|
262
|
+
<button data-act="close" data-id="${p.id}" data-tip="Close" aria-label="Close">${on}</button>
|
|
247
263
|
</span>
|
|
248
264
|
</div>
|
|
249
|
-
${
|
|
250
|
-
|
|
251
|
-
${(()=>{let
|
|
252
|
-
${
|
|
265
|
+
${Mc(p,W,Ht,wt)}
|
|
266
|
+
${(at=>`<div class="dt-note-hidden"${W?.hidden?"":" hidden"}><b>${tr}<span>${at?`Hidden in \xAB${b(at)}\xBB`:"Hidden right now"}</span></b><button type="button" data-act="where" data-id="${p.id}">Show where</button><button type="button" class="dt-note-hidden-more" data-act="hidden-why" aria-expanded="false" aria-label="Why" data-tip="Why">${us}</button><p hidden>It sits inside ${at?`\xAB${b(at)}\xBB`:"something"}, which is closed. Open it on the page and the pin moves onto the spot.</p></div>`)(Dc(W?.shut&&W.shut!==W.el?W.shut:W?.hidden))}
|
|
267
|
+
${(()=>{let at=Bc(p)+ha(Dn(p.category).id,p.id,fo(p))+(p.host&&p.host!==location.host?`<span class="dt-note-host" title="Written on ${b(p.host)}">${b(p.host)}</span>`:"");return at?`<div class="dt-note-meta">${at}</div>`:""})()}
|
|
268
|
+
${Pc(p)}
|
|
253
269
|
<div class="dt-note-thread">
|
|
254
|
-
${
|
|
255
|
-
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${
|
|
256
|
-
<textarea class="dt-note-edit-input" rows="1" maxlength="${
|
|
257
|
-
${
|
|
270
|
+
${Rc(p,Ps.map((at,ss)=>{let Oo=ss===0?null:at.at??null,Rn=at.author==="you"&&(!at.by||at.by===s.me?.email),ed=Rn&&Ft?.id===p.id&&Ft.at===Oo,Do=s.team?.find(Pn=>Pn.email===at.by),os=at.author==="claude"?wn(at.agent,at.by):Rn?"You":Do?.name||at.byName||at.by||"You",nd=at.author==="claude"?`<span class="dt-msg-face dt-msg-ai">${we(11)}</span>`:(Pn=>_n(Do?.avatar_url,Do?.name||at.byName||(Rn?s.me?.name:"")||at.by||os,"dt-msg-face").replace(/^<(img|b) /,`<$1 style="--hue:${Fe(Pn)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"))((at.by||(Rn?s.me?.email??"":"")||os).toLowerCase()),ci=`${p.id}:${at.at??"0"}`,sd=je.get(ci)?.text,ui=!Rn&&s.voice&&at.text?ou(p.id,at.at??"0",at.text):"",od=ui?iu(p.id,at.at??"0",at.text):"",qo=p.id<=0?null:ss===0?"":p.replies?.some(Pn=>Pn.at===at.at)?at.at:null,pi=qo===null?"":du(p.id,qo,at.reactions),vp=qo!==null&&!pi?`<button class="dt-msg-edit" data-act="react-pick" data-id="${p.id}" data-at="${b(qo)}" data-tip="Add reaction" aria-label="Add reaction">${hr}</button>`:"",ad=at.author==="claude"?[xd(at.agent),at.by?at.by===s.me?.email?"you":(Do?.name||at.by).split(" ")[0]:""].filter(Boolean).join(" \xB7 "):"",hi=`<div class="dt-msg-head">${nd}<b>${b(os)}</b>${ad?`<span class="dt-msg-sub">${b(ad)}</span>`:""}<time>${nn(at.at)}</time>${vp}${ui}${Rn&&!ed?`<button class="dt-msg-edit" data-act="edit" data-id="${p.id}" data-at="${b(Oo??"")}" title="Edit">${On}</button>${Oo?`<button class="dt-msg-edit" data-act="unsay" data-id="${p.id}" data-at="${b(Oo)}" title="Delete">${In}</button>`:""}`:""}</div>`;return ss===yp?`<div class="dt-msg dt-msg--done" data-msg="${p.id}:${b(at.at??"0")}"><div class="dt-msg-head">${nd}<b>${b(os)} fixed it</b><time>${nn(at.at)}</time>${ui}</div><p${je.get(ci)?.text===null?' class="is-asking"':""}>${hl(sd||at.text)}</p>${od}${ya(at.images)}${pi}
|
|
271
|
+
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${p.id}">${re}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${p.id}">${an}Send back</button></div></div>`:ed?`<div class="dt-msg">${hi}<div class="dt-compose">
|
|
272
|
+
<textarea class="dt-note-edit-input" rows="1" maxlength="${Ma}" aria-label="Edit the message">${b(Ft.text)}</textarea>
|
|
273
|
+
${ya(at.images.filter(Pn=>!Ft.drop.includes(Pn.split("/").pop())),p.id)}
|
|
258
274
|
<div class="dt-compose-bar">
|
|
259
275
|
<button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
|
|
260
|
-
<button class="dt-send${
|
|
276
|
+
<button class="dt-send${Ft.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${re}</button>
|
|
261
277
|
</div>
|
|
262
|
-
</div></div>`:`<div class="dt-msg" data-msg="${
|
|
278
|
+
</div></div>`:`<div class="dt-msg${Rn?" dt-msg--mine":""}${ss===td?" dt-msg--asks":""}" data-msg="${p.id}:${b(at.at??"0")}">${ss===td?hi.replace(`<b>${b(os)}</b>`,`<b>${b(os)} asks</b>`):hi}<p${je.get(ci)?.text===null?' class="is-asking"':""}>${hl(sd||at.text)}</p>${od}${ss===0&&p.suggest?Hc(p.suggest):""}${ya(at.images)}${pi}</div>`}))}
|
|
263
279
|
</div>
|
|
264
|
-
${
|
|
265
|
-
${
|
|
266
|
-
${
|
|
267
|
-
${
|
|
268
|
-
</div>`}}
|
|
269
|
-
style="left:${
|
|
270
|
-
<div class="dt-note${
|
|
280
|
+
${Ee[p.id]?`<button type="button" class="dt-new-below" data-act="newbelow" data-id="${p.id}">${Ee[p.id]} new ${Ee[p.id]===1?"reply":"replies"} \u2193</button>`:""}
|
|
281
|
+
${fu(p)}
|
|
282
|
+
${fr("dt-note-reply-input",ne(p)==="asks"?`Answer ${b(hn(p))}`:"Reply",de,`data-act="reply" data-id="${p.id}"`,ur(oe))}
|
|
283
|
+
${Qi(p.priority,p.category,p.id,p.assignee??"",fo(p),Nt(p),!0)}
|
|
284
|
+
</div>`}}me.forEach((p,W)=>{let z=ue(p);z&&(n+=`<button class="dt-pin dt-pin--draft" data-parked="${W}" data-act="draft-open" data-i="${W}"
|
|
285
|
+
style="left:${z.x}px;top:${z.y}px" title="Draft, not sent \u2014 click to finish it">${Wi()}</button>`)});let l=A&&ue(A);if(A){let p=l?.x??0,W=l?.y??0;n+=`${l?`<span class="dt-pin dt-pin--draft" data-draft style="left:${p}px;top:${W}px">${Wi()}</span>`:""}
|
|
286
|
+
<div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${p}px;top:${W}px">
|
|
271
287
|
<div class="dt-note-bar">
|
|
272
|
-
<span class="dt-note-el"${
|
|
273
|
-
${
|
|
288
|
+
<span class="dt-note-el"${s.client?"":` data-tip="${Ji(A.selector,A.label)}"`}>${s.client?"New thread":b(mo(A.tag,A.classes,A.selector))}</span>
|
|
289
|
+
${is()?'<span class="dt-note-draft">Draft</span>':""}
|
|
274
290
|
<span class="dt-note-tools">
|
|
275
291
|
|
|
276
|
-
${
|
|
277
|
-
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${
|
|
292
|
+
${ir()}
|
|
293
|
+
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${on}</button>
|
|
278
294
|
</span>
|
|
279
295
|
</div>
|
|
280
|
-
${
|
|
281
|
-
${(()=>{let
|
|
282
|
-
${
|
|
283
|
-
${
|
|
284
|
-
<span class="dt-suggest-was">Now: <del>${
|
|
285
|
-
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${
|
|
296
|
+
${l?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
|
|
297
|
+
${(()=>{let z=l?ke(A):null,Ht=z&&D.find(se=>se.id>0&&kt(se)==="open"&&ke(se)===z);return Ht?`<p class="dt-note-twin">Already open here: \u201C${b(Ot(Ht.text,60))}${Ht.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${Ht.id}">Open it</button></p>`:""})()}
|
|
298
|
+
${s.client?`<div class="dt-note-meta">${qc(A.assignee)}</div>`:""}
|
|
299
|
+
${A.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">${on}</button></span>
|
|
300
|
+
<span class="dt-suggest-was">Now: <del>${b(Ot(A.suggest.from,160))}${A.suggest.from.length>160?"\u2026":""}</del></span>
|
|
301
|
+
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${b(A.suggest.to)}</textarea>
|
|
286
302
|
<span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
|
|
287
|
-
|
|
288
|
-
${
|
|
289
|
-
</div>`}let d=new Map([...K.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(c=>[c.closest(".dt-note").dataset.id,{top:c.scrollTop,end:c.scrollTop+c.clientHeight>=c.scrollHeight-4}])),b=new Set([...K.querySelectorAll("[data-msg]")].map(c=>c.dataset.msg)),h=K.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Xo(K,o),h&&!K.contains(document.activeElement)&&xs(".dt-note-reply-input");for(let c of K.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let F=c.closest(".dt-note").dataset.id,q=d.get(F);if(!q)continue;let lt=[...c.querySelectorAll("[data-msg]")].filter(it=>!b.has(it.dataset.msg));for(let it of lt)it.classList.add("dt-msg--new");c.scrollTop=q.end&<.length||String(x)===F?c.scrollHeight:q.top;let C=lt.filter(it=>!it.querySelector(".dt-msg-edit")).length;if(C&&!q.end&&String(x)!==F){T[F]=(T[F]??0)+C;let it=T[F],Et=c.parentElement.querySelector(".dt-new-below")??c.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Et.dataset,{act:"newbelow",id:F}),Et.textContent=`${it} new ${it===1?"reply":"replies"} \u2193`}}for(let c of K.querySelectorAll(".dt-new-below")){let F=c.closest(".dt-note")?.querySelector(".dt-note-thread");(!F||F.scrollTop+F.clientHeight>=F.scrollHeight-4)&&(delete T[c.dataset.id],c.remove())}x=null;let N=Math.min(innerHeight,document.querySelector(".devtools")?.getBoundingClientRect().top??innerHeight)-8;for(let c of K.querySelectorAll(".dt-note")){let F=c.getBoundingClientRect(),q=F.top,lt=N-q,C=q-32;F.bottom>N&&C>lt&&(c.dataset.flip="1"),F.right>innerWidth-8&&(c.dataset.flipx="1"),F=c.getBoundingClientRect();let it=c.dataset.flip?F.height-(N-8):F.bottom-N,Et=c.querySelector(".dt-note-thread");it>0&&Et&&(Et.style.maxHeight=`${Math.max(40,Et.clientHeight-it)}px`),c.getBoundingClientRect().height>N-8&&(Object.assign(c.style,{maxHeight:`${N-8}px`,overflowY:"auto"}),c.classList.add("is-capped"),xn.has(c)||(xn.add(c),c.scrollTop=c.scrollHeight));let ne=c.getBoundingClientRect().bottom-N;ne>0&&(c.style.marginTop=`${-ne}px`);let mt=c.getBoundingClientRect().top;mt<8&&(c.style.marginTop=`${(parseFloat(c.style.marginTop)||0)+8-mt}px`)}hn(s),Vs(Ks()),ce();for(let c of K.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Ro(c);let V=K.querySelector(".dt-note-input");V&&document.activeElement!==V&&(V.focus(),V.setSelectionRange(V.value.length,V.value.length))},Bl=()=>{let t=!1,e=[];for(let s of K.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(s.classList.contains("dt-note--orphan")||s.classList.contains("is-dragging"))continue;let o=G.find(r=>r.id===Number(s.dataset.id)),a=o&&Qt(o);e.push([s,a&&s.matches(".dt-pin")&&Jn(a.el,a.x,a.y)?null:a]),a&&aa(a.el)&&(t=!0)}for(let s of K.querySelectorAll("[data-draft], [data-parked]")){if(s.classList.contains("dt-note--orphan"))continue;let o=s.dataset.parked?dt[Number(s.dataset.parked)]:S;e.push([s,o?Qt(o):null])}for(let[s,o]of e){if(!o){s.style.visibility="hidden";let a=s.nextElementSibling;a?.matches(".dt-pin-eye")&&(a.hidden=!0);continue}if(s.style.visibility="",s.style.left=`${o.x}px`,s.style.top=`${o.y}px`,s.matches(".dt-pin[data-id]")){o.off?s.dataset.off=o.off:delete s.dataset.off,s.classList.toggle("dt-pin--hidden",!!o.hidden);let a=s.nextElementSibling;a?.matches(".dt-pin-eye")&&(a.hidden=!o.hidden,a.style.left=`${o.x}px`,a.style.top=`${o.y}px`)}s.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!o.hidden)}if(!es.length&&(S||nt!=null)){let s=Ks();s&&aa(s)&&Vs(s)}Oe(S||nt!=null?Ks():null),t&&ce()},hn=t=>{if(!ct.hidden&&(Xo(ct,Sr({bp:t,notes:G.filter(dn),breakpoints:l,bandOfNote:k,orphan:e=>!Qt(e),hiddenNow:e=>!!Qt(e)?.hidden,whoseAgent:We,statusTools:e=>_a(e,!fa(e)),showResolved:Zt,showArchived:ve,archived:oe,drafts:Kt.hidden?Da():mo,checks:f?0:gs.toCheck().length,marker:Pl,assign:fa,find:Gt,forMe:Rl,forAgent:e=>!!se(e)&&bt(e)!=="done",unread:Qs,agentless:e=>n.client||It()||Mt(e),archives:!n.client&&!It()})),mn)){let e=ct.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(mn.at,mn.at),mn=null}},mn=null,Rl=t=>{if(bt(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||bt(t)==="claude"||Jt(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return Se(t).some(s=>s.text.toLowerCase().includes("@"+e))},Pl=t=>{let e=se(t),s=Zs[e??""],o=bt(t)==="done"?oe(t)?`<i class="dt-hist-badge is-archived">${rs}</i>`:`<i class="dt-hist-badge is-done">${qt}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${Wt(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${Ln.find(r=>r[0]===un(t))[2]}"></i>`,a=ha(t);return a?`<span class="dt-hist-face" style="--hue:${kn(t.by||t.byName||"")}">${a}${o}</span>`:`<span class="dt-hist-n" style="--cat:${Qe(t.category).color}">${o}</span>`},bo=t=>ct.toggleAttribute("data-collapsed",t);ct.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(Gt.q=e.value,mn={at:e.selectionStart??e.value.length},hn(we()))}),ct.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await Ge(),setTimeout(()=>delete e.dataset.spin,500);return}if(ct.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){bo(!1);return}if(t.target.closest("[data-fold]")){bo(!ct.hasAttribute("data-collapsed"));return}let s=t.target.closest(".dt-hist-bands [data-bp]");if(s){Hi(s.dataset.bp);return}let o=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(o){o.dataset.histView?(Gt.view=o.dataset.histView,$("dt-view",Gt.view),Gt.menu=!1):o.dataset.histSort?(Gt.sort=o.dataset.histSort,$("dt-sort",Gt.sort),Gt.menu=!1):o.hasAttribute("data-hist-clear")?(Gt.q="",mn={at:0}):Gt.menu=!Gt.menu,hn(we());return}Gt.menu&&!t.target.closest(".dt-hist-menu")&&(Gt.menu=!1,hn(we()));let a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){let F=a.dataset.draftRm!==void 0,q=Number(F?a.dataset.draftRm:a.dataset.draftGo);Kt.hidden?F?Ka(q):yo(q):ee(F?{dropDraft:q}:{openDraft:q});return}let r=t.target.closest("[data-unmark]");if(r){t.stopPropagation(),await Me(Number(r.dataset.unmark),!1);return}let d=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(d){await Me(Number(d.dataset.id),d.dataset.act==="done");return}let b=t.target.closest("[data-rm]");if(b){if(!confirm("Delete this thread and its replies? This cannot be undone."))return;nt=null,await go(Number(b.dataset.rm));return}if(t.target.closest("[data-review]")){gs.start();return}if(t.target.closest("[data-resolved]")){wo(!Zt);return}if(t.target.closest("[data-archived]")){$o(!ve);return}let h=t.target.closest("[data-archive-all]");if(h){let F=h.dataset.archiveAll.split(",").map(Number);for(let q of F)await ze(q,!0,!0);He(`Archived ${F.length}`,()=>{for(let q of F)ze(q,!1,!0)});return}let N=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(N){await ze(Number(N.dataset.id),N.dataset.act==="archive");return}let V=t.target.closest("[data-go]");if(!V)return;let c=Number(V.dataset.go);if(!Kt.hidden){ee({open:c});return}Hn(c)});let Hn=t=>{nt=t,Tt(),et();let e=G.find(o=>o.id===t),s=e&&Qt(e);s?scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"}):e&&de(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||K.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},yo=t=>{let[e]=dt.splice(t,1);if(!e)return;Tt(),S=e,nt=null;let s=Qt(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),et()},Ka=t=>{dt.splice(t,1),et()},gs=Tr({inFrame:f,everything:()=>xt,route:()=>Q,settle:Me,keepIn:on,toast:t=>Lt(t),waits:t=>bt(t)==="claude"||bt(t)==="done"&&!oe(t),approve:t=>bt(t)==="claude"?Me(t.id,!0):ze(t.id,!0,!0),open:t=>{if($t||he(!0),k(t)!==we()){Hi(k(t));for(let e of[600,1500])setTimeout(()=>ee({open:t.id}),e)}else Hn(t.id)}}),Ol=t=>{ct.hidden=!t,at.setAttribute("aria-pressed",String(t)),$("dt-history",t?"1":"0"),et()},vo=document.querySelector(".dt-resolved-btn"),Nn=document.querySelector(".dt-space"),Il=t=>{if(!Nn)return;Nn.hidden=!Ce(),Nn.dataset.on=ye;let e=document.documentElement,s=e.dataset.dtSpace==="clients";Ce()&&ye==="clients"?(e.dataset.dtSpace="clients",s||(e.classList.add("dt-client-glow"),window.setTimeout(()=>e.classList.remove("dt-client-glow"),1700))):delete e.dataset.dtSpace;for(let o of Nn.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===ye));let r=o.querySelector(".dt-space-n");r.textContent=String(t[a]),r.hidden=!t[a]}},Ua=0,Bn=t=>{if(!Ce()||t===ye)return;let e=()=>{ye=t,$("dt-space",t),nt!=null&&!dn(G.find(o=>o.id===nt))&&(nt=null),Tt(),fs(xt),et(),hn(we())};if(matchMedia("(prefers-reduced-motion: reduce)").matches)return e();let s=document.documentElement;s.classList.add("dt-switching"),clearTimeout(Ua),Ua=window.setTimeout(()=>{e(),requestAnimationFrame(()=>s.classList.remove("dt-switching"))},120)};document.querySelector(".dt-client-x")?.addEventListener("click",()=>Bn("studio")),Nn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&Bn(e.dataset.space)});let Ne=document.querySelector(".dt-pinf"),Rn=Ne.querySelector(".dt-pinf-btn"),ie=Ne.querySelector(".dt-pinf-menu"),Ga={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",claude:"My Claude",wrote:"Written by me",check:"To check"},Dl=()=>G.filter(t=>k(t)===we()&&Qo(t)&&dn(t)),Pn=(t,e=!1)=>{ie.hidden=!t,Rn.setAttribute("aria-expanded",String(t)),t&&(_s(),e&&ie.querySelector('[aria-checked="true"]')?.focus())};_s=()=>{let t=Dl();if(Ne.hidden=!Ce()||!t.length,Ne.hidden){ie.hidden=!0;return}let e=Object.fromEntries(Zo.map(C=>[C,t.filter(it=>wa(it,C)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",kn(s)],["others","var(--dt-faint)"]],a=o.reduce((C,[it])=>C+e[it],0)||1,r=11.75,d=o.filter(([C])=>e[C]).length>1?.42:0,b=2*Math.PI*r,h=0,N="";for(let[C,it]of o){let Et=2*Math.PI*e[C]/a;e[C]&&(N+=`<circle cx="20" cy="20" r="${r}" stroke="${it}" stroke-dasharray="${(Math.max(.3,Et-d)*r).toFixed(2)} ${b.toFixed(2)}" stroke-dashoffset="${(-(h+d/2)*r).toFixed(2)}"${le===C?' class="is-on"':le!=="all"?' class="is-off"':""}/>`),h+=Et}if(Ne.querySelector(".dt-pinf-arcs").innerHTML=N,Ne.querySelector(".dt-pinf-n").textContent=String(e[le]),Rn.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} nobody has, ${e.mine} mine, ${e.others} everyone else's${le==="all"?"":`; showing ${Ga[le]}, ${e[le]}`}`),ie.hidden)return;let V=[...new Set(t.map(C=>Is(C,bt(C))?.taker).filter(C=>!!C&&C!==s))].slice(0,2),c=C=>cn($e(C)?.avatar_url,$e(C)?.name||C,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${kn(C)}" `),F={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:c(s),others:V.map(c).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">${Wt(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:ss(Ln[2][2],Ln[2][3])},q=(C,it)=>`<b class="dt-pinf-share"><i style="--c:${it};width:${Math.round(100*e[C]/e.all)}%"></i></b>`,lt=(C,it="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${le===C}" data-pinf="${C}"><i class="dt-pinf-glyph">${F[C]}</i><span>${Ga[C]}</span>${it?q(C,it):""}<em>${e[C]}</em>${qt}</button>`;ie.innerHTML=`<div class="dt-pinf-head"><b>SHOW</b>${e.all} on this page</div>${lt("all")}${o.map(([C,it])=>lt(C,it)).join("")}<hr>${lt("claude")}${lt("wrote")}${lt("check")}${n.shortcuts?'<div class="dt-pinf-foot"><kbd>F</kbd>opens it \xB7 the rest dim, not hidden</div>':""}`},Rn.addEventListener("click",t=>Pn(ie.hidden,t.detail===0)),ie.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(le=e.dataset.pinf,$("dt-pinf",le),Pn(!1),Rn.focus(),$t?et():he(!0))}),ie.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),Pn(!1),Rn.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...ie.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!ie.hidden&&!Ne.contains(t.target)&&Pn(!1)},!0);let wo=t=>{Zt=t,vo.setAttribute("aria-pressed",String(t)),$("dt-resolved",t?"1":"0"),ee({resolved:t}),et(),Ke(!0)},$o=t=>{ve=t,$("dt-archived",t?"1":"0"),ee({archived:t}),et(),Ke(!0)};vo.addEventListener("click",()=>wo(!Zt)),vo.setAttribute("aria-pressed",String(Zt)),at.addEventListener("click",()=>{let t=ct.hidden===!0;t&&!$t&&he(!0),t&&bo(!1),Ol(t)});let ce=()=>{De||!$t||(De=requestAnimationFrame(()=>{De=0,Bl()}))},Ya=`${be}, .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`,ql=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Ya))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(Ya))},Xa=()=>{let t=document.querySelector(".dt-room")??Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"});document.body.lastElementChild!==t&&document.body.append(t)},Ja=new MutationObserver(t=>{$t&&!f&&document.body.lastElementChild?.className!=="dt-room"&&Xa(),!t.every(ql)&&(oa(),ce())}),Za=new ResizeObserver(()=>ce()),Qa=()=>{K.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&ce()},xt=[],ti=()=>{},On=new Set,Yt={at:"",ids:[]},fs=t=>{xt=t,queueMicrotask(()=>ti());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={},o={studio:0,clients:0};for(let h of t){if(oe(h)||(bt(h)!=="done"&&o[Mt(h)?"clients":"studio"]++,!dn(h)))continue;let N=bt(h),V=se(h),c=N==="done"?"done":N==="claude"?"review":V&&os[V]||un(h),F=s[h.route??""]??={...e(),bands:{}};F[c]++;let q=k(h);(F.bands[q]??=e())[c]++}Il(o);let a=["new","progress","review","waiting","done"],r={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},d=h=>a.map(N=>[N,N==="done"&&!Zt?0:h[N]]),b=h=>d(h).reduce((N,[,V])=>N+V,0);for(let h of document.querySelectorAll(".dt-pages a")){let N=h.querySelector(".dt-pages-n");if(!N)continue;let V=s[new URL(h.href).pathname.replace(/\/+$/,"")||"/"];for(let q of l){let lt=V?.bands[q.id];for(let[C,it]of d(lt??e())){let Et=N.querySelector(`[data-bp="${q.id}"][data-state="${C}"]`);Et.hidden=!it,it&&(Et.querySelector("i").textContent=String(it),Et.title=`${q.label}: ${it} ${r[C]}`)}}let c=V?b(V):0;N.hidden=!c;let F=V?l.filter(q=>V.bands[q.id]&&b(V.bands[q.id])).map(q=>`${q.label} ${b(V.bands[q.id])}`).join(" \xB7 "):"";N.title=c?`${a.filter(q=>V[q]).map(q=>`${V[q]} ${r[q]}`).join(" \xB7 ")}
|
|
290
|
-
${F}`:""}},gn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string").map(e=>({...e,id:Number(e.id),rx:Number(e.rx)||0,ry:Number(e.ry)||0,route:typeof e.route=="string"&&/^\/(?![\/\\])/.test(e.route)?e.route:"/",replies:Array.isArray(e.replies)?e.replies.filter(s=>typeof s?.text=="string"):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[]})),Fl=Ar(f,t=>Lt(t)),Xt=document.querySelector(".dt-push"),ue=Xt.querySelector(".dt-push-menu"),pe=new Set,fn=new Set,bs=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",ys=()=>n.client||It()||f?[]:xt.filter(t=>t.status!=="done"&&At(t.assignee)&&Jt(t)==="approved"&&!Re(t)&&!oe(t)&&!On.has(t.id)),vs=()=>ys().filter(t=>!pe.has(t.id)),ei=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?qt:""}</i>`,ni=()=>{let t=ys(),e=[...new Set(t.map(o=>o.route??"/"))],s=vs().length;ue.innerHTML=`<div class="dt-push-head">${Wt(14)}<b>Waiting for Claude</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(d=>(d.route??"/")===o),r=a.filter(d=>!pe.has(d.id)).length;return`<button type="button" class="dt-push-page${fn.has(o)?" is-open":""}" data-push-route="${g(o)}"><span data-push-fold="${g(o)}">${fn.has(o)?"\u25BE":"\u25B8"}</span>${ei(r>0,r>0&&r<a.length)}<span class="dt-push-route">${g(o)}</span><em>${a.length}</em></button>`+(fn.has(o)?a.map(d=>`<button type="button" class="dt-push-thread" data-push-id="${d.id}">${ei(!pe.has(d.id))}<span><small>#${d.id}</small>${g(d.text.slice(0,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>${Wt(13)}Send ${s} to Claude</button>`},xo=()=>["push","paused"].includes(bs()),Eo=()=>Yt.ids.filter(t=>{let e=xt.find(s=>s.id===t);return!!e&&e.status!=="done"&&Jt(e)!=="review"&&(On.has(t)||!!Re(e)||Jt(e)==="approved")}),si="",jl=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Ve=()=>{let t=bs(),e=vs().length,s=Eo(),o=Yt.ids.length-s.length,a=s.length>0&&xo();if(Xt.classList.toggle("is-working",a),s.length&&(si=Yt.at),!s.length&&Yt.ids.length&&Yt.at&&si===Yt.at&&!jl(Yt.at)){try{sessionStorage.setItem("nm-batch-done",Yt.at)}catch{}xt.length&&He(`Claude finished ${Yt.ids.length} \u2014 check the fixes`,()=>gs.start(),"Check")}Xt.hidden=n.client||It()||f,Xt.classList.toggle("is-live",xo()),Xt.classList.toggle("is-quiet",t==="on");let r=Xt.querySelector(".dt-push-n");r.textContent=String(a?s.length:e),r.hidden=a?!1:!e||t==="on",Xt.querySelector(".dt-push-all").dataset.tip=a?`Push to Claude: Claude 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 Claude: turbo is on \u2014 Claude takes each comment as it lands":t==="none"?`Push to Claude: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to Claude: ${e} ${e===1?"comment waits":"comments wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to Claude: nothing waits for Claude yet \u2014 mark comments for Claude, then send them here",(Xt.hidden||!ys().length)&&(ue.hidden=!0),ue.hidden||ni()},oi=async t=>{if(!t.length&&xo()){Lt("Nothing waits for Claude \u2014 mark comments for Claude first");return}if(bs()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Lt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(bs()==="on"){Lt("Turbo is on \u2014 Claude takes each comment as it lands");return}ue.hidden=!0;let e=t.map(o=>o.id),s=await Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(!s?.ok){qn("Could not send them to Claude",s);return}for(let o of e)On.add(o);Yt={at:Yt.ids.some(o=>Eo().includes(o))?Yt.at:new Date().toISOString(),ids:[...new Set([...Eo(),...e])]},Ve(),He(`${e.length} sent to Claude \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await Ct("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)On.delete(o);Ve()}),Ge()},ws=Xt.querySelector(".dt-push-all"),ai=0,Mo=!1,ii=()=>{ue.hidden=!1,ni()};ws.addEventListener("click",()=>{if(Mo){Mo=!1;return}oi(vs())}),ws.addEventListener("contextmenu",t=>{t.preventDefault(),ue.hidden?ii():ue.hidden=!0}),ws.addEventListener("pointerdown",t=>{t.button===0&&(ai=window.setTimeout(()=>{Mo=!0,ii()},500))});for(let t of["pointerup","pointerleave","pointercancel"])ws.addEventListener(t,()=>clearTimeout(ai));ue.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"){oi(vs());return}if(r==="all")pe.clear();else if(s){let d=s.dataset.pushFold;fn.has(d)?fn.delete(d):fn.add(d)}else if(o){let d=ys().filter(h=>(h.route??"/")===o.dataset.pushRoute),b=d.some(h=>!pe.has(h.id));for(let h of d)b?pe.add(h.id):pe.delete(h.id)}else if(a){let d=Number(a.dataset.pushId);pe.has(d)?pe.delete(d):pe.add(d)}Ve()}),document.addEventListener("pointerdown",t=>{!ue.hidden&&!Xt.contains(t.target)&&(ue.hidden=!0)},!0),new ResizeObserver(()=>document.querySelector(".devtools")?.style.setProperty("--dt-push-w",Xt.hidden?"0px":`${Xt.offsetWidth+8}px`)).observe(Xt),setInterval(Ve,3e4),ti=Ve;let ri=document.querySelector(".dt-turbo");ri&&new MutationObserver(Ve).observe(ri,{attributes:!0,attributeFilter:["data-state"]}),Ve();let In="",ko=!1,bn="dt-threads",li=String([Dt.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Lo="",$s=null,_l=t=>{f||t.version&&t.version===Lo||($s||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=$s;$s=null,Lo=e.version??"";let s=JSON.stringify({project:li,body:e});s.length<2e6?st.setItem(bn,s):st.removeItem(bn)},{timeout:3e3}),$s=t)},So=(t,e=!1)=>{In=t.version??"",Fl(t);let s=t.turbo;On=new Set(s?.push?.ids??[]),Yt={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=gn(t.comments);if(e&&(Zt||ve)){let r=new Set(o.map(d=>d.id));o=[...o,...xt.filter(d=>bt(d)==="done"&&!r.has(d.id))]}_l({...t,comments:o}),fs(o);let a=o.filter(r=>r.route===Q);if(!(Qn&&(G=a,di()))){if(JSON.stringify(a)===JSON.stringify(G)){!ct.hidden&&!f&&et();return}G=a,et(),ee({reload:!0})}},Ke=async(t=!1)=>{let e=[t||!In?"":`since=${In}`,Zt||ve?"":"open=1"].filter(Boolean).join("&");try{let s=await Ct(`comments${e?`?${e}`:""}`);s.status===200&&So(await s.json())}catch{}},Dn=!1,Ue=async()=>{if(!document.hidden){if(ko||hs){Dn=!0;return}ko=!0,await Ke(),ko=!1,Dn&&(Dn=!1,Ue())}};Wa=()=>{Dn&&!hs&&(Dn=!1,Ue())};let di=()=>{let t=Qn&&G.find(e=>e.id===Qn);return t?(Qn=0,Ce()&&!dn(t)&&Bn(Mt(t)?"clients":"studio"),$t||he(!0),Hn(t.id),!0):!1},To=()=>{G=xt.filter(t=>t.route===Q),di()||et()},Ao=0,Co=null,ci=()=>{Co&&$t&&Ho(Co)},Ho=t=>{Co=t,!Ao&&(Ao=requestAnimationFrame(()=>{Ao=0;let e=t.target;if(!$t||e.closest(St)){Bt.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(Bt.hidden=!1,!s)return;let o=s.getBoundingClientRect();sn.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,fe.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)}`,fe.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-20)}px`}))},ui=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),J){J=null,et();return}if(S){qe()&&(Tt(),et());return}if(nt!==null){nt=null,et();return}he(!1)}},pi=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],hi=!1,mi=t=>{t.type==="pointerdown"&&(hi=t.pointerType==="touch"),!t.target.closest?.(St)&&t.stopPropagation()},gi=t=>{hi&&!t.target.closest?.(St)&&t.preventDefault()},fi=t=>{if(t.target.closest(St))return;if(t.preventDefault(),t.stopPropagation(),I){I=!1;return}if(!getSelection()?.isCollapsed)return;K.hidden=!0;let s=document.elementFromPoint(t.clientX,t.clientY);if(K.hidden=!1,!s||!qe())return;Tt();let o=s.getBoundingClientRect(),a=s.tagName.toLowerCase(),r=[...s.classList].filter(b=>!/^(astro|svelte|css)-/.test(b)).slice(0,2);S={selector:ea(s),tag:a,classes:r,nth:na({tag:a,classes:r}).indexOf(s),rx:o.width?(t.clientX-o.left)/o.width:.5,ry:o.height?(t.clientY-o.top)/o.height:.5,label:Rt(s.textContent||"").slice(0,60),ctx:sa(s),category:u[0].id,...Ce()&&ye==="clients"?{shared:!0}:{}};let d=n.client||It()||S.shared?null:Xs();d&&(S.assignee=d,S.stage=At(d)?"approved":"new"),yi.set(S,Yl().then(()=>No(s))),nt=null,Bt.hidden=!0,et()},Wl=2200,zl=900*1024,bi=8*1024*1024,Vl=3*1024*1024,Kl=50*1024*1024,Ul=1200,Gl=1600,No=async t=>{let e=t instanceof HTMLElement?t:null;for(let a=0;e&&a<4&&e.parentElement&&e.parentElement!==document.body;a++){let r=e.getBoundingClientRect();if(r.width>=360&&r.height>=140)break;e=e.parentElement}let s=e?.getBoundingClientRect();if(!e||!s?.width||!s.height)return null;let o="";for(let a=e;a&&!o;a=a.parentElement){let r=getComputedStyle(a).backgroundColor;r&&r!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(r)&&(o=r)}if(!o){let[a,r,d]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);o=.299*a+.587*r+.114*d>140?"#111":"#fff"}try{let{domToWebp:a}=await import("modern-screenshot"),r=Math.min(1,Ul/s.width,Gl/s.height),d=await Promise.race([a(e,{scale:r,quality:.8,timeout:4e3,backgroundColor:o,filter:b=>!(b instanceof Element&&b.closest(be))}),new Promise(b=>setTimeout(()=>b(null),8e3))]);return d&&d.length<bi?d:null}catch{return null}},yi=new WeakMap,Yl=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Lt=(t,e=2800)=>{let s=document.createElement("div");return s.className="dt-toast",s.textContent=t,document.body.append(s),setTimeout(()=>s.remove(),e),s},vi=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),r=ds.get(o);if(ds.delete(o),!r){Lt(`${a} was not sent \u2014 attach it again`);continue}let d=Lt(`Uploading ${a}\u2026`,12e4),b=await Ct("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:r.name,size:r.size})}).then(c=>c.ok?c.json():null).catch(()=>null),h=b&&await fetch(b.url,{method:"PUT",headers:{"content-type":b.type,"x-upsert":"false"},body:r}).catch(()=>null),N=h?.ok&&await y({id:t,uploaded:[b.name]}).catch(()=>null);if(d.remove(),!N||!N.ok){Lt(h===null&&b?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let V=gn([await N.json().catch(()=>null)])[0];V&&(G=G.map(c=>c.id===V.id?V:c),et()),Lt(`${a} sent`)}},wi=t=>{let e=t.filter(s=>s.startsWith(ls)).length;return e&&Lt(e===1?"One file was left out \u2014 its chip said why":`${e} files were left out \u2014 their chips said why`,4e3),t.filter(s=>!s.startsWith(ls))},qn=async(t,e)=>{if(!navigator.onLine){Lt(`${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="")}Lt(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},Xl=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),Jl=async t=>{let e=await createImageBitmap(t),s=Math.min(1,Wl/Math.max(e.width,e.height));if(s===1&&t.size<=zl)return e.close(),Xl(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)},Bo=async(t,e)=>{let s=[],o=(a,r)=>s.push(`${ls}${a}\0${r}`);for(let a of t){let r,d=tr(a.name)||Object.keys(Wn).find(b=>Wn[b]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!d){o(a.name,_o.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>Kl){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>Vl&&Dt.via){let h=`${Date.now()}-${ds.size}`;ds.set(h,a),s.push(`${lo}${h}\0${a.name}\0${a.size}`);continue}let b=await new Promise((h,N)=>{let V=new FileReader;V.onload=()=>h(String(V.result).split(",")[1]),V.onerror=N,V.readAsDataURL(a)}).catch(()=>"");b?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${Qi(a.name)||"file"};ext=${d};base64,${b}`):o(a.name,"Could not be read");continue}try{r=await Jl(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>bi){o(a.name,"Too large even after shrinking");continue}s.push(r)}if(s.length){if(!Number(e?.dataset.id)){S&&((S.images??=[]).push(...s),et());return}O.push(...s),et(),xs(".dt-note-reply-input")}},$i=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);K.addEventListener("paste",t=>{let e=$i(t.clipboardData?.items);e.length&&(t.preventDefault(),Bo(e,t.target.closest(".dt-note")))}),K.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),K.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),K.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=$i(t.dataTransfer?.items);s.length&&Bo(s,e)});let xs=t=>{let e=K.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},xi=()=>{xs(".dt-note-edit-input"),K.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Ro=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=po-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},Zl=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Ql=()=>n.client||It()||S?.shared||nt!=null&&Mt(G.find(t=>t.id===nt))?[]:Os(),Ei=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();let s=Zl(t);if(!s)return;let o=s[1].toLowerCase(),a=nt!=null?G.find(h=>h.id===nt):void 0,d=(n.client||It()||S?.shared||a&&Mt(a)?n.team??[]:is()).filter(h=>[h.name,h.nickname,h.email].some(N=>N?.toLowerCase().startsWith(o))).slice(0,5),b=Ql().filter(h=>h.handle.toLowerCase().startsWith(o)||!!o&&"agent".startsWith(o)||!!o&&"claude".startsWith(o)).slice(0,4);!d.length&&!b.length||t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(h=>`<button type="button" role="option" data-act="mention" data-handle="${g(or(h))}">${cn(h.avatar_url,h.name||h.email)}<span class="dt-mention-who"><b>${g(h.name||h.email)}</b>${h.name?`<span>${g(h.email)}</span>`:""}</span></button>`),...b.map(h=>`<button type="button" role="option" data-act="mention" data-handle="${g(h.handle)}">${Vr(h.owner)}<span class="dt-mention-who"><b>${g(h.handle)}</b><span>${h.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((h,N)=>h.replace('role="option"',`role="option" aria-selected="${N===0}"`)).join("")}</div>`)},td='<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>',ed='<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>',Mi=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...Os().map(o=>o.handle)].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>g(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=e.length?new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"):null;return zo(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${g(o.url)}" target="_blank" rel="noopener noreferrer" title="${g(o.url)}">${o.kind==="pr"?td:ka}<span>${g(o.label)}</span>${ed}</a>`:s?g(o).replace(s,a=>`<span class="dt-at">${a}</span>`):g(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 ki=(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()},nd=(t,e)=>{if(!t){S&&(S.category=e),et();return}te(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>y({id:t,category:e}),"Changing the type")};$r([K,ct],g,qt),ct.addEventListener("change",t=>{let e=t.target.closest(".dt-for-select[data-id]");e&&Ys(Number(e.dataset.id),e.value)}),ct.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-hand [data-act="hand"]');if(!e)return;t.stopPropagation();let s=e.dataset.v;Ys(Number(e.dataset.id),s==="agent"?Us:s==="person"?Gs():"")},!0);let sd=t=>Mt(t)?"studio":"clients",Li=async(t,e=!1)=>{let s=G.find(a=>a.id===t);if(!s||Mt(s)&&s.client)return;let o=!Mt(s);nt===t&&(nt=null),await te(a=>a.map(r=>r.id===t?{...r,shared:o||void 0,client:o?r.client:void 0}:r),()=>y(o?{id:t,shared:o}:{id:t,shared:!1,client:!1}),o?"Moving it to clients":"Moving it to the workspace"),fs(xt),e||He(o?"Moved to clients":"Moved to the workspace",()=>Li(t,!0))},od=async t=>{let e=G.find(b=>b.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...Mt(e)?{}:{shared:!0}};for(let b of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[b]!=null&&(o[b]=s[b]);let a=await ms(Ct("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){qn("The copy was not made",a);return}let r=gn([await a.json().catch(()=>null)])[0];r&&(xt=[...xt,r],G=xt.filter(b=>b.route===Q)),fs(xt),et(),Ge();let d=sd(e);He(d==="clients"?"Duplicated for the client":"Duplicated to the workspace",()=>{r&&(Bn(d),Hn(r.id))},"Open")},ad=t=>{let e=`${location.origin}${location.pathname}?notemend#thread-${t}`;navigator.clipboard?.writeText(e).then(()=>Lt("Link copied"),()=>Lt(e,6e3))};K.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,b=Number(e.dataset.id)||0;e.value="",d==="dup"?od(b):d==="move"?Li(b):d==="link"?ad(b):d==="reopen"?Me(b,!1):d==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?(nt=null,go(b)):d==="discard"&&(S=null,et());return}let s=t.target.closest(".dt-lang-select");if(s){Ba(Number(s.dataset.id),s.dataset.at,s.value);return}let o=t.target.closest(".dt-cat-select");if(o){nd(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){Qr(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-for-select");if(r){if(st.setItem("nm-for",r.value),n.client){S&&(S.assignee=r.value,Xs(r.value),et());return}ua(Number(r.dataset.id)||0,"person")}}),K.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&S?.suggest){S.suggest.to=e.value,Mn(),Ro(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");s&&(Ei(s),s.classList.contains("dt-note-input")?S&&(S.text=s.value):s.classList.contains("dt-note-edit-input")?J&&(J.text=s.value):jt=s.value,Mn(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),Ro(s))}),K.addEventListener("keydown",t=>{if(t.key==="Escape"&&K.querySelector(".dt-emoji")){t.stopPropagation();let a=Ee?.box??Ee?.btn;us(),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()&&Ei(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),ki(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let ft=null,Es=!1;function Po(t){return!n.client||!!n.me&&t.by===n.me.email}let Si=t=>{let e=document.createElement("div");return e.className=`dt-drag-box ${t}`,e.hidden=!0,e.innerHTML="<span></span>",document.body.append(e),e},Oo=Si("dt-drag-box--home"),Ti=Si("dt-drag-box--to"),Io=t=>{let e=Rt(t.textContent||"").replace(/\s+/g," ").slice(0,24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Ai=(t,e,s="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left-3}px;top:${o.top-3}px;width:${o.width+6}px;height:${o.height+6}px`,t.querySelector("span").textContent=s,t.hidden=!1},id=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(St)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,rd=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},ld=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),r=[...t.classList].filter(d=>!/^(astro|svelte|css)-/.test(d)).slice(0,2);return{selector:ea(t),tag:a,classes:r,nth:na({tag:a,classes:r}).indexOf(t),label:Kn(t.textContent||"",60),ctx:sa(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}},Do=()=>{ft&&(ft.pin.classList.remove("is-dragging"),Oo.hidden=Ti.hidden=!0,ft=null,ce())};K.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=G.find(o=>o.id===Number(e.dataset.id));!s||!Po(s)||(ft={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:de(s),to:null},e.setPointerCapture(t.pointerId))}),K.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"),ft.pin.style.left=`${t.clientX}px`,ft.pin.style.top=`${t.clientY}px`,ft.to=ft.home&&rd(ft.home,t.clientX,t.clientY)?ft.home:id(t.clientX,t.clientY);let e=ft.to&&ft.to!==ft.home;Ai(Oo,ft.home,e?"":ft.home?Io(ft.home):""),Oo.classList.toggle("is-left",!!e),Ai(Ti,e?ft.to:null,e?`Move to ${Io(ft.to)}`:"")}),K.addEventListener("pointerup",async t=>{if(!ft)return;let e=ft;if(!e.on||!e.to){Do();return}Es=!0,setTimeout(()=>{Es=!1},0);let s=G.find(b=>b.id===e.id),o=ld(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(Do(),!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},d=(b,h)=>te(N=>N.map(V=>V.id===e.id?{...V,...b}:V),()=>y({id:e.id,move:b}),h);await d(o,"Moving the pin"),a&&He(`Moved to ${Io(e.to)}`,()=>d(r,"Putting the pin back"))}),K.addEventListener("click",t=>{Es&&(t.stopImmediatePropagation(),t.preventDefault(),Es=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&ft?.on&&(t.stopImmediatePropagation(),Do())},!0),K.addEventListener("click",async t=>{let e=t.target.closest("button"),s=Ee?.btn;if(e?.closest(".dt-emoji")||us(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="react"){Oa(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&Pa(e,o==="emoji-pick",o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&Ee){let r=Ee;Pa(r.btn,!0,r);return}if(o==="emoji"&&Ee){let r=Ee;us(),r.box?Tl(r.box,e.dataset.emoji):r.id&&Oa(r.id,r.at||null,e.dataset.emoji);return}if(o==="prio"){let r=e.dataset.v||null;a?te(d=>d.map(b=>b.id===a?{...b,priority:r??void 0}:b),()=>y({id:a,priority:r}),"Setting the priority"):S&&(S.priority=r??void 0,Mn(),et());return}if(o==="mention"){let r=e.closest(".dt-compose")?.querySelector("textarea");r&&ki(r,e.dataset.handle);return}if(!o){if(S&&!qe())return;if(nt=nt===a?null:a,nt!=null&&e.dataset.off){let r=G.find(b=>b.id===a);(r&&de(r))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}Tt(),et();return}if(o==="speak"){vl(e.closest(".dt-note"),e);return}if(o==="voice-write"){$l(e);return}if(o==="voice"||o==="voice-seek"){il(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}),d=e.closest(".dt-note");r.addEventListener("change",()=>{r.files?.length&&Bo([...r.files],d)}),r.click();return}if(o==="unshot"){a?J&&J.drop.push(e.dataset.img):(e.closest("[data-draft]")?S?.images??[]:O).splice(Number(e.dataset.i),1),et(),J&&xi();return}if(o==="edit"){let r=G.find(h=>h.id===a),d=e.dataset.at||null,b=d?r?.replies?.find(h=>h.at===d)?.text:r?.text;if(b===void 0)return;J={id:a,at:d,text:b,drop:[]},et(),xi();return}if(o==="edit-cancel"){J=null,et();return}if(o==="translate"){Ba(a,e.dataset.at);return}if(o==="unsay"){let r=e.dataset.at;if(!confirm("Delete this reply?"))return;await te(d=>d.map(b=>b.id!==a?b:{...b,replies:(b.replies??[]).map(h=>h.at===r?{...h,text:"",deleted:!0}:h)}),()=>y({id:a,unsay:r}),"Deleting the reply");return}if(o==="edit-save"){let r=J;if(!r)return;let d=r.text.trim();if(!d){K.querySelector(".dt-note-edit-input")?.focus();return}J=null;let b=h=>r.drop.includes(h.split("/").pop());await te(h=>h.map(N=>N.id!==r.id?N:{...N,...r.at==null?{text:d}:{replies:(N.replies??[]).map(V=>V.at===r.at?{...V,text:d}:V)},images:(N.images??[]).filter(V=>!b(V))}),()=>y({id:r.id,edit:{at:r.at,text:d},...r.drop.length?{removeImage:r.drop}:{}}).then(h=>(h.ok||(J=r),h),h=>{throw J=r,h}),"Saving the edit");return}if(o==="cancel"){qe()&&(Tt(),et());return}if(o==="twin"){if(!qe())return;Tt(),nt=Number(e.dataset.id),et();return}if(o==="discard"){S=null,et();return}if(o==="draft-open"){yo(Number(e.dataset.i));return}if(o==="close"){nt=null,et();return}if(o==="where"){let r=G.find(N=>N.id===Number(e.dataset.id)),d=r&&Qt(r)?.hidden;if(!d)return;let b=d.getBoundingClientRect();d.scrollIntoView({block:"nearest",behavior:"smooth"});let h=document.createElement("div");h.className="dt-where",h.style.cssText=`left:${b.left}px;top:${b.top}px;width:${b.width}px;height:${b.height}px`,document.body.append(h),h.animate([{opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.75},{opacity:0}],1600).finished.finally(()=>h.remove());return}if(o==="unsuggest"&&S){S.suggest=null,et();return}if(o==="save"){if(!S)return;S.images&&(S.images=wi(S.images));let r=(S.images??[]).filter(C=>!pn(C)),d=S.suggest&&S.suggest.to.trim()!==S.suggest.from?{from:S.suggest.from,to:S.suggest.to.trim()}:null,b=K.querySelector(".dt-note-input").value.trim()||(d?"Change the text":"")||(S.images?.some(oo)?Na:S.images?.some(C=>pn(C)&&!zn(C))?"See the attached image":S.images?.length?"See the attached file":"");if(!b){K.querySelector(".dt-note-input")?.focus();return}let h=S,N=n.client?null:Vo(b,Fe()),V=yi.get(h)??No(de(h)),c={...h,images:h.images?.filter(pn),route:Q,text:b,suggest:d,assignee:n.client?Sa(h.assignee)||void 0:N??(h.assignee||void 0),shared:n.client?!0:h.shared===!0,stage:n.client?"new":N?"approved":h.stage??(At(h.assignee)?"approved":"new"),breakpoint:Ws(),browser:Dr(),device:f?Ci:"",viewport:{w:innerWidth,h:innerHeight},logs:fr(),host:location.host},F={...h,id:-Date.now(),text:b,route:Q,status:"open",note:"",doneBy:null,breakpoint:c.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...d?{suggest:d}:{},by:n.me?.email,byName:n.me?.name};G=[...G,F],S=null,et();let q=await ms(Ct("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)})).catch(()=>null);if(!q?.ok){G=G.filter(C=>C!==F),Tt(),S=h,et(),qn("Comment was not saved",q);return}let lt=gn([await q.json().catch(()=>null)])[0];G=G.map(C=>C===F&<?lt:C),et(),lt&&V.then(C=>{C&&y({id:lt.id,before:C})}),lt&&r.length&&vi(lt.id,r),Ge();return}if(o==="reply"){let r=K.querySelector(".dt-note-reply-input");O=wi(O);let d=r.value.trim()||(O.some(oo)?Na:O.some(C=>pn(C)&&!zn(C))?"See the attached image":O.length?"See the attached file":"");if(!d){r.focus();return}let b=O;jt=d,rn=a,En(),jt="",O=[],r.value="";let h=G,N=n.client?null:Vo(d,Fe()),V=G.find(C=>C.id===a),c=N&&V&&(N!==V.assignee||Jt(V)!=="approved"||V.status==="done")?{assignee:N,stage:"approved",...V.status==="done"?{status:"open",doneBy:null}:{}}:{};G=G.map(C=>C.id===a?{...C,...c,replies:[...C.replies??[],{author:"you",text:d,at:new Date().toISOString(),by:n.me?.email}]}:C),x=a,et();let F=await ms(y({id:a,reply:d,images:b.filter(pn),...c})).catch(()=>null);if(!F?.ok){G=h,jt=d,O=b,et();let C=K.querySelector(".dt-note-reply-input");C&&!C.value&&(C.value=d);let it=()=>K.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?He(`Reply was not sent${F?` (${F.status})`:""} \u2014 it is back in the box`,it,"Retry"):qn("Reply was not sent",F);return}En();let q=gn([await F.json().catch(()=>null)])[0];q&&(G=G.map(C=>C.id===q.id?q:C),et()),Ge();let lt=b.filter(C=>!pn(C));lt.length&&vi(a,lt);return}if(o==="newbelow"){let r=e.closest(".dt-note")?.querySelector(".dt-note-thread");r?.scrollTo({top:r.scrollHeight,behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}),delete T[a],e.remove();return}if(o==="hand"){ua(a,e.dataset.v);return}if(o==="sendback"){await Me(a,!1),xs(".dt-note-reply-input");return}if(o==="accept"){await Me(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(nt=null),await ze(a,o==="archive");return}e.classList.contains("dt-step-act")||(nt=null),o==="rm"?await go(a):await Me(a,o==="done")});let Ci="",ee=t=>{Kt.hidden||Ae.contentWindow?.postMessage({dt:!0,...t},location.origin)},dd=()=>({notes:$t,grid:!Y.hidden,inspect:E,resolved:Zt,archived:ve,...Ni.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(!f&&t.source===Ae.contentWindow){if(e.key){qi(e.key[0],e.key[1])?.run();return}if(e.closeMenus){rt();return}if(e.drafts){mo=e.drafts,hn(we());return}}if(f&&typeof e.openDraft=="number"){yo(e.openDraft);return}if(f&&typeof e.dropDraft=="number"){Ka(e.dropDraft);return}if(f&&typeof e.device=="string"&&(Ci=e.device),f&&e.scrollbar&&Ft.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Ae.contentWindow){ee(dd());return}typeof e.notes=="boolean"&&e.notes!==$t&&he(e.notes,!1),typeof e.open=="number"&&Hn(e.open),typeof e.grid=="boolean"&&e.grid===Y.hidden&&A(e.grid),typeof e.inspect=="string"&&e.inspect!==E&&U(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Zt&&wo(e.resolved),typeof e.archived=="boolean"&&e.archived!==ve&&$o(e.archived),e.reload&&Ke()});let Ge=async()=>{await Ke(),ee({reload:!0}),f&&parent.postMessage({dt:!0,reload:!0},location.origin)},he=(t,e=!0)=>{if($t=t,tt.setAttribute("aria-pressed",String(t)),t?!f&&ct.hidden&&st.getItem("dt-history")!=="0"&&(ct.hidden=!1,at.setAttribute("aria-pressed","true")):(ct.hidden=!0,at.setAttribute("aria-pressed","false")),$(Xn,t?"1":"0"),ee({notes:t}),f&&e&&parent.postMessage({dt:!0,notes:t},location.origin),K.hidden=!t||!Kt.hidden,Ft.toggle("dt-noting",t),t&&!f?Xa():document.querySelector(".dt-room")?.remove(),t){U(""),document.addEventListener("click",fi,!0);for(let s of pi)document.addEventListener(s,mi,!0);document.addEventListener("contextmenu",gi,!0),document.addEventListener("keydown",ui),document.addEventListener("mousemove",Ho),addEventListener("scroll",ce,!0),addEventListener("scroll",ci,!0),addEventListener("resize",ce),addEventListener("pointerover",Qa,!0),oa(),Ja.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),Za.observe(document.body),To()}else{Tt(),nt=null,document.removeEventListener("click",fi,!0);for(let s of pi)document.removeEventListener(s,mi,!0);document.removeEventListener("contextmenu",gi,!0),document.removeEventListener("keydown",ui),document.removeEventListener("mousemove",Ho),Bt.hidden=!0,removeEventListener("scroll",ce,!0),removeEventListener("scroll",ci,!0),removeEventListener("resize",ce),removeEventListener("pointerover",Qa,!0),Ja.disconnect(),Za.disconnect(),K.innerHTML=""}},{pickBp:Hi,...Ni}=Mr({cfg:n,inFrame:f,persist:$,frame:Kt,frameEl:Ae,devicesMenu:Nt,bpBtns:X,notesOverlay:K,WIDE:p,bpOf:v,currentBp:Ws,deviceById:H,notesOn:()=>$t,filter:()=>js,filterTo:t=>{js=t},dropFrameDrafts:()=>{mo=[]},putAway:()=>{nt=null,Tt()},tellFrame:ee,syncBpButtons:ta,render:()=>et(),reread:()=>{$t?To():et()}}),Bi="dt-studio",Ri=t=>{kt.setAttribute("aria-pressed",String(t)),Ft.toggle("dt-no-studio",!t),$(Bi,t?"1":"0")};kt.addEventListener("click",()=>Ri(kt.getAttribute("aria-pressed")!=="true")),Ri(st.getItem(Bi)!=="0"),tt.addEventListener("click",()=>he(!$t));let Be=document.querySelector(".devtools"),Ye=document.querySelector(".dt-tab"),Pi=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-Be.getBoundingClientRect().top)+12}px`);new ResizeObserver(Pi).observe(Be),addEventListener("resize",Pi);let Oi=t=>{Be.toggleAttribute("data-collapsed",t),Ye.toggleAttribute("data-collapsed",t),Ye.setAttribute("aria-expanded",String(!t)),Ye.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(let e of Be.children)e instanceof HTMLElement&&!e.contains(Ye)&&(e.inert=t);t&&rt(),$("dt-collapsed",t?"1":"0")};Ye.addEventListener("click",()=>Oi(!Be.hasAttribute("data-collapsed")));let ke=document.querySelector(".dt-keys"),Ii=ke.querySelector(".dt-set-keys"),qo=t=>{Ii.hidden=!t,ke.querySelector(".dt-set-main").hidden=t};if(Dt.signOut)for(let t of ke.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;ke.querySelector("summary").addEventListener("click",()=>qo(!1)),ke.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return qo(s==="keys");ke.open=!1,s==="hide"&&Ye.click(),s==="out"&&confirm("Sign out of Notemend on this site?")&&(st.removeItem(bn),Dt.signOut?.())});let me=t=>()=>Be.querySelector(t)?.click(),Di=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},Ms=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:me(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:me(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:me(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>$o(!ve)},{group:"Threads",code:"KeyM",hint:"M",label:"Studio / clients",run:()=>Bn(ye==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Ne.hidden||Pn(ie.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:me(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:me(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:me(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:me(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:me(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:me(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:me(".dt-studio-btn")}]:[],...X.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:()=>{Nt.open=!Nt.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:Di(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:Di(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>Ye.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=ke.open&&!Ii.hidden;ke.open=!t,qo(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),qi=(t,e)=>Ms.find(s=>s.code===t&&!s.shift==!e),cd=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 e of Ms){let s=e.el&&Be.querySelector(e.el);s&&(s.dataset.tip=`${s.dataset.tip??e.label} \xB7 ${e.hint}`,s.setAttribute("aria-keyshortcuts",e.hint.startsWith("\u21E7")?`Shift+${e.hint.slice(1)}`:e.hint))}let t=(e,s)=>`<div class="dt-key-row"><span>${g(e)}</span><kbd>${g(s)}</kbd></div>`;if(ke.querySelector(".dt-keys-list").innerHTML='<p class="dt-menu-note">One key, no modifier, in any keyboard layout. Not while you type.</p>'+[...new Set(Ms.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+Ms.filter(s=>s.group===e).map(s=>t(s.label,s.hint)).join("")).join("")+'<p class="dt-devices-group">In a comment</p>'+t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"),document.addEventListener("keydown",e=>{if(e.repeat||e.isComposing||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||cd(e.target))return;let s=qi(e.code,e.shiftKey);s&&(e.preventDefault(),f?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):s.run())}),f){let e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",s=>{s.key==="Escape"&&e()})}}if(!f){Oi(st.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>Be.setAttribute("data-ready",""))),Ni.restore(),A(st.getItem(ht)==="1");let t=st.getItem(Pt);t&&t in zt&&U(t),he(st.getItem(Xn)==="1")}let Fi=()=>{try{let t=JSON.parse(st.getItem(ln)||"null");dt=(t?.parked??[]).filter(s=>Ut(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};t?.draft&&e(t.draft.selector)?(S=t.draft,!$t&&!f&&he(!0)):Ut(t?.draft)&&dt.push(t.draft),t?.reply?.text&&(jt=t.reply.text,rn=nt=t.reply.for??null),(S||dt.length||jt)&&et()}catch{st.removeItem(ln)}};Fi();let ji=()=>setTimeout(()=>{let t=R(location.pathname);t!==Q&&(clearTimeout(Zn),En(),Q=t,ln=Jo(),S=null,dt=[],jt="",rn=null,nt=null,J=null,G=[],L(),Fi(),To(),Ke())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),ji()}}addEventListener("popstate",ji);try{let t=JSON.parse(st.getItem(bn)||"null");t?.project===li&&t.body?(Lo=t.body.version??"",So(t.body),In=""):t&&st.removeItem(bn)}catch{st.removeItem(bn)}i.then(async t=>{t.status===200&&So(await t.json(),!0)},()=>{}).then(()=>Zt?Ke(!0):void 0).then(gs.resume),document.addEventListener("visibilitychange",()=>{document.hidden||Ue()}),addEventListener("focus",Ue),addEventListener("notemend:changed",()=>{f||Ue()});let ks=!1,Xe=null,_i=()=>{if(!(f||Dt.via||!("EventSource"in window))){if(document.hidden){Xe?.close(),Xe=null,ks=!1;return}Xe||(Xe=new EventSource("/__devbar/events"),Xe.onopen=()=>{ks=!0},Xe.onerror=()=>{ks=!1},Xe.onmessage=t=>{t.data!==In&&Ue()})}};_i(),document.addEventListener("visibilitychange",_i);let ud=0;f||setInterval(()=>{(!(Dt.live||ks)||++ud%6===0)&&Ue()},2e4),f&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Br(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,l=i.showModal,u=null,p=null,v=()=>{if(u){p?.disconnect(),p=null;for(let f of n)document.body.append(f);try{u.hidePopover()}catch{}u.remove(),u=null}},k=()=>{v();let f=document.querySelector("dialog:modal");f&&H(f)},H=f=>{v(),u=document.createElement("div"),u.className="dt-host",u.setAttribute("popover","manual"),u.append(...n),f.append(u);try{u.showPopover()}catch{}f.addEventListener("close",k,{once:!0}),p=new MutationObserver(()=>{f.isConnected||k()}),p.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){l.call(this),this.isConnected&&H(this)}}var zd=".devtools, [class^='dt-'], [class*=' dt-']";function Rr(){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,l,u=0,p=$=>{let y=$.getAttribute("title");y!==null&&($.removeAttribute("title"),$.hasAttribute("data-tip")||$.setAttribute("data-tip",y),!$.hasAttribute("aria-label")&&!$.textContent?.trim()&&$.setAttribute("aria-label",y))},v=$=>{let y=$?.closest?.("[data-tip], [title]");return y&&y.closest(zd)&&!y.closest(".dt-tipbox")?y:null},k=$=>{let y=$.getAttribute("data-tip");if(!y||$.getAttribute("aria-expanded")==="true")return H();n.textContent=y,n.hidden=!1;let R=$.getBoundingClientRect(),Q=n.getBoundingClientRect(),_=6,Y=8,ht=R.bottom+_+Q.height<=innerHeight-Y;n.style.top=`${ht?R.bottom+_:Math.max(Y,R.top-_-Q.height)}px`,n.style.left=`${Math.min(Math.max(Y,R.left+R.width/2-Q.width/2),innerWidth-Y-Q.width)}px`,n.classList.toggle("is-mono",$.classList.contains("dt-note-el")),$.setAttribute("aria-describedby",n.id)},H=()=>{clearTimeout(l),i&&!n.hidden&&(u=performance.now()+400),i?.removeAttribute("aria-describedby"),i=null,n.hidden=!0},f=$=>{$!==i&&(H(),p($),i=$,performance.now()<u?k($):l=setTimeout(()=>i===$&&k($),300))};document.addEventListener("pointerover",$=>{let y=v($.target);y?f(y):i&&!i.contains($.target)&&H()},!0),document.addEventListener("pointerout",$=>{i&&!i.contains($.relatedTarget)&&H()},!0),document.addEventListener("focusin",$=>{let y=v($.target);y&&$.target.matches(":focus-visible")&&f(y)},!0),document.addEventListener("focusout",H,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("keydown",$=>{$.key==="Escape"&&H()},!0),addEventListener("scroll",H,!0),new MutationObserver(()=>{i&&!i.isConnected&&H()}).observe(document.body,{childList:!0,subtree:!0})}function Pr(){let n=window;if(n.__notemend)return;n.__notemend=!0,gr(l=>l.includes("/__devbar/")||!!Dt.base&&l.startsWith(Dt.base)),Ft.ready=new Promise(l=>{if(!("__next_f"in self))return l();let u=0,p=()=>Object.keys(document.documentElement).some(v=>v.startsWith("__reactFiber$"))||++u>330?l():setTimeout(p,30);p()}),Ft.toggle("dt-in-frame",Ns);let i=Ct("comments?open=1");Yi().then(l=>{Ft.set("--dt-z",String(l.zIndex));let u=l.brand?.color;if(u&&/^#[0-9a-f]{6}$/i.test(u)){let[p,v,k]=[1,3,5].map(H=>parseInt(u.slice(H,H+2),16)/255);Ft.set("--dt-accent",u),Ft.set("--dt-accent-ink",.2126*p+.7152*v+.0722*k>.55?"#000000":"#ffffff")}cr(l),Nr(l,i),Rr(),Br([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-tipbox"].map(p=>document.querySelector(p)).filter(p=>!!p))}).catch(l=>console.warn("[notemend] not started:",l))}Pr();import.meta.hot&&import.meta.hot.accept(()=>location.reload());
|
|
303
|
+
<div class="dt-note-meta dt-note-type">${ha(Dn(A.category).id,void 0,!1)}</div>
|
|
304
|
+
${fr("dt-note-input",A.suggest?"Why (optional)":"Comment",A.text??"",'data-act="save"',ur(A.images))}
|
|
305
|
+
${A.carried&&A.assignee?`<p class="dt-carried">${xc}<span>For ${b(Be(A.assignee)?.name||A.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">${on}</button></p>`:""}
|
|
306
|
+
${Qi(A.priority,A.category,void 0,A.assignee??"",!1,!!A.shared,!0)}
|
|
307
|
+
</div>`}let d=new Map([...G.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(p=>[p.closest(".dt-note").dataset.id,{top:p.scrollTop,end:p.scrollTop+p.clientHeight>=p.scrollHeight-4}])),u=new Set([...G.querySelectorAll("[data-msg]")].map(p=>p.dataset.msg)),f=G.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");$u(e,ut.hidden?o.some(p=>!!a.get(p.id)):o.length>0),Ai(G,n),f&&!G.contains(document.activeElement)&&Ss(".dt-note-reply-input");let v=[],P=[];for(let p of G.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let W=p.closest(".dt-note").dataset.id,z=d.get(W);if(!z){v.push(p),delete Ee[W],p.parentElement.querySelector(".dt-new-below")?.remove();continue}let Ht=[...p.querySelectorAll("[data-msg]")].filter(wt=>!u.has(wt.dataset.msg));for(let wt of Ht)wt.classList.add("dt-msg--new");let se=z.end||String(Us)===W;se&&P.push(p),p.scrollTop=se?p.scrollHeight:z.top;let Wt=Ht.filter(wt=>!wt.classList.contains("dt-msg--mine")).length;if(Wt&&!z.end&&String(Us)!==W){Ee[W]=(Ee[W]??0)+Wt;let wt=Ee[W],_t=p.parentElement.querySelector(".dt-new-below")??p.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(_t.dataset,{act:"newbelow",id:W}),_t.textContent=`${wt} new ${wt===1?"reply":"replies"} \u2193`}}for(let p of G.querySelectorAll(".dt-new-below")){let W=p.closest(".dt-note")?.querySelector(".dt-note-thread");(!W||W.scrollTop+W.clientHeight>=W.scrollHeight-4)&&(delete Ee[p.dataset.id],p.remove())}Us=null,Cr([...v,...P]),requestAnimationFrame(()=>G.querySelectorAll(".dt-note-thread").forEach(Xo)),U==null?Vs=null:U!==Vs&&G.querySelector(`.dt-note[data-id="${U}"]`)&&(Vs=U,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&Ss(`.dt-note[data-id="${U}"] .dt-note-reply-input`)),Sn(e),ia(ra()),Se();for(let p of G.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Ja(p);let V=G.querySelector(".dt-note-input");V&&document.activeElement!==V&&(V.focus(),V.setSelectionRange(V.value.length,V.value.length))},Mu=()=>{Ia&&Pt&&!x&&Dr();let t=!1,e=document.getAnimations().some(i=>i.playState==="running"),n=[];for(let i of G.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(i.classList.contains("dt-note--orphan")||i.classList.contains("is-dragging"))continue;if(i.classList.contains("dt-pin--ghost")){let u=D.find(f=>f.id===Number(i.dataset.id))?.spot;n.push([i,u?{x:u.x-scrollX,y:u.y-scrollY,el:document.body}:null]);continue}let l=D.find(u=>u.id===Number(i.dataset.id)),d=l&&ue(l);n.push([i,d&&i.matches(".dt-pin")&&dc(d.el,d.x,d.y)?null:d]),d&&e&&Di(d.el)&&(t=!0)}for(let i of G.querySelectorAll("[data-draft], [data-parked]")){if(i.classList.contains("dt-note--orphan"))continue;let l=i.dataset.parked?me[Number(i.dataset.parked)]:A;n.push([i,l?ue(l):null])}let o=(i,l,d)=>{let u=`${l}px`,f=`${d}px`;i.style.left!==u&&(i.style.left=u),i.style.top!==f&&(i.style.top=f)};for(let[i,l]of n){let d=i.nextElementSibling;if(!l){i.style.visibility!=="hidden"&&(i.style.visibility="hidden"),d?.matches(".dt-pin-eye")&&!d.hidden&&(d.hidden=!0);continue}if(i.style.visibility&&(i.style.visibility=""),o(i,l.x,l.y),i.matches(".dt-pin[data-id]")){if(i.classList.contains("dt-pin--hidden")!==!!l.hidden){i.classList.toggle("dt-pin--hidden",!!l.hidden);for(let u of["title","aria-label"]){let f=(i.getAttribute(u)??"").replace(Ks,"");i.setAttribute(u,l.hidden?f.replace(/( \u2014 drag to move)?$/,`${Ks}$1`):f)}}d?.matches(".dt-pin-eye")&&(d.hidden!==!l.hidden&&(d.hidden=!l.hidden),l.hidden&&o(d,l.x,l.y))}i.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!l.hidden)}if(!no.length&&(A||U!=null)){let i=ra();i&&e&&Di(i)&&ia(i)}let a=G.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(a.length){let i=Aa();for(let l of a)l.style.visibility!=="hidden"&&Ar(l,i)}le(A||U!=null?ra():null),t&&Se(),clearTimeout(Nr),Nr=window.setTimeout(ku,150)},Ha=new Map,Nr=0,ku=()=>{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 u=getComputedStyle(l);if(u.backgroundImage!=="none"){i="var(--dt-bg)";break}let f=u.backgroundColor.match(/[\d.]+/g);if(f&&(f[3]===void 0?1:+f[3])>=.9){i=u.backgroundColor;break}}i||="#fff";for(let l of a)t.set(l,i);return i},n=[];for(let o of G.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=>!rn(l));i&&n.push([o,e(i)])}for(let[o,a]of n)Ha.set(Number(o.dataset.id),a),o.style.setProperty("--dt-page",a)},Br=t=>`dt-gfold:${s.project||location.host}:${t}`,Sn=t=>{if(ot.hidden){ot.replaceChildren();return}if(Ai(ot,ec({bp:t,notes:D.filter(cn),breakpoints:m,bandOfNote:M,orphan:e=>!ue(e),statusTools:e=>vr(e,!1),step:Tc,showResolved:Me,showArchived:qe,archived:ce,drafts:ut.hidden?br():ka,checks:x?0:xo.toCheck().length,clients:Xe()&&De==="clients",marker:Su,assign:Sc,draftFace:s.me?`<span class="dt-hist-face" style="--hue:${Fe(s.me.email)}">${da({by:s.me.email,byName:s.me.name})}</span>`:"",draftName:s.me?.name||"You",find:ge,forMe:Lu,forAgent:e=>!!ne(e)&&kt(e)!=="done",unread:Gi,archives:!s.client,deletable:e=>!fo(e),folded:ot.hasAttribute("data-collapsed"),shut:e=>st.getItem(Br(e))==="1"})),Yn){let e=ot.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Yn.at,Yn.at),Yn=null}},Yn=null,Lu=t=>{if(kt(t)==="done"||!s.me)return!1;if(t.assignee===s.me.email||kt(t)==="claude"||ve(t)==="review"&&t.assignee!==s.me.email)return!0;let e=(s.me.name||s.me.email).split(/[\s@]/)[0].toLowerCase();return vn(t).some(n=>n.text.toLowerCase().includes("@"+e))},Su=t=>{let e=ne(t),n=ao[e??""],o=kt(t)==="done"?ce(t)?`<i class="dt-hist-badge is-archived">${sn}</i>`:`<i class="dt-hist-badge is-done">${re}</i>`:n?`<i class="dt-hist-badge" style="--b:${n}">${we(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${Ze.find(i=>i[0]===Mn(t))[2]}"></i>`,a=da(t);return a?`<span class="dt-hist-face" style="--hue:${Fe(t.by||t.byName||"")}">${a}</span>`:`<span class="dt-hist-n" style="--cat:${Dn(t.category).color}">${o}</span>`},$o=t=>{Ca=!1,ot.toggleAttribute("data-collapsed",t),K()};ot.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(ge.q=e.value,Yn={at:e.selectionStart??e.value.length},Sn(Ne()))}),ot.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await Ve(),setTimeout(()=>delete e.dataset.spin,500);return}if(ot.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){$o(!1);return}if(t.target.closest("[data-fold]")){$o(!ot.hasAttribute("data-collapsed"));return}let n=t.target.closest("[data-gfold]");if(n){let V=Br(n.dataset.gfold);F(V,st.getItem(V)==="1"?"":"1"),Sn(Ne());return}let o=t.target.closest(".dt-hist-bands [data-bp]");if(o){ei(o.dataset.bp);return}let a=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(a){a.dataset.histView?(ge.view=a.dataset.histView,F("dt-view",ge.view),ge.menu=!1):a.dataset.histSort?(ge.sort=a.dataset.histSort,F("dt-sort",ge.sort),ge.menu=!1):a.hasAttribute("data-hist-clear")?(ge.q="",Yn={at:0}):ge.menu=!ge.menu,Sn(Ne());return}ge.menu&&!t.target.closest(".dt-hist-menu")&&(ge.menu=!1,Sn(Ne()));let i=t.target.closest("[data-draft-go], [data-draft-rm]");if(i){let V=i.dataset.draftRm!==void 0,p=Number(V?i.dataset.draftRm:i.dataset.draftGo);ut.hidden?V?Rr(p):Na(p):ye(V?{dropDraft:p}:{openDraft:p});return}let l=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(l){await We(Number(l.dataset.id),l.dataset.act==="done");return}let d=t.target.closest("[data-rm]");if(d){U=null,Sa(Number(d.dataset.rm));return}if(t.target.closest("[data-review]")){xo.start();return}if(t.target.closest("[data-resolved]")){Ra(!Me);return}if(t.target.closest("[data-archived]")){Pa(!qe);return}let u=t.target.closest("[data-archive-all]");if(u){let V=u.dataset.archiveAll.split(",").map(Number);for(let p of V)await kn(p,!0,!0);_e(`Archived ${V.length}`,()=>{for(let p of V)kn(p,!1,!0)});return}let f=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(f){await kn(Number(f.dataset.id),f.dataset.act==="archive");return}let v=t.target.closest("[data-go]");if(!v)return;let P=Number(v.dataset.go);if(!ut.hidden){ye({open:P});return}bs(P)});let bs=t=>{U=t,Vs=null,He(),Ln=!0,K();let e=D.find(o=>o.id===t),n=e&&ue(e);n?scrollTo({top:scrollY+n.y-innerHeight/2,behavior:"smooth"}):e&&ke(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||G.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400),wo()},Na=t=>{let[e]=me.splice(t,1);if(!e)return;He(),A=e,U=null;let n=ue(e);n&&(n.y<0||n.y>innerHeight)&&scrollTo({top:scrollY+n.y-innerHeight/3,behavior:"instant"}),K()},Rr=t=>{me.splice(t,1),K()},xo=nc({inFrame:x,everything:()=>ft,route:()=>mt,settle:We,keepIn:Ko,toast:t=>jt(t),waits:t=>kt(t)==="claude"||kt(t)==="done"&&!ce(t),approve:t=>kt(t)==="claude"?We(t.id,!0):kn(t.id,!0,!0),open:t=>{if(Pt||Te(!0),M(t)!==Ne()){ei(M(t));for(let e of[600,1500])setTimeout(()=>ye({open:t.id}),e)}else bs(t.id)}}),Tu=t=>{ot.hidden=!t,te.setAttribute("aria-pressed",String(t)),F("dt-history",t?"1":"0"),K()},Ba=document.querySelector(".dt-resolved-btn"),ys=document.querySelector(".dt-space"),Au=()=>{if(!ys)return;ys.hidden=!Xe(),ys.dataset.on=De;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Xe()&&De==="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 n=document.querySelector(".dt-client-tab");n&&(n.inert=t.dataset.dtSpace!=="clients",n.ariaHidden=n.inert?"true":null);for(let o of ys.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===De))}},Pr=0,vs=t=>{if(!Xe()||t===De)return;let e=()=>{De=t,F("dt-space",t),U!=null&&!cn(D.find(o=>o.id===U))&&(U=null),He(),Eo(ft),K(),Sn(Ne())};if(matchMedia("(prefers-reduced-motion: reduce)").matches)return e();let n=document.documentElement;n.classList.add("dt-switching"),clearTimeout(Pr),Pr=window.setTimeout(()=>{e(),requestAnimationFrame(()=>n.classList.remove("dt-switching"))},120)};document.querySelector(".dt-client-x")?.addEventListener("click",()=>vs("studio")),ys?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&vs(e.dataset.space)});let Xn=document.querySelector(".dt-pinf"),Jn=Xn.querySelector(".dt-pinf-btn"),Re=Xn.querySelector(".dt-pinf-menu"),Ir={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My agent",wrote:"Written by me",check:"To check"},Cu=()=>D.filter(t=>M(t)===Ne()&&Js(t)&&cn(t)),ws=(t,e=!1)=>{Re.hidden=!t,Jn.setAttribute("aria-expanded",String(t)),t&&(Qo(),e&&Re.querySelector('[aria-checked="true"]')?.focus())};Qo=()=>{let t=Cu();if(Xn.hidden=!Xe()||!t.length,Xn.hidden){Re.hidden=!0;return}let e=Object.fromEntries(Pi.map(f=>[f,t.filter(v=>Zi(v,f)).length])),n=(s.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",Fe(n)],["others","var(--dt-faint)"]];if(Jn.toggleAttribute("data-on",Je!=="all"),Jn.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${Je==="all"?"":`; showing ${Ir[Je]}, ${e[Je]}`}`),Re.hidden)return;let a=[...new Set(t.map(f=>Fs(f,kt(f))?.taker).filter(f=>!!f&&f!==n))].slice(0,2),i=f=>_n(Be(f)?.avatar_url,Be(f)?.name||f,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${Fe(f)}" `),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(n),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">${we(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:$e(Ze[2][2],Ze[2][3]),resolved:$e(pn[pn.length-1][2],pn[pn.length-1][3])},d=(f,v)=>`<b class="dt-pinf-share"><i style="--c:${v};width:${Math.round(100*e[f]/e.all)}%"></i></b>`,u=(f,v="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${Je===f}" data-pinf="${f}"><i class="dt-pinf-glyph">${l[f]}</i><span>${Ir[f]}</span>${v?d(f,v):""}<em>${e[f]}</em>${re}</button>`;Re.innerHTML=`<div class="dt-pinf-head"><b>SHOW</b>${e.all} on this page</div>${u("all")}${o.map(([f,v])=>u(f,v)).join("")}${e.resolved||Je==="resolved"?u("resolved"):""}<hr>${u("claude")}${u("wrote")}${u("check")}${s.shortcuts?'<div class="dt-pinf-foot"><kbd>F</kbd>opens it \xB7 the rest dim, not hidden</div>':""}`},Jn.addEventListener("click",t=>ws(Re.hidden,t.detail===0)),Re.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(Je=e.dataset.pinf,F("dt-pinf",Je),ws(!1),Jn.focus(),Pt?K():Te(!0))}),Re.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),ws(!1),Jn.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...Re.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!Re.hidden&&!Xn.contains(t.target)&&ws(!1)},!0);let Ra=t=>{Me=t,Ba.setAttribute("aria-pressed",String(t)),F("dt-resolved",t?"1":"0"),ye({resolved:t}),K(),An(!0)},Pa=t=>{qe=t,F("dt-archived",t?"1":"0"),ye({archived:t}),K(),An(!0)};Ba.addEventListener("click",()=>Ra(!Me)),Ba.setAttribute("aria-pressed",String(Me)),te.addEventListener("click",()=>{let t=ot.hidden===!0;t&&!Pt&&Te(!0),t&&$o(!1),Tu(t)});let Se=()=>{Yo||!Pt||(Yo=requestAnimationFrame(()=>{Yo=0,Mu()}))},Or=`${dn}, .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`,Hu=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Or))return!0;let n=[...t.addedNodes,...t.removedNodes];return n.length>0&&n.every(o=>o instanceof Element&&o.matches(Or))},Ia=!1,Dr=()=>{Ia=!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 n=e??Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"});document.body.lastElementChild!==n&&document.body.append(n)},Oa=0,Da=!1,Nu=()=>{if(!Pt)return!1;let t=new Set([...G.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].map(n=>Number(n.dataset.id))),e=Ne();return D.some(n=>!t.has(n.id)&&M(n)===e&&Js(n)&&cn(n)&&!!ue(n))},Bu=()=>Pt&&[...G.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=D.find(n=>n.id===Number(t.dataset.id));return!!e&&e.id!==U&&!ke(e)}),Ru=()=>Pt&&[...G.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=D.find(n=>n.id===Number(t.dataset.id));return!!e&&oa(e)==="probably"!==t.classList.contains("dt-pin--probably")}),qr=new MutationObserver(t=>{if(Pt&&!x&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),Ia=!0}t.every(Hu)||(Se(),t.some(e=>e.type!=="attributes")&&(Da=!0),Oa||(Oa=window.setTimeout(()=>{Oa=0,Da&&(Da=!1,to()),Nu()||Bu()||Ru()?K():Se()},150)))}),Fr=new ResizeObserver(()=>Se()),jr=()=>{G.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&Se()},ft=[],Wr=()=>{},$s=new Set,fe={at:"",ids:[]},Eo=t=>{ft=t,queueMicrotask(()=>Wr());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),n={};for(let d of t){if(ce(d)||!cn(d))continue;let u=kt(d),f=ne(d),v=u==="done"?"done":u==="claude"?"review":f&&ro[f]||Mn(d),P=n[d.route??""]??={...e(),bands:{}};P[v]++;let V=M(d);(P.bands[V]??=e())[v]++}Au();let o=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},i=d=>o.map(u=>[u,u==="done"&&!Me?0:d[u]]),l=d=>i(d).reduce((u,[,f])=>u+f,0);for(let d of document.querySelectorAll(".dt-pages a")){let u=d.querySelector(".dt-pages-n");if(!u)continue;let f=n[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let V of m){let p=f?.bands[V.id];for(let[W,z]of i(p??e())){let Ht=u.querySelector(`[data-bp="${V.id}"][data-state="${W}"]`);Ht.hidden=!z,z&&(Ht.querySelector("i").textContent=String(z),Ht.title=`${V.label}: ${z} ${a[W]}`)}}let v=f?l(f):0;u.hidden=!v;let P=f?m.filter(V=>f.bands[V.id]&&l(f.bands[V.id])).map(V=>`${V.label} ${l(f.bands[V.id])}`).join(" \xB7 "):"";u.title=v?`${o.filter(V=>f[V]).map(V=>`${f[V]} ${a[V]}`).join(" \xB7 ")}
|
|
308
|
+
${P}`:""}},Tn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!yo.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(n=>typeof n?.text=="string").map(n=>vo.has(`${Number(e.id)}|${n.at}`)?{...n,text:"",deleted:!0}:n):[],images:Array.isArray(e.images)?e.images.filter(n=>typeof n=="string"):[]})),Pu=sc(x,t=>jt(t,2800,document.querySelector(".dt-turbo")??void 0)),be=document.querySelector(".dt-push"),ze=be.querySelector(".dt-push-menu"),Ge=new Set,xs=new Set([mt]),Mo=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",ko=()=>s.client||x?[]:ft.filter(t=>t.status!=="done"&&Rt(t.assignee)&&!Nt(t)&&ve(t)==="approved"&&!Ke(t)&&!ce(t)&&!$s.has(t.id)),Lo=()=>ko().filter(t=>!Ge.has(t.id)),_r=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?re:""}</i>`,zr=()=>{let t=ko(),e=[...new Set(t.map(o=>o.route??"/"))],n=Lo().length;ze.innerHTML=`<div class="dt-push-head">${we(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=>!Ge.has(l.id)).length;return`<button type="button" class="dt-push-page${xs.has(o)?" is-open":""}" data-push-route="${b(o)}"><span data-push-fold="${b(o)}">${us}</span>${_r(i>0,i>0&&i<a.length)}<span class="dt-push-route">${b(o)}</span><em>${a.length}</em></button>`+(xs.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${_r(!Ge.has(l.id))}<span><small>#${l.id}</small>${b(Ot(l.text,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${n?"":" disabled"}>Send ${n} to the agent</button>`},Gr=()=>["push","paused"].includes(Mo()),qa=()=>fe.ids.filter(t=>{let e=ft.find(n=>n.id===t);return!!e&&e.status!=="done"&&ve(e)!=="review"&&($s.has(t)||!!Ke(e)||ve(e)==="approved")}),Vr="",Iu=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},tn=()=>{let t=Mo(),e=Lo().length,n=qa(),o=fe.ids.length-n.length,a=n.length>0&&Gr();if(n.length&&(Vr=fe.at),!n.length&&fe.ids.length&&fe.at&&Vr===fe.at&&!Iu(fe.at)){try{sessionStorage.setItem("nm-batch-done",fe.at)}catch{}ft.length&&_e(`The agent finished ${fe.ids.length} \u2014 check the fixes`,()=>xo.start(),"Check")}be.hidden=s.client||x||!e&&!be.matches(".is-sending, .is-sent");let i=be.querySelector(".dt-push-n");i.textContent=String(e),i.hidden=!e||be.classList.contains("is-sent"),be.querySelector(".dt-push-all").dataset.tip=a?`Push to the agent: it is on ${n.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to 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",(be.hidden||!ko().length)&&(ze.hidden=!0),ze.hidden||zr()},Ur=async t=>{if(!t.length&&Gr()){jt("Nothing waits for the agent \u2014 mark threads for the agent first");return}if(Mo()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),jt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(Mo()==="on"){jt("Turbo is on \u2014 the agent takes each thread as it lands");return}ze.hidden=!0;let e=t.map(o=>o.id);be.classList.add("is-sending");let n=await Qt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(be.classList.remove("is-sending"),!n?.ok){Nn("Could not send them to the agent",n),tn();return}for(let o of e)$s.add(o);be.classList.add("is-sent"),setTimeout(()=>{be.classList.remove("is-sent"),tn()},700),fe={at:fe.ids.some(o=>qa().includes(o))?fe.at:new Date().toISOString(),ids:[...new Set([...qa(),...e])]},tn(),_e(`${e.length} sent to the agent \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await Qt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)$s.delete(o);tn()}),Ve()},So=be.querySelector(".dt-push-all"),Kr=0,Fa=!1,Yr=()=>{ze.hidden=!1,zr()};So.addEventListener("click",()=>{if(Fa){Fa=!1;return}Ur(Lo())}),So.addEventListener("contextmenu",t=>{t.preventDefault(),ze.hidden?Yr():ze.hidden=!0}),So.addEventListener("pointerdown",t=>{t.button===0&&(Kr=window.setTimeout(()=>{Fa=!0,Yr()},500))});for(let t of["pointerup","pointerleave","pointercancel"])So.addEventListener(t,()=>clearTimeout(Kr));ze.addEventListener("click",t=>{let e=t.target,n=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),i=e.closest("[data-push]")?.dataset.push;if(i==="send"){Ur(Lo());return}if(i==="all")Ge.clear();else if(n){let l=n.dataset.pushFold;xs.has(l)?xs.delete(l):xs.add(l)}else if(o){let l=ko().filter(u=>(u.route??"/")===o.dataset.pushRoute),d=l.some(u=>!Ge.has(u.id));for(let u of l)d?Ge.add(u.id):Ge.delete(u.id)}else if(a){let l=Number(a.dataset.pushId);Ge.has(l)?Ge.delete(l):Ge.add(l)}tn()}),document.addEventListener("pointerdown",t=>{!ze.hidden&&!be.contains(t.target)&&(ze.hidden=!0)},!0),setInterval(tn,3e4),Wr=tn;let Xr=document.querySelector(".dt-turbo");Xr&&new MutationObserver(tn).observe(Xr,{attributes:!0,attributeFilter:["data-state"]}),tn();let Es="",ja=!1,Zn="dt-threads",Jr=String([Xt.base,s.me?.email??"",...s.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Wa="",To=null,Ou=t=>{x||t.version&&t.version===Wa||(To||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=To;To=null,Wa=e.version??"";let n=JSON.stringify({project:Jr,body:e});n.length<2e6?st.setItem(Zn,n):st.removeItem(Zn)},{timeout:3e3}),To=t)},_a=(t,e=!1)=>{Es=t.version??"",Pu(t);let n=t.turbo;$s=new Set(n?.push?.ids??[]),fe={at:n?.batch?.at??"",ids:n?.batch?.ids??[]};let o=Tn(t.comments);if(e&&(Me||qe)){let i=new Set(o.map(l=>l.id));o=[...o,...ft.filter(l=>kt(l)==="done"&&!i.has(l.id))]}Ou({...t,comments:o}),Eo(o);let a=o.filter(i=>i.route===mt);if(!(Xs&&(D=a,Zr()))){if(JSON.stringify(a)===JSON.stringify(D)){!ot.hidden&&!x&&K();return}D=a,K(),ye({reload:!0})}},An=async(t=!1)=>{let e=[t||!Es?"":`since=${Es}`,Me||qe?"":"open=1"].filter(Boolean).join("&");try{let n=await Qt(`comments${e?`?${e}`:""}`);n.status===200&&_a(await n.json())}catch{}},Ms=!1,Cn=async()=>{if(!document.hidden){if(ja||bo){Ms=!0;return}ja=!0,await An(),ja=!1,Ms&&(Ms=!1,Cn())}};wr=()=>{Ms&&!bo&&(Ms=!1,Cn())};let Zr=()=>{let t=Xs&&D.find(e=>e.id===Xs);return t?(Xs=0,Xe()&&!cn(t)&&vs(Nt(t)?"clients":"studio"),Pt||Te(!0),bs(t.id),!0):!1},za=()=>{D=ft.filter(t=>t.route===mt),Zr()||K()},Ga=0,Va=null,Ao=()=>{Va&&Pt&&Ua(Va)},Ua=t=>{Va=t,!Ga&&(Ga=requestAnimationFrame(()=>{Ga=0;let e=t.target;if(!Pt||e.closest(pe)){C.hidden=!0;return}let n=document.elementFromPoint(t.clientX,t.clientY);if(C.hidden=!1,!n)return;let o=n.getBoundingClientRect();N.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,_.textContent=n.tagName.toLowerCase()+([...n.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...n.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,_.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-16)}px`}))},Qr=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),Ft){Ft=null,K();return}if(A){rs()&&(He(),K());return}if(U!==null){U=null,K();return}Te(!1)}},tl=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],ks=!1,Ls=null,Hn=document.createElement("div");Hn.className="dt-repin-hint",Hn.hidden=!0,Hn.setAttribute("role","status"),Hn.textContent="Click the new spot for this thread \xB7 Esc cancels",document.body.append(Hn);let el=()=>{Ls=null,Hn.hidden=!0,Jt.toggle("dt-repinning",!1)},Du=t=>{Ls=t,U=null,Hn.hidden=!1,Jt.toggle("dt-repinning",!0),K()};document.addEventListener("keydown",t=>{t.key==="Escape"&&Ls!=null&&(t.stopImmediatePropagation(),el())},!0);let nl=!1,sl=t=>{ks||(t.type==="pointerdown"&&(nl=t.pointerType==="touch"),!t.target.closest?.(pe)&&t.stopPropagation())},ol=t=>{let e=t.target;nl&&(!e.closest?.(pe)||e.closest?.(".dt-pin"))&&t.preventDefault()},al=t=>{!ks&&t.button===0&&t.target.closest?.(":disabled")&&Ka(t)},Ka=t=>{if(ks)return;let e=t.target;if(e.closest(pe))return;if(t.preventDefault(),t.stopPropagation(),Mt){Mt=!1;return}if(!getSelection()?.isCollapsed)return;let n=t.detail===0&&!t.clientX&&!t.clientY,o=document.activeElement;G.hidden=!0;let a=n?o&&o!==document.body&&!o.closest(pe)?o:e:document.elementFromPoint(t.clientX,t.clientY);if(G.hidden=!1,!a)return;if(Ls!=null){let f=Ls;el();let v=a.getBoundingClientRect();np(f,a,n?v.left+v.width/2:t.clientX,n?v.top+v.height/2:t.clientY);return}if(!rs())return;He();let i=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(f=>!/^(astro|svelte|css)-/.test(f)).slice(0,2);A={selector:ea(a),tag:l,classes:d,nth:na({tag:l,classes:d}).indexOf(a),rx:i.width&&!n?(t.clientX-i.left)/i.width:.5,ry:i.height&&!n?(t.clientY-i.top)/i.height:.5,label:Ot(Kt(a.textContent||""),60),ctx:sa(a),fp:Zs(a),spot:{x:Math.round((n?i.left+i.width/2:t.clientX)+scrollX),y:Math.round((n?i.top+i.height/2:t.clientY)+scrollY)},opener:yc(a),category:g[0].id,...Xe()&&De==="clients"?{shared:!0}:{}};let u=s.client||A.shared?null:cs();u&&(A.assignee=u,A.stage="new",A.carried=!0),rl.set(A,Gu().then(()=>Ya(a))),U=null,C.hidden=!0,K()},qu=2200,Fu=900*1024,il=8*1024*1024,ju=3*1024*1024,Wu=50*1024*1024,_u=1200,zu=1600,Ya=async t=>{let e=t instanceof HTMLElement?t:null;for(let l=0;e&&l<4&&e.parentElement&&e.parentElement!==document.body;l++){let d=e.getBoundingClientRect();if(d.width>=360&&d.height>=140)break;e=e.parentElement}let n=e?.getBoundingClientRect();if(!e||!n?.width||!n.height)return null;let o=t?.getBoundingClientRect(),a=o&&o.width&&o.height?{x:(o.left-n.left)/n.width,y:(o.top-n.top)/n.height,w:o.width/n.width,h:o.height/n.height}:null,i="";for(let l=e;l&&!i;l=l.parentElement){let d=getComputedStyle(l).backgroundColor;d&&d!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(d)&&(i=d)}if(!i){let[l,d,u]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);i=.299*l+.587*d+.114*u>140?"#111":"#fff"}try{let{domToWebp:l}=await import("modern-screenshot"),d=Math.min(1,_u/n.width,zu/n.height),u=await Promise.race([l(e,{scale:d,quality:.8,timeout:4e3,backgroundColor:i,filter:f=>!(f instanceof Element&&f.closest(dn))}),new Promise(f=>setTimeout(()=>f(null),8e3))]);return u&&u.length<il?{url:u,box:a}:null}catch{return null}},rl=new WeakMap,Gu=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),jt=(t,e=2800,n)=>{let o=document.createElement("div");o.className="dt-toast",o.textContent=t;for(let a of document.querySelectorAll(".dt-toast:not(.dt-toast--undo)"))a.remove();if(document.body.append(o),n){let a=n.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(()=>o.remove(),e),o},ll=async(t,e)=>{for(let n of e){let[,o,a]=n.split("\0"),i=uo.get(o);if(uo.delete(o),!i){jt(`${a} was not sent \u2014 attach it again`);continue}let l=jt(`Uploading ${a}\u2026`,12e4),d=await Qt("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:i.name,size:i.size})}).then(P=>P.ok?P.json():null).catch(()=>null),u=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:i}).catch(()=>null),f=u?.ok&&await Y({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!f||!f.ok){jt(u===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let v=Tn([await f.json().catch(()=>null)])[0];v&&(D=D.map(P=>P.id===v.id?v:P),K()),jt(`${a} sent`)}},dl=t=>{let e=t.filter(n=>n.startsWith(co)).map(n=>n.split("\0"));return e.length&&jt(e.length===1?`${e[0][1]} was not sent \u2014 ${e[0][2]}`:`${e.length} files were not sent: ${e.map(([,n,o])=>`${n} (${o})`).join(", ")}`,6e3),t.filter(n=>!n.startsWith(co))},Nn=async(t,e)=>{if(!navigator.onLine){jt(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let n="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{n=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{n=""}(n.length>160||n.startsWith("<"))&&(n="")}jt(n?`${t}: ${n.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},Vu=t=>new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result)),n.readAsDataURL(t)}),Uu=async t=>{let e=await createImageBitmap(t),n=Math.min(1,qu/Math.max(e.width,e.height));if(n===1&&t.size<=Fu)return e.close(),Vu(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*n),o.height=Math.round(e.height*n),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},Xa=async(t,e)=>{let n=[],o=(a,i)=>n.push(`${co}${a}\0${i}`);for(let a of t){let i,l=md(a.name)||Object.keys(Os).find(d=>Os[d]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,gi.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>Wu){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>ju&&Xt.via){let u=`${Date.now()}-${uo.size}`;uo.set(u,a),n.push(`${va}${u}\0${a.name}\0${a.size}`);continue}let d=await new Promise((u,f)=>{let v=new FileReader;v.onload=()=>u(String(v.result).split(",")[1]),v.onerror=f,v.readAsDataURL(a)}).catch(()=>"");d?n.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${hd(a.name)||"file"};ext=${l};base64,${d}`):o(a.name,"Could not be read");continue}try{i=await Uu(a)}catch{o(a.name,"This picture could not be read");continue}if(i.length>il){o(a.name,"Too large even after shrinking");continue}n.push(i)}if(n.length){if(!Number(e?.dataset.id)){A&&((A.images??=[]).push(...n),K());return}oe.push(...n),K(),Ss(".dt-note-reply-input")}},cl=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);G.addEventListener("paste",t=>{let e=cl(t.clipboardData?.items);e.length&&(t.preventDefault(),Xa(e,t.target.closest(".dt-note")))}),G.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),G.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),G.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let n=cl(t.dataTransfer?.items);n.length&&Xa(n,e)});let Ss=t=>{let e=G.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},ul=()=>{Ss(".dt-note-edit-input"),G.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Ja=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=Ma-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},Ku=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Yu=()=>s.client||A?.shared||U!=null&&Nt(D.find(t=>t.id===U))?[]:Sd(),pl=t=>{let n=t.closest(".dt-compose").querySelector(".dt-mentions");n?.remove();let o=Ku(t);if(!o)return;let a=o[1].toLowerCase(),i=U!=null?D.find(v=>v.id===U):void 0,d=(s.client||A?.shared||i&&Nt(i)?s.team??[]:lo()).filter(v=>!$i(v.email)).filter(v=>v.email!==s.me?.email&&[v.name,v.nickname,v.email].some(P=>P?.toLowerCase().startsWith(a))).slice(0,5),u=Yu().filter(()=>!a||qs.some(v=>v.startsWith(a))).slice(0,4);if(!d.length&&!u.length)return;t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(v=>`<button type="button" role="option" data-act="mention" data-handle="${b(yd(v))}">${_n(v.avatar_url,v.name||v.email)}<span class="dt-mention-who"><b>${b(v.name||v.email)}</b>${v.name?`<span>${b(v.email)}</span>`:""}</span></button>`),...u.map(v=>`<button type="button" role="option" data-act="mention" data-handle="${b(v.handle)}">${Cc(null)}<span class="dt-mention-who"><b>Agent</b><span>agent \xB7 the shared queue \u2014 any agent takes it</span></span></button>`)].map((v,P)=>v.replace('role="option"',`role="option" aria-selected="${P===0}"`)).join("")}</div>`);let f=t.nextElementSibling;n&&(f.style.animation="none"),f.getBoundingClientRect().top<8&&f.classList.add("is-below")},Xu='<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>',Ju='<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>',hl=t=>{let e=[...(s.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...qs].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>b(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=e.length?new RegExp(`@(?:${e.join("|")})${bi}`,"giu"):null;return yi(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${b(o.url)}" target="_blank" rel="noopener noreferrer" title="${b(o.url)}">${o.kind==="pr"?Xu:ar}<span>${b(o.label)}</span>${Ju}</a>`:n?b(o).replace(n,a=>{let i=Td(a,s.team??[],s.me?.email);return`<span class="dt-at" data-kind="${i}">${i==="agent"?we(10):""}${a}</span>`}):b(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let n=document.createElement("div");for(let a=0;a<e.rangeCount;a++)n.append(e.getRangeAt(a).cloneContents());let o=n.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",n.textContent??""),t.preventDefault()}});let ml=(t,e)=>{let n=t.selectionStart??t.value.length,o=t.value.slice(0,n).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(n)}`,t.selectionStart=t.selectionEnd=o+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},Zu=(t,e)=>{if(!t){A&&(A.category=e),K();return}Le(n=>n.map(o=>o.id===t?{...o,category:e}:o),()=>Y({id:t,category:e}),"Changing the type")};Ud([G,ot],b,re),ot.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&so(Number(e.dataset.id),e.value)}),ot.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),Xi(Number(e.dataset.id)))},!0);let Qu=t=>Nt(t)?"studio":"clients",gl=async(t,e=!1)=>{let n=D.find(i=>i.id===t);if(!n||Nt(n)&&n.client)return;let o=!Nt(n);U===t&&(U=null);let a=o&&Rt(n.assignee)?{assignee:null,stage:"new"}:{};await Le(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),()=>Y(o?{id:t,shared:o,...a}:{id:t,shared:!1,client:!1}),o?"Moving it to clients":"Moving it to the workspace"),Eo(ft),e||_e(o?"Moved to clients":"Moved to the workspace",()=>gl(t,!0))},tp=async t=>{let e=D.find(d=>d.id===t);if(!e)return;let n=e,o={text:e.text,from:{id:e.id},...Nt(e)?{}:{shared:!0}};for(let d of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])n[d]!=null&&(o[d]=n[d]);let a=await Un(Qt("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Nn("The copy was not made",a);return}let i=Tn([await a.json().catch(()=>null)])[0];i&&(ft=[...ft,i],D=ft.filter(d=>d.route===mt)),Eo(ft),K(),Ve();let l=Qu(e);_e(l==="clients"?"Duplicated for the client":"Duplicated to the workspace",()=>{i&&(vs(l),bs(i.id))},"Open")},ep=t=>{let e=new URL(location.href);e.searchParams.has("notemend")||(e.search=e.search?`${e.search}¬emend`:"?notemend"),e.hash=`thread-${t}`;let n=e.href;navigator.clipboard?.writeText(n).then(()=>jt("Link copied"),()=>jt(n,6e3))};G.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,u=Number(e.dataset.id)||0;e.value="",d==="dup"?tp(u):d==="move"?gl(u):d==="link"?ep(u):d==="reopen"?We(u,!1):d==="rm"?(U=null,Sa(u)):d==="discard"&&(A=null,K());return}let n=t.target.closest(".dt-lang-select");if(n){xa(Number(n.dataset.id),n.dataset.at,n.value==="orig"?null:n.value);return}let o=t.target.closest(".dt-cat-select");if(o){Zu(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){Ic(Number(a.dataset.id),a.value);return}let i=t.target.closest(".dt-owner-select");if(i){$c(Number(i.dataset.id)||0,i.value);return}let l=t.target.closest(".dt-for-select");if(l){if(st.setItem("nm-for",l.value),s.client){A&&(A.assignee=l.value,cs(l.value),K());return}la(Number(l.dataset.id)||0,"person")}}),G.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&A?.suggest){A.suggest.to=e.value,xn(),Ja(e);return}let n=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");n&&(pl(n),n.classList.contains("dt-note-input")?A&&(A.text=n.value):n.classList.contains("dt-note-edit-input")?Ft&&(Ft.text=n.value):de=n.value,xn(),n.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",n.value.trim()!==""),Ja(n))}),G.addEventListener("keydown",t=>{if(t.key==="Escape"&&G.querySelector(".dt-emoji")){t.stopPropagation();let a=Qe?.box??Qe?.btn;ho(),a?.focus();return}let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let n=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!n()&&pl(e);let o=n();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),ml(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let Tt=null,Co=!1;function Ts(t){return!s.client||!!s.me&&t.by===s.me.email}let fl=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},Za=fl("dt-drag-box--home"),bl=fl("dt-drag-box--to"),yl=()=>{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)};yl(),addEventListener("resize",yl);let np=async(t,e,n,o)=>{let a=D.find(f=>f.id===t);if(!a)return;let i={...Qa(e,n,o),fp:Zs(e),spot:{x:Math.round(n+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=`${mo(a.tag,a.classes,a.selector)}${Kt(a.label)?` \xAB${Ot(Kt(a.label),24)}\xBB`:""}`,u=(f,v,P)=>Le(V=>V.map(p=>p.id===t?{...p,...f,anchor:null,...v?{repinnedAt:new Date().toISOString(),repinnedBy:s.me?.email??"you",repinnedFrom:d}:{repinnedAt:null,repinnedBy:null,repinnedFrom:null}}:p),()=>Y({id:t,move:f,anchor:null,repin:v?d:!1}),P);En.delete(t),await u(i,!0,"Re-pinning"),_e(`Pinned to ${As(e)}`,()=>{En.delete(t),u(l,!1,"Putting the pin back")})},sp=async t=>{let e=D.find(i=>i.id===t),n=e&&ke(e);if(!e||!n)return;let o=n.getBoundingClientRect(),a={...Qa(n,o.left+o.width*e.rx,o.top+o.height*e.ry),fp:Zs(n)};En.delete(t),await Le(i=>i.map(l=>l.id===t?{...l,...a,anchor:null}:l),()=>Y({id:t,move:a,anchor:null}),"Keeping the pin here"),to(),K()},op=t=>{let e=D.find(i=>i.id===t),n=e&&ue(e)?.opener;if(!e||!n)return;ks=!0;let o=n.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"])n.dispatchEvent(new(i.startsWith("pointer")?PointerEvent:MouseEvent)(i,a))}finally{ks=!1}U=null,setTimeout(()=>{to(),U=t,K()},180)},As=t=>{let e=Ot(Kt(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},vl=(t,e,n="")=>{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=n,t.hidden=!1},ap=(t,e)=>document.elementsFromPoint(t,e).find(n=>!n.closest(pe)&&!n.closest(".dt-drag-box")&&n!==document.documentElement&&n!==document.body)??null,ip=(t,e,n)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&n>=o.top&&n<=o.bottom},Qa=(t,e,n)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),i=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ea(t),tag:a,classes:i,nth:na({tag:a,classes:i}).indexOf(t),label:as(t.textContent||"",60),ctx:sa(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(n-o.top)/o.height)):.5}},ti=()=>{Tt&&(Tt.pin.classList.remove("is-dragging"),Jt.toggle("dt-dragging",!1),Za.hidden=bl.hidden=!0,Tt=null,Se())};G.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let n=D.find(o=>o.id===Number(e.dataset.id));!n||!Ts(n)||(Tt={id:n.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:ke(n),to:null},e.setPointerCapture(t.pointerId))}),G.addEventListener("pointermove",t=>{if(!Tt||!Tt.on&&Math.hypot(t.clientX-Tt.x0,t.clientY-Tt.y0)<4)return;Tt.on=!0,Tt.pin.classList.add("is-dragging"),Jt.toggle("dt-dragging",!0),Tt.pin.style.left=`${t.clientX}px`,Tt.pin.style.top=`${t.clientY}px`,Tt.to=Tt.home&&ip(Tt.home,t.clientX,t.clientY)?Tt.home:ap(t.clientX,t.clientY);let e=Tt.to&&Tt.to!==Tt.home;vl(Za,Tt.home,e?"":Tt.home?As(Tt.home):""),Za.classList.toggle("is-left",!!e),vl(bl,e?Tt.to:null,e?`Move to ${As(Tt.to)}`:"")}),G.addEventListener("pointerup",async t=>{if(!Tt)return;let e=Tt;if(!e.on||!e.to){ti();return}Co=!0,setTimeout(()=>{Co=!1},0);let n=D.find(d=>d.id===e.id),o=Qa(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(ti(),!n)return;let i={selector:n.selector,tag:n.tag,classes:n.classes,nth:n.nth,label:n.label,ctx:n.ctx,rx:n.rx,ry:n.ry},l=(d,u)=>Le(f=>f.map(v=>v.id===e.id?{...v,...d}:v),()=>Y({id:e.id,move:d}),u);await l(o,"Moving the pin"),a&&_e(`Moved to ${As(e.to)}`,()=>l(i,"Putting the pin back"))}),G.addEventListener("click",t=>{Co&&(t.stopImmediatePropagation(),t.preventDefault(),Co=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&Tt?.on&&(t.stopImmediatePropagation(),ti())},!0),G.addEventListener("click",async t=>{let e=t.target.closest("button"),n=Qe?.btn;if(e?.closest(".dt-emoji")||ho(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="react"){gr(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){n!==e&&mr(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"&&Qe){let i=Qe;mr(i.btn,!0,i);return}if(o==="emoji"&&Qe){let i=Qe;ho(),i.box?cu(i.box,e.dataset.emoji):i.id&&gr(i.id,i.at||null,e.dataset.emoji);return}if(o==="prio"){let i=e.dataset.v||null;a?Le(l=>l.map(d=>d.id===a?{...d,priority:i??void 0}:d),()=>Y({id:a,priority:i}),"Setting the priority"):A&&(A.priority=i??void 0,xn(),K());return}if(o==="mention"){let i=e.closest(".dt-compose")?.querySelector("textarea");i&&ml(i,e.dataset.handle);return}if(!o){if(A&&!rs())return;U=U===a?null:a,He(),K(),Ln&&wo();return}if(o==="speak"){eu(e.closest(".dt-note"),e);return}if(o==="voice-write"){su(e);return}if(o==="voice"||o==="voice-seek"){Wc(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&&Xa([...i.files],l)}),i.click();return}if(o==="unshot"){a?Ft&&Ft.drop.push(e.dataset.img):(e.closest("[data-draft]")?A?.images??[]:oe).splice(Number(e.dataset.i),1),K(),Ft&&ul();return}if(o==="edit"){let i=D.find(u=>u.id===a),l=e.dataset.at||null,d=l?i?.replies?.find(u=>u.at===l)?.text:i?.text;if(d===void 0)return;Ft={id:a,at:l,text:d,drop:[]},K(),ul();return}if(o==="edit-cancel"){Ft=null,K();return}if(o==="tr-orig"){xa(a,e.dataset.at,null);return}if(o==="tr-retry"){xa(a,e.dataset.at,e.dataset.to);return}if(o==="unsay"){let i=e.dataset.at;vu(a,i);return}if(o==="edit-save"){let i=Ft;if(!i)return;let l=i.text.trim();if(!l){G.querySelector(".dt-note-edit-input")?.focus();return}Ft=null;let d=u=>i.drop.includes(u.split("/").pop());await Le(u=>u.map(f=>f.id!==i.id?f:{...f,...i.at==null?{text:l}:{replies:(f.replies??[]).map(v=>v.at===i.at?{...v,text:l}:v)},images:(f.images??[]).filter(v=>!d(v))}),()=>Y({id:i.id,edit:{at:i.at,text:l},...i.drop.length?{removeImage:i.drop}:{}}).then(u=>(u.ok||(Ft=i),u),u=>{throw Ft=i,u}),"Saving the edit");return}if(o==="cancel"){rs()&&(He(),K());return}if(o==="twin"){if(!rs())return;He(),U=Number(e.dataset.id),K();return}if(o==="discard"){A=null,K();return}if(o==="draft-open"){Na(Number(e.dataset.i));return}if(o==="close"){U=null,K();return}if(o==="hidden-why"){let i=e.getAttribute("aria-expanded")!=="true";e.setAttribute("aria-expanded",String(i)),e.parentElement.querySelector("p").hidden=!i;return}if(o==="where"){let i=D.find(V=>V.id===Number(e.dataset.id)),l=i&&ue(i),d=l?.hidden;if(!d)return;let u=V=>{let p=V.getBoundingClientRect();return(p.width||p.height)&&V.checkVisibility?.()!==!1?p:null},f=l.shut instanceof HTMLElement?l.shut:null,v=f&&u(f);if(f&&!v){let V=f.getAttribute("style");f.setAttribute("style",`${V??""};display:block!important`),v=u(f),V==null?f.removeAttribute("style"):f.setAttribute("style",V)}v??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let P=document.createElement("div");P.className="dt-where",P.style.cssText=`left:${v.left}px;top:${v.top}px;width:${v.width}px;height:${v.height}px`,document.body.append(P),P.animate([{opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.75},{opacity:0}],1600).finished.finally(()=>P.remove());return}if(o==="unsuggest"&&A){A.suggest=null,K();return}if(o==="uncarry"&&A){A.assignee="",A.carried=!1,cs(""),xn(),K();return}if(o==="save"){if(!A)return;A.images&&(A.images=dl(A.images));let i=(A.images??[]).filter(z=>!Vn(z)),l=A.suggest&&A.suggest.to.trim()!==A.suggest.from?{from:A.suggest.from,to:A.suggest.to.trim()}:null,d=G.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(A.images?.some(ga)?pr:A.images?.some(z=>Vn(z)&&!Ds(z))?"See the attached image":A.images?.length?"See the attached file":"");if(!d){G.querySelector(".dt-note-input")?.focus();return}let u=A,f=s.client||u.shared===!0?null:wi(d,ds()),v=rl.get(u)??Ya(ke(u)),P={...u,images:u.images?.filter(Vn),route:mt,text:d,suggest:l,assignee:s.client?rr(u.assignee)||void 0:f??(u.assignee||void 0),shared:s.client?!0:u.shared===!0,stage:s.client?"new":f?"approved":u.stage??(Rt(u.assignee)?"approved":"new"),breakpoint:ta(),browser:hc(),device:x?wl:"",viewport:{w:innerWidth,h:innerHeight},logs:jd(),host:location.host},V={...u,id:-Date.now(),text:d,route:mt,status:"open",note:"",doneBy:null,breakpoint:P.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:s.me?.email,byName:s.me?.name};D=[...D,V],A=null,K();let p=await Un(Qt("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(P)})).catch(()=>null);if(!p?.ok){D=D.filter(z=>z!==V),He(),A=u,K(),Nn("Thread was not saved",p);return}let W=Tn([await p.json().catch(()=>null)])[0];D=D.map(z=>z===V&&W?W:z),K(),W&&v.then(z=>{z&&Y({id:W.id,before:z.url,box:z.box})}),W&&i.length&&ll(W.id,i),Ve();return}if(o==="reply"){let i=G.querySelector(".dt-note-reply-input");oe=dl(oe);let l=i.value.trim()||(oe.some(ga)?pr:oe.some(z=>Vn(z)&&!Ds(z))?"See the attached image":oe.length?"See the attached file":"");if(!l){i.focus();return}let d=oe;de=l,Oe=a,ls(),de="",oe=[],i.value="";let u=D,f=D.find(z=>z.id===a),v=s.client||Nt(f)?null:wi(l,ds()),P=v&&f&&(v!==f.assignee||ve(f)!=="approved"||f.status==="done")?{assignee:v,stage:"approved",...f.status==="done"?{status:"open",doneBy:null}:{}}:{};D=D.map(z=>z.id===a?{...z,...P,replies:[...z.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:s.me?.email}]}:z),Us=a,K();let V=await Un(Y({id:a,reply:l,images:d.filter(Vn),...P})).catch(()=>null);if(!V?.ok){D=u,de=l,oe=d,K();let z=G.querySelector(".dt-note-reply-input");z&&!z.value&&(z.value=l);let Ht=()=>G.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?_e(`Reply was not sent${V?` (${V.status})`:""} \u2014 it is back in the box`,Ht,"Retry"):Nn("Reply was not sent",V);return}ls();let p=Tn([await V.json().catch(()=>null)])[0];p&&(D=D.map(z=>z.id===p.id?p:z),K()),Ve();let W=d.filter(z=>!Vn(z));W.length&&ll(a,W);return}if(o==="newbelow"){let i=e.closest(".dt-note")?.querySelector(".dt-note-thread");i?.scrollTo({top:i.scrollHeight,behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}),delete Ee[a],e.remove();return}if(o==="hand"){la(a,e.dataset.v);return}if(o==="repin"){Du(a);return}if(o==="pin-yes"){await sp(a);return}if(o==="open-it"){op(a);return}if(o==="lost-resolve"){U=null,await We(a,!0);return}if(o==="claude"){Xi(a);return}if(o==="sendback"){await We(a,!1),Ss(".dt-note-reply-input");return}if(o==="accept"){await We(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(U=null),await kn(a,o==="archive");return}e.classList.contains("dt-step-act")||(U=null),o==="rm"?await Sa(a):await We(a,o==="done")});let wl="",ye=t=>{ut.hidden||he.contentWindow?.postMessage({dt:!0,...t},location.origin)},rp=()=>({notes:Pt,grid:!pt.hidden,inspect:w,resolved:Me,archived:qe,...$l.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(x&&e.projectGrid!==void 0){Et=e.projectGrid,pt.hidden||et();return}if(!x&&t.source===he.contentWindow){if(e.key){Vl(e.key[0],e.key[1])?.run();return}if(e.closeMenus){ae();return}if(e.route){ct();return}if(e.drafts){ka=e.drafts,Sn(Ne());return}}if(x&&typeof e.openDraft=="number"){Na(e.openDraft);return}if(x&&typeof e.dropDraft=="number"){Rr(e.dropDraft);return}if(x&&typeof e.device=="string"&&(wl=e.device),x&&e.scrollbar&&Jt.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===he.contentWindow){ye(rp());return}typeof e.notes=="boolean"&&e.notes!==Pt&&Te(e.notes,!1),typeof e.open=="number"&&bs(e.open),typeof e.grid=="boolean"&&e.grid===pt.hidden&&bt(e.grid),typeof e.inspect=="string"&&e.inspect!==w&&Vt(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Me&&Ra(e.resolved),typeof e.archived=="boolean"&&e.archived!==qe&&Pa(e.archived),e.reload&&An()});let Ve=async()=>{await An(),ye({reload:!0}),x&&parent.postMessage({dt:!0,reload:!0},location.origin)},Te=(t,e=!0)=>{if(Pt=t,Ct.setAttribute("aria-pressed",String(t)),t?!x&&ot.hidden&&st.getItem("dt-history")==="1"&&(ot.hidden=!1,te.setAttribute("aria-pressed","true")):(ot.hidden=!0,ot.replaceChildren(),te.setAttribute("aria-pressed","false")),F(Hi,t?"1":"0"),ye({notes:t}),x&&e&&parent.postMessage({dt:!0,notes:t},location.origin),G.hidden=!t||!ut.hidden,Jt.toggle("dt-noting",t),t&&!x?Dr():document.querySelector(".dt-room")?.remove(),t){Vt(""),document.addEventListener("click",Ka,!0),document.addEventListener("pointerup",al,!0);for(let n of tl)document.addEventListener(n,sl,!0);document.addEventListener("contextmenu",ol,!0),document.addEventListener("keydown",Qr),document.addEventListener("mousemove",Ua),addEventListener("scroll",Se,!0),addEventListener("scroll",Ao,!0),addEventListener("scroll",wo,!0),addEventListener("resize",Se),addEventListener("resize",Ao),addEventListener("pointerover",jr,!0),to(),qr.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),Fr.observe(document.body),za()}else{He(),U=null,document.removeEventListener("click",Ka,!0),document.removeEventListener("pointerup",al,!0);for(let n of tl)document.removeEventListener(n,sl,!0);document.removeEventListener("contextmenu",ol,!0),document.removeEventListener("keydown",Qr),document.removeEventListener("mousemove",Ua),C.hidden=!0,removeEventListener("scroll",Se,!0),removeEventListener("scroll",Ao,!0),removeEventListener("scroll",wo,!0),removeEventListener("resize",Se),removeEventListener("resize",Ao),removeEventListener("pointerover",jr,!0),qr.disconnect(),Fr.disconnect(),G.innerHTML=""}},{pickBp:ei,...$l}=Qd({cfg:s,inFrame:x,persist:F,frame:ut,frameEl:he,devicesMenu:Pe,bpBtns:It,notesOverlay:G,WIDE:$,bpOf:T,currentBp:ta,deviceById:k,notesOn:()=>Pt,filter:()=>Zo,filterTo:t=>{Zo=t},dropFrameDrafts:()=>{ka=[]},putAway:()=>{U=null,He()},tellFrame:ye,syncBpButtons:Ii,render:()=>K(),reread:()=>{Pt?za():K()}}),xl="dt-studio",El=t=>{ln.setAttribute("aria-pressed",String(t)),Jt.toggle("dt-no-studio",!t),F(xl,t?"1":"0")};ln.addEventListener("click",()=>El(ln.getAttribute("aria-pressed")!=="true")),El(st.getItem(xl)!=="0"),Ct.addEventListener("click",()=>Te(!Pt));let ee=document.querySelector(".devtools"),Qn=document.querySelector(".dt-tab"),Ml=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-ee.getBoundingClientRect().top)+12}px`);new ResizeObserver(Ml).observe(ee),addEventListener("resize",Ml);let lp=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),kl=()=>{ee.removeAttribute("data-tight");let t=ee.getBoundingClientRect().right,e=lp(),n=!1;for(let o of ee.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&&(n=!0)}ee.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||n)},Ll=0,ni=()=>{cancelAnimationFrame(Ll),Ll=requestAnimationFrame(kl)},dp=new ResizeObserver(ni);for(let t of ee.children)dp.observe(t);addEventListener("resize",ni),kl();for(let t of[1500,4e3])setTimeout(ni,t);for(let t of gt)t.addEventListener("toggle",()=>{let e=t.querySelector(":scope > :not(summary)");if(!e||(e.style.translate="",!t.open||ot.hidden))return;let n=e.getBoundingClientRect(),o=ot.getBoundingClientRect();o.width&&n.right>o.left-8&&n.bottom>o.top&&n.top<o.bottom&&(e.style.translate=`${Math.round(o.left-8-n.right)}px 0`)});let Sl=t=>{ee.toggleAttribute("data-collapsed",t),Qn.toggleAttribute("data-collapsed",t),Qn.setAttribute("aria-expanded",String(!t)),Qn.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),ee.inert=t,t&&ae(),t&&ns&&No(""),t&&Pt&&Te(!1),F("dt-collapsed",t?"1":"0")};Qn.addEventListener("click",()=>Sl(!ee.hasAttribute("data-collapsed")));let Ae=document.querySelector(".dt-keys"),Tl=Ae.querySelector(".dt-set-keys"),cp=Ae.querySelector(".dt-set-main"),Cs=Ae.querySelector(".dt-set-grid"),Al=Ae.querySelector('[data-set="grid"] .dt-set-hint'),Hs=t=>{if(cp.hidden=t!=="main",Tl.hidden=t!=="keys",Cs.hidden=t!=="grid",t==="grid"&&mp(),Al){let e=Zt();Al.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},si=t=>Hs(t?"keys":"main"),oi={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}},Ns={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},up=["cols","gutter","margin","max"],Ho=(t,e)=>Math.min(Ns[t][1],Math.max(Ns[t][0],Math.round(e))),pp=()=>({...oi,...Et?.widths}),ai=()=>!!s.project&&!!s.gridAdmin,Cl=()=>!pt.hidden&&!Zt()&&S?S:E(),hp=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},mp=()=>{let t=ai(),e=pp(),n=dt(),o=Zt(),a=m.find(u=>u.id===n),i=(u,f)=>`<div class="dt-grid-row"><span>${u}</span><b>${f}</b></div>`,l=(Xt.cabinet||s.cabinet)&&s.project?` <a href="${b(`${Xt.cabinet||s.cabinet}/p/${s.project}?tab=settings`)}" target="_blank" rel="noopener">Also in the cabinet \u203A</a>`:"",d;if(o)d=`<p class="dt-grid-band">${b(a.label.toUpperCase())} \xB7 ${a.ideal} \u2014 this width</p>
|
|
309
|
+
<div class="dt-grid-fields">${up.map(u=>`<label><span>${u==="cols"?"Cols":u[0].toUpperCase()+u.slice(1)}</span>
|
|
310
|
+
<input type="number" inputmode="numeric" step="1" min="${Ns[u][0]}" max="${Ns[u][1]}" data-grid-k="${u}" value="${o[u]??""}"${u==="max"?' placeholder="\u2014"':""}${t?"":" disabled"}></label>`).join("")}</div><hr>
|
|
311
|
+
${m.filter(u=>u.id!==n&&e[u.id]).map(u=>i(`${b(hp(u.label))} \xB7 ${u.ideal}`,`${e[u.id].cols} \xB7 ${e[u.id].gutter} \xB7 ${e[u.id].margin}`)).join("")}<hr>
|
|
312
|
+
<p class="dt-grid-foot">${t?"Saved for the project \u2014 everyone sees it.":"Set by the project\u2019s admins."}${l}</p>`;else{let u=Cl();d=i(u.from==="guess"?"Guessed":"Read from the page",`${u.cols} \xD7 ${u.w}`)+i("Gap",String(u.gap))+i("Margin",String(u.x))+`<hr><p class="dt-grid-foot">${s.project?"Auto reads each page. Custom keeps the same columns on every page.":"Auto reads each page. Link the site to a project to set its grid."}</p>`}Cs.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${zo}<span>Grid</span></button><hr>`+(s.project?`<div class="dt-grid-from"><span>Columns from</span><div class="dt-seg" role="radiogroup" aria-label="Columns from">${["auto","custom"].map(u=>`<button type="button" role="radio" data-grid-mode="${u}" aria-checked="${u==="custom"==!!o}"${t?"":" disabled"}>${u==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},Hl=async(t,e)=>{let n=Et,o=u=>{u&&!Cs.hidden&&Hs("grid"),pt.hidden||et(),ye({projectGrid:Et})};Et=t(Et),o(e);let a=await Qt("config").then(u=>u.ok?u.json():null).catch(()=>null),i=t(a?a.projectGrid??null:n),l=await Qt("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:i})}).catch(()=>null);if(l?.ok){Et=(await l.json()).grid??null;return}let d=l?await l.text():"";jt(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),Et=n,o(!0)};if(Cs.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!ai()||e==="custom"==!!Zt())return;let n=dt(),o=e==="custom"?Cl():null,a=document.documentElement.clientWidth,i=o&&{cols:Ho("cols",o.cols),gutter:Ho("gutter",o.gap),margin:Ho("margin",o.x),max:Math.abs(a-2*o.x-o.w)<=2?null:Ho("max",o.w)};Hl(l=>({mode:e,widths:{...oi,...l?.widths,...i?{[n]:i}:{}}}),!0)}),Cs.addEventListener("change",t=>{let e=t.target,n=e.dataset.gridK,o=Zt();if(!n||!o||!ai())return;let a=e.value.trim()===""?null:Number(e.value),[i,l]=Ns[n];if(a===null?n!=="max":!Number.isInteger(a)||a<i||a>l){jt(`${n==="cols"?"Cols":n[0].toUpperCase()+n.slice(1)} is ${i}\u2013${l}${n==="max"?" or empty":""}.`),e.value=String(o[n]??"");return}if(a===o[n])return;let d=dt();Hl(u=>({mode:"custom",widths:{...oi,...u?.widths,[d]:{...u?.widths?.[d]??o,[n]:a}}}),!1)}),it.querySelector("button").addEventListener("click",()=>{ae(),Ae.open=!0,Hs("grid")}),Hs("main"),Xt.signOut)for(let t of Ae.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;Ae.querySelector("summary").addEventListener("click",()=>si(!1));let mn=ee.querySelector(".dt-vision"),ts=mn.querySelector(".dt-vision-sheet"),Bs=[{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">${Bs.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 Nl=document.createElement("style");document.head.append(Nl);let es=document.createElement("div");es.className="dt-seeing",es.hidden=!0,ee.append(es);let ns="",No=t=>{ns=t;let e=Bs.find(n=>n.id===t)??Bs[0];Nl.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",mn.toggleAttribute("data-on",!!t),es.hidden=!t,es.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>`:""};es.addEventListener("click",t=>{t.target.closest("button")&&No("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!ns||t.defaultPrevented||Ul(t.target)||(No(""),t.preventDefault())});let Bo=null,ii=0,ri=0,Bl=()=>{let t=Math.round((Date.now()-ii)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},Rl=t=>{if(t==="none"){ts.className="dt-sheet dt-vision-sheet dt-vision-list",ts.innerHTML='<p class="dt-vision-title">See the page as</p>'+Bs.map(n=>`<button type="button" data-vision="${n.id}" aria-pressed="${n.id===ns}"><span>${n.name}</span>${n.id===ns?$t('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${n.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;ts.className="dt-sheet dt-vision-sheet",ts.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 ${Bl()}`}</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">${Bs.map(n=>`<button type="button" data-vision="${n.id}" aria-pressed="${n.id===ns}"><span class="dt-vision-thumb">${Bo&&t==="ready"?`<img src="${Bo}" alt="" style="filter:${n.id==="low"?`blur(${(2.5*e*2).toFixed(2)}px)`:n.css}">`:""}</span><span>${n.name}</span></button>`).join("")}</div>`},li=async()=>{let t=++ri;Rl("taking");let e=[document.body,document.documentElement].map(o=>getComputedStyle(o).backgroundColor).find(o=>o&&o!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(o))??"#fff",n=null;try{let{domToWebp:o}=await import("modern-screenshot");n=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(`${dn}, .dt-pad-overlay, .dt-grid-overlay, .dt-vision-defs, .dt-toast`))}),new Promise(a=>setTimeout(()=>a(null),4e3))])}catch{n=null}t!==ri||!mn.open||(Bo=n,ii=Date.now(),Rl(n?"ready":"none"))},Pl=0,Il=0,Ol=()=>{clearTimeout(Il),Il=window.setTimeout(li,400)};mn.addEventListener("toggle",()=>{if(clearInterval(Pl),removeEventListener("scroll",Ol,!0),!mn.open){ri++;return}li(),addEventListener("scroll",Ol,!0),Pl=window.setInterval(()=>{let t=ts.querySelector(".dt-vision-ago");t&&Bo&&ii&&(t.textContent=`snapshot \xB7 ${Bl()}`)},1e3)}),ts.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void li();let n=e.closest("[data-vision]");n&&(No(n.dataset.vision??""),mn.open=!1)});let Rs=ee.querySelector(".dt-custom"),Ro=Rs.querySelector(".dt-custom-sheet"),Dl="dt-hidden-tools",ql="dt-new-seen",Fl=["contrast","vision"],jl=()=>{let t=(o,a,i)=>{let l=ee.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")],n=[...It.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:Pe,name:"Device menu"}];return[...s.client?[]:[{group:"Inspect",tools:e.filter(o=>!!o)}],{group:"Devices",tools:n}]},Wl=t=>(st.getItem(t)??"").split(",").filter(Boolean),gn=new Set(Wl(Dl)),_l=()=>{for(let{tools:e}of jl())for(let n of e)n.el.toggleAttribute("data-off",gn.has(n.id));Object.entries(xe).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&Vt("")},gp=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",zl=()=>{let t=Wl(ql);Ro.innerHTML=jl().map(({group:e,tools:n})=>{let o=n.filter(a=>!gn.has(a.id)).length;return`<p class="dt-custom-label"><b>${e}</b><span>${o} of ${n.length}</span></p><div class="dt-custom-well">${n.map(a=>`<button type="button" class="dt-custom-tile" data-tool="${b(a.id)}" aria-pressed="${!gn.has(a.id)}">${gp(a.el)}<span>${b(a.name)}</span>${Fl.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"${gn.size?"":" disabled"}>Show all</button><span></span><button type="button" class="dt-custom-done">Done</button></div>`};Ro.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){Rs.open=!1;return}e.closest(".dt-custom-all")&&gn.clear();let n=e.closest("[data-tool]");if(n){let o=n.dataset.tool;gn.delete(o)||gn.add(o)}!n&&!e.closest(".dt-custom-all")||(F(Dl,[...gn].join(",")),_l(),zl(),Ro.querySelector(n?`[data-tool="${n.dataset.tool}"]`:".dt-custom-done")?.focus())}),Rs.addEventListener("toggle",()=>{Rs.open?(zl(),Ro.querySelector(".dt-custom-tile")?.focus()):F(ql,Fl.join(","))}),_l(),Ae.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let n=e.dataset.set;if(n==="keys"||n==="back")return si(n==="keys");if(n==="grid")return Hs("grid");Ae.open=!1,n==="custom"&&(Rs.open=!0),n==="hide"&&Qn.click(),n==="out"&&confirm("Sign out of Notemend on this site?")&&(st.removeItem(Zn),Xt.signOut?.())});let Ce=t=>()=>ee.querySelector(t)?.click(),Gl=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(n=>n.hasAttribute("aria-current"))+t]?.click()},Po=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:Ce(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:Ce(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:Ce(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>Pa(!qe)},{group:"Threads",code:"Slash",hint:"/",label:"Search threads",run:()=>{document.querySelector(".dt-history")?.hasAttribute("hidden")&&Ce(".dt-history-btn")(),ot.hasAttribute("data-collapsed")&&$o(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Workspace / clients",run:()=>vs(De==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Xn.hidden||ws(Re.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:Ce(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:Ce(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:Ce(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:Ce(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:Ce(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:Ce(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{mn.open=!mn.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:Ce(".dt-border-btn")},...s.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:Ce(".dt-studio-btn")}]:[],...It.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:()=>{Pe.open=!Pe.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:Gl(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:Gl(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>Qn.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=Ae.open&&!Tl.hidden;Ae.open=!t,si(!t)}}].filter(t=>!s.client||t.group!=="Inspect"),Vl=(t,e)=>Po.find(n=>n.code===t&&!n.shift==!e&&!(n.el&&ee.querySelector(n.el)?.closest("[data-off]"))&&!(n.code==="KeyD"&&Pe.hasAttribute("data-off"))),Ul=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||!!t.closest('[role="menu"], [role="listbox"], [role="dialog"][aria-modal="true"], [role="combobox"]'));if(s.shortcuts){for(let o of Po){let a=o.el&&ee.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>${b(o)}</span><kbd>${b(a)}</kbd></div>`,e=(o,a)=>`<div class="dt-keys-col"><p class="dt-keys-group">${o}</p>${a}</div>`,n=[...new Set(Po.map(o=>o.group))].map(o=>e(o,Po.filter(a=>a.group===o).map(a=>t(a.label,a.hint)).join("")));if(n.push(e("In a comment",t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"))),Ae.querySelector(".dt-keys-list").innerHTML=`<div class="dt-keys-half">${n.slice(0,2).join("")}</div><div class="dt-keys-half">${n.slice(2).join("")}</div>`,document.addEventListener("keydown",o=>{if(o.repeat||o.isComposing||o.metaKey||o.ctrlKey||o.altKey||o.defaultPrevented||Ul(o.composedPath()[0]??o.target))return;let a=Vl(o.code,o.shiftKey);a&&setTimeout(()=>{o.defaultPrevented||(x?parent.postMessage({dt:!0,key:[o.code,o.shiftKey]},location.origin):a.run())})}),x){let o=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",o,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&o()})}}if(!x){Sl(st.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>ee.setAttribute("data-ready",""))),$l.restore(),bt(st.getItem(Lt)==="1");let t=st.getItem(Ye);t&&t in xe&&Vt(t),Te(st.getItem(Hi)==="1"&&mt!=="/connect")}let Kl=()=>{try{let t=JSON.parse(st.getItem(Wn)||"null");me=(t?.parked??[]).filter(n=>is(n));let e=n=>{try{return!!document.querySelector(n)}catch{return!1}};t?.draft&&e(t.draft.selector)?(A=t.draft,!Pt&&!x&&Te(!0)):is(t?.draft)&&me.push(t.draft),t?.reply?.text&&(de=t.reply.text,Oe=U=t.reply.for??null),(A||me.length||de)&&K()}catch{st.removeItem(Wn)}};Kl();let Yl=()=>setTimeout(()=>{let t=q(location.pathname);t!==mt&&(clearTimeout(Ys),ls(),mt=t,x&&parent.postMessage({dt:!0,route:t},location.origin),Wn=Ri(),A=null,me=[],de="",Oe=null,U=null,Ft=null,D=[],Pt&&!x&&Te(!1),ct(),Kl(),za(),An())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...n){e.apply(this,n),Yl()}}addEventListener("popstate",Yl);try{let t=JSON.parse(st.getItem(Zn)||"null");t?.project===Jr&&t.body?(Wa=t.body.version??"",_a(t.body),Es=""):t&&st.removeItem(Zn)}catch{st.removeItem(Zn)}r.then(async t=>{t.status===200&&_a(await t.json(),!c)},()=>{}).then(()=>!c&&(Me||qe)?An(!0):void 0).then(xo.resume),document.addEventListener("visibilitychange",()=>{document.hidden||Cn()}),addEventListener("focus",Cn),addEventListener("notemend:changed",()=>{x||Cn()});let Io=!1,Bn=null,Xl=()=>{if(!(x||Xt.via||!("EventSource"in window))){if(document.hidden){Bn?.close(),Bn=null,Io=!1;return}Bn||(Bn=new EventSource("/__devbar/events"),Bn.onopen=()=>{Io=!0},Bn.onerror=()=>{Io=!1},Bn.onmessage=t=>{t.data!==Es&&Cn()})}};Xl(),document.addEventListener("visibilitychange",Xl);let fp=0;x||setInterval(()=>{(!(Xt.live||Io)||++fp%6===0)&&Cn()},2e4),setInterval(()=>{!document.hidden&&D.some(t=>Ke(t))&&K()},3e4),x&&parent.postMessage({dt:!0,hello:!0},location.origin)}function rc(s){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let r=HTMLDialogElement.prototype,c=r.showModal,m=null,g=null,$=()=>{if(m){g?.disconnect(),g=null;for(let M of s)document.body.append(M);try{m.hidePopover()}catch{}m.remove(),m=null}},T=()=>{$();let M=document.querySelector("dialog:modal");M&&H(M)},H=M=>{$(),m=document.createElement("div"),m.className="dt-host",m.setAttribute("popover","manual"),m.append(...s),M.append(m);try{m.showPopover()}catch{}M.addEventListener("close",T,{once:!0}),g=new MutationObserver(()=>{M.isConnected||T()}),g.observe(document.documentElement,{childList:!0,subtree:!0})};r.showModal=function(){c.call(this),this.isConnected&&H(this)}}function Ci(s,r,c,m=""){let g=document.createElement("div");g.className="nm-ask",g.setAttribute("style",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px","padding:6px 6px 6px 12px","background:#0e0d0c","color:#f2efec","border:1px solid rgba(255,255,255,.09)","border-radius:999px","box-shadow:0 10px 34px rgba(0,0,0,.5)","font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif"].join(";"));let $=document.createElement(s?"a":"span");$ instanceof HTMLAnchorElement&&s&&($.href=s,$.target=c,m&&($.rel=m)),$.className="nm-ask-go",$.textContent=r;let T=document.createElement("style");return T.textContent=`.nm-ask{transition:border-color 120ms cubic-bezier(.22,1,.36,1)}
|
|
313
|
+
.nm-ask:has(a.nm-ask-go:hover){border-color:rgba(255,255,255,.14)!important}
|
|
314
|
+
.nm-ask-go{transition:background-color 120ms cubic-bezier(.22,1,.36,1),transform 120ms cubic-bezier(.22,1,.36,1)}
|
|
315
|
+
a.nm-ask-go:hover{background:#ff7a33!important}
|
|
316
|
+
a.nm-ask-go:active{background:#d94d00!important;transform:translateY(1px)}
|
|
317
|
+
.nm-ask-go:focus-visible{outline:2px solid #ff6a1a;outline-offset:2px}
|
|
318
|
+
@media (prefers-reduced-motion:reduce){.nm-ask,.nm-ask-go{transition:none}}`,$.setAttribute("style",`display:inline-flex;align-items:center;height:28px;padding:0 12px;border-radius:999px;background:${s?"#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:${s?"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,$),document.body.append(g),{pill:g,link:$}}function lc(s){let r=window;if(r.__notemend)return;r.__notemend=!0,Fd(g=>g.includes("/__devbar/")||!!Xt.base&&g.startsWith(Xt.base)),Jt.ready=new Promise(g=>{if(!("__next_f"in self))return g();let $=0,T=()=>Object.keys(document.documentElement).some(H=>H.startsWith("__reactFiber$"))||++$>330?g():setTimeout(T,30);T()}),Jt.toggle("dt-in-frame",Is);let c=id(),m=Qt(c);Bd().then(async g=>{await s,Jt.set("--dt-z",String(g.zIndex));let $=g.client?g.brand?.color:null;if($&&/^#[0-9a-f]{6}$/i.test($)){let[k,x,F]=[1,3,5].map(j=>parseInt($.slice(j,j+2),16)/255);Jt.set("--dt-accent",$),Jt.set("--dt-accent-ink",.2126*k+.7152*x+.0722*F>.55?"#000000":"#ffffff")}Pd(g);let T="",H=()=>{let k=document.body.currentCSSZoom??1,x=k>0&&Math.abs(k-1)>.001?String(1/k):"1";x!==T&&(T=x,Jt.set("--dt-unzoom",x))};H();let M=new MutationObserver(H);for(let k of[document.documentElement,document.body])M.observe(k,{attributes:!0,attributeFilter:["style","class"]});addEventListener("resize",H),ic(g,m,c==="comments"),Xd(),rc([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-tipbox"].map(k=>document.querySelector(k)).filter(k=>!!k))}).catch(g=>{console.warn("[notemend] not started:",g);let $=window.__notemendHosted;Xt.via&&String(g).includes("config 403")&&$?.ask&&(Xt.refused=!0,$.ask("You\u2019re not in this project \u2014 sign in as someone else")),!Xt.via&&String(g).includes("config 401")&&Jp(String(g.said??""))})}function Jp(s){if(/link/i.test(s)&&!/sign in/i.test(s)){Ci(null,"Link this site to comment: npx notemend link <project-id>","");return}let{link:r}=Ci("/__devbar/signin","Sign in to comment","notemend-signin"),c=0;r.addEventListener("click",()=>{clearInterval(c),c=window.setInterval(async()=>{let m=await fetch("/__devbar/signin?code=1").then(g=>g.json()).catch(()=>null);if(m?.done){clearInterval(c),location.reload();return}m?.code&&(r.textContent=`Allow code ${m.code} in the cabinet tab`)},1500)})}lc();import.meta.hot&&import.meta.hot.accept(()=>location.reload());
|