linear-grab 0.15.3 → 0.15.5
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 +2 -2
- package/dist/linear-grab.js +7 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ export default function RootLayout({ children }) {
|
|
|
26
26
|
{children}
|
|
27
27
|
{process.env.NODE_ENV === "development" && (
|
|
28
28
|
<Script
|
|
29
|
-
src="https://cdn.jsdelivr.net/gh/ahmedbanihanibh/linear-grab@v0.15.
|
|
29
|
+
src="https://cdn.jsdelivr.net/gh/ahmedbanihanibh/linear-grab@v0.15.5/dist/index.global.js"
|
|
30
30
|
crossOrigin="anonymous"
|
|
31
31
|
strategy="afterInteractive"
|
|
32
32
|
/>
|
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}if(n.source?.filePath){let e=t.findIndex(e=>e.source?.filePath===n.source.filePath&&e.source?.lineNumber===n.source.lineNumber);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??``}`:`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)}`;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}.
|
|
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(`
|
|
@@ -177,7 +177,7 @@ of the other sections.`,pD="- FIRST, self-orient in the repo checkout (skip any
|
|
|
177
177
|
`).slice(-n).join(`
|
|
178
178
|
`).trim();return i.length>GO&&(i=`…\n${i.slice(i.length-GO)}`),i||null}finally{clearTimeout(i)}}var JO=50,YO=[],XO=!1;function ZO(e){if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(typeof e==`object`&&e)try{return JSON.stringify(e).slice(0,400)}catch{return String(e)}return String(e)}function QO(e,t){let n=t.map(ZO).join(` `).slice(0,600);n.trim()&&(YO.push({at:Date.now(),level:e,text:n}),YO.length>JO&&YO.shift())}function $O(){if(XO||typeof window>`u`)return;XO=!0;let e=console.error.bind(console);console.error=(...t)=>{QO(`error`,t),e(...t)};let t=console.warn.bind(console);console.warn=(...e)=>{QO(`warn`,e),t(...e)},window.addEventListener(`error`,e=>{QO(`error`,[`${e.message}${e.filename?` (${e.filename}:${e.lineno})`:``}`])}),window.addEventListener(`unhandledrejection`,e=>{let t=e.reason;QO(`unhandled`,[t?.stack??String(e.reason??`unhandled rejection`)])})}function ek(e=30){return YO.slice(-e)}function tk(e=30){let t=ek(e);if(!t.length)return null;let n=t.map(e=>`[${new Date(e.at).toTimeString().slice(0,8)}] ${e.level.toUpperCase()}: ${e.text}`).join(`
|
|
179
179
|
`);return n.length>8e3&&(n=`…\n${n.slice(n.length-8e3)}`),n}function nk(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}var rk=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function ik(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}var ak=null;function ok(e={}){return ak||(e.includeStyleProperties?(ak=e.includeStyleProperties,ak):(ak=ik(window.getComputedStyle(document.documentElement)),ak))}function sk(e,t){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace(`px`,``)):0}function ck(e){let t=sk(e,`border-left-width`),n=sk(e,`border-right-width`);return e.clientWidth+t+n}function lk(e){let t=sk(e,`border-top-width`),n=sk(e,`border-bottom-width`);return e.clientHeight+t+n}function uk(e,t={}){return{width:t.width||ck(e),height:t.height||lk(e)}}function dk(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var fk=16384;function pk(e){(e.width>fk||e.height>fk)&&(e.width>fk&&e.height>fk?e.width>e.height?(e.height*=fk/e.width,e.width=fk):(e.width*=fk/e.height,e.height=fk):e.width>fk?(e.height*=fk/e.width,e.width=fk):(e.width*=fk/e.height,e.height=fk))}function mk(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin=`anonymous`,r.decoding=`async`,r.src=e})}async function hk(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function gk(e,t,n){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`),a=document.createElementNS(r,`foreignObject`);return i.setAttribute(`width`,`${t}`),i.setAttribute(`height`,`${n}`),i.setAttribute(`viewBox`,`0 0 ${t} ${n}`),a.setAttribute(`width`,`100%`),a.setAttribute(`height`,`100%`),a.setAttribute(`x`,`0`),a.setAttribute(`y`,`0`),a.setAttribute(`externalResourcesRequired`,`true`),i.appendChild(a),a.appendChild(e),hk(i)}var _k=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||_k(n,t)};function vk(e){let t=e.getPropertyValue(`content`);return`${e.cssText} content: '${t.replace(/'|"/g,``)}';`}function yk(e,t){return ok(t).map(t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?` !important`:``};`).join(` `)}function bk(e,t,n,r){let i=`.${e}:${t}`,a=n.cssText?vk(n):yk(n,r);return document.createTextNode(`${i}{${a}}`)}function xk(e,t,n,r){let i=window.getComputedStyle(e,n),a=i.getPropertyValue(`content`);if(a===``||a===`none`)return;let o=rk();try{t.className=`${t.className} ${o}`}catch{return}let s=document.createElement(`style`);s.appendChild(bk(o,n,i,r)),t.appendChild(s)}function Sk(e,t,n){xk(e,t,`:before`,n),xk(e,t,`:after`,n)}var Ck=`application/font-woff`,wk=`image/jpeg`,Tk={woff:Ck,woff2:Ck,ttf:`application/font-truetype`,eot:`application/vnd.ms-fontobject`,png:`image/png`,jpg:wk,jpeg:wk,gif:`image/gif`,tiff:`image/tiff`,svg:`image/svg+xml`,webp:`image/webp`};function Ek(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:``}function Dk(e){return Tk[Ek(e).toLowerCase()]||``}function Ok(e){return e.split(/,/)[1]}function kk(e){return e.search(/^(data:)/)!==-1}function Ak(e,t){return`data:${t};base64,${e}`}async function jk(e,t,n){let r=await fetch(e,t);if(r.status===404)throw Error(`Resource "${r.url}" not found`);let i=await r.blob();return new Promise((e,t)=>{let a=new FileReader;a.onerror=t,a.onloadend=()=>{try{e(n({res:r,result:a.result}))}catch(e){t(e)}},a.readAsDataURL(i)})}var Mk={};function Nk(e,t,n){let r=e.replace(/\?.*/,``);return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,``)),t?`[${t}]${r}`:r}async function Pk(e,t,n){let r=Nk(e,t,n.includeQueryParams);if(Mk[r]!=null)return Mk[r];n.cacheBust&&(e+=(/\?/.test(e)?`&`:`?`)+new Date().getTime());let i;try{i=Ak(await jk(e,n.fetchRequestInit,({res:e,result:n})=>(t||=e.headers.get(`Content-Type`)||``,Ok(n))),t)}catch(t){i=n.imagePlaceholder||``;let r=`Failed to fetch resource: ${e}`;t&&(r=typeof t==`string`?t:t.message),r&&console.warn(r)}return Mk[r]=i,i}async function Fk(e){let t=e.toDataURL();return t===`data:,`?e.cloneNode(!1):mk(t)}async function Ik(e,t){if(e.currentSrc){let t=document.createElement(`canvas`),n=t.getContext(`2d`);return t.width=e.clientWidth,t.height=e.clientHeight,n?.drawImage(e,0,0,t.width,t.height),mk(t.toDataURL())}let n=e.poster;return mk(await Pk(n,Dk(n),t))}async function Lk(e,t){try{if(e?.contentDocument?.body)return await qk(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function Rk(e,t){return _k(e,HTMLCanvasElement)?Fk(e):_k(e,HTMLVideoElement)?Ik(e,t):_k(e,HTMLIFrameElement)?Lk(e,t):e.cloneNode(Bk(e))}var zk=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SLOT`,Bk=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SVG`;async function Vk(e,t,n){if(Bk(t))return t;let r=[];return r=zk(e)&&e.assignedNodes?ik(e.assignedNodes()):_k(e,HTMLIFrameElement)&&e.contentDocument?.body?ik(e.contentDocument.body.childNodes):ik((e.shadowRoot??e).childNodes),r.length===0||_k(e,HTMLVideoElement)||await r.reduce((e,r)=>e.then(()=>qk(r,n)).then(e=>{e&&t.appendChild(e)}),Promise.resolve()),t}function Hk(e,t,n){let r=t.style;if(!r)return;let i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):ok(n).forEach(n=>{let a=i.getPropertyValue(n);n===`font-size`&&a.endsWith(`px`)&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),_k(e,HTMLIFrameElement)&&n===`display`&&a===`inline`&&(a=`block`),n===`d`&&t.getAttribute(`d`)&&(a=`path(${t.getAttribute(`d`)})`),r.setProperty(n,a,i.getPropertyPriority(n))})}function Uk(e,t){_k(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),_k(e,HTMLInputElement)&&t.setAttribute(`value`,e.value)}function Wk(e,t){if(_k(e,HTMLSelectElement)){let n=t,r=Array.from(n.children).find(t=>e.value===t.getAttribute(`value`));r&&r.setAttribute(`selected`,``)}}function Gk(e,t,n){return _k(t,Element)&&(Hk(e,t,n),Sk(e,t,n),Uk(e,t),Wk(e,t)),t}async function Kk(e,t){let n=e.querySelectorAll?e.querySelectorAll(`use`):[];if(n.length===0)return e;let r={};for(let i=0;i<n.length;i++){let a=n[i].getAttribute(`xlink:href`);if(a){let n=e.querySelector(a),i=document.querySelector(a);!n&&i&&!r[a]&&(r[a]=await qk(i,t,!0))}}let i=Object.values(r);if(i.length){let t=`http://www.w3.org/1999/xhtml`,n=document.createElementNS(t,`svg`);n.setAttribute(`xmlns`,t),n.style.position=`absolute`,n.style.width=`0`,n.style.height=`0`,n.style.overflow=`hidden`,n.style.display=`none`;let r=document.createElementNS(t,`defs`);n.appendChild(r);for(let e=0;e<i.length;e++)r.appendChild(i[e]);e.appendChild(n)}return e}async function qk(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(e=>Rk(e,t)).then(n=>Vk(e,n,t)).then(n=>Gk(e,n,t)).then(e=>Kk(e,t))}var Jk=/url\((['"]?)([^'"]+?)\1\)/g,Yk=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Xk=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Zk(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}function Qk(e){let t=[];return e.replace(Jk,(e,n,r)=>(t.push(r),e)),t.filter(e=>!kk(e))}async function $k(e,t,n,r,i){try{let a=n?nk(t,n):t,o=Dk(t),s;return s=i?Ak(await i(a),o):await Pk(a,o,r),e.replace(Zk(t),`$1${s}$3`)}catch{}return e}function eA(e,{preferredFontFormat:t}){return t?e.replace(Xk,e=>{for(;;){let[n,,r]=Yk.exec(e)||[];if(!r)return``;if(r===t)return`src: ${n};`}}):e}function tA(e){return e.search(Jk)!==-1}async function nA(e,t,n){if(!tA(e))return e;let r=eA(e,n);return Qk(r).reduce((e,r)=>e.then(e=>$k(e,r,t,n)),Promise.resolve(r))}async function rA(e,t,n){let r=t.style?.getPropertyValue(e);if(r){let i=await nA(r,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function iA(e,t){await rA(`background`,e,t)||await rA(`background-image`,e,t),await rA(`mask`,e,t)||await rA(`-webkit-mask`,e,t)||await rA(`mask-image`,e,t)||await rA(`-webkit-mask-image`,e,t)}async function aA(e,t){let n=_k(e,HTMLImageElement);if(!(n&&!kk(e.src))&&!(_k(e,SVGImageElement)&&!kk(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,i=await Pk(r,Dk(r),t);await new Promise((r,a)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){a(e)}}:a;let o=e;o.decode&&=r,o.loading===`lazy`&&(o.loading=`eager`),n?(e.srcset=``,e.src=i):e.href.baseVal=i})}async function oA(e,t){let n=ik(e.childNodes).map(e=>sA(e,t));await Promise.all(n).then(()=>e)}async function sA(e,t){_k(e,Element)&&(await iA(e,t),await aA(e,t),await oA(e,t))}function cA(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;return r!=null&&Object.keys(r).forEach(e=>{n[e]=r[e]}),e}var lA={};async function uA(e){let t=lA[e];return t??(t={url:e,cssText:await(await fetch(e)).text()},lA[e]=t,t)}async function dA(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async i=>{let a=i.replace(r,`$1`);return a.startsWith(`https://`)||(a=new URL(a,e.url).href),jk(a,t.fetchRequestInit,({result:e})=>(n=n.replace(i,`url(${e})`),[i,e]))});return Promise.all(i).then(()=>n)}function fA(e){if(e==null)return[];let t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,``),r=RegExp(`((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})`,`gi`);for(;;){let e=r.exec(n);if(e===null)break;t.push(e[0])}n=n.replace(r,``);let i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a=RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=i.exec(n);if(e===null){if(e=a.exec(n),e===null)break;i.lastIndex=a.lastIndex}else a.lastIndex=i.lastIndex;t.push(e[0])}return t}async function pA(e,t){let n=[],r=[];return e.forEach(n=>{if(`cssRules`in n)try{ik(n.cssRules||[]).forEach((e,i)=>{if(e.type===CSSRule.IMPORT_RULE){let a=i+1,o=e.href,s=uA(o).then(e=>dA(e,t)).then(e=>fA(e).forEach(e=>{try{n.insertRule(e,e.startsWith(`@import`)?a+=1:n.cssRules.length)}catch(t){console.error(`Error inserting rule from remote css`,{rule:e,error:t})}})).catch(e=>{console.error(`Error loading remote css`,e.toString())});r.push(s)}})}catch(i){let a=e.find(e=>e.href==null)||document.styleSheets[0];n.href!=null&&r.push(uA(n.href).then(e=>dA(e,t)).then(e=>fA(e).forEach(e=>{a.insertRule(e,a.cssRules.length)})).catch(e=>{console.error(`Error loading remote stylesheet`,e)})),console.error(`Error inlining remote css file`,i)}}),Promise.all(r).then(()=>(e.forEach(e=>{if(`cssRules`in e)try{ik(e.cssRules||[]).forEach(e=>{n.push(e)})}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}}),n))}function mA(e){return e.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>tA(e.style.getPropertyValue(`src`)))}async function hA(e,t){if(e.ownerDocument==null)throw Error(`Provided element is not within a Document`);return mA(await pA(ik(e.ownerDocument.styleSheets),t))}function gA(e){return e.trim().replace(/["']/g,``)}function _A(e){let t=new Set;function n(e){(e.style.fontFamily||getComputedStyle(e).fontFamily).split(`,`).forEach(e=>{t.add(gA(e))}),Array.from(e.children).forEach(e=>{e instanceof HTMLElement&&n(e)})}return n(e),t}async function vA(e,t){let n=await hA(e,t),r=_A(e);return(await Promise.all(n.filter(e=>r.has(gA(e.style.fontFamily))).map(e=>{let n=e.parentStyleSheet?e.parentStyleSheet.href:null;return nA(e.cssText,n,t)}))).join(`
|
|
180
|
-
`)}async function yA(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await vA(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function bA(e,t={}){let{width:n,height:r}=uk(e,t),i=await qk(e,t,!0);return await yA(i,t),await sA(i,t),cA(i,t),await gk(i,n,r)}async function xA(e,t={}){let{width:n,height:r}=uk(e,t),i=await mk(await bA(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||dk(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||pk(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function SA(e,t={}){return vA(e,t)}var CA=6,wA=class{last=performance.now();async tick(){performance.now()-this.last<=CA||(await new Promise(e=>{`requestIdleCallback`in window?requestIdleCallback(()=>e(),{timeout:100}):setTimeout(e,0)}),this.last=performance.now())}},TA=null,EA=new Map;function DA(e){let t=EA.get(e);if(t)return t;if(!TA){let e=document.createElement(`iframe`);if(e.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden`,document.body.appendChild(e),TA=e.contentDocument,!TA)return{}}let n=TA.createElement(e);TA.body.appendChild(n);let r=TA.defaultView.getComputedStyle(n),i={};for(let e=0;e<r.length;e++){let t=r[e];i[t]=r.getPropertyValue(t)}return n.remove(),EA.set(e,i),i}function OA(){try{for(let e of[`div`,`span`,`p`,`a`,`button`,`img`,`ul`,`li`,`svg`])DA(e)}catch{}}function kA(e){if(e.id===`linear-grab-root`)return!0;let t=e.tagName?.toLowerCase()??``;return t===`overlay-canvas`||t.startsWith(`react-grab`)||t===`script`||t===`iframe`}function AA(e,t){try{let n=document.createElement(`canvas`);n.width=e.naturalWidth||e.width||1,n.height=e.naturalHeight||e.height||1,n.getContext(`2d`).drawImage(e,0,0),t.src=n.toDataURL(`image/png`)}catch{t.removeAttribute(`src`),t.setAttribute(`style`,`${t.getAttribute(`style`)??``}background:#8b8e9822;`)}}async function jA(e,t){if(kA(e))return null;if(e instanceof SVGSVGElement)return e.cloneNode(!0);let n=e.cloneNode(!1),r=getComputedStyle(e),i=DA(e.tagName.toLowerCase()),a=``;for(let e=0;e<r.length;e++){let t=r[e],n=r.getPropertyValue(t);n&&n!==i[t]&&(a+=`${t}:${n};`)}if(n.setAttribute(`style`,a),n.removeAttribute(`class`),e instanceof HTMLImageElement&&AA(e,n),e instanceof HTMLCanvasElement)try{let t=document.createElement(`img`);return t.setAttribute(`style`,a),t.src=e.toDataURL(),t}catch{}e instanceof HTMLInputElement&&n.setAttribute(`value`,e.value),e instanceof HTMLTextAreaElement&&(n.textContent=e.value),await t.tick();for(let r of Array.from(e.childNodes))if(r.nodeType===Node.TEXT_NODE)n.appendChild(r.cloneNode());else if(r.nodeType===Node.ELEMENT_NODE){let e=await jA(r,t);e&&n.appendChild(e)}return n}async function MA(e,t){let n=e.getBoundingClientRect(),r=Math.max(1,Math.ceil(n.width)),i=Math.max(1,Math.ceil(n.height)),a=await jA(e,new wA);if(!a)throw Error(`Capture root was filtered`);a.style.margin=`0`;let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${i}"><style>${t}</style><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(a)}</div></foreignObject></svg>`,s=URL.createObjectURL(new Blob([o],{type:`image/svg+xml;charset=utf-8`})),c=new Image;c.decoding=`async`,c.src=s;try{await c.decode()}finally{URL.revokeObjectURL(s)}let l=8192,u=Math.min(window.devicePixelRatio||1,1.5,l/r,l/i),d=document.createElement(`canvas`);d.width=Math.max(1,Math.round(r*u)),d.height=Math.max(1,Math.round(i*u));let f=d.getContext(`2d`);if(!f)throw Error(`Canvas 2d unavailable`);return f.drawImage(c,0,0,d.width,d.height),d}var NA=null;function PA(e){return NA??=SA(e).catch(()=>``),NA}function FA(){`requestIdleCallback`in window?requestIdleCallback(()=>{OA(),PA(document.body)},{timeout:3e3}):setTimeout(()=>{OA(),PA(document.body)},1500)}var IA=4e3,LA=1e3;async function RA(e){try{if(await new Promise(e=>{requestAnimationFrame(()=>`requestIdleCallback`in window?requestIdleCallback(()=>e(void 0),{timeout:500}):setTimeout(e,80))}),!e.isConnected)return null;let t=VA(e),n=t.querySelectorAll(`*`).length;n>IA&&(t=e);let r;try{r=await MA(t,await PA(t))}catch{t!==e&&n>LA&&(t=e),r=await xA(t,{pixelRatio:Math.min(window.devicePixelRatio||1,1.5),fontEmbedCSS:await PA(t),filter:e=>{if(!(e instanceof Element))return!0;if(e.id===`linear-grab-root`)return!1;let t=e.tagName?.toLowerCase()??``;return!(t===`overlay-canvas`||t.startsWith(`react-grab`))}})}return t!==e&&HA(r,t,e),await BA(r)}catch{return null}}async function zA(e){try{let t=e.x+e.w/2,n=e.y+e.h/2,r=document.elementFromPoint(t,n)??document.body,i=t=>{let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.w&&n.bottom>=e.y+e.h};for(;r!==document.body&&(!i(r)||r.querySelectorAll(`*`).length<1);)r=r.parentElement??document.body;let a=await MA(r,await PA(r)),o=r.getBoundingClientRect(),s=a.width/o.width,c=a.height/o.height,l=document.createElement(`canvas`);l.width=Math.max(1,Math.round(e.w*s)),l.height=Math.max(1,Math.round(e.h*c));let u=l.getContext(`2d`);return u?(u.drawImage(a,(e.x-o.left+r.scrollLeft)*s,(e.y-o.top+r.scrollTop)*c,e.w*s,e.h*c,0,0,l.width,l.height),await BA(l)):null}catch{return null}}async function BA(e){try{if(typeof createImageBitmap==`function`&&typeof OffscreenCanvas<`u`){let t=await createImageBitmap(e);return(await jD({type:`encode-png`,bitmap:t},[t])).dataUrl}}catch{}return UA(e)}function VA(e){let t=window.innerWidth,n=window.innerHeight,r=t*n*1.7,i=e,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){let o=a.getBoundingClientRect();if(o.width*o.height>r||a!==e&&(a.scrollTop>0||a.scrollLeft>0)||(i=a,o.width>=t*.55&&o.height>=n*.35))break;a=a.parentElement}return i}function HA(e,t,n){let r=e.getContext(`2d`);if(!r)return;let i=t.getBoundingClientRect(),a=n.getBoundingClientRect();if(!i.width||!i.height)return;let o=e.width/i.width,s=e.height/i.height,c=(a.left-i.left+t.scrollLeft)*o,l=(a.top-i.top+t.scrollTop)*s,u=a.width*o,d=a.height*s,f=Math.min(6*o,u/2,d/2);r.strokeStyle=`rgba(94, 106, 210, 0.35)`,r.lineWidth=8*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke(),r.strokeStyle=`#5e6ad2`,r.lineWidth=3*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke()}function UA(e){let t=e.toDataURL(`image/png`);return t.length<=25e5?t:e.toDataURL(`image/jpeg`,.85)}function WA(e){let[t,n]=e.split(`,`),r=t.match(/data:([^;]+)/)?.[1]??`image/png`,i=atob(n),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return new Blob([a],{type:r})}var[GA,KA]=T(null),[qA,JA]=T(null);function YA(e,t){KA(e),JA(t??null)}function XA(){KA(null),JA(null)}var[ZA,QA]=T(`capture`);function $A(e){QA(e)}var ej=N(`<span class="absolute inset-0 grid place-items-center">`),tj=N(`<button><span>`),nj=N(`<span role=status aria-label=Loading class="text-text-dim relative inline-block shrink-0">`),rj=N(`<span class="absolute top-0 left-1/2 rounded-full bg-current"style="animation:geist-spinner-fade 1.2s linear infinite;will-change:opacity">`),ij=N(`<input>`),aj=N(`<textarea>`),oj=N(`<select>`),sj=N(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><path d="M4.5 12.5a3 3 0 0 1-.4-5.97 4 4 0 0 1 7.8-.9A3.2 3.2 0 0 1 11.5 12.5h-7Z">`),cj=N(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><rect x=1.5 y=2.5 width=13 height=9 rx=1.5></rect><path d="M5.5 14h5M8 11.5V14">`),lj=N(`<a target=_blank rel="noopener noreferrer"><span class="min-w-0 truncate"></span><svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><path d="M4.5 11.5 11.5 4.5M5.5 4.5h6v6">`),uj=N(`<span class="text-text-faint text-[10.5px] leading-snug">`),dj=N(`<label class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">`),fj=N(`<section class="flex flex-col gap-2.5"><h2 class="text-text-dim text-[11px] font-semibold tracking-wide uppercase">`),pj=N(`<span>`),mj=N(`<span aria-hidden class="inline-block size-2 shrink-0 rounded-full">`),hj=N(`<div class="flex flex-col items-center gap-1.5 px-4 py-10 text-center"><p class="text-text-dim text-[12px] font-medium"></p><div class="text-text-faint text-[11.5px] leading-relaxed">`),gj=N(`<p class="bg-danger-soft text-danger rounded-md px-2.5 py-1.5 text-[11.5px] leading-snug break-words">`),_j={primary:`bg-accent hover:bg-accent-hover text-white border-transparent disabled:bg-surface-3 disabled:text-text-faint`,ghost:`bg-surface-2 hover:bg-surface-3 text-text border-border disabled:text-text-faint disabled:hover:bg-surface-2`,danger:`bg-danger-soft hover:bg-danger/30 text-danger border-transparent`};function vj(e){let[t,n]=He(e,[`variant`,`loading`,`children`,`class`,`disabled`,`title`]);return(()=>{var e=tj(),r=e.firstChild;return ft(e,Ve(n,{get"data-tip"(){return t.title||void 0},get"aria-label"(){return n[`aria-label`]??t.title},get disabled(){return t.disabled||t.loading},get class(){return`relative inline-flex h-7 cursor-pointer items-center justify-center gap-1.5 rounded-md border px-3 text-[12px] font-medium transition-colors disabled:cursor-not-allowed ${_j[t.variant??`ghost`]} ${t.class??``}`}}),!1,!0),P(r,()=>t.children),P(e,j(M,{get when(){return t.loading},get children(){var e=ej();return P(e,j(yj,{})),e}}),null),D(()=>st(r,`inline-flex items-center gap-1.5 ${t.loading?`invisible`:``}`)),e})()}function yj(e){let t=()=>e.size??14,n=()=>Math.max(1,Math.round(t()*.09)),r=()=>Math.round(t()*.26);return(()=>{var e=nj();return P(e,j(We,{get each(){return Array.from({length:12},(e,t)=>t)},children:e=>(()=>{var i=rj();return dt(i,`transform`,`rotate(${e*30}deg)`),dt(i,`animation-delay`,`${(e-12)*.1}s`),D(e=>{var a=`${n()}px`,o=`${r()}px`,s=`-${n()/2}px`,c=`center ${t()/2}px`;return a!==e.e&&dt(i,`width`,e.e=a),o!==e.t&&dt(i,`height`,e.t=o),s!==e.a&&dt(i,`margin-left`,e.a=s),c!==e.o&&dt(i,`transform-origin`,e.o=c),e},{e:void 0,t:void 0,a:void 0,o:void 0}),i})()})),D(n=>{var r=`${t()}px`,i=`${t()}px`;return r!==n.e&&dt(e,`width`,n.e=r),i!==n.t&&dt(e,`height`,n.t=i),n},{e:void 0,t:void 0}),e})()}function bj(e){let[t,n]=He(e,[`class`]);return(()=>{var e=ij();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint h-7 w-full rounded-md border px-2 text-[12px] outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function xj(e){let[t,n]=He(e,[`class`]);return(()=>{var e=aj();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint w-full resize-y rounded-md border px-2 py-1.5 text-[12px] leading-relaxed outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function Sj(e){let[t,n]=He(e,[`class`,`children`]);return(()=>{var e=oj();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent h-7 w-full cursor-pointer rounded-md border px-1.5 text-[12px] outline-none ${t.class??``}`}}),!1,!0),P(e,()=>t.children),e})()}function Cj(e){let t=e.size??11;return(()=>{var e=sj();return it(e,`width`,t),it(e,`height`,t),e})()}function wj(e){let t=e.size??11;return(()=>{var e=cj();return it(e,`width`,t),it(e,`height`,t),e})()}function Tj(e){return(()=>{var t=lj(),n=t.firstChild;return P(n,()=>e.children),D(n=>{var r=e.href,i=e.title||void 0,a=`text-accent inline-flex min-w-0 items-center gap-1 text-[11px] underline-offset-2 hover:underline ${e.class??``}`;return r!==n.e&&it(t,`href`,n.e=r),i!==n.t&&it(t,`data-tip`,n.t=i),a!==n.a&&st(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()}function Ej(e){return(()=>{var t=dj(),n=t.firstChild;return P(n,()=>e.label),P(t,()=>e.children,null),P(t,j(M,{get when(){return e.hint},get children(){var t=uj();return P(t,()=>e.hint),t}}),null),t})()}function Dj(e){return(()=>{var t=fj(),n=t.firstChild;return P(n,()=>e.title),P(t,()=>e.children,null),t})()}function Oj(e){return(()=>{var t=pj();return P(t,()=>e.children),D(n=>{var r=`bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class??``}`,i=e.color?{color:e.color}:void 0;return r!==n.e&&st(t,n.e=r),n.t=ut(t,i,n.t),n},{e:void 0,t:void 0}),t})()}function kj(e){return(()=>{var t=mj();return D(n=>dt(t,`background`,e.color)),t})()}function Aj(e){return(()=>{var t=hj(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.title),P(r,()=>e.children),t})()}function jj(e){return(()=>{var t=gj();return P(t,()=>e.message),t})()}var Mj={0:`No priority`,1:`Urgent`,2:`High`,3:`Medium`,4:`Low`};function Nj(e){let t=typeof e==`number`?e:Date.parse(e),n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}Rr(),Nx(),mD();var Pj=N(`<span class="truncate font-mono">`),Fj=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="M5.5 3.5 6.6 2h2.8l1.1 1.5H13A1.5 1.5 0 0 1 14.5 5v7A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V5A1.5 1.5 0 0 1 3 3.5h2.5Z"></path><circle cx=8 cy=8.2 r=2.4>`),Ij=N(`<div class="flex flex-wrap gap-1.5"><span class="text-text-faint self-end text-[10.5px]">attached on create`),Lj=N(`<div class="flex items-center justify-between gap-1.5"><span class="text-text-faint text-[11px]">Model:</span><div class="flex rounded-md border border-border overflow-hidden">`),Rj=N(`<span class="inline-block min-w-[12ch] text-center">`),zj=N(`<div class="flex justify-end">`),Bj=N(`<div class="flex flex-col gap-1.5">`),Vj=N(`<p class="text-text-faint text-[11px] leading-snug">Primary provider failed — drafted with <span class=text-text-dim></span> (<!>).`),Hj=N(`<div class="border-warn/40 bg-surface rounded-md border px-2.5 py-2"><p class="text-warn mb-1 text-[10.5px] font-semibold tracking-wide uppercase">Possibly related — check before creating`),Uj=N(`<div class="flex flex-col gap-1">`),Wj=N(`<option value>Select a team…`),Gj=N(`<option value=cursor> — cloud agent`),Kj=N(`<option value=local>Local Claude Code (bridge)`),qj=N(`<option value=none>No one — just create the issue`),Jj=N(`<option value>Claude Code default`),Yj=N(`<option value=fable>Fable 5`),Xj=N(`<option value=opus>Opus`),Zj=N(`<option value=sonnet>Sonnet`),Qj=N(`<option value=haiku>Haiku`),$j=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]">Isolated worktree <span class=text-text-dim>— own branch, run agents in parallel safely`),eM=N(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach console errors <span class="text-text-dim tabular-nums">(<!> captured)`),tM=N(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach dev server logs <span class="text-text-dim tabular-nums">(last <!> lines)`),nM=N(`<p class="text-warn text-[11px] leading-snug">`),rM=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4"><div class="bg-surface border-border flex items-center gap-2 rounded-lg border px-2.5 py-2"><div class="flex min-w-0 flex-1 flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Attached context</span><div class="flex min-w-0 flex-wrap items-center gap-1.5"></div></div></div><div class="bg-bg border-border sticky bottom-0 z-10 -mb-4 flex flex-col gap-2 border-t pt-2.5 pb-3">`),iM=N(`<div class="border-border relative overflow-hidden rounded-md border"><img alt="Pasted attachment"class="block h-16 w-16 object-cover"><button class="bg-bg/80 text-text-dim hover:text-danger absolute top-0.5 right-0.5 grid size-4 cursor-pointer place-items-center rounded text-[10px] leading-none"title=Remove aria-label="Remove pasted image">×`),aM=N(`<button>`),oM=N(`<div class="flex min-w-0 items-center gap-1.5 py-0.5"><span class="font-mono text-text-dim shrink-0 text-[10.5px]"></span><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),sM=N(`<div class="flex items-center gap-1"><span class="text-text-faint text-[11px] tabular-nums w-4 shrink-0 text-right">.</span><button class="text-text-faint hover:text-danger shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors cursor-pointer text-[12px] leading-none"aria-label="Remove step">×`),cM=N(`<option>`),lM=N(`<option>Loading teams…`),uM=N(`<div class="bg-surface border-border rounded-lg border p-2.5 flex items-center justify-between gap-2"><a target=_blank rel="noopener noreferrer"class="text-accent font-mono text-[12px] hover:underline">`);function dM(e){sr();let t=_r(()=>({queryKey:[`grab`],queryFn:Tr})),n=_r(()=>({queryKey:[`settings`],queryFn:Cr})),r=k(()=>n.data??{}),i=k(()=>t.data?.[0]??null),a=k(()=>!!(r().linearApiKey||r().linearAccessToken)),o=k(()=>Ox(r())),[s,c]=T(``),[l,u]=T(``),[d,f]=T([]),[p,m]=T(``),[h,g]=T(``),[_,v]=T(``),[y,b]=T(``),[x,S]=T(``),[C,w]=T(0),[E,ee]=T(r().defaultTeamId??``),[te,A]=T(r().defaultRepo??``),[ne,re]=T(`none`),[ie,oe]=T(``),[se,ce]=T(``),[le,ue]=T(!1),[de,fe]=T(!0),[pe,me]=T(ek().length);O(()=>{let e=setInterval(()=>me(ek().length),3e3);ae(()=>clearInterval(e))});let[he,ge]=T(``);O(()=>{let e=s().trim(),t=setTimeout(()=>ge(e.length>=8?e:``),600);ae(()=>clearTimeout(t))});let _e=_r(()=>({queryKey:[`dup-search`,he()],queryFn:()=>pO(he()),enabled:!!he()&&a(),staleTime:3e4})),[ve,ye]=T(``),[be,xe]=T([]),Se=e=>{for(let t of Array.from(e.clipboardData?.items??[])){if(!t.type.startsWith(`image/`))continue;let e=t.getAsFile();if(!e||e.size>8e6)continue;let n=new FileReader;n.onload=()=>xe(e=>[...e,{id:Date.now()+Math.random(),dataUrl:n.result}].slice(-6)),n.readAsDataURL(e)}},[Ce,we]=T(`fast`),[Te,Ee]=T(!0),De=!1;O(()=>{let e=n.data;De||!e||(De=!0,ee(e.defaultTeamId??``),A(e.defaultRepo??``),re(e.cursorAgentId?`cursor`:`none`))});let Oe=_r(()=>({queryKey:[`teams`],queryFn:cO,enabled:a()})),ke=k(()=>(Oe.data??[]).find(e=>e.id===E())?.name),[Ae,je]=T(!1),[Me,Ne]=T(null),[Pe,Fe]=T(null),Ie=null,Le=()=>{Ie?.(),Ie=null};ae(Le);let Re=e=>{e.title!==void 0&&c(e.title),e.description!==void 0&&u(e.description),e.reproSteps!==void 0&&f(e.reproSteps),e.expected!==void 0&&m(e.expected),e.actual!==void 0&&g(e.actual),e.impact!==void 0&&v(e.impact),e.analysisNotes!==void 0&&b(e.analysisNotes),e.suggestedNextSteps!==void 0&&S(e.suggestedNextSteps),e.priority!==void 0&&w(e.priority)},ze=async()=>{if(!o())return;je(!0),Ne(null),Fe(null),Le();let e=r().logUrl&&Te()?await qO({logUrl:r().logUrl,logLines:40}).catch(()=>void 0):void 0,n=de()?tk(15):null,a=[e?`--- dev server ---\n${e}`:null,n?`--- browser console ---\n${n}`:null].filter(Boolean).join(`
|
|
180
|
+
`)}async function yA(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await vA(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function bA(e,t={}){let{width:n,height:r}=uk(e,t),i=await qk(e,t,!0);return await yA(i,t),await sA(i,t),cA(i,t),await gk(i,n,r)}async function xA(e,t={}){let{width:n,height:r}=uk(e,t),i=await mk(await bA(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||dk(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||pk(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function SA(e,t={}){return vA(e,t)}var CA=6,wA=class{last=performance.now();async tick(){performance.now()-this.last<=CA||(await new Promise(e=>{`requestIdleCallback`in window?requestIdleCallback(()=>e(),{timeout:100}):setTimeout(e,0)}),this.last=performance.now())}},TA=null,EA=new Map;function DA(e){let t=EA.get(e);if(t)return t;if(!TA){let e=document.createElement(`iframe`);if(e.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden`,document.body.appendChild(e),TA=e.contentDocument,!TA)return{}}let n=TA.createElement(e);TA.body.appendChild(n);let r=TA.defaultView.getComputedStyle(n),i={};for(let e=0;e<r.length;e++){let t=r[e];i[t]=r.getPropertyValue(t)}return n.remove(),EA.set(e,i),i}function OA(){try{for(let e of[`div`,`span`,`p`,`a`,`button`,`img`,`ul`,`li`,`svg`])DA(e)}catch{}}function kA(e){if(e.id===`linear-grab-root`)return!0;let t=e.tagName?.toLowerCase()??``;return t===`overlay-canvas`||t.startsWith(`react-grab`)||t===`script`||t===`iframe`}function AA(e,t){try{let n=document.createElement(`canvas`);n.width=e.naturalWidth||e.width||1,n.height=e.naturalHeight||e.height||1,n.getContext(`2d`).drawImage(e,0,0),t.src=n.toDataURL(`image/png`)}catch{t.removeAttribute(`src`),t.setAttribute(`style`,`${t.getAttribute(`style`)??``}background:#8b8e9822;`)}}async function jA(e,t){if(kA(e))return null;if(e instanceof SVGSVGElement)return e.cloneNode(!0);let n=e.cloneNode(!1),r=getComputedStyle(e),i=DA(e.tagName.toLowerCase()),a=``;for(let e=0;e<r.length;e++){let t=r[e],n=r.getPropertyValue(t);n&&n!==i[t]&&(a+=`${t}:${n};`)}if(n.setAttribute(`style`,a),n.removeAttribute(`class`),e instanceof HTMLImageElement&&AA(e,n),e instanceof HTMLCanvasElement)try{let t=document.createElement(`img`);return t.setAttribute(`style`,a),t.src=e.toDataURL(),t}catch{}e instanceof HTMLInputElement&&n.setAttribute(`value`,e.value),e instanceof HTMLTextAreaElement&&(n.textContent=e.value),await t.tick();for(let r of Array.from(e.childNodes))if(r.nodeType===Node.TEXT_NODE)n.appendChild(r.cloneNode());else if(r.nodeType===Node.ELEMENT_NODE){let e=await jA(r,t);e&&n.appendChild(e)}return n}async function MA(e,t){let n=e.getBoundingClientRect(),r=Math.max(1,Math.ceil(n.width)),i=Math.max(1,Math.ceil(n.height)),a=await jA(e,new wA);if(!a)throw Error(`Capture root was filtered`);a.style.margin=`0`;let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${i}"><style>${t}</style><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(a)}</div></foreignObject></svg>`,s=URL.createObjectURL(new Blob([o],{type:`image/svg+xml;charset=utf-8`})),c=new Image;c.decoding=`async`,c.src=s;try{await c.decode()}finally{URL.revokeObjectURL(s)}let l=8192,u=Math.min(window.devicePixelRatio||1,1.5,l/r,l/i),d=document.createElement(`canvas`);d.width=Math.max(1,Math.round(r*u)),d.height=Math.max(1,Math.round(i*u));let f=d.getContext(`2d`);if(!f)throw Error(`Canvas 2d unavailable`);return f.drawImage(c,0,0,d.width,d.height),d}var NA=null;function PA(e){return NA??=SA(e).catch(()=>``),NA}function FA(){`requestIdleCallback`in window?requestIdleCallback(()=>{OA(),PA(document.body)},{timeout:3e3}):setTimeout(()=>{OA(),PA(document.body)},1500)}var IA=4e3,LA=1e3;async function RA(e){try{if(await new Promise(e=>{requestAnimationFrame(()=>`requestIdleCallback`in window?requestIdleCallback(()=>e(void 0),{timeout:500}):setTimeout(e,80))}),!e.isConnected)return null;let t=VA(e),n=t.querySelectorAll(`*`).length;n>IA&&(t=e);let r;try{r=await MA(t,await PA(t))}catch{t!==e&&n>LA&&(t=e),r=await xA(t,{pixelRatio:Math.min(window.devicePixelRatio||1,1.5),fontEmbedCSS:await PA(t),filter:e=>{if(!(e instanceof Element))return!0;if(e.id===`linear-grab-root`)return!1;let t=e.tagName?.toLowerCase()??``;return!(t===`overlay-canvas`||t.startsWith(`react-grab`))}})}return t!==e&&HA(r,t,e),await BA(r)}catch{return null}}async function zA(e){try{let t=e.x+e.w/2,n=e.y+e.h/2,r=document.elementFromPoint(t,n)??document.body,i=t=>{let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.w&&n.bottom>=e.y+e.h};for(;r!==document.body&&(!i(r)||r.querySelectorAll(`*`).length<1);)r=r.parentElement??document.body;let a=await MA(r,await PA(r)),o=r.getBoundingClientRect(),s=a.width/o.width,c=a.height/o.height,l=document.createElement(`canvas`);l.width=Math.max(1,Math.round(e.w*s)),l.height=Math.max(1,Math.round(e.h*c));let u=l.getContext(`2d`);return u?(u.drawImage(a,(e.x-o.left+r.scrollLeft)*s,(e.y-o.top+r.scrollTop)*c,e.w*s,e.h*c,0,0,l.width,l.height),await BA(l)):null}catch{return null}}async function BA(e){try{if(typeof createImageBitmap==`function`&&typeof OffscreenCanvas<`u`){let t=await createImageBitmap(e);return(await jD({type:`encode-png`,bitmap:t},[t])).dataUrl}}catch{}return UA(e)}function VA(e){let t=window.innerWidth,n=window.innerHeight,r=t*n*1.7,i=e,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){let o=a.getBoundingClientRect();if(o.width*o.height>r||a!==e&&(a.scrollTop>0||a.scrollLeft>0)||(i=a,o.width>=t*.55&&o.height>=n*.35))break;a=a.parentElement}return i}function HA(e,t,n){let r=e.getContext(`2d`);if(!r)return;let i=t.getBoundingClientRect(),a=n.getBoundingClientRect();if(!i.width||!i.height)return;let o=e.width/i.width,s=e.height/i.height,c=(a.left-i.left+t.scrollLeft)*o,l=(a.top-i.top+t.scrollTop)*s,u=a.width*o,d=a.height*s,f=Math.min(6*o,u/2,d/2);r.strokeStyle=`rgba(94, 106, 210, 0.35)`,r.lineWidth=8*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke(),r.strokeStyle=`#5e6ad2`,r.lineWidth=3*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke()}function UA(e){let t=e.toDataURL(`image/png`);return t.length<=25e5?t:e.toDataURL(`image/jpeg`,.85)}function WA(e){let[t,n]=e.split(`,`),r=t.match(/data:([^;]+)/)?.[1]??`image/png`,i=atob(n),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return new Blob([a],{type:r})}var[GA,KA]=T(null),[qA,JA]=T(null);function YA(e,t){KA(e),JA(t??null)}function XA(){KA(null),JA(null)}var[ZA,QA]=T(`capture`);function $A(e){QA(e)}var ej=N(`<span class="absolute inset-0 grid place-items-center">`),tj=N(`<button><span>`),nj=N(`<span role=status aria-label=Loading class="text-text-dim relative inline-block shrink-0">`),rj=N(`<span class="absolute top-0 left-1/2 rounded-full bg-current"style="animation:geist-spinner-fade 1.2s linear infinite;will-change:opacity">`),ij=N(`<input>`),aj=N(`<textarea>`),oj=N(`<select>`),sj=N(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><path d="M4.5 12.5a3 3 0 0 1-.4-5.97 4 4 0 0 1 7.8-.9A3.2 3.2 0 0 1 11.5 12.5h-7Z">`),cj=N(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><rect x=1.5 y=2.5 width=13 height=9 rx=1.5></rect><path d="M5.5 14h5M8 11.5V14">`),lj=N(`<a target=_blank rel="noopener noreferrer"><span class="min-w-0 truncate"></span><svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><path d="M4.5 11.5 11.5 4.5M5.5 4.5h6v6">`),uj=N(`<span class="text-text-faint text-[10.5px] leading-snug">`),dj=N(`<label class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">`),fj=N(`<section class="flex flex-col gap-2.5"><h2 class="text-text-dim text-[11px] font-semibold tracking-wide uppercase">`),pj=N(`<span>`),mj=N(`<span aria-hidden class="inline-block size-2 shrink-0 rounded-full">`),hj=N(`<div class="flex flex-col items-center gap-1.5 px-4 py-10 text-center"><p class="text-text-dim text-[12px] font-medium"></p><div class="text-text-faint text-[11.5px] leading-relaxed">`),gj=N(`<p class="bg-danger-soft text-danger rounded-md px-2.5 py-1.5 text-[11.5px] leading-snug break-words">`),_j={primary:`bg-accent hover:bg-accent-hover text-white border-transparent disabled:bg-surface-3 disabled:text-text-faint`,ghost:`bg-surface-2 hover:bg-surface-3 text-text border-border disabled:text-text-faint disabled:hover:bg-surface-2`,danger:`bg-danger-soft hover:bg-danger/30 text-danger border-transparent`};function vj(e){let[t,n]=He(e,[`variant`,`loading`,`children`,`class`,`disabled`,`title`]);return(()=>{var e=tj(),r=e.firstChild;return ft(e,Ve(n,{get"data-tip"(){return t.title||void 0},get"aria-label"(){return n[`aria-label`]??t.title},get disabled(){return t.disabled||t.loading},get class(){return`relative inline-flex h-7 cursor-pointer items-center justify-center gap-1.5 rounded-md border px-3 text-[12px] font-medium transition-colors disabled:cursor-not-allowed ${_j[t.variant??`ghost`]} ${t.class??``}`}}),!1,!0),P(r,()=>t.children),P(e,j(M,{get when(){return t.loading},get children(){var e=ej();return P(e,j(yj,{})),e}}),null),D(()=>st(r,`inline-flex items-center gap-1.5 ${t.loading?`invisible`:``}`)),e})()}function yj(e){let t=()=>e.size??14,n=()=>Math.max(1,Math.round(t()*.09)),r=()=>Math.round(t()*.26);return(()=>{var e=nj();return P(e,j(We,{get each(){return Array.from({length:12},(e,t)=>t)},children:e=>(()=>{var i=rj();return dt(i,`transform`,`rotate(${e*30}deg)`),dt(i,`animation-delay`,`${(e-12)*.1}s`),D(e=>{var a=`${n()}px`,o=`${r()}px`,s=`-${n()/2}px`,c=`center ${t()/2}px`;return a!==e.e&&dt(i,`width`,e.e=a),o!==e.t&&dt(i,`height`,e.t=o),s!==e.a&&dt(i,`margin-left`,e.a=s),c!==e.o&&dt(i,`transform-origin`,e.o=c),e},{e:void 0,t:void 0,a:void 0,o:void 0}),i})()})),D(n=>{var r=`${t()}px`,i=`${t()}px`;return r!==n.e&&dt(e,`width`,n.e=r),i!==n.t&&dt(e,`height`,n.t=i),n},{e:void 0,t:void 0}),e})()}function bj(e){let[t,n]=He(e,[`class`]);return(()=>{var e=ij();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint h-7 w-full rounded-md border px-2 text-[12px] outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function xj(e){let[t,n]=He(e,[`class`]);return(()=>{var e=aj();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint w-full resize-y rounded-md border px-2 py-1.5 text-[12px] leading-relaxed outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function Sj(e){let[t,n]=He(e,[`class`,`children`]);return(()=>{var e=oj();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent h-7 w-full cursor-pointer rounded-md border px-1.5 text-[12px] outline-none ${t.class??``}`}}),!1,!0),P(e,()=>t.children),e})()}function Cj(e){let t=e.size??11;return(()=>{var e=sj();return it(e,`width`,t),it(e,`height`,t),e})()}function wj(e){let t=e.size??11;return(()=>{var e=cj();return it(e,`width`,t),it(e,`height`,t),e})()}function Tj(e){return(()=>{var t=lj(),n=t.firstChild;return P(n,()=>e.children),D(n=>{var r=e.href,i=e.title||void 0,a=`text-accent inline-flex min-w-0 items-center gap-1 text-[11px] underline-offset-2 hover:underline ${e.class??``}`;return r!==n.e&&it(t,`href`,n.e=r),i!==n.t&&it(t,`data-tip`,n.t=i),a!==n.a&&st(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()}function Ej(e){return(()=>{var t=dj(),n=t.firstChild;return P(n,()=>e.label),P(t,()=>e.children,null),P(t,j(M,{get when(){return e.hint},get children(){var t=uj();return P(t,()=>e.hint),t}}),null),t})()}function Dj(e){return(()=>{var t=fj(),n=t.firstChild;return P(n,()=>e.title),P(t,()=>e.children,null),t})()}function Oj(e){return(()=>{var t=pj();return P(t,()=>e.children),D(n=>{var r=`bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class??``}`,i=e.color?{color:e.color}:void 0,a=e.title||void 0;return r!==n.e&&st(t,n.e=r),n.t=ut(t,i,n.t),a!==n.a&&it(t,`data-tip`,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()}function kj(e){return(()=>{var t=mj();return D(n=>dt(t,`background`,e.color)),t})()}function Aj(e){return(()=>{var t=hj(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.title),P(r,()=>e.children),t})()}function jj(e){return(()=>{var t=gj();return P(t,()=>e.message),t})()}var Mj={0:`No priority`,1:`Urgent`,2:`High`,3:`Medium`,4:`Low`};function Nj(e){let t=typeof e==`number`?e:Date.parse(e),n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}Rr(),Nx(),mD();var Pj=N(`<span class="truncate font-mono">`),Fj=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="M5.5 3.5 6.6 2h2.8l1.1 1.5H13A1.5 1.5 0 0 1 14.5 5v7A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V5A1.5 1.5 0 0 1 3 3.5h2.5Z"></path><circle cx=8 cy=8.2 r=2.4>`),Ij=N(`<div class="flex flex-wrap gap-1.5"><span class="text-text-faint self-end text-[10.5px]">attached on create`),Lj=N(`<div class="flex items-center justify-between gap-1.5"><span class="text-text-faint text-[11px]">Model:</span><div class="flex rounded-md border border-border overflow-hidden">`),Rj=N(`<span class="inline-block min-w-[12ch] text-center">`),zj=N(`<div class="flex justify-end">`),Bj=N(`<div class="flex flex-col gap-1.5">`),Vj=N(`<p class="text-text-faint text-[11px] leading-snug">Primary provider failed — drafted with <span class=text-text-dim></span> (<!>).`),Hj=N(`<div class="border-warn/40 bg-surface rounded-md border px-2.5 py-2"><p class="text-warn mb-1 text-[10.5px] font-semibold tracking-wide uppercase">Possibly related — check before creating`),Uj=N(`<div class="flex flex-col gap-1">`),Wj=N(`<option value>Select a team…`),Gj=N(`<option value=cursor> — cloud agent`),Kj=N(`<option value=local>Local Claude Code (bridge)`),qj=N(`<option value=none>No one — just create the issue`),Jj=N(`<option value>Claude Code default`),Yj=N(`<option value=fable>Fable 5`),Xj=N(`<option value=opus>Opus`),Zj=N(`<option value=sonnet>Sonnet`),Qj=N(`<option value=haiku>Haiku`),$j=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]">Isolated worktree <span class=text-text-dim>— own branch, run agents in parallel safely`),eM=N(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach console errors <span class="text-text-dim tabular-nums">(<!> captured)`),tM=N(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach dev server logs <span class="text-text-dim tabular-nums">(last <!> lines)`),nM=N(`<p class="text-warn text-[11px] leading-snug">`),rM=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4"><div class="bg-surface border-border flex items-center gap-2 rounded-lg border px-2.5 py-2"><div class="flex min-w-0 flex-1 flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Attached context</span><div class="flex min-w-0 flex-wrap items-center gap-1.5"></div></div></div><div class="bg-bg border-border sticky bottom-0 z-10 -mb-4 flex flex-col gap-2 border-t pt-2.5 pb-3">`),iM=N(`<div class="border-border relative overflow-hidden rounded-md border"><img alt="Pasted attachment"class="block h-16 w-16 object-cover"><button class="bg-bg/80 text-text-dim hover:text-danger absolute top-0.5 right-0.5 grid size-4 cursor-pointer place-items-center rounded text-[10px] leading-none"title=Remove aria-label="Remove pasted image">×`),aM=N(`<button>`),oM=N(`<div class="flex min-w-0 items-center gap-1.5 py-0.5"><span class="font-mono text-text-dim shrink-0 text-[10.5px]"></span><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),sM=N(`<div class="flex items-center gap-1"><span class="text-text-faint text-[11px] tabular-nums w-4 shrink-0 text-right">.</span><button class="text-text-faint hover:text-danger shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors cursor-pointer text-[12px] leading-none"aria-label="Remove step">×`),cM=N(`<option>`),lM=N(`<option>Loading teams…`),uM=N(`<div class="bg-surface border-border rounded-lg border p-2.5 flex items-center justify-between gap-2"><a target=_blank rel="noopener noreferrer"class="text-accent font-mono text-[12px] hover:underline">`);function dM(e){sr();let t=_r(()=>({queryKey:[`grab`],queryFn:Tr})),n=_r(()=>({queryKey:[`settings`],queryFn:Cr})),r=k(()=>n.data??{}),i=k(()=>t.data?.[0]??null),a=k(()=>!!(r().linearApiKey||r().linearAccessToken)),o=k(()=>Ox(r())),[s,c]=T(``),[l,u]=T(``),[d,f]=T([]),[p,m]=T(``),[h,g]=T(``),[_,v]=T(``),[y,b]=T(``),[x,S]=T(``),[C,w]=T(0),[E,ee]=T(r().defaultTeamId??``),[te,A]=T(r().defaultRepo??``),[ne,re]=T(`none`),[ie,oe]=T(``),[se,ce]=T(``),[le,ue]=T(!1),[de,fe]=T(!0),[pe,me]=T(ek().length);O(()=>{let e=setInterval(()=>me(ek().length),3e3);ae(()=>clearInterval(e))});let[he,ge]=T(``);O(()=>{let e=s().trim(),t=setTimeout(()=>ge(e.length>=8?e:``),600);ae(()=>clearTimeout(t))});let _e=_r(()=>({queryKey:[`dup-search`,he()],queryFn:()=>pO(he()),enabled:!!he()&&a(),staleTime:3e4})),[ve,ye]=T(``),[be,xe]=T([]),Se=e=>{for(let t of Array.from(e.clipboardData?.items??[])){if(!t.type.startsWith(`image/`))continue;let e=t.getAsFile();if(!e||e.size>8e6)continue;let n=new FileReader;n.onload=()=>xe(e=>[...e,{id:Date.now()+Math.random(),dataUrl:n.result}].slice(-6)),n.readAsDataURL(e)}},[Ce,we]=T(`fast`),[Te,Ee]=T(!0),De=!1;O(()=>{let e=n.data;De||!e||(De=!0,ee(e.defaultTeamId??``),A(e.defaultRepo??``),re(e.cursorAgentId?`cursor`:`none`))});let Oe=_r(()=>({queryKey:[`teams`],queryFn:cO,enabled:a()})),ke=k(()=>(Oe.data??[]).find(e=>e.id===E())?.name),[Ae,je]=T(!1),[Me,Ne]=T(null),[Pe,Fe]=T(null),Ie=null,Le=()=>{Ie?.(),Ie=null};ae(Le);let Re=e=>{e.title!==void 0&&c(e.title),e.description!==void 0&&u(e.description),e.reproSteps!==void 0&&f(e.reproSteps),e.expected!==void 0&&m(e.expected),e.actual!==void 0&&g(e.actual),e.impact!==void 0&&v(e.impact),e.analysisNotes!==void 0&&b(e.analysisNotes),e.suggestedNextSteps!==void 0&&S(e.suggestedNextSteps),e.priority!==void 0&&w(e.priority)},ze=async()=>{if(!o())return;je(!0),Ne(null),Fe(null),Le();let e=r().logUrl&&Te()?await qO({logUrl:r().logUrl,logLines:40}).catch(()=>void 0):void 0,n=de()?tk(15):null,a=[e?`--- dev server ---\n${e}`:null,n?`--- browser console ---\n${n}`:null].filter(Boolean).join(`
|
|
181
181
|
|
|
182
182
|
`)||void 0;Ie=bD({note:be().length?`${ve()}\n\n(${be().length} pasted screenshot(s) will be attached to the issue.)`:ve(),grabbed:i()??null,grabbedList:t.data??void 0,teamName:ke(),tier:Ce(),template:sD(r()),logs:a},{onPartial:Re,onDone:e=>{Re(e.draft),e.fellBack&&Fe({provider:e.provider,modelId:e.modelId}),je(!1),Ie=null},onError:(e,t)=>{Ne(t===`no-provider`?`No AI provider configured — add an OpenAI or Anthropic key in Settings.`:e),je(!1),Ie=null}})},[Be,Ve]=T(BD());ae(VD(Ve));let He=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},[Ue,Ke]=T(null),[qe,Je]=T(null),[Ye,Xe]=T(null),Ze=vr(()=>({mutationFn:async()=>{let e=dD({description:l(),reproSteps:d(),expected:p(),actual:h(),impact:_(),analysisNotes:y(),suggestedNextSteps:x(),grabs:t.data??[],repo:te(),model:se().trim()||r().cursorModel,agentInstructions:sD(r())});Je(null);let n=[],i=BD();if(i.result&&i.attachOnCreate)try{let t=await He();e+=`\n\n### Recording\n`}catch{n.push(`recording`)}let a=(t.data??[]).filter(e=>e.screenshotDataUrl).slice(0,3);for(let[t,r]of a.entries())try{let n=await xO(WA(r.screenshotDataUrl),`element-${Date.now()}-${t}.png`),i=r.componentName?`<${r.componentName}>`:r.tagName??`element`;e+=`\n\n### Element location${a.length>1?` — ${i}`:``}\n`}catch{n.push(`screenshot${a.length>1?` ${t+1}`:``}`)}let o=be();for(let[t,r]of o.entries())try{let n=await xO(WA(r.dataUrl),`pasted-${Date.now()}-${t}.png`);e+=`${t===0?`
|
|
183
183
|
|
package/dist/linear-grab.js
CHANGED
|
@@ -3152,8 +3152,9 @@ async function Dr(e) {
|
|
|
3152
3152
|
};
|
|
3153
3153
|
continue;
|
|
3154
3154
|
}
|
|
3155
|
+
let r = (e) => `${e.source?.filePath ?? ""}:${e.source?.lineNumber ?? ""}|${e.tagName ?? ""}|${(e.content ?? "").trim().slice(0, 80)}`;
|
|
3155
3156
|
if (n.source?.filePath) {
|
|
3156
|
-
let e = t.findIndex((e) => e
|
|
3157
|
+
let e = t.findIndex((e) => r(e) === r(n));
|
|
3157
3158
|
if (e >= 0) {
|
|
3158
3159
|
t[e] = {
|
|
3159
3160
|
...t[e],
|
|
@@ -3166,7 +3167,7 @@ async function Dr(e) {
|
|
|
3166
3167
|
}
|
|
3167
3168
|
let n = /* @__PURE__ */ new Set(), r = [];
|
|
3168
3169
|
for (let e = t.length - 1; e >= 0; e--) {
|
|
3169
|
-
let i = t[e], a = i.source?.filePath ? `${i.source.filePath}:${i.source.lineNumber ?? ""}` : `id:${i.grabbedAt}`;
|
|
3170
|
+
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}`;
|
|
3170
3171
|
n.has(a) || (n.add(a), r.unshift(i));
|
|
3171
3172
|
}
|
|
3172
3173
|
await Er(r.slice(-8));
|
|
@@ -27658,11 +27659,12 @@ function Oj(e) {
|
|
|
27658
27659
|
return (() => {
|
|
27659
27660
|
var t = pj();
|
|
27660
27661
|
return P(t, () => e.children), D((n) => {
|
|
27661
|
-
var r = `bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class ?? ""}`, i = e.color ? { color: e.color } : void 0;
|
|
27662
|
-
return r !== n.e && st(t, n.e = r), n.t = ut(t, i, n.t), n;
|
|
27662
|
+
var r = `bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class ?? ""}`, i = e.color ? { color: e.color } : void 0, a = e.title || void 0;
|
|
27663
|
+
return r !== n.e && st(t, n.e = r), n.t = ut(t, i, n.t), a !== n.a && it(t, "data-tip", n.a = a), n;
|
|
27663
27664
|
}, {
|
|
27664
27665
|
e: void 0,
|
|
27665
|
-
t: void 0
|
|
27666
|
+
t: void 0,
|
|
27667
|
+
a: void 0
|
|
27666
27668
|
}), t;
|
|
27667
27669
|
})();
|
|
27668
27670
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linear-grab",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Point at any React element in your dev app, draft a Linear issue with AI, delegate it to the Cursor agent, and track it live — in any browser.",
|
|
6
6
|
"exports": {
|