linear-grab 0.9.2 → 0.9.3

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/README.md CHANGED
@@ -26,7 +26,7 @@ export default function RootLayout({ children }) {
26
26
  {children}
27
27
  {process.env.NODE_ENV === "development" && (
28
28
  <Script
29
- src="https://cdn.jsdelivr.net/gh/ahmedbanihanibh/linear-grab@v0.9.2/dist/index.global.js"
29
+ src="https://cdn.jsdelivr.net/gh/ahmedbanihanibh/linear-grab@v0.9.3/dist/index.global.js"
30
30
  crossOrigin="anonymous"
31
31
  strategy="afterInteractive"
32
32
  />
@@ -172,7 +172,7 @@ of the other sections.`,mD="- FIRST, self-orient in the repo checkout (skip any
172
172
  `)}async function FO(e,t){let n=await(await fetch(`https://slack.com/api/chat.postMessage`,{method:`POST`,body:new URLSearchParams({token:e.slackToken,channel:e.slackChannelId,text:PO(t,`slack`),unfurl_links:`false`})})).json();if(!n.ok)throw Error(n.error??`slack error`)}async function IO(e,t){let n=`https://api.telegram.org/bot${e.telegramToken}`,r=PO(t,`telegram`),i=t.demoUrl&&/raw\.githubusercontent\.com|\.gif($|\?)/i.test(t.demoUrl),a=await(await fetch(`${n}/${i?`sendAnimation`:`sendMessage`}`,{method:`POST`,body:new URLSearchParams(i?{chat_id:e.telegramChatId,animation:t.demoUrl,caption:r.slice(0,1e3)}:{chat_id:e.telegramChatId,text:r})})).json();if(!a.ok)throw Error(a.description??`telegram error`)}async function LO(e,t){if(e.notifyOnCreate===!1)return[];let n=[];if(e.slackToken&&e.slackChannelId)try{await FO(e,t)}catch{n.push(`Slack`)}if(e.telegramToken&&e.telegramChatId)try{await IO(e,t)}catch{n.push(`Telegram`)}return n}async function RO(e){let t=async t=>await(await fetch(`https://slack.com/api/conversations.list`,{method:`POST`,body:new URLSearchParams({token:e,types:t,exclude_archived:`true`,limit:`200`})})).json(),n=await t(`public_channel,private_channel`);if(!n.ok&&n.error===`missing_scope`&&(n=await t(`public_channel`)),!n.ok)throw Error(n.error??`slack error`);return(n.channels??[]).map(e=>({id:e.id,name:e.name})).sort((e,t)=>e.name.localeCompare(t.name))}var zO=12e3,BO=4e3;async function VO(e){let t=e.logUrl?.trim();if(!t)return null;let n=Math.min(500,Math.max(10,e.logLines??100)),r=new AbortController,i=setTimeout(()=>r.abort(),BO);try{let e=await fetch(t,{cache:`no-store`,signal:r.signal});if(!e.ok)throw Error(`Log fetch failed (${e.status})`);let i=(await e.text()).split(`
173
173
  `).slice(-n).join(`
174
174
  `).trim();return i.length>zO&&(i=`…\n${i.slice(i.length-zO)}`),i||null}finally{clearTimeout(i)}}function HO(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}var UO=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function WO(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}var GO=null;function KO(e={}){return GO||(e.includeStyleProperties?(GO=e.includeStyleProperties,GO):(GO=WO(window.getComputedStyle(document.documentElement)),GO))}function qO(e,t){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace(`px`,``)):0}function JO(e){let t=qO(e,`border-left-width`),n=qO(e,`border-right-width`);return e.clientWidth+t+n}function YO(e){let t=qO(e,`border-top-width`),n=qO(e,`border-bottom-width`);return e.clientHeight+t+n}function XO(e,t={}){return{width:t.width||JO(e),height:t.height||YO(e)}}function ZO(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var QO=16384;function $O(e){(e.width>QO||e.height>QO)&&(e.width>QO&&e.height>QO?e.width>e.height?(e.height*=QO/e.width,e.width=QO):(e.width*=QO/e.height,e.height=QO):e.width>QO?(e.height*=QO/e.width,e.width=QO):(e.width*=QO/e.height,e.height=QO))}function ek(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin=`anonymous`,r.decoding=`async`,r.src=e})}async function tk(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function nk(e,t,n){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`),a=document.createElementNS(r,`foreignObject`);return i.setAttribute(`width`,`${t}`),i.setAttribute(`height`,`${n}`),i.setAttribute(`viewBox`,`0 0 ${t} ${n}`),a.setAttribute(`width`,`100%`),a.setAttribute(`height`,`100%`),a.setAttribute(`x`,`0`),a.setAttribute(`y`,`0`),a.setAttribute(`externalResourcesRequired`,`true`),i.appendChild(a),a.appendChild(e),tk(i)}var rk=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||rk(n,t)};function ik(e){let t=e.getPropertyValue(`content`);return`${e.cssText} content: '${t.replace(/'|"/g,``)}';`}function ak(e,t){return KO(t).map(t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?` !important`:``};`).join(` `)}function ok(e,t,n,r){let i=`.${e}:${t}`,a=n.cssText?ik(n):ak(n,r);return document.createTextNode(`${i}{${a}}`)}function sk(e,t,n,r){let i=window.getComputedStyle(e,n),a=i.getPropertyValue(`content`);if(a===``||a===`none`)return;let o=UO();try{t.className=`${t.className} ${o}`}catch{return}let s=document.createElement(`style`);s.appendChild(ok(o,n,i,r)),t.appendChild(s)}function ck(e,t,n){sk(e,t,`:before`,n),sk(e,t,`:after`,n)}var lk=`application/font-woff`,uk=`image/jpeg`,dk={woff:lk,woff2:lk,ttf:`application/font-truetype`,eot:`application/vnd.ms-fontobject`,png:`image/png`,jpg:uk,jpeg:uk,gif:`image/gif`,tiff:`image/tiff`,svg:`image/svg+xml`,webp:`image/webp`};function fk(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:``}function pk(e){return dk[fk(e).toLowerCase()]||``}function mk(e){return e.split(/,/)[1]}function hk(e){return e.search(/^(data:)/)!==-1}function gk(e,t){return`data:${t};base64,${e}`}async function _k(e,t,n){let r=await fetch(e,t);if(r.status===404)throw Error(`Resource "${r.url}" not found`);let i=await r.blob();return new Promise((e,t)=>{let a=new FileReader;a.onerror=t,a.onloadend=()=>{try{e(n({res:r,result:a.result}))}catch(e){t(e)}},a.readAsDataURL(i)})}var vk={};function yk(e,t,n){let r=e.replace(/\?.*/,``);return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,``)),t?`[${t}]${r}`:r}async function bk(e,t,n){let r=yk(e,t,n.includeQueryParams);if(vk[r]!=null)return vk[r];n.cacheBust&&(e+=(/\?/.test(e)?`&`:`?`)+new Date().getTime());let i;try{i=gk(await _k(e,n.fetchRequestInit,({res:e,result:n})=>(t||=e.headers.get(`Content-Type`)||``,mk(n))),t)}catch(t){i=n.imagePlaceholder||``;let r=`Failed to fetch resource: ${e}`;t&&(r=typeof t==`string`?t:t.message),r&&console.warn(r)}return vk[r]=i,i}async function xk(e){let t=e.toDataURL();return t===`data:,`?e.cloneNode(!1):ek(t)}async function Sk(e,t){if(e.currentSrc){let t=document.createElement(`canvas`),n=t.getContext(`2d`);return t.width=e.clientWidth,t.height=e.clientHeight,n?.drawImage(e,0,0,t.width,t.height),ek(t.toDataURL())}let n=e.poster;return ek(await bk(n,pk(n),t))}async function Ck(e,t){try{if(e?.contentDocument?.body)return await Nk(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function wk(e,t){return rk(e,HTMLCanvasElement)?xk(e):rk(e,HTMLVideoElement)?Sk(e,t):rk(e,HTMLIFrameElement)?Ck(e,t):e.cloneNode(Ek(e))}var Tk=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SLOT`,Ek=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SVG`;async function Dk(e,t,n){if(Ek(t))return t;let r=[];return r=Tk(e)&&e.assignedNodes?WO(e.assignedNodes()):rk(e,HTMLIFrameElement)&&e.contentDocument?.body?WO(e.contentDocument.body.childNodes):WO((e.shadowRoot??e).childNodes),r.length===0||rk(e,HTMLVideoElement)||await r.reduce((e,r)=>e.then(()=>Nk(r,n)).then(e=>{e&&t.appendChild(e)}),Promise.resolve()),t}function Ok(e,t,n){let r=t.style;if(!r)return;let i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):KO(n).forEach(n=>{let a=i.getPropertyValue(n);n===`font-size`&&a.endsWith(`px`)&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),rk(e,HTMLIFrameElement)&&n===`display`&&a===`inline`&&(a=`block`),n===`d`&&t.getAttribute(`d`)&&(a=`path(${t.getAttribute(`d`)})`),r.setProperty(n,a,i.getPropertyPriority(n))})}function kk(e,t){rk(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),rk(e,HTMLInputElement)&&t.setAttribute(`value`,e.value)}function Ak(e,t){if(rk(e,HTMLSelectElement)){let n=t,r=Array.from(n.children).find(t=>e.value===t.getAttribute(`value`));r&&r.setAttribute(`selected`,``)}}function jk(e,t,n){return rk(t,Element)&&(Ok(e,t,n),ck(e,t,n),kk(e,t),Ak(e,t)),t}async function Mk(e,t){let n=e.querySelectorAll?e.querySelectorAll(`use`):[];if(n.length===0)return e;let r={};for(let i=0;i<n.length;i++){let a=n[i].getAttribute(`xlink:href`);if(a){let n=e.querySelector(a),i=document.querySelector(a);!n&&i&&!r[a]&&(r[a]=await Nk(i,t,!0))}}let i=Object.values(r);if(i.length){let t=`http://www.w3.org/1999/xhtml`,n=document.createElementNS(t,`svg`);n.setAttribute(`xmlns`,t),n.style.position=`absolute`,n.style.width=`0`,n.style.height=`0`,n.style.overflow=`hidden`,n.style.display=`none`;let r=document.createElementNS(t,`defs`);n.appendChild(r);for(let e=0;e<i.length;e++)r.appendChild(i[e]);e.appendChild(n)}return e}async function Nk(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(e=>wk(e,t)).then(n=>Dk(e,n,t)).then(n=>jk(e,n,t)).then(e=>Mk(e,t))}var Pk=/url\((['"]?)([^'"]+?)\1\)/g,Fk=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Ik=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Lk(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}function Rk(e){let t=[];return e.replace(Pk,(e,n,r)=>(t.push(r),e)),t.filter(e=>!hk(e))}async function zk(e,t,n,r,i){try{let a=n?HO(t,n):t,o=pk(t),s;return s=i?gk(await i(a),o):await bk(a,o,r),e.replace(Lk(t),`$1${s}$3`)}catch{}return e}function Bk(e,{preferredFontFormat:t}){return t?e.replace(Ik,e=>{for(;;){let[n,,r]=Fk.exec(e)||[];if(!r)return``;if(r===t)return`src: ${n};`}}):e}function Vk(e){return e.search(Pk)!==-1}async function Hk(e,t,n){if(!Vk(e))return e;let r=Bk(e,n);return Rk(r).reduce((e,r)=>e.then(e=>zk(e,r,t,n)),Promise.resolve(r))}async function Uk(e,t,n){let r=t.style?.getPropertyValue(e);if(r){let i=await Hk(r,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function Wk(e,t){await Uk(`background`,e,t)||await Uk(`background-image`,e,t),await Uk(`mask`,e,t)||await Uk(`-webkit-mask`,e,t)||await Uk(`mask-image`,e,t)||await Uk(`-webkit-mask-image`,e,t)}async function Gk(e,t){let n=rk(e,HTMLImageElement);if(!(n&&!hk(e.src))&&!(rk(e,SVGImageElement)&&!hk(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,i=await bk(r,pk(r),t);await new Promise((r,a)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){a(e)}}:a;let o=e;o.decode&&=r,o.loading===`lazy`&&(o.loading=`eager`),n?(e.srcset=``,e.src=i):e.href.baseVal=i})}async function Kk(e,t){let n=WO(e.childNodes).map(e=>qk(e,t));await Promise.all(n).then(()=>e)}async function qk(e,t){rk(e,Element)&&(await Wk(e,t),await Gk(e,t),await Kk(e,t))}function Jk(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;return r!=null&&Object.keys(r).forEach(e=>{n[e]=r[e]}),e}var Yk={};async function Xk(e){let t=Yk[e];return t??(t={url:e,cssText:await(await fetch(e)).text()},Yk[e]=t,t)}async function Zk(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async i=>{let a=i.replace(r,`$1`);return a.startsWith(`https://`)||(a=new URL(a,e.url).href),_k(a,t.fetchRequestInit,({result:e})=>(n=n.replace(i,`url(${e})`),[i,e]))});return Promise.all(i).then(()=>n)}function Qk(e){if(e==null)return[];let t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,``),r=RegExp(`((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})`,`gi`);for(;;){let e=r.exec(n);if(e===null)break;t.push(e[0])}n=n.replace(r,``);let i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a=RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=i.exec(n);if(e===null){if(e=a.exec(n),e===null)break;i.lastIndex=a.lastIndex}else a.lastIndex=i.lastIndex;t.push(e[0])}return t}async function $k(e,t){let n=[],r=[];return e.forEach(n=>{if(`cssRules`in n)try{WO(n.cssRules||[]).forEach((e,i)=>{if(e.type===CSSRule.IMPORT_RULE){let a=i+1,o=e.href,s=Xk(o).then(e=>Zk(e,t)).then(e=>Qk(e).forEach(e=>{try{n.insertRule(e,e.startsWith(`@import`)?a+=1:n.cssRules.length)}catch(t){console.error(`Error inserting rule from remote css`,{rule:e,error:t})}})).catch(e=>{console.error(`Error loading remote css`,e.toString())});r.push(s)}})}catch(i){let a=e.find(e=>e.href==null)||document.styleSheets[0];n.href!=null&&r.push(Xk(n.href).then(e=>Zk(e,t)).then(e=>Qk(e).forEach(e=>{a.insertRule(e,a.cssRules.length)})).catch(e=>{console.error(`Error loading remote stylesheet`,e)})),console.error(`Error inlining remote css file`,i)}}),Promise.all(r).then(()=>(e.forEach(e=>{if(`cssRules`in e)try{WO(e.cssRules||[]).forEach(e=>{n.push(e)})}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}}),n))}function eA(e){return e.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Vk(e.style.getPropertyValue(`src`)))}async function tA(e,t){if(e.ownerDocument==null)throw Error(`Provided element is not within a Document`);return eA(await $k(WO(e.ownerDocument.styleSheets),t))}function nA(e){return e.trim().replace(/["']/g,``)}function rA(e){let t=new Set;function n(e){(e.style.fontFamily||getComputedStyle(e).fontFamily).split(`,`).forEach(e=>{t.add(nA(e))}),Array.from(e.children).forEach(e=>{e instanceof HTMLElement&&n(e)})}return n(e),t}async function iA(e,t){let n=await tA(e,t),r=rA(e);return(await Promise.all(n.filter(e=>r.has(nA(e.style.fontFamily))).map(e=>{let n=e.parentStyleSheet?e.parentStyleSheet.href:null;return Hk(e.cssText,n,t)}))).join(`
175
- `)}async function aA(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await iA(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function oA(e,t={}){let{width:n,height:r}=XO(e,t),i=await Nk(e,t,!0);return await aA(i,t),await qk(i,t),Jk(i,t),await nk(i,n,r)}async function sA(e,t={}){let{width:n,height:r}=XO(e,t),i=await ek(await oA(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||ZO(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||$O(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function cA(e,t={}){return iA(e,t)}var lA=6,uA=class{last=performance.now();async tick(){performance.now()-this.last<=lA||(await new Promise(e=>{`requestIdleCallback`in window?requestIdleCallback(()=>e(),{timeout:100}):setTimeout(e,0)}),this.last=performance.now())}},dA=null,fA=new Map;function pA(e){let t=fA.get(e);if(t)return t;if(!dA){let e=document.createElement(`iframe`);if(e.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden`,document.body.appendChild(e),dA=e.contentDocument,!dA)return{}}let n=dA.createElement(e);dA.body.appendChild(n);let r=dA.defaultView.getComputedStyle(n),i={};for(let e=0;e<r.length;e++){let t=r[e];i[t]=r.getPropertyValue(t)}return n.remove(),fA.set(e,i),i}function mA(){try{for(let e of[`div`,`span`,`p`,`a`,`button`,`img`,`ul`,`li`,`svg`])pA(e)}catch{}}function hA(e){if(e.id===`linear-grab-root`)return!0;let t=e.tagName?.toLowerCase()??``;return t===`overlay-canvas`||t.startsWith(`react-grab`)||t===`script`||t===`iframe`}function gA(e,t){try{let n=document.createElement(`canvas`);n.width=e.naturalWidth||e.width||1,n.height=e.naturalHeight||e.height||1,n.getContext(`2d`).drawImage(e,0,0),t.src=n.toDataURL(`image/png`)}catch{t.removeAttribute(`src`),t.setAttribute(`style`,`${t.getAttribute(`style`)??``}background:#8b8e9822;`)}}async function _A(e,t){if(hA(e))return null;if(e instanceof SVGSVGElement)return e.cloneNode(!0);let n=e.cloneNode(!1),r=getComputedStyle(e),i=pA(e.tagName.toLowerCase()),a=``;for(let e=0;e<r.length;e++){let t=r[e],n=r.getPropertyValue(t);n&&n!==i[t]&&(a+=`${t}:${n};`)}if(n.setAttribute(`style`,a),n.removeAttribute(`class`),e instanceof HTMLImageElement&&gA(e,n),e instanceof HTMLCanvasElement)try{let t=document.createElement(`img`);return t.setAttribute(`style`,a),t.src=e.toDataURL(),t}catch{}e instanceof HTMLInputElement&&n.setAttribute(`value`,e.value),e instanceof HTMLTextAreaElement&&(n.textContent=e.value),await t.tick();for(let r of Array.from(e.childNodes))if(r.nodeType===Node.TEXT_NODE)n.appendChild(r.cloneNode());else if(r.nodeType===Node.ELEMENT_NODE){let e=await _A(r,t);e&&n.appendChild(e)}return n}async function vA(e,t){let n=e.getBoundingClientRect(),r=Math.max(1,Math.ceil(n.width)),i=Math.max(1,Math.ceil(n.height)),a=await _A(e,new uA);if(!a)throw Error(`Capture root was filtered`);a.style.margin=`0`;let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${i}"><style>${t}</style><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(a)}</div></foreignObject></svg>`,s=new Image;s.decoding=`async`,s.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(o)}`,await s.decode();let c=Math.min(window.devicePixelRatio||1,1.5),l=document.createElement(`canvas`);l.width=Math.round(r*c),l.height=Math.round(i*c);let u=l.getContext(`2d`);if(!u)throw Error(`Canvas 2d unavailable`);return u.drawImage(s,0,0,l.width,l.height),l}var yA=null;function bA(e){return yA??=cA(e).catch(()=>``),yA}function xA(){`requestIdleCallback`in window?requestIdleCallback(()=>{mA(),bA(document.body)},{timeout:3e3}):setTimeout(()=>{mA(),bA(document.body)},1500)}var SA=4e3,CA=1e3;async function wA(e){try{if(await new Promise(e=>{requestAnimationFrame(()=>`requestIdleCallback`in window?requestIdleCallback(()=>e(void 0),{timeout:500}):setTimeout(e,80))}),!e.isConnected)return null;let t=EA(e),n=t.querySelectorAll(`*`).length;n>SA&&(t=e);let r;try{r=await vA(t,await bA(t))}catch{t!==e&&n>CA&&(t=e),r=await sA(t,{pixelRatio:Math.min(window.devicePixelRatio||1,1.5),fontEmbedCSS:await bA(t),filter:e=>{if(!(e instanceof Element))return!0;if(e.id===`linear-grab-root`)return!1;let t=e.tagName?.toLowerCase()??``;return!(t===`overlay-canvas`||t.startsWith(`react-grab`))}})}return t!==e&&DA(r,t,e),await TA(r)}catch{return null}}async function TA(e){try{if(typeof createImageBitmap==`function`&&typeof OffscreenCanvas<`u`){let t=await createImageBitmap(e);return(await MD({type:`encode-png`,bitmap:t},[t])).dataUrl}}catch{}return OA(e)}function EA(e){let t=window.innerWidth,n=window.innerHeight,r=t*n*1.7,i=e,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){let o=a.getBoundingClientRect();if(o.width*o.height>r||a!==e&&(a.scrollTop>0||a.scrollLeft>0)||(i=a,o.width>=t*.55&&o.height>=n*.35))break;a=a.parentElement}return i}function DA(e,t,n){let r=e.getContext(`2d`);if(!r)return;let i=t.getBoundingClientRect(),a=n.getBoundingClientRect();if(!i.width||!i.height)return;let o=e.width/i.width,s=e.height/i.height,c=(a.left-i.left+t.scrollLeft)*o,l=(a.top-i.top+t.scrollTop)*s,u=a.width*o,d=a.height*s,f=Math.min(6*o,u/2,d/2);r.strokeStyle=`rgba(94, 106, 210, 0.35)`,r.lineWidth=8*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke(),r.strokeStyle=`#5e6ad2`,r.lineWidth=3*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke()}function OA(e){let t=e.toDataURL(`image/png`);return t.length<=25e5?t:e.toDataURL(`image/jpeg`,.85)}function kA(e){let[t,n]=e.split(`,`),r=t.match(/data:([^;]+)/)?.[1]??`image/png`,i=atob(n),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return new Blob([a],{type:r})}var[AA,jA]=w(null),[MA,NA]=w(null);function PA(e,t){jA(e),NA(t??null)}function FA(){jA(null),NA(null)}var IA=M(`<span class="absolute inset-0 grid place-items-center">`),LA=M(`<button><span>`),RA=M(`<span aria-hidden class="border-text-dim inline-block size-3.5 animate-spin rounded-full border-[1.5px] border-t-transparent">`),zA=M(`<input>`),BA=M(`<textarea>`),VA=M(`<select>`),HA=M(`<span class="text-text-faint text-[10.5px] leading-snug">`),UA=M(`<label class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">`),WA=M(`<section class="flex flex-col gap-2.5"><h2 class="text-text-dim text-[11px] font-semibold tracking-wide uppercase">`),GA=M(`<span>`),KA=M(`<span aria-hidden class="inline-block size-2 shrink-0 rounded-full">`),qA=M(`<div class="flex flex-col items-center gap-1.5 px-4 py-10 text-center"><p class="text-text-dim text-[12px] font-medium"></p><div class="text-text-faint text-[11.5px] leading-relaxed">`),JA=M(`<p class="bg-danger-soft text-danger rounded-md px-2.5 py-1.5 text-[11.5px] leading-snug break-words">`),YA={primary:`bg-accent hover:bg-accent-hover text-white border-transparent disabled:bg-surface-3 disabled:text-text-faint`,ghost:`bg-surface-2 hover:bg-surface-3 text-text border-border disabled:text-text-faint disabled:hover:bg-surface-2`,danger:`bg-danger-soft hover:bg-danger/30 text-danger border-transparent`};function XA(e){let[t,n]=Ue(e,[`variant`,`loading`,`children`,`class`,`disabled`]);return(()=>{var e=LA(),r=e.firstChild;return ht(e,He(n,{get disabled(){return t.disabled||t.loading},get class(){return`relative inline-flex h-7 cursor-pointer items-center justify-center gap-1.5 rounded-md border px-3 text-[12px] font-medium transition-colors disabled:cursor-not-allowed ${YA[t.variant??`ghost`]} ${t.class??``}`}}),!1,!0),N(r,()=>t.children),N(e,A(j,{get when(){return t.loading},get children(){var e=IA();return N(e,A(ZA,{})),e}}),null),E(()=>ut(r,`inline-flex items-center gap-1.5 ${t.loading?`invisible`:``}`)),e})()}function ZA(){return RA()}function QA(e){let[t,n]=Ue(e,[`class`]);return(()=>{var e=zA();return ht(e,He(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint h-7 w-full rounded-md border px-2 text-[12px] outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function $A(e){let[t,n]=Ue(e,[`class`]);return(()=>{var e=BA();return ht(e,He(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint w-full resize-y rounded-md border px-2 py-1.5 text-[12px] leading-relaxed outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function ej(e){let[t,n]=Ue(e,[`class`,`children`]);return(()=>{var e=VA();return ht(e,He(n,{get class(){return`bg-surface-2 border-border focus:border-accent h-7 w-full cursor-pointer rounded-md border px-1.5 text-[12px] outline-none ${t.class??``}`}}),!1,!0),N(e,()=>t.children),e})()}function tj(e){return(()=>{var t=UA(),n=t.firstChild;return N(n,()=>e.label),N(t,()=>e.children,null),N(t,A(j,{get when(){return e.hint},get children(){var t=HA();return N(t,()=>e.hint),t}}),null),t})()}function nj(e){return(()=>{var t=WA(),n=t.firstChild;return N(n,()=>e.title),N(t,()=>e.children,null),t})()}function rj(e){return(()=>{var t=GA();return N(t,()=>e.children),E(n=>{var r=`bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class??``}`,i=e.color?{color:e.color}:void 0;return r!==n.e&&ut(t,n.e=r),n.t=pt(t,i,n.t),n},{e:void 0,t:void 0}),t})()}function ij(e){return(()=>{var t=KA();return E(n=>mt(t,`background`,e.color)),t})()}function aj(e){return(()=>{var t=qA(),n=t.firstChild,r=n.nextSibling;return N(n,()=>e.title),N(r,()=>e.children),t})()}function oj(e){return(()=>{var t=JA();return N(t,()=>e.message),t})()}var sj={0:`No priority`,1:`Urgent`,2:`High`,3:`Medium`,4:`Low`};function cj(e){let t=typeof e==`number`?e:Date.parse(e),n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}zr(),Px(),hD();var lj=M(`<span class="truncate font-mono">`),uj=M(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M5.5 3.5 6.6 2h2.8l1.1 1.5H13A1.5 1.5 0 0 1 14.5 5v7A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V5A1.5 1.5 0 0 1 3 3.5h2.5Z"></path><circle cx=8 cy=8.2 r=2.4>`),dj=M(`<div class="flex items-center justify-between gap-1.5"><span class="text-text-faint text-[11px]">Model:</span><div class="flex rounded-md border border-border overflow-hidden">`),fj=M(`<span class="inline-block min-w-[12ch] text-center">`),pj=M(`<div class="flex justify-end">`),mj=M(`<div class="flex flex-col gap-1.5">`),hj=M(`<p class="text-text-faint text-[11px] leading-snug">Primary provider failed — drafted with <span class=text-text-dim></span> (<!>).`),gj=M(`<div class="flex flex-col gap-1">`),_j=M(`<option value>Select a team…`),vj=M(`<option value=cursor> — cloud agent`),yj=M(`<option value=local>Local Claude Code (bridge)`),bj=M(`<option value=none>No one — just create the issue`),xj=M(`<option value>Claude Code default`),Sj=M(`<option value=opus>Opus`),Cj=M(`<option value=sonnet>Sonnet`),wj=M(`<option value=haiku>Haiku`),Tj=M(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach dev server logs <span class="text-text-dim tabular-nums">(last <!> lines)`),Ej=M(`<p class="text-warn text-[11px] leading-snug">`),Dj=M(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4"><div class="bg-surface border-border flex items-center gap-2 rounded-lg border px-2.5 py-2"><div class="flex min-w-0 flex-1 flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Attached context</span><div class="flex min-w-0 flex-wrap items-center gap-1.5"></div></div></div><div class="bg-bg border-border sticky bottom-0 z-10 -mb-4 flex flex-col gap-2 border-t pt-2.5 pb-3">`),Oj=M(`<button>`),kj=M(`<div class="flex items-center gap-1"><span class="text-text-faint text-[11px] tabular-nums w-4 shrink-0 text-right">.</span><button class="text-text-faint hover:text-danger shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors cursor-pointer text-[12px] leading-none"aria-label="Remove step">×`),Aj=M(`<option>`),jj=M(`<option>Loading teams…`),Mj=M(`<div class="bg-surface border-border rounded-lg border p-2.5 flex items-center justify-between gap-2"><a target=_blank rel="noopener noreferrer"class="text-accent font-mono text-[12px] hover:underline">`);function Nj(e){ur();let t=br(()=>({queryKey:[`grab`],queryFn:Or})),n=br(()=>({queryKey:[`settings`],queryFn:Er})),r=O(()=>n.data??{}),i=O(()=>t.data?.[0]??null),a=O(()=>!!(r().linearApiKey||r().linearAccessToken)),o=O(()=>kx(r())),[s,c]=w(``),[l,u]=w(``),[d,f]=w([]),[p,m]=w(``),[h,g]=w(``),[_,v]=w(``),[y,b]=w(``),[x,S]=w(``),[ee,C]=w(0),[T,te]=w(r().defaultTeamId??``),[ne,k]=w(r().defaultRepo??``),[re,ie]=w(`none`),[ae,se]=w(``),[ce,le]=w(``),[ue,de]=w(``),[fe,pe]=w(`fast`),[me,he]=w(!0),ge=!1;D(()=>{let e=n.data;ge||!e||(ge=!0,te(e.defaultTeamId??``),k(e.defaultRepo??``),ie(e.cursorAgentId?`cursor`:`none`))});let _e=br(()=>({queryKey:[`teams`],queryFn:lO,enabled:a()})),ve=O(()=>(_e.data??[]).find(e=>e.id===T())?.name),[ye,be]=w(!1),[xe,Se]=w(null),[Ce,we]=w(null),Te=null,Ee=()=>{Te?.(),Te=null};oe(Ee);let De=e=>{e.title!==void 0&&c(e.title),e.description!==void 0&&u(e.description),e.reproSteps!==void 0&&f(e.reproSteps),e.expected!==void 0&&m(e.expected),e.actual!==void 0&&g(e.actual),e.impact!==void 0&&v(e.impact),e.analysisNotes!==void 0&&b(e.analysisNotes),e.suggestedNextSteps!==void 0&&S(e.suggestedNextSteps),e.priority!==void 0&&C(e.priority)},Oe=async()=>{if(!o())return;be(!0),Se(null),we(null),Ee();let e=r().logUrl&&me()?await VO({logUrl:r().logUrl,logLines:40}).catch(()=>void 0):void 0;Te=xD({note:ue(),grabbed:i()??null,grabbedList:t.data??void 0,teamName:ve(),tier:fe(),template:cD(r()),logs:e??void 0},{onPartial:De,onDone:e=>{De(e.draft),e.fellBack&&we({provider:e.provider,modelId:e.modelId}),be(!1),Te=null},onError:(e,t)=>{Se(t===`no-provider`?`No AI provider configured — add an OpenAI or Anthropic key in Settings.`:e),be(!1),Te=null}})},[ke,Ae]=w(VD());oe(HD(Ae));let je=async()=>{let e=VD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await xO(e.blob,`recording-${Date.now()}.gif`);return nO(t),t},[Me,Ne]=w(null),[Pe,Fe]=w(null),[Ie,Le]=w(null),Re=xr(()=>({mutationFn:async()=>{let e=fD({description:l(),reproSteps:d(),expected:p(),actual:h(),impact:_(),analysisNotes:y(),suggestedNextSteps:x(),grabs:t.data??[],repo:ne(),model:ce().trim()||r().cursorModel,agentInstructions:cD(r())});Fe(null);let n=[],i=VD();if(i.result&&i.attachOnCreate)try{let t=await je();e+=`\n\n### Recording\n![Screen recording](${t})`}catch{n.push(`recording`)}let a=(t.data??[]).filter(e=>e.screenshotDataUrl).slice(0,3);for(let[t,r]of a.entries())try{let n=await xO(kA(r.screenshotDataUrl),`element-${Date.now()}-${t}.png`),i=r.componentName?`<${r.componentName}>`:r.tagName??`element`;e+=`\n\n### Element location${a.length>1?` — ${i}`:``}\n![Highlighted element in context](${n})`}catch{n.push(`screenshot${a.length>1?` ${t+1}`:``}`)}if(r().logUrl&&me())try{let t=await VO(r());if(t){let n=Math.min(500,Math.max(10,r().logLines??100));e+=`\n\n### Dev server logs (last ${n} lines)\n\`\`\`\n${t}\n\`\`\``}}catch{n.push(`server logs (fetch failed — is the Log URL serving the file?)`)}if(n.length){let e=n.some(e=>!e.startsWith(`server logs`));Fe(`Skipped: ${n.join(`, `)} — issue created without ${n.length>1?`them`:`it`}.${e?" Real fix for uploads: run `npx linear-grab-bridge` in the repo (uploads relay through it) or set the GitHub fallback in Settings.":``}`)}let o=await gO({teamId:T(),title:s(),description:e,priority:ee(),delegateId:re()===`cursor`?r().cursorAgentId:void 0}),c=!1;if(re()===`local`)try{let t=[`You are delegated Linear issue ${o.identifier} (${o.url}).`,``,e,``,`## Closeout — do ALL of this autonomously when the fix is verified (permissions are granted):`,`1. Create a branch (e.g. fix/${o.identifier.toLowerCase()}-short-slug), commit, push.`,`2. Open a PR: \`gh pr create\` — reference ${o.identifier} and ${o.url} in the body so Linear links it.`,`3. Update the Linear issue via its GraphQL API (https://api.linear.app/graphql) using the LINEAR_API_KEY env var as the Authorization header:`,` - commentCreate on issue ${o.identifier}: one-line fix summary + root cause + the PR link.`,` - Move it to review: query the team's workflowStates, then issueUpdate with the review/'In Review' stateId.`,`4. If Slack/Telegram tokens appear in the instructions above, announce there too.`].join(`
175
+ `)}async function aA(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await iA(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function oA(e,t={}){let{width:n,height:r}=XO(e,t),i=await Nk(e,t,!0);return await aA(i,t),await qk(i,t),Jk(i,t),await nk(i,n,r)}async function sA(e,t={}){let{width:n,height:r}=XO(e,t),i=await ek(await oA(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||ZO(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||$O(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function cA(e,t={}){return iA(e,t)}var lA=6,uA=class{last=performance.now();async tick(){performance.now()-this.last<=lA||(await new Promise(e=>{`requestIdleCallback`in window?requestIdleCallback(()=>e(),{timeout:100}):setTimeout(e,0)}),this.last=performance.now())}},dA=null,fA=new Map;function pA(e){let t=fA.get(e);if(t)return t;if(!dA){let e=document.createElement(`iframe`);if(e.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden`,document.body.appendChild(e),dA=e.contentDocument,!dA)return{}}let n=dA.createElement(e);dA.body.appendChild(n);let r=dA.defaultView.getComputedStyle(n),i={};for(let e=0;e<r.length;e++){let t=r[e];i[t]=r.getPropertyValue(t)}return n.remove(),fA.set(e,i),i}function mA(){try{for(let e of[`div`,`span`,`p`,`a`,`button`,`img`,`ul`,`li`,`svg`])pA(e)}catch{}}function hA(e){if(e.id===`linear-grab-root`)return!0;let t=e.tagName?.toLowerCase()??``;return t===`overlay-canvas`||t.startsWith(`react-grab`)||t===`script`||t===`iframe`}function gA(e,t){try{let n=document.createElement(`canvas`);n.width=e.naturalWidth||e.width||1,n.height=e.naturalHeight||e.height||1,n.getContext(`2d`).drawImage(e,0,0),t.src=n.toDataURL(`image/png`)}catch{t.removeAttribute(`src`),t.setAttribute(`style`,`${t.getAttribute(`style`)??``}background:#8b8e9822;`)}}async function _A(e,t){if(hA(e))return null;if(e instanceof SVGSVGElement)return e.cloneNode(!0);let n=e.cloneNode(!1),r=getComputedStyle(e),i=pA(e.tagName.toLowerCase()),a=``;for(let e=0;e<r.length;e++){let t=r[e],n=r.getPropertyValue(t);n&&n!==i[t]&&(a+=`${t}:${n};`)}if(n.setAttribute(`style`,a),n.removeAttribute(`class`),e instanceof HTMLImageElement&&gA(e,n),e instanceof HTMLCanvasElement)try{let t=document.createElement(`img`);return t.setAttribute(`style`,a),t.src=e.toDataURL(),t}catch{}e instanceof HTMLInputElement&&n.setAttribute(`value`,e.value),e instanceof HTMLTextAreaElement&&(n.textContent=e.value),await t.tick();for(let r of Array.from(e.childNodes))if(r.nodeType===Node.TEXT_NODE)n.appendChild(r.cloneNode());else if(r.nodeType===Node.ELEMENT_NODE){let e=await _A(r,t);e&&n.appendChild(e)}return n}async function vA(e,t){let n=e.getBoundingClientRect(),r=Math.max(1,Math.ceil(n.width)),i=Math.max(1,Math.ceil(n.height)),a=await _A(e,new uA);if(!a)throw Error(`Capture root was filtered`);a.style.margin=`0`;let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${i}"><style>${t}</style><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(a)}</div></foreignObject></svg>`,s=new Image;s.decoding=`async`,s.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(o)}`,await s.decode();let c=Math.min(window.devicePixelRatio||1,1.5),l=document.createElement(`canvas`);l.width=Math.round(r*c),l.height=Math.round(i*c);let u=l.getContext(`2d`);if(!u)throw Error(`Canvas 2d unavailable`);return u.drawImage(s,0,0,l.width,l.height),l}var yA=null;function bA(e){return yA??=cA(e).catch(()=>``),yA}function xA(){`requestIdleCallback`in window?requestIdleCallback(()=>{mA(),bA(document.body)},{timeout:3e3}):setTimeout(()=>{mA(),bA(document.body)},1500)}var SA=4e3,CA=1e3;async function wA(e){try{if(await new Promise(e=>{requestAnimationFrame(()=>`requestIdleCallback`in window?requestIdleCallback(()=>e(void 0),{timeout:500}):setTimeout(e,80))}),!e.isConnected)return null;let t=EA(e),n=t.querySelectorAll(`*`).length;n>SA&&(t=e);let r;try{r=await vA(t,await bA(t))}catch{t!==e&&n>CA&&(t=e),r=await sA(t,{pixelRatio:Math.min(window.devicePixelRatio||1,1.5),fontEmbedCSS:await bA(t),filter:e=>{if(!(e instanceof Element))return!0;if(e.id===`linear-grab-root`)return!1;let t=e.tagName?.toLowerCase()??``;return!(t===`overlay-canvas`||t.startsWith(`react-grab`))}})}return t!==e&&DA(r,t,e),await TA(r)}catch{return null}}async function TA(e){try{if(typeof createImageBitmap==`function`&&typeof OffscreenCanvas<`u`){let t=await createImageBitmap(e);return(await MD({type:`encode-png`,bitmap:t},[t])).dataUrl}}catch{}return OA(e)}function EA(e){let t=window.innerWidth,n=window.innerHeight,r=t*n*1.7,i=e,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){let o=a.getBoundingClientRect();if(o.width*o.height>r||a!==e&&(a.scrollTop>0||a.scrollLeft>0)||(i=a,o.width>=t*.55&&o.height>=n*.35))break;a=a.parentElement}return i}function DA(e,t,n){let r=e.getContext(`2d`);if(!r)return;let i=t.getBoundingClientRect(),a=n.getBoundingClientRect();if(!i.width||!i.height)return;let o=e.width/i.width,s=e.height/i.height,c=(a.left-i.left+t.scrollLeft)*o,l=(a.top-i.top+t.scrollTop)*s,u=a.width*o,d=a.height*s,f=Math.min(6*o,u/2,d/2);r.strokeStyle=`rgba(94, 106, 210, 0.35)`,r.lineWidth=8*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke(),r.strokeStyle=`#5e6ad2`,r.lineWidth=3*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke()}function OA(e){let t=e.toDataURL(`image/png`);return t.length<=25e5?t:e.toDataURL(`image/jpeg`,.85)}function kA(e){let[t,n]=e.split(`,`),r=t.match(/data:([^;]+)/)?.[1]??`image/png`,i=atob(n),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return new Blob([a],{type:r})}var[AA,jA]=w(null),[MA,NA]=w(null);function PA(e,t){jA(e),NA(t??null)}function FA(){jA(null),NA(null)}var IA=M(`<span class="absolute inset-0 grid place-items-center">`),LA=M(`<button><span>`),RA=M(`<span aria-hidden class="border-text-dim inline-block size-3.5 animate-spin rounded-full border-[1.5px] border-t-transparent">`),zA=M(`<input>`),BA=M(`<textarea>`),VA=M(`<select>`),HA=M(`<span class="text-text-faint text-[10.5px] leading-snug">`),UA=M(`<label class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">`),WA=M(`<section class="flex flex-col gap-2.5"><h2 class="text-text-dim text-[11px] font-semibold tracking-wide uppercase">`),GA=M(`<span>`),KA=M(`<span aria-hidden class="inline-block size-2 shrink-0 rounded-full">`),qA=M(`<div class="flex flex-col items-center gap-1.5 px-4 py-10 text-center"><p class="text-text-dim text-[12px] font-medium"></p><div class="text-text-faint text-[11.5px] leading-relaxed">`),JA=M(`<p class="bg-danger-soft text-danger rounded-md px-2.5 py-1.5 text-[11.5px] leading-snug break-words">`),YA={primary:`bg-accent hover:bg-accent-hover text-white border-transparent disabled:bg-surface-3 disabled:text-text-faint`,ghost:`bg-surface-2 hover:bg-surface-3 text-text border-border disabled:text-text-faint disabled:hover:bg-surface-2`,danger:`bg-danger-soft hover:bg-danger/30 text-danger border-transparent`};function XA(e){let[t,n]=Ue(e,[`variant`,`loading`,`children`,`class`,`disabled`]);return(()=>{var e=LA(),r=e.firstChild;return ht(e,He(n,{get disabled(){return t.disabled||t.loading},get class(){return`relative inline-flex h-7 cursor-pointer items-center justify-center gap-1.5 rounded-md border px-3 text-[12px] font-medium transition-colors disabled:cursor-not-allowed ${YA[t.variant??`ghost`]} ${t.class??``}`}}),!1,!0),N(r,()=>t.children),N(e,A(j,{get when(){return t.loading},get children(){var e=IA();return N(e,A(ZA,{})),e}}),null),E(()=>ut(r,`inline-flex items-center gap-1.5 ${t.loading?`invisible`:``}`)),e})()}function ZA(){return RA()}function QA(e){let[t,n]=Ue(e,[`class`]);return(()=>{var e=zA();return ht(e,He(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint h-7 w-full rounded-md border px-2 text-[12px] outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function $A(e){let[t,n]=Ue(e,[`class`]);return(()=>{var e=BA();return ht(e,He(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint w-full resize-y rounded-md border px-2 py-1.5 text-[12px] leading-relaxed outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function ej(e){let[t,n]=Ue(e,[`class`,`children`]);return(()=>{var e=VA();return ht(e,He(n,{get class(){return`bg-surface-2 border-border focus:border-accent h-7 w-full cursor-pointer rounded-md border px-1.5 text-[12px] outline-none ${t.class??``}`}}),!1,!0),N(e,()=>t.children),e})()}function tj(e){return(()=>{var t=UA(),n=t.firstChild;return N(n,()=>e.label),N(t,()=>e.children,null),N(t,A(j,{get when(){return e.hint},get children(){var t=HA();return N(t,()=>e.hint),t}}),null),t})()}function nj(e){return(()=>{var t=WA(),n=t.firstChild;return N(n,()=>e.title),N(t,()=>e.children,null),t})()}function rj(e){return(()=>{var t=GA();return N(t,()=>e.children),E(n=>{var r=`bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class??``}`,i=e.color?{color:e.color}:void 0;return r!==n.e&&ut(t,n.e=r),n.t=pt(t,i,n.t),n},{e:void 0,t:void 0}),t})()}function ij(e){return(()=>{var t=KA();return E(n=>mt(t,`background`,e.color)),t})()}function aj(e){return(()=>{var t=qA(),n=t.firstChild,r=n.nextSibling;return N(n,()=>e.title),N(r,()=>e.children),t})()}function oj(e){return(()=>{var t=JA();return N(t,()=>e.message),t})()}var sj={0:`No priority`,1:`Urgent`,2:`High`,3:`Medium`,4:`Low`};function cj(e){let t=typeof e==`number`?e:Date.parse(e),n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}zr(),Px(),hD();var lj=M(`<span class="truncate font-mono">`),uj=M(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M5.5 3.5 6.6 2h2.8l1.1 1.5H13A1.5 1.5 0 0 1 14.5 5v7A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V5A1.5 1.5 0 0 1 3 3.5h2.5Z"></path><circle cx=8 cy=8.2 r=2.4>`),dj=M(`<div class="flex items-center justify-between gap-1.5"><span class="text-text-faint text-[11px]">Model:</span><div class="flex rounded-md border border-border overflow-hidden">`),fj=M(`<span class="inline-block min-w-[12ch] text-center">`),pj=M(`<div class="flex justify-end">`),mj=M(`<div class="flex flex-col gap-1.5">`),hj=M(`<p class="text-text-faint text-[11px] leading-snug">Primary provider failed — drafted with <span class=text-text-dim></span> (<!>).`),gj=M(`<div class="flex flex-col gap-1">`),_j=M(`<option value>Select a team…`),vj=M(`<option value=cursor> — cloud agent`),yj=M(`<option value=local>Local Claude Code (bridge)`),bj=M(`<option value=none>No one — just create the issue`),xj=M(`<option value>Claude Code default`),Sj=M(`<option value=opus>Opus`),Cj=M(`<option value=sonnet>Sonnet`),wj=M(`<option value=haiku>Haiku`),Tj=M(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach dev server logs <span class="text-text-dim tabular-nums">(last <!> lines)`),Ej=M(`<p class="text-warn text-[11px] leading-snug">`),Dj=M(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4"><div class="bg-surface border-border flex items-center gap-2 rounded-lg border px-2.5 py-2"><div class="flex min-w-0 flex-1 flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Attached context</span><div class="flex min-w-0 flex-wrap items-center gap-1.5"></div></div></div><div class="bg-bg border-border sticky bottom-0 z-10 -mb-4 flex flex-col gap-2 border-t pt-2.5 pb-3">`),Oj=M(`<button>`),kj=M(`<div class="flex items-center gap-1"><span class="text-text-faint text-[11px] tabular-nums w-4 shrink-0 text-right">.</span><button class="text-text-faint hover:text-danger shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors cursor-pointer text-[12px] leading-none"aria-label="Remove step">×`),Aj=M(`<option>`),jj=M(`<option>Loading teams…`),Mj=M(`<div class="bg-surface border-border rounded-lg border p-2.5 flex items-center justify-between gap-2"><a target=_blank rel="noopener noreferrer"class="text-accent font-mono text-[12px] hover:underline">`);function Nj(e){ur();let t=br(()=>({queryKey:[`grab`],queryFn:Or})),n=br(()=>({queryKey:[`settings`],queryFn:Er})),r=O(()=>n.data??{}),i=O(()=>t.data?.[0]??null),a=O(()=>!!(r().linearApiKey||r().linearAccessToken)),o=O(()=>kx(r())),[s,c]=w(``),[l,u]=w(``),[d,f]=w([]),[p,m]=w(``),[h,g]=w(``),[_,v]=w(``),[y,b]=w(``),[x,S]=w(``),[ee,C]=w(0),[T,te]=w(r().defaultTeamId??``),[ne,k]=w(r().defaultRepo??``),[re,ie]=w(`none`),[ae,se]=w(``),[ce,le]=w(``),[ue,de]=w(``),[fe,pe]=w(`fast`),[me,he]=w(!0),ge=!1;D(()=>{let e=n.data;ge||!e||(ge=!0,te(e.defaultTeamId??``),k(e.defaultRepo??``),ie(e.cursorAgentId?`cursor`:`none`))});let _e=br(()=>({queryKey:[`teams`],queryFn:lO,enabled:a()})),ve=O(()=>(_e.data??[]).find(e=>e.id===T())?.name),[ye,be]=w(!1),[xe,Se]=w(null),[Ce,we]=w(null),Te=null,Ee=()=>{Te?.(),Te=null};oe(Ee);let De=e=>{e.title!==void 0&&c(e.title),e.description!==void 0&&u(e.description),e.reproSteps!==void 0&&f(e.reproSteps),e.expected!==void 0&&m(e.expected),e.actual!==void 0&&g(e.actual),e.impact!==void 0&&v(e.impact),e.analysisNotes!==void 0&&b(e.analysisNotes),e.suggestedNextSteps!==void 0&&S(e.suggestedNextSteps),e.priority!==void 0&&C(e.priority)},Oe=async()=>{if(!o())return;be(!0),Se(null),we(null),Ee();let e=r().logUrl&&me()?await VO({logUrl:r().logUrl,logLines:40}).catch(()=>void 0):void 0;Te=xD({note:ue(),grabbed:i()??null,grabbedList:t.data??void 0,teamName:ve(),tier:fe(),template:cD(r()),logs:e??void 0},{onPartial:De,onDone:e=>{De(e.draft),e.fellBack&&we({provider:e.provider,modelId:e.modelId}),be(!1),Te=null},onError:(e,t)=>{Se(t===`no-provider`?`No AI provider configured — add an OpenAI or Anthropic key in Settings.`:e),be(!1),Te=null}})},[ke,Ae]=w(VD());oe(HD(Ae));let je=async()=>{let e=VD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await xO(e.blob,`recording-${Date.now()}.gif`);return nO(t),t},[Me,Ne]=w(null),[Pe,Fe]=w(null),[Ie,Le]=w(null),Re=xr(()=>({mutationFn:async()=>{let e=fD({description:l(),reproSteps:d(),expected:p(),actual:h(),impact:_(),analysisNotes:y(),suggestedNextSteps:x(),grabs:t.data??[],repo:ne(),model:ce().trim()||r().cursorModel,agentInstructions:cD(r())});Fe(null);let n=[],i=VD();if(i.result&&i.attachOnCreate)try{let t=await je();e+=`\n\n### Recording\n![Screen recording](${t})`}catch{n.push(`recording`)}let a=(t.data??[]).filter(e=>e.screenshotDataUrl).slice(0,3);for(let[t,r]of a.entries())try{let n=await xO(kA(r.screenshotDataUrl),`element-${Date.now()}-${t}.png`),i=r.componentName?`<${r.componentName}>`:r.tagName??`element`;e+=`\n\n### Element location${a.length>1?` — ${i}`:``}\n![Highlighted element in context](${n})`}catch{n.push(`screenshot${a.length>1?` ${t+1}`:``}`)}if(r().logUrl&&me())try{let t=await VO(r());if(t){let n=Math.min(500,Math.max(10,r().logLines??100));e+=`\n\n### Dev server logs (last ${n} lines)\n\`\`\`\n${t}\n\`\`\``}}catch{n.push(`server logs (fetch failed — is the Log URL serving the file?)`)}if(n.length){let e=n.some(e=>!e.startsWith(`server logs`));Fe(`Skipped: ${n.join(`, `)} — issue created without ${n.length>1?`them`:`it`}.${e?" Real fix for uploads: run `npx linear-grab-bridge` in the repo (uploads relay through it) or set the GitHub fallback in Settings.":``}`)}let o=await gO({teamId:T(),title:s(),description:e,priority:ee(),delegateId:re()===`cursor`?r().cursorAgentId:void 0}),c=!1;if(re()===`local`)try{let t=[`You are delegated Linear issue ${o.identifier} (${o.url}).`,``,e,``,`## Closeout — do ALL of this autonomously when the fix is verified (permissions are granted):`,`1. Create a branch (e.g. fix/${o.identifier.toLowerCase()}-short-slug), commit, push.`,`2. Open a PR: \`gh pr create\` — reference ${o.identifier} and ${o.url} in the body so Linear links it.`,`3. Update the Linear issue via its GraphQL API (https://api.linear.app/graphql) using the LINEAR_API_KEY env var as the Authorization header:`,` - commentCreate on issue ${o.identifier}: one-line fix summary + root cause + the PR link.`,` - Move it to review: query the team's workflowStates, then issueUpdate with the review/'In Review' stateId.`,`4. Announce the finished fix on every channel whose token appears in the instructions above (Slack chat.postMessage + files upload, Telegram sendMessage/sendVideo) — include: what was broken, the one-line fix, the Linear issue link, the PR link, and the demo recording if you made one. End with "👉 Review the PR".`].join(`
176
176
  `);await kO(`${o.identifier} — ${s()}`,t,{model:ae()||void 0,permissionMode:`bypassPermissions`,env:r().linearApiKey?{LINEAR_API_KEY:r().linearApiKey}:void 0}),c=!0;try{let e=(await mO(T())).filter(e=>e.type===`started`).sort((e,t)=>e.position-t.position)[0];e&&await hO(o.id,e.id)}catch{}await _O(o.id,`🖥️ Delegated to **local Claude Code** on this machine (Linear Grab bridge). Live status, conversation, and steering in the panel's Local tab. The agent will post its fix summary + PR here and move this issue to review when done.`).catch(()=>{})}catch{Fe("Issue created, but the local bridge is unreachable — run `npx linear-grab-bridge` in the repo and re-delegate from the Local tab.")}let u=await LO(r(),{identifier:o.identifier,title:s(),url:o.url,summary:l(),impact:_(),repo:ne()||r().defaultRepo,demoUrl:VD().result?.assetUrl,executor:re()});return u.length&&Fe(`${u.join(` + `)} announcement failed — check the token/channel in Settings.`),{...o,localTask:c}},onSuccess:e=>{Le({identifier:e.identifier,url:e.url}),Ne(null),we(null),eO(),e.localTask&&PA(`local`)},onError:e=>{Ne(e.message)}})),ze=O(()=>!!s().trim()&&!!T()&&a()),Be=O(()=>{let e=o();return e?Mx[e][fe()]:null}),Ve=()=>f(e=>[...e,``]),He=e=>f(t=>t.filter((t,n)=>n!==e)),Ue=(e,t)=>f(n=>n.map((n,r)=>r===e?t:n));return(()=>{var n=Dj(),f=n.firstChild,w=f.firstChild.firstChild.nextSibling,D=f.nextSibling;return N(w,A(j,{get when(){return i()},get fallback(){return A(rj,{class:`text-text-faint`,children:`No element`})},get children(){return A(rj,{class:`text-accent max-w-full`,get children(){var e=lj();return N(e,(()=>{var e=nt(()=>!!i().componentName);return()=>e()?`<${i().componentName}>`:i().source?.filePath?.split(`/`).pop()??`element`})()),e}})}}),null),N(w,A(j,{get when(){return i()?.screenshotDataUrl},get children(){return A(rj,{class:`text-success`,children:`screenshot ✓`})}}),null),N(w,A(j,{get when(){return ke().result},get children(){return A(rj,{get class(){return ke().attachOnCreate?`text-success`:`text-text-faint`},get children(){return[`gif `,nt(()=>(ke().result.durationMs/1e3).toFixed(0)),`s`,nt(()=>ke().attachOnCreate?` ✓`:` (off)`)]}})}}),null),N(w,A(j,{get when(){return(t.data?.length??0)>1},get children(){return A(rj,{get children(){return[`+`,nt(()=>t.data.length-1),` more`]}})}}),null),N(w,A(j,{get when(){return ke().phase===`recording`},get children(){return A(rj,{class:`text-danger`,children:`● recording…`})}}),null),N(f,A(XA,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Manage in the Capture tab — elements, screenshots, recording`,"aria-label":`Open Capture tab`,onClick:()=>PA(`capture`),get children(){return uj()}}),null),N(n,A(nj,{title:`AI draft`,get children(){return[A(tj,{label:`Your note`,get children(){return A($A,{rows:3,placeholder:`Describe the problem or change in your own words…`,get value(){return ue()},onInput:e=>de(e.currentTarget.value)})}}),(()=>{var e=dj(),t=e.firstChild.nextSibling;return N(t,()=>[`fast`,`best`].map(e=>(()=>{var t=Oj();return t.$$click=()=>pe(e),N(t,e===`fast`?`Fast`:`Best`),E(()=>ut(t,`h-6 px-2.5 text-[11px] font-medium transition-colors cursor-pointer ${fe()===e?`bg-accent text-white`:`bg-surface-2 text-text-dim hover:text-text`}`)),t})())),e})(),(()=>{var e=mj();return N(e,A(j,{get when(){return o()},get fallback(){return A(XA,{variant:`ghost`,class:`w-full opacity-60 cursor-default`,disabled:!1,children:`Add an AI key in Settings`})},get children(){return A(XA,{variant:`primary`,class:`w-full`,get loading(){return ye()},onClick:Oe,get disabled(){return ye()},children:`Draft with AI`})}}),null),N(e,A(j,{get when(){return Be()},get children(){var e=pj();return N(e,A(rj,{get children(){var e=fj();return N(e,Be),e}})),e}}),null),e})(),A(j,{get when(){return Ce()},get children(){var e=hj(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return n.nextSibling,N(t,()=>Ce().provider),N(e,()=>Ce().modelId,n),e}}),A(j,{get when(){return xe()},get children(){return A(oj,{get message(){return xe()}})}})]}}),D),N(n,A(nj,{title:`Issue`,get children(){return[A(tj,{label:`Title`,get children(){return A(QA,{class:`h-8 text-[13px] font-medium`,get value(){return s()},onInput:e=>c(e.currentTarget.value),placeholder:`Brief summary of the issue`})}}),A(tj,{label:`Description`,get children(){return A($A,{rows:6,get value(){return l()},onInput:e=>u(e.currentTarget.value),placeholder:`Markdown supported`})}}),A(tj,{label:`Reproduction steps`,get children(){var e=gj();return N(e,A(Ke,{get each(){return d()},children:(e,t)=>(()=>{var n=kj(),r=n.firstChild,i=r.firstChild,a=r.nextSibling;return N(r,t+1,i),N(n,A(QA,{class:`flex-1`,get value(){return e()},onInput:e=>Ue(t,e.currentTarget.value),placeholder:`Step ${t+1}`}),a),a.$$click=()=>He(t),n})()}),null),N(e,A(XA,{variant:`ghost`,class:`self-start h-6 px-2 text-[11px]`,onClick:Ve,children:`+ Add step`}),null),e}}),A(tj,{label:`Expected`,get children(){return A($A,{rows:2,get value(){return p()},onInput:e=>m(e.currentTarget.value),placeholder:`What should happen`})}}),A(tj,{label:`Actual`,get children(){return A($A,{rows:2,get value(){return h()},onInput:e=>g(e.currentTarget.value),placeholder:`What actually happens`})}}),A(tj,{label:`Impact`,get children(){return A($A,{rows:2,get value(){return _()},onInput:e=>v(e.currentTarget.value),placeholder:`Who/what is affected and how badly`})}}),A(tj,{label:`Analysis / Notes`,get children(){return A($A,{rows:3,get value(){return y()},onInput:e=>b(e.currentTarget.value),placeholder:`- Likely root cause…`})}}),A(tj,{label:`Suggested next steps`,get children(){return A($A,{rows:3,get value(){return x()},onInput:e=>S(e.currentTarget.value),placeholder:`- Concrete fix suggestion…`})}}),A(tj,{label:`Priority`,get children(){return A(ej,{get value(){return ee()},onChange:e=>C(Number(e.currentTarget.value)),get children(){return A(Ge,{get each(){return Object.entries(sj)},children:([e,t])=>(()=>{var n=Aj();return n.value=e,N(n,t),n})()})}})}}),A(j,{get when(){return a()},get fallback(){return A(oj,{message:`Connect Linear in Settings to create issues.`})},get children(){return A(tj,{label:`Team`,get children(){return A(j,{get when(){return!_e.isLoading},get fallback(){return A(ej,{disabled:!0,get children(){return jj()}})},get children(){return A(ej,{get value(){return T()},onChange:e=>te(e.currentTarget.value),get children(){return[_j(),A(Ge,{get each(){return _e.data??[]},children:e=>(()=>{var t=Aj();return N(t,()=>e.name),E(()=>t.selected=e.id===T()),E(()=>t.value=e.id),t})()})]}})}})}})}}),A(tj,{label:`Repo`,hint:`Appended as [repo=…] so Cursor works in the right repository.`,get children(){return A(QA,{get value(){return ne()},onInput:e=>k(e.currentTarget.value),placeholder:`owner/repository`})}}),A(tj,{label:`Delegate to`,get hint(){return nt(()=>re()===`local`)()?"Requires `npx linear-grab-bridge` running in the repo — track it in the Local tab.":re()===`cursor`&&!r().cursorAgentId?`Pick the Cursor agent in Settings first.`:void 0},get children(){return A(ej,{get value(){return re()},onChange:e=>ie(e.currentTarget.value),get children(){return[(()=>{var e=vj(),t=e.firstChild;return N(e,()=>r().cursorAgentName??`Cursor`,t),E(t=>{var n=!r().cursorAgentId,i=re()===`cursor`;return n!==t.e&&(e.disabled=t.e=n),i!==t.t&&(e.selected=t.t=i),t},{e:void 0,t:void 0}),e})(),(()=>{var e=yj();return E(()=>e.selected=re()===`local`),e})(),(()=>{var e=bj();return E(()=>e.selected=re()===`none`),e})()]}})}}),A(j,{get when(){return re()===`cursor`},get children(){return A(tj,{label:`Cloud model`,get hint(){return`Sent as [model=…]. Empty = ${r().cursorModel?`your default (${r().cursorModel})`:`Cursor's default`}.`},get children(){return A(QA,{get placeholder(){return r().cursorModel||`Cursor's default — e.g. claude-opus-4-8, composer`},get value(){return ce()},onInput:e=>le(e.currentTarget.value)})}})}}),A(j,{get when(){return re()===`local`},get children(){return A(tj,{label:`Local model`,hint:`Switchable while running from the Local tab.`,get children(){return A(ej,{get value(){return ae()},onChange:e=>se(e.currentTarget.value),get children(){return[(()=>{var e=xj();return E(()=>e.selected=ae()===``),e})(),(()=>{var e=Sj();return E(()=>e.selected=ae()===`opus`),e})(),(()=>{var e=Cj();return E(()=>e.selected=ae()===`sonnet`),e})(),(()=>{var e=wj();return E(()=>e.selected=ae()===`haiku`),e})()]}})}})}}),A(j,{get when(){return r().logUrl},get children(){var e=Tj(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,i=n.firstChild.nextSibling;return i.nextSibling,t.addEventListener(`change`,e=>he(e.currentTarget.checked)),N(n,()=>Math.min(500,Math.max(10,r().logLines??100)),i),E(()=>t.checked=me()),e}})]}}),D),N(D,A(j,{get when(){return Me()},get children(){return A(oj,{get message(){return Me()}})}}),null),N(D,A(j,{get when(){return Pe()},get children(){var e=Ej();return N(e,Pe),e}}),null),N(D,A(j,{get when(){return Ie()},children:t=>(()=>{var n=Mj(),r=n.firstChild;return N(r,()=>t().identifier),N(n,A(XA,{variant:`ghost`,class:`h-6 px-2 text-[11px]`,onClick:()=>{Le(null),we(null),e.onCreated()},children:`View activity`}),null),E(()=>st(r,`href`,t().url)),n})()}),null),N(D,A(XA,{variant:`primary`,get loading(){return Re.isPending},get disabled(){return!ze()},onClick:()=>Re.mutate(),children:`Create issue`}),null),n})()}ot([`click`]);function Pj(e,t,n=!1){if(!e)return null;let r=t(e);if(r instanceof Promise)return(async()=>{if(await r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=await _N(i,t,n);if(e)return e;i=n?null:i.sibling}return null})();if(r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=gN(i,t,n);if(e)return e;i=n?null:i.sibling}return null}function Fj(e,t){let n=0,r=0,i=0;do i=VN[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function Ij(e,t){return e.pos>=t?!1:e.peek()!==RN}function Lj(e){let{length:t}=e,n=new HN(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=Fj(n,i),i<u&&(l=!1),u=i,Ij(n,e)?(a=Fj(n,a),o=Fj(n,o),s=Fj(n,s),Ij(n,e)?(c=Fj(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||Rj(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function Rj(e){e.sort(zj)}function zj(e,t){return e[0]-t[0]}var Bj,Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj,Zj,Qj,$j,eM,tM,nM,rM,iM,aM,oM,sM,cM,lM,uM,dM,fM,pM,mM,hM,gM,_M,vM,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,JM,YM,XM,ZM,QM,$M,eN,tN,nN,rN,iN,aN,oN,sN,cN,lN,uN,dN,fN,pN,mN,hN,gN,_N,vN,yN,bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,YN,XN,ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,fP,pP,mP,hP,gP,_P,vP,yP,bP,xP,SP,CP,wP,TP,EP,DP,OP,kP,AP,jP,MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,JP,YP,XP,ZP,QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,MF,NF,PF,FF,IF,LF,RF,zF,BF,VF,HF,UF,WF,GF,KF,qF,JF,YF,XF,ZF,QF,$F,eI,tI,nI,rI,iI,aI,oI,sI,cI,lI,uI,dI,fI,pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,wI,TI,EI,DI,OI,kI,AI,jI,MI,NI,PI,FI,II,LI,RI,zI,BI,VI,HI,UI,WI,GI,KI,qI,JI,YI,XI,ZI,QI,$I,eL,tL,nL,rL,iL,aL,oL,sL,cL,lL,uL,dL,fL,pL,mL,hL,gL,_L,vL,yL,bL,xL,SL=t((()=>{Bj=null,Vj=()=>{if(Bj!==null)return Bj;try{Bj=window.matchMedia(`(color-gamut: p3)`).matches}catch{Bj=!1}return Bj},Hj=Vj(),Uj=e=>Hj?`color(display-p3 0.84 0.19 0.78 / ${e})`:`rgba(210, 57, 192, ${e})`,Wj=null,Gj=e=>{Wj=e},Kj=()=>Wj,qj=e=>!Wj||e!==null&&Wj.contains(e),Jj=e=>e,Yj=`data-react-grab`,Xj=`0.1.48`,Zj=`var(--rg-shadow)`,Qj=-1e3,$j=.95,eM=1500,tM=[`/components/ui/`,`/packages/ui/`,`/design-system/`,`/design-systems/`,`/primitives/`],nM=5e3,rM=8e3,iM=1e4,aM=2147483647,oM=2147483645,sM=.7,cM=1e3/60,lM=.01,uM=Uj(.4),dM=Uj(.05),fM=Uj(.5),pM=Uj(.08),mM=Uj(.15),hM=.2,gM=[`id`,`class`,`aria-label`,`data-testid`,`role`,`name`,`title`],_M=new Set([`id`,`data-testid`,`aria-label`,`href`,`src`,`alt`,`type`,`name`,`placeholder`,`role`,`for`,`action`,`method`,`title`,`disabled`,`checked`,`readonly`,`required`,`selected`,`open`]),vM=new Set([`a`,`code`,`pre`]),yM=new Set([`script`,`style`,`template`,`noscript`]),bM=[`Meta`,`Control`,`Shift`,`Alt`],xM=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]),SM=`data-react-grab-frozen`,CM=.5,wM=`data-react-grab-input`,TM=.5,EM=`copy`,DM=`comment`,OM=`edit`,kM=`superellipse(1.25)`,AM=.01,jM=1e3,MM={left:-9999,top:-9999},NM={left:`left center`,right:`right center`,top:`center top`,bottom:`center bottom`},PM=1e3,FM=`#00000000`,IM=`transparent`,LM=2e3,RM=`cubic-bezier(0.34, 1.56, 0.64, 1)`,zM=12e3,BM=9e3,VM=1e4,HM=8e3,UM=5e3,WM=1e3,GM=1.2,KM=-9999,new Set(`display.position.top.right.bottom.left.z-index.overflow.overflow-x.overflow-y.width.height.min-width.min-height.max-width.max-height.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.flex-direction.flex-wrap.justify-content.align-items.align-self.align-content.flex-grow.flex-shrink.flex-basis.order.gap.row-gap.column-gap.grid-template-columns.grid-template-rows.grid-template-areas.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-align.text-decoration-line.text-decoration-style.text-transform.text-overflow.text-shadow.white-space.word-break.overflow-wrap.vertical-align.color.background-color.background-image.background-position.background-size.background-repeat.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.box-shadow.opacity.transform.filter.backdrop-filter.object-fit.object-position`.split(`.`)),qM=e=>(e.tagName||``).toLowerCase(),YM=()=>{if(JM!==void 0)return JM;let e=document.querySelector(`script[nonce], style[nonce]`),t=e?.nonce||e?.getAttribute(`nonce`)||null;return t&&(JM=t),t},XM=[[`data-rr-block`,``],[`data-rr-ignore`,``],[`data-rr-mask`,``],[`data-sentry-block`,``],[`data-sentry-ignore`,``],[`data-sentry-mask`,``],[`data-dd-privacy`,`hidden`],[`data-fs-exclude`,``],[`data-lr-exclude`,``],[`data-hj-suppress`,``],[`data-recording-disable`,``],[`data-clarity-mask`,`true`],[`data-heap-redact-text`,``]],ZM=e=>{for(let[t,n]of XM)e.setAttribute(t,n);e.setAttribute(`data-testid`,`react-grab-overlay`),e.classList.add(`ph-no-capture`)},QM=`bippy-0.5.43`,$M=Object.defineProperty,eN=Object.prototype.hasOwnProperty,tN=()=>{},nN=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},rN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),iN=!1,oN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>iN?!0:(e&&typeof e.inject==`function`&&(aN=e.inject.toString()),!!aN?.includes(`(injected)`)),sN=new Set,cN=new Set,lN=e=>{let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:QM,checkDCE:nN,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),cN.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,sN.forEach(e=>e())),i},on:tN,onCommitFiberRoot:tN,onCommitFiberUnmount:tN,onPostCommitFiberRoot:tN,renderers:t,supportsFiber:!0,supportsFlight:!0};try{$M(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return r},set(t){if(t&&typeof t==`object`){let n=r.renderers;r=t,n.size>0&&(n.forEach((e,n)=>{cN.add(e),t.renderers.set(n,e)}),uN(e))}}});let t=window.hasOwnProperty,n=!1;$M(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{uN(e)}return r},uN=e=>{e&&sN.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=nN,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=QM,t._instrumentationIsActive=!1;let e=rN(t);if(e||(t.on=tN),t.renderers.size){t._instrumentationIsActive=!0,sN.forEach(e=>e());return}let n=t.inject,r=oN(t);r&&!e&&(iN=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return cN.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,sN.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||oN())&&e?.()}catch{}},dN=()=>eN.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),fN=e=>dN()?(uN(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):lN(e),pN=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)),mN=()=>{try{pN()&&fN()}catch{}},hN=e=>{switch(e.tag){case 1:case 11:case 0:case 14:case 15:return!0;default:return!1}},gN=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=gN(r,t,n);if(e)return e;r=n?null:r.sibling}return null},_N=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await _N(r,t,n);if(e)return e;r=n?null:r.sibling}return null},vN=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?vN(t.type||t.render):null},yN=e=>{let t=e;if(typeof t==`string`)return t;if(typeof t!=`function`&&!(typeof t==`object`&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=vN(t);return r&&(r.displayName||r.name)||null},bN=()=>{let e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;return!!e?._instrumentationIsActive||rN(e)||oN(e)},xN=e=>{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t?.renderers)for(let n of t.renderers.values())try{let t=n.findFiberByHostInstance?.(e);if(t)return t}catch{}if(typeof e==`object`&&e){if(`_reactRootContainer`in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let t in e)if(t.startsWith(`__reactContainer$`)||t.startsWith(`__reactInternalInstance$`)||t.startsWith(`__reactFiber`))return e[t]||null}return null},SN=new Set,CN=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,wN=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],TN=[`<anonymous>`,`eval`,``],EN=/\.(jsx|tsx|ts|js)$/,DN=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,ON=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,kN=/\(at [^)]+\)$/,AN=/(^|@)\S+:\d+/,jN=/^\s*at .*(\S+:\d+|\(native\))/m,MN=/^(eval@)?(\[native code\])?$/,NN=(e,t)=>{if(t?.includeInElement!==!1){let n=e.split(`
177
177
  `),r=[];for(let e of n)if(/^\s*at\s+/.test(e)){let t=IN(e,void 0)[0];t&&r.push(t)}else if(/^\s*in\s+/.test(e)){let t=e.replace(/^\s*in\s+/,``).replace(/\s*\(at .*\)$/,``);r.push({functionName:t,source:e})}else if(e.match(AN)){let t=LN(e,void 0)[0];t&&r.push(t)}return FN(r,t)}return e.match(jN)?IN(e,t):LN(e,t)},PN=e=>{if(!e.includes(`:`))return[e,void 0,void 0];let t=e.startsWith(`(`)&&/:\d+\)$/.test(e)?e.slice(1,-1):e,n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t);return n?[n[1],n[2]||void 0,n[3]||void 0]:[t,void 0,void 0]},FN=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e,IN=(e,t)=>FN(e.split(`
178
178
  `).filter(e=>!!e.match(jN)),t).map(e=>{let t=e;t.includes(`(eval `)&&(t=t.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let n=t.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],``):n;let i=PN(r?r[1]:n);return{functionName:r&&n||void 0,fileName:[`eval`,`<anonymous>`].includes(i[0])?void 0:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}),LN=(e,t)=>FN(e.split(`
@@ -27646,7 +27646,7 @@ function Nj(e) {
27646
27646
  "3. Update the Linear issue via its GraphQL API (https://api.linear.app/graphql) using the LINEAR_API_KEY env var as the Authorization header:",
27647
27647
  ` - commentCreate on issue ${o.identifier}: one-line fix summary + root cause + the PR link.`,
27648
27648
  " - Move it to review: query the team's workflowStates, then issueUpdate with the review/'In Review' stateId.",
27649
- "4. If Slack/Telegram tokens appear in the instructions above, announce there too."
27649
+ "4. Announce the finished fix on every channel whose token appears in the instructions above (Slack chat.postMessage + files upload, Telegram sendMessage/sendVideo) — include: what was broken, the one-line fix, the Linear issue link, the PR link, and the demo recording if you made one. End with \"👉 Review the PR\"."
27650
27650
  ].join("\n");
27651
27651
  await kO(`${o.identifier} — ${s()}`, t, {
27652
27652
  model: ae() || void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-grab",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "type": "module",
5
5
  "description": "Point at any React element in your dev app, draft a Linear issue with AI, delegate it to the Cursor agent, and track it live — in any browser.",
6
6
  "exports": {