linear-grab 0.16.0 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.global.js +8 -8
- package/dist/linear-grab.js +388 -372
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),r=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},i={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return a(this.context.count)},getNextContextId(){return a(this.context.count++)}};function a(e){let t=String(e),n=t.length-1;return i.context.id+(n?String.fromCharCode(96+n):``)+t}function o(e){i.context=e}var s=(e,t)=>e===t,c=Symbol(`solid-proxy`),l=typeof Proxy==`function`,u=Symbol(`solid-track`),d={equals:s},f=null,p=Se,m=1,h=2,g={owned:null,cleanups:null,context:null,owner:null},_={},v=null,y=null,b=null,x=null,S=null,C=0;function w(e,t){let n=b,r=v,i=e.length===0,a=t===void 0?r:t,o=i?g:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>ne(()=>Ee(o)));v=o,b=null;try{return be(s,!0)}finally{b=n,v=r}}function T(e,t){t=t?Object.assign({},d,t):d;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[me.bind(n),e=>(typeof e==`function`&&(e=y&&y.running&&y.sources.has(n)?e(n.tValue):e(n.value)),he(n,e))]}function E(e,t,n){ge(ve(e,t,!0,m))}function D(e,t,n){ge(ve(e,t,!1,m))}function O(e,t,n){p=Ce;let r=ve(e,t,!1,m),i=pe&&de(pe);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),S?S.push(r):ge(r)}function k(e,t,n){n=n?Object.assign({},d,n):d;let r=ve(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,ge(r),me.bind(r)}function ee(e){return e&&typeof e==`object`&&`then`in e}function te(e,t,n){let r,a,o;typeof t==`function`?(r=e,a=t,o=n||{}):(r=!0,a=e,o=t||{});let s=null,c=_,l=null,u=!1,d=!1,f=`initialValue`in o,p=typeof r==`function`&&k(r),m=new Set,[h,g]=(o.storage||T)(o.initialValue),[x,S]=T(void 0),[C,w]=T(void 0,{equals:!1}),[D,O]=T(f?`ready`:`unresolved`);v&&ae(()=>{for(let e of m.keys())e.decrement();m.clear(),y&&s&&y.promises.delete(s),s=null}),i.context&&(l=i.getNextContextId(),o.ssrLoadFrom===`initial`?c=o.initialValue:i.load&&i.has(l)&&(c=i.load(l)));function te(e,t,n,r){return s===e&&(s=null,r!==void 0&&(f=!0),(e===c||t===c)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(r,{value:t})),c=_,y&&e&&u?(y.promises.delete(e),u=!1,be(()=>{y.running=!0,A(t,n)},!1)):A(t,n)),t}function A(e,t){be(()=>{t===void 0&&g(()=>e),O(t===void 0?f?`ready`:`unresolved`:`errored`),S(t);for(let e of m.keys())e.decrement();m.clear()},!1)}function re(){let e=pe&&de(pe),t=h(),n=x();if(n!==void 0&&!s)throw n;return b&&!b.user&&e&&E(()=>{C(),s&&(e.resolved&&y&&u?y.promises.add(s):m.has(e)||(e.increment(),m.add(e)))}),t}function ie(e=!0){if(e!==!1&&d)return;d=!1;let t=p?p():r;if(u=y&&y.running,t==null||t===!1){te(s,ne(h));return}y&&s&&y.promises.delete(s);let n,i=c===_?ne(()=>{try{return a(t,{value:h(),refetching:e})}catch(e){n=e}}):c;if(n!==void 0){te(s,void 0,Oe(n),t);return}else if(!ee(i))return te(s,i,void 0,t),i;return s=i,`v`in i?(i.s===1?te(s,i.v,void 0,t):te(s,void 0,Oe(i.v),t),i):(d=!0,queueMicrotask(()=>d=!1),be(()=>{O(f?`refreshing`:`pending`),w()},!1),i.then(e=>te(i,e,void 0,t),e=>te(i,void 0,Oe(e),t)))}Object.defineProperties(re,{state:{get:()=>D()},error:{get:()=>x()},loading:{get(){let e=D();return e===`pending`||e===`refreshing`}},latest:{get(){if(!f)return re();let e=x();if(e&&!s)throw e;return h()}}});let oe=v;return p?E(()=>(oe=v,ie(!1))):ie(!1),[re,{refetch:e=>se(oe,()=>ie(e)),mutate:g}]}function A(e){return be(e,!1)}function ne(e){if(b===null)return e();let t=b;b=null;try{return e()}finally{b=t}}function re(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=ne(()=>t(o,i,n));return i=o,s}}function ie(e){O(()=>ne(e))}function ae(e){return v===null||(v.cleanups===null?v.cleanups=[e]:v.cleanups.push(e)),e}function oe(){return b}function se(e,t){let n=v,r=b;v=e,b=null;try{return be(t,!0)}catch(e){Ae(e)}finally{v=n,b=r}}var[ce,le]=T(!1);function ue(e,t){let n=Symbol(`context`);return{id:n,Provider:Me(n),defaultValue:e}}function de(e){let t;return v&&v.context&&(t=v.context[e.id])!==void 0?t:e.defaultValue}function fe(e){let t=k(e),n=k(()=>je(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var pe;function me(){let e=y&&y.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===m)ge(this);else{let e=x;x=null,be(()=>we(this),!1),x=e}if(b){let e=this.observers;if(!e||e[e.length-1]!==b){let t=e?e.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(t)):(b.sources=[this],b.sourceSlots=[t]),e?(e.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}}return e&&y.sources.has(this)?this.tValue:this.value}function he(e,t,n){let r=y&&y.running&&y.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(y){let r=y.running;(r||!n&&y.sources.has(e))&&(y.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&be(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=y&&y.running;r&&y.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?x.push(n):S.push(n),n.observers&&Te(n)),r?n.tState=m:n.state=m)}if(x.length>1e6)throw x=[],Error()},!1)}return t}function ge(e){if(!e.fn)return;Ee(e);let t=C;_e(e,y&&y.running&&y.sources.has(e)?e.tValue:e.value,t),y&&!y.running&&y.sources.has(e)&&queueMicrotask(()=>{be(()=>{y&&(y.running=!0),b=v=e,_e(e,e.tValue,t),b=v=null},!1)})}function _e(e,t,n){let r,i=v,a=b;b=v=e;try{r=e.fn(t)}catch(t){return e.pure&&(y&&y.running?(e.tState=m,e.tOwned&&e.tOwned.forEach(Ee),e.tOwned=void 0):(e.state=m,e.owned&&e.owned.forEach(Ee),e.owned=null)),e.updatedAt=n+1,Ae(t)}finally{b=a,v=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?he(e,r,!0):y&&y.running&&e.pure?(y.sources.has(e)||(e.value=r),y.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function ve(e,t,n,r=m,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:v,context:v?v.context:null,pure:n};return y&&y.running&&(a.state=0,a.tState=r),v===null||v!==g&&(y&&y.running&&v.pure?v.tOwned?v.tOwned.push(a):v.tOwned=[a]:v.owned?v.owned.push(a):v.owned=[a]),a}function ye(e){let t=y&&y.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===h)return we(e);if(e.suspense&&ne(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<C);){if(t&&y.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(y.disposed.has(t))return}if((t?e.tState:e.state)===m)ge(e);else if((t?e.tState:e.state)===h){let t=x;x=null,be(()=>we(e,n[0]),!1),x=t}}}function be(e,t){if(x)return e();let n=!1;t||(x=[]),S?n=!0:S=[],C++;try{let t=e();return xe(n),t}catch(e){n||(S=null),x=null,Ae(e)}}function xe(e){if(x&&=(Se(x),null),e)return;let t;if(y){if(!y.promises.size&&!y.queue.size){let e=y.sources,n=y.disposed;S.push.apply(S,y.effects),t=y.resolve;for(let e of S)`tState`in e&&(e.state=e.tState),delete e.tState;y=null,be(()=>{for(let e of n)Ee(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)Ee(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}le(!1)},!1)}else if(y.running){y.running=!1,y.effects.push.apply(y.effects,S),S=null,le(!0);return}}let n=S;S=null,n.length&&be(()=>p(n),!1),t&&t()}function Se(e){for(let t=0;t<e.length;t++)ye(e[t])}function Ce(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:ye(r)}if(i.context){if(i.count){i.effects||=[],i.effects.push(...e.slice(0,n));return}o()}for(i.effects&&(i.done||!i.count)&&(e=[...i.effects,...e],n+=i.effects.length,delete i.effects),t=0;t<n;t++)ye(e[t])}function we(e,t){let n=y&&y.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===m?i!==t&&(!i.updatedAt||i.updatedAt<C)&&ye(i):e===h&&we(i,t)}}}function Te(e){let t=y&&y.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=h:r.state=h,r.pure?x.push(r):S.push(r),r.observers&&Te(r))}}function Ee(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Ee(e.tOwned[t]);delete e.tOwned}if(y&&y.running&&e.pure)De(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)Ee(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}y&&y.running?e.tState=0:e.state=0}function De(e,t){if(t||(e.tState=0,y.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)De(e.owned[t])}function Oe(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function ke(e,t,n){try{for(let n of t)n(e)}catch(e){Ae(e,n&&n.owner||null)}}function Ae(e,t=v){let n=f&&t&&t.context&&t.context[f],r=Oe(e);if(!n)throw r;S?S.push({fn(){ke(r,n,t)},state:m}):ke(r,n,t)}function je(e){if(typeof e==`function`&&!e.length)return je(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=je(e[n]);if(Array.isArray(r))if(r.length<32768)t.push.apply(t,r);else for(let e=0;e<r.length;e++)t.push(r[e]);else t.push(r)}return t}return e}function Me(e,t){return function(t){let n;return D(()=>n=ne(()=>(v.context={...v.context,[e]:t.value},fe(()=>t.children))),void 0),n}}var Ne=Symbol(`fallback`);function Pe(e){for(let t=0;t<e.length;t++)e[t]()}function Fe(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return ae(()=>Pe(a)),()=>{let c=e()||[],l=c.length,d,f;return c[u],ne(()=>{let e,t,u,m,h,g,_,v,y;if(l===0)o!==0&&(Pe(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Ne],i[0]=w(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),f=0;f<l;f++)r[f]=c[f],i[f]=w(p);o=l}else{for(u=Array(l),m=Array(l),s&&(h=Array(l)),g=0,_=Math.min(o,l);g<_&&r[g]===c[g];g++);for(_=o-1,v=l-1;_>=g&&v>=g&&r[_]===c[v];_--,v--)u[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),f=v;f>=g;f--)y=c[f],d=e.get(y),t[f]=d===void 0?-1:d,e.set(y,f);for(d=g;d<=_;d++)y=r[d],f=e.get(y),f!==void 0&&f!==-1?(u[f]=i[d],m[f]=a[d],s&&(h[f]=s[d]),f=t[f],e.set(y,f)):a[d]();for(f=g;f<l;f++)f in u?(i[f]=u[f],a[f]=m[f],s&&(s[f]=h[f],s[f](f))):i[f]=w(p);i=i.slice(0,o=l),r=c.slice(0)}return i});function p(e){if(a[f]=e,s){let[e,n]=T(f);return s[f]=n,t(c[f],e)}return t(c[f])}}}function Ie(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return ae(()=>Pe(a)),()=>{let l=e()||[],d=l.length;return l[u],ne(()=>{if(d===0)return s!==0&&(Pe(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[Ne],i[0]=w(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===Ne&&(a[0](),a=[],r=[],i=[],s=0),c=0;c<d;c++)c<r.length&&r[c]!==l[c]?o[c](()=>l[c]):c>=r.length&&(i[c]=w(f));for(;c<r.length;c++)a[c]();return s=o.length=a.length=d,r=l.slice(0),i=i.slice(0,s)});function f(e){a[c]=e;let[n,r]=T(l[c]);return o[c]=r,t(n,c)}}}function j(e,t){return ne(()=>e(t||{}))}function Le(){return!0}var Re={get(e,t,n){return t===c?n:e.get(t)},has(e,t){return t===c||e.has(t)},set:Le,deleteProperty:Le,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Le,deleteProperty:Le}},ownKeys(e){return e.keys()}};function ze(e){return(e=typeof e==`function`?e():e)?e:{}}function Be(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function Ve(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&c in r,e[n]=typeof r==`function`?(t=!0,k(r)):r}if(l&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=ze(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in ze(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(ze(e[n])));return[...new Set(t)]}},Re);let n={},r=Object.create(null);for(let t=e.length-1;t>=0;t--){let i=e[t];if(!i)continue;let a=Object.getOwnPropertyNames(i);for(let e=a.length-1;e>=0;e--){let t=a[e];if(t===`__proto__`||t===`constructor`)continue;let o=Object.getOwnPropertyDescriptor(i,t);if(!r[t])r[t]=o.get?{enumerable:!0,configurable:!0,get:Be.bind(n[t]=[o.get.bind(i)])}:o.value===void 0?void 0:o;else{let e=n[t];e&&(o.get?e.push(o.get.bind(i)):o.value!==void 0&&e.push(()=>o.value))}}}let i={},a=Object.keys(r);for(let e=a.length-1;e>=0;e--){let t=a[e],n=r[t];n&&n.get?Object.defineProperty(i,t,n):i[t]=n?n.value:void 0}return i}function He(e,...t){let n=t.length;if(l&&c in e){let r=n>1?t.flat():t[0],i=t.map(t=>new Proxy({get(n){return t.includes(n)?e[n]:void 0},has(n){return t.includes(n)&&n in e},keys(){return t.filter(t=>t in e)}},Re));return i.push(new Proxy({get(t){return r.includes(t)?void 0:e[t]},has(t){return!r.includes(t)&&t in e},keys(){return Object.keys(e).filter(e=>!r.includes(e))}},Re)),i}let r=[];for(let e=0;e<=n;e++)r[e]={};for(let i of Object.getOwnPropertyNames(e)){let a=n;for(let e=0;e<t.length;e++)if(t[e].includes(i)){a=e;break}let o=Object.getOwnPropertyDescriptor(e,i);!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?r[a][i]=o.value:Object.defineProperty(r[a],i,o)}return r}var Ue=e=>`Stale read from <${e}>.`;function We(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return k(Fe(()=>e.each,e.children,t||void 0))}function Ge(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return k(Ie(()=>e.each,e.children,t||void 0))}function M(e){let t=e.keyed,n=k(()=>e.when,void 0,void 0),r=t?n:k(n,void 0,{equals:(e,t)=>!e==!t});return k(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?ne(()=>a(t?i:()=>{if(!ne(r))throw Ue(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var Ke=new Set([`className`,`value`,`readOnly`,`noValidate`,`formNoValidate`,`isMap`,`noModule`,`playsInline`,`adAuctionHeaders`,`allowFullscreen`,`browsingTopics`,`defaultChecked`,`defaultMuted`,`defaultSelected`,`disablePictureInPicture`,`disableRemotePlayback`,`preservesPitch`,`shadowRootClonable`,`shadowRootCustomElementRegistry`,`shadowRootDelegatesFocus`,`shadowRootSerializable`,`sharedStorageWritable`,...`allowfullscreen.async.alpha.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.hidden.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.adauctionheaders.browsingtopics.credentialless.defaultchecked.defaultmuted.defaultselected.defer.disablepictureinpicture.disableremoteplayback.preservespitch.shadowrootclonable.shadowrootcustomelementregistry.shadowrootdelegatesfocus.shadowrootserializable.sharedstoragewritable`.split(`.`)]),qe=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),Je=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),Ye=Object.assign(Object.create(null),{class:`className`,novalidate:{$:`noValidate`,FORM:1},formnovalidate:{$:`formNoValidate`,BUTTON:1,INPUT:1},ismap:{$:`isMap`,IMG:1},nomodule:{$:`noModule`,SCRIPT:1},playsinline:{$:`playsInline`,VIDEO:1},readonly:{$:`readOnly`,INPUT:1,TEXTAREA:1},adauctionheaders:{$:`adAuctionHeaders`,IFRAME:1},allowfullscreen:{$:`allowFullscreen`,IFRAME:1},browsingtopics:{$:`browsingTopics`,IMG:1},defaultchecked:{$:`defaultChecked`,INPUT:1},defaultmuted:{$:`defaultMuted`,AUDIO:1,VIDEO:1},defaultselected:{$:`defaultSelected`,OPTION:1},disablepictureinpicture:{$:`disablePictureInPicture`,VIDEO:1},disableremoteplayback:{$:`disableRemotePlayback`,AUDIO:1,VIDEO:1},preservespitch:{$:`preservesPitch`,AUDIO:1,VIDEO:1},shadowrootclonable:{$:`shadowRootClonable`,TEMPLATE:1},shadowrootdelegatesfocus:{$:`shadowRootDelegatesFocus`,TEMPLATE:1},shadowrootserializable:{$:`shadowRootSerializable`,TEMPLATE:1},sharedstoragewritable:{$:`sharedStorageWritable`,IFRAME:1,IMG:1}});function Xe(e,t){let n=Ye[e];return typeof n==`object`?n[t]?n.$:void 0:n}var Ze=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),Qe={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},$e=e=>k(()=>e());function et(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&!((d=l.get(t[c]))==null||d!==r+u);)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}var tt=`_$DX_DELEGATE`;function nt(e,t,n,r={}){let i;return w(r=>{i=r,t===document?e():P(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function N(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>ne(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function rt(e,t=window.document){let n=t[tt]||(t[tt]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,yt))}}function it(e,t,n){ht(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function at(e,t,n,r){ht(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function ot(e,t,n){ht(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function st(e,t){ht(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function ct(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function lt(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(_t(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(_t(e,i,!0),n[i]=o)}return n}function ut(e,t,n){if(!t)return n?it(e,`style`):t;let r=e.style;if(typeof t==`string`)return r.cssText=t;typeof n==`string`&&(r.cssText=n=void 0),n||={},t||={};let i,a;for(a in n)t[a]??r.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(r.setProperty(a,i),n[a]=i);return n}function dt(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function ft(e,t={},n,r){let i={};return r||D(()=>i.children=bt(e,t.children,i.children)),D(()=>typeof t.ref==`function`&&pt(t.ref,e)),D(()=>mt(e,t,n,!0,i,!0)),i}function pt(e,t,n){return ne(()=>e(t,n))}function P(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return bt(e,t,r,n);D(r=>bt(e,t(),r,n),r)}function mt(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=vt(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||bt(e,t.children);continue}let s=t[o];i[o]=vt(e,o,s,i[o],n,a,t)}}function ht(e){return!!i.context&&!i.done&&(!e||e.isConnected)}function gt(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function _t(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function vt(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return ut(e,n,r);if(t===`classList`)return lt(e,n,r);if(n===r)return r;if(t===`ref`)a||n(e);else if(t.slice(0,3)===`on:`){let i=t.slice(3);r&&e.removeEventListener(i,r,typeof r!=`function`&&r),n&&e.addEventListener(i,n,typeof n!=`function`&&n)}else if(t.slice(0,10)===`oncapture:`){let i=t.slice(10);r&&e.removeEventListener(i,r,!0),n&&e.addEventListener(i,n,!0)}else if(t.slice(0,2)===`on`){let i=t.slice(2).toLowerCase(),a=Ze.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(ct(e,i,n,a),a&&rt([i]))}else if(t.slice(0,5)===`attr:`)it(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)ot(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=qe.has(t))||!i&&((u=Xe(t,e.tagName))||(c=Ke.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(ht(e))return n;t===`class`||t===`className`?st(e,n):s&&!c&&!l?e[gt(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&Qe[t.split(`:`)[0]];r?at(e,r,t,n):it(e,Je[t]||t,n)}return n}function yt(e){if(i.registry&&i.events&&i.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,a=e.currentTarget,o=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),s=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&o(t.host),!0},c=()=>{for(;s()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),i.registry&&!i.done&&(i.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();o(n[0]);for(let e=0;e<n.length-2&&(t=n[e],s());e++){if(t._$host){t=t._$host,c();break}if(t.parentNode===a)break}}else c();o(r)}function bt(e,t,n,r,i){let a=ht(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=Ct(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=Ct(e,n,r)}else if(o===`function`)return D(()=>{let i=t();for(;typeof i==`function`;)i=i();n=bt(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(xt(o,t,n,i))return D(()=>n=bt(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=Ct(e,n,r),s)return n}else c?n.length===0?St(e,o,r):et(e,n,o):(n&&Ct(e),St(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Ct(e,n,r,t);Ct(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function xt(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=xt(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=xt(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function St(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Ct(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var wt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Tt=new class extends wt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Et={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Dt=new class{#e=Et;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ot(e){setTimeout(e,0)}var kt=typeof window>`u`||`Deno`in globalThis;function At(){}function jt(e,t){return typeof e==`function`?e(t):e}function Mt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Nt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Pt(e,t){return typeof e==`function`?e(t):e}function Ft(e,t){return typeof e==`function`?e(t):e}function It(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Rt(o,t.options))return!1}else if(!Bt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Lt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zt(t.options.mutationKey)!==zt(a))return!1}else if(!Bt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Rt(e,t){return(t?.queryKeyHashFn||zt)(e)}function zt(e){return JSON.stringify(e,(e,t)=>Gt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Bt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Bt(e[n],t[n])):!1}var Vt=Object.prototype.hasOwnProperty;function Ht(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Wt(e)&&Wt(t);if(!r&&!(Gt(e)&&Gt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Vt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ht(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ut(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Wt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Gt(e){if(!Kt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Kt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Kt(e){return Object.prototype.toString.call(e)===`[object Object]`}function qt(e){return new Promise(t=>{Dt.setTimeout(t,e)})}function Jt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ht(e,t)}function Yt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Xt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Zt=Symbol();function Qt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Zt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $t(e,t){return typeof e==`function`?e(...t):!!e}function en(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var tn=(()=>{let e=()=>kt;return{isServer(){return e()},setIsServer(t){e=t}}})();function nn(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function rn(e){let t;if(e.then(e=>(t=e,e),At)?.catch(At),t!==void 0)return{data:t}}function an(e){return e}function on(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??an,o=t.mutations||[],s=t.queries||[];o.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),s.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?rn(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a(f),m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l!==void 0&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l??Date.now(),...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l??Date.now()}});c&&!d&&!h&&!g&&(l===void 0||l>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(At)})}var sn=Ot;function cn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=sn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ln=cn(),un=new class extends wt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function dn(e){return Math.min(1e3*2**e,3e4)}function fn(e){return(e??`online`)!==`online`||un.isOnline()}var pn=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function mn(e){let t=!1,n=0,r,i=nn(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new pn(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Tt.isFocused()&&(e.networkMode===`always`||un.isOnline())&&e.canRun(),u=()=>fn(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(tn.isServer()?0:3),o=e.retryDelay??dn,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),qt(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var hn=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Mt(this.gcTime)&&(this.#e=Dt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Dt.clearTimeout(this.#e),this.#e=void 0)}};function gn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{en(e,()=>t.signal,()=>n=!0)},u=Qt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Xt:Yt;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?vn:_n,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:_n(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function _n(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var yn=class extends hn{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sn(this.options);e.data!==void 0&&(this.setState(xn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Jt(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ft(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Zt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Pt(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Nt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Qt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=mn({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pn&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pn){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ln.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cn=class extends wt{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=nn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tn(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return En(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return En(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Ft(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ut(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dn(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Ft(this.options.enabled,this.#t)!==Ft(t.enabled,this.#t)||Pt(this.options.staleTime,this.#t)!==Pt(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Ft(this.options.enabled,this.#t)!==Ft(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return kn(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(At)),t}#g(){this.#b();let e=Pt(this.options.staleTime,this.#t);if(tn.isServer()||this.#r.isStale||!Mt(e))return;let t=Nt(this.#r.dataUpdatedAt,e)+1;this.#d=Dt.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(tn.isServer()||Ft(this.options.enabled,this.#t)===!1||!Mt(this.#p)||this.#p===0)&&(this.#f=Dt.setInterval(()=>{(this.options.refetchIntervalInBackground||Tt.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Dt.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Dt.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tn(e,t),o=i&&Dn(e,n,t,r);(a||o)&&(l={...l,...bn(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Jt(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Jt(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:On(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ft(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=nn();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ut(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){ln.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function wn(e,t){return Ft(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Ft(t.retryOnMount,e)===!1)}function Tn(e,t){return wn(e,t)||e.state.data!==void 0&&En(e,t,t.refetchOnMount)}function En(e,t,n){if(Ft(t.enabled,e)!==!1&&Pt(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&On(e,t)}return!1}function Dn(e,t,n,r){return(e!==t||Ft(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&On(e,n)}function On(e,t){return Ft(t.enabled,e)!==!1&&e.isStaleByTime(Pt(t.staleTime,e))}function kn(e,t){return!Ut(e.getCurrentResult(),t)}var An=class extends hn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||jn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=mn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ln.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mn=class extends wt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new An({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Nn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ln.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Lt(t,e))}findAll(e={}){return this.getAll().filter(t=>Lt(e,t))}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ln.batch(()=>Promise.all(e.map(e=>e.continue().catch(At))))}};function Nn(e){return e.options.scope?.id}var Pn=class extends wt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ut(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&zt(t.mutationKey)!==zt(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??jn();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ln.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Fn=class extends wt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Rt(r,t),a=this.get(i);return a||(a=new yn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ln.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>It(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>It(e,t)):t}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ln.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ln.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},In=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Fn,this.#t=e.mutationCache||new Mn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Tt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=un.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Pt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=jt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ln.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ln.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ln.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ln.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(At).catch(At)}invalidateQueries(e,t={}){return ln.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ln.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(At)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(At)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Pt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(At).catch(At)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return un.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(zt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Bt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Bt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Rt(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Zt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ln=Symbol(`store-raw`),Rn=Symbol(`store-node`),zn=Symbol(`store-has`),Bn=Symbol(`store-self`);function Vn(e){let t=e[c];if(!t&&(Object.defineProperty(e,c,{value:t=new Proxy(e,Yn)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),i=Object.getPrototypeOf(e),a=i!==null&&typeof e==`object`&&!!e&&!Array.isArray(e)&&i!==Object.prototype;if(a){let e=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(e)),Object.assign(r,e)}for(let i=0,o=n.length;i<o;i++){let o=n[i];a&&o===`constructor`||r[o].get&&Object.defineProperty(e,o,{configurable:!0,enumerable:r[o].enumerable,get:r[o].get.bind(t)})}}return t}function Hn(e){let t;return typeof e==`object`&&!!e&&(e[c]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Un(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Ln])return n;if(!Hn(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=Un(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],!o[a].get&&(i=e[a],(r=Un(i,t))!==i&&(e[a]=r))}return e}function Wn(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Gn(e,t,n){if(e[t])return e[t];let[r,i]=T(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function Kn(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===c||t===Rn?n:(delete n.value,delete n.writable,n.get=()=>e[c][t],n)}function qn(e){oe()&&Gn(Wn(e,Rn),Bn)()}function Jn(e){return qn(e),Reflect.ownKeys(e)}var Yn={get(e,t,n){if(t===Ln)return e;if(t===c)return n;if(t===u)return qn(e),n;let r=Wn(e,Rn),i=r[t],a=i?i():e[t];if(t===Rn||t===zn||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);oe()&&(typeof a!=`function`||Object.prototype.hasOwnProperty.call(e,t))&&!(n&&n.get)&&(a=Gn(r,t,a)())}return Hn(a)?Vn(a):a},has(e,t){return t===Ln||t===c||t===u||t===Rn||t===zn||t===`__proto__`?!0:(oe()&&Gn(Wn(e,zn),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Jn,getOwnPropertyDescriptor:Kn};function Xn(e,t,n,r=!1){if(t===`__proto__`||!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[zn]&&e[zn][t]&&i!==void 0&&e[zn][t].$()):(e[t]=n,e[zn]&&e[zn][t]&&i===void 0&&e[zn][t].$());let o=Wn(e,Rn),s;if((s=Gn(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=Gn(o,`length`,a))&&s.$(e.length)}(s=o[Bn])&&s.$()}function Zn(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];Qn(i)||Xn(e,i,t[i])}}function Qn(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function $n(e,t){if(typeof t==`function`&&(t=t(e)),t=Un(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&Xn(e,n,r)}Xn(e,`length`,r)}else Zn(e,t)}function er(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(a===`string`&&(r===`__proto__`||t.length>1&&Qn(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)er(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&er(e,[i].concat(t),n);return}else if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)er(e,[r].concat(t),n);return}else if(t.length>1){er(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||r===void 0&&a==null||(a=Un(a),r===void 0||Hn(i)&&Hn(a)&&!Array.isArray(a)?Zn(i,a):Xn(e,r,a))}function tr(...[e,t]){let n=Un(e||{}),r=Array.isArray(n),i=Vn(n);function a(...e){A(()=>{r&&e.length===1?$n(n,e[0]):er(n,e)})}return[i,a]}var nr=Symbol(`store-root`);function rr(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function ir(e,t,n,r,i){if(rr(n))return;let a=t[n];if(e===a)return;let o=Array.isArray(e);if(n!==nr&&(!Hn(e)||!Hn(a)||o!==Array.isArray(a)||i&&e[i]!==a[i])){Xn(t,n,e);return}if(o){if(e.length&&a.length&&(!r||i&&e[0]&&e[0][i]!=null)){let t,n,o,s,c,l,u,d;for(o=0,s=Math.min(a.length,e.length);o<s&&(a[o]===e[o]||i&&a[o]&&e[o]&&a[o][i]&&a[o][i]===e[o][i]);o++)ir(e[o],a,o,r,i);let f=Array(e.length),p=new Map;for(s=a.length-1,c=e.length-1;s>=o&&c>=o&&(a[s]===e[c]||i&&a[s]&&e[c]&&a[s][i]&&a[s][i]===e[c][i]);s--,c--)f[c]=a[s];if(o>c||o>s){for(n=o;n<=c;n++)Xn(a,n,e[n]);for(;n<e.length;n++)Xn(a,n,f[n]),ir(e[n],a,n,r,i);a.length>e.length&&Xn(a,`length`,e.length);return}for(u=Array(c+1),n=c;n>=o;n--)l=e[n],d=i&&l?l[i]:l,t=p.get(d),u[n]=t===void 0?-1:t,p.set(d,n);for(t=o;t<=s;t++)l=a[t],d=i&&l?l[i]:l,n=p.get(d),n!==void 0&&n!==-1&&(f[n]=a[t],n=u[n],p.set(d,n));for(n=o;n<e.length;n++)n in f?(Xn(a,n,f[n]),ir(e[n],a,n,r,i)):Xn(a,n,e[n])}else for(let t=0,n=e.length;t<n;t++)ir(e[t],a,t,r,i);a.length>e.length&&Xn(a,`length`,e.length);return}let s=Object.keys(e);for(let t=0,n=s.length;t<n;t++)rr(s[t])||ir(e[s[t]],a,s[t],r,i);let c=Object.keys(a);for(let t=0,n=c.length;t<n;t++)e[c[t]]===void 0&&Xn(a,c[t],void 0)}function ar(e,t={}){let{merge:n,key:r=`id`}=t,i=Un(e);return e=>{if(!Hn(e)||!Hn(i))return i;let t=ir(i,{[nr]:e},nr,n,r);return t===void 0?e:t}}var or=ue(void 0),sr=e=>{if(e)return e;let t=de(or);if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t()},cr=e=>(D(t=>(t?.(),e.client.mount(),e.client.unmount.bind(e.client))),ae(()=>e.client.unmount()),j(or.Provider,{value:()=>e.client,get children(){return e.children}})),lr=ue(()=>!1),ur=()=>de(lr);lr.Provider;function dr(e,t,n,r){if(n===!1)return t;if(typeof n==`function`){let r=n(e.data,t.data);return{...t,data:r}}let i=t.data;if(e.data===void 0)try{i=structuredClone(i)}catch{}let a=ar(i,{key:n})(e.data);return{...t,data:a}}var fr=(e,t)=>t;function pr(e,t,n){let r=k(()=>sr(n?.())),i=ur(),a=k(()=>{let t=r().defaultQueryOptions(e());return t._optimisticResults=i()?`isRestoring`:`optimistic`,t.structuralSharing=!1,t}),o=a(),[s,c]=T(new t(r(),a())),l=s().getOptimisticResult(a()),[u,d]=tr(l),f=()=>s().subscribe(e=>{l=e,queueMicrotask(()=>{h&&v()})});function p(e){let t=s().options,n=t.reconcile;d(r=>dr(r,e,n!==void 0&&n,t.queryHash))}function m(){return[()=>u,e=>{let t=Un(u);if(typeof e==`function`&&(e=e(t)),e?.hydrationData){let{hydrationData:t,...n}=e;e=n}p(e)}]}let h=null,g=null,[_,{refetch:v}]=te(()=>{let e=s();return new Promise((t,n)=>{if(g=t,!h&&!i()&&(h=f()),e.updateResult(),l.isError&&!l.isFetching&&!i()&&$t(e.options.throwOnError,[l.error,e.getCurrentQuery()]))return p(l),n(l.error);if(!l.isLoading)return g=null,t(fr(e.getCurrentQuery(),l));p(l)})},{storage:m,get deferStream(){return e().deferStream},onHydrated(e,t){if(t.value&&`hydrationData`in t.value&&on(r(),{queries:[{...t.value.hydrationData}]}),h)return;let n={...o};(o.staleTime||!o.initialData)&&t.value&&(n.refetchOnMount=!1),s().setOptions(n),p(s().getOptimisticResult(n)),h=f()}});return E(re(r,e=>{h&&h();let n=new t(e,a());h=f(),c(n)},{defer:!0})),E(re(i,e=>{e||v()},{defer:!0})),ae(()=>{h&&=(h(),null),g&&=(g(l),null)}),E(re([s,a],([e,t])=>{e.setOptions(t),p(e.getOptimisticResult(t)),v()},{defer:!0})),new Proxy(u,{get(e,t){return t===`data`?u.data===void 0?_()?.data:_.latest?.data:Reflect.get(e,t)}})}function mr(e,t){return pr(k(()=>e()),Cn,t)}function hr(e,t){let n=new Pn(k(()=>sr(t?.()))(),e()),r=(e,t)=>{n.mutate(e,t).catch(At)},[i,a]=tr({...n.getCurrentResult(),mutate:r,mutateAsync:n.getCurrentResult().mutate});return E(()=>{n.setOptions(e())}),E(re(()=>i.status,()=>{if(i.isError&&$t(n.options.throwOnError,[i.error]))throw i.error})),ae(n.subscribe(e=>{a({...e,mutate:r,mutateAsync:e.mutate})})),i}var gr=class extends In{constructor(e={}){super(e)}},_r=mr,vr=hr,yr,br=t((()=>{yr=typeof chrome<`u`&&!!chrome.runtime?.id&&!!chrome.storage?.local}));function xr(e){for(let t of Fr)t(e)}function Sr(e,t){try{let n=e.getItem(t);return n?JSON.parse(n):null}catch{return null}}async function Cr(){return yr?(await chrome.storage.local.get(jr))[jr]??{}:Sr(localStorage,Nr)??{}}async function wr(e){let t={...await Cr(),...e};return yr?await chrome.storage.local.set({[jr]:t}):(localStorage.setItem(Nr,JSON.stringify(t)),xr(`settings`)),t}async function Tr(){if(yr){let e=(await chrome.storage.session.get(Mr))[Mr]??null;if(!e?.length)return e;let t=await chrome.storage.session.get(e.map(e=>Lr(e.grabbedAt)));return e.map(e=>({...e,screenshotDataUrl:t[Lr(e.grabbedAt)]??void 0}))}let e=Sr(sessionStorage,Pr);return e?.length?e.map(e=>({...e,screenshotDataUrl:sessionStorage.getItem(Lr(e.grabbedAt))??void 0})):e}async function Er(e){let t=e.map(({screenshotDataUrl:e,...t})=>t);if(yr){let n={};for(let t of e)t.screenshotDataUrl&&(n[Lr(t.grabbedAt)]=t.screenshotDataUrl);await chrome.storage.session.set({[Mr]:t,...n})}else{for(let t of e)if(t.screenshotDataUrl)try{sessionStorage.setItem(Lr(t.grabbedAt),t.screenshotDataUrl)}catch{}let n=new Set(t.map(e=>Lr(e.grabbedAt)));for(let e=sessionStorage.length-1;e>=0;e--){let t=sessionStorage.key(e);t?.startsWith(Ir)&&!n.has(t)&&sessionStorage.removeItem(t)}sessionStorage.setItem(Pr,JSON.stringify(t)),xr(`grab`)}}async function Dr(e){let t=[...await Tr()??[]];for(let n of e){let e=t.findIndex(e=>e.grabbedAt===n.grabbedAt);if(e>=0){t[e]={...t[e],...n,screenshotDataUrl:n.screenshotDataUrl??t[e].screenshotDataUrl,source:n.source??t[e].source};continue}let r=e=>`${e.source?.filePath??``}:${e.source?.lineNumber??``}|${e.tagName??``}|${(e.content??``).trim().slice(0,80)}`;if(n.source?.filePath){let e=t.findIndex(e=>r(e)===r(n));if(e>=0){t[e]={...t[e],...n};continue}}t.push(n)}let n=new Set,r=[];for(let e=t.length-1;e>=0;e--){let i=t[e],a=i.source?.filePath?`${i.source.filePath}:${i.source.lineNumber??``}|${i.tagName??``}|${(i.content??``).trim().slice(0,80)}`:`id:${i.grabbedAt}`;n.has(a)||(n.add(a),r.unshift(i))}await Er(r.slice(-8))}async function Or(e){await Er((await Tr()??[]).filter(t=>t.grabbedAt!==e))}async function kr(){yr?await chrome.storage.session.remove(Mr):(sessionStorage.removeItem(Pr),xr(`grab`))}function Ar(e){if(yr){let t=(t,n)=>{n===`local`&&e(`settings`),n===`session`&&e(`grab`)};return chrome.storage.onChanged.addListener(t),()=>chrome.storage.onChanged.removeListener(t)}return Fr.add(e),()=>Fr.delete(e)}var jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr=t((()=>{br(),jr=`settings`,Mr=`lastGrab`,Nr=`linear-grab:settings`,Pr=`linear-grab:last-grab`,Fr=new Set,Ir=`linear-grab:shot:`,Lr=e=>`${Ir}${e}`}));function zr(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}function Br(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?!0:Array.isArray(e)?e.every(Br):typeof e==`object`&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Br(t)))}function Vr(e){return Array.isArray(e)&&e.every(Br)}function Hr(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Br(t)))}var Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma=t((()=>{Ur=`vercel.ai.error`,Wr=Symbol.for(Ur),qr=class e extends (Kr=Error,Gr=Wr,Kr){constructor({name:e,message:t,cause:n}){super(t),this[Gr]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Ur)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},Jr=`AI_APICallError`,Yr=`vercel.ai.error.${Jr}`,Xr=Symbol.for(Yr),$r=class extends (Qr=qr,Zr=Xr,Qr){constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=r!=null&&(r===408||r===409||r===429||r>=500),data:c}){super({name:Jr,message:e,cause:o}),this[Zr]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=c}static isInstance(e){return qr.hasMarker(e,Yr)}},ei=`AI_EmptyResponseBodyError`,ti=`vercel.ai.error.${ei}`,ni=Symbol.for(ti),ai=class extends (ii=qr,ri=ni,ii){constructor({message:e=`Empty response body`}={}){super({name:ei,message:e}),this[ri]=!0}static isInstance(e){return qr.hasMarker(e,ti)}},oi=`AI_InvalidArgumentError`,si=`vercel.ai.error.${oi}`,ci=Symbol.for(si),di=class extends (ui=qr,li=ci,ui){constructor({message:e,cause:t,argument:n}){super({name:oi,message:e,cause:t}),this[li]=!0,this.argument=n}static isInstance(e){return qr.hasMarker(e,si)}},fi=`AI_InvalidPromptError`,pi=`vercel.ai.error.${fi}`,mi=Symbol.for(pi),_i=class extends (gi=qr,hi=mi,gi){constructor({prompt:e,message:t,cause:n}){super({name:fi,message:`Invalid prompt: ${t}`,cause:n}),this[hi]=!0,this.prompt=e}static isInstance(e){return qr.hasMarker(e,pi)}},vi=`AI_InvalidResponseDataError`,yi=`vercel.ai.error.${vi}`,bi=Symbol.for(yi),Ci=class extends (Si=qr,xi=bi,Si){constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:vi,message:t}),this[xi]=!0,this.data=e}static isInstance(e){return qr.hasMarker(e,yi)}},wi=`AI_JSONParseError`,Ti=`vercel.ai.error.${wi}`,Ei=Symbol.for(Ti),ki=class extends (Oi=qr,Di=Ei,Oi){constructor({text:e,cause:t}){super({name:wi,message:`JSON parsing failed: Text: ${e}.
|
|
1
|
+
(function(){var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),r=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},i={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return a(this.context.count)},getNextContextId(){return a(this.context.count++)}};function a(e){let t=String(e),n=t.length-1;return i.context.id+(n?String.fromCharCode(96+n):``)+t}function o(e){i.context=e}var s=(e,t)=>e===t,c=Symbol(`solid-proxy`),l=typeof Proxy==`function`,u=Symbol(`solid-track`),d={equals:s},f=null,p=Se,m=1,h=2,g={owned:null,cleanups:null,context:null,owner:null},_={},v=null,y=null,b=null,x=null,S=null,C=0;function w(e,t){let n=b,r=v,i=e.length===0,a=t===void 0?r:t,o=i?g:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>ne(()=>Ee(o)));v=o,b=null;try{return be(s,!0)}finally{b=n,v=r}}function T(e,t){t=t?Object.assign({},d,t):d;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[me.bind(n),e=>(typeof e==`function`&&(e=y&&y.running&&y.sources.has(n)?e(n.tValue):e(n.value)),he(n,e))]}function E(e,t,n){ge(ve(e,t,!0,m))}function D(e,t,n){ge(ve(e,t,!1,m))}function O(e,t,n){p=Ce;let r=ve(e,t,!1,m),i=pe&&de(pe);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),S?S.push(r):ge(r)}function k(e,t,n){n=n?Object.assign({},d,n):d;let r=ve(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,ge(r),me.bind(r)}function ee(e){return e&&typeof e==`object`&&`then`in e}function te(e,t,n){let r,a,o;typeof t==`function`?(r=e,a=t,o=n||{}):(r=!0,a=e,o=t||{});let s=null,c=_,l=null,u=!1,d=!1,f=`initialValue`in o,p=typeof r==`function`&&k(r),m=new Set,[h,g]=(o.storage||T)(o.initialValue),[x,S]=T(void 0),[C,w]=T(void 0,{equals:!1}),[D,O]=T(f?`ready`:`unresolved`);v&&ae(()=>{for(let e of m.keys())e.decrement();m.clear(),y&&s&&y.promises.delete(s),s=null}),i.context&&(l=i.getNextContextId(),o.ssrLoadFrom===`initial`?c=o.initialValue:i.load&&i.has(l)&&(c=i.load(l)));function te(e,t,n,r){return s===e&&(s=null,r!==void 0&&(f=!0),(e===c||t===c)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(r,{value:t})),c=_,y&&e&&u?(y.promises.delete(e),u=!1,be(()=>{y.running=!0,A(t,n)},!1)):A(t,n)),t}function A(e,t){be(()=>{t===void 0&&g(()=>e),O(t===void 0?f?`ready`:`unresolved`:`errored`),S(t);for(let e of m.keys())e.decrement();m.clear()},!1)}function re(){let e=pe&&de(pe),t=h(),n=x();if(n!==void 0&&!s)throw n;return b&&!b.user&&e&&E(()=>{C(),s&&(e.resolved&&y&&u?y.promises.add(s):m.has(e)||(e.increment(),m.add(e)))}),t}function ie(e=!0){if(e!==!1&&d)return;d=!1;let t=p?p():r;if(u=y&&y.running,t==null||t===!1){te(s,ne(h));return}y&&s&&y.promises.delete(s);let n,i=c===_?ne(()=>{try{return a(t,{value:h(),refetching:e})}catch(e){n=e}}):c;if(n!==void 0){te(s,void 0,Oe(n),t);return}else if(!ee(i))return te(s,i,void 0,t),i;return s=i,`v`in i?(i.s===1?te(s,i.v,void 0,t):te(s,void 0,Oe(i.v),t),i):(d=!0,queueMicrotask(()=>d=!1),be(()=>{O(f?`refreshing`:`pending`),w()},!1),i.then(e=>te(i,e,void 0,t),e=>te(i,void 0,Oe(e),t)))}Object.defineProperties(re,{state:{get:()=>D()},error:{get:()=>x()},loading:{get(){let e=D();return e===`pending`||e===`refreshing`}},latest:{get(){if(!f)return re();let e=x();if(e&&!s)throw e;return h()}}});let oe=v;return p?E(()=>(oe=v,ie(!1))):ie(!1),[re,{refetch:e=>se(oe,()=>ie(e)),mutate:g}]}function A(e){return be(e,!1)}function ne(e){if(b===null)return e();let t=b;b=null;try{return e()}finally{b=t}}function re(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=ne(()=>t(o,i,n));return i=o,s}}function ie(e){O(()=>ne(e))}function ae(e){return v===null||(v.cleanups===null?v.cleanups=[e]:v.cleanups.push(e)),e}function oe(){return b}function se(e,t){let n=v,r=b;v=e,b=null;try{return be(t,!0)}catch(e){Ae(e)}finally{v=n,b=r}}var[ce,le]=T(!1);function ue(e,t){let n=Symbol(`context`);return{id:n,Provider:Me(n),defaultValue:e}}function de(e){let t;return v&&v.context&&(t=v.context[e.id])!==void 0?t:e.defaultValue}function fe(e){let t=k(e),n=k(()=>je(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var pe;function me(){let e=y&&y.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===m)ge(this);else{let e=x;x=null,be(()=>we(this),!1),x=e}if(b){let e=this.observers;if(!e||e[e.length-1]!==b){let t=e?e.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(t)):(b.sources=[this],b.sourceSlots=[t]),e?(e.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}}return e&&y.sources.has(this)?this.tValue:this.value}function he(e,t,n){let r=y&&y.running&&y.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(y){let r=y.running;(r||!n&&y.sources.has(e))&&(y.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&be(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=y&&y.running;r&&y.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?x.push(n):S.push(n),n.observers&&Te(n)),r?n.tState=m:n.state=m)}if(x.length>1e6)throw x=[],Error()},!1)}return t}function ge(e){if(!e.fn)return;Ee(e);let t=C;_e(e,y&&y.running&&y.sources.has(e)?e.tValue:e.value,t),y&&!y.running&&y.sources.has(e)&&queueMicrotask(()=>{be(()=>{y&&(y.running=!0),b=v=e,_e(e,e.tValue,t),b=v=null},!1)})}function _e(e,t,n){let r,i=v,a=b;b=v=e;try{r=e.fn(t)}catch(t){return e.pure&&(y&&y.running?(e.tState=m,e.tOwned&&e.tOwned.forEach(Ee),e.tOwned=void 0):(e.state=m,e.owned&&e.owned.forEach(Ee),e.owned=null)),e.updatedAt=n+1,Ae(t)}finally{b=a,v=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?he(e,r,!0):y&&y.running&&e.pure?(y.sources.has(e)||(e.value=r),y.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function ve(e,t,n,r=m,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:v,context:v?v.context:null,pure:n};return y&&y.running&&(a.state=0,a.tState=r),v===null||v!==g&&(y&&y.running&&v.pure?v.tOwned?v.tOwned.push(a):v.tOwned=[a]:v.owned?v.owned.push(a):v.owned=[a]),a}function ye(e){let t=y&&y.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===h)return we(e);if(e.suspense&&ne(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<C);){if(t&&y.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(y.disposed.has(t))return}if((t?e.tState:e.state)===m)ge(e);else if((t?e.tState:e.state)===h){let t=x;x=null,be(()=>we(e,n[0]),!1),x=t}}}function be(e,t){if(x)return e();let n=!1;t||(x=[]),S?n=!0:S=[],C++;try{let t=e();return xe(n),t}catch(e){n||(S=null),x=null,Ae(e)}}function xe(e){if(x&&=(Se(x),null),e)return;let t;if(y){if(!y.promises.size&&!y.queue.size){let e=y.sources,n=y.disposed;S.push.apply(S,y.effects),t=y.resolve;for(let e of S)`tState`in e&&(e.state=e.tState),delete e.tState;y=null,be(()=>{for(let e of n)Ee(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)Ee(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}le(!1)},!1)}else if(y.running){y.running=!1,y.effects.push.apply(y.effects,S),S=null,le(!0);return}}let n=S;S=null,n.length&&be(()=>p(n),!1),t&&t()}function Se(e){for(let t=0;t<e.length;t++)ye(e[t])}function Ce(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:ye(r)}if(i.context){if(i.count){i.effects||=[],i.effects.push(...e.slice(0,n));return}o()}for(i.effects&&(i.done||!i.count)&&(e=[...i.effects,...e],n+=i.effects.length,delete i.effects),t=0;t<n;t++)ye(e[t])}function we(e,t){let n=y&&y.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===m?i!==t&&(!i.updatedAt||i.updatedAt<C)&&ye(i):e===h&&we(i,t)}}}function Te(e){let t=y&&y.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=h:r.state=h,r.pure?x.push(r):S.push(r),r.observers&&Te(r))}}function Ee(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Ee(e.tOwned[t]);delete e.tOwned}if(y&&y.running&&e.pure)De(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)Ee(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}y&&y.running?e.tState=0:e.state=0}function De(e,t){if(t||(e.tState=0,y.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)De(e.owned[t])}function Oe(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function ke(e,t,n){try{for(let n of t)n(e)}catch(e){Ae(e,n&&n.owner||null)}}function Ae(e,t=v){let n=f&&t&&t.context&&t.context[f],r=Oe(e);if(!n)throw r;S?S.push({fn(){ke(r,n,t)},state:m}):ke(r,n,t)}function je(e){if(typeof e==`function`&&!e.length)return je(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=je(e[n]);if(Array.isArray(r))if(r.length<32768)t.push.apply(t,r);else for(let e=0;e<r.length;e++)t.push(r[e]);else t.push(r)}return t}return e}function Me(e,t){return function(t){let n;return D(()=>n=ne(()=>(v.context={...v.context,[e]:t.value},fe(()=>t.children))),void 0),n}}var Ne=Symbol(`fallback`);function Pe(e){for(let t=0;t<e.length;t++)e[t]()}function Fe(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return ae(()=>Pe(a)),()=>{let c=e()||[],l=c.length,d,f;return c[u],ne(()=>{let e,t,u,m,h,g,_,v,y;if(l===0)o!==0&&(Pe(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Ne],i[0]=w(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),f=0;f<l;f++)r[f]=c[f],i[f]=w(p);o=l}else{for(u=Array(l),m=Array(l),s&&(h=Array(l)),g=0,_=Math.min(o,l);g<_&&r[g]===c[g];g++);for(_=o-1,v=l-1;_>=g&&v>=g&&r[_]===c[v];_--,v--)u[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),f=v;f>=g;f--)y=c[f],d=e.get(y),t[f]=d===void 0?-1:d,e.set(y,f);for(d=g;d<=_;d++)y=r[d],f=e.get(y),f!==void 0&&f!==-1?(u[f]=i[d],m[f]=a[d],s&&(h[f]=s[d]),f=t[f],e.set(y,f)):a[d]();for(f=g;f<l;f++)f in u?(i[f]=u[f],a[f]=m[f],s&&(s[f]=h[f],s[f](f))):i[f]=w(p);i=i.slice(0,o=l),r=c.slice(0)}return i});function p(e){if(a[f]=e,s){let[e,n]=T(f);return s[f]=n,t(c[f],e)}return t(c[f])}}}function Ie(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return ae(()=>Pe(a)),()=>{let l=e()||[],d=l.length;return l[u],ne(()=>{if(d===0)return s!==0&&(Pe(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[Ne],i[0]=w(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===Ne&&(a[0](),a=[],r=[],i=[],s=0),c=0;c<d;c++)c<r.length&&r[c]!==l[c]?o[c](()=>l[c]):c>=r.length&&(i[c]=w(f));for(;c<r.length;c++)a[c]();return s=o.length=a.length=d,r=l.slice(0),i=i.slice(0,s)});function f(e){a[c]=e;let[n,r]=T(l[c]);return o[c]=r,t(n,c)}}}function j(e,t){return ne(()=>e(t||{}))}function Le(){return!0}var Re={get(e,t,n){return t===c?n:e.get(t)},has(e,t){return t===c||e.has(t)},set:Le,deleteProperty:Le,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Le,deleteProperty:Le}},ownKeys(e){return e.keys()}};function ze(e){return(e=typeof e==`function`?e():e)?e:{}}function Be(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function Ve(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&c in r,e[n]=typeof r==`function`?(t=!0,k(r)):r}if(l&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=ze(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in ze(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(ze(e[n])));return[...new Set(t)]}},Re);let n={},r=Object.create(null);for(let t=e.length-1;t>=0;t--){let i=e[t];if(!i)continue;let a=Object.getOwnPropertyNames(i);for(let e=a.length-1;e>=0;e--){let t=a[e];if(t===`__proto__`||t===`constructor`)continue;let o=Object.getOwnPropertyDescriptor(i,t);if(!r[t])r[t]=o.get?{enumerable:!0,configurable:!0,get:Be.bind(n[t]=[o.get.bind(i)])}:o.value===void 0?void 0:o;else{let e=n[t];e&&(o.get?e.push(o.get.bind(i)):o.value!==void 0&&e.push(()=>o.value))}}}let i={},a=Object.keys(r);for(let e=a.length-1;e>=0;e--){let t=a[e],n=r[t];n&&n.get?Object.defineProperty(i,t,n):i[t]=n?n.value:void 0}return i}function He(e,...t){let n=t.length;if(l&&c in e){let r=n>1?t.flat():t[0],i=t.map(t=>new Proxy({get(n){return t.includes(n)?e[n]:void 0},has(n){return t.includes(n)&&n in e},keys(){return t.filter(t=>t in e)}},Re));return i.push(new Proxy({get(t){return r.includes(t)?void 0:e[t]},has(t){return!r.includes(t)&&t in e},keys(){return Object.keys(e).filter(e=>!r.includes(e))}},Re)),i}let r=[];for(let e=0;e<=n;e++)r[e]={};for(let i of Object.getOwnPropertyNames(e)){let a=n;for(let e=0;e<t.length;e++)if(t[e].includes(i)){a=e;break}let o=Object.getOwnPropertyDescriptor(e,i);!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?r[a][i]=o.value:Object.defineProperty(r[a],i,o)}return r}var Ue=e=>`Stale read from <${e}>.`;function We(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return k(Fe(()=>e.each,e.children,t||void 0))}function Ge(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return k(Ie(()=>e.each,e.children,t||void 0))}function M(e){let t=e.keyed,n=k(()=>e.when,void 0,void 0),r=t?n:k(n,void 0,{equals:(e,t)=>!e==!t});return k(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?ne(()=>a(t?i:()=>{if(!ne(r))throw Ue(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var Ke=new Set([`className`,`value`,`readOnly`,`noValidate`,`formNoValidate`,`isMap`,`noModule`,`playsInline`,`adAuctionHeaders`,`allowFullscreen`,`browsingTopics`,`defaultChecked`,`defaultMuted`,`defaultSelected`,`disablePictureInPicture`,`disableRemotePlayback`,`preservesPitch`,`shadowRootClonable`,`shadowRootCustomElementRegistry`,`shadowRootDelegatesFocus`,`shadowRootSerializable`,`sharedStorageWritable`,...`allowfullscreen.async.alpha.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.hidden.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.adauctionheaders.browsingtopics.credentialless.defaultchecked.defaultmuted.defaultselected.defer.disablepictureinpicture.disableremoteplayback.preservespitch.shadowrootclonable.shadowrootcustomelementregistry.shadowrootdelegatesfocus.shadowrootserializable.sharedstoragewritable`.split(`.`)]),qe=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),Je=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),Ye=Object.assign(Object.create(null),{class:`className`,novalidate:{$:`noValidate`,FORM:1},formnovalidate:{$:`formNoValidate`,BUTTON:1,INPUT:1},ismap:{$:`isMap`,IMG:1},nomodule:{$:`noModule`,SCRIPT:1},playsinline:{$:`playsInline`,VIDEO:1},readonly:{$:`readOnly`,INPUT:1,TEXTAREA:1},adauctionheaders:{$:`adAuctionHeaders`,IFRAME:1},allowfullscreen:{$:`allowFullscreen`,IFRAME:1},browsingtopics:{$:`browsingTopics`,IMG:1},defaultchecked:{$:`defaultChecked`,INPUT:1},defaultmuted:{$:`defaultMuted`,AUDIO:1,VIDEO:1},defaultselected:{$:`defaultSelected`,OPTION:1},disablepictureinpicture:{$:`disablePictureInPicture`,VIDEO:1},disableremoteplayback:{$:`disableRemotePlayback`,AUDIO:1,VIDEO:1},preservespitch:{$:`preservesPitch`,AUDIO:1,VIDEO:1},shadowrootclonable:{$:`shadowRootClonable`,TEMPLATE:1},shadowrootdelegatesfocus:{$:`shadowRootDelegatesFocus`,TEMPLATE:1},shadowrootserializable:{$:`shadowRootSerializable`,TEMPLATE:1},sharedstoragewritable:{$:`sharedStorageWritable`,IFRAME:1,IMG:1}});function Xe(e,t){let n=Ye[e];return typeof n==`object`?n[t]?n.$:void 0:n}var Ze=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),Qe={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},$e=e=>k(()=>e());function et(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&!((d=l.get(t[c]))==null||d!==r+u);)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}var tt=`_$DX_DELEGATE`;function nt(e,t,n,r={}){let i;return w(r=>{i=r,t===document?e():P(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function N(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>ne(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function rt(e,t=window.document){let n=t[tt]||(t[tt]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,yt))}}function it(e,t,n){ht(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function at(e,t,n,r){ht(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function ot(e,t,n){ht(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function st(e,t){ht(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function ct(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function lt(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(_t(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(_t(e,i,!0),n[i]=o)}return n}function ut(e,t,n){if(!t)return n?it(e,`style`):t;let r=e.style;if(typeof t==`string`)return r.cssText=t;typeof n==`string`&&(r.cssText=n=void 0),n||={},t||={};let i,a;for(a in n)t[a]??r.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(r.setProperty(a,i),n[a]=i);return n}function dt(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function ft(e,t={},n,r){let i={};return r||D(()=>i.children=bt(e,t.children,i.children)),D(()=>typeof t.ref==`function`&&pt(t.ref,e)),D(()=>mt(e,t,n,!0,i,!0)),i}function pt(e,t,n){return ne(()=>e(t,n))}function P(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return bt(e,t,r,n);D(r=>bt(e,t(),r,n),r)}function mt(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=vt(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||bt(e,t.children);continue}let s=t[o];i[o]=vt(e,o,s,i[o],n,a,t)}}function ht(e){return!!i.context&&!i.done&&(!e||e.isConnected)}function gt(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function _t(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function vt(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return ut(e,n,r);if(t===`classList`)return lt(e,n,r);if(n===r)return r;if(t===`ref`)a||n(e);else if(t.slice(0,3)===`on:`){let i=t.slice(3);r&&e.removeEventListener(i,r,typeof r!=`function`&&r),n&&e.addEventListener(i,n,typeof n!=`function`&&n)}else if(t.slice(0,10)===`oncapture:`){let i=t.slice(10);r&&e.removeEventListener(i,r,!0),n&&e.addEventListener(i,n,!0)}else if(t.slice(0,2)===`on`){let i=t.slice(2).toLowerCase(),a=Ze.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(ct(e,i,n,a),a&&rt([i]))}else if(t.slice(0,5)===`attr:`)it(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)ot(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=qe.has(t))||!i&&((u=Xe(t,e.tagName))||(c=Ke.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(ht(e))return n;t===`class`||t===`className`?st(e,n):s&&!c&&!l?e[gt(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&Qe[t.split(`:`)[0]];r?at(e,r,t,n):it(e,Je[t]||t,n)}return n}function yt(e){if(i.registry&&i.events&&i.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,a=e.currentTarget,o=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),s=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&o(t.host),!0},c=()=>{for(;s()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),i.registry&&!i.done&&(i.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();o(n[0]);for(let e=0;e<n.length-2&&(t=n[e],s());e++){if(t._$host){t=t._$host,c();break}if(t.parentNode===a)break}}else c();o(r)}function bt(e,t,n,r,i){let a=ht(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=Ct(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=Ct(e,n,r)}else if(o===`function`)return D(()=>{let i=t();for(;typeof i==`function`;)i=i();n=bt(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(xt(o,t,n,i))return D(()=>n=bt(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=Ct(e,n,r),s)return n}else c?n.length===0?St(e,o,r):et(e,n,o):(n&&Ct(e),St(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Ct(e,n,r,t);Ct(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function xt(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=xt(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=xt(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function St(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Ct(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var wt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Tt=new class extends wt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Et={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Dt=new class{#e=Et;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ot(e){setTimeout(e,0)}var kt=typeof window>`u`||`Deno`in globalThis;function At(){}function jt(e,t){return typeof e==`function`?e(t):e}function Mt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Nt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Pt(e,t){return typeof e==`function`?e(t):e}function Ft(e,t){return typeof e==`function`?e(t):e}function It(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Rt(o,t.options))return!1}else if(!Bt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Lt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zt(t.options.mutationKey)!==zt(a))return!1}else if(!Bt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Rt(e,t){return(t?.queryKeyHashFn||zt)(e)}function zt(e){return JSON.stringify(e,(e,t)=>Gt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Bt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Bt(e[n],t[n])):!1}var Vt=Object.prototype.hasOwnProperty;function Ht(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Wt(e)&&Wt(t);if(!r&&!(Gt(e)&&Gt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Vt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ht(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ut(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Wt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Gt(e){if(!Kt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Kt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Kt(e){return Object.prototype.toString.call(e)===`[object Object]`}function qt(e){return new Promise(t=>{Dt.setTimeout(t,e)})}function Jt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ht(e,t)}function Yt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Xt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Zt=Symbol();function Qt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Zt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $t(e,t){return typeof e==`function`?e(...t):!!e}function en(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var tn=(()=>{let e=()=>kt;return{isServer(){return e()},setIsServer(t){e=t}}})();function nn(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function rn(e){let t;if(e.then(e=>(t=e,e),At)?.catch(At),t!==void 0)return{data:t}}function an(e){return e}function on(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??an,o=t.mutations||[],s=t.queries||[];o.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),s.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?rn(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a(f),m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l!==void 0&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l??Date.now(),...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l??Date.now()}});c&&!d&&!h&&!g&&(l===void 0||l>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(At)})}var sn=Ot;function cn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=sn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ln=cn(),un=new class extends wt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function dn(e){return Math.min(1e3*2**e,3e4)}function fn(e){return(e??`online`)!==`online`||un.isOnline()}var pn=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function mn(e){let t=!1,n=0,r,i=nn(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new pn(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Tt.isFocused()&&(e.networkMode===`always`||un.isOnline())&&e.canRun(),u=()=>fn(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(tn.isServer()?0:3),o=e.retryDelay??dn,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),qt(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var hn=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Mt(this.gcTime)&&(this.#e=Dt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Dt.clearTimeout(this.#e),this.#e=void 0)}};function gn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{en(e,()=>t.signal,()=>n=!0)},u=Qt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Xt:Yt;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?vn:_n,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:_n(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function _n(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var yn=class extends hn{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sn(this.options);e.data!==void 0&&(this.setState(xn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Jt(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ft(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Zt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Pt(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Nt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Qt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=mn({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pn&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pn){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ln.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cn=class extends wt{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=nn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tn(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return En(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return En(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Ft(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ut(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dn(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Ft(this.options.enabled,this.#t)!==Ft(t.enabled,this.#t)||Pt(this.options.staleTime,this.#t)!==Pt(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Ft(this.options.enabled,this.#t)!==Ft(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return kn(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(At)),t}#g(){this.#b();let e=Pt(this.options.staleTime,this.#t);if(tn.isServer()||this.#r.isStale||!Mt(e))return;let t=Nt(this.#r.dataUpdatedAt,e)+1;this.#d=Dt.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(tn.isServer()||Ft(this.options.enabled,this.#t)===!1||!Mt(this.#p)||this.#p===0)&&(this.#f=Dt.setInterval(()=>{(this.options.refetchIntervalInBackground||Tt.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Dt.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Dt.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tn(e,t),o=i&&Dn(e,n,t,r);(a||o)&&(l={...l,...bn(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Jt(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Jt(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:On(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ft(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=nn();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ut(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){ln.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function wn(e,t){return Ft(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Ft(t.retryOnMount,e)===!1)}function Tn(e,t){return wn(e,t)||e.state.data!==void 0&&En(e,t,t.refetchOnMount)}function En(e,t,n){if(Ft(t.enabled,e)!==!1&&Pt(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&On(e,t)}return!1}function Dn(e,t,n,r){return(e!==t||Ft(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&On(e,n)}function On(e,t){return Ft(t.enabled,e)!==!1&&e.isStaleByTime(Pt(t.staleTime,e))}function kn(e,t){return!Ut(e.getCurrentResult(),t)}var An=class extends hn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||jn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=mn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ln.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mn=class extends wt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new An({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Nn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ln.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Lt(t,e))}findAll(e={}){return this.getAll().filter(t=>Lt(e,t))}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ln.batch(()=>Promise.all(e.map(e=>e.continue().catch(At))))}};function Nn(e){return e.options.scope?.id}var Pn=class extends wt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ut(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&zt(t.mutationKey)!==zt(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??jn();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ln.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Fn=class extends wt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Rt(r,t),a=this.get(i);return a||(a=new yn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ln.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>It(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>It(e,t)):t}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ln.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ln.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},In=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Fn,this.#t=e.mutationCache||new Mn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Tt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=un.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Pt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=jt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ln.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ln.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ln.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ln.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(At).catch(At)}invalidateQueries(e,t={}){return ln.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ln.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(At)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(At)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Pt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(At).catch(At)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return un.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(zt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Bt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Bt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Rt(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Zt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ln=Symbol(`store-raw`),Rn=Symbol(`store-node`),zn=Symbol(`store-has`),Bn=Symbol(`store-self`);function Vn(e){let t=e[c];if(!t&&(Object.defineProperty(e,c,{value:t=new Proxy(e,Yn)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),i=Object.getPrototypeOf(e),a=i!==null&&typeof e==`object`&&!!e&&!Array.isArray(e)&&i!==Object.prototype;if(a){let e=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(e)),Object.assign(r,e)}for(let i=0,o=n.length;i<o;i++){let o=n[i];a&&o===`constructor`||r[o].get&&Object.defineProperty(e,o,{configurable:!0,enumerable:r[o].enumerable,get:r[o].get.bind(t)})}}return t}function Hn(e){let t;return typeof e==`object`&&!!e&&(e[c]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Un(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Ln])return n;if(!Hn(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=Un(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],!o[a].get&&(i=e[a],(r=Un(i,t))!==i&&(e[a]=r))}return e}function Wn(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Gn(e,t,n){if(e[t])return e[t];let[r,i]=T(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function Kn(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===c||t===Rn?n:(delete n.value,delete n.writable,n.get=()=>e[c][t],n)}function qn(e){oe()&&Gn(Wn(e,Rn),Bn)()}function Jn(e){return qn(e),Reflect.ownKeys(e)}var Yn={get(e,t,n){if(t===Ln)return e;if(t===c)return n;if(t===u)return qn(e),n;let r=Wn(e,Rn),i=r[t],a=i?i():e[t];if(t===Rn||t===zn||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);oe()&&(typeof a!=`function`||Object.prototype.hasOwnProperty.call(e,t))&&!(n&&n.get)&&(a=Gn(r,t,a)())}return Hn(a)?Vn(a):a},has(e,t){return t===Ln||t===c||t===u||t===Rn||t===zn||t===`__proto__`?!0:(oe()&&Gn(Wn(e,zn),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Jn,getOwnPropertyDescriptor:Kn};function Xn(e,t,n,r=!1){if(t===`__proto__`||!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[zn]&&e[zn][t]&&i!==void 0&&e[zn][t].$()):(e[t]=n,e[zn]&&e[zn][t]&&i===void 0&&e[zn][t].$());let o=Wn(e,Rn),s;if((s=Gn(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=Gn(o,`length`,a))&&s.$(e.length)}(s=o[Bn])&&s.$()}function Zn(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];Qn(i)||Xn(e,i,t[i])}}function Qn(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function $n(e,t){if(typeof t==`function`&&(t=t(e)),t=Un(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&Xn(e,n,r)}Xn(e,`length`,r)}else Zn(e,t)}function er(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(a===`string`&&(r===`__proto__`||t.length>1&&Qn(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)er(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&er(e,[i].concat(t),n);return}else if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)er(e,[r].concat(t),n);return}else if(t.length>1){er(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||r===void 0&&a==null||(a=Un(a),r===void 0||Hn(i)&&Hn(a)&&!Array.isArray(a)?Zn(i,a):Xn(e,r,a))}function tr(...[e,t]){let n=Un(e||{}),r=Array.isArray(n),i=Vn(n);function a(...e){A(()=>{r&&e.length===1?$n(n,e[0]):er(n,e)})}return[i,a]}var nr=Symbol(`store-root`);function rr(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function ir(e,t,n,r,i){if(rr(n))return;let a=t[n];if(e===a)return;let o=Array.isArray(e);if(n!==nr&&(!Hn(e)||!Hn(a)||o!==Array.isArray(a)||i&&e[i]!==a[i])){Xn(t,n,e);return}if(o){if(e.length&&a.length&&(!r||i&&e[0]&&e[0][i]!=null)){let t,n,o,s,c,l,u,d;for(o=0,s=Math.min(a.length,e.length);o<s&&(a[o]===e[o]||i&&a[o]&&e[o]&&a[o][i]&&a[o][i]===e[o][i]);o++)ir(e[o],a,o,r,i);let f=Array(e.length),p=new Map;for(s=a.length-1,c=e.length-1;s>=o&&c>=o&&(a[s]===e[c]||i&&a[s]&&e[c]&&a[s][i]&&a[s][i]===e[c][i]);s--,c--)f[c]=a[s];if(o>c||o>s){for(n=o;n<=c;n++)Xn(a,n,e[n]);for(;n<e.length;n++)Xn(a,n,f[n]),ir(e[n],a,n,r,i);a.length>e.length&&Xn(a,`length`,e.length);return}for(u=Array(c+1),n=c;n>=o;n--)l=e[n],d=i&&l?l[i]:l,t=p.get(d),u[n]=t===void 0?-1:t,p.set(d,n);for(t=o;t<=s;t++)l=a[t],d=i&&l?l[i]:l,n=p.get(d),n!==void 0&&n!==-1&&(f[n]=a[t],n=u[n],p.set(d,n));for(n=o;n<e.length;n++)n in f?(Xn(a,n,f[n]),ir(e[n],a,n,r,i)):Xn(a,n,e[n])}else for(let t=0,n=e.length;t<n;t++)ir(e[t],a,t,r,i);a.length>e.length&&Xn(a,`length`,e.length);return}let s=Object.keys(e);for(let t=0,n=s.length;t<n;t++)rr(s[t])||ir(e[s[t]],a,s[t],r,i);let c=Object.keys(a);for(let t=0,n=c.length;t<n;t++)e[c[t]]===void 0&&Xn(a,c[t],void 0)}function ar(e,t={}){let{merge:n,key:r=`id`}=t,i=Un(e);return e=>{if(!Hn(e)||!Hn(i))return i;let t=ir(i,{[nr]:e},nr,n,r);return t===void 0?e:t}}var or=ue(void 0),sr=e=>{if(e)return e;let t=de(or);if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t()},cr=e=>(D(t=>(t?.(),e.client.mount(),e.client.unmount.bind(e.client))),ae(()=>e.client.unmount()),j(or.Provider,{value:()=>e.client,get children(){return e.children}})),lr=ue(()=>!1),ur=()=>de(lr);lr.Provider;function dr(e,t,n,r){if(n===!1)return t;if(typeof n==`function`){let r=n(e.data,t.data);return{...t,data:r}}let i=t.data;if(e.data===void 0)try{i=structuredClone(i)}catch{}let a=ar(i,{key:n})(e.data);return{...t,data:a}}var fr=(e,t)=>t;function pr(e,t,n){let r=k(()=>sr(n?.())),i=ur(),a=k(()=>{let t=r().defaultQueryOptions(e());return t._optimisticResults=i()?`isRestoring`:`optimistic`,t.structuralSharing=!1,t}),o=a(),[s,c]=T(new t(r(),a())),l=s().getOptimisticResult(a()),[u,d]=tr(l),f=()=>s().subscribe(e=>{l=e,queueMicrotask(()=>{h&&v()})});function p(e){let t=s().options,n=t.reconcile;d(r=>dr(r,e,n!==void 0&&n,t.queryHash))}function m(){return[()=>u,e=>{let t=Un(u);if(typeof e==`function`&&(e=e(t)),e?.hydrationData){let{hydrationData:t,...n}=e;e=n}p(e)}]}let h=null,g=null,[_,{refetch:v}]=te(()=>{let e=s();return new Promise((t,n)=>{if(g=t,!h&&!i()&&(h=f()),e.updateResult(),l.isError&&!l.isFetching&&!i()&&$t(e.options.throwOnError,[l.error,e.getCurrentQuery()]))return p(l),n(l.error);if(!l.isLoading)return g=null,t(fr(e.getCurrentQuery(),l));p(l)})},{storage:m,get deferStream(){return e().deferStream},onHydrated(e,t){if(t.value&&`hydrationData`in t.value&&on(r(),{queries:[{...t.value.hydrationData}]}),h)return;let n={...o};(o.staleTime||!o.initialData)&&t.value&&(n.refetchOnMount=!1),s().setOptions(n),p(s().getOptimisticResult(n)),h=f()}});return E(re(r,e=>{h&&h();let n=new t(e,a());h=f(),c(n)},{defer:!0})),E(re(i,e=>{e||v()},{defer:!0})),ae(()=>{h&&=(h(),null),g&&=(g(l),null)}),E(re([s,a],([e,t])=>{e.setOptions(t),p(e.getOptimisticResult(t)),v()},{defer:!0})),new Proxy(u,{get(e,t){return t===`data`?u.data===void 0?_()?.data:_.latest?.data:Reflect.get(e,t)}})}function mr(e,t){return pr(k(()=>e()),Cn,t)}function hr(e,t){let n=new Pn(k(()=>sr(t?.()))(),e()),r=(e,t)=>{n.mutate(e,t).catch(At)},[i,a]=tr({...n.getCurrentResult(),mutate:r,mutateAsync:n.getCurrentResult().mutate});return E(()=>{n.setOptions(e())}),E(re(()=>i.status,()=>{if(i.isError&&$t(n.options.throwOnError,[i.error]))throw i.error})),ae(n.subscribe(e=>{a({...e,mutate:r,mutateAsync:e.mutate})})),i}var gr=class extends In{constructor(e={}){super(e)}},_r=mr,vr=hr,yr,br=t((()=>{yr=typeof chrome<`u`&&!!chrome.runtime?.id&&!!chrome.storage?.local}));function xr(e){for(let t of Fr)t(e)}function Sr(e,t){try{let n=e.getItem(t);return n?JSON.parse(n):null}catch{return null}}async function Cr(){return yr?(await chrome.storage.local.get(jr))[jr]??{}:Sr(localStorage,Nr)??{}}async function wr(e){let t={...await Cr(),...e};return yr?await chrome.storage.local.set({[jr]:t}):(localStorage.setItem(Nr,JSON.stringify(t)),xr(`settings`)),t}async function Tr(){if(yr){let e=(await chrome.storage.session.get(Mr))[Mr]??null;if(!e?.length)return e;let t=await chrome.storage.session.get(e.map(e=>Lr(e.grabbedAt)));return e.map(e=>({...e,screenshotDataUrl:t[Lr(e.grabbedAt)]??void 0}))}let e=Sr(sessionStorage,Pr);return e?.length?e.map(e=>({...e,screenshotDataUrl:sessionStorage.getItem(Lr(e.grabbedAt))??void 0})):e}async function Er(e){let t=e.map(({screenshotDataUrl:e,...t})=>t);if(yr){let n={};for(let t of e)t.screenshotDataUrl&&(n[Lr(t.grabbedAt)]=t.screenshotDataUrl);await chrome.storage.session.set({[Mr]:t,...n})}else{for(let t of e)if(t.screenshotDataUrl)try{sessionStorage.setItem(Lr(t.grabbedAt),t.screenshotDataUrl)}catch{}let n=new Set(t.map(e=>Lr(e.grabbedAt)));for(let e=sessionStorage.length-1;e>=0;e--){let t=sessionStorage.key(e);t?.startsWith(Ir)&&!n.has(t)&&sessionStorage.removeItem(t)}sessionStorage.setItem(Pr,JSON.stringify(t)),xr(`grab`)}}async function Dr(e){let t=[...await Tr()??[]];for(let n of e){let e=t.findIndex(e=>e.grabbedAt===n.grabbedAt);if(e>=0){t[e]={...t[e],...n,screenshotDataUrl:n.screenshotDataUrl??t[e].screenshotDataUrl,source:n.source??t[e].source};continue}let r=e=>`${e.source?.filePath??``}:${e.source?.lineNumber??``}|${e.tagName??``}|${(e.content??``).trim().slice(0,80)}`,i=t[t.length-1];if(n.source?.filePath&&i&&r(i)===r(n)){t[t.length-1]={...i,...n};continue}t.push(n)}await Er(t.slice(-8))}async function Or(e){await Er((await Tr()??[]).filter(t=>t.grabbedAt!==e))}async function kr(){yr?await chrome.storage.session.remove(Mr):(sessionStorage.removeItem(Pr),xr(`grab`))}function Ar(e){if(yr){let t=(t,n)=>{n===`local`&&e(`settings`),n===`session`&&e(`grab`)};return chrome.storage.onChanged.addListener(t),()=>chrome.storage.onChanged.removeListener(t)}return Fr.add(e),()=>Fr.delete(e)}var jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr=t((()=>{br(),jr=`settings`,Mr=`lastGrab`,Nr=`linear-grab:settings`,Pr=`linear-grab:last-grab`,Fr=new Set,Ir=`linear-grab:shot:`,Lr=e=>`${Ir}${e}`}));function zr(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}function Br(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?!0:Array.isArray(e)?e.every(Br):typeof e==`object`&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Br(t)))}function Vr(e){return Array.isArray(e)&&e.every(Br)}function Hr(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Br(t)))}var Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma=t((()=>{Ur=`vercel.ai.error`,Wr=Symbol.for(Ur),qr=class e extends (Kr=Error,Gr=Wr,Kr){constructor({name:e,message:t,cause:n}){super(t),this[Gr]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Ur)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},Jr=`AI_APICallError`,Yr=`vercel.ai.error.${Jr}`,Xr=Symbol.for(Yr),$r=class extends (Qr=qr,Zr=Xr,Qr){constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=r!=null&&(r===408||r===409||r===429||r>=500),data:c}){super({name:Jr,message:e,cause:o}),this[Zr]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=c}static isInstance(e){return qr.hasMarker(e,Yr)}},ei=`AI_EmptyResponseBodyError`,ti=`vercel.ai.error.${ei}`,ni=Symbol.for(ti),ai=class extends (ii=qr,ri=ni,ii){constructor({message:e=`Empty response body`}={}){super({name:ei,message:e}),this[ri]=!0}static isInstance(e){return qr.hasMarker(e,ti)}},oi=`AI_InvalidArgumentError`,si=`vercel.ai.error.${oi}`,ci=Symbol.for(si),di=class extends (ui=qr,li=ci,ui){constructor({message:e,cause:t,argument:n}){super({name:oi,message:e,cause:t}),this[li]=!0,this.argument=n}static isInstance(e){return qr.hasMarker(e,si)}},fi=`AI_InvalidPromptError`,pi=`vercel.ai.error.${fi}`,mi=Symbol.for(pi),_i=class extends (gi=qr,hi=mi,gi){constructor({prompt:e,message:t,cause:n}){super({name:fi,message:`Invalid prompt: ${t}`,cause:n}),this[hi]=!0,this.prompt=e}static isInstance(e){return qr.hasMarker(e,pi)}},vi=`AI_InvalidResponseDataError`,yi=`vercel.ai.error.${vi}`,bi=Symbol.for(yi),Ci=class extends (Si=qr,xi=bi,Si){constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:vi,message:t}),this[xi]=!0,this.data=e}static isInstance(e){return qr.hasMarker(e,yi)}},wi=`AI_JSONParseError`,Ti=`vercel.ai.error.${wi}`,Ei=Symbol.for(Ti),ki=class extends (Oi=qr,Di=Ei,Oi){constructor({text:e,cause:t}){super({name:wi,message:`JSON parsing failed: Text: ${e}.
|
|
2
2
|
Error message: ${zr(t)}`,cause:t}),this[Di]=!0,this.text=e}static isInstance(e){return qr.hasMarker(e,Ti)}},Ai=`AI_LoadAPIKeyError`,ji=`vercel.ai.error.${Ai}`,Mi=Symbol.for(ji),Fi=class extends (Pi=qr,Ni=Mi,Pi){constructor({message:e}){super({name:Ai,message:e}),this[Ni]=!0}static isInstance(e){return qr.hasMarker(e,ji)}},Ii=`AI_LoadSettingError`,`${Ii}`,Li=`AI_NoContentGeneratedError`,`${Li}`,Ri=`AI_NoSuchModelError`,zi=`vercel.ai.error.${Ri}`,Bi=Symbol.for(zi),Ui=class extends (Hi=qr,Vi=Bi,Hi){constructor({errorName:e=Ri,modelId:t,modelType:n,message:r=`No such ${n}: ${t}`}){super({name:e,message:r}),this[Vi]=!0,this.modelId=t,this.modelType=n}static isInstance(e){return qr.hasMarker(e,zi)}},Wi=`AI_NoSuchProviderReferenceError`,Gi=`vercel.ai.error.${Wi}`,Ki=Symbol.for(Gi),Yi=class extends (Ji=qr,qi=Ki,Ji){constructor({provider:e,reference:t,message:n=`No provider reference found for provider '${e}'. Available providers: ${Object.keys(t).join(`, `)}`}){super({name:Wi,message:n}),this[qi]=!0,this.provider=e,this.reference=t}static isInstance(e){return qr.hasMarker(e,Gi)}},Xi=`AI_TooManyEmbeddingValuesForCallError`,Zi=`vercel.ai.error.${Xi}`,Qi=Symbol.for(Zi),ta=class extends (ea=qr,$i=Qi,ea){constructor(e){super({name:Xi,message:`Too many values for a single embedding call. The ${e.provider} model "${e.modelId}" can only embed up to ${e.maxEmbeddingsPerCall} values per call, but ${e.values.length} values were provided.`}),this[$i]=!0,this.provider=e.provider,this.modelId=e.modelId,this.maxEmbeddingsPerCall=e.maxEmbeddingsPerCall,this.values=e.values}static isInstance(e){return qr.hasMarker(e,Zi)}},na=`AI_TypeValidationError`,ra=`vercel.ai.error.${na}`,ia=Symbol.for(ra),sa=class e extends (oa=qr,aa=ia,oa){constructor({value:e,cause:t,context:n}){let r=`Type validation failed`;if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=` (`;let e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(`, `),r+=`)`}super({name:na,message:`${r}: Value: ${JSON.stringify(e)}.
|
|
3
3
|
Error message: ${zr(t)}`,cause:t}),this[aa]=!0,this.value=e,this.context=n}static isInstance(e){return qr.hasMarker(e,ra)}static wrap({value:t,cause:n,context:r}){return e.isInstance(n)&&n.value===t&&n.context?.field===r?.field&&n.context?.entityName===r?.entityName&&n.context?.entityId===r?.entityId?n:new e({value:t,cause:n,context:r})}},ca=`AI_UnsupportedFunctionalityError`,la=`vercel.ai.error.${ca}`,ua=Symbol.for(la),pa=class extends (fa=qr,da=ua,fa){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:ca,message:t}),this[da]=!0,this.functionality=e}static isInstance(e){return qr.hasMarker(e,la)}}}));function F(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(let e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}function ha(e){return e&&Object.assign(_a,e),_a}var ga,_a,va=t((()=>{Object.freeze({status:`aborted`}),ga=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},_a={}}));function ya(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ba(e,t){return typeof t==`bigint`?t.toString():t}function xa(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Sa(e){return e==null}function Ca(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function wa(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}function Ta(e,t,n){Object.defineProperty(e,t,{get(){{let r=n();return e[t]=r,r}throw Error(`cached value already set`)},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ea(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Da(e){return JSON.stringify(e)}function Oa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ka(e){if(Oa(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Oa(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Aa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ja(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Ma(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Na(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function Pa(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=r.shape[e])}return ja(e,{...e._zod.def,shape:n,checks:[]})}function Fa(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return ja(e,{...e._zod.def,shape:n,checks:[]})}function Ia(e,t){if(!ka(t))throw Error(`Invalid input to extend: expected a plain object`);return ja(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return Ea(this,`shape`,n),n},checks:[]})}function La(e,t){return ja(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ea(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function Ra(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ja(t,{...t._zod.def,shape:i,checks:[]})}function za(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ja(t,{...t._zod.def,shape:i,checks:[]})}function Ba(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Va(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ha(e){return typeof e==`string`?e:e?.message}function Ua(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Ha(e.inst?._zod.def?.error?.(e))??Ha(t?.error?.(e))??Ha(n.customError?.(e))??Ha(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Wa(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ga(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ka,qa,Ja,Ya,Xa=t((()=>{Ka=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{},qa=xa(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),Ja=new Set([`string`,`number`,`symbol`]),Ya={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function Za(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Qa(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i<t.path.length;){let r=t.path[i];i===t.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(n(t))):e[r]=e[r]||{_errors:[]},e=e[r],i++}}};return i(e),r}var $a,eo,to,no=t((()=>{va(),Xa(),$a=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,ba,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eo=F(`$ZodError`,$a),to=F(`$ZodError`,$a,{Parent:Error})})),ro,io,ao,oo,so,co,lo=t((()=>{va(),no(),Xa(),ro=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new ga;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ua(e,a,ha())));throw Ka(t,i?.callee),t}return o.value},io=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ua(e,a,ha())));throw Ka(t,i?.callee),t}return o.value},ao=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ga;return a.issues.length?{success:!1,error:new(e??eo)(a.issues.map(e=>Ua(e,i,ha())))}:{success:!0,data:a.value}},oo=ao(to),so=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Ua(e,i,ha())))}:{success:!0,data:a.value}},co=so(to)}));function uo(){return new RegExp(To,`u`)}function fo(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function po(e){return RegExp(`^${fo(e)}$`)}function mo(e){let t=fo({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Po}T(?:${r})$`)}var ho,go,_o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo=t((()=>{ho=/^[cC][^\s-]{8,}$/,go=/^[0-9a-z]+$/,_o=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,vo=/^[0-9a-vA-V]{20}$/,yo=/^[A-Za-z0-9]{27}$/,bo=/^[a-zA-Z0-9_-]{21}$/,xo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,So=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Co=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,wo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,To=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Eo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Do=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Oo=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ko=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ao=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jo=/^[A-Za-z0-9_-]*$/,Mo=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,No=/^\+(?:[0-9]){6,14}[0-9]$/,Po=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Fo=RegExp(`^${Po}$`),Io=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Lo=/^\d+$/,Ro=/^-?\d+(?:\.\d+)?/i,zo=/true|false/i,Bo=/null/i,Vo=/^[^A-Z]*$/,Ho=/^[^a-z]*$/})),Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss=t((()=>{va(),Uo(),Xa(),Wo=F(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Go={number:`number`,bigint:`bigint`,object:`date`},Ko=F(`$ZodCheckLessThan`,(e,t)=>{Wo.init(e,t);let n=Go[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qo=F(`$ZodCheckGreaterThan`,(e,t)=>{Wo.init(e,t);let n=Go[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jo=F(`$ZodCheckMultipleOf`,(e,t)=>{Wo.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):wa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Yo=F(`$ZodCheckNumberFormat`,(e,t)=>{Wo.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ya[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Lo)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),Xo=F(`$ZodCheckMaxLength`,(e,t)=>{var n;Wo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Sa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Wa(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Zo=F(`$ZodCheckMinLength`,(e,t)=>{var n;Wo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Sa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Wa(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Qo=F(`$ZodCheckLengthEquals`,(e,t)=>{var n;Wo.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Sa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Wa(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),$o=F(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Wo.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),es=F(`$ZodCheckRegex`,(e,t)=>{$o.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ts=F(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Vo,$o.init(e,t)}),ns=F(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ho,$o.init(e,t)}),rs=F(`$ZodCheckIncludes`,(e,t)=>{Wo.init(e,t);let n=Aa(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),is=F(`$ZodCheckStartsWith`,(e,t)=>{Wo.init(e,t);let n=RegExp(`^${Aa(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),as=F(`$ZodCheckEndsWith`,(e,t)=>{Wo.init(e,t);let n=RegExp(`.*${Aa(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),os=F(`$ZodCheckOverwrite`,(e,t)=>{Wo.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),cs,ls=t((()=>{cs=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
4
4
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
@@ -212,12 +212,12 @@ of the other sections.`,pD="- FIRST, self-orient in the repo checkout (skip any
|
|
|
212
212
|
`),entries:i}:null},xY=(e,t,n)=>{if(e?.entries)return t===e.content?e.entries:e.entries.length===1?[{...e.entries[0],content:t,commentText:n}]:e.entries.map(e=>({...e,commentText:n}))},SY=async(e,t,n,r)=>{await t.onBeforeCopy(n);let i=!1,a=``;try{let o=e.getContent?{content:await e.getContent(n)}:await bY(n,e.maxContextLines),s=o?.content;if(s?.trim()){let c=await t.transformCopyContent(s,n);a=r?`${r}\n${c}`:c,i=WU(a,{componentName:e.componentName,entries:xY(o,a,r)})}}catch(e){t.onCopyError(_Y(e))}return i&&t.onCopySuccess(n,a),t.onAfterCopy(n,i),i},CY=(e,t)=>{let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return Math.max(0,i-n)*Math.max(0,a-r)},wY=(e,t)=>e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top,TY=e=>e.sort((e,t)=>{if(e===t)return 0;let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0}),EY=e=>{if(e.width<=0||e.height<=0)return[];let t=window.innerWidth,n=window.innerHeight,r=e.x,i=e.y,a=e.x+e.width,o=e.y+e.height,s=r+e.width/2,c=i+e.height/2,l=yB(Math.ceil(e.width/32),3,20),u=yB(Math.ceil(e.height/32),3,20),d=l*u,f=d>100?Math.sqrt(100/d):1,p=yB(Math.floor(l*f),3,20),m=yB(Math.floor(u*f),3,20),h=new Set,g=[],_=(e,r)=>{let i=yB(Math.round(e),0,t-1),a=yB(Math.round(r),0,n-1),o=`${i}:${a}`;h.has(o)||(h.add(o),g.push({x:i,y:a}))};_(r+1,i+1),_(a-1,i+1),_(r+1,o-1),_(a-1,o-1),_(s,i+1),_(s,o-1),_(r+1,c),_(a-1,c),_(s,c);for(let t=0;t<p;t+=1){let n=r+(t+.5)/p*e.width;for(let t=0;t<m;t+=1)_(n,i+(t+.5)/m*e.height)}return g},DY=(e,t,n)=>{let r={left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height},i=new Set,a=EY(e);uI();try{for(let e of a){let t=document.elementsFromPoint(e.x,e.y);for(let e of t)i.add(e)}}finally{dI()}let o=[];for(let e of i)!n&&qF(e)||TM(e)&&t(e)&&o.push(e);let s=new Map;for(let e of o)s.set(e,e.getBoundingClientRect());let c=[];for(let e of o){let t=s.get(e);if(t.width<=0||t.height<=0)continue;let i={left:t.left,top:t.top,right:t.left+t.width,bottom:t.top+t.height};if(n){let n=CY(r,i),a=t.width*t.height;a>0&&n/a>=.75&&c.push(e)}else wY(i,r)&&c.push(e)}return TY(c)},OY=e=>{let t=new Set(e);return e.filter(e=>{for(let n=e.parentElement;n;n=n.parentElement)if(t.has(n))return!1;return!0})},kY=(e,t,n=!0)=>OY(DY(e,t,n)),AY=(e,t)=>e.width<=0?0:yB((t.x-e.x)/e.width,0,1),jY=()=>{zJ(),xI(),nI()},MY=e=>({borderRadius:`0px`,height:e.height,width:e.width,x:e.pageX-window.scrollX,y:e.pageY-window.scrollY}),NY=e=>({pageX:e.x+window.scrollX,pageY:e.y+window.scrollY,width:e.width,height:e.height}),PY=e=>({borderRadius:`0px`,height:e.height,width:e.width,x:e.x,y:e.y}),FY=(e,t,n)=>{let r=(e,t,n,r)=>{let i=[],a=e,o=0;for(;a&&i.length<n&&o<100;)r(a)&&i.push(a),a=t(a),o+=1;return i},i=r(e.parentElement,e=>e.parentElement,6,t);i.reverse();let a=i.map((e,t)=>({element:e,depth:t,isLast:!0})),o=i.length,s=r(e.previousElementSibling,e=>e.previousElementSibling,7,n),c=r(e.nextElementSibling,e=>e.nextElementSibling,7,n),l=Math.min(s.length,Math.max(3,7-c.length)),u=Math.min(c.length,7-l),d=[...s.slice(0,l).reverse(),e,...c.slice(0,u)],f=r(e.firstElementChild,e=>e.nextElementSibling,6,t),p=d.length-1,m=f.length-1;return d.forEach((t,n)=>{a.push({element:t,depth:o,isLast:n===p}),t===e&&f.forEach((e,t)=>{a.push({element:e,depth:o+1,isLast:t===m})})}),a},IY=e=>e instanceof SVGElement&&!(e instanceof SVGSVGElement),LY=e=>{let t=e.getBoundingClientRect();return t.width>=16||t.height>=16},RY=(e,t)=>t(e)&&!IY(e)&&LY(e),zY=new Set([`c`,`C`,`с`,`С`,`ȼ`,`Ȼ`,`ↄ`,`Ↄ`,`ᴄ`,`ᶜ`,`ⱼ`,`ⅽ`,`Ⅽ`,`ç`,`Ç`,`ć`,`Ć`,`č`,`Č`,`ĉ`,`Ĉ`,`ċ`,`Ċ`]),BY=(e,t)=>t===`KeyC`?!0:!e||e.length!==1?!1:zY.has(e),VY=(e,t)=>{if(!e||!t)return!1;let n=e.toLowerCase();return t===`Space`?n===`space`||n===` `:t.startsWith(`Key`)?t.slice(3).toLowerCase()===n:t.startsWith(`Digit`)?t.slice(5)===n:!1},HY={meta:`metaKey`,cmd:`metaKey`,command:`metaKey`,win:`metaKey`,windows:`metaKey`,ctrl:`ctrlKey`,control:`ctrlKey`,shift:`shiftKey`,alt:`altKey`,option:`altKey`,opt:`altKey`},UY=e=>{let t=e.split(`+`).map(e=>e.trim().toLowerCase()),n={metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1,key:null};for(let e of t){let t=HY[e];t?n[t]=!0:n.key=e}return n},WY=e=>{if(typeof e==`function`)return e;let t=UY(e),n=t.key;return e=>{if(n===null){let n=!t.metaKey||e.metaKey||e.key===`Meta`,r=!t.ctrlKey||e.ctrlKey||e.key===`Control`,i=!t.shiftKey||e.shiftKey||e.key===`Shift`,a=!t.altKey||e.altKey||e.key===`Alt`,o=n&&r&&i&&a,s=[t.metaKey,t.ctrlKey,t.shiftKey,t.altKey].filter(Boolean).length,c=[e.metaKey||e.key===`Meta`,e.ctrlKey||e.key===`Control`,e.shiftKey||e.key===`Shift`,e.altKey||e.key===`Alt`].filter(Boolean).length;return o&&c>=s}let r=e.key?.toLowerCase()===n||VY(n,e.code),i=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?(!t.metaKey||e.metaKey)&&(!t.ctrlKey||e.ctrlKey)&&(!t.shiftKey||e.shiftKey)&&(!t.altKey||e.altKey):!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey;return r&&i}},GY=e=>!e||typeof e==`function`?{metaKey:SB(),ctrlKey:!SB(),shiftKey:!1,altKey:!1,key:null}:UY(e),KY=(e,t)=>{if(t.activationKey)return WY(t.activationKey)(e);let n=(SB()?e.metaKey:e.ctrlKey)&&!e.shiftKey&&!e.altKey;return!!(e.key&&n&&BY(e.key,e.code))},qY=e=>{if(e.length===0)return{x:0,y:0,width:0,height:0};if(e.length===1)return e[0];let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.width),i=Math.max(i,a.y+a.height);return{x:t,y:n,width:r-t,height:i-n}},JY=e=>{let t=getComputedStyle(e),n={};for(let e of wB)n[e]=t.getPropertyValue(e);return n},YY=e=>{let t={};for(let n of WB)t[n]=e.getPropertyValue(n);return t},XY=e=>{try{let t=e.parentElement;if(!t)return null;let n=e.namespaceURI,r=e.tagName.toLowerCase(),i=n&&n!==`http://www.w3.org/1999/xhtml`?e.ownerDocument.createElementNS(n,r):e.ownerDocument.createElement(r),a=`style`in i?i.style:null;a instanceof CSSStyleDeclaration&&a.setProperty(`display`,`none`,`important`),t.appendChild(i);try{return YY(getComputedStyle(i))}finally{i.remove()}}catch{return null}},ZY=new Set([`display`,`width`,`height`]),QY=(e,t,n)=>e.kind===`color`?!1:e.cssProperties.some(e=>ZY.has(e))?$Y(e):e.cssProperties.every(e=>{let r=t[e],i=n[e];return r===void 0||i===void 0?!1:r===i}),$Y=e=>{if(e.kind===`color`)return!1;if(e.kind===`enum`)return e.key===`font-weight`?e.original===`400`:e.options[0]?.value===e.original;let{key:t,original:n}=e;return t.startsWith(`padding`)||t.startsWith(`margin`)||t.includes(`gap`)||t===`border-width`||t.endsWith(`-radius`)||t===`border-radius`?n===0:t===`opacity`?n===100:t===`letter-spacing`||t===`z-index`?n===0:!IB.has(t)&&!!(t===`width`||t===`height`||t===`width,height`||t.startsWith(`max-`)||t.startsWith(`min-`)||t===`line-height`)},eX=e=>{let t=e.trim();if(!t||t===`auto`||t===`normal`||t===`none`)return null;let n=Number.parseFloat(t);return Number.isFinite(n)?t.endsWith(`%`)?{value:n,unit:`%`}:t.endsWith(`rem`)||t.endsWith(`em`)?{value:n*16,unit:`px`}:t.endsWith(`px`)?{value:n,unit:`px`}:{value:n,unit:``}:null},tX=(e,t)=>{let n=eX(e[t]);if(n)return n;if(t===`line-height`){let t=eX(e[`font-size`]);return t?{value:JB(t.value*CN),unit:t.unit||`px`}:null}return kB.has(t)?{value:0,unit:`px`}:null},nX=(e,t)=>{let n=tX(e,t[0]);if(!n)return null;for(let r=1;r<t.length;r++){let i=tX(e,t[r]);if(!i||i.unit!==n.unit||Math.abs(i.value-n.value)>=.5)return null}return n},rX=(e,t)=>e===`opacity`?{value:Math.round(t.value*100),unit:`%`}:AB.has(e)?{value:JB(t.value),unit:``}:{value:JB(t.value),unit:t.unit||`px`},iX=e=>e!==null,aX=(e,t)=>{let n=t.map(t=>{let n=t.longhands.length===1?tX(e,t.longhands[0]):nX(e,t.longhands);return n?{definition:t,value:n}:null}).filter(iX),r=new Map;for(let e of n)for(let t of e.definition.longhands){let n=r.get(t);(!n||e.definition.longhands.length>n.definition.longhands.length)&&r.set(t,e)}let i=new Set(r.values());return n.map(e=>({...e,isCanonical:i.has(e)}))},oX=(e,t,n)=>e===`opacity`?{min:0,max:100}:e===`z-index`?{min:DB,max:OB}:e===`letter-spacing`?{min:-10,max:20}:e===`font-size`?{min:8,max:96}:e===`line-height`?{min:0,max:120}:e.includes(`radius`)?{min:0,max:96}:e===`width`||e===`height`||e===`width,height`||e.startsWith(`min-`)||e.startsWith(`max-`)?{min:0,max:Math.max(512,Math.ceil(t*2))}:IB.has(e)?{min:EB,max:512}:n===`%`?{min:0,max:100}:{min:e.startsWith(`margin`)?TB:0,max:384},sX=(e,t,n)=>{let r=rX(e.key,t),i=r.unit===`px`&&Math.abs(r.value)>1e7,a=oX(e.key,i?0:r.value,r.unit),o=r.value<0?a.min:a.max,s=i?o:r.value;return{kind:`numeric`,key:e.key,label:e.label,cssProperties:e.longhands,min:a.min,max:a.max,value:s,original:s,unit:r.unit,tailwindAliases:SV(e.key),isPrioritized:!1,isDefault:!1,isCanonical:n}},cX=(e,t,n,r=!1)=>{let i=vB(n),a=i?rB(i):null,o=a!==null&&a.alpha!==0;if(!o&&!r)return null;let s=o&&i?i:pN;return{kind:`color`,key:e,label:t,cssProperties:[e],value:s,original:s,tailwindAliases:SV(e),isPrioritized:r,isDefault:!1,isCanonical:!0}},lX=(e,t,n)=>{let r=t.trim(),i=n??e.options;return!i||!i.some(e=>e.value===r)?null:{kind:`enum`,key:e.key,label:e.label,cssProperties:[e.key],value:r,original:r,options:i,tailwindAliases:SV(e.key),isPrioritized:!1,isDefault:!1,isCanonical:!0}},uX=new Map(`background-color.color.padding.padding-left,padding-right.padding-top,padding-bottom.padding-top.padding-right.padding-bottom.padding-left.margin.margin-left,margin-right.margin-top,margin-bottom.margin-top.margin-right.margin-bottom.margin-left.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-transform.text-align.text-decoration-line.white-space.word-break.overflow-wrap.font-variant-numeric.border-radius.border-top-left-radius,border-top-right-radius.border-bottom-left-radius,border-bottom-right-radius.border-top-left-radius,border-bottom-left-radius.border-top-right-radius,border-bottom-right-radius.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.width,height.width.height.max-width.max-height.min-width.min-height.opacity.gap.row-gap.column-gap.border-width.border-top-width.border-right-width.border-bottom-width.border-left-width.border-color.align-items.justify-content.top,right,bottom,left.left,right.top,bottom.top.right.bottom.left.z-index`.split(`.`).map((e,t)=>[e,t])),dX=e=>uX.get(e.key)??1/0,fX=e=>e.map((e,t)=>({property:e,index:t})).sort((e,t)=>{let n=dX(e.property)-dX(t.property);return n===0?e.index-t.index:n}).map(e=>e.property),pX=e=>{let t=JY(e),n=getComputedStyle(e),r=YY(n),i=XY(e),a=[],o=new Set,s=e=>{o.has(e.key)||(a.push(e),o.add(e.key))};for(let e of LB)for(let n of aX(t,e))s(sX(n.definition,n.value,n.isCanonical));for(let e of RB){let n=tX(t,e.key);n&&s(sX({key:e.key,label:e.label,longhands:[e.key]},n,!0))}for(let{key:e,label:t,alwaysShow:r}of zB){let i=n.getPropertyValue(e);if(!r&&(!i||aB(i)))continue;let a=cX(e,t,i,r);a&&s(a)}let c=n.getPropertyValue(HB.key);if(c){let e=lX(HB,c,VB(c));e&&s(e)}for(let e of UB){let t=n.getPropertyValue(e.key);if(!t)continue;let r=lX(e,t);r&&s(r)}return mX(a,xV(e),r,i)},mX=(e,t,n,r)=>{let i=[],a=[];for(let o of e)if(o.isPrioritized||t.has(o.key))i.push({...o,isPrioritized:!0,isDefault:!1});else{let e=r?QY(o,n,r):$Y(o);a.push({...o,isDefault:e})}return[...fX(i),...fX(a)]},hX=[{keyword:`letter`,family:`letter-spacing`},{keyword:`tracking`,family:`letter-spacing`},{keyword:`leading`,family:`line-height`},{keyword:`line-height`,family:`line-height`},{keyword:`lineheight`,family:`line-height`},{keyword:`radius`,family:`radius`},{keyword:`rounded`,family:`radius`},{keyword:`corner`,family:`radius`},{keyword:`font-size`,family:`font-size`},{keyword:`fontsize`,family:`font-size`},{keyword:`text`,family:`font-size`},{keyword:`stroke`,family:`border-width`},{keyword:`border-width`,family:`border-width`},{keyword:`borderwidth`,family:`border-width`},{keyword:`space`,family:`spacing`},{keyword:`gap`,family:`spacing`},{keyword:`gutter`,family:`spacing`},{keyword:`inset`,family:`spacing`},{keyword:`padding`,family:`spacing`},{keyword:`margin`,family:`spacing`},{keyword:`size`,family:`size`},{keyword:`width`,family:`size`},{keyword:`height`,family:`size`}],gX=e=>{let t=e.toLowerCase();for(let{keyword:e,family:n}of hX)if(t.includes(e))return n;return null},_X=e=>e.includes(`radius`)?`radius`:e.endsWith(`-width`)&&e.includes(`border`)?`border-width`:e===`font-size`?`font-size`:e===`line-height`?`line-height`:e===`letter-spacing`?`letter-spacing`:e.startsWith(`padding`)||e.startsWith(`margin`)||e.endsWith(`gap`)||e===`top`||e===`right`||e===`bottom`||e===`left`||e.startsWith(`inset`)?`spacing`:e===`width`||e===`height`||e.startsWith(`min-`)||e.startsWith(`max-`)?`size`:null,vX=e=>{let t=eX(e);return!t||t.unit!==`px`?null:JB(t.value)},yX=(e,t)=>t===null?!0:e.length===t.length?e<t:e.length<t.length,bX=(e,t,n)=>{if(n===1){for(let n of e)if(n>t)return n;return null}for(let n=e.length-1;n>=0;n--)if(e[n]<t)return e[n];return null},xX=(e,t,n)=>{let r=(t===1?Math.floor(e/n)+1:Math.ceil(e/n)-1)*n;return r<0?null:r},SX=null,CX=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),wX=()=>{let e=Array.from(document.adoptedStyleSheets??[]),t=document.styleSheets.length;if(SX&&SX.documentSheetCount===t&&CX(SX.adoptedSheets,e))return SX.names;let n=new Set;for(let t of[...document.styleSheets,...e]){let e;try{e=t.cssRules}catch{continue}TX(e,n)}return SX={documentSheetCount:t,adoptedSheets:e,names:n},n},TX=(e,t)=>{for(let n of Array.from(e))if(n instanceof CSSStyleRule){let e=n.style;for(let n=0;n<e.length;n++){let r=e.item(n);r.startsWith(`--`)&&t.add(r)}}else n instanceof CSSGroupingRule&&TX(n.cssRules,t)},EX={hasTokens:!1,matchColor:()=>null,matchLength:()=>null,stepLength:()=>null},DX=e=>{if(typeof document>`u`)return EX;let t=wX();if(t.size===0)return EX;let n=getComputedStyle(e),r=new Map,i=new Map,a=new Map,o=null;for(let e of t){let t=n.getPropertyValue(e).trim();if(!t)continue;let s=vX(t);if(s!==null){e===`--spacing`&&s>0&&(o=s);let t=gX(e);if(t!==null){let n=i.get(s);n?n.push({name:e,family:t}):i.set(s,[{name:e,family:t}]);let r=a.get(t);r?r.add(s):a.set(t,new Set([s]))}continue}let c=vB(t);if(c){let t=c.toLowerCase();yX(e,r.get(t)??null)&&r.set(t,e)}}if(r.size===0&&i.size===0)return EX;let s=new Map;for(let[e,t]of a)s.set(e,Array.from(t).sort((e,t)=>e-t));return{hasTokens:!0,matchColor:e=>{let t=vB(e)?.toLowerCase();return t?r.get(t)??null:null},matchLength:(e,t)=>{let n=_X(t);if(n===null)return null;let r=i.get(Math.round(e));if(!r)return null;let a=null;for(let e of r)e.family===n&&yX(e.name,a)&&(a=e.name);return a},stepLength:(e,t,n)=>{let r=_X(n);if(r===null)return null;let i=Math.round(e),a=s.get(r);return a&&a.length>=2?bX(a,i,t):(r===`spacing`||r===`size`)&&o?xX(i,t,o):a?bX(a,i,t):null}}},OX=e=>e.kind===`color`||e.kind===`enum`?e.value:e.key===`opacity`&&e.unit===`%`?qB(e.value/100):`${qB(e.value)}${e.unit}`,kX=(e,t,n)=>{if(!n?.hasTokens)return null;let{edit:r}=t;return r.kind===`color`?n.matchColor(r.value):r.kind===`numeric`&&r.unit===`px`?n.matchLength(r.value,e):null},AX=e=>{let t=new Map;for(let n of e.edits){let e=OX(n);for(let r of n.cssProperties)t.set(r,{edit:n,cssValue:e})}let n=!1;return{lines:Array.from(t,([t,r])=>{let i=kX(t,r,e.designTokens);i&&(n=!0);let a=i?` /* var(${i}) */`:``;return`${t}: ${r.cssValue};${a}`}),usesToken:n}},jX=e=>e.filePath?`${e.filePath}:${e.lineNumber}`:``,MX=e=>["```css",...e,"```"].join(`
|
|
213
213
|
`),NX=e=>{if(e.length===0)return``;let t=e.map(e=>{let{lines:t,usesToken:n}=AX(e);return{header:jX(e),cssLines:t,usesToken:n}}),n=[`Apply these style changes canonically (CSS = visual intent; choose the source change that best expresses the underlying layout intent):`];if(t.some(e=>e.usesToken)&&n.push("Prefer the design token shown in each `/* var(--token) */` comment over the raw value when it matches the project's intent."),t.length===1){let[e]=t;return e.header&&n.push(`\n${e.header}`),n.push(MX(e.cssLines)),n.join(`
|
|
214
214
|
`)}for(let e of t)n.push(e.header?`\n${e.header}`:``),n.push(MX(e.cssLines));return n.join(`
|
|
215
|
-
`)},PX=e=>`style`in e&&e.style instanceof CSSStyleDeclaration,FX=e=>{let t=new Map,n=PX(e)?e:null;return{apply:(e,r)=>{if(n)for(let i of e)t.has(i)||t.set(i,{value:n.style.getPropertyValue(i),priority:n.style.getPropertyPriority(i)}),n.style.setProperty(i,r)},restore:()=>{if(!n){t.clear();return}for(let[e,{value:r,priority:i}]of t)r?n.style.setProperty(e,r,i):n.style.removeProperty(e);t.clear()},hasAppliedStyles:()=>t.size>0}},IX=(e,t)=>{for(let n of t){let t=e.edits.findIndex(e=>e.key===n.key);t>=0?e.edits[t]=n:e.edits.push(n)}},LX=(e,t)=>({element:e.element,preview:e.preview,filePath:e.filePath??``,lineNumber:e.lineNumber??0,edits:t,designTokens:e.designTokens}),RX=e=>{let[t,n]=J(null),[r,i]=J(!1),a=[],o=[],s=e=>{o=e},c=()=>{let r=t()!==null;n(null),i(!1),a=[],o=[],r&&e.onClose?.()},l=()=>{t()?.preview.restore();for(let e=a.length-1;e>=0;e--)a[e].preview.restore();c()},u=e=>{bU(e).then(t=>{t&&n(n=>!n||n.element!==e||n.componentName?n:{...n,componentName:t})})},d=(r,i,a={})=>{if(t()!==null)return!1;let o=pX(r);if(o.length===0)return!1;let s=a.filePath??e.store.selectionFilePath??void 0,c=a.lineNumber??e.store.selectionLineNumber??void 0;return n({element:r,position:i,selectionBounds:VJ(r),properties:o,preview:FX(r),filePath:s,lineNumber:c,componentName:a.componentName,tagName:a.tagName??TN(r),initialSearchQuery:a.initialSearchQuery,designTokens:DX(r)}),u(r),e.isActivated()||e.activateRenderer(),e.actions.setPointer(i),e.actions.setFrozenElement(r),e.actions.freeze(),e.onOpen?.(),!0},f=(r,i)=>{let s=t();if(!s||s.element===r)return!1;let c=pX(r);return c.length===0?!1:((o.length>0||s.preview.hasAppliedStyles())&&a.push(LX(s,o)),o=[],n({element:r,position:i,selectionBounds:VJ(r),properties:c,preview:FX(r),tagName:TN(r),hasSessionEdits:a.some(e=>e.edits.length>0),designTokens:DX(r)}),DU(r).then(e=>{if(e){for(let t of a)t.element===r&&!t.filePath&&(t.filePath=e.filePath,t.lineNumber=e.lineNumber??0);n(t=>!t||t.element!==r||t.filePath?t:{...t,filePath:e.filePath,lineNumber:e.lineNumber??void 0})}}).catch(()=>void 0),u(r),e.actions.setPointer(i),e.actions.setFrozenElement(r),!0)},p=(e,t)=>[...a,LX(e,t)],m=e=>{let t=new Map;for(let n of e){if(n.edits.length===0)continue;let e=t.get(n.element);if(e){!e.filePath&&n.filePath&&(e.filePath=n.filePath,e.lineNumber=n.lineNumber),IX(e,n.edits);continue}t.set(n.element,{filePath:n.filePath,lineNumber:n.lineNumber,edits:[...n.edits],designTokens:n.designTokens})}return Array.from(t.values())},h=e=>{let t=new Set;for(let n of e)n.edits.length>0&&t.add(n.element);for(let n=e.length-1;n>=0;n--){let r=e[n];r.edits.length===0&&!t.has(r.element)&&r.preview.restore()}};return{state:t,trigger:d,switchToElement:f,setPendingEdits:s,dismiss:()=>{t()!==null&&(l(),e.store.wasActivatedByToggle?e.deactivateRenderer():e.actions.unfreeze())},closePreservingRenderer:()=>{t()!==null&&(l(),e.actions.unfreeze())},submit:n=>{let r=t();if(!r)return;let i=r.element,a=p(r,n),o=NX(m(a));h(a),c(),e.store.wasActivatedByToggle||e.actions.unfreeze(),e.performCopyWithLabel({element:i,cursorX:r.position.x,extraPrompt:o||void 0,shouldDeactivateAfter:e.store.wasActivatedByToggle})},resetWithDiscard:l,isOpen:()=>t()!==null,isInteracting:r,setInteracting:i}},zX={enabled:!0,hue:0,selectionBox:{enabled:!0},dragBox:{enabled:!0},grabbedBoxes:{enabled:!0},elementLabel:{enabled:!0},toolbar:{enabled:!0}},BX=(e,t)=>({enabled:t.enabled??e.enabled,hue:t.hue??e.hue,selectionBox:{enabled:t.selectionBox?.enabled??e.selectionBox.enabled},dragBox:{enabled:t.dragBox?.enabled??e.dragBox.enabled},grabbedBoxes:{enabled:t.grabbedBoxes?.enabled??e.grabbedBoxes.enabled},elementLabel:{enabled:t.elementLabel?.enabled??e.elementLabel.enabled},toolbar:{enabled:t.toolbar?.enabled??e.toolbar.enabled}}),VX={activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,activationKey:void 0,getContent:void 0,maxContextLines:3,freezeReactUpdates:!0},HX=(e={})=>{let t=new Map,n={},[r,i]=DJ({theme:zX,options:{...VX,...e},actions:[]}),a=()=>{let r=zX,a={...VX,...e},o=[];for(let{config:e}of t.values())if(e.theme&&(r=BX(r,e.theme)),e.options&&(a={...a,...e.options}),e.actions)for(let t of e.actions)o.push(t);a={...a,...n},i(`theme`,r),i(`options`,a),i(`actions`,o)},o=(e,t)=>{n[e]=t,i(`options`,e,t)},s=[`activationMode`,`keyHoldDuration`,`allowActivationInsideInput`,`activationKey`,`getContent`,`maxContextLines`,`freezeReactUpdates`],c=e=>{for(let t of s)e[t]!==void 0&&o(t,e[t])},l=(e,n)=>{t.has(e.name)&&u(e.name);let r=e.setup?.(n,_)??{};e.theme&&(r.theme=r.theme?BX(BX(zX,e.theme),r.theme):e.theme),e.actions&&(r.actions=[...e.actions,...r.actions??[]]),e.hooks&&(r.hooks=r.hooks?{...e.hooks,...r.hooks}:e.hooks),e.options&&(r.options=r.options?{...e.options,...r.options}:e.options),t.set(e.name,{plugin:e,config:r}),a()},u=e=>{let n=t.get(e);n&&(n.config.cleanup&&n.config.cleanup(),t.delete(e),a())},d=()=>Array.from(t.keys()),f=(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&t(...n)}},p=(e,...n)=>{let r=!1;for(let{config:i}of t.values()){let t=i.hooks?.[e];t&&t(...n)===!0&&(r=!0)}return r},m=async(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&await t(...n)}},h=async(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=await t(i,...r))}return i},g=(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=t(i,...r))}return i},_={onActivate:()=>f(`onActivate`),onDeactivate:()=>f(`onDeactivate`),onElementHover:e=>f(`onElementHover`,e),onElementSelect:e=>{let n=!1,r;for(let{config:i}of t.values()){let t=i.hooks?.onElementSelect;if(t){let i=t(e);i===!0?n=!0:i instanceof Promise&&(n=!0,r=i)}}return{wasIntercepted:n,pendingResult:r}},onDragStart:(e,t)=>f(`onDragStart`,e,t),onDragEnd:(e,t)=>f(`onDragEnd`,e,t),onBeforeCopy:async e=>m(`onBeforeCopy`,e),transformCopyContent:async(e,t)=>h(`transformCopyContent`,e,t),onAfterCopy:(e,t)=>f(`onAfterCopy`,e,t),onCopySuccess:(e,t)=>f(`onCopySuccess`,e,t),onCopyError:e=>f(`onCopyError`,e),onStateChange:e=>f(`onStateChange`,e),onPromptModeChange:(e,t)=>f(`onPromptModeChange`,e,t),onSelectionBox:(e,t,n)=>f(`onSelectionBox`,e,t,n),onDragBox:(e,t)=>f(`onDragBox`,e,t),onGrabbedBox:(e,t)=>f(`onGrabbedBox`,e,t),onElementLabel:(e,t,n)=>f(`onElementLabel`,e,t,n),onContextMenu:(e,t)=>f(`onContextMenu`,e,t),onOpenFile:(e,t)=>p(`onOpenFile`,e,t),transformHtmlContent:async(e,t)=>h(`transformHtmlContent`,e,t),transformAgentContext:async(e,t)=>h(`transformAgentContext`,e,t),transformActionContext:e=>g(`transformActionContext`,e),transformOpenFileUrl:(e,t,n)=>g(`transformOpenFileUrl`,e,t,n)};return{register:l,unregister:u,getPluginNames:d,setOptions:c,store:r,hooks:_}},UX=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,WX=e=>{let t=e.bounds.x+e.bounds.width/2,n=e.bounds.width/2,r=e.mouseX===void 0?void 0:e.mouseX-t;return{id:UX(`label`),bounds:e.bounds,boundsMultiple:e.boundsMultiple,tagName:e.tagName,componentName:e.componentName,status:e.status,createdAt:Date.now(),element:e.element,elements:e.elements,mouseX:e.mouseX,mouseXOffsetFromCenter:r,mouseXOffsetRatio:r!==void 0&&n>0?r/n:void 0,hideArrow:e.hideArrow}},GX=(e,t)=>{let n=new Map,r=e=>{let t=n.get(e);t!==void 0&&(window.clearTimeout(t),n.delete(e))},i=()=>{for(let e of n.values())window.clearTimeout(e);n.clear()},a=()=>{i(),e.clearLabelInstances()},o=t=>{r(t);let i=window.setTimeout(()=>{e.updateLabelInstance(t,`fading`);let r=window.setTimeout(()=>{n.delete(t),e.removeLabelInstance(t)},125);n.set(t,r)},MM);n.set(t,i)};return{createInstance:(t,n,r,i,o)=>{a();let s=WX({bounds:t,tagName:n,componentName:r,status:i,element:o?.element,mouseX:o?.mouseX,elements:o?.elements,boundsMultiple:o?.boundsMultiple,hideArrow:o?.hideArrow});return e.addLabelInstance(s),s.id},createPerElementInstances:(t,n)=>{a();let r=[];for(let i of t){let t=WX({bounds:VJ(i.element),tagName:i.tagName,componentName:i.componentName,status:n,element:i.element,mouseX:i.mouseX});e.addLabelInstance(t),r.push(t.id)}return r},updateAfterCopy:(t,n,r)=>{n?e.updateLabelInstance(t,`copied`):e.updateLabelInstance(t,`error`,r||`Unknown error`),o(t)},cancelAllFades:i,clearAll:a,handleHoverChange:(e,n)=>{if(n){r(e);return}let i=t().find(t=>t.id===e);i&&(i.status===`copied`||i.status===`error`||i.status===`fading`)&&o(e)}}},KX=e=>{let t=window.innerWidth,n=window.innerHeight,r=Math.max(0,e.x),i=Math.min(t,e.x+e.width),a=Math.max(0,e.y),o=Math.min(n,e.y+e.height);return{x:(r+i)/2,y:(a+o)/2}},qX=(e,t,n)=>{let r=[],i=(t,r)=>{let i=KX(n(t)),a=yI(i.x,i.y).filter(e),o=a.indexOf(t);return o===-1?null:a[o+r]??null},a=e=>{let t=i(e,1);return t&&(r.push(e),r.length>50&&(r=r.slice(-50))),t},o=e=>{if(r.length>0){let e=r.pop();if(Jz(e))return e}return i(e,-1)},s=(e,n)=>{let i=e=>n?e.nextElementSibling:e.previousElementSibling,a=i(e);for(;a;){if(t(a))return r=[],a;a=i(a)}return null};return{findNext:(e,t)=>{switch(e){case`ArrowUp`:return a(t);case`ArrowDown`:return o(t);case`ArrowRight`:return s(t,!0);case`ArrowLeft`:return s(t,!1);default:return null}},clearHistory:()=>{r=[]}}},JX=e=>{let{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}=GY(e.activationKey);return{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}},YX=()=>{let e=new WeakSet,t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,`key`),n=!1;if(t?.get&&!t.get.__reactGrabPatched){n=!0;let r=t.get,i=function(){return e.has(this)?``:r.call(this)};i.__reactGrabPatched=!0,Object.defineProperty(KeyboardEvent.prototype,"key",{get:i,configurable:!0})}return{claimedEvents:e,originalKeyDescriptor:t,restore:()=>{n&&t&&Object.defineProperty(KeyboardEvent.prototype,"key",t)}}},XX=(e,t)=>({top:t<25,bottom:t>window.innerHeight-25,left:e<25,right:e>window.innerWidth-25}),ZX=(e,t,n)=>{let r=null,i=()=>{if(!t()){a();return}let o=e(),s=XX(o.x,o.y),c=0,l=0;if(s.top&&(l-=10),s.bottom&&(l+=10),s.left&&(c-=10),s.right&&(c+=10),c!==0||l!==0){let e=window.scrollX,t=window.scrollY;window.scrollBy(c,l);let r=window.scrollX-e,i=window.scrollY-t;(r!==0||i!==0)&&n?.({x:r,y:i})}r=s.top||s.bottom||s.left||s.right?UF(i):null},a=()=>{r!==null&&(WF(r),r=null)};return{start:i,stop:a,isActive:()=>r!==null}},QX=()=>{let e=globalThis;return!!(e.chrome?.runtime?.id||e.browser?.runtime?.id)},$X=e=>{try{let t=`0.1.48`,n=`data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 294 294"><path fill="#ff40e0" d="M145 47c25-20 50-27 67-17 16 9 23 30 20 60 0 2-1 5-1 7l-2 13h-1l-12-4c-8-3-17-5-25-6l-17-3c-10-1-20-1-29-1-10 0-20 0-29 1-6 8-11 16-16 24-5 9-9 17-13 26 4 9 8 18 13 26s10 16 16 24l11 14c5 7 11 13 18 19l10 8s-1 0 0 0l-11 9c-17 14-35 22-49 22-6 0-13-2-18-5-16-9-23-30-20-59 1-3 1-5 1-8-30-12-48-29-48-50 0-18 14-35 41-47 2-1 5-2 7-3 0-2 0-5-1-7-3-30 4-51 20-60 18-10 42-3 68 17M71 201c-1 2-1 4-1 5-2 24 3 41 13 47h1c11 7 30 1 51-15-10-9-18-18-26-29-13-1-26-4-38-8m9-38c-3 9-5 17-7 26 8 2 17 4 25 6-3-5-6-10-9-16-3-5-6-10-9-16m-19-53c-2 1-3 1-5 2-21 10-34 23-34 35 0 13 14 27 39 37 3-12 7-25 12-37-5-12-9-24-12-37m37-10c-8 1-17 3-25 6 2 8 4 16 7 25 3-5 6-11 9-16zm-3-61c-4-1-8 0-12 2-10 7-15 24-13 47 0 2 0 3 1 5 12-4 25-6 38-8 8-10 16-20 26-29-15-11-29-17-40-17m111 2c-4-2-8-3-12-2-11 0-25 5-40 17 10 9 19 19 26 29 13 2 26 4 39 8v-5c3-23-2-40-13-47m-61 23c-7 6-13 13-19 19h37c-6-6-12-13-18-19"/><mask id="a"><path fill="#fff" d="m235 85-133 27 28 133 133-27Z"/></mask><path fill="#ff40e0" d="m137 130 76 11c8 1 9 11 3 15l-28 16-4 32c-1 8-10 10-14 4l-41-66c-3-6 1-13 8-12" mask="url(#a)"/></svg>`)}`;console.log(`%cReact Grab${` v${t}`}%c\nhttps://react-grab.com`,`background: #330039; color: #ffffff; border: 1px solid #d75fcb; padding: 4px 4px 4px 24px; border-radius: 4px; background-image: url("${n}"); background-size: 16px 16px; background-repeat: no-repeat; background-position: 4px center; display: inline-block; margin-bottom: 4px;`,``),e&&navigator.onLine&&!QX()&&fetch(`https://www.react-grab.com/api/version?source=browser&v=${t}&t=${Date.now()}`,{referrerPolicy:`origin`,keepalive:!0,priority:`low`,cache:`no-store`}).then(e=>e.text()).then(e=>{e&&e!==t&&console.warn(`[React Grab] v${t} is outdated (latest: v${e}). Run \`npx grab@latest upgrade\` to upgrade.`)}).catch(()=>null)}catch{}},eZ=e=>typeof e==`object`&&!!e,tZ=e=>{if(!eZ(e))return null;let t={};return typeof e.enabled==`boolean`&&(t.enabled=e.enabled),(e.activationMode===`toggle`||e.activationMode===`hold`)&&(t.activationMode=e.activationMode),typeof e.keyHoldDuration==`number`&&Number.isFinite(e.keyHoldDuration)&&(t.keyHoldDuration=e.keyHoldDuration),typeof e.allowActivationInsideInput==`boolean`&&(t.allowActivationInsideInput=e.allowActivationInsideInput),typeof e.activationKey==`string`&&(t.activationKey=e.activationKey),typeof e.maxContextLines==`number`&&Number.isFinite(e.maxContextLines)&&(t.maxContextLines=e.maxContextLines),typeof e.freezeReactUpdates==`boolean`&&(t.freezeReactUpdates=e.freezeReactUpdates),typeof e.telemetry==`boolean`&&(t.telemetry=e.telemetry),Object.keys(t).length===0?null:t},nZ=()=>{if(typeof window>`u`)return null;try{let e=(document.currentScript instanceof HTMLScriptElement?document.currentScript:null)?.getAttribute(`data-options`);return e?tZ(JSON.parse(e)):null}catch{return null}},rZ=e=>e===`Enter`||e===`NumpadEnter`,iZ=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height,aZ=(e=>({name:e.name,setup:(t,n)=>({actions:[typeof e.contextMenuAction==`function`?e.contextMenuAction(t,n):e.contextMenuAction],cleanup:e.cleanup})}))({name:`copy`,contextMenuAction:{id:`copy`,label:`Copy`,shortcut:`C`,showInToolbarMenu:!0,onAction:e=>{e.copy?.()}}}),oZ={name:`comment`,setup:()=>({actions:[{id:`comment`,label:`Comment`,shortcut:`Enter`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterPromptMode?.()}}]})},sZ={name:`edit`,setup:()=>({actions:[{id:`edit`,label:`Style`,shortcut:`S`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterEditMode?.()}}]})},cZ={name:`open`,actions:[{id:`open`,label:`Open`,shortcut:`O`,enabled:e=>!!e.filePath,onAction:e=>{e.filePath&&(e.hooks.onOpenFile(e.filePath,e.lineNumber)||CI(e.filePath,e.lineNumber,e.hooks.transformOpenFileUrl),e.hideContextMenu(),e.cleanup())}}]},lZ=e=>{let t=e.left+e.width/2,n=e.top+e.height/2,r=n,i=window.innerHeight-n,a=t,o=window.innerWidth-t,s=Math.min(r,i,a,o);return s===r?`top`:s===a?`left`:s===o?`right`:`bottom`},uZ=()=>{let[e,t]=J(!1),[n,r]=J(null),i=MV(),a=()=>{let e=n();return Jz(e)?e:null},o=()=>{r(null),i.clear(),t(!1)};return{selectedElement:a,isPendingDismiss:e,select:(e,n)=>{r(e),t(!1),n?.shouldPromptBeforeMouseHandoff?i.arm():i.clear()},clear:o,consumeMouseHandoff:()=>i.consume()&&a()!==null,showDismissPrompt:()=>a()?e()?!1:(t(!0),!0):(o(),!1),takeSelection:e=>{let t=a()??(Jz(e)?e:null);return o(),t}}},dZ=async(e,t={})=>(await Promise.allSettled(e.map(e=>HU(e,t)))).map(e=>e.status===`fulfilled`?e.value:``),fZ=[aZ,sZ,oZ,cZ],pZ=!1,mZ=new Set,hZ=e=>{if(typeof window>`u`)return mY();let t={enabled:!0,activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,...nZ(),...e};if(t.enabled===!1||pZ)return mY();pZ=!0,CM(t.container??null),$X(t.telemetry!==!1);let{enabled:n,telemetry:r,container:i,...a}=t;return rR(e=>{let t=!1,n,r=HX(a),{store:i,actions:o,pointer:s,viewportVersion:c,current:l}=WJ({keyHoldDuration:r.store.options.keyHoldDuration??100}),u=Y(()=>l().state===`holding`),d=Y(()=>l().state===`active`),f=Y(()=>{let e=l();return e.state===`active`&&e.phase===`frozen`}),p=Y(()=>{let e=l();return e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)}),m=Y(()=>{if(!p())return!1;let e=Math.abs(s().x+window.scrollX-i.dragStart.x),t=Math.abs(s().y+window.scrollY-i.dragStart.y);return e>2||t>2}),h=Y(()=>{let e=l();return e.state===`active`&&e.phase===`dragging-reposition`}),g=Y(()=>{let e=l();return e.state===`active`&&e.phase===`justDragged`}),_=Y(()=>l().state===`copying`),v=Y(()=>i.selectionInteractionLockDepth>0),y=Y(()=>l().state===`justCopied`),b=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode}),x=Y(()=>i.pendingCommentMode||b()),S=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode&&!!e.isPendingDismiss}),C=(e,t)=>{document.body.style[e]=t};oR(dR(d,(e,t)=>{e&&!t?(SL(s().x,s().y),C(`touchAction`,`none`)):!e&&t&&(CL(),C(`touchAction`,``))}));let w=EV(),[T,E]=J(!w||!w.collapsed),[D,O]=J(0),[k,ee]=J(0),[te,A]=J(w),[ne,re]=J(!1),ie=OV(e=>e.shiftKey),[ae,oe]=J(null),[se,ce]=J(null),[le,ue]=J(null),de=RX({store:i,actions:o,isActivated:d,activateRenderer:()=>Gt(),deactivateRenderer:()=>Kt(),performCopyWithLabel:e=>dt(e),onOpen:()=>{kr(),ge?.(),ge=Or(Dr,ce)},onClose:()=>{ge?.(),ge=null,ce(null)}}),fe=Y(()=>i.contextMenuPosition!==null||de.isOpen()),pe=Y(()=>fe()||ae()!==null),me,he=null,ge=null,_e=!1,ve=new WeakMap,ye=uZ(),be=()=>!T()||b()||v()||fe()||ye.isPendingDismiss(),xe=()=>{ve=new WeakMap},Se=()=>{Le(!1),xe()},Ce=e=>{let t=te()??EV(),n={edge:t?.edge??`bottom`,ratio:t?.ratio??.5,collapsed:t?.collapsed??!1,enabled:t?.enabled??!0,defaultAction:t?.defaultAction??`copy`,...e};DV(n),A(n);for(let e of mZ)e(n)},we=()=>{Fe.timerId!==null&&(clearTimeout(Fe.timerId),Fe.timerId=null)},Te=()=>{Fe.copyWaiting=!1,Fe.holdTimerFired=!1,Fe.startTimestamp=null};oR(()=>{if(l().state!==`holding`){we();return}Fe.startTimestamp=Date.now(),Fe.timerId=window.setTimeout(()=>{if(Fe.timerId=null,Fe.copyWaiting){Fe.holdTimerFired=!0;return}o.activate()},i.keyHoldDuration),pR(we)}),oR(()=>{let e=l();if(e.state!==`active`||e.phase!==`justDragged`)return;let t=setTimeout(()=>{o.finishJustDragged()},MM);pR(()=>clearTimeout(t))}),oR(()=>{if(l().state!==`justCopied`)return;let e=setTimeout(()=>{o.finishJustCopied()},MM);pR(()=>clearTimeout(e))}),oR(dR(u,(e,t=!1)=>{!t||e||!d()||(r.store.options.activationMode!==`hold`&&o.setWasActivatedByToggle(!0),r.hooks.onActivate())}));let Ee=(e,t,n)=>{Oe(e,t,n),o.clearInputText()},De=()=>{let e=i.frozenElement||pt();e&&o.enterPromptMode({x:s().x,y:s().y},e)},Oe=(e,t,n)=>{o.setCopyStart({x:t,y:n},e)},ke={lastDetectionTimestamp:0,pendingDetectionScheduledAt:0,latestPointerX:0,latestPointerY:0},Ae=null,[je,Me]=J(null),Ne=(e,t)=>{Ae!==null&&clearTimeout(Ae),Me(null),Ae=window.setTimeout(()=>{Me({x:e,y:t}),Ae=null},32)},Pe=null,Fe={timerId:null,startTimestamp:null,copyWaiting:!1,holdTimerFired:!1},Ie=null,[j,Le]=J(!1),Re=0,ze=!1,Be=null,Ve=()=>{ze=!0,Be!==null&&window.clearTimeout(Be),Be=window.setTimeout(()=>{ze=!1,Be=null},MM)},He=()=>{Be!==null&&(window.clearTimeout(Be),Be=null),ze=!1},Ue=0,We=null,Ge=null,[M,Ke]=J(!1),[qe,Je]=J(null),[Ye,Xe]=J(null),[Ze,Qe]=JJ(Ye),$e=Y(()=>de.isOpen()?oN:x()?aN:M()?qe():d()?iN:null),et=e=>RY(e,rI),tt=qX(rI,et,VJ),nt=ZX(s,()=>p(),e=>{if(h()){if(o.shiftDragStart(e),Ie){Ie={x:Ie.x+e.x,y:Ie.y+e.y};return}let{pageX:t,pageY:n}=Et(s().x,s().y);Ie={x:t,y:n}}}),N=Y(()=>d()&&!_()),rt=new Map,it=(e,t)=>{let n=UX(`grabbed`),i={id:n,bounds:e,createdAt:Date.now(),element:t};o.addGrabbedBox(i),r.hooks.onGrabbedBox(e,t);let a=window.setTimeout(()=>{rt.delete(n),o.removeGrabbedBox(n)},MM+125);rt.set(n,a)},at=async e=>{let t=await Promise.all(e.map(async e=>{let t=await DU(e),n=t?.componentName??null,r=t?.filePath,i=t?.lineNumber??void 0,a=t?.columnNumber??void 0;n||=OU(e);let o=e instanceof HTMLElement?e.innerText?.slice(0,100):void 0;return{tagName:TN(e),id:e.id||void 0,className:e.getAttribute(`class`)||void 0,textContent:o,componentName:n??void 0,filePath:r,lineNumber:i,columnNumber:a}}));window.dispatchEvent(new CustomEvent(`react-grab:element-selected`,{detail:{elements:t}}))},ot=GX(o,()=>i.labelInstances),st=async(e,t,n)=>{He(),l().state!==`copying`&&o.startCopy();let r=!1,i;try{r=await e(),r||(i=`Failed to copy`)}catch(e){i=gY(e,`Action failed`)}if(t)for(let e of t)ot.updateAfterCopy(e,r,i);l().state===`copying`&&(r&&o.completeCopy(),n?Kt():r?(o.activate(),Ve()):o.unfreeze())},ct=(e,t,n)=>{let i=e[0],a=n??(i?OU(i):null),o=i?TN(i):null,s=a??o??void 0;return SY({getContent:r.store.options.getContent,componentName:s,maxContextLines:r.store.options.maxContextLines},r.hooks,e,t)},lt=async(e,t,n)=>{if(e.length===0)return!1;let i=[],a=[];for(let t of e){let{wasIntercepted:e,pendingResult:n}=r.hooks.onElementSelect(t);e||i.push(t),n&&a.push(n),r.store.theme.grabbedBoxes.enabled&&it(VJ(t),t)}await GF();let o=!0;if(i.length>0&&(o=await ct(i,t,n)),a.length>0&&!(await Promise.all(a)).every(Boolean))throw new RV;return at(e),o},ut=e=>{bU(e.primaryElement).then(async t=>{await st(()=>lt(e.targetElements,e.extraPrompt,t??void 0),e.labelInstanceIds.length>0?e.labelInstanceIds:null,e.shouldDeactivateAfter),e.onComplete?.()}).catch(t=>{let n=gY(t,`Action failed`);for(let t of e.labelInstanceIds)ot.updateAfterCopy(t,!1,n);l().state===`copying`&&o.unfreeze()})},dt=e=>{let{element:t,cursorX:n,selectedElements:r,extraPrompt:a,shouldDeactivateAfter:s,onComplete:c,dragRect:l}=e,u=r??[t],d=l??i.frozenDragRect,f=u.length>1,p=!f&&t===yt()?Tt():void 0,m=d&&f?MY(d):p??VJ(t),h=f?m.x+m.width/2:n,g=TN(t);He(),o.startCopy();let _=g?ot.createInstance(m,g,void 0,`copying`,{element:t,mouseX:h,elements:r}):null;ut({primaryElement:t,targetElements:u,labelInstanceIds:_?[_]:[],extraPrompt:a,shouldDeactivateAfter:s,onComplete:c})},ft=e=>{let{elements:t,labelEntries:n,shouldDeactivateAfter:r,onComplete:i}=e,a=t[0];He(),o.startCopy(),ut({primaryElement:a,targetElements:t,labelInstanceIds:ot.createPerElementInstances(n,`copying`),shouldDeactivateAfter:r,onComplete:i})},pt=Y(()=>{if(c(),!N()||m()||v()||ye.isPendingDismiss())return null;let e=i.detectedElement;return Jz(e)?e:null}),P=Y(()=>i.frozenElement||(f()?null:pt())),mt=Y(()=>!d()||b()||j()||_()||pe()||ye.isPendingDismiss()?null:ie()?f()?P():pt()??i.frozenElement:ye.selectedElement()),ht=Y(()=>{let e=mt();return e?FY(e,rI,et):[]}),gt=Y(()=>{let e=mt();return e?Math.max(0,ht().findIndex(t=>t.element===e)):0}),_t=Y(()=>mt()!==null);oR(()=>{let e=i.detectedElement;if(!e)return;let t=setInterval(()=>{Jz(e)||o.setDetectedElement(null)},100);pR(()=>clearInterval(t))}),oR(dR(P,e=>{if(We!==null&&(clearTimeout(We),We=null),!e){Xe(null);return}We=window.setTimeout(()=>{We=null,Xe(e)},100)})),pR(()=>{We!==null&&(clearTimeout(We),We=null)}),oR(()=>{let e=i.frozenElements;pR(tL(e))}),oR(dR(d,e=>{e&&r.store.options.freezeReactUpdates&&pR($L())}));let vt=()=>{if(i.isTouchMode&&p()){let e=i.detectedElement;return!e||qF(e)?void 0:e}let e=P();if(!(!e||qF(e)))return e},yt=Y(()=>vt()),bt=()=>yt()?i.isTouchMode&&p()?N():N()&&!m():!1,xt=RR(()=>i.frozenElements,e=>Y(()=>(c(),VJ(e)))),St=Y(()=>{let e=i.frozenElements;if(e.length===0)return[];let t=i.frozenDragRect;return t&&e.length>1?[MY(t)]:xt().map(e=>e())}),Ct=Y(()=>{if(!j()||i.pendingCommentMode||M())return null;let e=i.detectedElement;return!Jz(e)||qF(e)||i.frozenElements.includes(e)?null:e}),wt=Y(()=>{c();let e=Ct();if(e)return VJ(e)}),Tt=Y(()=>{c();let e=i.frozenElements;if(e.length>0){let t=St();if(e.length===1){let e=t[0];if(e)return e}let n=i.frozenDragRect;return n?t[0]??MY(n):PY(qY(t))}let t=yt();if(t)return VJ(t)}),Et=(e,t)=>({pageX:e+window.scrollX,pageY:t+window.scrollY}),Dt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t);return{x:Math.abs(n-i.dragStart.x),y:Math.abs(r-i.dragStart.y)}},Ot=Y(()=>{if(!p())return!1;let e=Dt(s().x,s().y);return e.x>2||e.y>2}),kt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t),a=Math.min(i.dragStart.x,n),o=Math.min(i.dragStart.y,r),s=Math.abs(n-i.dragStart.x),c=Math.abs(r-i.dragStart.y);return{x:a-window.scrollX,y:o-window.scrollY,width:s,height:c}},At=e=>e.code===`Space`||e.key===` `,jt=()=>{if(!p())return;o.startDragReposition();let{pageX:e,pageY:t}=Et(s().x,s().y);Ie={x:e,y:t}},Mt=()=>{o.stopDragReposition(),Ie=null},Nt=Y(()=>{if(c(),Ot())return PY(kt(s().x,s().y))}),Pt=Y(()=>{if(c(),!Ot())return[];let e=je();if(!e)return[];let t=kt(e.x,e.y),n=kY(t,rI);return(n.length>0?n:kY(t,rI,!1)).map(e=>VJ(e))}),Ft=Y(()=>{let e=Pt();if(e.length>0)return e;let t=wt();return t?[...St(),t]:St()}),It=RR(()=>i.frozenElements,e=>{let t=TN(e)||`element`,n=OU(e)??void 0;return Y(()=>{if(c(),!Jz(e))return null;let r=VJ(e),i=ve.get(e);return{tagName:t,componentName:n,bounds:r,mouseX:i===void 0?void 0:r.x+r.width*i}})}),Lt=Y(()=>{if(b()||i.frozenElements.length<2)return[];let e=[];for(let t of It()){let n=t();n!==null&&e.push(n)}return e}),Rt=Y(()=>{if(b())return null;let e=Ct();return e?(c(),{tagName:TN(e)||`element`,componentName:OU(e)??void 0,bounds:VJ(e),mouseX:s().x}):null}),zt=Y(()=>{if(_()||b()){c();let e=i.frozenElement||pt();return e?{x:HJ(VJ(e)).x+i.copyOffsetFromCenterX,y:i.copyStart.y}:{x:i.copyStart.x,y:i.copyStart.y}}return{x:s().x,y:s().y}}),Bt=Y(()=>{if(!j()||i.frozenElements.length!==1)return;c();let e=i.frozenElements[0];if(!Jz(e))return;let t=ve.get(e);if(t===void 0)return;let n=VJ(e);return n.x+n.width*t});oR(dR(()=>[pt(),i.lastGrabbedElement],([e,t])=>{t&&e&&t!==e&&o.setLastGrabbed(null),e&&r.hooks.onElementHover(e)})),oR(dR(()=>pt(),e=>{let t=++Ue,n=()=>{Ue===t&&o.setSelectionSource(null,null)};if(!e){n();return}DU(e).then(e=>{if(Ue===t){if(!e){n();return}o.setSelectionSource(e.filePath,e.lineNumber)}}).catch(()=>{Ue===t&&o.setSelectionSource(null,null)})}));let Vt=Y(()=>i.grabbedBoxes.map(e=>({id:e.id,bounds:e.bounds,createdAt:e.createdAt}))),Ht=Y(()=>i.labelInstances.map(e=>({id:e.id,status:e.status,tagName:e.tagName,componentName:e.componentName,createdAt:e.createdAt})));oR(dR(Y(()=>{let e=d(),t=p(),n=_(),a=b(),o=pt(),s=Nt(),c=r.store.theme.enabled,l=r.store.theme.selectionBox.enabled,u=r.store.theme.dragBox.enabled,f=Ot(),m=P(),h=y();return{isActive:e,isDragging:t,isCopying:n,isPromptMode:a,isSelectionBoxVisible:!!(c&&l&&e&&!n&&!h&&!t&&m!=null),isDragBoxVisible:!!(c&&u&&e&&!n&&f),targetElement:o,dragBounds:s?{x:s.x,y:s.y,width:s.width,height:s.height}:null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:te()}}),e=>{r.hooks.onStateChange(e)})),oR(dR(()=>{let e=b();return{inputMode:e,position:e?s():uR(s),target:e?pt():uR(pt)}},({inputMode:e,position:t,target:n})=>{r.hooks.onPromptModeChange(e,{x:t.x,y:t.y,targetElement:n})})),oR(dR(()=>[ar(),Tt(),pt()],([e,t,n])=>{r.hooks.onSelectionBox(!!e,t??null,n)})),oR(dR(()=>[fr(),Nt()],([e,t])=>{r.hooks.onDragBox(!!e,t??null)})),oR(dR(()=>{let e=mr();return[e,pr(),e?zt():uR(zt),e?pt():uR(pt),i.selectionFilePath,i.selectionLineNumber]},([e,t,n,i,a,o])=>{r.hooks.onElementLabel(e,t,{x:n.x,y:n.y,content:``,element:i??void 0,tagName:i&&TN(i)||void 0,filePath:a??void 0,lineNumber:o??void 0})}));let Ut=null,Wt=e=>{if(e){if(!Ut){Ut=document.createElement(`style`),Ut.setAttribute(`data-react-grab-cursor`,``);let e=DN();e&&(Ut.nonce=e),kN(Ut),document.head.appendChild(Ut)}Ut.textContent=`* { cursor: ${e} !important; }`}else Ut&&=(Ut.remove(),null)};oR(dR(()=>[d(),_(),b()],([e,t,n])=>{Wt(t?`progress`:e&&!n?`crosshair`:null)}));let Gt=()=>{let e=u();o.activate(),e||r.hooks.onActivate()},Kt=()=>{let e=p(),t=i.previouslyFocusedElement;Mt(),o.deactivate(),de.resetWithDiscard(),kr(),Se(),wn(),ye.clear(),Ke(!1),Je(null),e&&C(`userSelect`,``),Pe&&window.clearTimeout(Pe),nt.stop(),t instanceof HTMLElement&&t!==document.body&&t!==document.activeElement&&Jz(t)&&t.focus({preventScroll:!0}),r.hooks.onDeactivate()},qt=()=>{u()&&o.releaseHold(),d()&&Kt(),He()},Jt=()=>{o.setWasActivatedByToggle(!0),Gt()},Yt=()=>{let e=[...i.frozenElements],t=i.frozenElement||pt(),n=b()?i.inputText.trim():``;if(!t){Kt();return}let r=e.length>0?e:[t],a=r.map(e=>VJ(e))[0],{x:s,y:c}=HJ(a),l=s+i.copyOffsetFromCenterX;o.setPointer({x:s,y:c}),o.exitPromptMode(),o.clearInputText(),dt({element:t,cursorX:l,selectedElements:r,extraPrompt:n||void 0,shouldDeactivateAfter:!0})},Xt=()=>{if(b()){if(S()){o.clearInputText(),Kt();return}o.setPendingDismiss(!0),ee(e=>e+1)}},Zt=()=>{if(ye.isPendingDismiss()){Dn();return}o.clearInputText(),Kt()},Qt=()=>{o.setPendingDismiss(!1)},$t=()=>{if(de.isOpen()){de.dismiss();return}let e=i.frozenElement||pt();e&&en(e,{x:s().x,y:s().y})},en=(e,t,n={})=>de.trigger(e,t,n),tn=(e,t)=>{if(!de.isOpen()||i.contextMenuPosition!==null)return!1;let n=yI(e,t).find(rI);if(!n)return!1;let r=de.switchToElement(n,{x:e,y:t});return r&&$I([n]),r},nn=e=>({filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,componentName:Ze(),tagName:TN(e)||void 0}),rn=()=>{Ge=null,Ke(!1),o.setPendingCommentMode(!1),Je(null)},an=e=>{let t=i.frozenElement||pt();if(!t)return!1;let n={x:s().x,y:s().y},a=r.store.actions.find(t=>t.id===e);return a?e===`edit`?en(t,n,nn(t))?(o.clearInputText(),o.exitPromptMode(),rn(),!0):!0:(o.clearInputText(),o.exitPromptMode(),rn(),a.onAction(Nn(t,n)),!0):(o.clearInputText(),o.exitPromptMode(),rn(),Mr(iN),ln(t,n),!0)},on=e=>{if(d()){if($e()!==e&&b()&&an(e))return;if($e()!==e&&i.pendingCommentMode){o.setPendingCommentMode(!1),Ge=e,Je(e),Ke(!0);return}if($e()!==e&&M()){Ge=e,Je(e);return}Kt();return}T()&&(Ge=e,Je(e),Ke(!0),Jt())},sn=()=>{on(te()?.defaultAction??`copy`)},cn=(e,t,n)=>{rn(),o.clearInputText(),o.enterPromptMode({x:t,y:n},e)},ln=(e,t)=>{Se(),Ar(),o.showContextMenu(t,e),wn(),r.hooks.onContextMenu(e,t)},un=(e,t)=>{let n=Ge;if(Ge=null,Je(null),!n)return;if(n===`edit`){en(e,t,nn(e));return}let i=r.store.actions.find(e=>e.id===n);if(!i){Mr(iN),ln(e,t);return}i.onAction(Nn(e,t))},dn=()=>{if(T()){if(d()&&x()){Kt();return}o.setPendingCommentMode(!0),d()||Jt()}},fn=(e,t,n)=>{let r=n&&j()&&!p()&&!i.pendingCommentMode&&!M();if(be()||f()&&!r)return;if(o.setPointer({x:e,y:t}),ke.latestPointerX=e,ke.latestPointerY=t,r){let n=bI(e,t);n!==i.detectedElement&&o.setDetectedElement(n);return}let a=performance.now(),s=ke.pendingDetectionScheduledAt>0&&a-ke.pendingDetectionScheduledAt<200;if(a-ke.lastDetectionTimestamp>=32&&!s&&(ke.lastDetectionTimestamp=a,ke.pendingDetectionScheduledAt=a,setTimeout(()=>{if(be()){ke.pendingDetectionScheduledAt=0;return}let e=bI(ke.latestPointerX,ke.latestPointerY);e!==i.detectedElement&&o.setDetectedElement(e),ke.pendingDetectionScheduledAt=0})),p()){if(h()){let{pageX:n,pageY:r}=Et(e,t);Ie&&o.shiftDragStart({x:n-Ie.x,y:r-Ie.y}),Ie={x:n,y:r}}Ne(e,t);let n=XX(e,t),r=n.top||n.bottom||n.left||n.right;r&&!nt.isActive()?nt.start():!r&&nt.isActive()&&nt.stop()}},pn=(e,t,n)=>{if(!N()||v())return!1;!n&&j()&&Se();let i=ye.selectedElement()!==null;return o.startDrag({x:e,y:t},n||i),o.setPointer({x:e,y:t}),C(`userSelect`,`none`),Ne(e,t),r.hooks.onDragStart(e+window.scrollX,t+window.scrollY),!0},mn=(e,t)=>{let n=i.frozenElements.includes(e),r=i.frozenElements.length===0;if(!n){let n=AY(VJ(e),t);ve.set(e,n),r&&Qe(OU(e)??void 0)}o.toggleFrozenElement(e),xI();let a=i.frozenElements.includes(e);if(a||ve.delete(e),i.frozenElements.length===0){Se(),o.unfreeze();return}$I(i.frozenElements),Le(!0),o.setPointer(t),o.setLastGrabbed(a?e:i.frozenElements[i.frozenElements.length-1]),o.freeze(),wn()},hn=()=>{let e=i.frozenElements.filter(Jz),t=e.map(e=>{let t=TN(e)||`element`,n=OU(e)??void 0,r=ve.get(e),i=VJ(e);return{element:e,tagName:t,componentName:n,mouseX:r===void 0?i.x+i.width/2:i.x+i.width*r}});if(Se(),e.length===0){o.unfreeze();return}if(e.length===1){dt({element:e[0],cursorX:t[0].mouseX,selectedElements:e,shouldDeactivateAfter:i.wasActivatedByToggle});return}ft({elements:e,labelEntries:t,shouldDeactivateAfter:i.wasActivatedByToggle})},gn=(e,t,n)=>{let a=kY(e,rI),s=a.length>0?a:kY(e,rI,!1);if(s.length===0)return;let c=n&&!i.pendingCommentMode&&!M();if(c&&o.addFrozenElements(s),$I(c?i.frozenElements:s),r.hooks.onDragEnd(s,e),c){let e=s[s.length-1];Le(!0),xI(),o.setPointer(HJ(VJ(e))),o.setLastGrabbed(e),o.freeze(),wn();return}let l=s[0],u=HJ(VJ(l));o.setPointer(u),o.setFrozenElements(s);let d=NY(e);if(o.setFrozenDragRect(d),o.freeze(),o.setLastGrabbed(l),i.pendingCommentMode){cn(l,u.x,u.y);return}if(M()){Ke(!1),Ge?un(l,u):ln(l,u);return}let f=i.wasActivatedByToggle&&!t;dt({element:l,cursorX:u.x,selectedElements:s,shouldDeactivateAfter:f,dragRect:d})},_n=e=>{for(let t of i.frozenElements)if(Jz(t)&&iZ(e,VJ(t)))return t;return null},vn=(e,t,n,a)=>{let c=Jz(i.frozenElement)?i.frozenElement:null,l=ye.selectedElement(),u=()=>yI(e,t).find(rI)??null;if(a&&!i.pendingCommentMode&&!M()){let n=u();n!==null&&mn(n,{x:e,y:t});return}let d=u()??(Jz(i.detectedElement)?i.detectedElement:null),f=l??d??c;if(!f)return;let p,m,h=d===null&&c===f,g=l===f;if(h)p=s().x,m=s().y;else if(g){let e=HJ(VJ(f));p=e.x,m=e.y}else p=e,m=t;if(i.pendingCommentMode){cn(f,p,m),ye.clear();return}if(M()){Ke(!1);let{wasIntercepted:e}=r.hooks.onElementSelect(f);if(e)return;ye.clear(),$I([f]),o.setFrozenElement(f);let t={x:p,y:m};o.setPointer(t),o.freeze(),Ge?un(f,t):ln(f,t);return}let _=i.wasActivatedByToggle&&!n;o.setLastGrabbed(f),dt({element:f,cursorX:p,shouldDeactivateAfter:_}),ye.clear()},yn=()=>{p()&&(Mt(),o.cancelDrag(),nt.stop(),C(`userSelect`,``))},bn=(e,t,n,r)=>{if(!p())return;Ae!==null&&(clearTimeout(Ae),Ae=null),Me(null);let i=Dt(e,t),a=i.x>2||i.y>2,s=a?kt(e,t):null;a?o.endDrag():o.cancelDrag(),Mt(),nt.stop(),C(`userSelect`,``),s?gn(s,n,r):vn(e,t,n,r)},xn=hY(),Sn=YX(),Cn=e=>{let t;try{t=Sn.originalKeyDescriptor?.get?Sn.originalKeyDescriptor.get.call(e):e.key}catch{return!1}let n=t===`Enter`||rZ(e.code),r=d()||u();return n&&r&&!b()&&!ye.isPendingDismiss()&&!i.wasActivatedByToggle?CB(e,`data-react-grab-input`)?!1:(Sn.claimedEvents.add(e),e.preventDefault(),e.stopImmediatePropagation(),!0):!1};xn.addDocumentListener(`keydown`,EM(Cn),{capture:!0}),xn.addDocumentListener(`keyup`,EM(Cn),{capture:!0}),xn.addDocumentListener(`keypress`,EM(Cn),{capture:!0});let wn=()=>{tt.clearHistory(),ye.clear()},Tn=(e,t=!1)=>{o.setFrozenElement(e),o.freeze(),ye.select(e,{shouldPromptBeforeMouseHandoff:t});let n=HJ(VJ(e));o.setPointer(n),i.contextMenuPosition!==null&&o.showContextMenu(n,e)},En=()=>{ye.showDismissPrompt()&&ee(e=>e+1)},Dn=()=>{ye.clear(),o.unfreeze(),wn()},On=()=>{let e=ye.takeSelection(i.frozenElement);if(!e){Dn();return}let t=HJ(VJ(e));wn(),o.setLastGrabbed(e),dt({element:e,cursorX:t.x,shouldDeactivateAfter:i.wasActivatedByToggle})},kn=e=>$M.has(e.key)?e.key:e.key===`Tab`?e.shiftKey?`ArrowLeft`:`ArrowRight`:null,An=(e,t={})=>{if(!d()||b()||j()||ye.isPendingDismiss()&&!t.allowPendingKeyboardSelection)return!1;let n=kn(e);if(!n||pe())return!1;let r=P(),i=!r;if(!r){let e=wM()?.getBoundingClientRect();r=e?bI(e.left+e.width/2,e.top+e.height/2):bI(window.innerWidth/2,window.innerHeight/2)}if(!r)return!1;let a=n===`ArrowUp`||n===`ArrowDown`,o=tt.findNext(n,r);if(!o&&!a&&!i)return!1;let s=o??r;return e.preventDefault(),e.stopPropagation(),Tn(s,!0),!0},jn=e=>e.metaKey||e.ctrlKey||e.altKey||e.repeat||Zz(e)||!d()||_()||v()||pe()?null:i.frozenElement||pt(),Mn=e=>{let t=jn(e);if(!t)return null;let n=jV(r.store.actions,e);return n?{element:t,action:n}:null},Nn=(e,t)=>{let n=VJ(e);return Cr({element:e,filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,tagName:TN(e)||void 0,componentName:Ze(),position:t,shouldDeferHideContextMenu:!1,performWithFeedbackOptions:{fallbackBounds:n,fallbackSelectionBounds:[n],position:t}})},Pn=/^[a-zA-Z0-9-]$/,Fn=e=>{if(!e.key||e.key.length!==1||!Pn.test(e.key))return!1;let t=jn(e);return!t||!de.trigger(t,{x:s().x,y:s().y},{initialSearchQuery:e.key})?!1:(rn(),e.preventDefault(),e.stopImmediatePropagation(),!0)},In=e=>{let t=Mn(e);if(!t)return!1;let{element:n,action:r}=t;if(b())return an(r.id)?(e.preventDefault(),e.stopImmediatePropagation(),!0):!1;let i={x:s().x,y:s().y};return r.onAction(Nn(n,i)),e.preventDefault(),e.stopImmediatePropagation(),!0},Ln=e=>{if(e.key?.toLowerCase()!==`o`||!d()||!(e.metaKey||e.ctrlKey))return!1;let t=i.selectionFilePath,n=i.selectionLineNumber;return t?(e.preventDefault(),e.stopPropagation(),r.hooks.onOpenFile(t,n??void 0)||CI(t,n??void 0,r.hooks.transformOpenFileUrl),!0):!1},Rn=e=>{if(!d()||_()||i.contextMenuPosition!==null||de.isOpen())return!1;let t=e.key===`F10`&&e.shiftKey,n=e.key===`ContextMenu`;if(!t&&!n)return!1;let r=i.frozenElements,a=r.length>1,s=(a?r[0]:null)||i.frozenElement||pt();if(!s)return!1;e.preventDefault(),e.stopPropagation();let c=HJ(VJ(s));return a?$I(r):($I([s]),o.setFrozenElement(s)),o.setPointer(c),o.freeze(),ln(s,c),!0},zn=Y(()=>ht().map(e=>({tagName:TN(e.element)||`element`,componentName:OU(e.element)??void 0,depth:e.depth,isLast:e.isLast}))),Bn=Y(()=>({items:zn(),activeIndex:gt()})),Vn=e=>{if(!(!r.store.options.allowActivationInsideInput&&Zz(e))&&!(!KY(e,r.store.options)&&((e.metaKey||e.ctrlKey)&&!QM.includes(e.key)&&!rZ(e.code)&&(d()&&!i.wasActivatedByToggle?Kt():u()&&(we(),Te(),o.releaseHold())),!rZ(e.code)||!u()))){if((d()||u())&&!b()&&(e.preventDefault(),rZ(e.code)&&e.stopImmediatePropagation()),d()){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e.repeat)return;Pe!==null&&window.clearTimeout(Pe),Pe=window.setTimeout(()=>{Kt()},200);return}if(u()&&e.repeat){if(Fe.copyWaiting){let e=Fe.holdTimerFired;Te(),e&&o.activate()}return}if(!(_()||y())&&!u()){let t=r.store.options.keyHoldDuration??100;Zz(e)?Qz(e)?t+=600:t+=400:$z()&&(t+=600),Te(),o.startHold(t)}}},Hn=e=>{if(!ye.isPendingDismiss())return!1;if(rZ(e.code))return!0;let t=$M.has(e.key),n=Mn(e)!==null;return!t&&!n?!1:t?An(e,{allowPendingKeyboardSelection:!0}):In(e)?(wn(),!0):!1};xn.addWindowListener(`keydown`,EM(e=>{if(kn(e)&&Zz(e)||Hn(e))return;if(Cn(e),!T()){KY(e,r.store.options)&&!e.repeat&&O(e=>e+1);return}let t=rZ(e.code)&&u()&&!b(),n=CB(e,nN);if(b()&&KY(e,r.store.options)&&!e.repeat&&!n){e.preventDefault(),e.stopPropagation(),Xt();return}if(e.key===`Escape`&&pe()){ae()!==null&&kr();return}let a=CB(e,`data-react-grab-ignore-events`)&&!t;if(b()||a)return b()&&!n&&In(e)||(e.key===`Escape`&&(b()?Xt():i.wasActivatedByToggle&&Kt()),a&&$M.has(e.key)&&An(e)),void 0;if(p()&&At(e)){e.repeat||jt(),e.preventDefault(),e.stopPropagation();return}if(e.key===`Escape`&&(u()||i.wasActivatedByToggle)){Kt();return}d()&&!QM.includes(e.key)&&e.preventDefault();let o=Date.now()-Re<200;An(e)||Ln(e)||Rn(e)||In(e)||Fn(e)||o||Vn(e)}),{capture:!0}),xn.addWindowListener(`keyup`,EM(e=>{if(Cn(e))return;if(At(e)&&h()&&(Mt(),e.preventDefault(),e.stopPropagation()),e.key===`Shift`&&j()){p()&&yn(),hn();return}if(CB(e,`data-react-grab-ignore-events`))return;let t=JX(r.store.options),n=t.metaKey||t.ctrlKey?SB()?!e.metaKey:!e.ctrlKey:t.shiftKey&&!e.shiftKey||t.altKey&&!e.altKey,a=r.store.options.activationKey?typeof r.store.options.activationKey==`function`?r.store.options.activationKey(e):WY(r.store.options.activationKey)(e):BY(e.key,e.code);if(y()||ze){(a||n)&&(He(),Kt());return}if(!u()&&!d()||b())return;let s=!!r.store.options.activationKey,c=r.store.options.activationMode===`hold`,l=p();if(d()){let e=fe();if(n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e)return;Kt()}else if(c&&a){if(Pe!==null&&(window.clearTimeout(Pe),Pe=null),e||l)return;Kt()}else!s&&a&&Pe!==null&&(window.clearTimeout(Pe),Pe=null);return}if(a||n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`)return;if(u()||Fe.holdTimerFired&&n){we();let t=(Fe.startTimestamp?Date.now()-Fe.startTimestamp:0)>=200,n=Fe.holdTimerFired&&t&&(r.store.options.allowActivationInsideInput||!Zz(e));Te(),n?o.activate():o.releaseHold()}else Kt()}}),{capture:!0}),xn.addDocumentListener(`copy`,()=>{u()&&(Fe.copyWaiting=!0)}),xn.addWindowListener(`keypress`,EM(Cn),{capture:!0}),xn.addWindowListener(`pointermove`,EM(e=>{if(!e.isPrimary)return;let t=e.pointerType===`touch`;if(o.setTouchMode(t),!CB(e,`data-react-grab-ignore-events`)&&!be()&&!(t&&!u()&&!d())){if((t?u():d())&&!b()&&f()&&!e.shiftKey&&!j()){if(ye.consumeMouseHandoff()){En();return}o.unfreeze(),wn()}fn(e.clientX,e.clientY,e.shiftKey)}}),{passive:!0}),xn.addWindowListener(`pointerdown`,EM(e=>{if(e.button===0&&e.isPrimary&&(o.setTouchMode(e.pointerType===`touch`),_e=!1,!CB(e,`data-react-grab-ignore-events`))){if(fe()){tn(e.clientX,e.clientY)&&(_e=!0,e.preventDefault(),e.stopImmediatePropagation());return}if(b()){let t=Tt();t&&e.clientX>=t.x&&e.clientX<=t.x+t.width&&e.clientY>=t.y&&e.clientY<=t.y+t.height?Yt():Xt();return}if(ye.isPendingDismiss()){e.preventDefault(),e.stopImmediatePropagation();return}if(v()){e.preventDefault(),e.stopImmediatePropagation();return}pn(e.clientX,e.clientY,e.shiftKey)&&(e.pointerId!==void 0&&document.documentElement.setPointerCapture(e.pointerId),e.preventDefault(),e.stopImmediatePropagation())}}),{capture:!0}),xn.addWindowListener(`pointerup`,EM(e=>{if(e.button!==0||!e.isPrimary||CB(e,`data-react-grab-ignore-events`)||fe())return;let t=N()||v()||p(),n=e.metaKey||e.ctrlKey;bn(e.clientX,e.clientY,n,e.shiftKey),t&&(e.preventDefault(),e.stopImmediatePropagation())}),{capture:!0}),xn.addWindowListener(`contextmenu`,EM(e=>{if(!N()||_()||b()||de.isOpen())return;let t=CB(e,`data-react-grab-ignore-events`),n={x:e.clientX,y:e.clientY},r=t&&i.frozenElements.length>1?_n(n):null,a=ye.isPendingDismiss();if(t&&!r&&!a&&!_t())return;if(fe()){e.preventDefault();return}e.preventDefault(),e.stopPropagation();let s=r??bI(e.clientX,e.clientY);if(!s)return;let c=i.frozenElements;c.length>1&&c.includes(s)?$I(c):($I([s]),o.setFrozenElement(s)),o.setPointer(n),o.freeze(),ln(s,n)}),{capture:!0}),xn.addWindowListener(`pointercancel`,EM(e=>{e.isPrimary&&yn()})),xn.addWindowListener(`click`,EM(e=>{if(!CB(e,`data-react-grab-ignore-events`)){if(_e){_e=!1,e.preventDefault(),e.stopImmediatePropagation();return}fe()||(N()||g())&&(e.preventDefault(),e.stopImmediatePropagation(),i.wasActivatedByToggle&&!b()&&!e.shiftKey&&(u()?o.setWasActivatedByToggle(!1):Kt()))}}),{capture:!0}),xn.addDocumentListener(`visibilitychange`,()=>{if(document.hidden){o.clearGrabbedBoxes();let e=i.activationTimestamp;d()&&!b()&&e!==null&&Date.now()-e>500&&Kt()}}),xn.addWindowListener(`blur`,()=>{yn(),u()&&(we(),o.releaseHold(),Te()),Se()}),xn.addWindowListener(`focus`,()=>{Re=Date.now()}),xn.addWindowListener(`focusin`,e=>{CB(e,DM)&&e.stopPropagation()},{capture:!0});let Un=()=>{if(!(i.isTouchMode&&!u()&&!d())&&!be()&&!f()&&!p()&&i.frozenElements.length===0){let e=bI(s().x,s().y);o.setDetectedElement(e)}},Wn=null,Gn=null,Kn=()=>{jY(),Un(),o.incrementViewportVersion(),o.updateContextMenuPosition()};xn.addWindowListener(`scroll`,Kn,{capture:!0});let qn=window.innerWidth,Jn=window.innerHeight;xn.addWindowListener(`resize`,()=>{let e=window.innerWidth,t=window.innerHeight;if(qn>0&&Jn>0){let n=e/qn,r=t/Jn,i=Math.abs(n-r)<cN,a=Math.abs(n-1)>cN;i&&a&&o.setPointer({x:s().x*n,y:s().y*r})}qn=e,Jn=t,Kn()});let Yn=window.visualViewport;if(Yn){let{signal:e}=xn;Yn.addEventListener(`resize`,Kn,{signal:e}),Yn.addEventListener(`scroll`,Kn,{signal:e})}let Xn=()=>{Gn===null&&(Gn=UF(()=>{Gn=null,o.incrementViewportVersion()}))};oR(()=>{if(r.store.theme.enabled&&(d()||_()||i.labelInstances.length>0||i.grabbedBoxes.length>0)){if(Wn!==null)return;Wn=window.setInterval(()=>{Xn()},100);return}Wn!==null&&(window.clearInterval(Wn),Wn=null),Gn!==null&&(WF(Gn),Gn=null)}),pR(()=>{Wn!==null&&window.clearInterval(Wn),Gn!==null&&WF(Gn)}),xn.addDocumentListener(`copy`,EM(e=>{b()||CB(e,`data-react-grab-ignore-events`)||N()&&e.preventDefault()}),{capture:!0}),pR(()=>{xn.abort(),Ae!==null&&window.clearTimeout(Ae),Pe&&window.clearTimeout(Pe),He(),he?.(),he=null,ge?.(),ge=null,rt.forEach(e=>window.clearTimeout(e)),rt.clear(),ot.cancelAllFades(),nt.stop(),C(`userSelect`,``),C(`touchAction`,``),Wt(null),Sn.restore(),CM(null)});let{root:Zn,host:Qn}=qJ(kJ);pR(fY(Qn).cleanup);let $n=Y(()=>r.store.theme.enabled),er=Y(()=>r.store.theme.selectionBox.enabled),tr=Y(()=>r.store.theme.elementLabel.enabled),nr=Y(()=>r.store.theme.dragBox.enabled),rr=Y(()=>y()||ne()&&!f()||de.isInteracting()),ir=Y(()=>Pt().length>0),ar=Y(()=>!$n()||!er()||rr()?!1:ir()?!0:bt()),or=Y(()=>{let e=yt();if(e)return TN(e)||void 0}),sr=Y(()=>!$n()||fe()||!tr()||rr()?!1:bt()),cr=new Map,lr=e=>{let t=e.elements?.filter(Jz)??[],n=e.element,r=null;t.length>0?r=t.map(VJ):n&&Jz(n)&&(r=[VJ(n)]);let i=e.bounds,a=e.boundsMultiple;r&&(i=r.length>1?PY(qY(r)):r[0],e.boundsMultiple!==void 0&&(a=e.boundsMultiple.length>1&&e.boundsMultiple.length===e.elements?.length?r:[i]));let o=cr.get(e.id),s=o?.boundsMultiple,c=s===a||s!==void 0&&a!==void 0&&s.length===a.length&&s.every((e,t)=>e.x===a[t].x&&e.y===a[t].y&&e.width===a[t].width&&e.height===a[t].height);if(o&&o.status===e.status&&o.errorMessage===e.errorMessage&&o.bounds.x===i.x&&o.bounds.y===i.y&&o.bounds.width===i.width&&o.bounds.height===i.height&&c)return o;let l=i.x+i.width/2,u=i.width/2,d;d=e.mouseXOffsetRatio!==void 0&&u>0?l+e.mouseXOffsetRatio*u:e.mouseXOffsetFromCenter===void 0?e.mouseX??l:l+e.mouseXOffsetFromCenter;let f={...e,bounds:i,boundsMultiple:a,mouseX:d};return cr.set(e.id,f),f},ur=Y(()=>{if(!$n()||!r.store.theme.grabbedBoxes.enabled)return[];c();let e=new Set(i.labelInstances.map(e=>e.id));for(let t of cr.keys())e.has(t)||cr.delete(t);return i.labelInstances.map(lr)}),dr=Y(()=>!$n()||!r.store.theme.grabbedBoxes.enabled?[]:(c(),i.grabbedBoxes.map(e=>!e.element||!document.body.contains(e.element)?e:{...e,bounds:VJ(e.element)}))),fr=Y(()=>$n()&&nr()&&N()&&Ot()),pr=Y(()=>_()?`processing`:`hover`),mr=Y(()=>{if(!$n())return!1;let e=tr(),t=b(),n=_(),r=N(),i=p(),a=!!P(),o=ne(),s=f();return!e||t||o&&!s?!1:n?!0:r&&!i&&a}),hr=Y(()=>{c();let e=i.contextMenuElement;return e?VJ(e):null}),gr=Y(()=>(c(),i.contextMenuPosition)),_r=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=i.frozenElements.length;return t>1?`${t} elements`:TN(e)||void 0}),[vr]=JJ(()=>i.frozenElements.length>1?null:i.contextMenuElement),[yr]=cR(()=>i.contextMenuElement,async e=>e?DU(e):null),br=async e=>{o.incrementSelectionInteractionLockDepth();try{return await e()}finally{o.decrementSelectionInteractionLockDepth()}},xr=(e,t,n,r,a)=>async c=>{await br(async()=>{let l=a?.fallbackBounds??null,u=a?.fallbackSelectionBounds??[],d=a?.position??i.contextMenuPosition??s(),f=St(),p=hr()??l,m=t.length>1,h=m?PY(qY(f)):p,g=i.wasActivatedByToggle,_;if(_=m?f:p?[p]:u,o.hideContextMenu(),h){let i=m?h.x+h.width/2:d.x,a=ot.createInstance(h,n||`element`,r,`copying`,{element:e,mouseX:i,elements:m?t:void 0,boundsMultiple:_}),o=!1,s;try{o=await c(),o||(s=`Failed to copy`)}catch(e){s=gY(e,`Action failed`)}ot.updateAfterCopy(a,o,s)}else try{await c()}catch{}g?Kt():o.unfreeze()})},Sr=()=>{setTimeout(()=>{o.hideContextMenu()},0)},Cr=e=>{let{element:t,filePath:n,lineNumber:a,tagName:s,componentName:c,position:l,performWithFeedbackOptions:u,shouldDeferHideContextMenu:f,onBeforeCopy:p,onBeforePrompt:m,customEnterPromptMode:h}=e,g=i.frozenElements.length>0?i.frozenElements:[t],_=f?Sr:o.hideContextMenu,v={element:t,elements:g,filePath:n,lineNumber:a,componentName:c,tagName:s,enterPromptMode:h??(()=>{ot.clearAll(),rn(),m?.(),Ee(t,l.x,l.y),o.setPointer({x:l.x,y:l.y}),o.setFrozenElement(t),De(),d()||Gt(),_()}),enterEditMode:()=>{en(t,l,{filePath:n,lineNumber:a,componentName:c,tagName:s})&&rn(),_()},copy:()=>{rn(),p?.(),dt({element:t,cursorX:l.x,selectedElements:g.length>1?g:void 0,shouldDeactivateAfter:i.wasActivatedByToggle}),_()},hooks:{transformHtmlContent:r.hooks.transformHtmlContent,onOpenFile:r.hooks.onOpenFile,transformOpenFileUrl:r.hooks.transformOpenFileUrl},performWithFeedback:xr(t,g,s,c,u),hideContextMenu:_,cleanup:()=>{i.wasActivatedByToggle?Kt():o.unfreeze()}},y=r.hooks.transformActionContext(v);return{...v,...y}},wr=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=yr(),n=i.contextMenuPosition??s();return Cr({element:e,filePath:t?.filePath,lineNumber:t?.lineNumber??void 0,tagName:_r(),componentName:vr(),position:n,shouldDeferHideContextMenu:!0,onBeforeCopy:()=>{ye.clear()},customEnterPromptMode:()=>{ot.clearAll(),rn(),o.clearInputText(),o.enterPromptMode(n,e),Sr()}})}),Tr=()=>{setTimeout(()=>{o.hideContextMenu(),Kt()},0)},Er=()=>{if(!me)return null;let e=me.getBoundingClientRect(),t=lZ(e);return t===`left`||t===`right`?{x:t===`left`?e.right:e.left,y:e.top+e.height/2,edge:t}:{x:e.left+e.width/2,y:t===`top`?e.bottom:e.top,edge:t}},Dr=()=>{let e=Er();if(e)return e;let t=de.state();return t?{x:t.position.x,y:t.position.y,edge:`bottom`}:null},Or=(e,t)=>{let n=null,r=()=>{let i=e();i&&t(i),n=UF(r)};return r(),()=>{n!==null&&(WF(n),n=null)}};oR(()=>{if(!_t())return;let e=Or(Er,ue);pR(()=>{e(),ue(null)})});let kr=()=>{he?.(),he=null,oe(null)},Ar=()=>{o.hideContextMenu(),kr(),de.dismiss()},jr=()=>{ae()===null?(o.hideContextMenu(),de.isOpen()&&de.closePreservingRenderer(),he?.(),he=Or(Er,oe)):kr()},Mr=e=>{Ce({defaultAction:e})},Nr=e=>{let t=i.labelInstances.find(t=>t.id===e);if(!t?.element||!Jz(t.element))return;let n=t.element,r=HJ(VJ(n)),a={x:t.mouseX??r.x,y:r.y},s=t.elements&&t.elements.length>0?t.elements.filter(e=>Jz(e)):[n];setTimeout(()=>{kr(),de.isOpen()&&de.closePreservingRenderer(),d()||(o.setWasActivatedByToggle(!0),Gt()),o.setPointer(a),o.setFrozenElements(s),s.length>1&&t.bounds&&o.setFrozenDragRect(NY(t.bounds)),o.freeze(),o.showContextMenu(a,n)},0)};oR(()=>{let e=r.store.theme.hue;e===0?Zn.style.filter=``:Zn.style.filter=`hue-rotate(${e}deg)`}),r.store.theme.enabled&&Promise.resolve().then(()=>(mJ(),KU)).then(({ReactGrabRenderer:e})=>{t||(n=QR(()=>X(e,{get selectionVisible(){return ar()},get selectionBounds(){return Tt()},get selectionBoundsMultiple(){return Ft()},get selectionShouldSnap(){return i.frozenElements.length>0||Pt().length>0},get selectionElementsCount(){return i.frozenElements.length},get frozenLabelEntries(){return Lt()},get pendingShiftPreviewEntry(){return Rt()??void 0},get selectionFilePath(){return i.selectionFilePath??void 0},get selectionLineNumber(){return i.selectionLineNumber??void 0},get selectionTagName(){return or()},get selectionComponentName(){return Ze()},get selectionLabelVisible(){return sr()},selectionLabelStatus:`idle`,get hierarchyState(){return Bn()},get hierarchyMenuPosition(){return le()},get labelInstances(){return ur()},get dragVisible(){return fr()},get dragBounds(){return Nt()},get grabbedBoxes(){return dr()},get mouseX(){return Kz(()=>i.frozenElements.length>1)()?void 0:Bt()??zt().x},get isFrozen(){return f()||d()||ne()},get inputValue(){return i.inputText},get isPromptMode(){return b()},onShowContextMenuInstance:Nr,get onLabelInstanceHoverChange(){return ot.handleHoverChange},get onInputChange(){return o.setInputText},onInputSubmit:()=>void Yt(),onToggleExpand:$t,get selectionLabelShakeCount(){return k()},onConfirmDismiss:Zt,get discardPrompt(){return Kz(()=>!!ye.isPendingDismiss())()?{isKeyboardSelection:!0,onConfirm:Zt,onCopy:On}:S()?{onConfirm:Zt,onCancel:Qt}:void 0},get toolbarVisible(){return r.store.theme.toolbar.enabled},get isActive(){return d()},onToggleActive:sn,onActivateAction:on,get activeActionId(){return $e()},get enabled(){return T()},get shakeCount(){return D()},onToolbarStateChange:e=>{A(e),e.enabled!==T()&&(E(e.enabled),e.enabled||(qt(),Ar())),mZ.forEach(t=>t(e))},onSubscribeToToolbarStateChanges:e=>(mZ.add(e),()=>{mZ.delete(e)}),onToolbarSelectHoverChange:re,onToolbarRef:e=>{me=e},get contextMenuPosition(){return gr()},get contextMenuBounds(){return hr()},get contextMenuTagName(){return _r()},get contextMenuComponentName(){return vr()},get contextMenuHasFilePath(){return!!yr()?.filePath},get actions(){return r.store.actions},get actionContext(){return wr()},onContextMenuDismiss:Tr,onContextMenuHide:Sr,get toolbarMenuPosition(){return ae()},get toolbarMenuActions(){return r.store.actions.filter(e=>e.showInToolbarMenu===!0)},get defaultActionId(){return te()?.defaultAction??`copy`},onSetDefaultAction:Mr,onToggleToolbarMenu:jr,onToolbarMenuDismiss:kr,get editPanelState(){return de.state()},get editPanelPosition(){return se()},get onEditPanelDismiss(){return de.dismiss},get onEditPanelSubmit(){return de.submit},get onEditPanelPendingEditsChange(){return de.setPendingEdits},get onEditPanelInteractingChange(){return de.setInteracting}}),Zn))}).catch(e=>{console.warn(`[react-grab] Failed to load renderer:`,e)});let Pr={activate:()=>{o.setPendingCommentMode(!1),!d()&&T()&&Jt()},deactivate:()=>{(d()||_())&&Kt()},toggle:()=>{d()?Kt():T()&&Jt()},comment:dn,isActive:()=>d(),isEnabled:()=>T(),setEnabled:e=>{e!==T()&&(E(e),Ce({enabled:e,collapsed:!e}),e||(qt(),Ar()))},getToolbarState:()=>te()??EV(),setToolbarState:e=>{let t=te()??EV(),n=e.collapsed??t?.collapsed??!1,r={edge:e.edge??t?.edge??`bottom`,ratio:e.ratio??t?.ratio??.5,collapsed:n,enabled:e.enabled??!n,defaultAction:e.defaultAction??t?.defaultAction??`copy`};DV(r),A(r),r.enabled!==T()&&(E(r.enabled),r.enabled||(qt(),Ar())),mZ.forEach(e=>e(r))},onToolbarStateChange:e=>(mZ.add(e),()=>{mZ.delete(e)}),reset:()=>{qt(),Ar(),o.clearGrabbedBoxes(),o.clearLabelInstances(),o.setSelectionSource(null,null)},dispose:()=>{t=!0,pZ=!1,n?.(),he?.(),he=null,ge?.(),ge=null,mZ.clear(),e()},copyElement:async e=>{let t=Array.isArray(e)?e:[e];return t.length!==0&&await ct(t)},getSource:async e=>{let t=await DU(e);return t?{filePath:t.filePath,lineNumber:t.lineNumber,componentName:t.componentName}:null},getStackContext:e=>zU(e,{maxLines:r.store.options.maxContextLines}),getState:()=>({isActive:d(),isDragging:p(),isCopying:_(),isPromptMode:b(),isSelectionBoxVisible:!!ar(),isDragBoxVisible:!!fr(),targetElement:pt(),dragBounds:Nt()??null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:te()}),setOptions:e=>{r.setOptions(e)},registerPlugin:e=>{r.register(e,Pr)},unregisterPlugin:e=>{r.unregister(e)},getPlugins:()=>r.getPluginNames(),getDisplayName:OU};for(let e of fZ)r.register(e,Pr);return setTimeout(()=>{LF(!0)},fN),Pr})}})),_Z=r({DEFAULT_THEME:()=>zX,commentPlugin:()=>oZ,formatElementInfo:()=>HU,generateSnippet:()=>dZ,getGlobalApi:()=>yZ,getStack:()=>yU,init:()=>hZ,isInstrumentationActive:()=>QN,openPlugin:()=>cZ,registerPlugin:()=>CZ,setGlobalApi:()=>bZ,unregisterPlugin:()=>wZ}),vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ=t((()=>{gZ(),eR(),GU(),vZ=null,yZ=()=>typeof window>`u`?vZ:window.__REACT_GRAB__??vZ??null,bZ=e=>{vZ=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},xZ=[],SZ=e=>{for(;xZ.length>0;){let t=xZ.shift();t&&e.registerPlugin(t)}},CZ=e=>{let t=yZ();if(t){t.registerPlugin(e);return}xZ.push(e)},wZ=e=>{let t=yZ();if(t){t.unregisterPlugin(e);return}let n=xZ.findIndex(t=>t.name===e);n!==-1&&xZ.splice(n,1)},typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?vZ=window.__REACT_GRAB__:(vZ=hZ(),window.__REACT_GRAB__=vZ),SZ(vZ),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:vZ})))}));br(),Rr(),mD();var EZ=`linear-grab:context-copied`,DZ=`linear-grab:picker-activated`,OZ=0,kZ=null;function AZ(e){!e||e.grabbedAt===OZ||Cr().then(t=>{if(t.workflowMode!==`local`||e.grabbedAt===OZ)return;let n=()=>{OZ=e.grabbedAt,navigator.clipboard.writeText(uD(e,t)).then(()=>window.dispatchEvent(new CustomEvent(EZ))).catch(()=>{OZ=0})};e.source?.filePath?(kZ&&clearTimeout(kZ),kZ=null,n()):(kZ&&clearTimeout(kZ),kZ=setTimeout(n,900))})}function jZ(e,t=Date.now()){return{tagName:e.tagName||void 0,componentName:e.componentName||void 0,content:e.textContent?e.textContent.slice(0,500):``,source:e.filePath?{filePath:e.filePath,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:e.componentName??null}:null,stackContext:void 0,pageUrl:location.href,grabbedAt:t}}function MZ(e,t){let n=null,r=0;return{plugin:{name:`linear-grab`,hooks:{onElementSelect:i=>{r=Date.now(),n=Cr().then(e=>e.captureShots?RA(i):null);let a=t?.(),o={tagName:i.tagName?.toLowerCase()||void 0,componentName:a?.getDisplayName?.(i)||void 0,content:(i.textContent??``).slice(0,500),source:null,stackContext:void 0,pageUrl:location.href,grabbedAt:r};e([o]);try{a?.getSource?.(i)?.then(t=>{t?.filePath&&e([{...o,source:{filePath:t.filePath,lineNumber:t.lineNumber??null,columnNumber:t.columnNumber??null,componentName:t.componentName??o.componentName??null}}])})}catch{}}}},handleSelection(t){let i=r&&Date.now()-r<4e3?r:Date.now(),a=t.map((e,t)=>jZ(e,i+t));if(!a.length)return;e(a);let o=n;n=null,o&&o.then(t=>{t&&e([{...a[0],screenshotDataUrl:t},...a.slice(1)])})}}}var NZ=!1;async function PZ(){if(yr||NZ)return;NZ=!0;let e=await Promise.resolve().then(()=>(TZ(),_Z));try{e.init()}catch{NZ=!1;return}let t=MZ(e=>{Dr(e),AZ(e[0])},()=>e.getGlobalApi());e.registerPlugin(t.plugin),FA(),window.addEventListener(`react-grab:element-selected`,e=>{t.handleSelection(e.detail.elements??[])})}async function FZ(){if(yr){let e=await chrome.runtime.sendMessage({type:`grab/activate`});if(e&&e.ok===!1)throw Error(e.error??`Cannot activate the picker on this page.`);return}await PZ();let e=await Promise.resolve().then(()=>(TZ(),_Z));window.dispatchEvent(new CustomEvent(DZ)),e.getGlobalApi()?.activate()}function IZ(e){if(!yr)return()=>{};let t=t=>{t?.type===`grab/updated`&&e()};return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)}function LZ(){return new Promise(e=>{let t=document.createElement(`div`);t.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:crosshair;user-select:none;`;let n=document.createElement(`div`);n.style.cssText=`position:fixed;display:none;border:2px solid #5e6ad2;border-radius:4px;box-shadow:0 0 0 100000px rgba(0,0,0,0.35);pointer-events:none;`,t.appendChild(n),document.body.appendChild(t);let r=0,i=0,a=!1,o=e=>({x:Math.min(r,e.clientX),y:Math.min(i,e.clientY),w:Math.abs(e.clientX-r),h:Math.abs(e.clientY-i)}),s=()=>{t.remove(),window.removeEventListener(`keydown`,l,!0)},c=()=>{s(),e(null)},l=e=>{e.key===`Escape`&&(e.stopPropagation(),c())};window.addEventListener(`keydown`,l,!0),t.addEventListener(`pointerdown`,e=>{a=!0,r=e.clientX,i=e.clientY,t.setPointerCapture(e.pointerId)}),t.addEventListener(`pointermove`,e=>{if(!a)return;let t=o(e);n.style.display=`block`,n.style.left=`${t.x}px`,n.style.top=`${t.y}px`,n.style.width=`${t.w}px`,n.style.height=`${t.h}px`}),t.addEventListener(`pointerup`,t=>{let n=o(t);if(s(),n.w<8||n.h<8)return e(null);zA(n).then(t=>{if(!t)return e(null);e({tagName:`region`,componentName:void 0,content:`Region capture ${Math.round(n.w)}×${Math.round(n.h)}`,source:null,stackContext:void 0,screenshotDataUrl:t,pageUrl:location.href,grabbedAt:Date.now()})})})})}Rr(),br(),mD();var RZ=N(`<span class="text-text-faint ml-auto text-[10.5px] font-normal normal-case tabular-nums">`),zZ=N(`<details open class=group><summary class="text-text-dim hover:text-text flex cursor-pointer items-center gap-1.5 text-[11px] font-semibold tracking-wide uppercase select-none"><span aria-hidden class="text-text-faint inline-block w-3 text-center transition-transform group-open:rotate-90">›</span></summary><div class="flex flex-col gap-2 pt-2 pl-4">`),BZ=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center justify-between gap-2"><span class="text-text-faint min-w-0 text-[10.5px] leading-snug">All elements post into ONE issue. Shift+click / drag selects several at once.`),VZ=N(`<div class="flex flex-col gap-1.5"><div class="flex gap-1.5">`),HZ=N(`<span class=text-danger>●`),UZ=N(`<div class="flex flex-col gap-1.5"><span class="text-text-faint text-[10.5px] leading-snug">Captures your screen as a looping GIF (max 30s) the coding agent can watch. Pick this tab in the share dialog, then reproduce the issue.`),WZ=N(`<span class="inline-block min-w-[4ch] text-center">Stop`),GZ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full"></span><span class="text-text min-w-[5ch] text-[12px] tabular-nums"></span><span class="text-text-faint text-[10.5px]">max 0:30`),KZ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span class="text-text-dim text-[12px]">Encoding GIF…`),qZ=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4">`),JZ=N(`<span class="text-success text-[12px] leading-none">✓`),YZ=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M4 4l8 8M12 4l-8 8">`),XZ=N(`<span class="font-mono text-text-dim break-all text-[11px] leading-snug">`),ZZ=N(`<img alt="Element location screenshot"class="border-border bg-bg max-h-32 w-full rounded-md border object-contain">`),QZ=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex items-center justify-between gap-2"><span class="font-mono text-accent min-w-0 truncate text-[12px]"></span><div class="flex shrink-0 items-center gap-1">`),$Z=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">`),eQ=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="M8 2.5v8M4.5 7.5 8 11l3.5-3.5M2.5 13.5h11">`),tQ=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="M2.5 4h11M6.5 4V2.5h3V4M4 4l.7 9a1.5 1.5 0 0 0 1.5 1.4h3.6A1.5 1.5 0 0 0 11.3 13l.7-9M6.5 7v4.5M9.5 7v4.5">`),nQ=N(`<div class="bg-surface border-border flex flex-col gap-2 rounded-lg border p-2.5"><img alt="Screen recording preview"class="border-border bg-bg max-h-44 w-full rounded-md border object-contain"><span class="text-text-faint text-[10.5px] tabular-nums"> KB · <!>s · <!>×</span><label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Attach to issue on create</span></label><div class="flex items-center gap-1">`),rQ=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="M6.5 9.5 9.5 6.5M7.5 4.5 9 3a2.5 2.5 0 0 1 3.5 3.5L11 8M8.5 11.5 7 13a2.5 2.5 0 0 1-3.5-3.5L5 8">`);function iQ(e){return(()=>{var t=zZ(),n=t.firstChild;n.firstChild;var r=n.nextSibling;return P(n,()=>e.title,null),P(n,j(M,{get when(){return e.badge},get children(){var t=RZ();return P(t,()=>e.badge),t}}),null),P(r,()=>e.children),t})()}function aQ(){let e=sr(),t=_r(()=>({queryKey:[`grab`],queryFn:Tr})),n=_r(()=>({queryKey:[`settings`],queryFn:Cr})),r=()=>t.data??[],i=()=>!!(n.data?.linearApiKey||n.data?.linearAccessToken),[a,o]=T(null),s=()=>{o(null),FZ().catch(e=>{o(e instanceof Error&&e.message?e.message:`Cannot activate the picker — open your dev app in the active tab first.`)})},c=async()=>{await kr(),e.invalidateQueries({queryKey:[`grab`]})},[l,u]=T(null),d=async e=>{try{await navigator.clipboard.writeText(uD(e,n.data??{})),u(e.grabbedAt),setTimeout(()=>u(null),1800)}catch{o(`Clipboard was blocked — click the button again.`)}},f=async t=>{await Or(t),e.invalidateQueries({queryKey:[`grab`]})},[p,m]=T(!1),h=async()=>{o(null),m(!0),window.dispatchEvent(new CustomEvent(DZ));try{let e=await LZ();e?await Dr([e]):o(`Region capture failed — try a smaller area (huge scrollers exceed canvas limits), or it was cancelled.`)}finally{m(!1)}},[g,_]=T(BD());ae(VD(_));let[v,y]=T(0);O(()=>{if(g().phase!==`recording`)return;let e=setInterval(()=>y(Date.now()-(BD().startedAt??Date.now())),250);ae(()=>clearInterval(e))});let b=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[x,S]=T(`idle`),[C,w]=T(null),E=async()=>{let e=BD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await xO(e.blob,`recording-${Date.now()}.gif`);return tO(t),t},k=async()=>{w(null),S(`busy`);try{let e=E().then(e=>new Blob([``],{type:`text/plain`}));try{await navigator.clipboard.write([new ClipboardItem({"text/plain":e})])}catch{let t=await e;await navigator.clipboard.writeText(await t.text())}S(`copied`),setTimeout(()=>S(`idle`),2e3)}catch{S(`idle`),await ne(),w(`Direct upload is blocked in this browser — copied the GIF instead. Paste it into a Linear comment and Linear uploads it.`)}},ee=()=>{let e=g().result;if(!e)return;let t=document.createElement(`a`);t.href=e.url,t.download=`linear-grab-recording.gif`,t.click()},[te,A]=T(`idle`),ne=async()=>{let e=g().result;if(e){w(null),A(`busy`);try{try{await navigator.clipboard.write([new ClipboardItem({"image/gif":e.blob})])}catch{let t=await createImageBitmap(e.blob),n=document.createElement(`canvas`);n.width=t.width,n.height=t.height,n.getContext(`2d`).drawImage(t,0,0);let r=await new Promise((e,t)=>n.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`));await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),w(`Browser blocks GIF clipboard — copied the first frame as PNG. Use Download for the animation.`)}A(`copied`),setTimeout(()=>A(`idle`),2e3)}catch(e){A(`idle`),w(e instanceof Error?e.message:`Copy failed.`)}}};return(()=>{var e=qZ();return P(e,j(iQ,{title:`Captured elements`,get badge(){return $e(()=>!!r().length)()?`${r().length}/8`:void 0},get children(){return[j(M,{get when(){return r().length>0},get fallback(){return j(Aj,{title:`No elements captured`,children:`Click "Pick element" below, then use the react-grab overlay on your dev app. Every pick ADDS to this list — Shift+click or drag in the overlay selects several at once. Source info needs a dev build.`})},get children(){var e=BZ(),t=e.firstChild;return t.firstChild,P(e,j(We,{get each(){return r()},children:e=>(()=>{var t=QZ(),n=t.firstChild.firstChild,r=n.nextSibling;return P(n,(()=>{var t=$e(()=>!!e.componentName);return()=>t()?`<${e.componentName}>`:$e(()=>!!e.tagName)()?`<${e.tagName}>`:`Element`})()),P(r,j(vj,{class:`size-7 px-0`,variant:`ghost`,title:`Copy context for a local agent (Claude Code / Cursor) — includes skills & memory paths`,"aria-label":`Copy context`,onClick:()=>void d(e),get children(){return j(M,{get when(){return l()===e.grabbedAt},get fallback(){return $Z()},get children(){return JZ()}})}}),null),P(r,j(vj,{class:`size-7 px-0`,variant:`ghost`,title:`Remove this element`,"aria-label":`Remove element`,onClick:()=>void f(e.grabbedAt),get children(){return YZ()}}),null),P(t,j(M,{get when(){return e.source?.filePath},get children(){var t=XZ();return P(t,()=>e.source.filePath,null),P(t,(()=>{var t=$e(()=>e.source?.lineNumber!=null);return()=>t()?`:${e.source.lineNumber}`:``})(),null),t}}),null),P(t,j(M,{get when(){return e.screenshotDataUrl},get children(){var t=ZZ();return D(()=>it(t,`src`,e.screenshotDataUrl)),t}}),null),t})()}),t),P(t,j(vj,{class:`h-6 shrink-0 px-2 text-[11px]`,variant:`ghost`,onClick:c,children:`Clear all`}),null),e}}),(()=>{var e=VZ(),t=e.firstChild;return P(t,j(vj,{variant:`primary`,class:`min-w-0 flex-1`,onClick:s,children:`Pick element`}),null),P(t,j(M,{when:!yr,get children(){return j(vj,{variant:`ghost`,class:`min-w-0 flex-1`,get loading(){return p()},title:`Drag a rectangle over any part of the page — the shot attaches to the issue`,onClick:()=>void h(),children:`Capture region`})}}),null),P(e,j(M,{get when(){return a()},get children(){return j(jj,{get message(){return a()}})}}),null),e})()]}}),null),P(e,j(iQ,{title:`Recording`,get badge(){return $e(()=>!!g().result)()?`${(g().result.durationMs/1e3).toFixed(1)}s`:void 0},get children(){return[j(M,{get when(){return g().phase===`idle`||g().phase===`error`},get children(){var e=UZ(),t=e.firstChild;return P(e,j(vj,{variant:`ghost`,onClick:()=>void ZD(),get children(){return[HZ(),` Record interaction`]}}),t),P(e,j(M,{get when(){return $e(()=>g().phase===`error`)()&&g().error},get children(){return j(jj,{get message(){return g().error}})}}),null),e}}),j(M,{get when(){return g().phase===`recording`},get children(){var e=GZ(),t=e.firstChild.nextSibling;return t.nextSibling,P(t,()=>b(v())),P(e,j(vj,{variant:`primary`,class:`ml-auto`,onClick:()=>void QD(),get children(){return WZ()}}),null),e}}),j(M,{get when(){return g().phase===`processing`},get children(){var e=KZ(),t=e.firstChild;return P(e,j(yj,{}),t),e}}),j(M,{get when(){return $e(()=>g().phase===`ready`)()&&g().result},children:e=>(()=>{var t=nQ(),n=t.firstChild,r=n.nextSibling,a=r.firstChild,o=a.nextSibling,s=o.nextSibling.nextSibling;s.nextSibling;var c=r.nextSibling,l=c.firstChild,u=c.nextSibling;return P(r,()=>(e().blob.size/1024).toFixed(0),a),P(r,()=>(e().durationMs/1e3).toFixed(1),o),P(r,()=>e().width,s),P(r,()=>e().height,null),l.addEventListener(`change`,e=>eO(e.currentTarget.checked)),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return x()===`busy`},get disabled(){return!i()},get title(){return i()?`Copy markdown — uploads to Linear, copies embeddable link`:`Connect Linear in Settings first`},"aria-label":`Copy markdown`,onClick:()=>void k(),get children(){return j(M,{get when(){return x()===`copied`},get fallback(){return rQ()},get children(){return JZ()}})}}),null),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return te()===`busy`},title:`Copy GIF — paste into a Linear comment and Linear uploads it`,"aria-label":`Copy GIF`,onClick:()=>void ne(),get children(){return j(M,{get when(){return te()===`copied`},get fallback(){return $Z()},get children(){return JZ()}})}}),null),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Download GIF`,"aria-label":`Download GIF`,onClick:ee,get children(){return eQ()}}),null),P(u,j(vj,{variant:`danger`,class:`ml-auto size-7 px-0`,title:`Discard recording`,"aria-label":`Discard recording`,onClick:$D,get children(){return tQ()}}),null),P(t,j(M,{get when(){return C()},get children(){return j(jj,{get message(){return C()}})}}),null),D(()=>it(n,`src`,e().url)),D(()=>l.checked=g().attachOnCreate),t})()})]}}),null),e})()}function oQ(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function sQ(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function cQ(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var lQ=(e,t)=>Math.abs(e-t)<1.01,uQ=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},dQ,fQ=()=>{if(dQ!==void 0)return dQ;if(typeof navigator>`u`)return dQ=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return dQ=!0;let e=navigator.maxTouchPoints;return dQ=navigator.platform===`MacIntel`&&e!==void 0&&e>0},pQ=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},mQ=e=>e,hQ=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},gQ=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(pQ(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(pQ(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},_Q={passive:!0},vQ=typeof window>`u`||`onscrollend`in window,yQ=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&vQ,o=0,s=a?null:uQ(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,_Q),a&&r.addEventListener(`scrollend`,u,_Q),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},bQ=(e,t)=>yQ(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),xQ=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},SQ=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},CQ=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mQ,rangeExtractor:hQ,onChange:()=>{},measureElement:xQ,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=sQ(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!fQ()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,_Q),e.addEventListener(`touchend`,n,_Q),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(fQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=sQ(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=sQ(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=oQ(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=sQ(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=EQ(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=sQ(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=sQ(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return cQ(t[wQ(0,t.length-1,r?e=>n[e*2]:e=>cQ(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(fQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&lQ(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},wQ=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function TQ(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function EQ(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=TQ(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=wQ(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}function DQ(e){let t=Ve(e),n=new CQ(t),[r,i]=tr(n.getVirtualItems()),[a,o]=T(n.getTotalSize()),s=new Proxy(n,{get(e,t){switch(t){case`getVirtualItems`:return()=>r;case`getTotalSize`:return()=>a();default:return Reflect.get(e,t)}}});return s.setOptions(t),ie(()=>{let e=s._didMount();s._willUpdate(),ae(e)}),E(()=>{s.setOptions(Ve(t,e,{onChange:(t,n)=>{var r;t._willUpdate(),i(ar(t.getVirtualItems(),{key:`index`})),o(t.getTotalSize()),(r=e.onChange)==null||r.call(e,t,n)}})),s._willUpdate(),i(ar(n.getVirtualItems(),{key:`index`})),o(n.getTotalSize())}),s}function OQ(e){return DQ(Ve({observeElementRect:gQ,observeElementOffset:bQ,scrollToFn:SQ},e))}Rr();var kQ=3e4,AQ=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,jQ={running:[],review:[]},MQ=null,NQ=new Set;function PQ(e){return NQ.add(e),MQ||(MQ=setInterval(()=>void LQ(),kQ),LQ()),()=>{NQ.delete(e),!NQ.size&&MQ&&(clearInterval(MQ),MQ=null)}}function FQ(){LQ()}function IQ(e){return{id:e.id,identifier:e.identifier,title:e.title,stateName:e.state.name,stateColor:e.state.color,delegateName:e.delegate?.displayName??`Agent`,updatedAt:e.updatedAt,prUrl:e.attachments?.find(e=>AQ.test(e.url))?.url}}async function LQ(){try{let e=await Cr();if(!e.linearApiKey&&!e.linearAccessToken)return;let t=(await uO()).filter(e=>!!e.delegate&&e.state.type===`started`).map(IQ);jQ={running:t.filter(e=>!e.prUrl),review:t.filter(e=>!!e.prUrl)};for(let e of NQ)e(jQ)}catch{}}Rr();function RQ(e,t=6e3){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(Error(`upload timeout`)),t))])}async function zQ(){let e=[];for(let t of await Tr()??[]){let n=t.source?.filePath?` — \`${t.source.filePath}${t.source.lineNumber==null?``:`:${t.source.lineNumber}`}\``:``;if(e.push(`- \`<${t.componentName??t.tagName??`element`}>\`${n}`),t.screenshotDataUrl)try{let n=await RQ(xO(WA(t.screenshotDataUrl),`capture-${t.grabbedAt}.png`));e.push(` `)}catch{}}let t=BD();if(t.result)try{let n=t.result.assetUrl??await RQ(xO(t.result.blob,`recording-${Date.now()}.gif`));tO(n),e.push(``)}catch{}return e.length?`Captured context:\n${e.join(`
|
|
216
|
-
`)}`:null}function
|
|
215
|
+
`)},PX=e=>`style`in e&&e.style instanceof CSSStyleDeclaration,FX=e=>{let t=new Map,n=PX(e)?e:null;return{apply:(e,r)=>{if(n)for(let i of e)t.has(i)||t.set(i,{value:n.style.getPropertyValue(i),priority:n.style.getPropertyPriority(i)}),n.style.setProperty(i,r)},restore:()=>{if(!n){t.clear();return}for(let[e,{value:r,priority:i}]of t)r?n.style.setProperty(e,r,i):n.style.removeProperty(e);t.clear()},hasAppliedStyles:()=>t.size>0}},IX=(e,t)=>{for(let n of t){let t=e.edits.findIndex(e=>e.key===n.key);t>=0?e.edits[t]=n:e.edits.push(n)}},LX=(e,t)=>({element:e.element,preview:e.preview,filePath:e.filePath??``,lineNumber:e.lineNumber??0,edits:t,designTokens:e.designTokens}),RX=e=>{let[t,n]=J(null),[r,i]=J(!1),a=[],o=[],s=e=>{o=e},c=()=>{let r=t()!==null;n(null),i(!1),a=[],o=[],r&&e.onClose?.()},l=()=>{t()?.preview.restore();for(let e=a.length-1;e>=0;e--)a[e].preview.restore();c()},u=e=>{bU(e).then(t=>{t&&n(n=>!n||n.element!==e||n.componentName?n:{...n,componentName:t})})},d=(r,i,a={})=>{if(t()!==null)return!1;let o=pX(r);if(o.length===0)return!1;let s=a.filePath??e.store.selectionFilePath??void 0,c=a.lineNumber??e.store.selectionLineNumber??void 0;return n({element:r,position:i,selectionBounds:VJ(r),properties:o,preview:FX(r),filePath:s,lineNumber:c,componentName:a.componentName,tagName:a.tagName??TN(r),initialSearchQuery:a.initialSearchQuery,designTokens:DX(r)}),u(r),e.isActivated()||e.activateRenderer(),e.actions.setPointer(i),e.actions.setFrozenElement(r),e.actions.freeze(),e.onOpen?.(),!0},f=(r,i)=>{let s=t();if(!s||s.element===r)return!1;let c=pX(r);return c.length===0?!1:((o.length>0||s.preview.hasAppliedStyles())&&a.push(LX(s,o)),o=[],n({element:r,position:i,selectionBounds:VJ(r),properties:c,preview:FX(r),tagName:TN(r),hasSessionEdits:a.some(e=>e.edits.length>0),designTokens:DX(r)}),DU(r).then(e=>{if(e){for(let t of a)t.element===r&&!t.filePath&&(t.filePath=e.filePath,t.lineNumber=e.lineNumber??0);n(t=>!t||t.element!==r||t.filePath?t:{...t,filePath:e.filePath,lineNumber:e.lineNumber??void 0})}}).catch(()=>void 0),u(r),e.actions.setPointer(i),e.actions.setFrozenElement(r),!0)},p=(e,t)=>[...a,LX(e,t)],m=e=>{let t=new Map;for(let n of e){if(n.edits.length===0)continue;let e=t.get(n.element);if(e){!e.filePath&&n.filePath&&(e.filePath=n.filePath,e.lineNumber=n.lineNumber),IX(e,n.edits);continue}t.set(n.element,{filePath:n.filePath,lineNumber:n.lineNumber,edits:[...n.edits],designTokens:n.designTokens})}return Array.from(t.values())},h=e=>{let t=new Set;for(let n of e)n.edits.length>0&&t.add(n.element);for(let n=e.length-1;n>=0;n--){let r=e[n];r.edits.length===0&&!t.has(r.element)&&r.preview.restore()}};return{state:t,trigger:d,switchToElement:f,setPendingEdits:s,dismiss:()=>{t()!==null&&(l(),e.store.wasActivatedByToggle?e.deactivateRenderer():e.actions.unfreeze())},closePreservingRenderer:()=>{t()!==null&&(l(),e.actions.unfreeze())},submit:n=>{let r=t();if(!r)return;let i=r.element,a=p(r,n),o=NX(m(a));h(a),c(),e.store.wasActivatedByToggle||e.actions.unfreeze(),e.performCopyWithLabel({element:i,cursorX:r.position.x,extraPrompt:o||void 0,shouldDeactivateAfter:e.store.wasActivatedByToggle})},resetWithDiscard:l,isOpen:()=>t()!==null,isInteracting:r,setInteracting:i}},zX={enabled:!0,hue:0,selectionBox:{enabled:!0},dragBox:{enabled:!0},grabbedBoxes:{enabled:!0},elementLabel:{enabled:!0},toolbar:{enabled:!0}},BX=(e,t)=>({enabled:t.enabled??e.enabled,hue:t.hue??e.hue,selectionBox:{enabled:t.selectionBox?.enabled??e.selectionBox.enabled},dragBox:{enabled:t.dragBox?.enabled??e.dragBox.enabled},grabbedBoxes:{enabled:t.grabbedBoxes?.enabled??e.grabbedBoxes.enabled},elementLabel:{enabled:t.elementLabel?.enabled??e.elementLabel.enabled},toolbar:{enabled:t.toolbar?.enabled??e.toolbar.enabled}}),VX={activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,activationKey:void 0,getContent:void 0,maxContextLines:3,freezeReactUpdates:!0},HX=(e={})=>{let t=new Map,n={},[r,i]=DJ({theme:zX,options:{...VX,...e},actions:[]}),a=()=>{let r=zX,a={...VX,...e},o=[];for(let{config:e}of t.values())if(e.theme&&(r=BX(r,e.theme)),e.options&&(a={...a,...e.options}),e.actions)for(let t of e.actions)o.push(t);a={...a,...n},i(`theme`,r),i(`options`,a),i(`actions`,o)},o=(e,t)=>{n[e]=t,i(`options`,e,t)},s=[`activationMode`,`keyHoldDuration`,`allowActivationInsideInput`,`activationKey`,`getContent`,`maxContextLines`,`freezeReactUpdates`],c=e=>{for(let t of s)e[t]!==void 0&&o(t,e[t])},l=(e,n)=>{t.has(e.name)&&u(e.name);let r=e.setup?.(n,_)??{};e.theme&&(r.theme=r.theme?BX(BX(zX,e.theme),r.theme):e.theme),e.actions&&(r.actions=[...e.actions,...r.actions??[]]),e.hooks&&(r.hooks=r.hooks?{...e.hooks,...r.hooks}:e.hooks),e.options&&(r.options=r.options?{...e.options,...r.options}:e.options),t.set(e.name,{plugin:e,config:r}),a()},u=e=>{let n=t.get(e);n&&(n.config.cleanup&&n.config.cleanup(),t.delete(e),a())},d=()=>Array.from(t.keys()),f=(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&t(...n)}},p=(e,...n)=>{let r=!1;for(let{config:i}of t.values()){let t=i.hooks?.[e];t&&t(...n)===!0&&(r=!0)}return r},m=async(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&await t(...n)}},h=async(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=await t(i,...r))}return i},g=(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=t(i,...r))}return i},_={onActivate:()=>f(`onActivate`),onDeactivate:()=>f(`onDeactivate`),onElementHover:e=>f(`onElementHover`,e),onElementSelect:e=>{let n=!1,r;for(let{config:i}of t.values()){let t=i.hooks?.onElementSelect;if(t){let i=t(e);i===!0?n=!0:i instanceof Promise&&(n=!0,r=i)}}return{wasIntercepted:n,pendingResult:r}},onDragStart:(e,t)=>f(`onDragStart`,e,t),onDragEnd:(e,t)=>f(`onDragEnd`,e,t),onBeforeCopy:async e=>m(`onBeforeCopy`,e),transformCopyContent:async(e,t)=>h(`transformCopyContent`,e,t),onAfterCopy:(e,t)=>f(`onAfterCopy`,e,t),onCopySuccess:(e,t)=>f(`onCopySuccess`,e,t),onCopyError:e=>f(`onCopyError`,e),onStateChange:e=>f(`onStateChange`,e),onPromptModeChange:(e,t)=>f(`onPromptModeChange`,e,t),onSelectionBox:(e,t,n)=>f(`onSelectionBox`,e,t,n),onDragBox:(e,t)=>f(`onDragBox`,e,t),onGrabbedBox:(e,t)=>f(`onGrabbedBox`,e,t),onElementLabel:(e,t,n)=>f(`onElementLabel`,e,t,n),onContextMenu:(e,t)=>f(`onContextMenu`,e,t),onOpenFile:(e,t)=>p(`onOpenFile`,e,t),transformHtmlContent:async(e,t)=>h(`transformHtmlContent`,e,t),transformAgentContext:async(e,t)=>h(`transformAgentContext`,e,t),transformActionContext:e=>g(`transformActionContext`,e),transformOpenFileUrl:(e,t,n)=>g(`transformOpenFileUrl`,e,t,n)};return{register:l,unregister:u,getPluginNames:d,setOptions:c,store:r,hooks:_}},UX=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,WX=e=>{let t=e.bounds.x+e.bounds.width/2,n=e.bounds.width/2,r=e.mouseX===void 0?void 0:e.mouseX-t;return{id:UX(`label`),bounds:e.bounds,boundsMultiple:e.boundsMultiple,tagName:e.tagName,componentName:e.componentName,status:e.status,createdAt:Date.now(),element:e.element,elements:e.elements,mouseX:e.mouseX,mouseXOffsetFromCenter:r,mouseXOffsetRatio:r!==void 0&&n>0?r/n:void 0,hideArrow:e.hideArrow}},GX=(e,t)=>{let n=new Map,r=e=>{let t=n.get(e);t!==void 0&&(window.clearTimeout(t),n.delete(e))},i=()=>{for(let e of n.values())window.clearTimeout(e);n.clear()},a=()=>{i(),e.clearLabelInstances()},o=t=>{r(t);let i=window.setTimeout(()=>{e.updateLabelInstance(t,`fading`);let r=window.setTimeout(()=>{n.delete(t),e.removeLabelInstance(t)},125);n.set(t,r)},MM);n.set(t,i)};return{createInstance:(t,n,r,i,o)=>{a();let s=WX({bounds:t,tagName:n,componentName:r,status:i,element:o?.element,mouseX:o?.mouseX,elements:o?.elements,boundsMultiple:o?.boundsMultiple,hideArrow:o?.hideArrow});return e.addLabelInstance(s),s.id},createPerElementInstances:(t,n)=>{a();let r=[];for(let i of t){let t=WX({bounds:VJ(i.element),tagName:i.tagName,componentName:i.componentName,status:n,element:i.element,mouseX:i.mouseX});e.addLabelInstance(t),r.push(t.id)}return r},updateAfterCopy:(t,n,r)=>{n?e.updateLabelInstance(t,`copied`):e.updateLabelInstance(t,`error`,r||`Unknown error`),o(t)},cancelAllFades:i,clearAll:a,handleHoverChange:(e,n)=>{if(n){r(e);return}let i=t().find(t=>t.id===e);i&&(i.status===`copied`||i.status===`error`||i.status===`fading`)&&o(e)}}},KX=e=>{let t=window.innerWidth,n=window.innerHeight,r=Math.max(0,e.x),i=Math.min(t,e.x+e.width),a=Math.max(0,e.y),o=Math.min(n,e.y+e.height);return{x:(r+i)/2,y:(a+o)/2}},qX=(e,t,n)=>{let r=[],i=(t,r)=>{let i=KX(n(t)),a=yI(i.x,i.y).filter(e),o=a.indexOf(t);return o===-1?null:a[o+r]??null},a=e=>{let t=i(e,1);return t&&(r.push(e),r.length>50&&(r=r.slice(-50))),t},o=e=>{if(r.length>0){let e=r.pop();if(Jz(e))return e}return i(e,-1)},s=(e,n)=>{let i=e=>n?e.nextElementSibling:e.previousElementSibling,a=i(e);for(;a;){if(t(a))return r=[],a;a=i(a)}return null};return{findNext:(e,t)=>{switch(e){case`ArrowUp`:return a(t);case`ArrowDown`:return o(t);case`ArrowRight`:return s(t,!0);case`ArrowLeft`:return s(t,!1);default:return null}},clearHistory:()=>{r=[]}}},JX=e=>{let{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}=GY(e.activationKey);return{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}},YX=()=>{let e=new WeakSet,t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,`key`),n=!1;if(t?.get&&!t.get.__reactGrabPatched){n=!0;let r=t.get,i=function(){return e.has(this)?``:r.call(this)};i.__reactGrabPatched=!0,Object.defineProperty(KeyboardEvent.prototype,"key",{get:i,configurable:!0})}return{claimedEvents:e,originalKeyDescriptor:t,restore:()=>{n&&t&&Object.defineProperty(KeyboardEvent.prototype,"key",t)}}},XX=(e,t)=>({top:t<25,bottom:t>window.innerHeight-25,left:e<25,right:e>window.innerWidth-25}),ZX=(e,t,n)=>{let r=null,i=()=>{if(!t()){a();return}let o=e(),s=XX(o.x,o.y),c=0,l=0;if(s.top&&(l-=10),s.bottom&&(l+=10),s.left&&(c-=10),s.right&&(c+=10),c!==0||l!==0){let e=window.scrollX,t=window.scrollY;window.scrollBy(c,l);let r=window.scrollX-e,i=window.scrollY-t;(r!==0||i!==0)&&n?.({x:r,y:i})}r=s.top||s.bottom||s.left||s.right?UF(i):null},a=()=>{r!==null&&(WF(r),r=null)};return{start:i,stop:a,isActive:()=>r!==null}},QX=()=>{let e=globalThis;return!!(e.chrome?.runtime?.id||e.browser?.runtime?.id)},$X=e=>{try{let t=`0.1.48`,n=`data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 294 294"><path fill="#ff40e0" d="M145 47c25-20 50-27 67-17 16 9 23 30 20 60 0 2-1 5-1 7l-2 13h-1l-12-4c-8-3-17-5-25-6l-17-3c-10-1-20-1-29-1-10 0-20 0-29 1-6 8-11 16-16 24-5 9-9 17-13 26 4 9 8 18 13 26s10 16 16 24l11 14c5 7 11 13 18 19l10 8s-1 0 0 0l-11 9c-17 14-35 22-49 22-6 0-13-2-18-5-16-9-23-30-20-59 1-3 1-5 1-8-30-12-48-29-48-50 0-18 14-35 41-47 2-1 5-2 7-3 0-2 0-5-1-7-3-30 4-51 20-60 18-10 42-3 68 17M71 201c-1 2-1 4-1 5-2 24 3 41 13 47h1c11 7 30 1 51-15-10-9-18-18-26-29-13-1-26-4-38-8m9-38c-3 9-5 17-7 26 8 2 17 4 25 6-3-5-6-10-9-16-3-5-6-10-9-16m-19-53c-2 1-3 1-5 2-21 10-34 23-34 35 0 13 14 27 39 37 3-12 7-25 12-37-5-12-9-24-12-37m37-10c-8 1-17 3-25 6 2 8 4 16 7 25 3-5 6-11 9-16zm-3-61c-4-1-8 0-12 2-10 7-15 24-13 47 0 2 0 3 1 5 12-4 25-6 38-8 8-10 16-20 26-29-15-11-29-17-40-17m111 2c-4-2-8-3-12-2-11 0-25 5-40 17 10 9 19 19 26 29 13 2 26 4 39 8v-5c3-23-2-40-13-47m-61 23c-7 6-13 13-19 19h37c-6-6-12-13-18-19"/><mask id="a"><path fill="#fff" d="m235 85-133 27 28 133 133-27Z"/></mask><path fill="#ff40e0" d="m137 130 76 11c8 1 9 11 3 15l-28 16-4 32c-1 8-10 10-14 4l-41-66c-3-6 1-13 8-12" mask="url(#a)"/></svg>`)}`;console.log(`%cReact Grab${` v${t}`}%c\nhttps://react-grab.com`,`background: #330039; color: #ffffff; border: 1px solid #d75fcb; padding: 4px 4px 4px 24px; border-radius: 4px; background-image: url("${n}"); background-size: 16px 16px; background-repeat: no-repeat; background-position: 4px center; display: inline-block; margin-bottom: 4px;`,``),e&&navigator.onLine&&!QX()&&fetch(`https://www.react-grab.com/api/version?source=browser&v=${t}&t=${Date.now()}`,{referrerPolicy:`origin`,keepalive:!0,priority:`low`,cache:`no-store`}).then(e=>e.text()).then(e=>{e&&e!==t&&console.warn(`[React Grab] v${t} is outdated (latest: v${e}). Run \`npx grab@latest upgrade\` to upgrade.`)}).catch(()=>null)}catch{}},eZ=e=>typeof e==`object`&&!!e,tZ=e=>{if(!eZ(e))return null;let t={};return typeof e.enabled==`boolean`&&(t.enabled=e.enabled),(e.activationMode===`toggle`||e.activationMode===`hold`)&&(t.activationMode=e.activationMode),typeof e.keyHoldDuration==`number`&&Number.isFinite(e.keyHoldDuration)&&(t.keyHoldDuration=e.keyHoldDuration),typeof e.allowActivationInsideInput==`boolean`&&(t.allowActivationInsideInput=e.allowActivationInsideInput),typeof e.activationKey==`string`&&(t.activationKey=e.activationKey),typeof e.maxContextLines==`number`&&Number.isFinite(e.maxContextLines)&&(t.maxContextLines=e.maxContextLines),typeof e.freezeReactUpdates==`boolean`&&(t.freezeReactUpdates=e.freezeReactUpdates),typeof e.telemetry==`boolean`&&(t.telemetry=e.telemetry),Object.keys(t).length===0?null:t},nZ=()=>{if(typeof window>`u`)return null;try{let e=(document.currentScript instanceof HTMLScriptElement?document.currentScript:null)?.getAttribute(`data-options`);return e?tZ(JSON.parse(e)):null}catch{return null}},rZ=e=>e===`Enter`||e===`NumpadEnter`,iZ=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height,aZ=(e=>({name:e.name,setup:(t,n)=>({actions:[typeof e.contextMenuAction==`function`?e.contextMenuAction(t,n):e.contextMenuAction],cleanup:e.cleanup})}))({name:`copy`,contextMenuAction:{id:`copy`,label:`Copy`,shortcut:`C`,showInToolbarMenu:!0,onAction:e=>{e.copy?.()}}}),oZ={name:`comment`,setup:()=>({actions:[{id:`comment`,label:`Comment`,shortcut:`Enter`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterPromptMode?.()}}]})},sZ={name:`edit`,setup:()=>({actions:[{id:`edit`,label:`Style`,shortcut:`S`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterEditMode?.()}}]})},cZ={name:`open`,actions:[{id:`open`,label:`Open`,shortcut:`O`,enabled:e=>!!e.filePath,onAction:e=>{e.filePath&&(e.hooks.onOpenFile(e.filePath,e.lineNumber)||CI(e.filePath,e.lineNumber,e.hooks.transformOpenFileUrl),e.hideContextMenu(),e.cleanup())}}]},lZ=e=>{let t=e.left+e.width/2,n=e.top+e.height/2,r=n,i=window.innerHeight-n,a=t,o=window.innerWidth-t,s=Math.min(r,i,a,o);return s===r?`top`:s===a?`left`:s===o?`right`:`bottom`},uZ=()=>{let[e,t]=J(!1),[n,r]=J(null),i=MV(),a=()=>{let e=n();return Jz(e)?e:null},o=()=>{r(null),i.clear(),t(!1)};return{selectedElement:a,isPendingDismiss:e,select:(e,n)=>{r(e),t(!1),n?.shouldPromptBeforeMouseHandoff?i.arm():i.clear()},clear:o,consumeMouseHandoff:()=>i.consume()&&a()!==null,showDismissPrompt:()=>a()?e()?!1:(t(!0),!0):(o(),!1),takeSelection:e=>{let t=a()??(Jz(e)?e:null);return o(),t}}},dZ=async(e,t={})=>(await Promise.allSettled(e.map(e=>HU(e,t)))).map(e=>e.status===`fulfilled`?e.value:``),fZ=[aZ,sZ,oZ,cZ],pZ=!1,mZ=new Set,hZ=e=>{if(typeof window>`u`)return mY();let t={enabled:!0,activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,...nZ(),...e};if(t.enabled===!1||pZ)return mY();pZ=!0,CM(t.container??null),$X(t.telemetry!==!1);let{enabled:n,telemetry:r,container:i,...a}=t;return rR(e=>{let t=!1,n,r=HX(a),{store:i,actions:o,pointer:s,viewportVersion:c,current:l}=WJ({keyHoldDuration:r.store.options.keyHoldDuration??100}),u=Y(()=>l().state===`holding`),d=Y(()=>l().state===`active`),f=Y(()=>{let e=l();return e.state===`active`&&e.phase===`frozen`}),p=Y(()=>{let e=l();return e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)}),m=Y(()=>{if(!p())return!1;let e=Math.abs(s().x+window.scrollX-i.dragStart.x),t=Math.abs(s().y+window.scrollY-i.dragStart.y);return e>2||t>2}),h=Y(()=>{let e=l();return e.state===`active`&&e.phase===`dragging-reposition`}),g=Y(()=>{let e=l();return e.state===`active`&&e.phase===`justDragged`}),_=Y(()=>l().state===`copying`),v=Y(()=>i.selectionInteractionLockDepth>0),y=Y(()=>l().state===`justCopied`),b=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode}),x=Y(()=>i.pendingCommentMode||b()),S=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode&&!!e.isPendingDismiss}),C=(e,t)=>{document.body.style[e]=t};oR(dR(d,(e,t)=>{e&&!t?(SL(s().x,s().y),C(`touchAction`,`none`)):!e&&t&&(CL(),C(`touchAction`,``))}));let w=EV(),[T,E]=J(!w||!w.collapsed),[D,O]=J(0),[k,ee]=J(0),[te,A]=J(w),[ne,re]=J(!1),ie=OV(e=>e.shiftKey),[ae,oe]=J(null),[se,ce]=J(null),[le,ue]=J(null),de=RX({store:i,actions:o,isActivated:d,activateRenderer:()=>Gt(),deactivateRenderer:()=>Kt(),performCopyWithLabel:e=>dt(e),onOpen:()=>{kr(),ge?.(),ge=Or(Dr,ce)},onClose:()=>{ge?.(),ge=null,ce(null)}}),fe=Y(()=>i.contextMenuPosition!==null||de.isOpen()),pe=Y(()=>fe()||ae()!==null),me,he=null,ge=null,_e=!1,ve=new WeakMap,ye=uZ(),be=()=>!T()||b()||v()||fe()||ye.isPendingDismiss(),xe=()=>{ve=new WeakMap},Se=()=>{Le(!1),xe()},Ce=e=>{let t=te()??EV(),n={edge:t?.edge??`bottom`,ratio:t?.ratio??.5,collapsed:t?.collapsed??!1,enabled:t?.enabled??!0,defaultAction:t?.defaultAction??`copy`,...e};DV(n),A(n);for(let e of mZ)e(n)},we=()=>{Fe.timerId!==null&&(clearTimeout(Fe.timerId),Fe.timerId=null)},Te=()=>{Fe.copyWaiting=!1,Fe.holdTimerFired=!1,Fe.startTimestamp=null};oR(()=>{if(l().state!==`holding`){we();return}Fe.startTimestamp=Date.now(),Fe.timerId=window.setTimeout(()=>{if(Fe.timerId=null,Fe.copyWaiting){Fe.holdTimerFired=!0;return}o.activate()},i.keyHoldDuration),pR(we)}),oR(()=>{let e=l();if(e.state!==`active`||e.phase!==`justDragged`)return;let t=setTimeout(()=>{o.finishJustDragged()},MM);pR(()=>clearTimeout(t))}),oR(()=>{if(l().state!==`justCopied`)return;let e=setTimeout(()=>{o.finishJustCopied()},MM);pR(()=>clearTimeout(e))}),oR(dR(u,(e,t=!1)=>{!t||e||!d()||(r.store.options.activationMode!==`hold`&&o.setWasActivatedByToggle(!0),r.hooks.onActivate())}));let Ee=(e,t,n)=>{Oe(e,t,n),o.clearInputText()},De=()=>{let e=i.frozenElement||pt();e&&o.enterPromptMode({x:s().x,y:s().y},e)},Oe=(e,t,n)=>{o.setCopyStart({x:t,y:n},e)},ke={lastDetectionTimestamp:0,pendingDetectionScheduledAt:0,latestPointerX:0,latestPointerY:0},Ae=null,[je,Me]=J(null),Ne=(e,t)=>{Ae!==null&&clearTimeout(Ae),Me(null),Ae=window.setTimeout(()=>{Me({x:e,y:t}),Ae=null},32)},Pe=null,Fe={timerId:null,startTimestamp:null,copyWaiting:!1,holdTimerFired:!1},Ie=null,[j,Le]=J(!1),Re=0,ze=!1,Be=null,Ve=()=>{ze=!0,Be!==null&&window.clearTimeout(Be),Be=window.setTimeout(()=>{ze=!1,Be=null},MM)},He=()=>{Be!==null&&(window.clearTimeout(Be),Be=null),ze=!1},Ue=0,We=null,Ge=null,[M,Ke]=J(!1),[qe,Je]=J(null),[Ye,Xe]=J(null),[Ze,Qe]=JJ(Ye),$e=Y(()=>de.isOpen()?oN:x()?aN:M()?qe():d()?iN:null),et=e=>RY(e,rI),tt=qX(rI,et,VJ),nt=ZX(s,()=>p(),e=>{if(h()){if(o.shiftDragStart(e),Ie){Ie={x:Ie.x+e.x,y:Ie.y+e.y};return}let{pageX:t,pageY:n}=Et(s().x,s().y);Ie={x:t,y:n}}}),N=Y(()=>d()&&!_()),rt=new Map,it=(e,t)=>{let n=UX(`grabbed`),i={id:n,bounds:e,createdAt:Date.now(),element:t};o.addGrabbedBox(i),r.hooks.onGrabbedBox(e,t);let a=window.setTimeout(()=>{rt.delete(n),o.removeGrabbedBox(n)},MM+125);rt.set(n,a)},at=async e=>{let t=await Promise.all(e.map(async e=>{let t=await DU(e),n=t?.componentName??null,r=t?.filePath,i=t?.lineNumber??void 0,a=t?.columnNumber??void 0;n||=OU(e);let o=e instanceof HTMLElement?e.innerText?.slice(0,100):void 0;return{tagName:TN(e),id:e.id||void 0,className:e.getAttribute(`class`)||void 0,textContent:o,componentName:n??void 0,filePath:r,lineNumber:i,columnNumber:a}}));window.dispatchEvent(new CustomEvent(`react-grab:element-selected`,{detail:{elements:t}}))},ot=GX(o,()=>i.labelInstances),st=async(e,t,n)=>{He(),l().state!==`copying`&&o.startCopy();let r=!1,i;try{r=await e(),r||(i=`Failed to copy`)}catch(e){i=gY(e,`Action failed`)}if(t)for(let e of t)ot.updateAfterCopy(e,r,i);l().state===`copying`&&(r&&o.completeCopy(),n?Kt():r?(o.activate(),Ve()):o.unfreeze())},ct=(e,t,n)=>{let i=e[0],a=n??(i?OU(i):null),o=i?TN(i):null,s=a??o??void 0;return SY({getContent:r.store.options.getContent,componentName:s,maxContextLines:r.store.options.maxContextLines},r.hooks,e,t)},lt=async(e,t,n)=>{if(e.length===0)return!1;let i=[],a=[];for(let t of e){let{wasIntercepted:e,pendingResult:n}=r.hooks.onElementSelect(t);e||i.push(t),n&&a.push(n),r.store.theme.grabbedBoxes.enabled&&it(VJ(t),t)}await GF();let o=!0;if(i.length>0&&(o=await ct(i,t,n)),a.length>0&&!(await Promise.all(a)).every(Boolean))throw new RV;return at(e),o},ut=e=>{bU(e.primaryElement).then(async t=>{await st(()=>lt(e.targetElements,e.extraPrompt,t??void 0),e.labelInstanceIds.length>0?e.labelInstanceIds:null,e.shouldDeactivateAfter),e.onComplete?.()}).catch(t=>{let n=gY(t,`Action failed`);for(let t of e.labelInstanceIds)ot.updateAfterCopy(t,!1,n);l().state===`copying`&&o.unfreeze()})},dt=e=>{let{element:t,cursorX:n,selectedElements:r,extraPrompt:a,shouldDeactivateAfter:s,onComplete:c,dragRect:l}=e,u=r??[t],d=l??i.frozenDragRect,f=u.length>1,p=!f&&t===yt()?Tt():void 0,m=d&&f?MY(d):p??VJ(t),h=f?m.x+m.width/2:n,g=TN(t);He(),o.startCopy();let _=g?ot.createInstance(m,g,void 0,`copying`,{element:t,mouseX:h,elements:r}):null;ut({primaryElement:t,targetElements:u,labelInstanceIds:_?[_]:[],extraPrompt:a,shouldDeactivateAfter:s,onComplete:c})},ft=e=>{let{elements:t,labelEntries:n,shouldDeactivateAfter:r,onComplete:i}=e,a=t[0];He(),o.startCopy(),ut({primaryElement:a,targetElements:t,labelInstanceIds:ot.createPerElementInstances(n,`copying`),shouldDeactivateAfter:r,onComplete:i})},pt=Y(()=>{if(c(),!N()||m()||v()||ye.isPendingDismiss())return null;let e=i.detectedElement;return Jz(e)?e:null}),P=Y(()=>i.frozenElement||(f()?null:pt())),mt=Y(()=>!d()||b()||j()||_()||pe()||ye.isPendingDismiss()?null:ie()?f()?P():pt()??i.frozenElement:ye.selectedElement()),ht=Y(()=>{let e=mt();return e?FY(e,rI,et):[]}),gt=Y(()=>{let e=mt();return e?Math.max(0,ht().findIndex(t=>t.element===e)):0}),_t=Y(()=>mt()!==null);oR(()=>{let e=i.detectedElement;if(!e)return;let t=setInterval(()=>{Jz(e)||o.setDetectedElement(null)},100);pR(()=>clearInterval(t))}),oR(dR(P,e=>{if(We!==null&&(clearTimeout(We),We=null),!e){Xe(null);return}We=window.setTimeout(()=>{We=null,Xe(e)},100)})),pR(()=>{We!==null&&(clearTimeout(We),We=null)}),oR(()=>{let e=i.frozenElements;pR(tL(e))}),oR(dR(d,e=>{e&&r.store.options.freezeReactUpdates&&pR($L())}));let vt=()=>{if(i.isTouchMode&&p()){let e=i.detectedElement;return!e||qF(e)?void 0:e}let e=P();if(!(!e||qF(e)))return e},yt=Y(()=>vt()),bt=()=>yt()?i.isTouchMode&&p()?N():N()&&!m():!1,xt=RR(()=>i.frozenElements,e=>Y(()=>(c(),VJ(e)))),St=Y(()=>{let e=i.frozenElements;if(e.length===0)return[];let t=i.frozenDragRect;return t&&e.length>1?[MY(t)]:xt().map(e=>e())}),Ct=Y(()=>{if(!j()||i.pendingCommentMode||M())return null;let e=i.detectedElement;return!Jz(e)||qF(e)||i.frozenElements.includes(e)?null:e}),wt=Y(()=>{c();let e=Ct();if(e)return VJ(e)}),Tt=Y(()=>{c();let e=i.frozenElements;if(e.length>0){let t=St();if(e.length===1){let e=t[0];if(e)return e}let n=i.frozenDragRect;return n?t[0]??MY(n):PY(qY(t))}let t=yt();if(t)return VJ(t)}),Et=(e,t)=>({pageX:e+window.scrollX,pageY:t+window.scrollY}),Dt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t);return{x:Math.abs(n-i.dragStart.x),y:Math.abs(r-i.dragStart.y)}},Ot=Y(()=>{if(!p())return!1;let e=Dt(s().x,s().y);return e.x>2||e.y>2}),kt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t),a=Math.min(i.dragStart.x,n),o=Math.min(i.dragStart.y,r),s=Math.abs(n-i.dragStart.x),c=Math.abs(r-i.dragStart.y);return{x:a-window.scrollX,y:o-window.scrollY,width:s,height:c}},At=e=>e.code===`Space`||e.key===` `,jt=()=>{if(!p())return;o.startDragReposition();let{pageX:e,pageY:t}=Et(s().x,s().y);Ie={x:e,y:t}},Mt=()=>{o.stopDragReposition(),Ie=null},Nt=Y(()=>{if(c(),Ot())return PY(kt(s().x,s().y))}),Pt=Y(()=>{if(c(),!Ot())return[];let e=je();if(!e)return[];let t=kt(e.x,e.y),n=kY(t,rI);return(n.length>0?n:kY(t,rI,!1)).map(e=>VJ(e))}),Ft=Y(()=>{let e=Pt();if(e.length>0)return e;let t=wt();return t?[...St(),t]:St()}),It=RR(()=>i.frozenElements,e=>{let t=TN(e)||`element`,n=OU(e)??void 0;return Y(()=>{if(c(),!Jz(e))return null;let r=VJ(e),i=ve.get(e);return{tagName:t,componentName:n,bounds:r,mouseX:i===void 0?void 0:r.x+r.width*i}})}),Lt=Y(()=>{if(b()||i.frozenElements.length<2)return[];let e=[];for(let t of It()){let n=t();n!==null&&e.push(n)}return e}),Rt=Y(()=>{if(b())return null;let e=Ct();return e?(c(),{tagName:TN(e)||`element`,componentName:OU(e)??void 0,bounds:VJ(e),mouseX:s().x}):null}),zt=Y(()=>{if(_()||b()){c();let e=i.frozenElement||pt();return e?{x:HJ(VJ(e)).x+i.copyOffsetFromCenterX,y:i.copyStart.y}:{x:i.copyStart.x,y:i.copyStart.y}}return{x:s().x,y:s().y}}),Bt=Y(()=>{if(!j()||i.frozenElements.length!==1)return;c();let e=i.frozenElements[0];if(!Jz(e))return;let t=ve.get(e);if(t===void 0)return;let n=VJ(e);return n.x+n.width*t});oR(dR(()=>[pt(),i.lastGrabbedElement],([e,t])=>{t&&e&&t!==e&&o.setLastGrabbed(null),e&&r.hooks.onElementHover(e)})),oR(dR(()=>pt(),e=>{let t=++Ue,n=()=>{Ue===t&&o.setSelectionSource(null,null)};if(!e){n();return}DU(e).then(e=>{if(Ue===t){if(!e){n();return}o.setSelectionSource(e.filePath,e.lineNumber)}}).catch(()=>{Ue===t&&o.setSelectionSource(null,null)})}));let Vt=Y(()=>i.grabbedBoxes.map(e=>({id:e.id,bounds:e.bounds,createdAt:e.createdAt}))),Ht=Y(()=>i.labelInstances.map(e=>({id:e.id,status:e.status,tagName:e.tagName,componentName:e.componentName,createdAt:e.createdAt})));oR(dR(Y(()=>{let e=d(),t=p(),n=_(),a=b(),o=pt(),s=Nt(),c=r.store.theme.enabled,l=r.store.theme.selectionBox.enabled,u=r.store.theme.dragBox.enabled,f=Ot(),m=P(),h=y();return{isActive:e,isDragging:t,isCopying:n,isPromptMode:a,isSelectionBoxVisible:!!(c&&l&&e&&!n&&!h&&!t&&m!=null),isDragBoxVisible:!!(c&&u&&e&&!n&&f),targetElement:o,dragBounds:s?{x:s.x,y:s.y,width:s.width,height:s.height}:null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:te()}}),e=>{r.hooks.onStateChange(e)})),oR(dR(()=>{let e=b();return{inputMode:e,position:e?s():uR(s),target:e?pt():uR(pt)}},({inputMode:e,position:t,target:n})=>{r.hooks.onPromptModeChange(e,{x:t.x,y:t.y,targetElement:n})})),oR(dR(()=>[ar(),Tt(),pt()],([e,t,n])=>{r.hooks.onSelectionBox(!!e,t??null,n)})),oR(dR(()=>[fr(),Nt()],([e,t])=>{r.hooks.onDragBox(!!e,t??null)})),oR(dR(()=>{let e=mr();return[e,pr(),e?zt():uR(zt),e?pt():uR(pt),i.selectionFilePath,i.selectionLineNumber]},([e,t,n,i,a,o])=>{r.hooks.onElementLabel(e,t,{x:n.x,y:n.y,content:``,element:i??void 0,tagName:i&&TN(i)||void 0,filePath:a??void 0,lineNumber:o??void 0})}));let Ut=null,Wt=e=>{if(e){if(!Ut){Ut=document.createElement(`style`),Ut.setAttribute(`data-react-grab-cursor`,``);let e=DN();e&&(Ut.nonce=e),kN(Ut),document.head.appendChild(Ut)}Ut.textContent=`* { cursor: ${e} !important; }`}else Ut&&=(Ut.remove(),null)};oR(dR(()=>[d(),_(),b()],([e,t,n])=>{Wt(t?`progress`:e&&!n?`crosshair`:null)}));let Gt=()=>{let e=u();o.activate(),e||r.hooks.onActivate()},Kt=()=>{let e=p(),t=i.previouslyFocusedElement;Mt(),o.deactivate(),de.resetWithDiscard(),kr(),Se(),wn(),ye.clear(),Ke(!1),Je(null),e&&C(`userSelect`,``),Pe&&window.clearTimeout(Pe),nt.stop(),t instanceof HTMLElement&&t!==document.body&&t!==document.activeElement&&Jz(t)&&t.focus({preventScroll:!0}),r.hooks.onDeactivate()},qt=()=>{u()&&o.releaseHold(),d()&&Kt(),He()},Jt=()=>{o.setWasActivatedByToggle(!0),Gt()},Yt=()=>{let e=[...i.frozenElements],t=i.frozenElement||pt(),n=b()?i.inputText.trim():``;if(!t){Kt();return}let r=e.length>0?e:[t],a=r.map(e=>VJ(e))[0],{x:s,y:c}=HJ(a),l=s+i.copyOffsetFromCenterX;o.setPointer({x:s,y:c}),o.exitPromptMode(),o.clearInputText(),dt({element:t,cursorX:l,selectedElements:r,extraPrompt:n||void 0,shouldDeactivateAfter:!0})},Xt=()=>{if(b()){if(S()){o.clearInputText(),Kt();return}o.setPendingDismiss(!0),ee(e=>e+1)}},Zt=()=>{if(ye.isPendingDismiss()){Dn();return}o.clearInputText(),Kt()},Qt=()=>{o.setPendingDismiss(!1)},$t=()=>{if(de.isOpen()){de.dismiss();return}let e=i.frozenElement||pt();e&&en(e,{x:s().x,y:s().y})},en=(e,t,n={})=>de.trigger(e,t,n),tn=(e,t)=>{if(!de.isOpen()||i.contextMenuPosition!==null)return!1;let n=yI(e,t).find(rI);if(!n)return!1;let r=de.switchToElement(n,{x:e,y:t});return r&&$I([n]),r},nn=e=>({filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,componentName:Ze(),tagName:TN(e)||void 0}),rn=()=>{Ge=null,Ke(!1),o.setPendingCommentMode(!1),Je(null)},an=e=>{let t=i.frozenElement||pt();if(!t)return!1;let n={x:s().x,y:s().y},a=r.store.actions.find(t=>t.id===e);return a?e===`edit`?en(t,n,nn(t))?(o.clearInputText(),o.exitPromptMode(),rn(),!0):!0:(o.clearInputText(),o.exitPromptMode(),rn(),a.onAction(Nn(t,n)),!0):(o.clearInputText(),o.exitPromptMode(),rn(),Mr(iN),ln(t,n),!0)},on=e=>{if(d()){if($e()!==e&&b()&&an(e))return;if($e()!==e&&i.pendingCommentMode){o.setPendingCommentMode(!1),Ge=e,Je(e),Ke(!0);return}if($e()!==e&&M()){Ge=e,Je(e);return}Kt();return}T()&&(Ge=e,Je(e),Ke(!0),Jt())},sn=()=>{on(te()?.defaultAction??`copy`)},cn=(e,t,n)=>{rn(),o.clearInputText(),o.enterPromptMode({x:t,y:n},e)},ln=(e,t)=>{Se(),Ar(),o.showContextMenu(t,e),wn(),r.hooks.onContextMenu(e,t)},un=(e,t)=>{let n=Ge;if(Ge=null,Je(null),!n)return;if(n===`edit`){en(e,t,nn(e));return}let i=r.store.actions.find(e=>e.id===n);if(!i){Mr(iN),ln(e,t);return}i.onAction(Nn(e,t))},dn=()=>{if(T()){if(d()&&x()){Kt();return}o.setPendingCommentMode(!0),d()||Jt()}},fn=(e,t,n)=>{let r=n&&j()&&!p()&&!i.pendingCommentMode&&!M();if(be()||f()&&!r)return;if(o.setPointer({x:e,y:t}),ke.latestPointerX=e,ke.latestPointerY=t,r){let n=bI(e,t);n!==i.detectedElement&&o.setDetectedElement(n);return}let a=performance.now(),s=ke.pendingDetectionScheduledAt>0&&a-ke.pendingDetectionScheduledAt<200;if(a-ke.lastDetectionTimestamp>=32&&!s&&(ke.lastDetectionTimestamp=a,ke.pendingDetectionScheduledAt=a,setTimeout(()=>{if(be()){ke.pendingDetectionScheduledAt=0;return}let e=bI(ke.latestPointerX,ke.latestPointerY);e!==i.detectedElement&&o.setDetectedElement(e),ke.pendingDetectionScheduledAt=0})),p()){if(h()){let{pageX:n,pageY:r}=Et(e,t);Ie&&o.shiftDragStart({x:n-Ie.x,y:r-Ie.y}),Ie={x:n,y:r}}Ne(e,t);let n=XX(e,t),r=n.top||n.bottom||n.left||n.right;r&&!nt.isActive()?nt.start():!r&&nt.isActive()&&nt.stop()}},pn=(e,t,n)=>{if(!N()||v())return!1;!n&&j()&&Se();let i=ye.selectedElement()!==null;return o.startDrag({x:e,y:t},n||i),o.setPointer({x:e,y:t}),C(`userSelect`,`none`),Ne(e,t),r.hooks.onDragStart(e+window.scrollX,t+window.scrollY),!0},mn=(e,t)=>{let n=i.frozenElements.includes(e),r=i.frozenElements.length===0;if(!n){let n=AY(VJ(e),t);ve.set(e,n),r&&Qe(OU(e)??void 0)}o.toggleFrozenElement(e),xI();let a=i.frozenElements.includes(e);if(a||ve.delete(e),i.frozenElements.length===0){Se(),o.unfreeze();return}$I(i.frozenElements),Le(!0),o.setPointer(t),o.setLastGrabbed(a?e:i.frozenElements[i.frozenElements.length-1]),o.freeze(),wn()},hn=()=>{let e=i.frozenElements.filter(Jz),t=e.map(e=>{let t=TN(e)||`element`,n=OU(e)??void 0,r=ve.get(e),i=VJ(e);return{element:e,tagName:t,componentName:n,mouseX:r===void 0?i.x+i.width/2:i.x+i.width*r}});if(Se(),e.length===0){o.unfreeze();return}if(e.length===1){dt({element:e[0],cursorX:t[0].mouseX,selectedElements:e,shouldDeactivateAfter:i.wasActivatedByToggle});return}ft({elements:e,labelEntries:t,shouldDeactivateAfter:i.wasActivatedByToggle})},gn=(e,t,n)=>{let a=kY(e,rI),s=a.length>0?a:kY(e,rI,!1);if(s.length===0)return;let c=n&&!i.pendingCommentMode&&!M();if(c&&o.addFrozenElements(s),$I(c?i.frozenElements:s),r.hooks.onDragEnd(s,e),c){let e=s[s.length-1];Le(!0),xI(),o.setPointer(HJ(VJ(e))),o.setLastGrabbed(e),o.freeze(),wn();return}let l=s[0],u=HJ(VJ(l));o.setPointer(u),o.setFrozenElements(s);let d=NY(e);if(o.setFrozenDragRect(d),o.freeze(),o.setLastGrabbed(l),i.pendingCommentMode){cn(l,u.x,u.y);return}if(M()){Ke(!1),Ge?un(l,u):ln(l,u);return}let f=i.wasActivatedByToggle&&!t;dt({element:l,cursorX:u.x,selectedElements:s,shouldDeactivateAfter:f,dragRect:d})},_n=e=>{for(let t of i.frozenElements)if(Jz(t)&&iZ(e,VJ(t)))return t;return null},vn=(e,t,n,a)=>{let c=Jz(i.frozenElement)?i.frozenElement:null,l=ye.selectedElement(),u=()=>yI(e,t).find(rI)??null;if(a&&!i.pendingCommentMode&&!M()){let n=u();n!==null&&mn(n,{x:e,y:t});return}let d=u()??(Jz(i.detectedElement)?i.detectedElement:null),f=l??d??c;if(!f)return;let p,m,h=d===null&&c===f,g=l===f;if(h)p=s().x,m=s().y;else if(g){let e=HJ(VJ(f));p=e.x,m=e.y}else p=e,m=t;if(i.pendingCommentMode){cn(f,p,m),ye.clear();return}if(M()){Ke(!1);let{wasIntercepted:e}=r.hooks.onElementSelect(f);if(e)return;ye.clear(),$I([f]),o.setFrozenElement(f);let t={x:p,y:m};o.setPointer(t),o.freeze(),Ge?un(f,t):ln(f,t);return}let _=i.wasActivatedByToggle&&!n;o.setLastGrabbed(f),dt({element:f,cursorX:p,shouldDeactivateAfter:_}),ye.clear()},yn=()=>{p()&&(Mt(),o.cancelDrag(),nt.stop(),C(`userSelect`,``))},bn=(e,t,n,r)=>{if(!p())return;Ae!==null&&(clearTimeout(Ae),Ae=null),Me(null);let i=Dt(e,t),a=i.x>2||i.y>2,s=a?kt(e,t):null;a?o.endDrag():o.cancelDrag(),Mt(),nt.stop(),C(`userSelect`,``),s?gn(s,n,r):vn(e,t,n,r)},xn=hY(),Sn=YX(),Cn=e=>{let t;try{t=Sn.originalKeyDescriptor?.get?Sn.originalKeyDescriptor.get.call(e):e.key}catch{return!1}let n=t===`Enter`||rZ(e.code),r=d()||u();return n&&r&&!b()&&!ye.isPendingDismiss()&&!i.wasActivatedByToggle?CB(e,`data-react-grab-input`)?!1:(Sn.claimedEvents.add(e),e.preventDefault(),e.stopImmediatePropagation(),!0):!1};xn.addDocumentListener(`keydown`,EM(Cn),{capture:!0}),xn.addDocumentListener(`keyup`,EM(Cn),{capture:!0}),xn.addDocumentListener(`keypress`,EM(Cn),{capture:!0});let wn=()=>{tt.clearHistory(),ye.clear()},Tn=(e,t=!1)=>{o.setFrozenElement(e),o.freeze(),ye.select(e,{shouldPromptBeforeMouseHandoff:t});let n=HJ(VJ(e));o.setPointer(n),i.contextMenuPosition!==null&&o.showContextMenu(n,e)},En=()=>{ye.showDismissPrompt()&&ee(e=>e+1)},Dn=()=>{ye.clear(),o.unfreeze(),wn()},On=()=>{let e=ye.takeSelection(i.frozenElement);if(!e){Dn();return}let t=HJ(VJ(e));wn(),o.setLastGrabbed(e),dt({element:e,cursorX:t.x,shouldDeactivateAfter:i.wasActivatedByToggle})},kn=e=>$M.has(e.key)?e.key:e.key===`Tab`?e.shiftKey?`ArrowLeft`:`ArrowRight`:null,An=(e,t={})=>{if(!d()||b()||j()||ye.isPendingDismiss()&&!t.allowPendingKeyboardSelection)return!1;let n=kn(e);if(!n||pe())return!1;let r=P(),i=!r;if(!r){let e=wM()?.getBoundingClientRect();r=e?bI(e.left+e.width/2,e.top+e.height/2):bI(window.innerWidth/2,window.innerHeight/2)}if(!r)return!1;let a=n===`ArrowUp`||n===`ArrowDown`,o=tt.findNext(n,r);if(!o&&!a&&!i)return!1;let s=o??r;return e.preventDefault(),e.stopPropagation(),Tn(s,!0),!0},jn=e=>e.metaKey||e.ctrlKey||e.altKey||e.repeat||Zz(e)||!d()||_()||v()||pe()?null:i.frozenElement||pt(),Mn=e=>{let t=jn(e);if(!t)return null;let n=jV(r.store.actions,e);return n?{element:t,action:n}:null},Nn=(e,t)=>{let n=VJ(e);return Cr({element:e,filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,tagName:TN(e)||void 0,componentName:Ze(),position:t,shouldDeferHideContextMenu:!1,performWithFeedbackOptions:{fallbackBounds:n,fallbackSelectionBounds:[n],position:t}})},Pn=/^[a-zA-Z0-9-]$/,Fn=e=>{if(!e.key||e.key.length!==1||!Pn.test(e.key))return!1;let t=jn(e);return!t||!de.trigger(t,{x:s().x,y:s().y},{initialSearchQuery:e.key})?!1:(rn(),e.preventDefault(),e.stopImmediatePropagation(),!0)},In=e=>{let t=Mn(e);if(!t)return!1;let{element:n,action:r}=t;if(b())return an(r.id)?(e.preventDefault(),e.stopImmediatePropagation(),!0):!1;let i={x:s().x,y:s().y};return r.onAction(Nn(n,i)),e.preventDefault(),e.stopImmediatePropagation(),!0},Ln=e=>{if(e.key?.toLowerCase()!==`o`||!d()||!(e.metaKey||e.ctrlKey))return!1;let t=i.selectionFilePath,n=i.selectionLineNumber;return t?(e.preventDefault(),e.stopPropagation(),r.hooks.onOpenFile(t,n??void 0)||CI(t,n??void 0,r.hooks.transformOpenFileUrl),!0):!1},Rn=e=>{if(!d()||_()||i.contextMenuPosition!==null||de.isOpen())return!1;let t=e.key===`F10`&&e.shiftKey,n=e.key===`ContextMenu`;if(!t&&!n)return!1;let r=i.frozenElements,a=r.length>1,s=(a?r[0]:null)||i.frozenElement||pt();if(!s)return!1;e.preventDefault(),e.stopPropagation();let c=HJ(VJ(s));return a?$I(r):($I([s]),o.setFrozenElement(s)),o.setPointer(c),o.freeze(),ln(s,c),!0},zn=Y(()=>ht().map(e=>({tagName:TN(e.element)||`element`,componentName:OU(e.element)??void 0,depth:e.depth,isLast:e.isLast}))),Bn=Y(()=>({items:zn(),activeIndex:gt()})),Vn=e=>{if(!(!r.store.options.allowActivationInsideInput&&Zz(e))&&!(!KY(e,r.store.options)&&((e.metaKey||e.ctrlKey)&&!QM.includes(e.key)&&!rZ(e.code)&&(d()&&!i.wasActivatedByToggle?Kt():u()&&(we(),Te(),o.releaseHold())),!rZ(e.code)||!u()))){if((d()||u())&&!b()&&(e.preventDefault(),rZ(e.code)&&e.stopImmediatePropagation()),d()){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e.repeat)return;Pe!==null&&window.clearTimeout(Pe),Pe=window.setTimeout(()=>{Kt()},200);return}if(u()&&e.repeat){if(Fe.copyWaiting){let e=Fe.holdTimerFired;Te(),e&&o.activate()}return}if(!(_()||y())&&!u()){let t=r.store.options.keyHoldDuration??100;Zz(e)?Qz(e)?t+=600:t+=400:$z()&&(t+=600),Te(),o.startHold(t)}}},Hn=e=>{if(!ye.isPendingDismiss())return!1;if(rZ(e.code))return!0;let t=$M.has(e.key),n=Mn(e)!==null;return!t&&!n?!1:t?An(e,{allowPendingKeyboardSelection:!0}):In(e)?(wn(),!0):!1};xn.addWindowListener(`keydown`,EM(e=>{if(kn(e)&&Zz(e)||Hn(e))return;if(Cn(e),!T()){KY(e,r.store.options)&&!e.repeat&&O(e=>e+1);return}let t=rZ(e.code)&&u()&&!b(),n=CB(e,nN);if(b()&&KY(e,r.store.options)&&!e.repeat&&!n){e.preventDefault(),e.stopPropagation(),Xt();return}if(e.key===`Escape`&&pe()){ae()!==null&&kr();return}let a=CB(e,`data-react-grab-ignore-events`)&&!t;if(b()||a)return b()&&!n&&In(e)||(e.key===`Escape`&&(b()?Xt():i.wasActivatedByToggle&&Kt()),a&&$M.has(e.key)&&An(e)),void 0;if(p()&&At(e)){e.repeat||jt(),e.preventDefault(),e.stopPropagation();return}if(e.key===`Escape`&&(u()||i.wasActivatedByToggle)){Kt();return}d()&&!QM.includes(e.key)&&e.preventDefault();let o=Date.now()-Re<200;An(e)||Ln(e)||Rn(e)||In(e)||Fn(e)||o||Vn(e)}),{capture:!0}),xn.addWindowListener(`keyup`,EM(e=>{if(Cn(e))return;if(At(e)&&h()&&(Mt(),e.preventDefault(),e.stopPropagation()),e.key===`Shift`&&j()){p()&&yn(),hn();return}if(CB(e,`data-react-grab-ignore-events`))return;let t=JX(r.store.options),n=t.metaKey||t.ctrlKey?SB()?!e.metaKey:!e.ctrlKey:t.shiftKey&&!e.shiftKey||t.altKey&&!e.altKey,a=r.store.options.activationKey?typeof r.store.options.activationKey==`function`?r.store.options.activationKey(e):WY(r.store.options.activationKey)(e):BY(e.key,e.code);if(y()||ze){(a||n)&&(He(),Kt());return}if(!u()&&!d()||b())return;let s=!!r.store.options.activationKey,c=r.store.options.activationMode===`hold`,l=p();if(d()){let e=fe();if(n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e)return;Kt()}else if(c&&a){if(Pe!==null&&(window.clearTimeout(Pe),Pe=null),e||l)return;Kt()}else!s&&a&&Pe!==null&&(window.clearTimeout(Pe),Pe=null);return}if(a||n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`)return;if(u()||Fe.holdTimerFired&&n){we();let t=(Fe.startTimestamp?Date.now()-Fe.startTimestamp:0)>=200,n=Fe.holdTimerFired&&t&&(r.store.options.allowActivationInsideInput||!Zz(e));Te(),n?o.activate():o.releaseHold()}else Kt()}}),{capture:!0}),xn.addDocumentListener(`copy`,()=>{u()&&(Fe.copyWaiting=!0)}),xn.addWindowListener(`keypress`,EM(Cn),{capture:!0}),xn.addWindowListener(`pointermove`,EM(e=>{if(!e.isPrimary)return;let t=e.pointerType===`touch`;if(o.setTouchMode(t),!CB(e,`data-react-grab-ignore-events`)&&!be()&&!(t&&!u()&&!d())){if((t?u():d())&&!b()&&f()&&!e.shiftKey&&!j()){if(ye.consumeMouseHandoff()){En();return}o.unfreeze(),wn()}fn(e.clientX,e.clientY,e.shiftKey)}}),{passive:!0}),xn.addWindowListener(`pointerdown`,EM(e=>{if(e.button===0&&e.isPrimary&&(o.setTouchMode(e.pointerType===`touch`),_e=!1,!CB(e,`data-react-grab-ignore-events`))){if(fe()){tn(e.clientX,e.clientY)&&(_e=!0,e.preventDefault(),e.stopImmediatePropagation());return}if(b()){let t=Tt();t&&e.clientX>=t.x&&e.clientX<=t.x+t.width&&e.clientY>=t.y&&e.clientY<=t.y+t.height?Yt():Xt();return}if(ye.isPendingDismiss()){e.preventDefault(),e.stopImmediatePropagation();return}if(v()){e.preventDefault(),e.stopImmediatePropagation();return}pn(e.clientX,e.clientY,e.shiftKey)&&(e.pointerId!==void 0&&document.documentElement.setPointerCapture(e.pointerId),e.preventDefault(),e.stopImmediatePropagation())}}),{capture:!0}),xn.addWindowListener(`pointerup`,EM(e=>{if(e.button!==0||!e.isPrimary||CB(e,`data-react-grab-ignore-events`)||fe())return;let t=N()||v()||p(),n=e.metaKey||e.ctrlKey;bn(e.clientX,e.clientY,n,e.shiftKey),t&&(e.preventDefault(),e.stopImmediatePropagation())}),{capture:!0}),xn.addWindowListener(`contextmenu`,EM(e=>{if(!N()||_()||b()||de.isOpen())return;let t=CB(e,`data-react-grab-ignore-events`),n={x:e.clientX,y:e.clientY},r=t&&i.frozenElements.length>1?_n(n):null,a=ye.isPendingDismiss();if(t&&!r&&!a&&!_t())return;if(fe()){e.preventDefault();return}e.preventDefault(),e.stopPropagation();let s=r??bI(e.clientX,e.clientY);if(!s)return;let c=i.frozenElements;c.length>1&&c.includes(s)?$I(c):($I([s]),o.setFrozenElement(s)),o.setPointer(n),o.freeze(),ln(s,n)}),{capture:!0}),xn.addWindowListener(`pointercancel`,EM(e=>{e.isPrimary&&yn()})),xn.addWindowListener(`click`,EM(e=>{if(!CB(e,`data-react-grab-ignore-events`)){if(_e){_e=!1,e.preventDefault(),e.stopImmediatePropagation();return}fe()||(N()||g())&&(e.preventDefault(),e.stopImmediatePropagation(),i.wasActivatedByToggle&&!b()&&!e.shiftKey&&(u()?o.setWasActivatedByToggle(!1):Kt()))}}),{capture:!0}),xn.addDocumentListener(`visibilitychange`,()=>{if(document.hidden){o.clearGrabbedBoxes();let e=i.activationTimestamp;d()&&!b()&&e!==null&&Date.now()-e>500&&Kt()}}),xn.addWindowListener(`blur`,()=>{yn(),u()&&(we(),o.releaseHold(),Te()),Se()}),xn.addWindowListener(`focus`,()=>{Re=Date.now()}),xn.addWindowListener(`focusin`,e=>{CB(e,DM)&&e.stopPropagation()},{capture:!0});let Un=()=>{if(!(i.isTouchMode&&!u()&&!d())&&!be()&&!f()&&!p()&&i.frozenElements.length===0){let e=bI(s().x,s().y);o.setDetectedElement(e)}},Wn=null,Gn=null,Kn=()=>{jY(),Un(),o.incrementViewportVersion(),o.updateContextMenuPosition()};xn.addWindowListener(`scroll`,Kn,{capture:!0});let qn=window.innerWidth,Jn=window.innerHeight;xn.addWindowListener(`resize`,()=>{let e=window.innerWidth,t=window.innerHeight;if(qn>0&&Jn>0){let n=e/qn,r=t/Jn,i=Math.abs(n-r)<cN,a=Math.abs(n-1)>cN;i&&a&&o.setPointer({x:s().x*n,y:s().y*r})}qn=e,Jn=t,Kn()});let Yn=window.visualViewport;if(Yn){let{signal:e}=xn;Yn.addEventListener(`resize`,Kn,{signal:e}),Yn.addEventListener(`scroll`,Kn,{signal:e})}let Xn=()=>{Gn===null&&(Gn=UF(()=>{Gn=null,o.incrementViewportVersion()}))};oR(()=>{if(r.store.theme.enabled&&(d()||_()||i.labelInstances.length>0||i.grabbedBoxes.length>0)){if(Wn!==null)return;Wn=window.setInterval(()=>{Xn()},100);return}Wn!==null&&(window.clearInterval(Wn),Wn=null),Gn!==null&&(WF(Gn),Gn=null)}),pR(()=>{Wn!==null&&window.clearInterval(Wn),Gn!==null&&WF(Gn)}),xn.addDocumentListener(`copy`,EM(e=>{b()||CB(e,`data-react-grab-ignore-events`)||N()&&e.preventDefault()}),{capture:!0}),pR(()=>{xn.abort(),Ae!==null&&window.clearTimeout(Ae),Pe&&window.clearTimeout(Pe),He(),he?.(),he=null,ge?.(),ge=null,rt.forEach(e=>window.clearTimeout(e)),rt.clear(),ot.cancelAllFades(),nt.stop(),C(`userSelect`,``),C(`touchAction`,``),Wt(null),Sn.restore(),CM(null)});let{root:Zn,host:Qn}=qJ(kJ);pR(fY(Qn).cleanup);let $n=Y(()=>r.store.theme.enabled),er=Y(()=>r.store.theme.selectionBox.enabled),tr=Y(()=>r.store.theme.elementLabel.enabled),nr=Y(()=>r.store.theme.dragBox.enabled),rr=Y(()=>y()||ne()&&!f()||de.isInteracting()),ir=Y(()=>Pt().length>0),ar=Y(()=>!$n()||!er()||rr()?!1:ir()?!0:bt()),or=Y(()=>{let e=yt();if(e)return TN(e)||void 0}),sr=Y(()=>!$n()||fe()||!tr()||rr()?!1:bt()),cr=new Map,lr=e=>{let t=e.elements?.filter(Jz)??[],n=e.element,r=null;t.length>0?r=t.map(VJ):n&&Jz(n)&&(r=[VJ(n)]);let i=e.bounds,a=e.boundsMultiple;r&&(i=r.length>1?PY(qY(r)):r[0],e.boundsMultiple!==void 0&&(a=e.boundsMultiple.length>1&&e.boundsMultiple.length===e.elements?.length?r:[i]));let o=cr.get(e.id),s=o?.boundsMultiple,c=s===a||s!==void 0&&a!==void 0&&s.length===a.length&&s.every((e,t)=>e.x===a[t].x&&e.y===a[t].y&&e.width===a[t].width&&e.height===a[t].height);if(o&&o.status===e.status&&o.errorMessage===e.errorMessage&&o.bounds.x===i.x&&o.bounds.y===i.y&&o.bounds.width===i.width&&o.bounds.height===i.height&&c)return o;let l=i.x+i.width/2,u=i.width/2,d;d=e.mouseXOffsetRatio!==void 0&&u>0?l+e.mouseXOffsetRatio*u:e.mouseXOffsetFromCenter===void 0?e.mouseX??l:l+e.mouseXOffsetFromCenter;let f={...e,bounds:i,boundsMultiple:a,mouseX:d};return cr.set(e.id,f),f},ur=Y(()=>{if(!$n()||!r.store.theme.grabbedBoxes.enabled)return[];c();let e=new Set(i.labelInstances.map(e=>e.id));for(let t of cr.keys())e.has(t)||cr.delete(t);return i.labelInstances.map(lr)}),dr=Y(()=>!$n()||!r.store.theme.grabbedBoxes.enabled?[]:(c(),i.grabbedBoxes.map(e=>!e.element||!document.body.contains(e.element)?e:{...e,bounds:VJ(e.element)}))),fr=Y(()=>$n()&&nr()&&N()&&Ot()),pr=Y(()=>_()?`processing`:`hover`),mr=Y(()=>{if(!$n())return!1;let e=tr(),t=b(),n=_(),r=N(),i=p(),a=!!P(),o=ne(),s=f();return!e||t||o&&!s?!1:n?!0:r&&!i&&a}),hr=Y(()=>{c();let e=i.contextMenuElement;return e?VJ(e):null}),gr=Y(()=>(c(),i.contextMenuPosition)),_r=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=i.frozenElements.length;return t>1?`${t} elements`:TN(e)||void 0}),[vr]=JJ(()=>i.frozenElements.length>1?null:i.contextMenuElement),[yr]=cR(()=>i.contextMenuElement,async e=>e?DU(e):null),br=async e=>{o.incrementSelectionInteractionLockDepth();try{return await e()}finally{o.decrementSelectionInteractionLockDepth()}},xr=(e,t,n,r,a)=>async c=>{await br(async()=>{let l=a?.fallbackBounds??null,u=a?.fallbackSelectionBounds??[],d=a?.position??i.contextMenuPosition??s(),f=St(),p=hr()??l,m=t.length>1,h=m?PY(qY(f)):p,g=i.wasActivatedByToggle,_;if(_=m?f:p?[p]:u,o.hideContextMenu(),h){let i=m?h.x+h.width/2:d.x,a=ot.createInstance(h,n||`element`,r,`copying`,{element:e,mouseX:i,elements:m?t:void 0,boundsMultiple:_}),o=!1,s;try{o=await c(),o||(s=`Failed to copy`)}catch(e){s=gY(e,`Action failed`)}ot.updateAfterCopy(a,o,s)}else try{await c()}catch{}g?Kt():o.unfreeze()})},Sr=()=>{setTimeout(()=>{o.hideContextMenu()},0)},Cr=e=>{let{element:t,filePath:n,lineNumber:a,tagName:s,componentName:c,position:l,performWithFeedbackOptions:u,shouldDeferHideContextMenu:f,onBeforeCopy:p,onBeforePrompt:m,customEnterPromptMode:h}=e,g=i.frozenElements.length>0?i.frozenElements:[t],_=f?Sr:o.hideContextMenu,v={element:t,elements:g,filePath:n,lineNumber:a,componentName:c,tagName:s,enterPromptMode:h??(()=>{ot.clearAll(),rn(),m?.(),Ee(t,l.x,l.y),o.setPointer({x:l.x,y:l.y}),o.setFrozenElement(t),De(),d()||Gt(),_()}),enterEditMode:()=>{en(t,l,{filePath:n,lineNumber:a,componentName:c,tagName:s})&&rn(),_()},copy:()=>{rn(),p?.(),dt({element:t,cursorX:l.x,selectedElements:g.length>1?g:void 0,shouldDeactivateAfter:i.wasActivatedByToggle}),_()},hooks:{transformHtmlContent:r.hooks.transformHtmlContent,onOpenFile:r.hooks.onOpenFile,transformOpenFileUrl:r.hooks.transformOpenFileUrl},performWithFeedback:xr(t,g,s,c,u),hideContextMenu:_,cleanup:()=>{i.wasActivatedByToggle?Kt():o.unfreeze()}},y=r.hooks.transformActionContext(v);return{...v,...y}},wr=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=yr(),n=i.contextMenuPosition??s();return Cr({element:e,filePath:t?.filePath,lineNumber:t?.lineNumber??void 0,tagName:_r(),componentName:vr(),position:n,shouldDeferHideContextMenu:!0,onBeforeCopy:()=>{ye.clear()},customEnterPromptMode:()=>{ot.clearAll(),rn(),o.clearInputText(),o.enterPromptMode(n,e),Sr()}})}),Tr=()=>{setTimeout(()=>{o.hideContextMenu(),Kt()},0)},Er=()=>{if(!me)return null;let e=me.getBoundingClientRect(),t=lZ(e);return t===`left`||t===`right`?{x:t===`left`?e.right:e.left,y:e.top+e.height/2,edge:t}:{x:e.left+e.width/2,y:t===`top`?e.bottom:e.top,edge:t}},Dr=()=>{let e=Er();if(e)return e;let t=de.state();return t?{x:t.position.x,y:t.position.y,edge:`bottom`}:null},Or=(e,t)=>{let n=null,r=()=>{let i=e();i&&t(i),n=UF(r)};return r(),()=>{n!==null&&(WF(n),n=null)}};oR(()=>{if(!_t())return;let e=Or(Er,ue);pR(()=>{e(),ue(null)})});let kr=()=>{he?.(),he=null,oe(null)},Ar=()=>{o.hideContextMenu(),kr(),de.dismiss()},jr=()=>{ae()===null?(o.hideContextMenu(),de.isOpen()&&de.closePreservingRenderer(),he?.(),he=Or(Er,oe)):kr()},Mr=e=>{Ce({defaultAction:e})},Nr=e=>{let t=i.labelInstances.find(t=>t.id===e);if(!t?.element||!Jz(t.element))return;let n=t.element,r=HJ(VJ(n)),a={x:t.mouseX??r.x,y:r.y},s=t.elements&&t.elements.length>0?t.elements.filter(e=>Jz(e)):[n];setTimeout(()=>{kr(),de.isOpen()&&de.closePreservingRenderer(),d()||(o.setWasActivatedByToggle(!0),Gt()),o.setPointer(a),o.setFrozenElements(s),s.length>1&&t.bounds&&o.setFrozenDragRect(NY(t.bounds)),o.freeze(),o.showContextMenu(a,n)},0)};oR(()=>{let e=r.store.theme.hue;e===0?Zn.style.filter=``:Zn.style.filter=`hue-rotate(${e}deg)`}),r.store.theme.enabled&&Promise.resolve().then(()=>(mJ(),KU)).then(({ReactGrabRenderer:e})=>{t||(n=QR(()=>X(e,{get selectionVisible(){return ar()},get selectionBounds(){return Tt()},get selectionBoundsMultiple(){return Ft()},get selectionShouldSnap(){return i.frozenElements.length>0||Pt().length>0},get selectionElementsCount(){return i.frozenElements.length},get frozenLabelEntries(){return Lt()},get pendingShiftPreviewEntry(){return Rt()??void 0},get selectionFilePath(){return i.selectionFilePath??void 0},get selectionLineNumber(){return i.selectionLineNumber??void 0},get selectionTagName(){return or()},get selectionComponentName(){return Ze()},get selectionLabelVisible(){return sr()},selectionLabelStatus:`idle`,get hierarchyState(){return Bn()},get hierarchyMenuPosition(){return le()},get labelInstances(){return ur()},get dragVisible(){return fr()},get dragBounds(){return Nt()},get grabbedBoxes(){return dr()},get mouseX(){return Kz(()=>i.frozenElements.length>1)()?void 0:Bt()??zt().x},get isFrozen(){return f()||d()||ne()},get inputValue(){return i.inputText},get isPromptMode(){return b()},onShowContextMenuInstance:Nr,get onLabelInstanceHoverChange(){return ot.handleHoverChange},get onInputChange(){return o.setInputText},onInputSubmit:()=>void Yt(),onToggleExpand:$t,get selectionLabelShakeCount(){return k()},onConfirmDismiss:Zt,get discardPrompt(){return Kz(()=>!!ye.isPendingDismiss())()?{isKeyboardSelection:!0,onConfirm:Zt,onCopy:On}:S()?{onConfirm:Zt,onCancel:Qt}:void 0},get toolbarVisible(){return r.store.theme.toolbar.enabled},get isActive(){return d()},onToggleActive:sn,onActivateAction:on,get activeActionId(){return $e()},get enabled(){return T()},get shakeCount(){return D()},onToolbarStateChange:e=>{A(e),e.enabled!==T()&&(E(e.enabled),e.enabled||(qt(),Ar())),mZ.forEach(t=>t(e))},onSubscribeToToolbarStateChanges:e=>(mZ.add(e),()=>{mZ.delete(e)}),onToolbarSelectHoverChange:re,onToolbarRef:e=>{me=e},get contextMenuPosition(){return gr()},get contextMenuBounds(){return hr()},get contextMenuTagName(){return _r()},get contextMenuComponentName(){return vr()},get contextMenuHasFilePath(){return!!yr()?.filePath},get actions(){return r.store.actions},get actionContext(){return wr()},onContextMenuDismiss:Tr,onContextMenuHide:Sr,get toolbarMenuPosition(){return ae()},get toolbarMenuActions(){return r.store.actions.filter(e=>e.showInToolbarMenu===!0)},get defaultActionId(){return te()?.defaultAction??`copy`},onSetDefaultAction:Mr,onToggleToolbarMenu:jr,onToolbarMenuDismiss:kr,get editPanelState(){return de.state()},get editPanelPosition(){return se()},get onEditPanelDismiss(){return de.dismiss},get onEditPanelSubmit(){return de.submit},get onEditPanelPendingEditsChange(){return de.setPendingEdits},get onEditPanelInteractingChange(){return de.setInteracting}}),Zn))}).catch(e=>{console.warn(`[react-grab] Failed to load renderer:`,e)});let Pr={activate:()=>{o.setPendingCommentMode(!1),!d()&&T()&&Jt()},deactivate:()=>{(d()||_())&&Kt()},toggle:()=>{d()?Kt():T()&&Jt()},comment:dn,isActive:()=>d(),isEnabled:()=>T(),setEnabled:e=>{e!==T()&&(E(e),Ce({enabled:e,collapsed:!e}),e||(qt(),Ar()))},getToolbarState:()=>te()??EV(),setToolbarState:e=>{let t=te()??EV(),n=e.collapsed??t?.collapsed??!1,r={edge:e.edge??t?.edge??`bottom`,ratio:e.ratio??t?.ratio??.5,collapsed:n,enabled:e.enabled??!n,defaultAction:e.defaultAction??t?.defaultAction??`copy`};DV(r),A(r),r.enabled!==T()&&(E(r.enabled),r.enabled||(qt(),Ar())),mZ.forEach(e=>e(r))},onToolbarStateChange:e=>(mZ.add(e),()=>{mZ.delete(e)}),reset:()=>{qt(),Ar(),o.clearGrabbedBoxes(),o.clearLabelInstances(),o.setSelectionSource(null,null)},dispose:()=>{t=!0,pZ=!1,n?.(),he?.(),he=null,ge?.(),ge=null,mZ.clear(),e()},copyElement:async e=>{let t=Array.isArray(e)?e:[e];return t.length!==0&&await ct(t)},getSource:async e=>{let t=await DU(e);return t?{filePath:t.filePath,lineNumber:t.lineNumber,componentName:t.componentName}:null},getStackContext:e=>zU(e,{maxLines:r.store.options.maxContextLines}),getState:()=>({isActive:d(),isDragging:p(),isCopying:_(),isPromptMode:b(),isSelectionBoxVisible:!!ar(),isDragBoxVisible:!!fr(),targetElement:pt(),dragBounds:Nt()??null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:te()}),setOptions:e=>{r.setOptions(e)},registerPlugin:e=>{r.register(e,Pr)},unregisterPlugin:e=>{r.unregister(e)},getPlugins:()=>r.getPluginNames(),getDisplayName:OU};for(let e of fZ)r.register(e,Pr);return setTimeout(()=>{LF(!0)},fN),Pr})}})),_Z=r({DEFAULT_THEME:()=>zX,commentPlugin:()=>oZ,formatElementInfo:()=>HU,generateSnippet:()=>dZ,getGlobalApi:()=>yZ,getStack:()=>yU,init:()=>hZ,isInstrumentationActive:()=>QN,openPlugin:()=>cZ,registerPlugin:()=>CZ,setGlobalApi:()=>bZ,unregisterPlugin:()=>wZ}),vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ=t((()=>{gZ(),eR(),GU(),vZ=null,yZ=()=>typeof window>`u`?vZ:window.__REACT_GRAB__??vZ??null,bZ=e=>{vZ=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},xZ=[],SZ=e=>{for(;xZ.length>0;){let t=xZ.shift();t&&e.registerPlugin(t)}},CZ=e=>{let t=yZ();if(t){t.registerPlugin(e);return}xZ.push(e)},wZ=e=>{let t=yZ();if(t){t.unregisterPlugin(e);return}let n=xZ.findIndex(t=>t.name===e);n!==-1&&xZ.splice(n,1)},typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?vZ=window.__REACT_GRAB__:(vZ=hZ(),window.__REACT_GRAB__=vZ),SZ(vZ),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:vZ})))}));br(),Rr(),mD();var EZ=`linear-grab:context-copied`,DZ=`linear-grab:picker-activated`,OZ=0,kZ=null;function AZ(e){!e||e.grabbedAt===OZ||Cr().then(t=>{if(t.workflowMode!==`local`||e.grabbedAt===OZ)return;let n=()=>{OZ=e.grabbedAt,navigator.clipboard.writeText(uD(e,t)).then(()=>window.dispatchEvent(new CustomEvent(EZ))).catch(()=>{OZ=0})};e.source?.filePath?(kZ&&clearTimeout(kZ),kZ=null,n()):(kZ&&clearTimeout(kZ),kZ=setTimeout(n,900))})}function jZ(e,t=Date.now()){return{tagName:e.tagName||void 0,componentName:e.componentName||void 0,content:e.textContent?e.textContent.slice(0,500):``,source:e.filePath?{filePath:e.filePath,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:e.componentName??null}:null,stackContext:void 0,pageUrl:location.href,grabbedAt:t}}function MZ(e,t){let n=null,r=0;return{plugin:{name:`linear-grab`,hooks:{onElementSelect:i=>{r=Date.now(),n=Cr().then(e=>e.captureShots?RA(i):null);let a=t?.(),o={tagName:i.tagName?.toLowerCase()||void 0,componentName:a?.getDisplayName?.(i)||void 0,content:(i.textContent??``).slice(0,500),source:null,stackContext:void 0,pageUrl:location.href,grabbedAt:r};e([o]);try{a?.getSource?.(i)?.then(t=>{t?.filePath&&e([{...o,source:{filePath:t.filePath,lineNumber:t.lineNumber??null,columnNumber:t.columnNumber??null,componentName:t.componentName??o.componentName??null}}])})}catch{}}}},handleSelection(t){let i=r&&Date.now()-r<4e3?r:Date.now(),a=t.map((e,t)=>jZ(e,i+t));if(!a.length)return;e(a);let o=n;n=null,o&&o.then(t=>{t&&e([{...a[0],screenshotDataUrl:t},...a.slice(1)])})}}}var NZ=!1;async function PZ(){if(yr||NZ)return;NZ=!0;let e=await Promise.resolve().then(()=>(TZ(),_Z));try{e.init()}catch{NZ=!1;return}let t=MZ(e=>{Dr(e),AZ(e[0])},()=>e.getGlobalApi());e.registerPlugin(t.plugin),FA(),window.addEventListener(`react-grab:element-selected`,e=>{t.handleSelection(e.detail.elements??[])})}async function FZ(){if(yr){let e=await chrome.runtime.sendMessage({type:`grab/activate`});if(e&&e.ok===!1)throw Error(e.error??`Cannot activate the picker on this page.`);return}await PZ();let e=await Promise.resolve().then(()=>(TZ(),_Z));window.dispatchEvent(new CustomEvent(DZ)),e.getGlobalApi()?.activate()}function IZ(e){if(!yr)return()=>{};let t=t=>{t?.type===`grab/updated`&&e()};return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)}function LZ(){return new Promise(e=>{let t=document.createElement(`div`);t.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:crosshair;user-select:none;`;let n=document.createElement(`div`);n.style.cssText=`position:fixed;display:none;border:2px solid #5e6ad2;border-radius:4px;box-shadow:0 0 0 100000px rgba(0,0,0,0.35);pointer-events:none;`,t.appendChild(n),document.body.appendChild(t);let r=0,i=0,a=!1,o=e=>({x:Math.min(r,e.clientX),y:Math.min(i,e.clientY),w:Math.abs(e.clientX-r),h:Math.abs(e.clientY-i)}),s=()=>{t.remove(),window.removeEventListener(`keydown`,l,!0)},c=()=>{s(),e(null)},l=e=>{e.key===`Escape`&&(e.stopPropagation(),c())};window.addEventListener(`keydown`,l,!0),t.addEventListener(`pointerdown`,e=>{a=!0,r=e.clientX,i=e.clientY,t.setPointerCapture(e.pointerId)}),t.addEventListener(`pointermove`,e=>{if(!a)return;let t=o(e);n.style.display=`block`,n.style.left=`${t.x}px`,n.style.top=`${t.y}px`,n.style.width=`${t.w}px`,n.style.height=`${t.h}px`}),t.addEventListener(`pointerup`,t=>{let n=o(t);if(s(),n.w<8||n.h<8)return e(null);zA(n).then(t=>{if(!t)return e(null);e({tagName:`region`,componentName:void 0,content:`Region capture ${Math.round(n.w)}×${Math.round(n.h)}`,source:null,stackContext:void 0,screenshotDataUrl:t,pageUrl:location.href,grabbedAt:Date.now()})})})})}Rr(),br(),mD();var RZ=N(`<span class="text-text-faint ml-auto text-[10.5px] font-normal normal-case tabular-nums">`),zZ=N(`<details open class=group><summary class="text-text-dim hover:text-text flex cursor-pointer items-center gap-1.5 text-[11px] font-semibold tracking-wide uppercase select-none"><span aria-hidden class="text-text-faint inline-block w-3 text-center transition-transform group-open:rotate-90">›</span></summary><div class="flex flex-col gap-2 pt-2 pl-4">`),BZ=N(`<p class="text-warn text-[10.5px] leading-snug">Several captures resolve to the same source — this page region likely renders inside an iframe/canvas the picker can't see into. Use <b>Capture region</b> for visual pointers there.`),VZ=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center justify-between gap-2"><span class="text-text-faint min-w-0 text-[10.5px] leading-snug">All elements post into ONE issue. Shift+click / drag selects several at once.`),HZ=N(`<div class="flex flex-col gap-1.5"><div class="flex gap-1.5">`),UZ=N(`<span class=text-danger>●`),WZ=N(`<div class="flex flex-col gap-1.5"><span class="text-text-faint text-[10.5px] leading-snug">Captures your screen as a looping GIF (max 30s) the coding agent can watch. Pick this tab in the share dialog, then reproduce the issue.`),GZ=N(`<span class="inline-block min-w-[4ch] text-center">Stop`),KZ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full"></span><span class="text-text min-w-[5ch] text-[12px] tabular-nums"></span><span class="text-text-faint text-[10.5px]">max 0:30`),qZ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span class="text-text-dim text-[12px]">Encoding GIF…`),JZ=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4">`),YZ=N(`<span class="text-success text-[12px] leading-none">✓`),XZ=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M4 4l8 8M12 4l-8 8">`),ZZ=N(`<span class="font-mono text-text-dim break-all text-[11px] leading-snug">`),QZ=N(`<img alt="Element location screenshot"class="border-border bg-bg max-h-32 w-full rounded-md border object-contain">`),$Z=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex items-center justify-between gap-2"><span class="font-mono text-accent min-w-0 truncate text-[12px]"></span><div class="flex shrink-0 items-center gap-1">`),eQ=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">`),tQ=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="M8 2.5v8M4.5 7.5 8 11l3.5-3.5M2.5 13.5h11">`),nQ=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="M2.5 4h11M6.5 4V2.5h3V4M4 4l.7 9a1.5 1.5 0 0 0 1.5 1.4h3.6A1.5 1.5 0 0 0 11.3 13l.7-9M6.5 7v4.5M9.5 7v4.5">`),rQ=N(`<div class="bg-surface border-border flex flex-col gap-2 rounded-lg border p-2.5"><img alt="Screen recording preview"class="border-border bg-bg max-h-44 w-full rounded-md border object-contain"><span class="text-text-faint text-[10.5px] tabular-nums"> KB · <!>s · <!>×</span><label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Attach to issue on create</span></label><div class="flex items-center gap-1">`),iQ=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="M6.5 9.5 9.5 6.5M7.5 4.5 9 3a2.5 2.5 0 0 1 3.5 3.5L11 8M8.5 11.5 7 13a2.5 2.5 0 0 1-3.5-3.5L5 8">`);function aQ(e){return(()=>{var t=zZ(),n=t.firstChild;n.firstChild;var r=n.nextSibling;return P(n,()=>e.title,null),P(n,j(M,{get when(){return e.badge},get children(){var t=RZ();return P(t,()=>e.badge),t}}),null),P(r,()=>e.children),t})()}function oQ(){let e=sr(),t=_r(()=>({queryKey:[`grab`],queryFn:Tr})),n=_r(()=>({queryKey:[`settings`],queryFn:Cr})),r=()=>t.data??[],i=()=>!!(n.data?.linearApiKey||n.data?.linearAccessToken),[a,o]=T(null),s=()=>{o(null),FZ().catch(e=>{o(e instanceof Error&&e.message?e.message:`Cannot activate the picker — open your dev app in the active tab first.`)})},c=async()=>{await kr(),e.invalidateQueries({queryKey:[`grab`]})},[l,u]=T(null),d=async e=>{try{await navigator.clipboard.writeText(uD(e,n.data??{})),u(e.grabbedAt),setTimeout(()=>u(null),1800)}catch{o(`Clipboard was blocked — click the button again.`)}},f=async t=>{await Or(t),e.invalidateQueries({queryKey:[`grab`]})},[p,m]=T(!1),h=async()=>{o(null),m(!0),window.dispatchEvent(new CustomEvent(DZ));try{let e=await LZ();e?await Dr([e]):o(`Region capture failed — try a smaller area (huge scrollers exceed canvas limits), or it was cancelled.`)}finally{m(!1)}},[g,_]=T(BD());ae(VD(_));let[v,y]=T(0);O(()=>{if(g().phase!==`recording`)return;let e=setInterval(()=>y(Date.now()-(BD().startedAt??Date.now())),250);ae(()=>clearInterval(e))});let b=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[x,S]=T(`idle`),[C,w]=T(null),E=async()=>{let e=BD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await xO(e.blob,`recording-${Date.now()}.gif`);return tO(t),t},k=async()=>{w(null),S(`busy`);try{let e=E().then(e=>new Blob([``],{type:`text/plain`}));try{await navigator.clipboard.write([new ClipboardItem({"text/plain":e})])}catch{let t=await e;await navigator.clipboard.writeText(await t.text())}S(`copied`),setTimeout(()=>S(`idle`),2e3)}catch{S(`idle`),await ne(),w(`Direct upload is blocked in this browser — copied the GIF instead. Paste it into a Linear comment and Linear uploads it.`)}},ee=()=>{let e=g().result;if(!e)return;let t=document.createElement(`a`);t.href=e.url,t.download=`linear-grab-recording.gif`,t.click()},[te,A]=T(`idle`),ne=async()=>{let e=g().result;if(e){w(null),A(`busy`);try{try{await navigator.clipboard.write([new ClipboardItem({"image/gif":e.blob})])}catch{let t=await createImageBitmap(e.blob),n=document.createElement(`canvas`);n.width=t.width,n.height=t.height,n.getContext(`2d`).drawImage(t,0,0);let r=await new Promise((e,t)=>n.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`));await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),w(`Browser blocks GIF clipboard — copied the first frame as PNG. Use Download for the animation.`)}A(`copied`),setTimeout(()=>A(`idle`),2e3)}catch(e){A(`idle`),w(e instanceof Error?e.message:`Copy failed.`)}}};return(()=>{var e=JZ();return P(e,j(aQ,{title:`Captured elements`,get badge(){return $e(()=>!!r().length)()?`${r().length}/8`:void 0},get children(){return[j(M,{get when(){return r().length>0},get fallback(){return j(Aj,{title:`No elements captured`,children:`Click "Pick element" below, then use the react-grab overlay on your dev app. Every pick ADDS to this list — Shift+click or drag in the overlay selects several at once. Source info needs a dev build.`})},get children(){var e=VZ(),t=e.firstChild;return t.firstChild,P(e,j(We,{get each(){return r()},children:e=>(()=>{var t=$Z(),n=t.firstChild.firstChild,r=n.nextSibling;return P(n,(()=>{var t=$e(()=>!!e.componentName);return()=>t()?`<${e.componentName}>`:$e(()=>!!e.tagName)()?`<${e.tagName}>`:`Element`})()),P(r,j(vj,{class:`size-7 px-0`,variant:`ghost`,title:`Copy context for a local agent (Claude Code / Cursor) — includes skills & memory paths`,"aria-label":`Copy context`,onClick:()=>void d(e),get children(){return j(M,{get when(){return l()===e.grabbedAt},get fallback(){return eQ()},get children(){return YZ()}})}}),null),P(r,j(vj,{class:`size-7 px-0`,variant:`ghost`,title:`Remove this element`,"aria-label":`Remove element`,onClick:()=>void f(e.grabbedAt),get children(){return XZ()}}),null),P(t,j(M,{get when(){return e.source?.filePath},get children(){var t=ZZ();return P(t,()=>e.source.filePath,null),P(t,(()=>{var t=$e(()=>e.source?.lineNumber!=null);return()=>t()?`:${e.source.lineNumber}`:``})(),null),t}}),null),P(t,j(M,{get when(){return e.screenshotDataUrl},get children(){var t=QZ();return D(()=>it(t,`src`,e.screenshotDataUrl)),t}}),null),t})()}),t),P(e,j(M,{get when(){return new Set(r().filter(e=>e.source?.filePath).map(e=>`${e.source.filePath}:${e.source.lineNumber??``}`)).size<r().filter(e=>e.source?.filePath).length},get children(){return BZ()}}),t),P(t,j(vj,{class:`h-6 shrink-0 px-2 text-[11px]`,variant:`ghost`,onClick:c,children:`Clear all`}),null),e}}),(()=>{var e=HZ(),t=e.firstChild;return P(t,j(vj,{variant:`primary`,class:`min-w-0 flex-1`,onClick:s,children:`Pick element`}),null),P(t,j(M,{when:!yr,get children(){return j(vj,{variant:`ghost`,class:`min-w-0 flex-1`,get loading(){return p()},title:`Drag a rectangle over any part of the page — the shot attaches to the issue`,onClick:()=>void h(),children:`Capture region`})}}),null),P(e,j(M,{get when(){return a()},get children(){return j(jj,{get message(){return a()}})}}),null),e})()]}}),null),P(e,j(aQ,{title:`Recording`,get badge(){return $e(()=>!!g().result)()?`${(g().result.durationMs/1e3).toFixed(1)}s`:void 0},get children(){return[j(M,{get when(){return g().phase===`idle`||g().phase===`error`},get children(){var e=WZ(),t=e.firstChild;return P(e,j(vj,{variant:`ghost`,onClick:()=>void ZD(),get children(){return[UZ(),` Record interaction`]}}),t),P(e,j(M,{get when(){return $e(()=>g().phase===`error`)()&&g().error},get children(){return j(jj,{get message(){return g().error}})}}),null),e}}),j(M,{get when(){return g().phase===`recording`},get children(){var e=KZ(),t=e.firstChild.nextSibling;return t.nextSibling,P(t,()=>b(v())),P(e,j(vj,{variant:`primary`,class:`ml-auto`,onClick:()=>void QD(),get children(){return GZ()}}),null),e}}),j(M,{get when(){return g().phase===`processing`},get children(){var e=qZ(),t=e.firstChild;return P(e,j(yj,{}),t),e}}),j(M,{get when(){return $e(()=>g().phase===`ready`)()&&g().result},children:e=>(()=>{var t=rQ(),n=t.firstChild,r=n.nextSibling,a=r.firstChild,o=a.nextSibling,s=o.nextSibling.nextSibling;s.nextSibling;var c=r.nextSibling,l=c.firstChild,u=c.nextSibling;return P(r,()=>(e().blob.size/1024).toFixed(0),a),P(r,()=>(e().durationMs/1e3).toFixed(1),o),P(r,()=>e().width,s),P(r,()=>e().height,null),l.addEventListener(`change`,e=>eO(e.currentTarget.checked)),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return x()===`busy`},get disabled(){return!i()},get title(){return i()?`Copy markdown — uploads to Linear, copies embeddable link`:`Connect Linear in Settings first`},"aria-label":`Copy markdown`,onClick:()=>void k(),get children(){return j(M,{get when(){return x()===`copied`},get fallback(){return iQ()},get children(){return YZ()}})}}),null),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return te()===`busy`},title:`Copy GIF — paste into a Linear comment and Linear uploads it`,"aria-label":`Copy GIF`,onClick:()=>void ne(),get children(){return j(M,{get when(){return te()===`copied`},get fallback(){return eQ()},get children(){return YZ()}})}}),null),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Download GIF`,"aria-label":`Download GIF`,onClick:ee,get children(){return tQ()}}),null),P(u,j(vj,{variant:`danger`,class:`ml-auto size-7 px-0`,title:`Discard recording`,"aria-label":`Discard recording`,onClick:$D,get children(){return nQ()}}),null),P(t,j(M,{get when(){return C()},get children(){return j(jj,{get message(){return C()}})}}),null),D(()=>it(n,`src`,e().url)),D(()=>l.checked=g().attachOnCreate),t})()})]}}),null),e})()}function sQ(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function cQ(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function lQ(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var uQ=(e,t)=>Math.abs(e-t)<1.01,dQ=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},fQ,pQ=()=>{if(fQ!==void 0)return fQ;if(typeof navigator>`u`)return fQ=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return fQ=!0;let e=navigator.maxTouchPoints;return fQ=navigator.platform===`MacIntel`&&e!==void 0&&e>0},mQ=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},hQ=e=>e,gQ=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},_Q=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(mQ(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(mQ(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},vQ={passive:!0},yQ=typeof window>`u`||`onscrollend`in window,bQ=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&yQ,o=0,s=a?null:dQ(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,vQ),a&&r.addEventListener(`scrollend`,u,vQ),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},xQ=(e,t)=>bQ(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),SQ=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},CQ=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},wQ=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:hQ,rangeExtractor:gQ,onChange:()=>{},measureElement:SQ,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=cQ(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!pQ()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,vQ),e.addEventListener(`touchend`,n,vQ),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(pQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=cQ(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=cQ(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=sQ(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=cQ(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=DQ(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=cQ(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=cQ(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return lQ(t[TQ(0,t.length-1,r?e=>n[e*2]:e=>lQ(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(pQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&uQ(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},TQ=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function EQ(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function DQ(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=EQ(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=TQ(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}function OQ(e){let t=Ve(e),n=new wQ(t),[r,i]=tr(n.getVirtualItems()),[a,o]=T(n.getTotalSize()),s=new Proxy(n,{get(e,t){switch(t){case`getVirtualItems`:return()=>r;case`getTotalSize`:return()=>a();default:return Reflect.get(e,t)}}});return s.setOptions(t),ie(()=>{let e=s._didMount();s._willUpdate(),ae(e)}),E(()=>{s.setOptions(Ve(t,e,{onChange:(t,n)=>{var r;t._willUpdate(),i(ar(t.getVirtualItems(),{key:`index`})),o(t.getTotalSize()),(r=e.onChange)==null||r.call(e,t,n)}})),s._willUpdate(),i(ar(n.getVirtualItems(),{key:`index`})),o(n.getTotalSize())}),s}function kQ(e){return OQ(Ve({observeElementRect:_Q,observeElementOffset:xQ,scrollToFn:CQ},e))}Rr();var AQ=3e4,jQ=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,MQ={running:[],review:[]},NQ=null,PQ=new Set;function FQ(e){return PQ.add(e),NQ||(NQ=setInterval(()=>void RQ(),AQ),RQ()),()=>{PQ.delete(e),!PQ.size&&NQ&&(clearInterval(NQ),NQ=null)}}function IQ(){RQ()}function LQ(e){return{id:e.id,identifier:e.identifier,title:e.title,stateName:e.state.name,stateColor:e.state.color,delegateName:e.delegate?.displayName??`Agent`,updatedAt:e.updatedAt,prUrl:e.attachments?.find(e=>jQ.test(e.url))?.url}}async function RQ(){try{let e=await Cr();if(!e.linearApiKey&&!e.linearAccessToken)return;let t=(await uO()).filter(e=>!!e.delegate&&e.state.type===`started`).map(LQ);MQ={running:t.filter(e=>!e.prUrl),review:t.filter(e=>!!e.prUrl)};for(let e of PQ)e(MQ)}catch{}}Rr();function zQ(e,t=6e3){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(Error(`upload timeout`)),t))])}async function BQ(){let e=[];for(let t of await Tr()??[]){let n=t.source?.filePath?` — \`${t.source.filePath}${t.source.lineNumber==null?``:`:${t.source.lineNumber}`}\``:``;if(e.push(`- \`<${t.componentName??t.tagName??`element`}>\`${n}`),t.screenshotDataUrl)try{let n=await zQ(xO(WA(t.screenshotDataUrl),`capture-${t.grabbedAt}.png`));e.push(` `)}catch{}}let t=BD();if(t.result)try{let n=t.result.assetUrl??await zQ(xO(t.result.blob,`recording-${Date.now()}.gif`));tO(n),e.push(``)}catch{}return e.length?`Captured context:\n${e.join(`
|
|
216
|
+
`)}`:null}function VQ(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var HQ=/^(https?:\/\/|mailto:)/i,UQ=/\.(mp4|mov|webm|m4v)(\?|#|$)/i,WQ=/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/i,GQ=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`,GQ);var KQ=null;function qQ(e){KQ=e?e.replace(/\/$/,``):null}function JQ(e){try{if(KQ&&new URL(e).hostname.endsWith(`uploads.linear.app`))return`${KQ}/fetch?url=${encodeURIComponent(e)}`}catch{}return e}function YQ(e){let t=e;return t=t.replace(/`([^`]+)`/g,(e,t)=>`<code>${t}</code>`),t=t.replace(/!\[([^\]]*)\]\((?:<)?([^()\s]+?)(?:>)?\)/g,(e,t,n)=>{if(!HQ.test(n))return t;let r=JQ(n);return UQ.test(n)?`<video controls preload="metadata" src="${r}"></video>`:r!==n&&!WQ.test(n)?`<lg-media src="${r}" alt="${t}"></lg-media>`:`<img src="${r}" alt="${t}" loading="lazy" />`}),t=t.replace(/\[([^\]]+)\]\((?:<)?([^()\s]+?)(?:>)?\)/g,(e,t,n)=>HQ.test(n)?`<a href="${n}" target="_blank" rel="noopener noreferrer">${t}</a>`:t),t=t.replace(/<(https?:\/\/[^\s&]+)>/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 XQ(e){let t=VQ(e.trim()).split(`
|
|
217
217
|
`),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(`
|
|
218
|
-
`)}</code></pre>`);continue}let i=e.match(/^(#{1,6})\s+(.*)$/);if(i){n.push(`<h4>${JQ(i[2])}</h4>`),r++;continue}if(/^\s*[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*[-*]\s+/.test(t[r]);)e.push(`<li>${JQ(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>${JQ(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>${JQ(a.join(`<br />`))}</p>`)}return n.join(``)}Rr();var XQ=N(`<div class="lg-md text-text text-[12px] leading-relaxed break-words">`),ZQ=N(`<div class="flex h-full flex-col">`),QQ=N(`<span class="tabular-nums text-[10.5px] text-text-faint">live · updated `),$Q=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">`),e$=N(`<div class="flex-1 overflow-y-auto">`),t$=N(`<div class="min-h-0 flex-1 overflow-y-auto pl-2 pr-3"><div style=position:relative>`),n$=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">`),r$=N(`<div style=position:absolute;top:0;left:0;width:100%>`),i$=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">`),a$=N(`<span class="inline-block min-w-[6ch] text-left">← Back`),o$=N(`<span class="font-mono text-[11px] text-text-dim shrink-0">`),s$=N(`<span class="truncate text-[12px] font-medium text-text">`),c$=N(`<span class="text-[11.5px] text-text-faint">Loading…`),l$=N(`<div class="flex items-center gap-2"><span class="text-[11px] text-text-dim">`),u$=N(`<div class="flex flex-col gap-2">`),d$=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">`),f$=N(`<div class="flex flex-col gap-2.5"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Comments`),p$=N(`<option value=new>Start NEW agent (@<!>)`),m$=N(`<option value=comment>Comment only`),h$=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">`),g$=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>`),_$=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">`),v$=N(`<span class="inline-block min-w-[4ch] text-left">Send`),y$=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">`),b$=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><button class="hover:bg-surface-2 flex h-9 w-full min-w-0 cursor-pointer items-center gap-2 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">`),x$=N(`<span class="inline-block min-w-[6ch] text-center">Merge`),S$=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">`),C$=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">`),w$=N(`<option>Steer running agent<!> · `),T$=N(`<span class="bg-danger inline-block size-2.5 rounded-full"aria-hidden>`),E$=N(`<span class="text-[11px] text-text-dim">`),D$=N(`<p class="text-[12px] text-text leading-relaxed whitespace-pre-wrap break-words">`),O$=N(`<div class="flex flex-col gap-0.5 border-t border-border pt-1.5 mt-0.5">`),k$=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">`),A$=N(`<div class="flex items-start gap-1.5"><span class="tabular-nums text-[10px] text-text-faint shrink-0 mt-px"></span><span class="text-[11px] text-text-dim break-words min-w-0">`);function j$(e){let t=k(()=>YQ(e.text));return(()=>{var e=XQ();return D(()=>e.innerHTML=t()),e})()}function M$(){let[e,t]=T(null);return O(()=>{let e=qA();e&&(t(e),XA())}),(()=>{var n=ZQ();return P(n,j(M,{get when(){return e()===null},get fallback(){return j(F$,{get issueId(){return e()},onBack:()=>t(null)})},get children(){return j(N$,{onSelect:e=>t(e)})}})),n})()}function N$(e){let t,n=_r(()=>({queryKey:[`my-issues`],queryFn:uO,refetchInterval:12e3})),r=k(()=>n.data??[]),i=OQ({get count(){return r().length},getScrollElement:()=>t,estimateSize:()=>56,overscan:5});return(()=>{var a=n$(),o=a.firstChild.firstChild.nextSibling;return P(o,j(M,{get when(){return n.dataUpdatedAt>0},get children(){var e=QQ();return e.firstChild,P(e,()=>Nj(n.dataUpdatedAt),null),e}}),null),P(o,j(vj,{class:`size-7 px-0`,get loading(){return n.isFetching},onClick:()=>void n.refetch(),title:`Refresh`,"aria-label":`Refresh issues`,get children(){return $Q()}}),null),P(a,j(M,{get when(){return n.isError},get children(){var e=e$();return P(e,j(Aj,{title:`Connect Linear in Settings`,get children(){return n.error?.message??`Unable to load issues.`}})),e}}),null),P(a,j(M,{get when(){return $e(()=>!n.isError&&!n.isPending)()&&r().length===0},get children(){var e=e$();return P(e,j(Aj,{title:`No issues found`,children:`Issues you create will appear here.`})),e}}),null),P(a,j(M,{get when(){return $e(()=>!n.isError)()&&r().length>0},get children(){var n=t$(),a=n.firstChild,o=t;return typeof o==`function`?pt(o,n):t=n,P(a,j(We,{get each(){return i.getVirtualItems()},children:t=>{let n=k(()=>r()[t.index]);return(()=>{var r=r$();return P(r,j(P$,{get issue(){return n()},get onSelect(){return e.onSelect}})),D(e=>dt(r,`transform`,`translateY(${t.start}px)`)),r})()}})),D(e=>dt(a,`height`,`${i.getTotalSize()}px`)),n}}),null),a})()}function P$(e){return(()=>{var t=i$(),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(kj,{get color(){return e.issue.state.color}}),r),P(r,()=>e.issue.identifier),P(i,()=>e.issue.title),P(a,j(Oj,{get children(){return e.issue.state.name}}),o),P(a,j(M,{get when(){return e.issue.delegate},get children(){return j(Oj,{class:`text-accent`,get children(){return[j(Cj,{}),` `,$e(()=>e.issue.delegate.displayName)]}})}}),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(Oj,{color:`var(--color-warn)`,children:`needs review`})}}),o),P(o,()=>Nj(e.issue.updatedAt)),t})()}function F$(e){let t=sr(),n=_r(()=>({queryKey:[`issue`,e.issueId],queryFn:()=>dO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),r=_r(()=>({queryKey:[`sessions`,e.issueId],queryFn:()=>fO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),i=_r(()=>({queryKey:[`settings`],queryFn:Cr})),a=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:5e3,retry:0})),o=k(()=>{let e=n.data?.identifier;return e?a.data?.find(t=>t.title.startsWith(e)):void 0}),s=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`},[c,l]=T(``),[u,d]=T(null),[f,p]=T(0),m=_r(()=>({queryKey:[`grab`],queryFn:Tr,enabled:ZA()===`composer`})),[h,g]=T(!1),_=async()=>{g(!0),d(null);try{let e=await zQ();e?l(t=>`${t?`${t}\n`:``}${e}\n`):d(`Nothing captured yet — pick an element, capture a region, or record first.`)}catch(e){d(e instanceof Error?e.message:`Attach failed.`)}finally{g(!1)}},v=()=>{if(ZA()===`composer`){$A(`capture`);return}p(Date.now()),$A(`composer`),FZ().catch(()=>$A(`capture`))};O(()=>{if(ZA()!==`composer`)return;let e=(m.data??[]).filter(e=>e.grabbedAt>f());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(`
|
|
219
|
-
`);l(e=>`${e?`${e}\n`:``}${t}\n`),p(Math.max(...e.map(e=>e.grabbedAt)))});let[y,b]=T(BD());ae(VD(b));let x=!1;O(()=>{y().phase===`ready`&&x&&(x=!1,_())});let S=()=>{y().phase===`recording`?QD():(x=!0,ZD())},C=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,w=k(()=>(n.data?.attachments??[]).map(e=>e.url).filter(e=>C.test(e))),E=_r(()=>({queryKey:[`pr-status`,w().sort().join(`|`)],queryFn:()=>IO(w()),refetchInterval:3e4,retry:0,enabled:w().length>0})),ee=e=>ne().has(e)?`MERGED`:E.data?.[e],[te,A]=T(null),[ne,re]=T(new Set),[ie,oe]=T(null),se=async n=>{oe(null),A(n);try{await LO(n),re(e=>new Set(e).add(n)),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`my-issues`]}),FQ()}catch(e){oe(e instanceof Error?`${e.message} (bridge must be running; gh needs merge rights)`:`Merge failed.`)}finally{A(null)}},ce=k(()=>n.data?yO(n.data.comments):[]),[le,ue]=T(`comment`),de=!1;O(()=>{if(de||!n.data||!i.data)return;de=!0;let e=ce();e.length?ue(`thread:${e[0].id}`):n.data.delegate&&i.data.cursorAgentId&&ue(`new`)});let fe=vr(()=>({mutationFn:async()=>{let t=c().trim();if(!t)throw Error(`Message is empty`);let n=i.data??{},r=le();r.startsWith(`thread:`)?await _O(e.issueId,t,r.slice(7)):r===`new`&&n.cursorAgentId?await vO(e.issueId,t,{name:n.cursorAgentName,displayName:n.cursorAgentName??`Cursor`,url:n.cursorAgentUrl}):await _O(e.issueId,t)},onSuccess:()=>{l(``),d(null),$A(`capture`),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),FQ()},onError:e=>{d(e.message??`Failed to send`)}})),pe=k(()=>n.data),me=k(()=>r.data??[]);return(()=>{var t=y$(),r=t.firstChild,a=r.firstChild,d=r.nextSibling,f=d.nextSibling,p=f.firstChild;return P(a,j(vj,{class:`min-w-[68px] shrink-0 text-[11px]`,get onClick(){return e.onBack},get children(){return a$()}}),null),P(a,j(M,{get when(){return pe()},get children(){return[(()=>{var e=o$();return P(e,()=>pe().identifier),e})(),(()=>{var e=s$();return P(e,()=>pe().title),e})()]}}),null),P(a,j(M,{get when(){return $e(()=>!!n.isPending)()&&!pe()},get children(){return c$()}}),null),P(r,j(M,{get when(){return pe()},get children(){var e=l$(),t=e.firstChild;return P(e,j(kj,{get color(){return pe().state.color}}),t),P(t,()=>pe().state.name),P(e,j(Tj,{get href(){return pe().url},class:`ml-auto shrink-0`,children:`Open in Linear`}),null),e}}),null),P(d,j(M,{get when(){return o()},children:e=>{let t=()=>s(e());return(()=>{var n=b$(),r=n.firstChild,i=r.firstChild.firstChild,a=i.nextSibling.nextSibling.nextSibling;a.firstChild;var o=r.nextSibling,s=o.firstChild,c=s.nextSibling;return P(i,j(wj,{size:12})),P(a,()=>Nj(e().startedAt),null),P(r,j(Oj,{get children(){return e().model??`default`}}),null),o.$$click=()=>YA(`local`),P(o,j(M,{get when(){return e().status===`running`},get children(){return j(yj,{size:12})}}),s),P(s,()=>t().word),P(c,(()=>{var t=$e(()=>e().status===`done`);return()=>t()?e().result??e().lastText:e().lastText})()),D(()=>st(s,`shrink-0 text-[11.5px] font-medium ${t().cls}`)),n})()}}),null),P(d,j(M,{get when(){return me().length>0},get children(){var e=u$();return P(e,j(We,{get each(){return me()},children:e=>j(I$,{session:e})})),e}}),null),P(d,j(M,{get when(){return $e(()=>!!pe())()&&pe().attachments.length>0},get children(){var e=d$(),t=e.firstChild.nextSibling;return P(t,j(We,{get each(){return pe().attachments},children:e=>{let t=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url);return(()=>{var n=S$(),r=n.firstChild;return P(r,()=>e.title),P(n,j(M,{get when(){return $e(()=>!!(t&&ee(e.url)))()&&ee(e.url)!==`OPEN`},get children(){return j(Oj,{get class(){return`ml-auto shrink-0 ${ee(e.url)===`MERGED`?`text-success`:`text-text-faint`}`},get children(){return ee(e.url)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(n,j(M,{get when(){return t&&(!ee(e.url)||ee(e.url)===`OPEN`)},get children(){return j(vj,{variant:`primary`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return te()===e.url},get title(){return E.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 se(e.url),get children(){return x$()}})}}),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 ie()},get children(){return j(jj,{get message(){return ie()}})}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!pe())()&&pe().comments.length>0},get children(){var e=f$();return e.firstChild,P(e,j(Ge,{get each(){return pe().comments},children:e=>{let t=e();return(()=>{var e=C$(),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(Oj,{children:`agent`})}}),i),P(i,()=>Nj(t.createdAt)),P(e,j(j$,{get text(){return t.body}}),null),e})()}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!(pe()&&pe().comments.length===0))()&&me().length===0},get children(){return j(Aj,{title:`No activity yet`,children:`Comments and agent sessions will appear here.`})}}),null),P(d,j(M,{get when(){return $e(()=>!!n.isError)()&&!pe()},get children(){return j(Aj,{title:`Failed to load issue`,get children(){return n.error?.message??`Unknown error`}})}}),null),P(f,j(M,{get when(){return u()},get children(){return j(jj,{get message(){return u()}})}}),p),P(f,j(xj,{rows:2,placeholder:`Reply — steer the agent or add context…`,get value(){return c()},onInput:e=>l(e.target.value),get disabled(){return fe.isPending}}),p),P(p,j(Sj,{class:`min-w-0 flex-1`,get value(){return le()},onChange:e=>ue(e.currentTarget.value),get children(){return[j(We,{get each(){return ce()},children:(e,t)=>(()=>{var n=w$(),r=n.firstChild.nextSibling;return r.nextSibling,P(n,(()=>{var e=$e(()=>ce().length>1);return()=>e()?` #${t()+1}`:``})(),r),P(n,()=>Nj(e.createdAt),null),D(()=>n.selected=le()===`thread:${e.id}`),D(()=>n.value=`thread:${e.id}`),n})()}),j(M,{get when(){return i.data?.cursorAgentId},get children(){var e=p$(),t=e.firstChild.nextSibling;return t.nextSibling,P(e,()=>i.data?.cursorAgentName??`Cursor`,t),D(()=>e.selected=le()===`new`),e}}),(()=>{var e=m$();return D(()=>e.selected=le()===`comment`),e})()]}}),null),P(p,j(vj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${ZA()===`composer`?`text-accent`:``}`},get title(){return ZA()===`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:v,get children(){return h$()}}),null),P(p,j(vj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${y().phase===`recording`?`text-danger`:``}`},get title(){return y().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:S,get children(){return j(M,{get when(){return y().phase===`recording`},get fallback(){return T$()},get children(){return g$()}})}}),null),P(p,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return h()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void _(),get children(){return _$()}}),null),P(p,j(vj,{class:`min-w-[52px] shrink-0`,variant:`primary`,get loading(){return fe.isPending},get disabled(){return c().trim().length===0},onClick:()=>fe.mutate(),get children(){return v$()}}),null),t})()}function I$(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(()=>e.session.activities.slice(-10));return(()=>{var r=k$(),i=r.firstChild,a=i.firstChild;return P(i,j(Oj,{get color(){return t()},get children(){return e.session.status}}),a),P(i,j(M,{get when(){return e.session.appUser?.displayName},get children(){var t=E$();return P(t,()=>e.session.appUser.displayName),t}}),a),P(a,()=>Nj(e.session.updatedAt)),P(r,j(M,{get when(){return e.session.summary},get children(){var t=D$();return P(t,()=>e.session.summary),t}}),null),P(r,j(M,{get when(){return n().length>0},get children(){var e=O$();return P(e,j(We,{get each(){return n()},children:e=>{let t=e.content,n=String(t?.body??t?.text??t?.type??JSON.stringify(t)).slice(0,300);return(()=>{var t=A$(),r=t.firstChild,i=r.nextSibling;return P(r,()=>Nj(e.createdAt)),P(i,n),t})()}})),e}}),null),r})()}rt([`click`]),Rr();var L$=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">`),R$=N(`<div><p></p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),z$=N(`<p>`),B$=N(`<span class="text-text-faint max-w-[55%] truncate text-[10.5px] tabular-nums"> running · `),V$=N(`<div class="flex flex-col gap-1.5">`),H$=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">`),U$=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`),W$=N(`<span class="text-text-faint text-[10.5px] tabular-nums">ctx <!> · out `),G$=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]">`),K$=N(`<span class="text-success text-[12px] leading-none">✓`),q$=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">`),J$=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>`),Y$=N(`<span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),X$=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>−`),Z$=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">`),Q$=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">`),$$=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">`),e1=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">`),t1=N(`<span class="inline-block min-w-[4ch] text-center">Send`),n1=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]">`),r1=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">`),i1=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),a1=N(`<div class="flex min-w-0 items-center gap-1.5">`),o1=N(`<option>`),s1=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>`),c1=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">`),l1=N(`<span class=text-success>+`),u1=N(`<span class=text-danger>−`),d1=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">`),f1=N(`<span class=text-text-faint>bin`),p1=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`),m1=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">`),h1=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 _1(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 v1=e=>e==null?`–`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e);function y1(){let e=sr(),t=_r(()=>({queryKey:[`bridge-health`],queryFn:EO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:3e3,enabled:!!t.data?.ok})),[r,i]=T(null),a=_r(()=>({queryKey:[`my-issues`],queryFn:uO,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:()=>OO(r()),refetchInterval:1500,enabled:!!r()&&!!t.data?.ok})),c=_r(()=>({queryKey:[`bridge-diff`,r()],queryFn:()=>PO(r()),refetchInterval:6e3,enabled:!!r()&&!!t.data?.ok})),l=()=>{e.invalidateQueries({queryKey:[`bridge-tasks`]}),e.invalidateQueries({queryKey:[`bridge-task`,r()]})},u=vr(()=>({mutationFn:e=>MO(e),onSuccess:l})),[d,f]=T(``),[p,m]=T(!1),[h,g]=T(0),_=_r(()=>({queryKey:[`grab`],queryFn:Tr,enabled:ZA()===`local`})),v=()=>{g(Date.now()),$A(`local`),FZ().catch(()=>$A(`capture`))};O(()=>{if(ZA()!==`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(`
|
|
220
|
-
`);f(e=>`${e?`${e}\n`:``}${t}\n`),$A(`capture`)});let y=async()=>{m(!0);try{let e=await zQ();e&&f(t=>`${t?`${t}\n`:``}${e}\n`)}finally{m(!1)}},b=vr(()=>({mutationFn:e=>AO(e.id,e.text),onSuccess:()=>{f(``),l()}})),x=vr(()=>({mutationFn:e=>jO(e.id,e.model),onSuccess:l})),S=vr(()=>({mutationFn:e=>NO(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(zO(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(()=>YQ(e.line.text));return t===`user`?(()=>{var e=L$(),t=e.firstChild.nextSibling;return D(()=>t.innerHTML=n()),e})():t===`assistant`||t===`result`?(()=>{var e=R$(),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=z$();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=H$(),a=e.firstChild;a.firstChild;var l=a.nextSibling;return P(a,j(M,{get when(){return t.data?.ok},get fallback(){return j(Oj,{class:`text-danger`,children:`bridge offline`})},get children(){return[j(M,{get when(){return _1(t.data.version,`0.15.1`)},get children(){return j(Oj,{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=B$(),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(Aj,{title:`Bridge not running`,get children(){return[`Start it in your repo's terminal:`,U$(),`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(Aj,{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=V$();return P(e,j(We,{get each(){return n.data},children:e=>(()=>{var t=r1(),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=i1();return D(n=>dt(t,`background`,ne(e.status))),t})()},get children(){return j(yj,{})}}),a),P(a,()=>e.title),P(l,()=>Nj(e.startedAt)),P(m,()=>e.lastText),P(h,j(Oj,{get color(){return ne(e.status)},get children(){return e.status}}),null),P(h,j(Oj,{get children(){return e.model??`default model`}}),null),P(h,j(M,{get when(){return e.pendingModel},get children(){return j(Oj,{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(Oj,{class:`text-warn`,get children(){return[`⛓ `,$e(()=>e.subagents),` subagents`]}})}}),null),P(h,j(M,{get when(){return e.usage},get children(){var t=W$(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>v1(e.usage.contextTokens),n),P(t,()=>v1(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=a1();return P(t,j(Oj,{get children(){return e().state.name}}),null),P(t,j(Tj,{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=G$(),n=t.firstChild;return P(t,j(Oj,{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(vj,{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(Sj,{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=o1();return P(n,()=>t.label),D(()=>n.selected=(e.pendingModel??e.model??``)===t.id),D(()=>n.value=t.id),n})()})}}),null),P(g,j(M,{get when(){return o(e)},children:e=>j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,onClick:()=>YA(`activity`,e().id),get children(){return s1()}})}),null),P(g,j(vj,{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 c1()},get children(){return K$()}})}}),null),P(g,j(vj,{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 q$()}}),null),P(g,j(M,{get when(){return e.status===`running`},get children(){return j(vj,{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 J$()}})}}),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=X$(),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=Y$();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=d1(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.path),P(r,j(M,{get when(){return!e.binary},get fallback(){return f1()},get children(){return[(()=>{var t=l1();return t.firstChild,P(t,()=>e.added,null),t})(),` `,(()=>{var t=u1();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=p1(),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=m1(),n=t.firstChild;return P(t,j(Oj,{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=Z$();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 h1()},get children(){return j(Ge,{get each(){return s.data?.tail??[]},children:e=>j(re,{get line(){return e()}})})}})),e})(),(()=>{var t=n1(),n=t.firstChild,r=n.firstChild;return P(t,j(xj,{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(vj,{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 Q$()}}),null),P(n,j(vj,{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 $$()}}),null),P(n,j(vj,{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 e1()}}),null),P(n,j(vj,{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 t1()}}),null),t})()]}}),null),t})()})),e}})}})),e})()}var b1=N(`<span class="text-text-faint text-[10.5px] tabular-nums">/<!> from your issues`),x1=N(`<div class="flex flex-col gap-1.5">`),S1=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">`),C1=N(`<span class="text-warn text-[10.5px]"title="Merge states come from gh via the bridge">states unknown — restart the bridge`),w1=N(`<button>`),T1=N(`<span class="text-[12px] leading-none">✓`),E1=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>`),D1=N(`<span class="text-success text-[12px] leading-none">✓`),O1=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">`),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><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">`),A1=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">`),j1=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i;function M1(e){let t=_r(()=>({queryKey:[`my-issues`],queryFn:uO,refetchInterval:15e3})),n=k(()=>(t.data??[]).flatMap(e=>(e.attachments??[]).filter(e=>j1.test(e.url)).map(t=>({issue:e,attachment:t})))),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:1e4,retry:0})),i=_r(()=>({queryKey:[`pr-status`,n().map(e=>e.attachment.url).sort().join(`|`)],queryFn:()=>IO(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 LO(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=S1(),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 C1()},get children(){var e=b1(),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=w1();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(bj,{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(Aj,{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=O1(),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(kj,{get color(){return t.issue.state.color}}),s),P(s,()=>t.issue.identifier),P(c,()=>t.issue.title),P(l,()=>Nj(t.issue.updatedAt)),P(u,j(Oj,{get children(){return t.issue.state.name}}),d),P(u,j(M,{get when(){return t.issue.delegate},get children(){return j(Oj,{class:`text-accent`,get children(){return[j(Cj,{}),` `,$e(()=>t.issue.delegate.displayName)]}})}}),d),P(u,j(M,{get when(){return o(t)},get children(){return j(Oj,{class:`text-warn`,get children(){return[j(wj,{}),` local`]}})}}),d),P(u,j(Tj,{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(Oj,{get class(){return a(t)===`MERGED`?`text-success`:`text-text-faint`},get children(){return a(t)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(d,j(vj,{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 k1()},get children(){return T1()}})}}),null),P(d,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,"aria-label":`Open issue activity`,onClick:()=>{YA(`activity`,t.issue.id),e.onOpenIssue()},get children(){return E1()}}),null),P(d,j(vj,{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 A1()},get children(){return D1()}})}}),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`]),Rr();function N1(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function P1(e){let t=N1(crypto.getRandomValues(new Uint8Array(32))),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t)),r=N1(new Uint8Array(n)),i=N1(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 wr({linearAccessToken:d.access_token,linearOauthClientId:e})}async function F1(){await wr({linearAccessToken:void 0,linearApiKey:void 0})}Rr(),br(),Nx(),mD();var I1=N(`<div class="bg-surface-2 border-border flex rounded-md border p-0.5">`),L1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Cloud: picking an element opens the panel to draft & 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.`),R1=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`),z1=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).`),B1=N(`<span class=text-text>Connected as <span class=font-medium></span> · <span class=text-text-dim>`),V1=N(`<div class="bg-surface border-border flex items-center justify-between rounded-lg border p-2.5"><span class="text-text text-[12px]">`),H1=N(`<option value>Select a team…`),U1=N(`<p class="text-text-dim text-[11px]">No agents found — install the Cursor integration in Linear first.`),W1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Empty = the default above (computer-use testing, video demo, PR + review babysitting).`),G1=N(`<div class="flex flex-col gap-1.5">`),K1=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.`),q1=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.`),J1=N(`<option value>Select a channel…`),Y1=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`),X1=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.`),Z1=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`),Q1=N(`<p class="text-text-dim text-[11px]">`),$1=N(`<div class=min-h-[2lh]>`),e0=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.`),t0=N(`<div class="flex h-full flex-col gap-5 overflow-y-auto pt-3 pb-6 pl-3 pr-4">`),n0=N(`<button>`),r0=N(`<div class="flex gap-1.5">`),i0=N(`<p class="text-text-faint text-center text-[10.5px]">or`),a0=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">`),o0=N(`<div class="flex flex-col gap-3">`),s0=N(`<span class=text-text-dim>Connected — verifying…`),c0=N(`<option> (<!>)`),l0=N(`<option value>Select the agent…`),u0=N(`<option>`),d0=N(`<option>#`),f0=N(`<p class="text-text-dim text-[11px]">No key set — AI drafting disabled, manual drafting still works.`);function p0(){let e=sr(),t=_r(()=>({queryKey:[`settings`],queryFn:Cr,staleTime:0})),n=k(()=>t.data??{});async function r(t,n=!1){await wr(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:sO,enabled:i(),retry:0})),o=_r(()=>({queryKey:[`teams`],queryFn:cO,enabled:i()})),s=_r(()=>({queryKey:[`agents`],queryFn:lO,enabled:i()})),[c,l]=T(``),[u,d]=T(!1),[f,p]=T(``);async function m(){let e=c().trim();if(e){d(!0),p(``);try{await r({linearApiKey:e},!0),await sO(),l(``)}catch{p(`Key rejected — could not verify. Check the key and try again.`),await r({linearApiKey:void 0},!0)}finally{d(!1)}}}let[h,g]=T(``),[_,v]=T(!1),[y,b]=T(``);async function x(){let t=(h()||n().linearOauthClientId||``).trim();if(!t){b(`Enter an OAuth client ID first.`);return}v(!0),b(``);try{await P1(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){b(e instanceof Error?e.message:`OAuth flow failed.`)}finally{v(!1)}}let[S,C]=T(!1);async function w(){C(!0);try{await F1(),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{C(!1)}}let E=yr?chrome.identity.getRedirectURL():null,O=_r(()=>({queryKey:[`slack-channels`,n().slackToken],queryFn:()=>WO(n().slackToken),enabled:!!n().slackToken,retry:0,staleTime:6e4})),ee=k(()=>Ox(n())),te=k(()=>{let e=ee();return e?`Drafting with ${e} — ${jx[e].fast} (fast) / ${jx[e].best} (best)`:null});return(()=>{var e=t0();return P(e,j(Dj,{title:`Workflow`,get children(){return[(()=>{var e=I1();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})(),L1()]}}),null),P(e,j(Dj,{title:`Capture`,get children(){return[(()=>{var e=R1(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({captureShots:e.currentTarget.checked||void 0})),D(()=>t.checked=!!n().captureShots),e})(),z1()]}}),null),P(e,j(Dj,{title:`Linear`,get children(){return j(M,{get when(){return i()},get fallback(){return(()=>{var e=o0();return P(e,j(Ej,{label:`Personal API key`,hint:`Create one at linear.app → Settings → API — fastest path.`,get children(){return[(()=>{var e=r0();return P(e,j(bj,{type:`password`,placeholder:`lin_api_…`,get value(){return c()},onInput:e=>l(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&m()}}),null),P(e,j(vj,{variant:`primary`,get loading(){return u()},get disabled(){return!c().trim()},onClick:()=>void m(),class:`shrink-0`,children:`Connect`}),null),e})(),j(M,{get when(){return f()},get children(){return j(jj,{get message(){return f()}})}})]}}),null),P(e,j(M,{when:yr,get children(){return[i0(),j(Ej,{label:`OAuth client ID`,get children(){return[(()=>{var e=r0();return P(e,j(bj,{placeholder:`your-client-id`,get value(){return h()||n().linearOauthClientId||``},onInput:e=>g(e.currentTarget.value)}),null),P(e,j(vj,{variant:`ghost`,get loading(){return _()},onClick:()=>void x(),class:`shrink-0 whitespace-nowrap`,children:`Connect with OAuth`}),null),e})(),j(M,{get when(){return y()},get children(){return j(jj,{get message(){return y()}})}}),(()=>{var e=a0(),t=e.firstChild.nextSibling.nextSibling;return P(t,E),e})()]}})]}}),null),e})()},get children(){var e=V1(),t=e.firstChild;return P(t,j(M,{get when(){return!a.isLoading},get fallback(){return s0()},get children(){return j(M,{get when(){return a.data},get fallback(){return j(M,{get when(){return a.isError},get fallback(){return s0()},get children(){return j(jj,{message:`Key rejected — reconnect`})}})},get children(){var e=B1(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return P(t,()=>a.data.name),P(n,()=>a.data.email),e}})}})),P(e,j(vj,{variant:`ghost`,get loading(){return S()},onClick:()=>void w(),class:`ml-2 shrink-0`,children:`Disconnect`}),null),e}})}}),null),P(e,j(M,{get when(){return i()},get children(){return j(Dj,{title:`Workspace`,get children(){return[j(Ej,{label:`Default team`,get children(){return j(Sj,{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[H1(),j(M,{get when(){return o.data},get children(){return j(We,{get each(){return o.data},children:e=>(()=>{var t=c0(),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(Ej,{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(()=>!!s.data)()&&s.data.length===0},get fallback(){return j(Sj,{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=s.data?.find(e=>e.id===t);n&&r({cursorAgentId:n.id,cursorAgentName:n.displayName,cursorAgentUrl:n.url??void 0})},get disabled(){return s.isLoading},get children(){return[l0(),j(M,{get when(){return s.data},get children(){return j(We,{get each(){return s.data},children:e=>(()=>{var t=u0();return P(t,()=>e.displayName),D(()=>t.selected=e.id===n().cursorAgentId),D(()=>t.value=e.id),t})()})}})]}})},get children(){return U1()}})}}),j(Ej,{label:`Default repository`,hint:`Appended to delegated issues as [repo=…] so Cursor picks the right repo.`,get children(){return j(bj,{placeholder:`owner/repository`,get value(){return n().defaultRepo??``},onBlur:e=>{r({defaultRepo:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{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(bj,{placeholder:`Cursor's default`,get value(){return n().cursorModel??``},onBlur:e=>{r({cursorModel:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{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(xj,{rows:5,placeholder:pD,get value(){return n().issueTemplate??``},onBlur:e=>{r({issueTemplate:e.currentTarget.value.trim()||void 0})}}),W1()]}}),j(Ej,{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(bj,{placeholder:`/dev-server.log`,get value(){return n().logUrl??``},onBlur:e=>{r({logUrl:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Log lines to attach`,hint:`Trailing lines included in the issue (10–500).`,get children(){return j(bj,{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(Ej,{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(xj,{rows:4,placeholder:`.claude/skills/apple-hig-design-principles
|
|
218
|
+
`)}</code></pre>`);continue}let i=e.match(/^(#{1,6})\s+(.*)$/);if(i){n.push(`<h4>${YQ(i[2])}</h4>`),r++;continue}if(/^\s*[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*[-*]\s+/.test(t[r]);)e.push(`<li>${YQ(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>${YQ(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>${YQ(a.join(`<br />`))}</p>`)}return n.join(``)}Rr();var ZQ=N(`<div class="lg-md text-text text-[12px] leading-relaxed break-words">`),QQ=N(`<div class="flex h-full flex-col">`),$Q=N(`<span class="tabular-nums text-[10.5px] text-text-faint">live · updated `),e$=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">`),t$=N(`<div class="flex-1 overflow-y-auto">`),n$=N(`<div class="min-h-0 flex-1 overflow-y-auto pl-2 pr-3"><div style=position:relative>`),r$=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">`),i$=N(`<div style=position:absolute;top:0;left:0;width:100%>`),a$=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">`),o$=N(`<span class="inline-block min-w-[6ch] text-left">← Back`),s$=N(`<span class="font-mono text-[11px] text-text-dim shrink-0">`),c$=N(`<span class="truncate text-[12px] font-medium text-text">`),l$=N(`<span class="text-[11.5px] text-text-faint">Loading…`),u$=N(`<div class="flex items-center gap-2"><span class="text-[11px] text-text-dim">`),d$=N(`<div class="flex flex-col gap-2">`),f$=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">`),p$=N(`<div class="flex flex-col gap-2.5"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Comments`),m$=N(`<option value=local>Message local Claude Code session`),h$=N(`<option value=new>Start NEW agent (@<!>)`),g$=N(`<option value=comment>Comment only`),_$=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">`),v$=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>`),y$=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">`),b$=N(`<span class="inline-block min-w-[4ch] text-left">Send`),x$=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">`),S$=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><button class="hover:bg-surface-2 flex h-9 w-full min-w-0 cursor-pointer items-center gap-2 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">`),C$=N(`<span class="inline-block min-w-[6ch] text-center">Merge`),w$=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">`),T$=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">`),E$=N(`<option>Steer running agent<!> · `),D$=N(`<span class="bg-danger inline-block size-2.5 rounded-full"aria-hidden>`),O$=N(`<span class="text-[11px] text-text-dim">`),k$=N(`<p class="text-[12px] text-text leading-relaxed whitespace-pre-wrap break-words">`),A$=N(`<div class="flex flex-col gap-0.5 border-t border-border pt-1.5 mt-0.5">`),j$=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">`),M$=N(`<div class="flex items-start gap-1.5"><span class="tabular-nums text-[10px] text-text-faint shrink-0 mt-px"></span><span class="text-[11px] text-text-dim break-words min-w-0">`);function N$(e){let t=k(()=>XQ(e.text));return(()=>{var e=ZQ();return D(()=>e.innerHTML=t()),e})()}function P$(){let[e,t]=T(null);return O(()=>{let e=qA();e&&(t(e),XA())}),(()=>{var n=QQ();return P(n,j(M,{get when(){return e()===null},get fallback(){return j(L$,{get issueId(){return e()},onBack:()=>t(null)})},get children(){return j(F$,{onSelect:e=>t(e)})}})),n})()}function F$(e){let t,n=_r(()=>({queryKey:[`my-issues`],queryFn:uO,refetchInterval:12e3})),r=k(()=>n.data??[]),i=kQ({get count(){return r().length},getScrollElement:()=>t,estimateSize:()=>56,overscan:5});return(()=>{var a=r$(),o=a.firstChild.firstChild.nextSibling;return P(o,j(M,{get when(){return n.dataUpdatedAt>0},get children(){var e=$Q();return e.firstChild,P(e,()=>Nj(n.dataUpdatedAt),null),e}}),null),P(o,j(vj,{class:`size-7 px-0`,get loading(){return n.isFetching},onClick:()=>void n.refetch(),title:`Refresh`,"aria-label":`Refresh issues`,get children(){return e$()}}),null),P(a,j(M,{get when(){return n.isError},get children(){var e=t$();return P(e,j(Aj,{title:`Connect Linear in Settings`,get children(){return n.error?.message??`Unable to load issues.`}})),e}}),null),P(a,j(M,{get when(){return $e(()=>!n.isError&&!n.isPending)()&&r().length===0},get children(){var e=t$();return P(e,j(Aj,{title:`No issues found`,children:`Issues you create will appear here.`})),e}}),null),P(a,j(M,{get when(){return $e(()=>!n.isError)()&&r().length>0},get children(){var n=n$(),a=n.firstChild,o=t;return typeof o==`function`?pt(o,n):t=n,P(a,j(We,{get each(){return i.getVirtualItems()},children:t=>{let n=k(()=>r()[t.index]);return(()=>{var r=i$();return P(r,j(I$,{get issue(){return n()},get onSelect(){return e.onSelect}})),D(e=>dt(r,`transform`,`translateY(${t.start}px)`)),r})()}})),D(e=>dt(a,`height`,`${i.getTotalSize()}px`)),n}}),null),a})()}function I$(e){return(()=>{var t=a$(),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(kj,{get color(){return e.issue.state.color}}),r),P(r,()=>e.issue.identifier),P(i,()=>e.issue.title),P(a,j(Oj,{get children(){return e.issue.state.name}}),o),P(a,j(M,{get when(){return e.issue.delegate},get children(){return j(Oj,{class:`text-accent`,get children(){return[j(Cj,{}),` `,$e(()=>e.issue.delegate.displayName)]}})}}),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(Oj,{color:`var(--color-warn)`,children:`needs review`})}}),o),P(o,()=>Nj(e.issue.updatedAt)),t})()}function L$(e){let t=sr(),n=_r(()=>({queryKey:[`issue`,e.issueId],queryFn:()=>dO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),r=_r(()=>({queryKey:[`sessions`,e.issueId],queryFn:()=>fO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),i=_r(()=>({queryKey:[`settings`],queryFn:Cr})),a=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:5e3,retry:0})),o=k(()=>{let e=n.data?.identifier;return e?a.data?.find(t=>t.title.startsWith(e)):void 0}),s=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`},[c,l]=T(``),[u,d]=T(null),[f,p]=T(0),m=_r(()=>({queryKey:[`grab`],queryFn:Tr,enabled:ZA()===`composer`})),[h,g]=T(!1),_=async()=>{g(!0),d(null);try{let e=await BQ();e?l(t=>`${t?`${t}\n`:``}${e}\n`):d(`Nothing captured yet — pick an element, capture a region, or record first.`)}catch(e){d(e instanceof Error?e.message:`Attach failed.`)}finally{g(!1)}},v=()=>{if(ZA()===`composer`){$A(`capture`);return}p(Date.now()),$A(`composer`),FZ().catch(()=>$A(`capture`))};O(()=>{if(ZA()!==`composer`)return;let e=(m.data??[]).filter(e=>e.grabbedAt>f());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(`
|
|
219
|
+
`);l(e=>`${e?`${e}\n`:``}${t}\n`),p(Math.max(...e.map(e=>e.grabbedAt)))});let[y,b]=T(BD());ae(VD(b));let x=!1;O(()=>{y().phase===`ready`&&x&&(x=!1,_())});let S=()=>{y().phase===`recording`?QD():(x=!0,ZD())},C=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,w=k(()=>(n.data?.attachments??[]).map(e=>e.url).filter(e=>C.test(e))),E=_r(()=>({queryKey:[`pr-status`,w().sort().join(`|`)],queryFn:()=>IO(w()),refetchInterval:3e4,retry:0,enabled:w().length>0})),ee=e=>ne().has(e)?`MERGED`:E.data?.[e],[te,A]=T(null),[ne,re]=T(new Set),[ie,oe]=T(null),se=async n=>{oe(null),A(n);try{await LO(n),re(e=>new Set(e).add(n)),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`my-issues`]}),IQ()}catch(e){oe(e instanceof Error?`${e.message} (bridge must be running; gh needs merge rights)`:`Merge failed.`)}finally{A(null)}},ce=k(()=>n.data?yO(n.data.comments):[]),[le,ue]=T(`comment`),de=!1,fe=!1;O(()=>{if(fe||!n.data||!i.data)return;fe=!0;let e=ce();e.length?ue(`thread:${e[0].id}`):n.data.delegate&&i.data.cursorAgentId&&ue(`new`)}),O(()=>{de||o()&&(le()===`comment`||le()===`new`)&&ue(`local`)});let pe=vr(()=>({mutationFn:async()=>{let t=c().trim();if(!t)throw Error(`Message is empty`);let n=i.data??{},r=le();if(r===`local`){let n=o();if(!n)throw Error(`Local session not found — is the bridge running?`);await AO(n.id,t),await _O(e.issueId,`🖥️ **→ local agent:** ${t}`).catch(()=>{})}else r.startsWith(`thread:`)?await _O(e.issueId,t,r.slice(7)):r===`new`&&n.cursorAgentId?await vO(e.issueId,t,{name:n.cursorAgentName,displayName:n.cursorAgentName??`Cursor`,url:n.cursorAgentUrl}):await _O(e.issueId,t)},onSuccess:()=>{l(``),d(null),$A(`capture`),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),IQ()},onError:e=>{d(e.message??`Failed to send`)}})),me=k(()=>n.data),he=k(()=>r.data??[]);return(()=>{var t=x$(),r=t.firstChild,a=r.firstChild,d=r.nextSibling,f=d.nextSibling,p=f.firstChild;return P(a,j(vj,{class:`min-w-[68px] shrink-0 text-[11px]`,get onClick(){return e.onBack},get children(){return o$()}}),null),P(a,j(M,{get when(){return me()},get children(){return[(()=>{var e=s$();return P(e,()=>me().identifier),e})(),(()=>{var e=c$();return P(e,()=>me().title),e})()]}}),null),P(a,j(M,{get when(){return $e(()=>!!n.isPending)()&&!me()},get children(){return l$()}}),null),P(r,j(M,{get when(){return me()},get children(){var e=u$(),t=e.firstChild;return P(e,j(kj,{get color(){return me().state.color}}),t),P(t,()=>me().state.name),P(e,j(Tj,{get href(){return me().url},class:`ml-auto shrink-0`,children:`Open in Linear`}),null),e}}),null),P(d,j(M,{get when(){return o()},children:e=>{let t=()=>s(e());return(()=>{var n=S$(),r=n.firstChild,i=r.firstChild.firstChild,a=i.nextSibling.nextSibling.nextSibling;a.firstChild;var o=r.nextSibling,s=o.firstChild,c=s.nextSibling;return P(i,j(wj,{size:12})),P(a,()=>Nj(e().startedAt),null),P(r,j(Oj,{get children(){return e().model??`default`}}),null),o.$$click=()=>YA(`local`),P(o,j(M,{get when(){return e().status===`running`},get children(){return j(yj,{size:12})}}),s),P(s,()=>t().word),P(c,(()=>{var t=$e(()=>e().status===`done`);return()=>t()?e().result??e().lastText:e().lastText})()),D(()=>st(s,`shrink-0 text-[11.5px] font-medium ${t().cls}`)),n})()}}),null),P(d,j(M,{get when(){return he().length>0},get children(){var e=d$();return P(e,j(We,{get each(){return he()},children:e=>j(R$,{session:e})})),e}}),null),P(d,j(M,{get when(){return $e(()=>!!me())()&&me().attachments.length>0},get children(){var e=f$(),t=e.firstChild.nextSibling;return P(t,j(We,{get each(){return me().attachments},children:e=>{let t=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url);return(()=>{var n=w$(),r=n.firstChild;return P(r,()=>e.title),P(n,j(M,{get when(){return $e(()=>!!(t&&ee(e.url)))()&&ee(e.url)!==`OPEN`},get children(){return j(Oj,{get class(){return`ml-auto shrink-0 ${ee(e.url)===`MERGED`?`text-success`:`text-text-faint`}`},get children(){return ee(e.url)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(n,j(M,{get when(){return t&&(!ee(e.url)||ee(e.url)===`OPEN`)},get children(){return j(vj,{variant:`primary`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return te()===e.url},get title(){return E.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 se(e.url),get children(){return C$()}})}}),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 ie()},get children(){return j(jj,{get message(){return ie()}})}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!me())()&&me().comments.length>0},get children(){var e=p$();return e.firstChild,P(e,j(Ge,{get each(){return me().comments},children:e=>{let t=e();return(()=>{var e=T$(),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(Oj,{children:`agent`})}}),i),P(i,()=>Nj(t.createdAt)),P(e,j(N$,{get text(){return t.body}}),null),e})()}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!(me()&&me().comments.length===0))()&&he().length===0},get children(){return j(Aj,{title:`No activity yet`,children:`Comments and agent sessions will appear here.`})}}),null),P(d,j(M,{get when(){return $e(()=>!!n.isError)()&&!me()},get children(){return j(Aj,{title:`Failed to load issue`,get children(){return n.error?.message??`Unknown error`}})}}),null),P(f,j(M,{get when(){return u()},get children(){return j(jj,{get message(){return u()}})}}),p),P(f,j(xj,{rows:2,placeholder:`Reply — steer the agent or add context…`,get value(){return c()},onInput:e=>l(e.target.value),get disabled(){return pe.isPending}}),p),P(p,j(Sj,{class:`min-w-0 flex-1`,get value(){return le()},onChange:e=>{de=!0,ue(e.currentTarget.value)},get children(){return[j(M,{get when(){return o()},get children(){var e=m$();return D(()=>e.selected=le()===`local`),e}}),j(We,{get each(){return ce()},children:(e,t)=>(()=>{var n=E$(),r=n.firstChild.nextSibling;return r.nextSibling,P(n,(()=>{var e=$e(()=>ce().length>1);return()=>e()?` #${t()+1}`:``})(),r),P(n,()=>Nj(e.createdAt),null),D(()=>n.selected=le()===`thread:${e.id}`),D(()=>n.value=`thread:${e.id}`),n})()}),j(M,{get when(){return i.data?.cursorAgentId},get children(){var e=h$(),t=e.firstChild.nextSibling;return t.nextSibling,P(e,()=>i.data?.cursorAgentName??`Cursor`,t),D(()=>e.selected=le()===`new`),e}}),(()=>{var e=g$();return D(()=>e.selected=le()===`comment`),e})()]}}),null),P(p,j(vj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${ZA()===`composer`?`text-accent`:``}`},get title(){return ZA()===`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:v,get children(){return _$()}}),null),P(p,j(vj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${y().phase===`recording`?`text-danger`:``}`},get title(){return y().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:S,get children(){return j(M,{get when(){return y().phase===`recording`},get fallback(){return D$()},get children(){return v$()}})}}),null),P(p,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return h()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void _(),get children(){return y$()}}),null),P(p,j(vj,{class:`min-w-[52px] shrink-0`,variant:`primary`,get loading(){return pe.isPending},get disabled(){return c().trim().length===0},onClick:()=>pe.mutate(),get children(){return b$()}}),null),t})()}function R$(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(()=>e.session.activities.slice(-10));return(()=>{var r=j$(),i=r.firstChild,a=i.firstChild;return P(i,j(Oj,{get color(){return t()},get children(){return e.session.status}}),a),P(i,j(M,{get when(){return e.session.appUser?.displayName},get children(){var t=O$();return P(t,()=>e.session.appUser.displayName),t}}),a),P(a,()=>Nj(e.session.updatedAt)),P(r,j(M,{get when(){return e.session.summary},get children(){var t=k$();return P(t,()=>e.session.summary),t}}),null),P(r,j(M,{get when(){return n().length>0},get children(){var e=A$();return P(e,j(We,{get each(){return n()},children:e=>{let t=e.content,n=String(t?.body??t?.text??t?.type??JSON.stringify(t)).slice(0,300);return(()=>{var t=M$(),r=t.firstChild,i=r.nextSibling;return P(r,()=>Nj(e.createdAt)),P(i,n),t})()}})),e}}),null),r})()}rt([`click`]),Rr();var z$=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">`),B$=N(`<div><p></p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),V$=N(`<p>`),H$=N(`<span class="text-text-faint max-w-[55%] truncate text-[10.5px] tabular-nums"> running · `),U$=N(`<div class="flex flex-col gap-1.5">`),W$=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">`),G$=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`),K$=N(`<span class="text-text-faint text-[10.5px] tabular-nums">ctx <!> · out `),q$=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]">`),J$=N(`<span class="text-success text-[12px] leading-none">✓`),Y$=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">`),X$=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>`),Z$=N(`<span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),Q$=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>−`),$$=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">`),e1=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">`),t1=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">`),n1=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">`),r1=N(`<span class="inline-block min-w-[4ch] text-center">Send`),i1=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]">`),a1=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">`),o1=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),s1=N(`<div class="flex min-w-0 items-center gap-1.5">`),c1=N(`<option>`),l1=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>`),u1=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">`),d1=N(`<span class=text-success>+`),f1=N(`<span class=text-danger>−`),p1=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">`),m1=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`),g1=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">`),_1=N(`<p class="text-text-faint text-[11px]">Waiting for output…`),v1=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}];function y1(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 b1=e=>e==null?`–`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e);function x1(){let e=sr(),t=_r(()=>({queryKey:[`bridge-health`],queryFn:EO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:3e3,enabled:!!t.data?.ok})),[r,i]=T(null),a=_r(()=>({queryKey:[`my-issues`],queryFn:uO,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:()=>OO(r()),refetchInterval:1500,enabled:!!r()&&!!t.data?.ok})),c=_r(()=>({queryKey:[`bridge-diff`,r()],queryFn:()=>PO(r()),refetchInterval:6e3,enabled:!!r()&&!!t.data?.ok})),l=()=>{e.invalidateQueries({queryKey:[`bridge-tasks`]}),e.invalidateQueries({queryKey:[`bridge-task`,r()]})},u=vr(()=>({mutationFn:e=>MO(e),onSuccess:l})),[d,f]=T(``),[p,m]=T(!1),[h,g]=T(0),_=_r(()=>({queryKey:[`grab`],queryFn:Tr,enabled:ZA()===`local`})),v=()=>{g(Date.now()),$A(`local`),FZ().catch(()=>$A(`capture`))};O(()=>{if(ZA()!==`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(`
|
|
220
|
+
`);f(e=>`${e?`${e}\n`:``}${t}\n`),$A(`capture`)});let y=async()=>{m(!0);try{let e=await BQ();e&&f(t=>`${t?`${t}\n`:``}${e}\n`)}finally{m(!1)}},b=vr(()=>({mutationFn:e=>AO(e.id,e.text),onSuccess:()=>{f(``),l()}})),x=vr(()=>({mutationFn:e=>jO(e.id,e.model),onSuccess:l})),S=vr(()=>({mutationFn:e=>NO(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(zO(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(()=>XQ(e.line.text));return t===`user`?(()=>{var e=z$(),t=e.firstChild.nextSibling;return D(()=>t.innerHTML=n()),e})():t===`assistant`||t===`result`?(()=>{var e=B$(),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=V$();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=W$(),a=e.firstChild;a.firstChild;var l=a.nextSibling;return P(a,j(M,{get when(){return t.data?.ok},get fallback(){return j(Oj,{class:`text-danger`,children:`bridge offline`})},get children(){return[j(M,{get when(){return y1(t.data.version,`0.15.1`)},get children(){return j(Oj,{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=H$(),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(Aj,{title:`Bridge not running`,get children(){return[`Start it in your repo's terminal:`,G$(),`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(Aj,{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=U$();return P(e,j(We,{get each(){return n.data},children:e=>(()=>{var t=a1(),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=o1();return D(n=>dt(t,`background`,ne(e.status))),t})()},get children(){return j(yj,{})}}),a),P(a,()=>e.title),P(l,()=>Nj(e.startedAt)),P(m,()=>e.lastText),P(h,j(Oj,{get color(){return ne(e.status)},get children(){return e.status}}),null),P(h,j(Oj,{get children(){return e.model??`default model`}}),null),P(h,j(M,{get when(){return e.pendingModel},get children(){return j(Oj,{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(Oj,{class:`text-warn`,get children(){return[`⛓ `,$e(()=>e.subagents),` subagents`]}})}}),null),P(h,j(M,{get when(){return e.usage},get children(){var t=K$(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>b1(e.usage.contextTokens),n),P(t,()=>b1(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=s1();return P(t,j(Oj,{get children(){return e().state.name}}),null),P(t,j(Tj,{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=q$(),n=t.firstChild;return P(t,j(Oj,{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(vj,{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(Sj,{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:v1,children:t=>(()=>{var n=c1();return P(n,()=>t.label),D(()=>n.selected=(e.pendingModel??e.model??``)===t.id),D(()=>n.value=t.id),n})()})}}),null),P(g,j(M,{get when(){return o(e)},children:e=>j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,onClick:()=>YA(`activity`,e().id),get children(){return l1()}})}),null),P(g,j(vj,{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 u1()},get children(){return J$()}})}}),null),P(g,j(vj,{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 Y$()}}),null),P(g,j(M,{get when(){return e.status===`running`},get children(){return j(vj,{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 X$()}})}}),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=Q$(),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=Z$();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=p1(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.path),P(r,j(M,{get when(){return!e.binary},get fallback(){return m1()},get children(){return[(()=>{var t=d1();return t.firstChild,P(t,()=>e.added,null),t})(),` `,(()=>{var t=f1();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=g1(),n=t.firstChild;return P(t,j(Oj,{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=$$();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 _1()},get children(){return j(Ge,{get each(){return s.data?.tail??[]},children:e=>j(re,{get line(){return e()}})})}})),e})(),(()=>{var t=i1(),n=t.firstChild,r=n.firstChild;return P(t,j(xj,{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(vj,{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 e1()}}),null),P(n,j(vj,{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 t1()}}),null),P(n,j(vj,{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 n1()}}),null),P(n,j(vj,{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 r1()}}),null),t})()]}}),null),t})()})),e}})}})),e})()}var S1=N(`<span class="text-text-faint text-[10.5px] tabular-nums">/<!> from your issues`),C1=N(`<div class="flex flex-col gap-1.5">`),w1=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">`),T1=N(`<span class="text-warn text-[10.5px]"title="Merge states come from gh via the bridge">states unknown — restart the bridge`),E1=N(`<button>`),D1=N(`<span class="text-[12px] leading-none">✓`),O1=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>`),k1=N(`<span class="text-success text-[12px] leading-none">✓`),A1=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">`),j1=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">`),M1=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">`),N1=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i;function P1(e){let t=_r(()=>({queryKey:[`my-issues`],queryFn:uO,refetchInterval:15e3})),n=k(()=>(t.data??[]).flatMap(e=>(e.attachments??[]).filter(e=>N1.test(e.url)).map(t=>({issue:e,attachment:t})))),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:1e4,retry:0})),i=_r(()=>({queryKey:[`pr-status`,n().map(e=>e.attachment.url).sort().join(`|`)],queryFn:()=>IO(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 LO(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=w1(),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 T1()},get children(){var e=S1(),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=E1();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(bj,{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(Aj,{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=C1();return P(t,j(We,{get each(){return d()},children:t=>(()=>{var n=A1(),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(kj,{get color(){return t.issue.state.color}}),s),P(s,()=>t.issue.identifier),P(c,()=>t.issue.title),P(l,()=>Nj(t.issue.updatedAt)),P(u,j(Oj,{get children(){return t.issue.state.name}}),d),P(u,j(M,{get when(){return t.issue.delegate},get children(){return j(Oj,{class:`text-accent`,get children(){return[j(Cj,{}),` `,$e(()=>t.issue.delegate.displayName)]}})}}),d),P(u,j(M,{get when(){return o(t)},get children(){return j(Oj,{class:`text-warn`,get children(){return[j(wj,{}),` local`]}})}}),d),P(u,j(Tj,{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(Oj,{get class(){return a(t)===`MERGED`?`text-success`:`text-text-faint`},get children(){return a(t)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(d,j(vj,{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 j1()},get children(){return D1()}})}}),null),P(d,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,"aria-label":`Open issue activity`,onClick:()=>{YA(`activity`,t.issue.id),e.onOpenIssue()},get children(){return O1()}}),null),P(d,j(vj,{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 M1()},get children(){return k1()}})}}),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`]),Rr();function F1(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function I1(e){let t=F1(crypto.getRandomValues(new Uint8Array(32))),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t)),r=F1(new Uint8Array(n)),i=F1(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 wr({linearAccessToken:d.access_token,linearOauthClientId:e})}async function L1(){await wr({linearAccessToken:void 0,linearApiKey:void 0})}Rr(),br(),Nx(),mD();var R1=N(`<div class="bg-surface-2 border-border flex rounded-md border p-0.5">`),z1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Cloud: picking an element opens the panel to draft & 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.`),B1=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`),V1=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).`),H1=N(`<span class=text-text>Connected as <span class=font-medium></span> · <span class=text-text-dim>`),U1=N(`<div class="bg-surface border-border flex items-center justify-between rounded-lg border p-2.5"><span class="text-text text-[12px]">`),W1=N(`<option value>Select a team…`),G1=N(`<p class="text-text-dim text-[11px]">No agents found — install the Cursor integration in Linear first.`),K1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Empty = the default above (computer-use testing, video demo, PR + review babysitting).`),q1=N(`<div class="flex flex-col gap-1.5">`),J1=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.`),Y1=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.`),X1=N(`<option value>Select a channel…`),Z1=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`),Q1=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.`),$1=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`),e0=N(`<p class="text-text-dim text-[11px]">`),t0=N(`<div class=min-h-[2lh]>`),n0=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.`),r0=N(`<div class="flex h-full flex-col gap-5 overflow-y-auto pt-3 pb-6 pl-3 pr-4">`),i0=N(`<button>`),a0=N(`<div class="flex gap-1.5">`),o0=N(`<p class="text-text-faint text-center text-[10.5px]">or`),s0=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">`),c0=N(`<div class="flex flex-col gap-3">`),l0=N(`<span class=text-text-dim>Connected — verifying…`),u0=N(`<option> (<!>)`),d0=N(`<option value>Select the agent…`),f0=N(`<option>`),p0=N(`<option>#`),m0=N(`<p class="text-text-dim text-[11px]">No key set — AI drafting disabled, manual drafting still works.`);function h0(){let e=sr(),t=_r(()=>({queryKey:[`settings`],queryFn:Cr,staleTime:0})),n=k(()=>t.data??{});async function r(t,n=!1){await wr(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:sO,enabled:i(),retry:0})),o=_r(()=>({queryKey:[`teams`],queryFn:cO,enabled:i()})),s=_r(()=>({queryKey:[`agents`],queryFn:lO,enabled:i()})),[c,l]=T(``),[u,d]=T(!1),[f,p]=T(``);async function m(){let e=c().trim();if(e){d(!0),p(``);try{await r({linearApiKey:e},!0),await sO(),l(``)}catch{p(`Key rejected — could not verify. Check the key and try again.`),await r({linearApiKey:void 0},!0)}finally{d(!1)}}}let[h,g]=T(``),[_,v]=T(!1),[y,b]=T(``);async function x(){let t=(h()||n().linearOauthClientId||``).trim();if(!t){b(`Enter an OAuth client ID first.`);return}v(!0),b(``);try{await I1(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){b(e instanceof Error?e.message:`OAuth flow failed.`)}finally{v(!1)}}let[S,C]=T(!1);async function w(){C(!0);try{await L1(),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{C(!1)}}let E=yr?chrome.identity.getRedirectURL():null,O=_r(()=>({queryKey:[`slack-channels`,n().slackToken],queryFn:()=>WO(n().slackToken),enabled:!!n().slackToken,retry:0,staleTime:6e4})),ee=k(()=>Ox(n())),te=k(()=>{let e=ee();return e?`Drafting with ${e} — ${jx[e].fast} (fast) / ${jx[e].best} (best)`:null});return(()=>{var e=r0();return P(e,j(Dj,{title:`Workflow`,get children(){return[(()=>{var e=R1();return P(e,j(We,{each:[{id:`cloud`,label:`Cloud · Linear + Cursor`},{id:`local`,label:`Local · clipboard`}],children:e=>(()=>{var t=i0();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})(),z1()]}}),null),P(e,j(Dj,{title:`Capture`,get children(){return[(()=>{var e=B1(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({captureShots:e.currentTarget.checked||void 0})),D(()=>t.checked=!!n().captureShots),e})(),V1()]}}),null),P(e,j(Dj,{title:`Linear`,get children(){return j(M,{get when(){return i()},get fallback(){return(()=>{var e=c0();return P(e,j(Ej,{label:`Personal API key`,hint:`Create one at linear.app → Settings → API — fastest path.`,get children(){return[(()=>{var e=a0();return P(e,j(bj,{type:`password`,placeholder:`lin_api_…`,get value(){return c()},onInput:e=>l(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&m()}}),null),P(e,j(vj,{variant:`primary`,get loading(){return u()},get disabled(){return!c().trim()},onClick:()=>void m(),class:`shrink-0`,children:`Connect`}),null),e})(),j(M,{get when(){return f()},get children(){return j(jj,{get message(){return f()}})}})]}}),null),P(e,j(M,{when:yr,get children(){return[o0(),j(Ej,{label:`OAuth client ID`,get children(){return[(()=>{var e=a0();return P(e,j(bj,{placeholder:`your-client-id`,get value(){return h()||n().linearOauthClientId||``},onInput:e=>g(e.currentTarget.value)}),null),P(e,j(vj,{variant:`ghost`,get loading(){return _()},onClick:()=>void x(),class:`shrink-0 whitespace-nowrap`,children:`Connect with OAuth`}),null),e})(),j(M,{get when(){return y()},get children(){return j(jj,{get message(){return y()}})}}),(()=>{var e=s0(),t=e.firstChild.nextSibling.nextSibling;return P(t,E),e})()]}})]}}),null),e})()},get children(){var e=U1(),t=e.firstChild;return P(t,j(M,{get when(){return!a.isLoading},get fallback(){return l0()},get children(){return j(M,{get when(){return a.data},get fallback(){return j(M,{get when(){return a.isError},get fallback(){return l0()},get children(){return j(jj,{message:`Key rejected — reconnect`})}})},get children(){var e=H1(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return P(t,()=>a.data.name),P(n,()=>a.data.email),e}})}})),P(e,j(vj,{variant:`ghost`,get loading(){return S()},onClick:()=>void w(),class:`ml-2 shrink-0`,children:`Disconnect`}),null),e}})}}),null),P(e,j(M,{get when(){return i()},get children(){return j(Dj,{title:`Workspace`,get children(){return[j(Ej,{label:`Default team`,get children(){return j(Sj,{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[W1(),j(M,{get when(){return o.data},get children(){return j(We,{get each(){return o.data},children:e=>(()=>{var t=u0(),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(Ej,{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(()=>!!s.data)()&&s.data.length===0},get fallback(){return j(Sj,{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=s.data?.find(e=>e.id===t);n&&r({cursorAgentId:n.id,cursorAgentName:n.displayName,cursorAgentUrl:n.url??void 0})},get disabled(){return s.isLoading},get children(){return[d0(),j(M,{get when(){return s.data},get children(){return j(We,{get each(){return s.data},children:e=>(()=>{var t=f0();return P(t,()=>e.displayName),D(()=>t.selected=e.id===n().cursorAgentId),D(()=>t.value=e.id),t})()})}})]}})},get children(){return G1()}})}}),j(Ej,{label:`Default repository`,hint:`Appended to delegated issues as [repo=…] so Cursor picks the right repo.`,get children(){return j(bj,{placeholder:`owner/repository`,get value(){return n().defaultRepo??``},onBlur:e=>{r({defaultRepo:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{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(bj,{placeholder:`Cursor's default`,get value(){return n().cursorModel??``},onBlur:e=>{r({cursorModel:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{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(xj,{rows:5,placeholder:pD,get value(){return n().issueTemplate??``},onBlur:e=>{r({issueTemplate:e.currentTarget.value.trim()||void 0})}}),K1()]}}),j(Ej,{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(bj,{placeholder:`/dev-server.log`,get value(){return n().logUrl??``},onBlur:e=>{r({logUrl:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Log lines to attach`,hint:`Trailing lines included in the issue (10–500).`,get children(){return j(bj,{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(Ej,{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(xj,{rows:4,placeholder:`.claude/skills/apple-hig-design-principles
|
|
221
221
|
.claude/CLAUDE.md
|
|
222
|
-
docs/design-tokens.md`,get value(){return n().skillPaths??``},onBlur:e=>{r({skillPaths:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{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=G1();return P(e,j(bj,{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(bj,{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:!yr,get children(){return j(Dj,{title:`Panel`,get children(){return[(()=>{var e=K1(),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=q1(),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(Dj,{title:`Local Claude Code`,get children(){return j(Ej,{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(bj,{placeholder:`http://localhost:4577`,get value(){return n().bridgeUrl??``},onBlur:e=>{r({bridgeUrl:e.currentTarget.value.trim()||void 0})}})}})}}),null),P(e,j(Dj,{title:`Asset uploads`,get children(){return[j(Ej,{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(bj,{type:`password`,placeholder:`github_pat_…`,get value(){return n().githubToken??``},onBlur:e=>{r({githubToken:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{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(bj,{placeholder:`ahmedbanihanibh/linear-grab-assets`,get value(){return n().githubAssetsRepo??``},onBlur:e=>{r({githubAssetsRepo:e.currentTarget.value.trim()||void 0})}})}})]}}),null),P(e,j(Dj,{title:`Notifications`,get children(){return[j(Ej,{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(bj,{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(Ej,{label:`Slack channel`,get children(){return j(M,{get when(){return!O.isError},get fallback(){return j(jj,{message:`Couldn't list channels — check the token scopes (channels:read).`})},get children(){return j(Sj,{get value(){return n().slackChannelId??``},get disabled(){return O.isLoading},onChange:e=>{let t=e.currentTarget.value,n=O.data?.find(e=>e.id===t);r({slackChannelId:t||void 0,slackChannelName:n?.name})},get children(){return[J1(),j(We,{get each(){return O.data??[]},children:e=>(()=>{var t=d0();return t.firstChild,P(t,()=>e.name,null),D(()=>t.selected=e.id===n().slackChannelId),D(()=>t.value=e.id),t})()})]}})}})}})}}),j(Ej,{label:`Telegram bot token`,hint:`From @BotFather. The agent also receives it to send the demo video (sendVideo).`,get children(){return j(bj,{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(Ej,{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(bj,{placeholder:`-1001234567890`,get value(){return n().telegramChatId??``},onBlur:e=>{r({telegramChatId:e.currentTarget.value.trim()||void 0})}})}})}}),(()=>{var e=Y1(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({notifyOnCreate:e.currentTarget.checked?void 0:!1})),D(()=>t.checked=n().notifyOnCreate!==!1),e})(),X1()]}}),null),P(e,j(Dj,{title:`AI providers`,get children(){return[j(Ej,{label:`OpenAI API key`,get children(){return j(bj,{type:`password`,placeholder:`sk-…`,get value(){return n().openaiKey??``},onBlur:e=>{r({openaiKey:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Anthropic API key`,get children(){return j(bj,{type:`password`,placeholder:`sk-ant-…`,get value(){return n().anthropicKey??``},onBlur:e=>{r({anthropicKey:e.currentTarget.value.trim()||void 0})}})}}),(()=>{var e=Z1(),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=$1();return P(e,j(M,{get when(){return te()},get fallback(){return f0()},get children(){var e=Q1();return P(e,te),e}})),e})()]}}),null),P(e,j(Dj,{title:`How it works`,get children(){return e0()}}),null),e})()}rt([`click`]);var m0=`linear-grab`,h0=`queries`,g0=[`my-issues`,`issue`,`sessions`,`teams`,`agents`];function _0(){return new Promise(e=>{try{let t=indexedDB.open(m0,1);t.onupgradeneeded=()=>t.result.createObjectStore(h0),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}function v0(e){return typeof e[0]==`string`&&g0.includes(e[0])}async function y0(e){let t=await _0();if(!t)return()=>{};await new Promise(n=>{try{let r=t.transaction(h0,`readonly`).objectStore(h0).openCursor();r.onsuccess=()=>{let t=r.result;if(!t)return n();try{let{queryKey:n,data:r}=t.value;v0(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(!v0(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(h0,`readwrite`).objectStore(h0).put({queryKey:i,data:n},a)}catch{}},400))});return()=>{r();for(let e of n.values())clearTimeout(e);t.close()}}Rr();var b0=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">`),x0=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">`),S0=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">–`),C0=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>`),w0=N(`<button>`),T0=[{id:`draft`,label:`Draft`},{id:`capture`,label:`Capture`},{id:`activity`,label:`Activity`},{id:`local`,label:`Local`},{id:`prs`,label:`PRs`},{id:`settings`,label:`Settings`}],E0=new gr({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});function D0(e){return(()=>{var t=b0();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 O0(e){let[t,n]=T(`draft`),r=()=>{E0.invalidateQueries({queryKey:[`grab`]}),ZA()===`capture`&&n(`capture`),e.onGrab?.()};return O(()=>{let e=GA();e&&n(e)}),ie(()=>{let e=y0(E0),t=IZ(r),n=()=>{RO().then(KQ),FO()};n();let i=Ar(e=>{e===`settings`&&(E0.invalidateQueries({queryKey:[`settings`]}),n()),e===`grab`&&r()});ae(()=>{t(),i(),e.then(e=>e())})}),j(cr,{client:E0,get children(){var r=C0(),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;return i.$$pointerdown=t=>e.onHeaderPointerDown?.(t),P(a,j(D0,{size:14})),P(o,j(We,{each:T0,children:e=>(()=>{var r=w0();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=x0();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=S0();return t.$$click=()=>e.onClose?.(),t}}),null),P(s,j(dM,{onCreated:()=>n(`activity`)})),P(c,j(aQ,{})),P(l,j(M$,{})),P(u,j(y1,{})),P(d,j(M1,{onOpenIssue:()=>n(`activity`)})),P(f,j(p0,{})),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`,p=t()!==`activity`,m=t()!==`local`,h=t()!==`prs`,g=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),p!==n.o&&l.classList.toggle(`hidden`,n.o=p),m!==n.i&&u.classList.toggle(`hidden`,n.i=m),h!==n.n&&d.classList.toggle(`hidden`,n.n=h),g!==n.s&&f.classList.toggle(`hidden`,n.s=g),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),r}})}rt([`pointerdown`,`click`]);var k0=`/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
|
|
223
|
-
@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-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-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-\\[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-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-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}.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}}`;Rr();var A0=N(`<span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full">`),j0=N(`<span class="text-text min-w-[5ch] text-[11px] font-medium tabular-nums">`),M0=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`),N0=N(`<p class="text-warn px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Needs review`),P0=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`),F0=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">`),I0=N(`<div><div title="Drag to resize">`),L0=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">`),R0=N(`<span class="bg-border h-4 w-px"aria-hidden>`),z0=N(`<span aria-hidden class="bg-warn size-2 rounded-full">`),B0=N(`<span class="text-warn min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums"> rev`),V0=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>`),H0=N(`<p class="text-text-faint px-1.5 pb-1.5 text-[11.5px]">No agents running right now.`),U0=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 W0(e={}){if(typeof window>`u`||window.__LINEAR_GRAB_PAGE__)return;window.__LINEAR_GRAB_PAGE__=!0;let t=()=>{$O(),PZ();let t=document.createElement(`div`);t.id=`linear-grab-root`,document.body.appendChild(t);let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=k0,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=()=>i.setAttribute(`data-theme`,G0());a(),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,a),nt(()=>j(Z0,{get defaultOpen(){return e.defaultOpen??!1}}),i)};document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function G0(){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 K0=130,q0=36,J0=380,Y0=280,X0=720;function Z0(e){let[t,n]=T(e.defaultOpen),[r,i]=T(`right`),[a,o]=T({x:Math.max(8,window.innerWidth-K0-24),y:Math.max(8,window.innerHeight-q0-20)}),[s,c]=T({running:[],review:[]}),l=()=>s().running,u=()=>s().review,[d,f]=T(!1),[p,m]=T(BD().phase),[h,g]=T(0);ie(()=>{let e=setInterval(()=>{p()===`recording`&&g(Date.now()-(BD().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-K0-8),y:Math.min(Math.max(8,e.y),window.innerHeight-q0-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(J0),ne=e=>Math.min(X0,Math.max(Y0,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),wr({panelMode:e?`pinned`:`overlay`,panelPos:void 0})};ie(()=>{Cr().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=Ar(e=>{e===`settings`&&Cr().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(EZ,t);let r=()=>{f(!1),S()||n(!1)};window.addEventListener(DZ,r),ae(()=>{window.removeEventListener(EZ,t),window.removeEventListener(DZ,r)});let s=PQ(c),l=BD().phase,u=VD(e=>{m(e.phase),e.phase===`recording`&&l!==`recording`&&!S()&&n(!1),e.phase===`ready`&&l!==`ready`&&(YA(`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&&wr({launcherPos:a()})};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},ce=()=>a().y>260,le=e=>{f(!1),YA(`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),wr({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),wr({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&&wr({panelPos:e})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)};return[j(M,{get when(){return!t()},get children(){var e=F0(),t=e.firstChild;return t.$$pointerdown=se,P(t,j(M,{get when(){return p()===`recording`},get fallback(){return[(()=>{var e=L0();return e.$$click=()=>{oe||(f(!1),n(!0))},P(e,j(D0,{size:13})),e})(),R0(),(()=>{var e=V0(),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[z0(),(()=>{var e=B0(),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[A0(),(()=>{var e=j0();return P(e,()=>_(h())),e})(),(()=>{var e=M0();return e.$$click=()=>{oe||QD()},e})()]}})),P(e,j(M,{get when(){return d()},get children(){var e=P0(),t=e.firstChild;return P(e,j(M,{get when(){return u().length>0},get children(){return[N0(),j(We,{get each(){return u()},children:e=>j(Q0,{agent:e,review:!0,onOpen:le})})]}}),t),P(e,j(M,{get when(){return l().length>0},get fallback(){return H0()},get children(){return j(We,{get each(){return l()},children:e=>j(Q0,{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=I0(),t=e.firstChild;return t.$$pointerdown=ue,P(e,j(O0,{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 Q0(e){return(()=>{var t=U0(),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,()=>$0(e.agent.updatedAt),null),D(t=>dt(r,`background`,e.review?`var(--color-warn)`:e.agent.stateColor)),t})()}function $0(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`]),W0()})();
|
|
222
|
+
docs/design-tokens.md`,get value(){return n().skillPaths??``},onBlur:e=>{r({skillPaths:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{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=q1();return P(e,j(bj,{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(bj,{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:!yr,get children(){return j(Dj,{title:`Panel`,get children(){return[(()=>{var e=J1(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[{id:`overlay`,label:`Overlay`},{id:`pinned`,label:`Beside page`}],children:e=>(()=>{var t=i0();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=Y1(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[`left`,`right`],children:e=>(()=>{var t=i0();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(Dj,{title:`Local Claude Code`,get children(){return j(Ej,{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(bj,{placeholder:`http://localhost:4577`,get value(){return n().bridgeUrl??``},onBlur:e=>{r({bridgeUrl:e.currentTarget.value.trim()||void 0})}})}})}}),null),P(e,j(Dj,{title:`Asset uploads`,get children(){return[j(Ej,{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(bj,{type:`password`,placeholder:`github_pat_…`,get value(){return n().githubToken??``},onBlur:e=>{r({githubToken:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{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(bj,{placeholder:`ahmedbanihanibh/linear-grab-assets`,get value(){return n().githubAssetsRepo??``},onBlur:e=>{r({githubAssetsRepo:e.currentTarget.value.trim()||void 0})}})}})]}}),null),P(e,j(Dj,{title:`Notifications`,get children(){return[j(Ej,{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(bj,{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(Ej,{label:`Slack channel`,get children(){return j(M,{get when(){return!O.isError},get fallback(){return j(jj,{message:`Couldn't list channels — check the token scopes (channels:read).`})},get children(){return j(Sj,{get value(){return n().slackChannelId??``},get disabled(){return O.isLoading},onChange:e=>{let t=e.currentTarget.value,n=O.data?.find(e=>e.id===t);r({slackChannelId:t||void 0,slackChannelName:n?.name})},get children(){return[X1(),j(We,{get each(){return O.data??[]},children:e=>(()=>{var t=p0();return t.firstChild,P(t,()=>e.name,null),D(()=>t.selected=e.id===n().slackChannelId),D(()=>t.value=e.id),t})()})]}})}})}})}}),j(Ej,{label:`Telegram bot token`,hint:`From @BotFather. The agent also receives it to send the demo video (sendVideo).`,get children(){return j(bj,{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(Ej,{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(bj,{placeholder:`-1001234567890`,get value(){return n().telegramChatId??``},onBlur:e=>{r({telegramChatId:e.currentTarget.value.trim()||void 0})}})}})}}),(()=>{var e=Z1(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({notifyOnCreate:e.currentTarget.checked?void 0:!1})),D(()=>t.checked=n().notifyOnCreate!==!1),e})(),Q1()]}}),null),P(e,j(Dj,{title:`AI providers`,get children(){return[j(Ej,{label:`OpenAI API key`,get children(){return j(bj,{type:`password`,placeholder:`sk-…`,get value(){return n().openaiKey??``},onBlur:e=>{r({openaiKey:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Anthropic API key`,get children(){return j(bj,{type:`password`,placeholder:`sk-ant-…`,get value(){return n().anthropicKey??``},onBlur:e=>{r({anthropicKey:e.currentTarget.value.trim()||void 0})}})}}),(()=>{var e=$1(),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=t0();return P(e,j(M,{get when(){return te()},get fallback(){return m0()},get children(){var e=e0();return P(e,te),e}})),e})()]}}),null),P(e,j(Dj,{title:`How it works`,get children(){return n0()}}),null),e})()}rt([`click`]);var g0=`linear-grab`,_0=`queries`,v0=[`my-issues`,`issue`,`sessions`,`teams`,`agents`];function y0(){return new Promise(e=>{try{let t=indexedDB.open(g0,1);t.onupgradeneeded=()=>t.result.createObjectStore(_0),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}function b0(e){return typeof e[0]==`string`&&v0.includes(e[0])}async function x0(e){let t=await y0();if(!t)return()=>{};await new Promise(n=>{try{let r=t.transaction(_0,`readonly`).objectStore(_0).openCursor();r.onsuccess=()=>{let t=r.result;if(!t)return n();try{let{queryKey:n,data:r}=t.value;b0(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(!b0(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(_0,`readwrite`).objectStore(_0).put({queryKey:i,data:n},a)}catch{}},400))});return()=>{r();for(let e of n.values())clearTimeout(e);t.close()}}Rr();var S0=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">`),C0=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">`),w0=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">–`),T0=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>`),E0=N(`<button>`),D0=[{id:`draft`,label:`Draft`},{id:`capture`,label:`Capture`},{id:`activity`,label:`Activity`},{id:`local`,label:`Local`},{id:`prs`,label:`PRs`},{id:`settings`,label:`Settings`}],O0=new gr({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});function k0(e){return(()=>{var t=S0();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 A0(e){let[t,n]=T(`draft`),r=()=>{O0.invalidateQueries({queryKey:[`grab`]}),ZA()===`capture`&&n(`capture`),e.onGrab?.()};return O(()=>{let e=GA();e&&n(e)}),ie(()=>{let e=x0(O0),t=IZ(r),n=()=>{RO().then(qQ),FO()};n();let i=Ar(e=>{e===`settings`&&(O0.invalidateQueries({queryKey:[`settings`]}),n()),e===`grab`&&r()});ae(()=>{t(),i(),e.then(e=>e())})}),j(cr,{client:O0,get children(){var r=T0(),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;return i.$$pointerdown=t=>e.onHeaderPointerDown?.(t),P(a,j(k0,{size:14})),P(o,j(We,{each:D0,children:e=>(()=>{var r=E0();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=C0();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=w0();return t.$$click=()=>e.onClose?.(),t}}),null),P(s,j(dM,{onCreated:()=>n(`activity`)})),P(c,j(oQ,{})),P(l,j(P$,{})),P(u,j(x1,{})),P(d,j(P1,{onOpenIssue:()=>n(`activity`)})),P(f,j(h0,{})),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`,p=t()!==`activity`,m=t()!==`local`,h=t()!==`prs`,g=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),p!==n.o&&l.classList.toggle(`hidden`,n.o=p),m!==n.i&&u.classList.toggle(`hidden`,n.i=m),h!==n.n&&d.classList.toggle(`hidden`,n.n=h),g!==n.s&&f.classList.toggle(`hidden`,n.s=g),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),r}})}rt([`pointerdown`,`click`]);var j0=`/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
|
|
223
|
+
@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-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-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-\\[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-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-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}.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}}`;Rr();var M0=N(`<span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full">`),N0=N(`<span class="text-text min-w-[5ch] text-[11px] font-medium tabular-nums">`),P0=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`),F0=N(`<p class="text-warn px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Needs review`),I0=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`),L0=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">`),R0=N(`<div><div title="Drag to resize">`),z0=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">`),B0=N(`<span class="bg-border h-4 w-px"aria-hidden>`),V0=N(`<span aria-hidden class="bg-warn size-2 rounded-full">`),H0=N(`<span class="text-warn min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums"> rev`),U0=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>`),W0=N(`<p class="text-text-faint px-1.5 pb-1.5 text-[11.5px]">No agents running right now.`),G0=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 K0(e={}){if(typeof window>`u`||window.__LINEAR_GRAB_PAGE__)return;window.__LINEAR_GRAB_PAGE__=!0;let t=()=>{$O(),PZ();let t=document.createElement(`div`);t.id=`linear-grab-root`,document.body.appendChild(t);let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=j0,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=()=>i.setAttribute(`data-theme`,q0());a(),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,a),nt(()=>j($0,{get defaultOpen(){return e.defaultOpen??!1}}),i)};document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function q0(){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 J0=130,Y0=36,X0=380,Z0=280,Q0=720;function $0(e){let[t,n]=T(e.defaultOpen),[r,i]=T(`right`),[a,o]=T({x:Math.max(8,window.innerWidth-J0-24),y:Math.max(8,window.innerHeight-Y0-20)}),[s,c]=T({running:[],review:[]}),l=()=>s().running,u=()=>s().review,[d,f]=T(!1),[p,m]=T(BD().phase),[h,g]=T(0);ie(()=>{let e=setInterval(()=>{p()===`recording`&&g(Date.now()-(BD().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-J0-8),y:Math.min(Math.max(8,e.y),window.innerHeight-Y0-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(X0),ne=e=>Math.min(Q0,Math.max(Z0,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),wr({panelMode:e?`pinned`:`overlay`,panelPos:void 0})};ie(()=>{Cr().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=Ar(e=>{e===`settings`&&Cr().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(EZ,t);let r=()=>{f(!1),S()||n(!1)};window.addEventListener(DZ,r),ae(()=>{window.removeEventListener(EZ,t),window.removeEventListener(DZ,r)});let s=FQ(c),l=BD().phase,u=VD(e=>{m(e.phase),e.phase===`recording`&&l!==`recording`&&!S()&&n(!1),e.phase===`ready`&&l!==`ready`&&(YA(`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&&wr({launcherPos:a()})};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},ce=()=>a().y>260,le=e=>{f(!1),YA(`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),wr({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),wr({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&&wr({panelPos:e})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)};return[j(M,{get when(){return!t()},get children(){var e=L0(),t=e.firstChild;return t.$$pointerdown=se,P(t,j(M,{get when(){return p()===`recording`},get fallback(){return[(()=>{var e=z0();return e.$$click=()=>{oe||(f(!1),n(!0))},P(e,j(k0,{size:13})),e})(),B0(),(()=>{var e=U0(),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[V0(),(()=>{var e=H0(),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[M0(),(()=>{var e=N0();return P(e,()=>_(h())),e})(),(()=>{var e=P0();return e.$$click=()=>{oe||QD()},e})()]}})),P(e,j(M,{get when(){return d()},get children(){var e=I0(),t=e.firstChild;return P(e,j(M,{get when(){return u().length>0},get children(){return[F0(),j(We,{get each(){return u()},children:e=>j(e2,{agent:e,review:!0,onOpen:le})})]}}),t),P(e,j(M,{get when(){return l().length>0},get fallback(){return W0()},get children(){return j(We,{get each(){return l()},children:e=>j(e2,{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=R0(),t=e.firstChild;return t.$$pointerdown=ue,P(e,j(A0,{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 e2(e){return(()=>{var t=G0(),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,()=>t2(e.agent.updatedAt),null),D(t=>dt(r,`background`,e.review?`var(--color-warn)`:e.agent.stateColor)),t})()}function t2(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`]),K0()})();
|