@staff0rd/assist 0.954.0 → 0.954.2

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.
@@ -173,6 +173,9 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
173
173
  padding: 3px 12px 3px 8px;
174
174
  margin-left: 0;
175
175
  }
176
+ .assist-send--before-date {
177
+ margin-right: 8px;
178
+ }
176
179
  .assist-send:hover:not(:disabled) {
177
180
  background: var(--button-default-bgColor-hover, #eff2f5);
178
181
  border-color: var(--fgColor-muted, #59636e);
@@ -199,7 +202,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
199
202
  transition: none;
200
203
  }
201
204
  }
202
- `;function $1(){if(document.head.querySelector(`[${F1}]`))return;let e=document.createElement("style");e.setAttribute(F1,""),e.textContent=MB,document.head.append(e)}function q1(e){let t={type:"assist-send",...e};return Bf(t)}var CO=S(bO(),1);var o4=["keydown","keyup","keypress"];function TO(e){for(let t of o4)e.addEventListener(t,o=>o.stopPropagation())}var il=S(U(),1);function r4(e){let t=e.getAttribute("data-color-mode");return t==="light"||t==="dark"?t:globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function Sc(e){let t=r4(e),o=e.getAttribute(t==="dark"?"data-dark-theme":"data-light-theme");return o?o.startsWith("dark")?"dark":"light":t}var n4=["data-color-mode","data-light-theme","data-dark-theme"];function vO(e,t){let o=Sc(e),r=()=>{let i=Sc(e);i!==o&&(o=i,t(i))},n=new MutationObserver(r);n.observe(e,{attributeFilter:n4});let a=globalThis.matchMedia?.("(prefers-color-scheme: dark)");return a?.addEventListener?.("change",r),()=>{n.disconnect(),a?.removeEventListener?.("change",r)}}var SO=S(z(),1);function xO({children:e}){let[t,o]=(0,il.useState)(()=>Sc(document.documentElement));(0,il.useEffect)(()=>vO(document.documentElement,o),[]);let r=(0,il.useMemo)(()=>hr({palette:{mode:t},typography:{fontFamily:"inherit"}}),[t]);return(0,SO.jsx)(Bp,{theme:r,children:e})}var gT=S(z(),1);function cm(e,t,o){let r=e.shadowRoot??e.attachShadow({mode:"open"});TO(e);let n=document.createElement("div"),a=document.createElement("div");a.style.cssText="width:100%;font:inherit;color:inherit",r.append(n,a);let i=Lc({key:t,container:n}),s=(0,CO.createRoot)(a);return s.render((0,gT.jsx)(Gm,{value:i,children:(0,gT.jsx)(xO,{children:o})})),s}function EO(e,t){let o=t.closest('dialog, [role="dialog"]'),r=o?i4:a4,n=()=>{e.style.cssText=r(t)};return n(),o?(e.setAttribute("popover","manual"),o.append(e),e.showPopover?.()):document.body.append(e),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}function a4(e){let{top:t,left:o}=PO(e);return["position: absolute",`top: ${t+window.scrollY}px`,`left: ${o+window.scrollX}px`,"width: 320px","z-index: 2147483646"].join(";")}function i4(e){let{top:t,left:o}=PO(e);return["position: fixed","inset: auto",`top: ${t}px`,`left: ${o}px`,"width: 320px","height: auto","margin: 0","padding: 0","border: 0","background: transparent","overflow: visible"].join(";")}function PO(e){let t=e.getBoundingClientRect(),o=Math.max(16,Math.min(t.left,window.innerWidth-320-16));return{top:t.bottom+4,left:o}}var Cc=null;function s4(){Cc?.close()}function RO(e,t){let o=Cc?.anchor;if(s4(),o===e)return;let r=document.createElement("div");r.setAttribute("data-assist-popover","");let n=EO(r,e),a=()=>{Cc?.close===a&&(Cc=null,n(),r.remove(),queueMicrotask(()=>i.unmount()))};Cc={anchor:e,close:a};let i=cm(r,"assist-popover",t(s=>{a(),s&&e.focus()}))}var l4="icons/assist-32.png";function OO(){let e=si()?.getURL?.(l4);if(!e)return;let t=document.createElement("img");return t.src=e,t.alt="",t}function AO(e){try{return decodeURIComponent(e)}catch{return e}}var u4=/^\/([^/]+)\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i,c4=/^(?:\/DefaultCollection)?\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i,p4=/^([^.]+)\.visualstudio\.com$/;function f4(e,t){if(e==="dev.azure.com"){let n=u4.exec(t);return n&&{path:n[0],parts:n.slice(1)}}let o=p4.exec(e)?.[1],r=o?c4.exec(t):null;return r&&o?{path:r[0],parts:[o,...r.slice(1)]}:null}function Ec(e){let t;try{t=new URL(e)}catch{return}if(t.protocol!=="https:")return;let o=f4(t.hostname.toLowerCase(),t.pathname);if(!o)return;let[r,n,a,i]=o.parts.map(AO);return{org:r,project:n,repo:a,id:i,url:`${t.origin}${o.path}`}}var d4=/^\/[^/]+\/[^/]+\/pull\/(\d+)(?:\/|$)/;function MO(e){let t;try{t=new URL(e)}catch{return}return d4.exec(t.pathname)?.[1]}function wO(e,t){if(typeof t!="function")return"link";if(e!=="header")return"instructions";let o=t();return Ec(o)?"azure-devops-review":MO(o)?"review":"instructions"}var NO="assist";async function m4(e){return typeof e=="function"?e():e.link()}function Jn(e,t,o="comment"){$1();let r=document.createElement("button");r.type="button",r.setAttribute("data-assist-send",""),r.className=o==="header"?"assist-send assist-send--header":"assist-send",r.title=t;let n=document.createElement("span");n.textContent=NO;let a=OO();a&&r.append(a),r.append(n);let i=async s=>{r.disabled=!0,n.textContent="sending\u2026";let l=await m4(e).then(u=>q1({url:u,...s}),u=>({ok:!1,message:u instanceof Error?u.message:String(u)}));zf(l.message,l.ok),r.disabled=!1,n.textContent=NO};return r.addEventListener("mousedown",s=>s.preventDefault()),r.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),RO(r,l=>V1(wO(o,e),{send:i,dismiss:l}))}),r}function DO(e){return`https://mail.google.com/mail/u/0/#search/rfc822msgid%3A${encodeURIComponent(e)}`}var y4={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&#39;":"'"},h4=/(?:^|>)Message-ID:[ \t]*(?:\r?\n[ \t]+)?(?:<|&lt;)([^\s<>]+?)(?:>|&gt;)/im;function _O(e){let t=h4.exec(e);return t?`<${t[1].replace(/&(?:lt|gt|amp|quot|#39);/g,r=>y4[r])}>`:void 0}var g4=/GLOBALS=\[(?:[^,]*,){9}"([0-9a-f]+)"/,b4=/^\/mail\/u\/\d+[/]/;function T4(){return globalThis.content?.fetch??fetch}function v4(){for(let e of document.querySelectorAll("script")){let t=g4.exec(e.textContent??"")?.[1];if(t)return t}}function x4(e){let t=b4.exec(location.pathname)?.[0]??"/mail/u/0/",o=`${location.origin}${t}`,r=e.dataset.messageId?.replace(/^#/,""),n=e.dataset.legacyMessageId,a=v4();return[r&&`${o}?${a?`ik=${a}&`:""}view=om&permmsgid=${encodeURIComponent(r)}`,n&&`${o}?view=att&th=${n}&attid=0&disp=comp&safe=1&zw`].filter(i=>!!i)}async function BO(e){for(let t of x4(e)){let o=await T4()(t,{credentials:"include"}).catch(()=>{});if(!o?.ok)continue;let r=_O(await o.text());if(r)return r}throw new Error("Couldn't resolve this message's Message-ID")}var S4="div.adn[data-message-id]",C4="span.g3";function zO(){for(let e of document.querySelectorAll(S4)){let t=e.querySelector(C4);!t||e.querySelector("[data-assist-send]")||t.before(Jn({link:async()=>DO(await BO(e))},"Start an assist session from this email"))}}var E4=['a[href*="#discussion_r"]','a[href*="#issuecomment-"]','a[href*="#pullrequestreview-"]'].join(",");function P4(e){return e.classList.contains("js-timestamp")||e.querySelector("relative-time")!==null}function kO(){for(let e of document.querySelectorAll(E4))P4(e)&&(e.nextElementSibling?.hasAttribute("data-assist-send")||e.after(Jn(()=>e.href,"Start an assist session from this comment")))}function pm({owner:e,repo:t,number:o}){return document.querySelector(`a[href$="/${e}/${t}/pull/${o}" i]`)!==null}var R4=/^\/(?:orgs|users)\/[^/]+\/projects\/\d+(?:\/|$)/,O4=/^([\w.-]+)\|([\w.-]+)\|(\d+)$/;function fm({pathname:e,search:t}){if(!R4.test(e))return;let o=new URLSearchParams(t);if(o.get("pane")!=="issue")return;let r=O4.exec(o.get("issue")??"");if(!r)return;let[,n,a,i]=r;return{owner:n,repo:a,number:i}}var A4=/^\/([^/]+)\/([^/]+)\/(pull|issues)\/(\d+)(?:\/|$)/;function bT(e,t=pm){let o=A4.exec(e.pathname);if(o){let[,a,i,s,l]=o;return`${e.origin}/${a}/${i}/${s}/${l}`}let r=fm(e);if(!r)return;let n=t(r)?"pull":"issues";return`${e.origin}/${r.owner}/${r.repo}/${n}/${r.number}`}var M4='.gh-header-actions, [data-component="PH_Actions"]';function UO(){if(!bT(location)){for(let e of document.querySelectorAll(".assist-send--header[data-assist-send]"))e.remove();return}for(let e of document.querySelectorAll(M4))e.querySelector(":scope > [data-assist-send]")||e.prepend(Jn(()=>bT(location)??location.href,"Start an assist session from this page","header"))}var w4=".repos-pr-header .repos-pr-header-complete-button";function LO(){if(!Ec(location.href)){for(let o of document.querySelectorAll(".assist-send--header[data-assist-send]"))o.remove();return}let t=document.querySelector(w4)?.parentElement;!t||t.querySelector(":scope > [data-assist-send]")||t.prepend(Jn(()=>Ec(location.href)?.url??location.href,"Start an assist session for this PR","header"))}var N4=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,D4=/^ {0,3}#{1,6}[ \t]/;function Pr(e){let t=e.split(`
205
+ `;function $1(){if(document.head.querySelector(`[${F1}]`))return;let e=document.createElement("style");e.setAttribute(F1,""),e.textContent=MB,document.head.append(e)}function q1(e){let t={type:"assist-send",...e};return Bf(t)}var CO=S(bO(),1);var o4=["keydown","keyup","keypress"];function TO(e){for(let t of o4)e.addEventListener(t,o=>o.stopPropagation())}var il=S(U(),1);function r4(e){let t=e.getAttribute("data-color-mode");return t==="light"||t==="dark"?t:globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function Sc(e){let t=r4(e),o=e.getAttribute(t==="dark"?"data-dark-theme":"data-light-theme");return o?o.startsWith("dark")?"dark":"light":t}var n4=["data-color-mode","data-light-theme","data-dark-theme"];function vO(e,t){let o=Sc(e),r=()=>{let i=Sc(e);i!==o&&(o=i,t(i))},n=new MutationObserver(r);n.observe(e,{attributeFilter:n4});let a=globalThis.matchMedia?.("(prefers-color-scheme: dark)");return a?.addEventListener?.("change",r),()=>{n.disconnect(),a?.removeEventListener?.("change",r)}}var SO=S(z(),1);function xO({children:e}){let[t,o]=(0,il.useState)(()=>Sc(document.documentElement));(0,il.useEffect)(()=>vO(document.documentElement,o),[]);let r=(0,il.useMemo)(()=>hr({palette:{mode:t},typography:{fontFamily:"inherit"}}),[t]);return(0,SO.jsx)(Bp,{theme:r,children:e})}var gT=S(z(),1);function cm(e,t,o){let r=e.shadowRoot??e.attachShadow({mode:"open"});TO(e);let n=document.createElement("div"),a=document.createElement("div");a.style.cssText="width:100%;font:inherit;color:inherit",r.append(n,a);let i=Lc({key:t,container:n}),s=(0,CO.createRoot)(a);return s.render((0,gT.jsx)(Gm,{value:i,children:(0,gT.jsx)(xO,{children:o})})),s}function EO(e,t){let o=t.closest('dialog, [role="dialog"]'),r=o?i4:a4,n=()=>{e.style.cssText=r(t)};return n(),o?(e.setAttribute("popover","manual"),o.append(e),e.showPopover?.()):document.body.append(e),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)}function a4(e){let{top:t,left:o}=PO(e);return["position: absolute",`top: ${t+window.scrollY}px`,`left: ${o+window.scrollX}px`,"width: 320px","z-index: 2147483646"].join(";")}function i4(e){let{top:t,left:o}=PO(e);return["position: fixed","inset: auto",`top: ${t}px`,`left: ${o}px`,"width: 320px","height: auto","margin: 0","padding: 0","border: 0","background: transparent","overflow: visible"].join(";")}function PO(e){let t=e.getBoundingClientRect(),o=Math.max(16,Math.min(t.left,window.innerWidth-320-16));return{top:t.bottom+4,left:o}}var Cc=null;function s4(){Cc?.close()}function RO(e,t){let o=Cc?.anchor;if(s4(),o===e)return;let r=document.createElement("div");r.setAttribute("data-assist-popover","");let n=EO(r,e),a=()=>{Cc?.close===a&&(Cc=null,n(),r.remove(),queueMicrotask(()=>i.unmount()))};Cc={anchor:e,close:a};let i=cm(r,"assist-popover",t(s=>{a(),s&&e.focus()}))}var l4="icons/assist-32.png";function OO(){let e=si()?.getURL?.(l4);if(!e)return;let t=document.createElement("img");return t.src=e,t.alt="",t}function AO(e){try{return decodeURIComponent(e)}catch{return e}}var u4=/^\/([^/]+)\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i,c4=/^(?:\/DefaultCollection)?\/([^/]+)\/_git\/([^/]+)\/pullrequest\/([1-9]\d*)(?=\/|$)/i,p4=/^([^.]+)\.visualstudio\.com$/;function f4(e,t){if(e==="dev.azure.com"){let n=u4.exec(t);return n&&{path:n[0],parts:n.slice(1)}}let o=p4.exec(e)?.[1],r=o?c4.exec(t):null;return r&&o?{path:r[0],parts:[o,...r.slice(1)]}:null}function Ec(e){let t;try{t=new URL(e)}catch{return}if(t.protocol!=="https:")return;let o=f4(t.hostname.toLowerCase(),t.pathname);if(!o)return;let[r,n,a,i]=o.parts.map(AO);return{org:r,project:n,repo:a,id:i,url:`${t.origin}${o.path}`}}var d4=/^\/[^/]+\/[^/]+\/pull\/(\d+)(?:\/|$)/;function MO(e){let t;try{t=new URL(e)}catch{return}return d4.exec(t.pathname)?.[1]}function wO(e,t){if(typeof t!="function")return"link";if(e!=="header")return"instructions";let o=t();return Ec(o)?"azure-devops-review":MO(o)?"review":"instructions"}var NO="assist";async function m4(e){return typeof e=="function"?e():e.link()}function Jn(e,t,o="comment"){$1();let r=document.createElement("button");r.type="button",r.setAttribute("data-assist-send",""),r.className=o==="header"?"assist-send assist-send--header":"assist-send",r.title=t;let n=document.createElement("span");n.textContent=NO;let a=OO();a&&r.append(a),r.append(n);let i=async s=>{r.disabled=!0,n.textContent="sending\u2026";let l=await m4(e).then(u=>q1({url:u,...s}),u=>({ok:!1,message:u instanceof Error?u.message:String(u)}));zf(l.message,l.ok),r.disabled=!1,n.textContent=NO};return r.addEventListener("mousedown",s=>s.preventDefault()),r.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),RO(r,l=>V1(wO(o,e),{send:i,dismiss:l}))}),r}function DO(e){return`https://mail.google.com/mail/u/0/#search/rfc822msgid%3A${encodeURIComponent(e)}`}var y4={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&#39;":"'"},h4=/(?:^|>)Message-ID:[ \t]*(?:\r?\n[ \t]+)?(?:<|&lt;)([^\s<>]+?)(?:>|&gt;)/im;function _O(e){let t=h4.exec(e);return t?`<${t[1].replace(/&(?:lt|gt|amp|quot|#39);/g,r=>y4[r])}>`:void 0}var g4=/GLOBALS=\[(?:[^,]*,){9}"([0-9a-f]+)"/,b4=/^\/mail\/u\/\d+[/]/;function T4(){return globalThis.content?.fetch??fetch}function v4(){for(let e of document.querySelectorAll("script")){let t=g4.exec(e.textContent??"")?.[1];if(t)return t}}function x4(e){let t=b4.exec(location.pathname)?.[0]??"/mail/u/0/",o=`${location.origin}${t}`,r=e.dataset.messageId?.replace(/^#/,""),n=e.dataset.legacyMessageId,a=v4();return[r&&`${o}?${a?`ik=${a}&`:""}view=om&permmsgid=${encodeURIComponent(r)}`,n&&`${o}?view=att&th=${n}&attid=0&disp=comp&safe=1&zw`].filter(i=>!!i)}async function BO(e){for(let t of x4(e)){let o=await T4()(t,{credentials:"include"}).catch(()=>{});if(!o?.ok)continue;let r=_O(await o.text());if(r)return r}throw new Error("Couldn't resolve this message's Message-ID")}var S4="div.adn[data-message-id]",C4="span.g3";function zO(){for(let e of document.querySelectorAll(S4)){let t=e.querySelector(C4);if(!t||e.querySelector("[data-assist-send]"))continue;let o=Jn({link:async()=>DO(await BO(e))},"Start an assist session from this email");o.classList.add("assist-send--before-date"),t.before(o)}}var E4=['a[href*="#discussion_r"]','a[href*="#issuecomment-"]','a[href*="#pullrequestreview-"]'].join(",");function P4(e){return e.classList.contains("js-timestamp")||e.querySelector("relative-time")!==null}function kO(){for(let e of document.querySelectorAll(E4))P4(e)&&(e.nextElementSibling?.hasAttribute("data-assist-send")||e.after(Jn(()=>e.href,"Start an assist session from this comment")))}function pm({owner:e,repo:t,number:o}){return document.querySelector(`a[href$="/${e}/${t}/pull/${o}" i]`)!==null}var R4=/^\/(?:orgs|users)\/[^/]+\/projects\/\d+(?:\/|$)/,O4=/^([\w.-]+)\|([\w.-]+)\|(\d+)$/;function fm({pathname:e,search:t}){if(!R4.test(e))return;let o=new URLSearchParams(t);if(o.get("pane")!=="issue")return;let r=O4.exec(o.get("issue")??"");if(!r)return;let[,n,a,i]=r;return{owner:n,repo:a,number:i}}var A4=/^\/([^/]+)\/([^/]+)\/(pull|issues)\/(\d+)(?:\/|$)/;function bT(e,t=pm){let o=A4.exec(e.pathname);if(o){let[,a,i,s,l]=o;return`${e.origin}/${a}/${i}/${s}/${l}`}let r=fm(e);if(!r)return;let n=t(r)?"pull":"issues";return`${e.origin}/${r.owner}/${r.repo}/${n}/${r.number}`}var M4='.gh-header-actions, [data-component="PH_Actions"]';function UO(){if(!bT(location)){for(let e of document.querySelectorAll(".assist-send--header[data-assist-send]"))e.remove();return}for(let e of document.querySelectorAll(M4))e.querySelector(":scope > [data-assist-send]")||e.prepend(Jn(()=>bT(location)??location.href,"Start an assist session from this page","header"))}var w4=".repos-pr-header .repos-pr-header-complete-button";function LO(){if(!Ec(location.href)){for(let o of document.querySelectorAll(".assist-send--header[data-assist-send]"))o.remove();return}let t=document.querySelector(w4)?.parentElement;!t||t.querySelector(":scope > [data-assist-send]")||t.prepend(Jn(()=>Ec(location.href)?.url??location.href,"Start an assist session for this PR","header"))}var N4=/^ {0,3}#{1,6}[ \t]+acceptance criteria[ \t]*$/i,D4=/^ {0,3}#{1,6}[ \t]/;function Pr(e){let t=e.split(`
203
206
  `),o=t.findIndex(i=>N4.test(i));if(o===-1)return null;let r=o+1;for(;r<t.length&&!D4.test(t[r]);)r+=1;let n=o+1;for(;n<r&&t[n].trim()==="";)n+=1;let a=r;for(;a>n&&t[a-1].trim()==="";)a-=1;return n===r&&(n=o+1,a=o+1),{before:t.slice(0,n),lines:t.slice(n,a),after:t.slice(a)}}function dm(e){let t=0;for(let o of e)t+=o===" "?4:1;return t}function mm(e){let t=[];return e.map(o=>{for(;t.length>0&&o<t[t.length-1];)t.pop();return(t.length===0||o>t[t.length-1])&&t.push(o),t.length-1})}var _4=/^([ \t]*)\d+[.)](?:[ \t]+(.*))?$/;function jO(e){let t=Pr(e);if(!t)return null;let o=[];for(let n of t.lines){if(n.trim()==="")continue;let a=_4.exec(n);if(!a)return null;o.push({width:dm(a[1]),text:a[2]??""})}let r=mm(o.map(n=>n.width));return{before:t.before,items:o.map((n,a)=>({text:n.text,depth:r[a]})),after:t.after}}function ym(e){let t=jO(e);if(t)return{kind:"outline",items:t.items,before:t.before.join(`
204
207
  `),after:t.after.join(`
205
208
  `)};let o=Pr(e);return o?{kind:"convert",before:[...o.before,...o.lines].join(`
@@ -3,8 +3,8 @@
3
3
  "assist@staff0rd.github.io": {
4
4
  "updates": [
5
5
  {
6
- "version": "0.952.0",
7
- "update_link": "https://github.com/staff0rd/assist/releases/download/v0.952.0/assist-extension.xpi"
6
+ "version": "0.954.1",
7
+ "update_link": "https://github.com/staff0rd/assist/releases/download/v0.954.1/assist-extension.xpi"
8
8
  }
9
9
  ]
10
10
  }