linear-grab 0.17.2 → 0.17.4

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.17.2/dist/index.global.js"
29
+ src="https://cdn.jsdelivr.net/gh/ahmedbanihanibh/linear-grab@v0.17.4/dist/index.global.js"
30
30
  crossOrigin="anonymous"
31
31
  strategy="afterInteractive"
32
32
  />
@@ -28,7 +28,7 @@ const flag = (name, fallback) => {
28
28
  const PORT = Number(flag('--port', '4577'));
29
29
  const DIR = flag('--dir', process.cwd());
30
30
  const CLAUDE_BIN = flag('--claude', 'claude');
31
- const VERSION = '0.15.1';
31
+ const VERSION = '0.18.0';
32
32
 
33
33
  /** Best-effort command runner (git/gh introspection). Never throws. */
34
34
  function run(cmd, args, cwd = DIR) {
@@ -588,6 +588,7 @@ createServer(async (req, res) => {
588
588
  const body = await readBody(req);
589
589
  const urls = (Array.isArray(body.urls) ? body.urls : []).slice(0, 20);
590
590
  const statuses = {};
591
+ const previews = {};
591
592
  await Promise.all(
592
593
  urls.map(async (u) => {
593
594
  const prUrl = String(u);
@@ -595,21 +596,29 @@ createServer(async (req, res) => {
595
596
  const cached = prStatusCache.get(prUrl);
596
597
  if (cached && Date.now() - cached.at < 60_000) {
597
598
  statuses[prUrl] = cached.state;
599
+ if (cached.preview) previews[prUrl] = cached.preview;
598
600
  return;
599
601
  }
600
- const out = await run('gh', ['pr', 'view', prUrl, '--json', 'state']);
602
+ // comments carry the Vercel bot's preview link; statusCheckRollup
603
+ // has it too but comments survive check re-runs.
604
+ const out = await run('gh', ['pr', 'view', prUrl, '--json', 'state,comments,body']);
601
605
  try {
602
- const state = JSON.parse(out ?? '').state;
606
+ const parsed = JSON.parse(out ?? '');
607
+ const state = parsed.state;
608
+ const haystack =
609
+ (parsed.comments ?? []).map((c) => c.body ?? '').join('\n') + '\n' + (parsed.body ?? '');
610
+ const preview = (haystack.match(/https:\/\/[a-z0-9-]+\.vercel\.app[^\s)"\]]*/i) ?? [])[0] ?? null;
603
611
  if (state) {
604
- prStatusCache.set(prUrl, { state, at: Date.now() });
612
+ prStatusCache.set(prUrl, { state, preview, at: Date.now() });
605
613
  statuses[prUrl] = state;
614
+ if (preview) previews[prUrl] = preview;
606
615
  }
607
616
  } catch {
608
617
  /* gh missing / not accessible */
609
618
  }
610
619
  }),
611
620
  );
612
- return json(res, 200, { statuses });
621
+ return json(res, 200, { statuses, previews });
613
622
  }
614
623
  // Fast-merge: after reviewing the demo, one click merges the PR via gh.
615
624
  if (req.method === 'POST' && url.pathname === '/pr/merge') {
@@ -83,8 +83,9 @@ Learn more: \x1B[34m${n}\x1B[0m
83
83
  `),{name:`GatewayAuthenticationError`})}function Uw(e){return{inputTokens:e.inputTokens.total,inputTokenDetails:{noCacheTokens:e.inputTokens.noCache,cacheReadTokens:e.inputTokens.cacheRead,cacheWriteTokens:e.inputTokens.cacheWrite},outputTokens:e.outputTokens.total,outputTokenDetails:{textTokens:e.outputTokens.text,reasoningTokens:e.outputTokens.reasoning},totalTokens:Gw(e.inputTokens.total,e.outputTokens.total),raw:e.raw}}function Ww(){return{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}}function Gw(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function Kw(){return(globalThis==null?void 0:globalThis.performance)?.now()??Date.now()}async function qw(e){await Promise.all(Wp(e.callbacks).map(async t=>{try{await t?.(e.event)}catch{}}))}function Jw({error:e,exponentialBackoffDelay:t}){let n=ti.isInstance(e)?e.responseHeaders:ti.isInstance(e.cause)?e.cause.responseHeaders:void 0;if(!n)return t;let r,i=n[`retry-after-ms`];if(i){let e=parseFloat(i);Number.isNaN(e)||(r=e)}let a=n[`retry-after`];if(a&&r===void 0){let e=parseFloat(a);r=Number.isNaN(e)?Date.parse(a)-Date.now():e*1e3}return r!=null&&!Number.isNaN(r)&&0<=r&&(r<60*1e3||r<t)?r:t}function Yw({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new DT({parameter:`maxRetries`,value:e,message:`maxRetries must be an integer`});if(e<0)throw new DT({parameter:`maxRetries`,value:e,message:`maxRetries must be >= 0`})}let n=e??2;return{maxRetries:n,retry:UE({maxRetries:n,abortSignal:t})}}function Xw(e){let t=[`ROOT`],n=-1,r=null,i=0;function a(e){return e>=`0`&&e<=`9`||e>=`A`&&e<=`F`||e>=`a`&&e<=`f`}function o(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function s(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case`ROOT`:o(u,l,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=l,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(u){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:o(u,l,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:s(u,l);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=l;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=l}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=l,t.pop();break;default:n=l,o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=l,t.pop();break;default:n=l;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),u===`u`?(i=0,t.push(`INSIDE_STRING_UNICODE_ESCAPE`)):n=l;break;case`INSIDE_STRING_UNICODE_ESCAPE`:a(u)&&(i++,i===4&&(t.pop(),n=l));break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=l;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,l+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?s(u,l):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l)):n=l;break}}}let l=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:l+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:l+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:l+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?l+=`true`.slice(t.length):`false`.startsWith(t)?l+=`false`.slice(t.length):`null`.startsWith(t)&&(l+=`null`.slice(t.length))}}return l}async function Zw(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await Dh({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await Dh({text:Xw(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function Qw(...e){return async t=>{await Promise.allSettled(e.map(async e=>{await e?.(t)}))}}function $w(){return typeof process<`u`&&process.release?.name===`node`}async function eT(){if($w())return ZE??=Promise.resolve(tT(`node:diagnostics_channel`)),ZE}function tT(e){let t=globalThis.process;try{return(t?.getBuiltinModule)?.call(t,e)}catch{return}}async function nT(e,t){let n=await eT(),r=(n?.tracingChannel)?.call(n,XE);if(r==null||r.hasSubscribers===!1)return await t();let i,a,o,s=!1,c=!1,l=()=>{try{i=Promise.resolve(t())}catch(e){i=Promise.reject(e)}return i=i.then(e=>(a=e,s=!0,e),e=>{throw o=e,c=!0,e}),i};try{return await r.tracePromise(l,e)}catch{if(c)throw o;return s?a:i==null?await t():await i}}function rT({message:e,completion:t}){if(!$w())return;let n=tT(`node:diagnostics_channel`),r=tT(`node:async_hooks`),i=(n?.tracingChannel)?.call(n,XE);if(i==null||i.hasSubscribers===!1||r==null){Promise.resolve(t).catch(()=>{});return}let a=e,o,s=!1,c=e=>{try{e()}catch{}},l=({result:e,error:t})=>{s||(s=!0,t!==void 0&&(a.error=t,c(()=>i.error.publish(a))),e!==void 0&&(a.result=e),c(()=>i.asyncEnd.publish(a)))};return c(()=>{i.start.runStores(a,()=>{o=new r.AsyncResource(`ai.telemetry`)})}),c(()=>i.end.publish(a)),Promise.resolve(t).then(e=>l({result:e}),e=>l({error:e})),{run:e=>o==null?e():o.runInAsyncScope(e)}}function iT(){return globalThis.AI_SDK_TELEMETRY_INTEGRATIONS??[]}function aT(e,t){return Object.assign(Object.create(Object.getPrototypeOf(e)),e,t)}function oT({telemetry:e}){if(e?.isEnabled===!1)return{};let t=e?.integrations,n=t==null?iT():Wp(t),r={recordInputs:e?.recordInputs,recordOutputs:e?.recordOutputs,functionId:e?.functionId},i=e=>{let t=Qw(...n.map(t=>t[e]?.bind(t)).filter(Boolean).map(e=>t=>e(aT(t,r))));return async e=>{await t(e)}},a=n.map(e=>e.executeLanguageModelCall?.bind(e)).filter(Boolean),o=n.map(e=>e.executeTool?.bind(e)).filter(Boolean);return{runInTracingChannelSpan:async({type:e,event:t,execute:n})=>await nT({type:e,event:aT(t,r)},n),startTracingChannelContext:({type:e,event:t,completion:n})=>rT({message:{type:e,event:aT(t,r)},completion:n}),onStart:i(`onStart`),onStepStart:i(`onStepStart`),onLanguageModelCallStart:i(`onLanguageModelCallStart`),onLanguageModelCallEnd:i(`onLanguageModelCallEnd`),onToolExecutionStart:i(`onToolExecutionStart`),onToolExecutionEnd:i(`onToolExecutionEnd`),onStepEnd:Qw(i(`onStepEnd`),i(`onStepFinish`)),onObjectStepStart:i(`onObjectStepStart`),onObjectStepEnd:i(`onObjectStepEnd`),onEmbedStart:i(`onEmbedStart`),onEmbedEnd:i(`onEmbedEnd`),onRerankStart:i(`onRerankStart`),onRerankEnd:i(`onRerankEnd`),onEnd:i(`onEnd`),onAbort:i(`onAbort`),onError:i(`onError`),executeLanguageModelCall:async({execute:e,...t})=>{let n=aT(t,r),i=e;for(let e of a){let t=i;i=()=>e({...n,execute:t})}return await nT({type:`languageModelCall`,event:n},i)},executeTool:async({execute:e,...t})=>{let n=aT(t,r),i=e;for(let e of o){let t=i;i=()=>e({...n,execute:t})}return await i()}}}function sT(e,t){let n=new Headers(e??{});for(let[e,r]of Object.entries(t))n.has(e)||n.set(e,r);return n}function cT({status:e,statusText:t,headers:n,stream:r}){return new Response(r.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:sT(n,{"content-type":`text/plain; charset=utf-8`})})}function lT({response:e,status:t,statusText:n,headers:r,stream:i}){let a=t??200;n===void 0?e.writeHead(a,r):e.writeHead(a,n,r);let o=i.getReader();(async()=>{try{for(;;){let{done:t,value:n}=await o.read();if(t)break;let r=e.write(n),i=e.flush;typeof i==`function`&&i.call(e),r||await new Promise(t=>{e.once(`drain`,t)})}}catch(e){throw e}finally{e.end()}})()}function uT({response:e,status:t,statusText:n,headers:r,stream:i}){lT({response:e,status:t,statusText:n,headers:Object.fromEntries(sT(r,{"content-type":`text/plain; charset=utf-8`}).entries()),stream:i.pipeThrough(new TextEncoderStream)})}function dT(e){return fT(e.pipeThrough(new TransformStream))}function fT(e){return e[Symbol.asyncIterator]=function(){let e=this.getReader(),t=!1;async function n(n){if(!t){t=!0;try{n&&await e.cancel?.call(e)}finally{try{e.releaseLock()}catch{}}}}return{async next(){if(t)return{done:!0,value:void 0};let{done:r,value:i}=await e.read();return r?(await n(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(e){throw await n(!0),e}}},e}function pT(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function mT(){let e=[],t=null,n=!1,r=pT(),i=()=>{n=!0,r.resolve(),e.forEach(e=>e.cancel()),e=[],t?.close()},a=async()=>{if(n&&e.length===0){t?.close();return}if(e.length===0)return r=pT(),await r.promise,await a();try{let{value:r,done:i}=await e[0].read();i?(e.shift(),e.length===0&&n?t?.close():await a()):t?.enqueue(r)}catch(n){t?.error(n),e.shift(),i()}};return{stream:new ReadableStream({start(e){t=e},pull:a,async cancel(){for(let t of e)await t.cancel();e=[],n=!0}}),addStream:t=>{if(n)throw Error(`Cannot add inner stream: outer stream is closed`);e.push(t.getReader()),r.resolve()},close:()=>{n=!0,r.resolve(),e.length===0&&t?.close()},terminate:i}}function hT({output:e,schema:t,enumValues:n}){switch(e){case`object`:return $E(yh(t));case`array`:return eD(yh(t));case`enum`:return tD(n);case`no-schema`:return QE;default:throw Error(`Unsupported output: ${e}`)}}async function gT(e,t,n){let r=await Dh({text:e});if(!r.success)throw new UT({message:`No object generated: could not parse the response.`,cause:r.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=await t.validateFinalResult(r.value,{text:e,response:n.response,usage:n.usage});if(!i.success)throw new UT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.value}async function _T(e,t,n,r){try{return await gT(e,t,r)}catch(i){if(n!=null&&UT.isInstance(i)&&(ji.isInstance(i.cause)||la.isInstance(i.cause))){let a=await n({text:e,error:i.cause});if(a===null)throw i;return await gT(a,t,r)}throw i}}function vT({output:e,schema:t,schemaName:n,schemaDescription:r,enumValues:i}){if(e!=null&&e!==`object`&&e!==`array`&&e!==`enum`&&e!==`no-schema`)throw new DT({parameter:`output`,value:e,message:`Invalid output type.`});if(e===`no-schema`){if(t!=null)throw new DT({parameter:`schema`,value:t,message:`Schema is not supported for no-schema output.`});if(r!=null)throw new DT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for no-schema output.`});if(n!=null)throw new DT({parameter:`schemaName`,value:n,message:`Schema name is not supported for no-schema output.`});if(i!=null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are not supported for no-schema output.`})}if(e===`object`){if(t==null)throw new DT({parameter:`schema`,value:t,message:`Schema is required for object output.`});if(i!=null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are not supported for object output.`})}if(e===`array`){if(t==null)throw new DT({parameter:`schema`,value:t,message:`Element schema is required for array output.`});if(i!=null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are not supported for array output.`})}if(e===`enum`){if(t!=null)throw new DT({parameter:`schema`,value:t,message:`Schema is not supported for enum output.`});if(r!=null)throw new DT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for enum output.`});if(n!=null)throw new DT({parameter:`schemaName`,value:n,message:`Schema name is not supported for enum output.`});if(i==null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are required for enum output.`});for(let e of i)if(typeof e!=`string`)throw new DT({parameter:`enumValues`,value:e,message:`Enum values must be strings.`})}}function yT(e,t){if(e===t)return!0;if(e==null||t==null)return!1;if(typeof e!=`object`&&typeof t!=`object`)return e===t;if(e.constructor!==t.constructor)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!yT(e[n],t[n]))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||!yT(e[i],t[i]))return!1;return!0}function bT(e){let{model:t,output:n=`object`,instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,maxRetries:c,abortSignal:l,headers:u,experimental_repairText:d,experimental_telemetry:f,telemetry:p=f,experimental_download:m,providerOptions:h,onStart:g,experimental_onStart:_,onStepStart:v,experimental_onStepStart:y,onStepEnd:b,onStepFinish:x,onError:S=({error:e})=>{console.error(e)},onFinish:C,_internal:{generateId:w=nD,currentDate:T=()=>new Date,now:E=Kw}={},...D}=e,O=`enum`in e&&e.enum?e.enum:void 0,{schema:k,schemaDescription:ee,schemaName:te}=`schema`in e?e:{};return vT({output:n,schema:k,schemaName:te,schemaDescription:ee,enumValues:O}),new rD({model:t,telemetry:p,headers:u,settings:D,maxRetries:c,abortSignal:l,outputStrategy:hT({output:n,schema:k,enumValues:O}),instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,schemaName:te,schemaDescription:ee,providerOptions:h,repairText:d,onStart:g??_,onStepStart:v??y,onStepFinish:b??x,onError:S,onFinish:C,download:m,generateId:w,currentDate:T,now:E})}var xT,ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE,qE,JE,YE,XE,ZE,QE,$E,eD,tD,nD,rD,iD,aD=t((()=>{Qg(),ga(),ow(),Fd(),xT=Object.defineProperty,ST=(e,t)=>{for(var n in t)xT(e,n,{get:t[n],enumerable:!0})},CT=`AI_InvalidArgumentError`,wT=`vercel.ai.error.${CT}`,TT=Symbol.for(wT),DT=class extends Yr{constructor({parameter:e,value:t,message:n}){super({name:CT,message:`Invalid argument for parameter ${e}: ${n}`}),this[ET]=!0,this.parameter=e,this.value=t}static isInstance(e){return Yr.hasMarker(e,wT)}},ET=TT,OT=`AI_InvalidStreamPartError`,`${OT}`,kT=`AI_InvalidToolApprovalError`,`${kT}`,AT=`AI_InvalidToolApprovalSignatureError`,`${AT}`,jT=`AI_InvalidToolInputError`,`${jT}`,MT=`AI_ToolCallNotFoundForApprovalError`,`${MT}`,NT=`AI_MissingToolResultsError`,PT=`vercel.ai.error.${NT}`,FT=Symbol.for(PT),LT=class extends Yr{constructor({toolCallIds:e}){super({name:NT,message:`Tool result${e.length>1?`s are`:` is`} missing for tool call${e.length>1?`s`:``} ${e.join(`, `)}.`}),this[IT]=!0,this.toolCallIds=e}static isInstance(e){return Yr.hasMarker(e,PT)}},IT=FT,RT=`AI_NoImageGeneratedError`,`${RT}`,zT=`AI_NoObjectGeneratedError`,BT=`vercel.ai.error.${zT}`,VT=Symbol.for(BT),UT=class extends Yr{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:zT,message:e,cause:t}),this[HT]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return Yr.hasMarker(e,BT)}},HT=VT,WT=`AI_NoOutputGeneratedError`,`${WT}`,GT=`AI_NoSpeechGeneratedError`,`${GT}`,KT=`AI_NoTranscriptGeneratedError`,`${KT}`,qT=`AI_NoVideoGeneratedError`,`${qT}`,JT=`AI_NoSuchToolError`,`${JT}`,YT=`AI_ToolCallRepairError`,`${YT}`,XT=class extends Yr{constructor(e){super({name:`AI_UnsupportedModelVersionError`,message:`Unsupported model version ${e.version} for provider "${e.provider}" and model "${e.modelId}". AI SDK 5 only supports models that implement specification version "v2".`}),this.version=e.version,this.provider=e.provider,this.modelId=e.modelId}},ZT=`AI_UIMessageStreamError`,`${ZT}`,QT=`AI_InvalidDataContentError`,$T=`vercel.ai.error.${QT}`,eE=Symbol.for($T),nE=class extends Yr{constructor({content:e,cause:t,message:n=`Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof e}.`}){super({name:QT,message:n,cause:t}),this[tE]=!0,this.content=e}static isInstance(e){return Yr.hasMarker(e,$T)}},tE=eE,rE=`AI_InvalidMessageRoleError`,iE=`vercel.ai.error.${rE}`,aE=Symbol.for(iE),sE=class extends Yr{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:rE,message:t}),this[oE]=!0,this.role=e}static isInstance(e){return Yr.hasMarker(e,iE)}},oE=aE,cE=`AI_MessageConversionError`,`${cE}`,lE=`AI_RetryError`,uE=`vercel.ai.error.${lE}`,dE=Symbol.for(uE),pE=class extends Yr{constructor({message:e,reason:t,errors:n}){super({name:lE,message:e}),this[fE]=!0,this.reason=t,this.errors=n,this.lastError=n[n.length-1]}static isInstance(e){return Yr.hasMarker(e,uE)}},fE=dE,mE=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,hE=!1,gE=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}hE||(hE=!0,console.info(mE));for(let t of e.warnings){let n=sw({warning:t,provider:e.provider,model:e.model});typeof process<`u`&&typeof process.emitWarning==`function`?process.emitWarning(n,{type:t.type===`deprecated`?`DeprecationWarning`:`Warning`}):console.warn(n)}}},_E=`7.0.22`,vE=async({url:e,maxBytes:t,abortSignal:n})=>{let r=e.toString();try{let e=await fm({url:r,headers:xm({},`ai-sdk/${_E}`,ym()),abortSignal:n});if(!e.ok)throw await am(e),new og({url:r,statusCode:e.status,statusText:e.statusText});return{data:await pm({response:e,url:r,maxBytes:t??cg}),mediaType:e.headers.get(`content-type`)??void 0}}catch(e){throw og.isInstance(e)?e:new og({url:r,cause:e})}},yE=(e=vE)=>t=>Promise.all(t.map(async t=>t.isUrlSupportedByModel?null:await e(t))),bE={jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,avif:`image/avif`,heic:`image/heic`,bmp:`image/bmp`,tiff:`image/tiff`,tif:`image/tiff`,pdf:`application/pdf`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`},xE=Du(()=>B([lu(),I(),L(),cu(),_u(I(),xE.optional()),R(xE)])),SE=_u(I(),_u(I(),xE.optional())),CE=B([I(),Mu(Uint8Array),Mu(ArrayBuffer),ku(Sm,{message:`Must be a Buffer`})]),wE=_u(I(),I()),TE=z({type:H(`text`),text:I(),providerOptions:SE.optional()}),EE=z({type:H(`image`),image:B([CE,Mu(URL),wE]),mediaType:I().optional(),providerOptions:SE.optional()}),DE=mu(`type`,[z({type:H(`data`),data:CE}),z({type:H(`url`),url:Mu(URL)}),z({type:H(`reference`),reference:wE}),z({type:H(`text`),text:I()})]),OE=mu(`type`,[z({type:H(`data`),data:CE}),z({type:H(`url`),url:Mu(URL)})]),kE=z({type:H(`file`),data:B([DE,CE,Mu(URL),wE]),filename:I().optional(),mediaType:I(),providerOptions:SE.optional()}),AE=z({type:H(`reasoning`),text:I(),providerOptions:SE.optional()}),jE=z({type:H(`custom`),kind:I().transform(e=>e),providerOptions:SE.optional()}),ME=z({type:H(`reasoning-file`),data:B([OE,CE,Mu(URL)]),mediaType:I(),providerOptions:SE.optional()}),NE=z({type:H(`tool-call`),toolCallId:I(),toolName:I(),input:du(),providerOptions:SE.optional(),providerExecuted:cu().optional()}),PE=mu(`type`,[z({type:H(`text`),value:I(),providerOptions:SE.optional()}),z({type:H(`json`),value:xE,providerOptions:SE.optional()}),z({type:H(`execution-denied`),reason:I().optional(),providerOptions:SE.optional()}),z({type:H(`error-text`),value:I(),providerOptions:SE.optional()}),z({type:H(`error-json`),value:xE,providerOptions:SE.optional()}),z({type:H(`content`),value:R(B([z({type:H(`text`),text:I(),providerOptions:SE.optional()}),z({type:H(`file`),data:DE,mediaType:I(),filename:I().optional(),providerOptions:SE.optional()}),z({type:H(`file-data`),data:I(),mediaType:I(),filename:I().optional(),providerOptions:SE.optional()}),z({type:H(`file-url`),url:I(),mediaType:I().optional(),providerOptions:SE.optional()}),z({type:H(`file-id`),fileId:B([I(),_u(I(),I())]),providerOptions:SE.optional()}),z({type:H(`file-reference`),providerReference:_u(I(),I()),providerOptions:SE.optional()}),z({type:H(`image-data`),data:I(),mediaType:I(),providerOptions:SE.optional()}),z({type:H(`image-url`),url:I(),providerOptions:SE.optional()}),z({type:H(`image-file-id`),fileId:B([I(),_u(I(),I())]),providerOptions:SE.optional()}),z({type:H(`image-file-reference`),providerReference:_u(I(),I()),providerOptions:SE.optional()}),z({type:H(`custom`),providerOptions:SE.optional()})]))})]),FE=z({type:H(`tool-result`),toolCallId:I(),toolName:I(),output:PE,providerOptions:SE.optional()}),IE=z({type:H(`tool-approval-request`),approvalId:I(),toolCallId:I()}),LE=z({type:H(`tool-approval-response`),approvalId:I(),approved:cu(),reason:I().optional()}),RE=z({role:H(`system`),content:I(),providerOptions:SE.optional()}),zE=z({role:H(`user`),content:B([I(),R(B([TE,EE,kE]))]),providerOptions:SE.optional()}),BE=z({role:H(`assistant`),content:B([I(),R(B([TE,jE,kE,AE,ME,NE,FE,IE]))]),providerOptions:SE.optional()}),VE=z({role:H(`tool`),content:R(B([FE,LE])),providerOptions:SE.optional()}),HE=B([RE,zE,BE,VE]),UE=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:n=2,abortSignal:r}={})=>Wg({maxRetries:e,initialDelayInMs:t,backoffFactor:n,abortSignal:r,shouldRetry:e=>e instanceof Error&&(ti.isInstance(e)&&e.isRetryable===!0||cS.isInstance(e)&&e.isRetryable===!0),getDelayInMs:({error:e,exponentialBackoffDelay:t})=>Jw({error:e,exponentialBackoffDelay:t}),createRetryError:({message:e,reason:t,errors:n})=>new pE({message:e,reason:t,errors:n})}),WE={},ST(WE,{array:()=>qE,choice:()=>JE,json:()=>YE,object:()=>KE,text:()=>GE}),GE=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),KE=({schema:e,name:t,description:n})=>{let r=yh(e);return{name:`object`,responseFormat:Ph(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await Dh({text:e});if(!n.success)throw new UT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await Th({value:n.value,schema:r});if(!i.success)throw new UT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await Zw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},qE=({element:e,name:t,description:n})=>{let r=yh(e);return{name:`array`,responseFormat:Ph(r.jsonSchema).then(e=>{let{$schema:r,...i}=e;return{type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:i}},required:[`elements`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:e},t){let n=await Dh({text:e});if(!n.success)throw new UT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=n.value;if(typeof i!=`object`||!i||!(`elements`in i)||!Array.isArray(i.elements))throw new UT({message:`No object generated: response did not match schema.`,cause:new la({value:i,cause:`response must be an object with an elements array`}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let a=[];for(let n of i.elements){let i=await Th({value:n,schema:r});if(!i.success)throw new UT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});a.push(i.value)}return a},async parsePartialOutput({text:e}){let t=await Zw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let e=t.value;if(typeof e!=`object`||!e||!(`elements`in e)||!Array.isArray(e.elements))return;let n=t.state===`repaired-parse`&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of n){let t=await Th({value:e,schema:r});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(t!=null)for(;e<t.length;e++)n.enqueue(t[e])}})}}},JE=({options:e,name:t,description:n})=>({name:`choice`,responseFormat:Promise.resolve({type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:t},n){let r=await Dh({text:t});if(!r.success)throw new UT({message:`No object generated: could not parse the response.`,cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=r.value;if(typeof i!=`object`||!i||!(`result`in i)||typeof i.result!=`string`||!e.includes(i.result))throw new UT({message:`No object generated: response did not match schema.`,cause:new la({value:i,cause:`response must be an object that contains a choice value.`}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.result},async parsePartialOutput({text:t}){let n=await Zw(t);switch(n.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let t=n.value;if(typeof t!=`object`||!t||!(`result`in t)||typeof t.result!=`string`)return;let r=e.filter(e=>e.startsWith(t.result));return n.state===`successful-parse`?r.includes(t.result)?{partial:t.result}:void 0:r.length===1?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),YE=({name:e,description:t}={})=>({name:`json`,responseFormat:Promise.resolve({type:`json`,...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:e},t){let n=await Dh({text:e});if(!n.success)throw new UT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await Zw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return t.value===void 0?void 0:{partial:t.value}}},createElementStreamTransform(){}}),XE=`ai:telemetry`,new TextEncoder,new TextEncoder,lg({prefix:`aitxt`,size:24}),lg({prefix:`call`,size:24}),TransformStream,_u(I(),xE.optional()),lg({prefix:`aitxt`,size:24}),lg({prefix:`call`,size:24}),lg({prefix:`aitxt`,size:24}),lg({prefix:`call`,size:24}),_u(I(),xE.optional()),_u(I(),I()),lg({prefix:`call`,size:24}),lg({prefix:`call`,size:24}),QE={type:`no-schema`,jsonSchema:async()=>void 0,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(e,t){return e===void 0?{success:!1,error:new UT({message:`No object generated: response did not match schema.`,text:t.text,response:t.response,usage:t.usage,finishReason:t.finishReason})}:{success:!0,value:e}},createElementStream(){throw new ha({functionality:`element streams in no-schema mode`})}},$E=e=>({type:`object`,jsonSchema:async()=>await e.jsonSchema,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(t){return Th({value:t,schema:e})},createElementStream(){throw new ha({functionality:`element streams in object mode`})}}),eD=e=>({type:`array`,jsonSchema:async()=>{let{$schema:t,...n}=await e.jsonSchema;return{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:n}},required:[`elements`],additionalProperties:!1}},async validatePartialResult({value:t,latestObject:n,isFirstDelta:r,isFinalDelta:i}){if(!Wr(t)||!Ur(t.elements))return{success:!1,error:new la({value:t,cause:`value must be an object that contains an array of elements`})};let a=t.elements,o=[];for(let t=0;t<a.length;t++){let n=a[t],r=await Th({value:n,schema:e});if(!(t===a.length-1&&!i)){if(!r.success)return r;o.push(r.value)}}let s=n?.length??0,c=``;return r&&(c+=`[`),s>0&&(c+=`,`),c+=o.slice(s).map(e=>JSON.stringify(e)).join(`,`),i&&(c+=`]`),{success:!0,value:{partial:o,textDelta:c}}},async validateFinalResult(t){if(!Wr(t)||!Ur(t.elements))return{success:!1,error:new la({value:t,cause:`value must be an object that contains an array of elements`})};let n=t.elements,r=[];for(let t of n){let n=await Th({value:t,schema:e});if(!n.success)return n;r.push(n.value)}return{success:!0,value:r}},createElementStream(e){let t=0;return dT(e.pipeThrough(new TransformStream({transform(e,n){switch(e.type){case`object`:{let r=e.object;for(;t<r.length;t++)n.enqueue(r[t]);break}case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}}),tD=e=>({type:`enum`,jsonSchema:async()=>({$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1}),async validateFinalResult(t){if(!Wr(t)||typeof t.result!=`string`)return{success:!1,error:new la({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let n=t.result;return e.includes(n)?{success:!0,value:n}:{success:!1,error:new la({value:t,cause:`value must be a string in the enum`})}},async validatePartialResult({value:t,textDelta:n}){if(!Wr(t)||typeof t.result!=`string`)return{success:!1,error:new la({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let r=t.result,i=e.filter(e=>e.startsWith(r));return t.result.length===0||i.length===0?{success:!1,error:new la({value:t,cause:`value must be a string in the enum`})}:{success:!0,value:{partial:i.length>1?r:i[0],textDelta:n}}},createElementStream(){throw new ha({functionality:`element streams in enum mode`})}}),lg({prefix:`aiobj`,size:24}),nD=lg({prefix:`aiobj`,size:24}),rD=class{constructor({model:e,headers:t,telemetry:n,settings:r,maxRetries:i,abortSignal:a,outputStrategy:o,instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d,schemaName:f,schemaDescription:p,providerOptions:m,repairText:h,onStart:g,onStepStart:_,onStepFinish:v,onError:y,onFinish:b,download:x,generateId:S,currentDate:C,now:w}){this._object=new Jh,this._usage=new Jh,this._providerMetadata=new Jh,this._warnings=new Jh,this._request=new Jh,this._response=new Jh,this._finishReason=new Jh;let T=Tw(e),{maxRetries:E,retry:D}=Yw({maxRetries:i,abortSignal:a}),O=Bw(r),k=oT({telemetry:n}),ee=this,te=mT(),A=new TransformStream({transform(e,t){t.enqueue(e),e.type===`error`&&y({error:Hw(e.error)})}});this.baseStream=te.stream.pipeThrough(A);let ne=S();(async()=>{let e=await o.jsonSchema();await qw({event:{callId:ne,operationId:`ai.streamObject`,provider:T.provider,modelId:T.modelId,system:s??c,prompt:l,messages:u,maxOutputTokens:O.maxOutputTokens,temperature:O.temperature,topP:O.topP,topK:O.topK,presencePenalty:O.presencePenalty,frequencyPenalty:O.frequencyPenalty,seed:O.seed,maxRetries:E,headers:t,providerOptions:m,output:o.type,schema:e,schemaName:f,schemaDescription:p},callbacks:[g,k.onStart]});let n=await Vw({instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d}),i={responseFormat:{type:`json`,schema:e,name:f,description:p},...Bw(r),prompt:await Mw({prompt:n,supportedUrls:await T.supportedUrls,download:x,provider:T.provider.split(`.`)[0]}),providerOptions:m,abortSignal:a,headers:t,includeRawChunks:!1};await qw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,providerOptions:m,headers:t,promptMessages:i.prompt},callbacks:[_,k.onObjectStepStart]});let y={transform:(e,t)=>{switch(e.type){case`text-delta`:t.enqueue(e.delta);break;case`response-metadata`:case`finish`:case`error`:case`stream-start`:t.enqueue(e);break}}},A=w(),{stream:re,response:ie,request:ae}=await D(()=>T.doStream(i));ee._request.resolve(ae??{});let oe,se=Ww(),ce,le,ue,de,fe,pe=``,me=``,he={id:S(),timestamp:C(),modelId:T.modelId},ge,_e,ve=!0,ye=!0,be=re.pipeThrough(new TransformStream(y)).pipeThrough(new TransformStream({async transform(e,t){if(typeof e==`object`&&e.type===`stream-start`){oe=e.warnings;return}if(ve&&=(fe=w()-A,!1),typeof e==`string`){pe+=e,me+=e;let{value:n,state:r}=await Zw(pe);if(n!==void 0&&!yT(ge,n)){let e=await o.validatePartialResult({value:n,textDelta:me,latestObject:_e,isFirstDelta:ye,isFinalDelta:r===`successful-parse`});e.success&&!yT(_e,e.value.partial)&&(ge=n,_e=e.value.partial,t.enqueue({type:`object`,object:_e}),t.enqueue({type:`text-delta`,textDelta:e.value.textDelta}),me=``,ye=!1)}return}switch(e.type){case`response-metadata`:he={id:e.id??he.id,timestamp:e.timestamp??he.timestamp,modelId:e.modelId??he.modelId};break;case`finish`:me!==``&&t.enqueue({type:`text-delta`,textDelta:me}),ce=e.finishReason.unified,se=Uw(e.usage),le=e.providerMetadata,t.enqueue({...e,finishReason:e.finishReason.unified,usage:se,response:he}),gE({warnings:oe??[],provider:T.provider,model:T.modelId}),ee._usage.resolve(se),ee._providerMetadata.resolve(le),ee._warnings.resolve(oe),ee._response.resolve({...he,headers:ie?.headers}),ee._finishReason.resolve(ce??`other`);try{ue=await _T(pe,o,h,{response:he,usage:se,finishReason:ce}),ee._object.resolve(ue)}catch(e){de=e,ee._object.reject(e)}break;default:t.enqueue(e);break}},async flush(e){try{let e=se??{promptTokens:NaN,completionTokens:NaN,totalTokens:NaN};await qw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,finishReason:ce??`other`,usage:e,objectText:pe,msToFirstChunk:fe,reasoning:void 0,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[v,k.onObjectStepEnd]}),await qw({event:{callId:ne,object:ue,error:de,reasoning:void 0,finishReason:ce??`other`,usage:e,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[b,k.onEnd]})}catch(t){e.enqueue({type:`error`,error:t})}}}));te.addStream(be)})().catch(async e=>{await k.onError?.call(k,{callId:ne,error:e}),te.addStream(new ReadableStream({start(t){t.enqueue({type:`error`,error:e}),t.close()}}))}).finally(()=>{te.close()}),this.outputStrategy=o}get object(){return this._object.promise}get usage(){return this._usage.promise}get providerMetadata(){return this._providerMetadata.promise}get warnings(){return this._warnings.promise}get request(){return this._request.promise}get response(){return this._response.promise}get finishReason(){return this._finishReason.promise}get partialObjectStream(){return dT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`object`:t.enqueue(e.object);break;case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get elementStream(){return this.outputStrategy.createElementStream(this.baseStream)}get textStream(){return dT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`text-delta`:t.enqueue(e.textDelta);break;case`object`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get fullStream(){return dT(this.baseStream)}pipeTextStreamToResponse(e,t){uT({response:e,stream:this.textStream,...t})}toTextStreamResponse(e){return cT({stream:this.textStream,...e})}},iD=`AI_NoSuchProviderError`,`${iD}`,lg({prefix:`call`,size:24})})),oD=t((()=>{Op(),Op()})),sD,cD=t((()=>{oD(),sD=Ep({title:Cp().describe(`Concise, specific issue title. Imperative or descriptive, no trailing period.`),description:Cp().describe(`Issue body in Linear markdown: a short problem summary and relevant context. Do NOT include repro steps, expected/actual, or source location — those are separate fields.`),reproSteps:Tp(Cp()).describe(`Ordered reproduction steps, each a single action.`),expected:Cp().describe(`Expected behavior, one or two sentences.`),actual:Cp().describe(`Actual (buggy) behavior, one or two sentences.`),impact:Cp().describe(`Who/what is affected and how badly, 1-2 sentences (e.g. "Cosmetic/UX polish issue — doesn't block anything but feels glitchy.").`),analysisNotes:Cp().describe(`Markdown bullet list ("- …") of likely root-cause analysis based on the source context. Empty string when there is nothing substantive to say.`),suggestedNextSteps:Cp().describe(`Markdown bullet list of concrete, actionable fix suggestions the coding agent should consider first.`),priority:wp().int().min(0).max(4).describe(`Linear priority: 0 none, 1 urgent, 2 high, 3 medium, 4 low.`),suggestedLabels:Tp(Cp()).describe(`0-3 suggested label names, e.g. "Bug", "UI".`)})}));function lD(e){let t=[e.issueTemplate?.trim()||hD],n=(e.skillPaths??``).split(`
84
84
  `).map(e=>e.trim()).filter(Boolean);n.length&&t.push(`**Project skills & memory — MANDATORY reading before implementing.** This repo ships maintained skills/memory files. Read each of these paths in your checkout and treat their guidance as authoritative for design, style, and architectural decisions:\n${n.map(e=>`- \`${e}\``).join(`
85
85
  `)}`),e.githubAssetsRepo?.trim()&&t.push(`**Demo media hosting:** commit demo GIFs/videos to the PUBLIC assets repo \`${e.githubAssetsRepo.trim()}\` under \`linear-grab/\` (clone it or use \`gh api\`), and embed the raw.githubusercontent.com URL in BOTH the Linear comment and the PR body. Prefer GIF for short demos — it renders inline everywhere (Linear, GitHub, the panel); Linear-hosted uploads do NOT render on GitHub.`);let r=[];e.testUsername?.trim()&&r.push(`- Username / email: \`${e.testUsername.trim()}\``),e.testPassword?.trim()&&r.push(`- Password: \`${e.testPassword.trim()}\``),r.length&&t.push(`**Test account — log into the app with this while testing:**\n${r.join(`
86
- `)}`);let i=[];return e.slackToken&&e.slackChannelId&&i.push(`- Slack: bot token \`${e.slackToken}\`, channel \`${e.slackChannelId}\`${e.slackChannelName?` (#${e.slackChannelName})`:``}. Use \`chat.postMessage\` for the message and \`files.uploadV2\` (or getUploadURLExternal + completeUploadExternal) to upload the demo video into the channel.`),e.telegramToken&&e.telegramChatId&&i.push(`- Telegram: bot token \`${e.telegramToken}\`, chat id \`${e.telegramChatId}\`. Use \`sendMessage\` and \`sendVideo\` (multipart upload of the demo file).`),i.length&&t.push(`**When the fix is complete and the PR is open, announce it yourself:**\n${i.join(`
87
- `)}\n\nMessage format — keep it short: what was broken → what you changed (one-line fix summary) → links to the Linear issue, the PR, and your agent run → attach/upload the demo video → end with the CTA "👉 Review the PR". You may also use these tokens to send yourself intermediate test notifications while verifying the integration works.`),t.join(`
86
+ `)}`);let i=[];e.slackToken&&e.slackChannelId&&i.push(`- Slack: bot token \`${e.slackToken}\`, channel \`${e.slackChannelId}\`${e.slackChannelName?` (#${e.slackChannelName})`:``}. Use \`chat.postMessage\` for the message and \`files.uploadV2\` (or getUploadURLExternal + completeUploadExternal) to upload the demo video into the channel.`),e.telegramToken&&e.telegramChatId&&i.push(`- Telegram: bot token \`${e.telegramToken}\`, chat id \`${e.telegramChatId}\`. Use \`sendMessage\` and \`sendVideo\` (multipart upload of the demo file).`),i.length&&t.push(`**When the fix is complete and the PR is open, announce it yourself:**\n${i.join(`
87
+ `)}\n\nMessage format — keep it short: what was broken → what you changed (one-line fix summary) → links to the Linear issue, the PR, and your agent run → attach/upload the demo video → end with the CTA "👉 Review the PR". You may also use these tokens to send yourself intermediate test notifications while verifying the integration works.`);let a=[`- [ ] Tested the change hands-on in the RUNNING app (state what you exercised)`,`- [ ] Demo media captured — GIF/video preferred; if recording is impossible in your environment, before/after screenshots + the stated reason`];return e.githubAssetsRepo?.trim()&&a.push(`- [ ] Demo media committed to \`${e.githubAssetsRepo.trim()}\` and embedded via raw.githubusercontent.com URL in the Linear comment AND the PR body`),a.push(`- [ ] Demo media attached to the Linear ISSUE itself (not only the PR)`,`- [ ] PR opened and linked here`,`- [ ] Deploy-preview URL included, deep-linked to the changed page (if the repo has preview deployments, e.g. Vercel; otherwise state that it does not)`,`- [ ] Issue moved to its review/done state`),i.length&&a.push(`- [ ] Announcement posted to the configured channel(s) with the demo attached`),t.push(`**DEFINITION OF DONE — acceptance checklist.** Copy this checklist VERBATIM into your Linear closeout comment and tick each box (\`- [x]\`) with a link or one-line evidence next to it. Any unchecked box means the work is NOT ACCEPTED — leave it unchecked and explain the blocker rather than omitting it:\n${a.join(`
88
+ `)}`),t.join(`
88
89
 
89
90
  `)}function uD(e){let t=[];if(e.componentName&&t.push(`Component: <${e.componentName}>`),e.tagName&&t.push(`DOM element: <${e.tagName}>`),e.source?.filePath){let n=e.source.lineNumber==null?``:`:${e.source.lineNumber}`;t.push(`Source: ${e.source.filePath}${n}`)}return e.stackContext&&t.push(`Component stack:\n${e.stackContext}`),e.content&&t.push(`Element context:\n${e.content}`),t.push(`Page URL: ${e.pageUrl}`),t.join(`
90
91
  `)}function dD(e){let t=[];t.push(`Reporter note:\n${e.note.trim()||`(none — infer from the element context)`}`);let n=e.grabbedList?.length?e.grabbedList:e.grabbed?[e.grabbed]:[];return n.slice(0,3).forEach((e,r)=>{t.push(`Captured element ${n.length>1?`${r+1}/${Math.min(n.length,3)} `:``}(via the Linear Grab picker):\n${uD(e)}`)}),e.teamName&&t.push(`Target team: ${e.teamName}`),e.template?.trim()&&t.push(`Standing agent instructions the team appends to every issue (context only — do NOT repeat them in your description, they are added automatically):\n${e.template.trim()}`),e.logs?.trim()&&t.push(`Recent dev server logs (tail — use for Analysis/Notes when relevant, do not paste wholesale):\n\`\`\`\n${e.logs.trim()}\n\`\`\``),t.push(`Draft the issue now.`),t.join(`
@@ -111,7 +112,7 @@ Summary (description field) → Steps to Reproduce (reproSteps) → Expected Beh
111
112
  (analysisNotes, markdown bullets grounded in the provided source context) →
112
113
  Suggested Next Steps (suggestedNextSteps, markdown bullets with concrete fixes).
113
114
  The Summary is a short plain-prose paragraph — no headings inside it, no repetition
114
- of the other sections.`,hD="- FIRST, self-orient in the repo checkout (skip any path that doesn't exist):\n 1. Read `CLAUDE.md` and `AGENTS.md` at the repo root — the master map of product rules, architecture, and memory/skill pointers.\n 2. Skim `.claude/memory/MEMORY.md` (the index) to learn what project memory exists; load the specific `.claude/memory/*.md` files the map names for the surface you're touching.\n 3. Load the matching `.claude/skills/<name>/SKILL.md` files before designing, building UI, or animating (if skills are symlinked, follow them into `.agents/skills/`).\n Treat all of this as authoritative — it overrides your defaults.\n- Keep going until the code works and you're happy with the implementation.\n- MANDATORY COMPLETION GATE — the task is NOT complete (and you may not call it complete) until every step below is done, in order. Skipping any step silently is a FAILED task:\n 1. RUN the app and TEST your change hands-on (computer use / a real browser against the running app). Code reading alone does not count as verification.\n 2. RECORD a demo video or GIF showing the fix working (before → after where possible). If your environment genuinely cannot record media, capture before/after screenshots instead AND state explicitly in your closeout comment why video was not possible — never just omit the demo.\n 3. Open the PR, babysit it for the first set of review comments, and address them.\n 4. CLOSE OUT THE LINEAR ISSUE: post a completion comment (one-line fix summary + PR link), attach the demo media to the ISSUE itself (not only the PR), and move the issue to its review/done state."})),_D=r({describeAiError:()=>bD,executeDraft:()=>vD});async function vD(e,t,n){let r=await jx(e.tier);try{return await yD(r,e,t,n,!1)}catch(i){if(n.aborted)throw i;let a=await Mx(r.provider,e.tier);if(!a)throw Error(bD(i));try{return await yD(a,e,t,n,!0)}catch(e){throw Error(bD(e))}}}async function yD(e,t,n,r,i){let a=bT({model:e.model,schema:sD,system:mD,prompt:dD(t),abortSignal:r});for await(let e of a.partialObjectStream)n(e);return{draft:await a.object,provider:e.provider,modelId:e.modelId,fellBack:i}}function bD(e){let t=e instanceof Error?e.message:String(e);return/401|unauthorized|invalid.*key/i.test(t)?`AI provider rejected the API key.`:/429|rate/i.test(t)?`AI provider rate limit hit — try again shortly.`:`Draft failed: ${t}`}var xD=t((()=>{aD(),cD(),gD(),Fx()}));Sr(),Fx();function SD(e,t){return xr?CD(e,t):wD(e,t)}function CD(e,t){let n=chrome.runtime.connect({name:`ai-draft`}),r=!1;return n.onMessage.addListener(e=>{e.type===`partial`?t.onPartial(e.draft):e.type===`done`?(r=!0,t.onDone(e),n.disconnect()):e.type===`error`&&(r=!0,t.onError(e.message,e.code===`no-provider`?`no-provider`:`unknown`),n.disconnect())}),n.onDisconnect.addListener(()=>{r||t.onError(`Draft stream disconnected.`)}),n.postMessage({type:`start`,input:e}),()=>{try{n.disconnect()}catch{}}}function wD(e,t){let n=new AbortController;return(async()=>{let{executeDraft:r}=await Promise.resolve().then(()=>(xD(),_D));try{let i=await r(e,t.onPartial,n.signal);n.signal.aborted||t.onDone(i)}catch(e){if(n.signal.aborted)return;t.onError(e instanceof Error?e.message:String(e),e instanceof Px?`no-provider`:`unknown`)}})(),()=>n.abort()}var TD=n((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>ee,applyPalette:()=>S,default:()=>le,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var ee=d[O.nn],te=O.cnt,A=ee.cnt,S=1/(te+A);u&&(O.ac=S*(te*O.ac+A*ee.ac)),O.rc=S*(te*O.rc+A*ee.rc),O.gc=S*(te*O.gc+A*ee.gc),O.bc=S*(te*O.bc+A*ee.bc),O.cnt+=ee.cnt,O.mtm=++x,d[ee.bk].fw=ee.fw,d[ee.fw].bk=ee.bk,ee.mtm=_}let ne=[];var re=0;for(x=0;;++re){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(ne,c)||ne.push(c),(x=d[x].fw)==0)break}return ne}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function ee(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);A(a,t,n,m,g),re(a,m),h>=0&&ne(a,h)}let y=Math.round(p/10);te(a,_,y,o,f);let b=!!m&&!v;ie(a,t,n,b?m:null),b&&re(a,m),ae(a,e,t,n,g,s,c,l)}};function d(){se(a,`GIF89a`)}}function te(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),oe(e,n),e.writeByte(i||0),e.writeByte(0)}function A(e,t,n,r,i=8){let a=ce(r.length)-1,o=i-1<<4|128|a;oe(e,t),oe(e,n),e.writeBytes([o,0,0])}function ne(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),se(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),oe(e,t),e.writeByte(0)}function re(e,t){let n=1<<ce(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function ie(e,t,n,r){if(e.writeByte(44),oe(e,0),oe(e,0),oe(e,t),oe(e,n),r){let t=ce(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function ae(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function oe(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function se(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function ce(e){return Math.max(Math.ceil(Math.log2(e)),1)}var le=ee}))(),ED="(function(){var e=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>A,applyPalette:()=>S,default:()=>B,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var A=d[O.nn],j=O.cnt,M=A.cnt,S=1/(j+M);u&&(O.ac=S*(j*O.ac+M*A.ac)),O.rc=S*(j*O.rc+M*A.rc),O.gc=S*(j*O.gc+M*A.gc),O.bc=S*(j*O.bc+M*A.bc),O.cnt+=A.cnt,O.mtm=++x,d[A.bk].fw=A.fw,d[A.fw].bk=A.bk,A.mtm=_}let N=[];var P=0;for(x=0;;++P){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(N,c)||N.push(c),(x=d[x].fw)==0)break}return N}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function A(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);M(a,t,n,m,g),P(a,m),h>=0&&N(a,h)}let y=Math.round(p/10);j(a,_,y,o,f);let b=!!m&&!v;F(a,t,n,b?m:null),b&&P(a,m),I(a,e,t,n,g,s,c,l)}};function d(){R(a,`GIF89a`)}}function j(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),L(e,n),e.writeByte(i||0),e.writeByte(0)}function M(e,t,n,r,i=8){let a=z(r.length)-1,o=i-1<<4|128|a;L(e,t),L(e,n),e.writeBytes([o,0,0])}function N(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),R(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),L(e,t),e.writeByte(0)}function P(e,t){let n=1<<z(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function F(e,t,n,r){if(e.writeByte(44),L(e,0),L(e,0),L(e,t),L(e,n),r){let t=z(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function I(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function L(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function R(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function z(e){return Math.max(Math.ceil(Math.log2(e)),1)}var B=A}))();let t=null,n=!0;self.onmessage=e=>{r(e.data).catch(t=>{e.data?.id!=null&&self.postMessage({id:e.data.id,type:`error`,message:t instanceof Error?t.message:String(t)})})};async function r(r){let a=(e,t=[])=>self.postMessage({id:r.id,...e},t);switch(r.type){case`encode-png`:{let e=r.bitmap,t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(`OffscreenCanvas 2d unavailable`);n.drawImage(e,0,0),e.close();let o=await t.convertToBlob({type:`image/png`});o.size>18e5&&(o=await t.convertToBlob({type:`image/jpeg`,quality:.85})),a({type:`png`,dataUrl:await i(o)});return}case`gif-init`:t=(0,e.GIFEncoder)(),n=!0,a({type:`ok`});return;case`gif-frame`:{if(!t)return;let i=new Uint8ClampedArray(r.buffer),a=(0,e.quantize)(i,256,{format:`rgb565`}),o=(0,e.applyPalette)(i,a,`rgb565`);t.writeFrame(o,r.width,r.height,{palette:a,delay:r.delay,first:n,repeat:0}),n=!1;return}case`gif-finish`:{if(!t)throw Error(`No active GIF session`);t.finish();let e=t.bytes();t=null,a({type:`gif`,buffer:e.buffer},[e.buffer]);return}case`gif-abort`:t=null;return}}function i(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}})();",DD=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,ED],{type:`text/javascript;charset=utf-8`});function OD(e){let t;try{if(t=DD&&(self.URL||self.webkitURL).createObjectURL(DD),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(ED),{name:e?.name})}}var kD,AD=1,jD=new Map;function MD(){if(kD!==void 0)return kD;try{kD=new OD,kD.onmessage=e=>{let t=e.data?.id;if(t==null)return;let n=jD.get(t);n&&(jD.delete(t),e.data.type===`error`?n.reject(Error(e.data.message??`Worker error`)):n.resolve(e.data))},kD.onerror=()=>{for(let e of jD.values())e.reject(Error(`Image worker crashed`));jD.clear()}}catch{kD=null}return kD}function ND(e,t=[]){let n=MD();if(!n)return Promise.reject(Error(`Image worker unavailable`));let r=AD++;return new Promise((i,a)=>{jD.set(r,{resolve:i,reject:a}),n.postMessage({...e,id:r},t)})}function PD(e,t=[]){let n=MD();return n?(n.postMessage(e,t),!0):!1}var FD=6,ID=Math.round(1e3/FD),LD=3e4,RD=640,zD={phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0},BD=new Set;function VD(e){zD={...zD,...e};for(let e of BD)e(zD)}function HD(){return zD}function UD(e){return BD.add(e),()=>BD.delete(e)}var WD=null,GD=null,KD=null,qD=null,JD=null,YD=null,XD=!1,ZD=0,QD=!0;async function $D(){if(zD.phase===`recording`||zD.phase===`processing`)return;tO();try{WD=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:FD},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`,surfaceSwitching:`exclude`,monitorTypeSurfaces:`exclude`,systemAudio:`exclude`})}catch{VD({phase:`error`,error:`Screen capture was denied or cancelled.`});return}let e=WD.getVideoTracks()[0];if(!e){VD({phase:`error`,error:`No video track available.`}),iO();return}e.addEventListener(`ended`,()=>void eO()),GD=document.createElement(`video`),GD.muted=!0,GD.playsInline=!0,GD.srcObject=WD,await GD.play().catch(()=>{});let t=Date.now()+3e3;for(;!GD.videoWidth&&Date.now()<t;)await new Promise(e=>setTimeout(e,50));if(!GD.videoWidth){VD({phase:`error`,error:`Could not read the capture stream.`}),iO();return}let n=Math.min(1,RD/GD.videoWidth),r=Math.round(GD.videoWidth*n),i=Math.round(GD.videoHeight*n);if(KD=document.createElement(`canvas`),KD.width=r,KD.height=i,qD=KD.getContext(`2d`,{willReadFrequently:!0}),!qD){VD({phase:`error`,error:`Canvas is unavailable.`}),iO();return}XD=await ND({type:`gif-init`}).then(()=>!0,()=>!1),YD=XD?null:(0,TD.GIFEncoder)(),ZD=0,QD=!0,VD({phase:`recording`,startedAt:Date.now(),error:null,result:null}),JD=setInterval(()=>{if(!qD||!GD||!KD)return;let e=zD.startedAt??Date.now();if(Date.now()-e>=LD){eO();return}try{qD.drawImage(GD,0,0,KD.width,KD.height);let{data:e}=qD.getImageData(0,0,KD.width,KD.height);if(XD)PD({type:`gif-frame`,buffer:e.buffer,width:KD.width,height:KD.height,delay:ID},[e.buffer]);else if(YD){let t=(0,TD.quantize)(e,256,{format:`rgb565`}),n=(0,TD.applyPalette)(e,t,`rgb565`);YD.writeFrame(n,KD.width,KD.height,{palette:t,delay:ID,first:QD,repeat:0}),QD=!1}ZD++}catch{}},ID)}async function eO(){if(zD.phase!==`recording`)return;let e=zD.startedAt??Date.now();VD({phase:`processing`}),JD&&=(clearInterval(JD),null);let t=KD?.width??0,n=KD?.height??0,r=ZD,i=YD,a=XD;if(YD=null,XD=!1,iO(),!i&&!a||r===0){VD({phase:`error`,error:`Nothing was captured.`});return}try{let o;if(a){let e=await ND({type:`gif-finish`});o=new Uint8Array(e.buffer)}else i.finish(),o=i.bytes();let s=new Blob([o.buffer],{type:`image/gif`});VD({phase:`ready`,result:{blob:s,url:URL.createObjectURL(s),width:t,height:n,frameCount:r,durationMs:Date.now()-e}})}catch(e){VD({phase:`error`,error:e instanceof Error?e.message:`GIF encoding failed.`})}}function tO(){zD.result?.url&&URL.revokeObjectURL(zD.result.url),iO(),JD&&=(clearInterval(JD),null),XD&&PD({type:`gif-abort`}),XD=!1,YD=null,ZD=0,VD({phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0})}function nO(e){VD({attachOnCreate:e})}function rO(e){zD.result&&VD({result:{...zD.result,assetUrl:e}})}function iO(){WD?.getTracks().forEach(e=>e.stop()),WD=null,GD&&=(GD.srcObject=null,null),KD=null,qD=null}Br();var aO=`https://api.linear.app/graphql`,oO=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`LinearError`}},sO=class extends oO{constructor(){super(`Not connected to Linear. Add an API key or connect OAuth in Settings.`),this.name=`LinearNotConnectedError`}};async function cO(e,t){let{linearApiKey:n,linearAccessToken:r}=await Tr(),i=r?`Bearer ${r}`:n;if(!i)throw new sO;let a=await fetch(aO,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:i},body:JSON.stringify({query:e,variables:t})}),o=await a.json().catch(()=>null);if(!a.ok)throw new oO(o?.errors?.[0]?.message??`Linear request failed (${a.status})`,a.status);if(o?.errors?.length)throw new oO(o.errors[0].message);if(!o?.data)throw new oO(`Empty response from Linear`);return o.data}async function lO(){return(await cO(`query { viewer { id name email } }`)).viewer}async function uO(){return(await cO(`query { teams(first: 50) { nodes { id key name } } }`)).teams.nodes}async function dO(){return(await cO(`query {
115
+ of the other sections.`,hD="- FIRST, self-orient in the repo checkout (skip any path that doesn't exist):\n 1. Read `CLAUDE.md` and `AGENTS.md` at the repo root — the master map of product rules, architecture, and memory/skill pointers.\n 2. Skim `.claude/memory/MEMORY.md` (the index) to learn what project memory exists; load the specific `.claude/memory/*.md` files the map names for the surface you're touching.\n 3. Load the matching `.claude/skills/<name>/SKILL.md` files before designing, building UI, or animating (if skills are symlinked, follow them into `.agents/skills/`).\n Treat all of this as authoritative — it overrides your defaults.\n- Keep going until the code works and you're happy with the implementation.\n- MANDATORY COMPLETION GATE — the task is NOT complete (and you may not call it complete) until every step below is done, in order. Skipping any step silently is a FAILED task:\n 1. RUN the app and TEST your change hands-on (computer use / a real browser against the running app). Code reading alone does not count as verification.\n 2. RECORD a demo video or GIF showing the fix working (before → after where possible). If your environment genuinely cannot record media, capture before/after screenshots instead AND state explicitly in your closeout comment why video was not possible — never just omit the demo.\n 3. Open the PR, babysit it for the first set of review comments, and address them. If the repo has preview deployments (e.g. Vercel), wait for the preview to go green and include its URL — deep-linked to the changed page — in the PR body, the Linear closeout, and the announcement.\n 4. CLOSE OUT THE LINEAR ISSUE: post a completion comment (one-line fix summary + PR link), attach the demo media to the ISSUE itself (not only the PR), and move the issue to its review/done state."})),_D=r({describeAiError:()=>bD,executeDraft:()=>vD});async function vD(e,t,n){let r=await jx(e.tier);try{return await yD(r,e,t,n,!1)}catch(i){if(n.aborted)throw i;let a=await Mx(r.provider,e.tier);if(!a)throw Error(bD(i));try{return await yD(a,e,t,n,!0)}catch(e){throw Error(bD(e))}}}async function yD(e,t,n,r,i){let a=bT({model:e.model,schema:sD,system:mD,prompt:dD(t),abortSignal:r});for await(let e of a.partialObjectStream)n(e);return{draft:await a.object,provider:e.provider,modelId:e.modelId,fellBack:i}}function bD(e){let t=e instanceof Error?e.message:String(e);return/401|unauthorized|invalid.*key/i.test(t)?`AI provider rejected the API key.`:/429|rate/i.test(t)?`AI provider rate limit hit — try again shortly.`:`Draft failed: ${t}`}var xD=t((()=>{aD(),cD(),gD(),Fx()}));Sr(),Fx();function SD(e,t){return xr?CD(e,t):wD(e,t)}function CD(e,t){let n=chrome.runtime.connect({name:`ai-draft`}),r=!1;return n.onMessage.addListener(e=>{e.type===`partial`?t.onPartial(e.draft):e.type===`done`?(r=!0,t.onDone(e),n.disconnect()):e.type===`error`&&(r=!0,t.onError(e.message,e.code===`no-provider`?`no-provider`:`unknown`),n.disconnect())}),n.onDisconnect.addListener(()=>{r||t.onError(`Draft stream disconnected.`)}),n.postMessage({type:`start`,input:e}),()=>{try{n.disconnect()}catch{}}}function wD(e,t){let n=new AbortController;return(async()=>{let{executeDraft:r}=await Promise.resolve().then(()=>(xD(),_D));try{let i=await r(e,t.onPartial,n.signal);n.signal.aborted||t.onDone(i)}catch(e){if(n.signal.aborted)return;t.onError(e instanceof Error?e.message:String(e),e instanceof Px?`no-provider`:`unknown`)}})(),()=>n.abort()}var TD=n((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>ee,applyPalette:()=>S,default:()=>le,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var ee=d[O.nn],te=O.cnt,A=ee.cnt,S=1/(te+A);u&&(O.ac=S*(te*O.ac+A*ee.ac)),O.rc=S*(te*O.rc+A*ee.rc),O.gc=S*(te*O.gc+A*ee.gc),O.bc=S*(te*O.bc+A*ee.bc),O.cnt+=ee.cnt,O.mtm=++x,d[ee.bk].fw=ee.fw,d[ee.fw].bk=ee.bk,ee.mtm=_}let ne=[];var re=0;for(x=0;;++re){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(ne,c)||ne.push(c),(x=d[x].fw)==0)break}return ne}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function ee(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);A(a,t,n,m,g),re(a,m),h>=0&&ne(a,h)}let y=Math.round(p/10);te(a,_,y,o,f);let b=!!m&&!v;ie(a,t,n,b?m:null),b&&re(a,m),ae(a,e,t,n,g,s,c,l)}};function d(){se(a,`GIF89a`)}}function te(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),oe(e,n),e.writeByte(i||0),e.writeByte(0)}function A(e,t,n,r,i=8){let a=ce(r.length)-1,o=i-1<<4|128|a;oe(e,t),oe(e,n),e.writeBytes([o,0,0])}function ne(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),se(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),oe(e,t),e.writeByte(0)}function re(e,t){let n=1<<ce(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function ie(e,t,n,r){if(e.writeByte(44),oe(e,0),oe(e,0),oe(e,t),oe(e,n),r){let t=ce(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function ae(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function oe(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function se(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function ce(e){return Math.max(Math.ceil(Math.log2(e)),1)}var le=ee}))(),ED="(function(){var e=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>A,applyPalette:()=>S,default:()=>B,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var A=d[O.nn],j=O.cnt,M=A.cnt,S=1/(j+M);u&&(O.ac=S*(j*O.ac+M*A.ac)),O.rc=S*(j*O.rc+M*A.rc),O.gc=S*(j*O.gc+M*A.gc),O.bc=S*(j*O.bc+M*A.bc),O.cnt+=A.cnt,O.mtm=++x,d[A.bk].fw=A.fw,d[A.fw].bk=A.bk,A.mtm=_}let N=[];var P=0;for(x=0;;++P){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(N,c)||N.push(c),(x=d[x].fw)==0)break}return N}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function A(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);M(a,t,n,m,g),P(a,m),h>=0&&N(a,h)}let y=Math.round(p/10);j(a,_,y,o,f);let b=!!m&&!v;F(a,t,n,b?m:null),b&&P(a,m),I(a,e,t,n,g,s,c,l)}};function d(){R(a,`GIF89a`)}}function j(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),L(e,n),e.writeByte(i||0),e.writeByte(0)}function M(e,t,n,r,i=8){let a=z(r.length)-1,o=i-1<<4|128|a;L(e,t),L(e,n),e.writeBytes([o,0,0])}function N(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),R(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),L(e,t),e.writeByte(0)}function P(e,t){let n=1<<z(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function F(e,t,n,r){if(e.writeByte(44),L(e,0),L(e,0),L(e,t),L(e,n),r){let t=z(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function I(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function L(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function R(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function z(e){return Math.max(Math.ceil(Math.log2(e)),1)}var B=A}))();let t=null,n=!0;self.onmessage=e=>{r(e.data).catch(t=>{e.data?.id!=null&&self.postMessage({id:e.data.id,type:`error`,message:t instanceof Error?t.message:String(t)})})};async function r(r){let a=(e,t=[])=>self.postMessage({id:r.id,...e},t);switch(r.type){case`encode-png`:{let e=r.bitmap,t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(`OffscreenCanvas 2d unavailable`);n.drawImage(e,0,0),e.close();let o=await t.convertToBlob({type:`image/png`});o.size>18e5&&(o=await t.convertToBlob({type:`image/jpeg`,quality:.85})),a({type:`png`,dataUrl:await i(o)});return}case`gif-init`:t=(0,e.GIFEncoder)(),n=!0,a({type:`ok`});return;case`gif-frame`:{if(!t)return;let i=new Uint8ClampedArray(r.buffer),a=(0,e.quantize)(i,256,{format:`rgb565`}),o=(0,e.applyPalette)(i,a,`rgb565`);t.writeFrame(o,r.width,r.height,{palette:a,delay:r.delay,first:n,repeat:0}),n=!1;return}case`gif-finish`:{if(!t)throw Error(`No active GIF session`);t.finish();let e=t.bytes();t=null,a({type:`gif`,buffer:e.buffer},[e.buffer]);return}case`gif-abort`:t=null;return}}function i(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}})();",DD=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,ED],{type:`text/javascript;charset=utf-8`});function OD(e){let t;try{if(t=DD&&(self.URL||self.webkitURL).createObjectURL(DD),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(ED),{name:e?.name})}}var kD,AD=1,jD=new Map;function MD(){if(kD!==void 0)return kD;try{kD=new OD,kD.onmessage=e=>{let t=e.data?.id;if(t==null)return;let n=jD.get(t);n&&(jD.delete(t),e.data.type===`error`?n.reject(Error(e.data.message??`Worker error`)):n.resolve(e.data))},kD.onerror=()=>{for(let e of jD.values())e.reject(Error(`Image worker crashed`));jD.clear()}}catch{kD=null}return kD}function ND(e,t=[]){let n=MD();if(!n)return Promise.reject(Error(`Image worker unavailable`));let r=AD++;return new Promise((i,a)=>{jD.set(r,{resolve:i,reject:a}),n.postMessage({...e,id:r},t)})}function PD(e,t=[]){let n=MD();return n?(n.postMessage(e,t),!0):!1}var FD=6,ID=Math.round(1e3/FD),LD=3e4,RD=640,zD={phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0},BD=new Set;function VD(e){zD={...zD,...e};for(let e of BD)e(zD)}function HD(){return zD}function UD(e){return BD.add(e),()=>BD.delete(e)}var WD=null,GD=null,KD=null,qD=null,JD=null,YD=null,XD=!1,ZD=0,QD=!0;async function $D(){if(zD.phase===`recording`||zD.phase===`processing`)return;tO();try{WD=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:FD},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`,surfaceSwitching:`exclude`,monitorTypeSurfaces:`exclude`,systemAudio:`exclude`})}catch{VD({phase:`error`,error:`Screen capture was denied or cancelled.`});return}let e=WD.getVideoTracks()[0];if(!e){VD({phase:`error`,error:`No video track available.`}),iO();return}e.addEventListener(`ended`,()=>void eO()),GD=document.createElement(`video`),GD.muted=!0,GD.playsInline=!0,GD.srcObject=WD,await GD.play().catch(()=>{});let t=Date.now()+3e3;for(;!GD.videoWidth&&Date.now()<t;)await new Promise(e=>setTimeout(e,50));if(!GD.videoWidth){VD({phase:`error`,error:`Could not read the capture stream.`}),iO();return}let n=Math.min(1,RD/GD.videoWidth),r=Math.round(GD.videoWidth*n),i=Math.round(GD.videoHeight*n);if(KD=document.createElement(`canvas`),KD.width=r,KD.height=i,qD=KD.getContext(`2d`,{willReadFrequently:!0}),!qD){VD({phase:`error`,error:`Canvas is unavailable.`}),iO();return}XD=await ND({type:`gif-init`}).then(()=>!0,()=>!1),YD=XD?null:(0,TD.GIFEncoder)(),ZD=0,QD=!0,VD({phase:`recording`,startedAt:Date.now(),error:null,result:null}),JD=setInterval(()=>{if(!qD||!GD||!KD)return;let e=zD.startedAt??Date.now();if(Date.now()-e>=LD){eO();return}try{qD.drawImage(GD,0,0,KD.width,KD.height);let{data:e}=qD.getImageData(0,0,KD.width,KD.height);if(XD)PD({type:`gif-frame`,buffer:e.buffer,width:KD.width,height:KD.height,delay:ID},[e.buffer]);else if(YD){let t=(0,TD.quantize)(e,256,{format:`rgb565`}),n=(0,TD.applyPalette)(e,t,`rgb565`);YD.writeFrame(n,KD.width,KD.height,{palette:t,delay:ID,first:QD,repeat:0}),QD=!1}ZD++}catch{}},ID)}async function eO(){if(zD.phase!==`recording`)return;let e=zD.startedAt??Date.now();VD({phase:`processing`}),JD&&=(clearInterval(JD),null);let t=KD?.width??0,n=KD?.height??0,r=ZD,i=YD,a=XD;if(YD=null,XD=!1,iO(),!i&&!a||r===0){VD({phase:`error`,error:`Nothing was captured.`});return}try{let o;if(a){let e=await ND({type:`gif-finish`});o=new Uint8Array(e.buffer)}else i.finish(),o=i.bytes();let s=new Blob([o.buffer],{type:`image/gif`});VD({phase:`ready`,result:{blob:s,url:URL.createObjectURL(s),width:t,height:n,frameCount:r,durationMs:Date.now()-e}})}catch(e){VD({phase:`error`,error:e instanceof Error?e.message:`GIF encoding failed.`})}}function tO(){zD.result?.url&&URL.revokeObjectURL(zD.result.url),iO(),JD&&=(clearInterval(JD),null),XD&&PD({type:`gif-abort`}),XD=!1,YD=null,ZD=0,VD({phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0})}function nO(e){VD({attachOnCreate:e})}function rO(e){zD.result&&VD({result:{...zD.result,assetUrl:e}})}function iO(){WD?.getTracks().forEach(e=>e.stop()),WD=null,GD&&=(GD.srcObject=null,null),KD=null,qD=null}Br();var aO=`https://api.linear.app/graphql`,oO=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`LinearError`}},sO=class extends oO{constructor(){super(`Not connected to Linear. Add an API key or connect OAuth in Settings.`),this.name=`LinearNotConnectedError`}};async function cO(e,t){let{linearApiKey:n,linearAccessToken:r}=await Tr(),i=r?`Bearer ${r}`:n;if(!i)throw new sO;let a=await fetch(aO,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:i},body:JSON.stringify({query:e,variables:t})}),o=await a.json().catch(()=>null);if(!a.ok)throw new oO(o?.errors?.[0]?.message??`Linear request failed (${a.status})`,a.status);if(o?.errors?.length)throw new oO(o.errors[0].message);if(!o?.data)throw new oO(`Empty response from Linear`);return o.data}async function lO(){return(await cO(`query { viewer { id name email } }`)).viewer}async function uO(){return(await cO(`query { teams(first: 50) { nodes { id key name } } }`)).teams.nodes}async function dO(){return(await cO(`query {
115
116
  users(filter: { app: { eq: true } }) {
116
117
  nodes { id name displayName url active }
117
118
  }
@@ -210,7 +211,7 @@ of the other sections.`,hD="- FIRST, self-orient in the repo checkout (skip any
210
211
  success
211
212
  uploadFile { uploadUrl assetUrl headers { key value } }
212
213
  }
213
- }`,{contentType:e.type,filename:t,size:e.size}),r=n.fileUpload.uploadFile;if(!n.fileUpload.success||!r)throw Error(`Linear did not provide an upload URL.`);let{linearApiKey:i,linearAccessToken:a}=await Tr(),o=a?`Bearer ${a}`:i??``,s=Object.fromEntries((r.headers??[]).map(e=>[e.key,e.value])),c=[{"Content-Type":e.type,...s,...o?{Authorization:o}:{}},{"Content-Type":e.type,...s},{"Content-Type":e.type}],l=null;for(let t of c)try{let n=await fetch(r.uploadUrl,{method:`PUT`,mode:`cors`,headers:t,body:e});if(n.ok)return r.assetUrl;l=Error(`Upload rejected (${n.status}).`)}catch(e){l=e}try{let{bridgeUrl:t}=await Tr(),n=(t?.trim()||`http://localhost:4577`).replace(/\/$/,``);if((await fetch(`${n}/put`,{method:`POST`,headers:{"Content-Type":e.type,"x-upload-url":r.uploadUrl,"x-upload-headers":JSON.stringify({...s,...o?{Authorization:o}:{}})},body:e})).ok)return r.assetUrl}catch{}throw Error(`Upload to Linear storage failed${l instanceof Error?` — ${l.message}`:``}. Run \`npx linear-grab-bridge\` in the repo (uploads relay through it), set the GitHub fallback in Settings, or use "Copy GIF" + paste.`)}Br();async function EO(e,t){try{return await TO(e,t)}catch(n){let r=await Tr();if(r.githubToken&&r.githubAssetsRepo)return DO(e,t,r.githubToken,r.githubAssetsRepo);throw n instanceof Error?Error(`${n.message} Tip: configure the GitHub assets fallback in Settings for automatic uploads in this browser.`):n}}async function DO(e,t,n,r){let i=`linear-grab/${Date.now()}-${t.replace(/[^\w.-]/g,`_`)}`,a=await fetch(`https://api.github.com/repos/${r}/contents/${i}`,{method:`PUT`,headers:{Authorization:`Bearer ${n}`,Accept:`application/vnd.github+json`,"Content-Type":`application/json`},body:JSON.stringify({message:`chore(linear-grab): asset ${t}`,content:await OO(e)})}),o=await a.json().catch(()=>null);if(!a.ok||!o?.content?.download_url)throw Error(`GitHub asset upload failed — ${o?.message??`HTTP ${a.status}`}`);return o.content.download_url}function OO(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result.split(`,`)[1]??``),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}Br();async function kO(){return((await Tr()).bridgeUrl?.trim()||`http://localhost:4577`).replace(/\/$/,``)}async function AO(e,t){let n=await kO(),r=await fetch(`${n}${e}`,{...t,headers:{"Content-Type":`application/json`,...t?.headers??{}}});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error??`Bridge request failed (${r.status})`)}return await r.json()}function jO(){return AO(`/health`)}async function MO(){return(await AO(`/tasks`)).tasks}function NO(e){return AO(`/tasks/${e}`)}function PO(e,t,n){return AO(`/tasks`,{method:`POST`,body:JSON.stringify({title:e,prompt:t,...n})})}function FO(e,t){return AO(`/tasks/${e}/message`,{method:`POST`,body:JSON.stringify({text:t})})}function IO(e,t){return AO(`/tasks/${e}/model`,{method:`POST`,body:JSON.stringify({model:t||null})})}function LO(e){return AO(`/tasks/${e}/stop`,{method:`POST`}).then(()=>void 0)}function RO(e){return AO(`/tasks/${e}/worktree/remove`,{method:`POST`})}function zO(e){return AO(`/tasks/${e}/diff`)}async function BO(){let e=await Tr(),t=e.linearAccessToken?`Bearer ${e.linearAccessToken}`:e.linearApiKey;t&&await AO(`/config`,{method:`POST`,body:JSON.stringify({linearAuth:t})}).catch(()=>void 0)}async function VO(e){return e.length?(await AO(`/pr/status`,{method:`POST`,body:JSON.stringify({urls:e})})).statuses:{}}function HO(e){return AO(`/pr/merge`,{method:`POST`,body:JSON.stringify({url:e})})}async function UO(){return((await Tr()).bridgeUrl?.trim()||`http://localhost:4577`).replace(/\/$/,``)}function WO(e){return`claude --dangerously-skip-permissions --resume ${e.sessionId??`<session-id>`}`}function GO(e,t){return[`🛠️ ${(e=>t===`slack`?`*${e}*`:e)(`${e.identifier} — ${e.title}`)}`,e.summary?.trim()?e.summary.trim().slice(0,300):null,e.impact?.trim()?`Impact: ${e.impact.trim().slice(0,200)}`:null,e.executor===`cursor`?`🤖 Delegated to the Cursor cloud agent — PR with demo video incoming.`:e.executor===`local`?`💻 Delegated to local Claude Code.`:null,e.repo?`Repo: ${e.repo}`:null,e.demoUrl?`Demo: ${e.demoUrl}`:null,`👉 Follow & review: ${e.url}`].filter(Boolean).join(`
214
+ }`,{contentType:e.type,filename:t,size:e.size}),r=n.fileUpload.uploadFile;if(!n.fileUpload.success||!r)throw Error(`Linear did not provide an upload URL.`);let{linearApiKey:i,linearAccessToken:a}=await Tr(),o=a?`Bearer ${a}`:i??``,s=Object.fromEntries((r.headers??[]).map(e=>[e.key,e.value])),c=[{"Content-Type":e.type,...s,...o?{Authorization:o}:{}},{"Content-Type":e.type,...s},{"Content-Type":e.type}],l=null;for(let t of c)try{let n=await fetch(r.uploadUrl,{method:`PUT`,mode:`cors`,headers:t,body:e});if(n.ok)return r.assetUrl;l=Error(`Upload rejected (${n.status}).`)}catch(e){l=e}try{let{bridgeUrl:t}=await Tr(),n=(t?.trim()||`http://localhost:4577`).replace(/\/$/,``);if((await fetch(`${n}/put`,{method:`POST`,headers:{"Content-Type":e.type,"x-upload-url":r.uploadUrl,"x-upload-headers":JSON.stringify({...s,...o?{Authorization:o}:{}})},body:e})).ok)return r.assetUrl}catch{}throw Error(`Upload to Linear storage failed${l instanceof Error?` — ${l.message}`:``}. Run \`npx linear-grab-bridge\` in the repo (uploads relay through it), set the GitHub fallback in Settings, or use "Copy GIF" + paste.`)}Br();async function EO(e,t){try{return await TO(e,t)}catch(n){let r=await Tr();if(r.githubToken&&r.githubAssetsRepo)return DO(e,t,r.githubToken,r.githubAssetsRepo);throw n instanceof Error?Error(`${n.message} Tip: configure the GitHub assets fallback in Settings for automatic uploads in this browser.`):n}}async function DO(e,t,n,r){let i=`linear-grab/${Date.now()}-${t.replace(/[^\w.-]/g,`_`)}`,a=await fetch(`https://api.github.com/repos/${r}/contents/${i}`,{method:`PUT`,headers:{Authorization:`Bearer ${n}`,Accept:`application/vnd.github+json`,"Content-Type":`application/json`},body:JSON.stringify({message:`chore(linear-grab): asset ${t}`,content:await OO(e)})}),o=await a.json().catch(()=>null);if(!a.ok||!o?.content?.download_url)throw Error(`GitHub asset upload failed — ${o?.message??`HTTP ${a.status}`}`);return o.content.download_url}function OO(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result.split(`,`)[1]??``),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}Br();async function kO(){return((await Tr()).bridgeUrl?.trim()||`http://localhost:4577`).replace(/\/$/,``)}async function AO(e,t){let n=await kO(),r=await fetch(`${n}${e}`,{...t,headers:{"Content-Type":`application/json`,...t?.headers??{}}});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error??`Bridge request failed (${r.status})`)}return await r.json()}function jO(){return AO(`/health`)}async function MO(){return(await AO(`/tasks`)).tasks}function NO(e){return AO(`/tasks/${e}`)}function PO(e,t,n){return AO(`/tasks`,{method:`POST`,body:JSON.stringify({title:e,prompt:t,...n})})}function FO(e,t){return AO(`/tasks/${e}/message`,{method:`POST`,body:JSON.stringify({text:t})})}function IO(e,t){return AO(`/tasks/${e}/model`,{method:`POST`,body:JSON.stringify({model:t||null})})}function LO(e){return AO(`/tasks/${e}/stop`,{method:`POST`}).then(()=>void 0)}function RO(e){return AO(`/tasks/${e}/worktree/remove`,{method:`POST`})}function zO(e){return AO(`/tasks/${e}/diff`)}async function BO(){let e=await Tr(),t=e.linearAccessToken?`Bearer ${e.linearAccessToken}`:e.linearApiKey;t&&await AO(`/config`,{method:`POST`,body:JSON.stringify({linearAuth:t})}).catch(()=>void 0)}async function VO(e){if(!e.length)return{statuses:{},previews:{}};let t=await AO(`/pr/status`,{method:`POST`,body:JSON.stringify({urls:e})});return{statuses:t.statuses??{},previews:t.previews??{}}}function HO(e){return AO(`/pr/merge`,{method:`POST`,body:JSON.stringify({url:e})})}async function UO(){return((await Tr()).bridgeUrl?.trim()||`http://localhost:4577`).replace(/\/$/,``)}function WO(e){return`claude --dangerously-skip-permissions --resume ${e.sessionId??`<session-id>`}`}function GO(e,t){return[`🛠️ ${(e=>t===`slack`?`*${e}*`:e)(`${e.identifier} — ${e.title}`)}`,e.summary?.trim()?e.summary.trim().slice(0,300):null,e.impact?.trim()?`Impact: ${e.impact.trim().slice(0,200)}`:null,e.executor===`cursor`?`🤖 Delegated to the Cursor cloud agent — PR with demo video incoming.`:e.executor===`local`?`💻 Delegated to local Claude Code.`:null,e.repo?`Repo: ${e.repo}`:null,e.demoUrl?`Demo: ${e.demoUrl}`:null,`👉 Follow & review: ${e.url}`].filter(Boolean).join(`
214
215
  `)}async function KO(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:GO(t,`slack`),unfurl_links:`false`})})).json();if(!n.ok)throw Error(n.error??`slack error`)}async function qO(e,t){let n=`https://api.telegram.org/bot${e.telegramToken}`,r=GO(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 JO(e,t){if(e.notifyOnCreate===!1)return[];let n=[];if(e.slackToken&&e.slackChannelId)try{await KO(e,t)}catch{n.push(`Slack`)}if(e.telegramToken&&e.telegramChatId)try{await qO(e,t)}catch{n.push(`Telegram`)}return n}async function YO(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 XO=12e3,ZO=4e3;async function QO(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(),ZO);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(`
215
216
  `).slice(-n).join(`
216
217
  `).trim();return i.length>XO&&(i=`…\n${i.slice(i.length-XO)}`),i||null}finally{clearTimeout(i)}}var $O=50,ek=[],tk=!1;function nk(e){if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(typeof e==`object`&&e)try{return JSON.stringify(e).slice(0,400)}catch{return String(e)}return String(e)}function rk(e,t){let n=t.map(nk).join(` `).slice(0,600);n.trim()&&(ek.push({at:Date.now(),level:e,text:n}),ek.length>$O&&ek.shift())}function ik(){if(tk||typeof window>`u`)return;tk=!0;let e=console.error.bind(console);console.error=(...t)=>{rk(`error`,t),e(...t)};let t=console.warn.bind(console);console.warn=(...e)=>{rk(`warn`,e),t(...e)},window.addEventListener(`error`,e=>{rk(`error`,[`${e.message}${e.filename?` (${e.filename}:${e.lineno})`:``}`])}),window.addEventListener(`unhandledrejection`,e=>{let t=e.reason;rk(`unhandled`,[t?.stack??String(e.reason??`unhandled rejection`)])})}function ak(e=30){return ek.slice(-e)}function ok(e=30){let t=ak(e);if(!t.length)return null;let n=t.map(e=>`[${new Date(e.at).toTimeString().slice(0,8)}] ${e.level.toUpperCase()}: ${e.text}`).join(`
@@ -254,8 +255,8 @@ of the other sections.`,hD="- FIRST, self-orient in the repo checkout (skip any
254
255
  `)}`:null}function KQ(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var qQ=/^(https?:\/\/|mailto:)/i,JQ=/\.(mp4|mov|webm|m4v)(\?|#|$)/i,YQ=/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/i,XQ=class extends HTMLElement{objectUrl=null;connectedCallback(){let e=this.getAttribute(`src`)??``,t=this.getAttribute(`alt`)??``;(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(String(n.status));let r=await n.blob();if(this.objectUrl=URL.createObjectURL(r),this.textContent=``,r.type.startsWith(`video/`)){let e=document.createElement(`video`);e.controls=!0,e.preload=`metadata`,e.src=this.objectUrl,this.appendChild(e)}else{let e=document.createElement(`img`);e.src=this.objectUrl,e.alt=t,this.appendChild(e)}}catch{this.textContent=``;let e=document.createElement(`span`);e.textContent=`🖼 ${t||`media`} — start the bridge (npx linear-grab-bridge) to view Linear-hosted media here`,e.style.cssText=`font-size:10.5px;color:var(--color-text-faint);`,this.appendChild(e)}})()}disconnectedCallback(){this.objectUrl&&URL.revokeObjectURL(this.objectUrl)}};typeof customElements<`u`&&!customElements.get(`lg-media`)&&customElements.define(`lg-media`,XQ);var ZQ=null;function QQ(e){ZQ=e?e.replace(/\/$/,``):null}function $Q(e){try{if(ZQ&&new URL(e).hostname.endsWith(`uploads.linear.app`))return`${ZQ}/fetch?url=${encodeURIComponent(e)}`}catch{}return e}function e$(e){let t=e;return t=t.replace(/`([^`]+)`/g,(e,t)=>`<code>${t}</code>`),t=t.replace(/!\[([^\]]*)\]\((?:&lt;)?([^()\s]+?)(?:&gt;)?\)/g,(e,t,n)=>{if(!qQ.test(n))return t;let r=$Q(n);return JQ.test(n)?`<video controls preload="metadata" src="${r}"></video>`:r!==n&&!YQ.test(n)?`<lg-media src="${r}" alt="${t}"></lg-media>`:`<img src="${r}" alt="${t}" loading="lazy" />`}),t=t.replace(/\[([^\]]+)\]\((?:&lt;)?([^()\s]+?)(?:&gt;)?\)/g,(e,t,n)=>qQ.test(n)?`<a href="${n}" target="_blank" rel="noopener noreferrer">${t}</a>`:t),t=t.replace(/&lt;(https?:\/\/[^\s&]+)&gt;/g,`<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>`),t=t.replace(/(^|[\s(])((?:https?:\/\/)[^\s<>()"']+)/g,(e,t,n)=>`${t}<a href="${n}" target="_blank" rel="noopener noreferrer">${n}</a>`),t=t.replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`),t=t.replace(/(^|\W)\*([^*\n]+)\*(?=\W|$)/g,`$1<em>$2</em>`),t}function t$(e){let t=KQ(e.trim()).split(`
255
256
  `),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r++;continue}if(e.startsWith("```")){let e=[];for(r++;r<t.length&&!t[r].startsWith("```");)e.push(t[r++]);r++,n.push(`<pre><code>${e.join(`
256
257
  `)}</code></pre>`);continue}let i=e.match(/^(#{1,6})\s+(.*)$/);if(i){n.push(`<h4>${e$(i[2])}</h4>`),r++;continue}if(/^\s*[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*[-*]\s+/.test(t[r]);)e.push(`<li>${e$(t[r].replace(/^\s*[-*]\s+/,``))}</li>`),r++;n.push(`<ul>${e.join(``)}</ul>`);continue}if(/^\s*\d+[.)]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*\d+[.)]\s+/.test(t[r]);)e.push(`<li>${e$(t[r].replace(/^\s*\d+[.)]\s+/,``))}</li>`),r++;n.push(`<ol>${e.join(``)}</ol>`);continue}let a=[];for(;r<t.length&&t[r].trim()&&!/^(#{1,6}\s|```|\s*[-*]\s+|\s*\d+[.)]\s+)/.test(t[r]);)a.push(t[r]),r++;n.push(`<p>${e$(a.join(`<br />`))}</p>`)}return n.join(``)}Br();var n$=N(`<div class="lg-md text-text text-[12px] leading-relaxed break-words">`),r$=N(`<div class="flex h-full flex-col">`),i$=N(`<span class="tabular-nums text-[10.5px] text-text-faint">live · updated `),a$=N(`<svg aria-hidden width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 4.5A7 7 0 0 1 13.5 3"></path><path d="M15 11.5A7 7 0 0 1 2.5 13"></path><polyline points="1 1 1 5 5 5"></polyline><polyline points="15 11 15 15 11 15">`),o$=N(`<div class="flex-1 overflow-y-auto">`),s$=N(`<div class="min-h-0 flex-1 overflow-y-auto pl-2 pr-3"><div style=position:relative>`),c$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">My issues</span><div class="flex items-center gap-2"></div></div><div class="border-border flex shrink-0 items-center gap-1 border-b px-3 py-1.5">`),l$=N(`<button>`),u$=N(`<div style=position:absolute;top:0;left:0;width:100%>`),d$=N(`<button class="w-full cursor-pointer rounded-md px-2 py-1.5 text-left hover:bg-surface-2 transition-colors"><div class="flex items-center gap-1.5 min-w-0"><span class="font-mono text-[11px] text-text-dim shrink-0"></span><span class="truncate text-[12.5px] text-text"></span></div><div class="mt-0.5 flex items-center gap-1.5"><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),f$=N(`<span class="inline-block min-w-[6ch] text-left">← Back`),p$=N(`<span class="font-mono text-[11px] text-text-dim shrink-0">`),m$=N(`<span class="truncate text-[12px] font-medium text-text">`),h$=N(`<span class="text-[11.5px] text-text-faint">Loading…`),g$=N(`<div class="flex items-center gap-2"><span class="text-[11px] text-text-dim">`),_$=N(`<div class="flex flex-col gap-2">`),v$=N(`<div class="flex flex-col gap-1"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Attachments</span><div class="flex flex-col gap-1">`),y$=N(`<div class="flex flex-col gap-2.5"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Comments`),b$=N(`<option value=local>Message local Claude Code session`),x$=N(`<option value=new>Start NEW agent (@<!>)`),S$=N(`<option value=comment>Comment only`),C$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),w$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),T$=N(`<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="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),E$=N(`<span class="inline-block min-w-[4ch] text-left">Send`),D$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 flex-col gap-1 border-b px-3 py-2"><div class="flex items-center gap-2"></div></div><div class="min-h-0 flex-1 overflow-y-auto pl-3 pr-4 py-3 flex flex-col gap-3"></div><div class="border-border shrink-0 border-t p-2.5 flex flex-col gap-1.5"><div class="flex items-center gap-2">`),O$=N(`<option selected>`),k$=N(`<svg width=10 height=10 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),A$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><path d="M4.5 2.8a.8.8 0 0 1 1.22-.68l8 5.2a.8.8 0 0 1 0 1.36l-8 5.2a.8.8 0 0 1-1.22-.68V2.8Z">`),j$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="m2.5 4 3.5 4-3.5 4M8 12.5h5.5">`),M$=N(`<div class="bg-surface border-border overflow-clip rounded-lg border"><div class="border-border flex h-9 min-w-0 items-center justify-between gap-2 border-b px-3"><div class="flex min-w-0 items-center gap-1.5 text-[11.5px] font-medium"><span aria-hidden class="text-text-dim inline-flex"></span><span class="text-text shrink-0">Local Claude Code</span><span class="text-text-dim shrink-0">started by you</span><span class="text-text-faint shrink-0 tabular-nums">· </span></div></div><div class="flex h-9 items-center gap-1 pr-2"><button class="hover:bg-surface-2 flex h-full min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-3 text-left transition-colors"title="Open the live thread in the Local tab"><span></span><span class="text-text-faint min-w-0 flex-1 truncate text-[11.5px]"></span><svg width=14 height=14 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class="text-text-dim shrink-0"><path d="m6 3.5 4.5 4.5L6 12.5">`),N$=N(`<option>`),P$=N(`<span class="inline-block min-w-[6ch] text-center">Merge`),F$=N(`<div class="flex min-w-0 items-center gap-1.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11.5px] hover:underline">`),I$=N(`<div class="flex flex-col gap-0.5"><div class="flex items-center gap-1.5"><span class="text-[11px] font-medium text-text-dim"></span><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),L$=N(`<option>Steer running agent<!> · `),R$=N(`<span class="bg-danger inline-block size-2.5 rounded-full"aria-hidden>`),z$=N(`<span class="text-[11px] text-text-dim">`),B$=N(`<p class="text-[12px] text-text leading-relaxed whitespace-pre-wrap break-words">`),V$=N(`<div class="border-border mt-0.5 flex max-h-64 flex-col gap-1 overflow-y-auto border-t pt-1.5 pl-0.5 pr-3">`),H$=N(`<div class="bg-surface border-border rounded-lg border p-2.5 flex flex-col gap-1.5"><div class="flex items-center gap-1.5 flex-wrap"><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),U$=N(`<p class="font-mono text-text-faint text-[10.5px] leading-relaxed break-words">→ <!> `),W$=N(`<div>`);function G$(e){let t=k(()=>t$(e.text));return(()=>{var e=n$();return D(()=>e.innerHTML=t()),e})()}function K$(){let[e,t]=T(null);return O(()=>{let e=QA();e&&(t(e),tj())}),(()=>{var n=r$();return P(n,j(M,{get when(){return e()===null},get fallback(){return j(Y$,{get issueId(){return e()},onBack:()=>t(null)})},get children(){return j(q$,{onSelect:e=>t(e)})}})),n})()}function q$(e){let t,n=_r(()=>({queryKey:[`my-issues`],queryFn:fO,refetchInterval:12e3})),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:MO,refetchInterval:1e4,retry:0})),i=e=>(r.data??[]).some(t=>t.title.startsWith(e.identifier)),a=e=>e.state.type===`started`&&e.attachments?.some(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url)),o=[{id:`all`,label:`All`},{id:`active`,label:`In Progress`},{id:`review`,label:`Review`},{id:`done`,label:`Done`},{id:`cloud`,label:`Cloud`},{id:`local`,label:`Local`}],[s,c]=br(`issues:filter`,`all`),[l,u]=br(`issues:search`,``),d=k(()=>{let e=l().trim().toLowerCase();return(n.data??[]).filter(t=>{if(e&&!`${t.identifier} ${t.title}`.toLowerCase().includes(e))return!1;switch(s()){case`active`:return t.state.type===`started`;case`review`:return!!a(t);case`done`:return t.state.type===`completed`;case`cloud`:return!!t.delegate;case`local`:return i(t);default:return!0}})}),f=PQ({get count(){return d().length},getScrollElement:()=>t,estimateSize:()=>56,overscan:5});return(()=>{var r=c$(),a=r.firstChild,p=a.firstChild.nextSibling,m=a.nextSibling;return P(p,j(M,{get when(){return n.dataUpdatedAt>0},get children(){var e=i$();return e.firstChild,P(e,()=>Rj(n.dataUpdatedAt),null),e}}),null),P(p,j(Cj,{class:`size-7 px-0`,get loading(){return n.isFetching},onClick:()=>void n.refetch(),title:`Refresh`,"aria-label":`Refresh issues`,get children(){return a$()}}),null),P(m,j(We,{each:o,children:e=>(()=>{var t=l$();return t.$$click=()=>c(e.id),P(t,()=>e.label),D(()=>st(t,`h-6 shrink-0 cursor-pointer rounded-md px-2 text-[11px] font-medium transition-colors ${s()===e.id?`bg-accent-soft text-accent`:`text-text-dim hover:bg-surface-2`}`)),t})()}),null),P(m,j(Tj,{class:`ml-auto h-6 w-28 text-[11px]`,placeholder:`Search…`,get value(){return l()},onInput:e=>u(e.currentTarget.value)}),null),P(r,j(M,{get when(){return n.isError},get children(){var e=o$();return P(e,j(Fj,{title:`Connect Linear in Settings`,get children(){return n.error?.message??`Unable to load issues.`}})),e}}),null),P(r,j(M,{get when(){return $e(()=>!n.isError&&!n.isPending)()&&d().length===0},get children(){var e=o$();return P(e,j(Fj,{title:`No issues found`,children:`Issues you create will appear here.`})),e}}),null),P(r,j(M,{get when(){return $e(()=>!n.isError)()&&d().length>0},get children(){var n=s$(),r=n.firstChild,a=t;return typeof a==`function`?pt(a,n):t=n,P(r,j(We,{get each(){return f.getVirtualItems()},children:t=>{let n=k(()=>d()[t.index]);return j(M,{get when(){return n()},get children(){var r=u$();return P(r,j(J$,{get issue(){return n()},get local(){return i(n())},get onSelect(){return e.onSelect}})),D(e=>dt(r,`transform`,`translateY(${t.start}px)`)),r}})}})),D(e=>dt(r,`height`,`${f.getTotalSize()}px`)),n}}),null),r})()}function J$(e){return(()=>{var t=d$(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling,o=a.firstChild;return t.$$click=()=>e.onSelect(e.issue.id),P(n,j(Pj,{get color(){return e.issue.state.color}}),r),P(r,()=>e.issue.identifier),P(i,()=>e.issue.title),P(a,j(Nj,{get children(){return e.issue.state.name}}),o),P(a,j(M,{get when(){return e.issue.delegate},get children(){return j(Nj,{class:`text-accent`,get children(){return[j(Oj,{}),` `,$e(()=>e.issue.delegate.displayName)]}})}}),o),P(a,j(M,{get when(){return e.local},get children(){return j(Nj,{class:`text-accent`,get children(){return[j(kj,{}),` local`]}})}}),o),P(a,j(M,{get when(){return $e(()=>!!(e.issue.state.type===`started`&&e.issue.delegate))()&&e.issue.attachments?.some(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url))},get children(){return j(Nj,{color:`var(--color-warn)`,children:`needs review`})}}),o),P(o,()=>Rj(e.issue.updatedAt)),t})()}function Y$(e){let t=sr(),n=_r(()=>({queryKey:[`issue`,e.issueId],queryFn:()=>pO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),r=_r(()=>({queryKey:[`sessions`,e.issueId],queryFn:()=>mO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),i=_r(()=>({queryKey:[`settings`],queryFn:Tr})),a=_r(()=>({queryKey:[`bridge-tasks`],queryFn:MO,refetchInterval:5e3,retry:0})),o=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}],s=vr(()=>({mutationFn:e=>IO(e.id,e.model),onSuccess:e=>{t.setQueryData([`bridge-tasks`],t=>t?.map(t=>t.id===e.id?e:t))}})),c=vr(()=>({mutationFn:e=>FO(e,`Continue where you left off. If the work is already complete, finish any remaining closeout steps (PR, Linear update, announcement).`),onSuccess:()=>void t.invalidateQueries({queryKey:[`bridge-tasks`]})})),l=vr(()=>({mutationFn:e=>LO(e),onSuccess:()=>void t.invalidateQueries({queryKey:[`bridge-tasks`]})})),[u,d]=T(!1),f=async e=>{try{await navigator.clipboard.writeText(WO(e)),d(!0),setTimeout(()=>d(!1),1800)}catch{}},p=k(()=>{let e=n.data?.identifier;return e?a.data?.find(t=>t.title.startsWith(e)):void 0}),m=e=>e.status===`running`?{word:`Working…`,cls:`text-accent`}:e.status===`done`?{word:`Finished`,cls:`text-success`}:e.status===`stopped`?{word:`Stopped`,cls:`text-warn`}:{word:`Error`,cls:`text-danger`},[h,g]=br(`activity-reply:${e.issueId}`,``),[_,v]=T(null),[y,b]=T(0),x=_r(()=>({queryKey:[`grab`],queryFn:Dr,enabled:nj()===`composer`})),[S,C]=T(!1),w=async()=>{C(!0),v(null);try{let e=await GQ();e?g(t=>`${t?`${t}\n`:``}${e}\n`):v(`Nothing captured yet — pick an element, capture a region, or record first.`)}catch(e){v(e instanceof Error?e.message:`Attach failed.`)}finally{C(!1)}},E=()=>{if(nj()===`composer`){ij(`capture`);return}b(Date.now()),ij(`composer`),BZ().catch(()=>ij(`capture`))};O(()=>{if(nj()!==`composer`)return;let e=(x.data??[]).filter(e=>e.grabbedAt>y());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
257
- `);g(e=>`${e?`${e}\n`:``}${t}\n`),b(Math.max(...e.map(e=>e.grabbedAt)))});let[ee,te]=T(HD());ae(UD(te));let A=!1;O(()=>{ee().phase===`ready`&&A&&(A=!1,w())});let ne=()=>{ee().phase===`recording`?eO():(A=!0,$D())},re=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,ie=k(()=>(n.data?.attachments??[]).map(e=>e.url).filter(e=>re.test(e))),oe=_r(()=>({queryKey:[`pr-status`,ie().sort().join(`|`)],queryFn:()=>VO(ie()),refetchInterval:3e4,retry:0,enabled:ie().length>0})),se=e=>ue().has(e)?`MERGED`:oe.data?.[e],[ce,le]=T(null),[ue,de]=T(new Set),[fe,pe]=T(null),me=async n=>{pe(null),le(n);try{await HO(n),de(e=>new Set(e).add(n)),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`my-issues`]}),VQ()}catch(e){pe(e instanceof Error?`${e.message} (bridge must be running; gh needs merge rights)`:`Merge failed.`)}finally{le(null)}},he=k(()=>{let e=n.data?wO(n.data.comments):[],t=new Set(e.map(e=>e.id));return[...(r.data??[]).filter(e=>e.comment?.id&&!t.has(e.comment.id)).map(e=>({id:e.comment.id,createdAt:e.updatedAt,body:``,user:{displayName:e.appUser?.displayName??`agent`,app:!0},parent:null})),...e]}),[ge,_e]=T(`comment`),ve=!1,ye=!1;O(()=>{if(ye||!n.data||!i.data)return;ye=!0;let e=he();e.length?_e(`thread:${e[0].id}`):n.data.delegate&&i.data.cursorAgentId&&_e(`new`)}),O(()=>{ve||p()&&(ge()===`comment`||ge()===`new`)&&_e(`local`)}),O(()=>{if(ve)return;let e=he();e.length&&(ge()===`comment`||ge()===`new`)&&_e(`thread:${e[0].id}`)});let be=vr(()=>({mutationFn:async()=>{let t=h().trim();if(!t)throw Error(`Message is empty`);let n=i.data??{},r=ge();if(r===`local`){let n=p();if(!n)throw Error(`Local session not found — is the bridge running?`);await FO(n.id,t),await SO(e.issueId,`🖥️ **→ local agent:** ${t}`).catch(()=>{})}else r.startsWith(`thread:`)?await SO(e.issueId,t,r.slice(7)):r===`new`&&n.cursorAgentId?await CO(e.issueId,t,{name:n.cursorAgentName,displayName:n.cursorAgentName??`Cursor`,url:n.cursorAgentUrl}):await SO(e.issueId,t)},onSuccess:()=>{g(``),v(null),ij(`capture`),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),VQ()},onError:e=>{v(e.message??`Failed to send`)}})),xe=k(()=>n.data),Se=k(()=>r.data??[]);return(()=>{var t=D$(),r=t.firstChild,a=r.firstChild,d=r.nextSibling,v=d.nextSibling,y=v.firstChild;return P(a,j(Cj,{class:`min-w-[68px] shrink-0 text-[11px]`,get onClick(){return e.onBack},get children(){return f$()}}),null),P(a,j(M,{get when(){return xe()},get children(){return[(()=>{var e=p$();return P(e,()=>xe().identifier),e})(),(()=>{var e=m$();return P(e,()=>xe().title),e})()]}}),null),P(a,j(M,{get when(){return $e(()=>!!n.isPending)()&&!xe()},get children(){return h$()}}),null),P(r,j(M,{get when(){return xe()},get children(){var e=g$(),t=e.firstChild;return P(e,j(Pj,{get color(){return xe().state.color}}),t),P(t,()=>xe().state.name),P(e,j(Aj,{get href(){return xe().url},class:`ml-auto shrink-0`,children:`Open in Linear`}),null),e}}),null),P(d,j(M,{get when(){return p()},children:e=>{let t=()=>m(e());return(()=>{var n=M$(),r=n.firstChild,i=r.firstChild.firstChild,a=i.nextSibling.nextSibling.nextSibling;a.firstChild;var d=r.nextSibling,p=d.firstChild,m=p.firstChild,h=m.nextSibling;return P(i,j(kj,{size:12})),P(a,()=>Rj(e().startedAt),null),P(r,j(Dj,{class:`h-6 w-auto max-w-[110px] shrink-0 text-[10.5px]`,get value(){return e().pendingModel??e().model??``},onChange:t=>s.mutate({id:e().id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return[j(We,{each:o,children:t=>(()=>{var n=N$();return P(n,()=>t.label),D(()=>n.selected=(e().pendingModel??e().model??``)===t.id),D(()=>n.value=t.id),n})()}),j(M,{get when(){return!o.some(t=>t.id===(e().pendingModel??e().model??``))},get children(){var t=O$();return P(t,()=>e().pendingModel??e().model),D(()=>t.value=e().pendingModel??e().model??``),t}})]}}),null),p.$$click=()=>ej(`local`),P(p,j(M,{get when(){return e().status===`running`},get children(){return j(wj,{size:12})}}),m),P(m,()=>t().word),P(h,(()=>{var t=$e(()=>e().status===`done`);return()=>t()?e().result??e().lastText:e().lastText})()),P(d,j(M,{get when(){return e().status===`running`},get children(){return j(Cj,{variant:`danger`,class:`size-6 shrink-0 px-0`,get loading(){return l.isPending},title:`Stop the session — resumable afterwards`,"aria-label":`Stop session`,onClick:()=>l.mutate(e().id),get children(){return k$()}})}}),null),P(d,j(M,{get when(){return $e(()=>e().status!==`running`)()&&e().sessionId},get children(){return j(Cj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get loading(){return c.isPending},get title(){return`Run again — resumes this session${e().pendingModel?` on ${e().pendingModel}`:``}`},"aria-label":`Resume session`,onClick:()=>c.mutate(e().id),get children(){return A$()}})}}),null),P(d,j(M,{get when(){return e().sessionId},get children(){return j(Cj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return u()?`Copied!`:`Copy terminal resume command (claude --resume …)`},"aria-label":`Copy resume command`,onClick:()=>void f(e()),get children(){return j$()}})}}),null),D(()=>st(m,`shrink-0 text-[11.5px] font-medium ${t().cls}`)),n})()}}),null),P(d,j(M,{get when(){return Se().length>0},get children(){var e=_$();return P(e,j(We,{get each(){return Se()},children:e=>j(X$,{session:e})})),e}}),null),P(d,j(M,{get when(){return $e(()=>!!xe())()&&xe().attachments.length>0},get children(){var e=v$(),t=e.firstChild.nextSibling;return P(t,j(We,{get each(){return xe().attachments},children:e=>{let t=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url);return(()=>{var n=F$(),r=n.firstChild;return P(r,()=>e.title),P(n,j(M,{get when(){return $e(()=>!!(t&&se(e.url)))()&&se(e.url)!==`OPEN`},get children(){return j(Nj,{get class(){return`ml-auto shrink-0 ${se(e.url)===`MERGED`?`text-success`:`text-text-faint`}`},get children(){return se(e.url)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(n,j(M,{get when(){return t&&(!se(e.url)||se(e.url)===`OPEN`)},get children(){return j(Cj,{variant:`primary`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return ce()===e.url},get title(){return oe.isError?`PR state unknown — restart the bridge (npx linear-grab-bridge) for live merge status`:`Squash-merge this PR via the bridge gh — reviewed the demo? Ship it.`},onClick:()=>void me(e.url),get children(){return P$()}})}}),null),D(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),n})()}}),null),P(t,j(M,{get when(){return fe()},get children(){return j(Ij,{get message(){return fe()}})}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!xe())()&&xe().comments.length>0},get children(){var e=y$();return e.firstChild,P(e,j(Ge,{get each(){return xe().comments},children:e=>{let t=e();return(()=>{var e=I$(),n=e.firstChild,r=n.firstChild,i=r.nextSibling;return P(r,()=>t.user?.displayName??t.user?.name??`Unknown`),P(n,j(M,{get when(){return t.user?.app},get children(){return j(Nj,{children:`agent`})}}),i),P(i,()=>Rj(t.createdAt)),P(e,j(G$,{get text(){return t.body}}),null),e})()}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!(xe()&&xe().comments.length===0))()&&Se().length===0},get children(){return j(Fj,{title:`No activity yet`,children:`Comments and agent sessions will appear here.`})}}),null),P(d,j(M,{get when(){return $e(()=>!!n.isError)()&&!xe()},get children(){return j(Fj,{title:`Failed to load issue`,get children(){return n.error?.message??`Unknown error`}})}}),null),P(v,j(M,{get when(){return _()},get children(){return j(Ij,{get message(){return _()}})}}),y),P(v,j(Ej,{rows:2,placeholder:`Reply — steer the agent or add context…`,get value(){return h()},onInput:e=>g(e.target.value),get disabled(){return be.isPending}}),y),P(y,j(Dj,{class:`min-w-0 flex-1`,get value(){return ge()},onChange:e=>{ve=!0,_e(e.currentTarget.value)},get children(){return[j(M,{get when(){return p()},get children(){var e=b$();return D(()=>e.selected=ge()===`local`),e}}),j(We,{get each(){return he()},children:(e,t)=>(()=>{var n=L$(),r=n.firstChild.nextSibling;return r.nextSibling,P(n,(()=>{var e=$e(()=>he().length>1);return()=>e()?` #${t()+1}`:``})(),r),P(n,()=>Rj(e.createdAt),null),D(()=>n.selected=ge()===`thread:${e.id}`),D(()=>n.value=`thread:${e.id}`),n})()}),j(M,{get when(){return i.data?.cursorAgentId},get children(){var e=x$(),t=e.firstChild.nextSibling;return t.nextSibling,P(e,()=>i.data?.cursorAgentName??`Cursor`,t),D(()=>e.selected=ge()===`new`),e}}),(()=>{var e=S$();return D(()=>e.selected=ge()===`comment`),e})()]}}),null),P(y,j(Cj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${nj()===`composer`?`text-accent`:``}`},get title(){return nj()===`composer`?`Pick mode ON — every pick appends here. Click to stop.`:`Pick elements — refs append to this reply (stays on until toggled off or sent)`},"aria-label":`Pick element for reply`,onClick:E,get children(){return C$()}}),null),P(y,j(Cj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${ee().phase===`recording`?`text-danger`:``}`},get title(){return ee().phase===`recording`?`Stop recording — the GIF auto-attaches to this reply`:`Record a GIF from this thread (auto-attaches when done)`},"aria-label":`Record GIF`,onClick:ne,get children(){return j(M,{get when(){return ee().phase===`recording`},get fallback(){return R$()},get children(){return w$()}})}}),null),P(y,j(Cj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return S()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void w(),get children(){return T$()}}),null),P(y,j(Cj,{class:`min-w-[52px] shrink-0`,variant:`primary`,get loading(){return be.isPending},get disabled(){return h().trim().length===0},onClick:()=>be.mutate(),get children(){return E$()}}),null),t})()}function X$(e){let t=k(()=>{let t=e.session.status;return/complete|done/i.test(t)?`var(--color-success)`:/await|pending|elicit/i.test(t)?`var(--color-warn)`:`var(--color-accent)`}),n=k(()=>{let t=e.session.status;return/active/i.test(t)?`Working…`:/awaitingInput|elicit/i.test(t)?`Needs input`:/complete/i.test(t)?`Complete`:/error/i.test(t)?`Error`:/pending/i.test(t)?`Queued`:t}),r=k(()=>e.session.activities.filter(e=>e.content?.body||e.content?.action).slice(-15)),i,a=!0,o=()=>{i&&(a=i.scrollTop+i.clientHeight>=i.scrollHeight-40)};return O(()=>{let e=r().length;!i||!e||!a||requestAnimationFrame(()=>{i&&(i.scrollTop=i.scrollHeight)})}),(()=>{var a=H$(),s=a.firstChild,c=s.firstChild;return P(s,j(Nj,{get color(){return t()},get children(){return n()}}),c),P(s,j(M,{get when(){return e.session.appUser?.displayName},get children(){var t=z$();return P(t,()=>e.session.appUser.displayName),t}}),c),P(c,()=>Rj(e.session.updatedAt)),P(a,j(M,{get when(){return e.session.summary},get children(){var t=B$();return P(t,()=>e.session.summary),t}}),null),P(a,j(M,{get when(){return r().length>0},get children(){var e=V$();e.addEventListener(`scroll`,o);var t=i;return typeof t==`function`?pt(t,e):i=e,P(e,j(Ge,{get each(){return r()},children:e=>j(M,{get when(){return e().content.action},get fallback(){return(()=>{var t=W$();return P(t,j(G$,{get text(){return e().content.body??``}})),D(()=>st(t,`lg-md text-[11.5px] leading-relaxed break-words ${e().content.__typename===`AgentActivityErrorContent`?`text-danger`:`text-text`}`)),t})()},get children(){var t=U$(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>e().content.action,n),P(t,()=>e().content.parameter,null),t}})})),e}}),null),a})()}rt([`click`]);var Z$=N(`<svg aria-hidden width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 4.5A7 7 0 0 1 13.5 3"></path><path d="M15 11.5A7 7 0 0 1 2.5 13"></path><polyline points="1 1 1 5 5 5"></polyline><polyline points="15 11 15 15 11 15">`),Q$=N(`<div class="flex flex-col gap-1.5">`),$$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text inline-flex items-center gap-1.5 text-[12px] font-semibold"> Cloud agents</span><span class="text-text-faint text-[10.5px] tabular-nums"> working · updated </span></div><div class="border-border flex shrink-0 items-center gap-1 border-b px-3 py-1.5"></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),e1=N(`<button>`),t1=N(`<div class="grid place-items-center py-10">`),n1=N(`<span class="font-mono text-text-dim shrink-0 text-[11px]">`),r1=N(`<span class="text-text min-w-0 truncate text-[12.5px] font-medium">`),i1=N(`<p class="text-text-dim line-clamp-2 text-[11.5px] leading-snug break-words">`),a1=N(`<span class="text-text-dim text-[11px]">`),o1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 items-center gap-1.5"><span class=ml-auto>`),s1=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),c1=N(`<span class="text-text-dim text-[12.5px]">Conversation session`);function l1(){let e=_r(()=>({queryKey:[`cloud-sessions`],queryFn:hO,refetchInterval:12e3})),t=[{id:`all`,label:`All`},{id:`working`,label:`Working`},{id:`input`,label:`Needs input`},{id:`done`,label:`Done`}],[n,r]=br(`cloud:filter`,`all`),i=k(()=>(e.data??[]).filter(e=>{switch(n()){case`working`:return/active|pending/i.test(e.status);case`input`:return/awaitingInput|elicit/i.test(e.status);case`done`:return/complete/i.test(e.status);default:return!0}})),a=e=>/active/i.test(e)?{word:`Working…`,color:`var(--color-accent)`}:/awaitingInput|elicit/i.test(e)?{word:`Needs input`,color:`var(--color-warn)`}:/complete/i.test(e)?{word:`Complete`,color:`var(--color-success)`}:/error/i.test(e)?{word:`Error`,color:`var(--color-danger)`}:{word:e,color:`var(--color-text-dim)`},o=e=>{let t=[...e.activities].reverse().find(e=>e.content?.body||e.content?.action);return t?t.content.action?`→ ${t.content.action} ${t.content.parameter??``}`:t.content.body??``:e.summary??``},s=k(()=>(e.data??[]).filter(e=>/active|pending/i.test(e.status)).length);return(()=>{var c=$$(),l=c.firstChild,u=l.firstChild,d=u.firstChild,f=u.nextSibling,p=f.firstChild,m=l.nextSibling,h=m.nextSibling;return P(u,j(Oj,{size:13}),d),P(f,s,p),P(f,()=>Rj(e.dataUpdatedAt||Date.now()),null),P(m,j(We,{each:t,children:e=>(()=>{var t=e1();return t.$$click=()=>r(e.id),P(t,()=>e.label),D(()=>st(t,`h-6 shrink-0 cursor-pointer rounded-md px-2 text-[11px] font-medium transition-colors ${n()===e.id?`bg-accent-soft text-accent`:`text-text-dim hover:bg-surface-2`}`)),t})()}),null),P(m,j(Cj,{class:`ml-auto size-6 px-0`,get loading(){return e.isFetching},title:`Refresh`,"aria-label":`Refresh sessions`,onClick:()=>void e.refetch(),get children(){return Z$()}}),null),P(h,j(M,{get when(){return i().length>0},get fallback(){return j(M,{get when(){return!e.isPending},get fallback(){return(()=>{var e=t1();return P(e,j(wj,{})),e})()},get children(){return j(Fj,{title:`No cloud agent sessions`,children:`Delegate an issue to Cursor from the Draft tab and its live session appears here.`})}})},get children(){var e=Q$();return P(e,j(Ge,{get each(){return i()},children:e=>(()=>{var t=o1(),n=t.firstChild,r=n.firstChild,i=n.nextSibling,s=i.firstChild;return P(n,j(M,{get when(){return/active|pending/i.test(e().status)},get fallback(){return(()=>{var t=s1();return D(n=>dt(t,`background`,a(e().status).color)),t})()},get children(){return j(wj,{})}}),r),P(n,j(M,{get when(){return e().issue},get fallback(){return c1()},get children(){return[(()=>{var t=n1();return P(t,()=>e().issue.identifier),t})(),(()=>{var t=r1();return P(t,()=>e().issue.title),t})()]}}),r),P(r,()=>Rj(e().updatedAt)),P(t,j(M,{get when(){return o(e())},get children(){var t=i1();return P(t,()=>o(e())),t}}),i),P(i,j(Nj,{get color(){return a(e().status).color},get children(){return a(e().status).word}}),s),P(i,j(M,{get when(){return e().issue},get children(){return[j(Pj,{get color(){return e().issue.state.color}}),(()=>{var t=a1();return P(t,()=>e().issue.state.name),t})()]}}),s),P(i,j(M,{get when(){return e().issue},get children(){return[j(Cj,{variant:`ghost`,class:`h-6 shrink-0 px-2 text-[11px]`,title:`Open the thread — steer this agent`,onClick:()=>ej(`activity`,e().issue.id),children:`Thread`}),j(Aj,{get href(){return e().issue.url},class:`shrink-0`,children:`Linear`})]}}),null),t})()})),e}})),c})()}rt([`click`]),Br();var u1=N(`<div class="border-accent/40 bg-accent-soft self-end rounded-lg border px-2.5 py-1.5"><p class="text-accent mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase">You</p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),d1=N(`<div><p></p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),f1=N(`<p>`),p1=N(`<span class="text-text-faint max-w-[55%] truncate text-[10.5px] tabular-nums"> running · `),m1=N(`<div class="flex flex-col gap-1.5">`),h1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Local Claude Code</span></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),g1=N(`<span class="bg-surface-2 border-border font-mono mt-2 block rounded-md border px-2 py-1.5 text-[11px] select-all">npx linear-grab-bridge`),_1=N(`<span class="text-text-faint text-[10.5px] tabular-nums">ctx <!> · out `),v1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),y1=N(`<option selected>`),b1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=currentColor aria-hidden><path d="M4.5 2.8a.8.8 0 0 1 1.22-.68l8 5.2a.8.8 0 0 1 0 1.36l-8 5.2a.8.8 0 0 1-1.22-.68V2.8Z">`),x1=N(`<span class="text-success text-[12px] leading-none">✓`),S1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><path d="M14 10a2 2 0 0 1-2 2H6l-3.5 2.5V4a2 2 0 0 1 2-2H12a2 2 0 0 1 2 2v6Z">`),C1=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),w1=N(`<span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),T1=N(`<div class="border-border bg-bg flex flex-col gap-1 rounded-md border p-2"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-dim text-[10.5px] font-semibold tracking-wide uppercase">Changes</span><span class="ml-auto shrink-0 text-[10.5px] tabular-nums"><span class=text-success>+</span> <span class=text-danger>−`),E1=N(`<div class="border-border bg-bg flex max-h-80 flex-col gap-1.5 overflow-y-auto rounded-md border py-2 pl-2 pr-3">`),D1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),O1=N(`<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="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),k1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M8 2v4M8 10v4M2 8h4M10 8h4M4.5 4.5 6 6M11.5 11.5 10 10M11.5 4.5 10 6M4.5 11.5 6 10">`),A1=N(`<span class="inline-block min-w-[4ch] text-center">Send`),j1=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center gap-1"><span class="text-text-faint min-w-0 flex-1 truncate text-[10.5px]">`),M1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text min-w-0 truncate text-[12.5px] font-medium"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><p class="text-text-dim text-[11.5px] leading-snug break-words"></p><div class="flex flex-wrap items-center gap-1.5"></div><div class="flex items-center gap-1">`),N1=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),P1=N(`<div class="flex min-w-0 items-center gap-1.5">`),F1=N(`<option>`),I1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),L1=N(`<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="M2.5 3.5 6 7 2.5 10.5M7.5 12.5h6">`),R1=N(`<span class=text-success>+`),z1=N(`<span class=text-danger>−`),B1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="shrink-0 text-[10px] tabular-nums">`),V1=N(`<span class=text-text-faint>bin`),H1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="text-success shrink-0 text-[10px]">new`),U1=N(`<div class="flex min-w-0 items-center gap-1.5 pt-0.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),W1=N(`<p class="text-text-faint text-[11px]">Waiting for output…`),G1=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}];function K1(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)<(r[e]??0);return!1}var q1=e=>e==null?`–`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e);function J1(){let e=sr(),t=_r(()=>({queryKey:[`bridge-health`],queryFn:jO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`bridge-tasks`],queryFn:MO,refetchInterval:3e3,enabled:!!t.data?.ok})),[r,i]=T(null),a=_r(()=>({queryKey:[`my-issues`],queryFn:fO,staleTime:15e3})),o=e=>{let t=e.title.match(/^([A-Z][A-Z0-9]*-\d+)/)?.[1];return t?a.data?.find(e=>e.identifier===t):void 0},s=_r(()=>({queryKey:[`bridge-task`,r()],queryFn:()=>NO(r()),refetchInterval:1500,enabled:!!r()&&!!t.data?.ok})),c=_r(()=>({queryKey:[`bridge-diff`,r()],queryFn:()=>zO(r()),refetchInterval:6e3,enabled:!!r()&&!!t.data?.ok})),l=()=>{e.invalidateQueries({queryKey:[`bridge-tasks`]}),e.invalidateQueries({queryKey:[`bridge-task`,r()]})},u=vr(()=>({mutationFn:e=>LO(e),onSuccess:l})),[d,f]=br(`local:message`,``),[p,m]=T(!1),[h,g]=T(0),_=_r(()=>({queryKey:[`grab`],queryFn:Dr,enabled:nj()===`local`})),v=()=>{g(Date.now()),ij(`local`),BZ().catch(()=>ij(`capture`))};O(()=>{if(nj()!==`local`)return;let e=(_.data??[]).filter(e=>e.grabbedAt>=h());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
258
- `);f(e=>`${e?`${e}\n`:``}${t}\n`),ij(`capture`)});let y=async()=>{m(!0);try{let e=await GQ();e&&f(t=>`${t?`${t}\n`:``}${e}\n`)}finally{m(!1)}},b=vr(()=>({mutationFn:e=>FO(e.id,e.text),onSuccess:()=>{f(``),l()}})),x=vr(()=>({mutationFn:e=>IO(e.id,e.model),onSuccess:t=>{e.setQueryData([`bridge-tasks`],e=>e?.map(e=>e.id===t.id?t:e)),l()}})),S=vr(()=>({mutationFn:e=>RO(e),onSuccess:l})),C,w=!0,E=()=>{C&&(w=C.scrollTop+C.clientHeight>=C.scrollHeight-48)};O(()=>{let e=s.data?.tail?.length??0;r(),!(!C||!e||!w)&&requestAnimationFrame(()=>{C&&(C.scrollTop=C.scrollHeight)})});let[ee,te]=T(null),A=async e=>{try{await navigator.clipboard.writeText(WO(e)),te(e.id),setTimeout(()=>te(null),1800)}catch{}},ne=e=>e===`running`?`var(--color-accent)`:e===`done`?`var(--color-success)`:e===`stopped`?`var(--color-warn)`:`var(--color-danger)`,re=e=>{let t=e.line.kind,n=k(()=>t$(e.line.text));return t===`user`?(()=>{var e=u1(),t=e.firstChild.nextSibling;return D(()=>t.innerHTML=n()),e})():t===`assistant`||t===`result`?(()=>{var e=d1(),r=e.firstChild,i=r.nextSibling;return st(e,`bg-surface rounded-lg border px-2.5 py-1.5 ${t===`result`?`border-success/40`:`border-border`}`),st(r,`mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase ${t===`result`?`text-success`:`text-text-faint`}`),P(r,t===`result`?`Result`:`Claude`),D(()=>i.innerHTML=n()),e})():(()=>{var n=f1();return st(n,`font-mono px-1 text-[10px] leading-relaxed break-words ${t===`subagent`?`text-warn`:t===`stderr`?`text-danger`:`text-text-faint`}`),P(n,()=>e.line.text),n})()};return(()=>{var e=h1(),a=e.firstChild;a.firstChild;var l=a.nextSibling;return P(a,j(M,{get when(){return t.data?.ok},get fallback(){return j(Nj,{class:`text-danger`,children:`bridge offline`})},get children(){return[j(M,{get when(){return K1(t.data.version,`0.15.1`)},get children(){return j(Nj,{class:`text-warn`,title:`Ctrl+C the old process, then: npx linear-grab-bridge`,get children(){return[`v`,$e(()=>t.data.version),` outdated — restart`]}})}}),(()=>{var e=p1(),n=e.firstChild;return P(e,()=>t.data.active,n),P(e,()=>t.data.cwd.split(`/`).slice(-2).join(`/`),null),D(()=>it(e,`title`,t.data?.cwd)),e})()]}}),null),P(l,j(M,{get when(){return t.data?.ok},get fallback(){return j(Fj,{title:`Bridge not running`,get children(){return[`Start it in your repo's terminal:`,g1(),`Then delegate from the Draft tab ("Local Claude Code") or watch tasks here. Sessions stay interactive — send follow-ups, switch models, interrupt, resume in your terminal. History persists across restarts.`]}})},get children(){return j(M,{get when(){return(n.data??[]).length>0},get fallback(){return j(Fj,{title:`No local tasks yet`,children:`Create an issue in Draft with "Delegate to → Local Claude Code", and it appears here with live status and a conversation view.`})},get children(){var e=m1();return P(e,j(Ge,{get each(){return n.data},children:e=>(()=>{var t=M1(),n=t.firstChild,a=n.firstChild,l=a.nextSibling,m=n.nextSibling,h=m.nextSibling,g=h.nextSibling;return P(n,j(M,{get when(){return e().status===`running`},get fallback(){return(()=>{var t=N1();return D(n=>dt(t,`background`,ne(e().status))),t})()},get children(){return j(wj,{})}}),a),P(a,()=>e().title),P(l,()=>Rj(e().startedAt)),P(m,()=>e().lastText),P(h,j(Nj,{get color(){return ne(e().status)},get children(){return e().status}}),null),P(h,j(Nj,{get children(){return e().model??`default model`}}),null),P(h,j(M,{get when(){return e().pendingModel},get children(){return j(Nj,{class:`text-warn`,get children(){return[`→ `,$e(()=>e().pendingModel),` next msg`]}})}}),null),P(h,j(M,{get when(){return e().subagents>0},get children(){return j(Nj,{class:`text-warn`,get children(){return[`⛓ `,$e(()=>e().subagents),` subagents`]}})}}),null),P(h,j(M,{get when(){return e().usage},get children(){var t=_1(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>q1(e().usage.contextTokens),n),P(t,()=>q1(e().usage.outputTokens),null),P(t,(()=>{var t=$e(()=>!!e().usage.costUsd);return()=>t()?` · $${e().usage.costUsd.toFixed(2)}`:``})(),null),t}}),null),P(t,j(M,{get when(){return o(e())},children:e=>(()=>{var t=P1();return P(t,j(Nj,{get children(){return e().state.name}}),null),P(t,j(Aj,{get href(){return e().url},children:`Open in Linear`}),null),t})()}),g),P(t,j(M,{get when(){return $e(()=>!!e().worktree)()&&!e().worktree.removed},get children(){var t=v1(),n=t.firstChild;return P(t,j(Nj,{class:`text-warn`,children:`⎇ worktree`}),n),P(n,()=>e().worktree.branch),P(t,j(M,{get when(){return e().status!==`running`},get children(){return j(Cj,{variant:`ghost`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return S.isPending},get title(){return`Remove the worktree at ${e().worktree.path} — the branch (and PR) survive`},onClick:()=>S.mutate(e().id),children:`Remove`})}}),null),D(()=>it(n,`title`,e().worktree.path)),t}}),g),P(g,j(Dj,{class:`h-7 w-auto min-w-0 flex-1 text-[11px]`,get value(){return e().pendingModel??e().model??``},onChange:t=>x.mutate({id:e().id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return[j(We,{each:G1,children:t=>(()=>{var n=F1();return P(n,()=>t.label),D(()=>n.selected=(e().pendingModel??e().model??``)===t.id),D(()=>n.value=t.id),n})()}),j(M,{get when(){return!G1.some(t=>t.id===(e().pendingModel??e().model??``))},get children(){var t=y1();return P(t,()=>e().pendingModel??e().model),D(()=>t.value=e().pendingModel??e().model??``),t}})]}}),null),P(g,j(M,{get when(){return $e(()=>e().status!==`running`)()&&e().sessionId},get children(){return j(Cj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return b.isPending},get title(){return`Resume — continues this session${e().pendingModel?` on ${e().pendingModel}`:``}`},"aria-label":`Resume session`,onClick:()=>b.mutate({id:e().id,text:`Continue where you left off. If the work is already complete, finish any remaining closeout steps (PR, Linear update, announcement).`}),get children(){return b1()}})}}),null),P(g,j(M,{get when(){return o(e())},children:e=>j(Cj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,onClick:()=>ej(`activity`,e().id),get children(){return I1()}})}),null),P(g,j(Cj,{variant:`ghost`,class:`size-7 px-0`,get disabled(){return!e().sessionId},get title(){return $e(()=>!!e().sessionId)()?`Copy resume command · session ${e().sessionId.slice(0,8)}…`:`No session yet`},onClick:()=>void A(e()),get children(){return j(M,{get when(){return ee()===e().id},get fallback(){return L1()},get children(){return x1()}})}}),null),P(g,j(Cj,{variant:`ghost`,class:`size-7 px-0`,get title(){return r()===e().id?`Hide thread`:`Open thread — chat & changes`},onClick:()=>i(r()===e().id?null:e().id),get children(){return S1()}}),null),P(g,j(M,{get when(){return e().status===`running`},get children(){return j(Cj,{variant:`danger`,class:`size-7 px-0`,get loading(){return u.isPending},title:`Interrupt — the session stays resumable`,onClick:()=>u.mutate(e().id),get children(){return C1()}})}}),null),P(t,j(M,{get when(){return r()===e().id},get children(){return[j(M,{get when(){return $e(()=>!!c.data)()&&(c.data.files.length||c.data.untracked.length||c.data.prs.length)},get children(){var e=T1(),t=e.firstChild,n=t.firstChild.nextSibling,r=n.firstChild;r.firstChild;var i=r.nextSibling.nextSibling;return i.firstChild,P(t,j(M,{get when(){return c.data.branch},get children(){var e=w1();return P(e,()=>c.data.branch),e}}),n),P(r,()=>c.data.totalAdded,null),P(i,()=>c.data.totalDeleted,null),P(e,j(We,{get each(){return c.data.files},children:e=>(()=>{var t=B1(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.path),P(r,j(M,{get when(){return!e.binary},get fallback(){return V1()},get children(){return[(()=>{var t=R1();return t.firstChild,P(t,()=>e.added,null),t})(),` `,(()=>{var t=z1();return t.firstChild,P(t,()=>e.deleted,null),t})()]}})),D(()=>it(n,`title`,e.path)),t})()}),null),P(e,j(We,{get each(){return c.data.untracked},children:e=>(()=>{var t=H1(),n=t.firstChild;return it(n,`title`,e),P(n,e),t})()}),null),P(e,j(We,{get each(){return c.data.prs},children:e=>(()=>{var t=U1(),n=t.firstChild;return P(t,j(Nj,{class:`text-accent`,get children(){return[`PR · `,$e(()=>e.state.toLowerCase())]}}),n),P(n,()=>e.title),D(t=>{var r=e.url,i=e.title;return r!==t.e&&it(n,`href`,t.e=r),i!==t.t&&it(n,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),(()=>{var e=E1();return e.addEventListener(`scroll`,E),pt(e=>{C=e,w=!0},e),P(e,j(M,{get when(){return(s.data?.tail??[]).length>0},get fallback(){return W1()},get children(){return j(Ge,{get each(){return s.data?.tail??[]},children:e=>j(re,{get line(){return e()}})})}})),e})(),(()=>{var t=j1(),n=t.firstChild,r=n.firstChild;return P(t,j(Ej,{rows:2,get placeholder(){return e().status===`running`?`Message the working agent — it queues into the live session…`:`Follow-up — resumes the session…`},get value(){return d()},onInput:e=>f(e.currentTarget.value)}),n),P(r,(()=>{var t=$e(()=>!!e().alive);return()=>t()?`live session`:e().sessionId?`resumes on send`:`no session`})()),P(n,j(Cj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Pick elements on the page — refs drop into this message`,"aria-label":`Pick element`,onClick:v,get children(){return D1()}}),null),P(n,j(Cj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return p()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void y(),get children(){return O1()}}),null),P(n,j(Cj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get disabled(){return $e(()=>!e().alive)()&&!e().sessionId},title:`Compact the session — frees context (sends /compact)`,"aria-label":`Compact session`,onClick:()=>b.mutate({id:e().id,text:`/compact`}),get children(){return k1()}}),null),P(n,j(Cj,{variant:`primary`,class:`shrink-0`,get loading(){return b.isPending},get disabled(){return!d().trim()||!e().alive&&!e().sessionId},onClick:()=>b.mutate({id:e().id,text:d().trim()}),get children(){return A1()}}),null),t})()]}}),null),t})()})),e}})}})),e})()}var Y1=N(`<span class="text-text-faint text-[10.5px] tabular-nums">/<!> from your issues`),X1=N(`<div class="flex flex-col gap-1.5">`),Z1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Pull requests</span></div><div class="border-border flex shrink-0 items-center gap-1.5 border-b px-3 py-1.5"><div class="bg-surface-2 border-border flex shrink-0 rounded-md border p-0.5"></div></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),Q1=N(`<span class="text-warn text-[10.5px]"title="Merge states come from gh via the bridge">states unknown — restart the bridge`),$1=N(`<button>`),e0=N(`<span class="text-[12px] leading-none">✓`),t0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),n0=N(`<span class="text-success text-[12px] leading-none">✓`),r0=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><a target=_blank rel=noreferrer class="text-accent truncate text-[12.5px] font-medium hover:underline"></a><div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim shrink-0 text-[11px]"></span><span class="text-text-dim truncate text-[11.5px]"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 flex-wrap items-center gap-1.5"><div class="ml-auto flex shrink-0 items-center gap-1">`),i0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=4 cy=3.5 r=1.5></circle><circle cx=4 cy=12.5 r=1.5></circle><circle cx=12 cy=8 r=1.5></circle><path d="M4 5v6M4 6.5c0 2 2 3 4.5 3h2">`),a0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),o0=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i;function s0(e){let t=_r(()=>({queryKey:[`my-issues`],queryFn:fO,refetchInterval:15e3})),n=k(()=>(t.data??[]).flatMap(e=>(e.attachments??[]).filter(e=>o0.test(e.url)).map(t=>({issue:e,attachment:t})))),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:MO,refetchInterval:1e4,retry:0})),i=_r(()=>({queryKey:[`pr-status`,n().map(e=>e.attachment.url).sort().join(`|`)],queryFn:()=>VO(n().map(e=>e.attachment.url)),refetchInterval:3e4,retry:0,enabled:n().length>0})),a=e=>g().has(e.attachment.url)?`MERGED`:i.data?.[e.attachment.url],o=e=>!!r.data?.some(t=>t.title.startsWith(e.issue.identifier)),[s,c]=T(`all`),[l,u]=T(``),d=k(()=>{let e=l().trim().toLowerCase();return n().filter(t=>{let n=t.issue.state.type;return!(s()===`review`&&n!==`started`||s()===`open`&&!(n===`started`||n===`unstarted`||n===`backlog`)||s()===`done`&&n!==`completed`||e&&![t.attachment.title,t.issue.title,t.issue.identifier].join(` `).toLowerCase().includes(e))})}),[f,p]=T(null),[m,h]=T(null),[g,_]=T(new Set),v=async e=>{h(e);try{await HO(e),_(t=>new Set(t).add(e))}catch{}finally{h(null)}},y=async e=>{try{await navigator.clipboard.writeText(e.attachment.url),p(e.attachment.id),setTimeout(()=>p(null),1500)}catch{}};return(()=>{var r=Z1(),p=r.firstChild;p.firstChild;var h=p.nextSibling,_=h.firstChild,b=h.nextSibling;return P(p,j(M,{get when(){return!i.isError},get fallback(){return Q1()},get children(){var e=Y1(),t=e.firstChild,r=t.nextSibling;return r.nextSibling,P(e,()=>d().length,t),P(e,()=>n().length,r),e}}),null),P(_,j(We,{each:[{id:`all`,label:`All`},{id:`review`,label:`Review`},{id:`open`,label:`Open`},{id:`done`,label:`Done`}],children:e=>(()=>{var t=$1();return t.$$click=()=>c(e.id),P(t,()=>e.label),D(()=>st(t,`rounded-[5px] px-2 py-0.5 text-[11px] font-medium transition-colors ${s()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),P(h,j(Tj,{class:`h-6 min-w-0 flex-1 text-[11px]`,placeholder:`Search PRs…`,get value(){return l()},onInput:e=>u(e.currentTarget.value)}),null),P(b,j(M,{get when(){return d().length>0},get fallback(){return j(Fj,{title:`No PRs yet`,get children(){return $e(()=>!!t.isError)()?`Connect Linear in Settings.`:n().length>0?`No PRs match the current filter.`:`PRs opened by delegated agents appear here as soon as they link back to your issues.`}})},get children(){var t=X1();return P(t,j(We,{get each(){return d()},children:t=>(()=>{var n=r0(),r=n.firstChild,i=r.nextSibling,s=i.firstChild,c=s.nextSibling,l=c.nextSibling,u=i.nextSibling,d=u.firstChild;return P(r,()=>t.attachment.title||t.attachment.url),P(i,j(Pj,{get color(){return t.issue.state.color}}),s),P(s,()=>t.issue.identifier),P(c,()=>t.issue.title),P(l,()=>Rj(t.issue.updatedAt)),P(u,j(Nj,{get children(){return t.issue.state.name}}),d),P(u,j(M,{get when(){return t.issue.delegate},get children(){return j(Nj,{class:`text-accent`,get children(){return[j(Oj,{}),` `,$e(()=>t.issue.delegate.displayName)]}})}}),d),P(u,j(M,{get when(){return o(t)},get children(){return j(Nj,{class:`text-warn`,get children(){return[j(kj,{}),` local`]}})}}),d),P(u,j(Aj,{get href(){return t.issue.url},class:`shrink-0`,title:`Open the issue in Linear`,children:`Linear`}),d),P(d,j(M,{get when(){return $e(()=>!!a(t))()&&a(t)!==`OPEN`},get children(){return j(Nj,{get class(){return a(t)===`MERGED`?`text-success`:`text-text-faint`},get children(){return a(t)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(d,j(Cj,{variant:`primary`,class:`size-7 px-0`,get classList(){return{hidden:!!a(t)&&a(t)!==`OPEN`}},get loading(){return m()===t.attachment.url},get disabled(){return g().has(t.attachment.url)},get title(){return g().has(t.attachment.url)?`Merged`:`Squash-merge this PR (bridge gh)`},"aria-label":`Merge PR`,onClick:()=>void v(t.attachment.url),get children(){return j(M,{get when(){return g().has(t.attachment.url)},get fallback(){return i0()},get children(){return e0()}})}}),null),P(d,j(Cj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,"aria-label":`Open issue activity`,onClick:()=>{ej(`activity`,t.issue.id),e.onOpenIssue()},get children(){return t0()}}),null),P(d,j(Cj,{variant:`ghost`,class:`size-7 px-0`,title:`Copy PR URL`,"aria-label":`Copy PR URL`,onClick:()=>void y(t),get children(){return j(M,{get when(){return f()===t.attachment.id},get fallback(){return a0()},get children(){return n0()}})}}),null),D(e=>{var n=t.attachment.url,i=t.attachment.title;return n!==e.e&&it(r,`href`,e.e=n),i!==e.t&&it(r,`title`,e.t=i),e},{e:void 0,t:void 0}),n})()})),t}})),r})()}rt([`click`]),Br();function c0(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function l0(e){let t=c0(crypto.getRandomValues(new Uint8Array(32))),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t)),r=c0(new Uint8Array(n)),i=c0(crypto.getRandomValues(new Uint8Array(16))),a=chrome.identity.getRedirectURL(),o=new URL(`https://linear.app/oauth/authorize`);o.searchParams.set(`client_id`,e),o.searchParams.set(`redirect_uri`,a),o.searchParams.set(`response_type`,`code`),o.searchParams.set(`scope`,`read,write`),o.searchParams.set(`state`,i),o.searchParams.set(`code_challenge`,r),o.searchParams.set(`code_challenge_method`,`S256`);let s=await chrome.identity.launchWebAuthFlow({url:o.toString(),interactive:!0});if(!s)throw Error(`OAuth flow was cancelled`);let c=new URL(s).searchParams;if(c.get(`state`)!==i)throw Error(`OAuth state mismatch`);let l=c.get(`code`);if(!l)throw Error(c.get(`error_description`)??`No authorization code returned`);let u=await fetch(`https://api.linear.app/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,code:l,redirect_uri:a,client_id:e,code_verifier:t})}),d=await u.json().catch(()=>null);if(!u.ok||!d?.access_token)throw Error(`Token exchange failed — check the OAuth app callback URL and client id`);await Er({linearAccessToken:d.access_token,linearOauthClientId:e})}async function u0(){await Er({linearAccessToken:void 0,linearApiKey:void 0})}Br(),Sr(),Fx(),gD();var d0=N(`<div class="bg-surface-2 border-border flex rounded-md border p-0.5">`),f0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Cloud: picking an element opens the panel to draft &amp; delegate to the Cursor agent. Local (react-grab style): picking auto-copies the element's context — source, stack, and your skills/memory paths — straight to the clipboard for a local Claude Code or Cursor session; the panel stays out of the way. Both share the same picker; switch anytime.`),p0=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Element screenshots`),m0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Captures a highlighted screenshot of each picked element and attaches it to the issue. Costs a beat on huge pages — with this off, picking is instant (pure react-grab speed).`),h0=N(`<span class=text-text>Connected as <span class=font-medium></span> · <span class=text-text-dim>`),g0=N(`<div class="bg-surface border-border flex items-center justify-between rounded-lg border p-2.5"><span class="text-text text-[12px]">`),_0=N(`<option value>Select a team…`),v0=N(`<option value>No project`),y0=N(`<div class="flex flex-wrap gap-1">`),b0=N(`<p class="text-text-dim text-[11px]">No agents found — install the Cursor integration in Linear first.`),x0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Empty = the default above (computer-use testing, video demo, PR + review babysitting).`),S0=N(`<div class="flex flex-col gap-1.5">`),C0=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Mode</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">Beside page squeezes the app next to the panel, DevTools-style — nothing gets covered. Also toggleable from the dock icon in the panel header.`),w0=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Dock side</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">The launcher pill is draggable — park it anywhere it doesn't cover your app.`),T0=N(`<option value>Select a channel…`),E0=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Announce new issues on create`),D0=N(`<span class="text-text-faint text-[10.5px] leading-snug">⚠️ Tokens are embedded in issue Agent-instructions so agents can post the finished demo — everyone who can read the issue can read them. Use single-channel-scoped bots.`),O0=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Provider preference</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"><button>Auto</button><button>OpenAI</button><button>Anthropic`),k0=N(`<p class="text-text-dim text-[11px]">`),A0=N(`<div class=min-h-[2lh]>`),j0=N(`<ol class="text-text-faint flex list-decimal flex-col gap-1 pl-4 text-[11px] leading-relaxed"><li>Pick an element on your running dev app.</li><li>Draft the issue (AI optional).</li><li>Create + delegate — Cursor's cloud agent fixes it and opens a PR.</li><li>Track and steer it from Activity.`),M0=N(`<div class="flex h-full flex-col gap-5 overflow-y-auto pt-3 pb-6 pl-3 pr-4">`),N0=N(`<button>`),P0=N(`<div class="flex gap-1.5">`),F0=N(`<p class="text-text-faint text-center text-[10.5px]">or`),I0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Register this callback URL in your Linear OAuth app config:<br><span class="font-mono text-[10.5px] break-all">`),L0=N(`<div class="flex flex-col gap-3">`),R0=N(`<span class=text-text-dim>Connected — verifying…`),z0=N(`<option> (<!>)`),B0=N(`<option>`),V0=N(`<button type=button><span class="mr-1 inline-block size-2 rounded-full align-middle">`),H0=N(`<option value>Select the agent…`),U0=N(`<option>#`),W0=N(`<p class="text-text-dim text-[11px]">No key set — AI drafting disabled, manual drafting still works.`);function G0(){let e=sr(),t=_r(()=>({queryKey:[`settings`],queryFn:Tr,staleTime:0})),n=k(()=>t.data??{});async function r(t,n=!1){await Er(t),await e.invalidateQueries({queryKey:[`settings`]}),n&&(await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]}))}let i=k(()=>!!(n().linearApiKey||n().linearAccessToken)),a=_r(()=>({queryKey:[`viewer`],queryFn:lO,enabled:i(),retry:0})),o=_r(()=>({queryKey:[`teams`],queryFn:uO,enabled:i()})),s=_r(()=>({queryKey:[`linear-projects`],queryFn:yO,enabled:i()})),c=_r(()=>({queryKey:[`linear-labels`],queryFn:bO,enabled:i()})),l=_r(()=>({queryKey:[`agents`],queryFn:dO,enabled:i()})),[u,d]=T(``),[f,p]=T(!1),[m,h]=T(``);async function g(){let e=u().trim();if(e){p(!0),h(``);try{await r({linearApiKey:e},!0),await lO(),d(``)}catch{h(`Key rejected — could not verify. Check the key and try again.`),await r({linearApiKey:void 0},!0)}finally{p(!1)}}}let[_,v]=T(``),[y,b]=T(!1),[x,S]=T(``);async function C(){let t=(_()||n().linearOauthClientId||``).trim();if(!t){S(`Enter an OAuth client ID first.`);return}b(!0),S(``);try{await l0(t),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}catch(e){S(e instanceof Error?e.message:`OAuth flow failed.`)}finally{b(!1)}}let[w,E]=T(!1);async function O(){E(!0);try{await u0(),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}finally{E(!1)}}let ee=xr?chrome.identity.getRedirectURL():null,te=_r(()=>({queryKey:[`slack-channels`,n().slackToken],queryFn:()=>YO(n().slackToken),enabled:!!n().slackToken,retry:0,staleTime:6e4})),A=k(()=>Ax(n())),ne=k(()=>{let e=A();return e?`Drafting with ${e} — ${Nx[e].fast} (fast) / ${Nx[e].best} (best)`:null});return(()=>{var e=M0();return P(e,j(Mj,{title:`Workflow`,get children(){return[(()=>{var e=d0();return P(e,j(We,{each:[{id:`cloud`,label:`Cloud · Linear + Cursor`},{id:`local`,label:`Local · clipboard`}],children:e=>(()=>{var t=N0();return t.$$click=()=>void r({workflowMode:e.id}),P(t,()=>e.label),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-1 text-[11.5px] font-medium transition-colors ${(n().workflowMode??`cloud`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),f0()]}}),null),P(e,j(Mj,{title:`Capture`,get children(){return[(()=>{var e=p0(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({captureShots:e.currentTarget.checked||void 0})),D(()=>t.checked=!!n().captureShots),e})(),m0()]}}),null),P(e,j(Mj,{title:`Linear`,get children(){return j(M,{get when(){return i()},get fallback(){return(()=>{var e=L0();return P(e,j(jj,{label:`Personal API key`,hint:`Create one at linear.app → Settings → API — fastest path.`,get children(){return[(()=>{var e=P0();return P(e,j(Tj,{type:`password`,placeholder:`lin_api_…`,get value(){return u()},onInput:e=>d(e.currentTarget.value),"on:keydown":e=>{e.key===`Enter`&&g()}}),null),P(e,j(Cj,{variant:`primary`,get loading(){return f()},get disabled(){return!u().trim()},onClick:()=>void g(),class:`shrink-0`,children:`Connect`}),null),e})(),j(M,{get when(){return m()},get children(){return j(Ij,{get message(){return m()}})}})]}}),null),P(e,j(M,{when:xr,get children(){return[F0(),j(jj,{label:`OAuth client ID`,get children(){return[(()=>{var e=P0();return P(e,j(Tj,{placeholder:`your-client-id`,get value(){return _()||n().linearOauthClientId||``},onInput:e=>v(e.currentTarget.value)}),null),P(e,j(Cj,{variant:`ghost`,get loading(){return y()},onClick:()=>void C(),class:`shrink-0 whitespace-nowrap`,children:`Connect with OAuth`}),null),e})(),j(M,{get when(){return x()},get children(){return j(Ij,{get message(){return x()}})}}),(()=>{var e=I0(),t=e.firstChild.nextSibling.nextSibling;return P(t,ee),e})()]}})]}}),null),e})()},get children(){var e=g0(),t=e.firstChild;return P(t,j(M,{get when(){return!a.isLoading},get fallback(){return R0()},get children(){return j(M,{get when(){return a.data},get fallback(){return j(M,{get when(){return a.isError},get fallback(){return R0()},get children(){return j(Ij,{message:`Key rejected — reconnect`})}})},get children(){var e=h0(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return P(t,()=>a.data.name),P(n,()=>a.data.email),e}})}})),P(e,j(Cj,{variant:`ghost`,get loading(){return w()},onClick:()=>void O(),class:`ml-2 shrink-0`,children:`Disconnect`}),null),e}})}}),null),P(e,j(M,{get when(){return i()},get children(){return j(Mj,{title:`Workspace`,get children(){return[j(jj,{label:`Default team`,get children(){return j(Dj,{get value(){return n().defaultTeamId??``},onChange:e=>{let t=e.currentTarget.value;r({defaultTeamId:t||void 0})},get disabled(){return o.isLoading},get children(){return[_0(),j(M,{get when(){return o.data},get children(){return j(We,{get each(){return o.data},children:e=>(()=>{var t=z0(),r=t.firstChild,i=r.nextSibling;return i.nextSibling,P(t,()=>e.name,r),P(t,()=>e.key,i),D(()=>t.selected=e.id===n().defaultTeamId),D(()=>t.value=e.id),t})()})}})]}})}}),j(jj,{label:`Default project`,hint:`Every issue created from the panel is filed into this project.`,get children(){return j(Dj,{get value(){return n().defaultProjectId??``},onChange:e=>void r({defaultProjectId:e.currentTarget.value||void 0}),get disabled(){return s.isLoading},get children(){return[(()=>{var e=v0();return D(()=>e.selected=!n().defaultProjectId),e})(),j(We,{get each(){return s.data??[]},children:e=>(()=>{var t=B0();return P(t,()=>e.name),D(()=>t.selected=e.id===n().defaultProjectId),D(()=>t.value=e.id),t})()})]}})}}),j(jj,{label:`Default labels`,hint:`Applied to every issue created from the panel.`,get children(){var e=y0();return P(e,j(We,{get each(){return c.data??[]},children:e=>{let t=()=>(n().defaultLabelIds??[]).includes(e.id);return(()=>{var i=V0(),a=i.firstChild;return i.$$click=()=>{let i=n().defaultLabelIds??[];r({defaultLabelIds:t()?i.filter(t=>t!==e.id):[...i,e.id]})},P(i,()=>e.name,null),D(n=>{var r=`h-6 cursor-pointer rounded-full border px-2.5 text-[11px] font-medium transition-colors ${t()?`bg-accent-soft text-accent border-accent/40`:`bg-surface-2 text-text-dim border-border hover:bg-surface-3`}`,o=e.color;return r!==n.e&&st(i,n.e=r),o!==n.t&&dt(a,`background`,n.t=o),n},{e:void 0,t:void 0}),i})()}})),e}}),j(jj,{label:`Cursor agent`,hint:`App users in your workspace. Pick Cursor — requires the Cursor integration installed in Linear (workspace admin) with usage-based pricing enabled in Cursor.`,get children(){return j(M,{get when(){return $e(()=>!!l.data)()&&l.data.length===0},get fallback(){return j(Dj,{get value(){return n().cursorAgentId??``},onChange:e=>{let t=e.currentTarget.value;if(!t){r({cursorAgentId:void 0,cursorAgentName:void 0,cursorAgentUrl:void 0});return}let n=l.data?.find(e=>e.id===t);n&&r({cursorAgentId:n.id,cursorAgentName:n.displayName,cursorAgentUrl:n.url??void 0})},get disabled(){return l.isLoading},get children(){return[H0(),j(M,{get when(){return l.data},get children(){return j(We,{get each(){return l.data},children:e=>(()=>{var t=B0();return P(t,()=>e.displayName),D(()=>t.selected=e.id===n().cursorAgentId),D(()=>t.value=e.id),t})()})}})]}})},get children(){return b0()}})}}),j(jj,{label:`Default repository`,hint:`Appended to delegated issues as [repo=…] so Cursor picks the right repo.`,get children(){return j(Tj,{placeholder:`owner/repository`,get value(){return n().defaultRepo??``},onBlur:e=>{r({defaultRepo:e.currentTarget.value.trim()||void 0})}})}}),j(jj,{label:`Cursor cloud model`,hint:`Appended as [model=…] — e.g. claude-opus-4-8, gpt-5.2, composer. Empty = Cursor's default.`,get children(){return j(Tj,{placeholder:`Cursor's default`,get value(){return n().cursorModel??``},onBlur:e=>{r({cursorModel:e.currentTarget.value.trim()||void 0})}})}}),j(jj,{label:`Agent instructions`,hint:`Appended to every issue as '### Agent instructions' and given to the AI draft. Add demo credentials (username/password) so the agent can log in, test, and record its video. Careful: credentials become visible to everyone who can read the issue.`,get children(){return[j(Ej,{rows:5,placeholder:hD,get value(){return n().issueTemplate??``},onBlur:e=>{r({issueTemplate:e.currentTarget.value.trim()||void 0})}}),x0()]}}),j(jj,{label:`Dev server log URL`,hint:`Tail of your dev-server log attached to issues (and fed to AI drafts). Serve the log over HTTP: "dev:http": "next dev 2>&1 | tee public/dev-server.log" (gitignore it), then use /dev-server.log here. Empty = disabled.`,get children(){return j(Tj,{placeholder:`/dev-server.log`,get value(){return n().logUrl??``},onBlur:e=>{r({logUrl:e.currentTarget.value.trim()||void 0})}})}}),j(jj,{label:`Log lines to attach`,hint:`Trailing lines included in the issue (10–500).`,get children(){return j(Tj,{type:`number`,min:`10`,max:`500`,placeholder:`100`,get value(){return n().logLines??``},onBlur:e=>{let t=Number(e.currentTarget.value);r({logLines:Number.isFinite(t)&&t>0?Math.min(500,Math.max(10,Math.round(t))):void 0})}})}}),j(jj,{label:`Skills & memory paths`,hint:`One path per line. The cloud agent works in a full repo checkout, so committed paths (e.g. .claude/skills/apple-hig-design-principles) are readable directly — every issue gets a MANDATORY-reading section pointing at them. Repo-relative for cloud agents; absolute paths also work when you paste the issue into a local Claude Code session. Per project: these settings live per dev origin.`,get children(){return j(Ej,{rows:4,placeholder:`.claude/skills/apple-hig-design-principles
258
+ `);g(e=>`${e?`${e}\n`:``}${t}\n`),b(Math.max(...e.map(e=>e.grabbedAt)))});let[ee,te]=T(HD());ae(UD(te));let A=!1;O(()=>{ee().phase===`ready`&&A&&(A=!1,w())});let ne=()=>{ee().phase===`recording`?eO():(A=!0,$D())},re=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,ie=k(()=>(n.data?.attachments??[]).map(e=>e.url).filter(e=>re.test(e))),oe=_r(()=>({queryKey:[`pr-status`,ie().sort().join(`|`)],queryFn:()=>VO(ie()),refetchInterval:3e4,retry:0,enabled:ie().length>0})),se=e=>ue().has(e)?`MERGED`:oe.data?.statuses[e],[ce,le]=T(null),[ue,de]=T(new Set),[fe,pe]=T(null),me=async n=>{pe(null),le(n);try{await HO(n),de(e=>new Set(e).add(n)),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`my-issues`]}),VQ()}catch(e){pe(e instanceof Error?`${e.message} (bridge must be running; gh needs merge rights)`:`Merge failed.`)}finally{le(null)}},he=k(()=>{let e=n.data?wO(n.data.comments):[],t=new Set(e.map(e=>e.id));return[...(r.data??[]).filter(e=>e.comment?.id&&!t.has(e.comment.id)).map(e=>({id:e.comment.id,createdAt:e.updatedAt,body:``,user:{displayName:e.appUser?.displayName??`agent`,app:!0},parent:null})),...e]}),[ge,_e]=T(`comment`),ve=!1,ye=!1;O(()=>{if(ye||!n.data||!i.data)return;ye=!0;let e=he();e.length?_e(`thread:${e[0].id}`):n.data.delegate&&i.data.cursorAgentId&&_e(`new`)}),O(()=>{ve||p()&&(ge()===`comment`||ge()===`new`)&&_e(`local`)}),O(()=>{if(ve)return;let e=he();e.length&&(ge()===`comment`||ge()===`new`)&&_e(`thread:${e[0].id}`)});let be=vr(()=>({mutationFn:async()=>{let t=h().trim();if(!t)throw Error(`Message is empty`);let n=i.data??{},r=ge();if(r===`local`){let n=p();if(!n)throw Error(`Local session not found — is the bridge running?`);await FO(n.id,t),await SO(e.issueId,`🖥️ **→ local agent:** ${t}`).catch(()=>{})}else r.startsWith(`thread:`)?await SO(e.issueId,t,r.slice(7)):r===`new`&&n.cursorAgentId?await CO(e.issueId,t,{name:n.cursorAgentName,displayName:n.cursorAgentName??`Cursor`,url:n.cursorAgentUrl}):await SO(e.issueId,t)},onSuccess:()=>{g(``),v(null),ij(`capture`),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),VQ()},onError:e=>{v(e.message??`Failed to send`)}})),xe=k(()=>n.data),Se=k(()=>r.data??[]);return(()=>{var t=D$(),r=t.firstChild,a=r.firstChild,d=r.nextSibling,v=d.nextSibling,y=v.firstChild;return P(a,j(Cj,{class:`min-w-[68px] shrink-0 text-[11px]`,get onClick(){return e.onBack},get children(){return f$()}}),null),P(a,j(M,{get when(){return xe()},get children(){return[(()=>{var e=p$();return P(e,()=>xe().identifier),e})(),(()=>{var e=m$();return P(e,()=>xe().title),e})()]}}),null),P(a,j(M,{get when(){return $e(()=>!!n.isPending)()&&!xe()},get children(){return h$()}}),null),P(r,j(M,{get when(){return xe()},get children(){var e=g$(),t=e.firstChild;return P(e,j(Pj,{get color(){return xe().state.color}}),t),P(t,()=>xe().state.name),P(e,j(Aj,{get href(){return xe().url},class:`ml-auto shrink-0`,children:`Open in Linear`}),null),e}}),null),P(d,j(M,{get when(){return p()},children:e=>{let t=()=>m(e());return(()=>{var n=M$(),r=n.firstChild,i=r.firstChild.firstChild,a=i.nextSibling.nextSibling.nextSibling;a.firstChild;var d=r.nextSibling,p=d.firstChild,m=p.firstChild,h=m.nextSibling;return P(i,j(kj,{size:12})),P(a,()=>Rj(e().startedAt),null),P(r,j(Dj,{class:`h-6 w-auto max-w-[110px] shrink-0 text-[10.5px]`,get value(){return e().pendingModel??e().model??``},onChange:t=>s.mutate({id:e().id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return[j(We,{each:o,children:t=>(()=>{var n=N$();return P(n,()=>t.label),D(()=>n.selected=(e().pendingModel??e().model??``)===t.id),D(()=>n.value=t.id),n})()}),j(M,{get when(){return!o.some(t=>t.id===(e().pendingModel??e().model??``))},get children(){var t=O$();return P(t,()=>e().pendingModel??e().model),D(()=>t.value=e().pendingModel??e().model??``),t}})]}}),null),p.$$click=()=>ej(`local`),P(p,j(M,{get when(){return e().status===`running`},get children(){return j(wj,{size:12})}}),m),P(m,()=>t().word),P(h,(()=>{var t=$e(()=>e().status===`done`);return()=>t()?e().result??e().lastText:e().lastText})()),P(d,j(M,{get when(){return e().status===`running`},get children(){return j(Cj,{variant:`danger`,class:`size-6 shrink-0 px-0`,get loading(){return l.isPending},title:`Stop the session — resumable afterwards`,"aria-label":`Stop session`,onClick:()=>l.mutate(e().id),get children(){return k$()}})}}),null),P(d,j(M,{get when(){return $e(()=>e().status!==`running`)()&&e().sessionId},get children(){return j(Cj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get loading(){return c.isPending},get title(){return`Run again — resumes this session${e().pendingModel?` on ${e().pendingModel}`:``}`},"aria-label":`Resume session`,onClick:()=>c.mutate(e().id),get children(){return A$()}})}}),null),P(d,j(M,{get when(){return e().sessionId},get children(){return j(Cj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return u()?`Copied!`:`Copy terminal resume command (claude --resume …)`},"aria-label":`Copy resume command`,onClick:()=>void f(e()),get children(){return j$()}})}}),null),D(()=>st(m,`shrink-0 text-[11.5px] font-medium ${t().cls}`)),n})()}}),null),P(d,j(M,{get when(){return Se().length>0},get children(){var e=_$();return P(e,j(We,{get each(){return Se()},children:e=>j(X$,{session:e})})),e}}),null),P(d,j(M,{get when(){return $e(()=>!!xe())()&&xe().attachments.length>0},get children(){var e=v$(),t=e.firstChild.nextSibling;return P(t,j(We,{get each(){return xe().attachments},children:e=>{let t=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url);return(()=>{var n=F$(),r=n.firstChild;return P(r,()=>e.title),P(n,j(M,{get when(){return t&&oe.data?.previews[e.url]},get children(){return j(Aj,{get href(){return oe.data.previews[e.url]},class:`shrink-0`,title:`Vercel deploy preview of this PR's branch`,children:`Preview`})}}),null),P(n,j(M,{get when(){return $e(()=>!!(t&&se(e.url)))()&&se(e.url)!==`OPEN`},get children(){return j(Nj,{get class(){return`ml-auto shrink-0 ${se(e.url)===`MERGED`?`text-success`:`text-text-faint`}`},get children(){return se(e.url)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(n,j(M,{get when(){return t&&(!se(e.url)||se(e.url)===`OPEN`)},get children(){return j(Cj,{variant:`primary`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return ce()===e.url},get title(){return oe.isError?`PR state unknown — restart the bridge (npx linear-grab-bridge) for live merge status`:`Squash-merge this PR via the bridge gh — reviewed the demo? Ship it.`},onClick:()=>void me(e.url),get children(){return P$()}})}}),null),D(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),n})()}}),null),P(t,j(M,{get when(){return fe()},get children(){return j(Ij,{get message(){return fe()}})}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!xe())()&&xe().comments.length>0},get children(){var e=y$();return e.firstChild,P(e,j(Ge,{get each(){return xe().comments},children:e=>{let t=e();return(()=>{var e=I$(),n=e.firstChild,r=n.firstChild,i=r.nextSibling;return P(r,()=>t.user?.displayName??t.user?.name??`Unknown`),P(n,j(M,{get when(){return t.user?.app},get children(){return j(Nj,{children:`agent`})}}),i),P(i,()=>Rj(t.createdAt)),P(e,j(G$,{get text(){return t.body}}),null),e})()}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!(xe()&&xe().comments.length===0))()&&Se().length===0},get children(){return j(Fj,{title:`No activity yet`,children:`Comments and agent sessions will appear here.`})}}),null),P(d,j(M,{get when(){return $e(()=>!!n.isError)()&&!xe()},get children(){return j(Fj,{title:`Failed to load issue`,get children(){return n.error?.message??`Unknown error`}})}}),null),P(v,j(M,{get when(){return _()},get children(){return j(Ij,{get message(){return _()}})}}),y),P(v,j(Ej,{rows:2,placeholder:`Reply — steer the agent or add context…`,get value(){return h()},onInput:e=>g(e.target.value),get disabled(){return be.isPending}}),y),P(y,j(Dj,{class:`min-w-0 flex-1`,get value(){return ge()},onChange:e=>{ve=!0,_e(e.currentTarget.value)},get children(){return[j(M,{get when(){return p()},get children(){var e=b$();return D(()=>e.selected=ge()===`local`),e}}),j(We,{get each(){return he()},children:(e,t)=>(()=>{var n=L$(),r=n.firstChild.nextSibling;return r.nextSibling,P(n,(()=>{var e=$e(()=>he().length>1);return()=>e()?` #${t()+1}`:``})(),r),P(n,()=>Rj(e.createdAt),null),D(()=>n.selected=ge()===`thread:${e.id}`),D(()=>n.value=`thread:${e.id}`),n})()}),j(M,{get when(){return i.data?.cursorAgentId},get children(){var e=x$(),t=e.firstChild.nextSibling;return t.nextSibling,P(e,()=>i.data?.cursorAgentName??`Cursor`,t),D(()=>e.selected=ge()===`new`),e}}),(()=>{var e=S$();return D(()=>e.selected=ge()===`comment`),e})()]}}),null),P(y,j(Cj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${nj()===`composer`?`text-accent`:``}`},get title(){return nj()===`composer`?`Pick mode ON — every pick appends here. Click to stop.`:`Pick elements — refs append to this reply (stays on until toggled off or sent)`},"aria-label":`Pick element for reply`,onClick:E,get children(){return C$()}}),null),P(y,j(Cj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${ee().phase===`recording`?`text-danger`:``}`},get title(){return ee().phase===`recording`?`Stop recording — the GIF auto-attaches to this reply`:`Record a GIF from this thread (auto-attaches when done)`},"aria-label":`Record GIF`,onClick:ne,get children(){return j(M,{get when(){return ee().phase===`recording`},get fallback(){return R$()},get children(){return w$()}})}}),null),P(y,j(Cj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return S()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void w(),get children(){return T$()}}),null),P(y,j(Cj,{class:`min-w-[52px] shrink-0`,variant:`primary`,get loading(){return be.isPending},get disabled(){return h().trim().length===0},onClick:()=>be.mutate(),get children(){return E$()}}),null),t})()}function X$(e){let t=k(()=>{let t=e.session.status;return/complete|done/i.test(t)?`var(--color-success)`:/await|pending|elicit/i.test(t)?`var(--color-warn)`:`var(--color-accent)`}),n=k(()=>{let t=e.session.status;return/active/i.test(t)?`Working…`:/awaitingInput|elicit/i.test(t)?`Needs input`:/complete/i.test(t)?`Complete`:/error/i.test(t)?`Error`:/pending/i.test(t)?`Queued`:t}),r=k(()=>e.session.activities.filter(e=>e.content?.body||e.content?.action).slice(-15)),i,a=!0,o=()=>{i&&(a=i.scrollTop+i.clientHeight>=i.scrollHeight-40)};return O(()=>{let e=r().length;!i||!e||!a||requestAnimationFrame(()=>{i&&(i.scrollTop=i.scrollHeight)})}),(()=>{var a=H$(),s=a.firstChild,c=s.firstChild;return P(s,j(Nj,{get color(){return t()},get children(){return n()}}),c),P(s,j(M,{get when(){return e.session.appUser?.displayName},get children(){var t=z$();return P(t,()=>e.session.appUser.displayName),t}}),c),P(c,()=>Rj(e.session.updatedAt)),P(a,j(M,{get when(){return e.session.summary},get children(){var t=B$();return P(t,()=>e.session.summary),t}}),null),P(a,j(M,{get when(){return r().length>0},get children(){var e=V$();e.addEventListener(`scroll`,o);var t=i;return typeof t==`function`?pt(t,e):i=e,P(e,j(Ge,{get each(){return r()},children:e=>j(M,{get when(){return e().content.action},get fallback(){return(()=>{var t=W$();return P(t,j(G$,{get text(){return e().content.body??``}})),D(()=>st(t,`lg-md text-[11.5px] leading-relaxed break-words ${e().content.__typename===`AgentActivityErrorContent`?`text-danger`:`text-text`}`)),t})()},get children(){var t=U$(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>e().content.action,n),P(t,()=>e().content.parameter,null),t}})})),e}}),null),a})()}rt([`click`]);var Z$=N(`<svg aria-hidden width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 4.5A7 7 0 0 1 13.5 3"></path><path d="M15 11.5A7 7 0 0 1 2.5 13"></path><polyline points="1 1 1 5 5 5"></polyline><polyline points="15 11 15 15 11 15">`),Q$=N(`<div class="flex flex-col gap-1.5">`),$$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text inline-flex items-center gap-1.5 text-[12px] font-semibold"> Cloud agents</span><span class="text-text-faint text-[10.5px] tabular-nums"> working · updated </span></div><div class="border-border flex shrink-0 items-center gap-1 border-b px-3 py-1.5"></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),e1=N(`<button>`),t1=N(`<div class="grid place-items-center py-10">`),n1=N(`<span class="font-mono text-text-dim shrink-0 text-[11px]">`),r1=N(`<span class="text-text min-w-0 truncate text-[12.5px] font-medium">`),i1=N(`<p class="text-text-dim line-clamp-2 text-[11.5px] leading-snug break-words">`),a1=N(`<span class="text-text-dim text-[11px]">`),o1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 items-center gap-1.5"><span class=ml-auto>`),s1=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),c1=N(`<span class="text-text-dim text-[12.5px]">Conversation session`);function l1(){let e=_r(()=>({queryKey:[`cloud-sessions`],queryFn:hO,refetchInterval:12e3})),t=[{id:`all`,label:`All`},{id:`working`,label:`Working`},{id:`input`,label:`Needs input`},{id:`done`,label:`Done`}],[n,r]=br(`cloud:filter`,`all`),i=k(()=>(e.data??[]).filter(e=>{switch(n()){case`working`:return/active|pending/i.test(e.status);case`input`:return/awaitingInput|elicit/i.test(e.status);case`done`:return/complete/i.test(e.status);default:return!0}})),a=e=>/active/i.test(e)?{word:`Working…`,color:`var(--color-accent)`}:/awaitingInput|elicit/i.test(e)?{word:`Needs input`,color:`var(--color-warn)`}:/complete/i.test(e)?{word:`Complete`,color:`var(--color-success)`}:/error/i.test(e)?{word:`Error`,color:`var(--color-danger)`}:{word:e,color:`var(--color-text-dim)`},o=e=>{let t=[...e.activities].reverse().find(e=>e.content?.body||e.content?.action);return t?t.content.action?`→ ${t.content.action} ${t.content.parameter??``}`:t.content.body??``:e.summary??``},s=k(()=>(e.data??[]).filter(e=>/active|pending/i.test(e.status)).length);return(()=>{var c=$$(),l=c.firstChild,u=l.firstChild,d=u.firstChild,f=u.nextSibling,p=f.firstChild,m=l.nextSibling,h=m.nextSibling;return P(u,j(Oj,{size:13}),d),P(f,s,p),P(f,()=>Rj(e.dataUpdatedAt||Date.now()),null),P(m,j(We,{each:t,children:e=>(()=>{var t=e1();return t.$$click=()=>r(e.id),P(t,()=>e.label),D(()=>st(t,`h-6 shrink-0 cursor-pointer rounded-md px-2 text-[11px] font-medium transition-colors ${n()===e.id?`bg-accent-soft text-accent`:`text-text-dim hover:bg-surface-2`}`)),t})()}),null),P(m,j(Cj,{class:`ml-auto size-6 px-0`,get loading(){return e.isFetching},title:`Refresh`,"aria-label":`Refresh sessions`,onClick:()=>void e.refetch(),get children(){return Z$()}}),null),P(h,j(M,{get when(){return i().length>0},get fallback(){return j(M,{get when(){return!e.isPending},get fallback(){return(()=>{var e=t1();return P(e,j(wj,{})),e})()},get children(){return j(Fj,{title:`No cloud agent sessions`,children:`Delegate an issue to Cursor from the Draft tab and its live session appears here.`})}})},get children(){var e=Q$();return P(e,j(Ge,{get each(){return i()},children:e=>(()=>{var t=o1(),n=t.firstChild,r=n.firstChild,i=n.nextSibling,s=i.firstChild;return P(n,j(M,{get when(){return/active|pending/i.test(e().status)},get fallback(){return(()=>{var t=s1();return D(n=>dt(t,`background`,a(e().status).color)),t})()},get children(){return j(wj,{})}}),r),P(n,j(M,{get when(){return e().issue},get fallback(){return c1()},get children(){return[(()=>{var t=n1();return P(t,()=>e().issue.identifier),t})(),(()=>{var t=r1();return P(t,()=>e().issue.title),t})()]}}),r),P(r,()=>Rj(e().updatedAt)),P(t,j(M,{get when(){return o(e())},get children(){var t=i1();return P(t,()=>o(e())),t}}),i),P(i,j(Nj,{get color(){return a(e().status).color},get children(){return a(e().status).word}}),s),P(i,j(M,{get when(){return e().issue},get children(){return[j(Pj,{get color(){return e().issue.state.color}}),(()=>{var t=a1();return P(t,()=>e().issue.state.name),t})()]}}),s),P(i,j(M,{get when(){return e().issue},get children(){return[j(Cj,{variant:`ghost`,class:`h-6 shrink-0 px-2 text-[11px]`,title:`Open the thread — steer this agent`,onClick:()=>ej(`activity`,e().issue.id),children:`Thread`}),j(Aj,{get href(){return e().issue.url},class:`shrink-0`,children:`Linear`})]}}),null),t})()})),e}})),c})()}rt([`click`]),Br();var u1=N(`<div class="border-accent/40 bg-accent-soft self-end rounded-lg border px-2.5 py-1.5"><p class="text-accent mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase">You</p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),d1=N(`<div><p></p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),f1=N(`<p>`),p1=N(`<span class="text-text-faint max-w-[55%] truncate text-[10.5px] tabular-nums"> running · `),m1=N(`<div class="flex flex-col gap-1.5">`),h1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Local Claude Code</span></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),g1=N(`<span class="bg-surface-2 border-border font-mono mt-2 block rounded-md border px-2 py-1.5 text-[11px] select-all">npx linear-grab-bridge`),_1=N(`<span class="text-text-faint text-[10.5px] tabular-nums">ctx <!> · out `),v1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),y1=N(`<option selected>`),b1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=currentColor aria-hidden><path d="M4.5 2.8a.8.8 0 0 1 1.22-.68l8 5.2a.8.8 0 0 1 0 1.36l-8 5.2a.8.8 0 0 1-1.22-.68V2.8Z">`),x1=N(`<span class="text-success text-[12px] leading-none">✓`),S1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><path d="M14 10a2 2 0 0 1-2 2H6l-3.5 2.5V4a2 2 0 0 1 2-2H12a2 2 0 0 1 2 2v6Z">`),C1=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),w1=N(`<span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),T1=N(`<div class="border-border bg-bg flex flex-col gap-1 rounded-md border p-2"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-dim text-[10.5px] font-semibold tracking-wide uppercase">Changes</span><span class="ml-auto shrink-0 text-[10.5px] tabular-nums"><span class=text-success>+</span> <span class=text-danger>−`),E1=N(`<div class="border-border bg-bg flex max-h-80 flex-col gap-1.5 overflow-y-auto rounded-md border py-2 pl-2 pr-3">`),D1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),O1=N(`<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="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),k1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M8 2v4M8 10v4M2 8h4M10 8h4M4.5 4.5 6 6M11.5 11.5 10 10M11.5 4.5 10 6M4.5 11.5 6 10">`),A1=N(`<span class="inline-block min-w-[4ch] text-center">Send`),j1=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center gap-1"><span class="text-text-faint min-w-0 flex-1 truncate text-[10.5px]">`),M1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text min-w-0 truncate text-[12.5px] font-medium"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><p class="text-text-dim text-[11.5px] leading-snug break-words"></p><div class="flex flex-wrap items-center gap-1.5"></div><div class="flex items-center gap-1">`),N1=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),P1=N(`<div class="flex min-w-0 items-center gap-1.5">`),F1=N(`<option>`),I1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),L1=N(`<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="M2.5 3.5 6 7 2.5 10.5M7.5 12.5h6">`),R1=N(`<span class=text-success>+`),z1=N(`<span class=text-danger>−`),B1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="shrink-0 text-[10px] tabular-nums">`),V1=N(`<span class=text-text-faint>bin`),H1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="text-success shrink-0 text-[10px]">new`),U1=N(`<div class="flex min-w-0 items-center gap-1.5 pt-0.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),W1=N(`<p class="text-text-faint text-[11px]">Waiting for output…`),G1=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}];function K1(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)<(r[e]??0);return!1}var q1=e=>e==null?`–`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e);function J1(){let e=sr(),t=_r(()=>({queryKey:[`bridge-health`],queryFn:jO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`bridge-tasks`],queryFn:MO,refetchInterval:3e3,enabled:!!t.data?.ok})),[r,i]=T(null),a=_r(()=>({queryKey:[`my-issues`],queryFn:fO,staleTime:15e3})),o=e=>{let t=e.title.match(/^([A-Z][A-Z0-9]*-\d+)/)?.[1];return t?a.data?.find(e=>e.identifier===t):void 0},s=_r(()=>({queryKey:[`bridge-task`,r()],queryFn:()=>NO(r()),refetchInterval:1500,enabled:!!r()&&!!t.data?.ok})),c=_r(()=>({queryKey:[`bridge-diff`,r()],queryFn:()=>zO(r()),refetchInterval:6e3,enabled:!!r()&&!!t.data?.ok})),l=()=>{e.invalidateQueries({queryKey:[`bridge-tasks`]}),e.invalidateQueries({queryKey:[`bridge-task`,r()]})},u=vr(()=>({mutationFn:e=>LO(e),onSuccess:l})),[d,f]=br(`local:message`,``),[p,m]=T(!1),[h,g]=T(0),_=_r(()=>({queryKey:[`grab`],queryFn:Dr,enabled:nj()===`local`})),v=()=>{g(Date.now()),ij(`local`),BZ().catch(()=>ij(`capture`))};O(()=>{if(nj()!==`local`)return;let e=(_.data??[]).filter(e=>e.grabbedAt>=h());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
259
+ `);f(e=>`${e?`${e}\n`:``}${t}\n`),ij(`capture`)});let y=async()=>{m(!0);try{let e=await GQ();e&&f(t=>`${t?`${t}\n`:``}${e}\n`)}finally{m(!1)}},b=vr(()=>({mutationFn:e=>FO(e.id,e.text),onSuccess:()=>{f(``),l()}})),x=vr(()=>({mutationFn:e=>IO(e.id,e.model),onSuccess:t=>{e.setQueryData([`bridge-tasks`],e=>e?.map(e=>e.id===t.id?t:e)),l()}})),S=vr(()=>({mutationFn:e=>RO(e),onSuccess:l})),C,w=!0,E=()=>{C&&(w=C.scrollTop+C.clientHeight>=C.scrollHeight-48)};O(()=>{let e=s.data?.tail?.length??0;r(),!(!C||!e||!w)&&requestAnimationFrame(()=>{C&&(C.scrollTop=C.scrollHeight)})});let[ee,te]=T(null),A=async e=>{try{await navigator.clipboard.writeText(WO(e)),te(e.id),setTimeout(()=>te(null),1800)}catch{}},ne=e=>e===`running`?`var(--color-accent)`:e===`done`?`var(--color-success)`:e===`stopped`?`var(--color-warn)`:`var(--color-danger)`,re=e=>{let t=e.line.kind,n=k(()=>t$(e.line.text));return t===`user`?(()=>{var e=u1(),t=e.firstChild.nextSibling;return D(()=>t.innerHTML=n()),e})():t===`assistant`||t===`result`?(()=>{var e=d1(),r=e.firstChild,i=r.nextSibling;return st(e,`bg-surface rounded-lg border px-2.5 py-1.5 ${t===`result`?`border-success/40`:`border-border`}`),st(r,`mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase ${t===`result`?`text-success`:`text-text-faint`}`),P(r,t===`result`?`Result`:`Claude`),D(()=>i.innerHTML=n()),e})():(()=>{var n=f1();return st(n,`font-mono px-1 text-[10px] leading-relaxed break-words ${t===`subagent`?`text-warn`:t===`stderr`?`text-danger`:`text-text-faint`}`),P(n,()=>e.line.text),n})()};return(()=>{var e=h1(),a=e.firstChild;a.firstChild;var l=a.nextSibling;return P(a,j(M,{get when(){return t.data?.ok},get fallback(){return j(Nj,{class:`text-danger`,children:`bridge offline`})},get children(){return[j(M,{get when(){return K1(t.data.version,`0.15.1`)},get children(){return j(Nj,{class:`text-warn`,title:`Ctrl+C the old process, then: npx linear-grab-bridge`,get children(){return[`v`,$e(()=>t.data.version),` outdated — restart`]}})}}),(()=>{var e=p1(),n=e.firstChild;return P(e,()=>t.data.active,n),P(e,()=>t.data.cwd.split(`/`).slice(-2).join(`/`),null),D(()=>it(e,`title`,t.data?.cwd)),e})()]}}),null),P(l,j(M,{get when(){return t.data?.ok},get fallback(){return j(Fj,{title:`Bridge not running`,get children(){return[`Start it in your repo's terminal:`,g1(),`Then delegate from the Draft tab ("Local Claude Code") or watch tasks here. Sessions stay interactive — send follow-ups, switch models, interrupt, resume in your terminal. History persists across restarts.`]}})},get children(){return j(M,{get when(){return(n.data??[]).length>0},get fallback(){return j(Fj,{title:`No local tasks yet`,children:`Create an issue in Draft with "Delegate to → Local Claude Code", and it appears here with live status and a conversation view.`})},get children(){var e=m1();return P(e,j(Ge,{get each(){return n.data},children:e=>(()=>{var t=M1(),n=t.firstChild,a=n.firstChild,l=a.nextSibling,m=n.nextSibling,h=m.nextSibling,g=h.nextSibling;return P(n,j(M,{get when(){return e().status===`running`},get fallback(){return(()=>{var t=N1();return D(n=>dt(t,`background`,ne(e().status))),t})()},get children(){return j(wj,{})}}),a),P(a,()=>e().title),P(l,()=>Rj(e().startedAt)),P(m,()=>e().lastText),P(h,j(Nj,{get color(){return ne(e().status)},get children(){return e().status}}),null),P(h,j(Nj,{get children(){return e().model??`default model`}}),null),P(h,j(M,{get when(){return e().pendingModel},get children(){return j(Nj,{class:`text-warn`,get children(){return[`→ `,$e(()=>e().pendingModel),` next msg`]}})}}),null),P(h,j(M,{get when(){return e().subagents>0},get children(){return j(Nj,{class:`text-warn`,get children(){return[`⛓ `,$e(()=>e().subagents),` subagents`]}})}}),null),P(h,j(M,{get when(){return e().usage},get children(){var t=_1(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>q1(e().usage.contextTokens),n),P(t,()=>q1(e().usage.outputTokens),null),P(t,(()=>{var t=$e(()=>!!e().usage.costUsd);return()=>t()?` · $${e().usage.costUsd.toFixed(2)}`:``})(),null),t}}),null),P(t,j(M,{get when(){return o(e())},children:e=>(()=>{var t=P1();return P(t,j(Nj,{get children(){return e().state.name}}),null),P(t,j(Aj,{get href(){return e().url},children:`Open in Linear`}),null),t})()}),g),P(t,j(M,{get when(){return $e(()=>!!e().worktree)()&&!e().worktree.removed},get children(){var t=v1(),n=t.firstChild;return P(t,j(Nj,{class:`text-warn`,children:`⎇ worktree`}),n),P(n,()=>e().worktree.branch),P(t,j(M,{get when(){return e().status!==`running`},get children(){return j(Cj,{variant:`ghost`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return S.isPending},get title(){return`Remove the worktree at ${e().worktree.path} — the branch (and PR) survive`},onClick:()=>S.mutate(e().id),children:`Remove`})}}),null),D(()=>it(n,`title`,e().worktree.path)),t}}),g),P(g,j(Dj,{class:`h-7 w-auto min-w-0 flex-1 text-[11px]`,get value(){return e().pendingModel??e().model??``},onChange:t=>x.mutate({id:e().id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return[j(We,{each:G1,children:t=>(()=>{var n=F1();return P(n,()=>t.label),D(()=>n.selected=(e().pendingModel??e().model??``)===t.id),D(()=>n.value=t.id),n})()}),j(M,{get when(){return!G1.some(t=>t.id===(e().pendingModel??e().model??``))},get children(){var t=y1();return P(t,()=>e().pendingModel??e().model),D(()=>t.value=e().pendingModel??e().model??``),t}})]}}),null),P(g,j(M,{get when(){return $e(()=>e().status!==`running`)()&&e().sessionId},get children(){return j(Cj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return b.isPending},get title(){return`Resume — continues this session${e().pendingModel?` on ${e().pendingModel}`:``}`},"aria-label":`Resume session`,onClick:()=>b.mutate({id:e().id,text:`Continue where you left off. If the work is already complete, finish any remaining closeout steps (PR, Linear update, announcement).`}),get children(){return b1()}})}}),null),P(g,j(M,{get when(){return o(e())},children:e=>j(Cj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,onClick:()=>ej(`activity`,e().id),get children(){return I1()}})}),null),P(g,j(Cj,{variant:`ghost`,class:`size-7 px-0`,get disabled(){return!e().sessionId},get title(){return $e(()=>!!e().sessionId)()?`Copy resume command · session ${e().sessionId.slice(0,8)}…`:`No session yet`},onClick:()=>void A(e()),get children(){return j(M,{get when(){return ee()===e().id},get fallback(){return L1()},get children(){return x1()}})}}),null),P(g,j(Cj,{variant:`ghost`,class:`size-7 px-0`,get title(){return r()===e().id?`Hide thread`:`Open thread — chat & changes`},onClick:()=>i(r()===e().id?null:e().id),get children(){return S1()}}),null),P(g,j(M,{get when(){return e().status===`running`},get children(){return j(Cj,{variant:`danger`,class:`size-7 px-0`,get loading(){return u.isPending},title:`Interrupt — the session stays resumable`,onClick:()=>u.mutate(e().id),get children(){return C1()}})}}),null),P(t,j(M,{get when(){return r()===e().id},get children(){return[j(M,{get when(){return $e(()=>!!c.data)()&&(c.data.files.length||c.data.untracked.length||c.data.prs.length)},get children(){var e=T1(),t=e.firstChild,n=t.firstChild.nextSibling,r=n.firstChild;r.firstChild;var i=r.nextSibling.nextSibling;return i.firstChild,P(t,j(M,{get when(){return c.data.branch},get children(){var e=w1();return P(e,()=>c.data.branch),e}}),n),P(r,()=>c.data.totalAdded,null),P(i,()=>c.data.totalDeleted,null),P(e,j(We,{get each(){return c.data.files},children:e=>(()=>{var t=B1(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.path),P(r,j(M,{get when(){return!e.binary},get fallback(){return V1()},get children(){return[(()=>{var t=R1();return t.firstChild,P(t,()=>e.added,null),t})(),` `,(()=>{var t=z1();return t.firstChild,P(t,()=>e.deleted,null),t})()]}})),D(()=>it(n,`title`,e.path)),t})()}),null),P(e,j(We,{get each(){return c.data.untracked},children:e=>(()=>{var t=H1(),n=t.firstChild;return it(n,`title`,e),P(n,e),t})()}),null),P(e,j(We,{get each(){return c.data.prs},children:e=>(()=>{var t=U1(),n=t.firstChild;return P(t,j(Nj,{class:`text-accent`,get children(){return[`PR · `,$e(()=>e.state.toLowerCase())]}}),n),P(n,()=>e.title),D(t=>{var r=e.url,i=e.title;return r!==t.e&&it(n,`href`,t.e=r),i!==t.t&&it(n,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),(()=>{var e=E1();return e.addEventListener(`scroll`,E),pt(e=>{C=e,w=!0},e),P(e,j(M,{get when(){return(s.data?.tail??[]).length>0},get fallback(){return W1()},get children(){return j(Ge,{get each(){return s.data?.tail??[]},children:e=>j(re,{get line(){return e()}})})}})),e})(),(()=>{var t=j1(),n=t.firstChild,r=n.firstChild;return P(t,j(Ej,{rows:2,get placeholder(){return e().status===`running`?`Message the working agent — it queues into the live session…`:`Follow-up — resumes the session…`},get value(){return d()},onInput:e=>f(e.currentTarget.value)}),n),P(r,(()=>{var t=$e(()=>!!e().alive);return()=>t()?`live session`:e().sessionId?`resumes on send`:`no session`})()),P(n,j(Cj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Pick elements on the page — refs drop into this message`,"aria-label":`Pick element`,onClick:v,get children(){return D1()}}),null),P(n,j(Cj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return p()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void y(),get children(){return O1()}}),null),P(n,j(Cj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get disabled(){return $e(()=>!e().alive)()&&!e().sessionId},title:`Compact the session — frees context (sends /compact)`,"aria-label":`Compact session`,onClick:()=>b.mutate({id:e().id,text:`/compact`}),get children(){return k1()}}),null),P(n,j(Cj,{variant:`primary`,class:`shrink-0`,get loading(){return b.isPending},get disabled(){return!d().trim()||!e().alive&&!e().sessionId},onClick:()=>b.mutate({id:e().id,text:d().trim()}),get children(){return A1()}}),null),t})()]}}),null),t})()})),e}})}})),e})()}var Y1=N(`<span class="text-text-faint text-[10.5px] tabular-nums">/<!> from your issues`),X1=N(`<div class="flex flex-col gap-1.5">`),Z1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Pull requests</span></div><div class="border-border flex shrink-0 items-center gap-1.5 border-b px-3 py-1.5"><div class="bg-surface-2 border-border flex shrink-0 rounded-md border p-0.5"></div></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),Q1=N(`<span class="text-warn text-[10.5px]"title="Merge states come from gh via the bridge">states unknown — restart the bridge`),$1=N(`<button>`),e0=N(`<span class="text-[12px] leading-none">✓`),t0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),n0=N(`<span class="text-success text-[12px] leading-none">✓`),r0=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><a target=_blank rel=noreferrer class="text-accent truncate text-[12.5px] font-medium hover:underline"></a><div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim shrink-0 text-[11px]"></span><span class="text-text-dim truncate text-[11.5px]"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 flex-wrap items-center gap-1.5"><div class="ml-auto flex shrink-0 items-center gap-1">`),i0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=4 cy=3.5 r=1.5></circle><circle cx=4 cy=12.5 r=1.5></circle><circle cx=12 cy=8 r=1.5></circle><path d="M4 5v6M4 6.5c0 2 2 3 4.5 3h2">`),a0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),o0=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i;function s0(e){let t=_r(()=>({queryKey:[`my-issues`],queryFn:fO,refetchInterval:15e3})),n=k(()=>(t.data??[]).flatMap(e=>(e.attachments??[]).filter(e=>o0.test(e.url)).map(t=>({issue:e,attachment:t})))),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:MO,refetchInterval:1e4,retry:0})),i=_r(()=>({queryKey:[`pr-status`,n().map(e=>e.attachment.url).sort().join(`|`)],queryFn:()=>VO(n().map(e=>e.attachment.url)),refetchInterval:3e4,retry:0,enabled:n().length>0})),a=e=>g().has(e.attachment.url)?`MERGED`:i.data?.statuses[e.attachment.url],o=e=>!!r.data?.some(t=>t.title.startsWith(e.issue.identifier)),[s,c]=T(`all`),[l,u]=T(``),d=k(()=>{let e=l().trim().toLowerCase();return n().filter(t=>{let n=t.issue.state.type;return!(s()===`review`&&n!==`started`||s()===`open`&&!(n===`started`||n===`unstarted`||n===`backlog`)||s()===`done`&&n!==`completed`||e&&![t.attachment.title,t.issue.title,t.issue.identifier].join(` `).toLowerCase().includes(e))})}),[f,p]=T(null),[m,h]=T(null),[g,_]=T(new Set),v=async e=>{h(e);try{await HO(e),_(t=>new Set(t).add(e))}catch{}finally{h(null)}},y=async e=>{try{await navigator.clipboard.writeText(e.attachment.url),p(e.attachment.id),setTimeout(()=>p(null),1500)}catch{}};return(()=>{var r=Z1(),p=r.firstChild;p.firstChild;var h=p.nextSibling,_=h.firstChild,b=h.nextSibling;return P(p,j(M,{get when(){return!i.isError},get fallback(){return Q1()},get children(){var e=Y1(),t=e.firstChild,r=t.nextSibling;return r.nextSibling,P(e,()=>d().length,t),P(e,()=>n().length,r),e}}),null),P(_,j(We,{each:[{id:`all`,label:`All`},{id:`review`,label:`Review`},{id:`open`,label:`Open`},{id:`done`,label:`Done`}],children:e=>(()=>{var t=$1();return t.$$click=()=>c(e.id),P(t,()=>e.label),D(()=>st(t,`rounded-[5px] px-2 py-0.5 text-[11px] font-medium transition-colors ${s()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),P(h,j(Tj,{class:`h-6 min-w-0 flex-1 text-[11px]`,placeholder:`Search PRs…`,get value(){return l()},onInput:e=>u(e.currentTarget.value)}),null),P(b,j(M,{get when(){return d().length>0},get fallback(){return j(Fj,{title:`No PRs yet`,get children(){return $e(()=>!!t.isError)()?`Connect Linear in Settings.`:n().length>0?`No PRs match the current filter.`:`PRs opened by delegated agents appear here as soon as they link back to your issues.`}})},get children(){var t=X1();return P(t,j(We,{get each(){return d()},children:t=>(()=>{var n=r0(),r=n.firstChild,s=r.nextSibling,c=s.firstChild,l=c.nextSibling,u=l.nextSibling,d=s.nextSibling,p=d.firstChild;return P(r,()=>t.attachment.title||t.attachment.url),P(n,j(M,{get when(){return i.data?.previews[t.attachment.url]},get children(){return j(Aj,{get href(){return i.data.previews[t.attachment.url]},class:`shrink-0 self-start`,title:`Vercel deploy preview of this PR's branch`,children:`Preview`})}}),s),P(s,j(Pj,{get color(){return t.issue.state.color}}),c),P(c,()=>t.issue.identifier),P(l,()=>t.issue.title),P(u,()=>Rj(t.issue.updatedAt)),P(d,j(Nj,{get children(){return t.issue.state.name}}),p),P(d,j(M,{get when(){return t.issue.delegate},get children(){return j(Nj,{class:`text-accent`,get children(){return[j(Oj,{}),` `,$e(()=>t.issue.delegate.displayName)]}})}}),p),P(d,j(M,{get when(){return o(t)},get children(){return j(Nj,{class:`text-warn`,get children(){return[j(kj,{}),` local`]}})}}),p),P(d,j(Aj,{get href(){return t.issue.url},class:`shrink-0`,title:`Open the issue in Linear`,children:`Linear`}),p),P(p,j(M,{get when(){return $e(()=>!!a(t))()&&a(t)!==`OPEN`},get children(){return j(Nj,{get class(){return a(t)===`MERGED`?`text-success`:`text-text-faint`},get children(){return a(t)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(p,j(Cj,{variant:`primary`,class:`size-7 px-0`,get classList(){return{hidden:!!a(t)&&a(t)!==`OPEN`}},get loading(){return m()===t.attachment.url},get disabled(){return g().has(t.attachment.url)},get title(){return g().has(t.attachment.url)?`Merged`:`Squash-merge this PR (bridge gh)`},"aria-label":`Merge PR`,onClick:()=>void v(t.attachment.url),get children(){return j(M,{get when(){return g().has(t.attachment.url)},get fallback(){return i0()},get children(){return e0()}})}}),null),P(p,j(Cj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,"aria-label":`Open issue activity`,onClick:()=>{ej(`activity`,t.issue.id),e.onOpenIssue()},get children(){return t0()}}),null),P(p,j(Cj,{variant:`ghost`,class:`size-7 px-0`,title:`Copy PR URL`,"aria-label":`Copy PR URL`,onClick:()=>void y(t),get children(){return j(M,{get when(){return f()===t.attachment.id},get fallback(){return a0()},get children(){return n0()}})}}),null),D(e=>{var n=t.attachment.url,i=t.attachment.title;return n!==e.e&&it(r,`href`,e.e=n),i!==e.t&&it(r,`title`,e.t=i),e},{e:void 0,t:void 0}),n})()})),t}})),r})()}rt([`click`]),Br();function c0(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function l0(e){let t=c0(crypto.getRandomValues(new Uint8Array(32))),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t)),r=c0(new Uint8Array(n)),i=c0(crypto.getRandomValues(new Uint8Array(16))),a=chrome.identity.getRedirectURL(),o=new URL(`https://linear.app/oauth/authorize`);o.searchParams.set(`client_id`,e),o.searchParams.set(`redirect_uri`,a),o.searchParams.set(`response_type`,`code`),o.searchParams.set(`scope`,`read,write`),o.searchParams.set(`state`,i),o.searchParams.set(`code_challenge`,r),o.searchParams.set(`code_challenge_method`,`S256`);let s=await chrome.identity.launchWebAuthFlow({url:o.toString(),interactive:!0});if(!s)throw Error(`OAuth flow was cancelled`);let c=new URL(s).searchParams;if(c.get(`state`)!==i)throw Error(`OAuth state mismatch`);let l=c.get(`code`);if(!l)throw Error(c.get(`error_description`)??`No authorization code returned`);let u=await fetch(`https://api.linear.app/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,code:l,redirect_uri:a,client_id:e,code_verifier:t})}),d=await u.json().catch(()=>null);if(!u.ok||!d?.access_token)throw Error(`Token exchange failed — check the OAuth app callback URL and client id`);await Er({linearAccessToken:d.access_token,linearOauthClientId:e})}async function u0(){await Er({linearAccessToken:void 0,linearApiKey:void 0})}Br(),Sr(),Fx(),gD();var d0=N(`<div class="bg-surface-2 border-border flex rounded-md border p-0.5">`),f0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Cloud: picking an element opens the panel to draft &amp; delegate to the Cursor agent. Local (react-grab style): picking auto-copies the element's context — source, stack, and your skills/memory paths — straight to the clipboard for a local Claude Code or Cursor session; the panel stays out of the way. Both share the same picker; switch anytime.`),p0=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Element screenshots`),m0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Captures a highlighted screenshot of each picked element and attaches it to the issue. Costs a beat on huge pages — with this off, picking is instant (pure react-grab speed).`),h0=N(`<span class=text-text>Connected as <span class=font-medium></span> · <span class=text-text-dim>`),g0=N(`<div class="bg-surface border-border flex items-center justify-between rounded-lg border p-2.5"><span class="text-text text-[12px]">`),_0=N(`<option value>Select a team…`),v0=N(`<option value>No project`),y0=N(`<div class="flex flex-wrap gap-1">`),b0=N(`<p class="text-text-dim text-[11px]">No agents found — install the Cursor integration in Linear first.`),x0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Empty = the default above (computer-use testing, video demo, PR + review babysitting).`),S0=N(`<div class="flex flex-col gap-1.5">`),C0=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Mode</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">Beside page squeezes the app next to the panel, DevTools-style — nothing gets covered. Also toggleable from the dock icon in the panel header.`),w0=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Dock side</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">The launcher pill is draggable — park it anywhere it doesn't cover your app.`),T0=N(`<option value>Select a channel…`),E0=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Announce new issues on create`),D0=N(`<span class="text-text-faint text-[10.5px] leading-snug">⚠️ Tokens are embedded in issue Agent-instructions so agents can post the finished demo — everyone who can read the issue can read them. Use single-channel-scoped bots.`),O0=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Provider preference</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"><button>Auto</button><button>OpenAI</button><button>Anthropic`),k0=N(`<p class="text-text-dim text-[11px]">`),A0=N(`<div class=min-h-[2lh]>`),j0=N(`<ol class="text-text-faint flex list-decimal flex-col gap-1 pl-4 text-[11px] leading-relaxed"><li>Pick an element on your running dev app.</li><li>Draft the issue (AI optional).</li><li>Create + delegate — Cursor's cloud agent fixes it and opens a PR.</li><li>Track and steer it from Activity.`),M0=N(`<div class="flex h-full flex-col gap-5 overflow-y-auto pt-3 pb-6 pl-3 pr-4">`),N0=N(`<button>`),P0=N(`<div class="flex gap-1.5">`),F0=N(`<p class="text-text-faint text-center text-[10.5px]">or`),I0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Register this callback URL in your Linear OAuth app config:<br><span class="font-mono text-[10.5px] break-all">`),L0=N(`<div class="flex flex-col gap-3">`),R0=N(`<span class=text-text-dim>Connected — verifying…`),z0=N(`<option> (<!>)`),B0=N(`<option>`),V0=N(`<button type=button><span class="mr-1 inline-block size-2 rounded-full align-middle">`),H0=N(`<option value>Select the agent…`),U0=N(`<option>#`),W0=N(`<p class="text-text-dim text-[11px]">No key set — AI drafting disabled, manual drafting still works.`);function G0(){let e=sr(),t=_r(()=>({queryKey:[`settings`],queryFn:Tr,staleTime:0})),n=k(()=>t.data??{});async function r(t,n=!1){await Er(t),await e.invalidateQueries({queryKey:[`settings`]}),n&&(await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]}))}let i=k(()=>!!(n().linearApiKey||n().linearAccessToken)),a=_r(()=>({queryKey:[`viewer`],queryFn:lO,enabled:i(),retry:0})),o=_r(()=>({queryKey:[`teams`],queryFn:uO,enabled:i()})),s=_r(()=>({queryKey:[`linear-projects`],queryFn:yO,enabled:i()})),c=_r(()=>({queryKey:[`linear-labels`],queryFn:bO,enabled:i()})),l=_r(()=>({queryKey:[`agents`],queryFn:dO,enabled:i()})),[u,d]=T(``),[f,p]=T(!1),[m,h]=T(``);async function g(){let e=u().trim();if(e){p(!0),h(``);try{await r({linearApiKey:e},!0),await lO(),d(``)}catch{h(`Key rejected — could not verify. Check the key and try again.`),await r({linearApiKey:void 0},!0)}finally{p(!1)}}}let[_,v]=T(``),[y,b]=T(!1),[x,S]=T(``);async function C(){let t=(_()||n().linearOauthClientId||``).trim();if(!t){S(`Enter an OAuth client ID first.`);return}b(!0),S(``);try{await l0(t),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}catch(e){S(e instanceof Error?e.message:`OAuth flow failed.`)}finally{b(!1)}}let[w,E]=T(!1);async function O(){E(!0);try{await u0(),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}finally{E(!1)}}let ee=xr?chrome.identity.getRedirectURL():null,te=_r(()=>({queryKey:[`slack-channels`,n().slackToken],queryFn:()=>YO(n().slackToken),enabled:!!n().slackToken,retry:0,staleTime:6e4})),A=k(()=>Ax(n())),ne=k(()=>{let e=A();return e?`Drafting with ${e} — ${Nx[e].fast} (fast) / ${Nx[e].best} (best)`:null});return(()=>{var e=M0();return P(e,j(Mj,{title:`Workflow`,get children(){return[(()=>{var e=d0();return P(e,j(We,{each:[{id:`cloud`,label:`Cloud · Linear + Cursor`},{id:`local`,label:`Local · clipboard`}],children:e=>(()=>{var t=N0();return t.$$click=()=>void r({workflowMode:e.id}),P(t,()=>e.label),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-1 text-[11.5px] font-medium transition-colors ${(n().workflowMode??`cloud`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),f0()]}}),null),P(e,j(Mj,{title:`Capture`,get children(){return[(()=>{var e=p0(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({captureShots:e.currentTarget.checked||void 0})),D(()=>t.checked=!!n().captureShots),e})(),m0()]}}),null),P(e,j(Mj,{title:`Linear`,get children(){return j(M,{get when(){return i()},get fallback(){return(()=>{var e=L0();return P(e,j(jj,{label:`Personal API key`,hint:`Create one at linear.app → Settings → API — fastest path.`,get children(){return[(()=>{var e=P0();return P(e,j(Tj,{type:`password`,placeholder:`lin_api_…`,get value(){return u()},onInput:e=>d(e.currentTarget.value),"on:keydown":e=>{e.key===`Enter`&&g()}}),null),P(e,j(Cj,{variant:`primary`,get loading(){return f()},get disabled(){return!u().trim()},onClick:()=>void g(),class:`shrink-0`,children:`Connect`}),null),e})(),j(M,{get when(){return m()},get children(){return j(Ij,{get message(){return m()}})}})]}}),null),P(e,j(M,{when:xr,get children(){return[F0(),j(jj,{label:`OAuth client ID`,get children(){return[(()=>{var e=P0();return P(e,j(Tj,{placeholder:`your-client-id`,get value(){return _()||n().linearOauthClientId||``},onInput:e=>v(e.currentTarget.value)}),null),P(e,j(Cj,{variant:`ghost`,get loading(){return y()},onClick:()=>void C(),class:`shrink-0 whitespace-nowrap`,children:`Connect with OAuth`}),null),e})(),j(M,{get when(){return x()},get children(){return j(Ij,{get message(){return x()}})}}),(()=>{var e=I0(),t=e.firstChild.nextSibling.nextSibling;return P(t,ee),e})()]}})]}}),null),e})()},get children(){var e=g0(),t=e.firstChild;return P(t,j(M,{get when(){return!a.isLoading},get fallback(){return R0()},get children(){return j(M,{get when(){return a.data},get fallback(){return j(M,{get when(){return a.isError},get fallback(){return R0()},get children(){return j(Ij,{message:`Key rejected — reconnect`})}})},get children(){var e=h0(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return P(t,()=>a.data.name),P(n,()=>a.data.email),e}})}})),P(e,j(Cj,{variant:`ghost`,get loading(){return w()},onClick:()=>void O(),class:`ml-2 shrink-0`,children:`Disconnect`}),null),e}})}}),null),P(e,j(M,{get when(){return i()},get children(){return j(Mj,{title:`Workspace`,get children(){return[j(jj,{label:`Default team`,get children(){return j(Dj,{get value(){return n().defaultTeamId??``},onChange:e=>{let t=e.currentTarget.value;r({defaultTeamId:t||void 0})},get disabled(){return o.isLoading},get children(){return[_0(),j(M,{get when(){return o.data},get children(){return j(We,{get each(){return o.data},children:e=>(()=>{var t=z0(),r=t.firstChild,i=r.nextSibling;return i.nextSibling,P(t,()=>e.name,r),P(t,()=>e.key,i),D(()=>t.selected=e.id===n().defaultTeamId),D(()=>t.value=e.id),t})()})}})]}})}}),j(jj,{label:`Default project`,hint:`Every issue created from the panel is filed into this project.`,get children(){return j(Dj,{get value(){return n().defaultProjectId??``},onChange:e=>void r({defaultProjectId:e.currentTarget.value||void 0}),get disabled(){return s.isLoading},get children(){return[(()=>{var e=v0();return D(()=>e.selected=!n().defaultProjectId),e})(),j(We,{get each(){return s.data??[]},children:e=>(()=>{var t=B0();return P(t,()=>e.name),D(()=>t.selected=e.id===n().defaultProjectId),D(()=>t.value=e.id),t})()})]}})}}),j(jj,{label:`Default labels`,hint:`Applied to every issue created from the panel.`,get children(){var e=y0();return P(e,j(We,{get each(){return c.data??[]},children:e=>{let t=()=>(n().defaultLabelIds??[]).includes(e.id);return(()=>{var i=V0(),a=i.firstChild;return i.$$click=()=>{let i=n().defaultLabelIds??[];r({defaultLabelIds:t()?i.filter(t=>t!==e.id):[...i,e.id]})},P(i,()=>e.name,null),D(n=>{var r=`h-6 cursor-pointer rounded-full border px-2.5 text-[11px] font-medium transition-colors ${t()?`bg-accent-soft text-accent border-accent/40`:`bg-surface-2 text-text-dim border-border hover:bg-surface-3`}`,o=e.color;return r!==n.e&&st(i,n.e=r),o!==n.t&&dt(a,`background`,n.t=o),n},{e:void 0,t:void 0}),i})()}})),e}}),j(jj,{label:`Cursor agent`,hint:`App users in your workspace. Pick Cursor — requires the Cursor integration installed in Linear (workspace admin) with usage-based pricing enabled in Cursor.`,get children(){return j(M,{get when(){return $e(()=>!!l.data)()&&l.data.length===0},get fallback(){return j(Dj,{get value(){return n().cursorAgentId??``},onChange:e=>{let t=e.currentTarget.value;if(!t){r({cursorAgentId:void 0,cursorAgentName:void 0,cursorAgentUrl:void 0});return}let n=l.data?.find(e=>e.id===t);n&&r({cursorAgentId:n.id,cursorAgentName:n.displayName,cursorAgentUrl:n.url??void 0})},get disabled(){return l.isLoading},get children(){return[H0(),j(M,{get when(){return l.data},get children(){return j(We,{get each(){return l.data},children:e=>(()=>{var t=B0();return P(t,()=>e.displayName),D(()=>t.selected=e.id===n().cursorAgentId),D(()=>t.value=e.id),t})()})}})]}})},get children(){return b0()}})}}),j(jj,{label:`Default repository`,hint:`Appended to delegated issues as [repo=…] so Cursor picks the right repo.`,get children(){return j(Tj,{placeholder:`owner/repository`,get value(){return n().defaultRepo??``},onBlur:e=>{r({defaultRepo:e.currentTarget.value.trim()||void 0})}})}}),j(jj,{label:`Cursor cloud model`,hint:`Appended as [model=…] — e.g. claude-opus-4-8, gpt-5.2, composer. Empty = Cursor's default.`,get children(){return j(Tj,{placeholder:`Cursor's default`,get value(){return n().cursorModel??``},onBlur:e=>{r({cursorModel:e.currentTarget.value.trim()||void 0})}})}}),j(jj,{label:`Agent instructions`,hint:`Appended to every issue as '### Agent instructions' and given to the AI draft. Add demo credentials (username/password) so the agent can log in, test, and record its video. Careful: credentials become visible to everyone who can read the issue.`,get children(){return[j(Ej,{rows:5,placeholder:hD,get value(){return n().issueTemplate??``},onBlur:e=>{r({issueTemplate:e.currentTarget.value.trim()||void 0})}}),x0()]}}),j(jj,{label:`Dev server log URL`,hint:`Tail of your dev-server log attached to issues (and fed to AI drafts). Serve the log over HTTP: "dev:http": "next dev 2>&1 | tee public/dev-server.log" (gitignore it), then use /dev-server.log here. Empty = disabled.`,get children(){return j(Tj,{placeholder:`/dev-server.log`,get value(){return n().logUrl??``},onBlur:e=>{r({logUrl:e.currentTarget.value.trim()||void 0})}})}}),j(jj,{label:`Log lines to attach`,hint:`Trailing lines included in the issue (10–500).`,get children(){return j(Tj,{type:`number`,min:`10`,max:`500`,placeholder:`100`,get value(){return n().logLines??``},onBlur:e=>{let t=Number(e.currentTarget.value);r({logLines:Number.isFinite(t)&&t>0?Math.min(500,Math.max(10,Math.round(t))):void 0})}})}}),j(jj,{label:`Skills & memory paths`,hint:`One path per line. The cloud agent works in a full repo checkout, so committed paths (e.g. .claude/skills/apple-hig-design-principles) are readable directly — every issue gets a MANDATORY-reading section pointing at them. Repo-relative for cloud agents; absolute paths also work when you paste the issue into a local Claude Code session. Per project: these settings live per dev origin.`,get children(){return j(Ej,{rows:4,placeholder:`.claude/skills/apple-hig-design-principles
259
260
  .claude/CLAUDE.md
260
261
  docs/design-tokens.md`,get value(){return n().skillPaths??``},onBlur:e=>{r({skillPaths:e.currentTarget.value.trim()||void 0})}})}}),j(jj,{label:`Test account`,hint:`The cloud agent logs into the app with this while testing and recording its demo. Added to every issue's Agent instructions. Use a throwaway account — it's visible to everyone who can read the issue.`,get children(){var e=S0();return P(e,j(Tj,{placeholder:`Username or email (e.g. demo@yourapp.com)`,get value(){return n().testUsername??``},onBlur:e=>{r({testUsername:e.currentTarget.value.trim()||void 0})}}),null),P(e,j(Tj,{type:`password`,placeholder:`Password`,get value(){return n().testPassword??``},onBlur:e=>{r({testPassword:e.currentTarget.value.trim()||void 0})}}),null),e}})]}})}}),null),P(e,j(M,{when:!xr,get children(){return j(Mj,{title:`Panel`,get children(){return[(()=>{var e=C0(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[{id:`overlay`,label:`Overlay`},{id:`pinned`,label:`Beside page`}],children:e=>(()=>{var t=N0();return t.$$click=()=>void r({panelMode:e.id,panelPos:void 0}),P(t,()=>e.label),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelMode??`overlay`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),(()=>{var e=w0(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[`left`,`right`],children:e=>(()=>{var t=N0();return t.$$click=()=>void r({panelSide:e}),P(t,e===`left`?`Left`:`Right`),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelSide??`right`)===e?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})()]}})}}),null),P(e,j(Mj,{title:`Local Claude Code`,get children(){return j(jj,{label:`Bridge URL`,hint:'Run `npx linear-grab-bridge` in your repo\'s terminal (binds localhost only). Enables "Delegate to → Local Claude Code" in Draft, the Local tab, and relays blocked uploads to Linear storage.',get children(){return j(Tj,{placeholder:`http://localhost:4577`,get value(){return n().bridgeUrl??``},onBlur:e=>{r({bridgeUrl:e.currentTarget.value.trim()||void 0})}})}})}}),null),P(e,j(Mj,{title:`Asset uploads`,get children(){return[j(jj,{label:`GitHub token`,hint:`Linear's storage blocks browser uploads in some browsers (Safari). With this set, GIFs/screenshots upload to your GitHub repo instead and embed automatically. Fine-grained PAT with Contents read/write on the assets repo.`,get children(){return j(Tj,{type:`password`,placeholder:`github_pat_…`,get value(){return n().githubToken??``},onBlur:e=>{r({githubToken:e.currentTarget.value.trim()||void 0})}})}}),j(jj,{label:`Assets repository`,hint:`owner/repo — must be PUBLIC so Linear (and agents) can render the images. Files land under linear-grab/.`,get children(){return j(Tj,{placeholder:`ahmedbanihanibh/linear-grab-assets`,get value(){return n().githubAssetsRepo??``},onBlur:e=>{r({githubAssetsRepo:e.currentTarget.value.trim()||void 0})}})}})]}}),null),P(e,j(Mj,{title:`Notifications`,get children(){return[j(jj,{label:`Slack bot token`,hint:`Bot token (xoxb-…) with chat:write + channels:read + files:write. New issues get announced with links + demo, and the AGENT receives the token to post its finished demo video itself.`,get children(){return j(Tj,{type:`password`,placeholder:`xoxb-…`,get value(){return n().slackToken??``},onBlur:e=>{r({slackToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().slackToken},get children(){return j(jj,{label:`Slack channel`,get children(){return j(M,{get when(){return!te.isError},get fallback(){return j(Ij,{message:`Couldn't list channels — check the token scopes (channels:read).`})},get children(){return j(Dj,{get value(){return n().slackChannelId??``},get disabled(){return te.isLoading},onChange:e=>{let t=e.currentTarget.value,n=te.data?.find(e=>e.id===t);r({slackChannelId:t||void 0,slackChannelName:n?.name})},get children(){return[T0(),j(We,{get each(){return te.data??[]},children:e=>(()=>{var t=U0();return t.firstChild,P(t,()=>e.name,null),D(()=>t.selected=e.id===n().slackChannelId),D(()=>t.value=e.id),t})()})]}})}})}})}}),j(jj,{label:`Telegram bot token`,hint:`From @BotFather. The agent also receives it to send the demo video (sendVideo).`,get children(){return j(Tj,{type:`password`,placeholder:`123456:ABC-…`,get value(){return n().telegramToken??``},onBlur:e=>{r({telegramToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().telegramToken},get children(){return j(jj,{label:`Telegram chat ID`,hint:`Add the bot to your group/channel, send a message, then read the chat id from api.telegram.org/bot<token>/getUpdates.`,get children(){return j(Tj,{placeholder:`-1001234567890`,get value(){return n().telegramChatId??``},onBlur:e=>{r({telegramChatId:e.currentTarget.value.trim()||void 0})}})}})}}),(()=>{var e=E0(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({notifyOnCreate:e.currentTarget.checked?void 0:!1})),D(()=>t.checked=n().notifyOnCreate!==!1),e})(),D0()]}}),null),P(e,j(Mj,{title:`AI providers`,get children(){return[j(jj,{label:`OpenAI API key`,get children(){return j(Tj,{type:`password`,placeholder:`sk-…`,get value(){return n().openaiKey??``},onBlur:e=>{r({openaiKey:e.currentTarget.value.trim()||void 0})}})}}),j(jj,{label:`Anthropic API key`,get children(){return j(Tj,{type:`password`,placeholder:`sk-ant-…`,get value(){return n().anthropicKey??``},onBlur:e=>{r({anthropicKey:e.currentTarget.value.trim()||void 0})}})}}),(()=>{var e=O0(),t=e.firstChild.nextSibling.firstChild,i=t.nextSibling,a=i.nextSibling;return t.$$click=()=>void r({preferredProvider:void 0}),i.$$click=()=>void r({preferredProvider:`openai`}),a.$$click=()=>void r({preferredProvider:`anthropic`}),D(e=>{var r=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${n().preferredProvider===void 0?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`,o=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`openai`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,s=!n().openaiKey,c=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`anthropic`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,l=!n().anthropicKey;return r!==e.e&&st(t,e.e=r),o!==e.t&&st(i,e.t=o),s!==e.a&&(i.disabled=e.a=s),c!==e.o&&st(a,e.o=c),l!==e.i&&(a.disabled=e.i=l),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e})(),(()=>{var e=A0();return P(e,j(M,{get when(){return ne()},get fallback(){return W0()},get children(){var e=k0();return P(e,ne),e}})),e})()]}}),null),P(e,j(Mj,{title:`How it works`,get children(){return j0()}}),null),e})()}rt([`click`]);var K0=`linear-grab`,q0=`queries`,J0=[`my-issues`,`issue`,`sessions`,`teams`,`agents`];function Y0(){return new Promise(e=>{try{let t=indexedDB.open(K0,1);t.onupgradeneeded=()=>t.result.createObjectStore(q0),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}function X0(e){return typeof e[0]==`string`&&J0.includes(e[0])}async function Z0(e){let t=await Y0();if(!t)return()=>{};await new Promise(n=>{try{let r=t.transaction(q0,`readonly`).objectStore(q0).openCursor();r.onsuccess=()=>{let t=r.result;if(!t)return n();try{let{queryKey:n,data:r}=t.value;X0(n)&&e.getQueryData(n)===void 0&&e.setQueryData(n,r,{updatedAt:0})}catch{}t.continue()},r.onerror=()=>n()}catch{n()}});let n=new Map,r=e.getQueryCache().subscribe(r=>{if(r.type!==`updated`||r.action.type!==`success`)return;let{queryKey:i,queryHash:a}=r.query;if(!X0(i))return;let o=n.get(a);o&&clearTimeout(o),n.set(a,setTimeout(()=>{n.delete(a);try{let n=e.getQueryData(i);if(n===void 0)return;t.transaction(q0,`readwrite`).objectStore(q0).put({queryKey:i,data:n},a)}catch{}},400))});return()=>{r();for(let e of n.values())clearTimeout(e);t.close()}}Br();var Q0=N(`<svg viewBox="0 0 100 100"fill=currentColor aria-hidden><path d="M1.22541 61.5228c-.2225-.9485.90748-1.5459 1.59638-.857L39.3342 97.1782c.6889.6889.0915 1.8189-.857 1.5964C20.0515 94.4522 5.54779 79.9485 1.22541 61.5228ZM.00189135 46.8891c-.01764375.2833.08887215.5599.28957165.7606L52.3503 99.7085c.2007.2007.4773.3075.7606.2896 2.3692-.1476 4.6938-.46 6.9624-.9259.7645-.157 1.0301-1.0963.4782-1.6481L2.57595 39.4485c-.55186-.5519-1.49117-.2863-1.648174.4782-.465915 2.2686-.77832 4.5932-.92588465 6.9624ZM4.21093 29.7054c-.16649.3738-.08169.8106.20765 1.1l64.77602 64.776c.2894.2894.7262.3742 1.1.2077 1.7861-.7956 3.5171-1.6927 5.1855-2.684.5521-.328.6373-1.0867.1832-1.5407L8.43566 24.3367c-.45409-.4541-1.21271-.3689-1.54074.1832-.99132 1.6684-1.88843 3.3994-2.68399 5.1855ZM12.6587 18.074c-.3701-.3701-.393-.9637-.0443-1.3541C21.7795 6.45931 35.1114 0 49.9519 0 77.5927 0 100 22.4073 100 50.0481c0 14.8405-6.4593 28.1724-16.7199 37.3375-.3903.3487-.984.3258-1.3541-.0443L12.6587 18.074Z">`),$0=N(`<button><svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><rect x=1.5 y=2.5 width=13 height=11 rx=1.5></rect><path d="M10 2.5v11">`),e2=N(`<button aria-label="Minimize to launcher"title="Minimize to launcher"class="text-text-dim hover:text-text hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md text-[15px] leading-none transition-colors">–`),t2=N(`<div class="bg-bg text-text flex h-full flex-col"><header><span class="text-accent mr-0.5 inline-flex shrink-0"title="Linear Grab"></span><div class="no-scrollbar flex min-w-0 flex-1 items-center gap-1 overflow-x-auto"></div></header><main class="min-h-0 flex-1"><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full>`),n2=N(`<button>`),r2=[{id:`draft`,label:`Draft`},{id:`capture`,label:`Capture`},{id:`activity`,label:`Activity`},{id:`cloud`,label:`Cloud`},{id:`local`,label:`Local`},{id:`prs`,label:`PRs`},{id:`settings`,label:`Settings`}],i2=new gr({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});function a2(e){return(()=>{var t=Q0();return D(n=>{var r=e.size??14,i=e.size??14;return r!==n.e&&it(t,`width`,n.e=r),i!==n.t&&it(t,`height`,n.t=i),n},{e:void 0,t:void 0}),t})()}function o2(e){let[t,n]=T(`draft`),r=()=>{i2.invalidateQueries({queryKey:[`grab`]}),nj()===`capture`&&n(`capture`),e.onGrab?.()};return O(()=>{let e=XA();e&&n(e)}),ie(()=>{let e=Z0(i2),t=VZ(r),n=()=>{UO().then(QQ),BO()};n();let i=Mr(e=>{e===`settings`&&(i2.invalidateQueries({queryKey:[`settings`]}),n()),e===`grab`&&r()});ae(()=>{t(),i(),e.then(e=>e())})}),j(cr,{client:i2,get children(){var r=t2(),i=r.firstChild,a=i.firstChild,o=a.nextSibling,s=i.nextSibling.firstChild,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,d=u.nextSibling,f=d.nextSibling,p=f.nextSibling;return i.$$pointerdown=t=>e.onHeaderPointerDown?.(t),P(a,j(a2,{size:14})),P(o,j(We,{each:r2,children:e=>(()=>{var r=n2();return r.$$click=()=>n(e.id),P(r,()=>e.label),D(()=>st(r,`h-6 shrink-0 rounded-md px-2 text-[12px] font-medium whitespace-nowrap transition-colors ${t()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),r})()})),P(i,j(M,{get when(){return e.onTogglePin},get children(){var t=$0();return t.$$click=()=>e.onTogglePin?.(),D(n=>{var r=e.pinned?`Switch to overlay`:`Dock beside page`,i=e.pinned?`Overlay the page`:`Dock beside page (squeezes the app, DevTools-style)`,a=`hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md transition-colors ${e.pinned?`text-accent`:`text-text-dim hover:text-text`}`;return r!==n.e&&it(t,`aria-label`,n.e=r),i!==n.t&&it(t,`title`,n.t=i),a!==n.a&&st(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t}}),null),P(i,j(M,{get when(){return e.onClose},get children(){var t=e2();return t.$$click=()=>e.onClose?.(),t}}),null),P(s,j(gM,{onCreated:()=>n(`activity`)})),P(c,j(dQ,{})),P(l,j(K$,{})),P(u,j(l1,{})),P(d,j(J1,{})),P(f,j(s0,{onOpenIssue:()=>n(`activity`)})),P(p,j(G0,{})),D(n=>{var r=`border-border bg-surface flex shrink-0 items-center gap-1 border-b px-2 py-1.5 select-none ${e.onHeaderPointerDown?`cursor-grab active:cursor-grabbing`:``}`,a=t()!==`draft`,o=t()!==`capture`,m=t()!==`activity`,h=t()!==`cloud`,g=t()!==`local`,_=t()!==`prs`,v=t()!==`settings`;return r!==n.e&&st(i,n.e=r),a!==n.t&&s.classList.toggle(`hidden`,n.t=a),o!==n.a&&c.classList.toggle(`hidden`,n.a=o),m!==n.o&&l.classList.toggle(`hidden`,n.o=m),h!==n.i&&u.classList.toggle(`hidden`,n.i=h),g!==n.n&&d.classList.toggle(`hidden`,n.n=g),_!==n.s&&f.classList.toggle(`hidden`,n.s=_),v!==n.h&&p.classList.toggle(`hidden`,n.h=v),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),r}})}rt([`pointerdown`,`click`]);var s2=`/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
261
262
  @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-contain-size:initial;--tw-contain-layout:initial;--tw-contain-paint:initial;--tw-contain-style:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, "SF Mono", Menlo, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-white:#fff;--spacing:.25rem;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-wide:.025em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:4px;--radius-md:6px;--radius-lg:10px;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#0b0c0e;--color-surface:#141517;--color-surface-2:#1c1d21;--color-surface-3:#24262b;--color-border:#26282d;--color-border-strong:#34363d;--color-text:#e8e9eb;--color-text-dim:#8b8e98;--color-text-faint:#5c5f6a;--color-accent:#5e6ad2;--color-accent-hover:#6e79e0;--color-accent-soft:#5e6ad226;--color-success:#4cb782;--color-warn:#f2c94c;--color-danger:#eb5757;--color-danger-soft:#eb575726}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-0\\.5{top:calc(var(--spacing) * .5)}.top-1{top:var(--spacing)}.top-1\\/2{top:50%}.top-\\[2px\\]{top:2px}.top-full{top:100%}.right-0{right:0}.right-0\\.5{right:calc(var(--spacing) * .5)}.right-4{right:calc(var(--spacing) * 4)}.right-full{right:100%}.bottom-0{bottom:0}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-\\[2px\\]{bottom:2px}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:var(--spacing)}.left-1\\/2{left:50%}.left-full{left:100%}.z-1{z-index:1}.z-10{z-index:10}.z-\\[2147483645\\]{z-index:2147483645}.z-\\[2147483646\\]{z-index:2147483646}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-m-0{margin:0}.-m-0\\.5{margin:calc(var(--spacing) * -.5)}.-m-4{margin:calc(var(--spacing) * -4)}.m-0{margin:0}.-mx-2{margin-inline:calc(var(--spacing) * -2)}.-my-1{margin-block:calc(var(--spacing) * -1)}.-my-1\\.5{margin-block:calc(var(--spacing) * -1.5)}.mt-0{margin-top:0}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-px{margin-top:1px}.mr-0{margin-right:0}.mr-0\\.5{margin-right:calc(var(--spacing) * .5)}.mr-1{margin-right:var(--spacing)}.mr-1\\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-2\\.5{margin-right:calc(var(--spacing) * 2.5)}.-mb-4{margin-bottom:calc(var(--spacing) * -4)}.mb-0{margin-bottom:0}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-2\\.5{margin-left:calc(var(--spacing) * 2.5)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.ml-px{margin-left:1px}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-5{-webkit-line-clamp:5;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.size-0{width:0;height:0}.size-1{width:var(--spacing);height:var(--spacing)}.size-1\\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-\\[12px\\]{width:12px;height:12px}.size-\\[16px\\]{width:16px;height:16px}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-16{height:calc(var(--spacing) * 16)}.h-\\[8px\\]{height:8px}.h-\\[17px\\]{height:17px}.h-\\[18px\\]{height:18px}.h-\\[20px\\]{height:20px}.h-\\[24px\\]{height:24px}.h-fit{height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-44{max-height:calc(var(--spacing) * 44)}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\\[var\\(--rg-edit-list-max-h\\)\\]{max-height:var(--rg-edit-list-max-h)}.min-h-0{min-height:0}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-\\[2lh\\]{min-height:2lh}.min-h-\\[28px\\]{min-height:28px}.w-1{width:var(--spacing)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-16{width:calc(var(--spacing) * 16)}.w-28{width:calc(var(--spacing) * 28)}.w-72{width:calc(var(--spacing) * 72)}.w-\\[2px\\]{width:2px}.w-\\[calc\\(100\\%\\+16px\\)\\]{width:calc(100% + 16px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\\[55\\%\\]{max-width:55%}.max-w-\\[100vw\\]{max-width:100vw}.max-w-\\[110px\\]{max-width:110px}.max-w-\\[280px\\]{max-width:280px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.min-w-\\[3\\.5ch\\]{min-width:3.5ch}.min-w-\\[4ch\\]{min-width:4ch}.min-w-\\[5ch\\]{min-width:5ch}.min-w-\\[6ch\\]{min-width:6ch}.min-w-\\[12ch\\]{min-width:12ch}.min-w-\\[36px\\]{min-width:36px}.min-w-\\[52px\\]{min-width:52px}.min-w-\\[68px\\]{min-width:68px}.min-w-\\[100px\\]{min-width:100px}.min-w-\\[150px\\]{min-width:150px}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-rotate-90{rotate:-90deg}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-decimal{list-style-type:decimal}.grid-cols-\\[0fr\\]{grid-template-columns:0fr}.grid-cols-\\[1fr\\]{grid-template-columns:1fr}.grid-rows-\\[0fr\\]{grid-template-rows:0fr}.grid-rows-\\[1fr\\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:0}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-\\[5px\\]{gap:5px}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[1px\\]{border-radius:1px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-\\[5px\\]{border-radius:5px}.rounded-\\[6px\\]{border-radius:6px}.rounded-\\[13px\\]{border-radius:13px}.rounded-\\[14px\\]{border-radius:14px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-\\[10px\\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-t-none{border-top-left-radius:0;border-top-right-radius:0}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-l-\\[10px\\]{border-top-left-radius:10px;border-bottom-left-radius:10px}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-\\[10px\\]{border-top-right-radius:10px;border-bottom-right-radius:10px}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-b-\\[6px\\]{border-bottom-right-radius:6px;border-bottom-left-radius:6px}.rounded-b-\\[10px\\]{border-bottom-right-radius:10px;border-bottom-left-radius:10px}.rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.\\[border-width\\:0\\.5px\\]{border-width:.5px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.\\[border-top-width\\:0\\.5px\\]{border-top-width:.5px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-\\[var\\(--rg-border-button\\)\\]{border-color:var(--rg-border-button)}.border-accent{border-color:var(--color-accent)}.border-accent\\/40{border-color:#5e6ad266}@supports (color:color-mix(in lab, red, red)){.border-accent\\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-border{border-color:var(--color-border)}.border-success{border-color:var(--color-success)}.border-success\\/40{border-color:#4cb78266}@supports (color:color-mix(in lab, red, red)){.border-success\\/40{border-color:color-mix(in oklab, var(--color-success) 40%, transparent)}}.border-text-dim{border-color:var(--color-text-dim)}.border-transparent{border-color:#0000}.border-warn{border-color:var(--color-warn)}.border-warn\\/40{border-color:#f2c94c66}@supports (color:color-mix(in lab, red, red)){.border-warn\\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-t-\\[var\\(--rg-border-subtle\\)\\]{border-top-color:var(--rg-border-subtle)}.border-t-transparent{border-top-color:#0000}.bg-\\[var\\(--rg-error-bg\\)\\]{background-color:var(--rg-error-bg)}.bg-\\[var\\(--rg-panel-bg\\)\\]{background-color:var(--rg-panel-bg)}.bg-\\[var\\(--rg-submit-bg\\)\\]{background-color:var(--rg-submit-bg)}.bg-\\[var\\(--rg-surface-active\\)\\]{background-color:var(--rg-surface-active)}.bg-\\[var\\(--rg-surface-hover\\)\\]{background-color:var(--rg-surface-hover)}.bg-\\[var\\(--rg-text-primary\\)\\]{background-color:var(--rg-text-primary)}.bg-\\[var\\(--rg-text-secondary\\)\\]{background-color:var(--rg-text-secondary)}.bg-accent{background-color:var(--color-accent)}.bg-accent-soft{background-color:var(--color-accent-soft)}.bg-bg{background-color:var(--color-bg)}.bg-bg\\/80{background-color:#0b0c0ecc}@supports (color:color-mix(in lab, red, red)){.bg-bg\\/80{background-color:color-mix(in oklab, var(--color-bg) 80%, transparent)}}.bg-border{background-color:var(--color-border)}.bg-current{background-color:currentColor}.bg-danger{background-color:var(--color-danger)}.bg-danger-soft{background-color:var(--color-danger-soft)}.bg-red-500{background-color:var(--color-red-500)}.bg-success{background-color:var(--color-success)}.bg-surface{background-color:var(--color-surface)}.bg-surface-2{background-color:var(--color-surface-2)}.bg-surface-3{background-color:var(--color-surface-3)}.bg-text-faint{background-color:var(--color-text-faint)}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\\.5{padding:calc(var(--spacing) * 2.5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:0}.px-0\\.25{padding-inline:calc(var(--spacing) * .25)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-\\[3px\\]{padding-inline:3px}.py-0{padding-block:0}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-0\\.25{padding-block:calc(var(--spacing) * .25)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-px{padding-block:1px}.pt-0{padding-top:0}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-1{padding-bottom:var(--spacing)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-0{padding-left:0}.pl-0\\.5{padding-left:calc(var(--spacing) * .5)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-2\\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.text-end{text-align:end}.text-justify{text-align:justify}.text-left{text-align:left}.text-right{text-align:right}.text-start{text-align:start}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-\\[9\\.5px\\]{font-size:9.5px}.text-\\[9px\\]{font-size:9px}.text-\\[10\\.5px\\]{font-size:10.5px}.text-\\[10px\\]{font-size:10px}.text-\\[11\\.5px\\]{font-size:11.5px}.text-\\[11px\\]{font-size:11px}.text-\\[12\\.5px\\]{font-size:12.5px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[15px\\]{font-size:15px}.leading-3{--tw-leading:calc(var(--spacing) * 3);line-height:calc(var(--spacing) * 3)}.leading-3\\.5{--tw-leading:calc(var(--spacing) * 3.5);line-height:calc(var(--spacing) * 3.5)}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-extralight{--tw-font-weight:var(--font-weight-extralight);font-weight:var(--font-weight-extralight)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.font-thin{--tw-font-weight:var(--font-weight-thin);font-weight:var(--font-weight-thin)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-normal{overflow-wrap:normal;word-break:normal}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.break-keep{word-break:keep-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-break-spaces{white-space:break-spaces}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[var\\(--rg-error-text\\)\\]{color:var(--rg-error-text)}.text-\\[var\\(--rg-submit-fg\\)\\]{color:var(--rg-submit-fg)}.text-\\[var\\(--rg-text-primary\\)\\]{color:var(--rg-text-primary)}.text-\\[var\\(--rg-text-primary-85\\)\\]{color:var(--rg-text-primary-85)}.text-\\[var\\(--rg-text-secondary\\)\\]{color:var(--rg-text-secondary)}.text-accent{color:var(--color-accent)}.text-danger{color:var(--color-danger)}.text-success{color:var(--color-success)}.text-text{color:var(--color-text)}.text-text-dim{color:var(--color-text-dim)}.text-text-faint{color:var(--color-text-faint)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-accent{accent-color:var(--color-accent)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.\\[box-shadow\\:var\\(--rg-shadow\\)\\]{box-shadow:var(--rg-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\\[filter\\:var\\(--rg-drop-shadow\\)\\]{filter:var(--rg-drop-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-columns\\]{transition-property:grid-template-columns;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-rows\\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[padding\\,border-radius\\,transform\\]{transition-property:padding,border-radius,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[top\\,left\\,width\\,height\\,opacity\\,border-radius\\]{transition-property:top,left,width,height,opacity,border-radius;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,color\\]{transition-property:transform,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.delay-\\[80ms\\]{transition-delay:80ms}.duration-60{--tw-duration:60ms;transition-duration:60ms}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-120{--tw-duration:.12s;transition-duration:.12s}.duration-140{--tw-duration:.14s;transition-duration:.14s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-180{--tw-duration:.18s;transition-duration:.18s}.duration-220{--tw-duration:.22s;transition-duration:.22s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-400{--tw-duration:.4s;transition-duration:.4s}.ease-\\[cubic-bezier\\(0\\,0\\,0\\.2\\,1\\)\\]{--tw-ease:cubic-bezier(0,0,.2,1);transition-timing-function:cubic-bezier(0,0,.2,1)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.will-change-\\[opacity\\,transform\\]{will-change:opacity,transform}.will-change-transform{will-change:transform}.contain-layout{--tw-contain-layout:layout;contain:var(--tw-contain-size,) var(--tw-contain-layout,) var(--tw-contain-paint,) var(--tw-contain-style,)}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.\\[corner-shape\\:superellipse\\(1\\.25\\)\\]{corner-shape:superellipse(1.25)}.\\[font-synthesis\\:none\\]{font-synthesis:none}.group-open\\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\\:text-\\[var\\(--rg-text-primary\\)\\]:is(:where(.group):hover *){color:var(--rg-text-primary)}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\\:text-text-faint::placeholder{color:var(--color-text-faint)}@media (hover:hover){.hover\\:bg-\\[var\\(--rg-error-bg-hover\\)\\]:hover{background-color:var(--rg-error-bg-hover)}.hover\\:bg-\\[var\\(--rg-surface-active\\)\\]:hover{background-color:var(--rg-surface-active)}.hover\\:bg-\\[var\\(--rg-surface-hover\\)\\]:hover{background-color:var(--rg-surface-hover)}.hover\\:bg-accent-hover:hover{background-color:var(--color-accent-hover)}.hover\\:bg-accent\\/50:hover{background-color:#5e6ad280}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-accent\\/50:hover{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\\:bg-danger\\/30:hover{background-color:#eb57574d}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-danger\\/30:hover{background-color:color-mix(in oklab, var(--color-danger) 30%, transparent)}}.hover\\:bg-surface-2:hover{background-color:var(--color-surface-2)}.hover\\:bg-surface-3:hover{background-color:var(--color-surface-3)}.hover\\:text-\\[var\\(--rg-text-primary\\)\\]:hover{color:var(--rg-text-primary)}.hover\\:text-danger:hover{color:var(--color-danger)}.hover\\:text-text:hover{color:var(--color-text)}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-80:hover{opacity:.8}}.focus\\:border-accent:focus{border-color:var(--color-accent)}.active\\:cursor-grabbing:active{cursor:grabbing}.active\\:bg-accent:active{background-color:var(--color-accent)}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-surface-3:disabled{background-color:var(--color-surface-3)}.disabled\\:text-text-faint:disabled{color:var(--color-text-faint)}.disabled\\:opacity-40:disabled{opacity:.4}@media (hover:hover){.disabled\\:hover\\:bg-surface-2:disabled:hover{background-color:var(--color-surface-2)}}}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}[data-theme=light],:host([data-theme=light]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}@media (prefers-color-scheme:light){:root:not([data-theme=dark]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}}body{background-color:var(--color-bg);font-family:var(--font-sans);color:var(--color-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-width:320px;margin:0;font-size:13px}@keyframes geist-spinner-fade{0%{opacity:1}to{opacity:.15}}[data-tip]{position:relative}[data-tip]:hover:after{content:attr(data-tip);color:#fff;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;z-index:60;background:#1b1c20;border-radius:6px;max-width:260px;padding:3px 8px;font-size:10.5px;font-weight:500;line-height:1.35;position:absolute;bottom:calc(100% + 6px);left:50%;overflow:hidden;transform:translate(-50%);box-shadow:0 4px 12px #0000004d}.no-scrollbar{scrollbar-width:none}.no-scrollbar::-webkit-scrollbar{display:none}.lg-md p{margin:0 0 6px}.lg-md p:last-child{margin-bottom:0}.lg-md a{color:var(--color-accent);word-break:break-all;text-decoration:none}.lg-md a:hover{text-decoration:underline}.lg-md code{background:var(--color-surface-2);border:1px solid var(--color-border);font-family:var(--font-mono);border-radius:4px;padding:0 4px;font-size:11px}.lg-md pre{background:var(--color-surface-2);border:1px solid var(--color-border);border-radius:6px;margin:6px 0;padding:8px;overflow-x:auto}.lg-md pre code{white-space:pre;background:0 0;border:none;padding:0;font-size:11px}.lg-md ul,.lg-md ol{flex-direction:column;gap:2px;margin:4px 0 6px;padding-left:18px;display:flex}.lg-md ul{list-style:outside}.lg-md ol{list-style:decimal}.lg-md h4{margin:8px 0 4px;font-size:12px;font-weight:600}.lg-md lg-media{display:block}.lg-md lg-media img,.lg-md lg-media video{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md video{border:1px solid var(--color-border);background:#000;border-radius:6px;max-width:100%;margin:4px 0}.lg-md img{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md strong{font-weight:600}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:var(--color-border-strong);border-radius:4px}::-webkit-scrollbar-track{background:0 0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-contain-size{syntax:"*";inherits:false}@property --tw-contain-layout{syntax:"*";inherits:false}@property --tw-contain-paint{syntax:"*";inherits:false}@property --tw-contain-style{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`;Br();var c2=N(`<span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full">`),l2=N(`<span class="text-text min-w-[5ch] text-[11px] font-medium tabular-nums">`),u2=N(`<button class="bg-accent hover:bg-accent-hover h-7 cursor-pointer rounded-full px-2.5 text-[11px] font-medium text-white transition-colors"><span class="inline-block min-w-[4ch] text-center">Stop`),d2=N(`<p class="text-warn px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Needs review`),f2=N(`<div><p class="text-text-dim px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Running agents`),p2=N(`<div class="fixed z-[2147483646] select-none"><div class="bg-surface border-border text-text flex h-9 cursor-grab items-center gap-1 rounded-full border py-1 pr-1 pl-2.5 font-sans shadow-lg active:cursor-grabbing">`),m2=N(`<div><div title="Drag to resize">`),h2=N(`<button title="Open Linear Grab"aria-label="Open Linear Grab"class="text-accent hover:opacity-80 inline-flex cursor-pointer items-center gap-1.5">`),g2=N(`<span class="bg-border h-4 w-px"aria-hidden>`),_2=N(`<span aria-hidden class="bg-warn size-2 rounded-full">`),v2=N(`<span class="text-warn min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums"> rev`),y2=N(`<button title="Running agents"aria-label="Running agents"class="hover:bg-surface-2 flex h-7 cursor-pointer items-center gap-1.5 rounded-full px-2 transition-colors"><span aria-hidden></span><span>`),b2=N(`<p class="text-text-faint px-1.5 pb-1.5 text-[11.5px]">No agents running right now.`),x2=N(`<button class="hover:bg-surface-2 flex w-full cursor-pointer flex-col gap-0.5 rounded-md px-1.5 py-1.5 text-left transition-colors"><span class="flex min-w-0 items-center gap-1.5"><span aria-hidden class="size-1.5 shrink-0 rounded-full"></span><span class="font-mono text-text-dim shrink-0 text-[10.5px]"></span><span class="text-text truncate text-[11.5px]"></span></span><span class="text-text-faint pl-3 text-[10.5px] tabular-nums"> · <!> · `);function S2(e={}){if(typeof window>`u`||window.__LINEAR_GRAB_PAGE__)return;window.__LINEAR_GRAB_PAGE__=!0;let t=()=>{ik(),zZ();let t=document.createElement(`div`);t.id=`linear-grab-root`,document.body.appendChild(t);let n=e=>{let n=e.composedPath();if(!n.includes(t))return;e.stopImmediatePropagation();let r=n[0];e instanceof KeyboardEvent&&r&&r!==t&&r.dispatchEvent(new KeyboardEvent(e.type,{key:e.key,code:e.code,location:e.location,repeat:e.repeat,isComposing:e.isComposing,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,bubbles:!1,cancelable:!1}))};for(let e of[`keydown`,`keyup`,`keypress`])window.addEventListener(e,n,{capture:!0});let r=t.attachShadow({mode:`open`}),i=document.createElement(`style`);i.textContent=s2,r.appendChild(i);let a=document.createElement(`div`);r.appendChild(a);let o=()=>a.setAttribute(`data-theme`,C2());o(),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,o),nt(()=>j(k2,{get defaultOpen(){return e.defaultOpen??!1}}),a)};document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function C2(){try{let e=[document.body,document.documentElement];for(let t of e){let e=getComputedStyle(t).backgroundColor.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+))?/);if(!(!e||e[4]!==void 0&&Number(e[4])===0))return .2126*e[1]+.7152*e[2]+.0722*e[3]>140?`light`:`dark`}}catch{}return matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}var w2=130,T2=36,E2=380,D2=280,O2=720;function k2(e){let[t,n]=T(e.defaultOpen),[r,i]=T(`right`),[a,o]=T({x:Math.max(8,window.innerWidth-w2-24),y:Math.max(8,window.innerHeight-T2-20)}),[s,c]=T({running:[],review:[]}),l=()=>s().running,u=()=>s().review,[d,f]=T(!1),[p,m]=T(HD().phase),[h,g]=T(0);ie(()=>{let e=setInterval(()=>{p()===`recording`&&g(Date.now()-(HD().startedAt??Date.now()))},250);ae(()=>clearInterval(e))});let _=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[v,y]=T(null),b=e=>({x:Math.min(Math.max(8,e.x),window.innerWidth-w2-8),y:Math.min(Math.max(8,e.y),window.innerHeight-T2-8)}),x=e=>({x:Math.min(Math.max(8-(te()-80),e.x),window.innerWidth-80),y:Math.min(Math.max(0,e.y),window.innerHeight-80)}),[S,C]=T(!1),[w,E]=T(`cloud`),[k,ee]=T(!1),[te,A]=T(E2),ne=e=>Math.min(O2,Math.max(D2,Math.min(e,window.innerWidth-60)));O(()=>{let e=document.documentElement,n=t()&&S();e.style.transition=`margin 0.2s ease`,e.style.marginRight=n&&r()===`right`?`${te()}px`:``,e.style.marginLeft=n&&r()===`left`?`${te()}px`:``}),ae(()=>{document.documentElement.style.marginRight=``,document.documentElement.style.marginLeft=``});let re=()=>{let e=!S();C(e),e&&y(null),Er({panelMode:e?`pinned`:`overlay`,panelPos:void 0})};ie(()=>{Tr().then(e=>{e.panelSide&&i(e.panelSide),e.launcherPos&&o(b(e.launcherPos)),e.panelPos&&y(x(e.panelPos)),e.panelWidth&&A(ne(e.panelWidth)),C(e.panelMode===`pinned`),E(e.workflowMode??`cloud`)});let e=Mr(e=>{e===`settings`&&Tr().then(e=>{i(e.panelSide??`right`),C(e.panelMode===`pinned`),E(e.workflowMode??`cloud`)}),e===`grab`&&w()!==`local`&&n(!0)}),t=()=>{ee(!0),setTimeout(()=>ee(!1),1600)};window.addEventListener(jZ,t);let r=()=>{f(!1),S()||n(!1)};window.addEventListener(MZ,r),ae(()=>{window.removeEventListener(jZ,t),window.removeEventListener(MZ,r)});let s=BQ(c),l=HD().phase,u=UD(e=>{m(e.phase),e.phase===`recording`&&l!==`recording`&&!S()&&n(!1),e.phase===`ready`&&l!==`ready`&&(ej(`capture`),n(!0)),l=e.phase}),d=()=>{o(b(a()));let e=v();e&&y(x(e))};window.addEventListener(`resize`,d),ae(()=>{e(),s(),u(),window.removeEventListener(`resize`,d)})});let oe=!1,se=e=>{if(e.button!==0)return;let t={x:e.clientX,y:e.clientY},n=a();oe=!1;let r=e=>{let r=e.clientX-t.x,i=e.clientY-t.y;Math.abs(r)+Math.abs(i)>4&&(oe=!0),oe&&o(b({x:n.x+r,y:n.y+i}))},i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i),oe&&Er({launcherPos:a()})};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},ce=()=>a().y>260,le=e=>{f(!1),ej(`activity`,e),n(!0)},ue=e=>{if(e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=e.clientX,n=te(),i=v(),a=e=>{let a=e.clientX-t,o=r()===`right`?-a:a,s=ne(n+o);A(s),i&&r()===`right`&&y(x({x:i.x+(n-s),y:i.y}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),Er({panelWidth:te(),...v()?{panelPos:v()}:{}})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},de=e=>{if(e.button!==0)return;if(e.detail===2){y(null),Er({panelPos:void 0});return}let t={x:e.clientX,y:e.clientY},n=v()??{x:r()===`right`?window.innerWidth-te():0,y:0},i=!1,a=e=>{let r=e.clientX-t.x,a=e.clientY-t.y;Math.abs(r)+Math.abs(a)>4&&(i=!0),i&&y(x({x:n.x+r,y:n.y+a}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o);let e=v();i&&e&&Er({panelPos:e})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)};return[j(M,{get when(){return!t()},get children(){var e=p2(),t=e.firstChild;return t.$$pointerdown=se,P(t,j(M,{get when(){return p()===`recording`},get fallback(){return[(()=>{var e=h2();return e.$$click=()=>{oe||(f(!1),n(!0))},P(e,j(a2,{size:13})),e})(),g2(),(()=>{var e=y2(),t=e.firstChild,n=t.nextSibling;return e.$$click=()=>{oe||f(e=>!e)},P(n,(()=>{var e=$e(()=>!!k());return()=>e()?`Copied ✓`:`${l().length} run`})()),P(e,j(M,{get when(){return $e(()=>!k())()&&u().length>0},get children(){return[_2(),(()=>{var e=v2(),t=e.firstChild;return P(e,()=>u().length,t),e})()]}}),null),D(e=>{var r=`size-2 rounded-full ${k()?`bg-success`:l().length?`bg-success animate-pulse`:`bg-text-faint`}`,i=`min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums ${k()?`text-success`:`text-text-dim`}`;return r!==e.e&&st(t,e.e=r),i!==e.t&&st(n,e.t=i),e},{e:void 0,t:void 0}),e})()]},get children(){return[c2(),(()=>{var e=l2();return P(e,()=>_(h())),e})(),(()=>{var e=u2();return e.$$click=()=>{oe||eO()},e})()]}})),P(e,j(M,{get when(){return d()},get children(){var e=f2(),t=e.firstChild;return P(e,j(M,{get when(){return u().length>0},get children(){return[d2(),j(We,{get each(){return u()},children:e=>j(A2,{agent:e,review:!0,onOpen:le})})]}}),t),P(e,j(M,{get when(){return l().length>0},get fallback(){return b2()},get children(){return j(We,{get each(){return l()},children:e=>j(A2,{agent:e,onOpen:le})})}}),null),D(()=>st(e,`bg-surface border-border absolute w-72 rounded-lg border p-1.5 font-sans shadow-2xl ${ce()?`bottom-full mb-2`:`top-full mt-2`} ${a().x>window.innerWidth-300?`right-0`:`left-0`}`)),e}}),null),D(t=>{var n=`${a().x}px`,r=`${a().y}px`;return n!==t.e&&dt(e,`left`,t.e=n),r!==t.t&&dt(e,`top`,t.t=r),t},{e:void 0,t:void 0}),e}}),j(M,{get when(){return t()},get children(){var e=m2(),t=e.firstChild;return t.$$pointerdown=ue,P(e,j(o2,{onGrab:()=>n(!0),onClose:()=>n(!1),get onHeaderPointerDown(){return S()?void 0:de},get pinned(){return S()},onTogglePin:re}),null),D(n=>{var i=`bg-bg text-text border-border fixed z-[2147483645] flex max-w-[100vw] flex-col overflow-hidden font-sans text-[13px] antialiased ${S()?``:`shadow-2xl`} ${!S()&&v()?`rounded-xl border`:r()===`right`?`top-0 right-0 h-screen border-l`:`top-0 left-0 h-screen border-r`}`,a={width:`${te()}px`,...!S()&&v()?{left:`${v().x}px`,top:`${v().y}px`,height:`${Math.min(680,window.innerHeight-16)}px`}:{}},o=`hover:bg-accent/50 active:bg-accent absolute top-0 z-10 h-full w-1 cursor-col-resize transition-colors ${r()===`right`?`left-0`:`right-0`}`;return i!==n.e&&st(e,n.e=i),n.t=ut(e,a,n.t),o!==n.a&&st(t,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}})]}function A2(e){return(()=>{var t=x2(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=n.nextSibling,s=o.firstChild,c=s.nextSibling;return c.nextSibling,t.$$click=()=>e.onOpen(e.agent.id),P(i,()=>e.agent.identifier),P(a,()=>e.agent.title),P(o,(()=>{var t=$e(()=>!!e.review);return()=>t()?`PR ready · needs review`:e.agent.stateName})(),s),P(o,()=>e.agent.delegateName,c),P(o,()=>j2(e.agent.updatedAt),null),D(t=>dt(r,`background`,e.review?`var(--color-warn)`:e.agent.stateColor)),t})()}function j2(e){let t=Math.max(0,Math.floor((Date.now()-Date.parse(e))/1e3));return t<60?`now`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}rt([`pointerdown`,`click`]),S2()})();
@@ -25697,7 +25697,9 @@ function lD(e) {
25697
25697
  let r = [];
25698
25698
  e.testUsername?.trim() && r.push(`- Username / email: \`${e.testUsername.trim()}\``), e.testPassword?.trim() && r.push(`- Password: \`${e.testPassword.trim()}\``), r.length && t.push(`**Test account — log into the app with this while testing:**\n${r.join("\n")}`);
25699
25699
  let i = [];
25700
- return e.slackToken && e.slackChannelId && i.push(`- Slack: bot token \`${e.slackToken}\`, channel \`${e.slackChannelId}\`${e.slackChannelName ? ` (#${e.slackChannelName})` : ""}. Use \`chat.postMessage\` for the message and \`files.uploadV2\` (or getUploadURLExternal + completeUploadExternal) to upload the demo video into the channel.`), e.telegramToken && e.telegramChatId && i.push(`- Telegram: bot token \`${e.telegramToken}\`, chat id \`${e.telegramChatId}\`. Use \`sendMessage\` and \`sendVideo\` (multipart upload of the demo file).`), i.length && t.push(`**When the fix is complete and the PR is open, announce it yourself:**\n${i.join("\n")}\n\nMessage format — keep it short: what was broken → what you changed (one-line fix summary) → links to the Linear issue, the PR, and your agent run → attach/upload the demo video → end with the CTA "👉 Review the PR". You may also use these tokens to send yourself intermediate test notifications while verifying the integration works.`), t.join("\n\n");
25700
+ e.slackToken && e.slackChannelId && i.push(`- Slack: bot token \`${e.slackToken}\`, channel \`${e.slackChannelId}\`${e.slackChannelName ? ` (#${e.slackChannelName})` : ""}. Use \`chat.postMessage\` for the message and \`files.uploadV2\` (or getUploadURLExternal + completeUploadExternal) to upload the demo video into the channel.`), e.telegramToken && e.telegramChatId && i.push(`- Telegram: bot token \`${e.telegramToken}\`, chat id \`${e.telegramChatId}\`. Use \`sendMessage\` and \`sendVideo\` (multipart upload of the demo file).`), i.length && t.push(`**When the fix is complete and the PR is open, announce it yourself:**\n${i.join("\n")}\n\nMessage format — keep it short: what was broken → what you changed (one-line fix summary) → links to the Linear issue, the PR, and your agent run → attach/upload the demo video → end with the CTA "👉 Review the PR". You may also use these tokens to send yourself intermediate test notifications while verifying the integration works.`);
25701
+ let a = ["- [ ] Tested the change hands-on in the RUNNING app (state what you exercised)", "- [ ] Demo media captured — GIF/video preferred; if recording is impossible in your environment, before/after screenshots + the stated reason"];
25702
+ return e.githubAssetsRepo?.trim() && a.push(`- [ ] Demo media committed to \`${e.githubAssetsRepo.trim()}\` and embedded via raw.githubusercontent.com URL in the Linear comment AND the PR body`), a.push("- [ ] Demo media attached to the Linear ISSUE itself (not only the PR)", "- [ ] PR opened and linked here", "- [ ] Deploy-preview URL included, deep-linked to the changed page (if the repo has preview deployments, e.g. Vercel; otherwise state that it does not)", "- [ ] Issue moved to its review/done state"), i.length && a.push("- [ ] Announcement posted to the configured channel(s) with the demo attached"), t.push(`**DEFINITION OF DONE — acceptance checklist.** Copy this checklist VERBATIM into your Linear closeout comment and tick each box (\`- [x]\`) with a link or one-line evidence next to it. Any unchecked box means the work is NOT ACCEPTED — leave it unchecked and explain the blocker rather than omitting it:\n${a.join("\n")}`), t.join("\n\n");
25701
25703
  }
25702
25704
  function uD(e) {
25703
25705
  let t = [];
@@ -25743,7 +25745,7 @@ function pD(e) {
25743
25745
  return i.length && t.push(i.join(" ")), t.join("\n\n");
25744
25746
  }
25745
25747
  var mD, hD, gD = t((() => {
25746
- mD = "You are an expert engineer drafting a Linear issue for a development team.\nYou are given a rough note from the reporter and, when available, the exact React source\nlocation of the UI element the issue is about (captured from a running dev build).\n\nWrite a crisp, actionable issue a coding agent can execute against with zero follow-up\nquestions. Be specific, never invent details you were not given, and keep the tone neutral\nand technical. If the note implies a bug, structure it as a bug; if it implies a change or\nfeature, keep reproSteps minimal and focus the description on the desired change.\n\nThe issue renders in this exact section order — fill each field for its section:\nSummary (description field) → Steps to Reproduce (reproSteps) → Expected Behavior\n(expected) → Actual Behavior (actual) → Impact (impact) → Analysis / Notes\n(analysisNotes, markdown bullets grounded in the provided source context) →\nSuggested Next Steps (suggestedNextSteps, markdown bullets with concrete fixes).\nThe Summary is a short plain-prose paragraph — no headings inside it, no repetition\nof the other sections.", hD = "- FIRST, self-orient in the repo checkout (skip any path that doesn't exist):\n 1. Read `CLAUDE.md` and `AGENTS.md` at the repo root — the master map of product rules, architecture, and memory/skill pointers.\n 2. Skim `.claude/memory/MEMORY.md` (the index) to learn what project memory exists; load the specific `.claude/memory/*.md` files the map names for the surface you're touching.\n 3. Load the matching `.claude/skills/<name>/SKILL.md` files before designing, building UI, or animating (if skills are symlinked, follow them into `.agents/skills/`).\n Treat all of this as authoritative — it overrides your defaults.\n- Keep going until the code works and you're happy with the implementation.\n- MANDATORY COMPLETION GATE — the task is NOT complete (and you may not call it complete) until every step below is done, in order. Skipping any step silently is a FAILED task:\n 1. RUN the app and TEST your change hands-on (computer use / a real browser against the running app). Code reading alone does not count as verification.\n 2. RECORD a demo video or GIF showing the fix working (before → after where possible). If your environment genuinely cannot record media, capture before/after screenshots instead AND state explicitly in your closeout comment why video was not possible — never just omit the demo.\n 3. Open the PR, babysit it for the first set of review comments, and address them.\n 4. CLOSE OUT THE LINEAR ISSUE: post a completion comment (one-line fix summary + PR link), attach the demo media to the ISSUE itself (not only the PR), and move the issue to its review/done state.";
25748
+ mD = "You are an expert engineer drafting a Linear issue for a development team.\nYou are given a rough note from the reporter and, when available, the exact React source\nlocation of the UI element the issue is about (captured from a running dev build).\n\nWrite a crisp, actionable issue a coding agent can execute against with zero follow-up\nquestions. Be specific, never invent details you were not given, and keep the tone neutral\nand technical. If the note implies a bug, structure it as a bug; if it implies a change or\nfeature, keep reproSteps minimal and focus the description on the desired change.\n\nThe issue renders in this exact section order — fill each field for its section:\nSummary (description field) → Steps to Reproduce (reproSteps) → Expected Behavior\n(expected) → Actual Behavior (actual) → Impact (impact) → Analysis / Notes\n(analysisNotes, markdown bullets grounded in the provided source context) →\nSuggested Next Steps (suggestedNextSteps, markdown bullets with concrete fixes).\nThe Summary is a short plain-prose paragraph — no headings inside it, no repetition\nof the other sections.", hD = "- FIRST, self-orient in the repo checkout (skip any path that doesn't exist):\n 1. Read `CLAUDE.md` and `AGENTS.md` at the repo root — the master map of product rules, architecture, and memory/skill pointers.\n 2. Skim `.claude/memory/MEMORY.md` (the index) to learn what project memory exists; load the specific `.claude/memory/*.md` files the map names for the surface you're touching.\n 3. Load the matching `.claude/skills/<name>/SKILL.md` files before designing, building UI, or animating (if skills are symlinked, follow them into `.agents/skills/`).\n Treat all of this as authoritative — it overrides your defaults.\n- Keep going until the code works and you're happy with the implementation.\n- MANDATORY COMPLETION GATE — the task is NOT complete (and you may not call it complete) until every step below is done, in order. Skipping any step silently is a FAILED task:\n 1. RUN the app and TEST your change hands-on (computer use / a real browser against the running app). Code reading alone does not count as verification.\n 2. RECORD a demo video or GIF showing the fix working (before → after where possible). If your environment genuinely cannot record media, capture before/after screenshots instead AND state explicitly in your closeout comment why video was not possible — never just omit the demo.\n 3. Open the PR, babysit it for the first set of review comments, and address them. If the repo has preview deployments (e.g. Vercel), wait for the preview to go green and include its URL — deep-linked to the changed page — in the PR body, the Linear closeout, and the announcement.\n 4. CLOSE OUT THE LINEAR ISSUE: post a completion comment (one-line fix summary + PR link), attach the demo media to the ISSUE itself (not only the PR), and move the issue to its review/done state.";
25747
25749
  })), _D = /* @__PURE__ */ r({
25748
25750
  describeAiError: () => bD,
25749
25751
  executeDraft: () => vD
@@ -26746,10 +26748,18 @@ async function BO() {
26746
26748
  }).catch(() => void 0);
26747
26749
  }
26748
26750
  async function VO(e) {
26749
- return e.length ? (await AO("/pr/status", {
26751
+ if (!e.length) return {
26752
+ statuses: {},
26753
+ previews: {}
26754
+ };
26755
+ let t = await AO("/pr/status", {
26750
26756
  method: "POST",
26751
26757
  body: JSON.stringify({ urls: e })
26752
- })).statuses : {};
26758
+ });
26759
+ return {
26760
+ statuses: t.statuses ?? {},
26761
+ previews: t.previews ?? {}
26762
+ };
26753
26763
  }
26754
26764
  function HO(e) {
26755
26765
  return AO("/pr/merge", {
@@ -43344,7 +43354,7 @@ function Y$(e) {
43344
43354
  refetchInterval: 3e4,
43345
43355
  retry: 0,
43346
43356
  enabled: ie().length > 0
43347
- })), se = (e) => ue().has(e) ? "MERGED" : oe.data?.[e], [ce, le] = T(null), [ue, de] = T(/* @__PURE__ */ new Set()), [fe, pe] = T(null), me = async (n) => {
43357
+ })), se = (e) => ue().has(e) ? "MERGED" : oe.data?.statuses[e], [ce, le] = T(null), [ue, de] = T(/* @__PURE__ */ new Set()), [fe, pe] = T(null), me = async (n) => {
43348
43358
  pe(null), le(n);
43349
43359
  try {
43350
43360
  await HO(n), de((e) => new Set(e).add(n)), t.invalidateQueries({ queryKey: ["issue", e.issueId] }), t.invalidateQueries({ queryKey: ["my-issues"] }), VQ();
@@ -43582,6 +43592,20 @@ function Y$(e) {
43582
43592
  return (() => {
43583
43593
  var n = F$(), r = n.firstChild;
43584
43594
  return P(r, () => e.title), P(n, j(M, {
43595
+ get when() {
43596
+ return t && oe.data?.previews[e.url];
43597
+ },
43598
+ get children() {
43599
+ return j(Aj, {
43600
+ get href() {
43601
+ return oe.data.previews[e.url];
43602
+ },
43603
+ class: "shrink-0",
43604
+ title: "Vercel deploy preview of this PR's branch",
43605
+ children: "Preview"
43606
+ });
43607
+ }
43608
+ }), null), P(n, j(M, {
43585
43609
  get when() {
43586
43610
  return $e(() => !!(t && se(e.url)))() && se(e.url) !== "OPEN";
43587
43611
  },
@@ -44700,7 +44724,7 @@ function s0(e) {
44700
44724
  refetchInterval: 3e4,
44701
44725
  retry: 0,
44702
44726
  enabled: n().length > 0
44703
- })), a = (e) => g().has(e.attachment.url) ? "MERGED" : i.data?.[e.attachment.url], o = (e) => !!r.data?.some((t) => t.title.startsWith(e.issue.identifier)), [s, c] = T("all"), [l, u] = T(""), d = k(() => {
44727
+ })), a = (e) => g().has(e.attachment.url) ? "MERGED" : i.data?.statuses[e.attachment.url], o = (e) => !!r.data?.some((t) => t.title.startsWith(e.issue.identifier)), [s, c] = T("all"), [l, u] = T(""), d = k(() => {
44704
44728
  let e = l().trim().toLowerCase();
44705
44729
  return n().filter((t) => {
44706
44730
  let n = t.issue.state.type;
@@ -44786,12 +44810,26 @@ function s0(e) {
44786
44810
  return d();
44787
44811
  },
44788
44812
  children: (t) => (() => {
44789
- var n = r0(), r = n.firstChild, i = r.nextSibling, s = i.firstChild, c = s.nextSibling, l = c.nextSibling, u = i.nextSibling, d = u.firstChild;
44790
- return P(r, () => t.attachment.title || t.attachment.url), P(i, j(Pj, { get color() {
44813
+ var n = r0(), r = n.firstChild, s = r.nextSibling, c = s.firstChild, l = c.nextSibling, u = l.nextSibling, d = s.nextSibling, p = d.firstChild;
44814
+ return P(r, () => t.attachment.title || t.attachment.url), P(n, j(M, {
44815
+ get when() {
44816
+ return i.data?.previews[t.attachment.url];
44817
+ },
44818
+ get children() {
44819
+ return j(Aj, {
44820
+ get href() {
44821
+ return i.data.previews[t.attachment.url];
44822
+ },
44823
+ class: "shrink-0 self-start",
44824
+ title: "Vercel deploy preview of this PR's branch",
44825
+ children: "Preview"
44826
+ });
44827
+ }
44828
+ }), s), P(s, j(Pj, { get color() {
44791
44829
  return t.issue.state.color;
44792
- } }), s), P(s, () => t.issue.identifier), P(c, () => t.issue.title), P(l, () => Rj(t.issue.updatedAt)), P(u, j(Nj, { get children() {
44830
+ } }), c), P(c, () => t.issue.identifier), P(l, () => t.issue.title), P(u, () => Rj(t.issue.updatedAt)), P(d, j(Nj, { get children() {
44793
44831
  return t.issue.state.name;
44794
- } }), d), P(u, j(M, {
44832
+ } }), p), P(d, j(M, {
44795
44833
  get when() {
44796
44834
  return t.issue.delegate;
44797
44835
  },
@@ -44807,7 +44845,7 @@ function s0(e) {
44807
44845
  }
44808
44846
  });
44809
44847
  }
44810
- }), d), P(u, j(M, {
44848
+ }), p), P(d, j(M, {
44811
44849
  get when() {
44812
44850
  return o(t);
44813
44851
  },
@@ -44819,14 +44857,14 @@ function s0(e) {
44819
44857
  }
44820
44858
  });
44821
44859
  }
44822
- }), d), P(u, j(Aj, {
44860
+ }), p), P(d, j(Aj, {
44823
44861
  get href() {
44824
44862
  return t.issue.url;
44825
44863
  },
44826
44864
  class: "shrink-0",
44827
44865
  title: "Open the issue in Linear",
44828
44866
  children: "Linear"
44829
- }), d), P(d, j(M, {
44867
+ }), p), P(p, j(M, {
44830
44868
  get when() {
44831
44869
  return $e(() => !!a(t))() && a(t) !== "OPEN";
44832
44870
  },
@@ -44840,7 +44878,7 @@ function s0(e) {
44840
44878
  }
44841
44879
  });
44842
44880
  }
44843
- }), null), P(d, j(Cj, {
44881
+ }), null), P(p, j(Cj, {
44844
44882
  variant: "primary",
44845
44883
  class: "size-7 px-0",
44846
44884
  get classList() {
@@ -44870,7 +44908,7 @@ function s0(e) {
44870
44908
  }
44871
44909
  });
44872
44910
  }
44873
- }), null), P(d, j(Cj, {
44911
+ }), null), P(p, j(Cj, {
44874
44912
  variant: "ghost",
44875
44913
  class: "size-7 px-0",
44876
44914
  title: "Open the issue's Activity thread",
@@ -44881,7 +44919,7 @@ function s0(e) {
44881
44919
  get children() {
44882
44920
  return t0();
44883
44921
  }
44884
- }), null), P(d, j(Cj, {
44922
+ }), null), P(p, j(Cj, {
44885
44923
  variant: "ghost",
44886
44924
  class: "size-7 px-0",
44887
44925
  title: "Copy PR URL",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-grab",
3
- "version": "0.17.2",
3
+ "version": "0.17.4",
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": {