notemend 0.1.28 → 0.1.30
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 +17 -13
- package/bin/init.mjs +21 -21
- package/bin/notemend.mjs +15 -16
- package/bin/step.mjs +1 -1
- package/package.json +1 -1
- package/src/client/index.js +196 -164
- package/src/client/notemend.css +1 -1
- package/src/integration.mjs +2 -1
- package/src/next.mjs +1 -1
- package/src/server/middleware.mjs +4 -4
- package/src/store/cloud.mjs +3 -3
- package/src/store/comments.mjs +4 -3
- package/src/store/thread.mjs +1 -1
- package/store.d.ts +1 -3
- package/thread.d.ts +26 -9
package/src/client/index.js
CHANGED
|
@@ -1,109 +1,138 @@
|
|
|
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
|
-
<!--
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import"./notemend.css";var de={base:"",via:null,signed:{},live:!1,signOut:null,cabinet:"",refused:!1};async function ae(n,r={}){if(r.method&&r.method!=="GET"&&typeof r.body=="string"&&r.body.length<8e3&&r.keepalive===void 0&&(r={...r,keepalive:!0}),!de.via){let p=window.__notemendEarly,g=!r.method||r.method==="GET"?p?.[n]:void 0;if(g){delete p[n];let b=await g;if(b)return b}return fetch(`/__devbar/${n}`,r)}let u=await de.via(n,r);if(u.ok&&n.startsWith("comments")&&(r.method??"GET")==="GET"){let p=await u.json().catch(()=>{});p?.signed&&Object.assign(de.signed,p.signed),u.json=()=>p===void 0?Promise.reject(new TypeError("bad json")):Promise.resolve(p)}return u}var ar=n=>de.via?de.signed[n]??"":`/__devbar/image?name=${encodeURIComponent(n)}`,Bs=(()=>{if(window.self===window.top)return!1;try{return parent.location.origin===location.origin}catch{return!1}})(),mt={getItem:n=>{try{return localStorage.getItem(n)}catch{return null}},setItem:(n,r)=>{try{localStorage.setItem(n,r)}catch{}},removeItem:n=>{try{localStorage.removeItem(n)}catch{}}},lc=()=>mt.getItem("dt-resolved")==="0"&&mt.getItem("dt-archived")!=="1"?"comments?open=1":"comments";var pc=n=>/(?:^|\/)(before|after)-[^/]*$/.exec(String(n))?.[1]??null,mc=n=>{let r={};for(let u of n?.images||[]){let p=pc(u);p&&(r[p]=u)}return r},bo={pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},ir=/^(exe|msi|msp|dmg|pkg|mpkg|app|sh|bash|zsh|command|bat|cmd|com|scr|cpl|ps1|psm1|vbs|vbe|js[e]?|wsf|wsh|hta|jar|apk|ipa|deb|rpm|bin|run|reg|lnk|inf|gadget|appimage)$/i,Fm=/^(png|jpe?g|webp|gif|webm)$/i,Ma=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter:null,Zt=(n,r)=>{let u=String(n??"");if(u.length<=r)return u;let p="";if(Ma)for(let{segment:g}of Ma.segment(u)){if(p.length+g.length>r)break;p+=g}else for(let g of u){if(p.length+g.length>r)break;p+=g}return p},jm=[["PDF","#e5484d","pdf"],["DOC","#0d99ff","doc docx rtf odt pages"],["XLS","#30a46c","xls xlsx csv tsv numbers ods"],["PPT","#f76b15","ppt pptx key odp"],["ZIP","#ffb224","zip rar 7z tar gz tgz bz2"],["FIG","#7c6cf2","fig sketch psd ai xd indd eps"],["TXT","#12a594","txt md json html htm css ts tsx jsx xml yml yaml svg log"],["MP3","#d6409f","mp3 wav m4a ogg flac aac"],["MP4","#e93d82","mp4 mov avi mkv m4v"]],hc=n=>{let r=String(n??"").split(".").pop().toLowerCase(),u=jm.find(([,,p])=>p.split(" ").includes(r));return u?{label:u[0],color:u[1]}:{label:"FILE",color:"#717171"}},rr=n=>/\.(pdf|png|jpe?g|webp|gif|mp4|mov|webm|mp3|wav|m4a)$/i.test(String(n??"").split("?")[0]),_m=Object.fromEntries([..."\u0430\u0431\u0432\u0433\u0491\u0434\u0435\u0454\u0436\u0437\u0438\u0456\u0457\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044C\u044E\u044F\u044B\u044D\u0451\u044A"].map((n,r)=>[n,["a","b","v","h","g","d","e","ie","zh","z","y","i","i","i","k","l","m","n","o","p","r","s","t","u","f","kh","ts","ch","sh","shch","","iu","ia","y","e","io",""][r]])),gc=n=>String(n??"").replace(/\.[^.]*$/,"").toLowerCase().replace(/[а-яёєіїґ]/g,r=>_m[r]??"").normalize("NFKD").replace(/[^\w-]+/g,"-").replace(/^[-_]+|-+$/g,"").slice(0,60),fc=n=>{let r=/\.([a-z0-9]{1,8})$/i.exec(String(n??""));return r&&!ir.test(r[1])?r[1].toLowerCase():""};var yo=n=>{let r=String(n??"");if(r.startsWith("data:")){let g=/^data:([^;,]+)((?:;[^;,]*)*)[;,]/.exec(r);if(!g)return null;let b=/;ext=([a-z0-9]{1,8})/i.exec(g[2])?.[1]?.toLowerCase()??Object.keys(bo).find(E=>bo[E]===g[1]);return b?`${/;name=([\w-]+)/.exec(g[2])?.[1]||"document"}.${b}`:null}let u=r.split("/").pop().split("?")[0];if(/^(voice|before|after)-/.test(u))return null;let p=/-\d+(?:\.([\w-]+))?\.([a-z0-9]{1,8})$/i.exec(u);return p&&!Fm.test(p[2])?`${p[1]||"document"}.${p[2].toLowerCase()}`:null},en=n=>{let r=[{author:"you",text:n.text,at:n.createdAt,by:n.by,byName:n.byName,images:[],...n.reactions?{reactions:n.reactions}:{}},...n.note?[{author:"claude",text:n.note,at:n.updatedAt,images:[]}]:[],...(n.replies||[]).map(u=>({...u,images:[]}))];for(let u of n.images||[]){if(pc(u))continue;let p=Number(/-(\d+)(?:\.[\w-]+)?\.\w+$/.exec(u)?.[1]?.slice(0,13)),g=0;r.forEach((b,E)=>{Date.parse(b.at)<=p&&(g=E)}),r[g].images.push(u)}return r.filter(u=>!u.deleted)},bc=["\u{1F44D}","\u2764\uFE0F","\u{1F602}","\u{1F389}","\u{1F440}","\u{1F525}"],yc=["\u{1F44D}","\u{1F44E}","\u{1F44F}","\u{1F64C}","\u{1F64F}","\u{1F4AA}","\u{1F44C}","\u270C\uFE0F","\u{1F91D}","\u{1F44B}","\u2764\uFE0F","\u{1F525}","\u{1F389}","\u2728","\u2B50","\u2705","\u274C","\u26A0\uFE0F","\u{1F4AF}","\u{1F680}","\u{1F600}","\u{1F602}","\u{1F60A}","\u{1F60D}","\u{1F914}","\u{1F605}","\u{1F60E}","\u{1F973}","\u{1F622}","\u{1F62E}","\u{1F648}","\u{1F92F}","\u{1F62C}","\u{1F643}","\u{1F440}","\u{1F4A1}","\u{1F4CC}","\u{1F41B}","\u{1F3A8}","\u2615"];var Wm=20,vc=(n,r,u)=>{let p={...n||{}},g=p[r]||[];if(!g.length&&Object.keys(p).length>=Wm)return null;let b=g.includes(u)?g.filter(E=>E!==u):[...g,u];return b.length?p[r]=b:delete p[r],Object.keys(p).length?p:void 0},wc=n=>n.nickname||n.name||n.email,lr="(?![\\p{L}\\p{N}_]|[.-][\\p{L}\\p{N}_])",zm=new RegExp("^"+lr,"u"),Vm=(n,r)=>{let u="@"+r.toLowerCase(),p=-1;for(let g=n.indexOf(u);g!==-1;g=n.indexOf(u,g+1))zm.test(n.slice(g+u.length))&&(p=g);return p};var Gm=/https?:\/\/[^\s<>"']+/g,dc=n=>{let r=n.filter(Boolean).pop();try{return r?decodeURIComponent(r):""}catch{return r}},Km=n=>{let r;try{r=new URL(n)}catch{return{label:String(n),kind:"link"}}let u=r.hostname.replace(/^www\./,""),p=r.pathname.split("/").filter(Boolean);if(/(^|\.)figma\.com$/.test(u))return{label:p[2]?`Figma \xB7 ${dc([p[2]]).replace(/-/g," ")}`:"Figma",kind:"link"};if(u==="github.com"&&p.length){let[b,E,H,y]=p;return{label:`GitHub \xB7 ${E??b}${/^(pull|issues)$/.test(H??"")&&y?` #${y}`:""}`,kind:H==="pull"?"pr":"github"}}if(/(^|\.)loom\.com$/.test(u))return{label:"Loom",kind:"link"};let g=dc(p);return{label:g?`${u} \xB7 ${g.length>32?Zt(g,31)+"\u2026":g}`:u,kind:"link"}},dr=n=>{let r=String(n??""),u=[],p=0;for(let g of r.matchAll(Gm)){let b=g[0].replace(/[.,;:!?)\]]+$/,"");g.index>p&&u.push(r.slice(p,g.index)),u.push({url:b,...Km(b)}),p=g.index+b.length}return p<r.length&&u.push(r.slice(p)),u},$c=n=>dr(n).map(r=>typeof r=="string"?r:r.label).join(""),cc={claude:"Claude",codex:"Codex",gemini:"Gemini",cursor:"Cursor",copilot:"Copilot",windsurf:"Windsurf",amp:"Amp",aider:"Aider",opencode:"OpenCode",agent:"AI agent"},xc=new Map,Ec=(n=[])=>{for(let r of n)r?.email&&xc.set(r.email.toLowerCase(),r.agent_name?.trim()||"")},Wn=(n,r)=>r&&xc.get(String(ur(r)??r).toLowerCase())||"Agent",cr=n=>!n||n==="claude"?"via Claude Code":n==="agent"||!cc[n]?"":`via ${cc[n]}`,ka="3.6 3.6 10.8 10.8",La="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",ur=n=>typeof n=="string"&&n.startsWith("agent:")?n.slice(6):null,Jt=n=>n==="claude"||ur(n)!=null;var Um=["new","approved","progress","review","waiting"],Be=n=>Um.includes(n?.stage)?n.stage:n?.stage==="accepted"?"review":Jt(n?.assignee)?"approved":"new",qt=n=>n?.client===!0||n?.shared===!0,Mc=(n,r,u="")=>`Duplicated from ${u?u==="you"?"your":`${u}\u2019s`:"a"} ${(r?qt(r):!qt(n))?"client":"studio"} thread`,kc=n=>qt(n)?"Duplicated for the client":"Mirrored to Team",Ps=n=>Number.isInteger(n?.from?.id)&&!qt(n),Lc=(n="")=>`Mirrored from Client${n?` by ${n}`:""}`,fo={new:"Received",progress:"In progress",review:"In progress",waiting:"In progress",done:"Fixed \u2014 please check"},Sc=(n,r=Date.now())=>n?.status==="done"?fo.done:ln(n,r)||["progress","review","waiting"].includes(Be(n))?fo.progress:fo.new,Tc="Fixed \u2014 please check.",Ac=n=>n?.status==="done"&&!qt(n)&&Number.isInteger(n.from?.id)?n.from.id:null;var Sa=["agent","claude","codex","gemini"];var pr=(n,r=[])=>{let u=String(n||"").toLowerCase();return Sa.some(p=>Vm(u,p)!==-1)?"claude":null},Hc=(n,r=[],u="")=>{let p=String(n||"").replace(/^@/,"").toLowerCase();if(Sa.includes(p))return"agent";let g=r.find(b=>[b.name,b.nickname,b.email].some(E=>E&&E.toLowerCase()===p));return g&&u&&g.email?.toLowerCase()===u.toLowerCase()?"you":"person"};var Ym=2*36e5,ln=(n,r=Date.now())=>n?.working&&n.status!=="done"&&r-Date.parse(n.working.at)<Ym?n.working:null;var vo=(n,r,u=Date.now())=>{let p=String(n?.by||n?.byName||"").toLowerCase();if(!p||r==="done")return null;let g=r==="claude"||Jt(n.assignee),b=g?ln(n,u)?.by||n.doneFor||n.handedBy||ur(n.assignee)||p:n.assignee||"";return{writer:p,taker:String(b).toLowerCase(),claude:g}},mr=n=>/@guest\.notemend\.com$/i.test(String(n||"")),we=(n,r=Date.now())=>{if(!n)return null;if(n.status==="done")return n.doneBy==="claude"?"review":Jt(n.assignee)?"done":null;if(!Jt(n.assignee))return null;let u=en(n),p=u[u.length-1],g=ln(n,r);return u.length>1&&p.author==="claude"&&!(n.reopenedAt&&Date.parse(n.reopenedAt)>=Date.parse(p.at))&&(!g||String(p.text??"").includes("?"))?"asks":g?g.step&&r-Date.parse(g.at)>Xm?"stuck":"working":n.working?"stuck":Be(n)==="approved"?"queued":null},Xm=10*6e4,uc=(n,r=Date.now())=>{let u=Math.floor((r-Date.parse(n??""))/6e4);return u>=1?u<60?`${u} min`:`${Math.floor(u/60)} h`:"now"},hr=(n,r=31)=>{let u=Ma?[...Ma.segment(String(n??""))].map(b=>b.segment):[...String(n??"")];if(u.length<=r)return u.join("");let p=u.join("").match(/\.\w{1,8}$/)?.[0],g=p?p.length+3:0;return u.slice(0,r-1-g).join("")+"\u2026"+(g?u.slice(-g).join(""):"")},gr=(n,r=Date.now())=>{let u=n?.status!=="done"?n?.working:null;return u?.at?{step:u.step?String(u.step):null,elapsed:uc(u.since??u.at,r),silent:uc(u.at,r),stale:!ln(n,r)}:null};var Cc=La.split("M").filter(Boolean).map(n=>{let r=n.match(/[\d.]+/g).map(Number),[u,p]=/H/.test(n)?[r[2],r[1]]:/V/.test(n)?[r[0],r[2]]:[r[2],r[3]];return{d:"M"+n,a:(Math.atan2(u-9,9-p)+2*Math.PI)%(2*Math.PI)}}).sort((n,r)=>n.a-r.a).map(n=>n.d);var Nc=(n,r)=>{if(n.archivedAt)return!0;if(!r||n.status!=="done"||n.doneBy==="claude")return!1;let u=Math.max(Date.parse(n.confirmedAt||n.updatedAt||"")||0,...(n.replies||[]).filter(p=>!p.deleted).map(p=>Date.parse(p.at||"")||0));return!!u&&Date.now()-u>r*864e5},Jm=["uk","ru","en"],Rc=n=>{try{let r=new Intl.DisplayNames([n],{type:"language"}).of(n)??n;return r[0].toUpperCase()+r.slice(1)}catch{return n}},fr=n=>{try{return new Intl.DisplayNames(["en"],{type:"language"}).of(n)??n}catch{return n}},Ta=n=>/[іїєґІЇЄҐ]/.test(n)?"uk":/[ыэъёЫЭЪЁ]/.test(n)?"ru":/\p{Script=Cyrillic}/u.test(n)?"":/\p{L}/u.test(n)&&!/[^\p{Script=Latin}\P{L}]/u.test(n)?"en":"",Bc=(n,r="en")=>{let u=Ta(n),p=r.split("-")[0].toLowerCase();return[...new Set([p,...Jm])].filter(g=>g!==u)};async function Pc(){let n=await ae("config");if(!n.ok)throw Object.assign(new Error(`config ${n.status}`),{said:n.status===401?await n.text().catch(()=>""):""});let r=await n.json();return r.breakpoints=r.breakpoints.map(u=>({...u,max:u.max??1/0})),Ec(r.team),r}var Ic=["iPhone","Android","Foldable","Tablet","Laptop & display"],wo=[{id:"iphone-se",label:"iPhone SE",group:"iPhone",w:375,h:667,dpr:2,rotates:!0,mobile:!0},{id:"iphone-xr",label:"iPhone XR",group:"iPhone",w:414,h:896,dpr:2,rotates:!0,mobile:!0,insets:{left:0,top:44,right:0,bottom:34},cutout:{shape:"notch",x:92,y:0,width:231,height:33,"upper-radius":6,"lower-radius":25}},{id:"iphone-12-pro",label:"iPhone 12 Pro",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:90,y:0,width:210,height:32,"upper-radius":6,"lower-radius":23}},{id:"iphone-14",label:"iPhone 14",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-plus",label:"iPhone 14 Plus",group:"iPhone",w:428,h:926,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:133,y:0,width:161,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-14-pro",label:"iPhone 14 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-14-pro-max",label:"iPhone 14 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15",label:"iPhone 15",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-plus",label:"iPhone 15 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro",label:"iPhone 15 Pro",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-15-pro-max",label:"iPhone 15 Pro Max",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16e",label:"iPhone 16e",group:"iPhone",w:390,h:844,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:47,right:0,bottom:34},cutout:{shape:"notch",x:114,y:0,width:162,height:34,"upper-radius":5,"lower-radius":22}},{id:"iphone-16",label:"iPhone 16",group:"iPhone",w:393,h:852,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:134,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-plus",label:"iPhone 16 Plus",group:"iPhone",w:430,h:932,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:59,right:0,bottom:34},cutout:{shape:"pill",x:153,y:11,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro",label:"iPhone 16 Pro",group:"iPhone",w:402,h:874,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:139,y:14,width:125,height:37,"border-radius":19}},{id:"iphone-16-pro-max",label:"iPhone 16 Pro Max",group:"iPhone",w:440,h:956,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:62,right:0,bottom:34},cutout:{shape:"pill",x:158,y:14,width:125,height:37,"border-radius":19}},{id:"jiophone-2",label:"JioPhone 2",group:"Android",w:240,h:320,dpr:1,rotates:!0,mobile:!0},{id:"pixel-7",label:"Pixel 7",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:52,right:0,bottom:0},cutout:{shape:"circle",x:183,y:0,width:55,height:52,cx:206,cy:26,radius:13}},{id:"pixel-8",label:"Pixel 8",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:182,y:0,width:46,height:50,cx:206,cy:25,radius:14}},{id:"pixel-8-pro",label:"Pixel 8 Pro",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:50,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:37,height:50,cx:224,cy:25,radius:14}},{id:"pixel-8a",label:"Pixel 8a",group:"Android",w:412,h:915,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:46,right:0,bottom:0},cutout:{shape:"circle",x:185,y:0,width:42,height:46,cx:206,cy:26,radius:13}},{id:"pixel-9",label:"Pixel 9",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"pixel-9-pro",label:"Pixel 9 Pro",group:"Android",w:427,h:952,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:68,right:0,bottom:0},cutout:{shape:"circle",x:195,y:0,width:36,height:68,cx:213,cy:34,radius:16}},{id:"pixel-9-pro-xl",label:"Pixel 9 Pro XL",group:"Android",w:448,h:997,dpr:3,rotates:!0,mobile:!0,insets:{left:0,top:66,right:0,bottom:0},cutout:{shape:"circle",x:205,y:0,width:38,height:66,cx:224,cy:33,radius:16}},{id:"pixel-10",label:"Pixel 10",group:"Android",w:412,h:924,dpr:2.625,rotates:!0,mobile:!0,insets:{left:0,top:58,right:0,bottom:0},cutout:{shape:"circle",x:188,y:0,width:37,height:58,cx:206,cy:29,radius:14}},{id:"samsung-galaxy-s8",label:"Samsung Galaxy S8+",group:"Android",w:360,h:740,dpr:4,rotates:!0,mobile:!0},{id:"samsung-galaxy-a55",label:"Samsung Galaxy A55",group:"Android",w:360,h:800,dpr:2.25,rotates:!0,mobile:!0},{id:"samsung-galaxy-s20-ultra",label:"Samsung Galaxy S20 Ultra",group:"Android",w:412,h:915,dpr:3.5,rotates:!0,mobile:!0},{id:"samsung-galaxy-a51-71",label:"Samsung Galaxy A51/71",group:"Android",w:412,h:914,dpr:2.625,rotates:!0,mobile:!0},{id:"facebook-on-android",label:"Facebook on Android",group:"Android",w:412,h:892,dpr:3.5,rotates:!0,mobile:!0},{id:"moto-g4",label:"Moto G4",group:"Android",w:360,h:640,dpr:3,rotates:!0,mobile:!0},{id:"moto-g-power",label:"Moto G Power",group:"Android",w:412,h:823,dpr:1.75,rotates:!0,mobile:!0},{id:"surface-duo",label:"Surface Duo",group:"Foldable",w:540,h:720,dpr:2.5,rotates:!0,mobile:!0},{id:"pixel-9-pro-fold",label:"Pixel 9 Pro Fold",group:"Foldable",w:412,h:922,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-6",label:"Galaxy Z Fold 6",group:"Foldable",w:412,h:968,dpr:2.625,rotates:!0,mobile:!0},{id:"galaxy-z-fold-5",label:"Galaxy Z Fold 5",group:"Foldable",w:344,h:882,dpr:2.625,rotates:!0,mobile:!0},{id:"asus-zenbook-fold",label:"Asus Zenbook Fold",group:"Foldable",w:853,h:1280,dpr:1.5,rotates:!0,mobile:!1},{id:"ipad-mini",label:"iPad Mini",group:"Tablet",w:768,h:1024,dpr:2,rotates:!0,mobile:!0},{id:"ipad-pro-13",label:"iPad Pro 13",group:"Tablet",w:1032,h:1376,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-7",label:"Surface Pro 7",group:"Tablet",w:912,h:1368,dpr:2,rotates:!0,mobile:!0},{id:"surface-pro-10",label:"Surface Pro 10",group:"Tablet",w:960,h:1440,dpr:2,rotates:!0,mobile:!0},{id:"galaxy-tab-s4",label:"Galaxy Tab S4",group:"Tablet",w:712,h:1138,dpr:2.25,rotates:!0,mobile:!0},{id:"nest-hub-max",label:"Nest Hub Max",group:"Laptop & display",w:1280,h:800,dpr:2,rotates:!1,mobile:!0},{id:"laptop-with-touch",label:"Laptop with touch",group:"Laptop & display",w:1280,h:950,dpr:1,rotates:!1,mobile:!1},{id:"laptop-with-hidpi-screen",label:"Laptop with HiDPI screen",group:"Laptop & display",w:1440,h:900,dpr:2,rotates:!1,mobile:!1},{id:"laptop-with-mdpi-screen",label:"Laptop with MDPI screen",group:"Laptop & display",w:1280,h:800,dpr:1,rotates:!1,mobile:!1}];var f=n=>n.replace(/[&<>"']/g,r=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[r]),zn=n=>n?new Date(n).toLocaleString("en",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):"",yr=(n,r=u=>new Date(u).toLocaleDateString("en",{day:"numeric",month:"short"}))=>new Date(n).toDateString()===new Date().toDateString()?new Date(n).toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):r(n),cs='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M8 6V4.2h4V6M6.6 6l.55 9.8h5.7L13.4 6"/></svg>',$e='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4.8 10.4 8.2 13.8l7-7.6" stroke-linejoin="round"/></svg>',Vn='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M12.6 4.4l3 3-8.4 8.4H4.2v-3z" stroke-linejoin="round"/></svg>',Ln='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3" y="4" width="14" height="3.5" rx="1"/><path d="M4.5 7.5v7A1.5 1.5 0 0 0 6 16h8a1.5 1.5 0 0 0 1.5-1.5v-7M8.5 10.5h3" stroke-linejoin="round"/></svg>',Sn='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5.4 5.4l9.2 9.2M14.6 5.4l-9.2 9.2"/></svg>',Aa='<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>',Ha='<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>',Pe=n=>`<svg viewBox="${ka}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude"><path d="${La}" stroke-width="1.15" stroke-linecap="round"/></svg>`,vr=(n,r)=>`<svg viewBox="${ka}" width="${n}" height="${n}" aria-hidden="true" class="dt-claude dt-claude--fill">${Cc.map((u,p)=>`<path d="${u}" stroke-width="1.15" stroke-linecap="round"${p<r?"":' class="is-off"'}/>`).join("")}</svg>`,xt=(n,r=15)=>`<svg viewBox="0 0 20 20" width="${r}" height="${r}" aria-hidden="true">${n}</svg>`,Zm=n=>n.breakpoints.map(r=>["new","progress","review","waiting","done"].map(u=>`<b data-bp="${f(r.id)}" data-state="${u}" hidden>${xt(r.icon,11)}<i></i></b>`).join("")).join(""),Oc=(n,r,u,p)=>`<li${p?` draggable="true" data-route="${f(r.route)}"`:""}><a href="${/^\/(?![\/\\])/.test(r.route)?f(r.route):"#"}"${r.route===u?' aria-current="page"':""}>`+(p?'<i class="dt-grip" aria-hidden="true"></i>':"")+`<span class="dt-menu-label">${f(r.label)}</span><em class="dt-pages-n" hidden>${Zm(n)}</em></a></li>`,Qm='<svg viewBox="0 4 100 100" width="18" height="18" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',$o=xt('<path d="M6 8l4 4 4-4" />',12),br='<rect x="3" y="4" width="14" height="12" rx="2" /><path d="M3 8h14" />',qc='<circle cx="8" cy="7" r="3" /><path d="M2.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M13.5 12.5l1.2 1.2 2.3-2.4" />',wr={studio:br,clients:qc};function Dc(n){let r=n.client?' style="display:none"':"",u=[...new Set(n.devices.map(T=>T.group))].map(T=>`<p class="dt-devices-group">${f(T)}</p>`+n.devices.filter(x=>x.group===T).map(x=>`<button type="button" data-device="${f(x.id)}" aria-pressed="false"${x.note?` title="${f(x.note)}"`:""}><span class="dt-menu-label">${f(x.label)}</span><em>${x.w}×${x.h}</em></button>`).join("")).join(""),p=Ic.map(T=>`<p class="dt-devices-group">${f(T)}</p>`+wo.filter(x=>x.group===T).map(x=>`<button type="button" data-emu="${f(x.id)}" aria-pressed="false"><span class="dt-menu-label">${f(x.label)}</span><em>${x.w}×${x.h}</em></button>`).join("")).join(""),g=n.breakpoints.map(T=>`<button class="dt-icon dt-bp" type="button" data-bp="${f(T.id)}" aria-pressed="false" title="${f(T.label)}">${xt(T.icon,16)}</button>`).join(""),b="Real screens, the browser around the page. A thread goes to its width\u2019s breakpoint.",E="The page at the device\u2019s size. A thread goes to its breakpoint.",H=Array.from({length:n.grid.columns},()=>'<div class="dt-overlay-col"></div>').join(""),y="Drag to resize inside this breakpoint. Double-click snaps to the band's edge";document.body.insertAdjacentHTML("beforeend",`
|
|
2
|
+
<!-- The top strip (Figma Proposals 33 \xABW9\xBB, 10.11): the mark, the studio / the space \u2304 on the left,
|
|
3
|
+
the address \u2014 the page list with its folders and search \u2014 in the middle, you and settings on the right.
|
|
4
|
+
The bar below keeps the tools. It does not fold (10.11). -->
|
|
5
|
+
<div class="dt-strip" role="banner" aria-label="Notemend">
|
|
6
|
+
<div class="dt-strip-side">
|
|
7
|
+
<span class="dt-strip-mark">${Qm}</span>
|
|
8
|
+
${n.studioName?`<span class="dt-strip-studio">${f(n.studioName)}</span>`:""}
|
|
9
|
+
<details class="dt-space" name="dt-menu" hidden>
|
|
10
|
+
<summary data-tip="Switch space \xB7 M"><span class="dt-space-ic">${xt(br,14)}</span><span class="dt-space-name">Team</span>${$o}</summary>
|
|
11
|
+
<div class="dt-space-menu" role="menu" aria-label="Whose threads">
|
|
12
|
+
<button type="button" role="menuitemradio" data-space="studio" aria-checked="true">${xt(br,14)}<span><b>Team</b><em>Only people in ${f(n.studioName||"your studio")}</em></span><i class="dt-space-n"></i></button>
|
|
13
|
+
<button type="button" role="menuitemradio" data-space="clients" aria-checked="false">${xt(qc,14)}<span><b>Client</b><em>Also visible to the client of this project</em></span><i class="dt-space-n"></i></button>
|
|
14
|
+
</div>
|
|
15
|
+
</details>
|
|
16
|
+
</div>
|
|
17
|
+
<details class="dt-pages" name="dt-menu">
|
|
18
|
+
<summary aria-label="Pages">
|
|
19
|
+
<span class="dt-pages-copy" role="button" tabindex="0" aria-label="Copy the page\u2019s link" data-tip="Copy link">${xt('<path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-.9.9M11.5 8.5a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l.9-.9" />',15)}</span>
|
|
20
|
+
<span class="dt-pages-addr"><span class="dt-pages-host">${f(location.host)}</span><span class="dt-pages-slash">/</span><span class="dt-pages-name"></span></span>
|
|
21
|
+
<em class="dt-pages-here" hidden></em>${$o}
|
|
22
|
+
</summary>
|
|
23
|
+
<div class="dt-pages-menu">
|
|
24
|
+
<label class="dt-pages-find">${xt('<circle cx="9" cy="9" r="5.5" /><path d="m13.2 13.2 3.3 3.3" />',14)}<input type="search" placeholder="Search pages" aria-label="Search pages" /><kbd>/</kbd></label>
|
|
25
|
+
<ul class="dt-pages-list"></ul>
|
|
26
|
+
<div class="dt-pages-hits" hidden></div>
|
|
27
|
+
<div class="dt-pages-foot" hidden><button type="button" class="dt-folder-new">${xt('<path d="M10 4.5v11M4.5 10h11" />',14)}<span>New folder</span></button><p class="dt-sel-hint" hidden></p></div>
|
|
28
|
+
</div>
|
|
29
|
+
</details>
|
|
30
|
+
<div class="dt-strip-side dt-strip-end">
|
|
31
|
+
<details class="dt-me" name="dt-menu"${n.me?"":" hidden"}>
|
|
32
|
+
<summary data-tip="You"><span class="dt-me-face"></span><span class="dt-me-name">${f(n.me?.name||n.me?.email||"")}</span>${$o}</summary>
|
|
33
|
+
<div class="dt-me-menu" role="menu">
|
|
34
|
+
<p class="dt-set-who">Signed in as<b>${f(n.me?.email??"")}</b></p><hr>
|
|
35
|
+
<a role="menuitem" class="dt-me-cab" target="_blank" rel="noopener" hidden>${xt('<path d="M11 3.5h5.5V9M16.5 3.5 9 11M14 11.5v4A1.5 1.5 0 0 1 12.5 17h-8A1.5 1.5 0 0 1 3 15.5v-8A1.5 1.5 0 0 1 4.5 6h4" />',14)}<span>Open the cabinet</span></a>
|
|
36
|
+
<a role="menuitem" class="dt-me-acc" target="_blank" rel="noopener" hidden>${xt('<circle cx="7.5" cy="7" r="3" /><path d="M2 16.5c.5-2.8 2.6-4.5 5.5-4.5s5 1.7 5.5 4.5M13 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1.4.6 2.3 2 2.5 4.1" />',14)}<span>Account</span></a>
|
|
37
|
+
<hr data-set-out hidden>
|
|
38
|
+
<button type="button" role="menuitem" data-set="out" hidden>${xt('<path d="M8 3.5H5a1.5 1.5 0 0 0-1.5 1.5v10A1.5 1.5 0 0 0 5 16.5h3M12.5 13.5 16 10l-3.5-3.5M16 10H8" />',14)}<span>Sign out</span></button>
|
|
39
|
+
</div>
|
|
40
|
+
</details>
|
|
41
|
+
<!-- settings (the top strip, beside \u2303; who you are and signing out moved to the profile): the keys (their list in the same menu, written by the script from
|
|
42
|
+
the table that runs them), hiding the bar, signing out of a hosted bar -->
|
|
43
|
+
<details class="dt-keys" name="dt-menu">
|
|
44
|
+
<summary class="dt-icon" title="Settings">
|
|
45
|
+
${xt('<g transform="scale(0.8333)" stroke-width="1.8"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /><circle cx="12" cy="12" r="3" /></g>')}
|
|
10
46
|
</summary>
|
|
11
|
-
<
|
|
47
|
+
<div class="dt-keys-menu">
|
|
48
|
+
<div class="dt-set-main">
|
|
49
|
+
${n.client?"":`<button type="button" data-set="grid">${xt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />',14)}<span>Grid</span><em class="dt-set-hint">Auto</em>${xt('<path d="M8 5l5 5-5 5" />',12)}</button>`}
|
|
50
|
+
<button type="button" data-set="custom">${xt('<rect x="3" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="3" width="5.5" height="5.5" rx="1.5" /><rect x="3" y="11.5" width="5.5" height="5.5" rx="1.5" /><rect x="11.5" y="11.5" width="5.5" height="5.5" rx="1.5" stroke-dasharray="2 1.6" />',14)}<span>Customize the bar</span></button>
|
|
51
|
+
<button type="button" data-set="keys"${n.shortcuts?"":" hidden"}>${xt('<rect x="2" y="5" width="16" height="10" rx="2" /><path d="M5.5 8.5h.01M8.5 8.5h.01M11.5 8.5h.01M14.5 8.5h.01M6.5 12h7" />',14)}<span>Keyboard shortcuts</span><kbd>?</kbd></button>
|
|
52
|
+
<button type="button" data-set="hide">${xt('<path d="M5.5 8 10 12.5 14.5 8" />',14)}<span>Hide the bar</span>${n.shortcuts?"<kbd>\\</kbd>":""}</button>
|
|
53
|
+
</div>
|
|
54
|
+
<!-- the project's grid (Figma: Settings menu \u203A Pane=Grid \xB7 Custom / Grid \xB7 Auto), drawn by run.ts -->
|
|
55
|
+
<div class="dt-set-grid" hidden></div>
|
|
56
|
+
<div class="dt-set-keys" hidden>
|
|
57
|
+
<button type="button" class="dt-set-back" data-set="back">${xt('<path d="M15.5 10h-11M9 5.5 4.5 10 9 14.5" />',13)}<span>Keyboard shortcuts</span></button>
|
|
58
|
+
<hr>
|
|
59
|
+
<div class="dt-keys-list"></div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
12
62
|
</details>
|
|
13
63
|
</div>
|
|
64
|
+
</div>
|
|
14
65
|
|
|
15
|
-
|
|
66
|
+
<!-- One bar, bottom-centre: inspectors | comments | breakpoints \xB7 devices. -->
|
|
67
|
+
<div class="devtools">
|
|
68
|
+
${n.client&&n.brand?.logo&&/^https:\/\/[a-z0-9]+\.supabase\.co\/storage\/v1\/object\/public\/avatars\/|^http:\/\/127\.0\.0\.1:54321\//.test(n.brand.logo)?`<img class="dt-brand" src="${f(n.brand.logo)}" alt="" />`:""}
|
|
69
|
+
<div class="dt-group" role="group" aria-label="Inspect"${r}>
|
|
16
70
|
<button class="dt-icon dt-grid-btn" type="button" aria-pressed="false" title="Grid">
|
|
17
|
-
${
|
|
71
|
+
${xt('<path d="M4 3v14M8 3v14M12 3v14M16 3v14" />')}
|
|
18
72
|
</button>
|
|
19
73
|
<button class="dt-icon dt-pad-btn" type="button" aria-pressed="false" title="Spacing">
|
|
20
|
-
${
|
|
74
|
+
${xt('<rect x="2.5" y="2.5" width="15" height="15" rx="1.5" /><rect x="6.5" y="6.5" width="7" height="7" rx="1" stroke-dasharray="2 2" />')}
|
|
21
75
|
</button>
|
|
22
76
|
<button class="dt-icon dt-size-btn" type="button" aria-pressed="false" title="Size">
|
|
23
|
-
${
|
|
77
|
+
${xt('<path d="M3 7V4h3M17 13v3h-3M3 4l6 6M17 16l-6-6" />')}
|
|
24
78
|
</button>
|
|
25
79
|
<button class="dt-icon dt-type-btn" type="button" aria-pressed="false" title="Typography">
|
|
26
|
-
${
|
|
80
|
+
${xt('<path d="M2.5 15.5 6.5 5l4 10.5M3.9 12.6h5.2M15 4.5v11M13.2 6.3 15 4.5l1.8 1.8M13.2 13.7 15 15.5l1.8-1.8" />')}
|
|
27
81
|
</button>
|
|
28
82
|
<button class="dt-icon dt-color-btn" type="button" aria-pressed="false" title="Color">
|
|
29
|
-
${
|
|
83
|
+
${xt('<path d="M10 3c2.9 3.4 4.6 5.9 4.6 8.2a4.6 4.6 0 0 1-9.2 0C5.4 8.9 7.1 6.4 10 3z" />')}
|
|
30
84
|
</button>
|
|
31
85
|
<button class="dt-icon dt-contrast-btn" type="button" aria-pressed="false" title="Contrast">
|
|
32
|
-
${
|
|
86
|
+
${xt('<circle cx="10" cy="10" r="7" /><path d="M10 3a7 7 0 0 1 0 14z" fill="currentColor" />')}
|
|
33
87
|
</button>
|
|
34
88
|
<!-- Figma \xABBar \xB7 Vision \xB7 4 Vision sheet\xBB: the view as six kinds of eyes, filled in by run.ts -->
|
|
35
89
|
<details class="dt-vision" name="dt-menu">
|
|
36
90
|
<summary class="dt-icon" title="Vision">
|
|
37
|
-
${
|
|
91
|
+
${xt('<path d="M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z" /><circle cx="10" cy="10" r="2.5" />')}
|
|
38
92
|
</summary>
|
|
39
93
|
<div class="dt-sheet dt-vision-sheet"></div>
|
|
40
94
|
</details>
|
|
41
95
|
<button class="dt-icon dt-border-btn" type="button" aria-pressed="false" title="Border & radius">
|
|
42
|
-
${
|
|
96
|
+
${xt('<path d="M3.5 16.5V8a4.5 4.5 0 0 1 4.5-4.5h8.5" /><path d="M16.5 8v8.5H8" stroke-dasharray="1.6 2.2" />')}
|
|
43
97
|
</button>
|
|
44
|
-
<button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${
|
|
45
|
-
${
|
|
98
|
+
<button class="dt-icon dt-studio-btn" type="button" aria-pressed="true" title="Sanity"${n.sanity?"":" hidden"}>
|
|
99
|
+
${xt('<path d="M12.5 3.5 16.5 7.5 7 17H3v-4z" />')}
|
|
46
100
|
</button>
|
|
47
101
|
</div>
|
|
48
102
|
|
|
49
103
|
<div class="dt-group" role="group" aria-label="Threads">
|
|
50
104
|
<button class="dt-icon dt-notes-btn" type="button" aria-pressed="false" title="Comment">
|
|
51
|
-
${
|
|
105
|
+
${xt('<path d="M4 3.5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9.5L5.5 16.5v-3H4a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2z" stroke-linejoin="round" />')}
|
|
52
106
|
<span class="dt-notes-count" hidden></span>
|
|
53
107
|
</button>
|
|
54
108
|
<button class="dt-icon dt-history-btn" type="button" aria-pressed="false" title="Panel">
|
|
55
|
-
${
|
|
109
|
+
${xt('<rect x="2.5" y="3.5" width="15" height="13" rx="2" /><path d="M12 3.5v13M14 7.5h1.5M14 10h1.5" />')}
|
|
56
110
|
</button>
|
|
57
111
|
<!-- resolved pins on or off: the switch is in the comments panel's head now; this one stays for the code that reads it -->
|
|
58
112
|
<button class="dt-icon dt-resolved-btn" type="button" aria-pressed="true" title="Resolved" hidden style="display:none">
|
|
59
|
-
${
|
|
113
|
+
${xt('<circle cx="10" cy="10" r="7.5" /><path d="M6.8 10.2 9 12.4l4-4.4" stroke-linejoin="round" />')}
|
|
60
114
|
</button>
|
|
61
115
|
</div>
|
|
62
116
|
|
|
63
|
-
<div class="dt-group dt-bps" role="group" aria-label="Screen size">${
|
|
117
|
+
<div class="dt-group dt-bps" role="group" aria-label="Screen size">${g}</div>
|
|
64
118
|
|
|
65
119
|
<div class="dt-group dt-group--menus">
|
|
66
120
|
<details class="dt-devices" name="dt-menu">
|
|
67
121
|
<summary title="Devices">
|
|
68
|
-
${
|
|
122
|
+
${xt('<rect x="3" y="4" width="14" height="9" rx="1.5" /><path d="M7 16h6" />')}
|
|
69
123
|
<span class="dt-devices-name">Device</span>
|
|
70
124
|
</summary>
|
|
71
125
|
<div class="dt-devices-menu">
|
|
72
126
|
<div class="dt-menu-tabs" role="tablist" aria-label="Device lists">
|
|
73
|
-
<button type="button" role="tab" data-tab="preview" aria-selected="true" aria-description="${
|
|
127
|
+
<button type="button" role="tab" data-tab="preview" aria-selected="true" aria-description="${b}" data-tip="${b}">Preview</button>
|
|
74
128
|
<button type="button" role="tab" data-tab="devtools" aria-selected="false" aria-description="${E}" data-tip="${E}">DevTools</button>
|
|
75
129
|
</div>
|
|
76
130
|
<div class="dt-menu-panel" role="tabpanel" data-panel="preview">
|
|
77
|
-
${
|
|
131
|
+
${u}
|
|
78
132
|
</div>
|
|
79
133
|
<div class="dt-menu-panel" role="tabpanel" data-panel="devtools" hidden>
|
|
80
134
|
<input class="dt-emu-search" type="search" placeholder="Find a device" aria-label="Find a device" />
|
|
81
|
-
${
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</details>
|
|
85
|
-
<!-- settings: who you are, the keys (their list in the same menu, written by the script from
|
|
86
|
-
the table that runs them), hiding the bar, signing out of a hosted bar -->
|
|
87
|
-
<details class="dt-keys" name="dt-menu">
|
|
88
|
-
<summary class="dt-icon" title="Settings">
|
|
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>')}
|
|
90
|
-
</summary>
|
|
91
|
-
<div class="dt-keys-menu">
|
|
92
|
-
<div class="dt-set-main">
|
|
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>
|
|
98
|
-
<hr 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>
|
|
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>
|
|
103
|
-
<div class="dt-set-keys" hidden>
|
|
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>
|
|
105
|
-
<hr>
|
|
106
|
-
<div class="dt-keys-list"></div>
|
|
135
|
+
${p}
|
|
107
136
|
</div>
|
|
108
137
|
</div>
|
|
109
138
|
</details>
|
|
@@ -113,12 +142,6 @@ import"./notemend.css";var _t={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
113
142
|
<div class="dt-sheet dt-custom-sheet" role="dialog" aria-label="Customize the bar"></div>
|
|
114
143
|
</details>
|
|
115
144
|
</div>
|
|
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. -->
|
|
118
|
-
<span class="dt-space" role="radiogroup" aria-label="Whose threads" hidden>
|
|
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>
|
|
121
|
-
</span>
|
|
122
145
|
<!-- pin filters: a funnel after the spaces pill, in the page's well (Figma \xABBar \xB7 Idle\xBB: icon/bar/filter) \u2014
|
|
123
146
|
its menu has the counts, filters the pins and the rest dim (F). The studio's only, as the pill is. -->
|
|
124
147
|
<span class="dt-pinf" hidden>
|
|
@@ -127,15 +150,15 @@ import"./notemend.css";var _t={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
127
150
|
</span>
|
|
128
151
|
<!-- push to Claude: one square tool in the agent's well \u2014 a press sends what waits for Claude; a right
|
|
129
152
|
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${
|
|
131
|
-
<button class="dt-push-all" type="button" aria-label="Push to
|
|
153
|
+
<span class="dt-push" hidden${n.client?' style="display:none"':""}>
|
|
154
|
+
<button class="dt-push-all" type="button" aria-label="Push to the agent"><svg viewBox="${ka}" width="14" height="14" aria-hidden="true" class="dt-claude"><path d="${La}" stroke-width="1.1" stroke-linecap="round"/></svg><b class="dt-push-n">0</b></button
|
|
132
155
|
>
|
|
133
|
-
<div class="dt-push-menu" hidden role="dialog" aria-label="What goes to
|
|
156
|
+
<div class="dt-push-menu" hidden role="dialog" aria-label="What goes to the agent"></div>
|
|
134
157
|
</span>
|
|
135
158
|
<!-- turbo: a bolt in the agent's well beside push, always there for the studio \u2014 lit while
|
|
136
159
|
an agent session takes comments, grey when none is listening or it is paused here -->
|
|
137
|
-
<button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${
|
|
138
|
-
<span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${
|
|
160
|
+
<button class="dt-turbo" type="button" role="switch" data-state="none" aria-checked="false"${n.client?" hidden":""}>
|
|
161
|
+
<span class="dt-turbo-switch" aria-hidden="true"><span class="dt-turbo-knob">${xt('<path d="M11 2.5 4.5 11h5l-1 6.5L15.5 9h-5z" stroke-linejoin="round" />',12)}</span></span>
|
|
139
162
|
</button>
|
|
140
163
|
</div>
|
|
141
164
|
|
|
@@ -147,14 +170,14 @@ import"./notemend.css";var _t={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
147
170
|
|
|
148
171
|
<div class="dt-frame" hidden role="region" aria-label="Breakpoint preview">
|
|
149
172
|
<div class="dt-stage">
|
|
150
|
-
<span class="dt-frame-handle" data-edge="l" title="${
|
|
173
|
+
<span class="dt-frame-handle" data-edge="l" title="${y}"></span>
|
|
151
174
|
<div class="dt-device">
|
|
152
175
|
<div class="dt-shell"></div>
|
|
153
176
|
<iframe title="Breakpoint preview"></iframe>
|
|
154
177
|
<div class="dt-chrome" data-at="top"></div>
|
|
155
178
|
<div class="dt-chrome" data-at="bottom"></div>
|
|
156
179
|
</div>
|
|
157
|
-
<span class="dt-frame-handle" data-edge="r" title="${
|
|
180
|
+
<span class="dt-frame-handle" data-edge="r" title="${y}"></span>
|
|
158
181
|
</div>
|
|
159
182
|
<div class="dt-ruler"></div>
|
|
160
183
|
<span class="dt-frame-size"></span>
|
|
@@ -173,139 +196,148 @@ import"./notemend.css";var _t={base:"",via:null,signed:{},live:!1,signOut:null,c
|
|
|
173
196
|
<div class="dt-notes-overlay" hidden role="region" aria-label="Threads on this page"></div>
|
|
174
197
|
<!-- the clients' space: a frame round the page and its name in a notch at the top, with \xD7 back to the studio's -->
|
|
175
198
|
<div class="dt-client-frame" aria-hidden="true"></div>
|
|
176
|
-
<div class="dt-client-tab" inert aria-hidden="true">${
|
|
199
|
+
<div class="dt-client-tab" inert aria-hidden="true">${xt('<circle cx="9" cy="7" r="3" /><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9" /><path d="M14.5 12.5l1.2 1.2 2.3-2.4" />',13)}<span>Client space</span><button type="button" class="dt-client-x" aria-label="Back to Team" data-tip="Back to Team \xB7 M">${xt('<path d="M6 6l8 8M14 6l-8 8" />',10)}</button></div>
|
|
177
200
|
<div class="dt-grid-overlay" hidden>
|
|
178
201
|
<div class="dt-grid-chip"><span></span><button type="button" hidden>Edit</button></div>
|
|
179
|
-
<div class="${f(
|
|
180
|
-
<div class="${f(
|
|
202
|
+
<div class="${f(n.grid.container)} dt-overlay-container" aria-hidden="true">
|
|
203
|
+
<div class="${f(n.grid.grid)} dt-overlay-grid">${H}</div>
|
|
181
204
|
</div>
|
|
182
205
|
</div>
|
|
183
206
|
<div class="dt-pad-overlay" hidden aria-hidden="true"></div>
|
|
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="${
|
|
186
|
-
${
|
|
207
|
+
`)}var Ve=(n,r)=>{let u=r<=0?"":r>=1?"6,0.5 11.5,6 6,11.5 0.5,6":["6,6","6,0.5",...["11.5,6","6,11.5","0.5,6"].slice(0,Math.round(r*4))].join(" ");return`<svg class="dt-stage-icon" viewBox="0 0 12 12" width="12" height="12" aria-hidden="true">${u?`<polygon points="${u}" fill="${n}"/>`:""}<rect x="1.75" y="1.75" width="8.5" height="8.5" rx="1.5" fill="none" stroke="${n}" stroke-width="1.5" transform="rotate(45 6 6)"/></svg>`};var Fc=[{id:"general",label:"General",color:"#0d99ff",icon:'<path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect x="3" y="14" width="7" height="7" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/>'},{id:"bug",label:"Bug",color:"#e5484d",icon:'<path d="m8 2 1.88 1.88M14.12 3.88 16 2M9 7.13v-1a3 3 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6M12 20v-9M6.53 9C4.6 8.8 3 7.1 3 5M6 13H2M3 21c0-2.1 1.7-3.9 3.8-4M20.97 5c0 2.1-1.6 3.8-3.5 4M22 13h-4M17.2 17c2.1.1 3.8 1.9 3.8 4"/>'},{id:"text",label:"Text",color:"#f5c451",icon:'<path d="M4 7V4h16v3M9 20h6M12 4v16"/>'},{id:"motion",label:"Motion",color:"#a475f9",icon:'<path d="M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2M9.6 4.6A2 2 0 1 1 11 8H2M12.6 19.4A2 2 0 1 0 14 16H2"/>'},{id:"design",label:"Design",color:"#d6409f",icon:'<path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.97 6.01 17.46 2 12 2z"/><circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/>'},{id:"content",label:"Content",color:"#30a46c",icon:'<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4M10 9H8M16 13H8M16 17H8"/>'}],jc=(n,r=14)=>`<svg viewBox="0 0 24 24" width="${r}" height="${r}" fill="none" stroke="${n.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n.icon}</svg>`,Is=n=>Fc.find(r=>r.id===n)||Fc[0];var Dt=n=>n.status!=="done"?"open":n.doneBy==="claude"?"claude":"done",_c={open:"Open",done:"Resolved",claude:"To check"};var ee={ready:Promise.resolve(),toggle:(n,r)=>{ee.ready.then(()=>document.documentElement.classList.toggle(n,r))},set:(n,r)=>{ee.ready.then(()=>document.documentElement.style.setProperty(n,r))}};var th=/([?&#;](?:[^=&#;]*(?:token|key|secret|passw|auth|session|sig|code|jwt|credential)[^=&#;]*)=)[^&#;\s]*/gi,Wc=n=>String(n??"").replace(/(\/\/)[^/@\s]+@/g,"$1\u2022\u2022\u2022@").replace(th,"$1\u2022\u2022\u2022").replace(/\b(Bearer|Basic|Token)\s+[\w.~+/=-]+/gi,"$1 \u2022\u2022\u2022").replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/g,"\u2022\u2022\u2022");var ps=[],$r=n=>{if(n instanceof Error)return`${n.name}: ${n.message}`;if(typeof n=="string")return n;try{return JSON.stringify(n)??String(n)}catch{return String(n)}},eh=/ResizeObserver loop/,us=(n,r)=>{if(eh.test(r))return;let u=Zt(Wc(r.replace(/\s+/g," ").trim()),500),p=ps.findIndex(g=>g.kind===n&&g.text.replace(/ ×\d+$/,"")===u);if(p>=0){let[g]=ps.splice(p,1),b=Number(/ ×(\d+)$/.exec(g.text)?.[1]??1)+1;ps.push({at:new Date().toISOString(),kind:n,text:`${u} \xD7${b}`});return}ps.push({at:new Date().toISOString(),kind:n,text:u}),ps.length>50&&ps.shift()},zc=!1;function Vc(n){if(zc||typeof window>"u")return;zc=!0;let r=console.error;console.error=(...g)=>{us("console",g.map($r).join(" ")),r.apply(console,g)},addEventListener("error",g=>{if(g instanceof ErrorEvent)return us("error",`${g.message}${g.filename?` (${g.filename}:${g.lineno})`:""}`);let b=g.target,E=b?.src||b?.href;E&&!n(E)&&us("network",`${b.tagName?.toLowerCase()} ${E} did not load`)},!0),addEventListener("unhandledrejection",g=>us("rejection",$r(g.reason)));let u=window.fetch;window.fetch=async(g,b)=>{let E=typeof g=="string"?g:g instanceof URL?g.href:g.url,H=(b?.method||(g instanceof Request?g.method:"GET")).toUpperCase();try{let y=await u.call(window,g,b);return y.status>=400&&!n(E)&&us("network",`${H} ${E} \u2192 ${y.status}`),y}catch(y){throw!n(E)&&y?.name!=="AbortError"&&us("network",`${H} ${E} \u2192 no answer (${$r(y)})`),y}};let p=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(g,b,...E){return this._nm=`${g.toUpperCase()} ${String(b)}`,this.addEventListener("loadend",()=>{(this.status>=400||this.status===0)&&(n(String(b))||us("network",`${this._nm} \u2192 ${this.status||"no answer"}`))}),p.call(this,g,b,...E)}}var Gc=(n=Date.now())=>ps.filter(r=>n-Date.parse(r.at)<10*6e4).slice(-20);function Kc(n){let r=L=>{let w=parseFloat(getComputedStyle(document.documentElement).fontSize)/16,C=L/w;return Math.round(C*10)%10===0?String(Math.round(C)):C.toFixed(1)},u=(L,w,C,q,F,wt="p")=>{if(C<=0||q<=0)return"";let $t=F!==""?`<span class="dt-pad-chip dt-pad-chip--${wt}" style="left:${L+C/2}px;top:${w+q/2}px">${F}</span>`:"";return`<span class="dt-pad-zone dt-pad-zone--${wt}" style="left:${L}px;top:${w}px;width:${C}px;height:${q}px"></span>${$t}`},p=["paddingTop","paddingRight","paddingBottom","paddingLeft","marginTop","marginRight","marginBottom","marginLeft","columnGap","rowGap"],g="button, a, input, select, textarea, label, [role='button']",b=L=>{let w=L;for(let C=0;w&&C<6;C++,w=w.parentElement){if(w.matches(g))return w;let q=getComputedStyle(w);if(p.some(F=>parseFloat(q[F])>=2))return w}return L},E=(L,w)=>{let C=parseFloat(w.columnGap)||0,q=parseFloat(w.rowGap)||0;if(!(w.display.includes("flex")||w.display.includes("grid"))||!C&&!q)return"";let F=[...L.children].map(ot=>ot.getBoundingClientRect()).filter(ot=>ot.width||ot.height),wt="",$t=(ot,et)=>r(Math.abs(ot-et)<=1?et:ot);for(let ot=1;ot<F.length;ot++){let et=F[ot-1],ct=F[ot];if(C&&ct.left>=et.right-1){let ft=Math.max(et.top,ct.top);wt+=u(et.right,ft,ct.left-et.right,Math.min(et.bottom,ct.bottom)-ft,$t(ct.left-et.right,C),"g")}else if(q&&ct.top>=et.bottom-1){let ft=Math.min(et.left,ct.left);wt+=u(ft,et.bottom,Math.max(et.right,ct.right)-ft,ct.top-et.bottom,$t(ct.top-et.bottom,q),"g")}}return wt},H=L=>`<span class="dt-pad-outline" style="left:${L.left}px;top:${L.top}px;width:${L.width}px;height:${L.height}px"></span>`,y=(L,w,C="")=>`<span class="dt-pad-tag" style="left:${w.left}px;top:${Math.max(2,w.top-22)}px">${L.tagName.toLowerCase()+(L.classList[0]?"."+L.classList[0]:"")}${C}</span>`,T=L=>{let w=L.getBoundingClientRect(),C=getComputedStyle(L),q=parseFloat(C.paddingTop),F=parseFloat(C.paddingRight),wt=parseFloat(C.paddingBottom),$t=parseFloat(C.paddingLeft),ot=H(w);ot+=u(w.left,w.top,w.width,q,q>=2?r(q):""),ot+=u(w.left,w.bottom-wt,w.width,wt,wt>=2?r(wt):""),ot+=u(w.left,w.top+q,$t,w.height-q-wt,$t>=2?r($t):""),ot+=u(w.right-F,w.top+q,F,w.height-q-wt,F>=2?r(F):"");let et=parseFloat(C.marginTop),ct=parseFloat(C.marginRight),ft=parseFloat(C.marginBottom),Nt=parseFloat(C.marginLeft);ot+=u(w.left,w.top-et,w.width,et,et>=2?r(et):"","m"),ot+=u(w.left,w.bottom,w.width,ft,ft>=2?r(ft):"","m"),ot+=u(w.left-Nt,w.top,Nt,w.height,Nt>=2?r(Nt):"","m"),ot+=u(w.right,w.top,ct,w.height,ct>=2?r(ct):"","m"),ot+=E(L,C);let ye=parseFloat(C.columnGap)||0,Ie=parseFloat(C.rowGap)||0,xe=(C.display.includes("flex")||C.display.includes("grid"))&&(ye||Ie)?` \xB7 gap ${r(ye)}${Ie&&Ie!==ye?"/"+r(Ie):""}`:"",Gt="",ce=L.parentElement;if(L.matches(g)&&ce){let he=getComputedStyle(ce);ot+=E(ce,he);let Oe=parseFloat(he.columnGap)||parseFloat(he.rowGap)||0;Gt=` \xB7 ${r(w.width)}\xD7${r(w.height)}${Oe&&(he.display.includes("flex")||he.display.includes("grid"))?` \xB7 gap ${r(Oe)} in its row`:""}`}let Se=Gt?"":` \xB7 ${Math.round(parseFloat(r(w.width)))} \xD7 ${Math.round(parseFloat(r(w.height)))}`;n.innerHTML=ot+y(L,w,Se+xe+Gt)},x=L=>{let w=L.getBoundingClientRect();n.innerHTML=H(w).replace("dt-pad-outline","dt-pad-outline dt-size-line")+`<span class="dt-pad-chip dt-size-chip" style="left:${w.left+w.width/2}px;top:${w.bottom+6}px">${Math.round(parseFloat(r(w.width)))} \xD7 ${Math.round(parseFloat(r(w.height)))}</span>`},D=L=>{let w=(L.match(/[\d.]+/g)||[]).map(Number);if(w.length<3)return L;let C="#"+w.slice(0,3).map(q=>Math.round(q).toString(16).padStart(2,"0")).join("");return w[3]!==void 0&&w[3]<1?`${C} \xB7 ${Math.round(w[3]*100)}%`:C},dt=null,J=()=>{if(dt)return dt;let L=getComputedStyle(document.documentElement),w=document.createElement("span");w.style.display="none",document.body.append(w);let C=[];for(let q of Array.from(L)){if(!q.startsWith("--"))continue;let F=L.getPropertyValue(q).trim();if(!/^(#|rgb|hsl|oklch|lab|color\(|light-dark\()/i.test(F))continue;w.style.color="rgb(1, 2, 3)",w.style.color=F;let wt=getComputedStyle(w).color;wt&&wt!=="rgb(1, 2, 3)"&&C.push([wt,q])}return w.remove(),C.sort((q,F)=>q[1].length-F[1].length),dt=C,C},tt=L=>J().find(([w])=>w===L)?.[1]??"",O=null,St=()=>{if(O)return O;let L=[],w=C=>{for(let q of Array.from(C))q instanceof CSSStyleRule?q.style.cssText.includes("var(--")&&L.push({sel:q.selectorText,style:q.style}):q instanceof CSSMediaRule?matchMedia(q.conditionText).matches&&w(q.cssRules):"cssRules"in q&&w(q.cssRules)};for(let C of Array.from(document.styleSheets))try{w(C.cssRules)}catch{}return O=L},Wt={color:["color"],"background-color":["background-color","background"],...Object.fromEntries(["top","right","bottom","left"].map(L=>[`border-${L}-color`,[`border-${L}-color`,"border-color",`border-${L}`,"border"]]))},Tt=(L,w)=>{let C=Wt[w]??[w],q=w==="color";for(let F=L;F;F=q?F.parentElement:null){let wt=et=>C.map(ct=>/var\(\s*(--[\w-]+)/.exec(et.getPropertyValue(ct))?.[1]).find(Boolean),$t=F instanceof HTMLElement?wt(F.style):void 0;if($t)return $t;let ot="";for(let et of St()){let ct=!1;try{ct=F.matches(et.sel)}catch{}ct&&(ot=wt(et.style)||ot)}if(ot)return ot;if(q&&F.parentElement&&getComputedStyle(F).color!==getComputedStyle(F.parentElement).color)break}return""},at=(L,w,C)=>{let q=getComputedStyle(L).getPropertyValue(w).trim();if(!q)return D(C);let F=document.createElement("span");if(F.style.display="none",F.style.color=q,!F.style.color)return D(C);document.body.append(F);let wt=getComputedStyle(F).color;return F.remove(),D(wt)},vt=(L,w,C)=>{let q=Tt(L,w);if(q)return`<b class="dt-var">${q}</b> <em>${at(L,q,C)}</em>`;let F=tt(C);return F?`<span title="Same value as ${F}; not written with it">\u2248 ${F}</span> <em>${D(C)}</em>`:D(C)},Ft=L=>`<i class="dt-type-sw" style="background:${L}"></i>`,zt={100:"Thin",200:"Extra Light",300:"Light",400:"Regular",500:"Medium",600:"Semi Bold",700:"Bold",800:"Extra Bold",900:"Black"},Lt=L=>(L.match(/[\d.]+/g)??[]).map(Number).concat([1]).slice(0,4),ne=(L,w)=>L.slice(0,3).map((C,q)=>C*L[3]+w[q]*(1-L[3])).concat([1]),be=L=>{let w=[];for(let C=L;C;C=C.parentElement){let q=getComputedStyle(C);if(q.backgroundImage!=="none")return null;let F=Lt(q.backgroundColor);if(F[3]>0&&(w.push(F),F[3]>=1))break}return w.reduceRight((C,q)=>ne(q,C),[255,255,255,1])},re=L=>{let[w,C,q]=L.slice(0,3).map(F=>(F/=255,F<=.03928?F/12.92:((F+.055)/1.055)**2.4));return .2126*w+.7152*C+.0722*q},me=(L,w,C)=>{let q=be(L);if(!q)return["Contrast","<em>on an image</em>"];let F=ne(Lt(w.color),q),[wt,$t]=[re(F),re(q)].sort((ft,Nt)=>Nt-ft),ot=(wt+.05)/($t+.05),et=C>=24||C>=18.66&&Number(w.fontWeight)>=700,ct=ot>=(et?4.5:7)?"AAA":ot>=(et?3:4.5)?"AA":"fails AA";return["Contrast",`${ot.toFixed(2)}:1 <em class="${ct==="fails AA"?"dt-type-bad":""}">${ct}${et?" \xB7 large":""}</em>`]},S=L=>{let w=L.getBoundingClientRect(),C=getComputedStyle(L),q=parseFloat(C.fontSize),F=C.lineHeight==="normal"?0:parseFloat(C.lineHeight),wt=parseFloat(C.letterSpacing)||0,$t=Nt=>`${(Nt*100).toFixed(1).replace(/\.0$/,"")}%`,ot=[["Font",C.fontFamily.split(",")[0].replace(/["']/g,"")+(C.fontStyle!=="normal"?` ${C.fontStyle}`:"")],["Weight",`${zt[C.fontWeight]??""} <em>${C.fontWeight}</em>`],["Size",`${r(q)}px`],["Line",F?`${$t(F/q)} <em>${r(F)}px</em>`:"normal"],["Letter",wt?`${$t(wt/q)} <em>${wt.toFixed(2).replace(/\.?0+$/,"")}px</em>`:"0"],["Color",Ft(C.color)+vt(L,"color",C.color)],me(L,C,q)],ct=w.bottom+150<innerHeight?w.bottom+8:Math.max(8,w.top-158),ft=Math.min(Math.max(8,w.left),innerWidth-210);n.innerHTML=H(w)+y(L,w)+`<div class="dt-type-card" style="left:${ft}px;top:${ct}px">${ot.map(([Nt,ye])=>`<span class="dt-type-row"><b>${Nt}</b><span>${ye}</span></span>`).join("")}</div>`},k=L=>L.every(w=>w===L[0])?L[0]:L[1]===L[3]&&L[0]===L[2]?`${L[0]} ${L[1]}`:L.join(" "),W=L=>/^rgba\(.*,\s*0\)$|^transparent$/.test(L),U=(L,w,C,q="")=>{let F=20+C.length*21,$t=w.bottom+F+12<innerHeight?w.bottom+8:Math.max(8,w.top-F-8),ot=Math.min(Math.max(8,w.left),innerWidth-230);n.innerHTML=`<span class="dt-pad-outline" style="left:${w.left}px;top:${w.top}px;width:${w.width}px;height:${w.height}px${q?`;border-radius:${q}`:""}"></span>`+y(L,w)+`<div class="dt-type-card dt-style-card" style="left:${ot}px;top:${$t}px">${C.map(([et,ct])=>`<span class="dt-type-row"><b>${et}</b><span>${ct}</span></span>`).join("")}</div>`},$=L=>{let w=getComputedStyle(L),C=[];w.backgroundImage!=="none"&&C.push(["Fill",`<em>${/gradient/.test(w.backgroundImage)?"gradient":"image"}</em>`]),W(w.backgroundColor)||C.push(["Fill",Ft(w.backgroundColor)+vt(L,"background-color",w.backgroundColor)]),L.textContent?.trim()&&C.push(["Text",Ft(w.color)+vt(L,"color",w.color)]),C.push(["Opacity",`${Math.round(Number(w.opacity)*100)}%`]),C.length||C.push(["Color","<em>no fill or text</em>"]),U(L,L.getBoundingClientRect(),C)},I=L=>{let w=getComputedStyle(L),C=[],q=["top","right","bottom","left"],F=q.map($t=>parseFloat(w.getPropertyValue(`border-${$t}-width`))||0);if(F.some($t=>$t>0)){let $t=q.filter((et,ct)=>F[ct]>0);q.forEach((et,ct)=>C.push([et[0].toUpperCase()+et.slice(1),`${r(F[ct])} <em>${w.getPropertyValue(`border-${et}-style`)}</em>`]));let ot=$t.map(et=>w.getPropertyValue(`border-${et}-color`));$t.forEach((et,ct)=>{ct&&ot[ct]===ot[0]||C.push([ct?`\u21B3 ${et}`:"Color",Ft(ot[ct])+vt(L,`border-${et}-color`,ot[ct])])})}else C.push(["Width","<em>none</em>"]);let wt=["top-left","top-right","bottom-right","bottom-left"].map($t=>{let[ot,et=ot]=w.getPropertyValue(`border-${$t}-radius`).split(" "),ct=ft=>ft.endsWith("%")?ft:r(parseFloat(ft)||0);return ot===et?ct(ot):`${ct(ot)}/${ct(et)}`});C.push(["Radius",k(wt)]),U(L,L.getBoundingClientRect(),C,w.borderRadius)},ht=(L,w)=>{let[C,q]=[re(L),re(w)].sort((F,wt)=>wt-F);return(C+.05)/(q+.05)},At=L=>"#"+L.slice(0,3).map(w=>Math.round(w).toString(16).padStart(2,"0")).join(""),Ht=(L,w,C)=>{let[q,F,wt]=L.map(xe=>xe/255),$t=Math.max(q,F,wt),ot=Math.min(q,F,wt),et=($t+ot)/2,ct=$t-ot,ft=ct?ct/(1-Math.abs(2*et-1)):0,Nt=ct?$t===q?((F-wt)/ct%6+6)%6:$t===F?(wt-q)/ct+2:(q-F)/ct+4:0,ye=xe=>{let Gt=(1-Math.abs(2*xe-1))*ft,ce=Gt*(1-Math.abs(Nt%2-1)),Se=xe-Gt/2,[he,Oe,gs]=Nt<1?[Gt,ce,0]:Nt<2?[ce,Gt,0]:Nt<3?[0,Gt,ce]:Nt<4?[0,ce,Gt]:Nt<5?[ce,0,Gt]:[Gt,0,ce];return[he,Oe,gs].map(Hn=>Math.min(255,Math.max(0,Math.round((Hn+Se)*255)))).concat([1])},Ie=re(L)>=re(w);for(let xe of Ie?[1,-1]:[-1,1]){let Gt=xe>0?1:0;if(ht(ye(Gt),w)<C)continue;let ce=et,Se=Gt;for(let he=0;he<20;he++){let Oe=(ce+Se)/2;ht(ye(Oe),w)>=C?Se=Oe:ce=Oe}return ye(Se)}return null},gt={half:'<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><circle cx="6" cy="6" r="4.5" fill="none" stroke="currentColor" stroke-width="0.9"/><path d="M6 1.5a4.5 4.5 0 0 1 0 9z" fill="currentColor"/></svg>',x:'<svg class="dt-ct-no" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M3 3l5 5M8 3l-5 5" stroke="currentColor" stroke-width="1.1" stroke-linecap="round"/></svg>',ok:'<svg class="dt-ct-ok" viewBox="0 0 11 11" width="11" height="11" aria-hidden="true"><path d="M2.2 5.8 4.4 8l4.4-5" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"/></svg>',copy:'<svg viewBox="0 0 11 11" width="11" height="11" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="0.9"><rect x="4" y="4" width="6" height="6" rx="1.2"/><path d="M7 2.5V2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h.5"/></svg>'},Et=L=>`${L.toFixed(1).replace(/\.0$/,"")} : 1`,Q="",se=null,jt=!1,Bt=L=>{L!==se&&(se=L,jt=!1),Q="";let w=L.getBoundingClientRect(),C=(L instanceof HTMLInputElement||L instanceof HTMLTextAreaElement)&&!L.value&&!!L.placeholder,q=getComputedStyle(L,C?"::placeholder":null),F=parseFloat(q.fontSize),wt=F>=24||F>=18.66&&Number(q.fontWeight)>=700,$t=be(L),ot=ft=>`<i class="dt-type-sw" style="background:${ft}"></i>`,et;if(!L.textContent?.trim()&&!C&&!(L instanceof HTMLInputElement&&L.value))et='<p class="dt-ct-note">Point at some text.</p>';else if(!$t)et='<p class="dt-ct-note">It sits on an image or a gradient: there is no one colour behind it to measure.</p>';else{let ft=ne(Lt(q.color),$t),Nt=ht(ft,$t),ye=wt?3:4.5,Ie=Nt>=7?["ok",gt.ok+"AAA"]:Nt>=4.5?["ok",gt.ok+"AA"]:Nt>=3?["warn","Large text only"]:["bad","Fails"],xe=`<div class="dt-ct-ratio"><b>${Et(Nt)}</b><span class="dt-ct-chip dt-ct-chip--${Ie[0]}">${Ie[1]}</span></div>`;if(Nt>=7){et=xe,n.innerHTML=H(w)+y(L,w,C?" \xB7 placeholder":"")+Un(w,41,`<div class="dt-ct-card dt-ct-card--one">${et}</div>`);return}let Gt=(Se,he)=>`<div class="dt-ct-check">${Nt>=he?gt.ok:gt.x}<span>${Se}</span><em>${Et(he).replace(".0","")}</em></div>`,ce=Nt>=ye?null:Ht(ft,$t,ye);ce&&(Q=At(ce)),et=`<div class="dt-ct-pair"><div><span>Text</span><b>${ot(At(ft))}${At(ft)}</b></div><div><span>Background</span><b>${ot(At($t))}${At($t)}</b></div></div>`+xe+Gt("Body text \xB7 AA",4.5)+Gt("Large text \xB7 AA",3)+Gt("Body text \xB7 AAA",7)+(Q?jt?`<div class="dt-ct-fix dt-ct-fix--done">${gt.ok}<span>Copied ${Q}</span></div>`:`<div class="dt-ct-fix"><span>Passes AA at</span><b>${ot(Q)}${Q}</b>${gt.copy}</div>`:"")}let ct=`<div class="dt-ct-card"><div class="dt-ct-head">${gt.half}<span>Contrast</span></div>${et}</div>`;n.innerHTML=H(w)+y(L,w,C?" \xB7 placeholder":"")+Un(w,210,ct)},Un=(L,w,C)=>{let q=L.bottom+w+12<innerHeight?L.bottom+8:Math.max(8,L.top-w-8),F=Math.min(Math.max(8,L.left),innerWidth-260);return C.replace(/^<div class="([^"]+)"/,`<div class="$1" style="left:${F}px;top:${q}px"`)};return{spacer:b,drawPads:T,drawSize:x,drawType:S,drawColor:$,drawBorder:I,drawContrast:Bt,contrastFix:()=>Q,markCopied:()=>{jt=!0}}}var ie=n=>(n??"").replace(/[\u200B-\u200D\uFEFF\u2060]/g,"").trim(),Uc=(n,r,u=!1)=>{for(let p=r*4;;p*=4){let g=u?ie(n.slice(0,p)).replace(/\s+/g," "):ie(n.slice(0,p));if(g.length>=r||p>=n.length)return g}},Os=(n,r,u=!1)=>Zt(Uc(n,r,u),r),Yc='[class^="dt-"],[class*=" dt-"],.devtools',Tn=n=>{let r=n;for(;r.parentElement&&r.parentElement!==document.body;)r=r.parentElement;return r.parentElement===document.body&&r.matches(Yc)};function Xc(){let n=(S,k)=>S?[...S.children].filter(W=>W.tagName.toUpperCase()===k.toUpperCase()&&!(S===document.body&&W.matches(Yc))):[],r=S=>{let k=[],W=S;for(;W&&W.tagName!=="HTML"&&k.length<8;){if(W.id){k.unshift("#"+CSS.escape(W.id));break}let U=W.parentElement,$=W.tagName.toLowerCase(),I=n(U,W.tagName),ht=U===document.body&&I.length>1?[...W.classList].find(At=>/^[\w-]+$/.test(At)&&I.filter(Ht=>Ht.classList.contains(At)).length===1):void 0;k.unshift(ht?`${$}.${ht}`:I.length>1?`${$}:nth-of-type(${I.indexOf(W)+1})`:$),W=U}return k.join(">")},u=S=>{let k=S.split(">"),W=null;for(let[U,$]of k.entries()){if($.startsWith("#")){if(U)return null;W=document.querySelector($);continue}let I=/^([a-z][a-z0-9-]*)(?:\.([\w-]+))?(?::nth-of-type\((\d+)\))?$/.exec($);if(!I)return document.querySelector(S);if(!W){if(I[1]!=="body"||I[2]||I[3])return document.querySelector(S);W=document.body;continue}let ht=n(W,I[1].toUpperCase());if(W=(I[2]?ht.find(At=>At.classList.contains(I[2])):ht[I[3]?Number(I[3])-1:0])??null,!W)return null}return W},p=S=>S.replace(/\s+/g," ").trim(),g=(S,k)=>{if(!k)return!0;let W=Uc(S.textContent||"",60),U=p(k);return p(Zt(W,60))===U||p(W.slice(0,60))===U},b=(S,k)=>[S||"*",...(k||[]).map(W=>"."+CSS.escape(W))].join(""),E=S=>{try{return[...document.querySelectorAll(b(S.tag,S.classes))].filter(k=>!Tn(k))}catch{return[]}},H=S=>{for(let k of S.classes??[]){let W=E({tag:S.tag,classes:[k]});if(W.length)return W}return E({tag:S.tag}).slice(0,400)},T=S=>{let k=S.textContent||"",W=null;for(let U=S.parentElement,$=0;U&&U!==document.body&&$<4;U=U.parentElement,$++){let I=U.textContent||"";if(I===k)continue;let ht=Os(I,80,!0);if(ht&&(ht!==Os(k,80,!0)||(W??=ie(k).replace(/\s+/g," "),ie(I).replace(/\s+/g," ")!==W)))return ht}return""},x=S=>T(S),D=(S,k,W=120)=>Zt(ie(S.getAttribute(k)),W)||void 0,dt=S=>{for(let k=S.parentElement,W=0;k&&k!==document.body&&W<4;k=k.parentElement,W++){let U=k.querySelector("h1,h2,h3,h4,h5,h6,[role=heading]");if(U&&U!==S&&!S.contains(U))return Os(U.textContent||"",60,!0)||void 0}},J=S=>{let k=W=>W?Os(W.textContent||"",30,!0):"";return(k(S.previousElementSibling)+"|"+k(S.nextElementSibling)).replace(/^\|$/,"")||void 0},tt=/^data-(testid|test-id|test|qa|cy|id|key|slug|name|item)$/,O=S=>{let k=[...S.attributes].find(U=>tt.test(U.name)&&U.value),W=(S.getAttribute("src")||S.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)||void 0;return Object.fromEntries(Object.entries({id:S.id?Zt(S.id,80):void 0,data:k?`${k.name}=${Zt(k.value,80)}`:void 0,aria:D(S,"aria-label"),alt:D(S,"alt"),title:D(S,"title"),src:W,href:D(S,"href"),head:dt(S),sib:J(S)}).filter(([,U])=>U))},St=(S,k)=>!k||T(S).startsWith(k),Wt=new WeakMap,Tt=S=>Wt.get(S)??"found",at=S=>{let k=S.fp,W=null;try{W=u(S.selector)}catch{}let U=E(S),$=U.length?U:H(S),I=new Set($.slice(0,400));if(W&&!Tn(W)&&I.add(W),k.id){let gt=document.getElementById(k.id);gt&&I.add(gt)}if(k.data){let[gt,Et]=k.data.split(/=(.*)/s);try{document.querySelectorAll(`[${gt}="${CSS.escape(Et)}"]`).forEach(Q=>I.add(Q))}catch{}}let ht=null,At=null,Ht=0;for(let gt of I){if(Tn(gt))continue;let Et=k.id&>.id===k.id||k.data&>.getAttribute(k.data.split("=")[0])===k.data.split(/=(.*)/s)[1]?35:0,Q=ie(S.label)&&g(gt,S.label)||k.aria&&D(gt,"aria-label")===k.aria||k.alt&&D(gt,"alt")===k.alt||k.title&&D(gt,"title")===k.title||k.href&&D(gt,"href")===k.href||k.src&&(gt.getAttribute("src")||gt.querySelector?.("img")?.getAttribute("src")||"").split("?")[0].slice(-120)===k.src?25:0,se=k.head&&dt(gt)===k.head||k.sib&&J(gt)===k.sib||S.ctx&&T(gt).startsWith(S.ctx)?15:0,jt=Et+Q+se,Bt=jt+(gt===W?40:0)+(S.nth!=null&&$[S.nth]===gt?5:0);jt||(Bt=Math.min(Bt,39)),Q&&(Ht++,At={el:gt,score:Bt}),(!ht||Bt>ht.score)&&(ht={el:gt,score:Bt})}return At&&Ht===1&&At.score<40&&(!ht||ht.score<40)?{el:At.el,score:40}:ht},vt=S=>{let k=Ft(S),W=null;if(k){try{W=u(S.selector)}catch{}return Wt.set(S,k===W?"found":"moved"),k}let U=S.fp?at(S):null;return U&&U.score>=40?(Wt.set(S,U.score>=70?"moved":"probably"),U.el):(Wt.set(S,"gone"),null)},Ft=S=>{let k=null;try{k=u(S.selector)}catch{k=null}if(k&&Tn(k)&&(k=null),k&&g(k,S.label)&&St(k,S.ctx))return k;let W=E(S),U=W.length?W:H(S),$=ie(S.label)?U.filter(Ht=>g(Ht,S.label)):[],I=(S.ctx?$.find(Ht=>St(Ht,S.ctx)):$.length===1?$[0]:void 0)??(S.ctx&&!ie(S.label)?W.find(Ht=>St(Ht,S.ctx)):void 0);if(I)return I;if(S.ctx&&$.length===1&&p(ie(S.label)).length>=20)return $[0];let ht=Ht=>Ht.split(">").slice(0,2).join(">"),At=Ht=>!S.ctx&&ht(r(Ht))===ht(S.selector);return ie(S.label)?k&&!S.ctx&&g(k,S.label)?k:$.length===1&&At($[0])?$[0]:null:k||(S.nth!=null?W[S.nth]??null:null)},zt=S=>{let k=null;for(let W=S,U=S.parentElement;U&&U!==document.body&&getComputedStyle(W).position!=="fixed";W=U,U=U.parentElement){let $=getComputedStyle(U);if($.overflowX==="visible"&&$.overflowY==="visible")continue;let I=U.getBoundingClientRect();k=k?{l:Math.max(k.l,I.left),t:Math.max(k.t,I.top),r:Math.min(k.r,I.right),b:Math.min(k.b,I.bottom)}:{l:I.left,t:I.top,r:I.right,b:I.bottom}}return k},Lt=S=>{let k=S.getBoundingClientRect();return(k.width>0||k.height>0)&&(!S.checkVisibility||S.checkVisibility({opacityProperty:!0,visibilityProperty:!0}))},ne=S=>({...S,x:Math.min(Math.max(S.x,3),document.documentElement.clientWidth-30),y:S.y>=0&&S.y<19?19:S.y}),be=(S,k)=>{let W=k;for(let U=k.parentElement;U&&U!==document.body;U=U.parentElement){if(!Lt(U)){W=U;continue}let $=k.getBoundingClientRect();if($.width||$.height)return ne({x:$.left+$.width*S.rx,y:$.top+$.height*S.ry,el:k,hidden:U,shut:W});let I=U.getBoundingClientRect();return ne({x:I.left,y:I.top,el:k,hidden:U,shut:W})}return null},re=S=>{let k=S.opener?Ft(S.opener):null;if(!k||!Lt(k))return null;let W=k.getBoundingClientRect();return ne({x:W.right-4,y:W.top+4,el:k,opener:k})};return{cssPath:r,poolOf:E,contextOf:x,resolveEl:vt,anchorOf:(S,k=vt(S))=>{if(!k)return re(S);if(!Lt(k))return re(S)??be(S,k);let W=k.getBoundingClientRect(),U=W.left+W.width*S.rx,$=W.top+W.height*S.ry,I=zt(k);return I?U<I.l||U>I.r||$<I.t||$>I.b?null:{x:U,y:$,el:k}:{x:U,y:$,el:k}},anchorState:Tt,fingerprintOf:O}}var Jc=(n,r)=>`<svg class="dt-bars" viewBox="0 0 18 11" width="18" height="11" aria-hidden="true">${[0,1,2,3].map(u=>`<rect x="${u*5}" y="${6-u*2}" width="3" height="${5+u*2}" rx="1" fill="${u<n?r:"#fff"}" stroke="none"${u<n?"":' opacity="0.12"'}/>`).join("")}</svg>`;function Zc(n,r,u){let p=document.createElement("div");p.className="dt-field-menu",p.setAttribute("role","listbox"),p.hidden=!0,document.body.append(p);for(let E of["pointerdown","mousedown","pointerup","mouseup","click","focusin","focusout"])p.addEventListener(E,H=>H.stopPropagation());let g=null,b=()=>{p.hidden=!0,g=null};for(let E of n)E.addEventListener("mousedown",H=>{let y=H.target.closest(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select");if(!y){p.contains(H.target)||b();return}if(H.preventDefault(),g===y){b();return}g=y;let T=y.classList.contains("dt-more-select"),x=O=>T?O.dataset.on!=null:O.selected,D=y.dataset.search;p.innerHTML=(D?`<label class="dt-field-search"><svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg><input type="search" placeholder="${r(D)}" aria-label="${r(D)}" spellcheck="false"></label>`:"")+[...y.options].map((O,St)=>O.hidden?"":O.dataset.head!=null?`<p class="dt-field-head">${r(O.text)}${O.dataset.note?`<small>${r(O.dataset.note)}</small>`:""}</p>`:`${O.dataset.sep!=null?"<hr>":""}<button type="button" role="option" data-i="${St}" aria-selected="${x(O)}"${O.disabled?" disabled":""}${O.dataset.hint?` data-tip="${r(O.dataset.hint)}" data-hint="${r(O.dataset.hint.toLowerCase())}"`:""}${O.dataset.danger!=null?' class="is-danger"':""}>${O.dataset.icon?O.dataset.icon:O.dataset.initial!=null?O.dataset.face?`<img class="dt-face" src="${r(O.dataset.face)}" alt="">`:`<b class="dt-face" aria-hidden="true">${r(O.dataset.initial)}</b>`:O.dataset.bare!=null?"":`<i style="background:${r(O.dataset.c||"#717171")}"></i>`}<span>${r(O.text)}</span>${O.dataset.note?`<small>${r(O.dataset.note)}</small>`:""}${x(O)?u:""}</button>${O.dataset.sepAfter!=null?"<hr>":""}`).join("")+(D?'<p class="dt-field-none" hidden></p>':""),p.classList.toggle("is-people",!!D);let dt=y.parentElement.getBoundingClientRect(),J=D?y.closest(".dt-note, .dt-hist-row")?.getBoundingClientRect():void 0;p.style.left=`${J?J.left+4:dt.left}px`,p.style.top=`${dt.bottom+4}px`,p.style.minWidth=`${J?J.width-8:Math.max(200,dt.width)}px`,p.style.width=J?`${J.width-8}px`:"",p.hidden=!1;for(let O of p.querySelectorAll("[data-hint]")){let St=O.querySelector("span");St.scrollWidth>St.clientWidth&&(O.dataset.tip=`${St.textContent} \xB7 ${O.dataset.tip}`)}let tt=p.getBoundingClientRect();(tt.bottom>innerHeight-8||D&&y.closest(".dt-note"))&&(p.style.top=`${Math.max(8,dt.top-4-tt.height)}px`),tt.right>innerWidth-8&&(p.style.left=`${Math.max(8,dt.right-tt.width)}px`),p.querySelector(".dt-field-search input")?.focus()});p.addEventListener("input",E=>{let H=E.target.value.trim().toLowerCase(),y=0;for(let x of p.querySelectorAll("[data-i]"))x.hidden=!!H&&!x.textContent.toLowerCase().includes(H)&&!x.dataset.hint?.includes(H),x.hidden||y++;for(let x of p.querySelectorAll("hr"))x.hidden=!!H;let T=p.querySelector(".dt-field-none");T&&(T.hidden=y>0,T.textContent=`No one matches \xAB${E.target.value.trim()}\xBB`)}),p.addEventListener("keydown",E=>{E.key!=="Enter"||!E.target.matches("input")||(E.preventDefault(),p.querySelector("[data-i]:not([hidden])")?.click())}),p.addEventListener("click",E=>{let H=E.target.closest("[data-i]");if(!H||!g)return;let y=g;b(),!(y.selectedIndex===Number(H.dataset.i)&&!y.classList.contains("dt-more-select"))&&(y.selectedIndex=Number(H.dataset.i),y.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("keydown",E=>{E.key==="Escape"&&!p.hidden&&(E.stopPropagation(),b())},!0),document.addEventListener("pointerdown",E=>{!p.hidden&&!p.contains(E.target)&&!E.target.closest?.(".dt-cat-select, .dt-for-select, .dt-owner-select, .dt-status-select, .dt-more-select, .dt-lang-select")&&b()},!0),addEventListener("scroll",E=>{p.contains(E.target)||b()},!0)}var Gn=()=>!matchMedia("(prefers-reduced-motion: reduce)").matches,An=n=>Promise.allSettled(n.getAnimations({subtree:!0}).filter(r=>r.effect?.getComputedTiming().iterations!==1/0).map(r=>r.finished)),xo=new WeakMap,Kn=(n,r)=>{let u=xo.has(n);xo.set(n,r),!u&&(n.setAttribute("data-leaving",""),An(n).then(()=>{let p=xo.get(n);p&&(xo.delete(n),n.removeAttribute("data-leaving"),p())}))},Eo=n=>{xo.delete(n),n.removeAttribute("data-leaving")},Qc=n=>{let r=n.cloneNode(!0);for(let u of["id","data-id","data-draft","data-parked"])r.removeAttribute(u);r.setAttribute("data-ghost",""),r.setAttribute("aria-hidden","true"),r.inert=!0,n.after(r),An(r).then(()=>r.remove())},Mo=(n,r)=>{n.removeAttribute("data-nudge"),n.offsetWidth,n.setAttribute("data-nudge",r),An(n).then(()=>{n.getAttribute("data-nudge")===r&&n.removeAttribute("data-nudge")})},tu=n=>{let r=getComputedStyle(document.documentElement).getPropertyValue(n).trim(),u=r.indexOf(" ");return{duration:parseFloat(r)*(/^[\d.]+s$/.test(r.slice(0,u))?1e3:1),easing:r.slice(u+1)}},Ca=(n,r,u=1/0)=>{let p=n.hidden?0:Math.min(n.offsetHeight,u),g=n.hidden?"0":getComputedStyle(n).opacity;n.getAnimations().forEach(y=>y.cancel()),n.hidden=!1;let b=r?Math.min(n.scrollHeight,u):0,E=()=>{n.hidden=!r};if(!Gn()||p===b)return E();let H=n.animate([{height:`${p}px`,opacity:g,overflow:"hidden"},{height:`${b}px`,opacity:r?1:0,overflow:"hidden"}],{...tu(r?"--dt-smooth":"--dt-snappy"),fill:"forwards"});H.onfinish=()=>{E(),H.cancel()}},xr=(n,r,u,p,g)=>{if(n.getAnimations().forEach(E=>E.cancel()),!Gn()||Math.abs(r-u)<1)return g();let b=n.animate([{height:`${r}px`,overflow:"hidden"},{height:`${u}px`,overflow:"hidden"}],{...tu(p?"--dt-smooth":"--dt-snappy"),fill:"forwards"});b.onfinish=()=>{g(),b.cancel()}};var nh=".devtools, [class^='dt-'], [class*=' dt-']",sh=300,eu=null,nu=n=>{eu=n};function su(){let n=document.createElement("div");n.className="dt-tipbox",n.setAttribute("role","tooltip"),n.id="dt-tipbox",n.hidden=!0,document.body.append(n);let r=null,u,p=0,g=T=>{let x=T.getAttribute("title");x!==null&&(T.removeAttribute("title"),T.hasAttribute("data-tip")||T.setAttribute("data-tip",x),!T.hasAttribute("aria-label")&&!T.textContent?.trim()&&T.setAttribute("aria-label",x))},b=T=>{let x=T?.closest?.("[data-tip], [title]");return x&&x.closest(nh)&&!x.closest(".dt-tipbox")?x:null},E=T=>{let x=T.getAttribute("data-tip");if(!x||T.getAttribute("aria-expanded")==="true")return H();let D=eu?.(T);n.classList.toggle("is-peek",!!D),D?n.innerHTML=D:n.textContent=x,Eo(n),n.hidden=!1,n.style.left="0px",n.style.top="0px";let dt=T.getBoundingClientRect(),J=n.getBoundingClientRect(),tt=6,O=8;if(D){let Wt=dt.right+8+J.width<=innerWidth-O;n.style.left=`${Wt?dt.right+8:Math.max(O,dt.left-8-J.width)}px`,n.style.top=`${Math.min(Math.max(O,dt.top-4),innerHeight-O-J.height)}px`,T.setAttribute("aria-describedby",n.id);return}let St=dt.bottom+tt+J.height<=innerHeight-O;n.style.top=`${St?dt.bottom+tt:Math.max(O,dt.top-tt-J.height)}px`,n.style.left=`${Math.min(Math.max(O,dt.left+dt.width/2-J.width/2),innerWidth-O-J.width)}px`,n.classList.toggle("is-mono",T.classList.contains("dt-note-el")),T.setAttribute("aria-describedby",n.id)},H=()=>{clearTimeout(u),r&&!n.hidden&&(p=performance.now()+400),r?.removeAttribute("aria-describedby"),r=null,n.hidden||Kn(n,()=>{n.hidden=!0})},y=T=>{T!==r&&(H(),g(T),r=T,performance.now()<p?E(T):u=setTimeout(()=>r===T&&E(T),sh))};document.addEventListener("pointerover",T=>{let x=b(T.target);x?y(x):r&&!r.contains(T.target)&&H()},!0),document.addEventListener("pointerout",T=>{r&&!r.contains(T.relatedTarget)&&H()},!0),document.addEventListener("focusin",T=>{let x=T.target,D=b(x);D&&x.matches(":focus-visible")&&y(D)},!0),document.addEventListener("focusout",H,!0),document.addEventListener("pointerdown",H,!0),document.addEventListener("keydown",T=>{T.key==="Escape"&&H()},!0),addEventListener("scroll",H,!0),new MutationObserver(()=>{r&&(!r.isConnected||r.getAttribute("aria-expanded")==="true")&&H()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-expanded"]})}var pt={signal:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><rect x="1" y="12" width="3.2" height="5" rx="1"/><rect x="5.6" y="9" width="3.2" height="8" rx="1"/><rect x="10.2" y="6" width="3.2" height="11" rx="1"/><rect x="14.8" y="3" width="3.2" height="14" rx="1"/></svg>',wifi:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><path d="M10 16.6 7.4 13.8a3.7 3.7 0 0 1 5.2 0z"/><path d="M4.8 11.1a7.4 7.4 0 0 1 10.4 0l-1.3 1.4a5.5 5.5 0 0 0-7.8 0z"/><path d="M2.2 8.3a11.1 11.1 0 0 1 15.6 0l-1.3 1.4a9.2 9.2 0 0 0-13 0z"/></svg>',battery:'<svg viewBox="0 0 28 14" class="dt-i dt-i--batt"><rect x="1" y="1" width="23" height="12" rx="3.5" fill="none" stroke="currentColor" stroke-opacity=".4"/><rect x="3" y="3" width="17" height="8" rx="2" fill="currentColor"/><path d="M26 5v4a2 2 0 0 0 0-4z" fill="currentColor" fill-opacity=".4"/></svg>',back:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4 6.5 10l6 6"/></svg>',fwd:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M7.5 4l6 6-6 6"/></svg>',reload:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9"/><path d="M14.2 3.2v3.2H11"/></svg>',dots:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="4.5" cy="10" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="15.5" cy="10" r="1.6"/></svg>',dotsV:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="4.5" r="1.6"/><circle cx="10" cy="10" r="1.6"/><circle cx="10" cy="15.5" r="1.6"/></svg>',share:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 12.5V2.8M6.8 5.8 10 2.6l3.2 3.2"/><path d="M6.5 8.5H5a1.5 1.5 0 0 0-1.5 1.5v6A1.5 1.5 0 0 0 5 17.5h10a1.5 1.5 0 0 0 1.5-1.5v-6A1.5 1.5 0 0 0 15 8.5h-1.5"/></svg>',plus:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M10 4v12M4 10h12"/></svg>',tabs:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="3" y="6" width="11" height="11" rx="2"/><path d="M6 3.5h8.5A2.5 2.5 0 0 1 17 6v8.5"/></svg>',sidebar:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="2.5" y="4" width="15" height="12" rx="2"/><path d="M8 4v12"/></svg>',lock:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="9" width="10" height="8" rx="1.8"/><path d="M7 9V6.5a3 3 0 0 1 6 0V9"/></svg>',tune:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3 6.5h8M15 6.5h2M3 13.5h2M9 13.5h8"/><circle cx="13" cy="6.5" r="2"/><circle cx="7" cy="13.5" r="2"/></svg>',star:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m10 3 2.1 4.4 4.8.6-3.5 3.3.9 4.7L10 13.7 5.7 16l.9-4.7L3.1 8l4.8-.6z" stroke-linejoin="round"/></svg>',user:'<svg viewBox="0 0 20 20" class="dt-i dt-i--fill"><circle cx="10" cy="10" r="8" fill-opacity=".25"/><circle cx="10" cy="8" r="3"/><path d="M4.8 15.3a6 6 0 0 1 10.4 0 7.9 7.9 0 0 1-10.4 0z"/></svg>',recent:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5.5 5v10M10 5v10M14.5 5v10"/></svg>',home:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="4.5" y="4.5" width="11" height="11" rx="3.5"/></svg>',navBack:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M12.5 4.5 7 10l5.5 5.5"/></svg>',close:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m5.5 5.5 9 9m0-9-9 9"/></svg>',winMin:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M5 10h10"/></svg>',winMax:'<svg viewBox="0 0 20 20" class="dt-i"><rect x="5" y="5" width="10" height="10" rx="1.5"/></svg>',chevUp:'<svg viewBox="0 0 20 20" class="dt-i"><path d="m6 12 4-4 4 4"/></svg>',volume:'<svg viewBox="0 0 20 20" class="dt-i"><path d="M3.5 8v4h3l4 3.5v-11l-4 3.5z" stroke-linejoin="round"/><path d="M13.5 7.5a3.5 3.5 0 0 1 0 5"/></svg>'},Er=(n,r)=>n.toLocaleTimeString("en-US",r),Na=n=>Er(n,{hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?[AP]M$/,""),oh={island:n=>({side:12,top:12,bottom:12,r:n.w>=430?62:55,body:n.w>=430?74:67,extraW:6}),home:()=>({side:18,top:92,bottom:92,r:0,body:56,extraW:6}),punch:()=>({side:9,top:9,bottom:9,r:34,body:43,extraW:6}),tablet:()=>({side:26,top:26,bottom:26,r:18,body:44}),macbook:n=>({side:16,top:18,bottom:24,r:10,rb:0,body:20,extraW:Math.round((n.w+32)*.12),extraH:18}),laptop:n=>({side:12,top:14,bottom:28,r:4,rb:0,body:12,extraW:Math.round((n.w+24)*.08),extraH:16}),monitor:()=>({side:12,top:12,bottom:34,r:0,body:10,extraH:96})};function ah(n,r,u,p,g){let b=n.w+2*r.side,E=n.h+r.top+r.bottom,H=(u-b)/2,y=`<rect class="dt-shell-screen" x="${g}" y="${r.top}" width="${n.w}" height="${n.h}" rx="${r.r}"/>`,T="";if(n.shell==="island"||n.shell==="home"||n.shell==="punch"){let x=(D,dt,J)=>`<rect class="dt-shell-btn" x="${D}" y="${dt}" width="4" height="${J}" rx="2"/>`;T+=n.shell==="punch"?x(H+b-1,150,70)+x(H+b-1,240,44):x(H-3,120,28)+x(H-3,170,56)+x(H-3,236,56)+x(H+b-1,190,90),T+=`<rect class="dt-shell-body" x="${H}" y="0" width="${b}" height="${E}" rx="${r.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${H+3}" y="3" width="${b-6}" height="${E-6}" rx="${r.body-3}"/>`,n.shell==="home"&&(T+=`<rect class="dt-shell-slot" x="${u/2-26}" y="44" width="52" height="6" rx="3"/>`,T+=`<circle class="dt-shell-slot" cx="${u/2-48}" cy="47" r="5"/>`,T+=`<circle class="dt-shell-homebtn" cx="${u/2}" cy="${E-46}" r="28"/>`)}else if(n.shell==="tablet")T+=`<rect class="dt-shell-body dt-shell-body--light" x="${H}" y="0" width="${b}" height="${E}" rx="${r.body}"/>`,T+=`<rect class="dt-shell-bezel" x="${H+4}" y="4" width="${b-8}" height="${E-8}" rx="${r.body-4}"/>`;else if(n.shell==="monitor"){let x=Math.round(b*.1);T+=`<path class="dt-shell-stand" d="M${u/2-x/2} ${E-2}h${x}l${x*.2} 84h${-x*1.4}z"/>`,T+=`<rect class="dt-shell-stand" x="${u/2-b*.15}" y="${E+80}" width="${b*.3}" height="14" rx="7"/>`,T+=`<rect class="dt-shell-body" x="${H}" y="0" width="${b}" height="${E}" rx="${r.body}"/>`}else{let x=b+(r.extraW??0),D=(u-x)/2,dt=r.extraH??16;T+=`<path class="dt-shell-body" d="M${H} ${r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${-r.body}h${b-2*r.body}a${r.body} ${r.body} 0 0 1 ${r.body} ${r.body}V${E}H${H}z"/>`,T+=`<path class="dt-shell-base${n.shell==="macbook"?" dt-shell-base--silver":""}" d="M${D} ${E}h${x}v${dt-8}a8 8 0 0 1-8 8H${D+8}a8 8 0 0 1-8-8z"/>`,T+=`<rect class="dt-shell-lip" x="${u/2-b*.07}" y="${E}" width="${b*.14}" height="5" rx="2.5"/>`}return`<svg viewBox="0 0 ${u} ${p}" width="${u}" height="${p}" aria-hidden="true">${T}${y}</svg>`}var ih={"safari-ios":n=>{let r=n.shell==="home"?20:n.w>=400?62:59;return{top:r,bottom:98,topMin:r,bottomMin:58}},"chrome-android":()=>({top:92,bottom:48,topMin:36,bottomMin:48}),"safari-ipad":()=>({top:74,bottom:20}),"safari-mac":()=>({top:85,bottom:59}),"chrome-windows":()=>({top:87,bottom:48})},rh=({d:n,now:r,cutout:u},p)=>{if(n.shell==="home")return`<div class="dt-sb dt-sb--mini" style="height:${p}px"><span class="dt-sb-l">${pt.signal}${pt.wifi}</span><b>${Na(r)}</b><span class="dt-sb-r">${pt.battery}</span></div>`;let g=u??{x:(n.w-125)/2,y:11,width:125,height:37};return`<div class="dt-sb" style="height:${p}px"><span class="dt-island" style="left:${g.x}px;top:${g.y}px;width:${g.width}px;height:${g.height}px"></span><b class="dt-sb-time" style="top:${g.y}px;height:${g.height}px">${Na(r)}</b><span class="dt-sb-icons" style="top:${g.y}px;height:${g.height}px">${pt.signal}${pt.wifi}${pt.battery}</span></div>`},lh=({d:n,host:r,min:u},p)=>{let g=n.shell==="home"?"":'<i class="dt-home-ind"></i>';return u?`<div class="dt-ios-bar is-min" style="height:${p}px"><span class="dt-ios-mini">${f(r)}</span>${g}</div>`:`<div class="dt-ios-bar" style="height:${p}px"><div class="dt-ios-row"><button class="dt-glass dt-glass--round" data-nav="back" aria-label="Back" title="Back">${pt.back}</button><span class="dt-glass dt-ios-url"><span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-glass dt-glass--round">${pt.dots}</span></div>${g}</div>`},dh=({now:n,min:r},u)=>`<div class="dt-sb dt-sb--android" style="height:36px"><b>${Er(n,{hour:"numeric",minute:"2-digit",hour12:!1})}</b><span class="dt-punch"></span><span class="dt-sb-r">${pt.wifi}${pt.signal}${pt.battery}</span></div>`+(r?"":`<div class="dt-and-bar"><span class="dt-and-url">${pt.tune}<span>${f(u)}</span></span><span class="dt-and-tabs">1</span>${pt.dotsV}</div>`),ch=()=>`<div class="dt-and-nav">${pt.recent}${pt.home}${pt.navBack}</div>`,uh=({now:n,host:r})=>`<div class="dt-sb dt-sb--flat" style="height:24px"><b>${Na(n)} ${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}</b><span class="dt-sb-r">${pt.wifi}${pt.battery}</span></div><div class="dt-ipad-bar"><span class="dt-bar-group">${pt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${pt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${pt.fwd}</button></span><span class="dt-ipad-url">${pt.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-bar-group">${pt.share}${pt.plus}${pt.tabs}</span></div>`,ph=({now:n,host:r},u)=>'<div class="dt-mac-menu"><span class="dt-mac-apps"><b>Safari</b><span>File</span><span>Edit</span><span>View</span><span>History</span><span>Bookmarks</span><span>Window</span><span>Help</span></span>'+(u?'<span class="dt-mac-notch"></span>':"")+`<span class="dt-sb-r">${pt.wifi}${pt.battery}<span>${n.toLocaleDateString("en-US",{weekday:"short",day:"numeric",month:"short"})} ${Na(n)}</span></span></div><div class="dt-mac-bar"><span class="dt-lights"><i></i><i></i><i></i></span><span class="dt-bar-group">${pt.sidebar}<button data-nav="back" aria-label="Back" title="Back">${pt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${pt.fwd}</button></span><span class="dt-mac-url">${pt.lock}<span>${f(r)}</span><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-bar-group">${pt.share}${pt.plus}${pt.tabs}</span></div>`,mh=()=>`<div class="dt-mac-dock"><span class="dt-dock">${Array.from({length:9},(n,r)=>`<i style="--hue:${r*40}"></i>`).join("")}</span></div>`,hh=({host:n,title:r})=>`<div class="dt-win-tabs"><span class="dt-win-tab"><i class="dt-fav"></i><span>${f(r||n)}</span>${pt.close}</span><span class="dt-win-new">${pt.plus}</span><span class="dt-win-ctrl">${pt.winMin}${pt.winMax}${pt.close}</span></div><div class="dt-win-bar"><span class="dt-bar-group"><button data-nav="back" aria-label="Back" title="Back">${pt.back}</button><button data-nav="fwd" aria-label="Forward" title="Forward">${pt.fwd}</button><button data-nav="reload" aria-label="Reload" title="Reload">${pt.reload}</button></span><span class="dt-win-url">${pt.tune}<span>${f(n)}</span>${pt.star}</span><span class="dt-bar-group">${pt.user}${pt.dotsV}</span></div>`,gh=({now:n})=>`<div class="dt-win-task"><span class="dt-win-apps">${Array.from({length:6},(r,u)=>`<i style="--hue:${200+u*30}"></i>`).join("")}</span><span class="dt-win-tray">${pt.chevUp}${pt.wifi}${pt.volume}${pt.battery}<span class="dt-win-clock">${Er(n,{hour:"numeric",minute:"2-digit"})}<br>${n.toLocaleDateString("en-US")}</span></span></div>`;function ou(n,r){let u=oh[n.shell](n),p=n.w+2*u.side,g=n.h+u.top+u.bottom,b=p+(u.extraW??0),E=g+(n.shell==="monitor"||n.shell==="macbook"||n.shell==="laptop"?u.extraH??0:0),H=(b-p)/2+u.side,y=ih[n.browser](n),T=r.min?y.topMin??y.top:y.top,x=r.min?y.bottomMin??y.bottom:y.bottom,D={...r,d:n},dt="",J="";switch(n.browser){case"safari-ios":dt=rh(D,T),J=lh(D,x);break;case"chrome-android":dt=dh(D,r.host),J=ch();break;case"safari-ipad":dt=uh(D),J='<div class="dt-ipad-foot"><i class="dt-home-ind"></i></div>';break;case"safari-mac":dt=ph(D,n.shell==="macbook"),J=mh();break;case"chrome-windows":dt=hh(D),J=gh(D);break}return{footprint:{w:b,h:E},screen:{x:H,y:u.top,w:n.w,h:n.h,r:u.r,rb:u.rb??u.r},topH:T,bottomH:x,shell:ah(n,u,b,E,H),top:dt,bottom:J,canMinimize:y.topMin!==void 0&&(y.topMin!==y.top||y.bottomMin!==y.bottom),scrollbar:n.browser==="chrome-windows"?"classic":"overlay"}}var ms=null;function Lo(n){if(ms??=Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),!ms||!n)return[0,0,0,0];ms.clearRect(0,0,1,1),ms.fillStyle="rgba(0, 0, 0, 0)",ms.fillStyle=n,ms.fillRect(0,0,1,1);let[r,u,p,g]=ms.getImageData(0,0,1,1).data;return[r,u,p,g/255]}var ko=([n,r,u])=>`rgb(${n}, ${r}, ${u})`;function au(n){let r=n.defaultView,u=J=>!J||Lo(J)[3]===0,p=[n.body,n.documentElement].map(J=>J&&r.getComputedStyle(J).backgroundColor).find(J=>J&&!u(J)),[g,b,E,H]=p?Lo(p):[255,255,255,1],y=[g,b,E].map(J=>Math.round(J*H+255*(1-H))),T=J=>{let[tt,O,St,Wt]=Lo(J);if(Wt>=.75)return ko([tt,O,St]);let Tt=(at,vt)=>Math.round(at*Wt+vt*(1-Wt));return ko([Tt(tt,y[0]),Tt(O,y[1]),Tt(St,y[2])])},x=J=>{let tt=n.elementFromPoint(r.innerWidth/2,J);for(;tt&&tt!==n.documentElement;tt=tt.parentElement){let O=r.getComputedStyle(tt);if(O.position!=="fixed"&&O.position!=="sticky")continue;let St=tt.getBoundingClientRect().width>=r.innerWidth*.9,Wt=O.backdropFilter&&O.backdropFilter!=="none";return St&&!Wt&&!u(O.backgroundColor)?T(O.backgroundColor):null}return null},D=n.querySelector('meta[name="theme-color"]')?.content||"",dt=D&&!u(D)?ko(Lo(D)):"";return{top:x(4)??ko(y),bottom:x(r.innerHeight-4)??ko(y),theme:dt}}function Mr(n){let[r,u,p]=Lo(n).map(g=>g/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4);return .2126*r+.7152*u+.0722*p>.4?"#000":"#fff"}function iu(n){let{cfg:r,inFrame:u,persist:p,frame:g,frameEl:b,devicesMenu:E,bpBtns:H,notesOverlay:y,WIDE:T,bpOf:x,currentBp:D,deviceById:dt,notesOn:J,filter:tt,filterTo:O,dropFrameDrafts:St,putAway:Wt,tellFrame:Tt,syncBpButtons:at,render:vt,reread:Ft}=n,zt=r.breakpoints,Lt=document.querySelector(".dt-device"),ne=document.querySelector(".dt-shell"),be=document.querySelector('.dt-chrome[data-at="top"]'),re=document.querySelector('.dt-chrome[data-at="bottom"]'),me=document.querySelector(".dt-ruler"),S=[...document.querySelectorAll(".dt-frame-handle")],k=document.querySelector(".dt-frame-size"),W=document.querySelector(".dt-frame-rotate"),U=document.querySelector(".dt-frame-bars"),$="overlay",I="",ht="dt-w",At="dt-canvas",Ht="dt-device",gt=mt.getItem(At)==="1",Et=mt.getItem(Ht)||"";Et&&!dt(Et)&&(Et="",mt.setItem(Ht,""));let Q=Number(mt.getItem(ht))||0,se="dt-emu",jt=(()=>{try{return JSON.parse(mt.getItem(se)||"null")}catch{return null}})(),Bt=()=>jt?wo.find(R=>R.id===jt.id)??null:null,Un=()=>{let R=Bt();return R?jt.turned?{w:R.h,h:R.w}:{w:R.w,h:R.h}:null},dn=mt.getItem("dt-bars-min")==="1",Le=R=>{jt=R,p(se,R?JSON.stringify(R):"")},L=R=>{k.textContent=R,g.style.setProperty("--dt-badge-w",`${k.offsetWidth}px`)},w=R=>{if(!R){me.innerHTML="";return}let P="";for(let Y=0;Y<=R;Y+=50)P+=`<span class="dt-tick${Y%200===0?" is-major":""}" style="left:${Y}px"></span>`;for(let Y of zt)for(let Pt of[Y.min,Y.max])Pt>0&&Number.isFinite(Pt)&&Pt<=R&&(P+=`<span class="dt-edge" style="left:${Pt}px" title="${Y.label} edge"></span>`);me.innerHTML=P,me.style.width=`${R}px`},C=()=>{let R=parseFloat(Lt.style.width)||0,P=parseFloat(Lt.style.height)||0;if(!R||!P){Lt.style.transform="",delete Lt.dataset.scaled;return}let Y=Et||jt?Math.min(1,(innerWidth-80)/R,(innerHeight-120)/P):Math.min(1,(innerWidth-80)/R);Lt.style.transform=Y<1?`scale(${Y})`:"",Lt.dataset.scaled=Y<1?String(Math.round(Y*100)):""},q=R=>wo.find(P=>P.w===R.w&&P.h===R.h&&P.cutout?.shape==="pill")?.cutout,F=()=>{try{return b.contentDocument}catch{return null}},wt=()=>F()?.title.split("\u2014").pop()?.trim()||"",$t=()=>{let R=F(),P=Et?dt(Et):null;if(!R?.body||!P)return;let Y=au(R),Pt=P.browser==="chrome-android"?Y.theme||"rgb(255, 255, 255)":Y.top,Yt=P.browser==="chrome-android"?"rgb(255, 255, 255)":Y.bottom;Lt.style.setProperty("--dt-top",Pt),Lt.style.setProperty("--dt-top-ink",Mr(Pt)),Lt.style.setProperty("--dt-bottom",Yt),Lt.style.setProperty("--dt-bottom-ink",Mr(Yt));let ve=be.querySelector(".dt-win-tab > span");ve&&(ve.textContent=wt()||location.host)},ot=0;b.addEventListener("load",()=>{let R=F();if(!R)return;let P=window.__notemendHosted;if(P&&!b.contentWindow?.__notemendHosted&&!R.querySelector(`script[src^="${P.base}/bar.js"]`)){let Y=R.createElement("script");Y.src=`${P.base}/bar.js`,Y.dataset.project=P.project,R.head.append(Y)}$t(),b.contentWindow?.addEventListener("scroll",()=>{ot||(ot=requestAnimationFrame(()=>{ot=0,$t()}))},{passive:!0})});for(let R of[be,re])R.addEventListener("click",P=>{let Y=P.target.closest("[data-nav]")?.dataset.nav;if(Y)try{let Pt=b.contentWindow?.navigation;if(!F()||!Pt)throw new Error("foreign");Y==="back"?Pt.canGoBack&&Pt.back():Y==="fwd"?Pt.canGoForward&&Pt.forward():Pt.reload()}catch{(Y==="reload"||Y==="back")&&(b.src=location.href)}});U.addEventListener("click",()=>{dn=!dn,p("dt-bars-min",dn?"1":"0"),ft()});let et=[],ct=R=>{for(let P of et)P.inert=!1;et=R?[...document.body.children].filter(P=>P instanceof HTMLElement&&!P.inert&&!P.matches('[class^="dt-"], [class*=" dt-"], .devtools')):[];for(let P of et)P.inert=!0},ft=()=>{if(u)return;let R=Et?dt(Et)??null:null;if(Et&&!R&&(Et="",mt.setItem(Ht,"")),!R&&!gt){let P="";try{let Y=b.getAttribute("src")?b.contentWindow?.location:null;Y?.origin===location.origin&&(P=Y.pathname+Y.search+Y.hash)}catch{}if(g.hidden=!0,ct(!1),b.removeAttribute("src"),ee.toggle("dt-framing",!1),y.hidden=!J(),me.innerHTML="",at(),W.hidden=!0,U.hidden=!0,O(null),I="",St(),at(),Se(),P&&P!==location.pathname+location.search+location.hash){location.assign(P);return}Ft();return}if(g.hidden=!1,ct(!0),ee.toggle("dt-framing",!0),y.hidden=!0,b.src||(b.src=location.href),R){let P=ou(R,{host:location.host,title:wt(),now:new Date,min:dn,cutout:q(R)}),{screen:Y}=P;g.dataset.mode="device",Lt.dataset.shell=R.shell,Lt.dataset.browser=R.browser,Lt.style.width=`${P.footprint.w}px`,Lt.style.height=`${P.footprint.h}px`,Lt.style.setProperty("--dt-r",`${Y.r}px`),Lt.style.setProperty("--dt-rb",`${Y.rb}px`),ne.innerHTML=P.shell;let Pt=(rt,ge,Yn,Xn)=>{rt.innerHTML=Xn,rt.style.cssText=`left:${Y.x}px;top:${ge}px;width:${Y.w}px;height:${Yn}px`};Pt(be,Y.y,P.topH,P.top),Pt(re,Y.y+Y.h-P.bottomH,P.bottomH,P.bottom);let Yt=Y.h-P.topH-P.bottomH;b.style.position="absolute",b.style.left=`${Y.x}px`,b.style.top=`${Y.y+P.topH}px`,b.style.width=`${Y.w}px`,b.style.height=`${Yt}px`,me.innerHTML="";let ve=dn&&P.canMinimize;$=P.scrollbar,I=`${R.label}${ve?" \xB7 bars folded":""}`,O(x(R.w)),Tt({notes:J(),scrollbar:$,device:I}),U.hidden=!P.canMinimize,U.setAttribute("aria-pressed",String(ve)),L(`${R.label} ${R.w}\xD7${R.h} \xB7 page ${R.w}\xD7${Yt}${ve?" \xB7 bars folded":""} \xB7 ${zt.find(rt=>rt.id===tt())?.label??""}`),$t()}else{let P=Un();P||Le(null);let Y=P?.w||Q||zt.find(ve=>ve.id===D()).ideal;Q=Y,g.dataset.mode="canvas",delete Lt.dataset.shell,delete Lt.dataset.browser,ne.innerHTML=be.innerHTML=re.innerHTML="",be.style.cssText=re.style.cssText="",U.hidden=!0,$="overlay",Lt.style.width=`${Y}px`,Lt.style.height=`${P?.h??innerHeight-84}px`,b.style.position="",b.style.left=b.style.top="",b.style.width="100%",b.style.height="100%",w(Y),Tt({notes:J()});let Pt=zt.find(ve=>ve.id===x(Y)),Yt=Bt();I=Yt?`${Yt.label}${jt?.turned?" \xB7 landscape":""}`:"",Tt({scrollbar:$,device:I}),L(Yt&&P?`${Yt.label} \xB7 ${P.w}\xD7${P.h} \xB7 ${Pt.label}`:`${Y}px \xB7 ${Pt.label}`),O(x(Y))}W.hidden=!(Bt()?.rotates&&!R),Se(),C(),at(),Ft()},Nt=R=>{let P=zt.find(Y=>Y.id===R);Et="",mt.setItem(Ht,""),Le(null),gt=D()!==R,Q=gt?P.ideal:0,O(gt?R:null),mt.setItem(At,gt?"1":"0"),mt.setItem(ht,String(Q)),Wt(),ft()};for(let R of H)R.addEventListener("click",()=>Nt(R.dataset.bp));for(let R of document.querySelectorAll("[data-device]"))R.addEventListener("click",()=>{Et=R.dataset.device===Et?"":R.dataset.device,mt.setItem(Ht,Et),E.open=!1,ft()});for(let R of document.querySelectorAll("[data-emu]"))R.addEventListener("click",()=>{let P=jt?.id===R.dataset.emu&&!Et;Et="",mt.setItem(Ht,""),Le(P?null:{id:R.dataset.emu,turned:!1}),gt=!P,Q=0,mt.setItem(At,gt?"1":"0"),O(null),Wt(),E.open=!1,ft()});W.addEventListener("click",()=>{jt&&(Le({...jt,turned:!jt.turned}),Wt(),ft())});let ye=[...E.querySelectorAll("[data-tab]")],Ie=[...E.querySelectorAll("[data-panel]")],xe=R=>{for(let P of ye)P.setAttribute("aria-selected",String(P.dataset.tab===R));for(let P of Ie)P.hidden=P.dataset.panel!==R;p("dt-devices-tab",R)};for(let R of ye)R.addEventListener("click",()=>xe(R.dataset.tab));xe(mt.getItem("dt-devices-tab")==="devtools"?"devtools":"preview");let Gt=E.querySelector(".dt-emu-search");Gt.addEventListener("input",()=>{let R=Gt.value.trim().toLowerCase(),P=null,Y=!1,Pt=()=>{P&&(P.hidden=!Y)};for(let Yt of Gt.parentElement.children){if(Yt.classList.contains("dt-devices-group")){Pt(),P=Yt,Y=!1;continue}Yt.dataset.emu&&(Yt.hidden=!!R&&!Yt.textContent.toLowerCase().includes(R),Y||=!Yt.hidden)}Pt()});let ce=E.querySelector(".dt-devices-name");function Se(){for(let P of E.querySelectorAll("[data-device]"))P.setAttribute("aria-pressed",String(P.dataset.device===Et));let R=!Et&&!g.hidden?jt?.id:void 0;for(let P of E.querySelectorAll("[data-emu]"))P.setAttribute("aria-pressed",String(P.dataset.emu===R));ce.textContent=Et&&dt(Et)?.label||R&&Bt()?.label||"Device"}let he=R=>zt.find(P=>P.id===R),Oe=R=>{let P=he(tt()??D());return Math.max(P.min||320,Math.min(Number.isFinite(P.max)?P.max:2560,Math.round(R)))};for(let R of S){let P=R.dataset.edge==="l"?-1:1;R.addEventListener("pointerdown",Y=>{if(Et)return;Y.preventDefault(),jt&&(Le(null),ft()),R.setPointerCapture(Y.pointerId);let Pt=Y.clientX,Yt=Q,ve=Number(Lt.dataset.scaled||100)/100;g.dataset.dragging="1";let rt=Yn=>{Q=Oe(Yt+P*(Yn.clientX-Pt)*2/ve),Lt.style.width=`${Q}px`,w(Q),L(`${Q}px \xB7 ${he(x(Q)).label}`),C()},ge=()=>{R.removeEventListener("pointermove",rt),R.removeEventListener("pointerup",ge),R.removeEventListener("pointercancel",ge),delete g.dataset.dragging,mt.setItem(ht,String(Q)),ft()};R.addEventListener("pointermove",rt),R.addEventListener("pointerup",ge),R.addEventListener("pointercancel",ge)}),R.addEventListener("dblclick",()=>{if(Et)return;Le(null);let Y=he(tt()??D()),Pt=[Y.min||320,Number.isFinite(Y.max)?Y.max:Y.ideal];Q=Math.abs(Q-Pt[0])<Math.abs(Q-Pt[1])?Pt[0]:Pt[1],mt.setItem(ht,String(Q)),ft()})}let gs=D(),Hn=()=>{let R=zt.find(P=>P.id===T);return gt&&!Et&&!jt&&Q===R.ideal&&innerWidth>=R.min};return addEventListener("resize",()=>{if(Hn()){Nt(T);return}at(),D()!==gs&&(gs=D(),vt()),g.hidden||(!Et&&!jt&&(Lt.style.height=`${innerHeight-84}px`),C())}),{apply:ft,pickBp:Nt,look:()=>({scrollbar:$,device:I}),restore:()=>{Hn()?Nt(T):gt||Et?ft():Se()}}}var ru='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="5" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.2" fill="currentColor" stroke="none"/><circle cx="15" cy="10" r="1.2" fill="currentColor" stroke="none"/></svg>',lu='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><path d="m13.2 13.2 3.3 3.3"/></svg>',fh='<svg viewBox="0 0 20 20" width="10" height="10" aria-hidden="true"><rect x="3" y="3" width="14" height="14" rx="3"/><path d="M10 3v14"/></svg>',bh='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M4 6h12M6.5 10h7M9 14h2"/></svg>';function du(n){let{bp:r,notes:u,breakpoints:p,bandOfNote:g,showResolved:b,showArchived:E,drafts:H,find:y}=n,T=u.filter($=>g($)===r),x=$=>[$.text,$.note,$.byName,...($.replies??[]).filter(I=>!I.deleted).map(I=>I.text)].join(" ").toLowerCase(),D=$=>y.view==="me"?n.forMe($):y.view==="agent"?n.forAgent($):!0,dt=$=>Date.parse($.updatedAt||$.createdAt||"")||0,J=$=>Date.parse($.createdAt||"")||0,tt=T.filter($=>D($)&&(!y.q||x($).includes(y.q.trim().toLowerCase()))).sort(($,I)=>y.sort==="old"?J($)-J(I):y.sort==="new"?J(I)-J($):(y.sort==="unread"?Number(n.unread(I))-Number(n.unread($)):0)||dt(I)-dt($)),O={open:[],claude:[],done:[],archived:[]};for(let $ of tt)O[Dt($)==="done"&&n.archived($)?"archived":Dt($)].push($);let St=$=>{let I=Dt($),ht=n.orphan($),At=n.unread($),Ht=n.picking&&n.pickable($),gt=!!Ht&&n.picking.has($.id),Et=n.mirror($),Q=zn($.updatedAt||$.createdAt),se=Et?`<i class="dt-hist-mirror"${Et==="there"?` data-tip="In Team too \xB7 ${f(Q)}"`:' data-tip="A client\u2019s thread, mirrored into Team"'}>${fh}Mirrored</i>`:"";return`<div class="dt-hist-row is-${I}${I==="done"?n.archived($)?" is-archived":" is-resolved":""}${ht?" is-orphan":""}${At?" is-unread":""}${n.menuFor===$.id?" is-menu":""}${gt?" is-picked":""}${n.picking&&!Ht?` is-unpickable${Et?" is-dim":""}`:""}">
|
|
208
|
+
<button class="dt-hist-go" data-go="${$.id}" data-tip="${f($.text.slice(0,80))}"${Ht?` role="checkbox" aria-checked="${gt}"`:""}>
|
|
209
|
+
${Ht?`<span class="dt-hist-pick" aria-hidden="true"><i class="dt-hist-box">${gt?$e:""}</i></span>`:n.marker($)}
|
|
187
210
|
<span class="dt-hist-body">
|
|
188
|
-
<span class="dt-hist-id"><b class="dt-hist-who">${f(
|
|
189
|
-
<span class="dt-hist-text">${
|
|
211
|
+
<span class="dt-hist-id"><b class="dt-hist-who">${f($.byName||"You")}</b>${se}${Et==="there"?"":`<em>\xB7 ${Q}</em>`}${At?'<i class="dt-hist-new" aria-label="New messages"></i>':""}</span>
|
|
212
|
+
<span class="dt-hist-text">${f($c($.text||$.note))}</span>${n.replied($)}
|
|
190
213
|
</span>
|
|
191
214
|
</button>
|
|
192
|
-
|
|
193
|
-
</div>`},
|
|
194
|
-
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${
|
|
195
|
-
><svg viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${
|
|
196
|
-
<button class="dt-hist-go" data-draft-go="${
|
|
197
|
-
|
|
215
|
+
<span class="dt-note-tools dt-hist-tools">${n.tick($)}${n.assign($)}<button type="button" class="dt-hist-more" data-row-more="${$.id}" aria-label="More" aria-haspopup="menu" aria-expanded="${n.menuFor===$.id}">${ru}</button>${n.rowMenu($)}</span>
|
|
216
|
+
</div>`},Wt=p.map($=>{let I=u.filter(ht=>g(ht)===$.id&&Dt(ht)!=="done");return{band:$,open:I.filter(ht=>Dt(ht)==="open").length,total:I.length}}).filter($=>$.total&&$.band.id!==r),Tt=Wt.length?`<i class="dt-hist-sep"></i><div class="dt-hist-bands">${Wt.map(({band:$,open:I,total:ht})=>{let At=`${$.label}: ${I} open \xB7 ${ht-I} to check`;return`<button data-bp="${$.id}" data-state="${I?"open":"claude"}" title="${At}" aria-label="${At}"
|
|
217
|
+
><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true">${$.icon}</svg><i>${ht}</i></button>`}).join("")}</div>`:"",at=["open","claude","done","archived"],vt={..._c,archived:"Archived"},Ft=($,I,ht)=>`<button type="button" class="dt-hist-gfold" data-gfold="${$}" aria-expanded="${!n.shut($)}"
|
|
218
|
+
>${zt[$]??""}${I}<em>${ht}</em><svg class="dt-hist-chev" viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="${n.shut($)?"m9 18 6-6-6-6":"m6 9 6 6 6-6"}"/></svg></button>`,zt={open:Ve("#0d99ff",0),claude:Ve("#8e4ec6",.5),done:Ve("#30a46c",1),archived:Ve("#717171",1)},Lt=n.cap,ne=at.filter($=>O[$].length&&($==="done"?b:$==="archived"?E:!0)),be=$=>`<div class="dt-hist-row is-draft">
|
|
219
|
+
<button class="dt-hist-go" data-draft-go="${$.i}">
|
|
220
|
+
${n.draftFace||`<span class="dt-hist-n">${Vn}</span>`}
|
|
198
221
|
<span class="dt-hist-body">
|
|
199
|
-
<span class="dt-hist-id">${f(
|
|
200
|
-
<span class="dt-hist-text">${
|
|
222
|
+
<span class="dt-hist-id">${n.draftFace?`<b class="dt-hist-who">${f(n.draftName)}</b><em>\xB7 draft \xB7 ${f($.el)}</em>`:f($.el)}${$.orphan?'<b class="dt-hist-orphan" title="The element this was pinned to is not on the page right now">no pin</b>':""}</span>
|
|
223
|
+
<span class="dt-hist-text">${$.text?f($.text):`${$.shots} screenshot${$.shots===1?"":"s"}`}</span>
|
|
201
224
|
</span>
|
|
202
|
-
</button
|
|
203
|
-
<span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${
|
|
204
|
-
</div>`,
|
|
205
|
-
<label class="dt-hist-search">${
|
|
206
|
-
<button type="button" class="dt-tip-r dt-hist-filter${
|
|
207
|
-
${
|
|
208
|
-
</div
|
|
225
|
+
</button>${n.draftFace?`<span class="dt-hist-step" role="img" aria-label="Draft, not sent"><span class="dt-hist-n">${Vn}</span></span>`:""}
|
|
226
|
+
<span class="dt-note-tools dt-hist-tools"><span class="dt-hist-well"><button data-draft-rm="${$.i}" title="Discard this draft">${cs}</button></span></span>
|
|
227
|
+
</div>`,re=T.filter($=>Dt($)!=="done"),me=($,I,ht,At,Ht)=>`<button type="button" role="menuitemradio" aria-checked="${At}" ${$}="${I}"><i>${At?$e:""}</i><span>${ht}</span>${Ht==null?"":`<em>${Ht}</em>`}</button>`,S=()=>`<div class="dt-hist-find">
|
|
228
|
+
<label class="dt-hist-search">${lu}<input type="search" data-hist-q placeholder="Search threads" aria-label="Search threads" value="${f(y.q)}" spellcheck="false">${y.q?`<button type="button" data-hist-clear aria-label="Clear search">${Sn}</button>`:'<kbd aria-hidden="true">/</kbd>'}</label>
|
|
229
|
+
<button type="button" class="dt-tip-r dt-hist-filter${y.view!=="all"?" is-on":""}" data-hist-filter aria-label="Filter and order" aria-expanded="${y.menu}" data-tip="Filter">${bh}</button>
|
|
230
|
+
${y.menu?`<div class="dt-hist-menu" role="menu">${me("data-hist-view","me","For me",y.view==="me",re.filter(n.forMe).length)}${me("data-hist-view","agent","Agent",y.view==="agent",re.filter(n.forAgent).length)}${me("data-hist-view","all","All",y.view==="all",re.length)}</div>`:""}
|
|
231
|
+
</div>`,k=($,I,ht,At)=>`<button type="button" role="menuitemcheckbox" ${$} aria-checked="${I}"><span>${ht}</span><kbd>${At}</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>`,W=$=>$.map(I=>I.id).join(","),U=()=>`<div class="dt-hist-menu is-panel" role="menu">
|
|
232
|
+
<button type="button" role="menuitem" data-read-all><span>Mark all as read</span></button>${O.open.length?`<button type="button" role="menuitem" data-resolve-all="${W(O.open)}"><span>Resolve all open</span><em>${O.open.length}</em></button>`:""}${n.mirrorAll.length?`<button type="button" role="menuitem" data-mirror-all="${n.mirrorAll.join(",")}"><span>Mirror all open to Team</span><em>${n.mirrorAll.length}</em></button>`:""}${n.archives&&O.done.length?`<button type="button" role="menuitem" data-archive-all="${W(O.done)}"><span>Archive all resolved</span><em>${O.done.length}</em></button>`:""}<hr>${k("data-resolved",b,"Show resolved","R")}${n.archives?k("data-archived",E,"Show archived","A"):""}<hr>
|
|
233
|
+
<p class="dt-hist-menu-head">Sort</p>${me("data-hist-sort","new","Newest first",y.sort==="new")}${me("data-hist-sort","old","Oldest first",y.sort==="old")}${me("data-hist-sort","reply","Last reply",y.sort==="reply")}${me("data-hist-sort","unread","Unread first",y.sort==="unread")}</div>`;return`<div class="dt-hist-head">
|
|
209
234
|
<span class="dt-hist-here"
|
|
210
235
|
><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>
|
|
211
236
|
<span class="dt-hist-title">Threads</span>
|
|
212
|
-
${
|
|
213
|
-
${
|
|
214
|
-
${
|
|
215
|
-
<button class="dt-hist-refresh" data-
|
|
216
|
-
|
|
217
|
-
</button>
|
|
218
|
-
<button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel" aria-expanded="${!o.folded}">
|
|
237
|
+
${n.clients?'<span class="dt-hist-space"><svg viewBox="0 0 20 20" width="11" height="11" aria-hidden="true"><circle cx="9" cy="7" r="3"/><path d="M3.5 16.5c.5-2.8 2.7-4.5 5.5-4.5 1.2 0 2.3.3 3.2.9"/><path d="M14.5 12.5l1.2 1.2 2.3-2.4"/></svg>Client</span>':""}
|
|
238
|
+
${Tt}
|
|
239
|
+
${n.checks&&!n.clients?`<button class="dt-review-btn" data-review aria-label="Check all ${n.checks} ${n.checks===1?"fix":"fixes"}" data-tip="${n.checks} ${n.checks===1?"fix waits":"fixes wait"} for a look across every page \u2014 walk through them">${n.checks}</button>`:""}
|
|
240
|
+
<button class="dt-hist-refresh" data-hist-more aria-label="More" aria-haspopup="menu" aria-expanded="${y.more}">${ru}</button>${y.more&&!n.folded?U():""}
|
|
241
|
+
<button class="dt-hist-fold" data-fold aria-label="Collapse or expand the panel" aria-expanded="${!n.folded}">
|
|
219
242
|
<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>
|
|
220
243
|
</button>
|
|
221
|
-
</div>`+(
|
|
222
|
-
|
|
244
|
+
</div>`+(n.folded?"":S()+(ne.length||H.length?`<div class="dt-hist-list">${H.length?`<p class="dt-hist-group">${Ft("drafts","Drafts",H.length)}</p>${n.shut("drafts")?"":H.map(be).join("")}`:""}${ne.map($=>{if(n.shut($))return`<p class="dt-hist-group">${Ft($,vt[$],O[$].length)}</p>`;let I=O[$].slice(0,Math.max(0,Lt));Lt-=I.length;let ht=O[$].slice(I.length).find(Ht=>Ht.id===n.keep);ht&&I.push(ht);let At=O[$].length-I.length;return`<p class="dt-hist-group">${Ft($,vt[$],O[$].length)}</p>${I.map(St).join("")}${At?`<button type="button" class="dt-note-fold dt-hist-rest" data-hist-rows>${At} more in ${vt[$]}</button>`:""}`}).join("")}</div>`:y.q.trim()?`<div class="dt-hist-empty">${lu}<p>No threads match \xAB${f(y.q.trim())}\xBB.</p><button data-hist-clear>Clear search</button></div>`:y.view!=="all"?'<div class="dt-hist-empty"><p>Nothing in this view at this breakpoint.</p><button data-hist-view="all">Show all</button></div>':`<div class="dt-hist-empty is-blank"><i><svg viewBox="0 0 20 20" width="18" height="18" aria-hidden="true"><path d="M4 3.5h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9.5L5.5 16.5v-3H4a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM10 6v5M7.5 8.5h5" stroke-linejoin="round"/></svg></i>${O.done.length||O.archived.length?"<b>Everything here is resolved.</b>":b?"<b>No threads at this breakpoint yet</b><p>Click anything on the page to leave one.</p>":"<b>Nothing open at this breakpoint</b><p>Resolved threads are hidden \u2014 \xABShow resolved\xBB below brings them back.</p>"}</div>`)+(n.picking?`<div class="dt-hist-foot is-picking" role="toolbar" aria-label="Selected threads"><span class="dt-hist-sel" aria-live="polite">${n.picking.size} selected</span
|
|
245
|
+
><button type="button" data-pick-mirror${n.picking.size?"":" disabled"}><kbd>M</kbd>Mirror to Team</button><button type="button" data-pick-cancel><kbd>Esc</kbd>Cancel</button></div>`:`<div class="dt-hist-foot">
|
|
246
|
+
<button class="dt-hist-resolved" data-resolved role="switch" aria-checked="${b}"
|
|
223
247
|
><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
|
|
224
248
|
><span>Show resolved</span><kbd>R</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
225
|
-
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${
|
|
226
|
-
>${
|
|
227
|
-
</div>`)}function
|
|
228
|
-
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${
|
|
229
|
-
<span class="dt-review-n">${
|
|
230
|
-
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${
|
|
231
|
-
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${
|
|
249
|
+
<button class="dt-hist-resolved" data-archived role="switch" aria-checked="${E}"
|
|
250
|
+
>${Ln}<span>Show archived</span><kbd>A</kbd><i class="dt-hist-switch" aria-hidden="true"></i></button>
|
|
251
|
+
</div>`))}function cu(n){let{inFrame:r,everything:u,route:p,open:g,settle:b,keepIn:E,toast:H,waits:y,approve:T}=n,x=at=>{let vt=u().find(Ft=>Ft.id===at);return!!vt&&y(vt)},D="nm-review",dt=()=>{try{return JSON.parse(sessionStorage.getItem(D)||"null")}catch{return null}},J=at=>{try{at?sessionStorage.setItem(D,JSON.stringify(at)):sessionStorage.removeItem(D)}catch{}},tt=document.createElement("div");tt.className="dt-review",tt.setAttribute("role","region"),tt.setAttribute("aria-label","Checking fixes"),tt.hidden=!0,E(tt),r||document.body.append(tt);let O=()=>u().filter(y),St=()=>{let at=O().sort((vt,Ft)=>+(Ft.route===p())-+(vt.route===p())||String(vt.route).localeCompare(String(Ft.route))||vt.id-Ft.id).map(vt=>vt.id);at.length&&(J({ids:at,i:0}),Wt())},Wt=()=>{let at=dt();if(!at||r){tt.hidden=!0;return}for(;at.i<at.ids.length&&!x(at.ids[at.i]);)at.i++;if(at.i>=at.ids.length){J(null),tt.hidden=!0,H("Every fix is checked.");return}J(at);let vt=u().find(zt=>zt.id===at.ids[at.i]);if(vt.route&&vt.route!==p()){location.assign(vt.route+location.search);return}g(vt);let Ft=at.ids.slice(0,at.i).some(x);tt.innerHTML=`<b><span class="dt-review-dot" aria-hidden="true"></span>Check fixes</b>
|
|
252
|
+
<span class="dt-review-nav"><button data-r="prev" aria-label="Previous fix" data-tip="Previous \xB7 \u2190"${Ft?"":" disabled"}>${Aa}</button>
|
|
253
|
+
<span class="dt-review-n">${at.i+1} of ${at.ids.length}</span>
|
|
254
|
+
<button data-r="skip" aria-label="Next fix" data-tip="Next \xB7 \u2192">${Ha}</button></span>
|
|
255
|
+
<button data-r="ok" class="dt-review-ok" aria-label="Looks right \u2014 mark it resolved" data-tip="Looks right \u2014 resolve it">${$e}</button>
|
|
232
256
|
<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
|
-
${
|
|
235
|
-
</select></label>`},
|
|
236
|
-
`).find(
|
|
257
|
+
<button data-r="stop" aria-label="Stop checking" data-tip="Stop checking">${Sn}</button>`,tt.hidden=!1};tt.addEventListener("click",async at=>{let vt=at.target.closest("[data-r]"),Ft=dt();if(!vt||!Ft)return;if(vt.dataset.r==="stop"){J(null),tt.hidden=!0;return}if(vt.dataset.r==="prev"){Tt();return}let zt=Ft.ids[Ft.i];J({...Ft,i:Ft.i+1});let Lt=u().find(be=>be.id===zt),ne=vt.dataset.r==="ok"&&Lt?T(Lt):vt.dataset.r==="no"?b(zt,!1):null;Wt(),await ne});let Tt=()=>{let at=dt();if(at){for(let vt=at.i-1;vt>=0;vt--)if(x(at.ids[vt])){J({...at,i:vt}),Wt();return}}};return document.addEventListener("keydown",at=>{tt.hidden||at.metaKey||at.ctrlKey||at.altKey||at.key!=="ArrowLeft"&&at.key!=="ArrowRight"||at.target.closest?.("input, textarea, select, [contenteditable]")||(at.preventDefault(),at.key==="ArrowLeft"?Tt():tt.querySelector('[data-r="skip"]')?.click())}),{start:St,toCheck:O,resume:()=>{dt()&&Wt()}}}function uu(n,r){let u=null,p=null,g=document.querySelector(".dt-turbo"),b="/notemend:turbo",E=()=>{let H=!!u&&Date.now()-Date.parse(u.at)<18e4,y=H?u.mode==="push"?"push":p?.paused?"paused":"on":"none",T=H?Wn(u.agent):"",x=y==="none"?`Turbo is off. Run ${b} in Claude Code and threads for the agent are taken as they land \u2014 click to copy it`:y==="push"?`Push mode: ${T} takes threads when you press Push to the agent. For live, run ${b} instead`:y==="on"?`Turbo on: ${T} takes threads for the agent as they land \u2014 click to pause`:`Turbo paused: ${T} is listening but waits \u2014 click to resume`;g.dataset.state=y,g.dataset.tip=x,g.setAttribute("aria-label",x),g.setAttribute("aria-checked",String(y==="on")),n&&(g.hidden=!0)};return setInterval(E,3e4),g.addEventListener("click",async()=>{let H=g.dataset.state;if(H==="none"||H==="push"){await navigator.clipboard?.writeText(b).catch(()=>{}),r(`Copied ${b} \u2014 paste it in Claude Code`);return}let y=H==="on"?"off":"on";p={paused:y==="off"},E();try{let T=await ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({turbo:y})});if(!T.ok)throw new Error(String(T.status));r(y==="off"?"Turbo paused":"Turbo on")}catch{p={paused:y==="on"},E(),r("Could not switch turbo \u2014 try again")}}),H=>{u=H.listening??null,p=H.turbo??null,E()}}var yh=new Set(["data-wired","data-nudge"]),vh=".dt-note",pu=n=>n instanceof Element&&n.hasAttribute("data-ghost"),So=n=>{if(!(n instanceof Element))return null;let r=n.dataset;return r.msg?`m:${r.msg}`:r.id?`${n.tagName}:${n.classList[0]??""}:${r.id}`:"draft"in r?`${n.tagName}:draft`:r.parked?`${n.tagName}:parked:${r.parked}`:r.k?`${n.tagName}:k:${r.k}`:null},mu=(n,r)=>n.nodeType===r.nodeType&&n.nodeName===r.nodeName&&So(n)===So(r);function wh(n,r){for(let{name:u}of[...n.attributes])!r.hasAttribute(u)&&!yh.has(u)&&n.removeAttribute(u);for(let{name:u,value:p}of r.attributes)n.getAttribute(u)!==p&&n.setAttribute(u,p);n instanceof HTMLInputElement&&r instanceof HTMLInputElement&&(n.checked!==r.checked&&(n.checked=r.checked),n!==document.activeElement&&n.value!==r.value&&(n.value=r.value))}function hu(n,r){let u=[...n.childNodes].filter(y=>!pu(y)),p=new Map;for(let y of u){let T=So(y);T&&p.set(T,y)}let g=new Set,b=0,E=[];for(let y of[...r.childNodes]){let T=So(y),x=T?p.get(T):void 0;if(!T){for(;b<u.length&&(g.has(u[b])||So(u[b]));)b++;b<u.length&&mu(u[b],y)&&(x=u[b++])}x&&!g.has(x)&&mu(x,y)?(g.add(x),$h(x,y),E.push(x)):E.push(y)}for(let y of u)g.has(y)||(y instanceof HTMLElement&&y.matches(vh)&&Qc(y),n.removeChild(y));let H=n.firstChild;for(let y of E){for(;H&&pu(H);)H=H.nextSibling;if(y===H){H=H.nextSibling;continue}n.insertBefore(y,H)}}function $h(n,r){if(n.nodeType===Node.TEXT_NODE||n.nodeType===Node.COMMENT_NODE){n.nodeValue!==r.nodeValue&&(n.nodeValue=r.nodeValue);return}if(!(!(n instanceof Element)||!(r instanceof Element))){if(wh(n,r),n instanceof HTMLTextAreaElement){n!==document.activeElement&&n.value!==r.value&&(n.value=r.value);return}if(n instanceof SVGElement){n.innerHTML!==r.innerHTML&&(n.innerHTML=r.innerHTML);return}hu(n,r),n instanceof HTMLSelectElement&&n!==document.activeElement&&n.value!==r.value&&(n.value=r.value)}}function kr(n,r){let u=document.createElement("template");u.innerHTML=r,hu(n,u.content)}function gu(n,r,u=!1){let p=n.breakpoints,g=n.categories,b=(p.find(t=>!Number.isFinite(t.max))??p[0]).id,E=t=>p.find(e=>t>=e.min&&t<=e.max)?.id??b,H=(t,e)=>{let s=E(t);if(Bs||!matchMedia("(pointer: coarse)").matches)return s;let o=[...p].sort((l,d)=>l.min-d.min),a=e<500?E(767):(o[o.length-2]??o[0]).id,i=l=>o.findIndex(d=>d.id===l);return i(s)>i(a)?a:s},y=t=>t.breakpoint||b,T=t=>n.devices.find(e=>e.id===t),x=Bs,D=(t,e)=>{x||mt.setItem(t,e)},dt=null,J=["stage","status","priority","assignee"],tt=t=>{let e=(dt??B).find(a=>a.id===t.id),s=J.filter(a=>a in t||(a==="stage"||a==="status")&&("stage"in t||"status"in t)),o=e&&s.length&&!t.reply?Object.fromEntries(s.map(a=>[a,e[a]??null])):void 0;return ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(o?{...t,seen:o}:t)})},O=t=>t.replace(/\/+$/,"")||"/",St=O(location.pathname);for(let t of document.querySelectorAll(".devtools .dt-icon[title]"))t.dataset.tip=t.title,t.getAttribute("aria-label")||t.setAttribute("aria-label",t.title),t.removeAttribute("title");let Wt=document.querySelector(".dt-grid-btn"),Tt=document.querySelector(".dt-grid-overlay"),at=Tt.querySelector(".dt-overlay-grid"),vt=Tt.querySelector(".dt-grid-chip"),Ft="dt-grid",zt=n.projectGrid??null,Lt=()=>H(innerWidth,innerHeight),ne=()=>zt?.mode==="custom"?zt.widths?.[Lt()]??null:null,be=t=>t.gridTemplateColumns==="none"?[]:t.gridTemplateColumns.replace(/\[[^\]]*\]/g," ").trim().split(/\s+/).map(parseFloat).filter(e=>e!==0),re=t=>be(t).length,me=()=>{let t=Tt.hidden;t&&(Tt.style.visibility="hidden",Tt.hidden=!1);try{return S()}finally{t&&(Tt.hidden=!0,Tt.style.visibility="")}},S=()=>{let t=document.documentElement.clientWidth;Tt.classList.remove("is-auto");let e=getComputedStyle(at);if(e.display==="grid"&&re(e)>1){let i=at.getBoundingClientRect();return{cols:re(e),gap:Math.round(parseFloat(e.columnGap)||0),x:Math.round(i.left),w:Math.round(i.width),from:"site"}}let s=null,o=null;for(let i of[...document.body.querySelectorAll("*")].slice(0,3e3)){if(i.closest(fs)||Tt.contains(i))continue;let l=i.getBoundingClientRect();if(!l.width||!l.height)continue;let d=getComputedStyle(i);if(d.maxWidth!=="none"&&l.left>0&&Math.abs(l.left-(t-l.right))<=2&&l.width>(s?.w??0)){let m=parseFloat(d.paddingLeft)||0;s={x:l.left+m,w:l.width-m-(parseFloat(d.paddingRight)||0)}}if(l.width<=(o?.w??0))continue;let c=d.display.endsWith("grid")?be(d):[];if(c.length>1){if(!c.every(v=>Math.abs(v-c[0])<2))continue;let m=parseFloat(d.columnGap)||0;o={cols:c.length,gap:m,x:l.left+(parseFloat(d.borderLeftWidth)||0)+(parseFloat(d.paddingLeft)||0),w:c.reduce((v,A)=>v+A,0)+m*(c.length-1)}}else if(d.display.endsWith("flex")&&!d.flexDirection.startsWith("column")){let m=[...i.children].map(A=>A.getBoundingClientRect()).filter(A=>A.width&&A.height),v=m.filter(A=>Math.abs(A.top-m[0].top)<2).sort((A,j)=>A.left-j.left);v.length>1&&v.every(A=>Math.abs(A.width-v[0].width)<2)&&(o={cols:v.length,gap:Math.max(0,v[1].left-v[0].right),x:v[0].left,w:v.at(-1).right-v[0].left})}}let a=i=>({...i,gap:Math.round(i.gap),x:Math.round(i.x),w:Math.round(i.w)});return a(o?{...o,...s??{},from:"page"}:{cols:n.grid.columns,gap:innerWidth<768?16:24,...s??{x:24,w:t-48},from:"guess"})},k=null,W=(t,e,s,o)=>{Tt.classList.add("is-auto"),at.children.length!==t&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(t)),Tt.style.setProperty("--grid-x",`${s}px`),Tt.style.setProperty("--grid-w",`${o}px`),Tt.style.setProperty("--grid-gap",`${e}px`)},U=()=>{let t=ne(),e=vt.querySelector("span");if(vt.querySelector("button").hidden=!t||x,t){let s=document.documentElement.clientWidth,o=Math.max(0,Math.min(t.max??1/0,s-2*t.margin));W(t.cols,t.gutter,(s-o)/2,o),e.textContent="Project grid \xB7";return}at.children.length!==n.grid.columns&&(at.innerHTML='<div class="dt-overlay-col"></div>'.repeat(n.grid.columns)),k=me(),k.from!=="site"&&W(k.cols,k.gap,k.x,k.w),e.textContent=k.from==="guess"?`Guessed \xB7 ${k.cols} \xD7 ${k.w}`:`From the page \xB7 ${k.cols} \xD7 ${k.w} \xB7 gap ${k.gap}`},$=()=>{vt.classList.remove("is-lifted");let t=vt.getBoundingClientRect(),e=document.querySelector(".devtools").getBoundingClientRect();vt.classList.toggle("is-lifted",t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top)},I=t=>{Tt.hidden=!t,t&&(U(),$()),Wt.setAttribute("aria-pressed",String(t)),D(Ft,t?"1":"0"),We({grid:t})};Wt.addEventListener("click",()=>I(Tt.hidden===!0)),addEventListener("resize",()=>{Tt.hidden||(U(),$())});let ht=document.querySelector(".dt-pages-name"),At=()=>{try{let t=document.querySelector(".dt-frame:not([hidden]) iframe")?.contentWindow;return t&&t.location.href!=="about:blank"?{route:O(t.location.pathname),title:t.document.title}:null}catch{return null}},Ht=()=>{let t=document.querySelector(".dt-pages-here"),e=document.querySelector('.dt-pages-list a[aria-current="page"] .dt-pages-n');t&&(t.innerHTML=e?.innerHTML??"",t.hidden=!e||e.hidden,t.title=e?.title??"")},gt=()=>{let e=At()?.route??St,s=null;for(let l of document.querySelectorAll(".dt-pages a"))O(new URL(l.href).pathname)===e?(l.setAttribute("aria-current","page"),s=l):l.removeAttribute("aria-current");Ht();let i=(s?.querySelector(".dt-menu-label")?.textContent?.trim()||e).trim().split(/\s+/);ht.textContent=e==="/"?"":e.replace(/^\//,""),ht.closest("summary").toggleAttribute("data-home",e==="/")},Et=(!!n.gridAdmin||!!n.arrange)&&!n.client,Q=(n.folders??[]).filter(t=>t&&typeof t.name=="string"&&Array.isArray(t.pages)),se=new Set((()=>{try{return JSON.parse(mt.getItem("dt-folders-open")||"[]")}catch{return[]}})()),jt=new Set((()=>{try{return JSON.parse(mt.getItem("dt-folders-closed")||"[]")}catch{return[]}})()),Bt=document.querySelector(".dt-pages-list"),Un=()=>gt(),dn=t=>xt(t?'<path d="M2.5 15.5V5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H15A1.5 1.5 0 0 1 16.5 7v1.5M2.5 15.5l2.2-6A1.5 1.5 0 0 1 6.1 8.5h11.2l-2.5 7z" />':'<path d="M2.5 5A1.5 1.5 0 0 1 4 3.5h3.5l2 2H16A1.5 1.5 0 0 1 17.5 7v7.5A1.5 1.5 0 0 1 16 16H4a1.5 1.5 0 0 1-1.5-1.5z" />',14),Le=()=>{let t=new Map(n.pages.map(d=>[d.route,d])),e=new Set(Q.flatMap(d=>d.pages)),s=d=>Oc(n,d,St,Et),o=d=>Q.filter(c=>(c.parent&&Q.some(m=>m.id===c.parent)?c.parent:null)===d),a=d=>d.pages.includes(St)||o(d.id).some(a),i=(d,c)=>s(d).replace("<li",`<li style="--d:${c}"`),l=(d,c)=>{let m=se.has(d.id)||!jt.has(d.id)&&a(d),v=d.pages.map(j=>t.get(j)).filter(j=>!!j),A=o(d.id);return`<li class="dt-folder" data-folder="${f(d.id)}" style="--d:${c}"${m?" data-open":""}${Et?' draggable="true"':""}><div class="dt-folder-row" role="button" tabindex="0" aria-expanded="${m}">${$o}${dn(m)}<span class="dt-menu-label">${f(d.name)}</span><em class="dt-folder-n"></em>`+(Et?`<button type="button" class="dt-folder-more" aria-label="Folder menu">${xt('<circle cx="5" cy="10" r="1" /><circle cx="10" cy="10" r="1" /><circle cx="15" cy="10" r="1" />',14)}</button>`:"")+`</div><ul${m?"":" hidden"}>${A.map(j=>l(j,c+1)).join("")}${v.map(j=>i(j,c+1)).join("")}${v.length||A.length?"":`<li class="dt-folder-empty" style="--d:${c+1}">Empty \u2014 drag pages here</li>`}</ul></li>`};Bt.innerHTML=o(null).map(d=>l(d,0)).join("")+n.pages.filter(d=>!e.has(d.route)).map(d=>i(d,0)).join(""),document.querySelector(".dt-pages-foot").hidden=!Et,Un()};Le();let L=document.querySelector(".dt-pages");L&&!L.querySelector("li")&&L.querySelector("summary")?.addEventListener("click",t=>t.preventDefault());let w=[...document.querySelectorAll(".devtools details, .dt-strip details")],C=!1,q=t=>Kn(t,()=>{t.open=!1}),F=()=>{let t=w.filter(e=>e.open&&!e.hasAttribute("data-leaving"));for(let e of t)q(e);return t};for(let t of w)t.querySelector(":scope > summary")?.addEventListener("click",e=>{t.open&&t.hasAttribute("data-leaving")?(e.preventDefault(),Eo(t)):t.open&&(e.preventDefault(),q(t))});document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let[e]=F();e&&(e.querySelector("summary")?.focus(),t.preventDefault(),t.stopImmediatePropagation())},!0),document.addEventListener("pointerdown",t=>{C=w.some(e=>e.open&&!e.contains(t.target))&&F().length>0},!0),addEventListener("blur",F);let wt=document.querySelector(".dt-pad-overlay"),$t="dt-inspect",ot=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-room",".dt-pad-overlay",".dt-grid-overlay",".dt-frame",".dt-history",".dt-review",".dt-field-menu",...n.ignore].join(", "),et=[".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-room",".dt-notes-overlay",".dt-history",".dt-frame",".dt-client-tab",".dt-review",".dt-field-menu",".dt-toast",".dt-elsewhere",".dt-drag-box",'[aria-modal="true"]',...n.ignore].join(", "),ct={pads:document.querySelector(".dt-pad-btn"),sizes:document.querySelector(".dt-size-btn"),type:document.querySelector(".dt-type-btn"),color:document.querySelector(".dt-color-btn"),contrast:document.querySelector(".dt-contrast-btn"),border:document.querySelector(".dt-border-btn")},ft="",Nt=0,{spacer:ye,drawPads:Ie,drawSize:xe,drawType:Gt,drawColor:ce,drawBorder:Se,drawContrast:he,contrastFix:Oe,markCopied:gs}=Kc(wt),Hn=null,R=()=>{Hn&&ft&&P(Hn)},P=t=>{Hn=t,!Nt&&(Nt=requestAnimationFrame(()=>{Nt=0;let e=document.elementFromPoint(t.clientX,t.clientY);if(!e||e.closest(ot)){wt.innerHTML="";return}t.altKey&&e.parentElement&&e.parentElement!==document.body&&(e=e.parentElement),ft==="sizes"?xe(e):ft==="type"?Gt(e):ft==="color"?ce(e):ft==="contrast"?he(e):ft==="border"?Se(e):Ie(t.altKey?e:ye(e))}))},Y=t=>{ft=t;for(let[e,s]of Object.entries(ct))s.setAttribute("aria-pressed",String(e===t));D($t,t),We({inspect:t}),wt.hidden=!t,wt.innerHTML="",t?(document.addEventListener("mousemove",P),addEventListener("scroll",R,!0),addEventListener("resize",R)):(document.removeEventListener("mousemove",P),removeEventListener("scroll",R,!0),removeEventListener("resize",R))};document.addEventListener("click",t=>{ft!=="contrast"||!Oe()||t.target.closest?.(ot)||(t.preventDefault(),t.stopPropagation(),navigator.clipboard?.writeText(Oe()).catch(()=>{}),gs(),R())},!0);for(let[t,e]of Object.entries(ct))e.addEventListener("click",()=>{t!==ft&&Qe(!1),Y(ft===t?"":t)});document.addEventListener("keydown",t=>{if(t.key!=="Escape"||t.isComposing||t.defaultPrevented||Kt)return;let e=t.target;if(e?.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??""))return;let s=o=>{x&&parent.postMessage({dt:!0,...o},location.origin)};ft?(Y(""),s({inspect:""}),t.preventDefault(),t.stopImmediatePropagation()):Tt.hidden||(I(!1),s({grid:!1}),t.preventDefault(),t.stopImmediatePropagation())});let Pt=document.querySelector(".dt-notes-btn"),Yt=[...document.querySelectorAll(".dt-bp")],ve=document.querySelector(".dt-history-btn"),rt=document.querySelector(".dt-history"),ge=document.querySelector(".dt-elsewhere"),Yn=document.querySelector(".dt-studio-btn"),Xn=document.querySelector(".dt-devices"),Jn=document.querySelector(".dt-notes-hi"),xu=Jn.querySelector(".dt-hi-box"),Ar=Jn.querySelector(".dt-hi-tag"),yn=document.querySelector(".dt-frame"),Ge=document.createElement("div");Ge.className="dt-spot",Ge.hidden=!0,Ge.setAttribute("aria-hidden","true"),document.body.append(Ge);let Eu=t=>{if(!t||!Kt){Ge.hidden=!0;return}let e=t.getBoundingClientRect(),s=6;Ge.style.setProperty("--spot-x",`${e.left-s}px`),Ge.style.setProperty("--spot-y",`${e.top-s}px`),Ge.style.setProperty("--spot-w",`${e.width+s*2}px`),Ge.style.setProperty("--spot-h",`${e.height+s*2}px`),Ge.hidden&&(Jn.hidden=!0),Ge.hidden=!1},qs=yn.querySelector("iframe");qs.addEventListener("load",gt),new MutationObserver(gt).observe(yn,{attributes:!0,attributeFilter:["hidden"]});let Ra=document.querySelector(".dt-notes-count"),nt=document.querySelector(".dt-notes-overlay"),fs=".devtools, .dt-tab, .dt-strip, .dt-strip-tab, .dt-notes-overlay, .dt-history, .dt-frame, .dt-client-tab",Ba=t=>{for(let e of["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend","click","focusin","focusout"])t.addEventListener(e,s=>s.stopPropagation())};document.querySelectorAll(fs).forEach(Ba);let Hr="dt-notes",B=[],Kt=!1,X=null,N=null,Pa=0,Ae="",Mu=(t,e,s)=>{if(s>160&&s<innerHeight-120)return!1;let o=document.elementsFromPoint(e,s).find(a=>!Tn(a)&&a!==document.documentElement&&a!==document.body);if(!o||o===t||t.contains(o)||o.contains(t))return!1;for(let a=o;a&&a!==document.body;a=a.parentElement){let i=getComputedStyle(a).position;if(i==="fixed"||i==="sticky")return!a.contains(t)}return!1},Cr=new WeakSet,Ao=null,Ho=null,qe={},Co=" \xB7 hidden \u2014 inside something closed",No=t=>{t.toggleAttribute("data-up",t.scrollTop>2),t.toggleAttribute("data-more",t.scrollTop+t.clientHeight<t.scrollHeight-2)};nt.addEventListener("scroll",t=>{let e=t.target;e.classList?.contains("dt-note-thread")&&No(e)},!0),nt.addEventListener("load",t=>{let e=t.target.closest?.(".dt-note-thread");e&&No(e)},!0),nt.addEventListener("scroll",t=>{let e=t.target;if(!e.classList?.contains("dt-note-thread")||e.scrollTop+e.clientHeight<e.scrollHeight-4)return;let s=e.parentElement?.querySelector(".dt-new-below");s&&(delete qe[s.dataset.id],s.remove())},!0);let Ee=[],Qt=null,De=[],ku=10,Ds=(t=N)=>!!(t&&((t.text?.trim().length??0)>=ku||t.images?.length)),nn=()=>{N&&Ds()&&De.push(N),N=null},Nr=0,Fs=()=>{if(!Ds()||performance.now()-Nr<4e3)return!0;Nr=performance.now();let t=nt.querySelector(".dt-note[data-draft]");return t&&Mo(t,"no"),t?.querySelector(".dt-note-input")?.focus(),Ut("Not sent \u2014 close again to keep it as a draft",2400),!1},cn=null,Ia=new Map,Oa=null,Rr=()=>`dt-draft:${n.me?.email??""}:${St}${x?":canvas":""}`,vn=Rr(),Ro=0,js=()=>{if(!N&&!De.length&&!Ae){mt.removeItem(vn);return}let t={draft:N,parked:De,reply:Ae?{for:cn,text:Ae}:null};try{localStorage.setItem(vn,JSON.stringify(t))}catch{let e=s=>({...s,images:void 0});try{localStorage.setItem(vn,JSON.stringify({...t,draft:N&&e(N),parked:De.map(e)}))}catch{}}},Zn=()=>{clearTimeout(Ro),Ro=setTimeout(js,200)};addEventListener("pagehide",()=>{clearTimeout(Ro),js();try{sessionStorage.setItem(`nm-open:${vn}`,X==null?"":String(X))}catch{}});let Fe=mt.getItem("dt-space")==="clients"?"clients":"studio",Ke=()=>!!n.me&&!n.client,wn=t=>!Ke()||Fe==="clients"===qt(t),Br=["all","nobody","mine","others","resolved","claude","wrote","check"],$n=Br.find(t=>t===mt.getItem("dt-pinf"))??"all",qa=()=>{},Bo=Number(/^#thread-(\d+)$/.exec(location.hash)?.[1])||0,Ue=mt.getItem("dt-resolved")!=="0",un=mt.getItem("dt-archived")==="1",Me=t=>Nc(t,n.autoArchive),Po=t=>Me(t)?un:Dt(t)!=="done"||Ue,oe={q:"",menu:!1,more:!1,view:["me","agent"].includes(mt.getItem("dt-view")??"")?mt.getItem("dt-view"):"all",sort:["old","reply","unread"].includes(mt.getItem("dt-sort")??"")?mt.getItem("dt-sort"):"new"},Cn=null,Io=t=>yt.find(e=>e.from?.id===t.id&&Ps(e)),Da=t=>Ps(t)?yt.find(e=>e.id===t.from.id&&qt(e)):void 0,He=null,Oo=null,qo=()=>Ke()&&Fe==="clients",bs=t=>qo()&&qt(t)&&Dt(t)==="open"&&!Io(t),Fa='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="3.5" y="3.5" width="13" height="13" rx="2.5"/><path d="M10 3.5v13"/></svg>',Lu=t=>{let e=n.client?void 0:Da(t);if(!e)return"";let s=Sc(e);return`<button type="button" class="dt-field dt-field--bare dt-field--client" data-act="open-orig" data-id="${e.id}" data-tip="What the client sees now \u2014 open their thread" aria-label="The client sees: ${f(s)}. Open their thread"><span class="dt-field-box"><svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true">${wr.clients}</svg><span class="dt-field-label">Client \xB7 ${f(s)}</span><svg class="dt-field-ext" viewBox="0 0 24 24" width="11" height="11" aria-hidden="true"><path d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg></span></button>`},Su=[[/Edg\/(\d+)/,"Edge"],[/OPR\/(\d+)/,"Opera"],[/Firefox\/(\d+)/,"Firefox"],[/Chrome\/(\d+)/,"Chrome"],[/Version\/(\d+).*Safari/,"Safari"]],Tu=[[/iPhone|iPad/,"iOS"],[/Android/,"Android"],[/Mac OS X/,"macOS"],[/Windows/,"Windows"],[/Linux/,"Linux"]],Au=()=>{let t=navigator.userAgent,e=i=>i.find(([l])=>l.test(t)),s=e(Su),o=e(Tu),a=s?s[0].exec(t)?.[1]:null;return[s?`${s[1]}${a?" "+a:""}`:"unknown browser",o?.[1]].filter(Boolean).join(" \xB7 ")},ja=()=>H(innerWidth,innerHeight),Xt=()=>Oa??ja(),Pr=()=>{let t=Xt();for(let e of Yt)e.setAttribute("aria-pressed",String(e.dataset.bp===t))},{cssPath:_a,poolOf:Wa,contextOf:za,resolveEl:Hu,anchorOf:Cu,anchorState:Nu,fingerprintOf:Do}=Xc(),ys=new Map,_s=()=>{ys=new Map},Ir=t=>JSON.stringify([t.selector,t.label,t.ctx,t.tag,t.classes,t.nth,t.fp]),Ce=t=>{let e=Ir(t),s=ys.get(e);return(s===void 0||s.el&&!s.el.isConnected)&&(s={el:Hu(t),st:Nu(t)},ys.set(e,s)),s.el},Fo=t=>(Ce(t),ys.get(Ir(t))?.st??"found"),Ws=0,zs=null,jo="",Or=()=>{Ws=Math.max(Ws,scrollY+innerHeight)},qr=(t,e)=>e==="gone"&&!!t.spot&&(Or(),t.spot.y>Ws&&Ws<document.documentElement.scrollHeight-1);addEventListener("scroll",()=>{Or(),zs!=null&&Ws>=zs&&(zs=null,setTimeout(()=>{_s(),Z()},600))},{capture:!0,passive:!0});let Ru=t=>{let e=Fo(t);return(qr(t,e)?"later":e)+(Te(t)?"":" \xB7 no pin")},Dr=t=>{t.spot&&scrollTo({top:Math.max(0,t.spot.y-innerHeight/2),behavior:"smooth"})},Va=[];document.addEventListener("pointerdown",t=>{let e=t.target;e instanceof Element&&!Tn(e)&&!e.closest(".devtools")&&(Va=[Va.at(-1),{el:e,t:Date.now()}].filter(Boolean))},!0);let Bu='[role=menu],[role=listbox],[role=dialog],[role=tooltip],dialog,[popover],[aria-modal],[data-state="open"],[data-radix-popper-content-wrapper],details[open]>:not(summary)',Pu=t=>{let e=[...Va].reverse().find(l=>!t.contains(l.el)&&!l.el.contains(t));if(!e||Date.now()-e.t>6e5)return null;let s=e.el.closest("button,a,[role=button],summary,[aria-haspopup],[aria-expanded],[aria-controls]");if(!s||!s.isConnected||s.contains(t)||t.contains(s)||Tn(s))return null;let o=t.closest(Bu);if(o?.contains(s)||!o&&s.getAttribute("aria-expanded")!=="true"&&!s.matches("summary,[aria-haspopup]"))return null;let a=s.tagName.toLowerCase(),i=[...s.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:_a(s),tag:a,classes:i,nth:Wa({tag:a,classes:i}).indexOf(s),label:Zt(ie(s.textContent||""),60),ctx:za(s),fp:Do(s),rx:.5,ry:.5}},_o=new Map,Te=t=>{_o.size||requestAnimationFrame(()=>_o.clear());let e=_o.get(t);return e===void 0&&(e=Cu(t,Ce(t)),_o.set(t,e)),e},Fr=t=>{for(let e=t;e&&e!==document.body;e=e.parentElement)if(e.getAnimations().some(s=>s.playState==="running"))return!0;return!1},Wo=[],Ga=t=>{for(let e of Wo)e.play();Wo=[];for(let e=t;e&&e!==document.body;e=e.parentElement)for(let s of e.getAnimations())s.playState==="running"&&(s.pause(),Wo.push(s))},Ka=()=>{if(N)return Ce(N);let t=X!=null?B.find(s=>s.id===X):null;if(!t)return null;let e=Te(t);return e&&!e.hidden?Ce(t):null},jr="claude",Iu=()=>(n.client||Fe==="clients"?n.team??[]:Xo()).filter(t=>!mr(t.email)),Ou=()=>Iu().filter(t=>t.email!==n.me?.email),Vs=()=>[...n.me?(n.team??[]).filter(t=>t.email===n.me.email):[],...Ou()],_r='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><circle cx="10" cy="10" r="6.5" stroke-dasharray="2.4 2.4"/></svg>',Ua=(t,e)=>{let s=e==="agent"?jr:e==="me"?n.me?.email??"":"";if(!t){if(!N)return;N.assignee=s,N.stage=Jt(s)?"approved":!N.stage||N.stage==="approved"?"new":N.stage,Gs(s),N.carried=!1,Zn(),Z();return}zo(t,s)},zo=(t,e)=>{let s=B.find(i=>i.id===t);if(s&&ln(s)&&!Jt(e)&&!confirm("The agent is still working on this \u2014 it may finish its changes after you take it. Take it anyway?"))return;let o=s?Be(s):"new",a=Jt(e)?"approved":o==="approved"?"new":o;Ye(i=>i.map(l=>l.id===t?{...l,assignee:e||void 0,stage:a}:l),()=>tt({id:t,assignee:e||null,stage:a}),Jt(e)?"Approving it for the agent":"Reassigning")},qu=(t,e)=>{if(e&&mt.setItem("nm-for",e),!t){if(!N)return;N.assignee=e,N.stage==="approved"&&(N.stage="new"),Gs(e),N.carried=!1,Zn(),Z();return}zo(t,e)},Du='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><path d="M15.5 10a5.5 5.5 0 1 1-1.6-3.9M15.5 4v3.5H12" stroke-linecap="round" stroke-linejoin="round"/></svg>',Gs=t=>{try{if(t!==void 0)return sessionStorage.setItem("nm-next-for",t),t;let e=sessionStorage.getItem("nm-next-for");return e&&!Jt(e)&&Vs().some(s=>s.email===e)?e:null}catch{return null}},Wr=t=>Jt(t)?"#d97757":t?"#0d99ff":"#717171",pn=t=>t===n.me?.email?"you":n.team?.find(e=>e.email===t)?.name||t.split("@")[0],sn=t=>t?n.team?.find(e=>e.email===t):void 0,Vo=t=>{let e=ie(t??"").split(/\s+/).filter(Boolean);return f(([...e[0]??"?"][0]+(e.length>1?[...e[e.length-1]][0]:"")).toUpperCase())},Nn=(t,e,s="dt-face")=>t?`<img class="${s}" src="${f(t)}" alt="">`:`<b class="${s}" aria-hidden="true">${Vo(e)}</b>`,Ya=t=>{let e=sn(t.by);return e||t.byName?Nn(e?.avatar_url,e?.name||t.byName||t.by).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"):""},Ne=t=>`var(--dt-avatar-${sn(t)?.avatar_hue??[...t].reduce((e,s)=>e*31+s.charCodeAt(0)>>>0,7)%8+1})`,mn=(t,e)=>{let s=sn(t),o=s?.name||(t===e.by?.toLowerCase()||t===e.byName?.toLowerCase()?e.byName:"")||t;return Nn(s?.avatar_url,o).replace(/^<(img|b) /,`<$1 style="--hue:${Ne(t)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>")},zr=()=>n.me?`${mn(n.me.email.toLowerCase(),{by:n.me.email,byName:n.me.name})}<i class="dt-pin-cut" aria-hidden="true">${Vn}</i>`:Vn,Qn=new Map,Xa=new Map,Vr=0,Fu=(t,e)=>{let s=e==="found"?null:e;n.client||x||t.id<=0||(t.anchor??null)===s||Qn.get(t.id)===s||(Qn.set(t.id,s),Xa.set(t.id,s),clearTimeout(Vr),Vr=window.setTimeout(()=>{for(let[o,a]of Xa){let i=B.find(d=>d.id===o),l=i?Fo(i):"found";if(!i||(l==="found"?null:l)!==a){Qn.delete(o);continue}tt({id:o,anchor:a}).then(d=>{if(d.ok){let c=B.find(m=>m.id===o);c&&(c.anchor=a)}}).catch(()=>Qn.delete(o))}Xa.clear()},4e3))},ju=t=>{let e=!!Ce(t)?.getClientRects().length;return`<div class="dt-note-hidden dt-note-away"><b>${Yo}<span>${e?"Scrolled out of view":"Hidden right now"}</span></b>${e?`<button type="button" data-act="show-el" data-id="${t.id}">Show it</button>`:""}</div>`},_u=(t,e,s,o)=>{let a=(d,c,m=!1)=>`<button type="button" class="dt-lost-btn${m?" is-main":""}" data-act="${d}" data-id="${t.id}">${c}</button>`,i=(d,c,m)=>`<button type="button" class="dt-lost-btn dt-lost-ico" data-act="${d}" data-id="${t.id}" data-tip="${m}" aria-label="${m}">${c}</button>`,l=!n.client;if(o&&s==="later")return`<div class="dt-note-hidden dt-note-away"><b>${Yo}<span>Not on the page yet</span></b><button type="button" data-act="go-spot" data-id="${t.id}">Go to its place</button></div>`;if(o&&s==="gone"){let d=mc(t).before,c=Dt(t)!=="open";return`<div class="dt-lost dt-lost--gone"><p>${t.spot&&!c?"Its element is gone \u2014 here is how it looked. Pin it to something else, or close the thread.":"Not on this page any more \u2014 the element was removed or changed since. The thread stays: answer or resolve it here."}</p>${d?`<img class="dt-lost-shot" src="${f(ar(d.split("/").pop()))}" alt="How the element looked" loading="lazy">`:""}${c?"":`<span class="dt-lost-acts">${ro(t)?a("repin","Re-pin",!0):""}${i("lost-resolve",$e,"Resolve")}${l?i("archive",Ln,"Archive"):""}</span>`}</div>`}return s==="probably"?`<div class="dt-lost dt-lost--maybe"><p>The page changed since \u2014 is this still its element?</p><span class="dt-lost-acts">${ro(t)?a("pin-yes","Yes, it\u2019s this",!0)+a("repin","Re-pin"):""}</span></div>`:e?.opener?`<div class="dt-lost dt-lost--inside"><p>Inside ${f(lo(e.opener))} \u2014 closed now.</p><span class="dt-lost-acts">${a("open-it","Open it",!0)}</span></div>`:""},Ja=(t,e)=>sn(t)?.name||(t===e.by?.toLowerCase()?e.byName:"")||t.split("@")[0],Go={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(mt.getItem("dt-seen")||"{}")}catch{return{}}})(),Za=()=>D("dt-seen",JSON.stringify(Rn)),Gr=t=>{let e=en(t);if(!(t.id in Rn))return Rn[t.id]=e.length,Za(),!1;let s=e[e.length-1];return e.length>Rn[t.id]&&!(s?.author==="you"&&(!s.by||s.by===n.me?.email))},Kr=t=>{let e=en(t).length;Rn[t.id]!==e&&(Rn[t.id]=e,Za())},Wu=t=>{let e=sn(t);return e?` data-face="${f(e.avatar_url??"")}" data-initial="${Vo(e.name||e.email)}"`:""},zu=t=>n.client||qt(t)||Dt(t)==="done"?"":Jr(t,t.assignee??"",t.id),Vu=t=>{let e=Dt(t)==="done";return`<button type="button" class="dt-hist-tick" data-act="${e?"reopen":"done"}" data-id="${t.id}" data-tip="${e?"Reopen":Dt(t)==="claude"?"Looks right \u2014 resolve":"Resolve"}" aria-label="${e?"Reopen":"Resolve"}">${e?bn:$e}</button>`},Gu=t=>{let e=(t.replies??[]).filter(a=>!a.deleted);if(!e.length)return"";let s=[...new Set(e.map(a=>a.author==="claude"?"@agent":(a.by||"you").toLowerCase()))];return`<span class="dt-hist-replied"><span class="dt-hist-faces">${s.slice(0,3).map(a=>a==="@agent"?`<span class="dt-hist-face is-agent">${Pe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Ne(a)}">${mn(a,t)}</span>`).join("")}${s.length>3?`<i>+${s.length-3}</i>`:""}</span>${e.length} ${e.length===1?"reply":"replies"}</span>`},Ku=t=>{if(Cn!==t.id)return"";let e=(a,i,l="")=>`<button type="button" role="menuitem" ${a} class="${l}"><span>${i}</span></button>`,s=Me(t),o=!n.client;return`<div class="dt-hist-menu is-row" role="menu">${o&&!qt(t)?`<div class="dt-hist-assign"><span>Assign</span>${Xr(t.assignee??"",t.id)}</div><hr>`:""}${e(`data-row-unread="${t.id}"`,"Mark as unread")}${e(`data-row-link="${t.id}"`,"Copy link")}${qo()?e(`data-row-select="${t.id}"`,"Select")+(bs(t)?e(`data-row-mirror="${t.id}"`,"Mirror to Team"):""):""}${o&&Ke()&&!t.client?e(`data-row-move="${t.id}"`,qt(t)?"Move to Team":"Move to Client"):""}${o||!$s(t)?"<hr>":""}${o?`<button type="button" role="menuitem" data-act="${s?"unarchive":"archive"}" data-id="${t.id}"><span>${s?"Unarchive":"Archive"}</span></button>`:""}${$s(t)?"":e(`data-rm="${t.id}"`,"Delete thread","is-danger")}</div>`},Ur={queued:"#0d99ff",working:"#f5a623",asks:"#e93d82",stuck:"#e5402c",review:"#8e4ec6"};nu(t=>{if(t.matches(".dt-hist-go[data-go]")){let v=B.find(Rt=>Rt.id===Number(t.dataset.go)),A=v&&[...v.replies??[]].reverse().find(Rt=>!Rt.deleted);if(!v||!A)return null;let j=A.author==="claude",h=(A.by||"you").toLowerCase(),G=j?En(v):A.by?A.by===n.me?.email?"You":pn(A.by):"You",z=j?`<span class="dt-hist-face is-agent">${Pe(11)}</span>`:`<span class="dt-hist-face" style="--hue:${Ne(h)}">${mn(h,v)}</span>`,It=(A.images?.length?'<span class="dt-peek-chip">Picture</span>':"")+(A.files?.length?'<span class="dt-peek-chip">File</span>':"")+(A.audio?'<span class="dt-peek-chip">Voice note</span>':"");return`<span class="dt-peek-head"><span class="dt-peek-people">${z}</span><b>${f(G)}</b>${j?`<em>${f(cr(A.agent)||"")}</em>`:""}${A.editedAt?"<em>edited</em>":""}<em>${zn(A.at)}</em></span>`+(A.text?`<span class="dt-peek-text is-reply">${f(Zt(A.text,320))}</span>`:"")+(It?`<span class="dt-peek-files">${It}</span>`:"")}if(X!=null||!t.matches(".dt-pin[data-id]"))return null;let e=B.find(v=>v.id===Number(t.dataset.id));if(!e)return null;let s=[...new Set([e.by,...(e.replies??[]).filter(v=>v.author!=="claude").map(v=>v.by)].filter(Boolean).map(v=>v.toLowerCase()))].slice(0,3),o=Dt(e),a=n.client||qt(e)||o==="done"?null:we(e),i=a&&Ur[a]&&(Jt(e.assignee)||a==="review")?a:null,l=Bn.find(v=>v[0]===ts(e)),[d,c]=o==="done"?Me(e)?["#717171","Archived"]:["#30a46c","Resolved"]:i?[Ur[i],`${En(e)}${Qa(e)}`]:[l[2],l[1]],m=e.replies?.length??0;return`<span class="dt-peek-head">${s.length?`<span class="dt-peek-people">${s.map(v=>`<span class="dt-hist-face" style="--hue:${Ne(v)}">${mn(v,e)}</span>`).join("")}</span>`:""}<b>${f(e.byName||"You")}</b><em>\xB7 ${zn(e.createdAt)}</em></span><span class="dt-peek-text">${f(Zt(e.text,240))}</span><span class="dt-peek-foot">${Ve(d,o==="done"?1:0)}<span>${f(c)}${m?` \xB7 ${m} ${m===1?"reply":"replies"}`:""}</span></span>`});let Qa=t=>{let e=we(t),s=gr(t);return e==="working"?s?.step?` \xB7 ${hr(s.step)} \xB7 ${s.elapsed}`:" is working":e==="stuck"?` went quiet \xB7 ${s?.silent??""}${s?.step?` \xB7 last: ${s.step}`:""}`:e==="queued"?" \xB7 queued \xB7 next run":e==="asks"?" asks you \xB7 answer in the thread":e==="review"?" fixed it \xB7 to check":""},Uu=t=>{let e=sn(t);return e?Nn(e.avatar_url,e.name||e.email):""},Yr=(t,e,s={})=>`<option value="${f(t)}"${s.dot?` data-c="${Wr(t)}"`:""}${Wu(t||null)}${s.selected?" selected":""}>${f(e)}</option>`,Xr=(t,e,s=!1)=>{let o=Jt(t),a=o?"":t,i=sn(a),l=i?i.avatar_url?`<img class="dt-owner-face" src="${f(i.avatar_url)}" alt="">`:`<b class="dt-owner-face" style="--hue:${Ne(a.toLowerCase())}" aria-hidden="true">${Vo(i.name||i.email)}</b>`:a?nl:_r,d=a?i?.name||pn(a):"Anyone",c=A=>{let j=sn(A);return j?.avatar_url?`<img class="dt-menu-face" src="${f(j.avatar_url)}" alt="">`:`<b class="dt-menu-face" style="--hue:${Ne(A.toLowerCase())}">${[...Vo(j?.name||A)][0]}</b>`},m=(A,j,h="")=>`<option value="${f(A)}" data-icon="${f(A?c(A):_r)}"${h?` data-hint="${f(h)}"`:""}${A===a?" selected":""}${A?"":" data-sep-after"}>${f(j)}</option>`,v=Vs();return`<label class="dt-owner${i?" has-face":""}${s?" is-compact":""}" data-tip="${o?"The agent has it \u2014 pick a person to hand it over":s?f(d):"Who takes it"}">${l}${s?"":`<span class="dt-owner-name">${f(d)}</span>`}${Ks}<select class="dt-owner-select" data-search="Assign to\u2026"${e?` data-id="${e}"`:""} aria-label="Who takes it">
|
|
258
|
+
${m("","Anyone")}${v.map(A=>m(A.email,A.email===n.me?.email?`Me \xB7 ${A.name||A.email}`:A.name||A.email,A.email)).join("")}${a&&!v.some(A=>A.email===a)?m(a,pn(a)):""}
|
|
259
|
+
</select></label>`},Yu={queued:"queued",working:"working",asks:"asks you",stuck:"went quiet",review:"fixed it \u2014 to check",done:"done"},Jr=(t,e,s,o=!1)=>{let a=t?we(t):Jt(e)?"queued":null,i=!!a&&(Jt(e)||a==="review"),l=o?"The agent does not work in the clients\u2019 space":i?"Take it back":"Give to the agent",d=i?`With the agent \u2014 ${Yu[a]??"queued"}. Take it back`:l;return`<button type="button" class="dt-claude-btn${i?" is-on":""}" data-act="claude"${s?` data-id="${s}"`:""}${i?` data-step="${a}" style="--step-c:${Go[a]??Go.queued}"`:""} aria-pressed="${i}" data-tip="${f(l)}" aria-label="${f(d)}"${o?" disabled":""}>${Pe(13)}</button>`},Zr=t=>{if(!t){if(!N)return;Ua(0,Jt(N.assignee)?"nobody":"agent");return}let e=B.find(o=>o.id===t);if(!e)return;let s=we(e);zo(t,Jt(e.assignee)||s==="review"?"":jr)},Xu=t=>`<div class="dt-suggest dt-suggest--read"><del>${f(t.from)}</del><ins>${f(t.to)}</ins></div>`,Qr=(t,e)=>{let s=String(t??"").replace(/\s*>\s*/g," \u203A ").slice(-160);return f([s,ie(e??"")&&`\u201C${Zt(ie(e),80)}\u201D`].filter(Boolean).join(" \xB7 "))},Ks='<svg class="dt-chev" viewBox="0 0 12 12" width="9" height="9" aria-hidden="true"><path d="M3 4.5 6 7.5 9 4.5"/></svg>',ti=(t,e,s=!1)=>{let o=Is(t),a=i=>jc(i).replace("<svg ",`<svg style="stroke:${i.color}" `);return s?`<span class="dt-field dt-field--bare dt-field--type"><span class="dt-field-box">${a(o)}<span class="dt-field-label">${f(o.label)}</span></span></span>`:`<label class="dt-field dt-field--bare dt-field--type" data-tip="Type: ${f(o.label)}"><span class="dt-field-box">${a(o)}<span class="dt-field-label">${f(o.label)}</span>${Ks}<select class="dt-cat-select"${e?` data-id="${e}"`:""} aria-label="Type">${g.map(i=>`<option value="${i.id}" data-c="${i.color}" data-icon="${f(a(i))}"${i.id===t?" selected":""}>${i.label}</option>`).join("")}</select></span></label>`},Bn=[["new","New","#0d99ff",0],["progress","In progress","#f5a623",.25],["review","To check","#8e4ec6",.5],["waiting","Waiting","#e93d82",.75]],ts=t=>ln(t)||Be(t)==="progress"?"progress":Be(t)==="review"?"review":Be(t)==="waiting"?"waiting":"new",tl=(t,e)=>{if(e==="all")return!0;let s=Dt(t),o=vo(t,s),a=(n.me?.email??"").toLowerCase();return e==="nobody"?s!=="done"&&!!o&&!o.taker:e==="mine"?!!o&&o.taker===a:e==="others"?!!o&&!!o.taker&&o.taker!==a:e==="resolved"?s==="done":e==="claude"?!!o?.claude&&o.taker===a:e==="wrote"?!t.by||t.by.toLowerCase()===a:s==="claude"||s==="open"&&(we(t)==="review"||ts(t)==="review")},Ko={queued:"new",working:"progress",stuck:"progress",asks:"waiting",review:"review",done:"done"},Pn=[...Bn,["done","Resolved","#30a46c",1]],Ju=t=>{let e=we(t);return t.status==="done"&&e!=="review"?"done":e&&Ko[e]?Ko[e]:ts(t)},Zu=t=>{let e=we(t),s=Ju(t),[,,o,a]=Pn.find(l=>l[0]===s),i=!n.client&&Da(t)?l=>` data-note="${f(fo[l])}"`:()=>"";return`<label class="dt-field" data-tip="${e&&Ko[e]?"Follows the agent":"Status"}"><span class="dt-field-box dt-field-box--icon" style="--cat:${o}">${Ve(o,a)}<select class="dt-status-select" data-id="${t.id}" aria-label="Status">${i("new")?'<option disabled data-head data-note="The client sees">Status</option>':""}${Pn.map(([l,d,c,m])=>`<option value="${l}" data-c="${c}" data-icon="${f(Ve(c,m))}"${i(l)}${l===s?" selected":""}>${d}</option>`).join("")}${n.client?"":`<option value="${Me(t)?"unarchive":"archive"}" data-sep data-icon="${f(Ln)}">${Me(t)?"Out of the archive":"Archive"}</option>`}</select></span></label>`},Uo=(t,e,s)=>`<p class="dt-note-event"><span>${t}<b>${f(e)}</b>${s?`<time>${yr(s,zn)}</time>`:""}</span></p>`,vs=new Map,Qu=(t,e,s=1/0)=>{let{reopenedAt:o,reopenedBy:a,movedAt:i,movedBy:l,movedFrom:d,repinnedAt:c,repinnedBy:m,repinnedFrom:v}=t,A=en(t),j=Mt=>{let kt=Date.parse(Mt),Ct=A.findIndex((_t,ke)=>ke>0&&!!_t.at&&Date.parse(_t.at)>kt);return Ct<0?A.length:Ct},h=Mt=>Mt?Mt==="you"||Mt===n.me?.email?"you":Mt==="claude"?"the agent":pn(Mt):"",G=[],z=tp(t);if(z&&G.push([z.at?j(z.at):0,Uo(z.icon,z.words,z.time)]),i&&d&&G.push([j(i),Uo(ol,`Moved from ${d}${l?` by ${h(l)}`:""}`,i)]),c&&G.push([j(c),Uo(ol,`Re-pinned${m?` by ${h(m)}`:""}${v?` from ${v}`:""}`,c)]),o&&t.status!=="done"){let Mt=h(a);G.push([j(o),Uo(bn,Mt?`Reopened by ${Mt}`:"Reopened",o)])}let It=e.map(()=>!0);for(let[Mt,kt]of G.sort((Ct,_t)=>_t[0]-Ct[0]))e.splice(Mt,0,kt),It.splice(Mt,0,!1);let Rt=It.flatMap((Mt,kt)=>Mt?[kt]:[]),le=Rt.length-1-s;if(le<2)return e.join("");let Ot=[...new Set(en(t).slice(1,1+le).map(Mt=>Mt.author==="claude"?"@agent":(Mt.by||n.me?.email||"you").toLowerCase()))].slice(0,3).map(Mt=>Mt==="@agent"?`<span class="dt-hist-face is-agent">${Pe(9)}</span>`:`<span class="dt-hist-face" style="--hue:${Ne(Mt)}">${mn(Mt,t)}</span>`).join("");return[...e.slice(0,Rt[1]),`<button type="button" class="dt-note-fold" data-act="unfold" data-id="${t.id}"><span class="dt-hist-faces">${Ot}</span>${le} more replies</button>`,...e.slice(Rt[Rt.length-s])].join("")},tp=t=>{let e=t.from;if(e){if(Ps(t))return{icon:Fa,words:Lc(t.mirroredBy?t.mirroredBy===n.me?.email?"you":(t.mirroredByName||pn(t.mirroredBy)).split(" ")[0]:""),at:null,time:t.createdAt};let o=yt.find(a=>a.id===e.id);return{icon:ei,words:Mc(t,o,o?.by?pn(o.by):""),at:null,time:t.createdAt}}if(n.client)return null;let s=yt.find(o=>o.from?.id===t.id);return s?{icon:Ps(s)?Fa:ei,words:kc(s),at:s.createdAt??null,time:s.createdAt}:null},ep=(t,e)=>{let s=B.find(l=>l.id===t);if(!s)return;if(e==="done"){Xe(t,!0);return}if(e==="archive"||e==="unarchive"){ns(t,e==="archive");return}if(Jt(s.assignee)&&!qt(s)){s.status==="done"?Xe(t,!1):(Ut("Still with the agent \u2014 its step is the status; the agent button takes it back.",6e3),Z());return}let a=e==="new"&&Jt(s.assignee)?"approved":e,i=s.status==="done"?{status:"open",doneBy:null}:{};Ye(l=>l.map(d=>d.id===t?{...d,...i,stage:a}:d),()=>tt({id:t,...i,stage:a}),"Setting the status")},Us=[["low","Low","#30a46c",1],["normal","Mid","#f5c451",2],["high","High","#ff5a00",3],["urgent","Urgent","#e5484d",4]],np=(t,e)=>{let s=Math.max(0,Us.findIndex(d=>d[0]===t)),[,o,a,i]=Us[s],l=Us[(s+1)%Us.length];return`<button type="button" class="dt-prio" style="--cat:${a}" data-act="prio" data-v="${l[0]}"${e?` data-id="${e}"`:""} data-tip="Priority: ${o} \u2014 click for ${l[1]}" aria-label="Priority ${o}">${Jc(i,a)}<span>${o}</span></button>`},el=(t,e,s,o,a=!1,i=!1,l=!1)=>`<div class="dt-prio-row"><span class="dt-meta">${n.client?"":np(t,s)}${l?"":ti(Is(e).id,s,a)}</span>${n.client?"":`<span class="dt-who">${i?"":Xr(o,s)}${Jr(s?B.find(d=>d.id===s):void 0,o,s,i)}</span>`}</div>`,Yo='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M3 3l14 14M8.6 5.2A7.6 7.6 0 0 1 10 5c4.5 0 7.5 5 7.5 5a12.6 12.6 0 0 1-2.3 2.8M5.6 6.6A12.4 12.4 0 0 0 2.5 10s3 5 7.5 5c1.4 0 2.6-.4 3.7-1" stroke-linejoin="round"/></svg>',sp=t=>{let e=ie(t?.querySelector("h1, h2, h3, h4, h5, h6")?.textContent??t?.innerText?.split(`
|
|
260
|
+
`).find(s=>ie(s))??"");return e?e.length>30?`${Zt(e,30)}\u2026`:e:t?.tagName.toLowerCase()??""},nl='<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>',sl='<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>',ol='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M5 4.5v5a3 3 0 0 0 3 3h7.5M12.5 9.5l3 3-3 3" stroke-linejoin="round"/></svg>',ei='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><rect x="7" y="7" width="9.5" height="9.5" rx="2"/><path d="M13 7V5a1.5 1.5 0 0 0-1.5-1.5h-6A1.5 1.5 0 0 0 4 5v6a1.5 1.5 0 0 0 1.5 1.5H7"/></svg>',al='<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>',il='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2l-.9.9"/><path d="M11.5 8.5a3 3 0 0 0-4.2 0L5 10.8A3 3 0 0 0 9.2 15l.9-.9"/></svg>',rl=t=>{let e=(a,i,l,d="")=>`<option value="${a}" data-icon="${f(i)}"${d}>${l}</option>`,s=t&&Ke()?qt(t)?(Io(t)?"":e("mirror",Fa,"Mirror to Team"))+(t.client?"":e("move",al,"Move to Team")):e("dup",ei,"Duplicate for the client")+e("move",al,"Move to Client"):"",o=t&&n.client&&t.status==="done"?e("reopen",bn,"Reopen \u2014 back to work"):"";return`<label class="dt-more" data-tip="More"><span aria-hidden="true">${sl}</span><select class="dt-more-select"${t?` data-id="${t.id}"`:""} aria-label="More">
|
|
237
261
|
<option value="" hidden selected></option>
|
|
238
|
-
${
|
|
239
|
-
${e(t?"rm":"discard",
|
|
240
|
-
</select></label>`},
|
|
241
|
-
${
|
|
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="${
|
|
262
|
+
${s}${o}${t?e("link",il,"Copy link"):""}${t&&!n.client&&t.id>0?e(Me(t)?"unarchive":"archive",Ln,Me(t)?"Out of the archive":"Archive"):""}
|
|
263
|
+
${e(t?"rm":"discard",cs,t?"Delete thread":"Discard draft",` data-danger${t?" data-sep":""}`)}
|
|
264
|
+
</select></label>`},Xo=()=>n.studio?(n.team??[]).filter(t=>n.studio.includes(t.email)):[],ll=t=>{let e=t||n.lead||"",s=Xo();return!s.length||s.some(o=>o.email===e)?e:s[0].email},op=t=>{let e=ll(t),s=Xo();if(!s.length)return"";let o=Uu(e);return`<label class="dt-field" title="Who it is for"><span class="dt-field-box${o?" dt-field-box--face":""}" style="--cat:${Wr(e||"x@x")}">${o}<select class="dt-for-select" aria-label="Who this is for">
|
|
265
|
+
${s.map(a=>Yr(a.email,a.name||a.email,{dot:!0,selected:e===a.email})).join("")}
|
|
266
|
+
</select></span></label>`},Ys='<svg viewBox="0 0 20 20" width="9" height="9" aria-hidden="true"><path d="M5.5 5.5l9 9M14.5 5.5l-9 9"/></svg>',dl='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M3 1.8v8.4L10 6z"/></svg>',ap='<svg viewBox="0 0 12 12" width="10" height="10" aria-hidden="true"><path d="M2.5 1.5h2.5v9H2.5zM7 1.5h2.5v9H7z"/></svg>',ip=t=>`${Math.floor(t/60)}:${String(Math.floor(t%60)).padStart(2,"0")}`,rp=(t,e)=>{let s=t.closest(".dt-voice"),o=s.querySelector("audio"),a=s.querySelector(".dt-voice-play");if(!o.dataset.wired){o.dataset.wired="1";let d=s.querySelector(".dt-voice-track i"),c=s.querySelector(".dt-voice-time"),m=()=>Number.isFinite(o.duration)?o.duration:0;o.addEventListener("timeupdate",()=>{d.style.transform=`scaleX(${m()?Math.min(1,o.currentTime/m()):0})`,c.textContent=ip(o.currentTime)}),o.addEventListener("play",()=>{a.innerHTML=ap,a.setAttribute("aria-label","Pause"),s.classList.add("is-playing")}),o.addEventListener("pause",()=>{a.innerHTML=dl,a.setAttribute("aria-label","Play the voice note"),s.classList.remove("is-playing")}),o.addEventListener("ended",()=>{o.currentTime=0})}let i=()=>{if(e){let d=s.querySelector(".dt-voice-track").getBoundingClientRect();Number.isFinite(o.duration)&&(o.currentTime=Math.max(0,Math.min(1,(e.clientX-d.left)/d.width))*o.duration);return}if(!o.paused){o.pause();return}nt.querySelectorAll(".dt-voice audio").forEach(d=>{d!==o&&d.pause()}),o.play().catch(()=>{})};if(Number.isFinite(o.duration)||o.readyState<1){o.readyState<1?o.addEventListener("loadedmetadata",()=>Number.isFinite(o.duration)?i():l(),{once:!0}):i();return}l();function l(){o.addEventListener("timeupdate",()=>{o.currentTime=0,i()},{once:!0}),o.currentTime=1e9}},ni=t=>t.startsWith("data:audio/")||/(^|\/)voice-[^/?]*\.(webm|m4a)(\?|$)/i.test(t),cl=t=>t.startsWith("data:video/")||/\.webm(\?|$)/i.test(t),Xs=new Map,lp=t=>{if(!t.startsWith("data:"))return t;let e=Xs.get(t);if(!e){let[s,o]=t.split(",",2);if(e=URL.createObjectURL(new Blob([Uint8Array.from(atob(o),a=>a.charCodeAt(0))],{type:s.slice(5).split(";")[0]})),Xs.set(t,e),Xs.size>8){let[a,i]=Xs.entries().next().value;URL.revokeObjectURL(i),Xs.delete(a)}}return e},dp=(t,e)=>`<span class="dt-voice"><button type="button" class="dt-voice-play" data-act="voice" aria-label="Play the voice note">${dl}</button><button type="button" class="dt-voice-track" data-act="voice-seek" aria-label="Jump"><i></i></button><span class="dt-voice-time">0:00</span><audio src="${lp(t)}" preload="metadata"></audio>${e===void 0?"":`<button class="dt-voice-rm" data-act="voice-write" ${e} aria-label="Write it out" title="Write it out \u2014 its words go in the box">${$p}</button>`}${e===void 0?"":`<button class="dt-voice-rm" data-act="unshot" ${e} aria-label="Remove the recording" title="Remove the recording">${Ys}</button>`}</span>`,si=t=>t.length>30?`${Zt(t,17)}\u2026${[...t].slice(-11).join("")}`:t,cp=t=>{if(!t.startsWith("data:"))return"";let e=Math.round((t.length-t.indexOf(",")-1)*3/4);return e<1024*1024?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`},oi=t=>{let e=hc(t);return`<i class="dt-file-tile" style="--k:${e.color}" aria-hidden="true">${e.label}</i>`},up=(t,e,s)=>{let o=!t.startsWith("data:"),a=o?`${t}${t.includes("?")?"&":"?"}download=${encodeURIComponent(e)}`:"",i=`${oi(e)}<span class="dt-file-text"><b>${f(si(e))}</b>${o?"":`<small>${cp(t)}</small>`}</span>`;return`<span class="dt-file" title="${f(e)}">${o?`<a class="dt-file-open" href="${f(rr(e)?t:a)}"${rr(e)?' target="_blank" rel="noreferrer"':` download="${f(e)}"`}>${i}</a><a class="dt-tip-r dt-file-get" href="${f(a)}" download="${f(e)}" aria-label="Download ${f(e)}" data-tip="Download">${hp}</a>`:`<span class="dt-file-open">${i}</span>`}${s===void 0?"":`<button class="dt-file-rm" data-act="unshot" ${s} aria-label="Remove">${Ys}</button>`}</span>`},pp=(t,e)=>{let[,s,o]=t.split("\0");return`<span class="dt-file is-refused" title="${f(s)}"><span class="dt-file-open">${oi(s)}<span class="dt-file-text"><b>${f(si(s))}</b><small>${f(o)}</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${Ys}</button></span>`},mp=(t,e)=>{let[,,s,o]=t.split("\0");return`<span class="dt-file" title="${f(s)}"><span class="dt-file-open">${oi(s)}<span class="dt-file-text"><b>${f(si(s))}</b><small>${(Number(o)/1024/1024).toFixed(1)} MB \u2014 uploads when you send</small></span></span><button class="dt-file-rm" data-act="unshot" ${e} aria-label="Remove">${Ys}</button></span>`},ul=(t,e,s=t)=>t.startsWith(Jo)?pp(t,e??""):t.startsWith(ii)?mp(t,e??""):yo(s)?up(t,yo(s),e):ni(s)?dp(t,e):`<span class="dt-shot${cl(s)?" dt-shot--video":""}">${cl(s)?`<video src="${t}" controls preload="metadata" playsinline></video>`:`<a href="${t}" target="_blank"><img src="${t}" alt="" loading="lazy" /></a>`}${e===void 0?"":`<button class="dt-shot-rm" data-act="unshot" ${e} aria-label="Remove">${Ys}</button>`}</span>`,ai=(t=[],e)=>t.length?`<div class="dt-note-shots">${t.map(s=>{let o=s.split("/").pop(),a=ar(o);return ul(a,e===void 0?void 0:`data-id="${e}" data-img="${f(o)}"`,o)}).join("")}</div>`:"",pl=(t=[])=>t.length?`<div class="dt-note-shots">${t.map((e,s)=>ul(e,`data-i="${s}"`)).join("")}</div>`:"",hp='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="M10 3.5v9M6 9l4 4 4-4M4 16.5h12" stroke-linejoin="round"/></svg>',gp='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><path d="M16 9.5 9.9 15.6a3.6 3.6 0 0 1-5.1-5.1l6.6-6.6a2.4 2.4 0 0 1 3.4 3.4l-6.6 6.6a1.2 1.2 0 0 1-1.7-1.7L12.4 6.3" stroke-linejoin="round"/></svg>',Jo="refused:\0",ii="big:\0",Zo=new Map,ws=t=>!t.startsWith(ii),fp='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="7.5" y="3" width="5" height="9" rx="2.5"/><path d="M5 9.5a5 5 0 0 0 10 0M10 14.5V17"/></svg>',bp='<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true"><path d="m5 10.5 3.2 3L15 6.5"/></svg>',yp=90,ri=32,vp=()=>!!n.voice&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<"u",Qo=!1,wp=async(t,e)=>{if(Qo||!t)return;let s=Number(t.dataset.id)||0;Qo=!0,e.classList.add("is-asking"),e.title="Waiting for the microphone \u2014 allow it in the browser";let o=setTimeout(()=>Ut("Allow the microphone in the browser\u2019s prompt by the address bar",6e3),3e3),a;try{a=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(bt){clearTimeout(o),Qo=!1,e.classList.remove("is-asking");let Ot=bt?.name;Ut(Ot==="NotAllowedError"?"The microphone is blocked for this site \u2014 allow it from the icon left of the address, then try again.":Ot==="NotFoundError"?"No microphone found \u2014 plug one in or pick it in the system settings.":Ot==="NotReadableError"?"The microphone is busy in another app \u2014 close it there and try again.":`The microphone did not start: ${bt?.message||Ot||"unknown error"}`,9e3);return}clearTimeout(o),e.classList.remove("is-asking");let i=()=>nt.querySelector(s?`.dt-note[data-id="${s}"] .dt-compose`:".dt-note[data-draft] .dt-compose"),l=document.createElement("div");l.className="dt-rec",l.innerHTML=`<button type="button" class="dt-rec-x" title="Discard (Esc)" aria-label="Discard">${cs}</button><span class="dt-rec-time"><i></i><b>0:00</b></span><span class="dt-rec-wave">${"<i></i>".repeat(ri)}</span><button type="button" class="dt-rec-done" title="Done \u2014 write it out" aria-label="Done">${bp}</button>`;let d=l.querySelector("b"),c=[...l.querySelectorAll(".dt-rec-wave i")],m=new AudioContext,v=m.createAnalyser();v.fftSize=512,m.createMediaStreamSource(a).connect(v);let A=new Uint8Array(v.fftSize),j=[],h=new MediaRecorder(a,{audioBitsPerSecond:32e3}),G=[],z=Date.now(),It=!0,Rt=setInterval(()=>{let bt=i();if(!bt){le(!1);return}l.parentElement!==bt&&bt.appendChild(l),v.getByteTimeDomainData(A);let Ot=0;for(let Ct of A)Ot+=((Ct-128)/128)**2;j.push(Math.min(1,Math.sqrt(Ot/A.length)*4));let Mt=j.slice(-ri);c.forEach((Ct,_t)=>{let ke=Mt[_t-(ri-Mt.length)];Ct.style.transform=`scaleY(${Math.max(.1,ke??0).toFixed(2)})`,Ct.classList.toggle("is-empty",ke===void 0)});let kt=Math.floor((Date.now()-z)/1e3);d.textContent=`${Math.floor(kt/60)}:${String(kt%60).padStart(2,"0")}`,kt>=yp&&h.state!=="inactive"&&h.stop()},90),le=bt=>{It=bt,h.state!=="inactive"&&h.stop()};l.querySelector(".dt-rec-x").addEventListener("click",bt=>{bt.stopPropagation(),le(!1)}),l.querySelector(".dt-rec-done").addEventListener("click",bt=>{bt.stopPropagation(),le(!0)}),l.addEventListener("keydown",bt=>{bt.key==="Escape"&&(bt.stopPropagation(),le(!1))}),h.ondataavailable=bt=>{bt.data.size&&G.push(bt.data)},h.onstop=async()=>{if(clearInterval(Rt),a.getTracks().forEach(Mt=>Mt.stop()),m.close().catch(()=>{}),l.remove(),Qo=!1,!It)return;let bt=new Blob(G,{type:h.mimeType||"audio/webm"}),Ot=await new Promise(Mt=>{let kt=new FileReader;kt.onload=()=>Mt(String(kt.result)),kt.readAsDataURL(bt)});s?Ee.push(Ot):N&&(N.images??=[]).push(Ot),Z(),i()?.querySelector("textarea")?.focus()},h.start(1e3),i()?.appendChild(l),l.querySelector(".dt-rec-done").focus()},ml="\u{1F3A4} Voice note",$p='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><rect x="2.5" y="4.5" width="15" height="11" rx="2"/><path d="M6 11.5h3M11 11.5h3M6 8.5h8"/></svg>',xp=async t=>{let e=t.closest(".dt-note"),o=(e?.hasAttribute("data-draft")?N?.images??[]:Ee)[Number(t.dataset.i)];if(!o||t.classList.contains("is-asking"))return;t.classList.add("is-asking");let a=await ae("transcribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({audio:o})}).catch(()=>null),i=a?await a.json().catch(()=>({})):{};if(t.classList.remove("is-asking"),!a?.ok||!i.text){Ut(i.error||(a?.ok?"Didn't hear any words in it.":"Could not make out the words \u2014 try again, or type it."));return}let l=e?.querySelector("textarea.dt-note-input, textarea.dt-note-reply-input");l&&(l.value=l.value.trim()?`${l.value.trimEnd()} ${i.text}`:i.text,l.dispatchEvent(new Event("input",{bubbles:!0})),l.focus())},hn=new Map,li=new Map,di=async(t,e,s)=>{let o=`${t}:${e}`;if(li.delete(o),!s){hn.delete(o),Z();return}let a=B.find(c=>c.id===t),i=a&&en(a).find(c=>(c.at??"0")===e);if(!i?.text)return;hn.set(o,{to:s,text:null}),Z();let l=await ae("translate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:i.text,to:s})}).catch(()=>null),d=l?await l.json().catch(()=>({})):{};hn.get(o)?.to===s&&(l?.ok&&d.text?hn.set(o,{to:s,text:d.text}):(hn.delete(o),li.set(o,s)),Z())},Ep=(t,e,s)=>{let o=hn.get(`${t}:${e}`),a=Ta(s),i=(navigator.language||"en").split("-")[0].toLowerCase();return`<label class="dt-msg-edit dt-msg-lang${o?" is-on":""}" data-tip="Translate">${o?.text===null?`<span class="dt-tr-spin">${Mp}</span>`:Lp}<span aria-hidden="true">${Ks}</span><select class="dt-lang-select" data-id="${t}" data-at="${f(e)}" aria-label="Translate"><option value="" hidden${o?"":" selected"}></option><option data-head disabled>${a?`Written in ${f(fr(a))}`:"Translate into"}</option>${Bc(s,navigator.language||"en").map(l=>`<option value="${f(l)}" data-bare${l===i?' data-note="your language"':""}${o?.to===l?" selected":""}>${f(Rc(l))}</option>`).join("")}<option value="orig" data-sep data-icon="${f(bn)}"${o?"":" disabled"}>Show original</option></select></label>`},Mp='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M10 3a7 7 0 1 0 7 7"/></svg>',kp=(t,e,s)=>{let o=`${t}:${e}`,a=Ta(s);if(hn.get(o)?.text)return`<p class="dt-tr-note">Translated from ${a?f(fr(a)):"another language"} \xB7 <button type="button" data-act="tr-orig" data-id="${t}" data-at="${f(e)}">Show original</button></p>`;let i=li.get(o);return i?`<p class="dt-tr-note is-error" role="alert">Could not translate it \xB7 <button type="button" data-act="tr-retry" data-id="${t}" data-at="${f(e)}" data-to="${f(i)}">Try again</button></p>`:""},Lp='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M3 5h8M7 3v2m2 0c-.6 3.2-2.8 6-6 7.5M5.5 8.5c.8 1.6 2.2 2.9 4 3.8M10.5 17l3.25-7.5L17 17m-5.5-2h4.5"/></svg>',Sp='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><circle cx="10" cy="10" r="6.5"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/></svg>',hl='<svg viewBox="0 0 20 20" width="13" height="13" aria-hidden="true"><path d="M15.9 9.3a6.5 6.5 0 1 1-5.2-5.7"/><path d="M7.3 11.6c.7.9 1.6 1.4 2.7 1.4s2-.5 2.7-1.4"/><path d="M7.8 8.2h.01M12.2 8.2h.01" stroke-width="2"/><path d="M15.5 2.5v4.5M13.25 4.75h4.5"/></svg>',ci=()=>n.me?.email??"you",Tp=(t,e,s)=>{let o=Object.entries(s??{}).filter(([,a])=>a.length);return o.length?`<div class="dt-reacts">${o.map(([a,i])=>{let l=i.includes(ci()),d=i.map(c=>c===ci()?"You":pn(c)).join(", ");return`<button type="button" class="dt-react${l?" is-mine":""}" data-act="react" data-id="${t}" data-at="${f(e)}" data-emoji="${f(a)}" aria-pressed="${l}" data-tip="${f(d)}" aria-label="${f(`${a} ${i.length}: ${d}`)}">${f(a)}<span>${i.length}</span></button>`}).join("")}<button type="button" class="dt-react dt-react-add" data-act="react-pick" data-id="${t}" data-at="${f(e)}" data-tip="Add reaction" aria-label="Add reaction">${hl}</button></div>`:""},gl=(t,e,s)=>{ta();let o=document.createElement("div");o.className=`dt-emoji${e?" is-all":""}`,o.setAttribute("role","menu"),o.setAttribute("aria-label",s.box?"Emoji":"React"),o.innerHTML=(e?yc:bc).map(v=>`<button type="button" role="menuitem" data-act="emoji" data-emoji="${f(v)}" aria-label="${f(v)}">${f(v)}</button>`).join("")+(e?"":`<button type="button" role="menuitem" class="dt-emoji-more" data-act="emoji-more" data-tip="More emoji" aria-label="More emoji">${sl}</button>`),xn={...s,btn:t},nt.append(o);let a=t.getBoundingClientRect(),i=o.getBoundingClientRect(),l=6,d=8,c=a.top-l-i.height>=d;o.style.top=`${c?a.top-l-i.height:Math.min(a.bottom+l,innerHeight-d-i.height)}px`;let m=(t.closest(".dt-note")??t).getBoundingClientRect().right;o.style.left=`${Math.min(Math.max(d,m-i.width),innerWidth-d-i.width)}px`,o.querySelector("button")?.focus()},xn=null,ta=()=>{nt.querySelectorAll(".dt-emoji").forEach(t=>t.remove()),xn=null},Ap=(t,e)=>{t.setRangeText(e,t.selectionStart??t.value.length,t.selectionEnd??t.value.length,"end"),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()},fl=(t,e,s)=>{let o=a=>{let i=vc(a.reactions,s,ci());return i===null?a:{...a,reactions:i}};Ye(a=>a.map(i=>i.id!==t?i:e?{...i,replies:i.replies?.map(l=>l.at===e?o(l):l)}:o(i)),()=>tt({id:t,react:{at:e,emoji:s}}),"The reaction")},Hp='<svg viewBox="0 0 20 20" width="15" height="15" aria-hidden="true"><rect x="3" y="4" width="14" height="12" rx="2"/><circle cx="7.5" cy="8.5" r="1.4"/><path d="m3.5 14.5 4-4 3 3 2-2 4 4"/></svg>',ui=1e4,bl=(t,e,s,o,a="")=>`<div class="dt-note-foot"><div class="dt-compose">
|
|
267
|
+
<textarea class="${t}" rows="1" maxlength="${ui}" aria-label="${e}" placeholder="${e}">${f(s)}</textarea>
|
|
244
268
|
${a}
|
|
245
269
|
<div class="dt-compose-bar">
|
|
246
|
-
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${
|
|
247
|
-
${
|
|
248
|
-
<button class="dt-send${
|
|
270
|
+
<span class="dt-compose-tools"><button class="dt-attach" data-act="attach" title="Attach a picture \u2014 or paste or drop one">${Hp}</button><button class="dt-attach" data-act="attach-file" title="Attach a file \u2014 any but a program, up to 50 MB">${gp}</button>
|
|
271
|
+
${vp()?`<button class="dt-attach" data-act="speak" title="Speak \u2014 sent with its words as a voice note">${fp}</button>`:""}<button class="dt-attach" data-act="emoji-pick" data-tip="Emoji" aria-label="Emoji">${Sp}</button></span>
|
|
272
|
+
<button class="dt-send${s.trim()?" is-ready":""}" ${o} title="Send (Enter)"
|
|
249
273
|
><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>
|
|
250
274
|
</div>
|
|
251
|
-
</div></div>`,
|
|
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:${
|
|
254
|
-
title="${f(Zt(
|
|
255
|
-
style="left:${
|
|
275
|
+
</div></div>`,ea=(t,e,s)=>(t||/^[a-z][a-z0-9-]*/i.exec(s?.split(">").pop()?.trim()??"")?.[0]||"element")+(e?.[0]?"."+e[0]:""),yl=()=>De.map((t,e)=>({i:e,el:ea(t.tag,t.classes,t.selector),text:ie(t.text??""),shots:t.images?.length??0,orphan:!Te(t)})),pi=[],vl="",En=t=>{let e=t.working;return Wn(e?.agent,e?.by??t.doneFor)},Cp=t=>{let e=Math.max(1,Math.round((Date.now()-Date.parse(t??""))/6e4)||1);return e<60?`${e} min`:`${Math.round(e/60)} h`},na=(t,e)=>{let s=t.working;return{queued:"Queued for the agent \u2014 it takes it on its next run",asks:`${En(t)} is waiting for your answer`,working:`${En(t)} is on it \xB7 ${Cp(s?.at)}`,stuck:`${En(t)} went quiet \u2014 its next run takes it again`,review:`To check \u2014 ${Wn(t.doneAgent,t.doneFor)} fixed it \xB7 click to reopen`,done:"Resolved"}[e]},Np=t=>{if(n.client||qt(t))return"";let e=we(t);if(!e)return t.status==="done"?"":`<button class="dt-note-state dt-step--none" data-act="hand" data-v="agent" data-id="${t.id}" data-tip="Hand to the agent" aria-label="Hand to the agent">${vr(13,0)}</button>`;let s=vr(13,12);return e==="review"?`<button class="dt-note-state dt-step--review" data-act="reopen" data-id="${t.id}" data-tip="${f(na(t,e))}" aria-label="${f(na(t,e))}">${s}</button>`:`<span class="dt-note-state dt-step--${e}" data-tip="${f(na(t,e))}" role="img" aria-label="${f(na(t,e))}">${s}</span>`},$s=t=>!!n.client&&!(n.me&&t.by===n.me.email),wl=(t,e=!0,s=!0)=>{let o=Dt(t),a=o==="done",i=Me(t);return`${e?Np(t):""}<button data-act="${a?"reopen":"done"}" data-id="${t.id}"
|
|
276
|
+
class="dt-note-resolve${a&&!i?" is-on":""}" title="${a?"Reopen":o==="claude"?"Looks right \u2014 mark it resolved":"Resolve"}">${$e}</button>${n.client||!s?"":`<button data-act="${i?"unarchive":"archive"}" data-id="${t.id}" class="dt-note-archive${i?" is-on":""}" title="${i?"Out of the archive \u2014 back to resolved":"Archive \u2014 put it away"}">${Ln}</button>`}`},Rp='<i class="dt-step-dots" aria-hidden="true"><i></i><i></i><i></i></i>',mi=new Map,Bp=(t,e)=>{let s=hr(e,25),o=mi.get(t);o?.now!==s&&mi.set(t,{now:s,was:o?.now??"",at:performance.now()});let a=mi.get(t),i=a.was&&performance.now()-a.at<160?a.was:"";return`<span class="dt-step-words">${i?`<span class="dt-step-was" data-k="was:${f(i)}" aria-hidden="true">${f(i)}</span>`:""}<span class="dt-step-now" data-k="${f(s)}"${s!==e?` data-tip="${f(e)}"`:""}>${f(s)}</span></span>`},Pp=t=>{if(t.status==="done"&&t.doneBy!=="claude"&&!Me(t)){let m=t.confirmedBy?t.confirmedBy===n.me?.email?"you":pn(t.confirmedBy).split(" ")[0]:"",v=t.confirmedAt;return`<div class="dt-step dt-step--resolved">${Ve(Pn[Pn.length-1][2],1)}<span class="dt-step-text"><b>${f(m?`Resolved by ${m}`:"Resolved")}${v?` \xB7 ${f(yr(v))}`:""}</b></span><button type="button" class="dt-step-act" data-act="reopen" data-id="${t.id}" data-tip="Reopen \u2014 not right yet" aria-label="Reopen">${bn}</button>`+(n.client?"</div>":`<button type="button" class="dt-step-act" data-act="archive" data-id="${t.id}" data-tip="Looks right \u2014 archive it" aria-label="Looks right \u2014 archive it">${Ln}</button></div>`)}if(n.client||qt(t))return"";let e=we(t),s={act:"hand",v:"me",icon:nl,tip:n.me?"Take it myself":"Take it off the agent"},o=[{act:"sendback",icon:bn,tip:"Send it back \u2014 say what is wrong below"},{act:"accept",icon:$e,tip:"Looks right \u2014 mark it resolved",main:!0,label:"Looks right"}],a=gr(t),i=!Jt(t.assignee)&&t.assignee?t.assignee===n.me?.email?"You":pn(t.assignee).split(" ")[0]:"",l=[a?.step&&`last: ${a.step}`,a?.stale&&"next run retries"].filter(Boolean).join(" \xB7 "),d=e==="queued"?{step:e,title:"With the agent \u2014 queued",sub:"Starts on the agent\u2019s next run",acts:[]}:e==="working"?a?.step?{step:e,title:"",now:a.step,time:a.elapsed,acts:[],live:!0}:{step:e,title:"With the agent \u2014 working",acts:[],live:!0}:e==="asks"?null:e==="stuck"?{step:e,title:`Silent for ${a?.silent??"a while"}`,sub:l&&l[0].toUpperCase()+l.slice(1),acts:[s]}:e==="review"?null:Be(t)==="review"&&i?{step:"review",title:`${i} ${i==="You"?"say":"says"} done`,acts:o}:null;if(!d)return"";let c=d.step==="review"?Ve(Bn[2][2],Bn[2][3]):`<i class="dt-step-mark">${Pe(16)}</i>`;return`<div class="dt-step dt-step--${d.step}">${c}${d.now?`${Rp}<span class="dt-step-text" aria-live="polite"><b>${Bp(t.id,d.now)}</b></span>`:`<span class="dt-step-text"><b>${f(d.title)}</b>${d.sub?`<span>${f(d.sub)}</span>`:""}</span>`}${d.acts.map(m=>m.pick?`<label class="dt-step-act" data-tip="${f(m.tip)}">${m.icon}<select class="dt-for-select" data-id="${t.id}" aria-label="${f(m.tip)}"><option value="" selected hidden></option>${Vs().map(v=>Yr(v.email,v.email===n.me?.email?`Me \xB7 ${v.name||v.email}`:v.name||v.email)).join("")}</select></label>`:`<button type="button" class="dt-step-act${m.main?" is-main":""}${m.label?" has-label":""}" data-act="${m.act}" data-id="${t.id}"${m.v?` data-v="${m.v}"`:""} data-tip="${f(m.tip)}" aria-label="${f(m.tip)}">${m.icon}${m.label?f(m.label):""}</button>`).join("")}${d.live?'<i class="dt-step-live" aria-hidden="true"></i>':""}</div>`},Ip=async(t,e,s)=>{let o=e?B.find(i=>i.id===t):void 0,a=await tt(e?{id:t,status:"done",doneBy:"you"}:{id:t,status:"open",doneBy:null,...s});return a.ok&&o&&qi(Ce(o)).then(i=>{i&&tt({id:t,after:i.url})}),a},es=0,$l=()=>{},In=t=>(es++,t.finally(()=>{es--,$l()})),Ye=async(t,e,s)=>{let o=B,a=yt;B=t(B),yt=t(yt),Z();let i;dt=o;try{i=e()}finally{dt=null}let l=await In(i).catch(()=>null),d=l?.status===409?await l.clone().json().catch(()=>null):null;if(d?.thread&&d.field){let m=qn([d.thread])[0];B=(es?B:o).map(A=>m&&A.id===m.id?m:A),yt=(es?yt:a).map(A=>m&&A.id===m.id?m:A),Z();let v=d.by?d.by==="claude"?"The agent":pn(d.by):"Someone";Ut(`${v[0].toUpperCase()}${v.slice(1)} changed the ${d.field} just now`,6e3),Ze();return}if(!l?.ok){es?Ze():(B=o,yt=a,Z()),Dn(`${s} did not go through`,l);return}let c=qn([await l.json().catch(()=>null)])[0];c&&(B=B.map(m=>m.id===c.id?c:m),yt=yt.map(m=>m.id===c.id?c:m),Z()),Ze()},Op=t=>t?Jt(t.assignee)?{stage:"approved"}:t.status==="done"&&t.doneBy==="claude"&&!qt(t)&&!n.client?{stage:"approved",assignee:"claude"}:{stage:t.assignee?"progress":"new"}:{stage:"new"},xl=async(t,e)=>{let s=[];for(let o=0;o<t.length;o+=6)s.push(...await Promise.all(t.slice(o,o+6).map(e)));return s},Xe=async(t,e)=>{let s=e?void 0:Op(B.find(l=>l.id===t)??yt.find(l=>l.id===t));await Ye(l=>l.map(d=>d.id===t?{...d,status:e?"done":"open",doneBy:e?"you":null,...e?{confirmedBy:n.me?.email??null}:{...s,confirmedBy:null,reopenedAt:new Date().toISOString(),reopenedBy:n.me?.email??"you"}}:d),()=>Ip(t,e,s),e?"Resolving":"Reopening");let o=yt.find(l=>l.id===t),a=e?Ac(o):null,i=a!=null&&yt.find(l=>l.id===a);i&&qt(i)&&i.status!=="done"&&(await tt({id:i.id,reply:Tc,status:"done",doneBy:"you"}).catch(()=>null),Ze())},ns=async(t,e,s=!1)=>{let o=B.find(i=>i.id===t);if(!o)return;let a=e&&o.status!=="done"?{status:"done",doneBy:"you"}:{};await Ye(i=>i.map(l=>l.id===t?{...l,...a,archivedAt:e?new Date().toISOString():void 0,archivedBy:e?n.me?.email:void 0}:l),()=>tt({id:t,archived:e,...a}),e?"Archiving":"Taking it out of the archive"),e&&!s&&Re(`Archived #${t}`,()=>ns(t,!1,!0))},Re=(t,e,s="Undo")=>{let o=document.createElement("div");o.className="dt-toast dt-toast--undo",o.innerHTML=`<span>${f(t)}</span><button type="button">${f(s)}</button>`,Ba(o),o.querySelector("button").addEventListener("click",()=>{o.remove(),e()}),document.body.append(o),setTimeout(()=>Kn(o,()=>o.remove()),5e3)},sa=new Set,oa=new Set,Js=new Map,El=(t,e,s,o,a)=>{Js.get(t)?.(),s();let i=!1,l=()=>{i||(i=!0,clearTimeout(d),Js.delete(t),a())},d=window.setTimeout(l,5e3);Js.set(t,l),Re(e,()=>{i||(i=!0,clearTimeout(d),Js.delete(t),o())})};addEventListener("pagehide",()=>{for(let t of[...Js.values()])t()});let Ml=(t,e,s)=>!e||t.some(o=>o.id===e.id)?t:[...t.slice(0,s),e,...t.slice(s)],hi=t=>{let e=B.find(i=>i.id===t),s=B.findIndex(i=>i.id===t),o=yt.find(i=>i.id===t),a=yt.findIndex(i=>i.id===t);El(`t${t}`,`Thread #${t} deleted`,()=>{sa.add(t),B=B.filter(i=>i.id!==t),yt=yt.filter(i=>i.id!==t),Z()},()=>{sa.delete(t),B=Ml(B,e,s),yt=Ml(yt,o,a),Z()},async()=>{let i=await In(ae(`comments?id=${t}`,{method:"DELETE",keepalive:!0})).catch(()=>null);sa.delete(t),i?.ok||Dn("Deleting did not go through",i),Ze()})},qp=(t,e)=>{let s=`${t}|${e}`,o=l=>l.find(d=>d.id===t)?.replies?.find(d=>d.at===e),a=o(B)??o(yt);if(!a)return;let i=(l,d)=>l.map(c=>c.id!==t?c:{...c,replies:(c.replies??[]).map(m=>m.at===e?d(m):m)});El(`r${s}`,"Reply deleted",()=>{oa.add(s),B=i(B,l=>({...l,text:"",deleted:!0})),yt=i(yt,l=>({...l,text:"",deleted:!0})),Z()},()=>{oa.delete(s),B=i(B,()=>a),yt=i(yt,()=>a),Z()},async()=>{let l=await In(tt({id:t,unsay:e})).catch(()=>null);oa.delete(s),l?.ok||Dn("Deleting the reply did not go through",l),Ze()})},xs=null,kl=t=>Math.max(70,t*18),Ll=t=>{let e=Dt(t),s=Us.find(o=>o[0]===t.priority)?.[3]??1;return(t.id===X?-100:0)+(Me(t)?30:e==="done"?20:e==="claude"?10:0)-s},Dp=(t,e)=>{let s=[];for(let a of t){let i=e.get(a.id);if(!i)continue;let l=s.find(d=>{let c=e.get(d[0].id);return Math.abs(c.x-i.x)<6&&Math.abs(c.y-i.y)<6});l?l.push(a):s.push([a])}let o=new Map;for(let a of s){if(a.length<2)continue;a.sort((c,m)=>Ll(c)-Ll(m)||m.id-c.id);let i=a.length,l=kl(i),d=String(a[0].id);a.forEach((c,m)=>{let v=(-150+120*m/(i-1))*(Math.PI/180);o.set(c.id,{key:d,i:m,n:i,fx:Math.round(l*Math.cos(v))-14,fy:Math.round(l*Math.sin(v))+4})})}return o},gi=t=>{if(xs!==t){xs=t;for(let e of nt.querySelectorAll(".dt-pin[data-stack]"))e.classList.toggle("is-fanned",e.dataset.stack===t)}};document.addEventListener("pointermove",t=>{if(!xs){let i=t.target?.closest?.(".dt-pin--stacktop");i&&t.pointerType==="mouse"&&gi(i.dataset.stack);return}let e=nt.querySelector(`.dt-pin--stacktop[data-stack="${xs}"]`);if(!e){xs=null;return}let s=parseFloat(e.style.left),o=parseFloat(e.style.top),a=Number(e.querySelector(".dt-pin-count")?.textContent)||2;Math.hypot(t.clientX-s,t.clientY-(o-40))>kl(a)+36&&gi(null)},{passive:!0}),nt.addEventListener("click",t=>{let e=t.target.closest(".dt-pin--stacktop:not(.is-fanned)");e&&(t.stopImmediatePropagation(),t.preventDefault(),gi(e.dataset.stack))},!0);let Fp=(t,e)=>{let s=e||x||N?[]:p.filter(d=>d.id!==t).map(d=>({band:d,n:B.filter(c=>y(c)===d.id&&Po(c)&&wn(c)).length})).filter(d=>d.n).sort((d,c)=>c.n-d.n);if(ge.hidden=!s.length,!s.length)return;let[o,...a]=s,i=({band:d,n:c})=>`${c} ${c===1?"pin":"pins"} on ${d.label}`;ge.dataset.bp=o.band.id;let l=`${xt(o.band.icon,15)}<span>${f(i(o))}</span>${Ha}`;ge.dataset.html!==l&&(ge.innerHTML=l,ge.dataset.html=l),ge.dataset.tip=a.length?`Also ${a.map(i).join(", ")}`:`Switch to ${o.band.label}`,ge.setAttribute("aria-label",`${i(o)} \u2014 switch to ${o.band.label}`)};ge.addEventListener("click",()=>{ge.dataset.bp&&Gi(ge.dataset.bp)});let jp=t=>{let e=B.filter(a=>y(a)===t),s=e.filter(a=>Dt(a)==="open").length,o=e.filter(a=>Dt(a)==="claude").length;Ra.innerHTML=s?String(s):o?Pe(9):"\u2713",Ra.dataset.state=s?"open":o?"claude":"done",Ra.hidden=e.length===0},Zs=()=>{let t=document.activeElement?.closest(".dt-note")??null;if(document.querySelectorAll(".dt-note").forEach(a=>{a!==t&&(a.style.translate="")}),!t||(t.style.translate="",ss))return;let e=window.visualViewport,s=t.getBoundingClientRect(),o=s.bottom-((e?e.offsetTop+e.height:innerHeight)-8);o>0&&(t.style.translate=`0 ${-Math.min(o,s.top-8)}px`)},Sl=window.visualViewport?.height??innerHeight,Tl=()=>{let t=window.visualViewport?.height??innerHeight,e=t<Sl;if(Sl=t,!e||!nt.querySelector(".dt-note"))return Zs();Z();let s=document.activeElement?.closest(".dt-note.is-capped");s&&(s.scrollTop=s.scrollHeight)};window.visualViewport?.addEventListener("resize",Tl),addEventListener("resize",Tl),document.addEventListener("focusin",Zs),document.addEventListener("focusout",()=>setTimeout(Zs));let aa=()=>{let t=window.visualViewport;return Math.min(innerHeight,t?t.offsetTop+t.height:innerHeight,document.querySelector(".devtools:not([data-collapsed])")?.getBoundingClientRect().top??innerHeight)-8},fi=!1,Al=null,_p=()=>{if(X===Al||(Al=X,rt.hasAttribute("data-collapsed")&&!fi))return;let t=X!=null?B.find(o=>o.id===X):void 0,e=t&&Te(t),s=!1;if(e){rt.removeAttribute("data-collapsed");let o=rt.getBoundingClientRect();s=!!o.width&&e.x>o.left-12&&e.x<o.right&&(ss||e.y>o.top&&e.y<o.bottom)}fi=s,rt.toggleAttribute("data-collapsed",s)},Hl=t=>{let e=rt.hidden?null:rt.getBoundingClientRect();return e&&e.width&&t.bottom>e.top&&t.top<e.bottom?e.left:innerWidth},Cl=(t,e=aa())=>{if(t.style.marginTop="",ss)return;let s=parseFloat(getComputedStyle(t).marginTop)||0,o=t.getBoundingClientRect().bottom-e;o>0&&(t.style.marginTop=`${s-o}px`);let a=t.getBoundingClientRect().top;a<8&&(t.style.marginTop=`${(parseFloat(t.style.marginTop)||s)+8-a}px`)},bi=t=>{let e=aa();for(let s of nt.querySelectorAll(".dt-note")){let o=s.querySelector(".dt-note-thread");o&&o.scrollTop+o.clientHeight>=o.scrollHeight-4&&t.push(o);let a=s.scrollTop;delete s.dataset.flip,delete s.dataset.flipx,o?.style.removeProperty("max-height");for(let v of["max-height","overflow-y","margin-top","translate"])s.style.removeProperty(v);s.classList.remove("is-capped");let i=s.getBoundingClientRect(),l=i.top,d=e-l,c=l-28;if(i.bottom>e&&c>d&&(s.dataset.flip="1"),i.right>Hl(i)-8&&(s.dataset.flipx="1"),s.style.marginLeft="",s.dataset.flipx&&innerWidth>=480){let v=s.getBoundingClientRect(),A=Hl(v);v.right>A-8&&(s.style.marginLeft=`${(parseFloat(getComputedStyle(s).marginLeft)||0)-(v.right-A+8)}px`)}i=s.getBoundingClientRect();let m=s.dataset.flip?i.height-(e-8):i.bottom-e;m>0&&o&&(o.style.maxHeight=`${Math.max(40,o.clientHeight-m)}px`),s.getBoundingClientRect().height>e-8&&(Object.assign(s.style,{maxHeight:`${e-8}px`,overflowY:"auto"}),s.classList.add("is-capped"),Cr.has(s)?s.scrollTop=a:(Cr.add(s),s.scrollTop=s.scrollHeight)),Cl(s,e)}for(let s of t)s.scrollTop=s.scrollHeight},Nl=0,ss=!1,ia=t=>{t?.target?.closest?.(fs)||(clearTimeout(Nl),Nl=window.setTimeout(()=>{ss=!1,nt.querySelector(".dt-note")&&(bi([]),requestAnimationFrame(Zs),Je())},ss?300:150))},Z=()=>{for(let h of Object.keys(qe))h!==String(X)&&delete qe[h];for(let h of vs.keys())h!==X&&vs.delete(h);if(requestAnimationFrame(Zs),Zn(),x){let h=yl(),G=JSON.stringify(h);G!==vl&&(vl=G,parent.postMessage({dt:!0,drafts:h},location.origin))}if(Pr(),rt.toggleAttribute("data-yield",X!=null||!!N),X!==cn){cn!=null&&(Ae||Ee.length)?Ia.set(cn,{text:Ae,images:[...Ee]}):cn!=null&&Ia.delete(cn);let h=X!=null?Ia.get(X):void 0;Ae=h?.text??"",Ee=h?[...h.images]:[],cn=X}Qt&&Qt.id!==X&&(Qt=null);let t=Xt();if(jp(t),qa(),!Kt){nt.innerHTML="",Ga(null),Ge.hidden=!0,ge.hidden=!0;return}let e=t;if(X!=null&&!N){let h=B.find(G=>G.id===X);h&&y(h)!==e&&(X=null)}_p();let s="",o=B.filter(h=>y(h)===e&&(Po(h)&&wn(h)||h.id===X)),a=new Map(o.map(h=>[h.id,Te(h)])),i=Dp(o,a);jo="";for(let h of o){let G=a.get(h.id)??null,z=i.get(h.id),It=Fo(h),Rt=qr(h,It)?"later":It;Rt==="later"&&(zs=Math.min(zs??1/0,h.spot.y)),h.id===X&&(jo=Rt+(G?"":" \xB7 no pin"));let le=!G&&!!h.spot&&Dt(h)==="open"&&Rt==="gone";if(!G&&!le&&X!==h.id)continue;let bt=Dt(h),Ot=!G,Mt=G??(le?{x:h.spot.x-scrollX,y:h.spot.y-scrollY}:{x:0,y:0});Rt!=="later"&&Fu(h,bt==="open"?Rt:"found"),le&&(s+=`<button class="dt-pin dt-pin--ghost" data-id="${h.id}" aria-expanded="${X===h.id}" aria-label="Thread ${h.id}, its element is gone" title="${f(Zt(h.text,80))} \xB7 its element is gone \u2014 click to see what it was" style="left:${Mt.x}px;top:${Mt.y}px"></button>`);let kt=Is(h.category),Ct=ln(h),_t=bt==="done"?null:we(h),ke=_t?Go[_t]??"":"",pe=vo(h,bt),tr=!!pe&&!pe.taker,kn=!!pe&&!!pe.taker&&pe.taker!==pe.writer,rn=bt==="done"?vo(h,"open"):null,go=!!rn&&!rn.claude&&!!rn.taker&&rn.taker!==rn.writer,M=ke||Bn.find(K=>K[0]===ts(h))[2],V=pe?tr?` \xB7 ${Ja(pe.writer,h)} \xB7 anyone can take it`:` \xB7 ${kn?`${Ja(pe.writer,h)} \u2192 `:""}${Ja(pe.taker,h)}${pe.claude?` \xB7 ${En(h)}${Qa(h)}`:""}`:"";if(X===h.id&&(vs.has(h.id)||vs.set(h.id,Math.max(2,en(h).length-(Rn[h.id]??en(h).length))),Kr(h)),Ot||(s+=`<button class="dt-pin dt-pin--${bt}${bt==="done"&&!Me(h)?" dt-pin--resolved":""}${pe?` dt-pin--people${kn?" dt-pin--pair":""}`:go?" dt-pin--people dt-pin--pair":ke?" dt-pin--agent":""}${Ct?" dt-pin--working":""}${bt==="open"&&Be(h)==="review"?" dt-pin--review":""}${G?.hidden?" dt-pin--hidden":""}${Rt==="probably"?" dt-pin--probably":""}${G?.opener?" dt-pin--inside":""}${X!==h.id&&!tl(h,$n)?" dt-pin--dim":""}${z?` dt-pin--stack${z.i?"":" dt-pin--stacktop"}${xs===z.key?" is-fanned":""}`:""}" data-id="${h.id}"${z?` data-stack="${z.key}"`:""} aria-label="Thread ${h.id}, ${bt==="open"?"open":bt==="claude"?`resolved by ${f(Wn(h.doneAgent,h.doneFor))}`:"resolved"}${f(V.replace(/^ \u00b7 /,", ").replace(/ \u00b7 /g,", "))}${!pe&&ke?`, with ${f(En(h))}`:""}${G?.hidden?Co:""}" aria-expanded="${X===h.id}"
|
|
277
|
+
style="left:${Mt.x}px;top:${Mt.y}px;--cat:${kt.color};--ring:${M};--hue:${Ne(h.by||h.byName||"")}${ke?`;--step-c:${ke}`:""}${vi.has(h.id)?`;--dt-page:${vi.get(h.id)}`:""}${z?`;--fx:${z.fx}px;--fy:${z.fy}px`:""}"
|
|
278
|
+
title="${f(Zt(h.text,80))} \xB7 ${kt.label}${pe?f(V):Ct||_t==="queued"?` \xB7 ${f(En(h)+Qa(h))}`:""}${bt==="claude"?` \xB7 resolved by ${f(Wn(h.doneAgent,h.doneFor))} \u2014 tick to confirm`:bt==="done"?" \xB7 resolved":""}${G?.hidden?Co:""}${ro(h)?" \u2014 drag to move":""}"${ro(h)?" data-move":""}>${bt==="done"?rn?`${mn(rn.writer,h)}${go?mn(rn.taker,h):""}<i class="dt-pin-cut" aria-hidden="true">${$e}</i>`:"\u2713":pe?`${mn(pe.writer,h)}${kn?mn(pe.taker,h):""}${pe.claude?`<i class="dt-pin-claude" aria-hidden="true">${Pe(9)}</i>`:""}`:ke?Pe(11):Ya(h)}${X!==h.id&&Gr(h)?'<i class="dt-pin-new" aria-label="New messages"></i>':""}${z&&!z.i?`<i class="dt-pin-count" aria-hidden="true">${z.n}</i><i class="dt-pin-spot" aria-hidden="true"></i>`:""}${G?.opener?'<i class="dt-pin-inside" aria-hidden="true"></i>':""}</button><i class="dt-pin-eye" data-eye="${h.id}" aria-hidden="true" style="left:${Mt.x}px;top:${Mt.y}px"${G?.hidden?"":" hidden"}>${Yo}</i>`),X===h.id){let K=en(h),ut=we(h)==="review"&&!n.client?K.map(_=>_.author).lastIndexOf("claude"):-1,lt=we(h)==="asks"&&!n.client?K.length-1:-1;s+=`<div class="dt-note${Ot?" dt-note--orphan":""}" data-id="${h.id}" role="dialog" aria-label="Thread ${h.id}"
|
|
279
|
+
style="left:${Mt.x}px;top:${Mt.y}px">
|
|
256
280
|
<div class="dt-note-bar">
|
|
257
|
-
|
|
281
|
+
${h.id>0&&!(n.client||qt(h))?`<span class="dt-note-num">#${h.id}</span>`:""}${h.by||h.byName?`<i class="dt-note-pin" style="--pin-c:${M}" aria-hidden="true">${mn((h.by||h.byName||"").toLowerCase(),h)}</i>`:""}
|
|
282
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${Qr(h.selector,h.label)}"`}>${n.client||qt(h)?`Thread #${h.id>0?h.id:"\u2026"}`:f(ea(h.tag,h.classes,h.selector))}</span>
|
|
258
283
|
<span class="dt-note-tools">
|
|
259
|
-
${
|
|
284
|
+
${wl(h,!1,!1)}
|
|
260
285
|
<i class="dt-note-sep"></i>
|
|
261
|
-
${
|
|
262
|
-
<button data-act="close" data-id="${
|
|
286
|
+
${$s(h)?"":rl(h)}
|
|
287
|
+
<button data-act="close" data-id="${h.id}" data-tip="Close" aria-label="Close">${Sn}</button>
|
|
263
288
|
</span>
|
|
264
289
|
</div>
|
|
265
|
-
${
|
|
266
|
-
|
|
267
|
-
${
|
|
268
|
-
${
|
|
290
|
+
${_u(h,G,Rt,Ot)}
|
|
291
|
+
${(_=>`<div class="dt-note-hidden"${G?.hidden?"":" hidden"}><b>${Yo}<span>${_?`Hidden in \xAB${f(_)}\xBB`:"Hidden right now"}</span></b><button type="button" data-act="where" data-id="${h.id}">Show where</button><button type="button" class="dt-note-hidden-more" data-act="hidden-why" aria-expanded="false" aria-label="Why" data-tip="Why">${Ks}</button><p hidden>It sits inside ${_?`\xAB${f(_)}\xBB`:"something"}, which is closed. Open it on the page and the pin moves onto the spot.</p></div>`)(sp(G?.shut&&G.shut!==G.el?G.shut:G?.hidden))}
|
|
292
|
+
${Ot&&Rt!=="gone"&&Rt!=="later"?ju(h):""}
|
|
293
|
+
${(()=>{let _=Zu(h)+ti(Is(h.category).id,h.id,$s(h))+Lu(h)+(h.host&&h.host!==location.host?`<span class="dt-note-host" title="Written on ${f(h.host)}">${f(h.host)}</span>`:"");return _?`<div class="dt-note-meta">${_}</div>`:""})()}
|
|
269
294
|
<div class="dt-note-thread">
|
|
270
|
-
${
|
|
271
|
-
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${
|
|
272
|
-
<textarea class="dt-note-edit-input" rows="1" maxlength="${
|
|
273
|
-
${
|
|
295
|
+
${Qu(h,K.map((_,st)=>{let it=st===0?null:_.at??null,te=_.author==="you"&&(!_.by||_.by===n.me?.email),ze=te&&Qt?.id===h.id&&Qt.at===it,_n=n.team?.find(ds=>ds.email===_.by),Rs=_.author==="claude"?Wn(_.agent,_.by):te?"You":_n?.name||_.byName||_.by||"You",oc=_.author==="claude"?`<span class="dt-msg-face dt-msg-ai">${Pe(11)}</span>`:(ds=>Nn(_n?.avatar_url,_n?.name||_.byName||(te?n.me?.name:"")||_.by||Rs,"dt-msg-face").replace(/^<(img|b) /,`<$1 style="--hue:${Ne(ds)}" `).replace(/>([^<])[^<]*<\/b>$/,">$1</b>"))((_.by||(te?n.me?.email??"":"")||Rs).toLowerCase()),er=`${h.id}:${_.at??"0"}`,ac=hn.get(er)?.text,nr=!te&&n.voice&&_.text?Ep(h.id,_.at??"0",_.text):"",ic=nr?kp(h.id,_.at??"0",_.text):"",Ea=h.id<=0?null:st===0?"":h.replies?.some(ds=>ds.at===_.at)?_.at:null,sr=Ea===null?"":Tp(h.id,Ea,_.reactions),Dm=Ea!==null&&!sr?`<button class="dt-msg-edit" data-act="react-pick" data-id="${h.id}" data-at="${f(Ea)}" data-tip="Add reaction" aria-label="Add reaction">${hl}</button>`:"",rc=_.author==="claude"?[cr(_.agent),_.by?_.by===n.me?.email?"you":(_n?.name||_.by).split(" ")[0]:""].filter(Boolean).join(" \xB7 "):"",or=`<div class="dt-msg-head">${oc}<b>${f(Rs)}</b>${rc?`<span class="dt-msg-sub">${f(rc)}</span>`:""}<time>${zn(_.at)}</time>${Dm}${nr}${te&&!ze?`<button class="dt-msg-edit" data-act="edit" data-id="${h.id}" data-at="${f(it??"")}" title="Edit">${Vn}</button>${it?`<button class="dt-msg-edit" data-act="unsay" data-id="${h.id}" data-at="${f(it)}" title="Delete">${cs}</button>`:""}`:""}</div>`;return st===ut?`<div class="dt-msg dt-msg--done" data-msg="${h.id}:${f(_.at??"0")}"><div class="dt-msg-head">${oc}<b>${f(Rs)} fixed it</b><time>${zn(_.at)}</time>${nr}</div><p${hn.get(er)?.text===null?' class="is-asking"':""}>${wd(ac||_.text)}</p>${ic}${ai(_.images)}${sr}
|
|
296
|
+
<div class="dt-done-acts"><button type="button" class="dt-done-act is-main" data-act="accept" data-id="${h.id}">${$e}Looks right</button><button type="button" class="dt-done-act" data-act="sendback" data-id="${h.id}">${bn}Send back</button></div></div>`:ze?`<div class="dt-msg">${or}<div class="dt-compose">
|
|
297
|
+
<textarea class="dt-note-edit-input" rows="1" maxlength="${ui}" aria-label="Edit the message">${f(Qt.text)}</textarea>
|
|
298
|
+
${ai(_.images.filter(ds=>!Qt.drop.includes(ds.split("/").pop())),h.id)}
|
|
274
299
|
<div class="dt-compose-bar">
|
|
275
300
|
<button class="dt-edit-cancel" data-act="edit-cancel">Cancel</button>
|
|
276
|
-
<button class="dt-send${
|
|
301
|
+
<button class="dt-send${Qt.text.trim()?" is-ready":""}" data-act="edit-save" title="Save (Enter)">${$e}</button>
|
|
277
302
|
</div>
|
|
278
|
-
</div></div>`:`<div class="dt-msg${
|
|
303
|
+
</div></div>`:`<div class="dt-msg${te?" dt-msg--mine":""}${st===lt?" dt-msg--asks":""}" data-msg="${h.id}:${f(_.at??"0")}">${st===lt?or.replace(`<b>${f(Rs)}</b>`,`<b>${f(Rs)} asks</b>`):or}<p${hn.get(er)?.text===null?' class="is-asking"':""}>${wd(ac||_.text)}</p>${ic}${st===0&&h.suggest?Xu(h.suggest):""}${ai(_.images)}${sr}</div>`}),Qt?.id===h.id?1/0:(vs.get(h.id)??2)+(ut===K.length-1||lt>=0?1:0))}
|
|
279
304
|
</div>
|
|
280
|
-
${
|
|
281
|
-
${
|
|
282
|
-
${
|
|
283
|
-
${
|
|
284
|
-
</div>`}}
|
|
285
|
-
style="left:${z.x}px;top:${z.y}px" title="Draft, not sent \u2014 click to finish it">${
|
|
286
|
-
<div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${
|
|
305
|
+
${qe[h.id]?`<button type="button" class="dt-new-below" data-act="newbelow" data-id="${h.id}">${qe[h.id]} new ${qe[h.id]===1?"reply":"replies"} \u2193</button>`:""}
|
|
306
|
+
${Pp(h)}
|
|
307
|
+
${bl("dt-note-reply-input",we(h)==="asks"?`Answer ${f(En(h))}`:"Reply",Ae,`data-act="reply" data-id="${h.id}"`,pl(Ee))}
|
|
308
|
+
${el(h.priority,h.category,h.id,h.assignee??"",$s(h),qt(h),!0)}
|
|
309
|
+
</div>`}}De.forEach((h,G)=>{let z=Te(h);z&&(s+=`<button class="dt-pin dt-pin--draft" data-parked="${G}" data-act="draft-open" data-i="${G}"
|
|
310
|
+
style="left:${z.x}px;top:${z.y}px" title="Draft, not sent \u2014 click to finish it">${zr()}</button>`)});let l=N&&Te(N);if(N){let h=l?.x??0,G=l?.y??0;s+=`${l?`<span class="dt-pin dt-pin--draft" data-draft style="left:${h}px;top:${G}px">${zr()}</span>`:""}
|
|
311
|
+
<div class="dt-note${l?"":" dt-note--orphan"}" data-draft style="left:${h}px;top:${G}px">
|
|
287
312
|
<div class="dt-note-bar">
|
|
288
|
-
<span class="dt-note-el"${
|
|
289
|
-
${
|
|
313
|
+
<span class="dt-note-el"${n.client?"":` data-tip="${Qr(N.selector,N.label)}"`}>${n.client?"New thread":f(ea(N.tag,N.classes,N.selector))}</span>
|
|
314
|
+
${Ds()?'<span class="dt-note-draft">Draft</span>':""}
|
|
290
315
|
<span class="dt-note-tools">
|
|
291
316
|
|
|
292
|
-
${
|
|
293
|
-
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${
|
|
317
|
+
${rl()}
|
|
318
|
+
<button data-act="cancel" data-tip="Close \u2014 the draft stays" aria-label="Close">${Sn}</button>
|
|
294
319
|
</span>
|
|
295
320
|
</div>
|
|
296
321
|
${l?"":'<p class="dt-note-orphan">The element this was pinned to is not on the page right now.</p>'}
|
|
297
|
-
${(()=>{let z=l?
|
|
298
|
-
${
|
|
299
|
-
${
|
|
300
|
-
<span class="dt-suggest-was">Now: <del>${f(Zt(
|
|
301
|
-
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${f(
|
|
302
|
-
<span class="dt-suggest-hint">Change the words in the box \u2014
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
${
|
|
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
|
-
|
|
310
|
-
|
|
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());
|
|
322
|
+
${(()=>{let z=l?Ce(N):null,It=z&&B.find(Rt=>Rt.id>0&&Dt(Rt)==="open"&&Ce(Rt)===z);return It?`<p class="dt-note-twin">Already open here: \u201C${f(Zt(It.text,60))}${It.text.length>60?"\u2026":""}\u201D <button data-act="twin" data-id="${It.id}">Open it</button></p>`:""})()}
|
|
323
|
+
${n.client?`<div class="dt-note-meta">${op(N.assignee)}</div>`:""}
|
|
324
|
+
${N.suggest?`<div class="dt-suggest"><span class="dt-suggest-head">New wording for this text<button data-act="unsuggest" title="Keep the text as it is">${Sn}</button></span>
|
|
325
|
+
<span class="dt-suggest-was">Now: <del>${f(Zt(N.suggest.from,160))}${N.suggest.from.length>160?"\u2026":""}</del></span>
|
|
326
|
+
<textarea class="dt-suggest-input" rows="2" placeholder="Type how it should read" aria-label="How it should read">${f(N.suggest.to)}</textarea>
|
|
327
|
+
<span class="dt-suggest-hint">Change the words in the box \u2014 the agent puts in exactly what you write.</span></div>`:""}
|
|
328
|
+
<div class="dt-note-meta dt-note-type">${ti(Is(N.category).id,void 0,!1)}</div>
|
|
329
|
+
${bl("dt-note-input",N.suggest?"Why (optional)":"Comment",N.text??"",'data-act="save"',pl(N.images))}
|
|
330
|
+
${N.carried&&N.assignee?`<p class="dt-carried">${Du}<span>For ${f(sn(N.assignee)?.name||N.assignee.split("@")[0])} \xB7 from your last comment</span><button type="button" data-act="uncarry" aria-label="Don\u2019t carry it over" data-tip="Back to Anyone \u2014 and the next ones too">${Sn}</button></p>`:""}
|
|
331
|
+
${el(N.priority,N.category,void 0,N.assignee??"",!1,!!N.shared,!0)}
|
|
332
|
+
</div>`}let d=new Map([...nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")].map(h=>[h.closest(".dt-note").dataset.id,{top:h.scrollTop,end:h.scrollTop+h.clientHeight>=h.scrollHeight-4}])),c=new Set([...nt.querySelectorAll("[data-msg]")].map(h=>h.dataset.msg)),m=nt.contains(document.activeElement)&&document.activeElement.matches(".dt-note-reply-input");Fp(e,yn.hidden?o.some(h=>!!a.get(h.id)):o.length>0),kr(nt,s),m&&!nt.contains(document.activeElement)&&io(".dt-note-reply-input");let v=[],A=[];for(let h of nt.querySelectorAll(".dt-note[data-id] .dt-note-thread")){let G=h.closest(".dt-note").dataset.id,z=d.get(G);if(!z){v.push(h),delete qe[G],h.parentElement.querySelector(".dt-new-below")?.remove();continue}let It=[...h.querySelectorAll("[data-msg]")].filter(bt=>!c.has(bt.dataset.msg));for(let bt of It)bt.classList.add("dt-msg--new");let Rt=z.end||String(Ho)===G;Rt&&A.push(h),h.scrollTop=Rt?h.scrollHeight:z.top;let le=It.filter(bt=>!bt.classList.contains("dt-msg--mine")).length;if(le&&!z.end&&String(Ho)!==G){qe[G]=(qe[G]??0)+le;let bt=qe[G],Ot=h.parentElement.querySelector(".dt-new-below")??h.insertAdjacentElement("afterend",Object.assign(document.createElement("button"),{type:"button",className:"dt-new-below"}));Object.assign(Ot.dataset,{act:"newbelow",id:G}),Ot.textContent=`${bt} new ${bt===1?"reply":"replies"} \u2193`}}for(let h of nt.querySelectorAll(".dt-new-below")){let G=h.closest(".dt-note")?.querySelector(".dt-note-thread");(!G||G.scrollTop+G.clientHeight>=G.scrollHeight-4)&&(delete qe[h.dataset.id],h.remove())}Ho=null,bi([...v,...A]),requestAnimationFrame(()=>nt.querySelectorAll(".dt-note-thread").forEach(No)),X==null?Ao=null:X!==Ao&&nt.querySelector(`.dt-note[data-id="${X}"]`)&&(Ao=X,!document.querySelector(".dt-review:not([hidden])")&&matchMedia("(pointer: fine)").matches&&io(`.dt-note[data-id="${X}"] .dt-note-reply-input`)),ue(e),Ga(Ka()),Je();for(let h of nt.querySelectorAll(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input"))Fi(h);let j=nt.querySelector(".dt-note-input");j&&document.activeElement!==j&&(j.focus(),j.setSelectionRange(j.value.length,j.value.length))},yi=0,Wp=()=>{Mi&&Kt&&!x&&zl();let t=!1,e=document.getAnimations().some(l=>l.playState==="running"),s=[],o=!1;for(let l of nt.querySelectorAll(".dt-pin[data-id], .dt-note[data-id]")){if(l.classList.contains("dt-note--orphan")||l.classList.contains("is-dragging"))continue;if(l.classList.contains("dt-pin--ghost")){let m=B.find(v=>v.id===Number(l.dataset.id))?.spot;s.push([l,m?{x:m.x-scrollX,y:m.y-scrollY,el:document.body}:null]);continue}let d=B.find(m=>m.id===Number(l.dataset.id)),c=d&&Te(d);s.push([l,c&&l.matches(".dt-pin")&&Mu(c.el,c.x,c.y)?null:c]),c&&e&&Fr(c.el)&&(t=!0)}for(let l of nt.querySelectorAll("[data-draft], [data-parked]")){if(l.classList.contains("dt-note--orphan"))continue;let d=l.dataset.parked?De[Number(l.dataset.parked)]:N;s.push([l,d?Te(d):null])}let a=(l,d,c)=>{Math.abs(parseFloat(l.style.left)-d)<.05||(l.style.left=`${d}px`,o=!0),Math.abs(parseFloat(l.style.top)-c)<.05||(l.style.top=`${c}px`,o=!0)};for(let[l,d]of s){let c=l.nextElementSibling;if(!d){l.style.visibility!=="hidden"&&(l.style.visibility="hidden"),c?.matches(".dt-pin-eye")&&!c.hidden&&(c.hidden=!0);continue}if(l.style.visibility&&(l.style.visibility=""),a(l,d.x,d.y),l.matches(".dt-pin[data-id]")){if(l.classList.contains("dt-pin--hidden")!==!!d.hidden){l.classList.toggle("dt-pin--hidden",!!d.hidden);for(let m of["title","aria-label"]){let v=(l.getAttribute(m)??"").replace(Co,"");l.setAttribute(m,d.hidden?v.replace(/( \u2014 drag to move)?$/,`${Co}$1`):v)}}c?.matches(".dt-pin-eye")&&(c.hidden!==!d.hidden&&(c.hidden=!d.hidden),d.hidden&&a(c,d.x,d.y))}l.querySelector(".dt-note-hidden")?.toggleAttribute("hidden",!d.hidden)}if(!Wo.length&&(N||X!=null)){let l=Ka();l&&e&&Fr(l)&&Ga(l)}let i=nt.querySelectorAll(".dt-note:not(.dt-note--orphan)");if(i.length){let l=aa();for(let d of i)d.style.visibility!=="hidden"&&Cl(d,l)}Eu(N||X!=null?Ka():null),yi=o?0:yi+1,t&&Je(),clearTimeout(Rl),Rl=window.setTimeout(zp,150)},vi=new Map,Rl=0,zp=()=>{let t=new Map,e=o=>{let a=[],i="";for(let l=o;l;l=l.parentElement){let d=t.get(l);if(d!==void 0){i=d;break}if(a.push(l),/^(IMG|VIDEO|CANVAS|PICTURE|IFRAME)$/.test(l.tagName)){i="var(--dt-bg)";break}let c=getComputedStyle(l);if(c.backgroundImage!=="none"){i="var(--dt-bg)";break}let m=c.backgroundColor.match(/[\d.]+/g);if(m&&(m[3]===void 0?1:+m[3])>=.9){i=c.backgroundColor;break}}i||="#fff";for(let l of a)t.set(l,i);return i},s=[];for(let o of nt.querySelectorAll(".dt-pin[data-id]")){if(o.style.visibility==="hidden"||o.classList.contains("is-dragging"))continue;let a=o.getBoundingClientRect(),i=document.elementsFromPoint(a.x+a.width/2,a.y+a.height/2).find(l=>!Tn(l));i&&s.push([o,e(i)])}for(let[o,a]of s)vi.set(Number(o.dataset.id),a),o.style.setProperty("--dt-page",a)},Bl=t=>`dt-gfold:${n.project||location.host}:${t}`,ue=t=>{if(rt.hidden){rt.replaceChildren();return}if(rt.toggleAttribute("data-picking",!!He),kr(rt,du({bp:t,notes:B.filter(wn),breakpoints:p,bandOfNote:y,orphan:e=>!Te(e),statusTools:e=>wl(e,!1),tick:Vu,replied:Gu,rowMenu:Ku,menuFor:Cn,showResolved:Ue,showArchived:un,archived:Me,drafts:yn.hidden?yl():pi,checks:x?0:la.toCheck().length,clients:Ke()&&Fe==="clients",marker:Gp,assign:zu,mirror:e=>Ke()?Da(e)?"here":qt(e)&&Io(e)?"there":"":"",picking:He,pickable:bs,mirrorAll:qo()?B.filter(e=>wn(e)&&y(e)===t&&bs(e)).map(e=>e.id):[],draftFace:n.me?`<span class="dt-hist-face" style="--hue:${Ne(n.me.email)}">${Ya({by:n.me.email,byName:n.me.name})}</span>`:"",draftName:n.me?.name||"You",find:oe,forMe:Vp,forAgent:e=>!!we(e)&&Dt(e)!=="done",unread:Gr,archives:!n.client,deletable:e=>!$s(e),folded:rt.hasAttribute("data-collapsed"),shut:e=>mt.getItem(Bl(e))==="1",cap:Pl,keep:X})),Es){let e=rt.querySelector("[data-hist-q]");e?.focus(),e?.setSelectionRange(Es.at,Es.at),Es=null}},Es=null,Pl=150,Vp=t=>{if(Dt(t)==="done"||!n.me)return!1;if(t.assignee===n.me.email||Dt(t)==="claude"||Be(t)==="review"&&t.assignee!==n.me.email)return!0;let e=(n.me.name||n.me.email).split(/[\s@]/)[0].toLowerCase();return en(t).some(s=>s.text.toLowerCase().includes("@"+e))},Gp=t=>{let e=we(t),s=Go[e??""],o=Dt(t)==="done"?Me(t)?`<i class="dt-hist-badge is-archived">${Ln}</i>`:`<i class="dt-hist-badge is-done">${$e}</i>`:s?`<i class="dt-hist-badge" style="--b:${s}">${Pe(8)}</i>`:`<i class="dt-hist-badge is-dot" style="--b:${Bn.find(i=>i[0]===ts(t))[2]}"></i>`,a=Ya(t)||Nn(void 0,t.byName||(t.by==="you"||!t.by?"You":t.by)).replace(/>([^<])[^<]*<\/b>$/,">$1</b>");return`<span class="dt-hist-face" style="--hue:${Ne(t.by||t.byName||"you")}">${a}</span>`},ra=t=>{fi=!1;let e=rt.hasAttribute("data-collapsed");if(t===e||rt.hidden){rt.toggleAttribute("data-collapsed",t),Z();return}let s=rt.querySelector(".dt-hist-head")?.offsetHeight??44;if(t){rt.setAttribute("data-folding",""),xr(rt,rt.offsetHeight,s,!1,()=>{rt.removeAttribute("data-folding"),rt.setAttribute("data-collapsed",""),Z()});return}rt.removeAttribute("data-folding"),rt.removeAttribute("data-collapsed"),Z(),xr(rt,s,rt.offsetHeight,!0,()=>{})},Il=t=>{let e=[];for(let s=t.nextElementSibling;s&&s.classList.contains("dt-hist-row");s=s.nextElementSibling)e.push(s);return e},Ol=t=>{let e=document.createElement("div");return e.className="dt-hist-rows",t[0].before(e),e.append(...t),e},Kp=t=>{let e=Bl(t),s=mt.getItem(e)==="1",o=rt.querySelector(".dt-hist-list"),a=o?.clientHeight??600,i=()=>rt.querySelector(`[data-gfold="${CSS.escape(t)}"]`)?.closest(".dt-hist-group");if(!s){let m=i(),v=m?Il(m):[],A=()=>{D(e,"1"),ue(Xt())};if(!v.length||!Gn())return A();let j=Ol(v);Ca(j,!1,a),An(j).then(A);return}D(e,""),ue(Xt());let l=i(),d=l?Il(l):[];if(!d.length||!Gn())return;let c=Ol(d);c.hidden=!0,Ca(c,!0,a),An(c).then(()=>{c.isConnected&&(c.before(...c.children),c.remove())})};rt.addEventListener("input",t=>{let e=t.target.closest("[data-hist-q]");e&&(oe.q=e.value,Es={at:e.selectionStart??e.value.length},ue(Xt()))}),rt.addEventListener("click",async t=>{let e=t.target;if(e.closest("[data-hist-more]")){oe.more=!oe.more,Cn=null,oe.menu=!1,ue(Xt());return}let s=e.closest("[data-row-more]");if(s){let kt=Number(s.dataset.rowMore);Cn=Cn===kt?null:kt,oe.more=!1,ue(Xt());return}if((oe.more||Cn!=null)&&!e.closest(".dt-hist-menu")&&(oe.more=!1,Cn=null,ue(Xt()),!e.closest("[data-go]"))||e.closest(".dt-hist-assign"))return;let o=()=>{oe.more=!1,Cn=null};if(e.closest("[data-hist-rows]")){Pl+=300,ue(Xt());return}if(e.closest("[data-read-all]")){for(let kt of B)Kr(kt);o(),ue(Xt());return}let a=e.closest("[data-resolve-all]");if(a){let kt=a.dataset.resolveAll.split(",").map(Number);o(),await xl(kt,Ct=>Xe(Ct,!0)),Re(`Resolved ${kt.length}`,()=>xl(kt,Ct=>Xe(Ct,!1)));return}let i=e.closest("[data-row-unread]");if(i){let kt=Number(i.dataset.rowUnread);Rn[kt]=Math.max(0,en(B.find(Ct=>Ct.id===kt)).length-1),Za(),o(),ue(Xt());return}let l=e.closest("[data-row-link]");if(l){o(),ue(Xt()),await navigator.clipboard?.writeText(`${location.origin}${location.pathname}#thread-${l.dataset.rowLink}`).catch(()=>null),Ut("Link copied");return}let d=e.closest("[data-row-select]");if(d){o();let kt=Number(d.dataset.rowSelect),Ct=B.find(_t=>_t.id===kt);He=new Set(Ct&&bs(Ct)?[kt]:[]),Oo=kt,ue(Xt());return}let c=e.closest("[data-row-mirror]");if(c){o(),ue(Xt()),await ga([Number(c.dataset.rowMirror)]);return}let m=e.closest("[data-mirror-all]");if(m){o(),ue(Xt()),await ga(m.dataset.mirrorAll.split(",").map(Number));return}if(e.closest("[data-pick-mirror]")){await xd();return}if(e.closest("[data-pick-cancel]")){_i();return}let v=e.closest(".dt-hist-go[data-go]");if(v&&qo()&&(He||t.metaKey||t.ctrlKey||t.shiftKey)){t.preventDefault(),$m(Number(v.dataset.go),t.shiftKey);return}let A=e.closest("[data-row-move]");if(A){o(),await ji(Number(A.dataset.rowMove));return}if(e.closest(".dt-hist-menu.is-row [data-act], .dt-hist-menu.is-row [data-rm]")&&o(),rt.hasAttribute("data-collapsed")&&t.target.closest(".dt-hist-head")){ra(!1);return}if(t.target.closest("[data-fold]")){ra(!rt.hasAttribute("data-collapsed"));return}let j=t.target.closest("[data-gfold]");if(j){Kp(j.dataset.gfold);return}let h=t.target.closest(".dt-hist-bands [data-bp]");if(h){Gi(h.dataset.bp);return}let G=t.target.closest("[data-hist-filter], [data-hist-view], [data-hist-sort], [data-hist-clear]");if(G){G.dataset.histView?(oe.view=G.dataset.histView,D("dt-view",oe.view),oe.menu=!1):G.dataset.histSort?(oe.sort=G.dataset.histSort,D("dt-sort",oe.sort),oe.menu=!1,oe.more=!1):G.hasAttribute("data-hist-clear")?(oe.q="",Es={at:0}):oe.menu=!oe.menu,ue(Xt());return}oe.menu&&!t.target.closest(".dt-hist-menu")&&(oe.menu=!1,ue(Xt()));let z=t.target.closest("[data-draft-go], [data-draft-rm]");if(z){let kt=z.dataset.draftRm!==void 0,Ct=Number(kt?z.dataset.draftRm:z.dataset.draftGo);yn.hidden?kt?ql(Ct):wi(Ct):We(kt?{dropDraft:Ct}:{openDraft:Ct});return}let It=t.target.closest(".dt-hist-tools [data-act='done'], .dt-hist-tools [data-act='reopen']");if(e.closest(".dt-hist-menu.is-panel [data-resolved], .dt-hist-menu.is-panel [data-archived], .dt-hist-menu.is-panel [data-archive-all]")&&(oe.more=!1),It){await Xe(Number(It.dataset.id),It.dataset.act==="done");return}let Rt=t.target.closest("[data-rm]");if(Rt){X=null,hi(Number(Rt.dataset.rm));return}if(t.target.closest("[data-review]")){la.start();return}if(t.target.closest("[data-resolved]")){xi(!Ue);return}if(t.target.closest("[data-archived]")){Ei(!un);return}let le=t.target.closest("[data-archive-all]");if(le){let kt=le.dataset.archiveAll.split(",").map(Number);for(let Ct of kt)await ns(Ct,!0,!0);Re(`Archived ${kt.length}`,()=>{for(let Ct of kt)ns(Ct,!1,!0)});return}let bt=t.target.closest(".dt-hist-tools [data-act='archive'], .dt-hist-tools [data-act='unarchive']");if(bt){await ns(Number(bt.dataset.id),bt.dataset.act==="archive");return}let Ot=t.target.closest("[data-go]");if(!Ot)return;let Mt=Number(Ot.dataset.go);if(!yn.hidden){We({open:Mt});return}Ms(Mt)});let Ms=t=>{X=t,Ao=null,nn(),ss=!0,Z();let e=B.find(a=>a.id===t),s=e&&Te(e);if(s)scrollTo({top:scrollY+s.y-innerHeight/2,behavior:"smooth"});else if(e){let a=Ce(e);a?a.scrollIntoView({block:"center",behavior:"smooth"}):Dr(e)}let o=nt.querySelector(`.dt-pin[data-id="${t}"]`);o&&Mo(o,"land"),ia()},wi=t=>{let[e]=De.splice(t,1);if(!e)return;nn(),N=e,X=null;let s=Te(e);s&&(s.y<0||s.y>innerHeight)&&scrollTo({top:scrollY+s.y-innerHeight/3,behavior:"instant"}),Z()},ql=t=>{De.splice(t,1),Z()},la=cu({inFrame:x,everything:()=>yt,route:()=>St,settle:Xe,keepIn:Ba,toast:t=>Ut(t),waits:t=>Dt(t)==="claude"||Dt(t)==="open"&&ts(t)==="review",approve:t=>Xe(t.id,!0),open:t=>{if(Kt||Qe(!0),y(t)!==Xt()){Gi(y(t));for(let e of[600,1500])setTimeout(()=>We({open:t.id}),e)}else Ms(t.id)}}),Dl=t=>{if(rt.hidden){t?.();return}Kn(rt,()=>{rt.hidden=!0,t?.()})},Fl=()=>{Eo(rt),rt.hidden=!1},Up=t=>{t?Fl():Dl(),ve.setAttribute("aria-pressed",String(t)),D("dt-history",t?"1":"0"),Z()},$i=document.querySelector(".dt-resolved-btn"),On=document.querySelector(".dt-space"),Yp=()=>{if(!On)return;On.hidden=!Ke(),On.dataset.on=Fe;let t=document.documentElement,e=t.dataset.dtSpace==="clients";Ke()&&Fe==="clients"?(t.dataset.dtSpace="clients",e||(t.classList.add("dt-client-glow"),window.setTimeout(()=>t.classList.remove("dt-client-glow"),1700))):delete t.dataset.dtSpace;let s=document.querySelector(".dt-client-tab");s&&(s.inert=t.dataset.dtSpace!=="clients",s.ariaHidden=s.inert?"true":null);for(let o of On.querySelectorAll("[data-space]")){let a=o.dataset.space;o.setAttribute("aria-checked",String(a===Fe));let i=yt.filter(l=>!Me(l)&&Dt(l)!=="done"&&qt(l)===(a==="clients")).length;o.querySelector(".dt-space-n").textContent=i?String(i):""}On.querySelector(".dt-space-name").textContent=Fe==="clients"?"Client":"Team",On.querySelector(".dt-space-ic").innerHTML=xt(wr[Fe],14)},jl=0,ks=t=>{if(!Ke()||t===Fe)return;let e=()=>{Fe=t,He=null,D("dt-space",t),X!=null&&!wn(B.find(a=>a.id===X))&&(X=null),nn(),os(yt),Z(),ue(Xt())},s=document.documentElement,o=++jl;s.classList.add("dt-switching"),Promise.all([An(nt),An(rt)]).then(()=>{o===jl&&(e(),requestAnimationFrame(()=>s.classList.remove("dt-switching")))})};document.querySelector(".dt-client-x")?.addEventListener("click",()=>ks("studio")),On?.addEventListener("click",t=>{let e=t.target.closest("[data-space]");e&&(On.open=!1,ks(e.dataset.space))});let Ls=document.querySelector(".dt-pinf"),Ss=Ls.querySelector(".dt-pinf-btn"),on=Ls.querySelector(".dt-pinf-menu"),_l={all:"All",nobody:"Anyone",mine:"Mine",others:"Everyone else",resolved:"Resolved",claude:"My agent",wrote:"Written by me",check:"To check"},Xp=()=>B.filter(t=>y(t)===Xt()&&Po(t)&&wn(t)),Qs=(t,e=!1)=>{on.hidden=!t,Ss.setAttribute("aria-expanded",String(t)),t&&(qa(),e&&on.querySelector('[aria-checked="true"]')?.focus())};qa=()=>{let t=Xp();if(Ls.hidden=!Ke()||!t.length,Ls.hidden){on.hidden=!0;return}let e=Object.fromEntries(Br.map(m=>[m,t.filter(v=>tl(v,m)).length])),s=(n.me?.email??"").toLowerCase(),o=[["nobody","var(--dt-new)"],["mine",Ne(s)],["others","var(--dt-faint)"]];if(Ss.toggleAttribute("data-on",$n!=="all"),Ss.setAttribute("aria-label",`Pins on this page: ${e.all} \u2014 ${e.nobody} anyone can take, ${e.mine} mine, ${e.others} everyone else's, ${e.resolved} resolved${$n==="all"?"":`; showing ${_l[$n]}, ${e[$n]}`}`),on.hidden)return;let a=[...new Set(t.map(m=>vo(m,Dt(m))?.taker).filter(m=>!!m&&m!==s))].slice(0,2),i=m=>Nn(sn(m)?.avatar_url,sn(m)?.name||m,"dt-pinf-face").replace(/^<(img|b) /,`<$1 style="--hue:${Ne(m)}" `),l={all:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 3 3 6.5 10 10l7-3.5zM3 10l7 3.5 7-3.5M3 13.5 10 17l7-3.5"/></svg>',nobody:'<svg viewBox="0 0 16 16" width="16" height="16"><circle cx="8" cy="8" r="7" stroke="var(--dt-new)" stroke-width="1.5" stroke-dasharray="2.5 2"/></svg>',mine:i(s),others:a.map(i).join("")||'<svg viewBox="0 0 20 20" width="14" height="14"><circle cx="8" cy="7" r="3"/><path d="M3 16.5c.5-2.8 2.5-4.5 5-4.5s4.5 1.7 5 4.5M13.5 4.2a3 3 0 0 1 0 5.6M15.5 12.4c1 .9 1.6 2.3 1.8 4.1"/></svg>',claude:`<i class="dt-pinf-claude">${Pe(10)}</i>`,wrote:'<svg viewBox="0 0 20 20" width="14" height="14"><path d="M10 16.5h6.5M13.4 3.9a1.8 1.8 0 0 1 2.6 2.6L7.4 15.1 4 16l.9-3.4z"/></svg>',check:Ve(Bn[2][2],Bn[2][3]),resolved:Ve(Pn[Pn.length-1][2],Pn[Pn.length-1][3])},d=(m,v)=>`<b class="dt-pinf-share"><i style="--c:${v};width:${Math.round(100*e[m]/e.all)}%"></i></b>`,c=(m,v="")=>`<button type="button" class="dt-pinf-row" role="menuitemradio" aria-checked="${$n===m}" data-pinf="${m}"><i class="dt-pinf-glyph">${l[m]}</i><span>${_l[m]}</span>${v?d(m,v):""}<em>${e[m]}</em>${$e}</button>`;on.innerHTML=`<div class="dt-pinf-head"><b>SHOW</b>${e.all} on this page</div>${c("all")}${o.map(([m,v])=>c(m,v)).join("")}${e.resolved||$n==="resolved"?c("resolved"):""}<hr>${c("claude")}${c("wrote")}${c("check")}${n.shortcuts?'<div class="dt-pinf-foot"><kbd>F</kbd>opens it \xB7 the rest dim, not hidden</div>':""}`},Ss.addEventListener("click",t=>Qs(on.hidden,t.detail===0)),on.addEventListener("click",t=>{let e=t.target.closest("[data-pinf]");e&&($n=e.dataset.pinf,D("dt-pinf",$n),Qs(!1),Ss.focus(),Kt?Z():Qe(!0))}),on.addEventListener("keydown",t=>{if(t.key==="Escape"){t.stopPropagation(),Qs(!1),Ss.focus();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault();let e=[...on.querySelectorAll("[data-pinf]")];e[(e.indexOf(document.activeElement)+(t.key==="ArrowDown"?1:e.length-1))%e.length]?.focus()}),document.addEventListener("pointerdown",t=>{!on.hidden&&!Ls.contains(t.target)&&Qs(!1)},!0);let xi=t=>{Ue=t,$i.setAttribute("aria-pressed",String(t)),D("dt-resolved",t?"1":"0"),We({resolved:t}),Z(),as(!0)},Ei=t=>{un=t,D("dt-archived",t?"1":"0"),We({archived:t}),Z(),as(!0)};$i.addEventListener("click",()=>xi(!Ue)),$i.setAttribute("aria-pressed",String(Ue)),ve.addEventListener("click",()=>{let t=rt.hidden||rt.hasAttribute("data-leaving");t&&!Kt&&Qe(!0),t&&ra(!1),Up(t)});let Je=()=>{Pa||!Kt||(Pa=requestAnimationFrame(()=>{Pa=0,Wp()}))},Wl=`${fs}, .dt-where, .dt-spot, .dt-drag-box, .dt-room, .dt-notes-hi, .dt-pad-overlay, .dt-grid-overlay, .dt-review, .dt-field-menu, .dt-toast`,Jp=t=>{if((t.target instanceof Element?t.target:t.target.parentElement)?.closest(Wl))return!0;let s=[...t.addedNodes,...t.removedNodes];return s.length>0&&s.every(o=>o instanceof Element&&o.matches(Wl))},Mi=!1,zl=()=>{Mi=!1;let t=document.scrollingElement??document.documentElement,e=document.querySelector(".dt-room");if(t.scrollHeight-(e?.offsetHeight??0)<=t.clientHeight+1){e?.remove();return}let s=e??Object.assign(document.createElement("div"),{className:"dt-room",ariaHidden:"true"});document.body.lastElementChild!==s&&document.body.append(s)},ki=0,Li=!1,Si=!1,Vl=0,Zp=()=>{if(!Kt)return!1;let t=new Set([...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].map(s=>Number(s.dataset.id))),e=Xt();return B.some(s=>!t.has(s.id)&&y(s)===e&&Po(s)&&wn(s)&&!!Te(s))},Qp=()=>Kt&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=B.find(s=>s.id===Number(t.dataset.id));return!!e&&e.id!==X&&!Ce(e)}),tm=()=>Kt&&[...nt.querySelectorAll(".dt-pin[data-id]:not(.dt-pin--ghost)")].some(t=>{let e=B.find(s=>s.id===Number(t.dataset.id));return!!e&&Fo(e)==="probably"!==t.classList.contains("dt-pin--probably")}),Gl=new MutationObserver(t=>{if(Kt&&!x&&document.body.lastElementChild?.className!=="dt-room"){let e=document.querySelector(".dt-room");e&&document.body.append(e),Mi=!0}t.every(Jp)||((yi<3||t.some(e=>e.type!=="attributes"))&&Je(),t.some(e=>e.type!=="attributes")?Li=!0:t.some(e=>e.attributeName==="class")&&(Si=!0),ki||(ki=window.setTimeout(()=>{if(ki=0,Li)_s();else if(Si&&performance.now()-Vl>1e3){Vl=performance.now();for(let[s,o]of ys)o.el||ys.delete(s)}Li=Si=!1;let e=X!=null?B.find(s=>s.id===X):void 0;Zp()||Qp()||tm()||e&&jo&&Ru(e)!==jo?Z():Je()},150)))}),Kl=new ResizeObserver(()=>Je()),Ul=()=>{nt.querySelector(".dt-pin[data-id], .dt-note[data-id]")&&Je()},yt=[],Yl=()=>{},to=new Set,je={at:"",ids:[]},os=t=>{yt=t,queueMicrotask(()=>Yl());let e=()=>({new:0,progress:0,review:0,waiting:0,done:0}),s={};for(let d of t){if(Me(d)||!wn(d))continue;let c=Dt(d),m=we(d),v=c==="done"?"done":c==="claude"?"review":m&&Ko[m]||ts(d),A=s[d.route??""]??={...e(),bands:{}};A[v]++;let j=y(d);(A.bands[j]??=e())[v]++}Yp();let o=["new","progress","review","waiting","done"],a={new:"new",progress:"in progress",review:"to review",waiting:"waiting",done:"resolved"},i=d=>o.map(c=>[c,c==="done"&&!Ue?0:d[c]]),l=d=>i(d).reduce((c,[,m])=>c+m,0);for(let d of document.querySelectorAll(".dt-pages a")){let c=d.querySelector(".dt-pages-n");if(!c)continue;let m=s[new URL(d.href).pathname.replace(/\/+$/,"")||"/"];for(let j of p){let h=m?.bands[j.id];for(let[G,z]of i(h??e())){let It=c.querySelector(`[data-bp="${j.id}"][data-state="${G}"]`);It.hidden=!z,z&&(It.querySelector("i").textContent=String(z),It.title=`${j.label}: ${z} ${a[G]}`)}}let v=m?l(m):0;c.hidden=!v;let A=m?p.filter(j=>m.bands[j.id]&&l(m.bands[j.id])).map(j=>`${j.label} ${l(m.bands[j.id])}`).join(" \xB7 "):"";c.title=v?`${o.filter(j=>m[j]).map(j=>`${m[j]} ${a[j]}`).join(" \xB7 ")}
|
|
333
|
+
${A}`:"",d.dataset.n=String(v)}for(let d of document.querySelectorAll(".dt-folder")){let c=d.querySelectorAll(":scope > ul li[data-route] > a").length,m=[...d.querySelectorAll("a[data-n]")].reduce((A,j)=>A+Number(j.dataset.n),0),v=d.querySelector(".dt-folder-n");v.textContent=c?String(c):"",v.title=`${c} ${c===1?"page":"pages"}${m?` \xB7 ${m} open ${m===1?"thread":"threads"}`:""}`}Ht()},qn=t=>(Array.isArray(t)?t:[]).filter(e=>e&&Number.isInteger(Number(e.id))&&typeof e.text=="string"&&!sa.has(Number(e.id))).map(e=>({...e,id:Number(e.id),rx:Number(e.rx)||0,ry:Number(e.ry)||0,route:typeof e.route=="string"&&/^\/(?![\/\\])/.test(e.route)?e.route:"/",replies:Array.isArray(e.replies)?e.replies.filter(s=>typeof s?.text=="string").map(s=>oa.has(`${Number(e.id)}|${s.at}`)?{...s,text:"",deleted:!0}:s):[],images:Array.isArray(e.images)?e.images.filter(s=>typeof s=="string"):[],...Ps(e)&&typeof e.from.by=="string"?{by:e.from.by,byName:typeof e.from.byName=="string"?e.from.byName:void 0,mirroredBy:e.by,mirroredByName:e.byName}:{}})),em=uu(x,t=>Ut(t,2800,document.querySelector(".dt-turbo")??void 0)),_e=document.querySelector(".dt-push"),gn=_e.querySelector(".dt-push-menu"),fn=new Set,eo=new Set([St]),da=()=>document.querySelector(".dt-turbo")?.dataset.state??"none",ca=()=>n.client||x?[]:yt.filter(t=>t.status!=="done"&&Jt(t.assignee)&&!qt(t)&&Be(t)==="approved"&&!ln(t)&&!Me(t)&&!to.has(t.id)),ua=()=>ca().filter(t=>!fn.has(t.id)),Xl=(t,e=!1)=>`<i class="dt-push-check${t?" is-on":""}${e?" is-part":""}" aria-hidden="true">${t&&!e?$e:""}</i>`,Jl=()=>{let t=ca(),e=[...new Set(t.map(o=>o.route??"/"))],s=ua().length;gn.innerHTML=`<div class="dt-push-head">${Pe(14)}<b>Waiting for the agent</b><button type="button" data-push="all">All</button></div>`+e.map(o=>{let a=t.filter(l=>(l.route??"/")===o),i=a.filter(l=>!fn.has(l.id)).length;return`<button type="button" class="dt-push-page${eo.has(o)?" is-open":""}" data-push-route="${f(o)}"><span data-push-fold="${f(o)}">${Ks}</span>${Xl(i>0,i>0&&i<a.length)}<span class="dt-push-route">${f(o)}</span><em>${a.length}</em></button>`+(eo.has(o)?a.map(l=>`<button type="button" class="dt-push-thread" data-push-id="${l.id}">${Xl(!fn.has(l.id))}<span><small>#${l.id}</small>${f(Zt(l.text,60))}</span></button>`).join(""):"")}).join("")+`<button type="button" class="dt-push-send" data-push="send"${s?"":" disabled"}>Send ${s} to the agent</button>`},Zl=()=>["push","paused"].includes(da()),Ti=()=>je.ids.filter(t=>{let e=yt.find(s=>s.id===t);return!!e&&e.status!=="done"&&Be(e)!=="review"&&(to.has(t)||!!ln(e)||Be(e)==="approved")}),Ql="",nm=t=>{try{return sessionStorage.getItem("nm-batch-done")===t}catch{return!0}},Mn=()=>{let t=da(),e=ua().length,s=Ti(),o=je.ids.length-s.length,a=s.length>0&&Zl();if(s.length&&(Ql=je.at),!s.length&&je.ids.length&&je.at&&Ql===je.at&&!nm(je.at)){try{sessionStorage.setItem("nm-batch-done",je.at)}catch{}yt.length&&Re(`The agent finished ${je.ids.length} \u2014 check the fixes`,()=>la.start(),"Check")}_e.hidden=n.client||x||!e&&!_e.matches(".is-sending, .is-sent");let i=_e.querySelector(".dt-push-n");i.textContent=String(e),i.hidden=!e||_e.classList.contains("is-sent"),_e.querySelector(".dt-push-all").dataset.tip=a?`Push to the agent: it is on ${s.length}${o?` \u2014 ${o} done`:""}. ${e?`${e} more ${e===1?"waits":"wait"} \u2014 press to add ${e===1?"it":"them"}`:"New ones you mark wait for the next push"}`:t==="on"?"Push to the agent: turbo is on \u2014 the agent takes each thread as it lands":t==="none"?`Push to the agent: Claude Code isn\u2019t listening \u2014 click to copy /notemend:push${e?` (${e} waiting)`:""}`:e?`Push to the agent: ${e} ${e===1?"thread waits":"threads wait"} \u2014 send ${e===1?"it":"them all"} (right click to pick)`:"Push to the agent: nothing waits for the agent yet \u2014 mark threads for the agent, then send them here",(_e.hidden||!ca().length)&&(gn.hidden=!0),gn.hidden||Jl()},td=async t=>{if(!t.length&&Zl()){Ut("Nothing waits for the agent \u2014 mark threads for the agent first");return}if(da()==="none"){await navigator.clipboard?.writeText("/notemend:push").catch(()=>{}),Ut("Copied /notemend:push \u2014 run it in Claude Code, then Push sends them");return}if(da()==="on"){Ut("Turbo is on \u2014 the agent takes each thread as it lands");return}gn.hidden=!0;let e=t.map(o=>o.id);_e.classList.add("is-sending");let s=await ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({push:e})}).catch(()=>null);if(_e.classList.remove("is-sending"),!s?.ok){Dn("Could not send them to the agent",s),Mn();return}for(let o of e)to.add(o);_e.classList.add("is-sent"),setTimeout(()=>{_e.classList.remove("is-sent"),Mn()},700),je={at:je.ids.some(o=>Ti().includes(o))?je.at:new Date().toISOString(),ids:[...new Set([...Ti(),...e])]},Mn(),Re(`${e.length} sent to the agent \u2014 it\u2019s on ${e.length===1?"it":"them"}`,async()=>{await ae("comments",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({unpush:e})}).catch(()=>null);for(let o of e)to.delete(o);Mn()}),Ze()},pa=_e.querySelector(".dt-push-all"),ed=0,Ai=!1,nd=()=>{gn.hidden=!1,Jl()};pa.addEventListener("click",()=>{if(Ai){Ai=!1;return}td(ua())}),pa.addEventListener("contextmenu",t=>{t.preventDefault(),gn.hidden?nd():gn.hidden=!0}),pa.addEventListener("pointerdown",t=>{t.button===0&&(ed=window.setTimeout(()=>{Ai=!0,nd()},500))});for(let t of["pointerup","pointerleave","pointercancel"])pa.addEventListener(t,()=>clearTimeout(ed));gn.addEventListener("click",t=>{let e=t.target,s=e.closest("[data-push-fold]"),o=e.closest("[data-push-route]"),a=e.closest("[data-push-id]"),i=e.closest("[data-push]")?.dataset.push;if(i==="send"){td(ua());return}if(i==="all")fn.clear();else if(s){let l=s.dataset.pushFold;eo.has(l)?eo.delete(l):eo.add(l)}else if(o){let l=ca().filter(c=>(c.route??"/")===o.dataset.pushRoute),d=l.some(c=>!fn.has(c.id));for(let c of l)d?fn.add(c.id):fn.delete(c.id)}else if(a){let l=Number(a.dataset.pushId);fn.has(l)?fn.delete(l):fn.add(l)}Mn()}),document.addEventListener("pointerdown",t=>{!gn.hidden&&!_e.contains(t.target)&&(gn.hidden=!0)},!0),setInterval(Mn,3e4),Yl=Mn;let sd=document.querySelector(".dt-turbo");sd&&new MutationObserver(Mn).observe(sd,{attributes:!0,attributeFilter:["data-state"]}),Mn();let no="",Hi=!1,Ts="dt-threads",od=String([de.base,n.me?.email??"",...n.pages.map(t=>t.route)].join("|").split("").reduce((t,e)=>t*31+e.charCodeAt(0)|0,7)),Ci="",ma=null,sm=t=>{x||t.version&&t.version===Ci||(ma||(window.requestIdleCallback??(e=>setTimeout(e,200)))(()=>{let e=ma;ma=null,Ci=e.version??"";let s=JSON.stringify({project:od,body:e});s.length<2e6?mt.setItem(Ts,s):mt.removeItem(Ts)},{timeout:3e3}),ma=t)},Ni=(t,e=!1)=>{no=t.version??"",em(t);let s=t.turbo;to=new Set(s?.push?.ids??[]),je={at:s?.batch?.at??"",ids:s?.batch?.ids??[]};let o=qn(t.comments);if(e&&(Ue||un)){let i=new Set(o.map(l=>l.id));o=[...o,...yt.filter(l=>Dt(l)==="done"&&!i.has(l.id))]}sm({...t,comments:o}),os(o);let a=o.filter(i=>i.route===St);if(!(Bo&&(B=a,ad()))){if(JSON.stringify(a)===JSON.stringify(B)){!rt.hidden&&!x&&Z();return}B=a,Z(),We({reload:!0})}},as=async(t=!1)=>{let e=[t||!no?"":`since=${no}`,Ue||un?"":"open=1"].filter(Boolean).join("&");try{let s=await ae(`comments${e?`?${e}`:""}`);s.status===200&&Ni(await s.json())}catch{}},so=!1,is=async()=>{if(!document.hidden){if(Hi||es){so=!0;return}Hi=!0,await as(),Hi=!1,so&&(so=!1,is())}};$l=()=>{so&&!es&&(so=!1,is())};let ad=()=>{let t=Bo&&B.find(e=>e.id===Bo);return t?(Bo=0,Ke()&&!wn(t)&&ks(qt(t)?"clients":"studio"),Kt||Qe(!0),Ms(t.id),!0):!1},Ri=()=>{B=yt.filter(t=>t.route===St),ad()||Z()},Bi=0,Pi=null,ha=()=>{Pi&&Kt&&Ii(Pi)},Ii=t=>{Pi=t,!Bi&&(Bi=requestAnimationFrame(()=>{Bi=0;let e=t.target;if(!Kt||e.closest(et)){Jn.hidden=!0;return}let s=document.elementFromPoint(t.clientX,t.clientY);if(Jn.hidden=!1,!s)return;let o=s.getBoundingClientRect();xu.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,Ar.textContent=s.tagName.toLowerCase()+([...s.classList].find(a=>!/^(astro|svelte)-/.test(a))?"."+[...s.classList].find(a=>!/^(astro|svelte)-/.test(a)):"")+` ${Math.round(o.width)}\xD7${Math.round(o.height)}`,Ar.style.cssText=`left:${o.left}px;top:${Math.max(2,o.top-16)}px`}))},id=t=>{if(!(t.key!=="Escape"||t.isComposing)){if(t.preventDefault(),t.stopImmediatePropagation(),Qt){Qt=null,Z();return}if(N){Fs()&&(nn(),Z());return}if(X!==null){X=null,Z();return}Qe(!1)}},rd=["pointerdown","mousedown","pointerup","mouseup","touchstart","touchend"],oo=!1,ao=null,rs=document.createElement("div");rs.className="dt-repin-hint",rs.hidden=!0,rs.setAttribute("role","status"),rs.textContent="Click the new spot for this thread \xB7 Esc cancels",document.body.append(rs);let ld=()=>{ao=null,rs.hidden=!0,ee.toggle("dt-repinning",!1)},om=t=>{ao=t,X=null,rs.hidden=!1,ee.toggle("dt-repinning",!0),Z()};document.addEventListener("keydown",t=>{t.key==="Escape"&&ao!=null&&(t.stopImmediatePropagation(),ld())},!0);let dd=!1,cd=t=>{oo||(t.type==="pointerdown"&&(dd=t.pointerType==="touch"),!t.target.closest?.(et)&&t.stopPropagation())},ud=t=>{let e=t.target;dd&&(!e.closest?.(et)||e.closest?.(".dt-pin"))&&t.preventDefault()},pd=t=>{!oo&&t.button===0&&t.target.closest?.(":disabled")&&Oi(t)},Oi=t=>{if(oo)return;let e=t.target;if(e.closest(et))return;if(t.preventDefault(),t.stopPropagation(),C){C=!1;return}if(!getSelection()?.isCollapsed)return;let s=t.detail===0&&!t.clientX&&!t.clientY,o=document.activeElement;nt.hidden=!0;let a=s?o&&o!==document.body&&!o.closest(et)?o:e:document.elementFromPoint(t.clientX,t.clientY);if(nt.hidden=!1,!a)return;if(ao!=null){let m=ao;ld();let v=a.getBoundingClientRect();Em(m,a,s?v.left+v.width/2:t.clientX,s?v.top+v.height/2:t.clientY);return}if(!Fs())return;nn();let i=a.getBoundingClientRect(),l=a.tagName.toLowerCase(),d=[...a.classList].filter(m=>!/^(astro|svelte|css)-/.test(m)).slice(0,2);N={selector:_a(a),tag:l,classes:d,nth:Wa({tag:l,classes:d}).indexOf(a),rx:i.width&&!s?(t.clientX-i.left)/i.width:.5,ry:i.height&&!s?(t.clientY-i.top)/i.height:.5,label:Zt(ie(a.textContent||""),60),ctx:za(a),fp:Do(a),spot:{x:Math.round((s?i.left+i.width/2:t.clientX)+scrollX),y:Math.round((s?i.top+i.height/2:t.clientY)+scrollY)},opener:Pu(a),category:g[0].id,...Ke()&&Fe==="clients"?{shared:!0}:{}};let c=n.client||N.shared?null:Gs();c&&(N.assignee=c,N.stage="new",N.carried=!0),hd.set(N,um().then(()=>qi(a))),X=null,Jn.hidden=!0,Z()},am=2200,im=900*1024,md=8*1024*1024,rm=3*1024*1024,lm=50*1024*1024,dm=1200,cm=1600,qi=async t=>{let e=t instanceof HTMLElement?t:null;for(let l=0;e&&l<4&&e.parentElement&&e.parentElement!==document.body;l++){let d=e.getBoundingClientRect();if(d.width>=360&&d.height>=140)break;e=e.parentElement}let s=e?.getBoundingClientRect();if(!e||!s?.width||!s.height)return null;let o=t?.getBoundingClientRect(),a=o&&o.width&&o.height?{x:(o.left-s.left)/s.width,y:(o.top-s.top)/s.height,w:o.width/s.width,h:o.height/s.height}:null,i="";for(let l=e;l&&!i;l=l.parentElement){let d=getComputedStyle(l).backgroundColor;d&&d!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(d)&&(i=d)}if(!i){let[l,d,c]=(getComputedStyle(e).color.match(/[\d.]+/g)??["0","0","0"]).map(Number);i=.299*l+.587*d+.114*c>140?"#111":"#fff"}try{let{domToWebp:l}=await import("modern-screenshot"),d=Math.min(1,dm/s.width,cm/s.height),c=await Promise.race([l(e,{scale:d,quality:.8,timeout:4e3,backgroundColor:i,filter:m=>!(m instanceof Element&&m.closest(fs))}),new Promise(m=>setTimeout(()=>m(null),8e3))]);return c&&c.length<md?{url:c,box:a}:null}catch{return null}},hd=new WeakMap,um=()=>new Promise(t=>requestAnimationFrame(()=>"requestIdleCallback"in window?requestIdleCallback(()=>t(),{timeout:1500}):setTimeout(t,50))),Ut=(t,e=2800,s)=>{let o=document.createElement("div");o.className="dt-toast",o.textContent=t;for(let a of document.querySelectorAll(".dt-toast:not(.dt-toast--undo)"))Kn(a,()=>a.remove());if(document.body.append(o),s){let a=s.getBoundingClientRect(),i=o.offsetWidth/2;o.style.left=`${Math.min(Math.max(a.left+a.width/2,i+8),innerWidth-i-8)}px`}return setTimeout(()=>Kn(o,()=>o.remove()),e),o},gd=async(t,e)=>{for(let s of e){let[,o,a]=s.split("\0"),i=Zo.get(o);if(Zo.delete(o),!i){Ut(`${a} was not sent \u2014 attach it again`);continue}let l=Ut(`Uploading ${a}\u2026`,12e4),d=await ae("upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:t,name:i.name,size:i.size})}).then(A=>A.ok?A.json():null).catch(()=>null),c=d&&await fetch(d.url,{method:"PUT",headers:{"content-type":d.type,"x-upsert":"false"},body:i}).catch(()=>null),m=c?.ok&&await tt({id:t,uploaded:[d.name]}).catch(()=>null);if(l.remove(),!m||!m.ok){Ut(c===null&&d?`${a} could not be uploaded from this site \u2014 attach it in Notemend instead`:`${a} was not sent`);continue}let v=qn([await m.json().catch(()=>null)])[0];v&&(B=B.map(A=>A.id===v.id?v:A),Z()),Ut(`${a} sent`)}},fd=t=>{let e=t.filter(s=>s.startsWith(Jo)).map(s=>s.split("\0"));return e.length&&Ut(e.length===1?`${e[0][1]} was not sent \u2014 ${e[0][2]}`:`${e.length} files were not sent: ${e.map(([,s,o])=>`${s} (${o})`).join(", ")}`,6e3),t.filter(s=>!s.startsWith(Jo))},Dn=async(t,e)=>{if(!navigator.onLine){Ut(`${t} \u2014 you are offline. Try again once you are back online.`,6e3);return}let s="";if(e&&e.status>=400&&e.status<500&&e instanceof Response){let o=(await e.clone().text().catch(()=>"")).trim();try{s=o.startsWith("{")?String(JSON.parse(o).error??""):o}catch{s=""}(s.length>160||s.startsWith("<"))&&(s="")}Ut(s?`${t}: ${s.replace(/\.$/,"")}.`:`${t}${e?` (${e.status})`:""}.`,6e3)},pm=t=>new Promise(e=>{let s=new FileReader;s.onload=()=>e(String(s.result)),s.readAsDataURL(t)}),mm=async t=>{let e=await createImageBitmap(t),s=Math.min(1,am/Math.max(e.width,e.height));if(s===1&&t.size<=im)return e.close(),pm(t);let o=document.createElement("canvas");return o.width=Math.round(e.width*s),o.height=Math.round(e.height*s),o.getContext("2d").drawImage(e,0,0,o.width,o.height),e.close(),o.toDataURL("image/jpeg",.85)},Di=async(t,e)=>{let s=[],o=(a,i)=>s.push(`${Jo}${a}\0${i}`);for(let a of t){let i,l=fc(a.name)||Object.keys(bo).find(d=>bo[d]===a.type)||"";if(!/^image\/(png|jpeg|webp|gif)$/.test(a.type)){if(!l){o(a.name,ir.test(a.name.split(".").pop()??"")?"Programs can\u2019t be attached":"A file needs an extension");continue}if(a.size>lm){o(a.name,`${(a.size/1024/1024).toFixed(0)} MB \u2014 up to 50 MB a file`);continue}if(a.size>rm&&de.via){let c=`${Date.now()}-${Zo.size}`;Zo.set(c,a),s.push(`${ii}${c}\0${a.name}\0${a.size}`);continue}let d=await new Promise((c,m)=>{let v=new FileReader;v.onload=()=>c(String(v.result).split(",")[1]),v.onerror=m,v.readAsDataURL(a)}).catch(()=>"");d?s.push(`data:${/^[\w.+-]+\/[\w.+-]+$/.test(a.type)?a.type:"application/octet-stream"};name=${gc(a.name)||"file"};ext=${l};base64,${d}`):o(a.name,"Could not be read");continue}try{i=await mm(a)}catch{o(a.name,"This picture could not be read");continue}if(i.length>md){o(a.name,"Too large even after shrinking");continue}s.push(i)}if(s.length){if(!Number(e?.dataset.id)){N&&((N.images??=[]).push(...s),Z());return}Ee.push(...s),Z(),io(".dt-note-reply-input")}},bd=t=>[...t??[]].filter(e=>e.kind==="file").map(e=>e.getAsFile()).filter(Boolean);nt.addEventListener("paste",t=>{let e=bd(t.clipboardData?.items);e.length&&(t.preventDefault(),Di(e,t.target.closest(".dt-note")))}),nt.addEventListener("dragover",t=>{t.target.closest(".dt-note")&&(t.preventDefault(),t.target.closest(".dt-note").querySelector(".dt-compose")?.setAttribute("data-drop",""))}),nt.addEventListener("dragleave",t=>{t.target.closest(".dt-note")?.querySelector(".dt-compose")?.removeAttribute("data-drop")}),nt.addEventListener("drop",t=>{let e=t.target.closest(".dt-note");if(!e)return;t.preventDefault(),e.querySelector(".dt-compose")?.removeAttribute("data-drop");let s=bd(t.dataTransfer?.items);s.length&&Di(s,e)});let io=t=>{let e=nt.querySelector(t);e?.focus({preventScroll:!0}),e?.setSelectionRange(e.value.length,e.value.length)},yd=()=>{io(".dt-note-edit-input"),nt.querySelector(".dt-msg .dt-compose")?.scrollIntoView({block:"nearest"})},Fi=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=ui-t.value.length;t.closest(".dt-compose")?.querySelector(".dt-compose-tools")?.setAttribute("data-left",e<500?`${e} left`:"")},hm=t=>/(?:^|\s)@([^\s@]*)$/.exec(t.value.slice(0,t.selectionStart??t.value.length)),vd=t=>{let s=t.closest(".dt-compose").querySelector(".dt-mentions");s?.remove();let o=hm(t);if(!o)return;let a=o[1].toLowerCase(),i=X!=null?B.find(m=>m.id===X):void 0,d=(n.client||N?.shared||i&&qt(i)?n.team??[]:Xo()).filter(m=>!mr(m.email)).filter(m=>m.email!==n.me?.email&&[m.name,m.nickname,m.email].some(v=>v?.toLowerCase().startsWith(a))).slice(0,5);if(!d.length)return;t.insertAdjacentHTML("afterend",`<div class="dt-mentions" role="listbox" aria-label="Mention someone">${[...d.map(m=>`<button type="button" role="option" data-act="mention" data-handle="${f(wc(m))}">${Nn(m.avatar_url,m.name||m.email)}<span class="dt-mention-who"><b>${f(m.name||m.email)}</b>${m.name?`<span>${f(m.email)}</span>`:""}</span></button>`)].map((m,v)=>m.replace('role="option"',`role="option" aria-selected="${v===0}"`)).join("")}</div>`);let c=t.nextElementSibling;s&&(c.style.animation="none"),c.getBoundingClientRect().top<8&&c.classList.add("is-below")},gm='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true"><circle cx="5.5" cy="5" r="1.8"/><circle cx="5.5" cy="15" r="1.8"/><circle cx="14.5" cy="15" r="1.8"/><path d="M5.5 6.8v6.4M14.5 13.2V8.5a2 2 0 0 0-2-2H9.5M11 4.8 9.3 6.5 11 8.2"/></svg>',fm='<svg viewBox="0 0 20 20" width="12" height="12" aria-hidden="true" class="dt-link-out"><path d="M11 4h5v5M16 4l-7 7M14 11.5V15a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3.5"/></svg>',wd=t=>{let e=[...(n.team??[]).flatMap(o=>[o.name,o.nickname,o.email]),...Sa].filter(o=>!!o).sort((o,a)=>a.length-o.length).map(o=>f(o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),s=e.length?new RegExp(`@(?:${e.join("|")})${lr}`,"giu"):null;return dr(t).map(o=>typeof o!="string"?`<a class="dt-link" href="${f(o.url)}" target="_blank" rel="noopener noreferrer" title="${f(o.url)}">${o.kind==="pr"?gm:il}<span>${f(o.label)}</span>${fm}</a>`:s?f(o).replace(s,a=>{let i=Hc(a,n.team??[],n.me?.email);return`<span class="dt-at" data-kind="${i}">${i==="agent"?Pe(10):""}${a}</span>`}):f(o)).join("")};document.addEventListener("copy",t=>{let e=getSelection();if(!e?.rangeCount||!t.clipboardData)return;let s=document.createElement("div");for(let a=0;a<e.rangeCount;a++)s.append(e.getRangeAt(a).cloneContents());let o=s.querySelectorAll("a.dt-link");if(o.length){for(let a of o)a.replaceWith(a.getAttribute("href")??"");t.clipboardData.setData("text/plain",s.textContent??""),t.preventDefault()}});let $d=(t,e)=>{let s=t.selectionStart??t.value.length,o=t.value.slice(0,s).lastIndexOf("@");t.value=`${t.value.slice(0,o)}@${e} ${t.value.slice(s)}`,t.selectionStart=t.selectionEnd=o+e.length+2,t.closest(".dt-compose")?.querySelector(".dt-mentions")?.remove(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()};document.addEventListener("pointerdown",t=>{for(let e of nt.querySelectorAll(".dt-mentions"))e.contains(t.target)||(e.closest(".dt-compose")?.querySelector("textarea")?.setAttribute("data-no-mention",""),e.remove())},!0);let bm=(t,e)=>{if(!t){N&&(N.category=e),Z();return}Ye(s=>s.map(o=>o.id===t?{...o,category:e}:o),()=>tt({id:t,category:e}),"Changing the type")};Zc([nt,rt],f,$e),rt.addEventListener("change",t=>{let e=t.target.closest(".dt-owner-select[data-id]");e&&zo(Number(e.dataset.id),e.value)}),rt.addEventListener("click",t=>{let e=t.target.closest('.dt-hist-tools [data-act="claude"]');e&&(t.stopPropagation(),Zr(Number(e.dataset.id)))},!0);let ym=t=>qt(t)?"studio":"clients",ji=async(t,e=!1)=>{let s=B.find(i=>i.id===t);if(!s||qt(s)&&s.client)return;let o=!qt(s);X===t&&(X=null);let a=o&&Jt(s.assignee)?{assignee:null,stage:"new"}:{};await Ye(i=>i.map(l=>l.id===t?{...l,...a.stage?{assignee:void 0,stage:"new"}:{},shared:o||void 0,client:o?l.client:void 0}:l),()=>tt(o?{id:t,shared:o,...a}:{id:t,shared:!1,client:!1}),o?"Moving it to Client":"Moving it to Team"),os(yt),e||Re(o?"Moved to Client":"Moved to Team",()=>ji(t,!0))},vm=async t=>{let e=B.find(d=>d.id===t);if(!e)return;let s=e,o={text:e.text,from:{id:e.id},...qt(e)?{}:{shared:!0}};for(let d of["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"])s[d]!=null&&(o[d]=s[d]);let a=await In(ae("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o)})).catch(()=>null);if(!a?.ok){Dn("The copy was not made",a);return}let i=qn([await a.json().catch(()=>null)])[0];i&&(yt=[...yt,i],B=yt.filter(d=>d.route===St)),os(yt),Z(),Ze();let l=ym(e);Re(l==="clients"?"Duplicated for the client":"Duplicated to Team",()=>{i&&(ks(l),Ms(i.id))},"Open")},wm=["route","selector","rx","ry","label","ctx","breakpoint","browser","device","tag","classes","nth","category","priority","host","viewport"],ga=async t=>{let e=[],s=0;for(let o of t){let a=yt.find(m=>m.id===o);if(!a||!qt(a)||Io(a))continue;let i=a,l={text:a.text,from:{id:a.id}};for(let m of wm)i[m]!=null&&(l[m]=i[m]);let d=await In(ae("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(l)})).catch(()=>null);if(!d?.ok){Dn("Not mirrored",d);break}let c=qn([await d.json().catch(()=>null)])[0];c&&(d.status===201?e.push(c):s++,yt=[...yt.filter(m=>m.id!==c.id),c])}if(B=yt.filter(o=>o.route===St),os(yt),Z(),Ze(),!e.length){s&&Ut("Already mirrored");return}Re(`${e.length} mirrored to Team`,async()=>{let o=new Set(e.map(a=>a.id));yt=yt.filter(a=>!o.has(a.id)),B=B.filter(a=>!o.has(a.id)),os(yt),Z();for(let a of o)await In(ae(`comments?id=${a}`,{method:"DELETE"})).catch(()=>null);Ze()})},_i=()=>{He=null,Oo=null,ue(Xt())},xd=async()=>{let t=[...He??[]];_i(),t.length&&await ga(t)},$m=(t,e)=>{let s=B.find(o=>o.id===t);if(He??=new Set,s&&bs(s)){let o=[...rt.querySelectorAll(".dt-hist-go[data-go]")].map(l=>Number(l.dataset.go)),a=o.indexOf(Oo??t),i=o.indexOf(t);if(e&&a>=0&&i>=0)for(let l of o.slice(Math.min(a,i),Math.max(a,i)+1)){let d=B.find(c=>c.id===l);d&&bs(d)&&He.add(l)}else He.has(t)?He.delete(t):He.add(t);Oo=t}ue(Xt())};document.addEventListener("keydown",t=>{t.key==="Escape"&&He&&(t.stopImmediatePropagation(),t.preventDefault(),_i())},!0);let xm=t=>{let e=new URL(location.href);e.searchParams.has("notemend")||(e.search=e.search?`${e.search}¬emend`:"?notemend"),e.hash=`thread-${t}`;let s=e.href;navigator.clipboard?.writeText(s).then(()=>Ut("Link copied"),()=>Ut(s,6e3))};nt.addEventListener("change",t=>{let e=t.target.closest(".dt-more-select");if(e){let d=e.value,c=Number(e.dataset.id)||0;e.value="",d==="dup"?vm(c):d==="mirror"?ga([c]):d==="move"?ji(c):d==="link"?xm(c):d==="reopen"?Xe(c,!1):d==="archive"||d==="unarchive"?ns(c,d==="archive"):d==="rm"?(X=null,hi(c)):d==="discard"&&(N=null,Z());return}let s=t.target.closest(".dt-lang-select");if(s){di(Number(s.dataset.id),s.dataset.at,s.value==="orig"?null:s.value);return}let o=t.target.closest(".dt-cat-select");if(o){bm(Number(o.dataset.id)||0,o.value);return}let a=t.target.closest(".dt-status-select");if(a){ep(Number(a.dataset.id),a.value);return}let i=t.target.closest(".dt-owner-select");if(i){qu(Number(i.dataset.id)||0,i.value);return}let l=t.target.closest(".dt-for-select");if(l){if(mt.setItem("nm-for",l.value),n.client){N&&(N.assignee=l.value,Gs(l.value),Z());return}Ua(Number(l.dataset.id)||0,"person")}}),nt.addEventListener("input",t=>{let e=t.target.closest(".dt-suggest-input");if(e&&N?.suggest){N.suggest.to=e.value,Zn(),Fi(e);return}let s=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!s)return;s.removeAttribute("data-no-mention"),vd(s),s.classList.contains("dt-note-input")?N&&(N.text=s.value):s.classList.contains("dt-note-edit-input")?Qt&&(Qt.text=s.value):Ae=s.value,Zn(),s.closest(".dt-compose")?.querySelector(".dt-send")?.classList.toggle("is-ready",s.value.trim()!==""),Fi(s);let o=s.closest(".dt-note");o&&o.getBoundingClientRect().bottom>aa()&&(bi([]),o.classList.contains("is-capped")&&(o.scrollTop=o.scrollHeight))}),nt.addEventListener("keydown",t=>{if(t.key==="Escape"&&nt.querySelector(".dt-emoji")){t.stopPropagation();let a=xn?.box??xn?.btn;ta(),a?.focus();return}let e=t.target.closest(".dt-note-input, .dt-note-reply-input, .dt-note-edit-input");if(!e)return;let s=()=>e.closest(".dt-compose")?.querySelector(".dt-mentions button");(t.key==="Enter"||t.key==="Tab")&&!t.isComposing&&!s()&&!e.hasAttribute("data-no-mention")&&vd(e);let o=s();if(o&&(t.key==="Enter"||t.key==="Tab")&&!t.isComposing){t.preventDefault(),$d(e,o.dataset.handle);return}if(o&&t.key==="Escape"){t.stopPropagation(),e.setAttribute("data-no-mention",""),o.parentElement.remove();return}t.key!=="Enter"||t.shiftKey||t.isComposing||(t.preventDefault(),e.closest(".dt-compose")?.querySelector(".dt-send")?.click())});let Vt=null,fa=!1;function ro(t){return!n.client||!!n.me&&t.by===n.me.email}let Ed=t=>{let e=document.createElement("div");return e.className=`dt-drag-box ${t}`,e.hidden=!0,e.innerHTML="<span></span>",document.body.append(e),e},Wi=Ed("dt-drag-box--home"),Md=Ed("dt-drag-box--to"),kd=()=>{let t=document.body.currentCSSZoom??1;for(let e of document.querySelectorAll(".dt-notes-overlay, .dt-notes-hi, .dt-spot, .dt-pad-overlay, .dt-drag-box"))e.style.zoom=t===1?"":String(1/t)};kd(),addEventListener("resize",kd);let Em=async(t,e,s,o)=>{let a=B.find(m=>m.id===t);if(!a)return;let i={...zi(e,s,o),fp:Do(e),spot:{x:Math.round(s+scrollX),y:Math.round(o+scrollY)}},l={selector:a.selector,tag:a.tag,classes:a.classes,nth:a.nth,label:a.label,ctx:a.ctx,rx:a.rx,ry:a.ry,fp:a.fp,spot:a.spot},d=`${ea(a.tag,a.classes,a.selector)}${ie(a.label)?` \xAB${Zt(ie(a.label),24)}\xBB`:""}`,c=(m,v,A)=>Ye(j=>j.map(h=>h.id===t?{...h,...m,anchor:null,...v?{repinnedAt:new Date().toISOString(),repinnedBy:n.me?.email??"you",repinnedFrom:d}:{repinnedAt:null,repinnedBy:null,repinnedFrom:null}}:h),()=>tt({id:t,move:m,anchor:null,repin:v?d:!1}),A);Qn.delete(t),await c(i,!0,"Re-pinning"),Re(`Pinned to ${lo(e)}`,()=>{Qn.delete(t),c(l,!1,"Putting the pin back")})},Mm=async t=>{let e=B.find(i=>i.id===t),s=e&&Ce(e);if(!e||!s)return;let o=s.getBoundingClientRect(),a={...zi(s,o.left+o.width*e.rx,o.top+o.height*e.ry),fp:Do(s)};Qn.delete(t),await Ye(i=>i.map(l=>l.id===t?{...l,...a,anchor:null}:l),()=>tt({id:t,move:a,anchor:null}),"Keeping the pin here"),_s(),Z()},km=t=>{let e=B.find(i=>i.id===t),s=e&&Te(e)?.opener;if(!e||!s)return;oo=!0;let o=s.getBoundingClientRect(),a={bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2,button:0,view:window};try{for(let i of["pointerdown","mousedown","pointerup","mouseup","click"])s.dispatchEvent(new(i.startsWith("pointer")?PointerEvent:MouseEvent)(i,a))}finally{oo=!1}X=null,setTimeout(()=>{_s(),X=t,Z()},180)},lo=t=>{let e=Zt(ie(t.textContent||"").replace(/\s+/g," "),24);return`${t.tagName.toLowerCase()}${e?` \xAB${e}\xBB`:""}`},Ld=(t,e,s="")=>{if(!e){t.hidden=!0;return}let o=e.getBoundingClientRect();t.style.cssText=`left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px`,t.querySelector("span").textContent=s,t.hidden=!1},Lm=(t,e)=>document.elementsFromPoint(t,e).find(s=>!s.closest(et)&&!s.closest(".dt-drag-box")&&s!==document.documentElement&&s!==document.body)??null,Sm=(t,e,s)=>{let o=t.getBoundingClientRect();return e>=o.left&&e<=o.right&&s>=o.top&&s<=o.bottom},zi=(t,e,s)=>{let o=t.getBoundingClientRect(),a=t.tagName.toLowerCase(),i=[...t.classList].filter(l=>!/^(astro|svelte|css)-/.test(l)).slice(0,2);return{selector:_a(t),tag:a,classes:i,nth:Wa({tag:a,classes:i}).indexOf(t),label:Os(t.textContent||"",60),ctx:za(t),rx:o.width?Math.min(1,Math.max(0,(e-o.left)/o.width)):.5,ry:o.height?Math.min(1,Math.max(0,(s-o.top)/o.height)):.5}},Vi=()=>{Vt&&(Vt.on&&Mo(Vt.pin,"land"),Vt.pin.classList.remove("is-dragging"),ee.toggle("dt-dragging",!1),Wi.hidden=Md.hidden=!0,Vt=null,Je())};nt.addEventListener("pointerdown",t=>{let e=t.target.closest(".dt-pin[data-id]");if(!e||t.button!==0)return;let s=B.find(o=>o.id===Number(e.dataset.id));!s||!ro(s)||(Vt={id:s.id,pin:e,x0:t.clientX,y0:t.clientY,on:!1,home:Ce(s),to:null},e.setPointerCapture(t.pointerId))}),nt.addEventListener("pointermove",t=>{if(!Vt||!Vt.on&&Math.hypot(t.clientX-Vt.x0,t.clientY-Vt.y0)<4)return;Vt.on=!0,Vt.pin.classList.add("is-dragging"),ee.toggle("dt-dragging",!0),Vt.pin.style.left=`${t.clientX}px`,Vt.pin.style.top=`${t.clientY}px`,Vt.to=Vt.home&&Sm(Vt.home,t.clientX,t.clientY)?Vt.home:Lm(t.clientX,t.clientY);let e=Vt.to&&Vt.to!==Vt.home;Ld(Wi,Vt.home,e?"":Vt.home?lo(Vt.home):""),Wi.classList.toggle("is-left",!!e),Ld(Md,e?Vt.to:null,e?`Move to ${lo(Vt.to)}`:"")}),nt.addEventListener("pointerup",async t=>{if(!Vt)return;let e=Vt;if(!e.on||!e.to){Vi();return}fa=!0,setTimeout(()=>{fa=!1},0);let s=B.find(d=>d.id===e.id),o=zi(e.to,t.clientX,t.clientY),a=e.to!==e.home;if(Vi(),!s)return;let i={selector:s.selector,tag:s.tag,classes:s.classes,nth:s.nth,label:s.label,ctx:s.ctx,rx:s.rx,ry:s.ry},l=(d,c)=>Ye(m=>m.map(v=>v.id===e.id?{...v,...d}:v),()=>tt({id:e.id,move:d}),c);await l(o,"Moving the pin"),a&&Re(`Moved to ${lo(e.to)}`,()=>l(i,"Putting the pin back"))}),nt.addEventListener("click",t=>{fa&&(t.stopImmediatePropagation(),t.preventDefault(),fa=!1)},!0),document.addEventListener("keydown",t=>{t.key==="Escape"&&Vt?.on&&(t.stopImmediatePropagation(),Vi())},!0),nt.addEventListener("click",async t=>{let e=t.target.closest("button"),s=xn?.btn;if(e?.closest(".dt-emoji")||ta(),!e)return;let o=e.dataset.act,a=Number(e.dataset.id);if(o==="open-orig"){ks("clients"),Ms(a);return}if(o==="react"){fl(a,e.dataset.at||null,e.dataset.emoji);return}if(o==="react-pick"||o==="emoji-pick"){s!==e&&gl(e,!1,o==="react-pick"?{id:a,at:e.dataset.at??""}:{box:e.closest(".dt-compose")?.querySelector("textarea")??void 0});return}if(o==="emoji-more"&&xn){let i=xn;gl(i.btn,!0,i);return}if(o==="emoji"&&xn){let i=xn;ta(),i.box?Ap(i.box,e.dataset.emoji):i.id&&fl(i.id,i.at||null,e.dataset.emoji);return}if(o==="prio"){let i=e.dataset.v||null;a?Ye(l=>l.map(d=>d.id===a?{...d,priority:i??void 0}:d),()=>tt({id:a,priority:i}),"Setting the priority"):N&&(N.priority=i??void 0,Zn(),Z());return}if(o==="mention"){let i=e.closest(".dt-compose")?.querySelector("textarea");i&&$d(i,e.dataset.handle);return}if(!o){if(N&&!Fs())return;X=X===a?null:a,nn(),Z(),ss&&ia();return}if(o==="speak"){wp(e.closest(".dt-note"),e);return}if(o==="voice-write"){xp(e);return}if(o==="voice"||o==="voice-seek"){rp(e,o==="voice-seek"?t:null);return}if(o==="attach"||o==="attach-file"){let i=Object.assign(document.createElement("input"),{type:"file",accept:o==="attach"?"image/*":"",multiple:!0}),l=e.closest(".dt-note");i.addEventListener("change",()=>{i.files?.length&&Di([...i.files],l)}),i.click();return}if(o==="unshot"){a?Qt&&Qt.drop.push(e.dataset.img):(e.closest("[data-draft]")?N?.images??[]:Ee).splice(Number(e.dataset.i),1),Z(),Qt&&yd();return}if(o==="edit"){let i=B.find(c=>c.id===a),l=e.dataset.at||null,d=l?i?.replies?.find(c=>c.at===l)?.text:i?.text;if(d===void 0)return;Qt={id:a,at:l,text:d,drop:[]},Z(),yd();return}if(o==="edit-cancel"){Qt=null,Z();return}if(o==="tr-orig"){di(a,e.dataset.at,null);return}if(o==="tr-retry"){di(a,e.dataset.at,e.dataset.to);return}if(o==="unsay"){let i=e.dataset.at;qp(a,i);return}if(o==="edit-save"){let i=Qt;if(!i)return;let l=i.text.trim();if(!l){nt.querySelector(".dt-note-edit-input")?.focus();return}Qt=null;let d=c=>i.drop.includes(c.split("/").pop());await Ye(c=>c.map(m=>m.id!==i.id?m:{...m,...i.at==null?{text:l}:{replies:(m.replies??[]).map(v=>v.at===i.at?{...v,text:l}:v)},images:(m.images??[]).filter(v=>!d(v))}),()=>tt({id:i.id,edit:{at:i.at,text:l},...i.drop.length?{removeImage:i.drop}:{}}).then(c=>(c.ok||(Qt=i),c),c=>{throw Qt=i,c}),"Saving the edit");return}if(o==="cancel"){Fs()&&(nn(),Z());return}if(o==="twin"){if(!Fs())return;nn(),X=Number(e.dataset.id),Z();return}if(o==="discard"){N=null,Z();return}if(o==="draft-open"){wi(Number(e.dataset.i));return}if(o==="close"){X=null,Z();return}if(o==="hidden-why"){let i=e.getAttribute("aria-expanded")!=="true";e.setAttribute("aria-expanded",String(i)),e.parentElement.querySelector("p").hidden=!i;return}if(o==="go-spot"){let i=B.find(l=>l.id===Number(e.dataset.id));i&&Dr(i);return}if(o==="show-el"){let i=B.find(l=>l.id===Number(e.dataset.id));i&&Ce(i)?.scrollIntoView({block:"center",inline:"center",behavior:Gn()?"smooth":"auto"});return}if(o==="where"){let i=B.find(j=>j.id===Number(e.dataset.id)),l=i&&Te(i),d=l?.hidden;if(!d)return;let c=j=>{let h=j.getBoundingClientRect();return(h.width||h.height)&&j.checkVisibility?.()!==!1?h:null},m=l.shut instanceof HTMLElement?l.shut:null,v=m&&c(m);if(m&&!v){let j=m.getAttribute("style");m.setAttribute("style",`${j??""};display:block!important`),v=c(m),j==null?m.removeAttribute("style"):m.setAttribute("style",j)}v??=d.getBoundingClientRect(),d.scrollIntoView({block:"nearest",behavior:"smooth"});let A=document.createElement("div");A.className="dt-where",A.style.cssText=`left:${v.left}px;top:${v.top}px;width:${v.width}px;height:${v.height}px`,document.body.append(A),An(A).then(()=>A.remove());return}if(o==="unsuggest"&&N){N.suggest=null,Z();return}if(o==="uncarry"&&N){N.assignee="",N.carried=!1,Gs(""),Zn(),Z();return}if(o==="save"){if(!N)return;N.images&&(N.images=fd(N.images));let i=(N.images??[]).filter(z=>!ws(z)),l=N.suggest&&N.suggest.to.trim()!==N.suggest.from?{from:N.suggest.from,to:N.suggest.to.trim()}:null,d=nt.querySelector(".dt-note-input").value.trim()||(l?"Change the text":"")||(N.images?.some(ni)?ml:N.images?.some(z=>ws(z)&&!yo(z))?"See the attached image":N.images?.length?"See the attached file":"");if(!d){nt.querySelector(".dt-note-input")?.focus();return}let c=N,m=n.client||c.shared===!0?null:pr(d,Vs()),v=hd.get(c)??qi(Ce(c)),A={...c,images:c.images?.filter(ws),route:St,text:d,suggest:l,assignee:n.client?ll(c.assignee)||void 0:m??(c.assignee||void 0),shared:n.client?!0:c.shared===!0,stage:n.client?"new":m?"approved":c.stage??(Jt(c.assignee)?"approved":"new"),breakpoint:ja(),browser:Au(),device:x?Sd:"",viewport:{w:innerWidth,h:innerHeight},logs:Gc(),host:location.host},j={...c,id:-Date.now(),text:d,route:St,status:"open",note:"",doneBy:null,breakpoint:A.breakpoint,replies:[],images:[],createdAt:new Date().toISOString(),...l?{suggest:l}:{},by:n.me?.email,byName:n.me?.name};B=[...B,j],N=null,Z();let h=await In(ae("comments",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(A)})).catch(()=>null);if(!h?.ok){B=B.filter(z=>z!==j),nn(),N=c,Z(),Dn("Thread was not saved",h);return}let G=qn([await h.json().catch(()=>null)])[0];B=B.map(z=>z===j&&G?G:z),Z(),G&&v.then(z=>{z&&tt({id:G.id,before:z.url,box:z.box})}),G&&i.length&&gd(G.id,i),Ze();return}if(o==="reply"){let i=nt.querySelector(".dt-note-reply-input");Ee=fd(Ee);let l=i.value.trim()||(Ee.some(ni)?ml:Ee.some(z=>ws(z)&&!yo(z))?"See the attached image":Ee.length?"See the attached file":"");if(!l){i.focus();return}let d=Ee;Ae=l,cn=a,js(),Ae="",Ee=[],i.value="";let c=B,m=B.find(z=>z.id===a),v=n.client||qt(m)?null:pr(l,Vs()),A=v&&m&&(v!==m.assignee||Be(m)!=="approved"||m.status==="done")?{assignee:v,stage:"approved",...m.status==="done"?{status:"open",doneBy:null}:{}}:{};B=B.map(z=>z.id===a?{...z,...A,replies:[...z.replies??[],{author:"you",text:l,at:new Date().toISOString(),by:n.me?.email}]}:z),Ho=a,Z();let j=await In(tt({id:a,reply:l,images:d.filter(ws),...A})).catch(()=>null);if(!j?.ok){B=c,Ae=l,Ee=d,Z();let z=nt.querySelector(".dt-note-reply-input");z&&!z.value&&(z.value=l);let It=()=>nt.querySelector(`[data-act="reply"][data-id="${a}"]`)?.click();navigator.onLine?Re(`Reply was not sent${j?` (${j.status})`:""} \u2014 it is back in the box`,It,"Retry"):Dn("Reply was not sent",j);return}js();let h=qn([await j.json().catch(()=>null)])[0];h&&(B=B.map(z=>z.id===h.id?h:z),Z()),Ze();let G=d.filter(z=>!ws(z));G.length&&gd(a,G);return}if(o==="unfold"){vs.set(a,1/0),Z();let i=nt.querySelector(`.dt-note[data-id="${a}"] .dt-note-thread`);if(i){for(let l of i.querySelectorAll(".dt-msg--new"))l.classList.remove("dt-msg--new");i.scrollTop=i.scrollHeight,No(i)}delete qe[a],i?.parentElement?.querySelector(".dt-new-below")?.remove();return}if(o==="newbelow"){let i=e.closest(".dt-note")?.querySelector(".dt-note-thread");i?.scrollTo({top:i.scrollHeight,behavior:Gn()?"smooth":"auto"}),delete qe[a],e.remove();return}if(o==="hand"){Ua(a,e.dataset.v);return}if(o==="repin"){om(a);return}if(o==="pin-yes"){await Mm(a);return}if(o==="open-it"){km(a);return}if(o==="lost-resolve"){X=null,await Xe(a,!0);return}if(o==="claude"){Zr(a);return}if(o==="sendback"){await Xe(a,!1),io(".dt-note-reply-input");return}if(o==="accept"){await Xe(a,!0);return}if(o==="archive"||o==="unarchive"){o==="archive"&&!e.classList.contains("dt-step-act")&&(X=null),await ns(a,o==="archive");return}e.classList.contains("dt-step-act")||(X=null),o==="rm"?await hi(a):await Xe(a,o==="done")});let Sd="",We=t=>{yn.hidden||qs.contentWindow?.postMessage({dt:!0,...t},location.origin)},Tm=()=>({notes:Kt,grid:!Tt.hidden,inspect:ft,resolved:Ue,archived:un,...Td.look()});addEventListener("message",t=>{if(t.origin!==location.origin||!t.data?.dt)return;let e=t.data;if(x&&e.projectGrid!==void 0){zt=e.projectGrid,Tt.hidden||U();return}if(!x&&t.source===qs.contentWindow){if(e.key){Qd(e.key[0],e.key[1])?.run();return}if(e.closeMenus){F();return}if(e.route){gt();return}if(e.drafts){pi=e.drafts,ue(Xt());return}}if(x&&typeof e.openDraft=="number"){wi(e.openDraft);return}if(x&&typeof e.dropDraft=="number"){ql(e.dropDraft);return}if(x&&typeof e.device=="string"&&(Sd=e.device),x&&e.scrollbar&&ee.toggle("dt-sb-classic",e.scrollbar==="classic"),e.hello&&t.source===qs.contentWindow){We(Tm());return}typeof e.notes=="boolean"&&e.notes!==Kt&&Qe(e.notes,!1),typeof e.open=="number"&&Ms(e.open),typeof e.grid=="boolean"&&e.grid===Tt.hidden&&I(e.grid),typeof e.inspect=="string"&&e.inspect!==ft&&Y(e.inspect),typeof e.resolved=="boolean"&&e.resolved!==Ue&&xi(e.resolved),typeof e.archived=="boolean"&&e.archived!==un&&Ei(e.archived),e.reload&&as()});let Ze=async()=>{await as(),We({reload:!0}),x&&parent.postMessage({dt:!0,reload:!0},location.origin)},Qe=(t,e=!0)=>{if(Kt=t,Pt.setAttribute("aria-pressed",String(t)),t?!x&&rt.hidden&&mt.getItem("dt-history")==="1"&&(Fl(),ve.setAttribute("aria-pressed","true")):(Dl(()=>{Kt||rt.replaceChildren()}),ve.setAttribute("aria-pressed","false")),D(Hr,t?"1":"0"),We({notes:t}),x&&e&&parent.postMessage({dt:!0,notes:t},location.origin),nt.hidden=!t||!yn.hidden,ee.toggle("dt-noting",t),t&&!x?zl():document.querySelector(".dt-room")?.remove(),t){Y(""),document.addEventListener("click",Oi,!0),document.addEventListener("pointerup",pd,!0);for(let s of rd)document.addEventListener(s,cd,!0);document.addEventListener("contextmenu",ud,!0),document.addEventListener("keydown",id),document.addEventListener("mousemove",Ii),addEventListener("scroll",Je,!0),addEventListener("scroll",ha,!0),addEventListener("scroll",ia,!0),addEventListener("resize",Je),addEventListener("resize",ha),addEventListener("pointerover",Ul,!0),_s(),Gl.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden","open"]}),Kl.observe(document.body),Ri()}else{nn(),X=null,document.removeEventListener("click",Oi,!0),document.removeEventListener("pointerup",pd,!0);for(let s of rd)document.removeEventListener(s,cd,!0);document.removeEventListener("contextmenu",ud,!0),document.removeEventListener("keydown",id),document.removeEventListener("mousemove",Ii),Jn.hidden=!0,removeEventListener("scroll",Je,!0),removeEventListener("scroll",ha,!0),removeEventListener("scroll",ia,!0),removeEventListener("resize",Je),removeEventListener("resize",ha),removeEventListener("pointerover",Ul,!0),Gl.disconnect(),Kl.disconnect(),nt.innerHTML=""}},{pickBp:Gi,...Td}=iu({cfg:n,inFrame:x,persist:D,frame:yn,frameEl:qs,devicesMenu:Xn,bpBtns:Yt,notesOverlay:nt,WIDE:b,bpOf:E,currentBp:ja,deviceById:T,notesOn:()=>Kt,filter:()=>Oa,filterTo:t=>{Oa=t},dropFrameDrafts:()=>{pi=[]},putAway:()=>{X=null,nn()},tellFrame:We,syncBpButtons:Pr,render:()=>Z(),reread:()=>{Kt?Ri():Z()}}),Ad="dt-studio",Hd=t=>{Yn.setAttribute("aria-pressed",String(t)),ee.toggle("dt-no-studio",!t),D(Ad,t?"1":"0")};Yn.addEventListener("click",()=>Hd(Yn.getAttribute("aria-pressed")!=="true")),Hd(mt.getItem(Ad)!=="0"),Pt.addEventListener("click",()=>Qe(!Kt));let fe=document.querySelector(".devtools"),As=document.querySelector(".dt-tab"),Cd=()=>document.documentElement.style.setProperty("--dt-bar-room",`${Math.max(56,innerHeight-fe.getBoundingClientRect().top)+12}px`);new ResizeObserver(Cd).observe(fe),addEventListener("resize",Cd);let Am=()=>document.querySelector("nextjs-portal")?.shadowRoot?.querySelector("[data-next-badge-root]")?.getBoundingClientRect(),Nd=()=>{fe.removeAttribute("data-tight");let t=fe.getBoundingClientRect().right,e=Am(),s=!1;for(let o of fe.children){let a=o.getBoundingClientRect();t=Math.max(t,a.right),e?.width&&e.left<a.right+8&&e.right>a.left-8&&e.top<a.bottom&&e.bottom>a.top&&(s=!0)}fe.toggleAttribute("data-tight",innerWidth<768||t>document.documentElement.clientWidth-8||s)},Rd=0,Ki=()=>{cancelAnimationFrame(Rd),Rd=requestAnimationFrame(Nd)},Hm=new ResizeObserver(Ki);for(let t of fe.children)Hm.observe(t);addEventListener("resize",Ki),Nd();for(let t of[1500,4e3])setTimeout(Ki,t);for(let t of w)t.addEventListener("toggle",()=>{let e=t.querySelector(":scope > :not(summary)");if(!e||(e.style.translate="",!t.open||rt.hidden))return;let s=e.getBoundingClientRect(),o=rt.getBoundingClientRect();o.width&&s.right>o.left-8&&s.bottom>o.top&&s.top<o.bottom&&(e.style.translate=`${Math.round(o.left-8-s.right)}px 0`)});let Bd=t=>{fe.toggleAttribute("data-collapsed",t),As.toggleAttribute("data-collapsed",t),As.setAttribute("aria-expanded",String(!t)),As.setAttribute("aria-label",t?"Show the bar":"Hide the bar"),fe.inert=t,t&&F(),t&&Ns&&ya(""),t&&Kt&&!N&&X==null&&Qe(!1),D("dt-collapsed",t?"1":"0")};As.addEventListener("click",()=>Bd(!fe.hasAttribute("data-collapsed")));let an=document.querySelector(".dt-keys"),Pd=an.querySelector(".dt-set-keys"),Cm=an.querySelector(".dt-set-main"),co=an.querySelector(".dt-set-grid"),Id=an.querySelector('[data-set="grid"] .dt-set-hint'),uo=t=>{if(Cm.hidden=t!=="main",Pd.hidden=t!=="keys",co.hidden=t!=="grid",t==="grid"&&Pm(),Id){let e=ne();Id.textContent=e?`Project \xB7 ${e.cols} cols`:"Auto"}},Ui=t=>uo(t?"keys":"main"),Yi={desktop:{cols:12,gutter:24,margin:24,max:1200},tablet:{cols:8,gutter:16,margin:24,max:null},landscape:{cols:4,gutter:16,margin:16,max:null},portrait:{cols:4,gutter:16,margin:16,max:null}},po={cols:[1,24],gutter:[0,200],margin:[0,200],max:[320,4e3]},Nm=["cols","gutter","margin","max"],ba=(t,e)=>Math.min(po[t][1],Math.max(po[t][0],Math.round(e))),Rm=()=>({...Yi,...zt?.widths}),Xi=()=>!!n.project&&!!n.gridAdmin,Od=()=>!Tt.hidden&&!ne()&&k?k:me(),Bm=t=>{let e=t.replace(/^Mobile /,"");return e[0].toUpperCase()+e.slice(1)},Pm=()=>{let t=Xi(),e=Rm(),s=Lt(),o=ne(),a=p.find(c=>c.id===s),i=(c,m)=>`<div class="dt-grid-row"><span>${c}</span><b>${m}</b></div>`,l=(de.cabinet||n.cabinet)&&n.project?` <a href="${f(`${de.cabinet||n.cabinet}/p/${n.project}?tab=settings`)}" target="_blank" rel="noopener">Also in the cabinet \u203A</a>`:"",d;if(o)d=`<p class="dt-grid-band">${f(a.label.toUpperCase())} \xB7 ${a.ideal} \u2014 this width</p>
|
|
334
|
+
<div class="dt-grid-fields">${Nm.map(c=>`<label><span>${c==="cols"?"Cols":c[0].toUpperCase()+c.slice(1)}</span>
|
|
335
|
+
<input type="number" inputmode="numeric" step="1" min="${po[c][0]}" max="${po[c][1]}" data-grid-k="${c}" value="${o[c]??""}"${c==="max"?' placeholder="\u2014"':""}${t?"":" disabled"}></label>`).join("")}</div><hr>
|
|
336
|
+
${p.filter(c=>c.id!==s&&e[c.id]).map(c=>i(`${f(Bm(c.label))} \xB7 ${c.ideal}`,`${e[c.id].cols} \xB7 ${e[c.id].gutter} \xB7 ${e[c.id].margin}`)).join("")}<hr>
|
|
337
|
+
<p class="dt-grid-foot">${t?"Saved for the project \u2014 everyone sees it.":"Set by the project\u2019s admins."}${l}</p>`;else{let c=Od();d=i(c.from==="guess"?"Guessed":"Read from the page",`${c.cols} \xD7 ${c.w}`)+i("Gap",String(c.gap))+i("Margin",String(c.x))}co.innerHTML=`<button type="button" class="dt-set-back" data-set="back">${Aa}<span>Grid</span></button><hr>`+(n.project?`<div class="dt-grid-from"><span>Columns from</span><div class="dt-seg" role="radiogroup" aria-label="Columns from">${["auto","custom"].map(c=>`<button type="button" role="radio" data-grid-mode="${c}" aria-checked="${c==="custom"==!!o}"${t?"":" disabled"}>${c==="auto"?"Auto":"Custom"}</button>`).join("")}</div></div><hr>`:"")+d},qd=async(t,e)=>{let s=zt,o=c=>{c&&!co.hidden&&uo("grid"),Tt.hidden||U(),We({projectGrid:zt})};zt=t(zt),o(e);let a=await ae("config").then(c=>c.ok?c.json():null).catch(()=>null),i=t(a?a.projectGrid??null:s),l=await ae("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({grid:i})}).catch(()=>null);if(l?.ok){zt=(await l.json()).grid??null;return}let d=l?await l.text():"";Ut(l?(()=>{try{return JSON.parse(d).error}catch{return d}})()||"The grid was not saved.":"The grid was not saved \u2014 no connection."),zt=s,o(!0)};if(co.addEventListener("click",t=>{let e=t.target.closest("[data-grid-mode]")?.dataset.gridMode;if(!e||!Xi()||e==="custom"==!!ne())return;let s=Lt(),o=e==="custom"?Od():null,a=document.documentElement.clientWidth,i=o&&{cols:ba("cols",o.cols),gutter:ba("gutter",o.gap),margin:ba("margin",o.x),max:Math.abs(a-2*o.x-o.w)<=2?null:ba("max",o.w)};qd(l=>({mode:e,widths:{...Yi,...l?.widths,...i?{[s]:i}:{}}}),!0)}),co.addEventListener("change",t=>{let e=t.target,s=e.dataset.gridK,o=ne();if(!s||!o||!Xi())return;let a=e.value.trim()===""?null:Number(e.value),[i,l]=po[s];if(a===null?s!=="max":!Number.isInteger(a)||a<i||a>l){Ut(`${s==="cols"?"Cols":s[0].toUpperCase()+s.slice(1)} is ${i}\u2013${l}${s==="max"?" or empty":""}.`),e.value=String(o[s]??"");return}if(a===o[s])return;let d=Lt();qd(c=>({mode:"custom",widths:{...Yi,...c?.widths,[d]:{...c?.widths?.[d]??o,[s]:a}}}),!1)}),vt.querySelector("button").addEventListener("click",()=>{F(),an.open=!0,uo("grid")}),uo("main"),de.signOut)for(let t of document.querySelectorAll('.dt-me [data-set="out"], .dt-me [data-set-out]'))t.hidden=!1;Im();function Im(){let t=document.querySelector(".dt-strip"),e=document.documentElement;if(x){t.hidden=!0;return}ee.toggle("dt-strip-on",!0);let s=t.querySelector(".dt-me");if(n.me){s.querySelector(".dt-me-face").innerHTML=Nn(n.me.avatar_url,n.me.name||n.me.email).replace(/^<(img|b) /,`<$1 style="--hue:${Ne(n.me.email.toLowerCase())}" `);let M=de.cabinet||n.cabinet;if(M){let V=s.querySelector(".dt-me-cab"),K=s.querySelector(".dt-me-acc");V.href=n.project?`${M}/p/${n.project}`:M,V.hidden=!1,K.href=`${M}/settings?tab=account`,K.hidden=!1}}s.addEventListener("click",M=>{let V=M.target.closest("[data-set], a");V&&(s.open=!1,V.dataset.set==="out"&&confirm("Sign out of Notemend on this site?")&&(mt.removeItem(Ts),de.signOut?.()))});let o=t.querySelector(".dt-pages"),a=o.querySelector(".dt-pages-find input"),i=o.querySelector(".dt-pages-hits"),l=o.querySelector(".dt-pages-foot");o.addEventListener("toggle",()=>{if(o.open){a.value="",d(),requestAnimationFrame(()=>a.focus());let M=o.querySelector(".dt-pages-copy");M&&(delete M.dataset.copied,M.dataset.tip="Copy link")}});let d=()=>{let M=a.value.trim().toLowerCase();if(Bt.hidden=!!M,i.hidden=!M,l.classList.toggle("is-off",!!M),!M)return;let V=n.pages.filter(K=>K.label.toLowerCase().includes(M)||K.route.toLowerCase().includes(M)).slice(0,12);i.innerHTML=V.length?`<ul>${V.map(K=>`<li><a href="${f(K.route)}"${K.route===St?' aria-current="page"':""}><span class="dt-menu-label">${f(K.label)}</span><em class="dt-pages-route">${f(K.route)}</em></a></li>`).join("")}</ul>`:`<p class="dt-pages-none">No page matches \u201C${f(a.value.trim())}\u201D</p>`};a.addEventListener("input",d),a.addEventListener("keydown",M=>{M.key==="Enter"&&(M.preventDefault(),i.querySelector("a")?.click()),M.key==="Escape"&&a.value&&(M.preventDefault(),M.stopPropagation(),a.value="",d())});let c=o.querySelector(".dt-pages-copy"),m=M=>{M.preventDefault(),M.stopPropagation(),M instanceof MouseEvent&&M.detail>0&&c.blur(),navigator.clipboard?.writeText(location.href.replace(/#.*$/,"")).catch(()=>null),c.dataset.copied="",c.dataset.tip="Link copied",clearTimeout(Number(c.dataset.t)),c.dataset.t=String(window.setTimeout(()=>{delete c.dataset.copied,c.dataset.tip="Copy link"},1600))};c.addEventListener("click",m),c.addEventListener("keydown",M=>{(M.key==="Enter"||M.key===" ")&&m(M)}),Un=()=>{gt(),os(yt),Et&&It()};let v=()=>{D("dt-folders-open",JSON.stringify([...se])),D("dt-folders-closed",JSON.stringify([...jt]))};if(Bt.addEventListener("click",M=>{let V=M.target,K=V.closest(".dt-folder-more");if(K)return M.preventDefault(),pe(K);let ut=V.closest(".dt-folder-row");if(!ut||ut.querySelector("input"))return;let lt=ut.parentElement,_=lt.dataset.folder,st=!lt.hasAttribute("data-open");st?(se.add(_),jt.delete(_)):(se.delete(_),jt.add(_)),v(),lt.toggleAttribute("data-open",st),ut.setAttribute("aria-expanded",String(st)),ut.children[1].outerHTML=dn(st),Ca(lt.querySelector(":scope > ul"),st)}),Bt.addEventListener("keydown",M=>{(M.key==="Enter"||M.key===" ")&&M.target.matches(".dt-folder-row")&&(M.preventDefault(),M.target.click())}),!Et)return;let A=new Set,j="",h=M=>{let V=M.closest("li[data-route]");if(V)return`p:${V.dataset.route}`;let K=M.closest(".dt-folder:not(.dt-folder--site)");return K&&M.closest(".dt-folder-row")?`f:${K.dataset.folder}`:""},G=()=>[...Bt.querySelectorAll("li[data-route], .dt-folder:not(.dt-folder--site)")].filter(M=>M.matches(".dt-folder")||M.offsetParent).map(M=>M.dataset.route?`p:${M.dataset.route}`:`f:${M.dataset.folder}`),z=l.querySelector(".dt-sel-hint");function It(){for(let V of Bt.querySelectorAll(".is-picked"))V.classList.remove("is-picked");for(let V of A)(V.startsWith("p:")?Bt.querySelector(`li[data-route="${CSS.escape(V.slice(2))}"] > a`):Bt.querySelector(`[data-folder="${CSS.escape(V.slice(2))}"] > .dt-folder-row`))?.classList.add("is-picked");let M=A.size;z.hidden=!M,z.innerHTML=M?`<b>${M} selected</b><button type="button" data-sel="group"><kbd>\u2318G</kbd> Group</button><button type="button" data-sel="ungroup"><kbd>\u2318\u21E7G</kbd> Ungroup</button>`:""}let Rt=()=>{A.size&&(A.clear(),j="",It())};Bt.addEventListener("click",M=>{let V=M,K=V.metaKey||V.ctrlKey,ut=V.shiftKey,lt=h(M.target);if(!lt||!K&&!ut){M.target.closest(".dt-folder-more")||Rt();return}if(M.preventDefault(),M.stopImmediatePropagation(),ut&&j){let _=G(),st=_.indexOf(j),it=_.indexOf(lt);if(st>=0&&it>=0)for(let te of _.slice(Math.min(st,it),Math.max(st,it)+1))A.add(te)}else A.has(lt)?A.delete(lt):A.add(lt);j=lt,It()},!0),o.addEventListener("toggle",()=>{o.open||Rt()});let le=()=>{let M=G().filter(st=>A.has(st)&&st.startsWith("p:")).map(st=>st.slice(2)),V=[...A].filter(st=>st.startsWith("f:")).map(st=>st.slice(2)).filter(st=>!Q.some(it=>A.has(`f:${it.id}`)&&kt(st,it.id)));if(!M.length&&!V.length)return;let K=new Set([...M.map(st=>Q.find(it=>it.pages.includes(st))?.id??""),...V.map(st=>Q.find(it=>it.id===st)?.parent??"")]),ut=K.size===1&&[...K][0]||null,lt=Math.random().toString(36).slice(2,10),_=[{id:lt,name:"Untitled folder",pages:M,...ut?{parent:ut}:{}},...Q.map(st=>({...st,pages:st.pages.filter(it=>!M.includes(it)),...V.includes(st.id)?{parent:lt}:{}}))];ut&&(se.add(ut),jt.delete(ut)),A.clear(),j="",se.add(lt),jt.delete(lt),v(),Ot(_),Ct(lt,!1)};z.addEventListener("click",M=>{let V=M.target.closest("[data-sel]")?.dataset.sel;V==="group"&&le(),V==="ungroup"&&bt()});let bt=()=>{let M=new Set([...A].filter(ut=>ut.startsWith("f:")).map(ut=>ut.slice(2)));for(let ut of A)if(ut.startsWith("p:")){let lt=Q.find(_=>_.pages.includes(ut.slice(2)));lt&&M.add(lt.id)}if(!M.size)return;let V=Q,K=Q.filter(ut=>M.has(ut.id));A.clear(),j="",Ot(Mt(Q,M)),Re(K.length===1?`Ungrouped \u201C${K[0].name}\u201D`:`Ungrouped ${K.length} folders`,()=>Ot(V))};document.addEventListener("keydown",M=>{if(!(!o.open||M.target?.closest?.("input:not(.dt-pages-find input), textarea"))){if(M.key==="Escape"&&A.size){M.preventDefault(),M.stopImmediatePropagation(),Rt();return}(M.metaKey||M.ctrlKey)&&M.code==="KeyG"&&A.size&&(M.preventDefault(),M.stopImmediatePropagation(),M.shiftKey?bt():le())}},!0),Bt.addEventListener("dblclick",M=>{let V=M.target.closest(".dt-folder:not(.dt-folder--site)");!V||M.target.closest(".dt-folder-more, input")||!M.target.closest(".dt-folder-row")||(M.preventDefault(),Ct(V.dataset.folder,!1))});let Ot=async M=>{let V=Q;Q=M,Le();let K=await ae("config",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({folders:M})}).catch(()=>null);if(K?.ok){let lt=(await K.json()).folders??[];JSON.stringify(lt)!==JSON.stringify(Q)&&(Q=lt,Le());return}let ut=K?await K.text():"";Ut(K?(()=>{try{return JSON.parse(ut).error}catch{return ut}})()||"The folders were not saved.":"The folders were not saved \u2014 no connection."),Q=V,Le()},Mt=(M,V)=>{let K=M.map(ut=>({...ut,pages:[...ut.pages]}));for(let ut of V){let lt=K.find(it=>it.id===ut);if(!lt)continue;let _=lt.parent&&K.some(it=>it.id===lt.parent&&it.id!==ut)?lt.parent:null;K=K.filter(it=>it.id!==ut).map(it=>it.parent===ut?{...it,parent:_}:it);let st=_?K.find(it=>it.id===_):null;if(st)for(let it of lt.pages)st.pages.includes(it)||st.pages.push(it)}return K.map(({parent:ut,...lt})=>ut?{...lt,parent:ut}:lt)},kt=(M,V)=>{let K=Q.find(ut=>ut.id===M);return!!K?.parent&&(K.parent===V||kt(K.parent,V))},Ct=(M,V)=>{let K=Bt.querySelector(`[data-folder="${CSS.escape(M)}"] .dt-folder-row .dt-menu-label`);if(!K)return;let ut=Q.find(it=>it.id===M),lt=document.createElement("input");lt.className="dt-folder-name",lt.value=ut.name,lt.maxLength=60,lt.setAttribute("aria-label","Folder name"),K.replaceWith(lt),lt.focus(),lt.select();let _=!1,st=it=>{if(_)return;_=!0;let te=lt.value.trim();if(it&&te)return void Ot(Q.map(ze=>ze.id===M?{...ze,name:te}:ze));V&&(Q=Q.filter(ze=>ze.id!==M)),Le()};lt.addEventListener("keydown",it=>{it.key==="Enter"&&(it.preventDefault(),st(!0)),it.key==="Escape"&&(it.preventDefault(),it.stopPropagation(),st(!1)),it.stopPropagation()}),lt.addEventListener("blur",()=>st(!0)),lt.addEventListener("click",it=>it.stopPropagation())};l.querySelector(".dt-folder-new").addEventListener("click",()=>{let M=Math.random().toString(36).slice(2,10);Q=[{id:M,name:"Untitled folder",pages:[]},...Q],se.add(M),v(),Le(),Ct(M,!0)});let _t=null,ke=()=>{_t?.remove(),_t=null};o.addEventListener("toggle",()=>{o.open||ke()});function pe(M){ke();let V=M.closest(".dt-folder").dataset.folder,K=Q.find(_=>_.id===V);_t=document.createElement("div"),_t.className="dt-folder-menu",_t.setAttribute("role","menu"),_t.innerHTML=`<button type="button" role="menuitem" data-do="rename">${Vn}<span>Rename</span></button><button type="button" role="menuitem" data-do="add">${xt('<path d="M10 4.5v11M4.5 10h11" />',13)}<span>Add pages\u2026</span></button><button type="button" role="menuitem" data-do="sub">${dn(!1)}<span>New folder inside</span></button>`+(K.pages.length||Q.some(_=>_.parent===K.id)?`<button type="button" role="menuitem" data-do="ungroup">${xt('<rect x="3" y="3" width="6" height="6" rx="1.5" /><rect x="11" y="11" width="6" height="6" rx="1.5" /><path d="M11 5.5h3.5V9M9 14.5H5.5V11" />',13)}<span>Ungroup</span></button>`:"")+`<button type="button" role="menuitem" data-do="delete" class="is-danger">${cs}<span>Delete folder</span></button>`,o.append(_t);let ut=M.getBoundingClientRect(),lt=o.getBoundingClientRect();_t.style.left=`${ut.right-lt.left+6}px`,_t.style.top=`${ut.top-lt.top-4}px`,_t.addEventListener("click",_=>{let st=_.target.closest("[data-do]")?.dataset.do;if(!st)return;if(ke(),st==="rename")return Ct(V,!1);if(st==="add")return tr(V,M);if(st==="sub"){let te=Math.random().toString(36).slice(2,10);return Q=[{id:te,name:"Untitled folder",pages:[],parent:V},...Q],se.add(V),se.add(te),jt.delete(V),v(),Le(),Ct(te,!0)}let it=Q;Ot(Mt(Q,new Set([V]))),Re(st==="delete"?`Deleted \u201C${K.name}\u201D`:`Ungrouped \u201C${K.name}\u201D`,()=>Ot(it))})}function tr(M,V){ke();let K=Q.find(st=>st.id===M),ut=n.pages.filter(st=>!K.pages.includes(st.route));_t=document.createElement("div"),_t.className="dt-folder-menu dt-folder-add",_t.setAttribute("role","menu"),_t.innerHTML=`<p class="dt-pages-group">Add to ${f(K.name)}</p>`+(ut.length?ut.map(st=>`<button type="button" role="menuitem" data-route="${f(st.route)}"><span>${f(st.label)}</span><em class="dt-pages-route">${f(st.route)}</em></button>`).join(""):'<p class="dt-pages-none">Every page is in it</p>'),o.append(_t);let lt=V.getBoundingClientRect(),_=o.getBoundingClientRect();_t.style.left=`${lt.right-_.left+6}px`,_t.style.top=`${lt.top-_.top-4}px`,_t.addEventListener("click",st=>{let it=st.target.closest("[data-route]");if(!it)return;let te=it.dataset.route;it.remove(),se.add(M),jt.delete(M),v(),Ot(Q.map(ze=>({...ze,pages:ze.id===M?[...ze.pages.filter(_n=>_n!==te),te]:ze.pages.filter(_n=>_n!==te)})))})}let kn="";Bt.addEventListener("dragstart",M=>{let V=M.target.closest("li[data-route], li.dt-folder");V&&(M.stopPropagation(),kn=V.dataset.route??`f:${V.dataset.folder}`,V.classList.add("is-dragging"),M.dataTransfer?.setData("text/plain",kn),M.dataTransfer&&(M.dataTransfer.effectAllowed="move"))});let rn=M=>M?.closest?.(".dt-folder:not(.dt-folder--site)")??null;Bt.addEventListener("dragover",M=>{if(!kn)return;M.preventDefault();let V=rn(M.target);for(let K of Bt.querySelectorAll(".is-drop"))K!==V&&K.classList.remove("is-drop");V?.classList.add("is-drop"),Bt.classList.toggle("is-drop-out",!V)}),Bt.addEventListener("dragend",()=>{kn="",Bt.classList.remove("is-drop-out");for(let M of Bt.querySelectorAll(".is-drop, .is-dragging"))M.classList.remove("is-drop","is-dragging")});let go=M=>requestAnimationFrame(()=>{let V=Bt.querySelector(M);V&&(Mo(V,"glow"),V.scrollIntoView({block:"nearest",behavior:Gn()?"smooth":"auto"}))});Bt.addEventListener("drop",M=>{M.preventDefault();let V=kn,K=rn(M.target)?.dataset.folder;if(!V)return;if(V.startsWith("f:")){let _=V.slice(2);if(K===_||K&&kt(K,_))return;let st=Q.map(it=>it.id===_?{...it,parent:K??null}:it).map(({parent:it,...te})=>it?{...te,parent:it}:te);K&&(se.add(K),jt.delete(K),v()),JSON.stringify(st)!==JSON.stringify(Q)&&(Ot(st),go(`[data-folder="${CSS.escape(_)}"] > .dt-folder-row`));return}let ut=Q.map(_=>({..._,pages:_.pages.filter(st=>st!==V)})),lt=K?ut.find(_=>_.id===K):null;lt&&(lt.pages.push(V),se.add(lt.id),v()),JSON.stringify(ut)!==JSON.stringify(Q)&&(Ot(ut),go(`li[data-route="${CSS.escape(V)}"] > a`))})}an.querySelector("summary").addEventListener("click",()=>Ui(!1));let Fn=fe.querySelector(".dt-vision"),Hs=Fn.querySelector(".dt-vision-sheet"),mo=[{id:"",name:"Normal",hint:"",css:"none"},{id:"grey",name:"Greyscale",hint:"only light and dark",css:"grayscale(1)"},{id:"low",name:"Low vision",hint:"slightly blurred",css:"blur(2.5px)"},{id:"deut",name:"Deuteranopia",hint:"red\u2013green, most common",css:"url(#dt-deut)",m:"0.367322 0.860646 -0.227968 0 0 0.280085 0.672501 0.047413 0 0 -0.011820 0.042940 0.968881 0 0 0 0 0 1 0"},{id:"prot",name:"Protanopia",hint:"red\u2013green",css:"url(#dt-prot)",m:"0.152286 1.052583 -0.204868 0 0 0.114503 0.786281 0.099216 0 0 -0.003882 -0.048116 1.051998 0 0 0 0 0 1 0"},{id:"trit",name:"Tritanopia",hint:"blue\u2013yellow",css:"url(#dt-trit)",m:"1.255528 -0.076749 -0.178779 0 0 -0.078411 0.930809 0.147602 0 0 0.004733 0.691367 0.303900 0 0 0 0 0 1 0"}];document.body.insertAdjacentHTML("beforeend",`<svg class="dt-vision-defs" width="0" height="0" aria-hidden="true">${mo.filter(t=>t.m).map(t=>`<filter id="dt-${t.id}" color-interpolation-filters="linearRGB"><feColorMatrix type="matrix" values="${t.m}"/></filter>`).join("")}</svg>`);let Dd=document.createElement("style");document.head.append(Dd);let Cs=document.createElement("div");Cs.className="dt-seeing",Cs.hidden=!0,fe.append(Cs);let Ns="",ya=t=>{Ns=t;let e=mo.find(s=>s.id===t)??mo[0];Dd.textContent=t?`body > :not(.devtools, [class^="dt-"], [class*=" dt-"]), .dt-frame iframe { filter: ${e.css} !important; }`:"",Fn.toggleAttribute("data-on",!!t),Cs.hidden=!t,Cs.innerHTML=t?`${xt('<path d="M2 10s3-5.5 8-5.5S18 10 18 10s-3 5.5-8 5.5S2 10 2 10z" /><circle cx="10" cy="10" r="2.5" />',13)}<span>Seeing as ${e.name}</span><kbd>Esc</kbd><button type="button" aria-label="See the page as it is">${xt('<path d="M5 5l10 10M15 5 5 15" />',12)}</button>`:""};Cs.addEventListener("click",t=>{t.target.closest("button")&&ya("")}),document.addEventListener("keydown",t=>{t.key!=="Escape"||!Ns||t.defaultPrevented||tc(t.target)||(ya(""),t.preventDefault())});let va=null,Ji=0,Zi=0,Fd=()=>{let t=Math.round((Date.now()-Ji)/1e3);return t<60?`${t} s ago`:`${Math.round(t/60)} min ago`},jd=t=>{if(t==="none"){Hs.className="dt-sheet dt-vision-sheet dt-vision-list",Hs.innerHTML='<p class="dt-vision-title">See the page as</p>'+mo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Ns}"><span>${s.name}</span>${s.id===Ns?xt('<path d="M4.5 10.5 8 14l7.5-8" />',12):`<em>${s.hint}</em>`}</button>`).join("");return}let e=230/innerWidth;Hs.className="dt-sheet dt-vision-sheet",Hs.innerHTML=`<div class="dt-vision-head"><b>This view, six ways</b><span class="dt-vision-ago">${t==="taking"?"taking a snapshot\u2026":`snapshot \xB7 ${Fd()}`}</span><span class="dt-vision-grow"></span><span>Click one to see the page that way</span><button type="button" class="dt-icon dt-vision-again" data-tip="Take a new snapshot" aria-label="Take a new snapshot">${xt('<path d="M3.5 10a6.5 6.5 0 1 0 2-4.7M3.5 3.5v3.6h3.6" />')}</button></div><div class="dt-vision-grid">${mo.map(s=>`<button type="button" data-vision="${s.id}" aria-pressed="${s.id===Ns}"><span class="dt-vision-thumb">${va&&t==="ready"?`<img src="${va}" alt="" style="filter:${s.id==="low"?`blur(${(2.5*e*2).toFixed(2)}px)`:s.css}">`:""}</span><span>${s.name}</span></button>`).join("")}</div>`},Qi=async()=>{let t=++Zi;jd("taking");let e=[document.body,document.documentElement].map(o=>getComputedStyle(o).backgroundColor).find(o=>o&&o!=="transparent"&&!/rgba\(.*,\s*0\)$/.test(o))??"#fff",s=null;try{let{domToWebp:o}=await import("modern-screenshot");s=await Promise.race([o(document.body,{width:innerWidth,height:innerHeight,scale:460/innerWidth,quality:.75,timeout:4e3,backgroundColor:e,style:{transform:`translate(${-scrollX}px, ${-scrollY}px)`},filter:a=>!(a instanceof Element&&a.closest(`${fs}, .dt-pad-overlay, .dt-grid-overlay, .dt-vision-defs, .dt-toast`))}),new Promise(a=>setTimeout(()=>a(null),4e3))])}catch{s=null}t!==Zi||!Fn.open||(va=s,Ji=Date.now(),jd(s?"ready":"none"))},_d=0,Wd=0,zd=()=>{clearTimeout(Wd),Wd=window.setTimeout(Qi,400)};Fn.addEventListener("toggle",()=>{if(clearInterval(_d),removeEventListener("scroll",zd,!0),!Fn.open){Zi++;return}Qi(),addEventListener("scroll",zd,!0),_d=window.setInterval(()=>{let t=Hs.querySelector(".dt-vision-ago");t&&va&&Ji&&(t.textContent=`snapshot \xB7 ${Fd()}`)},1e3)}),Hs.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-vision-again"))return void Qi();let s=e.closest("[data-vision]");s&&(ya(s.dataset.vision??""),Fn.open=!1)});let ho=fe.querySelector(".dt-custom"),wa=ho.querySelector(".dt-custom-sheet"),Vd="dt-hidden-tools",Gd="dt-new-seen",Kd=["contrast","vision"],Ud=()=>{let t=(o,a,i)=>{let l=fe.querySelector(a);return l?{id:o,el:l,name:i}:null},e=[t("grid",".dt-grid-btn","Grid"),t("pads",".dt-pad-btn","Spacing"),t("sizes",".dt-size-btn","Size"),t("type",".dt-type-btn","Typography"),t("color",".dt-color-btn","Color"),t("border",".dt-border-btn","Border"),t("contrast",".dt-contrast-btn","Contrast"),t("vision",".dt-vision","Vision")],s=[...Yt.map(o=>({id:`bp:${o.dataset.bp}`,el:o,name:(o.getAttribute("aria-label")??o.dataset.bp??"").replace(/^mobile\s+(\w)/i,(a,i)=>i.toUpperCase())})),{id:"devices",el:Xn,name:"Device menu"}];return[...n.client?[]:[{group:"Inspect",tools:e.filter(o=>!!o)}],{group:"Devices",tools:s}]},Yd=t=>(mt.getItem(t)??"").split(",").filter(Boolean),jn=new Set(Yd(Vd)),Xd=()=>{for(let{tools:e}of Ud())for(let s of e)s.el.toggleAttribute("data-off",jn.has(s.id));Object.entries(ct).find(([,e])=>e.hasAttribute("data-off")&&e.getAttribute("aria-pressed")==="true")&&Y("")},Om=t=>(t.matches("details")?t.querySelector("summary svg"):t.querySelector("svg"))?.outerHTML??"",Jd=()=>{let t=Yd(Gd);wa.innerHTML=Ud().map(({group:e,tools:s})=>{let o=s.filter(a=>!jn.has(a.id)).length;return`<p class="dt-custom-label"><b>${e}</b><span>${o} of ${s.length}</span></p><div class="dt-custom-well">${s.map(a=>`<button type="button" class="dt-custom-tile" data-tool="${f(a.id)}" aria-pressed="${!jn.has(a.id)}">${Om(a.el)}<span>${f(a.name)}</span>${Kd.includes(a.id)&&!t.includes(a.id)?'<i class="dt-custom-new">New</i>':""}</button>`).join("")}</div>`}).join("")+`<div class="dt-custom-foot"><button type="button" class="dt-custom-all"${jn.size?"":" disabled"}>Show all</button><span></span><button type="button" class="dt-custom-done">Done</button></div>`};wa.addEventListener("click",t=>{let e=t.target;if(e.closest(".dt-custom-done")){ho.open=!1;return}e.closest(".dt-custom-all")&&jn.clear();let s=e.closest("[data-tool]");if(s){let o=s.dataset.tool;jn.delete(o)||jn.add(o)}!s&&!e.closest(".dt-custom-all")||(D(Vd,[...jn].join(",")),Xd(),Jd(),wa.querySelector(s?`[data-tool="${s.dataset.tool}"]`:".dt-custom-done")?.focus())}),ho.addEventListener("toggle",()=>{ho.open?(Jd(),wa.querySelector(".dt-custom-tile")?.focus()):D(Gd,Kd.join(","))}),Xd(),an.addEventListener("click",t=>{let e=t.target.closest("[data-set]");if(!e)return;let s=e.dataset.set;if(s==="keys"||s==="back")return Ui(s==="keys");if(s==="grid")return uo("grid");an.open=!1,s==="custom"&&(ho.open=!0),s==="hide"&&As.click()});let tn=t=>()=>fe.querySelector(t)?.click(),Zd=t=>()=>{let e=[...document.querySelectorAll(".dt-pages a")];e[e.findIndex(s=>s.hasAttribute("aria-current"))+t]?.click()},$a=[{group:"Threads",code:"KeyC",hint:"C",label:"Comment mode",el:".dt-notes-btn",run:tn(".dt-notes-btn")},{group:"Threads",code:"KeyC",shift:!0,hint:"\u21E7C",label:"Threads panel",el:".dt-history-btn",run:tn(".dt-history-btn")},{group:"Threads",code:"KeyR",hint:"R",label:"Show resolved",el:".dt-resolved-btn",run:tn(".dt-resolved-btn")},{group:"Threads",code:"KeyA",hint:"A",label:"Show archived",run:()=>Ei(!un)},{group:"Threads",code:"Slash",hint:"/",label:"Search pages",run:()=>{let t=document.querySelector(".dt-strip"),e=t?.querySelector(".dt-pages");if(t&&!t.hidden&&e){F(),e.open=!0;return}document.querySelector(".dt-history")?.hasAttribute("hidden")&&tn(".dt-history-btn")(),rt.hasAttribute("data-collapsed")&&ra(!1),document.querySelector(".dt-hist-search input")?.focus()}},{group:"Threads",code:"KeyM",hint:"M",label:"Team / client",run:()=>He?void xd():ks(Fe==="clients"?"studio":"clients")},{group:"Threads",code:"KeyF",hint:"F",label:"Show pins",run:()=>{Ls.hidden||Qs(on.hidden,!0)}},{group:"Inspect",code:"KeyG",hint:"G",label:"Grid",el:".dt-grid-btn",run:tn(".dt-grid-btn")},{group:"Inspect",code:"KeyP",hint:"P",label:"Spacing",el:".dt-pad-btn",run:tn(".dt-pad-btn")},{group:"Inspect",code:"KeyS",hint:"S",label:"Size",el:".dt-size-btn",run:tn(".dt-size-btn")},{group:"Inspect",code:"KeyT",hint:"T",label:"Typography",el:".dt-type-btn",run:tn(".dt-type-btn")},{group:"Inspect",code:"KeyO",hint:"O",label:"Color",el:".dt-color-btn",run:tn(".dt-color-btn")},{group:"Inspect",code:"KeyK",hint:"K",label:"Contrast",el:".dt-contrast-btn",run:tn(".dt-contrast-btn")},{group:"Inspect",code:"KeyV",hint:"V",label:"Vision",el:".dt-vision summary",run:()=>{Fn.open=!Fn.open}},{group:"Inspect",code:"KeyB",hint:"B",label:"Border & radius",el:".dt-border-btn",run:tn(".dt-border-btn")},...n.sanity?[{group:"Inspect",code:"KeyE",hint:"E",label:"Sanity overlay",el:".dt-studio-btn",run:tn(".dt-studio-btn")}]:[],...Yt.slice(0,9).map((t,e)=>({group:"Breakpoints",code:`Digit${e+1}`,hint:String(e+1),label:t.dataset.tip??t.title,el:`.dt-bp[data-bp="${t.dataset.bp}"]`,run:()=>t.click()})),{group:"View",code:"KeyD",hint:"D",label:"Devices",run:()=>{Xn.open=!Xn.open}},{group:"View",code:"BracketLeft",hint:"[",label:"Previous page",run:Zd(-1)},{group:"View",code:"BracketRight",hint:"]",label:"Next page",run:Zd(1)},{group:"View",code:"Backslash",hint:"\\",label:"Hide the bar",run:()=>As.click()},{group:"View",code:"Slash",shift:!0,hint:"?",label:"Keyboard shortcuts",run:()=>{let t=an.open&&!Pd.hidden;an.open=!t,Ui(!t)}}].filter(t=>!n.client||t.group!=="Inspect"),Qd=(t,e)=>$a.find(s=>s.code===t&&!s.shift==!e&&!(s.el&&fe.querySelector(s.el)?.closest("[data-off]"))&&!(s.code==="KeyD"&&Xn.hasAttribute("data-off"))),tc=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||!!t.closest('[role="menu"], [role="listbox"], [role="dialog"][aria-modal="true"], [role="combobox"]'));if(n.shortcuts){for(let o of $a){let a=o.el&&fe.querySelector(o.el);a&&(a.dataset.tip=`${a.dataset.tip??o.label} \xB7 ${o.hint}`,a.setAttribute("aria-keyshortcuts",o.hint.startsWith("\u21E7")?`Shift+${o.hint.slice(1)}`:o.hint))}let t=(o,a)=>`<div class="dt-key-row"><span>${f(o)}</span><kbd>${f(a)}</kbd></div>`,e=(o,a)=>`<div class="dt-keys-col"><p class="dt-keys-group">${o}</p>${a}</div>`,s=[...new Set($a.map(o=>o.group))].map(o=>e(o,$a.filter(a=>a.group===o).map(a=>t(a.label,a.hint)).join("")));if(s.push(e("In a comment",t("Send","Enter")+t("New line","\u21E7Enter")+t("Close, cancel, back out","Esc"))),an.querySelector(".dt-keys-list").innerHTML=`<div class="dt-keys-half">${s.slice(0,2).join("")}</div><div class="dt-keys-half">${s.slice(2).join("")}</div>`,document.addEventListener("keydown",o=>{if(o.repeat||o.isComposing||o.metaKey||o.ctrlKey||o.altKey||o.defaultPrevented||tc(o.composedPath()[0]??o.target))return;let a=Qd(o.code,o.shiftKey);a&&setTimeout(()=>{o.defaultPrevented||(x?parent.postMessage({dt:!0,key:[o.code,o.shiftKey]},location.origin):a.run())})}),x){let o=()=>parent.postMessage({dt:!0,closeMenus:!0},location.origin);document.addEventListener("pointerdown",o,!0),document.addEventListener("keydown",a=>{a.key==="Escape"&&o()})}}if(!x){Bd(mt.getItem("dt-collapsed")==="1"),requestAnimationFrame(()=>requestAnimationFrame(()=>fe.setAttribute("data-ready",""))),Td.restore(),I(mt.getItem(Ft)==="1");let t=mt.getItem($t);t&&t in ct&&Y(t),Qe(mt.getItem(Hr)==="1"&&St!=="/connect")}let ec=()=>{try{let t=JSON.parse(mt.getItem(vn)||"null");De=(t?.parked??[]).filter(s=>Ds(s));let e=s=>{try{return!!document.querySelector(s)}catch{return!1}};if(t?.draft&&e(t.draft.selector)?(N=t.draft,!Kt&&!x&&Qe(!0)):Ds(t?.draft)&&De.push(t.draft),t?.reply?.text&&(Ae=t.reply.text,cn=X=t.reply.for??null),X==null)try{X=Number(sessionStorage.getItem(`nm-open:${vn}`))||null,sessionStorage.removeItem(`nm-open:${vn}`)}catch{}(N||De.length||Ae)&&Z()}catch{mt.removeItem(vn)}};ec();let nc=()=>setTimeout(()=>{let t=O(location.pathname);t!==St&&(clearTimeout(Ro),js(),St=t,x&&parent.postMessage({dt:!0,route:t},location.origin),vn=Rr(),N=null,De=[],Ae="",cn=null,X=null,Qt=null,B=[],Kt&&!x&&Qe(!1),gt(),ec(),Ri(),as())});for(let t of["pushState","replaceState"]){let e=window.history[t];window.history[t]=function(...s){e.apply(this,s),nc()}}addEventListener("popstate",nc);try{let t=JSON.parse(mt.getItem(Ts)||"null");t?.project===od&&t.body?(Ci=t.body.version??"",Ni(t.body),no=""):t&&mt.removeItem(Ts)}catch{mt.removeItem(Ts)}r.then(async t=>{t.status===200&&Ni(await t.json(),!u)},()=>{}).then(()=>!u&&(Ue||un)?as(!0):void 0).then(la.resume),document.addEventListener("visibilitychange",()=>{document.hidden||is()}),addEventListener("focus",is),addEventListener("notemend:changed",()=>{x||is()});let xa=!1,ls=null,sc=()=>{if(!(x||de.via||!("EventSource"in window))){if(document.hidden){ls?.close(),ls=null,xa=!1;return}ls||(ls=new EventSource("/__devbar/events"),ls.onopen=()=>{xa=!0},ls.onerror=()=>{xa=!1},ls.onmessage=t=>{t.data!==no&&is()})}};sc(),document.addEventListener("visibilitychange",sc);let qm=0;x||setInterval(()=>{(!(de.live||xa)||++qm%6===0)&&is()},2e4),setInterval(()=>{!document.hidden&&B.some(t=>ln(t))&&Z()},3e4),x&&parent.postMessage({dt:!0,hello:!0},location.origin)}function fu(n){if(!("showPopover"in HTMLElement.prototype)||typeof HTMLDialogElement>"u")return;let r=HTMLDialogElement.prototype,u=r.showModal,p=null,g=null,b=()=>{if(p){g?.disconnect(),g=null;for(let y of n)document.body.append(y);try{p.hidePopover()}catch{}p.remove(),p=null}},E=()=>{b();let y=document.querySelector("dialog:modal");y&&H(y)},H=y=>{b(),p=document.createElement("div"),p.className="dt-host",p.setAttribute("popover","manual"),p.append(...n),y.append(p);try{p.showPopover()}catch{}y.addEventListener("close",E,{once:!0}),g=new MutationObserver(()=>{y.isConnected||E()}),g.observe(document.documentElement,{childList:!0,subtree:!0})};r.showModal=function(){u.call(this),this.isConnected&&H(this)}}function Lr(n,r,u,p=""){let g=document.createElement("div");g.className="nm-ask",g.setAttribute("style",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:2147483000","display:flex","align-items:center","gap:10px","padding:6px 6px 6px 12px","background:#0e0d0c","color:#f2efec","border:1px solid rgba(255,255,255,.09)","border-radius:999px","box-shadow:0 10px 34px rgba(0,0,0,.5)","font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif"].join(";"));let b=document.createElement(n?"a":"span");b instanceof HTMLAnchorElement&&n&&(b.href=n,b.target=u,p&&(b.rel=p)),b.className="nm-ask-go",b.textContent=r;let E=document.createElement("style");return E.textContent=`.nm-ask{transition:border-color 120ms cubic-bezier(.22,1,.36,1)}
|
|
338
|
+
.nm-ask:has(a.nm-ask-go:hover){border-color:rgba(255,255,255,.14)!important}
|
|
339
|
+
.nm-ask-go{transition:background-color 120ms cubic-bezier(.22,1,.36,1),transform 120ms cubic-bezier(.22,1,.36,1)}
|
|
340
|
+
a.nm-ask-go:hover{background:#ff7a33!important}
|
|
341
|
+
a.nm-ask-go:active{background:#d94d00!important;transform:translateY(1px)}
|
|
342
|
+
.nm-ask-go:focus-visible{outline:2px solid #ff6a1a;outline-offset:2px}
|
|
343
|
+
@media (prefers-reduced-motion:reduce){.nm-ask,.nm-ask-go{transition:none}}`,b.setAttribute("style",`display:inline-flex;align-items:center;height:28px;padding:0 12px;border-radius:999px;background:${n?"#ff6a1a;color:#1a0800":"rgba(255,255,255,.08);color:#f2efec"};font:500 11px/1 Inter,ui-sans-serif,system-ui,sans-serif;letter-spacing:-.01em;text-decoration:none;cursor:${n?"pointer":"default"}`),g.innerHTML='<svg role="img" aria-label="Notemend" width="16" height="16" viewBox="0 4 100 100" style="display:block;flex:none"><path fill="currentColor" fill-rule="evenodd" d="M72 4C87.464 4 100 16.536 100 32V76C100 91.464 87.464 104 72 104H28C12.536 104 6.44299e-08 91.464 0 76V32C0 16.536 12.536 4 28 4H72ZM50 18C30.1177 18 14 34.1177 14 54C14 73.8822 30.1177 90 50 90C69.8822 90 86 73.8822 86 54C86 34.1177 69.8822 18 50 18Z"/><circle fill="currentColor" cx="50" cy="54" r="14"/></svg>',g.append(E,b),document.body.append(g),{pill:g,link:b}}function bu(n){let r=window;if(r.__notemend)return;r.__notemend=!0,Vc(g=>g.includes("/__devbar/")||!!de.base&&g.startsWith(de.base)),ee.ready=new Promise(g=>{if(!("__next_f"in self))return g();let b=0,E=()=>Object.keys(document.documentElement).some(H=>H.startsWith("__reactFiber$"))||++b>330?g():setTimeout(E,30);E()}),ee.toggle("dt-in-frame",Bs),ee.toggle("dt-strip-on",!Bs);let u=lc(),p=ae(u);Pc().then(async g=>{await n,ee.set("--dt-z",String(g.zIndex));let b=g.client?g.brand?.color:null;if(b&&/^#[0-9a-f]{6}$/i.test(b)){let[T,x,D]=[1,3,5].map(dt=>parseInt(b.slice(dt,dt+2),16)/255);ee.set("--dt-accent",b),ee.set("--dt-accent-ink",.2126*T+.7152*x+.0722*D>.55?"#000000":"#ffffff")}Dc(g);let E="",H=()=>{let T=document.body.currentCSSZoom??1,x=T>0&&Math.abs(T-1)>.001?String(1/T):"1";x!==E&&(E=x,ee.set("--dt-unzoom",x))};H();let y=new MutationObserver(H);for(let T of[document.documentElement,document.body])y.observe(T,{attributes:!0,attributeFilter:["style","class"]});addEventListener("resize",H),gu(g,p,u==="comments"),su(),fu([".dt-grid-overlay",".dt-pad-overlay",".dt-notes-overlay",".dt-notes-hi",".dt-history",".devtools",".dt-tab",".dt-strip",".dt-strip-tab",".dt-tipbox"].map(T=>document.querySelector(T)).filter(T=>!!T))}).catch(g=>{console.warn("[notemend] not started:",g),ee.toggle("dt-strip-on",!1);let b=window.__notemendHosted;de.via&&String(g).includes("config 403")&&b?.ask&&(de.refused=!0,b.ask("You\u2019re not in this project \u2014 sign in as someone else")),!de.via&&String(g).includes("config 401")&&xh(String(g.said??""))})}function xh(n){if(/link/i.test(n)&&!/sign in/i.test(n)){Lr(null,"Link this site to comment: npx notemend link <project-id>","");return}let{link:r}=Lr("/__devbar/signin","Sign in to comment","notemend-signin"),u=0;r.addEventListener("click",()=>{clearInterval(u),u=window.setInterval(async()=>{let p=await fetch("/__devbar/signin?code=1").then(g=>g.json()).catch(()=>null);if(p?.done){clearInterval(u),location.reload();return}p?.code&&(r.textContent=`Allow code ${p.code} in the cabinet tab`)},1500)})}var yu=window,hs=class extends Error{},vu=n=>new Set([...n.querySelectorAll("script")].filter(r=>!r.src.includes("/@vite/client")).map(r=>r.src?`src:${r.getAttribute("src").replace(/[?&]t=\d+/,"")}`:`inline:${r.textContent}`)),wu=(n,r)=>{let u=vu(n);return[...vu(r)].some(p=>!u.has(p))};function Eh(n,r){let u=[],p=n.firstChild;for(let g of r){let b=p;for(;b&&!(b.nodeName===g.nodeName&&(!(g instanceof Element)||!g.id||b.id===g.id));)b=b.nextSibling;u.push(b),b&&(p=b.nextSibling)}return u}function Mh(n,r,u){for(let{name:p,value:g}of u.attributes){let b=r.getAttribute(p);if(b!==g)if(p==="class"&&b!=null){let E=new Set(b.split(/\s+/)),H=new Set(g.split(/\s+/));for(let y of E)y&&!H.has(y)&&n.classList.remove(y);for(let y of H)y&&!E.has(y)&&n.classList.add(y)}else n.setAttribute(p,g)}for(let{name:p}of r.attributes)u.hasAttribute(p)||n.removeAttribute(p)}function $u(n,r,u){if(r.isEqualNode(u))return;if(r.nodeType!==Node.ELEMENT_NODE||u.nodeType!==Node.ELEMENT_NODE||r.nodeName!==u.nodeName||u.nodeName==="ASTRO-ISLAND"){if(r.nodeType===Node.TEXT_NODE&&u.nodeType===Node.TEXT_NODE){n.nodeValue=u.nodeValue;return}n.parentNode.replaceChild(document.importNode(u,!0),n);return}Mh(n,r,u);let p=[...r.childNodes],g=[...u.childNodes],b=Eh(n,p),E=0,H=0;for(;E<p.length&&E<g.length&&p[E].isEqualNode(g[E]);)E++;for(;H<p.length-E&&H<g.length-E&&p[p.length-1-H].isEqualNode(g[g.length-1-H]);)H++;let y=p.slice(E,p.length-H),T=g.slice(E,g.length-H);if(y.length===T.length&&y.every((J,tt)=>J.nodeName===T[tt].nodeName)){y.forEach((J,tt)=>{let O=b[E+tt];if(!O)throw new hs;$u(O,J,T[tt])});return}let x=H?b[p.length-H]:null,D=E?b[E-1]:null;if(H&&!x||E&&!D)throw new hs;for(let J of b.slice(E,p.length-H))J?.parentNode?.removeChild(J);let dt=x??(D?D.nextSibling:n.firstChild);for(let J of T)n.insertBefore(document.importNode(J,!0),dt)}function kh(n){for(let r of n.head.querySelectorAll("style, link[rel=stylesheet]")){let u=r.getAttribute("data-vite-dev-id"),p=r.getAttribute("href"),g=[...document.head.querySelectorAll("style, link[rel=stylesheet]")].find(b=>u?b.getAttribute("data-vite-dev-id")===u:p?b.getAttribute("href")===p:b.textContent===r.textContent);g?u&&r.tagName==="STYLE"&&g.textContent!==r.textContent&&(g.textContent=r.textContent):document.head.append(document.importNode(r,!0))}n.title&&n.title!==document.title&&(document.title=n.title)}var To=null,Sr=!1;function Tr(){return To?(Sr=!0,To):(To=(async()=>{try{let n=yu.__notemendPage,r=await fetch(location.href,{cache:"no-store",headers:{accept:"text/html"}});if(!n||!r.ok||!(r.headers.get("content-type")??"").includes("html"))throw new hs;let u=new DOMParser().parseFromString(await r.text(),"text/html");if(wu(n,u.body)||wu(document.head,u.head))throw new hs;kh(u),$u(document.body,n,u.body),yu.__notemendPage=u.body,document.querySelector('meta[name="astro-view-transitions-enabled"]')&&(document.dispatchEvent(new Event("astro:after-swap")),document.dispatchEvent(new Event("astro:page-load")))}catch(n){n instanceof hs||console.warn("[notemend] refresh in place failed, reloading:",n),location.reload()}finally{To=null,Sr&&(Sr=!1,Tr())}})(),To)}bu();import.meta.hot&&import.meta.hot.accept(()=>location.reload());import.meta.hot?.on&&import.meta.hot.on("notemend:refresh",()=>{import.meta.hot?.send?.("notemend:refreshed"),Tr()});
|