notemend 0.1.26 → 0.1.28
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 +42 -14
- package/bin/init.mjs +15 -15
- package/bin/notemend.mjs +18 -18
- package/bin/step.mjs +2 -0
- package/hooks/hooks.json +3 -0
- package/package.json +1 -1
- package/src/client/index.js +167 -145
- package/src/client/notemend.css +1 -1
- package/src/integration.mjs +1 -1
- package/src/next.mjs +7 -1
- package/src/server/middleware.mjs +7 -1
- 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 +18 -3
- package/thread.d.ts +42 -1
package/src/client/index.js
CHANGED
|
@@ -1,52 +1,62 @@
|
|
|
1
|
-
import"./notemend.css";var Yt={base:"",via:null,signed:{},live:!1,signOut:null};async function At(s,i={}){if(i.method&&i.method!=="GET"&&typeof i.body=="string"&&i.body.length<6e4&&i.keepalive===void 0&&(i={...i,keepalive:!0}),!Yt.via)return fetch(`/__devbar/${s}`,i);let d=await Yt.via(s,i);if(d.ok&&s.startsWith("comments")&&(i.method??"GET")==="GET"){let h=await d.clone().json().catch(()=>null);h?.signed&&Object.assign(Yt.signed,h.signed)}return d}var Ei=s=>Yt.via?Yt.signed[s]??"":`/__devbar/image?name=${encodeURIComponent(s)}`,ys=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),ot={getItem:s=>{try{return localStorage.getItem(s)}catch{return null}},setItem:(s,i)=>{try{localStorage.setItem(s,i)}catch{}},removeItem:s=>{try{localStorage.removeItem(s)}catch{}}};async function Mi(){let s=await At("config");if(!s.ok)throw new Error(`config ${s.status}`);let i=await s.json();return i.breakpoints=i.breakpoints.map(d=>({...d,max:d.max??1/0})),i}var ki=["iPhone","Android","Foldable","Tablet","Laptop & display"],On=[{id:"iphone-se",label:"iPhone SE",group:"iPhone",w:375,h:667,dpr:2,rotates:!0,mobile:!0},{id:"iphone-xr",label:"iPhone XR",group:"iPhone",w:414,h:896,dpr:2,rotates:!0,mobile:!0,insets:{left:0,top:44,right:0,bottom:34},cutout:{shape:"notch",x:92,y:0,width:231,height:33,"upper-radius":6,"lower-radius":25}},{id:"iphone-12-pro",label:"iPhone 12 Pro",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:90,y:0,width:210,height:32,"upper-radius":6,"lower-radius":23}},{id:"iphone-14",label:"iPhone 14",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-plus",label:"iPhone 14 Plus",group:"iPhone",w:428,h:926,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:133,y:0,width:161,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-pro",label:"iPhone 14 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-14-pro-max",label:"iPhone 14 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15",label:"iPhone 15",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-plus",label:"iPhone 15 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro",label:"iPhone 15 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16e",label:"iPhone 16e",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-16",label:"iPhone 16",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-plus",label:"iPhone 16 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro",label:"iPhone 16 Pro",group:"iPhone",w:402,h:874,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:139,y:14,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro-max",label:"iPhone 16 Pro Max",group:"iPhone",w:440,h:956,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:158,y:14,width:125,height:37,"border-radius":19}},{id:"jiophone-2",label:"JioPhone 2",group:"Android",w:240,h:320,dpr:1,rotates:!0,mobile:!0},{id:"pixel-7",label:"Pixel 7",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:52,right:0,bottom:0},cutout:{shape:"circle",x:183,y:0,width:55,height:52,cx:206,cy:26,radius:13}},{id:"pixel-8",label:"Pixel 8",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:182,y:0,width:46,height:50,cx:206,cy:25,radius:14}},{id:"pixel-8-pro",label:"Pixel 8 Pro",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:37,height:50,cx:224,cy:25,radius:14}},{id:"pixel-8a",label:"Pixel 8a",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:46,right:0,bottom:0},cutout:{shape:"circle",x:185,y:0,width:42,height:46,cx:206,cy:26,radius:13}},{id:"pixel-9",label:"Pixel 9",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"pixel-9-pro",label:"Pixel 9 Pro",group:"Android",w:427,h:952,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:68,right:0,bottom:0},cutout:{shape:"circle",x:195,y:0,width:36,height:68,cx:213,cy:34,radius:16}},{id:"pixel-9-pro-xl",label:"Pixel 9 Pro XL",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:66,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:38,height:66,cx:224,cy:33,radius:16}},{id:"pixel-10",label:"Pixel 10",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"samsung-galaxy-s8",label:"Samsung Galaxy S8+",group:"Android",w:360,h:740,dpr:4,rotates:!0,mobile:!0},{id:"samsung-galaxy-a55",label:"Samsung Galaxy A55",group:"Android",w:360,h:800,dpr:2.25,rotates:!0,mobile:!0},{id:"samsung-galaxy-s20-ultra",label:"Samsung Galaxy S20 Ultra",group:"Android",w:412,h:915,dpr:3.5,rotates:!0,mobile:!0},{id:"samsung-galaxy-a51-71",label:"Samsung Galaxy A51/71",group:"Android",w:412,h:914,dpr:2.625,rotates:!0,mobile:!0},{id:"facebook-on-android",label:"Facebook on Android",group:"Android",w:412,h:892,dpr:3.5,rotates:!0,mobile:!0},{id:"moto-g4",label:"Moto G4",group:"Android",w:360,h:640,dpr:3,rotates:!0,mobile:!0},{id:"moto-g-power",label:"Moto G Power",group:"Android",w:412,h:823,dpr:1.75,rotates:!0,mobile:!0},{id:"surface-duo",label:"Surface Duo",group:"Foldable",w:540,h:720,dpr:2.5,rotates:!0,mobile:!0},{id:"pixel-9-pro-fold",label:"Pixel 9 Pro Fold",group:"Foldable",w:412,h:922,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-6",label:"Galaxy Z Fold 6",group:"Foldable",w:412,h:968,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-5",label:"Galaxy Z Fold 5",group:"Foldable",w:344,h:882,dpr:2.625,rotates:!0,mobile:!0},{id:"asus-zenbook-fold",label:"Asus Zenbook Fold",group:"Foldable",w:853,h:1280,dpr:1.5,rotates:!0,mobile:!1},{id:"ipad-mini",label:"iPad Mini",group:"Tablet",w:768,h:1024,dpr:2,rotates:!0,mobile:!0},{id:"ipad-pro-13",label:"iPad Pro 13",group:"Tablet",w:1032,h:1376,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-7",label:"Surface Pro 7",group:"Tablet",w:912,h:1368,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-10",label:"Surface Pro 10",group:"Tablet",w:960,h:1440,dpr:2,rotates:!0,mobile:!0},{id:"galaxy-tab-s4",label:"Galaxy Tab S4",group:"Tablet",w:712,h:1138,dpr:2.25,rotates:!0,mobile:!0},{id:"nest-hub-max",label:"Nest Hub Max",group:"Laptop & display",w:1280,h:800,dpr:2,rotates:!1,mobile:!0},{id:"laptop-with-touch",label:"Laptop with touch",group:"Laptop & display",w:1280,h:950,dpr:1,rotates:!1,mobile:!1},{id:"laptop-with-hidpi-screen",label:"Laptop with HiDPI screen",group:"Laptop & display",w:1440,h:900,dpr:2,rotates:!1,mobile:!1},{id:"laptop-with-mdpi-screen",label:"Laptop with MDPI screen",group:"Laptop & display",w:1280,h:800,dpr:1,rotates:!1,mobile:!1}];var Wl=s=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(s))?.[1]??null;var Dn={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},ko=/^(exe|msi|msp|dmg|pkg|mpkg|app|sh|bash|zsh|command|bat|cmd|com|scr|cpl|ps1|psm1|vbs|vbe|js[e]?|wsf|wsh|hta|jar|apk|ipa|deb|rpm|bin|run|reg|lnk|inf|gadget|appimage)$/i,_l=/^(png|jpe?g|webp|gif|webm)$/i,zl=[["PDF","#e5484d","pdf"],["DOC","#0d99ff","doc docx rtf odt pages"],["XLS","#30a46c","xls xlsx csv tsv numbers ods"],["PPT","#f76b15","ppt pptx key odp"],["ZIP","#ffb224","zip rar 7z tar gz tgz bz2"],["FIG","#7c6cf2","fig sketch psd ai xd indd eps"],["TXT","#12a594","txt md json html htm css ts tsx jsx xml yml yaml svg log"],["MP3","#d6409f","mp3 wav m4a ogg flac aac"],["MP4","#e93d82","mp4 mov avi mkv m4v"]],Si=s=>{let i=String(s??"").split(".").pop().toLowerCase(),d=zl.find(([,,h])=>h.split(" ").includes(i));return d?{label:d[0],color:d[1]}:{label:"FILE",color:"#717171"}},Lo=s=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(s??"").split("?")[0]),Vl=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((s,i)=>[s,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][i]])),Ti=s=>String(s??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,i=>Vl[i]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),Ai=s=>{let i=/\.([a-z0-9]{1,8})$/i.exec(String(s??""));return i&&!ko.test(i[1])?i[1].toLowerCase():""},qn=s=>{let i=String(s??"");if(i.startsWith("data:")){let m=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(i);if(!m)return null;let v=/;ext=([a-z0-9]{1,8})/i.exec(m[2])?.[1]?.toLowerCase()??Object.keys(Dn).find(S=>Dn[S]===m[1]);return v?`${/;name=([\w-]+)/.exec(m[2])?.[1]||"document"}.${v}`:null}let d=i.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(d))return null;let h=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(d);return h&&!_l.test(h[2])?`${h[1]||"document"}.${h[2].toLowerCase()}`:null},Oe=s=>{let i=[{author:"you",text:s.text,at:s.createdAt,by:s.by,byName:s.byName,images:[],...s.reactions?{reactions:s.reactions}:{}},...s.note?[{author:"claude",text:s.note,at:s.updatedAt,images:[]}]:[],...(s.replies||[]).map(d=>({...d,images:[]}))];for(let d of s.images||[]){if(Wl(d))continue;let h=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(d)?.[1]),m=0;i.forEach((v,S)=>{Date.parse(v.at)<=h&&(m=S)}),i[m].images.push(d)}return i.filter(d=>!d.deleted)},Ci=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],Hi=["\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u{1F44C}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4AF}","\u{1F680}","\u{1F600}","\u{1F602}","\u{1F60A}","\u{1F60D}","\u{1F914}","\u{1F605}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62E}","\u{1F648}","\u{1F92F}","\u{1F62C}","\u{1F643}","\u{1F440}","\u{1F4A1}","\u{1F4CC}","\u{1F41B}","\u{1F3A8}","\u2615"];var Ul=20,Bi=(s,i,d)=>{let h={...s||{}},m=h[i]||[];if(!m.length&&Object.keys(h).length>=Ul)return null;let v=m.includes(d)?m.filter(S=>S!==d):[...m,d];return v.length?h[i]=v:delete h[i],Object.keys(h).length?h:void 0},Ni=s=>s.nickname||s.name||s.email,Kl=(s,i)=>{let d="@"+i.toLowerCase(),h=-1;for(let m=s.indexOf(d);m!==-1;m=s.indexOf(d,m+1))/[\p{L}\p{N}_.-]/u.test(s[m+d.length]??"")||(h=m);return h};var Gl=/https?:\/\/[^\s<>"']+/g,Li=s=>{let i=s.filter(Boolean).pop();try{return i?decodeURIComponent(i):""}catch{return i}},Yl=s=>{let i;try{i=new URL(s)}catch{return{label:String(s),kind:"link"}}let d=i.hostname.replace(/^www\./,""),h=i.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(d))return{label:h[2]?`Figma \xB7 ${Li([h[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(d==="github.com"&&h.length){let[v,S,H,b]=h;return{label:`GitHub \xB7 ${S??v}${/^(pull|issues)$/.test(H??"")&&b?` #${b}`:""}`,kind:H==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(d))return{label:"Loom",kind:"link"};let m=Li(h);return{label:m?`${d} \xB7 ${m.length>32?m.slice(0,31)+"\u2026":m}`:d,kind:"link"}},So=s=>{let i=String(s??""),d=[],h=0;for(let m of i.matchAll(Gl)){let v=m[0].replace(/[.,;:!?)\]]+$/,"");m.index>h&&d.push(i.slice(h,m.index)),d.push({url:v,...Yl(v)}),h=m.index+v.length}return h<i.length&&d.push(i.slice(h)),d},Ri=s=>So(s).map(i=>typeof i=="string"?i:i.label).join(""),Xl={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},fn=s=>Xl[s]||(s?"AI agent":"Claude"),vs="3.6 3.6 10.8 10.8",ws="M10.116 9H13.883M9.966 9.558L12.222 10.86M9.558 9.966L11.441 13.228M9 10.116V12.72M8.442 9.966L6.559 13.228M8.034 9.558L5.778 10.86M7.884 9H4.118M8.034 8.442L5.778 7.14M8.442 8.034L6.559 4.772M9 7.884V5.28M9.558 8.034L11.441 4.772M9.966 8.442L12.222 7.14",$s=s=>typeof s=="string"&&s.startsWith("agent:")?s.slice(6):null,kt=s=>s==="claude"||$s(s)!=null;var Jl=["new","approved","progress","review","waiting"],Xt=s=>Jl.includes(s?.stage)?s.stage:s?.stage==="accepted"?"review":kt(s?.assignee)?"approved":"new",$t=s=>s?.client===!0||s?.shared===!0;var xs=()=>[{assignee:"claude",handle:"Claude",owner:null}],To=(s,i=[])=>{let d=String(s||"").toLowerCase(),h=null,m=-1;for(let v of xs()){let S=Kl(d,v.handle);S>m&&(m=S,h=v.assignee)}return h};var Zl=2*36e5,De=(s,i=Date.now())=>s?.working&&s.status!=="done"&&i-Date.parse(s.working.at)<Zl?s.working:null,Es=(s,i,d=Date.now())=>{let h=String(s?.by||s?.byName||"").toLowerCase();if(!h||i==="done")return null;let m=i==="claude"||kt(s.assignee),v=Ms(s)?"":m?De(s,d)?.by||s.doneFor||s.handedBy||$s(s.assignee)||h:s.assignee||"";return{writer:h,taker:String(v).toLowerCase(),claude:m}},Ql=s=>/@guest\.notemend\.com$/i.test(String(s||"")),Ms=s=>Ql(s.by)&&!s.approvedBy,ne=(s,i=Date.now())=>{if(!s)return null;if(s.status==="done")return s.doneBy==="claude"?"review":kt(s.assignee)?"done":null;if(Ms(s))return"held";if(!kt(s.assignee))return null;let d=Oe(s),h=d[d.length-1];return d.length>1&&h.author==="claude"&&!(s.reopenedAt&&Date.parse(s.reopenedAt)>=Date.parse(h.at))?"asks":De(s,i)?"working":s.working?"stuck":Xt(s)==="approved"?"queued":null};var Pi=ws.split("M").filter(Boolean).map(s=>{let i=s.match(/[\d.]+/g).map(Number),[d,h]=/H/.test(s)?[i[2],i[1]]:/V/.test(s)?[i[0],i[2]]:[i[2],i[3]];return{d:"M"+s,a:(Math.atan2(d-9,9-h)+2*Math.PI)%(2*Math.PI)}}).sort((s,i)=>s.a-i.a).map(s=>s.d);var Ii=(s,i)=>{if(s.archivedAt)return!0;if(!i||s.status!=="done"||s.doneBy==="claude")return!1;let d=Math.max(Date.parse(s.confirmedAt||s.updatedAt||"")||0,...(s.replies||[]).filter(h=>!h.deleted).map(h=>Date.parse(h.at||"")||0));return!!d&&Date.now()-d>i*864e5};var g=s=>s.replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]),Je=s=>s?new Date(s).toLocaleString(void 0,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Ze='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M8 6V4.2h4V6M6.6 6l.55 9.8h5.7L13.4 6"/></svg>',qt='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.8 10.4 8.2 13.8l7-7.6" stroke-linejoin="round"/></svg>',Fn='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M12.6 4.4l3 3-8.4 8.4H4.2v-3z" stroke-linejoin="round"/></svg>',qe='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.4 5.4l9.2 9.2M14.6 5.4l-9.2 9.2"/></svg>',Oi='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M12 5l-5 5 5 5" stroke-linejoin="round"/></svg>',Di='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',Ae='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.5 8.5h7.5a3.5 3.5 0 0 1 0 7H8.5M7.5 5.5l-3 3 3 3" stroke-linejoin="round"/></svg>',zt=s=>`<svg viewBox="${vs}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude"><path d="${ws}" stroke-width="1.15" stroke-linecap="round"/></svg>`,Ao=(s,i)=>`<svg viewBox="${vs}" width="${s}" height="${s}" aria-hidden="true" class="dt-claude dt-claude--fill">${Pi.map((d,h)=>`<path d="${d}" stroke-width="1.15" stroke-linecap="round"${h<i?"":' class="is-off"'}/>`).join("")}</svg>`,yt=(s,i=15)=>`<svg viewBox="0 0 20 20" width="${i}" height="${i}" aria-hidden="true">${s}</svg>`;function qi(s){let i=location.pathname.replace(/\/$/,"")||"/",d=s.client?' style="display:none"':"",h=s.breakpoints.map(y=>["new","progress","review","waiting","done"].map(B=>`<b data-bp="${g(y.id)}" data-state="${B}" hidden>${yt(y.icon,11)}<i></i></b>`).join("")).join(""),m=s.groups.map(y=>`<li class="dt-pages-group">${g(y)}</li>`+s.pages.filter(B=>B.group===y).map(B=>`<li><a href="${/^\/(?![\/\\])/.test(B.route)?g(B.route):"#"}"${B.route===i?' aria-current="page"':""}><span class="dt-menu-label">${g(B.label)}</span><em class="dt-pages-n" hidden>${h}</em></a></li>`).join("")).join(""),v=[...new Set(s.devices.map(y=>y.group))].map(y=>`<p class="dt-devices-group">${g(y)}</p>`+s.devices.filter(B=>B.group===y).map(B=>`<button type="button" data-device="${g(B.id)}" aria-pressed="false"${B.note?` title="${g(B.note)}"`:""}><span class="dt-menu-label">${g(B.label)}</span><em>${B.w}×${B.h}</em></button>`).join("")).join(""),S=ki.map(y=>`<p class="dt-devices-group">${g(y)}</p>`+On.filter(B=>B.group===y).map(B=>`<button type="button" data-emu="${g(B.id)}" aria-pressed="false"><span class="dt-menu-label">${g(B.label)}</span><em>${B.w}×${B.h}</em></button>`).join("")).join(""),H=s.breakpoints.map(y=>`<button class="dt-icon dt-bp" type="button" data-bp="${g(y.id)}" aria-pressed="false" title="${g(y.label)}">${yt(y.icon,16)}</button>`).join(""),b=Array.from({length:s.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),k="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
1
|
+
import"./notemend.css";var _t={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function zt(o,r={}){if(r.method&&r.method!=="GET"&&typeof r.body=="string"&&r.body.length<8e3&&r.keepalive===void 0&&(r={...r,keepalive:!0}),!_t.via){let h=window.__notemendEarly,m=!r.method||r.method==="GET"?h?.[o]:void 0;if(m){delete h[o];let y=await m;if(y)return y}return fetch(`/__devbar/${o}`,r)}let c=await _t.via(o,r);if(c.ok&&o.startsWith("comments")&&(r.method??"GET")==="GET"){let h=await c.json().catch(()=>{});h?.signed&&Object.assign(_t.signed,h.signed),c.json=()=>h===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(h)}return c}var Rl=o=>_t.via?_t.signed[o]??"":`/__devbar/image?name=${encodeURIComponent(o)}`,Ts=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),ot={getItem:o=>{try{return localStorage.getItem(o)}catch{return null}},setItem:(o,r)=>{try{localStorage.setItem(o,r)}catch{}},removeItem:o=>{try{localStorage.removeItem(o)}catch{}}},Pl=()=>ot.getItem("dt-resolved")==="0"&&ot.getItem("dt-archived")!=="1"?"comments?open=1":"comments";async function Il(){let o=await zt("config");if(!o.ok)throw new Error(`config ${o.status}`);let r=await o.json();return r.breakpoints=r.breakpoints.map(c=>({...c,max:c.max??1/0})),r}var Ol=["iPhone","Android","Foldable","Tablet","Laptop & display"],Cs=[{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 Au=o=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(o))?.[1]??null;var As={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},Ya=/^(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,Hu=/^(png|jpe?g|webp|gif|webm)$/i,So=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,Zt=(o,r)=>{let c=String(o??"");if(c.length<=r)return c;let h="";if(So)for(let{segment:m}of So.segment(c)){if(h.length+m.length>r)break;h+=m}else for(let m of c){if(h.length+m.length>r)break;h+=m}return h},Nu=[["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"]],Fl=o=>{let r=String(o??"").split(".").pop().toLowerCase(),c=Nu.find(([,,h])=>h.split(" ").includes(r));return c?{label:c[0],color:c[1]}:{label:"FILE",color:"#717171"}},Xa=o=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(o??"").split("?")[0]),Bu=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((o,r)=>[o,["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]])),jl=o=>String(o??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,r=>Bu[r]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),Wl=o=>{let r=/\.([a-z0-9]{1,8})$/i.exec(String(o??""));return r&&!Ya.test(r[1])?r[1].toLowerCase():""};var Hs=o=>{let r=String(o??"");if(r.startsWith("data:")){let m=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(r);if(!m)return null;let y=/;ext=([a-z0-9]{1,8})/i.exec(m[2])?.[1]?.toLowerCase()??Object.keys(As).find(L=>As[L]===m[1]);return y?`${/;name=([\w-]+)/.exec(m[2])?.[1]||"document"}.${y}`:null}let c=r.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(c))return null;let h=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(c);return h&&!Hu.test(h[2])?`${h[1]||"document"}.${h[2].toLowerCase()}`:null},mn=o=>{let r=[{author:"you",text:o.text,at:o.createdAt,by:o.by,byName:o.byName,images:[],...o.reactions?{reactions:o.reactions}:{}},...o.note?[{author:"claude",text:o.note,at:o.updatedAt,images:[]}]:[],...(o.replies||[]).map(c=>({...c,images:[]}))];for(let c of o.images||[]){if(Au(c))continue;let h=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(c)?.[1]?.slice(0,13)),m=0;r.forEach((y,L)=>{Date.parse(y.at)<=h&&(m=L)}),r[m].images.push(c)}return r.filter(c=>!c.deleted)},_l=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],zl=["\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 Ru=20,Gl=(o,r,c)=>{let h={...o||{}},m=h[r]||[];if(!m.length&&Object.keys(h).length>=Ru)return null;let y=m.includes(c)?m.filter(L=>L!==c):[...m,c];return y.length?h[r]=y:delete h[r],Object.keys(h).length?h:void 0},Vl=o=>o.nickname||o.name||o.email,Ja="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",Pu=new RegExp("^"+Ja,"u"),Iu=(o,r)=>{let c="@"+r.toLowerCase(),h=-1;for(let m=o.indexOf(c);m!==-1;m=o.indexOf(c,m+1))Pu.test(o.slice(m+c.length))&&(h=m);return h};var Ou=/https?:\/\/[^\s<>"']+/g,Dl=o=>{let r=o.filter(Boolean).pop();try{return r?decodeURIComponent(r):""}catch{return r}},Du=o=>{let r;try{r=new URL(o)}catch{return{label:String(o),kind:"link"}}let c=r.hostname.replace(/^www\./,""),h=r.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(c))return{label:h[2]?`Figma \xB7 ${Dl([h[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(c==="github.com"&&h.length){let[y,L,H,$]=h;return{label:`GitHub \xB7 ${L??y}${/^(pull|issues)$/.test(H??"")&&$?` #${$}`:""}`,kind:H==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(c))return{label:"Loom",kind:"link"};let m=Dl(h);return{label:m?`${c} \xB7 ${m.length>32?Zt(m,31)+"\u2026":m}`:c,kind:"link"}},Za=o=>{let r=String(o??""),c=[],h=0;for(let m of r.matchAll(Ou)){let y=m[0].replace(/[.,;:!?)\]]+$/,"");m.index>h&&c.push(r.slice(h,m.index)),c.push({url:y,...Du(y)}),h=m.index+y.length}return h<r.length&&c.push(r.slice(h)),c},Ul=o=>Za(o).map(r=>typeof r=="string"?r:r.label).join(""),qu={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},Ue=o=>qu[o]||(o?"AI agent":"Claude"),To="3.6 3.6 10.8 10.8",Co="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",Kl=o=>typeof o=="string"&&o.startsWith("agent:")?o.slice(6):null,Tt=o=>o==="claude"||Kl(o)!=null;var Fu=["new","approved","progress","review","waiting"],fe=o=>Fu.includes(o?.stage)?o.stage:o?.stage==="accepted"?"review":Tt(o?.assignee)?"approved":"new",Lt=o=>o?.client===!0||o?.shared===!0,Yl=(o,r,c="")=>`Duplicated from ${c?c==="you"?"your":`${c}\u2019s`:"a"} ${(r?Lt(r):!Lt(o))?"client":"studio"} thread`,Xl=o=>Lt(o)?"Duplicated for the client":"Duplicated to the workspace",Jl="Fixed \u2014 please check.",Zl=o=>o?.status==="done"&&!Lt(o)&&Number.isInteger(o.from?.id)?o.from.id:null;var Ao=()=>[{assignee:"claude",handle:"Claude",owner:null}],Qa=(o,r=[])=>{let c=String(o||"").toLowerCase(),h=null,m=-1;for(let y of Ao()){let L=Iu(c,y.handle);L>m&&(m=L,h=y.assignee)}return h};var ju=2*36e5,Ke=(o,r=Date.now())=>o?.working&&o.status!=="done"&&r-Date.parse(o.working.at)<ju?o.working:null;var Ho=(o,r,c=Date.now())=>{let h=String(o?.by||o?.byName||"").toLowerCase();if(!h||r==="done")return null;let m=r==="claude"||Tt(o.assignee),y=No(o)?"":m?Ke(o,c)?.by||o.doneFor||o.handedBy||Kl(o.assignee)||h:o.assignee||"";return{writer:h,taker:String(y).toLowerCase(),claude:m}},Wu=o=>/@guest\.notemend\.com$/i.test(String(o||"")),No=o=>Wu(o.by)&&!o.approvedBy,Ut=(o,r=Date.now())=>{if(!o)return null;if(o.status==="done")return o.doneBy==="claude"?"review":Tt(o.assignee)?"done":null;if(No(o))return"held";if(!Tt(o.assignee))return null;let c=mn(o),h=c[c.length-1],m=Ke(o,r);return c.length>1&&h.author==="claude"&&!(o.reopenedAt&&Date.parse(o.reopenedAt)>=Date.parse(h.at))&&(!m||String(h.text??"").includes("?"))?"asks":m?m.step&&r-Date.parse(m.at)>_u?"stuck":"working":o.working?"stuck":fe(o)==="approved"?"queued":null},_u=10*6e4,ql=(o,r=Date.now())=>{let c=Math.floor((r-Date.parse(o??""))/6e4);return c>=1?c<60?`${c} min`:`${Math.floor(c/60)} h`:"now"},Bo=(o,r=31)=>{let c=So?[...So.segment(String(o??""))].map(y=>y.segment):[...String(o??"")];if(c.length<=r)return c.join("");let h=c.join("").match(/\.\w{1,8}$/)?.[0],m=h?h.length+3:0;return c.slice(0,r-1-m).join("")+"\u2026"+(m?c.slice(-m).join(""):"")},Ro=(o,r=Date.now())=>{let c=o?.status!=="done"?o?.working:null;return c?.at?{step:c.step?String(c.step):null,elapsed:ql(c.since??c.at,r),silent:ql(c.at,r),stale:!Ke(o,r)}:null};var Ql=Co.split("M").filter(Boolean).map(o=>{let r=o.match(/[\d.]+/g).map(Number),[c,h]=/H/.test(o)?[r[2],r[1]]:/V/.test(o)?[r[0],r[2]]:[r[2],r[3]];return{d:"M"+o,a:(Math.atan2(c-9,9-h)+2*Math.PI)%(2*Math.PI)}}).sort((o,r)=>o.a-r.a).map(o=>o.d);var td=(o,r)=>{if(o.archivedAt)return!0;if(!r||o.status!=="done"||o.doneBy==="claude")return!1;let c=Math.max(Date.parse(o.confirmedAt||o.updatedAt||"")||0,...(o.replies||[]).filter(h=>!h.deleted).map(h=>Date.parse(h.at||"")||0));return!!c&&Date.now()-c>r*864e5};var f=o=>o.replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r]),An=o=>o?new Date(o).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",Po=(o,r=c=>new Date(c).toLocaleDateString("en",{day:"numeric",month:"short"}))=>new Date(o).toDateString()===new Date().toDateString()?new Date(o).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):r(o),Hn='<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>',be='<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>',Qn='<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>',gn='<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>',fn='<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>',Io='<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>',Oo='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8 5l5 5-5 5" stroke-linejoin="round"/></svg>',bn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.5 8.5h7.5a3.5 3.5 0 0 1 0 7H8.5M7.5 5.5l-3 3 3 3" stroke-linejoin="round"/></svg>',de=o=>`<svg viewBox="${To}" width="${o}" height="${o}" aria-hidden="true" class="dt-claude"><path d="${Co}" stroke-width="1.15" stroke-linecap="round"/></svg>`,ti=(o,r)=>`<svg viewBox="${To}" width="${o}" height="${o}" aria-hidden="true" class="dt-claude dt-claude--fill">${Ql.map((c,h)=>`<path d="${c}" stroke-width="1.15" stroke-linecap="round"${h<r?"":' class="is-off"'}/>`).join("")}</svg>`,gt=(o,r=15)=>`<svg viewBox="0 0 20 20" width="${r}" height="${r}" aria-hidden="true">${o}</svg>`;function ed(o){let r=location.pathname.replace(/\/$/,"")||"/",c=o.client?' style="display:none"':"",h=o.breakpoints.map(_=>["new","progress","review","waiting","done"].map(D=>`<b data-bp="${f(_.id)}" data-state="${D}" hidden>${gt(_.icon,11)}<i></i></b>`).join("")).join(""),m=o.groups.map(_=>`<li class="dt-pages-group">${f(_)}</li>`+o.pages.filter(D=>D.group===_).map(D=>`<li><a href="${/^\/(?![\/\\])/.test(D.route)?f(D.route):"#"}"${D.route===r?' aria-current="page"':""}><span class="dt-menu-label">${f(D.label)}</span><em class="dt-pages-n" hidden>${h}</em></a></li>`).join("")).join(""),y=[...new Set(o.devices.map(_=>_.group))].map(_=>`<p class="dt-devices-group">${f(_)}</p>`+o.devices.filter(D=>D.group===_).map(D=>`<button type="button" data-device="${f(D.id)}" aria-pressed="false"${D.note?` title="${f(D.note)}"`:""}><span class="dt-menu-label">${f(D.label)}</span><em>${D.w}×${D.h}</em></button>`).join("")).join(""),L=Ol.map(_=>`<p class="dt-devices-group">${f(_)}</p>`+Cs.filter(D=>D.group===_).map(D=>`<button type="button" data-emu="${f(D.id)}" aria-pressed="false"><span class="dt-menu-label">${f(D.label)}</span><em>${D.w}×${D.h}</em></button>`).join("")).join(""),H=o.breakpoints.map(_=>`<button class="dt-icon dt-bp" type="button" data-bp="${f(_.id)}" aria-pressed="false" title="${f(_.label)}">${gt(_.icon,16)}</button>`).join(""),$="Real screens, the browser around the page. A thread goes to its width\u2019s breakpoint.",E="The page at the device\u2019s size. A thread goes to its breakpoint.",x=Array.from({length:o.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),q="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
2
2
|
<!-- One bar, bottom-centre: pages | inspectors | comments | breakpoints \xB7 devices. -->
|
|
3
3
|
<div class="devtools">
|
|
4
|
-
${
|
|
4
|
+
${o.client&&o.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(o.brand.logo)?`<img class="dt-brand" src="${f(o.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
|
+
${gt('<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">${f(r)}</span>
|
|
10
10
|
</summary>
|
|
11
11
|
<ul>${m}</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
|
+
${gt('<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
|
+
${gt('<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
|
+
${gt('<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
|
+
${gt('<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
|
+
${gt('<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
|
+
${gt('<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
|
+
${gt('<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
|
+
${gt('<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"${o.sanity?"":" hidden"}>
|
|
45
|
+
${gt('<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
|
+
${gt('<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
|
+
${gt('<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
|
+
${gt('<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 Yt={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
|
+
${gt('<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="${$}" data-tip="${$}">Preview</button>
|
|
74
|
+
<button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${E}" data-tip="${E}">DevTools</button>
|
|
65
75
|
</div>
|
|
66
76
|
<div class="dt-menu-panel" role="tabpanel" data-panel="preview">
|
|
67
|
-
|
|
68
|
-
${v}
|
|
77
|
+
${y}
|
|
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
|
+
${L}
|
|
74
82
|
</div>
|
|
75
83
|
</div>
|
|
76
84
|
</details>
|
|
@@ -78,50 +86,56 @@ import"./notemend.css";var Yt={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
|
+
${gt('<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
|
+
${o.me?.email?`<p class="dt-set-who">Signed in as<b>${f(o.me.email)}</b></p><hr>`:""}
|
|
94
|
+
${o.client?"":`<button type="button" data-set="grid">${gt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />',14)}<span>Grid</span><em class="dt-set-hint">Auto</em>${gt('<path d="M8 5l5 5-5 5" />',12)}</button>`}
|
|
95
|
+
<button type="button" data-set="custom">${gt('<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"${o.shortcuts?"":" hidden"}>${gt('<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">${gt('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${o.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>${gt('<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">${gt('<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 Claude"><svg viewBox="${
|
|
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${o.client?' style="display:none"':""}>
|
|
131
|
+
<button class="dt-push-all" type="button" aria-label="Push to Claude"><svg viewBox="${To}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${Co}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
|
|
118
132
|
>
|
|
119
133
|
<div class="dt-push-menu" hidden role="dialog" aria-label="What goes to Claude"></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"${o.client?" hidden":""}>
|
|
138
|
+
<span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${gt('<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 Yt={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="${q}"></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="${q}"></span>
|
|
144
158
|
</div>
|
|
145
159
|
<div class="dt-ruler"></div>
|
|
146
160
|
<span class="dt-frame-size"></span>
|
|
@@ -152,138 +166,146 @@ import"./notemend.css";var Yt={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">${gt('<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">${gt('<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="${f(o.grid.container)} dt-overlay-container" aria-hidden="true">
|
|
180
|
+
<div class="${f(o.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 Fi=[{id:"general",label:"General",color:"#0d99ff",icon:'<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect x="3" y="14" width="7" height="7" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/>'},{id:"bug",label:"Bug",color:"#e5484d",icon:'<path d="m8 2 1.88 1.88M14.12 3.88 16 2M9 7.13v-1a3 3 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6M12 20v-9M6.53 9C4.6 8.8 3 7.1 3 5M6 13H2M3 21c0-2.1 1.7-3.9 3.8-4M20.97 5c0 2.1-1.6 3.8-3.5 4M22 13h-4M17.2 17c2.1.1 3.8 1.9 3.8 4"/>'},{id:"text",label:"Text",color:"#f5c451",icon:'<path d="M4 7V4h16v3M9 20h6M12 4v16"/>'},{id:"motion",label:"Motion",color:"#a475f9",icon:'<path d="M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2M9.6 4.6A2 2 0 1 1 11 8H2M12.6 19.4A2 2 0 1 0 14 16H2"/>'},{id:"design",label:"Design",color:"#d6409f",icon:'<path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.97 6.01 17.46 2 12 2z"/><circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/>'},{id:"content",label:"Content",color:"#30a46c",icon:'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4M10 9H8M16 13H8M16 17H8"/>'}],bn=(s,i=14)=>`<svg viewBox="0 0 24 24" width="${i}" height="${i}" fill="none" stroke="${s.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${s.icon}</svg>`,Qe=s=>Fi.find(i=>i.id===s)||Fi[0];var ht=s=>s.status!=="done"?"open":s.doneBy==="claude"?"claude":"done",ji={open:"Open",done:"Resolved",claude:"To check"};var Ft={ready:Promise.resolve(),toggle:(s,i)=>{Ft.ready.then(()=>document.documentElement.classList.toggle(s,i))},set:(s,i)=>{Ft.ready.then(()=>document.documentElement.style.setProperty(s,i))}};var td=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Wi=s=>String(s??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(td,"$1\u2022\u2022\u2022").replace(/\b(Bearer|Basic|Token)\s+[\w.~+/=-]+/gi,"$1 \u2022\u2022\u2022").replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/g,"\u2022\u2022\u2022");var ks=[],Co=s=>{if(s instanceof Error)return`${s.name}: ${s.message}`;if(typeof s=="string")return s;try{return JSON.stringify(s)??String(s)}catch{return String(s)}},tn=(s,i)=>{ks.push({at:new Date().toISOString(),kind:s,text:Wi(i.replace(/\s+/g," ").trim()).slice(0,500)}),ks.length>50&&ks.shift()},_i=!1;function zi(s){if(_i||typeof window>"u")return;_i=!0;let i=console.error;console.error=(...m)=>{tn("console",m.map(Co).join(" ")),i.apply(console,m)},addEventListener("error",m=>{if(m instanceof ErrorEvent)return tn("error",`${m.message}${m.filename?` (${m.filename}:${m.lineno})`:""}`);let v=m.target,S=v?.src||v?.href;S&&!s(S)&&tn("network",`${v.tagName?.toLowerCase()} ${S} did not load`)},!0),addEventListener("unhandledrejection",m=>tn("rejection",Co(m.reason)));let d=window.fetch;window.fetch=async(m,v)=>{let S=typeof m=="string"?m:m instanceof URL?m.href:m.url,H=(v?.method||(m instanceof Request?m.method:"GET")).toUpperCase();try{let b=await d.call(window,m,v);return b.status>=400&&!s(S)&&tn("network",`${H} ${S} \u2192 ${b.status}`),b}catch(b){throw!s(S)&&b?.name!=="AbortError"&&tn("network",`${H} ${S} \u2192 no answer (${Co(b)})`),b}};let h=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(m,v,...S){return this._nm=`${m.toUpperCase()} ${String(v)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(s(String(v))||tn("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),h.call(this,m,v,...S)}}var Vi=(s=Date.now())=>ks.filter(i=>s-Date.parse(i.at)<10*6e4).slice(-20);function Ui(s){let i=$=>{let p=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,x=$/p;return Math.round(x*10)%10===0?String(Math.round(x)):x.toFixed(1)},d=($,p,x,N,R,W="p")=>{if(x<=0||N<=0)return"";let z=R!==""?`<span class="dt-pad-chip dt-pad-chip--${W}" style="left:${$+x/2}px;top:${p+N/2}px">${R}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${W}" style="left:${$}px;top:${p}px;width:${x}px;height:${N}px"></span>${z}`},h=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],m="button, a, input, select, textarea, label, [role='button']",v=$=>{let p=$;for(let x=0;p&&x<6;x++,p=p.parentElement){if(p.matches(m))return p;let N=getComputedStyle(p);if(h.some(R=>parseFloat(N[R])>=2))return p}return $},S=($,p)=>{let x=parseFloat(p.columnGap)||0,N=parseFloat(p.rowGap)||0;if(!(p.display.includes("flex")||p.display.includes("grid"))||!x&&!N)return"";let R=[...$.children].map(z=>z.getBoundingClientRect()).filter(z=>z.width||z.height),W="";for(let z=1;z<R.length;z++){let Y=R[z-1],q=R[z];if(x&&q.left>=Y.right-1){let nt=Math.max(Y.top,q.top);W+=d(Y.right,nt,q.left-Y.right,Math.min(Y.bottom,q.bottom)-nt,i(x),"g")}else if(N&&q.top>=Y.bottom-1){let nt=Math.min(Y.left,q.left);W+=d(nt,Y.bottom,Math.max(Y.right,q.right)-nt,q.top-Y.bottom,i(N),"g")}}return W},H=$=>`<span class="dt-pad-outline" style="left:${$.left}px;top:${$.top}px;width:${$.width}px;height:${$.height}px"></span>`,b=($,p,x="")=>`<span class="dt-pad-tag" style="left:${p.left}px;top:${Math.max(2,p.top-22)}px">${$.tagName.toLowerCase()+($.classList[0]?"."+$.classList[0]:"")}${x}</span>`,k=$=>{let p=$.getBoundingClientRect(),x=getComputedStyle($),N=parseFloat(x.paddingTop),R=parseFloat(x.paddingRight),W=parseFloat(x.paddingBottom),z=parseFloat(x.paddingLeft),Y=H(p);Y+=d(p.left,p.top,p.width,N,N>=2?i(N):""),Y+=d(p.left,p.bottom-W,p.width,W,W>=2?i(W):""),Y+=d(p.left,p.top+N,z,p.height-N-W,z>=2?i(z):""),Y+=d(p.right-R,p.top+N,R,p.height-N-W,R>=2?i(R):"");let q=parseFloat(x.marginTop),nt=parseFloat(x.marginRight),St=parseFloat(x.marginBottom),bt=parseFloat(x.marginLeft);Y+=d(p.left,p.top-q,p.width,q,q>=2?i(q):"","m"),Y+=d(p.left,p.bottom,p.width,St,St>=2?i(St):"","m"),Y+=d(p.left-bt,p.top,bt,p.height,bt>=2?i(bt):"","m"),Y+=d(p.right,p.top,nt,p.height,nt>=2?i(nt):"","m"),Y+=S($,x);let jt=parseFloat(x.columnGap)||0,oe=parseFloat(x.rowGap)||0,Jt=(x.display.includes("flex")||x.display.includes("grid"))&&(jt||oe)?` \xB7 gap ${i(jt)}${oe&&oe!==jt?"/"+i(oe):""}`:"",xt="",Fe=$.parentElement;if($.matches(m)&&Fe){let Ot=getComputedStyle(Fe);Y+=S(Fe,Ot);let we=parseFloat(Ot.columnGap)||parseFloat(Ot.rowGap)||0;xt=` \xB7 ${i(p.width)}\xD7${i(p.height)}${we&&(Ot.display.includes("flex")||Ot.display.includes("grid"))?` \xB7 gap ${i(we)} in its row`:""}`}s.innerHTML=Y+b($,p,Jt+xt)},y=$=>{let p=$.getBoundingClientRect();s.innerHTML=H(p)+`<span class="dt-pad-chip" style="left:${p.left+p.width/2}px;top:${p.top+p.height/2}px">${i(p.width)} \xD7 ${i(p.height)}</span>`+b($,p)},B=$=>{let p=($.match(/[\d.]+/g)||[]).map(Number);if(p.length<3)return $;let x="#"+p.slice(0,3).map(N=>Math.round(N).toString(16).padStart(2,"0")).join("");return p[3]!==void 0&&p[3]<1?`${x} \xB7 ${Math.round(p[3]*100)}%`:x},Z=null,F=()=>{if(Z)return Z;let $=getComputedStyle(document.documentElement),p=document.createElement("span");p.style.display="none",document.body.append(p);let x=[];for(let N of Array.from($)){if(!N.startsWith("--"))continue;let R=$.getPropertyValue(N).trim();if(!/^(#|rgb|hsl|oklch|lab|color\()/i.test(R))continue;p.style.color="rgb(1, 2, 3)",p.style.color=R;let W=getComputedStyle(p).color;W&&W!=="rgb(1, 2, 3)"&&x.push([W,N])}return p.remove(),x.sort((N,R)=>N[1].length-R[1].length),Z=x,x},w=$=>F().find(([p])=>p===$)?.[1]??"",A=null,D=()=>{if(A)return A;let $=[],p=x=>{for(let N of Array.from(x))N instanceof CSSStyleRule?N.style.cssText.includes("var(--")&&$.push({sel:N.selectorText,style:N.style}):N instanceof CSSMediaRule?matchMedia(N.conditionText).matches&&p(N.cssRules):"cssRules"in N&&p(N.cssRules)};for(let x of Array.from(document.styleSheets))try{p(x.cssRules)}catch{}return A=$},G={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map($=>[`border-${$}-color`,[`border-${$}-color`,"border-color",`border-${$}`,"border"]]))},et=($,p)=>{let x=G[p]??[p],N=p==="color";for(let R=$;R;R=N?R.parentElement:null){let W=q=>x.map(nt=>/var\(\s*(--[\w-]+)/.exec(q.getPropertyValue(nt))?.[1]).find(Boolean),z=R instanceof HTMLElement?W(R.style):void 0;if(z)return z;let Y="";for(let q of D()){let nt=!1;try{nt=R.matches(q.sel)}catch{}nt&&(Y=W(q.style)||Y)}if(Y)return Y;if(N&&R.parentElement&&getComputedStyle(R).color!==getComputedStyle(R.parentElement).color)break}return""},L=($,p,x)=>{let N=et($,p);if(N)return`<b class="dt-var">${N}</b> <em>${B(x)}</em>`;let R=w(x);return R?`<span title="Same value as ${R}; not written with it">\u2248 ${R}</span> <em>${B(x)}</em>`:B(x)},st=$=>`<i class="dt-type-sw" style="background:${$}"></i>`,ut={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},mt=$=>($.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),at=($,p)=>$.slice(0,3).map((x,N)=>x*$[3]+p[N]*(1-$[3])).concat([1]),se=$=>{let p=[];for(let x=$;x;x=x.parentElement){let N=getComputedStyle(x);if(N.backgroundImage!=="none")return null;let R=mt(N.backgroundColor);if(R[3]>0&&(p.push(R),R[3]>=1))break}return p.reduceRight((x,N)=>at(N,x),[255,255,255,1])},Ct=$=>{let[p,x,N]=$.slice(0,3).map(R=>(R/=255,R<=.03928?R/12.92:((R+.055)/1.055)**2.4));return .2126*p+.7152*x+.0722*N},Lt=($,p,x)=>{let N=se($);if(!N)return["Contrast","<em>on an image</em>"];let R=at(mt(p.color),N),[W,z]=[Ct(R),Ct(N)].sort((St,bt)=>bt-St),Y=(W+.05)/(z+.05),q=x>=24||x>=18.66&&Number(p.fontWeight)>=700,nt=Y>=(q?4.5:7)?"AAA":Y>=(q?3:4.5)?"AA":"fails AA";return["Contrast",`${Y.toFixed(2)}:1 <em class="${nt==="fails AA"?"dt-type-bad":""}">${nt}${q?" \xB7 large":""}</em>`]},Vt=$=>{let p=$.getBoundingClientRect(),x=getComputedStyle($),N=parseFloat(x.fontSize),R=x.lineHeight==="normal"?0:parseFloat(x.lineHeight),W=parseFloat(x.letterSpacing)||0,z=bt=>`${(bt*100).toFixed(1).replace(/\.0$/,"")}%`,Y=[["Font",x.fontFamily.split(",")[0].replace(/["']/g,"")+(x.fontStyle!=="normal"?` ${x.fontStyle}`:"")],["Weight",`${ut[x.fontWeight]??""} <em>${x.fontWeight}</em>`],["Size",`${i(N)}px`],["Line",R?`${z(R/N)} <em>${i(R)}px</em>`:"normal"],["Letter",W?`${z(W/N)} <em>${W.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",st(x.color)+L($,"color",x.color)],Lt($,x,N)],nt=p.bottom+150<innerHeight?p.bottom+8:Math.max(8,p.top-158),St=Math.min(Math.max(8,p.left),innerWidth-210);s.innerHTML=H(p)+b($,p)+`<div class="dt-type-card" style="left:${St}px;top:${nt}px">${Y.map(([bt,jt])=>`<span class="dt-type-row"><b>${bt}</b><span>${jt}</span></span>`).join("")}</div>`},E=$=>$.every(p=>p===$[0])?$[0]:$[1]===$[3]&&$[0]===$[2]?`${$[0]} ${$[1]}`:$.join(" "),lt=$=>/^rgba\(.*,\s*0\)$|^transparent$/.test($),vt=($,p,x,N="")=>{let R=16+x.length*18,z=p.bottom+R+12<innerHeight?p.bottom+8:Math.max(8,p.top-R-8),Y=Math.min(Math.max(8,p.left),innerWidth-230);s.innerHTML=`<span class="dt-pad-outline" style="left:${p.left}px;top:${p.top}px;width:${p.width}px;height:${p.height}px${N?`;border-radius:${N}`:""}"></span>`+b($,p)+`<div class="dt-type-card dt-style-card" style="left:${Y}px;top:${z}px">${x.map(([q,nt])=>`<span class="dt-type-row"><b>${q}</b><span>${nt}</span></span>`).join("")}</div>`};return{spacer:v,drawPads:k,drawSize:y,drawType:Vt,drawColor:$=>{let p=getComputedStyle($),x=[];p.backgroundImage!=="none"&&x.push(["Fill",`<em>${/gradient/.test(p.backgroundImage)?"gradient":"image"}</em>`]),lt(p.backgroundColor)||x.push(["Fill",st(p.backgroundColor)+L($,"background-color",p.backgroundColor)]),$.textContent?.trim()&&x.push(["Text",st(p.color)+L($,"color",p.color)]),Number(p.opacity)<1&&x.push(["Opacity",`${Math.round(Number(p.opacity)*100)}%`]),x.length||x.push(["Color","<em>no fill or text</em>"]),vt($,$.getBoundingClientRect(),x)},drawBorder:$=>{let p=getComputedStyle($),x=[],N=["top","right","bottom","left"],R=N.map(z=>parseFloat(p.getPropertyValue(`border-${z}-width`))||0);if(R.some(z=>z>0)){let z=N.filter((q,nt)=>R[nt]>0);x.push(["Width",`${E(R.map(i))} <em>${p.getPropertyValue(`border-${z[0]}-style`)}</em>`]);let Y=z.map(q=>p.getPropertyValue(`border-${q}-color`));z.forEach((q,nt)=>{nt&&Y[nt]===Y[0]||x.push([nt?`\u21B3 ${q}`:"Color",st(Y[nt])+L($,`border-${q}-color`,Y[nt])])})}else x.push(["Width","<em>none</em>"]);let W=["top-left","top-right","bottom-right","bottom-left"].map(z=>{let[Y,q=Y]=p.getPropertyValue(`border-${z}-radius`).split(" "),nt=St=>St.endsWith("%")?St:i(parseFloat(St)||0);return Y===q?nt(Y):`${nt(Y)}/${nt(q)}`});x.push(["Radius",E(W)]),vt($,$.getBoundingClientRect(),x,p.borderRadius)}}}var Pt=s=>(s??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),Gi='[class^="dt-"],[class*=" dt-"],.devtools',Ki=s=>{let i=s;for(;i.parentElement&&i.parentElement!==document.body;)i=i.parentElement;return i.parentElement===document.body&&i.matches(Gi)};function Yi(){let s=(w,A)=>w?[...w.children].filter(D=>D.tagName===A&&!(w===document.body&&D.matches(Gi))):[],i=w=>{let A=[],D=w;for(;D&&D.tagName!=="HTML"&&A.length<8;){if(D.id){A.unshift("#"+CSS.escape(D.id));break}let G=D.parentElement,et=D.tagName.toLowerCase(),L=s(G,D.tagName);A.unshift(L.length>1?`${et}:nth-of-type(${L.indexOf(D)+1})`:et),D=G}return A.join(">")},d=w=>{let A=w.split(">"),D=null;for(let[G,et]of A.entries()){if(et.startsWith("#")){if(G)return null;D=document.querySelector(et);continue}let L=/^([a-z][a-z0-9-]*)(?::nth-of-type\((\d+)\))?$/.exec(et);if(!L)return document.querySelector(w);if(!D){if(L[1]!=="body"||L[2])return document.querySelector(w);D=document.body;continue}if(D=s(D,L[1].toUpperCase())[L[2]?Number(L[2])-1:0]??null,!D)return null}return D},h=(w,A)=>!A||Pt(w.textContent||"").slice(0,60)===A,m=(w,A)=>[w||"*",...(A||[]).map(D=>"."+CSS.escape(D))].join(""),v=w=>{try{return[...document.querySelectorAll(m(w.tag,w.classes))].filter(A=>!Ki(A))}catch{return[]}},S=w=>{let A=Pt(w.textContent||"").replace(/\s+/g," ");for(let D=w.parentElement,G=0;D&&D!==document.body&&G<4;D=D.parentElement,G++){let et=Pt(D.textContent||"").replace(/\s+/g," ");if(et&&et!==A)return et}return""},H=w=>S(w).slice(0,80),b=(w,A)=>!A||S(w).startsWith(A),k=w=>{let A=null;try{A=d(w.selector)}catch{A=null}if(A&&Ki(A)&&(A=null),A&&h(A,w.label)&&b(A,w.ctx))return A;let D=v(w),G=Pt(w.label)?D.filter(L=>h(L,w.label)):[],et=G.find(L=>b(L,w.ctx))??D.find(L=>w.ctx&&b(L,w.ctx)&&!Pt(w.label));return et||(Pt(w.label)?A&&h(A,w.label)?A:G.length===1?G[0]:null:A||(w.nth!=null?D[w.nth]??null:null))},y=w=>{let A=null;for(let D=w,G=w.parentElement;G&&G!==document.body&&getComputedStyle(D).position!=="fixed";D=G,G=G.parentElement){let et=getComputedStyle(G);if(et.overflowX==="visible"&&et.overflowY==="visible")continue;let L=G.getBoundingClientRect();A=A?{l:Math.max(A.l,L.left),t:Math.max(A.t,L.top),r:Math.min(A.r,L.right),b:Math.min(A.b,L.bottom)}:{l:L.left,t:L.top,r:L.right,b:L.bottom}}return A},B=w=>{let A=w.getBoundingClientRect();return(A.width>0||A.height>0)&&(!w.checkVisibility||w.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},Z=(w,A)=>{for(let D=A.parentElement;D&&D!==document.body;D=D.parentElement){if(!B(D))continue;let G=A.getBoundingClientRect();if(G.width||G.height)return{x:G.left+G.width*w.rx,y:G.top+G.height*w.ry,off:"",el:A,hidden:D};let et=D.getBoundingClientRect();return{x:et.left,y:et.top,off:"",el:A,hidden:D}}return null};return{cssPath:i,poolOf:v,contextOf:H,resolveEl:k,anchorOf:(w,A=k(w))=>{if(!A)return null;if(!B(A))return Z(w,A);let D=A.getBoundingClientRect(),G=D.left+D.width*w.rx,et=D.top+D.height*w.ry,L=y(A);if(!L)return{x:G,y:et,off:"",el:A};if(L.r-L.l<18||L.b-L.t<18)return null;let st=Math.min(Math.max(G,L.l),L.r-18),ut=Math.min(Math.max(et,L.t+18),L.b),mt=G<L.l?"l":G>L.r-18?"r":et<L.t+18?"t":et>L.b?"b":"";return{x:st,y:ut,off:mt,el:A}}}}var Xi=(s,i)=>`<svg class="dt-bars" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${[0,1,2,3].map(d=>`<rect x="${.5+d*3}" y="${8.5-d*2.5}" width="2" height="${3+d*2.5}" rx="0.6" fill="${i}" stroke="none" opacity="${d<s?1:.28}"/>`).join("")}</svg>`;function Ji(s,i,d){let h=document.createElement("div");h.className="dt-field-menu",h.setAttribute("role","listbox"),h.hidden=!0,document.body.append(h);for(let S of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])h.addEventListener(S,H=>H.stopPropagation());let m=null,v=()=>{h.hidden=!0,m=null};for(let S of s)S.addEventListener("mousedown",H=>{let b=H.target.closest(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select");if(!b){h.contains(H.target)||v();return}if(H.preventDefault(),m===b){v();return}m=b;let k=b.classList.contains("dt-more-select"),y=F=>k?F.dataset.on!=null:F.selected;h.innerHTML=[...b.options].map((F,w)=>F.hidden?"":`${F.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${w}" aria-selected="${y(F)}"${F.dataset.danger!=null?' class="is-danger"':""}>${F.dataset.icon?F.dataset.icon:F.dataset.initial!=null?F.dataset.face?`<img class="dt-face" src="${i(F.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${i(F.dataset.initial)}</b>`:`<i style="background:${i(F.dataset.c||"#717171")}"></i>`}<span>${i(F.text)}</span>${F.dataset.hint?`<small>${i(F.dataset.hint)}</small>`:""}${y(F)?d:""}</button>`).join("");let B=b.parentElement.getBoundingClientRect();h.style.left=`${B.left}px`,h.style.top=`${B.bottom+4}px`,h.style.minWidth=`${B.width}px`,h.hidden=!1;let Z=h.getBoundingClientRect();Z.bottom>innerHeight-8&&(h.style.top=`${B.top-4-Z.height}px`),Z.right>innerWidth-8&&(h.style.left=`${Math.max(8,B.right-Z.width)}px`)});h.addEventListener("click",S=>{let H=S.target.closest("[data-i]");if(!H||!m)return;let b=m;v(),!(b.selectedIndex===Number(H.dataset.i)&&!b.classList.contains("dt-more-select"))&&(b.selectedIndex=Number(H.dataset.i),b.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",S=>{S.key==="Escape"&&!h.hidden&&(S.stopPropagation(),v())},!0),document.addEventListener("pointerdown",S=>{!h.hidden&&!h.contains(S.target)&&!S.target.closest?.(".dt-cat-select, .dt-for-select, .dt-status-select, .dt-more-select")&&v()},!0),addEventListener("scroll",S=>{h.contains(S.target)||v()},!0)}var nn=s=>s.replace(/[&<>"]/g,i=>({"&":"&","<":"<",">":">",'"':"""})[i]),X={signal:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><rect x="1" y="12" width="3.2" height="5" rx="1"/><rect x="5.6" y="9" width="3.2" height="8" rx="1"/><rect x="10.2" y="6" width="3.2" height="11" rx="1"/><rect x="14.8" y="3" width="3.2" height="14" rx="1"/></svg>',wifi:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><path d="M10 16.6 7.4 13.8a3.7 3.7 0 0 1 5.2 0z"/><path d="M4.8 11.1a7.4 7.4 0 0 1 10.4 0l-1.3 1.4a5.5 5.5 0 0 0-7.8 0z"/><path d="M2.2 8.3a11.1 11.1 0 0 1 15.6 0l-1.3 1.4a9.2 9.2 0 0 0-13 0z"/></svg>',battery:'<svg viewBox="0 0 28 14" class="dt-i dt-i--batt"><rect x="1" y="1" width="23" height="12" rx="3.5" fill="none" stroke="currentColor" stroke-opacity=".4"/><rect x="3" y="3" width="17" height="8" rx="2" fill="currentColor"/><path d="M26 5v4a2 2 0 0 0 0-4z" fill="currentColor" fill-opacity=".4"/></svg>',back:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4 6.5 10l6 6"/></svg>',fwd:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M7.5 4l6 6-6 6"/></svg>',reload:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9"/><path d="M14.2 3.2v3.2H11"/></svg>',dots:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="4.5" cy="10" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="15.5" cy="10" r="1.6"/></svg>',dotsV:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="4.5" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="10" cy="15.5" r="1.6"/></svg>',share:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 12.5V2.8M6.8 5.8 10 2.6l3.2 3.2"/><path d="M6.5 8.5H5a1.5 1.5 0 0 0-1.5 1.5v6A1.5 1.5 0 0 0 5 17.5h10a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 15 8.5h-1.5"/></svg>',plus:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 4v12M4 10h12"/></svg>',tabs:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="3" y="6" width="11" height="11" rx="2"/><path d="M6 3.5h8.5A2.5 2.5 0 0 1 17 6v8.5"/></svg>',sidebar:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="2.5" y="4" width="15" height="12" rx="2"/><path d="M8 4v12"/></svg>',lock:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="9" width="10" height="8" rx="1.8"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/></svg>',tune:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3 6.5h8M15 6.5h2M3 13.5h2M9 13.5h8"/><circle cx="13" cy="6.5" r="2"/><circle cx="7" cy="13.5" r="2"/></svg>',star:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m10 3 2.1 4.4 4.8.6-3.5 3.3.9 4.7L10 13.7 5.7 16l.9-4.7L3.1 8l4.8-.6z" stroke-linejoin="round"/></svg>',user:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="10" r="8" fill-opacity=".25"/><circle cx="10" cy="8" r="3"/><path d="M4.8 15.3a6 6 0 0 1 10.4 0 7.9 7.9 0 0 1-10.4 0z"/></svg>',recent:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5.5 5v10M10 5v10M14.5 5v10"/></svg>',home:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="4.5" y="4.5" width="11" height="11" rx="3.5"/></svg>',navBack:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4.5 7 10l5.5 5.5"/></svg>',close:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m5.5 5.5 9 9m0-9-9 9"/></svg>',winMin:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5 10h10"/></svg>',winMax:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="5" width="10" height="10" rx="1.5"/></svg>',chevUp:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m6 12 4-4 4 4"/></svg>',volume:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3.5 8v4h3l4 3.5v-11l-4 3.5z" stroke-linejoin="round"/><path d="M13.5 7.5a3.5 3.5 0 0 1 0 5"/></svg>'},Ho=(s,i)=>s.toLocaleTimeString("en-US",i),Ls=s=>Ho(s,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),ed={island:s=>({side:12,top:12,bottom:12,r:s.w>=430?62:55,body:s.w>=430?74:67,extraW:6}),home:()=>({side:18,top:92,bottom:92,r:0,body:56,extraW:6}),punch:()=>({side:9,top:9,bottom:9,r:34,body:43,extraW:6}),tablet:()=>({side:26,top:26,bottom:26,r:18,body:44}),macbook:s=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((s.w+32)*.12),extraH:18}),laptop:s=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((s.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function nd(s,i,d,h,m){let v=s.w+2*i.side,S=s.h+i.top+i.bottom,H=(d-v)/2,b=`<rect class="dt-shell-screen" x="${m}" y="${i.top}" width="${s.w}" height="${s.h}" rx="${i.r}"/>`,k="";if(s.shell==="island"||s.shell==="home"||s.shell==="punch"){let y=(B,Z,F)=>`<rect class="dt-shell-btn" x="${B}" y="${Z}" width="4" height="${F}" rx="2"/>`;k+=s.shell==="punch"?y(H+v-1,150,70)+y(H+v-1,240,44):y(H-3,120,28)+y(H-3,170,56)+y(H-3,236,56)+y(H+v-1,190,90),k+=`<rect class="dt-shell-body" x="${H}" y="0" width="${v}" height="${S}" rx="${i.body}"/>`,k+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${v-6}" height="${S-6}" rx="${i.body-3}"/>`,s.shell==="home"&&(k+=`<rect class="dt-shell-slot" x="${d/2-26}" y="44" width="52" height="6" rx="3"/>`,k+=`<circle class="dt-shell-slot" cx="${d/2-48}" cy="47" r="5"/>`,k+=`<circle class="dt-shell-homebtn" cx="${d/2}" cy="${S-46}" r="28"/>`)}else if(s.shell==="tablet")k+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${v}" height="${S}" rx="${i.body}"/>`,k+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${v-8}" height="${S-8}" rx="${i.body-4}"/>`;else if(s.shell==="monitor"){let y=Math.round(v*.1);k+=`<path class="dt-shell-stand" d="M${d/2-y/2} ${S-2}h${y}l${y*.2} 84h${-y*1.4}z"/>`,k+=`<rect class="dt-shell-stand" x="${d/2-v*.15}" y="${S+80}" width="${v*.3}" height="14" rx="7"/>`,k+=`<rect class="dt-shell-body" x="${H}" y="0" width="${v}" height="${S}" rx="${i.body}"/>`}else{let y=v+(i.extraW??0),B=(d-y)/2,Z=i.extraH??16;k+=`<path class="dt-shell-body" d="M${H} ${i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${-i.body}h${v-2*i.body}a${i.body} ${i.body} 0 0 1 ${i.body} ${i.body}V${S}H${H}z"/>`,k+=`<path class="dt-shell-base${s.shell==="macbook"?" dt-shell-base--silver":""}" d="M${B} ${S}h${y}v${Z-8}a8 8 0 0 1-8 8H${B+8}a8 8 0 0 1-8-8z"/>`,k+=`<rect class="dt-shell-lip" x="${d/2-v*.07}" y="${S}" width="${v*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${d} ${h}" width="${d}" height="${h}" aria-hidden="true">${k}${b}</svg>`}var sd={"safari-ios":s=>{let i=s.shell==="home"?20:s.w>=400?62:59;return{top:i,bottom:98,topMin:i,bottomMin:58}},"chrome-android":()=>({top:92,bottom:48,topMin:36,bottomMin:48}),"safari-ipad":()=>({top:74,bottom:20}),"safari-mac":()=>({top:85,bottom:59}),"chrome-windows":()=>({top:87,bottom:48})},od=({d:s,now:i,cutout:d},h)=>{if(s.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${h}px"><span class="dt-sb-l">${X.signal}${X.wifi}</span><b>${Ls(i)}</b><span class="dt-sb-r">${X.battery}</span></div>`;let m=d??{x:(s.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${h}px"><span class="dt-island" style="left:${m.x}px;top:${m.y}px;width:${m.width}px;height:${m.height}px"></span><b class="dt-sb-time" style="top:${m.y}px;height:${m.height}px">${Ls(i)}</b><span class="dt-sb-icons" style="top:${m.y}px;height:${m.height}px">${X.signal}${X.wifi}${X.battery}</span></div>`},ad=({d:s,host:i,min:d},h)=>{let m=s.shell==="home"?"":'<i class="dt-home-ind"></i>';return d?`<div class="dt-ios-bar is-min" style="height:${h}px"><span class="dt-ios-mini">${nn(i)}</span>${m}</div>`:`<div class="dt-ios-bar" style="height:${h}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${X.back}</button><span class="dt-glass dt-ios-url"><span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${X.reload}</button></span><span class="dt-glass dt-glass--round">${X.dots}</span></div>${m}</div>`},id=({now:s,min:i},d)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Ho(s,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${X.wifi}${X.signal}${X.battery}</span></div>`+(i?"":`<div class="dt-and-bar"><span class="dt-and-url">${X.tune}<span>${nn(d)}</span></span><span class="dt-and-tabs">1</span>${X.dotsV}</div>`),rd=()=>`<div class="dt-and-nav">${X.recent}${X.home}${X.navBack}</div>`,ld=({now:s,host:i})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Ls(s)} ${s.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${X.wifi}${X.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${X.sidebar}<button data-nav="back" aria-label="Back" title="Back">${X.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${X.fwd}</button></span><span class="dt-ipad-url">${X.lock}<span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${X.reload}</button></span><span class="dt-bar-group">${X.share}${X.plus}${X.tabs}</span></div>`,dd=({now:s,host:i},d)=>'<div class="dt-mac-menu"><span class="dt-mac-apps"><b>Safari</b><span>File</span><span>Edit</span><span>View</span><span>History</span><span>Bookmarks</span><span>Window</span><span>Help</span></span>'+(d?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${X.wifi}${X.battery}<span>${s.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${Ls(s)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${X.sidebar}<button data-nav="back" aria-label="Back" title="Back">${X.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${X.fwd}</button></span><span class="dt-mac-url">${X.lock}<span>${nn(i)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${X.reload}</button></span><span class="dt-bar-group">${X.share}${X.plus}${X.tabs}</span></div>`,cd=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(s,i)=>`<i style="--hue:${i*40}"></i>`).join("")}</span></div>`,ud=({host:s,title:i})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${nn(i||s)}</span>${X.close}</span><span class="dt-win-new">${X.plus}</span><span class="dt-win-ctrl">${X.winMin}${X.winMax}${X.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${X.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${X.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${X.reload}</button></span><span class="dt-win-url">${X.tune}<span>${nn(s)}</span>${X.star}</span><span class="dt-bar-group">${X.user}${X.dotsV}</span></div>`,pd=({now:s})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(i,d)=>`<i style="--hue:${200+d*30}"></i>`).join("")}</span><span class="dt-win-tray">${X.chevUp}${X.wifi}${X.volume}${X.battery}<span class="dt-win-clock">${Ho(s,{hour:"numeric",minute:"2-digit"})}<br>${s.toLocaleDateString("en-US")}</span></span></div>`;function Zi(s,i){let d=ed[s.shell](s),h=s.w+2*d.side,m=s.h+d.top+d.bottom,v=h+(d.extraW??0),S=m+(s.shell==="monitor"||s.shell==="macbook"||s.shell==="laptop"?d.extraH??0:0),H=(v-h)/2+d.side,b=sd[s.browser](s),k=i.min?b.topMin??b.top:b.top,y=i.min?b.bottomMin??b.bottom:b.bottom,B={...i,d:s},Z="",F="";switch(s.browser){case"safari-ios":Z=od(B,k),F=ad(B,y);break;case"chrome-android":Z=id(B,i.host),F=rd();break;case"safari-ipad":Z=ld(B),F='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":Z=dd(B,s.shell==="macbook"),F=cd();break;case"chrome-windows":Z=ud(B),F=pd(B);break}return{footprint:{w:v,h:S},screen:{x:H,y:d.top,w:s.w,h:s.h,r:d.r,rb:d.rb??d.r},topH:k,bottomH:y,shell:nd(s,d,v,S,H),top:Z,bottom:F,canMinimize:b.topMin!==void 0&&(b.topMin!==b.top||b.bottomMin!==b.bottom),scrollbar:s.browser==="chrome-windows"?"classic":"overlay"}}var en=null;function Wn(s){if(en??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!en||!s)return[0,0,0,0];en.clearRect(0,0,1,1),en.fillStyle="rgba(0, 0, 0, 0)",en.fillStyle=s,en.fillRect(0,0,1,1);let[i,d,h,m]=en.getImageData(0,0,1,1).data;return[i,d,h,m/255]}var jn=([s,i,d])=>`rgb(${s}, ${i}, ${d})`;function Qi(s){let i=s.defaultView,d=F=>!F||Wn(F)[3]===0,h=[s.body,s.documentElement].map(F=>F&&i.getComputedStyle(F).backgroundColor).find(F=>F&&!d(F)),[m,v,S,H]=h?Wn(h):[255,255,255,1],b=[m,v,S].map(F=>Math.round(F*H+255*(1-H))),k=F=>{let[w,A,D,G]=Wn(F);if(G>=.75)return jn([w,A,D]);let et=(L,st)=>Math.round(L*G+st*(1-G));return jn([et(w,b[0]),et(A,b[1]),et(D,b[2])])},y=F=>{let w=s.elementFromPoint(i.innerWidth/2,F);for(;w&&w!==s.documentElement;w=w.parentElement){let A=i.getComputedStyle(w);if(A.position!=="fixed"&&A.position!=="sticky")continue;let D=w.getBoundingClientRect().width>=i.innerWidth*.9,G=A.backdropFilter&&A.backdropFilter!=="none";return D&&!G&&!d(A.backgroundColor)?k(A.backgroundColor):null}return null},B=s.querySelector('meta[name="theme-color"]')?.content||"",Z=B&&!d(B)?jn(Wn(B)):"";return{top:y(4)??jn(b),bottom:y(i.innerHeight-4)??jn(b),theme:Z}}function Bo(s){let[i,d,h]=Wn(s).map(m=>m/255).map(m=>m<=.04045?m/12.92:((m+.055)/1.055)**2.4);return .2126*i+.7152*d+.0722*h>.4?"#000":"#fff"}function tr(s){let{cfg:i,inFrame:d,persist:h,frame:m,frameEl:v,devicesMenu:S,bpBtns:H,notesOverlay:b,WIDE:k,bpOf:y,currentBp:B,deviceById:Z,notesOn:F,filter:w,filterTo:A,dropFrameDrafts:D,putAway:G,tellFrame:et,syncBpButtons:L,render:st,reread:ut}=s,mt=i.breakpoints,at=document.querySelector(".dt-device"),se=document.querySelector(".dt-shell"),Ct=document.querySelector('.dt-chrome[data-at="top"]'),Lt=document.querySelector('.dt-chrome[data-at="bottom"]'),Vt=document.querySelector(".dt-ruler"),E=[...document.querySelectorAll(".dt-frame-handle")],lt=document.querySelector(".dt-frame-size"),vt=document.querySelector(".dt-frame-rotate"),It=document.querySelector(".dt-frame-bars"),Ut="overlay",$="",p="dt-w",x="dt-canvas",N="dt-device",R=ot.getItem(x)==="1",W=ot.getItem(N)||"";W&&!Z(W)&&(W="",ot.setItem(N,""));let z=Number(ot.getItem(p))||0,Y="dt-emu",q=(()=>{try{return JSON.parse(ot.getItem(Y)||"null")}catch{return null}})(),nt=()=>q?On.find(M=>M.id===q.id)??null:null,St=()=>{let M=nt();return M?q.turned?{w:M.h,h:M.w}:{w:M.w,h:M.h}:null},bt=ot.getItem("dt-bars-min")==="1",jt=M=>{q=M,h(Y,M?JSON.stringify(M):"")},oe=M=>{lt.textContent=M,m.style.setProperty("--dt-badge-w",`${lt.offsetWidth}px`)},Jt=M=>{if(!M){Vt.innerHTML="";return}let C="";for(let O=0;O<=M;O+=50)C+=`<span class="dt-tick${O%200===0?" is-major":""}" style="left:${O}px"></span>`;for(let O of mt)for(let it of[O.min,O.max])it>0&&Number.isFinite(it)&&it<=M&&(C+=`<span class="dt-edge" style="left:${it}px" title="${O.label} edge"></span>`);Vt.innerHTML=C,Vt.style.width=`${M}px`},xt=()=>{let M=parseFloat(at.style.width)||0,C=parseFloat(at.style.height)||0;if(!M||!C){at.style.transform="",delete at.dataset.scaled;return}let O=W||q?Math.min(1,(innerWidth-80)/M,(innerHeight-120)/C):Math.min(1,(innerWidth-80)/M);at.style.transform=O<1?`scale(${O})`:"",at.dataset.scaled=O<1?String(Math.round(O*100)):""},Fe=M=>On.find(C=>C.w===M.w&&C.h===M.h&&C.cutout?.shape==="pill")?.cutout,Ot=()=>{try{return v.contentDocument}catch{return null}},we=()=>Ot()?.title.split("\u2014").pop()?.trim()||"",J=()=>{let M=Ot(),C=W?Z(W):null;if(!M?.body||!C)return;let O=Qi(M),it=C.browser==="chrome-android"?O.theme||"rgb(255, 255, 255)":O.top,ft=C.browser==="chrome-android"?"rgb(255, 255, 255)":O.bottom;at.style.setProperty("--dt-top",it),at.style.setProperty("--dt-top-ink",Bo(it)),at.style.setProperty("--dt-bottom",ft),at.style.setProperty("--dt-bottom-ink",Bo(ft));let Et=Ct.querySelector(".dt-win-tab > span");Et&&(Et.textContent=we()||location.host)},Ce=0;v.addEventListener("load",()=>{let M=Ot();if(!M)return;let C=window.__notemendHosted;if(C&&!v.contentWindow?.__notemendHosted&&!M.querySelector(`script[src^="${C.base}/bar.js"]`)){let O=M.createElement("script");O.src=`${C.base}/bar.js`,O.dataset.project=C.project,M.head.append(O)}J(),v.contentWindow?.addEventListener("scroll",()=>{Ce||(Ce=requestAnimationFrame(()=>{Ce=0,J()}))},{passive:!0})});for(let M of[Ct,Lt])M.addEventListener("click",C=>{let O=C.target.closest("[data-nav]")?.dataset.nav;if(O)try{let it=v.contentWindow?.navigation;if(!Ot()||!it)throw new Error("foreign");O==="back"?it.canGoBack&&it.back():O==="fwd"?it.canGoForward&&it.forward():it.reload()}catch{(O==="reload"||O==="back")&&(v.src=location.href)}});It.addEventListener("click",()=>{bt=!bt,h("dt-bars-min",bt?"1":"0"),Wt()});let Wt=()=>{if(d)return;let M=W?Z(W)??null:null;if(W&&!M&&(W="",ot.setItem(N,"")),!M&&!R){m.hidden=!0,v.removeAttribute("src"),Ft.toggle("dt-framing",!1),b.hidden=!F(),Vt.innerHTML="",L(),vt.hidden=!0,It.hidden=!0,A(null),$="",D(),L(),Ht(),ut();return}if(m.hidden=!1,Ft.toggle("dt-framing",!0),b.hidden=!0,v.src||(v.src=location.href),M){let C=Zi(M,{host:location.host,title:we(),now:new Date,min:bt,cutout:Fe(M)}),{screen:O}=C;m.dataset.mode="device",at.dataset.shell=M.shell,at.dataset.browser=M.browser,at.style.width=`${C.footprint.w}px`,at.style.height=`${C.footprint.h}px`,at.style.setProperty("--dt-r",`${O.r}px`),at.style.setProperty("--dt-rb",`${O.rb}px`),se.innerHTML=C.shell;let it=(ae,$e,ue,sn)=>{ae.innerHTML=sn,ae.style.cssText=`left:${O.x}px;top:${$e}px;width:${O.w}px;height:${ue}px`};it(Ct,O.y,C.topH,C.top),it(Lt,O.y+O.h-C.bottomH,C.bottomH,C.bottom);let ft=O.h-C.topH-C.bottomH;v.style.position="absolute",v.style.left=`${O.x}px`,v.style.top=`${O.y+C.topH}px`,v.style.width=`${O.w}px`,v.style.height=`${ft}px`,Vt.innerHTML="";let Et=bt&&C.canMinimize;Ut=C.scrollbar,$=`${M.label}${Et?" \xB7 bars folded":""}`,A(y(M.w)),et({notes:F(),scrollbar:Ut,device:$}),It.hidden=!C.canMinimize,It.setAttribute("aria-pressed",String(Et)),oe(`${M.label} \xB7 page ${M.w}\xD7${ft} of ${M.w}\xD7${M.h}${Et?" \xB7 bars folded":""} \xB7 ${mt.find(ae=>ae.id===w())?.label??""}`),J()}else{let C=St();C||jt(null);let O=C?.w||z||mt.find(Et=>Et.id===B()).ideal;z=O,m.dataset.mode="canvas",delete at.dataset.shell,delete at.dataset.browser,se.innerHTML=Ct.innerHTML=Lt.innerHTML="",Ct.style.cssText=Lt.style.cssText="",It.hidden=!0,Ut="overlay",at.style.width=`${O}px`,at.style.height=`${C?.h??innerHeight-84}px`,v.style.position="",v.style.left=v.style.top="",v.style.width="100%",v.style.height="100%",Jt(O),et({notes:F()});let it=mt.find(Et=>Et.id===y(O)),ft=nt();$=ft?`${ft.label}${q?.turned?" \xB7 landscape":""}`:"",et({scrollbar:Ut,device:$}),oe(ft&&C?`${ft.label} \xB7 ${C.w}\xD7${C.h} \xB7 ${it.label}`:`${O}px \xB7 ${it.label}`),A(y(O))}vt.hidden=!(nt()?.rotates&&!M),Ht(),xt(),L(),ut()},je=M=>{let C=mt.find(O=>O.id===M);W="",ot.setItem(N,""),jt(null),R=M!==k||innerWidth<C.min,z=R?C.ideal:0,A(R?M:null),ot.setItem(x,R?"1":"0"),ot.setItem(p,String(z)),G(),Wt()};for(let M of H)M.addEventListener("click",()=>je(M.dataset.bp));for(let M of document.querySelectorAll("[data-device]"))M.addEventListener("click",()=>{W=M.dataset.device===W?"":M.dataset.device,ot.setItem(N,W),S.open=!1,Wt()});for(let M of document.querySelectorAll("[data-emu]"))M.addEventListener("click",()=>{let C=q?.id===M.dataset.emu&&!W;W="",ot.setItem(N,""),jt(C?null:{id:M.dataset.emu,turned:!1}),R=!C,z=0,ot.setItem(x,R?"1":"0"),A(null),G(),S.open=!1,Wt()});vt.addEventListener("click",()=>{q&&(jt({...q,turned:!q.turned}),G(),Wt())});let V=[...S.querySelectorAll("[data-tab]")],Tt=[...S.querySelectorAll("[data-panel]")],tt=M=>{for(let C of V)C.setAttribute("aria-selected",String(C.dataset.tab===M));for(let C of Tt)C.hidden=C.dataset.panel!==M;h("dt-devices-tab",M)};for(let M of V)M.addEventListener("click",()=>tt(M.dataset.tab));tt(ot.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let T=S.querySelector(".dt-emu-search");T.addEventListener("input",()=>{let M=T.value.trim().toLowerCase(),C=null,O=!1,it=()=>{C&&(C.hidden=!O)};for(let ft of T.parentElement.children){if(ft.classList.contains("dt-devices-group")){it(),C=ft,O=!1;continue}ft.dataset.emu&&(ft.hidden=!!M&&!ft.textContent.toLowerCase().includes(M),O||=!ft.hidden)}it()});let yn=S.querySelector(".dt-devices-name");function Ht(){for(let C of S.querySelectorAll("[data-device]"))C.setAttribute("aria-pressed",String(C.dataset.device===W));let M=!W&&!m.hidden?q?.id:void 0;for(let C of S.querySelectorAll("[data-emu]"))C.setAttribute("aria-pressed",String(C.dataset.emu===M));yn.textContent=W&&Z(W)?.label||M&&nt()?.label||"Device"}let We=M=>mt.find(C=>C.id===M),Bt=M=>{let C=We(w()??B());return Math.max(C.min||320,Math.min(Number.isFinite(C.max)?C.max:2560,Math.round(M)))};for(let M of E){let C=M.dataset.edge==="l"?-1:1;M.addEventListener("pointerdown",O=>{if(W)return;O.preventDefault(),q&&(jt(null),Wt()),M.setPointerCapture(O.pointerId);let it=O.clientX,ft=z,Et=Number(at.dataset.scaled||100)/100;m.dataset.dragging="1";let ae=ue=>{z=Bt(ft+C*(ue.clientX-it)*2/Et),at.style.width=`${z}px`,Jt(z),oe(`${z}px \xB7 ${We(y(z)).label}`),xt()},$e=()=>{M.removeEventListener("pointermove",ae),M.removeEventListener("pointerup",$e),M.removeEventListener("pointercancel",$e),delete m.dataset.dragging,ot.setItem(p,String(z)),Wt()};M.addEventListener("pointermove",ae),M.addEventListener("pointerup",$e),M.addEventListener("pointercancel",$e)}),M.addEventListener("dblclick",()=>{if(W)return;jt(null);let O=We(w()??B()),it=[O.min||320,Number.isFinite(O.max)?O.max:O.ideal];z=Math.abs(z-it[0])<Math.abs(z-it[1])?it[0]:it[1],ot.setItem(p,String(z)),Wt()})}let gt=B(),Nt=()=>{let M=mt.find(C=>C.id===k);return R&&!W&&!q&&z===M.ideal&&innerWidth>=M.min};return addEventListener("resize",()=>{if(Nt()){je(k);return}L(),B()!==gt&&(gt=B(),st()),m.hidden||(!W&&!q&&(at.style.height=`${innerHeight-84}px`),xt())}),{apply:Wt,pickBp:je,look:()=>({scrollbar:Ut,device:$}),restore:()=>{Nt()?je(k):R||W?Wt():Ht()}}}var er='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg>',nr='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',hd='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function sr(s){let{bp:i,notes:d,breakpoints:h,bandOfNote:m,whoseAgent:v,statusTools:S,showResolved:H,showArchived:b,drafts:k,find:y}=s,B=d.filter(E=>m(E)===i),Z=E=>[E.text,E.note,E.byName,...(E.replies??[]).filter(lt=>!lt.deleted).map(lt=>lt.text)].join(" ").toLowerCase(),F=E=>y.view==="me"?s.forMe(E):y.view==="agent"?s.forAgent(E):!0,w=E=>Date.parse(E.updatedAt||E.createdAt||"")||0,A=B.filter(E=>F(E)&&(!y.q||Z(E).includes(y.q.trim().toLowerCase()))).sort((E,lt)=>(y.sort==="unread"?Number(s.unread(lt))-Number(s.unread(E)):0)||w(lt)-w(E)),D={open:[],claude:[],done:[],archived:[]};for(let E of A)D[ht(E)==="done"&&s.archived(E)?"archived":ht(E)].push(E);let G=E=>{let lt=(E.replies??[]).filter(R=>!R.deleted),vt=Qe(E.category),It=ht(E),Ut=It==="claude"&&!s.agentless(E),$=s.orphan(E),p=lt.length?lt[lt.length-1]:E.note?{author:"claude",text:E.note}:{author:"you",text:E.text},x=(R,W)=>R.by&&W.by?R.by===W.by:R.byName===W.byName,N=s.unread(E);return`<div class="dt-hist-row is-${It}${It==="done"?s.archived(E)?" is-archived":" is-resolved":""}${$?" is-orphan":""}${N?" is-unread":""}">
|
|
168
|
-
<button class="dt-hist-go" data-go="${
|
|
169
|
-
${
|
|
184
|
+
`)}var Ae=(o,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="${o}"/>`:""}<rect x="1.75" y="1.75" width="8.5" height="8.5" rx="1.5" fill="none" stroke="${o}" stroke-width="1.5" transform="rotate(45 6 6)"/></svg>`};var nd=[{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"/>'}],ts=(o,r=14)=>`<svg viewBox="0 0 24 24" width="${r}" height="${r}" fill="none" stroke="${o.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${o.icon}</svg>`,sn=o=>nd.find(r=>r.id===o)||nd[0];var Mt=o=>o.status!=="done"?"open":o.doneBy==="claude"?"claude":"done",sd={open:"Open",done:"Resolved",claude:"To check"};var Kt={ready:Promise.resolve(),toggle:(o,r)=>{Kt.ready.then(()=>document.documentElement.classList.toggle(o,r))},set:(o,r)=>{Kt.ready.then(()=>document.documentElement.style.setProperty(o,r))}};var zu=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,od=o=>String(o??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(zu,"$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 Bn=[],ei=o=>{if(o instanceof Error)return`${o.name}: ${o.message}`;if(typeof o=="string")return o;try{return JSON.stringify(o)??String(o)}catch{return String(o)}},Gu=/ResizeObserver loop/,Nn=(o,r)=>{if(Gu.test(r))return;let c=Zt(od(r.replace(/\s+/g," ").trim()),500),h=Bn.findIndex(m=>m.kind===o&&m.text.replace(/ ×\d+$/,"")===c);if(h>=0){let[m]=Bn.splice(h,1),y=Number(/ ×(\d+)$/.exec(m.text)?.[1]??1)+1;Bn.push({at:new Date().toISOString(),kind:o,text:`${c} \xD7${y}`});return}Bn.push({at:new Date().toISOString(),kind:o,text:c}),Bn.length>50&&Bn.shift()},ad=!1;function id(o){if(ad||typeof window>"u")return;ad=!0;let r=console.error;console.error=(...m)=>{Nn("console",m.map(ei).join(" ")),r.apply(console,m)},addEventListener("error",m=>{if(m instanceof ErrorEvent)return Nn("error",`${m.message}${m.filename?` (${m.filename}:${m.lineno})`:""}`);let y=m.target,L=y?.src||y?.href;L&&!o(L)&&Nn("network",`${y.tagName?.toLowerCase()} ${L} did not load`)},!0),addEventListener("unhandledrejection",m=>Nn("rejection",ei(m.reason)));let c=window.fetch;window.fetch=async(m,y)=>{let L=typeof m=="string"?m:m instanceof URL?m.href:m.url,H=(y?.method||(m instanceof Request?m.method:"GET")).toUpperCase();try{let $=await c.call(window,m,y);return $.status>=400&&!o(L)&&Nn("network",`${H} ${L} \u2192 ${$.status}`),$}catch($){throw!o(L)&&$?.name!=="AbortError"&&Nn("network",`${H} ${L} \u2192 no answer (${ei($)})`),$}};let h=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(m,y,...L){return this._nm=`${m.toUpperCase()} ${String(y)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(o(String(y))||Nn("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),h.call(this,m,y,...L)}}var rd=(o=Date.now())=>Bn.filter(r=>o-Date.parse(r.at)<10*6e4).slice(-20);function ld(o){let r=v=>{let b=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,M=v/b;return Math.round(M*10)%10===0?String(Math.round(M)):M.toFixed(1)},c=(v,b,M,I,O,it="p")=>{if(M<=0||I<=0)return"";let rt=O!==""?`<span class="dt-pad-chip dt-pad-chip--${it}" style="left:${v+M/2}px;top:${b+I/2}px">${O}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${it}" style="left:${v}px;top:${b}px;width:${M}px;height:${I}px"></span>${rt}`},h=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],m="button, a, input, select, textarea, label, [role='button']",y=v=>{let b=v;for(let M=0;b&&M<6;M++,b=b.parentElement){if(b.matches(m))return b;let I=getComputedStyle(b);if(h.some(O=>parseFloat(I[O])>=2))return b}return v},L=(v,b)=>{let M=parseFloat(b.columnGap)||0,I=parseFloat(b.rowGap)||0;if(!(b.display.includes("flex")||b.display.includes("grid"))||!M&&!I)return"";let O=[...v.children].map(X=>X.getBoundingClientRect()).filter(X=>X.width||X.height),it="",rt=(X,K)=>r(Math.abs(X-K)<=1?K:X);for(let X=1;X<O.length;X++){let K=O[X-1],et=O[X];if(M&&et.left>=K.right-1){let ct=Math.max(K.top,et.top);it+=c(K.right,ct,et.left-K.right,Math.min(K.bottom,et.bottom)-ct,rt(et.left-K.right,M),"g")}else if(I&&et.top>=K.bottom-1){let ct=Math.min(K.left,et.left);it+=c(ct,K.bottom,Math.max(K.right,et.right)-ct,et.top-K.bottom,rt(et.top-K.bottom,I),"g")}}return it},H=v=>`<span class="dt-pad-outline" style="left:${v.left}px;top:${v.top}px;width:${v.width}px;height:${v.height}px"></span>`,$=(v,b,M="")=>`<span class="dt-pad-tag" style="left:${b.left}px;top:${Math.max(2,b.top-22)}px">${v.tagName.toLowerCase()+(v.classList[0]?"."+v.classList[0]:"")}${M}</span>`,E=v=>{let b=v.getBoundingClientRect(),M=getComputedStyle(v),I=parseFloat(M.paddingTop),O=parseFloat(M.paddingRight),it=parseFloat(M.paddingBottom),rt=parseFloat(M.paddingLeft),X=H(b);X+=c(b.left,b.top,b.width,I,I>=2?r(I):""),X+=c(b.left,b.bottom-it,b.width,it,it>=2?r(it):""),X+=c(b.left,b.top+I,rt,b.height-I-it,rt>=2?r(rt):""),X+=c(b.right-O,b.top+I,O,b.height-I-it,O>=2?r(O):"");let K=parseFloat(M.marginTop),et=parseFloat(M.marginRight),ct=parseFloat(M.marginBottom),mt=parseFloat(M.marginLeft);X+=c(b.left,b.top-K,b.width,K,K>=2?r(K):"","m"),X+=c(b.left,b.bottom,b.width,ct,ct>=2?r(ct):"","m"),X+=c(b.left-mt,b.top,mt,b.height,mt>=2?r(mt):"","m"),X+=c(b.right,b.top,et,b.height,et>=2?r(et):"","m"),X+=L(v,M);let qt=parseFloat(M.columnGap)||0,te=parseFloat(M.rowGap)||0,Ft=(M.display.includes("flex")||M.display.includes("grid"))&&(qt||te)?` \xB7 gap ${r(qt)}${te&&te!==qt?"/"+r(te):""}`:"",kt="",Nt=v.parentElement;if(v.matches(m)&&Nt){let at=getComputedStyle(Nt);X+=L(Nt,at);let It=parseFloat(at.columnGap)||parseFloat(at.rowGap)||0;kt=` \xB7 ${r(b.width)}\xD7${r(b.height)}${It&&(at.display.includes("flex")||at.display.includes("grid"))?` \xB7 gap ${r(It)} in its row`:""}`}let Gt=kt?"":` \xB7 ${Math.round(parseFloat(r(b.width)))} \xD7 ${Math.round(parseFloat(r(b.height)))}`;o.innerHTML=X+$(v,b,Gt+Ft+kt)},x=v=>{let b=v.getBoundingClientRect();o.innerHTML=H(b).replace("dt-pad-outline","dt-pad-outline dt-size-line")+`<span class="dt-pad-chip dt-size-chip" style="left:${b.left+b.width/2}px;top:${b.bottom+6}px">${Math.round(parseFloat(r(b.width)))} \xD7 ${Math.round(parseFloat(r(b.height)))}</span>`},q=v=>{let b=(v.match(/[\d.]+/g)||[]).map(Number);if(b.length<3)return v;let M="#"+b.slice(0,3).map(I=>Math.round(I).toString(16).padStart(2,"0")).join("");return b[3]!==void 0&&b[3]<1?`${M} \xB7 ${Math.round(b[3]*100)}%`:M},_=null,D=()=>{if(_)return _;let v=getComputedStyle(document.documentElement),b=document.createElement("span");b.style.display="none",document.body.append(b);let M=[];for(let I of Array.from(v)){if(!I.startsWith("--"))continue;let O=v.getPropertyValue(I).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(O))continue;b.style.color="rgb(1, 2, 3)",b.style.color=O;let it=getComputedStyle(b).color;it&&it!=="rgb(1, 2, 3)"&&M.push([it,I])}return b.remove(),M.sort((I,O)=>I[1].length-O[1].length),_=M,M},V=v=>D().find(([b])=>b===v)?.[1]??"",Z=null,wt=()=>{if(Z)return Z;let v=[],b=M=>{for(let I of Array.from(M))I instanceof CSSStyleRule?I.style.cssText.includes("var(--")&&v.push({sel:I.selectorText,style:I.style}):I instanceof CSSMediaRule?matchMedia(I.conditionText).matches&&b(I.cssRules):"cssRules"in I&&b(I.cssRules)};for(let M of Array.from(document.styleSheets))try{b(M.cssRules)}catch{}return Z=v},R={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(v=>[`border-${v}-color`,[`border-${v}-color`,"border-color",`border-${v}`,"border"]]))},T=(v,b)=>{let M=R[b]??[b],I=b==="color";for(let O=v;O;O=I?O.parentElement:null){let it=K=>M.map(et=>/var\(\s*(--[\w-]+)/.exec(K.getPropertyValue(et))?.[1]).find(Boolean),rt=O instanceof HTMLElement?it(O.style):void 0;if(rt)return rt;let X="";for(let K of wt()){let et=!1;try{et=O.matches(K.sel)}catch{}et&&(X=it(K.style)||X)}if(X)return X;if(I&&O.parentElement&&getComputedStyle(O).color!==getComputedStyle(O.parentElement).color)break}return""},S=(v,b,M)=>{let I=getComputedStyle(v).getPropertyValue(b).trim();if(!I)return q(M);let O=document.createElement("span");if(O.style.display="none",O.style.color=I,!O.style.color)return q(M);document.body.append(O);let it=getComputedStyle(O).color;return O.remove(),q(it)},P=(v,b,M)=>{let I=T(v,b);if(I)return`<b class="dt-var">${I}</b> <em>${S(v,I,M)}</em>`;let O=V(M);return O?`<span title="Same value as ${O}; not written with it">\u2248 ${O}</span> <em>${q(M)}</em>`:q(M)},tt=v=>`<i class="dt-type-sw" style="background:${v}"></i>`,F={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},nt=v=>(v.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),ht=(v,b)=>v.slice(0,3).map((M,I)=>M*v[3]+b[I]*(1-v[3])).concat([1]),Dt=v=>{let b=[];for(let M=v;M;M=M.parentElement){let I=getComputedStyle(M);if(I.backgroundImage!=="none")return null;let O=nt(I.backgroundColor);if(O[3]>0&&(b.push(O),O[3]>=1))break}return b.reduceRight((M,I)=>ht(I,M),[255,255,255,1])},jt=v=>{let[b,M,I]=v.slice(0,3).map(O=>(O/=255,O<=.03928?O/12.92:((O+.055)/1.055)**2.4));return .2126*b+.7152*M+.0722*I},ve=(v,b,M)=>{let I=Dt(v);if(!I)return["Contrast","<em>on an image</em>"];let O=ht(nt(b.color),I),[it,rt]=[jt(O),jt(I)].sort((ct,mt)=>mt-ct),X=(it+.05)/(rt+.05),K=M>=24||M>=18.66&&Number(b.fontWeight)>=700,et=X>=(K?4.5:7)?"AAA":X>=(K?3:4.5)?"AA":"fails AA";return["Contrast",`${X.toFixed(2)}:1 <em class="${et==="fails AA"?"dt-type-bad":""}">${et}${K?" \xB7 large":""}</em>`]},A=v=>{let b=v.getBoundingClientRect(),M=getComputedStyle(v),I=parseFloat(M.fontSize),O=M.lineHeight==="normal"?0:parseFloat(M.lineHeight),it=parseFloat(M.letterSpacing)||0,rt=mt=>`${(mt*100).toFixed(1).replace(/\.0$/,"")}%`,X=[["Font",M.fontFamily.split(",")[0].replace(/["']/g,"")+(M.fontStyle!=="normal"?` ${M.fontStyle}`:"")],["Weight",`${F[M.fontWeight]??""} <em>${M.fontWeight}</em>`],["Size",`${r(I)}px`],["Line",O?`${rt(O/I)} <em>${r(O)}px</em>`:"normal"],["Letter",it?`${rt(it/I)} <em>${it.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",tt(M.color)+P(v,"color",M.color)],ve(v,M,I)],et=b.bottom+150<innerHeight?b.bottom+8:Math.max(8,b.top-158),ct=Math.min(Math.max(8,b.left),innerWidth-210);o.innerHTML=H(b)+$(v,b)+`<div class="dt-type-card" style="left:${ct}px;top:${et}px">${X.map(([mt,qt])=>`<span class="dt-type-row"><b>${mt}</b><span>${qt}</span></span>`).join("")}</div>`},lt=v=>v.every(b=>b===v[0])?v[0]:v[1]===v[3]&&v[0]===v[2]?`${v[0]} ${v[1]}`:v.join(" "),Ct=v=>/^rgba\(.*,\s*0\)$|^transparent$/.test(v),At=(v,b,M,I="")=>{let O=20+M.length*21,rt=b.bottom+O+12<innerHeight?b.bottom+8:Math.max(8,b.top-O-8),X=Math.min(Math.max(8,b.left),innerWidth-230);o.innerHTML=`<span class="dt-pad-outline" style="left:${b.left}px;top:${b.top}px;width:${b.width}px;height:${b.height}px${I?`;border-radius:${I}`:""}"></span>`+$(v,b)+`<div class="dt-type-card dt-style-card" style="left:${X}px;top:${rt}px">${M.map(([K,et])=>`<span class="dt-type-row"><b>${K}</b><span>${et}</span></span>`).join("")}</div>`},Yt=v=>{let b=getComputedStyle(v),M=[];b.backgroundImage!=="none"&&M.push(["Fill",`<em>${/gradient/.test(b.backgroundImage)?"gradient":"image"}</em>`]),Ct(b.backgroundColor)||M.push(["Fill",tt(b.backgroundColor)+P(v,"background-color",b.backgroundColor)]),v.textContent?.trim()&&M.push(["Text",tt(b.color)+P(v,"color",b.color)]),M.push(["Opacity",`${Math.round(Number(b.opacity)*100)}%`]),M.length||M.push(["Color","<em>no fill or text</em>"]),At(v,v.getBoundingClientRect(),M)},Wt=v=>{let b=getComputedStyle(v),M=[],I=["top","right","bottom","left"],O=I.map(rt=>parseFloat(b.getPropertyValue(`border-${rt}-width`))||0);if(O.some(rt=>rt>0)){let rt=I.filter((K,et)=>O[et]>0);I.forEach((K,et)=>M.push([K[0].toUpperCase()+K.slice(1),`${r(O[et])} <em>${b.getPropertyValue(`border-${K}-style`)}</em>`]));let X=rt.map(K=>b.getPropertyValue(`border-${K}-color`));rt.forEach((K,et)=>{et&&X[et]===X[0]||M.push([et?`\u21B3 ${K}`:"Color",tt(X[et])+P(v,`border-${K}-color`,X[et])])})}else M.push(["Width","<em>none</em>"]);let it=["top-left","top-right","bottom-right","bottom-left"].map(rt=>{let[X,K=X]=b.getPropertyValue(`border-${rt}-radius`).split(" "),et=ct=>ct.endsWith("%")?ct:r(parseFloat(ct)||0);return X===K?et(X):`${et(X)}/${et(K)}`});M.push(["Radius",lt(it)]),At(v,v.getBoundingClientRect(),M,b.borderRadius)},ee=(v,b)=>{let[M,I]=[jt(v),jt(b)].sort((O,it)=>it-O);return(M+.05)/(I+.05)},ne=v=>"#"+v.slice(0,3).map(b=>Math.round(b).toString(16).padStart(2,"0")).join(""),$t=(v,b,M)=>{let[I,O,it]=v.map(Ft=>Ft/255),rt=Math.max(I,O,it),X=Math.min(I,O,it),K=(rt+X)/2,et=rt-X,ct=et?et/(1-Math.abs(2*K-1)):0,mt=et?rt===I?((O-it)/et%6+6)%6:rt===O?(it-I)/et+2:(I-O)/et+4:0,qt=Ft=>{let kt=(1-Math.abs(2*Ft-1))*ct,Nt=kt*(1-Math.abs(mt%2-1)),Gt=Ft-kt/2,[at,It,on]=mt<1?[kt,Nt,0]:mt<2?[Nt,kt,0]:mt<3?[0,kt,Nt]:mt<4?[0,Nt,kt]:mt<5?[Nt,0,kt]:[kt,0,Nt];return[at,It,on].map(Ie=>Math.min(255,Math.max(0,Math.round((Ie+Gt)*255)))).concat([1])},te=jt(v)>=jt(b);for(let Ft of te?[1,-1]:[-1,1]){let kt=Ft>0?1:0;if(ee(qt(kt),b)<M)continue;let Nt=K,Gt=kt;for(let at=0;at<20;at++){let It=(Nt+Gt)/2;ee(qt(It),b)>=M?Gt=It:Nt=It}return qt(Gt)}return null},St={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>'},ft=v=>`${v.toFixed(1).replace(/\.0$/,"")} : 1`,yt="",ye=null,Ht=!1,Ye=v=>{v!==ye&&(ye=v,Ht=!1),yt="";let b=v.getBoundingClientRect(),M=(v instanceof HTMLInputElement||v instanceof HTMLTextAreaElement)&&!v.value&&!!v.placeholder,I=getComputedStyle(v,M?"::placeholder":null),O=parseFloat(I.fontSize),it=O>=24||O>=18.66&&Number(I.fontWeight)>=700,rt=Dt(v),X=ct=>`<i class="dt-type-sw" style="background:${ct}"></i>`,K;if(!v.textContent?.trim()&&!M&&!(v instanceof HTMLInputElement&&v.value))K='<p class="dt-ct-note">Point at some text.</p>';else if(!rt)K='<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 ct=ht(nt(I.color),rt),mt=ee(ct,rt),qt=it?3:4.5,te=mt>=7?["ok",St.ok+"AAA"]:mt>=4.5?["ok",St.ok+"AA"]:mt>=3?["warn","Large text only"]:["bad","Fails"],Ft=`<div class="dt-ct-ratio"><b>${ft(mt)}</b><span class="dt-ct-chip dt-ct-chip--${te[0]}">${te[1]}</span></div>`;if(mt>=7){K=Ft,o.innerHTML=H(b)+$(v,b,M?" \xB7 placeholder":"")+vn(b,41,`<div class="dt-ct-card dt-ct-card--one">${K}</div>`);return}let kt=(Gt,at)=>`<div class="dt-ct-check">${mt>=at?St.ok:St.x}<span>${Gt}</span><em>${ft(at).replace(".0","")}</em></div>`,Nt=mt>=qt?null:$t(ct,rt,qt);Nt&&(yt=ne(Nt)),K=`<div class="dt-ct-pair"><div><span>Text</span><b>${X(ne(ct))}${ne(ct)}</b></div><div><span>Background</span><b>${X(ne(rt))}${ne(rt)}</b></div></div>`+Ft+kt("Body text \xB7 AA",4.5)+kt("Large text \xB7 AA",3)+kt("Body text \xB7 AAA",7)+(yt?Ht?`<div class="dt-ct-fix dt-ct-fix--done">${St.ok}<span>Copied ${yt}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${X(yt)}${yt}</b>${St.copy}</div>`:"")}let et=`<div class="dt-ct-card"><div class="dt-ct-head">${St.half}<span>Contrast</span></div>${K}</div>`;o.innerHTML=H(b)+$(v,b,M?" \xB7 placeholder":"")+vn(b,210,et)},vn=(v,b,M)=>{let I=v.bottom+b+12<innerHeight?v.bottom+8:Math.max(8,v.top-b-8),O=Math.min(Math.max(8,v.left),innerWidth-260);return M.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${O}px;top:${I}px"`)};return{spacer:y,drawPads:E,drawSize:x,drawType:A,drawColor:Yt,drawBorder:Wt,drawContrast:Ye,contrastFix:()=>yt,markCopied:()=>{Ht=!0}}}var Qt=o=>(o??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),dd=(o,r,c=!1)=>{for(let h=r*4;;h*=4){let m=c?Qt(o.slice(0,h)).replace(/\s+/g," "):Qt(o.slice(0,h));if(m.length>=r||h>=o.length)return m}},Do=(o,r,c=!1)=>Zt(dd(o,r,c),r),cd='[class^="dt-"],[class*=" dt-"],.devtools',Ns=o=>{let r=o;for(;r.parentElement&&r.parentElement!==document.body;)r=r.parentElement;return r.parentElement===document.body&&r.matches(cd)};function ud(){let o=(R,T)=>R?[...R.children].filter(S=>S.tagName.toUpperCase()===T.toUpperCase()&&!(R===document.body&&S.matches(cd))):[],r=R=>{let T=[],S=R;for(;S&&S.tagName!=="HTML"&&T.length<8;){if(S.id){T.unshift("#"+CSS.escape(S.id));break}let P=S.parentElement,tt=S.tagName.toLowerCase(),F=o(P,S.tagName),nt=P===document.body&&F.length>1?[...S.classList].find(ht=>/^[\w-]+$/.test(ht)&&F.filter(Dt=>Dt.classList.contains(ht)).length===1):void 0;T.unshift(nt?`${tt}.${nt}`:F.length>1?`${tt}:nth-of-type(${F.indexOf(S)+1})`:tt),S=P}return T.join(">")},c=R=>{let T=R.split(">"),S=null;for(let[P,tt]of T.entries()){if(tt.startsWith("#")){if(P)return null;S=document.querySelector(tt);continue}let F=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec(tt);if(!F)return document.querySelector(R);if(!S){if(F[1]!=="body"||F[2]||F[3])return document.querySelector(R);S=document.body;continue}let nt=o(S,F[1].toUpperCase());if(S=(F[2]?nt.find(ht=>ht.classList.contains(F[2])):nt[F[3]?Number(F[3])-1:0])??null,!S)return null}return S},h=R=>R.replace(/\s+/g," ").trim(),m=(R,T)=>{if(!T)return!0;let S=dd(R.textContent||"",60),P=h(T);return h(Zt(S,60))===P||h(S.slice(0,60))===P},y=(R,T)=>[R||"*",...(T||[]).map(S=>"."+CSS.escape(S))].join(""),L=R=>{try{return[...document.querySelectorAll(y(R.tag,R.classes))].filter(T=>!Ns(T))}catch{return[]}},$=R=>{let T=R.textContent||"",S=null;for(let P=R.parentElement,tt=0;P&&P!==document.body&&tt<4;P=P.parentElement,tt++){let F=P.textContent||"";if(F===T)continue;let nt=Do(F,80,!0);if(nt&&(nt!==Do(T,80,!0)||(S??=Qt(T).replace(/\s+/g," "),Qt(F).replace(/\s+/g," ")!==S)))return nt}return""},E=R=>$(R),x=(R,T)=>!T||$(R).startsWith(T),q=R=>{let T=null;try{T=c(R.selector)}catch{T=null}if(T&&Ns(T)&&(T=null),T&&m(T,R.label)&&x(T,R.ctx))return T;let S=L(R),P=Qt(R.label)?S.filter(ht=>m(ht,R.label)):[],tt=(R.ctx?P.find(ht=>x(ht,R.ctx)):P.length===1?P[0]:void 0)??S.find(ht=>R.ctx&&x(ht,R.ctx)&&!Qt(R.label));if(tt)return tt;let F=ht=>ht.split(">").slice(0,2).join(">"),nt=ht=>!R.ctx&&F(r(ht))===F(R.selector);return Qt(R.label)?T&&!R.ctx&&m(T,R.label)?T:P.length===1&&nt(P[0])?P[0]:null:T||(R.nth!=null?S[R.nth]??null:null)},_=R=>{let T=null;for(let S=R,P=R.parentElement;P&&P!==document.body&&getComputedStyle(S).position!=="fixed";S=P,P=P.parentElement){let tt=getComputedStyle(P);if(tt.overflowX==="visible"&&tt.overflowY==="visible")continue;let F=P.getBoundingClientRect();T=T?{l:Math.max(T.l,F.left),t:Math.max(T.t,F.top),r:Math.min(T.r,F.right),b:Math.min(T.b,F.bottom)}:{l:F.left,t:F.top,r:F.right,b:F.bottom}}return T},D=R=>{let T=R.getBoundingClientRect();return(T.width>0||T.height>0)&&(!R.checkVisibility||R.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},V=R=>({...R,x:Math.min(Math.max(R.x,3),document.documentElement.clientWidth-30),y:R.y>=0&&R.y<19?19:R.y}),Z=(R,T)=>{let S=T;for(let P=T.parentElement;P&&P!==document.body;P=P.parentElement){if(!D(P)){S=P;continue}let tt=T.getBoundingClientRect();if(tt.width||tt.height)return V({x:tt.left+tt.width*R.rx,y:tt.top+tt.height*R.ry,off:"",el:T,hidden:P,shut:S});let F=P.getBoundingClientRect();return V({x:F.left,y:F.top,off:"",el:T,hidden:P,shut:S})}return null};return{cssPath:r,poolOf:L,contextOf:E,resolveEl:q,anchorOf:(R,T=q(R))=>{if(!T)return null;if(!D(T))return Z(R,T);let S=T.getBoundingClientRect(),P=S.left+S.width*R.rx,tt=S.top+S.height*R.ry,F=_(T);if(!F)return{x:P,y:tt,off:"",el:T};if(F.r-F.l<18||F.b-F.t<18)return null;let nt=Math.min(Math.max(P,F.l),F.r-18),ht=Math.min(Math.max(tt,F.t+18),F.b),Dt=P<F.l?"l":P>F.r-18?"r":tt<F.t+18?"t":tt>F.b?"b":"";return{x:nt,y:ht,off:Dt,el:T}}}}var pd=(o,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<o?r:"#fff"}" stroke="none"${c<o?"":' opacity="0.12"'}/>`).join("")}</svg>`;function hd(o,r,c){let h=document.createElement("div");h.className="dt-field-menu",h.setAttribute("role","listbox"),h.hidden=!0,document.body.append(h);for(let L of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])h.addEventListener(L,H=>H.stopPropagation());let m=null,y=()=>{h.hidden=!0,m=null};for(let L of o)L.addEventListener("mousedown",H=>{let $=H.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select");if(!$){h.contains(H.target)||y();return}if(H.preventDefault(),m===$){y();return}m=$;let E=$.classList.contains("dt-more-select"),x=Z=>E?Z.dataset.on!=null:Z.selected,q=$.dataset.search;h.innerHTML=(q?`<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(q)}" aria-label="${r(q)}" spellcheck="false"></label>`:"")+[...$.options].map((Z,wt)=>Z.hidden?"":`${Z.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${wt}" aria-selected="${x(Z)}"${Z.dataset.danger!=null?' class="is-danger"':""}>${Z.dataset.icon?Z.dataset.icon:Z.dataset.initial!=null?Z.dataset.face?`<img class="dt-face" src="${r(Z.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${r(Z.dataset.initial)}</b>`:`<i style="background:${r(Z.dataset.c||"#717171")}"></i>`}<span>${r(Z.text)}</span>${Z.dataset.hint?`<small>${r(Z.dataset.hint)}</small>`:""}${x(Z)?c:""}</button>${Z.dataset.sepAfter!=null?"<hr>":""}`).join(""),h.classList.toggle("is-people",!!q);let _=$.parentElement.getBoundingClientRect(),D=q?$.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;h.style.left=`${D?D.left+4:_.left}px`,h.style.top=`${_.bottom+4}px`,h.style.minWidth=`${D?D.width-8:Math.max(200,_.width)}px`,h.style.width=D?`${D.width-8}px`:"",h.hidden=!1;let V=h.getBoundingClientRect();(V.bottom>innerHeight-8||q&&$.closest(".dt-note"))&&(h.style.top=`${Math.max(8,_.top-4-V.height)}px`),V.right>innerWidth-8&&(h.style.left=`${Math.max(8,_.right-V.width)}px`),h.querySelector(".dt-field-search input")?.focus()});h.addEventListener("input",L=>{let H=L.target.value.trim().toLowerCase();for(let $ of h.querySelectorAll("[data-i]"))$.hidden=!!H&&!$.textContent.toLowerCase().includes(H);for(let $ of h.querySelectorAll("hr"))$.hidden=!!H}),h.addEventListener("keydown",L=>{L.key!=="Enter"||!L.target.matches("input")||(L.preventDefault(),h.querySelector("[data-i]:not([hidden])")?.click())}),h.addEventListener("click",L=>{let H=L.target.closest("[data-i]");if(!H||!m)return;let $=m;y(),!($.selectedIndex===Number(H.dataset.i)&&!$.classList.contains("dt-more-select"))&&($.selectedIndex=Number(H.dataset.i),$.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",L=>{L.key==="Escape"&&!h.hidden&&(L.stopPropagation(),y())},!0),document.addEventListener("pointerdown",L=>{!h.hidden&&!h.contains(L.target)&&!L.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select")&&y()},!0),addEventListener("scroll",L=>{h.contains(L.target)||y()},!0)}var st={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>'},ni=(o,r)=>o.toLocaleTimeString("en-US",r),qo=o=>ni(o,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),Vu={island:o=>({side:12,top:12,bottom:12,r:o.w>=430?62:55,body:o.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:o=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((o.w+32)*.12),extraH:18}),laptop:o=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((o.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function Uu(o,r,c,h,m){let y=o.w+2*r.side,L=o.h+r.top+r.bottom,H=(c-y)/2,$=`<rect class="dt-shell-screen" x="${m}" y="${r.top}" width="${o.w}" height="${o.h}" rx="${r.r}"/>`,E="";if(o.shell==="island"||o.shell==="home"||o.shell==="punch"){let x=(q,_,D)=>`<rect class="dt-shell-btn" x="${q}" y="${_}" width="4" height="${D}" rx="2"/>`;E+=o.shell==="punch"?x(H+y-1,150,70)+x(H+y-1,240,44):x(H-3,120,28)+x(H-3,170,56)+x(H-3,236,56)+x(H+y-1,190,90),E+=`<rect class="dt-shell-body" x="${H}" y="0" width="${y}" height="${L}" rx="${r.body}"/>`,E+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${y-6}" height="${L-6}" rx="${r.body-3}"/>`,o.shell==="home"&&(E+=`<rect class="dt-shell-slot" x="${c/2-26}" y="44" width="52" height="6" rx="3"/>`,E+=`<circle class="dt-shell-slot" cx="${c/2-48}" cy="47" r="5"/>`,E+=`<circle class="dt-shell-homebtn" cx="${c/2}" cy="${L-46}" r="28"/>`)}else if(o.shell==="tablet")E+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${y}" height="${L}" rx="${r.body}"/>`,E+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${y-8}" height="${L-8}" rx="${r.body-4}"/>`;else if(o.shell==="monitor"){let x=Math.round(y*.1);E+=`<path class="dt-shell-stand" d="M${c/2-x/2} ${L-2}h${x}l${x*.2} 84h${-x*1.4}z"/>`,E+=`<rect class="dt-shell-stand" x="${c/2-y*.15}" y="${L+80}" width="${y*.3}" height="14" rx="7"/>`,E+=`<rect class="dt-shell-body" x="${H}" y="0" width="${y}" height="${L}" rx="${r.body}"/>`}else{let x=y+(r.extraW??0),q=(c-x)/2,_=r.extraH??16;E+=`<path class="dt-shell-body" d="M${H} ${r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${-r.body}h${y-2*r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${r.body}V${L}H${H}z"/>`,E+=`<path class="dt-shell-base${o.shell==="macbook"?" dt-shell-base--silver":""}" d="M${q} ${L}h${x}v${_-8}a8 8 0 0 1-8 8H${q+8}a8 8 0 0 1-8-8z"/>`,E+=`<rect class="dt-shell-lip" x="${c/2-y*.07}" y="${L}" width="${y*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${c} ${h}" width="${c}" height="${h}" aria-hidden="true">${E}${$}</svg>`}var Ku={"safari-ios":o=>{let r=o.shell==="home"?20:o.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})},Yu=({d:o,now:r,cutout:c},h)=>{if(o.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${h}px"><span class="dt-sb-l">${st.signal}${st.wifi}</span><b>${qo(r)}</b><span class="dt-sb-r">${st.battery}</span></div>`;let m=c??{x:(o.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${h}px"><span class="dt-island" style="left:${m.x}px;top:${m.y}px;width:${m.width}px;height:${m.height}px"></span><b class="dt-sb-time" style="top:${m.y}px;height:${m.height}px">${qo(r)}</b><span class="dt-sb-icons" style="top:${m.y}px;height:${m.height}px">${st.signal}${st.wifi}${st.battery}</span></div>`},Xu=({d:o,host:r,min:c},h)=>{let m=o.shell==="home"?"":'<i class="dt-home-ind"></i>';return c?`<div class="dt-ios-bar is-min" style="height:${h}px"><span class="dt-ios-mini">${f(r)}</span>${m}</div>`:`<div class="dt-ios-bar" style="height:${h}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${st.back}</button><span class="dt-glass dt-ios-url"><span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${st.reload}</button></span><span class="dt-glass dt-glass--round">${st.dots}</span></div>${m}</div>`},Ju=({now:o,min:r},c)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${ni(o,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${st.wifi}${st.signal}${st.battery}</span></div>`+(r?"":`<div class="dt-and-bar"><span class="dt-and-url">${st.tune}<span>${f(c)}</span></span><span class="dt-and-tabs">1</span>${st.dotsV}</div>`),Zu=()=>`<div class="dt-and-nav">${st.recent}${st.home}${st.navBack}</div>`,Qu=({now:o,host:r})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${qo(o)} ${o.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${st.wifi}${st.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${st.sidebar}<button data-nav="back" aria-label="Back" title="Back">${st.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${st.fwd}</button></span><span class="dt-ipad-url">${st.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${st.reload}</button></span><span class="dt-bar-group">${st.share}${st.plus}${st.tabs}</span></div>`,tp=({now:o,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">${st.wifi}${st.battery}<span>${o.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${qo(o)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${st.sidebar}<button data-nav="back" aria-label="Back" title="Back">${st.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${st.fwd}</button></span><span class="dt-mac-url">${st.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${st.reload}</button></span><span class="dt-bar-group">${st.share}${st.plus}${st.tabs}</span></div>`,ep=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(o,r)=>`<i style="--hue:${r*40}"></i>`).join("")}</span></div>`,np=({host:o,title:r})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${f(r||o)}</span>${st.close}</span><span class="dt-win-new">${st.plus}</span><span class="dt-win-ctrl">${st.winMin}${st.winMax}${st.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${st.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${st.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${st.reload}</button></span><span class="dt-win-url">${st.tune}<span>${f(o)}</span>${st.star}</span><span class="dt-bar-group">${st.user}${st.dotsV}</span></div>`,sp=({now:o})=>`<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">${st.chevUp}${st.wifi}${st.volume}${st.battery}<span class="dt-win-clock">${ni(o,{hour:"numeric",minute:"2-digit"})}<br>${o.toLocaleDateString("en-US")}</span></span></div>`;function md(o,r){let c=Vu[o.shell](o),h=o.w+2*c.side,m=o.h+c.top+c.bottom,y=h+(c.extraW??0),L=m+(o.shell==="monitor"||o.shell==="macbook"||o.shell==="laptop"?c.extraH??0:0),H=(y-h)/2+c.side,$=Ku[o.browser](o),E=r.min?$.topMin??$.top:$.top,x=r.min?$.bottomMin??$.bottom:$.bottom,q={...r,d:o},_="",D="";switch(o.browser){case"safari-ios":_=Yu(q,E),D=Xu(q,x);break;case"chrome-android":_=Ju(q,r.host),D=Zu();break;case"safari-ipad":_=Qu(q),D='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":_=tp(q,o.shell==="macbook"),D=ep();break;case"chrome-windows":_=np(q),D=sp(q);break}return{footprint:{w:y,h:L},screen:{x:H,y:c.top,w:o.w,h:o.h,r:c.r,rb:c.rb??c.r},topH:E,bottomH:x,shell:Uu(o,c,y,L,H),top:_,bottom:D,canMinimize:$.topMin!==void 0&&($.topMin!==$.top||$.bottomMin!==$.bottom),scrollbar:o.browser==="chrome-windows"?"classic":"overlay"}}var Rn=null;function Rs(o){if(Rn??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!Rn||!o)return[0,0,0,0];Rn.clearRect(0,0,1,1),Rn.fillStyle="rgba(0, 0, 0, 0)",Rn.fillStyle=o,Rn.fillRect(0,0,1,1);let[r,c,h,m]=Rn.getImageData(0,0,1,1).data;return[r,c,h,m/255]}var Bs=([o,r,c])=>`rgb(${o}, ${r}, ${c})`;function gd(o){let r=o.defaultView,c=D=>!D||Rs(D)[3]===0,h=[o.body,o.documentElement].map(D=>D&&r.getComputedStyle(D).backgroundColor).find(D=>D&&!c(D)),[m,y,L,H]=h?Rs(h):[255,255,255,1],$=[m,y,L].map(D=>Math.round(D*H+255*(1-H))),E=D=>{let[V,Z,wt,R]=Rs(D);if(R>=.75)return Bs([V,Z,wt]);let T=(S,P)=>Math.round(S*R+P*(1-R));return Bs([T(V,$[0]),T(Z,$[1]),T(wt,$[2])])},x=D=>{let V=o.elementFromPoint(r.innerWidth/2,D);for(;V&&V!==o.documentElement;V=V.parentElement){let Z=r.getComputedStyle(V);if(Z.position!=="fixed"&&Z.position!=="sticky")continue;let wt=V.getBoundingClientRect().width>=r.innerWidth*.9,R=Z.backdropFilter&&Z.backdropFilter!=="none";return wt&&!R&&!c(Z.backgroundColor)?E(Z.backgroundColor):null}return null},q=o.querySelector('meta[name="theme-color"]')?.content||"",_=q&&!c(q)?Bs(Rs(q)):"";return{top:x(4)??Bs($),bottom:x(r.innerHeight-4)??Bs($),theme:_}}function si(o){let[r,c,h]=Rs(o).map(m=>m/255).map(m=>m<=.04045?m/12.92:((m+.055)/1.055)**2.4);return .2126*r+.7152*c+.0722*h>.4?"#000":"#fff"}function fd(o){let{cfg:r,inFrame:c,persist:h,frame:m,frameEl:y,devicesMenu:L,bpBtns:H,notesOverlay:$,WIDE:E,bpOf:x,currentBp:q,deviceById:_,notesOn:D,filter:V,filterTo:Z,dropFrameDrafts:wt,putAway:R,tellFrame:T,syncBpButtons:S,render:P,reread:tt}=o,F=r.breakpoints,nt=document.querySelector(".dt-device"),ht=document.querySelector(".dt-shell"),Dt=document.querySelector('.dt-chrome[data-at="top"]'),jt=document.querySelector('.dt-chrome[data-at="bottom"]'),ve=document.querySelector(".dt-ruler"),A=[...document.querySelectorAll(".dt-frame-handle")],lt=document.querySelector(".dt-frame-size"),Ct=document.querySelector(".dt-frame-rotate"),At=document.querySelector(".dt-frame-bars"),Yt="overlay",Wt="",ee="dt-w",ne="dt-canvas",$t="dt-device",St=ot.getItem(ne)==="1",ft=ot.getItem($t)||"";ft&&!_(ft)&&(ft="",ot.setItem($t,""));let yt=Number(ot.getItem(ee))||0,ye="dt-emu",Ht=(()=>{try{return JSON.parse(ot.getItem(ye)||"null")}catch{return null}})(),Ye=()=>Ht?Cs.find(k=>k.id===Ht.id)??null:null,vn=()=>{let k=Ye();return k?Ht.turned?{w:k.h,h:k.w}:{w:k.w,h:k.h}:null},ce=ot.getItem("dt-bars-min")==="1",we=k=>{Ht=k,h(ye,k?JSON.stringify(k):"")},v=k=>{lt.textContent=k,m.style.setProperty("--dt-badge-w",`${lt.offsetWidth}px`)},b=k=>{if(!k){ve.innerHTML="";return}let B="";for(let W=0;W<=k;W+=50)B+=`<span class="dt-tick${W%200===0?" is-major":""}" style="left:${W}px"></span>`;for(let W of F)for(let dt of[W.min,W.max])dt>0&&Number.isFinite(dt)&&dt<=k&&(B+=`<span class="dt-edge" style="left:${dt}px" title="${W.label} edge"></span>`);ve.innerHTML=B,ve.style.width=`${k}px`},M=()=>{let k=parseFloat(nt.style.width)||0,B=parseFloat(nt.style.height)||0;if(!k||!B){nt.style.transform="",delete nt.dataset.scaled;return}let W=ft||Ht?Math.min(1,(innerWidth-80)/k,(innerHeight-120)/B):Math.min(1,(innerWidth-80)/k);nt.style.transform=W<1?`scale(${W})`:"",nt.dataset.scaled=W<1?String(Math.round(W*100)):""},I=k=>Cs.find(B=>B.w===k.w&&B.h===k.h&&B.cutout?.shape==="pill")?.cutout,O=()=>{try{return y.contentDocument}catch{return null}},it=()=>O()?.title.split("\u2014").pop()?.trim()||"",rt=()=>{let k=O(),B=ft?_(ft):null;if(!k?.body||!B)return;let W=gd(k),dt=B.browser==="chrome-android"?W.theme||"rgb(255, 255, 255)":W.top,bt=B.browser==="chrome-android"?"rgb(255, 255, 255)":W.bottom;nt.style.setProperty("--dt-top",dt),nt.style.setProperty("--dt-top-ink",si(dt)),nt.style.setProperty("--dt-bottom",bt),nt.style.setProperty("--dt-bottom-ink",si(bt));let se=Dt.querySelector(".dt-win-tab > span");se&&(se.textContent=it()||location.host)},X=0;y.addEventListener("load",()=>{let k=O();if(!k)return;let B=window.__notemendHosted;if(B&&!y.contentWindow?.__notemendHosted&&!k.querySelector(`script[src^="${B.base}/bar.js"]`)){let W=k.createElement("script");W.src=`${B.base}/bar.js`,W.dataset.project=B.project,k.head.append(W)}rt(),y.contentWindow?.addEventListener("scroll",()=>{X||(X=requestAnimationFrame(()=>{X=0,rt()}))},{passive:!0})});for(let k of[Dt,jt])k.addEventListener("click",B=>{let W=B.target.closest("[data-nav]")?.dataset.nav;if(W)try{let dt=y.contentWindow?.navigation;if(!O()||!dt)throw new Error("foreign");W==="back"?dt.canGoBack&&dt.back():W==="fwd"?dt.canGoForward&&dt.forward():dt.reload()}catch{(W==="reload"||W==="back")&&(y.src=location.href)}});At.addEventListener("click",()=>{ce=!ce,h("dt-bars-min",ce?"1":"0"),ct()});let K=[],et=k=>{for(let B of K)B.inert=!1;K=k?[...document.body.children].filter(B=>B instanceof HTMLElement&&!B.inert&&!B.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let B of K)B.inert=!0},ct=()=>{if(c)return;let k=ft?_(ft)??null:null;if(ft&&!k&&(ft="",ot.setItem($t,"")),!k&&!St){let B="";try{let W=y.getAttribute("src")?y.contentWindow?.location:null;W?.origin===location.origin&&(B=W.pathname+W.search+W.hash)}catch{}if(m.hidden=!0,et(!1),y.removeAttribute("src"),Kt.toggle("dt-framing",!1),$.hidden=!D(),ve.innerHTML="",S(),Ct.hidden=!0,At.hidden=!0,Z(null),Wt="",wt(),S(),Gt(),B&&B!==location.pathname+location.search+location.hash){location.assign(B);return}tt();return}if(m.hidden=!1,et(!0),Kt.toggle("dt-framing",!0),$.hidden=!0,y.src||(y.src=location.href),k){let B=md(k,{host:location.host,title:it(),now:new Date,min:ce,cutout:I(k)}),{screen:W}=B;m.dataset.mode="device",nt.dataset.shell=k.shell,nt.dataset.browser=k.browser,nt.style.width=`${B.footprint.w}px`,nt.style.height=`${B.footprint.h}px`,nt.style.setProperty("--dt-r",`${W.r}px`),nt.style.setProperty("--dt-rb",`${W.rb}px`),ht.innerHTML=B.shell;let dt=(ue,Oe,U,an)=>{ue.innerHTML=an,ue.style.cssText=`left:${W.x}px;top:${Oe}px;width:${W.w}px;height:${U}px`};dt(Dt,W.y,B.topH,B.top),dt(jt,W.y+W.h-B.bottomH,B.bottomH,B.bottom);let bt=W.h-B.topH-B.bottomH;y.style.position="absolute",y.style.left=`${W.x}px`,y.style.top=`${W.y+B.topH}px`,y.style.width=`${W.w}px`,y.style.height=`${bt}px`,ve.innerHTML="";let se=ce&&B.canMinimize;Yt=B.scrollbar,Wt=`${k.label}${se?" \xB7 bars folded":""}`,Z(x(k.w)),T({notes:D(),scrollbar:Yt,device:Wt}),At.hidden=!B.canMinimize,At.setAttribute("aria-pressed",String(se)),v(`${k.label} ${k.w}\xD7${k.h} \xB7 page ${k.w}\xD7${bt}${se?" \xB7 bars folded":""} \xB7 ${F.find(ue=>ue.id===V())?.label??""}`),rt()}else{let B=vn();B||we(null);let W=B?.w||yt||F.find(se=>se.id===q()).ideal;yt=W,m.dataset.mode="canvas",delete nt.dataset.shell,delete nt.dataset.browser,ht.innerHTML=Dt.innerHTML=jt.innerHTML="",Dt.style.cssText=jt.style.cssText="",At.hidden=!0,Yt="overlay",nt.style.width=`${W}px`,nt.style.height=`${B?.h??innerHeight-84}px`,y.style.position="",y.style.left=y.style.top="",y.style.width="100%",y.style.height="100%",b(W),T({notes:D()});let dt=F.find(se=>se.id===x(W)),bt=Ye();Wt=bt?`${bt.label}${Ht?.turned?" \xB7 landscape":""}`:"",T({scrollbar:Yt,device:Wt}),v(bt&&B?`${bt.label} \xB7 ${B.w}\xD7${B.h} \xB7 ${dt.label}`:`${W}px \xB7 ${dt.label}`),Z(x(W))}Ct.hidden=!(Ye()?.rotates&&!k),Gt(),M(),S(),tt()},mt=k=>{let B=F.find(W=>W.id===k);ft="",ot.setItem($t,""),we(null),St=q()!==k,yt=St?B.ideal:0,Z(St?k:null),ot.setItem(ne,St?"1":"0"),ot.setItem(ee,String(yt)),R(),ct()};for(let k of H)k.addEventListener("click",()=>mt(k.dataset.bp));for(let k of document.querySelectorAll("[data-device]"))k.addEventListener("click",()=>{ft=k.dataset.device===ft?"":k.dataset.device,ot.setItem($t,ft),L.open=!1,ct()});for(let k of document.querySelectorAll("[data-emu]"))k.addEventListener("click",()=>{let B=Ht?.id===k.dataset.emu&&!ft;ft="",ot.setItem($t,""),we(B?null:{id:k.dataset.emu,turned:!1}),St=!B,yt=0,ot.setItem(ne,St?"1":"0"),Z(null),R(),L.open=!1,ct()});Ct.addEventListener("click",()=>{Ht&&(we({...Ht,turned:!Ht.turned}),R(),ct())});let qt=[...L.querySelectorAll("[data-tab]")],te=[...L.querySelectorAll("[data-panel]")],Ft=k=>{for(let B of qt)B.setAttribute("aria-selected",String(B.dataset.tab===k));for(let B of te)B.hidden=B.dataset.panel!==k;h("dt-devices-tab",k)};for(let k of qt)k.addEventListener("click",()=>Ft(k.dataset.tab));Ft(ot.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let kt=L.querySelector(".dt-emu-search");kt.addEventListener("input",()=>{let k=kt.value.trim().toLowerCase(),B=null,W=!1,dt=()=>{B&&(B.hidden=!W)};for(let bt of kt.parentElement.children){if(bt.classList.contains("dt-devices-group")){dt(),B=bt,W=!1;continue}bt.dataset.emu&&(bt.hidden=!!k&&!bt.textContent.toLowerCase().includes(k),W||=!bt.hidden)}dt()});let Nt=L.querySelector(".dt-devices-name");function Gt(){for(let B of L.querySelectorAll("[data-device]"))B.setAttribute("aria-pressed",String(B.dataset.device===ft));let k=!ft&&!m.hidden?Ht?.id:void 0;for(let B of L.querySelectorAll("[data-emu]"))B.setAttribute("aria-pressed",String(B.dataset.emu===k));Nt.textContent=ft&&_(ft)?.label||k&&Ye()?.label||"Device"}let at=k=>F.find(B=>B.id===k),It=k=>{let B=at(V()??q());return Math.max(B.min||320,Math.min(Number.isFinite(B.max)?B.max:2560,Math.round(k)))};for(let k of A){let B=k.dataset.edge==="l"?-1:1;k.addEventListener("pointerdown",W=>{if(ft)return;W.preventDefault(),Ht&&(we(null),ct()),k.setPointerCapture(W.pointerId);let dt=W.clientX,bt=yt,se=Number(nt.dataset.scaled||100)/100;m.dataset.dragging="1";let ue=U=>{yt=It(bt+B*(U.clientX-dt)*2/se),nt.style.width=`${yt}px`,b(yt),v(`${yt}px \xB7 ${at(x(yt)).label}`),M()},Oe=()=>{k.removeEventListener("pointermove",ue),k.removeEventListener("pointerup",Oe),k.removeEventListener("pointercancel",Oe),delete m.dataset.dragging,ot.setItem(ee,String(yt)),ct()};k.addEventListener("pointermove",ue),k.addEventListener("pointerup",Oe),k.addEventListener("pointercancel",Oe)}),k.addEventListener("dblclick",()=>{if(ft)return;we(null);let W=at(V()??q()),dt=[W.min||320,Number.isFinite(W.max)?W.max:W.ideal];yt=Math.abs(yt-dt[0])<Math.abs(yt-dt[1])?dt[0]:dt[1],ot.setItem(ee,String(yt)),ct()})}let on=q(),Ie=()=>{let k=F.find(B=>B.id===E);return St&&!ft&&!Ht&&yt===k.ideal&&innerWidth>=k.min};return addEventListener("resize",()=>{if(Ie()){mt(E);return}S(),q()!==on&&(on=q(),P()),m.hidden||(!ft&&!Ht&&(nt.style.height=`${innerHeight-84}px`),M())}),{apply:ct,pickBp:mt,look:()=>({scrollbar:Yt,device:Wt}),restore:()=>{Ie()?mt(E):St||ft?ct():Gt()}}}var bd='<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>',op='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function vd(o){let{bp:r,notes:c,breakpoints:h,bandOfNote:m,statusTools:y,showResolved:L,showArchived:H,drafts:$,find:E}=o,x=c.filter(A=>m(A)===r),q=A=>[A.text,A.note,A.byName,...(A.replies??[]).filter(lt=>!lt.deleted).map(lt=>lt.text)].join(" ").toLowerCase(),_=A=>E.view==="me"?o.forMe(A):E.view==="agent"?o.forAgent(A):!0,D=A=>Date.parse(A.updatedAt||A.createdAt||"")||0,V=x.filter(A=>_(A)&&(!E.q||q(A).includes(E.q.trim().toLowerCase()))).sort((A,lt)=>(E.sort==="unread"?Number(o.unread(lt))-Number(o.unread(A)):0)||D(lt)-D(A)),Z={open:[],claude:[],done:[],archived:[]};for(let A of V)Z[Mt(A)==="done"&&o.archived(A)?"archived":Mt(A)].push(A);let wt=A=>{let lt=(A.replies??[]).filter($t=>!$t.deleted),Ct=sn(A.category),At=Mt(A),Yt=o.orphan(A),Wt=lt.length?lt[lt.length-1]:A.note?{author:"claude",text:A.note}:{author:"you",text:A.text},ee=($t,St)=>$t.by&&St.by?$t.by===St.by:$t.byName===St.byName,ne=o.unread(A);return`<div class="dt-hist-row is-${At}${At==="done"?o.archived(A)?" is-archived":" is-resolved":""}${Yt?" is-orphan":""}${ne?" is-unread":""}">
|
|
185
|
+
<button class="dt-hist-go" data-go="${A.id}">
|
|
186
|
+
${o.marker(A)}
|
|
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">${f(A.byName||"You")}</b><i class="dt-hist-type" data-tip="${f(Ct.label)}">${ts(Ct)}</i>${At==="open"?o.stage(A):""}${($t=>`<em${$t?' class="is-live"':""}>${$t?.[0]??""}#${A.id>0?A.id:"\u2026"} \xB7 ${$t?f($t[1]):An(A.updatedAt||A.createdAt)}</em>`)(o.live(A))}${Yt?'<b class="dt-hist-orphan" title="The element is not on this page any more">gone</b>':o.hiddenNow(A)?'<b class="dt-hist-orphan is-hidden" title="Inside a menu or a popup that is closed now \u2014 open it and the pin moves onto it">hidden</b>':""}${ne?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
|
|
189
|
+
<span class="dt-hist-text">${Wt.author==="claude"?($t=>`<b class="dt-hist-ai" role="img" aria-label="${$t}:" title="${$t}">${de(12)}</b>`)(f(Ue(Wt.agent))):lt.length&&!ee(Wt,A)?`<b class="dt-hist-by">${f(Wt.byName||"Someone")}:</b> `:""}${f(Ul(Wt.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">${Fn}</span>
|
|
192
|
+
${o.step(A)}<span class="dt-note-tools dt-hist-tools">${o.assign(A)}<span class="dt-hist-well">${y(A)}${o.deletable(A)?`<button data-rm="${A.id}" title="Delete this thread">${Hn}</button>`:""}</span></span>
|
|
193
|
+
</div>`},R=h.map(A=>{let lt=c.filter(Ct=>m(Ct)===A.id&&Mt(Ct)!=="done");return{band:A,open:lt.filter(Ct=>Mt(Ct)==="open").length,total:lt.length}}).filter(A=>A.total&&A.band.id!==r),T=R.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${R.map(({band:A,open:lt,total:Ct})=>{let At=`${A.label}: ${lt} open \xB7 ${Ct-lt} to check`;return`<button data-bp="${A.id}" data-state="${lt?"open":"claude"}" title="${At}" aria-label="${At}"
|
|
194
|
+
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${A.icon}</svg><i>${Ct}</i></button>`}).join("")}</div>`:"",S=["open","claude","done","archived"],P={...sd,archived:"Archived"},tt=(A,lt,Ct)=>`<button type="button" class="dt-hist-gfold" data-gfold="${A}" aria-expanded="${!o.shut(A)}"
|
|
195
|
+
><svg viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${o.shut(A)?"m9 18 6-6-6-6":"m6 9 6 6 6-6"}"/></svg>${F[A]??""}${lt}<em>${Ct}</em></button>`,F={open:Ae("#0d99ff",0),claude:Ae("#8e4ec6",.5),done:Ae("#30a46c",1)},nt=S.filter(A=>Z[A].length&&(A==="done"?L:A==="archived"?H:!0)),ht=A=>`<div class="dt-hist-row is-draft">
|
|
196
|
+
<button class="dt-hist-go" data-draft-go="${A.i}">
|
|
197
|
+
<span class="dt-hist-n">${Qn}</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">${f(A.el)}${A.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">${A.text?f(A.text):`${A.shots} screenshot${A.shots===1?"":"s"}`}</span>
|
|
185
201
|
</span>
|
|
186
202
|
</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
|
-
${
|
|
203
|
+
<span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${A.i}" title="Discard this draft">${Hn}</button></span></span>
|
|
204
|
+
</div>`,Dt=x.filter(A=>Mt(A)!=="done"),jt=(A,lt,Ct,At,Yt)=>`<button type="button" role="menuitemradio" aria-checked="${At}" ${A}="${lt}"><i>${At?be:""}</i><span>${Ct}</span>${Yt==null?"":`<em>${Yt}</em>`}</button>`,ve=()=>`<div class="dt-hist-find">
|
|
205
|
+
<label class="dt-hist-search">${bd}<input type="search" data-hist-q placeholder="Search threads" aria-label="Search threads" value="${f(E.q)}" spellcheck="false">${E.q?`<button type="button" data-hist-clear aria-label="Clear search">${fn}</button>`:'<kbd aria-hidden="true">/</kbd>'}</label>
|
|
206
|
+
<button type="button" class="dt-tip-r dt-hist-filter${E.view!=="all"||E.sort!=="new"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${E.menu}" data-tip="Filter">${op}</button>
|
|
207
|
+
${E.menu?`<div class="dt-hist-menu" role="menu">${jt("data-hist-view","me","For me",E.view==="me",Dt.filter(o.forMe).length)}${jt("data-hist-view","agent","Claude",E.view==="agent",Dt.filter(o.forAgent).length)}${jt("data-hist-view","all","All",E.view==="all",Dt.length)}<hr>${jt("data-hist-sort","new","Newest",E.sort==="new")}${jt("data-hist-sort","unread","Unread first",E.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
|
+
${o.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
|
+
${T}
|
|
214
|
+
${o.checks&&!o.clients?`<button class="dt-review-btn" data-review aria-label="Check all ${o.checks} ${o.checks===1?"fix":"fixes"}" data-tip="${o.checks} ${o.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${o.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="${!o.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>`+(o.folded?"":ve()+(nt.length||$.length?`<div class="dt-hist-list">${$.length?`<p class="dt-hist-group">${tt("drafts","Drafts",$.length)}</p>${o.shut("drafts")?"":$.map(ht).join("")}`:""}${nt.map(A=>`<p class="dt-hist-group">${tt(A,P[A],Z[A].length)}${A==="done"&&o.archives?`<button type="button" class="dt-tip-r dt-hist-archive-all" data-archive-all="${Z.done.map(lt=>lt.id).join(",")}" data-tip="Archive every resolved thread here">${gn}Archive all</button>`:""}</p>`+(o.shut(A)?"":Z[A].map(wt).join(""))).join("")}</div>`:E.q.trim()?`<div class="dt-hist-empty">${bd}<p>No threads match \xAB${f(E.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:E.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>${Z.done.length||Z.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="${L}"
|
|
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">${qe}</button>`,w.hidden=!1};w.addEventListener("click",async L=>{let st=L.target.closest("[data-r]"),ut=Z();if(!st||!ut)return;if(st.dataset.r==="stop"){F(null),w.hidden=!0;return}if(st.dataset.r==="prev"){et();return}let mt=ut.ids[ut.i];F({...ut,i:ut.i+1});let at=d().find(Ct=>Ct.id===mt),se=st.dataset.r==="ok"&&at?k(at):st.dataset.r==="no"?v(mt,!1):null;G(),await se});let et=()=>{let L=Z();if(L){for(let st=L.i-1;st>=0;st--)if(y(L.ids[st])){F({...L,i:st}),G();return}}};return document.addEventListener("keydown",L=>{w.hidden||L.metaKey||L.ctrlKey||L.altKey||L.key!=="ArrowLeft"&&L.key!=="ArrowRight"||L.target.closest?.("input, textarea, select, [contenteditable]")||(L.preventDefault(),L.key==="ArrowLeft"?et():w.querySelector('[data-r="skip"]')?.click())}),{start:D,toCheck:A,resume:()=>{Z()&&G()}}}function ar(s,i){let d=null,h=null,m=document.querySelector(".dt-turbo"),v="/notemend:turbo",S=()=>{let H=!!d&&Date.now()-Date.parse(d.at)<18e4,b=H?d.mode==="push"?"push":h?.paused?"paused":"on":"none",k=H?fn(d.agent):"",y=b==="none"?`Turbo is off. Run ${v} in Claude Code and comments for the agent are taken as they land \u2014 click to copy it`:b==="push"?`Push mode: ${k} takes comments when you press Push to Claude. For live, run ${v} instead`:b==="on"?`Turbo on: ${k} takes comments for the agent as they land \u2014 click to pause`:`Turbo paused: ${k} is listening but waits \u2014 click to resume`;m.dataset.state=b,m.dataset.tip=y,m.setAttribute("aria-label",y),m.setAttribute("aria-checked",String(b==="on")),s&&(m.hidden=!0)};return setInterval(S,3e4),m.addEventListener("click",async()=>{let H=m.dataset.state;if(H==="none"||H==="push"){await navigator.clipboard?.writeText(v).catch(()=>{}),i(`Copied ${v} \u2014 paste it in Claude Code`);return}let b=H==="on"?"off":"on";h={paused:b==="off"},S();try{let k=await At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:b})});if(!k.ok)throw new Error(String(k.status));i(b==="off"?"Turbo paused":"Turbo on")}catch{h={paused:b==="on"},S(),i("Could not switch turbo \u2014 try again")}}),H=>{d=H.listening??null,h=H.turbo??null,S()}}function ir(s,i){let d=s.breakpoints,h=s.categories,m=(d.find(t=>!Number.isFinite(t.max))??d[0]).id,v=t=>d.find(e=>t>=e.min&&t<=e.max)?.id??m,S=t=>t.breakpoint||m,H=t=>s.devices.find(e=>e.id===t),b=ys,k=(t,e)=>{b||ot.setItem(t,e)},y=t=>At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),B=t=>t.replace(/\/+$/,"")||"/",Z=B(location.pathname);for(let t of document.querySelectorAll(".devtools .dt-icon[title]"))t.dataset.tip=t.title,t.getAttribute("aria-label")||t.setAttribute("aria-label",t.title),t.removeAttribute("title");let F=document.querySelector(".dt-grid-btn"),w=document.querySelector(".dt-grid-overlay"),A="dt-grid",D=()=>{let t=w.querySelector(".dt-overlay-grid");if(w.classList.remove("is-auto"),getComputedStyle(t).display==="grid")return;let e=0,n=0;for(let o of[...document.body.querySelectorAll("*")].slice(0,600)){if(o.closest(Ce))continue;let a=getComputedStyle(o);if(a.maxWidth==="none"||a.marginLeft!==a.marginRight||parseFloat(a.marginLeft)<=0)continue;let r=o.getBoundingClientRect();r.width>e&&(e=r.width,n=r.left)}e||(n=24,e=innerWidth-48),w.classList.add("is-auto"),w.style.setProperty("--grid-x",`${n}px`),w.style.setProperty("--grid-w",`${e}px`),w.style.setProperty("--grid-gap",innerWidth<768?"16px":"24px")},G=t=>{w.hidden=!t,t&&D(),F.setAttribute("aria-pressed",String(t)),k(A,t?"1":"0"),ee({grid:t})};F.addEventListener("click",()=>G(w.hidden===!0)),addEventListener("resize",()=>{w.hidden||D()});let et=document.querySelector(".dt-pages-name"),L=()=>{let t=null;for(let r of document.querySelectorAll(".dt-pages a"))B(new URL(r.href).pathname)===Z?(r.setAttribute("aria-current","page"),t=r):r.removeAttribute("aria-current");let e=document.title.split("\u2014").pop()?.trim(),o=t?.querySelector(".dt-menu-label")?.textContent?.trim()||e||et.textContent||"",a=o.trim().split(/\s+/);et.textContent=a.length>3?`${a.slice(0,3).join(" ")}\u2026`:o,et.title=a.length>3?o:""};L();let st=[...document.querySelectorAll(".devtools details")],ut=!1,mt=()=>{let t=st.filter(e=>e.open);for(let e of t)e.open=!1;return t};document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=mt();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{ut=st.some(e=>e.open&&!e.contains(t.target))&&mt().length>0},!0),addEventListener("blur",mt);let at=document.querySelector(".dt-pad-overlay"),se="dt-inspect",Ct=[".devtools",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...s.ignore].join(", "),Lt=[".devtools",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-drag-box",'[aria-modal="true"]',...s.ignore].join(", "),Vt={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),border:document.querySelector(".dt-border-btn")},E="",lt=0,{spacer:vt,drawPads:It,drawSize:Ut,drawType:$,drawColor:p,drawBorder:x}=Ui(at),N=t=>{lt||(lt=requestAnimationFrame(()=>{lt=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(Ct)){at.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),E==="sizes"?Ut(e):E==="type"?$(e):E==="color"?p(e):E==="border"?x(e):It(t.altKey?e:vt(e))}))},R=t=>{E=t;for(let[e,n]of Object.entries(Vt))n.setAttribute("aria-pressed",String(e===t));k(se,t),ee({inspect:t}),at.hidden=!t,at.innerHTML="",t?document.addEventListener("mousemove",N):document.removeEventListener("mousemove",N)};for(let[t,e]of Object.entries(Vt))e.addEventListener("click",()=>{t!==E&&ye(!1),R(E===t?"":t)});let W=document.querySelector(".dt-notes-btn"),z=[...document.querySelectorAll(".dt-bp")],Y=document.querySelector(".dt-history-btn"),q=document.querySelector(".dt-history"),nt=document.querySelector(".dt-studio-btn"),St=document.querySelector(".dt-devices"),bt=document.querySelector(".dt-notes-hi"),jt=bt.querySelector(".dt-hi-box"),oe=bt.querySelector(".dt-hi-tag"),Jt=document.querySelector(".dt-frame"),xt=document.createElement("div");xt.className="dt-spot",xt.hidden=!0,xt.setAttribute("aria-hidden","true"),document.body.append(xt);let Fe=t=>{if(!t||!Tt){xt.hidden=!0;return}let e=t.getBoundingClientRect(),n=6;xt.style.setProperty("--spot-x",`${e.left-n}px`),xt.style.setProperty("--spot-y",`${e.top-n}px`),xt.style.setProperty("--spot-w",`${e.width+n*2}px`),xt.style.setProperty("--spot-h",`${e.height+n*2}px`),xt.hidden&&(bt.hidden=!0),xt.hidden=!1},Ot=Jt.querySelector("iframe"),we=document.querySelector(".dt-notes-count"),J=document.querySelector(".dt-notes-overlay"),Ce=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Wt=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,n=>n.stopPropagation())};document.querySelectorAll(Ce).forEach(Wt);let je="dt-notes",V=[],Tt=!1,tt=null,T=null,yn=0,Ht="",We=null,Bt=[],gt=null,Nt=[],M=10,C=(t=T)=>!!(t&&((t.text?.trim().length??0)>=M||t.images?.length)),O=()=>{T&&C()&&Nt.push(T),T=null},it=0,ft=()=>{if(!C()||performance.now()-it<4e3)return!0;it=performance.now();let t=J.querySelector(".dt-note[data-draft]");return t&&!matchMedia("(prefers-reduced-motion: reduce)").matches&&t.animate([0,-6,6,-4,4,0].map(e=>({transform:`translateX(${e}px)`})),{duration:320,easing:"ease-out",composite:"add"}),t?.querySelector(".dt-note-input")?.focus(),Mt("Not sent \u2014 close again to keep it as a draft",2400),!1},Et=null,ae=null,$e=()=>`dt-draft:${s.me?.email??""}:${Z}${b?":canvas":""}`,ue=$e(),sn=0,vn=()=>{if(!T&&!Nt.length&&!Ht){ot.removeItem(ue);return}let t={draft:T,parked:Nt,reply:Ht?{for:Et,text:Ht}:null};try{localStorage.setItem(ue,JSON.stringify(t))}catch{let e=n=>({...n,images:void 0});try{localStorage.setItem(ue,JSON.stringify({...t,draft:T&&e(T),parked:Nt.map(e)}))}catch{}}},wn=()=>{clearTimeout(sn),sn=setTimeout(vn,200)};addEventListener("pagehide",()=>{clearTimeout(sn),vn()});let He=ot.getItem("dt-space")==="clients"?"clients":"studio",Be=()=>!!s.me&&!s.client,on=t=>!Be()||He==="clients"===$t(t),No=["all","nobody","mine","others","claude","wrote","check"],pe=No.find(t=>t===ot.getItem("dt-pinf"))??"all",Ss=()=>{},_n=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,ie=ot.getItem("dt-resolved")!=="0",Ne=ot.getItem("dt-archived")==="1",re=t=>Ii(t,s.autoArchive),Ro=t=>ht(t)!=="done"||(re(t)?Ne:ie),Kt={q:"",menu:!1,view:["me","agent"].includes(ot.getItem("dt-view")??"")?ot.getItem("dt-view"):"all",sort:ot.getItem("dt-sort")==="unread"?"unread":"new"},cr=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],ur=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],pr=()=>{let t=navigator.userAgent,e=r=>r.find(([l])=>l.test(t)),n=e(cr),o=e(ur),a=n?n[0].exec(t)?.[1]:null;return[n?`${n[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},Ts=()=>v(innerWidth),xe=()=>ae??Ts(),Po=()=>{let t=xe();for(let e of z)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:Io,poolOf:Oo,contextOf:Do,resolveEl:hr,anchorOf:mr}=Yi(),As=new WeakMap,qo=()=>{As=new WeakMap},he=t=>{let e=As.get(t);return(e===void 0||e&&!e.isConnected)&&(e=hr(t),As.set(t,e)),e},zn=new Map,Zt=t=>{zn.size||requestAnimationFrame(()=>zn.clear());let e=zn.get(t);return e===void 0&&(e=mr(t,he(t)),zn.set(t,e)),e},Fo=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(n=>n.playState==="running"))return!0;return!1},Vn=[],Cs=t=>{for(let e of Vn)e.play();Vn=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let n of e.getAnimations())n.playState==="running"&&(n.pause(),Vn.push(n))},Hs=()=>{if(T)return he(T);let t=tt!=null?V.find(n=>n.id===tt):null;if(!t)return null;let e=Zt(t);return e&&!e.off&&!e.hidden?he(t):null},Bs="claude",gr=()=>(s.team??[]).filter(t=>t.email!==s.me?.email),_e=()=>[...s.me?(s.team??[]).filter(t=>t.email===s.me.email):[],...gr()],jo='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="10" cy="10" r="6.5" stroke-dasharray="2.4 2.4"/></svg>',Wo=(t,e,n=!1)=>{let o=kt(t)?"agent":t?"person":"nobody",a=Ee(o==="person"?t:Ns()),r=[["person",a?an(a.avatar_url,a.name||a.email):Fs,o==="person"?`${ze(t)==="you"?"You":ze(t)} \u2014 pick someone else`:a?`Give it to ${a.email===s.me?.email?"me":a.name||a.email}`:"A person"],["nobody",jo,"Anyone \u2014 nobody has taken it yet"],["agent",zt(12),n?"Waits for the studio to approve it":o==="agent"?"Claude does it":"Give it to Claude"]],l=e!=null?V.find(u=>u.id===e):void 0,f=o==="agent"&&l?Os[ne(l)??""]:"";return`<span class="dt-hand" role="radiogroup" aria-label="Who takes it"${f?` style="--step-c:${f}"`:""}>${r.filter(([u])=>u!=="person"||o==="person"||_e().length).map(([u,P,j])=>u===o?`<span class="dt-hand-stop dt-hand-stop--${u} is-on" role="radio" aria-checked="true" data-tip="${g(j)}" aria-label="${g(j)}">${u==="person"?wr(t,e):P}</span>`:`<button type="button" class="dt-hand-stop dt-hand-stop--${u}" role="radio" aria-checked="false" data-act="hand" data-v="${u}"${e?` data-id="${e}"`:""} data-tip="${g(j)}" aria-label="${g(j)}"${u==="agent"&&n?" disabled":""}>${P}</button>`).join("")}</span>`},Ns=()=>{let t=br();return t&&!kt(t)&&_e().some(e=>e.email===t)?t:_e()[0]?.email??""},fr=()=>{let t=J.querySelector(".dt-hand .dt-hand-stop.is-on");return t?{rect:t.getBoundingClientRect(),ghost:t.cloneNode(!0)}:void 0},_o="cubic-bezier(0.32, 0.72, 0, 1)",zo=t=>{let e=J.querySelector(".dt-hand .dt-hand-stop.is-on");if(!t||!e||matchMedia("(prefers-reduced-motion: reduce)").matches)return;let n=e.getBoundingClientRect(),o=document.createElement("span");o.className="dt-hand dt-hand-ghost",o.style.cssText=`left:${t.rect.left}px;top:${t.rect.top}px;width:${t.rect.width}px;height:${t.rect.height}px`,t.ghost.querySelectorAll("select").forEach(a=>a.tabIndex=-1),o.append(t.ghost),J.append(o),o.animate([{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:120,easing:"ease-out",fill:"forwards"}).finished.then(()=>o.remove(),()=>o.remove()),eo=performance.now()+480,e.animate([{transform:`translateX(${t.rect.left-n.left}px)`,width:`${t.rect.width}px`},{transform:"none",width:`${n.width}px`}],{duration:460,easing:_o});for(let a of e.children)a.animate([{opacity:0,transform:"scale(0.92)",filter:"blur(3px)"},{opacity:0,transform:"scale(0.92)",filter:"blur(3px)",offset:.4},{opacity:1,transform:"none",filter:"blur(0)"}],{duration:460,easing:_o});for(let a of e.parentElement?.querySelectorAll("button.dt-hand-stop")??[])a.animate([{opacity:0},{opacity:1}],{duration:300,delay:140,easing:"ease-out",fill:"backwards"})},Vo=(t,e)=>{let n=eo>performance.now()?void 0:fr(),o=e==="agent"?Bs:e==="person"?Ns():e==="me"?s.me?.email??"":"";if(!t){if(!T)return;T.assignee=o,T.stage=kt(o)?"approved":!T.stage||T.stage==="approved"?"new":T.stage,e==="person"&&ot.setItem("nm-for",o),Ps(o),wn(),Q(),zo(n);return}Rs(t,o),zo(n)},Rs=(t,e)=>{let n=V.find(r=>r.id===t);if(n&&De(n)&&!kt(e)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=n?Xt(n):"new",a=kt(e)?"approved":o==="approved"?"new":o;Qt(r=>r.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>y({id:t,assignee:e||null,stage:a}),kt(e)?"Approving it for the agent":"Reassigning")},br=()=>ot.getItem("nm-for")??"",Ps=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e!==null&&(e===""||e===Bs||_e().some(n=>n.email===e))?e:null}catch{return null}},Un=t=>kt(t)?"#d97757":t?"#0d99ff":"#717171",ze=t=>t===s.me?.email?"you":s.team?.find(e=>e.email===t)?.name||t.split("@")[0],Ee=t=>t?s.team?.find(e=>e.email===t):void 0,Uo=t=>{let e=Pt(t??"").split(/\s+/).filter(Boolean);return g(((e[0]?.[0]??"?")+(e.length>1?e[e.length-1][0]:"")).toUpperCase())},an=(t,e,n="dt-face")=>t?`<img class="${n}" src="${g(t)}" alt="">`:`<b class="${n}" aria-hidden="true">${Uo(e)}</b>`,Ko=t=>{let e=Ee(t.by);return e||t.byName?an(e?.avatar_url,e?.name||t.byName||t.by):""},$n=t=>`var(--dt-avatar-${[...t].reduce((e,n)=>e*31+n.charCodeAt(0)>>>0,7)%8+1})`,Go=(t,e)=>{let n=Ee(t),o=n?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return an(n?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${$n(t)}" `)},Is=(t,e)=>Ee(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],Os={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},rn=(()=>{try{return JSON.parse(ot.getItem("dt-seen")||"{}")}catch{return{}}})(),Yo=()=>k("dt-seen",JSON.stringify(rn)),Xo=t=>{let e=Oe(t);if(!(t.id in rn))return rn[t.id]=e.length,Yo(),!1;let n=e[e.length-1];return e.length>rn[t.id]&&!(n?.author==="you"&&(!n.by||n.by===s.me?.email))},yr=t=>{let e=Oe(t).length;rn[t.id]!==e&&(rn[t.id]=e,Yo())},Ds=t=>{let e=Ee(t);return e?` data-face="${g(e.avatar_url??"")}" data-initial="${Uo(e.name||e.email)}"`:""},Jo=t=>s.client||_t()||$t(t)||ht(t)==="done"?"":`<span class="dt-hist-hand">${Wo(t.assignee??"",t.id)}</span>`,Ve=(t,e)=>fn(t),Zo=t=>{let e=Ee(t);return e?an(e.avatar_url,e.name||e.email):""},vr=t=>{let e=Ee(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${g(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${zt(12)}</b>`},wr=(t,e)=>{let n=(a,r)=>`<option value="${g(a)}" data-c="${Un(a)}"${Ds(a||null)}${t===a?" selected":""}>${g(r)}</option>`,o=(s.team??[]).filter(a=>a.email!==s.me?.email);return`<label class="dt-field dt-field--knob"><span class="dt-field-box dt-field-box--face" style="--cat:${Un(t)}">${Zo(t||null)||Fs}<select class="dt-for-select"${e?` data-id="${e}"`:""} aria-label="Who does it">
|
|
217
|
-
${
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
`).find(n=>Pt(n))??"");return e?e.length>30?`${e.slice(0,30)}\u2026`:e:t?.tagName.toLowerCase()??""},Fs='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="10" cy="6.8" r="3"/><path d="M4.2 16.5c.6-3 3-4.8 5.8-4.8s5.2 1.8 5.8 4.8" stroke-linejoin="round"/></svg>',Hr='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><circle cx="8.5" cy="6.8" r="3"/><path d="M2.8 16.5c.6-3 3-4.8 5.7-4.8 1.3 0 2.5.4 3.5 1.1M15.5 11v5M13 13.5h5" stroke-linejoin="round"/></svg>',sa='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="5" cy="10" r="1.1" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.1" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.1" fill="currentColor" stroke="none"/></svg>',js='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="7" y="7" width="9.5" height="9.5" rx="2"/><path d="M13 7V5a1.5 1.5 0 0 0-1.5-1.5h-6A1.5 1.5 0 0 0 4 5v6a1.5 1.5 0 0 0 1.5 1.5H7"/></svg>',oa='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 7h11M12 4l3 3-3 3M16 13H5M8 10l-3 3 3 3"/></svg>',aa='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2l-.9.9"/><path d="M11.5 8.5a3 3 0 0 0-4.2 0L5 10.8A3 3 0 0 0 9.2 15l.9-.9"/></svg>',ia=t=>{let e=(a,r,l,f="")=>`<option value="${a}" data-icon="${g(r)}"${f}>${l}</option>`,n=t&&Be()?$t(t)?e("dup",js,"Duplicate to workspace")+(t.client?"":e("move",oa,"Move to workspace")):e("dup",js,"Duplicate for the client")+e("move",oa,"Move to clients"):"",o=t&&s.client&&t.status==="done"?e("reopen",Ae,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${sa}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
|
|
225
|
+
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${H}"
|
|
226
|
+
>${gn}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
227
|
+
</div>`)}function yd(o){let{inFrame:r,everything:c,route:h,open:m,settle:y,keepIn:L,toast:H,waits:$,approve:E}=o,x=S=>{let P=c().find(tt=>tt.id===S);return!!P&&$(P)},q="nm-review",_=()=>{try{return JSON.parse(sessionStorage.getItem(q)||"null")}catch{return null}},D=S=>{try{S?sessionStorage.setItem(q,JSON.stringify(S)):sessionStorage.removeItem(q)}catch{}},V=document.createElement("div");V.className="dt-review",V.setAttribute("role","region"),V.setAttribute("aria-label","Checking fixes"),V.hidden=!0,L(V),r||document.body.append(V);let Z=()=>c().filter($),wt=()=>{let S=Z().sort((P,tt)=>+(tt.route===h())-+(P.route===h())||String(P.route).localeCompare(String(tt.route))||P.id-tt.id).map(P=>P.id);S.length&&(D({ids:S,i:0}),R())},R=()=>{let S=_();if(!S||r){V.hidden=!0;return}for(;S.i<S.ids.length&&!x(S.ids[S.i]);)S.i++;if(S.i>=S.ids.length){D(null),V.hidden=!0,H("Every fix is checked.");return}D(S);let P=c().find(F=>F.id===S.ids[S.i]);if(P.route&&P.route!==h()){location.assign(P.route+location.search);return}m(P);let tt=S.ids.slice(0,S.i).some(x);V.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"${tt?"":" disabled"}>${Io}</button>
|
|
229
|
+
<span class="dt-review-n">${S.i+1} of ${S.ids.length}</span>
|
|
230
|
+
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Oo}</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">${be}</button>
|
|
232
|
+
<button data-r="no" aria-label="Reopen" data-tip="Not yet \u2014 reopen it">${bn}</button>
|
|
233
|
+
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${fn}</button>`,V.hidden=!1};V.addEventListener("click",async S=>{let P=S.target.closest("[data-r]"),tt=_();if(!P||!tt)return;if(P.dataset.r==="stop"){D(null),V.hidden=!0;return}if(P.dataset.r==="prev"){T();return}let F=tt.ids[tt.i];D({...tt,i:tt.i+1});let nt=c().find(Dt=>Dt.id===F),ht=P.dataset.r==="ok"&&nt?E(nt):P.dataset.r==="no"?y(F,!1):null;R(),await ht});let T=()=>{let S=_();if(S){for(let P=S.i-1;P>=0;P--)if(x(S.ids[P])){D({...S,i:P}),R();return}}};return document.addEventListener("keydown",S=>{V.hidden||S.metaKey||S.ctrlKey||S.altKey||S.key!=="ArrowLeft"&&S.key!=="ArrowRight"||S.target.closest?.("input, textarea, select, [contenteditable]")||(S.preventDefault(),S.key==="ArrowLeft"?T():V.querySelector('[data-r="skip"]')?.click())}),{start:wt,toCheck:Z,resume:()=>{_()&&R()}}}function wd(o,r){let c=null,h=null,m=document.querySelector(".dt-turbo"),y="/notemend:turbo",L=()=>{let H=!!c&&Date.now()-Date.parse(c.at)<18e4,$=H?c.mode==="push"?"push":h?.paused?"paused":"on":"none",E=H?Ue(c.agent):"",x=$==="none"?`Turbo is off. Run ${y} in Claude Code and threads for Claude are taken as they land \u2014 click to copy it`:$==="push"?`Push mode: ${E} takes threads when you press Push to Claude. For live, run ${y} instead`:$==="on"?`Turbo on: ${E} takes threads for Claude as they land \u2014 click to pause`:`Turbo paused: ${E} is listening but waits \u2014 click to resume`;m.dataset.state=$,m.dataset.tip=x,m.setAttribute("aria-label",x),m.setAttribute("aria-checked",String($==="on")),o&&(m.hidden=!0)};return setInterval(L,3e4),m.addEventListener("click",async()=>{let H=m.dataset.state;if(H==="none"||H==="push"){await navigator.clipboard?.writeText(y).catch(()=>{}),r(`Copied ${y} \u2014 paste it in Claude Code`);return}let $=H==="on"?"off":"on";h={paused:$==="off"},L();try{let E=await zt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:$})});if(!E.ok)throw new Error(String(E.status));r($==="off"?"Turbo paused":"Turbo on")}catch{h={paused:$==="on"},L(),r("Could not switch turbo \u2014 try again")}}),H=>{c=H.listening??null,h=H.turbo??null,L()}}var ap=new Set(["data-wired"]),Ps=o=>{if(!(o instanceof Element))return null;let r=o.dataset;return r.msg?`m:${r.msg}`:r.id?`${o.tagName}:${o.classList[0]??""}:${r.id}`:"draft"in r?`${o.tagName}:draft`:r.parked?`${o.tagName}:parked:${r.parked}`:r.k?`${o.tagName}:k:${r.k}`:null},$d=(o,r)=>o.nodeType===r.nodeType&&o.nodeName===r.nodeName&&Ps(o)===Ps(r);function ip(o,r){for(let{name:c}of[...o.attributes])!r.hasAttribute(c)&&!ap.has(c)&&o.removeAttribute(c);for(let{name:c,value:h}of r.attributes)o.getAttribute(c)!==h&&o.setAttribute(c,h);o instanceof HTMLInputElement&&r instanceof HTMLInputElement&&(o.checked!==r.checked&&(o.checked=r.checked),o!==document.activeElement&&o.value!==r.value&&(o.value=r.value))}function xd(o,r){let c=[...o.childNodes],h=new Map;for(let $ of c){let E=Ps($);E&&h.set(E,$)}let m=new Set,y=0,L=[];for(let $ of[...r.childNodes]){let E=Ps($),x=E?h.get(E):void 0;if(!E){for(;y<c.length&&(m.has(c[y])||Ps(c[y]));)y++;y<c.length&&$d(c[y],$)&&(x=c[y++])}x&&!m.has(x)&&$d(x,$)?(m.add(x),rp(x,$),L.push(x)):L.push($)}for(let $ of c)m.has($)||o.removeChild($);let H=o.firstChild;for(let $ of L){if($===H){H=H.nextSibling;continue}o.insertBefore($,H)}}function rp(o,r){if(o.nodeType===Node.TEXT_NODE||o.nodeType===Node.COMMENT_NODE){o.nodeValue!==r.nodeValue&&(o.nodeValue=r.nodeValue);return}if(!(!(o instanceof Element)||!(r instanceof Element))){if(ip(o,r),o instanceof HTMLTextAreaElement){o!==document.activeElement&&o.value!==r.value&&(o.value=r.value);return}if(o instanceof SVGElement){o.innerHTML!==r.innerHTML&&(o.innerHTML=r.innerHTML);return}xd(o,r),o instanceof HTMLSelectElement&&o!==document.activeElement&&o.value!==r.value&&(o.value=r.value)}}function oi(o,r){let c=document.createElement("template");c.innerHTML=r,xd(o,c.content)}function Ed(o,r,c=!1){let h=o.breakpoints,m=o.categories,y=(h.find(t=>!Number.isFinite(t.max))??h[0]).id,L=t=>h.find(e=>t>=e.min&&t<=e.max)?.id??y,H=(t,e)=>{let n=L(t);if(Ts||!matchMedia("(pointer: coarse)").matches)return n;let s=[...h].sort((l,d)=>l.min-d.min),a=e<500?L(767):(s[s.length-2]??s[0]).id,i=l=>s.findIndex(d=>d.id===l);return i(n)>i(a)?a:n},$=t=>t.breakpoint||y,E=t=>o.devices.find(e=>e.id===t),x=Ts,q=(t,e)=>{x||ot.setItem(t,e)},_=null,D=["stage","status","priority","assignee"],V=t=>{let e=(_??j).find(a=>a.id===t.id),n=D.filter(a=>a in t||(a==="stage"||a==="status")&&("stage"in t||"status"in t)),s=e&&n.length&&!t.reply?Object.fromEntries(n.map(a=>[a,e[a]??null])):void 0;return zt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(s?{...t,seen:s}:t)})},Z=t=>t.replace(/\/+$/,"")||"/",wt=Z(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 R=document.querySelector(".dt-grid-btn"),T=document.querySelector(".dt-grid-overlay"),S=T.querySelector(".dt-overlay-grid"),P=T.querySelector(".dt-grid-chip"),tt="dt-grid",F=o.projectGrid??null,nt=()=>H(innerWidth,innerHeight),ht=()=>F?.mode==="custom"?F.widths?.[nt()]??null:null,Dt=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),jt=t=>Dt(t).length,ve=()=>{let t=T.hidden;t&&(T.style.visibility="hidden",T.hidden=!1);try{return A()}finally{t&&(T.hidden=!0,T.style.visibility="")}},A=()=>{let t=document.documentElement.clientWidth;T.classList.remove("is-auto");let e=getComputedStyle(S);if(e.display==="grid"&&jt(e)>1){let i=S.getBoundingClientRect();return{cols:jt(e),gap:Math.round(parseFloat(e.columnGap)||0),x:Math.round(i.left),w:Math.round(i.width),from:"site"}}let n=null,s=null;for(let i of[...document.body.querySelectorAll("*")].slice(0,3e3)){if(i.closest(an)||T.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 g=parseFloat(d.paddingLeft)||0;n={x:l.left+g,w:l.width-g-(parseFloat(d.paddingRight)||0)}}if(l.width<=(s?.w??0))continue;let u=d.display.endsWith("grid")?Dt(d):[];if(u.length>1){if(!u.every(w=>Math.abs(w-u[0])<2))continue;let g=parseFloat(d.columnGap)||0;s={cols:u.length,gap:g,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:u.reduce((w,N)=>w+N,0)+g*(u.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let g=[...i.children].map(N=>N.getBoundingClientRect()).filter(N=>N.width&&N.height),w=g.filter(N=>Math.abs(N.top-g[0].top)<2).sort((N,G)=>N.left-G.left);w.length>1&&w.every(N=>Math.abs(N.width-w[0].width)<2)&&(s={cols:w.length,gap:Math.max(0,w[1].left-w[0].right),x:w[0].left,w:w.at(-1).right-w[0].left})}}let a=i=>({...i,gap:Math.round(i.gap),x:Math.round(i.x),w:Math.round(i.w)});return a(s?{...s,...n??{},from:"page"}:{cols:o.grid.columns,gap:innerWidth<768?16:24,...n??{x:24,w:t-48},from:"guess"})},lt=null,Ct=(t,e,n,s)=>{T.classList.add("is-auto"),S.children.length!==t&&(S.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),T.style.setProperty("--grid-x",`${n}px`),T.style.setProperty("--grid-w",`${s}px`),T.style.setProperty("--grid-gap",`${e}px`)},At=()=>{let t=ht(),e=P.querySelector("span");if(P.querySelector("button").hidden=!t||x,t){let n=document.documentElement.clientWidth,s=Math.max(0,Math.min(t.max??1/0,n-2*t.margin));Ct(t.cols,t.gutter,(n-s)/2,s),e.textContent="Project grid \xB7";return}S.children.length!==o.grid.columns&&(S.innerHTML='<div class="dt-overlay-col"></div>'.repeat(o.grid.columns)),lt=ve(),lt.from!=="site"&&Ct(lt.cols,lt.gap,lt.x,lt.w),e.textContent=lt.from==="guess"?`Guessed \xB7 ${lt.cols} \xD7 ${lt.w}`:`From the page \xB7 ${lt.cols} \xD7 ${lt.w} \xB7 gap ${lt.gap}`},Yt=()=>{P.classList.remove("is-lifted");let t=P.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();P.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},Wt=t=>{T.hidden=!t,t&&(At(),Yt()),R.setAttribute("aria-pressed",String(t)),q(tt,t?"1":"0"),ge({grid:t})};R.addEventListener("click",()=>Wt(T.hidden===!0)),addEventListener("resize",()=>{T.hidden||(At(),Yt())});let ee=document.querySelector(".dt-pages-name"),ne=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:Z(t.location.pathname),title:t.document.title}:null}catch{return null}},$t=()=>{let e=ne()?.route??wt,n=null;for(let l of document.querySelectorAll(".dt-pages a"))Z(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+/);ee.textContent=i.length>3?`${i.slice(0,3).join(" ")}\u2026`:a,i.length>3?ee.title=a:ee.removeAttribute("title")};$t();let St=document.querySelector(".dt-pages");St&&!St.querySelector("li")&&St.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let ft=[...document.querySelectorAll(".devtools details")],yt=!1,ye=()=>{let t=ft.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]=ye();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{yt=ft.some(e=>e.open&&!e.contains(t.target))&&ye().length>0},!0),addEventListener("blur",ye);let Ht=document.querySelector(".dt-pad-overlay"),Ye="dt-inspect",vn=[".devtools",".dt-tab",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...o.ignore].join(", "),ce=[".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"]',...o.ignore].join(", "),we={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")},v="",b=0,{spacer:M,drawPads:I,drawSize:O,drawType:it,drawColor:rt,drawBorder:X,drawContrast:K,contrastFix:et,markCopied:ct}=ld(Ht),mt=null,qt=()=>{mt&&v&&te(mt)},te=t=>{mt=t,!b&&(b=requestAnimationFrame(()=>{b=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(vn)){Ht.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),v==="sizes"?O(e):v==="type"?it(e):v==="color"?rt(e):v==="contrast"?K(e):v==="border"?X(e):I(t.altKey?e:M(e))}))},Ft=t=>{v=t;for(let[e,n]of Object.entries(we))n.setAttribute("aria-pressed",String(e===t));q(Ye,t),ge({inspect:t}),Ht.hidden=!t,Ht.innerHTML="",t?(document.addEventListener("mousemove",te),addEventListener("scroll",qt,!0),addEventListener("resize",qt)):(document.removeEventListener("mousemove",te),removeEventListener("scroll",qt,!0),removeEventListener("resize",qt))};document.addEventListener("click",t=>{v!=="contrast"||!et()||t.target.closest?.(vn)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(et()).catch(()=>{}),ct(),qt())},!0);for(let[t,e]of Object.entries(we))e.addEventListener("click",()=>{t!==v&&Le(!1),Ft(v===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Bt)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let n=s=>{x&&parent.postMessage({dt:!0,...s},location.origin)};v?(Ft(""),n({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):T.hidden||(Wt(!1),n({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let kt=document.querySelector(".dt-notes-btn"),Nt=[...document.querySelectorAll(".dt-bp")],Gt=document.querySelector(".dt-history-btn"),at=document.querySelector(".dt-history"),It=document.querySelector(".dt-elsewhere"),on=document.querySelector(".dt-studio-btn"),Ie=document.querySelector(".dt-devices"),k=document.querySelector(".dt-notes-hi"),B=k.querySelector(".dt-hi-box"),W=k.querySelector(".dt-hi-tag"),dt=document.querySelector(".dt-frame"),bt=document.createElement("div");bt.className="dt-spot",bt.hidden=!0,bt.setAttribute("aria-hidden","true"),document.body.append(bt);let se=t=>{if(!t||!Bt){bt.hidden=!0;return}let e=t.getBoundingClientRect(),n=6;bt.style.setProperty("--spot-x",`${e.left-n}px`),bt.style.setProperty("--spot-y",`${e.top-n}px`),bt.style.setProperty("--spot-w",`${e.width+n*2}px`),bt.style.setProperty("--spot-h",`${e.height+n*2}px`),bt.hidden&&(k.hidden=!0),bt.hidden=!1},ue=dt.querySelector("iframe");ue.addEventListener("load",$t),new MutationObserver($t).observe(dt,{attributes:!0,attributeFilter:["hidden"]});let Oe=document.querySelector(".dt-notes-count"),U=document.querySelector(".dt-notes-overlay"),an=".devtools, .dt-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Fo=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,n=>n.stopPropagation())};document.querySelectorAll(an).forEach(Fo);let ai="dt-notes",j=[],Bt=!1,Q=null,C=null,jo=0,oe="",Sd=(t,e,n)=>{if(n>160&&n<innerHeight-120)return!1;let s=document.elementsFromPoint(e,n).find(a=>!Ns(a)&&a!==document.documentElement&&a!==document.body);if(!s||s===t||t.contains(s)||s.contains(t))return!1;for(let a=s;a&&a!==document.body;a=a.parentElement){let i=getComputedStyle(a).position;if(i==="fixed"||i==="sticky")return!a.contains(t)}return!1},ii=new WeakSet,Is=null,Os=null,$e={},Ds=" \xB7 hidden \u2014 inside something closed";U.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 $e[n.dataset.id],n.remove())},!0);let Xt=[],Ot=null,pe=[],Td=10,es=(t=C)=>!!(t&&((t.text?.trim().length??0)>=Td||t.images?.length)),He=()=>{C&&es()&&pe.push(C),C=null},ri=0,ns=()=>{if(!es()||performance.now()-ri<4e3)return!0;ri=performance.now();let t=U.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(),Rt("Not sent \u2014 close again to keep it as a draft",2400),!1},De=null,Wo=new Map,_o=null,li=()=>`dt-draft:${o.me?.email??""}:${wt}${x?":canvas":""}`,Pn=li(),qs=0,ss=()=>{if(!C&&!pe.length&&!oe){ot.removeItem(Pn);return}let t={draft:C,parked:pe,reply:oe?{for:De,text:oe}:null};try{localStorage.setItem(Pn,JSON.stringify(t))}catch{let e=n=>({...n,images:void 0});try{localStorage.setItem(Pn,JSON.stringify({...t,draft:C&&e(C),parked:pe.map(e)}))}catch{}}},In=()=>{clearTimeout(qs),qs=setTimeout(ss,200)};addEventListener("pagehide",()=>{clearTimeout(qs),ss()});let qe=ot.getItem("dt-space")==="clients"?"clients":"studio",Xe=()=>!!o.me&&!o.client,rn=t=>!Xe()||qe==="clients"===Lt(t),di=["all","nobody","mine","others","resolved","claude","wrote","check"],Je=di.find(t=>t===ot.getItem("dt-pinf"))??"all",zo=()=>{},Fs=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,xe=ot.getItem("dt-resolved")!=="0",Fe=ot.getItem("dt-archived")==="1",Ee=t=>td(t,o.autoArchive),js=t=>Ee(t)?Fe:Mt(t)!=="done"||xe,he={q:"",menu:!1,view:["me","agent"].includes(ot.getItem("dt-view")??"")?ot.getItem("dt-view"):"all",sort:ot.getItem("dt-sort")==="unread"?"unread":"new"},Cd=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Ad=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Hd=()=>{let t=navigator.userAgent,e=i=>i.find(([l])=>l.test(t)),n=e(Cd),s=e(Ad),a=n?n[0].exec(t)?.[1]:null;return[n?`${n[1]}${a?" "+a:""}`:"unknown browser",s?.[1]].filter(Boolean).join(" \xB7 ")},Go=()=>H(innerWidth,innerHeight),Ne=()=>_o??Go(),ci=()=>{let t=Ne();for(let e of Nt)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:ui,poolOf:pi,contextOf:hi,resolveEl:Nd,anchorOf:Bd}=ud(),Vo=new Map,mi=()=>{Vo=new Map},Be=t=>{let e=JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth]),n=Vo.get(e);return(n===void 0||n&&!n.isConnected)&&(n=Nd(t),Vo.set(e,n)),n},Ws=new Map,ae=t=>{Ws.size||requestAnimationFrame(()=>Ws.clear());let e=Ws.get(t);return e===void 0&&(e=Bd(t,Be(t)),Ws.set(t,e)),e},gi=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(n=>n.playState==="running"))return!0;return!1},_s=[],Uo=t=>{for(let e of _s)e.play();_s=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let n of e.getAnimations())n.playState==="running"&&(n.pause(),_s.push(n))},Ko=()=>{if(C)return Be(C);let t=Q!=null?j.find(n=>n.id===Q):null;if(!t)return null;let e=ae(t);return e&&!e.off&&!e.hidden?Be(t):null},os="claude",Rd=()=>o.client||ie()||qe==="clients"?o.team??[]:Ys(),Pd=()=>Rd().filter(t=>t.email!==o.me?.email),as=()=>[...o.me?(o.team??[]).filter(t=>t.email===o.me.email):[],...Pd()],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>',Yo=(t,e)=>{let n=e==="agent"?os:e==="me"?o.me?.email??"":"";if(!t){if(!C)return;C.assignee=n,C.stage=Tt(n)?"approved":!C.stage||C.stage==="approved"?"new":C.stage,Gs(n),In(),J();return}zs(t,n)},zs=(t,e)=>{let n=j.find(i=>i.id===t);if(n&&Ke(n)&&!Tt(e)&&!confirm("Claude is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let s=n?fe(n):"new",a=Tt(e)?"approved":s==="approved"?"new":s;Re(i=>i.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>V({id:t,assignee:e||null,stage:a}),Tt(e)?"Approving it for Claude":"Reassigning")},Id=(t,e)=>{if(e&&ot.setItem("nm-for",e),!t){if(!C)return;C.assignee=e,C.stage==="approved"&&(C.stage="new"),Gs(e),In(),J();return}zs(t,e)},dp=()=>ot.getItem("nm-for")??"",Gs=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===os||as().some(n=>n.email===e))?e:null}catch{return null}},bi=t=>Tt(t)?"#d97757":t?"#0d99ff":"#717171",ln=t=>t===o.me?.email?"you":o.team?.find(e=>e.email===t)?.name||t.split("@")[0],je=t=>t?o.team?.find(e=>e.email===t):void 0,Vs=t=>{let e=Qt(t??"").split(/\s+/).filter(Boolean);return f(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},On=(t,e,n="dt-face")=>t?`<img class="${n}" src="${f(t)}" alt="">`:`<b class="${n}" aria-hidden="true">${Vs(e)}</b>`,vi=t=>{let e=je(t.by);return e||t.byName?On(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},dn=t=>`var(--dt-avatar-${[...t].reduce((e,n)=>e*31+n.charCodeAt(0)>>>0,7)%8+1})`,yi=(t,e)=>{let n=je(t),s=n?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return On(n?.avatar_url,s).replace(/^<(img|b) /,`<$1 style="--hue:${dn(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},Xo=(t,e)=>je(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],Dn={queued:"var(--dt-new)",working:"var(--dt-progress)",asks:"var(--dt-waiting)",stuck:"var(--dt-stuck)",review:"var(--dt-review)",done:"var(--dt-accepted)"},qn=(()=>{try{return JSON.parse(ot.getItem("dt-seen")||"{}")}catch{return{}}})(),wi=()=>q("dt-seen",JSON.stringify(qn)),$i=t=>{let e=mn(t);if(!(t.id in qn))return qn[t.id]=e.length,wi(),!1;let n=e[e.length-1];return e.length>qn[t.id]&&!(n?.author==="you"&&(!n.by||n.by===o.me?.email))},Od=t=>{let e=mn(t).length;qn[t.id]!==e&&(qn[t.id]=e,wi())},Dd=t=>{let e=je(t);return e?` data-face="${f(e.avatar_url??"")}" data-initial="${Vs(e.name||e.email)}"`:""},qd=t=>o.client||ie()||Lt(t)||Mt(t)==="done"?"":`<span class="dt-hist-well">${Mi(t.assignee??"",t.id,!0)}${Li(t,t.assignee??"",t.id)}</span>`,Fd=t=>{if(o.client||ie()||Lt(t))return"";let e=Ut(t);return e&&e!=="held"&&(Tt(t.assignee)||e==="review")?`<i class="dt-hist-step" style="--step-c:${Dn[e]??Dn.queued}" role="img" aria-label="With Claude \u2014 ${f(ki[e]??"")}">${de(10)}</i>`:""},jd=t=>{if(o.client||ie()||Lt(t))return null;let e=Ut(t),n=Ro(t),s=Me(t);return!Tt(t.assignee)&&e!=="review"?null:e==="queued"?["",`Queued for ${s}`]:e==="working"?[Qi,n?.step?Bo(n.step):`${s} is working`]:e==="asks"?["",`${s} asks you`]:e==="stuck"?["",n?.step?`Went quiet \xB7 last: ${n.step}`:"Went quiet"]:e==="review"?["",`${s} fixed it \u2014 to check`]:null},xi=t=>{let e=Ut(t),n=Ro(t);return e==="working"?n?.step?` \xB7 ${Bo(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":""},Wd=t=>{let e=je(t);return e?On(e.avatar_url,e.name||e.email):""},_d=t=>{let e=je(t)?.agent_avatar_url;return e?`<img class="dt-face" src="${f(e)}" alt="">`:`<b class="dt-face dt-face--ai" aria-hidden="true">${de(12)}</b>`},Ei=(t,e,n={})=>`<option value="${f(t)}"${n.dot?` data-c="${bi(t)}"`:""}${Dd(t||null)}${n.selected?" selected":""}>${f(e)}</option>`,Mi=(t,e,n=!1)=>{let s=Tt(t),a=s?"":t,i=je(a),l=i?i.avatar_url?`<img class="dt-owner-face" src="${f(i.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${dn(a.toLowerCase())}" aria-hidden="true">${Vs(i.name||i.email)}</b>`:a?Bi:fi,d=a?i?.name||ln(a):"Anyone",u=N=>`<b class="dt-menu-face" style="--hue:${dn(N.toLowerCase())}">${[...Vs(je(N)?.name||N)][0]}</b>`,g=(N,G,p="")=>`<option value="${f(N)}" data-icon="${f(N?u(N):fi)}"${p?` data-hint="${f(p)}"`:""}${N===a?" selected":""}${N?"":" data-sep-after"}>${f(G)}</option>`,w=as();return`<label class="dt-owner${s?" is-dim":""}${i?" has-face":""}${n?" is-compact":""}" data-tip="${n?f(d):"Who takes it"}">${l}${n?"":`<span class="dt-owner-name">${f(d)}</span>`}${Us}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
|
|
234
|
+
${g("","Anyone")}${w.map(N=>g(N.email,N.email===o.me?.email?`Me \xB7 ${N.name||N.email}`:N.name||N.email,N.email)).join("")}${a&&!w.some(N=>N.email===a)?g(a,ln(a)):""}
|
|
235
|
+
</select></label>`},ki={queued:"queued",working:"working",asks:"asks you",stuck:"went quiet",review:"fixed it \u2014 to check",done:"done"},Li=(t,e,n,s=!1)=>{let a=t?Ut(t):Tt(e)?"queued":null,i=!!a&&a!=="held"&&(Tt(e)||a==="review"),l=s?"Claude does not work in the clients\u2019 space":a==="held"?"From a guest \u2014 click to approve for Claude":i?"Take it back":"Give to Claude",d=i?`With Claude \u2014 ${ki[a]??"queued"}. Take it back`:l;return`<button type="button" class="dt-claude-btn${i?" is-on":""}${a==="held"?" is-held":""}" data-act="claude"${n?` data-id="${n}"`:""}${i?` data-step="${a}" style="--step-c:${Dn[a]??Dn.queued}"`:""} aria-pressed="${i}" data-tip="${f(l)}" aria-label="${f(d)}"${s?" disabled":""}>${de(13)}</button>`},Si=t=>{if(!t){if(!C)return;Yo(0,Tt(C.assignee)?"nobody":"agent");return}let e=j.find(s=>s.id===t);if(!e)return;if(No(e)){Re(s=>s.map(a=>a.id===t?{...a,assignee:os,stage:"approved",approvedBy:o.me?.email??"you"}:a),()=>V({id:t,approve:!0,assignee:os,stage:"approved"}),"Approving it for Claude");return}let n=Ut(e);zs(t,Tt(e.assignee)||n==="review"?"":os)},zd=t=>`<div class="dt-suggest dt-suggest--read"><del>${f(t.from)}</del><ins>${f(t.to)}</ins></div>`,Ti=(t,e)=>{let n=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return f([n,Qt(e??"")&&`\u201C${Zt(Qt(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>',Jo=(t,e,n=!1)=>{let s=sn(t);return n?`<span class="dt-field dt-field--bare dt-field--type"><span class="dt-field-box">${ts(s)}<span class="dt-field-label">${f(s.label)}</span></span></span>`:`<label class="dt-field dt-field--bare dt-field--type" data-tip="Type: ${f(s.label)}"><span class="dt-field-box">${ts(s)}<span class="dt-field-label">${f(s.label)}</span>${Us}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${m.map(a=>`<option value="${a.id}" data-c="${a.color}" data-icon="${f(ts(a))}"${a.id===t?" selected":""}>${a.label}</option>`).join("")}</select></span></label>`},cn=[["new","New","#0d99ff",0],["progress","In progress","#f5a623",.25],["review","To check","#8e4ec6",.5],["waiting","Waiting","#e93d82",.75]],Fn=t=>Ke(t)||fe(t)==="progress"?"progress":fe(t)==="review"?"review":fe(t)==="waiting"?"waiting":"new",Ci=(t,e)=>{if(e==="all")return!0;let n=Mt(t),s=Ho(t,n),a=(o.me?.email??"").toLowerCase();return e==="nobody"?n!=="done"&&!!s&&!s.taker:e==="mine"?!!s&&s.taker===a:e==="others"?!!s&&!!s.taker&&s.taker!==a:e==="resolved"?n==="done":e==="claude"?!!s?.claude&&s.taker===a:e==="wrote"?!t.by||t.by.toLowerCase()===a:n==="claude"||n==="open"&&(Ut(t)==="review"||Fn(t)==="review")},Ks={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",held:"new",done:"done"},Ze=[...cn,["done","Resolved","#30a46c",1]],Ai=t=>{let e=Ut(t);return t.status==="done"&&e!=="review"?"done":e&&Ks[e]?Ks[e]:Fn(t)},Gd=t=>{let e=Ut(t),n=Ai(t),[,,s,a]=Ze.find(i=>i[0]===n);return`<label class="dt-field" data-tip="${e&&Ks[e]?"Follows Claude":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${s}">${Ae(s,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${Ze.map(([i,l,d,u])=>`<option value="${i}" data-c="${d}" data-icon="${f(Ae(d,u))}"${i===n?" selected":""}>${l}</option>`).join("")}${o.client?"":`<option value="${Ee(t)?"unarchive":"archive"}" data-sep data-icon="${f(gn)}">${Ee(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},Vd=(t,e)=>{let{reopenedAt:n,reopenedBy:s,movedAt:a,movedBy:i,movedFrom:l}=t,d=mn(t),u=N=>{let G=Date.parse(N),p=d.findIndex((Y,z)=>z>0&&!!Y.at&&Date.parse(Y.at)>G);return p<0?d.length:p},g=N=>N?N==="you"||N===o.me?.email?"you":N==="claude"?"Claude":ln(N):"",w=[];if(a&&l&&w.push([u(a),`<p class="dt-note-event">${Zd}${f(`Moved from ${l}${i?` by ${g(i)}`:""}`)} \xB7 ${Po(a,An)}</p>`]),n&&t.status!=="done"){let N=g(s);w.push([u(n),`<p class="dt-note-event">${bn}${f(N?`Reopened by ${N}`:"Reopened")} \xB7 ${Po(n,An)}</p>`])}for(let[N,G]of w.sort((p,Y)=>Y[0]-p[0]))e.splice(N,0,G);return e.join("")},Ud=t=>{let e=t.from,n=a=>`<p class="dt-note-from">${Zo}${a}</p>`;if(e){let a=pt.find(i=>i.id===e.id);return n(Yl(t,a,a?.by?ln(a.by):""))}if(o.client)return"";let s=pt.find(a=>a.from?.id===t.id);return s?n(Xl(s)):""},Kd=t=>{let e=t.status==="done"?"done":Fn(t),[,n,s,a]=Ze.find(i=>i[0]===e);return`<span class="dt-field dt-field--read"><span class="dt-field-box dt-field-box--icon" style="--cat:${s}">${Ae(s,a)}<span class="dt-field-label">${n}</span></span></span>`},Yd=(t,e)=>{let n=j.find(l=>l.id===t);if(!n)return;if(e==="done"){en(t,!0);return}if(e==="archive"||e==="unarchive"){wn(t,e==="archive");return}if(Tt(n.assignee)&&!Lt(n)){n.status==="done"?en(t,!1):(Rt("Still with Claude \u2014 its step is the status; the Claude button takes it back.",6e3),J());return}let a=e==="new"&&Tt(n.assignee)?"approved":e,i=n.status==="done"?{status:"open",doneBy:null}:{};Re(l=>l.map(d=>d.id===t?{...d,...i,stage:a}:d),()=>V({id:t,...i,stage:a}),"Setting the status")},is=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],Xd=(t,e)=>{let n=Math.max(0,is.findIndex(d=>d[0]===t)),[,s,a,i]=is[n],l=is[(n+1)%is.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: ${s} \u2014 click for ${l[1]}" aria-label="Priority ${s}">${pd(i,a)}<span>${s}</span></button>`},ie=()=>!!o.me&&/@guest\.notemend\.com$/i.test(o.me.email),Hi=(t,e,n,s,a=!1,i=!1,l=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${o.client?"":Xd(t,n)}${l?"":Jo(sn(e).id,n,a)}</span>${o.client||ie()?"":`<span class="dt-who">${i?"":Mi(s,n)}${Li(n?j.find(d=>d.id===n):void 0,s,n,i)}</span>`}</div>`,Ni='<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>',Jd=t=>{let e=Qt(t?.querySelector("h1, h2, h3, h4, h5, h6")?.textContent??t?.innerText?.split(`
|
|
236
|
+
`).find(n=>Qt(n))??"");return e?e.length>30?`${Zt(e,30)}\u2026`:e:t?.tagName.toLowerCase()??""},Bi='<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>',Ri='<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>',Zd='<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>',Zo='<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>',Pi='<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>',Ii='<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>',Oi=t=>{let e=(a,i,l,d="")=>`<option value="${a}" data-icon="${f(i)}"${d}>${l}</option>`,n=t&&Xe()?Lt(t)?e("dup",Zo,"Duplicate to workspace")+(t.client?"":e("move",Pi,"Move to workspace")):e("dup",Zo,"Duplicate for the client")+e("move",Pi,"Move to clients"):"",s=t&&o.client&&t.status==="done"?e("reopen",bn,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${Ri}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
|
|
221
237
|
<option value="" hidden selected></option>
|
|
222
|
-
${n}${
|
|
223
|
-
${e(t?"rm":"discard",
|
|
224
|
-
</select></label>`},
|
|
225
|
-
${n.map(a
|
|
226
|
-
</select></span></label>`},En='<svg viewBox="0 0 20 20" width="9" height="9" aria-hidden="true"><path d="M5.5 5.5l9 9M14.5 5.5l-9 9"/></svg>',la='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',Nr='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M2.5 1.5h2.5v9H2.5zM7 1.5h2.5v9H7z"/></svg>',Rr=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,Pr=(t,e)=>{let n=t.closest(".dt-voice"),o=n.querySelector("audio"),a=n.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let f=n.querySelector(".dt-voice-track i"),u=n.querySelector(".dt-voice-time"),P=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{f.style.transform=`scaleX(${P()?Math.min(1,o.currentTime/P()):0})`,u.textContent=Rr(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=Nr,a.setAttribute("aria-label","Pause"),n.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=la,a.setAttribute("aria-label","Play the voice note"),n.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let r=()=>{if(e){let f=n.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-f.left)/f.width))*o.duration);return}if(!o.paused){o.pause();return}J.querySelectorAll(".dt-voice audio").forEach(f=>{f!==o&&f.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?r():l(),{once:!0}):r();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,r()},{once:!0}),o.currentTime=1e9}},_s=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),da=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Mn=new Map,Ir=t=>{if(!t.startsWith("data:"))return t;let e=Mn.get(t);if(!e){let[n,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:n.slice(5).split(";")[0]})),Mn.set(t,e),Mn.size>8){let[a,r]=Mn.entries().next().value;URL.revokeObjectURL(r),Mn.delete(a)}}return e},Or=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${la}</button><button type="button" class="dt-voice-track" data-act="voice-seek" aria-label="Jump"><i></i></button><span class="dt-voice-time">0:00</span><audio src="${Ir(t)}" preload="metadata"></audio>${e===void 0?"":`<button class="dt-voice-rm" data-act="voice-write" ${e} aria-label="Write it out" title="Write it out \u2014 its words go in the box">${Yr}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${En}</button>`}</span>`,zs=t=>t.length>30?`${t.slice(0,17)}\u2026${t.slice(-11)}`:t,Dr=t=>{if(!t.startsWith("data:"))return"";let e=Math.round((t.length-t.indexOf(",")-1)*3/4);return e<1024*1024?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`},Vs=t=>{let e=Si(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},qr=(t,e,n)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",r=`${Vs(e)}<span class="dt-file-text"><b>${g(zs(e))}</b>${o?"":`<small>${Dr(t)}</small>`}</span>`;return`<span class="dt-file" title="${g(e)}">${o?`<a class="dt-file-open" href="${g(Lo(e)?t:a)}"${Lo(e)?' target="_blank" rel="noreferrer"':` download="${g(e)}"`}>${r}</a><a class="dt-tip-r dt-file-get" href="${g(a)}" download="${g(e)}" aria-label="Download ${g(e)}" data-tip="Download">${Wr}</a>`:`<span class="dt-file-open">${r}</span>`}${n===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${n} aria-label="Remove">${En}</button>`}</span>`},Fr=(t,e)=>{let[,n,o]=t.split("\0");return`<span class="dt-file is-refused" title="${g(n)}"><span class="dt-file-open">${Vs(n)}<span class="dt-file-text"><b>${g(zs(n))}</b><small>${g(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${En}</button></span>`},jr=(t,e)=>{let[,,n,o]=t.split("\0");return`<span class="dt-file" title="${g(n)}"><span class="dt-file-open">${Vs(n)}<span class="dt-file-text"><b>${g(zs(n))}</b><small>${(Number(o)/1024/1024).toFixed(1)} MB \u2014 uploads when you send</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${En}</button></span>`},ca=(t,e,n=t)=>t.startsWith(Jn)?Fr(t,e??""):t.startsWith(Ks)?jr(t,e??""):qn(n)?qr(t,qn(n),e):_s(n)?Or(t,e):`<span class="dt-shot${da(n)?" dt-shot--video":""}">${da(n)?`<video src="${t}" controls preload="metadata" playsinline></video>`:`<a href="${t}" target="_blank"><img src="${t}" alt="" loading="lazy" /></a>`}${e===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${e} aria-label="Remove">${En}</button>`}</span>`,Us=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(n=>{let o=n.split("/").pop(),a=Ei(o);return ca(a,e===void 0?void 0:`data-id="${e}" data-img="${g(o)}"`,o)}).join("")}</div>`:"",ua=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,n)=>ca(e,`data-i="${n}"`)).join("")}</div>`:"",Xn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',Wr='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3.5v9M6 9l4 4 4-4M4 16.5h12" stroke-linejoin="round"/></svg>',_r='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><path d="M16 9.5 9.9 15.6a3.6 3.6 0 0 1-5.1-5.1l6.6-6.6a2.4 2.4 0 0 1 3.4 3.4l-6.6 6.6a1.2 1.2 0 0 1-1.7-1.7L12.4 6.3" stroke-linejoin="round"/></svg>',Jn="refused:\0",Ks="big:\0",Zn=new Map,dn=t=>!t.startsWith(Ks),gd='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M11.5 2.5H6a1.5 1.5 0 0 0-1.5 1.5v12A1.5 1.5 0 0 0 6 17.5h8a1.5 1.5 0 0 0 1.5-1.5V6.5z"/><path d="M11.5 2.5v4h4"/></svg>',zr='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="7.5" y="3" width="5" height="9" rx="2.5"/><path d="M5 9.5a5 5 0 0 0 10 0M10 14.5V17"/></svg>',Vr='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',Ur=90,Gs=32,Kr=()=>!!s.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",Qn=!1,Gr=async(t,e)=>{if(Qn||!t)return;let n=Number(t.dataset.id)||0;Qn=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Mt("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(pt){clearTimeout(o),Qn=!1,e.classList.remove("is-asking");let dt=pt?.name;Mt(dt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":dt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":dt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${pt?.message||dt||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let r=()=>J.querySelector(n?`.dt-note[data-id="${n}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),l=document.createElement("div");l.className="dt-rec",l.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${Ze}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(Gs)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${Vr}</button>`;let f=l.querySelector("b"),u=[...l.querySelectorAll(".dt-rec-wave i")],P=new AudioContext,j=P.createAnalyser();j.fftSize=512,P.createMediaStreamSource(a).connect(j);let c=new Uint8Array(j.fftSize),U=[],I=new MediaRecorder(a,{audioBitsPerSecond:32e3}),K=[],_=Date.now(),Rt=!0,Dt=setInterval(()=>{let pt=r();pt&&l.parentElement!==pt&&pt.appendChild(l),j.getByteTimeDomainData(c);let dt=0;for(let gn of c)dt+=((gn-128)/128)**2;U.push(Math.min(1,Math.sqrt(dt/c.length)*4));let Te=U.slice(-Gs);u.forEach((gn,xo)=>{let Xe=Te[xo-(Gs-Te.length)];gn.style.transform=`scaleY(${Math.max(.1,Xe??0).toFixed(2)})`,gn.classList.toggle("is-empty",Xe===void 0)});let ce=Math.floor((Date.now()-_)/1e3);f.textContent=`${Math.floor(ce/60)}:${String(ce%60).padStart(2,"0")}`,ce>=Ur&&I.state!=="inactive"&&I.stop()},90),de=pt=>{Rt=pt,I.state!=="inactive"&&I.stop()};l.querySelector(".dt-rec-x").addEventListener("click",pt=>{pt.stopPropagation(),de(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",pt=>{pt.stopPropagation(),de(!0)}),l.addEventListener("keydown",pt=>{pt.key==="Escape"&&(pt.stopPropagation(),de(!1))}),I.ondataavailable=pt=>{pt.data.size&&K.push(pt.data)},I.onstop=async()=>{if(clearInterval(Dt),a.getTracks().forEach(Te=>Te.stop()),P.close().catch(()=>{}),l.remove(),Qn=!1,!Rt)return;let pt=new Blob(K,{type:I.mimeType||"audio/webm"}),dt=await new Promise(Te=>{let ce=new FileReader;ce.onload=()=>Te(String(ce.result)),ce.readAsDataURL(pt)});n?Bt.push(dt):T&&(T.images??=[]).push(dt),Q(),r()?.querySelector("textarea")?.focus()},I.start(1e3),r()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},pa="\u{1F3A4} Voice note",Yr='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><rect x="2.5" y="4.5" width="15" height="11" rx="2"/><path d="M6 11.5h3M11 11.5h3M6 8.5h8"/></svg>',Xr=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?T?.images??[]:Bt)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await At("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),r=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!r.text){Mt(r.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${r.text}`:r.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},Me=new Map,ha=async(t,e,n)=>{let o=`${t}:${e}`;if(!n&&Me.has(o)){Me.delete(o),Q();return}let a=V.find(u=>u.id===t),r=a&&Oe(a).find(u=>(u.at??"0")===e);if(!r?.text)return;Me.set(o,null),Q();let l=await At("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:r.text,to:n||navigator.language||"en"})}).catch(()=>null),f=l?await l.json().catch(()=>({})):{};Me.has(o)&&(l?.ok&&f.text?Me.set(o,f.text):(Me.delete(o),Mt(f.error||"Could not translate it \u2014 try again.")),Q())},Jr=["uk","ru","en"],Zr=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},Qr=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${ta}</span><select class="dt-lang-select" data-id="${t}" data-at="${g(e)}" aria-label="Translate into"><option value="" selected hidden></option>${Jr.map(n=>`<option value="${g(n)}">${g(Zr(n))}</option>`).join("")}</select></label>`,tl='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M3 5h8M7 3v2m2 0c-.6 3.2-2.8 6-6 7.5M5.5 8.5c.8 1.6 2.2 2.9 4 3.8M10.5 17l3.25-7.5L17 17m-5.5-2h4.5"/></svg>',el='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/></svg>',ma='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M15.9 9.3a6.5 6.5 0 1 1-5.2-5.7"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/><path d="M15.5 2.5v4.5M13.25 4.75h4.5"/></svg>',Ys=()=>s.me?.email??"you",nl=(t,e,n)=>{let o=Object.entries(n??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,r])=>{let l=r.includes(Ys()),f=r.map(u=>u===Ys()?"You":ze(u)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${g(e)}" data-emoji="${g(a)}" aria-pressed="${l}" data-tip="${g(f)}" aria-label="${g(`${a} ${r.length}: ${f}`)}">${g(a)}<span>${r.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${g(e)}" data-tip="Add reaction" aria-label="Add reaction">${ma}</button></div>`:""},ga=(t,e,n)=>{ts();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",n.box?"Emoji":"React"),o.innerHTML=(e?Hi:Ci).map(P=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${g(P)}" aria-label="${g(P)}">${g(P)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${sa}</button>`),ke={...n,btn:t},J.append(o);let a=t.getBoundingClientRect(),r=o.getBoundingClientRect(),l=6,f=8,u=a.bottom+l+r.height<=innerHeight-f;o.style.top=`${u?a.bottom+l:Math.max(f,a.top-l-r.height)}px`,o.style.left=`${Math.min(Math.max(f,a.right-r.width),innerWidth-f-r.width)}px`,o.querySelector("button")?.focus()},ke=null,ts=()=>{J.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),ke=null},sl=(t,e)=>{t.setRangeText(e,t.selectionStart??t.value.length,t.selectionEnd??t.value.length,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},fa=(t,e,n)=>{let o=a=>{let r=Bi(a.reactions,n,Ys());return r===null?a:{...a,reactions:r}};Qt(a=>a.map(r=>r.id!==t?r:e?{...r,replies:r.replies?.map(l=>l.at===e?o(l):l)}:o(r)),()=>y({id:t,react:{at:e,emoji:n}}),"The reaction")},ol='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="3" y="4" width="14" height="12" rx="2"/><circle cx="7.5" cy="8.5" r="1.4"/><path d="m3.5 14.5 4-4 3 3 2-2 4 4"/></svg>',Xs=1e4,ba=(t,e,n,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
227
|
-
<textarea class="${t}" rows="1" maxlength="${
|
|
238
|
+
${n}${s}${t?e("link",Ii,"Copy link"):""}
|
|
239
|
+
${e(t?"rm":"discard",Hn,t?"Delete thread":"Discard draft",` data-danger${t?" data-sep":""}`)}
|
|
240
|
+
</select></label>`},Ys=()=>o.studio?(o.team??[]).filter(t=>o.studio.includes(t.email)):[],Di=t=>{let e=t||o.lead||"",n=Ys();return!n.length||n.some(s=>s.email===e)?e:n[0].email},Qd=t=>{let e=Di(t),n=Ys();if(!n.length)return"";let s=Wd(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${s?" dt-field-box--face":""}" style="--cat:${bi(e||"x@x")}">${s}<select class="dt-for-select" aria-label="Who this is for">
|
|
241
|
+
${n.map(a=>Ei(a.email,a.name||a.email,{dot:!0,selected:e===a.email})).join("")}
|
|
242
|
+
</select></span></label>`},rs='<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>',qi='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',tc='<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>',ec=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,nc=(t,e)=>{let n=t.closest(".dt-voice"),s=n.querySelector("audio"),a=n.querySelector(".dt-voice-play");if(!s.dataset.wired){s.dataset.wired="1";let d=n.querySelector(".dt-voice-track i"),u=n.querySelector(".dt-voice-time"),g=()=>Number.isFinite(s.duration)?s.duration:0;s.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${g()?Math.min(1,s.currentTime/g()):0})`,u.textContent=ec(s.currentTime)}),s.addEventListener("play",()=>{a.innerHTML=tc,a.setAttribute("aria-label","Pause"),n.classList.add("is-playing")}),s.addEventListener("pause",()=>{a.innerHTML=qi,a.setAttribute("aria-label","Play the voice note"),n.classList.remove("is-playing")}),s.addEventListener("ended",()=>{s.currentTime=0})}let i=()=>{if(e){let d=n.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(s.duration)&&(s.currentTime=Math.max(0,Math.min(1,(e.clientX-d.left)/d.width))*s.duration);return}if(!s.paused){s.pause();return}U.querySelectorAll(".dt-voice audio").forEach(d=>{d!==s&&d.pause()}),s.play().catch(()=>{})};if(Number.isFinite(s.duration)||s.readyState<1){s.readyState<1?s.addEventListener("loadedmetadata",()=>Number.isFinite(s.duration)?i():l(),{once:!0}):i();return}l();function l(){s.addEventListener("timeupdate",()=>{s.currentTime=0,i()},{once:!0}),s.currentTime=1e9}},Qo=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),Fi=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),ls=new Map,sc=t=>{if(!t.startsWith("data:"))return t;let e=ls.get(t);if(!e){let[n,s]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(s),a=>a.charCodeAt(0))],{type:n.slice(5).split(";")[0]})),ls.set(t,e),ls.size>8){let[a,i]=ls.entries().next().value;URL.revokeObjectURL(i),ls.delete(a)}}return e},oc=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${qi}</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="${sc(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">${fc}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${rs}</button>`}</span>`,ta=t=>t.length>30?`${Zt(t,17)}\u2026${[...t].slice(-11).join("")}`:t,ac=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`},ea=t=>{let e=Fl(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},ic=(t,e,n)=>{let s=!t.startsWith("data:"),a=s?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",i=`${ea(e)}<span class="dt-file-text"><b>${f(ta(e))}</b>${s?"":`<small>${ac(t)}</small>`}</span>`;return`<span class="dt-file" title="${f(e)}">${s?`<a class="dt-file-open" href="${f(Xa(e)?t:a)}"${Xa(e)?' target="_blank" rel="noreferrer"':` download="${f(e)}"`}>${i}</a><a class="dt-tip-r dt-file-get" href="${f(a)}" download="${f(e)}" aria-label="Download ${f(e)}" data-tip="Download">${dc}</a>`:`<span class="dt-file-open">${i}</span>`}${n===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${n} aria-label="Remove">${rs}</button>`}</span>`},rc=(t,e)=>{let[,n,s]=t.split("\0");return`<span class="dt-file is-refused" title="${f(n)}"><span class="dt-file-open">${ea(n)}<span class="dt-file-text"><b>${f(ta(n))}</b><small>${f(s)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${rs}</button></span>`},lc=(t,e)=>{let[,,n,s]=t.split("\0");return`<span class="dt-file" title="${f(n)}"><span class="dt-file-open">${ea(n)}<span class="dt-file-text"><b>${f(ta(n))}</b><small>${(Number(s)/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">${rs}</button></span>`},ji=(t,e,n=t)=>t.startsWith(Xs)?rc(t,e??""):t.startsWith(sa)?lc(t,e??""):Hs(n)?ic(t,Hs(n),e):Qo(n)?oc(t,e):`<span class="dt-shot${Fi(n)?" dt-shot--video":""}">${Fi(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">${rs}</button>`}</span>`,na=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(n=>{let s=n.split("/").pop(),a=Rl(s);return ji(a,e===void 0?void 0:`data-id="${e}" data-img="${f(s)}"`,s)}).join("")}</div>`:"",Wi=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,n)=>ji(e,`data-i="${n}"`)).join("")}</div>`:"",dc='<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>',cc='<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>',Xs="refused:\0",sa="big:\0",Js=new Map,jn=t=>!t.startsWith(sa),uc='<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>',pc='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',hc=90,oa=32,mc=()=>!!o.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",Zs=!1,gc=async(t,e)=>{if(Zs||!t)return;let n=Number(t.dataset.id)||0;Zs=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let s=setTimeout(()=>Rt("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(vt){clearTimeout(s),Zs=!1,e.classList.remove("is-asking");let Jt=vt?.name;Rt(Jt==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Jt==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Jt==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${vt?.message||Jt||"unknown error"}`,9e3);return}clearTimeout(s),e.classList.remove("is-asking");let i=()=>U.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">${Hn}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(oa)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${pc}</button>`;let d=l.querySelector("b"),u=[...l.querySelectorAll(".dt-rec-wave i")],g=new AudioContext,w=g.createAnalyser();w.fftSize=512,g.createMediaStreamSource(a).connect(w);let N=new Uint8Array(w.fftSize),G=[],p=new MediaRecorder(a,{audioBitsPerSecond:32e3}),Y=[],z=Date.now(),xt=!0,Ce=setInterval(()=>{let vt=i();if(!vt){re(!1);return}l.parentElement!==vt&&vt.appendChild(l),w.getByteTimeDomainData(N);let Jt=0;for(let Pt of N)Jt+=((Pt-128)/128)**2;G.push(Math.min(1,Math.sqrt(Jt/N.length)*4));let Ve=G.slice(-oa);u.forEach((Pt,xo)=>{let Zn=Ve[xo-(oa-Ve.length)];Pt.style.transform=`scaleY(${Math.max(.1,Zn??0).toFixed(2)})`,Pt.classList.toggle("is-empty",Zn===void 0)});let le=Math.floor((Date.now()-z)/1e3);d.textContent=`${Math.floor(le/60)}:${String(le%60).padStart(2,"0")}`,le>=hc&&p.state!=="inactive"&&p.stop()},90),re=vt=>{xt=vt,p.state!=="inactive"&&p.stop()};l.querySelector(".dt-rec-x").addEventListener("click",vt=>{vt.stopPropagation(),re(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",vt=>{vt.stopPropagation(),re(!0)}),l.addEventListener("keydown",vt=>{vt.key==="Escape"&&(vt.stopPropagation(),re(!1))}),p.ondataavailable=vt=>{vt.data.size&&Y.push(vt.data)},p.onstop=async()=>{if(clearInterval(Ce),a.getTracks().forEach(Ve=>Ve.stop()),g.close().catch(()=>{}),l.remove(),Zs=!1,!xt)return;let vt=new Blob(Y,{type:p.mimeType||"audio/webm"}),Jt=await new Promise(Ve=>{let le=new FileReader;le.onload=()=>Ve(String(le.result)),le.readAsDataURL(vt)});n?Xt.push(Jt):C&&(C.images??=[]).push(Jt),J(),i()?.querySelector("textarea")?.focus()},p.start(1e3),i()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},_i="\u{1F3A4} Voice note",fc='<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>',bc=async t=>{let e=t.closest(".dt-note"),s=(e?.hasAttribute("data-draft")?C?.images??[]:Xt)[Number(t.dataset.i)];if(!s||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await zt("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:s})}).catch(()=>null),i=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!i.text){Rt(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())},Qe=new Map,zi=async(t,e,n)=>{let s=`${t}:${e}`;if(!n&&Qe.has(s)){Qe.delete(s),J();return}let a=j.find(u=>u.id===t),i=a&&mn(a).find(u=>(u.at??"0")===e);if(!i?.text)return;Qe.set(s,null),J();let l=await zt("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:i.text,to:n||navigator.language||"en"})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};Qe.has(s)&&(l?.ok&&d.text?Qe.set(s,d.text):(Qe.delete(s),Rt(d.error||"Could not translate it \u2014 try again.")),J())},vc=["uk","ru","en"],yc=t=>{try{let e=new Intl.DisplayNames([t],{type:"language"}).of(t)??t;return e[0].toUpperCase()+e.slice(1)}catch{return t}},wc=(t,e)=>`<label class="dt-msg-edit dt-msg-lang" title="Translate into\u2026"><span aria-hidden="true">${Us}</span><select class="dt-lang-select" data-id="${t}" data-at="${f(e)}" aria-label="Translate into"><option value="" selected hidden></option>${vc.map(n=>`<option value="${f(n)}">${f(yc(n))}</option>`).join("")}</select></label>`,$c='<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>',xc='<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>',Gi='<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>',aa=()=>o.me?.email??"you",Ec=(t,e,n)=>{let s=Object.entries(n??{}).filter(([,a])=>a.length);return s.length?`<div class="dt-reacts">${s.map(([a,i])=>{let l=i.includes(aa()),d=i.map(u=>u===aa()?"You":ln(u)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${f(e)}" data-emoji="${f(a)}" aria-pressed="${l}" data-tip="${f(d)}" aria-label="${f(`${a} ${i.length}: ${d}`)}">${f(a)}<span>${i.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${f(e)}" data-tip="Add reaction" aria-label="Add reaction">${Gi}</button></div>`:""},Vi=(t,e,n)=>{Qs();let s=document.createElement("div");s.className=`dt-emoji${e?" is-all":""}`,s.setAttribute("role","menu"),s.setAttribute("aria-label",n.box?"Emoji":"React"),s.innerHTML=(e?zl:_l).map(w=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${f(w)}" aria-label="${f(w)}">${f(w)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${Ri}</button>`),tn={...n,btn:t},U.append(s);let a=t.getBoundingClientRect(),i=s.getBoundingClientRect(),l=6,d=8,u=a.top-l-i.height>=d;s.style.top=`${u?a.top-l-i.height:Math.min(a.bottom+l,innerHeight-d-i.height)}px`;let g=(t.closest(".dt-note")??t).getBoundingClientRect().right;s.style.left=`${Math.min(Math.max(d,g-i.width),innerWidth-d-i.width)}px`,s.querySelector("button")?.focus()},tn=null,Qs=()=>{U.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),tn=null},Mc=(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()},Ui=(t,e,n)=>{let s=a=>{let i=Gl(a.reactions,n,aa());return i===null?a:{...a,reactions:i}};Re(a=>a.map(i=>i.id!==t?i:e?{...i,replies:i.replies?.map(l=>l.at===e?s(l):l)}:s(i)),()=>V({id:t,react:{at:e,emoji:n}}),"The reaction")},kc='<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>',ia=1e4,Ki=(t,e,n,s,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
243
|
+
<textarea class="${t}" rows="1" maxlength="${ia}" aria-label="${e}" placeholder="${e}">${f(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${n.trim()?" is-ready":""}" ${
|
|
246
|
+
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${kc}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${cc}</button>
|
|
247
|
+
${mc()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${uc}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${xc}</button></span>
|
|
248
|
+
<button class="dt-send${n.trim()?" is-ready":""}" ${s} 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":n==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${qt}</button>${s.client||_t()?"":`<button data-act="${a?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${a?" is-on":""}" title="${a?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${Xn}</button>`}`},al=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!re(t)&&!kn(t)){let u=t.confirmedBy?t.confirmedBy===s.me?.email?"you":ze(t.confirmedBy):"",P=t.confirmedAt;return`<div class="dt-step dt-step--resolved"><span class="dt-step-text"><b>${g(u?`Resolved by ${u}`:"Resolved")}</b>${P?` \xB7 ${Je(P)}`:""}</span><button type="button" class="dt-step-act" data-act="reopen" data-id="${t.id}" data-tip="Reopen \u2014 not right yet" aria-label="Reopen">${Ae}</button>`+(s.client?"</div>":`<button type="button" class="dt-step-act is-main" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${Xn}</button></div>`)}if(s.client||$t(t))return"";let e=ne(t),n={act:"hand",v:"me",icon:Fs,tip:s.me?"Take it myself":"Take it off Claude"},o={act:"reopen",icon:Ae,tip:"Reopen"},a=[{act:"accept",icon:qt,tip:"Looks right \u2014 mark it resolved",main:!0},{act:"sendback",icon:Ae,tip:"Send it back \u2014 say what is wrong below"}],r=t.working,l=!kt(t.assignee)&&t.assignee?t.assignee===s.me?.email?"You":ze(t.assignee):"",f=e==="queued"?{step:e,title:`With ${me(t)} \u2014 queued`,acts:[n]}:e==="working"?{step:e,title:`With ${me(t)} \u2014 working`,acts:[n],live:!0}:e==="asks"?{step:e,title:`With ${me(t)} \u2014 it asks you`,acts:[]}:e==="stuck"?{step:e,title:`With ${me(t)} \u2014 silent for ${wa(r?.at)}`,acts:[n]}:e==="review"?null:Xt(t)==="review"&&l?{step:"review",title:`To check \u2014 ${l} ${l==="You"?"say":"says"} done`,acts:a}:!e&&!t.assignee&&t.status!=="done"&&s.me&&!_t()?{step:"anyone",title:"Anyone",acts:[{act:"hand",v:"me",icon:qt,tip:"Take it myself"},{act:"hand",v:"agent",icon:zt(13),tip:`Give it to ${me(t)}`},{act:"give",icon:Hr,tip:"Give it to someone",pick:!0}]}:null;return f?`<div class="dt-step dt-step--${f.step}">${f.step==="anyone"?jo:""}<span class="dt-step-text"><b>${g(f.title)}</b></span>${f.acts.map(u=>u.pick?`<label class="dt-step-act" data-tip="${g(u.tip)}">${u.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${g(u.tip)}"><option value="" selected hidden></option>${_e().map(P=>`<option value="${g(P.email)}"${Ds(P.email)}>${g(P.email===s.me?.email?`Me \xB7 ${P.name||P.email}`:P.name||P.email)}</option>`).join("")}</select></label>`:`<button type="button" class="dt-step-act${u.main?" is-main":""}" data-act="${u.act}" data-id="${t.id}"${u.v?` data-v="${u.v}"`:""} data-tip="${g(u.tip)}" aria-label="${g(u.tip)}">${u.icon}</button>`).join("")}${f.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`:""},il=async(t,e)=>{let n=e?V.find(a=>a.id===t):void 0,o=await y(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,stage:Ea(V.find(a=>a.id===t))});return o.ok&&n&&mo(he(n)).then(a=>{a&&y({id:t,after:a})}),o},Qs=0,ns=t=>(Qs++,t.finally(()=>{Qs--})),Qt=async(t,e,n)=>{let o=V,a=wt;V=t(V),wt=t(wt),Q();let r=await ns(e()).catch(()=>null);if(!r?.ok){V=o,wt=a,Q(),Rn(`${n} did not go through`,r);return}let l=pn([await r.json().catch(()=>null)])[0];l&&(V=V.map(f=>f.id===l.id?l:f),wt=wt.map(f=>f.id===l.id?l:f),Q()),Ye()},Ea=t=>t?kt(t.assignee)?"approved":t.assignee?"progress":"new":"new",Le=async(t,e)=>{await Qt(r=>r.map(l=>l.id===t?{...l,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{stage:Ea(l),reopenedAt:new Date().toISOString(),reopenedBy:s.me?.email??"you"}}:l),()=>il(t,e),e?"Resolving":"Reopening");let n=wt.find(r=>r.id===t),o=n?.from,a=o&&wt.find(r=>r.id===o.id);e&&n?.status==="done"&&a&&$t(a)&&!$t(n)&&a.status!=="done"&&(await y({id:a.id,reply:"Fixed \u2014 please check.",status:"done",doneBy:"you"}).catch(()=>null),Ye())},Ue=async(t,e,n=!1)=>{let o=V.find(r=>r.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await Qt(r=>r.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?s.me?.email:void 0}:l),()=>y({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!n&&Re(`Archived #${t}`,()=>Ue(t,!1,!0))},Re=(t,e,n="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${g(t)}</span><button type="button">${g(n)}</button>`,Wt(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>o.remove(),5e3)},to=t=>Qt(e=>e.filter(n=>n.id!==t),()=>At(`comments?id=${t}`,{method:"DELETE"}),"Deleting"),rl=t=>{let e=V.filter(a=>S(a)===t),n=e.filter(a=>ht(a)==="open").length,o=e.filter(a=>ht(a)==="claude").length;we.innerHTML=n?String(n):o?zt(9):"\u2713",we.dataset.state=n?"open":o?"claude":"done",we.hidden=e.length===0},eo=0,Ma,Ln=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t)return;t.style.translate="";let e=window.visualViewport,n=t.getBoundingClientRect(),o=n.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,n.top-8)}px`)};window.visualViewport?.addEventListener("resize",Ln),addEventListener("resize",Ln),document.addEventListener("focusin",Ln),document.addEventListener("focusout",()=>setTimeout(Ln));let Q=()=>{requestAnimationFrame(Ln);let t=eo-performance.now();if(t>0){clearTimeout(Ma),Ma=setTimeout(Q,t);return}if(wn(),b){let c=ya(),U=JSON.stringify(c);U!==va&&(va=U,parent.postMessage({dt:!0,drafts:c},location.origin))}Po(),q.toggleAttribute("data-yield",tt!=null||!!T),tt!==Et&&(Ht="",Bt=[],Et=tt),gt&>.id!==tt&&(gt=null);let e=xe();if(rl(e),Ss(),!Tt){J.innerHTML="",Cs(null),xt.hidden=!0;return}let n=e;if(tt!=null&&!T){let c=V.find(U=>U.id===tt);c&&S(c)!==n&&(tt=null)}let o="",a=V.filter(c=>S(c)===n&&(Ro(c)&&on(c)||c.id===tt));for(let c of a){let U=Zt(c);if(!U&&tt!==c.id)continue;let I=ht(c),K=!U,_=U??{x:0,y:0},Rt=Qe(c.category),Dt=De(c),de=I==="done"?null:ne(c),pt=de?Os[de]??"":"",dt=Es(c,I),Te=!!dt&&!dt.taker,ce=!!dt&&!!dt.taker&&dt.taker!==dt.writer,gn=pt||xn.find(Xe=>Xe[0]===ln(c))[2],xo=dt?Te?` \xB7 ${Is(dt.writer,c)} \xB7 nobody has it yet`:` \xB7 ${ce?`${Is(dt.writer,c)} \u2192 `:""}${Is(dt.taker,c)}${dt.claude?` \xB7 Claude${Dt?" is working":de==="asks"?" asks":de==="review"||I==="claude"?" fixed it":""}`:""}`:"";if(tt===c.id&&yr(c),K||(o+=`<button class="dt-pin dt-pin--${I}${I==="done"&&!re(c)?" dt-pin--resolved":""}${dt?` dt-pin--people${Te?" dt-pin--nobody":""}${ce?" dt-pin--pair":""}`:pt?" dt-pin--agent":""}${Dt?" dt-pin--working":""}${I==="open"&&Xt(c)==="review"?" dt-pin--review":""}${U?.hidden?" dt-pin--hidden":""}${tt!==c.id&&!ea(c,pe)?" dt-pin--dim":""}" data-id="${c.id}"${U?.off?` data-off="${U.off}"`:""} aria-label="Comment ${c.id}, ${I==="open"?"open":I==="claude"?`resolved by ${g(Ve(c.doneAgent,c.doneFor))}`:"resolved"}" aria-expanded="${tt===c.id}"
|
|
237
|
-
style="left:${
|
|
238
|
-
title="${
|
|
239
|
-
style="left:${
|
|
251
|
+
</div></div>`,ra=(t,e,n)=>(t||/^[a-z][a-z0-9-]*/i.exec(n?.split(">").pop()?.trim()??"")?.[0]||"element")+(e?.[0]?"."+e[0]:""),Yi=()=>pe.map((t,e)=>({i:e,el:ra(t.tag,t.classes,t.selector),text:Qt(t.text??""),shots:t.images?.length??0,orphan:!ae(t)})),la=[],Xi="",Me=t=>Ue(t.working?.agent),Lc=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`},to=(t,e)=>{let n=t.working;return{held:"From a guest \u2014 waits for the studio to approve it",queued:`Queued for ${Me(t)} \u2014 it takes it on its next run`,asks:`${Me(t)} is waiting for your answer`,working:`${Me(t)} is on it \xB7 ${Lc(n?.at)}`,stuck:`${Me(t)} went quiet \u2014 its next run takes it again`,review:`To check \u2014 ${Ue(t.doneAgent)} fixed it \xB7 click to reopen`,done:"Resolved"}[e]},Ji=t=>{if(o.client||ie()||Lt(t))return"";let e=Ut(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 Claude" aria-label="Hand to Claude">${ti(13,0)}</button>`;let n=ti(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${f(to(t,e))}" aria-label="${f(to(t,e))}">${n}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${f(to(t,e))}" role="img" aria-label="${f(to(t,e))}">${n}</span>`},yn=t=>!!o.client&&!(o.me&&t.by===o.me.email),Zi=(t,e=!0)=>{if(yn(t))return e?Ji(t):"";let n=Mt(t),s=n==="done",a=Ee(t);return`${e?Ji(t):""}<button data-act="${s?"reopen":"done"}" data-id="${t.id}"
|
|
252
|
+
class="dt-note-resolve${s&&!a?" is-on":""}" title="${s?"Reopen":n==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${be}</button>${o.client||ie()?"":`<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"}">${gn}</button>`}`},Qi='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',da=new Map,Sc=(t,e)=>{let n=Bo(e,25),s=da.get(t);s?.now!==n&&da.set(t,{now:n,was:s?.now??"",at:performance.now()});let a=da.get(t),i=a.was&&performance.now()-a.at<160?a.was:"";return`<span class="dt-step-words">${i?`<span class="dt-step-was" data-k="was:${f(i)}" aria-hidden="true">${f(i)}</span>`:""}<span class="dt-step-now" data-k="${f(n)}"${n!==e?` data-tip="${f(e)}"`:""}>${f(n)}</span></span>`},Tc=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!Ee(t)&&!yn(t)){let g=t.confirmedBy?t.confirmedBy===o.me?.email?"you":ln(t.confirmedBy).split(" ")[0]:"",w=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${Ae(Ze[Ze.length-1][2],1)}<span class="dt-step-text"><b>${f(g?`Resolved by ${g}`:"Resolved")}${w?` \xB7 ${f(Po(w))}`:""}</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">${bn}</button>`+(o.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">${gn}</button></div>`)}if(o.client||Lt(t))return"";let e=Ut(t),n={act:"hand",v:"me",icon:Bi,tip:o.me?"Take it myself":"Take it off Claude"},s=[{act:"sendback",icon:bn,tip:"Send it back \u2014 say what is wrong below"},{act:"accept",icon:be,tip:"Looks right \u2014 mark it resolved",main:!0,label:"Looks right"}],a=Ro(t),i=!Tt(t.assignee)&&t.assignee?t.assignee===o.me?.email?"You":ln(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 ${Me(t)} \u2014 queued`,sub:`Starts on ${Me(t)}\u2019s next run`,acts:[n]}:e==="working"?a?.step?{step:e,title:"",now:a.step,time:a.elapsed,acts:[n],live:!0}:{step:e,title:`With ${Me(t)} \u2014 working`,acts:[n],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:fe(t)==="review"&&i?{step:"review",title:`${i} ${i==="You"?"say":"says"} done`,acts:s}:null;if(!d)return"";let u=d.step==="review"?Ae(cn[2][2],cn[2][3]):`<i class="dt-step-mark">${de(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${u}${d.now?`${Qi}<span class="dt-step-text" aria-live="polite"><b>${Sc(t.id,d.now)}<i class="dt-step-time">${f(d.time??"")}</i></b></span>`:`<span class="dt-step-text"><b>${f(d.title)}</b>${d.sub?`<span>${f(d.sub)}</span>`:""}</span>`}${d.acts.map(g=>g.pick?`<label class="dt-step-act" data-tip="${f(g.tip)}">${g.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${f(g.tip)}"><option value="" selected hidden></option>${as().map(w=>Ei(w.email,w.email===o.me?.email?`Me \xB7 ${w.name||w.email}`:w.name||w.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${g.main?" is-main":""}${g.label?" has-label":""}" data-act="${g.act}" data-id="${t.id}"${g.v?` data-v="${g.v}"`:""} data-tip="${f(g.tip)}" aria-label="${f(g.tip)}">${g.icon}${g.label?f(g.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},Cc=async(t,e,n)=>{let s=e?j.find(i=>i.id===t):void 0,a=await V(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...n});return a.ok&&s&&Na(Be(s)).then(i=>{i&&V({id:t,after:i.url})}),a},eo=0,tr=()=>{},Wn=t=>(eo++,t.finally(()=>{eo--,tr()})),Re=async(t,e,n)=>{let s=j,a=pt;j=t(j),pt=t(pt),J();let i;_=s;try{i=e()}finally{_=null}let l=await Wn(i).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let g=xn([d.thread])[0];j=s.map(N=>g&&N.id===g.id?g:N),pt=a.map(N=>g&&N.id===g.id?g:N),J();let w=d.by?d.by==="claude"?"Claude":ln(d.by):"Someone";Rt(`${w[0].toUpperCase()}${w.slice(1)} changed the ${d.field} just now`,6e3),Ge();return}if(!l?.ok){j=s,pt=a,J(),Ln(`${n} did not go through`,l);return}let u=xn([await l.json().catch(()=>null)])[0];u&&(j=j.map(g=>g.id===u.id?u:g),pt=pt.map(g=>g.id===u.id?u:g),J()),Ge()},Ac=t=>t?Tt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!Lt(t)&&!o.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},en=async(t,e)=>{let n=e?void 0:Ac(j.find(l=>l.id===t)??pt.find(l=>l.id===t));await Re(l=>l.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{}:{...n,reopenedAt:new Date().toISOString(),reopenedBy:o.me?.email??"you"}}:d),()=>Cc(t,e,n),e?"Resolving":"Reopening");let s=pt.find(l=>l.id===t),a=e?Zl(s):null,i=a!=null&&pt.find(l=>l.id===a);i&&Lt(i)&&i.status!=="done"&&(await V({id:i.id,reply:Jl,status:"done",doneBy:"you"}).catch(()=>null),Ge())},wn=async(t,e,n=!1)=>{let s=j.find(i=>i.id===t);if(!s)return;let a=e&&s.status!=="done"?{status:"done",doneBy:"you"}:{};await Re(i=>i.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?o.me?.email:void 0}:l),()=>V({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!n&&nn(`Archived #${t}`,()=>wn(t,!1,!0))},nn=(t,e,n="Undo")=>{let s=document.createElement("div");s.className="dt-toast dt-toast--undo",s.innerHTML=`<span>${f(t)}</span><button type="button">${f(n)}</button>`,Fo(s),s.querySelector("button").addEventListener("click",()=>{s.remove(),e()}),document.body.append(s),setTimeout(()=>s.remove(),5e3)},no=new Set,so=new Set,ds=new Map,er=(t,e,n,s,a)=>{ds.get(t)?.(),n();let i=!1,l=()=>{i||(i=!0,clearTimeout(d),ds.delete(t),a())},d=window.setTimeout(l,5e3);ds.set(t,l),nn(e,()=>{i||(i=!0,clearTimeout(d),ds.delete(t),s())})};addEventListener("pagehide",()=>{for(let t of[...ds.values()])t()});let nr=(t,e,n)=>!e||t.some(s=>s.id===e.id)?t:[...t.slice(0,n),e,...t.slice(n)],ca=t=>{let e=j.find(i=>i.id===t),n=j.findIndex(i=>i.id===t),s=pt.find(i=>i.id===t),a=pt.findIndex(i=>i.id===t);er(`t${t}`,`Thread #${t} deleted`,()=>{no.add(t),j=j.filter(i=>i.id!==t),pt=pt.filter(i=>i.id!==t),J()},()=>{no.delete(t),j=nr(j,e,n),pt=nr(pt,s,a),J()},async()=>{let i=await Wn(zt(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);no.delete(t),i?.ok||Ln("Deleting did not go through",i),Ge()})},Hc=(t,e)=>{let n=`${t}|${e}`,s=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=s(j)??s(pt);if(!a)return;let i=(l,d)=>l.map(u=>u.id!==t?u:{...u,replies:(u.replies??[]).map(g=>g.at===e?d(g):g)});er(`r${n}`,"Reply deleted",()=>{so.add(n),j=i(j,l=>({...l,text:"",deleted:!0})),pt=i(pt,l=>({...l,text:"",deleted:!0})),J()},()=>{so.delete(n),j=i(j,()=>a),pt=i(pt,()=>a),J()},async()=>{let l=await Wn(V({id:t,unsay:e})).catch(()=>null);so.delete(n),l?.ok||Ln("Deleting the reply did not go through",l),Ge()})},_n=null,sr=t=>Math.max(70,t*18),or=t=>{let e=Mt(t),n=is.find(s=>s[0]===t.priority)?.[3]??1;return(t.id===Q?-100:0)+(Ee(t)?30:e==="done"?20:e==="claude"?10:0)-n},Nc=(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 s=new Map;for(let a of n){if(a.length<2)continue;a.sort((u,g)=>or(u)-or(g)||g.id-u.id);let i=a.length,l=sr(i),d=String(a[0].id);a.forEach((u,g)=>{let w=(-150+120*g/(i-1))*(Math.PI/180);s.set(u.id,{key:d,i:g,n:i,fx:Math.round(l*Math.cos(w))-16,fy:Math.round(l*Math.sin(w))+6})})}return s},ua=t=>{if(_n!==t){_n=t;for(let e of U.querySelectorAll(".dt-pin[data-stack]"))e.classList.toggle("is-fanned",e.dataset.stack===t)}};document.addEventListener("pointermove",t=>{if(!_n){let i=t.target?.closest?.(".dt-pin--stacktop");i&&t.pointerType==="mouse"&&ua(i.dataset.stack);return}let e=U.querySelector(`.dt-pin--stacktop[data-stack="${_n}"]`);if(!e){_n=null;return}let n=parseFloat(e.style.left),s=parseFloat(e.style.top),a=Number(e.querySelector(".dt-pin-count")?.textContent)||2;Math.hypot(t.clientX-n,t.clientY-(s-40))>sr(a)+36&&ua(null)},{passive:!0}),U.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),ua(e.dataset.stack))},!0);let Bc=(t,e)=>{let n=e||x||C?[]:h.filter(d=>d.id!==t).map(d=>({band:d,n:j.filter(u=>$(u)===d.id&&js(u)&&rn(u)).length})).filter(d=>d.n).sort((d,u)=>u.n-d.n);if(It.hidden=!n.length,!n.length)return;let[s,...a]=n,i=({band:d,n:u})=>`${u} ${u===1?"pin":"pins"} on ${d.label}`;It.dataset.bp=s.band.id;let l=`${gt(s.band.icon,15)}<span>${f(i(s))}</span>${Oo}`;It.dataset.html!==l&&(It.innerHTML=l,It.dataset.html=l),It.dataset.tip=a.length?`Also ${a.map(i).join(", ")}`:`Switch to ${s.band.label}`,It.setAttribute("aria-label",`${i(s)} \u2014 switch to ${s.band.label}`)};It.addEventListener("click",()=>{It.dataset.bp&&qa(It.dataset.bp)});let Rc=t=>{let e=j.filter(a=>$(a)===t),n=e.filter(a=>Mt(a)==="open").length,s=e.filter(a=>Mt(a)==="claude").length;Oe.innerHTML=n?String(n):s?de(9):"\u2713",Oe.dataset.state=n?"open":s?"claude":"done",Oe.hidden=e.length===0},cs=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t||(t.style.translate="",un))return;let e=window.visualViewport,n=t.getBoundingClientRect(),s=n.bottom-((e?e.offsetTop+e.height:innerHeight)-8);s>0&&(t.style.translate=`0 ${-Math.min(s,n.top-8)}px`)},ar=window.visualViewport?.height??innerHeight,ir=()=>{let t=window.visualViewport?.height??innerHeight,e=t<ar;if(ar=t,!e||!U.querySelector(".dt-note"))return cs();J();let n=document.activeElement?.closest(".dt-note.is-capped");n&&(n.scrollTop=n.scrollHeight)};window.visualViewport?.addEventListener("resize",ir),addEventListener("resize",ir),document.addEventListener("focusin",cs),document.addEventListener("focusout",()=>setTimeout(cs));let pa=()=>{let t=window.visualViewport;return Math.min(innerHeight,t?t.offsetTop+t.height:innerHeight,document.querySelector(".devtools")?.getBoundingClientRect().top??innerHeight)-8},ha=!1,rr=null,Pc=()=>{if(Q===rr||(rr=Q,at.hasAttribute("data-collapsed")&&!ha))return;let t=Q!=null?j.find(s=>s.id===Q):void 0,e=t&&ae(t),n=!1;if(e){at.removeAttribute("data-collapsed");let s=at.getBoundingClientRect();n=!!s.width&&e.x>s.left-12&&e.x<s.right&&(un||e.y>s.top&&e.y<s.bottom)}ha=n,at.toggleAttribute("data-collapsed",n)},lr=t=>{let e=at.hidden?null:at.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},dr=(t,e=pa())=>{if(t.style.marginTop="",un)return;let n=parseFloat(getComputedStyle(t).marginTop)||0,s=t.getBoundingClientRect().bottom-e;s>0&&(t.style.marginTop=`${n-s}px`);let a=t.getBoundingClientRect().top;a<8&&(t.style.marginTop=`${(parseFloat(t.style.marginTop)||n)+8-a}px`)},cr=t=>{let e=pa();for(let n of U.querySelectorAll(".dt-note")){let s=n.querySelector(".dt-note-thread");s&&s.scrollTop+s.clientHeight>=s.scrollHeight-4&&t.push(s);let a=n.scrollTop;delete n.dataset.flip,delete n.dataset.flipx,s?.style.removeProperty("max-height");for(let w of["max-height","overflow-y","margin-top","translate"])n.style.removeProperty(w);n.classList.remove("is-capped");let i=n.getBoundingClientRect(),l=i.top,d=e-l,u=l-32;if(i.bottom>e&&u>d&&(n.dataset.flip="1"),i.right>lr(i)-8&&(n.dataset.flipx="1"),n.style.marginLeft="",n.dataset.flipx&&innerWidth>=480){let w=n.getBoundingClientRect(),N=lr(w);w.right>N-8&&(n.style.marginLeft=`${(parseFloat(getComputedStyle(n).marginLeft)||0)-(w.right-N+8)}px`)}i=n.getBoundingClientRect();let g=n.dataset.flip?i.height-(e-8):i.bottom-e;g>0&&s&&(s.style.maxHeight=`${Math.max(40,s.clientHeight-g)}px`),n.getBoundingClientRect().height>e-8&&(Object.assign(n.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),n.classList.add("is-capped"),ii.has(n)?n.scrollTop=a:(ii.add(n),n.scrollTop=n.scrollHeight)),dr(n,e)}for(let n of t)n.scrollTop=n.scrollHeight},ur=0,un=!1,oo=t=>{t?.target?.closest?.(an)||(clearTimeout(ur),ur=window.setTimeout(()=>{un=!1,U.querySelector(".dt-note")&&(cr([]),requestAnimationFrame(cs),ke())},un?300:150))},J=()=>{for(let p of Object.keys($e))p!==String(Q)&&delete $e[p];if(requestAnimationFrame(cs),In(),x){let p=Yi(),Y=JSON.stringify(p);Y!==Xi&&(Xi=Y,parent.postMessage({dt:!0,drafts:p},location.origin))}if(ci(),at.toggleAttribute("data-yield",Q!=null||!!C),Q!==De){De!=null&&(oe||Xt.length)?Wo.set(De,{text:oe,images:[...Xt]}):De!=null&&Wo.delete(De);let p=Q!=null?Wo.get(Q):void 0;oe=p?.text??"",Xt=p?[...p.images]:[],De=Q}Ot&&Ot.id!==Q&&(Ot=null);let t=Ne();if(Rc(t),zo(),!Bt){U.innerHTML="",Uo(null),bt.hidden=!0,It.hidden=!0;return}let e=t;if(Q!=null&&!C){let p=j.find(Y=>Y.id===Q);p&&$(p)!==e&&(Q=null)}Pc();let n="",s=j.filter(p=>$(p)===e&&(js(p)&&rn(p)||p.id===Q)),a=new Map(s.map(p=>[p.id,ae(p)])),i=Nc(s,a);for(let p of s){let Y=a.get(p.id)??null,z=i.get(p.id);if(!Y&&Q!==p.id)continue;let xt=Mt(p),Ce=!Y,re=Y??{x:0,y:0},vt=sn(p.category),Jt=Ke(p),Ve=xt==="done"?null:Ut(p),le=Ve?Dn[Ve]??"":"",Pt=Ho(p,xt),xo=!!Pt&&!Pt.taker,Zn=!!Pt&&!!Pt.taker&&Pt.taker!==Pt.writer,Lu=le||cn.find(ks=>ks[0]===Fn(p))[2],Cl=Pt?xo?` \xB7 ${Xo(Pt.writer,p)} \xB7 anyone can take it`:` \xB7 ${Zn?`${Xo(Pt.writer,p)} \u2192 `:""}${Xo(Pt.taker,p)}${Pt.claude?` \xB7 ${Me(p)}${xi(p)}`:""}`:"";if(Q===p.id&&Od(p),Ce||(n+=`<button class="dt-pin dt-pin--${xt}${xt==="done"&&!Ee(p)?" dt-pin--resolved":""}${Pt?` dt-pin--people${xo?" dt-pin--nobody":""}${Zn?" dt-pin--pair":""}`:le?" dt-pin--agent":""}${Jt?" dt-pin--working":""}${xt==="open"&&fe(p)==="review"?" dt-pin--review":""}${Y?.hidden?" dt-pin--hidden":""}${Q!==p.id&&!Ci(p,Je)?" dt-pin--dim":""}${z?` dt-pin--stack${z.i?"":" dt-pin--stacktop"}${_n===z.key?" is-fanned":""}`:""}" data-id="${p.id}"${z?` data-stack="${z.key}"`:""}${Y?.off?` data-off="${Y.off}"`:""} aria-label="Thread ${p.id}, ${xt==="open"?"open":xt==="claude"?`resolved by ${f(Ue(p.doneAgent))}`:"resolved"}${f(Cl.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!Pt&&le?`, with ${f(Me(p))}`:""}${Y?.hidden?Ds:""}" aria-expanded="${Q===p.id}"
|
|
253
|
+
style="left:${re.x}px;top:${re.y}px;--cat:${vt.color};--ring:${Lu};--hue:${dn(p.by||p.byName||"")}${le?`;--step-c:${le}`:""}${ma.has(p.id)?`;--dt-page:${ma.get(p.id)}`:""}${z?`;--fx:${z.fx}px;--fy:${z.fy}px`:""}"
|
|
254
|
+
title="${f(Zt(p.text,80))} \xB7 ${vt.label}${Pt?f(Cl):Jt||Ve==="queued"?` \xB7 ${f(Me(p)+xi(p))}`:""}${xt==="claude"?` \xB7 resolved by ${f(Ue(p.doneAgent))} \u2014 tick to confirm`:xt==="done"?" \xB7 resolved":""}${Y?.hidden?Ds:""}${Pa(p)?" \u2014 drag to move":""}"${Pa(p)?" data-move":""}>${xt==="done"?"\u2713":Pt?`${yi(Pt.writer,p)}${Zn?yi(Pt.taker,p):""}${Pt.claude?`<i class="dt-pin-claude" aria-hidden="true">${de(9)}</i>`:""}`:le?de(11):vi(p)}${xt!=="done"&&Q!==p.id&&$i(p)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}${z&&!z.i?`<i class="dt-pin-count" aria-hidden="true">${z.n}</i><i class="dt-pin-spot" aria-hidden="true"></i>`:""}</button><i class="dt-pin-eye" data-eye="${p.id}" aria-hidden="true" style="left:${re.x}px;top:${re.y}px"${Y?.hidden?"":" hidden"}>${Ni}</i>`),Q===p.id){let ks=mn(p),Su=Ut(p)==="review"&&!o.client?ks.map(ut=>ut.author).lastIndexOf("claude"):-1,Tu=Ut(p)==="asks"&&!o.client?ks.length-1:-1;n+=`<div class="dt-note${Ce?" dt-note--orphan":""}" data-id="${p.id}" role="dialog" aria-label="Thread ${p.id}"
|
|
255
|
+
style="left:${re.x}px;top:${re.y}px">
|
|
240
256
|
<div class="dt-note-bar">
|
|
241
|
-
<span class="dt-note-el"${
|
|
257
|
+
<span class="dt-note-el"${o.client?"":` data-tip="${Ti(p.selector,p.label)}"`}>${o.client||Lt(p)?`Thread #${p.id>0?p.id:"\u2026"}`:f(ra(p.tag,p.classes,p.selector))}</span>
|
|
242
258
|
<span class="dt-note-tools">
|
|
243
|
-
${
|
|
259
|
+
${Zi(p,!1)}
|
|
244
260
|
<i class="dt-note-sep"></i>
|
|
245
|
-
${
|
|
246
|
-
<button data-act="close" data-id="${
|
|
261
|
+
${yn(p)?"":Oi(p)}
|
|
262
|
+
<button data-act="close" data-id="${p.id}" data-tip="Close" aria-label="Close">${fn}</button>
|
|
247
263
|
</span>
|
|
248
264
|
</div>
|
|
249
|
-
${
|
|
250
|
-
<div class="dt-note-hidden"${
|
|
251
|
-
${(()=>{let
|
|
252
|
-
${
|
|
265
|
+
${Ce?'<p class="dt-note-orphan">Not on this page any more \u2014 the element was removed or changed since. The thread stays: answer or resolve it here.</p>':""}
|
|
266
|
+
<div class="dt-note-hidden"${Y?.hidden?"":" hidden"}><b>${Ni}Hidden right now</b><p>It sits inside ${(ut=>ut?`\xAB${f(ut)}\xBB`:"something")(Jd(Y?.shut&&Y.shut!==Y.el?Y.shut:Y?.hidden))}, which is closed. Open it on the page and the pin moves onto the spot.</p><button type="button" data-act="where" data-id="${p.id}">Show where</button></div>
|
|
267
|
+
${(()=>{let ut=(yn(p)||ie()?Kd(p):Gd(p))+Jo(sn(p.category).id,p.id,yn(p))+(p.host&&p.host!==location.host?`<span class="dt-note-host" title="Written on ${f(p.host)}">${f(p.host)}</span>`:"");return ut?`<div class="dt-note-meta">${ut}</div>`:""})()}
|
|
268
|
+
${Ud(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
|
+
${Vd(p,ks.map((ut,Ls)=>{let Eo=Ls===0?null:ut.at??null,Tn=ut.author==="you"&&(!ut.by||ut.by===o.me?.email),Al=Tn&&Ot?.id===p.id&&Ot.at===Eo,Ss=o.team?.find(Cn=>Cn.email===ut.by),Mo=ut.author==="claude"?Ue(ut.agent):Tn?"You":Ss?.name||ut.byName||ut.by||"You",Hl=ut.author==="claude"?Ss?.agent_avatar_url?`<img class="dt-msg-face" src="${f(Ss.agent_avatar_url)}" alt="">`:`<span class="dt-msg-face dt-msg-ai">${de(11)}</span>`:(Cn=>On(Ss?.avatar_url,Ss?.name||ut.byName||(Tn?o.me?.name:"")||ut.by||Mo,"dt-msg-face").replace(/^<(img|b) /,`<$1 style="--hue:${dn(Cn)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"))((ut.by||(Tn?o.me?.email??"":"")||Mo).toLowerCase()),Ua=`${p.id}:${ut.at??"0"}`,ko=Qe.get(Ua),Nl=!Tn&&o.voice&&ut.text?`<button class="dt-msg-edit${Qe.has(Ua)?" is-on":""}" data-act="translate" data-id="${p.id}" data-at="${f(ut.at??"0")}" title="${Qe.has(Ua)?"Show the original":"Translate into your language"}">${$c}</button>${wc(p.id,ut.at??"0")}`:"",Lo=p.id<=0?null:Ls===0?"":p.replies?.some(Cn=>Cn.at===ut.at)?ut.at:null,Ka=Lo===null?"":Ec(p.id,Lo,ut.reactions),Cu=Lo!==null&&!Ka?`<button class="dt-msg-edit" data-act="react-pick" data-id="${p.id}" data-at="${f(Lo)}" data-tip="Add reaction" aria-label="Add reaction">${Gi}</button>`:"",Bl=`<div class="dt-msg-head">${Hl}<b>${f(Mo)}</b><time>${An(ut.at)}</time>${Cu}${Nl}${Tn&&!Al?`<button class="dt-msg-edit" data-act="edit" data-id="${p.id}" data-at="${f(Eo??"")}" title="Edit">${Qn}</button>${Eo?`<button class="dt-msg-edit" data-act="unsay" data-id="${p.id}" data-at="${f(Eo)}" title="Delete">${Hn}</button>`:""}`:""}</div>`;return Ls===Su?`<div class="dt-msg dt-msg--done" data-msg="${p.id}:${f(ut.at??"0")}"><div class="dt-msg-head">${Hl}<b>${f(Mo)} fixed it</b><time>${An(ut.at)}</time>${Nl}</div><p${ko===null?' class="is-asking"':""}>${Gr(ko||ut.text)}</p>${na(ut.images)}${Ka}
|
|
271
|
+
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${p.id}">${be}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${p.id}">${bn}Send back</button></div></div>`:Al?`<div class="dt-msg">${Bl}<div class="dt-compose">
|
|
272
|
+
<textarea class="dt-note-edit-input" rows="1" maxlength="${ia}" aria-label="Edit the message">${f(Ot.text)}</textarea>
|
|
273
|
+
${na(ut.images.filter(Cn=>!Ot.drop.includes(Cn.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${Ot.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${be}</button>
|
|
261
277
|
</div>
|
|
262
|
-
</div></div>`:`<div class="dt-msg" data-msg="${
|
|
278
|
+
</div></div>`:`<div class="dt-msg${Tn?" dt-msg--mine":""}${Ls===Tu?" dt-msg--asks":""}" data-msg="${p.id}:${f(ut.at??"0")}">${Bl}<p${ko===null?' class="is-asking"':""}>${Gr(ko||ut.text)}</p>${Ls===0&&p.suggest?zd(p.suggest):""}${na(ut.images)}${Ka}</div>`}))}
|
|
263
279
|
</div>
|
|
264
|
-
${
|
|
265
|
-
${
|
|
266
|
-
${
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
280
|
+
${$e[p.id]?`<button type="button" class="dt-new-below" data-act="newbelow" data-id="${p.id}">${$e[p.id]} new ${$e[p.id]===1?"reply":"replies"} \u2193</button>`:""}
|
|
281
|
+
${Tc(p)}
|
|
282
|
+
${Ki("dt-note-reply-input",Ut(p)==="asks"?`Answer ${f(Me(p))}`:"Reply",oe,`data-act="reply" data-id="${p.id}"`,Wi(Xt))}
|
|
283
|
+
${Hi(p.priority,p.category,p.id,p.assignee??"",yn(p),Lt(p),!0)}
|
|
284
|
+
</div>`}}pe.forEach((p,Y)=>{let z=ae(p);z&&(n+=`<button class="dt-pin dt-pin--draft" data-parked="${Y}" data-act="draft-open" data-i="${Y}"
|
|
285
|
+
style="left:${z.x}px;top:${z.y}px" title="Draft, not sent \u2014 click to finish it">${Qn}</button>`)});let l=C&&ae(C);if(C){let p=l?.x??0,Y=l?.y??0;n+=`${l?`<span class="dt-pin dt-pin--draft" data-draft style="left:${p}px;top:${Y}px">${Qn}</span>`:""}
|
|
286
|
+
<div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${p}px;top:${Y}px">
|
|
270
287
|
<div class="dt-note-bar">
|
|
271
|
-
<span class="dt-note-el"${
|
|
272
|
-
${
|
|
288
|
+
<span class="dt-note-el"${o.client?"":` data-tip="${Ti(C.selector,C.label)}"`}>${o.client?"New thread":f(ra(C.tag,C.classes,C.selector))}</span>
|
|
289
|
+
${es()?'<span class="dt-note-draft">Draft</span>':""}
|
|
273
290
|
<span class="dt-note-tools">
|
|
274
291
|
|
|
275
|
-
${
|
|
276
|
-
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${
|
|
292
|
+
${Oi()}
|
|
293
|
+
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${fn}</button>
|
|
277
294
|
</span>
|
|
278
295
|
</div>
|
|
279
|
-
${
|
|
280
|
-
${(()=>{let
|
|
281
|
-
${
|
|
282
|
-
${
|
|
283
|
-
<span class="dt-suggest-was">Now: <del>${
|
|
284
|
-
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${
|
|
285
|
-
<span class="dt-suggest-hint">Change the words in the box \u2014
|
|
286
|
-
${
|
|
287
|
-
|
|
288
|
-
</div>`}let l=new Map([...J.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(c=>[c.closest(".dt-note").dataset.id,{top:c.scrollTop,end:c.scrollTop+c.clientHeight>=c.scrollHeight-4}])),f=new Set([...J.querySelectorAll("[data-msg]")].map(c=>c.dataset.msg)),u=J.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");J.innerHTML=o,u&&cs(".dt-note-reply-input");for(let c of J.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let U=c.closest(".dt-note").dataset.id,I=l.get(U);if(!I)continue;let K=[...c.querySelectorAll("[data-msg]")].filter(_=>!f.has(_.dataset.msg));for(let _ of K)_.classList.add("dt-msg--new");c.scrollTop=I.end&&K.length||String(We)===U?c.scrollHeight:I.top}We=null;let P=Math.min(innerHeight,document.querySelector(".devtools")?.getBoundingClientRect().top??innerHeight)-8;for(let c of J.querySelectorAll(".dt-note")){let U=c.getBoundingClientRect(),I=U.top,K=P-I,_=I-32;U.bottom>P&&_>K&&(c.dataset.flip="1"),U.right>innerWidth-8&&(c.dataset.flipx="1"),U=c.getBoundingClientRect();let Rt=c.dataset.flip?8-U.top:U.bottom-P,Dt=c.querySelector(".dt-note-thread");Rt>0&&Dt&&(Dt.style.maxHeight=`${Math.max(40,Dt.clientHeight-Rt)}px`);let de=c.getBoundingClientRect().top;c.dataset.flip&&de<8&&(c.style.marginTop=`${8-de}px`)}cn(n),Cs(Hs()),ge();for(let c of J.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))fo(c);let j=J.querySelector(".dt-note-input");j&&(j.focus(),j.setSelectionRange(j.value.length,j.value.length))},ll=()=>{let t=!1,e=[];for(let n of J.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(n.classList.contains("dt-note--orphan")||n.classList.contains("is-dragging"))continue;let o=V.find(r=>r.id===Number(n.dataset.id)),a=o&&Zt(o);e.push([n,a]),a&&Fo(a.el)&&(t=!0)}for(let n of J.querySelectorAll("[data-draft], [data-parked]")){if(n.classList.contains("dt-note--orphan"))continue;let o=n.dataset.parked?Nt[Number(n.dataset.parked)]:T;e.push([n,o?Zt(o):null])}for(let[n,o]of e){if(!o){n.style.visibility="hidden";continue}n.style.visibility="",n.style.left=`${o.x}px`,n.style.top=`${o.y}px`,n.matches(".dt-pin[data-id]")&&(o.off?n.dataset.off=o.off:delete n.dataset.off,n.classList.toggle("dt-pin--hidden",!!o.hidden)),n.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!o.hidden)}if(!Vn.length&&(T||tt!=null)){let n=Hs();n&&Fo(n)&&Cs(n)}Fe(T||tt!=null?Hs():null),t&&ge()},cn=t=>{if(!q.hidden&&(q.innerHTML=sr({bp:t,notes:V.filter(on),breakpoints:d,bandOfNote:S,orphan:e=>!Zt(e),hiddenNow:e=>!!Zt(e)?.hidden,whoseAgent:Ve,statusTools:e=>xa(e,!Jo(e)),showResolved:ie,showArchived:Ne,archived:re,drafts:Jt.hidden?ya():Zs,checks:b?0:ss.toCheck().length,marker:cl,assign:Jo,find:Kt,forMe:dl,forAgent:e=>!!ne(e)&&ht(e)!=="done",unread:Xo,agentless:e=>s.client||_t()||$t(e),archives:!s.client&&!_t()}),un)){let e=q.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(un.at,un.at),un=null}},un=null,dl=t=>{if(ht(t)==="done"||!s.me)return!1;if(t.assignee===s.me.email||ht(t)==="claude"||Xt(t)==="review"&&t.assignee!==s.me.email)return!0;let e=(s.me.name||s.me.email).split(/[\s@]/)[0].toLowerCase();return Oe(t).some(n=>n.text.toLowerCase().includes("@"+e))},cl=t=>{let e=ne(t),n=Os[e??""],o=ht(t)==="done"?re(t)?`<i class="dt-hist-badge is-archived">${Xn}</i>`:`<i class="dt-hist-badge is-done">${qt}</i>`:n?`<i class="dt-hist-badge" style="--b:${n}">${zt(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${xn.find(r=>r[0]===ln(t))[2]}"></i>`,a=Ko(t);return a?`<span class="dt-hist-face" style="--hue:${$n(t.by||t.byName||"")}">${a}${o}</span>`:`<span class="dt-hist-n" style="--cat:${Qe(t.category).color}">${o}</span>`},no=t=>q.toggleAttribute("data-collapsed",t);q.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(Kt.q=e.value,un={at:e.selectionStart??e.value.length},cn(xe()))}),q.addEventListener("click",async t=>{let e=t.target.closest("[data-refresh]");if(e){e.dataset.spin="1",await Ye(),setTimeout(()=>delete e.dataset.spin,500);return}if(q.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){no(!1);return}if(t.target.closest("[data-fold]")){no(!q.hasAttribute("data-collapsed"));return}let n=t.target.closest(".dt-hist-bands [data-bp]");if(n){ri(n.dataset.bp);return}let o=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(o){o.dataset.histView?(Kt.view=o.dataset.histView,k("dt-view",Kt.view),Kt.menu=!1):o.dataset.histSort?(Kt.sort=o.dataset.histSort,k("dt-sort",Kt.sort),Kt.menu=!1):o.hasAttribute("data-hist-clear")?(Kt.q="",un={at:0}):Kt.menu=!Kt.menu,cn(xe());return}Kt.menu&&!t.target.closest(".dt-hist-menu")&&(Kt.menu=!1,cn(xe()));let a=t.target.closest("[data-draft-go], [data-draft-rm]");if(a){let U=a.dataset.draftRm!==void 0,I=Number(U?a.dataset.draftRm:a.dataset.draftGo);Jt.hidden?U?ka(I):so(I):ee(U?{dropDraft:I}:{openDraft:I});return}let r=t.target.closest("[data-unmark]");if(r){t.stopPropagation(),await Le(Number(r.dataset.unmark),!1);return}let l=t.target.closest(".dt-hist-tools [data-act]");if(l){await Le(Number(l.dataset.id),l.dataset.act==="done");return}let f=t.target.closest("[data-rm]");if(f){tt=null,await to(Number(f.dataset.rm));return}if(t.target.closest("[data-review]")){ss.start();return}if(t.target.closest("[data-resolved]")){ao(!ie);return}if(t.target.closest("[data-archived]")){io(!Ne);return}let u=t.target.closest("[data-archive-all]");if(u){let U=u.dataset.archiveAll.split(",").map(Number);for(let I of U)await Ue(I,!0,!0);Re(`Archived ${U.length}`,()=>{for(let I of U)Ue(I,!1,!0)});return}let P=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(P){await Ue(Number(P.dataset.id),P.dataset.act==="archive");return}let j=t.target.closest("[data-go]");if(!j)return;let c=Number(j.dataset.go);if(!Jt.hidden){ee({open:c});return}Sn(c)});let Sn=t=>{tt=t,O(),Q();let e=V.find(o=>o.id===t),n=e&&Zt(e);n?scrollTo({top:scrollY+n.y-innerHeight/2,behavior:"smooth"}):e&&he(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||J.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400)},so=t=>{let[e]=Nt.splice(t,1);if(!e)return;O(),T=e,tt=null;let n=Zt(e);n&&(n.y<0||n.y>innerHeight)&&scrollTo({top:scrollY+n.y-innerHeight/3,behavior:"instant"}),Q()},ka=t=>{Nt.splice(t,1),Q()},ss=or({inFrame:b,everything:()=>wt,route:()=>Z,settle:Le,keepIn:Wt,toast:t=>Mt(t),waits:t=>ht(t)==="claude"||ht(t)==="done"&&!re(t),approve:t=>ht(t)==="claude"?Le(t.id,!0):Ue(t.id,!0,!0),open:t=>{if(Tt||ye(!0),S(t)!==xe()){ri(S(t));for(let e of[600,1500])setTimeout(()=>ee({open:t.id}),e)}else Sn(t.id)}}),ul=t=>{q.hidden=!t,Y.setAttribute("aria-pressed",String(t)),k("dt-history",t?"1":"0"),Q()},oo=document.querySelector(".dt-resolved-btn"),Tn=document.querySelector(".dt-space"),pl=t=>{if(!Tn)return;Tn.hidden=!Be(),Tn.dataset.on=He;let e=document.documentElement,n=e.dataset.dtSpace==="clients";Be()&&He==="clients"?(e.dataset.dtSpace="clients",n||(e.classList.add("dt-client-glow"),window.setTimeout(()=>e.classList.remove("dt-client-glow"),1700))):delete e.dataset.dtSpace;for(let o of Tn.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===He));let r=o.querySelector(".dt-space-n");r.textContent=String(t[a]),r.hidden=!t[a]}},La=0,An=t=>{if(!Be()||t===He)return;let e=()=>{He=t,k("dt-space",t),tt!=null&&!on(V.find(o=>o.id===tt))&&(tt=null),O(),os(wt),Q(),cn(xe())};if(matchMedia("(prefers-reduced-motion: reduce)").matches)return e();let n=document.documentElement;n.classList.add("dt-switching"),clearTimeout(La),La=window.setTimeout(()=>{e(),requestAnimationFrame(()=>n.classList.remove("dt-switching"))},120)};document.querySelector(".dt-client-x")?.addEventListener("click",()=>An("studio")),Tn?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&An(e.dataset.space)});let Pe=document.querySelector(".dt-pinf"),Cn=Pe.querySelector(".dt-pinf-btn"),le=Pe.querySelector(".dt-pinf-menu"),Sa={all:"All",nobody:"Nobody has it",mine:"Mine",others:"Everyone else",claude:"My Claude",wrote:"Written by me",check:"To check"},hl=()=>V.filter(t=>S(t)===xe()&&Ro(t)&&on(t)),Hn=(t,e=!1)=>{le.hidden=!t,Cn.setAttribute("aria-expanded",String(t)),t&&(Ss(),e&&le.querySelector('[aria-checked="true"]')?.focus())};Ss=()=>{let t=hl();if(Pe.hidden=!Be()||!t.length,Pe.hidden){le.hidden=!0;return}let e=Object.fromEntries(No.map(K=>[K,t.filter(_=>ea(_,K)).length])),n=(s.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",$n(n)],["others","var(--dt-faint)"]],a=11.75,r=.42,l=2*Math.PI*a,f=0,u="";for(let[K,_]of o){let Rt=2*Math.PI*e[K]/e.all;e[K]&&(u+=`<circle cx="20" cy="20" r="${a}" stroke="${_}" stroke-dasharray="${Math.max(.01,(Rt-r)*a).toFixed(2)} ${l.toFixed(2)}" stroke-dashoffset="${(-(f+r/2)*a).toFixed(2)}"${pe===K?' class="is-on"':pe!=="all"?' class="is-off"':""}/>`),f+=Rt}if(Pe.querySelector(".dt-pinf-arcs").innerHTML=u,Pe.querySelector(".dt-pinf-n").textContent=String(e[pe]),Cn.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} nobody has, ${e.mine} mine, ${e.others} everyone else's${pe==="all"?"":`; showing ${Sa[pe]}, ${e[pe]}`}`),le.hidden)return;let P=[...new Set(t.map(K=>Es(K,ht(K))?.taker).filter(K=>!!K&&K!==n))].slice(0,2),j=K=>an(Ee(K)?.avatar_url,Ee(K)?.name||K,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${$n(K)}" `),c={all:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 3 3 6.5 10 10l7-3.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5"/></svg>',nobody:'<svg viewBox="0 0 16 16" width="16" height="16"><circle cx="8" cy="8" r="7" stroke="var(--dt-new)" stroke-width="1.5" stroke-dasharray="2.5 2"/></svg>',mine:j(n),others:P.map(j).join("")||'<svg viewBox="0 0 20 20" width="14" height="14"><circle cx="8" cy="7" r="3"/><path d="M3 16.5c.5-2.8 2.5-4.5 5-4.5s4.5 1.7 5 4.5M13.5 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1 .9 1.6 2.3 1.8 4.1"/></svg>',claude:`<i class="dt-pinf-claude">${zt(10)}</i>`,wrote:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 16.5h6.5M13.4 3.9a1.8 1.8 0 0 1 2.6 2.6L7.4 15.1 4 16l.9-3.4z"/></svg>',check:Kn(xn[2][2],xn[2][3])},U=(K,_)=>`<b class="dt-pinf-share"><i style="--c:${_};width:${Math.round(100*e[K]/e.all)}%"></i></b>`,I=(K,_="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${pe===K}" data-pinf="${K}"><i class="dt-pinf-glyph">${c[K]}</i><span>${Sa[K]}</span>${_?U(K,_):""}<em>${e[K]}</em>${qt}</button>`;le.innerHTML=`<div class="dt-pinf-head"><b>SHOW</b>${e.all} on this page</div>${I("all")}${o.map(([K,_])=>I(K,_)).join("")}<hr>${I("claude")}${I("wrote")}${I("check")}${s.shortcuts?'<div class="dt-pinf-foot"><kbd>F</kbd>opens it \xB7 the rest dim, not hidden</div>':""}`},Cn.addEventListener("click",t=>Hn(le.hidden,t.detail===0)),le.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(pe=e.dataset.pinf,k("dt-pinf",pe),Hn(!1),Cn.focus(),Tt?Q():ye(!0))}),le.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),Hn(!1),Cn.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...le.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!le.hidden&&!Pe.contains(t.target)&&Hn(!1)},!0);let ao=t=>{ie=t,oo.setAttribute("aria-pressed",String(t)),k("dt-resolved",t?"1":"0"),ee({resolved:t}),Q(),Ge(!0)},io=t=>{Ne=t,k("dt-archived",t?"1":"0"),ee({archived:t}),Q(),Ge(!0)};oo.addEventListener("click",()=>ao(!ie)),oo.setAttribute("aria-pressed",String(ie)),Y.addEventListener("click",()=>{let t=q.hidden===!0;t&&!Tt&&ye(!0),t&&no(!1),ul(t)});let ge=()=>{yn||!Tt||(yn=requestAnimationFrame(()=>{yn=0,ll()}))},Ta=`${Ce}, .dt-where, .dt-spot, .dt-drag-box, .dt-room, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,ml=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Ta))return!0;let n=[...t.addedNodes,...t.removedNodes];return n.length>0&&n.every(o=>o instanceof Element&&o.matches(Ta))},Aa=new MutationObserver(t=>{t.every(ml)||(qo(),ge())}),Ca=new ResizeObserver(()=>ge()),Ha=()=>{J.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&ge()},wt=[],Ba=()=>{},Bn=new Set,Gt={at:"",ids:[]},os=t=>{wt=t,queueMicrotask(()=>Ba());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),n={},o={studio:0,clients:0};for(let u of t){if(re(u)||(ht(u)!=="done"&&o[$t(u)?"clients":"studio"]++,!on(u)))continue;let P=ht(u),j=ne(u),c=P==="done"?"done":P==="claude"?"review":j&&Gn[j]||ln(u),U=n[u.route??""]??={...e(),bands:{}};U[c]++;let I=S(u);(U.bands[I]??=e())[c]++}pl(o);let a=["new","progress","review","waiting","done"],r={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},l=u=>a.map(P=>[P,P==="done"&&!ie?0:u[P]]),f=u=>l(u).reduce((P,[,j])=>P+j,0);for(let u of document.querySelectorAll(".dt-pages a")){let P=u.querySelector(".dt-pages-n");if(!P)continue;let j=n[new URL(u.href).pathname.replace(/\/+$/,"")||"/"];for(let I of d){let K=j?.bands[I.id];for(let[_,Rt]of l(K??e())){let Dt=P.querySelector(`[data-bp="${I.id}"][data-state="${_}"]`);Dt.hidden=!Rt,Rt&&(Dt.querySelector("i").textContent=String(Rt),Dt.title=`${I.label}: ${Rt} ${r[_]}`)}}let c=j?f(j):0;P.hidden=!c;let U=j?d.filter(I=>j.bands[I.id]&&f(j.bands[I.id])).map(I=>`${I.label} ${f(j.bands[I.id])}`).join(" \xB7 "):"";P.title=c?`${a.filter(I=>j[I]).map(I=>`${j[I]} ${r[I]}`).join(" \xB7 ")}
|
|
289
|
-
${U}`:""}},pn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string").map(e=>({...e,id:Number(e.id),rx:Number(e.rx)||0,ry:Number(e.ry)||0,route:typeof e.route=="string"&&/^\/(?![\/\\])/.test(e.route)?e.route:"/",replies:Array.isArray(e.replies)?e.replies.filter(n=>typeof n?.text=="string"):[],images:Array.isArray(e.images)?e.images.filter(n=>typeof n=="string"):[]})),gl=ar(b,t=>Mt(t)),te=document.querySelector(".dt-push"),fe=te.querySelector(".dt-push-menu"),be=new Set,hn=new Set,as=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",is=()=>s.client||_t()||b?[]:wt.filter(t=>t.status!=="done"&&kt(t.assignee)&&Xt(t)==="approved"&&!De(t)&&!re(t)&&!Bn.has(t.id)),rs=()=>is().filter(t=>!be.has(t.id)),Na=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?qt:""}</i>`,Ra=()=>{let t=is(),e=[...new Set(t.map(o=>o.route??"/"))],n=rs().length;fe.innerHTML=`<div class="dt-push-head">${zt(14)}<b>Waiting for Claude</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),r=a.filter(l=>!be.has(l.id)).length;return`<button type="button" class="dt-push-page${hn.has(o)?" is-open":""}" data-push-route="${g(o)}"><span data-push-fold="${g(o)}">${hn.has(o)?"\u25BE":"\u25B8"}</span>${Na(r>0,r>0&&r<a.length)}<span class="dt-push-route">${g(o)}</span><em>${a.length}</em></button>`+(hn.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${Na(!be.has(l.id))}<span><small>#${l.id}</small>${g(l.text.slice(0,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${n?"":" disabled"}>${zt(13)}Send ${n} to Claude</button>`},ro=()=>["push","paused"].includes(as()),lo=()=>Gt.ids.filter(t=>{let e=wt.find(n=>n.id===t);return!!e&&e.status!=="done"&&Xt(e)!=="review"&&(Bn.has(t)||!!De(e)||Xt(e)==="approved")}),Pa="",fl=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Ke=()=>{let t=as(),e=rs().length,n=lo(),o=Gt.ids.length-n.length,a=n.length>0&&ro();if(te.classList.toggle("is-working",a),n.length&&(Pa=Gt.at),!n.length&&Gt.ids.length&&Gt.at&&Pa===Gt.at&&!fl(Gt.at)){try{sessionStorage.setItem("nm-batch-done",Gt.at)}catch{}wt.length&&Re(`Claude finished ${Gt.ids.length} \u2014 check the fixes`,()=>ss.start(),"Check")}te.hidden=s.client||_t()||b,te.classList.toggle("is-live",ro()),te.classList.toggle("is-quiet",t==="on");let r=te.querySelector(".dt-push-n");r.textContent=String(a?n.length:e),r.hidden=a?!1:!e||t==="on",te.querySelector(".dt-push-all").dataset.tip=a?`Push to Claude: Claude is on ${n.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to Claude: turbo is on \u2014 Claude takes each comment as it lands":t==="none"?`Push to Claude: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to Claude: ${e} ${e===1?"comment waits":"comments wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to Claude: nothing waits for Claude yet \u2014 mark comments for Claude, then send them here",document.querySelector(".devtools")?.style.setProperty("--dt-push-w",te.hidden?"0px":`${te.offsetWidth+8}px`),(te.hidden||!is().length)&&(fe.hidden=!0),fe.hidden||Ra()},Ia=async t=>{if(!t.length&&ro()){Mt("Nothing waits for Claude \u2014 mark comments for Claude first");return}if(as()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Mt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(as()==="on"){Mt("Turbo is on \u2014 Claude takes each comment as it lands");return}fe.hidden=!0;let e=t.map(o=>o.id),n=await At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(!n?.ok){Rn("Could not send them to Claude",n);return}for(let o of e)Bn.add(o);Gt={at:Gt.ids.some(o=>lo().includes(o))?Gt.at:new Date().toISOString(),ids:[...new Set([...lo(),...e])]},Ke(),Re(`${e.length} sent to Claude \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await At("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)Bn.delete(o);Ke()}),Ye()},ls=te.querySelector(".dt-push-all"),Oa=0,co=!1,Da=()=>{fe.hidden=!1,Ra()};ls.addEventListener("click",()=>{if(co){co=!1;return}Ia(rs())}),ls.addEventListener("contextmenu",t=>{t.preventDefault(),fe.hidden?Da():fe.hidden=!0}),ls.addEventListener("pointerdown",t=>{t.button===0&&(Oa=window.setTimeout(()=>{co=!0,Da()},500))});for(let t of["pointerup","pointerleave","pointercancel"])ls.addEventListener(t,()=>clearTimeout(Oa));fe.addEventListener("click",t=>{let e=t.target,n=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),r=e.closest("[data-push]")?.dataset.push;if(r==="send"){Ia(rs());return}if(r==="all")be.clear();else if(n){let l=n.dataset.pushFold;hn.has(l)?hn.delete(l):hn.add(l)}else if(o){let l=is().filter(u=>(u.route??"/")===o.dataset.pushRoute),f=l.some(u=>!be.has(u.id));for(let u of l)f?be.add(u.id):be.delete(u.id)}else if(a){let l=Number(a.dataset.pushId);be.has(l)?be.delete(l):be.add(l)}Ke()}),document.addEventListener("pointerdown",t=>{!fe.hidden&&!te.contains(t.target)&&(fe.hidden=!0)},!0),setInterval(Ke,3e4),Ba=Ke;let qa=document.querySelector(".dt-turbo");qa&&new MutationObserver(Ke).observe(qa,{attributes:!0,attributeFilter:["data-state"]}),Ke();let ds="",uo=!1,Fa=t=>{ds=t.version??"",gl(t);let e=t.turbo;Bn=new Set(e?.push?.ids??[]),Gt={at:e?.batch?.at??"",ids:e?.batch?.ids??[]};let n=pn(t.comments);os(n);let o=n.filter(a=>a.route===Z);if(!(_n&&(V=o,ja()))){if(JSON.stringify(o)===JSON.stringify(V)){!q.hidden&&!b&&Q();return}if(J.contains(document.activeElement)&&document.activeElement.matches("textarea, input")){ds="",setTimeout(Nn,5e3);return}V=o,Q(),ee({reload:!0})}},Ge=async(t=!1)=>{let e=[t||!ds?"":`since=${ds}`,ie||Ne?"":"open=1"].filter(Boolean).join("&");try{let n=await At(`comments${e?`?${e}`:""}`);n.status===200&&Fa(await n.json())}catch{}},Nn=async()=>{document.hidden||uo||Qs||(uo=!0,await Ge(),uo=!1)},ja=()=>{let t=_n&&V.find(e=>e.id===_n);return t?(_n=0,Be()&&!on(t)&&An($t(t)?"clients":"studio"),Tt||ye(!0),Sn(t.id),!0):!1},po=()=>{V=wt.filter(t=>t.route===Z),ja()||Q()},ho=0,Wa=t=>{ho||(ho=requestAnimationFrame(()=>{ho=0;let e=t.target;if(!Tt||e.closest(Lt)){bt.hidden=!0;return}let n=document.elementFromPoint(t.clientX,t.clientY);if(bt.hidden=!1,!n)return;let o=n.getBoundingClientRect();jt.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,oe.textContent=n.tagName.toLowerCase()+([...n.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...n.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,oe.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-20)}px`}))},_a=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),gt){gt=null,Q();return}if(T){ft()&&(O(),Q());return}if(tt!==null){tt=null,Q();return}ye(!1)}},za=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],Va=t=>{t.target.closest?.(Lt)||t.stopPropagation()},Ua=t=>{if(t.target.closest(Lt))return;if(t.preventDefault(),t.stopPropagation(),ut){ut=!1;return}if(!getSelection()?.isCollapsed)return;J.hidden=!0;let n=document.elementFromPoint(t.clientX,t.clientY);if(J.hidden=!1,!n||!ft())return;O();let o=n.getBoundingClientRect(),a=n.tagName.toLowerCase(),r=[...n.classList].filter(f=>!/^(astro|svelte|css)-/.test(f)).slice(0,2);T={selector:Io(n),tag:a,classes:r,nth:Oo({tag:a,classes:r}).indexOf(n),rx:o.width?(t.clientX-o.left)/o.width:.5,ry:o.height?(t.clientY-o.top)/o.height:.5,label:Pt(n.textContent||"").slice(0,60),ctx:Do(n),category:h[0].id,...Be()&&He==="clients"?{shared:!0}:{}};let l=s.client||_t()||T.shared?null:Ps();l&&(T.assignee=l,T.stage=kt(l)?"approved":"new"),Ga.set(T,El().then(()=>mo(n))),tt=null,bt.hidden=!0,Q()},bl=2200,yl=900*1024,Ka=8*1024*1024,vl=3*1024*1024,wl=50*1024*1024,$l=1200,xl=1600,mo=async t=>{let e=t instanceof HTMLElement?t:null;for(let a=0;e&&a<4&&e.parentElement&&e.parentElement!==document.body;a++){let r=e.getBoundingClientRect();if(r.width>=360&&r.height>=140)break;e=e.parentElement}let n=e?.getBoundingClientRect();if(!e||!n?.width||!n.height)return null;let o="";for(let a=e;a&&!o;a=a.parentElement){let r=getComputedStyle(a).backgroundColor;r&&r!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(r)&&(o=r)}if(!o){let[a,r,l]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);o=.299*a+.587*r+.114*l>140?"#111":"#fff"}try{let{domToWebp:a}=await import("modern-screenshot"),r=Math.min(1,$l/n.width,xl/n.height),l=await Promise.race([a(e,{scale:r,quality:.8,timeout:4e3,backgroundColor:o,filter:f=>!(f instanceof Element&&f.closest(Ce))}),new Promise(f=>setTimeout(()=>f(null),8e3))]);return l&&l.length<Ka?l:null}catch{return null}},Ga=new WeakMap,El=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Mt=(t,e=2800)=>{let n=document.createElement("div");return n.className="dt-toast",n.textContent=t,document.body.append(n),setTimeout(()=>n.remove(),e),n},Ya=async(t,e)=>{for(let n of e){let[,o,a]=n.split("\0"),r=Zn.get(o);if(Zn.delete(o),!r){Mt(`${a} was not sent \u2014 attach it again`);continue}let l=Mt(`Uploading ${a}\u2026`,12e4),f=await At("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:r.name,size:r.size})}).then(c=>c.ok?c.json():null).catch(()=>null),u=f&&await fetch(f.url,{method:"PUT",headers:{"content-type":f.type,"x-upsert":"false"},body:r}).catch(()=>null),P=u?.ok&&await y({id:t,uploaded:[f.name]}).catch(()=>null);if(l.remove(),!P||!P.ok){Mt(u===null&&f?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let j=pn([await P.json().catch(()=>null)])[0];j&&(V=V.map(c=>c.id===j.id?j:c),Q()),Mt(`${a} sent`)}},Xa=t=>{let e=t.filter(n=>n.startsWith(Jn)).length;return e&&Mt(e===1?"One file was left out \u2014 its chip said why":`${e} files were left out \u2014 their chips said why`,4e3),t.filter(n=>!n.startsWith(Jn))},Rn=async(t,e)=>{if(!navigator.onLine){Mt(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let n="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{n=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{n=""}(n.length>160||n.startsWith("<"))&&(n="")}Mt(n?`${t}: ${n.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},Ml=t=>new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result)),n.readAsDataURL(t)}),kl=async t=>{let e=await createImageBitmap(t),n=Math.min(1,bl/Math.max(e.width,e.height));if(n===1&&t.size<=yl)return e.close(),Ml(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*n),o.height=Math.round(e.height*n),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},go=async(t,e)=>{let n=[],o=(a,r)=>n.push(`${Jn}${a}\0${r}`);for(let a of t){let r,l=Ai(a.name)||Object.keys(Dn).find(f=>Dn[f]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,ko.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>wl){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>vl&&Yt.via){let u=`${Date.now()}-${Zn.size}`;Zn.set(u,a),n.push(`${Ks}${u}\0${a.name}\0${a.size}`);continue}let f=await new Promise((u,P)=>{let j=new FileReader;j.onload=()=>u(String(j.result).split(",")[1]),j.onerror=P,j.readAsDataURL(a)}).catch(()=>"");f?n.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${Ti(a.name)||"file"};ext=${l};base64,${f}`):o(a.name,"Could not be read");continue}try{r=await kl(a)}catch{o(a.name,"This picture could not be read");continue}if(r.length>Ka){o(a.name,"Too large even after shrinking");continue}n.push(r)}if(n.length){if(!Number(e?.dataset.id)){T&&((T.images??=[]).push(...n),Q());return}Bt.push(...n),Q(),cs(".dt-note-reply-input")}},Ja=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);J.addEventListener("paste",t=>{let e=Ja(t.clipboardData?.items);e.length&&(t.preventDefault(),go(e,t.target.closest(".dt-note")))}),J.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),J.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),J.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let n=Ja(t.dataTransfer?.items);n.length&&go(n,e)});let cs=t=>{let e=J.querySelector(t);e?.focus(),e?.setSelectionRange(e.value.length,e.value.length)},Za=()=>{cs(".dt-note-edit-input"),J.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},fo=t=>{t.style.overflowY="hidden",t.style.height="auto",t.style.height=`${t.scrollHeight}px`,t.style.overflowY=t.scrollHeight>t.clientHeight?"auto":"hidden";let e=Xs-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},Ll=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),Sl=()=>s.client||_t()||T?.shared||tt!=null&&$t(V.find(t=>t.id===tt))?[]:xs(),Qa=t=>{t.closest(".dt-compose").querySelector(".dt-mentions")?.remove();let n=Ll(t);if(!n)return;let o=n[1].toLowerCase(),a=tt!=null?V.find(u=>u.id===tt):void 0,l=(s.client||_t()||T?.shared||a&&$t(a)?s.team??[]:Ws()).filter(u=>[u.name,u.nickname,u.email].some(P=>P?.toLowerCase().startsWith(o))).slice(0,5),f=Sl().filter(u=>u.handle.toLowerCase().startsWith(o)||!!o&&"agent".startsWith(o)||!!o&&"claude".startsWith(o)).slice(0,4);!l.length&&!f.length||t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...l.map(u=>`<button type="button" role="option" data-act="mention" data-handle="${g(Ni(u))}">${an(u.avatar_url,u.name||u.email)}<span class="dt-mention-who"><b>${g(u.name||u.email)}</b>${u.name?`<span>${g(u.email)}</span>`:""}</span></button>`),...f.map(u=>`<button type="button" role="option" data-act="mention" data-handle="${g(u.handle)}">${vr(u.owner)}<span class="dt-mention-who"><b>${g(u.handle)}</b><span>${u.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((u,P)=>u.replace('role="option"',`role="option" aria-selected="${P===0}"`)).join("")}</div>`)},Tl='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="5.5" cy="5" r="1.8"/><circle cx="5.5" cy="15" r="1.8"/><circle cx="14.5" cy="15" r="1.8"/><path d="M5.5 6.8v6.4M14.5 13.2V8.5a2 2 0 0 0-2-2H9.5M11 4.8 9.3 6.5 11 8.2"/></svg>',Al='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true" class="dt-link-out"><path d="M11 4h5v5M16 4l-7 7M14 11.5V15a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3.5"/></svg>',ti=t=>{let e=[...(s.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...xs().map(o=>o.handle)].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>g(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=e.length?new RegExp(`@(?:${e.join("|")})(?![\\p{L}\\p{N}_.-])`,"giu"):null;return So(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${g(o.url)}" target="_blank" rel="noopener noreferrer" title="${g(o.url)}">${o.kind==="pr"?Tl:aa}<span>${g(o.label)}</span>${Al}</a>`:n?g(o).replace(n,a=>`<span class="dt-at">${a}</span>`):g(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let n=document.createElement("div");for(let a=0;a<e.rangeCount;a++)n.append(e.getRangeAt(a).cloneContents());let o=n.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",n.textContent??""),t.preventDefault()}});let ei=(t,e)=>{let n=t.selectionStart??t.value.length,o=t.value.slice(0,n).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(n)}`,t.selectionStart=t.selectionEnd=o+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},Cl=(t,e)=>{if(!t){T&&(T.category=e),Q();return}Qt(n=>n.map(o=>o.id===t?{...o,category:e}:o),()=>y({id:t,category:e}),"Changing the type")};Ji([J,q],g,qt),q.addEventListener("change",t=>{let e=t.target.closest(".dt-for-select[data-id]");e&&Rs(Number(e.dataset.id),e.value)}),q.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-hand [data-act="hand"]');if(!e)return;t.stopPropagation();let n=e.dataset.v;Rs(Number(e.dataset.id),n==="agent"?Bs:n==="person"?Ns():"")},!0);let Hl=t=>$t(t)?"studio":"clients",ni=async(t,e=!1)=>{let n=V.find(a=>a.id===t);if(!n||$t(n)&&n.client)return;let o=!$t(n);tt===t&&(tt=null),await Qt(a=>a.map(r=>r.id===t?{...r,shared:o||void 0,client:o?r.client:void 0}:r),()=>y(o?{id:t,shared:o}:{id:t,shared:!1,client:!1}),o?"Moving it to clients":"Moving it to the workspace"),os(wt),e||Re(o?"Moved to clients":"Moved to the workspace",()=>ni(t,!0))},Bl=async t=>{let e=V.find(f=>f.id===t);if(!e)return;let n=e,o={text:e.text,from:{id:e.id},...$t(e)?{}:{shared:!0}};for(let f of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])n[f]!=null&&(o[f]=n[f]);let a=await ns(At("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Rn("The copy was not made",a);return}let r=pn([await a.json().catch(()=>null)])[0];r&&(wt=[...wt,r],V=wt.filter(f=>f.route===Z)),os(wt),Q(),Ye();let l=Hl(e);Re(l==="clients"?"Duplicated for the client":"Duplicated to the workspace",()=>{r&&(An(l),Sn(r.id))},"Open")},Nl=t=>{let e=`${location.origin}${location.pathname}?notemend#thread-${t}`;navigator.clipboard?.writeText(e).then(()=>Mt("Link copied"),()=>Mt(e,6e3))};J.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let l=e.value,f=Number(e.dataset.id)||0;e.value="",l==="dup"?Bl(f):l==="move"?ni(f):l==="link"?Nl(f):l==="reopen"?Le(f,!1):l==="rm"&&confirm("Delete this thread and its replies? This cannot be undone.")?(tt=null,to(f)):l==="discard"&&(T=null,Q());return}let n=t.target.closest(".dt-lang-select");if(n){ha(Number(n.dataset.id),n.dataset.at,n.value);return}let o=t.target.closest(".dt-cat-select");if(o){Cl(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){Sr(Number(a.dataset.id),a.value);return}let r=t.target.closest(".dt-for-select");if(r){if(ot.setItem("nm-for",r.value),s.client){T&&(T.assignee=r.value,Ps(r.value),Q());return}Vo(Number(r.dataset.id)||0,"person")}}),J.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&T?.suggest){T.suggest.to=e.value,wn(),fo(e);return}let n=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");n&&(Qa(n),n.classList.contains("dt-note-input")?T&&(T.text=n.value):n.classList.contains("dt-note-edit-input")?gt&&(gt.text=n.value):Ht=n.value,wn(),n.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",n.value.trim()!==""),fo(n))}),J.addEventListener("keydown",t=>{if(t.key==="Escape"&&J.querySelector(".dt-emoji")){t.stopPropagation();let a=ke?.box??ke?.btn;ts(),a?.focus();return}let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let n=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!n()&&Qa(e);let o=n();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),ei(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let ct=null,us=!1;function bo(t){return!s.client||!!s.me&&t.by===s.me.email}let si=t=>{let e=document.createElement("div");return e.className=`dt-drag-box ${t}`,e.hidden=!0,e.innerHTML="<span></span>",document.body.append(e),e},yo=si("dt-drag-box--home"),oi=si("dt-drag-box--to"),vo=t=>{let e=Pt(t.textContent||"").replace(/\s+/g," ").slice(0,24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},ai=(t,e,n="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left-3}px;top:${o.top-3}px;width:${o.width+6}px;height:${o.height+6}px`,t.querySelector("span").textContent=n,t.hidden=!1},Rl=(t,e)=>document.elementsFromPoint(t,e).find(n=>!n.closest(Lt)&&!n.closest(".dt-drag-box")&&n!==document.documentElement&&n!==document.body)??null,Pl=(t,e,n)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&n>=o.top&&n<=o.bottom},Il=(t,e,n)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),r=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:Io(t),tag:a,classes:r,nth:Oo({tag:a,classes:r}).indexOf(t),label:Pt(t.textContent||"").slice(0,60),ctx:Do(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(n-o.top)/o.height)):.5}},wo=()=>{ct&&(ct.pin.classList.remove("is-dragging"),yo.hidden=oi.hidden=!0,ct=null,ge())};J.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let n=V.find(o=>o.id===Number(e.dataset.id));!n||!bo(n)||(ct={id:n.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:he(n),to:null},e.setPointerCapture(t.pointerId))}),J.addEventListener("pointermove",t=>{if(!ct||!ct.on&&Math.hypot(t.clientX-ct.x0,t.clientY-ct.y0)<4)return;ct.on=!0,ct.pin.classList.add("is-dragging"),ct.pin.style.left=`${t.clientX}px`,ct.pin.style.top=`${t.clientY}px`,ct.to=ct.home&&Pl(ct.home,t.clientX,t.clientY)?ct.home:Rl(t.clientX,t.clientY);let e=ct.to&&ct.to!==ct.home;ai(yo,ct.home,e?"":ct.home?vo(ct.home):""),yo.classList.toggle("is-left",!!e),ai(oi,e?ct.to:null,e?`Move to ${vo(ct.to)}`:"")}),J.addEventListener("pointerup",async t=>{if(!ct)return;let e=ct;if(!e.on||!e.to){wo();return}us=!0,setTimeout(()=>{us=!1},0);let n=V.find(f=>f.id===e.id),o=Il(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(wo(),!n)return;let r={selector:n.selector,tag:n.tag,classes:n.classes,nth:n.nth,label:n.label,ctx:n.ctx,rx:n.rx,ry:n.ry},l=(f,u)=>Qt(P=>P.map(j=>j.id===e.id?{...j,...f}:j),()=>y({id:e.id,move:f}),u);await l(o,"Moving the pin"),a&&Re(`Moved to ${vo(e.to)}`,()=>l(r,"Putting the pin back"))}),J.addEventListener("click",t=>{us&&(t.stopImmediatePropagation(),t.preventDefault(),us=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&ct?.on&&(t.stopImmediatePropagation(),wo())},!0),J.addEventListener("click",async t=>{let e=t.target.closest("button"),n=ke?.btn;if(e?.closest(".dt-emoji")||ts(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="react"){fa(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){n!==e&&ga(e,o==="emoji-pick",o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&ke){let r=ke;ga(r.btn,!0,r);return}if(o==="emoji"&&ke){let r=ke;ts(),r.box?sl(r.box,e.dataset.emoji):r.id&&fa(r.id,r.at||null,e.dataset.emoji);return}if(o==="prio"){let r=e.dataset.v||null;a?Qt(l=>l.map(f=>f.id===a?{...f,priority:r??void 0}:f),()=>y({id:a,priority:r}),"Setting the priority"):T&&(T.priority=r??void 0,wn(),Q());return}if(o==="mention"){let r=e.closest(".dt-compose")?.querySelector("textarea");r&&ei(r,e.dataset.handle);return}if(!o){if(T&&!ft())return;if(tt=tt===a?null:a,tt!=null&&e.dataset.off){let r=V.find(f=>f.id===a);(r&&he(r))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}O(),Q();return}if(o==="speak"){Gr(e.closest(".dt-note"),e);return}if(o==="voice-write"){Xr(e);return}if(o==="voice"||o==="voice-seek"){Pr(e,o==="voice-seek"?t:null);return}if(o==="attach"||o==="attach-file"){let r=Object.assign(document.createElement("input"),{type:"file",accept:o==="attach"?"image/*":"",multiple:!0}),l=e.closest(".dt-note");r.addEventListener("change",()=>{r.files?.length&&go([...r.files],l)}),r.click();return}if(o==="unshot"){a?gt&>.drop.push(e.dataset.img):(e.closest("[data-draft]")?T?.images??[]:Bt).splice(Number(e.dataset.i),1),Q(),gt&&Za();return}if(o==="edit"){let r=V.find(u=>u.id===a),l=e.dataset.at||null,f=l?r?.replies?.find(u=>u.at===l)?.text:r?.text;if(f===void 0)return;gt={id:a,at:l,text:f,drop:[]},Q(),Za();return}if(o==="edit-cancel"){gt=null,Q();return}if(o==="translate"){ha(a,e.dataset.at);return}if(o==="unsay"){let r=e.dataset.at;if(!confirm("Delete this reply?"))return;await Qt(l=>l.map(f=>f.id!==a?f:{...f,replies:(f.replies??[]).map(u=>u.at===r?{...u,text:"",deleted:!0}:u)}),()=>y({id:a,unsay:r}),"Deleting the reply");return}if(o==="edit-save"){let r=gt;if(!r)return;let l=r.text.trim();if(!l){J.querySelector(".dt-note-edit-input")?.focus();return}gt=null;let f=u=>r.drop.includes(u.split("/").pop());await Qt(u=>u.map(P=>P.id!==r.id?P:{...P,...r.at==null?{text:l}:{replies:(P.replies??[]).map(j=>j.at===r.at?{...j,text:l}:j)},images:(P.images??[]).filter(j=>!f(j))}),()=>y({id:r.id,edit:{at:r.at,text:l},...r.drop.length?{removeImage:r.drop}:{}}).then(u=>(u.ok||(gt=r),u),u=>{throw gt=r,u}),"Saving the edit");return}if(o==="cancel"){ft()&&(O(),Q());return}if(o==="twin"){if(!ft())return;O(),tt=Number(e.dataset.id),Q();return}if(o==="discard"){T=null,Q();return}if(o==="draft-open"){so(Number(e.dataset.i));return}if(o==="close"){tt=null,Q();return}if(o==="where"){let r=V.find(P=>P.id===Number(e.dataset.id)),l=r&&Zt(r)?.hidden;if(!l)return;let f=l.getBoundingClientRect();l.scrollIntoView({block:"nearest",behavior:"smooth"});let u=document.createElement("div");u.className="dt-where",u.style.cssText=`left:${f.left}px;top:${f.top}px;width:${f.width}px;height:${f.height}px`,document.body.append(u),u.animate([{opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.75},{opacity:0}],1600).finished.finally(()=>u.remove());return}if(o==="unsuggest"&&T){T.suggest=null,Q();return}if(o==="save"){if(!T)return;T.images&&(T.images=Xa(T.images));let r=(T.images??[]).filter(_=>!dn(_)),l=T.suggest&&T.suggest.to.trim()!==T.suggest.from?{from:T.suggest.from,to:T.suggest.to.trim()}:null,f=J.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(T.images?.some(_s)?pa:T.images?.some(_=>dn(_)&&!qn(_))?"See the attached image":T.images?.length?"See the attached file":"");if(!f){J.querySelector(".dt-note-input")?.focus();return}let u=T,P=s.client?null:To(f,_e()),j=Ga.get(u)??mo(he(u)),c={...u,images:u.images?.filter(dn),route:Z,text:f,suggest:l,assignee:s.client?ra(u.assignee)||void 0:P??(u.assignee||void 0),shared:s.client?!0:u.shared===!0,stage:s.client?"new":P?"approved":u.stage??(kt(u.assignee)?"approved":"new"),breakpoint:Ts(),browser:pr(),device:b?ii:"",viewport:{w:innerWidth,h:innerHeight},logs:Vi(),host:location.host},U={...u,id:-Date.now(),text:f,route:Z,status:"open",note:"",doneBy:null,breakpoint:c.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:s.me?.email,byName:s.me?.name};V=[...V,U],T=null,Q();let I=await ns(At("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(c)})).catch(()=>null);if(!I?.ok){V=V.filter(_=>_!==U),O(),T=u,Q(),Rn("Comment was not saved",I);return}let K=pn([await I.json().catch(()=>null)])[0];V=V.map(_=>_===U&&K?K:_),Q(),K&&j.then(_=>{_&&y({id:K.id,before:_})}),K&&r.length&&Ya(K.id,r),Ye();return}if(o==="reply"){let r=J.querySelector(".dt-note-reply-input");Bt=Xa(Bt);let l=r.value.trim()||(Bt.some(_s)?pa:Bt.some(_=>dn(_)&&!qn(_))?"See the attached image":Bt.length?"See the attached file":"");if(!l){r.focus();return}let f=Bt;Ht=l,Et=a,vn(),Ht="",Bt=[];let u=V,P=s.client?null:To(l,_e()),j=V.find(_=>_.id===a),c=P&&j&&(P!==j.assignee||Xt(j)!=="approved"||j.status==="done")?{assignee:P,stage:"approved",...j.status==="done"?{status:"open",doneBy:null}:{}}:{};V=V.map(_=>_.id===a?{..._,...c,replies:[..._.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:s.me?.email}]}:_),We=a,Q();let U=await ns(y({id:a,reply:l,images:f.filter(dn),...c})).catch(()=>null);if(!U?.ok){V=u,Ht=l,Bt=f,Q();let _=()=>J.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?Re(`Reply was not sent${U?` (${U.status})`:""} \u2014 it is back in the box`,_,"Retry"):Rn("Reply was not sent",U);return}vn();let I=pn([await U.json().catch(()=>null)])[0];I&&(V=V.map(_=>_.id===I.id?I:_),Q()),Ye();let K=f.filter(_=>!dn(_));K.length&&Ya(a,K);return}if(o==="hand"){Vo(a,e.dataset.v);return}if(o==="sendback"){await Le(a,!1),cs(".dt-note-reply-input");return}if(o==="accept"){await Le(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(tt=null),await Ue(a,o==="archive");return}e.classList.contains("dt-step-act")||(tt=null),o==="rm"?await to(a):await Le(a,o==="done")});let ii="",ee=t=>{Jt.hidden||Ot.contentWindow?.postMessage({dt:!0,...t},location.origin)},Ol=()=>({notes:Tt,grid:!w.hidden,inspect:E,resolved:ie,archived:Ne,...li.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(!b&&t.source===Ot.contentWindow){if(e.key){gi(e.key[0],e.key[1])?.run();return}if(e.closeMenus){mt();return}if(e.drafts){Zs=e.drafts,cn(xe());return}}if(b&&typeof e.openDraft=="number"){so(e.openDraft);return}if(b&&typeof e.dropDraft=="number"){ka(e.dropDraft);return}if(b&&typeof e.device=="string"&&(ii=e.device),b&&e.scrollbar&&Ft.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===Ot.contentWindow){ee(Ol());return}typeof e.notes=="boolean"&&e.notes!==Tt&&ye(e.notes,!1),typeof e.open=="number"&&Sn(e.open),typeof e.grid=="boolean"&&e.grid===w.hidden&&G(e.grid),typeof e.inspect=="string"&&e.inspect!==E&&R(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==ie&&ao(e.resolved),typeof e.archived=="boolean"&&e.archived!==Ne&&io(e.archived),e.reload&&Ge()});let Ye=async()=>{await Ge(),ee({reload:!0}),b&&parent.postMessage({dt:!0,reload:!0},location.origin)},ye=(t,e=!0)=>{if(Tt=t,W.setAttribute("aria-pressed",String(t)),t?!b&&q.hidden&&ot.getItem("dt-history")!=="0"&&(q.hidden=!1,Y.setAttribute("aria-pressed","true")):(q.hidden=!0,Y.setAttribute("aria-pressed","false")),k(je,t?"1":"0"),ee({notes:t}),b&&e&&parent.postMessage({dt:!0,notes:t},location.origin),J.hidden=!t||!Jt.hidden,Ft.toggle("dt-noting",t),t&&!document.querySelector(".dt-room")?document.body.append(Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"})):t||document.querySelector(".dt-room")?.remove(),t){R(""),document.addEventListener("click",Ua,!0);for(let n of za)document.addEventListener(n,Va,!0);document.addEventListener("keydown",_a),document.addEventListener("mousemove",Wa),addEventListener("scroll",ge,!0),addEventListener("resize",ge),addEventListener("pointerover",Ha,!0),qo(),Aa.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),Ca.observe(document.body),po()}else{O(),tt=null,document.removeEventListener("click",Ua,!0);for(let n of za)document.removeEventListener(n,Va,!0);document.removeEventListener("keydown",_a),document.removeEventListener("mousemove",Wa),bt.hidden=!0,removeEventListener("scroll",ge,!0),removeEventListener("resize",ge),removeEventListener("pointerover",Ha,!0),Aa.disconnect(),Ca.disconnect(),J.innerHTML=""}},{pickBp:ri,...li}=tr({cfg:s,inFrame:b,persist:k,frame:Jt,frameEl:Ot,devicesMenu:St,bpBtns:z,notesOverlay:J,WIDE:m,bpOf:v,currentBp:Ts,deviceById:H,notesOn:()=>Tt,filter:()=>ae,filterTo:t=>{ae=t},dropFrameDrafts:()=>{Zs=[]},putAway:()=>{tt=null,O()},tellFrame:ee,syncBpButtons:Po,render:()=>Q(),reread:()=>{Tt?po():Q()}}),di="dt-studio",ci=t=>{nt.setAttribute("aria-pressed",String(t)),Ft.toggle("dt-no-studio",!t),k(di,t?"1":"0")};nt.addEventListener("click",()=>ci(nt.getAttribute("aria-pressed")!=="true")),ci(ot.getItem(di)!=="0"),W.addEventListener("click",()=>ye(!Tt));let Ie=document.querySelector(".devtools"),mn=document.querySelector(".dt-tab"),ui=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-Ie.getBoundingClientRect().top)+12}px`);new ResizeObserver(ui).observe(Ie),addEventListener("resize",ui);let pi=t=>{Ie.toggleAttribute("data-collapsed",t),mn.toggleAttribute("data-collapsed",t),mn.setAttribute("aria-expanded",String(!t)),mn.setAttribute("aria-label",t?"Show the bar":"Hide the bar");for(let e of Ie.querySelectorAll(".dt-group"))e.inert=t;t&&mt(),k("dt-collapsed",t?"1":"0")};mn.addEventListener("click",()=>pi(!Ie.hasAttribute("data-collapsed")));let Se=document.querySelector(".dt-keys"),hi=Se.querySelector(".dt-set-keys"),$o=t=>{hi.hidden=!t,Se.querySelector(".dt-set-main").hidden=t};if(Yt.signOut)for(let t of Se.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;Se.querySelector("summary").addEventListener("click",()=>$o(!1)),Se.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let n=e.dataset.set;if(n==="keys"||n==="back")return $o(n==="keys");Se.open=!1,n==="hide"&&mn.click(),n==="out"&&confirm("Sign out of Notemend on this site?")&&Yt.signOut?.()});let ve=t=>()=>Ie.querySelector(t)?.click(),mi=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(n=>n.hasAttribute("aria-current"))+t]?.click()},ps=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:ve(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:ve(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:ve(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>io(!Ne)},{group:"Threads",code:"KeyM",hint:"M",label:"Studio / clients",run:()=>An(He==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Pe.hidden||Hn(le.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:ve(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:ve(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:ve(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:ve(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:ve(".dt-color-btn")},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:ve(".dt-border-btn")},...s.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:ve(".dt-studio-btn")}]:[],...z.slice(0,9).map((t,e)=>({group:"Breakpoints",code:`Digit${e+1}`,hint:String(e+1),label:t.dataset.tip??t.title,el:`.dt-bp[data-bp="${t.dataset.bp}"]`,run:()=>t.click()})),{group:"View",code:"KeyD",hint:"D",label:"Devices",run:()=>{St.open=!St.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:mi(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:mi(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>mn.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=Se.open&&!hi.hidden;Se.open=!t,$o(!t)}}].filter(t=>!s.client||t.group!=="Inspect"),gi=(t,e)=>ps.find(n=>n.code===t&&!n.shift==!e),Dl=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||!!t.closest('[role="menu"], [role="listbox"], [role="dialog"][aria-modal="true"], [role="combobox"]'));if(s.shortcuts){for(let e of ps){let n=e.el&&Ie.querySelector(e.el);n&&(n.dataset.tip=`${n.dataset.tip??e.label} \xB7 ${e.hint}`,n.setAttribute("aria-keyshortcuts",e.hint.startsWith("\u21E7")?`Shift+${e.hint.slice(1)}`:e.hint))}let t=(e,n)=>`<div class="dt-key-row"><span>${g(e)}</span><kbd>${g(n)}</kbd></div>`;if(Se.querySelector(".dt-keys-list").innerHTML='<p class="dt-menu-note">One key, no modifier, in any keyboard layout. Not while you type.</p>'+[...new Set(ps.map(e=>e.group))].map(e=>`<p class="dt-devices-group">${e}</p>`+ps.filter(n=>n.group===e).map(n=>t(n.label,n.hint)).join("")).join("")+'<p class="dt-devices-group">In a comment</p>'+t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"),document.addEventListener("keydown",e=>{if(e.repeat||e.isComposing||e.metaKey||e.ctrlKey||e.altKey||e.defaultPrevented||Dl(e.target))return;let n=gi(e.code,e.shiftKey);n&&(e.preventDefault(),b?parent.postMessage({dt:!0,key:[e.code,e.shiftKey]},location.origin):n.run())}),b){let e=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",n=>{n.key==="Escape"&&e()})}}if(!b){pi(ot.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>Ie.setAttribute("data-ready",""))),li.restore(),G(ot.getItem(A)==="1");let t=ot.getItem(se);t&&t in Vt&&R(t),ye(ot.getItem(je)==="1")}let fi=()=>{try{let t=JSON.parse(ot.getItem(ue)||"null");Nt=(t?.parked??[]).filter(e=>C(e)),t?.draft&&document.querySelector(t.draft.selector)?(T=t.draft,!Tt&&!b&&ye(!0)):C(t?.draft)&&Nt.push(t.draft),t?.reply?.text&&(Ht=t.reply.text,Et=tt=t.reply.for??null),(T||Nt.length||Ht)&&Q()}catch{ot.removeItem(ue)}};fi();let bi=()=>setTimeout(()=>{let t=B(location.pathname);t!==Z&&(clearTimeout(sn),vn(),Z=t,ue=$e(),T=null,Nt=[],Ht="",Et=null,tt=null,gt=null,V=[],L(),fi(),po(),Ge())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...n){e.apply(this,n),bi()}}addEventListener("popstate",bi),i.then(async t=>{t.status===200&&Fa(await t.json())},()=>{}).then(()=>ie?Ge(!0):void 0).then(ss.resume),document.addEventListener("visibilitychange",()=>{document.hidden||Nn()}),addEventListener("focus",Nn),addEventListener("notemend:changed",()=>{b||Nn()});let ql=0;b||setInterval(()=>{(!Yt.live||++ql%6===0)&&Nn()},2e4),b&&parent.postMessage({dt:!0,hello:!0},location.origin)}function rr(s){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let i=HTMLDialogElement.prototype,d=i.showModal,h=null,m=null,v=()=>{if(h){m?.disconnect(),m=null;for(let b of s)document.body.append(b);try{h.hidePopover()}catch{}h.remove(),h=null}},S=()=>{v();let b=document.querySelector("dialog:modal");b&&H(b)},H=b=>{v(),h=document.createElement("div"),h.className="dt-host",h.setAttribute("popover","manual"),h.append(...s),b.append(h);try{h.showPopover()}catch{}b.addEventListener("close",S,{once:!0}),m=new MutationObserver(()=>{b.isConnected||S()}),m.observe(document.documentElement,{childList:!0,subtree:!0})};i.showModal=function(){d.call(this),this.isConnected&&H(this)}}var md=".devtools, [class^='dt-'], [class*=' dt-']";function lr(){let s=document.createElement("div");s.className="dt-tipbox",s.setAttribute("role","tooltip"),s.id="dt-tipbox",s.hidden=!0,document.body.append(s);let i=null,d,h=0,m=k=>{let y=k.getAttribute("title");y!==null&&(k.removeAttribute("title"),k.hasAttribute("data-tip")||k.setAttribute("data-tip",y),!k.hasAttribute("aria-label")&&!k.textContent?.trim()&&k.setAttribute("aria-label",y))},v=k=>{let y=k?.closest?.("[data-tip], [title]");return y&&y.closest(md)&&!y.closest(".dt-tipbox")?y:null},S=k=>{let y=k.getAttribute("data-tip");if(!y||k.getAttribute("aria-expanded")==="true")return H();s.textContent=y,s.hidden=!1;let B=k.getBoundingClientRect(),Z=s.getBoundingClientRect(),F=6,w=8,A=B.bottom+F+Z.height<=innerHeight-w;s.style.top=`${A?B.bottom+F:Math.max(w,B.top-F-Z.height)}px`,s.style.left=`${Math.min(Math.max(w,B.left+B.width/2-Z.width/2),innerWidth-w-Z.width)}px`,s.classList.toggle("is-mono",k.classList.contains("dt-note-el")),k.setAttribute("aria-describedby",s.id)},H=()=>{clearTimeout(d),i&&!s.hidden&&(h=performance.now()+400),i?.removeAttribute("aria-describedby"),i=null,s.hidden=!0},b=k=>{k!==i&&(H(),m(k),i=k,performance.now()<h?S(k):d=setTimeout(()=>i===k&&S(k),300))};document.addEventListener("pointerover",k=>{let y=v(k.target);y?b(y):i&&!i.contains(k.target)&&H()},!0),document.addEventListener("pointerout",k=>{i&&!i.contains(k.relatedTarget)&&H()},!0),document.addEventListener("focusin",k=>{let y=v(k.target);y&&k.target.matches(":focus-visible")&&b(y)},!0),document.addEventListener("focusout",H,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("keydown",k=>{k.key==="Escape"&&H()},!0),addEventListener("scroll",H,!0),new MutationObserver(()=>{i&&!i.isConnected&&H()}).observe(document.body,{childList:!0,subtree:!0})}function dr(){let s=window;if(s.__notemend)return;s.__notemend=!0,zi(d=>d.includes("/__devbar/")||!!Yt.base&&d.startsWith(Yt.base)),Ft.ready=new Promise(d=>{if(!("__next_f"in self))return d();let h=0,m=()=>Object.keys(document.documentElement).some(v=>v.startsWith("__reactFiber$"))||++h>330?d():setTimeout(m,30);m()}),Ft.toggle("dt-in-frame",ys);let i=At("comments?open=1");Mi().then(d=>{Ft.set("--dt-z",String(d.zIndex));let h=d.brand?.color;if(h&&/^#[0-9a-f]{6}$/i.test(h)){let[m,v,S]=[1,3,5].map(H=>parseInt(h.slice(H,H+2),16)/255);Ft.set("--dt-accent",h),Ft.set("--dt-accent-ink",.2126*m+.7152*v+.0722*S>.55?"#000000":"#ffffff")}qi(d),ir(d,i),lr(),rr([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-tipbox"].map(m=>document.querySelector(m)).filter(m=>!!m))}).catch(d=>console.warn("[notemend] not started:",d))}dr();import.meta.hot&&import.meta.hot.accept(()=>location.reload());
|
|
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?Be(C):null,xt=z&&j.find(Ce=>Ce.id>0&&Mt(Ce)==="open"&&Be(Ce)===z);return xt?`<p class="dt-note-twin">Already open here: \u201C${f(Zt(xt.text,60))}${xt.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${xt.id}">Open it</button></p>`:""})()}
|
|
298
|
+
${o.client?`<div class="dt-note-meta">${Qd(C.assignee)}</div>`:""}
|
|
299
|
+
${C.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">${fn}</button></span>
|
|
300
|
+
<span class="dt-suggest-was">Now: <del>${f(Zt(C.suggest.from,160))}${C.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">${f(C.suggest.to)}</textarea>
|
|
302
|
+
<span class="dt-suggest-hint">Change the words in the box \u2014 Claude puts in exactly what you write.</span></div>`:""}
|
|
303
|
+
${Ki("dt-note-input",C.suggest?"Why (optional)":"Comment",C.text??"",'data-act="save"',Wi(C.images))}
|
|
304
|
+
<div class="dt-note-meta dt-note-type">${Jo(sn(C.category).id,void 0,!1)}</div>
|
|
305
|
+
${Hi(C.priority,C.category,void 0,C.assignee??"",!1,!!C.shared,!0)}
|
|
306
|
+
</div>`}let d=new Map([...U.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([...U.querySelectorAll("[data-msg]")].map(p=>p.dataset.msg)),g=U.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Bc(e,dt.hidden?s.some(p=>!!a.get(p.id)):s.length>0),oi(U,n),g&&!U.contains(document.activeElement)&&ys(".dt-note-reply-input");let w=[],N=[];for(let p of U.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let Y=p.closest(".dt-note").dataset.id,z=d.get(Y);if(!z){w.push(p),delete $e[Y],p.parentElement.querySelector(".dt-new-below")?.remove();continue}let xt=[...p.querySelectorAll("[data-msg]")].filter(vt=>!u.has(vt.dataset.msg));for(let vt of xt)vt.classList.add("dt-msg--new");let Ce=z.end||String(Os)===Y;Ce&&N.push(p),p.scrollTop=Ce?p.scrollHeight:z.top;let re=xt.filter(vt=>!vt.classList.contains("dt-msg--mine")).length;if(re&&!z.end&&String(Os)!==Y){$e[Y]=($e[Y]??0)+re;let vt=$e[Y],Jt=p.parentElement.querySelector(".dt-new-below")??p.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Jt.dataset,{act:"newbelow",id:Y}),Jt.textContent=`${vt} new ${vt===1?"reply":"replies"} \u2193`}}for(let p of U.querySelectorAll(".dt-new-below")){let Y=p.closest(".dt-note")?.querySelector(".dt-note-thread");(!Y||Y.scrollTop+Y.clientHeight>=Y.scrollHeight-4)&&(delete $e[p.dataset.id],p.remove())}Os=null,cr([...w,...N]),Q==null?Is=null:Q!==Is&&U.querySelector(`.dt-note[data-id="${Q}"]`)&&(Is=Q,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&ys(`.dt-note[data-id="${Q}"] .dt-note-reply-input`)),$n(e),Uo(Ko()),ke();for(let p of U.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Ra(p);let G=U.querySelector(".dt-note-input");G&&document.activeElement!==G&&(G.focus(),G.setSelectionRange(G.value.length,G.value.length))},Ic=()=>{ya&&Bt&&!x&&vr();let t=!1,e=document.getAnimations().some(i=>i.playState==="running"),n=[];for(let i of U.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(i.classList.contains("dt-note--orphan")||i.classList.contains("is-dragging"))continue;let l=j.find(u=>u.id===Number(i.dataset.id)),d=l&&ae(l);n.push([i,d&&i.matches(".dt-pin")&&Sd(d.el,d.x,d.y)?null:d]),d&&e&&gi(d.el)&&(t=!0)}for(let i of U.querySelectorAll("[data-draft], [data-parked]")){if(i.classList.contains("dt-note--orphan"))continue;let l=i.dataset.parked?pe[Number(i.dataset.parked)]:C;n.push([i,l?ae(l):null])}let s=(i,l,d)=>{let u=`${l}px`,g=`${d}px`;i.style.left!==u&&(i.style.left=u),i.style.top!==g&&(i.style.top=g)};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=""),s(i,l.x,l.y),i.matches(".dt-pin[data-id]")){if((i.dataset.off??"")!==(l.off||"")&&(l.off?i.dataset.off=l.off:delete i.dataset.off),i.classList.contains("dt-pin--hidden")!==!!l.hidden){i.classList.toggle("dt-pin--hidden",!!l.hidden);for(let u of["title","aria-label"]){let g=(i.getAttribute(u)??"").replace(Ds,"");i.setAttribute(u,l.hidden?g.replace(/( \u2014 drag to move)?$/,`${Ds}$1`):g)}}d?.matches(".dt-pin-eye")&&(d.hidden!==!l.hidden&&(d.hidden=!l.hidden),l.hidden&&s(d,l.x,l.y))}i.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!l.hidden)}if(!_s.length&&(C||Q!=null)){let i=Ko();i&&e&&gi(i)&&Uo(i)}let a=U.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(a.length){let i=pa();for(let l of a)l.style.visibility!=="hidden"&&dr(l,i)}se(C||Q!=null?Ko():null),t&&ke(),clearTimeout(pr),pr=window.setTimeout(Oc,150)},ma=new Map,pr=0,Oc=()=>{let t=new Map,e=s=>{let a=[],i="";for(let l=s;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 g=u.backgroundColor.match(/[\d.]+/g);if(g&&(g[3]===void 0?1:+g[3])>=.9){i=u.backgroundColor;break}}i||="#fff";for(let l of a)t.set(l,i);return i},n=[];for(let s of U.querySelectorAll(".dt-pin[data-id]")){if(s.style.visibility==="hidden"||s.classList.contains("is-dragging"))continue;let a=s.getBoundingClientRect(),i=document.elementsFromPoint(a.x+a.width/2,a.y+a.height/2).find(l=>!Ns(l));i&&n.push([s,e(i)])}for(let[s,a]of n)ma.set(Number(s.dataset.id),a),s.style.setProperty("--dt-page",a)},hr=t=>`dt-gfold:${o.project||location.host}:${t}`,$n=t=>{if(at.hidden){at.replaceChildren();return}if(oi(at,vd({bp:t,notes:j.filter(rn),breakpoints:h,bandOfNote:$,orphan:e=>!ae(e),hiddenNow:e=>!!ae(e)?.hidden,statusTools:e=>Zi(e,!1),stage:Dc,step:Fd,live:jd,showResolved:xe,showArchived:Fe,archived:Ee,drafts:dt.hidden?Yi():la,checks:x?0:io.toCheck().length,clients:Xe()&&qe==="clients",marker:Fc,assign:qd,find:he,forMe:qc,forAgent:e=>!!Ut(e)&&Mt(e)!=="done",unread:$i,archives:!o.client&&!ie(),deletable:e=>!yn(e),folded:at.hasAttribute("data-collapsed"),shut:e=>ot.getItem(hr(e))==="1"})),zn){let e=at.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(zn.at,zn.at),zn=null}},zn=null,Dc=t=>{let e=cn.find(n=>n[0]===Ai(t)&&n[0]!=="new");return e?`<i class="dt-hist-stage" style="--cat:${e[2]}">${e[1]}</i>`:""},qc=t=>{if(Mt(t)==="done"||!o.me)return!1;if(t.assignee===o.me.email||Mt(t)==="claude"||fe(t)==="review"&&t.assignee!==o.me.email)return!0;let e=(o.me.name||o.me.email).split(/[\s@]/)[0].toLowerCase();return mn(t).some(n=>n.text.toLowerCase().includes("@"+e))},Fc=t=>{let e=Ut(t),n=Dn[e??""],s=Mt(t)==="done"?Ee(t)?`<i class="dt-hist-badge is-archived">${gn}</i>`:`<i class="dt-hist-badge is-done">${be}</i>`:n?`<i class="dt-hist-badge" style="--b:${n}">${de(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${cn.find(i=>i[0]===Fn(t))[2]}"></i>`,a=vi(t);return a?`<span class="dt-hist-face" style="--hue:${dn(t.by||t.byName||"")}">${a}</span>`:`<span class="dt-hist-n" style="--cat:${sn(t.category).color}">${s}</span>`},ao=t=>{ha=!1,at.toggleAttribute("data-collapsed",t),J()};at.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(he.q=e.value,zn={at:e.selectionStart??e.value.length},$n(Ne()))}),at.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(at.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){ao(!1);return}if(t.target.closest("[data-fold]")){ao(!at.hasAttribute("data-collapsed"));return}let n=t.target.closest("[data-gfold]");if(n){let G=hr(n.dataset.gfold);q(G,ot.getItem(G)==="1"?"":"1"),$n(Ne());return}let s=t.target.closest(".dt-hist-bands [data-bp]");if(s){qa(s.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?(he.view=a.dataset.histView,q("dt-view",he.view),he.menu=!1):a.dataset.histSort?(he.sort=a.dataset.histSort,q("dt-sort",he.sort),he.menu=!1):a.hasAttribute("data-hist-clear")?(he.q="",zn={at:0}):he.menu=!he.menu,$n(Ne());return}he.menu&&!t.target.closest(".dt-hist-menu")&&(he.menu=!1,$n(Ne()));let i=t.target.closest("[data-draft-go], [data-draft-rm]");if(i){let G=i.dataset.draftRm!==void 0,p=Number(G?i.dataset.draftRm:i.dataset.draftGo);dt.hidden?G?mr(p):ga(p):ge(G?{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 en(Number(l.dataset.id),l.dataset.act==="done");return}let d=t.target.closest("[data-rm]");if(d){Q=null,ca(Number(d.dataset.rm));return}if(t.target.closest("[data-review]")){io.start();return}if(t.target.closest("[data-resolved]")){ba(!xe);return}if(t.target.closest("[data-archived]")){va(!Fe);return}let u=t.target.closest("[data-archive-all]");if(u){let G=u.dataset.archiveAll.split(",").map(Number);for(let p of G)await wn(p,!0,!0);nn(`Archived ${G.length}`,()=>{for(let p of G)wn(p,!1,!0)});return}let g=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(g){await wn(Number(g.dataset.id),g.dataset.act==="archive");return}let w=t.target.closest("[data-go]");if(!w)return;let N=Number(w.dataset.go);if(!dt.hidden){ge({open:N});return}us(N)});let us=t=>{Q=t,Is=null,He(),un=!0,J();let e=j.find(s=>s.id===t),n=e&&ae(e);n?scrollTo({top:scrollY+n.y-innerHeight/2,behavior:"smooth"}):e&&Be(e)?.scrollIntoView({block:"center",behavior:"smooth"}),matchMedia("(prefers-reduced-motion: reduce)").matches||U.querySelector(`.dt-pin[data-id="${t}"]`)?.animate([{transform:"scale(1)"},{transform:"scale(1.5)"},{transform:"scale(1)"}],400),oo()},ga=t=>{let[e]=pe.splice(t,1);if(!e)return;He(),C=e,Q=null;let n=ae(e);n&&(n.y<0||n.y>innerHeight)&&scrollTo({top:scrollY+n.y-innerHeight/3,behavior:"instant"}),J()},mr=t=>{pe.splice(t,1),J()},io=yd({inFrame:x,everything:()=>pt,route:()=>wt,settle:en,keepIn:Fo,toast:t=>Rt(t),waits:t=>Mt(t)==="claude"||Mt(t)==="done"&&!Ee(t),approve:t=>Mt(t)==="claude"?en(t.id,!0):wn(t.id,!0,!0),open:t=>{if(Bt||Le(!0),$(t)!==Ne()){qa($(t));for(let e of[600,1500])setTimeout(()=>ge({open:t.id}),e)}else us(t.id)}}),jc=t=>{at.hidden=!t,Gt.setAttribute("aria-pressed",String(t)),q("dt-history",t?"1":"0"),J()},fa=document.querySelector(".dt-resolved-btn"),ps=document.querySelector(".dt-space"),Wc=()=>{if(!ps)return;ps.hidden=!Xe(),ps.dataset.on=qe;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Xe()&&qe==="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 s of ps.querySelectorAll("[data-space]")){let a=s.dataset.space;s.setAttribute("aria-checked",String(a===qe))}},gr=0,hs=t=>{if(!Xe()||t===qe)return;let e=()=>{qe=t,q("dt-space",t),Q!=null&&!rn(j.find(s=>s.id===Q))&&(Q=null),He(),ro(pt),J(),$n(Ne())};if(matchMedia("(prefers-reduced-motion: reduce)").matches)return e();let n=document.documentElement;n.classList.add("dt-switching"),clearTimeout(gr),gr=window.setTimeout(()=>{e(),requestAnimationFrame(()=>n.classList.remove("dt-switching"))},120)};document.querySelector(".dt-client-x")?.addEventListener("click",()=>hs("studio")),ps?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&hs(e.dataset.space)});let Gn=document.querySelector(".dt-pinf"),Vn=Gn.querySelector(".dt-pinf-btn"),Pe=Gn.querySelector(".dt-pinf-menu"),fr={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My Claude",wrote:"Written by me",check:"To check"},_c=()=>j.filter(t=>$(t)===Ne()&&js(t)&&rn(t)),ms=(t,e=!1)=>{Pe.hidden=!t,Vn.setAttribute("aria-expanded",String(t)),t&&(zo(),e&&Pe.querySelector('[aria-checked="true"]')?.focus())};zo=()=>{let t=_c();if(Gn.hidden=!Xe()||!t.length,Gn.hidden){Pe.hidden=!0;return}let e=Object.fromEntries(di.map(g=>[g,t.filter(w=>Ci(w,g)).length])),n=(o.me?.email??"").toLowerCase(),s=[["nobody","var(--dt-new)"],["mine",dn(n)],["others","var(--dt-faint)"]];if(Vn.toggleAttribute("data-on",Je!=="all"),Vn.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 ${fr[Je]}, ${e[Je]}`}`),Pe.hidden)return;let a=[...new Set(t.map(g=>Ho(g,Mt(g))?.taker).filter(g=>!!g&&g!==n))].slice(0,2),i=g=>On(je(g)?.avatar_url,je(g)?.name||g,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${dn(g)}" `),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">${de(10)}</i>`,wrote:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 16.5h6.5M13.4 3.9a1.8 1.8 0 0 1 2.6 2.6L7.4 15.1 4 16l.9-3.4z"/></svg>',check:Ae(cn[2][2],cn[2][3]),resolved:Ae(Ze[Ze.length-1][2],Ze[Ze.length-1][3])},d=(g,w)=>`<b class="dt-pinf-share"><i style="--c:${w};width:${Math.round(100*e[g]/e.all)}%"></i></b>`,u=(g,w="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${Je===g}" data-pinf="${g}"><i class="dt-pinf-glyph">${l[g]}</i><span>${fr[g]}</span>${w?d(g,w):""}<em>${e[g]}</em>${be}</button>`;Pe.innerHTML=`<div class="dt-pinf-head"><b>SHOW</b>${e.all} on this page</div>${u("all")}${s.map(([g,w])=>u(g,w)).join("")}${e.resolved||Je==="resolved"?u("resolved"):""}<hr>${u("claude")}${u("wrote")}${u("check")}${o.shortcuts?'<div class="dt-pinf-foot"><kbd>F</kbd>opens it \xB7 the rest dim, not hidden</div>':""}`},Vn.addEventListener("click",t=>ms(Pe.hidden,t.detail===0)),Pe.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&(Je=e.dataset.pinf,q("dt-pinf",Je),ms(!1),Vn.focus(),Bt?J():Le(!0))}),Pe.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),ms(!1),Vn.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...Pe.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!Pe.hidden&&!Gn.contains(t.target)&&ms(!1)},!0);let ba=t=>{xe=t,fa.setAttribute("aria-pressed",String(t)),q("dt-resolved",t?"1":"0"),ge({resolved:t}),J(),Mn(!0)},va=t=>{Fe=t,q("dt-archived",t?"1":"0"),ge({archived:t}),J(),Mn(!0)};fa.addEventListener("click",()=>ba(!xe)),fa.setAttribute("aria-pressed",String(xe)),Gt.addEventListener("click",()=>{let t=at.hidden===!0;t&&!Bt&&Le(!0),t&&ao(!1),jc(t)});let ke=()=>{jo||!Bt||(jo=requestAnimationFrame(()=>{jo=0,Ic()}))},br=`${an}, .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`,zc=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(br))return!0;let n=[...t.addedNodes,...t.removedNodes];return n.length>0&&n.every(s=>s instanceof Element&&s.matches(br))},ya=!1,vr=()=>{ya=!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)},wa=0,$a=!1,Gc=()=>{if(!Bt)return!1;let t=new Set([...U.querySelectorAll(".dt-pin[data-id]")].map(n=>Number(n.dataset.id))),e=Ne();return j.some(n=>!t.has(n.id)&&$(n)===e&&js(n)&&rn(n)&&!!ae(n))},Vc=()=>Bt&&[...U.querySelectorAll(".dt-pin[data-id]")].some(t=>{let e=j.find(n=>n.id===Number(t.dataset.id));return!!e&&e.id!==Q&&!Be(e)}),yr=new MutationObserver(t=>{if(Bt&&!x&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),ya=!0}t.every(zc)||(ke(),t.some(e=>e.type!=="attributes")&&($a=!0),wa||(wa=window.setTimeout(()=>{wa=0,$a&&($a=!1,mi()),Gc()||Vc()?J():ke()},150)))}),wr=new ResizeObserver(()=>ke()),$r=()=>{U.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&ke()},pt=[],xr=()=>{},gs=new Set,me={at:"",ids:[]},ro=t=>{pt=t,queueMicrotask(()=>xr());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),n={};for(let d of t){if(Ee(d)||!rn(d))continue;let u=Mt(d),g=Ut(d),w=u==="done"?"done":u==="claude"?"review":g&&Ks[g]||Fn(d),N=n[d.route??""]??={...e(),bands:{}};N[w]++;let G=$(d);(N.bands[G]??=e())[w]++}Wc();let s=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},i=d=>s.map(u=>[u,u==="done"&&!xe?0:d[u]]),l=d=>i(d).reduce((u,[,g])=>u+g,0);for(let d of document.querySelectorAll(".dt-pages a")){let u=d.querySelector(".dt-pages-n");if(!u)continue;let g=n[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let G of h){let p=g?.bands[G.id];for(let[Y,z]of i(p??e())){let xt=u.querySelector(`[data-bp="${G.id}"][data-state="${Y}"]`);xt.hidden=!z,z&&(xt.querySelector("i").textContent=String(z),xt.title=`${G.label}: ${z} ${a[Y]}`)}}let w=g?l(g):0;u.hidden=!w;let N=g?h.filter(G=>g.bands[G.id]&&l(g.bands[G.id])).map(G=>`${G.label} ${l(g.bands[G.id])}`).join(" \xB7 "):"";u.title=w?`${s.filter(G=>g[G]).map(G=>`${g[G]} ${a[G]}`).join(" \xB7 ")}
|
|
307
|
+
${N}`:""}},xn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!no.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=>so.has(`${Number(e.id)}|${n.at}`)?{...n,text:"",deleted:!0}:n):[],images:Array.isArray(e.images)?e.images.filter(n=>typeof n=="string"):[]})),Uc=wd(x,t=>Rt(t,2800,document.querySelector(".dt-turbo")??void 0)),We=document.querySelector(".dt-push"),_e=We.querySelector(".dt-push-menu"),ze=new Set,fs=new Set([wt]),lo=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",co=()=>o.client||ie()||x?[]:pt.filter(t=>t.status!=="done"&&Tt(t.assignee)&&!Lt(t)&&fe(t)==="approved"&&!Ke(t)&&!Ee(t)&&!gs.has(t.id)),uo=()=>co().filter(t=>!ze.has(t.id)),Er=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?be:""}</i>`,Mr=()=>{let t=co(),e=[...new Set(t.map(s=>s.route??"/"))],n=uo().length;_e.innerHTML=`<div class="dt-push-head">${de(14)}<b>Waiting for Claude</b><button type="button" data-push="all">All</button></div>`+e.map(s=>{let a=t.filter(l=>(l.route??"/")===s),i=a.filter(l=>!ze.has(l.id)).length;return`<button type="button" class="dt-push-page${fs.has(s)?" is-open":""}" data-push-route="${f(s)}"><span data-push-fold="${f(s)}">${Us}</span>${Er(i>0,i>0&&i<a.length)}<span class="dt-push-route">${f(s)}</span><em>${a.length}</em></button>`+(fs.has(s)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${Er(!ze.has(l.id))}<span><small>#${l.id}</small>${f(Zt(l.text,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${n?"":" disabled"}>Send ${n} to Claude</button>`},xa=()=>["push","paused"].includes(lo()),Ea=()=>me.ids.filter(t=>{let e=pt.find(n=>n.id===t);return!!e&&e.status!=="done"&&fe(e)!=="review"&&(gs.has(t)||!!Ke(e)||fe(e)==="approved")}),kr="",Kc=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},En=()=>{let t=lo(),e=uo().length,n=Ea(),s=me.ids.length-n.length,a=n.length>0&&xa();if(We.classList.toggle("is-working",a),n.length&&(kr=me.at),!n.length&&me.ids.length&&me.at&&kr===me.at&&!Kc(me.at)){try{sessionStorage.setItem("nm-batch-done",me.at)}catch{}pt.length&&nn(`Claude finished ${me.ids.length} \u2014 check the fixes`,()=>io.start(),"Check")}We.hidden=o.client||ie()||x,We.classList.toggle("is-live",xa()),We.classList.toggle("is-quiet",t==="on");let i=We.querySelector(".dt-push-n");i.textContent=String(a?n.length:e),i.hidden=!a&&!e,We.querySelector(".dt-push-all").dataset.tip=a?`Push to Claude: Claude is on ${n.length}${s?` \u2014 ${s} 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 thread 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?"thread waits":"threads wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to Claude: nothing waits for Claude yet \u2014 mark threads for Claude, then send them here",(We.hidden||!co().length)&&(_e.hidden=!0),_e.hidden||Mr()},Lr=async t=>{if(!t.length&&xa()){Rt("Nothing waits for Claude \u2014 mark threads for Claude first");return}if(lo()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Rt("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(lo()==="on"){Rt("Turbo is on \u2014 Claude takes each thread as it lands");return}_e.hidden=!0;let e=t.map(s=>s.id),n=await zt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(!n?.ok){Ln("Could not send them to Claude",n);return}for(let s of e)gs.add(s);me={at:me.ids.some(s=>Ea().includes(s))?me.at:new Date().toISOString(),ids:[...new Set([...Ea(),...e])]},En(),nn(`${e.length} sent to Claude \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await zt("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let s of e)gs.delete(s);En()}),Ge()},po=We.querySelector(".dt-push-all"),Sr=0,Ma=!1,Tr=()=>{_e.hidden=!1,Mr()};po.addEventListener("click",()=>{if(Ma){Ma=!1;return}Lr(uo())}),po.addEventListener("contextmenu",t=>{t.preventDefault(),_e.hidden?Tr():_e.hidden=!0}),po.addEventListener("pointerdown",t=>{t.button===0&&(Sr=window.setTimeout(()=>{Ma=!0,Tr()},500))});for(let t of["pointerup","pointerleave","pointercancel"])po.addEventListener(t,()=>clearTimeout(Sr));_e.addEventListener("click",t=>{let e=t.target,n=e.closest("[data-push-fold]"),s=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),i=e.closest("[data-push]")?.dataset.push;if(i==="send"){Lr(uo());return}if(i==="all")ze.clear();else if(n){let l=n.dataset.pushFold;fs.has(l)?fs.delete(l):fs.add(l)}else if(s){let l=co().filter(u=>(u.route??"/")===s.dataset.pushRoute),d=l.some(u=>!ze.has(u.id));for(let u of l)d?ze.add(u.id):ze.delete(u.id)}else if(a){let l=Number(a.dataset.pushId);ze.has(l)?ze.delete(l):ze.add(l)}En()}),document.addEventListener("pointerdown",t=>{!_e.hidden&&!We.contains(t.target)&&(_e.hidden=!0)},!0),setInterval(En,3e4),xr=En;let Cr=document.querySelector(".dt-turbo");Cr&&new MutationObserver(En).observe(Cr,{attributes:!0,attributeFilter:["data-state"]}),En();let bs="",ka=!1,Un="dt-threads",Ar=String([_t.base,o.me?.email??"",...o.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),La="",ho=null,Yc=t=>{x||t.version&&t.version===La||(ho||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=ho;ho=null,La=e.version??"";let n=JSON.stringify({project:Ar,body:e});n.length<2e6?ot.setItem(Un,n):ot.removeItem(Un)},{timeout:3e3}),ho=t)},Sa=(t,e=!1)=>{bs=t.version??"",Uc(t);let n=t.turbo;gs=new Set(n?.push?.ids??[]),me={at:n?.batch?.at??"",ids:n?.batch?.ids??[]};let s=xn(t.comments);if(e&&(xe||Fe)){let i=new Set(s.map(l=>l.id));s=[...s,...pt.filter(l=>Mt(l)==="done"&&!i.has(l.id))]}Yc({...t,comments:s}),ro(s);let a=s.filter(i=>i.route===wt);if(!(Fs&&(j=a,Hr()))){if(JSON.stringify(a)===JSON.stringify(j)){!at.hidden&&!x&&J();return}j=a,J(),ge({reload:!0})}},Mn=async(t=!1)=>{let e=[t||!bs?"":`since=${bs}`,xe||Fe?"":"open=1"].filter(Boolean).join("&");try{let n=await zt(`comments${e?`?${e}`:""}`);n.status===200&&Sa(await n.json())}catch{}},vs=!1,kn=async()=>{if(!document.hidden){if(ka||eo){vs=!0;return}ka=!0,await Mn(),ka=!1,vs&&(vs=!1,kn())}};tr=()=>{vs&&!eo&&(vs=!1,kn())};let Hr=()=>{let t=Fs&&j.find(e=>e.id===Fs);return t?(Fs=0,Xe()&&!rn(t)&&hs(Lt(t)?"clients":"studio"),Bt||Le(!0),us(t.id),!0):!1},Ta=()=>{j=pt.filter(t=>t.route===wt),Hr()||J()},Ca=0,Aa=null,mo=()=>{Aa&&Bt&&Ha(Aa)},Ha=t=>{Aa=t,!Ca&&(Ca=requestAnimationFrame(()=>{Ca=0;let e=t.target;if(!Bt||e.closest(ce)){k.hidden=!0;return}let n=document.elementFromPoint(t.clientX,t.clientY);if(k.hidden=!1,!n)return;let s=n.getBoundingClientRect();B.style.cssText=`left:${s.left}px;top:${s.top}px;width:${s.width}px;height:${s.height}px`,W.textContent=n.tagName.toLowerCase()+([...n.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...n.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(s.width)}\xD7${Math.round(s.height)}`,W.style.cssText=`left:${s.left}px;top:${Math.max(2,s.top-16)}px`}))},Nr=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),Ot){Ot=null,J();return}if(C){ns()&&(He(),J());return}if(Q!==null){Q=null,J();return}Le(!1)}},Br=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],Rr=!1,Pr=t=>{t.type==="pointerdown"&&(Rr=t.pointerType==="touch"),!t.target.closest?.(ce)&&t.stopPropagation()},Ir=t=>{let e=t.target;Rr&&(!e.closest?.(ce)||e.closest?.(".dt-pin"))&&t.preventDefault()},Or=t=>{let e=t.target;if(e.closest(ce))return;if(t.preventDefault(),t.stopPropagation(),yt){yt=!1;return}if(!getSelection()?.isCollapsed)return;let n=t.detail===0&&!t.clientX&&!t.clientY,s=document.activeElement;U.hidden=!0;let a=n?s&&s!==document.body&&!s.closest(ce)?s:e:document.elementFromPoint(t.clientX,t.clientY);if(U.hidden=!1,!a||!ns())return;He();let i=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(g=>!/^(astro|svelte|css)-/.test(g)).slice(0,2);C={selector:ui(a),tag:l,classes:d,nth:pi({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:Zt(Qt(a.textContent||""),60),ctx:hi(a),category:m[0].id,...Xe()&&qe==="clients"?{shared:!0}:{}};let u=o.client||ie()||C.shared?null:Gs();u&&(C.assignee=u,C.stage=Tt(u)?"approved":"new"),qr.set(C,nu().then(()=>Na(a))),Q=null,k.hidden=!0,J()},Xc=2200,Jc=900*1024,Dr=8*1024*1024,Zc=3*1024*1024,Qc=50*1024*1024,tu=1200,eu=1600,Na=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 s=t?.getBoundingClientRect(),a=s&&s.width&&s.height?{x:(s.left-n.left)/n.width,y:(s.top-n.top)/n.height,w:s.width/n.width,h:s.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,tu/n.width,eu/n.height),u=await Promise.race([l(e,{scale:d,quality:.8,timeout:4e3,backgroundColor:i,filter:g=>!(g instanceof Element&&g.closest(an))}),new Promise(g=>setTimeout(()=>g(null),8e3))]);return u&&u.length<Dr?{url:u,box:a}:null}catch{return null}},qr=new WeakMap,nu=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Rt=(t,e=2800,n)=>{let s=document.createElement("div");s.className="dt-toast",s.textContent=t;for(let a of document.querySelectorAll(".dt-toast:not(.dt-toast--undo)"))a.remove();if(document.body.append(s),n){let a=n.getBoundingClientRect(),i=s.offsetWidth/2;s.style.left=`${Math.min(Math.max(a.left+a.width/2,i+8),innerWidth-i-8)}px`}return setTimeout(()=>s.remove(),e),s},Fr=async(t,e)=>{for(let n of e){let[,s,a]=n.split("\0"),i=Js.get(s);if(Js.delete(s),!i){Rt(`${a} was not sent \u2014 attach it again`);continue}let l=Rt(`Uploading ${a}\u2026`,12e4),d=await zt("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:i.name,size:i.size})}).then(N=>N.ok?N.json():null).catch(()=>null),u=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:i}).catch(()=>null),g=u?.ok&&await V({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!g||!g.ok){Rt(u===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let w=xn([await g.json().catch(()=>null)])[0];w&&(j=j.map(N=>N.id===w.id?w:N),J()),Rt(`${a} sent`)}},jr=t=>{let e=t.filter(n=>n.startsWith(Xs)).map(n=>n.split("\0"));return e.length&&Rt(e.length===1?`${e[0][1]} was not sent \u2014 ${e[0][2]}`:`${e.length} files were not sent: ${e.map(([,n,s])=>`${n} (${s})`).join(", ")}`,6e3),t.filter(n=>!n.startsWith(Xs))},Ln=async(t,e)=>{if(!navigator.onLine){Rt(`${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 s=(await e.clone().text().catch(()=>"")).trim();try{n=s.startsWith("{")?String(JSON.parse(s).error??""):s}catch{n=""}(n.length>160||n.startsWith("<"))&&(n="")}Rt(n?`${t}: ${n.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},su=t=>new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result)),n.readAsDataURL(t)}),ou=async t=>{let e=await createImageBitmap(t),n=Math.min(1,Xc/Math.max(e.width,e.height));if(n===1&&t.size<=Jc)return e.close(),su(t);let s=document.createElement("canvas");return s.width=Math.round(e.width*n),s.height=Math.round(e.height*n),s.getContext("2d").drawImage(e,0,0,s.width,s.height),e.close(),s.toDataURL("image/jpeg",.85)},Ba=async(t,e)=>{let n=[],s=(a,i)=>n.push(`${Xs}${a}\0${i}`);for(let a of t){let i,l=Wl(a.name)||Object.keys(As).find(d=>As[d]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){s(a.name,Ya.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>Qc){s(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>Zc&&_t.via){let u=`${Date.now()}-${Js.size}`;Js.set(u,a),n.push(`${sa}${u}\0${a.name}\0${a.size}`);continue}let d=await new Promise((u,g)=>{let w=new FileReader;w.onload=()=>u(String(w.result).split(",")[1]),w.onerror=g,w.readAsDataURL(a)}).catch(()=>"");d?n.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${jl(a.name)||"file"};ext=${l};base64,${d}`):s(a.name,"Could not be read");continue}try{i=await ou(a)}catch{s(a.name,"This picture could not be read");continue}if(i.length>Dr){s(a.name,"Too large even after shrinking");continue}n.push(i)}if(n.length){if(!Number(e?.dataset.id)){C&&((C.images??=[]).push(...n),J());return}Xt.push(...n),J(),ys(".dt-note-reply-input")}},Wr=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);U.addEventListener("paste",t=>{let e=Wr(t.clipboardData?.items);e.length&&(t.preventDefault(),Ba(e,t.target.closest(".dt-note")))}),U.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),U.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),U.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let n=Wr(t.dataTransfer?.items);n.length&&Ba(n,e)});let ys=t=>{let e=U.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},_r=()=>{ys(".dt-note-edit-input"),U.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Ra=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=ia-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},au=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),iu=()=>o.client||ie()||C?.shared||Q!=null&&Lt(j.find(t=>t.id===Q))?[]:Ao(),zr=t=>{let n=t.closest(".dt-compose").querySelector(".dt-mentions");n?.remove();let s=au(t);if(!s)return;let a=s[1].toLowerCase(),i=Q!=null?j.find(w=>w.id===Q):void 0,d=(o.client||ie()||C?.shared||i&&Lt(i)?o.team??[]:Ys()).filter(w=>w.email!==o.me?.email&&[w.name,w.nickname,w.email].some(N=>N?.toLowerCase().startsWith(a))).slice(0,5),u=iu().filter(w=>w.handle.toLowerCase().startsWith(a)||!!a&&"agent".startsWith(a)||!!a&&"claude".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(w=>`<button type="button" role="option" data-act="mention" data-handle="${f(Vl(w))}">${On(w.avatar_url,w.name||w.email)}<span class="dt-mention-who"><b>${f(w.name||w.email)}</b>${w.name?`<span>${f(w.email)}</span>`:""}</span></button>`),...u.map(w=>`<button type="button" role="option" data-act="mention" data-handle="${f(w.handle)}">${_d(w.owner)}<span class="dt-mention-who"><b>${f(w.handle)}</b><span>${w.owner?"Hands it to this agent":"The shared queue \u2014 any agent takes it"}</span></span></button>`)].map((w,N)=>w.replace('role="option"',`role="option" aria-selected="${N===0}"`)).join("")}</div>`);let g=t.nextElementSibling;n&&(g.style.animation="none"),g.getBoundingClientRect().top<8&&g.classList.add("is-below")},ru='<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>',lu='<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>',Gr=t=>{let e=[...(o.team??[]).flatMap(s=>[s.name,s.nickname,s.email]),...Ao().map(s=>s.handle)].filter(s=>!!s).sort((s,a)=>a.length-s.length).map(s=>f(s).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=e.length?new RegExp(`@(?:${e.join("|")})${Ja}`,"giu"):null;return Za(t).map(s=>typeof s!="string"?`<a class="dt-link" href="${f(s.url)}" target="_blank" rel="noopener noreferrer" title="${f(s.url)}">${s.kind==="pr"?ru:Ii}<span>${f(s.label)}</span>${lu}</a>`:n?f(s).replace(n,a=>`<span class="dt-at">${a}</span>`):f(s)).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 s=n.querySelectorAll("a.dt-link");if(s.length){for(let a of s)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",n.textContent??""),t.preventDefault()}});let Vr=(t,e)=>{let n=t.selectionStart??t.value.length,s=t.value.slice(0,n).lastIndexOf("@");t.value=`${t.value.slice(0,s)}@${e} ${t.value.slice(n)}`,t.selectionStart=t.selectionEnd=s+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},du=(t,e)=>{if(!t){C&&(C.category=e),J();return}Re(n=>n.map(s=>s.id===t?{...s,category:e}:s),()=>V({id:t,category:e}),"Changing the type")};hd([U,at],f,be),at.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&zs(Number(e.dataset.id),e.value)}),at.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),Si(Number(e.dataset.id)))},!0);let cu=t=>Lt(t)?"studio":"clients",Ur=async(t,e=!1)=>{let n=j.find(i=>i.id===t);if(!n||Lt(n)&&n.client)return;let s=!Lt(n);Q===t&&(Q=null);let a=s&&Tt(n.assignee)?{assignee:null,stage:"new"}:{};await Re(i=>i.map(l=>l.id===t?{...l,...a.stage?{assignee:void 0,stage:"new"}:{},shared:s||void 0,client:s?l.client:void 0}:l),()=>V(s?{id:t,shared:s,...a}:{id:t,shared:!1,client:!1}),s?"Moving it to clients":"Moving it to the workspace"),ro(pt),e||nn(s?"Moved to clients":"Moved to the workspace",()=>Ur(t,!0))},uu=async t=>{let e=j.find(d=>d.id===t);if(!e)return;let n=e,s={text:e.text,from:{id:e.id},...Lt(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&&(s[d]=n[d]);let a=await Wn(zt("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s)})).catch(()=>null);if(!a?.ok){Ln("The copy was not made",a);return}let i=xn([await a.json().catch(()=>null)])[0];i&&(pt=[...pt,i],j=pt.filter(d=>d.route===wt)),ro(pt),J(),Ge();let l=cu(e);nn(l==="clients"?"Duplicated for the client":"Duplicated to the workspace",()=>{i&&(hs(l),us(i.id))},"Open")},pu=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(()=>Rt("Link copied"),()=>Rt(n,6e3))};U.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"?uu(u):d==="move"?Ur(u):d==="link"?pu(u):d==="reopen"?en(u,!1):d==="rm"?(Q=null,ca(u)):d==="discard"&&(C=null,J());return}let n=t.target.closest(".dt-lang-select");if(n){zi(Number(n.dataset.id),n.dataset.at,n.value);return}let s=t.target.closest(".dt-cat-select");if(s){du(Number(s.dataset.id)||0,s.value);return}let a=t.target.closest(".dt-status-select");if(a){Yd(Number(a.dataset.id),a.value);return}let i=t.target.closest(".dt-owner-select");if(i){Id(Number(i.dataset.id)||0,i.value);return}let l=t.target.closest(".dt-for-select");if(l){if(ot.setItem("nm-for",l.value),o.client){C&&(C.assignee=l.value,Gs(l.value),J());return}Yo(Number(l.dataset.id)||0,"person")}}),U.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&C?.suggest){C.suggest.to=e.value,In(),Ra(e);return}let n=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");n&&(zr(n),n.classList.contains("dt-note-input")?C&&(C.text=n.value):n.classList.contains("dt-note-edit-input")?Ot&&(Ot.text=n.value):oe=n.value,In(),n.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",n.value.trim()!==""),Ra(n))}),U.addEventListener("keydown",t=>{if(t.key==="Escape"&&U.querySelector(".dt-emoji")){t.stopPropagation();let a=tn?.box??tn?.btn;Qs(),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()&&zr(e);let s=n();if(s&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),Vr(e,s.dataset.handle);return}if(s&&t.key==="Escape"){t.stopPropagation(),s.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let Et=null,go=!1;function Pa(t){return!o.client||!!o.me&&t.by===o.me.email}let Kr=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},Ia=Kr("dt-drag-box--home"),Yr=Kr("dt-drag-box--to"),Xr=()=>{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)};Xr(),addEventListener("resize",Xr);let Oa=t=>{let e=Zt(Qt(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Jr=(t,e,n="")=>{if(!e){t.hidden=!0;return}let s=e.getBoundingClientRect();t.style.cssText=`left:${s.left}px;top:${s.top}px;width:${s.width}px;height:${s.height}px`,t.querySelector("span").textContent=n,t.hidden=!1},hu=(t,e)=>document.elementsFromPoint(t,e).find(n=>!n.closest(ce)&&!n.closest(".dt-drag-box")&&n!==document.documentElement&&n!==document.body)??null,mu=(t,e,n)=>{let s=t.getBoundingClientRect();return e>=s.left&&e<=s.right&&n>=s.top&&n<=s.bottom},gu=(t,e,n)=>{let s=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),i=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:ui(t),tag:a,classes:i,nth:pi({tag:a,classes:i}).indexOf(t),label:Do(t.textContent||"",60),ctx:hi(t),rx:s.width?Math.min(1,Math.max(0,(e-s.left)/s.width)):.5,ry:s.height?Math.min(1,Math.max(0,(n-s.top)/s.height)):.5}},Da=()=>{Et&&(Et.pin.classList.remove("is-dragging"),Kt.toggle("dt-dragging",!1),Ia.hidden=Yr.hidden=!0,Et=null,ke())};U.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let n=j.find(s=>s.id===Number(e.dataset.id));!n||!Pa(n)||(Et={id:n.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:Be(n),to:null},e.setPointerCapture(t.pointerId))}),U.addEventListener("pointermove",t=>{if(!Et||!Et.on&&Math.hypot(t.clientX-Et.x0,t.clientY-Et.y0)<4)return;Et.on=!0,Et.pin.classList.add("is-dragging"),Kt.toggle("dt-dragging",!0),Et.pin.style.left=`${t.clientX}px`,Et.pin.style.top=`${t.clientY}px`,Et.to=Et.home&&mu(Et.home,t.clientX,t.clientY)?Et.home:hu(t.clientX,t.clientY);let e=Et.to&&Et.to!==Et.home;Jr(Ia,Et.home,e?"":Et.home?Oa(Et.home):""),Ia.classList.toggle("is-left",!!e),Jr(Yr,e?Et.to:null,e?`Move to ${Oa(Et.to)}`:"")}),U.addEventListener("pointerup",async t=>{if(!Et)return;let e=Et;if(!e.on||!e.to){Da();return}go=!0,setTimeout(()=>{go=!1},0);let n=j.find(d=>d.id===e.id),s=gu(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(Da(),!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)=>Re(g=>g.map(w=>w.id===e.id?{...w,...d}:w),()=>V({id:e.id,move:d}),u);await l(s,"Moving the pin"),a&&nn(`Moved to ${Oa(e.to)}`,()=>l(i,"Putting the pin back"))}),U.addEventListener("click",t=>{go&&(t.stopImmediatePropagation(),t.preventDefault(),go=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&Et?.on&&(t.stopImmediatePropagation(),Da())},!0),U.addEventListener("click",async t=>{let e=t.target.closest("button"),n=tn?.btn;if(e?.closest(".dt-emoji")||Qs(),!e)return;let s=e.dataset.act,a=Number(e.dataset.id);if(s==="react"){Ui(a,e.dataset.at||null,e.dataset.emoji);return}if(s==="react-pick"||s==="emoji-pick"){n!==e&&Vi(e,!1,s==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(s==="emoji-more"&&tn){let i=tn;Vi(i.btn,!0,i);return}if(s==="emoji"&&tn){let i=tn;Qs(),i.box?Mc(i.box,e.dataset.emoji):i.id&&Ui(i.id,i.at||null,e.dataset.emoji);return}if(s==="prio"){let i=e.dataset.v||null;a?Re(l=>l.map(d=>d.id===a?{...d,priority:i??void 0}:d),()=>V({id:a,priority:i}),"Setting the priority"):C&&(C.priority=i??void 0,In(),J());return}if(s==="mention"){let i=e.closest(".dt-compose")?.querySelector("textarea");i&&Vr(i,e.dataset.handle);return}if(!s){if(C&&!ns())return;if(Q=Q===a?null:a,Q!=null&&e.dataset.off){let i=j.find(d=>d.id===a);(i&&Be(i))?.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}),un=!0}He(),J(),un&&oo();return}if(s==="speak"){gc(e.closest(".dt-note"),e);return}if(s==="voice-write"){bc(e);return}if(s==="voice"||s==="voice-seek"){nc(e,s==="voice-seek"?t:null);return}if(s==="attach"||s==="attach-file"){let i=Object.assign(document.createElement("input"),{type:"file",accept:s==="attach"?"image/*":"",multiple:!0}),l=e.closest(".dt-note");i.addEventListener("change",()=>{i.files?.length&&Ba([...i.files],l)}),i.click();return}if(s==="unshot"){a?Ot&&Ot.drop.push(e.dataset.img):(e.closest("[data-draft]")?C?.images??[]:Xt).splice(Number(e.dataset.i),1),J(),Ot&&_r();return}if(s==="edit"){let i=j.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;Ot={id:a,at:l,text:d,drop:[]},J(),_r();return}if(s==="edit-cancel"){Ot=null,J();return}if(s==="translate"){zi(a,e.dataset.at);return}if(s==="unsay"){let i=e.dataset.at;Hc(a,i);return}if(s==="edit-save"){let i=Ot;if(!i)return;let l=i.text.trim();if(!l){U.querySelector(".dt-note-edit-input")?.focus();return}Ot=null;let d=u=>i.drop.includes(u.split("/").pop());await Re(u=>u.map(g=>g.id!==i.id?g:{...g,...i.at==null?{text:l}:{replies:(g.replies??[]).map(w=>w.at===i.at?{...w,text:l}:w)},images:(g.images??[]).filter(w=>!d(w))}),()=>V({id:i.id,edit:{at:i.at,text:l},...i.drop.length?{removeImage:i.drop}:{}}).then(u=>(u.ok||(Ot=i),u),u=>{throw Ot=i,u}),"Saving the edit");return}if(s==="cancel"){ns()&&(He(),J());return}if(s==="twin"){if(!ns())return;He(),Q=Number(e.dataset.id),J();return}if(s==="discard"){C=null,J();return}if(s==="draft-open"){ga(Number(e.dataset.i));return}if(s==="close"){Q=null,J();return}if(s==="where"){let i=j.find(G=>G.id===Number(e.dataset.id)),l=i&&ae(i),d=l?.hidden;if(!d)return;let u=G=>{let p=G.getBoundingClientRect();return(p.width||p.height)&&G.checkVisibility?.()!==!1?p:null},g=l.shut instanceof HTMLElement?l.shut:null,w=g&&u(g);if(g&&!w){let G=g.getAttribute("style");g.setAttribute("style",`${G??""};display:block!important`),w=u(g),G==null?g.removeAttribute("style"):g.setAttribute("style",G)}w??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let N=document.createElement("div");N.className="dt-where",N.style.cssText=`left:${w.left}px;top:${w.top}px;width:${w.width}px;height:${w.height}px`,document.body.append(N),N.animate([{opacity:0},{opacity:1,offset:.15},{opacity:1,offset:.75},{opacity:0}],1600).finished.finally(()=>N.remove());return}if(s==="unsuggest"&&C){C.suggest=null,J();return}if(s==="save"){if(!C)return;C.images&&(C.images=jr(C.images));let i=(C.images??[]).filter(z=>!jn(z)),l=C.suggest&&C.suggest.to.trim()!==C.suggest.from?{from:C.suggest.from,to:C.suggest.to.trim()}:null,d=U.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(C.images?.some(Qo)?_i:C.images?.some(z=>jn(z)&&!Hs(z))?"See the attached image":C.images?.length?"See the attached file":"");if(!d){U.querySelector(".dt-note-input")?.focus();return}let u=C,g=o.client||u.shared===!0?null:Qa(d,as()),w=qr.get(u)??Na(Be(u)),N={...u,images:u.images?.filter(jn),route:wt,text:d,suggest:l,assignee:o.client?Di(u.assignee)||void 0:g??(u.assignee||void 0),shared:o.client?!0:u.shared===!0,stage:o.client?"new":g?"approved":u.stage??(Tt(u.assignee)?"approved":"new"),breakpoint:Go(),browser:Hd(),device:x?Zr:"",viewport:{w:innerWidth,h:innerHeight},logs:rd(),host:location.host},G={...u,id:-Date.now(),text:d,route:wt,status:"open",note:"",doneBy:null,breakpoint:N.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:o.me?.email,byName:o.me?.name};j=[...j,G],C=null,J();let p=await Wn(zt("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(N)})).catch(()=>null);if(!p?.ok){j=j.filter(z=>z!==G),He(),C=u,J(),Ln("Thread was not saved",p);return}let Y=xn([await p.json().catch(()=>null)])[0];j=j.map(z=>z===G&&Y?Y:z),J(),Y&&w.then(z=>{z&&V({id:Y.id,before:z.url,box:z.box})}),Y&&i.length&&Fr(Y.id,i),Ge();return}if(s==="reply"){let i=U.querySelector(".dt-note-reply-input");Xt=jr(Xt);let l=i.value.trim()||(Xt.some(Qo)?_i:Xt.some(z=>jn(z)&&!Hs(z))?"See the attached image":Xt.length?"See the attached file":"");if(!l){i.focus();return}let d=Xt;oe=l,De=a,ss(),oe="",Xt=[],i.value="";let u=j,g=j.find(z=>z.id===a),w=o.client||Lt(g)?null:Qa(l,as()),N=w&&g&&(w!==g.assignee||fe(g)!=="approved"||g.status==="done")?{assignee:w,stage:"approved",...g.status==="done"?{status:"open",doneBy:null}:{}}:{};j=j.map(z=>z.id===a?{...z,...N,replies:[...z.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:o.me?.email}]}:z),Os=a,J();let G=await Wn(V({id:a,reply:l,images:d.filter(jn),...N})).catch(()=>null);if(!G?.ok){j=u,oe=l,Xt=d,J();let z=U.querySelector(".dt-note-reply-input");z&&!z.value&&(z.value=l);let xt=()=>U.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?nn(`Reply was not sent${G?` (${G.status})`:""} \u2014 it is back in the box`,xt,"Retry"):Ln("Reply was not sent",G);return}ss();let p=xn([await G.json().catch(()=>null)])[0];p&&(j=j.map(z=>z.id===p.id?p:z),J()),Ge();let Y=d.filter(z=>!jn(z));Y.length&&Fr(a,Y);return}if(s==="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 $e[a],e.remove();return}if(s==="hand"){Yo(a,e.dataset.v);return}if(s==="claude"){Si(a);return}if(s==="sendback"){await en(a,!1),ys(".dt-note-reply-input");return}if(s==="accept"){await en(a,!0);return}if(s==="archive"||s==="unarchive"){s==="archive"&&!e.classList.contains("dt-step-act")&&(Q=null),await wn(a,s==="archive");return}e.classList.contains("dt-step-act")||(Q=null),s==="rm"?await ca(a):await en(a,s==="done")});let Zr="",ge=t=>{dt.hidden||ue.contentWindow?.postMessage({dt:!0,...t},location.origin)},fu=()=>({notes:Bt,grid:!T.hidden,inspect:v,resolved:xe,archived:Fe,...Qr.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(x&&e.projectGrid!==void 0){F=e.projectGrid,T.hidden||At();return}if(!x&&t.source===ue.contentWindow){if(e.key){Ml(e.key[0],e.key[1])?.run();return}if(e.closeMenus){ye();return}if(e.route){$t();return}if(e.drafts){la=e.drafts,$n(Ne());return}}if(x&&typeof e.openDraft=="number"){ga(e.openDraft);return}if(x&&typeof e.dropDraft=="number"){mr(e.dropDraft);return}if(x&&typeof e.device=="string"&&(Zr=e.device),x&&e.scrollbar&&Kt.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===ue.contentWindow){ge(fu());return}typeof e.notes=="boolean"&&e.notes!==Bt&&Le(e.notes,!1),typeof e.open=="number"&&us(e.open),typeof e.grid=="boolean"&&e.grid===T.hidden&&Wt(e.grid),typeof e.inspect=="string"&&e.inspect!==v&&Ft(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==xe&&ba(e.resolved),typeof e.archived=="boolean"&&e.archived!==Fe&&va(e.archived),e.reload&&Mn()});let Ge=async()=>{await Mn(),ge({reload:!0}),x&&parent.postMessage({dt:!0,reload:!0},location.origin)},Le=(t,e=!0)=>{if(Bt=t,kt.setAttribute("aria-pressed",String(t)),t?!x&&at.hidden&&ot.getItem("dt-history")==="1"&&(at.hidden=!1,Gt.setAttribute("aria-pressed","true")):(at.hidden=!0,at.replaceChildren(),Gt.setAttribute("aria-pressed","false")),q(ai,t?"1":"0"),ge({notes:t}),x&&e&&parent.postMessage({dt:!0,notes:t},location.origin),U.hidden=!t||!dt.hidden,Kt.toggle("dt-noting",t),t&&!x?vr():document.querySelector(".dt-room")?.remove(),t){Ft(""),document.addEventListener("click",Or,!0);for(let n of Br)document.addEventListener(n,Pr,!0);document.addEventListener("contextmenu",Ir,!0),document.addEventListener("keydown",Nr),document.addEventListener("mousemove",Ha),addEventListener("scroll",ke,!0),addEventListener("scroll",mo,!0),addEventListener("scroll",oo,!0),addEventListener("resize",ke),addEventListener("resize",mo),addEventListener("pointerover",$r,!0),mi(),yr.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),wr.observe(document.body),Ta()}else{He(),Q=null,document.removeEventListener("click",Or,!0);for(let n of Br)document.removeEventListener(n,Pr,!0);document.removeEventListener("contextmenu",Ir,!0),document.removeEventListener("keydown",Nr),document.removeEventListener("mousemove",Ha),k.hidden=!0,removeEventListener("scroll",ke,!0),removeEventListener("scroll",mo,!0),removeEventListener("scroll",oo,!0),removeEventListener("resize",ke),removeEventListener("resize",mo),removeEventListener("pointerover",$r,!0),yr.disconnect(),wr.disconnect(),U.innerHTML=""}},{pickBp:qa,...Qr}=fd({cfg:o,inFrame:x,persist:q,frame:dt,frameEl:ue,devicesMenu:Ie,bpBtns:Nt,notesOverlay:U,WIDE:y,bpOf:L,currentBp:Go,deviceById:E,notesOn:()=>Bt,filter:()=>_o,filterTo:t=>{_o=t},dropFrameDrafts:()=>{la=[]},putAway:()=>{Q=null,He()},tellFrame:ge,syncBpButtons:ci,render:()=>J(),reread:()=>{Bt?Ta():J()}}),tl="dt-studio",el=t=>{on.setAttribute("aria-pressed",String(t)),Kt.toggle("dt-no-studio",!t),q(tl,t?"1":"0")};on.addEventListener("click",()=>el(on.getAttribute("aria-pressed")!=="true")),el(ot.getItem(tl)!=="0"),kt.addEventListener("click",()=>Le(!Bt));let Vt=document.querySelector(".devtools"),Kn=document.querySelector(".dt-tab"),nl=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-Vt.getBoundingClientRect().top)+12}px`);new ResizeObserver(nl).observe(Vt),addEventListener("resize",nl);let bu=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),sl=()=>{Vt.removeAttribute("data-tight");let t=Vt.getBoundingClientRect().right,e=bu(),n=!1;for(let s of Vt.children){let a=s.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)}Vt.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||n)},ol=0,Fa=()=>{cancelAnimationFrame(ol),ol=requestAnimationFrame(sl)},vu=new ResizeObserver(Fa);for(let t of Vt.children)vu.observe(t);addEventListener("resize",Fa),sl();for(let t of[1500,4e3])setTimeout(Fa,t);for(let t of ft)t.addEventListener("toggle",()=>{let e=t.querySelector(":scope > :not(summary)");if(!e||(e.style.translate="",!t.open||at.hidden))return;let n=e.getBoundingClientRect(),s=at.getBoundingClientRect();s.width&&n.right>s.left-8&&n.bottom>s.top&&n.top<s.bottom&&(e.style.translate=`${Math.round(s.left-8-n.right)}px 0`)});let al=t=>{Vt.toggleAttribute("data-collapsed",t),Kn.toggleAttribute("data-collapsed",t),Kn.setAttribute("aria-expanded",String(!t)),Kn.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),Vt.inert=t,t&&ye(),t&&Jn&&bo(""),t&&Bt&&Le(!1),q("dt-collapsed",t?"1":"0")};Kn.addEventListener("click",()=>al(!Vt.hasAttribute("data-collapsed")));let Se=document.querySelector(".dt-keys"),il=Se.querySelector(".dt-set-keys"),yu=Se.querySelector(".dt-set-main"),ws=Se.querySelector(".dt-set-grid"),rl=Se.querySelector('[data-set="grid"] .dt-set-hint'),$s=t=>{if(yu.hidden=t!=="main",il.hidden=t!=="keys",ws.hidden=t!=="grid",t==="grid"&&Eu(),rl){let e=ht();rl.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},ja=t=>$s(t?"keys":"main"),Wa={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}},xs={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},wu=["cols","gutter","margin","max"],fo=(t,e)=>Math.min(xs[t][1],Math.max(xs[t][0],Math.round(e))),$u=()=>({...Wa,...F?.widths}),_a=()=>!!o.project&&!!o.gridAdmin,ll=()=>!T.hidden&&!ht()&<?lt:ve(),xu=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},Eu=()=>{let t=_a(),e=$u(),n=nt(),s=ht(),a=h.find(u=>u.id===n),i=(u,g)=>`<div class="dt-grid-row"><span>${u}</span><b>${g}</b></div>`,l=(_t.cabinet||o.cabinet)&&o.project?` <a href="${f(`${_t.cabinet||o.cabinet}/p/${o.project}?tab=settings`)}" target="_blank" rel="noopener">Also in the cabinet \u203A</a>`:"",d;if(s)d=`<p class="dt-grid-band">${f(a.label.toUpperCase())} \xB7 ${a.ideal} \u2014 this width</p>
|
|
308
|
+
<div class="dt-grid-fields">${wu.map(u=>`<label><span>${u==="cols"?"Cols":u[0].toUpperCase()+u.slice(1)}</span>
|
|
309
|
+
<input type="number" inputmode="numeric" step="1" min="${xs[u][0]}" max="${xs[u][1]}" data-grid-k="${u}" value="${s[u]??""}"${u==="max"?' placeholder="\u2014"':""}${t?"":" disabled"}></label>`).join("")}</div><hr>
|
|
310
|
+
${h.filter(u=>u.id!==n&&e[u.id]).map(u=>i(`${f(xu(u.label))} \xB7 ${u.ideal}`,`${e[u.id].cols} \xB7 ${e[u.id].gutter} \xB7 ${e[u.id].margin}`)).join("")}<hr>
|
|
311
|
+
<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=ll();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">${o.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>`}ws.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${Io}<span>Grid</span></button><hr>`+(o.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"==!!s}"${t?"":" disabled"}>${u==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},dl=async(t,e)=>{let n=F,s=u=>{u&&!ws.hidden&&$s("grid"),T.hidden||At(),ge({projectGrid:F})};F=t(F),s(e);let a=await zt("config").then(u=>u.ok?u.json():null).catch(()=>null),i=t(a?a.projectGrid??null:n),l=await zt("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:i})}).catch(()=>null);if(l?.ok){F=(await l.json()).grid??null;return}let d=l?await l.text():"";Rt(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),F=n,s(!0)};if(ws.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!_a()||e==="custom"==!!ht())return;let n=nt(),s=e==="custom"?ll():null,a=document.documentElement.clientWidth,i=s&&{cols:fo("cols",s.cols),gutter:fo("gutter",s.gap),margin:fo("margin",s.x),max:Math.abs(a-2*s.x-s.w)<=2?null:fo("max",s.w)};dl(l=>({mode:e,widths:{...Wa,...l?.widths,...i?{[n]:i}:{}}}),!0)}),ws.addEventListener("change",t=>{let e=t.target,n=e.dataset.gridK,s=ht();if(!n||!s||!_a())return;let a=e.value.trim()===""?null:Number(e.value),[i,l]=xs[n];if(a===null?n!=="max":!Number.isInteger(a)||a<i||a>l){Rt(`${n==="cols"?"Cols":n[0].toUpperCase()+n.slice(1)} is ${i}\u2013${l}${n==="max"?" or empty":""}.`),e.value=String(s[n]??"");return}if(a===s[n])return;let d=nt();dl(u=>({mode:"custom",widths:{...Wa,...u?.widths,[d]:{...u?.widths?.[d]??s,[n]:a}}}),!1)}),P.querySelector("button").addEventListener("click",()=>{ye(),Se.open=!0,$s("grid")}),$s("main"),_t.signOut)for(let t of Se.querySelectorAll('[data-set="out"], [data-set-out]'))t.hidden=!1;Se.querySelector("summary").addEventListener("click",()=>ja(!1));let pn=Vt.querySelector(".dt-vision"),Yn=pn.querySelector(".dt-vision-sheet"),Es=[{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">${Es.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 cl=document.createElement("style");document.head.append(cl);let Xn=document.createElement("div");Xn.className="dt-seeing",Xn.hidden=!0,Vt.append(Xn);let Jn="",bo=t=>{Jn=t;let e=Es.find(n=>n.id===t)??Es[0];cl.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",pn.toggleAttribute("data-on",!!t),Xn.hidden=!t,Xn.innerHTML=t?`${gt('<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">${gt('<path d="M5 5l10 10M15 5 5 15" />',12)}</button>`:""};Xn.addEventListener("click",t=>{t.target.closest("button")&&bo("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!Jn||t.defaultPrevented||kl(t.target)||(bo(""),t.preventDefault())});let vo=null,za=0,Ga=0,ul=()=>{let t=Math.round((Date.now()-za)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},pl=t=>{if(t==="none"){Yn.className="dt-sheet dt-vision-sheet dt-vision-list",Yn.innerHTML='<p class="dt-vision-title">See the page as</p>'+Es.map(n=>`<button type="button" data-vision="${n.id}" aria-pressed="${n.id===Jn}"><span>${n.name}</span>${n.id===Jn?gt('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${n.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;Yn.className="dt-sheet dt-vision-sheet",Yn.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 ${ul()}`}</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">${gt('<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">${Es.map(n=>`<button type="button" data-vision="${n.id}" aria-pressed="${n.id===Jn}"><span class="dt-vision-thumb">${vo&&t==="ready"?`<img src="${vo}" alt="" style="filter:${n.id==="low"?`blur(${(2.5*e*2).toFixed(2)}px)`:n.css}">`:""}</span><span>${n.name}</span></button>`).join("")}</div>`},Va=async()=>{let t=++Ga;pl("taking");let e=[document.body,document.documentElement].map(s=>getComputedStyle(s).backgroundColor).find(s=>s&&s!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(s))??"#fff",n=null;try{let{domToWebp:s}=await import("modern-screenshot");n=await Promise.race([s(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(`${an}, .dt-pad-overlay, .dt-grid-overlay, .dt-vision-defs, .dt-toast`))}),new Promise(a=>setTimeout(()=>a(null),4e3))])}catch{n=null}t!==Ga||!pn.open||(vo=n,za=Date.now(),pl(n?"ready":"none"))},hl=0,ml=0,gl=()=>{clearTimeout(ml),ml=window.setTimeout(Va,400)};pn.addEventListener("toggle",()=>{if(clearInterval(hl),removeEventListener("scroll",gl,!0),!pn.open){Ga++;return}Va(),addEventListener("scroll",gl,!0),hl=window.setInterval(()=>{let t=Yn.querySelector(".dt-vision-ago");t&&vo&&za&&(t.textContent=`snapshot \xB7 ${ul()}`)},1e3)}),Yn.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void Va();let n=e.closest("[data-vision]");n&&(bo(n.dataset.vision??""),pn.open=!1)});let Ms=Vt.querySelector(".dt-custom"),yo=Ms.querySelector(".dt-custom-sheet"),fl="dt-hidden-tools",bl="dt-new-seen",vl=["contrast","vision"],yl=()=>{let t=(s,a,i)=>{let l=Vt.querySelector(a);return l?{id:s,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=[...Nt.map(s=>({id:`bp:${s.dataset.bp}`,el:s,name:(s.getAttribute("aria-label")??s.dataset.bp??"").replace(/^mobile\s+(\w)/i,(a,i)=>i.toUpperCase())})),{id:"devices",el:Ie,name:"Device menu"}];return[...o.client?[]:[{group:"Inspect",tools:e.filter(s=>!!s)}],{group:"Devices",tools:n}]},wl=t=>(ot.getItem(t)??"").split(",").filter(Boolean),hn=new Set(wl(fl)),$l=()=>{for(let{tools:e}of yl())for(let n of e)n.el.toggleAttribute("data-off",hn.has(n.id));Object.entries(we).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&Ft("")},Mu=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",xl=()=>{let t=wl(bl);yo.innerHTML=yl().map(({group:e,tools:n})=>{let s=n.filter(a=>!hn.has(a.id)).length;return`<p class="dt-custom-label"><b>${e}</b><span>${s} of ${n.length}</span></p><div class="dt-custom-well">${n.map(a=>`<button type="button" class="dt-custom-tile" data-tool="${f(a.id)}" aria-pressed="${!hn.has(a.id)}">${Mu(a.el)}<span>${f(a.name)}</span>${vl.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"${hn.size?"":" disabled"}>Show all</button><span></span><button type="button" class="dt-custom-done">Done</button></div>`};yo.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){Ms.open=!1;return}e.closest(".dt-custom-all")&&hn.clear();let n=e.closest("[data-tool]");if(n){let s=n.dataset.tool;hn.delete(s)||hn.add(s)}!n&&!e.closest(".dt-custom-all")||(q(fl,[...hn].join(",")),$l(),xl(),yo.querySelector(n?`[data-tool="${n.dataset.tool}"]`:".dt-custom-done")?.focus())}),Ms.addEventListener("toggle",()=>{Ms.open?(xl(),yo.querySelector(".dt-custom-tile")?.focus()):q(bl,vl.join(","))}),$l(),Se.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let n=e.dataset.set;if(n==="keys"||n==="back")return ja(n==="keys");if(n==="grid")return $s("grid");Se.open=!1,n==="custom"&&(Ms.open=!0),n==="hide"&&Kn.click(),n==="out"&&confirm("Sign out of Notemend on this site?")&&(ot.removeItem(Un),_t.signOut?.())});let Te=t=>()=>Vt.querySelector(t)?.click(),El=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(n=>n.hasAttribute("aria-current"))+t]?.click()},wo=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:Te(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:Te(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:Te(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>va(!Fe)},{group:"Threads",code:"Slash",hint:"/",label:"Search threads",run:()=>{document.querySelector(".dt-history")?.hasAttribute("hidden")&&Te(".dt-history-btn")(),at.hasAttribute("data-collapsed")&&ao(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Workspace / clients",run:()=>hs(qe==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Gn.hidden||ms(Pe.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:Te(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:Te(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:Te(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:Te(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:Te(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:Te(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{pn.open=!pn.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:Te(".dt-border-btn")},...o.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:Te(".dt-studio-btn")}]:[],...Nt.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:()=>{Ie.open=!Ie.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:El(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:El(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>Kn.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=Se.open&&!il.hidden;Se.open=!t,ja(!t)}}].filter(t=>!o.client||t.group!=="Inspect"),Ml=(t,e)=>wo.find(n=>n.code===t&&!n.shift==!e&&!(n.el&&Vt.querySelector(n.el)?.closest("[data-off]"))&&!(n.code==="KeyD"&&Ie.hasAttribute("data-off"))),kl=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(o.shortcuts){for(let s of wo){let a=s.el&&Vt.querySelector(s.el);a&&(a.dataset.tip=`${a.dataset.tip??s.label} \xB7 ${s.hint}`,a.setAttribute("aria-keyshortcuts",s.hint.startsWith("\u21E7")?`Shift+${s.hint.slice(1)}`:s.hint))}let t=(s,a)=>`<div class="dt-key-row"><span>${f(s)}</span><kbd>${f(a)}</kbd></div>`,e=(s,a)=>`<div class="dt-keys-col"><p class="dt-keys-group">${s}</p>${a}</div>`,n=[...new Set(wo.map(s=>s.group))].map(s=>e(s,wo.filter(a=>a.group===s).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"))),Se.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",s=>{if(s.repeat||s.isComposing||s.metaKey||s.ctrlKey||s.altKey||s.defaultPrevented||kl(s.composedPath()[0]??s.target))return;let a=Ml(s.code,s.shiftKey);a&&setTimeout(()=>{s.defaultPrevented||(x?parent.postMessage({dt:!0,key:[s.code,s.shiftKey]},location.origin):a.run())})}),x){let s=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",s,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&s()})}}if(!x){al(ot.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>Vt.setAttribute("data-ready",""))),Qr.restore(),Wt(ot.getItem(tt)==="1");let t=ot.getItem(Ye);t&&t in we&&Ft(t),Le(ot.getItem(ai)==="1"&&wt!=="/connect")}let Ll=()=>{try{let t=JSON.parse(ot.getItem(Pn)||"null");pe=(t?.parked??[]).filter(n=>es(n));let e=n=>{try{return!!document.querySelector(n)}catch{return!1}};t?.draft&&e(t.draft.selector)?(C=t.draft,!Bt&&!x&&Le(!0)):es(t?.draft)&&pe.push(t.draft),t?.reply?.text&&(oe=t.reply.text,De=Q=t.reply.for??null),(C||pe.length||oe)&&J()}catch{ot.removeItem(Pn)}};Ll();let Sl=()=>setTimeout(()=>{let t=Z(location.pathname);t!==wt&&(clearTimeout(qs),ss(),wt=t,x&&parent.postMessage({dt:!0,route:t},location.origin),Pn=li(),C=null,pe=[],oe="",De=null,Q=null,Ot=null,j=[],Bt&&!x&&Le(!1),$t(),Ll(),Ta(),Mn())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...n){e.apply(this,n),Sl()}}addEventListener("popstate",Sl);try{let t=JSON.parse(ot.getItem(Un)||"null");t?.project===Ar&&t.body?(La=t.body.version??"",Sa(t.body),bs=""):t&&ot.removeItem(Un)}catch{ot.removeItem(Un)}r.then(async t=>{t.status===200&&Sa(await t.json(),!c)},()=>{}).then(()=>!c&&(xe||Fe)?Mn(!0):void 0).then(io.resume),document.addEventListener("visibilitychange",()=>{document.hidden||kn()}),addEventListener("focus",kn),addEventListener("notemend:changed",()=>{x||kn()});let $o=!1,Sn=null,Tl=()=>{if(!(x||_t.via||!("EventSource"in window))){if(document.hidden){Sn?.close(),Sn=null,$o=!1;return}Sn||(Sn=new EventSource("/__devbar/events"),Sn.onopen=()=>{$o=!0},Sn.onerror=()=>{$o=!1},Sn.onmessage=t=>{t.data!==bs&&kn()})}};Tl(),document.addEventListener("visibilitychange",Tl);let ku=0;x||setInterval(()=>{(!(_t.live||$o)||++ku%6===0)&&kn()},2e4),setInterval(()=>{!document.hidden&&j.some(t=>Ke(t))&&J()},3e4),x&&parent.postMessage({dt:!0,hello:!0},location.origin)}function Md(o){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let r=HTMLDialogElement.prototype,c=r.showModal,h=null,m=null,y=()=>{if(h){m?.disconnect(),m=null;for(let $ of o)document.body.append($);try{h.hidePopover()}catch{}h.remove(),h=null}},L=()=>{y();let $=document.querySelector("dialog:modal");$&&H($)},H=$=>{y(),h=document.createElement("div"),h.className="dt-host",h.setAttribute("popover","manual"),h.append(...o),$.append(h);try{h.showPopover()}catch{}$.addEventListener("close",L,{once:!0}),m=new MutationObserver(()=>{$.isConnected||L()}),m.observe(document.documentElement,{childList:!0,subtree:!0})};r.showModal=function(){c.call(this),this.isConnected&&H(this)}}var lp=".devtools, [class^='dt-'], [class*=' dt-']";function kd(){let o=document.createElement("div");o.className="dt-tipbox",o.setAttribute("role","tooltip"),o.id="dt-tipbox",o.hidden=!0,document.body.append(o);let r=null,c,h=0,m=E=>{let x=E.getAttribute("title");x!==null&&(E.removeAttribute("title"),E.hasAttribute("data-tip")||E.setAttribute("data-tip",x),!E.hasAttribute("aria-label")&&!E.textContent?.trim()&&E.setAttribute("aria-label",x))},y=E=>{let x=E?.closest?.("[data-tip], [title]");return x&&x.closest(lp)&&!x.closest(".dt-tipbox")?x:null},L=E=>{let x=E.getAttribute("data-tip");if(!x||E.getAttribute("aria-expanded")==="true")return H();o.textContent=x,o.hidden=!1;let q=E.getBoundingClientRect(),_=o.getBoundingClientRect(),D=6,V=8,Z=q.bottom+D+_.height<=innerHeight-V;o.style.top=`${Z?q.bottom+D:Math.max(V,q.top-D-_.height)}px`,o.style.left=`${Math.min(Math.max(V,q.left+q.width/2-_.width/2),innerWidth-V-_.width)}px`,o.classList.toggle("is-mono",E.classList.contains("dt-note-el")),E.setAttribute("aria-describedby",o.id)},H=()=>{clearTimeout(c),r&&!o.hidden&&(h=performance.now()+400),r?.removeAttribute("aria-describedby"),r=null,o.hidden=!0},$=E=>{E!==r&&(H(),m(E),r=E,performance.now()<h?L(E):c=setTimeout(()=>r===E&&L(E),300))};document.addEventListener("pointerover",E=>{let x=y(E.target);x?$(x):r&&!r.contains(E.target)&&H()},!0),document.addEventListener("pointerout",E=>{r&&!r.contains(E.relatedTarget)&&H()},!0),document.addEventListener("focusin",E=>{let x=E.target,q=y(x);q&&x.matches(":focus-visible")&&$(q)},!0),document.addEventListener("focusout",H,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("keydown",E=>{E.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"]})}function Ld(o){let r=window;if(r.__notemend)return;r.__notemend=!0,id(m=>m.includes("/__devbar/")||!!_t.base&&m.startsWith(_t.base)),Kt.ready=new Promise(m=>{if(!("__next_f"in self))return m();let y=0,L=()=>Object.keys(document.documentElement).some(H=>H.startsWith("__reactFiber$"))||++y>330?m():setTimeout(L,30);L()}),Kt.toggle("dt-in-frame",Ts);let c=Pl(),h=zt(c);Il().then(async m=>{await o,Kt.set("--dt-z",String(m.zIndex));let y=m.client?m.brand?.color:null;if(y&&/^#[0-9a-f]{6}$/i.test(y)){let[E,x,q]=[1,3,5].map(_=>parseInt(y.slice(_,_+2),16)/255);Kt.set("--dt-accent",y),Kt.set("--dt-accent-ink",.2126*E+.7152*x+.0722*q>.55?"#000000":"#ffffff")}ed(m);let L="",H=()=>{let E=document.body.currentCSSZoom??1,x=E>0&&Math.abs(E-1)>.001?String(1/E):"1";x!==L&&(L=x,Kt.set("--dt-unzoom",x))};H();let $=new MutationObserver(H);for(let E of[document.documentElement,document.body])$.observe(E,{attributes:!0,attributeFilter:["style","class"]});addEventListener("resize",H),Ed(m,h,c==="comments"),kd(),Md([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-tipbox"].map(E=>document.querySelector(E)).filter(E=>!!E))}).catch(m=>{console.warn("[notemend] not started:",m);let y=window.__notemendHosted;_t.via&&String(m).includes("config 403")&&y?.ask&&(_t.refused=!0,y.ask("You\u2019re not in this project \u2014 sign in as someone else"))})}Ld();import.meta.hot&&import.meta.hot.accept(()=>location.reload());
|