linear-grab 0.15.2 → 0.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.global.js +17 -17
- package/dist/linear-grab.js +624 -567
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),r=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},i={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return a(this.context.count)},getNextContextId(){return a(this.context.count++)}};function a(e){let t=String(e),n=t.length-1;return i.context.id+(n?String.fromCharCode(96+n):``)+t}function o(e){i.context=e}var s=(e,t)=>e===t,c=Symbol(`solid-proxy`),l=typeof Proxy==`function`,u=Symbol(`solid-track`),d={equals:s},f=null,p=Se,m=1,h=2,g={owned:null,cleanups:null,context:null,owner:null},_={},v=null,y=null,b=null,x=null,S=null,C=0;function w(e,t){let n=b,r=v,i=e.length===0,a=t===void 0?r:t,o=i?g:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>ne(()=>Ee(o)));v=o,b=null;try{return be(s,!0)}finally{b=n,v=r}}function T(e,t){t=t?Object.assign({},d,t):d;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[me.bind(n),e=>(typeof e==`function`&&(e=y&&y.running&&y.sources.has(n)?e(n.tValue):e(n.value)),he(n,e))]}function ee(e,t,n){ge(ve(e,t,!0,m))}function E(e,t,n){ge(ve(e,t,!1,m))}function D(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 O(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 te(e){return e&&typeof e==`object`&&`then`in e}function k(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`&&O(r),m=new Set,[h,g]=(o.storage||T)(o.initialValue),[x,S]=T(void 0),[C,w]=T(void 0,{equals:!1}),[E,D]=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 k(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),D(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&&ee(()=>{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){k(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){k(s,void 0,Oe(n),t);return}else if(!te(i))return k(s,i,void 0,t),i;return s=i,`v`in i?(i.s===1?k(s,i.v,void 0,t):k(s,void 0,Oe(i.v),t),i):(d=!0,queueMicrotask(()=>d=!1),be(()=>{D(f?`refreshing`:`pending`),w()},!1),i.then(e=>k(i,e,void 0,t),e=>k(i,void 0,Oe(e),t)))}Object.defineProperties(re,{state:{get:()=>E()},error:{get:()=>x()},loading:{get(){let e=E();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?ee(()=>(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){D(()=>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=O(e),n=O(()=>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 E(()=>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,O(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 O(Fe(()=>e.each,e.children,t||void 0))}function Ge(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return O(Ie(()=>e.each,e.children,t||void 0))}function M(e){let t=e.keyed,n=O(()=>e.when,void 0,void 0),r=t?n:O(n,void 0,{equals:(e,t)=>!e==!t});return O(()=>{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=>O(()=>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||E(()=>i.children=bt(e,t.children,i.children)),E(()=>typeof t.ref==`function`&&pt(t.ref,e)),E(()=>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);E(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 E(()=>{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 E(()=>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=>(E(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=O(()=>sr(n?.())),i=ur(),a=O(()=>{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}]=k(()=>{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 ee(re(r,e=>{h&&h();let n=new t(e,a());h=f(),c(n)},{defer:!0})),ee(re(i,e=>{e||v()},{defer:!0})),ae(()=>{h&&=(h(),null),g&&=(g(l),null)}),ee(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(O(()=>e()),Cn,t)}function hr(e,t){let n=new Pn(O(()=>sr(t?.()))(),e()),r=(e,t)=>{n.mutate(e,t).catch(At)},[i,a]=tr({...n.getCurrentResult(),mutate:r,mutateAsync:n.getCurrentResult().mutate});return ee(()=>{n.setOptions(e())}),ee(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}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}.
|
|
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(`
|
|
@@ -50,8 +50,8 @@ ${e}
|
|
|
50
50
|
|
|
51
51
|
`;break}case`tool`:throw new pa({functionality:`tool messages`});default:throw Error(`Unsupported role: ${i}`)}return r+=`${n}:
|
|
52
52
|
`,{prompt:r,stopSequences:[`
|
|
53
|
-
${t}:`]}}function h_({id:e,model:t,created:n}){return{id:e??void 0,modelId:t??void 0,timestamp:n==null?void 0:new Date(n*1e3)}}function g_(e){switch(e){case`stop`:return`stop`;case`length`:return`length`;case`content_filter`:return`content-filter`;case`function_call`:case`tool_calls`:return`tool-calls`;default:return`other`}}function __(e){return!(`error`in e)&&e.choices.some(e=>e.text.length>0)}function v_(e){return Tv.some(t=>e.startsWith(t))}function y_(e,t,n){if(e==null)return{};let r={};if(e.image_tokens!=null){let i=Math.floor(e.image_tokens/n),a=e.image_tokens-i*(n-1);r.imageTokens=t===n-1?a:i}if(e.text_tokens!=null){let i=Math.floor(e.text_tokens/n),a=e.text_tokens-i*(n-1);r.textTokens=t===n-1?a:i}return r}async function b_(e){if(!e)return;if(e.type===`url`)return fm(e.url);let t=e.data instanceof Uint8Array?e.data:Wp(e.data);return new Blob([t],{type:e.mediaType})}function x_(e){let t=e,n=t.type;switch(n){case`session.created`:return{type:`session-created`,sessionId:t.session?.id,raw:e};case`session.updated`:return{type:`session-updated`,raw:e};case`input_audio_buffer.speech_started`:return{type:`speech-started`,itemId:t.item_id,raw:e};case`input_audio_buffer.speech_stopped`:return{type:`speech-stopped`,itemId:t.item_id,raw:e};case`input_audio_buffer.committed`:return{type:`audio-committed`,itemId:t.item_id,previousItemId:t.previous_item_id,raw:e};case`conversation.item.added`:return{type:`conversation-item-added`,itemId:t.item?.id??t.item_id,item:t.item,raw:e};case`conversation.item.input_audio_transcription.completed`:return{type:`input-transcription-completed`,itemId:t.item_id,transcript:t.transcript??``,raw:e};case`response.created`:return{type:`response-created`,responseId:t.response?.id??t.response_id,raw:e};case`response.done`:return{type:`response-done`,responseId:t.response?.id??t.response_id,status:t.response?.status??`completed`,raw:e};case`response.output_item.added`:return{type:`output-item-added`,responseId:t.response_id,itemId:t.item?.id??t.item_id,raw:e};case`response.output_item.done`:return{type:`output-item-done`,responseId:t.response_id,itemId:t.item?.id??t.item_id,raw:e};case`response.content_part.added`:return{type:`content-part-added`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.content_part.done`:return{type:`content-part-done`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.output_audio.delta`:return{type:`audio-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_audio.done`:return{type:`audio-done`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.output_audio_transcript.delta`:return{type:`audio-transcript-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_audio_transcript.done`:return{type:`audio-transcript-done`,responseId:t.response_id,itemId:t.item_id,transcript:t.transcript,raw:e};case`response.output_text.delta`:return{type:`text-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_text.done`:return{type:`text-done`,responseId:t.response_id,itemId:t.item_id,text:t.text,raw:e};case`response.function_call_arguments.delta`:return{type:`function-call-arguments-delta`,responseId:t.response_id,itemId:t.item_id,callId:t.call_id,delta:t.delta,raw:e};case`response.function_call_arguments.done`:return{type:`function-call-arguments-done`,responseId:t.response_id,itemId:t.item_id,callId:t.call_id,name:t.name,arguments:t.arguments,raw:e};case`error`:return{type:`error`,message:t.error?.message??t.message??`Unknown error`,code:t.error?.code??t.code,raw:e};default:return{type:`custom`,rawType:n,raw:e}}}function S_(e,t){switch(e.type){case`session-update`:return{type:`session.update`,session:C_(e.config,t)};case`input-audio-append`:return{type:`input_audio_buffer.append`,audio:e.audio};case`input-audio-commit`:return{type:`input_audio_buffer.commit`};case`input-audio-clear`:return{type:`input_audio_buffer.clear`};case`conversation-item-create`:{let t=e.item;switch(t.type){case`text-message`:return{type:`conversation.item.create`,item:{type:`message`,role:t.role,content:[{type:`input_text`,text:t.text}]}};case`audio-message`:return{type:`conversation.item.create`,item:{type:`message`,role:t.role,content:[{type:`input_audio`,audio:t.audio}]}};case`function-call-output`:return{type:`conversation.item.create`,item:{type:`function_call_output`,call_id:t.callId,output:t.output}}}break}case`conversation-item-truncate`:return{type:`conversation.item.truncate`,item_id:e.itemId,content_index:e.contentIndex,audio_end_ms:e.audioEndMs};case`response-create`:return{type:`response.create`,...e.options==null?{}:{response:{...e.options.modalities==null?{}:{output_modalities:e.options.modalities},...e.options.instructions==null?{}:{instructions:e.options.instructions},...e.options.metadata==null?{}:{metadata:e.options.metadata}}}};case`response-cancel`:return{type:`response.cancel`}}}function C_(e,t){let n={type:`realtime`,model:t};e.instructions!=null&&(n.instructions=e.instructions),e.outputModalities!=null&&(n.output_modalities=e.outputModalities);let r={};if(e.inputAudioFormat!=null||e.inputAudioTranscription!=null||e.turnDetection!=null){let t={};if(e.inputAudioFormat!=null&&(t.format={type:e.inputAudioFormat.type,...e.inputAudioFormat.rate==null?{}:{rate:e.inputAudioFormat.rate}}),e.turnDetection!=null)if(e.turnDetection.type===`disabled`)t.turn_detection=null;else{let n={type:e.turnDetection.type===`server-vad`?`server_vad`:`semantic_vad`};e.turnDetection.threshold!=null&&(n.threshold=e.turnDetection.threshold),e.turnDetection.silenceDurationMs!=null&&(n.silence_duration_ms=e.turnDetection.silenceDurationMs),e.turnDetection.prefixPaddingMs!=null&&(n.prefix_padding_ms=e.turnDetection.prefixPaddingMs),t.turn_detection=n}e.inputAudioTranscription!=null&&(t.transcription={model:e.inputAudioTranscription.model??`gpt-realtime-whisper`,...e.inputAudioTranscription.language==null?{}:{language:e.inputAudioTranscription.language},...e.inputAudioTranscription.prompt==null?{}:{prompt:e.inputAudioTranscription.prompt}}),r.input=t}if(e.outputAudioFormat!=null||e.voice!=null){let t={};e.outputAudioFormat!=null&&(t.format={type:e.outputAudioFormat.type,...e.outputAudioFormat.rate==null?{}:{rate:e.outputAudioFormat.rate}}),e.voice!=null&&(t.voice=e.voice),r.output=t}return Object.keys(r).length>0&&(n.audio=r),e.tools!=null&&e.tools.length>0&&(n.tools=e.tools.map(e=>({type:e.type,name:e.name,description:e.description,parameters:e.parameters})),n.tool_choice=`auto`),e.providerOptions!=null&&Object.assign(n,e.providerOptions),n}function w_(e){if(e==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let t=e.input_tokens,n=e.output_tokens,r=e.input_tokens_details?.cached_tokens??0,i=e.input_tokens_details?.cache_write_tokens??void 0,a=e.output_tokens_details?.reasoning_tokens??0;return{inputTokens:{total:t,noCache:t-r-(i??0),cacheRead:r,cacheWrite:i},outputTokens:{total:n,text:n-a,reasoning:a},raw:e}}function T_(e){return JSON.stringify(e===void 0?{}:e)}function E_(e,t){return e?.[t]?.promptCacheBreakpoint}function D_(e,t){return t?t.some(t=>e.startsWith(t)):!1}async function O_({prompt:e,toolNameMapping:t,systemMessageMode:n,providerOptionsName:r,fileIdPrefixes:i,passThroughUnsupportedFiles:a=!1,store:o,hasConversation:s=!1,hasPreviousResponseId:c=!1,hasLocalShellTool:l=!1,hasShellTool:u=!1,hasApplyPatchTool:d=!1,customProviderToolNames:f}){let p=[],m=[],h=new Set;for(let{role:g,content:_,providerOptions:v}of e)switch(g){case`system`:switch(n){case`system`:{let e=E_(v,r);p.push({role:`system`,content:e==null?_:[{type:`input_text`,text:_,prompt_cache_breakpoint:e}]});break}case`developer`:{let e=E_(v,r);p.push({role:`developer`,content:e==null?_:[{type:`input_text`,text:_,prompt_cache_breakpoint:e}]});break}case`remove`:m.push({type:`other`,message:`system messages are removed for this model`});break;default:throw Error(`Unsupported system message mode: ${n}`)}break;case`user`:p.push({role:`user`,content:_.map((e,t)=>{switch(e.type){case`text`:{let t=E_(e.providerOptions,r);return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}}}case`file`:{let n=E_(e.providerOptions,r);switch(e.data.type){case`reference`:{let t=Ph({reference:e.data.reference,provider:r});return tm(e.mediaType)===`image`?{type:`input_image`,file_id:t,detail:e.providerOptions?.[r]?.imageDetail,...n!=null&&{prompt_cache_breakpoint:n}}:{type:`input_file`,file_id:t,...n!=null&&{prompt_cache_breakpoint:n}}}case`text`:throw new pa({functionality:`text file parts`});case`url`:case`data`:if(tm(e.mediaType)===`image`)return{type:`input_image`,...e.data.type===`url`?{image_url:e.data.url.toString()}:typeof e.data.data==`string`&&D_(e.data.data,i)?{file_id:e.data.data}:{image_url:`data:${Nh({part:e})};base64,${Kp(e.data.data)}`},detail:e.providerOptions?.[r]?.imageDetail,...n!=null&&{prompt_cache_breakpoint:n}};{if(e.data.type===`url`)return{type:`input_file`,file_url:e.data.url.toString(),...n!=null&&{prompt_cache_breakpoint:n}};let r=Nh({part:e});if(r!==`application/pdf`&&!a)throw new pa({functionality:`file part media type ${r}`});return{type:`input_file`,...typeof e.data.data==`string`&&D_(e.data.data,i)?{file_id:e.data.data}:{filename:e.filename??(r===`application/pdf`?`part-${t}.pdf`:`part-${t}`),file_data:`data:${r};base64,${Kp(e.data.data)}`},...n!=null&&{prompt_cache_breakpoint:n}}}}}}})});break;case`assistant`:{let e={};for(let n of _)switch(n.type){case`text`:{let e=n.providerOptions?.[r],t=e?.itemId,i=e?.phase;if(s&&t!=null)break;if(o&&t!=null){p.push({type:`item_reference`,id:t});break}p.push({role:`assistant`,content:[{type:`output_text`,text:n.text}],id:t,...i!=null&&{phase:i}});break}case`tool-call`:{let e=n.providerOptions?.[r]?.itemId??n.providerMetadata?.[r]?.itemId,i=n.providerOptions?.[r]?.namespace??n.providerMetadata?.[r]?.namespace;if(s&&e!=null)break;let a=t.toProviderToolName(n.toolName);if(a===`tool_search`){if(o&&e!=null){p.push({type:`item_reference`,id:e});break}let t=typeof n.input==`string`?await wh({text:n.input,schema:iy}):await Sh({value:n.input,schema:iy}),r=t.call_id==null?`server`:`client`;p.push({type:`tool_search_call`,id:e??n.toolCallId,execution:r,call_id:t.call_id??null,status:`completed`,arguments:t.arguments});break}if(n.providerExecuted){o&&e!=null&&p.push({type:`item_reference`,id:e});break}if(c&&o&&e!=null)break;let m=l&&a===`local_shell`||u&&a===`shell`||d&&a===`apply_patch`||(f?.has(a)??!1);if(o&&e!=null&&m){p.push({type:`item_reference`,id:e});break}if(l&&a===`local_shell`){let t=await Sh({value:n.input,schema:Yv});p.push({type:`local_shell_call`,call_id:n.toolCallId,id:e,action:{type:`exec`,command:t.action.command,timeout_ms:t.action.timeoutMs,user:t.action.user,working_directory:t.action.workingDirectory,env:t.action.env}});break}if(u&&a===`shell`){let t=await Sh({value:n.input,schema:Qv});p.push({type:`shell_call`,call_id:n.toolCallId,id:e,status:`completed`,action:{commands:t.action.commands,timeout_ms:t.action.timeoutMs,max_output_length:t.action.maxOutputLength}});break}if(d&&a===`apply_patch`){let t=await Sh({value:n.input,schema:Av});p.push({type:`apply_patch_call`,call_id:t.callId,id:e,status:`completed`,operation:t.operation});break}if(f?.has(a)){p.push({type:`custom_tool_call`,call_id:n.toolCallId,name:a,input:typeof n.input==`string`?n.input:JSON.stringify(n.input),id:e});break}p.push({type:`function_call`,call_id:n.toolCallId,name:a,arguments:T_(n.input),...i!=null&&{namespace:i}});break}case`tool-result`:{if(n.output.type===`execution-denied`||n.output.type===`json`&&typeof n.output.value==`object`&&n.output.value!=null&&`type`in n.output.value&&n.output.value.type===`execution-denied`||s)break;let e=t.toProviderToolName(n.toolName);if(e===`tool_search`){let e=n.providerOptions?.[r]?.itemId??n.toolCallId;if(o)p.push({type:`item_reference`,id:e});else if(n.output.type===`json`){let t=await Sh({value:n.output.value,schema:ay});p.push({type:`tool_search_output`,id:e,execution:`server`,call_id:null,status:`completed`,tools:t.tools})}break}if(u&&e===`shell`){if(n.output.type===`json`){let e=await Sh({value:n.output.value,schema:$v});p.push({type:`shell_call_output`,call_id:n.toolCallId,output:e.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`timeout`?{type:`timeout`}:{type:`exit`,exit_code:e.outcome.exitCode}}))})}break}if(o){let e=n.providerOptions?.[r]?.itemId??n.toolCallId;p.push({type:`item_reference`,id:e})}else m.push({type:`other`,message:`Results for OpenAI tool ${n.toolName} are not sent to the API when store is false`});break}case`reasoning`:{let t=await Dh({provider:r,providerOptions:n.providerOptions,schema:yy}),i=t?.itemId;if((s||c)&&i!=null)break;if(i!=null){let r=e[i];if(o)r===void 0&&(p.push({type:`item_reference`,id:i}),e[i]={type:`reasoning`,id:i,summary:[]});else{let a=[];n.text.length>0?a.push({type:`summary_text`,text:n.text}):r!==void 0&&m.push({type:`other`,message:`Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(n)}.`}),r===void 0?(e[i]={type:`reasoning`,id:i,encrypted_content:t?.reasoningEncryptedContent,summary:a},p.push(e[i])):(r.summary.push(...a),t?.reasoningEncryptedContent!=null&&(r.encrypted_content=t.reasoningEncryptedContent))}}else{let e=t?.reasoningEncryptedContent;if(e!=null){let t=[];n.text.length>0&&t.push({type:`summary_text`,text:n.text}),p.push({type:`reasoning`,encrypted_content:e,summary:t})}else m.push({type:`other`,message:`Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(n)}.`})}break}case`custom`:if(n.kind===`openai.compaction`){let e=n.providerOptions?.[r],t=e?.itemId;if(s&&t!=null)break;if(o&&t!=null){p.push({type:`item_reference`,id:t});break}let i=e?.encryptedContent;t!=null&&p.push({type:`compaction`,id:t,encrypted_content:i})}break}break}case`tool`:for(let e of _){if(e.type===`tool-approval-response`){let t=e;if(h.has(t.approvalId))continue;h.add(t.approvalId),o&&p.push({type:`item_reference`,id:t.approvalId}),p.push({type:`mcp_approval_response`,approval_request_id:t.approvalId,approve:t.approved});continue}let n=e.output;if(n.type===`execution-denied`&&n.providerOptions?.openai?.approvalId)continue;let i=t.toProviderToolName(e.toolName);if(i===`tool_search`&&n.type===`json`){let t=await Sh({value:n.value,schema:ay});p.push({type:`tool_search_output`,execution:`client`,call_id:e.toolCallId,status:`completed`,tools:t.tools});continue}if(l&&i===`local_shell`&&n.type===`json`){let t=await Sh({value:n.value,schema:Xv});p.push({type:`local_shell_call_output`,call_id:e.toolCallId,output:t.output});continue}if(u&&i===`shell`&&n.type===`json`){let t=await Sh({value:n.value,schema:$v});p.push({type:`shell_call_output`,call_id:e.toolCallId,output:t.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`timeout`?{type:`timeout`}:{type:`exit`,exit_code:e.outcome.exitCode}}))});continue}if(d&&e.toolName===`apply_patch`&&n.type===`json`){let t=await Sh({value:n.value,schema:jv});p.push({type:`apply_patch_call_output`,call_id:e.toolCallId,status:t.status,output:t.output});continue}if(f?.has(i)){let t;switch(n.type){case`text`:case`error-text`:t=n.value;break;case`execution-denied`:t=n.reason??`Tool call execution denied.`;break;case`json`:case`error-json`:t=JSON.stringify(n.value);break;case`content`:t=n.value.map(e=>{let t=E_(e.providerOptions,r);switch(e.type){case`text`:return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}};case`file`:{let n=tm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Nh({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${Kp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${Kp(e.data.data)}`,...t!=null&&{prompt_cache_breakpoint:t}}}if(e.data.type===`url`)return n===`image`?{type:`input_image`,image_url:e.data.url.toString(),detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,file_url:e.data.url.toString(),...t!=null&&{prompt_cache_breakpoint:t}};m.push({type:`other`,message:`unsupported custom tool content part type: ${e.type} with data type: ${e.data.type}`});return}default:m.push({type:`other`,message:`unsupported custom tool content part type: ${e.type}`});return}}).filter(xm);break;default:t=``}p.push({type:`custom_tool_call_output`,call_id:e.toolCallId,output:t});continue}let a;switch(n.type){case`text`:case`error-text`:a=n.value;break;case`execution-denied`:a=n.reason??`Tool call execution denied.`;break;case`json`:case`error-json`:a=JSON.stringify(n.value);break;case`content`:a=n.value.map(e=>{let t=E_(e.providerOptions,r);switch(e.type){case`text`:return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}};case`file`:{let n=tm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Nh({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${Kp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${Kp(e.data.data)}`,...t!=null&&{prompt_cache_breakpoint:t}}}if(e.data.type===`url`)return n===`image`?{type:`input_image`,image_url:e.data.url.toString(),detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,file_url:e.data.url.toString(),...t!=null&&{prompt_cache_breakpoint:t}};m.push({type:`other`,message:`unsupported tool content part type: ${e.type} with data type: ${e.data.type}`});return}default:m.push({type:`other`,message:`unsupported tool content part type: ${e.type}`});return}}).filter(xm);break}p.push({type:`function_call_output`,call_id:e.toolCallId,output:a})}break;default:throw Error(`Unsupported role: ${g}`)}return!o&&p.some(e=>`type`in e&&e.type===`reasoning`&&e.encrypted_content==null)&&(m.push({type:`other`,message:`Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts.`}),p=p.filter(e=>!(`type`in e)||e.type!==`reasoning`||e.encrypted_content!=null)),{input:p,warnings:m}}function k_({finishReason:e,hasFunctionCall:t}){switch(e){case void 0:case null:return t?`tool-calls`:`stop`;case`max_output_tokens`:return`length`;case`content_filter`:return`content-filter`;default:return t?`tool-calls`:`other`}}async function A_({tools:e,toolChoice:t,allowedTools:n,toolNameMapping:r,customProviderToolNames:i}){e=e?.length?e:void 0;let a=[];if(e==null)return{tools:void 0,toolChoice:void 0,toolWarnings:a};let o=[],s=new Map,c=i??new Set;for(let t of e)switch(t.type){case`function`:{let e=t.providerOptions?.openai,n=j_({tool:t,options:e}),r=e?.namespace;if(r==null)o.push(n);else{let e=s.get(r.name);if(e==null)e={type:`namespace`,name:r.name,description:r.description,tools:[]},s.set(r.name,e),o.push(e);else if(e.description!==r.description)throw new pa({functionality:`conflicting descriptions for OpenAI tool namespace "${r.name}"`});e.tools.push(n)}break}case`provider`:switch(t.id){case`openai.file_search`:{let e=await Sh({value:t.args,schema:Uv});o.push({type:`file_search`,vector_store_ids:e.vectorStoreIds,max_num_results:e.maxNumResults,ranking_options:e.ranking?{ranker:e.ranking.ranker,score_threshold:e.ranking.scoreThreshold}:void 0,filters:e.filters});break}case`openai.local_shell`:o.push({type:`local_shell`});break;case`openai.shell`:{let e=await Sh({value:t.args,schema:ty});o.push({type:`shell`,...e.environment&&{environment:M_(e.environment)}});break}case`openai.apply_patch`:o.push({type:`apply_patch`});break;case`openai.web_search_preview`:{let e=await Sh({value:t.args,schema:dy});o.push({type:`web_search_preview`,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case`openai.web_search`:{let e=await Sh({value:t.args,schema:cy});o.push({type:`web_search`,filters:e.filters==null?void 0:{allowed_domains:e.filters.allowedDomains},external_web_access:e.externalWebAccess,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case`openai.code_interpreter`:{let e=await Sh({value:t.args,schema:Fv});o.push({type:`code_interpreter`,container:e.container==null?{type:`auto`,file_ids:void 0}:typeof e.container==`string`?e.container:{type:`auto`,file_ids:e.container.fileIds}});break}case`openai.image_generation`:{let e=await Sh({value:t.args,schema:Kv});o.push({type:`image_generation`,background:e.background,input_fidelity:e.inputFidelity,input_image_mask:e.inputImageMask?{file_id:e.inputImageMask.fileId,image_url:e.inputImageMask.imageUrl}:void 0,model:e.model,moderation:e.moderation,partial_images:e.partialImages,quality:e.quality,output_compression:e.outputCompression,output_format:e.outputFormat,size:e.size});break}case`openai.mcp`:{let e=await Sh({value:t.args,schema:my}),n=e=>({tool_names:e.toolNames}),r=e.requireApproval,i=r==null?void 0:typeof r==`string`?r:r.never==null?void 0:{never:n(r.never)};o.push({type:`mcp`,server_label:e.serverLabel,allowed_tools:Array.isArray(e.allowedTools)?e.allowedTools:e.allowedTools?{read_only:e.allowedTools.readOnly,tool_names:e.allowedTools.toolNames}:void 0,authorization:e.authorization,connector_id:e.connectorId,headers:e.headers,require_approval:i??`never`,server_description:e.serverDescription,server_url:e.serverUrl});break}case`openai.custom`:{let e=await Sh({value:t.args,schema:Rv});o.push({type:`custom`,name:t.name,description:e.description,format:e.format}),c.add(t.name);break}case`openai.tool_search`:{let e=await Sh({value:t.args,schema:ry});o.push({type:`tool_search`,...e.execution==null?{}:{execution:e.execution},...e.description==null?{}:{description:e.description},...e.parameters==null?{}:{parameters:e.parameters}});break}}break;default:a.push({type:`unsupported`,feature:`function tool ${t}`});break}if(n!=null)return{tools:o,toolChoice:{type:`allowed_tools`,mode:n.mode??`auto`,tools:n.toolNames.map(e=>({type:`function`,name:r?.toProviderToolName(e)??e}))},toolWarnings:a};if(t==null)return{tools:o,toolChoice:void 0,toolWarnings:a};let l=t.type;switch(l){case`auto`:case`none`:case`required`:return{tools:o,toolChoice:l,toolWarnings:a};case`tool`:{let e=r?.toProviderToolName(t.toolName)??t.toolName;return{tools:o,toolChoice:e===`code_interpreter`||e===`file_search`||e===`image_generation`||e===`web_search_preview`||e===`web_search`||e===`mcp`||e===`apply_patch`?{type:e}:c.has(e)?{type:`custom`,name:e}:{type:`function`,name:e},toolWarnings:a}}default:throw new pa({functionality:`tool choice type: ${l}`})}}function j_({tool:e,options:t}){let n=t?.deferLoading;return{type:`function`,name:e.name,description:e.description,parameters:e.inputSchema,...e.strict==null?{}:{strict:e.strict},...n==null?{}:{defer_loading:n}}}function M_(e){if(e.type===`containerReference`)return{type:`container_reference`,container_id:e.containerId};if(e.type===`containerAuto`){let t=e;return{type:`container_auto`,file_ids:t.fileIds,memory_limit:t.memoryLimit,network_policy:t.networkPolicy==null?void 0:t.networkPolicy.type===`disabled`?{type:`disabled`}:{type:`allowlist`,allowed_domains:t.networkPolicy.allowedDomains,domain_secrets:t.networkPolicy.domainSecrets},skills:N_(t.skills)}}return{type:`local`,skills:e.skills}}function N_(e){return e?.map(e=>e.type===`skillReference`?{type:`skill_reference`,skill_id:Ph({reference:e.providerReference??{},provider:`openai`}),version:e.version??`latest`}:{type:`inline`,name:e.name,description:e.description,source:{type:`base64`,media_type:e.source.mediaType,data:e.source.data}})}function P_(e){let t={};for(let n of e)if(n.role===`assistant`)for(let e of n.content){if(e.type!==`tool-call`)continue;let n=e.providerOptions?.openai?.approvalRequestId;n!=null&&(t[n]=e.toolCallId)}return t}function F_(e){return e.type===`response.output_text.delta`}function I_(e){let t=R_(e);return t!=null&&Array.isArray(t.choices)&&typeof t.type!=`string`}function L_({value:e,cause:t,url:n,requestBodyValues:r,responseHeaders:i}){return new $r({message:`Received a Chat Completions stream while using the OpenAI Responses API. The default OpenAI provider model uses the Responses API. If your custom baseURL targets a Chat Completions-compatible endpoint, use openai.chat('model-id') or createOpenAI(...).chat('model-id') instead. You can also use @ai-sdk/openai-compatible for OpenAI-compatible providers.`,url:n,requestBodyValues:r,responseHeaders:i,responseBody:JSON.stringify(e),cause:t,data:e,isRetryable:!1})}function R_(e){return typeof e==`object`&&e?e:void 0}function z_(e){return e.type===`response.output_item.done`}function B_(e){return e.type===`response.completed`||e.type===`response.incomplete`}function V_(e){return e.type===`response.failed`}function H_(e){return e.type===`response.created`}function U_(e){return e.type===`response.function_call_arguments.delta`}function W_(e){return e.type===`response.custom_tool_call_input.delta`}function G_(e){return e.type===`response.image_generation_call.partial_image`}function K_(e){return e.type===`response.code_interpreter_call_code.delta`}function q_(e){return e.type===`response.code_interpreter_call_code.done`}function J_(e){return e.type===`response.apply_patch_call_operation_diff.delta`}function Y_(e){return e.type===`response.apply_patch_call_operation_diff.done`}function X_(e){return e.type===`response.output_item.added`}function Z_(e){return e.type===`response.output_text.annotation.added`}function Q_(e){return e.type===`error`}function $_(e){return!(e.type===`response.created`||e.type===`response.failed`||e.type===`error`||e.type===`unknown_chunk`)}function ev(e){if(e==null)return{};switch(e.type){case`search`:return{action:{type:`search`,query:e.query??void 0,...e.queries!=null&&{queries:e.queries}},...e.sources!=null&&{sources:e.sources}};case`open_page`:return{action:{type:`openPage`,url:e.url}};case`find_in_page`:return{action:{type:`findInPage`,url:e.url,pattern:e.pattern}}}}function tv(e){return JSON.stringify(e).slice(1,-1)}function nv(e){return e===`gpt-realtime-whisper`||e.startsWith(`gpt-realtime-whisper-`)}function rv({webSocket:e,url:t,headers:n,sessionUpdate:r,language:i,warnings:a,audio:o,abortSignal:s,includeRawChunks:c}){let l=!1,u=()=>{};return new ReadableStream({start:d=>{let f=new(Bh(e))(t,av(n),{headers:n}),p;u=e=>{s?.removeEventListener(`abort`,g),p?.cancel().catch(()=>{});try{f.close(e)}catch{}};let m=e=>{l||(l=!0,u(),d.error(e))},h=(e,t)=>{l||(l=!0,t!=null&&d.enqueue({type:`transcript-final`,id:t,text:e}),d.enqueue({type:`finish`,text:e,segments:[],language:i}),d.close(),u(1e3))},g=()=>{m(s?.reason??Error(`Aborted`))};if(s?.aborted){g();return}s?.addEventListener(`abort`,g,{once:!0});let _=async()=>{p=o.getReader();try{for(;;){let{done:e,value:t}=await p.read();if(e||l)break;f.send(JSON.stringify({type:`input_audio_buffer.append`,audio:Kp(t)}))}}finally{p.releaseLock()}l||f.send(JSON.stringify({type:`input_audio_buffer.commit`}))};f.onopen=()=>{d.enqueue({type:`stream-start`,warnings:a}),f.send(JSON.stringify(r)),_().catch(m)},f.onmessage=e=>{Hh(e.data).then(async e=>{let t=await Th({text:e});if(!t.success)return;let n=t.value;switch(c&&d.enqueue({type:`raw`,rawValue:n}),n.type){case`conversation.item.input_audio_transcription.delta`:d.enqueue({type:`transcript-delta`,id:n.item_id,delta:n.delta??``});break;case`conversation.item.input_audio_transcription.completed`:h(n.transcript??``,n.item_id);break;case`error`:m(Error(n.error?.message??`OpenAI realtime error`));break}}).catch(m)},f.onerror=()=>{m(Error(`OpenAI realtime transcription error`))},f.onclose=()=>{l||(l=!0,u(),d.close())}},cancel:()=>{l||(l=!0,u())}})}function iv({modelId:e,inputAudioFormat:t,providerOptions:n}){return{type:`session.update`,session:{type:`transcription`,audio:{input:{format:{type:t.type,...t.rate==null?{}:{rate:t.rate}},transcription:{model:e,...n?.language==null?{}:{language:n.language},...n?.streaming?.delay==null?{}:{delay:n.streaming.delay}},turn_detection:null}},...n?.streaming?.include==null?{}:{include:n.streaming.include}}}}function av(e){let t=e.Authorization??e.authorization,n=t?.startsWith(`Bearer `)?t.slice(7):void 0;return n==null?[`realtime`]:[`realtime`,`openai-insecure-api-key.${n}`]}function ov(e={}){let t=Uh(Tm({settingValue:e.baseURL,environmentVariableName:`OPENAI_BASE_URL`}))??`https://api.openai.com/v1`,n=e.name??`openai`,r=()=>ym({Authorization:`Bearer ${wm({apiKey:e.apiKey,environmentVariableName:`OPENAI_API_KEY`,description:`OpenAI`})}`,"OpenAI-Organization":e.organization,"OpenAI-Project":e.project,...e.headers},`ai-sdk/openai/${Iy}`),i=i=>new fv(i,{provider:`${n}.chat`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),a=i=>new gv(i,{provider:`${n}.completion`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),o=i=>new yv(i,{provider:`${n}.embedding`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),s=i=>new kv(i,{provider:`${n}.image`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),c=i=>new Ny(i,{provider:`${n}.transcription`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,webSocket:e.webSocket}),l=i=>new ky(i,{provider:`${n}.speech`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),u=()=>new Sv({provider:`${n}.files`,baseURL:t,headers:r,fetch:e.fetch}),d=()=>new Fy({provider:`${n}.skills`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),f=e=>{if(new.target)throw Error(`The OpenAI model function cannot be called with the new keyword.`);return p(e)},p=i=>new Dy(i,{provider:`${n}.responses`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,fileIdPrefixes:[`file-`]}),m=i=>new vy(i,{provider:`${n}.realtime`,baseURL:t,headers:r,fetch:e.fetch}),h=Object.assign(e=>m(e),{getToken:async e=>{let t=await m(e.model).doCreateClientSecret({sessionConfig:e.sessionConfig,expiresAfterSeconds:e.expiresAfterSeconds});return{token:t.token,url:t.url,expiresAt:t.expiresAt}}}),g=function(e){return f(e)};return g.specificationVersion=`v4`,g.languageModel=f,g.chat=i,g.completion=a,g.responses=p,g.embedding=o,g.embeddingModel=o,g.textEmbedding=o,g.textEmbeddingModel=o,g.image=s,g.imageModel=s,g.transcription=c,g.transcriptionModel=c,g.speech=l,g.speechModel=l,g.files=u,g.skills=d,g.experimental_realtime=h,g.tools=_y,g}var sv,cv,lv,uv,dv,fv,pv,mv,hv,gv,_v,vv,yv,bv,xv,Sv,Cv,wv,Tv,Ev,Dv,Ov,kv,Av,jv,Mv,Nv,Pv,Fv,Iv,Lv,Rv,zv,Bv,Vv,Hv,Uv,Wv,Gv,Kv,qv,Jv,Yv,Xv,Zv,Qv,$v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly=t((()=>{Xg(),Nd(),ma(),sv=z({error:z({message:I(),type:I().nullish(),param:cu().nullish(),code:B([I(),L()]).nullish()})}),cv=Wg({errorSchema:sv,errorToMessage:e=>e.error.message}),lv=K(()=>q(z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({message:z({role:H(`assistant`).nullish(),content:I().nullish(),tool_calls:R(z({id:I().nullish(),type:H(`function`),function:z({name:I(),arguments:I()})})).nullish(),annotations:R(z({type:H(`url_citation`),url_citation:z({start_index:L(),end_index:L(),url:I(),title:I()})})).nullish()}),index:L(),logprobs:z({content:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}).nullish(),finish_reason:I().nullish()})),usage:z({prompt_tokens:L().nullish(),completion_tokens:L().nullish(),total_tokens:L().nullish(),prompt_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish()}).nullish(),completion_tokens_details:z({reasoning_tokens:L().nullish(),accepted_prediction_tokens:L().nullish(),rejected_prediction_tokens:L().nullish()}).nullish()}).nullish()}))),uv=K(()=>q(B([z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({delta:z({role:V([`assistant`]).nullish(),content:I().nullish(),tool_calls:R(z({index:L(),id:I().nullish(),type:H(`function`).nullish(),function:z({name:I().nullish(),arguments:I().nullish()})})).nullish(),annotations:R(z({type:H(`url_citation`),url_citation:z({start_index:L(),end_index:L(),url:I(),title:I()})})).nullish()}).nullish(),logprobs:z({content:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}).nullish(),finish_reason:I().nullish(),index:L()})),usage:z({prompt_tokens:L().nullish(),completion_tokens:L().nullish(),total_tokens:L().nullish(),prompt_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish()}).nullish(),completion_tokens_details:z({reasoning_tokens:L().nullish(),accepted_prediction_tokens:L().nullish(),rejected_prediction_tokens:L().nullish()}).nullish()}).nullish()}),sv]))),dv=K(()=>q(z({logitBias:hu(kd(),L()).optional(),logprobs:B([ou(),L()]).optional(),parallelToolCalls:ou().optional(),user:I().optional(),reasoningEffort:V([`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]).optional(),maxCompletionTokens:L().optional(),store:ou().optional(),metadata:hu(I().max(64),I().max(512)).optional(),prediction:hu(I(),cu()).optional(),serviceTier:V([`auto`,`flex`,`priority`,`default`]).optional(),strictJsonSchema:ou().optional(),textVerbosity:V([`low`,`medium`,`high`]).optional(),promptCacheKey:I().optional(),promptCacheOptions:z({mode:V([`implicit`,`explicit`]).optional(),ttl:H(`30m`).optional()}).optional(),promptCacheRetention:V([`in_memory`,`24h`]).optional(),safetyIdentifier:I().optional(),systemMessageMode:V([`system`,`developer`,`remove`]).optional(),forceReasoning:ou().optional()}))),fv=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:r,topK:i,frequencyPenalty:a,presencePenalty:o,stopSequences:s,responseFormat:c,seed:l,tools:u,toolChoice:d,reasoning:f,providerOptions:p}){let m=[],h=await Dh({provider:`openai`,providerOptions:p,schema:dv})??{},g=Zg(this.modelId),_=h.reasoningEffort??(Em(f)?f:void 0),v=h.forceReasoning??g.isReasoningModel;i!=null&&m.push({type:`unsupported`,feature:`topK`});let{messages:y,warnings:b}=c_({prompt:e,systemMessageMode:h.systemMessageMode??(v?`developer`:g.systemMessageMode)});m.push(...b);let x=h.strictJsonSchema??!0,S={model:this.modelId,logit_bias:h.logitBias,logprobs:h.logprobs===!0||typeof h.logprobs==`number`||void 0,top_logprobs:typeof h.logprobs==`number`?h.logprobs:typeof h.logprobs==`boolean`&&h.logprobs?0:void 0,user:h.user,parallel_tool_calls:h.parallelToolCalls,max_tokens:t,temperature:n,top_p:r,frequency_penalty:a,presence_penalty:o,response_format:c?.type===`json`?c.schema==null?{type:`json_object`}:{type:`json_schema`,json_schema:{schema:c.schema,strict:x,name:c.name??`response`,description:c.description}}:void 0,stop:s,seed:l,verbosity:h.textVerbosity,max_completion_tokens:h.maxCompletionTokens,store:h.store,metadata:h.metadata,prediction:h.prediction,reasoning_effort:_,service_tier:h.serviceTier,prompt_cache_key:h.promptCacheKey,prompt_cache_options:h.promptCacheOptions,prompt_cache_retention:h.promptCacheRetention,safety_identifier:h.safetyIdentifier,messages:y};v?((_!==`none`||!g.supportsNonReasoningParameters)&&(S.temperature!=null&&(S.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for reasoning models`})),S.top_p!=null&&(S.top_p=void 0,m.push({type:`unsupported`,feature:`topP`,details:`topP is not supported for reasoning models`})),S.logprobs!=null&&(S.logprobs=void 0,m.push({type:`other`,message:`logprobs is not supported for reasoning models`}))),S.frequency_penalty!=null&&(S.frequency_penalty=void 0,m.push({type:`unsupported`,feature:`frequencyPenalty`,details:`frequencyPenalty is not supported for reasoning models`})),S.presence_penalty!=null&&(S.presence_penalty=void 0,m.push({type:`unsupported`,feature:`presencePenalty`,details:`presencePenalty is not supported for reasoning models`})),S.logit_bias!=null&&(S.logit_bias=void 0,m.push({type:`other`,message:`logitBias is not supported for reasoning models`})),S.top_logprobs!=null&&(S.top_logprobs=void 0,m.push({type:`other`,message:`topLogprobs is not supported for reasoning models`})),S.max_tokens!=null&&(S.max_completion_tokens??=S.max_tokens,S.max_tokens=void 0)):(this.modelId.startsWith(`gpt-4o-search-preview`)||this.modelId.startsWith(`gpt-4o-mini-search-preview`))&&S.temperature!=null&&(S.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for the search preview models and has been removed.`})),h.serviceTier===`flex`&&!g.supportsFlexProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`flex processing is only available for o3, o4-mini, and gpt-5 models`}),S.service_tier=void 0),h.serviceTier===`priority`&&!g.supportsPriorityProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported`}),S.service_tier=void 0);let{tools:C,toolChoice:w,toolWarnings:T}=d_({tools:u,toolChoice:d});return{args:{...S,tools:C,tool_choice:w},warnings:[...m,...T]}}async doGenerate(e){var t;let{args:n,warnings:r}=await this.getArgs(e),{responseHeaders:i,value:a,rawValue:o}=await zg({url:this.config.url({path:`/chat/completions`,modelId:this.modelId}),headers:Up((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:cv,successfulResponseHandler:Kg(lv),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=a.choices[0],c=[],l=s.message.content;l!=null&&l.length>0&&c.push({type:`text`,text:l});for(let e of s.message.tool_calls??[])c.push({type:`tool-call`,toolCallId:e.id??cg(),toolName:e.function.name,input:e.function.arguments});for(let e of s.message.annotations??[])c.push({type:`source`,sourceType:`url`,id:cg(),url:e.url_citation.url,title:e.url_citation.title});let u=a.usage?.completion_tokens_details,d={openai:{}};return u?.accepted_prediction_tokens!=null&&(d.openai.acceptedPredictionTokens=u?.accepted_prediction_tokens),u?.rejected_prediction_tokens!=null&&(d.openai.rejectedPredictionTokens=u?.rejected_prediction_tokens),s.logprobs?.content!=null&&(d.openai.logprobs=s.logprobs.content),{content:c,finishReason:{unified:u_(s.finish_reason),raw:s.finish_reason??void 0},usage:a_(a.usage),request:{body:n},response:{...l_(a),headers:i,body:o},warnings:r,providerMetadata:d}}async doStream(e){var t;let{args:n,warnings:r}=await this.getArgs(e),i={...n,stream:!0,stream_options:{include_usage:!0}},a=this.config.url({path:`/chat/completions`,modelId:this.modelId}),{responseHeaders:o,value:s}=await zg({url:a,headers:Up((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:cv,successfulResponseHandler:Gg(uv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await Qg({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:f_,url:a,requestBodyValues:i,responseHeaders:o}),l,u={unified:`other`,raw:void 0},d,f=!1,p=!1,m={openai:{}};return{stream:c.pipeThrough(new TransformStream({start(e){l=new Jg(e,{generateId:cg,typeValidation:`if-present`}),e.enqueue({type:`stream-start`,warnings:r})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){u={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:t.error});return}let r=t.value;if(`error`in r){u={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:r.error});return}if(!f){let e=l_(r);Object.values(e).some(Boolean)&&(f=!0,n.enqueue({type:`response-metadata`,...l_(r)}))}r.usage!=null&&(d=r.usage,r.usage.completion_tokens_details?.accepted_prediction_tokens!=null&&(m.openai.acceptedPredictionTokens=r.usage.completion_tokens_details?.accepted_prediction_tokens),r.usage.completion_tokens_details?.rejected_prediction_tokens!=null&&(m.openai.rejectedPredictionTokens=r.usage.completion_tokens_details?.rejected_prediction_tokens));let i=r.choices[0];if(i?.finish_reason!=null&&(u={unified:u_(i.finish_reason),raw:i.finish_reason}),i?.logprobs?.content!=null&&(m.openai.logprobs=i.logprobs.content),i?.delta==null)return;let a=i.delta;if(a.content!=null&&(p||=(n.enqueue({type:`text-start`,id:`0`}),!0),n.enqueue({type:`text-delta`,id:`0`,delta:a.content})),a.tool_calls!=null)for(let e of a.tool_calls)l.processDelta(e);if(a.annotations!=null)for(let e of a.annotations)n.enqueue({type:`source`,sourceType:`url`,id:cg(),url:e.url_citation.url,title:e.url_citation.title})},flush(e){p&&e.enqueue({type:`text-end`,id:`0`}),l.flush(),e.enqueue({type:`finish`,finishReason:u,usage:a_(d),...m==null?{}:{providerMetadata:m}})}})),request:{body:i},response:{headers:o}}}},pv=K(()=>q(z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({text:I(),finish_reason:I(),logprobs:z({tokens:R(I()),token_logprobs:R(L()),top_logprobs:R(hu(I(),L())).nullish()}).nullish()})),usage:z({prompt_tokens:L(),completion_tokens:L(),total_tokens:L()}).nullish()}))),mv=K(()=>q(B([z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({text:I(),finish_reason:I().nullish(),index:L(),logprobs:z({tokens:R(I()),token_logprobs:R(L()),top_logprobs:R(hu(I(),L())).nullish()}).nullish()})),usage:z({prompt_tokens:L(),completion_tokens:L(),total_tokens:L()}).nullish()}),sv]))),hv=K(()=>q(z({echo:ou().optional(),logitBias:hu(I(),L()).optional(),suffix:I().optional(),user:I().optional(),logprobs:B([ou(),L()]).optional()}))),gv=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={},this.modelId=e,this.config=t}get providerOptionsName(){return this.config.provider.split(`.`)[0].trim()}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:r,topK:i,frequencyPenalty:a,presencePenalty:o,stopSequences:s,responseFormat:c,tools:l,toolChoice:u,seed:d,providerOptions:f}){let p=[],m={...await Dh({provider:`openai`,providerOptions:f,schema:hv}),...await Dh({provider:this.providerOptionsName,providerOptions:f,schema:hv})};i!=null&&p.push({type:`unsupported`,feature:`topK`}),l?.length&&p.push({type:`unsupported`,feature:`tools`}),u!=null&&p.push({type:`unsupported`,feature:`toolChoice`}),c!=null&&c.type!==`text`&&p.push({type:`unsupported`,feature:`responseFormat`,details:`JSON response format is not supported.`});let{prompt:h,stopSequences:g}=m_({prompt:e}),_=[...g??[],...s??[]];return{args:{model:this.modelId,echo:m.echo,logit_bias:m.logitBias,logprobs:m?.logprobs===!0?0:m?.logprobs===!1?void 0:m?.logprobs,suffix:m.suffix,user:m.user,max_tokens:t,temperature:n,top_p:r,frequency_penalty:a,presence_penalty:o,seed:d,prompt:h,stop:_.length>0?_:void 0},warnings:p}}async doGenerate(e){var t;let{args:n,warnings:r}=await this.getArgs(e),{responseHeaders:i,value:a,rawValue:o}=await zg({url:this.config.url({path:`/completions`,modelId:this.modelId}),headers:Up((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:cv,successfulResponseHandler:Kg(pv),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=a.choices[0],c={openai:{}};return s.logprobs!=null&&(c.openai.logprobs=s.logprobs),{content:[{type:`text`,text:s.text}],usage:p_(a.usage),finishReason:{unified:g_(s.finish_reason),raw:s.finish_reason??void 0},request:{body:n},response:{...h_(a),headers:i,body:o},providerMetadata:c,warnings:r}}async doStream(e){var t;let{args:n,warnings:r}=await this.getArgs(e),i={...n,stream:!0,stream_options:{include_usage:!0}},a=this.config.url({path:`/completions`,modelId:this.modelId}),{responseHeaders:o,value:s}=await zg({url:a,headers:Up((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:cv,successfulResponseHandler:Gg(mv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await Qg({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:__,url:a,requestBodyValues:i,responseHeaders:o}),l={unified:`other`,raw:void 0},u={openai:{}},d,f=!0;return{stream:c.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:r})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){l={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:t.error});return}let r=t.value;if(`error`in r){l={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:r.error});return}f&&(f=!1,n.enqueue({type:`response-metadata`,...h_(r)}),n.enqueue({type:`text-start`,id:`0`})),r.usage!=null&&(d=r.usage);let i=r.choices[0];i?.finish_reason!=null&&(l={unified:g_(i.finish_reason),raw:i.finish_reason}),i?.logprobs!=null&&(u.openai.logprobs=i.logprobs),i?.text!=null&&i.text.length>0&&n.enqueue({type:`text-delta`,id:`0`,delta:i.text})},flush(e){f||e.enqueue({type:`text-end`,id:`0`}),e.enqueue({type:`finish`,finishReason:l,providerMetadata:u,usage:p_(d)})}})),request:{body:i},response:{headers:o}}}},_v=K(()=>q(z({dimensions:L().optional(),user:I().optional()}))),vv=K(()=>q(z({data:R(z({embedding:R(L())})),usage:z({prompt_tokens:L()}).nullish()}))),yv=class e{constructor(e,t){this.specificationVersion=`v4`,this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=e,this.config=t}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:r}){var i;if(e.length>this.maxEmbeddingsPerCall)throw new ta({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:e});let a=await Dh({provider:`openai`,providerOptions:r,schema:_v})??{},{responseHeaders:o,value:s,rawValue:c}=await zg({url:this.config.url({path:`/embeddings`,modelId:this.modelId}),headers:Up((i=this.config).headers?.call(i),t),body:{model:this.modelId,input:e,encoding_format:`float`,dimensions:a.dimensions,user:a.user},failedResponseHandler:cv,successfulResponseHandler:Kg(vv),abortSignal:n,fetch:this.config.fetch});return{warnings:[],embeddings:s.data.map(e=>e.embedding),usage:s.usage?{tokens:s.usage.prompt_tokens}:void 0,response:{headers:o,body:c}}}},bv=K(()=>q(z({id:I(),object:I().nullish(),bytes:L().nullish(),created_at:L().nullish(),filename:I().nullish(),purpose:I().nullish(),status:I().nullish(),expires_at:L().nullish()}))),xv=K(()=>q(z({purpose:I().optional(),expiresAfter:L().optional()}))),Sv=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadFile({data:e,mediaType:t,filename:n,providerOptions:r}){let i=await Dh({provider:`openai`,providerOptions:r,schema:xv}),a=qp(e),o=new Blob([a],{type:t}),s=new FormData;n==null?s.append(`file`,o):s.append(`file`,o,n),s.append(`purpose`,i?.purpose??`assistants`),i?.expiresAfter!=null&&s.append(`expires_after`,String(i.expiresAfter));let{value:c}=await Bg({url:`${this.config.baseURL}/files`,headers:Up(this.config.headers()),formData:s,failedResponseHandler:cv,successfulResponseHandler:Kg(bv),fetch:this.config.fetch});return{warnings:[],providerReference:{openai:c.id},...c.filename??n?{filename:c.filename??n}:{},...t==null?{}:{mediaType:t},providerMetadata:{openai:{...c.filename==null?{}:{filename:c.filename},...c.purpose==null?{}:{purpose:c.purpose},...c.bytes==null?{}:{bytes:c.bytes},...c.created_at==null?{}:{createdAt:c.created_at},...c.status==null?{}:{status:c.status},...c.expires_at==null?{}:{expiresAt:c.expires_at}}}}}},Cv=K(()=>q(z({created:L().nullish(),data:R(z({b64_json:I(),revised_prompt:I().nullish()})),background:I().nullish(),output_format:I().nullish(),size:I().nullish(),quality:I().nullish(),usage:z({input_tokens:L().nullish(),output_tokens:L().nullish(),total_tokens:L().nullish(),input_tokens_details:z({image_tokens:L().nullish(),text_tokens:L().nullish()}).nullish()}).nullish()}))),wv={"dall-e-3":1,"dall-e-2":10,"gpt-image-1":10,"gpt-image-1-mini":10,"gpt-image-1.5":10,"gpt-image-2":10,"chatgpt-image-latest":10},Tv=[`chatgpt-image-`,`gpt-image-1-mini`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-2`],Ev=z({quality:V([`standard`,`hd`,`low`,`medium`,`high`,`auto`]).optional(),background:V([`transparent`,`opaque`,`auto`]).optional(),outputFormat:V([`png`,`jpeg`,`webp`]).optional(),outputCompression:L().int().min(0).max(100).optional(),user:I().optional()}),Dv=K(()=>q(Ev.extend({style:V([`vivid`,`natural`]).optional(),moderation:V([`auto`,`low`]).optional()}))),Ov=K(()=>q(Ev.extend({inputFidelity:V([`high`,`low`]).optional()}))),kv=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get maxImagesPerCall(){return wv[this.modelId]??1}get provider(){return this.config.provider}async doGenerate({prompt:e,files:t,mask:n,n:r,size:i,aspectRatio:a,seed:o,providerOptions:s,headers:c,abortSignal:l}){var u,d,f;let p=[];a!=null&&p.push({type:`unsupported`,feature:`aspectRatio`,details:"This model does not support aspect ratio. Use `size` instead."}),o!=null&&p.push({type:`unsupported`,feature:`seed`});let m=((u=this.config._internal)?.currentDate)?.call(u)??new Date;if(t!=null){let a=await Dh({provider:`openai`,providerOptions:s,schema:Ov})??{},{value:o,responseHeaders:u}=await Bg({url:this.config.url({path:`/images/edits`,modelId:this.modelId}),headers:Up((d=this.config).headers?.call(d),c),formData:Jp({model:this.modelId,prompt:e,image:await Promise.all(t.map(e=>e.type===`file`?new Blob([e.data instanceof Uint8Array?new Blob([e.data],{type:e.mediaType}):new Blob([Wp(e.data)],{type:e.mediaType})],{type:e.mediaType}):fm(e.url))),mask:n==null?void 0:await b_(n),n:r,size:i,quality:a.quality,background:a.background,output_format:a.outputFormat,output_compression:a.outputCompression,input_fidelity:a.inputFidelity,user:a.user}),failedResponseHandler:cv,successfulResponseHandler:Kg(Cv),abortSignal:l,fetch:this.config.fetch});return{images:o.data.map(e=>e.b64_json),warnings:p,usage:o.usage==null?void 0:{inputTokens:o.usage.input_tokens??void 0,outputTokens:o.usage.output_tokens??void 0,totalTokens:o.usage.total_tokens??void 0},response:{timestamp:m,modelId:this.modelId,headers:u},providerMetadata:{openai:{images:o.data.map((e,t)=>({...e.revised_prompt?{revisedPrompt:e.revised_prompt}:{},created:o.created??void 0,size:o.size??void 0,quality:o.quality??void 0,background:o.background??void 0,outputFormat:o.output_format??void 0,...y_(o.usage?.input_tokens_details,t,o.data.length)}))}}}}let h=await Dh({provider:`openai`,providerOptions:s,schema:Dv})??{},{value:g,responseHeaders:_}=await zg({url:this.config.url({path:`/images/generations`,modelId:this.modelId}),headers:Up((f=this.config).headers?.call(f),c),body:{model:this.modelId,prompt:e,n:r,size:i,quality:h.quality,style:h.style,background:h.background,moderation:h.moderation,output_format:h.outputFormat,output_compression:h.outputCompression,user:h.user,...v_(this.modelId)?{}:{response_format:`b64_json`}},failedResponseHandler:cv,successfulResponseHandler:Kg(Cv),abortSignal:l,fetch:this.config.fetch});return{images:g.data.map(e=>e.b64_json),warnings:p,usage:g.usage==null?void 0:{inputTokens:g.usage.input_tokens??void 0,outputTokens:g.usage.output_tokens??void 0,totalTokens:g.usage.total_tokens??void 0},response:{timestamp:m,modelId:this.modelId,headers:_},providerMetadata:{openai:{images:g.data.map((e,t)=>({...e.revised_prompt?{revisedPrompt:e.revised_prompt}:{},created:g.created??void 0,size:g.size??void 0,quality:g.quality??void 0,background:g.background??void 0,outputFormat:g.output_format??void 0,...y_(g.usage?.input_tokens_details,t,g.data.length)}))}}}}},Av=K(()=>q(z({callId:I(),operation:fu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}))),jv=K(()=>q(z({status:V([`completed`,`failed`]),output:I().optional()}))),Mv=Ah({id:`openai.apply_patch`,inputSchema:Av,outputSchema:jv}),Nv=K(()=>q(z({code:I().nullish(),containerId:I()}))),Pv=K(()=>q(z({outputs:R(fu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullish()}))),Fv=K(()=>q(z({container:B([I(),z({fileIds:R(I()).optional()})]).optional()}))),Iv=jh({id:`openai.code_interpreter`,inputSchema:Nv,outputSchema:Pv}),Lv=(e={})=>Iv(e),Rv=K(()=>q(z({description:I().optional(),format:B([z({type:H(`grammar`),syntax:V([`regex`,`lark`]),definition:I()}),z({type:H(`text`)})]).optional()}))),zv=kh({id:`openai.custom`,inputSchema:K(()=>q(I()))}),Bv=e=>zv(e),Vv=z({key:I(),type:V([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`]),value:B([I(),L(),ou(),R(I())])}),Hv=z({type:V([`and`,`or`]),filters:R(B([Vv,Tu(()=>Hv)]))}),Uv=K(()=>q(z({vectorStoreIds:R(I()),maxNumResults:L().optional(),ranking:z({ranker:I().optional(),scoreThreshold:L().optional()}).optional(),filters:B([Vv,Hv]).optional()}))),Wv=K(()=>q(z({queries:R(I()),results:R(z({attributes:hu(I(),lu()),fileId:I(),filename:I(),score:L(),text:I()})).nullable()}))),Gv=jh({id:`openai.file_search`,inputSchema:z({}),outputSchema:Wv}),Kv=K(()=>q(z({background:V([`auto`,`opaque`,`transparent`]).optional(),inputFidelity:V([`low`,`high`]).optional(),inputImageMask:z({fileId:I().optional(),imageUrl:I().optional()}).optional(),model:I().optional(),moderation:V([`auto`]).optional(),outputCompression:L().int().min(0).max(100).optional(),outputFormat:V([`png`,`jpeg`,`webp`]).optional(),partialImages:L().int().min(0).max(3).optional(),quality:V([`auto`,`low`,`medium`,`high`]).optional(),size:V([`1024x1024`,`1024x1536`,`1536x1024`,`auto`]).optional()}).strict())),qv=jh({id:`openai.image_generation`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({result:I()})))}),Jv=(e={})=>qv(e),Yv=K(()=>q(z({action:z({type:H(`exec`),command:R(I()),timeoutMs:L().optional(),user:I().optional(),workingDirectory:I().optional(),env:hu(I(),I()).optional()})}))),Xv=K(()=>q(z({output:I()}))),Zv=Ah({id:`openai.local_shell`,inputSchema:Yv,outputSchema:Xv}),Qv=K(()=>q(z({action:z({commands:R(I()),timeoutMs:L().optional(),maxOutputLength:L().optional()})}))),$v=K(()=>q(z({output:R(z({stdout:I(),stderr:I(),outcome:fu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exitCode:L()})])}))}))),ey=R(fu(`type`,[z({type:H(`skillReference`),providerReference:hu(I(),I()),version:I().optional()}),z({type:H(`inline`),name:I(),description:I(),source:z({type:H(`base64`),mediaType:H(`application/zip`),data:I()})})])).optional(),ty=K(()=>q(z({environment:B([z({type:H(`containerAuto`),fileIds:R(I()).optional(),memoryLimit:V([`1g`,`4g`,`16g`,`64g`]).optional(),networkPolicy:fu(`type`,[z({type:H(`disabled`)}),z({type:H(`allowlist`),allowedDomains:R(I()),domainSecrets:R(z({domain:I(),name:I(),value:I()})).optional()})]).optional(),skills:ey}),z({type:H(`containerReference`),containerId:I()}),z({type:H(`local`).optional(),skills:R(z({name:I(),description:I(),path:I()})).optional()})]).optional()}))),ny=Ah({id:`openai.shell`,inputSchema:Qv,outputSchema:$v}),ry=K(()=>q(z({execution:V([`server`,`client`]).optional(),description:I().optional(),parameters:hu(I(),lu()).optional()}))),iy=K(()=>q(z({arguments:lu().optional(),call_id:I().nullish()}))),ay=K(()=>q(z({tools:R(hu(I(),lu()))}))),oy=Ah({id:`openai.tool_search`,inputSchema:iy,outputSchema:ay}),sy=(e={})=>oy(e),cy=K(()=>q(z({externalWebAccess:ou().optional(),filters:z({allowedDomains:R(I()).optional()}).optional(),searchContextSize:V([`low`,`medium`,`high`]).optional(),userLocation:z({type:H(`approximate`),country:I().optional(),city:I().optional(),region:I().optional(),timezone:I().optional()}).optional()}))),ly=jh({id:`openai.web_search`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({action:fu(`type`,[z({type:H(`search`),query:I().optional(),queries:R(I()).optional()}),z({type:H(`openPage`),url:I().nullish()}),z({type:H(`findInPage`),url:I().nullish(),pattern:I().nullish()})]).optional(),sources:R(fu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).optional()})))}),uy=(e={})=>ly(e),dy=K(()=>q(z({searchContextSize:V([`low`,`medium`,`high`]).optional(),userLocation:z({type:H(`approximate`),country:I().optional(),city:I().optional(),region:I().optional(),timezone:I().optional()}).optional()}))),fy=jh({id:`openai.web_search_preview`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({action:fu(`type`,[z({type:H(`search`),query:I().optional()}),z({type:H(`openPage`),url:I().nullish()}),z({type:H(`findInPage`),url:I().nullish(),pattern:I().nullish()})]).optional()})))}),py=Tu(()=>B([I(),L(),ou(),su(),R(py),hu(I(),py)])),my=K(()=>q(z({serverLabel:I(),allowedTools:B([R(I()),z({readOnly:ou().optional(),toolNames:R(I()).optional()})]).optional(),authorization:I().optional(),connectorId:I().optional(),headers:hu(I(),I()).optional(),requireApproval:B([V([`always`,`never`]),z({never:z({toolNames:R(I()).optional()}).optional()})]).optional(),serverDescription:I().optional(),serverUrl:I().optional()}).refine(e=>e.serverUrl!=null||e.connectorId!=null,`One of serverUrl or connectorId must be provided.`))),hy=jh({id:`openai.mcp`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({type:H(`call`),serverLabel:I(),name:I(),arguments:I(),output:I().nullish(),error:B([I(),py]).optional()})))}),gy=e=>hy(e),_y={applyPatch:Mv,customTool:Bv,codeInterpreter:Lv,fileSearch:Gv,imageGeneration:Jv,localShell:Zv,shell:ny,webSearchPreview:fy,webSearch:uy,mcp:gy,toolSearch:sy},vy=class{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.provider=t.provider,this.config=t}async doCreateClientSecret(e){let t=this.config.fetch??fetch,n=`${this.config.baseURL}/realtime/client_secrets`,r=e.sessionConfig==null?{type:`realtime`,model:this.modelId}:C_(e.sessionConfig,this.modelId),i=await t(n,{method:`POST`,headers:{...this.config.headers(),"Content-Type":`application/json`},body:JSON.stringify({session:r,...e.expiresAfterSeconds==null?{}:{expires_after:{anchor:`created_at`,seconds:e.expiresAfterSeconds}}})});if(!i.ok){let e=await i.text();throw Error(`OpenAI realtime client secret request failed: ${i.status} ${e}`)}let a=await i.json();return{token:a.value,url:`wss://${new URL(this.config.baseURL).host}/v1/realtime?model=${encodeURIComponent(this.modelId)}`,expiresAt:a.expires_at}}getWebSocketConfig(e){return{url:e.url,protocols:[`realtime`,`openai-insecure-api-key.${e.token}`]}}parseServerEvent(e){return x_(e)}serializeClientEvent(e){return S_(e,this.modelId)}buildSessionConfig(e){return C_(e,this.modelId)}},yy=z({itemId:I().nullish(),reasoningEncryptedContent:I().nullish()}),by=Tu(()=>B([I(),L(),ou(),su(),R(by),hu(I(),by.optional())])),xy=z({type:H(`error`),sequence_number:L(),error:z({type:I(),code:I(),message:I(),param:I().nullish()})}),Sy=z({type:H(`error`),sequence_number:L(),code:I().nullish(),message:I(),param:I().nullish()}),Cy=K(()=>q(B([z({type:H(`response.output_text.delta`),item_id:I(),delta:I(),logprobs:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}),z({type:V([`response.completed`,`response.incomplete`]),response:z({incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}),reasoning:z({context:I().nullish()}).nullish(),service_tier:I().nullish()})}),z({type:H(`response.failed`),sequence_number:L(),response:z({error:z({code:I().nullish(),message:I()}).nullish(),incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}).nullish(),reasoning:z({context:I().nullish()}).nullish(),service_tier:I().nullish()})}),z({type:H(`response.created`),response:z({id:I(),created_at:L(),model:I(),service_tier:I().nullish()})}),z({type:H(`response.output_item.added`),output_index:L(),item:fu(`type`,[z({type:H(`message`),id:I(),phase:V([`commentary`,`final_answer`]).nullish()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish()}),z({type:H(`function_call`),id:I(),call_id:I(),name:I(),arguments:I(),namespace:I().nullish()}),z({type:H(`web_search_call`),id:I(),status:I()}),z({type:H(`computer_call`),id:I(),status:I()}),z({type:H(`file_search_call`),id:I()}),z({type:H(`image_generation_call`),id:I()}),z({type:H(`code_interpreter_call`),id:I(),container_id:I(),code:I().nullable(),outputs:R(fu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable(),status:I()}),z({type:H(`mcp_call`),id:I(),status:I(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I()}),z({type:H(`mcp_approval_request`),id:I()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:fu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`custom_tool_call`),id:I(),call_id:I(),name:I(),input:I()}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I().nullish()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:fu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:lu()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(hu(I(),by.optional()))})])}),z({type:H(`response.output_item.done`),output_index:L(),item:fu(`type`,[z({type:H(`message`),id:I(),phase:V([`commentary`,`final_answer`]).nullish()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish()}),z({type:H(`function_call`),id:I(),call_id:I(),name:I(),arguments:I(),status:H(`completed`),namespace:I().nullish()}),z({type:H(`custom_tool_call`),id:I(),call_id:I(),name:I(),input:I(),status:H(`completed`)}),z({type:H(`code_interpreter_call`),id:I(),code:I().nullable(),container_id:I(),outputs:R(fu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable()}),z({type:H(`image_generation_call`),id:I(),result:I()}),z({type:H(`web_search_call`),id:I(),status:I(),action:fu(`type`,[z({type:H(`search`),query:I().nullish(),queries:R(I()).nullish(),sources:R(fu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).nullish()}),z({type:H(`open_page`),url:I().nullish()}),z({type:H(`find_in_page`),url:I().nullish(),pattern:I().nullish()})]).nullish()}),z({type:H(`file_search_call`),id:I(),queries:R(I()),results:R(z({attributes:hu(I(),B([I(),L(),ou()])),file_id:I(),filename:I(),score:L(),text:I()})).nullish()}),z({type:H(`local_shell_call`),id:I(),call_id:I(),action:z({type:H(`exec`),command:R(I()),timeout_ms:L().optional(),user:I().optional(),working_directory:I().optional(),env:hu(I(),I()).optional()})}),z({type:H(`computer_call`),id:I(),status:H(`completed`)}),z({type:H(`mcp_call`),id:I(),status:I(),arguments:I(),name:I(),server_label:I(),output:I().nullish(),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).nullish(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I(),server_label:I(),tools:R(z({name:I(),description:I().optional(),input_schema:cu(),annotations:hu(I(),lu()).optional()})),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).optional()}),z({type:H(`mcp_approval_request`),id:I(),server_label:I(),name:I(),arguments:I(),approval_request_id:I().optional()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:fu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:fu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:lu()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(hu(I(),by.optional()))})])}),z({type:H(`response.function_call_arguments.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.custom_tool_call_input.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.image_generation_call.partial_image`),item_id:I(),output_index:L(),partial_image_b64:I()}),z({type:H(`response.code_interpreter_call_code.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.code_interpreter_call_code.done`),item_id:I(),output_index:L(),code:I()}),z({type:H(`response.output_text.annotation.added`),annotation:fu(`type`,[z({type:H(`url_citation`),start_index:L(),end_index:L(),url:I(),title:I()}),z({type:H(`file_citation`),file_id:I(),filename:I(),index:L()}),z({type:H(`container_file_citation`),container_id:I(),file_id:I(),filename:I(),start_index:L(),end_index:L()}),z({type:H(`file_path`),file_id:I(),index:L()})])}),z({type:H(`response.reasoning_summary_part.added`),item_id:I(),summary_index:L()}),z({type:H(`response.reasoning_summary_text.delta`),item_id:I(),summary_index:L(),delta:I()}),z({type:H(`response.reasoning_summary_part.done`),item_id:I(),summary_index:L()}),z({type:H(`response.apply_patch_call_operation_diff.delta`),item_id:I(),output_index:L(),delta:I(),obfuscation:I().nullish()}),z({type:H(`response.apply_patch_call_operation_diff.done`),item_id:I(),output_index:L(),diff:I()}),xy,Sy,z({type:I()}).loose().transform(e=>({type:`unknown_chunk`,message:e.type}))]))),wy=K(()=>q(z({id:I().optional(),created_at:L().optional(),error:z({message:I(),type:I(),param:I().nullish(),code:I()}).nullish(),model:I().optional(),output:R(fu(`type`,[z({type:H(`message`),role:H(`assistant`),id:I(),phase:V([`commentary`,`final_answer`]).nullish(),content:R(z({type:H(`output_text`),text:I(),logprobs:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish(),annotations:R(fu(`type`,[z({type:H(`url_citation`),start_index:L(),end_index:L(),url:I(),title:I()}),z({type:H(`file_citation`),file_id:I(),filename:I(),index:L()}),z({type:H(`container_file_citation`),container_id:I(),file_id:I(),filename:I(),start_index:L(),end_index:L()}),z({type:H(`file_path`),file_id:I(),index:L()})]))}))}),z({type:H(`web_search_call`),id:I(),status:I(),action:fu(`type`,[z({type:H(`search`),query:I().nullish(),queries:R(I()).nullish(),sources:R(fu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).nullish()}),z({type:H(`open_page`),url:I().nullish()}),z({type:H(`find_in_page`),url:I().nullish(),pattern:I().nullish()})]).nullish()}),z({type:H(`file_search_call`),id:I(),queries:R(I()),results:R(z({attributes:hu(I(),B([I(),L(),ou()])),file_id:I(),filename:I(),score:L(),text:I()})).nullish()}),z({type:H(`code_interpreter_call`),id:I(),code:I().nullable(),container_id:I(),outputs:R(fu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable()}),z({type:H(`image_generation_call`),id:I(),result:I()}),z({type:H(`local_shell_call`),id:I(),call_id:I(),action:z({type:H(`exec`),command:R(I()),timeout_ms:L().optional(),user:I().optional(),working_directory:I().optional(),env:hu(I(),I()).optional()})}),z({type:H(`function_call`),call_id:I(),name:I(),arguments:I(),id:I(),namespace:I().nullish()}),z({type:H(`custom_tool_call`),call_id:I(),name:I(),input:I(),id:I()}),z({type:H(`computer_call`),id:I(),status:I().optional()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish(),summary:R(z({type:H(`summary_text`),text:I()}))}),z({type:H(`mcp_call`),id:I(),status:I(),arguments:I(),name:I(),server_label:I(),output:I().nullish(),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).nullish(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I(),server_label:I(),tools:R(z({name:I(),description:I().optional(),input_schema:cu(),annotations:hu(I(),lu()).optional()})),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).optional()}),z({type:H(`mcp_approval_request`),id:I(),server_label:I(),name:I(),arguments:I(),approval_request_id:I().optional()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:fu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:fu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:lu()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(hu(I(),by.optional()))})])).optional(),service_tier:I().nullish(),reasoning:z({context:I().nullish()}).nullish(),incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}).optional()}))),Ty=20,Ey=K(()=>q(z({conversation:I().nullish(),include:R(V([`reasoning.encrypted_content`,`file_search_call.results`,`web_search_call.results`,`message.output_text.logprobs`])).nullish(),instructions:I().nullish(),logprobs:B([ou(),L().min(1).max(Ty)]).optional(),maxToolCalls:L().nullish(),metadata:cu().nullish(),parallelToolCalls:ou().nullish(),previousResponseId:I().nullish(),promptCacheKey:I().nullish(),promptCacheOptions:z({mode:V([`implicit`,`explicit`]).optional(),ttl:H(`30m`).optional()}).optional(),promptCacheRetention:V([`in_memory`,`24h`]).nullish(),reasoningEffort:I().nullish(),reasoningMode:V([`standard`,`pro`]).optional(),reasoningContext:V([`auto`,`current_turn`,`all_turns`]).optional(),reasoningSummary:I().nullish(),safetyIdentifier:I().nullish(),serviceTier:V([`auto`,`flex`,`priority`,`default`]).nullish(),store:ou().nullish(),passThroughUnsupportedFiles:ou().optional(),strictJsonSchema:ou().nullish(),textVerbosity:V([`low`,`medium`,`high`]).nullish(),truncation:V([`auto`,`disabled`]).nullish(),user:I().nullish(),systemMessageMode:V([`system`,`developer`,`remove`]).optional(),forceReasoning:ou().optional(),contextManagement:R(z({type:H(`compaction`),compactThreshold:L()})).nullish(),allowedTools:z({toolNames:R(I()).min(1),mode:V([`auto`,`required`]).optional()}).optional()}))),Dy=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({maxOutputTokens:e,temperature:t,stopSequences:n,topP:r,topK:i,presencePenalty:a,frequencyPenalty:o,seed:s,prompt:c,reasoning:l,providerOptions:u,tools:d,toolChoice:f,responseFormat:p}){let m=[],h=Zg(this.modelId);i!=null&&m.push({type:`unsupported`,feature:`topK`}),s!=null&&m.push({type:`unsupported`,feature:`seed`}),a!=null&&m.push({type:`unsupported`,feature:`presencePenalty`}),o!=null&&m.push({type:`unsupported`,feature:`frequencyPenalty`}),n!=null&&m.push({type:`unsupported`,feature:`stopSequences`});let g=this.config.provider.includes(`azure`)?`azure`:`openai`,_=await Dh({provider:g,providerOptions:u,schema:Ey});_==null&&g!==`openai`&&(_=await Dh({provider:`openai`,providerOptions:u,schema:Ey}));let v=_?.reasoningEffort??(Em(l)?l:void 0),y=_?.reasoningSummary===void 0?v!=null&&v!==`none`?`detailed`:void 0:_.reasoningSummary,b=_?.forceReasoning??h.isReasoningModel;_?.conversation&&_?.previousResponseId&&m.push({type:`unsupported`,feature:`conversation`,details:`conversation and previousResponseId cannot be used together`});let x=Yp({tools:d,providerToolNames:{"openai.code_interpreter":`code_interpreter`,"openai.file_search":`file_search`,"openai.image_generation":`image_generation`,"openai.local_shell":`local_shell`,"openai.shell":`shell`,"openai.web_search":`web_search`,"openai.web_search_preview":`web_search_preview`,"openai.mcp":`mcp`,"openai.apply_patch":`apply_patch`,"openai.tool_search":`tool_search`}}),S=new Set,{tools:C,toolChoice:w,toolWarnings:T}=await A_({tools:d,toolChoice:f,allowedTools:_?.allowedTools??void 0,toolNameMapping:x,customProviderToolNames:S}),{input:ee,warnings:E}=await O_({prompt:c,toolNameMapping:x,systemMessageMode:_?.systemMessageMode??(b?`developer`:h.systemMessageMode),providerOptionsName:g,fileIdPrefixes:this.config.fileIdPrefixes,passThroughUnsupportedFiles:_?.passThroughUnsupportedFiles??!1,store:_?.store??!0,hasConversation:_?.conversation!=null,hasPreviousResponseId:_?.previousResponseId!=null,hasLocalShellTool:k(`openai.local_shell`),hasShellTool:k(`openai.shell`),hasApplyPatchTool:k(`openai.apply_patch`),customProviderToolNames:S.size>0?S:void 0});m.push(...E);let D=_?.strictJsonSchema??!0,O=_?.include;function te(e){O==null?O=[e]:O.includes(e)||(O=[...O,e])}function k(e){return d?.find(t=>t.type===`provider`&&t.id===e)!=null}let A=typeof _?.logprobs==`number`?_?.logprobs:_?.logprobs===!0?Ty:void 0;A&&te(`message.output_text.logprobs`);let ne=d?.find(e=>e.type===`provider`&&(e.id===`openai.web_search`||e.id===`openai.web_search_preview`))?.name;ne&&te(`web_search_call.action.sources`),k(`openai.code_interpreter`)&&te(`code_interpreter_call.outputs`);let re=_?.store;re===!1&&b&&te(`reasoning.encrypted_content`);let ie={model:this.modelId,input:ee,temperature:t,top_p:r,max_output_tokens:e,...(p?.type===`json`||_?.textVerbosity)&&{text:{...p?.type===`json`&&{format:p.schema==null?{type:`json_object`}:{type:`json_schema`,strict:D,name:p.name??`response`,description:p.description,schema:p.schema}},..._?.textVerbosity&&{verbosity:_.textVerbosity}}},conversation:_?.conversation,max_tool_calls:_?.maxToolCalls,metadata:_?.metadata,parallel_tool_calls:_?.parallelToolCalls,previous_response_id:_?.previousResponseId,store:re,user:_?.user,instructions:_?.instructions,service_tier:_?.serviceTier,include:O,prompt_cache_key:_?.promptCacheKey,prompt_cache_options:_?.promptCacheOptions,prompt_cache_retention:_?.promptCacheRetention,safety_identifier:_?.safetyIdentifier,top_logprobs:A,truncation:_?.truncation,..._?.contextManagement&&{context_management:_.contextManagement.map(e=>({type:e.type,compact_threshold:e.compactThreshold}))},...b&&(v!=null||y!=null||_?.reasoningMode!=null||_?.reasoningContext!=null)&&{reasoning:{...v!=null&&{effort:v},...y!=null&&{summary:y},..._?.reasoningMode!=null&&{mode:_.reasoningMode},..._?.reasoningContext!=null&&{context:_.reasoningContext}}}};b?v===`none`&&h.supportsNonReasoningParameters||(ie.temperature!=null&&(ie.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for reasoning models`})),ie.top_p!=null&&(ie.top_p=void 0,m.push({type:`unsupported`,feature:`topP`,details:`topP is not supported for reasoning models`}))):(_?.reasoningEffort!=null&&m.push({type:`unsupported`,feature:`reasoningEffort`,details:`reasoningEffort is not supported for non-reasoning models`}),_?.reasoningSummary!=null&&m.push({type:`unsupported`,feature:`reasoningSummary`,details:`reasoningSummary is not supported for non-reasoning models`}),_?.reasoningMode!=null&&m.push({type:`unsupported`,feature:`reasoningMode`,details:`reasoningMode is not supported for non-reasoning models`}),_?.reasoningContext!=null&&m.push({type:`unsupported`,feature:`reasoningContext`,details:`reasoningContext is not supported for non-reasoning models`})),_?.serviceTier===`flex`&&!h.supportsFlexProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`flex processing is only available for o3, o4-mini, and gpt-5 models`}),delete ie.service_tier),_?.serviceTier===`priority`&&!h.supportsPriorityProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported`}),delete ie.service_tier);let ae=d?.find(e=>e.type===`provider`&&e.id===`openai.shell`)?.args?.environment?.type,oe=ae===`containerAuto`||ae===`containerReference`;return{webSearchToolName:ne,args:{...ie,tools:C,tool_choice:w},warnings:[...m,...T],store:re,toolNameMapping:x,providerOptionsName:g,isShellProviderExecuted:oe}}async doGenerate(e){var t,n,r,i,a,o;let{args:s,warnings:c,webSearchToolName:l,toolNameMapping:u,providerOptionsName:d,isShellProviderExecuted:f}=await this.getArgs(e),p=this.config.url({path:`/responses`,modelId:this.modelId}),m=P_(e.prompt),{responseHeaders:h,value:g,rawValue:_}=await zg({url:p,headers:Up((t=this.config).headers?.call(t),e.headers),body:s,failedResponseHandler:cv,successfulResponseHandler:Kg(wy),abortSignal:e.abortSignal,fetch:this.config.fetch});if(g.error)throw new $r({message:g.error.message,url:p,requestBodyValues:s,statusCode:400,responseHeaders:h,responseBody:_,isRetryable:!1});let v=[],y=[],b=!1,x=[];for(let t of g.output)switch(t.type){case`reasoning`:t.summary.length===0&&t.summary.push({type:`summary_text`,text:``});for(let e of t.summary)v.push({type:`reasoning`,text:e.text,providerMetadata:{[d]:{itemId:t.id,reasoningEncryptedContent:t.encrypted_content??null}}});break;case`image_generation_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`image_generation`),input:`{}`,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`image_generation`),result:{result:t.result}});break;case`tool_search_call`:{let e=t.call_id??t.id,n=t.execution===`server`;n&&x.push(e),v.push({type:`tool-call`,toolCallId:e,toolName:u.toCustomToolName(`tool_search`),input:JSON.stringify({arguments:t.arguments,call_id:t.call_id}),...n?{providerExecuted:!0}:{},providerMetadata:{[d]:{itemId:t.id}}});break}case`tool_search_output`:{let e=t.call_id??x.shift()??t.id;v.push({type:`tool-result`,toolCallId:e,toolName:u.toCustomToolName(`tool_search`),result:{tools:t.tools},providerMetadata:{[d]:{itemId:t.id}}});break}case`local_shell_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`local_shell`),input:JSON.stringify({action:t.action}),providerMetadata:{[d]:{itemId:t.id}}});break;case`shell_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`shell`),input:JSON.stringify({action:{commands:t.action.commands}}),...f&&{providerExecuted:!0},providerMetadata:{[d]:{itemId:t.id}}});break;case`shell_call_output`:v.push({type:`tool-result`,toolCallId:t.call_id,toolName:u.toCustomToolName(`shell`),result:{output:t.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`exit`?{type:`exit`,exitCode:e.outcome.exit_code}:{type:`timeout`}}))}});break;case`message`:for(let o of t.content){e.providerOptions?.[d]?.logprobs&&o.logprobs&&y.push(o.logprobs);let s={itemId:t.id,...t.phase!=null&&{phase:t.phase},...o.annotations.length>0&&{annotations:o.annotations}};v.push({type:`text`,text:o.text,providerMetadata:{[d]:s}});for(let e of o.annotations)e.type===`url_citation`?v.push({type:`source`,sourceType:`url`,id:(n=this.config).generateId?.call(n)??cg(),url:e.url,title:e.title}):e.type===`file_citation`?v.push({type:`source`,sourceType:`document`,id:(r=this.config).generateId?.call(r)??cg(),mediaType:`text/plain`,title:e.filename,filename:e.filename,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,index:e.index}}}):e.type===`container_file_citation`?v.push({type:`source`,sourceType:`document`,id:(i=this.config).generateId?.call(i)??cg(),mediaType:`text/plain`,title:e.filename,filename:e.filename,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,containerId:e.container_id}}}):e.type===`file_path`&&v.push({type:`source`,sourceType:`document`,id:(a=this.config).generateId?.call(a)??cg(),mediaType:`application/octet-stream`,title:e.file_id,filename:e.file_id,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,index:e.index}}})}break;case`function_call`:b=!0,v.push({type:`tool-call`,toolCallId:t.call_id,toolName:t.name,input:t.arguments,providerMetadata:{[d]:{itemId:t.id,...t.namespace!=null&&{namespace:t.namespace}}}});break;case`custom_tool_call`:{b=!0;let e=u.toCustomToolName(t.name);v.push({type:`tool-call`,toolCallId:t.call_id,toolName:e,input:JSON.stringify(t.input),providerMetadata:{[d]:{itemId:t.id}}});break}case`web_search_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(l??`web_search`),input:JSON.stringify({}),providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(l??`web_search`),result:ev(t.action)});break;case`mcp_call`:{let e=t.approval_request_id==null?t.id:m[t.approval_request_id]??t.id,n=`mcp.${t.name}`;v.push({type:`tool-call`,toolCallId:e,toolName:n,input:t.arguments,providerExecuted:!0,dynamic:!0}),v.push({type:`tool-result`,toolCallId:e,toolName:n,result:{type:`call`,serverLabel:t.server_label,name:t.name,arguments:t.arguments,...t.output==null?{}:{output:t.output},...t.error==null?{}:{error:t.error}},providerMetadata:{[d]:{itemId:t.id}}});break}case`mcp_list_tools`:break;case`mcp_approval_request`:{let e=t.approval_request_id??t.id,n=(o=this.config).generateId?.call(o)??cg(),r=`mcp.${t.name}`;v.push({type:`tool-call`,toolCallId:n,toolName:r,input:t.arguments,providerExecuted:!0,dynamic:!0}),v.push({type:`tool-approval-request`,approvalId:e,toolCallId:n});break}case`computer_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`computer_use`),input:``,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`computer_use`),result:{type:`computer_use_tool_result`,status:t.status||`completed`}});break;case`file_search_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`file_search`),input:`{}`,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`file_search`),result:{queries:t.queries,results:t.results?.map(e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))??null}});break;case`code_interpreter_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`code_interpreter`),input:JSON.stringify({code:t.code,containerId:t.container_id}),providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`code_interpreter`),result:{outputs:t.outputs}});break;case`apply_patch_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`apply_patch`),input:JSON.stringify({callId:t.call_id,operation:t.operation}),providerMetadata:{[d]:{itemId:t.id}}});break;case`compaction`:v.push({type:`custom`,kind:`openai.compaction`,providerMetadata:{[d]:{type:`compaction`,itemId:t.id,encryptedContent:t.encrypted_content}}});break}let S={[d]:{responseId:g.id,...y.length>0?{logprobs:y}:{},...typeof g.service_tier==`string`?{serviceTier:g.service_tier}:{},...g.reasoning?.context==null?{}:{reasoningContext:g.reasoning.context}}},C=g.usage;return{content:v,finishReason:{unified:k_({finishReason:g.incomplete_details?.reason,hasFunctionCall:b}),raw:g.incomplete_details?.reason??void 0},usage:w_(C),request:{body:s},response:{id:g.id,timestamp:new Date(g.created_at*1e3),modelId:g.model,headers:h,body:_},providerMetadata:S,warnings:c}}async doStream(e){var t;let{args:n,warnings:r,webSearchToolName:i,toolNameMapping:a,store:o,providerOptionsName:s,isShellProviderExecuted:c}=await this.getArgs(e),l=this.config.url({path:`/responses`,modelId:this.modelId}),{responseHeaders:u,value:d}=await zg({url:l,headers:Up((t=this.config).headers?.call(t),e.headers),body:{...n,stream:!0},failedResponseHandler:cv,successfulResponseHandler:Gg(Cy),abortSignal:e.abortSignal,fetch:this.config.fetch}),f=await Qg({stream:d,getError:e=>Q_(e)||V_(e)&&e.response.error!=null?e:void 0,isOutputChunk:$_,url:l,requestBodyValues:n,responseHeaders:u}),p=this,m=P_(e.prompt),h=new Map,g={unified:`other`,raw:void 0},_,v=[],y=null,b={},x=[],S,C=!1,w={},T,ee,E=[],D=!1;return{stream:f.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:r})},transform(t,r){var d,f,O,te,k;if(e.includeRawChunks&&r.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){let e=I_(t.rawValue)?L_({value:t.rawValue,cause:t.error,url:l,requestBodyValues:n,responseHeaders:u}):t.error;g={unified:`error`,raw:void 0},r.enqueue({type:`error`,error:e});return}let A=t.value;if(X_(A)){if(A.item.type===`function_call`)b[A.output_index]={toolName:A.item.name,toolCallId:A.item.call_id},r.enqueue({type:`tool-input-start`,id:A.item.call_id,toolName:A.item.name});else if(A.item.type===`custom_tool_call`){let e=a.toCustomToolName(A.item.name);b[A.output_index]={toolName:e,toolCallId:A.item.call_id},r.enqueue({type:`tool-input-start`,id:A.item.call_id,toolName:e})}else if(A.item.type===`web_search_call`)b[A.output_index]={toolName:a.toCustomToolName(i??`web_search`),toolCallId:A.item.id},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(i??`web_search`),providerExecuted:!0}),r.enqueue({type:`tool-input-end`,id:A.item.id}),r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(i??`web_search`),input:JSON.stringify({}),providerExecuted:!0});else if(A.item.type===`computer_call`)b[A.output_index]={toolName:a.toCustomToolName(`computer_use`),toolCallId:A.item.id},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(`computer_use`),providerExecuted:!0});else if(A.item.type===`code_interpreter_call`)b[A.output_index]={toolName:a.toCustomToolName(`code_interpreter`),toolCallId:A.item.id,codeInterpreter:{containerId:A.item.container_id}},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(`code_interpreter`),providerExecuted:!0}),r.enqueue({type:`tool-input-delta`,id:A.item.id,delta:`{"containerId":"${A.item.container_id}","code":"`});else if(A.item.type===`file_search_call`)r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`file_search`),input:`{}`,providerExecuted:!0});else if(A.item.type===`image_generation_call`)r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`image_generation`),input:`{}`,providerExecuted:!0});else if(A.item.type===`tool_search_call`){let e=A.item.id,t=a.toCustomToolName(`tool_search`),n=A.item.execution===`server`;b[A.output_index]={toolName:t,toolCallId:e,toolSearchExecution:A.item.execution??`server`},n&&r.enqueue({type:`tool-input-start`,id:e,toolName:t,providerExecuted:!0})}else if(A.item.type!==`tool_search_output`&&!(A.item.type===`mcp_call`||A.item.type===`mcp_list_tools`||A.item.type===`mcp_approval_request`))if(A.item.type===`apply_patch_call`){let{call_id:e,operation:t}=A.item;if(b[A.output_index]={toolName:a.toCustomToolName(`apply_patch`),toolCallId:e,applyPatch:{hasDiff:t.type===`delete_file`,endEmitted:t.type===`delete_file`}},r.enqueue({type:`tool-input-start`,id:e,toolName:a.toCustomToolName(`apply_patch`)}),t.type===`delete_file`){let n=JSON.stringify({callId:e,operation:t});r.enqueue({type:`tool-input-delta`,id:e,delta:n}),r.enqueue({type:`tool-input-end`,id:e})}else r.enqueue({type:`tool-input-delta`,id:e,delta:`{"callId":"${tv(e)}","operation":{"type":"${tv(t.type)}","path":"${tv(t.path)}","diff":"`})}else A.item.type===`shell_call`?b[A.output_index]={toolName:a.toCustomToolName(`shell`),toolCallId:A.item.call_id}:A.item.type===`shell_call_output`||(A.item.type===`message`?(x.splice(0,x.length),S=A.item.phase??void 0,r.enqueue({type:`text-start`,id:A.item.id,providerMetadata:{[s]:{itemId:A.item.id,...A.item.phase!=null&&{phase:A.item.phase}}}})):X_(A)&&A.item.type===`reasoning`&&(w[A.item.id]={encryptedContent:A.item.encrypted_content,summaryParts:{0:`active`}},r.enqueue({type:`reasoning-start`,id:`${A.item.id}:0`,providerMetadata:{[s]:{itemId:A.item.id,reasoningEncryptedContent:A.item.encrypted_content??null}}})))}else if(z_(A))if(A.item.type===`message`){let e=A.item.phase??S;S=void 0,r.enqueue({type:`text-end`,id:A.item.id,providerMetadata:{[s]:{itemId:A.item.id,...e!=null&&{phase:e},...x.length>0&&{annotations:x}}}})}else if(A.item.type===`function_call`)b[A.output_index]=void 0,C=!0,r.enqueue({type:`tool-input-end`,id:A.item.call_id,...A.item.namespace!=null&&{providerMetadata:{[s]:{namespace:A.item.namespace}}}}),r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:A.item.name,input:A.item.arguments,providerMetadata:{[s]:{itemId:A.item.id,...A.item.namespace!=null&&{namespace:A.item.namespace}}}});else if(A.item.type===`custom_tool_call`){b[A.output_index]=void 0,C=!0;let e=a.toCustomToolName(A.item.name);r.enqueue({type:`tool-input-end`,id:A.item.call_id}),r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:e,input:JSON.stringify(A.item.input),providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`web_search_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(i??`web_search`),result:ev(A.item.action)});else if(A.item.type===`computer_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-input-end`,id:A.item.id}),r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`computer_use`),input:``,providerExecuted:!0}),r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`computer_use`),result:{type:`computer_use_tool_result`,status:A.item.status||`completed`}});else if(A.item.type===`file_search_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`file_search`),result:{queries:A.item.queries,results:A.item.results?.map(e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))??null}});else if(A.item.type===`code_interpreter_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`code_interpreter`),result:{outputs:A.item.outputs}});else if(A.item.type===`image_generation_call`)r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`image_generation`),result:{result:A.item.result}});else if(A.item.type===`tool_search_call`){let e=b[A.output_index],t=A.item.execution===`server`;if(e!=null){let n=t?e.toolCallId:A.item.call_id??A.item.id;t?E.push(n):r.enqueue({type:`tool-input-start`,id:n,toolName:e.toolName}),r.enqueue({type:`tool-input-end`,id:n}),r.enqueue({type:`tool-call`,toolCallId:n,toolName:e.toolName,input:JSON.stringify({arguments:A.item.arguments,call_id:t?null:n}),...t?{providerExecuted:!0}:{},providerMetadata:{[s]:{itemId:A.item.id}}})}b[A.output_index]=void 0}else if(A.item.type===`tool_search_output`){let e=A.item.call_id??E.shift()??A.item.id;r.enqueue({type:`tool-result`,toolCallId:e,toolName:a.toCustomToolName(`tool_search`),result:{tools:A.item.tools},providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`mcp_call`){b[A.output_index]=void 0;let e=A.item.approval_request_id??void 0,t=e==null?A.item.id:h.get(e)??m[e]??A.item.id,n=`mcp.${A.item.name}`;r.enqueue({type:`tool-call`,toolCallId:t,toolName:n,input:A.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-result`,toolCallId:t,toolName:n,result:{type:`call`,serverLabel:A.item.server_label,name:A.item.name,arguments:A.item.arguments,...A.item.output==null?{}:{output:A.item.output},...A.item.error==null?{}:{error:A.item.error}},providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`mcp_list_tools`)b[A.output_index]=void 0;else if(A.item.type===`apply_patch_call`){let e=b[A.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&A.item.operation.type!==`delete_file`&&(e.applyPatch.hasDiff||r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:tv(A.item.operation.diff)}),r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),e.applyPatch.endEmitted=!0),e&&A.item.status===`completed`&&r.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:a.toCustomToolName(`apply_patch`),input:JSON.stringify({callId:A.item.call_id,operation:A.item.operation}),providerMetadata:{[s]:{itemId:A.item.id}}}),b[A.output_index]=void 0}else if(A.item.type===`mcp_approval_request`){b[A.output_index]=void 0;let e=(d=p.config).generateId?.call(d)??cg(),t=A.item.approval_request_id??A.item.id;h.set(t,e);let n=`mcp.${A.item.name}`;r.enqueue({type:`tool-call`,toolCallId:e,toolName:n,input:A.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-approval-request`,approvalId:t,toolCallId:e})}else if(A.item.type===`local_shell_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`local_shell`),input:JSON.stringify({action:{type:`exec`,command:A.item.action.command,timeoutMs:A.item.action.timeout_ms,user:A.item.action.user,workingDirectory:A.item.action.working_directory,env:A.item.action.env}}),providerMetadata:{[s]:{itemId:A.item.id}}});else if(A.item.type===`shell_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`shell`),input:JSON.stringify({action:{commands:A.item.action.commands}}),...c&&{providerExecuted:!0},providerMetadata:{[s]:{itemId:A.item.id}}});else if(A.item.type===`shell_call_output`)r.enqueue({type:`tool-result`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`shell`),result:{output:A.item.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`exit`?{type:`exit`,exitCode:e.outcome.exit_code}:{type:`timeout`}}))}});else if(A.item.type===`reasoning`){let e=w[A.item.id],t=Object.entries(e.summaryParts).filter(([e,t])=>t===`active`||t===`can-conclude`).map(([e])=>e);for(let e of t)r.enqueue({type:`reasoning-end`,id:`${A.item.id}:${e}`,providerMetadata:{[s]:{itemId:A.item.id,reasoningEncryptedContent:A.item.encrypted_content??null}}});delete w[A.item.id]}else A.item.type===`compaction`&&r.enqueue({type:`custom`,kind:`openai.compaction`,providerMetadata:{[s]:{type:`compaction`,itemId:A.item.id,encryptedContent:A.item.encrypted_content}}});else if(U_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:A.delta})}else if(W_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:A.delta})}else if(J_(A)){let e=b[A.output_index];e?.applyPatch&&(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:tv(A.delta)}),e.applyPatch.hasDiff=!0)}else if(Y_(A)){let e=b[A.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&(e.applyPatch.hasDiff||(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:tv(A.diff)}),e.applyPatch.hasDiff=!0),r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),e.applyPatch.endEmitted=!0)}else if(G_(A))r.enqueue({type:`tool-result`,toolCallId:A.item_id,toolName:a.toCustomToolName(`image_generation`),result:{result:A.partial_image_b64},preliminary:!0});else if(K_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:tv(A.delta)})}else if(q_(A)){let e=b[A.output_index];e!=null&&(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),r.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:a.toCustomToolName(`code_interpreter`),input:JSON.stringify({code:A.code,containerId:e.codeInterpreter.containerId}),providerExecuted:!0}))}else if(H_(A))y=A.response.id,r.enqueue({type:`response-metadata`,id:A.response.id,timestamp:new Date(A.response.created_at*1e3),modelId:A.response.model});else if(F_(A))r.enqueue({type:`text-delta`,id:A.item_id,delta:A.delta}),e.providerOptions?.[s]?.logprobs&&A.logprobs&&v.push(A.logprobs);else if(A.type===`response.reasoning_summary_part.added`){if(A.summary_index>0){let e=w[A.item_id];e.summaryParts[A.summary_index]=`active`;for(let t of Object.keys(e.summaryParts))e.summaryParts[t]===`can-conclude`&&(r.enqueue({type:`reasoning-end`,id:`${A.item_id}:${t}`,providerMetadata:{[s]:{itemId:A.item_id}}}),e.summaryParts[t]=`concluded`);r.enqueue({type:`reasoning-start`,id:`${A.item_id}:${A.summary_index}`,providerMetadata:{[s]:{itemId:A.item_id,reasoningEncryptedContent:w[A.item_id]?.encryptedContent??null}}})}}else if(A.type===`response.reasoning_summary_text.delta`)r.enqueue({type:`reasoning-delta`,id:`${A.item_id}:${A.summary_index}`,delta:A.delta,providerMetadata:{[s]:{itemId:A.item_id}}});else if(A.type===`response.reasoning_summary_part.done`)o?(r.enqueue({type:`reasoning-end`,id:`${A.item_id}:${A.summary_index}`,providerMetadata:{[s]:{itemId:A.item_id}}}),w[A.item_id].summaryParts[A.summary_index]=`concluded`):w[A.item_id].summaryParts[A.summary_index]=`can-conclude`;else if(B_(A))g={unified:k_({finishReason:A.response.incomplete_details?.reason,hasFunctionCall:C}),raw:A.response.incomplete_details?.reason??void 0},_=A.response.usage,typeof A.response.service_tier==`string`&&(T=A.response.service_tier),A.response.reasoning?.context!=null&&(ee=A.response.reasoning.context);else if(V_(A)){let e=A.response.incomplete_details?.reason;g={unified:e?k_({finishReason:e,hasFunctionCall:C}):`error`,raw:e??`error`},_=A.response.usage??void 0,A.response.reasoning?.context!=null&&(ee=A.response.reasoning.context),!D&&A.response.error!=null&&(D=!0,r.enqueue({type:`error`,error:{type:`response.failed`,sequence_number:A.sequence_number,response:{error:A.response.error,incomplete_details:A.response.incomplete_details,service_tier:A.response.service_tier}}}))}else Z_(A)?(x.push(A.annotation),A.annotation.type===`url_citation`?r.enqueue({type:`source`,sourceType:`url`,id:(f=p.config).generateId?.call(f)??cg(),url:A.annotation.url,title:A.annotation.title}):A.annotation.type===`file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(O=p.config).generateId?.call(O)??cg(),mediaType:`text/plain`,title:A.annotation.filename,filename:A.annotation.filename,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,index:A.annotation.index}}}):A.annotation.type===`container_file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(te=p.config).generateId?.call(te)??cg(),mediaType:`text/plain`,title:A.annotation.filename,filename:A.annotation.filename,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,containerId:A.annotation.container_id}}}):A.annotation.type===`file_path`&&r.enqueue({type:`source`,sourceType:`document`,id:(k=p.config).generateId?.call(k)??cg(),mediaType:`application/octet-stream`,title:A.annotation.file_id,filename:A.annotation.file_id,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,index:A.annotation.index}}})):Q_(A)&&(D=!0,g={unified:`error`,raw:`error`},r.enqueue({type:`error`,error:A}))},flush(e){let t={[s]:{responseId:y,...v.length>0?{logprobs:v}:{},...T===void 0?{}:{serviceTier:T},...ee===void 0?{}:{reasoningContext:ee}}};e.enqueue({type:`finish`,finishReason:g,usage:w_(_),providerMetadata:t})}})),request:{body:n},response:{headers:u}}}},Oy=K(()=>q(z({instructions:I().nullish(),speed:L().min(.25).max(4).default(1).nullish()}))),ky=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({text:e,voice:t=`alloy`,outputFormat:n=`mp3`,speed:r,instructions:i,language:a,providerOptions:o}){let s=[],c=await Dh({provider:`openai`,providerOptions:o,schema:Oy}),l={model:this.modelId,input:e,voice:t,response_format:`mp3`,speed:r,instructions:i};if(n&&([`mp3`,`opus`,`aac`,`flac`,`wav`,`pcm`].includes(n)?l.response_format=n:s.push({type:`unsupported`,feature:`outputFormat`,details:`Unsupported output format: ${n}. Using mp3 instead.`})),c){let e={};for(let t in e){let n=e[t];n!==void 0&&(l[t]=n)}}return a&&s.push({type:`unsupported`,feature:`language`,details:`OpenAI speech models do not support language selection. Language parameter "${a}" was ignored.`}),{requestBody:l,warnings:s}}async doGenerate(e){var t,n;let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,{requestBody:i,warnings:a}=await this.getArgs(e),{value:o,responseHeaders:s,rawValue:c}=await zg({url:this.config.url({path:`/audio/speech`,modelId:this.modelId}),headers:Up((n=this.config).headers?.call(n),e.headers),body:i,failedResponseHandler:cv,successfulResponseHandler:qg(),abortSignal:e.abortSignal,fetch:this.config.fetch});return{audio:o,warnings:a,request:{body:JSON.stringify(i)},response:{timestamp:r,modelId:this.modelId,headers:s,body:c}}}},Ay=K(()=>q(z({text:I(),language:I().nullish(),duration:L().nullish(),words:R(z({word:I(),start:L(),end:L()})).nullish(),segments:R(z({id:L(),seek:L(),start:L(),end:L(),text:I(),tokens:R(L()),temperature:L(),avg_logprob:L(),compression_ratio:L(),no_speech_prob:L()})).nullish()}))),jy=K(()=>q(z({include:R(I()).optional(),language:I().optional(),prompt:I().optional(),temperature:L().min(0).max(1).default(0).optional(),timestampGranularities:R(V([`word`,`segment`])).default([`segment`]).optional(),streaming:z({delay:V([`minimal`,`low`,`medium`,`high`,`xhigh`]).optional(),include:R(I()).optional()}).optional()}))),My={afrikaans:`af`,arabic:`ar`,armenian:`hy`,azerbaijani:`az`,belarusian:`be`,bosnian:`bs`,bulgarian:`bg`,catalan:`ca`,chinese:`zh`,croatian:`hr`,czech:`cs`,danish:`da`,dutch:`nl`,english:`en`,estonian:`et`,finnish:`fi`,french:`fr`,galician:`gl`,german:`de`,greek:`el`,hebrew:`he`,hindi:`hi`,hungarian:`hu`,icelandic:`is`,indonesian:`id`,italian:`it`,japanese:`ja`,kannada:`kn`,kazakh:`kk`,korean:`ko`,latvian:`lv`,lithuanian:`lt`,macedonian:`mk`,malay:`ms`,marathi:`mr`,maori:`mi`,nepali:`ne`,norwegian:`no`,persian:`fa`,polish:`pl`,portuguese:`pt`,romanian:`ro`,russian:`ru`,serbian:`sr`,slovak:`sk`,slovenian:`sl`,spanish:`es`,swahili:`sw`,swedish:`sv`,tagalog:`tl`,tamil:`ta`,thai:`th`,turkish:`tr`,ukrainian:`uk`,urdu:`ur`,vietnamese:`vi`,welsh:`cy`},Ny=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({audio:e,mediaType:t,providerOptions:n}){let r=[],i=await Dh({provider:`openai`,providerOptions:n,schema:jy}),a=new FormData,o=e instanceof Uint8Array?new Blob([e]):new Blob([Wp(e)]);a.append(`model`,this.modelId);let s=km(t);if(a.append(`file`,new File([o],`audio`,{type:t}),`audio.${s}`),this.modelId===`whisper-1`&&a.append(`response_format`,`verbose_json`),i){let e=[`gpt-4o-transcribe`,`gpt-4o-mini-transcribe`].includes(this.modelId),t={include:i.include,language:i.language,prompt:i.prompt,...this.modelId!==`whisper-1`&&{response_format:e?`json`:`verbose_json`},temperature:i.temperature,timestamp_granularities:i.timestampGranularities};for(let[e,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let t of n)a.append(`${e}[]`,String(t));else a.append(e,String(n))}return{formData:a,warnings:r}}async doGenerate(e){var t,n;if(nv(this.modelId))throw new pa({functionality:`non-streaming transcription with ${this.modelId}`});let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,{formData:i,warnings:a}=await this.getArgs(e),{value:o,responseHeaders:s,rawValue:c}=await Bg({url:this.config.url({path:`/audio/transcriptions`,modelId:this.modelId}),headers:Up((n=this.config).headers?.call(n),e.headers),formData:i,failedResponseHandler:cv,successfulResponseHandler:Kg(Ay),abortSignal:e.abortSignal,fetch:this.config.fetch}),l=o.language!=null&&o.language in My?My[o.language]:void 0;return{text:o.text,segments:o.segments?.map(e=>({text:e.text,startSecond:e.start,endSecond:e.end}))??o.words?.map(e=>({text:e.word,startSecond:e.start,endSecond:e.end}))??[],language:l,durationInSeconds:o.duration??void 0,warnings:a,response:{timestamp:r,modelId:this.modelId,headers:s,body:c}}}async doStream(e){var t,n;if(!nv(this.modelId))throw new pa({functionality:`streaming transcription with ${this.modelId}`});let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,i=await Dh({provider:`openai`,providerOptions:e.providerOptions,schema:jy}),a=[],o=e.providerOptions?.openai??{};for(let e of[`include`,`prompt`,`temperature`,`timestampGranularities`])o[e]!=null&&a.push({type:`unsupported`,feature:`providerOptions.openai.${e}`,details:`OpenAI streaming transcription does not support ${e}.`});let s=Up((n=this.config).headers?.call(n),e.headers),c=iv({modelId:this.modelId,inputAudioFormat:e.inputAudioFormat,providerOptions:i});return{request:{body:c},response:{timestamp:r,modelId:this.modelId},stream:rv({webSocket:this.config.webSocket,url:Vh(this.config.url({path:`/realtime?intent=transcription`,modelId:this.modelId})),headers:s,sessionUpdate:c,language:i?.language,warnings:a,audio:e.audio,abortSignal:e.abortSignal,includeRawChunks:e.includeRawChunks})}}},Py=K(()=>q(z({id:I(),name:I().nullish(),description:I().nullish(),default_version:I().nullish(),latest_version:I().nullish(),created_at:L(),updated_at:L().nullish()}))),Fy=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadSkill(e){let t=[];e.displayTitle!=null&&t.push({type:`unsupported`,feature:`displayTitle`});let n=new FormData;for(let t of e.files){let e=qp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let{value:r}=await Bg({url:this.config.url({path:`/skills`}),headers:Up(this.config.headers()),formData:n,failedResponseHandler:cv,successfulResponseHandler:Kg(Py),fetch:this.config.fetch});return{providerReference:{openai:r.id},...r.name==null?{}:{name:r.name},...r.description==null?{}:{description:r.description},...r.latest_version==null?{}:{latestVersion:r.latest_version},providerMetadata:{openai:{...r.default_version==null?{}:{defaultVersion:r.default_version},...r.created_at==null?{}:{createdAt:r.created_at},...r.updated_at==null?{}:{updatedAt:r.updated_at}}},warnings:t}}},Iy=`4.0.11`,ov()}));function Ry(e){let t=e?.anthropic;return t?.cacheControl??t?.cache_control}async function zy({tools:e,toolChoice:t,disableParallelToolUse:n,cacheControlValidator:r,supportsStructuredOutput:i,supportsStrictTools:a,defaultEagerInputStreaming:o=!1}){e=e?.length?e:void 0;let s=[],c=new Set,l=r||new xb;if(e==null)return{tools:void 0,toolChoice:void 0,toolWarnings:s,betas:c};let u=[];for(let t of e)switch(t.type){case`function`:{let e=l.getCacheControl(t.providerOptions,{type:`tool definition`,canCache:!0}),n=t.providerOptions?.anthropic,r=n?.eagerInputStreaming??o,d=n?.deferLoading,f=n?.allowedCallers;!a&&t.strict!=null&&s.push({type:`unsupported`,feature:`strict`,details:`Tool '${t.name}' has strict: ${t.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`}),u.push({name:t.name,description:t.description,input_schema:t.inputSchema,cache_control:e,...r?{eager_input_streaming:!0}:{},...a===!0&&t.strict!=null?{strict:t.strict}:{},...d==null?{}:{defer_loading:d},...f==null?{}:{allowed_callers:f},...t.inputExamples==null?{}:{input_examples:t.inputExamples.map(e=>e.input)}}),i===!0&&c.add(`structured-outputs-2025-11-13`),(t.inputExamples!=null||f!=null)&&c.add(`advanced-tool-use-2025-11-20`);break}case`provider`:switch(t.id){case`anthropic.code_execution_20250522`:c.add(`code-execution-2025-05-22`),u.push({type:`code_execution_20250522`,name:`code_execution`,cache_control:void 0});break;case`anthropic.code_execution_20250825`:c.add(`code-execution-2025-08-25`),u.push({type:`code_execution_20250825`,name:`code_execution`});break;case`anthropic.code_execution_20260120`:u.push({type:`code_execution_20260120`,name:`code_execution`});break;case`anthropic.computer_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`computer`,type:`computer_20250124`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,cache_control:void 0});break;case`anthropic.computer_20251124`:c.add(`computer-use-2025-11-24`),u.push({name:`computer`,type:`computer_20251124`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,enable_zoom:t.args.enableZoom,cache_control:void 0});break;case`anthropic.computer_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`computer`,type:`computer_20241022`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,cache_control:void 0});break;case`anthropic.text_editor_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`str_replace_editor`,type:`text_editor_20250124`,cache_control:void 0});break;case`anthropic.text_editor_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`str_replace_editor`,type:`text_editor_20241022`,cache_control:void 0});break;case`anthropic.text_editor_20250429`:c.add(`computer-use-2025-01-24`),u.push({name:`str_replace_based_edit_tool`,type:`text_editor_20250429`,cache_control:void 0});break;case`anthropic.text_editor_20250728`:{let e=await Sh({value:t.args,schema:Eb});u.push({name:`str_replace_based_edit_tool`,type:`text_editor_20250728`,max_characters:e.maxCharacters,cache_control:void 0});break}case`anthropic.bash_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`bash`,type:`bash_20250124`,cache_control:void 0});break;case`anthropic.bash_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`bash`,type:`bash_20241022`,cache_control:void 0});break;case`anthropic.memory_20250818`:c.add(`context-management-2025-06-27`),u.push({name:`memory`,type:`memory_20250818`});break;case`anthropic.web_fetch_20250910`:{c.add(`web-fetch-2025-09-10`);let e=await Sh({value:t.args,schema:Vb});u.push({type:`web_fetch_20250910`,name:`web_fetch`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,citations:e.citations,max_content_tokens:e.maxContentTokens,cache_control:void 0});break}case`anthropic.web_fetch_20260209`:{c.add(`code-execution-web-tools-2026-02-09`);let e=await Sh({value:t.args,schema:Lb});u.push({type:`web_fetch_20260209`,name:`web_fetch`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,citations:e.citations,max_content_tokens:e.maxContentTokens,cache_control:void 0});break}case`anthropic.web_search_20250305`:{let e=await Sh({value:t.args,schema:Nb});u.push({type:`web_search_20250305`,name:`web_search`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,user_location:e.userLocation,cache_control:void 0});break}case`anthropic.web_search_20260209`:{c.add(`code-execution-web-tools-2026-02-09`);let e=await Sh({value:t.args,schema:kb});u.push({type:`web_search_20260209`,name:`web_search`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,user_location:e.userLocation,cache_control:void 0});break}case`anthropic.tool_search_regex_20251119`:u.push({type:`tool_search_tool_regex_20251119`,name:`tool_search_tool_regex`});break;case`anthropic.tool_search_bm25_20251119`:u.push({type:`tool_search_tool_bm25_20251119`,name:`tool_search_tool_bm25`});break;case`anthropic.advisor_20260301`:{c.add(`advisor-tool-2026-03-01`);let e=await Sh({value:t.args,schema:Sb});u.push({type:`advisor_20260301`,name:`advisor`,model:e.model,...e.maxUses!==void 0&&{max_uses:e.maxUses},...e.caching!==void 0&&{caching:e.caching}});break}default:s.push({type:`unsupported`,feature:`provider-defined tool ${t.id}`});break}break;default:s.push({type:`unsupported`,feature:`tool ${t}`});break}if(t==null)return{tools:u,toolChoice:n?{type:`auto`,disable_parallel_tool_use:n}:void 0,toolWarnings:s,betas:c};let d=t.type;switch(d){case`auto`:return{tools:u,toolChoice:{type:`auto`,disable_parallel_tool_use:n},toolWarnings:s,betas:c};case`required`:return{tools:u,toolChoice:{type:`any`,disable_parallel_tool_use:n},toolWarnings:s,betas:c};case`none`:return{tools:void 0,toolChoice:void 0,toolWarnings:s,betas:c};case`tool`:return{tools:u,toolChoice:{type:`tool`,name:t.toolName,disable_parallel_tool_use:n},toolWarnings:s,betas:c};default:throw new pa({functionality:`tool choice type: ${d}`})}}function By({usage:e,rawUsage:t}){let n=e.cache_creation_input_tokens??0,r=e.cache_read_input_tokens??0,i,a,o=e.iterations?.some(e=>e.type===`fallback_message`);if(e.iterations&&e.iterations.length>0&&!o){let t=e.iterations.filter(e=>e.type===`compaction`||e.type===`message`);if(t.length>0){let e=t.reduce((e,t)=>({input:e.input+t.input_tokens,output:e.output+t.output_tokens}),{input:0,output:0});i=e.input,a=e.output}else i=e.input_tokens,a=e.output_tokens}else i=e.input_tokens,a=e.output_tokens;return{inputTokens:{total:i+n+r,noCache:i,cacheRead:r,cacheWrite:n},outputTokens:{total:a,text:void 0,reasoning:void 0},raw:t??e}}function Vy(e){return typeof e==`string`?new TextDecoder().decode(Wp(e)):new TextDecoder().decode(e)}function Hy(e){try{if(typeof e==`string`)return Mm(e);if(typeof e==`object`&&e)return e}catch{let t=e?.errorCode;return{errorCode:typeof t==`string`?t:`unavailable`}}return{}}async function Uy({prompt:e,sendReasoning:t,warnings:n,cacheControlValidator:r,toolNameMapping:i}){let a=new Set,o=Wy(e),s=r||new xb,c,l=[];async function u(e){return(await Dh({provider:`anthropic`,providerOptions:e,schema:vb}))?.citations?.enabled??!1}async function d(e){return(await Dh({provider:`anthropic`,providerOptions:e,schema:vb}))?.containerUpload??!1}async function f(e){let t=await Dh({provider:`anthropic`,providerOptions:e,schema:vb});return{title:t?.title,context:t?.context}}for(let e=0;e<o.length;e++){let r=o[e],p=e===o.length-1,m=r.type;switch(m){case`system`:{let e=r.messages.map(({content:e,providerOptions:t})=>({type:`text`,text:e,cache_control:s.getCacheControl(t,{type:`system message`,canCache:!0})}));c==null?c=e:(l.push({role:`system`,content:e}),a.add(`mid-conversation-system-2026-04-07`));break}case`user`:{let e=[];for(let t of r.messages){let{role:r,content:i}=t;switch(r){case`user`:for(let n=0;n<i.length;n++){let r=i[n],o=n===i.length-1,c=s.getCacheControl(r.providerOptions,{type:`user message part`,canCache:!0})??(o?s.getCacheControl(t.providerOptions,{type:`user message`,canCache:!0}):void 0);switch(r.type){case`text`:e.push({type:`text`,text:r.text,cache_control:c});break;case`file`:switch(r.data.type){case`reference`:{let t=Ph({reference:r.data.reference,provider:`anthropic`});a.add(`files-api-2025-04-14`),await d(r.providerOptions)?e.push({type:`container_upload`,file_id:t}):tm(r.mediaType)===`image`?e.push({type:`image`,source:{type:`file`,file_id:t},cache_control:c}):e.push({type:`document`,source:{type:`file`,file_id:t},cache_control:c});break}case`text`:{let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:{type:`text`,media_type:`text/plain`,data:r.data.text},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c});break}case`url`:case`data`:{let t=tm(r.mediaType);if(t===`image`)e.push({type:`image`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`base64`,media_type:Nh({part:r}),data:Kp(r.data.data)},cache_control:c});else if(t===`application`&&(r.data.type===`url`?r.mediaType===`application/pdf`:Nh({part:r})===`application/pdf`)){a.add(`pdfs-2024-09-25`);let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`base64`,media_type:`application/pdf`,data:Kp(r.data.data)},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c})}else if(r.mediaType===`text/plain`){let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`text`,media_type:`text/plain`,data:Vy(r.data.data)},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c})}else throw new pa({functionality:`media type: ${r.mediaType}`});break}}break}}break;case`tool`:for(let r=0;r<i.length;r++){let o=i[r];if(o.type===`tool-approval-response`)continue;let c=o.output,l=`providerOptions`in c?c.providerOptions:c.type===`content`?c.value.find(e=>e.providerOptions!=null)?.providerOptions:void 0,u=r===i.length-1,d=s.getCacheControl(o.providerOptions,{type:`tool result part`,canCache:!0})??s.getCacheControl(l,{type:`tool result output`,canCache:!0})??(u?s.getCacheControl(t.providerOptions,{type:`tool result message`,canCache:!0}):void 0),f;switch(c.type){case`content`:f=c.value.map(e=>{switch(e.type){case`text`:return{type:`text`,text:e.text};case`file`:{let t=tm(e.mediaType);if(e.data.type===`url`)return t===`image`?{type:`image`,source:{type:`url`,url:e.data.url.toString()}}:{type:`document`,source:{type:`url`,url:e.data.url.toString()}};if(e.data.type===`data`){if(t===`image`)return{type:`image`,source:{type:`base64`,media_type:Nh({part:e}),data:Kp(e.data.data)}};if(Nh({part:e})===`application/pdf`)return a.add(`pdfs-2024-09-25`),{type:`document`,source:{type:`base64`,media_type:`application/pdf`,data:Kp(e.data.data)}};n.push({type:`other`,message:`unsupported tool content part type: ${e.type} with media type: ${e.mediaType}`});return}n.push({type:`other`,message:`unsupported tool content part type: ${e.type} with data type: ${e.data.type}`});return}case`custom`:{let t=e.providerOptions?.anthropic;if(t?.type===`tool-reference`)return{type:`tool_reference`,tool_name:t.toolName};n.push({type:`other`,message:`unsupported custom tool content part`});return}default:n.push({type:`other`,message:`unsupported tool content part type: ${e.type}`});return}}).filter(xm);break;case`text`:case`error-text`:f=c.value;break;case`execution-denied`:f=c.reason??`Tool call execution denied.`;break;default:f=JSON.stringify(c.value);break}e.push({type:`tool_result`,tool_use_id:o.toolCallId,content:f,is_error:c.type===`error-text`||c.type===`error-json`||void 0,cache_control:d})}break;default:throw Error(`Unsupported role: ${r}`)}}l.push({role:`user`,content:e});break}case`assistant`:{let e=[],a=new Set;for(let o=0;o<r.messages.length;o++){let c=r.messages[o],l=o===r.messages.length-1,{content:u}=c;for(let r=0;r<u.length;r++){let o=u[r],d=r===u.length-1,f=s.getCacheControl(o.providerOptions,{type:`assistant message part`,canCache:!0})??(d?s.getCacheControl(c.providerOptions,{type:`assistant message`,canCache:!0}):void 0);switch(o.type){case`text`:o.providerOptions?.anthropic?.type===`compaction`?e.push({type:`compaction`,content:o.text,cache_control:f}):e.push({type:`text`,text:p&&l&&d?o.text.trim():o.text,cache_control:f});break;case`reasoning`:if(t){let t=await Dh({provider:`anthropic`,providerOptions:o.providerOptions,schema:_b});t==null?n.push({type:`other`,message:`unsupported reasoning metadata`}):t.signature==null?t.redactedData==null?n.push({type:`other`,message:`unsupported reasoning metadata`}):(s.getCacheControl(o.providerOptions,{type:`redacted thinking block`,canCache:!1}),e.push({type:`redacted_thinking`,data:t.redactedData})):(s.getCacheControl(o.providerOptions,{type:`thinking block`,canCache:!1}),e.push({type:`thinking`,thinking:o.text,signature:t.signature}))}else n.push({type:`other`,message:`sending reasoning content is disabled for this model`});break;case`tool-call`:{if(o.providerExecuted){let t=i.toProviderToolName(o.toolName);if(o.providerOptions?.anthropic?.type===`mcp-tool-use`){a.add(o.toolCallId);let t=o.providerOptions?.anthropic?.serverName;if(t==null||typeof t!=`string`){n.push({type:`other`,message:`mcp tool use server name is required and must be a string`});break}e.push({type:`mcp_tool_use`,id:o.toolCallId,name:o.toolName,input:o.input,server_name:t,cache_control:f})}else if(t===`code_execution`&&o.input!=null&&typeof o.input==`object`&&`type`in o.input&&typeof o.input.type==`string`&&(o.input.type===`bash_code_execution`||o.input.type===`text_editor_code_execution`))e.push({type:`server_tool_use`,id:o.toolCallId,name:o.input.type,input:o.input,cache_control:f});else if(t===`code_execution`&&o.input!=null&&typeof o.input==`object`&&`type`in o.input&&o.input.type===`programmatic-tool-call`){let{type:t,...n}=o.input;e.push({type:`server_tool_use`,id:o.toolCallId,name:`code_execution`,input:n,cache_control:f})}else t===`code_execution`||t===`web_fetch`||t===`web_search`||t===`tool_search_tool_regex`||t===`tool_search_tool_bm25`?e.push({type:`server_tool_use`,id:o.toolCallId,name:t,input:o.input,cache_control:f}):t===`advisor`?e.push({type:`server_tool_use`,id:o.toolCallId,name:`advisor`,input:{},cache_control:f}):n.push({type:`other`,message:`provider executed tool call for tool ${o.toolName} is not supported`});break}let t=o.providerOptions?.anthropic,r=t?.caller?(t.caller.type===`code_execution_20250825`||t.caller.type===`code_execution_20260120`)&&t.caller.toolId?{type:t.caller.type,tool_id:t.caller.toolId}:t.caller.type===`direct`?{type:`direct`}:void 0:void 0;e.push({type:`tool_use`,id:o.toolCallId,name:o.toolName,input:Ky(o.input),...r&&{caller:r},cache_control:f});break}case`tool-result`:{let t=i.toProviderToolName(o.toolName);if(a.has(o.toolCallId)){let t=o.output;if(t.type!==`json`&&t.type!==`error-json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}e.push({type:`mcp_tool_result`,tool_use_id:o.toolCallId,is_error:t.type===`error-json`,content:t.value,cache_control:f})}else if(t===`code_execution`){let t=o.output;if(t.type===`error-text`||t.type===`error-json`){let n={};try{typeof t.value==`string`?n=Mm(t.value):typeof t.value==`object`&&t.value!==null&&(n=t.value)}catch{}n.type===`code_execution_tool_result_error`?e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:`code_execution_tool_result_error`,error_code:n.errorCode??`unknown`},cache_control:f}):e.push({type:`bash_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:{type:`bash_code_execution_tool_result_error`,error_code:n.errorCode??`unknown`}});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}if(t.value==null||typeof t.value!=`object`||!(`type`in t.value)||typeof t.value.type!=`string`){n.push({type:`other`,message:`provider executed tool result output value is not a valid code execution result for tool ${o.toolName}`});break}if(t.value.type===`code_execution_result`){let n=await Sh({value:t.value,schema:Gb});e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,stdout:n.stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f})}else if(t.value.type===`encrypted_code_execution_result`){let n=await Sh({value:t.value,schema:Zb});n.type===`encrypted_code_execution_result`&&e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,encrypted_stdout:n.encrypted_stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f})}else{let n=await Sh({value:t.value,schema:Jb});n.type===`code_execution_result`?e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,stdout:n.stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f}):n.type===`bash_code_execution_result`||n.type===`bash_code_execution_tool_result_error`?e.push({type:`bash_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:n}):e.push({type:`text_editor_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:n})}break}if(t===`web_fetch`){let t=o.output;if(t.type===`error-json`){e.push({type:`web_fetch_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_fetch_tool_result_error`,error_code:Hy(t.value).errorCode??`unavailable`},cache_control:f});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await Sh({value:t.value,schema:Hb});e.push({type:`web_fetch_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_fetch_result`,url:r.url,retrieved_at:r.retrievedAt,content:{type:`document`,title:r.content.title,citations:r.content.citations,source:{type:r.content.source.type,media_type:r.content.source.mediaType,data:r.content.source.data}}},cache_control:f});break}if(t===`web_search`){let t=o.output;if(t.type===`error-json`){e.push({type:`web_search_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_search_tool_result_error`,error_code:Hy(t.value).errorCode??`unavailable`},cache_control:f});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await Sh({value:t.value,schema:Pb});e.push({type:`web_search_tool_result`,tool_use_id:o.toolCallId,content:r.map(e=>({url:e.url,title:e.title,page_age:e.pageAge,encrypted_content:e.encryptedContent,type:e.type})),cache_control:f});break}if(t===`tool_search_tool_regex`||t===`tool_search_tool_bm25`){let t=o.output;if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=(await Sh({value:t.value,schema:ex})).map(e=>({type:`tool_reference`,tool_name:e.toolName}));e.push({type:`tool_search_tool_result`,tool_use_id:o.toolCallId,content:{type:`tool_search_tool_search_result`,tool_references:r},cache_control:f});break}if(t===`advisor`){let t=o.output;if(t.type!==`json`&&t.type!==`error-json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await Sh({value:t.value,schema:Cb});r.type===`advisor_result`?e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_result`,text:r.text},cache_control:f}):r.type===`advisor_redacted_result`?e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_redacted_result`,encrypted_content:r.encryptedContent},cache_control:f}):e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_tool_result_error`,error_code:r.errorCode},cache_control:f});break}n.push({type:`other`,message:`provider executed tool result for tool ${o.toolName} is not supported`});break}}}}l.push({role:`assistant`,content:Gy(e)});break}default:throw Error(`content type: ${m}`)}}return{prompt:{system:c,messages:l},betas:a}}function Wy(e){let t=[],n;for(let r of e){let{role:e}=r;switch(e){case`system`:n?.type!==`system`&&(n={type:`system`,messages:[]},t.push(n)),n.messages.push(r);break;case`assistant`:n?.type!==`assistant`&&(n={type:`assistant`,messages:[]},t.push(n)),n.messages.push(r);break;case`user`:n?.type!==`user`&&(n={type:`user`,messages:[]},t.push(n)),n.messages.push(r);break;case`tool`:n?.type!==`user`&&(n={type:`user`,messages:[]},t.push(n)),n.messages.push(r);break;default:throw Error(`Unsupported role: ${e}`)}}return t}function Gy(e){let t=[],n=[];function r(){t.push(...n.filter(e=>e.type!==`tool_use`),...n.filter(e=>e.type===`tool_use`)),n=[]}for(let i of e)i.type===`thinking`||i.type===`redacted_thinking`?(r(),t.push(i)):n.push(i);return r(),t}function Ky(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{rawInvalidInput:e}}function qy({finishReason:e,isJsonResponseFromTool:t}){switch(e){case`pause_turn`:case`end_turn`:case`stop_sequence`:return`stop`;case`refusal`:return`content-filter`;case`tool_use`:return t?`stop`:`tool-calls`;case`max_tokens`:case`model_context_window_exceeded`:return`length`;case`compaction`:return`other`;default:return`other`}}function Jy(e){return Xy(e)}function Yy(e){return typeof e==`boolean`||!eb(e)?e:Xy(e)}function Xy(e){let t={},n=e;if(e.$ref!=null)return{$ref:e.$ref};if(e.$schema!=null&&(t.$schema=e.$schema),e.$id!=null&&(t.$id=e.$id),e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description),e.default!==void 0&&(t.default=e.default),e.const!==void 0&&(t.const=e.const),e.enum!=null&&(t.enum=e.enum),e.type!=null&&(t.type=e.type),e.anyOf==null?e.oneOf!=null&&(t.anyOf=e.oneOf.map(Yy)):t.anyOf=e.anyOf.map(Yy),e.allOf!=null&&(t.allOf=e.allOf.map(Yy)),e.definitions!=null&&(t.definitions=Object.fromEntries(Object.entries(e.definitions).map(([e,t])=>[e,Yy(t)]))),n.$defs!=null){let e=t;e.$defs=Object.fromEntries(Object.entries(n.$defs).map(([e,t])=>[e,Yy(t)]))}(e.type===`object`||e.properties!=null)&&(e.properties!=null&&(t.properties=Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,Yy(t)]))),t.additionalProperties=!1,e.required!=null&&(t.required=e.required)),e.items!=null&&(t.items=Array.isArray(e.items)?e.items.map(Yy):Yy(e.items)),typeof e.format==`string`&&rx.has(e.format)&&(t.format=e.format);let r=Zy(e);return r!=null&&(t.description=t.description==null?r:`${t.description}
|
|
54
|
-
${r}`),t}function Zy(e){let t=ix.flatMap(t=>{let n=e[t];return n==null||n===!1?[]:`${Qy(t)}: ${$y(n)}`});return typeof e.format==`string`&&!rx.has(e.format)&&t.push(`format: ${e.format}`),t.length===0?void 0:`${t.join(`; `)}.`}function Qy(e){return e.replace(/[A-Z]/g,e=>` ${e.toLowerCase()}`)}function $y(e){return typeof e==`string`?e:JSON.stringify(e)}function eb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tb(e,t,n){if(e.type===`web_search_result_location`)return{type:`source`,sourceType:`url`,id:n(),url:e.url,title:e.title,providerMetadata:{anthropic:{citedText:e.cited_text,encryptedIndex:e.encrypted_index}}};if(e.type!==`page_location`&&e.type!==`char_location`)return;let r=t[e.document_index];if(r)return{type:`source`,sourceType:`document`,id:n(),mediaType:r.mediaType,title:e.document_title??r.title,filename:r.filename,providerMetadata:{anthropic:e.type===`page_location`?{citedText:e.cited_text,startPageNumber:e.start_page_number,endPageNumber:e.end_page_number}:{citedText:e.cited_text,startCharIndex:e.start_char_index,endCharIndex:e.end_char_index}}}}function nb(e){return e.includes(`claude-opus-4-8`)||e.includes(`claude-opus-4-7`)||e.includes(`claude-fable-5`)||e.includes(`claude-sonnet-5`)?{maxOutputTokens:128e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!0,rejectsSamplingParameters:!0,supportsXhighEffort:!0,isKnownModel:!0}:e.includes(`claude-sonnet-4-6`)||e.includes(`claude-opus-4-6`)?{maxOutputTokens:128e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!0,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-sonnet-4-5`)||e.includes(`claude-opus-4-5`)||e.includes(`claude-haiku-4-5`)?{maxOutputTokens:64e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-opus-4-1`)?{maxOutputTokens:32e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-sonnet-4-`)?{maxOutputTokens:64e3,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-opus-4-`)?{maxOutputTokens:32e3,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-3-haiku`)?{maxOutputTokens:4096,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:{maxOutputTokens:4096,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!1}}function rb(e){if(!e)return!1;let t=!1,n=!1;for(let r of e){if(`type`in r&&(r.type===`web_fetch_20260209`||r.type===`web_search_20260209`)){t=!0;continue}if(r.name===`code_execution`){n=!0;break}}return t&&!n}function ib({reasoning:e,supportsAdaptiveThinking:t,supportsXhighEffort:n,maxOutputTokensForModel:r,warnings:i}){if(!Em(e))return;if(e===`none`)return{thinking:{type:`disabled`}};if(t)return{thinking:{type:`adaptive`},effort:Dm({reasoning:e,effortMap:{minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:n?`xhigh`:`max`},warnings:i})};let a=Om({reasoning:e,maxOutputTokens:r,maxReasoningBudget:r,warnings:i});if(a!=null)return{thinking:{type:`enabled`,budgetTokens:a}}}function ab(e){return e?{appliedEdits:e.applied_edits.map(e=>{switch(e.type){case`clear_tool_uses_20250919`:return{type:e.type,clearedToolUses:e.cleared_tool_uses,clearedInputTokens:e.cleared_input_tokens};case`clear_thinking_20251015`:return{type:e.type,clearedThinkingTurns:e.cleared_thinking_turns,clearedInputTokens:e.cleared_input_tokens};case`compact_20260112`:return{type:e.type}}}).filter(e=>e!==void 0)}:null}function ob(e){if(e!=null)return{type:e.type,...e.category==null?{}:{category:e.category},...e.explanation==null?{}:{explanation:e.explanation},...e.recommended_model==null?{}:{recommendedModel:e.recommended_model}}}function sb(e={}){let{execute:t,...n}=e;return ox(t===void 0?{...n,execute:async({command:e},{abortSignal:t,experimental_sandbox:n})=>{if(!n)throw Error(`Sandbox session is not available`);return await n.run({command:e,abortSignal:t})}}:{...n,...t===null?{}:{execute:t}})}function cb(e={}){let{execute:t,...n}=e;return sx(t===void 0?{...n,execute:async({command:e},{abortSignal:t,experimental_sandbox:n})=>{if(!n)throw Error(`Sandbox session is not available`);return await n.run({command:e,abortSignal:t})}}:{...n,...t===null?{}:{execute:t}})}function lb(e){let t=Uh(e);return t===Cx?wx:t}function ub(e={}){let t=lb(Tm({settingValue:e.baseURL,environmentVariableName:`ANTHROPIC_BASE_URL`}))??wx,n=e.name??`anthropic.messages`;if(e.apiKey&&e.authToken)throw new di({argument:`apiKey/authToken`,message:`Both apiKey and authToken were provided. Please use only one authentication method.`});let r=()=>ym({"anthropic-version":`2023-06-01`,...e.authToken?{Authorization:`Bearer ${e.authToken}`}:{"x-api-key":wm({apiKey:e.apiKey,environmentVariableName:`ANTHROPIC_API_KEY`,description:`Anthropic`})},...e.headers},`ai-sdk/anthropic/${Sx}`),i=i=>new ax(i,{provider:n,baseURL:t,headers:r,fetch:e.fetch,generateId:e.generateId??cg,supportedUrls:()=>({"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]})}),a=()=>new xx({provider:`${n.replace(`.messages`,``)}.skills`,baseURL:t,headers:r,fetch:e.fetch}),o=function(e){if(new.target)throw Error(`The Anthropic model function cannot be called with the new keyword.`);return i(e)};return o.specificationVersion=`v4`,o.languageModel=i,o.chat=i,o.messages=i,o.embeddingModel=e=>{throw new Ui({modelId:e,modelType:`embeddingModel`})},o.textEmbeddingModel=o.embeddingModel,o.imageModel=e=>{throw new Ui({modelId:e,modelType:`imageModel`})},o.files=()=>new pb({provider:n,baseURL:t,headers:r,fetch:e.fetch}),o.skills=a,o.tools=vx,o}var db,fb,pb,mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Cx,wx,Tx=t((()=>{ma(),Xg(),Nd(),db=Wg({errorSchema:K(()=>q(z({type:H(`error`),error:z({type:I(),message:I()})}))),errorToMessage:e=>e.error.message}),fb=K(()=>q(z({id:I(),type:H(`file`),filename:I(),mime_type:I(),size_bytes:L(),created_at:I(),downloadable:ou().nullish()}))),pb=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadFile({data:e,mediaType:t,filename:n}){let r=qp(e),i=new Blob([r],{type:t}),a=new FormData;n==null?a.append(`file`,i):a.append(`file`,i,n);let{value:o}=await Bg({url:`${this.config.baseURL}/files`,headers:Up(this.config.headers(),{"anthropic-beta":`files-api-2025-04-14`}),formData:a,failedResponseHandler:db,successfulResponseHandler:Kg(fb),fetch:this.config.fetch});return{warnings:[],providerReference:{anthropic:o.id},mediaType:o.mime_type??t,filename:o.filename??n,providerMetadata:{anthropic:{filename:o.filename,mimeType:o.mime_type,sizeBytes:o.size_bytes,createdAt:o.created_at,...o.downloadable==null?{}:{downloadable:o.downloadable}}}}}},mb=z({type:I(),category:I().nullish(),explanation:I().nullish(),recommended_model:I().nullish()}),hb=K(()=>q(z({type:H(`message`),id:I().nullish(),model:I().nullish(),content:R(fu(`type`,[z({type:H(`text`),text:I(),citations:R(fu(`type`,[z({type:H(`web_search_result_location`),cited_text:I(),url:I(),title:I(),encrypted_index:I()}),z({type:H(`page_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_page_number:L(),end_page_number:L()}),z({type:H(`char_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_char_index:L(),end_char_index:L()})])).optional()}),z({type:H(`thinking`),thinking:I(),signature:I()}),z({type:H(`redacted_thinking`),data:I()}),z({type:H(`compaction`),content:I()}),z({type:H(`tool_use`),id:I(),name:I(),input:lu(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`server_tool_use`),id:I(),name:I(),input:hu(I(),lu()).nullish(),caller:B([z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`mcp_tool_use`),id:I(),name:I(),input:lu(),server_name:I()}),z({type:H(`mcp_tool_result`),tool_use_id:I(),is_error:ou(),content:R(B([I(),z({type:H(`text`),text:I()})]))}),z({type:H(`web_fetch_tool_result`),tool_use_id:I(),content:B([z({type:H(`web_fetch_result`),url:I(),retrieved_at:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:ou()}).optional(),source:B([z({type:H(`base64`),media_type:H(`application/pdf`),data:I()}),z({type:H(`text`),media_type:H(`text/plain`),data:I()})])})}),z({type:H(`web_fetch_tool_result_error`),error_code:I()})])}),z({type:H(`web_search_tool_result`),tool_use_id:I(),content:B([R(z({type:H(`web_search_result`),url:I(),title:I(),encrypted_content:I(),page_age:I().nullish()})),z({type:H(`web_search_tool_result_error`),error_code:I()})])}),z({type:H(`code_execution_tool_result`),tool_use_id:I(),content:B([z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`bash_code_execution_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`text_editor_code_execution_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:ou()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})])}),z({type:H(`tool_search_tool_result`),tool_use_id:I(),content:B([z({type:H(`tool_search_tool_search_result`),tool_references:R(z({type:H(`tool_reference`),tool_name:I()}))}),z({type:H(`tool_search_tool_result_error`),error_code:I()})])}),z({type:H(`advisor_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encrypted_content:I()}),z({type:H(`advisor_tool_result_error`),error_code:I()})])}),z({type:H(`fallback`)})])),stop_reason:I().nullish(),stop_sequence:I().nullish(),stop_details:mb.nullish(),usage:du({input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish(),iterations:R(z({type:B([H(`compaction`),H(`message`),H(`advisor_message`),H(`fallback_message`)]),model:I().nullish(),input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()})).nullish()}),container:z({expires_at:I(),id:I(),skills:R(z({type:B([H(`anthropic`),H(`custom`)]),skill_id:I(),version:I()})).nullish()}).nullish(),context_management:z({applied_edits:R(B([z({type:H(`clear_tool_uses_20250919`),cleared_tool_uses:L(),cleared_input_tokens:L()}),z({type:H(`clear_thinking_20251015`),cleared_thinking_turns:L(),cleared_input_tokens:L()}),z({type:H(`compact_20260112`)})]))}).nullish()}))),gb=K(()=>q(fu(`type`,[z({type:H(`message_start`),message:z({id:I().nullish(),model:I().nullish(),role:I().nullish(),usage:du({input_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()}),content:R(fu(`type`,[z({type:H(`tool_use`),id:I(),name:I(),input:lu(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()})])).nullish(),stop_reason:I().nullish(),container:z({expires_at:I(),id:I()}).nullish()})}),z({type:H(`content_block_start`),index:L(),content_block:fu(`type`,[z({type:H(`text`),text:I()}),z({type:H(`thinking`),thinking:I()}),z({type:H(`tool_use`),id:I(),name:I(),input:hu(I(),lu()).optional(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`redacted_thinking`),data:I()}),z({type:H(`compaction`),content:I().nullish()}),z({type:H(`server_tool_use`),id:I(),name:I(),input:hu(I(),lu()).nullish(),caller:B([z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`mcp_tool_use`),id:I(),name:I(),input:lu(),server_name:I()}),z({type:H(`mcp_tool_result`),tool_use_id:I(),is_error:ou(),content:R(B([I(),z({type:H(`text`),text:I()})]))}),z({type:H(`web_fetch_tool_result`),tool_use_id:I(),content:B([z({type:H(`web_fetch_result`),url:I(),retrieved_at:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:ou()}).optional(),source:B([z({type:H(`base64`),media_type:H(`application/pdf`),data:I()}),z({type:H(`text`),media_type:H(`text/plain`),data:I()})])})}),z({type:H(`web_fetch_tool_result_error`),error_code:I()})])}),z({type:H(`web_search_tool_result`),tool_use_id:I(),content:B([R(z({type:H(`web_search_result`),url:I(),title:I(),encrypted_content:I(),page_age:I().nullish()})),z({type:H(`web_search_tool_result_error`),error_code:I()})])}),z({type:H(`code_execution_tool_result`),tool_use_id:I(),content:B([z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`bash_code_execution_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`text_editor_code_execution_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:ou()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})])}),z({type:H(`tool_search_tool_result`),tool_use_id:I(),content:B([z({type:H(`tool_search_tool_search_result`),tool_references:R(z({type:H(`tool_reference`),tool_name:I()}))}),z({type:H(`tool_search_tool_result_error`),error_code:I()})])}),z({type:H(`advisor_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encrypted_content:I()}),z({type:H(`advisor_tool_result_error`),error_code:I()})])}),z({type:H(`fallback`)})])}),z({type:H(`content_block_delta`),index:L(),delta:fu(`type`,[z({type:H(`input_json_delta`),partial_json:I()}),z({type:H(`text_delta`),text:I()}),z({type:H(`thinking_delta`),thinking:I()}),z({type:H(`signature_delta`),signature:I()}),z({type:H(`compaction_delta`),content:I().nullish()}),z({type:H(`citations_delta`),citation:fu(`type`,[z({type:H(`web_search_result_location`),cited_text:I(),url:I(),title:I(),encrypted_index:I()}),z({type:H(`page_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_page_number:L(),end_page_number:L()}),z({type:H(`char_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_char_index:L(),end_char_index:L()})])})])}),z({type:H(`content_block_stop`),index:L()}),z({type:H(`error`),error:z({type:I(),message:I()})}),z({type:H(`message_delta`),delta:z({stop_reason:I().nullish(),stop_sequence:I().nullish(),stop_details:mb.nullish(),container:z({expires_at:I(),id:I(),skills:R(z({type:B([H(`anthropic`),H(`custom`)]),skill_id:I(),version:I()})).nullish()}).nullish()}),usage:du({input_tokens:L().nullish(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish(),iterations:R(z({type:B([H(`compaction`),H(`message`),H(`advisor_message`),H(`fallback_message`)]),model:I().nullish(),input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()})).nullish()}),context_management:z({applied_edits:R(B([z({type:H(`clear_tool_uses_20250919`),cleared_tool_uses:L(),cleared_input_tokens:L()}),z({type:H(`clear_thinking_20251015`),cleared_thinking_turns:L(),cleared_input_tokens:L()}),z({type:H(`compact_20260112`)})]))}).nullish()}),z({type:H(`message_stop`)}),z({type:H(`ping`)})]))),_b=K(()=>q(z({signature:I().optional(),redactedData:I().optional()}))),vb=z({containerUpload:ou().optional(),citations:z({enabled:ou()}).optional(),title:I().optional(),context:I().optional()}),yb=z({sendReasoning:ou().optional(),structuredOutputMode:V([`outputFormat`,`jsonTool`,`auto`]).optional(),thinking:fu(`type`,[z({type:H(`adaptive`),display:V([`omitted`,`summarized`]).optional()}),z({type:H(`enabled`),budgetTokens:L().optional()}),z({type:H(`disabled`)})]).optional(),disableParallelToolUse:ou().optional(),cacheControl:z({type:H(`ephemeral`),ttl:B([H(`5m`),H(`1h`)]).optional()}).optional(),metadata:z({userId:I().optional()}).optional(),mcpServers:R(z({type:H(`url`),name:I(),url:I(),authorizationToken:I().nullish(),toolConfiguration:z({enabled:ou().nullish(),allowedTools:R(I()).nullish()}).nullish()})).optional(),container:z({id:I().optional(),skills:R(fu(`type`,[z({type:H(`anthropic`),skillId:I(),version:I().optional()}),z({type:H(`custom`),providerReference:hu(I(),I()),version:I().optional()})])).optional()}).optional(),toolStreaming:ou().optional(),effort:V([`low`,`medium`,`high`,`xhigh`,`max`]).optional(),taskBudget:z({type:H(`tokens`),total:L().int().min(2e4),remaining:L().int().min(0).optional()}).optional(),speed:V([`fast`,`standard`]).optional(),inferenceGeo:V([`us`,`global`]).optional(),fallbacks:R(z({model:I(),max_tokens:L().int().optional(),thinking:hu(I(),lu()).optional(),output_config:hu(I(),lu()).optional(),speed:V([`fast`,`standard`]).optional()})).optional(),anthropicBeta:R(I()).optional(),contextManagement:z({edits:R(fu(`type`,[z({type:H(`clear_tool_uses_20250919`),trigger:fu(`type`,[z({type:H(`input_tokens`),value:L()}),z({type:H(`tool_uses`),value:L()})]).optional(),keep:z({type:H(`tool_uses`),value:L()}).optional(),clearAtLeast:z({type:H(`input_tokens`),value:L()}).optional(),clearToolInputs:ou().optional(),excludeTools:R(I()).optional()}),z({type:H(`clear_thinking_20251015`),keep:B([H(`all`),z({type:H(`thinking_turns`),value:L()})]).optional()}),z({type:H(`compact_20260112`),trigger:z({type:H(`input_tokens`),value:L()}).optional(),pauseAfterCompaction:ou().optional(),instructions:I().optional()})]))}).optional()}),bb=4,xb=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(e,t){let n=Ry(e);if(n){if(!t.canCache){this.warnings.push({type:`unsupported`,feature:`cache_control on non-cacheable context`,details:`cache_control cannot be set on ${t.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>bb){this.warnings.push({type:`unsupported`,feature:`cacheControl breakpoint limit`,details:`Maximum ${bb} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return n}}getWarnings(){return this.warnings}},Sb=K(()=>q(z({model:I(),maxUses:L().optional(),caching:z({type:H(`ephemeral`),ttl:B([H(`5m`),H(`1h`)])}).optional()}))),Cb=K(()=>q(fu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encryptedContent:I()}),z({type:H(`advisor_tool_result_error`),errorCode:I()})]))),wb=jh({id:`anthropic.advisor_20260301`,inputSchema:K(()=>q(z({}).strict())),outputSchema:Cb,supportsDeferredResults:!0}),Tb=e=>wb(e),Eb=K(()=>q(z({maxCharacters:L().optional()}))),Db=kh({id:`anthropic.text_editor_20250728`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),Ob=(e={})=>Db(e),kb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),userLocation:z({type:H(`approximate`),city:I().optional(),region:I().optional(),country:I().optional(),timezone:I().optional()}).optional()}))),Ab=K(()=>q(R(z({url:I(),title:I().nullable(),pageAge:I().nullable(),encryptedContent:I(),type:H(`web_search_result`)})))),jb=jh({id:`anthropic.web_search_20260209`,inputSchema:K(()=>q(z({query:I()}))),outputSchema:Ab,supportsDeferredResults:!0}),Mb=(e={})=>jb(e),Nb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),userLocation:z({type:H(`approximate`),city:I().optional(),region:I().optional(),country:I().optional(),timezone:I().optional()}).optional()}))),Pb=K(()=>q(R(z({url:I(),title:I().nullable(),pageAge:I().nullable(),encryptedContent:I(),type:H(`web_search_result`)})))),Fb=jh({id:`anthropic.web_search_20250305`,inputSchema:K(()=>q(z({query:I()}))),outputSchema:Pb,supportsDeferredResults:!0}),Ib=(e={})=>Fb(e),Lb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),citations:z({enabled:ou()}).optional(),maxContentTokens:L().optional()}))),Rb=K(()=>q(z({type:H(`web_fetch_result`),url:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:ou()}).optional(),source:B([z({type:H(`base64`),mediaType:H(`application/pdf`),data:I()}),z({type:H(`text`),mediaType:H(`text/plain`),data:I()})])}),retrievedAt:I().nullable()}))),zb=jh({id:`anthropic.web_fetch_20260209`,inputSchema:K(()=>q(z({url:I()}))),outputSchema:Rb,supportsDeferredResults:!0}),Bb=(e={})=>zb(e),Vb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),citations:z({enabled:ou()}).optional(),maxContentTokens:L().optional()}))),Hb=K(()=>q(z({type:H(`web_fetch_result`),url:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:ou()}).optional(),source:B([z({type:H(`base64`),mediaType:H(`application/pdf`),data:I()}),z({type:H(`text`),mediaType:H(`text/plain`),data:I()})])}),retrievedAt:I().nullable()}))),Ub=jh({id:`anthropic.web_fetch_20250910`,inputSchema:K(()=>q(z({url:I()}))),outputSchema:Hb,supportsDeferredResults:!0}),Wb=(e={})=>Ub(e),Gb=K(()=>q(z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}))),Kb=jh({id:`anthropic.code_execution_20250522`,inputSchema:K(()=>q(z({code:I()}))),outputSchema:Gb}),qb=(e={})=>Kb(e),Jb=K(()=>q(fu(`type`,[z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:ou()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})]))),Yb=jh({id:`anthropic.code_execution_20250825`,inputSchema:K(()=>q(fu(`type`,[z({type:H(`programmatic-tool-call`),code:I()}),z({type:H(`bash_code_execution`),command:I()}),fu(`command`,[z({type:H(`text_editor_code_execution`),command:H(`view`),path:I()}),z({type:H(`text_editor_code_execution`),command:H(`create`),path:I(),file_text:I().nullish()}),z({type:H(`text_editor_code_execution`),command:H(`str_replace`),path:I(),old_str:I(),new_str:I()})])]))),outputSchema:Jb,supportsDeferredResults:!0}),Xb=(e={})=>Yb(e),Zb=K(()=>q(fu(`type`,[z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:ou()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})]))),Qb=jh({id:`anthropic.code_execution_20260120`,inputSchema:K(()=>q(fu(`type`,[z({type:H(`programmatic-tool-call`),code:I()}),z({type:H(`bash_code_execution`),command:I()}),fu(`command`,[z({type:H(`text_editor_code_execution`),command:H(`view`),path:I()}),z({type:H(`text_editor_code_execution`),command:H(`create`),path:I(),file_text:I().nullish()}),z({type:H(`text_editor_code_execution`),command:H(`str_replace`),path:I(),old_str:I(),new_str:I()})])]))),outputSchema:Zb,supportsDeferredResults:!0}),$b=(e={})=>Qb(e),ex=K(()=>q(R(z({type:H(`tool_reference`),toolName:I()})))),tx=jh({id:`anthropic.tool_search_regex_20251119`,inputSchema:K(()=>q(z({pattern:I(),limit:L().optional()}))),outputSchema:ex,supportsDeferredResults:!0}),nx=(e={})=>tx(e),rx=new Set([`date-time`,`time`,`date`,`duration`,`email`,`hostname`,`uri`,`ipv4`,`ipv6`,`uuid`]),ix=[`minimum`,`maximum`,`exclusiveMinimum`,`exclusiveMaximum`,`multipleOf`,`minLength`,`maxLength`,`pattern`,`minItems`,`maxItems`,`uniqueItems`,`minProperties`,`maxProperties`,`not`],ax=class e{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.config=t,this.generateId=t.generateId??cg}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}supportsUrl(e){return e.protocol===`https:`}get provider(){return this.config.provider}get providerOptionsName(){let e=this.config.provider,t=e.indexOf(`.`);return t===-1?e:e.substring(0,t)}get supportedUrls(){var e;return(e=this.config).supportedUrls?.call(e)??{}}async getArgs({userSuppliedBetas:e,prompt:t,maxOutputTokens:n,temperature:r,topP:i,topK:a,frequencyPenalty:o,presencePenalty:s,stopSequences:c,responseFormat:l,seed:u,tools:d,toolChoice:f,reasoning:p,providerOptions:m,stream:h}){let g=[];o!=null&&g.push({type:`unsupported`,feature:`frequencyPenalty`}),s!=null&&g.push({type:`unsupported`,feature:`presencePenalty`}),u!=null&&g.push({type:`unsupported`,feature:`seed`}),r!=null&&r>1?(g.push({type:`unsupported`,feature:`temperature`,details:`${r} exceeds anthropic maximum of 1.0. clamped to 1.0`}),r=1):r!=null&&r<0&&(g.push({type:`unsupported`,feature:`temperature`,details:`${r} is below anthropic minimum of 0. clamped to 0`}),r=0),l?.type===`json`&&(l.schema??g.push({type:`unsupported`,feature:`responseFormat`,details:`JSON response format requires a schema. The response format is ignored.`}));let _=this.providerOptionsName,v=await Dh({provider:`anthropic`,providerOptions:m,schema:yb}),y=_===`anthropic`?null:await Dh({provider:_,providerOptions:m,schema:yb}),b=y!=null,x=Object.assign({},v??{},y??{}),{maxOutputTokens:S,supportsStructuredOutput:C,supportsAdaptiveThinking:w,rejectsSamplingParameters:T,supportsXhighEffort:ee,isKnownModel:E}=nb(this.modelId);T&&(r!=null&&(g.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported by ${this.modelId} and will be ignored`}),r=void 0),a!=null&&(g.push({type:`unsupported`,feature:`topK`,details:`topK is not supported by ${this.modelId} and will be ignored`}),a=void 0),i!=null&&(g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported by ${this.modelId} and will be ignored`}),i=void 0));let D=E||this.modelId.startsWith(`claude-`),O=(this.config.supportsNativeStructuredOutput??!0)&&C,te=(this.config.supportsStrictTools??!0)&&C,k=x?.structuredOutputMode??`auto`,A=k===`outputFormat`||k===`auto`&&O,ne=l?.type===`json`&&l.schema!=null&&!A?{type:`function`,name:`json`,description:`Respond with a JSON object.`,inputSchema:l.schema}:void 0,re=x?.contextManagement,ie=new xb,ae=Yp({tools:d,providerToolNames:{"anthropic.code_execution_20250522":`code_execution`,"anthropic.code_execution_20250825":`code_execution`,"anthropic.code_execution_20260120":`code_execution`,"anthropic.computer_20241022":`computer`,"anthropic.computer_20250124":`computer`,"anthropic.text_editor_20241022":`str_replace_editor`,"anthropic.text_editor_20250124":`str_replace_editor`,"anthropic.text_editor_20250429":`str_replace_based_edit_tool`,"anthropic.text_editor_20250728":`str_replace_based_edit_tool`,"anthropic.bash_20241022":`bash`,"anthropic.bash_20250124":`bash`,"anthropic.memory_20250818":`memory`,"anthropic.web_search_20250305":`web_search`,"anthropic.web_search_20260209":`web_search`,"anthropic.web_fetch_20250910":`web_fetch`,"anthropic.web_fetch_20260209":`web_fetch`,"anthropic.tool_search_regex_20251119":`tool_search_tool_regex`,"anthropic.tool_search_bm25_20251119":`tool_search_tool_bm25`,"anthropic.advisor_20260301":`advisor`}}),{prompt:oe,betas:se}=await Uy({prompt:t,sendReasoning:x?.sendReasoning??!0,warnings:g,cacheControlValidator:ie,toolNameMapping:ae});if(Em(p)&&x?.effort==null){let e=ib({reasoning:p,supportsAdaptiveThinking:w,supportsXhighEffort:ee,maxOutputTokensForModel:S,warnings:g});e!=null&&(x.thinking??=e.thinking,e.effort!=null&&x.thinking?.type!==`disabled`&&(x.effort=e.effort))}let ce=x?.thinking?.type,le=ce===`enabled`||ce===`adaptive`,ue=le||ce===`disabled`,de=ce===`enabled`?x?.thinking?.budgetTokens:void 0,fe=ce===`adaptive`?x?.thinking?.display:void 0,pe=n??S,me={model:this.modelId,max_tokens:pe,temperature:r,top_k:a,top_p:i,stop_sequences:c,...ue&&{thinking:{type:ce,...de!=null&&{budget_tokens:de},...fe!=null&&{display:fe}}},...(x?.effort||x?.taskBudget||A&&l?.type===`json`&&l.schema!=null)&&{output_config:{...x?.effort&&{effort:x.effort},...x?.taskBudget&&{task_budget:{type:x.taskBudget.type,total:x.taskBudget.total,...x.taskBudget.remaining!=null&&{remaining:x.taskBudget.remaining}}},...A&&l?.type===`json`&&l.schema!=null&&{format:{type:`json_schema`,schema:Jy(l.schema)}}}},...x?.speed&&{speed:x.speed},...x?.inferenceGeo&&{inference_geo:x.inferenceGeo},...x?.fallbacks&&x.fallbacks.length>0&&{fallbacks:x.fallbacks},...x?.cacheControl&&{cache_control:x.cacheControl},...x?.metadata?.userId!=null&&{metadata:{user_id:x.metadata.userId}},...x?.mcpServers&&x.mcpServers.length>0&&{mcp_servers:x.mcpServers.map(e=>({type:e.type,name:e.name,url:e.url,authorization_token:e.authorizationToken,tool_configuration:e.toolConfiguration?{allowed_tools:e.toolConfiguration.allowedTools,enabled:e.toolConfiguration.enabled}:void 0}))},...x?.container&&{container:x.container.skills&&x.container.skills.length>0?{id:x.container.id,skills:x.container.skills.map(e=>({type:e.type,skill_id:e.type===`custom`?Ph({reference:e.providerReference,provider:`anthropic`}):e.skillId,version:e.version}))}:x.container.id},system:oe.system,messages:oe.messages,...re&&{context_management:{edits:re.edits.map(e=>{let t=e.type;switch(t){case`clear_tool_uses_20250919`:return{type:e.type,...e.trigger!==void 0&&{trigger:e.trigger},...e.keep!==void 0&&{keep:e.keep},...e.clearAtLeast!==void 0&&{clear_at_least:e.clearAtLeast},...e.clearToolInputs!==void 0&&{clear_tool_inputs:e.clearToolInputs},...e.excludeTools!==void 0&&{exclude_tools:e.excludeTools}};case`clear_thinking_20251015`:return{type:e.type,...e.keep!==void 0&&{keep:e.keep}};case`compact_20260112`:return{type:e.type,...e.trigger!==void 0&&{trigger:e.trigger},...e.pauseAfterCompaction!==void 0&&{pause_after_compaction:e.pauseAfterCompaction},...e.instructions!==void 0&&{instructions:e.instructions}};default:g.push({type:`other`,message:`Unknown context management strategy: ${t}`});return}}).filter(e=>e!==void 0)}}};le?(ce===`enabled`&&de==null&&(g.push({type:`compatibility`,feature:`extended thinking`,details:`thinking budget is required when thinking is enabled. using default budget of 1024 tokens.`}),me.thinking={type:`enabled`,budget_tokens:1024},de=1024),me.temperature!=null&&(me.temperature=void 0,g.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported when thinking is enabled`})),a!=null&&(me.top_k=void 0,g.push({type:`unsupported`,feature:`topK`,details:`topK is not supported when thinking is enabled`})),i!=null&&(me.top_p=void 0,g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when thinking is enabled`})),me.max_tokens=pe+(de??0)):D&&i!=null&&r!=null&&(g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when temperature is set. topP is ignored.`}),me.top_p=void 0),E&&me.max_tokens>S&&(n!=null&&g.push({type:`unsupported`,feature:`maxOutputTokens`,details:`${me.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${S} max output tokens. The max output tokens have been limited to ${S}.`}),me.max_tokens=S),x?.mcpServers&&x.mcpServers.length>0&&se.add(`mcp-client-2025-04-04`),re&&(se.add(`context-management-2025-06-27`),re.edits.some(e=>e.type===`compact_20260112`)&&se.add(`compact-2026-01-12`)),x?.container&&x.container.skills&&x.container.skills.length>0&&(se.add(`code-execution-2025-08-25`),se.add(`skills-2025-10-02`),se.add(`files-api-2025-04-14`),d?.some(e=>e.type===`provider`&&(e.id===`anthropic.code_execution_20250825`||e.id===`anthropic.code_execution_20260120`))||g.push({type:`other`,message:`code execution tool is required when using skills`})),x?.taskBudget&&se.add(`task-budgets-2026-03-13`),x?.speed===`fast`&&se.add(`fast-mode-2026-02-01`),x?.fallbacks&&x.fallbacks.length>0&&se.add(`server-side-fallback-2026-06-01`);let he=h&&(x?.toolStreaming??!0),{tools:ge,toolChoice:_e,toolWarnings:ve,betas:ye}=await zy(ne==null?{tools:d??[],toolChoice:f,disableParallelToolUse:x?.disableParallelToolUse,cacheControlValidator:ie,supportsStructuredOutput:O,supportsStrictTools:te,defaultEagerInputStreaming:he}:{tools:[...d??[],ne],toolChoice:{type:`required`},disableParallelToolUse:!0,cacheControlValidator:ie,supportsStructuredOutput:!1,supportsStrictTools:te,defaultEagerInputStreaming:he}),be=ie.getWarnings();return{args:{...me,tools:ge,tool_choice:_e,stream:h===!0||void 0},warnings:[...g,...ve,...be],betas:new Set([...se,...ye,...e,...x?.anthropicBeta??[]]),usesJsonResponseTool:ne!=null,toolNameMapping:ae,providerOptionsName:_,usedCustomProviderKey:b}}async getHeaders({betas:e,headers:t}){return Up(this.config.headers?await Mh(this.config.headers):void 0,t,e.size>0?{"anthropic-beta":Array.from(e).join(`,`)}:{})}async getBetasFromHeaders(e){let t=(this.config.headers?await Mh(this.config.headers):void 0)?.[`anthropic-beta`]??``,n=e?.[`anthropic-beta`]??``;return new Set([...t.toLowerCase().split(`,`),...n.toLowerCase().split(`,`)].map(e=>e.trim()).filter(e=>e!==``))}buildRequestUrl(e){var t;return(t=this.config).buildRequestUrl?.call(t,this.config.baseURL,e)??`${this.config.baseURL}/messages`}transformRequestBody(e,t){var n;return(n=this.config).transformRequestBody?.call(n,e,t)??e}extractCitationDocuments(e){return e.filter(e=>e.role===`user`).flatMap(e=>e.content).filter(e=>e.type!==`file`||e.mediaType!==`application/pdf`&&e.mediaType!==`text/plain`?!1:e.providerOptions?.anthropic?.citations?.enabled??!1).map(e=>{let t=e;return{title:t.filename??`Untitled Document`,filename:t.filename,mediaType:t.mediaType}})}async doGenerate(e){let{args:t,warnings:n,betas:r,usesJsonResponseTool:i,toolNameMapping:a,providerOptionsName:o,usedCustomProviderKey:s}=await this.getArgs({...e,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(e.headers)}),c=[...this.extractCitationDocuments(e.prompt)],l=rb(t.tools),{responseHeaders:u,value:d,rawValue:f}=await zg({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:db,successfulResponseHandler:Kg(hb),abortSignal:e.abortSignal,fetch:this.config.fetch}),p=[],m={},h={},g=!1;for(let e of d.content)switch(e.type){case`text`:if(!i&&(p.push({type:`text`,text:e.text}),e.citations))for(let t of e.citations){let e=tb(t,c,this.generateId);e&&p.push(e)}break;case`thinking`:p.push({type:`reasoning`,text:e.thinking,providerMetadata:{anthropic:{signature:e.signature}}});break;case`redacted_thinking`:p.push({type:`reasoning`,text:``,providerMetadata:{anthropic:{redactedData:e.data}}});break;case`compaction`:p.push({type:`text`,text:e.content,providerMetadata:{anthropic:{type:`compaction`}}});break;case`tool_use`:if(i&&e.name===`json`)g=!0,p.push({type:`text`,text:JSON.stringify(e.input)});else{let t=e.caller,n=t?{type:t.type,toolId:`tool_id`in t?t.tool_id:void 0}:void 0;p.push({type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),...n&&{providerMetadata:{anthropic:{caller:n}}}})}break;case`server_tool_use`:if(e.name===`text_editor_code_execution`||e.name===`bash_code_execution`)p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(`code_execution`),input:JSON.stringify({type:e.name,...e.input}),providerExecuted:!0,...l?{dynamic:!0}:{}});else if(e.name===`web_search`||e.name===`code_execution`||e.name===`web_fetch`){let t=e.name===`code_execution`&&e.input!=null&&typeof e.input==`object`&&`code`in e.input&&!(`type`in e.input)?{type:`programmatic-tool-call`,...e.input}:e.input;p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(e.name),input:JSON.stringify(t),providerExecuted:!0,...l&&e.name===`code_execution`?{dynamic:!0}:{}})}else e.name===`tool_search_tool_regex`||e.name===`tool_search_tool_bm25`?(h[e.id]=e.name,p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(e.name),input:JSON.stringify(e.input),providerExecuted:!0})):e.name===`advisor`&&p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(`advisor`),input:JSON.stringify(e.input),providerExecuted:!0});break;case`mcp_tool_use`:m[e.id]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:`mcp-tool-use`,serverName:e.server_name}}},p.push(m[e.id]);break;case`mcp_tool_result`:p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:m[e.tool_use_id].toolName,isError:e.is_error,result:e.content,dynamic:!0,providerMetadata:m[e.tool_use_id].providerMetadata});break;case`web_fetch_tool_result`:e.content.type===`web_fetch_result`?(c.push({title:e.content.content.title??e.content.url,mediaType:e.content.content.source.media_type}),p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),result:{type:`web_fetch_result`,url:e.content.url,retrievedAt:e.content.retrieved_at,content:{type:e.content.content.type,title:e.content.content.title,citations:e.content.content.citations,source:{type:e.content.content.source.type,mediaType:e.content.content.source.media_type,data:e.content.content.source.data}}}})):e.content.type===`web_fetch_tool_result_error`&&p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),isError:!0,result:{type:`web_fetch_tool_result_error`,errorCode:e.content.error_code}});break;case`web_search_tool_result`:if(Array.isArray(e.content)){p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),result:e.content.map(e=>({url:e.url,title:e.title,pageAge:e.page_age??null,encryptedContent:e.encrypted_content,type:e.type}))});for(let t of e.content)p.push({type:`source`,sourceType:`url`,id:this.generateId(),url:t.url,title:t.title,providerMetadata:{anthropic:{pageAge:t.page_age??null}}})}else p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),isError:!0,result:{type:`web_search_tool_result_error`,errorCode:e.content.error_code}});break;case`code_execution_tool_result`:e.content.type===`code_execution_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,stdout:e.content.stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`encrypted_code_execution_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,encrypted_stdout:e.content.encrypted_stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`code_execution_tool_result_error`&&p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),isError:!0,result:{type:`code_execution_tool_result_error`,errorCode:e.content.error_code}});break;case`bash_code_execution_tool_result`:case`text_editor_code_execution_tool_result`:p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:e.content});break;case`tool_search_tool_result`:{let t=h[e.tool_use_id];if(t==null){let e=a.toCustomToolName(`tool_search_tool_bm25`);a.toCustomToolName(`tool_search_tool_regex`),t=e===`tool_search_tool_bm25`?`tool_search_tool_regex`:`tool_search_tool_bm25`}e.content.type===`tool_search_tool_search_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),result:e.content.tool_references.map(e=>({type:e.type,toolName:e.tool_name}))}):p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),isError:!0,result:{type:`tool_search_tool_result_error`,errorCode:e.content.error_code}});break}case`advisor_tool_result`:{let t=a.toCustomToolName(`advisor`);e.content.type===`advisor_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_result`,text:e.content.text}}):e.content.type===`advisor_redacted_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_redacted_result`,encryptedContent:e.content.encrypted_content}}):p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,isError:!0,result:{type:`advisor_tool_result_error`,errorCode:e.content.error_code}});break}case`fallback`:break}return{content:p,finishReason:{unified:qy({finishReason:d.stop_reason,isJsonResponseFromTool:g}),raw:d.stop_reason??void 0},usage:By({usage:d.usage}),request:{body:t},response:{id:d.id??void 0,modelId:d.model??void 0,headers:u,body:f},warnings:n,providerMetadata:(()=>{let e=ob(d.stop_details),t={usage:d.usage,stopSequence:d.stop_sequence??null,...e==null?{}:{stopDetails:e},iterations:d.usage.iterations?d.usage.iterations.map(e=>({type:e.type,...e.model==null?{}:{model:e.model},inputTokens:e.input_tokens,outputTokens:e.output_tokens,...e.cache_creation_input_tokens?{cacheCreationInputTokens:e.cache_creation_input_tokens}:{},...e.cache_read_input_tokens?{cacheReadInputTokens:e.cache_read_input_tokens}:{}})):null,container:d.container?{expiresAt:d.container.expires_at,id:d.container.id,skills:d.container.skills?.map(e=>({type:e.type,skillId:e.skill_id,version:e.version}))??null}:null,contextManagement:ab(d.context_management)??null},n={anthropic:t};return s&&o!==`anthropic`&&(n[o]=t),n})()}}async doStream(e){"use step";let{args:t,warnings:n,betas:r,usesJsonResponseTool:i,toolNameMapping:a,providerOptionsName:o,usedCustomProviderKey:s}=await this.getArgs({...e,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(e.headers)}),c=[...this.extractCitationDocuments(e.prompt)],l=rb(t.tools),u=this.buildRequestUrl(!0),{responseHeaders:d,value:f}=await zg({url:u,headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:db,successfulResponseHandler:Gg(gb),abortSignal:e.abortSignal,fetch:this.config.fetch}),p={unified:`other`,raw:void 0},m={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},h={},g={},_={},v=null,y,b=null,x,S=null,C=!1,w,T=this.generateId,[ee,E]=f.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:n})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){n.enqueue({type:`error`,error:t.error});return}let r=t.value;switch(r.type){case`ping`:return;case`content_block_start`:{let e=r.content_block,t=e.type;if(t===`fallback`)return;switch(w=t,t){case`text`:if(i)return;h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index)});return;case`thinking`:h[r.index]={type:`reasoning`},n.enqueue({type:`reasoning-start`,id:String(r.index)});return;case`redacted_thinking`:h[r.index]={type:`reasoning`},n.enqueue({type:`reasoning-start`,id:String(r.index),providerMetadata:{anthropic:{redactedData:e.data}}});return;case`compaction`:h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index),providerMetadata:{anthropic:{type:`compaction`}}});return;case`tool_use`:if(i&&e.name===`json`)C=!0,h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index)});else{let t=e.caller,i=t?{type:t.type,toolId:`tool_id`in t?t.tool_id:void 0}:void 0,a=e.input&&Object.keys(e.input).length>0?JSON.stringify(e.input):``;h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:a,firstDelta:a.length===0,...i&&{caller:i}},n.enqueue({type:`tool-input-start`,id:e.id,toolName:e.name})}return;case`server_tool_use`:if([`web_fetch`,`web_search`,`code_execution`,`text_editor_code_execution`,`bash_code_execution`].includes(e.name)){let t=e.name===`text_editor_code_execution`||e.name===`bash_code_execution`?`code_execution`:e.name,i=e.name===`text_editor_code_execution`||e.name===`bash_code_execution`?e.name:e.name===`code_execution`?`programmatic-tool-call`:void 0,o=a.toCustomToolName(t),s=e.input!=null&&typeof e.input==`object`&&Object.keys(e.input).length>0?JSON.stringify(e.input):``;h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:o,input:s,providerExecuted:!0,...l&&t===`code_execution`?{dynamic:!0}:{},firstDelta:s.length===0,providerToolName:t,providerToolInputType:i},n.enqueue({type:`tool-input-start`,id:e.id,toolName:o,providerExecuted:!0,...l&&t===`code_execution`?{dynamic:!0}:{}})}else if(e.name===`tool_search_tool_regex`||e.name===`tool_search_tool_bm25`){_[e.id]=e.name;let t=a.toCustomToolName(e.name);h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:t,input:``,providerExecuted:!0,firstDelta:!0,providerToolName:e.name},n.enqueue({type:`tool-input-start`,id:e.id,toolName:t,providerExecuted:!0})}else if(e.name===`advisor`){let t=a.toCustomToolName(`advisor`);h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:t,input:`{}`,providerExecuted:!0,firstDelta:!0,providerToolName:e.name},n.enqueue({type:`tool-input-start`,id:e.id,toolName:t,providerExecuted:!0})}return;case`web_fetch_tool_result`:e.content.type===`web_fetch_result`?(c.push({title:e.content.content.title??e.content.url,mediaType:e.content.content.source.media_type}),n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),result:{type:`web_fetch_result`,url:e.content.url,retrievedAt:e.content.retrieved_at,content:{type:e.content.content.type,title:e.content.content.title,citations:e.content.content.citations,source:{type:e.content.content.source.type,mediaType:e.content.content.source.media_type,data:e.content.content.source.data}}}})):e.content.type===`web_fetch_tool_result_error`&&n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),isError:!0,result:{type:`web_fetch_tool_result_error`,errorCode:e.content.error_code}});return;case`web_search_tool_result`:if(Array.isArray(e.content)){n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),result:e.content.map(e=>({url:e.url,title:e.title,pageAge:e.page_age??null,encryptedContent:e.encrypted_content,type:e.type}))});for(let t of e.content)n.enqueue({type:`source`,sourceType:`url`,id:T(),url:t.url,title:t.title,providerMetadata:{anthropic:{pageAge:t.page_age??null}}})}else n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),isError:!0,result:{type:`web_search_tool_result_error`,errorCode:e.content.error_code}});return;case`code_execution_tool_result`:e.content.type===`code_execution_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,stdout:e.content.stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`encrypted_code_execution_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,encrypted_stdout:e.content.encrypted_stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`code_execution_tool_result_error`&&n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),isError:!0,result:{type:`code_execution_tool_result_error`,errorCode:e.content.error_code}});return;case`bash_code_execution_tool_result`:case`text_editor_code_execution_tool_result`:n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:e.content});return;case`tool_search_tool_result`:{let t=_[e.tool_use_id];if(t==null){let e=a.toCustomToolName(`tool_search_tool_bm25`);a.toCustomToolName(`tool_search_tool_regex`),t=e===`tool_search_tool_bm25`?`tool_search_tool_regex`:`tool_search_tool_bm25`}e.content.type===`tool_search_tool_search_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),result:e.content.tool_references.map(e=>({type:e.type,toolName:e.tool_name}))}):n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),isError:!0,result:{type:`tool_search_tool_result_error`,errorCode:e.content.error_code}});return}case`advisor_tool_result`:{let t=a.toCustomToolName(`advisor`);e.content.type===`advisor_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_result`,text:e.content.text}}):e.content.type===`advisor_redacted_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_redacted_result`,encryptedContent:e.content.encrypted_content}}):n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,isError:!0,result:{type:`advisor_tool_result_error`,errorCode:e.content.error_code}});return}case`mcp_tool_use`:g[e.id]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:`mcp-tool-use`,serverName:e.server_name}}},n.enqueue(g[e.id]);return;case`mcp_tool_result`:n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:g[e.tool_use_id].toolName,isError:e.is_error,result:e.content,dynamic:!0,providerMetadata:g[e.tool_use_id].providerMetadata});return;default:throw Error(`Unsupported content block type: ${t}`)}}case`content_block_stop`:if(h[r.index]!=null){let e=h[r.index];switch(e.type){case`text`:n.enqueue({type:`text-end`,id:String(r.index)});break;case`reasoning`:n.enqueue({type:`reasoning-end`,id:String(r.index)});break;case`tool-call`:if(!(i&&e.toolName===`json`)){n.enqueue({type:`tool-input-end`,id:e.toolCallId});let t=e.input===``?`{}`:e.input;if(e.providerToolName===`code_execution`)try{let e=Mm(t);typeof e==`object`&&e&&`code`in e&&!(`type`in e)&&(t=JSON.stringify({type:`programmatic-tool-call`,...e}))}catch{}n.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:t,providerExecuted:e.providerExecuted,...l&&e.providerToolName===`code_execution`?{dynamic:!0}:{},...e.caller&&{providerMetadata:{anthropic:{caller:e.caller}}}})}break}delete h[r.index]}w=void 0;return;case`content_block_delta`:{let e=r.delta.type;switch(e){case`text_delta`:if(i)return;n.enqueue({type:`text-delta`,id:String(r.index),delta:r.delta.text});return;case`thinking_delta`:n.enqueue({type:`reasoning-delta`,id:String(r.index),delta:r.delta.thinking});return;case`signature_delta`:w===`thinking`&&n.enqueue({type:`reasoning-delta`,id:String(r.index),delta:``,providerMetadata:{anthropic:{signature:r.delta.signature}}});return;case`compaction_delta`:r.delta.content!=null&&n.enqueue({type:`text-delta`,id:String(r.index),delta:r.delta.content});return;case`input_json_delta`:{let e=h[r.index],t=r.delta.partial_json;if(t.length===0)return;if(C){if(e?.type!==`text`)return;n.enqueue({type:`text-delta`,id:String(r.index),delta:t})}else{if(e?.type!==`tool-call`)return;e.firstDelta&&e.providerToolInputType!=null&&(t=`{"type": "${e.providerToolInputType}",${t.substring(1)}`),n.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:t}),e.input+=t,e.firstDelta=!1}return}case`citations_delta`:{let e=r.delta.citation,t=tb(e,c,T);t&&n.enqueue(t);return}default:throw Error(`Unsupported delta type: ${e}`)}}case`message_start`:if(m.input_tokens=r.message.usage.input_tokens,m.cache_read_input_tokens=r.message.usage.cache_read_input_tokens??0,m.cache_creation_input_tokens=r.message.usage.cache_creation_input_tokens??0,y={...r.message.usage},r.message.container!=null&&(S={expiresAt:r.message.container.expires_at,id:r.message.container.id,skills:null}),r.message.stop_reason!=null&&(p={unified:qy({finishReason:r.message.stop_reason,isJsonResponseFromTool:C}),raw:r.message.stop_reason}),n.enqueue({type:`response-metadata`,id:r.message.id??void 0,modelId:r.message.model??void 0}),r.message.content!=null)for(let e=0;e<r.message.content.length;e++){let t=r.message.content[e];if(t.type===`tool_use`){let e=t.caller,r=e?{type:e.type,toolId:`tool_id`in e?e.tool_id:void 0}:void 0;n.enqueue({type:`tool-input-start`,id:t.id,toolName:t.name});let i=JSON.stringify(t.input??{});n.enqueue({type:`tool-input-delta`,id:t.id,delta:i}),n.enqueue({type:`tool-input-end`,id:t.id}),n.enqueue({type:`tool-call`,toolCallId:t.id,toolName:t.name,input:i,...r&&{providerMetadata:{anthropic:{caller:r}}}})}}return;case`message_delta`:r.usage.input_tokens!=null&&m.input_tokens!==r.usage.input_tokens&&(m.input_tokens=r.usage.input_tokens),m.output_tokens=r.usage.output_tokens,r.usage.cache_read_input_tokens!=null&&(m.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.cache_creation_input_tokens!=null&&(m.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.iterations!=null&&(m.iterations=r.usage.iterations),p={unified:qy({finishReason:r.delta.stop_reason,isJsonResponseFromTool:C}),raw:r.delta.stop_reason??void 0},b=r.delta.stop_sequence??null,x=ob(r.delta.stop_details),S=r.delta.container==null?null:{expiresAt:r.delta.container.expires_at,id:r.delta.container.id,skills:r.delta.container.skills?.map(e=>({type:e.type,skillId:e.skill_id,version:e.version}))??null},r.context_management&&(v=ab(r.context_management)),y={...y,...r.usage};return;case`message_stop`:{let e={usage:y??null,stopSequence:b,...x==null?{}:{stopDetails:x},iterations:m.iterations?m.iterations.map(e=>({type:e.type,...e.model==null?{}:{model:e.model},inputTokens:e.input_tokens,outputTokens:e.output_tokens,...e.cache_creation_input_tokens?{cacheCreationInputTokens:e.cache_creation_input_tokens}:{},...e.cache_read_input_tokens?{cacheReadInputTokens:e.cache_read_input_tokens}:{}})):null,container:S,contextManagement:v},t={anthropic:e};s&&o!==`anthropic`&&(t[o]=e),n.enqueue({type:`finish`,finishReason:p,usage:By({usage:m,rawUsage:y}),providerMetadata:t});return}case`error`:n.enqueue({type:`error`,error:r.error});return;default:throw Error(`Unsupported chunk type: ${r}`)}}})).tee(),D=ee.getReader();try{await D.read();let e=await D.read();if(e.value?.type===`raw`&&(e=await D.read()),e.value?.type===`error`){let n=e.value.error;throw new $r({message:n.message,url:u,requestBodyValues:t,statusCode:n.type===`overloaded_error`?529:500,responseHeaders:d,responseBody:JSON.stringify(n),isRetryable:n.type===`overloaded_error`})}}finally{D.cancel().catch(()=>{}),D.releaseLock()}return{stream:E,request:{body:t},response:{headers:d}}}},ox=kh({id:`anthropic.bash_20241022`,inputSchema:K(()=>q(z({command:I(),restart:ou().optional()})))}),sx=kh({id:`anthropic.bash_20250124`,inputSchema:K(()=>q(z({command:I(),restart:ou().optional()})))}),cx=kh({id:`anthropic.computer_20241022`,inputSchema:K(()=>q(z({action:V([`key`,`type`,`mouse_move`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`screenshot`,`cursor_position`]),coordinate:R(L().int()).optional(),text:I().optional()})))}),lx=kh({id:`anthropic.computer_20250124`,inputSchema:K(()=>q(z({action:V([`key`,`hold_key`,`type`,`cursor_position`,`mouse_move`,`left_mouse_down`,`left_mouse_up`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`triple_click`,`scroll`,`wait`,`screenshot`]),coordinate:mu([L().int(),L().int()]).optional(),duration:L().optional(),scroll_amount:L().optional(),scroll_direction:V([`up`,`down`,`left`,`right`]).optional(),start_coordinate:mu([L().int(),L().int()]).optional(),text:I().optional()})))}),ux=kh({id:`anthropic.computer_20251124`,inputSchema:K(()=>q(z({action:V([`key`,`hold_key`,`type`,`cursor_position`,`mouse_move`,`left_mouse_down`,`left_mouse_up`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`triple_click`,`scroll`,`wait`,`screenshot`,`zoom`]),coordinate:mu([L().int(),L().int()]).optional(),duration:L().optional(),region:mu([L().int(),L().int(),L().int(),L().int()]).optional(),scroll_amount:L().optional(),scroll_direction:V([`up`,`down`,`left`,`right`]).optional(),start_coordinate:mu([L().int(),L().int()]).optional(),text:I().optional()})))}),dx=kh({id:`anthropic.memory_20250818`,inputSchema:K(()=>q(fu(`command`,[z({command:H(`view`),path:I(),view_range:mu([L(),L()]).optional()}),z({command:H(`create`),path:I(),file_text:I()}),z({command:H(`str_replace`),path:I(),old_str:I(),new_str:I()}),z({command:H(`insert`),path:I(),insert_line:L(),insert_text:I()}),z({command:H(`delete`),path:I()}),z({command:H(`rename`),old_path:I(),new_path:I()})])))}),fx=kh({id:`anthropic.text_editor_20241022`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),px=kh({id:`anthropic.text_editor_20250124`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),mx=kh({id:`anthropic.text_editor_20250429`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),hx=K(()=>q(R(z({type:H(`tool_reference`),toolName:I()})))),gx=jh({id:`anthropic.tool_search_bm25_20251119`,inputSchema:K(()=>q(z({query:I(),limit:L().optional()}))),outputSchema:hx,supportsDeferredResults:!0}),_x=(e={})=>gx(e),vx={advisor_20260301:Tb,bash_20241022:sb,bash_20250124:cb,codeExecution_20250522:qb,codeExecution_20250825:Xb,codeExecution_20260120:$b,computer_20241022:cx,computer_20250124:lx,computer_20251124:ux,memory_20250818:dx,textEditor_20241022:fx,textEditor_20250124:px,textEditor_20250429:mx,textEditor_20250728:Ob,webFetch_20250910:Wb,webFetch_20260209:Bb,webSearch_20250305:Ib,webSearch_20260209:Mb,toolSearchRegex_20251119:nx,toolSearchBm25_20251119:_x},yx=K(()=>q(z({id:I(),display_title:I().nullish(),name:I().nullish(),description:I().nullish(),latest_version:I().nullish(),source:I(),created_at:I(),updated_at:I()}))),bx=K(()=>q(z({type:I(),skill_id:I(),name:I().nullish(),description:I().nullish()}))),xx=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async getHeaders(){return Up(await Mh(this.config.headers),{"anthropic-beta":`skills-2025-10-02`})}async fetchVersionMetadata({skillId:e,version:t,headers:n}){let{value:r}=await pg({url:`${this.config.baseURL}/skills/${e}/versions/${t}`,headers:n,failedResponseHandler:db,successfulResponseHandler:Kg(bx),fetch:this.config.fetch});return{...r.name==null?{}:{name:r.name},...r.description==null?{}:{description:r.description}}}async uploadSkill(e){let t=[],n=new FormData;e.displayTitle!=null&&n.append(`display_title`,e.displayTitle);for(let t of e.files){let e=qp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let r=await this.getHeaders(),{value:i}=await Bg({url:`${this.config.baseURL}/skills`,headers:r,formData:n,failedResponseHandler:db,successfulResponseHandler:Kg(yx),fetch:this.config.fetch}),a=i.latest_version==null?{}:await this.fetchVersionMetadata({skillId:i.id,version:i.latest_version,headers:r}),o=a.name??i.name,s=a.description??i.description;return{providerReference:{anthropic:i.id},...i.display_title==null?{}:{displayTitle:i.display_title},...o==null?{}:{name:o},...s==null?{}:{description:s},...i.latest_version==null?{}:{latestVersion:i.latest_version},providerMetadata:{anthropic:{...i.source==null?{}:{source:i.source},...i.created_at==null?{}:{createdAt:i.created_at},...i.updated_at==null?{}:{updatedAt:i.updated_at}}},warnings:t}}},Sx=`4.0.12`,Cx=`https://api.anthropic.com`,wx=`${Cx}/v1`,ub()}));function Ex(e,t){return t===`openai`?e.openaiKey:e.anthropicKey}function Dx(e,t,n){let r=jx[e][n];return{model:e===`openai`?ov({apiKey:t})(r):ub({apiKey:t,headers:yr?void 0:{"anthropic-dangerous-direct-browser-access":`true`}})(r),provider:e,modelId:r}}function Ox(e){let t=e.preferredProvider;return t&&Ex(e,t)?t:e.openaiKey?`openai`:e.anthropicKey?`anthropic`:null}async function kx(e){let t=await Cr(),n=Ox(t);if(!n)throw new Mx;return Dx(n,Ex(t,n),e)}async function Ax(e,t){let n=await Cr(),r=e===`openai`?`anthropic`:`openai`,i=Ex(n,r);return i?Dx(r,i,t):null}var jx,Mx,Nx=t((()=>{Ly(),Tx(),br(),Rr(),jx={openai:{fast:`gpt-5.4-nano`,best:`gpt-5.2`},anthropic:{fast:`claude-haiku-4-5`,best:`claude-opus-4-8`}},Mx=class extends Error{constructor(){super(`No AI provider configured. Add an OpenAI or Anthropic API key in Settings.`),this.name=`NoProviderError`}}})),Px=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);var u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),Fx=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>u,RefreshAccessTokenFailedError:()=>d}),t.exports=c(l);var u=class extends Error{constructor(){super(`No authentication found. Please log in with the Vercel CLI (vercel login).`),this.name=`AccessTokenMissingError`}},d=class extends Error{constructor(e){super(`Failed to refresh authentication token.`,{cause:e}),this.name=`RefreshAccessTokenFailedError`}};0&&(t.exports={AccessTokenMissingError:u,RefreshAccessTokenFailedError:d})})),Ix=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>d.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>d.RefreshAccessTokenFailedError,getContext:()=>u.getContext,getVercelOidcToken:()=>f,getVercelOidcTokenSync:()=>p,getVercelToken:()=>m}),t.exports=c(l);var u=Px(),d=Fx();async function f(){return``}function p(){return``}async function m(){throw Error(`getVercelToken is not supported in browser environments`)}0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken:f,getVercelOidcTokenSync:p,getVercelToken:m})}));function Lx(e,t){let n=[eS,`${tS}${e}`];return t?.teamIdOrSlug&&n.push(`${nS}${Rx(t.teamIdOrSlug)}`),n}function Rx(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/u,``)}async function zx({response:e,statusCode:t,defaultMessage:n=`Gateway request failed`,cause:r,authMethod:i}){let a=await Ch({value:e,schema:rC});if(!a.success){let i=typeof e==`object`&&e&&`generationId`in e?e.generationId:void 0;return new nC({message:`Invalid error response format: ${n}`,statusCode:t,response:e,validationError:a.error,cause:r,generationId:i})}let o=a.value,s=o.error.type,c=o.error.message,l=o.generationId??void 0;switch(s){case`authentication_error`:return fS.createContextualError({apiKeyProvided:i===`api-key`,oidcTokenProvided:i===`oidc`,statusCode:t,cause:r,generationId:l});case`invalid_request_error`:return new vS({message:c,statusCode:t,cause:r,generationId:l});case`rate_limit_exceeded`:return new wS({message:c,statusCode:t,cause:r,generationId:l});case`model_not_found`:{let e=await Ch({value:o.error.param,schema:OS});return new jS({message:c,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:r,generationId:l})}case`internal_server_error`:return new LS({message:c,statusCode:t,cause:r,generationId:l});case`failed_dependency`:return new US({message:c,statusCode:t,cause:r,generationId:l});case`forbidden`:{let e=await Ch({value:o.error.param,schema:qS});return new XS({message:c,statusCode:t,cause:r,generationId:l,ruleId:e.success?e.value.ruleId:void 0})}default:return new LS({message:c,statusCode:t,cause:r,generationId:l})}}function Bx(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return Mm(e.responseBody)}catch{return e.responseBody}return{}}function Vx(e){if(!(e instanceof Error))return!1;let t=e.code;return typeof t==`string`&&[`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CONNECT_TIMEOUT`].includes(t)}async function Hx(e,t){return oS.isInstance(e)?e:Vx(e)?lC.createTimeoutError({originalMessage:e instanceof Error?e.message:`Unknown error`,cause:e}):$r.isInstance(e)?e.cause&&Vx(e.cause)?lC.createTimeoutError({originalMessage:e.message,cause:e}):await zx({response:Bx(e),statusCode:e.statusCode??500,defaultMessage:`Gateway request failed`,cause:e,authMethod:t}):await zx({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:`Unknown Gateway error`,cause:e,authMethod:t})}async function Ux(e){let t=await Ch({value:e[uC],schema:fC});return t.success?t.value:void 0}function Wx(e){if(e.type===`data`){let t=e.data;if(t instanceof Uint8Array)return{...e,data:Buffer.from(t).toString(`base64`)}}return e}function Gx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:Gp(e.data)}:e}function Kx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:Gp(e.data)}:e}function qx(e,t){let n=new URL(`${e.replace(/^http/,`ws`)}/realtime-model`);return n.searchParams.set(`ai-model-id`,t),n.toString()}async function Jx(){return(0,Qx.getContext)().headers?.[`x-vercel-id`]}function Yx(e={}){let t=null,n=null,r=e.metadataCacheRefreshMillis??1e3*60*5,i=0,a=Uh(e.baseURL)??`https://ai-gateway.vercel.sh/v4/ai`,o=t=>ym({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":tw,[uC]:t.authMethod,...e.teamIdOrSlug==null?{}:{[dC]:e.teamIdOrSlug},...e.headers},`ai-sdk/gateway/${ew}`),s=async()=>{try{return o(await Xx(e))}catch(e){throw fS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},c=async()=>{try{return await Xx(e)}catch(e){throw fS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},l=async t=>{Zx();let n=await c(),r=o(n),i=new URL(`/v1/realtime/client-secrets`,a).toString();try{let{value:n}=await zg({url:i,headers:r,body:{model:t.modelId,...t.expiresAfterSeconds!=null&&{expiresIn:t.expiresAfterSeconds}},successfulResponseHandler:Kg(nw),failedResponseHandler:Wg({errorSchema:cu(),errorToMessage:e=>e}),fetch:e.fetch});return{token:n.token,...n.expiresAt!=null&&{expiresAt:n.expiresAt}}}catch(e){throw await Hx(e,await Ux(r))}},u=()=>{let e=Tm({settingValue:void 0,environmentVariableName:`VERCEL_DEPLOYMENT_ID`}),t=Tm({settingValue:void 0,environmentVariableName:`VERCEL_ENV`}),n=Tm({settingValue:void 0,environmentVariableName:`VERCEL_REGION`}),r=Tm({settingValue:void 0,environmentVariableName:`VERCEL_PROJECT_ID`});return async()=>{let i=await Jx();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...n&&{"ai-o11y-region":n},...i&&{"ai-o11y-request-id":i},...r&&{"ai-o11y-project-id":r}}}},d=t=>new xC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),f=async()=>{var o;let c=((o=e._internal)?.currentDate)?.call(o).getTime()??Date.now();return(!t||c-i>r)&&(i=c,t=new mC({baseURL:a,headers:s,fetch:e.fetch}).getAvailableModels().then(e=>(n=e,e)).catch(async e=>{throw await Hx(e,await Ux(await s()))})),n?Promise.resolve(n):t},p=async()=>new mC({baseURL:a,headers:s,fetch:e.fetch}).getCredits().catch(async e=>{throw await Hx(e,await Ux(await s()))}),m=async t=>new _C({baseURL:a,headers:s,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await Hx(e,await Ux(await s()))}),h=async t=>new yC({baseURL:a,headers:s,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await Hx(e,await Ux(await s()))}),g=function(e){if(new.target)throw Error(`The Gateway Provider model function cannot be called with the new keyword.`);return d(e)};g.specificationVersion=`v4`,g.getAvailableModels=f,g.getCredits=p,g.getSpendReport=m,g.getGenerationInfo=h,g.imageModel=t=>new TC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),g.languageModel=d;let _=t=>new SC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.embeddingModel=_,g.textEmbeddingModel=_,g.videoModel=t=>new AC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});let v=t=>new FC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.rerankingModel=v,g.reranking=v;let y=t=>new RC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.speechModel=y,g.speech=y;let b=t=>new HC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.transcriptionModel=b,g.transcription=b;let x=t=>new KC(t,{provider:`gateway.realtime`,baseURL:a,teamIdOrSlug:e.teamIdOrSlug,createClientSecret:l});return g.experimental_realtime=Object.assign(e=>x(e),{getToken:async e=>{let{model:t,...n}=e,r=await x(t).doCreateClientSecret(n);return{token:r.token,url:r.url,...r.expiresAt!=null&&{expiresAt:r.expiresAt}}}}),g.chat=g.languageModel,g.embedding=g.embeddingModel,g.image=g.imageModel,g.video=g.videoModel,g.tools=$C,g}async function Xx(e){let t=Tm({settingValue:e.apiKey,environmentVariableName:`AI_GATEWAY_API_KEY`});return t?{token:t,authMethod:`api-key`}:{token:await(0,$x.getVercelOidcToken)(),authMethod:`oidc`}}function Zx(){if(globalThis.window!==void 0)throw Error(`AI Gateway realtime client secrets must be minted server-side: minting needs your Gateway credential, which must never reach the browser. Call gateway.experimental_realtime.getToken() from your server and pass the returned token to the client.`)}var Qx,$x,eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS,_S,vS,yS,bS,xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC,hC,gC,_C,vC,yC,bC,xC,SC,CC,wC,TC,EC,DC,OC,kC,AC,jC,MC,NC,PC,FC,IC,LC,RC,zC,BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw=t((()=>{Xg(),Nd(),ma(),Qx=Ix(),$x=Ix(),eS=`ai-gateway-realtime.v1`,tS=`ai-gateway-auth.`,nS=`ai-gateway-team.`,rS=Symbol.for(`vercel.ai.gateway.error`),oS=class e extends (aS=Error,iS=rS,aS){constructor({message:e,statusCode:t=500,cause:n,generationId:r,isRetryable:i=t!=null&&(t===408||t===409||t===429||t>=500)}){super(r?`${e} [${r}]`:e),this[iS]=!0,this.statusCode=t,this.cause=n,this.generationId=r,this.isRetryable=i}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return typeof e==`object`&&!!e&&rS in e&&e[rS]===!0}},sS=`GatewayAuthenticationError`,cS=`vercel.ai.gateway.error.${sS}`,lS=Symbol.for(cS),fS=class e extends (dS=oS,uS=lS,dS){constructor({message:e=`Authentication failed`,statusCode:t=401,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[uS]=!0,this.name=sS,this.type=`authentication_error`}static isInstance(e){return oS.hasMarker(e)&&lS in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,statusCode:r=401,cause:i,generationId:a}){let o;return o=t?`AI Gateway authentication failed: Invalid API key or token.
|
|
53
|
+
${t}:`]}}function h_({id:e,model:t,created:n}){return{id:e??void 0,modelId:t??void 0,timestamp:n==null?void 0:new Date(n*1e3)}}function g_(e){switch(e){case`stop`:return`stop`;case`length`:return`length`;case`content_filter`:return`content-filter`;case`function_call`:case`tool_calls`:return`tool-calls`;default:return`other`}}function __(e){return!(`error`in e)&&e.choices.some(e=>e.text.length>0)}function v_(e){return Tv.some(t=>e.startsWith(t))}function y_(e,t,n){if(e==null)return{};let r={};if(e.image_tokens!=null){let i=Math.floor(e.image_tokens/n),a=e.image_tokens-i*(n-1);r.imageTokens=t===n-1?a:i}if(e.text_tokens!=null){let i=Math.floor(e.text_tokens/n),a=e.text_tokens-i*(n-1);r.textTokens=t===n-1?a:i}return r}async function b_(e){if(!e)return;if(e.type===`url`)return fm(e.url);let t=e.data instanceof Uint8Array?e.data:Wp(e.data);return new Blob([t],{type:e.mediaType})}function x_(e){let t=e,n=t.type;switch(n){case`session.created`:return{type:`session-created`,sessionId:t.session?.id,raw:e};case`session.updated`:return{type:`session-updated`,raw:e};case`input_audio_buffer.speech_started`:return{type:`speech-started`,itemId:t.item_id,raw:e};case`input_audio_buffer.speech_stopped`:return{type:`speech-stopped`,itemId:t.item_id,raw:e};case`input_audio_buffer.committed`:return{type:`audio-committed`,itemId:t.item_id,previousItemId:t.previous_item_id,raw:e};case`conversation.item.added`:return{type:`conversation-item-added`,itemId:t.item?.id??t.item_id,item:t.item,raw:e};case`conversation.item.input_audio_transcription.completed`:return{type:`input-transcription-completed`,itemId:t.item_id,transcript:t.transcript??``,raw:e};case`response.created`:return{type:`response-created`,responseId:t.response?.id??t.response_id,raw:e};case`response.done`:return{type:`response-done`,responseId:t.response?.id??t.response_id,status:t.response?.status??`completed`,raw:e};case`response.output_item.added`:return{type:`output-item-added`,responseId:t.response_id,itemId:t.item?.id??t.item_id,raw:e};case`response.output_item.done`:return{type:`output-item-done`,responseId:t.response_id,itemId:t.item?.id??t.item_id,raw:e};case`response.content_part.added`:return{type:`content-part-added`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.content_part.done`:return{type:`content-part-done`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.output_audio.delta`:return{type:`audio-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_audio.done`:return{type:`audio-done`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.output_audio_transcript.delta`:return{type:`audio-transcript-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_audio_transcript.done`:return{type:`audio-transcript-done`,responseId:t.response_id,itemId:t.item_id,transcript:t.transcript,raw:e};case`response.output_text.delta`:return{type:`text-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_text.done`:return{type:`text-done`,responseId:t.response_id,itemId:t.item_id,text:t.text,raw:e};case`response.function_call_arguments.delta`:return{type:`function-call-arguments-delta`,responseId:t.response_id,itemId:t.item_id,callId:t.call_id,delta:t.delta,raw:e};case`response.function_call_arguments.done`:return{type:`function-call-arguments-done`,responseId:t.response_id,itemId:t.item_id,callId:t.call_id,name:t.name,arguments:t.arguments,raw:e};case`error`:return{type:`error`,message:t.error?.message??t.message??`Unknown error`,code:t.error?.code??t.code,raw:e};default:return{type:`custom`,rawType:n,raw:e}}}function S_(e,t){switch(e.type){case`session-update`:return{type:`session.update`,session:C_(e.config,t)};case`input-audio-append`:return{type:`input_audio_buffer.append`,audio:e.audio};case`input-audio-commit`:return{type:`input_audio_buffer.commit`};case`input-audio-clear`:return{type:`input_audio_buffer.clear`};case`conversation-item-create`:{let t=e.item;switch(t.type){case`text-message`:return{type:`conversation.item.create`,item:{type:`message`,role:t.role,content:[{type:`input_text`,text:t.text}]}};case`audio-message`:return{type:`conversation.item.create`,item:{type:`message`,role:t.role,content:[{type:`input_audio`,audio:t.audio}]}};case`function-call-output`:return{type:`conversation.item.create`,item:{type:`function_call_output`,call_id:t.callId,output:t.output}}}break}case`conversation-item-truncate`:return{type:`conversation.item.truncate`,item_id:e.itemId,content_index:e.contentIndex,audio_end_ms:e.audioEndMs};case`response-create`:return{type:`response.create`,...e.options==null?{}:{response:{...e.options.modalities==null?{}:{output_modalities:e.options.modalities},...e.options.instructions==null?{}:{instructions:e.options.instructions},...e.options.metadata==null?{}:{metadata:e.options.metadata}}}};case`response-cancel`:return{type:`response.cancel`}}}function C_(e,t){let n={type:`realtime`,model:t};e.instructions!=null&&(n.instructions=e.instructions),e.outputModalities!=null&&(n.output_modalities=e.outputModalities);let r={};if(e.inputAudioFormat!=null||e.inputAudioTranscription!=null||e.turnDetection!=null){let t={};if(e.inputAudioFormat!=null&&(t.format={type:e.inputAudioFormat.type,...e.inputAudioFormat.rate==null?{}:{rate:e.inputAudioFormat.rate}}),e.turnDetection!=null)if(e.turnDetection.type===`disabled`)t.turn_detection=null;else{let n={type:e.turnDetection.type===`server-vad`?`server_vad`:`semantic_vad`};e.turnDetection.threshold!=null&&(n.threshold=e.turnDetection.threshold),e.turnDetection.silenceDurationMs!=null&&(n.silence_duration_ms=e.turnDetection.silenceDurationMs),e.turnDetection.prefixPaddingMs!=null&&(n.prefix_padding_ms=e.turnDetection.prefixPaddingMs),t.turn_detection=n}e.inputAudioTranscription!=null&&(t.transcription={model:e.inputAudioTranscription.model??`gpt-realtime-whisper`,...e.inputAudioTranscription.language==null?{}:{language:e.inputAudioTranscription.language},...e.inputAudioTranscription.prompt==null?{}:{prompt:e.inputAudioTranscription.prompt}}),r.input=t}if(e.outputAudioFormat!=null||e.voice!=null){let t={};e.outputAudioFormat!=null&&(t.format={type:e.outputAudioFormat.type,...e.outputAudioFormat.rate==null?{}:{rate:e.outputAudioFormat.rate}}),e.voice!=null&&(t.voice=e.voice),r.output=t}return Object.keys(r).length>0&&(n.audio=r),e.tools!=null&&e.tools.length>0&&(n.tools=e.tools.map(e=>({type:e.type,name:e.name,description:e.description,parameters:e.parameters})),n.tool_choice=`auto`),e.providerOptions!=null&&Object.assign(n,e.providerOptions),n}function w_(e){if(e==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let t=e.input_tokens,n=e.output_tokens,r=e.input_tokens_details?.cached_tokens??0,i=e.input_tokens_details?.cache_write_tokens??void 0,a=e.output_tokens_details?.reasoning_tokens??0;return{inputTokens:{total:t,noCache:t-r-(i??0),cacheRead:r,cacheWrite:i},outputTokens:{total:n,text:n-a,reasoning:a},raw:e}}function T_(e){return JSON.stringify(e===void 0?{}:e)}function E_(e,t){return e?.[t]?.promptCacheBreakpoint}function D_(e,t){return t?t.some(t=>e.startsWith(t)):!1}async function O_({prompt:e,toolNameMapping:t,systemMessageMode:n,providerOptionsName:r,fileIdPrefixes:i,passThroughUnsupportedFiles:a=!1,store:o,hasConversation:s=!1,hasPreviousResponseId:c=!1,hasLocalShellTool:l=!1,hasShellTool:u=!1,hasApplyPatchTool:d=!1,customProviderToolNames:f}){let p=[],m=[],h=new Set;for(let{role:g,content:_,providerOptions:v}of e)switch(g){case`system`:switch(n){case`system`:{let e=E_(v,r);p.push({role:`system`,content:e==null?_:[{type:`input_text`,text:_,prompt_cache_breakpoint:e}]});break}case`developer`:{let e=E_(v,r);p.push({role:`developer`,content:e==null?_:[{type:`input_text`,text:_,prompt_cache_breakpoint:e}]});break}case`remove`:m.push({type:`other`,message:`system messages are removed for this model`});break;default:throw Error(`Unsupported system message mode: ${n}`)}break;case`user`:p.push({role:`user`,content:_.map((e,t)=>{switch(e.type){case`text`:{let t=E_(e.providerOptions,r);return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}}}case`file`:{let n=E_(e.providerOptions,r);switch(e.data.type){case`reference`:{let t=Ph({reference:e.data.reference,provider:r});return tm(e.mediaType)===`image`?{type:`input_image`,file_id:t,detail:e.providerOptions?.[r]?.imageDetail,...n!=null&&{prompt_cache_breakpoint:n}}:{type:`input_file`,file_id:t,...n!=null&&{prompt_cache_breakpoint:n}}}case`text`:throw new pa({functionality:`text file parts`});case`url`:case`data`:if(tm(e.mediaType)===`image`)return{type:`input_image`,...e.data.type===`url`?{image_url:e.data.url.toString()}:typeof e.data.data==`string`&&D_(e.data.data,i)?{file_id:e.data.data}:{image_url:`data:${Nh({part:e})};base64,${Kp(e.data.data)}`},detail:e.providerOptions?.[r]?.imageDetail,...n!=null&&{prompt_cache_breakpoint:n}};{if(e.data.type===`url`)return{type:`input_file`,file_url:e.data.url.toString(),...n!=null&&{prompt_cache_breakpoint:n}};let r=Nh({part:e});if(r!==`application/pdf`&&!a)throw new pa({functionality:`file part media type ${r}`});return{type:`input_file`,...typeof e.data.data==`string`&&D_(e.data.data,i)?{file_id:e.data.data}:{filename:e.filename??(r===`application/pdf`?`part-${t}.pdf`:`part-${t}`),file_data:`data:${r};base64,${Kp(e.data.data)}`},...n!=null&&{prompt_cache_breakpoint:n}}}}}}})});break;case`assistant`:{let e={};for(let n of _)switch(n.type){case`text`:{let e=n.providerOptions?.[r],t=e?.itemId,i=e?.phase;if(s&&t!=null)break;if(o&&t!=null){p.push({type:`item_reference`,id:t});break}p.push({role:`assistant`,content:[{type:`output_text`,text:n.text}],id:t,...i!=null&&{phase:i}});break}case`tool-call`:{let e=n.providerOptions?.[r]?.itemId??n.providerMetadata?.[r]?.itemId,i=n.providerOptions?.[r]?.namespace??n.providerMetadata?.[r]?.namespace;if(s&&e!=null)break;let a=t.toProviderToolName(n.toolName);if(a===`tool_search`){if(o&&e!=null){p.push({type:`item_reference`,id:e});break}let t=typeof n.input==`string`?await wh({text:n.input,schema:iy}):await Sh({value:n.input,schema:iy}),r=t.call_id==null?`server`:`client`;p.push({type:`tool_search_call`,id:e??n.toolCallId,execution:r,call_id:t.call_id??null,status:`completed`,arguments:t.arguments});break}if(n.providerExecuted){o&&e!=null&&p.push({type:`item_reference`,id:e});break}if(c&&o&&e!=null)break;let m=l&&a===`local_shell`||u&&a===`shell`||d&&a===`apply_patch`||(f?.has(a)??!1);if(o&&e!=null&&m){p.push({type:`item_reference`,id:e});break}if(l&&a===`local_shell`){let t=await Sh({value:n.input,schema:Yv});p.push({type:`local_shell_call`,call_id:n.toolCallId,id:e,action:{type:`exec`,command:t.action.command,timeout_ms:t.action.timeoutMs,user:t.action.user,working_directory:t.action.workingDirectory,env:t.action.env}});break}if(u&&a===`shell`){let t=await Sh({value:n.input,schema:Qv});p.push({type:`shell_call`,call_id:n.toolCallId,id:e,status:`completed`,action:{commands:t.action.commands,timeout_ms:t.action.timeoutMs,max_output_length:t.action.maxOutputLength}});break}if(d&&a===`apply_patch`){let t=await Sh({value:n.input,schema:Av});p.push({type:`apply_patch_call`,call_id:t.callId,id:e,status:`completed`,operation:t.operation});break}if(f?.has(a)){p.push({type:`custom_tool_call`,call_id:n.toolCallId,name:a,input:typeof n.input==`string`?n.input:JSON.stringify(n.input),id:e});break}p.push({type:`function_call`,call_id:n.toolCallId,name:a,arguments:T_(n.input),...i!=null&&{namespace:i}});break}case`tool-result`:{if(n.output.type===`execution-denied`||n.output.type===`json`&&typeof n.output.value==`object`&&n.output.value!=null&&`type`in n.output.value&&n.output.value.type===`execution-denied`||s)break;let e=t.toProviderToolName(n.toolName);if(e===`tool_search`){let e=n.providerOptions?.[r]?.itemId??n.toolCallId;if(o)p.push({type:`item_reference`,id:e});else if(n.output.type===`json`){let t=await Sh({value:n.output.value,schema:ay});p.push({type:`tool_search_output`,id:e,execution:`server`,call_id:null,status:`completed`,tools:t.tools})}break}if(u&&e===`shell`){if(n.output.type===`json`){let e=await Sh({value:n.output.value,schema:$v});p.push({type:`shell_call_output`,call_id:n.toolCallId,output:e.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`timeout`?{type:`timeout`}:{type:`exit`,exit_code:e.outcome.exitCode}}))})}break}if(o){let e=n.providerOptions?.[r]?.itemId??n.toolCallId;p.push({type:`item_reference`,id:e})}else m.push({type:`other`,message:`Results for OpenAI tool ${n.toolName} are not sent to the API when store is false`});break}case`reasoning`:{let t=await Dh({provider:r,providerOptions:n.providerOptions,schema:yy}),i=t?.itemId;if((s||c)&&i!=null)break;if(i!=null){let r=e[i];if(o)r===void 0&&(p.push({type:`item_reference`,id:i}),e[i]={type:`reasoning`,id:i,summary:[]});else{let a=[];n.text.length>0?a.push({type:`summary_text`,text:n.text}):r!==void 0&&m.push({type:`other`,message:`Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(n)}.`}),r===void 0?(e[i]={type:`reasoning`,id:i,encrypted_content:t?.reasoningEncryptedContent,summary:a},p.push(e[i])):(r.summary.push(...a),t?.reasoningEncryptedContent!=null&&(r.encrypted_content=t.reasoningEncryptedContent))}}else{let e=t?.reasoningEncryptedContent;if(e!=null){let t=[];n.text.length>0&&t.push({type:`summary_text`,text:n.text}),p.push({type:`reasoning`,encrypted_content:e,summary:t})}else m.push({type:`other`,message:`Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(n)}.`})}break}case`custom`:if(n.kind===`openai.compaction`){let e=n.providerOptions?.[r],t=e?.itemId;if(s&&t!=null)break;if(o&&t!=null){p.push({type:`item_reference`,id:t});break}let i=e?.encryptedContent;t!=null&&p.push({type:`compaction`,id:t,encrypted_content:i})}break}break}case`tool`:for(let e of _){if(e.type===`tool-approval-response`){let t=e;if(h.has(t.approvalId))continue;h.add(t.approvalId),o&&p.push({type:`item_reference`,id:t.approvalId}),p.push({type:`mcp_approval_response`,approval_request_id:t.approvalId,approve:t.approved});continue}let n=e.output;if(n.type===`execution-denied`&&n.providerOptions?.openai?.approvalId)continue;let i=t.toProviderToolName(e.toolName);if(i===`tool_search`&&n.type===`json`){let t=await Sh({value:n.value,schema:ay});p.push({type:`tool_search_output`,execution:`client`,call_id:e.toolCallId,status:`completed`,tools:t.tools});continue}if(l&&i===`local_shell`&&n.type===`json`){let t=await Sh({value:n.value,schema:Xv});p.push({type:`local_shell_call_output`,call_id:e.toolCallId,output:t.output});continue}if(u&&i===`shell`&&n.type===`json`){let t=await Sh({value:n.value,schema:$v});p.push({type:`shell_call_output`,call_id:e.toolCallId,output:t.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`timeout`?{type:`timeout`}:{type:`exit`,exit_code:e.outcome.exitCode}}))});continue}if(d&&e.toolName===`apply_patch`&&n.type===`json`){let t=await Sh({value:n.value,schema:jv});p.push({type:`apply_patch_call_output`,call_id:e.toolCallId,status:t.status,output:t.output});continue}if(f?.has(i)){let t;switch(n.type){case`text`:case`error-text`:t=n.value;break;case`execution-denied`:t=n.reason??`Tool call execution denied.`;break;case`json`:case`error-json`:t=JSON.stringify(n.value);break;case`content`:t=n.value.map(e=>{let t=E_(e.providerOptions,r);switch(e.type){case`text`:return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}};case`file`:{let n=tm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Nh({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${Kp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${Kp(e.data.data)}`,...t!=null&&{prompt_cache_breakpoint:t}}}if(e.data.type===`url`)return n===`image`?{type:`input_image`,image_url:e.data.url.toString(),detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,file_url:e.data.url.toString(),...t!=null&&{prompt_cache_breakpoint:t}};m.push({type:`other`,message:`unsupported custom tool content part type: ${e.type} with data type: ${e.data.type}`});return}default:m.push({type:`other`,message:`unsupported custom tool content part type: ${e.type}`});return}}).filter(xm);break;default:t=``}p.push({type:`custom_tool_call_output`,call_id:e.toolCallId,output:t});continue}let a;switch(n.type){case`text`:case`error-text`:a=n.value;break;case`execution-denied`:a=n.reason??`Tool call execution denied.`;break;case`json`:case`error-json`:a=JSON.stringify(n.value);break;case`content`:a=n.value.map(e=>{let t=E_(e.providerOptions,r);switch(e.type){case`text`:return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}};case`file`:{let n=tm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Nh({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${Kp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${Kp(e.data.data)}`,...t!=null&&{prompt_cache_breakpoint:t}}}if(e.data.type===`url`)return n===`image`?{type:`input_image`,image_url:e.data.url.toString(),detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,file_url:e.data.url.toString(),...t!=null&&{prompt_cache_breakpoint:t}};m.push({type:`other`,message:`unsupported tool content part type: ${e.type} with data type: ${e.data.type}`});return}default:m.push({type:`other`,message:`unsupported tool content part type: ${e.type}`});return}}).filter(xm);break}p.push({type:`function_call_output`,call_id:e.toolCallId,output:a})}break;default:throw Error(`Unsupported role: ${g}`)}return!o&&p.some(e=>`type`in e&&e.type===`reasoning`&&e.encrypted_content==null)&&(m.push({type:`other`,message:`Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts.`}),p=p.filter(e=>!(`type`in e)||e.type!==`reasoning`||e.encrypted_content!=null)),{input:p,warnings:m}}function k_({finishReason:e,hasFunctionCall:t}){switch(e){case void 0:case null:return t?`tool-calls`:`stop`;case`max_output_tokens`:return`length`;case`content_filter`:return`content-filter`;default:return t?`tool-calls`:`other`}}async function A_({tools:e,toolChoice:t,allowedTools:n,toolNameMapping:r,customProviderToolNames:i}){e=e?.length?e:void 0;let a=[];if(e==null)return{tools:void 0,toolChoice:void 0,toolWarnings:a};let o=[],s=new Map,c=i??new Set;for(let t of e)switch(t.type){case`function`:{let e=t.providerOptions?.openai,n=j_({tool:t,options:e}),r=e?.namespace;if(r==null)o.push(n);else{let e=s.get(r.name);if(e==null)e={type:`namespace`,name:r.name,description:r.description,tools:[]},s.set(r.name,e),o.push(e);else if(e.description!==r.description)throw new pa({functionality:`conflicting descriptions for OpenAI tool namespace "${r.name}"`});e.tools.push(n)}break}case`provider`:switch(t.id){case`openai.file_search`:{let e=await Sh({value:t.args,schema:Uv});o.push({type:`file_search`,vector_store_ids:e.vectorStoreIds,max_num_results:e.maxNumResults,ranking_options:e.ranking?{ranker:e.ranking.ranker,score_threshold:e.ranking.scoreThreshold}:void 0,filters:e.filters});break}case`openai.local_shell`:o.push({type:`local_shell`});break;case`openai.shell`:{let e=await Sh({value:t.args,schema:ty});o.push({type:`shell`,...e.environment&&{environment:M_(e.environment)}});break}case`openai.apply_patch`:o.push({type:`apply_patch`});break;case`openai.web_search_preview`:{let e=await Sh({value:t.args,schema:dy});o.push({type:`web_search_preview`,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case`openai.web_search`:{let e=await Sh({value:t.args,schema:cy});o.push({type:`web_search`,filters:e.filters==null?void 0:{allowed_domains:e.filters.allowedDomains},external_web_access:e.externalWebAccess,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case`openai.code_interpreter`:{let e=await Sh({value:t.args,schema:Fv});o.push({type:`code_interpreter`,container:e.container==null?{type:`auto`,file_ids:void 0}:typeof e.container==`string`?e.container:{type:`auto`,file_ids:e.container.fileIds}});break}case`openai.image_generation`:{let e=await Sh({value:t.args,schema:Kv});o.push({type:`image_generation`,background:e.background,input_fidelity:e.inputFidelity,input_image_mask:e.inputImageMask?{file_id:e.inputImageMask.fileId,image_url:e.inputImageMask.imageUrl}:void 0,model:e.model,moderation:e.moderation,partial_images:e.partialImages,quality:e.quality,output_compression:e.outputCompression,output_format:e.outputFormat,size:e.size});break}case`openai.mcp`:{let e=await Sh({value:t.args,schema:my}),n=e=>({tool_names:e.toolNames}),r=e.requireApproval,i=r==null?void 0:typeof r==`string`?r:r.never==null?void 0:{never:n(r.never)};o.push({type:`mcp`,server_label:e.serverLabel,allowed_tools:Array.isArray(e.allowedTools)?e.allowedTools:e.allowedTools?{read_only:e.allowedTools.readOnly,tool_names:e.allowedTools.toolNames}:void 0,authorization:e.authorization,connector_id:e.connectorId,headers:e.headers,require_approval:i??`never`,server_description:e.serverDescription,server_url:e.serverUrl});break}case`openai.custom`:{let e=await Sh({value:t.args,schema:Rv});o.push({type:`custom`,name:t.name,description:e.description,format:e.format}),c.add(t.name);break}case`openai.tool_search`:{let e=await Sh({value:t.args,schema:ry});o.push({type:`tool_search`,...e.execution==null?{}:{execution:e.execution},...e.description==null?{}:{description:e.description},...e.parameters==null?{}:{parameters:e.parameters}});break}}break;default:a.push({type:`unsupported`,feature:`function tool ${t}`});break}if(n!=null)return{tools:o,toolChoice:{type:`allowed_tools`,mode:n.mode??`auto`,tools:n.toolNames.map(e=>({type:`function`,name:r?.toProviderToolName(e)??e}))},toolWarnings:a};if(t==null)return{tools:o,toolChoice:void 0,toolWarnings:a};let l=t.type;switch(l){case`auto`:case`none`:case`required`:return{tools:o,toolChoice:l,toolWarnings:a};case`tool`:{let e=r?.toProviderToolName(t.toolName)??t.toolName;return{tools:o,toolChoice:e===`code_interpreter`||e===`file_search`||e===`image_generation`||e===`web_search_preview`||e===`web_search`||e===`mcp`||e===`apply_patch`?{type:e}:c.has(e)?{type:`custom`,name:e}:{type:`function`,name:e},toolWarnings:a}}default:throw new pa({functionality:`tool choice type: ${l}`})}}function j_({tool:e,options:t}){let n=t?.deferLoading;return{type:`function`,name:e.name,description:e.description,parameters:e.inputSchema,...e.strict==null?{}:{strict:e.strict},...n==null?{}:{defer_loading:n}}}function M_(e){if(e.type===`containerReference`)return{type:`container_reference`,container_id:e.containerId};if(e.type===`containerAuto`){let t=e;return{type:`container_auto`,file_ids:t.fileIds,memory_limit:t.memoryLimit,network_policy:t.networkPolicy==null?void 0:t.networkPolicy.type===`disabled`?{type:`disabled`}:{type:`allowlist`,allowed_domains:t.networkPolicy.allowedDomains,domain_secrets:t.networkPolicy.domainSecrets},skills:N_(t.skills)}}return{type:`local`,skills:e.skills}}function N_(e){return e?.map(e=>e.type===`skillReference`?{type:`skill_reference`,skill_id:Ph({reference:e.providerReference??{},provider:`openai`}),version:e.version??`latest`}:{type:`inline`,name:e.name,description:e.description,source:{type:`base64`,media_type:e.source.mediaType,data:e.source.data}})}function P_(e){let t={};for(let n of e)if(n.role===`assistant`)for(let e of n.content){if(e.type!==`tool-call`)continue;let n=e.providerOptions?.openai?.approvalRequestId;n!=null&&(t[n]=e.toolCallId)}return t}function F_(e){return e.type===`response.output_text.delta`}function I_(e){let t=R_(e);return t!=null&&Array.isArray(t.choices)&&typeof t.type!=`string`}function L_({value:e,cause:t,url:n,requestBodyValues:r,responseHeaders:i}){return new $r({message:`Received a Chat Completions stream while using the OpenAI Responses API. The default OpenAI provider model uses the Responses API. If your custom baseURL targets a Chat Completions-compatible endpoint, use openai.chat('model-id') or createOpenAI(...).chat('model-id') instead. You can also use @ai-sdk/openai-compatible for OpenAI-compatible providers.`,url:n,requestBodyValues:r,responseHeaders:i,responseBody:JSON.stringify(e),cause:t,data:e,isRetryable:!1})}function R_(e){return typeof e==`object`&&e?e:void 0}function z_(e){return e.type===`response.output_item.done`}function B_(e){return e.type===`response.completed`||e.type===`response.incomplete`}function V_(e){return e.type===`response.failed`}function H_(e){return e.type===`response.created`}function U_(e){return e.type===`response.function_call_arguments.delta`}function W_(e){return e.type===`response.custom_tool_call_input.delta`}function G_(e){return e.type===`response.image_generation_call.partial_image`}function K_(e){return e.type===`response.code_interpreter_call_code.delta`}function q_(e){return e.type===`response.code_interpreter_call_code.done`}function J_(e){return e.type===`response.apply_patch_call_operation_diff.delta`}function Y_(e){return e.type===`response.apply_patch_call_operation_diff.done`}function X_(e){return e.type===`response.output_item.added`}function Z_(e){return e.type===`response.output_text.annotation.added`}function Q_(e){return e.type===`error`}function $_(e){return!(e.type===`response.created`||e.type===`response.failed`||e.type===`error`||e.type===`unknown_chunk`)}function ev(e){if(e==null)return{};switch(e.type){case`search`:return{action:{type:`search`,query:e.query??void 0,...e.queries!=null&&{queries:e.queries}},...e.sources!=null&&{sources:e.sources}};case`open_page`:return{action:{type:`openPage`,url:e.url}};case`find_in_page`:return{action:{type:`findInPage`,url:e.url,pattern:e.pattern}}}}function tv(e){return JSON.stringify(e).slice(1,-1)}function nv(e){return e===`gpt-realtime-whisper`||e.startsWith(`gpt-realtime-whisper-`)}function rv({webSocket:e,url:t,headers:n,sessionUpdate:r,language:i,warnings:a,audio:o,abortSignal:s,includeRawChunks:c}){let l=!1,u=()=>{};return new ReadableStream({start:d=>{let f=new(Bh(e))(t,av(n),{headers:n}),p;u=e=>{s?.removeEventListener(`abort`,g),p?.cancel().catch(()=>{});try{f.close(e)}catch{}};let m=e=>{l||(l=!0,u(),d.error(e))},h=(e,t)=>{l||(l=!0,t!=null&&d.enqueue({type:`transcript-final`,id:t,text:e}),d.enqueue({type:`finish`,text:e,segments:[],language:i}),d.close(),u(1e3))},g=()=>{m(s?.reason??Error(`Aborted`))};if(s?.aborted){g();return}s?.addEventListener(`abort`,g,{once:!0});let _=async()=>{p=o.getReader();try{for(;;){let{done:e,value:t}=await p.read();if(e||l)break;f.send(JSON.stringify({type:`input_audio_buffer.append`,audio:Kp(t)}))}}finally{p.releaseLock()}l||f.send(JSON.stringify({type:`input_audio_buffer.commit`}))};f.onopen=()=>{d.enqueue({type:`stream-start`,warnings:a}),f.send(JSON.stringify(r)),_().catch(m)},f.onmessage=e=>{Hh(e.data).then(async e=>{let t=await Th({text:e});if(!t.success)return;let n=t.value;switch(c&&d.enqueue({type:`raw`,rawValue:n}),n.type){case`conversation.item.input_audio_transcription.delta`:d.enqueue({type:`transcript-delta`,id:n.item_id,delta:n.delta??``});break;case`conversation.item.input_audio_transcription.completed`:h(n.transcript??``,n.item_id);break;case`error`:m(Error(n.error?.message??`OpenAI realtime error`));break}}).catch(m)},f.onerror=()=>{m(Error(`OpenAI realtime transcription error`))},f.onclose=()=>{l||(l=!0,u(),d.close())}},cancel:()=>{l||(l=!0,u())}})}function iv({modelId:e,inputAudioFormat:t,providerOptions:n}){return{type:`session.update`,session:{type:`transcription`,audio:{input:{format:{type:t.type,...t.rate==null?{}:{rate:t.rate}},transcription:{model:e,...n?.language==null?{}:{language:n.language},...n?.streaming?.delay==null?{}:{delay:n.streaming.delay}},turn_detection:null}},...n?.streaming?.include==null?{}:{include:n.streaming.include}}}}function av(e){let t=e.Authorization??e.authorization,n=t?.startsWith(`Bearer `)?t.slice(7):void 0;return n==null?[`realtime`]:[`realtime`,`openai-insecure-api-key.${n}`]}function ov(e={}){let t=Uh(Tm({settingValue:e.baseURL,environmentVariableName:`OPENAI_BASE_URL`}))??`https://api.openai.com/v1`,n=e.name??`openai`,r=()=>ym({Authorization:`Bearer ${wm({apiKey:e.apiKey,environmentVariableName:`OPENAI_API_KEY`,description:`OpenAI`})}`,"OpenAI-Organization":e.organization,"OpenAI-Project":e.project,...e.headers},`ai-sdk/openai/${Iy}`),i=i=>new fv(i,{provider:`${n}.chat`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),a=i=>new gv(i,{provider:`${n}.completion`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),o=i=>new yv(i,{provider:`${n}.embedding`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),s=i=>new kv(i,{provider:`${n}.image`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),c=i=>new Ny(i,{provider:`${n}.transcription`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,webSocket:e.webSocket}),l=i=>new ky(i,{provider:`${n}.speech`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),u=()=>new Sv({provider:`${n}.files`,baseURL:t,headers:r,fetch:e.fetch}),d=()=>new Fy({provider:`${n}.skills`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),f=e=>{if(new.target)throw Error(`The OpenAI model function cannot be called with the new keyword.`);return p(e)},p=i=>new Dy(i,{provider:`${n}.responses`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,fileIdPrefixes:[`file-`]}),m=i=>new vy(i,{provider:`${n}.realtime`,baseURL:t,headers:r,fetch:e.fetch}),h=Object.assign(e=>m(e),{getToken:async e=>{let t=await m(e.model).doCreateClientSecret({sessionConfig:e.sessionConfig,expiresAfterSeconds:e.expiresAfterSeconds});return{token:t.token,url:t.url,expiresAt:t.expiresAt}}}),g=function(e){return f(e)};return g.specificationVersion=`v4`,g.languageModel=f,g.chat=i,g.completion=a,g.responses=p,g.embedding=o,g.embeddingModel=o,g.textEmbedding=o,g.textEmbeddingModel=o,g.image=s,g.imageModel=s,g.transcription=c,g.transcriptionModel=c,g.speech=l,g.speechModel=l,g.files=u,g.skills=d,g.experimental_realtime=h,g.tools=_y,g}var sv,cv,lv,uv,dv,fv,pv,mv,hv,gv,_v,vv,yv,bv,xv,Sv,Cv,wv,Tv,Ev,Dv,Ov,kv,Av,jv,Mv,Nv,Pv,Fv,Iv,Lv,Rv,zv,Bv,Vv,Hv,Uv,Wv,Gv,Kv,qv,Jv,Yv,Xv,Zv,Qv,$v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly=t((()=>{Xg(),Nd(),ma(),sv=z({error:z({message:I(),type:I().nullish(),param:cu().nullish(),code:B([I(),L()]).nullish()})}),cv=Wg({errorSchema:sv,errorToMessage:e=>e.error.message}),lv=K(()=>q(z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({message:z({role:H(`assistant`).nullish(),content:I().nullish(),tool_calls:R(z({id:I().nullish(),type:H(`function`),function:z({name:I(),arguments:I()})})).nullish(),annotations:R(z({type:H(`url_citation`),url_citation:z({start_index:L(),end_index:L(),url:I(),title:I()})})).nullish()}),index:L(),logprobs:z({content:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}).nullish(),finish_reason:I().nullish()})),usage:z({prompt_tokens:L().nullish(),completion_tokens:L().nullish(),total_tokens:L().nullish(),prompt_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish()}).nullish(),completion_tokens_details:z({reasoning_tokens:L().nullish(),accepted_prediction_tokens:L().nullish(),rejected_prediction_tokens:L().nullish()}).nullish()}).nullish()}))),uv=K(()=>q(B([z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({delta:z({role:V([`assistant`]).nullish(),content:I().nullish(),tool_calls:R(z({index:L(),id:I().nullish(),type:H(`function`).nullish(),function:z({name:I().nullish(),arguments:I().nullish()})})).nullish(),annotations:R(z({type:H(`url_citation`),url_citation:z({start_index:L(),end_index:L(),url:I(),title:I()})})).nullish()}).nullish(),logprobs:z({content:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}).nullish(),finish_reason:I().nullish(),index:L()})),usage:z({prompt_tokens:L().nullish(),completion_tokens:L().nullish(),total_tokens:L().nullish(),prompt_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish()}).nullish(),completion_tokens_details:z({reasoning_tokens:L().nullish(),accepted_prediction_tokens:L().nullish(),rejected_prediction_tokens:L().nullish()}).nullish()}).nullish()}),sv]))),dv=K(()=>q(z({logitBias:hu(kd(),L()).optional(),logprobs:B([ou(),L()]).optional(),parallelToolCalls:ou().optional(),user:I().optional(),reasoningEffort:V([`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]).optional(),maxCompletionTokens:L().optional(),store:ou().optional(),metadata:hu(I().max(64),I().max(512)).optional(),prediction:hu(I(),cu()).optional(),serviceTier:V([`auto`,`flex`,`priority`,`default`]).optional(),strictJsonSchema:ou().optional(),textVerbosity:V([`low`,`medium`,`high`]).optional(),promptCacheKey:I().optional(),promptCacheOptions:z({mode:V([`implicit`,`explicit`]).optional(),ttl:H(`30m`).optional()}).optional(),promptCacheRetention:V([`in_memory`,`24h`]).optional(),safetyIdentifier:I().optional(),systemMessageMode:V([`system`,`developer`,`remove`]).optional(),forceReasoning:ou().optional()}))),fv=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:r,topK:i,frequencyPenalty:a,presencePenalty:o,stopSequences:s,responseFormat:c,seed:l,tools:u,toolChoice:d,reasoning:f,providerOptions:p}){let m=[],h=await Dh({provider:`openai`,providerOptions:p,schema:dv})??{},g=Zg(this.modelId),_=h.reasoningEffort??(Em(f)?f:void 0),v=h.forceReasoning??g.isReasoningModel;i!=null&&m.push({type:`unsupported`,feature:`topK`});let{messages:y,warnings:b}=c_({prompt:e,systemMessageMode:h.systemMessageMode??(v?`developer`:g.systemMessageMode)});m.push(...b);let x=h.strictJsonSchema??!0,S={model:this.modelId,logit_bias:h.logitBias,logprobs:h.logprobs===!0||typeof h.logprobs==`number`||void 0,top_logprobs:typeof h.logprobs==`number`?h.logprobs:typeof h.logprobs==`boolean`&&h.logprobs?0:void 0,user:h.user,parallel_tool_calls:h.parallelToolCalls,max_tokens:t,temperature:n,top_p:r,frequency_penalty:a,presence_penalty:o,response_format:c?.type===`json`?c.schema==null?{type:`json_object`}:{type:`json_schema`,json_schema:{schema:c.schema,strict:x,name:c.name??`response`,description:c.description}}:void 0,stop:s,seed:l,verbosity:h.textVerbosity,max_completion_tokens:h.maxCompletionTokens,store:h.store,metadata:h.metadata,prediction:h.prediction,reasoning_effort:_,service_tier:h.serviceTier,prompt_cache_key:h.promptCacheKey,prompt_cache_options:h.promptCacheOptions,prompt_cache_retention:h.promptCacheRetention,safety_identifier:h.safetyIdentifier,messages:y};v?((_!==`none`||!g.supportsNonReasoningParameters)&&(S.temperature!=null&&(S.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for reasoning models`})),S.top_p!=null&&(S.top_p=void 0,m.push({type:`unsupported`,feature:`topP`,details:`topP is not supported for reasoning models`})),S.logprobs!=null&&(S.logprobs=void 0,m.push({type:`other`,message:`logprobs is not supported for reasoning models`}))),S.frequency_penalty!=null&&(S.frequency_penalty=void 0,m.push({type:`unsupported`,feature:`frequencyPenalty`,details:`frequencyPenalty is not supported for reasoning models`})),S.presence_penalty!=null&&(S.presence_penalty=void 0,m.push({type:`unsupported`,feature:`presencePenalty`,details:`presencePenalty is not supported for reasoning models`})),S.logit_bias!=null&&(S.logit_bias=void 0,m.push({type:`other`,message:`logitBias is not supported for reasoning models`})),S.top_logprobs!=null&&(S.top_logprobs=void 0,m.push({type:`other`,message:`topLogprobs is not supported for reasoning models`})),S.max_tokens!=null&&(S.max_completion_tokens??=S.max_tokens,S.max_tokens=void 0)):(this.modelId.startsWith(`gpt-4o-search-preview`)||this.modelId.startsWith(`gpt-4o-mini-search-preview`))&&S.temperature!=null&&(S.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for the search preview models and has been removed.`})),h.serviceTier===`flex`&&!g.supportsFlexProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`flex processing is only available for o3, o4-mini, and gpt-5 models`}),S.service_tier=void 0),h.serviceTier===`priority`&&!g.supportsPriorityProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported`}),S.service_tier=void 0);let{tools:C,toolChoice:w,toolWarnings:T}=d_({tools:u,toolChoice:d});return{args:{...S,tools:C,tool_choice:w},warnings:[...m,...T]}}async doGenerate(e){var t;let{args:n,warnings:r}=await this.getArgs(e),{responseHeaders:i,value:a,rawValue:o}=await zg({url:this.config.url({path:`/chat/completions`,modelId:this.modelId}),headers:Up((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:cv,successfulResponseHandler:Kg(lv),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=a.choices[0],c=[],l=s.message.content;l!=null&&l.length>0&&c.push({type:`text`,text:l});for(let e of s.message.tool_calls??[])c.push({type:`tool-call`,toolCallId:e.id??cg(),toolName:e.function.name,input:e.function.arguments});for(let e of s.message.annotations??[])c.push({type:`source`,sourceType:`url`,id:cg(),url:e.url_citation.url,title:e.url_citation.title});let u=a.usage?.completion_tokens_details,d={openai:{}};return u?.accepted_prediction_tokens!=null&&(d.openai.acceptedPredictionTokens=u?.accepted_prediction_tokens),u?.rejected_prediction_tokens!=null&&(d.openai.rejectedPredictionTokens=u?.rejected_prediction_tokens),s.logprobs?.content!=null&&(d.openai.logprobs=s.logprobs.content),{content:c,finishReason:{unified:u_(s.finish_reason),raw:s.finish_reason??void 0},usage:a_(a.usage),request:{body:n},response:{...l_(a),headers:i,body:o},warnings:r,providerMetadata:d}}async doStream(e){var t;let{args:n,warnings:r}=await this.getArgs(e),i={...n,stream:!0,stream_options:{include_usage:!0}},a=this.config.url({path:`/chat/completions`,modelId:this.modelId}),{responseHeaders:o,value:s}=await zg({url:a,headers:Up((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:cv,successfulResponseHandler:Gg(uv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await Qg({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:f_,url:a,requestBodyValues:i,responseHeaders:o}),l,u={unified:`other`,raw:void 0},d,f=!1,p=!1,m={openai:{}};return{stream:c.pipeThrough(new TransformStream({start(e){l=new Jg(e,{generateId:cg,typeValidation:`if-present`}),e.enqueue({type:`stream-start`,warnings:r})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){u={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:t.error});return}let r=t.value;if(`error`in r){u={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:r.error});return}if(!f){let e=l_(r);Object.values(e).some(Boolean)&&(f=!0,n.enqueue({type:`response-metadata`,...l_(r)}))}r.usage!=null&&(d=r.usage,r.usage.completion_tokens_details?.accepted_prediction_tokens!=null&&(m.openai.acceptedPredictionTokens=r.usage.completion_tokens_details?.accepted_prediction_tokens),r.usage.completion_tokens_details?.rejected_prediction_tokens!=null&&(m.openai.rejectedPredictionTokens=r.usage.completion_tokens_details?.rejected_prediction_tokens));let i=r.choices[0];if(i?.finish_reason!=null&&(u={unified:u_(i.finish_reason),raw:i.finish_reason}),i?.logprobs?.content!=null&&(m.openai.logprobs=i.logprobs.content),i?.delta==null)return;let a=i.delta;if(a.content!=null&&(p||=(n.enqueue({type:`text-start`,id:`0`}),!0),n.enqueue({type:`text-delta`,id:`0`,delta:a.content})),a.tool_calls!=null)for(let e of a.tool_calls)l.processDelta(e);if(a.annotations!=null)for(let e of a.annotations)n.enqueue({type:`source`,sourceType:`url`,id:cg(),url:e.url_citation.url,title:e.url_citation.title})},flush(e){p&&e.enqueue({type:`text-end`,id:`0`}),l.flush(),e.enqueue({type:`finish`,finishReason:u,usage:a_(d),...m==null?{}:{providerMetadata:m}})}})),request:{body:i},response:{headers:o}}}},pv=K(()=>q(z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({text:I(),finish_reason:I(),logprobs:z({tokens:R(I()),token_logprobs:R(L()),top_logprobs:R(hu(I(),L())).nullish()}).nullish()})),usage:z({prompt_tokens:L(),completion_tokens:L(),total_tokens:L()}).nullish()}))),mv=K(()=>q(B([z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({text:I(),finish_reason:I().nullish(),index:L(),logprobs:z({tokens:R(I()),token_logprobs:R(L()),top_logprobs:R(hu(I(),L())).nullish()}).nullish()})),usage:z({prompt_tokens:L(),completion_tokens:L(),total_tokens:L()}).nullish()}),sv]))),hv=K(()=>q(z({echo:ou().optional(),logitBias:hu(I(),L()).optional(),suffix:I().optional(),user:I().optional(),logprobs:B([ou(),L()]).optional()}))),gv=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={},this.modelId=e,this.config=t}get providerOptionsName(){return this.config.provider.split(`.`)[0].trim()}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:r,topK:i,frequencyPenalty:a,presencePenalty:o,stopSequences:s,responseFormat:c,tools:l,toolChoice:u,seed:d,providerOptions:f}){let p=[],m={...await Dh({provider:`openai`,providerOptions:f,schema:hv}),...await Dh({provider:this.providerOptionsName,providerOptions:f,schema:hv})};i!=null&&p.push({type:`unsupported`,feature:`topK`}),l?.length&&p.push({type:`unsupported`,feature:`tools`}),u!=null&&p.push({type:`unsupported`,feature:`toolChoice`}),c!=null&&c.type!==`text`&&p.push({type:`unsupported`,feature:`responseFormat`,details:`JSON response format is not supported.`});let{prompt:h,stopSequences:g}=m_({prompt:e}),_=[...g??[],...s??[]];return{args:{model:this.modelId,echo:m.echo,logit_bias:m.logitBias,logprobs:m?.logprobs===!0?0:m?.logprobs===!1?void 0:m?.logprobs,suffix:m.suffix,user:m.user,max_tokens:t,temperature:n,top_p:r,frequency_penalty:a,presence_penalty:o,seed:d,prompt:h,stop:_.length>0?_:void 0},warnings:p}}async doGenerate(e){var t;let{args:n,warnings:r}=await this.getArgs(e),{responseHeaders:i,value:a,rawValue:o}=await zg({url:this.config.url({path:`/completions`,modelId:this.modelId}),headers:Up((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:cv,successfulResponseHandler:Kg(pv),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=a.choices[0],c={openai:{}};return s.logprobs!=null&&(c.openai.logprobs=s.logprobs),{content:[{type:`text`,text:s.text}],usage:p_(a.usage),finishReason:{unified:g_(s.finish_reason),raw:s.finish_reason??void 0},request:{body:n},response:{...h_(a),headers:i,body:o},providerMetadata:c,warnings:r}}async doStream(e){var t;let{args:n,warnings:r}=await this.getArgs(e),i={...n,stream:!0,stream_options:{include_usage:!0}},a=this.config.url({path:`/completions`,modelId:this.modelId}),{responseHeaders:o,value:s}=await zg({url:a,headers:Up((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:cv,successfulResponseHandler:Gg(mv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await Qg({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:__,url:a,requestBodyValues:i,responseHeaders:o}),l={unified:`other`,raw:void 0},u={openai:{}},d,f=!0;return{stream:c.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:r})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){l={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:t.error});return}let r=t.value;if(`error`in r){l={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:r.error});return}f&&(f=!1,n.enqueue({type:`response-metadata`,...h_(r)}),n.enqueue({type:`text-start`,id:`0`})),r.usage!=null&&(d=r.usage);let i=r.choices[0];i?.finish_reason!=null&&(l={unified:g_(i.finish_reason),raw:i.finish_reason}),i?.logprobs!=null&&(u.openai.logprobs=i.logprobs),i?.text!=null&&i.text.length>0&&n.enqueue({type:`text-delta`,id:`0`,delta:i.text})},flush(e){f||e.enqueue({type:`text-end`,id:`0`}),e.enqueue({type:`finish`,finishReason:l,providerMetadata:u,usage:p_(d)})}})),request:{body:i},response:{headers:o}}}},_v=K(()=>q(z({dimensions:L().optional(),user:I().optional()}))),vv=K(()=>q(z({data:R(z({embedding:R(L())})),usage:z({prompt_tokens:L()}).nullish()}))),yv=class e{constructor(e,t){this.specificationVersion=`v4`,this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=e,this.config=t}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:r}){var i;if(e.length>this.maxEmbeddingsPerCall)throw new ta({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:e});let a=await Dh({provider:`openai`,providerOptions:r,schema:_v})??{},{responseHeaders:o,value:s,rawValue:c}=await zg({url:this.config.url({path:`/embeddings`,modelId:this.modelId}),headers:Up((i=this.config).headers?.call(i),t),body:{model:this.modelId,input:e,encoding_format:`float`,dimensions:a.dimensions,user:a.user},failedResponseHandler:cv,successfulResponseHandler:Kg(vv),abortSignal:n,fetch:this.config.fetch});return{warnings:[],embeddings:s.data.map(e=>e.embedding),usage:s.usage?{tokens:s.usage.prompt_tokens}:void 0,response:{headers:o,body:c}}}},bv=K(()=>q(z({id:I(),object:I().nullish(),bytes:L().nullish(),created_at:L().nullish(),filename:I().nullish(),purpose:I().nullish(),status:I().nullish(),expires_at:L().nullish()}))),xv=K(()=>q(z({purpose:I().optional(),expiresAfter:L().optional()}))),Sv=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadFile({data:e,mediaType:t,filename:n,providerOptions:r}){let i=await Dh({provider:`openai`,providerOptions:r,schema:xv}),a=qp(e),o=new Blob([a],{type:t}),s=new FormData;n==null?s.append(`file`,o):s.append(`file`,o,n),s.append(`purpose`,i?.purpose??`assistants`),i?.expiresAfter!=null&&s.append(`expires_after`,String(i.expiresAfter));let{value:c}=await Bg({url:`${this.config.baseURL}/files`,headers:Up(this.config.headers()),formData:s,failedResponseHandler:cv,successfulResponseHandler:Kg(bv),fetch:this.config.fetch});return{warnings:[],providerReference:{openai:c.id},...c.filename??n?{filename:c.filename??n}:{},...t==null?{}:{mediaType:t},providerMetadata:{openai:{...c.filename==null?{}:{filename:c.filename},...c.purpose==null?{}:{purpose:c.purpose},...c.bytes==null?{}:{bytes:c.bytes},...c.created_at==null?{}:{createdAt:c.created_at},...c.status==null?{}:{status:c.status},...c.expires_at==null?{}:{expiresAt:c.expires_at}}}}}},Cv=K(()=>q(z({created:L().nullish(),data:R(z({b64_json:I(),revised_prompt:I().nullish()})),background:I().nullish(),output_format:I().nullish(),size:I().nullish(),quality:I().nullish(),usage:z({input_tokens:L().nullish(),output_tokens:L().nullish(),total_tokens:L().nullish(),input_tokens_details:z({image_tokens:L().nullish(),text_tokens:L().nullish()}).nullish()}).nullish()}))),wv={"dall-e-3":1,"dall-e-2":10,"gpt-image-1":10,"gpt-image-1-mini":10,"gpt-image-1.5":10,"gpt-image-2":10,"chatgpt-image-latest":10},Tv=[`chatgpt-image-`,`gpt-image-1-mini`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-2`],Ev=z({quality:V([`standard`,`hd`,`low`,`medium`,`high`,`auto`]).optional(),background:V([`transparent`,`opaque`,`auto`]).optional(),outputFormat:V([`png`,`jpeg`,`webp`]).optional(),outputCompression:L().int().min(0).max(100).optional(),user:I().optional()}),Dv=K(()=>q(Ev.extend({style:V([`vivid`,`natural`]).optional(),moderation:V([`auto`,`low`]).optional()}))),Ov=K(()=>q(Ev.extend({inputFidelity:V([`high`,`low`]).optional()}))),kv=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get maxImagesPerCall(){return wv[this.modelId]??1}get provider(){return this.config.provider}async doGenerate({prompt:e,files:t,mask:n,n:r,size:i,aspectRatio:a,seed:o,providerOptions:s,headers:c,abortSignal:l}){var u,d,f;let p=[];a!=null&&p.push({type:`unsupported`,feature:`aspectRatio`,details:"This model does not support aspect ratio. Use `size` instead."}),o!=null&&p.push({type:`unsupported`,feature:`seed`});let m=((u=this.config._internal)?.currentDate)?.call(u)??new Date;if(t!=null){let a=await Dh({provider:`openai`,providerOptions:s,schema:Ov})??{},{value:o,responseHeaders:u}=await Bg({url:this.config.url({path:`/images/edits`,modelId:this.modelId}),headers:Up((d=this.config).headers?.call(d),c),formData:Jp({model:this.modelId,prompt:e,image:await Promise.all(t.map(e=>e.type===`file`?new Blob([e.data instanceof Uint8Array?new Blob([e.data],{type:e.mediaType}):new Blob([Wp(e.data)],{type:e.mediaType})],{type:e.mediaType}):fm(e.url))),mask:n==null?void 0:await b_(n),n:r,size:i,quality:a.quality,background:a.background,output_format:a.outputFormat,output_compression:a.outputCompression,input_fidelity:a.inputFidelity,user:a.user}),failedResponseHandler:cv,successfulResponseHandler:Kg(Cv),abortSignal:l,fetch:this.config.fetch});return{images:o.data.map(e=>e.b64_json),warnings:p,usage:o.usage==null?void 0:{inputTokens:o.usage.input_tokens??void 0,outputTokens:o.usage.output_tokens??void 0,totalTokens:o.usage.total_tokens??void 0},response:{timestamp:m,modelId:this.modelId,headers:u},providerMetadata:{openai:{images:o.data.map((e,t)=>({...e.revised_prompt?{revisedPrompt:e.revised_prompt}:{},created:o.created??void 0,size:o.size??void 0,quality:o.quality??void 0,background:o.background??void 0,outputFormat:o.output_format??void 0,...y_(o.usage?.input_tokens_details,t,o.data.length)}))}}}}let h=await Dh({provider:`openai`,providerOptions:s,schema:Dv})??{},{value:g,responseHeaders:_}=await zg({url:this.config.url({path:`/images/generations`,modelId:this.modelId}),headers:Up((f=this.config).headers?.call(f),c),body:{model:this.modelId,prompt:e,n:r,size:i,quality:h.quality,style:h.style,background:h.background,moderation:h.moderation,output_format:h.outputFormat,output_compression:h.outputCompression,user:h.user,...v_(this.modelId)?{}:{response_format:`b64_json`}},failedResponseHandler:cv,successfulResponseHandler:Kg(Cv),abortSignal:l,fetch:this.config.fetch});return{images:g.data.map(e=>e.b64_json),warnings:p,usage:g.usage==null?void 0:{inputTokens:g.usage.input_tokens??void 0,outputTokens:g.usage.output_tokens??void 0,totalTokens:g.usage.total_tokens??void 0},response:{timestamp:m,modelId:this.modelId,headers:_},providerMetadata:{openai:{images:g.data.map((e,t)=>({...e.revised_prompt?{revisedPrompt:e.revised_prompt}:{},created:g.created??void 0,size:g.size??void 0,quality:g.quality??void 0,background:g.background??void 0,outputFormat:g.output_format??void 0,...y_(g.usage?.input_tokens_details,t,g.data.length)}))}}}}},Av=K(()=>q(z({callId:I(),operation:fu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}))),jv=K(()=>q(z({status:V([`completed`,`failed`]),output:I().optional()}))),Mv=Ah({id:`openai.apply_patch`,inputSchema:Av,outputSchema:jv}),Nv=K(()=>q(z({code:I().nullish(),containerId:I()}))),Pv=K(()=>q(z({outputs:R(fu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullish()}))),Fv=K(()=>q(z({container:B([I(),z({fileIds:R(I()).optional()})]).optional()}))),Iv=jh({id:`openai.code_interpreter`,inputSchema:Nv,outputSchema:Pv}),Lv=(e={})=>Iv(e),Rv=K(()=>q(z({description:I().optional(),format:B([z({type:H(`grammar`),syntax:V([`regex`,`lark`]),definition:I()}),z({type:H(`text`)})]).optional()}))),zv=kh({id:`openai.custom`,inputSchema:K(()=>q(I()))}),Bv=e=>zv(e),Vv=z({key:I(),type:V([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`]),value:B([I(),L(),ou(),R(I())])}),Hv=z({type:V([`and`,`or`]),filters:R(B([Vv,Tu(()=>Hv)]))}),Uv=K(()=>q(z({vectorStoreIds:R(I()),maxNumResults:L().optional(),ranking:z({ranker:I().optional(),scoreThreshold:L().optional()}).optional(),filters:B([Vv,Hv]).optional()}))),Wv=K(()=>q(z({queries:R(I()),results:R(z({attributes:hu(I(),lu()),fileId:I(),filename:I(),score:L(),text:I()})).nullable()}))),Gv=jh({id:`openai.file_search`,inputSchema:z({}),outputSchema:Wv}),Kv=K(()=>q(z({background:V([`auto`,`opaque`,`transparent`]).optional(),inputFidelity:V([`low`,`high`]).optional(),inputImageMask:z({fileId:I().optional(),imageUrl:I().optional()}).optional(),model:I().optional(),moderation:V([`auto`]).optional(),outputCompression:L().int().min(0).max(100).optional(),outputFormat:V([`png`,`jpeg`,`webp`]).optional(),partialImages:L().int().min(0).max(3).optional(),quality:V([`auto`,`low`,`medium`,`high`]).optional(),size:V([`1024x1024`,`1024x1536`,`1536x1024`,`auto`]).optional()}).strict())),qv=jh({id:`openai.image_generation`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({result:I()})))}),Jv=(e={})=>qv(e),Yv=K(()=>q(z({action:z({type:H(`exec`),command:R(I()),timeoutMs:L().optional(),user:I().optional(),workingDirectory:I().optional(),env:hu(I(),I()).optional()})}))),Xv=K(()=>q(z({output:I()}))),Zv=Ah({id:`openai.local_shell`,inputSchema:Yv,outputSchema:Xv}),Qv=K(()=>q(z({action:z({commands:R(I()),timeoutMs:L().optional(),maxOutputLength:L().optional()})}))),$v=K(()=>q(z({output:R(z({stdout:I(),stderr:I(),outcome:fu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exitCode:L()})])}))}))),ey=R(fu(`type`,[z({type:H(`skillReference`),providerReference:hu(I(),I()),version:I().optional()}),z({type:H(`inline`),name:I(),description:I(),source:z({type:H(`base64`),mediaType:H(`application/zip`),data:I()})})])).optional(),ty=K(()=>q(z({environment:B([z({type:H(`containerAuto`),fileIds:R(I()).optional(),memoryLimit:V([`1g`,`4g`,`16g`,`64g`]).optional(),networkPolicy:fu(`type`,[z({type:H(`disabled`)}),z({type:H(`allowlist`),allowedDomains:R(I()),domainSecrets:R(z({domain:I(),name:I(),value:I()})).optional()})]).optional(),skills:ey}),z({type:H(`containerReference`),containerId:I()}),z({type:H(`local`).optional(),skills:R(z({name:I(),description:I(),path:I()})).optional()})]).optional()}))),ny=Ah({id:`openai.shell`,inputSchema:Qv,outputSchema:$v}),ry=K(()=>q(z({execution:V([`server`,`client`]).optional(),description:I().optional(),parameters:hu(I(),lu()).optional()}))),iy=K(()=>q(z({arguments:lu().optional(),call_id:I().nullish()}))),ay=K(()=>q(z({tools:R(hu(I(),lu()))}))),oy=Ah({id:`openai.tool_search`,inputSchema:iy,outputSchema:ay}),sy=(e={})=>oy(e),cy=K(()=>q(z({externalWebAccess:ou().optional(),filters:z({allowedDomains:R(I()).optional()}).optional(),searchContextSize:V([`low`,`medium`,`high`]).optional(),userLocation:z({type:H(`approximate`),country:I().optional(),city:I().optional(),region:I().optional(),timezone:I().optional()}).optional()}))),ly=jh({id:`openai.web_search`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({action:fu(`type`,[z({type:H(`search`),query:I().optional(),queries:R(I()).optional()}),z({type:H(`openPage`),url:I().nullish()}),z({type:H(`findInPage`),url:I().nullish(),pattern:I().nullish()})]).optional(),sources:R(fu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).optional()})))}),uy=(e={})=>ly(e),dy=K(()=>q(z({searchContextSize:V([`low`,`medium`,`high`]).optional(),userLocation:z({type:H(`approximate`),country:I().optional(),city:I().optional(),region:I().optional(),timezone:I().optional()}).optional()}))),fy=jh({id:`openai.web_search_preview`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({action:fu(`type`,[z({type:H(`search`),query:I().optional()}),z({type:H(`openPage`),url:I().nullish()}),z({type:H(`findInPage`),url:I().nullish(),pattern:I().nullish()})]).optional()})))}),py=Tu(()=>B([I(),L(),ou(),su(),R(py),hu(I(),py)])),my=K(()=>q(z({serverLabel:I(),allowedTools:B([R(I()),z({readOnly:ou().optional(),toolNames:R(I()).optional()})]).optional(),authorization:I().optional(),connectorId:I().optional(),headers:hu(I(),I()).optional(),requireApproval:B([V([`always`,`never`]),z({never:z({toolNames:R(I()).optional()}).optional()})]).optional(),serverDescription:I().optional(),serverUrl:I().optional()}).refine(e=>e.serverUrl!=null||e.connectorId!=null,`One of serverUrl or connectorId must be provided.`))),hy=jh({id:`openai.mcp`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({type:H(`call`),serverLabel:I(),name:I(),arguments:I(),output:I().nullish(),error:B([I(),py]).optional()})))}),gy=e=>hy(e),_y={applyPatch:Mv,customTool:Bv,codeInterpreter:Lv,fileSearch:Gv,imageGeneration:Jv,localShell:Zv,shell:ny,webSearchPreview:fy,webSearch:uy,mcp:gy,toolSearch:sy},vy=class{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.provider=t.provider,this.config=t}async doCreateClientSecret(e){let t=this.config.fetch??fetch,n=`${this.config.baseURL}/realtime/client_secrets`,r=e.sessionConfig==null?{type:`realtime`,model:this.modelId}:C_(e.sessionConfig,this.modelId),i=await t(n,{method:`POST`,headers:{...this.config.headers(),"Content-Type":`application/json`},body:JSON.stringify({session:r,...e.expiresAfterSeconds==null?{}:{expires_after:{anchor:`created_at`,seconds:e.expiresAfterSeconds}}})});if(!i.ok){let e=await i.text();throw Error(`OpenAI realtime client secret request failed: ${i.status} ${e}`)}let a=await i.json();return{token:a.value,url:`wss://${new URL(this.config.baseURL).host}/v1/realtime?model=${encodeURIComponent(this.modelId)}`,expiresAt:a.expires_at}}getWebSocketConfig(e){return{url:e.url,protocols:[`realtime`,`openai-insecure-api-key.${e.token}`]}}parseServerEvent(e){return x_(e)}serializeClientEvent(e){return S_(e,this.modelId)}buildSessionConfig(e){return C_(e,this.modelId)}},yy=z({itemId:I().nullish(),reasoningEncryptedContent:I().nullish()}),by=Tu(()=>B([I(),L(),ou(),su(),R(by),hu(I(),by.optional())])),xy=z({type:H(`error`),sequence_number:L(),error:z({type:I(),code:I(),message:I(),param:I().nullish()})}),Sy=z({type:H(`error`),sequence_number:L(),code:I().nullish(),message:I(),param:I().nullish()}),Cy=K(()=>q(B([z({type:H(`response.output_text.delta`),item_id:I(),delta:I(),logprobs:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}),z({type:V([`response.completed`,`response.incomplete`]),response:z({incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}),reasoning:z({context:I().nullish()}).nullish(),service_tier:I().nullish()})}),z({type:H(`response.failed`),sequence_number:L(),response:z({error:z({code:I().nullish(),message:I()}).nullish(),incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}).nullish(),reasoning:z({context:I().nullish()}).nullish(),service_tier:I().nullish()})}),z({type:H(`response.created`),response:z({id:I(),created_at:L(),model:I(),service_tier:I().nullish()})}),z({type:H(`response.output_item.added`),output_index:L(),item:fu(`type`,[z({type:H(`message`),id:I(),phase:V([`commentary`,`final_answer`]).nullish()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish()}),z({type:H(`function_call`),id:I(),call_id:I(),name:I(),arguments:I(),namespace:I().nullish()}),z({type:H(`web_search_call`),id:I(),status:I()}),z({type:H(`computer_call`),id:I(),status:I()}),z({type:H(`file_search_call`),id:I()}),z({type:H(`image_generation_call`),id:I()}),z({type:H(`code_interpreter_call`),id:I(),container_id:I(),code:I().nullable(),outputs:R(fu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable(),status:I()}),z({type:H(`mcp_call`),id:I(),status:I(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I()}),z({type:H(`mcp_approval_request`),id:I()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:fu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`custom_tool_call`),id:I(),call_id:I(),name:I(),input:I()}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I().nullish()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:fu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:lu()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(hu(I(),by.optional()))})])}),z({type:H(`response.output_item.done`),output_index:L(),item:fu(`type`,[z({type:H(`message`),id:I(),phase:V([`commentary`,`final_answer`]).nullish()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish()}),z({type:H(`function_call`),id:I(),call_id:I(),name:I(),arguments:I(),status:H(`completed`),namespace:I().nullish()}),z({type:H(`custom_tool_call`),id:I(),call_id:I(),name:I(),input:I(),status:H(`completed`)}),z({type:H(`code_interpreter_call`),id:I(),code:I().nullable(),container_id:I(),outputs:R(fu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable()}),z({type:H(`image_generation_call`),id:I(),result:I()}),z({type:H(`web_search_call`),id:I(),status:I(),action:fu(`type`,[z({type:H(`search`),query:I().nullish(),queries:R(I()).nullish(),sources:R(fu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).nullish()}),z({type:H(`open_page`),url:I().nullish()}),z({type:H(`find_in_page`),url:I().nullish(),pattern:I().nullish()})]).nullish()}),z({type:H(`file_search_call`),id:I(),queries:R(I()),results:R(z({attributes:hu(I(),B([I(),L(),ou()])),file_id:I(),filename:I(),score:L(),text:I()})).nullish()}),z({type:H(`local_shell_call`),id:I(),call_id:I(),action:z({type:H(`exec`),command:R(I()),timeout_ms:L().optional(),user:I().optional(),working_directory:I().optional(),env:hu(I(),I()).optional()})}),z({type:H(`computer_call`),id:I(),status:H(`completed`)}),z({type:H(`mcp_call`),id:I(),status:I(),arguments:I(),name:I(),server_label:I(),output:I().nullish(),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).nullish(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I(),server_label:I(),tools:R(z({name:I(),description:I().optional(),input_schema:cu(),annotations:hu(I(),lu()).optional()})),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).optional()}),z({type:H(`mcp_approval_request`),id:I(),server_label:I(),name:I(),arguments:I(),approval_request_id:I().optional()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:fu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:fu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:lu()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(hu(I(),by.optional()))})])}),z({type:H(`response.function_call_arguments.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.custom_tool_call_input.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.image_generation_call.partial_image`),item_id:I(),output_index:L(),partial_image_b64:I()}),z({type:H(`response.code_interpreter_call_code.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.code_interpreter_call_code.done`),item_id:I(),output_index:L(),code:I()}),z({type:H(`response.output_text.annotation.added`),annotation:fu(`type`,[z({type:H(`url_citation`),start_index:L(),end_index:L(),url:I(),title:I()}),z({type:H(`file_citation`),file_id:I(),filename:I(),index:L()}),z({type:H(`container_file_citation`),container_id:I(),file_id:I(),filename:I(),start_index:L(),end_index:L()}),z({type:H(`file_path`),file_id:I(),index:L()})])}),z({type:H(`response.reasoning_summary_part.added`),item_id:I(),summary_index:L()}),z({type:H(`response.reasoning_summary_text.delta`),item_id:I(),summary_index:L(),delta:I()}),z({type:H(`response.reasoning_summary_part.done`),item_id:I(),summary_index:L()}),z({type:H(`response.apply_patch_call_operation_diff.delta`),item_id:I(),output_index:L(),delta:I(),obfuscation:I().nullish()}),z({type:H(`response.apply_patch_call_operation_diff.done`),item_id:I(),output_index:L(),diff:I()}),xy,Sy,z({type:I()}).loose().transform(e=>({type:`unknown_chunk`,message:e.type}))]))),wy=K(()=>q(z({id:I().optional(),created_at:L().optional(),error:z({message:I(),type:I(),param:I().nullish(),code:I()}).nullish(),model:I().optional(),output:R(fu(`type`,[z({type:H(`message`),role:H(`assistant`),id:I(),phase:V([`commentary`,`final_answer`]).nullish(),content:R(z({type:H(`output_text`),text:I(),logprobs:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish(),annotations:R(fu(`type`,[z({type:H(`url_citation`),start_index:L(),end_index:L(),url:I(),title:I()}),z({type:H(`file_citation`),file_id:I(),filename:I(),index:L()}),z({type:H(`container_file_citation`),container_id:I(),file_id:I(),filename:I(),start_index:L(),end_index:L()}),z({type:H(`file_path`),file_id:I(),index:L()})]))}))}),z({type:H(`web_search_call`),id:I(),status:I(),action:fu(`type`,[z({type:H(`search`),query:I().nullish(),queries:R(I()).nullish(),sources:R(fu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).nullish()}),z({type:H(`open_page`),url:I().nullish()}),z({type:H(`find_in_page`),url:I().nullish(),pattern:I().nullish()})]).nullish()}),z({type:H(`file_search_call`),id:I(),queries:R(I()),results:R(z({attributes:hu(I(),B([I(),L(),ou()])),file_id:I(),filename:I(),score:L(),text:I()})).nullish()}),z({type:H(`code_interpreter_call`),id:I(),code:I().nullable(),container_id:I(),outputs:R(fu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable()}),z({type:H(`image_generation_call`),id:I(),result:I()}),z({type:H(`local_shell_call`),id:I(),call_id:I(),action:z({type:H(`exec`),command:R(I()),timeout_ms:L().optional(),user:I().optional(),working_directory:I().optional(),env:hu(I(),I()).optional()})}),z({type:H(`function_call`),call_id:I(),name:I(),arguments:I(),id:I(),namespace:I().nullish()}),z({type:H(`custom_tool_call`),call_id:I(),name:I(),input:I(),id:I()}),z({type:H(`computer_call`),id:I(),status:I().optional()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish(),summary:R(z({type:H(`summary_text`),text:I()}))}),z({type:H(`mcp_call`),id:I(),status:I(),arguments:I(),name:I(),server_label:I(),output:I().nullish(),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).nullish(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I(),server_label:I(),tools:R(z({name:I(),description:I().optional(),input_schema:cu(),annotations:hu(I(),lu()).optional()})),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).optional()}),z({type:H(`mcp_approval_request`),id:I(),server_label:I(),name:I(),arguments:I(),approval_request_id:I().optional()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:fu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:fu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:lu()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(hu(I(),by.optional()))})])).optional(),service_tier:I().nullish(),reasoning:z({context:I().nullish()}).nullish(),incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}).optional()}))),Ty=20,Ey=K(()=>q(z({conversation:I().nullish(),include:R(V([`reasoning.encrypted_content`,`file_search_call.results`,`web_search_call.results`,`message.output_text.logprobs`])).nullish(),instructions:I().nullish(),logprobs:B([ou(),L().min(1).max(Ty)]).optional(),maxToolCalls:L().nullish(),metadata:cu().nullish(),parallelToolCalls:ou().nullish(),previousResponseId:I().nullish(),promptCacheKey:I().nullish(),promptCacheOptions:z({mode:V([`implicit`,`explicit`]).optional(),ttl:H(`30m`).optional()}).optional(),promptCacheRetention:V([`in_memory`,`24h`]).nullish(),reasoningEffort:I().nullish(),reasoningMode:V([`standard`,`pro`]).optional(),reasoningContext:V([`auto`,`current_turn`,`all_turns`]).optional(),reasoningSummary:I().nullish(),safetyIdentifier:I().nullish(),serviceTier:V([`auto`,`flex`,`priority`,`default`]).nullish(),store:ou().nullish(),passThroughUnsupportedFiles:ou().optional(),strictJsonSchema:ou().nullish(),textVerbosity:V([`low`,`medium`,`high`]).nullish(),truncation:V([`auto`,`disabled`]).nullish(),user:I().nullish(),systemMessageMode:V([`system`,`developer`,`remove`]).optional(),forceReasoning:ou().optional(),contextManagement:R(z({type:H(`compaction`),compactThreshold:L()})).nullish(),allowedTools:z({toolNames:R(I()).min(1),mode:V([`auto`,`required`]).optional()}).optional()}))),Dy=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({maxOutputTokens:e,temperature:t,stopSequences:n,topP:r,topK:i,presencePenalty:a,frequencyPenalty:o,seed:s,prompt:c,reasoning:l,providerOptions:u,tools:d,toolChoice:f,responseFormat:p}){let m=[],h=Zg(this.modelId);i!=null&&m.push({type:`unsupported`,feature:`topK`}),s!=null&&m.push({type:`unsupported`,feature:`seed`}),a!=null&&m.push({type:`unsupported`,feature:`presencePenalty`}),o!=null&&m.push({type:`unsupported`,feature:`frequencyPenalty`}),n!=null&&m.push({type:`unsupported`,feature:`stopSequences`});let g=this.config.provider.includes(`azure`)?`azure`:`openai`,_=await Dh({provider:g,providerOptions:u,schema:Ey});_==null&&g!==`openai`&&(_=await Dh({provider:`openai`,providerOptions:u,schema:Ey}));let v=_?.reasoningEffort??(Em(l)?l:void 0),y=_?.reasoningSummary===void 0?v!=null&&v!==`none`?`detailed`:void 0:_.reasoningSummary,b=_?.forceReasoning??h.isReasoningModel;_?.conversation&&_?.previousResponseId&&m.push({type:`unsupported`,feature:`conversation`,details:`conversation and previousResponseId cannot be used together`});let x=Yp({tools:d,providerToolNames:{"openai.code_interpreter":`code_interpreter`,"openai.file_search":`file_search`,"openai.image_generation":`image_generation`,"openai.local_shell":`local_shell`,"openai.shell":`shell`,"openai.web_search":`web_search`,"openai.web_search_preview":`web_search_preview`,"openai.mcp":`mcp`,"openai.apply_patch":`apply_patch`,"openai.tool_search":`tool_search`}}),S=new Set,{tools:C,toolChoice:w,toolWarnings:T}=await A_({tools:d,toolChoice:f,allowedTools:_?.allowedTools??void 0,toolNameMapping:x,customProviderToolNames:S}),{input:E,warnings:D}=await O_({prompt:c,toolNameMapping:x,systemMessageMode:_?.systemMessageMode??(b?`developer`:h.systemMessageMode),providerOptionsName:g,fileIdPrefixes:this.config.fileIdPrefixes,passThroughUnsupportedFiles:_?.passThroughUnsupportedFiles??!1,store:_?.store??!0,hasConversation:_?.conversation!=null,hasPreviousResponseId:_?.previousResponseId!=null,hasLocalShellTool:te(`openai.local_shell`),hasShellTool:te(`openai.shell`),hasApplyPatchTool:te(`openai.apply_patch`),customProviderToolNames:S.size>0?S:void 0});m.push(...D);let O=_?.strictJsonSchema??!0,k=_?.include;function ee(e){k==null?k=[e]:k.includes(e)||(k=[...k,e])}function te(e){return d?.find(t=>t.type===`provider`&&t.id===e)!=null}let A=typeof _?.logprobs==`number`?_?.logprobs:_?.logprobs===!0?Ty:void 0;A&&ee(`message.output_text.logprobs`);let ne=d?.find(e=>e.type===`provider`&&(e.id===`openai.web_search`||e.id===`openai.web_search_preview`))?.name;ne&&ee(`web_search_call.action.sources`),te(`openai.code_interpreter`)&&ee(`code_interpreter_call.outputs`);let re=_?.store;re===!1&&b&&ee(`reasoning.encrypted_content`);let ie={model:this.modelId,input:E,temperature:t,top_p:r,max_output_tokens:e,...(p?.type===`json`||_?.textVerbosity)&&{text:{...p?.type===`json`&&{format:p.schema==null?{type:`json_object`}:{type:`json_schema`,strict:O,name:p.name??`response`,description:p.description,schema:p.schema}},..._?.textVerbosity&&{verbosity:_.textVerbosity}}},conversation:_?.conversation,max_tool_calls:_?.maxToolCalls,metadata:_?.metadata,parallel_tool_calls:_?.parallelToolCalls,previous_response_id:_?.previousResponseId,store:re,user:_?.user,instructions:_?.instructions,service_tier:_?.serviceTier,include:k,prompt_cache_key:_?.promptCacheKey,prompt_cache_options:_?.promptCacheOptions,prompt_cache_retention:_?.promptCacheRetention,safety_identifier:_?.safetyIdentifier,top_logprobs:A,truncation:_?.truncation,..._?.contextManagement&&{context_management:_.contextManagement.map(e=>({type:e.type,compact_threshold:e.compactThreshold}))},...b&&(v!=null||y!=null||_?.reasoningMode!=null||_?.reasoningContext!=null)&&{reasoning:{...v!=null&&{effort:v},...y!=null&&{summary:y},..._?.reasoningMode!=null&&{mode:_.reasoningMode},..._?.reasoningContext!=null&&{context:_.reasoningContext}}}};b?v===`none`&&h.supportsNonReasoningParameters||(ie.temperature!=null&&(ie.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for reasoning models`})),ie.top_p!=null&&(ie.top_p=void 0,m.push({type:`unsupported`,feature:`topP`,details:`topP is not supported for reasoning models`}))):(_?.reasoningEffort!=null&&m.push({type:`unsupported`,feature:`reasoningEffort`,details:`reasoningEffort is not supported for non-reasoning models`}),_?.reasoningSummary!=null&&m.push({type:`unsupported`,feature:`reasoningSummary`,details:`reasoningSummary is not supported for non-reasoning models`}),_?.reasoningMode!=null&&m.push({type:`unsupported`,feature:`reasoningMode`,details:`reasoningMode is not supported for non-reasoning models`}),_?.reasoningContext!=null&&m.push({type:`unsupported`,feature:`reasoningContext`,details:`reasoningContext is not supported for non-reasoning models`})),_?.serviceTier===`flex`&&!h.supportsFlexProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`flex processing is only available for o3, o4-mini, and gpt-5 models`}),delete ie.service_tier),_?.serviceTier===`priority`&&!h.supportsPriorityProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported`}),delete ie.service_tier);let ae=d?.find(e=>e.type===`provider`&&e.id===`openai.shell`)?.args?.environment?.type,oe=ae===`containerAuto`||ae===`containerReference`;return{webSearchToolName:ne,args:{...ie,tools:C,tool_choice:w},warnings:[...m,...T],store:re,toolNameMapping:x,providerOptionsName:g,isShellProviderExecuted:oe}}async doGenerate(e){var t,n,r,i,a,o;let{args:s,warnings:c,webSearchToolName:l,toolNameMapping:u,providerOptionsName:d,isShellProviderExecuted:f}=await this.getArgs(e),p=this.config.url({path:`/responses`,modelId:this.modelId}),m=P_(e.prompt),{responseHeaders:h,value:g,rawValue:_}=await zg({url:p,headers:Up((t=this.config).headers?.call(t),e.headers),body:s,failedResponseHandler:cv,successfulResponseHandler:Kg(wy),abortSignal:e.abortSignal,fetch:this.config.fetch});if(g.error)throw new $r({message:g.error.message,url:p,requestBodyValues:s,statusCode:400,responseHeaders:h,responseBody:_,isRetryable:!1});let v=[],y=[],b=!1,x=[];for(let t of g.output)switch(t.type){case`reasoning`:t.summary.length===0&&t.summary.push({type:`summary_text`,text:``});for(let e of t.summary)v.push({type:`reasoning`,text:e.text,providerMetadata:{[d]:{itemId:t.id,reasoningEncryptedContent:t.encrypted_content??null}}});break;case`image_generation_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`image_generation`),input:`{}`,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`image_generation`),result:{result:t.result}});break;case`tool_search_call`:{let e=t.call_id??t.id,n=t.execution===`server`;n&&x.push(e),v.push({type:`tool-call`,toolCallId:e,toolName:u.toCustomToolName(`tool_search`),input:JSON.stringify({arguments:t.arguments,call_id:t.call_id}),...n?{providerExecuted:!0}:{},providerMetadata:{[d]:{itemId:t.id}}});break}case`tool_search_output`:{let e=t.call_id??x.shift()??t.id;v.push({type:`tool-result`,toolCallId:e,toolName:u.toCustomToolName(`tool_search`),result:{tools:t.tools},providerMetadata:{[d]:{itemId:t.id}}});break}case`local_shell_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`local_shell`),input:JSON.stringify({action:t.action}),providerMetadata:{[d]:{itemId:t.id}}});break;case`shell_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`shell`),input:JSON.stringify({action:{commands:t.action.commands}}),...f&&{providerExecuted:!0},providerMetadata:{[d]:{itemId:t.id}}});break;case`shell_call_output`:v.push({type:`tool-result`,toolCallId:t.call_id,toolName:u.toCustomToolName(`shell`),result:{output:t.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`exit`?{type:`exit`,exitCode:e.outcome.exit_code}:{type:`timeout`}}))}});break;case`message`:for(let o of t.content){e.providerOptions?.[d]?.logprobs&&o.logprobs&&y.push(o.logprobs);let s={itemId:t.id,...t.phase!=null&&{phase:t.phase},...o.annotations.length>0&&{annotations:o.annotations}};v.push({type:`text`,text:o.text,providerMetadata:{[d]:s}});for(let e of o.annotations)e.type===`url_citation`?v.push({type:`source`,sourceType:`url`,id:(n=this.config).generateId?.call(n)??cg(),url:e.url,title:e.title}):e.type===`file_citation`?v.push({type:`source`,sourceType:`document`,id:(r=this.config).generateId?.call(r)??cg(),mediaType:`text/plain`,title:e.filename,filename:e.filename,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,index:e.index}}}):e.type===`container_file_citation`?v.push({type:`source`,sourceType:`document`,id:(i=this.config).generateId?.call(i)??cg(),mediaType:`text/plain`,title:e.filename,filename:e.filename,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,containerId:e.container_id}}}):e.type===`file_path`&&v.push({type:`source`,sourceType:`document`,id:(a=this.config).generateId?.call(a)??cg(),mediaType:`application/octet-stream`,title:e.file_id,filename:e.file_id,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,index:e.index}}})}break;case`function_call`:b=!0,v.push({type:`tool-call`,toolCallId:t.call_id,toolName:t.name,input:t.arguments,providerMetadata:{[d]:{itemId:t.id,...t.namespace!=null&&{namespace:t.namespace}}}});break;case`custom_tool_call`:{b=!0;let e=u.toCustomToolName(t.name);v.push({type:`tool-call`,toolCallId:t.call_id,toolName:e,input:JSON.stringify(t.input),providerMetadata:{[d]:{itemId:t.id}}});break}case`web_search_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(l??`web_search`),input:JSON.stringify({}),providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(l??`web_search`),result:ev(t.action)});break;case`mcp_call`:{let e=t.approval_request_id==null?t.id:m[t.approval_request_id]??t.id,n=`mcp.${t.name}`;v.push({type:`tool-call`,toolCallId:e,toolName:n,input:t.arguments,providerExecuted:!0,dynamic:!0}),v.push({type:`tool-result`,toolCallId:e,toolName:n,result:{type:`call`,serverLabel:t.server_label,name:t.name,arguments:t.arguments,...t.output==null?{}:{output:t.output},...t.error==null?{}:{error:t.error}},providerMetadata:{[d]:{itemId:t.id}}});break}case`mcp_list_tools`:break;case`mcp_approval_request`:{let e=t.approval_request_id??t.id,n=(o=this.config).generateId?.call(o)??cg(),r=`mcp.${t.name}`;v.push({type:`tool-call`,toolCallId:n,toolName:r,input:t.arguments,providerExecuted:!0,dynamic:!0}),v.push({type:`tool-approval-request`,approvalId:e,toolCallId:n});break}case`computer_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`computer_use`),input:``,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`computer_use`),result:{type:`computer_use_tool_result`,status:t.status||`completed`}});break;case`file_search_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`file_search`),input:`{}`,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`file_search`),result:{queries:t.queries,results:t.results?.map(e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))??null}});break;case`code_interpreter_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`code_interpreter`),input:JSON.stringify({code:t.code,containerId:t.container_id}),providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`code_interpreter`),result:{outputs:t.outputs}});break;case`apply_patch_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`apply_patch`),input:JSON.stringify({callId:t.call_id,operation:t.operation}),providerMetadata:{[d]:{itemId:t.id}}});break;case`compaction`:v.push({type:`custom`,kind:`openai.compaction`,providerMetadata:{[d]:{type:`compaction`,itemId:t.id,encryptedContent:t.encrypted_content}}});break}let S={[d]:{responseId:g.id,...y.length>0?{logprobs:y}:{},...typeof g.service_tier==`string`?{serviceTier:g.service_tier}:{},...g.reasoning?.context==null?{}:{reasoningContext:g.reasoning.context}}},C=g.usage;return{content:v,finishReason:{unified:k_({finishReason:g.incomplete_details?.reason,hasFunctionCall:b}),raw:g.incomplete_details?.reason??void 0},usage:w_(C),request:{body:s},response:{id:g.id,timestamp:new Date(g.created_at*1e3),modelId:g.model,headers:h,body:_},providerMetadata:S,warnings:c}}async doStream(e){var t;let{args:n,warnings:r,webSearchToolName:i,toolNameMapping:a,store:o,providerOptionsName:s,isShellProviderExecuted:c}=await this.getArgs(e),l=this.config.url({path:`/responses`,modelId:this.modelId}),{responseHeaders:u,value:d}=await zg({url:l,headers:Up((t=this.config).headers?.call(t),e.headers),body:{...n,stream:!0},failedResponseHandler:cv,successfulResponseHandler:Gg(Cy),abortSignal:e.abortSignal,fetch:this.config.fetch}),f=await Qg({stream:d,getError:e=>Q_(e)||V_(e)&&e.response.error!=null?e:void 0,isOutputChunk:$_,url:l,requestBodyValues:n,responseHeaders:u}),p=this,m=P_(e.prompt),h=new Map,g={unified:`other`,raw:void 0},_,v=[],y=null,b={},x=[],S,C=!1,w={},T,E,D=[],O=!1;return{stream:f.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:r})},transform(t,r){var d,f,k,ee,te;if(e.includeRawChunks&&r.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){let e=I_(t.rawValue)?L_({value:t.rawValue,cause:t.error,url:l,requestBodyValues:n,responseHeaders:u}):t.error;g={unified:`error`,raw:void 0},r.enqueue({type:`error`,error:e});return}let A=t.value;if(X_(A)){if(A.item.type===`function_call`)b[A.output_index]={toolName:A.item.name,toolCallId:A.item.call_id},r.enqueue({type:`tool-input-start`,id:A.item.call_id,toolName:A.item.name});else if(A.item.type===`custom_tool_call`){let e=a.toCustomToolName(A.item.name);b[A.output_index]={toolName:e,toolCallId:A.item.call_id},r.enqueue({type:`tool-input-start`,id:A.item.call_id,toolName:e})}else if(A.item.type===`web_search_call`)b[A.output_index]={toolName:a.toCustomToolName(i??`web_search`),toolCallId:A.item.id},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(i??`web_search`),providerExecuted:!0}),r.enqueue({type:`tool-input-end`,id:A.item.id}),r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(i??`web_search`),input:JSON.stringify({}),providerExecuted:!0});else if(A.item.type===`computer_call`)b[A.output_index]={toolName:a.toCustomToolName(`computer_use`),toolCallId:A.item.id},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(`computer_use`),providerExecuted:!0});else if(A.item.type===`code_interpreter_call`)b[A.output_index]={toolName:a.toCustomToolName(`code_interpreter`),toolCallId:A.item.id,codeInterpreter:{containerId:A.item.container_id}},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(`code_interpreter`),providerExecuted:!0}),r.enqueue({type:`tool-input-delta`,id:A.item.id,delta:`{"containerId":"${A.item.container_id}","code":"`});else if(A.item.type===`file_search_call`)r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`file_search`),input:`{}`,providerExecuted:!0});else if(A.item.type===`image_generation_call`)r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`image_generation`),input:`{}`,providerExecuted:!0});else if(A.item.type===`tool_search_call`){let e=A.item.id,t=a.toCustomToolName(`tool_search`),n=A.item.execution===`server`;b[A.output_index]={toolName:t,toolCallId:e,toolSearchExecution:A.item.execution??`server`},n&&r.enqueue({type:`tool-input-start`,id:e,toolName:t,providerExecuted:!0})}else if(A.item.type!==`tool_search_output`&&!(A.item.type===`mcp_call`||A.item.type===`mcp_list_tools`||A.item.type===`mcp_approval_request`))if(A.item.type===`apply_patch_call`){let{call_id:e,operation:t}=A.item;if(b[A.output_index]={toolName:a.toCustomToolName(`apply_patch`),toolCallId:e,applyPatch:{hasDiff:t.type===`delete_file`,endEmitted:t.type===`delete_file`}},r.enqueue({type:`tool-input-start`,id:e,toolName:a.toCustomToolName(`apply_patch`)}),t.type===`delete_file`){let n=JSON.stringify({callId:e,operation:t});r.enqueue({type:`tool-input-delta`,id:e,delta:n}),r.enqueue({type:`tool-input-end`,id:e})}else r.enqueue({type:`tool-input-delta`,id:e,delta:`{"callId":"${tv(e)}","operation":{"type":"${tv(t.type)}","path":"${tv(t.path)}","diff":"`})}else A.item.type===`shell_call`?b[A.output_index]={toolName:a.toCustomToolName(`shell`),toolCallId:A.item.call_id}:A.item.type===`shell_call_output`||(A.item.type===`message`?(x.splice(0,x.length),S=A.item.phase??void 0,r.enqueue({type:`text-start`,id:A.item.id,providerMetadata:{[s]:{itemId:A.item.id,...A.item.phase!=null&&{phase:A.item.phase}}}})):X_(A)&&A.item.type===`reasoning`&&(w[A.item.id]={encryptedContent:A.item.encrypted_content,summaryParts:{0:`active`}},r.enqueue({type:`reasoning-start`,id:`${A.item.id}:0`,providerMetadata:{[s]:{itemId:A.item.id,reasoningEncryptedContent:A.item.encrypted_content??null}}})))}else if(z_(A))if(A.item.type===`message`){let e=A.item.phase??S;S=void 0,r.enqueue({type:`text-end`,id:A.item.id,providerMetadata:{[s]:{itemId:A.item.id,...e!=null&&{phase:e},...x.length>0&&{annotations:x}}}})}else if(A.item.type===`function_call`)b[A.output_index]=void 0,C=!0,r.enqueue({type:`tool-input-end`,id:A.item.call_id,...A.item.namespace!=null&&{providerMetadata:{[s]:{namespace:A.item.namespace}}}}),r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:A.item.name,input:A.item.arguments,providerMetadata:{[s]:{itemId:A.item.id,...A.item.namespace!=null&&{namespace:A.item.namespace}}}});else if(A.item.type===`custom_tool_call`){b[A.output_index]=void 0,C=!0;let e=a.toCustomToolName(A.item.name);r.enqueue({type:`tool-input-end`,id:A.item.call_id}),r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:e,input:JSON.stringify(A.item.input),providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`web_search_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(i??`web_search`),result:ev(A.item.action)});else if(A.item.type===`computer_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-input-end`,id:A.item.id}),r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`computer_use`),input:``,providerExecuted:!0}),r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`computer_use`),result:{type:`computer_use_tool_result`,status:A.item.status||`completed`}});else if(A.item.type===`file_search_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`file_search`),result:{queries:A.item.queries,results:A.item.results?.map(e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))??null}});else if(A.item.type===`code_interpreter_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`code_interpreter`),result:{outputs:A.item.outputs}});else if(A.item.type===`image_generation_call`)r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`image_generation`),result:{result:A.item.result}});else if(A.item.type===`tool_search_call`){let e=b[A.output_index],t=A.item.execution===`server`;if(e!=null){let n=t?e.toolCallId:A.item.call_id??A.item.id;t?D.push(n):r.enqueue({type:`tool-input-start`,id:n,toolName:e.toolName}),r.enqueue({type:`tool-input-end`,id:n}),r.enqueue({type:`tool-call`,toolCallId:n,toolName:e.toolName,input:JSON.stringify({arguments:A.item.arguments,call_id:t?null:n}),...t?{providerExecuted:!0}:{},providerMetadata:{[s]:{itemId:A.item.id}}})}b[A.output_index]=void 0}else if(A.item.type===`tool_search_output`){let e=A.item.call_id??D.shift()??A.item.id;r.enqueue({type:`tool-result`,toolCallId:e,toolName:a.toCustomToolName(`tool_search`),result:{tools:A.item.tools},providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`mcp_call`){b[A.output_index]=void 0;let e=A.item.approval_request_id??void 0,t=e==null?A.item.id:h.get(e)??m[e]??A.item.id,n=`mcp.${A.item.name}`;r.enqueue({type:`tool-call`,toolCallId:t,toolName:n,input:A.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-result`,toolCallId:t,toolName:n,result:{type:`call`,serverLabel:A.item.server_label,name:A.item.name,arguments:A.item.arguments,...A.item.output==null?{}:{output:A.item.output},...A.item.error==null?{}:{error:A.item.error}},providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`mcp_list_tools`)b[A.output_index]=void 0;else if(A.item.type===`apply_patch_call`){let e=b[A.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&A.item.operation.type!==`delete_file`&&(e.applyPatch.hasDiff||r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:tv(A.item.operation.diff)}),r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),e.applyPatch.endEmitted=!0),e&&A.item.status===`completed`&&r.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:a.toCustomToolName(`apply_patch`),input:JSON.stringify({callId:A.item.call_id,operation:A.item.operation}),providerMetadata:{[s]:{itemId:A.item.id}}}),b[A.output_index]=void 0}else if(A.item.type===`mcp_approval_request`){b[A.output_index]=void 0;let e=(d=p.config).generateId?.call(d)??cg(),t=A.item.approval_request_id??A.item.id;h.set(t,e);let n=`mcp.${A.item.name}`;r.enqueue({type:`tool-call`,toolCallId:e,toolName:n,input:A.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-approval-request`,approvalId:t,toolCallId:e})}else if(A.item.type===`local_shell_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`local_shell`),input:JSON.stringify({action:{type:`exec`,command:A.item.action.command,timeoutMs:A.item.action.timeout_ms,user:A.item.action.user,workingDirectory:A.item.action.working_directory,env:A.item.action.env}}),providerMetadata:{[s]:{itemId:A.item.id}}});else if(A.item.type===`shell_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`shell`),input:JSON.stringify({action:{commands:A.item.action.commands}}),...c&&{providerExecuted:!0},providerMetadata:{[s]:{itemId:A.item.id}}});else if(A.item.type===`shell_call_output`)r.enqueue({type:`tool-result`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`shell`),result:{output:A.item.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`exit`?{type:`exit`,exitCode:e.outcome.exit_code}:{type:`timeout`}}))}});else if(A.item.type===`reasoning`){let e=w[A.item.id],t=Object.entries(e.summaryParts).filter(([e,t])=>t===`active`||t===`can-conclude`).map(([e])=>e);for(let e of t)r.enqueue({type:`reasoning-end`,id:`${A.item.id}:${e}`,providerMetadata:{[s]:{itemId:A.item.id,reasoningEncryptedContent:A.item.encrypted_content??null}}});delete w[A.item.id]}else A.item.type===`compaction`&&r.enqueue({type:`custom`,kind:`openai.compaction`,providerMetadata:{[s]:{type:`compaction`,itemId:A.item.id,encryptedContent:A.item.encrypted_content}}});else if(U_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:A.delta})}else if(W_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:A.delta})}else if(J_(A)){let e=b[A.output_index];e?.applyPatch&&(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:tv(A.delta)}),e.applyPatch.hasDiff=!0)}else if(Y_(A)){let e=b[A.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&(e.applyPatch.hasDiff||(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:tv(A.diff)}),e.applyPatch.hasDiff=!0),r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),e.applyPatch.endEmitted=!0)}else if(G_(A))r.enqueue({type:`tool-result`,toolCallId:A.item_id,toolName:a.toCustomToolName(`image_generation`),result:{result:A.partial_image_b64},preliminary:!0});else if(K_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:tv(A.delta)})}else if(q_(A)){let e=b[A.output_index];e!=null&&(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),r.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:a.toCustomToolName(`code_interpreter`),input:JSON.stringify({code:A.code,containerId:e.codeInterpreter.containerId}),providerExecuted:!0}))}else if(H_(A))y=A.response.id,r.enqueue({type:`response-metadata`,id:A.response.id,timestamp:new Date(A.response.created_at*1e3),modelId:A.response.model});else if(F_(A))r.enqueue({type:`text-delta`,id:A.item_id,delta:A.delta}),e.providerOptions?.[s]?.logprobs&&A.logprobs&&v.push(A.logprobs);else if(A.type===`response.reasoning_summary_part.added`){if(A.summary_index>0){let e=w[A.item_id];e.summaryParts[A.summary_index]=`active`;for(let t of Object.keys(e.summaryParts))e.summaryParts[t]===`can-conclude`&&(r.enqueue({type:`reasoning-end`,id:`${A.item_id}:${t}`,providerMetadata:{[s]:{itemId:A.item_id}}}),e.summaryParts[t]=`concluded`);r.enqueue({type:`reasoning-start`,id:`${A.item_id}:${A.summary_index}`,providerMetadata:{[s]:{itemId:A.item_id,reasoningEncryptedContent:w[A.item_id]?.encryptedContent??null}}})}}else if(A.type===`response.reasoning_summary_text.delta`)r.enqueue({type:`reasoning-delta`,id:`${A.item_id}:${A.summary_index}`,delta:A.delta,providerMetadata:{[s]:{itemId:A.item_id}}});else if(A.type===`response.reasoning_summary_part.done`)o?(r.enqueue({type:`reasoning-end`,id:`${A.item_id}:${A.summary_index}`,providerMetadata:{[s]:{itemId:A.item_id}}}),w[A.item_id].summaryParts[A.summary_index]=`concluded`):w[A.item_id].summaryParts[A.summary_index]=`can-conclude`;else if(B_(A))g={unified:k_({finishReason:A.response.incomplete_details?.reason,hasFunctionCall:C}),raw:A.response.incomplete_details?.reason??void 0},_=A.response.usage,typeof A.response.service_tier==`string`&&(T=A.response.service_tier),A.response.reasoning?.context!=null&&(E=A.response.reasoning.context);else if(V_(A)){let e=A.response.incomplete_details?.reason;g={unified:e?k_({finishReason:e,hasFunctionCall:C}):`error`,raw:e??`error`},_=A.response.usage??void 0,A.response.reasoning?.context!=null&&(E=A.response.reasoning.context),!O&&A.response.error!=null&&(O=!0,r.enqueue({type:`error`,error:{type:`response.failed`,sequence_number:A.sequence_number,response:{error:A.response.error,incomplete_details:A.response.incomplete_details,service_tier:A.response.service_tier}}}))}else Z_(A)?(x.push(A.annotation),A.annotation.type===`url_citation`?r.enqueue({type:`source`,sourceType:`url`,id:(f=p.config).generateId?.call(f)??cg(),url:A.annotation.url,title:A.annotation.title}):A.annotation.type===`file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(k=p.config).generateId?.call(k)??cg(),mediaType:`text/plain`,title:A.annotation.filename,filename:A.annotation.filename,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,index:A.annotation.index}}}):A.annotation.type===`container_file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(ee=p.config).generateId?.call(ee)??cg(),mediaType:`text/plain`,title:A.annotation.filename,filename:A.annotation.filename,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,containerId:A.annotation.container_id}}}):A.annotation.type===`file_path`&&r.enqueue({type:`source`,sourceType:`document`,id:(te=p.config).generateId?.call(te)??cg(),mediaType:`application/octet-stream`,title:A.annotation.file_id,filename:A.annotation.file_id,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,index:A.annotation.index}}})):Q_(A)&&(O=!0,g={unified:`error`,raw:`error`},r.enqueue({type:`error`,error:A}))},flush(e){let t={[s]:{responseId:y,...v.length>0?{logprobs:v}:{},...T===void 0?{}:{serviceTier:T},...E===void 0?{}:{reasoningContext:E}}};e.enqueue({type:`finish`,finishReason:g,usage:w_(_),providerMetadata:t})}})),request:{body:n},response:{headers:u}}}},Oy=K(()=>q(z({instructions:I().nullish(),speed:L().min(.25).max(4).default(1).nullish()}))),ky=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({text:e,voice:t=`alloy`,outputFormat:n=`mp3`,speed:r,instructions:i,language:a,providerOptions:o}){let s=[],c=await Dh({provider:`openai`,providerOptions:o,schema:Oy}),l={model:this.modelId,input:e,voice:t,response_format:`mp3`,speed:r,instructions:i};if(n&&([`mp3`,`opus`,`aac`,`flac`,`wav`,`pcm`].includes(n)?l.response_format=n:s.push({type:`unsupported`,feature:`outputFormat`,details:`Unsupported output format: ${n}. Using mp3 instead.`})),c){let e={};for(let t in e){let n=e[t];n!==void 0&&(l[t]=n)}}return a&&s.push({type:`unsupported`,feature:`language`,details:`OpenAI speech models do not support language selection. Language parameter "${a}" was ignored.`}),{requestBody:l,warnings:s}}async doGenerate(e){var t,n;let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,{requestBody:i,warnings:a}=await this.getArgs(e),{value:o,responseHeaders:s,rawValue:c}=await zg({url:this.config.url({path:`/audio/speech`,modelId:this.modelId}),headers:Up((n=this.config).headers?.call(n),e.headers),body:i,failedResponseHandler:cv,successfulResponseHandler:qg(),abortSignal:e.abortSignal,fetch:this.config.fetch});return{audio:o,warnings:a,request:{body:JSON.stringify(i)},response:{timestamp:r,modelId:this.modelId,headers:s,body:c}}}},Ay=K(()=>q(z({text:I(),language:I().nullish(),duration:L().nullish(),words:R(z({word:I(),start:L(),end:L()})).nullish(),segments:R(z({id:L(),seek:L(),start:L(),end:L(),text:I(),tokens:R(L()),temperature:L(),avg_logprob:L(),compression_ratio:L(),no_speech_prob:L()})).nullish()}))),jy=K(()=>q(z({include:R(I()).optional(),language:I().optional(),prompt:I().optional(),temperature:L().min(0).max(1).default(0).optional(),timestampGranularities:R(V([`word`,`segment`])).default([`segment`]).optional(),streaming:z({delay:V([`minimal`,`low`,`medium`,`high`,`xhigh`]).optional(),include:R(I()).optional()}).optional()}))),My={afrikaans:`af`,arabic:`ar`,armenian:`hy`,azerbaijani:`az`,belarusian:`be`,bosnian:`bs`,bulgarian:`bg`,catalan:`ca`,chinese:`zh`,croatian:`hr`,czech:`cs`,danish:`da`,dutch:`nl`,english:`en`,estonian:`et`,finnish:`fi`,french:`fr`,galician:`gl`,german:`de`,greek:`el`,hebrew:`he`,hindi:`hi`,hungarian:`hu`,icelandic:`is`,indonesian:`id`,italian:`it`,japanese:`ja`,kannada:`kn`,kazakh:`kk`,korean:`ko`,latvian:`lv`,lithuanian:`lt`,macedonian:`mk`,malay:`ms`,marathi:`mr`,maori:`mi`,nepali:`ne`,norwegian:`no`,persian:`fa`,polish:`pl`,portuguese:`pt`,romanian:`ro`,russian:`ru`,serbian:`sr`,slovak:`sk`,slovenian:`sl`,spanish:`es`,swahili:`sw`,swedish:`sv`,tagalog:`tl`,tamil:`ta`,thai:`th`,turkish:`tr`,ukrainian:`uk`,urdu:`ur`,vietnamese:`vi`,welsh:`cy`},Ny=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({audio:e,mediaType:t,providerOptions:n}){let r=[],i=await Dh({provider:`openai`,providerOptions:n,schema:jy}),a=new FormData,o=e instanceof Uint8Array?new Blob([e]):new Blob([Wp(e)]);a.append(`model`,this.modelId);let s=km(t);if(a.append(`file`,new File([o],`audio`,{type:t}),`audio.${s}`),this.modelId===`whisper-1`&&a.append(`response_format`,`verbose_json`),i){let e=[`gpt-4o-transcribe`,`gpt-4o-mini-transcribe`].includes(this.modelId),t={include:i.include,language:i.language,prompt:i.prompt,...this.modelId!==`whisper-1`&&{response_format:e?`json`:`verbose_json`},temperature:i.temperature,timestamp_granularities:i.timestampGranularities};for(let[e,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let t of n)a.append(`${e}[]`,String(t));else a.append(e,String(n))}return{formData:a,warnings:r}}async doGenerate(e){var t,n;if(nv(this.modelId))throw new pa({functionality:`non-streaming transcription with ${this.modelId}`});let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,{formData:i,warnings:a}=await this.getArgs(e),{value:o,responseHeaders:s,rawValue:c}=await Bg({url:this.config.url({path:`/audio/transcriptions`,modelId:this.modelId}),headers:Up((n=this.config).headers?.call(n),e.headers),formData:i,failedResponseHandler:cv,successfulResponseHandler:Kg(Ay),abortSignal:e.abortSignal,fetch:this.config.fetch}),l=o.language!=null&&o.language in My?My[o.language]:void 0;return{text:o.text,segments:o.segments?.map(e=>({text:e.text,startSecond:e.start,endSecond:e.end}))??o.words?.map(e=>({text:e.word,startSecond:e.start,endSecond:e.end}))??[],language:l,durationInSeconds:o.duration??void 0,warnings:a,response:{timestamp:r,modelId:this.modelId,headers:s,body:c}}}async doStream(e){var t,n;if(!nv(this.modelId))throw new pa({functionality:`streaming transcription with ${this.modelId}`});let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,i=await Dh({provider:`openai`,providerOptions:e.providerOptions,schema:jy}),a=[],o=e.providerOptions?.openai??{};for(let e of[`include`,`prompt`,`temperature`,`timestampGranularities`])o[e]!=null&&a.push({type:`unsupported`,feature:`providerOptions.openai.${e}`,details:`OpenAI streaming transcription does not support ${e}.`});let s=Up((n=this.config).headers?.call(n),e.headers),c=iv({modelId:this.modelId,inputAudioFormat:e.inputAudioFormat,providerOptions:i});return{request:{body:c},response:{timestamp:r,modelId:this.modelId},stream:rv({webSocket:this.config.webSocket,url:Vh(this.config.url({path:`/realtime?intent=transcription`,modelId:this.modelId})),headers:s,sessionUpdate:c,language:i?.language,warnings:a,audio:e.audio,abortSignal:e.abortSignal,includeRawChunks:e.includeRawChunks})}}},Py=K(()=>q(z({id:I(),name:I().nullish(),description:I().nullish(),default_version:I().nullish(),latest_version:I().nullish(),created_at:L(),updated_at:L().nullish()}))),Fy=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadSkill(e){let t=[];e.displayTitle!=null&&t.push({type:`unsupported`,feature:`displayTitle`});let n=new FormData;for(let t of e.files){let e=qp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let{value:r}=await Bg({url:this.config.url({path:`/skills`}),headers:Up(this.config.headers()),formData:n,failedResponseHandler:cv,successfulResponseHandler:Kg(Py),fetch:this.config.fetch});return{providerReference:{openai:r.id},...r.name==null?{}:{name:r.name},...r.description==null?{}:{description:r.description},...r.latest_version==null?{}:{latestVersion:r.latest_version},providerMetadata:{openai:{...r.default_version==null?{}:{defaultVersion:r.default_version},...r.created_at==null?{}:{createdAt:r.created_at},...r.updated_at==null?{}:{updatedAt:r.updated_at}}},warnings:t}}},Iy=`4.0.11`,ov()}));function Ry(e){let t=e?.anthropic;return t?.cacheControl??t?.cache_control}async function zy({tools:e,toolChoice:t,disableParallelToolUse:n,cacheControlValidator:r,supportsStructuredOutput:i,supportsStrictTools:a,defaultEagerInputStreaming:o=!1}){e=e?.length?e:void 0;let s=[],c=new Set,l=r||new xb;if(e==null)return{tools:void 0,toolChoice:void 0,toolWarnings:s,betas:c};let u=[];for(let t of e)switch(t.type){case`function`:{let e=l.getCacheControl(t.providerOptions,{type:`tool definition`,canCache:!0}),n=t.providerOptions?.anthropic,r=n?.eagerInputStreaming??o,d=n?.deferLoading,f=n?.allowedCallers;!a&&t.strict!=null&&s.push({type:`unsupported`,feature:`strict`,details:`Tool '${t.name}' has strict: ${t.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`}),u.push({name:t.name,description:t.description,input_schema:t.inputSchema,cache_control:e,...r?{eager_input_streaming:!0}:{},...a===!0&&t.strict!=null?{strict:t.strict}:{},...d==null?{}:{defer_loading:d},...f==null?{}:{allowed_callers:f},...t.inputExamples==null?{}:{input_examples:t.inputExamples.map(e=>e.input)}}),i===!0&&c.add(`structured-outputs-2025-11-13`),(t.inputExamples!=null||f!=null)&&c.add(`advanced-tool-use-2025-11-20`);break}case`provider`:switch(t.id){case`anthropic.code_execution_20250522`:c.add(`code-execution-2025-05-22`),u.push({type:`code_execution_20250522`,name:`code_execution`,cache_control:void 0});break;case`anthropic.code_execution_20250825`:c.add(`code-execution-2025-08-25`),u.push({type:`code_execution_20250825`,name:`code_execution`});break;case`anthropic.code_execution_20260120`:u.push({type:`code_execution_20260120`,name:`code_execution`});break;case`anthropic.computer_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`computer`,type:`computer_20250124`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,cache_control:void 0});break;case`anthropic.computer_20251124`:c.add(`computer-use-2025-11-24`),u.push({name:`computer`,type:`computer_20251124`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,enable_zoom:t.args.enableZoom,cache_control:void 0});break;case`anthropic.computer_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`computer`,type:`computer_20241022`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,cache_control:void 0});break;case`anthropic.text_editor_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`str_replace_editor`,type:`text_editor_20250124`,cache_control:void 0});break;case`anthropic.text_editor_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`str_replace_editor`,type:`text_editor_20241022`,cache_control:void 0});break;case`anthropic.text_editor_20250429`:c.add(`computer-use-2025-01-24`),u.push({name:`str_replace_based_edit_tool`,type:`text_editor_20250429`,cache_control:void 0});break;case`anthropic.text_editor_20250728`:{let e=await Sh({value:t.args,schema:Eb});u.push({name:`str_replace_based_edit_tool`,type:`text_editor_20250728`,max_characters:e.maxCharacters,cache_control:void 0});break}case`anthropic.bash_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`bash`,type:`bash_20250124`,cache_control:void 0});break;case`anthropic.bash_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`bash`,type:`bash_20241022`,cache_control:void 0});break;case`anthropic.memory_20250818`:c.add(`context-management-2025-06-27`),u.push({name:`memory`,type:`memory_20250818`});break;case`anthropic.web_fetch_20250910`:{c.add(`web-fetch-2025-09-10`);let e=await Sh({value:t.args,schema:Vb});u.push({type:`web_fetch_20250910`,name:`web_fetch`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,citations:e.citations,max_content_tokens:e.maxContentTokens,cache_control:void 0});break}case`anthropic.web_fetch_20260209`:{c.add(`code-execution-web-tools-2026-02-09`);let e=await Sh({value:t.args,schema:Lb});u.push({type:`web_fetch_20260209`,name:`web_fetch`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,citations:e.citations,max_content_tokens:e.maxContentTokens,cache_control:void 0});break}case`anthropic.web_search_20250305`:{let e=await Sh({value:t.args,schema:Nb});u.push({type:`web_search_20250305`,name:`web_search`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,user_location:e.userLocation,cache_control:void 0});break}case`anthropic.web_search_20260209`:{c.add(`code-execution-web-tools-2026-02-09`);let e=await Sh({value:t.args,schema:kb});u.push({type:`web_search_20260209`,name:`web_search`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,user_location:e.userLocation,cache_control:void 0});break}case`anthropic.tool_search_regex_20251119`:u.push({type:`tool_search_tool_regex_20251119`,name:`tool_search_tool_regex`});break;case`anthropic.tool_search_bm25_20251119`:u.push({type:`tool_search_tool_bm25_20251119`,name:`tool_search_tool_bm25`});break;case`anthropic.advisor_20260301`:{c.add(`advisor-tool-2026-03-01`);let e=await Sh({value:t.args,schema:Sb});u.push({type:`advisor_20260301`,name:`advisor`,model:e.model,...e.maxUses!==void 0&&{max_uses:e.maxUses},...e.caching!==void 0&&{caching:e.caching}});break}default:s.push({type:`unsupported`,feature:`provider-defined tool ${t.id}`});break}break;default:s.push({type:`unsupported`,feature:`tool ${t}`});break}if(t==null)return{tools:u,toolChoice:n?{type:`auto`,disable_parallel_tool_use:n}:void 0,toolWarnings:s,betas:c};let d=t.type;switch(d){case`auto`:return{tools:u,toolChoice:{type:`auto`,disable_parallel_tool_use:n},toolWarnings:s,betas:c};case`required`:return{tools:u,toolChoice:{type:`any`,disable_parallel_tool_use:n},toolWarnings:s,betas:c};case`none`:return{tools:void 0,toolChoice:void 0,toolWarnings:s,betas:c};case`tool`:return{tools:u,toolChoice:{type:`tool`,name:t.toolName,disable_parallel_tool_use:n},toolWarnings:s,betas:c};default:throw new pa({functionality:`tool choice type: ${d}`})}}function By({usage:e,rawUsage:t}){let n=e.cache_creation_input_tokens??0,r=e.cache_read_input_tokens??0,i,a,o=e.iterations?.some(e=>e.type===`fallback_message`);if(e.iterations&&e.iterations.length>0&&!o){let t=e.iterations.filter(e=>e.type===`compaction`||e.type===`message`);if(t.length>0){let e=t.reduce((e,t)=>({input:e.input+t.input_tokens,output:e.output+t.output_tokens}),{input:0,output:0});i=e.input,a=e.output}else i=e.input_tokens,a=e.output_tokens}else i=e.input_tokens,a=e.output_tokens;return{inputTokens:{total:i+n+r,noCache:i,cacheRead:r,cacheWrite:n},outputTokens:{total:a,text:void 0,reasoning:void 0},raw:t??e}}function Vy(e){return typeof e==`string`?new TextDecoder().decode(Wp(e)):new TextDecoder().decode(e)}function Hy(e){try{if(typeof e==`string`)return Mm(e);if(typeof e==`object`&&e)return e}catch{let t=e?.errorCode;return{errorCode:typeof t==`string`?t:`unavailable`}}return{}}async function Uy({prompt:e,sendReasoning:t,warnings:n,cacheControlValidator:r,toolNameMapping:i}){let a=new Set,o=Wy(e),s=r||new xb,c,l=[];async function u(e){return(await Dh({provider:`anthropic`,providerOptions:e,schema:vb}))?.citations?.enabled??!1}async function d(e){return(await Dh({provider:`anthropic`,providerOptions:e,schema:vb}))?.containerUpload??!1}async function f(e){let t=await Dh({provider:`anthropic`,providerOptions:e,schema:vb});return{title:t?.title,context:t?.context}}for(let e=0;e<o.length;e++){let r=o[e],p=e===o.length-1,m=r.type;switch(m){case`system`:{let e=r.messages.map(({content:e,providerOptions:t})=>({type:`text`,text:e,cache_control:s.getCacheControl(t,{type:`system message`,canCache:!0})}));c==null?c=e:(l.push({role:`system`,content:e}),a.add(`mid-conversation-system-2026-04-07`));break}case`user`:{let e=[];for(let t of r.messages){let{role:r,content:i}=t;switch(r){case`user`:for(let n=0;n<i.length;n++){let r=i[n],o=n===i.length-1,c=s.getCacheControl(r.providerOptions,{type:`user message part`,canCache:!0})??(o?s.getCacheControl(t.providerOptions,{type:`user message`,canCache:!0}):void 0);switch(r.type){case`text`:e.push({type:`text`,text:r.text,cache_control:c});break;case`file`:switch(r.data.type){case`reference`:{let t=Ph({reference:r.data.reference,provider:`anthropic`});a.add(`files-api-2025-04-14`),await d(r.providerOptions)?e.push({type:`container_upload`,file_id:t}):tm(r.mediaType)===`image`?e.push({type:`image`,source:{type:`file`,file_id:t},cache_control:c}):e.push({type:`document`,source:{type:`file`,file_id:t},cache_control:c});break}case`text`:{let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:{type:`text`,media_type:`text/plain`,data:r.data.text},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c});break}case`url`:case`data`:{let t=tm(r.mediaType);if(t===`image`)e.push({type:`image`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`base64`,media_type:Nh({part:r}),data:Kp(r.data.data)},cache_control:c});else if(t===`application`&&(r.data.type===`url`?r.mediaType===`application/pdf`:Nh({part:r})===`application/pdf`)){a.add(`pdfs-2024-09-25`);let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`base64`,media_type:`application/pdf`,data:Kp(r.data.data)},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c})}else if(r.mediaType===`text/plain`){let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`text`,media_type:`text/plain`,data:Vy(r.data.data)},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c})}else throw new pa({functionality:`media type: ${r.mediaType}`});break}}break}}break;case`tool`:for(let r=0;r<i.length;r++){let o=i[r];if(o.type===`tool-approval-response`)continue;let c=o.output,l=`providerOptions`in c?c.providerOptions:c.type===`content`?c.value.find(e=>e.providerOptions!=null)?.providerOptions:void 0,u=r===i.length-1,d=s.getCacheControl(o.providerOptions,{type:`tool result part`,canCache:!0})??s.getCacheControl(l,{type:`tool result output`,canCache:!0})??(u?s.getCacheControl(t.providerOptions,{type:`tool result message`,canCache:!0}):void 0),f;switch(c.type){case`content`:f=c.value.map(e=>{switch(e.type){case`text`:return{type:`text`,text:e.text};case`file`:{let t=tm(e.mediaType);if(e.data.type===`url`)return t===`image`?{type:`image`,source:{type:`url`,url:e.data.url.toString()}}:{type:`document`,source:{type:`url`,url:e.data.url.toString()}};if(e.data.type===`data`){if(t===`image`)return{type:`image`,source:{type:`base64`,media_type:Nh({part:e}),data:Kp(e.data.data)}};if(Nh({part:e})===`application/pdf`)return a.add(`pdfs-2024-09-25`),{type:`document`,source:{type:`base64`,media_type:`application/pdf`,data:Kp(e.data.data)}};n.push({type:`other`,message:`unsupported tool content part type: ${e.type} with media type: ${e.mediaType}`});return}n.push({type:`other`,message:`unsupported tool content part type: ${e.type} with data type: ${e.data.type}`});return}case`custom`:{let t=e.providerOptions?.anthropic;if(t?.type===`tool-reference`)return{type:`tool_reference`,tool_name:t.toolName};n.push({type:`other`,message:`unsupported custom tool content part`});return}default:n.push({type:`other`,message:`unsupported tool content part type: ${e.type}`});return}}).filter(xm);break;case`text`:case`error-text`:f=c.value;break;case`execution-denied`:f=c.reason??`Tool call execution denied.`;break;default:f=JSON.stringify(c.value);break}e.push({type:`tool_result`,tool_use_id:o.toolCallId,content:f,is_error:c.type===`error-text`||c.type===`error-json`||void 0,cache_control:d})}break;default:throw Error(`Unsupported role: ${r}`)}}l.push({role:`user`,content:e});break}case`assistant`:{let e=[],a=new Set;for(let o=0;o<r.messages.length;o++){let c=r.messages[o],l=o===r.messages.length-1,{content:u}=c;for(let r=0;r<u.length;r++){let o=u[r],d=r===u.length-1,f=s.getCacheControl(o.providerOptions,{type:`assistant message part`,canCache:!0})??(d?s.getCacheControl(c.providerOptions,{type:`assistant message`,canCache:!0}):void 0);switch(o.type){case`text`:o.providerOptions?.anthropic?.type===`compaction`?e.push({type:`compaction`,content:o.text,cache_control:f}):e.push({type:`text`,text:p&&l&&d?o.text.trim():o.text,cache_control:f});break;case`reasoning`:if(t){let t=await Dh({provider:`anthropic`,providerOptions:o.providerOptions,schema:_b});t==null?n.push({type:`other`,message:`unsupported reasoning metadata`}):t.signature==null?t.redactedData==null?n.push({type:`other`,message:`unsupported reasoning metadata`}):(s.getCacheControl(o.providerOptions,{type:`redacted thinking block`,canCache:!1}),e.push({type:`redacted_thinking`,data:t.redactedData})):(s.getCacheControl(o.providerOptions,{type:`thinking block`,canCache:!1}),e.push({type:`thinking`,thinking:o.text,signature:t.signature}))}else n.push({type:`other`,message:`sending reasoning content is disabled for this model`});break;case`tool-call`:{if(o.providerExecuted){let t=i.toProviderToolName(o.toolName);if(o.providerOptions?.anthropic?.type===`mcp-tool-use`){a.add(o.toolCallId);let t=o.providerOptions?.anthropic?.serverName;if(t==null||typeof t!=`string`){n.push({type:`other`,message:`mcp tool use server name is required and must be a string`});break}e.push({type:`mcp_tool_use`,id:o.toolCallId,name:o.toolName,input:o.input,server_name:t,cache_control:f})}else if(t===`code_execution`&&o.input!=null&&typeof o.input==`object`&&`type`in o.input&&typeof o.input.type==`string`&&(o.input.type===`bash_code_execution`||o.input.type===`text_editor_code_execution`))e.push({type:`server_tool_use`,id:o.toolCallId,name:o.input.type,input:o.input,cache_control:f});else if(t===`code_execution`&&o.input!=null&&typeof o.input==`object`&&`type`in o.input&&o.input.type===`programmatic-tool-call`){let{type:t,...n}=o.input;e.push({type:`server_tool_use`,id:o.toolCallId,name:`code_execution`,input:n,cache_control:f})}else t===`code_execution`||t===`web_fetch`||t===`web_search`||t===`tool_search_tool_regex`||t===`tool_search_tool_bm25`?e.push({type:`server_tool_use`,id:o.toolCallId,name:t,input:o.input,cache_control:f}):t===`advisor`?e.push({type:`server_tool_use`,id:o.toolCallId,name:`advisor`,input:{},cache_control:f}):n.push({type:`other`,message:`provider executed tool call for tool ${o.toolName} is not supported`});break}let t=o.providerOptions?.anthropic,r=t?.caller?(t.caller.type===`code_execution_20250825`||t.caller.type===`code_execution_20260120`)&&t.caller.toolId?{type:t.caller.type,tool_id:t.caller.toolId}:t.caller.type===`direct`?{type:`direct`}:void 0:void 0;e.push({type:`tool_use`,id:o.toolCallId,name:o.toolName,input:Ky(o.input),...r&&{caller:r},cache_control:f});break}case`tool-result`:{let t=i.toProviderToolName(o.toolName);if(a.has(o.toolCallId)){let t=o.output;if(t.type!==`json`&&t.type!==`error-json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}e.push({type:`mcp_tool_result`,tool_use_id:o.toolCallId,is_error:t.type===`error-json`,content:t.value,cache_control:f})}else if(t===`code_execution`){let t=o.output;if(t.type===`error-text`||t.type===`error-json`){let n={};try{typeof t.value==`string`?n=Mm(t.value):typeof t.value==`object`&&t.value!==null&&(n=t.value)}catch{}n.type===`code_execution_tool_result_error`?e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:`code_execution_tool_result_error`,error_code:n.errorCode??`unknown`},cache_control:f}):e.push({type:`bash_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:{type:`bash_code_execution_tool_result_error`,error_code:n.errorCode??`unknown`}});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}if(t.value==null||typeof t.value!=`object`||!(`type`in t.value)||typeof t.value.type!=`string`){n.push({type:`other`,message:`provider executed tool result output value is not a valid code execution result for tool ${o.toolName}`});break}if(t.value.type===`code_execution_result`){let n=await Sh({value:t.value,schema:Gb});e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,stdout:n.stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f})}else if(t.value.type===`encrypted_code_execution_result`){let n=await Sh({value:t.value,schema:Zb});n.type===`encrypted_code_execution_result`&&e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,encrypted_stdout:n.encrypted_stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f})}else{let n=await Sh({value:t.value,schema:Jb});n.type===`code_execution_result`?e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,stdout:n.stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f}):n.type===`bash_code_execution_result`||n.type===`bash_code_execution_tool_result_error`?e.push({type:`bash_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:n}):e.push({type:`text_editor_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:n})}break}if(t===`web_fetch`){let t=o.output;if(t.type===`error-json`){e.push({type:`web_fetch_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_fetch_tool_result_error`,error_code:Hy(t.value).errorCode??`unavailable`},cache_control:f});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await Sh({value:t.value,schema:Hb});e.push({type:`web_fetch_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_fetch_result`,url:r.url,retrieved_at:r.retrievedAt,content:{type:`document`,title:r.content.title,citations:r.content.citations,source:{type:r.content.source.type,media_type:r.content.source.mediaType,data:r.content.source.data}}},cache_control:f});break}if(t===`web_search`){let t=o.output;if(t.type===`error-json`){e.push({type:`web_search_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_search_tool_result_error`,error_code:Hy(t.value).errorCode??`unavailable`},cache_control:f});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await Sh({value:t.value,schema:Pb});e.push({type:`web_search_tool_result`,tool_use_id:o.toolCallId,content:r.map(e=>({url:e.url,title:e.title,page_age:e.pageAge,encrypted_content:e.encryptedContent,type:e.type})),cache_control:f});break}if(t===`tool_search_tool_regex`||t===`tool_search_tool_bm25`){let t=o.output;if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=(await Sh({value:t.value,schema:ex})).map(e=>({type:`tool_reference`,tool_name:e.toolName}));e.push({type:`tool_search_tool_result`,tool_use_id:o.toolCallId,content:{type:`tool_search_tool_search_result`,tool_references:r},cache_control:f});break}if(t===`advisor`){let t=o.output;if(t.type!==`json`&&t.type!==`error-json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await Sh({value:t.value,schema:Cb});r.type===`advisor_result`?e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_result`,text:r.text},cache_control:f}):r.type===`advisor_redacted_result`?e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_redacted_result`,encrypted_content:r.encryptedContent},cache_control:f}):e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_tool_result_error`,error_code:r.errorCode},cache_control:f});break}n.push({type:`other`,message:`provider executed tool result for tool ${o.toolName} is not supported`});break}}}}l.push({role:`assistant`,content:Gy(e)});break}default:throw Error(`content type: ${m}`)}}return{prompt:{system:c,messages:l},betas:a}}function Wy(e){let t=[],n;for(let r of e){let{role:e}=r;switch(e){case`system`:n?.type!==`system`&&(n={type:`system`,messages:[]},t.push(n)),n.messages.push(r);break;case`assistant`:n?.type!==`assistant`&&(n={type:`assistant`,messages:[]},t.push(n)),n.messages.push(r);break;case`user`:n?.type!==`user`&&(n={type:`user`,messages:[]},t.push(n)),n.messages.push(r);break;case`tool`:n?.type!==`user`&&(n={type:`user`,messages:[]},t.push(n)),n.messages.push(r);break;default:throw Error(`Unsupported role: ${e}`)}}return t}function Gy(e){let t=[],n=[];function r(){t.push(...n.filter(e=>e.type!==`tool_use`),...n.filter(e=>e.type===`tool_use`)),n=[]}for(let i of e)i.type===`thinking`||i.type===`redacted_thinking`?(r(),t.push(i)):n.push(i);return r(),t}function Ky(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{rawInvalidInput:e}}function qy({finishReason:e,isJsonResponseFromTool:t}){switch(e){case`pause_turn`:case`end_turn`:case`stop_sequence`:return`stop`;case`refusal`:return`content-filter`;case`tool_use`:return t?`stop`:`tool-calls`;case`max_tokens`:case`model_context_window_exceeded`:return`length`;case`compaction`:return`other`;default:return`other`}}function Jy(e){return Xy(e)}function Yy(e){return typeof e==`boolean`||!eb(e)?e:Xy(e)}function Xy(e){let t={},n=e;if(e.$ref!=null)return{$ref:e.$ref};if(e.$schema!=null&&(t.$schema=e.$schema),e.$id!=null&&(t.$id=e.$id),e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description),e.default!==void 0&&(t.default=e.default),e.const!==void 0&&(t.const=e.const),e.enum!=null&&(t.enum=e.enum),e.type!=null&&(t.type=e.type),e.anyOf==null?e.oneOf!=null&&(t.anyOf=e.oneOf.map(Yy)):t.anyOf=e.anyOf.map(Yy),e.allOf!=null&&(t.allOf=e.allOf.map(Yy)),e.definitions!=null&&(t.definitions=Object.fromEntries(Object.entries(e.definitions).map(([e,t])=>[e,Yy(t)]))),n.$defs!=null){let e=t;e.$defs=Object.fromEntries(Object.entries(n.$defs).map(([e,t])=>[e,Yy(t)]))}(e.type===`object`||e.properties!=null)&&(e.properties!=null&&(t.properties=Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,Yy(t)]))),t.additionalProperties=!1,e.required!=null&&(t.required=e.required)),e.items!=null&&(t.items=Array.isArray(e.items)?e.items.map(Yy):Yy(e.items)),typeof e.format==`string`&&rx.has(e.format)&&(t.format=e.format);let r=Zy(e);return r!=null&&(t.description=t.description==null?r:`${t.description}
|
|
54
|
+
${r}`),t}function Zy(e){let t=ix.flatMap(t=>{let n=e[t];return n==null||n===!1?[]:`${Qy(t)}: ${$y(n)}`});return typeof e.format==`string`&&!rx.has(e.format)&&t.push(`format: ${e.format}`),t.length===0?void 0:`${t.join(`; `)}.`}function Qy(e){return e.replace(/[A-Z]/g,e=>` ${e.toLowerCase()}`)}function $y(e){return typeof e==`string`?e:JSON.stringify(e)}function eb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tb(e,t,n){if(e.type===`web_search_result_location`)return{type:`source`,sourceType:`url`,id:n(),url:e.url,title:e.title,providerMetadata:{anthropic:{citedText:e.cited_text,encryptedIndex:e.encrypted_index}}};if(e.type!==`page_location`&&e.type!==`char_location`)return;let r=t[e.document_index];if(r)return{type:`source`,sourceType:`document`,id:n(),mediaType:r.mediaType,title:e.document_title??r.title,filename:r.filename,providerMetadata:{anthropic:e.type===`page_location`?{citedText:e.cited_text,startPageNumber:e.start_page_number,endPageNumber:e.end_page_number}:{citedText:e.cited_text,startCharIndex:e.start_char_index,endCharIndex:e.end_char_index}}}}function nb(e){return e.includes(`claude-opus-4-8`)||e.includes(`claude-opus-4-7`)||e.includes(`claude-fable-5`)||e.includes(`claude-sonnet-5`)?{maxOutputTokens:128e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!0,rejectsSamplingParameters:!0,supportsXhighEffort:!0,isKnownModel:!0}:e.includes(`claude-sonnet-4-6`)||e.includes(`claude-opus-4-6`)?{maxOutputTokens:128e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!0,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-sonnet-4-5`)||e.includes(`claude-opus-4-5`)||e.includes(`claude-haiku-4-5`)?{maxOutputTokens:64e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-opus-4-1`)?{maxOutputTokens:32e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-sonnet-4-`)?{maxOutputTokens:64e3,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-opus-4-`)?{maxOutputTokens:32e3,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-3-haiku`)?{maxOutputTokens:4096,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:{maxOutputTokens:4096,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!1}}function rb(e){if(!e)return!1;let t=!1,n=!1;for(let r of e){if(`type`in r&&(r.type===`web_fetch_20260209`||r.type===`web_search_20260209`)){t=!0;continue}if(r.name===`code_execution`){n=!0;break}}return t&&!n}function ib({reasoning:e,supportsAdaptiveThinking:t,supportsXhighEffort:n,maxOutputTokensForModel:r,warnings:i}){if(!Em(e))return;if(e===`none`)return{thinking:{type:`disabled`}};if(t)return{thinking:{type:`adaptive`},effort:Dm({reasoning:e,effortMap:{minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:n?`xhigh`:`max`},warnings:i})};let a=Om({reasoning:e,maxOutputTokens:r,maxReasoningBudget:r,warnings:i});if(a!=null)return{thinking:{type:`enabled`,budgetTokens:a}}}function ab(e){return e?{appliedEdits:e.applied_edits.map(e=>{switch(e.type){case`clear_tool_uses_20250919`:return{type:e.type,clearedToolUses:e.cleared_tool_uses,clearedInputTokens:e.cleared_input_tokens};case`clear_thinking_20251015`:return{type:e.type,clearedThinkingTurns:e.cleared_thinking_turns,clearedInputTokens:e.cleared_input_tokens};case`compact_20260112`:return{type:e.type}}}).filter(e=>e!==void 0)}:null}function ob(e){if(e!=null)return{type:e.type,...e.category==null?{}:{category:e.category},...e.explanation==null?{}:{explanation:e.explanation},...e.recommended_model==null?{}:{recommendedModel:e.recommended_model}}}function sb(e={}){let{execute:t,...n}=e;return ox(t===void 0?{...n,execute:async({command:e},{abortSignal:t,experimental_sandbox:n})=>{if(!n)throw Error(`Sandbox session is not available`);return await n.run({command:e,abortSignal:t})}}:{...n,...t===null?{}:{execute:t}})}function cb(e={}){let{execute:t,...n}=e;return sx(t===void 0?{...n,execute:async({command:e},{abortSignal:t,experimental_sandbox:n})=>{if(!n)throw Error(`Sandbox session is not available`);return await n.run({command:e,abortSignal:t})}}:{...n,...t===null?{}:{execute:t}})}function lb(e){let t=Uh(e);return t===Cx?wx:t}function ub(e={}){let t=lb(Tm({settingValue:e.baseURL,environmentVariableName:`ANTHROPIC_BASE_URL`}))??wx,n=e.name??`anthropic.messages`;if(e.apiKey&&e.authToken)throw new di({argument:`apiKey/authToken`,message:`Both apiKey and authToken were provided. Please use only one authentication method.`});let r=()=>ym({"anthropic-version":`2023-06-01`,...e.authToken?{Authorization:`Bearer ${e.authToken}`}:{"x-api-key":wm({apiKey:e.apiKey,environmentVariableName:`ANTHROPIC_API_KEY`,description:`Anthropic`})},...e.headers},`ai-sdk/anthropic/${Sx}`),i=i=>new ax(i,{provider:n,baseURL:t,headers:r,fetch:e.fetch,generateId:e.generateId??cg,supportedUrls:()=>({"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]})}),a=()=>new xx({provider:`${n.replace(`.messages`,``)}.skills`,baseURL:t,headers:r,fetch:e.fetch}),o=function(e){if(new.target)throw Error(`The Anthropic model function cannot be called with the new keyword.`);return i(e)};return o.specificationVersion=`v4`,o.languageModel=i,o.chat=i,o.messages=i,o.embeddingModel=e=>{throw new Ui({modelId:e,modelType:`embeddingModel`})},o.textEmbeddingModel=o.embeddingModel,o.imageModel=e=>{throw new Ui({modelId:e,modelType:`imageModel`})},o.files=()=>new pb({provider:n,baseURL:t,headers:r,fetch:e.fetch}),o.skills=a,o.tools=vx,o}var db,fb,pb,mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Cx,wx,Tx=t((()=>{ma(),Xg(),Nd(),db=Wg({errorSchema:K(()=>q(z({type:H(`error`),error:z({type:I(),message:I()})}))),errorToMessage:e=>e.error.message}),fb=K(()=>q(z({id:I(),type:H(`file`),filename:I(),mime_type:I(),size_bytes:L(),created_at:I(),downloadable:ou().nullish()}))),pb=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadFile({data:e,mediaType:t,filename:n}){let r=qp(e),i=new Blob([r],{type:t}),a=new FormData;n==null?a.append(`file`,i):a.append(`file`,i,n);let{value:o}=await Bg({url:`${this.config.baseURL}/files`,headers:Up(this.config.headers(),{"anthropic-beta":`files-api-2025-04-14`}),formData:a,failedResponseHandler:db,successfulResponseHandler:Kg(fb),fetch:this.config.fetch});return{warnings:[],providerReference:{anthropic:o.id},mediaType:o.mime_type??t,filename:o.filename??n,providerMetadata:{anthropic:{filename:o.filename,mimeType:o.mime_type,sizeBytes:o.size_bytes,createdAt:o.created_at,...o.downloadable==null?{}:{downloadable:o.downloadable}}}}}},mb=z({type:I(),category:I().nullish(),explanation:I().nullish(),recommended_model:I().nullish()}),hb=K(()=>q(z({type:H(`message`),id:I().nullish(),model:I().nullish(),content:R(fu(`type`,[z({type:H(`text`),text:I(),citations:R(fu(`type`,[z({type:H(`web_search_result_location`),cited_text:I(),url:I(),title:I(),encrypted_index:I()}),z({type:H(`page_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_page_number:L(),end_page_number:L()}),z({type:H(`char_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_char_index:L(),end_char_index:L()})])).optional()}),z({type:H(`thinking`),thinking:I(),signature:I()}),z({type:H(`redacted_thinking`),data:I()}),z({type:H(`compaction`),content:I()}),z({type:H(`tool_use`),id:I(),name:I(),input:lu(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`server_tool_use`),id:I(),name:I(),input:hu(I(),lu()).nullish(),caller:B([z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`mcp_tool_use`),id:I(),name:I(),input:lu(),server_name:I()}),z({type:H(`mcp_tool_result`),tool_use_id:I(),is_error:ou(),content:R(B([I(),z({type:H(`text`),text:I()})]))}),z({type:H(`web_fetch_tool_result`),tool_use_id:I(),content:B([z({type:H(`web_fetch_result`),url:I(),retrieved_at:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:ou()}).optional(),source:B([z({type:H(`base64`),media_type:H(`application/pdf`),data:I()}),z({type:H(`text`),media_type:H(`text/plain`),data:I()})])})}),z({type:H(`web_fetch_tool_result_error`),error_code:I()})])}),z({type:H(`web_search_tool_result`),tool_use_id:I(),content:B([R(z({type:H(`web_search_result`),url:I(),title:I(),encrypted_content:I(),page_age:I().nullish()})),z({type:H(`web_search_tool_result_error`),error_code:I()})])}),z({type:H(`code_execution_tool_result`),tool_use_id:I(),content:B([z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`bash_code_execution_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`text_editor_code_execution_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:ou()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})])}),z({type:H(`tool_search_tool_result`),tool_use_id:I(),content:B([z({type:H(`tool_search_tool_search_result`),tool_references:R(z({type:H(`tool_reference`),tool_name:I()}))}),z({type:H(`tool_search_tool_result_error`),error_code:I()})])}),z({type:H(`advisor_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encrypted_content:I()}),z({type:H(`advisor_tool_result_error`),error_code:I()})])}),z({type:H(`fallback`)})])),stop_reason:I().nullish(),stop_sequence:I().nullish(),stop_details:mb.nullish(),usage:du({input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish(),iterations:R(z({type:B([H(`compaction`),H(`message`),H(`advisor_message`),H(`fallback_message`)]),model:I().nullish(),input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()})).nullish()}),container:z({expires_at:I(),id:I(),skills:R(z({type:B([H(`anthropic`),H(`custom`)]),skill_id:I(),version:I()})).nullish()}).nullish(),context_management:z({applied_edits:R(B([z({type:H(`clear_tool_uses_20250919`),cleared_tool_uses:L(),cleared_input_tokens:L()}),z({type:H(`clear_thinking_20251015`),cleared_thinking_turns:L(),cleared_input_tokens:L()}),z({type:H(`compact_20260112`)})]))}).nullish()}))),gb=K(()=>q(fu(`type`,[z({type:H(`message_start`),message:z({id:I().nullish(),model:I().nullish(),role:I().nullish(),usage:du({input_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()}),content:R(fu(`type`,[z({type:H(`tool_use`),id:I(),name:I(),input:lu(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()})])).nullish(),stop_reason:I().nullish(),container:z({expires_at:I(),id:I()}).nullish()})}),z({type:H(`content_block_start`),index:L(),content_block:fu(`type`,[z({type:H(`text`),text:I()}),z({type:H(`thinking`),thinking:I()}),z({type:H(`tool_use`),id:I(),name:I(),input:hu(I(),lu()).optional(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`redacted_thinking`),data:I()}),z({type:H(`compaction`),content:I().nullish()}),z({type:H(`server_tool_use`),id:I(),name:I(),input:hu(I(),lu()).nullish(),caller:B([z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`mcp_tool_use`),id:I(),name:I(),input:lu(),server_name:I()}),z({type:H(`mcp_tool_result`),tool_use_id:I(),is_error:ou(),content:R(B([I(),z({type:H(`text`),text:I()})]))}),z({type:H(`web_fetch_tool_result`),tool_use_id:I(),content:B([z({type:H(`web_fetch_result`),url:I(),retrieved_at:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:ou()}).optional(),source:B([z({type:H(`base64`),media_type:H(`application/pdf`),data:I()}),z({type:H(`text`),media_type:H(`text/plain`),data:I()})])})}),z({type:H(`web_fetch_tool_result_error`),error_code:I()})])}),z({type:H(`web_search_tool_result`),tool_use_id:I(),content:B([R(z({type:H(`web_search_result`),url:I(),title:I(),encrypted_content:I(),page_age:I().nullish()})),z({type:H(`web_search_tool_result_error`),error_code:I()})])}),z({type:H(`code_execution_tool_result`),tool_use_id:I(),content:B([z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`bash_code_execution_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`text_editor_code_execution_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:ou()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})])}),z({type:H(`tool_search_tool_result`),tool_use_id:I(),content:B([z({type:H(`tool_search_tool_search_result`),tool_references:R(z({type:H(`tool_reference`),tool_name:I()}))}),z({type:H(`tool_search_tool_result_error`),error_code:I()})])}),z({type:H(`advisor_tool_result`),tool_use_id:I(),content:fu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encrypted_content:I()}),z({type:H(`advisor_tool_result_error`),error_code:I()})])}),z({type:H(`fallback`)})])}),z({type:H(`content_block_delta`),index:L(),delta:fu(`type`,[z({type:H(`input_json_delta`),partial_json:I()}),z({type:H(`text_delta`),text:I()}),z({type:H(`thinking_delta`),thinking:I()}),z({type:H(`signature_delta`),signature:I()}),z({type:H(`compaction_delta`),content:I().nullish()}),z({type:H(`citations_delta`),citation:fu(`type`,[z({type:H(`web_search_result_location`),cited_text:I(),url:I(),title:I(),encrypted_index:I()}),z({type:H(`page_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_page_number:L(),end_page_number:L()}),z({type:H(`char_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_char_index:L(),end_char_index:L()})])})])}),z({type:H(`content_block_stop`),index:L()}),z({type:H(`error`),error:z({type:I(),message:I()})}),z({type:H(`message_delta`),delta:z({stop_reason:I().nullish(),stop_sequence:I().nullish(),stop_details:mb.nullish(),container:z({expires_at:I(),id:I(),skills:R(z({type:B([H(`anthropic`),H(`custom`)]),skill_id:I(),version:I()})).nullish()}).nullish()}),usage:du({input_tokens:L().nullish(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish(),iterations:R(z({type:B([H(`compaction`),H(`message`),H(`advisor_message`),H(`fallback_message`)]),model:I().nullish(),input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()})).nullish()}),context_management:z({applied_edits:R(B([z({type:H(`clear_tool_uses_20250919`),cleared_tool_uses:L(),cleared_input_tokens:L()}),z({type:H(`clear_thinking_20251015`),cleared_thinking_turns:L(),cleared_input_tokens:L()}),z({type:H(`compact_20260112`)})]))}).nullish()}),z({type:H(`message_stop`)}),z({type:H(`ping`)})]))),_b=K(()=>q(z({signature:I().optional(),redactedData:I().optional()}))),vb=z({containerUpload:ou().optional(),citations:z({enabled:ou()}).optional(),title:I().optional(),context:I().optional()}),yb=z({sendReasoning:ou().optional(),structuredOutputMode:V([`outputFormat`,`jsonTool`,`auto`]).optional(),thinking:fu(`type`,[z({type:H(`adaptive`),display:V([`omitted`,`summarized`]).optional()}),z({type:H(`enabled`),budgetTokens:L().optional()}),z({type:H(`disabled`)})]).optional(),disableParallelToolUse:ou().optional(),cacheControl:z({type:H(`ephemeral`),ttl:B([H(`5m`),H(`1h`)]).optional()}).optional(),metadata:z({userId:I().optional()}).optional(),mcpServers:R(z({type:H(`url`),name:I(),url:I(),authorizationToken:I().nullish(),toolConfiguration:z({enabled:ou().nullish(),allowedTools:R(I()).nullish()}).nullish()})).optional(),container:z({id:I().optional(),skills:R(fu(`type`,[z({type:H(`anthropic`),skillId:I(),version:I().optional()}),z({type:H(`custom`),providerReference:hu(I(),I()),version:I().optional()})])).optional()}).optional(),toolStreaming:ou().optional(),effort:V([`low`,`medium`,`high`,`xhigh`,`max`]).optional(),taskBudget:z({type:H(`tokens`),total:L().int().min(2e4),remaining:L().int().min(0).optional()}).optional(),speed:V([`fast`,`standard`]).optional(),inferenceGeo:V([`us`,`global`]).optional(),fallbacks:R(z({model:I(),max_tokens:L().int().optional(),thinking:hu(I(),lu()).optional(),output_config:hu(I(),lu()).optional(),speed:V([`fast`,`standard`]).optional()})).optional(),anthropicBeta:R(I()).optional(),contextManagement:z({edits:R(fu(`type`,[z({type:H(`clear_tool_uses_20250919`),trigger:fu(`type`,[z({type:H(`input_tokens`),value:L()}),z({type:H(`tool_uses`),value:L()})]).optional(),keep:z({type:H(`tool_uses`),value:L()}).optional(),clearAtLeast:z({type:H(`input_tokens`),value:L()}).optional(),clearToolInputs:ou().optional(),excludeTools:R(I()).optional()}),z({type:H(`clear_thinking_20251015`),keep:B([H(`all`),z({type:H(`thinking_turns`),value:L()})]).optional()}),z({type:H(`compact_20260112`),trigger:z({type:H(`input_tokens`),value:L()}).optional(),pauseAfterCompaction:ou().optional(),instructions:I().optional()})]))}).optional()}),bb=4,xb=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(e,t){let n=Ry(e);if(n){if(!t.canCache){this.warnings.push({type:`unsupported`,feature:`cache_control on non-cacheable context`,details:`cache_control cannot be set on ${t.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>bb){this.warnings.push({type:`unsupported`,feature:`cacheControl breakpoint limit`,details:`Maximum ${bb} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return n}}getWarnings(){return this.warnings}},Sb=K(()=>q(z({model:I(),maxUses:L().optional(),caching:z({type:H(`ephemeral`),ttl:B([H(`5m`),H(`1h`)])}).optional()}))),Cb=K(()=>q(fu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encryptedContent:I()}),z({type:H(`advisor_tool_result_error`),errorCode:I()})]))),wb=jh({id:`anthropic.advisor_20260301`,inputSchema:K(()=>q(z({}).strict())),outputSchema:Cb,supportsDeferredResults:!0}),Tb=e=>wb(e),Eb=K(()=>q(z({maxCharacters:L().optional()}))),Db=kh({id:`anthropic.text_editor_20250728`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),Ob=(e={})=>Db(e),kb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),userLocation:z({type:H(`approximate`),city:I().optional(),region:I().optional(),country:I().optional(),timezone:I().optional()}).optional()}))),Ab=K(()=>q(R(z({url:I(),title:I().nullable(),pageAge:I().nullable(),encryptedContent:I(),type:H(`web_search_result`)})))),jb=jh({id:`anthropic.web_search_20260209`,inputSchema:K(()=>q(z({query:I()}))),outputSchema:Ab,supportsDeferredResults:!0}),Mb=(e={})=>jb(e),Nb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),userLocation:z({type:H(`approximate`),city:I().optional(),region:I().optional(),country:I().optional(),timezone:I().optional()}).optional()}))),Pb=K(()=>q(R(z({url:I(),title:I().nullable(),pageAge:I().nullable(),encryptedContent:I(),type:H(`web_search_result`)})))),Fb=jh({id:`anthropic.web_search_20250305`,inputSchema:K(()=>q(z({query:I()}))),outputSchema:Pb,supportsDeferredResults:!0}),Ib=(e={})=>Fb(e),Lb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),citations:z({enabled:ou()}).optional(),maxContentTokens:L().optional()}))),Rb=K(()=>q(z({type:H(`web_fetch_result`),url:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:ou()}).optional(),source:B([z({type:H(`base64`),mediaType:H(`application/pdf`),data:I()}),z({type:H(`text`),mediaType:H(`text/plain`),data:I()})])}),retrievedAt:I().nullable()}))),zb=jh({id:`anthropic.web_fetch_20260209`,inputSchema:K(()=>q(z({url:I()}))),outputSchema:Rb,supportsDeferredResults:!0}),Bb=(e={})=>zb(e),Vb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),citations:z({enabled:ou()}).optional(),maxContentTokens:L().optional()}))),Hb=K(()=>q(z({type:H(`web_fetch_result`),url:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:ou()}).optional(),source:B([z({type:H(`base64`),mediaType:H(`application/pdf`),data:I()}),z({type:H(`text`),mediaType:H(`text/plain`),data:I()})])}),retrievedAt:I().nullable()}))),Ub=jh({id:`anthropic.web_fetch_20250910`,inputSchema:K(()=>q(z({url:I()}))),outputSchema:Hb,supportsDeferredResults:!0}),Wb=(e={})=>Ub(e),Gb=K(()=>q(z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}))),Kb=jh({id:`anthropic.code_execution_20250522`,inputSchema:K(()=>q(z({code:I()}))),outputSchema:Gb}),qb=(e={})=>Kb(e),Jb=K(()=>q(fu(`type`,[z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:ou()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})]))),Yb=jh({id:`anthropic.code_execution_20250825`,inputSchema:K(()=>q(fu(`type`,[z({type:H(`programmatic-tool-call`),code:I()}),z({type:H(`bash_code_execution`),command:I()}),fu(`command`,[z({type:H(`text_editor_code_execution`),command:H(`view`),path:I()}),z({type:H(`text_editor_code_execution`),command:H(`create`),path:I(),file_text:I().nullish()}),z({type:H(`text_editor_code_execution`),command:H(`str_replace`),path:I(),old_str:I(),new_str:I()})])]))),outputSchema:Jb,supportsDeferredResults:!0}),Xb=(e={})=>Yb(e),Zb=K(()=>q(fu(`type`,[z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:ou()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})]))),Qb=jh({id:`anthropic.code_execution_20260120`,inputSchema:K(()=>q(fu(`type`,[z({type:H(`programmatic-tool-call`),code:I()}),z({type:H(`bash_code_execution`),command:I()}),fu(`command`,[z({type:H(`text_editor_code_execution`),command:H(`view`),path:I()}),z({type:H(`text_editor_code_execution`),command:H(`create`),path:I(),file_text:I().nullish()}),z({type:H(`text_editor_code_execution`),command:H(`str_replace`),path:I(),old_str:I(),new_str:I()})])]))),outputSchema:Zb,supportsDeferredResults:!0}),$b=(e={})=>Qb(e),ex=K(()=>q(R(z({type:H(`tool_reference`),toolName:I()})))),tx=jh({id:`anthropic.tool_search_regex_20251119`,inputSchema:K(()=>q(z({pattern:I(),limit:L().optional()}))),outputSchema:ex,supportsDeferredResults:!0}),nx=(e={})=>tx(e),rx=new Set([`date-time`,`time`,`date`,`duration`,`email`,`hostname`,`uri`,`ipv4`,`ipv6`,`uuid`]),ix=[`minimum`,`maximum`,`exclusiveMinimum`,`exclusiveMaximum`,`multipleOf`,`minLength`,`maxLength`,`pattern`,`minItems`,`maxItems`,`uniqueItems`,`minProperties`,`maxProperties`,`not`],ax=class e{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.config=t,this.generateId=t.generateId??cg}static[zp](e){return Rh({modelId:e.modelId,config:e.config})}static[Bp](t){return new e(t.modelId,t.config)}supportsUrl(e){return e.protocol===`https:`}get provider(){return this.config.provider}get providerOptionsName(){let e=this.config.provider,t=e.indexOf(`.`);return t===-1?e:e.substring(0,t)}get supportedUrls(){var e;return(e=this.config).supportedUrls?.call(e)??{}}async getArgs({userSuppliedBetas:e,prompt:t,maxOutputTokens:n,temperature:r,topP:i,topK:a,frequencyPenalty:o,presencePenalty:s,stopSequences:c,responseFormat:l,seed:u,tools:d,toolChoice:f,reasoning:p,providerOptions:m,stream:h}){let g=[];o!=null&&g.push({type:`unsupported`,feature:`frequencyPenalty`}),s!=null&&g.push({type:`unsupported`,feature:`presencePenalty`}),u!=null&&g.push({type:`unsupported`,feature:`seed`}),r!=null&&r>1?(g.push({type:`unsupported`,feature:`temperature`,details:`${r} exceeds anthropic maximum of 1.0. clamped to 1.0`}),r=1):r!=null&&r<0&&(g.push({type:`unsupported`,feature:`temperature`,details:`${r} is below anthropic minimum of 0. clamped to 0`}),r=0),l?.type===`json`&&(l.schema??g.push({type:`unsupported`,feature:`responseFormat`,details:`JSON response format requires a schema. The response format is ignored.`}));let _=this.providerOptionsName,v=await Dh({provider:`anthropic`,providerOptions:m,schema:yb}),y=_===`anthropic`?null:await Dh({provider:_,providerOptions:m,schema:yb}),b=y!=null,x=Object.assign({},v??{},y??{}),{maxOutputTokens:S,supportsStructuredOutput:C,supportsAdaptiveThinking:w,rejectsSamplingParameters:T,supportsXhighEffort:E,isKnownModel:D}=nb(this.modelId);T&&(r!=null&&(g.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported by ${this.modelId} and will be ignored`}),r=void 0),a!=null&&(g.push({type:`unsupported`,feature:`topK`,details:`topK is not supported by ${this.modelId} and will be ignored`}),a=void 0),i!=null&&(g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported by ${this.modelId} and will be ignored`}),i=void 0));let O=D||this.modelId.startsWith(`claude-`),k=(this.config.supportsNativeStructuredOutput??!0)&&C,ee=(this.config.supportsStrictTools??!0)&&C,te=x?.structuredOutputMode??`auto`,A=te===`outputFormat`||te===`auto`&&k,ne=l?.type===`json`&&l.schema!=null&&!A?{type:`function`,name:`json`,description:`Respond with a JSON object.`,inputSchema:l.schema}:void 0,re=x?.contextManagement,ie=new xb,ae=Yp({tools:d,providerToolNames:{"anthropic.code_execution_20250522":`code_execution`,"anthropic.code_execution_20250825":`code_execution`,"anthropic.code_execution_20260120":`code_execution`,"anthropic.computer_20241022":`computer`,"anthropic.computer_20250124":`computer`,"anthropic.text_editor_20241022":`str_replace_editor`,"anthropic.text_editor_20250124":`str_replace_editor`,"anthropic.text_editor_20250429":`str_replace_based_edit_tool`,"anthropic.text_editor_20250728":`str_replace_based_edit_tool`,"anthropic.bash_20241022":`bash`,"anthropic.bash_20250124":`bash`,"anthropic.memory_20250818":`memory`,"anthropic.web_search_20250305":`web_search`,"anthropic.web_search_20260209":`web_search`,"anthropic.web_fetch_20250910":`web_fetch`,"anthropic.web_fetch_20260209":`web_fetch`,"anthropic.tool_search_regex_20251119":`tool_search_tool_regex`,"anthropic.tool_search_bm25_20251119":`tool_search_tool_bm25`,"anthropic.advisor_20260301":`advisor`}}),{prompt:oe,betas:se}=await Uy({prompt:t,sendReasoning:x?.sendReasoning??!0,warnings:g,cacheControlValidator:ie,toolNameMapping:ae});if(Em(p)&&x?.effort==null){let e=ib({reasoning:p,supportsAdaptiveThinking:w,supportsXhighEffort:E,maxOutputTokensForModel:S,warnings:g});e!=null&&(x.thinking??=e.thinking,e.effort!=null&&x.thinking?.type!==`disabled`&&(x.effort=e.effort))}let ce=x?.thinking?.type,le=ce===`enabled`||ce===`adaptive`,ue=le||ce===`disabled`,de=ce===`enabled`?x?.thinking?.budgetTokens:void 0,fe=ce===`adaptive`?x?.thinking?.display:void 0,pe=n??S,me={model:this.modelId,max_tokens:pe,temperature:r,top_k:a,top_p:i,stop_sequences:c,...ue&&{thinking:{type:ce,...de!=null&&{budget_tokens:de},...fe!=null&&{display:fe}}},...(x?.effort||x?.taskBudget||A&&l?.type===`json`&&l.schema!=null)&&{output_config:{...x?.effort&&{effort:x.effort},...x?.taskBudget&&{task_budget:{type:x.taskBudget.type,total:x.taskBudget.total,...x.taskBudget.remaining!=null&&{remaining:x.taskBudget.remaining}}},...A&&l?.type===`json`&&l.schema!=null&&{format:{type:`json_schema`,schema:Jy(l.schema)}}}},...x?.speed&&{speed:x.speed},...x?.inferenceGeo&&{inference_geo:x.inferenceGeo},...x?.fallbacks&&x.fallbacks.length>0&&{fallbacks:x.fallbacks},...x?.cacheControl&&{cache_control:x.cacheControl},...x?.metadata?.userId!=null&&{metadata:{user_id:x.metadata.userId}},...x?.mcpServers&&x.mcpServers.length>0&&{mcp_servers:x.mcpServers.map(e=>({type:e.type,name:e.name,url:e.url,authorization_token:e.authorizationToken,tool_configuration:e.toolConfiguration?{allowed_tools:e.toolConfiguration.allowedTools,enabled:e.toolConfiguration.enabled}:void 0}))},...x?.container&&{container:x.container.skills&&x.container.skills.length>0?{id:x.container.id,skills:x.container.skills.map(e=>({type:e.type,skill_id:e.type===`custom`?Ph({reference:e.providerReference,provider:`anthropic`}):e.skillId,version:e.version}))}:x.container.id},system:oe.system,messages:oe.messages,...re&&{context_management:{edits:re.edits.map(e=>{let t=e.type;switch(t){case`clear_tool_uses_20250919`:return{type:e.type,...e.trigger!==void 0&&{trigger:e.trigger},...e.keep!==void 0&&{keep:e.keep},...e.clearAtLeast!==void 0&&{clear_at_least:e.clearAtLeast},...e.clearToolInputs!==void 0&&{clear_tool_inputs:e.clearToolInputs},...e.excludeTools!==void 0&&{exclude_tools:e.excludeTools}};case`clear_thinking_20251015`:return{type:e.type,...e.keep!==void 0&&{keep:e.keep}};case`compact_20260112`:return{type:e.type,...e.trigger!==void 0&&{trigger:e.trigger},...e.pauseAfterCompaction!==void 0&&{pause_after_compaction:e.pauseAfterCompaction},...e.instructions!==void 0&&{instructions:e.instructions}};default:g.push({type:`other`,message:`Unknown context management strategy: ${t}`});return}}).filter(e=>e!==void 0)}}};le?(ce===`enabled`&&de==null&&(g.push({type:`compatibility`,feature:`extended thinking`,details:`thinking budget is required when thinking is enabled. using default budget of 1024 tokens.`}),me.thinking={type:`enabled`,budget_tokens:1024},de=1024),me.temperature!=null&&(me.temperature=void 0,g.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported when thinking is enabled`})),a!=null&&(me.top_k=void 0,g.push({type:`unsupported`,feature:`topK`,details:`topK is not supported when thinking is enabled`})),i!=null&&(me.top_p=void 0,g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when thinking is enabled`})),me.max_tokens=pe+(de??0)):O&&i!=null&&r!=null&&(g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when temperature is set. topP is ignored.`}),me.top_p=void 0),D&&me.max_tokens>S&&(n!=null&&g.push({type:`unsupported`,feature:`maxOutputTokens`,details:`${me.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${S} max output tokens. The max output tokens have been limited to ${S}.`}),me.max_tokens=S),x?.mcpServers&&x.mcpServers.length>0&&se.add(`mcp-client-2025-04-04`),re&&(se.add(`context-management-2025-06-27`),re.edits.some(e=>e.type===`compact_20260112`)&&se.add(`compact-2026-01-12`)),x?.container&&x.container.skills&&x.container.skills.length>0&&(se.add(`code-execution-2025-08-25`),se.add(`skills-2025-10-02`),se.add(`files-api-2025-04-14`),d?.some(e=>e.type===`provider`&&(e.id===`anthropic.code_execution_20250825`||e.id===`anthropic.code_execution_20260120`))||g.push({type:`other`,message:`code execution tool is required when using skills`})),x?.taskBudget&&se.add(`task-budgets-2026-03-13`),x?.speed===`fast`&&se.add(`fast-mode-2026-02-01`),x?.fallbacks&&x.fallbacks.length>0&&se.add(`server-side-fallback-2026-06-01`);let he=h&&(x?.toolStreaming??!0),{tools:ge,toolChoice:_e,toolWarnings:ve,betas:ye}=await zy(ne==null?{tools:d??[],toolChoice:f,disableParallelToolUse:x?.disableParallelToolUse,cacheControlValidator:ie,supportsStructuredOutput:k,supportsStrictTools:ee,defaultEagerInputStreaming:he}:{tools:[...d??[],ne],toolChoice:{type:`required`},disableParallelToolUse:!0,cacheControlValidator:ie,supportsStructuredOutput:!1,supportsStrictTools:ee,defaultEagerInputStreaming:he}),be=ie.getWarnings();return{args:{...me,tools:ge,tool_choice:_e,stream:h===!0||void 0},warnings:[...g,...ve,...be],betas:new Set([...se,...ye,...e,...x?.anthropicBeta??[]]),usesJsonResponseTool:ne!=null,toolNameMapping:ae,providerOptionsName:_,usedCustomProviderKey:b}}async getHeaders({betas:e,headers:t}){return Up(this.config.headers?await Mh(this.config.headers):void 0,t,e.size>0?{"anthropic-beta":Array.from(e).join(`,`)}:{})}async getBetasFromHeaders(e){let t=(this.config.headers?await Mh(this.config.headers):void 0)?.[`anthropic-beta`]??``,n=e?.[`anthropic-beta`]??``;return new Set([...t.toLowerCase().split(`,`),...n.toLowerCase().split(`,`)].map(e=>e.trim()).filter(e=>e!==``))}buildRequestUrl(e){var t;return(t=this.config).buildRequestUrl?.call(t,this.config.baseURL,e)??`${this.config.baseURL}/messages`}transformRequestBody(e,t){var n;return(n=this.config).transformRequestBody?.call(n,e,t)??e}extractCitationDocuments(e){return e.filter(e=>e.role===`user`).flatMap(e=>e.content).filter(e=>e.type!==`file`||e.mediaType!==`application/pdf`&&e.mediaType!==`text/plain`?!1:e.providerOptions?.anthropic?.citations?.enabled??!1).map(e=>{let t=e;return{title:t.filename??`Untitled Document`,filename:t.filename,mediaType:t.mediaType}})}async doGenerate(e){let{args:t,warnings:n,betas:r,usesJsonResponseTool:i,toolNameMapping:a,providerOptionsName:o,usedCustomProviderKey:s}=await this.getArgs({...e,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(e.headers)}),c=[...this.extractCitationDocuments(e.prompt)],l=rb(t.tools),{responseHeaders:u,value:d,rawValue:f}=await zg({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:db,successfulResponseHandler:Kg(hb),abortSignal:e.abortSignal,fetch:this.config.fetch}),p=[],m={},h={},g=!1;for(let e of d.content)switch(e.type){case`text`:if(!i&&(p.push({type:`text`,text:e.text}),e.citations))for(let t of e.citations){let e=tb(t,c,this.generateId);e&&p.push(e)}break;case`thinking`:p.push({type:`reasoning`,text:e.thinking,providerMetadata:{anthropic:{signature:e.signature}}});break;case`redacted_thinking`:p.push({type:`reasoning`,text:``,providerMetadata:{anthropic:{redactedData:e.data}}});break;case`compaction`:p.push({type:`text`,text:e.content,providerMetadata:{anthropic:{type:`compaction`}}});break;case`tool_use`:if(i&&e.name===`json`)g=!0,p.push({type:`text`,text:JSON.stringify(e.input)});else{let t=e.caller,n=t?{type:t.type,toolId:`tool_id`in t?t.tool_id:void 0}:void 0;p.push({type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),...n&&{providerMetadata:{anthropic:{caller:n}}}})}break;case`server_tool_use`:if(e.name===`text_editor_code_execution`||e.name===`bash_code_execution`)p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(`code_execution`),input:JSON.stringify({type:e.name,...e.input}),providerExecuted:!0,...l?{dynamic:!0}:{}});else if(e.name===`web_search`||e.name===`code_execution`||e.name===`web_fetch`){let t=e.name===`code_execution`&&e.input!=null&&typeof e.input==`object`&&`code`in e.input&&!(`type`in e.input)?{type:`programmatic-tool-call`,...e.input}:e.input;p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(e.name),input:JSON.stringify(t),providerExecuted:!0,...l&&e.name===`code_execution`?{dynamic:!0}:{}})}else e.name===`tool_search_tool_regex`||e.name===`tool_search_tool_bm25`?(h[e.id]=e.name,p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(e.name),input:JSON.stringify(e.input),providerExecuted:!0})):e.name===`advisor`&&p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(`advisor`),input:JSON.stringify(e.input),providerExecuted:!0});break;case`mcp_tool_use`:m[e.id]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:`mcp-tool-use`,serverName:e.server_name}}},p.push(m[e.id]);break;case`mcp_tool_result`:p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:m[e.tool_use_id].toolName,isError:e.is_error,result:e.content,dynamic:!0,providerMetadata:m[e.tool_use_id].providerMetadata});break;case`web_fetch_tool_result`:e.content.type===`web_fetch_result`?(c.push({title:e.content.content.title??e.content.url,mediaType:e.content.content.source.media_type}),p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),result:{type:`web_fetch_result`,url:e.content.url,retrievedAt:e.content.retrieved_at,content:{type:e.content.content.type,title:e.content.content.title,citations:e.content.content.citations,source:{type:e.content.content.source.type,mediaType:e.content.content.source.media_type,data:e.content.content.source.data}}}})):e.content.type===`web_fetch_tool_result_error`&&p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),isError:!0,result:{type:`web_fetch_tool_result_error`,errorCode:e.content.error_code}});break;case`web_search_tool_result`:if(Array.isArray(e.content)){p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),result:e.content.map(e=>({url:e.url,title:e.title,pageAge:e.page_age??null,encryptedContent:e.encrypted_content,type:e.type}))});for(let t of e.content)p.push({type:`source`,sourceType:`url`,id:this.generateId(),url:t.url,title:t.title,providerMetadata:{anthropic:{pageAge:t.page_age??null}}})}else p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),isError:!0,result:{type:`web_search_tool_result_error`,errorCode:e.content.error_code}});break;case`code_execution_tool_result`:e.content.type===`code_execution_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,stdout:e.content.stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`encrypted_code_execution_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,encrypted_stdout:e.content.encrypted_stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`code_execution_tool_result_error`&&p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),isError:!0,result:{type:`code_execution_tool_result_error`,errorCode:e.content.error_code}});break;case`bash_code_execution_tool_result`:case`text_editor_code_execution_tool_result`:p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:e.content});break;case`tool_search_tool_result`:{let t=h[e.tool_use_id];if(t==null){let e=a.toCustomToolName(`tool_search_tool_bm25`);a.toCustomToolName(`tool_search_tool_regex`),t=e===`tool_search_tool_bm25`?`tool_search_tool_regex`:`tool_search_tool_bm25`}e.content.type===`tool_search_tool_search_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),result:e.content.tool_references.map(e=>({type:e.type,toolName:e.tool_name}))}):p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),isError:!0,result:{type:`tool_search_tool_result_error`,errorCode:e.content.error_code}});break}case`advisor_tool_result`:{let t=a.toCustomToolName(`advisor`);e.content.type===`advisor_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_result`,text:e.content.text}}):e.content.type===`advisor_redacted_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_redacted_result`,encryptedContent:e.content.encrypted_content}}):p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,isError:!0,result:{type:`advisor_tool_result_error`,errorCode:e.content.error_code}});break}case`fallback`:break}return{content:p,finishReason:{unified:qy({finishReason:d.stop_reason,isJsonResponseFromTool:g}),raw:d.stop_reason??void 0},usage:By({usage:d.usage}),request:{body:t},response:{id:d.id??void 0,modelId:d.model??void 0,headers:u,body:f},warnings:n,providerMetadata:(()=>{let e=ob(d.stop_details),t={usage:d.usage,stopSequence:d.stop_sequence??null,...e==null?{}:{stopDetails:e},iterations:d.usage.iterations?d.usage.iterations.map(e=>({type:e.type,...e.model==null?{}:{model:e.model},inputTokens:e.input_tokens,outputTokens:e.output_tokens,...e.cache_creation_input_tokens?{cacheCreationInputTokens:e.cache_creation_input_tokens}:{},...e.cache_read_input_tokens?{cacheReadInputTokens:e.cache_read_input_tokens}:{}})):null,container:d.container?{expiresAt:d.container.expires_at,id:d.container.id,skills:d.container.skills?.map(e=>({type:e.type,skillId:e.skill_id,version:e.version}))??null}:null,contextManagement:ab(d.context_management)??null},n={anthropic:t};return s&&o!==`anthropic`&&(n[o]=t),n})()}}async doStream(e){"use step";let{args:t,warnings:n,betas:r,usesJsonResponseTool:i,toolNameMapping:a,providerOptionsName:o,usedCustomProviderKey:s}=await this.getArgs({...e,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(e.headers)}),c=[...this.extractCitationDocuments(e.prompt)],l=rb(t.tools),u=this.buildRequestUrl(!0),{responseHeaders:d,value:f}=await zg({url:u,headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:db,successfulResponseHandler:Gg(gb),abortSignal:e.abortSignal,fetch:this.config.fetch}),p={unified:`other`,raw:void 0},m={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},h={},g={},_={},v=null,y,b=null,x,S=null,C=!1,w,T=this.generateId,[E,D]=f.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:n})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){n.enqueue({type:`error`,error:t.error});return}let r=t.value;switch(r.type){case`ping`:return;case`content_block_start`:{let e=r.content_block,t=e.type;if(t===`fallback`)return;switch(w=t,t){case`text`:if(i)return;h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index)});return;case`thinking`:h[r.index]={type:`reasoning`},n.enqueue({type:`reasoning-start`,id:String(r.index)});return;case`redacted_thinking`:h[r.index]={type:`reasoning`},n.enqueue({type:`reasoning-start`,id:String(r.index),providerMetadata:{anthropic:{redactedData:e.data}}});return;case`compaction`:h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index),providerMetadata:{anthropic:{type:`compaction`}}});return;case`tool_use`:if(i&&e.name===`json`)C=!0,h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index)});else{let t=e.caller,i=t?{type:t.type,toolId:`tool_id`in t?t.tool_id:void 0}:void 0,a=e.input&&Object.keys(e.input).length>0?JSON.stringify(e.input):``;h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:a,firstDelta:a.length===0,...i&&{caller:i}},n.enqueue({type:`tool-input-start`,id:e.id,toolName:e.name})}return;case`server_tool_use`:if([`web_fetch`,`web_search`,`code_execution`,`text_editor_code_execution`,`bash_code_execution`].includes(e.name)){let t=e.name===`text_editor_code_execution`||e.name===`bash_code_execution`?`code_execution`:e.name,i=e.name===`text_editor_code_execution`||e.name===`bash_code_execution`?e.name:e.name===`code_execution`?`programmatic-tool-call`:void 0,o=a.toCustomToolName(t),s=e.input!=null&&typeof e.input==`object`&&Object.keys(e.input).length>0?JSON.stringify(e.input):``;h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:o,input:s,providerExecuted:!0,...l&&t===`code_execution`?{dynamic:!0}:{},firstDelta:s.length===0,providerToolName:t,providerToolInputType:i},n.enqueue({type:`tool-input-start`,id:e.id,toolName:o,providerExecuted:!0,...l&&t===`code_execution`?{dynamic:!0}:{}})}else if(e.name===`tool_search_tool_regex`||e.name===`tool_search_tool_bm25`){_[e.id]=e.name;let t=a.toCustomToolName(e.name);h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:t,input:``,providerExecuted:!0,firstDelta:!0,providerToolName:e.name},n.enqueue({type:`tool-input-start`,id:e.id,toolName:t,providerExecuted:!0})}else if(e.name===`advisor`){let t=a.toCustomToolName(`advisor`);h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:t,input:`{}`,providerExecuted:!0,firstDelta:!0,providerToolName:e.name},n.enqueue({type:`tool-input-start`,id:e.id,toolName:t,providerExecuted:!0})}return;case`web_fetch_tool_result`:e.content.type===`web_fetch_result`?(c.push({title:e.content.content.title??e.content.url,mediaType:e.content.content.source.media_type}),n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),result:{type:`web_fetch_result`,url:e.content.url,retrievedAt:e.content.retrieved_at,content:{type:e.content.content.type,title:e.content.content.title,citations:e.content.content.citations,source:{type:e.content.content.source.type,mediaType:e.content.content.source.media_type,data:e.content.content.source.data}}}})):e.content.type===`web_fetch_tool_result_error`&&n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),isError:!0,result:{type:`web_fetch_tool_result_error`,errorCode:e.content.error_code}});return;case`web_search_tool_result`:if(Array.isArray(e.content)){n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),result:e.content.map(e=>({url:e.url,title:e.title,pageAge:e.page_age??null,encryptedContent:e.encrypted_content,type:e.type}))});for(let t of e.content)n.enqueue({type:`source`,sourceType:`url`,id:T(),url:t.url,title:t.title,providerMetadata:{anthropic:{pageAge:t.page_age??null}}})}else n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),isError:!0,result:{type:`web_search_tool_result_error`,errorCode:e.content.error_code}});return;case`code_execution_tool_result`:e.content.type===`code_execution_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,stdout:e.content.stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`encrypted_code_execution_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,encrypted_stdout:e.content.encrypted_stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`code_execution_tool_result_error`&&n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),isError:!0,result:{type:`code_execution_tool_result_error`,errorCode:e.content.error_code}});return;case`bash_code_execution_tool_result`:case`text_editor_code_execution_tool_result`:n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:e.content});return;case`tool_search_tool_result`:{let t=_[e.tool_use_id];if(t==null){let e=a.toCustomToolName(`tool_search_tool_bm25`);a.toCustomToolName(`tool_search_tool_regex`),t=e===`tool_search_tool_bm25`?`tool_search_tool_regex`:`tool_search_tool_bm25`}e.content.type===`tool_search_tool_search_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),result:e.content.tool_references.map(e=>({type:e.type,toolName:e.tool_name}))}):n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),isError:!0,result:{type:`tool_search_tool_result_error`,errorCode:e.content.error_code}});return}case`advisor_tool_result`:{let t=a.toCustomToolName(`advisor`);e.content.type===`advisor_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_result`,text:e.content.text}}):e.content.type===`advisor_redacted_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_redacted_result`,encryptedContent:e.content.encrypted_content}}):n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,isError:!0,result:{type:`advisor_tool_result_error`,errorCode:e.content.error_code}});return}case`mcp_tool_use`:g[e.id]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:`mcp-tool-use`,serverName:e.server_name}}},n.enqueue(g[e.id]);return;case`mcp_tool_result`:n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:g[e.tool_use_id].toolName,isError:e.is_error,result:e.content,dynamic:!0,providerMetadata:g[e.tool_use_id].providerMetadata});return;default:throw Error(`Unsupported content block type: ${t}`)}}case`content_block_stop`:if(h[r.index]!=null){let e=h[r.index];switch(e.type){case`text`:n.enqueue({type:`text-end`,id:String(r.index)});break;case`reasoning`:n.enqueue({type:`reasoning-end`,id:String(r.index)});break;case`tool-call`:if(!(i&&e.toolName===`json`)){n.enqueue({type:`tool-input-end`,id:e.toolCallId});let t=e.input===``?`{}`:e.input;if(e.providerToolName===`code_execution`)try{let e=Mm(t);typeof e==`object`&&e&&`code`in e&&!(`type`in e)&&(t=JSON.stringify({type:`programmatic-tool-call`,...e}))}catch{}n.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:t,providerExecuted:e.providerExecuted,...l&&e.providerToolName===`code_execution`?{dynamic:!0}:{},...e.caller&&{providerMetadata:{anthropic:{caller:e.caller}}}})}break}delete h[r.index]}w=void 0;return;case`content_block_delta`:{let e=r.delta.type;switch(e){case`text_delta`:if(i)return;n.enqueue({type:`text-delta`,id:String(r.index),delta:r.delta.text});return;case`thinking_delta`:n.enqueue({type:`reasoning-delta`,id:String(r.index),delta:r.delta.thinking});return;case`signature_delta`:w===`thinking`&&n.enqueue({type:`reasoning-delta`,id:String(r.index),delta:``,providerMetadata:{anthropic:{signature:r.delta.signature}}});return;case`compaction_delta`:r.delta.content!=null&&n.enqueue({type:`text-delta`,id:String(r.index),delta:r.delta.content});return;case`input_json_delta`:{let e=h[r.index],t=r.delta.partial_json;if(t.length===0)return;if(C){if(e?.type!==`text`)return;n.enqueue({type:`text-delta`,id:String(r.index),delta:t})}else{if(e?.type!==`tool-call`)return;e.firstDelta&&e.providerToolInputType!=null&&(t=`{"type": "${e.providerToolInputType}",${t.substring(1)}`),n.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:t}),e.input+=t,e.firstDelta=!1}return}case`citations_delta`:{let e=r.delta.citation,t=tb(e,c,T);t&&n.enqueue(t);return}default:throw Error(`Unsupported delta type: ${e}`)}}case`message_start`:if(m.input_tokens=r.message.usage.input_tokens,m.cache_read_input_tokens=r.message.usage.cache_read_input_tokens??0,m.cache_creation_input_tokens=r.message.usage.cache_creation_input_tokens??0,y={...r.message.usage},r.message.container!=null&&(S={expiresAt:r.message.container.expires_at,id:r.message.container.id,skills:null}),r.message.stop_reason!=null&&(p={unified:qy({finishReason:r.message.stop_reason,isJsonResponseFromTool:C}),raw:r.message.stop_reason}),n.enqueue({type:`response-metadata`,id:r.message.id??void 0,modelId:r.message.model??void 0}),r.message.content!=null)for(let e=0;e<r.message.content.length;e++){let t=r.message.content[e];if(t.type===`tool_use`){let e=t.caller,r=e?{type:e.type,toolId:`tool_id`in e?e.tool_id:void 0}:void 0;n.enqueue({type:`tool-input-start`,id:t.id,toolName:t.name});let i=JSON.stringify(t.input??{});n.enqueue({type:`tool-input-delta`,id:t.id,delta:i}),n.enqueue({type:`tool-input-end`,id:t.id}),n.enqueue({type:`tool-call`,toolCallId:t.id,toolName:t.name,input:i,...r&&{providerMetadata:{anthropic:{caller:r}}}})}}return;case`message_delta`:r.usage.input_tokens!=null&&m.input_tokens!==r.usage.input_tokens&&(m.input_tokens=r.usage.input_tokens),m.output_tokens=r.usage.output_tokens,r.usage.cache_read_input_tokens!=null&&(m.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.cache_creation_input_tokens!=null&&(m.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.iterations!=null&&(m.iterations=r.usage.iterations),p={unified:qy({finishReason:r.delta.stop_reason,isJsonResponseFromTool:C}),raw:r.delta.stop_reason??void 0},b=r.delta.stop_sequence??null,x=ob(r.delta.stop_details),S=r.delta.container==null?null:{expiresAt:r.delta.container.expires_at,id:r.delta.container.id,skills:r.delta.container.skills?.map(e=>({type:e.type,skillId:e.skill_id,version:e.version}))??null},r.context_management&&(v=ab(r.context_management)),y={...y,...r.usage};return;case`message_stop`:{let e={usage:y??null,stopSequence:b,...x==null?{}:{stopDetails:x},iterations:m.iterations?m.iterations.map(e=>({type:e.type,...e.model==null?{}:{model:e.model},inputTokens:e.input_tokens,outputTokens:e.output_tokens,...e.cache_creation_input_tokens?{cacheCreationInputTokens:e.cache_creation_input_tokens}:{},...e.cache_read_input_tokens?{cacheReadInputTokens:e.cache_read_input_tokens}:{}})):null,container:S,contextManagement:v},t={anthropic:e};s&&o!==`anthropic`&&(t[o]=e),n.enqueue({type:`finish`,finishReason:p,usage:By({usage:m,rawUsage:y}),providerMetadata:t});return}case`error`:n.enqueue({type:`error`,error:r.error});return;default:throw Error(`Unsupported chunk type: ${r}`)}}})).tee(),O=E.getReader();try{await O.read();let e=await O.read();if(e.value?.type===`raw`&&(e=await O.read()),e.value?.type===`error`){let n=e.value.error;throw new $r({message:n.message,url:u,requestBodyValues:t,statusCode:n.type===`overloaded_error`?529:500,responseHeaders:d,responseBody:JSON.stringify(n),isRetryable:n.type===`overloaded_error`})}}finally{O.cancel().catch(()=>{}),O.releaseLock()}return{stream:D,request:{body:t},response:{headers:d}}}},ox=kh({id:`anthropic.bash_20241022`,inputSchema:K(()=>q(z({command:I(),restart:ou().optional()})))}),sx=kh({id:`anthropic.bash_20250124`,inputSchema:K(()=>q(z({command:I(),restart:ou().optional()})))}),cx=kh({id:`anthropic.computer_20241022`,inputSchema:K(()=>q(z({action:V([`key`,`type`,`mouse_move`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`screenshot`,`cursor_position`]),coordinate:R(L().int()).optional(),text:I().optional()})))}),lx=kh({id:`anthropic.computer_20250124`,inputSchema:K(()=>q(z({action:V([`key`,`hold_key`,`type`,`cursor_position`,`mouse_move`,`left_mouse_down`,`left_mouse_up`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`triple_click`,`scroll`,`wait`,`screenshot`]),coordinate:mu([L().int(),L().int()]).optional(),duration:L().optional(),scroll_amount:L().optional(),scroll_direction:V([`up`,`down`,`left`,`right`]).optional(),start_coordinate:mu([L().int(),L().int()]).optional(),text:I().optional()})))}),ux=kh({id:`anthropic.computer_20251124`,inputSchema:K(()=>q(z({action:V([`key`,`hold_key`,`type`,`cursor_position`,`mouse_move`,`left_mouse_down`,`left_mouse_up`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`triple_click`,`scroll`,`wait`,`screenshot`,`zoom`]),coordinate:mu([L().int(),L().int()]).optional(),duration:L().optional(),region:mu([L().int(),L().int(),L().int(),L().int()]).optional(),scroll_amount:L().optional(),scroll_direction:V([`up`,`down`,`left`,`right`]).optional(),start_coordinate:mu([L().int(),L().int()]).optional(),text:I().optional()})))}),dx=kh({id:`anthropic.memory_20250818`,inputSchema:K(()=>q(fu(`command`,[z({command:H(`view`),path:I(),view_range:mu([L(),L()]).optional()}),z({command:H(`create`),path:I(),file_text:I()}),z({command:H(`str_replace`),path:I(),old_str:I(),new_str:I()}),z({command:H(`insert`),path:I(),insert_line:L(),insert_text:I()}),z({command:H(`delete`),path:I()}),z({command:H(`rename`),old_path:I(),new_path:I()})])))}),fx=kh({id:`anthropic.text_editor_20241022`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),px=kh({id:`anthropic.text_editor_20250124`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),mx=kh({id:`anthropic.text_editor_20250429`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),hx=K(()=>q(R(z({type:H(`tool_reference`),toolName:I()})))),gx=jh({id:`anthropic.tool_search_bm25_20251119`,inputSchema:K(()=>q(z({query:I(),limit:L().optional()}))),outputSchema:hx,supportsDeferredResults:!0}),_x=(e={})=>gx(e),vx={advisor_20260301:Tb,bash_20241022:sb,bash_20250124:cb,codeExecution_20250522:qb,codeExecution_20250825:Xb,codeExecution_20260120:$b,computer_20241022:cx,computer_20250124:lx,computer_20251124:ux,memory_20250818:dx,textEditor_20241022:fx,textEditor_20250124:px,textEditor_20250429:mx,textEditor_20250728:Ob,webFetch_20250910:Wb,webFetch_20260209:Bb,webSearch_20250305:Ib,webSearch_20260209:Mb,toolSearchRegex_20251119:nx,toolSearchBm25_20251119:_x},yx=K(()=>q(z({id:I(),display_title:I().nullish(),name:I().nullish(),description:I().nullish(),latest_version:I().nullish(),source:I(),created_at:I(),updated_at:I()}))),bx=K(()=>q(z({type:I(),skill_id:I(),name:I().nullish(),description:I().nullish()}))),xx=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async getHeaders(){return Up(await Mh(this.config.headers),{"anthropic-beta":`skills-2025-10-02`})}async fetchVersionMetadata({skillId:e,version:t,headers:n}){let{value:r}=await pg({url:`${this.config.baseURL}/skills/${e}/versions/${t}`,headers:n,failedResponseHandler:db,successfulResponseHandler:Kg(bx),fetch:this.config.fetch});return{...r.name==null?{}:{name:r.name},...r.description==null?{}:{description:r.description}}}async uploadSkill(e){let t=[],n=new FormData;e.displayTitle!=null&&n.append(`display_title`,e.displayTitle);for(let t of e.files){let e=qp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let r=await this.getHeaders(),{value:i}=await Bg({url:`${this.config.baseURL}/skills`,headers:r,formData:n,failedResponseHandler:db,successfulResponseHandler:Kg(yx),fetch:this.config.fetch}),a=i.latest_version==null?{}:await this.fetchVersionMetadata({skillId:i.id,version:i.latest_version,headers:r}),o=a.name??i.name,s=a.description??i.description;return{providerReference:{anthropic:i.id},...i.display_title==null?{}:{displayTitle:i.display_title},...o==null?{}:{name:o},...s==null?{}:{description:s},...i.latest_version==null?{}:{latestVersion:i.latest_version},providerMetadata:{anthropic:{...i.source==null?{}:{source:i.source},...i.created_at==null?{}:{createdAt:i.created_at},...i.updated_at==null?{}:{updatedAt:i.updated_at}}},warnings:t}}},Sx=`4.0.12`,Cx=`https://api.anthropic.com`,wx=`${Cx}/v1`,ub()}));function Ex(e,t){return t===`openai`?e.openaiKey:e.anthropicKey}function Dx(e,t,n){let r=jx[e][n];return{model:e===`openai`?ov({apiKey:t})(r):ub({apiKey:t,headers:yr?void 0:{"anthropic-dangerous-direct-browser-access":`true`}})(r),provider:e,modelId:r}}function Ox(e){let t=e.preferredProvider;return t&&Ex(e,t)?t:e.openaiKey?`openai`:e.anthropicKey?`anthropic`:null}async function kx(e){let t=await Cr(),n=Ox(t);if(!n)throw new Mx;return Dx(n,Ex(t,n),e)}async function Ax(e,t){let n=await Cr(),r=e===`openai`?`anthropic`:`openai`,i=Ex(n,r);return i?Dx(r,i,t):null}var jx,Mx,Nx=t((()=>{Ly(),Tx(),br(),Rr(),jx={openai:{fast:`gpt-5.4-nano`,best:`gpt-5.2`},anthropic:{fast:`claude-haiku-4-5`,best:`claude-opus-4-8`}},Mx=class extends Error{constructor(){super(`No AI provider configured. Add an OpenAI or Anthropic API key in Settings.`),this.name=`NoProviderError`}}})),Px=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);var u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),Fx=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>u,RefreshAccessTokenFailedError:()=>d}),t.exports=c(l);var u=class extends Error{constructor(){super(`No authentication found. Please log in with the Vercel CLI (vercel login).`),this.name=`AccessTokenMissingError`}},d=class extends Error{constructor(e){super(`Failed to refresh authentication token.`,{cause:e}),this.name=`RefreshAccessTokenFailedError`}};0&&(t.exports={AccessTokenMissingError:u,RefreshAccessTokenFailedError:d})})),Ix=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>d.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>d.RefreshAccessTokenFailedError,getContext:()=>u.getContext,getVercelOidcToken:()=>f,getVercelOidcTokenSync:()=>p,getVercelToken:()=>m}),t.exports=c(l);var u=Px(),d=Fx();async function f(){return``}function p(){return``}async function m(){throw Error(`getVercelToken is not supported in browser environments`)}0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken:f,getVercelOidcTokenSync:p,getVercelToken:m})}));function Lx(e,t){let n=[eS,`${tS}${e}`];return t?.teamIdOrSlug&&n.push(`${nS}${Rx(t.teamIdOrSlug)}`),n}function Rx(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/u,``)}async function zx({response:e,statusCode:t,defaultMessage:n=`Gateway request failed`,cause:r,authMethod:i}){let a=await Ch({value:e,schema:rC});if(!a.success){let i=typeof e==`object`&&e&&`generationId`in e?e.generationId:void 0;return new nC({message:`Invalid error response format: ${n}`,statusCode:t,response:e,validationError:a.error,cause:r,generationId:i})}let o=a.value,s=o.error.type,c=o.error.message,l=o.generationId??void 0;switch(s){case`authentication_error`:return fS.createContextualError({apiKeyProvided:i===`api-key`,oidcTokenProvided:i===`oidc`,statusCode:t,cause:r,generationId:l});case`invalid_request_error`:return new vS({message:c,statusCode:t,cause:r,generationId:l});case`rate_limit_exceeded`:return new wS({message:c,statusCode:t,cause:r,generationId:l});case`model_not_found`:{let e=await Ch({value:o.error.param,schema:OS});return new jS({message:c,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:r,generationId:l})}case`internal_server_error`:return new LS({message:c,statusCode:t,cause:r,generationId:l});case`failed_dependency`:return new US({message:c,statusCode:t,cause:r,generationId:l});case`forbidden`:{let e=await Ch({value:o.error.param,schema:qS});return new XS({message:c,statusCode:t,cause:r,generationId:l,ruleId:e.success?e.value.ruleId:void 0})}default:return new LS({message:c,statusCode:t,cause:r,generationId:l})}}function Bx(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return Mm(e.responseBody)}catch{return e.responseBody}return{}}function Vx(e){if(!(e instanceof Error))return!1;let t=e.code;return typeof t==`string`&&[`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CONNECT_TIMEOUT`].includes(t)}async function Hx(e,t){return oS.isInstance(e)?e:Vx(e)?lC.createTimeoutError({originalMessage:e instanceof Error?e.message:`Unknown error`,cause:e}):$r.isInstance(e)?e.cause&&Vx(e.cause)?lC.createTimeoutError({originalMessage:e.message,cause:e}):await zx({response:Bx(e),statusCode:e.statusCode??500,defaultMessage:`Gateway request failed`,cause:e,authMethod:t}):await zx({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:`Unknown Gateway error`,cause:e,authMethod:t})}async function Ux(e){let t=await Ch({value:e[uC],schema:fC});return t.success?t.value:void 0}function Wx(e){if(e.type===`data`){let t=e.data;if(t instanceof Uint8Array)return{...e,data:Buffer.from(t).toString(`base64`)}}return e}function Gx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:Gp(e.data)}:e}function Kx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:Gp(e.data)}:e}function qx(e,t){let n=new URL(`${e.replace(/^http/,`ws`)}/realtime-model`);return n.searchParams.set(`ai-model-id`,t),n.toString()}async function Jx(){return(0,Qx.getContext)().headers?.[`x-vercel-id`]}function Yx(e={}){let t=null,n=null,r=e.metadataCacheRefreshMillis??1e3*60*5,i=0,a=Uh(e.baseURL)??`https://ai-gateway.vercel.sh/v4/ai`,o=t=>ym({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":tw,[uC]:t.authMethod,...e.teamIdOrSlug==null?{}:{[dC]:e.teamIdOrSlug},...e.headers},`ai-sdk/gateway/${ew}`),s=async()=>{try{return o(await Xx(e))}catch(e){throw fS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},c=async()=>{try{return await Xx(e)}catch(e){throw fS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},l=async t=>{Zx();let n=await c(),r=o(n),i=new URL(`/v1/realtime/client-secrets`,a).toString();try{let{value:n}=await zg({url:i,headers:r,body:{model:t.modelId,...t.expiresAfterSeconds!=null&&{expiresIn:t.expiresAfterSeconds}},successfulResponseHandler:Kg(nw),failedResponseHandler:Wg({errorSchema:cu(),errorToMessage:e=>e}),fetch:e.fetch});return{token:n.token,...n.expiresAt!=null&&{expiresAt:n.expiresAt}}}catch(e){throw await Hx(e,await Ux(r))}},u=()=>{let e=Tm({settingValue:void 0,environmentVariableName:`VERCEL_DEPLOYMENT_ID`}),t=Tm({settingValue:void 0,environmentVariableName:`VERCEL_ENV`}),n=Tm({settingValue:void 0,environmentVariableName:`VERCEL_REGION`}),r=Tm({settingValue:void 0,environmentVariableName:`VERCEL_PROJECT_ID`});return async()=>{let i=await Jx();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...n&&{"ai-o11y-region":n},...i&&{"ai-o11y-request-id":i},...r&&{"ai-o11y-project-id":r}}}},d=t=>new xC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),f=async()=>{var o;let c=((o=e._internal)?.currentDate)?.call(o).getTime()??Date.now();return(!t||c-i>r)&&(i=c,t=new mC({baseURL:a,headers:s,fetch:e.fetch}).getAvailableModels().then(e=>(n=e,e)).catch(async e=>{throw await Hx(e,await Ux(await s()))})),n?Promise.resolve(n):t},p=async()=>new mC({baseURL:a,headers:s,fetch:e.fetch}).getCredits().catch(async e=>{throw await Hx(e,await Ux(await s()))}),m=async t=>new _C({baseURL:a,headers:s,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await Hx(e,await Ux(await s()))}),h=async t=>new yC({baseURL:a,headers:s,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await Hx(e,await Ux(await s()))}),g=function(e){if(new.target)throw Error(`The Gateway Provider model function cannot be called with the new keyword.`);return d(e)};g.specificationVersion=`v4`,g.getAvailableModels=f,g.getCredits=p,g.getSpendReport=m,g.getGenerationInfo=h,g.imageModel=t=>new TC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),g.languageModel=d;let _=t=>new SC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.embeddingModel=_,g.textEmbeddingModel=_,g.videoModel=t=>new AC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});let v=t=>new FC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.rerankingModel=v,g.reranking=v;let y=t=>new RC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.speechModel=y,g.speech=y;let b=t=>new HC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.transcriptionModel=b,g.transcription=b;let x=t=>new KC(t,{provider:`gateway.realtime`,baseURL:a,teamIdOrSlug:e.teamIdOrSlug,createClientSecret:l});return g.experimental_realtime=Object.assign(e=>x(e),{getToken:async e=>{let{model:t,...n}=e,r=await x(t).doCreateClientSecret(n);return{token:r.token,url:r.url,...r.expiresAt!=null&&{expiresAt:r.expiresAt}}}}),g.chat=g.languageModel,g.embedding=g.embeddingModel,g.image=g.imageModel,g.video=g.videoModel,g.tools=$C,g}async function Xx(e){let t=Tm({settingValue:e.apiKey,environmentVariableName:`AI_GATEWAY_API_KEY`});return t?{token:t,authMethod:`api-key`}:{token:await(0,$x.getVercelOidcToken)(),authMethod:`oidc`}}function Zx(){if(globalThis.window!==void 0)throw Error(`AI Gateway realtime client secrets must be minted server-side: minting needs your Gateway credential, which must never reach the browser. Call gateway.experimental_realtime.getToken() from your server and pass the returned token to the client.`)}var Qx,$x,eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS,_S,vS,yS,bS,xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC,hC,gC,_C,vC,yC,bC,xC,SC,CC,wC,TC,EC,DC,OC,kC,AC,jC,MC,NC,PC,FC,IC,LC,RC,zC,BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw=t((()=>{Xg(),Nd(),ma(),Qx=Ix(),$x=Ix(),eS=`ai-gateway-realtime.v1`,tS=`ai-gateway-auth.`,nS=`ai-gateway-team.`,rS=Symbol.for(`vercel.ai.gateway.error`),oS=class e extends (aS=Error,iS=rS,aS){constructor({message:e,statusCode:t=500,cause:n,generationId:r,isRetryable:i=t!=null&&(t===408||t===409||t===429||t>=500)}){super(r?`${e} [${r}]`:e),this[iS]=!0,this.statusCode=t,this.cause=n,this.generationId=r,this.isRetryable=i}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return typeof e==`object`&&!!e&&rS in e&&e[rS]===!0}},sS=`GatewayAuthenticationError`,cS=`vercel.ai.gateway.error.${sS}`,lS=Symbol.for(cS),fS=class e extends (dS=oS,uS=lS,dS){constructor({message:e=`Authentication failed`,statusCode:t=401,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[uS]=!0,this.name=sS,this.type=`authentication_error`}static isInstance(e){return oS.hasMarker(e)&&lS in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,statusCode:r=401,cause:i,generationId:a}){let o;return o=t?`AI Gateway authentication failed: Invalid API key or token.
|
|
55
55
|
|
|
56
56
|
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
57
57
|
|
|
@@ -80,7 +80,7 @@ Alternatively, you can use a provider module instead of the AI Gateway.
|
|
|
80
80
|
|
|
81
81
|
Learn more: \x1B[34m${n}\x1B[0m
|
|
82
82
|
|
|
83
|
-
`),{name:`GatewayAuthenticationError`})}function Vw(e){return{inputTokens:e.inputTokens.total,inputTokenDetails:{noCacheTokens:e.inputTokens.noCache,cacheReadTokens:e.inputTokens.cacheRead,cacheWriteTokens:e.inputTokens.cacheWrite},outputTokens:e.outputTokens.total,outputTokenDetails:{textTokens:e.outputTokens.text,reasoningTokens:e.outputTokens.reasoning},totalTokens:Uw(e.inputTokens.total,e.outputTokens.total),raw:e.raw}}function Hw(){return{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}}function Uw(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function Ww(){return(globalThis==null?void 0:globalThis.performance)?.now()??Date.now()}async function Gw(e){await Promise.all(Hp(e.callbacks).map(async t=>{try{await t?.(e.event)}catch{}}))}function Kw({error:e,exponentialBackoffDelay:t}){let n=$r.isInstance(e)?e.responseHeaders:$r.isInstance(e.cause)?e.cause.responseHeaders:void 0;if(!n)return t;let r,i=n[`retry-after-ms`];if(i){let e=parseFloat(i);Number.isNaN(e)||(r=e)}let a=n[`retry-after`];if(a&&r===void 0){let e=parseFloat(a);r=Number.isNaN(e)?Date.parse(a)-Date.now():e*1e3}return r!=null&&!Number.isNaN(r)&&0<=r&&(r<60*1e3||r<t)?r:t}function qw({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new TT({parameter:`maxRetries`,value:e,message:`maxRetries must be an integer`});if(e<0)throw new TT({parameter:`maxRetries`,value:e,message:`maxRetries must be >= 0`})}let n=e??2;return{maxRetries:n,retry:VE({maxRetries:n,abortSignal:t})}}function Jw(e){let t=[`ROOT`],n=-1,r=null,i=0;function a(e){return e>=`0`&&e<=`9`||e>=`A`&&e<=`F`||e>=`a`&&e<=`f`}function o(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function s(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case`ROOT`:o(u,l,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=l,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(u){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:o(u,l,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:s(u,l);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=l;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=l}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=l,t.pop();break;default:n=l,o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=l,t.pop();break;default:n=l;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),u===`u`?(i=0,t.push(`INSIDE_STRING_UNICODE_ESCAPE`)):n=l;break;case`INSIDE_STRING_UNICODE_ESCAPE`:a(u)&&(i++,i===4&&(t.pop(),n=l));break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=l;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,l+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?s(u,l):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l)):n=l;break}}}let l=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:l+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:l+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:l+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?l+=`true`.slice(t.length):`false`.startsWith(t)?l+=`false`.slice(t.length):`null`.startsWith(t)&&(l+=`null`.slice(t.length))}}return l}async function Yw(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await Th({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await Th({text:Jw(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function Xw(...e){return async t=>{await Promise.allSettled(e.map(async e=>{await e?.(t)}))}}function Zw(){return typeof process<`u`&&process.release?.name===`node`}async function Qw(){if(Zw())return YE??=Promise.resolve($w(`node:diagnostics_channel`)),YE}function $w(e){let t=globalThis.process;try{return(t?.getBuiltinModule)?.call(t,e)}catch{return}}async function eT(e,t){let n=await Qw(),r=(n?.tracingChannel)?.call(n,JE);if(r==null||r.hasSubscribers===!1)return await t();let i,a,o,s=!1,c=!1,l=()=>{try{i=Promise.resolve(t())}catch(e){i=Promise.reject(e)}return i=i.then(e=>(a=e,s=!0,e),e=>{throw o=e,c=!0,e}),i};try{return await r.tracePromise(l,e)}catch{if(c)throw o;return s?a:i==null?await t():await i}}function tT({message:e,completion:t}){if(!Zw())return;let n=$w(`node:diagnostics_channel`),r=$w(`node:async_hooks`),i=(n?.tracingChannel)?.call(n,JE);if(i==null||i.hasSubscribers===!1||r==null){Promise.resolve(t).catch(()=>{});return}let a=e,o,s=!1,c=e=>{try{e()}catch{}},l=({result:e,error:t})=>{s||(s=!0,t!==void 0&&(a.error=t,c(()=>i.error.publish(a))),e!==void 0&&(a.result=e),c(()=>i.asyncEnd.publish(a)))};return c(()=>{i.start.runStores(a,()=>{o=new r.AsyncResource(`ai.telemetry`)})}),c(()=>i.end.publish(a)),Promise.resolve(t).then(e=>l({result:e}),e=>l({error:e})),{run:e=>o==null?e():o.runInAsyncScope(e)}}function nT(){return globalThis.AI_SDK_TELEMETRY_INTEGRATIONS??[]}function rT(e,t){return Object.assign(Object.create(Object.getPrototypeOf(e)),e,t)}function iT({telemetry:e}){if(e?.isEnabled===!1)return{};let t=e?.integrations,n=t==null?nT():Hp(t),r={recordInputs:e?.recordInputs,recordOutputs:e?.recordOutputs,functionId:e?.functionId},i=e=>{let t=Xw(...n.map(t=>t[e]?.bind(t)).filter(Boolean).map(e=>t=>e(rT(t,r))));return async e=>{await t(e)}},a=n.map(e=>e.executeLanguageModelCall?.bind(e)).filter(Boolean),o=n.map(e=>e.executeTool?.bind(e)).filter(Boolean);return{runInTracingChannelSpan:async({type:e,event:t,execute:n})=>await eT({type:e,event:rT(t,r)},n),startTracingChannelContext:({type:e,event:t,completion:n})=>tT({message:{type:e,event:rT(t,r)},completion:n}),onStart:i(`onStart`),onStepStart:i(`onStepStart`),onLanguageModelCallStart:i(`onLanguageModelCallStart`),onLanguageModelCallEnd:i(`onLanguageModelCallEnd`),onToolExecutionStart:i(`onToolExecutionStart`),onToolExecutionEnd:i(`onToolExecutionEnd`),onStepEnd:Xw(i(`onStepEnd`),i(`onStepFinish`)),onObjectStepStart:i(`onObjectStepStart`),onObjectStepEnd:i(`onObjectStepEnd`),onEmbedStart:i(`onEmbedStart`),onEmbedEnd:i(`onEmbedEnd`),onRerankStart:i(`onRerankStart`),onRerankEnd:i(`onRerankEnd`),onEnd:i(`onEnd`),onAbort:i(`onAbort`),onError:i(`onError`),executeLanguageModelCall:async({execute:e,...t})=>{let n=rT(t,r),i=e;for(let e of a){let t=i;i=()=>e({...n,execute:t})}return await eT({type:`languageModelCall`,event:n},i)},executeTool:async({execute:e,...t})=>{let n=rT(t,r),i=e;for(let e of o){let t=i;i=()=>e({...n,execute:t})}return await i()}}}function aT(e,t){let n=new Headers(e??{});for(let[e,r]of Object.entries(t))n.has(e)||n.set(e,r);return n}function oT({status:e,statusText:t,headers:n,stream:r}){return new Response(r.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:aT(n,{"content-type":`text/plain; charset=utf-8`})})}function sT({response:e,status:t,statusText:n,headers:r,stream:i}){let a=t??200;n===void 0?e.writeHead(a,r):e.writeHead(a,n,r);let o=i.getReader();(async()=>{try{for(;;){let{done:t,value:n}=await o.read();if(t)break;let r=e.write(n),i=e.flush;typeof i==`function`&&i.call(e),r||await new Promise(t=>{e.once(`drain`,t)})}}catch(e){throw e}finally{e.end()}})()}function cT({response:e,status:t,statusText:n,headers:r,stream:i}){sT({response:e,status:t,statusText:n,headers:Object.fromEntries(aT(r,{"content-type":`text/plain; charset=utf-8`}).entries()),stream:i.pipeThrough(new TextEncoderStream)})}function lT(e){return uT(e.pipeThrough(new TransformStream))}function uT(e){return e[Symbol.asyncIterator]=function(){let e=this.getReader(),t=!1;async function n(n){if(!t){t=!0;try{n&&await e.cancel?.call(e)}finally{try{e.releaseLock()}catch{}}}}return{async next(){if(t)return{done:!0,value:void 0};let{done:r,value:i}=await e.read();return r?(await n(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(e){throw await n(!0),e}}},e}function dT(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function fT(){let e=[],t=null,n=!1,r=dT(),i=()=>{n=!0,r.resolve(),e.forEach(e=>e.cancel()),e=[],t?.close()},a=async()=>{if(n&&e.length===0){t?.close();return}if(e.length===0)return r=dT(),await r.promise,await a();try{let{value:r,done:i}=await e[0].read();i?(e.shift(),e.length===0&&n?t?.close():await a()):t?.enqueue(r)}catch(n){t?.error(n),e.shift(),i()}};return{stream:new ReadableStream({start(e){t=e},pull:a,async cancel(){for(let t of e)await t.cancel();e=[],n=!0}}),addStream:t=>{if(n)throw Error(`Cannot add inner stream: outer stream is closed`);e.push(t.getReader()),r.resolve()},close:()=>{n=!0,r.resolve(),e.length===0&&t?.close()},terminate:i}}function pT({output:e,schema:t,enumValues:n}){switch(e){case`object`:return ZE(_h(t));case`array`:return QE(_h(t));case`enum`:return $E(n);case`no-schema`:return XE;default:throw Error(`Unsupported output: ${e}`)}}async function mT(e,t,n){let r=await Th({text:e});if(!r.success)throw new VT({message:`No object generated: could not parse the response.`,cause:r.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=await t.validateFinalResult(r.value,{text:e,response:n.response,usage:n.usage});if(!i.success)throw new VT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.value}async function hT(e,t,n,r){try{return await mT(e,t,r)}catch(i){if(n!=null&&VT.isInstance(i)&&(ki.isInstance(i.cause)||sa.isInstance(i.cause))){let a=await n({text:e,error:i.cause});if(a===null)throw i;return await mT(a,t,r)}throw i}}function gT({output:e,schema:t,schemaName:n,schemaDescription:r,enumValues:i}){if(e!=null&&e!==`object`&&e!==`array`&&e!==`enum`&&e!==`no-schema`)throw new TT({parameter:`output`,value:e,message:`Invalid output type.`});if(e===`no-schema`){if(t!=null)throw new TT({parameter:`schema`,value:t,message:`Schema is not supported for no-schema output.`});if(r!=null)throw new TT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for no-schema output.`});if(n!=null)throw new TT({parameter:`schemaName`,value:n,message:`Schema name is not supported for no-schema output.`});if(i!=null)throw new TT({parameter:`enumValues`,value:i,message:`Enum values are not supported for no-schema output.`})}if(e===`object`){if(t==null)throw new TT({parameter:`schema`,value:t,message:`Schema is required for object output.`});if(i!=null)throw new TT({parameter:`enumValues`,value:i,message:`Enum values are not supported for object output.`})}if(e===`array`){if(t==null)throw new TT({parameter:`schema`,value:t,message:`Element schema is required for array output.`});if(i!=null)throw new TT({parameter:`enumValues`,value:i,message:`Enum values are not supported for array output.`})}if(e===`enum`){if(t!=null)throw new TT({parameter:`schema`,value:t,message:`Schema is not supported for enum output.`});if(r!=null)throw new TT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for enum output.`});if(n!=null)throw new TT({parameter:`schemaName`,value:n,message:`Schema name is not supported for enum output.`});if(i==null)throw new TT({parameter:`enumValues`,value:i,message:`Enum values are required for enum output.`});for(let e of i)if(typeof e!=`string`)throw new TT({parameter:`enumValues`,value:e,message:`Enum values must be strings.`})}}function _T(e,t){if(e===t)return!0;if(e==null||t==null)return!1;if(typeof e!=`object`&&typeof t!=`object`)return e===t;if(e.constructor!==t.constructor)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!_T(e[n],t[n]))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||!_T(e[i],t[i]))return!1;return!0}function vT(e){let{model:t,output:n=`object`,instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,maxRetries:c,abortSignal:l,headers:u,experimental_repairText:d,experimental_telemetry:f,telemetry:p=f,experimental_download:m,providerOptions:h,onStart:g,experimental_onStart:_,onStepStart:v,experimental_onStepStart:y,onStepEnd:b,onStepFinish:x,onError:S=({error:e})=>{console.error(e)},onFinish:C,_internal:{generateId:w=eD,currentDate:T=()=>new Date,now:ee=Ww}={},...E}=e,D=`enum`in e&&e.enum?e.enum:void 0,{schema:O,schemaDescription:te,schemaName:k}=`schema`in e?e:{};return gT({output:n,schema:O,schemaName:k,schemaDescription:te,enumValues:D}),new tD({model:t,telemetry:p,headers:u,settings:E,maxRetries:c,abortSignal:l,outputStrategy:pT({output:n,schema:O,enumValues:D}),instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,schemaName:k,schemaDescription:te,providerOptions:h,repairText:d,onStart:g??_,onStepStart:v??y,onStepFinish:b??x,onError:S,onFinish:C,download:m,generateId:w,currentDate:T,now:ee})}var yT,bT,xT,ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE,qE,JE,YE,XE,ZE,QE,$E,eD,tD,nD,rD=t((()=>{Xg(),ma(),iw(),Nd(),yT=Object.defineProperty,bT=(e,t)=>{for(var n in t)yT(e,n,{get:t[n],enumerable:!0})},xT=`AI_InvalidArgumentError`,ST=`vercel.ai.error.${xT}`,CT=Symbol.for(ST),TT=class extends qr{constructor({parameter:e,value:t,message:n}){super({name:xT,message:`Invalid argument for parameter ${e}: ${n}`}),this[wT]=!0,this.parameter=e,this.value=t}static isInstance(e){return qr.hasMarker(e,ST)}},wT=CT,ET=`AI_InvalidStreamPartError`,`${ET}`,DT=`AI_InvalidToolApprovalError`,`${DT}`,OT=`AI_InvalidToolApprovalSignatureError`,`${OT}`,kT=`AI_InvalidToolInputError`,`${kT}`,AT=`AI_ToolCallNotFoundForApprovalError`,`${AT}`,jT=`AI_MissingToolResultsError`,MT=`vercel.ai.error.${jT}`,NT=Symbol.for(MT),FT=class extends qr{constructor({toolCallIds:e}){super({name:jT,message:`Tool result${e.length>1?`s are`:` is`} missing for tool call${e.length>1?`s`:``} ${e.join(`, `)}.`}),this[PT]=!0,this.toolCallIds=e}static isInstance(e){return qr.hasMarker(e,MT)}},PT=NT,IT=`AI_NoImageGeneratedError`,`${IT}`,LT=`AI_NoObjectGeneratedError`,RT=`vercel.ai.error.${LT}`,zT=Symbol.for(RT),VT=class extends qr{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:LT,message:e,cause:t}),this[BT]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return qr.hasMarker(e,RT)}},BT=zT,HT=`AI_NoOutputGeneratedError`,`${HT}`,UT=`AI_NoSpeechGeneratedError`,`${UT}`,WT=`AI_NoTranscriptGeneratedError`,`${WT}`,GT=`AI_NoVideoGeneratedError`,`${GT}`,KT=`AI_NoSuchToolError`,`${KT}`,qT=`AI_ToolCallRepairError`,`${qT}`,JT=class extends qr{constructor(e){super({name:`AI_UnsupportedModelVersionError`,message:`Unsupported model version ${e.version} for provider "${e.provider}" and model "${e.modelId}". AI SDK 5 only supports models that implement specification version "v2".`}),this.version=e.version,this.provider=e.provider,this.modelId=e.modelId}},YT=`AI_UIMessageStreamError`,`${YT}`,XT=`AI_InvalidDataContentError`,ZT=`vercel.ai.error.${XT}`,QT=Symbol.for(ZT),eE=class extends qr{constructor({content:e,cause:t,message:n=`Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof e}.`}){super({name:XT,message:n,cause:t}),this[$T]=!0,this.content=e}static isInstance(e){return qr.hasMarker(e,ZT)}},$T=QT,tE=`AI_InvalidMessageRoleError`,nE=`vercel.ai.error.${tE}`,rE=Symbol.for(nE),aE=class extends qr{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:tE,message:t}),this[iE]=!0,this.role=e}static isInstance(e){return qr.hasMarker(e,nE)}},iE=rE,oE=`AI_MessageConversionError`,`${oE}`,sE=`AI_RetryError`,cE=`vercel.ai.error.${sE}`,lE=Symbol.for(cE),dE=class extends qr{constructor({message:e,reason:t,errors:n}){super({name:sE,message:e}),this[uE]=!0,this.reason=t,this.errors=n,this.lastError=n[n.length-1]}static isInstance(e){return qr.hasMarker(e,cE)}},uE=lE,fE=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,pE=!1,mE=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}pE||(pE=!0,console.info(fE));for(let t of e.warnings){let n=aw({warning:t,provider:e.provider,model:e.model});typeof process<`u`&&typeof process.emitWarning==`function`?process.emitWarning(n,{type:t.type===`deprecated`?`DeprecationWarning`:`Warning`}):console.warn(n)}}},hE=`7.0.22`,gE=async({url:e,maxBytes:t,abortSignal:n})=>{let r=e.toString();try{let e=await um({url:r,headers:ym({},`ai-sdk/${hE}`,_m()),abortSignal:n});if(!e.ok)throw await rm(e),new ig({url:r,statusCode:e.status,statusText:e.statusText});return{data:await dm({response:e,url:r,maxBytes:t??og}),mediaType:e.headers.get(`content-type`)??void 0}}catch(e){throw ig.isInstance(e)?e:new ig({url:r,cause:e})}},_E=(e=gE)=>t=>Promise.all(t.map(async t=>t.isUrlSupportedByModel?null:await e(t))),vE={jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,avif:`image/avif`,heic:`image/heic`,bmp:`image/bmp`,tiff:`image/tiff`,tif:`image/tiff`,pdf:`application/pdf`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`},yE=Tu(()=>B([su(),I(),L(),ou(),hu(I(),yE.optional()),R(yE)])),bE=hu(I(),hu(I(),yE.optional())),xE=B([I(),Au(Uint8Array),Au(ArrayBuffer),Du(bm,{message:`Must be a Buffer`})]),SE=hu(I(),I()),CE=z({type:H(`text`),text:I(),providerOptions:bE.optional()}),wE=z({type:H(`image`),image:B([xE,Au(URL),SE]),mediaType:I().optional(),providerOptions:bE.optional()}),TE=fu(`type`,[z({type:H(`data`),data:xE}),z({type:H(`url`),url:Au(URL)}),z({type:H(`reference`),reference:SE}),z({type:H(`text`),text:I()})]),EE=fu(`type`,[z({type:H(`data`),data:xE}),z({type:H(`url`),url:Au(URL)})]),DE=z({type:H(`file`),data:B([TE,xE,Au(URL),SE]),filename:I().optional(),mediaType:I(),providerOptions:bE.optional()}),OE=z({type:H(`reasoning`),text:I(),providerOptions:bE.optional()}),kE=z({type:H(`custom`),kind:I().transform(e=>e),providerOptions:bE.optional()}),AE=z({type:H(`reasoning-file`),data:B([EE,xE,Au(URL)]),mediaType:I(),providerOptions:bE.optional()}),jE=z({type:H(`tool-call`),toolCallId:I(),toolName:I(),input:lu(),providerOptions:bE.optional(),providerExecuted:ou().optional()}),ME=fu(`type`,[z({type:H(`text`),value:I(),providerOptions:bE.optional()}),z({type:H(`json`),value:yE,providerOptions:bE.optional()}),z({type:H(`execution-denied`),reason:I().optional(),providerOptions:bE.optional()}),z({type:H(`error-text`),value:I(),providerOptions:bE.optional()}),z({type:H(`error-json`),value:yE,providerOptions:bE.optional()}),z({type:H(`content`),value:R(B([z({type:H(`text`),text:I(),providerOptions:bE.optional()}),z({type:H(`file`),data:TE,mediaType:I(),filename:I().optional(),providerOptions:bE.optional()}),z({type:H(`file-data`),data:I(),mediaType:I(),filename:I().optional(),providerOptions:bE.optional()}),z({type:H(`file-url`),url:I(),mediaType:I().optional(),providerOptions:bE.optional()}),z({type:H(`file-id`),fileId:B([I(),hu(I(),I())]),providerOptions:bE.optional()}),z({type:H(`file-reference`),providerReference:hu(I(),I()),providerOptions:bE.optional()}),z({type:H(`image-data`),data:I(),mediaType:I(),providerOptions:bE.optional()}),z({type:H(`image-url`),url:I(),providerOptions:bE.optional()}),z({type:H(`image-file-id`),fileId:B([I(),hu(I(),I())]),providerOptions:bE.optional()}),z({type:H(`image-file-reference`),providerReference:hu(I(),I()),providerOptions:bE.optional()}),z({type:H(`custom`),providerOptions:bE.optional()})]))})]),NE=z({type:H(`tool-result`),toolCallId:I(),toolName:I(),output:ME,providerOptions:bE.optional()}),PE=z({type:H(`tool-approval-request`),approvalId:I(),toolCallId:I()}),FE=z({type:H(`tool-approval-response`),approvalId:I(),approved:ou(),reason:I().optional()}),IE=z({role:H(`system`),content:I(),providerOptions:bE.optional()}),LE=z({role:H(`user`),content:B([I(),R(B([CE,wE,DE]))]),providerOptions:bE.optional()}),RE=z({role:H(`assistant`),content:B([I(),R(B([CE,kE,DE,OE,AE,jE,NE,PE]))]),providerOptions:bE.optional()}),zE=z({role:H(`tool`),content:R(B([NE,FE])),providerOptions:bE.optional()}),BE=B([IE,LE,RE,zE]),VE=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:n=2,abortSignal:r}={})=>Hg({maxRetries:e,initialDelayInMs:t,backoffFactor:n,abortSignal:r,shouldRetry:e=>e instanceof Error&&($r.isInstance(e)&&e.isRetryable===!0||oS.isInstance(e)&&e.isRetryable===!0),getDelayInMs:({error:e,exponentialBackoffDelay:t})=>Kw({error:e,exponentialBackoffDelay:t}),createRetryError:({message:e,reason:t,errors:n})=>new dE({message:e,reason:t,errors:n})}),HE={},bT(HE,{array:()=>GE,choice:()=>KE,json:()=>qE,object:()=>WE,text:()=>UE}),UE=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),WE=({schema:e,name:t,description:n})=>{let r=_h(e);return{name:`object`,responseFormat:Mh(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await Th({text:e});if(!n.success)throw new VT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await Ch({value:n.value,schema:r});if(!i.success)throw new VT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await Yw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},GE=({element:e,name:t,description:n})=>{let r=_h(e);return{name:`array`,responseFormat:Mh(r.jsonSchema).then(e=>{let{$schema:r,...i}=e;return{type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:i}},required:[`elements`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:e},t){let n=await Th({text:e});if(!n.success)throw new VT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=n.value;if(typeof i!=`object`||!i||!(`elements`in i)||!Array.isArray(i.elements))throw new VT({message:`No object generated: response did not match schema.`,cause:new sa({value:i,cause:`response must be an object with an elements array`}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let a=[];for(let n of i.elements){let i=await Ch({value:n,schema:r});if(!i.success)throw new VT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});a.push(i.value)}return a},async parsePartialOutput({text:e}){let t=await Yw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let e=t.value;if(typeof e!=`object`||!e||!(`elements`in e)||!Array.isArray(e.elements))return;let n=t.state===`repaired-parse`&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of n){let t=await Ch({value:e,schema:r});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(t!=null)for(;e<t.length;e++)n.enqueue(t[e])}})}}},KE=({options:e,name:t,description:n})=>({name:`choice`,responseFormat:Promise.resolve({type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:t},n){let r=await Th({text:t});if(!r.success)throw new VT({message:`No object generated: could not parse the response.`,cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=r.value;if(typeof i!=`object`||!i||!(`result`in i)||typeof i.result!=`string`||!e.includes(i.result))throw new VT({message:`No object generated: response did not match schema.`,cause:new sa({value:i,cause:`response must be an object that contains a choice value.`}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.result},async parsePartialOutput({text:t}){let n=await Yw(t);switch(n.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let t=n.value;if(typeof t!=`object`||!t||!(`result`in t)||typeof t.result!=`string`)return;let r=e.filter(e=>e.startsWith(t.result));return n.state===`successful-parse`?r.includes(t.result)?{partial:t.result}:void 0:r.length===1?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),qE=({name:e,description:t}={})=>({name:`json`,responseFormat:Promise.resolve({type:`json`,...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:e},t){let n=await Th({text:e});if(!n.success)throw new VT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await Yw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return t.value===void 0?void 0:{partial:t.value}}},createElementStreamTransform(){}}),JE=`ai:telemetry`,new TextEncoder,new TextEncoder,sg({prefix:`aitxt`,size:24}),sg({prefix:`call`,size:24}),TransformStream,hu(I(),yE.optional()),sg({prefix:`aitxt`,size:24}),sg({prefix:`call`,size:24}),sg({prefix:`aitxt`,size:24}),sg({prefix:`call`,size:24}),hu(I(),yE.optional()),hu(I(),I()),sg({prefix:`call`,size:24}),sg({prefix:`call`,size:24}),XE={type:`no-schema`,jsonSchema:async()=>void 0,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(e,t){return e===void 0?{success:!1,error:new VT({message:`No object generated: response did not match schema.`,text:t.text,response:t.response,usage:t.usage,finishReason:t.finishReason})}:{success:!0,value:e}},createElementStream(){throw new pa({functionality:`element streams in no-schema mode`})}},ZE=e=>({type:`object`,jsonSchema:async()=>await e.jsonSchema,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(t){return Ch({value:t,schema:e})},createElementStream(){throw new pa({functionality:`element streams in object mode`})}}),QE=e=>({type:`array`,jsonSchema:async()=>{let{$schema:t,...n}=await e.jsonSchema;return{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:n}},required:[`elements`],additionalProperties:!1}},async validatePartialResult({value:t,latestObject:n,isFirstDelta:r,isFinalDelta:i}){if(!Hr(t)||!Vr(t.elements))return{success:!1,error:new sa({value:t,cause:`value must be an object that contains an array of elements`})};let a=t.elements,o=[];for(let t=0;t<a.length;t++){let n=a[t],r=await Ch({value:n,schema:e});if(!(t===a.length-1&&!i)){if(!r.success)return r;o.push(r.value)}}let s=n?.length??0,c=``;return r&&(c+=`[`),s>0&&(c+=`,`),c+=o.slice(s).map(e=>JSON.stringify(e)).join(`,`),i&&(c+=`]`),{success:!0,value:{partial:o,textDelta:c}}},async validateFinalResult(t){if(!Hr(t)||!Vr(t.elements))return{success:!1,error:new sa({value:t,cause:`value must be an object that contains an array of elements`})};let n=t.elements,r=[];for(let t of n){let n=await Ch({value:t,schema:e});if(!n.success)return n;r.push(n.value)}return{success:!0,value:r}},createElementStream(e){let t=0;return lT(e.pipeThrough(new TransformStream({transform(e,n){switch(e.type){case`object`:{let r=e.object;for(;t<r.length;t++)n.enqueue(r[t]);break}case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}}),$E=e=>({type:`enum`,jsonSchema:async()=>({$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1}),async validateFinalResult(t){if(!Hr(t)||typeof t.result!=`string`)return{success:!1,error:new sa({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let n=t.result;return e.includes(n)?{success:!0,value:n}:{success:!1,error:new sa({value:t,cause:`value must be a string in the enum`})}},async validatePartialResult({value:t,textDelta:n}){if(!Hr(t)||typeof t.result!=`string`)return{success:!1,error:new sa({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let r=t.result,i=e.filter(e=>e.startsWith(r));return t.result.length===0||i.length===0?{success:!1,error:new sa({value:t,cause:`value must be a string in the enum`})}:{success:!0,value:{partial:i.length>1?r:i[0],textDelta:n}}},createElementStream(){throw new pa({functionality:`element streams in enum mode`})}}),sg({prefix:`aiobj`,size:24}),eD=sg({prefix:`aiobj`,size:24}),tD=class{constructor({model:e,headers:t,telemetry:n,settings:r,maxRetries:i,abortSignal:a,outputStrategy:o,instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d,schemaName:f,schemaDescription:p,providerOptions:m,repairText:h,onStart:g,onStepStart:_,onStepFinish:v,onError:y,onFinish:b,download:x,generateId:S,currentDate:C,now:w}){this._object=new Kh,this._usage=new Kh,this._providerMetadata=new Kh,this._warnings=new Kh,this._request=new Kh,this._response=new Kh,this._finishReason=new Kh;let T=Cw(e),{maxRetries:ee,retry:E}=qw({maxRetries:i,abortSignal:a}),D=Rw(r),O=iT({telemetry:n}),te=this,k=fT(),A=new TransformStream({transform(e,t){t.enqueue(e),e.type===`error`&&y({error:Bw(e.error)})}});this.baseStream=k.stream.pipeThrough(A);let ne=S();(async()=>{let e=await o.jsonSchema();await Gw({event:{callId:ne,operationId:`ai.streamObject`,provider:T.provider,modelId:T.modelId,system:s??c,prompt:l,messages:u,maxOutputTokens:D.maxOutputTokens,temperature:D.temperature,topP:D.topP,topK:D.topK,presencePenalty:D.presencePenalty,frequencyPenalty:D.frequencyPenalty,seed:D.seed,maxRetries:ee,headers:t,providerOptions:m,output:o.type,schema:e,schemaName:f,schemaDescription:p},callbacks:[g,O.onStart]});let n=await zw({instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d}),i={responseFormat:{type:`json`,schema:e,name:f,description:p},...Rw(r),prompt:await Aw({prompt:n,supportedUrls:await T.supportedUrls,download:x,provider:T.provider.split(`.`)[0]}),providerOptions:m,abortSignal:a,headers:t,includeRawChunks:!1};await Gw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,providerOptions:m,headers:t,promptMessages:i.prompt},callbacks:[_,O.onObjectStepStart]});let y={transform:(e,t)=>{switch(e.type){case`text-delta`:t.enqueue(e.delta);break;case`response-metadata`:case`finish`:case`error`:case`stream-start`:t.enqueue(e);break}}},A=w(),{stream:re,response:ie,request:ae}=await E(()=>T.doStream(i));te._request.resolve(ae??{});let oe,se=Hw(),ce,le,ue,de,fe,pe=``,me=``,he={id:S(),timestamp:C(),modelId:T.modelId},ge,_e,ve=!0,ye=!0,be=re.pipeThrough(new TransformStream(y)).pipeThrough(new TransformStream({async transform(e,t){if(typeof e==`object`&&e.type===`stream-start`){oe=e.warnings;return}if(ve&&=(fe=w()-A,!1),typeof e==`string`){pe+=e,me+=e;let{value:n,state:r}=await Yw(pe);if(n!==void 0&&!_T(ge,n)){let e=await o.validatePartialResult({value:n,textDelta:me,latestObject:_e,isFirstDelta:ye,isFinalDelta:r===`successful-parse`});e.success&&!_T(_e,e.value.partial)&&(ge=n,_e=e.value.partial,t.enqueue({type:`object`,object:_e}),t.enqueue({type:`text-delta`,textDelta:e.value.textDelta}),me=``,ye=!1)}return}switch(e.type){case`response-metadata`:he={id:e.id??he.id,timestamp:e.timestamp??he.timestamp,modelId:e.modelId??he.modelId};break;case`finish`:me!==``&&t.enqueue({type:`text-delta`,textDelta:me}),ce=e.finishReason.unified,se=Vw(e.usage),le=e.providerMetadata,t.enqueue({...e,finishReason:e.finishReason.unified,usage:se,response:he}),mE({warnings:oe??[],provider:T.provider,model:T.modelId}),te._usage.resolve(se),te._providerMetadata.resolve(le),te._warnings.resolve(oe),te._response.resolve({...he,headers:ie?.headers}),te._finishReason.resolve(ce??`other`);try{ue=await hT(pe,o,h,{response:he,usage:se,finishReason:ce}),te._object.resolve(ue)}catch(e){de=e,te._object.reject(e)}break;default:t.enqueue(e);break}},async flush(e){try{let e=se??{promptTokens:NaN,completionTokens:NaN,totalTokens:NaN};await Gw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,finishReason:ce??`other`,usage:e,objectText:pe,msToFirstChunk:fe,reasoning:void 0,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[v,O.onObjectStepEnd]}),await Gw({event:{callId:ne,object:ue,error:de,reasoning:void 0,finishReason:ce??`other`,usage:e,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[b,O.onEnd]})}catch(t){e.enqueue({type:`error`,error:t})}}}));k.addStream(be)})().catch(async e=>{await O.onError?.call(O,{callId:ne,error:e}),k.addStream(new ReadableStream({start(t){t.enqueue({type:`error`,error:e}),t.close()}}))}).finally(()=>{k.close()}),this.outputStrategy=o}get object(){return this._object.promise}get usage(){return this._usage.promise}get providerMetadata(){return this._providerMetadata.promise}get warnings(){return this._warnings.promise}get request(){return this._request.promise}get response(){return this._response.promise}get finishReason(){return this._finishReason.promise}get partialObjectStream(){return lT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`object`:t.enqueue(e.object);break;case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get elementStream(){return this.outputStrategy.createElementStream(this.baseStream)}get textStream(){return lT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`text-delta`:t.enqueue(e.textDelta);break;case`object`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get fullStream(){return lT(this.baseStream)}pipeTextStreamToResponse(e,t){cT({response:e,stream:this.textStream,...t})}toTextStreamResponse(e){return oT({stream:this.textStream,...e})}},nD=`AI_NoSuchProviderError`,`${nD}`,sg({prefix:`call`,size:24})})),iD=t((()=>{Ep(),Ep()})),aD,oD=t((()=>{iD(),aD=wp({title:xp().describe(`Concise, specific issue title. Imperative or descriptive, no trailing period.`),description:xp().describe(`Issue body in Linear markdown: a short problem summary and relevant context. Do NOT include repro steps, expected/actual, or source location — those are separate fields.`),reproSteps:Cp(xp()).describe(`Ordered reproduction steps, each a single action.`),expected:xp().describe(`Expected behavior, one or two sentences.`),actual:xp().describe(`Actual (buggy) behavior, one or two sentences.`),impact:xp().describe(`Who/what is affected and how badly, 1-2 sentences (e.g. "Cosmetic/UX polish issue — doesn't block anything but feels glitchy.").`),analysisNotes:xp().describe(`Markdown bullet list ("- …") of likely root-cause analysis based on the source context. Empty string when there is nothing substantive to say.`),suggestedNextSteps:xp().describe(`Markdown bullet list of concrete, actionable fix suggestions the coding agent should consider first.`),priority:Sp().int().min(0).max(4).describe(`Linear priority: 0 none, 1 urgent, 2 high, 3 medium, 4 low.`),suggestedLabels:Cp(xp()).describe(`0-3 suggested label names, e.g. "Bug", "UI".`)})}));function sD(e){let t=[e.issueTemplate?.trim()||pD],n=(e.skillPaths??``).split(`
|
|
83
|
+
`),{name:`GatewayAuthenticationError`})}function Vw(e){return{inputTokens:e.inputTokens.total,inputTokenDetails:{noCacheTokens:e.inputTokens.noCache,cacheReadTokens:e.inputTokens.cacheRead,cacheWriteTokens:e.inputTokens.cacheWrite},outputTokens:e.outputTokens.total,outputTokenDetails:{textTokens:e.outputTokens.text,reasoningTokens:e.outputTokens.reasoning},totalTokens:Uw(e.inputTokens.total,e.outputTokens.total),raw:e.raw}}function Hw(){return{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}}function Uw(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function Ww(){return(globalThis==null?void 0:globalThis.performance)?.now()??Date.now()}async function Gw(e){await Promise.all(Hp(e.callbacks).map(async t=>{try{await t?.(e.event)}catch{}}))}function Kw({error:e,exponentialBackoffDelay:t}){let n=$r.isInstance(e)?e.responseHeaders:$r.isInstance(e.cause)?e.cause.responseHeaders:void 0;if(!n)return t;let r,i=n[`retry-after-ms`];if(i){let e=parseFloat(i);Number.isNaN(e)||(r=e)}let a=n[`retry-after`];if(a&&r===void 0){let e=parseFloat(a);r=Number.isNaN(e)?Date.parse(a)-Date.now():e*1e3}return r!=null&&!Number.isNaN(r)&&0<=r&&(r<60*1e3||r<t)?r:t}function qw({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new TT({parameter:`maxRetries`,value:e,message:`maxRetries must be an integer`});if(e<0)throw new TT({parameter:`maxRetries`,value:e,message:`maxRetries must be >= 0`})}let n=e??2;return{maxRetries:n,retry:VE({maxRetries:n,abortSignal:t})}}function Jw(e){let t=[`ROOT`],n=-1,r=null,i=0;function a(e){return e>=`0`&&e<=`9`||e>=`A`&&e<=`F`||e>=`a`&&e<=`f`}function o(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function s(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case`ROOT`:o(u,l,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=l,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(u){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:o(u,l,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:s(u,l);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=l;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=l}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=l,t.pop();break;default:n=l,o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=l,t.pop();break;default:n=l;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),u===`u`?(i=0,t.push(`INSIDE_STRING_UNICODE_ESCAPE`)):n=l;break;case`INSIDE_STRING_UNICODE_ESCAPE`:a(u)&&(i++,i===4&&(t.pop(),n=l));break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=l;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,l+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?s(u,l):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l)):n=l;break}}}let l=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:l+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:l+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:l+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?l+=`true`.slice(t.length):`false`.startsWith(t)?l+=`false`.slice(t.length):`null`.startsWith(t)&&(l+=`null`.slice(t.length))}}return l}async function Yw(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await Th({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await Th({text:Jw(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function Xw(...e){return async t=>{await Promise.allSettled(e.map(async e=>{await e?.(t)}))}}function Zw(){return typeof process<`u`&&process.release?.name===`node`}async function Qw(){if(Zw())return YE??=Promise.resolve($w(`node:diagnostics_channel`)),YE}function $w(e){let t=globalThis.process;try{return(t?.getBuiltinModule)?.call(t,e)}catch{return}}async function eT(e,t){let n=await Qw(),r=(n?.tracingChannel)?.call(n,JE);if(r==null||r.hasSubscribers===!1)return await t();let i,a,o,s=!1,c=!1,l=()=>{try{i=Promise.resolve(t())}catch(e){i=Promise.reject(e)}return i=i.then(e=>(a=e,s=!0,e),e=>{throw o=e,c=!0,e}),i};try{return await r.tracePromise(l,e)}catch{if(c)throw o;return s?a:i==null?await t():await i}}function tT({message:e,completion:t}){if(!Zw())return;let n=$w(`node:diagnostics_channel`),r=$w(`node:async_hooks`),i=(n?.tracingChannel)?.call(n,JE);if(i==null||i.hasSubscribers===!1||r==null){Promise.resolve(t).catch(()=>{});return}let a=e,o,s=!1,c=e=>{try{e()}catch{}},l=({result:e,error:t})=>{s||(s=!0,t!==void 0&&(a.error=t,c(()=>i.error.publish(a))),e!==void 0&&(a.result=e),c(()=>i.asyncEnd.publish(a)))};return c(()=>{i.start.runStores(a,()=>{o=new r.AsyncResource(`ai.telemetry`)})}),c(()=>i.end.publish(a)),Promise.resolve(t).then(e=>l({result:e}),e=>l({error:e})),{run:e=>o==null?e():o.runInAsyncScope(e)}}function nT(){return globalThis.AI_SDK_TELEMETRY_INTEGRATIONS??[]}function rT(e,t){return Object.assign(Object.create(Object.getPrototypeOf(e)),e,t)}function iT({telemetry:e}){if(e?.isEnabled===!1)return{};let t=e?.integrations,n=t==null?nT():Hp(t),r={recordInputs:e?.recordInputs,recordOutputs:e?.recordOutputs,functionId:e?.functionId},i=e=>{let t=Xw(...n.map(t=>t[e]?.bind(t)).filter(Boolean).map(e=>t=>e(rT(t,r))));return async e=>{await t(e)}},a=n.map(e=>e.executeLanguageModelCall?.bind(e)).filter(Boolean),o=n.map(e=>e.executeTool?.bind(e)).filter(Boolean);return{runInTracingChannelSpan:async({type:e,event:t,execute:n})=>await eT({type:e,event:rT(t,r)},n),startTracingChannelContext:({type:e,event:t,completion:n})=>tT({message:{type:e,event:rT(t,r)},completion:n}),onStart:i(`onStart`),onStepStart:i(`onStepStart`),onLanguageModelCallStart:i(`onLanguageModelCallStart`),onLanguageModelCallEnd:i(`onLanguageModelCallEnd`),onToolExecutionStart:i(`onToolExecutionStart`),onToolExecutionEnd:i(`onToolExecutionEnd`),onStepEnd:Xw(i(`onStepEnd`),i(`onStepFinish`)),onObjectStepStart:i(`onObjectStepStart`),onObjectStepEnd:i(`onObjectStepEnd`),onEmbedStart:i(`onEmbedStart`),onEmbedEnd:i(`onEmbedEnd`),onRerankStart:i(`onRerankStart`),onRerankEnd:i(`onRerankEnd`),onEnd:i(`onEnd`),onAbort:i(`onAbort`),onError:i(`onError`),executeLanguageModelCall:async({execute:e,...t})=>{let n=rT(t,r),i=e;for(let e of a){let t=i;i=()=>e({...n,execute:t})}return await eT({type:`languageModelCall`,event:n},i)},executeTool:async({execute:e,...t})=>{let n=rT(t,r),i=e;for(let e of o){let t=i;i=()=>e({...n,execute:t})}return await i()}}}function aT(e,t){let n=new Headers(e??{});for(let[e,r]of Object.entries(t))n.has(e)||n.set(e,r);return n}function oT({status:e,statusText:t,headers:n,stream:r}){return new Response(r.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:aT(n,{"content-type":`text/plain; charset=utf-8`})})}function sT({response:e,status:t,statusText:n,headers:r,stream:i}){let a=t??200;n===void 0?e.writeHead(a,r):e.writeHead(a,n,r);let o=i.getReader();(async()=>{try{for(;;){let{done:t,value:n}=await o.read();if(t)break;let r=e.write(n),i=e.flush;typeof i==`function`&&i.call(e),r||await new Promise(t=>{e.once(`drain`,t)})}}catch(e){throw e}finally{e.end()}})()}function cT({response:e,status:t,statusText:n,headers:r,stream:i}){sT({response:e,status:t,statusText:n,headers:Object.fromEntries(aT(r,{"content-type":`text/plain; charset=utf-8`}).entries()),stream:i.pipeThrough(new TextEncoderStream)})}function lT(e){return uT(e.pipeThrough(new TransformStream))}function uT(e){return e[Symbol.asyncIterator]=function(){let e=this.getReader(),t=!1;async function n(n){if(!t){t=!0;try{n&&await e.cancel?.call(e)}finally{try{e.releaseLock()}catch{}}}}return{async next(){if(t)return{done:!0,value:void 0};let{done:r,value:i}=await e.read();return r?(await n(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(e){throw await n(!0),e}}},e}function dT(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function fT(){let e=[],t=null,n=!1,r=dT(),i=()=>{n=!0,r.resolve(),e.forEach(e=>e.cancel()),e=[],t?.close()},a=async()=>{if(n&&e.length===0){t?.close();return}if(e.length===0)return r=dT(),await r.promise,await a();try{let{value:r,done:i}=await e[0].read();i?(e.shift(),e.length===0&&n?t?.close():await a()):t?.enqueue(r)}catch(n){t?.error(n),e.shift(),i()}};return{stream:new ReadableStream({start(e){t=e},pull:a,async cancel(){for(let t of e)await t.cancel();e=[],n=!0}}),addStream:t=>{if(n)throw Error(`Cannot add inner stream: outer stream is closed`);e.push(t.getReader()),r.resolve()},close:()=>{n=!0,r.resolve(),e.length===0&&t?.close()},terminate:i}}function pT({output:e,schema:t,enumValues:n}){switch(e){case`object`:return ZE(_h(t));case`array`:return QE(_h(t));case`enum`:return $E(n);case`no-schema`:return XE;default:throw Error(`Unsupported output: ${e}`)}}async function mT(e,t,n){let r=await Th({text:e});if(!r.success)throw new VT({message:`No object generated: could not parse the response.`,cause:r.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=await t.validateFinalResult(r.value,{text:e,response:n.response,usage:n.usage});if(!i.success)throw new VT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.value}async function hT(e,t,n,r){try{return await mT(e,t,r)}catch(i){if(n!=null&&VT.isInstance(i)&&(ki.isInstance(i.cause)||sa.isInstance(i.cause))){let a=await n({text:e,error:i.cause});if(a===null)throw i;return await mT(a,t,r)}throw i}}function gT({output:e,schema:t,schemaName:n,schemaDescription:r,enumValues:i}){if(e!=null&&e!==`object`&&e!==`array`&&e!==`enum`&&e!==`no-schema`)throw new TT({parameter:`output`,value:e,message:`Invalid output type.`});if(e===`no-schema`){if(t!=null)throw new TT({parameter:`schema`,value:t,message:`Schema is not supported for no-schema output.`});if(r!=null)throw new TT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for no-schema output.`});if(n!=null)throw new TT({parameter:`schemaName`,value:n,message:`Schema name is not supported for no-schema output.`});if(i!=null)throw new TT({parameter:`enumValues`,value:i,message:`Enum values are not supported for no-schema output.`})}if(e===`object`){if(t==null)throw new TT({parameter:`schema`,value:t,message:`Schema is required for object output.`});if(i!=null)throw new TT({parameter:`enumValues`,value:i,message:`Enum values are not supported for object output.`})}if(e===`array`){if(t==null)throw new TT({parameter:`schema`,value:t,message:`Element schema is required for array output.`});if(i!=null)throw new TT({parameter:`enumValues`,value:i,message:`Enum values are not supported for array output.`})}if(e===`enum`){if(t!=null)throw new TT({parameter:`schema`,value:t,message:`Schema is not supported for enum output.`});if(r!=null)throw new TT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for enum output.`});if(n!=null)throw new TT({parameter:`schemaName`,value:n,message:`Schema name is not supported for enum output.`});if(i==null)throw new TT({parameter:`enumValues`,value:i,message:`Enum values are required for enum output.`});for(let e of i)if(typeof e!=`string`)throw new TT({parameter:`enumValues`,value:e,message:`Enum values must be strings.`})}}function _T(e,t){if(e===t)return!0;if(e==null||t==null)return!1;if(typeof e!=`object`&&typeof t!=`object`)return e===t;if(e.constructor!==t.constructor)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!_T(e[n],t[n]))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||!_T(e[i],t[i]))return!1;return!0}function vT(e){let{model:t,output:n=`object`,instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,maxRetries:c,abortSignal:l,headers:u,experimental_repairText:d,experimental_telemetry:f,telemetry:p=f,experimental_download:m,providerOptions:h,onStart:g,experimental_onStart:_,onStepStart:v,experimental_onStepStart:y,onStepEnd:b,onStepFinish:x,onError:S=({error:e})=>{console.error(e)},onFinish:C,_internal:{generateId:w=eD,currentDate:T=()=>new Date,now:E=Ww}={},...D}=e,O=`enum`in e&&e.enum?e.enum:void 0,{schema:k,schemaDescription:ee,schemaName:te}=`schema`in e?e:{};return gT({output:n,schema:k,schemaName:te,schemaDescription:ee,enumValues:O}),new tD({model:t,telemetry:p,headers:u,settings:D,maxRetries:c,abortSignal:l,outputStrategy:pT({output:n,schema:k,enumValues:O}),instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,schemaName:te,schemaDescription:ee,providerOptions:h,repairText:d,onStart:g??_,onStepStart:v??y,onStepFinish:b??x,onError:S,onFinish:C,download:m,generateId:w,currentDate:T,now:E})}var yT,bT,xT,ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE,qE,JE,YE,XE,ZE,QE,$E,eD,tD,nD,rD=t((()=>{Xg(),ma(),iw(),Nd(),yT=Object.defineProperty,bT=(e,t)=>{for(var n in t)yT(e,n,{get:t[n],enumerable:!0})},xT=`AI_InvalidArgumentError`,ST=`vercel.ai.error.${xT}`,CT=Symbol.for(ST),TT=class extends qr{constructor({parameter:e,value:t,message:n}){super({name:xT,message:`Invalid argument for parameter ${e}: ${n}`}),this[wT]=!0,this.parameter=e,this.value=t}static isInstance(e){return qr.hasMarker(e,ST)}},wT=CT,ET=`AI_InvalidStreamPartError`,`${ET}`,DT=`AI_InvalidToolApprovalError`,`${DT}`,OT=`AI_InvalidToolApprovalSignatureError`,`${OT}`,kT=`AI_InvalidToolInputError`,`${kT}`,AT=`AI_ToolCallNotFoundForApprovalError`,`${AT}`,jT=`AI_MissingToolResultsError`,MT=`vercel.ai.error.${jT}`,NT=Symbol.for(MT),FT=class extends qr{constructor({toolCallIds:e}){super({name:jT,message:`Tool result${e.length>1?`s are`:` is`} missing for tool call${e.length>1?`s`:``} ${e.join(`, `)}.`}),this[PT]=!0,this.toolCallIds=e}static isInstance(e){return qr.hasMarker(e,MT)}},PT=NT,IT=`AI_NoImageGeneratedError`,`${IT}`,LT=`AI_NoObjectGeneratedError`,RT=`vercel.ai.error.${LT}`,zT=Symbol.for(RT),VT=class extends qr{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:LT,message:e,cause:t}),this[BT]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return qr.hasMarker(e,RT)}},BT=zT,HT=`AI_NoOutputGeneratedError`,`${HT}`,UT=`AI_NoSpeechGeneratedError`,`${UT}`,WT=`AI_NoTranscriptGeneratedError`,`${WT}`,GT=`AI_NoVideoGeneratedError`,`${GT}`,KT=`AI_NoSuchToolError`,`${KT}`,qT=`AI_ToolCallRepairError`,`${qT}`,JT=class extends qr{constructor(e){super({name:`AI_UnsupportedModelVersionError`,message:`Unsupported model version ${e.version} for provider "${e.provider}" and model "${e.modelId}". AI SDK 5 only supports models that implement specification version "v2".`}),this.version=e.version,this.provider=e.provider,this.modelId=e.modelId}},YT=`AI_UIMessageStreamError`,`${YT}`,XT=`AI_InvalidDataContentError`,ZT=`vercel.ai.error.${XT}`,QT=Symbol.for(ZT),eE=class extends qr{constructor({content:e,cause:t,message:n=`Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof e}.`}){super({name:XT,message:n,cause:t}),this[$T]=!0,this.content=e}static isInstance(e){return qr.hasMarker(e,ZT)}},$T=QT,tE=`AI_InvalidMessageRoleError`,nE=`vercel.ai.error.${tE}`,rE=Symbol.for(nE),aE=class extends qr{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:tE,message:t}),this[iE]=!0,this.role=e}static isInstance(e){return qr.hasMarker(e,nE)}},iE=rE,oE=`AI_MessageConversionError`,`${oE}`,sE=`AI_RetryError`,cE=`vercel.ai.error.${sE}`,lE=Symbol.for(cE),dE=class extends qr{constructor({message:e,reason:t,errors:n}){super({name:sE,message:e}),this[uE]=!0,this.reason=t,this.errors=n,this.lastError=n[n.length-1]}static isInstance(e){return qr.hasMarker(e,cE)}},uE=lE,fE=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,pE=!1,mE=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}pE||(pE=!0,console.info(fE));for(let t of e.warnings){let n=aw({warning:t,provider:e.provider,model:e.model});typeof process<`u`&&typeof process.emitWarning==`function`?process.emitWarning(n,{type:t.type===`deprecated`?`DeprecationWarning`:`Warning`}):console.warn(n)}}},hE=`7.0.22`,gE=async({url:e,maxBytes:t,abortSignal:n})=>{let r=e.toString();try{let e=await um({url:r,headers:ym({},`ai-sdk/${hE}`,_m()),abortSignal:n});if(!e.ok)throw await rm(e),new ig({url:r,statusCode:e.status,statusText:e.statusText});return{data:await dm({response:e,url:r,maxBytes:t??og}),mediaType:e.headers.get(`content-type`)??void 0}}catch(e){throw ig.isInstance(e)?e:new ig({url:r,cause:e})}},_E=(e=gE)=>t=>Promise.all(t.map(async t=>t.isUrlSupportedByModel?null:await e(t))),vE={jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,avif:`image/avif`,heic:`image/heic`,bmp:`image/bmp`,tiff:`image/tiff`,tif:`image/tiff`,pdf:`application/pdf`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`},yE=Tu(()=>B([su(),I(),L(),ou(),hu(I(),yE.optional()),R(yE)])),bE=hu(I(),hu(I(),yE.optional())),xE=B([I(),Au(Uint8Array),Au(ArrayBuffer),Du(bm,{message:`Must be a Buffer`})]),SE=hu(I(),I()),CE=z({type:H(`text`),text:I(),providerOptions:bE.optional()}),wE=z({type:H(`image`),image:B([xE,Au(URL),SE]),mediaType:I().optional(),providerOptions:bE.optional()}),TE=fu(`type`,[z({type:H(`data`),data:xE}),z({type:H(`url`),url:Au(URL)}),z({type:H(`reference`),reference:SE}),z({type:H(`text`),text:I()})]),EE=fu(`type`,[z({type:H(`data`),data:xE}),z({type:H(`url`),url:Au(URL)})]),DE=z({type:H(`file`),data:B([TE,xE,Au(URL),SE]),filename:I().optional(),mediaType:I(),providerOptions:bE.optional()}),OE=z({type:H(`reasoning`),text:I(),providerOptions:bE.optional()}),kE=z({type:H(`custom`),kind:I().transform(e=>e),providerOptions:bE.optional()}),AE=z({type:H(`reasoning-file`),data:B([EE,xE,Au(URL)]),mediaType:I(),providerOptions:bE.optional()}),jE=z({type:H(`tool-call`),toolCallId:I(),toolName:I(),input:lu(),providerOptions:bE.optional(),providerExecuted:ou().optional()}),ME=fu(`type`,[z({type:H(`text`),value:I(),providerOptions:bE.optional()}),z({type:H(`json`),value:yE,providerOptions:bE.optional()}),z({type:H(`execution-denied`),reason:I().optional(),providerOptions:bE.optional()}),z({type:H(`error-text`),value:I(),providerOptions:bE.optional()}),z({type:H(`error-json`),value:yE,providerOptions:bE.optional()}),z({type:H(`content`),value:R(B([z({type:H(`text`),text:I(),providerOptions:bE.optional()}),z({type:H(`file`),data:TE,mediaType:I(),filename:I().optional(),providerOptions:bE.optional()}),z({type:H(`file-data`),data:I(),mediaType:I(),filename:I().optional(),providerOptions:bE.optional()}),z({type:H(`file-url`),url:I(),mediaType:I().optional(),providerOptions:bE.optional()}),z({type:H(`file-id`),fileId:B([I(),hu(I(),I())]),providerOptions:bE.optional()}),z({type:H(`file-reference`),providerReference:hu(I(),I()),providerOptions:bE.optional()}),z({type:H(`image-data`),data:I(),mediaType:I(),providerOptions:bE.optional()}),z({type:H(`image-url`),url:I(),providerOptions:bE.optional()}),z({type:H(`image-file-id`),fileId:B([I(),hu(I(),I())]),providerOptions:bE.optional()}),z({type:H(`image-file-reference`),providerReference:hu(I(),I()),providerOptions:bE.optional()}),z({type:H(`custom`),providerOptions:bE.optional()})]))})]),NE=z({type:H(`tool-result`),toolCallId:I(),toolName:I(),output:ME,providerOptions:bE.optional()}),PE=z({type:H(`tool-approval-request`),approvalId:I(),toolCallId:I()}),FE=z({type:H(`tool-approval-response`),approvalId:I(),approved:ou(),reason:I().optional()}),IE=z({role:H(`system`),content:I(),providerOptions:bE.optional()}),LE=z({role:H(`user`),content:B([I(),R(B([CE,wE,DE]))]),providerOptions:bE.optional()}),RE=z({role:H(`assistant`),content:B([I(),R(B([CE,kE,DE,OE,AE,jE,NE,PE]))]),providerOptions:bE.optional()}),zE=z({role:H(`tool`),content:R(B([NE,FE])),providerOptions:bE.optional()}),BE=B([IE,LE,RE,zE]),VE=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:n=2,abortSignal:r}={})=>Hg({maxRetries:e,initialDelayInMs:t,backoffFactor:n,abortSignal:r,shouldRetry:e=>e instanceof Error&&($r.isInstance(e)&&e.isRetryable===!0||oS.isInstance(e)&&e.isRetryable===!0),getDelayInMs:({error:e,exponentialBackoffDelay:t})=>Kw({error:e,exponentialBackoffDelay:t}),createRetryError:({message:e,reason:t,errors:n})=>new dE({message:e,reason:t,errors:n})}),HE={},bT(HE,{array:()=>GE,choice:()=>KE,json:()=>qE,object:()=>WE,text:()=>UE}),UE=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),WE=({schema:e,name:t,description:n})=>{let r=_h(e);return{name:`object`,responseFormat:Mh(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await Th({text:e});if(!n.success)throw new VT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await Ch({value:n.value,schema:r});if(!i.success)throw new VT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await Yw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},GE=({element:e,name:t,description:n})=>{let r=_h(e);return{name:`array`,responseFormat:Mh(r.jsonSchema).then(e=>{let{$schema:r,...i}=e;return{type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:i}},required:[`elements`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:e},t){let n=await Th({text:e});if(!n.success)throw new VT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=n.value;if(typeof i!=`object`||!i||!(`elements`in i)||!Array.isArray(i.elements))throw new VT({message:`No object generated: response did not match schema.`,cause:new sa({value:i,cause:`response must be an object with an elements array`}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let a=[];for(let n of i.elements){let i=await Ch({value:n,schema:r});if(!i.success)throw new VT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});a.push(i.value)}return a},async parsePartialOutput({text:e}){let t=await Yw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let e=t.value;if(typeof e!=`object`||!e||!(`elements`in e)||!Array.isArray(e.elements))return;let n=t.state===`repaired-parse`&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of n){let t=await Ch({value:e,schema:r});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(t!=null)for(;e<t.length;e++)n.enqueue(t[e])}})}}},KE=({options:e,name:t,description:n})=>({name:`choice`,responseFormat:Promise.resolve({type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:t},n){let r=await Th({text:t});if(!r.success)throw new VT({message:`No object generated: could not parse the response.`,cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=r.value;if(typeof i!=`object`||!i||!(`result`in i)||typeof i.result!=`string`||!e.includes(i.result))throw new VT({message:`No object generated: response did not match schema.`,cause:new sa({value:i,cause:`response must be an object that contains a choice value.`}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.result},async parsePartialOutput({text:t}){let n=await Yw(t);switch(n.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let t=n.value;if(typeof t!=`object`||!t||!(`result`in t)||typeof t.result!=`string`)return;let r=e.filter(e=>e.startsWith(t.result));return n.state===`successful-parse`?r.includes(t.result)?{partial:t.result}:void 0:r.length===1?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),qE=({name:e,description:t}={})=>({name:`json`,responseFormat:Promise.resolve({type:`json`,...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:e},t){let n=await Th({text:e});if(!n.success)throw new VT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await Yw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return t.value===void 0?void 0:{partial:t.value}}},createElementStreamTransform(){}}),JE=`ai:telemetry`,new TextEncoder,new TextEncoder,sg({prefix:`aitxt`,size:24}),sg({prefix:`call`,size:24}),TransformStream,hu(I(),yE.optional()),sg({prefix:`aitxt`,size:24}),sg({prefix:`call`,size:24}),sg({prefix:`aitxt`,size:24}),sg({prefix:`call`,size:24}),hu(I(),yE.optional()),hu(I(),I()),sg({prefix:`call`,size:24}),sg({prefix:`call`,size:24}),XE={type:`no-schema`,jsonSchema:async()=>void 0,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(e,t){return e===void 0?{success:!1,error:new VT({message:`No object generated: response did not match schema.`,text:t.text,response:t.response,usage:t.usage,finishReason:t.finishReason})}:{success:!0,value:e}},createElementStream(){throw new pa({functionality:`element streams in no-schema mode`})}},ZE=e=>({type:`object`,jsonSchema:async()=>await e.jsonSchema,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(t){return Ch({value:t,schema:e})},createElementStream(){throw new pa({functionality:`element streams in object mode`})}}),QE=e=>({type:`array`,jsonSchema:async()=>{let{$schema:t,...n}=await e.jsonSchema;return{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:n}},required:[`elements`],additionalProperties:!1}},async validatePartialResult({value:t,latestObject:n,isFirstDelta:r,isFinalDelta:i}){if(!Hr(t)||!Vr(t.elements))return{success:!1,error:new sa({value:t,cause:`value must be an object that contains an array of elements`})};let a=t.elements,o=[];for(let t=0;t<a.length;t++){let n=a[t],r=await Ch({value:n,schema:e});if(!(t===a.length-1&&!i)){if(!r.success)return r;o.push(r.value)}}let s=n?.length??0,c=``;return r&&(c+=`[`),s>0&&(c+=`,`),c+=o.slice(s).map(e=>JSON.stringify(e)).join(`,`),i&&(c+=`]`),{success:!0,value:{partial:o,textDelta:c}}},async validateFinalResult(t){if(!Hr(t)||!Vr(t.elements))return{success:!1,error:new sa({value:t,cause:`value must be an object that contains an array of elements`})};let n=t.elements,r=[];for(let t of n){let n=await Ch({value:t,schema:e});if(!n.success)return n;r.push(n.value)}return{success:!0,value:r}},createElementStream(e){let t=0;return lT(e.pipeThrough(new TransformStream({transform(e,n){switch(e.type){case`object`:{let r=e.object;for(;t<r.length;t++)n.enqueue(r[t]);break}case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}}),$E=e=>({type:`enum`,jsonSchema:async()=>({$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1}),async validateFinalResult(t){if(!Hr(t)||typeof t.result!=`string`)return{success:!1,error:new sa({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let n=t.result;return e.includes(n)?{success:!0,value:n}:{success:!1,error:new sa({value:t,cause:`value must be a string in the enum`})}},async validatePartialResult({value:t,textDelta:n}){if(!Hr(t)||typeof t.result!=`string`)return{success:!1,error:new sa({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let r=t.result,i=e.filter(e=>e.startsWith(r));return t.result.length===0||i.length===0?{success:!1,error:new sa({value:t,cause:`value must be a string in the enum`})}:{success:!0,value:{partial:i.length>1?r:i[0],textDelta:n}}},createElementStream(){throw new pa({functionality:`element streams in enum mode`})}}),sg({prefix:`aiobj`,size:24}),eD=sg({prefix:`aiobj`,size:24}),tD=class{constructor({model:e,headers:t,telemetry:n,settings:r,maxRetries:i,abortSignal:a,outputStrategy:o,instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d,schemaName:f,schemaDescription:p,providerOptions:m,repairText:h,onStart:g,onStepStart:_,onStepFinish:v,onError:y,onFinish:b,download:x,generateId:S,currentDate:C,now:w}){this._object=new Kh,this._usage=new Kh,this._providerMetadata=new Kh,this._warnings=new Kh,this._request=new Kh,this._response=new Kh,this._finishReason=new Kh;let T=Cw(e),{maxRetries:E,retry:D}=qw({maxRetries:i,abortSignal:a}),O=Rw(r),k=iT({telemetry:n}),ee=this,te=fT(),A=new TransformStream({transform(e,t){t.enqueue(e),e.type===`error`&&y({error:Bw(e.error)})}});this.baseStream=te.stream.pipeThrough(A);let ne=S();(async()=>{let e=await o.jsonSchema();await Gw({event:{callId:ne,operationId:`ai.streamObject`,provider:T.provider,modelId:T.modelId,system:s??c,prompt:l,messages:u,maxOutputTokens:O.maxOutputTokens,temperature:O.temperature,topP:O.topP,topK:O.topK,presencePenalty:O.presencePenalty,frequencyPenalty:O.frequencyPenalty,seed:O.seed,maxRetries:E,headers:t,providerOptions:m,output:o.type,schema:e,schemaName:f,schemaDescription:p},callbacks:[g,k.onStart]});let n=await zw({instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d}),i={responseFormat:{type:`json`,schema:e,name:f,description:p},...Rw(r),prompt:await Aw({prompt:n,supportedUrls:await T.supportedUrls,download:x,provider:T.provider.split(`.`)[0]}),providerOptions:m,abortSignal:a,headers:t,includeRawChunks:!1};await Gw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,providerOptions:m,headers:t,promptMessages:i.prompt},callbacks:[_,k.onObjectStepStart]});let y={transform:(e,t)=>{switch(e.type){case`text-delta`:t.enqueue(e.delta);break;case`response-metadata`:case`finish`:case`error`:case`stream-start`:t.enqueue(e);break}}},A=w(),{stream:re,response:ie,request:ae}=await D(()=>T.doStream(i));ee._request.resolve(ae??{});let oe,se=Hw(),ce,le,ue,de,fe,pe=``,me=``,he={id:S(),timestamp:C(),modelId:T.modelId},ge,_e,ve=!0,ye=!0,be=re.pipeThrough(new TransformStream(y)).pipeThrough(new TransformStream({async transform(e,t){if(typeof e==`object`&&e.type===`stream-start`){oe=e.warnings;return}if(ve&&=(fe=w()-A,!1),typeof e==`string`){pe+=e,me+=e;let{value:n,state:r}=await Yw(pe);if(n!==void 0&&!_T(ge,n)){let e=await o.validatePartialResult({value:n,textDelta:me,latestObject:_e,isFirstDelta:ye,isFinalDelta:r===`successful-parse`});e.success&&!_T(_e,e.value.partial)&&(ge=n,_e=e.value.partial,t.enqueue({type:`object`,object:_e}),t.enqueue({type:`text-delta`,textDelta:e.value.textDelta}),me=``,ye=!1)}return}switch(e.type){case`response-metadata`:he={id:e.id??he.id,timestamp:e.timestamp??he.timestamp,modelId:e.modelId??he.modelId};break;case`finish`:me!==``&&t.enqueue({type:`text-delta`,textDelta:me}),ce=e.finishReason.unified,se=Vw(e.usage),le=e.providerMetadata,t.enqueue({...e,finishReason:e.finishReason.unified,usage:se,response:he}),mE({warnings:oe??[],provider:T.provider,model:T.modelId}),ee._usage.resolve(se),ee._providerMetadata.resolve(le),ee._warnings.resolve(oe),ee._response.resolve({...he,headers:ie?.headers}),ee._finishReason.resolve(ce??`other`);try{ue=await hT(pe,o,h,{response:he,usage:se,finishReason:ce}),ee._object.resolve(ue)}catch(e){de=e,ee._object.reject(e)}break;default:t.enqueue(e);break}},async flush(e){try{let e=se??{promptTokens:NaN,completionTokens:NaN,totalTokens:NaN};await Gw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,finishReason:ce??`other`,usage:e,objectText:pe,msToFirstChunk:fe,reasoning:void 0,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[v,k.onObjectStepEnd]}),await Gw({event:{callId:ne,object:ue,error:de,reasoning:void 0,finishReason:ce??`other`,usage:e,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[b,k.onEnd]})}catch(t){e.enqueue({type:`error`,error:t})}}}));te.addStream(be)})().catch(async e=>{await k.onError?.call(k,{callId:ne,error:e}),te.addStream(new ReadableStream({start(t){t.enqueue({type:`error`,error:e}),t.close()}}))}).finally(()=>{te.close()}),this.outputStrategy=o}get object(){return this._object.promise}get usage(){return this._usage.promise}get providerMetadata(){return this._providerMetadata.promise}get warnings(){return this._warnings.promise}get request(){return this._request.promise}get response(){return this._response.promise}get finishReason(){return this._finishReason.promise}get partialObjectStream(){return lT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`object`:t.enqueue(e.object);break;case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get elementStream(){return this.outputStrategy.createElementStream(this.baseStream)}get textStream(){return lT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`text-delta`:t.enqueue(e.textDelta);break;case`object`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get fullStream(){return lT(this.baseStream)}pipeTextStreamToResponse(e,t){cT({response:e,stream:this.textStream,...t})}toTextStreamResponse(e){return oT({stream:this.textStream,...e})}},nD=`AI_NoSuchProviderError`,`${nD}`,sg({prefix:`call`,size:24})})),iD=t((()=>{Ep(),Ep()})),aD,oD=t((()=>{iD(),aD=wp({title:xp().describe(`Concise, specific issue title. Imperative or descriptive, no trailing period.`),description:xp().describe(`Issue body in Linear markdown: a short problem summary and relevant context. Do NOT include repro steps, expected/actual, or source location — those are separate fields.`),reproSteps:Cp(xp()).describe(`Ordered reproduction steps, each a single action.`),expected:xp().describe(`Expected behavior, one or two sentences.`),actual:xp().describe(`Actual (buggy) behavior, one or two sentences.`),impact:xp().describe(`Who/what is affected and how badly, 1-2 sentences (e.g. "Cosmetic/UX polish issue — doesn't block anything but feels glitchy.").`),analysisNotes:xp().describe(`Markdown bullet list ("- …") of likely root-cause analysis based on the source context. Empty string when there is nothing substantive to say.`),suggestedNextSteps:xp().describe(`Markdown bullet list of concrete, actionable fix suggestions the coding agent should consider first.`),priority:Sp().int().min(0).max(4).describe(`Linear priority: 0 none, 1 urgent, 2 high, 3 medium, 4 low.`),suggestedLabels:Cp(xp()).describe(`0-3 suggested label names, e.g. "Bug", "UI".`)})}));function sD(e){let t=[e.issueTemplate?.trim()||pD],n=(e.skillPaths??``).split(`
|
|
84
84
|
`).map(e=>e.trim()).filter(Boolean);n.length&&t.push(`**Project skills & memory — MANDATORY reading before implementing.** This repo ships maintained skills/memory files. Read each of these paths in your checkout and treat their guidance as authoritative for design, style, and architectural decisions:\n${n.map(e=>`- \`${e}\``).join(`
|
|
85
85
|
`)}`),e.githubAssetsRepo?.trim()&&t.push(`**Demo media hosting:** commit demo GIFs/videos to the PUBLIC assets repo \`${e.githubAssetsRepo.trim()}\` under \`linear-grab/\` (clone it or use \`gh api\`), and embed the raw.githubusercontent.com URL in BOTH the Linear comment and the PR body. Prefer GIF for short demos — it renders inline everywhere (Linear, GitHub, the panel); Linear-hosted uploads do NOT render on GitHub.`);let r=[];e.testUsername?.trim()&&r.push(`- Username / email: \`${e.testUsername.trim()}\``),e.testPassword?.trim()&&r.push(`- Password: \`${e.testPassword.trim()}\``),r.length&&t.push(`**Test account — log into the app with this while testing:**\n${r.join(`
|
|
86
86
|
`)}`);let i=[];return e.slackToken&&e.slackChannelId&&i.push(`- Slack: bot token \`${e.slackToken}\`, channel \`${e.slackChannelId}\`${e.slackChannelName?` (#${e.slackChannelName})`:``}. Use \`chat.postMessage\` for the message and \`files.uploadV2\` (or getUploadURLExternal + completeUploadExternal) to upload the demo video into the channel.`),e.telegramToken&&e.telegramChatId&&i.push(`- Telegram: bot token \`${e.telegramToken}\`, chat id \`${e.telegramChatId}\`. Use \`sendMessage\` and \`sendVideo\` (multipart upload of the demo file).`),i.length&&t.push(`**When the fix is complete and the PR is open, announce it yourself:**\n${i.join(`
|
|
@@ -111,7 +111,7 @@ Summary (description field) → Steps to Reproduce (reproSteps) → Expected Beh
|
|
|
111
111
|
(analysisNotes, markdown bullets grounded in the provided source context) →
|
|
112
112
|
Suggested Next Steps (suggestedNextSteps, markdown bullets with concrete fixes).
|
|
113
113
|
The Summary is a short plain-prose paragraph — no headings inside it, no repetition
|
|
114
|
-
of the other sections.`,pD="- FIRST, self-orient in the repo checkout (skip any path that doesn't exist):\n 1. Read `CLAUDE.md` and `AGENTS.md` at the repo root — the master map of product rules, architecture, and memory/skill pointers.\n 2. Skim `.claude/memory/MEMORY.md` (the index) to learn what project memory exists; load the specific `.claude/memory/*.md` files the map names for the surface you're touching.\n 3. Load the matching `.claude/skills/<name>/SKILL.md` files before designing, building UI, or animating (if skills are symlinked, follow them into `.agents/skills/`).\n Treat all of this as authoritative — it overrides your defaults.\n- Use computer use to execute and test the change in the running app. Record a video demonstrating the fix and attach it to the PR.\n- Keep going until the code works and you're happy with the implementation.\n- Put up a PR, babysit it for the first set of review comments, and address them.\n- When the fix is verified: UPDATE THE LINEAR ISSUE — post a completion comment with a one-line fix summary + the PR link, attach the demo video to the issue itself (not only the PR), and move the issue to its review/done state."})),hD=r({describeAiError:()=>vD,executeDraft:()=>gD});async function gD(e,t,n){let r=await kx(e.tier);try{return await _D(r,e,t,n,!1)}catch(i){if(n.aborted)throw i;let a=await Ax(r.provider,e.tier);if(!a)throw Error(vD(i));try{return await _D(a,e,t,n,!0)}catch(e){throw Error(vD(e))}}}async function _D(e,t,n,r,i){let a=vT({model:e.model,schema:aD,system:fD,prompt:lD(t),abortSignal:r});for await(let e of a.partialObjectStream)n(e);return{draft:await a.object,provider:e.provider,modelId:e.modelId,fellBack:i}}function vD(e){let t=e instanceof Error?e.message:String(e);return/401|unauthorized|invalid.*key/i.test(t)?`AI provider rejected the API key.`:/429|rate/i.test(t)?`AI provider rate limit hit — try again shortly.`:`Draft failed: ${t}`}var yD=t((()=>{rD(),oD(),mD(),Nx()}));br(),Nx();function bD(e,t){return yr?xD(e,t):SD(e,t)}function xD(e,t){let n=chrome.runtime.connect({name:`ai-draft`}),r=!1;return n.onMessage.addListener(e=>{e.type===`partial`?t.onPartial(e.draft):e.type===`done`?(r=!0,t.onDone(e),n.disconnect()):e.type===`error`&&(r=!0,t.onError(e.message,e.code===`no-provider`?`no-provider`:`unknown`),n.disconnect())}),n.onDisconnect.addListener(()=>{r||t.onError(`Draft stream disconnected.`)}),n.postMessage({type:`start`,input:e}),()=>{try{n.disconnect()}catch{}}}function SD(e,t){let n=new AbortController;return(async()=>{let{executeDraft:r}=await Promise.resolve().then(()=>(yD(),hD));try{let i=await r(e,t.onPartial,n.signal);n.signal.aborted||t.onDone(i)}catch(e){if(n.signal.aborted)return;t.onError(e instanceof Error?e.message:String(e),e instanceof Mx?`no-provider`:`unknown`)}})(),()=>n.abort()}var CD=n((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>te,applyPalette:()=>S,default:()=>le,nearestColor:()=>O,nearestColorIndex:()=>E,nearestColorIndexWithDistance:()=>D,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],ee=0;for(let e=f;e<65536;e*=2)++ee;ee=8-ee,c.writeByte(p),D(x);let E=n.length;for(let e=1;e<E;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<ee^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}D(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,D(x))}return D(T),D(S),c.writeByte(0),c.bytesView();function D(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var ee=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=ee));w=T)y[w]=C;y[w]=x}var E=b-t;for(x=0;x<E;){for(var D;;){var O=y[1];if(D=d[O],D.tm>=D.mtm&&d[D.nn].mtm<=D.tm)break;D.mtm==_?O=y[1]=y[y[0]--]:(m(d,O,!1),D.tm=x);var ee=d[O].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(ee<=d[C=y[T]].err));w=T)y[w]=C;y[w]=O}var te=d[D.nn],k=D.cnt,A=te.cnt,S=1/(k+A);u&&(D.ac=S*(k*D.ac+A*te.ac)),D.rc=S*(k*D.rc+A*te.rc),D.gc=S*(k*D.gc+A*te.gc),D.bc=S*(k*D.bc+A*te.bc),D.cnt+=te.cnt,D.mtm=++x,d[te.bk].fw=te.fw,d[te.fw].bk=te.bk,te.mtm=_}let ne=[];var re=0;for(x=0;;++re){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(ne,c)||ne.push(c),(x=d[x].fw)==0)break}return ne}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=ee(l-r);if(u>o)continue;let d=c[0];if(u+=ee(d-e),u>o)continue;let f=c[1];if(u+=ee(f-t),u>o)continue;let p=c[2];u+=ee(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=ee(c-e);if(l>a)continue;let u=s[1];if(l+=ee(u-t),l>a)continue;let d=s[2];l+=ee(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=D(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function ee(e){return e*e}function E(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function O(e,t,n=y){return e[E(e,t,n)]}function te(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);A(a,t,n,m,g),re(a,m),h>=0&&ne(a,h)}let y=Math.round(p/10);k(a,_,y,o,f);let b=!!m&&!v;ie(a,t,n,b?m:null),b&&re(a,m),ae(a,e,t,n,g,s,c,l)}};function d(){se(a,`GIF89a`)}}function k(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),oe(e,n),e.writeByte(i||0),e.writeByte(0)}function A(e,t,n,r,i=8){let a=ce(r.length)-1,o=i-1<<4|128|a;oe(e,t),oe(e,n),e.writeBytes([o,0,0])}function ne(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),se(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),oe(e,t),e.writeByte(0)}function re(e,t){let n=1<<ce(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function ie(e,t,n,r){if(e.writeByte(44),oe(e,0),oe(e,0),oe(e,t),oe(e,n),r){let t=ce(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function ae(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function oe(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function se(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function ce(e){return Math.max(Math.ceil(Math.log2(e)),1)}var le=te}))(),wD="(function(){var e=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>A,applyPalette:()=>S,default:()=>B,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var A=d[O.nn],j=O.cnt,M=A.cnt,S=1/(j+M);u&&(O.ac=S*(j*O.ac+M*A.ac)),O.rc=S*(j*O.rc+M*A.rc),O.gc=S*(j*O.gc+M*A.gc),O.bc=S*(j*O.bc+M*A.bc),O.cnt+=A.cnt,O.mtm=++x,d[A.bk].fw=A.fw,d[A.fw].bk=A.bk,A.mtm=_}let N=[];var P=0;for(x=0;;++P){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(N,c)||N.push(c),(x=d[x].fw)==0)break}return N}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function A(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);M(a,t,n,m,g),P(a,m),h>=0&&N(a,h)}let y=Math.round(p/10);j(a,_,y,o,f);let b=!!m&&!v;F(a,t,n,b?m:null),b&&P(a,m),I(a,e,t,n,g,s,c,l)}};function d(){R(a,`GIF89a`)}}function j(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),L(e,n),e.writeByte(i||0),e.writeByte(0)}function M(e,t,n,r,i=8){let a=z(r.length)-1,o=i-1<<4|128|a;L(e,t),L(e,n),e.writeBytes([o,0,0])}function N(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),R(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),L(e,t),e.writeByte(0)}function P(e,t){let n=1<<z(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function F(e,t,n,r){if(e.writeByte(44),L(e,0),L(e,0),L(e,t),L(e,n),r){let t=z(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function I(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function L(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function R(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function z(e){return Math.max(Math.ceil(Math.log2(e)),1)}var B=A}))();let t=null,n=!0;self.onmessage=e=>{r(e.data).catch(t=>{e.data?.id!=null&&self.postMessage({id:e.data.id,type:`error`,message:t instanceof Error?t.message:String(t)})})};async function r(r){let a=(e,t=[])=>self.postMessage({id:r.id,...e},t);switch(r.type){case`encode-png`:{let e=r.bitmap,t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(`OffscreenCanvas 2d unavailable`);n.drawImage(e,0,0),e.close();let o=await t.convertToBlob({type:`image/png`});o.size>18e5&&(o=await t.convertToBlob({type:`image/jpeg`,quality:.85})),a({type:`png`,dataUrl:await i(o)});return}case`gif-init`:t=(0,e.GIFEncoder)(),n=!0,a({type:`ok`});return;case`gif-frame`:{if(!t)return;let i=new Uint8ClampedArray(r.buffer),a=(0,e.quantize)(i,256,{format:`rgb565`}),o=(0,e.applyPalette)(i,a,`rgb565`);t.writeFrame(o,r.width,r.height,{palette:a,delay:r.delay,first:n,repeat:0}),n=!1;return}case`gif-finish`:{if(!t)throw Error(`No active GIF session`);t.finish();let e=t.bytes();t=null,a({type:`gif`,buffer:e.buffer},[e.buffer]);return}case`gif-abort`:t=null;return}}function i(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}})();",TD=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,wD],{type:`text/javascript;charset=utf-8`});function ED(e){let t;try{if(t=TD&&(self.URL||self.webkitURL).createObjectURL(TD),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(wD),{name:e?.name})}}var DD,OD=1,kD=new Map;function AD(){if(DD!==void 0)return DD;try{DD=new ED,DD.onmessage=e=>{let t=e.data?.id;if(t==null)return;let n=kD.get(t);n&&(kD.delete(t),e.data.type===`error`?n.reject(Error(e.data.message??`Worker error`)):n.resolve(e.data))},DD.onerror=()=>{for(let e of kD.values())e.reject(Error(`Image worker crashed`));kD.clear()}}catch{DD=null}return DD}function jD(e,t=[]){let n=AD();if(!n)return Promise.reject(Error(`Image worker unavailable`));let r=OD++;return new Promise((i,a)=>{kD.set(r,{resolve:i,reject:a}),n.postMessage({...e,id:r},t)})}function MD(e,t=[]){let n=AD();return n?(n.postMessage(e,t),!0):!1}var ND=6,PD=Math.round(1e3/ND),FD=3e4,ID=640,LD={phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0},RD=new Set;function zD(e){LD={...LD,...e};for(let e of RD)e(LD)}function BD(){return LD}function VD(e){return RD.add(e),()=>RD.delete(e)}var HD=null,UD=null,WD=null,GD=null,KD=null,qD=null,JD=!1,YD=0,XD=!0;async function ZD(){if(LD.phase===`recording`||LD.phase===`processing`)return;$D();try{HD=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:ND},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`,surfaceSwitching:`exclude`,monitorTypeSurfaces:`exclude`,systemAudio:`exclude`})}catch{zD({phase:`error`,error:`Screen capture was denied or cancelled.`});return}let e=HD.getVideoTracks()[0];if(!e){zD({phase:`error`,error:`No video track available.`}),nO();return}e.addEventListener(`ended`,()=>void QD()),UD=document.createElement(`video`),UD.muted=!0,UD.playsInline=!0,UD.srcObject=HD,await UD.play().catch(()=>{});let t=Date.now()+3e3;for(;!UD.videoWidth&&Date.now()<t;)await new Promise(e=>setTimeout(e,50));if(!UD.videoWidth){zD({phase:`error`,error:`Could not read the capture stream.`}),nO();return}let n=Math.min(1,ID/UD.videoWidth),r=Math.round(UD.videoWidth*n),i=Math.round(UD.videoHeight*n);if(WD=document.createElement(`canvas`),WD.width=r,WD.height=i,GD=WD.getContext(`2d`,{willReadFrequently:!0}),!GD){zD({phase:`error`,error:`Canvas is unavailable.`}),nO();return}JD=await jD({type:`gif-init`}).then(()=>!0,()=>!1),qD=JD?null:(0,CD.GIFEncoder)(),YD=0,XD=!0,zD({phase:`recording`,startedAt:Date.now(),error:null,result:null}),KD=setInterval(()=>{if(!GD||!UD||!WD)return;let e=LD.startedAt??Date.now();if(Date.now()-e>=FD){QD();return}try{GD.drawImage(UD,0,0,WD.width,WD.height);let{data:e}=GD.getImageData(0,0,WD.width,WD.height);if(JD)MD({type:`gif-frame`,buffer:e.buffer,width:WD.width,height:WD.height,delay:PD},[e.buffer]);else if(qD){let t=(0,CD.quantize)(e,256,{format:`rgb565`}),n=(0,CD.applyPalette)(e,t,`rgb565`);qD.writeFrame(n,WD.width,WD.height,{palette:t,delay:PD,first:XD,repeat:0}),XD=!1}YD++}catch{}},PD)}async function QD(){if(LD.phase!==`recording`)return;let e=LD.startedAt??Date.now();zD({phase:`processing`}),KD&&=(clearInterval(KD),null);let t=WD?.width??0,n=WD?.height??0,r=YD,i=qD,a=JD;if(qD=null,JD=!1,nO(),!i&&!a||r===0){zD({phase:`error`,error:`Nothing was captured.`});return}try{let o;if(a){let e=await jD({type:`gif-finish`});o=new Uint8Array(e.buffer)}else i.finish(),o=i.bytes();let s=new Blob([o.buffer],{type:`image/gif`});zD({phase:`ready`,result:{blob:s,url:URL.createObjectURL(s),width:t,height:n,frameCount:r,durationMs:Date.now()-e}})}catch(e){zD({phase:`error`,error:e instanceof Error?e.message:`GIF encoding failed.`})}}function $D(){LD.result?.url&&URL.revokeObjectURL(LD.result.url),nO(),KD&&=(clearInterval(KD),null),JD&&MD({type:`gif-abort`}),JD=!1,qD=null,YD=0,zD({phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0})}function eO(e){zD({attachOnCreate:e})}function tO(e){LD.result&&zD({result:{...LD.result,assetUrl:e}})}function nO(){HD?.getTracks().forEach(e=>e.stop()),HD=null,UD&&=(UD.srcObject=null,null),WD=null,GD=null}Rr();var rO=`https://api.linear.app/graphql`,iO=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`LinearError`}},aO=class extends iO{constructor(){super(`Not connected to Linear. Add an API key or connect OAuth in Settings.`),this.name=`LinearNotConnectedError`}};async function oO(e,t){let{linearApiKey:n,linearAccessToken:r}=await Cr(),i=r?`Bearer ${r}`:n;if(!i)throw new aO;let a=await fetch(rO,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:i},body:JSON.stringify({query:e,variables:t})}),o=await a.json().catch(()=>null);if(!a.ok)throw new iO(o?.errors?.[0]?.message??`Linear request failed (${a.status})`,a.status);if(o?.errors?.length)throw new iO(o.errors[0].message);if(!o?.data)throw new iO(`Empty response from Linear`);return o.data}async function sO(){return(await oO(`query { viewer { id name email } }`)).viewer}async function cO(){return(await oO(`query { teams(first: 50) { nodes { id key name } } }`)).teams.nodes}async function lO(){return(await oO(`query {
|
|
114
|
+
of the other sections.`,pD="- FIRST, self-orient in the repo checkout (skip any path that doesn't exist):\n 1. Read `CLAUDE.md` and `AGENTS.md` at the repo root — the master map of product rules, architecture, and memory/skill pointers.\n 2. Skim `.claude/memory/MEMORY.md` (the index) to learn what project memory exists; load the specific `.claude/memory/*.md` files the map names for the surface you're touching.\n 3. Load the matching `.claude/skills/<name>/SKILL.md` files before designing, building UI, or animating (if skills are symlinked, follow them into `.agents/skills/`).\n Treat all of this as authoritative — it overrides your defaults.\n- Use computer use to execute and test the change in the running app. Record a video demonstrating the fix and attach it to the PR.\n- Keep going until the code works and you're happy with the implementation.\n- Put up a PR, babysit it for the first set of review comments, and address them.\n- When the fix is verified: UPDATE THE LINEAR ISSUE — post a completion comment with a one-line fix summary + the PR link, attach the demo video to the issue itself (not only the PR), and move the issue to its review/done state."})),hD=r({describeAiError:()=>vD,executeDraft:()=>gD});async function gD(e,t,n){let r=await kx(e.tier);try{return await _D(r,e,t,n,!1)}catch(i){if(n.aborted)throw i;let a=await Ax(r.provider,e.tier);if(!a)throw Error(vD(i));try{return await _D(a,e,t,n,!0)}catch(e){throw Error(vD(e))}}}async function _D(e,t,n,r,i){let a=vT({model:e.model,schema:aD,system:fD,prompt:lD(t),abortSignal:r});for await(let e of a.partialObjectStream)n(e);return{draft:await a.object,provider:e.provider,modelId:e.modelId,fellBack:i}}function vD(e){let t=e instanceof Error?e.message:String(e);return/401|unauthorized|invalid.*key/i.test(t)?`AI provider rejected the API key.`:/429|rate/i.test(t)?`AI provider rate limit hit — try again shortly.`:`Draft failed: ${t}`}var yD=t((()=>{rD(),oD(),mD(),Nx()}));br(),Nx();function bD(e,t){return yr?xD(e,t):SD(e,t)}function xD(e,t){let n=chrome.runtime.connect({name:`ai-draft`}),r=!1;return n.onMessage.addListener(e=>{e.type===`partial`?t.onPartial(e.draft):e.type===`done`?(r=!0,t.onDone(e),n.disconnect()):e.type===`error`&&(r=!0,t.onError(e.message,e.code===`no-provider`?`no-provider`:`unknown`),n.disconnect())}),n.onDisconnect.addListener(()=>{r||t.onError(`Draft stream disconnected.`)}),n.postMessage({type:`start`,input:e}),()=>{try{n.disconnect()}catch{}}}function SD(e,t){let n=new AbortController;return(async()=>{let{executeDraft:r}=await Promise.resolve().then(()=>(yD(),hD));try{let i=await r(e,t.onPartial,n.signal);n.signal.aborted||t.onDone(i)}catch(e){if(n.signal.aborted)return;t.onError(e instanceof Error?e.message:String(e),e instanceof Mx?`no-provider`:`unknown`)}})(),()=>n.abort()}var CD=n((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>ee,applyPalette:()=>S,default:()=>le,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var ee=d[O.nn],te=O.cnt,A=ee.cnt,S=1/(te+A);u&&(O.ac=S*(te*O.ac+A*ee.ac)),O.rc=S*(te*O.rc+A*ee.rc),O.gc=S*(te*O.gc+A*ee.gc),O.bc=S*(te*O.bc+A*ee.bc),O.cnt+=ee.cnt,O.mtm=++x,d[ee.bk].fw=ee.fw,d[ee.fw].bk=ee.bk,ee.mtm=_}let ne=[];var re=0;for(x=0;;++re){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(ne,c)||ne.push(c),(x=d[x].fw)==0)break}return ne}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function ee(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);A(a,t,n,m,g),re(a,m),h>=0&&ne(a,h)}let y=Math.round(p/10);te(a,_,y,o,f);let b=!!m&&!v;ie(a,t,n,b?m:null),b&&re(a,m),ae(a,e,t,n,g,s,c,l)}};function d(){se(a,`GIF89a`)}}function te(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),oe(e,n),e.writeByte(i||0),e.writeByte(0)}function A(e,t,n,r,i=8){let a=ce(r.length)-1,o=i-1<<4|128|a;oe(e,t),oe(e,n),e.writeBytes([o,0,0])}function ne(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),se(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),oe(e,t),e.writeByte(0)}function re(e,t){let n=1<<ce(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function ie(e,t,n,r){if(e.writeByte(44),oe(e,0),oe(e,0),oe(e,t),oe(e,n),r){let t=ce(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function ae(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function oe(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function se(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function ce(e){return Math.max(Math.ceil(Math.log2(e)),1)}var le=ee}))(),wD="(function(){var e=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>A,applyPalette:()=>S,default:()=>B,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var A=d[O.nn],j=O.cnt,M=A.cnt,S=1/(j+M);u&&(O.ac=S*(j*O.ac+M*A.ac)),O.rc=S*(j*O.rc+M*A.rc),O.gc=S*(j*O.gc+M*A.gc),O.bc=S*(j*O.bc+M*A.bc),O.cnt+=A.cnt,O.mtm=++x,d[A.bk].fw=A.fw,d[A.fw].bk=A.bk,A.mtm=_}let N=[];var P=0;for(x=0;;++P){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(N,c)||N.push(c),(x=d[x].fw)==0)break}return N}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function A(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);M(a,t,n,m,g),P(a,m),h>=0&&N(a,h)}let y=Math.round(p/10);j(a,_,y,o,f);let b=!!m&&!v;F(a,t,n,b?m:null),b&&P(a,m),I(a,e,t,n,g,s,c,l)}};function d(){R(a,`GIF89a`)}}function j(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),L(e,n),e.writeByte(i||0),e.writeByte(0)}function M(e,t,n,r,i=8){let a=z(r.length)-1,o=i-1<<4|128|a;L(e,t),L(e,n),e.writeBytes([o,0,0])}function N(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),R(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),L(e,t),e.writeByte(0)}function P(e,t){let n=1<<z(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function F(e,t,n,r){if(e.writeByte(44),L(e,0),L(e,0),L(e,t),L(e,n),r){let t=z(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function I(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function L(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function R(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function z(e){return Math.max(Math.ceil(Math.log2(e)),1)}var B=A}))();let t=null,n=!0;self.onmessage=e=>{r(e.data).catch(t=>{e.data?.id!=null&&self.postMessage({id:e.data.id,type:`error`,message:t instanceof Error?t.message:String(t)})})};async function r(r){let a=(e,t=[])=>self.postMessage({id:r.id,...e},t);switch(r.type){case`encode-png`:{let e=r.bitmap,t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(`OffscreenCanvas 2d unavailable`);n.drawImage(e,0,0),e.close();let o=await t.convertToBlob({type:`image/png`});o.size>18e5&&(o=await t.convertToBlob({type:`image/jpeg`,quality:.85})),a({type:`png`,dataUrl:await i(o)});return}case`gif-init`:t=(0,e.GIFEncoder)(),n=!0,a({type:`ok`});return;case`gif-frame`:{if(!t)return;let i=new Uint8ClampedArray(r.buffer),a=(0,e.quantize)(i,256,{format:`rgb565`}),o=(0,e.applyPalette)(i,a,`rgb565`);t.writeFrame(o,r.width,r.height,{palette:a,delay:r.delay,first:n,repeat:0}),n=!1;return}case`gif-finish`:{if(!t)throw Error(`No active GIF session`);t.finish();let e=t.bytes();t=null,a({type:`gif`,buffer:e.buffer},[e.buffer]);return}case`gif-abort`:t=null;return}}function i(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}})();",TD=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,wD],{type:`text/javascript;charset=utf-8`});function ED(e){let t;try{if(t=TD&&(self.URL||self.webkitURL).createObjectURL(TD),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(wD),{name:e?.name})}}var DD,OD=1,kD=new Map;function AD(){if(DD!==void 0)return DD;try{DD=new ED,DD.onmessage=e=>{let t=e.data?.id;if(t==null)return;let n=kD.get(t);n&&(kD.delete(t),e.data.type===`error`?n.reject(Error(e.data.message??`Worker error`)):n.resolve(e.data))},DD.onerror=()=>{for(let e of kD.values())e.reject(Error(`Image worker crashed`));kD.clear()}}catch{DD=null}return DD}function jD(e,t=[]){let n=AD();if(!n)return Promise.reject(Error(`Image worker unavailable`));let r=OD++;return new Promise((i,a)=>{kD.set(r,{resolve:i,reject:a}),n.postMessage({...e,id:r},t)})}function MD(e,t=[]){let n=AD();return n?(n.postMessage(e,t),!0):!1}var ND=6,PD=Math.round(1e3/ND),FD=3e4,ID=640,LD={phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0},RD=new Set;function zD(e){LD={...LD,...e};for(let e of RD)e(LD)}function BD(){return LD}function VD(e){return RD.add(e),()=>RD.delete(e)}var HD=null,UD=null,WD=null,GD=null,KD=null,qD=null,JD=!1,YD=0,XD=!0;async function ZD(){if(LD.phase===`recording`||LD.phase===`processing`)return;$D();try{HD=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:ND},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`,surfaceSwitching:`exclude`,monitorTypeSurfaces:`exclude`,systemAudio:`exclude`})}catch{zD({phase:`error`,error:`Screen capture was denied or cancelled.`});return}let e=HD.getVideoTracks()[0];if(!e){zD({phase:`error`,error:`No video track available.`}),nO();return}e.addEventListener(`ended`,()=>void QD()),UD=document.createElement(`video`),UD.muted=!0,UD.playsInline=!0,UD.srcObject=HD,await UD.play().catch(()=>{});let t=Date.now()+3e3;for(;!UD.videoWidth&&Date.now()<t;)await new Promise(e=>setTimeout(e,50));if(!UD.videoWidth){zD({phase:`error`,error:`Could not read the capture stream.`}),nO();return}let n=Math.min(1,ID/UD.videoWidth),r=Math.round(UD.videoWidth*n),i=Math.round(UD.videoHeight*n);if(WD=document.createElement(`canvas`),WD.width=r,WD.height=i,GD=WD.getContext(`2d`,{willReadFrequently:!0}),!GD){zD({phase:`error`,error:`Canvas is unavailable.`}),nO();return}JD=await jD({type:`gif-init`}).then(()=>!0,()=>!1),qD=JD?null:(0,CD.GIFEncoder)(),YD=0,XD=!0,zD({phase:`recording`,startedAt:Date.now(),error:null,result:null}),KD=setInterval(()=>{if(!GD||!UD||!WD)return;let e=LD.startedAt??Date.now();if(Date.now()-e>=FD){QD();return}try{GD.drawImage(UD,0,0,WD.width,WD.height);let{data:e}=GD.getImageData(0,0,WD.width,WD.height);if(JD)MD({type:`gif-frame`,buffer:e.buffer,width:WD.width,height:WD.height,delay:PD},[e.buffer]);else if(qD){let t=(0,CD.quantize)(e,256,{format:`rgb565`}),n=(0,CD.applyPalette)(e,t,`rgb565`);qD.writeFrame(n,WD.width,WD.height,{palette:t,delay:PD,first:XD,repeat:0}),XD=!1}YD++}catch{}},PD)}async function QD(){if(LD.phase!==`recording`)return;let e=LD.startedAt??Date.now();zD({phase:`processing`}),KD&&=(clearInterval(KD),null);let t=WD?.width??0,n=WD?.height??0,r=YD,i=qD,a=JD;if(qD=null,JD=!1,nO(),!i&&!a||r===0){zD({phase:`error`,error:`Nothing was captured.`});return}try{let o;if(a){let e=await jD({type:`gif-finish`});o=new Uint8Array(e.buffer)}else i.finish(),o=i.bytes();let s=new Blob([o.buffer],{type:`image/gif`});zD({phase:`ready`,result:{blob:s,url:URL.createObjectURL(s),width:t,height:n,frameCount:r,durationMs:Date.now()-e}})}catch(e){zD({phase:`error`,error:e instanceof Error?e.message:`GIF encoding failed.`})}}function $D(){LD.result?.url&&URL.revokeObjectURL(LD.result.url),nO(),KD&&=(clearInterval(KD),null),JD&&MD({type:`gif-abort`}),JD=!1,qD=null,YD=0,zD({phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0})}function eO(e){zD({attachOnCreate:e})}function tO(e){LD.result&&zD({result:{...LD.result,assetUrl:e}})}function nO(){HD?.getTracks().forEach(e=>e.stop()),HD=null,UD&&=(UD.srcObject=null,null),WD=null,GD=null}Rr();var rO=`https://api.linear.app/graphql`,iO=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`LinearError`}},aO=class extends iO{constructor(){super(`Not connected to Linear. Add an API key or connect OAuth in Settings.`),this.name=`LinearNotConnectedError`}};async function oO(e,t){let{linearApiKey:n,linearAccessToken:r}=await Cr(),i=r?`Bearer ${r}`:n;if(!i)throw new aO;let a=await fetch(rO,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:i},body:JSON.stringify({query:e,variables:t})}),o=await a.json().catch(()=>null);if(!a.ok)throw new iO(o?.errors?.[0]?.message??`Linear request failed (${a.status})`,a.status);if(o?.errors?.length)throw new iO(o.errors[0].message);if(!o?.data)throw new iO(`Empty response from Linear`);return o.data}async function sO(){return(await oO(`query { viewer { id name email } }`)).viewer}async function cO(){return(await oO(`query { teams(first: 50) { nodes { id key name } } }`)).teams.nodes}async function lO(){return(await oO(`query {
|
|
115
115
|
users(filter: { app: { eq: true } }) {
|
|
116
116
|
nodes { id name displayName url active }
|
|
117
117
|
}
|
|
@@ -177,12 +177,12 @@ 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),E(()=>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`),E(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})()})),E(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),E(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),E(n=>{var r=`bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class??``}`,i=e.color?{color:e.color}:void 0;return r!==n.e&&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 E(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=O(()=>n.data??{}),i=O(()=>t.data?.[0]??null),a=O(()=>!!(r().linearApiKey||r().linearAccessToken)),o=O(()=>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),[ee,te]=T(r().defaultTeamId??``),[k,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);D(()=>{let e=setInterval(()=>me(ek().length),3e3);ae(()=>clearInterval(e))});let[he,ge]=T(``);D(()=>{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;D(()=>{let e=n.data;De||!e||(De=!0,te(e.defaultTeamId??``),A(e.defaultRepo??``),re(e.cursorAgentId?`cursor`:`none`))});let Oe=_r(()=>({queryKey:[`teams`],queryFn:cO,enabled:a()})),ke=O(()=>(Oe.data??[]).find(e=>e.id===ee())?.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
|
-
`)||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:
|
|
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
|
|
|
184
|
-
### Attachments`:``}\n`}catch{n.push(`pasted image ${t+1}`)}if(de()){let t=tk(30);t&&(e+=`\n\n### Console errors (client)\n\`\`\`\n${t}\n\`\`\``)}if(r().logUrl&&Te())try{let t=await qO(r());if(t){let n=Math.min(500,Math.max(10,r().logLines??100));e+=`\n\n### Dev server logs (last ${n} lines)\n\`\`\`\n${t}\n\`\`\``}}catch{n.push(`server logs (fetch failed — is the Log URL serving the file?)`)}if(n.length){let e=n.some(e=>!e.startsWith(`server logs`));Je(`Skipped: ${n.join(`, `)} — issue created without ${n.length>1?`them`:`it`}.${e?" Real fix for uploads: run `npx linear-grab-bridge` in the repo (uploads relay through it) or set the GitHub fallback in Settings.":``}`)}let c=await gO({teamId:
|
|
185
|
-
`);await kO(`${c.identifier} — ${s()}`,le()?`${t}\n\nNote: you are running in an ISOLATED git worktree on a dedicated branch (already checked out) — commit and push THAT branch for the PR; do not switch back to main.`:t,{model:ie()||void 0,permissionMode:`bypassPermissions`,worktree:le(),env:r().linearApiKey?{LINEAR_API_KEY:r().linearApiKey}:void 0}),u=!0;try{let e=(await mO(ee())).filter(e=>e.type===`started`).sort((e,t)=>e.position-t.position)[0];e&&await hO(c.id,e.id)}catch{}await _O(c.id,`🖥️ Delegated to **local Claude Code** on this machine (Linear Grab bridge). Live status, conversation, and steering in the panel's Local tab. The agent will post its fix summary + PR here and move this issue to review when done.`).catch(()=>{})}catch{Je("Issue created, but the local bridge is unreachable — run `npx linear-grab-bridge` in the repo and re-delegate from the Local tab.")}let f=await UO(r(),{identifier:c.identifier,title:s(),url:c.url,summary:l(),impact:_(),repo:k()||r().defaultRepo,demoUrl:BD().result?.assetUrl,executor:ne()});return f.length&&Je(`${f.join(` + `)} announcement failed — check the token/channel in Settings.`),{...c,localTask:u}},onSuccess:e=>{Xe({identifier:e.identifier,url:e.url}),Ke(null),Fe(null),xe([]),$D(),e.localTask&&YA(`local`)},onError:e=>{Ke(e.message)}})),Qe=O(()=>!!s().trim()&&!!ee()&&a()),et=O(()=>{let e=o();return e?jx[e][Ce()]:null}),tt=()=>f(e=>[...e,``]),nt=e=>f(t=>t.filter((t,n)=>n!==e)),N=(e,t)=>f(n=>n.map((n,r)=>r===e?t:n));return(()=>{var n=rM(),f=n.firstChild,T=f.firstChild.firstChild.nextSibling,D=f.nextSibling;return P(T,j(M,{get when(){return i()},get fallback(){return j(Oj,{class:`text-text-faint`,children:`No element`})},get children(){return j(Oj,{class:`text-accent max-w-full`,get children(){var e=Pj();return P(e,(()=>{var e=$e(()=>!!i().componentName);return()=>e()?`<${i().componentName}>`:i().source?.filePath?.split(`/`).pop()??`element`})()),e}})}}),null),P(T,j(M,{get when(){return i()?.screenshotDataUrl},get children(){return j(Oj,{class:`text-success`,children:`screenshot ✓`})}}),null),P(T,j(M,{get when(){return Be().result},get children(){return j(Oj,{get class(){return Be().attachOnCreate?`text-success`:`text-text-faint`},get children(){return[`gif `,$e(()=>(Be().result.durationMs/1e3).toFixed(0)),`s`,$e(()=>Be().attachOnCreate?` ✓`:` (off)`)]}})}}),null),P(T,j(M,{get when(){return(t.data?.length??0)>1},get children(){return j(Oj,{get children(){return[`+`,$e(()=>t.data.length-1),` more`]}})}}),null),P(T,j(M,{get when(){return Be().phase===`recording`},get children(){return j(Oj,{class:`text-danger`,children:`● recording…`})}}),null),P(f,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Manage in the Capture tab — elements, screenshots, recording`,"aria-label":`Open Capture tab`,onClick:()=>YA(`capture`),get children(){return Fj()}}),null),P(n,j(Dj,{title:`AI draft`,get children(){return[j(Ej,{label:`Your note`,get children(){return j(xj,{rows:3,placeholder:`Describe the problem or change in your own words… (paste screenshots here too)`,get value(){return ve()},onInput:e=>ye(e.currentTarget.value),onPaste:Se})}}),j(M,{get when(){return be().length>0},get children(){var e=Ij(),t=e.firstChild;return P(e,j(We,{get each(){return be()},children:e=>(()=>{var t=iM(),n=t.firstChild,r=n.nextSibling;return r.$$click=()=>xe(t=>t.filter(t=>t.id!==e.id)),E(()=>it(n,`src`,e.dataUrl)),t})()}),t),e}}),(()=>{var e=Lj(),t=e.firstChild.nextSibling;return P(t,()=>[`fast`,`best`].map(e=>(()=>{var t=aM();return t.$$click=()=>we(e),P(t,e===`fast`?`Fast`:`Best`),E(()=>st(t,`h-6 px-2.5 text-[11px] font-medium transition-colors cursor-pointer ${Ce()===e?`bg-accent text-white`:`bg-surface-2 text-text-dim hover:text-text`}`)),t})())),e})(),(()=>{var e=Bj();return P(e,j(M,{get when(){return o()},get fallback(){return j(vj,{variant:`ghost`,class:`w-full opacity-60 cursor-default`,disabled:!1,children:`Add an AI key in Settings`})},get children(){return j(vj,{variant:`primary`,class:`w-full`,get loading(){return Ae()},onClick:ze,get disabled(){return Ae()},children:`Draft with AI`})}}),null),P(e,j(M,{get when(){return et()},get children(){var e=zj();return P(e,j(Oj,{get children(){var e=Rj();return P(e,et),e}})),e}}),null),e})(),j(M,{get when(){return Pe()},get children(){var e=Vj(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return n.nextSibling,P(t,()=>Pe().provider),P(e,()=>Pe().modelId,n),e}}),j(M,{get when(){return Me()},get children(){return j(jj,{get message(){return Me()}})}})]}}),D),P(n,j(Dj,{title:`Issue`,get children(){return[j(Ej,{label:`Title`,get children(){return j(bj,{class:`h-8 text-[13px] font-medium`,get value(){return s()},onInput:e=>c(e.currentTarget.value),placeholder:`Brief summary of the issue`})}}),j(M,{get when(){return(_e.data??[]).length>0},get children(){var e=Hj();return e.firstChild,P(e,j(We,{get each(){return _e.data.slice(0,3)},children:e=>(()=>{var t=oM(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.identifier),P(r,()=>e.title),P(t,j(Oj,{class:`ml-auto shrink-0`,get children(){return e.state.name}}),null),E(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),j(Ej,{label:`Description`,get children(){return j(xj,{rows:6,get value(){return l()},onInput:e=>u(e.currentTarget.value),placeholder:`Markdown supported`})}}),j(Ej,{label:`Reproduction steps`,get children(){var e=Uj();return P(e,j(Ge,{get each(){return d()},children:(e,t)=>(()=>{var n=sM(),r=n.firstChild,i=r.firstChild,a=r.nextSibling;return P(r,t+1,i),P(n,j(bj,{class:`flex-1`,get value(){return e()},onInput:e=>N(t,e.currentTarget.value),placeholder:`Step ${t+1}`}),a),a.$$click=()=>nt(t),n})()}),null),P(e,j(vj,{variant:`ghost`,class:`self-start h-6 px-2 text-[11px]`,onClick:tt,children:`+ Add step`}),null),e}}),j(Ej,{label:`Expected`,get children(){return j(xj,{rows:2,get value(){return p()},onInput:e=>m(e.currentTarget.value),placeholder:`What should happen`})}}),j(Ej,{label:`Actual`,get children(){return j(xj,{rows:2,get value(){return h()},onInput:e=>g(e.currentTarget.value),placeholder:`What actually happens`})}}),j(Ej,{label:`Impact`,get children(){return j(xj,{rows:2,get value(){return _()},onInput:e=>v(e.currentTarget.value),placeholder:`Who/what is affected and how badly`})}}),j(Ej,{label:`Analysis / Notes`,get children(){return j(xj,{rows:3,get value(){return y()},onInput:e=>b(e.currentTarget.value),placeholder:`- Likely root cause…`})}}),j(Ej,{label:`Suggested next steps`,get children(){return j(xj,{rows:3,get value(){return x()},onInput:e=>S(e.currentTarget.value),placeholder:`- Concrete fix suggestion…`})}}),j(Ej,{label:`Priority`,get children(){return j(Sj,{get value(){return C()},onChange:e=>w(Number(e.currentTarget.value)),get children(){return j(We,{get each(){return Object.entries(Mj)},children:([e,t])=>(()=>{var n=cM();return n.value=e,P(n,t),n})()})}})}}),j(M,{get when(){return a()},get fallback(){return j(jj,{message:`Connect Linear in Settings to create issues.`})},get children(){return j(Ej,{label:`Team`,get children(){return j(M,{get when(){return!Oe.isLoading},get fallback(){return j(Sj,{disabled:!0,get children(){return lM()}})},get children(){return j(Sj,{get value(){return ee()},onChange:e=>te(e.currentTarget.value),get children(){return[Wj(),j(We,{get each(){return Oe.data??[]},children:e=>(()=>{var t=cM();return P(t,()=>e.name),E(()=>t.selected=e.id===ee()),E(()=>t.value=e.id),t})()})]}})}})}})}}),j(Ej,{label:`Repo`,hint:`Appended as [repo=…] so Cursor works in the right repository.`,get children(){return j(bj,{get value(){return k()},onInput:e=>A(e.currentTarget.value),placeholder:`owner/repository`})}}),j(Ej,{label:`Delegate to`,get hint(){return $e(()=>ne()===`local`)()?"Requires `npx linear-grab-bridge` running in the repo — track it in the Local tab.":ne()===`cursor`&&!r().cursorAgentId?`Pick the Cursor agent in Settings first.`:void 0},get children(){return j(Sj,{get value(){return ne()},onChange:e=>re(e.currentTarget.value),get children(){return[(()=>{var e=Gj(),t=e.firstChild;return P(e,()=>r().cursorAgentName??`Cursor`,t),E(t=>{var n=!r().cursorAgentId,i=ne()===`cursor`;return n!==t.e&&(e.disabled=t.e=n),i!==t.t&&(e.selected=t.t=i),t},{e:void 0,t:void 0}),e})(),(()=>{var e=Kj();return E(()=>e.selected=ne()===`local`),e})(),(()=>{var e=qj();return E(()=>e.selected=ne()===`none`),e})()]}})}}),j(M,{get when(){return ne()===`cursor`},get children(){return j(Ej,{label:`Cloud model`,get hint(){return`Sent as [model=…]. Empty = ${r().cursorModel?`your default (${r().cursorModel})`:`Cursor's default`}.`},get children(){return j(bj,{get placeholder(){return r().cursorModel||`Cursor's default — e.g. claude-opus-4-8, composer`},get value(){return se()},onInput:e=>ce(e.currentTarget.value)})}})}}),j(M,{get when(){return ne()===`local`},get children(){return[j(Ej,{label:`Local model`,hint:`Switchable while running from the Local tab.`,get children(){return j(Sj,{get value(){return ie()},onChange:e=>oe(e.currentTarget.value),get children(){return[(()=>{var e=Jj();return E(()=>e.selected=ie()===``),e})(),(()=>{var e=Yj();return E(()=>e.selected=ie()===`fable`),e})(),(()=>{var e=Xj();return E(()=>e.selected=ie()===`opus`),e})(),(()=>{var e=Zj();return E(()=>e.selected=ie()===`sonnet`),e})(),(()=>{var e=Qj();return E(()=>e.selected=ie()===`haiku`),e})()]}})}}),(()=>{var e=$j(),t=e.firstChild;return t.addEventListener(`change`,e=>ue(e.currentTarget.checked)),E(()=>t.checked=le()),e})()]}}),j(M,{get when(){return pe()>0},get children(){var e=eM(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,r=n.firstChild.nextSibling;return r.nextSibling,t.addEventListener(`change`,e=>fe(e.currentTarget.checked)),P(n,pe,r),E(()=>t.checked=de()),e}}),j(M,{get when(){return r().logUrl},get children(){var e=tM(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,i=n.firstChild.nextSibling;return i.nextSibling,t.addEventListener(`change`,e=>Ee(e.currentTarget.checked)),P(n,()=>Math.min(500,Math.max(10,r().logLines??100)),i),E(()=>t.checked=Te()),e}})]}}),D),P(D,j(M,{get when(){return Ue()},get children(){return j(jj,{get message(){return Ue()}})}}),null),P(D,j(M,{get when(){return qe()},get children(){var e=nM();return P(e,qe),e}}),null),P(D,j(M,{get when(){return Ye()},children:t=>(()=>{var n=uM(),r=n.firstChild;return P(r,()=>t().identifier),P(n,j(vj,{variant:`ghost`,class:`h-6 px-2 text-[11px]`,onClick:()=>{Xe(null),Fe(null),e.onCreated()},children:`View activity`}),null),E(()=>it(r,`href`,t().url)),n})()}),null),P(D,j(vj,{variant:`primary`,get loading(){return Ze.isPending},get disabled(){return!Qe()},onClick:()=>Ze.mutate(),children:`Create issue`}),null),n})()}rt([`click`]);function fM(e,t,n=!1){if(!e)return null;let r=t(e);if(r instanceof Promise)return(async()=>{if(await r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=await YN(i,t,n);if(e)return e;i=n?null:i.sibling}return null})();if(r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=JN(i,t,n);if(e)return e;i=n?null:i.sibling}return null}function pM(e,t){let n=0,r=0,i=0;do i=yP[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function mM(e,t){return e.pos>=t?!1:e.peek()!==gP}function hM(e){let{length:t}=e,n=new bP(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=pM(n,i),i<u&&(l=!1),u=i,mM(n,e)?(a=pM(n,a),o=pM(n,o),s=pM(n,s),mM(n,e)?(c=pM(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||gM(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function gM(e){e.sort(_M)}function _M(e,t){return e[0]-t[0]}var vM,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,JM,YM,XM,ZM,QM,$M,eN,tN,nN,rN,iN,aN,oN,sN,cN,lN,uN,dN,fN,pN,mN,hN,gN,_N,vN,yN,bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,YN,XN,ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,fP,pP,mP,hP,gP,_P,vP,yP,bP,xP,SP,CP,wP,TP,EP,DP,OP,kP,AP,jP,MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,JP,YP,XP,ZP,QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,MF,NF,PF,FF,IF,LF,RF,zF,BF,VF,HF,UF,WF,GF,KF,qF,JF,YF,XF,ZF,QF,$F,eI,tI,nI,rI,iI,aI,oI,sI,cI,lI,uI,dI,fI,pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,wI,TI,EI,DI,OI,kI,AI,jI,MI,NI,PI,FI,II,LI,RI,zI,BI,VI,HI,UI,WI,GI,KI,qI,JI,YI,XI,ZI,QI,$I,eL,tL,nL,rL,iL,aL,oL,sL,cL,lL,uL,dL,fL,pL,mL,hL,gL,_L,vL,yL,bL,xL,SL,CL,wL,TL,EL,DL,OL,kL,AL,jL,ML,NL,PL,FL,IL,LL,RL,zL,BL,VL,HL,UL,WL,GL,KL,qL,JL,YL,XL,ZL,QL,$L,eR=t((()=>{vM=null,yM=()=>{if(vM!==null)return vM;try{vM=window.matchMedia(`(color-gamut: p3)`).matches}catch{vM=!1}return vM},bM=yM(),xM=e=>bM?`color(display-p3 0.84 0.19 0.78 / ${e})`:`rgba(210, 57, 192, ${e})`,SM=null,CM=e=>{SM=e},wM=()=>SM,TM=e=>!SM||e!==null&&SM.contains(e),EM=e=>e,DM=`data-react-grab`,OM=`0.1.48`,kM=`var(--rg-shadow)`,AM=-1e3,jM=.95,MM=1500,NM=[`/components/ui/`,`/packages/ui/`,`/design-system/`,`/design-systems/`,`/primitives/`],PM=5e3,FM=8e3,IM=1e4,LM=2147483647,RM=2147483645,zM=.7,BM=1e3/60,VM=.01,HM=xM(.4),UM=xM(.05),WM=xM(.5),GM=xM(.08),KM=xM(.15),qM=.2,JM=[`id`,`class`,`aria-label`,`data-testid`,`role`,`name`,`title`],YM=new Set([`id`,`data-testid`,`aria-label`,`href`,`src`,`alt`,`type`,`name`,`placeholder`,`role`,`for`,`action`,`method`,`title`,`disabled`,`checked`,`readonly`,`required`,`selected`,`open`]),XM=new Set([`a`,`code`,`pre`]),ZM=new Set([`script`,`style`,`template`,`noscript`]),QM=[`Meta`,`Control`,`Shift`,`Alt`],$M=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]),eN=`data-react-grab-frozen`,tN=.5,nN=`data-react-grab-input`,rN=.5,iN=`copy`,aN=`comment`,oN=`edit`,sN=`superellipse(1.25)`,cN=.01,lN=1e3,uN={left:-9999,top:-9999},dN={left:`left center`,right:`right center`,top:`center top`,bottom:`center bottom`},fN=1e3,pN=`#00000000`,mN=`transparent`,hN=2e3,gN=`cubic-bezier(0.34, 1.56, 0.64, 1)`,_N=12e3,vN=9e3,yN=1e4,bN=8e3,xN=5e3,SN=1e3,CN=1.2,wN=-9999,new Set(`display.position.top.right.bottom.left.z-index.overflow.overflow-x.overflow-y.width.height.min-width.min-height.max-width.max-height.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.flex-direction.flex-wrap.justify-content.align-items.align-self.align-content.flex-grow.flex-shrink.flex-basis.order.gap.row-gap.column-gap.grid-template-columns.grid-template-rows.grid-template-areas.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-align.text-decoration-line.text-decoration-style.text-transform.text-overflow.text-shadow.white-space.word-break.overflow-wrap.vertical-align.color.background-color.background-image.background-position.background-size.background-repeat.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.box-shadow.opacity.transform.filter.backdrop-filter.object-fit.object-position`.split(`.`)),TN=e=>(e.tagName||``).toLowerCase(),DN=()=>{if(EN!==void 0)return EN;let e=document.querySelector(`script[nonce], style[nonce]`),t=e?.nonce||e?.getAttribute(`nonce`)||null;return t&&(EN=t),t},ON=[[`data-rr-block`,``],[`data-rr-ignore`,``],[`data-rr-mask`,``],[`data-sentry-block`,``],[`data-sentry-ignore`,``],[`data-sentry-mask`,``],[`data-dd-privacy`,`hidden`],[`data-fs-exclude`,``],[`data-lr-exclude`,``],[`data-hj-suppress`,``],[`data-recording-disable`,``],[`data-clarity-mask`,`true`],[`data-heap-redact-text`,``]],kN=e=>{for(let[t,n]of ON)e.setAttribute(t,n);e.setAttribute(`data-testid`,`react-grab-overlay`),e.classList.add(`ph-no-capture`)},AN=`bippy-0.5.43`,jN=Object.defineProperty,MN=Object.prototype.hasOwnProperty,NN=()=>{},PN=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},FN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),IN=!1,RN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>IN?!0:(e&&typeof e.inject==`function`&&(LN=e.inject.toString()),!!LN?.includes(`(injected)`)),zN=new Set,BN=new Set,VN=e=>{let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:AN,checkDCE:PN,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),BN.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,zN.forEach(e=>e())),i},on:NN,onCommitFiberRoot:NN,onCommitFiberUnmount:NN,onPostCommitFiberRoot:NN,renderers:t,supportsFiber:!0,supportsFlight:!0};try{jN(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return r},set(t){if(t&&typeof t==`object`){let n=r.renderers;r=t,n.size>0&&(n.forEach((e,n)=>{BN.add(e),t.renderers.set(n,e)}),HN(e))}}});let t=window.hasOwnProperty,n=!1;jN(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{HN(e)}return r},HN=e=>{e&&zN.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=PN,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=AN,t._instrumentationIsActive=!1;let e=FN(t);if(e||(t.on=NN),t.renderers.size){t._instrumentationIsActive=!0,zN.forEach(e=>e());return}let n=t.inject,r=RN(t);r&&!e&&(IN=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return BN.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,zN.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||RN())&&e?.()}catch{}},UN=()=>MN.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),WN=e=>UN()?(HN(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):VN(e),GN=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)),KN=()=>{try{GN()&&WN()}catch{}},qN=e=>{switch(e.tag){case 1:case 11:case 0:case 14:case 15:return!0;default:return!1}},JN=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=JN(r,t,n);if(e)return e;r=n?null:r.sibling}return null},YN=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await YN(r,t,n);if(e)return e;r=n?null:r.sibling}return null},XN=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?XN(t.type||t.render):null},ZN=e=>{let t=e;if(typeof t==`string`)return t;if(typeof t!=`function`&&!(typeof t==`object`&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=XN(t);return r&&(r.displayName||r.name)||null},QN=()=>{let e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;return!!e?._instrumentationIsActive||FN(e)||RN(e)},$N=e=>{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t?.renderers)for(let n of t.renderers.values())try{let t=n.findFiberByHostInstance?.(e);if(t)return t}catch{}if(typeof e==`object`&&e){if(`_reactRootContainer`in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let t in e)if(t.startsWith(`__reactContainer$`)||t.startsWith(`__reactInternalInstance$`)||t.startsWith(`__reactFiber`))return e[t]||null}return null},eP=new Set,tP=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,nP=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],rP=[`<anonymous>`,`eval`,``],iP=/\.(jsx|tsx|ts|js)$/,aP=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,oP=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,sP=/\(at [^)]+\)$/,cP=/(^|@)\S+:\d+/,lP=/^\s*at .*(\S+:\d+|\(native\))/m,uP=/^(eval@)?(\[native code\])?$/,dP=(e,t)=>{if(t?.includeInElement!==!1){let n=e.split(`
|
|
184
|
+
### Attachments`:``}\n`}catch{n.push(`pasted image ${t+1}`)}if(de()){let t=tk(30);t&&(e+=`\n\n### Console errors (client)\n\`\`\`\n${t}\n\`\`\``)}if(r().logUrl&&Te())try{let t=await qO(r());if(t){let n=Math.min(500,Math.max(10,r().logLines??100));e+=`\n\n### Dev server logs (last ${n} lines)\n\`\`\`\n${t}\n\`\`\``}}catch{n.push(`server logs (fetch failed — is the Log URL serving the file?)`)}if(n.length){let e=n.some(e=>!e.startsWith(`server logs`));Je(`Skipped: ${n.join(`, `)} — issue created without ${n.length>1?`them`:`it`}.${e?" Real fix for uploads: run `npx linear-grab-bridge` in the repo (uploads relay through it) or set the GitHub fallback in Settings.":``}`)}let c=await gO({teamId:E(),title:s(),description:e,priority:C(),delegateId:ne()===`cursor`?r().cursorAgentId:void 0}),u=!1;if(ne()===`local`)try{let t=[`You are delegated Linear issue ${c.identifier} (${c.url}).`,``,e,``,`## Closeout — do ALL of this autonomously when the fix is verified (permissions are granted):`,`1. Create a branch (e.g. fix/${c.identifier.toLowerCase()}-short-slug), commit, push.`,`2. Open a PR: \`gh pr create\` — reference ${c.identifier} and ${c.url} in the body so Linear links it.`,`3. Update the Linear issue via its GraphQL API (https://api.linear.app/graphql) using the LINEAR_API_KEY env var as the Authorization header:`,` - commentCreate on issue ${c.identifier}: one-line fix summary + root cause + the PR link.`,` - Move it to review: query the team's workflowStates, then issueUpdate with the review/'In Review' stateId.`,`4. Announce the finished fix on every channel whose token appears in the instructions above (Slack chat.postMessage + files upload, Telegram sendMessage/sendVideo) — include: what was broken, the one-line fix, the Linear issue link, the PR link, and the demo recording if you made one. End with "👉 Review the PR".`].join(`
|
|
185
|
+
`);await kO(`${c.identifier} — ${s()}`,le()?`${t}\n\nNote: you are running in an ISOLATED git worktree on a dedicated branch (already checked out) — commit and push THAT branch for the PR; do not switch back to main.`:t,{model:ie()||void 0,permissionMode:`bypassPermissions`,worktree:le(),env:r().linearApiKey?{LINEAR_API_KEY:r().linearApiKey}:void 0}),u=!0;try{let e=(await mO(E())).filter(e=>e.type===`started`).sort((e,t)=>e.position-t.position)[0];e&&await hO(c.id,e.id)}catch{}await _O(c.id,`🖥️ Delegated to **local Claude Code** on this machine (Linear Grab bridge). Live status, conversation, and steering in the panel's Local tab. The agent will post its fix summary + PR here and move this issue to review when done.`).catch(()=>{})}catch{Je("Issue created, but the local bridge is unreachable — run `npx linear-grab-bridge` in the repo and re-delegate from the Local tab.")}let f=await UO(r(),{identifier:c.identifier,title:s(),url:c.url,summary:l(),impact:_(),repo:te()||r().defaultRepo,demoUrl:BD().result?.assetUrl,executor:ne()});return f.length&&Je(`${f.join(` + `)} announcement failed — check the token/channel in Settings.`),{...c,localTask:u}},onSuccess:e=>{Xe({identifier:e.identifier,url:e.url}),Ke(null),Fe(null),xe([]),$D(),e.localTask&&YA(`local`)},onError:e=>{Ke(e.message)}})),Qe=k(()=>!!s().trim()&&!!E()&&a()),et=k(()=>{let e=o();return e?jx[e][Ce()]:null}),tt=()=>f(e=>[...e,``]),nt=e=>f(t=>t.filter((t,n)=>n!==e)),N=(e,t)=>f(n=>n.map((n,r)=>r===e?t:n));return(()=>{var n=rM(),f=n.firstChild,T=f.firstChild.firstChild.nextSibling,O=f.nextSibling;return P(T,j(M,{get when(){return i()},get fallback(){return j(Oj,{class:`text-text-faint`,children:`No element`})},get children(){return j(Oj,{class:`text-accent max-w-full`,get children(){var e=Pj();return P(e,(()=>{var e=$e(()=>!!i().componentName);return()=>e()?`<${i().componentName}>`:i().source?.filePath?.split(`/`).pop()??`element`})()),e}})}}),null),P(T,j(M,{get when(){return i()?.screenshotDataUrl},get children(){return j(Oj,{class:`text-success`,children:`screenshot ✓`})}}),null),P(T,j(M,{get when(){return Be().result},get children(){return j(Oj,{get class(){return Be().attachOnCreate?`text-success`:`text-text-faint`},get children(){return[`gif `,$e(()=>(Be().result.durationMs/1e3).toFixed(0)),`s`,$e(()=>Be().attachOnCreate?` ✓`:` (off)`)]}})}}),null),P(T,j(M,{get when(){return(t.data?.length??0)>1},get children(){return j(Oj,{get children(){return[`+`,$e(()=>t.data.length-1),` more`]}})}}),null),P(T,j(M,{get when(){return Be().phase===`recording`},get children(){return j(Oj,{class:`text-danger`,children:`● recording…`})}}),null),P(f,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Manage in the Capture tab — elements, screenshots, recording`,"aria-label":`Open Capture tab`,onClick:()=>YA(`capture`),get children(){return Fj()}}),null),P(n,j(Dj,{title:`AI draft`,get children(){return[j(Ej,{label:`Your note`,get children(){return j(xj,{rows:3,placeholder:`Describe the problem or change in your own words… (paste screenshots here too)`,get value(){return ve()},onInput:e=>ye(e.currentTarget.value),onPaste:Se})}}),j(M,{get when(){return be().length>0},get children(){var e=Ij(),t=e.firstChild;return P(e,j(We,{get each(){return be()},children:e=>(()=>{var t=iM(),n=t.firstChild,r=n.nextSibling;return r.$$click=()=>xe(t=>t.filter(t=>t.id!==e.id)),D(()=>it(n,`src`,e.dataUrl)),t})()}),t),e}}),(()=>{var e=Lj(),t=e.firstChild.nextSibling;return P(t,()=>[`fast`,`best`].map(e=>(()=>{var t=aM();return t.$$click=()=>we(e),P(t,e===`fast`?`Fast`:`Best`),D(()=>st(t,`h-6 px-2.5 text-[11px] font-medium transition-colors cursor-pointer ${Ce()===e?`bg-accent text-white`:`bg-surface-2 text-text-dim hover:text-text`}`)),t})())),e})(),(()=>{var e=Bj();return P(e,j(M,{get when(){return o()},get fallback(){return j(vj,{variant:`ghost`,class:`w-full opacity-60 cursor-default`,disabled:!1,children:`Add an AI key in Settings`})},get children(){return j(vj,{variant:`primary`,class:`w-full`,get loading(){return Ae()},onClick:ze,get disabled(){return Ae()},children:`Draft with AI`})}}),null),P(e,j(M,{get when(){return et()},get children(){var e=zj();return P(e,j(Oj,{get children(){var e=Rj();return P(e,et),e}})),e}}),null),e})(),j(M,{get when(){return Pe()},get children(){var e=Vj(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return n.nextSibling,P(t,()=>Pe().provider),P(e,()=>Pe().modelId,n),e}}),j(M,{get when(){return Me()},get children(){return j(jj,{get message(){return Me()}})}})]}}),O),P(n,j(Dj,{title:`Issue`,get children(){return[j(Ej,{label:`Title`,get children(){return j(bj,{class:`h-8 text-[13px] font-medium`,get value(){return s()},onInput:e=>c(e.currentTarget.value),placeholder:`Brief summary of the issue`})}}),j(M,{get when(){return(_e.data??[]).length>0},get children(){var e=Hj();return e.firstChild,P(e,j(We,{get each(){return _e.data.slice(0,3)},children:e=>(()=>{var t=oM(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.identifier),P(r,()=>e.title),P(t,j(Oj,{class:`ml-auto shrink-0`,get children(){return e.state.name}}),null),D(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),j(Ej,{label:`Description`,get children(){return j(xj,{rows:6,get value(){return l()},onInput:e=>u(e.currentTarget.value),placeholder:`Markdown supported`})}}),j(Ej,{label:`Reproduction steps`,get children(){var e=Uj();return P(e,j(Ge,{get each(){return d()},children:(e,t)=>(()=>{var n=sM(),r=n.firstChild,i=r.firstChild,a=r.nextSibling;return P(r,t+1,i),P(n,j(bj,{class:`flex-1`,get value(){return e()},onInput:e=>N(t,e.currentTarget.value),placeholder:`Step ${t+1}`}),a),a.$$click=()=>nt(t),n})()}),null),P(e,j(vj,{variant:`ghost`,class:`self-start h-6 px-2 text-[11px]`,onClick:tt,children:`+ Add step`}),null),e}}),j(Ej,{label:`Expected`,get children(){return j(xj,{rows:2,get value(){return p()},onInput:e=>m(e.currentTarget.value),placeholder:`What should happen`})}}),j(Ej,{label:`Actual`,get children(){return j(xj,{rows:2,get value(){return h()},onInput:e=>g(e.currentTarget.value),placeholder:`What actually happens`})}}),j(Ej,{label:`Impact`,get children(){return j(xj,{rows:2,get value(){return _()},onInput:e=>v(e.currentTarget.value),placeholder:`Who/what is affected and how badly`})}}),j(Ej,{label:`Analysis / Notes`,get children(){return j(xj,{rows:3,get value(){return y()},onInput:e=>b(e.currentTarget.value),placeholder:`- Likely root cause…`})}}),j(Ej,{label:`Suggested next steps`,get children(){return j(xj,{rows:3,get value(){return x()},onInput:e=>S(e.currentTarget.value),placeholder:`- Concrete fix suggestion…`})}}),j(Ej,{label:`Priority`,get children(){return j(Sj,{get value(){return C()},onChange:e=>w(Number(e.currentTarget.value)),get children(){return j(We,{get each(){return Object.entries(Mj)},children:([e,t])=>(()=>{var n=cM();return n.value=e,P(n,t),n})()})}})}}),j(M,{get when(){return a()},get fallback(){return j(jj,{message:`Connect Linear in Settings to create issues.`})},get children(){return j(Ej,{label:`Team`,get children(){return j(M,{get when(){return!Oe.isLoading},get fallback(){return j(Sj,{disabled:!0,get children(){return lM()}})},get children(){return j(Sj,{get value(){return E()},onChange:e=>ee(e.currentTarget.value),get children(){return[Wj(),j(We,{get each(){return Oe.data??[]},children:e=>(()=>{var t=cM();return P(t,()=>e.name),D(()=>t.selected=e.id===E()),D(()=>t.value=e.id),t})()})]}})}})}})}}),j(Ej,{label:`Repo`,hint:`Appended as [repo=…] so Cursor works in the right repository.`,get children(){return j(bj,{get value(){return te()},onInput:e=>A(e.currentTarget.value),placeholder:`owner/repository`})}}),j(Ej,{label:`Delegate to`,get hint(){return $e(()=>ne()===`local`)()?"Requires `npx linear-grab-bridge` running in the repo — track it in the Local tab.":ne()===`cursor`&&!r().cursorAgentId?`Pick the Cursor agent in Settings first.`:void 0},get children(){return j(Sj,{get value(){return ne()},onChange:e=>re(e.currentTarget.value),get children(){return[(()=>{var e=Gj(),t=e.firstChild;return P(e,()=>r().cursorAgentName??`Cursor`,t),D(t=>{var n=!r().cursorAgentId,i=ne()===`cursor`;return n!==t.e&&(e.disabled=t.e=n),i!==t.t&&(e.selected=t.t=i),t},{e:void 0,t:void 0}),e})(),(()=>{var e=Kj();return D(()=>e.selected=ne()===`local`),e})(),(()=>{var e=qj();return D(()=>e.selected=ne()===`none`),e})()]}})}}),j(M,{get when(){return ne()===`cursor`},get children(){return j(Ej,{label:`Cloud model`,get hint(){return`Sent as [model=…]. Empty = ${r().cursorModel?`your default (${r().cursorModel})`:`Cursor's default`}.`},get children(){return j(bj,{get placeholder(){return r().cursorModel||`Cursor's default — e.g. claude-opus-4-8, composer`},get value(){return se()},onInput:e=>ce(e.currentTarget.value)})}})}}),j(M,{get when(){return ne()===`local`},get children(){return[j(Ej,{label:`Local model`,hint:`Switchable while running from the Local tab.`,get children(){return j(Sj,{get value(){return ie()},onChange:e=>oe(e.currentTarget.value),get children(){return[(()=>{var e=Jj();return D(()=>e.selected=ie()===``),e})(),(()=>{var e=Yj();return D(()=>e.selected=ie()===`fable`),e})(),(()=>{var e=Xj();return D(()=>e.selected=ie()===`opus`),e})(),(()=>{var e=Zj();return D(()=>e.selected=ie()===`sonnet`),e})(),(()=>{var e=Qj();return D(()=>e.selected=ie()===`haiku`),e})()]}})}}),(()=>{var e=$j(),t=e.firstChild;return t.addEventListener(`change`,e=>ue(e.currentTarget.checked)),D(()=>t.checked=le()),e})()]}}),j(M,{get when(){return pe()>0},get children(){var e=eM(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,r=n.firstChild.nextSibling;return r.nextSibling,t.addEventListener(`change`,e=>fe(e.currentTarget.checked)),P(n,pe,r),D(()=>t.checked=de()),e}}),j(M,{get when(){return r().logUrl},get children(){var e=tM(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,i=n.firstChild.nextSibling;return i.nextSibling,t.addEventListener(`change`,e=>Ee(e.currentTarget.checked)),P(n,()=>Math.min(500,Math.max(10,r().logLines??100)),i),D(()=>t.checked=Te()),e}})]}}),O),P(O,j(M,{get when(){return Ue()},get children(){return j(jj,{get message(){return Ue()}})}}),null),P(O,j(M,{get when(){return qe()},get children(){var e=nM();return P(e,qe),e}}),null),P(O,j(M,{get when(){return Ye()},children:t=>(()=>{var n=uM(),r=n.firstChild;return P(r,()=>t().identifier),P(n,j(vj,{variant:`ghost`,class:`h-6 px-2 text-[11px]`,onClick:()=>{Xe(null),Fe(null),e.onCreated()},children:`View activity`}),null),D(()=>it(r,`href`,t().url)),n})()}),null),P(O,j(vj,{variant:`primary`,get loading(){return Ze.isPending},get disabled(){return!Qe()},onClick:()=>Ze.mutate(),children:`Create issue`}),null),n})()}rt([`click`]);function fM(e,t,n=!1){if(!e)return null;let r=t(e);if(r instanceof Promise)return(async()=>{if(await r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=await YN(i,t,n);if(e)return e;i=n?null:i.sibling}return null})();if(r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=JN(i,t,n);if(e)return e;i=n?null:i.sibling}return null}function pM(e,t){let n=0,r=0,i=0;do i=yP[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function mM(e,t){return e.pos>=t?!1:e.peek()!==gP}function hM(e){let{length:t}=e,n=new bP(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=pM(n,i),i<u&&(l=!1),u=i,mM(n,e)?(a=pM(n,a),o=pM(n,o),s=pM(n,s),mM(n,e)?(c=pM(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||gM(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function gM(e){e.sort(_M)}function _M(e,t){return e[0]-t[0]}var vM,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,JM,YM,XM,ZM,QM,$M,eN,tN,nN,rN,iN,aN,oN,sN,cN,lN,uN,dN,fN,pN,mN,hN,gN,_N,vN,yN,bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,YN,XN,ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,fP,pP,mP,hP,gP,_P,vP,yP,bP,xP,SP,CP,wP,TP,EP,DP,OP,kP,AP,jP,MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,JP,YP,XP,ZP,QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,MF,NF,PF,FF,IF,LF,RF,zF,BF,VF,HF,UF,WF,GF,KF,qF,JF,YF,XF,ZF,QF,$F,eI,tI,nI,rI,iI,aI,oI,sI,cI,lI,uI,dI,fI,pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,wI,TI,EI,DI,OI,kI,AI,jI,MI,NI,PI,FI,II,LI,RI,zI,BI,VI,HI,UI,WI,GI,KI,qI,JI,YI,XI,ZI,QI,$I,eL,tL,nL,rL,iL,aL,oL,sL,cL,lL,uL,dL,fL,pL,mL,hL,gL,_L,vL,yL,bL,xL,SL,CL,wL,TL,EL,DL,OL,kL,AL,jL,ML,NL,PL,FL,IL,LL,RL,zL,BL,VL,HL,UL,WL,GL,KL,qL,JL,YL,XL,ZL,QL,$L,eR=t((()=>{vM=null,yM=()=>{if(vM!==null)return vM;try{vM=window.matchMedia(`(color-gamut: p3)`).matches}catch{vM=!1}return vM},bM=yM(),xM=e=>bM?`color(display-p3 0.84 0.19 0.78 / ${e})`:`rgba(210, 57, 192, ${e})`,SM=null,CM=e=>{SM=e},wM=()=>SM,TM=e=>!SM||e!==null&&SM.contains(e),EM=e=>e,DM=`data-react-grab`,OM=`0.1.48`,kM=`var(--rg-shadow)`,AM=-1e3,jM=.95,MM=1500,NM=[`/components/ui/`,`/packages/ui/`,`/design-system/`,`/design-systems/`,`/primitives/`],PM=5e3,FM=8e3,IM=1e4,LM=2147483647,RM=2147483645,zM=.7,BM=1e3/60,VM=.01,HM=xM(.4),UM=xM(.05),WM=xM(.5),GM=xM(.08),KM=xM(.15),qM=.2,JM=[`id`,`class`,`aria-label`,`data-testid`,`role`,`name`,`title`],YM=new Set([`id`,`data-testid`,`aria-label`,`href`,`src`,`alt`,`type`,`name`,`placeholder`,`role`,`for`,`action`,`method`,`title`,`disabled`,`checked`,`readonly`,`required`,`selected`,`open`]),XM=new Set([`a`,`code`,`pre`]),ZM=new Set([`script`,`style`,`template`,`noscript`]),QM=[`Meta`,`Control`,`Shift`,`Alt`],$M=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]),eN=`data-react-grab-frozen`,tN=.5,nN=`data-react-grab-input`,rN=.5,iN=`copy`,aN=`comment`,oN=`edit`,sN=`superellipse(1.25)`,cN=.01,lN=1e3,uN={left:-9999,top:-9999},dN={left:`left center`,right:`right center`,top:`center top`,bottom:`center bottom`},fN=1e3,pN=`#00000000`,mN=`transparent`,hN=2e3,gN=`cubic-bezier(0.34, 1.56, 0.64, 1)`,_N=12e3,vN=9e3,yN=1e4,bN=8e3,xN=5e3,SN=1e3,CN=1.2,wN=-9999,new Set(`display.position.top.right.bottom.left.z-index.overflow.overflow-x.overflow-y.width.height.min-width.min-height.max-width.max-height.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.flex-direction.flex-wrap.justify-content.align-items.align-self.align-content.flex-grow.flex-shrink.flex-basis.order.gap.row-gap.column-gap.grid-template-columns.grid-template-rows.grid-template-areas.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-align.text-decoration-line.text-decoration-style.text-transform.text-overflow.text-shadow.white-space.word-break.overflow-wrap.vertical-align.color.background-color.background-image.background-position.background-size.background-repeat.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.box-shadow.opacity.transform.filter.backdrop-filter.object-fit.object-position`.split(`.`)),TN=e=>(e.tagName||``).toLowerCase(),DN=()=>{if(EN!==void 0)return EN;let e=document.querySelector(`script[nonce], style[nonce]`),t=e?.nonce||e?.getAttribute(`nonce`)||null;return t&&(EN=t),t},ON=[[`data-rr-block`,``],[`data-rr-ignore`,``],[`data-rr-mask`,``],[`data-sentry-block`,``],[`data-sentry-ignore`,``],[`data-sentry-mask`,``],[`data-dd-privacy`,`hidden`],[`data-fs-exclude`,``],[`data-lr-exclude`,``],[`data-hj-suppress`,``],[`data-recording-disable`,``],[`data-clarity-mask`,`true`],[`data-heap-redact-text`,``]],kN=e=>{for(let[t,n]of ON)e.setAttribute(t,n);e.setAttribute(`data-testid`,`react-grab-overlay`),e.classList.add(`ph-no-capture`)},AN=`bippy-0.5.43`,jN=Object.defineProperty,MN=Object.prototype.hasOwnProperty,NN=()=>{},PN=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},FN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),IN=!1,RN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>IN?!0:(e&&typeof e.inject==`function`&&(LN=e.inject.toString()),!!LN?.includes(`(injected)`)),zN=new Set,BN=new Set,VN=e=>{let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:AN,checkDCE:PN,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),BN.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,zN.forEach(e=>e())),i},on:NN,onCommitFiberRoot:NN,onCommitFiberUnmount:NN,onPostCommitFiberRoot:NN,renderers:t,supportsFiber:!0,supportsFlight:!0};try{jN(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return r},set(t){if(t&&typeof t==`object`){let n=r.renderers;r=t,n.size>0&&(n.forEach((e,n)=>{BN.add(e),t.renderers.set(n,e)}),HN(e))}}});let t=window.hasOwnProperty,n=!1;jN(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{HN(e)}return r},HN=e=>{e&&zN.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=PN,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=AN,t._instrumentationIsActive=!1;let e=FN(t);if(e||(t.on=NN),t.renderers.size){t._instrumentationIsActive=!0,zN.forEach(e=>e());return}let n=t.inject,r=RN(t);r&&!e&&(IN=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return BN.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,zN.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||RN())&&e?.()}catch{}},UN=()=>MN.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),WN=e=>UN()?(HN(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):VN(e),GN=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)),KN=()=>{try{GN()&&WN()}catch{}},qN=e=>{switch(e.tag){case 1:case 11:case 0:case 14:case 15:return!0;default:return!1}},JN=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=JN(r,t,n);if(e)return e;r=n?null:r.sibling}return null},YN=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await YN(r,t,n);if(e)return e;r=n?null:r.sibling}return null},XN=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?XN(t.type||t.render):null},ZN=e=>{let t=e;if(typeof t==`string`)return t;if(typeof t!=`function`&&!(typeof t==`object`&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=XN(t);return r&&(r.displayName||r.name)||null},QN=()=>{let e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;return!!e?._instrumentationIsActive||FN(e)||RN(e)},$N=e=>{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t?.renderers)for(let n of t.renderers.values())try{let t=n.findFiberByHostInstance?.(e);if(t)return t}catch{}if(typeof e==`object`&&e){if(`_reactRootContainer`in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let t in e)if(t.startsWith(`__reactContainer$`)||t.startsWith(`__reactInternalInstance$`)||t.startsWith(`__reactFiber`))return e[t]||null}return null},eP=new Set,tP=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,nP=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],rP=[`<anonymous>`,`eval`,``],iP=/\.(jsx|tsx|ts|js)$/,aP=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,oP=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,sP=/\(at [^)]+\)$/,cP=/(^|@)\S+:\d+/,lP=/^\s*at .*(\S+:\d+|\(native\))/m,uP=/^(eval@)?(\[native code\])?$/,dP=(e,t)=>{if(t?.includeInElement!==!1){let n=e.split(`
|
|
186
186
|
`),r=[];for(let e of n)if(/^\s*at\s+/.test(e)){let t=mP(e,void 0)[0];t&&r.push(t)}else if(/^\s*in\s+/.test(e)){let t=e.replace(/^\s*in\s+/,``).replace(/\s*\(at .*\)$/,``);r.push({functionName:t,source:e})}else if(e.match(cP)){let t=hP(e,void 0)[0];t&&r.push(t)}return pP(r,t)}return e.match(lP)?mP(e,t):hP(e,t)},fP=e=>{if(!e.includes(`:`))return[e,void 0,void 0];let t=e.startsWith(`(`)&&/:\d+\)$/.test(e)?e.slice(1,-1):e,n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t);return n?[n[1],n[2]||void 0,n[3]||void 0]:[t,void 0,void 0]},pP=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e,mP=(e,t)=>pP(e.split(`
|
|
187
187
|
`).filter(e=>!!e.match(lP)),t).map(e=>{let t=e;t.includes(`(eval `)&&(t=t.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let n=t.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],``):n;let i=fP(r?r[1]:n);return{functionName:r&&n||void 0,fileName:[`eval`,`<anonymous>`].includes(i[0])?void 0:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}),hP=(e,t)=>pP(e.split(`
|
|
188
188
|
`).filter(e=>!e.match(uP)),t).map(e=>{let t=e;if(t.includes(` > eval`)&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),!t.includes(`@`)&&!t.includes(`:`))return{functionName:t};{let e=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=t.match(e),r=n&&n[1]?n[1]:void 0,i=fP(t.replace(e,``));return{functionName:r,fileName:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}}),gP=44,_P=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,vP=new Uint8Array(64),yP=new Uint8Array(128);for(let e=0;e<_P.length;e++){let t=_P.charCodeAt(e);vP[e]=t,yP[t]=e}bP=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}},xP=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,SP=/^data:application\/json[^,]+base64,/,CP=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,wP=new Map,TP=new Map,EP=(e,t,n,r)=>{if(n<0||n>=e.length)return null;let i=e[n];if(!i||i.length===0)return null;let a=null;for(let e of i)if(e[0]<=r)a=e;else break;if(!a||a.length<4)return null;let[,o,s,c]=a;if(o===void 0||s===void 0||c===void 0)return null;let l=t[o];return l?{columnNumber:c,fileName:l,lineNumber:s+1}:null},DP=(e,t,n)=>{if(e.sections){let r=null;for(let i of e.sections)if(t>i.offset.line||t===i.offset.line&&n>=i.offset.column)r=i;else break;if(!r)return null;let i=t-r.offset.line,a=t===r.offset.line?n-r.offset.column:n;return EP(r.map.mappings,r.map.sources,i,a)}return EP(e.mappings,e.sources,t-1,n)},OP=(e,t)=>{let n=t.split(`
|
|
@@ -206,18 +206,18 @@ of the other sections.`,pD="- FIRST, self-orient in the repo checkout (skip any
|
|
|
206
206
|
*, *::before, *::after {
|
|
207
207
|
transition: none !important;
|
|
208
208
|
}
|
|
209
|
-
`;let e=[];for(let t of document.getAnimations())QI(t)||e.push(t);ZI(e),VI=!1}else{for(let e of BI)try{e.finish()}catch{try{e.play()}catch{}}BI=[]}RI.remove(),RI=null,YI(zI),zI=[],MI()}},aL=[`mouseenter`,`mouseleave`,`mouseover`,`mouseout`,`pointerenter`,`pointerleave`,`pointerover`,`pointerout`],oL=[`focus`,`blur`,`focusin`,`focusout`],sL=[`background-color`,`color`,`border-color`,`box-shadow`,`transform`,`opacity`,`outline`,`filter`,`scale`,`visibility`],cL=[`background-color`,`color`,`border-color`,`box-shadow`,`outline`,`outline-offset`,`outline-width`,`outline-color`,`outline-style`,`filter`,`opacity`,`ring-color`,`ring-width`],lL=new Map,uL=new Map,dL=e=>{e.stopImmediatePropagation()},fL=e=>{e.preventDefault(),e.stopImmediatePropagation()},pL=(e,t)=>{let n=new Map;for(let r of t){let t=e.style.getPropertyValue(r);t&&n.set(r,t)}return n},mL=(e,t,n)=>{if(n?.has(e))return null;let r=getComputedStyle(e),i=e.style.cssText,a=pL(e,t);for(let e of t){let t=r.getPropertyValue(e);t&&(i+=`${e}: ${t} !important; `)}return{element:e,frozenStyles:i,originalPropertyValues:a}},hL=(e,t)=>{let n=[],r=document.elementFromPoint(e,t);for(;r&&r!==document.documentElement;)r instanceof HTMLElement&&n.push(r),r=r.parentElement;return n},gL=()=>{let e=[],t=document.activeElement;for(;t&&t!==document.body;)t instanceof HTMLElement&&e.push(t),t=t.shadowRoot?.activeElement??null;return e},_L=(e,t)=>{for(let{element:n,frozenStyles:r,originalPropertyValues:i}of e)t.set(n,i),n.style.cssText=r},vL=(e,t)=>{for(let[n,r]of e)for(let e of t){let t=r.get(e);t?n.style.setProperty(e,t):n.style.removeProperty(e)}e.clear()},yL=(e,t)=>{if(sI())return null;let n=[],r=e!==void 0&&t!==void 0&&e>=0&&t>=0&&e<window.innerWidth&&t<window.innerHeight?hL(e,t):Array.from(document.querySelectorAll(`:hover`)).filter(e=>e instanceof HTMLElement);for(let e of r){let t=mL(e,sL);t&&n.push(t)}let i=[];for(let e of gL()){let t=mL(e,cL,uL);t&&i.push(t)}return{hoverStates:n,focusStates:i}},bL=e=>{if(e){for(let e of aL)document.addEventListener(e,dL,!0);for(let e of oL)document.addEventListener(e,fL,!0);_L(e.hoverStates,lL),_L(e.focusStates,uL),cI()}},xL=()=>{xI();for(let e of aL)document.removeEventListener(e,dL,!0);for(let e of oL)document.removeEventListener(e,fL,!0);vL(lL,sL),vL(uL,cL),lI()},SL=(e,t)=>{let n=yL(e,t),r=nL();bL(n),rL(r)},CL=()=>{xL(),iL()},wL=!1,TL=(e,t,n)=>{let r=e.get(t);if(r)return r;let i=n();return e.set(t,i),i},EL=new WeakMap,DL=new WeakMap,OL=new WeakMap,kL=new Set,AL=[],jL=[],ML=new WeakMap,NL=new WeakMap,PL=new WeakSet,FL=eP,IL=e=>{let t=e;for(;t.return;)t=t.return;return t.stateNode??null},LL=()=>{if(FL.size>0)return FL;let e=new Set,t=n=>{let r=$N(n);if(r){let t=IL(r);t&&e.add(t);return}for(let r of Array.from(n.children))if(t(r),e.size>0)return};return t(document.body),e},RL=(e,t)=>{if(!e)return t;if(!t)return e;if(!e.next||!t.next)return t;let n=e.next,r=t.next,i=e===n,a=t===r;return i&&a?(e.next=t,t.next=e):i?(e.next=r,t.next=e):a?(t.next=n,e.next=t):(e.next=r,t.next=n),t},zL=e=>{if(!e||ML.has(e))return;let t={originalPendingDescriptor:Object.getOwnPropertyDescriptor(e,`pending`),pendingValueAtPause:e.pending,bufferedPending:null};typeof e.getSnapshot==`function`&&(t.originalGetSnapshot=e.getSnapshot,t.snapshotValueAtPause=e.getSnapshot(),e.getSnapshot=()=>wL?t.snapshotValueAtPause:t.originalGetSnapshot());let n=t.pendingValueAtPause;Object.defineProperty(e,"pending",{configurable:!0,enumerable:!0,get:()=>wL?null:n,set:e=>{if(wL){e!==null&&(t.bufferedPending=RL(t.bufferedPending??null,e));return}n=e}}),ML.set(e,t)},BL=e=>{if(!e)return[];let t=[],n=e.next;if(!n)return[];let r=n;do r&&=(t.push(r.action),r.next);while(r&&r!==n);return t},VL=e=>{let t=ML.get(e);if(!t)return;t.originalGetSnapshot&&(e.getSnapshot=t.originalGetSnapshot),t.originalPendingDescriptor?Object.defineProperty(e,"pending",t.originalPendingDescriptor):delete e.pending,e.pending=null;let n=e.dispatch;if(typeof n==`function`){let e=BL(t.pendingValueAtPause??null),r=BL(t.bufferedPending??null);for(let t of[...e,...r])jL.push(()=>n(t))}ML.delete(e)},HL=e=>{if(NL.has(e))return;let t={originalDescriptor:Object.getOwnPropertyDescriptor(e,`memoizedValue`),frozenValue:e.memoizedValue};Object.defineProperty(e,"memoizedValue",{configurable:!0,enumerable:!0,get(){return wL?t.frozenValue:t.originalDescriptor?.get?t.originalDescriptor.get.call(this):this._memoizedValue},set(e){if(wL){t.pendingValue=e,t.didReceivePendingValue=!0;return}t.originalDescriptor?.set?t.originalDescriptor.set.call(this,e):this._memoizedValue=e}}),t.originalDescriptor?.get||(e._memoizedValue=t.frozenValue),NL.set(e,t)},UL=e=>{let t=NL.get(e);t&&(t.originalDescriptor?Object.defineProperty(e,"memoizedValue",t.originalDescriptor):delete e.memoizedValue,t.didReceivePendingValue&&(e.memoizedValue=t.pendingValue),NL.delete(e))},WL=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&zL(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)HL(n),n=n.next},GL=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&VL(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)UL(n),n=n.next},KL=e=>{let t=e;for(;t;){if(qN(t)&&WL(t),t.child){t=t.child;continue}for(;t!==e&&!t.sibling;)if(t=t.return,!t)return;if(t===e)return;t=t.sibling}},qL=e=>{let t=e;for(;t;){if(qN(t)&&GL(t),t.child){t=t.child;continue}for(;t!==e&&!t.sibling;)if(t=t.return,!t)return;if(t===e)return;t=t.sibling}},JL=e=>{if(EL.has(e))return;let t=e,n={useState:t.useState,useReducer:t.useReducer,useTransition:t.useTransition,useSyncExternalStore:t.useSyncExternalStore};EL.set(e,n),t.useState=(...t)=>{let r=n.useState.apply(e,t);if(!wL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,TL(DL,a,()=>(...e)=>{wL?jL.push(()=>a(...e)):a(...e)})]},t.useReducer=(...t)=>{let r=n.useReducer.apply(e,t);if(!wL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,TL(DL,a,()=>(...e)=>{wL?jL.push(()=>a(...e)):a(...e)})]},t.useTransition=(...t)=>{let r=n.useTransition.apply(e,t);if(!wL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,TL(OL,a,()=>e=>{wL?AL.push(()=>a(e)):a(e)})]},t.useSyncExternalStore=((e,t,r)=>wL?n.useSyncExternalStore(t=>e(()=>{wL?kL.add(t):t()}),t,r):n.useSyncExternalStore(e,t,r))},YL=e=>{let t=e.currentDispatcherRef;if(!t||typeof t!=`object`)return;let n=`H`in t?`H`:`current`,r=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:()=>(r&&typeof r==`object`&&JL(r),r),set:e=>{r=e}})},XL=e=>{queueMicrotask(()=>{try{for(let t of WN().renderers.values())if(typeof t.scheduleUpdate==`function`){for(let n of e)if(n.current)try{t.scheduleUpdate(n.current)}catch{}}}catch{}})},ZL=e=>{for(let t of e)try{t()}catch{}},QL=()=>{for(let e of WN().renderers.values())PL.has(e)||(YL(e),PL.add(e))},$L=()=>{if(wL)return()=>{};QL(),wL=!0;let e=LL();for(let t of e)KL(t.current);return()=>{if(wL)try{let e=LL();for(let t of e)qL(t.current);let t=Array.from(kL),n=AL.slice(),r=jL.slice();wL=!1,ZL(t),ZL(n),ZL(r),XL(e)}finally{kL.clear(),AL.length=0,jL.length=0}}}}));function tR(e){let t=String(e),n=t.length-1;return yz.context.id+(n?String.fromCharCode(96+n):``)+t}function nR(e){yz.context=e}function rR(e,t){let n=Az,r=Oz,i=e.length===0,a=t===void 0?r:t,o=i?Ez:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>uR(()=>jR(o)));Oz=o,Az=null;try{return TR(s,!0)}finally{Az=n,Oz=r}}function J(e,t){t=t?Object.assign({},wz,t):wz;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[yR.bind(n),e=>(typeof e==`function`&&(e=kz&&kz.running&&kz.sources.has(n)?e(n.tValue):e(n.value)),bR(n,e))]}function iR(e,t,n){xR(CR(e,t,!0,1))}function aR(e,t,n){xR(CR(e,t,!1,1))}function oR(e,t,n){Tz=OR;let r=CR(e,t,!1,1),i=Iz&&_R(Iz);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),Mz?Mz.push(r):xR(r)}function Y(e,t,n){n=n?Object.assign({},wz,n):wz;let r=CR(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,xR(r),yR.bind(r)}function sR(e){return e&&typeof e==`object`&&`then`in e}function cR(e,t,n){let r,i,a;typeof t==`function`?(r=e,i=t,a=n||{}):(r=!0,i=e,a=t||{});let o=null,s=Dz,c=null,l=!1,u=!1,d=`initialValue`in a,f=typeof r==`function`&&Y(r),p=new Set,[m,h]=(a.storage||J)(a.initialValue),[g,_]=J(void 0),[v,y]=J(void 0,{equals:!1}),[b,x]=J(d?`ready`:`unresolved`);yz.context&&(c=yz.getNextContextId(),a.ssrLoadFrom===`initial`?s=a.initialValue:yz.load&&yz.has(c)&&(s=yz.load(c)));function S(e,t,n,r){return o===e&&(o=null,r!==void 0&&(d=!0),(e===s||t===s)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(r,{value:t})),s=Dz,kz&&e&&l?(kz.promises.delete(e),l=!1,TR(()=>{kz.running=!0,C(t,n)},!1)):C(t,n)),t}function C(e,t){TR(()=>{t===void 0&&h(()=>e),x(t===void 0?d?`ready`:`unresolved`:`errored`),_(t);for(let e of p.keys())e.decrement();p.clear()},!1)}function w(){let e=Iz&&_R(Iz),t=m(),n=g();if(n!==void 0&&!o)throw n;return Az&&!Az.user&&e&&iR(()=>{v(),o&&(e.resolved&&kz&&l?kz.promises.add(o):p.has(e)||(e.increment(),p.add(e)))}),t}function T(e=!0){if(e!==!1&&u)return;u=!1;let t=f?f():r;if(l=kz&&kz.running,t==null||t===!1){S(o,uR(m));return}kz&&o&&kz.promises.delete(o);let n,a=s===Dz?uR(()=>{try{return i(t,{value:m(),refetching:e})}catch(e){n=e}}):s;if(n!==void 0){S(o,void 0,NR(n),t);return}else if(!sR(a))return S(o,a,void 0,t),a;return o=a,`v`in a?(a.s===1?S(o,a.v,void 0,t):S(o,void 0,NR(a.v),t),a):(u=!0,queueMicrotask(()=>u=!1),TR(()=>{x(d?`refreshing`:`pending`),y()},!1),a.then(e=>S(a,e,void 0,t),e=>S(a,void 0,NR(e),t)))}Object.defineProperties(w,{state:{get:()=>b()},error:{get:()=>g()},loading:{get(){let e=b();return e===`pending`||e===`refreshing`}},latest:{get(){if(!d)return w();let e=g();if(e&&!o)throw e;return m()}}});let ee=Oz;return f?iR(()=>(ee=Oz,T(!1))):T(!1),[w,{refetch:e=>hR(ee,()=>T(e)),mutate:h}]}function lR(e){return TR(e,!1)}function uR(e){if(Az===null)return e();let t=Az;Az=null;try{return e()}finally{Az=t}}function dR(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=uR(()=>t(o,i,n));return i=o,s}}function fR(e){oR(()=>uR(e))}function pR(e){return Oz===null||(Oz.cleanups===null?Oz.cleanups=[e]:Oz.cleanups.push(e)),e}function mR(){return Az}function hR(e,t){let n=Oz,r=Az;Oz=e,Az=null;try{return TR(t,!0)}catch(e){PR(e)}finally{Oz=n,Az=r}}function gR(e,t){let n=Symbol(`context`);return{id:n,Provider:IR(n),defaultValue:e}}function _R(e){let t;return Oz&&Oz.context&&(t=Oz.context[e.id])!==void 0?t:e.defaultValue}function vR(e){let t=Y(e),n=Y(()=>FR(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}function yR(){let e=kz&&kz.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===1)xR(this);else{let e=jz;jz=null,TR(()=>kR(this),!1),jz=e}if(Az){let e=this.observers?this.observers.length:0;Az.sources?(Az.sources.push(this),Az.sourceSlots.push(e)):(Az.sources=[this],Az.sourceSlots=[e]),this.observers?(this.observers.push(Az),this.observerSlots.push(Az.sources.length-1)):(this.observers=[Az],this.observerSlots=[Az.sources.length-1])}return e&&kz.sources.has(this)?this.tValue:this.value}function bR(e,t,n){let r=kz&&kz.running&&kz.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(kz){let r=kz.running;(r||!n&&kz.sources.has(e))&&(kz.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&TR(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=kz&&kz.running;r&&kz.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?jz.push(n):Mz.push(n),n.observers&&AR(n)),r?n.tState=1:n.state=1)}if(jz.length>1e6)throw jz=[],Error()},!1)}return t}function xR(e){if(!e.fn)return;jR(e);let t=Nz;SR(e,kz&&kz.running&&kz.sources.has(e)?e.tValue:e.value,t),kz&&!kz.running&&kz.sources.has(e)&&queueMicrotask(()=>{TR(()=>{kz&&(kz.running=!0),Az=Oz=e,SR(e,e.tValue,t),Az=Oz=null},!1)})}function SR(e,t,n){let r,i=Oz,a=Az;Az=Oz=e;try{r=e.fn(t)}catch(t){return e.pure&&(kz&&kz.running?(e.tState=1,e.tOwned&&e.tOwned.forEach(jR),e.tOwned=void 0):(e.state=1,e.owned&&e.owned.forEach(jR),e.owned=null)),e.updatedAt=n+1,PR(t)}finally{Az=a,Oz=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?bR(e,r,!0):kz&&kz.running&&e.pure?(kz.sources.has(e)||(e.value=r),kz.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function CR(e,t,n,r=1,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:Oz,context:Oz?Oz.context:null,pure:n};return kz&&kz.running&&(a.state=0,a.tState=r),Oz===null||Oz!==Ez&&(kz&&kz.running&&Oz.pure?Oz.tOwned?Oz.tOwned.push(a):Oz.tOwned=[a]:Oz.owned?Oz.owned.push(a):Oz.owned=[a]),a}function wR(e){let t=kz&&kz.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===2)return kR(e);if(e.suspense&&uR(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Nz);){if(t&&kz.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(kz.disposed.has(t))return}if((t?e.tState:e.state)===1)xR(e);else if((t?e.tState:e.state)===2){let t=jz;jz=null,TR(()=>kR(e,n[0]),!1),jz=t}}}function TR(e,t){if(jz)return e();let n=!1;t||(jz=[]),Mz?n=!0:Mz=[],Nz++;try{let t=e();return ER(n),t}catch(e){n||(Mz=null),jz=null,PR(e)}}function ER(e){if(jz&&=(DR(jz),null),e)return;let t;if(kz){if(!kz.promises.size&&!kz.queue.size){let e=kz.sources,n=kz.disposed;Mz.push.apply(Mz,kz.effects),t=kz.resolve;for(let e of Mz)`tState`in e&&(e.state=e.tState),delete e.tState;kz=null,TR(()=>{for(let e of n)jR(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)jR(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}Fz(!1)},!1)}else if(kz.running){kz.running=!1,kz.effects.push.apply(kz.effects,Mz),Mz=null,Fz(!0);return}}let n=Mz;Mz=null,n.length&&TR(()=>Tz(n),!1),t&&t()}function DR(e){for(let t=0;t<e.length;t++)wR(e[t])}function OR(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:wR(r)}if(yz.context){if(yz.count){yz.effects||=[],yz.effects.push(...e.slice(0,n));return}nR()}for(yz.effects&&(yz.done||!yz.count)&&(e=[...yz.effects,...e],n+=yz.effects.length,delete yz.effects),t=0;t<n;t++)wR(e[t])}function kR(e,t){let n=kz&&kz.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===1?i!==t&&(!i.updatedAt||i.updatedAt<Nz)&&wR(i):e===2&&kR(i,t)}}}function AR(e){let t=kz&&kz.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=2:r.state=2,r.pure?jz.push(r):Mz.push(r),r.observers&&AR(r))}}function jR(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--)jR(e.tOwned[t]);delete e.tOwned}if(kz&&kz.running&&e.pure)MR(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)jR(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}kz&&kz.running?e.tState=0:e.state=0}function MR(e,t){if(t||(e.tState=0,kz.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)MR(e.owned[t])}function NR(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function PR(e,t=Oz){throw NR(e)}function FR(e){if(typeof e==`function`&&!e.length)return FR(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=FR(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function IR(e,t){return function(t){let n;return aR(()=>n=uR(()=>(Oz.context={...Oz.context,[e]:t.value},vR(()=>t.children))),void 0),n}}function LR(e){for(let t=0;t<e.length;t++)e[t]()}function RR(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return pR(()=>LR(a)),()=>{let c=e()||[],l=c.length,u,d;return c[Cz],uR(()=>{let e,t,p,m,h,g,_,v,y;if(l===0)o!==0&&(LR(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Lz],i[0]=rR(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),d=0;d<l;d++)r[d]=c[d],i[d]=rR(f);o=l}else{for(p=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--)p[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),d=v;d>=g;d--)y=c[d],u=e.get(y),t[d]=u===void 0?-1:u,e.set(y,d);for(u=g;u<=_;u++)y=r[u],d=e.get(y),d!==void 0&&d!==-1?(p[d]=i[u],m[d]=a[u],s&&(h[d]=s[u]),d=t[d],e.set(y,d)):a[u]();for(d=g;d<l;d++)d in p?(i[d]=p[d],a[d]=m[d],s&&(s[d]=h[d],s[d](d))):i[d]=rR(f);i=i.slice(0,o=l),r=c.slice(0)}return i});function f(e){if(a[d]=e,s){let[e,n]=J(d);return s[d]=n,t(c[d],e)}return t(c[d])}}}function zR(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return pR(()=>LR(a)),()=>{let l=e()||[],u=l.length;return l[Cz],uR(()=>{if(u===0)return s!==0&&(LR(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[Lz],i[0]=rR(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===Lz&&(a[0](),a=[],r=[],i=[],s=0),c=0;c<u;c++)c<r.length&&r[c]!==l[c]?o[c](()=>l[c]):c>=r.length&&(i[c]=rR(d));for(;c<r.length;c++)a[c]();return s=o.length=a.length=u,r=l.slice(0),i=i.slice(0,s)});function d(e){a[c]=e;let[n,r]=J(l[c]);return o[c]=r,t(n,c)}}}function X(e,t){return uR(()=>e(t||{}))}function BR(){return!0}function VR(e){return(e=typeof e==`function`?e():e)?e:{}}function HR(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function UR(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&xz in r,e[n]=typeof r==`function`?(t=!0,Y(r)):r}if(Sz&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=VR(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in VR(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(VR(e[n])));return[...new Set(t)]}},Rz);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:HR.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 WR(e,...t){let n=t.length;if(Sz&&xz 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)}},Rz));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))}},Rz)),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}function GR(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return Y(RR(()=>e.each,e.children,t||void 0))}function KR(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return Y(zR(()=>e.each,e.children,t||void 0))}function qR(e){let t=e.keyed,n=Y(()=>e.when,void 0,void 0),r=t?n:Y(n,void 0,{equals:(e,t)=>!e==!t});return Y(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?uR(()=>a(t?i:()=>{if(!uR(r))throw zz(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function JR(e){let t=vR(()=>e.children),n=Y(()=>{let e=t(),n=Array.isArray(e)?e:[e],r=()=>void 0;for(let e=0;e<n.length;e++){let t=e,i=n[e],a=r,o=Y(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:Y(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return Y(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?uR(()=>o(a.keyed?i():()=>{if(uR(n)()?.[0]!==r)throw zz(`Match`);return i()})):o},void 0,void 0)}function YR(e){return e}function XR(e,t){let n=Uz[e];return typeof n==`object`?n[t]?n.$:void 0:n}function ZR(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()}}}function QR(e,t,n,r={}){let i;return rR(r=>{i=r,t===document?e():$(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function Z(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?()=>uR(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function $R(e,t=window.document){let n=t[qz]||(t[qz]=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,mz))}}function Q(e,t,n){uz(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function ez(e,t,n,r){uz(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function tz(e,t,n){uz(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function nz(e,t){uz(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function rz(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 iz(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]||(fz(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||(fz(e,i,!0),n[i]=o)}return n}function az(e,t,n){if(!t)return n?Q(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 oz(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function sz(e,t={},n,r){let i={};return r||aR(()=>i.children=hz(e,t.children,i.children)),aR(()=>typeof t.ref==`function`&&cz(t.ref,e)),aR(()=>lz(e,t,n,!0,i,!0)),i}function cz(e,t,n){return uR(()=>e(t,n))}function $(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return hz(e,t,r,n);aR(r=>hz(e,t(),r,n),r)}function lz(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=pz(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||hz(e,t.children);continue}let s=t[o];i[o]=pz(e,o,s,i[o],n,a,t)}}function uz(e){return!!yz.context&&!yz.done&&(!e||e.isConnected)}function dz(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function fz(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 pz(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return az(e,n,r);if(t===`classList`)return iz(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=Wz.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(rz(e,i,n,a),a&&$R([i]))}else if(t.slice(0,5)===`attr:`)Q(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)tz(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=Vz.has(t))||!i&&((u=XR(t,e.tagName))||(c=Bz.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(uz(e))return n;t===`class`||t===`className`?nz(e,n):s&&!c&&!l?e[dz(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&Gz[t.split(`:`)[0]];r?ez(e,r,t,n):Q(e,Hz[t]||t,n)}return n}function mz(e){if(yz.registry&&yz.events&&yz.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,i=e.currentTarget,a=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),o=()=>{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)&&a(t.host),!0},s=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),yz.registry&&!yz.done&&(yz.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();a(n[0]);for(let e=0;e<n.length-2&&(t=n[e],o());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===i)break}}else s();a(r)}function hz(e,t,n,r,i){let a=uz(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=vz(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=vz(e,n,r)}else if(o===`function`)return aR(()=>{let i=t();for(;typeof i==`function`;)i=i();n=hz(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(gz(o,t,n,i))return aR(()=>n=hz(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=vz(e,n,r),s)return n}else c?n.length===0?_z(e,o,r):ZR(e,n,o):(n&&vz(e),_z(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=vz(e,n,r,t);vz(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function gz(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=gz(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=gz(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 _z(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function vz(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 yz,bz,xz,Sz,Cz,wz,Tz,Ez,Dz,Oz,kz,Az,jz,Mz,Nz,Pz,Fz,Iz,Lz,Rz,zz,Bz,Vz,Hz,Uz,Wz,Gz,Kz,qz,Jz,Yz,Xz,Zz,Qz,$z,eB,tB,nB,rB,iB,aB,oB,sB,cB,lB,uB,dB,fB,pB,mB,hB,gB,_B,vB,yB,bB,xB,SB,CB,wB,TB,EB,DB,OB,kB,AB,jB,MB,NB,PB,FB,IB,LB,RB,zB,BB,VB,HB,UB,WB,GB,KB,qB,JB,YB,XB,ZB,QB,$B,eV,tV,nV,rV,iV,aV,oV,sV,cV,lV,uV,dV,fV,pV,mV,hV,gV,_V,vV,yV,bV,xV,SV,CV,wV,TV,EV,DV,OV,kV,AV,jV,MV,NV=t((()=>{eR(),yz={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return tR(this.context.count)},getNextContextId(){return tR(this.context.count++)}},bz=(e,t)=>e===t,xz=Symbol(`solid-proxy`),Sz=typeof Proxy==`function`,Cz=Symbol(`solid-track`),wz={equals:bz},Tz=DR,Ez={owned:null,cleanups:null,context:null,owner:null},Dz={},Oz=null,kz=null,Az=null,jz=null,Mz=null,Nz=0,[Pz,Fz]=J(!1),Lz=Symbol(`fallback`),Rz={get(e,t,n){return t===xz?n:e.get(t)},has(e,t){return t===xz||e.has(t)},set:BR,deleteProperty:BR,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:BR,deleteProperty:BR}},ownKeys(e){return e.keys()}},zz=e=>`Stale read from <${e}>.`,Bz=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(`.`)]),Vz=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),Hz=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),Uz=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}}),Wz=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),Gz={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},Kz=e=>Y(()=>e()),qz=`_$DX_DELEGATE`,Jz=e=>!!(e?.isConnected??e?.ownerDocument?.contains(e)),Yz=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`,`combobox`],Xz=e=>{if(e.composed){let t=e.composedPath()[0];if(t instanceof HTMLElement)return t}else if(e.target instanceof HTMLElement)return e.target},Zz=e=>{if(document.designMode===`on`)return!0;let t=Xz(e);if(!t)return!1;if(t.isContentEditable)return!0;let n=TN(t);return Yz.some(e=>e===n||e===t.role)},Qz=e=>{let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){let e=t.selectionStart??0;return(t.selectionEnd??0)-e>0}return!1},$z=()=>{let e=window.getSelection();return e?e.toString().length>0:!1},eB=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/,tB=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`),nB=(e,t,n,r=1)=>{let i=tB(e),a=tB(t),o=tB(n);return r>=1?`#${i}${a}${o}`:`#${i}${a}${o}${tB(r*255)}`},rB=e=>{if(!e.startsWith(`#`))return null;let t=e.slice(1);if(t.length!==6&&t.length!==8)return null;let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),a=t.length===8?parseInt(t.slice(6,8),16)/255:1;return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)?null:{red:n,green:r,blue:i,alpha:a}},iB=e=>{let t=e.match(eB);if(!t)return null;let n=1;if(t[4]!==void 0){let e=t[4];n=e.endsWith(`%`)?Number(e.slice(0,-1))/100:Number(e)}return nB(Number(t[1]),Number(t[2]),Number(t[3]),n)},aB=e=>{let t=e.match(eB);return!t||t[4]===void 0?!1:(t[4].endsWith(`%`)?Number(t[4].slice(0,-1))/100:Number(t[4]))===0},oB=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,sB=e=>{let t=e.match(oB);if(!t)return null;let n=t[1];return n.length===3?`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`:n.length===4?`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:`#${n}`},cB=`rgba(0, 0, 0, 0)`,lB=/^oklch\(\s*([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+)(deg|grad|rad|turn)?(?:\s*\/\s*([+-]?\d*\.?\d+%?))?\s*\)$/i,uB=180/Math.PI,dB=(e,t)=>e.endsWith(`%`)?Number(e.slice(0,-1))/100*t:Number(e),fB=(e,t)=>{let n=Number(e);return t===`grad`?n*.9:t===`rad`?n*uB:t===`turn`?n*360:n},pB=e=>{let t=Math.max(0,Math.min(1,e));return(t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055)*255},mB=e=>{let t=e.match(lB);if(!t)return null;let n=dB(t[1],1),r=dB(t[2],.4),i=fB(t[3],t[4])*Math.PI/180,a=t[5]===void 0?1:dB(t[5],1);if(![n,r,i,a].every(Number.isFinite))return null;let o=r*Math.cos(i),s=r*Math.sin(i),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return nB(pB(m),pB(h),pB(g),Math.max(0,Math.min(1,a)))},hB=null,gB=()=>hB||(typeof document>`u`?null:(hB=document.createElement(`canvas`).getContext(`2d`,{willReadFrequently:!0}),hB)),_B=(e,t)=>{e.clearRect(0,0,1,1),e.fillStyle=t,e.fillRect(0,0,1,1);let n=e.getImageData(0,0,1,1).data;return n[3]===0?pN:nB(n[0],n[1],n[2],n[3]/255)},vB=e=>{let t=e.trim();if(!t)return null;if(t.toLowerCase()===`transparent`)return pN;let n=sB(t);if(n)return n;let r=mB(t);if(r)return r;let i=gB();if(!i)return null;i.fillStyle=cB,i.fillStyle=t;let a=i.fillStyle;return typeof a==`string`?a.toLowerCase()===cB?t.toLowerCase().replace(/\s+/g,``)===`rgba(0,0,0,0)`?pN:null:a.startsWith(`#`)&&a.length===7?a:a.startsWith(`rgb`)?iB(a):_B(i,t):null},yB=(e,t,n)=>Math.max(t,Math.min(e,n)),bB=null,xB=()=>{if(typeof navigator>`u`||!(`userAgentData`in navigator))return null;let e=navigator.userAgentData;if(typeof e!=`object`||!e||!(`platform`in e))return null;let t=e.platform;return typeof t==`string`?t:null},SB=()=>{if(bB===null){if(typeof navigator>`u`)return bB=!1,bB;let e=navigator.platform??xB()??navigator.userAgent;bB=/Mac|iPhone|iPad|iPod/i.test(e)}return bB},CB=(e,t)=>{try{return e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute(t))}catch{return!1}},wB=`padding-top.padding-right.padding-bottom.padding-left.margin-top.margin-right.margin-bottom.margin-left.gap.row-gap.column-gap.font-size.line-height.letter-spacing.border-radius.border-top-left-radius.border-top-right-radius.border-bottom-right-radius.border-bottom-left-radius.border-width.border-top-width.border-right-width.border-bottom-width.border-left-width.opacity.width.height.min-width.min-height.max-width.max-height.top.right.bottom.left.z-index`.split(`.`),TB=-128,EB=-512,DB=-9999,OB=9999,kB=new Set([`letter-spacing`,`gap`,`row-gap`,`column-gap`]),AB=new Set([`z-index`]),jB=[{key:`padding`,label:`padding`,longhands:[`padding-top`,`padding-right`,`padding-bottom`,`padding-left`]},{key:`padding-top,padding-bottom`,label:`padding-y`,longhands:[`padding-top`,`padding-bottom`]},{key:`padding-left,padding-right`,label:`padding-x`,longhands:[`padding-left`,`padding-right`]},{key:`padding-top`,label:`padding top`,longhands:[`padding-top`]},{key:`padding-right`,label:`padding right`,longhands:[`padding-right`]},{key:`padding-bottom`,label:`padding bottom`,longhands:[`padding-bottom`]},{key:`padding-left`,label:`padding left`,longhands:[`padding-left`]}],MB=[{key:`margin`,label:`margin`,longhands:[`margin-top`,`margin-right`,`margin-bottom`,`margin-left`]},{key:`margin-top,margin-bottom`,label:`margin-y`,longhands:[`margin-top`,`margin-bottom`]},{key:`margin-left,margin-right`,label:`margin-x`,longhands:[`margin-left`,`margin-right`]},{key:`margin-top`,label:`margin top`,longhands:[`margin-top`]},{key:`margin-right`,label:`margin right`,longhands:[`margin-right`]},{key:`margin-bottom`,label:`margin bottom`,longhands:[`margin-bottom`]},{key:`margin-left`,label:`margin left`,longhands:[`margin-left`]}],NB=[{key:`gap`,label:`gap`,longhands:[`row-gap`,`column-gap`]},{key:`row-gap`,label:`row gap`,longhands:[`row-gap`]},{key:`column-gap`,label:`column gap`,longhands:[`column-gap`]}],PB=[{key:`border-radius`,label:`border radius`,longhands:[`border-top-left-radius`,`border-top-right-radius`,`border-bottom-right-radius`,`border-bottom-left-radius`]},{key:`border-top-left-radius,border-top-right-radius`,label:`top corners`,longhands:[`border-top-left-radius`,`border-top-right-radius`]},{key:`border-bottom-left-radius,border-bottom-right-radius`,label:`bottom corners`,longhands:[`border-bottom-left-radius`,`border-bottom-right-radius`]},{key:`border-top-left-radius,border-bottom-left-radius`,label:`left corners`,longhands:[`border-top-left-radius`,`border-bottom-left-radius`]},{key:`border-top-right-radius,border-bottom-right-radius`,label:`right corners`,longhands:[`border-top-right-radius`,`border-bottom-right-radius`]},{key:`border-top-left-radius`,label:`top left radius`,longhands:[`border-top-left-radius`]},{key:`border-top-right-radius`,label:`top right radius`,longhands:[`border-top-right-radius`]},{key:`border-bottom-right-radius`,label:`bottom right radius`,longhands:[`border-bottom-right-radius`]},{key:`border-bottom-left-radius`,label:`bottom left radius`,longhands:[`border-bottom-left-radius`]}],FB=[{key:`top,right,bottom,left`,label:`inset`,longhands:[`top`,`right`,`bottom`,`left`]},{key:`top,bottom`,label:`inset-y`,longhands:[`top`,`bottom`]},{key:`left,right`,label:`inset-x`,longhands:[`left`,`right`]},{key:`top`,label:`top`,longhands:[`top`]},{key:`right`,label:`right`,longhands:[`right`]},{key:`bottom`,label:`bottom`,longhands:[`bottom`]},{key:`left`,label:`left`,longhands:[`left`]}],IB=new Set(FB.map(e=>e.key)),LB=[jB,MB,NB,PB,[{key:`border-width`,label:`border width`,longhands:[`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`]},{key:`border-top-width`,label:`border top width`,longhands:[`border-top-width`]},{key:`border-right-width`,label:`border right width`,longhands:[`border-right-width`]},{key:`border-bottom-width`,label:`border bottom width`,longhands:[`border-bottom-width`]},{key:`border-left-width`,label:`border left width`,longhands:[`border-left-width`]}],[{key:`width,height`,label:`size`,longhands:[`width`,`height`]},{key:`width`,label:`width`,longhands:[`width`]},{key:`height`,label:`height`,longhands:[`height`]}],FB],RB=[{key:`font-size`,label:`font size`},{key:`line-height`,label:`line height`},{key:`letter-spacing`,label:`letter spacing`},{key:`min-width`,label:`min width`},{key:`min-height`,label:`min height`},{key:`max-width`,label:`max width`},{key:`max-height`,label:`max height`},{key:`z-index`,label:`z-index`},{key:`opacity`,label:`opacity`}],zB=[{key:`color`,label:`text color`,alwaysShow:!0},{key:`background-color`,label:`background`,alwaysShow:!0},{key:`border-color`,label:`border color`},{key:`fill`,label:`fill`},{key:`stroke`,label:`stroke`}],BB=[{value:`ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,label:`sans`},{value:`ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`,label:`serif`},{value:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,label:`mono`},{value:`system-ui, sans-serif`,label:`system`},{value:`serif`,label:`serif`},{value:`monospace`,label:`mono`}],VB=e=>{let t=e.trim();return BB.some(e=>e.value===t)?BB:[{value:t,label:`current`},...BB]},HB={key:`font-family`,label:`font family`},UB=[{key:`display`,label:`display`,options:[{value:`block`,label:`block`},{value:`flex`,label:`flex`},{value:`inline-block`,label:`inline-block`},{value:`inline`,label:`inline`},{value:`grid`,label:`grid`},{value:`none`,label:`none`}]},{key:`text-align`,label:`text align`,options:[{value:`left`,label:`left`},{value:`center`,label:`center`},{value:`right`,label:`right`},{value:`justify`,label:`justify`}]},{key:`font-style`,label:`font style`,options:[{value:`normal`,label:`normal`},{value:`italic`,label:`italic`}]},{key:`text-transform`,label:`text transform`,options:[{value:`none`,label:`none`},{value:`uppercase`,label:`uppercase`},{value:`lowercase`,label:`lowercase`},{value:`capitalize`,label:`capitalize`}]},{key:`white-space`,label:`white space`,options:[{value:`normal`,label:`normal`},{value:`nowrap`,label:`nowrap`},{value:`pre`,label:`pre`},{value:`pre-wrap`,label:`pre-wrap`},{value:`pre-line`,label:`pre-line`},{value:`break-spaces`,label:`break-spaces`}]},{key:`word-break`,label:`word break`,options:[{value:`normal`,label:`normal`},{value:`break-all`,label:`break-all`},{value:`keep-all`,label:`keep-all`}]},{key:`overflow-wrap`,label:`wrap`,options:[{value:`normal`,label:`normal`},{value:`break-word`,label:`break-word`},{value:`anywhere`,label:`anywhere`}]},{key:`font-variant-numeric`,label:`number style`,options:[{value:`normal`,label:`normal`},{value:`tabular-nums`,label:`tabular`},{value:`proportional-nums`,label:`proportional`},{value:`lining-nums`,label:`lining`},{value:`oldstyle-nums`,label:`oldstyle`},{value:`slashed-zero`,label:`slashed zero`}]},{key:`text-decoration-line`,label:`decoration`,options:[{value:`none`,label:`none`},{value:`underline`,label:`underline`},{value:`line-through`,label:`strike`}]},{key:`border-style`,label:`border style`,options:[{value:`none`,label:`none`},{value:`solid`,label:`solid`},{value:`dashed`,label:`dashed`},{value:`dotted`,label:`dotted`}]},{key:`visibility`,label:`visibility`,options:[{value:`visible`,label:`visible`},{value:`hidden`,label:`hidden`}]},{key:`align-items`,label:`align items`,options:[{value:`stretch`,label:`stretch`},{value:`flex-start`,label:`start`},{value:`center`,label:`center`},{value:`flex-end`,label:`end`},{value:`baseline`,label:`baseline`}]},{key:`justify-content`,label:`justify content`,options:[{value:`flex-start`,label:`start`},{value:`center`,label:`center`},{value:`flex-end`,label:`end`},{value:`space-between`,label:`between`},{value:`space-around`,label:`around`},{value:`space-evenly`,label:`evenly`}]},{key:`font-weight`,label:`font weight`,options:[{value:`100`,label:`thin`},{value:`200`,label:`extra-light`},{value:`300`,label:`light`},{value:`400`,label:`normal`},{value:`500`,label:`medium`},{value:`600`,label:`semibold`},{value:`700`,label:`bold`},{value:`800`,label:`extra-bold`},{value:`900`,label:`black`}]}],WB=[...wB,`color`,`background-color`,`border-color`,`fill`,`stroke`,`font-family`,`display`,`text-align`,`font-style`,`text-transform`,`white-space`,`word-break`,`overflow-wrap`,`font-variant-numeric`,`text-decoration-line`,`border-style`,`visibility`,`align-items`,`justify-content`,`font-weight`],GB=e=>Number.isInteger(e)?e:Math.round(e*100)/100,KB=e=>Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,``),qB=e=>Number.isFinite(e)?KB(GB(e)):String(e),JB=e=>Math.round(e),YB=(e,t)=>{if(e.kind===`color`||e.kind===`enum`)return typeof t==`string`?t:e.value;let n=typeof t==`number`?t:e.value;return e.key===`opacity`&&e.unit===`%`?KB(GB(n/100)):`${KB(GB(n))}${e.unit}`},XB={slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#64748b`,600:`#475569`,700:`#334155`,800:`#1e293b`,900:`#0f172a`,950:`#020617`},gray:{50:`#f9fafb`,100:`#f3f4f6`,200:`#e5e7eb`,300:`#d1d5db`,400:`#9ca3af`,500:`#6b7280`,600:`#4b5563`,700:`#374151`,800:`#1f2937`,900:`#111827`,950:`#030712`},zinc:{50:`#fafafa`,100:`#f4f4f5`,200:`#e4e4e7`,300:`#d4d4d8`,400:`#a1a1aa`,500:`#71717a`,600:`#52525b`,700:`#3f3f46`,800:`#27272a`,900:`#18181b`,950:`#09090b`},neutral:{50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},stone:{50:`#fafaf9`,100:`#f5f5f4`,200:`#e7e5e4`,300:`#d6d3d1`,400:`#a8a29e`,500:`#78716c`,600:`#57534e`,700:`#44403c`,800:`#292524`,900:`#1c1917`,950:`#0c0a09`},red:{50:`#fef2f2`,100:`#fee2e2`,200:`#fecaca`,300:`#fca5a5`,400:`#f87171`,500:`#ef4444`,600:`#dc2626`,700:`#b91c1c`,800:`#991b1b`,900:`#7f1d1d`,950:`#450a0a`},orange:{50:`#fff7ed`,100:`#ffedd5`,200:`#fed7aa`,300:`#fdba74`,400:`#fb923c`,500:`#f97316`,600:`#ea580c`,700:`#c2410c`,800:`#9a3412`,900:`#7c2d12`,950:`#431407`},amber:{50:`#fffbeb`,100:`#fef3c7`,200:`#fde68a`,300:`#fcd34d`,400:`#fbbf24`,500:`#f59e0b`,600:`#d97706`,700:`#b45309`,800:`#92400e`,900:`#78350f`,950:`#451a03`},yellow:{50:`#fefce8`,100:`#fef9c3`,200:`#fef08a`,300:`#fde047`,400:`#facc15`,500:`#eab308`,600:`#ca8a04`,700:`#a16207`,800:`#854d0e`,900:`#713f12`,950:`#422006`},lime:{50:`#f7fee7`,100:`#ecfccb`,200:`#d9f99d`,300:`#bef264`,400:`#a3e635`,500:`#84cc16`,600:`#65a30d`,700:`#4d7c0f`,800:`#3f6212`,900:`#365314`,950:`#1a2e05`},green:{50:`#f0fdf4`,100:`#dcfce7`,200:`#bbf7d0`,300:`#86efac`,400:`#4ade80`,500:`#22c55e`,600:`#16a34a`,700:`#15803d`,800:`#166534`,900:`#14532d`,950:`#052e16`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#10b981`,600:`#059669`,700:`#047857`,800:`#065f46`,900:`#064e3b`,950:`#022c22`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#14b8a6`,600:`#0d9488`,700:`#0f766e`,800:`#115e59`,900:`#134e4a`,950:`#042f2e`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#06b6d4`,600:`#0891b2`,700:`#0e7490`,800:`#155e75`,900:`#164e63`,950:`#083344`},sky:{50:`#f0f9ff`,100:`#e0f2fe`,200:`#bae6fd`,300:`#7dd3fc`,400:`#38bdf8`,500:`#0ea5e9`,600:`#0284c7`,700:`#0369a1`,800:`#075985`,900:`#0c4a6e`,950:`#082f49`},blue:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#3b82f6`,600:`#2563eb`,700:`#1d4ed8`,800:`#1e40af`,900:`#1e3a8a`,950:`#172554`},indigo:{50:`#eef2ff`,100:`#e0e7ff`,200:`#c7d2fe`,300:`#a5b4fc`,400:`#818cf8`,500:`#6366f1`,600:`#4f46e5`,700:`#4338ca`,800:`#3730a3`,900:`#312e81`,950:`#1e1b4b`},violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#8b5cf6`,600:`#7c3aed`,700:`#6d28d9`,800:`#5b21b6`,900:`#4c1d95`,950:`#2e1065`},purple:{50:`#faf5ff`,100:`#f3e8ff`,200:`#e9d5ff`,300:`#d8b4fe`,400:`#c084fc`,500:`#a855f7`,600:`#9333ea`,700:`#7e22ce`,800:`#6b21a8`,900:`#581c87`,950:`#3b0764`},fuchsia:{50:`#fdf4ff`,100:`#fae8ff`,200:`#f5d0fe`,300:`#f0abfc`,400:`#e879f9`,500:`#d946ef`,600:`#c026d3`,700:`#a21caf`,800:`#86198f`,900:`#701a75`,950:`#4a044e`},pink:{50:`#fdf2f8`,100:`#fce7f3`,200:`#fbcfe8`,300:`#f9a8d4`,400:`#f472b6`,500:`#ec4899`,600:`#db2777`,700:`#be185d`,800:`#9d174d`,900:`#831843`,950:`#500724`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#f43f5e`,600:`#e11d48`,700:`#be123c`,800:`#9f1239`,900:`#881337`,950:`#4c0519`}},ZB={p:`padding`,px:`padding-left,padding-right`,py:`padding-top,padding-bottom`,pt:`padding-top`,pr:`padding-right`,pb:`padding-bottom`,pl:`padding-left`,ps:`padding-left`,pe:`padding-right`,m:`margin`,mx:`margin-left,margin-right`,my:`margin-top,margin-bottom`,mt:`margin-top`,mr:`margin-right`,mb:`margin-bottom`,ml:`margin-left`,ms:`margin-left`,me:`margin-right`,gap:`gap`,"gap-x":`column-gap`,"gap-y":`row-gap`,text:`font-size`,leading:`line-height`,tracking:`letter-spacing`,rounded:`border-radius`,"rounded-t":`border-top-left-radius,border-top-right-radius`,"rounded-b":`border-bottom-left-radius,border-bottom-right-radius`,"rounded-l":`border-top-left-radius,border-bottom-left-radius`,"rounded-r":`border-top-right-radius,border-bottom-right-radius`,"rounded-tl":`border-top-left-radius`,"rounded-tr":`border-top-right-radius`,"rounded-bl":`border-bottom-left-radius`,"rounded-br":`border-bottom-right-radius`,border:`border-width`,"border-t":`border-top-width`,"border-r":`border-right-width`,"border-b":`border-bottom-width`,"border-l":`border-left-width`,w:`width`,h:`height`,size:`width,height`,"max-w":`max-width`,"max-h":`max-height`,"min-w":`min-width`,"min-h":`min-height`,opacity:`opacity`,inset:`top,right,bottom,left`,"inset-x":`left,right`,"inset-y":`top,bottom`,top:`top`,right:`right`,bottom:`bottom`,left:`left`,z:`z-index`,items:`align-items`,justify:`justify-content`,font:`font-weight`,whitespace:`white-space`},QB={"font-size":[`font-size`,`font size`,`text-size`,`text size`],color:[`color`,`text-color`,`text color`,`text-colour`,`text colour`,`foreground`,`fg`],"background-color":[`background`,`background-color`,`background color`,`bg`,`bg-color`,`bg color`],"border-color":[`border-color`,`border color`],fill:[`fill`,`fill-color`,`fill color`],stroke:[`stroke`,`stroke-color`,`stroke color`],"font-family":[`font`,`font-sans`,`font-serif`,`font-mono`,`family`,`sans`,`serif`,`mono`],"font-style":[`italic`,`not-italic`],"text-align":[`text-left`,`text-center`,`text-right`,`text-justify`],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-decoration-line":[`underline`,`line-through`,`no-underline`],"white-space":[`whitespace`,`whitespace-normal`,`whitespace-nowrap`,`whitespace-pre`],"word-break":[`break-normal`,`break-all`,`break-keep`],"overflow-wrap":[`break-words`,`break-anywhere`],"font-variant-numeric":[`tabular-nums`,`proportional-nums`,`lining-nums`,`oldstyle-nums`],"border-style":[`border-solid`,`border-dashed`,`border-dotted`,`border-none`]},$B=(()=>{let e={};for(let[t,n]of Object.entries(ZB))n!==void 0&&(e[n]??=new Set).add(t);let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=Array.from(r));for(let[e,n]of Object.entries(QB)){let r=new Set([...t[e]??[],...n]);t[e]=Array.from(r)}return t})(),eV={text:`color`,bg:`background-color`,border:`border-color`,"border-x":`border-color`,"border-y":`border-color`,"border-t":`border-color`,"border-r":`border-color`,"border-b":`border-color`,"border-l":`border-color`,"border-s":`border-color`,"border-e":`border-color`,fill:`fill`,stroke:`stroke`},tV=e=>ZB[e]!==void 0||eV[e]!==void 0,nV=e=>{let t=0,n=-1;for(let r=0;r<e.length;r++){let i=e[r];i===`[`?t++:i===`]`?t--:i===`:`&&t===0&&(n=r)}let r=n>=0?e.slice(n+1):e;return r.startsWith(`!`)?r.slice(1):r},rV=e=>{let t=nV(e);if(!t)return null;let n=t.indexOf(`[`);if(n>0)return t.slice(0,n).replace(/-$/,``)||null;let r=t.split(`-`).filter(Boolean);if(r.length===0)return null;for(let e=r.length;e>=1;e--){let t=r.slice(0,e).join(`-`);if(tV(t))return t}return r[0]},iV=/-(red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone|black|white|transparent|current|inherit)\b/,aV=(e,t)=>e!==`text`&&e!==`bg`&&e!==`border`&&!e.startsWith(`border-`)?!1:iV.test(t),oV=new Set(`color.red.orange.amber.yellow.lime.green.emerald.teal.cyan.sky.blue.indigo.violet.purple.fuchsia.pink.rose.slate.gray.grey.zinc.neutral.stone.black.white.transparent.current.currentcolor.inherit.primary.secondary.accent.muted.foreground.background.destructive.success.warning.error.info.card.popover.input.ring`.split(`.`)),sV=new Set([`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`,`9xl`]),cV=/^(#|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color:|color\(|var\(--.*color)/,lV=/^(-?\d|length:|size:)/,uV=e=>e.trim().toLowerCase().replace(/\s+/g,`-`).replace(/([a-z])(\d)/g,`$1-$2`),dV=e=>cV.test(e)&&!lV.test(e),fV=(e,t)=>{if(e===t)return``;let n=`${t}-`;return e.startsWith(n)?e.slice(n.length):null},pV=e=>{let t=nV(uV(e)),n=rV(t);if(!n)return null;let r=eV[n];if(!r)return null;let i=t.indexOf(`[`);if(i>=0)return dV(t.slice(i+1).replace(/\]$/,``))?r:null;let a=fV(t,n);if(a===null)return null;if(n===`bg`&&a===``||(n===`fill`||n===`stroke`)&&a===``)return r;let o=a.split(`-`)[0];return n===`text`&&sV.has(o)?null:oV.has(o)?r:null},mV={black:`#000000`,white:`#ffffff`,transparent:pN},hV=e=>{let t=nV(uV(e)),n=rV(t);if(!n||eV[n]===void 0||t.includes(`[`))return null;let r=fV(t,n);if(!r)return null;let i=mV[r];if(i)return i;let a=r.lastIndexOf(`-`);if(a<0)return null;let o=r.slice(0,a),s=o===`grey`?`gray`:o,c=Number.parseInt(r.slice(a+1),10);return XB[s]?.[c]??null},gV=/^-?\d/,_V=(e,t)=>{if(t===``||t.startsWith(`[`)||gV.test(t))return!0;let n=t.split(`-`)[0];return e===`text`?sV.has(n):e===`font`||e===`border`||e.startsWith(`border-`)?!1:(e===`rounded`||e.startsWith(`rounded-`),!0)},vV={"font-sans":{property:`font-family`,value:`ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`},"font-serif":{property:`font-family`,value:`ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`},"font-mono":{property:`font-family`,value:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`},"font-thin":{property:`font-weight`,value:`100`},"font-extralight":{property:`font-weight`,value:`200`},"font-light":{property:`font-weight`,value:`300`},"font-normal":{property:`font-weight`,value:`400`},"font-medium":{property:`font-weight`,value:`500`},"font-semibold":{property:`font-weight`,value:`600`},"font-bold":{property:`font-weight`,value:`700`},"font-extrabold":{property:`font-weight`,value:`800`},"font-black":{property:`font-weight`,value:`900`},"text-left":{property:`text-align`,value:`left`},"text-center":{property:`text-align`,value:`center`},"text-right":{property:`text-align`,value:`right`},"text-justify":{property:`text-align`,value:`justify`},italic:{property:`font-style`,value:`italic`},"not-italic":{property:`font-style`,value:`normal`},uppercase:{property:`text-transform`,value:`uppercase`},lowercase:{property:`text-transform`,value:`lowercase`},capitalize:{property:`text-transform`,value:`capitalize`},"normal-case":{property:`text-transform`,value:`none`},underline:{property:`text-decoration-line`,value:`underline`},"line-through":{property:`text-decoration-line`,value:`line-through`},"no-underline":{property:`text-decoration-line`,value:`none`},"whitespace-normal":{property:`white-space`,value:`normal`},"whitespace-nowrap":{property:`white-space`,value:`nowrap`},"whitespace-pre":{property:`white-space`,value:`pre`},"whitespace-pre-line":{property:`white-space`,value:`pre-line`},"whitespace-pre-wrap":{property:`white-space`,value:`pre-wrap`},"whitespace-break-spaces":{property:`white-space`,value:`break-spaces`},"break-normal":{property:`word-break`,value:`normal`},"break-all":{property:`word-break`,value:`break-all`},"break-keep":{property:`word-break`,value:`keep-all`},"break-words":{property:`overflow-wrap`,value:`break-word`},"break-anywhere":{property:`overflow-wrap`,value:`anywhere`},"tabular-nums":{property:`font-variant-numeric`,value:`tabular-nums`},"proportional-nums":{property:`font-variant-numeric`,value:`proportional-nums`},"lining-nums":{property:`font-variant-numeric`,value:`lining-nums`},"oldstyle-nums":{property:`font-variant-numeric`,value:`oldstyle-nums`},"slashed-zero":{property:`font-variant-numeric`,value:`slashed-zero`},"border-solid":{property:`border-style`,value:`solid`},"border-dashed":{property:`border-style`,value:`dashed`},"border-dotted":{property:`border-style`,value:`dotted`},"border-none":{property:`border-style`,value:`none`}},yV=e=>{let t=uV(e);if(!t)return[];let n=wV(t);if(n)return[n.property];let r=pV(t);return r?[r]:[]},bV=e=>{let t=uV(e);if(!t)return[];let n=rV(t);if(!n)return[];let r=fV(nV(t),n);if(r===null||!_V(n,r))return[];let i=CV(n);return i?[i]:[]},xV=e=>{let t=e.getAttribute(`class`);if(!t)return new Set;let n=t.split(/\s+/).filter(Boolean),r=new Set;for(let e of n){let t=rV(e);if(!t||aV(t,e))continue;let n=wV(e);if(n){r.add(n.property);continue}let i=CV(t);i&&r.add(i)}return r},SV=e=>$B[e]??[],CV=e=>{let t=ZB[e];return t===void 0?null:t},wV=e=>{let t=vV[nV(e)];return t===void 0?null:t},TV=`react-grab-toolbar-state`,EV=()=>{try{let e=localStorage.getItem(TV);if(!e)return null;let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t,r=typeof n.collapsed==`boolean`&&n.collapsed;return{edge:n.edge===`top`||n.edge===`bottom`||n.edge===`left`||n.edge===`right`?n.edge:`bottom`,ratio:typeof n.ratio==`number`?n.ratio:rN,collapsed:r,enabled:!r,defaultAction:typeof n.defaultAction==`string`?n.defaultAction:iN}}catch(e){console.warn(`[react-grab] Failed to load toolbar state from localStorage:`,e)}return null},DV=e=>{try{localStorage.setItem(TV,JSON.stringify(e))}catch(e){console.warn(`[react-grab] Failed to save toolbar state to localStorage:`,e)}},OV=e=>{let[t,n]=J(!1);return fR(()=>{let t=EM(t=>n(e(t))),r=()=>n(!1);window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,t,{capture:!0}),window.addEventListener(`blur`,r),pR(()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,t,{capture:!0}),window.removeEventListener(`blur`,r)})}),t},kV=e=>e.key===`Enter`,AV=e=>e.metaKey||e.ctrlKey,jV=(e,t,n={})=>{if(!t.key)return null;if(kV(t))return e.find(e=>e.shortcut===`Enter`)??null;if(t.repeat)return null;let r=t.key.toLowerCase();return AV(t)?n.includeModifierShortcuts===!0?e.find(e=>e.shortcut!==void 0&&e.shortcut!==`Enter`&&e.shortcutModifier!==!1&&r===e.shortcut.toLowerCase())??null:null:e.find(e=>e.shortcut!==void 0&&e.shortcutModifier===!1&&r===e.shortcut.toLowerCase())??null},MV=()=>{let e=!1;return{arm:()=>{e=!0},clear:()=>{e=!1},consume:()=>e?(e=!1,!0):!1}}})),PV,FV,IV,LV,RV,zV,BV,VV,HV,UV,WV,GV,KV,qV,JV,YV,XV,ZV,QV,$V,eH,tH,nH,rH,iH,aH,oH,sH,cH,lH,uH,dH,fH,pH,mH,hH,gH,_H,vH,yH,bH,xH,SH,CH,wH,TH,EH,DH,OH,kH,AH,jH,MH,NH,PH,FH,IH,LH,RH,zH,BH,VH,HH,UH,WH,GH,KH,qH,JH,YH,XH,ZH,QH,$H,eU,tU,nU,rU,iU,aU,oU,sU,cU,lU,uU,dU,fU,pU,mU,hU,gU,_U,vU,yU,bU,xU,SU,CU,wU,TU,EU,DU,OU,kU,AU,jU,MU,NU,PU,FU,IU,LU,RU,zU,BU,VU,HU,UU,WU,GU=t((()=>{eR(),PV=class extends Error{constructor(e){super(e),this.name=`ReactGrabError`}},FV=class extends PV{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},IV=class extends PV{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},LV=class extends PV{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},RV=class extends PV{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}},zV=e=>e===void 0||!Number.isFinite(e)?3:Math.max(0,Math.floor(e)),BV=e=>{try{return decodeURIComponent(e)}catch{return e}},VV=/(?:^|[/\\])node_modules[/\\]/,HV=/[/\\]\.vite[/\\]deps[^/\\]*[/\\]/,UV=/\.[mc]?[jt]sx?$/i,WV=/^chunk-[A-Za-z0-9_-]+$/,GV=/[/\\]/,KV=/^(.+?)@v?\d/,qV=e=>e.split(GV).filter(Boolean),JV=e=>{let[t,n]=qV(e);return!t||t.startsWith(`.`)?null:t.startsWith(`@`)?n?`${t}/${n}`:null:t},YV=e=>{let t=qV(e)[0];if(!t)return null;let n=t.replace(UV,``);if(WV.test(n))return null;if(!n.startsWith(`@`))return n;let r=n.indexOf(`_`);return r===-1?null:`${n.slice(0,r)}/${n.slice(r+1)}`},XV=(e,t,n)=>{let r=e.split(t);return r.length>1?n(r[r.length-1]):null},ZV=e=>e?.match(KV)?.[1]??null,QV=e=>{let t;try{t=new URL(e)}catch{return null}if(!t.hostname)return null;let n=qV(t.pathname).map(BV);for(let[e,t]of n.entries()){if(t.startsWith(`@`)){let r=ZV(n[e+1]);if(r)return`${t}/${r}`;continue}let r=ZV(t);if(r)return r}return null},$V=e=>XV(e,HV,YV)??XV(e,VV,JV),eH=e=>{if(!e)return null;let t=nF(e);return t&&($V(BV(t))||QV(e))||null},tH=/^@[A-Za-z0-9][A-Za-z0-9._-]*$/,nH=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,rH=new Set([`app`,`web`,`website`,`frontend`,`client`,`src`]),iH=new Set([`app`,`src`,`components`,`pages`,`features`,`modules`,`hooks`,`lib`,`utils`,`ui`,`shared`,`common`,`core`,`styles`,`assets`]),aH=e=>{let t=e;for(;t.startsWith(`../`)||t.startsWith(`./`);)t=t.slice(t.startsWith(`../`)?3:2);return t},oH=e=>{let t=aH(BV(nF(e)));if(t.startsWith(`/`))return null;let[n,r,...i]=qV(t);return!n||!r||i.length===0||!tH.test(n)||iH.has(n.slice(1))||!nH.test(r)||UV.test(r)||rH.has(r)?null:`${n}/${r}`},sH=e=>e?eH(e)??oH(e):null,cH=e=>{if(!e)return{origin:`unknown`,packageName:null};let t=sH(e);return t?{origin:`package`,packageName:t}:rF(e)?{origin:`app`,packageName:null}:{origin:`unknown`,packageName:null}},lH=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),uH=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},dH=(e,t)=>{let n=lH.has(e)||e.startsWith(`data-`)&&uH(e),r=uH(t)&&t.length<100||t.startsWith(`#`)&&uH(t.slice(1));return n&&r},fH=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},pH=e=>{let t=0;for(let n of e)t+=n.penalty;return t},mH=(e,t)=>pH(e)-pH(t),hH=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r instanceof Element&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},gH=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,_H=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,vH=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&uH(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)uH(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=hH(e,i);a!==void 0&&n.push({name:_H(i,a),penalty:10});let o=hH(e);return o!==void 0&&n.push({name:gH(i,o),penalty:50}),n},yH=(e,t=IM,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...yH(e.slice(1),a,[...n,i]))}return r},bH=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e instanceof Document?e:e.ownerDocument},xH=(e,t)=>t.querySelectorAll(fH(e)).length===1,SH=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=hH(n,e);if(t===void 0)return;r.push({name:_H(e,t),penalty:10}),n=n.parentElement}return xH(r,t)?r:void 0},CH=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new FV;if(e.tagName.toLowerCase()===`html`)return`html`;let i=bH(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(vH(s,r)),s=s.parentElement,c++,c>=3){let t=yH(o);t.sort(mH);for(let r of t){if(Date.now()-a>n){let t=SH(e,i);if(!t)throw new IV(n);return fH(t)}if(xH(r,i)){l=r;break}}}if(!l&&c<3){let e=yH(o);e.sort(mH);for(let t of e){if(Date.now()-a>n)break;if(xH(t,i)){l=t;break}}}if(!l)throw new LV;return fH(l)},wH=e=>e.ownerDocument.body??e.ownerDocument.documentElement,TH=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),EH=e=>e.length>0&&e.length<=120,DH=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},OH=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${CSS.escape(e.id)}`;if(DH(e,t))return t}for(let t of TH){let n=e.getAttribute(t);if(!n||!EH(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(DH(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(DH(e,i))return i}return null},kH=e=>{let t=[],n=wH(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${CSS.escape(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r)+1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${i})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},AH=e=>{let t=OH(e);if(t)return t;try{let t=CH(e,wH(e),200,(e,t)=>dH(e,t)||TH.has(e)&&EH(t));if(t)return t}catch{}return kH(e)},jH=e=>{if(!e)return!1;let t=`/${FF(e)}/`.toLowerCase();return NM.some(e=>t.includes(e))},MH=e=>e.map(e=>`\n in ${e}`).join(``),NH=[`about://React/`,`rsc://React/`],PH=e=>NH.some(t=>e.startsWith(t)),FH=e=>{for(let t of NH){if(!e.startsWith(t))continue;let n=e.indexOf(`/`,t.length);if(n===-1)continue;let r=n+1,i=e.lastIndexOf(`?`);return BV(i>r?e.slice(r,i):e.slice(r))}return e},IH=e=>{if(typeof e!=`object`||!e||!(`status`in e)||e.status!==`fulfilled`||!(`value`in e)||typeof e.value!=`object`||e.value===null||!(`originalStackFrame`in e.value))return null;let t=e.value.originalStackFrame;return typeof t!=`object`||!t||!(`file`in t)||typeof t.file!=`string`||!t.file||`ignored`in t&&t.ignored?null:{file:t.file,line1:`line1`in t&&typeof t.line1==`number`?t.line1:null,column1:`column1`in t&&typeof t.column1==`number`?t.column1:null}},LH=async(e,t)=>{let n=[],r=[];for(let t=0;t<e.length;t++){let i=e[t];!i.isServer||!i.fileName||(n.push(t),r.push({file:FH(i.fileName),methodName:i.functionName??`<unknown>`,line1:i.lineNumber??null,column1:i.columnNumber??null,arguments:[]}))}if(r.length===0)return e;let i=new AbortController,a=setTimeout(()=>i.abort(),PM),o=()=>i.abort();t?.aborted&&i.abort(),t?.addEventListener(`abort`,o);try{let t=await fetch(`${zF()}/__nextjs_original-stack-frames`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({frames:r,isServer:!0,isEdgeServer:!1,isAppDirectory:!0}),priority:`high`,signal:i.signal});if(!t.ok)return e;let a=await t.json();if(!Array.isArray(a))return e;let o=[...e];for(let t=0;t<n.length;t++){let r=IH(a[t]);if(!r)continue;let i=n[t];o[i]={...e[i],fileName:r.file,lineNumber:r.line1??void 0,columnNumber:r.column1??void 0,isSymbolicated:!0}}return o}catch{return e}finally{clearTimeout(a),t?.removeEventListener(`abort`,o)}},RH=e=>{let t=new Map;return fM(e,e=>{if(!FP(e))return!1;let n=WP(e._debugStack.stack);if(!n)return!1;for(let e of dP(n))!e.functionName||!e.fileName||PH(e.fileName)&&(t.has(e.functionName)||t.set(e.functionName,{...e,isServer:!0}));return!1},!0),t},zH=(e,t)=>{if(!t.some(e=>e.isServer&&!e.fileName&&e.functionName))return t;let n=RH(e);return n.size===0?t:t.map(e=>{if(!e.isServer||e.fileName||!e.functionName)return e;let t=n.get(e.functionName);return t?{...e,fileName:t.fileName,lineNumber:t.lineNumber,columnNumber:t.columnNumber}:e})},BH=0,VH=[],HH=()=>BH<3?(BH+=1,Promise.resolve()):new Promise(e=>{VH.push(e)}),UH=()=>{let e=VH.shift();if(e){e();return}--BH},WH=async(e,t,n=FM)=>{await HH();let r=new AbortController,i,a=new Promise(e=>{i=setTimeout(()=>{r.abort(),e(t)},n)}),o=e(r.signal);o.catch(()=>{});try{return await Promise.race([o,a])}finally{clearTimeout(i),UH()}},GH=(e,t)=>e.length>t?`${e.slice(0,t)}...`:e,KH=e=>e.startsWith(`data-react-grab-`),qH=e=>e.replace(/\s+/g,` `).trim(),JH=e=>{let t=[];for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE)continue;let e=qH(n.textContent??``);e&&t.push(e)}return t.join(` `)},YH=e=>e.getAttribute(`aria-hidden`)===`true`||e.hasAttribute(`hidden`)?!0:ZM.has(e.tagName.toLowerCase()),XH=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=qH(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!(e instanceof Element)||YH(e))return n;for(let r of e.childNodes)if(n=XH(r,t,n),n<=0)break;return n},ZH=(e,t)=>{if(YH(e))return``;let n=JH(e);if(!XM.has(t)||n&&e.children.length===0)return n;let r=[];return XH(e,r,100),r.join(` `)},QH=e=>GH(e,15),$H=e=>{let t=[];for(let n of JM){let r=e.getAttribute(n);r&&t.push(`${n}="${r}"`)}return t.length>0?` ${t.join(` `)}`:``},eU=e=>e===`class`||e===`className`||e===`style`,tU=e=>{let t=[],n=[],r=``;for(let{name:i,value:a}of e.attributes)if(!KH(i)){if(eU(i)){i!==`style`&&a&&(r=` class="${QH(a)}"`);continue}YM.has(i)?t.push(a?` ${i}="${a}"`:` ${i}`):a&&n.push(` ${i}="${QH(a)}"`)}return t.join(``)+n.join(``)+r},nU=e=>e.length===0?``:e.length<=2?e.map(e=>`<${TN(e)} ...>`).join(`
|
|
210
|
-
`):`(${e.length} elements)`,rU=e=>{let t=TN(e);if(!(e instanceof HTMLElement))return`<${t}${$H(e)} />`;let n=tU(e),r=GH(ZH(e,t),100);return r?`<${t}${n}>${r}</${t}>`:`<${t}${n} />`},iU=e=>{let t=TN(e),n=tU(e),r=ZH(e,t),i=[],a=[],o=!1;for(let t of e.childNodes)t.nodeType!==Node.COMMENT_NODE&&(t.nodeType===Node.TEXT_NODE?t.textContent&&t.textContent.trim().length>0&&(o=!0):t instanceof Element&&(o?a.push(t):i.push(t)));let s=r.length>0&&XM.has(t),c=``,l=nU(i);l&&!s&&(c+=`\n ${l}`),r&&(c+=`\n ${GH(r,100)}`);let u=nU(a);return u&&!s&&(c+=`\n ${u}`),c.length>0?`<${t}${n}>${c}\n</${t}>`:`<${t}${n} />`},aU=new Set([`_`,`$`,`motion.`,`styled.`,`chakra.`,`ark.`,`Primitive.`,`Slot.`]),oU=new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),sU=new Set([`Suspense`,`Fragment`,`StrictMode`,`Profiler`,`SuspenseList`]),cU=new Set([`MotionDOMComponent`]),lU=e=>{if(oU.has(e)||sU.has(e)||cU.has(e))return!0;for(let t of aU)if(e.startsWith(t))return!0;return!1},uU=e=>!(!e||lU(e)||e===`SlotClone`||e===`Slot`),dU=e=>!(e.length<=1||lU(e)||e[0]!==e[0].toUpperCase()||e.endsWith(`Provider`)||e.endsWith(`Context`)),fU=e=>e&&dU(e)?e:null,pU=e=>{if(!QN())return e;let t=e;for(;t;){if($N(t))return t;t=t.parentElement}return e},mU=e=>{if(!QN())return null;let t=$N(pU(e)),n=0;for(;t;){if(t.key)return t.key;if(qN(t)&&(n+=1,n===2))break;t=t.return}return null},hU=new WeakMap,gU=new WeakMap,_U=e=>t=>fetch(t,{signal:e,priority:`high`}),vU=e=>WH(async t=>{try{let n=$N(e);if(!n)return null;let r=await XP(n,!0,_U(t));return LF()?await LH(zH(n,r),t):r}catch{return null}},null),yU=e=>{if(!QN())return Promise.resolve([]);let t=pU(e),n=hU.get(t);if(n)return n;let r=vU(t).then(e=>(e===null&&hU.delete(t),e));return hU.set(t,r),r},bU=async e=>{if(!QN())return null;let t=await yU(e);if(!t)return null;for(let e of t){let t=fU(e.functionName);if(t)return t}return null},xU=e=>e.find(e=>!!fU(e.functionName))??e[0]??null,SU=e=>!e||!qN(e)?null:fU(ZN(e.type)),CU=e=>WH(async t=>{let n=$N(pU(e));if(!n)return null;try{let e=await QP(n,!0,_U(t));return e?.fileName?{filePath:FF(e.fileName),lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:fU(e.functionName)??SU(n._debugOwner),origin:cH(e.fileName).origin}:null}catch{return null}},null),wU=e=>{let t=pU(e),n=gU.get(t);if(n)return n;let r=CU(t).then(e=>(e||gU.delete(t),e));return gU.set(t,r),r},TU=[`app`,`package`],EU=(e,t)=>{for(let n of TU){if(e?.origin===n)return e;let r=xU(t.filter(e=>cH(e.fileName).origin===n));if(r?.fileName)return{filePath:FF(r.fileName),lineNumber:r.lineNumber??null,columnNumber:r.columnNumber??null,componentName:fU(r.functionName),origin:n}}return null},DU=async e=>{let t=await wU(e);return t?.origin===`app`?t:EU(t,await yU(e)??[])},OU=e=>kU(pU(e),1)[0]??null,kU=(e,t,n=()=>!0)=>{if(!QN())return[];let r=$N(e);if(!r)return[];let i=[];return fM(r,e=>{if(i.length>=t)return!0;if(qN(e)){let t=ZN(e.type);t&&uU(t)&&n(t)&&i.push(t)}return!1},!0),i},AU=[`/src/app/`,`/src/pages/`,`/app/`,`/pages/`],jU=(e,t)=>{let n=FF(e);if(!t||!n.startsWith(`/`))return n;for(let e of AU){let t=n.indexOf(e);if(t!==-1)return`/./${n.slice(t+1)}`}return n},MU=(e,t)=>{let n=jU(e.filePath,t),r=t&&e.lineNumber?`${n}:${e.lineNumber}${e.columnNumber?`:${e.columnNumber}`:``}`:n;return e.componentName?`\n in ${e.componentName} (at ${r})`:`\n in ${r}`},NU={isAppSource:!1,consumesBudget:!1},PU=(e,t,n,r)=>{let i=t.packageName,a=t.origin===`app`?e.fileName:null;if(e.isServer&&!a&&(n||!e.functionName)){let e=i?`${i} at Server`:`at Server`;return{text:`\n in ${n??`<anonymous>`} (${e})`,...NU}}return!a&&n?{text:i?`\n in ${n} (${i})`:`\n in ${n}`,...NU}:i?{text:`\n in ${i}`,...NU}:a?{text:MU({componentName:n,filePath:a,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null},r),isAppSource:!0,consumesBudget:!jH(a)}:null},FU=(e,t={},n=null)=>{let r=zV(t.maxLines),i=Math.max(r,20),a=LF(),o=[],s=new Set,c=null,l=!1,u=!1,d=!1,f=0,p=e=>{e&&s.add(e)};n&&(u=n.origin===`app`,jH(n.filePath)||(f+=1),p(n.componentName),o.push(MU(n,a)));for(let t of e){if(f>=r||o.length>=i)break;let e=cH(t.fileName),s=fU(t.functionName),m=e.packageName?`${e.packageName}:${s??``}:${t.isServer?`server`:`client`}`:null;if(m&&m===c)continue;if(!l&&s&&s===n?.componentName){l=!0;continue}let h=PU(t,e,s,a);h!==null&&h.text!==o[o.length-1]&&(h.isAppSource&&(u=!0),h.consumesBudget&&(f+=1,d=!0),p(s),o.push(h.text),c=m)}return{text:o.join(``),shouldAppendSelectorHint:!u,hasBudgetedStackFrame:d,renderedComponentNames:s}},IU=async e=>{let t=await wU(e);return t?.origin===`app`?t:null},LU=(e,t,n)=>{let r=kU(pU(e),n,e=>dU(e)&&!t.renderedComponentNames.has(e));return r.length===0?t:{...t,text:`${t.text}${MH(r)}`}},RU=async(e,t={})=>{let n=await IU(e),r=await yU(e),i=zV(t.maxLines),a=FU(r??[],t,n);if(a.text)return a.hasBudgetedStackFrame?a:LU(e,a,i);let o=kU(pU(e),i);return{text:MH(o),shouldAppendSelectorHint:!0,hasBudgetedStackFrame:!1,renderedComponentNames:new Set(o)}},zU=async(e,t={})=>(await RU(e,t)).text,BU=(e,t)=>{let n=mU(e),r=n===null?``:`\n key: "${n}"`,i=t.shouldAppendSelectorHint?`\n selector: ${AH(e)}`:``;return`${t.text}${r}${i}`},VU=async(e,t={})=>{let n=await RU(e,t);return`${rU(e)}${BU(e,n).replace(/\n\s+/g,` `)}`},HU=async(e,t={})=>{let n=pU(e);return`${iU(n)}${BU(n,await RU(n,t))}`},UU=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),WU=(e,t)=>{let n=t?.componentName??`div`,r={version:OM,content:e,entries:t?.entries??[{tagName:t?.tagName,componentName:n,content:e,commentText:t?.commentText}],timestamp:Date.now()},i=t=>{t.preventDefault(),t.clipboardData?.setData(`text/plain`,e),t.clipboardData?.setData(`text/html`,`<meta charset='utf-8'><pre><code>${UU(e)}</code></pre>`),t.clipboardData?.setData(`application/x-react-grab`,JSON.stringify(r))};document.addEventListener(`copy`,i);let a=document.createElement(`textarea`);a.value=e,a.style.position=`fixed`,a.style.left=`-9999px`,a.ariaHidden=`true`,document.body.appendChild(a),a.select();try{return typeof document.execCommand==`function`&&document.execCommand(`copy`)}finally{document.removeEventListener(`copy`,i),a.remove()}}})),KU=r({ReactGrabRenderer:()=>pJ}),qU,JU,YU,XU,ZU,QU,$U,eW,tW,nW,rW,iW,aW,oW,sW,cW,lW,uW,dW,fW,pW,mW,hW,gW,_W,vW,yW,bW,xW,SW,CW,wW,TW,EW,DW,OW,kW,AW,jW,MW,NW,PW,FW,IW,LW,RW,zW,BW,VW,HW,UW,WW,GW,KW,qW,JW,YW,XW,ZW,QW,$W,eG,tG,nG,rG,iG,aG,oG,sG,cG,lG,uG,dG,fG,pG,mG,hG,gG,_G,vG,yG,bG,xG,SG,CG,wG,TG,EG,DG,OG,kG,AG,jG,MG,NG,PG,FG,IG,LG,RG,zG,BG,VG,HG,UG,WG,GG,KG,qG,JG,YG,XG,ZG,QG,$G,eK,tK,nK,rK,iK,aK,oK,sK,cK,lK,uK,dK,fK,pK,mK,hK,gK,_K,vK,yK,bK,xK,SK,CK,wK,TK,EK,DK,OK,kK,AK,jK,MK,NK,PK,FK,IK,LK,RK,zK,BK,VK,HK,UK,WK,GK,KK,qK,JK,YK,XK,ZK,QK,$K,eq,tq,nq,rq,iq,aq,oq,sq,cq,lq,uq,dq,fq,pq,mq,hq,gq,_q,vq,yq,bq,xq,Sq,Cq,wq,Tq,Eq,Dq,Oq,kq,Aq,jq,Mq,Nq,Pq,Fq,Iq,Lq,Rq,zq,Bq,Vq,Hq,Uq,Wq,Gq,Kq,qq,Jq,Yq,Xq,Zq,Qq,$q,eJ,tJ,nJ,rJ,iJ,aJ,oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ=t((()=>{NV(),eR(),qU=(e,t,n)=>e+(t-e)*n,JU=(e,t)=>{let n=Math.max(t,1);return 1-(1-e)**(n/BM)},YU=Z(`<canvas data-react-grab-overlay-canvas style=position:fixed;top:0;left:0;pointer-events:none>`),XU={borderColor:WM,fillColor:GM,lerpFactor:jM},ZU={drag:{borderColor:HM,fillColor:UM,lerpFactor:zM},selection:XU,grabbed:XU},QU=e=>{let t,n=null,r=0,i=0,a=1,o=null,s=null,c={drag:{canvas:null,context:null},selection:{canvas:null,context:null},grabbed:{canvas:null,context:null}},l=[],u=null,d=[],f=yM()?`display-p3`:`srgb`,p=(e,t,n)=>{let r=new OffscreenCanvas(e*n,t*n),i=r.getContext(`2d`,{colorSpace:f});return i&&i.scale(n,n),{canvas:r,context:i}},m=()=>{if(t){a=Math.max(window.devicePixelRatio||1,2),r=window.innerWidth,i=window.innerHeight,t.width=r*a,t.height=i*a,t.style.width=`${r}px`,t.style.height=`${i}px`,n=t.getContext(`2d`,{colorSpace:f}),n&&n.scale(a,a);for(let e of Object.keys(c))c[e]=p(r,i,a)}},h=e=>{if(!e)return 0;let t=e.match(/^(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):0},g=(e,t,n)=>({id:e,current:{x:t.x,y:t.y,width:t.width,height:t.height},target:{x:t.x,y:t.y,width:t.width,height:t.height},borderRadius:h(t.borderRadius),opacity:n?.opacity??1,targetOpacity:n?.targetOpacity??n?.opacity??1,createdAt:n?.createdAt,fadeStartTimestamp:null,isInitialized:!0}),_=(e,t,n)=>{let r=e.target;r.x=t.x,r.y=t.y,r.width=t.width,r.height=t.height,e.borderRadius=h(t.borderRadius),n!==void 0&&(e.targetOpacity=n)},v=e=>e.boundsMultiple??[e.bounds],y=(e,t,n,r,i,a,o,s,c=1)=>{if(r<=0||i<=0)return;let l=Math.min(r/2,i/2),u=Math.min(a,l),d=c!==1;d&&(e.globalAlpha=c),e.beginPath(),u>0?e.roundRect(t,n,r,i,u):e.rect(t,n,r,i),e.fillStyle=o,e.fill(),e.strokeStyle=s,e.lineWidth=1,e.stroke(),d&&(e.globalAlpha=1)},b=()=>{let t=c.drag;if(!t.context)return;let n=t.context;if(n.clearRect(0,0,r,i),!e.dragVisible||!u)return;let a=ZU.drag;y(n,u.current.x,u.current.y,u.current.width,u.current.height,u.borderRadius,a.fillColor,a.borderColor)},x=()=>{let t=c.selection;if(!t.context)return;let n=t.context;if(n.clearRect(0,0,r,i),!e.selectionVisible)return;let a=ZU.selection;for(let e of l)y(n,e.current.x,e.current.y,e.current.width,e.current.height,e.borderRadius,a.fillColor,a.borderColor,e.opacity)},S=(e,t)=>{let n=c[e];if(!n.context)return;let a=n.context;a.clearRect(0,0,r,i);let o=ZU[e];for(let e of t)y(a,e.current.x,e.current.y,e.current.width,e.current.height,e.borderRadius,o.fillColor,o.borderColor,e.opacity)},C=()=>{if(!(!n||!t)&&!(r<=0||i<=0)){n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.setTransform(a,0,0,a,0,0),b(),x(),S(`grabbed`,d);for(let e of[`drag`,`selection`,`grabbed`]){let t=c[e];t.canvas&&n.drawImage(t.canvas,0,0,r,i)}}},w=(e,t,n)=>{let r=qU(e.current.x,e.target.x,t),i=qU(e.current.y,e.target.y,t),a=qU(e.current.width,e.target.width,t),o=qU(e.current.height,e.target.height,t),s=Math.abs(r-e.target.x)<.5&&Math.abs(i-e.target.y)<.5&&Math.abs(a-e.target.width)<.5&&Math.abs(o-e.target.height)<.5;e.current.x=s?e.target.x:r,e.current.y=s?e.target.y:i,e.current.width=s?e.target.width:a,e.current.height=s?e.target.height:o;let c=!0;if(n?.interpolateOpacity){let n=qU(e.opacity,e.targetOpacity,t);c=Math.abs(n-e.targetOpacity)<VM,e.opacity=c?e.targetOpacity:n}return!s||!c},T=()=>{let e=performance.now(),t=s===null?BM:e-s;s=e;let n=JU(ZU.drag.lerpFactor,t),r=JU(ZU.selection.lerpFactor,t),i=JU(ZU.grabbed.lerpFactor,t),a=!1;u?.isInitialized&&w(u,n)&&(a=!0);for(let e of l)e.isInitialized&&w(e,r)&&(a=!0);let c=Date.now();d=d.filter(t=>{let n=t.id.startsWith(`label-`);if(t.isInitialized&&w(t,i)&&(a=!0),n&&t.targetOpacity===0){t.fadeStartTimestamp===null&&(t.fadeStartTimestamp=e);let n=e-t.fadeStartTimestamp,r=Math.min(1,n/125),i=1-(1-r)*(1-r);return t.opacity=Math.max(0,1-i),r>=1?!1:(a=!0,!0)}else n&&(t.fadeStartTimestamp=null);if(t.createdAt){let e=c-t.createdAt;if(e>=1625)return!1;if(e>1500){let n=Math.min(1,(e-MM)/125);t.opacity=1-(1-(1-n)*(1-n)),a=!0}return!0}return n?!0:t.opacity>0}),C(),a?o=UF(T):(o=null,s=null)},ee=()=>{o===null&&(o=UF(T))},E=()=>{m(),ee()};return oR(dR(()=>[e.selectionVisible,e.selectionBounds,e.selectionBoundsMultiple,e.selectionShouldSnap],([e,t,n,r])=>{if(!e||!t&&(!n||n.length===0)){l=[],ee();return}let i;i=n&&n.length>0?n:t?[t]:[];let a=new Map;for(let e of l)a.set(e.id,e);l=i.map((e,t)=>{let n=`selection-${t}`,i=a.get(n);return i?(_(i,e),r&&(i.current.x=i.target.x,i.current.y=i.target.y,i.current.width=i.target.width,i.current.height=i.target.height),i):g(n,e)}),ee()})),oR(dR(()=>[e.dragVisible,e.dragBounds],([e,t])=>{if(!e||!t){u=null,ee();return}u?_(u,t):u=g(`drag`,t),ee()})),oR(dR(()=>[e.grabbedBoxes,e.labelInstances],([e,t])=>{let n=e??[],r=t??[],i=new Map;for(let e of n)i.set(e.id,e);let a=new Map;for(let e of d)a.set(e.id,e);for(let e of n)if(!a.has(e.id)){let t=g(e.id,e.bounds,{createdAt:e.createdAt});d.push(t),a.set(e.id,t)}for(let e of d){let t=i.get(e.id);t&&_(e,t.bounds)}let o=new Set;for(let e of r){let t=v(e),n=e.status===`fading`?0:1;for(let r=0;r<t.length;r++){let i=t[r],s=`label-${e.id}-${r}`;o.add(s);let c=a.get(s);if(c)_(c,i,n);else{let e=g(s,i,{opacity:1,targetOpacity:n});d.push(e),a.set(s,e)}}}d=d.filter(e=>e.id.startsWith(`label-`)?o.has(e.id):i.has(e.id)),ee()})),fR(()=>{m(),ee(),window.addEventListener(`resize`,E);let e=null,t=()=>{Math.max(window.devicePixelRatio||1,2)!==a&&(E(),n())},n=()=>{e&&e.removeEventListener(`change`,t),e=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),e.addEventListener(`change`,t)};n(),pR(()=>{window.removeEventListener(`resize`,E),e&&e.removeEventListener(`change`,t),o!==null&&WF(o)})}),(()=>{var e=YU(),n=t;return typeof n==`function`?cz(n,e):t=e,aR(t=>oz(e,`z-index`,String(RM))),e})()},$U=Z(`<div style=position:fixed;pointer-events:none;will-change:opacity;contain:strict;transform:translateZ(0)>`),eW=e=>{let t=wM(),n=t?getComputedStyle(t).borderRadius:`0px`,r=()=>t?.getBoundingClientRect()??null,[i,a]=J(r());if(t){let n=()=>a(r());fR(()=>{let e=new ResizeObserver(n);e.observe(t),window.addEventListener(`scroll`,n,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),pR(()=>{e.disconnect(),window.removeEventListener(`scroll`,n,{capture:!0}),window.removeEventListener(`resize`,n)})}),oR(()=>{e.visible&&n()})}let o=()=>{let e=i();return e?`${e.top}px`:`0`},s=()=>{let e=i();return e?`${e.left}px`:`0`},c=()=>{let e=i();return e?`${e.width}px`:`100%`},l=()=>{let e=i();return e?`${e.height}px`:`100%`};return(()=>{var t=$U();return oz(t,`border-radius`,n),oz(t,`z-index`,RM),oz(t,`transition`,`opacity 125ms ease-out`),oz(t,`box-shadow`,`inset 0 0 50px ${KM}`),aR(n=>{var r=o(),i=s(),a=c(),u=l(),d=+!!e.visible;return r!==n.e&&oz(t,`top`,n.e=r),i!==n.t&&oz(t,`left`,n.t=i),a!==n.a&&oz(t,`width`,n.a=a),u!==n.o&&oz(t,`height`,n.o=u),d!==n.i&&oz(t,`opacity`,n.i=d),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})()},tW=(e,t)=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,t)}px`},nW=(e,t)=>{e&&e.focus(t)},rW=e=>{if(e<=0)return 8;let t=e*qM;return Math.round(Math.max(4,Math.min(8,t)))},iW=()=>{let e=wM();if(e){let t=e.getBoundingClientRect();return{width:t.width,height:t.height,offsetLeft:t.left,offsetTop:t.top}}let t=window.visualViewport;return t?{width:t.width,height:t.height,offsetLeft:t.offsetLeft,offsetTop:t.offsetTop}:{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0}},aW=e=>{if(typeof e==`string`||typeof e==`number`)return String(e);if(!e||typeof e!=`object`)return``;if(Array.isArray(e)){let t=``;for(let n of e){if(!n)continue;let e=aW(n);e&&(t=t?`${t} ${e}`:e)}return t}let t=``;for(let n in e)e[n]&&(t=t?`${t} ${n}`:n);return t},oW=(...e)=>{let t=``;for(let n of e){if(!n)continue;let e=aW(n);e&&(t=t?`${t} ${e}`:e)}return t},sW=e=>e.elementsCount&&e.elementsCount>1?{tagName:`${e.elementsCount} elements`,componentName:void 0}:{tagName:e.tagName||e.componentName||`element`,componentName:e.tagName?e.componentName:void 0},cW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M19.2929 12.7071C19.6834 13.0976 20.3166 13.0976 20.7071 12.7071C21.0976 12.3166 21.0976 11.6834 20.7071 11.2929L12.7071 3.29289C12.5196 3.10536 12.2652 3 12 3C11.7348 3 11.4804 3.10536 11.2929 3.29289L3.29289 11.2929C2.90237 11.6834 2.90237 12.3166 3.29289 12.7071C3.68342 13.0976 4.31658 13.0976 4.70711 12.7071L11 6.41421L11 20C11 20.5523 11.4477 21 12 21C12.5523 21 13 20.5523 13 20L13 6.41422L19.2929 12.7071Z">`),lW=e=>{let t=()=>e.size??10;return(()=>{var n=cW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},uW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path class=icon-loader-bar d="M12 2v4"style=animation-delay:0ms></path><path class=icon-loader-bar d="M15 6.8l2-3.5"style=animation-delay:-42ms></path><path class=icon-loader-bar d="M17.2 9l3.5-2"style=animation-delay:-83ms></path><path class=icon-loader-bar d="M18 12h4"style=animation-delay:-125ms></path><path class=icon-loader-bar d="M17.2 15l3.5 2"style=animation-delay:-167ms></path><path class=icon-loader-bar d="M15 17.2l2 3.5"style=animation-delay:-208ms></path><path class=icon-loader-bar d="M12 18v4"style=animation-delay:-250ms></path><path class=icon-loader-bar d="M9 17.2l-2 3.5"style=animation-delay:-292ms></path><path class=icon-loader-bar d="M6.8 15l-3.5 2"style=animation-delay:-333ms></path><path class=icon-loader-bar d="M2 12h4"style=animation-delay:-375ms></path><path class=icon-loader-bar d="M6.8 9l-3.5-2"style=animation-delay:-417ms></path><path class=icon-loader-bar d="M9 6.8l-2-3.5"style=animation-delay:-458ms>`),dW=e=>{let t=()=>e.size??16;return(()=>{var n=uW();return n.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling,aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},fW=Z(`<svg data-react-grab-arrow class="absolute block z-10"><path>`),pW=e=>{let t=()=>e.color??`var(--rg-panel-bg)`,n=()=>e.position===`bottom`,r=()=>rW(e.labelWidth??0),i=()=>r()*2,a=()=>r(),o=()=>{let e=i(),t=a(),r=1*Math.SQRT1_2,o=e/2,s=n()?t:0,c=n()?r:t-r,l=+!!n();return`M0 ${s} L${o-r} ${c} A1 1 0 0 ${l} ${o+r} ${c} L${e} ${s} Z`};return(()=>{var r=fW(),s=r.firstChild;return aR(c=>{var l=i(),u=a(),d=`0 0 ${i()} ${a()}`,f=`calc(${e.leftPercent}% + ${e.leftOffsetPx}px)`,p=n()?`0`:void 0,m=n()?void 0:`0`,h=n()?`translateX(-50%) translateY(calc(-100% + 1px))`:`translateX(-50%) translateY(calc(100% - 1px))`,g=o(),_=t();return l!==c.e&&Q(r,`width`,c.e=l),u!==c.t&&Q(r,`height`,c.t=u),d!==c.a&&Q(r,`viewBox`,c.a=d),f!==c.o&&oz(r,`left`,c.o=f),p!==c.i&&oz(r,`top`,c.i=p),m!==c.n&&oz(r,`bottom`,c.n=m),h!==c.s&&oz(r,`transform`,c.s=h),g!==c.h&&Q(s,`d`,c.h=g),_!==c.r&&Q(s,`fill`,c.r=_),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),r})()},mW=Z(`<span class=text-[var(--rg-text-primary)]>`),hW=Z(`<span class=text-[var(--rg-text-secondary)]>.`),gW=Z(`<span class="text-[13px] leading-4 h-fit font-medium overflow-hidden text-ellipsis whitespace-nowrap min-w-0">`),_W=Z(`<button type=button>`),vW=Z(`<div>`),yW=e=>{let t=()=>{e.onHoverChange?.(!0)},n=()=>{e.onHoverChange?.(!1)},r=()=>e.componentName?`${e.componentName}.${e.tagName}`:e.tagName,i=()=>(()=>{var t=gW();return $(t,X(qR,{get when(){return e.componentName},get children(){return[(()=>{var t=mW();return $(t,()=>e.componentName),t})(),(()=>{var t=hW();return t.firstChild,$(t,()=>e.tagName,null),t})()]}}),null),$(t,X(qR,{get when(){return!e.componentName},get children(){var t=mW();return $(t,()=>e.tagName),t}}),null),t})();return X(qR,{get when(){return e.isClickable},get fallback(){return(()=>{var r=vW();return rz(r,`click`,e.onClick,!0),r.addEventListener(`mouseleave`,n),r.addEventListener(`mouseenter`,t),$(r,i),aR(()=>nz(r,oW(`contain-layout flex items-center gap-1 max-w-[280px] overflow-hidden`,e.shrink&&`shrink-0`))),r})()},get children(){var a=_W();return rz(a,`click`,e.onClick,!0),a.addEventListener(`mouseleave`,n),a.addEventListener(`mouseenter`,t),$(a,i),aR(t=>{var n=`Open source for ${r()}`,i=oW(`contain-layout flex items-center gap-1 max-w-[280px] overflow-hidden cursor-pointer bg-transparent border-none p-0 m-0 text-left`,e.shrink&&`shrink-0`);return n!==t.e&&Q(a,`aria-label`,t.e=n),i!==t.t&&nz(a,t.t=i),t},{e:void 0,t:void 0}),a}})},$R([`click`]),bW=Z(`<div class="[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start px-2 py-1.5 w-auto h-fit self-stretch [border-top-width:0.5px] border-t-solid border-t-[var(--rg-border-subtle)] antialiased rounded-t-none rounded-b-[6px]">`),xW=e=>(()=>{var t=bW();return $(t,()=>e.children),t})(),SW=(e,t={})=>(n={})=>{let r=t.variants;if(!r)return e;let i=[e];for(let e in r){let a=n[e]??t.defaultVariants?.[e];if(a===void 0)continue;let o=r[e][String(a)];o&&i.push(o)}return oW(...i)},CW=Z(`<div>`),wW=SW(`contain-layout antialiased [font-synthesis:none] bg-[var(--rg-panel-bg)]`,{variants:{shape:{panel:`rounded-[14px] [corner-shape:superellipse(1.25)]`,pill:`rounded-full`}},defaultVariants:{shape:`panel`}}),TW=e=>{let[t,n]=WR(e,[`shape`,`class`]);return(()=>{var e=CW();return sz(e,UR({get class(){return oW(wW({shape:t.shape}),t.class)}},n),!1,!1),e})()},EW=null,DW={claim:e=>{EW=e},release:e=>{EW===e&&(EW=null)},isActive:e=>EW===e},OW=e=>{let t=Symbol(),n=EM(n=>{DW.isActive(t)&&(Zz(n)||(n.code===`Enter`?e.onEnter?.(n):n.code===`Escape`&&e.onEscape?.(n)))});return fR(()=>{DW.claim(t),window.addEventListener(`keydown`,n,{capture:!0})}),pR(()=>{DW.release(t),window.removeEventListener(`keydown`,n,{capture:!0})}),{claimFocus:()=>DW.claim(t)}},kW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M10.7071 21.2071C10.3166 21.5976 9.68342 21.5976 9.29289 21.2071L3.29289 15.2071C2.90237 14.8166 2.90237 14.1834 3.29289 13.7929L9.29289 7.79289C9.68342 7.40237 10.3166 7.40237 10.7071 7.79289C11.0976 8.18342 11.0976 8.81658 10.7071 9.20711L6.41421 13.5H16C16.5523 13.5 17 13.0523 17 12.5V3.5C17 2.94772 17.4477 2.5 18 2.5C18.5523 2.5 19 2.94772 19 3.5V12.5C19 14.1569 17.6569 15.5 16 15.5H6.41421L10.7071 19.7929C11.0976 20.1834 11.0976 20.8166 10.7071 21.2071Z">`),AW=e=>{let t=()=>e.size??10;return(()=>{var n=kW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},jW=Z(`<button>`),MW=SW(`contain-layout shrink-0 flex items-center justify-center cursor-pointer transition-all press-scale`,{variants:{variant:{chip:`px-[3px] py-px h-[17px] rounded-sm bg-[var(--rg-surface-hover)] [border-width:0.5px] border-solid border-[var(--rg-border-button)] hover:bg-[var(--rg-surface-active)] text-[var(--rg-text-primary)]`,destructive:`px-[3px] py-px h-[17px] rounded-sm bg-[var(--rg-error-bg)] hover:bg-[var(--rg-error-bg-hover)] text-[var(--rg-error-text)]`,ghost:`rounded-sm bg-transparent hover:bg-[var(--rg-surface-hover)] border-none outline-none p-0`}},defaultVariants:{variant:`chip`}}),NW=e=>{let[t,n]=WR(e,[`variant`,`class`,`type`]);return(()=>{var e=jW();return sz(e,UR({get type(){return t.type??`button`},get class(){return oW(MW({variant:t.variant}),t.class)}},n),!1,!1),e})()},PW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),FW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),IW=Z(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),LW=Z(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),RW=Z(`<div data-react-grab-discard-prompt class="contain-layout shrink-0 flex flex-col justify-center items-end w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 shrink-0 font-sans font-medium w-fit h-fit">`),zW=e=>{let t=()=>e.showCancel??!0,{claimFocus:n}=OW({onEnter:t=>{t.preventDefault(),t.stopPropagation();let n=t.composedPath()[0],r=n instanceof HTMLElement?n:null;if(r?.closest(`[data-react-grab-discard-copy]`)){e.onCopy?.();return}if(r?.closest(`[data-react-grab-discard-no]`)){e.onCancel?.();return}if(r?.closest(`[data-react-grab-discard-yes]`)){e.onConfirm?.();return}e.onConfirm?.()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.cancelOnEscape?e.onCancel?.():e.onConfirm?.()}});return(()=>{var r=RW(),i=r.firstChild.firstChild;return rz(r,`click`,n,!0),rz(r,`pointerdown`,n,!0),$(i,()=>e.label??`Discard?`),$(r,X(xW,{get children(){var n=LW();return $(n,X(qR,{get when(){return t()},get children(){return X(NW,{"data-react-grab-discard-no":!0,get onClick(){return e.onCancel},get children(){return PW()}})}}),null),$(n,X(qR,{get when(){return e.onCopy},get children(){return X(NW,{"data-react-grab-discard-copy":!0,get onClick(){return e.onCopy},get children(){return FW()}})}}),null),$(n,X(NW,{variant:`destructive`,class:`gap-0.5`,"data-react-grab-discard-yes":!0,get onClick(){return e.onConfirm},get children(){return[IW(),X(AW,{size:10,class:`text-[var(--rg-error-text)] opacity-50`})]}}),null),n}}),null),r})()},$R([`pointerdown`,`click`]),BW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M7 2C4.23858 2 2 4.23858 2 7V15C2 17.7614 4.23858 20 7 20H8C8.55228 20 9 19.5523 9 19C9 18.4477 8.55228 18 8 18H7C5.34315 18 4 16.6569 4 15V7C4 5.34315 5.34315 4 7 4H17C18.6569 4 20 5.34315 20 7V15C20 16.6569 18.6569 18 17 18H14.4142L16.2071 16.2071C16.5976 15.8166 16.5976 15.1834 16.2071 14.7929C15.8166 14.4024 15.1834 14.4024 14.7929 14.7929L11.2929 18.2929C11.197 18.3888 11.1247 18.4993 11.0759 18.6172C11.027 18.7351 11 18.8644 11 19C11 19.2728 11.1093 19.5201 11.2864 19.7005C11.2889 19.7031 11.2914 19.7056 11.2939 19.7081L14.7929 23.2071C15.1834 23.5976 15.8166 23.5976 16.2071 23.2071C16.5976 22.8166 16.5976 22.1834 16.2071 21.7929L14.4142 20H17C19.7614 20 22 17.7614 22 15V7C22 4.23858 19.7614 2 17 2H7Z">`),VW=e=>{let t=()=>e.size??12;return(()=>{var n=BW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},HW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Retry`),UW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Ok`),WW=Z(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),GW=Z(`<div data-react-grab-error role=alert aria-live=assertive class="contain-layout shrink-0 flex flex-col justify-center items-end w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-start gap-1 px-2 w-full h-fit"><span class="text-[var(--rg-error-text)] text-[13px] leading-4 font-sans font-medium overflow-hidden line-clamp-5">`),KW=e=>{let{claimFocus:t}=OW({onEnter:t=>{t.preventDefault(),t.stopPropagation(),e.onRetry?.()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onAcknowledge?.()}}),n=()=>!!(e.onRetry||e.onAcknowledge);return(()=>{var r=GW(),i=r.firstChild,a=i.firstChild;return rz(r,`click`,t,!0),rz(r,`pointerdown`,t,!0),$(a,()=>e.error),$(r,X(qR,{get when(){return n()},get children(){return X(xW,{get children(){var t=WW();return $(t,X(qR,{get when(){return e.onRetry},get children(){return X(NW,{"data-react-grab-retry":!0,class:`gap-1`,"aria-keyshortcuts":`Enter`,get onClick(){return e.onRetry},get children(){return[HW(),X(VW,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-text-secondary)]`})]}})}}),null),$(t,X(qR,{get when(){return e.onAcknowledge},get children(){return X(NW,{"data-react-grab-error-ok":!0,class:`gap-1`,"aria-keyshortcuts":`Escape`,get onClick(){return e.onAcknowledge},get children(){return UW()}})}}),null),t}})}}),null),aR(t=>{var r={"pt-1.5 pb-1":n(),"py-1.5":!n()},o=e.error;return t.e=iz(i,r,t.e),o!==t.t&&Q(a,`title`,t.t=o),t},{e:void 0,t:void 0}),r})()},$R([`pointerdown`,`click`]),qW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M7.5 12C7.5 13.3807 6.38071 14.5 5 14.5C3.61929 14.5 2.5 13.3807 2.5 12C2.5 10.6193 3.61929 9.5 5 9.5C6.38071 9.5 7.5 10.6193 7.5 12ZM14.5 12C14.5 13.3807 13.3807 14.5 12 14.5C10.6193 14.5 9.5 13.3807 9.5 12C9.5 10.6193 10.6193 9.5 12 9.5C13.3807 9.5 14.5 10.6193 14.5 12ZM19 14.5C20.3807 14.5 21.5 13.3807 21.5 12C21.5 10.6193 20.3807 9.5 19 9.5C17.6193 9.5 16.5 10.6193 16.5 12C16.5 13.3807 17.6193 14.5 19 14.5Z">`),JW=e=>{let t=()=>e.size??14;return(()=>{var n=qW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},YW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM17.7071 10.7071C18.0976 10.3166 18.0976 9.68342 17.7071 9.29289C17.3166 8.90237 16.6834 8.90237 16.2929 9.29289L11 14.5858L8.70711 12.2929C8.31658 11.9024 7.68342 11.9024 7.29289 12.2929C6.90237 12.6834 6.90237 13.3166 7.29289 13.7071L10.2929 16.7071C10.6834 17.0976 11.3166 17.0976 11.7071 16.7071L17.7071 10.7071Z">`),XW=e=>{let t=()=>e.size??14;return(()=>{var n=YW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},ZW=Z(`<button data-react-grab-ignore-events data-react-grab-more-options>`),QW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Keep`),$W=Z(`<div class="contain-layout shrink-0 flex items-center justify-between gap-2 pt-1.5 pb-1 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap min-w-0"></span><div class="contain-layout shrink-0 flex items-center gap-2 h-fit">`),eG=Z(`<div class="contain-layout shrink-0 flex items-center gap-0.5 py-1.5 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap min-w-0">`),tG=e=>(()=>{var t=ZW();return rz(t,`click`,t=>{t.stopImmediatePropagation(),e.onClick()}),rz(t,`pointerdown`,e=>{e.stopImmediatePropagation()}),$(t,X(JW,{size:14,class:`opacity-50 group-hover:opacity-100 transition-opacity`})),aR(()=>nz(t,oW(MW({variant:`ghost`}),`group size-4 text-[var(--rg-text-secondary)] hover:text-[var(--rg-text-primary)]`))),t})(),nG=e=>{let t,n,[r,i]=J(!1),[a,o]=J(!1),s=()=>r()?`Copied`:e.statusText,c=()=>{t!==void 0&&window.clearTimeout(t),n!==void 0&&window.clearTimeout(n),o(!0),e.onFadingChange?.(!0),e.onShowContextMenu?.()},l=()=>{r()||(i(!0),t=window.setTimeout(()=>{o(!0),e.onFadingChange?.(!0),n=window.setTimeout(()=>{e.onDismiss?.()},125)},1375))},{claimFocus:u}=OW({onEnter:e=>{e.preventDefault(),e.stopPropagation(),l()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onDismiss?.()}});return pR(()=>{t!==void 0&&window.clearTimeout(t),n!==void 0&&window.clearTimeout(n)}),X(TW,{shape:`pill`,"data-react-grab-completion":!0,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,class:`shrink-0 flex flex-col justify-center items-end w-fit h-fit max-w-[280px] transition-opacity duration-100 ease-out`,get style(){return{opacity:+!a()}},onPointerDown:u,onClick:u,get children(){return[X(qR,{get when(){return Kz(()=>!r())()&&e.onDismiss},get children(){var t=$W(),n=t.firstChild,i=n.nextSibling;return $(n,s),$(i,X(qR,{get when(){return e.onShowContextMenu},get children(){return X(tG,{onClick:c})}}),null),$(i,X(qR,{get when(){return e.onDismiss},get children(){return X(NW,{"data-react-grab-dismiss":!0,class:`gap-1`,"aria-keyshortcuts":`Enter`,onClick:l,get disabled(){return r()},get"aria-disabled"(){return r()},get children(){return[QW(),X(qR,{get when(){return!r()},get children(){return X(AW,{size:10,class:`text-[var(--rg-text-secondary)]`})}})]}})}}),null),t}}),X(qR,{get when(){return r()||!e.onDismiss},get children(){var t=eG(),n=t.firstChild;return $(t,X(XW,{size:14,"aria-hidden":`true`,class:`text-[var(--rg-text-primary-85)] shrink-0`}),n),$(n,s),$(t,X(qR,{get when(){return e.onShowContextMenu},get children(){return X(tG,{onClick:c})}}),null),t}})]}})},rG=Z(`<div class="contain-layout shrink-0 flex flex-col justify-center items-start w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 py-1.5 px-2 w-full h-fit"><span class="shimmer-text text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap">`),iG=Z(`<div class="contain-layout shrink-0 flex flex-col items-start w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 w-fit h-fit px-2 py-1.5">`),aG=Z(`<button data-react-grab-submit type=button aria-label="Submit context"class="contain-layout shrink-0 flex items-center justify-center size-4 rounded-full bg-[var(--rg-submit-bg)] cursor-pointer ml-1 interactive-scale a11y-hitbox">`),oG=Z(`<div class="shrink-0 flex justify-between items-end w-full min-h-4"><textarea data-react-grab-ignore-events data-react-grab-input aria-label="Add context for selected element"aria-keyshortcuts="Enter Escape"class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-medium bg-transparent border-none resize-none flex-1 p-0 m-0 wrap-break-word overflow-y-auto"placeholder="Add context"rows=1 style=field-sizing:content;min-height:16px;scrollbar-width:none>`),sG=Z(`<div class="contain-layout shrink-0 flex flex-col justify-center items-start w-fit h-fit min-w-[150px] max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 w-fit h-fit px-2 max-w-full">`),cG=Z(`<div data-react-grab-ignore-events data-react-grab-selection-label>`),lG={left:wN,top:wN,arrowLeftPercent:50,arrowLeftOffset:0,edgeOffsetX:0},uG=e=>{let t,n,r,i=!1,[a,o]=J(0),[s,c]=J(0),[l,u]=J(0),[d,f]=J(0),[p,m]=J(!1),[h,g]=J(!1),_=()=>e.status!==`copying`&&e.status!==`copied`&&e.status!==`fading`&&e.status!==`error`,v=()=>e.status===`copied`||e.status===`fading`,y=()=>!!e.shouldToggleExpandOnClick&&!!e.onToggleExpand&&_()&&!e.discardPrompt&&!e.isPromptMode,b=()=>!!(e.isPromptMode||e.discardPrompt||y()||v()&&(e.onDismiss||e.onShowContextMenu)||e.status===`error`&&(e.onAcknowledgeError||e.onRetry)),x,S=e=>{i=e},C=()=>{f(e=>e+1)},w=EM(t=>{Zz(t)||t.code===`Enter`&&!e.isPromptMode&&!e.discardPrompt&&_()&&(t.preventDefault(),t.stopImmediatePropagation(),e.onToggleExpand?.())});fR(()=>{let r=wM();if(x=new ResizeObserver(e=>{for(let a of e){let e=a.target.getBoundingClientRect();a.target===t&&!i?(o(e.width),c(e.height)):a.target===n?u(e.width):a.target===r&&C()}}),r&&x.observe(r),t){let e=t.getBoundingClientRect();o(e.width),c(e.height),x.observe(t)}n&&(u(n.getBoundingClientRect().width),x.observe(n)),window.addEventListener(`scroll`,C,!0),window.addEventListener(`resize`,C),window.visualViewport?.addEventListener(`resize`,C),window.visualViewport?.addEventListener(`scroll`,C),e.onToggleExpand&&window.addEventListener(`keydown`,w,{capture:!0})}),pR(()=>{x?.disconnect(),window.removeEventListener(`scroll`,C,!0),window.removeEventListener(`resize`,C),window.visualViewport?.removeEventListener(`resize`,C),window.visualViewport?.removeEventListener(`scroll`,C),window.removeEventListener(`keydown`,w,{capture:!0})});let T=()=>`${e.tagName??``}:${e.componentName??``}`,ee=Y(t=>{d();let n=T(),r=n===t.elementIdentity?t:{position:lG,computedArrowPosition:null,hadValidBounds:!1,elementIdentity:n},i=e.selectionBounds,o=a(),c=s(),u=o>0&&c>0,f=i&&i.width>0&&i.height>0;if(!u||!f)return{position:r.hadValidBounds?r.position:lG,computedArrowPosition:r.computedArrowPosition,hadValidBounds:r.hadValidBounds,elementIdentity:n};let p=iW(),m=p.offsetLeft,h=p.offsetTop,g=m+p.width,_=h+p.height;if(!(i.x+i.width>m&&i.x<g&&i.y+i.height>h&&i.y<_))return{position:lG,computedArrowPosition:r.computedArrowPosition,hadValidBounds:r.hadValidBounds,elementIdentity:n};let v=i.x+i.width/2,y=e.mouseX??v,b=i.y+i.height,x=i.y,S=e.hideArrow?0:rW(l()),C=y,w=0,ee=b+S+4;if(o>0){let e=C-o/2,t=C+o/2;t>g-8&&(w=g-8-t),e+w<m+8&&(w=m+8-e)}let E=c+S+4,D=ee+c<=_-8;D||(ee=x-E),ee<h+8&&(ee=h+8);let O=o/2,te=O-w,k=Math.min(16,O),A=Math.max(o-16,O),ne=Math.max(k,Math.min(A,te))-O;return{position:{left:C,top:ee,arrowLeftPercent:50,arrowLeftOffset:ne,edgeOffsetX:w},computedArrowPosition:D?`bottom`:`top`,hadValidBounds:!0,elementIdentity:n}},{position:lG,computedArrowPosition:null,hadValidBounds:!1,elementIdentity:``}),E=()=>ee().computedArrowPosition??`bottom`,D=()=>ee().hadValidBounds;oR(dR(()=>e.selectionLabelShakeCount,()=>g(!0),{defer:!0}));let O=t=>{if(t.isComposing||t.keyCode===229)return;t.stopImmediatePropagation();let n=t.code===`Enter`&&!t.shiftKey,r=t.code===`Escape`;n?(t.preventDefault(),e.onSubmit?.()):r&&(t.preventDefault(),e.onConfirmDismiss?.())},te=t=>{let n=t.target;n instanceof HTMLTextAreaElement&&(tW(n,95),e.onInputChange?.(n.value))},k=()=>sW({tagName:e.tagName,componentName:e.componentName,elementsCount:e.elementsCount}),A=Y(()=>!(e.error||e.discardPrompt||_()&&e.isPromptMode)),ne=t=>{if(t.stopImmediatePropagation(),e.filePath&&e.onOpen){e.onOpen();return}y()&&e.onToggleExpand?.()},re=t=>{t.stopImmediatePropagation(),_()&&e.isPromptMode&&!e.discardPrompt&&e.onSubmit&&r&&nW(r,{preventScroll:!0})},ie=()=>D()&&(v()||e.status===`error`);return X(qR,{get when(){return Kz(()=>e.visible!==!1)()&&(e.selectionBounds||ie())},get children(){var i=cG();i.addEventListener(`mouseleave`,()=>e.onHoverChange?.(!1)),i.addEventListener(`mouseenter`,()=>e.onHoverChange?.(!0)),i.$$click=e=>{e.stopImmediatePropagation()},i.$$pointerdown=re;var a=t;return typeof a==`function`?cz(a,i):t=i,oz(i,`z-index`,`${LM}`),oz(i,`transition`,`opacity 125ms ease-out, filter 125ms ease-out`),$(i,X(qR,{get when(){return!e.hideArrow},get children(){return X(pW,{get position(){return E()},get leftPercent(){return ee().position.arrowLeftPercent},get leftOffsetPx(){return ee().position.arrowLeftOffset},get labelWidth(){return l()}})}}),null),$(i,X(qR,{get when(){return Kz(()=>!!v())()&&!e.error},get children(){return X(nG,{get statusText(){return e.statusText??`Copied`},get onDismiss(){return e.onDismiss},onFadingChange:m,get onShowContextMenu(){return e.onShowContextMenu}})}}),null),$(i,X(TW,{ref:e=>n=e,get shape(){return A()?`pill`:`panel`},get class(){return oW(`flex items-center gap-[5px] w-fit h-fit p-0`,h()&&`animate-shake`)},get style(){return{display:v()&&!e.error?`none`:void 0}},onAnimationEnd:()=>g(!1),get children(){return[X(qR,{get when(){return e.status===`copying`},get children(){var t=rG(),n=t.firstChild,r=n.firstChild;return $(n,X(dW,{size:13,class:`text-[var(--rg-text-secondary)] shrink-0`}),r),$(r,()=>e.statusText??`Grabbing…`),t}}),X(qR,{get when(){return Kz(()=>!!(_()&&!e.isPromptMode))()&&!e.discardPrompt},get children(){var t=iG(),n=t.firstChild;return $(n,X(yW,{get tagName(){return k().tagName},get componentName(){return k().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:ne,onHoverChange:S,shrink:!0})),t}}),X(qR,{get when(){return Kz(()=>!!(_()&&e.isPromptMode))()&&!e.discardPrompt},get children(){var t=sG(),n=t.firstChild;return $(n,X(yW,{get tagName(){return k().tagName},get componentName(){return k().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:ne,onHoverChange:S})),$(t,X(xW,{get children(){var t=oG(),n=t.firstChild;return n.$$keydown=O,n.$$input=te,cz(t=>{r=t,e.onSubmit&&queueMicrotask(()=>{nW(t,{preventScroll:!0}),tW(t,95)})},n),oz(n,`max-height`,`95px`),$(t,X(qR,{get when(){return e.onSubmit},get children(){var t=aG();return t.$$click=()=>e.onSubmit?.(),$(t,X(lW,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-submit-fg)]`})),t}}),null),aR(()=>n.readOnly=!e.onSubmit),aR(()=>n.value=e.inputValue??``),t}}),null),t}}),X(qR,{get when(){return e.discardPrompt},keyed:!0,children:e=>X(zW,{get label(){return Kz(()=>!!e.isKeyboardSelection)()?`Discard selection?`:e.label},get showCancel(){return!e.isKeyboardSelection},get cancelOnEscape(){return e.cancelOnEscape},get onConfirm(){return e.onConfirm},get onCopy(){return e.onCopy},onCancel:()=>{e.isKeyboardSelection||e.onCancel?.(),nW(r,{preventScroll:!0})}})}),X(qR,{get when(){return e.error},get children(){return X(KW,{get error(){return e.error},get onAcknowledge(){return e.onAcknowledgeError},get onRetry(){return e.onRetry}})}})]}}),null),aR(t=>{var n=oW(`fixed font-sans text-[13px] antialiased select-none ease-out`),r=`${ee().position.top}px`,a=`${ee().position.left}px`,o=`translateX(calc(-50% + ${ee().position.edgeOffsetX}px))`,s=b()?`auto`:`none`,c=e.status===`fading`||p()?0:1,l=`drop-shadow(${kM}) blur(${e.status===`fading`||p()?`3px`:`0`})`;return n!==t.e&&nz(i,t.e=n),r!==t.t&&oz(i,`top`,t.t=r),a!==t.a&&oz(i,`left`,t.a=a),o!==t.o&&oz(i,`transform`,t.o=o),s!==t.i&&oz(i,`pointer-events`,t.i=s),c!==t.n&&oz(i,`opacity`,t.n=c),l!==t.s&&oz(i,`filter`,t.s=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),i}})},$R([`pointerdown`,`click`,`input`,`keydown`]),dG=Z(`<span style="transition-property:transform;transition-timing-function:cubic-bezier(0.32, 0.72, 0, 1)"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M20.8977 4.02356L21.8277 4.39121C22.3784 2.99813 21.0382 1.60206 19.6238 2.09546L3.47334 7.72936C1.38661 8.45728 1.49021 11.443 3.6224 12.0245L10.1289 13.799L11.2331 19.8724C11.638 22.0991 14.7072 22.4019 15.5393 20.2972L21.8277 4.39121L20.8977 4.02356Z">`),fG=e=>{let t=()=>e.size??14,n=()=>e.rotationDeg??0;return(()=>{var r=dG(),i=r.firstChild;return oz(r,`transition-duration`,`180ms`),aR(a=>{var o=oW(`inline-flex items-center justify-center will-change-transform`,e.class),s=`rotate(${n()}deg)`,c=t(),l=t();return o!==a.e&&nz(r,a.e=o),s!==a.t&&oz(r,`transform`,a.t=s),c!==a.a&&Q(i,`width`,a.a=c),l!==a.o&&Q(i,`height`,a.o=l),a},{e:void 0,t:void 0,a:void 0,o:void 0}),r})()},pG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 12 12"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M1 6C1 3.239 3.239 1 6 1C8.761 1 11 3.239 11 6C11 8.761 8.761 11 6 11C5.103 11 4.261 10.764 3.532 10.35C2.959 10.759 2.257 11 1.5 11C1.376 11 1.253 10.993 1.132 10.981C0.923 10.959 0.75 10.809 0.699 10.605C0.648 10.402 0.729 10.188 0.903 10.07C1.347 9.768 1.688 9.328 1.865 8.812C1.319 8.011 1 7.042 1 6Z">`),mG=e=>{let t=()=>e.size??14;return(()=>{var n=pG();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},hG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M2 12C2 6.477 6.477 2 12 2C17.523 2 22 6.477 22 12C22 13.867 20.345 14.992 18.77 14.992H16.029C14.739 14.992 13.823 16.248 14.218 17.476L14.48 18.295C14.751 19.139 14.643 20.041 14.211 20.751C13.769 21.479 12.985 22 12 22C6.477 22 2 17.523 2 12ZM12.21 6.783C12.416 7.585 11.933 8.403 11.131 8.609C10.328 8.815 9.511 8.332 9.305 7.529C9.099 6.727 9.582 5.909 10.384 5.703C11.187 5.497 12.004 5.981 12.21 6.783ZM7.59 9.207C8.388 9.43 8.853 10.258 8.63 11.055C8.407 11.853 7.579 12.319 6.782 12.096C5.984 11.873 5.518 11.045 5.741 10.247C5.964 9.449 6.792 8.983 7.59 9.207ZM9.497 14.446C8.918 13.854 7.968 13.844 7.376 14.423C6.784 15.002 6.773 15.952 7.353 16.544C7.932 17.136 8.882 17.147 9.474 16.567C10.066 15.988 10.076 15.039 9.497 14.446ZM16.624 9.575C16.032 10.155 15.082 10.144 14.503 9.552C13.923 8.96 13.934 8.01 14.526 7.431C15.118 6.852 16.068 6.862 16.647 7.454C17.226 8.046 17.216 8.996 16.624 9.575Z">`),gG=e=>{let t=()=>e.size??14;return(()=>{var n=hG();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},_G=Z(`<div>`),vG=0,yG=()=>Date.now()-vG<800,bG=e=>{let[t,n]=J(!1),[r,i]=J(!0),a;oR(dR(()=>e.visible,e=>{a!==void 0&&(clearTimeout(a),a=void 0),e?yG()?(i(!1),n(!0)):(i(!0),a=setTimeout(()=>{n(!0)},400)):(t()&&(vG=Date.now()),n(!1))})),pR(()=>{a!==void 0&&clearTimeout(a),t()&&(vG=Date.now())});let o=()=>e.position===`top`||e.position===`bottom`?{left:`50%`,translate:`-50%`,"z-index":`${LM}`}:{top:`50%`,translate:`0 -50%`,"z-index":`${LM}`};return X(qR,{get when(){return t()},get children(){var t=_G();return $(t,()=>e.children),aR(n=>{var i=oW(`absolute whitespace-nowrap px-2 py-0.5 rounded-full text-[10px] font-sans font-medium leading-4 pointer-events-none`,`bg-[var(--rg-panel-bg)] text-[var(--rg-text-primary)] [box-shadow:var(--rg-shadow)]`,e.position===`top`&&`bottom-full mb-2.5`,e.position===`bottom`&&`top-full mt-2.5`,e.position===`left`&&`right-full mr-2.5`,e.position===`right`&&`left-full ml-2.5`,r()&&`animate-tooltip-fade-in`),a=o();return i!==n.e&&nz(t,n.e=i),n.t=az(t,a,n.t),n},{e:void 0,t:void 0}),t}})},xG=Z(`<div><button data-react-grab-ignore-events type=button>`),SG=e=>(()=>{var t=xG(),n=t.firstChild;rz(n,`mouseleave`,e.onMouseLeave),rz(n,`mouseenter`,e.onMouseEnter),rz(n,`contextmenu`,t=>e.onContextMenu?.(t)),rz(n,`click`,e.onClick,!0);var r=e.ref;return typeof r==`function`?cz(r,n):e.ref=n,$(n,()=>e.icon),$(t,X(qR,{get when(){return e.tooltip},get children(){return X(bG,{get visible(){return!!e.tooltipVisible},get position(){return e.tooltipPosition??`top`},get children(){return e.tooltip}})}}),null),aR(r=>{var i=e.wrapperClass,a=e.isToggle?``:void 0,o=e.actionId,s=e.label,c=!!e.isActive,l=e.class;return i!==r.e&&nz(t,r.e=i),a!==r.t&&Q(n,`data-react-grab-toolbar-toggle`,r.t=a),o!==r.a&&Q(n,`data-react-grab-toolbar-action`,r.a=o),s!==r.o&&Q(n,`aria-label`,r.o=s),c!==r.i&&Q(n,`aria-pressed`,r.i=c),l!==r.n&&nz(n,r.n=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})(),$R([`click`]),CG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M9.29289 16.7071C8.90237 16.3166 8.90237 15.6834 9.29289 15.2929L12.5858 12L9.29289 8.70711C8.90237 8.31658 8.90237 7.68342 9.29289 7.29289C9.68342 6.90237 10.3166 6.90237 10.7071 7.29289L14.7071 11.2929C14.8946 11.4804 15 11.7348 15 12C15 12.2652 14.8946 12.5196 14.7071 12.7071L10.7071 16.7071C10.3166 17.0976 9.68342 17.0976 9.29289 16.7071Z">`),wG=e=>{let t=()=>e.size??14;return(()=>{var n=CG();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},TG=Z(`<button data-react-grab-ignore-events data-react-grab-toolbar-collapse type=button class="group contain-layout shrink-0 flex items-center justify-center cursor-pointer interactive-scale a11y-hitbox">`),EG=Z(`<div data-react-grab-toolbar-panel><div><div><div>`),DG=e=>{let t=()=>e.snapEdge??`bottom`,n=()=>t()===`left`||t()===`right`,r=()=>e.isCollapsed?`duration-140`:`duration-220`,i=()=>n()?`transition-[grid-template-rows] ${r()} ease-drawer`:`transition-[grid-template-columns] ${r()} ease-drawer`,a=()=>n()?`min-h-0`:`min-w-0`,o=()=>e.isCollapsed?`${{top:`rounded-t-none rounded-b-[10px]`,bottom:`rounded-b-none rounded-t-[10px]`,left:`rounded-l-none rounded-r-[10px]`,right:`rounded-r-none rounded-l-[10px]`}[t()]} ${n()?`px-0.25 py-2`:`px-2 py-0.25`}`:``,s=()=>{let n=e.isCollapsed;switch(t()){case`top`:return n?`rotate-90`:`-rotate-90`;case`bottom`:return n?`-rotate-90`:`rotate-90`;case`left`:return n?`rotate-0`:`rotate-180`;case`right`:return n?`rotate-180`:`rotate-0`;default:return`-rotate-90`}},c=()=>{if(e.isChevronPressed)return n()?`scale(0.97, 1)`:`scale(1, 0.97)`},l=()=>(()=>{var t=TG();return rz(t,`pointercancel`,e.onCollapsePointerLeave),rz(t,`pointerleave`,e.onCollapsePointerLeave),rz(t,`pointerup`,e.onCollapsePointerUp,!0),rz(t,`pointerdown`,e.onCollapsePointerDown),rz(t,`click`,e.onCollapseClick,!0),$(t,X(wG,{size:18,get class(){return oW(`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)] transition-[transform,color] duration-150 ease-drawer -m-0.5`,s())}})),aR(n=>{var r=e.isCollapsed?`Expand toolbar`:`Collapse toolbar`,i=!e.isCollapsed;return r!==n.e&&Q(t,`aria-label`,n.e=r),i!==n.t&&Q(t,`aria-expanded`,n.t=i),n},{e:void 0,t:void 0}),t})(),u=()=>e.isChevronPressed?`transition-[padding,border-radius,transform] duration-60 ease-[cubic-bezier(0,0,0.2,1)]`:`transition-[padding,border-radius,transform] ${r()} ease-drawer`;return(()=>{var t=EG(),r=t.firstChild,s=r.firstChild,d=s.firstChild;return rz(t,`click`,e.onPanelClick,!0),rz(t,`animationend`,e.onAnimationEnd),$(d,()=>e.actionButtons),$(t,l,null),aR(l=>{var f=oW(`flex items-center justify-center rounded-[13px] antialiased relative overflow-visible [font-synthesis:none]`,u(),n()&&`flex-col`,`bg-[var(--rg-panel-bg)] [box-shadow:var(--rg-shadow)]`,!e.isCollapsed&&(n()?`px-1.5 gap-0 py-2`:`py-1.5 gap-0 px-2`),o(),e.isShaking&&(n()?`animate-shake-vertical`:`animate-shake`)),p=e.transformOrigin,m=c(),h=oW(`grid relative overflow-visible`,i(),e.isCollapsed?n()?`grid-rows-[0fr] pointer-events-none`:`grid-cols-[0fr] pointer-events-none`:n()?`grid-rows-[1fr]`:`grid-cols-[1fr]`),g=oW(`flex`,n()?`flex-col items-center min-h-0`:`items-center min-w-0`,e.isCollapsed?`opacity-0`:`opacity-100`,e.isCollapsed?`transition-opacity duration-100 ease-drawer`:`transition-opacity duration-180 ease-drawer delay-[80ms]`),_=oW(`relative overflow-visible flex`,n()?`flex-col items-center`:`items-center`,a());return f!==l.e&&nz(t,l.e=f),p!==l.t&&oz(t,`transform-origin`,l.t=p),m!==l.a&&oz(t,`transform`,l.a=m),h!==l.o&&nz(r,l.o=h),g!==l.i&&nz(s,l.i=g),_!==l.n&&nz(d,l.n=_),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})()},$R([`click`,`pointerup`]),OG=e=>e===`top`||e===`bottom`,kG=e=>{let t=OG(e);return{width:t?30:16,height:t?16:30}},AG=(e,t,n,r)=>{let i=iW(),a=i.width,o=i.height,s=i.offsetLeft+16,c=Math.max(s,i.offsetLeft+a-n-16),l=i.offsetTop+16,u=Math.max(l,i.offsetTop+o-r-16);if(e===`top`||e===`bottom`){let r=Math.max(0,a-n-32);return{x:Math.min(c,Math.max(s,i.offsetLeft+16+r*t)),y:e===`top`?l:u}}let d=Math.max(0,o-r-32),f=Math.min(u,Math.max(l,i.offsetTop+16+d*t));return{x:e===`left`?s:c,y:f}},jG=(e,t,n,r,i)=>{let a=iW(),o=a.width,s=a.height;if(e===`top`||e===`bottom`){let e=o-r-32;return e<=0?rN:Math.max(0,Math.min(1,(t-a.offsetLeft-16)/e))}let c=s-i-32;return c<=0?rN:Math.max(0,Math.min(1,(n-a.offsetTop-16)/c))},MG=(e,t,n,r,i)=>{let a=iW(),o=a.width,s=a.height,{width:c,height:l}=n,u;if(t===`top`||t===`bottom`){let n=(c-r)/2;u={x:yB(e.x-n,a.offsetLeft+16,a.offsetLeft+o-c-16),y:t===`top`?a.offsetTop+16:a.offsetTop+s-l-16}}else{let n=(l-i)/2,r=yB(e.y-n,a.offsetTop+16,a.offsetTop+s-l-16);u={x:t===`left`?a.offsetLeft+16:a.offsetLeft+o-c-16,y:r}}let d=jG(t,u.x,u.y,c,l);return{position:u,ratio:d}},NG=(e,t,n,r)=>{let i=iW(),{width:a,height:o}=n,{width:s,height:c}=r;switch(e){case`top`:case`bottom`:{let n=(a-s)/2;return{x:yB(t.x+n,i.offsetLeft,i.offsetLeft+i.width-s),y:e===`top`?i.offsetTop:i.offsetTop+i.height-c}}case`left`:case`right`:{let n=(o-c)/2,r=yB(t.y+n,i.offsetTop,i.offsetTop+i.height-c);return{x:e===`left`?i.offsetLeft:i.offsetLeft+i.width-s,y:r}}}},PG=(e,t,n,r,i,a)=>{let o=iW(),s=o.width,c=o.height,l=e+i*150,u=t+a*150,d=u-o.offsetTop+r/2,f=o.offsetTop+c-u-r/2,p=l-o.offsetLeft+n/2,m=o.offsetLeft+s-l-n/2,h=Math.min(d,f,p,m),g=e=>yB(e,o.offsetLeft+16,o.offsetLeft+s-n-16),_=e=>yB(e,o.offsetTop+16,o.offsetTop+c-r-16);return h===d?{edge:`top`,x:g(l),y:o.offsetTop+16}:h===p?{edge:`left`,x:o.offsetLeft+16,y:_(u)}:h===m?{edge:`right`,x:o.offsetLeft+s-n-16,y:_(u)}:{edge:`bottom`,x:g(l),y:o.offsetTop+c-r-16}},FG=e=>{let[t,n]=J(!1),[r,i]=J(!1),[a,o]=J(!1),[s,c]=J({x:0,y:0}),l={x:0,y:0},u={x:0,y:0,time:0},d={x:0,y:0},f=!1,p,m=null,h=()=>{m?.abort(),m=null},g=t=>{if(!a()){if(Math.hypot(t.clientX-d.x,t.clientY-d.y)<=5)return;o(!0),e.onDragStart()}let n=performance.now(),r=n-u.time;r>0&&c({x:(t.clientX-u.x)/r,y:(t.clientY-u.y)/r}),u={x:t.clientX,y:t.clientY,time:n};let i=t.clientX-l.x,s=t.clientY-l.y;e.onPositionUpdate({x:i,y:s})},_=()=>{h();let t=a();if(n(!1),!t)return;f=!0;let r=e.getContainerRef(),o=r?.getBoundingClientRect();if(!o)return;let c=s(),l=PG(o.left,o.top,o.width,o.height,c.x,c.y),u=jG(l.edge,l.x,l.y,o.width,o.height);e.onSnapEdgeChange(l.edge,u),i(!0),UF(()=>{let t=r?.getBoundingClientRect(),n=t?{width:t.width,height:t.height}:e.getExpandedDimensions();UF(()=>{let t=AG(l.edge,u,n.width,n.height);e.onSnapComplete({edge:l.edge,ratio:u,position:t,expandedDimensions:n}),p=setTimeout(()=>{i(!1),e.onSnapAnimationEnd?.()},300)})})},v=EM(t=>{if(t.button!==0||e.isCollapsed())return;let r=e.getContainerRef()?.getBoundingClientRect();if(!r)return;d={x:t.clientX,y:t.clientY},l={x:t.clientX-r.left,y:t.clientY-r.top},n(!0),o(!1),c({x:0,y:0}),u={x:t.clientX,y:t.clientY,time:performance.now()},h(),m=new AbortController;let{signal:i}=m;window.addEventListener(`pointermove`,g,{signal:i}),window.addEventListener(`pointerup`,_,{signal:i}),window.addEventListener(`pointercancel`,_,{signal:i})});return pR(()=>{h(),clearTimeout(p)}),{isDragging:t,isSnapping:r,handlePointerDown:v,createDragAwareHandler:e=>t=>{if(t.stopImmediatePropagation(),f){f=!1;return}e()}}},IG=(e,t)=>{let n=t-e;return e+(n-Math.round(n/360)*360)},LG=Z(`<div data-react-grab-ignore-events data-react-grab-toolbar>`),RG=e=>{let t,n,r=null,i=EV(),[a,o]=J(!1),[s,c]=J(!1),[l,u]=J(!1),[d,f]=J(i?.edge??`bottom`),[p,m]=J(i?.ratio??.5),[h,g]=J({x:0,y:0}),[_,v]=J(!1),[y,b]=J(!1),[x,S]=J(!1),[C,w]=J(!1),[T,ee]=J(0),[E,D]=J(null),O=()=>{r?.(),r=null,e.isActive||CL()},te=FG({getContainerRef:()=>t,isCollapsed:s,getExpandedDimensions:()=>ce,onDragStart:()=>{D(null),r&&O()},onPositionUpdate:e=>g(e),onSnapEdgeChange:(e,t)=>{de(d(),e),f(e),m(t)},onSnapComplete:e=>{ce=e.expandedDimensions,g(e.position),Ae({edge:e.edge,ratio:e.ratio,collapsed:s(),enabled:!s()})}}),k=()=>d()===`left`||d()===`right`,A=()=>k()?`mb-1.5`:`mr-1.5`,ne=t=>e.activeActionId===t,re=()=>!!e.isActive&&(e.activeActionId??`copy`)===`copy`,ie=t=>E()===t&&!e.isActive&&!s()&&!te.isDragging()&&!te.isSnapping()&&!e.isContextMenuOpen,ae=()=>{switch(d()){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;default:return`top`}},oe=e=>{e.stopImmediatePropagation()},se=(t,n)=>({onMouseEnter:e=>{te.isDragging()||(D(t),n?.shouldFreezeInteractions!==!1&&!r&&(r=$L(),SL(e.clientX,e.clientY)),n?.onHoverChange?.(!0))},onMouseLeave:()=>{D(e=>e===t?null:e),n?.shouldFreezeInteractions!==!1&&!e.isActive&&!e.isContextMenuOpen&&O(),n?.onHoverChange?.(!1)}});oR(dR(()=>e.shakeCount,t=>{t&&!e.enabled&&v(!0)})),oR(dR(()=>[e.isActive,e.isContextMenuOpen],([e,t])=>{!e&&!t&&r&&(r(),r=null)})),oR(dR(()=>re(),e=>{if(!e){ee(e=>IG(e,0));return}let t=EM(e=>{if(!n)return;let t=n.getBoundingClientRect(),r=t.left+t.width/2,i=t.top+t.height/2,a=e.clientX-r,o=e.clientY-i;if(Math.hypot(a,o)<4)return;let s=Math.atan2(o,a)*180/Math.PI- -45;ee(e=>IG(e,s))});window.addEventListener(`pointermove`,t,{passive:!0}),pR(()=>{window.removeEventListener(`pointermove`,t)})}));let ce={width:78,height:28},[le,ue]=J(kG(d())),de=(e,t)=>{OG(e)!==OG(t)&&ue(kG(t))},fe=(e,n)=>{let r=t?.getBoundingClientRect(),i=kG(n);return MG(e,n,ce,r?.width??i.width,r?.height??i.height)},pe=()=>{g(AG(d(),p(),ce.width,ce.height))},me=te.createDragAwareHandler(()=>e.onToggle?.()),he=te.createDragAwareHandler(()=>e.onActivateAction?.(aN)),ge=te.createDragAwareHandler(()=>e.onActivateAction?.(oN)),_e=`group contain-layout flex items-center justify-center cursor-pointer interactive-scale a11y-hitbox`,ve=()=>oW(`relative contain-layout flex items-center justify-center`,A()),ye=e=>e?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)]`,be=te.createDragAwareHandler(()=>{let e=t?.getBoundingClientRect(),n=s(),r=p();if(n){let{position:e,ratio:t}=fe(je(),d());r=t,g(e),m(r)}else e&&(ce={width:e.width,height:e.height});b(!0),c(e=>!e),Ae({edge:d(),ratio:r,collapsed:!n,enabled:n}),Ce&&clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}),xe=()=>NG(d(),h(),ce,le()),Se,Ce,we=null,Te=()=>{let e=t?.getBoundingClientRect();!e||e.width===0||e.height===0||(s()?ue({width:e.width,height:e.height}):(ce={width:e.width,height:e.height},we={width:e.width,height:e.height}))},Ee=(e,t)=>{if(!(e===0||t===0)&&!(te.isDragging()||te.isSnapping())&&!y()){if(s()){let n=le();if(n.width===e&&n.height===t)return;ue({width:e,height:t});return}we&&we.width===e&&we.height===t||(we={width:e,height:t},ce={width:e,height:t},g(AG(d(),p(),e,t)))}},De=null,Oe=()=>{te.isDragging()||te.isSnapping()||De===null&&(De=UF(()=>{De=null,pe()}))},ke=()=>{te.isDragging()||(u(!0),pe(),Se&&clearTimeout(Se),Se=setTimeout(()=>{u(!1);let e=jG(d(),h().x,h().y,ce.width,ce.height);m(e),Ae({edge:d(),ratio:e,collapsed:s(),enabled:!s()})},500))},Ae=t=>{DV(t),e.onStateChange?.(t)};fR(()=>{t&&e.onContainerRef?.(t);let n=t?.getBoundingClientRect(),r=iW(),a=!!(n&&n.width>0&&n.height>0);i?(a&&n&&(ce={width:n.width,height:n.height}),c(i.collapsed),g(AG(i.edge,i.ratio,ce.width,ce.height))):a&&n?(ce={width:n.width,height:n.height},g({x:r.offsetLeft+(r.width-n.width)/2,y:r.offsetTop+r.height-n.height-16}),m(rN)):(g(AG(`bottom`,rN,ce.width,ce.height)),m(rN)),e.onSubscribeToStateChanges&&pR(e.onSubscribeToStateChanges(e=>{if(y()||!t?.getBoundingClientRect())return;let n=s()!==e.collapsed;if(de(d(),e.edge),f(e.edge),n&&!e.collapsed){let t=je();b(!0),c(e.collapsed);let{position:n,ratio:r}=fe(t,e.edge);g(n),m(r),clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}else n&&(b(!0),clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)),c(e.collapsed),g(AG(e.edge,e.ratio,ce.width,ce.height)),m(e.ratio)})),window.addEventListener(`resize`,ke),window.visualViewport?.addEventListener(`resize`,ke),window.visualViewport?.addEventListener(`scroll`,ke);let l=wM();if(l&&(window.addEventListener(`scroll`,Oe,{passive:!0,capture:!0}),typeof ResizeObserver<`u`)){let e=new ResizeObserver(Oe);e.observe(l),pR(()=>e.disconnect())}if(typeof ResizeObserver<`u`&&t){let e=new ResizeObserver(e=>{let n=e[0];if(!n)return;let r=n.borderBoxSize?.[0],i,a;if(r)i=r.inlineSize,a=r.blockSize;else{let e=t?.getBoundingClientRect();if(!e)return;i=e.width,a=e.height}Ee(i,a)});e.observe(t),pR(()=>e.disconnect())}let u=setTimeout(()=>{o(!0)},500);pR(()=>{clearTimeout(u)})}),pR(()=>{window.removeEventListener(`resize`,ke),window.visualViewport?.removeEventListener(`resize`,ke),window.visualViewport?.removeEventListener(`scroll`,ke),window.removeEventListener(`scroll`,Oe,{capture:!0}),De!==null&&WF(De),clearTimeout(Se),clearTimeout(Ce),r&&O()});let je=()=>s()?xe():h(),Me=()=>s()?`cursor-pointer`:te.isDragging()?`cursor-grabbing`:`cursor-grab`,Ne=()=>C()||!!e.isContextMenuOpen||te.isDragging()||te.isSnapping()||y()||x(),Pe=()=>!!e.isActive&&!Ne(),Fe=()=>l()||te.isDragging()?``:te.isSnapping()?`transition-[transform,opacity] duration-300 ease-out`:y()?`transition-[transform,opacity] ${s()?`duration-140`:`duration-220`} ease-drawer`:`transition-[transform,opacity] duration-400 ease-drawer`,Ie=()=>{switch(d()){case`top`:return`center top`;case`bottom`:return`center bottom`;case`left`:return`left center`;case`right`:return`right center`;default:return`center center`}};return(()=>{var r=LG();r.addEventListener(`mouseleave`,()=>{w(!1),e.onSelectHoverChange?.(!1)}),r.addEventListener(`mouseenter`,()=>{w(!0),s()||e.onSelectHoverChange?.(!0)}),rz(r,`mousedown`,oe),rz(r,`pointerdown`,e=>{oe(e),te.handlePointerDown(e)});var i=t;return typeof i==`function`?cz(i,r):t=r,$(r,X(DG,{get isCollapsed(){return s()},get snapEdge(){return d()},get isShaking(){return _()},get isChevronPressed(){return x()},get transformOrigin(){return Ie()},onAnimationEnd:()=>v(!1),onCollapseClick:be,onCollapsePointerDown:()=>S(!0),onCollapsePointerUp:()=>S(!1),onCollapsePointerLeave:()=>S(!1),onPanelClick:e=>{if(s()){e.stopPropagation();let{position:t,ratio:n}=fe(je(),d());g(t),m(n),b(!0),c(!1),Ae({edge:d(),ratio:n,collapsed:!1,enabled:!0}),Ce&&clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}},get actionButtons(){return[X(SG,UR({actionId:iN,isToggle:!0,ref:e=>n=e,get label(){return re()?`Stop selecting element`:`Copy element`},get isActive(){return re()},class:_e,get wrapperClass(){return ve()},onClick:me,onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),D(null),e.onToggleToolbarMenu?.()}},()=>se(iN),{get icon(){return X(fG,{size:14,get rotationDeg(){return T()},get class(){return ye(re())}})},get tooltipVisible(){return ie(iN)},get tooltipPosition(){return ae()},tooltip:`Copy`})),X(SG,UR({actionId:aN,label:`Comment on element`,get isActive(){return ne(aN)},class:_e,get wrapperClass(){return ve()},onClick:he},()=>se(aN),{get icon(){return X(mG,{size:14,get class(){return ye(ne(aN))}})},get tooltipVisible(){return ie(aN)},get tooltipPosition(){return ae()},tooltip:`Comment`})),X(SG,UR({actionId:oN,label:`Style element`,get isActive(){return ne(oN)},class:_e,get wrapperClass(){return ve()},onClick:ge},()=>se(oN),{get icon(){return X(gG,{size:14,get class(){return ye(ne(oN))}})},get tooltipVisible(){return ie(oN)},get tooltipPosition(){return ae()},tooltip:`Style`}))]}})),aR(e=>{var t=oW(`fixed left-0 top-0 font-sans text-[13px] antialiased select-none`,Me(),Fe(),a()?`pointer-events-auto`:`pointer-events-none`),n=String(LM),i=`translate(${je().x}px, ${je().y}px) scale(${Pe()?.97:1})`,o=Ie(),s=a()?Pe()?.55:1:0;return t!==e.e&&nz(r,e.e=t),n!==e.t&&oz(r,`z-index`,e.t=n),i!==e.a&&oz(r,`transform`,e.a=i),o!==e.o&&oz(r,`transform-origin`,e.o=o),s!==e.i&&oz(r,`opacity`,e.i=s),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r})()},zG=gR(),BG=()=>{let e=_R(zG);if(!e)throw Error(`Menu subcomponents must be rendered inside <Menu.Provider>`);return e},VG=e=>X(zG.Provider,{get value(){return e.store},get children(){return e.children}}),HG=e=>X(TW,{get class(){return oW(`flex flex-col w-fit h-fit`,e.class)},get style(){return e.style},get children(){return e.children}}),UG=Z(`<div role=menu aria-orientation=vertical><div aria-hidden=true class="pointer-events-none absolute opacity-0 transition-[top,left,width,height,opacity,border-radius] duration-75 ease-out bg-[var(--rg-surface-hover)]">`),WG=e=>{let t=BG();return(()=>{var n=UG(),r=n.firstChild;n.$$pointermove=()=>t.notePointerMove(),cz(n=>{t.setHighlightContainer(n),e.ref?.(n)},n);var i=t.setHighlightRail;return typeof i==`function`?cz(i,r):t.setHighlightRail=r,$(n,()=>e.children,null),aR(r=>{var i=e.label,a=t.keyboardNavigation?t.activeDescendantId():void 0,o=t.keyboardNavigation?-1:void 0,s=oW(`relative flex flex-col`,e.class);return i!==r.e&&Q(n,`aria-label`,r.e=i),a!==r.t&&Q(n,`aria-activedescendant`,r.t=a),o!==r.a&&Q(n,`tabindex`,r.a=o),s!==r.o&&nz(n,r.o=s),r},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()},$R([`pointermove`]),GG=Z(`<button data-react-grab-ignore-events type=button>`),KG=e=>{let t=BG(),n=t.createItemId(),r=e.value,i=()=>e.role??`menuitem`,a=()=>!e.disabled,o=()=>t.activeValue()===r,s;return fR(()=>{s&&(t.registerItem({value:r,domId:n,element:s,isEnabled:a,onSelect:()=>e.onSelect?.()}),pR(()=>t.unregisterItem(r)))}),(()=>{var c=GG();c.$$click=t=>{t.stopPropagation(),a()&&e.onSelect?.()},c.addEventListener(`pointerleave`,()=>{t.clearActiveOnPointerLeave&&t.setActiveItem(null)}),c.addEventListener(`pointerenter`,()=>{a()&&t.canActivateOnHover()&&t.setActiveItem(r)}),c.$$pointerdown=e=>e.stopPropagation();var l=s;return typeof l==`function`?cz(l,c):s=c,Q(c,`id`,n),$(c,()=>e.children),aR(n=>{var a=e.dataId??r,s=i(),l=i()===`menuitemradio`?!!e.checked:void 0,u=!!e.disabled,d=t.keyboardNavigation?o()?0:-1:void 0,f=e.disabled,p=oW(`relative z-1 contain-layout flex items-center justify-between w-full px-2 py-1 cursor-pointer text-left border-none bg-transparent disabled:opacity-40 disabled:cursor-default`,e.class);return a!==n.e&&Q(c,`data-react-grab-menu-item`,n.e=a),s!==n.t&&Q(c,`role`,n.t=s),l!==n.a&&Q(c,`aria-checked`,n.a=l),u!==n.o&&Q(c,`aria-disabled`,n.o=u),d!==n.i&&Q(c,`tabindex`,n.i=d),f!==n.n&&(c.disabled=n.n=f),p!==n.s&&nz(c,n.s=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),c})()},$R([`pointerdown`,`click`]),qG=Z(`<span>`),JG=e=>(()=>{var t=qG();return $(t,()=>e.children),aR(()=>nz(t,oW(`text-[13px] leading-4 font-sans font-medium`,e.class))),t})(),YG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M6.5 5C5.67157 5 5 5.67157 5 6.5C5 7.32843 5.67157 8 6.5 8H8V6.5C8 5.67157 7.32843 5 6.5 5ZM10 8V6.5C10 4.567 8.433 3 6.5 3C4.567 3 3 4.567 3 6.5C3 8.433 4.567 10 6.5 10H8V14H6.5C4.567 14 3 15.567 3 17.5C3 19.433 4.567 21 6.5 21C8.433 21 10 19.433 10 17.5V16H14V17.5C14 19.433 15.567 21 17.5 21C19.433 21 21 19.433 21 17.5C21 15.567 19.433 14 17.5 14H16V10H17.5C19.433 10 21 8.433 21 6.5C21 4.567 19.433 3 17.5 3C15.567 3 14 4.567 14 6.5V8H10ZM10 10V14H14V10H10ZM16 8H17.5C18.3284 8 19 7.32843 19 6.5C19 5.67157 18.3284 5 17.5 5C16.6716 5 16 5.67157 16 6.5V8ZM16 16V17.5C16 18.3284 16.6716 19 17.5 19C18.3284 19 19 18.3284 19 17.5C19 16.6716 18.3284 16 17.5 16H16ZM8 16H6.5C5.67157 16 5 16.6716 5 17.5C5 18.3284 5.67157 19 6.5 19C7.32843 19 8 18.3284 8 17.5V16Z">`),XG=e=>{let t=()=>e.size??11;return(()=>{var n=YG();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},ZG=Z(`<span>`),QG=Z(`<span style=display:inline-flex;align-items:center;gap:2px>`),$G=Z(`<span>Ctrl+`),eK=e=>{let t=()=>e.shortcut===`Enter`,n=()=>e.modifier!==!1,r=SB();return(()=>{var i=QG();return $(i,X(qR,{get when(){return t()},get children(){return X(AW,{size:8})}}),null),$(i,X(qR,{get when(){return!t()},get children(){return X(qR,{get when(){return n()},get fallback(){return(()=>{var t=ZG();return $(t,()=>e.shortcut),t})()},get children(){return X(qR,{when:r,get fallback(){return(()=>{var t=$G();return t.firstChild,$(t,()=>e.shortcut,null),t})()},get children(){return[X(XG,{size:9}),(()=>{var t=ZG();return $(t,()=>e.shortcut),t})()]}})}})}}),null),aR(()=>nz(i,e.class)),i})()},tK=e=>X(eK,{get shortcut(){return e.shortcut},get modifier(){return e.modifier},get class(){return oW(`text-[11px] font-sans text-[var(--rg-text-secondary)] ml-4`,e.class)}}),nK=({hiddenOpacity:e=`0`,visibleOpacity:t=`1`}={})=>{let n,r,i,a=e=>{r&&(r.style.opacity=t,r.style.top=`${e.offsetTop}px`,r.style.left=`${e.offsetLeft}px`,r.style.width=`${e.offsetWidth}px`,r.style.height=`${e.offsetHeight}px`)},o=typeof ResizeObserver>`u`?void 0:new ResizeObserver(()=>{i&&a(i)});pR(()=>o?.disconnect());let s=()=>{i=void 0,o?.disconnect(),r&&(r.style.opacity=e)};return{containerRef:e=>{n=e},followerRef:e=>{r=e},followElement:e=>{if(!(!r||!n)){if(!e){s();return}i=e,a(e),o?.disconnect(),o?.observe(e),o?.observe(n)}},hideFollower:s}},rK=(e,t)=>e!==t&&e instanceof HTMLElement,iK=(e,t)=>{let n=[];for(let r of Array.from(e.children))rK(r,t)&&n.push(r);return n},aK=(e={})=>{let{topCornerRadiusPx:t,bottomCornerRadiusPx:n,cornerShape:r}=e,i=t!==void 0||n!==void 0,a,o=!1,s=e=>{if(!a||!i)return;let s=e.parentElement;if(!s)return;let c=iK(s,a),l=c[0]===e,u=c[c.length-1]===e,d=l&&t!==void 0?`${t}px`:`0px`,f=u&&n!==void 0?`${n}px`:`0px`;a.style.borderTopLeftRadius=d,a.style.borderTopRightRadius=d,a.style.borderBottomLeftRadius=f,a.style.borderBottomRightRadius=f,r&&!o&&(a.style.setProperty(`corner-shape`,r),o=!0)},{containerRef:c,followerRef:l,followElement:u,hideFollower:d}=nK();return{containerRef:c,highlightRef:e=>{a=e,o=!1,l(e)},updateHighlight:e=>{u(e),e&&s(e)},clearHighlight:d}},oK=(e={})=>{let t=new Map,n=[],r=`react-grab-menu-${Math.random().toString(36).slice(2,8)}`,i=0,a=!1,o=e.value!==void 0,[s,c]=J(null),[l,u]=J(0),d=Y(()=>o?e.value?.()??null:s()),f=t=>{if(o){e.onValueChange?.(t);return}c(t)},p=aK(e.highlight??{});oR(dR([d,l],([e])=>{if(e===null){p.clearHighlight();return}let n=t.get(e);n?p.updateHighlight(n.element):p.clearHighlight()}));let m=()=>n.filter(e=>t.get(e)?.isEnabled()),h=()=>{let e=m();e.length>0&&f(e[0])},g=()=>{let e=m();e.length>0&&f(e[e.length-1])},_=()=>{let e=m();if(e.length===0)return;let t=e.indexOf(d()??``);f(e[t===-1?0:(t+1)%e.length])},v=()=>{let e=m();if(e.length===0)return;let t=e.indexOf(d()??``);f(e[t===-1?e.length-1:(t-1+e.length)%e.length])},y=Y(()=>{l();let e=d();if(e!==null)return t.get(e)?.domId});return{keyboardNavigation:e.keyboardNavigation??!1,clearActiveOnPointerLeave:e.clearActiveOnPointerLeave??!1,activeValue:d,activeDescendantId:y,setActiveItem:f,createItemId:()=>`${r}-item-${i++}`,canActivateOnHover:()=>!(e.requirePointerMove??!1)||a,notePointerMove:()=>{a=!0},resetPointerMove:()=>{a=!1},registerItem:e=>{t.set(e.value,e),n.includes(e.value)||n.push(e.value),u(e=>e+1)},unregisterItem:e=>{t.delete(e);let r=n.indexOf(e);r!==-1&&n.splice(r,1),o||c(t=>t===e?null:t),u(e=>e+1)},getActiveItem:()=>{let e=d();return e===null?void 0:t.get(e)},selectFirst:h,selectLast:g,selectNext:_,selectPrevious:v,setHighlightContainer:p.containerRef,setHighlightRail:p.highlightRef}},sK={Provider:VG,Panel:HG,List:WG,Item:KG,Label:JG,Shortcut:tK},cK=e=>e??!0,lK=(e,t)=>typeof e.enabled==`function`?t?e.enabled(t):!1:cK(e.enabled),uK=e=>{e.type===`contextmenu`&&e.preventDefault(),e.stopImmediatePropagation()},dK=e=>{let t=EM(t=>{e.isOpen()&&(e.shouldIgnoreKeyboardEvent?.(t)||e.shouldIgnoreInputEvents&&Zz(t)||t.code===`Escape`&&(t.preventDefault(),t.stopImmediatePropagation(),e.onDismiss(`keyboard`)))}),n=EM(t=>{e.isOpen()&&(CB(t,`data-react-grab-ignore-events`)||e.shouldIgnoreRightClick&&t instanceof MouseEvent&&t.button===2||e.onDismiss(`pointer`))}),r=UF(()=>{window.addEventListener(`mousedown`,n,{capture:!0}),window.addEventListener(`touchstart`,n,{capture:!0})});return window.addEventListener(`keydown`,t,{capture:!0}),()=>{WF(r),window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`mousedown`,n,{capture:!0}),window.removeEventListener(`touchstart`,n,{capture:!0})}},fK=Z(`<div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 w-fit h-fit px-2">`),pK=Z(`<div data-react-grab-ignore-events data-react-grab-context-menu class="fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none"style=pointer-events:auto>`),mK=e=>{let t,n,r=null,i=oK({keyboardNavigation:!0,highlight:{bottomCornerRadiusPx:14,cornerShape:sN}}),[a,o]=J(0),[s,c]=J(0),l=Y(()=>e.position!==null),u=Y(()=>sW({tagName:e.tagName,componentName:e.componentName})),d=()=>{if(t){let e=t.getBoundingClientRect();o(e.width),c(e.height)}};oR(()=>{l()&&UF(d)});let f=Y(()=>{let t=e.selectionBounds,n=e.position,r=a(),i=s();if(r===0||i===0||!t||!n)return{left:uN.left,top:uN.top,arrowLeft:0,arrowPosition:`bottom`};let o=n.x??t.x+t.width/2,c=Math.max(4,Math.min(o-r/2,window.innerWidth-r-4)),l=Math.max(8,Math.min(o-c,r-8)),u=t.y+t.height+8+4,d=t.y-i-8-4,f=u+i>window.innerHeight,p=d>=0,m=f&&p,h=m?d:u,g=m?`top`:`bottom`;if(f&&!p){let e=n.y??t.y+t.height/2;h=Math.max(4,Math.min(e+4,window.innerHeight-i-4)),g=`top`}return{left:c,top:h,arrowLeft:l,arrowPosition:g}}),p=Y(()=>{let t=e.actions??[],n=e.actionContext;return t.map(e=>({id:e.id,label:e.label,action:()=>{n&&e.onAction(n)},enabled:lK(e,n),shortcut:e.shortcut,shortcutModifier:e.shortcutModifier}))});oR(dR(l,e=>{if(e){let e=t?.getRootNode(),i=e instanceof ShadowRoot?e.activeElement:null,a=document.activeElement;r=a instanceof HTMLElement&&i===null&&!(t instanceof Element&&t.contains(a))?a:null,n?.focus({preventScroll:!0});return}i.setActiveItem(null);let a=r;r=null,!(!(a instanceof HTMLElement)||!document.contains(a))&&UF(()=>{let e=document.activeElement;(e===null||e===document.body)&&a.focus({preventScroll:!0})})})),fR(()=>{d();let t=t=>{if(!l())return;let n=t.key===`ArrowDown`,r=t.key===`ArrowUp`,a=t.key===`Home`,o=t.key===`End`,s=t.key===`Tab`;if(n||r||a||o||s){t.preventDefault(),t.stopPropagation();let e=n||s&&!t.shiftKey;a?i.selectFirst():o?i.selectLast():e?i.selectNext():i.selectPrevious();return}let c=e.actions??[],u=e.actionContext,d=n=>{u&&lK(n,u)&&(t.preventDefault(),t.stopPropagation(),n.onAction(u),e.onHide())};if(t.key===`Enter`){let e=i.getActiveItem();if(e){t.preventDefault(),t.stopPropagation(),e.isEnabled()&&e.onSelect();return}}let f=jV(c,t,{includeModifierShortcuts:!0});f&&d(f)},n=dK({isOpen:l,onDismiss:e.onDismiss,shouldIgnoreRightClick:!0}),r=EM(t);window.addEventListener(`keydown`,r,{capture:!0}),pR(()=>{n(),window.removeEventListener(`keydown`,r,{capture:!0})})});let m=Y(()=>{let{tagName:e,componentName:t}=u();return`Actions for ${t?`${t}.${e}`:e}`});return X(qR,{get when(){return l()},get children(){var r=pK();rz(r,`contextmenu`,uK,!0),rz(r,`click`,uK,!0),rz(r,`mousedown`,uK,!0),rz(r,`pointerdown`,uK,!0);var a=t;return typeof a==`function`?cz(a,r):t=r,oz(r,`z-index`,`${LM}`),$(r,X(pW,{get position(){return f().arrowPosition},leftPercent:0,get leftOffsetPx(){return f().arrowLeft}}),null),$(r,X(sK.Panel,{class:`justify-center items-start min-w-[100px]`,get children(){return[(()=>{var t=fK();return $(t,X(yW,{get tagName(){return u().tagName},get componentName(){return u().componentName},get isClickable(){return e.hasFilePath},onClick:t=>{t.stopPropagation(),e.hasFilePath&&e.actionContext&&(e.actions?.find(e=>e.id===`open`))?.onAction(e.actionContext)},shrink:!0})),t})(),X(xW,{get children(){return X(sK.Provider,{store:i,get children(){return X(sK.List,{ref:e=>n=e,get label(){return m()},class:`w-[calc(100%+16px)] -mx-2 -my-1.5 outline-none`,get children(){return X(GR,{get each(){return p()},children:t=>X(sK.Item,{get value(){return t.id},get dataId(){return t.label.toLowerCase()},get disabled(){return!t.enabled},onSelect:()=>{t.action(),e.onHide()},get children(){return[X(sK.Label,{class:`text-[var(--rg-text-primary)]`,get children(){return t.label}}),X(qR,{get when(){return t.shortcut},children:e=>X(sK.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})})}})}})}})]}}),null),aR(e=>{var t=`${f().top}px`,n=`${f().left}px`;return t!==e.e&&oz(r,`top`,e.e=t),n!==e.t&&oz(r,`left`,e.t=n),e},{e:void 0,t:void 0}),r}})},$R([`pointerdown`,`mousedown`,`click`,`contextmenu`]),hK=(e,t,n,r)=>Math.max(r,Math.min(e,n-t-r)),gK=({anchor:e,measuredWidth:t,measuredHeight:n,viewportLeft:r=0,viewportTop:i=0,viewportWidth:a,viewportHeight:o,anchorGapPx:s,viewportPaddingPx:c,offscreenPosition:l})=>{if(!e||t===0||n===0)return l;let u,d;return e.edge===`left`||e.edge===`right`?(u=e.edge===`left`?e.x+s:e.x-t-s,d=e.y-n/2):(u=e.x-t/2,d=e.edge===`top`?e.y+s:e.y-n-s),{left:r+hK(u-r,t,a,c),top:i+hK(d-i,n,o,c)}},_K=(e,t)=>{let[n,r]=J(0),[i,a]=J(0),[o,s]=J(!1),[c,l]=J(!1),[u,d]=J(0),[f,p]=J(`bottom`),m,h,g=()=>{clearTimeout(m),h!==void 0&&(WF(h),h=void 0)},_=()=>{let t=e();t&&(r(t.offsetWidth),a(t.offsetHeight))},v=()=>{lR(()=>{d(e=>e+1),_()})},y=Y(()=>t()!==null);return oR(()=>{let n=t();n?(p(n.edge),clearTimeout(m),s(!0),h!==void 0&&WF(h),h=UF(()=>{_(),e()?.offsetHeight,l(!0)})):(h!==void 0&&WF(h),l(!1),m=setTimeout(()=>{s(!1)},120)),pR(g)}),oR(()=>{if(!y())return;window.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`scroll`,v);let e=wM(),t;e&&typeof ResizeObserver<`u`&&(t=new ResizeObserver(v),t.observe(e)),pR(()=>{window.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`scroll`,v),t?.disconnect()})}),{shouldMount:o,isAnimatedIn:c,lastAnchorEdge:f,displayPosition:Y(e=>{u();let r=iW(),a=gK({anchor:t(),measuredWidth:n(),measuredHeight:i(),viewportLeft:r.offsetLeft,viewportTop:r.offsetTop,viewportWidth:r.width,viewportHeight:r.height,anchorGapPx:8,viewportPaddingPx:8,offscreenPosition:uN});return a.left===uN.left?e:a},uN),measure:_,clearAnimationHandles:g}},vK={padding:{prefix:`p`,scale:`spacing`},"padding-top,padding-bottom":{prefix:`py`,scale:`spacing`},"padding-left,padding-right":{prefix:`px`,scale:`spacing`},"padding-top":{prefix:`pt`,scale:`spacing`},"padding-right":{prefix:`pr`,scale:`spacing`},"padding-bottom":{prefix:`pb`,scale:`spacing`},"padding-left":{prefix:`pl`,scale:`spacing`},margin:{prefix:`m`,scale:`spacing`},"margin-top,margin-bottom":{prefix:`my`,scale:`spacing`},"margin-left,margin-right":{prefix:`mx`,scale:`spacing`},"margin-top":{prefix:`mt`,scale:`spacing`},"margin-right":{prefix:`mr`,scale:`spacing`},"margin-bottom":{prefix:`mb`,scale:`spacing`},"margin-left":{prefix:`ml`,scale:`spacing`},gap:{prefix:`gap`,scale:`spacing`},"column-gap":{prefix:`gap-x`,scale:`spacing`},"row-gap":{prefix:`gap-y`,scale:`spacing`},"width,height":{prefix:`size`,scale:`spacing`},width:{prefix:`w`,scale:`spacing`},height:{prefix:`h`,scale:`spacing`},"min-width":{prefix:`min-w`,scale:`spacing`},"max-width":{prefix:`max-w`,scale:`spacing`},"min-height":{prefix:`min-h`,scale:`spacing`},"max-height":{prefix:`max-h`,scale:`spacing`},"top,right,bottom,left":{prefix:`inset`,scale:`spacing`},"top,bottom":{prefix:`inset-y`,scale:`spacing`},"left,right":{prefix:`inset-x`,scale:`spacing`},top:{prefix:`top`,scale:`spacing`},right:{prefix:`right`,scale:`spacing`},bottom:{prefix:`bottom`,scale:`spacing`},left:{prefix:`left`,scale:`spacing`},"border-width":{prefix:`border`,scale:`border-width`},"border-top-width":{prefix:`border-t`,scale:`border-width`},"border-right-width":{prefix:`border-r`,scale:`border-width`},"border-bottom-width":{prefix:`border-b`,scale:`border-width`},"border-left-width":{prefix:`border-l`,scale:`border-width`},"z-index":{prefix:`z`,scale:`z-index`},opacity:{prefix:`opacity`,scale:`opacity`}},yK=(e,t)=>{let n=vK[e];if(!n)return null;let{prefix:r,scale:i}=n;if(i===`spacing`){if(t<0)return null;let e=t/4;return!Number.isInteger(e)||e>96?null:`${r}-${e}`}return i===`border-width`?!Number.isInteger(t)||t<0||t>8?null:t===1?r:`${r}-${t}`:i===`z-index`?!Number.isInteger(t)||t<0||t>50?null:`${r}-${t}`:!Number.isFinite(t)||t<0||t>100||t%5!=0?null:`${r}-${t}`},bK=e=>{let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement:e.ownerDocument?.activeElement??document.activeElement},xK=e=>e.toLowerCase()===`#00000000`?mN:e.toUpperCase(),SK=Z(`<input data-react-grab-ignore-events data-react-grab-input type=text autocapitalize=none autocorrect=off autocomplete=off>`),CK=e=>{let[t,n]=WR(e,[`class`,`ref`,`autoFocusSelect`]);return(()=>{var e=SK();return cz(e=>{t.autoFocusSelect&&queueMicrotask(()=>{e.focus(),e.select()}),t.ref?.(e)},e),Q(e,`spellcheck`,!1),sz(e,UR({get class(){return oW(`bg-transparent border-none outline-none text-[var(--rg-text-primary)] p-0 m-0`,t.class)}},n),!1,!1),e})()},wK=`text-[13px] leading-4 font-medium`,TK={position:`absolute`,opacity:0,"pointer-events":`none`,width:`0`,height:`0`,margin:`0`,padding:`0`,overflow:`hidden`},EK=Z(`<div class="flex items-center gap-2 w-full px-2 h-[20px]"><div class="flex items-center gap-1 ml-auto shrink-0"><button type=button data-react-grab-ignore-events aria-label="Pick color"class="size-[16px] rounded-[4px] border-[var(--rg-border-button)] [border-width:0.5px] border-solid p-0 m-0 cursor-pointer shrink-0"></button><input data-react-grab-ignore-events type=color aria-hidden=true tabindex=-1 class="absolute opacity-0 pointer-events-none size-0">`),DK=Z(`<span>`),OK=Z(`<span class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)] cursor-text">`),kK=e=>e.length===9?e.slice(0,7):e,AK=e=>{let[t,n]=J(null),r=()=>t()!==null,i=()=>xK(e.value),a,o=!0;pR(()=>{o=!1}),fR(()=>{let t=e.onRegisterTrigger?.(()=>a?.click());pR(()=>t?.())});let s=()=>{let r=t();if(r===null)return;n(null);let i=vB(r);i?i.toLowerCase()!==e.value.toLowerCase()&&e.onCommit(i,`keyboard`):e.onInvalidCommit?.(),e.onEditComplete?.()},c=()=>{r()&&(n(null),e.onEditComplete?.())},l=e=>{if(!(e.isComposing||e.keyCode===229)){if(e.stopImmediatePropagation(),e.key===`Enter`){e.preventDefault(),s();return}e.key===`Escape`&&(e.preventDefault(),c())}},u=t=>{t.preventDefault(),t.stopPropagation(),e.onInteract?.(),a?.click()};return(()=>{var c=EK(),d=c.firstChild,f=d.firstChild,p=f.nextSibling;$(c,X(qR,{get when(){return e.label},children:e=>(()=>{var t=DK();return nz(t,`${wK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,e),t})()}),d),$(d,X(qR,{get when(){return r()},get fallback(){return(()=>{var e=OK();return e.$$click=e=>{e.preventDefault(),e.stopPropagation(),n(i())},e.$$pointerdown=e=>e.stopPropagation(),$(e,i),aR(()=>Q(e,`data-react-grab-value`,i())),e})()},get children(){return X(CK,{autoFocusSelect:!0,inputmode:`text`,"aria-label":`Style color hex`,class:`text-[12px] leading-4 font-medium tabular-nums text-right`,get style(){return{"field-sizing":`content`,"min-width":`32px`,"max-width":e.emphasized?`100px`:`72px`}},get value(){return t()??``},onInput:e=>n(e.currentTarget.value),onKeyDown:l,onBlur:s,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()})}}),f),f.$$click=u,f.$$mousedown=e=>e.preventDefault(),f.$$pointerdown=e=>e.stopPropagation(),p.$$input=t=>{if(!o)return;let n=t.currentTarget.value,r=e.value.length===9?e.value.slice(7):``,i=n+(r.toLowerCase()===`00`?``:r);e.onInteract?.(),i&&i.toLowerCase()!==e.value.toLowerCase()&&e.onCommit(i,`pointer`)};var m=a;return typeof m==`function`?cz(m,p):a=p,aR(t=>oz(f,`background-color`,e.value)),aR(()=>p.value=kK(e.value)),c})()},$R([`pointerdown`,`mousedown`,`click`,`input`]),jK=Z(`<svg width=1em height=1em viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg aria-hidden=true style=width:16px;height:16px;flex-shrink:0;cursor:pointer><path fill-rule=evenodd clip-rule=evenodd>`),MK=e=>{let t=()=>e.active?`var(--rg-text-primary)`:`var(--rg-text-secondary)`,n=()=>e.active?e.direction===`left`?-2:2:0,r=()=>e.active?1.12:1,i=()=>e.direction===`left`?`M2.54282 10.5427C1.76177 11.3238 1.76177 12.5901 2.54282 13.3712L9.70183 20.5302C11.1193 21.9476 13.5428 20.9437 13.5428 18.9392V16.9573H21.0428C22.1474 16.9573 23.0428 16.0619 23.0428 14.9573V8.95733C23.0428 7.85276 22.1474 6.95733 21.0428 6.95733L13.5428 6.95733V4.97473C13.5428 2.9702 11.1193 1.96631 9.70183 3.38373L2.54282 10.5427Z`:`M14.2983 20.5302L21.4573 13.3712C22.2383 12.5901 22.2383 11.3238 21.4573 10.5427L14.2983 3.38374C12.8808 1.96631 10.4573 2.97019 10.4573 4.97473V6.95659L3.95728 6.95659C2.85271 6.95659 1.95728 7.85202 1.95728 8.95659V14.9566C1.95728 16.0612 2.85271 16.9566 3.95727 16.9566H10.4573V18.9392C10.4573 20.9437 12.8808 21.9476 14.2983 20.5302Z`;return(()=>{var a=jK(),o=a.firstChild;return rz(a,`pointerdown`,e.onPointerDown,!0),aR(s=>{var c=`translateX(${n()}px) scale(${r()})`,l=e.active?`transform 30ms cubic-bezier(0, 0, 0.2, 1)`:`transform 450ms cubic-bezier(0.34, 1.8, 0.64, 1)`,u=i(),d=t(),f=e.active?`fill 50ms ease`:`fill 300ms ease`;return c!==s.e&&oz(a,`transform`,s.e=c),l!==s.t&&oz(a,`transition`,s.t=l),u!==s.a&&Q(o,`d`,s.a=u),d!==s.o&&Q(o,`fill`,s.o=d),f!==s.i&&oz(o,`transition`,s.i=f),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a})()},$R([`pointerdown`]),NK=Z(`<span>`),PK=Z(`<div class="flex items-center gap-2 w-full px-2 h-[20px]"><div class="ml-auto shrink-0 flex items-center gap-1"><span data-react-grab-ignore-events role=button tabindex=-1 class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)] cursor-pointer select-none min-w-[36px] text-center">`),FK=e=>{let t=()=>e.options.find(t=>t.value===e.value)?.label??e.value;return(()=>{var n=PK(),r=n.firstChild,i=r.firstChild;return $(n,X(qR,{get when(){return e.label},get children(){var t=NK();return nz(t,`${wK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,()=>e.label),t}}),r),$(r,X(MK,{direction:`left`,get active(){return e.activeKey===`left`},onPointerDown:()=>e.onStep(-1)}),i),i.$$contextmenu=t=>{t.preventDefault(),t.stopPropagation(),e.onStep(-1)},i.$$click=t=>{t.preventDefault(),t.stopPropagation(),e.onStep(1)},i.$$mousedown=e=>e.preventDefault(),i.$$pointerdown=e=>e.stopPropagation(),$(i,t),$(r,X(MK,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)}),null),aR(t=>{var n=`Cycle ${e.label??`value`}`,r=`Click to cycle (${e.options.length} options)`;return n!==t.e&&Q(i,`aria-label`,t.e=n),r!==t.t&&Q(i,`title`,t.t=r),t},{e:void 0,t:void 0}),n})()},$R([`pointerdown`,`mousedown`,`click`,`contextmenu`]),IK=e=>e.kind===`numeric`?e:null,LK=e=>e.kind===`color`?e:null,RK=e=>e.kind===`enum`?e:null,zK=/^[0-9]$/,BK=e=>{let t=Array.from(e),n=t.findIndex(e=>zK.test(e));if(n<0)return{prefixLiterals:t,rightAlignedSegments:[]};let r=t.slice(0,n),i=[],a=0;for(let e=t.length-1;e>=n;e--){let n=t[e],r=zK.test(n)?`digit`:`literal`;i.push({kind:r,value:n,digitDistanceFromRight:a}),r===`digit`&&(a+=1)}return{prefixLiterals:r,rightAlignedSegments:i}},VK=Z(`<span class=rg-slot-column aria-hidden=true><span class=rg-slot-sizer>0</span><span class=rg-slot-cell>`),HK=Z(`<span class="rg-slot-cell rg-slot-exit">`),UK=Z(`<span><span class=inline-flex style=flex-direction:row-reverse>`),WK=Z(`<span class="inline-block whitespace-pre"aria-hidden=true>`),GK=e=>typeof e==`number`?e:Number.parseFloat(String(e).replace(/[^0-9.-]/g,``))||0,KK=e=>{let t,[n,r]=J(null),i=null;oR(dR(()=>e.digit,(n,a)=>{a===void 0||n===a||(t&&(t.classList.remove(`rg-slot-enter`),t.offsetWidth,t.classList.add(`rg-slot-enter`)),r({digit:a,direction:e.direction}),i!==null&&clearTimeout(i),i=setTimeout(()=>r(null),350))},{defer:!0})),pR(()=>{i!==null&&clearTimeout(i)});let a=()=>({"animation-delay":`${e.delayMs}ms`});return(()=>{var r=VK(),i=r.firstChild.nextSibling,o=t;return typeof o==`function`?cz(o,i):t=i,$(i,()=>e.digit),$(r,X(qR,{get when(){return n()},keyed:!0,children:e=>(()=>{var t=HK();return $(t,()=>e.digit),aR(n=>{var r=String(e.direction),i=a();return r!==n.e&&Q(t,`data-dir`,n.e=r),n.t=az(t,i,n.t),n},{e:void 0,t:void 0}),t})()}),null),aR(t=>{var n=String(e.direction),r=a();return n!==t.e&&Q(i,`data-dir`,t.e=n),t.t=az(i,r,t.t),t},{e:void 0,t:void 0}),r})()},qK=e=>{let t=Y(()=>String(e.children??``)),n=Y(()=>BK(t())),r=Y(dR(()=>GK(e.children),(e,t)=>t===void 0||e===t?0:e>t?1:-1)),i=Y(()=>e.direction??r());return(()=>{var r=UK(),a=r.firstChild;return $(r,X(KR,{get each(){return n().prefixLiterals},children:e=>(()=>{var t=WK();return $(t,e),t})()}),a),$(a,X(KR,{get each(){return n().rightAlignedSegments},children:e=>X(qR,{get when(){return e().kind===`digit`},get fallback(){return(()=>{var t=WK();return $(t,()=>e().value),t})()},get children(){return X(KK,{get digit(){return Number(e().value)},get direction(){return i()},get delayMs(){return e().digitDistanceFromRight*18}})}})})),aR(n=>{var i=t(),a=`inline-flex ${e.class??``}`,o={...e.style,"--rg-slot-dur":`350ms`};return i!==n.e&&Q(r,`aria-label`,n.e=i),a!==n.t&&nz(r,n.t=a),n.a=az(r,o,n.a),n},{e:void 0,t:void 0,a:void 0}),r})()},JK=Z(`<div data-react-grab-slider-base aria-hidden=true class="absolute inset-y-0 left-0 right-0 rounded-[6px] bg-[var(--rg-surface-active)] pointer-events-none">`),YK=Z(`<div class="flex items-center gap-1 w-full px-1"><div role=slider aria-keyshortcuts="ArrowLeft ArrowRight"tabindex=-1 class="relative flex-1 h-[20px] flex items-center overflow-hidden rounded-[6px]"><div data-react-grab-slider-fill aria-hidden=true class="absolute inset-y-0 left-0 bg-[var(--rg-surface-active)] pointer-events-none"></div><div aria-hidden=true class="absolute inset-0 pointer-events-none"></div><div data-react-grab-slider-handle aria-hidden=true class="absolute top-[2px] bottom-[2px] w-[2px] rounded-[1px] bg-[var(--rg-text-primary)] pointer-events-none"style="transition:opacity 120ms ease"></div><div class="relative z-10 flex items-center justify-between w-full px-2 pointer-events-none">`),XK=Z(`<div data-react-grab-slider-hash-mark class="absolute top-1/2 w-px h-[8px] rounded-[1px] bg-[var(--rg-text-secondary)]"style="transform:translate(-50%, -50%);transition:opacity 200ms ease">`),ZK=Z(`<span>`),QK=Z(`<span class="ml-auto flex items-center gap-1 pointer-events-auto"><span data-react-grab-value-text class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)]"><span class="text-[9px] text-[var(--rg-text-secondary)] ml-px">`),$K=Z(`<span data-react-grab-tailwind-label aria-hidden=true class="text-[10px] leading-4 text-[var(--rg-text-secondary)] tabular-nums">`),eq=Array.from({length:9},(e,t)=>(t+1)*100/10),tq=/^(-?(?:\d+\.?\d*|\.\d+))\s*([a-zA-Z%]*)$/,nq=e=>{let[t,n]=J(null),[r,i]=J(0),[a,o]=J(!1),[s,c]=J(!1),l=()=>t()!==null,u,d=null,f=()=>{let t=e.max-e.min;return t<=0?0:(Math.max(e.min,Math.min(e.max,e.value))-e.min)/t*100},p=()=>{e.onCommitValue&&n(qB(e.value))},m=()=>!!e.onCommitValue,h=(t,n)=>{if(n.width<=0)return e.value;let r=Math.max(0,Math.min(1,(t-n.left)/n.width));return e.min+r*(e.max-e.min)},g=(t,n)=>{e.onCommitValue?.(h(t,n),`pointer`)},_=(e,t)=>{let n=Math.max(0,e-t.right)-Math.max(0,t.left-e),r=Math.max(0,Math.abs(n)-32),i=Math.sqrt(Math.min(r/200,1));return Math.sign(n)*8*i},v=t=>{if(!m()||l())return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let n=u,r=n!==void 0&&t.target instanceof Node&&n.contains(t.target);d={startX:t.clientX,isDragging:!1,startedOnValueText:r,trackRect:t.currentTarget.getBoundingClientRect()},o(!0),e.onInteract?.()},y=t=>{if(!d)return;let n=t.clientX-d.startX;!d.isDragging&&Math.abs(n)<3||(d.isDragging=!0,e.onInteract?.(),g(t.clientX,d.trackRect),i(_(t.clientX,d.trackRect)))},b=e=>{let t=e.currentTarget;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),d&&(d.isDragging||(d.startedOnValueText?p():g(d.startX,d.trackRect)),d=null,o(!1),i(0))},x=e=>{let t=e.currentTarget;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),d&&(d=null,o(!1),i(0))};fR(()=>{let e=()=>{d=null,o(!1),c(!1),i(0)};window.addEventListener(`blur`,e),pR(()=>window.removeEventListener(`blur`,e))});let S=()=>!!e.activeKey||a()||s(),C=()=>{let r=t();if(r===null)return;n(null);let i=r.trim().replace(/(\d),(\d)/g,`$1.$2`).match(tq);if(!i){e.onInvalidCommit?.(),e.onEditComplete?.();return}let a=i[2].toLowerCase();if(a&&a!==e.unit){e.onInvalidCommit?.(),e.onEditComplete?.();return}let o=Number.parseFloat(i[1]);Number.isFinite(o)?e.onCommitValue?.(o,`keyboard`):e.onInvalidCommit?.(),e.onEditComplete?.()},w=()=>{l()&&(n(null),e.onEditComplete?.())},T=e=>{if(!(e.isComposing||e.keyCode===229)){if(e.stopImmediatePropagation(),e.key===`Enter`){e.preventDefault(),C();return}e.key===`Escape`&&(e.preventDefault(),w())}},ee=()=>{let t=r();return{cursor:m()&&!l()?`ew-resize`:`default`,"touch-action":m()?`none`:`auto`,"user-select":`none`,"-webkit-user-select":`none`,"min-width":e.emphasized?`96px`:void 0,transform:t===0?`translateX(0)`:`translateX(${t}px)`,transition:a()?`none`:`transform 350ms ${gN}`}};return(()=>{var r=YK(),i=r.firstChild,o=i.firstChild,d=o.nextSibling,p=d.nextSibling,m=p.nextSibling;return i.addEventListener(`lostpointercapture`,x),i.addEventListener(`pointercancel`,x),i.$$pointerup=b,i.addEventListener(`pointerleave`,()=>c(!1)),i.addEventListener(`pointerenter`,()=>c(!0)),i.$$pointermove=y,i.$$pointerdown=v,$(i,X(qR,{get when(){return e.emphasized},get children(){var e=JK();return aR(t=>oz(e,`opacity`,l()?0:.55)),e}}),o),$(d,X(KR,{each:eq,children:e=>(()=>{var t=XK();return aR(n=>{var r=`${e()}%`,i=S()?.4:0;return r!==n.e&&oz(t,`left`,n.e=r),i!==n.t&&oz(t,`opacity`,n.t=i),n},{e:void 0,t:void 0}),t})()})),$(m,X(qR,{get when(){return e.label},children:e=>(()=>{var t=ZK();return nz(t,`${wK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,e),t})()}),null),$(m,X(qR,{get when(){return l()},get fallback(){return(()=>{var t=QK(),n=t.firstChild,r=n.firstChild,i=u;return typeof i==`function`?cz(i,t):u=t,$(t,X(qR,{get when(){return e.tailwindLabel},children:e=>(()=>{var t=$K();return $(t,e),t})()}),n),$(n,X(qK,{get children(){return qB(e.value)}}),r),$(r,()=>e.unit),aR(n=>{var r=`${qB(e.value)}${e.unit}`,i=e.onCommitValue?`text`:`default`;return r!==n.e&&Q(t,`data-react-grab-value`,n.e=r),i!==n.t&&oz(t,`cursor`,n.t=i),n},{e:void 0,t:void 0}),t})()},get children(){return X(CK,{autoFocusSelect:!0,inputmode:`decimal`,"aria-label":`Style value`,class:`text-[12px] leading-4 font-medium tabular-nums text-right pointer-events-auto ml-auto`,get style(){return{"field-sizing":`content`,"min-width":`16px`,"max-width":e.emphasized?`120px`:`60px`}},get value(){return t()??``},onInput:e=>n(e.currentTarget.value),onKeyDown:T,onBlur:C,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()})}}),null),$(r,X(qR,{get when(){return e.emphasized},get children(){return[X(MK,{direction:`left`,get active(){return e.activeKey===`left`},onPointerDown:()=>e.onStep(-1)}),X(MK,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)})]}}),null),aR(t=>{var n=e.label??`Value`,r=e.min,c=e.max,u=e.value,d=`${qB(e.value)}${e.unit}`,m=ee(),h=`${f()}%`,g=+!l(),_=`calc(${f()}% - 1px)`,v=e.activeKey?.9:a()||s()?.35:0;return n!==t.e&&Q(i,`aria-label`,t.e=n),r!==t.t&&Q(i,`aria-valuemin`,t.t=r),c!==t.a&&Q(i,`aria-valuemax`,t.a=c),u!==t.o&&Q(i,`aria-valuenow`,t.o=u),d!==t.i&&Q(i,`aria-valuetext`,t.i=d),t.n=az(i,m,t.n),h!==t.s&&oz(o,`width`,t.s=h),g!==t.h&&oz(o,`opacity`,t.h=g),_!==t.r&&oz(p,`left`,t.r=_),v!==t.d&&oz(p,`opacity`,t.d=v),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),r})()},$R([`pointerdown`,`pointermove`,`pointerup`]),rq=e=>X(JR,{get children(){return[X(YR,{get when(){return IK(e.property)},children:t=>X(nq,{get label(){return Kz(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get min(){return t().min},get max(){return t().max},get unit(){return t().unit},get activeKey(){return e.activeKey},get onStep(){return e.onStep},get onCommitValue(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onInteract(){return e.onInteract},get tailwindLabel(){return e.tailwindLabel},get emphasized(){return e.emphasized}})}),X(YR,{get when(){return LK(e.property)},children:t=>X(AK,{get label(){return Kz(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get onCommit(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onRegisterTrigger(){return e.onColorPickerRegister},get onInteract(){return e.onInteract},get emphasized(){return e.emphasized}})}),X(YR,{get when(){return RK(e.property)},children:t=>X(FK,{get label(){return Kz(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get options(){return t().options},get activeKey(){return e.activeKey},get onStep(){return e.onStep}})})]}}),iq=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),aq=e=>X(NW,{"data-react-grab-ignore-events":!0,"data-react-grab-copy-button":!0,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.onCopy()},get children(){return iq()}}),oq=()=>{let[e,t]=J(!1),n,r=()=>{clearTimeout(n),t(!1)},i=()=>{t(!0),clearTimeout(n),n=setTimeout(()=>{t(!1)},hN)},a=()=>{clearTimeout(n)};return pR(a),{isPending:e,show:i,hide:r,cleanup:a}},sq=Z(`<div role=menu aria-orientation=vertical aria-label="Editable properties"class="relative flex flex-col w-full max-h-[var(--rg-edit-list-max-h)] overflow-y-auto outline-none no-scrollbar"><div aria-hidden=true class="pointer-events-none absolute opacity-0 transition-[top,left,width,height,opacity,border-radius] duration-75 ease-out bg-[var(--rg-surface-hover)]">`),cq=Z(`<div class="flex items-center w-full h-[24px]">`),lq=Z(`<button data-react-grab-ignore-events type=button role=menuitem tabindex=-1 class="relative z-1 contain-layout block w-full h-[24px] px-0 py-0 cursor-pointer text-left border-none bg-transparent">`),uq=Z(`<div class="flex items-center justify-between w-full h-[24px] px-2 gap-2"><span class="text-[13px] leading-4 font-sans font-medium text-[var(--rg-text-primary)] truncate min-w-0">`),dq=Z(`<span class="font-sans text-[var(--rg-text-secondary)] tabular-nums shrink-0"><span class=text-[11px]></span><span class="text-[9px] ml-px">`),fq=Z(`<span aria-hidden=true class="size-[12px] rounded-[3px] border-[var(--rg-border-button)] [border-width:0.5px] border-solid shrink-0">`),pq=Z(`<span class="text-[11px] font-sans text-[var(--rg-text-secondary)] shrink-0">`),mq=e=>{let t=RK(e);return t?t.options.find(e=>e.value===t.value)?.label??t.value:``},hq=e=>{let t=[],n,r=!1,i=null,a=()=>{if(!n)return!1;let e=bK(n);return e instanceof HTMLElement&&e.matches(`input[data-react-grab-input]`)},o=(t,n)=>{n===`move`&&(r=!0);let o=a();if(r&&!o){if(e.isAdjusting()){i=t;return}i=null,t!==e.activeIndex&&e.onHoverIndex(t)}};oR(()=>{if(e.isAdjusting())return;let n=i;if(n===null)return;i=null;let o=t[n],s=a();r&&(s||o?.matches(`:hover`)&&n!==e.activeIndex&&e.onHoverIndex(n))});let{containerRef:s,highlightRef:c,updateHighlight:l,clearHighlight:u}=aK({});oR(()=>{t.length=e.properties.length});let d;return oR(()=>{let r=e.activeIndex,i=t[r];if(!i||r<0){u();return}if(l(i),d!==void 0&&cancelAnimationFrame(d),d=requestAnimationFrame(()=>{d=void 0;let e=t[r];e&&l(e)}),!n)return;let a=n.getBoundingClientRect(),o=i.getBoundingClientRect();(o.top<a.top||o.bottom>a.bottom)&&i.scrollIntoView({block:`nearest`})}),pR(()=>{d!==void 0&&cancelAnimationFrame(d)}),(()=>{var a=sq(),l=a.firstChild;return a.$$pointermove=()=>{r=!0},cz(e=>{n=e,s(e)},a),cz(c,l),$(a,X(KR,{get each(){return e.properties},children:(r,a)=>{let s=()=>a===e.activeIndex;return(()=>{var c=lq();return c.$$click=t=>{t.stopPropagation(),e.onSelect(a)},c.$$mousedown=e=>{let t=n?bK(n):null;t instanceof HTMLElement&&t.matches(`input[data-react-grab-input]`)&&t.blur(),e.preventDefault()},c.addEventListener(`pointerleave`,()=>{i===a&&(i=null)}),c.$$pointermove=()=>{o(a,`move`)},c.addEventListener(`pointerenter`,()=>{o(a,`enter`)}),cz(e=>{t[a]=e,pR(()=>{t[a]===e&&(t[a]=void 0)})},c),$(c,X(qR,{get when(){return s()},get fallback(){return(()=>{var e=uq(),t=e.firstChild;return $(t,()=>r().label),$(e,X(JR,{get children(){return[X(YR,{get when(){return IK(r())},children:e=>(()=>{var t=dq(),n=t.firstChild,r=n.nextSibling;return $(n,()=>qB(e().value)),$(r,()=>e().unit),t})()}),X(YR,{get when(){return LK(r())},children:e=>(()=>{var t=fq();return aR(n=>oz(t,`background-color`,e().value)),t})()}),X(YR,{get when(){return RK(r())},children:e=>(()=>{var t=pq();return $(t,()=>mq(e())),t})()})]}}),null),e})()},get children(){var t=cq();return $(t,X(rq,{get property(){return r()},get activeKey(){return e.activeKey},get onStep(){return e.onStep},get onCommit(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onInteract(){return e.onInteract},get onColorPickerRegister(){return e.onColorPickerRegister},showLabel:!0,get tailwindLabel(){return e.activeTailwindLabel}})),t}})),aR(e=>{var t=r().key,n=s()?`true`:void 0;return t!==e.e&&Q(c,`data-react-grab-edit-property`,e.e=t),n!==e.t&&Q(c,`aria-current`,e.t=n),e},{e:void 0,t:void 0}),c})()}}),null),a})()},$R([`pointermove`,`mousedown`,`click`]),gq=(e,t,n)=>e.kind===`color`&&typeof t==`string`&&typeof n==`string`?t.toLowerCase()===n.toLowerCase():t===n,_q=e=>e===`ArrowLeft`?-1:1,vq=e=>{let[t,n]=J(0),r=null,i=null,a=null,o=()=>{i!==null&&clearTimeout(i),a!==null&&clearInterval(a),i=null,a=null,r=null},s=()=>{o(),n(0)},c=t=>{o(),r=t;let n=_q(t);i=setTimeout(()=>{a=setInterval(()=>{e.step(n,e.isShiftHeld(),e.isAltHeld(),!0)},60)},280)};return fR(()=>{window.addEventListener(`blur`,s),pR(()=>window.removeEventListener(`blur`,s))}),pR(s),{heldDirection:t,pressArrow:(t,r,i,a)=>{if(r)return;let o=_q(t);c(t),n(o),e.step(o,i,a,!1)},releaseKey:e=>{e===r&&s()},cancelRepeat:s}},yq=(e,t,n)=>{if(e.length===0)return null;let r=e.findIndex(e=>e.value===t),i=e[((r===-1?0:r)+n+e.length)%e.length];return!i||i.value===t?null:i},bq=(e,t,n,r,i)=>{if(e.kind===`enum`)return yq(e.options,e.value,t)?.value??null;if(e.kind!==`numeric`)return null;let a=Math.min(e.min,e.value),o=Math.max(e.max,e.value);if(!n&&!r&&e.unit===`px`&&i?.hasTokens){let n=i.stepLength(e.value,t,e.cssProperties[0]);if(n!==null){let t=JB(yB(n,a,o));if(t!==e.value)return t}}let s=n?10:1,c=JB(yB(e.value+t*s,a,o));return c===e.value?null:c},xq=/^-?\d*\.?\d+$/,Sq=e=>xq.test(e),Cq=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,``),wq=e=>{if(e.kind!==`enum`)return[];let t=[];for(let n of e.options){let e=Cq(n.value),r=Cq(n.label);e&&t.push(e),r&&r!==e&&t.push(r)}return t},Tq=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(let e of r.tailwindAliases){let i=Cq(e);i&&t.push({property:r,originalIndex:n,kind:`alias`,term:i})}for(let e of wq(r))t.push({property:r,originalIndex:n,kind:`enum-option`,term:e});let i=Cq(r.label);i&&t.push({property:r,originalIndex:n,kind:`name`,term:i});let a=Cq(r.key);a&&a!==i&&t.push({property:r,originalIndex:n,kind:`name`,term:a});let o=Cq(`${r.label} ${r.key}`);o&&t.push({property:r,originalIndex:n,kind:`label`,term:o})}return t},Eq=(e,t)=>{if(t.kind===`alias`||t.kind===`enum-option`||t.kind===`name`)return e===t.term?yN+t.term.length:t.term.startsWith(e)||e.startsWith(t.term)?bN+Math.min(e.length,t.term.length):null;let n=t.term.indexOf(e);return n===-1?null:n===0?xN-t.term.length*1:SN-n*100-t.term.length*1},Dq=(e,t,n,r)=>{let i=e.get(t.key);i&&i.score>=r||e.set(t.key,{property:t,score:r,originalIndex:n})},Oq=e=>{let t=Tq(e),n=new Map;for(let t=0;t<e.length;t++)n.set(e[t].key,t);let r=(t,r,i)=>{for(let a=0;a<r.length;a++){let o=r[a],s=n.get(o);if(s===void 0)continue;let c=e[s];Dq(t,c,s,i-a)}};return{search:n=>{let i=Cq(n);if(!i||Sq(i))return e;let a=new Map;r(a,yV(n),_N),r(a,bV(n),vN);for(let e of t){let t=Eq(i,e);t!==null&&Dq(a,e.property,e.originalIndex,t)}return Array.from(a.values()).sort((e,t)=>t.score===e.score?e.originalIndex-t.originalIndex:t.score-e.score).map(e=>e.property)}}},kq=(e,t)=>e.kind===t.kind&&!gq(e,t.value,e.original),Aq=e=>{let{initialProperties:t,searchQuery:n}=e,[r,i]=J({}),a=Oq(t),o=Y(()=>{let e=n(),i=r(),o=e?t:t.filter(e=>e.isPrioritized||e.isCanonical&&!e.isDefault||i[e.key]!==void 0);return e?a.search(e):o.slice(0,40)}),s=new Map(t.map(e=>[e.key,e])),c=Y(()=>{let e=r(),t=Object.keys(e);if(t.length===0)return o();let n=new Map;for(let r of t){let t=e[r];if(t.kind!==`numeric`)continue;let i=s.get(r);if(i)for(let e of i.cssProperties)n.set(e,t.value)}return o().map(t=>{let r=e[t.key];if(r!==void 0)return l(t,r);if(t.kind!==`numeric`)return t;let i=n.get(t.cssProperties[0]);return i===void 0?t:t.cssProperties.every(e=>n.get(e)===i)?{...t,value:i}:t})}),l=(e,t)=>e.kind===`numeric`&&t.kind===`numeric`||e.kind===`color`&&t.kind===`color`||e.kind===`enum`&&t.kind===`enum`?{...e,value:t.value}:e;return{filteredProperties:c,applyStyle:(e,t)=>{let n;if(e.kind===`numeric`&&typeof t==`number`)n={kind:`numeric`,value:t};else if(e.kind===`color`&&typeof t==`string`)n={kind:`color`,value:t};else if(e.kind===`enum`&&typeof t==`string`)n={kind:`enum`,value:t};else return;i(t=>{let r=Object.keys(t);if(r[r.length-1]===e.key)return{...t,[e.key]:n};let i={};for(let n of r){if(n===e.key)continue;let r=s.get(n);r!==void 0&&r.cssProperties.every(t=>e.cssProperties.includes(t))||(i[n]=t[n])}return i[e.key]=n,i})},buildPendingEdits:()=>{let e=r(),t=[],n=new Set;for(let r of Object.keys(e)){let i=e[r],a=s.get(r);if(!a||a.kind!==i.kind)continue;let o=kq(a,i),c=!o&&a.cssProperties.some(e=>n.has(e));if(!(!o&&!c)){if(o)for(let e of a.cssProperties)n.add(e);a.kind===`numeric`&&i.kind===`numeric`?t.push({kind:`numeric`,key:a.key,cssProperties:a.cssProperties,value:i.value,unit:a.unit}):a.kind===`color`&&i.kind===`color`?t.push({kind:`color`,key:a.key,cssProperties:a.cssProperties,value:i.value}):a.kind===`enum`&&i.kind===`enum`&&t.push({kind:`enum`,key:a.key,cssProperties:a.cssProperties,value:i.value})}}return t},hasPendingStyles:()=>{let e=r();for(let n of t){let t=e[n.key];if(t&&kq(n,t))return!0}return!1},hasChangedStyleFor:e=>{let t=r()[e],n=s.get(e);return!!(t&&n&&kq(n,t))}}},jq=new Map;for(let e of LB)for(let t of e)jq.set(t.key,t.longhands);Mq=e=>{if(e.includes(`,`))return e.split(`,`);let t=jq.get(e);return t?[...t]:[e]},Nq=/^-?(?:\d+\.?|\d*\.\d*)?$/,Pq=e=>Nq.test(e),Fq=e=>{let t=e.startsWith(`-`);return{isNegative:t,base:t?e.slice(1):e}},Iq=/^([a-z-]+)-(-?\d+(?:\.\d+)?)$/,Lq=/^(.+?)-\[(.+)]$/,Rq=/^(-?\d*\.?\d+)\s*([a-zA-Z%]*)$/,zq=/^(-?\d*\.?\d+)(px|rem)?$/i,Bq=/^(?:length|size):/i,Vq=new Set([`opacity`,`border-width`,`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`,`z-index`,`font-weight`]),Hq=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`numeric`)return n;return null},Uq=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`enum`)return n;return null},Wq=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`color`)return n;return null},Gq=e=>{let t=e.replace(/^(?:color|length|size):/i,``).trim();return/(?:var|url)\(/i.test(t)?t:t.replace(/_/g,` `)},Kq=e=>{let t=e.lastIndexOf(`:`),n=t>=0?e.slice(t+1):e;return(n.startsWith(`!`)?n.slice(1):n).toLowerCase()},qq=(e,t)=>{let n=e.match(zq);if(!n)return null;let r=n[2]?.toLowerCase();if(!r&&!t)return null;let i=Number.parseFloat(n[1]);return Number.isFinite(i)?r===`rem`?i*16:i:null},Jq=(e,t)=>{let n=Mq(t),r=new Map;for(let t of n)for(let n of e)n.kind===`numeric`&&n.cssProperties.includes(t)&&r.set(n.key,n);return Array.from(r.values())},Yq=(e,t)=>JB(yB(t,e.min,e.max)),Xq=e=>{let{initialProperties:t,searchQuery:n,isCompact:r,activeProperty:i,commit:a,setIsCompact:o}=e,s=e=>{for(let n of t)if(n.key===e&&(n.kind===`numeric`||n.kind===`enum`))return!0;return Jq(t,e).length>0},c=e=>{let t=e.trim().replace(/(\d),(\d)/g,`$1.$2`).match(Rq);if(!t)return null;let n=Number.parseFloat(t[1]);return Number.isFinite(n)?{value:n,unit:t[2].toLowerCase()}:null},l=(e,t)=>!e||t.toLowerCase().startsWith(e),u=e=>{if(!r())return!1;let t=i();if(t?.kind!==`numeric`)return!1;let n=c(e);return n?l(n.unit,t.unit):Pq(e)},d=Y(()=>u(n())),f=e=>{if(!r())return!1;let t=i();if(t?.kind!==`numeric`)return!1;let n=c(e);if(!n)return!1;let o=t.unit.toLowerCase();if(n.unit!==``&&n.unit!==o)return l(n.unit,t.unit);let s=Yq(t,n.value);return s!==t.value&&a(t,s),!0},p=(e,n)=>{let r=Hq(t,e);if(r)return r.unit===`px`?(o(!0),a(r,Yq(r,n),{shouldCompact:!0}),!0):!1;let i=Jq(t,e);return i.length===0?!1:(o(!0),lR(()=>{for(let e of i)a(e,Yq(e,n),{shouldCompact:!0})}),!0)},m=(e,n)=>{let r=pV(e);if(!r)return!1;let i=Wq(t,r);if(!i)return!1;let s=n===null?hV(e):vB(n);return s?(o(!0),a(i,s,{shouldCompact:!0}),!0):!1},h=e=>{let t=e.trim(),n=t.match(Lq);if(!n)return!1;let r=n[2],i=Gq(r);if(m(t,i))return!0;let a=qq(i,Bq.test(r.trim()));if(a===null)return!1;let{isNegative:o,base:s}=Fq(n[1]),c=CV(Kq(s));return c?p(c,o?-a:a):!1},g=e=>{if(h(e))return;let n=uV(e),{isNegative:r,base:i}=Fq(n),c=i.replace(/-\d*$/,``).replace(/-$/,``),l=c?CV(c):null;if(l&&s(l)&&o(!0),!r){if(m(n,null))return;let e=wV(n);if(e){let n=Uq(t,e.property);if(!n)return;let r=n.options.find(t=>t.value===e.value);r&&(o(!0),a(n,r.value,{shouldCompact:!0}));return}}let u=i.match(Iq);if(!u)return;let d=CV(u[1]);if(!d)return;let f=Number.parseFloat(u[2]);if(!Number.isFinite(f))return;let p=r?-f:f,g=Vq.has(d)?p:p*4,_=Hq(t,d);if(_){a(_,Yq(_,g),{shouldCompact:!0});return}if(!r){let e=Uq(t,d);if(e){let t=String(f),n=e.options.find(e=>e.value===t);if(n){a(e,n.value,{shouldCompact:!0});return}}}let v=Jq(t,d);v.length!==0&&lR(()=>{for(let e of v)a(e,Yq(e,g),{shouldCompact:!0})})},_=e=>{if(wV(e))return!0;let{base:n}=Fq(e),r=n.match(Iq);if(!r)return!1;let i=CV(r[1]);return i?s(i)?!0:Uq(t,i)!==null:!1};return{isInlineNumericEdit:d,isInlineNumericDraft:u,tryApplyNumericValue:f,applyTailwindClass:e=>{let t=e.trim().replace(/^class\s*=\s*["']/,``).replace(/["']\s*$/,``).replace(/\s+\[/g,`-[`),n=uV(t),r=t.split(/\s+/).filter(Boolean);if(r.length>1&&!_(n)){for(let e of r)g(e);return}g(t)}}},Zq=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),Qq=Z(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),$q=Z(`<div role=alertdialog aria-modal=true aria-labelledby=rg-discard-prompt-title class="contain-layout shrink-0 flex items-center justify-between gap-2 pt-1.5 pb-1 px-2 w-full self-stretch"><span id=rg-discard-prompt-title class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium">Discard edits?</span><div class="flex items-center gap-[5px]">`),eJ=Z(`<div><textarea data-react-grab-ignore-events data-react-grab-input aria-label="Search properties"aria-keyshortcuts="Enter Escape ArrowUp ArrowDown ArrowLeft ArrowRight Tab"autocapitalize=none autocorrect=off autocomplete=off class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-medium bg-transparent border-none resize-none w-full p-0 m-0 outline-none"rows=1 style=caret-color:var(--rg-text-primary);field-sizing:content;min-height:16px;max-height:16px;scrollbar-width:none>`),tJ=Z(`<div>`),nJ=Z(`<div role=dialog aria-modal=true aria-label="Style element"data-react-grab-ignore-events data-react-grab-edit-panel>`),rJ=Z(`<div class="flex items-center justify-center w-full px-3 py-1.5 min-h-[28px]">`),iJ=e=>X(qR,{get when(){return e.state},children:t=>X(qR,{keyed:!0,get when(){return t().element},children:n=>X(aJ,{get state(){return t()},position:()=>e.position,get onDismiss(){return e.onDismiss},get onSubmit(){return e.onSubmit},get onPendingEditsChange(){return e.onPendingEditsChange},get onInteractingChange(){return e.onInteractingChange}})})}),aJ=e=>{let t=e.state.properties,n,r=e.state.preview,[i,a]=J(e.state.initialSearchQuery??``),[o,s]=J(null),[c,l]=J(null),u=Aq({initialProperties:t,searchQuery:()=>o()??i()}),d=()=>{let e=u.filteredProperties().findIndex(e=>e.kind===`numeric`);return e>0?e:0},[f,p]=J(d()),m=Y(()=>u.hasPendingStyles()),h=Y(()=>m()||!!e.state.hasSessionEdits),[g,_]=J(!1),v,y,b,x=!1,[S,C]=J(!1),w=Y(()=>S()||m()),[T,ee]=J(!1),E=MV(),D=Y(()=>sW({tagName:e.state.tagName,componentName:e.state.componentName})),O=Y(()=>{let e=u.filteredProperties();return e.length===0?null:e[Math.min(Math.max(0,f()),e.length-1)]}),te,k=_K(()=>te,e.position),A=e=>{l(e),clearTimeout(v),v=setTimeout(()=>{l(t=>t===e?null:t)},100)},ne=Y(()=>w()&&!T());oR(()=>{let t=ne();e.onInteractingChange?.(t)});let re=()=>{C(!0),clearTimeout(y),y=setTimeout(()=>{C(!1)},150)},ie=()=>{queueMicrotask(()=>{n&&bK(n)!==n&&nW(n,{preventScroll:!0})})},ae=()=>{o()===null&&s(i())},oe=()=>{x=!1,clearTimeout(b)},se=()=>{x=!1,clearTimeout(b),b=setTimeout(()=>{x=!0},500)},ce=e=>{let t=e.trim(),n=t.replace(/^-/,``).replace(`.`,``);/[a-z%]+$/i.test(t)||n.length>1?se():oe()},le=e=>{if(!x)return e;let t=i();if(!t||!e.startsWith(t))return oe(),e;let n=e.slice(t.length);return/^[-.\d]/.test(n)?(oe(),n):e},ue=e=>{if(!x||e.metaKey||e.ctrlKey||e.altKey||!/^[-.\d]$/.test(e.key))return!1;e.preventDefault(),e.stopImmediatePropagation(),oe();let t=e.key;return n&&(n.value=t),xe.tryApplyNumericValue(t)?(ae(),a(t),ce(t),ie(),!0):(a(t),ie(),!0)},de=()=>{oe(),s(null),_(!1)},fe=(t,n,i={})=>{u.applyStyle(t,n),r.apply(t.cssProperties,YB(t,n)),e.onPendingEditsChange?.(u.buildPendingEdits()),re(),i.isFromKeyRepeat||we.hide(),i.flashDirection&&A(i.flashDirection===1?`right`:`left`),i.shouldFocus&&ie(),i.shouldCompact&&_(!0),i.source===`keyboard`&&E.arm()},pe=OV(e=>e.shiftKey),me=OV(e=>e.altKey),he=(t,n,r,i,a)=>{let o=O();if(!o)return null;let s=bq(o,t,n,r,e.state.designTokens);return s===null?(A(t===1?`right`:`left`),null):(fe(o,s,{flashDirection:t,shouldFocus:!0,isFromKeyRepeat:i,source:a}),o)},ge=(e,t,n,r)=>{he(e,t,n,r,`keyboard`)&&_(!0)},_e=e=>{he(e,!1,!1,!1,`pointer`)},ve=vq({step:ge,isShiftHeld:pe,isAltHeld:me}),ye=(e,t)=>{let n=O();if(n){if(n.kind===`numeric`&&typeof e==`number`){let r=JB(yB(e,n.min,n.max));r!==n.value&&fe(n,r,{source:t});return}typeof e==`string`&&(gq(n,e,n.value)||fe(n,e,{source:t}))}},be=Y(()=>{if(!pe())return null;let e=O();return!e||e.kind!==`numeric`?null:yK(e.key,e.value)}),xe=Xq({initialProperties:t,searchQuery:i,isCompact:g,activeProperty:O,commit:(e,t,n)=>{fe(e,t,{...n,source:`keyboard`})},setIsCompact:_}),Se=Y(()=>g()&&i()!==``&&xe.isInlineNumericEdit()),Ce=()=>{we.hide(),E.clear(),e.onSubmit(u.buildPendingEdits())},we=oq(),Te,Ee=()=>{Te&&(Te.classList.remove(`animate-shake`),Te.offsetWidth,Te.classList.add(`animate-shake`))},De=t=>{we.hide(),t===`discard`&&r.restore(),e.onDismiss()},Oe=e=>{if(ve.cancelRepeat(),e===`pointer`&&E.clear(),we.isPending()){De(`discard`);return}if(!h()){De(r.hasAppliedStyles()?`discard`:`preserve`);return}let t=g();de(),!(e===`keyboard`&&t)&&(we.show(),Ee())},ke=e=>{let t=u.filteredProperties();t.length!==0&&(p(n=>(n+e+t.length)%t.length),de())},Ae=()=>{E.clear(),we.hide()},je=[],Me=e=>(je.push(e),()=>{je=je.filter(t=>t!==e)}),Ne=()=>je[je.length-1]??null,Pe=(e,t)=>{if(O()?.kind===`color`){t.repeat||Ne()?.();return}ve.pressArrow(e,t.repeat,t.shiftKey,t.altKey)},Fe={ArrowUp:()=>ke(-1),ArrowDown:()=>ke(1),ArrowLeft:e=>Pe(`ArrowLeft`,e),ArrowRight:e=>Pe(`ArrowRight`,e),Tab:e=>ke(e.shiftKey?-1:1),Enter:()=>{if(we.isPending())return;let e=O(),t=Ne();if(e?.kind===`color`&&!u.hasChangedStyleFor(e.key)&&t&&!h()){t();return}Ce()},Escape:()=>Oe(`keyboard`)},Ie=e=>{if(e.isComposing||e.keyCode===229)return;if(we.isPending()){let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.closest(`[data-react-grab-discard-button]`)!==null&&(e.key===`Tab`||e.key===`Enter`))return;if(e.key===`Tab`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault(),e.stopImmediatePropagation();return}}let t=Fe[e.key];t&&(e.preventDefault(),e.stopImmediatePropagation(),t(e))};fR(()=>{queueMicrotask(()=>{if(nW(n,{preventScroll:!0}),n){let e=n.value.length;n.setSelectionRange(e,e)}}),k.measure();let e=i();e&&xe.applyTailwindClass(e);let t=dK({isOpen:()=>!0,onDismiss:Oe,shouldIgnoreKeyboardEvent:e=>{let t=e.composedPath()[0];return we.isPending()&&t instanceof HTMLElement&&t.closest(`[data-react-grab-discard-button]`)!==null},shouldIgnoreRightClick:!0,shouldIgnoreInputEvents:!0}),r=EM(e=>{CB(e,`data-react-grab-input`)||ue(e)||Ie(e)}),a=EM(e=>{ve.releaseKey(e.key)}),o=EM(e=>{e.pointerType===`mouse`&&(we.isPending()||E.consume()&&h()&&Oe(`pointer`))});window.addEventListener(`keydown`,r,{capture:!0}),window.addEventListener(`keyup`,a,{capture:!0}),window.addEventListener(`pointermove`,o,{capture:!0}),pR(()=>{t(),window.removeEventListener(`keydown`,r,{capture:!0}),window.removeEventListener(`keyup`,a,{capture:!0}),window.removeEventListener(`pointermove`,o,{capture:!0}),clearTimeout(v),clearTimeout(y),clearTimeout(b),we.cleanup(),k.clearAnimationHandles(),C(!1)})});let j=e=>{p(e),ie()};return X(qR,{get when(){return k.shouldMount()},get children(){var e=nJ();rz(e,`contextmenu`,uK,!0),rz(e,`click`,uK,!0),rz(e,`mousedown`,uK,!0),rz(e,`pointerdown`,uK,!0);var t=te;return typeof t==`function`?cz(t,e):te=e,oz(e,`z-index`,`${LM}`),oz(e,`--rg-edit-list-max-h`,`280px`),$(e,X(TW,{ref:e=>Te=e,class:`flex flex-col justify-center items-start overflow-hidden w-fit h-fit`,get style(){return{"min-width":g()?void 0:`200px`,"max-width":`320px`,transform:`translateX(${ve.heldDirection()*2}px)`,transition:`transform 280ms ${gN}`}},get children(){return[X(qR,{get when(){return we.isPending()},get fallback(){return X(qR,{get when(){return!g()},get children(){var e=tJ();return e.addEventListener(`mouseleave`,()=>ee(!1)),e.addEventListener(`mouseenter`,()=>ee(!0)),$(e,X(yW,{get tagName(){return D().tagName},get componentName(){return D().componentName},isClickable:!1,onClick:()=>{},shrink:!0}),null),$(e,X(qR,{get when(){return h()},get children(){return X(aq,{onCopy:Ce})}}),null),aR(()=>nz(e,oW(`contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 h-fit px-2`,h()?`w-full self-stretch justify-between`:`w-fit`))),e}})},get children(){var e=$q(),t=e.firstChild.nextSibling;return $(t,X(NW,{"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`cancel`,onClick:e=>{e.preventDefault(),e.stopPropagation(),Ae()},get children(){return Zq()}}),null),$(t,X(NW,{variant:`destructive`,"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`confirm`,onClick:e=>{e.preventDefault(),e.stopPropagation(),De(`discard`)},get children(){return Qq()}}),null),e}}),(()=>{var e=eJ(),t=e.firstChild;return t.$$keydown=Ie,t.$$input=e=>{let t=le(e.currentTarget.value);if(t!==e.currentTarget.value&&(e.currentTarget.value=t),xe.tryApplyNumericValue(t)){ae(),a(t),ce(t),ie();return}if(oe(),xe.isInlineNumericDraft(t)){ae(),a(t),ie();return}a(t),s(null),p(t.trim()===``?d():0),de(),xe.applyTailwindClass(t)},cz(e=>{n=e},t),Q(t,`spellcheck`,!1),aR(n=>{var r=Se()?``:`[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start px-2 py-1.5 w-full self-stretch [border-top-width:0.5px] border-t-solid border-t-[var(--rg-border-subtle)] antialiased`,i=Se()?TK:void 0,a=Se()?-1:0,o=g()?O()?.label??`Search property`:`Search property`;return r!==n.e&&nz(e,n.e=r),n.t=az(e,i,n.t),a!==n.a&&Q(t,`tabindex`,n.a=a),o!==n.o&&Q(t,`placeholder`,n.o=o),n},{e:void 0,t:void 0,a:void 0,o:void 0}),aR(()=>t.value=i()),e})(),X(qR,{get when(){return u.filteredProperties().length>0},get children(){var e=tJ();return $(e,X(hq,{get properties(){return u.filteredProperties()},get activeIndex(){return f()},get activeKey(){return c()},onHoverIndex:p,onSelect:j,onStep:_e,onCommit:ye,onColorPickerRegister:Me,onEditComplete:ie,onInvalidCommit:Ee,onInteract:re,isAdjusting:S,get activeTailwindLabel(){return be()}})),aR(t=>{var n=g()?``:`[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start w-full self-stretch antialiased`,r=g()?TK:void 0;return n!==t.e&&nz(e,t.e=n),t.t=az(e,r,t.t),t},{e:void 0,t:void 0}),e}}),X(qR,{get when(){return Kz(()=>!!g())()&&O()},children:e=>(()=>{var t=rJ();return t.$$mousedown=e=>e.preventDefault(),$(t,X(rq,{get property(){return e()},get activeKey(){return c()},onStep:_e,onCommit:ye,onEditComplete:ie,onInvalidCommit:Ee,onInteract:re,onColorPickerRegister:Me,showLabel:!1,get tailwindLabel(){return be()},emphasized:!0})),t})()})]}})),aR(t=>{var n=g()?`true`:`false`,r=oW(`fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none`,k.isAnimatedIn()?`transition-[opacity,transform] duration-220 ease-spring`:`transition-[opacity,transform] duration-120 ease-drawer`),i=`${k.displayPosition().top}px`,a=`${k.displayPosition().left}px`,o=k.isAnimatedIn()?`auto`:`none`,s=dN[k.lastAnchorEdge()],c=k.isAnimatedIn()?`1`:`0`,l=k.isAnimatedIn()?`scale(1)`:`scale(0.92)`;return n!==t.e&&Q(e,`data-rg-compact`,t.e=n),r!==t.t&&nz(e,t.t=r),i!==t.a&&oz(e,`top`,t.a=i),a!==t.o&&oz(e,`left`,t.o=a),o!==t.i&&oz(e,`pointer-events`,t.i=o),s!==t.n&&oz(e,`transform-origin`,t.n=s),c!==t.s&&oz(e,`opacity`,t.s=c),l!==t.h&&oz(e,`transform`,t.h=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e}})},$R([`pointerdown`,`mousedown`,`click`,`contextmenu`,`input`,`keydown`]),oJ=Z(`<div data-react-grab-ignore-events>`),sJ=e=>{let t,n=()=>e.interactive!==!1,r=_K(()=>t,()=>e.position);return fR(()=>{r.measure();let t=e.onDismiss?dK({isOpen:()=>!!e.position,onDismiss:e.onDismiss}):void 0;pR(()=>{r.clearAnimationHandles(),t?.()})}),X(qR,{get when(){return r.shouldMount()},get children(){var i=oJ(),a=t;return typeof a==`function`?cz(a,i):t=i,sz(i,UR(()=>({[e.dataAttribute]:``}),{get class(){return oW(`fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none will-change-[opacity,transform]`,r.isAnimatedIn()?`transition-[opacity,transform] duration-220 ease-spring`:`transition-[opacity,transform] duration-120 ease-drawer`)},get style(){return{top:`${r.displayPosition().top}px`,left:`${r.displayPosition().left}px`,"z-index":`${LM}`,"pointer-events":n()&&r.isAnimatedIn()?`auto`:`none`,"transform-origin":dN[r.lastAnchorEdge()],opacity:r.isAnimatedIn()?`1`:`0`,transform:r.isAnimatedIn()?`scale(1)`:`scale(0.92)`}},onPointerDown:uK,onMouseDown:uK,onClick:uK,onContextMenu:uK}),!1,!0),$(i,()=>e.children),i}})},cJ=e=>{let t=oK({clearActiveOnPointerLeave:!0,highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:sN}});return X(sJ,{get position(){return e.position},dataAttribute:`data-react-grab-toolbar-menu`,get onDismiss(){return e.onDismiss},get children(){return X(sK.Panel,{class:`overflow-hidden`,style:{"min-width":`100px`},get children(){return X(sK.Provider,{store:t,get children(){return X(sK.List,{label:`Default action`,get children(){return X(GR,{get each(){return e.actions},children:t=>{let n=()=>t.id===e.defaultActionId;return X(sK.Item,{get value(){return t.id},role:`menuitemradio`,get checked(){return n()},onSelect:()=>{e.onSetDefaultAction(t.id),e.onDismiss()},get children(){return[X(sK.Label,{get class(){return n()?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)]`},get children(){return t.label}}),X(qR,{get when(){return t.shortcut},children:e=>X(sK.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})}})}})}})}})}})},lJ=Z(`<span aria-hidden=true class="shrink-0 font-mono text-[11px] leading-4 text-[var(--rg-text-secondary)] opacity-60 mr-1">`),uJ=Z(`<span class=text-[var(--rg-text-secondary)]>.`),dJ=Z(`<span class="flex items-center min-w-0 w-full"><span class="text-[13px] leading-4 h-fit font-medium overflow-hidden text-ellipsis whitespace-nowrap min-w-0 transition-colors">`),fJ=e=>{let t=()=>e.state?.activeIndex??0,n=oK({value:()=>String(t()),highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:sN}});return X(sJ,{get position(){return e.position},dataAttribute:`data-react-grab-hierarchy-menu`,interactive:!1,get children(){return X(sK.Panel,{class:`overflow-hidden`,style:{"min-width":`160px`},get children(){return X(sK.Provider,{store:n,get children(){return X(sK.List,{label:`Navigate element hierarchy`,get children(){return X(GR,{get each(){return e.state?.items??[]},children:(e,n)=>X(sK.Item,{get value(){return String(n())},role:`menuitemradio`,get checked(){return n()===t()},get children(){var r=dJ(),i=r.firstChild;return $(r,X(qR,{get when(){return e.depth>0},get children(){var t=lJ();return $(t,()=>e.isLast?`└─`:`├─`),aR(n=>oz(t,`padding-left`,`${(e.depth-1)*12}px`)),t}}),i),$(i,X(qR,{get when(){return e.componentName},get children(){return[Kz(()=>e.componentName),uJ()]}}),null),$(i,()=>e.tagName,null),aR(e=>{var r=n()===t(),a=n()!==t();return r!==e.e&&i.classList.toggle(`text-[var(--rg-text-primary)]`,e.e=r),a!==e.t&&i.classList.toggle(`text-[var(--rg-text-secondary)]`,e.t=a),e},{e:void 0,t:void 0}),r}})})}})}})}})}})},pJ=e=>[X(QU,{get selectionVisible(){return e.selectionVisible},get selectionBounds(){return e.selectionBounds},get selectionBoundsMultiple(){return e.selectionBoundsMultiple},get selectionShouldSnap(){return e.selectionShouldSnap},get dragVisible(){return e.dragVisible},get dragBounds(){return e.dragBounds},get grabbedBoxes(){return e.grabbedBoxes},get labelInstances(){return e.labelInstances}}),X(eW,{get visible(){return e.isFrozen??!1}}),X(qR,{get when(){return Kz(()=>!!e.selectionLabelVisible)()&&(e.frozenLabelEntries?.length??0)>0},get children(){return X(KR,{get each(){return e.frozenLabelEntries??[]},children:(t,n)=>X(uG,{get tagName(){return t().tagName},get componentName(){return t().componentName},get selectionBounds(){return t().bounds},get mouseX(){return t().mouseX},visible:!0,shouldToggleExpandOnClick:n===0,get onToggleExpand(){return n===0?e.onToggleExpand:void 0}})})}}),X(qR,{get when(){return Kz(()=>!!e.selectionLabelVisible)()&&e.pendingShiftPreviewEntry},children:e=>X(uG,{get tagName(){return e().tagName},get componentName(){return e().componentName},get selectionBounds(){return e().bounds},get mouseX(){return e().mouseX},visible:!0})}),X(qR,{get when(){return Kz(()=>!!(e.selectionLabelVisible&&e.selectionBounds))()&&(e.frozenLabelEntries?.length??0)===0},get children(){return X(uG,{get tagName(){return e.selectionTagName},get componentName(){return e.selectionComponentName},get elementsCount(){return e.selectionElementsCount},get selectionBounds(){return e.selectionBounds},get mouseX(){return e.mouseX},get visible(){return e.selectionLabelVisible},get isPromptMode(){return e.isPromptMode},get inputValue(){return e.inputValue},get status(){return e.selectionLabelStatus},get filePath(){return e.selectionFilePath},get onInputChange(){return e.onInputChange},get onSubmit(){return e.onInputSubmit},get onToggleExpand(){return e.onToggleExpand},get selectionLabelShakeCount(){return e.selectionLabelShakeCount},get onConfirmDismiss(){return e.onConfirmDismiss},get discardPrompt(){return e.discardPrompt},onOpen:()=>{e.selectionFilePath&&CI(e.selectionFilePath,e.selectionLineNumber)},get isContextMenuOpen(){return e.contextMenuPosition!==null}})}}),X(KR,{get each(){return e.labelInstances??[]},children:t=>X(uG,{get tagName(){return t().tagName},get componentName(){return t().componentName},get elementsCount(){return t().elementsCount},get selectionBounds(){return t().bounds},get mouseX(){return t().mouseX},visible:!0,get status(){return t().status},get statusText(){return t().statusText},get isPromptMode(){return t().isPromptMode},get inputValue(){return t().inputValue},get error(){return t().errorMessage},get hideArrow(){return t().hideArrow},get onShowContextMenu(){let n=t();if(!(!(n.status===`copied`||n.status===`fading`)||!Jz(n.element)))return()=>e.onShowContextMenuInstance?.(n.id)},onHoverChange:n=>e.onLabelInstanceHoverChange?.(t().id,n)})}),X(qR,{get when(){return e.toolbarVisible!==!1},get children(){return X(RG,{get isActive(){return e.isActive},get isContextMenuOpen(){return e.contextMenuPosition!==null},get onToggle(){return e.onToggleActive},get onActivateAction(){return e.onActivateAction},get activeActionId(){return e.activeActionId},get enabled(){return e.enabled},get shakeCount(){return e.shakeCount},get onStateChange(){return e.onToolbarStateChange},get onSubscribeToStateChanges(){return e.onSubscribeToToolbarStateChanges},get onSelectHoverChange(){return e.onToolbarSelectHoverChange},get onContainerRef(){return e.onToolbarRef},get onToggleToolbarMenu(){return e.onToggleToolbarMenu}})}}),X(mK,{get position(){return e.contextMenuPosition??null},get selectionBounds(){return e.contextMenuBounds??null},get tagName(){return e.contextMenuTagName},get componentName(){return e.contextMenuComponentName},get hasFilePath(){return e.contextMenuHasFilePath??!1},get actions(){return e.actions},get actionContext(){return e.actionContext},get onDismiss(){return e.onContextMenuDismiss??(()=>{})},get onHide(){return e.onContextMenuHide??(()=>{})}}),X(cJ,{get position(){return e.toolbarMenuPosition??null},get actions(){return e.toolbarMenuActions??[]},get defaultActionId(){return e.defaultActionId??`copy`},get onSetDefaultAction(){return e.onSetDefaultAction??(()=>{})},get onDismiss(){return e.onToolbarMenuDismiss??(()=>{})}}),X(fJ,{get position(){return e.hierarchyMenuPosition??null},get state(){return e.hierarchyState}}),X(iJ,{get state(){return e.editPanelState??null},get position(){return e.editPanelPosition??null},get onDismiss(){return e.onEditPanelDismiss??(()=>{})},get onSubmit(){return e.onEditPanelSubmit??(()=>{})},get onPendingEditsChange(){return e.onEditPanelPendingEditsChange},get onInteractingChange(){return e.onEditPanelInteractingChange}})]}));function hJ(e){let t=e[xz];if(!t&&(Object.defineProperty(e,xz,{value:t=new Proxy(e,PJ)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let i=0,a=n.length;i<a;i++){let a=n[i];r[a].get&&Object.defineProperty(e,a,{enumerable:r[a].enumerable,get:r[a].get.bind(t)})}}return t}function gJ(e){let t;return typeof e==`object`&&!!e&&(e[xz]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function _J(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[AJ])return n;if(!gJ(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=_J(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=_J(i,t))!==i&&(e[a]=r))}return e}function vJ(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function yJ(e,t,n){if(e[t])return e[t];let[r,i]=J(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function bJ(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===xz||t===jJ?n:(delete n.value,delete n.writable,n.get=()=>e[xz][t],n)}function xJ(e){mR()&&yJ(vJ(e,jJ),NJ)()}function SJ(e){return xJ(e),Reflect.ownKeys(e)}function CJ(e,t,n,r=!1){if(!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[MJ]&&e[MJ][t]&&i!==void 0&&e[MJ][t].$()):(e[t]=n,e[MJ]&&e[MJ][t]&&i===void 0&&e[MJ][t].$());let o=vJ(e,jJ),s;if((s=yJ(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=yJ(o,`length`,a))&&s.$(e.length)}(s=o[NJ])&&s.$()}function wJ(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];CJ(e,i,t[i])}}function TJ(e,t){if(typeof t==`function`&&(t=t(e)),t=_J(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&&CJ(e,n,r)}CJ(e,`length`,r)}else wJ(e,t)}function EJ(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(Array.isArray(r)){for(let i=0;i<r.length;i++)EJ(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&EJ(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)EJ(e,[r].concat(t),n);return}else if(t.length>1){EJ(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=_J(a),r===void 0||gJ(i)&&gJ(a)&&!Array.isArray(a)?wJ(i,a):CJ(e,r,a))}function DJ(...[e,t]){let n=_J(e||{}),r=Array.isArray(n),i=hJ(n);function a(...e){lR(()=>{r&&e.length===1?TJ(n,e[0]):EJ(n,e)})}return[i,a]}function OJ(e){return t=>{if(gJ(t)){let n;(n=FJ.get(t))||FJ.set(t,n=new Proxy(t,IJ)),e(n)}return t}}var kJ,AJ,jJ,MJ,NJ,PJ,FJ,IJ,LJ,RJ,zJ,BJ,VJ,HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,zY,BY,VY,HY,UY,WY,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX,rX,iX,aX,oX,sX,cX,lX,uX,dX,fX,pX,mX,hX,gX,_X,vX,yX,bX,xX,SX,CX,wX,TX,EX,DX,OX,kX,AX,jX,MX,NX,PX,FX,IX,LX,RX,zX,BX,VX,HX,UX,WX,GX,KX,qX,JX,YX,XX,ZX,QX,$X,eZ,tZ,nZ,rZ,iZ,aZ,oZ,sZ,cZ,lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ=t((()=>{NV(),eR(),GU(),kJ=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
209
|
+
`;let e=[];for(let t of document.getAnimations())QI(t)||e.push(t);ZI(e),VI=!1}else{for(let e of BI)try{e.finish()}catch{try{e.play()}catch{}}BI=[]}RI.remove(),RI=null,YI(zI),zI=[],MI()}},aL=[`mouseenter`,`mouseleave`,`mouseover`,`mouseout`,`pointerenter`,`pointerleave`,`pointerover`,`pointerout`],oL=[`focus`,`blur`,`focusin`,`focusout`],sL=[`background-color`,`color`,`border-color`,`box-shadow`,`transform`,`opacity`,`outline`,`filter`,`scale`,`visibility`],cL=[`background-color`,`color`,`border-color`,`box-shadow`,`outline`,`outline-offset`,`outline-width`,`outline-color`,`outline-style`,`filter`,`opacity`,`ring-color`,`ring-width`],lL=new Map,uL=new Map,dL=e=>{e.stopImmediatePropagation()},fL=e=>{e.preventDefault(),e.stopImmediatePropagation()},pL=(e,t)=>{let n=new Map;for(let r of t){let t=e.style.getPropertyValue(r);t&&n.set(r,t)}return n},mL=(e,t,n)=>{if(n?.has(e))return null;let r=getComputedStyle(e),i=e.style.cssText,a=pL(e,t);for(let e of t){let t=r.getPropertyValue(e);t&&(i+=`${e}: ${t} !important; `)}return{element:e,frozenStyles:i,originalPropertyValues:a}},hL=(e,t)=>{let n=[],r=document.elementFromPoint(e,t);for(;r&&r!==document.documentElement;)r instanceof HTMLElement&&n.push(r),r=r.parentElement;return n},gL=()=>{let e=[],t=document.activeElement;for(;t&&t!==document.body;)t instanceof HTMLElement&&e.push(t),t=t.shadowRoot?.activeElement??null;return e},_L=(e,t)=>{for(let{element:n,frozenStyles:r,originalPropertyValues:i}of e)t.set(n,i),n.style.cssText=r},vL=(e,t)=>{for(let[n,r]of e)for(let e of t){let t=r.get(e);t?n.style.setProperty(e,t):n.style.removeProperty(e)}e.clear()},yL=(e,t)=>{if(sI())return null;let n=[],r=e!==void 0&&t!==void 0&&e>=0&&t>=0&&e<window.innerWidth&&t<window.innerHeight?hL(e,t):Array.from(document.querySelectorAll(`:hover`)).filter(e=>e instanceof HTMLElement);for(let e of r){let t=mL(e,sL);t&&n.push(t)}let i=[];for(let e of gL()){let t=mL(e,cL,uL);t&&i.push(t)}return{hoverStates:n,focusStates:i}},bL=e=>{if(e){for(let e of aL)document.addEventListener(e,dL,!0);for(let e of oL)document.addEventListener(e,fL,!0);_L(e.hoverStates,lL),_L(e.focusStates,uL),cI()}},xL=()=>{xI();for(let e of aL)document.removeEventListener(e,dL,!0);for(let e of oL)document.removeEventListener(e,fL,!0);vL(lL,sL),vL(uL,cL),lI()},SL=(e,t)=>{let n=yL(e,t),r=nL();bL(n),rL(r)},CL=()=>{xL(),iL()},wL=!1,TL=(e,t,n)=>{let r=e.get(t);if(r)return r;let i=n();return e.set(t,i),i},EL=new WeakMap,DL=new WeakMap,OL=new WeakMap,kL=new Set,AL=[],jL=[],ML=new WeakMap,NL=new WeakMap,PL=new WeakSet,FL=eP,IL=e=>{let t=e;for(;t.return;)t=t.return;return t.stateNode??null},LL=()=>{if(FL.size>0)return FL;let e=new Set,t=n=>{let r=$N(n);if(r){let t=IL(r);t&&e.add(t);return}for(let r of Array.from(n.children))if(t(r),e.size>0)return};return t(document.body),e},RL=(e,t)=>{if(!e)return t;if(!t)return e;if(!e.next||!t.next)return t;let n=e.next,r=t.next,i=e===n,a=t===r;return i&&a?(e.next=t,t.next=e):i?(e.next=r,t.next=e):a?(t.next=n,e.next=t):(e.next=r,t.next=n),t},zL=e=>{if(!e||ML.has(e))return;let t={originalPendingDescriptor:Object.getOwnPropertyDescriptor(e,`pending`),pendingValueAtPause:e.pending,bufferedPending:null};typeof e.getSnapshot==`function`&&(t.originalGetSnapshot=e.getSnapshot,t.snapshotValueAtPause=e.getSnapshot(),e.getSnapshot=()=>wL?t.snapshotValueAtPause:t.originalGetSnapshot());let n=t.pendingValueAtPause;Object.defineProperty(e,"pending",{configurable:!0,enumerable:!0,get:()=>wL?null:n,set:e=>{if(wL){e!==null&&(t.bufferedPending=RL(t.bufferedPending??null,e));return}n=e}}),ML.set(e,t)},BL=e=>{if(!e)return[];let t=[],n=e.next;if(!n)return[];let r=n;do r&&=(t.push(r.action),r.next);while(r&&r!==n);return t},VL=e=>{let t=ML.get(e);if(!t)return;t.originalGetSnapshot&&(e.getSnapshot=t.originalGetSnapshot),t.originalPendingDescriptor?Object.defineProperty(e,"pending",t.originalPendingDescriptor):delete e.pending,e.pending=null;let n=e.dispatch;if(typeof n==`function`){let e=BL(t.pendingValueAtPause??null),r=BL(t.bufferedPending??null);for(let t of[...e,...r])jL.push(()=>n(t))}ML.delete(e)},HL=e=>{if(NL.has(e))return;let t={originalDescriptor:Object.getOwnPropertyDescriptor(e,`memoizedValue`),frozenValue:e.memoizedValue};Object.defineProperty(e,"memoizedValue",{configurable:!0,enumerable:!0,get(){return wL?t.frozenValue:t.originalDescriptor?.get?t.originalDescriptor.get.call(this):this._memoizedValue},set(e){if(wL){t.pendingValue=e,t.didReceivePendingValue=!0;return}t.originalDescriptor?.set?t.originalDescriptor.set.call(this,e):this._memoizedValue=e}}),t.originalDescriptor?.get||(e._memoizedValue=t.frozenValue),NL.set(e,t)},UL=e=>{let t=NL.get(e);t&&(t.originalDescriptor?Object.defineProperty(e,"memoizedValue",t.originalDescriptor):delete e.memoizedValue,t.didReceivePendingValue&&(e.memoizedValue=t.pendingValue),NL.delete(e))},WL=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&zL(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)HL(n),n=n.next},GL=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&VL(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)UL(n),n=n.next},KL=e=>{let t=e;for(;t;){if(qN(t)&&WL(t),t.child){t=t.child;continue}for(;t!==e&&!t.sibling;)if(t=t.return,!t)return;if(t===e)return;t=t.sibling}},qL=e=>{let t=e;for(;t;){if(qN(t)&&GL(t),t.child){t=t.child;continue}for(;t!==e&&!t.sibling;)if(t=t.return,!t)return;if(t===e)return;t=t.sibling}},JL=e=>{if(EL.has(e))return;let t=e,n={useState:t.useState,useReducer:t.useReducer,useTransition:t.useTransition,useSyncExternalStore:t.useSyncExternalStore};EL.set(e,n),t.useState=(...t)=>{let r=n.useState.apply(e,t);if(!wL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,TL(DL,a,()=>(...e)=>{wL?jL.push(()=>a(...e)):a(...e)})]},t.useReducer=(...t)=>{let r=n.useReducer.apply(e,t);if(!wL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,TL(DL,a,()=>(...e)=>{wL?jL.push(()=>a(...e)):a(...e)})]},t.useTransition=(...t)=>{let r=n.useTransition.apply(e,t);if(!wL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,TL(OL,a,()=>e=>{wL?AL.push(()=>a(e)):a(e)})]},t.useSyncExternalStore=((e,t,r)=>wL?n.useSyncExternalStore(t=>e(()=>{wL?kL.add(t):t()}),t,r):n.useSyncExternalStore(e,t,r))},YL=e=>{let t=e.currentDispatcherRef;if(!t||typeof t!=`object`)return;let n=`H`in t?`H`:`current`,r=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:()=>(r&&typeof r==`object`&&JL(r),r),set:e=>{r=e}})},XL=e=>{queueMicrotask(()=>{try{for(let t of WN().renderers.values())if(typeof t.scheduleUpdate==`function`){for(let n of e)if(n.current)try{t.scheduleUpdate(n.current)}catch{}}}catch{}})},ZL=e=>{for(let t of e)try{t()}catch{}},QL=()=>{for(let e of WN().renderers.values())PL.has(e)||(YL(e),PL.add(e))},$L=()=>{if(wL)return()=>{};QL(),wL=!0;let e=LL();for(let t of e)KL(t.current);return()=>{if(wL)try{let e=LL();for(let t of e)qL(t.current);let t=Array.from(kL),n=AL.slice(),r=jL.slice();wL=!1,ZL(t),ZL(n),ZL(r),XL(e)}finally{kL.clear(),AL.length=0,jL.length=0}}}}));function tR(e){let t=String(e),n=t.length-1;return yz.context.id+(n?String.fromCharCode(96+n):``)+t}function nR(e){yz.context=e}function rR(e,t){let n=Az,r=Oz,i=e.length===0,a=t===void 0?r:t,o=i?Ez:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>uR(()=>jR(o)));Oz=o,Az=null;try{return TR(s,!0)}finally{Az=n,Oz=r}}function J(e,t){t=t?Object.assign({},wz,t):wz;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[yR.bind(n),e=>(typeof e==`function`&&(e=kz&&kz.running&&kz.sources.has(n)?e(n.tValue):e(n.value)),bR(n,e))]}function iR(e,t,n){xR(CR(e,t,!0,1))}function aR(e,t,n){xR(CR(e,t,!1,1))}function oR(e,t,n){Tz=OR;let r=CR(e,t,!1,1),i=Iz&&_R(Iz);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),Mz?Mz.push(r):xR(r)}function Y(e,t,n){n=n?Object.assign({},wz,n):wz;let r=CR(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,xR(r),yR.bind(r)}function sR(e){return e&&typeof e==`object`&&`then`in e}function cR(e,t,n){let r,i,a;typeof t==`function`?(r=e,i=t,a=n||{}):(r=!0,i=e,a=t||{});let o=null,s=Dz,c=null,l=!1,u=!1,d=`initialValue`in a,f=typeof r==`function`&&Y(r),p=new Set,[m,h]=(a.storage||J)(a.initialValue),[g,_]=J(void 0),[v,y]=J(void 0,{equals:!1}),[b,x]=J(d?`ready`:`unresolved`);yz.context&&(c=yz.getNextContextId(),a.ssrLoadFrom===`initial`?s=a.initialValue:yz.load&&yz.has(c)&&(s=yz.load(c)));function S(e,t,n,r){return o===e&&(o=null,r!==void 0&&(d=!0),(e===s||t===s)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(r,{value:t})),s=Dz,kz&&e&&l?(kz.promises.delete(e),l=!1,TR(()=>{kz.running=!0,C(t,n)},!1)):C(t,n)),t}function C(e,t){TR(()=>{t===void 0&&h(()=>e),x(t===void 0?d?`ready`:`unresolved`:`errored`),_(t);for(let e of p.keys())e.decrement();p.clear()},!1)}function w(){let e=Iz&&_R(Iz),t=m(),n=g();if(n!==void 0&&!o)throw n;return Az&&!Az.user&&e&&iR(()=>{v(),o&&(e.resolved&&kz&&l?kz.promises.add(o):p.has(e)||(e.increment(),p.add(e)))}),t}function T(e=!0){if(e!==!1&&u)return;u=!1;let t=f?f():r;if(l=kz&&kz.running,t==null||t===!1){S(o,uR(m));return}kz&&o&&kz.promises.delete(o);let n,a=s===Dz?uR(()=>{try{return i(t,{value:m(),refetching:e})}catch(e){n=e}}):s;if(n!==void 0){S(o,void 0,NR(n),t);return}else if(!sR(a))return S(o,a,void 0,t),a;return o=a,`v`in a?(a.s===1?S(o,a.v,void 0,t):S(o,void 0,NR(a.v),t),a):(u=!0,queueMicrotask(()=>u=!1),TR(()=>{x(d?`refreshing`:`pending`),y()},!1),a.then(e=>S(a,e,void 0,t),e=>S(a,void 0,NR(e),t)))}Object.defineProperties(w,{state:{get:()=>b()},error:{get:()=>g()},loading:{get(){let e=b();return e===`pending`||e===`refreshing`}},latest:{get(){if(!d)return w();let e=g();if(e&&!o)throw e;return m()}}});let E=Oz;return f?iR(()=>(E=Oz,T(!1))):T(!1),[w,{refetch:e=>hR(E,()=>T(e)),mutate:h}]}function lR(e){return TR(e,!1)}function uR(e){if(Az===null)return e();let t=Az;Az=null;try{return e()}finally{Az=t}}function dR(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=uR(()=>t(o,i,n));return i=o,s}}function fR(e){oR(()=>uR(e))}function pR(e){return Oz===null||(Oz.cleanups===null?Oz.cleanups=[e]:Oz.cleanups.push(e)),e}function mR(){return Az}function hR(e,t){let n=Oz,r=Az;Oz=e,Az=null;try{return TR(t,!0)}catch(e){PR(e)}finally{Oz=n,Az=r}}function gR(e,t){let n=Symbol(`context`);return{id:n,Provider:IR(n),defaultValue:e}}function _R(e){let t;return Oz&&Oz.context&&(t=Oz.context[e.id])!==void 0?t:e.defaultValue}function vR(e){let t=Y(e),n=Y(()=>FR(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}function yR(){let e=kz&&kz.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===1)xR(this);else{let e=jz;jz=null,TR(()=>kR(this),!1),jz=e}if(Az){let e=this.observers?this.observers.length:0;Az.sources?(Az.sources.push(this),Az.sourceSlots.push(e)):(Az.sources=[this],Az.sourceSlots=[e]),this.observers?(this.observers.push(Az),this.observerSlots.push(Az.sources.length-1)):(this.observers=[Az],this.observerSlots=[Az.sources.length-1])}return e&&kz.sources.has(this)?this.tValue:this.value}function bR(e,t,n){let r=kz&&kz.running&&kz.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(kz){let r=kz.running;(r||!n&&kz.sources.has(e))&&(kz.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&TR(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=kz&&kz.running;r&&kz.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?jz.push(n):Mz.push(n),n.observers&&AR(n)),r?n.tState=1:n.state=1)}if(jz.length>1e6)throw jz=[],Error()},!1)}return t}function xR(e){if(!e.fn)return;jR(e);let t=Nz;SR(e,kz&&kz.running&&kz.sources.has(e)?e.tValue:e.value,t),kz&&!kz.running&&kz.sources.has(e)&&queueMicrotask(()=>{TR(()=>{kz&&(kz.running=!0),Az=Oz=e,SR(e,e.tValue,t),Az=Oz=null},!1)})}function SR(e,t,n){let r,i=Oz,a=Az;Az=Oz=e;try{r=e.fn(t)}catch(t){return e.pure&&(kz&&kz.running?(e.tState=1,e.tOwned&&e.tOwned.forEach(jR),e.tOwned=void 0):(e.state=1,e.owned&&e.owned.forEach(jR),e.owned=null)),e.updatedAt=n+1,PR(t)}finally{Az=a,Oz=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?bR(e,r,!0):kz&&kz.running&&e.pure?(kz.sources.has(e)||(e.value=r),kz.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function CR(e,t,n,r=1,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:Oz,context:Oz?Oz.context:null,pure:n};return kz&&kz.running&&(a.state=0,a.tState=r),Oz===null||Oz!==Ez&&(kz&&kz.running&&Oz.pure?Oz.tOwned?Oz.tOwned.push(a):Oz.tOwned=[a]:Oz.owned?Oz.owned.push(a):Oz.owned=[a]),a}function wR(e){let t=kz&&kz.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===2)return kR(e);if(e.suspense&&uR(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Nz);){if(t&&kz.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(kz.disposed.has(t))return}if((t?e.tState:e.state)===1)xR(e);else if((t?e.tState:e.state)===2){let t=jz;jz=null,TR(()=>kR(e,n[0]),!1),jz=t}}}function TR(e,t){if(jz)return e();let n=!1;t||(jz=[]),Mz?n=!0:Mz=[],Nz++;try{let t=e();return ER(n),t}catch(e){n||(Mz=null),jz=null,PR(e)}}function ER(e){if(jz&&=(DR(jz),null),e)return;let t;if(kz){if(!kz.promises.size&&!kz.queue.size){let e=kz.sources,n=kz.disposed;Mz.push.apply(Mz,kz.effects),t=kz.resolve;for(let e of Mz)`tState`in e&&(e.state=e.tState),delete e.tState;kz=null,TR(()=>{for(let e of n)jR(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)jR(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}Fz(!1)},!1)}else if(kz.running){kz.running=!1,kz.effects.push.apply(kz.effects,Mz),Mz=null,Fz(!0);return}}let n=Mz;Mz=null,n.length&&TR(()=>Tz(n),!1),t&&t()}function DR(e){for(let t=0;t<e.length;t++)wR(e[t])}function OR(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:wR(r)}if(yz.context){if(yz.count){yz.effects||=[],yz.effects.push(...e.slice(0,n));return}nR()}for(yz.effects&&(yz.done||!yz.count)&&(e=[...yz.effects,...e],n+=yz.effects.length,delete yz.effects),t=0;t<n;t++)wR(e[t])}function kR(e,t){let n=kz&&kz.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===1?i!==t&&(!i.updatedAt||i.updatedAt<Nz)&&wR(i):e===2&&kR(i,t)}}}function AR(e){let t=kz&&kz.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=2:r.state=2,r.pure?jz.push(r):Mz.push(r),r.observers&&AR(r))}}function jR(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--)jR(e.tOwned[t]);delete e.tOwned}if(kz&&kz.running&&e.pure)MR(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)jR(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}kz&&kz.running?e.tState=0:e.state=0}function MR(e,t){if(t||(e.tState=0,kz.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)MR(e.owned[t])}function NR(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function PR(e,t=Oz){throw NR(e)}function FR(e){if(typeof e==`function`&&!e.length)return FR(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=FR(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function IR(e,t){return function(t){let n;return aR(()=>n=uR(()=>(Oz.context={...Oz.context,[e]:t.value},vR(()=>t.children))),void 0),n}}function LR(e){for(let t=0;t<e.length;t++)e[t]()}function RR(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return pR(()=>LR(a)),()=>{let c=e()||[],l=c.length,u,d;return c[Cz],uR(()=>{let e,t,p,m,h,g,_,v,y;if(l===0)o!==0&&(LR(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Lz],i[0]=rR(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),d=0;d<l;d++)r[d]=c[d],i[d]=rR(f);o=l}else{for(p=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--)p[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),d=v;d>=g;d--)y=c[d],u=e.get(y),t[d]=u===void 0?-1:u,e.set(y,d);for(u=g;u<=_;u++)y=r[u],d=e.get(y),d!==void 0&&d!==-1?(p[d]=i[u],m[d]=a[u],s&&(h[d]=s[u]),d=t[d],e.set(y,d)):a[u]();for(d=g;d<l;d++)d in p?(i[d]=p[d],a[d]=m[d],s&&(s[d]=h[d],s[d](d))):i[d]=rR(f);i=i.slice(0,o=l),r=c.slice(0)}return i});function f(e){if(a[d]=e,s){let[e,n]=J(d);return s[d]=n,t(c[d],e)}return t(c[d])}}}function zR(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return pR(()=>LR(a)),()=>{let l=e()||[],u=l.length;return l[Cz],uR(()=>{if(u===0)return s!==0&&(LR(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[Lz],i[0]=rR(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===Lz&&(a[0](),a=[],r=[],i=[],s=0),c=0;c<u;c++)c<r.length&&r[c]!==l[c]?o[c](()=>l[c]):c>=r.length&&(i[c]=rR(d));for(;c<r.length;c++)a[c]();return s=o.length=a.length=u,r=l.slice(0),i=i.slice(0,s)});function d(e){a[c]=e;let[n,r]=J(l[c]);return o[c]=r,t(n,c)}}}function X(e,t){return uR(()=>e(t||{}))}function BR(){return!0}function VR(e){return(e=typeof e==`function`?e():e)?e:{}}function HR(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function UR(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&xz in r,e[n]=typeof r==`function`?(t=!0,Y(r)):r}if(Sz&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=VR(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in VR(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(VR(e[n])));return[...new Set(t)]}},Rz);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:HR.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 WR(e,...t){let n=t.length;if(Sz&&xz 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)}},Rz));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))}},Rz)),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}function GR(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return Y(RR(()=>e.each,e.children,t||void 0))}function KR(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return Y(zR(()=>e.each,e.children,t||void 0))}function qR(e){let t=e.keyed,n=Y(()=>e.when,void 0,void 0),r=t?n:Y(n,void 0,{equals:(e,t)=>!e==!t});return Y(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?uR(()=>a(t?i:()=>{if(!uR(r))throw zz(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function JR(e){let t=vR(()=>e.children),n=Y(()=>{let e=t(),n=Array.isArray(e)?e:[e],r=()=>void 0;for(let e=0;e<n.length;e++){let t=e,i=n[e],a=r,o=Y(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:Y(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return Y(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?uR(()=>o(a.keyed?i():()=>{if(uR(n)()?.[0]!==r)throw zz(`Match`);return i()})):o},void 0,void 0)}function YR(e){return e}function XR(e,t){let n=Uz[e];return typeof n==`object`?n[t]?n.$:void 0:n}function ZR(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()}}}function QR(e,t,n,r={}){let i;return rR(r=>{i=r,t===document?e():$(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function Z(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?()=>uR(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function $R(e,t=window.document){let n=t[qz]||(t[qz]=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,mz))}}function Q(e,t,n){uz(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function ez(e,t,n,r){uz(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function tz(e,t,n){uz(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function nz(e,t){uz(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function rz(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 iz(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]||(fz(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||(fz(e,i,!0),n[i]=o)}return n}function az(e,t,n){if(!t)return n?Q(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 oz(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function sz(e,t={},n,r){let i={};return r||aR(()=>i.children=hz(e,t.children,i.children)),aR(()=>typeof t.ref==`function`&&cz(t.ref,e)),aR(()=>lz(e,t,n,!0,i,!0)),i}function cz(e,t,n){return uR(()=>e(t,n))}function $(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return hz(e,t,r,n);aR(r=>hz(e,t(),r,n),r)}function lz(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=pz(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||hz(e,t.children);continue}let s=t[o];i[o]=pz(e,o,s,i[o],n,a,t)}}function uz(e){return!!yz.context&&!yz.done&&(!e||e.isConnected)}function dz(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function fz(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 pz(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return az(e,n,r);if(t===`classList`)return iz(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=Wz.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(rz(e,i,n,a),a&&$R([i]))}else if(t.slice(0,5)===`attr:`)Q(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)tz(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=Vz.has(t))||!i&&((u=XR(t,e.tagName))||(c=Bz.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(uz(e))return n;t===`class`||t===`className`?nz(e,n):s&&!c&&!l?e[dz(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&Gz[t.split(`:`)[0]];r?ez(e,r,t,n):Q(e,Hz[t]||t,n)}return n}function mz(e){if(yz.registry&&yz.events&&yz.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,i=e.currentTarget,a=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),o=()=>{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)&&a(t.host),!0},s=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),yz.registry&&!yz.done&&(yz.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();a(n[0]);for(let e=0;e<n.length-2&&(t=n[e],o());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===i)break}}else s();a(r)}function hz(e,t,n,r,i){let a=uz(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=vz(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=vz(e,n,r)}else if(o===`function`)return aR(()=>{let i=t();for(;typeof i==`function`;)i=i();n=hz(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(gz(o,t,n,i))return aR(()=>n=hz(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=vz(e,n,r),s)return n}else c?n.length===0?_z(e,o,r):ZR(e,n,o):(n&&vz(e),_z(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=vz(e,n,r,t);vz(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function gz(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=gz(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=gz(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 _z(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function vz(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 yz,bz,xz,Sz,Cz,wz,Tz,Ez,Dz,Oz,kz,Az,jz,Mz,Nz,Pz,Fz,Iz,Lz,Rz,zz,Bz,Vz,Hz,Uz,Wz,Gz,Kz,qz,Jz,Yz,Xz,Zz,Qz,$z,eB,tB,nB,rB,iB,aB,oB,sB,cB,lB,uB,dB,fB,pB,mB,hB,gB,_B,vB,yB,bB,xB,SB,CB,wB,TB,EB,DB,OB,kB,AB,jB,MB,NB,PB,FB,IB,LB,RB,zB,BB,VB,HB,UB,WB,GB,KB,qB,JB,YB,XB,ZB,QB,$B,eV,tV,nV,rV,iV,aV,oV,sV,cV,lV,uV,dV,fV,pV,mV,hV,gV,_V,vV,yV,bV,xV,SV,CV,wV,TV,EV,DV,OV,kV,AV,jV,MV,NV=t((()=>{eR(),yz={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return tR(this.context.count)},getNextContextId(){return tR(this.context.count++)}},bz=(e,t)=>e===t,xz=Symbol(`solid-proxy`),Sz=typeof Proxy==`function`,Cz=Symbol(`solid-track`),wz={equals:bz},Tz=DR,Ez={owned:null,cleanups:null,context:null,owner:null},Dz={},Oz=null,kz=null,Az=null,jz=null,Mz=null,Nz=0,[Pz,Fz]=J(!1),Lz=Symbol(`fallback`),Rz={get(e,t,n){return t===xz?n:e.get(t)},has(e,t){return t===xz||e.has(t)},set:BR,deleteProperty:BR,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:BR,deleteProperty:BR}},ownKeys(e){return e.keys()}},zz=e=>`Stale read from <${e}>.`,Bz=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(`.`)]),Vz=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),Hz=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),Uz=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}}),Wz=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),Gz={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},Kz=e=>Y(()=>e()),qz=`_$DX_DELEGATE`,Jz=e=>!!(e?.isConnected??e?.ownerDocument?.contains(e)),Yz=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`,`combobox`],Xz=e=>{if(e.composed){let t=e.composedPath()[0];if(t instanceof HTMLElement)return t}else if(e.target instanceof HTMLElement)return e.target},Zz=e=>{if(document.designMode===`on`)return!0;let t=Xz(e);if(!t)return!1;if(t.isContentEditable)return!0;let n=TN(t);return Yz.some(e=>e===n||e===t.role)},Qz=e=>{let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){let e=t.selectionStart??0;return(t.selectionEnd??0)-e>0}return!1},$z=()=>{let e=window.getSelection();return e?e.toString().length>0:!1},eB=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/,tB=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`),nB=(e,t,n,r=1)=>{let i=tB(e),a=tB(t),o=tB(n);return r>=1?`#${i}${a}${o}`:`#${i}${a}${o}${tB(r*255)}`},rB=e=>{if(!e.startsWith(`#`))return null;let t=e.slice(1);if(t.length!==6&&t.length!==8)return null;let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),a=t.length===8?parseInt(t.slice(6,8),16)/255:1;return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)?null:{red:n,green:r,blue:i,alpha:a}},iB=e=>{let t=e.match(eB);if(!t)return null;let n=1;if(t[4]!==void 0){let e=t[4];n=e.endsWith(`%`)?Number(e.slice(0,-1))/100:Number(e)}return nB(Number(t[1]),Number(t[2]),Number(t[3]),n)},aB=e=>{let t=e.match(eB);return!t||t[4]===void 0?!1:(t[4].endsWith(`%`)?Number(t[4].slice(0,-1))/100:Number(t[4]))===0},oB=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,sB=e=>{let t=e.match(oB);if(!t)return null;let n=t[1];return n.length===3?`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`:n.length===4?`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:`#${n}`},cB=`rgba(0, 0, 0, 0)`,lB=/^oklch\(\s*([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+)(deg|grad|rad|turn)?(?:\s*\/\s*([+-]?\d*\.?\d+%?))?\s*\)$/i,uB=180/Math.PI,dB=(e,t)=>e.endsWith(`%`)?Number(e.slice(0,-1))/100*t:Number(e),fB=(e,t)=>{let n=Number(e);return t===`grad`?n*.9:t===`rad`?n*uB:t===`turn`?n*360:n},pB=e=>{let t=Math.max(0,Math.min(1,e));return(t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055)*255},mB=e=>{let t=e.match(lB);if(!t)return null;let n=dB(t[1],1),r=dB(t[2],.4),i=fB(t[3],t[4])*Math.PI/180,a=t[5]===void 0?1:dB(t[5],1);if(![n,r,i,a].every(Number.isFinite))return null;let o=r*Math.cos(i),s=r*Math.sin(i),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return nB(pB(m),pB(h),pB(g),Math.max(0,Math.min(1,a)))},hB=null,gB=()=>hB||(typeof document>`u`?null:(hB=document.createElement(`canvas`).getContext(`2d`,{willReadFrequently:!0}),hB)),_B=(e,t)=>{e.clearRect(0,0,1,1),e.fillStyle=t,e.fillRect(0,0,1,1);let n=e.getImageData(0,0,1,1).data;return n[3]===0?pN:nB(n[0],n[1],n[2],n[3]/255)},vB=e=>{let t=e.trim();if(!t)return null;if(t.toLowerCase()===`transparent`)return pN;let n=sB(t);if(n)return n;let r=mB(t);if(r)return r;let i=gB();if(!i)return null;i.fillStyle=cB,i.fillStyle=t;let a=i.fillStyle;return typeof a==`string`?a.toLowerCase()===cB?t.toLowerCase().replace(/\s+/g,``)===`rgba(0,0,0,0)`?pN:null:a.startsWith(`#`)&&a.length===7?a:a.startsWith(`rgb`)?iB(a):_B(i,t):null},yB=(e,t,n)=>Math.max(t,Math.min(e,n)),bB=null,xB=()=>{if(typeof navigator>`u`||!(`userAgentData`in navigator))return null;let e=navigator.userAgentData;if(typeof e!=`object`||!e||!(`platform`in e))return null;let t=e.platform;return typeof t==`string`?t:null},SB=()=>{if(bB===null){if(typeof navigator>`u`)return bB=!1,bB;let e=navigator.platform??xB()??navigator.userAgent;bB=/Mac|iPhone|iPad|iPod/i.test(e)}return bB},CB=(e,t)=>{try{return e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute(t))}catch{return!1}},wB=`padding-top.padding-right.padding-bottom.padding-left.margin-top.margin-right.margin-bottom.margin-left.gap.row-gap.column-gap.font-size.line-height.letter-spacing.border-radius.border-top-left-radius.border-top-right-radius.border-bottom-right-radius.border-bottom-left-radius.border-width.border-top-width.border-right-width.border-bottom-width.border-left-width.opacity.width.height.min-width.min-height.max-width.max-height.top.right.bottom.left.z-index`.split(`.`),TB=-128,EB=-512,DB=-9999,OB=9999,kB=new Set([`letter-spacing`,`gap`,`row-gap`,`column-gap`]),AB=new Set([`z-index`]),jB=[{key:`padding`,label:`padding`,longhands:[`padding-top`,`padding-right`,`padding-bottom`,`padding-left`]},{key:`padding-top,padding-bottom`,label:`padding-y`,longhands:[`padding-top`,`padding-bottom`]},{key:`padding-left,padding-right`,label:`padding-x`,longhands:[`padding-left`,`padding-right`]},{key:`padding-top`,label:`padding top`,longhands:[`padding-top`]},{key:`padding-right`,label:`padding right`,longhands:[`padding-right`]},{key:`padding-bottom`,label:`padding bottom`,longhands:[`padding-bottom`]},{key:`padding-left`,label:`padding left`,longhands:[`padding-left`]}],MB=[{key:`margin`,label:`margin`,longhands:[`margin-top`,`margin-right`,`margin-bottom`,`margin-left`]},{key:`margin-top,margin-bottom`,label:`margin-y`,longhands:[`margin-top`,`margin-bottom`]},{key:`margin-left,margin-right`,label:`margin-x`,longhands:[`margin-left`,`margin-right`]},{key:`margin-top`,label:`margin top`,longhands:[`margin-top`]},{key:`margin-right`,label:`margin right`,longhands:[`margin-right`]},{key:`margin-bottom`,label:`margin bottom`,longhands:[`margin-bottom`]},{key:`margin-left`,label:`margin left`,longhands:[`margin-left`]}],NB=[{key:`gap`,label:`gap`,longhands:[`row-gap`,`column-gap`]},{key:`row-gap`,label:`row gap`,longhands:[`row-gap`]},{key:`column-gap`,label:`column gap`,longhands:[`column-gap`]}],PB=[{key:`border-radius`,label:`border radius`,longhands:[`border-top-left-radius`,`border-top-right-radius`,`border-bottom-right-radius`,`border-bottom-left-radius`]},{key:`border-top-left-radius,border-top-right-radius`,label:`top corners`,longhands:[`border-top-left-radius`,`border-top-right-radius`]},{key:`border-bottom-left-radius,border-bottom-right-radius`,label:`bottom corners`,longhands:[`border-bottom-left-radius`,`border-bottom-right-radius`]},{key:`border-top-left-radius,border-bottom-left-radius`,label:`left corners`,longhands:[`border-top-left-radius`,`border-bottom-left-radius`]},{key:`border-top-right-radius,border-bottom-right-radius`,label:`right corners`,longhands:[`border-top-right-radius`,`border-bottom-right-radius`]},{key:`border-top-left-radius`,label:`top left radius`,longhands:[`border-top-left-radius`]},{key:`border-top-right-radius`,label:`top right radius`,longhands:[`border-top-right-radius`]},{key:`border-bottom-right-radius`,label:`bottom right radius`,longhands:[`border-bottom-right-radius`]},{key:`border-bottom-left-radius`,label:`bottom left radius`,longhands:[`border-bottom-left-radius`]}],FB=[{key:`top,right,bottom,left`,label:`inset`,longhands:[`top`,`right`,`bottom`,`left`]},{key:`top,bottom`,label:`inset-y`,longhands:[`top`,`bottom`]},{key:`left,right`,label:`inset-x`,longhands:[`left`,`right`]},{key:`top`,label:`top`,longhands:[`top`]},{key:`right`,label:`right`,longhands:[`right`]},{key:`bottom`,label:`bottom`,longhands:[`bottom`]},{key:`left`,label:`left`,longhands:[`left`]}],IB=new Set(FB.map(e=>e.key)),LB=[jB,MB,NB,PB,[{key:`border-width`,label:`border width`,longhands:[`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`]},{key:`border-top-width`,label:`border top width`,longhands:[`border-top-width`]},{key:`border-right-width`,label:`border right width`,longhands:[`border-right-width`]},{key:`border-bottom-width`,label:`border bottom width`,longhands:[`border-bottom-width`]},{key:`border-left-width`,label:`border left width`,longhands:[`border-left-width`]}],[{key:`width,height`,label:`size`,longhands:[`width`,`height`]},{key:`width`,label:`width`,longhands:[`width`]},{key:`height`,label:`height`,longhands:[`height`]}],FB],RB=[{key:`font-size`,label:`font size`},{key:`line-height`,label:`line height`},{key:`letter-spacing`,label:`letter spacing`},{key:`min-width`,label:`min width`},{key:`min-height`,label:`min height`},{key:`max-width`,label:`max width`},{key:`max-height`,label:`max height`},{key:`z-index`,label:`z-index`},{key:`opacity`,label:`opacity`}],zB=[{key:`color`,label:`text color`,alwaysShow:!0},{key:`background-color`,label:`background`,alwaysShow:!0},{key:`border-color`,label:`border color`},{key:`fill`,label:`fill`},{key:`stroke`,label:`stroke`}],BB=[{value:`ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,label:`sans`},{value:`ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`,label:`serif`},{value:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,label:`mono`},{value:`system-ui, sans-serif`,label:`system`},{value:`serif`,label:`serif`},{value:`monospace`,label:`mono`}],VB=e=>{let t=e.trim();return BB.some(e=>e.value===t)?BB:[{value:t,label:`current`},...BB]},HB={key:`font-family`,label:`font family`},UB=[{key:`display`,label:`display`,options:[{value:`block`,label:`block`},{value:`flex`,label:`flex`},{value:`inline-block`,label:`inline-block`},{value:`inline`,label:`inline`},{value:`grid`,label:`grid`},{value:`none`,label:`none`}]},{key:`text-align`,label:`text align`,options:[{value:`left`,label:`left`},{value:`center`,label:`center`},{value:`right`,label:`right`},{value:`justify`,label:`justify`}]},{key:`font-style`,label:`font style`,options:[{value:`normal`,label:`normal`},{value:`italic`,label:`italic`}]},{key:`text-transform`,label:`text transform`,options:[{value:`none`,label:`none`},{value:`uppercase`,label:`uppercase`},{value:`lowercase`,label:`lowercase`},{value:`capitalize`,label:`capitalize`}]},{key:`white-space`,label:`white space`,options:[{value:`normal`,label:`normal`},{value:`nowrap`,label:`nowrap`},{value:`pre`,label:`pre`},{value:`pre-wrap`,label:`pre-wrap`},{value:`pre-line`,label:`pre-line`},{value:`break-spaces`,label:`break-spaces`}]},{key:`word-break`,label:`word break`,options:[{value:`normal`,label:`normal`},{value:`break-all`,label:`break-all`},{value:`keep-all`,label:`keep-all`}]},{key:`overflow-wrap`,label:`wrap`,options:[{value:`normal`,label:`normal`},{value:`break-word`,label:`break-word`},{value:`anywhere`,label:`anywhere`}]},{key:`font-variant-numeric`,label:`number style`,options:[{value:`normal`,label:`normal`},{value:`tabular-nums`,label:`tabular`},{value:`proportional-nums`,label:`proportional`},{value:`lining-nums`,label:`lining`},{value:`oldstyle-nums`,label:`oldstyle`},{value:`slashed-zero`,label:`slashed zero`}]},{key:`text-decoration-line`,label:`decoration`,options:[{value:`none`,label:`none`},{value:`underline`,label:`underline`},{value:`line-through`,label:`strike`}]},{key:`border-style`,label:`border style`,options:[{value:`none`,label:`none`},{value:`solid`,label:`solid`},{value:`dashed`,label:`dashed`},{value:`dotted`,label:`dotted`}]},{key:`visibility`,label:`visibility`,options:[{value:`visible`,label:`visible`},{value:`hidden`,label:`hidden`}]},{key:`align-items`,label:`align items`,options:[{value:`stretch`,label:`stretch`},{value:`flex-start`,label:`start`},{value:`center`,label:`center`},{value:`flex-end`,label:`end`},{value:`baseline`,label:`baseline`}]},{key:`justify-content`,label:`justify content`,options:[{value:`flex-start`,label:`start`},{value:`center`,label:`center`},{value:`flex-end`,label:`end`},{value:`space-between`,label:`between`},{value:`space-around`,label:`around`},{value:`space-evenly`,label:`evenly`}]},{key:`font-weight`,label:`font weight`,options:[{value:`100`,label:`thin`},{value:`200`,label:`extra-light`},{value:`300`,label:`light`},{value:`400`,label:`normal`},{value:`500`,label:`medium`},{value:`600`,label:`semibold`},{value:`700`,label:`bold`},{value:`800`,label:`extra-bold`},{value:`900`,label:`black`}]}],WB=[...wB,`color`,`background-color`,`border-color`,`fill`,`stroke`,`font-family`,`display`,`text-align`,`font-style`,`text-transform`,`white-space`,`word-break`,`overflow-wrap`,`font-variant-numeric`,`text-decoration-line`,`border-style`,`visibility`,`align-items`,`justify-content`,`font-weight`],GB=e=>Number.isInteger(e)?e:Math.round(e*100)/100,KB=e=>Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,``),qB=e=>Number.isFinite(e)?KB(GB(e)):String(e),JB=e=>Math.round(e),YB=(e,t)=>{if(e.kind===`color`||e.kind===`enum`)return typeof t==`string`?t:e.value;let n=typeof t==`number`?t:e.value;return e.key===`opacity`&&e.unit===`%`?KB(GB(n/100)):`${KB(GB(n))}${e.unit}`},XB={slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#64748b`,600:`#475569`,700:`#334155`,800:`#1e293b`,900:`#0f172a`,950:`#020617`},gray:{50:`#f9fafb`,100:`#f3f4f6`,200:`#e5e7eb`,300:`#d1d5db`,400:`#9ca3af`,500:`#6b7280`,600:`#4b5563`,700:`#374151`,800:`#1f2937`,900:`#111827`,950:`#030712`},zinc:{50:`#fafafa`,100:`#f4f4f5`,200:`#e4e4e7`,300:`#d4d4d8`,400:`#a1a1aa`,500:`#71717a`,600:`#52525b`,700:`#3f3f46`,800:`#27272a`,900:`#18181b`,950:`#09090b`},neutral:{50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},stone:{50:`#fafaf9`,100:`#f5f5f4`,200:`#e7e5e4`,300:`#d6d3d1`,400:`#a8a29e`,500:`#78716c`,600:`#57534e`,700:`#44403c`,800:`#292524`,900:`#1c1917`,950:`#0c0a09`},red:{50:`#fef2f2`,100:`#fee2e2`,200:`#fecaca`,300:`#fca5a5`,400:`#f87171`,500:`#ef4444`,600:`#dc2626`,700:`#b91c1c`,800:`#991b1b`,900:`#7f1d1d`,950:`#450a0a`},orange:{50:`#fff7ed`,100:`#ffedd5`,200:`#fed7aa`,300:`#fdba74`,400:`#fb923c`,500:`#f97316`,600:`#ea580c`,700:`#c2410c`,800:`#9a3412`,900:`#7c2d12`,950:`#431407`},amber:{50:`#fffbeb`,100:`#fef3c7`,200:`#fde68a`,300:`#fcd34d`,400:`#fbbf24`,500:`#f59e0b`,600:`#d97706`,700:`#b45309`,800:`#92400e`,900:`#78350f`,950:`#451a03`},yellow:{50:`#fefce8`,100:`#fef9c3`,200:`#fef08a`,300:`#fde047`,400:`#facc15`,500:`#eab308`,600:`#ca8a04`,700:`#a16207`,800:`#854d0e`,900:`#713f12`,950:`#422006`},lime:{50:`#f7fee7`,100:`#ecfccb`,200:`#d9f99d`,300:`#bef264`,400:`#a3e635`,500:`#84cc16`,600:`#65a30d`,700:`#4d7c0f`,800:`#3f6212`,900:`#365314`,950:`#1a2e05`},green:{50:`#f0fdf4`,100:`#dcfce7`,200:`#bbf7d0`,300:`#86efac`,400:`#4ade80`,500:`#22c55e`,600:`#16a34a`,700:`#15803d`,800:`#166534`,900:`#14532d`,950:`#052e16`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#10b981`,600:`#059669`,700:`#047857`,800:`#065f46`,900:`#064e3b`,950:`#022c22`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#14b8a6`,600:`#0d9488`,700:`#0f766e`,800:`#115e59`,900:`#134e4a`,950:`#042f2e`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#06b6d4`,600:`#0891b2`,700:`#0e7490`,800:`#155e75`,900:`#164e63`,950:`#083344`},sky:{50:`#f0f9ff`,100:`#e0f2fe`,200:`#bae6fd`,300:`#7dd3fc`,400:`#38bdf8`,500:`#0ea5e9`,600:`#0284c7`,700:`#0369a1`,800:`#075985`,900:`#0c4a6e`,950:`#082f49`},blue:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#3b82f6`,600:`#2563eb`,700:`#1d4ed8`,800:`#1e40af`,900:`#1e3a8a`,950:`#172554`},indigo:{50:`#eef2ff`,100:`#e0e7ff`,200:`#c7d2fe`,300:`#a5b4fc`,400:`#818cf8`,500:`#6366f1`,600:`#4f46e5`,700:`#4338ca`,800:`#3730a3`,900:`#312e81`,950:`#1e1b4b`},violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#8b5cf6`,600:`#7c3aed`,700:`#6d28d9`,800:`#5b21b6`,900:`#4c1d95`,950:`#2e1065`},purple:{50:`#faf5ff`,100:`#f3e8ff`,200:`#e9d5ff`,300:`#d8b4fe`,400:`#c084fc`,500:`#a855f7`,600:`#9333ea`,700:`#7e22ce`,800:`#6b21a8`,900:`#581c87`,950:`#3b0764`},fuchsia:{50:`#fdf4ff`,100:`#fae8ff`,200:`#f5d0fe`,300:`#f0abfc`,400:`#e879f9`,500:`#d946ef`,600:`#c026d3`,700:`#a21caf`,800:`#86198f`,900:`#701a75`,950:`#4a044e`},pink:{50:`#fdf2f8`,100:`#fce7f3`,200:`#fbcfe8`,300:`#f9a8d4`,400:`#f472b6`,500:`#ec4899`,600:`#db2777`,700:`#be185d`,800:`#9d174d`,900:`#831843`,950:`#500724`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#f43f5e`,600:`#e11d48`,700:`#be123c`,800:`#9f1239`,900:`#881337`,950:`#4c0519`}},ZB={p:`padding`,px:`padding-left,padding-right`,py:`padding-top,padding-bottom`,pt:`padding-top`,pr:`padding-right`,pb:`padding-bottom`,pl:`padding-left`,ps:`padding-left`,pe:`padding-right`,m:`margin`,mx:`margin-left,margin-right`,my:`margin-top,margin-bottom`,mt:`margin-top`,mr:`margin-right`,mb:`margin-bottom`,ml:`margin-left`,ms:`margin-left`,me:`margin-right`,gap:`gap`,"gap-x":`column-gap`,"gap-y":`row-gap`,text:`font-size`,leading:`line-height`,tracking:`letter-spacing`,rounded:`border-radius`,"rounded-t":`border-top-left-radius,border-top-right-radius`,"rounded-b":`border-bottom-left-radius,border-bottom-right-radius`,"rounded-l":`border-top-left-radius,border-bottom-left-radius`,"rounded-r":`border-top-right-radius,border-bottom-right-radius`,"rounded-tl":`border-top-left-radius`,"rounded-tr":`border-top-right-radius`,"rounded-bl":`border-bottom-left-radius`,"rounded-br":`border-bottom-right-radius`,border:`border-width`,"border-t":`border-top-width`,"border-r":`border-right-width`,"border-b":`border-bottom-width`,"border-l":`border-left-width`,w:`width`,h:`height`,size:`width,height`,"max-w":`max-width`,"max-h":`max-height`,"min-w":`min-width`,"min-h":`min-height`,opacity:`opacity`,inset:`top,right,bottom,left`,"inset-x":`left,right`,"inset-y":`top,bottom`,top:`top`,right:`right`,bottom:`bottom`,left:`left`,z:`z-index`,items:`align-items`,justify:`justify-content`,font:`font-weight`,whitespace:`white-space`},QB={"font-size":[`font-size`,`font size`,`text-size`,`text size`],color:[`color`,`text-color`,`text color`,`text-colour`,`text colour`,`foreground`,`fg`],"background-color":[`background`,`background-color`,`background color`,`bg`,`bg-color`,`bg color`],"border-color":[`border-color`,`border color`],fill:[`fill`,`fill-color`,`fill color`],stroke:[`stroke`,`stroke-color`,`stroke color`],"font-family":[`font`,`font-sans`,`font-serif`,`font-mono`,`family`,`sans`,`serif`,`mono`],"font-style":[`italic`,`not-italic`],"text-align":[`text-left`,`text-center`,`text-right`,`text-justify`],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-decoration-line":[`underline`,`line-through`,`no-underline`],"white-space":[`whitespace`,`whitespace-normal`,`whitespace-nowrap`,`whitespace-pre`],"word-break":[`break-normal`,`break-all`,`break-keep`],"overflow-wrap":[`break-words`,`break-anywhere`],"font-variant-numeric":[`tabular-nums`,`proportional-nums`,`lining-nums`,`oldstyle-nums`],"border-style":[`border-solid`,`border-dashed`,`border-dotted`,`border-none`]},$B=(()=>{let e={};for(let[t,n]of Object.entries(ZB))n!==void 0&&(e[n]??=new Set).add(t);let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=Array.from(r));for(let[e,n]of Object.entries(QB)){let r=new Set([...t[e]??[],...n]);t[e]=Array.from(r)}return t})(),eV={text:`color`,bg:`background-color`,border:`border-color`,"border-x":`border-color`,"border-y":`border-color`,"border-t":`border-color`,"border-r":`border-color`,"border-b":`border-color`,"border-l":`border-color`,"border-s":`border-color`,"border-e":`border-color`,fill:`fill`,stroke:`stroke`},tV=e=>ZB[e]!==void 0||eV[e]!==void 0,nV=e=>{let t=0,n=-1;for(let r=0;r<e.length;r++){let i=e[r];i===`[`?t++:i===`]`?t--:i===`:`&&t===0&&(n=r)}let r=n>=0?e.slice(n+1):e;return r.startsWith(`!`)?r.slice(1):r},rV=e=>{let t=nV(e);if(!t)return null;let n=t.indexOf(`[`);if(n>0)return t.slice(0,n).replace(/-$/,``)||null;let r=t.split(`-`).filter(Boolean);if(r.length===0)return null;for(let e=r.length;e>=1;e--){let t=r.slice(0,e).join(`-`);if(tV(t))return t}return r[0]},iV=/-(red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone|black|white|transparent|current|inherit)\b/,aV=(e,t)=>e!==`text`&&e!==`bg`&&e!==`border`&&!e.startsWith(`border-`)?!1:iV.test(t),oV=new Set(`color.red.orange.amber.yellow.lime.green.emerald.teal.cyan.sky.blue.indigo.violet.purple.fuchsia.pink.rose.slate.gray.grey.zinc.neutral.stone.black.white.transparent.current.currentcolor.inherit.primary.secondary.accent.muted.foreground.background.destructive.success.warning.error.info.card.popover.input.ring`.split(`.`)),sV=new Set([`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`,`9xl`]),cV=/^(#|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color:|color\(|var\(--.*color)/,lV=/^(-?\d|length:|size:)/,uV=e=>e.trim().toLowerCase().replace(/\s+/g,`-`).replace(/([a-z])(\d)/g,`$1-$2`),dV=e=>cV.test(e)&&!lV.test(e),fV=(e,t)=>{if(e===t)return``;let n=`${t}-`;return e.startsWith(n)?e.slice(n.length):null},pV=e=>{let t=nV(uV(e)),n=rV(t);if(!n)return null;let r=eV[n];if(!r)return null;let i=t.indexOf(`[`);if(i>=0)return dV(t.slice(i+1).replace(/\]$/,``))?r:null;let a=fV(t,n);if(a===null)return null;if(n===`bg`&&a===``||(n===`fill`||n===`stroke`)&&a===``)return r;let o=a.split(`-`)[0];return n===`text`&&sV.has(o)?null:oV.has(o)?r:null},mV={black:`#000000`,white:`#ffffff`,transparent:pN},hV=e=>{let t=nV(uV(e)),n=rV(t);if(!n||eV[n]===void 0||t.includes(`[`))return null;let r=fV(t,n);if(!r)return null;let i=mV[r];if(i)return i;let a=r.lastIndexOf(`-`);if(a<0)return null;let o=r.slice(0,a),s=o===`grey`?`gray`:o,c=Number.parseInt(r.slice(a+1),10);return XB[s]?.[c]??null},gV=/^-?\d/,_V=(e,t)=>{if(t===``||t.startsWith(`[`)||gV.test(t))return!0;let n=t.split(`-`)[0];return e===`text`?sV.has(n):e===`font`||e===`border`||e.startsWith(`border-`)?!1:(e===`rounded`||e.startsWith(`rounded-`),!0)},vV={"font-sans":{property:`font-family`,value:`ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`},"font-serif":{property:`font-family`,value:`ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`},"font-mono":{property:`font-family`,value:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`},"font-thin":{property:`font-weight`,value:`100`},"font-extralight":{property:`font-weight`,value:`200`},"font-light":{property:`font-weight`,value:`300`},"font-normal":{property:`font-weight`,value:`400`},"font-medium":{property:`font-weight`,value:`500`},"font-semibold":{property:`font-weight`,value:`600`},"font-bold":{property:`font-weight`,value:`700`},"font-extrabold":{property:`font-weight`,value:`800`},"font-black":{property:`font-weight`,value:`900`},"text-left":{property:`text-align`,value:`left`},"text-center":{property:`text-align`,value:`center`},"text-right":{property:`text-align`,value:`right`},"text-justify":{property:`text-align`,value:`justify`},italic:{property:`font-style`,value:`italic`},"not-italic":{property:`font-style`,value:`normal`},uppercase:{property:`text-transform`,value:`uppercase`},lowercase:{property:`text-transform`,value:`lowercase`},capitalize:{property:`text-transform`,value:`capitalize`},"normal-case":{property:`text-transform`,value:`none`},underline:{property:`text-decoration-line`,value:`underline`},"line-through":{property:`text-decoration-line`,value:`line-through`},"no-underline":{property:`text-decoration-line`,value:`none`},"whitespace-normal":{property:`white-space`,value:`normal`},"whitespace-nowrap":{property:`white-space`,value:`nowrap`},"whitespace-pre":{property:`white-space`,value:`pre`},"whitespace-pre-line":{property:`white-space`,value:`pre-line`},"whitespace-pre-wrap":{property:`white-space`,value:`pre-wrap`},"whitespace-break-spaces":{property:`white-space`,value:`break-spaces`},"break-normal":{property:`word-break`,value:`normal`},"break-all":{property:`word-break`,value:`break-all`},"break-keep":{property:`word-break`,value:`keep-all`},"break-words":{property:`overflow-wrap`,value:`break-word`},"break-anywhere":{property:`overflow-wrap`,value:`anywhere`},"tabular-nums":{property:`font-variant-numeric`,value:`tabular-nums`},"proportional-nums":{property:`font-variant-numeric`,value:`proportional-nums`},"lining-nums":{property:`font-variant-numeric`,value:`lining-nums`},"oldstyle-nums":{property:`font-variant-numeric`,value:`oldstyle-nums`},"slashed-zero":{property:`font-variant-numeric`,value:`slashed-zero`},"border-solid":{property:`border-style`,value:`solid`},"border-dashed":{property:`border-style`,value:`dashed`},"border-dotted":{property:`border-style`,value:`dotted`},"border-none":{property:`border-style`,value:`none`}},yV=e=>{let t=uV(e);if(!t)return[];let n=wV(t);if(n)return[n.property];let r=pV(t);return r?[r]:[]},bV=e=>{let t=uV(e);if(!t)return[];let n=rV(t);if(!n)return[];let r=fV(nV(t),n);if(r===null||!_V(n,r))return[];let i=CV(n);return i?[i]:[]},xV=e=>{let t=e.getAttribute(`class`);if(!t)return new Set;let n=t.split(/\s+/).filter(Boolean),r=new Set;for(let e of n){let t=rV(e);if(!t||aV(t,e))continue;let n=wV(e);if(n){r.add(n.property);continue}let i=CV(t);i&&r.add(i)}return r},SV=e=>$B[e]??[],CV=e=>{let t=ZB[e];return t===void 0?null:t},wV=e=>{let t=vV[nV(e)];return t===void 0?null:t},TV=`react-grab-toolbar-state`,EV=()=>{try{let e=localStorage.getItem(TV);if(!e)return null;let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t,r=typeof n.collapsed==`boolean`&&n.collapsed;return{edge:n.edge===`top`||n.edge===`bottom`||n.edge===`left`||n.edge===`right`?n.edge:`bottom`,ratio:typeof n.ratio==`number`?n.ratio:rN,collapsed:r,enabled:!r,defaultAction:typeof n.defaultAction==`string`?n.defaultAction:iN}}catch(e){console.warn(`[react-grab] Failed to load toolbar state from localStorage:`,e)}return null},DV=e=>{try{localStorage.setItem(TV,JSON.stringify(e))}catch(e){console.warn(`[react-grab] Failed to save toolbar state to localStorage:`,e)}},OV=e=>{let[t,n]=J(!1);return fR(()=>{let t=EM(t=>n(e(t))),r=()=>n(!1);window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,t,{capture:!0}),window.addEventListener(`blur`,r),pR(()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,t,{capture:!0}),window.removeEventListener(`blur`,r)})}),t},kV=e=>e.key===`Enter`,AV=e=>e.metaKey||e.ctrlKey,jV=(e,t,n={})=>{if(!t.key)return null;if(kV(t))return e.find(e=>e.shortcut===`Enter`)??null;if(t.repeat)return null;let r=t.key.toLowerCase();return AV(t)?n.includeModifierShortcuts===!0?e.find(e=>e.shortcut!==void 0&&e.shortcut!==`Enter`&&e.shortcutModifier!==!1&&r===e.shortcut.toLowerCase())??null:null:e.find(e=>e.shortcut!==void 0&&e.shortcutModifier===!1&&r===e.shortcut.toLowerCase())??null},MV=()=>{let e=!1;return{arm:()=>{e=!0},clear:()=>{e=!1},consume:()=>e?(e=!1,!0):!1}}})),PV,FV,IV,LV,RV,zV,BV,VV,HV,UV,WV,GV,KV,qV,JV,YV,XV,ZV,QV,$V,eH,tH,nH,rH,iH,aH,oH,sH,cH,lH,uH,dH,fH,pH,mH,hH,gH,_H,vH,yH,bH,xH,SH,CH,wH,TH,EH,DH,OH,kH,AH,jH,MH,NH,PH,FH,IH,LH,RH,zH,BH,VH,HH,UH,WH,GH,KH,qH,JH,YH,XH,ZH,QH,$H,eU,tU,nU,rU,iU,aU,oU,sU,cU,lU,uU,dU,fU,pU,mU,hU,gU,_U,vU,yU,bU,xU,SU,CU,wU,TU,EU,DU,OU,kU,AU,jU,MU,NU,PU,FU,IU,LU,RU,zU,BU,VU,HU,UU,WU,GU=t((()=>{eR(),PV=class extends Error{constructor(e){super(e),this.name=`ReactGrabError`}},FV=class extends PV{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},IV=class extends PV{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},LV=class extends PV{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},RV=class extends PV{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}},zV=e=>e===void 0||!Number.isFinite(e)?3:Math.max(0,Math.floor(e)),BV=e=>{try{return decodeURIComponent(e)}catch{return e}},VV=/(?:^|[/\\])node_modules[/\\]/,HV=/[/\\]\.vite[/\\]deps[^/\\]*[/\\]/,UV=/\.[mc]?[jt]sx?$/i,WV=/^chunk-[A-Za-z0-9_-]+$/,GV=/[/\\]/,KV=/^(.+?)@v?\d/,qV=e=>e.split(GV).filter(Boolean),JV=e=>{let[t,n]=qV(e);return!t||t.startsWith(`.`)?null:t.startsWith(`@`)?n?`${t}/${n}`:null:t},YV=e=>{let t=qV(e)[0];if(!t)return null;let n=t.replace(UV,``);if(WV.test(n))return null;if(!n.startsWith(`@`))return n;let r=n.indexOf(`_`);return r===-1?null:`${n.slice(0,r)}/${n.slice(r+1)}`},XV=(e,t,n)=>{let r=e.split(t);return r.length>1?n(r[r.length-1]):null},ZV=e=>e?.match(KV)?.[1]??null,QV=e=>{let t;try{t=new URL(e)}catch{return null}if(!t.hostname)return null;let n=qV(t.pathname).map(BV);for(let[e,t]of n.entries()){if(t.startsWith(`@`)){let r=ZV(n[e+1]);if(r)return`${t}/${r}`;continue}let r=ZV(t);if(r)return r}return null},$V=e=>XV(e,HV,YV)??XV(e,VV,JV),eH=e=>{if(!e)return null;let t=nF(e);return t&&($V(BV(t))||QV(e))||null},tH=/^@[A-Za-z0-9][A-Za-z0-9._-]*$/,nH=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,rH=new Set([`app`,`web`,`website`,`frontend`,`client`,`src`]),iH=new Set([`app`,`src`,`components`,`pages`,`features`,`modules`,`hooks`,`lib`,`utils`,`ui`,`shared`,`common`,`core`,`styles`,`assets`]),aH=e=>{let t=e;for(;t.startsWith(`../`)||t.startsWith(`./`);)t=t.slice(t.startsWith(`../`)?3:2);return t},oH=e=>{let t=aH(BV(nF(e)));if(t.startsWith(`/`))return null;let[n,r,...i]=qV(t);return!n||!r||i.length===0||!tH.test(n)||iH.has(n.slice(1))||!nH.test(r)||UV.test(r)||rH.has(r)?null:`${n}/${r}`},sH=e=>e?eH(e)??oH(e):null,cH=e=>{if(!e)return{origin:`unknown`,packageName:null};let t=sH(e);return t?{origin:`package`,packageName:t}:rF(e)?{origin:`app`,packageName:null}:{origin:`unknown`,packageName:null}},lH=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),uH=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},dH=(e,t)=>{let n=lH.has(e)||e.startsWith(`data-`)&&uH(e),r=uH(t)&&t.length<100||t.startsWith(`#`)&&uH(t.slice(1));return n&&r},fH=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},pH=e=>{let t=0;for(let n of e)t+=n.penalty;return t},mH=(e,t)=>pH(e)-pH(t),hH=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r instanceof Element&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},gH=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,_H=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,vH=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&uH(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)uH(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=hH(e,i);a!==void 0&&n.push({name:_H(i,a),penalty:10});let o=hH(e);return o!==void 0&&n.push({name:gH(i,o),penalty:50}),n},yH=(e,t=IM,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...yH(e.slice(1),a,[...n,i]))}return r},bH=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e instanceof Document?e:e.ownerDocument},xH=(e,t)=>t.querySelectorAll(fH(e)).length===1,SH=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=hH(n,e);if(t===void 0)return;r.push({name:_H(e,t),penalty:10}),n=n.parentElement}return xH(r,t)?r:void 0},CH=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new FV;if(e.tagName.toLowerCase()===`html`)return`html`;let i=bH(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(vH(s,r)),s=s.parentElement,c++,c>=3){let t=yH(o);t.sort(mH);for(let r of t){if(Date.now()-a>n){let t=SH(e,i);if(!t)throw new IV(n);return fH(t)}if(xH(r,i)){l=r;break}}}if(!l&&c<3){let e=yH(o);e.sort(mH);for(let t of e){if(Date.now()-a>n)break;if(xH(t,i)){l=t;break}}}if(!l)throw new LV;return fH(l)},wH=e=>e.ownerDocument.body??e.ownerDocument.documentElement,TH=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),EH=e=>e.length>0&&e.length<=120,DH=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},OH=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${CSS.escape(e.id)}`;if(DH(e,t))return t}for(let t of TH){let n=e.getAttribute(t);if(!n||!EH(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(DH(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(DH(e,i))return i}return null},kH=e=>{let t=[],n=wH(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${CSS.escape(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r)+1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${i})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},AH=e=>{let t=OH(e);if(t)return t;try{let t=CH(e,wH(e),200,(e,t)=>dH(e,t)||TH.has(e)&&EH(t));if(t)return t}catch{}return kH(e)},jH=e=>{if(!e)return!1;let t=`/${FF(e)}/`.toLowerCase();return NM.some(e=>t.includes(e))},MH=e=>e.map(e=>`\n in ${e}`).join(``),NH=[`about://React/`,`rsc://React/`],PH=e=>NH.some(t=>e.startsWith(t)),FH=e=>{for(let t of NH){if(!e.startsWith(t))continue;let n=e.indexOf(`/`,t.length);if(n===-1)continue;let r=n+1,i=e.lastIndexOf(`?`);return BV(i>r?e.slice(r,i):e.slice(r))}return e},IH=e=>{if(typeof e!=`object`||!e||!(`status`in e)||e.status!==`fulfilled`||!(`value`in e)||typeof e.value!=`object`||e.value===null||!(`originalStackFrame`in e.value))return null;let t=e.value.originalStackFrame;return typeof t!=`object`||!t||!(`file`in t)||typeof t.file!=`string`||!t.file||`ignored`in t&&t.ignored?null:{file:t.file,line1:`line1`in t&&typeof t.line1==`number`?t.line1:null,column1:`column1`in t&&typeof t.column1==`number`?t.column1:null}},LH=async(e,t)=>{let n=[],r=[];for(let t=0;t<e.length;t++){let i=e[t];!i.isServer||!i.fileName||(n.push(t),r.push({file:FH(i.fileName),methodName:i.functionName??`<unknown>`,line1:i.lineNumber??null,column1:i.columnNumber??null,arguments:[]}))}if(r.length===0)return e;let i=new AbortController,a=setTimeout(()=>i.abort(),PM),o=()=>i.abort();t?.aborted&&i.abort(),t?.addEventListener(`abort`,o);try{let t=await fetch(`${zF()}/__nextjs_original-stack-frames`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({frames:r,isServer:!0,isEdgeServer:!1,isAppDirectory:!0}),priority:`high`,signal:i.signal});if(!t.ok)return e;let a=await t.json();if(!Array.isArray(a))return e;let o=[...e];for(let t=0;t<n.length;t++){let r=IH(a[t]);if(!r)continue;let i=n[t];o[i]={...e[i],fileName:r.file,lineNumber:r.line1??void 0,columnNumber:r.column1??void 0,isSymbolicated:!0}}return o}catch{return e}finally{clearTimeout(a),t?.removeEventListener(`abort`,o)}},RH=e=>{let t=new Map;return fM(e,e=>{if(!FP(e))return!1;let n=WP(e._debugStack.stack);if(!n)return!1;for(let e of dP(n))!e.functionName||!e.fileName||PH(e.fileName)&&(t.has(e.functionName)||t.set(e.functionName,{...e,isServer:!0}));return!1},!0),t},zH=(e,t)=>{if(!t.some(e=>e.isServer&&!e.fileName&&e.functionName))return t;let n=RH(e);return n.size===0?t:t.map(e=>{if(!e.isServer||e.fileName||!e.functionName)return e;let t=n.get(e.functionName);return t?{...e,fileName:t.fileName,lineNumber:t.lineNumber,columnNumber:t.columnNumber}:e})},BH=0,VH=[],HH=()=>BH<3?(BH+=1,Promise.resolve()):new Promise(e=>{VH.push(e)}),UH=()=>{let e=VH.shift();if(e){e();return}--BH},WH=async(e,t,n=FM)=>{await HH();let r=new AbortController,i,a=new Promise(e=>{i=setTimeout(()=>{r.abort(),e(t)},n)}),o=e(r.signal);o.catch(()=>{});try{return await Promise.race([o,a])}finally{clearTimeout(i),UH()}},GH=(e,t)=>e.length>t?`${e.slice(0,t)}...`:e,KH=e=>e.startsWith(`data-react-grab-`),qH=e=>e.replace(/\s+/g,` `).trim(),JH=e=>{let t=[];for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE)continue;let e=qH(n.textContent??``);e&&t.push(e)}return t.join(` `)},YH=e=>e.getAttribute(`aria-hidden`)===`true`||e.hasAttribute(`hidden`)?!0:ZM.has(e.tagName.toLowerCase()),XH=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=qH(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!(e instanceof Element)||YH(e))return n;for(let r of e.childNodes)if(n=XH(r,t,n),n<=0)break;return n},ZH=(e,t)=>{if(YH(e))return``;let n=JH(e);if(!XM.has(t)||n&&e.children.length===0)return n;let r=[];return XH(e,r,100),r.join(` `)},QH=e=>GH(e,15),$H=e=>{let t=[];for(let n of JM){let r=e.getAttribute(n);r&&t.push(`${n}="${r}"`)}return t.length>0?` ${t.join(` `)}`:``},eU=e=>e===`class`||e===`className`||e===`style`,tU=e=>{let t=[],n=[],r=``;for(let{name:i,value:a}of e.attributes)if(!KH(i)){if(eU(i)){i!==`style`&&a&&(r=` class="${QH(a)}"`);continue}YM.has(i)?t.push(a?` ${i}="${a}"`:` ${i}`):a&&n.push(` ${i}="${QH(a)}"`)}return t.join(``)+n.join(``)+r},nU=e=>e.length===0?``:e.length<=2?e.map(e=>`<${TN(e)} ...>`).join(`
|
|
210
|
+
`):`(${e.length} elements)`,rU=e=>{let t=TN(e);if(!(e instanceof HTMLElement))return`<${t}${$H(e)} />`;let n=tU(e),r=GH(ZH(e,t),100);return r?`<${t}${n}>${r}</${t}>`:`<${t}${n} />`},iU=e=>{let t=TN(e),n=tU(e),r=ZH(e,t),i=[],a=[],o=!1;for(let t of e.childNodes)t.nodeType!==Node.COMMENT_NODE&&(t.nodeType===Node.TEXT_NODE?t.textContent&&t.textContent.trim().length>0&&(o=!0):t instanceof Element&&(o?a.push(t):i.push(t)));let s=r.length>0&&XM.has(t),c=``,l=nU(i);l&&!s&&(c+=`\n ${l}`),r&&(c+=`\n ${GH(r,100)}`);let u=nU(a);return u&&!s&&(c+=`\n ${u}`),c.length>0?`<${t}${n}>${c}\n</${t}>`:`<${t}${n} />`},aU=new Set([`_`,`$`,`motion.`,`styled.`,`chakra.`,`ark.`,`Primitive.`,`Slot.`]),oU=new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),sU=new Set([`Suspense`,`Fragment`,`StrictMode`,`Profiler`,`SuspenseList`]),cU=new Set([`MotionDOMComponent`]),lU=e=>{if(oU.has(e)||sU.has(e)||cU.has(e))return!0;for(let t of aU)if(e.startsWith(t))return!0;return!1},uU=e=>!(!e||lU(e)||e===`SlotClone`||e===`Slot`),dU=e=>!(e.length<=1||lU(e)||e[0]!==e[0].toUpperCase()||e.endsWith(`Provider`)||e.endsWith(`Context`)),fU=e=>e&&dU(e)?e:null,pU=e=>{if(!QN())return e;let t=e;for(;t;){if($N(t))return t;t=t.parentElement}return e},mU=e=>{if(!QN())return null;let t=$N(pU(e)),n=0;for(;t;){if(t.key)return t.key;if(qN(t)&&(n+=1,n===2))break;t=t.return}return null},hU=new WeakMap,gU=new WeakMap,_U=e=>t=>fetch(t,{signal:e,priority:`high`}),vU=e=>WH(async t=>{try{let n=$N(e);if(!n)return null;let r=await XP(n,!0,_U(t));return LF()?await LH(zH(n,r),t):r}catch{return null}},null),yU=e=>{if(!QN())return Promise.resolve([]);let t=pU(e),n=hU.get(t);if(n)return n;let r=vU(t).then(e=>(e===null&&hU.delete(t),e));return hU.set(t,r),r},bU=async e=>{if(!QN())return null;let t=await yU(e);if(!t)return null;for(let e of t){let t=fU(e.functionName);if(t)return t}return null},xU=e=>e.find(e=>!!fU(e.functionName))??e[0]??null,SU=e=>!e||!qN(e)?null:fU(ZN(e.type)),CU=e=>WH(async t=>{let n=$N(pU(e));if(!n)return null;try{let e=await QP(n,!0,_U(t));return e?.fileName?{filePath:FF(e.fileName),lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:fU(e.functionName)??SU(n._debugOwner),origin:cH(e.fileName).origin}:null}catch{return null}},null),wU=e=>{let t=pU(e),n=gU.get(t);if(n)return n;let r=CU(t).then(e=>(e||gU.delete(t),e));return gU.set(t,r),r},TU=[`app`,`package`],EU=(e,t)=>{for(let n of TU){if(e?.origin===n)return e;let r=xU(t.filter(e=>cH(e.fileName).origin===n));if(r?.fileName)return{filePath:FF(r.fileName),lineNumber:r.lineNumber??null,columnNumber:r.columnNumber??null,componentName:fU(r.functionName),origin:n}}return null},DU=async e=>{let t=await wU(e);return t?.origin===`app`?t:EU(t,await yU(e)??[])},OU=e=>kU(pU(e),1)[0]??null,kU=(e,t,n=()=>!0)=>{if(!QN())return[];let r=$N(e);if(!r)return[];let i=[];return fM(r,e=>{if(i.length>=t)return!0;if(qN(e)){let t=ZN(e.type);t&&uU(t)&&n(t)&&i.push(t)}return!1},!0),i},AU=[`/src/app/`,`/src/pages/`,`/app/`,`/pages/`],jU=(e,t)=>{let n=FF(e);if(!t||!n.startsWith(`/`))return n;for(let e of AU){let t=n.indexOf(e);if(t!==-1)return`/./${n.slice(t+1)}`}return n},MU=(e,t)=>{let n=jU(e.filePath,t),r=t&&e.lineNumber?`${n}:${e.lineNumber}${e.columnNumber?`:${e.columnNumber}`:``}`:n;return e.componentName?`\n in ${e.componentName} (at ${r})`:`\n in ${r}`},NU={isAppSource:!1,consumesBudget:!1},PU=(e,t,n,r)=>{let i=t.packageName,a=t.origin===`app`?e.fileName:null;if(e.isServer&&!a&&(n||!e.functionName)){let e=i?`${i} at Server`:`at Server`;return{text:`\n in ${n??`<anonymous>`} (${e})`,...NU}}return!a&&n?{text:i?`\n in ${n} (${i})`:`\n in ${n}`,...NU}:i?{text:`\n in ${i}`,...NU}:a?{text:MU({componentName:n,filePath:a,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null},r),isAppSource:!0,consumesBudget:!jH(a)}:null},FU=(e,t={},n=null)=>{let r=zV(t.maxLines),i=Math.max(r,20),a=LF(),o=[],s=new Set,c=null,l=!1,u=!1,d=!1,f=0,p=e=>{e&&s.add(e)};n&&(u=n.origin===`app`,jH(n.filePath)||(f+=1),p(n.componentName),o.push(MU(n,a)));for(let t of e){if(f>=r||o.length>=i)break;let e=cH(t.fileName),s=fU(t.functionName),m=e.packageName?`${e.packageName}:${s??``}:${t.isServer?`server`:`client`}`:null;if(m&&m===c)continue;if(!l&&s&&s===n?.componentName){l=!0;continue}let h=PU(t,e,s,a);h!==null&&h.text!==o[o.length-1]&&(h.isAppSource&&(u=!0),h.consumesBudget&&(f+=1,d=!0),p(s),o.push(h.text),c=m)}return{text:o.join(``),shouldAppendSelectorHint:!u,hasBudgetedStackFrame:d,renderedComponentNames:s}},IU=async e=>{let t=await wU(e);return t?.origin===`app`?t:null},LU=(e,t,n)=>{let r=kU(pU(e),n,e=>dU(e)&&!t.renderedComponentNames.has(e));return r.length===0?t:{...t,text:`${t.text}${MH(r)}`}},RU=async(e,t={})=>{let n=await IU(e),r=await yU(e),i=zV(t.maxLines),a=FU(r??[],t,n);if(a.text)return a.hasBudgetedStackFrame?a:LU(e,a,i);let o=kU(pU(e),i);return{text:MH(o),shouldAppendSelectorHint:!0,hasBudgetedStackFrame:!1,renderedComponentNames:new Set(o)}},zU=async(e,t={})=>(await RU(e,t)).text,BU=(e,t)=>{let n=mU(e),r=n===null?``:`\n key: "${n}"`,i=t.shouldAppendSelectorHint?`\n selector: ${AH(e)}`:``;return`${t.text}${r}${i}`},VU=async(e,t={})=>{let n=await RU(e,t);return`${rU(e)}${BU(e,n).replace(/\n\s+/g,` `)}`},HU=async(e,t={})=>{let n=pU(e);return`${iU(n)}${BU(n,await RU(n,t))}`},UU=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),WU=(e,t)=>{let n=t?.componentName??`div`,r={version:OM,content:e,entries:t?.entries??[{tagName:t?.tagName,componentName:n,content:e,commentText:t?.commentText}],timestamp:Date.now()},i=t=>{t.preventDefault(),t.clipboardData?.setData(`text/plain`,e),t.clipboardData?.setData(`text/html`,`<meta charset='utf-8'><pre><code>${UU(e)}</code></pre>`),t.clipboardData?.setData(`application/x-react-grab`,JSON.stringify(r))};document.addEventListener(`copy`,i);let a=document.createElement(`textarea`);a.value=e,a.style.position=`fixed`,a.style.left=`-9999px`,a.ariaHidden=`true`,document.body.appendChild(a),a.select();try{return typeof document.execCommand==`function`&&document.execCommand(`copy`)}finally{document.removeEventListener(`copy`,i),a.remove()}}})),KU=r({ReactGrabRenderer:()=>pJ}),qU,JU,YU,XU,ZU,QU,$U,eW,tW,nW,rW,iW,aW,oW,sW,cW,lW,uW,dW,fW,pW,mW,hW,gW,_W,vW,yW,bW,xW,SW,CW,wW,TW,EW,DW,OW,kW,AW,jW,MW,NW,PW,FW,IW,LW,RW,zW,BW,VW,HW,UW,WW,GW,KW,qW,JW,YW,XW,ZW,QW,$W,eG,tG,nG,rG,iG,aG,oG,sG,cG,lG,uG,dG,fG,pG,mG,hG,gG,_G,vG,yG,bG,xG,SG,CG,wG,TG,EG,DG,OG,kG,AG,jG,MG,NG,PG,FG,IG,LG,RG,zG,BG,VG,HG,UG,WG,GG,KG,qG,JG,YG,XG,ZG,QG,$G,eK,tK,nK,rK,iK,aK,oK,sK,cK,lK,uK,dK,fK,pK,mK,hK,gK,_K,vK,yK,bK,xK,SK,CK,wK,TK,EK,DK,OK,kK,AK,jK,MK,NK,PK,FK,IK,LK,RK,zK,BK,VK,HK,UK,WK,GK,KK,qK,JK,YK,XK,ZK,QK,$K,eq,tq,nq,rq,iq,aq,oq,sq,cq,lq,uq,dq,fq,pq,mq,hq,gq,_q,vq,yq,bq,xq,Sq,Cq,wq,Tq,Eq,Dq,Oq,kq,Aq,jq,Mq,Nq,Pq,Fq,Iq,Lq,Rq,zq,Bq,Vq,Hq,Uq,Wq,Gq,Kq,qq,Jq,Yq,Xq,Zq,Qq,$q,eJ,tJ,nJ,rJ,iJ,aJ,oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ=t((()=>{NV(),eR(),qU=(e,t,n)=>e+(t-e)*n,JU=(e,t)=>{let n=Math.max(t,1);return 1-(1-e)**(n/BM)},YU=Z(`<canvas data-react-grab-overlay-canvas style=position:fixed;top:0;left:0;pointer-events:none>`),XU={borderColor:WM,fillColor:GM,lerpFactor:jM},ZU={drag:{borderColor:HM,fillColor:UM,lerpFactor:zM},selection:XU,grabbed:XU},QU=e=>{let t,n=null,r=0,i=0,a=1,o=null,s=null,c={drag:{canvas:null,context:null},selection:{canvas:null,context:null},grabbed:{canvas:null,context:null}},l=[],u=null,d=[],f=yM()?`display-p3`:`srgb`,p=(e,t,n)=>{let r=new OffscreenCanvas(e*n,t*n),i=r.getContext(`2d`,{colorSpace:f});return i&&i.scale(n,n),{canvas:r,context:i}},m=()=>{if(t){a=Math.max(window.devicePixelRatio||1,2),r=window.innerWidth,i=window.innerHeight,t.width=r*a,t.height=i*a,t.style.width=`${r}px`,t.style.height=`${i}px`,n=t.getContext(`2d`,{colorSpace:f}),n&&n.scale(a,a);for(let e of Object.keys(c))c[e]=p(r,i,a)}},h=e=>{if(!e)return 0;let t=e.match(/^(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):0},g=(e,t,n)=>({id:e,current:{x:t.x,y:t.y,width:t.width,height:t.height},target:{x:t.x,y:t.y,width:t.width,height:t.height},borderRadius:h(t.borderRadius),opacity:n?.opacity??1,targetOpacity:n?.targetOpacity??n?.opacity??1,createdAt:n?.createdAt,fadeStartTimestamp:null,isInitialized:!0}),_=(e,t,n)=>{let r=e.target;r.x=t.x,r.y=t.y,r.width=t.width,r.height=t.height,e.borderRadius=h(t.borderRadius),n!==void 0&&(e.targetOpacity=n)},v=e=>e.boundsMultiple??[e.bounds],y=(e,t,n,r,i,a,o,s,c=1)=>{if(r<=0||i<=0)return;let l=Math.min(r/2,i/2),u=Math.min(a,l),d=c!==1;d&&(e.globalAlpha=c),e.beginPath(),u>0?e.roundRect(t,n,r,i,u):e.rect(t,n,r,i),e.fillStyle=o,e.fill(),e.strokeStyle=s,e.lineWidth=1,e.stroke(),d&&(e.globalAlpha=1)},b=()=>{let t=c.drag;if(!t.context)return;let n=t.context;if(n.clearRect(0,0,r,i),!e.dragVisible||!u)return;let a=ZU.drag;y(n,u.current.x,u.current.y,u.current.width,u.current.height,u.borderRadius,a.fillColor,a.borderColor)},x=()=>{let t=c.selection;if(!t.context)return;let n=t.context;if(n.clearRect(0,0,r,i),!e.selectionVisible)return;let a=ZU.selection;for(let e of l)y(n,e.current.x,e.current.y,e.current.width,e.current.height,e.borderRadius,a.fillColor,a.borderColor,e.opacity)},S=(e,t)=>{let n=c[e];if(!n.context)return;let a=n.context;a.clearRect(0,0,r,i);let o=ZU[e];for(let e of t)y(a,e.current.x,e.current.y,e.current.width,e.current.height,e.borderRadius,o.fillColor,o.borderColor,e.opacity)},C=()=>{if(!(!n||!t)&&!(r<=0||i<=0)){n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.setTransform(a,0,0,a,0,0),b(),x(),S(`grabbed`,d);for(let e of[`drag`,`selection`,`grabbed`]){let t=c[e];t.canvas&&n.drawImage(t.canvas,0,0,r,i)}}},w=(e,t,n)=>{let r=qU(e.current.x,e.target.x,t),i=qU(e.current.y,e.target.y,t),a=qU(e.current.width,e.target.width,t),o=qU(e.current.height,e.target.height,t),s=Math.abs(r-e.target.x)<.5&&Math.abs(i-e.target.y)<.5&&Math.abs(a-e.target.width)<.5&&Math.abs(o-e.target.height)<.5;e.current.x=s?e.target.x:r,e.current.y=s?e.target.y:i,e.current.width=s?e.target.width:a,e.current.height=s?e.target.height:o;let c=!0;if(n?.interpolateOpacity){let n=qU(e.opacity,e.targetOpacity,t);c=Math.abs(n-e.targetOpacity)<VM,e.opacity=c?e.targetOpacity:n}return!s||!c},T=()=>{let e=performance.now(),t=s===null?BM:e-s;s=e;let n=JU(ZU.drag.lerpFactor,t),r=JU(ZU.selection.lerpFactor,t),i=JU(ZU.grabbed.lerpFactor,t),a=!1;u?.isInitialized&&w(u,n)&&(a=!0);for(let e of l)e.isInitialized&&w(e,r)&&(a=!0);let c=Date.now();d=d.filter(t=>{let n=t.id.startsWith(`label-`);if(t.isInitialized&&w(t,i)&&(a=!0),n&&t.targetOpacity===0){t.fadeStartTimestamp===null&&(t.fadeStartTimestamp=e);let n=e-t.fadeStartTimestamp,r=Math.min(1,n/125),i=1-(1-r)*(1-r);return t.opacity=Math.max(0,1-i),r>=1?!1:(a=!0,!0)}else n&&(t.fadeStartTimestamp=null);if(t.createdAt){let e=c-t.createdAt;if(e>=1625)return!1;if(e>1500){let n=Math.min(1,(e-MM)/125);t.opacity=1-(1-(1-n)*(1-n)),a=!0}return!0}return n?!0:t.opacity>0}),C(),a?o=UF(T):(o=null,s=null)},E=()=>{o===null&&(o=UF(T))},D=()=>{m(),E()};return oR(dR(()=>[e.selectionVisible,e.selectionBounds,e.selectionBoundsMultiple,e.selectionShouldSnap],([e,t,n,r])=>{if(!e||!t&&(!n||n.length===0)){l=[],E();return}let i;i=n&&n.length>0?n:t?[t]:[];let a=new Map;for(let e of l)a.set(e.id,e);l=i.map((e,t)=>{let n=`selection-${t}`,i=a.get(n);return i?(_(i,e),r&&(i.current.x=i.target.x,i.current.y=i.target.y,i.current.width=i.target.width,i.current.height=i.target.height),i):g(n,e)}),E()})),oR(dR(()=>[e.dragVisible,e.dragBounds],([e,t])=>{if(!e||!t){u=null,E();return}u?_(u,t):u=g(`drag`,t),E()})),oR(dR(()=>[e.grabbedBoxes,e.labelInstances],([e,t])=>{let n=e??[],r=t??[],i=new Map;for(let e of n)i.set(e.id,e);let a=new Map;for(let e of d)a.set(e.id,e);for(let e of n)if(!a.has(e.id)){let t=g(e.id,e.bounds,{createdAt:e.createdAt});d.push(t),a.set(e.id,t)}for(let e of d){let t=i.get(e.id);t&&_(e,t.bounds)}let o=new Set;for(let e of r){let t=v(e),n=e.status===`fading`?0:1;for(let r=0;r<t.length;r++){let i=t[r],s=`label-${e.id}-${r}`;o.add(s);let c=a.get(s);if(c)_(c,i,n);else{let e=g(s,i,{opacity:1,targetOpacity:n});d.push(e),a.set(s,e)}}}d=d.filter(e=>e.id.startsWith(`label-`)?o.has(e.id):i.has(e.id)),E()})),fR(()=>{m(),E(),window.addEventListener(`resize`,D);let e=null,t=()=>{Math.max(window.devicePixelRatio||1,2)!==a&&(D(),n())},n=()=>{e&&e.removeEventListener(`change`,t),e=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),e.addEventListener(`change`,t)};n(),pR(()=>{window.removeEventListener(`resize`,D),e&&e.removeEventListener(`change`,t),o!==null&&WF(o)})}),(()=>{var e=YU(),n=t;return typeof n==`function`?cz(n,e):t=e,aR(t=>oz(e,`z-index`,String(RM))),e})()},$U=Z(`<div style=position:fixed;pointer-events:none;will-change:opacity;contain:strict;transform:translateZ(0)>`),eW=e=>{let t=wM(),n=t?getComputedStyle(t).borderRadius:`0px`,r=()=>t?.getBoundingClientRect()??null,[i,a]=J(r());if(t){let n=()=>a(r());fR(()=>{let e=new ResizeObserver(n);e.observe(t),window.addEventListener(`scroll`,n,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),pR(()=>{e.disconnect(),window.removeEventListener(`scroll`,n,{capture:!0}),window.removeEventListener(`resize`,n)})}),oR(()=>{e.visible&&n()})}let o=()=>{let e=i();return e?`${e.top}px`:`0`},s=()=>{let e=i();return e?`${e.left}px`:`0`},c=()=>{let e=i();return e?`${e.width}px`:`100%`},l=()=>{let e=i();return e?`${e.height}px`:`100%`};return(()=>{var t=$U();return oz(t,`border-radius`,n),oz(t,`z-index`,RM),oz(t,`transition`,`opacity 125ms ease-out`),oz(t,`box-shadow`,`inset 0 0 50px ${KM}`),aR(n=>{var r=o(),i=s(),a=c(),u=l(),d=+!!e.visible;return r!==n.e&&oz(t,`top`,n.e=r),i!==n.t&&oz(t,`left`,n.t=i),a!==n.a&&oz(t,`width`,n.a=a),u!==n.o&&oz(t,`height`,n.o=u),d!==n.i&&oz(t,`opacity`,n.i=d),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})()},tW=(e,t)=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,t)}px`},nW=(e,t)=>{e&&e.focus(t)},rW=e=>{if(e<=0)return 8;let t=e*qM;return Math.round(Math.max(4,Math.min(8,t)))},iW=()=>{let e=wM();if(e){let t=e.getBoundingClientRect();return{width:t.width,height:t.height,offsetLeft:t.left,offsetTop:t.top}}let t=window.visualViewport;return t?{width:t.width,height:t.height,offsetLeft:t.offsetLeft,offsetTop:t.offsetTop}:{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0}},aW=e=>{if(typeof e==`string`||typeof e==`number`)return String(e);if(!e||typeof e!=`object`)return``;if(Array.isArray(e)){let t=``;for(let n of e){if(!n)continue;let e=aW(n);e&&(t=t?`${t} ${e}`:e)}return t}let t=``;for(let n in e)e[n]&&(t=t?`${t} ${n}`:n);return t},oW=(...e)=>{let t=``;for(let n of e){if(!n)continue;let e=aW(n);e&&(t=t?`${t} ${e}`:e)}return t},sW=e=>e.elementsCount&&e.elementsCount>1?{tagName:`${e.elementsCount} elements`,componentName:void 0}:{tagName:e.tagName||e.componentName||`element`,componentName:e.tagName?e.componentName:void 0},cW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M19.2929 12.7071C19.6834 13.0976 20.3166 13.0976 20.7071 12.7071C21.0976 12.3166 21.0976 11.6834 20.7071 11.2929L12.7071 3.29289C12.5196 3.10536 12.2652 3 12 3C11.7348 3 11.4804 3.10536 11.2929 3.29289L3.29289 11.2929C2.90237 11.6834 2.90237 12.3166 3.29289 12.7071C3.68342 13.0976 4.31658 13.0976 4.70711 12.7071L11 6.41421L11 20C11 20.5523 11.4477 21 12 21C12.5523 21 13 20.5523 13 20L13 6.41422L19.2929 12.7071Z">`),lW=e=>{let t=()=>e.size??10;return(()=>{var n=cW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},uW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path class=icon-loader-bar d="M12 2v4"style=animation-delay:0ms></path><path class=icon-loader-bar d="M15 6.8l2-3.5"style=animation-delay:-42ms></path><path class=icon-loader-bar d="M17.2 9l3.5-2"style=animation-delay:-83ms></path><path class=icon-loader-bar d="M18 12h4"style=animation-delay:-125ms></path><path class=icon-loader-bar d="M17.2 15l3.5 2"style=animation-delay:-167ms></path><path class=icon-loader-bar d="M15 17.2l2 3.5"style=animation-delay:-208ms></path><path class=icon-loader-bar d="M12 18v4"style=animation-delay:-250ms></path><path class=icon-loader-bar d="M9 17.2l-2 3.5"style=animation-delay:-292ms></path><path class=icon-loader-bar d="M6.8 15l-3.5 2"style=animation-delay:-333ms></path><path class=icon-loader-bar d="M2 12h4"style=animation-delay:-375ms></path><path class=icon-loader-bar d="M6.8 9l-3.5-2"style=animation-delay:-417ms></path><path class=icon-loader-bar d="M9 6.8l-2-3.5"style=animation-delay:-458ms>`),dW=e=>{let t=()=>e.size??16;return(()=>{var n=uW();return n.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling,aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},fW=Z(`<svg data-react-grab-arrow class="absolute block z-10"><path>`),pW=e=>{let t=()=>e.color??`var(--rg-panel-bg)`,n=()=>e.position===`bottom`,r=()=>rW(e.labelWidth??0),i=()=>r()*2,a=()=>r(),o=()=>{let e=i(),t=a(),r=1*Math.SQRT1_2,o=e/2,s=n()?t:0,c=n()?r:t-r,l=+!!n();return`M0 ${s} L${o-r} ${c} A1 1 0 0 ${l} ${o+r} ${c} L${e} ${s} Z`};return(()=>{var r=fW(),s=r.firstChild;return aR(c=>{var l=i(),u=a(),d=`0 0 ${i()} ${a()}`,f=`calc(${e.leftPercent}% + ${e.leftOffsetPx}px)`,p=n()?`0`:void 0,m=n()?void 0:`0`,h=n()?`translateX(-50%) translateY(calc(-100% + 1px))`:`translateX(-50%) translateY(calc(100% - 1px))`,g=o(),_=t();return l!==c.e&&Q(r,`width`,c.e=l),u!==c.t&&Q(r,`height`,c.t=u),d!==c.a&&Q(r,`viewBox`,c.a=d),f!==c.o&&oz(r,`left`,c.o=f),p!==c.i&&oz(r,`top`,c.i=p),m!==c.n&&oz(r,`bottom`,c.n=m),h!==c.s&&oz(r,`transform`,c.s=h),g!==c.h&&Q(s,`d`,c.h=g),_!==c.r&&Q(s,`fill`,c.r=_),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),r})()},mW=Z(`<span class=text-[var(--rg-text-primary)]>`),hW=Z(`<span class=text-[var(--rg-text-secondary)]>.`),gW=Z(`<span class="text-[13px] leading-4 h-fit font-medium overflow-hidden text-ellipsis whitespace-nowrap min-w-0">`),_W=Z(`<button type=button>`),vW=Z(`<div>`),yW=e=>{let t=()=>{e.onHoverChange?.(!0)},n=()=>{e.onHoverChange?.(!1)},r=()=>e.componentName?`${e.componentName}.${e.tagName}`:e.tagName,i=()=>(()=>{var t=gW();return $(t,X(qR,{get when(){return e.componentName},get children(){return[(()=>{var t=mW();return $(t,()=>e.componentName),t})(),(()=>{var t=hW();return t.firstChild,$(t,()=>e.tagName,null),t})()]}}),null),$(t,X(qR,{get when(){return!e.componentName},get children(){var t=mW();return $(t,()=>e.tagName),t}}),null),t})();return X(qR,{get when(){return e.isClickable},get fallback(){return(()=>{var r=vW();return rz(r,`click`,e.onClick,!0),r.addEventListener(`mouseleave`,n),r.addEventListener(`mouseenter`,t),$(r,i),aR(()=>nz(r,oW(`contain-layout flex items-center gap-1 max-w-[280px] overflow-hidden`,e.shrink&&`shrink-0`))),r})()},get children(){var a=_W();return rz(a,`click`,e.onClick,!0),a.addEventListener(`mouseleave`,n),a.addEventListener(`mouseenter`,t),$(a,i),aR(t=>{var n=`Open source for ${r()}`,i=oW(`contain-layout flex items-center gap-1 max-w-[280px] overflow-hidden cursor-pointer bg-transparent border-none p-0 m-0 text-left`,e.shrink&&`shrink-0`);return n!==t.e&&Q(a,`aria-label`,t.e=n),i!==t.t&&nz(a,t.t=i),t},{e:void 0,t:void 0}),a}})},$R([`click`]),bW=Z(`<div class="[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start px-2 py-1.5 w-auto h-fit self-stretch [border-top-width:0.5px] border-t-solid border-t-[var(--rg-border-subtle)] antialiased rounded-t-none rounded-b-[6px]">`),xW=e=>(()=>{var t=bW();return $(t,()=>e.children),t})(),SW=(e,t={})=>(n={})=>{let r=t.variants;if(!r)return e;let i=[e];for(let e in r){let a=n[e]??t.defaultVariants?.[e];if(a===void 0)continue;let o=r[e][String(a)];o&&i.push(o)}return oW(...i)},CW=Z(`<div>`),wW=SW(`contain-layout antialiased [font-synthesis:none] bg-[var(--rg-panel-bg)]`,{variants:{shape:{panel:`rounded-[14px] [corner-shape:superellipse(1.25)]`,pill:`rounded-full`}},defaultVariants:{shape:`panel`}}),TW=e=>{let[t,n]=WR(e,[`shape`,`class`]);return(()=>{var e=CW();return sz(e,UR({get class(){return oW(wW({shape:t.shape}),t.class)}},n),!1,!1),e})()},EW=null,DW={claim:e=>{EW=e},release:e=>{EW===e&&(EW=null)},isActive:e=>EW===e},OW=e=>{let t=Symbol(),n=EM(n=>{DW.isActive(t)&&(Zz(n)||(n.code===`Enter`?e.onEnter?.(n):n.code===`Escape`&&e.onEscape?.(n)))});return fR(()=>{DW.claim(t),window.addEventListener(`keydown`,n,{capture:!0})}),pR(()=>{DW.release(t),window.removeEventListener(`keydown`,n,{capture:!0})}),{claimFocus:()=>DW.claim(t)}},kW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M10.7071 21.2071C10.3166 21.5976 9.68342 21.5976 9.29289 21.2071L3.29289 15.2071C2.90237 14.8166 2.90237 14.1834 3.29289 13.7929L9.29289 7.79289C9.68342 7.40237 10.3166 7.40237 10.7071 7.79289C11.0976 8.18342 11.0976 8.81658 10.7071 9.20711L6.41421 13.5H16C16.5523 13.5 17 13.0523 17 12.5V3.5C17 2.94772 17.4477 2.5 18 2.5C18.5523 2.5 19 2.94772 19 3.5V12.5C19 14.1569 17.6569 15.5 16 15.5H6.41421L10.7071 19.7929C11.0976 20.1834 11.0976 20.8166 10.7071 21.2071Z">`),AW=e=>{let t=()=>e.size??10;return(()=>{var n=kW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},jW=Z(`<button>`),MW=SW(`contain-layout shrink-0 flex items-center justify-center cursor-pointer transition-all press-scale`,{variants:{variant:{chip:`px-[3px] py-px h-[17px] rounded-sm bg-[var(--rg-surface-hover)] [border-width:0.5px] border-solid border-[var(--rg-border-button)] hover:bg-[var(--rg-surface-active)] text-[var(--rg-text-primary)]`,destructive:`px-[3px] py-px h-[17px] rounded-sm bg-[var(--rg-error-bg)] hover:bg-[var(--rg-error-bg-hover)] text-[var(--rg-error-text)]`,ghost:`rounded-sm bg-transparent hover:bg-[var(--rg-surface-hover)] border-none outline-none p-0`}},defaultVariants:{variant:`chip`}}),NW=e=>{let[t,n]=WR(e,[`variant`,`class`,`type`]);return(()=>{var e=jW();return sz(e,UR({get type(){return t.type??`button`},get class(){return oW(MW({variant:t.variant}),t.class)}},n),!1,!1),e})()},PW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),FW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),IW=Z(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),LW=Z(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),RW=Z(`<div data-react-grab-discard-prompt class="contain-layout shrink-0 flex flex-col justify-center items-end w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 shrink-0 font-sans font-medium w-fit h-fit">`),zW=e=>{let t=()=>e.showCancel??!0,{claimFocus:n}=OW({onEnter:t=>{t.preventDefault(),t.stopPropagation();let n=t.composedPath()[0],r=n instanceof HTMLElement?n:null;if(r?.closest(`[data-react-grab-discard-copy]`)){e.onCopy?.();return}if(r?.closest(`[data-react-grab-discard-no]`)){e.onCancel?.();return}if(r?.closest(`[data-react-grab-discard-yes]`)){e.onConfirm?.();return}e.onConfirm?.()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.cancelOnEscape?e.onCancel?.():e.onConfirm?.()}});return(()=>{var r=RW(),i=r.firstChild.firstChild;return rz(r,`click`,n,!0),rz(r,`pointerdown`,n,!0),$(i,()=>e.label??`Discard?`),$(r,X(xW,{get children(){var n=LW();return $(n,X(qR,{get when(){return t()},get children(){return X(NW,{"data-react-grab-discard-no":!0,get onClick(){return e.onCancel},get children(){return PW()}})}}),null),$(n,X(qR,{get when(){return e.onCopy},get children(){return X(NW,{"data-react-grab-discard-copy":!0,get onClick(){return e.onCopy},get children(){return FW()}})}}),null),$(n,X(NW,{variant:`destructive`,class:`gap-0.5`,"data-react-grab-discard-yes":!0,get onClick(){return e.onConfirm},get children(){return[IW(),X(AW,{size:10,class:`text-[var(--rg-error-text)] opacity-50`})]}}),null),n}}),null),r})()},$R([`pointerdown`,`click`]),BW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M7 2C4.23858 2 2 4.23858 2 7V15C2 17.7614 4.23858 20 7 20H8C8.55228 20 9 19.5523 9 19C9 18.4477 8.55228 18 8 18H7C5.34315 18 4 16.6569 4 15V7C4 5.34315 5.34315 4 7 4H17C18.6569 4 20 5.34315 20 7V15C20 16.6569 18.6569 18 17 18H14.4142L16.2071 16.2071C16.5976 15.8166 16.5976 15.1834 16.2071 14.7929C15.8166 14.4024 15.1834 14.4024 14.7929 14.7929L11.2929 18.2929C11.197 18.3888 11.1247 18.4993 11.0759 18.6172C11.027 18.7351 11 18.8644 11 19C11 19.2728 11.1093 19.5201 11.2864 19.7005C11.2889 19.7031 11.2914 19.7056 11.2939 19.7081L14.7929 23.2071C15.1834 23.5976 15.8166 23.5976 16.2071 23.2071C16.5976 22.8166 16.5976 22.1834 16.2071 21.7929L14.4142 20H17C19.7614 20 22 17.7614 22 15V7C22 4.23858 19.7614 2 17 2H7Z">`),VW=e=>{let t=()=>e.size??12;return(()=>{var n=BW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},HW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Retry`),UW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Ok`),WW=Z(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),GW=Z(`<div data-react-grab-error role=alert aria-live=assertive class="contain-layout shrink-0 flex flex-col justify-center items-end w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-start gap-1 px-2 w-full h-fit"><span class="text-[var(--rg-error-text)] text-[13px] leading-4 font-sans font-medium overflow-hidden line-clamp-5">`),KW=e=>{let{claimFocus:t}=OW({onEnter:t=>{t.preventDefault(),t.stopPropagation(),e.onRetry?.()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onAcknowledge?.()}}),n=()=>!!(e.onRetry||e.onAcknowledge);return(()=>{var r=GW(),i=r.firstChild,a=i.firstChild;return rz(r,`click`,t,!0),rz(r,`pointerdown`,t,!0),$(a,()=>e.error),$(r,X(qR,{get when(){return n()},get children(){return X(xW,{get children(){var t=WW();return $(t,X(qR,{get when(){return e.onRetry},get children(){return X(NW,{"data-react-grab-retry":!0,class:`gap-1`,"aria-keyshortcuts":`Enter`,get onClick(){return e.onRetry},get children(){return[HW(),X(VW,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-text-secondary)]`})]}})}}),null),$(t,X(qR,{get when(){return e.onAcknowledge},get children(){return X(NW,{"data-react-grab-error-ok":!0,class:`gap-1`,"aria-keyshortcuts":`Escape`,get onClick(){return e.onAcknowledge},get children(){return UW()}})}}),null),t}})}}),null),aR(t=>{var r={"pt-1.5 pb-1":n(),"py-1.5":!n()},o=e.error;return t.e=iz(i,r,t.e),o!==t.t&&Q(a,`title`,t.t=o),t},{e:void 0,t:void 0}),r})()},$R([`pointerdown`,`click`]),qW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M7.5 12C7.5 13.3807 6.38071 14.5 5 14.5C3.61929 14.5 2.5 13.3807 2.5 12C2.5 10.6193 3.61929 9.5 5 9.5C6.38071 9.5 7.5 10.6193 7.5 12ZM14.5 12C14.5 13.3807 13.3807 14.5 12 14.5C10.6193 14.5 9.5 13.3807 9.5 12C9.5 10.6193 10.6193 9.5 12 9.5C13.3807 9.5 14.5 10.6193 14.5 12ZM19 14.5C20.3807 14.5 21.5 13.3807 21.5 12C21.5 10.6193 20.3807 9.5 19 9.5C17.6193 9.5 16.5 10.6193 16.5 12C16.5 13.3807 17.6193 14.5 19 14.5Z">`),JW=e=>{let t=()=>e.size??14;return(()=>{var n=qW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},YW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM17.7071 10.7071C18.0976 10.3166 18.0976 9.68342 17.7071 9.29289C17.3166 8.90237 16.6834 8.90237 16.2929 9.29289L11 14.5858L8.70711 12.2929C8.31658 11.9024 7.68342 11.9024 7.29289 12.2929C6.90237 12.6834 6.90237 13.3166 7.29289 13.7071L10.2929 16.7071C10.6834 17.0976 11.3166 17.0976 11.7071 16.7071L17.7071 10.7071Z">`),XW=e=>{let t=()=>e.size??14;return(()=>{var n=YW();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},ZW=Z(`<button data-react-grab-ignore-events data-react-grab-more-options>`),QW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Keep`),$W=Z(`<div class="contain-layout shrink-0 flex items-center justify-between gap-2 pt-1.5 pb-1 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap min-w-0"></span><div class="contain-layout shrink-0 flex items-center gap-2 h-fit">`),eG=Z(`<div class="contain-layout shrink-0 flex items-center gap-0.5 py-1.5 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap min-w-0">`),tG=e=>(()=>{var t=ZW();return rz(t,`click`,t=>{t.stopImmediatePropagation(),e.onClick()}),rz(t,`pointerdown`,e=>{e.stopImmediatePropagation()}),$(t,X(JW,{size:14,class:`opacity-50 group-hover:opacity-100 transition-opacity`})),aR(()=>nz(t,oW(MW({variant:`ghost`}),`group size-4 text-[var(--rg-text-secondary)] hover:text-[var(--rg-text-primary)]`))),t})(),nG=e=>{let t,n,[r,i]=J(!1),[a,o]=J(!1),s=()=>r()?`Copied`:e.statusText,c=()=>{t!==void 0&&window.clearTimeout(t),n!==void 0&&window.clearTimeout(n),o(!0),e.onFadingChange?.(!0),e.onShowContextMenu?.()},l=()=>{r()||(i(!0),t=window.setTimeout(()=>{o(!0),e.onFadingChange?.(!0),n=window.setTimeout(()=>{e.onDismiss?.()},125)},1375))},{claimFocus:u}=OW({onEnter:e=>{e.preventDefault(),e.stopPropagation(),l()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onDismiss?.()}});return pR(()=>{t!==void 0&&window.clearTimeout(t),n!==void 0&&window.clearTimeout(n)}),X(TW,{shape:`pill`,"data-react-grab-completion":!0,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,class:`shrink-0 flex flex-col justify-center items-end w-fit h-fit max-w-[280px] transition-opacity duration-100 ease-out`,get style(){return{opacity:+!a()}},onPointerDown:u,onClick:u,get children(){return[X(qR,{get when(){return Kz(()=>!r())()&&e.onDismiss},get children(){var t=$W(),n=t.firstChild,i=n.nextSibling;return $(n,s),$(i,X(qR,{get when(){return e.onShowContextMenu},get children(){return X(tG,{onClick:c})}}),null),$(i,X(qR,{get when(){return e.onDismiss},get children(){return X(NW,{"data-react-grab-dismiss":!0,class:`gap-1`,"aria-keyshortcuts":`Enter`,onClick:l,get disabled(){return r()},get"aria-disabled"(){return r()},get children(){return[QW(),X(qR,{get when(){return!r()},get children(){return X(AW,{size:10,class:`text-[var(--rg-text-secondary)]`})}})]}})}}),null),t}}),X(qR,{get when(){return r()||!e.onDismiss},get children(){var t=eG(),n=t.firstChild;return $(t,X(XW,{size:14,"aria-hidden":`true`,class:`text-[var(--rg-text-primary-85)] shrink-0`}),n),$(n,s),$(t,X(qR,{get when(){return e.onShowContextMenu},get children(){return X(tG,{onClick:c})}}),null),t}})]}})},rG=Z(`<div class="contain-layout shrink-0 flex flex-col justify-center items-start w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 py-1.5 px-2 w-full h-fit"><span class="shimmer-text text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap">`),iG=Z(`<div class="contain-layout shrink-0 flex flex-col items-start w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 w-fit h-fit px-2 py-1.5">`),aG=Z(`<button data-react-grab-submit type=button aria-label="Submit context"class="contain-layout shrink-0 flex items-center justify-center size-4 rounded-full bg-[var(--rg-submit-bg)] cursor-pointer ml-1 interactive-scale a11y-hitbox">`),oG=Z(`<div class="shrink-0 flex justify-between items-end w-full min-h-4"><textarea data-react-grab-ignore-events data-react-grab-input aria-label="Add context for selected element"aria-keyshortcuts="Enter Escape"class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-medium bg-transparent border-none resize-none flex-1 p-0 m-0 wrap-break-word overflow-y-auto"placeholder="Add context"rows=1 style=field-sizing:content;min-height:16px;scrollbar-width:none>`),sG=Z(`<div class="contain-layout shrink-0 flex flex-col justify-center items-start w-fit h-fit min-w-[150px] max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 w-fit h-fit px-2 max-w-full">`),cG=Z(`<div data-react-grab-ignore-events data-react-grab-selection-label>`),lG={left:wN,top:wN,arrowLeftPercent:50,arrowLeftOffset:0,edgeOffsetX:0},uG=e=>{let t,n,r,i=!1,[a,o]=J(0),[s,c]=J(0),[l,u]=J(0),[d,f]=J(0),[p,m]=J(!1),[h,g]=J(!1),_=()=>e.status!==`copying`&&e.status!==`copied`&&e.status!==`fading`&&e.status!==`error`,v=()=>e.status===`copied`||e.status===`fading`,y=()=>!!e.shouldToggleExpandOnClick&&!!e.onToggleExpand&&_()&&!e.discardPrompt&&!e.isPromptMode,b=()=>!!(e.isPromptMode||e.discardPrompt||y()||v()&&(e.onDismiss||e.onShowContextMenu)||e.status===`error`&&(e.onAcknowledgeError||e.onRetry)),x,S=e=>{i=e},C=()=>{f(e=>e+1)},w=EM(t=>{Zz(t)||t.code===`Enter`&&!e.isPromptMode&&!e.discardPrompt&&_()&&(t.preventDefault(),t.stopImmediatePropagation(),e.onToggleExpand?.())});fR(()=>{let r=wM();if(x=new ResizeObserver(e=>{for(let a of e){let e=a.target.getBoundingClientRect();a.target===t&&!i?(o(e.width),c(e.height)):a.target===n?u(e.width):a.target===r&&C()}}),r&&x.observe(r),t){let e=t.getBoundingClientRect();o(e.width),c(e.height),x.observe(t)}n&&(u(n.getBoundingClientRect().width),x.observe(n)),window.addEventListener(`scroll`,C,!0),window.addEventListener(`resize`,C),window.visualViewport?.addEventListener(`resize`,C),window.visualViewport?.addEventListener(`scroll`,C),e.onToggleExpand&&window.addEventListener(`keydown`,w,{capture:!0})}),pR(()=>{x?.disconnect(),window.removeEventListener(`scroll`,C,!0),window.removeEventListener(`resize`,C),window.visualViewport?.removeEventListener(`resize`,C),window.visualViewport?.removeEventListener(`scroll`,C),window.removeEventListener(`keydown`,w,{capture:!0})});let T=()=>`${e.tagName??``}:${e.componentName??``}`,E=Y(t=>{d();let n=T(),r=n===t.elementIdentity?t:{position:lG,computedArrowPosition:null,hadValidBounds:!1,elementIdentity:n},i=e.selectionBounds,o=a(),c=s(),u=o>0&&c>0,f=i&&i.width>0&&i.height>0;if(!u||!f)return{position:r.hadValidBounds?r.position:lG,computedArrowPosition:r.computedArrowPosition,hadValidBounds:r.hadValidBounds,elementIdentity:n};let p=iW(),m=p.offsetLeft,h=p.offsetTop,g=m+p.width,_=h+p.height;if(!(i.x+i.width>m&&i.x<g&&i.y+i.height>h&&i.y<_))return{position:lG,computedArrowPosition:r.computedArrowPosition,hadValidBounds:r.hadValidBounds,elementIdentity:n};let v=i.x+i.width/2,y=e.mouseX??v,b=i.y+i.height,x=i.y,S=e.hideArrow?0:rW(l()),C=y,w=0,E=b+S+4;if(o>0){let e=C-o/2,t=C+o/2;t>g-8&&(w=g-8-t),e+w<m+8&&(w=m+8-e)}let D=c+S+4,O=E+c<=_-8;O||(E=x-D),E<h+8&&(E=h+8);let k=o/2,ee=k-w,te=Math.min(16,k),A=Math.max(o-16,k),ne=Math.max(te,Math.min(A,ee))-k;return{position:{left:C,top:E,arrowLeftPercent:50,arrowLeftOffset:ne,edgeOffsetX:w},computedArrowPosition:O?`bottom`:`top`,hadValidBounds:!0,elementIdentity:n}},{position:lG,computedArrowPosition:null,hadValidBounds:!1,elementIdentity:``}),D=()=>E().computedArrowPosition??`bottom`,O=()=>E().hadValidBounds;oR(dR(()=>e.selectionLabelShakeCount,()=>g(!0),{defer:!0}));let k=t=>{if(t.isComposing||t.keyCode===229)return;t.stopImmediatePropagation();let n=t.code===`Enter`&&!t.shiftKey,r=t.code===`Escape`;n?(t.preventDefault(),e.onSubmit?.()):r&&(t.preventDefault(),e.onConfirmDismiss?.())},ee=t=>{let n=t.target;n instanceof HTMLTextAreaElement&&(tW(n,95),e.onInputChange?.(n.value))},te=()=>sW({tagName:e.tagName,componentName:e.componentName,elementsCount:e.elementsCount}),A=Y(()=>!(e.error||e.discardPrompt||_()&&e.isPromptMode)),ne=t=>{if(t.stopImmediatePropagation(),e.filePath&&e.onOpen){e.onOpen();return}y()&&e.onToggleExpand?.()},re=t=>{t.stopImmediatePropagation(),_()&&e.isPromptMode&&!e.discardPrompt&&e.onSubmit&&r&&nW(r,{preventScroll:!0})},ie=()=>O()&&(v()||e.status===`error`);return X(qR,{get when(){return Kz(()=>e.visible!==!1)()&&(e.selectionBounds||ie())},get children(){var i=cG();i.addEventListener(`mouseleave`,()=>e.onHoverChange?.(!1)),i.addEventListener(`mouseenter`,()=>e.onHoverChange?.(!0)),i.$$click=e=>{e.stopImmediatePropagation()},i.$$pointerdown=re;var a=t;return typeof a==`function`?cz(a,i):t=i,oz(i,`z-index`,`${LM}`),oz(i,`transition`,`opacity 125ms ease-out, filter 125ms ease-out`),$(i,X(qR,{get when(){return!e.hideArrow},get children(){return X(pW,{get position(){return D()},get leftPercent(){return E().position.arrowLeftPercent},get leftOffsetPx(){return E().position.arrowLeftOffset},get labelWidth(){return l()}})}}),null),$(i,X(qR,{get when(){return Kz(()=>!!v())()&&!e.error},get children(){return X(nG,{get statusText(){return e.statusText??`Copied`},get onDismiss(){return e.onDismiss},onFadingChange:m,get onShowContextMenu(){return e.onShowContextMenu}})}}),null),$(i,X(TW,{ref:e=>n=e,get shape(){return A()?`pill`:`panel`},get class(){return oW(`flex items-center gap-[5px] w-fit h-fit p-0`,h()&&`animate-shake`)},get style(){return{display:v()&&!e.error?`none`:void 0}},onAnimationEnd:()=>g(!1),get children(){return[X(qR,{get when(){return e.status===`copying`},get children(){var t=rG(),n=t.firstChild,r=n.firstChild;return $(n,X(dW,{size:13,class:`text-[var(--rg-text-secondary)] shrink-0`}),r),$(r,()=>e.statusText??`Grabbing…`),t}}),X(qR,{get when(){return Kz(()=>!!(_()&&!e.isPromptMode))()&&!e.discardPrompt},get children(){var t=iG(),n=t.firstChild;return $(n,X(yW,{get tagName(){return te().tagName},get componentName(){return te().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:ne,onHoverChange:S,shrink:!0})),t}}),X(qR,{get when(){return Kz(()=>!!(_()&&e.isPromptMode))()&&!e.discardPrompt},get children(){var t=sG(),n=t.firstChild;return $(n,X(yW,{get tagName(){return te().tagName},get componentName(){return te().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:ne,onHoverChange:S})),$(t,X(xW,{get children(){var t=oG(),n=t.firstChild;return n.$$keydown=k,n.$$input=ee,cz(t=>{r=t,e.onSubmit&&queueMicrotask(()=>{nW(t,{preventScroll:!0}),tW(t,95)})},n),oz(n,`max-height`,`95px`),$(t,X(qR,{get when(){return e.onSubmit},get children(){var t=aG();return t.$$click=()=>e.onSubmit?.(),$(t,X(lW,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-submit-fg)]`})),t}}),null),aR(()=>n.readOnly=!e.onSubmit),aR(()=>n.value=e.inputValue??``),t}}),null),t}}),X(qR,{get when(){return e.discardPrompt},keyed:!0,children:e=>X(zW,{get label(){return Kz(()=>!!e.isKeyboardSelection)()?`Discard selection?`:e.label},get showCancel(){return!e.isKeyboardSelection},get cancelOnEscape(){return e.cancelOnEscape},get onConfirm(){return e.onConfirm},get onCopy(){return e.onCopy},onCancel:()=>{e.isKeyboardSelection||e.onCancel?.(),nW(r,{preventScroll:!0})}})}),X(qR,{get when(){return e.error},get children(){return X(KW,{get error(){return e.error},get onAcknowledge(){return e.onAcknowledgeError},get onRetry(){return e.onRetry}})}})]}}),null),aR(t=>{var n=oW(`fixed font-sans text-[13px] antialiased select-none ease-out`),r=`${E().position.top}px`,a=`${E().position.left}px`,o=`translateX(calc(-50% + ${E().position.edgeOffsetX}px))`,s=b()?`auto`:`none`,c=e.status===`fading`||p()?0:1,l=`drop-shadow(${kM}) blur(${e.status===`fading`||p()?`3px`:`0`})`;return n!==t.e&&nz(i,t.e=n),r!==t.t&&oz(i,`top`,t.t=r),a!==t.a&&oz(i,`left`,t.a=a),o!==t.o&&oz(i,`transform`,t.o=o),s!==t.i&&oz(i,`pointer-events`,t.i=s),c!==t.n&&oz(i,`opacity`,t.n=c),l!==t.s&&oz(i,`filter`,t.s=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),i}})},$R([`pointerdown`,`click`,`input`,`keydown`]),dG=Z(`<span style="transition-property:transform;transition-timing-function:cubic-bezier(0.32, 0.72, 0, 1)"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M20.8977 4.02356L21.8277 4.39121C22.3784 2.99813 21.0382 1.60206 19.6238 2.09546L3.47334 7.72936C1.38661 8.45728 1.49021 11.443 3.6224 12.0245L10.1289 13.799L11.2331 19.8724C11.638 22.0991 14.7072 22.4019 15.5393 20.2972L21.8277 4.39121L20.8977 4.02356Z">`),fG=e=>{let t=()=>e.size??14,n=()=>e.rotationDeg??0;return(()=>{var r=dG(),i=r.firstChild;return oz(r,`transition-duration`,`180ms`),aR(a=>{var o=oW(`inline-flex items-center justify-center will-change-transform`,e.class),s=`rotate(${n()}deg)`,c=t(),l=t();return o!==a.e&&nz(r,a.e=o),s!==a.t&&oz(r,`transform`,a.t=s),c!==a.a&&Q(i,`width`,a.a=c),l!==a.o&&Q(i,`height`,a.o=l),a},{e:void 0,t:void 0,a:void 0,o:void 0}),r})()},pG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 12 12"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M1 6C1 3.239 3.239 1 6 1C8.761 1 11 3.239 11 6C11 8.761 8.761 11 6 11C5.103 11 4.261 10.764 3.532 10.35C2.959 10.759 2.257 11 1.5 11C1.376 11 1.253 10.993 1.132 10.981C0.923 10.959 0.75 10.809 0.699 10.605C0.648 10.402 0.729 10.188 0.903 10.07C1.347 9.768 1.688 9.328 1.865 8.812C1.319 8.011 1 7.042 1 6Z">`),mG=e=>{let t=()=>e.size??14;return(()=>{var n=pG();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},hG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M2 12C2 6.477 6.477 2 12 2C17.523 2 22 6.477 22 12C22 13.867 20.345 14.992 18.77 14.992H16.029C14.739 14.992 13.823 16.248 14.218 17.476L14.48 18.295C14.751 19.139 14.643 20.041 14.211 20.751C13.769 21.479 12.985 22 12 22C6.477 22 2 17.523 2 12ZM12.21 6.783C12.416 7.585 11.933 8.403 11.131 8.609C10.328 8.815 9.511 8.332 9.305 7.529C9.099 6.727 9.582 5.909 10.384 5.703C11.187 5.497 12.004 5.981 12.21 6.783ZM7.59 9.207C8.388 9.43 8.853 10.258 8.63 11.055C8.407 11.853 7.579 12.319 6.782 12.096C5.984 11.873 5.518 11.045 5.741 10.247C5.964 9.449 6.792 8.983 7.59 9.207ZM9.497 14.446C8.918 13.854 7.968 13.844 7.376 14.423C6.784 15.002 6.773 15.952 7.353 16.544C7.932 17.136 8.882 17.147 9.474 16.567C10.066 15.988 10.076 15.039 9.497 14.446ZM16.624 9.575C16.032 10.155 15.082 10.144 14.503 9.552C13.923 8.96 13.934 8.01 14.526 7.431C15.118 6.852 16.068 6.862 16.647 7.454C17.226 8.046 17.216 8.996 16.624 9.575Z">`),gG=e=>{let t=()=>e.size??14;return(()=>{var n=hG();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},_G=Z(`<div>`),vG=0,yG=()=>Date.now()-vG<800,bG=e=>{let[t,n]=J(!1),[r,i]=J(!0),a;oR(dR(()=>e.visible,e=>{a!==void 0&&(clearTimeout(a),a=void 0),e?yG()?(i(!1),n(!0)):(i(!0),a=setTimeout(()=>{n(!0)},400)):(t()&&(vG=Date.now()),n(!1))})),pR(()=>{a!==void 0&&clearTimeout(a),t()&&(vG=Date.now())});let o=()=>e.position===`top`||e.position===`bottom`?{left:`50%`,translate:`-50%`,"z-index":`${LM}`}:{top:`50%`,translate:`0 -50%`,"z-index":`${LM}`};return X(qR,{get when(){return t()},get children(){var t=_G();return $(t,()=>e.children),aR(n=>{var i=oW(`absolute whitespace-nowrap px-2 py-0.5 rounded-full text-[10px] font-sans font-medium leading-4 pointer-events-none`,`bg-[var(--rg-panel-bg)] text-[var(--rg-text-primary)] [box-shadow:var(--rg-shadow)]`,e.position===`top`&&`bottom-full mb-2.5`,e.position===`bottom`&&`top-full mt-2.5`,e.position===`left`&&`right-full mr-2.5`,e.position===`right`&&`left-full ml-2.5`,r()&&`animate-tooltip-fade-in`),a=o();return i!==n.e&&nz(t,n.e=i),n.t=az(t,a,n.t),n},{e:void 0,t:void 0}),t}})},xG=Z(`<div><button data-react-grab-ignore-events type=button>`),SG=e=>(()=>{var t=xG(),n=t.firstChild;rz(n,`mouseleave`,e.onMouseLeave),rz(n,`mouseenter`,e.onMouseEnter),rz(n,`contextmenu`,t=>e.onContextMenu?.(t)),rz(n,`click`,e.onClick,!0);var r=e.ref;return typeof r==`function`?cz(r,n):e.ref=n,$(n,()=>e.icon),$(t,X(qR,{get when(){return e.tooltip},get children(){return X(bG,{get visible(){return!!e.tooltipVisible},get position(){return e.tooltipPosition??`top`},get children(){return e.tooltip}})}}),null),aR(r=>{var i=e.wrapperClass,a=e.isToggle?``:void 0,o=e.actionId,s=e.label,c=!!e.isActive,l=e.class;return i!==r.e&&nz(t,r.e=i),a!==r.t&&Q(n,`data-react-grab-toolbar-toggle`,r.t=a),o!==r.a&&Q(n,`data-react-grab-toolbar-action`,r.a=o),s!==r.o&&Q(n,`aria-label`,r.o=s),c!==r.i&&Q(n,`aria-pressed`,r.i=c),l!==r.n&&nz(n,r.n=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})(),$R([`click`]),CG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M9.29289 16.7071C8.90237 16.3166 8.90237 15.6834 9.29289 15.2929L12.5858 12L9.29289 8.70711C8.90237 8.31658 8.90237 7.68342 9.29289 7.29289C9.68342 6.90237 10.3166 6.90237 10.7071 7.29289L14.7071 11.2929C14.8946 11.4804 15 11.7348 15 12C15 12.2652 14.8946 12.5196 14.7071 12.7071L10.7071 16.7071C10.3166 17.0976 9.68342 17.0976 9.29289 16.7071Z">`),wG=e=>{let t=()=>e.size??14;return(()=>{var n=CG();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},TG=Z(`<button data-react-grab-ignore-events data-react-grab-toolbar-collapse type=button class="group contain-layout shrink-0 flex items-center justify-center cursor-pointer interactive-scale a11y-hitbox">`),EG=Z(`<div data-react-grab-toolbar-panel><div><div><div>`),DG=e=>{let t=()=>e.snapEdge??`bottom`,n=()=>t()===`left`||t()===`right`,r=()=>e.isCollapsed?`duration-140`:`duration-220`,i=()=>n()?`transition-[grid-template-rows] ${r()} ease-drawer`:`transition-[grid-template-columns] ${r()} ease-drawer`,a=()=>n()?`min-h-0`:`min-w-0`,o=()=>e.isCollapsed?`${{top:`rounded-t-none rounded-b-[10px]`,bottom:`rounded-b-none rounded-t-[10px]`,left:`rounded-l-none rounded-r-[10px]`,right:`rounded-r-none rounded-l-[10px]`}[t()]} ${n()?`px-0.25 py-2`:`px-2 py-0.25`}`:``,s=()=>{let n=e.isCollapsed;switch(t()){case`top`:return n?`rotate-90`:`-rotate-90`;case`bottom`:return n?`-rotate-90`:`rotate-90`;case`left`:return n?`rotate-0`:`rotate-180`;case`right`:return n?`rotate-180`:`rotate-0`;default:return`-rotate-90`}},c=()=>{if(e.isChevronPressed)return n()?`scale(0.97, 1)`:`scale(1, 0.97)`},l=()=>(()=>{var t=TG();return rz(t,`pointercancel`,e.onCollapsePointerLeave),rz(t,`pointerleave`,e.onCollapsePointerLeave),rz(t,`pointerup`,e.onCollapsePointerUp,!0),rz(t,`pointerdown`,e.onCollapsePointerDown),rz(t,`click`,e.onCollapseClick,!0),$(t,X(wG,{size:18,get class(){return oW(`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)] transition-[transform,color] duration-150 ease-drawer -m-0.5`,s())}})),aR(n=>{var r=e.isCollapsed?`Expand toolbar`:`Collapse toolbar`,i=!e.isCollapsed;return r!==n.e&&Q(t,`aria-label`,n.e=r),i!==n.t&&Q(t,`aria-expanded`,n.t=i),n},{e:void 0,t:void 0}),t})(),u=()=>e.isChevronPressed?`transition-[padding,border-radius,transform] duration-60 ease-[cubic-bezier(0,0,0.2,1)]`:`transition-[padding,border-radius,transform] ${r()} ease-drawer`;return(()=>{var t=EG(),r=t.firstChild,s=r.firstChild,d=s.firstChild;return rz(t,`click`,e.onPanelClick,!0),rz(t,`animationend`,e.onAnimationEnd),$(d,()=>e.actionButtons),$(t,l,null),aR(l=>{var f=oW(`flex items-center justify-center rounded-[13px] antialiased relative overflow-visible [font-synthesis:none]`,u(),n()&&`flex-col`,`bg-[var(--rg-panel-bg)] [box-shadow:var(--rg-shadow)]`,!e.isCollapsed&&(n()?`px-1.5 gap-0 py-2`:`py-1.5 gap-0 px-2`),o(),e.isShaking&&(n()?`animate-shake-vertical`:`animate-shake`)),p=e.transformOrigin,m=c(),h=oW(`grid relative overflow-visible`,i(),e.isCollapsed?n()?`grid-rows-[0fr] pointer-events-none`:`grid-cols-[0fr] pointer-events-none`:n()?`grid-rows-[1fr]`:`grid-cols-[1fr]`),g=oW(`flex`,n()?`flex-col items-center min-h-0`:`items-center min-w-0`,e.isCollapsed?`opacity-0`:`opacity-100`,e.isCollapsed?`transition-opacity duration-100 ease-drawer`:`transition-opacity duration-180 ease-drawer delay-[80ms]`),_=oW(`relative overflow-visible flex`,n()?`flex-col items-center`:`items-center`,a());return f!==l.e&&nz(t,l.e=f),p!==l.t&&oz(t,`transform-origin`,l.t=p),m!==l.a&&oz(t,`transform`,l.a=m),h!==l.o&&nz(r,l.o=h),g!==l.i&&nz(s,l.i=g),_!==l.n&&nz(d,l.n=_),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})()},$R([`click`,`pointerup`]),OG=e=>e===`top`||e===`bottom`,kG=e=>{let t=OG(e);return{width:t?30:16,height:t?16:30}},AG=(e,t,n,r)=>{let i=iW(),a=i.width,o=i.height,s=i.offsetLeft+16,c=Math.max(s,i.offsetLeft+a-n-16),l=i.offsetTop+16,u=Math.max(l,i.offsetTop+o-r-16);if(e===`top`||e===`bottom`){let r=Math.max(0,a-n-32);return{x:Math.min(c,Math.max(s,i.offsetLeft+16+r*t)),y:e===`top`?l:u}}let d=Math.max(0,o-r-32),f=Math.min(u,Math.max(l,i.offsetTop+16+d*t));return{x:e===`left`?s:c,y:f}},jG=(e,t,n,r,i)=>{let a=iW(),o=a.width,s=a.height;if(e===`top`||e===`bottom`){let e=o-r-32;return e<=0?rN:Math.max(0,Math.min(1,(t-a.offsetLeft-16)/e))}let c=s-i-32;return c<=0?rN:Math.max(0,Math.min(1,(n-a.offsetTop-16)/c))},MG=(e,t,n,r,i)=>{let a=iW(),o=a.width,s=a.height,{width:c,height:l}=n,u;if(t===`top`||t===`bottom`){let n=(c-r)/2;u={x:yB(e.x-n,a.offsetLeft+16,a.offsetLeft+o-c-16),y:t===`top`?a.offsetTop+16:a.offsetTop+s-l-16}}else{let n=(l-i)/2,r=yB(e.y-n,a.offsetTop+16,a.offsetTop+s-l-16);u={x:t===`left`?a.offsetLeft+16:a.offsetLeft+o-c-16,y:r}}let d=jG(t,u.x,u.y,c,l);return{position:u,ratio:d}},NG=(e,t,n,r)=>{let i=iW(),{width:a,height:o}=n,{width:s,height:c}=r;switch(e){case`top`:case`bottom`:{let n=(a-s)/2;return{x:yB(t.x+n,i.offsetLeft,i.offsetLeft+i.width-s),y:e===`top`?i.offsetTop:i.offsetTop+i.height-c}}case`left`:case`right`:{let n=(o-c)/2,r=yB(t.y+n,i.offsetTop,i.offsetTop+i.height-c);return{x:e===`left`?i.offsetLeft:i.offsetLeft+i.width-s,y:r}}}},PG=(e,t,n,r,i,a)=>{let o=iW(),s=o.width,c=o.height,l=e+i*150,u=t+a*150,d=u-o.offsetTop+r/2,f=o.offsetTop+c-u-r/2,p=l-o.offsetLeft+n/2,m=o.offsetLeft+s-l-n/2,h=Math.min(d,f,p,m),g=e=>yB(e,o.offsetLeft+16,o.offsetLeft+s-n-16),_=e=>yB(e,o.offsetTop+16,o.offsetTop+c-r-16);return h===d?{edge:`top`,x:g(l),y:o.offsetTop+16}:h===p?{edge:`left`,x:o.offsetLeft+16,y:_(u)}:h===m?{edge:`right`,x:o.offsetLeft+s-n-16,y:_(u)}:{edge:`bottom`,x:g(l),y:o.offsetTop+c-r-16}},FG=e=>{let[t,n]=J(!1),[r,i]=J(!1),[a,o]=J(!1),[s,c]=J({x:0,y:0}),l={x:0,y:0},u={x:0,y:0,time:0},d={x:0,y:0},f=!1,p,m=null,h=()=>{m?.abort(),m=null},g=t=>{if(!a()){if(Math.hypot(t.clientX-d.x,t.clientY-d.y)<=5)return;o(!0),e.onDragStart()}let n=performance.now(),r=n-u.time;r>0&&c({x:(t.clientX-u.x)/r,y:(t.clientY-u.y)/r}),u={x:t.clientX,y:t.clientY,time:n};let i=t.clientX-l.x,s=t.clientY-l.y;e.onPositionUpdate({x:i,y:s})},_=()=>{h();let t=a();if(n(!1),!t)return;f=!0;let r=e.getContainerRef(),o=r?.getBoundingClientRect();if(!o)return;let c=s(),l=PG(o.left,o.top,o.width,o.height,c.x,c.y),u=jG(l.edge,l.x,l.y,o.width,o.height);e.onSnapEdgeChange(l.edge,u),i(!0),UF(()=>{let t=r?.getBoundingClientRect(),n=t?{width:t.width,height:t.height}:e.getExpandedDimensions();UF(()=>{let t=AG(l.edge,u,n.width,n.height);e.onSnapComplete({edge:l.edge,ratio:u,position:t,expandedDimensions:n}),p=setTimeout(()=>{i(!1),e.onSnapAnimationEnd?.()},300)})})},v=EM(t=>{if(t.button!==0||e.isCollapsed())return;let r=e.getContainerRef()?.getBoundingClientRect();if(!r)return;d={x:t.clientX,y:t.clientY},l={x:t.clientX-r.left,y:t.clientY-r.top},n(!0),o(!1),c({x:0,y:0}),u={x:t.clientX,y:t.clientY,time:performance.now()},h(),m=new AbortController;let{signal:i}=m;window.addEventListener(`pointermove`,g,{signal:i}),window.addEventListener(`pointerup`,_,{signal:i}),window.addEventListener(`pointercancel`,_,{signal:i})});return pR(()=>{h(),clearTimeout(p)}),{isDragging:t,isSnapping:r,handlePointerDown:v,createDragAwareHandler:e=>t=>{if(t.stopImmediatePropagation(),f){f=!1;return}e()}}},IG=(e,t)=>{let n=t-e;return e+(n-Math.round(n/360)*360)},LG=Z(`<div data-react-grab-ignore-events data-react-grab-toolbar>`),RG=e=>{let t,n,r=null,i=EV(),[a,o]=J(!1),[s,c]=J(!1),[l,u]=J(!1),[d,f]=J(i?.edge??`bottom`),[p,m]=J(i?.ratio??.5),[h,g]=J({x:0,y:0}),[_,v]=J(!1),[y,b]=J(!1),[x,S]=J(!1),[C,w]=J(!1),[T,E]=J(0),[D,O]=J(null),k=()=>{r?.(),r=null,e.isActive||CL()},ee=FG({getContainerRef:()=>t,isCollapsed:s,getExpandedDimensions:()=>ce,onDragStart:()=>{O(null),r&&k()},onPositionUpdate:e=>g(e),onSnapEdgeChange:(e,t)=>{de(d(),e),f(e),m(t)},onSnapComplete:e=>{ce=e.expandedDimensions,g(e.position),Ae({edge:e.edge,ratio:e.ratio,collapsed:s(),enabled:!s()})}}),te=()=>d()===`left`||d()===`right`,A=()=>te()?`mb-1.5`:`mr-1.5`,ne=t=>e.activeActionId===t,re=()=>!!e.isActive&&(e.activeActionId??`copy`)===`copy`,ie=t=>D()===t&&!e.isActive&&!s()&&!ee.isDragging()&&!ee.isSnapping()&&!e.isContextMenuOpen,ae=()=>{switch(d()){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;default:return`top`}},oe=e=>{e.stopImmediatePropagation()},se=(t,n)=>({onMouseEnter:e=>{ee.isDragging()||(O(t),n?.shouldFreezeInteractions!==!1&&!r&&(r=$L(),SL(e.clientX,e.clientY)),n?.onHoverChange?.(!0))},onMouseLeave:()=>{O(e=>e===t?null:e),n?.shouldFreezeInteractions!==!1&&!e.isActive&&!e.isContextMenuOpen&&k(),n?.onHoverChange?.(!1)}});oR(dR(()=>e.shakeCount,t=>{t&&!e.enabled&&v(!0)})),oR(dR(()=>[e.isActive,e.isContextMenuOpen],([e,t])=>{!e&&!t&&r&&(r(),r=null)})),oR(dR(()=>re(),e=>{if(!e){E(e=>IG(e,0));return}let t=EM(e=>{if(!n)return;let t=n.getBoundingClientRect(),r=t.left+t.width/2,i=t.top+t.height/2,a=e.clientX-r,o=e.clientY-i;if(Math.hypot(a,o)<4)return;let s=Math.atan2(o,a)*180/Math.PI- -45;E(e=>IG(e,s))});window.addEventListener(`pointermove`,t,{passive:!0}),pR(()=>{window.removeEventListener(`pointermove`,t)})}));let ce={width:78,height:28},[le,ue]=J(kG(d())),de=(e,t)=>{OG(e)!==OG(t)&&ue(kG(t))},fe=(e,n)=>{let r=t?.getBoundingClientRect(),i=kG(n);return MG(e,n,ce,r?.width??i.width,r?.height??i.height)},pe=()=>{g(AG(d(),p(),ce.width,ce.height))},me=ee.createDragAwareHandler(()=>e.onToggle?.()),he=ee.createDragAwareHandler(()=>e.onActivateAction?.(aN)),ge=ee.createDragAwareHandler(()=>e.onActivateAction?.(oN)),_e=`group contain-layout flex items-center justify-center cursor-pointer interactive-scale a11y-hitbox`,ve=()=>oW(`relative contain-layout flex items-center justify-center`,A()),ye=e=>e?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)]`,be=ee.createDragAwareHandler(()=>{let e=t?.getBoundingClientRect(),n=s(),r=p();if(n){let{position:e,ratio:t}=fe(je(),d());r=t,g(e),m(r)}else e&&(ce={width:e.width,height:e.height});b(!0),c(e=>!e),Ae({edge:d(),ratio:r,collapsed:!n,enabled:n}),Ce&&clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}),xe=()=>NG(d(),h(),ce,le()),Se,Ce,we=null,Te=()=>{let e=t?.getBoundingClientRect();!e||e.width===0||e.height===0||(s()?ue({width:e.width,height:e.height}):(ce={width:e.width,height:e.height},we={width:e.width,height:e.height}))},Ee=(e,t)=>{if(!(e===0||t===0)&&!(ee.isDragging()||ee.isSnapping())&&!y()){if(s()){let n=le();if(n.width===e&&n.height===t)return;ue({width:e,height:t});return}we&&we.width===e&&we.height===t||(we={width:e,height:t},ce={width:e,height:t},g(AG(d(),p(),e,t)))}},De=null,Oe=()=>{ee.isDragging()||ee.isSnapping()||De===null&&(De=UF(()=>{De=null,pe()}))},ke=()=>{ee.isDragging()||(u(!0),pe(),Se&&clearTimeout(Se),Se=setTimeout(()=>{u(!1);let e=jG(d(),h().x,h().y,ce.width,ce.height);m(e),Ae({edge:d(),ratio:e,collapsed:s(),enabled:!s()})},500))},Ae=t=>{DV(t),e.onStateChange?.(t)};fR(()=>{t&&e.onContainerRef?.(t);let n=t?.getBoundingClientRect(),r=iW(),a=!!(n&&n.width>0&&n.height>0);i?(a&&n&&(ce={width:n.width,height:n.height}),c(i.collapsed),g(AG(i.edge,i.ratio,ce.width,ce.height))):a&&n?(ce={width:n.width,height:n.height},g({x:r.offsetLeft+(r.width-n.width)/2,y:r.offsetTop+r.height-n.height-16}),m(rN)):(g(AG(`bottom`,rN,ce.width,ce.height)),m(rN)),e.onSubscribeToStateChanges&&pR(e.onSubscribeToStateChanges(e=>{if(y()||!t?.getBoundingClientRect())return;let n=s()!==e.collapsed;if(de(d(),e.edge),f(e.edge),n&&!e.collapsed){let t=je();b(!0),c(e.collapsed);let{position:n,ratio:r}=fe(t,e.edge);g(n),m(r),clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}else n&&(b(!0),clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)),c(e.collapsed),g(AG(e.edge,e.ratio,ce.width,ce.height)),m(e.ratio)})),window.addEventListener(`resize`,ke),window.visualViewport?.addEventListener(`resize`,ke),window.visualViewport?.addEventListener(`scroll`,ke);let l=wM();if(l&&(window.addEventListener(`scroll`,Oe,{passive:!0,capture:!0}),typeof ResizeObserver<`u`)){let e=new ResizeObserver(Oe);e.observe(l),pR(()=>e.disconnect())}if(typeof ResizeObserver<`u`&&t){let e=new ResizeObserver(e=>{let n=e[0];if(!n)return;let r=n.borderBoxSize?.[0],i,a;if(r)i=r.inlineSize,a=r.blockSize;else{let e=t?.getBoundingClientRect();if(!e)return;i=e.width,a=e.height}Ee(i,a)});e.observe(t),pR(()=>e.disconnect())}let u=setTimeout(()=>{o(!0)},500);pR(()=>{clearTimeout(u)})}),pR(()=>{window.removeEventListener(`resize`,ke),window.visualViewport?.removeEventListener(`resize`,ke),window.visualViewport?.removeEventListener(`scroll`,ke),window.removeEventListener(`scroll`,Oe,{capture:!0}),De!==null&&WF(De),clearTimeout(Se),clearTimeout(Ce),r&&k()});let je=()=>s()?xe():h(),Me=()=>s()?`cursor-pointer`:ee.isDragging()?`cursor-grabbing`:`cursor-grab`,Ne=()=>C()||!!e.isContextMenuOpen||ee.isDragging()||ee.isSnapping()||y()||x(),Pe=()=>!!e.isActive&&!Ne(),Fe=()=>l()||ee.isDragging()?``:ee.isSnapping()?`transition-[transform,opacity] duration-300 ease-out`:y()?`transition-[transform,opacity] ${s()?`duration-140`:`duration-220`} ease-drawer`:`transition-[transform,opacity] duration-400 ease-drawer`,Ie=()=>{switch(d()){case`top`:return`center top`;case`bottom`:return`center bottom`;case`left`:return`left center`;case`right`:return`right center`;default:return`center center`}};return(()=>{var r=LG();r.addEventListener(`mouseleave`,()=>{w(!1),e.onSelectHoverChange?.(!1)}),r.addEventListener(`mouseenter`,()=>{w(!0),s()||e.onSelectHoverChange?.(!0)}),rz(r,`mousedown`,oe),rz(r,`pointerdown`,e=>{oe(e),ee.handlePointerDown(e)});var i=t;return typeof i==`function`?cz(i,r):t=r,$(r,X(DG,{get isCollapsed(){return s()},get snapEdge(){return d()},get isShaking(){return _()},get isChevronPressed(){return x()},get transformOrigin(){return Ie()},onAnimationEnd:()=>v(!1),onCollapseClick:be,onCollapsePointerDown:()=>S(!0),onCollapsePointerUp:()=>S(!1),onCollapsePointerLeave:()=>S(!1),onPanelClick:e=>{if(s()){e.stopPropagation();let{position:t,ratio:n}=fe(je(),d());g(t),m(n),b(!0),c(!1),Ae({edge:d(),ratio:n,collapsed:!1,enabled:!0}),Ce&&clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}},get actionButtons(){return[X(SG,UR({actionId:iN,isToggle:!0,ref:e=>n=e,get label(){return re()?`Stop selecting element`:`Copy element`},get isActive(){return re()},class:_e,get wrapperClass(){return ve()},onClick:me,onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),O(null),e.onToggleToolbarMenu?.()}},()=>se(iN),{get icon(){return X(fG,{size:14,get rotationDeg(){return T()},get class(){return ye(re())}})},get tooltipVisible(){return ie(iN)},get tooltipPosition(){return ae()},tooltip:`Copy`})),X(SG,UR({actionId:aN,label:`Comment on element`,get isActive(){return ne(aN)},class:_e,get wrapperClass(){return ve()},onClick:he},()=>se(aN),{get icon(){return X(mG,{size:14,get class(){return ye(ne(aN))}})},get tooltipVisible(){return ie(aN)},get tooltipPosition(){return ae()},tooltip:`Comment`})),X(SG,UR({actionId:oN,label:`Style element`,get isActive(){return ne(oN)},class:_e,get wrapperClass(){return ve()},onClick:ge},()=>se(oN),{get icon(){return X(gG,{size:14,get class(){return ye(ne(oN))}})},get tooltipVisible(){return ie(oN)},get tooltipPosition(){return ae()},tooltip:`Style`}))]}})),aR(e=>{var t=oW(`fixed left-0 top-0 font-sans text-[13px] antialiased select-none`,Me(),Fe(),a()?`pointer-events-auto`:`pointer-events-none`),n=String(LM),i=`translate(${je().x}px, ${je().y}px) scale(${Pe()?.97:1})`,o=Ie(),s=a()?Pe()?.55:1:0;return t!==e.e&&nz(r,e.e=t),n!==e.t&&oz(r,`z-index`,e.t=n),i!==e.a&&oz(r,`transform`,e.a=i),o!==e.o&&oz(r,`transform-origin`,e.o=o),s!==e.i&&oz(r,`opacity`,e.i=s),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r})()},zG=gR(),BG=()=>{let e=_R(zG);if(!e)throw Error(`Menu subcomponents must be rendered inside <Menu.Provider>`);return e},VG=e=>X(zG.Provider,{get value(){return e.store},get children(){return e.children}}),HG=e=>X(TW,{get class(){return oW(`flex flex-col w-fit h-fit`,e.class)},get style(){return e.style},get children(){return e.children}}),UG=Z(`<div role=menu aria-orientation=vertical><div aria-hidden=true class="pointer-events-none absolute opacity-0 transition-[top,left,width,height,opacity,border-radius] duration-75 ease-out bg-[var(--rg-surface-hover)]">`),WG=e=>{let t=BG();return(()=>{var n=UG(),r=n.firstChild;n.$$pointermove=()=>t.notePointerMove(),cz(n=>{t.setHighlightContainer(n),e.ref?.(n)},n);var i=t.setHighlightRail;return typeof i==`function`?cz(i,r):t.setHighlightRail=r,$(n,()=>e.children,null),aR(r=>{var i=e.label,a=t.keyboardNavigation?t.activeDescendantId():void 0,o=t.keyboardNavigation?-1:void 0,s=oW(`relative flex flex-col`,e.class);return i!==r.e&&Q(n,`aria-label`,r.e=i),a!==r.t&&Q(n,`aria-activedescendant`,r.t=a),o!==r.a&&Q(n,`tabindex`,r.a=o),s!==r.o&&nz(n,r.o=s),r},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()},$R([`pointermove`]),GG=Z(`<button data-react-grab-ignore-events type=button>`),KG=e=>{let t=BG(),n=t.createItemId(),r=e.value,i=()=>e.role??`menuitem`,a=()=>!e.disabled,o=()=>t.activeValue()===r,s;return fR(()=>{s&&(t.registerItem({value:r,domId:n,element:s,isEnabled:a,onSelect:()=>e.onSelect?.()}),pR(()=>t.unregisterItem(r)))}),(()=>{var c=GG();c.$$click=t=>{t.stopPropagation(),a()&&e.onSelect?.()},c.addEventListener(`pointerleave`,()=>{t.clearActiveOnPointerLeave&&t.setActiveItem(null)}),c.addEventListener(`pointerenter`,()=>{a()&&t.canActivateOnHover()&&t.setActiveItem(r)}),c.$$pointerdown=e=>e.stopPropagation();var l=s;return typeof l==`function`?cz(l,c):s=c,Q(c,`id`,n),$(c,()=>e.children),aR(n=>{var a=e.dataId??r,s=i(),l=i()===`menuitemradio`?!!e.checked:void 0,u=!!e.disabled,d=t.keyboardNavigation?o()?0:-1:void 0,f=e.disabled,p=oW(`relative z-1 contain-layout flex items-center justify-between w-full px-2 py-1 cursor-pointer text-left border-none bg-transparent disabled:opacity-40 disabled:cursor-default`,e.class);return a!==n.e&&Q(c,`data-react-grab-menu-item`,n.e=a),s!==n.t&&Q(c,`role`,n.t=s),l!==n.a&&Q(c,`aria-checked`,n.a=l),u!==n.o&&Q(c,`aria-disabled`,n.o=u),d!==n.i&&Q(c,`tabindex`,n.i=d),f!==n.n&&(c.disabled=n.n=f),p!==n.s&&nz(c,n.s=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),c})()},$R([`pointerdown`,`click`]),qG=Z(`<span>`),JG=e=>(()=>{var t=qG();return $(t,()=>e.children),aR(()=>nz(t,oW(`text-[13px] leading-4 font-sans font-medium`,e.class))),t})(),YG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M6.5 5C5.67157 5 5 5.67157 5 6.5C5 7.32843 5.67157 8 6.5 8H8V6.5C8 5.67157 7.32843 5 6.5 5ZM10 8V6.5C10 4.567 8.433 3 6.5 3C4.567 3 3 4.567 3 6.5C3 8.433 4.567 10 6.5 10H8V14H6.5C4.567 14 3 15.567 3 17.5C3 19.433 4.567 21 6.5 21C8.433 21 10 19.433 10 17.5V16H14V17.5C14 19.433 15.567 21 17.5 21C19.433 21 21 19.433 21 17.5C21 15.567 19.433 14 17.5 14H16V10H17.5C19.433 10 21 8.433 21 6.5C21 4.567 19.433 3 17.5 3C15.567 3 14 4.567 14 6.5V8H10ZM10 10V14H14V10H10ZM16 8H17.5C18.3284 8 19 7.32843 19 6.5C19 5.67157 18.3284 5 17.5 5C16.6716 5 16 5.67157 16 6.5V8ZM16 16V17.5C16 18.3284 16.6716 19 17.5 19C18.3284 19 19 18.3284 19 17.5C19 16.6716 18.3284 16 17.5 16H16ZM8 16H6.5C5.67157 16 5 16.6716 5 17.5C5 18.3284 5.67157 19 6.5 19C7.32843 19 8 18.3284 8 17.5V16Z">`),XG=e=>{let t=()=>e.size??11;return(()=>{var n=YG();return aR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},ZG=Z(`<span>`),QG=Z(`<span style=display:inline-flex;align-items:center;gap:2px>`),$G=Z(`<span>Ctrl+`),eK=e=>{let t=()=>e.shortcut===`Enter`,n=()=>e.modifier!==!1,r=SB();return(()=>{var i=QG();return $(i,X(qR,{get when(){return t()},get children(){return X(AW,{size:8})}}),null),$(i,X(qR,{get when(){return!t()},get children(){return X(qR,{get when(){return n()},get fallback(){return(()=>{var t=ZG();return $(t,()=>e.shortcut),t})()},get children(){return X(qR,{when:r,get fallback(){return(()=>{var t=$G();return t.firstChild,$(t,()=>e.shortcut,null),t})()},get children(){return[X(XG,{size:9}),(()=>{var t=ZG();return $(t,()=>e.shortcut),t})()]}})}})}}),null),aR(()=>nz(i,e.class)),i})()},tK=e=>X(eK,{get shortcut(){return e.shortcut},get modifier(){return e.modifier},get class(){return oW(`text-[11px] font-sans text-[var(--rg-text-secondary)] ml-4`,e.class)}}),nK=({hiddenOpacity:e=`0`,visibleOpacity:t=`1`}={})=>{let n,r,i,a=e=>{r&&(r.style.opacity=t,r.style.top=`${e.offsetTop}px`,r.style.left=`${e.offsetLeft}px`,r.style.width=`${e.offsetWidth}px`,r.style.height=`${e.offsetHeight}px`)},o=typeof ResizeObserver>`u`?void 0:new ResizeObserver(()=>{i&&a(i)});pR(()=>o?.disconnect());let s=()=>{i=void 0,o?.disconnect(),r&&(r.style.opacity=e)};return{containerRef:e=>{n=e},followerRef:e=>{r=e},followElement:e=>{if(!(!r||!n)){if(!e){s();return}i=e,a(e),o?.disconnect(),o?.observe(e),o?.observe(n)}},hideFollower:s}},rK=(e,t)=>e!==t&&e instanceof HTMLElement,iK=(e,t)=>{let n=[];for(let r of Array.from(e.children))rK(r,t)&&n.push(r);return n},aK=(e={})=>{let{topCornerRadiusPx:t,bottomCornerRadiusPx:n,cornerShape:r}=e,i=t!==void 0||n!==void 0,a,o=!1,s=e=>{if(!a||!i)return;let s=e.parentElement;if(!s)return;let c=iK(s,a),l=c[0]===e,u=c[c.length-1]===e,d=l&&t!==void 0?`${t}px`:`0px`,f=u&&n!==void 0?`${n}px`:`0px`;a.style.borderTopLeftRadius=d,a.style.borderTopRightRadius=d,a.style.borderBottomLeftRadius=f,a.style.borderBottomRightRadius=f,r&&!o&&(a.style.setProperty(`corner-shape`,r),o=!0)},{containerRef:c,followerRef:l,followElement:u,hideFollower:d}=nK();return{containerRef:c,highlightRef:e=>{a=e,o=!1,l(e)},updateHighlight:e=>{u(e),e&&s(e)},clearHighlight:d}},oK=(e={})=>{let t=new Map,n=[],r=`react-grab-menu-${Math.random().toString(36).slice(2,8)}`,i=0,a=!1,o=e.value!==void 0,[s,c]=J(null),[l,u]=J(0),d=Y(()=>o?e.value?.()??null:s()),f=t=>{if(o){e.onValueChange?.(t);return}c(t)},p=aK(e.highlight??{});oR(dR([d,l],([e])=>{if(e===null){p.clearHighlight();return}let n=t.get(e);n?p.updateHighlight(n.element):p.clearHighlight()}));let m=()=>n.filter(e=>t.get(e)?.isEnabled()),h=()=>{let e=m();e.length>0&&f(e[0])},g=()=>{let e=m();e.length>0&&f(e[e.length-1])},_=()=>{let e=m();if(e.length===0)return;let t=e.indexOf(d()??``);f(e[t===-1?0:(t+1)%e.length])},v=()=>{let e=m();if(e.length===0)return;let t=e.indexOf(d()??``);f(e[t===-1?e.length-1:(t-1+e.length)%e.length])},y=Y(()=>{l();let e=d();if(e!==null)return t.get(e)?.domId});return{keyboardNavigation:e.keyboardNavigation??!1,clearActiveOnPointerLeave:e.clearActiveOnPointerLeave??!1,activeValue:d,activeDescendantId:y,setActiveItem:f,createItemId:()=>`${r}-item-${i++}`,canActivateOnHover:()=>!(e.requirePointerMove??!1)||a,notePointerMove:()=>{a=!0},resetPointerMove:()=>{a=!1},registerItem:e=>{t.set(e.value,e),n.includes(e.value)||n.push(e.value),u(e=>e+1)},unregisterItem:e=>{t.delete(e);let r=n.indexOf(e);r!==-1&&n.splice(r,1),o||c(t=>t===e?null:t),u(e=>e+1)},getActiveItem:()=>{let e=d();return e===null?void 0:t.get(e)},selectFirst:h,selectLast:g,selectNext:_,selectPrevious:v,setHighlightContainer:p.containerRef,setHighlightRail:p.highlightRef}},sK={Provider:VG,Panel:HG,List:WG,Item:KG,Label:JG,Shortcut:tK},cK=e=>e??!0,lK=(e,t)=>typeof e.enabled==`function`?t?e.enabled(t):!1:cK(e.enabled),uK=e=>{e.type===`contextmenu`&&e.preventDefault(),e.stopImmediatePropagation()},dK=e=>{let t=EM(t=>{e.isOpen()&&(e.shouldIgnoreKeyboardEvent?.(t)||e.shouldIgnoreInputEvents&&Zz(t)||t.code===`Escape`&&(t.preventDefault(),t.stopImmediatePropagation(),e.onDismiss(`keyboard`)))}),n=EM(t=>{e.isOpen()&&(CB(t,`data-react-grab-ignore-events`)||e.shouldIgnoreRightClick&&t instanceof MouseEvent&&t.button===2||e.onDismiss(`pointer`))}),r=UF(()=>{window.addEventListener(`mousedown`,n,{capture:!0}),window.addEventListener(`touchstart`,n,{capture:!0})});return window.addEventListener(`keydown`,t,{capture:!0}),()=>{WF(r),window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`mousedown`,n,{capture:!0}),window.removeEventListener(`touchstart`,n,{capture:!0})}},fK=Z(`<div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 w-fit h-fit px-2">`),pK=Z(`<div data-react-grab-ignore-events data-react-grab-context-menu class="fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none"style=pointer-events:auto>`),mK=e=>{let t,n,r=null,i=oK({keyboardNavigation:!0,highlight:{bottomCornerRadiusPx:14,cornerShape:sN}}),[a,o]=J(0),[s,c]=J(0),l=Y(()=>e.position!==null),u=Y(()=>sW({tagName:e.tagName,componentName:e.componentName})),d=()=>{if(t){let e=t.getBoundingClientRect();o(e.width),c(e.height)}};oR(()=>{l()&&UF(d)});let f=Y(()=>{let t=e.selectionBounds,n=e.position,r=a(),i=s();if(r===0||i===0||!t||!n)return{left:uN.left,top:uN.top,arrowLeft:0,arrowPosition:`bottom`};let o=n.x??t.x+t.width/2,c=Math.max(4,Math.min(o-r/2,window.innerWidth-r-4)),l=Math.max(8,Math.min(o-c,r-8)),u=t.y+t.height+8+4,d=t.y-i-8-4,f=u+i>window.innerHeight,p=d>=0,m=f&&p,h=m?d:u,g=m?`top`:`bottom`;if(f&&!p){let e=n.y??t.y+t.height/2;h=Math.max(4,Math.min(e+4,window.innerHeight-i-4)),g=`top`}return{left:c,top:h,arrowLeft:l,arrowPosition:g}}),p=Y(()=>{let t=e.actions??[],n=e.actionContext;return t.map(e=>({id:e.id,label:e.label,action:()=>{n&&e.onAction(n)},enabled:lK(e,n),shortcut:e.shortcut,shortcutModifier:e.shortcutModifier}))});oR(dR(l,e=>{if(e){let e=t?.getRootNode(),i=e instanceof ShadowRoot?e.activeElement:null,a=document.activeElement;r=a instanceof HTMLElement&&i===null&&!(t instanceof Element&&t.contains(a))?a:null,n?.focus({preventScroll:!0});return}i.setActiveItem(null);let a=r;r=null,!(!(a instanceof HTMLElement)||!document.contains(a))&&UF(()=>{let e=document.activeElement;(e===null||e===document.body)&&a.focus({preventScroll:!0})})})),fR(()=>{d();let t=t=>{if(!l())return;let n=t.key===`ArrowDown`,r=t.key===`ArrowUp`,a=t.key===`Home`,o=t.key===`End`,s=t.key===`Tab`;if(n||r||a||o||s){t.preventDefault(),t.stopPropagation();let e=n||s&&!t.shiftKey;a?i.selectFirst():o?i.selectLast():e?i.selectNext():i.selectPrevious();return}let c=e.actions??[],u=e.actionContext,d=n=>{u&&lK(n,u)&&(t.preventDefault(),t.stopPropagation(),n.onAction(u),e.onHide())};if(t.key===`Enter`){let e=i.getActiveItem();if(e){t.preventDefault(),t.stopPropagation(),e.isEnabled()&&e.onSelect();return}}let f=jV(c,t,{includeModifierShortcuts:!0});f&&d(f)},n=dK({isOpen:l,onDismiss:e.onDismiss,shouldIgnoreRightClick:!0}),r=EM(t);window.addEventListener(`keydown`,r,{capture:!0}),pR(()=>{n(),window.removeEventListener(`keydown`,r,{capture:!0})})});let m=Y(()=>{let{tagName:e,componentName:t}=u();return`Actions for ${t?`${t}.${e}`:e}`});return X(qR,{get when(){return l()},get children(){var r=pK();rz(r,`contextmenu`,uK,!0),rz(r,`click`,uK,!0),rz(r,`mousedown`,uK,!0),rz(r,`pointerdown`,uK,!0);var a=t;return typeof a==`function`?cz(a,r):t=r,oz(r,`z-index`,`${LM}`),$(r,X(pW,{get position(){return f().arrowPosition},leftPercent:0,get leftOffsetPx(){return f().arrowLeft}}),null),$(r,X(sK.Panel,{class:`justify-center items-start min-w-[100px]`,get children(){return[(()=>{var t=fK();return $(t,X(yW,{get tagName(){return u().tagName},get componentName(){return u().componentName},get isClickable(){return e.hasFilePath},onClick:t=>{t.stopPropagation(),e.hasFilePath&&e.actionContext&&(e.actions?.find(e=>e.id===`open`))?.onAction(e.actionContext)},shrink:!0})),t})(),X(xW,{get children(){return X(sK.Provider,{store:i,get children(){return X(sK.List,{ref:e=>n=e,get label(){return m()},class:`w-[calc(100%+16px)] -mx-2 -my-1.5 outline-none`,get children(){return X(GR,{get each(){return p()},children:t=>X(sK.Item,{get value(){return t.id},get dataId(){return t.label.toLowerCase()},get disabled(){return!t.enabled},onSelect:()=>{t.action(),e.onHide()},get children(){return[X(sK.Label,{class:`text-[var(--rg-text-primary)]`,get children(){return t.label}}),X(qR,{get when(){return t.shortcut},children:e=>X(sK.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})})}})}})}})]}}),null),aR(e=>{var t=`${f().top}px`,n=`${f().left}px`;return t!==e.e&&oz(r,`top`,e.e=t),n!==e.t&&oz(r,`left`,e.t=n),e},{e:void 0,t:void 0}),r}})},$R([`pointerdown`,`mousedown`,`click`,`contextmenu`]),hK=(e,t,n,r)=>Math.max(r,Math.min(e,n-t-r)),gK=({anchor:e,measuredWidth:t,measuredHeight:n,viewportLeft:r=0,viewportTop:i=0,viewportWidth:a,viewportHeight:o,anchorGapPx:s,viewportPaddingPx:c,offscreenPosition:l})=>{if(!e||t===0||n===0)return l;let u,d;return e.edge===`left`||e.edge===`right`?(u=e.edge===`left`?e.x+s:e.x-t-s,d=e.y-n/2):(u=e.x-t/2,d=e.edge===`top`?e.y+s:e.y-n-s),{left:r+hK(u-r,t,a,c),top:i+hK(d-i,n,o,c)}},_K=(e,t)=>{let[n,r]=J(0),[i,a]=J(0),[o,s]=J(!1),[c,l]=J(!1),[u,d]=J(0),[f,p]=J(`bottom`),m,h,g=()=>{clearTimeout(m),h!==void 0&&(WF(h),h=void 0)},_=()=>{let t=e();t&&(r(t.offsetWidth),a(t.offsetHeight))},v=()=>{lR(()=>{d(e=>e+1),_()})},y=Y(()=>t()!==null);return oR(()=>{let n=t();n?(p(n.edge),clearTimeout(m),s(!0),h!==void 0&&WF(h),h=UF(()=>{_(),e()?.offsetHeight,l(!0)})):(h!==void 0&&WF(h),l(!1),m=setTimeout(()=>{s(!1)},120)),pR(g)}),oR(()=>{if(!y())return;window.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`scroll`,v);let e=wM(),t;e&&typeof ResizeObserver<`u`&&(t=new ResizeObserver(v),t.observe(e)),pR(()=>{window.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`scroll`,v),t?.disconnect()})}),{shouldMount:o,isAnimatedIn:c,lastAnchorEdge:f,displayPosition:Y(e=>{u();let r=iW(),a=gK({anchor:t(),measuredWidth:n(),measuredHeight:i(),viewportLeft:r.offsetLeft,viewportTop:r.offsetTop,viewportWidth:r.width,viewportHeight:r.height,anchorGapPx:8,viewportPaddingPx:8,offscreenPosition:uN});return a.left===uN.left?e:a},uN),measure:_,clearAnimationHandles:g}},vK={padding:{prefix:`p`,scale:`spacing`},"padding-top,padding-bottom":{prefix:`py`,scale:`spacing`},"padding-left,padding-right":{prefix:`px`,scale:`spacing`},"padding-top":{prefix:`pt`,scale:`spacing`},"padding-right":{prefix:`pr`,scale:`spacing`},"padding-bottom":{prefix:`pb`,scale:`spacing`},"padding-left":{prefix:`pl`,scale:`spacing`},margin:{prefix:`m`,scale:`spacing`},"margin-top,margin-bottom":{prefix:`my`,scale:`spacing`},"margin-left,margin-right":{prefix:`mx`,scale:`spacing`},"margin-top":{prefix:`mt`,scale:`spacing`},"margin-right":{prefix:`mr`,scale:`spacing`},"margin-bottom":{prefix:`mb`,scale:`spacing`},"margin-left":{prefix:`ml`,scale:`spacing`},gap:{prefix:`gap`,scale:`spacing`},"column-gap":{prefix:`gap-x`,scale:`spacing`},"row-gap":{prefix:`gap-y`,scale:`spacing`},"width,height":{prefix:`size`,scale:`spacing`},width:{prefix:`w`,scale:`spacing`},height:{prefix:`h`,scale:`spacing`},"min-width":{prefix:`min-w`,scale:`spacing`},"max-width":{prefix:`max-w`,scale:`spacing`},"min-height":{prefix:`min-h`,scale:`spacing`},"max-height":{prefix:`max-h`,scale:`spacing`},"top,right,bottom,left":{prefix:`inset`,scale:`spacing`},"top,bottom":{prefix:`inset-y`,scale:`spacing`},"left,right":{prefix:`inset-x`,scale:`spacing`},top:{prefix:`top`,scale:`spacing`},right:{prefix:`right`,scale:`spacing`},bottom:{prefix:`bottom`,scale:`spacing`},left:{prefix:`left`,scale:`spacing`},"border-width":{prefix:`border`,scale:`border-width`},"border-top-width":{prefix:`border-t`,scale:`border-width`},"border-right-width":{prefix:`border-r`,scale:`border-width`},"border-bottom-width":{prefix:`border-b`,scale:`border-width`},"border-left-width":{prefix:`border-l`,scale:`border-width`},"z-index":{prefix:`z`,scale:`z-index`},opacity:{prefix:`opacity`,scale:`opacity`}},yK=(e,t)=>{let n=vK[e];if(!n)return null;let{prefix:r,scale:i}=n;if(i===`spacing`){if(t<0)return null;let e=t/4;return!Number.isInteger(e)||e>96?null:`${r}-${e}`}return i===`border-width`?!Number.isInteger(t)||t<0||t>8?null:t===1?r:`${r}-${t}`:i===`z-index`?!Number.isInteger(t)||t<0||t>50?null:`${r}-${t}`:!Number.isFinite(t)||t<0||t>100||t%5!=0?null:`${r}-${t}`},bK=e=>{let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement:e.ownerDocument?.activeElement??document.activeElement},xK=e=>e.toLowerCase()===`#00000000`?mN:e.toUpperCase(),SK=Z(`<input data-react-grab-ignore-events data-react-grab-input type=text autocapitalize=none autocorrect=off autocomplete=off>`),CK=e=>{let[t,n]=WR(e,[`class`,`ref`,`autoFocusSelect`]);return(()=>{var e=SK();return cz(e=>{t.autoFocusSelect&&queueMicrotask(()=>{e.focus(),e.select()}),t.ref?.(e)},e),Q(e,`spellcheck`,!1),sz(e,UR({get class(){return oW(`bg-transparent border-none outline-none text-[var(--rg-text-primary)] p-0 m-0`,t.class)}},n),!1,!1),e})()},wK=`text-[13px] leading-4 font-medium`,TK={position:`absolute`,opacity:0,"pointer-events":`none`,width:`0`,height:`0`,margin:`0`,padding:`0`,overflow:`hidden`},EK=Z(`<div class="flex items-center gap-2 w-full px-2 h-[20px]"><div class="flex items-center gap-1 ml-auto shrink-0"><button type=button data-react-grab-ignore-events aria-label="Pick color"class="size-[16px] rounded-[4px] border-[var(--rg-border-button)] [border-width:0.5px] border-solid p-0 m-0 cursor-pointer shrink-0"></button><input data-react-grab-ignore-events type=color aria-hidden=true tabindex=-1 class="absolute opacity-0 pointer-events-none size-0">`),DK=Z(`<span>`),OK=Z(`<span class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)] cursor-text">`),kK=e=>e.length===9?e.slice(0,7):e,AK=e=>{let[t,n]=J(null),r=()=>t()!==null,i=()=>xK(e.value),a,o=!0;pR(()=>{o=!1}),fR(()=>{let t=e.onRegisterTrigger?.(()=>a?.click());pR(()=>t?.())});let s=()=>{let r=t();if(r===null)return;n(null);let i=vB(r);i?i.toLowerCase()!==e.value.toLowerCase()&&e.onCommit(i,`keyboard`):e.onInvalidCommit?.(),e.onEditComplete?.()},c=()=>{r()&&(n(null),e.onEditComplete?.())},l=e=>{if(!(e.isComposing||e.keyCode===229)){if(e.stopImmediatePropagation(),e.key===`Enter`){e.preventDefault(),s();return}e.key===`Escape`&&(e.preventDefault(),c())}},u=t=>{t.preventDefault(),t.stopPropagation(),e.onInteract?.(),a?.click()};return(()=>{var c=EK(),d=c.firstChild,f=d.firstChild,p=f.nextSibling;$(c,X(qR,{get when(){return e.label},children:e=>(()=>{var t=DK();return nz(t,`${wK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,e),t})()}),d),$(d,X(qR,{get when(){return r()},get fallback(){return(()=>{var e=OK();return e.$$click=e=>{e.preventDefault(),e.stopPropagation(),n(i())},e.$$pointerdown=e=>e.stopPropagation(),$(e,i),aR(()=>Q(e,`data-react-grab-value`,i())),e})()},get children(){return X(CK,{autoFocusSelect:!0,inputmode:`text`,"aria-label":`Style color hex`,class:`text-[12px] leading-4 font-medium tabular-nums text-right`,get style(){return{"field-sizing":`content`,"min-width":`32px`,"max-width":e.emphasized?`100px`:`72px`}},get value(){return t()??``},onInput:e=>n(e.currentTarget.value),onKeyDown:l,onBlur:s,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()})}}),f),f.$$click=u,f.$$mousedown=e=>e.preventDefault(),f.$$pointerdown=e=>e.stopPropagation(),p.$$input=t=>{if(!o)return;let n=t.currentTarget.value,r=e.value.length===9?e.value.slice(7):``,i=n+(r.toLowerCase()===`00`?``:r);e.onInteract?.(),i&&i.toLowerCase()!==e.value.toLowerCase()&&e.onCommit(i,`pointer`)};var m=a;return typeof m==`function`?cz(m,p):a=p,aR(t=>oz(f,`background-color`,e.value)),aR(()=>p.value=kK(e.value)),c})()},$R([`pointerdown`,`mousedown`,`click`,`input`]),jK=Z(`<svg width=1em height=1em viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg aria-hidden=true style=width:16px;height:16px;flex-shrink:0;cursor:pointer><path fill-rule=evenodd clip-rule=evenodd>`),MK=e=>{let t=()=>e.active?`var(--rg-text-primary)`:`var(--rg-text-secondary)`,n=()=>e.active?e.direction===`left`?-2:2:0,r=()=>e.active?1.12:1,i=()=>e.direction===`left`?`M2.54282 10.5427C1.76177 11.3238 1.76177 12.5901 2.54282 13.3712L9.70183 20.5302C11.1193 21.9476 13.5428 20.9437 13.5428 18.9392V16.9573H21.0428C22.1474 16.9573 23.0428 16.0619 23.0428 14.9573V8.95733C23.0428 7.85276 22.1474 6.95733 21.0428 6.95733L13.5428 6.95733V4.97473C13.5428 2.9702 11.1193 1.96631 9.70183 3.38373L2.54282 10.5427Z`:`M14.2983 20.5302L21.4573 13.3712C22.2383 12.5901 22.2383 11.3238 21.4573 10.5427L14.2983 3.38374C12.8808 1.96631 10.4573 2.97019 10.4573 4.97473V6.95659L3.95728 6.95659C2.85271 6.95659 1.95728 7.85202 1.95728 8.95659V14.9566C1.95728 16.0612 2.85271 16.9566 3.95727 16.9566H10.4573V18.9392C10.4573 20.9437 12.8808 21.9476 14.2983 20.5302Z`;return(()=>{var a=jK(),o=a.firstChild;return rz(a,`pointerdown`,e.onPointerDown,!0),aR(s=>{var c=`translateX(${n()}px) scale(${r()})`,l=e.active?`transform 30ms cubic-bezier(0, 0, 0.2, 1)`:`transform 450ms cubic-bezier(0.34, 1.8, 0.64, 1)`,u=i(),d=t(),f=e.active?`fill 50ms ease`:`fill 300ms ease`;return c!==s.e&&oz(a,`transform`,s.e=c),l!==s.t&&oz(a,`transition`,s.t=l),u!==s.a&&Q(o,`d`,s.a=u),d!==s.o&&Q(o,`fill`,s.o=d),f!==s.i&&oz(o,`transition`,s.i=f),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a})()},$R([`pointerdown`]),NK=Z(`<span>`),PK=Z(`<div class="flex items-center gap-2 w-full px-2 h-[20px]"><div class="ml-auto shrink-0 flex items-center gap-1"><span data-react-grab-ignore-events role=button tabindex=-1 class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)] cursor-pointer select-none min-w-[36px] text-center">`),FK=e=>{let t=()=>e.options.find(t=>t.value===e.value)?.label??e.value;return(()=>{var n=PK(),r=n.firstChild,i=r.firstChild;return $(n,X(qR,{get when(){return e.label},get children(){var t=NK();return nz(t,`${wK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,()=>e.label),t}}),r),$(r,X(MK,{direction:`left`,get active(){return e.activeKey===`left`},onPointerDown:()=>e.onStep(-1)}),i),i.$$contextmenu=t=>{t.preventDefault(),t.stopPropagation(),e.onStep(-1)},i.$$click=t=>{t.preventDefault(),t.stopPropagation(),e.onStep(1)},i.$$mousedown=e=>e.preventDefault(),i.$$pointerdown=e=>e.stopPropagation(),$(i,t),$(r,X(MK,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)}),null),aR(t=>{var n=`Cycle ${e.label??`value`}`,r=`Click to cycle (${e.options.length} options)`;return n!==t.e&&Q(i,`aria-label`,t.e=n),r!==t.t&&Q(i,`title`,t.t=r),t},{e:void 0,t:void 0}),n})()},$R([`pointerdown`,`mousedown`,`click`,`contextmenu`]),IK=e=>e.kind===`numeric`?e:null,LK=e=>e.kind===`color`?e:null,RK=e=>e.kind===`enum`?e:null,zK=/^[0-9]$/,BK=e=>{let t=Array.from(e),n=t.findIndex(e=>zK.test(e));if(n<0)return{prefixLiterals:t,rightAlignedSegments:[]};let r=t.slice(0,n),i=[],a=0;for(let e=t.length-1;e>=n;e--){let n=t[e],r=zK.test(n)?`digit`:`literal`;i.push({kind:r,value:n,digitDistanceFromRight:a}),r===`digit`&&(a+=1)}return{prefixLiterals:r,rightAlignedSegments:i}},VK=Z(`<span class=rg-slot-column aria-hidden=true><span class=rg-slot-sizer>0</span><span class=rg-slot-cell>`),HK=Z(`<span class="rg-slot-cell rg-slot-exit">`),UK=Z(`<span><span class=inline-flex style=flex-direction:row-reverse>`),WK=Z(`<span class="inline-block whitespace-pre"aria-hidden=true>`),GK=e=>typeof e==`number`?e:Number.parseFloat(String(e).replace(/[^0-9.-]/g,``))||0,KK=e=>{let t,[n,r]=J(null),i=null;oR(dR(()=>e.digit,(n,a)=>{a===void 0||n===a||(t&&(t.classList.remove(`rg-slot-enter`),t.offsetWidth,t.classList.add(`rg-slot-enter`)),r({digit:a,direction:e.direction}),i!==null&&clearTimeout(i),i=setTimeout(()=>r(null),350))},{defer:!0})),pR(()=>{i!==null&&clearTimeout(i)});let a=()=>({"animation-delay":`${e.delayMs}ms`});return(()=>{var r=VK(),i=r.firstChild.nextSibling,o=t;return typeof o==`function`?cz(o,i):t=i,$(i,()=>e.digit),$(r,X(qR,{get when(){return n()},keyed:!0,children:e=>(()=>{var t=HK();return $(t,()=>e.digit),aR(n=>{var r=String(e.direction),i=a();return r!==n.e&&Q(t,`data-dir`,n.e=r),n.t=az(t,i,n.t),n},{e:void 0,t:void 0}),t})()}),null),aR(t=>{var n=String(e.direction),r=a();return n!==t.e&&Q(i,`data-dir`,t.e=n),t.t=az(i,r,t.t),t},{e:void 0,t:void 0}),r})()},qK=e=>{let t=Y(()=>String(e.children??``)),n=Y(()=>BK(t())),r=Y(dR(()=>GK(e.children),(e,t)=>t===void 0||e===t?0:e>t?1:-1)),i=Y(()=>e.direction??r());return(()=>{var r=UK(),a=r.firstChild;return $(r,X(KR,{get each(){return n().prefixLiterals},children:e=>(()=>{var t=WK();return $(t,e),t})()}),a),$(a,X(KR,{get each(){return n().rightAlignedSegments},children:e=>X(qR,{get when(){return e().kind===`digit`},get fallback(){return(()=>{var t=WK();return $(t,()=>e().value),t})()},get children(){return X(KK,{get digit(){return Number(e().value)},get direction(){return i()},get delayMs(){return e().digitDistanceFromRight*18}})}})})),aR(n=>{var i=t(),a=`inline-flex ${e.class??``}`,o={...e.style,"--rg-slot-dur":`350ms`};return i!==n.e&&Q(r,`aria-label`,n.e=i),a!==n.t&&nz(r,n.t=a),n.a=az(r,o,n.a),n},{e:void 0,t:void 0,a:void 0}),r})()},JK=Z(`<div data-react-grab-slider-base aria-hidden=true class="absolute inset-y-0 left-0 right-0 rounded-[6px] bg-[var(--rg-surface-active)] pointer-events-none">`),YK=Z(`<div class="flex items-center gap-1 w-full px-1"><div role=slider aria-keyshortcuts="ArrowLeft ArrowRight"tabindex=-1 class="relative flex-1 h-[20px] flex items-center overflow-hidden rounded-[6px]"><div data-react-grab-slider-fill aria-hidden=true class="absolute inset-y-0 left-0 bg-[var(--rg-surface-active)] pointer-events-none"></div><div aria-hidden=true class="absolute inset-0 pointer-events-none"></div><div data-react-grab-slider-handle aria-hidden=true class="absolute top-[2px] bottom-[2px] w-[2px] rounded-[1px] bg-[var(--rg-text-primary)] pointer-events-none"style="transition:opacity 120ms ease"></div><div class="relative z-10 flex items-center justify-between w-full px-2 pointer-events-none">`),XK=Z(`<div data-react-grab-slider-hash-mark class="absolute top-1/2 w-px h-[8px] rounded-[1px] bg-[var(--rg-text-secondary)]"style="transform:translate(-50%, -50%);transition:opacity 200ms ease">`),ZK=Z(`<span>`),QK=Z(`<span class="ml-auto flex items-center gap-1 pointer-events-auto"><span data-react-grab-value-text class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)]"><span class="text-[9px] text-[var(--rg-text-secondary)] ml-px">`),$K=Z(`<span data-react-grab-tailwind-label aria-hidden=true class="text-[10px] leading-4 text-[var(--rg-text-secondary)] tabular-nums">`),eq=Array.from({length:9},(e,t)=>(t+1)*100/10),tq=/^(-?(?:\d+\.?\d*|\.\d+))\s*([a-zA-Z%]*)$/,nq=e=>{let[t,n]=J(null),[r,i]=J(0),[a,o]=J(!1),[s,c]=J(!1),l=()=>t()!==null,u,d=null,f=()=>{let t=e.max-e.min;return t<=0?0:(Math.max(e.min,Math.min(e.max,e.value))-e.min)/t*100},p=()=>{e.onCommitValue&&n(qB(e.value))},m=()=>!!e.onCommitValue,h=(t,n)=>{if(n.width<=0)return e.value;let r=Math.max(0,Math.min(1,(t-n.left)/n.width));return e.min+r*(e.max-e.min)},g=(t,n)=>{e.onCommitValue?.(h(t,n),`pointer`)},_=(e,t)=>{let n=Math.max(0,e-t.right)-Math.max(0,t.left-e),r=Math.max(0,Math.abs(n)-32),i=Math.sqrt(Math.min(r/200,1));return Math.sign(n)*8*i},v=t=>{if(!m()||l())return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let n=u,r=n!==void 0&&t.target instanceof Node&&n.contains(t.target);d={startX:t.clientX,isDragging:!1,startedOnValueText:r,trackRect:t.currentTarget.getBoundingClientRect()},o(!0),e.onInteract?.()},y=t=>{if(!d)return;let n=t.clientX-d.startX;!d.isDragging&&Math.abs(n)<3||(d.isDragging=!0,e.onInteract?.(),g(t.clientX,d.trackRect),i(_(t.clientX,d.trackRect)))},b=e=>{let t=e.currentTarget;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),d&&(d.isDragging||(d.startedOnValueText?p():g(d.startX,d.trackRect)),d=null,o(!1),i(0))},x=e=>{let t=e.currentTarget;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),d&&(d=null,o(!1),i(0))};fR(()=>{let e=()=>{d=null,o(!1),c(!1),i(0)};window.addEventListener(`blur`,e),pR(()=>window.removeEventListener(`blur`,e))});let S=()=>!!e.activeKey||a()||s(),C=()=>{let r=t();if(r===null)return;n(null);let i=r.trim().replace(/(\d),(\d)/g,`$1.$2`).match(tq);if(!i){e.onInvalidCommit?.(),e.onEditComplete?.();return}let a=i[2].toLowerCase();if(a&&a!==e.unit){e.onInvalidCommit?.(),e.onEditComplete?.();return}let o=Number.parseFloat(i[1]);Number.isFinite(o)?e.onCommitValue?.(o,`keyboard`):e.onInvalidCommit?.(),e.onEditComplete?.()},w=()=>{l()&&(n(null),e.onEditComplete?.())},T=e=>{if(!(e.isComposing||e.keyCode===229)){if(e.stopImmediatePropagation(),e.key===`Enter`){e.preventDefault(),C();return}e.key===`Escape`&&(e.preventDefault(),w())}},E=()=>{let t=r();return{cursor:m()&&!l()?`ew-resize`:`default`,"touch-action":m()?`none`:`auto`,"user-select":`none`,"-webkit-user-select":`none`,"min-width":e.emphasized?`96px`:void 0,transform:t===0?`translateX(0)`:`translateX(${t}px)`,transition:a()?`none`:`transform 350ms ${gN}`}};return(()=>{var r=YK(),i=r.firstChild,o=i.firstChild,d=o.nextSibling,p=d.nextSibling,m=p.nextSibling;return i.addEventListener(`lostpointercapture`,x),i.addEventListener(`pointercancel`,x),i.$$pointerup=b,i.addEventListener(`pointerleave`,()=>c(!1)),i.addEventListener(`pointerenter`,()=>c(!0)),i.$$pointermove=y,i.$$pointerdown=v,$(i,X(qR,{get when(){return e.emphasized},get children(){var e=JK();return aR(t=>oz(e,`opacity`,l()?0:.55)),e}}),o),$(d,X(KR,{each:eq,children:e=>(()=>{var t=XK();return aR(n=>{var r=`${e()}%`,i=S()?.4:0;return r!==n.e&&oz(t,`left`,n.e=r),i!==n.t&&oz(t,`opacity`,n.t=i),n},{e:void 0,t:void 0}),t})()})),$(m,X(qR,{get when(){return e.label},children:e=>(()=>{var t=ZK();return nz(t,`${wK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,e),t})()}),null),$(m,X(qR,{get when(){return l()},get fallback(){return(()=>{var t=QK(),n=t.firstChild,r=n.firstChild,i=u;return typeof i==`function`?cz(i,t):u=t,$(t,X(qR,{get when(){return e.tailwindLabel},children:e=>(()=>{var t=$K();return $(t,e),t})()}),n),$(n,X(qK,{get children(){return qB(e.value)}}),r),$(r,()=>e.unit),aR(n=>{var r=`${qB(e.value)}${e.unit}`,i=e.onCommitValue?`text`:`default`;return r!==n.e&&Q(t,`data-react-grab-value`,n.e=r),i!==n.t&&oz(t,`cursor`,n.t=i),n},{e:void 0,t:void 0}),t})()},get children(){return X(CK,{autoFocusSelect:!0,inputmode:`decimal`,"aria-label":`Style value`,class:`text-[12px] leading-4 font-medium tabular-nums text-right pointer-events-auto ml-auto`,get style(){return{"field-sizing":`content`,"min-width":`16px`,"max-width":e.emphasized?`120px`:`60px`}},get value(){return t()??``},onInput:e=>n(e.currentTarget.value),onKeyDown:T,onBlur:C,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()})}}),null),$(r,X(qR,{get when(){return e.emphasized},get children(){return[X(MK,{direction:`left`,get active(){return e.activeKey===`left`},onPointerDown:()=>e.onStep(-1)}),X(MK,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)})]}}),null),aR(t=>{var n=e.label??`Value`,r=e.min,c=e.max,u=e.value,d=`${qB(e.value)}${e.unit}`,m=E(),h=`${f()}%`,g=+!l(),_=`calc(${f()}% - 1px)`,v=e.activeKey?.9:a()||s()?.35:0;return n!==t.e&&Q(i,`aria-label`,t.e=n),r!==t.t&&Q(i,`aria-valuemin`,t.t=r),c!==t.a&&Q(i,`aria-valuemax`,t.a=c),u!==t.o&&Q(i,`aria-valuenow`,t.o=u),d!==t.i&&Q(i,`aria-valuetext`,t.i=d),t.n=az(i,m,t.n),h!==t.s&&oz(o,`width`,t.s=h),g!==t.h&&oz(o,`opacity`,t.h=g),_!==t.r&&oz(p,`left`,t.r=_),v!==t.d&&oz(p,`opacity`,t.d=v),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),r})()},$R([`pointerdown`,`pointermove`,`pointerup`]),rq=e=>X(JR,{get children(){return[X(YR,{get when(){return IK(e.property)},children:t=>X(nq,{get label(){return Kz(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get min(){return t().min},get max(){return t().max},get unit(){return t().unit},get activeKey(){return e.activeKey},get onStep(){return e.onStep},get onCommitValue(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onInteract(){return e.onInteract},get tailwindLabel(){return e.tailwindLabel},get emphasized(){return e.emphasized}})}),X(YR,{get when(){return LK(e.property)},children:t=>X(AK,{get label(){return Kz(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get onCommit(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onRegisterTrigger(){return e.onColorPickerRegister},get onInteract(){return e.onInteract},get emphasized(){return e.emphasized}})}),X(YR,{get when(){return RK(e.property)},children:t=>X(FK,{get label(){return Kz(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get options(){return t().options},get activeKey(){return e.activeKey},get onStep(){return e.onStep}})})]}}),iq=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),aq=e=>X(NW,{"data-react-grab-ignore-events":!0,"data-react-grab-copy-button":!0,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.onCopy()},get children(){return iq()}}),oq=()=>{let[e,t]=J(!1),n,r=()=>{clearTimeout(n),t(!1)},i=()=>{t(!0),clearTimeout(n),n=setTimeout(()=>{t(!1)},hN)},a=()=>{clearTimeout(n)};return pR(a),{isPending:e,show:i,hide:r,cleanup:a}},sq=Z(`<div role=menu aria-orientation=vertical aria-label="Editable properties"class="relative flex flex-col w-full max-h-[var(--rg-edit-list-max-h)] overflow-y-auto outline-none no-scrollbar"><div aria-hidden=true class="pointer-events-none absolute opacity-0 transition-[top,left,width,height,opacity,border-radius] duration-75 ease-out bg-[var(--rg-surface-hover)]">`),cq=Z(`<div class="flex items-center w-full h-[24px]">`),lq=Z(`<button data-react-grab-ignore-events type=button role=menuitem tabindex=-1 class="relative z-1 contain-layout block w-full h-[24px] px-0 py-0 cursor-pointer text-left border-none bg-transparent">`),uq=Z(`<div class="flex items-center justify-between w-full h-[24px] px-2 gap-2"><span class="text-[13px] leading-4 font-sans font-medium text-[var(--rg-text-primary)] truncate min-w-0">`),dq=Z(`<span class="font-sans text-[var(--rg-text-secondary)] tabular-nums shrink-0"><span class=text-[11px]></span><span class="text-[9px] ml-px">`),fq=Z(`<span aria-hidden=true class="size-[12px] rounded-[3px] border-[var(--rg-border-button)] [border-width:0.5px] border-solid shrink-0">`),pq=Z(`<span class="text-[11px] font-sans text-[var(--rg-text-secondary)] shrink-0">`),mq=e=>{let t=RK(e);return t?t.options.find(e=>e.value===t.value)?.label??t.value:``},hq=e=>{let t=[],n,r=!1,i=null,a=()=>{if(!n)return!1;let e=bK(n);return e instanceof HTMLElement&&e.matches(`input[data-react-grab-input]`)},o=(t,n)=>{n===`move`&&(r=!0);let o=a();if(r&&!o){if(e.isAdjusting()){i=t;return}i=null,t!==e.activeIndex&&e.onHoverIndex(t)}};oR(()=>{if(e.isAdjusting())return;let n=i;if(n===null)return;i=null;let o=t[n],s=a();r&&(s||o?.matches(`:hover`)&&n!==e.activeIndex&&e.onHoverIndex(n))});let{containerRef:s,highlightRef:c,updateHighlight:l,clearHighlight:u}=aK({});oR(()=>{t.length=e.properties.length});let d;return oR(()=>{let r=e.activeIndex,i=t[r];if(!i||r<0){u();return}if(l(i),d!==void 0&&cancelAnimationFrame(d),d=requestAnimationFrame(()=>{d=void 0;let e=t[r];e&&l(e)}),!n)return;let a=n.getBoundingClientRect(),o=i.getBoundingClientRect();(o.top<a.top||o.bottom>a.bottom)&&i.scrollIntoView({block:`nearest`})}),pR(()=>{d!==void 0&&cancelAnimationFrame(d)}),(()=>{var a=sq(),l=a.firstChild;return a.$$pointermove=()=>{r=!0},cz(e=>{n=e,s(e)},a),cz(c,l),$(a,X(KR,{get each(){return e.properties},children:(r,a)=>{let s=()=>a===e.activeIndex;return(()=>{var c=lq();return c.$$click=t=>{t.stopPropagation(),e.onSelect(a)},c.$$mousedown=e=>{let t=n?bK(n):null;t instanceof HTMLElement&&t.matches(`input[data-react-grab-input]`)&&t.blur(),e.preventDefault()},c.addEventListener(`pointerleave`,()=>{i===a&&(i=null)}),c.$$pointermove=()=>{o(a,`move`)},c.addEventListener(`pointerenter`,()=>{o(a,`enter`)}),cz(e=>{t[a]=e,pR(()=>{t[a]===e&&(t[a]=void 0)})},c),$(c,X(qR,{get when(){return s()},get fallback(){return(()=>{var e=uq(),t=e.firstChild;return $(t,()=>r().label),$(e,X(JR,{get children(){return[X(YR,{get when(){return IK(r())},children:e=>(()=>{var t=dq(),n=t.firstChild,r=n.nextSibling;return $(n,()=>qB(e().value)),$(r,()=>e().unit),t})()}),X(YR,{get when(){return LK(r())},children:e=>(()=>{var t=fq();return aR(n=>oz(t,`background-color`,e().value)),t})()}),X(YR,{get when(){return RK(r())},children:e=>(()=>{var t=pq();return $(t,()=>mq(e())),t})()})]}}),null),e})()},get children(){var t=cq();return $(t,X(rq,{get property(){return r()},get activeKey(){return e.activeKey},get onStep(){return e.onStep},get onCommit(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onInteract(){return e.onInteract},get onColorPickerRegister(){return e.onColorPickerRegister},showLabel:!0,get tailwindLabel(){return e.activeTailwindLabel}})),t}})),aR(e=>{var t=r().key,n=s()?`true`:void 0;return t!==e.e&&Q(c,`data-react-grab-edit-property`,e.e=t),n!==e.t&&Q(c,`aria-current`,e.t=n),e},{e:void 0,t:void 0}),c})()}}),null),a})()},$R([`pointermove`,`mousedown`,`click`]),gq=(e,t,n)=>e.kind===`color`&&typeof t==`string`&&typeof n==`string`?t.toLowerCase()===n.toLowerCase():t===n,_q=e=>e===`ArrowLeft`?-1:1,vq=e=>{let[t,n]=J(0),r=null,i=null,a=null,o=()=>{i!==null&&clearTimeout(i),a!==null&&clearInterval(a),i=null,a=null,r=null},s=()=>{o(),n(0)},c=t=>{o(),r=t;let n=_q(t);i=setTimeout(()=>{a=setInterval(()=>{e.step(n,e.isShiftHeld(),e.isAltHeld(),!0)},60)},280)};return fR(()=>{window.addEventListener(`blur`,s),pR(()=>window.removeEventListener(`blur`,s))}),pR(s),{heldDirection:t,pressArrow:(t,r,i,a)=>{if(r)return;let o=_q(t);c(t),n(o),e.step(o,i,a,!1)},releaseKey:e=>{e===r&&s()},cancelRepeat:s}},yq=(e,t,n)=>{if(e.length===0)return null;let r=e.findIndex(e=>e.value===t),i=e[((r===-1?0:r)+n+e.length)%e.length];return!i||i.value===t?null:i},bq=(e,t,n,r,i)=>{if(e.kind===`enum`)return yq(e.options,e.value,t)?.value??null;if(e.kind!==`numeric`)return null;let a=Math.min(e.min,e.value),o=Math.max(e.max,e.value);if(!n&&!r&&e.unit===`px`&&i?.hasTokens){let n=i.stepLength(e.value,t,e.cssProperties[0]);if(n!==null){let t=JB(yB(n,a,o));if(t!==e.value)return t}}let s=n?10:1,c=JB(yB(e.value+t*s,a,o));return c===e.value?null:c},xq=/^-?\d*\.?\d+$/,Sq=e=>xq.test(e),Cq=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,``),wq=e=>{if(e.kind!==`enum`)return[];let t=[];for(let n of e.options){let e=Cq(n.value),r=Cq(n.label);e&&t.push(e),r&&r!==e&&t.push(r)}return t},Tq=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(let e of r.tailwindAliases){let i=Cq(e);i&&t.push({property:r,originalIndex:n,kind:`alias`,term:i})}for(let e of wq(r))t.push({property:r,originalIndex:n,kind:`enum-option`,term:e});let i=Cq(r.label);i&&t.push({property:r,originalIndex:n,kind:`name`,term:i});let a=Cq(r.key);a&&a!==i&&t.push({property:r,originalIndex:n,kind:`name`,term:a});let o=Cq(`${r.label} ${r.key}`);o&&t.push({property:r,originalIndex:n,kind:`label`,term:o})}return t},Eq=(e,t)=>{if(t.kind===`alias`||t.kind===`enum-option`||t.kind===`name`)return e===t.term?yN+t.term.length:t.term.startsWith(e)||e.startsWith(t.term)?bN+Math.min(e.length,t.term.length):null;let n=t.term.indexOf(e);return n===-1?null:n===0?xN-t.term.length*1:SN-n*100-t.term.length*1},Dq=(e,t,n,r)=>{let i=e.get(t.key);i&&i.score>=r||e.set(t.key,{property:t,score:r,originalIndex:n})},Oq=e=>{let t=Tq(e),n=new Map;for(let t=0;t<e.length;t++)n.set(e[t].key,t);let r=(t,r,i)=>{for(let a=0;a<r.length;a++){let o=r[a],s=n.get(o);if(s===void 0)continue;let c=e[s];Dq(t,c,s,i-a)}};return{search:n=>{let i=Cq(n);if(!i||Sq(i))return e;let a=new Map;r(a,yV(n),_N),r(a,bV(n),vN);for(let e of t){let t=Eq(i,e);t!==null&&Dq(a,e.property,e.originalIndex,t)}return Array.from(a.values()).sort((e,t)=>t.score===e.score?e.originalIndex-t.originalIndex:t.score-e.score).map(e=>e.property)}}},kq=(e,t)=>e.kind===t.kind&&!gq(e,t.value,e.original),Aq=e=>{let{initialProperties:t,searchQuery:n}=e,[r,i]=J({}),a=Oq(t),o=Y(()=>{let e=n(),i=r(),o=e?t:t.filter(e=>e.isPrioritized||e.isCanonical&&!e.isDefault||i[e.key]!==void 0);return e?a.search(e):o.slice(0,40)}),s=new Map(t.map(e=>[e.key,e])),c=Y(()=>{let e=r(),t=Object.keys(e);if(t.length===0)return o();let n=new Map;for(let r of t){let t=e[r];if(t.kind!==`numeric`)continue;let i=s.get(r);if(i)for(let e of i.cssProperties)n.set(e,t.value)}return o().map(t=>{let r=e[t.key];if(r!==void 0)return l(t,r);if(t.kind!==`numeric`)return t;let i=n.get(t.cssProperties[0]);return i===void 0?t:t.cssProperties.every(e=>n.get(e)===i)?{...t,value:i}:t})}),l=(e,t)=>e.kind===`numeric`&&t.kind===`numeric`||e.kind===`color`&&t.kind===`color`||e.kind===`enum`&&t.kind===`enum`?{...e,value:t.value}:e;return{filteredProperties:c,applyStyle:(e,t)=>{let n;if(e.kind===`numeric`&&typeof t==`number`)n={kind:`numeric`,value:t};else if(e.kind===`color`&&typeof t==`string`)n={kind:`color`,value:t};else if(e.kind===`enum`&&typeof t==`string`)n={kind:`enum`,value:t};else return;i(t=>{let r=Object.keys(t);if(r[r.length-1]===e.key)return{...t,[e.key]:n};let i={};for(let n of r){if(n===e.key)continue;let r=s.get(n);r!==void 0&&r.cssProperties.every(t=>e.cssProperties.includes(t))||(i[n]=t[n])}return i[e.key]=n,i})},buildPendingEdits:()=>{let e=r(),t=[],n=new Set;for(let r of Object.keys(e)){let i=e[r],a=s.get(r);if(!a||a.kind!==i.kind)continue;let o=kq(a,i),c=!o&&a.cssProperties.some(e=>n.has(e));if(!(!o&&!c)){if(o)for(let e of a.cssProperties)n.add(e);a.kind===`numeric`&&i.kind===`numeric`?t.push({kind:`numeric`,key:a.key,cssProperties:a.cssProperties,value:i.value,unit:a.unit}):a.kind===`color`&&i.kind===`color`?t.push({kind:`color`,key:a.key,cssProperties:a.cssProperties,value:i.value}):a.kind===`enum`&&i.kind===`enum`&&t.push({kind:`enum`,key:a.key,cssProperties:a.cssProperties,value:i.value})}}return t},hasPendingStyles:()=>{let e=r();for(let n of t){let t=e[n.key];if(t&&kq(n,t))return!0}return!1},hasChangedStyleFor:e=>{let t=r()[e],n=s.get(e);return!!(t&&n&&kq(n,t))}}},jq=new Map;for(let e of LB)for(let t of e)jq.set(t.key,t.longhands);Mq=e=>{if(e.includes(`,`))return e.split(`,`);let t=jq.get(e);return t?[...t]:[e]},Nq=/^-?(?:\d+\.?|\d*\.\d*)?$/,Pq=e=>Nq.test(e),Fq=e=>{let t=e.startsWith(`-`);return{isNegative:t,base:t?e.slice(1):e}},Iq=/^([a-z-]+)-(-?\d+(?:\.\d+)?)$/,Lq=/^(.+?)-\[(.+)]$/,Rq=/^(-?\d*\.?\d+)\s*([a-zA-Z%]*)$/,zq=/^(-?\d*\.?\d+)(px|rem)?$/i,Bq=/^(?:length|size):/i,Vq=new Set([`opacity`,`border-width`,`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`,`z-index`,`font-weight`]),Hq=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`numeric`)return n;return null},Uq=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`enum`)return n;return null},Wq=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`color`)return n;return null},Gq=e=>{let t=e.replace(/^(?:color|length|size):/i,``).trim();return/(?:var|url)\(/i.test(t)?t:t.replace(/_/g,` `)},Kq=e=>{let t=e.lastIndexOf(`:`),n=t>=0?e.slice(t+1):e;return(n.startsWith(`!`)?n.slice(1):n).toLowerCase()},qq=(e,t)=>{let n=e.match(zq);if(!n)return null;let r=n[2]?.toLowerCase();if(!r&&!t)return null;let i=Number.parseFloat(n[1]);return Number.isFinite(i)?r===`rem`?i*16:i:null},Jq=(e,t)=>{let n=Mq(t),r=new Map;for(let t of n)for(let n of e)n.kind===`numeric`&&n.cssProperties.includes(t)&&r.set(n.key,n);return Array.from(r.values())},Yq=(e,t)=>JB(yB(t,e.min,e.max)),Xq=e=>{let{initialProperties:t,searchQuery:n,isCompact:r,activeProperty:i,commit:a,setIsCompact:o}=e,s=e=>{for(let n of t)if(n.key===e&&(n.kind===`numeric`||n.kind===`enum`))return!0;return Jq(t,e).length>0},c=e=>{let t=e.trim().replace(/(\d),(\d)/g,`$1.$2`).match(Rq);if(!t)return null;let n=Number.parseFloat(t[1]);return Number.isFinite(n)?{value:n,unit:t[2].toLowerCase()}:null},l=(e,t)=>!e||t.toLowerCase().startsWith(e),u=e=>{if(!r())return!1;let t=i();if(t?.kind!==`numeric`)return!1;let n=c(e);return n?l(n.unit,t.unit):Pq(e)},d=Y(()=>u(n())),f=e=>{if(!r())return!1;let t=i();if(t?.kind!==`numeric`)return!1;let n=c(e);if(!n)return!1;let o=t.unit.toLowerCase();if(n.unit!==``&&n.unit!==o)return l(n.unit,t.unit);let s=Yq(t,n.value);return s!==t.value&&a(t,s),!0},p=(e,n)=>{let r=Hq(t,e);if(r)return r.unit===`px`?(o(!0),a(r,Yq(r,n),{shouldCompact:!0}),!0):!1;let i=Jq(t,e);return i.length===0?!1:(o(!0),lR(()=>{for(let e of i)a(e,Yq(e,n),{shouldCompact:!0})}),!0)},m=(e,n)=>{let r=pV(e);if(!r)return!1;let i=Wq(t,r);if(!i)return!1;let s=n===null?hV(e):vB(n);return s?(o(!0),a(i,s,{shouldCompact:!0}),!0):!1},h=e=>{let t=e.trim(),n=t.match(Lq);if(!n)return!1;let r=n[2],i=Gq(r);if(m(t,i))return!0;let a=qq(i,Bq.test(r.trim()));if(a===null)return!1;let{isNegative:o,base:s}=Fq(n[1]),c=CV(Kq(s));return c?p(c,o?-a:a):!1},g=e=>{if(h(e))return;let n=uV(e),{isNegative:r,base:i}=Fq(n),c=i.replace(/-\d*$/,``).replace(/-$/,``),l=c?CV(c):null;if(l&&s(l)&&o(!0),!r){if(m(n,null))return;let e=wV(n);if(e){let n=Uq(t,e.property);if(!n)return;let r=n.options.find(t=>t.value===e.value);r&&(o(!0),a(n,r.value,{shouldCompact:!0}));return}}let u=i.match(Iq);if(!u)return;let d=CV(u[1]);if(!d)return;let f=Number.parseFloat(u[2]);if(!Number.isFinite(f))return;let p=r?-f:f,g=Vq.has(d)?p:p*4,_=Hq(t,d);if(_){a(_,Yq(_,g),{shouldCompact:!0});return}if(!r){let e=Uq(t,d);if(e){let t=String(f),n=e.options.find(e=>e.value===t);if(n){a(e,n.value,{shouldCompact:!0});return}}}let v=Jq(t,d);v.length!==0&&lR(()=>{for(let e of v)a(e,Yq(e,g),{shouldCompact:!0})})},_=e=>{if(wV(e))return!0;let{base:n}=Fq(e),r=n.match(Iq);if(!r)return!1;let i=CV(r[1]);return i?s(i)?!0:Uq(t,i)!==null:!1};return{isInlineNumericEdit:d,isInlineNumericDraft:u,tryApplyNumericValue:f,applyTailwindClass:e=>{let t=e.trim().replace(/^class\s*=\s*["']/,``).replace(/["']\s*$/,``).replace(/\s+\[/g,`-[`),n=uV(t),r=t.split(/\s+/).filter(Boolean);if(r.length>1&&!_(n)){for(let e of r)g(e);return}g(t)}}},Zq=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),Qq=Z(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),$q=Z(`<div role=alertdialog aria-modal=true aria-labelledby=rg-discard-prompt-title class="contain-layout shrink-0 flex items-center justify-between gap-2 pt-1.5 pb-1 px-2 w-full self-stretch"><span id=rg-discard-prompt-title class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium">Discard edits?</span><div class="flex items-center gap-[5px]">`),eJ=Z(`<div><textarea data-react-grab-ignore-events data-react-grab-input aria-label="Search properties"aria-keyshortcuts="Enter Escape ArrowUp ArrowDown ArrowLeft ArrowRight Tab"autocapitalize=none autocorrect=off autocomplete=off class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-medium bg-transparent border-none resize-none w-full p-0 m-0 outline-none"rows=1 style=caret-color:var(--rg-text-primary);field-sizing:content;min-height:16px;max-height:16px;scrollbar-width:none>`),tJ=Z(`<div>`),nJ=Z(`<div role=dialog aria-modal=true aria-label="Style element"data-react-grab-ignore-events data-react-grab-edit-panel>`),rJ=Z(`<div class="flex items-center justify-center w-full px-3 py-1.5 min-h-[28px]">`),iJ=e=>X(qR,{get when(){return e.state},children:t=>X(qR,{keyed:!0,get when(){return t().element},children:n=>X(aJ,{get state(){return t()},position:()=>e.position,get onDismiss(){return e.onDismiss},get onSubmit(){return e.onSubmit},get onPendingEditsChange(){return e.onPendingEditsChange},get onInteractingChange(){return e.onInteractingChange}})})}),aJ=e=>{let t=e.state.properties,n,r=e.state.preview,[i,a]=J(e.state.initialSearchQuery??``),[o,s]=J(null),[c,l]=J(null),u=Aq({initialProperties:t,searchQuery:()=>o()??i()}),d=()=>{let e=u.filteredProperties().findIndex(e=>e.kind===`numeric`);return e>0?e:0},[f,p]=J(d()),m=Y(()=>u.hasPendingStyles()),h=Y(()=>m()||!!e.state.hasSessionEdits),[g,_]=J(!1),v,y,b,x=!1,[S,C]=J(!1),w=Y(()=>S()||m()),[T,E]=J(!1),D=MV(),O=Y(()=>sW({tagName:e.state.tagName,componentName:e.state.componentName})),k=Y(()=>{let e=u.filteredProperties();return e.length===0?null:e[Math.min(Math.max(0,f()),e.length-1)]}),ee,te=_K(()=>ee,e.position),A=e=>{l(e),clearTimeout(v),v=setTimeout(()=>{l(t=>t===e?null:t)},100)},ne=Y(()=>w()&&!T());oR(()=>{let t=ne();e.onInteractingChange?.(t)});let re=()=>{C(!0),clearTimeout(y),y=setTimeout(()=>{C(!1)},150)},ie=()=>{queueMicrotask(()=>{n&&bK(n)!==n&&nW(n,{preventScroll:!0})})},ae=()=>{o()===null&&s(i())},oe=()=>{x=!1,clearTimeout(b)},se=()=>{x=!1,clearTimeout(b),b=setTimeout(()=>{x=!0},500)},ce=e=>{let t=e.trim(),n=t.replace(/^-/,``).replace(`.`,``);/[a-z%]+$/i.test(t)||n.length>1?se():oe()},le=e=>{if(!x)return e;let t=i();if(!t||!e.startsWith(t))return oe(),e;let n=e.slice(t.length);return/^[-.\d]/.test(n)?(oe(),n):e},ue=e=>{if(!x||e.metaKey||e.ctrlKey||e.altKey||!/^[-.\d]$/.test(e.key))return!1;e.preventDefault(),e.stopImmediatePropagation(),oe();let t=e.key;return n&&(n.value=t),xe.tryApplyNumericValue(t)?(ae(),a(t),ce(t),ie(),!0):(a(t),ie(),!0)},de=()=>{oe(),s(null),_(!1)},fe=(t,n,i={})=>{u.applyStyle(t,n),r.apply(t.cssProperties,YB(t,n)),e.onPendingEditsChange?.(u.buildPendingEdits()),re(),i.isFromKeyRepeat||we.hide(),i.flashDirection&&A(i.flashDirection===1?`right`:`left`),i.shouldFocus&&ie(),i.shouldCompact&&_(!0),i.source===`keyboard`&&D.arm()},pe=OV(e=>e.shiftKey),me=OV(e=>e.altKey),he=(t,n,r,i,a)=>{let o=k();if(!o)return null;let s=bq(o,t,n,r,e.state.designTokens);return s===null?(A(t===1?`right`:`left`),null):(fe(o,s,{flashDirection:t,shouldFocus:!0,isFromKeyRepeat:i,source:a}),o)},ge=(e,t,n,r)=>{he(e,t,n,r,`keyboard`)&&_(!0)},_e=e=>{he(e,!1,!1,!1,`pointer`)},ve=vq({step:ge,isShiftHeld:pe,isAltHeld:me}),ye=(e,t)=>{let n=k();if(n){if(n.kind===`numeric`&&typeof e==`number`){let r=JB(yB(e,n.min,n.max));r!==n.value&&fe(n,r,{source:t});return}typeof e==`string`&&(gq(n,e,n.value)||fe(n,e,{source:t}))}},be=Y(()=>{if(!pe())return null;let e=k();return!e||e.kind!==`numeric`?null:yK(e.key,e.value)}),xe=Xq({initialProperties:t,searchQuery:i,isCompact:g,activeProperty:k,commit:(e,t,n)=>{fe(e,t,{...n,source:`keyboard`})},setIsCompact:_}),Se=Y(()=>g()&&i()!==``&&xe.isInlineNumericEdit()),Ce=()=>{we.hide(),D.clear(),e.onSubmit(u.buildPendingEdits())},we=oq(),Te,Ee=()=>{Te&&(Te.classList.remove(`animate-shake`),Te.offsetWidth,Te.classList.add(`animate-shake`))},De=t=>{we.hide(),t===`discard`&&r.restore(),e.onDismiss()},Oe=e=>{if(ve.cancelRepeat(),e===`pointer`&&D.clear(),we.isPending()){De(`discard`);return}if(!h()){De(r.hasAppliedStyles()?`discard`:`preserve`);return}let t=g();de(),!(e===`keyboard`&&t)&&(we.show(),Ee())},ke=e=>{let t=u.filteredProperties();t.length!==0&&(p(n=>(n+e+t.length)%t.length),de())},Ae=()=>{D.clear(),we.hide()},je=[],Me=e=>(je.push(e),()=>{je=je.filter(t=>t!==e)}),Ne=()=>je[je.length-1]??null,Pe=(e,t)=>{if(k()?.kind===`color`){t.repeat||Ne()?.();return}ve.pressArrow(e,t.repeat,t.shiftKey,t.altKey)},Fe={ArrowUp:()=>ke(-1),ArrowDown:()=>ke(1),ArrowLeft:e=>Pe(`ArrowLeft`,e),ArrowRight:e=>Pe(`ArrowRight`,e),Tab:e=>ke(e.shiftKey?-1:1),Enter:()=>{if(we.isPending())return;let e=k(),t=Ne();if(e?.kind===`color`&&!u.hasChangedStyleFor(e.key)&&t&&!h()){t();return}Ce()},Escape:()=>Oe(`keyboard`)},Ie=e=>{if(e.isComposing||e.keyCode===229)return;if(we.isPending()){let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.closest(`[data-react-grab-discard-button]`)!==null&&(e.key===`Tab`||e.key===`Enter`))return;if(e.key===`Tab`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault(),e.stopImmediatePropagation();return}}let t=Fe[e.key];t&&(e.preventDefault(),e.stopImmediatePropagation(),t(e))};fR(()=>{queueMicrotask(()=>{if(nW(n,{preventScroll:!0}),n){let e=n.value.length;n.setSelectionRange(e,e)}}),te.measure();let e=i();e&&xe.applyTailwindClass(e);let t=dK({isOpen:()=>!0,onDismiss:Oe,shouldIgnoreKeyboardEvent:e=>{let t=e.composedPath()[0];return we.isPending()&&t instanceof HTMLElement&&t.closest(`[data-react-grab-discard-button]`)!==null},shouldIgnoreRightClick:!0,shouldIgnoreInputEvents:!0}),r=EM(e=>{CB(e,`data-react-grab-input`)||ue(e)||Ie(e)}),a=EM(e=>{ve.releaseKey(e.key)}),o=EM(e=>{e.pointerType===`mouse`&&(we.isPending()||D.consume()&&h()&&Oe(`pointer`))});window.addEventListener(`keydown`,r,{capture:!0}),window.addEventListener(`keyup`,a,{capture:!0}),window.addEventListener(`pointermove`,o,{capture:!0}),pR(()=>{t(),window.removeEventListener(`keydown`,r,{capture:!0}),window.removeEventListener(`keyup`,a,{capture:!0}),window.removeEventListener(`pointermove`,o,{capture:!0}),clearTimeout(v),clearTimeout(y),clearTimeout(b),we.cleanup(),te.clearAnimationHandles(),C(!1)})});let j=e=>{p(e),ie()};return X(qR,{get when(){return te.shouldMount()},get children(){var e=nJ();rz(e,`contextmenu`,uK,!0),rz(e,`click`,uK,!0),rz(e,`mousedown`,uK,!0),rz(e,`pointerdown`,uK,!0);var t=ee;return typeof t==`function`?cz(t,e):ee=e,oz(e,`z-index`,`${LM}`),oz(e,`--rg-edit-list-max-h`,`280px`),$(e,X(TW,{ref:e=>Te=e,class:`flex flex-col justify-center items-start overflow-hidden w-fit h-fit`,get style(){return{"min-width":g()?void 0:`200px`,"max-width":`320px`,transform:`translateX(${ve.heldDirection()*2}px)`,transition:`transform 280ms ${gN}`}},get children(){return[X(qR,{get when(){return we.isPending()},get fallback(){return X(qR,{get when(){return!g()},get children(){var e=tJ();return e.addEventListener(`mouseleave`,()=>E(!1)),e.addEventListener(`mouseenter`,()=>E(!0)),$(e,X(yW,{get tagName(){return O().tagName},get componentName(){return O().componentName},isClickable:!1,onClick:()=>{},shrink:!0}),null),$(e,X(qR,{get when(){return h()},get children(){return X(aq,{onCopy:Ce})}}),null),aR(()=>nz(e,oW(`contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 h-fit px-2`,h()?`w-full self-stretch justify-between`:`w-fit`))),e}})},get children(){var e=$q(),t=e.firstChild.nextSibling;return $(t,X(NW,{"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`cancel`,onClick:e=>{e.preventDefault(),e.stopPropagation(),Ae()},get children(){return Zq()}}),null),$(t,X(NW,{variant:`destructive`,"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`confirm`,onClick:e=>{e.preventDefault(),e.stopPropagation(),De(`discard`)},get children(){return Qq()}}),null),e}}),(()=>{var e=eJ(),t=e.firstChild;return t.$$keydown=Ie,t.$$input=e=>{let t=le(e.currentTarget.value);if(t!==e.currentTarget.value&&(e.currentTarget.value=t),xe.tryApplyNumericValue(t)){ae(),a(t),ce(t),ie();return}if(oe(),xe.isInlineNumericDraft(t)){ae(),a(t),ie();return}a(t),s(null),p(t.trim()===``?d():0),de(),xe.applyTailwindClass(t)},cz(e=>{n=e},t),Q(t,`spellcheck`,!1),aR(n=>{var r=Se()?``:`[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start px-2 py-1.5 w-full self-stretch [border-top-width:0.5px] border-t-solid border-t-[var(--rg-border-subtle)] antialiased`,i=Se()?TK:void 0,a=Se()?-1:0,o=g()?k()?.label??`Search property`:`Search property`;return r!==n.e&&nz(e,n.e=r),n.t=az(e,i,n.t),a!==n.a&&Q(t,`tabindex`,n.a=a),o!==n.o&&Q(t,`placeholder`,n.o=o),n},{e:void 0,t:void 0,a:void 0,o:void 0}),aR(()=>t.value=i()),e})(),X(qR,{get when(){return u.filteredProperties().length>0},get children(){var e=tJ();return $(e,X(hq,{get properties(){return u.filteredProperties()},get activeIndex(){return f()},get activeKey(){return c()},onHoverIndex:p,onSelect:j,onStep:_e,onCommit:ye,onColorPickerRegister:Me,onEditComplete:ie,onInvalidCommit:Ee,onInteract:re,isAdjusting:S,get activeTailwindLabel(){return be()}})),aR(t=>{var n=g()?``:`[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start w-full self-stretch antialiased`,r=g()?TK:void 0;return n!==t.e&&nz(e,t.e=n),t.t=az(e,r,t.t),t},{e:void 0,t:void 0}),e}}),X(qR,{get when(){return Kz(()=>!!g())()&&k()},children:e=>(()=>{var t=rJ();return t.$$mousedown=e=>e.preventDefault(),$(t,X(rq,{get property(){return e()},get activeKey(){return c()},onStep:_e,onCommit:ye,onEditComplete:ie,onInvalidCommit:Ee,onInteract:re,onColorPickerRegister:Me,showLabel:!1,get tailwindLabel(){return be()},emphasized:!0})),t})()})]}})),aR(t=>{var n=g()?`true`:`false`,r=oW(`fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none`,te.isAnimatedIn()?`transition-[opacity,transform] duration-220 ease-spring`:`transition-[opacity,transform] duration-120 ease-drawer`),i=`${te.displayPosition().top}px`,a=`${te.displayPosition().left}px`,o=te.isAnimatedIn()?`auto`:`none`,s=dN[te.lastAnchorEdge()],c=te.isAnimatedIn()?`1`:`0`,l=te.isAnimatedIn()?`scale(1)`:`scale(0.92)`;return n!==t.e&&Q(e,`data-rg-compact`,t.e=n),r!==t.t&&nz(e,t.t=r),i!==t.a&&oz(e,`top`,t.a=i),a!==t.o&&oz(e,`left`,t.o=a),o!==t.i&&oz(e,`pointer-events`,t.i=o),s!==t.n&&oz(e,`transform-origin`,t.n=s),c!==t.s&&oz(e,`opacity`,t.s=c),l!==t.h&&oz(e,`transform`,t.h=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e}})},$R([`pointerdown`,`mousedown`,`click`,`contextmenu`,`input`,`keydown`]),oJ=Z(`<div data-react-grab-ignore-events>`),sJ=e=>{let t,n=()=>e.interactive!==!1,r=_K(()=>t,()=>e.position);return fR(()=>{r.measure();let t=e.onDismiss?dK({isOpen:()=>!!e.position,onDismiss:e.onDismiss}):void 0;pR(()=>{r.clearAnimationHandles(),t?.()})}),X(qR,{get when(){return r.shouldMount()},get children(){var i=oJ(),a=t;return typeof a==`function`?cz(a,i):t=i,sz(i,UR(()=>({[e.dataAttribute]:``}),{get class(){return oW(`fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none will-change-[opacity,transform]`,r.isAnimatedIn()?`transition-[opacity,transform] duration-220 ease-spring`:`transition-[opacity,transform] duration-120 ease-drawer`)},get style(){return{top:`${r.displayPosition().top}px`,left:`${r.displayPosition().left}px`,"z-index":`${LM}`,"pointer-events":n()&&r.isAnimatedIn()?`auto`:`none`,"transform-origin":dN[r.lastAnchorEdge()],opacity:r.isAnimatedIn()?`1`:`0`,transform:r.isAnimatedIn()?`scale(1)`:`scale(0.92)`}},onPointerDown:uK,onMouseDown:uK,onClick:uK,onContextMenu:uK}),!1,!0),$(i,()=>e.children),i}})},cJ=e=>{let t=oK({clearActiveOnPointerLeave:!0,highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:sN}});return X(sJ,{get position(){return e.position},dataAttribute:`data-react-grab-toolbar-menu`,get onDismiss(){return e.onDismiss},get children(){return X(sK.Panel,{class:`overflow-hidden`,style:{"min-width":`100px`},get children(){return X(sK.Provider,{store:t,get children(){return X(sK.List,{label:`Default action`,get children(){return X(GR,{get each(){return e.actions},children:t=>{let n=()=>t.id===e.defaultActionId;return X(sK.Item,{get value(){return t.id},role:`menuitemradio`,get checked(){return n()},onSelect:()=>{e.onSetDefaultAction(t.id),e.onDismiss()},get children(){return[X(sK.Label,{get class(){return n()?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)]`},get children(){return t.label}}),X(qR,{get when(){return t.shortcut},children:e=>X(sK.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})}})}})}})}})}})},lJ=Z(`<span aria-hidden=true class="shrink-0 font-mono text-[11px] leading-4 text-[var(--rg-text-secondary)] opacity-60 mr-1">`),uJ=Z(`<span class=text-[var(--rg-text-secondary)]>.`),dJ=Z(`<span class="flex items-center min-w-0 w-full"><span class="text-[13px] leading-4 h-fit font-medium overflow-hidden text-ellipsis whitespace-nowrap min-w-0 transition-colors">`),fJ=e=>{let t=()=>e.state?.activeIndex??0,n=oK({value:()=>String(t()),highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:sN}});return X(sJ,{get position(){return e.position},dataAttribute:`data-react-grab-hierarchy-menu`,interactive:!1,get children(){return X(sK.Panel,{class:`overflow-hidden`,style:{"min-width":`160px`},get children(){return X(sK.Provider,{store:n,get children(){return X(sK.List,{label:`Navigate element hierarchy`,get children(){return X(GR,{get each(){return e.state?.items??[]},children:(e,n)=>X(sK.Item,{get value(){return String(n())},role:`menuitemradio`,get checked(){return n()===t()},get children(){var r=dJ(),i=r.firstChild;return $(r,X(qR,{get when(){return e.depth>0},get children(){var t=lJ();return $(t,()=>e.isLast?`└─`:`├─`),aR(n=>oz(t,`padding-left`,`${(e.depth-1)*12}px`)),t}}),i),$(i,X(qR,{get when(){return e.componentName},get children(){return[Kz(()=>e.componentName),uJ()]}}),null),$(i,()=>e.tagName,null),aR(e=>{var r=n()===t(),a=n()!==t();return r!==e.e&&i.classList.toggle(`text-[var(--rg-text-primary)]`,e.e=r),a!==e.t&&i.classList.toggle(`text-[var(--rg-text-secondary)]`,e.t=a),e},{e:void 0,t:void 0}),r}})})}})}})}})}})},pJ=e=>[X(QU,{get selectionVisible(){return e.selectionVisible},get selectionBounds(){return e.selectionBounds},get selectionBoundsMultiple(){return e.selectionBoundsMultiple},get selectionShouldSnap(){return e.selectionShouldSnap},get dragVisible(){return e.dragVisible},get dragBounds(){return e.dragBounds},get grabbedBoxes(){return e.grabbedBoxes},get labelInstances(){return e.labelInstances}}),X(eW,{get visible(){return e.isFrozen??!1}}),X(qR,{get when(){return Kz(()=>!!e.selectionLabelVisible)()&&(e.frozenLabelEntries?.length??0)>0},get children(){return X(KR,{get each(){return e.frozenLabelEntries??[]},children:(t,n)=>X(uG,{get tagName(){return t().tagName},get componentName(){return t().componentName},get selectionBounds(){return t().bounds},get mouseX(){return t().mouseX},visible:!0,shouldToggleExpandOnClick:n===0,get onToggleExpand(){return n===0?e.onToggleExpand:void 0}})})}}),X(qR,{get when(){return Kz(()=>!!e.selectionLabelVisible)()&&e.pendingShiftPreviewEntry},children:e=>X(uG,{get tagName(){return e().tagName},get componentName(){return e().componentName},get selectionBounds(){return e().bounds},get mouseX(){return e().mouseX},visible:!0})}),X(qR,{get when(){return Kz(()=>!!(e.selectionLabelVisible&&e.selectionBounds))()&&(e.frozenLabelEntries?.length??0)===0},get children(){return X(uG,{get tagName(){return e.selectionTagName},get componentName(){return e.selectionComponentName},get elementsCount(){return e.selectionElementsCount},get selectionBounds(){return e.selectionBounds},get mouseX(){return e.mouseX},get visible(){return e.selectionLabelVisible},get isPromptMode(){return e.isPromptMode},get inputValue(){return e.inputValue},get status(){return e.selectionLabelStatus},get filePath(){return e.selectionFilePath},get onInputChange(){return e.onInputChange},get onSubmit(){return e.onInputSubmit},get onToggleExpand(){return e.onToggleExpand},get selectionLabelShakeCount(){return e.selectionLabelShakeCount},get onConfirmDismiss(){return e.onConfirmDismiss},get discardPrompt(){return e.discardPrompt},onOpen:()=>{e.selectionFilePath&&CI(e.selectionFilePath,e.selectionLineNumber)},get isContextMenuOpen(){return e.contextMenuPosition!==null}})}}),X(KR,{get each(){return e.labelInstances??[]},children:t=>X(uG,{get tagName(){return t().tagName},get componentName(){return t().componentName},get elementsCount(){return t().elementsCount},get selectionBounds(){return t().bounds},get mouseX(){return t().mouseX},visible:!0,get status(){return t().status},get statusText(){return t().statusText},get isPromptMode(){return t().isPromptMode},get inputValue(){return t().inputValue},get error(){return t().errorMessage},get hideArrow(){return t().hideArrow},get onShowContextMenu(){let n=t();if(!(!(n.status===`copied`||n.status===`fading`)||!Jz(n.element)))return()=>e.onShowContextMenuInstance?.(n.id)},onHoverChange:n=>e.onLabelInstanceHoverChange?.(t().id,n)})}),X(qR,{get when(){return e.toolbarVisible!==!1},get children(){return X(RG,{get isActive(){return e.isActive},get isContextMenuOpen(){return e.contextMenuPosition!==null},get onToggle(){return e.onToggleActive},get onActivateAction(){return e.onActivateAction},get activeActionId(){return e.activeActionId},get enabled(){return e.enabled},get shakeCount(){return e.shakeCount},get onStateChange(){return e.onToolbarStateChange},get onSubscribeToStateChanges(){return e.onSubscribeToToolbarStateChanges},get onSelectHoverChange(){return e.onToolbarSelectHoverChange},get onContainerRef(){return e.onToolbarRef},get onToggleToolbarMenu(){return e.onToggleToolbarMenu}})}}),X(mK,{get position(){return e.contextMenuPosition??null},get selectionBounds(){return e.contextMenuBounds??null},get tagName(){return e.contextMenuTagName},get componentName(){return e.contextMenuComponentName},get hasFilePath(){return e.contextMenuHasFilePath??!1},get actions(){return e.actions},get actionContext(){return e.actionContext},get onDismiss(){return e.onContextMenuDismiss??(()=>{})},get onHide(){return e.onContextMenuHide??(()=>{})}}),X(cJ,{get position(){return e.toolbarMenuPosition??null},get actions(){return e.toolbarMenuActions??[]},get defaultActionId(){return e.defaultActionId??`copy`},get onSetDefaultAction(){return e.onSetDefaultAction??(()=>{})},get onDismiss(){return e.onToolbarMenuDismiss??(()=>{})}}),X(fJ,{get position(){return e.hierarchyMenuPosition??null},get state(){return e.hierarchyState}}),X(iJ,{get state(){return e.editPanelState??null},get position(){return e.editPanelPosition??null},get onDismiss(){return e.onEditPanelDismiss??(()=>{})},get onSubmit(){return e.onEditPanelSubmit??(()=>{})},get onPendingEditsChange(){return e.onEditPanelPendingEditsChange},get onInteractingChange(){return e.onEditPanelInteractingChange}})]}));function hJ(e){let t=e[xz];if(!t&&(Object.defineProperty(e,xz,{value:t=new Proxy(e,PJ)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let i=0,a=n.length;i<a;i++){let a=n[i];r[a].get&&Object.defineProperty(e,a,{enumerable:r[a].enumerable,get:r[a].get.bind(t)})}}return t}function gJ(e){let t;return typeof e==`object`&&!!e&&(e[xz]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function _J(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[AJ])return n;if(!gJ(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=_J(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=_J(i,t))!==i&&(e[a]=r))}return e}function vJ(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function yJ(e,t,n){if(e[t])return e[t];let[r,i]=J(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function bJ(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===xz||t===jJ?n:(delete n.value,delete n.writable,n.get=()=>e[xz][t],n)}function xJ(e){mR()&&yJ(vJ(e,jJ),NJ)()}function SJ(e){return xJ(e),Reflect.ownKeys(e)}function CJ(e,t,n,r=!1){if(!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[MJ]&&e[MJ][t]&&i!==void 0&&e[MJ][t].$()):(e[t]=n,e[MJ]&&e[MJ][t]&&i===void 0&&e[MJ][t].$());let o=vJ(e,jJ),s;if((s=yJ(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=yJ(o,`length`,a))&&s.$(e.length)}(s=o[NJ])&&s.$()}function wJ(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];CJ(e,i,t[i])}}function TJ(e,t){if(typeof t==`function`&&(t=t(e)),t=_J(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&&CJ(e,n,r)}CJ(e,`length`,r)}else wJ(e,t)}function EJ(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(Array.isArray(r)){for(let i=0;i<r.length;i++)EJ(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&EJ(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)EJ(e,[r].concat(t),n);return}else if(t.length>1){EJ(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=_J(a),r===void 0||gJ(i)&&gJ(a)&&!Array.isArray(a)?wJ(i,a):CJ(e,r,a))}function DJ(...[e,t]){let n=_J(e||{}),r=Array.isArray(n),i=hJ(n);function a(...e){lR(()=>{r&&e.length===1?TJ(n,e[0]):EJ(n,e)})}return[i,a]}function OJ(e){return t=>{if(gJ(t)){let n;(n=FJ.get(t))||FJ.set(t,n=new Proxy(t,IJ)),e(n)}return t}}var kJ,AJ,jJ,MJ,NJ,PJ,FJ,IJ,LJ,RJ,zJ,BJ,VJ,HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,zY,BY,VY,HY,UY,WY,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX,rX,iX,aX,oX,sX,cX,lX,uX,dX,fX,pX,mX,hX,gX,_X,vX,yX,bX,xX,SX,CX,wX,TX,EX,DX,OX,kX,AX,jX,MX,NX,PX,FX,IX,LX,RX,zX,BX,VX,HX,UX,WX,GX,KX,qX,JX,YX,XX,ZX,QX,$X,eZ,tZ,nZ,rZ,iZ,aZ,oZ,sZ,cZ,lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ=t((()=>{NV(),eR(),GU(),kJ=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
211
211
|
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-contain-size:initial;--tw-contain-layout:initial;--tw-contain-paint:initial;--tw-contain-style:initial}}}@layer theme{:root,:host{--font-sans:"Geist", ui-sans-serif, system-ui, sans-serif;--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--spacing:4px;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--radius-sm:4px;--ease-out:cubic-bezier(0, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--ease-drawer:cubic-bezier(.32, .72, 0, 1);--ease-spring:cubic-bezier(.34, 1.56, .64, 1)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.a11y-hitbox{position:relative}.a11y-hitbox:before{content:"";pointer-events:auto;width:100%;min-width:24px;height:100%;min-height:24px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.top-\\[2px\\]{top:2px}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-full{right:100%}.bottom-\\[2px\\]{bottom:2px}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.left-full{left:100%}.z-1{z-index:1}.z-10{z-index:10}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.-m-0\\.5{margin:calc(var(--spacing) * -.5)}.-m-4{margin:calc(var(--spacing) * -4)}.m-0{margin:calc(var(--spacing) * 0)}.-mx-2{margin-inline:calc(var(--spacing) * -2)}.-my-1\\.5{margin-block:calc(var(--spacing) * -1.5)}.-mt-\\[8px\\]{margin-top:-8px}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2\\.5{margin-right:calc(var(--spacing) * 2.5)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2\\.5{margin-left:calc(var(--spacing) * 2.5)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.ml-px{margin-left:1px}.no-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.no-scrollbar::-webkit-scrollbar{width:0;height:0;display:none}.line-clamp-5{-webkit-line-clamp:5;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.size-0{width:calc(var(--spacing) * 0);height:calc(var(--spacing) * 0)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-\\[12px\\]{width:12px;height:12px}.size-\\[16px\\]{width:16px;height:16px}.h-\\[8px\\]{height:8px}.h-\\[17px\\]{height:17px}.h-\\[20px\\]{height:20px}.h-\\[24px\\]{height:24px}.h-fit{height:fit-content}.max-h-\\[var\\(--rg-edit-list-max-h\\)\\]{max-height:var(--rg-edit-list-max-h)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-\\[28px\\]{min-height:28px}.w-\\[2px\\]{width:2px}.w-\\[calc\\(100\\%\\+16px\\)\\]{width:calc(100% + 16px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\\[280px\\]{max-width:280px}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\\[36px\\]{min-width:36px}.min-w-\\[100px\\]{min-width:100px}.min-w-\\[150px\\]{min-width:150px}.flex-1{flex:1}.flex-shrink,.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.-rotate-90{rotate:-90deg}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.interactive-scale{transition:transform .4s cubic-bezier(.34,1.56,.64,1)}@media (hover:hover) and (pointer:fine){.interactive-scale:hover{transform:scale(1.05)}}.interactive-scale:active{transition:transform 60ms cubic-bezier(0,0,.2,1);transform:scale(.96)}.press-scale{transition:transform .4s cubic-bezier(.34,1.56,.64,1)}.press-scale:active{transition:transform 60ms cubic-bezier(0,0,.2,1);transform:scale(.97)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize{resize:both}.resize-none{resize:none}.grid-cols-\\[0fr\\]{grid-template-columns:0fr}.grid-cols-\\[1fr\\]{grid-template-columns:1fr}.grid-rows-\\[0fr\\]{grid-template-rows:0fr}.grid-rows-\\[1fr\\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-\\[5px\\]{gap:5px}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:4px}.rounded-\\[1px\\]{border-radius:1px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-\\[6px\\]{border-radius:6px}.rounded-\\[13px\\]{border-radius:13px}.rounded-\\[14px\\]{border-radius:14px}.rounded-full{border-radius:3.40282e38px}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t{border-top-left-radius:4px;border-top-right-radius:4px}.rounded-t-\\[10px\\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-t-none{border-top-left-radius:0;border-top-right-radius:0}.rounded-l{border-top-left-radius:4px;border-bottom-left-radius:4px}.rounded-l-\\[10px\\]{border-top-left-radius:10px;border-bottom-left-radius:10px}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-tl{border-top-left-radius:4px}.rounded-r{border-top-right-radius:4px;border-bottom-right-radius:4px}.rounded-r-\\[10px\\]{border-top-right-radius:10px;border-bottom-right-radius:10px}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-tr{border-top-right-radius:4px}.rounded-b{border-bottom-right-radius:4px;border-bottom-left-radius:4px}.rounded-b-\\[6px\\]{border-bottom-right-radius:6px;border-bottom-left-radius:6px}.rounded-b-\\[10px\\]{border-bottom-right-radius:10px;border-bottom-left-radius:10px}.rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.rounded-br{border-bottom-right-radius:4px}.rounded-bl{border-bottom-left-radius:4px}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.\\[border-width\\:0\\.5px\\]{border-width:.5px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.\\[border-top-width\\:0\\.5px\\]{border-top-width:.5px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-\\[var\\(--rg-border-button\\)\\]{border-color:var(--rg-border-button)}.border-t-\\[var\\(--rg-border-subtle\\)\\]{border-top-color:var(--rg-border-subtle)}.bg-\\[\\#f00\\]{background-color:red}.bg-\\[var\\(--rg-error-bg\\)\\]{background-color:var(--rg-error-bg)}.bg-\\[var\\(--rg-panel-bg\\)\\]{background-color:var(--rg-panel-bg)}.bg-\\[var\\(--rg-submit-bg\\)\\]{background-color:var(--rg-submit-bg)}.bg-\\[var\\(--rg-surface-active\\)\\]{background-color:var(--rg-surface-active)}.bg-\\[var\\(--rg-surface-hover\\)\\]{background-color:var(--rg-surface-hover)}.bg-\\[var\\(--rg-text-primary\\)\\]{background-color:var(--rg-text-primary)}.bg-\\[var\\(--rg-text-secondary\\)\\]{background-color:var(--rg-text-secondary)}.bg-red-500{background-color:var(--color-red-500)}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-0\\.25{padding-inline:calc(var(--spacing) * .25)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-\\[3px\\]{padding-inline:3px}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-0\\.25{padding-block:calc(var(--spacing) * .25)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-px{padding-block:1px}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.text-center{text-align:center}.text-justify{text-align:justify}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.leading-3\\.5{--tw-leading:calc(var(--spacing) * 3.5);line-height:calc(var(--spacing) * 3.5)}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-extralight{--tw-font-weight:var(--font-weight-extralight);font-weight:var(--font-weight-extralight)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.font-thin{--tw-font-weight:var(--font-weight-thin);font-weight:var(--font-weight-thin)}.break-normal{overflow-wrap:normal;word-break:normal}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.break-keep{word-break:keep-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-break-spaces{white-space:break-spaces}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[var\\(--rg-error-text\\)\\]{color:var(--rg-error-text)}.text-\\[var\\(--rg-submit-fg\\)\\]{color:var(--rg-submit-fg)}.text-\\[var\\(--rg-text-primary\\)\\]{color:var(--rg-text-primary)}.text-\\[var\\(--rg-text-primary-85\\)\\]{color:var(--rg-text-primary-85)}.text-\\[var\\(--rg-text-secondary\\)\\]{color:var(--rg-text-secondary)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.\\[box-shadow\\:var\\(--rg-shadow\\)\\]{box-shadow:var(--rg-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\\[filter\\:var\\(--rg-drop-shadow\\)\\]{filter:var(--rg-drop-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-columns\\]{transition-property:grid-template-columns;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-rows\\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[padding\\,border-radius\\,transform\\]{transition-property:padding,border-radius,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[top\\,left\\,width\\,height\\,opacity\\,border-radius\\]{transition-property:top,left,width,height,opacity,border-radius;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,color\\]{transition-property:transform,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.delay-\\[80ms\\]{transition-delay:80ms}.duration-60{--tw-duration:60ms;transition-duration:60ms}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-120{--tw-duration:.12s;transition-duration:.12s}.duration-140{--tw-duration:.14s;transition-duration:.14s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-180{--tw-duration:.18s;transition-duration:.18s}.duration-220{--tw-duration:.22s;transition-duration:.22s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-400{--tw-duration:.4s;transition-duration:.4s}.ease-\\[cubic-bezier\\(0\\,0\\,0\\.2\\,1\\)\\]{--tw-ease:cubic-bezier(0,0,.2,1);transition-timing-function:cubic-bezier(0,0,.2,1)}.ease-drawer{--tw-ease:var(--ease-drawer);transition-timing-function:var(--ease-drawer)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.ease-spring{--tw-ease:var(--ease-spring);transition-timing-function:var(--ease-spring)}.will-change-\\[opacity\\,transform\\]{will-change:opacity,transform}.will-change-transform{will-change:transform}.contain-layout{--tw-contain-layout:layout;contain:var(--tw-contain-size,) var(--tw-contain-layout,) var(--tw-contain-paint,) var(--tw-contain-style,)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\\[corner-shape\\:superellipse\\(1\\.25\\)\\]{corner-shape:superellipse(1.25)}.\\[font-synthesis\\:none\\]{font-synthesis:none}@media (hover:hover){.group-hover\\:text-\\[var\\(--rg-text-primary\\)\\]:is(:where(.group):hover *){color:var(--rg-text-primary)}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\\:bg-\\[var\\(--rg-error-bg-hover\\)\\]:hover{background-color:var(--rg-error-bg-hover)}.hover\\:bg-\\[var\\(--rg-surface-active\\)\\]:hover{background-color:var(--rg-surface-active)}.hover\\:bg-\\[var\\(--rg-surface-hover\\)\\]:hover{background-color:var(--rg-surface-hover)}.hover\\:text-\\[var\\(--rg-text-primary\\)\\]:hover{color:var(--rg-text-primary)}}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:opacity-40:disabled{opacity:.4}}:host{all:initial;direction:ltr}:host,[data-rg-theme=dark]{--rg-panel-bg:#161616;--rg-text-primary:#fff;--rg-text-secondary:#a7a7a7;--rg-surface-hover:#ffffff1a;--rg-surface-active:#ffffff26;--rg-border-subtle:#ffffff1a;--rg-border-button:#fff3;--rg-submit-bg:#fff;--rg-submit-fg:#161616;--rg-error-text:#f87171;--rg-error-bg:#3d1515;--rg-error-bg-hover:#4d1f1f;--rg-shadow:0 2px 8px #00000014;--rg-drop-shadow:drop-shadow(0px 2px 8px #00000014);--rg-shimmer-from:#a1a1aa;--rg-shimmer-to:#d4d4d8;--rg-text-primary-85:#ffffffd9}@media (prefers-color-scheme:dark){:host:not([data-rg-theme]){--rg-panel-bg:#fff;--rg-text-primary:#171717;--rg-text-secondary:#737373;--rg-surface-hover:#0000000d;--rg-surface-active:#00000014;--rg-border-subtle:#00000014;--rg-border-button:#00000026;--rg-submit-bg:#171717;--rg-submit-fg:#fff;--rg-error-text:#dc2626;--rg-error-bg:#fee2e2;--rg-error-bg-hover:#fecaca;--rg-shadow:0 2px 12px #0000001a;--rg-drop-shadow:drop-shadow(0px 2px 12px #0000001a);--rg-shimmer-from:#71717a;--rg-shimmer-to:#a1a1aa;--rg-text-primary-85:#171717d9}}:host([data-rg-theme=light]),[data-rg-theme=light]{--rg-panel-bg:#fff;--rg-text-primary:#171717;--rg-text-secondary:#737373;--rg-surface-hover:#0000000d;--rg-surface-active:#00000014;--rg-border-subtle:#00000014;--rg-border-button:#00000026;--rg-submit-bg:#171717;--rg-submit-fg:#fff;--rg-error-text:#dc2626;--rg-error-bg:#fee2e2;--rg-error-bg-hover:#fecaca;--rg-shadow:0 2px 12px #0000001a;--rg-drop-shadow:drop-shadow(0px 2px 12px #0000001a);--rg-shimmer-from:#71717a;--rg-shimmer-to:#a1a1aa;--rg-text-primary-85:#171717d9}@keyframes rg-slot-enter-up{0%{filter:blur(2px);opacity:0;transform:translateY(.5em)scale(.5)}to{filter:blur();opacity:1;transform:translateY(0)scale(1)}}@keyframes rg-slot-exit-up{0%{filter:blur();opacity:1;transform:translateY(0)scale(1)}to{filter:blur(2px);opacity:0;transform:translateY(-.5em)scale(.5)}}@keyframes rg-slot-enter-down{0%{filter:blur(2px);opacity:0;transform:translateY(-.5em)scale(.5)}to{filter:blur();opacity:1;transform:translateY(0)scale(1)}}@keyframes rg-slot-exit-down{0%{filter:blur();opacity:1;transform:translateY(0)scale(1)}to{filter:blur(2px);opacity:0;transform:translateY(.5em)scale(.5)}}@keyframes rg-slot-enter-fade{0%{filter:blur(2px);opacity:0;transform:scale(.5)}to{filter:blur();opacity:1;transform:scale(1)}}@keyframes rg-slot-exit-fade{0%{filter:blur();opacity:1;transform:scale(1)}to{filter:blur(2px);opacity:0;transform:scale(.5)}}.rg-slot-column{vertical-align:top;display:inline-block;position:relative}.rg-slot-sizer{visibility:hidden;white-space:pre;display:inline-block}.rg-slot-cell{white-space:pre;will-change:transform, filter, opacity;animation-duration:var(--rg-slot-dur,.35s);animation-timing-function:var(--rg-slot-ease,cubic-bezier(.34, 1.56, .64, 1));animation-fill-mode:both;display:inline-block;position:absolute;top:0;left:0}.rg-slot-cell.rg-slot-enter[data-dir="1"]{animation-name:rg-slot-enter-up}.rg-slot-cell.rg-slot-enter[data-dir="-1"]{animation-name:rg-slot-enter-down}.rg-slot-cell.rg-slot-enter[data-dir="0"]{animation-name:rg-slot-enter-fade}.rg-slot-cell.rg-slot-exit[data-dir="1"]{animation-name:rg-slot-exit-up}.rg-slot-cell.rg-slot-exit[data-dir="-1"]{animation-name:rg-slot-exit-down}.rg-slot-cell.rg-slot-exit[data-dir="0"]{animation-name:rg-slot-exit-fade}@media (prefers-reduced-motion:reduce){:host,:host *,:host :before,:host :after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}:host :focus,:host :focus-visible{box-shadow:none!important;outline:none!important}@keyframes shake{0%,to{translate:0}15%,45%{translate:calc(-3px * var(--rg-shake-x,1)) calc(-3px * var(--rg-shake-y,0))}30%,60%{translate:calc(3px * var(--rg-shake-x,1)) calc(3px * var(--rg-shake-y,0))}75%{translate:calc(-2px * var(--rg-shake-x,1)) calc(-2px * var(--rg-shake-y,0))}90%{translate:calc(2px * var(--rg-shake-x,1)) calc(2px * var(--rg-shake-y,0))}}@keyframes icon-loader-spin{0%{opacity:1}50%{opacity:.5}to{opacity:.2}}.icon-loader-bar{animation:.5s linear infinite icon-loader-spin}@keyframes shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.shimmer-text{background:linear-gradient(90deg, var(--rg-shimmer-from) 0%, var(--rg-shimmer-to) 25%, var(--rg-shimmer-from) 50%, var(--rg-shimmer-to) 75%, var(--rg-shimmer-from) 100%);color:#0000;background-size:200% 100%;-webkit-background-clip:text;background-clip:text;animation:2.5s linear infinite shimmer}.animate-shake,.animate-shake-vertical{will-change:translate;animation:.3s ease-out shake}@keyframes tooltip-fade-in{0%{opacity:0;transform:scale(.97)}to{opacity:1;transform:scale(1)}}.animate-tooltip-fade-in{will-change:transform, opacity;animation:.1s ease-out tooltip-fade-in}.animate-shake-vertical{--rg-shake-x:0;--rg-shake-y:1}@supports (-webkit-touch-callout:none){textarea[data-react-grab-input]{font-size:16px}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-contain-size{syntax:"*";inherits:false}@property --tw-contain-layout{syntax:"*";inherits:false}@property --tw-contain-paint{syntax:"*";inherits:false}@property --tw-contain-style{syntax:"*";inherits:false}`,AJ=Symbol(`store-raw`),jJ=Symbol(`store-node`),MJ=Symbol(`store-has`),NJ=Symbol(`store-self`),PJ={get(e,t,n){if(t===AJ)return e;if(t===xz)return n;if(t===Cz)return xJ(e),n;let r=vJ(e,jJ),i=r[t],a=i?i():e[t];if(t===jJ||t===MJ||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);mR()&&(typeof a!=`function`||e.hasOwnProperty(t))&&!(n&&n.get)&&(a=yJ(r,t,a)())}return gJ(a)?hJ(a):a},has(e,t){return t===AJ||t===xz||t===Cz||t===jJ||t===MJ||t===`__proto__`?!0:(mR()&&yJ(vJ(e,MJ),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:SJ,getOwnPropertyDescriptor:bJ},FJ=new WeakMap,IJ={get(e,t){if(t===AJ)return e;let n=e[t],r;return gJ(n)?FJ.get(n)||(FJ.set(n,r=new Proxy(n,IJ)),r):n},set(e,t,n){return CJ(e,t,_J(n)),!0},deleteProperty(e,t){return CJ(e,t,void 0,!0),!0}},LJ=new WeakMap,RJ=new WeakMap,zJ=()=>{LJ=new WeakMap,RJ=new WeakMap},BJ=(e,t,n)=>{let r=RJ.get(e);if(r&&n-r.timestamp<200)return r.borderRadius;let i=(t??window.getComputedStyle(e)).borderRadius||`0px`;return RJ.set(e,{borderRadius:i,timestamp:n}),i},VJ=e=>{let t=performance.now(),n=LJ.get(e);if(n&&t-n.timestamp<16)return n.bounds;let r=e.getBoundingClientRect(),i={borderRadius:BJ(e,null,t),height:r.height,width:r.width,x:r.left,y:r.top};return LJ.set(e,{bounds:i,timestamp:t}),i},HJ=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),UJ=e=>({selectionInteractionLockDepth:0,wasActivatedByToggle:!1,pendingCommentMode:!1,keyHoldDuration:e.keyHoldDuration,dragStart:{x:AM,y:AM},copyStart:{x:AM,y:AM},copyOffsetFromCenterX:0,detectedElement:null,frozenElement:null,frozenElements:[],frozenDragRect:null,lastGrabbedElement:null,selectionFilePath:null,selectionLineNumber:null,inputText:``,grabbedBoxes:[],labelInstances:[],isTouchMode:!1,activationTimestamp:null,previouslyFocusedElement:null,contextMenuPosition:null,contextMenuElement:null,contextMenuClickOffset:null}),WJ=e=>{let[t,n]=DJ(UJ(e)),[r,i]=J({x:AM,y:AM}),[a,o]=J(0),[s,c]=J({state:`idle`}),l=e=>{n(OJ(t=>{e(t),t.frozenElement=t.frozenElements.length>0?t.frozenElements[0]:null,t.frozenDragRect=null}))},u=()=>{l(e=>{e.frozenElements=[]})},d=e=>{c(t=>t.state===`active`?{...t,phase:e}:t)},f={startHold:e=>{e!==void 0&&n(`keyHoldDuration`,e),c({state:`holding`,startedAt:Date.now()})},releaseHold:()=>{s().state===`holding`&&c({state:`idle`})},activate:()=>{lR(()=>{c({state:`active`,phase:`hovering`,isPromptMode:!1,isPendingDismiss:!1}),n(`activationTimestamp`,Date.now()),n(`previouslyFocusedElement`,document.activeElement)})},deactivate:()=>{lR(()=>{c({state:`idle`}),n(OJ(e=>{e.wasActivatedByToggle=!1,e.pendingCommentMode=!1,e.inputText=``,e.frozenElement=null,e.frozenElements=[],e.frozenDragRect=null,e.activationTimestamp=null,e.previouslyFocusedElement=null,e.contextMenuPosition=null,e.contextMenuElement=null,e.contextMenuClickOffset=null,e.isTouchMode&&(e.detectedElement=null)}))})},toggle:()=>{t.activationTimestamp===null?(n(`wasActivatedByToggle`,!0),f.activate()):f.deactivate()},freeze:()=>{if(s().state===`active`){let e=t.frozenElement??t.detectedElement;e&&n(`frozenElement`,e),d(`frozen`)}},unfreeze:()=>{s().state===`active`&&lR(()=>{n(OJ(e=>{e.frozenElement=null,e.frozenElements=[],e.frozenDragRect=null})),d(`hovering`)})},startDrag:(e,t)=>{s().state===`active`&&lR(()=>{t||u(),n(`dragStart`,{x:e.x+window.scrollX,y:e.y+window.scrollY}),d(`dragging-select`)})},startDragReposition:()=>{let e=s();e.state===`active`&&e.phase===`dragging-select`&&d(`dragging-reposition`)},stopDragReposition:()=>{let e=s();e.state===`active`&&e.phase===`dragging-reposition`&&d(`dragging-select`)},shiftDragStart:e=>{let t=s();t.state===`active`&&t.phase===`dragging-reposition`&&n(`dragStart`,t=>({x:t.x+e.x,y:t.y+e.y}))},endDrag:()=>{let e=s();e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)&&lR(()=>{n(`dragStart`,{x:-1e3,y:-1e3}),d(`justDragged`)})},cancelDrag:()=>{let e=s();e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)&&lR(()=>{n(`dragStart`,{x:-1e3,y:-1e3}),d(`hovering`)})},finishJustDragged:()=>{let e=s();e.state===`active`&&e.phase===`justDragged`&&d(`hovering`)},startCopy:()=>{let e=s().state===`active`;c({state:`copying`,startedAt:Date.now(),wasActive:e})},completeCopy:()=>{let e=s(),t=e.state===`copying`&&e.wasActive;c({state:`justCopied`,copiedAt:Date.now(),wasActive:t})},finishJustCopied:()=>{let e=s();e.state===`justCopied`&&(e.wasActive&&!t.wasActivatedByToggle?lR(()=>{u(),c({state:`active`,phase:`hovering`,isPromptMode:!1,isPendingDismiss:!1})}):f.deactivate())},enterPromptMode:(e,t)=>{let{x:r}=HJ(VJ(t));lR(()=>{n(`copyStart`,e),n(`copyOffsetFromCenterX`,e.x-r),i(e),n(`frozenElement`,t),n(`wasActivatedByToggle`,!0),s().state===`active`?c(e=>e.state===`active`?{...e,isPromptMode:!0,phase:`frozen`}:e):(c({state:`active`,phase:`frozen`,isPromptMode:!0,isPendingDismiss:!1}),n(`activationTimestamp`,Date.now()),n(`previouslyFocusedElement`,document.activeElement))})},exitPromptMode:()=>{c(e=>e.state===`active`?{...e,isPromptMode:!1,isPendingDismiss:!1}:e)},setInputText:e=>{n(`inputText`,e)},clearInputText:()=>{n(`inputText`,``)},setPendingDismiss:e=>{c(t=>t.state===`active`?{...t,isPendingDismiss:e}:t)},setPointer:e=>{i(t=>t.x===e.x&&t.y===e.y?t:e)},setDetectedElement:e=>{n(`detectedElement`,e)},setFrozenElement:e=>{l(t=>{t.frozenElements=[e]})},setFrozenElements:e=>{l(t=>{t.frozenElements=e})},toggleFrozenElement:e=>{l(t=>{let n=t.frozenElements.indexOf(e);n>=0?t.frozenElements.splice(n,1):t.frozenElements.push(e)})},addFrozenElements:e=>{l(t=>{for(let n of e)t.frozenElements.includes(n)||t.frozenElements.push(n)})},setFrozenDragRect:e=>{n(`frozenDragRect`,e)},setCopyStart:(e,t)=>{let{x:r}=HJ(VJ(t));n(`copyStart`,e),n(`copyOffsetFromCenterX`,e.x-r)},setLastGrabbed:e=>{n(`lastGrabbedElement`,e)},setWasActivatedByToggle:e=>{n(`wasActivatedByToggle`,e)},setPendingCommentMode:e=>{n(`pendingCommentMode`,e)},setTouchMode:e=>{n(`isTouchMode`,e)},incrementSelectionInteractionLockDepth:()=>{n(`selectionInteractionLockDepth`,e=>e+1)},decrementSelectionInteractionLockDepth:()=>{n(`selectionInteractionLockDepth`,e=>Math.max(0,e-1))},setSelectionSource:(e,t)=>{lR(()=>{n(`selectionFilePath`,e),n(`selectionLineNumber`,t)})},incrementViewportVersion:()=>{o(e=>e+1)},addGrabbedBox:e=>{n(`grabbedBoxes`,t=>[...t,e])},removeGrabbedBox:e=>{n(`grabbedBoxes`,t=>t.filter(t=>t.id!==e))},clearGrabbedBoxes:()=>{n(`grabbedBoxes`,[])},addLabelInstance:e=>{n(`labelInstances`,t=>[...t,e])},updateLabelInstance:(e,r,i)=>{let a=t.labelInstances.findIndex(t=>t.id===e);a!==-1&&lR(()=>{n(`labelInstances`,a,`status`,r),i!==void 0&&n(`labelInstances`,a,`errorMessage`,i)})},removeLabelInstance:e=>{n(`labelInstances`,t=>t.filter(t=>t.id!==e))},clearLabelInstances:()=>{n(`labelInstances`,[])},showContextMenu:(e,t)=>{let{x:r,y:i}=HJ(VJ(t));lR(()=>{n(`contextMenuPosition`,e),n(`contextMenuElement`,t),n(`contextMenuClickOffset`,{x:e.x-r,y:e.y-i})})},hideContextMenu:()=>{lR(()=>{n(`contextMenuPosition`,null),n(`contextMenuElement`,null),n(`contextMenuClickOffset`,null)})},updateContextMenuPosition:()=>{let e=t.contextMenuElement,r=t.contextMenuClickOffset;if(!e||!r||!Jz(e))return;let{x:i,y:a}=HJ(VJ(e));n(`contextMenuPosition`,{x:i+r.x,y:a+r.y})}};return{store:t,actions:f,pointer:r,viewportVersion:a,current:s}},GJ=e=>{if(!document.body)return;let t=document.querySelectorAll(`[${DM}]`);for(let n of t)n!==e&&n.parentNode!==e&&(n.shadowRoot||n.remove());document.body.appendChild(e)},KJ=e=>{if(document.body){GJ(e);return}let t=()=>{document.removeEventListener(`DOMContentLoaded`,t),GJ(e)};document.addEventListener(`DOMContentLoaded`,t,{once:!0})},qJ=e=>{let t=document.querySelectorAll(`[${DM}]`);for(let e of t){let t=e.shadowRoot?.querySelector(`[${DM}]`);if(t instanceof HTMLDivElement)return{root:t,host:e};e.remove()}let n=document.createElement(`div`);n.setAttribute(DM,`true`),kN(n),n.style.zIndex=String(LM),n.style.position=`fixed`,n.style.inset=`0`,n.style.pointerEvents=`none`,n.style.contain=`strict`;let r=n.attachShadow({mode:`open`}),i=document.createElement(`style`),a=DN();a&&(i.nonce=a),i.textContent=`@import url("https://fonts.googleapis.com/css2?family=Geist:wght@500&display=swap");\n${e??``}`,r.appendChild(i);let o=document.createElement(`div`);return o.setAttribute(DM,`true`),r.appendChild(o),KJ(n),setTimeout(()=>{GJ(n)},lN),{root:o,host:n}},JJ=e=>{let[t,n]=J(void 0),r=0;return oR(dR(e,e=>{let t=++r;if(!e){n(void 0);return}let i=OU(e)??void 0;n(i),bU(e).then(e=>{r===t&&n(e??i)}).catch(()=>{r===t&&n(i)})})),[t,n]},YJ=[`data-theme`,`data-mode`,`data-color-scheme`,`data-bs-theme`,`data-mui-color-scheme`,`data-mantine-color-scheme`],XJ=[{attribute:`data-dark`,theme:`dark`},{attribute:`data-light`,theme:`light`}],ZJ=(e,t,n)=>{let[r,i,a]=[e,t,n].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a},QJ=(e,t=0)=>{let n=vB(e),r=n?rB(n):null;return!r||r.alpha<=t?null:ZJ(r.red,r.green,r.blue)},$J=e=>{let t=QJ(e);return t===null?null:t<.18?`dark`:`light`},eY=e=>$J(getComputedStyle(e).backgroundColor),tY=()=>{let e=QJ(getComputedStyle(document.documentElement).color,tN);return e===null?null:e>.6?`dark`:null},nY=()=>{let e=document.createElement(`div`);e.style.cssText=`position:fixed;width:0;height:0;background-color:Canvas!important`,document.documentElement.appendChild(e);let t=$J(getComputedStyle(e).backgroundColor);return e.remove(),t},rY=e=>{let t=e.toLowerCase();return t===`dark`?`dark`:t===`light`?`light`:null},iY=e=>{let t=e.style.colorScheme||getComputedStyle(e).colorScheme;return t?t.trim().toLowerCase().split(/\s+/):[]},aY=e=>{let t=iY(e),n=t.includes(`dark`);return n===t.includes(`light`)?null:n?`dark`:`light`},oY=e=>{if(e.classList.contains(`dark`))return`dark`;if(e.classList.contains(`light`))return`light`;for(let t of YJ){let n=e.getAttribute(t);if(!n)continue;let r=rY(n);if(r)return r}for(let{attribute:t,theme:n}of XJ)if(e.hasAttribute(t))return n;return null},sY=(e,t)=>{for(let n of e){if(!n)continue;let e=t(n);if(e)return e}return null},cY=()=>{let e=[document.documentElement,document.body],t=[document.body,document.documentElement];return sY(e,oY)??sY(e,aY)??sY(t,eY)??tY()??nY()??`light`},lY=e=>e===`dark`?`light`:`dark`,uY=()=>{let e=[];for(let t of[document.documentElement,document.body]){if(!t)continue;e.push(t.className);for(let n of YJ)e.push(t.getAttribute(n)??``);for(let{attribute:n}of XJ)e.push(t.hasAttribute(n)?`1`:``);let n=t.style;e.push(n.colorScheme,n.backgroundColor,n.color);for(let t=0;t<n.length;t++){let r=n[t];r.startsWith(`--`)&&e.push(`${r}:${n.getPropertyValue(r)}`)}}return e.join(`|`)},dY={attributes:!0,attributeFilter:[`class`,`style`,...YJ,...XJ.map(({attribute:e})=>e)]},fY=(e,t)=>{let n=null,r=null,i=null,a=()=>{let i=uY();if(i===r&&n!==null)return getComputedStyle(document.body??document.documentElement).backgroundColor,n;r=i;let a=lY(cY());return a!==n&&(n=a,e.setAttribute(`data-rg-theme`,a),t?.(a)),a},o=()=>{i===null&&(i=UF(()=>{i=null,a()}))},s=a(),c=new MutationObserver(o);c.observe(document.documentElement,dY);let l=null;document.body?c.observe(document.body,dY):(l=new MutationObserver(()=>{document.body&&(l.disconnect(),l=null,c.observe(document.body,dY),a())}),l.observe(document.documentElement,{childList:!0}));let u=()=>{r=null,o()},d=window.matchMedia(`(prefers-color-scheme: dark)`);return d.addEventListener(`change`,u),{theme:s,cleanup:()=>{l?.disconnect(),c.disconnect(),d.removeEventListener(`change`,u),i!==null&&WF(i)}}},pY=()=>{},mY=()=>({activate:pY,deactivate:pY,toggle:pY,comment:pY,isActive:()=>!1,isEnabled:()=>!1,setEnabled:pY,getToolbarState:()=>null,setToolbarState:pY,onToolbarStateChange:()=>pY,reset:pY,dispose:pY,copyElement:()=>Promise.resolve(!1),getSource:()=>Promise.resolve(null),getStackContext:()=>Promise.resolve(``),getState:()=>({isActive:!1,isDragging:!1,isCopying:!1,isPromptMode:!1,isSelectionBoxVisible:!1,isDragBoxVisible:!1,targetElement:null,dragBounds:null,grabbedBoxes:[],labelInstances:[],selectionFilePath:null,toolbarState:null}),setOptions:pY,registerPlugin:pY,unregisterPlugin:pY,getPlugins:()=>[],getDisplayName:()=>null}),hY=()=>{let e=new AbortController;return{signal:e.signal,abort:()=>e.abort(),addWindowListener:(t,n,r={})=>{window.addEventListener(t,n,{...r,signal:e.signal})},addDocumentListener:(t,n,r={})=>{document.addEventListener(t,n,{...r,signal:e.signal})}}},gY=(e,t=`Unknown error`)=>e instanceof Error&&e.message?e.message:t,_Y=e=>e instanceof Error?e:Error(String(e)),vY=e=>({functionName:e.functionName,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,isServer:e.isServer,isSymbolicated:e.isSymbolicated}),yY=async(e,t)=>{let n={maxLines:t},[r,i,a,o]=await Promise.all([VU(e,n),zU(e,n),DU(e),yU(e)]);return{tagName:TN(e),componentName:a?.componentName??void 0,content:`[${r}]`,source:a,stackContext:i,frames:(o??[]).map(vY)}},bY=async(e,t)=>{let n=await Promise.all(e.map(e=>yY(e,t))),r=new Map;for(let e of n)r.has(e.content)||r.set(e.content,e);let i=[...r.values()];return i.length>0?{content:i.map(e=>e.content).join(`
|
|
212
212
|
`),entries:i}:null},xY=(e,t,n)=>{if(e?.entries)return t===e.content?e.entries:e.entries.length===1?[{...e.entries[0],content:t,commentText:n}]:e.entries.map(e=>({...e,commentText:n}))},SY=async(e,t,n,r)=>{await t.onBeforeCopy(n);let i=!1,a=``;try{let o=e.getContent?{content:await e.getContent(n)}:await bY(n,e.maxContextLines),s=o?.content;if(s?.trim()){let c=await t.transformCopyContent(s,n);a=r?`${r}\n${c}`:c,i=WU(a,{componentName:e.componentName,entries:xY(o,a,r)})}}catch(e){t.onCopyError(_Y(e))}return i&&t.onCopySuccess(n,a),t.onAfterCopy(n,i),i},CY=(e,t)=>{let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return Math.max(0,i-n)*Math.max(0,a-r)},wY=(e,t)=>e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top,TY=e=>e.sort((e,t)=>{if(e===t)return 0;let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0}),EY=e=>{if(e.width<=0||e.height<=0)return[];let t=window.innerWidth,n=window.innerHeight,r=e.x,i=e.y,a=e.x+e.width,o=e.y+e.height,s=r+e.width/2,c=i+e.height/2,l=yB(Math.ceil(e.width/32),3,20),u=yB(Math.ceil(e.height/32),3,20),d=l*u,f=d>100?Math.sqrt(100/d):1,p=yB(Math.floor(l*f),3,20),m=yB(Math.floor(u*f),3,20),h=new Set,g=[],_=(e,r)=>{let i=yB(Math.round(e),0,t-1),a=yB(Math.round(r),0,n-1),o=`${i}:${a}`;h.has(o)||(h.add(o),g.push({x:i,y:a}))};_(r+1,i+1),_(a-1,i+1),_(r+1,o-1),_(a-1,o-1),_(s,i+1),_(s,o-1),_(r+1,c),_(a-1,c),_(s,c);for(let t=0;t<p;t+=1){let n=r+(t+.5)/p*e.width;for(let t=0;t<m;t+=1)_(n,i+(t+.5)/m*e.height)}return g},DY=(e,t,n)=>{let r={left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height},i=new Set,a=EY(e);uI();try{for(let e of a){let t=document.elementsFromPoint(e.x,e.y);for(let e of t)i.add(e)}}finally{dI()}let o=[];for(let e of i)!n&&qF(e)||TM(e)&&t(e)&&o.push(e);let s=new Map;for(let e of o)s.set(e,e.getBoundingClientRect());let c=[];for(let e of o){let t=s.get(e);if(t.width<=0||t.height<=0)continue;let i={left:t.left,top:t.top,right:t.left+t.width,bottom:t.top+t.height};if(n){let n=CY(r,i),a=t.width*t.height;a>0&&n/a>=.75&&c.push(e)}else wY(i,r)&&c.push(e)}return TY(c)},OY=e=>{let t=new Set(e);return e.filter(e=>{for(let n=e.parentElement;n;n=n.parentElement)if(t.has(n))return!1;return!0})},kY=(e,t,n=!0)=>OY(DY(e,t,n)),AY=(e,t)=>e.width<=0?0:yB((t.x-e.x)/e.width,0,1),jY=()=>{zJ(),xI(),nI()},MY=e=>({borderRadius:`0px`,height:e.height,width:e.width,x:e.pageX-window.scrollX,y:e.pageY-window.scrollY}),NY=e=>({pageX:e.x+window.scrollX,pageY:e.y+window.scrollY,width:e.width,height:e.height}),PY=e=>({borderRadius:`0px`,height:e.height,width:e.width,x:e.x,y:e.y}),FY=(e,t,n)=>{let r=(e,t,n,r)=>{let i=[],a=e,o=0;for(;a&&i.length<n&&o<100;)r(a)&&i.push(a),a=t(a),o+=1;return i},i=r(e.parentElement,e=>e.parentElement,6,t);i.reverse();let a=i.map((e,t)=>({element:e,depth:t,isLast:!0})),o=i.length,s=r(e.previousElementSibling,e=>e.previousElementSibling,7,n),c=r(e.nextElementSibling,e=>e.nextElementSibling,7,n),l=Math.min(s.length,Math.max(3,7-c.length)),u=Math.min(c.length,7-l),d=[...s.slice(0,l).reverse(),e,...c.slice(0,u)],f=r(e.firstElementChild,e=>e.nextElementSibling,6,t),p=d.length-1,m=f.length-1;return d.forEach((t,n)=>{a.push({element:t,depth:o,isLast:n===p}),t===e&&f.forEach((e,t)=>{a.push({element:e,depth:o+1,isLast:t===m})})}),a},IY=e=>e instanceof SVGElement&&!(e instanceof SVGSVGElement),LY=e=>{let t=e.getBoundingClientRect();return t.width>=16||t.height>=16},RY=(e,t)=>t(e)&&!IY(e)&&LY(e),zY=new Set([`c`,`C`,`с`,`С`,`ȼ`,`Ȼ`,`ↄ`,`Ↄ`,`ᴄ`,`ᶜ`,`ⱼ`,`ⅽ`,`Ⅽ`,`ç`,`Ç`,`ć`,`Ć`,`č`,`Č`,`ĉ`,`Ĉ`,`ċ`,`Ċ`]),BY=(e,t)=>t===`KeyC`?!0:!e||e.length!==1?!1:zY.has(e),VY=(e,t)=>{if(!e||!t)return!1;let n=e.toLowerCase();return t===`Space`?n===`space`||n===` `:t.startsWith(`Key`)?t.slice(3).toLowerCase()===n:t.startsWith(`Digit`)?t.slice(5)===n:!1},HY={meta:`metaKey`,cmd:`metaKey`,command:`metaKey`,win:`metaKey`,windows:`metaKey`,ctrl:`ctrlKey`,control:`ctrlKey`,shift:`shiftKey`,alt:`altKey`,option:`altKey`,opt:`altKey`},UY=e=>{let t=e.split(`+`).map(e=>e.trim().toLowerCase()),n={metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1,key:null};for(let e of t){let t=HY[e];t?n[t]=!0:n.key=e}return n},WY=e=>{if(typeof e==`function`)return e;let t=UY(e),n=t.key;return e=>{if(n===null){let n=!t.metaKey||e.metaKey||e.key===`Meta`,r=!t.ctrlKey||e.ctrlKey||e.key===`Control`,i=!t.shiftKey||e.shiftKey||e.key===`Shift`,a=!t.altKey||e.altKey||e.key===`Alt`,o=n&&r&&i&&a,s=[t.metaKey,t.ctrlKey,t.shiftKey,t.altKey].filter(Boolean).length,c=[e.metaKey||e.key===`Meta`,e.ctrlKey||e.key===`Control`,e.shiftKey||e.key===`Shift`,e.altKey||e.key===`Alt`].filter(Boolean).length;return o&&c>=s}let r=e.key?.toLowerCase()===n||VY(n,e.code),i=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?(!t.metaKey||e.metaKey)&&(!t.ctrlKey||e.ctrlKey)&&(!t.shiftKey||e.shiftKey)&&(!t.altKey||e.altKey):!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey;return r&&i}},GY=e=>!e||typeof e==`function`?{metaKey:SB(),ctrlKey:!SB(),shiftKey:!1,altKey:!1,key:null}:UY(e),KY=(e,t)=>{if(t.activationKey)return WY(t.activationKey)(e);let n=(SB()?e.metaKey:e.ctrlKey)&&!e.shiftKey&&!e.altKey;return!!(e.key&&n&&BY(e.key,e.code))},qY=e=>{if(e.length===0)return{x:0,y:0,width:0,height:0};if(e.length===1)return e[0];let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.width),i=Math.max(i,a.y+a.height);return{x:t,y:n,width:r-t,height:i-n}},JY=e=>{let t=getComputedStyle(e),n={};for(let e of wB)n[e]=t.getPropertyValue(e);return n},YY=e=>{let t={};for(let n of WB)t[n]=e.getPropertyValue(n);return t},XY=e=>{try{let t=e.parentElement;if(!t)return null;let n=e.namespaceURI,r=e.tagName.toLowerCase(),i=n&&n!==`http://www.w3.org/1999/xhtml`?e.ownerDocument.createElementNS(n,r):e.ownerDocument.createElement(r),a=`style`in i?i.style:null;a instanceof CSSStyleDeclaration&&a.setProperty(`display`,`none`,`important`),t.appendChild(i);try{return YY(getComputedStyle(i))}finally{i.remove()}}catch{return null}},ZY=new Set([`display`,`width`,`height`]),QY=(e,t,n)=>e.kind===`color`?!1:e.cssProperties.some(e=>ZY.has(e))?$Y(e):e.cssProperties.every(e=>{let r=t[e],i=n[e];return r===void 0||i===void 0?!1:r===i}),$Y=e=>{if(e.kind===`color`)return!1;if(e.kind===`enum`)return e.key===`font-weight`?e.original===`400`:e.options[0]?.value===e.original;let{key:t,original:n}=e;return t.startsWith(`padding`)||t.startsWith(`margin`)||t.includes(`gap`)||t===`border-width`||t.endsWith(`-radius`)||t===`border-radius`?n===0:t===`opacity`?n===100:t===`letter-spacing`||t===`z-index`?n===0:!IB.has(t)&&!!(t===`width`||t===`height`||t===`width,height`||t.startsWith(`max-`)||t.startsWith(`min-`)||t===`line-height`)},eX=e=>{let t=e.trim();if(!t||t===`auto`||t===`normal`||t===`none`)return null;let n=Number.parseFloat(t);return Number.isFinite(n)?t.endsWith(`%`)?{value:n,unit:`%`}:t.endsWith(`rem`)||t.endsWith(`em`)?{value:n*16,unit:`px`}:t.endsWith(`px`)?{value:n,unit:`px`}:{value:n,unit:``}:null},tX=(e,t)=>{let n=eX(e[t]);if(n)return n;if(t===`line-height`){let t=eX(e[`font-size`]);return t?{value:JB(t.value*CN),unit:t.unit||`px`}:null}return kB.has(t)?{value:0,unit:`px`}:null},nX=(e,t)=>{let n=tX(e,t[0]);if(!n)return null;for(let r=1;r<t.length;r++){let i=tX(e,t[r]);if(!i||i.unit!==n.unit||Math.abs(i.value-n.value)>=.5)return null}return n},rX=(e,t)=>e===`opacity`?{value:Math.round(t.value*100),unit:`%`}:AB.has(e)?{value:JB(t.value),unit:``}:{value:JB(t.value),unit:t.unit||`px`},iX=e=>e!==null,aX=(e,t)=>{let n=t.map(t=>{let n=t.longhands.length===1?tX(e,t.longhands[0]):nX(e,t.longhands);return n?{definition:t,value:n}:null}).filter(iX),r=new Map;for(let e of n)for(let t of e.definition.longhands){let n=r.get(t);(!n||e.definition.longhands.length>n.definition.longhands.length)&&r.set(t,e)}let i=new Set(r.values());return n.map(e=>({...e,isCanonical:i.has(e)}))},oX=(e,t,n)=>e===`opacity`?{min:0,max:100}:e===`z-index`?{min:DB,max:OB}:e===`letter-spacing`?{min:-10,max:20}:e===`font-size`?{min:8,max:96}:e===`line-height`?{min:0,max:120}:e.includes(`radius`)?{min:0,max:96}:e===`width`||e===`height`||e===`width,height`||e.startsWith(`min-`)||e.startsWith(`max-`)?{min:0,max:Math.max(512,Math.ceil(t*2))}:IB.has(e)?{min:EB,max:512}:n===`%`?{min:0,max:100}:{min:e.startsWith(`margin`)?TB:0,max:384},sX=(e,t,n)=>{let r=rX(e.key,t),i=r.unit===`px`&&Math.abs(r.value)>1e7,a=oX(e.key,i?0:r.value,r.unit),o=r.value<0?a.min:a.max,s=i?o:r.value;return{kind:`numeric`,key:e.key,label:e.label,cssProperties:e.longhands,min:a.min,max:a.max,value:s,original:s,unit:r.unit,tailwindAliases:SV(e.key),isPrioritized:!1,isDefault:!1,isCanonical:n}},cX=(e,t,n,r=!1)=>{let i=vB(n),a=i?rB(i):null,o=a!==null&&a.alpha!==0;if(!o&&!r)return null;let s=o&&i?i:pN;return{kind:`color`,key:e,label:t,cssProperties:[e],value:s,original:s,tailwindAliases:SV(e),isPrioritized:r,isDefault:!1,isCanonical:!0}},lX=(e,t,n)=>{let r=t.trim(),i=n??e.options;return!i||!i.some(e=>e.value===r)?null:{kind:`enum`,key:e.key,label:e.label,cssProperties:[e.key],value:r,original:r,options:i,tailwindAliases:SV(e.key),isPrioritized:!1,isDefault:!1,isCanonical:!0}},uX=new Map(`background-color.color.padding.padding-left,padding-right.padding-top,padding-bottom.padding-top.padding-right.padding-bottom.padding-left.margin.margin-left,margin-right.margin-top,margin-bottom.margin-top.margin-right.margin-bottom.margin-left.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-transform.text-align.text-decoration-line.white-space.word-break.overflow-wrap.font-variant-numeric.border-radius.border-top-left-radius,border-top-right-radius.border-bottom-left-radius,border-bottom-right-radius.border-top-left-radius,border-bottom-left-radius.border-top-right-radius,border-bottom-right-radius.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.width,height.width.height.max-width.max-height.min-width.min-height.opacity.gap.row-gap.column-gap.border-width.border-top-width.border-right-width.border-bottom-width.border-left-width.border-color.align-items.justify-content.top,right,bottom,left.left,right.top,bottom.top.right.bottom.left.z-index`.split(`.`).map((e,t)=>[e,t])),dX=e=>uX.get(e.key)??1/0,fX=e=>e.map((e,t)=>({property:e,index:t})).sort((e,t)=>{let n=dX(e.property)-dX(t.property);return n===0?e.index-t.index:n}).map(e=>e.property),pX=e=>{let t=JY(e),n=getComputedStyle(e),r=YY(n),i=XY(e),a=[],o=new Set,s=e=>{o.has(e.key)||(a.push(e),o.add(e.key))};for(let e of LB)for(let n of aX(t,e))s(sX(n.definition,n.value,n.isCanonical));for(let e of RB){let n=tX(t,e.key);n&&s(sX({key:e.key,label:e.label,longhands:[e.key]},n,!0))}for(let{key:e,label:t,alwaysShow:r}of zB){let i=n.getPropertyValue(e);if(!r&&(!i||aB(i)))continue;let a=cX(e,t,i,r);a&&s(a)}let c=n.getPropertyValue(HB.key);if(c){let e=lX(HB,c,VB(c));e&&s(e)}for(let e of UB){let t=n.getPropertyValue(e.key);if(!t)continue;let r=lX(e,t);r&&s(r)}return mX(a,xV(e),r,i)},mX=(e,t,n,r)=>{let i=[],a=[];for(let o of e)if(o.isPrioritized||t.has(o.key))i.push({...o,isPrioritized:!0,isDefault:!1});else{let e=r?QY(o,n,r):$Y(o);a.push({...o,isDefault:e})}return[...fX(i),...fX(a)]},hX=[{keyword:`letter`,family:`letter-spacing`},{keyword:`tracking`,family:`letter-spacing`},{keyword:`leading`,family:`line-height`},{keyword:`line-height`,family:`line-height`},{keyword:`lineheight`,family:`line-height`},{keyword:`radius`,family:`radius`},{keyword:`rounded`,family:`radius`},{keyword:`corner`,family:`radius`},{keyword:`font-size`,family:`font-size`},{keyword:`fontsize`,family:`font-size`},{keyword:`text`,family:`font-size`},{keyword:`stroke`,family:`border-width`},{keyword:`border-width`,family:`border-width`},{keyword:`borderwidth`,family:`border-width`},{keyword:`space`,family:`spacing`},{keyword:`gap`,family:`spacing`},{keyword:`gutter`,family:`spacing`},{keyword:`inset`,family:`spacing`},{keyword:`padding`,family:`spacing`},{keyword:`margin`,family:`spacing`},{keyword:`size`,family:`size`},{keyword:`width`,family:`size`},{keyword:`height`,family:`size`}],gX=e=>{let t=e.toLowerCase();for(let{keyword:e,family:n}of hX)if(t.includes(e))return n;return null},_X=e=>e.includes(`radius`)?`radius`:e.endsWith(`-width`)&&e.includes(`border`)?`border-width`:e===`font-size`?`font-size`:e===`line-height`?`line-height`:e===`letter-spacing`?`letter-spacing`:e.startsWith(`padding`)||e.startsWith(`margin`)||e.endsWith(`gap`)||e===`top`||e===`right`||e===`bottom`||e===`left`||e.startsWith(`inset`)?`spacing`:e===`width`||e===`height`||e.startsWith(`min-`)||e.startsWith(`max-`)?`size`:null,vX=e=>{let t=eX(e);return!t||t.unit!==`px`?null:JB(t.value)},yX=(e,t)=>t===null?!0:e.length===t.length?e<t:e.length<t.length,bX=(e,t,n)=>{if(n===1){for(let n of e)if(n>t)return n;return null}for(let n=e.length-1;n>=0;n--)if(e[n]<t)return e[n];return null},xX=(e,t,n)=>{let r=(t===1?Math.floor(e/n)+1:Math.ceil(e/n)-1)*n;return r<0?null:r},SX=null,CX=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),wX=()=>{let e=Array.from(document.adoptedStyleSheets??[]),t=document.styleSheets.length;if(SX&&SX.documentSheetCount===t&&CX(SX.adoptedSheets,e))return SX.names;let n=new Set;for(let t of[...document.styleSheets,...e]){let e;try{e=t.cssRules}catch{continue}TX(e,n)}return SX={documentSheetCount:t,adoptedSheets:e,names:n},n},TX=(e,t)=>{for(let n of Array.from(e))if(n instanceof CSSStyleRule){let e=n.style;for(let n=0;n<e.length;n++){let r=e.item(n);r.startsWith(`--`)&&t.add(r)}}else n instanceof CSSGroupingRule&&TX(n.cssRules,t)},EX={hasTokens:!1,matchColor:()=>null,matchLength:()=>null,stepLength:()=>null},DX=e=>{if(typeof document>`u`)return EX;let t=wX();if(t.size===0)return EX;let n=getComputedStyle(e),r=new Map,i=new Map,a=new Map,o=null;for(let e of t){let t=n.getPropertyValue(e).trim();if(!t)continue;let s=vX(t);if(s!==null){e===`--spacing`&&s>0&&(o=s);let t=gX(e);if(t!==null){let n=i.get(s);n?n.push({name:e,family:t}):i.set(s,[{name:e,family:t}]);let r=a.get(t);r?r.add(s):a.set(t,new Set([s]))}continue}let c=vB(t);if(c){let t=c.toLowerCase();yX(e,r.get(t)??null)&&r.set(t,e)}}if(r.size===0&&i.size===0)return EX;let s=new Map;for(let[e,t]of a)s.set(e,Array.from(t).sort((e,t)=>e-t));return{hasTokens:!0,matchColor:e=>{let t=vB(e)?.toLowerCase();return t?r.get(t)??null:null},matchLength:(e,t)=>{let n=_X(t);if(n===null)return null;let r=i.get(Math.round(e));if(!r)return null;let a=null;for(let e of r)e.family===n&&yX(e.name,a)&&(a=e.name);return a},stepLength:(e,t,n)=>{let r=_X(n);if(r===null)return null;let i=Math.round(e),a=s.get(r);return a&&a.length>=2?bX(a,i,t):(r===`spacing`||r===`size`)&&o?xX(i,t,o):a?bX(a,i,t):null}}},OX=e=>e.kind===`color`||e.kind===`enum`?e.value:e.key===`opacity`&&e.unit===`%`?qB(e.value/100):`${qB(e.value)}${e.unit}`,kX=(e,t,n)=>{if(!n?.hasTokens)return null;let{edit:r}=t;return r.kind===`color`?n.matchColor(r.value):r.kind===`numeric`&&r.unit===`px`?n.matchLength(r.value,e):null},AX=e=>{let t=new Map;for(let n of e.edits){let e=OX(n);for(let r of n.cssProperties)t.set(r,{edit:n,cssValue:e})}let n=!1;return{lines:Array.from(t,([t,r])=>{let i=kX(t,r,e.designTokens);i&&(n=!0);let a=i?` /* var(${i}) */`:``;return`${t}: ${r.cssValue};${a}`}),usesToken:n}},jX=e=>e.filePath?`${e.filePath}:${e.lineNumber}`:``,MX=e=>["```css",...e,"```"].join(`
|
|
213
213
|
`),NX=e=>{if(e.length===0)return``;let t=e.map(e=>{let{lines:t,usesToken:n}=AX(e);return{header:jX(e),cssLines:t,usesToken:n}}),n=[`Apply these style changes canonically (CSS = visual intent; choose the source change that best expresses the underlying layout intent):`];if(t.some(e=>e.usesToken)&&n.push("Prefer the design token shown in each `/* var(--token) */` comment over the raw value when it matches the project's intent."),t.length===1){let[e]=t;return e.header&&n.push(`\n${e.header}`),n.push(MX(e.cssLines)),n.join(`
|
|
214
214
|
`)}for(let e of t)n.push(e.header?`\n${e.header}`:``),n.push(MX(e.cssLines));return n.join(`
|
|
215
|
-
`)},PX=e=>`style`in e&&e.style instanceof CSSStyleDeclaration,FX=e=>{let t=new Map,n=PX(e)?e:null;return{apply:(e,r)=>{if(n)for(let i of e)t.has(i)||t.set(i,{value:n.style.getPropertyValue(i),priority:n.style.getPropertyPriority(i)}),n.style.setProperty(i,r)},restore:()=>{if(!n){t.clear();return}for(let[e,{value:r,priority:i}]of t)r?n.style.setProperty(e,r,i):n.style.removeProperty(e);t.clear()},hasAppliedStyles:()=>t.size>0}},IX=(e,t)=>{for(let n of t){let t=e.edits.findIndex(e=>e.key===n.key);t>=0?e.edits[t]=n:e.edits.push(n)}},LX=(e,t)=>({element:e.element,preview:e.preview,filePath:e.filePath??``,lineNumber:e.lineNumber??0,edits:t,designTokens:e.designTokens}),RX=e=>{let[t,n]=J(null),[r,i]=J(!1),a=[],o=[],s=e=>{o=e},c=()=>{let r=t()!==null;n(null),i(!1),a=[],o=[],r&&e.onClose?.()},l=()=>{t()?.preview.restore();for(let e=a.length-1;e>=0;e--)a[e].preview.restore();c()},u=e=>{bU(e).then(t=>{t&&n(n=>!n||n.element!==e||n.componentName?n:{...n,componentName:t})})},d=(r,i,a={})=>{if(t()!==null)return!1;let o=pX(r);if(o.length===0)return!1;let s=a.filePath??e.store.selectionFilePath??void 0,c=a.lineNumber??e.store.selectionLineNumber??void 0;return n({element:r,position:i,selectionBounds:VJ(r),properties:o,preview:FX(r),filePath:s,lineNumber:c,componentName:a.componentName,tagName:a.tagName??TN(r),initialSearchQuery:a.initialSearchQuery,designTokens:DX(r)}),u(r),e.isActivated()||e.activateRenderer(),e.actions.setPointer(i),e.actions.setFrozenElement(r),e.actions.freeze(),e.onOpen?.(),!0},f=(r,i)=>{let s=t();if(!s||s.element===r)return!1;let c=pX(r);return c.length===0?!1:((o.length>0||s.preview.hasAppliedStyles())&&a.push(LX(s,o)),o=[],n({element:r,position:i,selectionBounds:VJ(r),properties:c,preview:FX(r),tagName:TN(r),hasSessionEdits:a.some(e=>e.edits.length>0),designTokens:DX(r)}),DU(r).then(e=>{if(e){for(let t of a)t.element===r&&!t.filePath&&(t.filePath=e.filePath,t.lineNumber=e.lineNumber??0);n(t=>!t||t.element!==r||t.filePath?t:{...t,filePath:e.filePath,lineNumber:e.lineNumber??void 0})}}).catch(()=>void 0),u(r),e.actions.setPointer(i),e.actions.setFrozenElement(r),!0)},p=(e,t)=>[...a,LX(e,t)],m=e=>{let t=new Map;for(let n of e){if(n.edits.length===0)continue;let e=t.get(n.element);if(e){!e.filePath&&n.filePath&&(e.filePath=n.filePath,e.lineNumber=n.lineNumber),IX(e,n.edits);continue}t.set(n.element,{filePath:n.filePath,lineNumber:n.lineNumber,edits:[...n.edits],designTokens:n.designTokens})}return Array.from(t.values())},h=e=>{let t=new Set;for(let n of e)n.edits.length>0&&t.add(n.element);for(let n=e.length-1;n>=0;n--){let r=e[n];r.edits.length===0&&!t.has(r.element)&&r.preview.restore()}};return{state:t,trigger:d,switchToElement:f,setPendingEdits:s,dismiss:()=>{t()!==null&&(l(),e.store.wasActivatedByToggle?e.deactivateRenderer():e.actions.unfreeze())},closePreservingRenderer:()=>{t()!==null&&(l(),e.actions.unfreeze())},submit:n=>{let r=t();if(!r)return;let i=r.element,a=p(r,n),o=NX(m(a));h(a),c(),e.store.wasActivatedByToggle||e.actions.unfreeze(),e.performCopyWithLabel({element:i,cursorX:r.position.x,extraPrompt:o||void 0,shouldDeactivateAfter:e.store.wasActivatedByToggle})},resetWithDiscard:l,isOpen:()=>t()!==null,isInteracting:r,setInteracting:i}},zX={enabled:!0,hue:0,selectionBox:{enabled:!0},dragBox:{enabled:!0},grabbedBoxes:{enabled:!0},elementLabel:{enabled:!0},toolbar:{enabled:!0}},BX=(e,t)=>({enabled:t.enabled??e.enabled,hue:t.hue??e.hue,selectionBox:{enabled:t.selectionBox?.enabled??e.selectionBox.enabled},dragBox:{enabled:t.dragBox?.enabled??e.dragBox.enabled},grabbedBoxes:{enabled:t.grabbedBoxes?.enabled??e.grabbedBoxes.enabled},elementLabel:{enabled:t.elementLabel?.enabled??e.elementLabel.enabled},toolbar:{enabled:t.toolbar?.enabled??e.toolbar.enabled}}),VX={activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,activationKey:void 0,getContent:void 0,maxContextLines:3,freezeReactUpdates:!0},HX=(e={})=>{let t=new Map,n={},[r,i]=DJ({theme:zX,options:{...VX,...e},actions:[]}),a=()=>{let r=zX,a={...VX,...e},o=[];for(let{config:e}of t.values())if(e.theme&&(r=BX(r,e.theme)),e.options&&(a={...a,...e.options}),e.actions)for(let t of e.actions)o.push(t);a={...a,...n},i(`theme`,r),i(`options`,a),i(`actions`,o)},o=(e,t)=>{n[e]=t,i(`options`,e,t)},s=[`activationMode`,`keyHoldDuration`,`allowActivationInsideInput`,`activationKey`,`getContent`,`maxContextLines`,`freezeReactUpdates`],c=e=>{for(let t of s)e[t]!==void 0&&o(t,e[t])},l=(e,n)=>{t.has(e.name)&&u(e.name);let r=e.setup?.(n,_)??{};e.theme&&(r.theme=r.theme?BX(BX(zX,e.theme),r.theme):e.theme),e.actions&&(r.actions=[...e.actions,...r.actions??[]]),e.hooks&&(r.hooks=r.hooks?{...e.hooks,...r.hooks}:e.hooks),e.options&&(r.options=r.options?{...e.options,...r.options}:e.options),t.set(e.name,{plugin:e,config:r}),a()},u=e=>{let n=t.get(e);n&&(n.config.cleanup&&n.config.cleanup(),t.delete(e),a())},d=()=>Array.from(t.keys()),f=(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&t(...n)}},p=(e,...n)=>{let r=!1;for(let{config:i}of t.values()){let t=i.hooks?.[e];t&&t(...n)===!0&&(r=!0)}return r},m=async(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&await t(...n)}},h=async(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=await t(i,...r))}return i},g=(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=t(i,...r))}return i},_={onActivate:()=>f(`onActivate`),onDeactivate:()=>f(`onDeactivate`),onElementHover:e=>f(`onElementHover`,e),onElementSelect:e=>{let n=!1,r;for(let{config:i}of t.values()){let t=i.hooks?.onElementSelect;if(t){let i=t(e);i===!0?n=!0:i instanceof Promise&&(n=!0,r=i)}}return{wasIntercepted:n,pendingResult:r}},onDragStart:(e,t)=>f(`onDragStart`,e,t),onDragEnd:(e,t)=>f(`onDragEnd`,e,t),onBeforeCopy:async e=>m(`onBeforeCopy`,e),transformCopyContent:async(e,t)=>h(`transformCopyContent`,e,t),onAfterCopy:(e,t)=>f(`onAfterCopy`,e,t),onCopySuccess:(e,t)=>f(`onCopySuccess`,e,t),onCopyError:e=>f(`onCopyError`,e),onStateChange:e=>f(`onStateChange`,e),onPromptModeChange:(e,t)=>f(`onPromptModeChange`,e,t),onSelectionBox:(e,t,n)=>f(`onSelectionBox`,e,t,n),onDragBox:(e,t)=>f(`onDragBox`,e,t),onGrabbedBox:(e,t)=>f(`onGrabbedBox`,e,t),onElementLabel:(e,t,n)=>f(`onElementLabel`,e,t,n),onContextMenu:(e,t)=>f(`onContextMenu`,e,t),onOpenFile:(e,t)=>p(`onOpenFile`,e,t),transformHtmlContent:async(e,t)=>h(`transformHtmlContent`,e,t),transformAgentContext:async(e,t)=>h(`transformAgentContext`,e,t),transformActionContext:e=>g(`transformActionContext`,e),transformOpenFileUrl:(e,t,n)=>g(`transformOpenFileUrl`,e,t,n)};return{register:l,unregister:u,getPluginNames:d,setOptions:c,store:r,hooks:_}},UX=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,WX=e=>{let t=e.bounds.x+e.bounds.width/2,n=e.bounds.width/2,r=e.mouseX===void 0?void 0:e.mouseX-t;return{id:UX(`label`),bounds:e.bounds,boundsMultiple:e.boundsMultiple,tagName:e.tagName,componentName:e.componentName,status:e.status,createdAt:Date.now(),element:e.element,elements:e.elements,mouseX:e.mouseX,mouseXOffsetFromCenter:r,mouseXOffsetRatio:r!==void 0&&n>0?r/n:void 0,hideArrow:e.hideArrow}},GX=(e,t)=>{let n=new Map,r=e=>{let t=n.get(e);t!==void 0&&(window.clearTimeout(t),n.delete(e))},i=()=>{for(let e of n.values())window.clearTimeout(e);n.clear()},a=()=>{i(),e.clearLabelInstances()},o=t=>{r(t);let i=window.setTimeout(()=>{e.updateLabelInstance(t,`fading`);let r=window.setTimeout(()=>{n.delete(t),e.removeLabelInstance(t)},125);n.set(t,r)},MM);n.set(t,i)};return{createInstance:(t,n,r,i,o)=>{a();let s=WX({bounds:t,tagName:n,componentName:r,status:i,element:o?.element,mouseX:o?.mouseX,elements:o?.elements,boundsMultiple:o?.boundsMultiple,hideArrow:o?.hideArrow});return e.addLabelInstance(s),s.id},createPerElementInstances:(t,n)=>{a();let r=[];for(let i of t){let t=WX({bounds:VJ(i.element),tagName:i.tagName,componentName:i.componentName,status:n,element:i.element,mouseX:i.mouseX});e.addLabelInstance(t),r.push(t.id)}return r},updateAfterCopy:(t,n,r)=>{n?e.updateLabelInstance(t,`copied`):e.updateLabelInstance(t,`error`,r||`Unknown error`),o(t)},cancelAllFades:i,clearAll:a,handleHoverChange:(e,n)=>{if(n){r(e);return}let i=t().find(t=>t.id===e);i&&(i.status===`copied`||i.status===`error`||i.status===`fading`)&&o(e)}}},KX=e=>{let t=window.innerWidth,n=window.innerHeight,r=Math.max(0,e.x),i=Math.min(t,e.x+e.width),a=Math.max(0,e.y),o=Math.min(n,e.y+e.height);return{x:(r+i)/2,y:(a+o)/2}},qX=(e,t,n)=>{let r=[],i=(t,r)=>{let i=KX(n(t)),a=yI(i.x,i.y).filter(e),o=a.indexOf(t);return o===-1?null:a[o+r]??null},a=e=>{let t=i(e,1);return t&&(r.push(e),r.length>50&&(r=r.slice(-50))),t},o=e=>{if(r.length>0){let e=r.pop();if(Jz(e))return e}return i(e,-1)},s=(e,n)=>{let i=e=>n?e.nextElementSibling:e.previousElementSibling,a=i(e);for(;a;){if(t(a))return r=[],a;a=i(a)}return null};return{findNext:(e,t)=>{switch(e){case`ArrowUp`:return a(t);case`ArrowDown`:return o(t);case`ArrowRight`:return s(t,!0);case`ArrowLeft`:return s(t,!1);default:return null}},clearHistory:()=>{r=[]}}},JX=e=>{let{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}=GY(e.activationKey);return{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}},YX=()=>{let e=new WeakSet,t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,`key`),n=!1;if(t?.get&&!t.get.__reactGrabPatched){n=!0;let r=t.get,i=function(){return e.has(this)?``:r.call(this)};i.__reactGrabPatched=!0,Object.defineProperty(KeyboardEvent.prototype,"key",{get:i,configurable:!0})}return{claimedEvents:e,originalKeyDescriptor:t,restore:()=>{n&&t&&Object.defineProperty(KeyboardEvent.prototype,"key",t)}}},XX=(e,t)=>({top:t<25,bottom:t>window.innerHeight-25,left:e<25,right:e>window.innerWidth-25}),ZX=(e,t,n)=>{let r=null,i=()=>{if(!t()){a();return}let o=e(),s=XX(o.x,o.y),c=0,l=0;if(s.top&&(l-=10),s.bottom&&(l+=10),s.left&&(c-=10),s.right&&(c+=10),c!==0||l!==0){let e=window.scrollX,t=window.scrollY;window.scrollBy(c,l);let r=window.scrollX-e,i=window.scrollY-t;(r!==0||i!==0)&&n?.({x:r,y:i})}r=s.top||s.bottom||s.left||s.right?UF(i):null},a=()=>{r!==null&&(WF(r),r=null)};return{start:i,stop:a,isActive:()=>r!==null}},QX=()=>{let e=globalThis;return!!(e.chrome?.runtime?.id||e.browser?.runtime?.id)},$X=e=>{try{let t=`0.1.48`,n=`data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 294 294"><path fill="#ff40e0" d="M145 47c25-20 50-27 67-17 16 9 23 30 20 60 0 2-1 5-1 7l-2 13h-1l-12-4c-8-3-17-5-25-6l-17-3c-10-1-20-1-29-1-10 0-20 0-29 1-6 8-11 16-16 24-5 9-9 17-13 26 4 9 8 18 13 26s10 16 16 24l11 14c5 7 11 13 18 19l10 8s-1 0 0 0l-11 9c-17 14-35 22-49 22-6 0-13-2-18-5-16-9-23-30-20-59 1-3 1-5 1-8-30-12-48-29-48-50 0-18 14-35 41-47 2-1 5-2 7-3 0-2 0-5-1-7-3-30 4-51 20-60 18-10 42-3 68 17M71 201c-1 2-1 4-1 5-2 24 3 41 13 47h1c11 7 30 1 51-15-10-9-18-18-26-29-13-1-26-4-38-8m9-38c-3 9-5 17-7 26 8 2 17 4 25 6-3-5-6-10-9-16-3-5-6-10-9-16m-19-53c-2 1-3 1-5 2-21 10-34 23-34 35 0 13 14 27 39 37 3-12 7-25 12-37-5-12-9-24-12-37m37-10c-8 1-17 3-25 6 2 8 4 16 7 25 3-5 6-11 9-16zm-3-61c-4-1-8 0-12 2-10 7-15 24-13 47 0 2 0 3 1 5 12-4 25-6 38-8 8-10 16-20 26-29-15-11-29-17-40-17m111 2c-4-2-8-3-12-2-11 0-25 5-40 17 10 9 19 19 26 29 13 2 26 4 39 8v-5c3-23-2-40-13-47m-61 23c-7 6-13 13-19 19h37c-6-6-12-13-18-19"/><mask id="a"><path fill="#fff" d="m235 85-133 27 28 133 133-27Z"/></mask><path fill="#ff40e0" d="m137 130 76 11c8 1 9 11 3 15l-28 16-4 32c-1 8-10 10-14 4l-41-66c-3-6 1-13 8-12" mask="url(#a)"/></svg>`)}`;console.log(`%cReact Grab${` v${t}`}%c\nhttps://react-grab.com`,`background: #330039; color: #ffffff; border: 1px solid #d75fcb; padding: 4px 4px 4px 24px; border-radius: 4px; background-image: url("${n}"); background-size: 16px 16px; background-repeat: no-repeat; background-position: 4px center; display: inline-block; margin-bottom: 4px;`,``),e&&navigator.onLine&&!QX()&&fetch(`https://www.react-grab.com/api/version?source=browser&v=${t}&t=${Date.now()}`,{referrerPolicy:`origin`,keepalive:!0,priority:`low`,cache:`no-store`}).then(e=>e.text()).then(e=>{e&&e!==t&&console.warn(`[React Grab] v${t} is outdated (latest: v${e}). Run \`npx grab@latest upgrade\` to upgrade.`)}).catch(()=>null)}catch{}},eZ=e=>typeof e==`object`&&!!e,tZ=e=>{if(!eZ(e))return null;let t={};return typeof e.enabled==`boolean`&&(t.enabled=e.enabled),(e.activationMode===`toggle`||e.activationMode===`hold`)&&(t.activationMode=e.activationMode),typeof e.keyHoldDuration==`number`&&Number.isFinite(e.keyHoldDuration)&&(t.keyHoldDuration=e.keyHoldDuration),typeof e.allowActivationInsideInput==`boolean`&&(t.allowActivationInsideInput=e.allowActivationInsideInput),typeof e.activationKey==`string`&&(t.activationKey=e.activationKey),typeof e.maxContextLines==`number`&&Number.isFinite(e.maxContextLines)&&(t.maxContextLines=e.maxContextLines),typeof e.freezeReactUpdates==`boolean`&&(t.freezeReactUpdates=e.freezeReactUpdates),typeof e.telemetry==`boolean`&&(t.telemetry=e.telemetry),Object.keys(t).length===0?null:t},nZ=()=>{if(typeof window>`u`)return null;try{let e=(document.currentScript instanceof HTMLScriptElement?document.currentScript:null)?.getAttribute(`data-options`);return e?tZ(JSON.parse(e)):null}catch{return null}},rZ=e=>e===`Enter`||e===`NumpadEnter`,iZ=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height,aZ=(e=>({name:e.name,setup:(t,n)=>({actions:[typeof e.contextMenuAction==`function`?e.contextMenuAction(t,n):e.contextMenuAction],cleanup:e.cleanup})}))({name:`copy`,contextMenuAction:{id:`copy`,label:`Copy`,shortcut:`C`,showInToolbarMenu:!0,onAction:e=>{e.copy?.()}}}),oZ={name:`comment`,setup:()=>({actions:[{id:`comment`,label:`Comment`,shortcut:`Enter`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterPromptMode?.()}}]})},sZ={name:`edit`,setup:()=>({actions:[{id:`edit`,label:`Style`,shortcut:`S`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterEditMode?.()}}]})},cZ={name:`open`,actions:[{id:`open`,label:`Open`,shortcut:`O`,enabled:e=>!!e.filePath,onAction:e=>{e.filePath&&(e.hooks.onOpenFile(e.filePath,e.lineNumber)||CI(e.filePath,e.lineNumber,e.hooks.transformOpenFileUrl),e.hideContextMenu(),e.cleanup())}}]},lZ=e=>{let t=e.left+e.width/2,n=e.top+e.height/2,r=n,i=window.innerHeight-n,a=t,o=window.innerWidth-t,s=Math.min(r,i,a,o);return s===r?`top`:s===a?`left`:s===o?`right`:`bottom`},uZ=()=>{let[e,t]=J(!1),[n,r]=J(null),i=MV(),a=()=>{let e=n();return Jz(e)?e:null},o=()=>{r(null),i.clear(),t(!1)};return{selectedElement:a,isPendingDismiss:e,select:(e,n)=>{r(e),t(!1),n?.shouldPromptBeforeMouseHandoff?i.arm():i.clear()},clear:o,consumeMouseHandoff:()=>i.consume()&&a()!==null,showDismissPrompt:()=>a()?e()?!1:(t(!0),!0):(o(),!1),takeSelection:e=>{let t=a()??(Jz(e)?e:null);return o(),t}}},dZ=async(e,t={})=>(await Promise.allSettled(e.map(e=>HU(e,t)))).map(e=>e.status===`fulfilled`?e.value:``),fZ=[aZ,sZ,oZ,cZ],pZ=!1,mZ=new Set,hZ=e=>{if(typeof window>`u`)return mY();let t={enabled:!0,activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,...nZ(),...e};if(t.enabled===!1||pZ)return mY();pZ=!0,CM(t.container??null),$X(t.telemetry!==!1);let{enabled:n,telemetry:r,container:i,...a}=t;return rR(e=>{let t=!1,n,r=HX(a),{store:i,actions:o,pointer:s,viewportVersion:c,current:l}=WJ({keyHoldDuration:r.store.options.keyHoldDuration??100}),u=Y(()=>l().state===`holding`),d=Y(()=>l().state===`active`),f=Y(()=>{let e=l();return e.state===`active`&&e.phase===`frozen`}),p=Y(()=>{let e=l();return e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)}),m=Y(()=>{if(!p())return!1;let e=Math.abs(s().x+window.scrollX-i.dragStart.x),t=Math.abs(s().y+window.scrollY-i.dragStart.y);return e>2||t>2}),h=Y(()=>{let e=l();return e.state===`active`&&e.phase===`dragging-reposition`}),g=Y(()=>{let e=l();return e.state===`active`&&e.phase===`justDragged`}),_=Y(()=>l().state===`copying`),v=Y(()=>i.selectionInteractionLockDepth>0),y=Y(()=>l().state===`justCopied`),b=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode}),x=Y(()=>i.pendingCommentMode||b()),S=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode&&!!e.isPendingDismiss}),C=(e,t)=>{document.body.style[e]=t};oR(dR(d,(e,t)=>{e&&!t?(SL(s().x,s().y),C(`touchAction`,`none`)):!e&&t&&(CL(),C(`touchAction`,``))}));let w=EV(),[T,ee]=J(!w||!w.collapsed),[E,D]=J(0),[O,te]=J(0),[k,A]=J(w),[ne,re]=J(!1),ie=OV(e=>e.shiftKey),[ae,oe]=J(null),[se,ce]=J(null),[le,ue]=J(null),de=RX({store:i,actions:o,isActivated:d,activateRenderer:()=>Gt(),deactivateRenderer:()=>Kt(),performCopyWithLabel:e=>dt(e),onOpen:()=>{kr(),ge?.(),ge=Or(Dr,ce)},onClose:()=>{ge?.(),ge=null,ce(null)}}),fe=Y(()=>i.contextMenuPosition!==null||de.isOpen()),pe=Y(()=>fe()||ae()!==null),me,he=null,ge=null,_e=!1,ve=new WeakMap,ye=uZ(),be=()=>!T()||b()||v()||fe()||ye.isPendingDismiss(),xe=()=>{ve=new WeakMap},Se=()=>{Le(!1),xe()},Ce=e=>{let t=k()??EV(),n={edge:t?.edge??`bottom`,ratio:t?.ratio??.5,collapsed:t?.collapsed??!1,enabled:t?.enabled??!0,defaultAction:t?.defaultAction??`copy`,...e};DV(n),A(n);for(let e of mZ)e(n)},we=()=>{Fe.timerId!==null&&(clearTimeout(Fe.timerId),Fe.timerId=null)},Te=()=>{Fe.copyWaiting=!1,Fe.holdTimerFired=!1,Fe.startTimestamp=null};oR(()=>{if(l().state!==`holding`){we();return}Fe.startTimestamp=Date.now(),Fe.timerId=window.setTimeout(()=>{if(Fe.timerId=null,Fe.copyWaiting){Fe.holdTimerFired=!0;return}o.activate()},i.keyHoldDuration),pR(we)}),oR(()=>{let e=l();if(e.state!==`active`||e.phase!==`justDragged`)return;let t=setTimeout(()=>{o.finishJustDragged()},MM);pR(()=>clearTimeout(t))}),oR(()=>{if(l().state!==`justCopied`)return;let e=setTimeout(()=>{o.finishJustCopied()},MM);pR(()=>clearTimeout(e))}),oR(dR(u,(e,t=!1)=>{!t||e||!d()||(r.store.options.activationMode!==`hold`&&o.setWasActivatedByToggle(!0),r.hooks.onActivate())}));let Ee=(e,t,n)=>{Oe(e,t,n),o.clearInputText()},De=()=>{let e=i.frozenElement||pt();e&&o.enterPromptMode({x:s().x,y:s().y},e)},Oe=(e,t,n)=>{o.setCopyStart({x:t,y:n},e)},ke={lastDetectionTimestamp:0,pendingDetectionScheduledAt:0,latestPointerX:0,latestPointerY:0},Ae=null,[je,Me]=J(null),Ne=(e,t)=>{Ae!==null&&clearTimeout(Ae),Me(null),Ae=window.setTimeout(()=>{Me({x:e,y:t}),Ae=null},32)},Pe=null,Fe={timerId:null,startTimestamp:null,copyWaiting:!1,holdTimerFired:!1},Ie=null,[j,Le]=J(!1),Re=0,ze=!1,Be=null,Ve=()=>{ze=!0,Be!==null&&window.clearTimeout(Be),Be=window.setTimeout(()=>{ze=!1,Be=null},MM)},He=()=>{Be!==null&&(window.clearTimeout(Be),Be=null),ze=!1},Ue=0,We=null,Ge=null,[M,Ke]=J(!1),[qe,Je]=J(null),[Ye,Xe]=J(null),[Ze,Qe]=JJ(Ye),$e=Y(()=>de.isOpen()?oN:x()?aN:M()?qe():d()?iN:null),et=e=>RY(e,rI),tt=qX(rI,et,VJ),nt=ZX(s,()=>p(),e=>{if(h()){if(o.shiftDragStart(e),Ie){Ie={x:Ie.x+e.x,y:Ie.y+e.y};return}let{pageX:t,pageY:n}=Et(s().x,s().y);Ie={x:t,y:n}}}),N=Y(()=>d()&&!_()),rt=new Map,it=(e,t)=>{let n=UX(`grabbed`),i={id:n,bounds:e,createdAt:Date.now(),element:t};o.addGrabbedBox(i),r.hooks.onGrabbedBox(e,t);let a=window.setTimeout(()=>{rt.delete(n),o.removeGrabbedBox(n)},MM+125);rt.set(n,a)},at=async e=>{let t=await Promise.all(e.map(async e=>{let t=await DU(e),n=t?.componentName??null,r=t?.filePath,i=t?.lineNumber??void 0,a=t?.columnNumber??void 0;n||=OU(e);let o=e instanceof HTMLElement?e.innerText?.slice(0,100):void 0;return{tagName:TN(e),id:e.id||void 0,className:e.getAttribute(`class`)||void 0,textContent:o,componentName:n??void 0,filePath:r,lineNumber:i,columnNumber:a}}));window.dispatchEvent(new CustomEvent(`react-grab:element-selected`,{detail:{elements:t}}))},ot=GX(o,()=>i.labelInstances),st=async(e,t,n)=>{He(),l().state!==`copying`&&o.startCopy();let r=!1,i;try{r=await e(),r||(i=`Failed to copy`)}catch(e){i=gY(e,`Action failed`)}if(t)for(let e of t)ot.updateAfterCopy(e,r,i);l().state===`copying`&&(r&&o.completeCopy(),n?Kt():r?(o.activate(),Ve()):o.unfreeze())},ct=(e,t,n)=>{let i=e[0],a=n??(i?OU(i):null),o=i?TN(i):null,s=a??o??void 0;return SY({getContent:r.store.options.getContent,componentName:s,maxContextLines:r.store.options.maxContextLines},r.hooks,e,t)},lt=async(e,t,n)=>{if(e.length===0)return!1;let i=[],a=[];for(let t of e){let{wasIntercepted:e,pendingResult:n}=r.hooks.onElementSelect(t);e||i.push(t),n&&a.push(n),r.store.theme.grabbedBoxes.enabled&&it(VJ(t),t)}await GF();let o=!0;if(i.length>0&&(o=await ct(i,t,n)),a.length>0&&!(await Promise.all(a)).every(Boolean))throw new RV;return at(e),o},ut=e=>{bU(e.primaryElement).then(async t=>{await st(()=>lt(e.targetElements,e.extraPrompt,t??void 0),e.labelInstanceIds.length>0?e.labelInstanceIds:null,e.shouldDeactivateAfter),e.onComplete?.()}).catch(t=>{let n=gY(t,`Action failed`);for(let t of e.labelInstanceIds)ot.updateAfterCopy(t,!1,n);l().state===`copying`&&o.unfreeze()})},dt=e=>{let{element:t,cursorX:n,selectedElements:r,extraPrompt:a,shouldDeactivateAfter:s,onComplete:c,dragRect:l}=e,u=r??[t],d=l??i.frozenDragRect,f=u.length>1,p=!f&&t===yt()?Tt():void 0,m=d&&f?MY(d):p??VJ(t),h=f?m.x+m.width/2:n,g=TN(t);He(),o.startCopy();let _=g?ot.createInstance(m,g,void 0,`copying`,{element:t,mouseX:h,elements:r}):null;ut({primaryElement:t,targetElements:u,labelInstanceIds:_?[_]:[],extraPrompt:a,shouldDeactivateAfter:s,onComplete:c})},ft=e=>{let{elements:t,labelEntries:n,shouldDeactivateAfter:r,onComplete:i}=e,a=t[0];He(),o.startCopy(),ut({primaryElement:a,targetElements:t,labelInstanceIds:ot.createPerElementInstances(n,`copying`),shouldDeactivateAfter:r,onComplete:i})},pt=Y(()=>{if(c(),!N()||m()||v()||ye.isPendingDismiss())return null;let e=i.detectedElement;return Jz(e)?e:null}),P=Y(()=>i.frozenElement||(f()?null:pt())),mt=Y(()=>!d()||b()||j()||_()||pe()||ye.isPendingDismiss()?null:ie()?f()?P():pt()??i.frozenElement:ye.selectedElement()),ht=Y(()=>{let e=mt();return e?FY(e,rI,et):[]}),gt=Y(()=>{let e=mt();return e?Math.max(0,ht().findIndex(t=>t.element===e)):0}),_t=Y(()=>mt()!==null);oR(()=>{let e=i.detectedElement;if(!e)return;let t=setInterval(()=>{Jz(e)||o.setDetectedElement(null)},100);pR(()=>clearInterval(t))}),oR(dR(P,e=>{if(We!==null&&(clearTimeout(We),We=null),!e){Xe(null);return}We=window.setTimeout(()=>{We=null,Xe(e)},100)})),pR(()=>{We!==null&&(clearTimeout(We),We=null)}),oR(()=>{let e=i.frozenElements;pR(tL(e))}),oR(dR(d,e=>{e&&r.store.options.freezeReactUpdates&&pR($L())}));let vt=()=>{if(i.isTouchMode&&p()){let e=i.detectedElement;return!e||qF(e)?void 0:e}let e=P();if(!(!e||qF(e)))return e},yt=Y(()=>vt()),bt=()=>yt()?i.isTouchMode&&p()?N():N()&&!m():!1,xt=RR(()=>i.frozenElements,e=>Y(()=>(c(),VJ(e)))),St=Y(()=>{let e=i.frozenElements;if(e.length===0)return[];let t=i.frozenDragRect;return t&&e.length>1?[MY(t)]:xt().map(e=>e())}),Ct=Y(()=>{if(!j()||i.pendingCommentMode||M())return null;let e=i.detectedElement;return!Jz(e)||qF(e)||i.frozenElements.includes(e)?null:e}),wt=Y(()=>{c();let e=Ct();if(e)return VJ(e)}),Tt=Y(()=>{c();let e=i.frozenElements;if(e.length>0){let t=St();if(e.length===1){let e=t[0];if(e)return e}let n=i.frozenDragRect;return n?t[0]??MY(n):PY(qY(t))}let t=yt();if(t)return VJ(t)}),Et=(e,t)=>({pageX:e+window.scrollX,pageY:t+window.scrollY}),Dt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t);return{x:Math.abs(n-i.dragStart.x),y:Math.abs(r-i.dragStart.y)}},Ot=Y(()=>{if(!p())return!1;let e=Dt(s().x,s().y);return e.x>2||e.y>2}),kt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t),a=Math.min(i.dragStart.x,n),o=Math.min(i.dragStart.y,r),s=Math.abs(n-i.dragStart.x),c=Math.abs(r-i.dragStart.y);return{x:a-window.scrollX,y:o-window.scrollY,width:s,height:c}},At=e=>e.code===`Space`||e.key===` `,jt=()=>{if(!p())return;o.startDragReposition();let{pageX:e,pageY:t}=Et(s().x,s().y);Ie={x:e,y:t}},Mt=()=>{o.stopDragReposition(),Ie=null},Nt=Y(()=>{if(c(),Ot())return PY(kt(s().x,s().y))}),Pt=Y(()=>{if(c(),!Ot())return[];let e=je();if(!e)return[];let t=kt(e.x,e.y),n=kY(t,rI);return(n.length>0?n:kY(t,rI,!1)).map(e=>VJ(e))}),Ft=Y(()=>{let e=Pt();if(e.length>0)return e;let t=wt();return t?[...St(),t]:St()}),It=RR(()=>i.frozenElements,e=>{let t=TN(e)||`element`,n=OU(e)??void 0;return Y(()=>{if(c(),!Jz(e))return null;let r=VJ(e),i=ve.get(e);return{tagName:t,componentName:n,bounds:r,mouseX:i===void 0?void 0:r.x+r.width*i}})}),Lt=Y(()=>{if(b()||i.frozenElements.length<2)return[];let e=[];for(let t of It()){let n=t();n!==null&&e.push(n)}return e}),Rt=Y(()=>{if(b())return null;let e=Ct();return e?(c(),{tagName:TN(e)||`element`,componentName:OU(e)??void 0,bounds:VJ(e),mouseX:s().x}):null}),zt=Y(()=>{if(_()||b()){c();let e=i.frozenElement||pt();return e?{x:HJ(VJ(e)).x+i.copyOffsetFromCenterX,y:i.copyStart.y}:{x:i.copyStart.x,y:i.copyStart.y}}return{x:s().x,y:s().y}}),Bt=Y(()=>{if(!j()||i.frozenElements.length!==1)return;c();let e=i.frozenElements[0];if(!Jz(e))return;let t=ve.get(e);if(t===void 0)return;let n=VJ(e);return n.x+n.width*t});oR(dR(()=>[pt(),i.lastGrabbedElement],([e,t])=>{t&&e&&t!==e&&o.setLastGrabbed(null),e&&r.hooks.onElementHover(e)})),oR(dR(()=>pt(),e=>{let t=++Ue,n=()=>{Ue===t&&o.setSelectionSource(null,null)};if(!e){n();return}DU(e).then(e=>{if(Ue===t){if(!e){n();return}o.setSelectionSource(e.filePath,e.lineNumber)}}).catch(()=>{Ue===t&&o.setSelectionSource(null,null)})}));let Vt=Y(()=>i.grabbedBoxes.map(e=>({id:e.id,bounds:e.bounds,createdAt:e.createdAt}))),Ht=Y(()=>i.labelInstances.map(e=>({id:e.id,status:e.status,tagName:e.tagName,componentName:e.componentName,createdAt:e.createdAt})));oR(dR(Y(()=>{let e=d(),t=p(),n=_(),a=b(),o=pt(),s=Nt(),c=r.store.theme.enabled,l=r.store.theme.selectionBox.enabled,u=r.store.theme.dragBox.enabled,f=Ot(),m=P(),h=y();return{isActive:e,isDragging:t,isCopying:n,isPromptMode:a,isSelectionBoxVisible:!!(c&&l&&e&&!n&&!h&&!t&&m!=null),isDragBoxVisible:!!(c&&u&&e&&!n&&f),targetElement:o,dragBounds:s?{x:s.x,y:s.y,width:s.width,height:s.height}:null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:k()}}),e=>{r.hooks.onStateChange(e)})),oR(dR(()=>{let e=b();return{inputMode:e,position:e?s():uR(s),target:e?pt():uR(pt)}},({inputMode:e,position:t,target:n})=>{r.hooks.onPromptModeChange(e,{x:t.x,y:t.y,targetElement:n})})),oR(dR(()=>[ar(),Tt(),pt()],([e,t,n])=>{r.hooks.onSelectionBox(!!e,t??null,n)})),oR(dR(()=>[fr(),Nt()],([e,t])=>{r.hooks.onDragBox(!!e,t??null)})),oR(dR(()=>{let e=mr();return[e,pr(),e?zt():uR(zt),e?pt():uR(pt),i.selectionFilePath,i.selectionLineNumber]},([e,t,n,i,a,o])=>{r.hooks.onElementLabel(e,t,{x:n.x,y:n.y,content:``,element:i??void 0,tagName:i&&TN(i)||void 0,filePath:a??void 0,lineNumber:o??void 0})}));let Ut=null,Wt=e=>{if(e){if(!Ut){Ut=document.createElement(`style`),Ut.setAttribute(`data-react-grab-cursor`,``);let e=DN();e&&(Ut.nonce=e),kN(Ut),document.head.appendChild(Ut)}Ut.textContent=`* { cursor: ${e} !important; }`}else Ut&&=(Ut.remove(),null)};oR(dR(()=>[d(),_(),b()],([e,t,n])=>{Wt(t?`progress`:e&&!n?`crosshair`:null)}));let Gt=()=>{let e=u();o.activate(),e||r.hooks.onActivate()},Kt=()=>{let e=p(),t=i.previouslyFocusedElement;Mt(),o.deactivate(),de.resetWithDiscard(),kr(),Se(),wn(),ye.clear(),Ke(!1),Je(null),e&&C(`userSelect`,``),Pe&&window.clearTimeout(Pe),nt.stop(),t instanceof HTMLElement&&t!==document.body&&t!==document.activeElement&&Jz(t)&&t.focus({preventScroll:!0}),r.hooks.onDeactivate()},qt=()=>{u()&&o.releaseHold(),d()&&Kt(),He()},Jt=()=>{o.setWasActivatedByToggle(!0),Gt()},Yt=()=>{let e=[...i.frozenElements],t=i.frozenElement||pt(),n=b()?i.inputText.trim():``;if(!t){Kt();return}let r=e.length>0?e:[t],a=r.map(e=>VJ(e))[0],{x:s,y:c}=HJ(a),l=s+i.copyOffsetFromCenterX;o.setPointer({x:s,y:c}),o.exitPromptMode(),o.clearInputText(),dt({element:t,cursorX:l,selectedElements:r,extraPrompt:n||void 0,shouldDeactivateAfter:!0})},Xt=()=>{if(b()){if(S()){o.clearInputText(),Kt();return}o.setPendingDismiss(!0),te(e=>e+1)}},Zt=()=>{if(ye.isPendingDismiss()){Dn();return}o.clearInputText(),Kt()},Qt=()=>{o.setPendingDismiss(!1)},$t=()=>{if(de.isOpen()){de.dismiss();return}let e=i.frozenElement||pt();e&&en(e,{x:s().x,y:s().y})},en=(e,t,n={})=>de.trigger(e,t,n),tn=(e,t)=>{if(!de.isOpen()||i.contextMenuPosition!==null)return!1;let n=yI(e,t).find(rI);if(!n)return!1;let r=de.switchToElement(n,{x:e,y:t});return r&&$I([n]),r},nn=e=>({filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,componentName:Ze(),tagName:TN(e)||void 0}),rn=()=>{Ge=null,Ke(!1),o.setPendingCommentMode(!1),Je(null)},an=e=>{let t=i.frozenElement||pt();if(!t)return!1;let n={x:s().x,y:s().y},a=r.store.actions.find(t=>t.id===e);return a?e===`edit`?en(t,n,nn(t))?(o.clearInputText(),o.exitPromptMode(),rn(),!0):!0:(o.clearInputText(),o.exitPromptMode(),rn(),a.onAction(Nn(t,n)),!0):(o.clearInputText(),o.exitPromptMode(),rn(),Mr(iN),ln(t,n),!0)},on=e=>{if(d()){if($e()!==e&&b()&&an(e))return;if($e()!==e&&i.pendingCommentMode){o.setPendingCommentMode(!1),Ge=e,Je(e),Ke(!0);return}if($e()!==e&&M()){Ge=e,Je(e);return}Kt();return}T()&&(Ge=e,Je(e),Ke(!0),Jt())},sn=()=>{on(k()?.defaultAction??`copy`)},cn=(e,t,n)=>{rn(),o.clearInputText(),o.enterPromptMode({x:t,y:n},e)},ln=(e,t)=>{Se(),Ar(),o.showContextMenu(t,e),wn(),r.hooks.onContextMenu(e,t)},un=(e,t)=>{let n=Ge;if(Ge=null,Je(null),!n)return;if(n===`edit`){en(e,t,nn(e));return}let i=r.store.actions.find(e=>e.id===n);if(!i){Mr(iN),ln(e,t);return}i.onAction(Nn(e,t))},dn=()=>{if(T()){if(d()&&x()){Kt();return}o.setPendingCommentMode(!0),d()||Jt()}},fn=(e,t,n)=>{let r=n&&j()&&!p()&&!i.pendingCommentMode&&!M();if(be()||f()&&!r)return;if(o.setPointer({x:e,y:t}),ke.latestPointerX=e,ke.latestPointerY=t,r){let n=bI(e,t);n!==i.detectedElement&&o.setDetectedElement(n);return}let a=performance.now(),s=ke.pendingDetectionScheduledAt>0&&a-ke.pendingDetectionScheduledAt<200;if(a-ke.lastDetectionTimestamp>=32&&!s&&(ke.lastDetectionTimestamp=a,ke.pendingDetectionScheduledAt=a,setTimeout(()=>{if(be()){ke.pendingDetectionScheduledAt=0;return}let e=bI(ke.latestPointerX,ke.latestPointerY);e!==i.detectedElement&&o.setDetectedElement(e),ke.pendingDetectionScheduledAt=0})),p()){if(h()){let{pageX:n,pageY:r}=Et(e,t);Ie&&o.shiftDragStart({x:n-Ie.x,y:r-Ie.y}),Ie={x:n,y:r}}Ne(e,t);let n=XX(e,t),r=n.top||n.bottom||n.left||n.right;r&&!nt.isActive()?nt.start():!r&&nt.isActive()&&nt.stop()}},pn=(e,t,n)=>{if(!N()||v())return!1;!n&&j()&&Se();let i=ye.selectedElement()!==null;return o.startDrag({x:e,y:t},n||i),o.setPointer({x:e,y:t}),C(`userSelect`,`none`),Ne(e,t),r.hooks.onDragStart(e+window.scrollX,t+window.scrollY),!0},mn=(e,t)=>{let n=i.frozenElements.includes(e),r=i.frozenElements.length===0;if(!n){let n=AY(VJ(e),t);ve.set(e,n),r&&Qe(OU(e)??void 0)}o.toggleFrozenElement(e),xI();let a=i.frozenElements.includes(e);if(a||ve.delete(e),i.frozenElements.length===0){Se(),o.unfreeze();return}$I(i.frozenElements),Le(!0),o.setPointer(t),o.setLastGrabbed(a?e:i.frozenElements[i.frozenElements.length-1]),o.freeze(),wn()},hn=()=>{let e=i.frozenElements.filter(Jz),t=e.map(e=>{let t=TN(e)||`element`,n=OU(e)??void 0,r=ve.get(e),i=VJ(e);return{element:e,tagName:t,componentName:n,mouseX:r===void 0?i.x+i.width/2:i.x+i.width*r}});if(Se(),e.length===0){o.unfreeze();return}if(e.length===1){dt({element:e[0],cursorX:t[0].mouseX,selectedElements:e,shouldDeactivateAfter:i.wasActivatedByToggle});return}ft({elements:e,labelEntries:t,shouldDeactivateAfter:i.wasActivatedByToggle})},gn=(e,t,n)=>{let a=kY(e,rI),s=a.length>0?a:kY(e,rI,!1);if(s.length===0)return;let c=n&&!i.pendingCommentMode&&!M();if(c&&o.addFrozenElements(s),$I(c?i.frozenElements:s),r.hooks.onDragEnd(s,e),c){let e=s[s.length-1];Le(!0),xI(),o.setPointer(HJ(VJ(e))),o.setLastGrabbed(e),o.freeze(),wn();return}let l=s[0],u=HJ(VJ(l));o.setPointer(u),o.setFrozenElements(s);let d=NY(e);if(o.setFrozenDragRect(d),o.freeze(),o.setLastGrabbed(l),i.pendingCommentMode){cn(l,u.x,u.y);return}if(M()){Ke(!1),Ge?un(l,u):ln(l,u);return}let f=i.wasActivatedByToggle&&!t;dt({element:l,cursorX:u.x,selectedElements:s,shouldDeactivateAfter:f,dragRect:d})},_n=e=>{for(let t of i.frozenElements)if(Jz(t)&&iZ(e,VJ(t)))return t;return null},vn=(e,t,n,a)=>{let c=Jz(i.frozenElement)?i.frozenElement:null,l=ye.selectedElement(),u=()=>yI(e,t).find(rI)??null;if(a&&!i.pendingCommentMode&&!M()){let n=u();n!==null&&mn(n,{x:e,y:t});return}let d=u()??(Jz(i.detectedElement)?i.detectedElement:null),f=l??d??c;if(!f)return;let p,m,h=d===null&&c===f,g=l===f;if(h)p=s().x,m=s().y;else if(g){let e=HJ(VJ(f));p=e.x,m=e.y}else p=e,m=t;if(i.pendingCommentMode){cn(f,p,m),ye.clear();return}if(M()){Ke(!1);let{wasIntercepted:e}=r.hooks.onElementSelect(f);if(e)return;ye.clear(),$I([f]),o.setFrozenElement(f);let t={x:p,y:m};o.setPointer(t),o.freeze(),Ge?un(f,t):ln(f,t);return}let _=i.wasActivatedByToggle&&!n;o.setLastGrabbed(f),dt({element:f,cursorX:p,shouldDeactivateAfter:_}),ye.clear()},yn=()=>{p()&&(Mt(),o.cancelDrag(),nt.stop(),C(`userSelect`,``))},bn=(e,t,n,r)=>{if(!p())return;Ae!==null&&(clearTimeout(Ae),Ae=null),Me(null);let i=Dt(e,t),a=i.x>2||i.y>2,s=a?kt(e,t):null;a?o.endDrag():o.cancelDrag(),Mt(),nt.stop(),C(`userSelect`,``),s?gn(s,n,r):vn(e,t,n,r)},xn=hY(),Sn=YX(),Cn=e=>{let t;try{t=Sn.originalKeyDescriptor?.get?Sn.originalKeyDescriptor.get.call(e):e.key}catch{return!1}let n=t===`Enter`||rZ(e.code),r=d()||u();return n&&r&&!b()&&!ye.isPendingDismiss()&&!i.wasActivatedByToggle?CB(e,`data-react-grab-input`)?!1:(Sn.claimedEvents.add(e),e.preventDefault(),e.stopImmediatePropagation(),!0):!1};xn.addDocumentListener(`keydown`,EM(Cn),{capture:!0}),xn.addDocumentListener(`keyup`,EM(Cn),{capture:!0}),xn.addDocumentListener(`keypress`,EM(Cn),{capture:!0});let wn=()=>{tt.clearHistory(),ye.clear()},Tn=(e,t=!1)=>{o.setFrozenElement(e),o.freeze(),ye.select(e,{shouldPromptBeforeMouseHandoff:t});let n=HJ(VJ(e));o.setPointer(n),i.contextMenuPosition!==null&&o.showContextMenu(n,e)},En=()=>{ye.showDismissPrompt()&&te(e=>e+1)},Dn=()=>{ye.clear(),o.unfreeze(),wn()},On=()=>{let e=ye.takeSelection(i.frozenElement);if(!e){Dn();return}let t=HJ(VJ(e));wn(),o.setLastGrabbed(e),dt({element:e,cursorX:t.x,shouldDeactivateAfter:i.wasActivatedByToggle})},kn=e=>$M.has(e.key)?e.key:e.key===`Tab`?e.shiftKey?`ArrowLeft`:`ArrowRight`:null,An=(e,t={})=>{if(!d()||b()||j()||ye.isPendingDismiss()&&!t.allowPendingKeyboardSelection)return!1;let n=kn(e);if(!n||pe())return!1;let r=P(),i=!r;if(!r){let e=wM()?.getBoundingClientRect();r=e?bI(e.left+e.width/2,e.top+e.height/2):bI(window.innerWidth/2,window.innerHeight/2)}if(!r)return!1;let a=n===`ArrowUp`||n===`ArrowDown`,o=tt.findNext(n,r);if(!o&&!a&&!i)return!1;let s=o??r;return e.preventDefault(),e.stopPropagation(),Tn(s,!0),!0},jn=e=>e.metaKey||e.ctrlKey||e.altKey||e.repeat||Zz(e)||!d()||_()||v()||pe()?null:i.frozenElement||pt(),Mn=e=>{let t=jn(e);if(!t)return null;let n=jV(r.store.actions,e);return n?{element:t,action:n}:null},Nn=(e,t)=>{let n=VJ(e);return Cr({element:e,filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,tagName:TN(e)||void 0,componentName:Ze(),position:t,shouldDeferHideContextMenu:!1,performWithFeedbackOptions:{fallbackBounds:n,fallbackSelectionBounds:[n],position:t}})},Pn=/^[a-zA-Z0-9-]$/,Fn=e=>{if(!e.key||e.key.length!==1||!Pn.test(e.key))return!1;let t=jn(e);return!t||!de.trigger(t,{x:s().x,y:s().y},{initialSearchQuery:e.key})?!1:(rn(),e.preventDefault(),e.stopImmediatePropagation(),!0)},In=e=>{let t=Mn(e);if(!t)return!1;let{element:n,action:r}=t;if(b())return an(r.id)?(e.preventDefault(),e.stopImmediatePropagation(),!0):!1;let i={x:s().x,y:s().y};return r.onAction(Nn(n,i)),e.preventDefault(),e.stopImmediatePropagation(),!0},Ln=e=>{if(e.key?.toLowerCase()!==`o`||!d()||!(e.metaKey||e.ctrlKey))return!1;let t=i.selectionFilePath,n=i.selectionLineNumber;return t?(e.preventDefault(),e.stopPropagation(),r.hooks.onOpenFile(t,n??void 0)||CI(t,n??void 0,r.hooks.transformOpenFileUrl),!0):!1},Rn=e=>{if(!d()||_()||i.contextMenuPosition!==null||de.isOpen())return!1;let t=e.key===`F10`&&e.shiftKey,n=e.key===`ContextMenu`;if(!t&&!n)return!1;let r=i.frozenElements,a=r.length>1,s=(a?r[0]:null)||i.frozenElement||pt();if(!s)return!1;e.preventDefault(),e.stopPropagation();let c=HJ(VJ(s));return a?$I(r):($I([s]),o.setFrozenElement(s)),o.setPointer(c),o.freeze(),ln(s,c),!0},zn=Y(()=>ht().map(e=>({tagName:TN(e.element)||`element`,componentName:OU(e.element)??void 0,depth:e.depth,isLast:e.isLast}))),Bn=Y(()=>({items:zn(),activeIndex:gt()})),Vn=e=>{if(!(!r.store.options.allowActivationInsideInput&&Zz(e))&&!(!KY(e,r.store.options)&&((e.metaKey||e.ctrlKey)&&!QM.includes(e.key)&&!rZ(e.code)&&(d()&&!i.wasActivatedByToggle?Kt():u()&&(we(),Te(),o.releaseHold())),!rZ(e.code)||!u()))){if((d()||u())&&!b()&&(e.preventDefault(),rZ(e.code)&&e.stopImmediatePropagation()),d()){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e.repeat)return;Pe!==null&&window.clearTimeout(Pe),Pe=window.setTimeout(()=>{Kt()},200);return}if(u()&&e.repeat){if(Fe.copyWaiting){let e=Fe.holdTimerFired;Te(),e&&o.activate()}return}if(!(_()||y())&&!u()){let t=r.store.options.keyHoldDuration??100;Zz(e)?Qz(e)?t+=600:t+=400:$z()&&(t+=600),Te(),o.startHold(t)}}},Hn=e=>{if(!ye.isPendingDismiss())return!1;if(rZ(e.code))return!0;let t=$M.has(e.key),n=Mn(e)!==null;return!t&&!n?!1:t?An(e,{allowPendingKeyboardSelection:!0}):In(e)?(wn(),!0):!1};xn.addWindowListener(`keydown`,EM(e=>{if(kn(e)&&Zz(e)||Hn(e))return;if(Cn(e),!T()){KY(e,r.store.options)&&!e.repeat&&D(e=>e+1);return}let t=rZ(e.code)&&u()&&!b(),n=CB(e,nN);if(b()&&KY(e,r.store.options)&&!e.repeat&&!n){e.preventDefault(),e.stopPropagation(),Xt();return}if(e.key===`Escape`&&pe()){ae()!==null&&kr();return}let a=CB(e,`data-react-grab-ignore-events`)&&!t;if(b()||a)return b()&&!n&&In(e)||(e.key===`Escape`&&(b()?Xt():i.wasActivatedByToggle&&Kt()),a&&$M.has(e.key)&&An(e)),void 0;if(p()&&At(e)){e.repeat||jt(),e.preventDefault(),e.stopPropagation();return}if(e.key===`Escape`&&(u()||i.wasActivatedByToggle)){Kt();return}d()&&!QM.includes(e.key)&&e.preventDefault();let o=Date.now()-Re<200;An(e)||Ln(e)||Rn(e)||In(e)||Fn(e)||o||Vn(e)}),{capture:!0}),xn.addWindowListener(`keyup`,EM(e=>{if(Cn(e))return;if(At(e)&&h()&&(Mt(),e.preventDefault(),e.stopPropagation()),e.key===`Shift`&&j()){p()&&yn(),hn();return}if(CB(e,`data-react-grab-ignore-events`))return;let t=JX(r.store.options),n=t.metaKey||t.ctrlKey?SB()?!e.metaKey:!e.ctrlKey:t.shiftKey&&!e.shiftKey||t.altKey&&!e.altKey,a=r.store.options.activationKey?typeof r.store.options.activationKey==`function`?r.store.options.activationKey(e):WY(r.store.options.activationKey)(e):BY(e.key,e.code);if(y()||ze){(a||n)&&(He(),Kt());return}if(!u()&&!d()||b())return;let s=!!r.store.options.activationKey,c=r.store.options.activationMode===`hold`,l=p();if(d()){let e=fe();if(n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e)return;Kt()}else if(c&&a){if(Pe!==null&&(window.clearTimeout(Pe),Pe=null),e||l)return;Kt()}else!s&&a&&Pe!==null&&(window.clearTimeout(Pe),Pe=null);return}if(a||n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`)return;if(u()||Fe.holdTimerFired&&n){we();let t=(Fe.startTimestamp?Date.now()-Fe.startTimestamp:0)>=200,n=Fe.holdTimerFired&&t&&(r.store.options.allowActivationInsideInput||!Zz(e));Te(),n?o.activate():o.releaseHold()}else Kt()}}),{capture:!0}),xn.addDocumentListener(`copy`,()=>{u()&&(Fe.copyWaiting=!0)}),xn.addWindowListener(`keypress`,EM(Cn),{capture:!0}),xn.addWindowListener(`pointermove`,EM(e=>{if(!e.isPrimary)return;let t=e.pointerType===`touch`;if(o.setTouchMode(t),!CB(e,`data-react-grab-ignore-events`)&&!be()&&!(t&&!u()&&!d())){if((t?u():d())&&!b()&&f()&&!e.shiftKey&&!j()){if(ye.consumeMouseHandoff()){En();return}o.unfreeze(),wn()}fn(e.clientX,e.clientY,e.shiftKey)}}),{passive:!0}),xn.addWindowListener(`pointerdown`,EM(e=>{if(e.button===0&&e.isPrimary&&(o.setTouchMode(e.pointerType===`touch`),_e=!1,!CB(e,`data-react-grab-ignore-events`))){if(fe()){tn(e.clientX,e.clientY)&&(_e=!0,e.preventDefault(),e.stopImmediatePropagation());return}if(b()){let t=Tt();t&&e.clientX>=t.x&&e.clientX<=t.x+t.width&&e.clientY>=t.y&&e.clientY<=t.y+t.height?Yt():Xt();return}if(ye.isPendingDismiss()){e.preventDefault(),e.stopImmediatePropagation();return}if(v()){e.preventDefault(),e.stopImmediatePropagation();return}pn(e.clientX,e.clientY,e.shiftKey)&&(e.pointerId!==void 0&&document.documentElement.setPointerCapture(e.pointerId),e.preventDefault(),e.stopImmediatePropagation())}}),{capture:!0}),xn.addWindowListener(`pointerup`,EM(e=>{if(e.button!==0||!e.isPrimary||CB(e,`data-react-grab-ignore-events`)||fe())return;let t=N()||v()||p(),n=e.metaKey||e.ctrlKey;bn(e.clientX,e.clientY,n,e.shiftKey),t&&(e.preventDefault(),e.stopImmediatePropagation())}),{capture:!0}),xn.addWindowListener(`contextmenu`,EM(e=>{if(!N()||_()||b()||de.isOpen())return;let t=CB(e,`data-react-grab-ignore-events`),n={x:e.clientX,y:e.clientY},r=t&&i.frozenElements.length>1?_n(n):null,a=ye.isPendingDismiss();if(t&&!r&&!a&&!_t())return;if(fe()){e.preventDefault();return}e.preventDefault(),e.stopPropagation();let s=r??bI(e.clientX,e.clientY);if(!s)return;let c=i.frozenElements;c.length>1&&c.includes(s)?$I(c):($I([s]),o.setFrozenElement(s)),o.setPointer(n),o.freeze(),ln(s,n)}),{capture:!0}),xn.addWindowListener(`pointercancel`,EM(e=>{e.isPrimary&&yn()})),xn.addWindowListener(`click`,EM(e=>{if(!CB(e,`data-react-grab-ignore-events`)){if(_e){_e=!1,e.preventDefault(),e.stopImmediatePropagation();return}fe()||(N()||g())&&(e.preventDefault(),e.stopImmediatePropagation(),i.wasActivatedByToggle&&!b()&&!e.shiftKey&&(u()?o.setWasActivatedByToggle(!1):Kt()))}}),{capture:!0}),xn.addDocumentListener(`visibilitychange`,()=>{if(document.hidden){o.clearGrabbedBoxes();let e=i.activationTimestamp;d()&&!b()&&e!==null&&Date.now()-e>500&&Kt()}}),xn.addWindowListener(`blur`,()=>{yn(),u()&&(we(),o.releaseHold(),Te()),Se()}),xn.addWindowListener(`focus`,()=>{Re=Date.now()}),xn.addWindowListener(`focusin`,e=>{CB(e,DM)&&e.stopPropagation()},{capture:!0});let Un=()=>{if(!(i.isTouchMode&&!u()&&!d())&&!be()&&!f()&&!p()&&i.frozenElements.length===0){let e=bI(s().x,s().y);o.setDetectedElement(e)}},Wn=null,Gn=null,Kn=()=>{jY(),Un(),o.incrementViewportVersion(),o.updateContextMenuPosition()};xn.addWindowListener(`scroll`,Kn,{capture:!0});let qn=window.innerWidth,Jn=window.innerHeight;xn.addWindowListener(`resize`,()=>{let e=window.innerWidth,t=window.innerHeight;if(qn>0&&Jn>0){let n=e/qn,r=t/Jn,i=Math.abs(n-r)<cN,a=Math.abs(n-1)>cN;i&&a&&o.setPointer({x:s().x*n,y:s().y*r})}qn=e,Jn=t,Kn()});let Yn=window.visualViewport;if(Yn){let{signal:e}=xn;Yn.addEventListener(`resize`,Kn,{signal:e}),Yn.addEventListener(`scroll`,Kn,{signal:e})}let Xn=()=>{Gn===null&&(Gn=UF(()=>{Gn=null,o.incrementViewportVersion()}))};oR(()=>{if(r.store.theme.enabled&&(d()||_()||i.labelInstances.length>0||i.grabbedBoxes.length>0)){if(Wn!==null)return;Wn=window.setInterval(()=>{Xn()},100);return}Wn!==null&&(window.clearInterval(Wn),Wn=null),Gn!==null&&(WF(Gn),Gn=null)}),pR(()=>{Wn!==null&&window.clearInterval(Wn),Gn!==null&&WF(Gn)}),xn.addDocumentListener(`copy`,EM(e=>{b()||CB(e,`data-react-grab-ignore-events`)||N()&&e.preventDefault()}),{capture:!0}),pR(()=>{xn.abort(),Ae!==null&&window.clearTimeout(Ae),Pe&&window.clearTimeout(Pe),He(),he?.(),he=null,ge?.(),ge=null,rt.forEach(e=>window.clearTimeout(e)),rt.clear(),ot.cancelAllFades(),nt.stop(),C(`userSelect`,``),C(`touchAction`,``),Wt(null),Sn.restore(),CM(null)});let{root:Zn,host:Qn}=qJ(kJ);pR(fY(Qn).cleanup);let $n=Y(()=>r.store.theme.enabled),er=Y(()=>r.store.theme.selectionBox.enabled),tr=Y(()=>r.store.theme.elementLabel.enabled),nr=Y(()=>r.store.theme.dragBox.enabled),rr=Y(()=>y()||ne()&&!f()||de.isInteracting()),ir=Y(()=>Pt().length>0),ar=Y(()=>!$n()||!er()||rr()?!1:ir()?!0:bt()),or=Y(()=>{let e=yt();if(e)return TN(e)||void 0}),sr=Y(()=>!$n()||fe()||!tr()||rr()?!1:bt()),cr=new Map,lr=e=>{let t=e.elements?.filter(Jz)??[],n=e.element,r=null;t.length>0?r=t.map(VJ):n&&Jz(n)&&(r=[VJ(n)]);let i=e.bounds,a=e.boundsMultiple;r&&(i=r.length>1?PY(qY(r)):r[0],e.boundsMultiple!==void 0&&(a=e.boundsMultiple.length>1&&e.boundsMultiple.length===e.elements?.length?r:[i]));let o=cr.get(e.id),s=o?.boundsMultiple,c=s===a||s!==void 0&&a!==void 0&&s.length===a.length&&s.every((e,t)=>e.x===a[t].x&&e.y===a[t].y&&e.width===a[t].width&&e.height===a[t].height);if(o&&o.status===e.status&&o.errorMessage===e.errorMessage&&o.bounds.x===i.x&&o.bounds.y===i.y&&o.bounds.width===i.width&&o.bounds.height===i.height&&c)return o;let l=i.x+i.width/2,u=i.width/2,d;d=e.mouseXOffsetRatio!==void 0&&u>0?l+e.mouseXOffsetRatio*u:e.mouseXOffsetFromCenter===void 0?e.mouseX??l:l+e.mouseXOffsetFromCenter;let f={...e,bounds:i,boundsMultiple:a,mouseX:d};return cr.set(e.id,f),f},ur=Y(()=>{if(!$n()||!r.store.theme.grabbedBoxes.enabled)return[];c();let e=new Set(i.labelInstances.map(e=>e.id));for(let t of cr.keys())e.has(t)||cr.delete(t);return i.labelInstances.map(lr)}),dr=Y(()=>!$n()||!r.store.theme.grabbedBoxes.enabled?[]:(c(),i.grabbedBoxes.map(e=>!e.element||!document.body.contains(e.element)?e:{...e,bounds:VJ(e.element)}))),fr=Y(()=>$n()&&nr()&&N()&&Ot()),pr=Y(()=>_()?`processing`:`hover`),mr=Y(()=>{if(!$n())return!1;let e=tr(),t=b(),n=_(),r=N(),i=p(),a=!!P(),o=ne(),s=f();return!e||t||o&&!s?!1:n?!0:r&&!i&&a}),hr=Y(()=>{c();let e=i.contextMenuElement;return e?VJ(e):null}),gr=Y(()=>(c(),i.contextMenuPosition)),_r=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=i.frozenElements.length;return t>1?`${t} elements`:TN(e)||void 0}),[vr]=JJ(()=>i.frozenElements.length>1?null:i.contextMenuElement),[yr]=cR(()=>i.contextMenuElement,async e=>e?DU(e):null),br=async e=>{o.incrementSelectionInteractionLockDepth();try{return await e()}finally{o.decrementSelectionInteractionLockDepth()}},xr=(e,t,n,r,a)=>async c=>{await br(async()=>{let l=a?.fallbackBounds??null,u=a?.fallbackSelectionBounds??[],d=a?.position??i.contextMenuPosition??s(),f=St(),p=hr()??l,m=t.length>1,h=m?PY(qY(f)):p,g=i.wasActivatedByToggle,_;if(_=m?f:p?[p]:u,o.hideContextMenu(),h){let i=m?h.x+h.width/2:d.x,a=ot.createInstance(h,n||`element`,r,`copying`,{element:e,mouseX:i,elements:m?t:void 0,boundsMultiple:_}),o=!1,s;try{o=await c(),o||(s=`Failed to copy`)}catch(e){s=gY(e,`Action failed`)}ot.updateAfterCopy(a,o,s)}else try{await c()}catch{}g?Kt():o.unfreeze()})},Sr=()=>{setTimeout(()=>{o.hideContextMenu()},0)},Cr=e=>{let{element:t,filePath:n,lineNumber:a,tagName:s,componentName:c,position:l,performWithFeedbackOptions:u,shouldDeferHideContextMenu:f,onBeforeCopy:p,onBeforePrompt:m,customEnterPromptMode:h}=e,g=i.frozenElements.length>0?i.frozenElements:[t],_=f?Sr:o.hideContextMenu,v={element:t,elements:g,filePath:n,lineNumber:a,componentName:c,tagName:s,enterPromptMode:h??(()=>{ot.clearAll(),rn(),m?.(),Ee(t,l.x,l.y),o.setPointer({x:l.x,y:l.y}),o.setFrozenElement(t),De(),d()||Gt(),_()}),enterEditMode:()=>{en(t,l,{filePath:n,lineNumber:a,componentName:c,tagName:s})&&rn(),_()},copy:()=>{rn(),p?.(),dt({element:t,cursorX:l.x,selectedElements:g.length>1?g:void 0,shouldDeactivateAfter:i.wasActivatedByToggle}),_()},hooks:{transformHtmlContent:r.hooks.transformHtmlContent,onOpenFile:r.hooks.onOpenFile,transformOpenFileUrl:r.hooks.transformOpenFileUrl},performWithFeedback:xr(t,g,s,c,u),hideContextMenu:_,cleanup:()=>{i.wasActivatedByToggle?Kt():o.unfreeze()}},y=r.hooks.transformActionContext(v);return{...v,...y}},wr=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=yr(),n=i.contextMenuPosition??s();return Cr({element:e,filePath:t?.filePath,lineNumber:t?.lineNumber??void 0,tagName:_r(),componentName:vr(),position:n,shouldDeferHideContextMenu:!0,onBeforeCopy:()=>{ye.clear()},customEnterPromptMode:()=>{ot.clearAll(),rn(),o.clearInputText(),o.enterPromptMode(n,e),Sr()}})}),Tr=()=>{setTimeout(()=>{o.hideContextMenu(),Kt()},0)},Er=()=>{if(!me)return null;let e=me.getBoundingClientRect(),t=lZ(e);return t===`left`||t===`right`?{x:t===`left`?e.right:e.left,y:e.top+e.height/2,edge:t}:{x:e.left+e.width/2,y:t===`top`?e.bottom:e.top,edge:t}},Dr=()=>{let e=Er();if(e)return e;let t=de.state();return t?{x:t.position.x,y:t.position.y,edge:`bottom`}:null},Or=(e,t)=>{let n=null,r=()=>{let i=e();i&&t(i),n=UF(r)};return r(),()=>{n!==null&&(WF(n),n=null)}};oR(()=>{if(!_t())return;let e=Or(Er,ue);pR(()=>{e(),ue(null)})});let kr=()=>{he?.(),he=null,oe(null)},Ar=()=>{o.hideContextMenu(),kr(),de.dismiss()},jr=()=>{ae()===null?(o.hideContextMenu(),de.isOpen()&&de.closePreservingRenderer(),he?.(),he=Or(Er,oe)):kr()},Mr=e=>{Ce({defaultAction:e})},Nr=e=>{let t=i.labelInstances.find(t=>t.id===e);if(!t?.element||!Jz(t.element))return;let n=t.element,r=HJ(VJ(n)),a={x:t.mouseX??r.x,y:r.y},s=t.elements&&t.elements.length>0?t.elements.filter(e=>Jz(e)):[n];setTimeout(()=>{kr(),de.isOpen()&&de.closePreservingRenderer(),d()||(o.setWasActivatedByToggle(!0),Gt()),o.setPointer(a),o.setFrozenElements(s),s.length>1&&t.bounds&&o.setFrozenDragRect(NY(t.bounds)),o.freeze(),o.showContextMenu(a,n)},0)};oR(()=>{let e=r.store.theme.hue;e===0?Zn.style.filter=``:Zn.style.filter=`hue-rotate(${e}deg)`}),r.store.theme.enabled&&Promise.resolve().then(()=>(mJ(),KU)).then(({ReactGrabRenderer:e})=>{t||(n=QR(()=>X(e,{get selectionVisible(){return ar()},get selectionBounds(){return Tt()},get selectionBoundsMultiple(){return Ft()},get selectionShouldSnap(){return i.frozenElements.length>0||Pt().length>0},get selectionElementsCount(){return i.frozenElements.length},get frozenLabelEntries(){return Lt()},get pendingShiftPreviewEntry(){return Rt()??void 0},get selectionFilePath(){return i.selectionFilePath??void 0},get selectionLineNumber(){return i.selectionLineNumber??void 0},get selectionTagName(){return or()},get selectionComponentName(){return Ze()},get selectionLabelVisible(){return sr()},selectionLabelStatus:`idle`,get hierarchyState(){return Bn()},get hierarchyMenuPosition(){return le()},get labelInstances(){return ur()},get dragVisible(){return fr()},get dragBounds(){return Nt()},get grabbedBoxes(){return dr()},get mouseX(){return Kz(()=>i.frozenElements.length>1)()?void 0:Bt()??zt().x},get isFrozen(){return f()||d()||ne()},get inputValue(){return i.inputText},get isPromptMode(){return b()},onShowContextMenuInstance:Nr,get onLabelInstanceHoverChange(){return ot.handleHoverChange},get onInputChange(){return o.setInputText},onInputSubmit:()=>void Yt(),onToggleExpand:$t,get selectionLabelShakeCount(){return O()},onConfirmDismiss:Zt,get discardPrompt(){return Kz(()=>!!ye.isPendingDismiss())()?{isKeyboardSelection:!0,onConfirm:Zt,onCopy:On}:S()?{onConfirm:Zt,onCancel:Qt}:void 0},get toolbarVisible(){return r.store.theme.toolbar.enabled},get isActive(){return d()},onToggleActive:sn,onActivateAction:on,get activeActionId(){return $e()},get enabled(){return T()},get shakeCount(){return E()},onToolbarStateChange:e=>{A(e),e.enabled!==T()&&(ee(e.enabled),e.enabled||(qt(),Ar())),mZ.forEach(t=>t(e))},onSubscribeToToolbarStateChanges:e=>(mZ.add(e),()=>{mZ.delete(e)}),onToolbarSelectHoverChange:re,onToolbarRef:e=>{me=e},get contextMenuPosition(){return gr()},get contextMenuBounds(){return hr()},get contextMenuTagName(){return _r()},get contextMenuComponentName(){return vr()},get contextMenuHasFilePath(){return!!yr()?.filePath},get actions(){return r.store.actions},get actionContext(){return wr()},onContextMenuDismiss:Tr,onContextMenuHide:Sr,get toolbarMenuPosition(){return ae()},get toolbarMenuActions(){return r.store.actions.filter(e=>e.showInToolbarMenu===!0)},get defaultActionId(){return k()?.defaultAction??`copy`},onSetDefaultAction:Mr,onToggleToolbarMenu:jr,onToolbarMenuDismiss:kr,get editPanelState(){return de.state()},get editPanelPosition(){return se()},get onEditPanelDismiss(){return de.dismiss},get onEditPanelSubmit(){return de.submit},get onEditPanelPendingEditsChange(){return de.setPendingEdits},get onEditPanelInteractingChange(){return de.setInteracting}}),Zn))}).catch(e=>{console.warn(`[react-grab] Failed to load renderer:`,e)});let Pr={activate:()=>{o.setPendingCommentMode(!1),!d()&&T()&&Jt()},deactivate:()=>{(d()||_())&&Kt()},toggle:()=>{d()?Kt():T()&&Jt()},comment:dn,isActive:()=>d(),isEnabled:()=>T(),setEnabled:e=>{e!==T()&&(ee(e),Ce({enabled:e,collapsed:!e}),e||(qt(),Ar()))},getToolbarState:()=>k()??EV(),setToolbarState:e=>{let t=k()??EV(),n=e.collapsed??t?.collapsed??!1,r={edge:e.edge??t?.edge??`bottom`,ratio:e.ratio??t?.ratio??.5,collapsed:n,enabled:e.enabled??!n,defaultAction:e.defaultAction??t?.defaultAction??`copy`};DV(r),A(r),r.enabled!==T()&&(ee(r.enabled),r.enabled||(qt(),Ar())),mZ.forEach(e=>e(r))},onToolbarStateChange:e=>(mZ.add(e),()=>{mZ.delete(e)}),reset:()=>{qt(),Ar(),o.clearGrabbedBoxes(),o.clearLabelInstances(),o.setSelectionSource(null,null)},dispose:()=>{t=!0,pZ=!1,n?.(),he?.(),he=null,ge?.(),ge=null,mZ.clear(),e()},copyElement:async e=>{let t=Array.isArray(e)?e:[e];return t.length!==0&&await ct(t)},getSource:async e=>{let t=await DU(e);return t?{filePath:t.filePath,lineNumber:t.lineNumber,componentName:t.componentName}:null},getStackContext:e=>zU(e,{maxLines:r.store.options.maxContextLines}),getState:()=>({isActive:d(),isDragging:p(),isCopying:_(),isPromptMode:b(),isSelectionBoxVisible:!!ar(),isDragBoxVisible:!!fr(),targetElement:pt(),dragBounds:Nt()??null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:k()}),setOptions:e=>{r.setOptions(e)},registerPlugin:e=>{r.register(e,Pr)},unregisterPlugin:e=>{r.unregister(e)},getPlugins:()=>r.getPluginNames(),getDisplayName:OU};for(let e of fZ)r.register(e,Pr);return setTimeout(()=>{LF(!0)},fN),Pr})}})),_Z=r({DEFAULT_THEME:()=>zX,commentPlugin:()=>oZ,formatElementInfo:()=>HU,generateSnippet:()=>dZ,getGlobalApi:()=>yZ,getStack:()=>yU,init:()=>hZ,isInstrumentationActive:()=>QN,openPlugin:()=>cZ,registerPlugin:()=>CZ,setGlobalApi:()=>bZ,unregisterPlugin:()=>wZ}),vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ=t((()=>{gZ(),eR(),GU(),vZ=null,yZ=()=>typeof window>`u`?vZ:window.__REACT_GRAB__??vZ??null,bZ=e=>{vZ=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},xZ=[],SZ=e=>{for(;xZ.length>0;){let t=xZ.shift();t&&e.registerPlugin(t)}},CZ=e=>{let t=yZ();if(t){t.registerPlugin(e);return}xZ.push(e)},wZ=e=>{let t=yZ();if(t){t.unregisterPlugin(e);return}let n=xZ.findIndex(t=>t.name===e);n!==-1&&xZ.splice(n,1)},typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?vZ=window.__REACT_GRAB__:(vZ=hZ(),window.__REACT_GRAB__=vZ),SZ(vZ),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:vZ})))}));br(),Rr(),mD();var EZ=`linear-grab:context-copied`,DZ=`linear-grab:picker-activated`,OZ=0,kZ=null;function AZ(e){!e||e.grabbedAt===OZ||Cr().then(t=>{if(t.workflowMode!==`local`||e.grabbedAt===OZ)return;let n=()=>{OZ=e.grabbedAt,navigator.clipboard.writeText(uD(e,t)).then(()=>window.dispatchEvent(new CustomEvent(EZ))).catch(()=>{OZ=0})};e.source?.filePath?(kZ&&clearTimeout(kZ),kZ=null,n()):(kZ&&clearTimeout(kZ),kZ=setTimeout(n,900))})}function jZ(e,t=Date.now()){return{tagName:e.tagName||void 0,componentName:e.componentName||void 0,content:e.textContent?e.textContent.slice(0,500):``,source:e.filePath?{filePath:e.filePath,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:e.componentName??null}:null,stackContext:void 0,pageUrl:location.href,grabbedAt:t}}function MZ(e,t){let n=null,r=0;return{plugin:{name:`linear-grab`,hooks:{onElementSelect:i=>{r=Date.now(),n=Cr().then(e=>e.captureShots?RA(i):null);let a=t?.(),o={tagName:i.tagName?.toLowerCase()||void 0,componentName:a?.getDisplayName?.(i)||void 0,content:(i.textContent??``).slice(0,500),source:null,stackContext:void 0,pageUrl:location.href,grabbedAt:r};e([o]);try{a?.getSource?.(i)?.then(t=>{t?.filePath&&e([{...o,source:{filePath:t.filePath,lineNumber:t.lineNumber??null,columnNumber:t.columnNumber??null,componentName:t.componentName??o.componentName??null}}])})}catch{}}}},handleSelection(t){let i=r&&Date.now()-r<4e3?r:Date.now(),a=t.map((e,t)=>jZ(e,i+t));if(!a.length)return;e(a);let o=n;n=null,o&&o.then(t=>{t&&e([{...a[0],screenshotDataUrl:t},...a.slice(1)])})}}}var NZ=!1;async function PZ(){if(yr||NZ)return;NZ=!0;let e=await Promise.resolve().then(()=>(TZ(),_Z));try{e.init()}catch{NZ=!1;return}let t=MZ(e=>{Dr(e),AZ(e[0])},()=>e.getGlobalApi());e.registerPlugin(t.plugin),FA(),window.addEventListener(`react-grab:element-selected`,e=>{t.handleSelection(e.detail.elements??[])})}async function FZ(){if(yr){let e=await chrome.runtime.sendMessage({type:`grab/activate`});if(e&&e.ok===!1)throw Error(e.error??`Cannot activate the picker on this page.`);return}await PZ();let e=await Promise.resolve().then(()=>(TZ(),_Z));window.dispatchEvent(new CustomEvent(DZ)),e.getGlobalApi()?.activate()}function IZ(e){if(!yr)return()=>{};let t=t=>{t?.type===`grab/updated`&&e()};return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)}function LZ(){return new Promise(e=>{let t=document.createElement(`div`);t.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:crosshair;user-select:none;`;let n=document.createElement(`div`);n.style.cssText=`position:fixed;display:none;border:2px solid #5e6ad2;border-radius:4px;box-shadow:0 0 0 100000px rgba(0,0,0,0.35);pointer-events:none;`,t.appendChild(n),document.body.appendChild(t);let r=0,i=0,a=!1,o=e=>({x:Math.min(r,e.clientX),y:Math.min(i,e.clientY),w:Math.abs(e.clientX-r),h:Math.abs(e.clientY-i)}),s=()=>{t.remove(),window.removeEventListener(`keydown`,l,!0)},c=()=>{s(),e(null)},l=e=>{e.key===`Escape`&&(e.stopPropagation(),c())};window.addEventListener(`keydown`,l,!0),t.addEventListener(`pointerdown`,e=>{a=!0,r=e.clientX,i=e.clientY,t.setPointerCapture(e.pointerId)}),t.addEventListener(`pointermove`,e=>{if(!a)return;let t=o(e);n.style.display=`block`,n.style.left=`${t.x}px`,n.style.top=`${t.y}px`,n.style.width=`${t.w}px`,n.style.height=`${t.h}px`}),t.addEventListener(`pointerup`,t=>{let n=o(t);if(s(),n.w<8||n.h<8)return e(null);zA(n).then(t=>{if(!t)return e(null);e({tagName:`region`,componentName:void 0,content:`Region capture ${Math.round(n.w)}×${Math.round(n.h)}`,source:null,stackContext:void 0,screenshotDataUrl:t,pageUrl:location.href,grabbedAt:Date.now()})})})})}Rr(),br(),mD();var RZ=N(`<span class="text-text-faint ml-auto text-[10.5px] font-normal normal-case tabular-nums">`),zZ=N(`<details open class=group><summary class="text-text-dim hover:text-text flex cursor-pointer items-center gap-1.5 text-[11px] font-semibold tracking-wide uppercase select-none"><span aria-hidden class="text-text-faint inline-block w-3 text-center transition-transform group-open:rotate-90">›</span></summary><div class="flex flex-col gap-2 pt-2 pl-4">`),BZ=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center justify-between gap-2"><span class="text-text-faint min-w-0 text-[10.5px] leading-snug">All elements post into ONE issue. Shift+click / drag selects several at once.`),VZ=N(`<div class="flex flex-col gap-1.5"><div class="flex gap-1.5">`),HZ=N(`<span class=text-danger>●`),UZ=N(`<div class="flex flex-col gap-1.5"><span class="text-text-faint text-[10.5px] leading-snug">Captures your screen as a looping GIF (max 30s) the coding agent can watch. Pick this tab in the share dialog, then reproduce the issue.`),WZ=N(`<span class="inline-block min-w-[4ch] text-center">Stop`),GZ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full"></span><span class="text-text min-w-[5ch] text-[12px] tabular-nums"></span><span class="text-text-faint text-[10.5px]">max 0:30`),KZ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span class="text-text-dim text-[12px]">Encoding GIF…`),qZ=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4">`),JZ=N(`<span class="text-success text-[12px] leading-none">✓`),YZ=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M4 4l8 8M12 4l-8 8">`),XZ=N(`<span class="font-mono text-text-dim break-all text-[11px] leading-snug">`),ZZ=N(`<img alt="Element location screenshot"class="border-border bg-bg max-h-32 w-full rounded-md border object-contain">`),QZ=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex items-center justify-between gap-2"><span class="font-mono text-accent min-w-0 truncate text-[12px]"></span><div class="flex shrink-0 items-center gap-1">`),$Z=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),eQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M8 2.5v8M4.5 7.5 8 11l3.5-3.5M2.5 13.5h11">`),tQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M2.5 4h11M6.5 4V2.5h3V4M4 4l.7 9a1.5 1.5 0 0 0 1.5 1.4h3.6A1.5 1.5 0 0 0 11.3 13l.7-9M6.5 7v4.5M9.5 7v4.5">`),nQ=N(`<div class="bg-surface border-border flex flex-col gap-2 rounded-lg border p-2.5"><img alt="Screen recording preview"class="border-border bg-bg max-h-44 w-full rounded-md border object-contain"><span class="text-text-faint text-[10.5px] tabular-nums"> KB · <!>s · <!>×</span><label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Attach to issue on create</span></label><div class="flex items-center gap-1">`),rQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M6.5 9.5 9.5 6.5M7.5 4.5 9 3a2.5 2.5 0 0 1 3.5 3.5L11 8M8.5 11.5 7 13a2.5 2.5 0 0 1-3.5-3.5L5 8">`);function iQ(e){return(()=>{var t=zZ(),n=t.firstChild;n.firstChild;var r=n.nextSibling;return P(n,()=>e.title,null),P(n,j(M,{get when(){return e.badge},get children(){var t=RZ();return P(t,()=>e.badge),t}}),null),P(r,()=>e.children),t})()}function aQ(){let e=sr(),t=_r(()=>({queryKey:[`grab`],queryFn:Tr})),n=_r(()=>({queryKey:[`settings`],queryFn:Cr})),r=()=>t.data??[],i=()=>!!(n.data?.linearApiKey||n.data?.linearAccessToken),[a,o]=T(null),s=()=>{o(null),FZ().catch(e=>{o(e instanceof Error&&e.message?e.message:`Cannot activate the picker — open your dev app in the active tab first.`)})},c=async()=>{await kr(),e.invalidateQueries({queryKey:[`grab`]})},[l,u]=T(null),d=async e=>{try{await navigator.clipboard.writeText(uD(e,n.data??{})),u(e.grabbedAt),setTimeout(()=>u(null),1800)}catch{o(`Clipboard was blocked — click the button again.`)}},f=async t=>{await Or(t),e.invalidateQueries({queryKey:[`grab`]})},[p,m]=T(!1),h=async()=>{o(null),m(!0),window.dispatchEvent(new CustomEvent(DZ));try{let e=await LZ();e?await Dr([e]):o(`Region capture failed — try a smaller area (huge scrollers exceed canvas limits), or it was cancelled.`)}finally{m(!1)}},[g,_]=T(BD());ae(VD(_));let[v,y]=T(0);D(()=>{if(g().phase!==`recording`)return;let e=setInterval(()=>y(Date.now()-(BD().startedAt??Date.now())),250);ae(()=>clearInterval(e))});let b=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[x,S]=T(`idle`),[C,w]=T(null),ee=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},O=async()=>{w(null),S(`busy`);try{let e=ee().then(e=>new Blob([``],{type:`text/plain`}));try{await navigator.clipboard.write([new ClipboardItem({"text/plain":e})])}catch{let t=await e;await navigator.clipboard.writeText(await t.text())}S(`copied`),setTimeout(()=>S(`idle`),2e3)}catch{S(`idle`),await ne(),w(`Direct upload is blocked in this browser — copied the GIF instead. Paste it into a Linear comment and Linear uploads it.`)}},te=()=>{let e=g().result;if(!e)return;let t=document.createElement(`a`);t.href=e.url,t.download=`linear-grab-recording.gif`,t.click()},[k,A]=T(`idle`),ne=async()=>{let e=g().result;if(e){w(null),A(`busy`);try{try{await navigator.clipboard.write([new ClipboardItem({"image/gif":e.blob})])}catch{let t=await createImageBitmap(e.blob),n=document.createElement(`canvas`);n.width=t.width,n.height=t.height,n.getContext(`2d`).drawImage(t,0,0);let r=await new Promise((e,t)=>n.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`));await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),w(`Browser blocks GIF clipboard — copied the first frame as PNG. Use Download for the animation.`)}A(`copied`),setTimeout(()=>A(`idle`),2e3)}catch(e){A(`idle`),w(e instanceof Error?e.message:`Copy failed.`)}}};return(()=>{var e=qZ();return P(e,j(iQ,{title:`Captured elements`,get badge(){return $e(()=>!!r().length)()?`${r().length}/8`:void 0},get children(){return[j(M,{get when(){return r().length>0},get fallback(){return j(Aj,{title:`No elements captured`,children:`Click "Pick element" below, then use the react-grab overlay on your dev app. Every pick ADDS to this list — Shift+click or drag in the overlay selects several at once. Source info needs a dev build.`})},get children(){var e=BZ(),t=e.firstChild;return t.firstChild,P(e,j(We,{get each(){return r()},children:e=>(()=>{var t=QZ(),n=t.firstChild.firstChild,r=n.nextSibling;return P(n,(()=>{var t=$e(()=>!!e.componentName);return()=>t()?`<${e.componentName}>`:$e(()=>!!e.tagName)()?`<${e.tagName}>`:`Element`})()),P(r,j(vj,{class:`size-7 px-0`,variant:`ghost`,title:`Copy context for a local agent (Claude Code / Cursor) — includes skills & memory paths`,"aria-label":`Copy context`,onClick:()=>void d(e),get children(){return j(M,{get when(){return l()===e.grabbedAt},get fallback(){return $Z()},get children(){return JZ()}})}}),null),P(r,j(vj,{class:`size-7 px-0`,variant:`ghost`,title:`Remove this element`,"aria-label":`Remove element`,onClick:()=>void f(e.grabbedAt),get children(){return YZ()}}),null),P(t,j(M,{get when(){return e.source?.filePath},get children(){var t=XZ();return P(t,()=>e.source.filePath,null),P(t,(()=>{var t=$e(()=>e.source?.lineNumber!=null);return()=>t()?`:${e.source.lineNumber}`:``})(),null),t}}),null),P(t,j(M,{get when(){return e.screenshotDataUrl},get children(){var t=ZZ();return E(()=>it(t,`src`,e.screenshotDataUrl)),t}}),null),t})()}),t),P(t,j(vj,{class:`h-6 shrink-0 px-2 text-[11px]`,variant:`ghost`,onClick:c,children:`Clear all`}),null),e}}),(()=>{var e=VZ(),t=e.firstChild;return P(t,j(vj,{variant:`primary`,class:`min-w-0 flex-1`,onClick:s,children:`Pick element`}),null),P(t,j(M,{when:!yr,get children(){return j(vj,{variant:`ghost`,class:`min-w-0 flex-1`,get loading(){return p()},title:`Drag a rectangle over any part of the page — the shot attaches to the issue`,onClick:()=>void h(),children:`Capture region`})}}),null),P(e,j(M,{get when(){return a()},get children(){return j(jj,{get message(){return a()}})}}),null),e})()]}}),null),P(e,j(iQ,{title:`Recording`,get badge(){return $e(()=>!!g().result)()?`${(g().result.durationMs/1e3).toFixed(1)}s`:void 0},get children(){return[j(M,{get when(){return g().phase===`idle`||g().phase===`error`},get children(){var e=UZ(),t=e.firstChild;return P(e,j(vj,{variant:`ghost`,onClick:()=>void ZD(),get children(){return[HZ(),` Record interaction`]}}),t),P(e,j(M,{get when(){return $e(()=>g().phase===`error`)()&&g().error},get children(){return j(jj,{get message(){return g().error}})}}),null),e}}),j(M,{get when(){return g().phase===`recording`},get children(){var e=GZ(),t=e.firstChild.nextSibling;return t.nextSibling,P(t,()=>b(v())),P(e,j(vj,{variant:`primary`,class:`ml-auto`,onClick:()=>void QD(),get children(){return WZ()}}),null),e}}),j(M,{get when(){return g().phase===`processing`},get children(){var e=KZ(),t=e.firstChild;return P(e,j(yj,{}),t),e}}),j(M,{get when(){return $e(()=>g().phase===`ready`)()&&g().result},children:e=>(()=>{var t=nQ(),n=t.firstChild,r=n.nextSibling,a=r.firstChild,o=a.nextSibling,s=o.nextSibling.nextSibling;s.nextSibling;var c=r.nextSibling,l=c.firstChild,u=c.nextSibling;return P(r,()=>(e().blob.size/1024).toFixed(0),a),P(r,()=>(e().durationMs/1e3).toFixed(1),o),P(r,()=>e().width,s),P(r,()=>e().height,null),l.addEventListener(`change`,e=>eO(e.currentTarget.checked)),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return x()===`busy`},get disabled(){return!i()},get title(){return i()?`Copy markdown — uploads to Linear, copies embeddable link`:`Connect Linear in Settings first`},"aria-label":`Copy markdown`,onClick:()=>void O(),get children(){return j(M,{get when(){return x()===`copied`},get fallback(){return rQ()},get children(){return JZ()}})}}),null),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return k()===`busy`},title:`Copy GIF — paste into a Linear comment and Linear uploads it`,"aria-label":`Copy GIF`,onClick:()=>void ne(),get children(){return j(M,{get when(){return k()===`copied`},get fallback(){return $Z()},get children(){return JZ()}})}}),null),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Download GIF`,"aria-label":`Download GIF`,onClick:te,get children(){return eQ()}}),null),P(u,j(vj,{variant:`danger`,class:`ml-auto size-7 px-0`,title:`Discard recording`,"aria-label":`Discard recording`,onClick:$D,get children(){return tQ()}}),null),P(t,j(M,{get when(){return C()},get children(){return j(jj,{get message(){return C()}})}}),null),E(()=>it(n,`src`,e().url)),E(()=>l.checked=g().attachOnCreate),t})()})]}}),null),e})()}function oQ(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function sQ(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function cQ(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var lQ=(e,t)=>Math.abs(e-t)<1.01,uQ=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},dQ,fQ=()=>{if(dQ!==void 0)return dQ;if(typeof navigator>`u`)return dQ=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return dQ=!0;let e=navigator.maxTouchPoints;return dQ=navigator.platform===`MacIntel`&&e!==void 0&&e>0},pQ=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},mQ=e=>e,hQ=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},gQ=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(pQ(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(pQ(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},_Q={passive:!0},vQ=typeof window>`u`||`onscrollend`in window,yQ=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&vQ,o=0,s=a?null:uQ(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,_Q),a&&r.addEventListener(`scrollend`,u,_Q),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},bQ=(e,t)=>yQ(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),xQ=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},SQ=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},CQ=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mQ,rangeExtractor:hQ,onChange:()=>{},measureElement:xQ,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=sQ(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!fQ()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,_Q),e.addEventListener(`touchend`,n,_Q),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(fQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=sQ(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=sQ(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=oQ(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=sQ(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=EQ(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=sQ(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=sQ(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return cQ(t[wQ(0,t.length-1,r?e=>n[e*2]:e=>cQ(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(fQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&lQ(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},wQ=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function TQ(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function EQ(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=TQ(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=wQ(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}function DQ(e){let t=Ve(e),n=new CQ(t),[r,i]=tr(n.getVirtualItems()),[a,o]=T(n.getTotalSize()),s=new Proxy(n,{get(e,t){switch(t){case`getVirtualItems`:return()=>r;case`getTotalSize`:return()=>a();default:return Reflect.get(e,t)}}});return s.setOptions(t),ie(()=>{let e=s._didMount();s._willUpdate(),ae(e)}),ee(()=>{s.setOptions(Ve(t,e,{onChange:(t,n)=>{var r;t._willUpdate(),i(ar(t.getVirtualItems(),{key:`index`})),o(t.getTotalSize()),(r=e.onChange)==null||r.call(e,t,n)}})),s._willUpdate(),i(ar(n.getVirtualItems(),{key:`index`})),o(n.getTotalSize())}),s}function OQ(e){return DQ(Ve({observeElementRect:gQ,observeElementOffset:bQ,scrollToFn:SQ},e))}Rr();var kQ=3e4,AQ=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,jQ={running:[],review:[]},MQ=null,NQ=new Set;function PQ(e){return NQ.add(e),MQ||(MQ=setInterval(()=>void LQ(),kQ),LQ()),()=>{NQ.delete(e),!NQ.size&&MQ&&(clearInterval(MQ),MQ=null)}}function FQ(){LQ()}function IQ(e){return{id:e.id,identifier:e.identifier,title:e.title,stateName:e.state.name,stateColor:e.state.color,delegateName:e.delegate?.displayName??`Agent`,updatedAt:e.updatedAt,prUrl:e.attachments?.find(e=>AQ.test(e.url))?.url}}async function LQ(){try{let e=await Cr();if(!e.linearApiKey&&!e.linearAccessToken)return;let t=(await uO()).filter(e=>!!e.delegate&&e.state.type===`started`).map(IQ);jQ={running:t.filter(e=>!e.prUrl),review:t.filter(e=>!!e.prUrl)};for(let e of NQ)e(jQ)}catch{}}Rr();async function RQ(){let e=[];for(let t of await Tr()??[]){let n=t.source?.filePath?` — \`${t.source.filePath}${t.source.lineNumber==null?``:`:${t.source.lineNumber}`}\``:``;if(e.push(`- \`<${t.componentName??t.tagName??`element`}>\`${n}`),t.screenshotDataUrl)try{let n=await xO(WA(t.screenshotDataUrl),`capture-${t.grabbedAt}.png`);e.push(` `)}catch{}}let t=BD();if(t.result)try{let n=t.result.assetUrl??await xO(t.result.blob,`recording-${Date.now()}.gif`);tO(n),e.push(``)}catch{}return e.length?`Captured context:\n${e.join(`
|
|
215
|
+
`)},PX=e=>`style`in e&&e.style instanceof CSSStyleDeclaration,FX=e=>{let t=new Map,n=PX(e)?e:null;return{apply:(e,r)=>{if(n)for(let i of e)t.has(i)||t.set(i,{value:n.style.getPropertyValue(i),priority:n.style.getPropertyPriority(i)}),n.style.setProperty(i,r)},restore:()=>{if(!n){t.clear();return}for(let[e,{value:r,priority:i}]of t)r?n.style.setProperty(e,r,i):n.style.removeProperty(e);t.clear()},hasAppliedStyles:()=>t.size>0}},IX=(e,t)=>{for(let n of t){let t=e.edits.findIndex(e=>e.key===n.key);t>=0?e.edits[t]=n:e.edits.push(n)}},LX=(e,t)=>({element:e.element,preview:e.preview,filePath:e.filePath??``,lineNumber:e.lineNumber??0,edits:t,designTokens:e.designTokens}),RX=e=>{let[t,n]=J(null),[r,i]=J(!1),a=[],o=[],s=e=>{o=e},c=()=>{let r=t()!==null;n(null),i(!1),a=[],o=[],r&&e.onClose?.()},l=()=>{t()?.preview.restore();for(let e=a.length-1;e>=0;e--)a[e].preview.restore();c()},u=e=>{bU(e).then(t=>{t&&n(n=>!n||n.element!==e||n.componentName?n:{...n,componentName:t})})},d=(r,i,a={})=>{if(t()!==null)return!1;let o=pX(r);if(o.length===0)return!1;let s=a.filePath??e.store.selectionFilePath??void 0,c=a.lineNumber??e.store.selectionLineNumber??void 0;return n({element:r,position:i,selectionBounds:VJ(r),properties:o,preview:FX(r),filePath:s,lineNumber:c,componentName:a.componentName,tagName:a.tagName??TN(r),initialSearchQuery:a.initialSearchQuery,designTokens:DX(r)}),u(r),e.isActivated()||e.activateRenderer(),e.actions.setPointer(i),e.actions.setFrozenElement(r),e.actions.freeze(),e.onOpen?.(),!0},f=(r,i)=>{let s=t();if(!s||s.element===r)return!1;let c=pX(r);return c.length===0?!1:((o.length>0||s.preview.hasAppliedStyles())&&a.push(LX(s,o)),o=[],n({element:r,position:i,selectionBounds:VJ(r),properties:c,preview:FX(r),tagName:TN(r),hasSessionEdits:a.some(e=>e.edits.length>0),designTokens:DX(r)}),DU(r).then(e=>{if(e){for(let t of a)t.element===r&&!t.filePath&&(t.filePath=e.filePath,t.lineNumber=e.lineNumber??0);n(t=>!t||t.element!==r||t.filePath?t:{...t,filePath:e.filePath,lineNumber:e.lineNumber??void 0})}}).catch(()=>void 0),u(r),e.actions.setPointer(i),e.actions.setFrozenElement(r),!0)},p=(e,t)=>[...a,LX(e,t)],m=e=>{let t=new Map;for(let n of e){if(n.edits.length===0)continue;let e=t.get(n.element);if(e){!e.filePath&&n.filePath&&(e.filePath=n.filePath,e.lineNumber=n.lineNumber),IX(e,n.edits);continue}t.set(n.element,{filePath:n.filePath,lineNumber:n.lineNumber,edits:[...n.edits],designTokens:n.designTokens})}return Array.from(t.values())},h=e=>{let t=new Set;for(let n of e)n.edits.length>0&&t.add(n.element);for(let n=e.length-1;n>=0;n--){let r=e[n];r.edits.length===0&&!t.has(r.element)&&r.preview.restore()}};return{state:t,trigger:d,switchToElement:f,setPendingEdits:s,dismiss:()=>{t()!==null&&(l(),e.store.wasActivatedByToggle?e.deactivateRenderer():e.actions.unfreeze())},closePreservingRenderer:()=>{t()!==null&&(l(),e.actions.unfreeze())},submit:n=>{let r=t();if(!r)return;let i=r.element,a=p(r,n),o=NX(m(a));h(a),c(),e.store.wasActivatedByToggle||e.actions.unfreeze(),e.performCopyWithLabel({element:i,cursorX:r.position.x,extraPrompt:o||void 0,shouldDeactivateAfter:e.store.wasActivatedByToggle})},resetWithDiscard:l,isOpen:()=>t()!==null,isInteracting:r,setInteracting:i}},zX={enabled:!0,hue:0,selectionBox:{enabled:!0},dragBox:{enabled:!0},grabbedBoxes:{enabled:!0},elementLabel:{enabled:!0},toolbar:{enabled:!0}},BX=(e,t)=>({enabled:t.enabled??e.enabled,hue:t.hue??e.hue,selectionBox:{enabled:t.selectionBox?.enabled??e.selectionBox.enabled},dragBox:{enabled:t.dragBox?.enabled??e.dragBox.enabled},grabbedBoxes:{enabled:t.grabbedBoxes?.enabled??e.grabbedBoxes.enabled},elementLabel:{enabled:t.elementLabel?.enabled??e.elementLabel.enabled},toolbar:{enabled:t.toolbar?.enabled??e.toolbar.enabled}}),VX={activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,activationKey:void 0,getContent:void 0,maxContextLines:3,freezeReactUpdates:!0},HX=(e={})=>{let t=new Map,n={},[r,i]=DJ({theme:zX,options:{...VX,...e},actions:[]}),a=()=>{let r=zX,a={...VX,...e},o=[];for(let{config:e}of t.values())if(e.theme&&(r=BX(r,e.theme)),e.options&&(a={...a,...e.options}),e.actions)for(let t of e.actions)o.push(t);a={...a,...n},i(`theme`,r),i(`options`,a),i(`actions`,o)},o=(e,t)=>{n[e]=t,i(`options`,e,t)},s=[`activationMode`,`keyHoldDuration`,`allowActivationInsideInput`,`activationKey`,`getContent`,`maxContextLines`,`freezeReactUpdates`],c=e=>{for(let t of s)e[t]!==void 0&&o(t,e[t])},l=(e,n)=>{t.has(e.name)&&u(e.name);let r=e.setup?.(n,_)??{};e.theme&&(r.theme=r.theme?BX(BX(zX,e.theme),r.theme):e.theme),e.actions&&(r.actions=[...e.actions,...r.actions??[]]),e.hooks&&(r.hooks=r.hooks?{...e.hooks,...r.hooks}:e.hooks),e.options&&(r.options=r.options?{...e.options,...r.options}:e.options),t.set(e.name,{plugin:e,config:r}),a()},u=e=>{let n=t.get(e);n&&(n.config.cleanup&&n.config.cleanup(),t.delete(e),a())},d=()=>Array.from(t.keys()),f=(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&t(...n)}},p=(e,...n)=>{let r=!1;for(let{config:i}of t.values()){let t=i.hooks?.[e];t&&t(...n)===!0&&(r=!0)}return r},m=async(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&await t(...n)}},h=async(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=await t(i,...r))}return i},g=(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=t(i,...r))}return i},_={onActivate:()=>f(`onActivate`),onDeactivate:()=>f(`onDeactivate`),onElementHover:e=>f(`onElementHover`,e),onElementSelect:e=>{let n=!1,r;for(let{config:i}of t.values()){let t=i.hooks?.onElementSelect;if(t){let i=t(e);i===!0?n=!0:i instanceof Promise&&(n=!0,r=i)}}return{wasIntercepted:n,pendingResult:r}},onDragStart:(e,t)=>f(`onDragStart`,e,t),onDragEnd:(e,t)=>f(`onDragEnd`,e,t),onBeforeCopy:async e=>m(`onBeforeCopy`,e),transformCopyContent:async(e,t)=>h(`transformCopyContent`,e,t),onAfterCopy:(e,t)=>f(`onAfterCopy`,e,t),onCopySuccess:(e,t)=>f(`onCopySuccess`,e,t),onCopyError:e=>f(`onCopyError`,e),onStateChange:e=>f(`onStateChange`,e),onPromptModeChange:(e,t)=>f(`onPromptModeChange`,e,t),onSelectionBox:(e,t,n)=>f(`onSelectionBox`,e,t,n),onDragBox:(e,t)=>f(`onDragBox`,e,t),onGrabbedBox:(e,t)=>f(`onGrabbedBox`,e,t),onElementLabel:(e,t,n)=>f(`onElementLabel`,e,t,n),onContextMenu:(e,t)=>f(`onContextMenu`,e,t),onOpenFile:(e,t)=>p(`onOpenFile`,e,t),transformHtmlContent:async(e,t)=>h(`transformHtmlContent`,e,t),transformAgentContext:async(e,t)=>h(`transformAgentContext`,e,t),transformActionContext:e=>g(`transformActionContext`,e),transformOpenFileUrl:(e,t,n)=>g(`transformOpenFileUrl`,e,t,n)};return{register:l,unregister:u,getPluginNames:d,setOptions:c,store:r,hooks:_}},UX=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,WX=e=>{let t=e.bounds.x+e.bounds.width/2,n=e.bounds.width/2,r=e.mouseX===void 0?void 0:e.mouseX-t;return{id:UX(`label`),bounds:e.bounds,boundsMultiple:e.boundsMultiple,tagName:e.tagName,componentName:e.componentName,status:e.status,createdAt:Date.now(),element:e.element,elements:e.elements,mouseX:e.mouseX,mouseXOffsetFromCenter:r,mouseXOffsetRatio:r!==void 0&&n>0?r/n:void 0,hideArrow:e.hideArrow}},GX=(e,t)=>{let n=new Map,r=e=>{let t=n.get(e);t!==void 0&&(window.clearTimeout(t),n.delete(e))},i=()=>{for(let e of n.values())window.clearTimeout(e);n.clear()},a=()=>{i(),e.clearLabelInstances()},o=t=>{r(t);let i=window.setTimeout(()=>{e.updateLabelInstance(t,`fading`);let r=window.setTimeout(()=>{n.delete(t),e.removeLabelInstance(t)},125);n.set(t,r)},MM);n.set(t,i)};return{createInstance:(t,n,r,i,o)=>{a();let s=WX({bounds:t,tagName:n,componentName:r,status:i,element:o?.element,mouseX:o?.mouseX,elements:o?.elements,boundsMultiple:o?.boundsMultiple,hideArrow:o?.hideArrow});return e.addLabelInstance(s),s.id},createPerElementInstances:(t,n)=>{a();let r=[];for(let i of t){let t=WX({bounds:VJ(i.element),tagName:i.tagName,componentName:i.componentName,status:n,element:i.element,mouseX:i.mouseX});e.addLabelInstance(t),r.push(t.id)}return r},updateAfterCopy:(t,n,r)=>{n?e.updateLabelInstance(t,`copied`):e.updateLabelInstance(t,`error`,r||`Unknown error`),o(t)},cancelAllFades:i,clearAll:a,handleHoverChange:(e,n)=>{if(n){r(e);return}let i=t().find(t=>t.id===e);i&&(i.status===`copied`||i.status===`error`||i.status===`fading`)&&o(e)}}},KX=e=>{let t=window.innerWidth,n=window.innerHeight,r=Math.max(0,e.x),i=Math.min(t,e.x+e.width),a=Math.max(0,e.y),o=Math.min(n,e.y+e.height);return{x:(r+i)/2,y:(a+o)/2}},qX=(e,t,n)=>{let r=[],i=(t,r)=>{let i=KX(n(t)),a=yI(i.x,i.y).filter(e),o=a.indexOf(t);return o===-1?null:a[o+r]??null},a=e=>{let t=i(e,1);return t&&(r.push(e),r.length>50&&(r=r.slice(-50))),t},o=e=>{if(r.length>0){let e=r.pop();if(Jz(e))return e}return i(e,-1)},s=(e,n)=>{let i=e=>n?e.nextElementSibling:e.previousElementSibling,a=i(e);for(;a;){if(t(a))return r=[],a;a=i(a)}return null};return{findNext:(e,t)=>{switch(e){case`ArrowUp`:return a(t);case`ArrowDown`:return o(t);case`ArrowRight`:return s(t,!0);case`ArrowLeft`:return s(t,!1);default:return null}},clearHistory:()=>{r=[]}}},JX=e=>{let{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}=GY(e.activationKey);return{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}},YX=()=>{let e=new WeakSet,t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,`key`),n=!1;if(t?.get&&!t.get.__reactGrabPatched){n=!0;let r=t.get,i=function(){return e.has(this)?``:r.call(this)};i.__reactGrabPatched=!0,Object.defineProperty(KeyboardEvent.prototype,"key",{get:i,configurable:!0})}return{claimedEvents:e,originalKeyDescriptor:t,restore:()=>{n&&t&&Object.defineProperty(KeyboardEvent.prototype,"key",t)}}},XX=(e,t)=>({top:t<25,bottom:t>window.innerHeight-25,left:e<25,right:e>window.innerWidth-25}),ZX=(e,t,n)=>{let r=null,i=()=>{if(!t()){a();return}let o=e(),s=XX(o.x,o.y),c=0,l=0;if(s.top&&(l-=10),s.bottom&&(l+=10),s.left&&(c-=10),s.right&&(c+=10),c!==0||l!==0){let e=window.scrollX,t=window.scrollY;window.scrollBy(c,l);let r=window.scrollX-e,i=window.scrollY-t;(r!==0||i!==0)&&n?.({x:r,y:i})}r=s.top||s.bottom||s.left||s.right?UF(i):null},a=()=>{r!==null&&(WF(r),r=null)};return{start:i,stop:a,isActive:()=>r!==null}},QX=()=>{let e=globalThis;return!!(e.chrome?.runtime?.id||e.browser?.runtime?.id)},$X=e=>{try{let t=`0.1.48`,n=`data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 294 294"><path fill="#ff40e0" d="M145 47c25-20 50-27 67-17 16 9 23 30 20 60 0 2-1 5-1 7l-2 13h-1l-12-4c-8-3-17-5-25-6l-17-3c-10-1-20-1-29-1-10 0-20 0-29 1-6 8-11 16-16 24-5 9-9 17-13 26 4 9 8 18 13 26s10 16 16 24l11 14c5 7 11 13 18 19l10 8s-1 0 0 0l-11 9c-17 14-35 22-49 22-6 0-13-2-18-5-16-9-23-30-20-59 1-3 1-5 1-8-30-12-48-29-48-50 0-18 14-35 41-47 2-1 5-2 7-3 0-2 0-5-1-7-3-30 4-51 20-60 18-10 42-3 68 17M71 201c-1 2-1 4-1 5-2 24 3 41 13 47h1c11 7 30 1 51-15-10-9-18-18-26-29-13-1-26-4-38-8m9-38c-3 9-5 17-7 26 8 2 17 4 25 6-3-5-6-10-9-16-3-5-6-10-9-16m-19-53c-2 1-3 1-5 2-21 10-34 23-34 35 0 13 14 27 39 37 3-12 7-25 12-37-5-12-9-24-12-37m37-10c-8 1-17 3-25 6 2 8 4 16 7 25 3-5 6-11 9-16zm-3-61c-4-1-8 0-12 2-10 7-15 24-13 47 0 2 0 3 1 5 12-4 25-6 38-8 8-10 16-20 26-29-15-11-29-17-40-17m111 2c-4-2-8-3-12-2-11 0-25 5-40 17 10 9 19 19 26 29 13 2 26 4 39 8v-5c3-23-2-40-13-47m-61 23c-7 6-13 13-19 19h37c-6-6-12-13-18-19"/><mask id="a"><path fill="#fff" d="m235 85-133 27 28 133 133-27Z"/></mask><path fill="#ff40e0" d="m137 130 76 11c8 1 9 11 3 15l-28 16-4 32c-1 8-10 10-14 4l-41-66c-3-6 1-13 8-12" mask="url(#a)"/></svg>`)}`;console.log(`%cReact Grab${` v${t}`}%c\nhttps://react-grab.com`,`background: #330039; color: #ffffff; border: 1px solid #d75fcb; padding: 4px 4px 4px 24px; border-radius: 4px; background-image: url("${n}"); background-size: 16px 16px; background-repeat: no-repeat; background-position: 4px center; display: inline-block; margin-bottom: 4px;`,``),e&&navigator.onLine&&!QX()&&fetch(`https://www.react-grab.com/api/version?source=browser&v=${t}&t=${Date.now()}`,{referrerPolicy:`origin`,keepalive:!0,priority:`low`,cache:`no-store`}).then(e=>e.text()).then(e=>{e&&e!==t&&console.warn(`[React Grab] v${t} is outdated (latest: v${e}). Run \`npx grab@latest upgrade\` to upgrade.`)}).catch(()=>null)}catch{}},eZ=e=>typeof e==`object`&&!!e,tZ=e=>{if(!eZ(e))return null;let t={};return typeof e.enabled==`boolean`&&(t.enabled=e.enabled),(e.activationMode===`toggle`||e.activationMode===`hold`)&&(t.activationMode=e.activationMode),typeof e.keyHoldDuration==`number`&&Number.isFinite(e.keyHoldDuration)&&(t.keyHoldDuration=e.keyHoldDuration),typeof e.allowActivationInsideInput==`boolean`&&(t.allowActivationInsideInput=e.allowActivationInsideInput),typeof e.activationKey==`string`&&(t.activationKey=e.activationKey),typeof e.maxContextLines==`number`&&Number.isFinite(e.maxContextLines)&&(t.maxContextLines=e.maxContextLines),typeof e.freezeReactUpdates==`boolean`&&(t.freezeReactUpdates=e.freezeReactUpdates),typeof e.telemetry==`boolean`&&(t.telemetry=e.telemetry),Object.keys(t).length===0?null:t},nZ=()=>{if(typeof window>`u`)return null;try{let e=(document.currentScript instanceof HTMLScriptElement?document.currentScript:null)?.getAttribute(`data-options`);return e?tZ(JSON.parse(e)):null}catch{return null}},rZ=e=>e===`Enter`||e===`NumpadEnter`,iZ=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height,aZ=(e=>({name:e.name,setup:(t,n)=>({actions:[typeof e.contextMenuAction==`function`?e.contextMenuAction(t,n):e.contextMenuAction],cleanup:e.cleanup})}))({name:`copy`,contextMenuAction:{id:`copy`,label:`Copy`,shortcut:`C`,showInToolbarMenu:!0,onAction:e=>{e.copy?.()}}}),oZ={name:`comment`,setup:()=>({actions:[{id:`comment`,label:`Comment`,shortcut:`Enter`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterPromptMode?.()}}]})},sZ={name:`edit`,setup:()=>({actions:[{id:`edit`,label:`Style`,shortcut:`S`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterEditMode?.()}}]})},cZ={name:`open`,actions:[{id:`open`,label:`Open`,shortcut:`O`,enabled:e=>!!e.filePath,onAction:e=>{e.filePath&&(e.hooks.onOpenFile(e.filePath,e.lineNumber)||CI(e.filePath,e.lineNumber,e.hooks.transformOpenFileUrl),e.hideContextMenu(),e.cleanup())}}]},lZ=e=>{let t=e.left+e.width/2,n=e.top+e.height/2,r=n,i=window.innerHeight-n,a=t,o=window.innerWidth-t,s=Math.min(r,i,a,o);return s===r?`top`:s===a?`left`:s===o?`right`:`bottom`},uZ=()=>{let[e,t]=J(!1),[n,r]=J(null),i=MV(),a=()=>{let e=n();return Jz(e)?e:null},o=()=>{r(null),i.clear(),t(!1)};return{selectedElement:a,isPendingDismiss:e,select:(e,n)=>{r(e),t(!1),n?.shouldPromptBeforeMouseHandoff?i.arm():i.clear()},clear:o,consumeMouseHandoff:()=>i.consume()&&a()!==null,showDismissPrompt:()=>a()?e()?!1:(t(!0),!0):(o(),!1),takeSelection:e=>{let t=a()??(Jz(e)?e:null);return o(),t}}},dZ=async(e,t={})=>(await Promise.allSettled(e.map(e=>HU(e,t)))).map(e=>e.status===`fulfilled`?e.value:``),fZ=[aZ,sZ,oZ,cZ],pZ=!1,mZ=new Set,hZ=e=>{if(typeof window>`u`)return mY();let t={enabled:!0,activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,...nZ(),...e};if(t.enabled===!1||pZ)return mY();pZ=!0,CM(t.container??null),$X(t.telemetry!==!1);let{enabled:n,telemetry:r,container:i,...a}=t;return rR(e=>{let t=!1,n,r=HX(a),{store:i,actions:o,pointer:s,viewportVersion:c,current:l}=WJ({keyHoldDuration:r.store.options.keyHoldDuration??100}),u=Y(()=>l().state===`holding`),d=Y(()=>l().state===`active`),f=Y(()=>{let e=l();return e.state===`active`&&e.phase===`frozen`}),p=Y(()=>{let e=l();return e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)}),m=Y(()=>{if(!p())return!1;let e=Math.abs(s().x+window.scrollX-i.dragStart.x),t=Math.abs(s().y+window.scrollY-i.dragStart.y);return e>2||t>2}),h=Y(()=>{let e=l();return e.state===`active`&&e.phase===`dragging-reposition`}),g=Y(()=>{let e=l();return e.state===`active`&&e.phase===`justDragged`}),_=Y(()=>l().state===`copying`),v=Y(()=>i.selectionInteractionLockDepth>0),y=Y(()=>l().state===`justCopied`),b=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode}),x=Y(()=>i.pendingCommentMode||b()),S=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode&&!!e.isPendingDismiss}),C=(e,t)=>{document.body.style[e]=t};oR(dR(d,(e,t)=>{e&&!t?(SL(s().x,s().y),C(`touchAction`,`none`)):!e&&t&&(CL(),C(`touchAction`,``))}));let w=EV(),[T,E]=J(!w||!w.collapsed),[D,O]=J(0),[k,ee]=J(0),[te,A]=J(w),[ne,re]=J(!1),ie=OV(e=>e.shiftKey),[ae,oe]=J(null),[se,ce]=J(null),[le,ue]=J(null),de=RX({store:i,actions:o,isActivated:d,activateRenderer:()=>Gt(),deactivateRenderer:()=>Kt(),performCopyWithLabel:e=>dt(e),onOpen:()=>{kr(),ge?.(),ge=Or(Dr,ce)},onClose:()=>{ge?.(),ge=null,ce(null)}}),fe=Y(()=>i.contextMenuPosition!==null||de.isOpen()),pe=Y(()=>fe()||ae()!==null),me,he=null,ge=null,_e=!1,ve=new WeakMap,ye=uZ(),be=()=>!T()||b()||v()||fe()||ye.isPendingDismiss(),xe=()=>{ve=new WeakMap},Se=()=>{Le(!1),xe()},Ce=e=>{let t=te()??EV(),n={edge:t?.edge??`bottom`,ratio:t?.ratio??.5,collapsed:t?.collapsed??!1,enabled:t?.enabled??!0,defaultAction:t?.defaultAction??`copy`,...e};DV(n),A(n);for(let e of mZ)e(n)},we=()=>{Fe.timerId!==null&&(clearTimeout(Fe.timerId),Fe.timerId=null)},Te=()=>{Fe.copyWaiting=!1,Fe.holdTimerFired=!1,Fe.startTimestamp=null};oR(()=>{if(l().state!==`holding`){we();return}Fe.startTimestamp=Date.now(),Fe.timerId=window.setTimeout(()=>{if(Fe.timerId=null,Fe.copyWaiting){Fe.holdTimerFired=!0;return}o.activate()},i.keyHoldDuration),pR(we)}),oR(()=>{let e=l();if(e.state!==`active`||e.phase!==`justDragged`)return;let t=setTimeout(()=>{o.finishJustDragged()},MM);pR(()=>clearTimeout(t))}),oR(()=>{if(l().state!==`justCopied`)return;let e=setTimeout(()=>{o.finishJustCopied()},MM);pR(()=>clearTimeout(e))}),oR(dR(u,(e,t=!1)=>{!t||e||!d()||(r.store.options.activationMode!==`hold`&&o.setWasActivatedByToggle(!0),r.hooks.onActivate())}));let Ee=(e,t,n)=>{Oe(e,t,n),o.clearInputText()},De=()=>{let e=i.frozenElement||pt();e&&o.enterPromptMode({x:s().x,y:s().y},e)},Oe=(e,t,n)=>{o.setCopyStart({x:t,y:n},e)},ke={lastDetectionTimestamp:0,pendingDetectionScheduledAt:0,latestPointerX:0,latestPointerY:0},Ae=null,[je,Me]=J(null),Ne=(e,t)=>{Ae!==null&&clearTimeout(Ae),Me(null),Ae=window.setTimeout(()=>{Me({x:e,y:t}),Ae=null},32)},Pe=null,Fe={timerId:null,startTimestamp:null,copyWaiting:!1,holdTimerFired:!1},Ie=null,[j,Le]=J(!1),Re=0,ze=!1,Be=null,Ve=()=>{ze=!0,Be!==null&&window.clearTimeout(Be),Be=window.setTimeout(()=>{ze=!1,Be=null},MM)},He=()=>{Be!==null&&(window.clearTimeout(Be),Be=null),ze=!1},Ue=0,We=null,Ge=null,[M,Ke]=J(!1),[qe,Je]=J(null),[Ye,Xe]=J(null),[Ze,Qe]=JJ(Ye),$e=Y(()=>de.isOpen()?oN:x()?aN:M()?qe():d()?iN:null),et=e=>RY(e,rI),tt=qX(rI,et,VJ),nt=ZX(s,()=>p(),e=>{if(h()){if(o.shiftDragStart(e),Ie){Ie={x:Ie.x+e.x,y:Ie.y+e.y};return}let{pageX:t,pageY:n}=Et(s().x,s().y);Ie={x:t,y:n}}}),N=Y(()=>d()&&!_()),rt=new Map,it=(e,t)=>{let n=UX(`grabbed`),i={id:n,bounds:e,createdAt:Date.now(),element:t};o.addGrabbedBox(i),r.hooks.onGrabbedBox(e,t);let a=window.setTimeout(()=>{rt.delete(n),o.removeGrabbedBox(n)},MM+125);rt.set(n,a)},at=async e=>{let t=await Promise.all(e.map(async e=>{let t=await DU(e),n=t?.componentName??null,r=t?.filePath,i=t?.lineNumber??void 0,a=t?.columnNumber??void 0;n||=OU(e);let o=e instanceof HTMLElement?e.innerText?.slice(0,100):void 0;return{tagName:TN(e),id:e.id||void 0,className:e.getAttribute(`class`)||void 0,textContent:o,componentName:n??void 0,filePath:r,lineNumber:i,columnNumber:a}}));window.dispatchEvent(new CustomEvent(`react-grab:element-selected`,{detail:{elements:t}}))},ot=GX(o,()=>i.labelInstances),st=async(e,t,n)=>{He(),l().state!==`copying`&&o.startCopy();let r=!1,i;try{r=await e(),r||(i=`Failed to copy`)}catch(e){i=gY(e,`Action failed`)}if(t)for(let e of t)ot.updateAfterCopy(e,r,i);l().state===`copying`&&(r&&o.completeCopy(),n?Kt():r?(o.activate(),Ve()):o.unfreeze())},ct=(e,t,n)=>{let i=e[0],a=n??(i?OU(i):null),o=i?TN(i):null,s=a??o??void 0;return SY({getContent:r.store.options.getContent,componentName:s,maxContextLines:r.store.options.maxContextLines},r.hooks,e,t)},lt=async(e,t,n)=>{if(e.length===0)return!1;let i=[],a=[];for(let t of e){let{wasIntercepted:e,pendingResult:n}=r.hooks.onElementSelect(t);e||i.push(t),n&&a.push(n),r.store.theme.grabbedBoxes.enabled&&it(VJ(t),t)}await GF();let o=!0;if(i.length>0&&(o=await ct(i,t,n)),a.length>0&&!(await Promise.all(a)).every(Boolean))throw new RV;return at(e),o},ut=e=>{bU(e.primaryElement).then(async t=>{await st(()=>lt(e.targetElements,e.extraPrompt,t??void 0),e.labelInstanceIds.length>0?e.labelInstanceIds:null,e.shouldDeactivateAfter),e.onComplete?.()}).catch(t=>{let n=gY(t,`Action failed`);for(let t of e.labelInstanceIds)ot.updateAfterCopy(t,!1,n);l().state===`copying`&&o.unfreeze()})},dt=e=>{let{element:t,cursorX:n,selectedElements:r,extraPrompt:a,shouldDeactivateAfter:s,onComplete:c,dragRect:l}=e,u=r??[t],d=l??i.frozenDragRect,f=u.length>1,p=!f&&t===yt()?Tt():void 0,m=d&&f?MY(d):p??VJ(t),h=f?m.x+m.width/2:n,g=TN(t);He(),o.startCopy();let _=g?ot.createInstance(m,g,void 0,`copying`,{element:t,mouseX:h,elements:r}):null;ut({primaryElement:t,targetElements:u,labelInstanceIds:_?[_]:[],extraPrompt:a,shouldDeactivateAfter:s,onComplete:c})},ft=e=>{let{elements:t,labelEntries:n,shouldDeactivateAfter:r,onComplete:i}=e,a=t[0];He(),o.startCopy(),ut({primaryElement:a,targetElements:t,labelInstanceIds:ot.createPerElementInstances(n,`copying`),shouldDeactivateAfter:r,onComplete:i})},pt=Y(()=>{if(c(),!N()||m()||v()||ye.isPendingDismiss())return null;let e=i.detectedElement;return Jz(e)?e:null}),P=Y(()=>i.frozenElement||(f()?null:pt())),mt=Y(()=>!d()||b()||j()||_()||pe()||ye.isPendingDismiss()?null:ie()?f()?P():pt()??i.frozenElement:ye.selectedElement()),ht=Y(()=>{let e=mt();return e?FY(e,rI,et):[]}),gt=Y(()=>{let e=mt();return e?Math.max(0,ht().findIndex(t=>t.element===e)):0}),_t=Y(()=>mt()!==null);oR(()=>{let e=i.detectedElement;if(!e)return;let t=setInterval(()=>{Jz(e)||o.setDetectedElement(null)},100);pR(()=>clearInterval(t))}),oR(dR(P,e=>{if(We!==null&&(clearTimeout(We),We=null),!e){Xe(null);return}We=window.setTimeout(()=>{We=null,Xe(e)},100)})),pR(()=>{We!==null&&(clearTimeout(We),We=null)}),oR(()=>{let e=i.frozenElements;pR(tL(e))}),oR(dR(d,e=>{e&&r.store.options.freezeReactUpdates&&pR($L())}));let vt=()=>{if(i.isTouchMode&&p()){let e=i.detectedElement;return!e||qF(e)?void 0:e}let e=P();if(!(!e||qF(e)))return e},yt=Y(()=>vt()),bt=()=>yt()?i.isTouchMode&&p()?N():N()&&!m():!1,xt=RR(()=>i.frozenElements,e=>Y(()=>(c(),VJ(e)))),St=Y(()=>{let e=i.frozenElements;if(e.length===0)return[];let t=i.frozenDragRect;return t&&e.length>1?[MY(t)]:xt().map(e=>e())}),Ct=Y(()=>{if(!j()||i.pendingCommentMode||M())return null;let e=i.detectedElement;return!Jz(e)||qF(e)||i.frozenElements.includes(e)?null:e}),wt=Y(()=>{c();let e=Ct();if(e)return VJ(e)}),Tt=Y(()=>{c();let e=i.frozenElements;if(e.length>0){let t=St();if(e.length===1){let e=t[0];if(e)return e}let n=i.frozenDragRect;return n?t[0]??MY(n):PY(qY(t))}let t=yt();if(t)return VJ(t)}),Et=(e,t)=>({pageX:e+window.scrollX,pageY:t+window.scrollY}),Dt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t);return{x:Math.abs(n-i.dragStart.x),y:Math.abs(r-i.dragStart.y)}},Ot=Y(()=>{if(!p())return!1;let e=Dt(s().x,s().y);return e.x>2||e.y>2}),kt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t),a=Math.min(i.dragStart.x,n),o=Math.min(i.dragStart.y,r),s=Math.abs(n-i.dragStart.x),c=Math.abs(r-i.dragStart.y);return{x:a-window.scrollX,y:o-window.scrollY,width:s,height:c}},At=e=>e.code===`Space`||e.key===` `,jt=()=>{if(!p())return;o.startDragReposition();let{pageX:e,pageY:t}=Et(s().x,s().y);Ie={x:e,y:t}},Mt=()=>{o.stopDragReposition(),Ie=null},Nt=Y(()=>{if(c(),Ot())return PY(kt(s().x,s().y))}),Pt=Y(()=>{if(c(),!Ot())return[];let e=je();if(!e)return[];let t=kt(e.x,e.y),n=kY(t,rI);return(n.length>0?n:kY(t,rI,!1)).map(e=>VJ(e))}),Ft=Y(()=>{let e=Pt();if(e.length>0)return e;let t=wt();return t?[...St(),t]:St()}),It=RR(()=>i.frozenElements,e=>{let t=TN(e)||`element`,n=OU(e)??void 0;return Y(()=>{if(c(),!Jz(e))return null;let r=VJ(e),i=ve.get(e);return{tagName:t,componentName:n,bounds:r,mouseX:i===void 0?void 0:r.x+r.width*i}})}),Lt=Y(()=>{if(b()||i.frozenElements.length<2)return[];let e=[];for(let t of It()){let n=t();n!==null&&e.push(n)}return e}),Rt=Y(()=>{if(b())return null;let e=Ct();return e?(c(),{tagName:TN(e)||`element`,componentName:OU(e)??void 0,bounds:VJ(e),mouseX:s().x}):null}),zt=Y(()=>{if(_()||b()){c();let e=i.frozenElement||pt();return e?{x:HJ(VJ(e)).x+i.copyOffsetFromCenterX,y:i.copyStart.y}:{x:i.copyStart.x,y:i.copyStart.y}}return{x:s().x,y:s().y}}),Bt=Y(()=>{if(!j()||i.frozenElements.length!==1)return;c();let e=i.frozenElements[0];if(!Jz(e))return;let t=ve.get(e);if(t===void 0)return;let n=VJ(e);return n.x+n.width*t});oR(dR(()=>[pt(),i.lastGrabbedElement],([e,t])=>{t&&e&&t!==e&&o.setLastGrabbed(null),e&&r.hooks.onElementHover(e)})),oR(dR(()=>pt(),e=>{let t=++Ue,n=()=>{Ue===t&&o.setSelectionSource(null,null)};if(!e){n();return}DU(e).then(e=>{if(Ue===t){if(!e){n();return}o.setSelectionSource(e.filePath,e.lineNumber)}}).catch(()=>{Ue===t&&o.setSelectionSource(null,null)})}));let Vt=Y(()=>i.grabbedBoxes.map(e=>({id:e.id,bounds:e.bounds,createdAt:e.createdAt}))),Ht=Y(()=>i.labelInstances.map(e=>({id:e.id,status:e.status,tagName:e.tagName,componentName:e.componentName,createdAt:e.createdAt})));oR(dR(Y(()=>{let e=d(),t=p(),n=_(),a=b(),o=pt(),s=Nt(),c=r.store.theme.enabled,l=r.store.theme.selectionBox.enabled,u=r.store.theme.dragBox.enabled,f=Ot(),m=P(),h=y();return{isActive:e,isDragging:t,isCopying:n,isPromptMode:a,isSelectionBoxVisible:!!(c&&l&&e&&!n&&!h&&!t&&m!=null),isDragBoxVisible:!!(c&&u&&e&&!n&&f),targetElement:o,dragBounds:s?{x:s.x,y:s.y,width:s.width,height:s.height}:null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:te()}}),e=>{r.hooks.onStateChange(e)})),oR(dR(()=>{let e=b();return{inputMode:e,position:e?s():uR(s),target:e?pt():uR(pt)}},({inputMode:e,position:t,target:n})=>{r.hooks.onPromptModeChange(e,{x:t.x,y:t.y,targetElement:n})})),oR(dR(()=>[ar(),Tt(),pt()],([e,t,n])=>{r.hooks.onSelectionBox(!!e,t??null,n)})),oR(dR(()=>[fr(),Nt()],([e,t])=>{r.hooks.onDragBox(!!e,t??null)})),oR(dR(()=>{let e=mr();return[e,pr(),e?zt():uR(zt),e?pt():uR(pt),i.selectionFilePath,i.selectionLineNumber]},([e,t,n,i,a,o])=>{r.hooks.onElementLabel(e,t,{x:n.x,y:n.y,content:``,element:i??void 0,tagName:i&&TN(i)||void 0,filePath:a??void 0,lineNumber:o??void 0})}));let Ut=null,Wt=e=>{if(e){if(!Ut){Ut=document.createElement(`style`),Ut.setAttribute(`data-react-grab-cursor`,``);let e=DN();e&&(Ut.nonce=e),kN(Ut),document.head.appendChild(Ut)}Ut.textContent=`* { cursor: ${e} !important; }`}else Ut&&=(Ut.remove(),null)};oR(dR(()=>[d(),_(),b()],([e,t,n])=>{Wt(t?`progress`:e&&!n?`crosshair`:null)}));let Gt=()=>{let e=u();o.activate(),e||r.hooks.onActivate()},Kt=()=>{let e=p(),t=i.previouslyFocusedElement;Mt(),o.deactivate(),de.resetWithDiscard(),kr(),Se(),wn(),ye.clear(),Ke(!1),Je(null),e&&C(`userSelect`,``),Pe&&window.clearTimeout(Pe),nt.stop(),t instanceof HTMLElement&&t!==document.body&&t!==document.activeElement&&Jz(t)&&t.focus({preventScroll:!0}),r.hooks.onDeactivate()},qt=()=>{u()&&o.releaseHold(),d()&&Kt(),He()},Jt=()=>{o.setWasActivatedByToggle(!0),Gt()},Yt=()=>{let e=[...i.frozenElements],t=i.frozenElement||pt(),n=b()?i.inputText.trim():``;if(!t){Kt();return}let r=e.length>0?e:[t],a=r.map(e=>VJ(e))[0],{x:s,y:c}=HJ(a),l=s+i.copyOffsetFromCenterX;o.setPointer({x:s,y:c}),o.exitPromptMode(),o.clearInputText(),dt({element:t,cursorX:l,selectedElements:r,extraPrompt:n||void 0,shouldDeactivateAfter:!0})},Xt=()=>{if(b()){if(S()){o.clearInputText(),Kt();return}o.setPendingDismiss(!0),ee(e=>e+1)}},Zt=()=>{if(ye.isPendingDismiss()){Dn();return}o.clearInputText(),Kt()},Qt=()=>{o.setPendingDismiss(!1)},$t=()=>{if(de.isOpen()){de.dismiss();return}let e=i.frozenElement||pt();e&&en(e,{x:s().x,y:s().y})},en=(e,t,n={})=>de.trigger(e,t,n),tn=(e,t)=>{if(!de.isOpen()||i.contextMenuPosition!==null)return!1;let n=yI(e,t).find(rI);if(!n)return!1;let r=de.switchToElement(n,{x:e,y:t});return r&&$I([n]),r},nn=e=>({filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,componentName:Ze(),tagName:TN(e)||void 0}),rn=()=>{Ge=null,Ke(!1),o.setPendingCommentMode(!1),Je(null)},an=e=>{let t=i.frozenElement||pt();if(!t)return!1;let n={x:s().x,y:s().y},a=r.store.actions.find(t=>t.id===e);return a?e===`edit`?en(t,n,nn(t))?(o.clearInputText(),o.exitPromptMode(),rn(),!0):!0:(o.clearInputText(),o.exitPromptMode(),rn(),a.onAction(Nn(t,n)),!0):(o.clearInputText(),o.exitPromptMode(),rn(),Mr(iN),ln(t,n),!0)},on=e=>{if(d()){if($e()!==e&&b()&&an(e))return;if($e()!==e&&i.pendingCommentMode){o.setPendingCommentMode(!1),Ge=e,Je(e),Ke(!0);return}if($e()!==e&&M()){Ge=e,Je(e);return}Kt();return}T()&&(Ge=e,Je(e),Ke(!0),Jt())},sn=()=>{on(te()?.defaultAction??`copy`)},cn=(e,t,n)=>{rn(),o.clearInputText(),o.enterPromptMode({x:t,y:n},e)},ln=(e,t)=>{Se(),Ar(),o.showContextMenu(t,e),wn(),r.hooks.onContextMenu(e,t)},un=(e,t)=>{let n=Ge;if(Ge=null,Je(null),!n)return;if(n===`edit`){en(e,t,nn(e));return}let i=r.store.actions.find(e=>e.id===n);if(!i){Mr(iN),ln(e,t);return}i.onAction(Nn(e,t))},dn=()=>{if(T()){if(d()&&x()){Kt();return}o.setPendingCommentMode(!0),d()||Jt()}},fn=(e,t,n)=>{let r=n&&j()&&!p()&&!i.pendingCommentMode&&!M();if(be()||f()&&!r)return;if(o.setPointer({x:e,y:t}),ke.latestPointerX=e,ke.latestPointerY=t,r){let n=bI(e,t);n!==i.detectedElement&&o.setDetectedElement(n);return}let a=performance.now(),s=ke.pendingDetectionScheduledAt>0&&a-ke.pendingDetectionScheduledAt<200;if(a-ke.lastDetectionTimestamp>=32&&!s&&(ke.lastDetectionTimestamp=a,ke.pendingDetectionScheduledAt=a,setTimeout(()=>{if(be()){ke.pendingDetectionScheduledAt=0;return}let e=bI(ke.latestPointerX,ke.latestPointerY);e!==i.detectedElement&&o.setDetectedElement(e),ke.pendingDetectionScheduledAt=0})),p()){if(h()){let{pageX:n,pageY:r}=Et(e,t);Ie&&o.shiftDragStart({x:n-Ie.x,y:r-Ie.y}),Ie={x:n,y:r}}Ne(e,t);let n=XX(e,t),r=n.top||n.bottom||n.left||n.right;r&&!nt.isActive()?nt.start():!r&&nt.isActive()&&nt.stop()}},pn=(e,t,n)=>{if(!N()||v())return!1;!n&&j()&&Se();let i=ye.selectedElement()!==null;return o.startDrag({x:e,y:t},n||i),o.setPointer({x:e,y:t}),C(`userSelect`,`none`),Ne(e,t),r.hooks.onDragStart(e+window.scrollX,t+window.scrollY),!0},mn=(e,t)=>{let n=i.frozenElements.includes(e),r=i.frozenElements.length===0;if(!n){let n=AY(VJ(e),t);ve.set(e,n),r&&Qe(OU(e)??void 0)}o.toggleFrozenElement(e),xI();let a=i.frozenElements.includes(e);if(a||ve.delete(e),i.frozenElements.length===0){Se(),o.unfreeze();return}$I(i.frozenElements),Le(!0),o.setPointer(t),o.setLastGrabbed(a?e:i.frozenElements[i.frozenElements.length-1]),o.freeze(),wn()},hn=()=>{let e=i.frozenElements.filter(Jz),t=e.map(e=>{let t=TN(e)||`element`,n=OU(e)??void 0,r=ve.get(e),i=VJ(e);return{element:e,tagName:t,componentName:n,mouseX:r===void 0?i.x+i.width/2:i.x+i.width*r}});if(Se(),e.length===0){o.unfreeze();return}if(e.length===1){dt({element:e[0],cursorX:t[0].mouseX,selectedElements:e,shouldDeactivateAfter:i.wasActivatedByToggle});return}ft({elements:e,labelEntries:t,shouldDeactivateAfter:i.wasActivatedByToggle})},gn=(e,t,n)=>{let a=kY(e,rI),s=a.length>0?a:kY(e,rI,!1);if(s.length===0)return;let c=n&&!i.pendingCommentMode&&!M();if(c&&o.addFrozenElements(s),$I(c?i.frozenElements:s),r.hooks.onDragEnd(s,e),c){let e=s[s.length-1];Le(!0),xI(),o.setPointer(HJ(VJ(e))),o.setLastGrabbed(e),o.freeze(),wn();return}let l=s[0],u=HJ(VJ(l));o.setPointer(u),o.setFrozenElements(s);let d=NY(e);if(o.setFrozenDragRect(d),o.freeze(),o.setLastGrabbed(l),i.pendingCommentMode){cn(l,u.x,u.y);return}if(M()){Ke(!1),Ge?un(l,u):ln(l,u);return}let f=i.wasActivatedByToggle&&!t;dt({element:l,cursorX:u.x,selectedElements:s,shouldDeactivateAfter:f,dragRect:d})},_n=e=>{for(let t of i.frozenElements)if(Jz(t)&&iZ(e,VJ(t)))return t;return null},vn=(e,t,n,a)=>{let c=Jz(i.frozenElement)?i.frozenElement:null,l=ye.selectedElement(),u=()=>yI(e,t).find(rI)??null;if(a&&!i.pendingCommentMode&&!M()){let n=u();n!==null&&mn(n,{x:e,y:t});return}let d=u()??(Jz(i.detectedElement)?i.detectedElement:null),f=l??d??c;if(!f)return;let p,m,h=d===null&&c===f,g=l===f;if(h)p=s().x,m=s().y;else if(g){let e=HJ(VJ(f));p=e.x,m=e.y}else p=e,m=t;if(i.pendingCommentMode){cn(f,p,m),ye.clear();return}if(M()){Ke(!1);let{wasIntercepted:e}=r.hooks.onElementSelect(f);if(e)return;ye.clear(),$I([f]),o.setFrozenElement(f);let t={x:p,y:m};o.setPointer(t),o.freeze(),Ge?un(f,t):ln(f,t);return}let _=i.wasActivatedByToggle&&!n;o.setLastGrabbed(f),dt({element:f,cursorX:p,shouldDeactivateAfter:_}),ye.clear()},yn=()=>{p()&&(Mt(),o.cancelDrag(),nt.stop(),C(`userSelect`,``))},bn=(e,t,n,r)=>{if(!p())return;Ae!==null&&(clearTimeout(Ae),Ae=null),Me(null);let i=Dt(e,t),a=i.x>2||i.y>2,s=a?kt(e,t):null;a?o.endDrag():o.cancelDrag(),Mt(),nt.stop(),C(`userSelect`,``),s?gn(s,n,r):vn(e,t,n,r)},xn=hY(),Sn=YX(),Cn=e=>{let t;try{t=Sn.originalKeyDescriptor?.get?Sn.originalKeyDescriptor.get.call(e):e.key}catch{return!1}let n=t===`Enter`||rZ(e.code),r=d()||u();return n&&r&&!b()&&!ye.isPendingDismiss()&&!i.wasActivatedByToggle?CB(e,`data-react-grab-input`)?!1:(Sn.claimedEvents.add(e),e.preventDefault(),e.stopImmediatePropagation(),!0):!1};xn.addDocumentListener(`keydown`,EM(Cn),{capture:!0}),xn.addDocumentListener(`keyup`,EM(Cn),{capture:!0}),xn.addDocumentListener(`keypress`,EM(Cn),{capture:!0});let wn=()=>{tt.clearHistory(),ye.clear()},Tn=(e,t=!1)=>{o.setFrozenElement(e),o.freeze(),ye.select(e,{shouldPromptBeforeMouseHandoff:t});let n=HJ(VJ(e));o.setPointer(n),i.contextMenuPosition!==null&&o.showContextMenu(n,e)},En=()=>{ye.showDismissPrompt()&&ee(e=>e+1)},Dn=()=>{ye.clear(),o.unfreeze(),wn()},On=()=>{let e=ye.takeSelection(i.frozenElement);if(!e){Dn();return}let t=HJ(VJ(e));wn(),o.setLastGrabbed(e),dt({element:e,cursorX:t.x,shouldDeactivateAfter:i.wasActivatedByToggle})},kn=e=>$M.has(e.key)?e.key:e.key===`Tab`?e.shiftKey?`ArrowLeft`:`ArrowRight`:null,An=(e,t={})=>{if(!d()||b()||j()||ye.isPendingDismiss()&&!t.allowPendingKeyboardSelection)return!1;let n=kn(e);if(!n||pe())return!1;let r=P(),i=!r;if(!r){let e=wM()?.getBoundingClientRect();r=e?bI(e.left+e.width/2,e.top+e.height/2):bI(window.innerWidth/2,window.innerHeight/2)}if(!r)return!1;let a=n===`ArrowUp`||n===`ArrowDown`,o=tt.findNext(n,r);if(!o&&!a&&!i)return!1;let s=o??r;return e.preventDefault(),e.stopPropagation(),Tn(s,!0),!0},jn=e=>e.metaKey||e.ctrlKey||e.altKey||e.repeat||Zz(e)||!d()||_()||v()||pe()?null:i.frozenElement||pt(),Mn=e=>{let t=jn(e);if(!t)return null;let n=jV(r.store.actions,e);return n?{element:t,action:n}:null},Nn=(e,t)=>{let n=VJ(e);return Cr({element:e,filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,tagName:TN(e)||void 0,componentName:Ze(),position:t,shouldDeferHideContextMenu:!1,performWithFeedbackOptions:{fallbackBounds:n,fallbackSelectionBounds:[n],position:t}})},Pn=/^[a-zA-Z0-9-]$/,Fn=e=>{if(!e.key||e.key.length!==1||!Pn.test(e.key))return!1;let t=jn(e);return!t||!de.trigger(t,{x:s().x,y:s().y},{initialSearchQuery:e.key})?!1:(rn(),e.preventDefault(),e.stopImmediatePropagation(),!0)},In=e=>{let t=Mn(e);if(!t)return!1;let{element:n,action:r}=t;if(b())return an(r.id)?(e.preventDefault(),e.stopImmediatePropagation(),!0):!1;let i={x:s().x,y:s().y};return r.onAction(Nn(n,i)),e.preventDefault(),e.stopImmediatePropagation(),!0},Ln=e=>{if(e.key?.toLowerCase()!==`o`||!d()||!(e.metaKey||e.ctrlKey))return!1;let t=i.selectionFilePath,n=i.selectionLineNumber;return t?(e.preventDefault(),e.stopPropagation(),r.hooks.onOpenFile(t,n??void 0)||CI(t,n??void 0,r.hooks.transformOpenFileUrl),!0):!1},Rn=e=>{if(!d()||_()||i.contextMenuPosition!==null||de.isOpen())return!1;let t=e.key===`F10`&&e.shiftKey,n=e.key===`ContextMenu`;if(!t&&!n)return!1;let r=i.frozenElements,a=r.length>1,s=(a?r[0]:null)||i.frozenElement||pt();if(!s)return!1;e.preventDefault(),e.stopPropagation();let c=HJ(VJ(s));return a?$I(r):($I([s]),o.setFrozenElement(s)),o.setPointer(c),o.freeze(),ln(s,c),!0},zn=Y(()=>ht().map(e=>({tagName:TN(e.element)||`element`,componentName:OU(e.element)??void 0,depth:e.depth,isLast:e.isLast}))),Bn=Y(()=>({items:zn(),activeIndex:gt()})),Vn=e=>{if(!(!r.store.options.allowActivationInsideInput&&Zz(e))&&!(!KY(e,r.store.options)&&((e.metaKey||e.ctrlKey)&&!QM.includes(e.key)&&!rZ(e.code)&&(d()&&!i.wasActivatedByToggle?Kt():u()&&(we(),Te(),o.releaseHold())),!rZ(e.code)||!u()))){if((d()||u())&&!b()&&(e.preventDefault(),rZ(e.code)&&e.stopImmediatePropagation()),d()){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e.repeat)return;Pe!==null&&window.clearTimeout(Pe),Pe=window.setTimeout(()=>{Kt()},200);return}if(u()&&e.repeat){if(Fe.copyWaiting){let e=Fe.holdTimerFired;Te(),e&&o.activate()}return}if(!(_()||y())&&!u()){let t=r.store.options.keyHoldDuration??100;Zz(e)?Qz(e)?t+=600:t+=400:$z()&&(t+=600),Te(),o.startHold(t)}}},Hn=e=>{if(!ye.isPendingDismiss())return!1;if(rZ(e.code))return!0;let t=$M.has(e.key),n=Mn(e)!==null;return!t&&!n?!1:t?An(e,{allowPendingKeyboardSelection:!0}):In(e)?(wn(),!0):!1};xn.addWindowListener(`keydown`,EM(e=>{if(kn(e)&&Zz(e)||Hn(e))return;if(Cn(e),!T()){KY(e,r.store.options)&&!e.repeat&&O(e=>e+1);return}let t=rZ(e.code)&&u()&&!b(),n=CB(e,nN);if(b()&&KY(e,r.store.options)&&!e.repeat&&!n){e.preventDefault(),e.stopPropagation(),Xt();return}if(e.key===`Escape`&&pe()){ae()!==null&&kr();return}let a=CB(e,`data-react-grab-ignore-events`)&&!t;if(b()||a)return b()&&!n&&In(e)||(e.key===`Escape`&&(b()?Xt():i.wasActivatedByToggle&&Kt()),a&&$M.has(e.key)&&An(e)),void 0;if(p()&&At(e)){e.repeat||jt(),e.preventDefault(),e.stopPropagation();return}if(e.key===`Escape`&&(u()||i.wasActivatedByToggle)){Kt();return}d()&&!QM.includes(e.key)&&e.preventDefault();let o=Date.now()-Re<200;An(e)||Ln(e)||Rn(e)||In(e)||Fn(e)||o||Vn(e)}),{capture:!0}),xn.addWindowListener(`keyup`,EM(e=>{if(Cn(e))return;if(At(e)&&h()&&(Mt(),e.preventDefault(),e.stopPropagation()),e.key===`Shift`&&j()){p()&&yn(),hn();return}if(CB(e,`data-react-grab-ignore-events`))return;let t=JX(r.store.options),n=t.metaKey||t.ctrlKey?SB()?!e.metaKey:!e.ctrlKey:t.shiftKey&&!e.shiftKey||t.altKey&&!e.altKey,a=r.store.options.activationKey?typeof r.store.options.activationKey==`function`?r.store.options.activationKey(e):WY(r.store.options.activationKey)(e):BY(e.key,e.code);if(y()||ze){(a||n)&&(He(),Kt());return}if(!u()&&!d()||b())return;let s=!!r.store.options.activationKey,c=r.store.options.activationMode===`hold`,l=p();if(d()){let e=fe();if(n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e)return;Kt()}else if(c&&a){if(Pe!==null&&(window.clearTimeout(Pe),Pe=null),e||l)return;Kt()}else!s&&a&&Pe!==null&&(window.clearTimeout(Pe),Pe=null);return}if(a||n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`)return;if(u()||Fe.holdTimerFired&&n){we();let t=(Fe.startTimestamp?Date.now()-Fe.startTimestamp:0)>=200,n=Fe.holdTimerFired&&t&&(r.store.options.allowActivationInsideInput||!Zz(e));Te(),n?o.activate():o.releaseHold()}else Kt()}}),{capture:!0}),xn.addDocumentListener(`copy`,()=>{u()&&(Fe.copyWaiting=!0)}),xn.addWindowListener(`keypress`,EM(Cn),{capture:!0}),xn.addWindowListener(`pointermove`,EM(e=>{if(!e.isPrimary)return;let t=e.pointerType===`touch`;if(o.setTouchMode(t),!CB(e,`data-react-grab-ignore-events`)&&!be()&&!(t&&!u()&&!d())){if((t?u():d())&&!b()&&f()&&!e.shiftKey&&!j()){if(ye.consumeMouseHandoff()){En();return}o.unfreeze(),wn()}fn(e.clientX,e.clientY,e.shiftKey)}}),{passive:!0}),xn.addWindowListener(`pointerdown`,EM(e=>{if(e.button===0&&e.isPrimary&&(o.setTouchMode(e.pointerType===`touch`),_e=!1,!CB(e,`data-react-grab-ignore-events`))){if(fe()){tn(e.clientX,e.clientY)&&(_e=!0,e.preventDefault(),e.stopImmediatePropagation());return}if(b()){let t=Tt();t&&e.clientX>=t.x&&e.clientX<=t.x+t.width&&e.clientY>=t.y&&e.clientY<=t.y+t.height?Yt():Xt();return}if(ye.isPendingDismiss()){e.preventDefault(),e.stopImmediatePropagation();return}if(v()){e.preventDefault(),e.stopImmediatePropagation();return}pn(e.clientX,e.clientY,e.shiftKey)&&(e.pointerId!==void 0&&document.documentElement.setPointerCapture(e.pointerId),e.preventDefault(),e.stopImmediatePropagation())}}),{capture:!0}),xn.addWindowListener(`pointerup`,EM(e=>{if(e.button!==0||!e.isPrimary||CB(e,`data-react-grab-ignore-events`)||fe())return;let t=N()||v()||p(),n=e.metaKey||e.ctrlKey;bn(e.clientX,e.clientY,n,e.shiftKey),t&&(e.preventDefault(),e.stopImmediatePropagation())}),{capture:!0}),xn.addWindowListener(`contextmenu`,EM(e=>{if(!N()||_()||b()||de.isOpen())return;let t=CB(e,`data-react-grab-ignore-events`),n={x:e.clientX,y:e.clientY},r=t&&i.frozenElements.length>1?_n(n):null,a=ye.isPendingDismiss();if(t&&!r&&!a&&!_t())return;if(fe()){e.preventDefault();return}e.preventDefault(),e.stopPropagation();let s=r??bI(e.clientX,e.clientY);if(!s)return;let c=i.frozenElements;c.length>1&&c.includes(s)?$I(c):($I([s]),o.setFrozenElement(s)),o.setPointer(n),o.freeze(),ln(s,n)}),{capture:!0}),xn.addWindowListener(`pointercancel`,EM(e=>{e.isPrimary&&yn()})),xn.addWindowListener(`click`,EM(e=>{if(!CB(e,`data-react-grab-ignore-events`)){if(_e){_e=!1,e.preventDefault(),e.stopImmediatePropagation();return}fe()||(N()||g())&&(e.preventDefault(),e.stopImmediatePropagation(),i.wasActivatedByToggle&&!b()&&!e.shiftKey&&(u()?o.setWasActivatedByToggle(!1):Kt()))}}),{capture:!0}),xn.addDocumentListener(`visibilitychange`,()=>{if(document.hidden){o.clearGrabbedBoxes();let e=i.activationTimestamp;d()&&!b()&&e!==null&&Date.now()-e>500&&Kt()}}),xn.addWindowListener(`blur`,()=>{yn(),u()&&(we(),o.releaseHold(),Te()),Se()}),xn.addWindowListener(`focus`,()=>{Re=Date.now()}),xn.addWindowListener(`focusin`,e=>{CB(e,DM)&&e.stopPropagation()},{capture:!0});let Un=()=>{if(!(i.isTouchMode&&!u()&&!d())&&!be()&&!f()&&!p()&&i.frozenElements.length===0){let e=bI(s().x,s().y);o.setDetectedElement(e)}},Wn=null,Gn=null,Kn=()=>{jY(),Un(),o.incrementViewportVersion(),o.updateContextMenuPosition()};xn.addWindowListener(`scroll`,Kn,{capture:!0});let qn=window.innerWidth,Jn=window.innerHeight;xn.addWindowListener(`resize`,()=>{let e=window.innerWidth,t=window.innerHeight;if(qn>0&&Jn>0){let n=e/qn,r=t/Jn,i=Math.abs(n-r)<cN,a=Math.abs(n-1)>cN;i&&a&&o.setPointer({x:s().x*n,y:s().y*r})}qn=e,Jn=t,Kn()});let Yn=window.visualViewport;if(Yn){let{signal:e}=xn;Yn.addEventListener(`resize`,Kn,{signal:e}),Yn.addEventListener(`scroll`,Kn,{signal:e})}let Xn=()=>{Gn===null&&(Gn=UF(()=>{Gn=null,o.incrementViewportVersion()}))};oR(()=>{if(r.store.theme.enabled&&(d()||_()||i.labelInstances.length>0||i.grabbedBoxes.length>0)){if(Wn!==null)return;Wn=window.setInterval(()=>{Xn()},100);return}Wn!==null&&(window.clearInterval(Wn),Wn=null),Gn!==null&&(WF(Gn),Gn=null)}),pR(()=>{Wn!==null&&window.clearInterval(Wn),Gn!==null&&WF(Gn)}),xn.addDocumentListener(`copy`,EM(e=>{b()||CB(e,`data-react-grab-ignore-events`)||N()&&e.preventDefault()}),{capture:!0}),pR(()=>{xn.abort(),Ae!==null&&window.clearTimeout(Ae),Pe&&window.clearTimeout(Pe),He(),he?.(),he=null,ge?.(),ge=null,rt.forEach(e=>window.clearTimeout(e)),rt.clear(),ot.cancelAllFades(),nt.stop(),C(`userSelect`,``),C(`touchAction`,``),Wt(null),Sn.restore(),CM(null)});let{root:Zn,host:Qn}=qJ(kJ);pR(fY(Qn).cleanup);let $n=Y(()=>r.store.theme.enabled),er=Y(()=>r.store.theme.selectionBox.enabled),tr=Y(()=>r.store.theme.elementLabel.enabled),nr=Y(()=>r.store.theme.dragBox.enabled),rr=Y(()=>y()||ne()&&!f()||de.isInteracting()),ir=Y(()=>Pt().length>0),ar=Y(()=>!$n()||!er()||rr()?!1:ir()?!0:bt()),or=Y(()=>{let e=yt();if(e)return TN(e)||void 0}),sr=Y(()=>!$n()||fe()||!tr()||rr()?!1:bt()),cr=new Map,lr=e=>{let t=e.elements?.filter(Jz)??[],n=e.element,r=null;t.length>0?r=t.map(VJ):n&&Jz(n)&&(r=[VJ(n)]);let i=e.bounds,a=e.boundsMultiple;r&&(i=r.length>1?PY(qY(r)):r[0],e.boundsMultiple!==void 0&&(a=e.boundsMultiple.length>1&&e.boundsMultiple.length===e.elements?.length?r:[i]));let o=cr.get(e.id),s=o?.boundsMultiple,c=s===a||s!==void 0&&a!==void 0&&s.length===a.length&&s.every((e,t)=>e.x===a[t].x&&e.y===a[t].y&&e.width===a[t].width&&e.height===a[t].height);if(o&&o.status===e.status&&o.errorMessage===e.errorMessage&&o.bounds.x===i.x&&o.bounds.y===i.y&&o.bounds.width===i.width&&o.bounds.height===i.height&&c)return o;let l=i.x+i.width/2,u=i.width/2,d;d=e.mouseXOffsetRatio!==void 0&&u>0?l+e.mouseXOffsetRatio*u:e.mouseXOffsetFromCenter===void 0?e.mouseX??l:l+e.mouseXOffsetFromCenter;let f={...e,bounds:i,boundsMultiple:a,mouseX:d};return cr.set(e.id,f),f},ur=Y(()=>{if(!$n()||!r.store.theme.grabbedBoxes.enabled)return[];c();let e=new Set(i.labelInstances.map(e=>e.id));for(let t of cr.keys())e.has(t)||cr.delete(t);return i.labelInstances.map(lr)}),dr=Y(()=>!$n()||!r.store.theme.grabbedBoxes.enabled?[]:(c(),i.grabbedBoxes.map(e=>!e.element||!document.body.contains(e.element)?e:{...e,bounds:VJ(e.element)}))),fr=Y(()=>$n()&&nr()&&N()&&Ot()),pr=Y(()=>_()?`processing`:`hover`),mr=Y(()=>{if(!$n())return!1;let e=tr(),t=b(),n=_(),r=N(),i=p(),a=!!P(),o=ne(),s=f();return!e||t||o&&!s?!1:n?!0:r&&!i&&a}),hr=Y(()=>{c();let e=i.contextMenuElement;return e?VJ(e):null}),gr=Y(()=>(c(),i.contextMenuPosition)),_r=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=i.frozenElements.length;return t>1?`${t} elements`:TN(e)||void 0}),[vr]=JJ(()=>i.frozenElements.length>1?null:i.contextMenuElement),[yr]=cR(()=>i.contextMenuElement,async e=>e?DU(e):null),br=async e=>{o.incrementSelectionInteractionLockDepth();try{return await e()}finally{o.decrementSelectionInteractionLockDepth()}},xr=(e,t,n,r,a)=>async c=>{await br(async()=>{let l=a?.fallbackBounds??null,u=a?.fallbackSelectionBounds??[],d=a?.position??i.contextMenuPosition??s(),f=St(),p=hr()??l,m=t.length>1,h=m?PY(qY(f)):p,g=i.wasActivatedByToggle,_;if(_=m?f:p?[p]:u,o.hideContextMenu(),h){let i=m?h.x+h.width/2:d.x,a=ot.createInstance(h,n||`element`,r,`copying`,{element:e,mouseX:i,elements:m?t:void 0,boundsMultiple:_}),o=!1,s;try{o=await c(),o||(s=`Failed to copy`)}catch(e){s=gY(e,`Action failed`)}ot.updateAfterCopy(a,o,s)}else try{await c()}catch{}g?Kt():o.unfreeze()})},Sr=()=>{setTimeout(()=>{o.hideContextMenu()},0)},Cr=e=>{let{element:t,filePath:n,lineNumber:a,tagName:s,componentName:c,position:l,performWithFeedbackOptions:u,shouldDeferHideContextMenu:f,onBeforeCopy:p,onBeforePrompt:m,customEnterPromptMode:h}=e,g=i.frozenElements.length>0?i.frozenElements:[t],_=f?Sr:o.hideContextMenu,v={element:t,elements:g,filePath:n,lineNumber:a,componentName:c,tagName:s,enterPromptMode:h??(()=>{ot.clearAll(),rn(),m?.(),Ee(t,l.x,l.y),o.setPointer({x:l.x,y:l.y}),o.setFrozenElement(t),De(),d()||Gt(),_()}),enterEditMode:()=>{en(t,l,{filePath:n,lineNumber:a,componentName:c,tagName:s})&&rn(),_()},copy:()=>{rn(),p?.(),dt({element:t,cursorX:l.x,selectedElements:g.length>1?g:void 0,shouldDeactivateAfter:i.wasActivatedByToggle}),_()},hooks:{transformHtmlContent:r.hooks.transformHtmlContent,onOpenFile:r.hooks.onOpenFile,transformOpenFileUrl:r.hooks.transformOpenFileUrl},performWithFeedback:xr(t,g,s,c,u),hideContextMenu:_,cleanup:()=>{i.wasActivatedByToggle?Kt():o.unfreeze()}},y=r.hooks.transformActionContext(v);return{...v,...y}},wr=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=yr(),n=i.contextMenuPosition??s();return Cr({element:e,filePath:t?.filePath,lineNumber:t?.lineNumber??void 0,tagName:_r(),componentName:vr(),position:n,shouldDeferHideContextMenu:!0,onBeforeCopy:()=>{ye.clear()},customEnterPromptMode:()=>{ot.clearAll(),rn(),o.clearInputText(),o.enterPromptMode(n,e),Sr()}})}),Tr=()=>{setTimeout(()=>{o.hideContextMenu(),Kt()},0)},Er=()=>{if(!me)return null;let e=me.getBoundingClientRect(),t=lZ(e);return t===`left`||t===`right`?{x:t===`left`?e.right:e.left,y:e.top+e.height/2,edge:t}:{x:e.left+e.width/2,y:t===`top`?e.bottom:e.top,edge:t}},Dr=()=>{let e=Er();if(e)return e;let t=de.state();return t?{x:t.position.x,y:t.position.y,edge:`bottom`}:null},Or=(e,t)=>{let n=null,r=()=>{let i=e();i&&t(i),n=UF(r)};return r(),()=>{n!==null&&(WF(n),n=null)}};oR(()=>{if(!_t())return;let e=Or(Er,ue);pR(()=>{e(),ue(null)})});let kr=()=>{he?.(),he=null,oe(null)},Ar=()=>{o.hideContextMenu(),kr(),de.dismiss()},jr=()=>{ae()===null?(o.hideContextMenu(),de.isOpen()&&de.closePreservingRenderer(),he?.(),he=Or(Er,oe)):kr()},Mr=e=>{Ce({defaultAction:e})},Nr=e=>{let t=i.labelInstances.find(t=>t.id===e);if(!t?.element||!Jz(t.element))return;let n=t.element,r=HJ(VJ(n)),a={x:t.mouseX??r.x,y:r.y},s=t.elements&&t.elements.length>0?t.elements.filter(e=>Jz(e)):[n];setTimeout(()=>{kr(),de.isOpen()&&de.closePreservingRenderer(),d()||(o.setWasActivatedByToggle(!0),Gt()),o.setPointer(a),o.setFrozenElements(s),s.length>1&&t.bounds&&o.setFrozenDragRect(NY(t.bounds)),o.freeze(),o.showContextMenu(a,n)},0)};oR(()=>{let e=r.store.theme.hue;e===0?Zn.style.filter=``:Zn.style.filter=`hue-rotate(${e}deg)`}),r.store.theme.enabled&&Promise.resolve().then(()=>(mJ(),KU)).then(({ReactGrabRenderer:e})=>{t||(n=QR(()=>X(e,{get selectionVisible(){return ar()},get selectionBounds(){return Tt()},get selectionBoundsMultiple(){return Ft()},get selectionShouldSnap(){return i.frozenElements.length>0||Pt().length>0},get selectionElementsCount(){return i.frozenElements.length},get frozenLabelEntries(){return Lt()},get pendingShiftPreviewEntry(){return Rt()??void 0},get selectionFilePath(){return i.selectionFilePath??void 0},get selectionLineNumber(){return i.selectionLineNumber??void 0},get selectionTagName(){return or()},get selectionComponentName(){return Ze()},get selectionLabelVisible(){return sr()},selectionLabelStatus:`idle`,get hierarchyState(){return Bn()},get hierarchyMenuPosition(){return le()},get labelInstances(){return ur()},get dragVisible(){return fr()},get dragBounds(){return Nt()},get grabbedBoxes(){return dr()},get mouseX(){return Kz(()=>i.frozenElements.length>1)()?void 0:Bt()??zt().x},get isFrozen(){return f()||d()||ne()},get inputValue(){return i.inputText},get isPromptMode(){return b()},onShowContextMenuInstance:Nr,get onLabelInstanceHoverChange(){return ot.handleHoverChange},get onInputChange(){return o.setInputText},onInputSubmit:()=>void Yt(),onToggleExpand:$t,get selectionLabelShakeCount(){return k()},onConfirmDismiss:Zt,get discardPrompt(){return Kz(()=>!!ye.isPendingDismiss())()?{isKeyboardSelection:!0,onConfirm:Zt,onCopy:On}:S()?{onConfirm:Zt,onCancel:Qt}:void 0},get toolbarVisible(){return r.store.theme.toolbar.enabled},get isActive(){return d()},onToggleActive:sn,onActivateAction:on,get activeActionId(){return $e()},get enabled(){return T()},get shakeCount(){return D()},onToolbarStateChange:e=>{A(e),e.enabled!==T()&&(E(e.enabled),e.enabled||(qt(),Ar())),mZ.forEach(t=>t(e))},onSubscribeToToolbarStateChanges:e=>(mZ.add(e),()=>{mZ.delete(e)}),onToolbarSelectHoverChange:re,onToolbarRef:e=>{me=e},get contextMenuPosition(){return gr()},get contextMenuBounds(){return hr()},get contextMenuTagName(){return _r()},get contextMenuComponentName(){return vr()},get contextMenuHasFilePath(){return!!yr()?.filePath},get actions(){return r.store.actions},get actionContext(){return wr()},onContextMenuDismiss:Tr,onContextMenuHide:Sr,get toolbarMenuPosition(){return ae()},get toolbarMenuActions(){return r.store.actions.filter(e=>e.showInToolbarMenu===!0)},get defaultActionId(){return te()?.defaultAction??`copy`},onSetDefaultAction:Mr,onToggleToolbarMenu:jr,onToolbarMenuDismiss:kr,get editPanelState(){return de.state()},get editPanelPosition(){return se()},get onEditPanelDismiss(){return de.dismiss},get onEditPanelSubmit(){return de.submit},get onEditPanelPendingEditsChange(){return de.setPendingEdits},get onEditPanelInteractingChange(){return de.setInteracting}}),Zn))}).catch(e=>{console.warn(`[react-grab] Failed to load renderer:`,e)});let Pr={activate:()=>{o.setPendingCommentMode(!1),!d()&&T()&&Jt()},deactivate:()=>{(d()||_())&&Kt()},toggle:()=>{d()?Kt():T()&&Jt()},comment:dn,isActive:()=>d(),isEnabled:()=>T(),setEnabled:e=>{e!==T()&&(E(e),Ce({enabled:e,collapsed:!e}),e||(qt(),Ar()))},getToolbarState:()=>te()??EV(),setToolbarState:e=>{let t=te()??EV(),n=e.collapsed??t?.collapsed??!1,r={edge:e.edge??t?.edge??`bottom`,ratio:e.ratio??t?.ratio??.5,collapsed:n,enabled:e.enabled??!n,defaultAction:e.defaultAction??t?.defaultAction??`copy`};DV(r),A(r),r.enabled!==T()&&(E(r.enabled),r.enabled||(qt(),Ar())),mZ.forEach(e=>e(r))},onToolbarStateChange:e=>(mZ.add(e),()=>{mZ.delete(e)}),reset:()=>{qt(),Ar(),o.clearGrabbedBoxes(),o.clearLabelInstances(),o.setSelectionSource(null,null)},dispose:()=>{t=!0,pZ=!1,n?.(),he?.(),he=null,ge?.(),ge=null,mZ.clear(),e()},copyElement:async e=>{let t=Array.isArray(e)?e:[e];return t.length!==0&&await ct(t)},getSource:async e=>{let t=await DU(e);return t?{filePath:t.filePath,lineNumber:t.lineNumber,componentName:t.componentName}:null},getStackContext:e=>zU(e,{maxLines:r.store.options.maxContextLines}),getState:()=>({isActive:d(),isDragging:p(),isCopying:_(),isPromptMode:b(),isSelectionBoxVisible:!!ar(),isDragBoxVisible:!!fr(),targetElement:pt(),dragBounds:Nt()??null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:te()}),setOptions:e=>{r.setOptions(e)},registerPlugin:e=>{r.register(e,Pr)},unregisterPlugin:e=>{r.unregister(e)},getPlugins:()=>r.getPluginNames(),getDisplayName:OU};for(let e of fZ)r.register(e,Pr);return setTimeout(()=>{LF(!0)},fN),Pr})}})),_Z=r({DEFAULT_THEME:()=>zX,commentPlugin:()=>oZ,formatElementInfo:()=>HU,generateSnippet:()=>dZ,getGlobalApi:()=>yZ,getStack:()=>yU,init:()=>hZ,isInstrumentationActive:()=>QN,openPlugin:()=>cZ,registerPlugin:()=>CZ,setGlobalApi:()=>bZ,unregisterPlugin:()=>wZ}),vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ=t((()=>{gZ(),eR(),GU(),vZ=null,yZ=()=>typeof window>`u`?vZ:window.__REACT_GRAB__??vZ??null,bZ=e=>{vZ=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},xZ=[],SZ=e=>{for(;xZ.length>0;){let t=xZ.shift();t&&e.registerPlugin(t)}},CZ=e=>{let t=yZ();if(t){t.registerPlugin(e);return}xZ.push(e)},wZ=e=>{let t=yZ();if(t){t.unregisterPlugin(e);return}let n=xZ.findIndex(t=>t.name===e);n!==-1&&xZ.splice(n,1)},typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?vZ=window.__REACT_GRAB__:(vZ=hZ(),window.__REACT_GRAB__=vZ),SZ(vZ),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:vZ})))}));br(),Rr(),mD();var EZ=`linear-grab:context-copied`,DZ=`linear-grab:picker-activated`,OZ=0,kZ=null;function AZ(e){!e||e.grabbedAt===OZ||Cr().then(t=>{if(t.workflowMode!==`local`||e.grabbedAt===OZ)return;let n=()=>{OZ=e.grabbedAt,navigator.clipboard.writeText(uD(e,t)).then(()=>window.dispatchEvent(new CustomEvent(EZ))).catch(()=>{OZ=0})};e.source?.filePath?(kZ&&clearTimeout(kZ),kZ=null,n()):(kZ&&clearTimeout(kZ),kZ=setTimeout(n,900))})}function jZ(e,t=Date.now()){return{tagName:e.tagName||void 0,componentName:e.componentName||void 0,content:e.textContent?e.textContent.slice(0,500):``,source:e.filePath?{filePath:e.filePath,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:e.componentName??null}:null,stackContext:void 0,pageUrl:location.href,grabbedAt:t}}function MZ(e,t){let n=null,r=0;return{plugin:{name:`linear-grab`,hooks:{onElementSelect:i=>{r=Date.now(),n=Cr().then(e=>e.captureShots?RA(i):null);let a=t?.(),o={tagName:i.tagName?.toLowerCase()||void 0,componentName:a?.getDisplayName?.(i)||void 0,content:(i.textContent??``).slice(0,500),source:null,stackContext:void 0,pageUrl:location.href,grabbedAt:r};e([o]);try{a?.getSource?.(i)?.then(t=>{t?.filePath&&e([{...o,source:{filePath:t.filePath,lineNumber:t.lineNumber??null,columnNumber:t.columnNumber??null,componentName:t.componentName??o.componentName??null}}])})}catch{}}}},handleSelection(t){let i=r&&Date.now()-r<4e3?r:Date.now(),a=t.map((e,t)=>jZ(e,i+t));if(!a.length)return;e(a);let o=n;n=null,o&&o.then(t=>{t&&e([{...a[0],screenshotDataUrl:t},...a.slice(1)])})}}}var NZ=!1;async function PZ(){if(yr||NZ)return;NZ=!0;let e=await Promise.resolve().then(()=>(TZ(),_Z));try{e.init()}catch{NZ=!1;return}let t=MZ(e=>{Dr(e),AZ(e[0])},()=>e.getGlobalApi());e.registerPlugin(t.plugin),FA(),window.addEventListener(`react-grab:element-selected`,e=>{t.handleSelection(e.detail.elements??[])})}async function FZ(){if(yr){let e=await chrome.runtime.sendMessage({type:`grab/activate`});if(e&&e.ok===!1)throw Error(e.error??`Cannot activate the picker on this page.`);return}await PZ();let e=await Promise.resolve().then(()=>(TZ(),_Z));window.dispatchEvent(new CustomEvent(DZ)),e.getGlobalApi()?.activate()}function IZ(e){if(!yr)return()=>{};let t=t=>{t?.type===`grab/updated`&&e()};return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)}function LZ(){return new Promise(e=>{let t=document.createElement(`div`);t.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:crosshair;user-select:none;`;let n=document.createElement(`div`);n.style.cssText=`position:fixed;display:none;border:2px solid #5e6ad2;border-radius:4px;box-shadow:0 0 0 100000px rgba(0,0,0,0.35);pointer-events:none;`,t.appendChild(n),document.body.appendChild(t);let r=0,i=0,a=!1,o=e=>({x:Math.min(r,e.clientX),y:Math.min(i,e.clientY),w:Math.abs(e.clientX-r),h:Math.abs(e.clientY-i)}),s=()=>{t.remove(),window.removeEventListener(`keydown`,l,!0)},c=()=>{s(),e(null)},l=e=>{e.key===`Escape`&&(e.stopPropagation(),c())};window.addEventListener(`keydown`,l,!0),t.addEventListener(`pointerdown`,e=>{a=!0,r=e.clientX,i=e.clientY,t.setPointerCapture(e.pointerId)}),t.addEventListener(`pointermove`,e=>{if(!a)return;let t=o(e);n.style.display=`block`,n.style.left=`${t.x}px`,n.style.top=`${t.y}px`,n.style.width=`${t.w}px`,n.style.height=`${t.h}px`}),t.addEventListener(`pointerup`,t=>{let n=o(t);if(s(),n.w<8||n.h<8)return e(null);zA(n).then(t=>{if(!t)return e(null);e({tagName:`region`,componentName:void 0,content:`Region capture ${Math.round(n.w)}×${Math.round(n.h)}`,source:null,stackContext:void 0,screenshotDataUrl:t,pageUrl:location.href,grabbedAt:Date.now()})})})})}Rr(),br(),mD();var RZ=N(`<span class="text-text-faint ml-auto text-[10.5px] font-normal normal-case tabular-nums">`),zZ=N(`<details open class=group><summary class="text-text-dim hover:text-text flex cursor-pointer items-center gap-1.5 text-[11px] font-semibold tracking-wide uppercase select-none"><span aria-hidden class="text-text-faint inline-block w-3 text-center transition-transform group-open:rotate-90">›</span></summary><div class="flex flex-col gap-2 pt-2 pl-4">`),BZ=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center justify-between gap-2"><span class="text-text-faint min-w-0 text-[10.5px] leading-snug">All elements post into ONE issue. Shift+click / drag selects several at once.`),VZ=N(`<div class="flex flex-col gap-1.5"><div class="flex gap-1.5">`),HZ=N(`<span class=text-danger>●`),UZ=N(`<div class="flex flex-col gap-1.5"><span class="text-text-faint text-[10.5px] leading-snug">Captures your screen as a looping GIF (max 30s) the coding agent can watch. Pick this tab in the share dialog, then reproduce the issue.`),WZ=N(`<span class="inline-block min-w-[4ch] text-center">Stop`),GZ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full"></span><span class="text-text min-w-[5ch] text-[12px] tabular-nums"></span><span class="text-text-faint text-[10.5px]">max 0:30`),KZ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span class="text-text-dim text-[12px]">Encoding GIF…`),qZ=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4">`),JZ=N(`<span class="text-success text-[12px] leading-none">✓`),YZ=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M4 4l8 8M12 4l-8 8">`),XZ=N(`<span class="font-mono text-text-dim break-all text-[11px] leading-snug">`),ZZ=N(`<img alt="Element location screenshot"class="border-border bg-bg max-h-32 w-full rounded-md border object-contain">`),QZ=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex items-center justify-between gap-2"><span class="font-mono text-accent min-w-0 truncate text-[12px]"></span><div class="flex shrink-0 items-center gap-1">`),$Z=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),eQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M8 2.5v8M4.5 7.5 8 11l3.5-3.5M2.5 13.5h11">`),tQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M2.5 4h11M6.5 4V2.5h3V4M4 4l.7 9a1.5 1.5 0 0 0 1.5 1.4h3.6A1.5 1.5 0 0 0 11.3 13l.7-9M6.5 7v4.5M9.5 7v4.5">`),nQ=N(`<div class="bg-surface border-border flex flex-col gap-2 rounded-lg border p-2.5"><img alt="Screen recording preview"class="border-border bg-bg max-h-44 w-full rounded-md border object-contain"><span class="text-text-faint text-[10.5px] tabular-nums"> KB · <!>s · <!>×</span><label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Attach to issue on create</span></label><div class="flex items-center gap-1">`),rQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M6.5 9.5 9.5 6.5M7.5 4.5 9 3a2.5 2.5 0 0 1 3.5 3.5L11 8M8.5 11.5 7 13a2.5 2.5 0 0 1-3.5-3.5L5 8">`);function iQ(e){return(()=>{var t=zZ(),n=t.firstChild;n.firstChild;var r=n.nextSibling;return P(n,()=>e.title,null),P(n,j(M,{get when(){return e.badge},get children(){var t=RZ();return P(t,()=>e.badge),t}}),null),P(r,()=>e.children),t})()}function aQ(){let e=sr(),t=_r(()=>({queryKey:[`grab`],queryFn:Tr})),n=_r(()=>({queryKey:[`settings`],queryFn:Cr})),r=()=>t.data??[],i=()=>!!(n.data?.linearApiKey||n.data?.linearAccessToken),[a,o]=T(null),s=()=>{o(null),FZ().catch(e=>{o(e instanceof Error&&e.message?e.message:`Cannot activate the picker — open your dev app in the active tab first.`)})},c=async()=>{await kr(),e.invalidateQueries({queryKey:[`grab`]})},[l,u]=T(null),d=async e=>{try{await navigator.clipboard.writeText(uD(e,n.data??{})),u(e.grabbedAt),setTimeout(()=>u(null),1800)}catch{o(`Clipboard was blocked — click the button again.`)}},f=async t=>{await Or(t),e.invalidateQueries({queryKey:[`grab`]})},[p,m]=T(!1),h=async()=>{o(null),m(!0),window.dispatchEvent(new CustomEvent(DZ));try{let e=await LZ();e?await Dr([e]):o(`Region capture failed — try a smaller area (huge scrollers exceed canvas limits), or it was cancelled.`)}finally{m(!1)}},[g,_]=T(BD());ae(VD(_));let[v,y]=T(0);O(()=>{if(g().phase!==`recording`)return;let e=setInterval(()=>y(Date.now()-(BD().startedAt??Date.now())),250);ae(()=>clearInterval(e))});let b=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[x,S]=T(`idle`),[C,w]=T(null),E=async()=>{let e=BD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await xO(e.blob,`recording-${Date.now()}.gif`);return tO(t),t},k=async()=>{w(null),S(`busy`);try{let e=E().then(e=>new Blob([``],{type:`text/plain`}));try{await navigator.clipboard.write([new ClipboardItem({"text/plain":e})])}catch{let t=await e;await navigator.clipboard.writeText(await t.text())}S(`copied`),setTimeout(()=>S(`idle`),2e3)}catch{S(`idle`),await ne(),w(`Direct upload is blocked in this browser — copied the GIF instead. Paste it into a Linear comment and Linear uploads it.`)}},ee=()=>{let e=g().result;if(!e)return;let t=document.createElement(`a`);t.href=e.url,t.download=`linear-grab-recording.gif`,t.click()},[te,A]=T(`idle`),ne=async()=>{let e=g().result;if(e){w(null),A(`busy`);try{try{await navigator.clipboard.write([new ClipboardItem({"image/gif":e.blob})])}catch{let t=await createImageBitmap(e.blob),n=document.createElement(`canvas`);n.width=t.width,n.height=t.height,n.getContext(`2d`).drawImage(t,0,0);let r=await new Promise((e,t)=>n.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`));await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),w(`Browser blocks GIF clipboard — copied the first frame as PNG. Use Download for the animation.`)}A(`copied`),setTimeout(()=>A(`idle`),2e3)}catch(e){A(`idle`),w(e instanceof Error?e.message:`Copy failed.`)}}};return(()=>{var e=qZ();return P(e,j(iQ,{title:`Captured elements`,get badge(){return $e(()=>!!r().length)()?`${r().length}/8`:void 0},get children(){return[j(M,{get when(){return r().length>0},get fallback(){return j(Aj,{title:`No elements captured`,children:`Click "Pick element" below, then use the react-grab overlay on your dev app. Every pick ADDS to this list — Shift+click or drag in the overlay selects several at once. Source info needs a dev build.`})},get children(){var e=BZ(),t=e.firstChild;return t.firstChild,P(e,j(We,{get each(){return r()},children:e=>(()=>{var t=QZ(),n=t.firstChild.firstChild,r=n.nextSibling;return P(n,(()=>{var t=$e(()=>!!e.componentName);return()=>t()?`<${e.componentName}>`:$e(()=>!!e.tagName)()?`<${e.tagName}>`:`Element`})()),P(r,j(vj,{class:`size-7 px-0`,variant:`ghost`,title:`Copy context for a local agent (Claude Code / Cursor) — includes skills & memory paths`,"aria-label":`Copy context`,onClick:()=>void d(e),get children(){return j(M,{get when(){return l()===e.grabbedAt},get fallback(){return $Z()},get children(){return JZ()}})}}),null),P(r,j(vj,{class:`size-7 px-0`,variant:`ghost`,title:`Remove this element`,"aria-label":`Remove element`,onClick:()=>void f(e.grabbedAt),get children(){return YZ()}}),null),P(t,j(M,{get when(){return e.source?.filePath},get children(){var t=XZ();return P(t,()=>e.source.filePath,null),P(t,(()=>{var t=$e(()=>e.source?.lineNumber!=null);return()=>t()?`:${e.source.lineNumber}`:``})(),null),t}}),null),P(t,j(M,{get when(){return e.screenshotDataUrl},get children(){var t=ZZ();return D(()=>it(t,`src`,e.screenshotDataUrl)),t}}),null),t})()}),t),P(t,j(vj,{class:`h-6 shrink-0 px-2 text-[11px]`,variant:`ghost`,onClick:c,children:`Clear all`}),null),e}}),(()=>{var e=VZ(),t=e.firstChild;return P(t,j(vj,{variant:`primary`,class:`min-w-0 flex-1`,onClick:s,children:`Pick element`}),null),P(t,j(M,{when:!yr,get children(){return j(vj,{variant:`ghost`,class:`min-w-0 flex-1`,get loading(){return p()},title:`Drag a rectangle over any part of the page — the shot attaches to the issue`,onClick:()=>void h(),children:`Capture region`})}}),null),P(e,j(M,{get when(){return a()},get children(){return j(jj,{get message(){return a()}})}}),null),e})()]}}),null),P(e,j(iQ,{title:`Recording`,get badge(){return $e(()=>!!g().result)()?`${(g().result.durationMs/1e3).toFixed(1)}s`:void 0},get children(){return[j(M,{get when(){return g().phase===`idle`||g().phase===`error`},get children(){var e=UZ(),t=e.firstChild;return P(e,j(vj,{variant:`ghost`,onClick:()=>void ZD(),get children(){return[HZ(),` Record interaction`]}}),t),P(e,j(M,{get when(){return $e(()=>g().phase===`error`)()&&g().error},get children(){return j(jj,{get message(){return g().error}})}}),null),e}}),j(M,{get when(){return g().phase===`recording`},get children(){var e=GZ(),t=e.firstChild.nextSibling;return t.nextSibling,P(t,()=>b(v())),P(e,j(vj,{variant:`primary`,class:`ml-auto`,onClick:()=>void QD(),get children(){return WZ()}}),null),e}}),j(M,{get when(){return g().phase===`processing`},get children(){var e=KZ(),t=e.firstChild;return P(e,j(yj,{}),t),e}}),j(M,{get when(){return $e(()=>g().phase===`ready`)()&&g().result},children:e=>(()=>{var t=nQ(),n=t.firstChild,r=n.nextSibling,a=r.firstChild,o=a.nextSibling,s=o.nextSibling.nextSibling;s.nextSibling;var c=r.nextSibling,l=c.firstChild,u=c.nextSibling;return P(r,()=>(e().blob.size/1024).toFixed(0),a),P(r,()=>(e().durationMs/1e3).toFixed(1),o),P(r,()=>e().width,s),P(r,()=>e().height,null),l.addEventListener(`change`,e=>eO(e.currentTarget.checked)),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return x()===`busy`},get disabled(){return!i()},get title(){return i()?`Copy markdown — uploads to Linear, copies embeddable link`:`Connect Linear in Settings first`},"aria-label":`Copy markdown`,onClick:()=>void k(),get children(){return j(M,{get when(){return x()===`copied`},get fallback(){return rQ()},get children(){return JZ()}})}}),null),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return te()===`busy`},title:`Copy GIF — paste into a Linear comment and Linear uploads it`,"aria-label":`Copy GIF`,onClick:()=>void ne(),get children(){return j(M,{get when(){return te()===`copied`},get fallback(){return $Z()},get children(){return JZ()}})}}),null),P(u,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Download GIF`,"aria-label":`Download GIF`,onClick:ee,get children(){return eQ()}}),null),P(u,j(vj,{variant:`danger`,class:`ml-auto size-7 px-0`,title:`Discard recording`,"aria-label":`Discard recording`,onClick:$D,get children(){return tQ()}}),null),P(t,j(M,{get when(){return C()},get children(){return j(jj,{get message(){return C()}})}}),null),D(()=>it(n,`src`,e().url)),D(()=>l.checked=g().attachOnCreate),t})()})]}}),null),e})()}function oQ(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function sQ(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function cQ(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var lQ=(e,t)=>Math.abs(e-t)<1.01,uQ=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},dQ,fQ=()=>{if(dQ!==void 0)return dQ;if(typeof navigator>`u`)return dQ=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return dQ=!0;let e=navigator.maxTouchPoints;return dQ=navigator.platform===`MacIntel`&&e!==void 0&&e>0},pQ=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},mQ=e=>e,hQ=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},gQ=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(pQ(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(pQ(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},_Q={passive:!0},vQ=typeof window>`u`||`onscrollend`in window,yQ=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&vQ,o=0,s=a?null:uQ(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,_Q),a&&r.addEventListener(`scrollend`,u,_Q),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},bQ=(e,t)=>yQ(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),xQ=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},SQ=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},CQ=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mQ,rangeExtractor:hQ,onChange:()=>{},measureElement:xQ,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=sQ(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!fQ()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,_Q),e.addEventListener(`touchend`,n,_Q),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(fQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=sQ(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=sQ(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=oQ(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=sQ(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=EQ(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=sQ(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=sQ(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return cQ(t[wQ(0,t.length-1,r?e=>n[e*2]:e=>cQ(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(fQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&lQ(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},wQ=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function TQ(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function EQ(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=TQ(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=wQ(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}function DQ(e){let t=Ve(e),n=new CQ(t),[r,i]=tr(n.getVirtualItems()),[a,o]=T(n.getTotalSize()),s=new Proxy(n,{get(e,t){switch(t){case`getVirtualItems`:return()=>r;case`getTotalSize`:return()=>a();default:return Reflect.get(e,t)}}});return s.setOptions(t),ie(()=>{let e=s._didMount();s._willUpdate(),ae(e)}),E(()=>{s.setOptions(Ve(t,e,{onChange:(t,n)=>{var r;t._willUpdate(),i(ar(t.getVirtualItems(),{key:`index`})),o(t.getTotalSize()),(r=e.onChange)==null||r.call(e,t,n)}})),s._willUpdate(),i(ar(n.getVirtualItems(),{key:`index`})),o(n.getTotalSize())}),s}function OQ(e){return DQ(Ve({observeElementRect:gQ,observeElementOffset:bQ,scrollToFn:SQ},e))}Rr();var kQ=3e4,AQ=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,jQ={running:[],review:[]},MQ=null,NQ=new Set;function PQ(e){return NQ.add(e),MQ||(MQ=setInterval(()=>void LQ(),kQ),LQ()),()=>{NQ.delete(e),!NQ.size&&MQ&&(clearInterval(MQ),MQ=null)}}function FQ(){LQ()}function IQ(e){return{id:e.id,identifier:e.identifier,title:e.title,stateName:e.state.name,stateColor:e.state.color,delegateName:e.delegate?.displayName??`Agent`,updatedAt:e.updatedAt,prUrl:e.attachments?.find(e=>AQ.test(e.url))?.url}}async function LQ(){try{let e=await Cr();if(!e.linearApiKey&&!e.linearAccessToken)return;let t=(await uO()).filter(e=>!!e.delegate&&e.state.type===`started`).map(IQ);jQ={running:t.filter(e=>!e.prUrl),review:t.filter(e=>!!e.prUrl)};for(let e of NQ)e(jQ)}catch{}}Rr();async function RQ(){let e=[];for(let t of await Tr()??[]){let n=t.source?.filePath?` — \`${t.source.filePath}${t.source.lineNumber==null?``:`:${t.source.lineNumber}`}\``:``;if(e.push(`- \`<${t.componentName??t.tagName??`element`}>\`${n}`),t.screenshotDataUrl)try{let n=await xO(WA(t.screenshotDataUrl),`capture-${t.grabbedAt}.png`);e.push(` `)}catch{}}let t=BD();if(t.result)try{let n=t.result.assetUrl??await xO(t.result.blob,`recording-${Date.now()}.gif`);tO(n),e.push(``)}catch{}return e.length?`Captured context:\n${e.join(`
|
|
216
216
|
`)}`:null}function zQ(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var BQ=/^(https?:\/\/|mailto:)/i,VQ=/\.(mp4|mov|webm|m4v)(\?|#|$)/i,HQ=/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/i,UQ=class extends HTMLElement{objectUrl=null;connectedCallback(){let e=this.getAttribute(`src`)??``,t=this.getAttribute(`alt`)??``;(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(String(n.status));let r=await n.blob();if(this.objectUrl=URL.createObjectURL(r),this.textContent=``,r.type.startsWith(`video/`)){let e=document.createElement(`video`);e.controls=!0,e.preload=`metadata`,e.src=this.objectUrl,this.appendChild(e)}else{let e=document.createElement(`img`);e.src=this.objectUrl,e.alt=t,this.appendChild(e)}}catch{this.textContent=``;let e=document.createElement(`span`);e.textContent=`🖼 ${t||`media`} — start the bridge (npx linear-grab-bridge) to view Linear-hosted media here`,e.style.cssText=`font-size:10.5px;color:var(--color-text-faint);`,this.appendChild(e)}})()}disconnectedCallback(){this.objectUrl&&URL.revokeObjectURL(this.objectUrl)}};typeof customElements<`u`&&!customElements.get(`lg-media`)&&customElements.define(`lg-media`,UQ);var WQ=null;function GQ(e){WQ=e?e.replace(/\/$/,``):null}function KQ(e){try{if(WQ&&new URL(e).hostname.endsWith(`uploads.linear.app`))return`${WQ}/fetch?url=${encodeURIComponent(e)}`}catch{}return e}function qQ(e){let t=e;return t=t.replace(/`([^`]+)`/g,(e,t)=>`<code>${t}</code>`),t=t.replace(/!\[([^\]]*)\]\((?:<)?([^()\s]+?)(?:>)?\)/g,(e,t,n)=>{if(!BQ.test(n))return t;let r=KQ(n);return VQ.test(n)?`<video controls preload="metadata" src="${r}"></video>`:r!==n&&!HQ.test(n)?`<lg-media src="${r}" alt="${t}"></lg-media>`:`<img src="${r}" alt="${t}" loading="lazy" />`}),t=t.replace(/\[([^\]]+)\]\((?:<)?([^()\s]+?)(?:>)?\)/g,(e,t,n)=>BQ.test(n)?`<a href="${n}" target="_blank" rel="noopener noreferrer">${t}</a>`:t),t=t.replace(/<(https?:\/\/[^\s&]+)>/g,`<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>`),t=t.replace(/(^|[\s(])((?:https?:\/\/)[^\s<>()"']+)/g,(e,t,n)=>`${t}<a href="${n}" target="_blank" rel="noopener noreferrer">${n}</a>`),t=t.replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`),t=t.replace(/(^|\W)\*([^*\n]+)\*(?=\W|$)/g,`$1<em>$2</em>`),t}function JQ(e){let t=zQ(e.trim()).split(`
|
|
217
217
|
`),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r++;continue}if(e.startsWith("```")){let e=[];for(r++;r<t.length&&!t[r].startsWith("```");)e.push(t[r++]);r++,n.push(`<pre><code>${e.join(`
|
|
218
|
-
`)}</code></pre>`);continue}let i=e.match(/^(#{1,6})\s+(.*)$/);if(i){n.push(`<h4>${qQ(i[2])}</h4>`),r++;continue}if(/^\s*[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*[-*]\s+/.test(t[r]);)e.push(`<li>${qQ(t[r].replace(/^\s*[-*]\s+/,``))}</li>`),r++;n.push(`<ul>${e.join(``)}</ul>`);continue}if(/^\s*\d+[.)]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*\d+[.)]\s+/.test(t[r]);)e.push(`<li>${qQ(t[r].replace(/^\s*\d+[.)]\s+/,``))}</li>`),r++;n.push(`<ol>${e.join(``)}</ol>`);continue}let a=[];for(;r<t.length&&t[r].trim()&&!/^(#{1,6}\s|```|\s*[-*]\s+|\s*\d+[.)]\s+)/.test(t[r]);)a.push(t[r]),r++;n.push(`<p>${qQ(a.join(`<br />`))}</p>`)}return n.join(``)}Rr();var YQ=N(`<div class="flex h-full flex-col">`),XQ=N(`<span class="tabular-nums text-[10.5px] text-text-faint">live · updated `),ZQ=N(`<svg aria-hidden width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 4.5A7 7 0 0 1 13.5 3"></path><path d="M15 11.5A7 7 0 0 1 2.5 13"></path><polyline points="1 1 1 5 5 5"></polyline><polyline points="15 11 15 15 11 15">`),QQ=N(`<div class="flex-1 overflow-y-auto">`),$Q=N(`<div class="min-h-0 flex-1 overflow-y-auto pl-2 pr-3"><div style=position:relative>`),e$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">My issues</span><div class="flex items-center gap-2">`),t$=N(`<div style=position:absolute;top:0;left:0;width:100%>`),n$=N(`<button class="w-full cursor-pointer rounded-md px-2 py-1.5 text-left hover:bg-surface-2 transition-colors"><div class="flex items-center gap-1.5 min-w-0"><span class="font-mono text-[11px] text-text-dim shrink-0"></span><span class="truncate text-[12.5px] text-text"></span></div><div class="mt-0.5 flex items-center gap-1.5"><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),r$=N(`<span class="inline-block min-w-[6ch] text-left">← Back`),i$=N(`<span class="font-mono text-[11px] text-text-dim shrink-0">`),a$=N(`<span class="truncate text-[12px] font-medium text-text">`),o$=N(`<span class="text-[11.5px] text-text-faint">Loading…`),s$=N(`<div class="flex items-center gap-2"><span class="text-[11px] text-text-dim">`),c$=N(`<div class="flex flex-col gap-2">`),l$=N(`<div class="flex flex-col gap-1"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Attachments</span><div class="flex flex-col gap-1">`),u$=N(`<div class="flex flex-col gap-2.5"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Comments`),d$=N(`<option value=new>Start NEW agent (@<!>)`),f$=N(`<option value=comment>Comment only`),p$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),m$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),h$=N(`<span class="inline-block min-w-[4ch] text-left">Send`),g$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 flex-col gap-1 border-b px-3 py-2"><div class="flex items-center gap-2"></div></div><div class="min-h-0 flex-1 overflow-y-auto pl-3 pr-4 py-3 flex flex-col gap-3"></div><div class="border-border shrink-0 border-t p-2.5 flex flex-col gap-1.5"><div class="flex items-center gap-2">`),_$=N(`<div class="bg-surface border-border overflow-clip rounded-lg border"><div class="border-border flex h-9 min-w-0 items-center justify-between gap-2 border-b px-3"><div class="flex min-w-0 items-center gap-1.5 text-[11.5px] font-medium"><span aria-hidden class="text-text-dim inline-flex"></span><span class="text-text shrink-0">Local Claude Code</span><span class="text-text-dim shrink-0">started by you</span><span class="text-text-faint shrink-0 tabular-nums">· </span></div></div><button class="hover:bg-surface-2 flex h-9 w-full min-w-0 cursor-pointer items-center gap-2 px-3 text-left transition-colors"title="Open the live thread in the Local tab"><span></span><span class="text-text-faint min-w-0 flex-1 truncate text-[11.5px]"></span><svg width=14 height=14 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class="text-text-dim shrink-0"><path d="m6 3.5 4.5 4.5L6 12.5">`),v$=N(`<span class="inline-block min-w-[6ch] text-center"
|
|
219
|
-
`);l(e=>`${e?`${e}\n`:``}${t}\n`),$A(`capture`)});let[y,b]=T(null),[x,S]=T(new Set),[C,w]=T(null),ee=async n=>{w(null),b(n);try{await LO(n),S(e=>new Set(e).add(n)),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`my-issues`]}),FQ()}catch(e){w(e instanceof Error?`${e.message} (bridge must be running; gh needs merge rights)`:`Merge failed.`)}finally{b(null)}},te=O(()=>n.data?yO(n.data.comments):[]),[k,A]=T(`comment`),ne=!1;D(()=>{if(ne||!n.data||!i.data)return;ne=!0;let e=te();e.length?A(`thread:${e[0].id}`):n.data.delegate&&i.data.cursorAgentId&&A(`new`)});let re=vr(()=>({mutationFn:async()=>{let t=c().trim();if(!t)throw Error(`Message is empty`);let n=i.data??{},r=k();r.startsWith(`thread:`)?await _O(e.issueId,t,r.slice(7)):r===`new`&&n.cursorAgentId?await vO(e.issueId,t,{name:n.cursorAgentName,displayName:n.cursorAgentName??`Cursor`,url:n.cursorAgentUrl}):await _O(e.issueId,t)},onSuccess:()=>{l(``),d(null),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),FQ()},onError:e=>{d(e.message??`Failed to send`)}})),ie=O(()=>n.data),ae=O(()=>r.data??[]);return(()=>{var t=g$(),r=t.firstChild,a=r.firstChild,d=r.nextSibling,f=d.nextSibling,p=f.firstChild;return P(a,j(vj,{class:`min-w-[68px] shrink-0 text-[11px]`,get onClick(){return e.onBack},get children(){return r$()}}),null),P(a,j(M,{get when(){return ie()},get children(){return[(()=>{var e=i$();return P(e,()=>ie().identifier),e})(),(()=>{var e=a$();return P(e,()=>ie().title),e})()]}}),null),P(a,j(M,{get when(){return $e(()=>!!n.isPending)()&&!ie()},get children(){return o$()}}),null),P(r,j(M,{get when(){return ie()},get children(){var e=s$(),t=e.firstChild;return P(e,j(kj,{get color(){return ie().state.color}}),t),P(t,()=>ie().state.name),P(e,j(Tj,{get href(){return ie().url},class:`ml-auto shrink-0`,children:`Open in Linear`}),null),e}}),null),P(d,j(M,{get when(){return o()},children:e=>{let t=()=>s(e());return(()=>{var n=_$(),r=n.firstChild,i=r.firstChild.firstChild,a=i.nextSibling.nextSibling.nextSibling;a.firstChild;var o=r.nextSibling,s=o.firstChild,c=s.nextSibling;return P(i,j(wj,{size:12})),P(a,()=>Nj(e().startedAt),null),P(r,j(Oj,{get children(){return e().model??`default`}}),null),o.$$click=()=>YA(`local`),P(o,j(M,{get when(){return e().status===`running`},get children(){return j(yj,{size:12})}}),s),P(s,()=>t().word),P(c,(()=>{var t=$e(()=>e().status===`done`);return()=>t()?e().result??e().lastText:e().lastText})()),E(()=>st(s,`shrink-0 text-[11.5px] font-medium ${t().cls}`)),n})()}}),null),P(d,j(M,{get when(){return ae().length>0},get children(){var e=c$();return P(e,j(We,{get each(){return ae()},children:e=>j(j$,{session:e})})),e}}),null),P(d,j(M,{get when(){return $e(()=>!!ie())()&&ie().attachments.length>0},get children(){var e=l$(),t=e.firstChild.nextSibling;return P(t,j(We,{get each(){return ie().attachments},children:e=>{let t=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url);return(()=>{var n=y$(),r=n.firstChild;return P(r,()=>e.title),P(n,j(M,{when:t,get children(){return j(vj,{variant:`primary`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return y()===e.url},get disabled(){return x().has(e.url)},title:`Squash-merge this PR via the bridge's gh — reviewed the demo? Ship it.`,onClick:()=>void ee(e.url),get children(){var t=v$();return P(t,()=>x().has(e.url)?`Merged ✓`:`Merge`),t}})}}),null),E(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),n})()}}),null),P(t,j(M,{get when(){return C()},get children(){return j(jj,{get message(){return C()}})}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!ie())()&&ie().comments.length>0},get children(){var e=u$();return e.firstChild,P(e,j(We,{get each(){return ie().comments},children:e=>(()=>{var t=b$(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling;return P(r,()=>e.user?.displayName??e.user?.name??`Unknown`),P(n,j(M,{get when(){return e.user?.app},get children(){return j(Oj,{children:`agent`})}}),i),P(i,()=>Nj(e.createdAt)),E(()=>a.innerHTML=JQ(e.body)),t})()}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!(ie()&&ie().comments.length===0))()&&ae().length===0},get children(){return j(Aj,{title:`No activity yet`,children:`Comments and agent sessions will appear here.`})}}),null),P(d,j(M,{get when(){return $e(()=>!!n.isError)()&&!ie()},get children(){return j(Aj,{title:`Failed to load issue`,get children(){return n.error?.message??`Unknown error`}})}}),null),P(f,j(M,{get when(){return u()},get children(){return j(jj,{get message(){return u()}})}}),p),P(f,j(xj,{rows:2,placeholder:`Reply — steer the agent or add context…`,get value(){return c()},onInput:e=>l(e.target.value),get disabled(){return re.isPending}}),p),P(p,j(Sj,{class:`min-w-0 flex-1`,get value(){return k()},onChange:e=>A(e.currentTarget.value),get children(){return[j(We,{get each(){return te()},children:(e,t)=>(()=>{var n=x$(),r=n.firstChild.nextSibling;return r.nextSibling,P(n,(()=>{var e=$e(()=>te().length>1);return()=>e()?` #${t()+1}`:``})(),r),P(n,()=>Nj(e.createdAt),null),E(()=>n.selected=k()===`thread:${e.id}`),E(()=>n.value=`thread:${e.id}`),n})()}),j(M,{get when(){return i.data?.cursorAgentId},get children(){var e=d$(),t=e.firstChild.nextSibling;return t.nextSibling,P(e,()=>i.data?.cursorAgentName??`Cursor`,t),E(()=>e.selected=k()===`new`),e}}),(()=>{var e=f$();return E(()=>e.selected=k()===`comment`),e})()]}}),null),P(p,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Pick elements on the page — their source refs drop into this reply`,"aria-label":`Pick element for reply`,onClick:v,get children(){return p$()}}),null),P(p,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return h()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void _(),get children(){return m$()}}),null),P(p,j(vj,{class:`min-w-[52px] shrink-0`,variant:`primary`,get loading(){return re.isPending},get disabled(){return c().trim().length===0},onClick:()=>re.mutate(),get children(){return h$()}}),null),t})()}function j$(e){let t=O(()=>{let t=e.session.status;return/complete|done/i.test(t)?`var(--color-success)`:/await|pending|elicit/i.test(t)?`var(--color-warn)`:`var(--color-accent)`}),n=O(()=>e.session.activities.slice(-10));return(()=>{var r=T$(),i=r.firstChild,a=i.firstChild;return P(i,j(Oj,{get color(){return t()},get children(){return e.session.status}}),a),P(i,j(M,{get when(){return e.session.appUser?.displayName},get children(){var t=S$();return P(t,()=>e.session.appUser.displayName),t}}),a),P(a,()=>Nj(e.session.updatedAt)),P(r,j(M,{get when(){return e.session.summary},get children(){var t=C$();return P(t,()=>e.session.summary),t}}),null),P(r,j(M,{get when(){return n().length>0},get children(){var e=w$();return P(e,j(We,{get each(){return n()},children:e=>{let t=e.content,n=String(t?.body??t?.text??t?.type??JSON.stringify(t)).slice(0,300);return(()=>{var t=E$(),r=t.firstChild,i=r.nextSibling;return P(r,()=>Nj(e.createdAt)),P(i,n),t})()}})),e}}),null),r})()}rt([`click`]),Rr();var M$=N(`<div class="border-accent/40 bg-accent-soft self-end rounded-lg border px-2.5 py-1.5"><p class="text-accent mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase">You</p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),N$=N(`<div><p></p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),P$=N(`<p>`),F$=N(`<span class="text-text-faint max-w-[55%] truncate text-[10.5px] tabular-nums"> running · `),I$=N(`<div class="flex flex-col gap-1.5">`),L$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Local Claude Code</span></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),R$=N(`<span class="bg-surface-2 border-border font-mono mt-2 block rounded-md border px-2 py-1.5 text-[11px] select-all">npx linear-grab-bridge`),z$=N(`<span class="text-text-faint text-[10.5px] tabular-nums">ctx <!> · out `),B$=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),V$=N(`<span class="text-success text-[12px] leading-none">✓`),H$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><path d="M14 10a2 2 0 0 1-2 2H6l-3.5 2.5V4a2 2 0 0 1 2-2H12a2 2 0 0 1 2 2v6Z">`),U$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),W$=N(`<span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),G$=N(`<div class="border-border bg-bg flex flex-col gap-1 rounded-md border p-2"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-dim text-[10.5px] font-semibold tracking-wide uppercase">Changes</span><span class="ml-auto shrink-0 text-[10.5px] tabular-nums"><span class=text-success>+</span> <span class=text-danger>−`),K$=N(`<div class="border-border bg-bg flex max-h-80 flex-col gap-1.5 overflow-y-auto rounded-md border py-2 pl-2 pr-3">`),q$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),J$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),Y$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M8 2v4M8 10v4M2 8h4M10 8h4M4.5 4.5 6 6M11.5 11.5 10 10M11.5 4.5 10 6M4.5 11.5 6 10">`),X$=N(`<span class="inline-block min-w-[4ch] text-center">Send`),Z$=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center gap-1"><span class="text-text-faint min-w-0 flex-1 truncate text-[10.5px]">`),Q$=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text min-w-0 truncate text-[12.5px] font-medium"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><p class="text-text-dim text-[11.5px] leading-snug break-words"></p><div class="flex flex-wrap items-center gap-1.5"></div><div class="flex items-center gap-1">`),$$=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),e1=N(`<div class="flex min-w-0 items-center gap-1.5">`),t1=N(`<option>`),n1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),r1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M2.5 3.5 6 7 2.5 10.5M7.5 12.5h6">`),i1=N(`<span class=text-success>+`),a1=N(`<span class=text-danger>−`),o1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="shrink-0 text-[10px] tabular-nums">`),s1=N(`<span class=text-text-faint>bin`),c1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="text-success shrink-0 text-[10px]">new`),l1=N(`<div class="flex min-w-0 items-center gap-1.5 pt-0.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),u1=N(`<p class="text-text-faint text-[11px]">Waiting for output…`),d1=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}],f1=e=>e==null?`–`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e);function p1(){let e=sr(),t=_r(()=>({queryKey:[`bridge-health`],queryFn:EO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:3e3,enabled:!!t.data?.ok})),[r,i]=T(null),a=_r(()=>({queryKey:[`my-issues`],queryFn:uO,staleTime:15e3})),o=e=>{let t=e.title.match(/^([A-Z][A-Z0-9]*-\d+)/)?.[1];return t?a.data?.find(e=>e.identifier===t):void 0},s=_r(()=>({queryKey:[`bridge-task`,r()],queryFn:()=>OO(r()),refetchInterval:1500,enabled:!!r()&&!!t.data?.ok})),c=_r(()=>({queryKey:[`bridge-diff`,r()],queryFn:()=>PO(r()),refetchInterval:6e3,enabled:!!r()&&!!t.data?.ok})),l=()=>{e.invalidateQueries({queryKey:[`bridge-tasks`]}),e.invalidateQueries({queryKey:[`bridge-task`,r()]})},u=vr(()=>({mutationFn:e=>MO(e),onSuccess:l})),[d,f]=T(``),[p,m]=T(!1),[h,g]=T(0),_=_r(()=>({queryKey:[`grab`],queryFn:Tr,enabled:ZA()===`local`})),v=()=>{g(Date.now()),$A(`local`),FZ().catch(()=>$A(`capture`))};D(()=>{if(ZA()!==`local`)return;let e=(_.data??[]).filter(e=>e.grabbedAt>=h());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
|
|
220
|
-
`);f(e=>`${e?`${e}\n`:``}${t}\n`),$A(`capture`)});let y=async()=>{m(!0);try{let e=await RQ();e&&f(t=>`${t?`${t}\n`:``}${e}\n`)}finally{m(!1)}},b=vr(()=>({mutationFn:e=>AO(e.id,e.text),onSuccess:()=>{f(``),l()}})),x=vr(()=>({mutationFn:e=>jO(e.id,e.model),onSuccess:l})),S=vr(()=>({mutationFn:e=>NO(e),onSuccess:l})),C,w=!0,ee=()=>{C&&(w=C.scrollTop+C.clientHeight>=C.scrollHeight-48)};D(()=>{let e=s.data?.tail?.length??0;r(),!(!C||!e||!w)&&requestAnimationFrame(()=>{C&&(C.scrollTop=C.scrollHeight)})});let[te,k]=T(null),A=async e=>{try{await navigator.clipboard.writeText(zO(e)),k(e.id),setTimeout(()=>k(null),1800)}catch{}},ne=e=>e===`running`?`var(--color-accent)`:e===`done`?`var(--color-success)`:e===`stopped`?`var(--color-warn)`:`var(--color-danger)`,re=e=>{let t=e.line.kind,n=O(()=>JQ(e.line.text));return t===`user`?(()=>{var e=M$(),t=e.firstChild.nextSibling;return E(()=>t.innerHTML=n()),e})():t===`assistant`||t===`result`?(()=>{var e=N$(),r=e.firstChild,i=r.nextSibling;return st(e,`bg-surface rounded-lg border px-2.5 py-1.5 ${t===`result`?`border-success/40`:`border-border`}`),st(r,`mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase ${t===`result`?`text-success`:`text-text-faint`}`),P(r,t===`result`?`Result`:`Claude`),E(()=>i.innerHTML=n()),e})():(()=>{var n=P$();return st(n,`font-mono px-1 text-[10px] leading-relaxed break-words ${t===`subagent`?`text-warn`:t===`stderr`?`text-danger`:`text-text-faint`}`),P(n,()=>e.line.text),n})()};return(()=>{var e=L$(),a=e.firstChild;a.firstChild;var l=a.nextSibling;return P(a,j(M,{get when(){return t.data?.ok},get fallback(){return j(Oj,{class:`text-danger`,children:`bridge offline`})},get children(){var e=F$(),n=e.firstChild;return P(e,()=>t.data.active,n),P(e,()=>t.data.cwd.split(`/`).slice(-2).join(`/`),null),E(()=>it(e,`title`,t.data?.cwd)),e}}),null),P(l,j(M,{get when(){return t.data?.ok},get fallback(){return j(Aj,{title:`Bridge not running`,get children(){return[`Start it in your repo's terminal:`,R$(),`Then delegate from the Draft tab ("Local Claude Code") or watch tasks here. Sessions stay interactive — send follow-ups, switch models, interrupt, resume in your terminal. History persists across restarts.`]}})},get children(){return j(M,{get when(){return(n.data??[]).length>0},get fallback(){return j(Aj,{title:`No local tasks yet`,children:`Create an issue in Draft with "Delegate to → Local Claude Code", and it appears here with live status and a conversation view.`})},get children(){var e=I$();return P(e,j(We,{get each(){return n.data},children:e=>(()=>{var t=Q$(),n=t.firstChild,a=n.firstChild,l=a.nextSibling,m=n.nextSibling,h=m.nextSibling,g=h.nextSibling;return P(n,j(M,{get when(){return e.status===`running`},get fallback(){return(()=>{var t=$$();return E(n=>dt(t,`background`,ne(e.status))),t})()},get children(){return j(yj,{})}}),a),P(a,()=>e.title),P(l,()=>Nj(e.startedAt)),P(m,()=>e.lastText),P(h,j(Oj,{get color(){return ne(e.status)},get children(){return e.status}}),null),P(h,j(Oj,{get children(){return e.model??`default model`}}),null),P(h,j(M,{get when(){return e.pendingModel},get children(){return j(Oj,{class:`text-warn`,get children(){return[`→ `,$e(()=>e.pendingModel),` next msg`]}})}}),null),P(h,j(M,{get when(){return e.subagents>0},get children(){return j(Oj,{class:`text-warn`,get children(){return[`⛓ `,$e(()=>e.subagents),` subagents`]}})}}),null),P(h,j(M,{get when(){return e.usage},get children(){var t=z$(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>f1(e.usage.contextTokens),n),P(t,()=>f1(e.usage.outputTokens),null),P(t,(()=>{var t=$e(()=>!!e.usage.costUsd);return()=>t()?` · $${e.usage.costUsd.toFixed(2)}`:``})(),null),t}}),null),P(t,j(M,{get when(){return o(e)},children:e=>(()=>{var t=e1();return P(t,j(Oj,{get children(){return e().state.name}}),null),P(t,j(Tj,{get href(){return e().url},children:`Open in Linear`}),null),t})()}),g),P(t,j(M,{get when(){return $e(()=>!!e.worktree)()&&!e.worktree.removed},get children(){var t=B$(),n=t.firstChild;return P(t,j(Oj,{class:`text-warn`,children:`⎇ worktree`}),n),P(n,()=>e.worktree.branch),P(t,j(M,{get when(){return e.status!==`running`},get children(){return j(vj,{variant:`ghost`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return S.isPending},get title(){return`Remove the worktree at ${e.worktree.path} — the branch (and PR) survive`},onClick:()=>S.mutate(e.id),children:`Remove`})}}),null),E(()=>it(n,`title`,e.worktree.path)),t}}),g),P(g,j(Sj,{class:`h-7 w-auto min-w-0 flex-1 text-[11px]`,get value(){return e.pendingModel??e.model??``},onChange:t=>x.mutate({id:e.id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return j(We,{each:d1,children:t=>(()=>{var n=t1();return P(n,()=>t.label),E(()=>n.selected=(e.pendingModel??e.model??``)===t.id),E(()=>n.value=t.id),n})()})}}),null),P(g,j(M,{get when(){return o(e)},children:e=>j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,onClick:()=>YA(`activity`,e().id),get children(){return n1()}})}),null),P(g,j(vj,{variant:`ghost`,class:`size-7 px-0`,get disabled(){return!e.sessionId},get title(){return $e(()=>!!e.sessionId)()?`Copy resume command · session ${e.sessionId.slice(0,8)}…`:`No session yet`},onClick:()=>void A(e),get children(){return j(M,{get when(){return te()===e.id},get fallback(){return r1()},get children(){return V$()}})}}),null),P(g,j(vj,{variant:`ghost`,class:`size-7 px-0`,get title(){return r()===e.id?`Hide thread`:`Open thread — chat & changes`},onClick:()=>i(r()===e.id?null:e.id),get children(){return H$()}}),null),P(g,j(M,{get when(){return e.status===`running`},get children(){return j(vj,{variant:`danger`,class:`size-7 px-0`,get loading(){return u.isPending},title:`Interrupt — the session stays resumable`,onClick:()=>u.mutate(e.id),get children(){return U$()}})}}),null),P(t,j(M,{get when(){return r()===e.id},get children(){return[j(M,{get when(){return $e(()=>!!c.data)()&&(c.data.files.length||c.data.untracked.length||c.data.prs.length)},get children(){var e=G$(),t=e.firstChild,n=t.firstChild.nextSibling,r=n.firstChild;r.firstChild;var i=r.nextSibling.nextSibling;return i.firstChild,P(t,j(M,{get when(){return c.data.branch},get children(){var e=W$();return P(e,()=>c.data.branch),e}}),n),P(r,()=>c.data.totalAdded,null),P(i,()=>c.data.totalDeleted,null),P(e,j(We,{get each(){return c.data.files},children:e=>(()=>{var t=o1(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.path),P(r,j(M,{get when(){return!e.binary},get fallback(){return s1()},get children(){return[(()=>{var t=i1();return t.firstChild,P(t,()=>e.added,null),t})(),` `,(()=>{var t=a1();return t.firstChild,P(t,()=>e.deleted,null),t})()]}})),E(()=>it(n,`title`,e.path)),t})()}),null),P(e,j(We,{get each(){return c.data.untracked},children:e=>(()=>{var t=c1(),n=t.firstChild;return it(n,`title`,e),P(n,e),t})()}),null),P(e,j(We,{get each(){return c.data.prs},children:e=>(()=>{var t=l1(),n=t.firstChild;return P(t,j(Oj,{class:`text-accent`,get children(){return[`PR · `,$e(()=>e.state.toLowerCase())]}}),n),P(n,()=>e.title),E(t=>{var r=e.url,i=e.title;return r!==t.e&&it(n,`href`,t.e=r),i!==t.t&&it(n,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),(()=>{var e=K$();return e.addEventListener(`scroll`,ee),pt(e=>{C=e,w=!0},e),P(e,j(M,{get when(){return(s.data?.tail??[]).length>0},get fallback(){return u1()},get children(){return j(Ge,{get each(){return s.data?.tail??[]},children:e=>j(re,{get line(){return e()}})})}})),e})(),(()=>{var t=Z$(),n=t.firstChild,r=n.firstChild;return P(t,j(xj,{rows:2,get placeholder(){return e.status===`running`?`Message the working agent — it queues into the live session…`:`Follow-up — resumes the session…`},get value(){return d()},onInput:e=>f(e.currentTarget.value)}),n),P(r,(()=>{var t=$e(()=>!!e.alive);return()=>t()?`live session`:e.sessionId?`resumes on send`:`no session`})()),P(n,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Pick elements on the page — refs drop into this message`,"aria-label":`Pick element`,onClick:v,get children(){return q$()}}),null),P(n,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return p()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void y(),get children(){return J$()}}),null),P(n,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get disabled(){return $e(()=>!e.alive)()&&!e.sessionId},title:`Compact the session — frees context (sends /compact)`,"aria-label":`Compact session`,onClick:()=>b.mutate({id:e.id,text:`/compact`}),get children(){return Y$()}}),null),P(n,j(vj,{variant:`primary`,class:`shrink-0`,get loading(){return b.isPending},get disabled(){return!d().trim()||!e.alive&&!e.sessionId},onClick:()=>b.mutate({id:e.id,text:d().trim()}),get children(){return X$()}}),null),t})()]}}),null),t})()})),e}})}})),e})()}var m1=N(`<div class="flex flex-col gap-1.5">`),h1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Pull requests</span><span class="text-text-faint text-[10.5px] tabular-nums">/<!> from your issues</span></div><div class="border-border flex shrink-0 items-center gap-1.5 border-b px-3 py-1.5"><div class="bg-surface-2 border-border flex shrink-0 rounded-md border p-0.5"></div></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),g1=N(`<button>`),_1=N(`<span class="text-[12px] leading-none">✓`),v1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),y1=N(`<span class="text-success text-[12px] leading-none">✓`),b1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><a target=_blank rel=noreferrer class="text-accent truncate text-[12.5px] font-medium hover:underline"></a><div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim shrink-0 text-[11px]"></span><span class="text-text-dim truncate text-[11.5px]"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 flex-wrap items-center gap-1.5"><div class="ml-auto flex shrink-0 items-center gap-1">`),x1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=4 cy=3.5 r=1.5></circle><circle cx=4 cy=12.5 r=1.5></circle><circle cx=12 cy=8 r=1.5></circle><path d="M4 5v6M4 6.5c0 2 2 3 4.5 3h2">`),S1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),C1=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i;function w1(e){let t=_r(()=>({queryKey:[`my-issues`],queryFn:uO,refetchInterval:15e3})),n=O(()=>(t.data??[]).flatMap(e=>(e.attachments??[]).filter(e=>C1.test(e.url)).map(t=>({issue:e,attachment:t})))),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:1e4,retry:0})),i=_r(()=>({queryKey:[`pr-status`,n().map(e=>e.attachment.url).sort().join(`|`)],queryFn:()=>IO(n().map(e=>e.attachment.url)),refetchInterval:3e4,retry:0,enabled:n().length>0})),a=e=>g().has(e.attachment.url)?`MERGED`:i.data?.[e.attachment.url],o=e=>!!r.data?.some(t=>t.title.startsWith(e.issue.identifier)),[s,c]=T(`all`),[l,u]=T(``),d=O(()=>{let e=l().trim().toLowerCase();return n().filter(t=>{let n=t.issue.state.type;return!(s()===`review`&&n!==`started`||s()===`open`&&!(n===`started`||n===`unstarted`||n===`backlog`)||s()===`done`&&n!==`completed`||e&&![t.attachment.title,t.issue.title,t.issue.identifier].join(` `).toLowerCase().includes(e))})}),[f,p]=T(null),[m,h]=T(null),[g,_]=T(new Set),v=async e=>{h(e);try{await LO(e),_(t=>new Set(t).add(e))}catch{}finally{h(null)}},y=async e=>{try{await navigator.clipboard.writeText(e.attachment.url),p(e.attachment.id),setTimeout(()=>p(null),1500)}catch{}};return(()=>{var r=h1(),i=r.firstChild,p=i.firstChild.nextSibling,h=p.firstChild,_=h.nextSibling;_.nextSibling;var b=i.nextSibling,x=b.firstChild,S=b.nextSibling;return P(p,()=>d().length,h),P(p,()=>n().length,_),P(x,j(We,{each:[{id:`all`,label:`All`},{id:`review`,label:`Review`},{id:`open`,label:`Open`},{id:`done`,label:`Done`}],children:e=>(()=>{var t=g1();return t.$$click=()=>c(e.id),P(t,()=>e.label),E(()=>st(t,`rounded-[5px] px-2 py-0.5 text-[11px] font-medium transition-colors ${s()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),P(b,j(bj,{class:`h-6 min-w-0 flex-1 text-[11px]`,placeholder:`Search PRs…`,get value(){return l()},onInput:e=>u(e.currentTarget.value)}),null),P(S,j(M,{get when(){return d().length>0},get fallback(){return j(Aj,{title:`No PRs yet`,get children(){return $e(()=>!!t.isError)()?`Connect Linear in Settings.`:n().length>0?`No PRs match the current filter.`:`PRs opened by delegated agents appear here as soon as they link back to your issues.`}})},get children(){var t=m1();return P(t,j(We,{get each(){return d()},children:t=>(()=>{var n=b1(),r=n.firstChild,i=r.nextSibling,s=i.firstChild,c=s.nextSibling,l=c.nextSibling,u=i.nextSibling,d=u.firstChild;return P(r,()=>t.attachment.title||t.attachment.url),P(i,j(kj,{get color(){return t.issue.state.color}}),s),P(s,()=>t.issue.identifier),P(c,()=>t.issue.title),P(l,()=>Nj(t.issue.updatedAt)),P(u,j(Oj,{get children(){return t.issue.state.name}}),d),P(u,j(M,{get when(){return t.issue.delegate},get children(){return j(Oj,{class:`text-accent`,get children(){return[j(Cj,{}),` `,$e(()=>t.issue.delegate.displayName)]}})}}),d),P(u,j(M,{get when(){return o(t)},get children(){return j(Oj,{class:`text-warn`,get children(){return[j(wj,{}),` local`]}})}}),d),P(u,j(Tj,{get href(){return t.issue.url},class:`shrink-0`,title:`Open the issue in Linear`,children:`Linear`}),d),P(d,j(M,{get when(){return $e(()=>!!a(t))()&&a(t)!==`OPEN`},get children(){return j(Oj,{get class(){return a(t)===`MERGED`?`text-success`:`text-text-faint`},get children(){return a(t)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(d,j(vj,{variant:`primary`,class:`size-7 px-0`,get classList(){return{hidden:!!a(t)&&a(t)!==`OPEN`}},get loading(){return m()===t.attachment.url},get disabled(){return g().has(t.attachment.url)},get title(){return g().has(t.attachment.url)?`Merged`:`Squash-merge this PR (bridge gh)`},"aria-label":`Merge PR`,onClick:()=>void v(t.attachment.url),get children(){return j(M,{get when(){return g().has(t.attachment.url)},get fallback(){return x1()},get children(){return _1()}})}}),null),P(d,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,"aria-label":`Open issue activity`,onClick:()=>{YA(`activity`,t.issue.id),e.onOpenIssue()},get children(){return v1()}}),null),P(d,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Copy PR URL`,"aria-label":`Copy PR URL`,onClick:()=>void y(t),get children(){return j(M,{get when(){return f()===t.attachment.id},get fallback(){return S1()},get children(){return y1()}})}}),null),E(e=>{var n=t.attachment.url,i=t.attachment.title;return n!==e.e&&it(r,`href`,e.e=n),i!==e.t&&it(r,`title`,e.t=i),e},{e:void 0,t:void 0}),n})()})),t}})),r})()}rt([`click`]),Rr();function T1(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function E1(e){let t=T1(crypto.getRandomValues(new Uint8Array(32))),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t)),r=T1(new Uint8Array(n)),i=T1(crypto.getRandomValues(new Uint8Array(16))),a=chrome.identity.getRedirectURL(),o=new URL(`https://linear.app/oauth/authorize`);o.searchParams.set(`client_id`,e),o.searchParams.set(`redirect_uri`,a),o.searchParams.set(`response_type`,`code`),o.searchParams.set(`scope`,`read,write`),o.searchParams.set(`state`,i),o.searchParams.set(`code_challenge`,r),o.searchParams.set(`code_challenge_method`,`S256`);let s=await chrome.identity.launchWebAuthFlow({url:o.toString(),interactive:!0});if(!s)throw Error(`OAuth flow was cancelled`);let c=new URL(s).searchParams;if(c.get(`state`)!==i)throw Error(`OAuth state mismatch`);let l=c.get(`code`);if(!l)throw Error(c.get(`error_description`)??`No authorization code returned`);let u=await fetch(`https://api.linear.app/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,code:l,redirect_uri:a,client_id:e,code_verifier:t})}),d=await u.json().catch(()=>null);if(!u.ok||!d?.access_token)throw Error(`Token exchange failed — check the OAuth app callback URL and client id`);await wr({linearAccessToken:d.access_token,linearOauthClientId:e})}async function D1(){await wr({linearAccessToken:void 0,linearApiKey:void 0})}Rr(),br(),Nx(),mD();var O1=N(`<div class="bg-surface-2 border-border flex rounded-md border p-0.5">`),k1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Cloud: picking an element opens the panel to draft & delegate to the Cursor agent. Local (react-grab style): picking auto-copies the element's context — source, stack, and your skills/memory paths — straight to the clipboard for a local Claude Code or Cursor session; the panel stays out of the way. Both share the same picker; switch anytime.`),A1=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Element screenshots`),j1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Captures a highlighted screenshot of each picked element and attaches it to the issue. Costs a beat on huge pages — with this off, picking is instant (pure react-grab speed).`),M1=N(`<span class=text-text>Connected as <span class=font-medium></span> · <span class=text-text-dim>`),N1=N(`<div class="bg-surface border-border flex items-center justify-between rounded-lg border p-2.5"><span class="text-text text-[12px]">`),P1=N(`<option value>Select a team…`),F1=N(`<p class="text-text-dim text-[11px]">No agents found — install the Cursor integration in Linear first.`),I1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Empty = the default above (computer-use testing, video demo, PR + review babysitting).`),L1=N(`<div class="flex flex-col gap-1.5">`),R1=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Mode</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">Beside page squeezes the app next to the panel, DevTools-style — nothing gets covered. Also toggleable from the dock icon in the panel header.`),z1=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Dock side</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">The launcher pill is draggable — park it anywhere it doesn't cover your app.`),B1=N(`<option value>Select a channel…`),V1=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Announce new issues on create`),H1=N(`<span class="text-text-faint text-[10.5px] leading-snug">⚠️ Tokens are embedded in issue Agent-instructions so agents can post the finished demo — everyone who can read the issue can read them. Use single-channel-scoped bots.`),U1=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Provider preference</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"><button>Auto</button><button>OpenAI</button><button>Anthropic`),W1=N(`<p class="text-text-dim text-[11px]">`),G1=N(`<div class=min-h-[2lh]>`),K1=N(`<ol class="text-text-faint flex list-decimal flex-col gap-1 pl-4 text-[11px] leading-relaxed"><li>Pick an element on your running dev app.</li><li>Draft the issue (AI optional).</li><li>Create + delegate — Cursor's cloud agent fixes it and opens a PR.</li><li>Track and steer it from Activity.`),q1=N(`<div class="flex h-full flex-col gap-5 overflow-y-auto pt-3 pb-6 pl-3 pr-4">`),J1=N(`<button>`),Y1=N(`<div class="flex gap-1.5">`),X1=N(`<p class="text-text-faint text-center text-[10.5px]">or`),Z1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Register this callback URL in your Linear OAuth app config:<br><span class="font-mono text-[10.5px] break-all">`),Q1=N(`<div class="flex flex-col gap-3">`),$1=N(`<span class=text-text-dim>Connected — verifying…`),e0=N(`<option> (<!>)`),t0=N(`<option value>Select the agent…`),n0=N(`<option>`),r0=N(`<option>#`),i0=N(`<p class="text-text-dim text-[11px]">No key set — AI drafting disabled, manual drafting still works.`);function a0(){let e=sr(),t=_r(()=>({queryKey:[`settings`],queryFn:Cr,staleTime:0})),n=O(()=>t.data??{});async function r(t,n=!1){await wr(t),await e.invalidateQueries({queryKey:[`settings`]}),n&&(await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]}))}let i=O(()=>!!(n().linearApiKey||n().linearAccessToken)),a=_r(()=>({queryKey:[`viewer`],queryFn:sO,enabled:i(),retry:0})),o=_r(()=>({queryKey:[`teams`],queryFn:cO,enabled:i()})),s=_r(()=>({queryKey:[`agents`],queryFn:lO,enabled:i()})),[c,l]=T(``),[u,d]=T(!1),[f,p]=T(``);async function m(){let e=c().trim();if(e){d(!0),p(``);try{await r({linearApiKey:e},!0),await sO(),l(``)}catch{p(`Key rejected — could not verify. Check the key and try again.`),await r({linearApiKey:void 0},!0)}finally{d(!1)}}}let[h,g]=T(``),[_,v]=T(!1),[y,b]=T(``);async function x(){let t=(h()||n().linearOauthClientId||``).trim();if(!t){b(`Enter an OAuth client ID first.`);return}v(!0),b(``);try{await E1(t),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}catch(e){b(e instanceof Error?e.message:`OAuth flow failed.`)}finally{v(!1)}}let[S,C]=T(!1);async function w(){C(!0);try{await D1(),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}finally{C(!1)}}let ee=yr?chrome.identity.getRedirectURL():null,D=_r(()=>({queryKey:[`slack-channels`,n().slackToken],queryFn:()=>WO(n().slackToken),enabled:!!n().slackToken,retry:0,staleTime:6e4})),te=O(()=>Ox(n())),k=O(()=>{let e=te();return e?`Drafting with ${e} — ${jx[e].fast} (fast) / ${jx[e].best} (best)`:null});return(()=>{var e=q1();return P(e,j(Dj,{title:`Workflow`,get children(){return[(()=>{var e=O1();return P(e,j(We,{each:[{id:`cloud`,label:`Cloud · Linear + Cursor`},{id:`local`,label:`Local · clipboard`}],children:e=>(()=>{var t=J1();return t.$$click=()=>void r({workflowMode:e.id}),P(t,()=>e.label),E(()=>st(t,`flex-1 rounded-[5px] px-2 py-1 text-[11.5px] font-medium transition-colors ${(n().workflowMode??`cloud`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),k1()]}}),null),P(e,j(Dj,{title:`Capture`,get children(){return[(()=>{var e=A1(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({captureShots:e.currentTarget.checked||void 0})),E(()=>t.checked=!!n().captureShots),e})(),j1()]}}),null),P(e,j(Dj,{title:`Linear`,get children(){return j(M,{get when(){return i()},get fallback(){return(()=>{var e=Q1();return P(e,j(Ej,{label:`Personal API key`,hint:`Create one at linear.app → Settings → API — fastest path.`,get children(){return[(()=>{var e=Y1();return P(e,j(bj,{type:`password`,placeholder:`lin_api_…`,get value(){return c()},onInput:e=>l(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&m()}}),null),P(e,j(vj,{variant:`primary`,get loading(){return u()},get disabled(){return!c().trim()},onClick:()=>void m(),class:`shrink-0`,children:`Connect`}),null),e})(),j(M,{get when(){return f()},get children(){return j(jj,{get message(){return f()}})}})]}}),null),P(e,j(M,{when:yr,get children(){return[X1(),j(Ej,{label:`OAuth client ID`,get children(){return[(()=>{var e=Y1();return P(e,j(bj,{placeholder:`your-client-id`,get value(){return h()||n().linearOauthClientId||``},onInput:e=>g(e.currentTarget.value)}),null),P(e,j(vj,{variant:`ghost`,get loading(){return _()},onClick:()=>void x(),class:`shrink-0 whitespace-nowrap`,children:`Connect with OAuth`}),null),e})(),j(M,{get when(){return y()},get children(){return j(jj,{get message(){return y()}})}}),(()=>{var e=Z1(),t=e.firstChild.nextSibling.nextSibling;return P(t,ee),e})()]}})]}}),null),e})()},get children(){var e=N1(),t=e.firstChild;return P(t,j(M,{get when(){return!a.isLoading},get fallback(){return $1()},get children(){return j(M,{get when(){return a.data},get fallback(){return j(M,{get when(){return a.isError},get fallback(){return $1()},get children(){return j(jj,{message:`Key rejected — reconnect`})}})},get children(){var e=M1(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return P(t,()=>a.data.name),P(n,()=>a.data.email),e}})}})),P(e,j(vj,{variant:`ghost`,get loading(){return S()},onClick:()=>void w(),class:`ml-2 shrink-0`,children:`Disconnect`}),null),e}})}}),null),P(e,j(M,{get when(){return i()},get children(){return j(Dj,{title:`Workspace`,get children(){return[j(Ej,{label:`Default team`,get children(){return j(Sj,{get value(){return n().defaultTeamId??``},onChange:e=>{let t=e.currentTarget.value;r({defaultTeamId:t||void 0})},get disabled(){return o.isLoading},get children(){return[P1(),j(M,{get when(){return o.data},get children(){return j(We,{get each(){return o.data},children:e=>(()=>{var t=e0(),r=t.firstChild,i=r.nextSibling;return i.nextSibling,P(t,()=>e.name,r),P(t,()=>e.key,i),E(()=>t.selected=e.id===n().defaultTeamId),E(()=>t.value=e.id),t})()})}})]}})}}),j(Ej,{label:`Cursor agent`,hint:`App users in your workspace. Pick Cursor — requires the Cursor integration installed in Linear (workspace admin) with usage-based pricing enabled in Cursor.`,get children(){return j(M,{get when(){return $e(()=>!!s.data)()&&s.data.length===0},get fallback(){return j(Sj,{get value(){return n().cursorAgentId??``},onChange:e=>{let t=e.currentTarget.value;if(!t){r({cursorAgentId:void 0,cursorAgentName:void 0,cursorAgentUrl:void 0});return}let n=s.data?.find(e=>e.id===t);n&&r({cursorAgentId:n.id,cursorAgentName:n.displayName,cursorAgentUrl:n.url??void 0})},get disabled(){return s.isLoading},get children(){return[t0(),j(M,{get when(){return s.data},get children(){return j(We,{get each(){return s.data},children:e=>(()=>{var t=n0();return P(t,()=>e.displayName),E(()=>t.selected=e.id===n().cursorAgentId),E(()=>t.value=e.id),t})()})}})]}})},get children(){return F1()}})}}),j(Ej,{label:`Default repository`,hint:`Appended to delegated issues as [repo=…] so Cursor picks the right repo.`,get children(){return j(bj,{placeholder:`owner/repository`,get value(){return n().defaultRepo??``},onBlur:e=>{r({defaultRepo:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Cursor cloud model`,hint:`Appended as [model=…] — e.g. claude-opus-4-8, gpt-5.2, composer. Empty = Cursor's default.`,get children(){return j(bj,{placeholder:`Cursor's default`,get value(){return n().cursorModel??``},onBlur:e=>{r({cursorModel:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Agent instructions`,hint:`Appended to every issue as '### Agent instructions' and given to the AI draft. Add demo credentials (username/password) so the agent can log in, test, and record its video. Careful: credentials become visible to everyone who can read the issue.`,get children(){return[j(xj,{rows:5,placeholder:pD,get value(){return n().issueTemplate??``},onBlur:e=>{r({issueTemplate:e.currentTarget.value.trim()||void 0})}}),I1()]}}),j(Ej,{label:`Dev server log URL`,hint:`Tail of your dev-server log attached to issues (and fed to AI drafts). Serve the log over HTTP: "dev:http": "next dev 2>&1 | tee public/dev-server.log" (gitignore it), then use /dev-server.log here. Empty = disabled.`,get children(){return j(bj,{placeholder:`/dev-server.log`,get value(){return n().logUrl??``},onBlur:e=>{r({logUrl:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Log lines to attach`,hint:`Trailing lines included in the issue (10–500).`,get children(){return j(bj,{type:`number`,min:`10`,max:`500`,placeholder:`100`,get value(){return n().logLines??``},onBlur:e=>{let t=Number(e.currentTarget.value);r({logLines:Number.isFinite(t)&&t>0?Math.min(500,Math.max(10,Math.round(t))):void 0})}})}}),j(Ej,{label:`Skills & memory paths`,hint:`One path per line. The cloud agent works in a full repo checkout, so committed paths (e.g. .claude/skills/apple-hig-design-principles) are readable directly — every issue gets a MANDATORY-reading section pointing at them. Repo-relative for cloud agents; absolute paths also work when you paste the issue into a local Claude Code session. Per project: these settings live per dev origin.`,get children(){return j(xj,{rows:4,placeholder:`.claude/skills/apple-hig-design-principles
|
|
218
|
+
`)}</code></pre>`);continue}let i=e.match(/^(#{1,6})\s+(.*)$/);if(i){n.push(`<h4>${qQ(i[2])}</h4>`),r++;continue}if(/^\s*[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*[-*]\s+/.test(t[r]);)e.push(`<li>${qQ(t[r].replace(/^\s*[-*]\s+/,``))}</li>`),r++;n.push(`<ul>${e.join(``)}</ul>`);continue}if(/^\s*\d+[.)]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*\d+[.)]\s+/.test(t[r]);)e.push(`<li>${qQ(t[r].replace(/^\s*\d+[.)]\s+/,``))}</li>`),r++;n.push(`<ol>${e.join(``)}</ol>`);continue}let a=[];for(;r<t.length&&t[r].trim()&&!/^(#{1,6}\s|```|\s*[-*]\s+|\s*\d+[.)]\s+)/.test(t[r]);)a.push(t[r]),r++;n.push(`<p>${qQ(a.join(`<br />`))}</p>`)}return n.join(``)}Rr();var YQ=N(`<div class="flex h-full flex-col">`),XQ=N(`<span class="tabular-nums text-[10.5px] text-text-faint">live · updated `),ZQ=N(`<svg aria-hidden width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 4.5A7 7 0 0 1 13.5 3"></path><path d="M15 11.5A7 7 0 0 1 2.5 13"></path><polyline points="1 1 1 5 5 5"></polyline><polyline points="15 11 15 15 11 15">`),QQ=N(`<div class="flex-1 overflow-y-auto">`),$Q=N(`<div class="min-h-0 flex-1 overflow-y-auto pl-2 pr-3"><div style=position:relative>`),e$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">My issues</span><div class="flex items-center gap-2">`),t$=N(`<div style=position:absolute;top:0;left:0;width:100%>`),n$=N(`<button class="w-full cursor-pointer rounded-md px-2 py-1.5 text-left hover:bg-surface-2 transition-colors"><div class="flex items-center gap-1.5 min-w-0"><span class="font-mono text-[11px] text-text-dim shrink-0"></span><span class="truncate text-[12.5px] text-text"></span></div><div class="mt-0.5 flex items-center gap-1.5"><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),r$=N(`<span class="inline-block min-w-[6ch] text-left">← Back`),i$=N(`<span class="font-mono text-[11px] text-text-dim shrink-0">`),a$=N(`<span class="truncate text-[12px] font-medium text-text">`),o$=N(`<span class="text-[11.5px] text-text-faint">Loading…`),s$=N(`<div class="flex items-center gap-2"><span class="text-[11px] text-text-dim">`),c$=N(`<div class="flex flex-col gap-2">`),l$=N(`<div class="flex flex-col gap-1"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Attachments</span><div class="flex flex-col gap-1">`),u$=N(`<div class="flex flex-col gap-2.5"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Comments`),d$=N(`<option value=new>Start NEW agent (@<!>)`),f$=N(`<option value=comment>Comment only`),p$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),m$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),h$=N(`<span class="inline-block min-w-[4ch] text-left">Send`),g$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 flex-col gap-1 border-b px-3 py-2"><div class="flex items-center gap-2"></div></div><div class="min-h-0 flex-1 overflow-y-auto pl-3 pr-4 py-3 flex flex-col gap-3"></div><div class="border-border shrink-0 border-t p-2.5 flex flex-col gap-1.5"><div class="flex items-center gap-2">`),_$=N(`<div class="bg-surface border-border overflow-clip rounded-lg border"><div class="border-border flex h-9 min-w-0 items-center justify-between gap-2 border-b px-3"><div class="flex min-w-0 items-center gap-1.5 text-[11.5px] font-medium"><span aria-hidden class="text-text-dim inline-flex"></span><span class="text-text shrink-0">Local Claude Code</span><span class="text-text-dim shrink-0">started by you</span><span class="text-text-faint shrink-0 tabular-nums">· </span></div></div><button class="hover:bg-surface-2 flex h-9 w-full min-w-0 cursor-pointer items-center gap-2 px-3 text-left transition-colors"title="Open the live thread in the Local tab"><span></span><span class="text-text-faint min-w-0 flex-1 truncate text-[11.5px]"></span><svg width=14 height=14 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class="text-text-dim shrink-0"><path d="m6 3.5 4.5 4.5L6 12.5">`),v$=N(`<span class="inline-block min-w-[6ch] text-center">Merge`),y$=N(`<div class="flex min-w-0 items-center gap-1.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11.5px] hover:underline">`),b$=N(`<div class="flex flex-col gap-0.5"><div class="flex items-center gap-1.5"><span class="text-[11px] font-medium text-text-dim"></span><span class="ml-auto tabular-nums text-[10.5px] text-text-faint"></span></div><div class="lg-md text-text text-[12px] leading-relaxed break-words">`),x$=N(`<option>Steer running agent<!> · `),S$=N(`<span class="text-[11px] text-text-dim">`),C$=N(`<p class="text-[12px] text-text leading-relaxed whitespace-pre-wrap break-words">`),w$=N(`<div class="flex flex-col gap-0.5 border-t border-border pt-1.5 mt-0.5">`),T$=N(`<div class="bg-surface border-border rounded-lg border p-2.5 flex flex-col gap-1.5"><div class="flex items-center gap-1.5 flex-wrap"><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),E$=N(`<div class="flex items-start gap-1.5"><span class="tabular-nums text-[10px] text-text-faint shrink-0 mt-px"></span><span class="text-[11px] text-text-dim break-words min-w-0">`);function D$(){let[e,t]=T(null);return O(()=>{let e=qA();e&&(t(e),XA())}),(()=>{var n=YQ();return P(n,j(M,{get when(){return e()===null},get fallback(){return j(A$,{get issueId(){return e()},onBack:()=>t(null)})},get children(){return j(O$,{onSelect:e=>t(e)})}})),n})()}function O$(e){let t,n=_r(()=>({queryKey:[`my-issues`],queryFn:uO,refetchInterval:12e3})),r=k(()=>n.data??[]),i=OQ({get count(){return r().length},getScrollElement:()=>t,estimateSize:()=>56,overscan:5});return(()=>{var a=e$(),o=a.firstChild.firstChild.nextSibling;return P(o,j(M,{get when(){return n.dataUpdatedAt>0},get children(){var e=XQ();return e.firstChild,P(e,()=>Nj(n.dataUpdatedAt),null),e}}),null),P(o,j(vj,{class:`size-7 px-0`,get loading(){return n.isFetching},onClick:()=>void n.refetch(),title:`Refresh`,"aria-label":`Refresh issues`,get children(){return ZQ()}}),null),P(a,j(M,{get when(){return n.isError},get children(){var e=QQ();return P(e,j(Aj,{title:`Connect Linear in Settings`,get children(){return n.error?.message??`Unable to load issues.`}})),e}}),null),P(a,j(M,{get when(){return $e(()=>!n.isError&&!n.isPending)()&&r().length===0},get children(){var e=QQ();return P(e,j(Aj,{title:`No issues found`,children:`Issues you create will appear here.`})),e}}),null),P(a,j(M,{get when(){return $e(()=>!n.isError)()&&r().length>0},get children(){var n=$Q(),a=n.firstChild,o=t;return typeof o==`function`?pt(o,n):t=n,P(a,j(We,{get each(){return i.getVirtualItems()},children:t=>{let n=k(()=>r()[t.index]);return(()=>{var r=t$();return P(r,j(k$,{get issue(){return n()},get onSelect(){return e.onSelect}})),D(e=>dt(r,`transform`,`translateY(${t.start}px)`)),r})()}})),D(e=>dt(a,`height`,`${i.getTotalSize()}px`)),n}}),null),a})()}function k$(e){return(()=>{var t=n$(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling,o=a.firstChild;return t.$$click=()=>e.onSelect(e.issue.id),P(n,j(kj,{get color(){return e.issue.state.color}}),r),P(r,()=>e.issue.identifier),P(i,()=>e.issue.title),P(a,j(Oj,{get children(){return e.issue.state.name}}),o),P(a,j(M,{get when(){return e.issue.delegate},get children(){return j(Oj,{class:`text-accent`,get children(){return[j(Cj,{}),` `,$e(()=>e.issue.delegate.displayName)]}})}}),o),P(a,j(M,{get when(){return $e(()=>!!(e.issue.state.type===`started`&&e.issue.delegate))()&&e.issue.attachments?.some(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url))},get children(){return j(Oj,{color:`var(--color-warn)`,children:`needs review`})}}),o),P(o,()=>Nj(e.issue.updatedAt)),t})()}function A$(e){let t=sr(),n=_r(()=>({queryKey:[`issue`,e.issueId],queryFn:()=>dO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),r=_r(()=>({queryKey:[`sessions`,e.issueId],queryFn:()=>fO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),i=_r(()=>({queryKey:[`settings`],queryFn:Cr})),a=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:5e3,retry:0})),o=k(()=>{let e=n.data?.identifier;return e?a.data?.find(t=>t.title.startsWith(e)):void 0}),s=e=>e.status===`running`?{word:`Working…`,cls:`text-accent`}:e.status===`done`?{word:`Finished`,cls:`text-success`}:e.status===`stopped`?{word:`Stopped`,cls:`text-warn`}:{word:`Error`,cls:`text-danger`},[c,l]=T(``),[u,d]=T(null),[f,p]=T(0),m=_r(()=>({queryKey:[`grab`],queryFn:Tr,enabled:ZA()===`composer`})),[h,g]=T(!1),_=async()=>{g(!0);try{let e=await RQ();e&&l(t=>`${t?`${t}\n`:``}${e}\n`)}finally{g(!1)}},v=()=>{p(Date.now()),$A(`composer`),FZ().catch(()=>$A(`capture`))};O(()=>{if(ZA()!==`composer`)return;let e=(m.data??[]).filter(e=>e.grabbedAt>=f());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
|
|
219
|
+
`);l(e=>`${e?`${e}\n`:``}${t}\n`),$A(`capture`)});let y=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,b=k(()=>(n.data?.attachments??[]).map(e=>e.url).filter(e=>y.test(e))),x=_r(()=>({queryKey:[`pr-status`,b().sort().join(`|`)],queryFn:()=>IO(b()),refetchInterval:3e4,retry:0,enabled:b().length>0})),S=e=>E().has(e)?`MERGED`:x.data?.[e],[C,w]=T(null),[E,ee]=T(new Set),[te,A]=T(null),ne=async n=>{A(null),w(n);try{await LO(n),ee(e=>new Set(e).add(n)),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`my-issues`]}),FQ()}catch(e){A(e instanceof Error?`${e.message} (bridge must be running; gh needs merge rights)`:`Merge failed.`)}finally{w(null)}},re=k(()=>n.data?yO(n.data.comments):[]),[ie,ae]=T(`comment`),oe=!1;O(()=>{if(oe||!n.data||!i.data)return;oe=!0;let e=re();e.length?ae(`thread:${e[0].id}`):n.data.delegate&&i.data.cursorAgentId&&ae(`new`)});let se=vr(()=>({mutationFn:async()=>{let t=c().trim();if(!t)throw Error(`Message is empty`);let n=i.data??{},r=ie();r.startsWith(`thread:`)?await _O(e.issueId,t,r.slice(7)):r===`new`&&n.cursorAgentId?await vO(e.issueId,t,{name:n.cursorAgentName,displayName:n.cursorAgentName??`Cursor`,url:n.cursorAgentUrl}):await _O(e.issueId,t)},onSuccess:()=>{l(``),d(null),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),FQ()},onError:e=>{d(e.message??`Failed to send`)}})),ce=k(()=>n.data),le=k(()=>r.data??[]);return(()=>{var t=g$(),r=t.firstChild,a=r.firstChild,d=r.nextSibling,f=d.nextSibling,p=f.firstChild;return P(a,j(vj,{class:`min-w-[68px] shrink-0 text-[11px]`,get onClick(){return e.onBack},get children(){return r$()}}),null),P(a,j(M,{get when(){return ce()},get children(){return[(()=>{var e=i$();return P(e,()=>ce().identifier),e})(),(()=>{var e=a$();return P(e,()=>ce().title),e})()]}}),null),P(a,j(M,{get when(){return $e(()=>!!n.isPending)()&&!ce()},get children(){return o$()}}),null),P(r,j(M,{get when(){return ce()},get children(){var e=s$(),t=e.firstChild;return P(e,j(kj,{get color(){return ce().state.color}}),t),P(t,()=>ce().state.name),P(e,j(Tj,{get href(){return ce().url},class:`ml-auto shrink-0`,children:`Open in Linear`}),null),e}}),null),P(d,j(M,{get when(){return o()},children:e=>{let t=()=>s(e());return(()=>{var n=_$(),r=n.firstChild,i=r.firstChild.firstChild,a=i.nextSibling.nextSibling.nextSibling;a.firstChild;var o=r.nextSibling,s=o.firstChild,c=s.nextSibling;return P(i,j(wj,{size:12})),P(a,()=>Nj(e().startedAt),null),P(r,j(Oj,{get children(){return e().model??`default`}}),null),o.$$click=()=>YA(`local`),P(o,j(M,{get when(){return e().status===`running`},get children(){return j(yj,{size:12})}}),s),P(s,()=>t().word),P(c,(()=>{var t=$e(()=>e().status===`done`);return()=>t()?e().result??e().lastText:e().lastText})()),D(()=>st(s,`shrink-0 text-[11.5px] font-medium ${t().cls}`)),n})()}}),null),P(d,j(M,{get when(){return le().length>0},get children(){var e=c$();return P(e,j(We,{get each(){return le()},children:e=>j(j$,{session:e})})),e}}),null),P(d,j(M,{get when(){return $e(()=>!!ce())()&&ce().attachments.length>0},get children(){var e=l$(),t=e.firstChild.nextSibling;return P(t,j(We,{get each(){return ce().attachments},children:e=>{let t=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url);return(()=>{var n=y$(),r=n.firstChild;return P(r,()=>e.title),P(n,j(M,{get when(){return $e(()=>!!(t&&S(e.url)))()&&S(e.url)!==`OPEN`},get children(){return j(Oj,{get class(){return`ml-auto shrink-0 ${S(e.url)===`MERGED`?`text-success`:`text-text-faint`}`},get children(){return S(e.url)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(n,j(M,{get when(){return t&&(!S(e.url)||S(e.url)===`OPEN`)},get children(){return j(vj,{variant:`primary`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return C()===e.url},get title(){return x.isError?`PR state unknown — restart the bridge (npx linear-grab-bridge) for live merge status`:`Squash-merge this PR via the bridge gh — reviewed the demo? Ship it.`},onClick:()=>void ne(e.url),get children(){return v$()}})}}),null),D(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),n})()}}),null),P(t,j(M,{get when(){return te()},get children(){return j(jj,{get message(){return te()}})}}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!ce())()&&ce().comments.length>0},get children(){var e=u$();return e.firstChild,P(e,j(We,{get each(){return ce().comments},children:e=>(()=>{var t=b$(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling;return P(r,()=>e.user?.displayName??e.user?.name??`Unknown`),P(n,j(M,{get when(){return e.user?.app},get children(){return j(Oj,{children:`agent`})}}),i),P(i,()=>Nj(e.createdAt)),D(()=>a.innerHTML=JQ(e.body)),t})()}),null),e}}),null),P(d,j(M,{get when(){return $e(()=>!!(ce()&&ce().comments.length===0))()&&le().length===0},get children(){return j(Aj,{title:`No activity yet`,children:`Comments and agent sessions will appear here.`})}}),null),P(d,j(M,{get when(){return $e(()=>!!n.isError)()&&!ce()},get children(){return j(Aj,{title:`Failed to load issue`,get children(){return n.error?.message??`Unknown error`}})}}),null),P(f,j(M,{get when(){return u()},get children(){return j(jj,{get message(){return u()}})}}),p),P(f,j(xj,{rows:2,placeholder:`Reply — steer the agent or add context…`,get value(){return c()},onInput:e=>l(e.target.value),get disabled(){return se.isPending}}),p),P(p,j(Sj,{class:`min-w-0 flex-1`,get value(){return ie()},onChange:e=>ae(e.currentTarget.value),get children(){return[j(We,{get each(){return re()},children:(e,t)=>(()=>{var n=x$(),r=n.firstChild.nextSibling;return r.nextSibling,P(n,(()=>{var e=$e(()=>re().length>1);return()=>e()?` #${t()+1}`:``})(),r),P(n,()=>Nj(e.createdAt),null),D(()=>n.selected=ie()===`thread:${e.id}`),D(()=>n.value=`thread:${e.id}`),n})()}),j(M,{get when(){return i.data?.cursorAgentId},get children(){var e=d$(),t=e.firstChild.nextSibling;return t.nextSibling,P(e,()=>i.data?.cursorAgentName??`Cursor`,t),D(()=>e.selected=ie()===`new`),e}}),(()=>{var e=f$();return D(()=>e.selected=ie()===`comment`),e})()]}}),null),P(p,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Pick elements on the page — their source refs drop into this reply`,"aria-label":`Pick element for reply`,onClick:v,get children(){return p$()}}),null),P(p,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return h()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void _(),get children(){return m$()}}),null),P(p,j(vj,{class:`min-w-[52px] shrink-0`,variant:`primary`,get loading(){return se.isPending},get disabled(){return c().trim().length===0},onClick:()=>se.mutate(),get children(){return h$()}}),null),t})()}function j$(e){let t=k(()=>{let t=e.session.status;return/complete|done/i.test(t)?`var(--color-success)`:/await|pending|elicit/i.test(t)?`var(--color-warn)`:`var(--color-accent)`}),n=k(()=>e.session.activities.slice(-10));return(()=>{var r=T$(),i=r.firstChild,a=i.firstChild;return P(i,j(Oj,{get color(){return t()},get children(){return e.session.status}}),a),P(i,j(M,{get when(){return e.session.appUser?.displayName},get children(){var t=S$();return P(t,()=>e.session.appUser.displayName),t}}),a),P(a,()=>Nj(e.session.updatedAt)),P(r,j(M,{get when(){return e.session.summary},get children(){var t=C$();return P(t,()=>e.session.summary),t}}),null),P(r,j(M,{get when(){return n().length>0},get children(){var e=w$();return P(e,j(We,{get each(){return n()},children:e=>{let t=e.content,n=String(t?.body??t?.text??t?.type??JSON.stringify(t)).slice(0,300);return(()=>{var t=E$(),r=t.firstChild,i=r.nextSibling;return P(r,()=>Nj(e.createdAt)),P(i,n),t})()}})),e}}),null),r})()}rt([`click`]),Rr();var M$=N(`<div class="border-accent/40 bg-accent-soft self-end rounded-lg border px-2.5 py-1.5"><p class="text-accent mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase">You</p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),N$=N(`<div><p></p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),P$=N(`<p>`),F$=N(`<span class="text-text-faint max-w-[55%] truncate text-[10.5px] tabular-nums"> running · `),I$=N(`<div class="flex flex-col gap-1.5">`),L$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Local Claude Code</span></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),R$=N(`<span class="bg-surface-2 border-border font-mono mt-2 block rounded-md border px-2 py-1.5 text-[11px] select-all">npx linear-grab-bridge`),z$=N(`<span class="text-text-faint text-[10.5px] tabular-nums">ctx <!> · out `),B$=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),V$=N(`<span class="text-success text-[12px] leading-none">✓`),H$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><path d="M14 10a2 2 0 0 1-2 2H6l-3.5 2.5V4a2 2 0 0 1 2-2H12a2 2 0 0 1 2 2v6Z">`),U$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),W$=N(`<span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),G$=N(`<div class="border-border bg-bg flex flex-col gap-1 rounded-md border p-2"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-dim text-[10.5px] font-semibold tracking-wide uppercase">Changes</span><span class="ml-auto shrink-0 text-[10.5px] tabular-nums"><span class=text-success>+</span> <span class=text-danger>−`),K$=N(`<div class="border-border bg-bg flex max-h-80 flex-col gap-1.5 overflow-y-auto rounded-md border py-2 pl-2 pr-3">`),q$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),J$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),Y$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M8 2v4M8 10v4M2 8h4M10 8h4M4.5 4.5 6 6M11.5 11.5 10 10M11.5 4.5 10 6M4.5 11.5 6 10">`),X$=N(`<span class="inline-block min-w-[4ch] text-center">Send`),Z$=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center gap-1"><span class="text-text-faint min-w-0 flex-1 truncate text-[10.5px]">`),Q$=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text min-w-0 truncate text-[12.5px] font-medium"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><p class="text-text-dim text-[11.5px] leading-snug break-words"></p><div class="flex flex-wrap items-center gap-1.5"></div><div class="flex items-center gap-1">`),$$=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),e1=N(`<div class="flex min-w-0 items-center gap-1.5">`),t1=N(`<option>`),n1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),r1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M2.5 3.5 6 7 2.5 10.5M7.5 12.5h6">`),i1=N(`<span class=text-success>+`),a1=N(`<span class=text-danger>−`),o1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="shrink-0 text-[10px] tabular-nums">`),s1=N(`<span class=text-text-faint>bin`),c1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="text-success shrink-0 text-[10px]">new`),l1=N(`<div class="flex min-w-0 items-center gap-1.5 pt-0.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),u1=N(`<p class="text-text-faint text-[11px]">Waiting for output…`),d1=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}];function f1(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)<(r[e]??0);return!1}var p1=e=>e==null?`–`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e);function m1(){let e=sr(),t=_r(()=>({queryKey:[`bridge-health`],queryFn:EO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:3e3,enabled:!!t.data?.ok})),[r,i]=T(null),a=_r(()=>({queryKey:[`my-issues`],queryFn:uO,staleTime:15e3})),o=e=>{let t=e.title.match(/^([A-Z][A-Z0-9]*-\d+)/)?.[1];return t?a.data?.find(e=>e.identifier===t):void 0},s=_r(()=>({queryKey:[`bridge-task`,r()],queryFn:()=>OO(r()),refetchInterval:1500,enabled:!!r()&&!!t.data?.ok})),c=_r(()=>({queryKey:[`bridge-diff`,r()],queryFn:()=>PO(r()),refetchInterval:6e3,enabled:!!r()&&!!t.data?.ok})),l=()=>{e.invalidateQueries({queryKey:[`bridge-tasks`]}),e.invalidateQueries({queryKey:[`bridge-task`,r()]})},u=vr(()=>({mutationFn:e=>MO(e),onSuccess:l})),[d,f]=T(``),[p,m]=T(!1),[h,g]=T(0),_=_r(()=>({queryKey:[`grab`],queryFn:Tr,enabled:ZA()===`local`})),v=()=>{g(Date.now()),$A(`local`),FZ().catch(()=>$A(`capture`))};O(()=>{if(ZA()!==`local`)return;let e=(_.data??[]).filter(e=>e.grabbedAt>=h());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
|
|
220
|
+
`);f(e=>`${e?`${e}\n`:``}${t}\n`),$A(`capture`)});let y=async()=>{m(!0);try{let e=await RQ();e&&f(t=>`${t?`${t}\n`:``}${e}\n`)}finally{m(!1)}},b=vr(()=>({mutationFn:e=>AO(e.id,e.text),onSuccess:()=>{f(``),l()}})),x=vr(()=>({mutationFn:e=>jO(e.id,e.model),onSuccess:l})),S=vr(()=>({mutationFn:e=>NO(e),onSuccess:l})),C,w=!0,E=()=>{C&&(w=C.scrollTop+C.clientHeight>=C.scrollHeight-48)};O(()=>{let e=s.data?.tail?.length??0;r(),!(!C||!e||!w)&&requestAnimationFrame(()=>{C&&(C.scrollTop=C.scrollHeight)})});let[ee,te]=T(null),A=async e=>{try{await navigator.clipboard.writeText(zO(e)),te(e.id),setTimeout(()=>te(null),1800)}catch{}},ne=e=>e===`running`?`var(--color-accent)`:e===`done`?`var(--color-success)`:e===`stopped`?`var(--color-warn)`:`var(--color-danger)`,re=e=>{let t=e.line.kind,n=k(()=>JQ(e.line.text));return t===`user`?(()=>{var e=M$(),t=e.firstChild.nextSibling;return D(()=>t.innerHTML=n()),e})():t===`assistant`||t===`result`?(()=>{var e=N$(),r=e.firstChild,i=r.nextSibling;return st(e,`bg-surface rounded-lg border px-2.5 py-1.5 ${t===`result`?`border-success/40`:`border-border`}`),st(r,`mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase ${t===`result`?`text-success`:`text-text-faint`}`),P(r,t===`result`?`Result`:`Claude`),D(()=>i.innerHTML=n()),e})():(()=>{var n=P$();return st(n,`font-mono px-1 text-[10px] leading-relaxed break-words ${t===`subagent`?`text-warn`:t===`stderr`?`text-danger`:`text-text-faint`}`),P(n,()=>e.line.text),n})()};return(()=>{var e=L$(),a=e.firstChild;a.firstChild;var l=a.nextSibling;return P(a,j(M,{get when(){return t.data?.ok},get fallback(){return j(Oj,{class:`text-danger`,children:`bridge offline`})},get children(){return[j(M,{get when(){return f1(t.data.version,`0.15.1`)},get children(){return j(Oj,{class:`text-warn`,title:`Ctrl+C the old process, then: npx linear-grab-bridge`,get children(){return[`v`,$e(()=>t.data.version),` outdated — restart`]}})}}),(()=>{var e=F$(),n=e.firstChild;return P(e,()=>t.data.active,n),P(e,()=>t.data.cwd.split(`/`).slice(-2).join(`/`),null),D(()=>it(e,`title`,t.data?.cwd)),e})()]}}),null),P(l,j(M,{get when(){return t.data?.ok},get fallback(){return j(Aj,{title:`Bridge not running`,get children(){return[`Start it in your repo's terminal:`,R$(),`Then delegate from the Draft tab ("Local Claude Code") or watch tasks here. Sessions stay interactive — send follow-ups, switch models, interrupt, resume in your terminal. History persists across restarts.`]}})},get children(){return j(M,{get when(){return(n.data??[]).length>0},get fallback(){return j(Aj,{title:`No local tasks yet`,children:`Create an issue in Draft with "Delegate to → Local Claude Code", and it appears here with live status and a conversation view.`})},get children(){var e=I$();return P(e,j(We,{get each(){return n.data},children:e=>(()=>{var t=Q$(),n=t.firstChild,a=n.firstChild,l=a.nextSibling,m=n.nextSibling,h=m.nextSibling,g=h.nextSibling;return P(n,j(M,{get when(){return e.status===`running`},get fallback(){return(()=>{var t=$$();return D(n=>dt(t,`background`,ne(e.status))),t})()},get children(){return j(yj,{})}}),a),P(a,()=>e.title),P(l,()=>Nj(e.startedAt)),P(m,()=>e.lastText),P(h,j(Oj,{get color(){return ne(e.status)},get children(){return e.status}}),null),P(h,j(Oj,{get children(){return e.model??`default model`}}),null),P(h,j(M,{get when(){return e.pendingModel},get children(){return j(Oj,{class:`text-warn`,get children(){return[`→ `,$e(()=>e.pendingModel),` next msg`]}})}}),null),P(h,j(M,{get when(){return e.subagents>0},get children(){return j(Oj,{class:`text-warn`,get children(){return[`⛓ `,$e(()=>e.subagents),` subagents`]}})}}),null),P(h,j(M,{get when(){return e.usage},get children(){var t=z$(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>p1(e.usage.contextTokens),n),P(t,()=>p1(e.usage.outputTokens),null),P(t,(()=>{var t=$e(()=>!!e.usage.costUsd);return()=>t()?` · $${e.usage.costUsd.toFixed(2)}`:``})(),null),t}}),null),P(t,j(M,{get when(){return o(e)},children:e=>(()=>{var t=e1();return P(t,j(Oj,{get children(){return e().state.name}}),null),P(t,j(Tj,{get href(){return e().url},children:`Open in Linear`}),null),t})()}),g),P(t,j(M,{get when(){return $e(()=>!!e.worktree)()&&!e.worktree.removed},get children(){var t=B$(),n=t.firstChild;return P(t,j(Oj,{class:`text-warn`,children:`⎇ worktree`}),n),P(n,()=>e.worktree.branch),P(t,j(M,{get when(){return e.status!==`running`},get children(){return j(vj,{variant:`ghost`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return S.isPending},get title(){return`Remove the worktree at ${e.worktree.path} — the branch (and PR) survive`},onClick:()=>S.mutate(e.id),children:`Remove`})}}),null),D(()=>it(n,`title`,e.worktree.path)),t}}),g),P(g,j(Sj,{class:`h-7 w-auto min-w-0 flex-1 text-[11px]`,get value(){return e.pendingModel??e.model??``},onChange:t=>x.mutate({id:e.id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return j(We,{each:d1,children:t=>(()=>{var n=t1();return P(n,()=>t.label),D(()=>n.selected=(e.pendingModel??e.model??``)===t.id),D(()=>n.value=t.id),n})()})}}),null),P(g,j(M,{get when(){return o(e)},children:e=>j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,onClick:()=>YA(`activity`,e().id),get children(){return n1()}})}),null),P(g,j(vj,{variant:`ghost`,class:`size-7 px-0`,get disabled(){return!e.sessionId},get title(){return $e(()=>!!e.sessionId)()?`Copy resume command · session ${e.sessionId.slice(0,8)}…`:`No session yet`},onClick:()=>void A(e),get children(){return j(M,{get when(){return ee()===e.id},get fallback(){return r1()},get children(){return V$()}})}}),null),P(g,j(vj,{variant:`ghost`,class:`size-7 px-0`,get title(){return r()===e.id?`Hide thread`:`Open thread — chat & changes`},onClick:()=>i(r()===e.id?null:e.id),get children(){return H$()}}),null),P(g,j(M,{get when(){return e.status===`running`},get children(){return j(vj,{variant:`danger`,class:`size-7 px-0`,get loading(){return u.isPending},title:`Interrupt — the session stays resumable`,onClick:()=>u.mutate(e.id),get children(){return U$()}})}}),null),P(t,j(M,{get when(){return r()===e.id},get children(){return[j(M,{get when(){return $e(()=>!!c.data)()&&(c.data.files.length||c.data.untracked.length||c.data.prs.length)},get children(){var e=G$(),t=e.firstChild,n=t.firstChild.nextSibling,r=n.firstChild;r.firstChild;var i=r.nextSibling.nextSibling;return i.firstChild,P(t,j(M,{get when(){return c.data.branch},get children(){var e=W$();return P(e,()=>c.data.branch),e}}),n),P(r,()=>c.data.totalAdded,null),P(i,()=>c.data.totalDeleted,null),P(e,j(We,{get each(){return c.data.files},children:e=>(()=>{var t=o1(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.path),P(r,j(M,{get when(){return!e.binary},get fallback(){return s1()},get children(){return[(()=>{var t=i1();return t.firstChild,P(t,()=>e.added,null),t})(),` `,(()=>{var t=a1();return t.firstChild,P(t,()=>e.deleted,null),t})()]}})),D(()=>it(n,`title`,e.path)),t})()}),null),P(e,j(We,{get each(){return c.data.untracked},children:e=>(()=>{var t=c1(),n=t.firstChild;return it(n,`title`,e),P(n,e),t})()}),null),P(e,j(We,{get each(){return c.data.prs},children:e=>(()=>{var t=l1(),n=t.firstChild;return P(t,j(Oj,{class:`text-accent`,get children(){return[`PR · `,$e(()=>e.state.toLowerCase())]}}),n),P(n,()=>e.title),D(t=>{var r=e.url,i=e.title;return r!==t.e&&it(n,`href`,t.e=r),i!==t.t&&it(n,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),(()=>{var e=K$();return e.addEventListener(`scroll`,E),pt(e=>{C=e,w=!0},e),P(e,j(M,{get when(){return(s.data?.tail??[]).length>0},get fallback(){return u1()},get children(){return j(Ge,{get each(){return s.data?.tail??[]},children:e=>j(re,{get line(){return e()}})})}})),e})(),(()=>{var t=Z$(),n=t.firstChild,r=n.firstChild;return P(t,j(xj,{rows:2,get placeholder(){return e.status===`running`?`Message the working agent — it queues into the live session…`:`Follow-up — resumes the session…`},get value(){return d()},onInput:e=>f(e.currentTarget.value)}),n),P(r,(()=>{var t=$e(()=>!!e.alive);return()=>t()?`live session`:e.sessionId?`resumes on send`:`no session`})()),P(n,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Pick elements on the page — refs drop into this message`,"aria-label":`Pick element`,onClick:v,get children(){return q$()}}),null),P(n,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return p()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void y(),get children(){return J$()}}),null),P(n,j(vj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get disabled(){return $e(()=>!e.alive)()&&!e.sessionId},title:`Compact the session — frees context (sends /compact)`,"aria-label":`Compact session`,onClick:()=>b.mutate({id:e.id,text:`/compact`}),get children(){return Y$()}}),null),P(n,j(vj,{variant:`primary`,class:`shrink-0`,get loading(){return b.isPending},get disabled(){return!d().trim()||!e.alive&&!e.sessionId},onClick:()=>b.mutate({id:e.id,text:d().trim()}),get children(){return X$()}}),null),t})()]}}),null),t})()})),e}})}})),e})()}var h1=N(`<span class="text-text-faint text-[10.5px] tabular-nums">/<!> from your issues`),g1=N(`<div class="flex flex-col gap-1.5">`),_1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Pull requests</span></div><div class="border-border flex shrink-0 items-center gap-1.5 border-b px-3 py-1.5"><div class="bg-surface-2 border-border flex shrink-0 rounded-md border p-0.5"></div></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),v1=N(`<span class="text-warn text-[10.5px]"title="Merge states come from gh via the bridge">states unknown — restart the bridge`),y1=N(`<button>`),b1=N(`<span class="text-[12px] leading-none">✓`),x1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),S1=N(`<span class="text-success text-[12px] leading-none">✓`),C1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><a target=_blank rel=noreferrer class="text-accent truncate text-[12.5px] font-medium hover:underline"></a><div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim shrink-0 text-[11px]"></span><span class="text-text-dim truncate text-[11.5px]"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 flex-wrap items-center gap-1.5"><div class="ml-auto flex shrink-0 items-center gap-1">`),w1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=4 cy=3.5 r=1.5></circle><circle cx=4 cy=12.5 r=1.5></circle><circle cx=12 cy=8 r=1.5></circle><path d="M4 5v6M4 6.5c0 2 2 3 4.5 3h2">`),T1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),E1=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i;function D1(e){let t=_r(()=>({queryKey:[`my-issues`],queryFn:uO,refetchInterval:15e3})),n=k(()=>(t.data??[]).flatMap(e=>(e.attachments??[]).filter(e=>E1.test(e.url)).map(t=>({issue:e,attachment:t})))),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:DO,refetchInterval:1e4,retry:0})),i=_r(()=>({queryKey:[`pr-status`,n().map(e=>e.attachment.url).sort().join(`|`)],queryFn:()=>IO(n().map(e=>e.attachment.url)),refetchInterval:3e4,retry:0,enabled:n().length>0})),a=e=>g().has(e.attachment.url)?`MERGED`:i.data?.[e.attachment.url],o=e=>!!r.data?.some(t=>t.title.startsWith(e.issue.identifier)),[s,c]=T(`all`),[l,u]=T(``),d=k(()=>{let e=l().trim().toLowerCase();return n().filter(t=>{let n=t.issue.state.type;return!(s()===`review`&&n!==`started`||s()===`open`&&!(n===`started`||n===`unstarted`||n===`backlog`)||s()===`done`&&n!==`completed`||e&&![t.attachment.title,t.issue.title,t.issue.identifier].join(` `).toLowerCase().includes(e))})}),[f,p]=T(null),[m,h]=T(null),[g,_]=T(new Set),v=async e=>{h(e);try{await LO(e),_(t=>new Set(t).add(e))}catch{}finally{h(null)}},y=async e=>{try{await navigator.clipboard.writeText(e.attachment.url),p(e.attachment.id),setTimeout(()=>p(null),1500)}catch{}};return(()=>{var r=_1(),p=r.firstChild;p.firstChild;var h=p.nextSibling,_=h.firstChild,b=h.nextSibling;return P(p,j(M,{get when(){return!i.isError},get fallback(){return v1()},get children(){var e=h1(),t=e.firstChild,r=t.nextSibling;return r.nextSibling,P(e,()=>d().length,t),P(e,()=>n().length,r),e}}),null),P(_,j(We,{each:[{id:`all`,label:`All`},{id:`review`,label:`Review`},{id:`open`,label:`Open`},{id:`done`,label:`Done`}],children:e=>(()=>{var t=y1();return t.$$click=()=>c(e.id),P(t,()=>e.label),D(()=>st(t,`rounded-[5px] px-2 py-0.5 text-[11px] font-medium transition-colors ${s()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),P(h,j(bj,{class:`h-6 min-w-0 flex-1 text-[11px]`,placeholder:`Search PRs…`,get value(){return l()},onInput:e=>u(e.currentTarget.value)}),null),P(b,j(M,{get when(){return d().length>0},get fallback(){return j(Aj,{title:`No PRs yet`,get children(){return $e(()=>!!t.isError)()?`Connect Linear in Settings.`:n().length>0?`No PRs match the current filter.`:`PRs opened by delegated agents appear here as soon as they link back to your issues.`}})},get children(){var t=g1();return P(t,j(We,{get each(){return d()},children:t=>(()=>{var n=C1(),r=n.firstChild,i=r.nextSibling,s=i.firstChild,c=s.nextSibling,l=c.nextSibling,u=i.nextSibling,d=u.firstChild;return P(r,()=>t.attachment.title||t.attachment.url),P(i,j(kj,{get color(){return t.issue.state.color}}),s),P(s,()=>t.issue.identifier),P(c,()=>t.issue.title),P(l,()=>Nj(t.issue.updatedAt)),P(u,j(Oj,{get children(){return t.issue.state.name}}),d),P(u,j(M,{get when(){return t.issue.delegate},get children(){return j(Oj,{class:`text-accent`,get children(){return[j(Cj,{}),` `,$e(()=>t.issue.delegate.displayName)]}})}}),d),P(u,j(M,{get when(){return o(t)},get children(){return j(Oj,{class:`text-warn`,get children(){return[j(wj,{}),` local`]}})}}),d),P(u,j(Tj,{get href(){return t.issue.url},class:`shrink-0`,title:`Open the issue in Linear`,children:`Linear`}),d),P(d,j(M,{get when(){return $e(()=>!!a(t))()&&a(t)!==`OPEN`},get children(){return j(Oj,{get class(){return a(t)===`MERGED`?`text-success`:`text-text-faint`},get children(){return a(t)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(d,j(vj,{variant:`primary`,class:`size-7 px-0`,get classList(){return{hidden:!!a(t)&&a(t)!==`OPEN`}},get loading(){return m()===t.attachment.url},get disabled(){return g().has(t.attachment.url)},get title(){return g().has(t.attachment.url)?`Merged`:`Squash-merge this PR (bridge gh)`},"aria-label":`Merge PR`,onClick:()=>void v(t.attachment.url),get children(){return j(M,{get when(){return g().has(t.attachment.url)},get fallback(){return w1()},get children(){return b1()}})}}),null),P(d,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,"aria-label":`Open issue activity`,onClick:()=>{YA(`activity`,t.issue.id),e.onOpenIssue()},get children(){return x1()}}),null),P(d,j(vj,{variant:`ghost`,class:`size-7 px-0`,title:`Copy PR URL`,"aria-label":`Copy PR URL`,onClick:()=>void y(t),get children(){return j(M,{get when(){return f()===t.attachment.id},get fallback(){return T1()},get children(){return S1()}})}}),null),D(e=>{var n=t.attachment.url,i=t.attachment.title;return n!==e.e&&it(r,`href`,e.e=n),i!==e.t&&it(r,`title`,e.t=i),e},{e:void 0,t:void 0}),n})()})),t}})),r})()}rt([`click`]),Rr();function O1(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function k1(e){let t=O1(crypto.getRandomValues(new Uint8Array(32))),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t)),r=O1(new Uint8Array(n)),i=O1(crypto.getRandomValues(new Uint8Array(16))),a=chrome.identity.getRedirectURL(),o=new URL(`https://linear.app/oauth/authorize`);o.searchParams.set(`client_id`,e),o.searchParams.set(`redirect_uri`,a),o.searchParams.set(`response_type`,`code`),o.searchParams.set(`scope`,`read,write`),o.searchParams.set(`state`,i),o.searchParams.set(`code_challenge`,r),o.searchParams.set(`code_challenge_method`,`S256`);let s=await chrome.identity.launchWebAuthFlow({url:o.toString(),interactive:!0});if(!s)throw Error(`OAuth flow was cancelled`);let c=new URL(s).searchParams;if(c.get(`state`)!==i)throw Error(`OAuth state mismatch`);let l=c.get(`code`);if(!l)throw Error(c.get(`error_description`)??`No authorization code returned`);let u=await fetch(`https://api.linear.app/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,code:l,redirect_uri:a,client_id:e,code_verifier:t})}),d=await u.json().catch(()=>null);if(!u.ok||!d?.access_token)throw Error(`Token exchange failed — check the OAuth app callback URL and client id`);await wr({linearAccessToken:d.access_token,linearOauthClientId:e})}async function A1(){await wr({linearAccessToken:void 0,linearApiKey:void 0})}Rr(),br(),Nx(),mD();var j1=N(`<div class="bg-surface-2 border-border flex rounded-md border p-0.5">`),M1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Cloud: picking an element opens the panel to draft & delegate to the Cursor agent. Local (react-grab style): picking auto-copies the element's context — source, stack, and your skills/memory paths — straight to the clipboard for a local Claude Code or Cursor session; the panel stays out of the way. Both share the same picker; switch anytime.`),N1=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Element screenshots`),P1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Captures a highlighted screenshot of each picked element and attaches it to the issue. Costs a beat on huge pages — with this off, picking is instant (pure react-grab speed).`),F1=N(`<span class=text-text>Connected as <span class=font-medium></span> · <span class=text-text-dim>`),I1=N(`<div class="bg-surface border-border flex items-center justify-between rounded-lg border p-2.5"><span class="text-text text-[12px]">`),L1=N(`<option value>Select a team…`),R1=N(`<p class="text-text-dim text-[11px]">No agents found — install the Cursor integration in Linear first.`),z1=N(`<span class="text-text-faint text-[10.5px] leading-snug">Empty = the default above (computer-use testing, video demo, PR + review babysitting).`),B1=N(`<div class="flex flex-col gap-1.5">`),V1=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Mode</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">Beside page squeezes the app next to the panel, DevTools-style — nothing gets covered. Also toggleable from the dock icon in the panel header.`),H1=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Dock side</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">The launcher pill is draggable — park it anywhere it doesn't cover your app.`),U1=N(`<option value>Select a channel…`),W1=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Announce new issues on create`),G1=N(`<span class="text-text-faint text-[10.5px] leading-snug">⚠️ Tokens are embedded in issue Agent-instructions so agents can post the finished demo — everyone who can read the issue can read them. Use single-channel-scoped bots.`),K1=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Provider preference</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"><button>Auto</button><button>OpenAI</button><button>Anthropic`),q1=N(`<p class="text-text-dim text-[11px]">`),J1=N(`<div class=min-h-[2lh]>`),Y1=N(`<ol class="text-text-faint flex list-decimal flex-col gap-1 pl-4 text-[11px] leading-relaxed"><li>Pick an element on your running dev app.</li><li>Draft the issue (AI optional).</li><li>Create + delegate — Cursor's cloud agent fixes it and opens a PR.</li><li>Track and steer it from Activity.`),X1=N(`<div class="flex h-full flex-col gap-5 overflow-y-auto pt-3 pb-6 pl-3 pr-4">`),Z1=N(`<button>`),Q1=N(`<div class="flex gap-1.5">`),$1=N(`<p class="text-text-faint text-center text-[10.5px]">or`),e0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Register this callback URL in your Linear OAuth app config:<br><span class="font-mono text-[10.5px] break-all">`),t0=N(`<div class="flex flex-col gap-3">`),n0=N(`<span class=text-text-dim>Connected — verifying…`),r0=N(`<option> (<!>)`),i0=N(`<option value>Select the agent…`),a0=N(`<option>`),o0=N(`<option>#`),s0=N(`<p class="text-text-dim text-[11px]">No key set — AI drafting disabled, manual drafting still works.`);function c0(){let e=sr(),t=_r(()=>({queryKey:[`settings`],queryFn:Cr,staleTime:0})),n=k(()=>t.data??{});async function r(t,n=!1){await wr(t),await e.invalidateQueries({queryKey:[`settings`]}),n&&(await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]}))}let i=k(()=>!!(n().linearApiKey||n().linearAccessToken)),a=_r(()=>({queryKey:[`viewer`],queryFn:sO,enabled:i(),retry:0})),o=_r(()=>({queryKey:[`teams`],queryFn:cO,enabled:i()})),s=_r(()=>({queryKey:[`agents`],queryFn:lO,enabled:i()})),[c,l]=T(``),[u,d]=T(!1),[f,p]=T(``);async function m(){let e=c().trim();if(e){d(!0),p(``);try{await r({linearApiKey:e},!0),await sO(),l(``)}catch{p(`Key rejected — could not verify. Check the key and try again.`),await r({linearApiKey:void 0},!0)}finally{d(!1)}}}let[h,g]=T(``),[_,v]=T(!1),[y,b]=T(``);async function x(){let t=(h()||n().linearOauthClientId||``).trim();if(!t){b(`Enter an OAuth client ID first.`);return}v(!0),b(``);try{await k1(t),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}catch(e){b(e instanceof Error?e.message:`OAuth flow failed.`)}finally{v(!1)}}let[S,C]=T(!1);async function w(){C(!0);try{await A1(),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}finally{C(!1)}}let E=yr?chrome.identity.getRedirectURL():null,O=_r(()=>({queryKey:[`slack-channels`,n().slackToken],queryFn:()=>WO(n().slackToken),enabled:!!n().slackToken,retry:0,staleTime:6e4})),ee=k(()=>Ox(n())),te=k(()=>{let e=ee();return e?`Drafting with ${e} — ${jx[e].fast} (fast) / ${jx[e].best} (best)`:null});return(()=>{var e=X1();return P(e,j(Dj,{title:`Workflow`,get children(){return[(()=>{var e=j1();return P(e,j(We,{each:[{id:`cloud`,label:`Cloud · Linear + Cursor`},{id:`local`,label:`Local · clipboard`}],children:e=>(()=>{var t=Z1();return t.$$click=()=>void r({workflowMode:e.id}),P(t,()=>e.label),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-1 text-[11.5px] font-medium transition-colors ${(n().workflowMode??`cloud`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),M1()]}}),null),P(e,j(Dj,{title:`Capture`,get children(){return[(()=>{var e=N1(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({captureShots:e.currentTarget.checked||void 0})),D(()=>t.checked=!!n().captureShots),e})(),P1()]}}),null),P(e,j(Dj,{title:`Linear`,get children(){return j(M,{get when(){return i()},get fallback(){return(()=>{var e=t0();return P(e,j(Ej,{label:`Personal API key`,hint:`Create one at linear.app → Settings → API — fastest path.`,get children(){return[(()=>{var e=Q1();return P(e,j(bj,{type:`password`,placeholder:`lin_api_…`,get value(){return c()},onInput:e=>l(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&m()}}),null),P(e,j(vj,{variant:`primary`,get loading(){return u()},get disabled(){return!c().trim()},onClick:()=>void m(),class:`shrink-0`,children:`Connect`}),null),e})(),j(M,{get when(){return f()},get children(){return j(jj,{get message(){return f()}})}})]}}),null),P(e,j(M,{when:yr,get children(){return[$1(),j(Ej,{label:`OAuth client ID`,get children(){return[(()=>{var e=Q1();return P(e,j(bj,{placeholder:`your-client-id`,get value(){return h()||n().linearOauthClientId||``},onInput:e=>g(e.currentTarget.value)}),null),P(e,j(vj,{variant:`ghost`,get loading(){return _()},onClick:()=>void x(),class:`shrink-0 whitespace-nowrap`,children:`Connect with OAuth`}),null),e})(),j(M,{get when(){return y()},get children(){return j(jj,{get message(){return y()}})}}),(()=>{var e=e0(),t=e.firstChild.nextSibling.nextSibling;return P(t,E),e})()]}})]}}),null),e})()},get children(){var e=I1(),t=e.firstChild;return P(t,j(M,{get when(){return!a.isLoading},get fallback(){return n0()},get children(){return j(M,{get when(){return a.data},get fallback(){return j(M,{get when(){return a.isError},get fallback(){return n0()},get children(){return j(jj,{message:`Key rejected — reconnect`})}})},get children(){var e=F1(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return P(t,()=>a.data.name),P(n,()=>a.data.email),e}})}})),P(e,j(vj,{variant:`ghost`,get loading(){return S()},onClick:()=>void w(),class:`ml-2 shrink-0`,children:`Disconnect`}),null),e}})}}),null),P(e,j(M,{get when(){return i()},get children(){return j(Dj,{title:`Workspace`,get children(){return[j(Ej,{label:`Default team`,get children(){return j(Sj,{get value(){return n().defaultTeamId??``},onChange:e=>{let t=e.currentTarget.value;r({defaultTeamId:t||void 0})},get disabled(){return o.isLoading},get children(){return[L1(),j(M,{get when(){return o.data},get children(){return j(We,{get each(){return o.data},children:e=>(()=>{var t=r0(),r=t.firstChild,i=r.nextSibling;return i.nextSibling,P(t,()=>e.name,r),P(t,()=>e.key,i),D(()=>t.selected=e.id===n().defaultTeamId),D(()=>t.value=e.id),t})()})}})]}})}}),j(Ej,{label:`Cursor agent`,hint:`App users in your workspace. Pick Cursor — requires the Cursor integration installed in Linear (workspace admin) with usage-based pricing enabled in Cursor.`,get children(){return j(M,{get when(){return $e(()=>!!s.data)()&&s.data.length===0},get fallback(){return j(Sj,{get value(){return n().cursorAgentId??``},onChange:e=>{let t=e.currentTarget.value;if(!t){r({cursorAgentId:void 0,cursorAgentName:void 0,cursorAgentUrl:void 0});return}let n=s.data?.find(e=>e.id===t);n&&r({cursorAgentId:n.id,cursorAgentName:n.displayName,cursorAgentUrl:n.url??void 0})},get disabled(){return s.isLoading},get children(){return[i0(),j(M,{get when(){return s.data},get children(){return j(We,{get each(){return s.data},children:e=>(()=>{var t=a0();return P(t,()=>e.displayName),D(()=>t.selected=e.id===n().cursorAgentId),D(()=>t.value=e.id),t})()})}})]}})},get children(){return R1()}})}}),j(Ej,{label:`Default repository`,hint:`Appended to delegated issues as [repo=…] so Cursor picks the right repo.`,get children(){return j(bj,{placeholder:`owner/repository`,get value(){return n().defaultRepo??``},onBlur:e=>{r({defaultRepo:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Cursor cloud model`,hint:`Appended as [model=…] — e.g. claude-opus-4-8, gpt-5.2, composer. Empty = Cursor's default.`,get children(){return j(bj,{placeholder:`Cursor's default`,get value(){return n().cursorModel??``},onBlur:e=>{r({cursorModel:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Agent instructions`,hint:`Appended to every issue as '### Agent instructions' and given to the AI draft. Add demo credentials (username/password) so the agent can log in, test, and record its video. Careful: credentials become visible to everyone who can read the issue.`,get children(){return[j(xj,{rows:5,placeholder:pD,get value(){return n().issueTemplate??``},onBlur:e=>{r({issueTemplate:e.currentTarget.value.trim()||void 0})}}),z1()]}}),j(Ej,{label:`Dev server log URL`,hint:`Tail of your dev-server log attached to issues (and fed to AI drafts). Serve the log over HTTP: "dev:http": "next dev 2>&1 | tee public/dev-server.log" (gitignore it), then use /dev-server.log here. Empty = disabled.`,get children(){return j(bj,{placeholder:`/dev-server.log`,get value(){return n().logUrl??``},onBlur:e=>{r({logUrl:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Log lines to attach`,hint:`Trailing lines included in the issue (10–500).`,get children(){return j(bj,{type:`number`,min:`10`,max:`500`,placeholder:`100`,get value(){return n().logLines??``},onBlur:e=>{let t=Number(e.currentTarget.value);r({logLines:Number.isFinite(t)&&t>0?Math.min(500,Math.max(10,Math.round(t))):void 0})}})}}),j(Ej,{label:`Skills & memory paths`,hint:`One path per line. The cloud agent works in a full repo checkout, so committed paths (e.g. .claude/skills/apple-hig-design-principles) are readable directly — every issue gets a MANDATORY-reading section pointing at them. Repo-relative for cloud agents; absolute paths also work when you paste the issue into a local Claude Code session. Per project: these settings live per dev origin.`,get children(){return j(xj,{rows:4,placeholder:`.claude/skills/apple-hig-design-principles
|
|
221
221
|
.claude/CLAUDE.md
|
|
222
|
-
docs/design-tokens.md`,get value(){return n().skillPaths??``},onBlur:e=>{r({skillPaths:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Test account`,hint:`The cloud agent logs into the app with this while testing and recording its demo. Added to every issue's Agent instructions. Use a throwaway account — it's visible to everyone who can read the issue.`,get children(){var e=L1();return P(e,j(bj,{placeholder:`Username or email (e.g. demo@yourapp.com)`,get value(){return n().testUsername??``},onBlur:e=>{r({testUsername:e.currentTarget.value.trim()||void 0})}}),null),P(e,j(bj,{type:`password`,placeholder:`Password`,get value(){return n().testPassword??``},onBlur:e=>{r({testPassword:e.currentTarget.value.trim()||void 0})}}),null),e}})]}})}}),null),P(e,j(M,{when:!yr,get children(){return j(Dj,{title:`Panel`,get children(){return[(()=>{var e=R1(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[{id:`overlay`,label:`Overlay`},{id:`pinned`,label:`Beside page`}],children:e=>(()=>{var t=J1();return t.$$click=()=>void r({panelMode:e.id,panelPos:void 0}),P(t,()=>e.label),E(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelMode??`overlay`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),(()=>{var e=z1(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[`left`,`right`],children:e=>(()=>{var t=J1();return t.$$click=()=>void r({panelSide:e}),P(t,e===`left`?`Left`:`Right`),E(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelSide??`right`)===e?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})()]}})}}),null),P(e,j(Dj,{title:`Local Claude Code`,get children(){return j(Ej,{label:`Bridge URL`,hint:'Run `npx linear-grab-bridge` in your repo\'s terminal (binds localhost only). Enables "Delegate to → Local Claude Code" in Draft, the Local tab, and relays blocked uploads to Linear storage.',get children(){return j(bj,{placeholder:`http://localhost:4577`,get value(){return n().bridgeUrl??``},onBlur:e=>{r({bridgeUrl:e.currentTarget.value.trim()||void 0})}})}})}}),null),P(e,j(Dj,{title:`Asset uploads`,get children(){return[j(Ej,{label:`GitHub token`,hint:`Linear's storage blocks browser uploads in some browsers (Safari). With this set, GIFs/screenshots upload to your GitHub repo instead and embed automatically. Fine-grained PAT with Contents read/write on the assets repo.`,get children(){return j(bj,{type:`password`,placeholder:`github_pat_…`,get value(){return n().githubToken??``},onBlur:e=>{r({githubToken:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Assets repository`,hint:`owner/repo — must be PUBLIC so Linear (and agents) can render the images. Files land under linear-grab/.`,get children(){return j(bj,{placeholder:`ahmedbanihanibh/linear-grab-assets`,get value(){return n().githubAssetsRepo??``},onBlur:e=>{r({githubAssetsRepo:e.currentTarget.value.trim()||void 0})}})}})]}}),null),P(e,j(Dj,{title:`Notifications`,get children(){return[j(Ej,{label:`Slack bot token`,hint:`Bot token (xoxb-…) with chat:write + channels:read + files:write. New issues get announced with links + demo, and the AGENT receives the token to post its finished demo video itself.`,get children(){return j(bj,{type:`password`,placeholder:`xoxb-…`,get value(){return n().slackToken??``},onBlur:e=>{r({slackToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().slackToken},get children(){return j(Ej,{label:`Slack channel`,get children(){return j(M,{get when(){return!D.isError},get fallback(){return j(jj,{message:`Couldn't list channels — check the token scopes (channels:read).`})},get children(){return j(Sj,{get value(){return n().slackChannelId??``},get disabled(){return D.isLoading},onChange:e=>{let t=e.currentTarget.value,n=D.data?.find(e=>e.id===t);r({slackChannelId:t||void 0,slackChannelName:n?.name})},get children(){return[B1(),j(We,{get each(){return D.data??[]},children:e=>(()=>{var t=r0();return t.firstChild,P(t,()=>e.name,null),E(()=>t.selected=e.id===n().slackChannelId),E(()=>t.value=e.id),t})()})]}})}})}})}}),j(Ej,{label:`Telegram bot token`,hint:`From @BotFather. The agent also receives it to send the demo video (sendVideo).`,get children(){return j(bj,{type:`password`,placeholder:`123456:ABC-…`,get value(){return n().telegramToken??``},onBlur:e=>{r({telegramToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().telegramToken},get children(){return j(Ej,{label:`Telegram chat ID`,hint:`Add the bot to your group/channel, send a message, then read the chat id from api.telegram.org/bot<token>/getUpdates.`,get children(){return j(bj,{placeholder:`-1001234567890`,get value(){return n().telegramChatId??``},onBlur:e=>{r({telegramChatId:e.currentTarget.value.trim()||void 0})}})}})}}),(()=>{var e=V1(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({notifyOnCreate:e.currentTarget.checked?void 0:!1})),E(()=>t.checked=n().notifyOnCreate!==!1),e})(),H1()]}}),null),P(e,j(Dj,{title:`AI providers`,get children(){return[j(Ej,{label:`OpenAI API key`,get children(){return j(bj,{type:`password`,placeholder:`sk-…`,get value(){return n().openaiKey??``},onBlur:e=>{r({openaiKey:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Anthropic API key`,get children(){return j(bj,{type:`password`,placeholder:`sk-ant-…`,get value(){return n().anthropicKey??``},onBlur:e=>{r({anthropicKey:e.currentTarget.value.trim()||void 0})}})}}),(()=>{var e=U1(),t=e.firstChild.nextSibling.firstChild,i=t.nextSibling,a=i.nextSibling;return t.$$click=()=>void r({preferredProvider:void 0}),i.$$click=()=>void r({preferredProvider:`openai`}),a.$$click=()=>void r({preferredProvider:`anthropic`}),E(e=>{var r=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${n().preferredProvider===void 0?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`,o=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`openai`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,s=!n().openaiKey,c=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`anthropic`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,l=!n().anthropicKey;return r!==e.e&&st(t,e.e=r),o!==e.t&&st(i,e.t=o),s!==e.a&&(i.disabled=e.a=s),c!==e.o&&st(a,e.o=c),l!==e.i&&(a.disabled=e.i=l),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e})(),(()=>{var e=G1();return P(e,j(M,{get when(){return k()},get fallback(){return i0()},get children(){var e=W1();return P(e,k),e}})),e})()]}}),null),P(e,j(Dj,{title:`How it works`,get children(){return K1()}}),null),e})()}rt([`click`]);var o0=`linear-grab`,s0=`queries`,c0=[`my-issues`,`issue`,`sessions`,`teams`,`agents`];function l0(){return new Promise(e=>{try{let t=indexedDB.open(o0,1);t.onupgradeneeded=()=>t.result.createObjectStore(s0),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}function u0(e){return typeof e[0]==`string`&&c0.includes(e[0])}async function d0(e){let t=await l0();if(!t)return()=>{};await new Promise(n=>{try{let r=t.transaction(s0,`readonly`).objectStore(s0).openCursor();r.onsuccess=()=>{let t=r.result;if(!t)return n();try{let{queryKey:n,data:r}=t.value;u0(n)&&e.getQueryData(n)===void 0&&e.setQueryData(n,r,{updatedAt:0})}catch{}t.continue()},r.onerror=()=>n()}catch{n()}});let n=new Map,r=e.getQueryCache().subscribe(r=>{if(r.type!==`updated`||r.action.type!==`success`)return;let{queryKey:i,queryHash:a}=r.query;if(!u0(i))return;let o=n.get(a);o&&clearTimeout(o),n.set(a,setTimeout(()=>{n.delete(a);try{let n=e.getQueryData(i);if(n===void 0)return;t.transaction(s0,`readwrite`).objectStore(s0).put({queryKey:i,data:n},a)}catch{}},400))});return()=>{r();for(let e of n.values())clearTimeout(e);t.close()}}Rr();var f0=N(`<svg viewBox="0 0 100 100"fill=currentColor aria-hidden><path d="M1.22541 61.5228c-.2225-.9485.90748-1.5459 1.59638-.857L39.3342 97.1782c.6889.6889.0915 1.8189-.857 1.5964C20.0515 94.4522 5.54779 79.9485 1.22541 61.5228ZM.00189135 46.8891c-.01764375.2833.08887215.5599.28957165.7606L52.3503 99.7085c.2007.2007.4773.3075.7606.2896 2.3692-.1476 4.6938-.46 6.9624-.9259.7645-.157 1.0301-1.0963.4782-1.6481L2.57595 39.4485c-.55186-.5519-1.49117-.2863-1.648174.4782-.465915 2.2686-.77832 4.5932-.92588465 6.9624ZM4.21093 29.7054c-.16649.3738-.08169.8106.20765 1.1l64.77602 64.776c.2894.2894.7262.3742 1.1.2077 1.7861-.7956 3.5171-1.6927 5.1855-2.684.5521-.328.6373-1.0867.1832-1.5407L8.43566 24.3367c-.45409-.4541-1.21271-.3689-1.54074.1832-.99132 1.6684-1.88843 3.3994-2.68399 5.1855ZM12.6587 18.074c-.3701-.3701-.393-.9637-.0443-1.3541C21.7795 6.45931 35.1114 0 49.9519 0 77.5927 0 100 22.4073 100 50.0481c0 14.8405-6.4593 28.1724-16.7199 37.3375-.3903.3487-.984.3258-1.3541-.0443L12.6587 18.074Z">`),p0=N(`<button><svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><rect x=1.5 y=2.5 width=13 height=11 rx=1.5></rect><path d="M10 2.5v11">`),m0=N(`<button aria-label="Minimize to launcher"title="Minimize to launcher"class="text-text-dim hover:text-text hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md text-[15px] leading-none transition-colors">–`),h0=N(`<div class="bg-bg text-text flex h-full flex-col"><header><span class="text-accent mr-0.5 inline-flex shrink-0"title="Linear Grab"></span><div class="no-scrollbar flex min-w-0 flex-1 items-center gap-1 overflow-x-auto"></div></header><main class="min-h-0 flex-1"><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full>`),g0=N(`<button>`),_0=[{id:`draft`,label:`Draft`},{id:`capture`,label:`Capture`},{id:`activity`,label:`Activity`},{id:`local`,label:`Local`},{id:`prs`,label:`PRs`},{id:`settings`,label:`Settings`}],v0=new gr({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});function y0(e){return(()=>{var t=f0();return E(n=>{var r=e.size??14,i=e.size??14;return r!==n.e&&it(t,`width`,n.e=r),i!==n.t&&it(t,`height`,n.t=i),n},{e:void 0,t:void 0}),t})()}function b0(e){let[t,n]=T(`draft`),r=()=>{v0.invalidateQueries({queryKey:[`grab`]}),ZA()===`capture`&&n(`capture`),e.onGrab?.()};return D(()=>{let e=GA();e&&n(e)}),ie(()=>{let e=d0(v0),t=IZ(r),n=()=>{RO().then(GQ),FO()};n();let i=Ar(e=>{e===`settings`&&(v0.invalidateQueries({queryKey:[`settings`]}),n()),e===`grab`&&r()});ae(()=>{t(),i(),e.then(e=>e())})}),j(cr,{client:v0,get children(){var r=h0(),i=r.firstChild,a=i.firstChild,o=a.nextSibling,s=i.nextSibling.firstChild,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,d=u.nextSibling,f=d.nextSibling;return i.$$pointerdown=t=>e.onHeaderPointerDown?.(t),P(a,j(y0,{size:14})),P(o,j(We,{each:_0,children:e=>(()=>{var r=g0();return r.$$click=()=>n(e.id),P(r,()=>e.label),E(()=>st(r,`h-6 shrink-0 rounded-md px-2 text-[12px] font-medium whitespace-nowrap transition-colors ${t()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),r})()})),P(i,j(M,{get when(){return e.onTogglePin},get children(){var t=p0();return t.$$click=()=>e.onTogglePin?.(),E(n=>{var r=e.pinned?`Switch to overlay`:`Dock beside page`,i=e.pinned?`Overlay the page`:`Dock beside page (squeezes the app, DevTools-style)`,a=`hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md transition-colors ${e.pinned?`text-accent`:`text-text-dim hover:text-text`}`;return r!==n.e&&it(t,`aria-label`,n.e=r),i!==n.t&&it(t,`title`,n.t=i),a!==n.a&&st(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t}}),null),P(i,j(M,{get when(){return e.onClose},get children(){var t=m0();return t.$$click=()=>e.onClose?.(),t}}),null),P(s,j(dM,{onCreated:()=>n(`activity`)})),P(c,j(aQ,{})),P(l,j(D$,{})),P(u,j(p1,{})),P(d,j(w1,{onOpenIssue:()=>n(`activity`)})),P(f,j(a0,{})),E(n=>{var r=`border-border bg-surface flex shrink-0 items-center gap-1 border-b px-2 py-1.5 select-none ${e.onHeaderPointerDown?`cursor-grab active:cursor-grabbing`:``}`,a=t()!==`draft`,o=t()!==`capture`,p=t()!==`activity`,m=t()!==`local`,h=t()!==`prs`,g=t()!==`settings`;return r!==n.e&&st(i,n.e=r),a!==n.t&&s.classList.toggle(`hidden`,n.t=a),o!==n.a&&c.classList.toggle(`hidden`,n.a=o),p!==n.o&&l.classList.toggle(`hidden`,n.o=p),m!==n.i&&u.classList.toggle(`hidden`,n.i=m),h!==n.n&&d.classList.toggle(`hidden`,n.n=h),g!==n.s&&f.classList.toggle(`hidden`,n.s=g),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),r}})}rt([`pointerdown`,`click`]);var x0=`/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
|
|
223
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-contain-size:initial;--tw-contain-layout:initial;--tw-contain-paint:initial;--tw-contain-style:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, "SF Mono", Menlo, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-white:#fff;--spacing:.25rem;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-wide:.025em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:4px;--radius-md:6px;--radius-lg:10px;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#0b0c0e;--color-surface:#141517;--color-surface-2:#1c1d21;--color-surface-3:#24262b;--color-border:#26282d;--color-border-strong:#34363d;--color-text:#e8e9eb;--color-text-dim:#8b8e98;--color-text-faint:#5c5f6a;--color-accent:#5e6ad2;--color-accent-hover:#6e79e0;--color-accent-soft:#5e6ad226;--color-success:#4cb782;--color-warn:#f2c94c;--color-danger:#eb5757;--color-danger-soft:#eb575726}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-0\\.5{top:calc(var(--spacing) * .5)}.top-1{top:var(--spacing)}.top-1\\/2{top:50%}.top-\\[2px\\]{top:2px}.top-full{top:100%}.right-0{right:0}.right-0\\.5{right:calc(var(--spacing) * .5)}.right-4{right:calc(var(--spacing) * 4)}.right-full{right:100%}.bottom-0{bottom:0}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-\\[2px\\]{bottom:2px}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:var(--spacing)}.left-1\\/2{left:50%}.left-full{left:100%}.z-1{z-index:1}.z-10{z-index:10}.z-\\[2147483645\\]{z-index:2147483645}.z-\\[2147483646\\]{z-index:2147483646}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-m-0{margin:0}.-m-0\\.5{margin:calc(var(--spacing) * -.5)}.-m-4{margin:calc(var(--spacing) * -4)}.m-0{margin:0}.-mx-2{margin-inline:calc(var(--spacing) * -2)}.-my-1{margin-block:calc(var(--spacing) * -1)}.-my-1\\.5{margin-block:calc(var(--spacing) * -1.5)}.mt-0{margin-top:0}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-px{margin-top:1px}.mr-0{margin-right:0}.mr-0\\.5{margin-right:calc(var(--spacing) * .5)}.mr-1{margin-right:var(--spacing)}.mr-1\\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-2\\.5{margin-right:calc(var(--spacing) * 2.5)}.-mb-4{margin-bottom:calc(var(--spacing) * -4)}.mb-0{margin-bottom:0}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-2\\.5{margin-left:calc(var(--spacing) * 2.5)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.ml-px{margin-left:1px}.line-clamp-5{-webkit-line-clamp:5;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.size-0{width:0;height:0}.size-1{width:var(--spacing);height:var(--spacing)}.size-1\\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-\\[12px\\]{width:12px;height:12px}.size-\\[16px\\]{width:16px;height:16px}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-16{height:calc(var(--spacing) * 16)}.h-\\[8px\\]{height:8px}.h-\\[17px\\]{height:17px}.h-\\[18px\\]{height:18px}.h-\\[20px\\]{height:20px}.h-\\[24px\\]{height:24px}.h-fit{height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-44{max-height:calc(var(--spacing) * 44)}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\\[var\\(--rg-edit-list-max-h\\)\\]{max-height:var(--rg-edit-list-max-h)}.min-h-0{min-height:0}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-\\[2lh\\]{min-height:2lh}.min-h-\\[28px\\]{min-height:28px}.w-1{width:var(--spacing)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-16{width:calc(var(--spacing) * 16)}.w-72{width:calc(var(--spacing) * 72)}.w-\\[2px\\]{width:2px}.w-\\[calc\\(100\\%\\+16px\\)\\]{width:calc(100% + 16px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\\[55\\%\\]{max-width:55%}.max-w-\\[100vw\\]{max-width:100vw}.max-w-\\[280px\\]{max-width:280px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.min-w-\\[3\\.5ch\\]{min-width:3.5ch}.min-w-\\[4ch\\]{min-width:4ch}.min-w-\\[5ch\\]{min-width:5ch}.min-w-\\[6ch\\]{min-width:6ch}.min-w-\\[12ch\\]{min-width:12ch}.min-w-\\[36px\\]{min-width:36px}.min-w-\\[52px\\]{min-width:52px}.min-w-\\[68px\\]{min-width:68px}.min-w-\\[100px\\]{min-width:100px}.min-w-\\[150px\\]{min-width:150px}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-rotate-90{rotate:-90deg}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-decimal{list-style-type:decimal}.grid-cols-\\[0fr\\]{grid-template-columns:0fr}.grid-cols-\\[1fr\\]{grid-template-columns:1fr}.grid-rows-\\[0fr\\]{grid-template-rows:0fr}.grid-rows-\\[1fr\\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:0}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-\\[5px\\]{gap:5px}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[1px\\]{border-radius:1px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-\\[5px\\]{border-radius:5px}.rounded-\\[6px\\]{border-radius:6px}.rounded-\\[13px\\]{border-radius:13px}.rounded-\\[14px\\]{border-radius:14px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-\\[10px\\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-t-none{border-top-left-radius:0;border-top-right-radius:0}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-l-\\[10px\\]{border-top-left-radius:10px;border-bottom-left-radius:10px}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-\\[10px\\]{border-top-right-radius:10px;border-bottom-right-radius:10px}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-b-\\[6px\\]{border-bottom-right-radius:6px;border-bottom-left-radius:6px}.rounded-b-\\[10px\\]{border-bottom-right-radius:10px;border-bottom-left-radius:10px}.rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.\\[border-width\\:0\\.5px\\]{border-width:.5px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.\\[border-top-width\\:0\\.5px\\]{border-top-width:.5px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-\\[var\\(--rg-border-button\\)\\]{border-color:var(--rg-border-button)}.border-accent{border-color:var(--color-accent)}.border-accent\\/40{border-color:#5e6ad266}@supports (color:color-mix(in lab, red, red)){.border-accent\\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-border{border-color:var(--color-border)}.border-success{border-color:var(--color-success)}.border-success\\/40{border-color:#4cb78266}@supports (color:color-mix(in lab, red, red)){.border-success\\/40{border-color:color-mix(in oklab, var(--color-success) 40%, transparent)}}.border-text-dim{border-color:var(--color-text-dim)}.border-transparent{border-color:#0000}.border-warn{border-color:var(--color-warn)}.border-warn\\/40{border-color:#f2c94c66}@supports (color:color-mix(in lab, red, red)){.border-warn\\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-t-\\[var\\(--rg-border-subtle\\)\\]{border-top-color:var(--rg-border-subtle)}.border-t-transparent{border-top-color:#0000}.bg-\\[var\\(--rg-error-bg\\)\\]{background-color:var(--rg-error-bg)}.bg-\\[var\\(--rg-panel-bg\\)\\]{background-color:var(--rg-panel-bg)}.bg-\\[var\\(--rg-submit-bg\\)\\]{background-color:var(--rg-submit-bg)}.bg-\\[var\\(--rg-surface-active\\)\\]{background-color:var(--rg-surface-active)}.bg-\\[var\\(--rg-surface-hover\\)\\]{background-color:var(--rg-surface-hover)}.bg-\\[var\\(--rg-text-primary\\)\\]{background-color:var(--rg-text-primary)}.bg-\\[var\\(--rg-text-secondary\\)\\]{background-color:var(--rg-text-secondary)}.bg-accent{background-color:var(--color-accent)}.bg-accent-soft{background-color:var(--color-accent-soft)}.bg-bg{background-color:var(--color-bg)}.bg-bg\\/80{background-color:#0b0c0ecc}@supports (color:color-mix(in lab, red, red)){.bg-bg\\/80{background-color:color-mix(in oklab, var(--color-bg) 80%, transparent)}}.bg-border{background-color:var(--color-border)}.bg-current{background-color:currentColor}.bg-danger{background-color:var(--color-danger)}.bg-danger-soft{background-color:var(--color-danger-soft)}.bg-red-500{background-color:var(--color-red-500)}.bg-success{background-color:var(--color-success)}.bg-surface{background-color:var(--color-surface)}.bg-surface-2{background-color:var(--color-surface-2)}.bg-surface-3{background-color:var(--color-surface-3)}.bg-text-faint{background-color:var(--color-text-faint)}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\\.5{padding:calc(var(--spacing) * 2.5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:0}.px-0\\.25{padding-inline:calc(var(--spacing) * .25)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-\\[3px\\]{padding-inline:3px}.py-0{padding-block:0}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-0\\.25{padding-block:calc(var(--spacing) * .25)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-px{padding-block:1px}.pt-0{padding-top:0}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-1{padding-bottom:var(--spacing)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-2\\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.text-end{text-align:end}.text-justify{text-align:justify}.text-left{text-align:left}.text-right{text-align:right}.text-start{text-align:start}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-\\[9\\.5px\\]{font-size:9.5px}.text-\\[9px\\]{font-size:9px}.text-\\[10\\.5px\\]{font-size:10.5px}.text-\\[10px\\]{font-size:10px}.text-\\[11\\.5px\\]{font-size:11.5px}.text-\\[11px\\]{font-size:11px}.text-\\[12\\.5px\\]{font-size:12.5px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[15px\\]{font-size:15px}.leading-3{--tw-leading:calc(var(--spacing) * 3);line-height:calc(var(--spacing) * 3)}.leading-3\\.5{--tw-leading:calc(var(--spacing) * 3.5);line-height:calc(var(--spacing) * 3.5)}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-extralight{--tw-font-weight:var(--font-weight-extralight);font-weight:var(--font-weight-extralight)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.font-thin{--tw-font-weight:var(--font-weight-thin);font-weight:var(--font-weight-thin)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-normal{overflow-wrap:normal;word-break:normal}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.break-keep{word-break:keep-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-break-spaces{white-space:break-spaces}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[var\\(--rg-error-text\\)\\]{color:var(--rg-error-text)}.text-\\[var\\(--rg-submit-fg\\)\\]{color:var(--rg-submit-fg)}.text-\\[var\\(--rg-text-primary\\)\\]{color:var(--rg-text-primary)}.text-\\[var\\(--rg-text-primary-85\\)\\]{color:var(--rg-text-primary-85)}.text-\\[var\\(--rg-text-secondary\\)\\]{color:var(--rg-text-secondary)}.text-accent{color:var(--color-accent)}.text-danger{color:var(--color-danger)}.text-success{color:var(--color-success)}.text-text{color:var(--color-text)}.text-text-dim{color:var(--color-text-dim)}.text-text-faint{color:var(--color-text-faint)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-accent{accent-color:var(--color-accent)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.\\[box-shadow\\:var\\(--rg-shadow\\)\\]{box-shadow:var(--rg-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\\[filter\\:var\\(--rg-drop-shadow\\)\\]{filter:var(--rg-drop-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-columns\\]{transition-property:grid-template-columns;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-rows\\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[padding\\,border-radius\\,transform\\]{transition-property:padding,border-radius,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[top\\,left\\,width\\,height\\,opacity\\,border-radius\\]{transition-property:top,left,width,height,opacity,border-radius;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,color\\]{transition-property:transform,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.delay-\\[80ms\\]{transition-delay:80ms}.duration-60{--tw-duration:60ms;transition-duration:60ms}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-120{--tw-duration:.12s;transition-duration:.12s}.duration-140{--tw-duration:.14s;transition-duration:.14s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-180{--tw-duration:.18s;transition-duration:.18s}.duration-220{--tw-duration:.22s;transition-duration:.22s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-400{--tw-duration:.4s;transition-duration:.4s}.ease-\\[cubic-bezier\\(0\\,0\\,0\\.2\\,1\\)\\]{--tw-ease:cubic-bezier(0,0,.2,1);transition-timing-function:cubic-bezier(0,0,.2,1)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.will-change-\\[opacity\\,transform\\]{will-change:opacity,transform}.will-change-transform{will-change:transform}.contain-layout{--tw-contain-layout:layout;contain:var(--tw-contain-size,) var(--tw-contain-layout,) var(--tw-contain-paint,) var(--tw-contain-style,)}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.\\[corner-shape\\:superellipse\\(1\\.25\\)\\]{corner-shape:superellipse(1.25)}.\\[font-synthesis\\:none\\]{font-synthesis:none}.group-open\\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\\:text-\\[var\\(--rg-text-primary\\)\\]:is(:where(.group):hover *){color:var(--rg-text-primary)}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\\:text-text-faint::placeholder{color:var(--color-text-faint)}@media (hover:hover){.hover\\:bg-\\[var\\(--rg-error-bg-hover\\)\\]:hover{background-color:var(--rg-error-bg-hover)}.hover\\:bg-\\[var\\(--rg-surface-active\\)\\]:hover{background-color:var(--rg-surface-active)}.hover\\:bg-\\[var\\(--rg-surface-hover\\)\\]:hover{background-color:var(--rg-surface-hover)}.hover\\:bg-accent-hover:hover{background-color:var(--color-accent-hover)}.hover\\:bg-accent\\/50:hover{background-color:#5e6ad280}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-accent\\/50:hover{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\\:bg-danger\\/30:hover{background-color:#eb57574d}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-danger\\/30:hover{background-color:color-mix(in oklab, var(--color-danger) 30%, transparent)}}.hover\\:bg-surface-2:hover{background-color:var(--color-surface-2)}.hover\\:bg-surface-3:hover{background-color:var(--color-surface-3)}.hover\\:text-\\[var\\(--rg-text-primary\\)\\]:hover{color:var(--rg-text-primary)}.hover\\:text-danger:hover{color:var(--color-danger)}.hover\\:text-text:hover{color:var(--color-text)}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-80:hover{opacity:.8}}.focus\\:border-accent:focus{border-color:var(--color-accent)}.active\\:cursor-grabbing:active{cursor:grabbing}.active\\:bg-accent:active{background-color:var(--color-accent)}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-surface-3:disabled{background-color:var(--color-surface-3)}.disabled\\:text-text-faint:disabled{color:var(--color-text-faint)}.disabled\\:opacity-40:disabled{opacity:.4}@media (hover:hover){.disabled\\:hover\\:bg-surface-2:disabled:hover{background-color:var(--color-surface-2)}}}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}[data-theme=light],:host([data-theme=light]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}@media (prefers-color-scheme:light){:root:not([data-theme=dark]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}}body{background-color:var(--color-bg);font-family:var(--font-sans);color:var(--color-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-width:320px;margin:0;font-size:13px}@keyframes geist-spinner-fade{0%{opacity:1}to{opacity:.15}}[data-tip]{position:relative}[data-tip]:hover:after{content:attr(data-tip);color:#fff;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;z-index:60;background:#1b1c20;border-radius:6px;max-width:260px;padding:3px 8px;font-size:10.5px;font-weight:500;line-height:1.35;position:absolute;bottom:calc(100% + 6px);left:50%;overflow:hidden;transform:translate(-50%);box-shadow:0 4px 12px #0000004d}.no-scrollbar{scrollbar-width:none}.no-scrollbar::-webkit-scrollbar{display:none}.lg-md p{margin:0 0 6px}.lg-md p:last-child{margin-bottom:0}.lg-md a{color:var(--color-accent);word-break:break-all;text-decoration:none}.lg-md a:hover{text-decoration:underline}.lg-md code{background:var(--color-surface-2);border:1px solid var(--color-border);font-family:var(--font-mono);border-radius:4px;padding:0 4px;font-size:11px}.lg-md pre{background:var(--color-surface-2);border:1px solid var(--color-border);border-radius:6px;margin:6px 0;padding:8px;overflow-x:auto}.lg-md pre code{white-space:pre;background:0 0;border:none;padding:0;font-size:11px}.lg-md ul,.lg-md ol{flex-direction:column;gap:2px;margin:4px 0 6px;padding-left:18px;display:flex}.lg-md ul{list-style:outside}.lg-md ol{list-style:decimal}.lg-md h4{margin:8px 0 4px;font-size:12px;font-weight:600}.lg-md lg-media{display:block}.lg-md lg-media img,.lg-md lg-media video{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md video{border:1px solid var(--color-border);background:#000;border-radius:6px;max-width:100%;margin:4px 0}.lg-md img{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md strong{font-weight:600}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:var(--color-border-strong);border-radius:4px}::-webkit-scrollbar-track{background:0 0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-contain-size{syntax:"*";inherits:false}@property --tw-contain-layout{syntax:"*";inherits:false}@property --tw-contain-paint{syntax:"*";inherits:false}@property --tw-contain-style{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`;Rr();var S0=N(`<span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full">`),C0=N(`<span class="text-text min-w-[5ch] text-[11px] font-medium tabular-nums">`),w0=N(`<button class="bg-accent hover:bg-accent-hover h-7 cursor-pointer rounded-full px-2.5 text-[11px] font-medium text-white transition-colors"><span class="inline-block min-w-[4ch] text-center">Stop`),T0=N(`<p class="text-warn px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Needs review`),E0=N(`<div><p class="text-text-dim px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Running agents`),D0=N(`<div class="fixed z-[2147483646] select-none"><div class="bg-surface border-border text-text flex h-9 cursor-grab items-center gap-1 rounded-full border py-1 pr-1 pl-2.5 font-sans shadow-lg active:cursor-grabbing">`),O0=N(`<div><div title="Drag to resize">`),k0=N(`<button title="Open Linear Grab"aria-label="Open Linear Grab"class="text-accent hover:opacity-80 inline-flex cursor-pointer items-center gap-1.5">`),A0=N(`<span class="bg-border h-4 w-px"aria-hidden>`),j0=N(`<span aria-hidden class="bg-warn size-2 rounded-full">`),M0=N(`<span class="text-warn min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums"> rev`),N0=N(`<button title="Running agents"aria-label="Running agents"class="hover:bg-surface-2 flex h-7 cursor-pointer items-center gap-1.5 rounded-full px-2 transition-colors"><span aria-hidden></span><span>`),P0=N(`<p class="text-text-faint px-1.5 pb-1.5 text-[11.5px]">No agents running right now.`),F0=N(`<button class="hover:bg-surface-2 flex w-full cursor-pointer flex-col gap-0.5 rounded-md px-1.5 py-1.5 text-left transition-colors"><span class="flex min-w-0 items-center gap-1.5"><span aria-hidden class="size-1.5 shrink-0 rounded-full"></span><span class="font-mono text-text-dim shrink-0 text-[10.5px]"></span><span class="text-text truncate text-[11.5px]"></span></span><span class="text-text-faint pl-3 text-[10.5px] tabular-nums"> · <!> · `);function I0(e={}){if(typeof window>`u`||window.__LINEAR_GRAB_PAGE__)return;window.__LINEAR_GRAB_PAGE__=!0;let t=()=>{$O(),PZ();let t=document.createElement(`div`);t.id=`linear-grab-root`,document.body.appendChild(t);let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=x0,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=()=>i.setAttribute(`data-theme`,L0());a(),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,a),nt(()=>j(U0,{get defaultOpen(){return e.defaultOpen??!1}}),i)};document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function L0(){try{let e=[document.body,document.documentElement];for(let t of e){let e=getComputedStyle(t).backgroundColor.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+))?/);if(!(!e||e[4]!==void 0&&Number(e[4])===0))return .2126*e[1]+.7152*e[2]+.0722*e[3]>140?`light`:`dark`}}catch{}return matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}var R0=130,z0=36,B0=380,V0=280,H0=720;function U0(e){let[t,n]=T(e.defaultOpen),[r,i]=T(`right`),[a,o]=T({x:Math.max(8,window.innerWidth-R0-24),y:Math.max(8,window.innerHeight-z0-20)}),[s,c]=T({running:[],review:[]}),l=()=>s().running,u=()=>s().review,[d,f]=T(!1),[p,m]=T(BD().phase),[h,g]=T(0);ie(()=>{let e=setInterval(()=>{p()===`recording`&&g(Date.now()-(BD().startedAt??Date.now()))},250);ae(()=>clearInterval(e))});let _=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[v,y]=T(null),b=e=>({x:Math.min(Math.max(8,e.x),window.innerWidth-R0-8),y:Math.min(Math.max(8,e.y),window.innerHeight-z0-8)}),x=e=>({x:Math.min(Math.max(8-(k()-80),e.x),window.innerWidth-80),y:Math.min(Math.max(0,e.y),window.innerHeight-80)}),[S,C]=T(!1),[w,ee]=T(`cloud`),[O,te]=T(!1),[k,A]=T(B0),ne=e=>Math.min(H0,Math.max(V0,Math.min(e,window.innerWidth-60)));D(()=>{let e=document.documentElement,n=t()&&S();e.style.transition=`margin 0.2s ease`,e.style.marginRight=n&&r()===`right`?`${k()}px`:``,e.style.marginLeft=n&&r()===`left`?`${k()}px`:``}),ae(()=>{document.documentElement.style.marginRight=``,document.documentElement.style.marginLeft=``});let re=()=>{let e=!S();C(e),e&&y(null),wr({panelMode:e?`pinned`:`overlay`,panelPos:void 0})};ie(()=>{Cr().then(e=>{e.panelSide&&i(e.panelSide),e.launcherPos&&o(b(e.launcherPos)),e.panelPos&&y(x(e.panelPos)),e.panelWidth&&A(ne(e.panelWidth)),C(e.panelMode===`pinned`),ee(e.workflowMode??`cloud`)});let e=Ar(e=>{e===`settings`&&Cr().then(e=>{i(e.panelSide??`right`),C(e.panelMode===`pinned`),ee(e.workflowMode??`cloud`)}),e===`grab`&&w()!==`local`&&n(!0)}),t=()=>{te(!0),setTimeout(()=>te(!1),1600)};window.addEventListener(EZ,t);let r=()=>{f(!1),S()||n(!1)};window.addEventListener(DZ,r),ae(()=>{window.removeEventListener(EZ,t),window.removeEventListener(DZ,r)});let s=PQ(c),l=BD().phase,u=VD(e=>{m(e.phase),e.phase===`recording`&&l!==`recording`&&!S()&&n(!1),e.phase===`ready`&&l!==`ready`&&(YA(`capture`),n(!0)),l=e.phase}),d=()=>{o(b(a()));let e=v();e&&y(x(e))};window.addEventListener(`resize`,d),ae(()=>{e(),s(),u(),window.removeEventListener(`resize`,d)})});let oe=!1,se=e=>{if(e.button!==0)return;let t={x:e.clientX,y:e.clientY},n=a();oe=!1;let r=e=>{let r=e.clientX-t.x,i=e.clientY-t.y;Math.abs(r)+Math.abs(i)>4&&(oe=!0),oe&&o(b({x:n.x+r,y:n.y+i}))},i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i),oe&&wr({launcherPos:a()})};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},ce=()=>a().y>260,le=e=>{f(!1),YA(`activity`,e),n(!0)},ue=e=>{if(e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=e.clientX,n=k(),i=v(),a=e=>{let a=e.clientX-t,o=r()===`right`?-a:a,s=ne(n+o);A(s),i&&r()===`right`&&y(x({x:i.x+(n-s),y:i.y}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),wr({panelWidth:k(),...v()?{panelPos:v()}:{}})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},de=e=>{if(e.button!==0)return;if(e.detail===2){y(null),wr({panelPos:void 0});return}let t={x:e.clientX,y:e.clientY},n=v()??{x:r()===`right`?window.innerWidth-k():0,y:0},i=!1,a=e=>{let r=e.clientX-t.x,a=e.clientY-t.y;Math.abs(r)+Math.abs(a)>4&&(i=!0),i&&y(x({x:n.x+r,y:n.y+a}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o);let e=v();i&&e&&wr({panelPos:e})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)};return[j(M,{get when(){return!t()},get children(){var e=D0(),t=e.firstChild;return t.$$pointerdown=se,P(t,j(M,{get when(){return p()===`recording`},get fallback(){return[(()=>{var e=k0();return e.$$click=()=>{oe||(f(!1),n(!0))},P(e,j(y0,{size:13})),e})(),A0(),(()=>{var e=N0(),t=e.firstChild,n=t.nextSibling;return e.$$click=()=>{oe||f(e=>!e)},P(n,(()=>{var e=$e(()=>!!O());return()=>e()?`Copied ✓`:`${l().length} run`})()),P(e,j(M,{get when(){return $e(()=>!O())()&&u().length>0},get children(){return[j0(),(()=>{var e=M0(),t=e.firstChild;return P(e,()=>u().length,t),e})()]}}),null),E(e=>{var r=`size-2 rounded-full ${O()?`bg-success`:l().length?`bg-success animate-pulse`:`bg-text-faint`}`,i=`min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums ${O()?`text-success`:`text-text-dim`}`;return r!==e.e&&st(t,e.e=r),i!==e.t&&st(n,e.t=i),e},{e:void 0,t:void 0}),e})()]},get children(){return[S0(),(()=>{var e=C0();return P(e,()=>_(h())),e})(),(()=>{var e=w0();return e.$$click=()=>{oe||QD()},e})()]}})),P(e,j(M,{get when(){return d()},get children(){var e=E0(),t=e.firstChild;return P(e,j(M,{get when(){return u().length>0},get children(){return[T0(),j(We,{get each(){return u()},children:e=>j(W0,{agent:e,review:!0,onOpen:le})})]}}),t),P(e,j(M,{get when(){return l().length>0},get fallback(){return P0()},get children(){return j(We,{get each(){return l()},children:e=>j(W0,{agent:e,onOpen:le})})}}),null),E(()=>st(e,`bg-surface border-border absolute w-72 rounded-lg border p-1.5 font-sans shadow-2xl ${ce()?`bottom-full mb-2`:`top-full mt-2`} ${a().x>window.innerWidth-300?`right-0`:`left-0`}`)),e}}),null),E(t=>{var n=`${a().x}px`,r=`${a().y}px`;return n!==t.e&&dt(e,`left`,t.e=n),r!==t.t&&dt(e,`top`,t.t=r),t},{e:void 0,t:void 0}),e}}),j(M,{get when(){return t()},get children(){var e=O0(),t=e.firstChild;return t.$$pointerdown=ue,P(e,j(b0,{onGrab:()=>n(!0),onClose:()=>n(!1),get onHeaderPointerDown(){return S()?void 0:de},get pinned(){return S()},onTogglePin:re}),null),E(n=>{var i=`bg-bg text-text border-border fixed z-[2147483645] flex max-w-[100vw] flex-col overflow-hidden font-sans text-[13px] antialiased ${S()?``:`shadow-2xl`} ${!S()&&v()?`rounded-xl border`:r()===`right`?`top-0 right-0 h-screen border-l`:`top-0 left-0 h-screen border-r`}`,a={width:`${k()}px`,...!S()&&v()?{left:`${v().x}px`,top:`${v().y}px`,height:`${Math.min(680,window.innerHeight-16)}px`}:{}},o=`hover:bg-accent/50 active:bg-accent absolute top-0 z-10 h-full w-1 cursor-col-resize transition-colors ${r()===`right`?`left-0`:`right-0`}`;return i!==n.e&&st(e,n.e=i),n.t=ut(e,a,n.t),o!==n.a&&st(t,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}})]}function W0(e){return(()=>{var t=F0(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=n.nextSibling,s=o.firstChild,c=s.nextSibling;return c.nextSibling,t.$$click=()=>e.onOpen(e.agent.id),P(i,()=>e.agent.identifier),P(a,()=>e.agent.title),P(o,(()=>{var t=$e(()=>!!e.review);return()=>t()?`PR ready · needs review`:e.agent.stateName})(),s),P(o,()=>e.agent.delegateName,c),P(o,()=>G0(e.agent.updatedAt),null),E(t=>dt(r,`background`,e.review?`var(--color-warn)`:e.agent.stateColor)),t})()}function G0(e){let t=Math.max(0,Math.floor((Date.now()-Date.parse(e))/1e3));return t<60?`now`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}rt([`pointerdown`,`click`]),I0()})();
|
|
222
|
+
docs/design-tokens.md`,get value(){return n().skillPaths??``},onBlur:e=>{r({skillPaths:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Test account`,hint:`The cloud agent logs into the app with this while testing and recording its demo. Added to every issue's Agent instructions. Use a throwaway account — it's visible to everyone who can read the issue.`,get children(){var e=B1();return P(e,j(bj,{placeholder:`Username or email (e.g. demo@yourapp.com)`,get value(){return n().testUsername??``},onBlur:e=>{r({testUsername:e.currentTarget.value.trim()||void 0})}}),null),P(e,j(bj,{type:`password`,placeholder:`Password`,get value(){return n().testPassword??``},onBlur:e=>{r({testPassword:e.currentTarget.value.trim()||void 0})}}),null),e}})]}})}}),null),P(e,j(M,{when:!yr,get children(){return j(Dj,{title:`Panel`,get children(){return[(()=>{var e=V1(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[{id:`overlay`,label:`Overlay`},{id:`pinned`,label:`Beside page`}],children:e=>(()=>{var t=Z1();return t.$$click=()=>void r({panelMode:e.id,panelPos:void 0}),P(t,()=>e.label),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelMode??`overlay`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),(()=>{var e=H1(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[`left`,`right`],children:e=>(()=>{var t=Z1();return t.$$click=()=>void r({panelSide:e}),P(t,e===`left`?`Left`:`Right`),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelSide??`right`)===e?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})()]}})}}),null),P(e,j(Dj,{title:`Local Claude Code`,get children(){return j(Ej,{label:`Bridge URL`,hint:'Run `npx linear-grab-bridge` in your repo\'s terminal (binds localhost only). Enables "Delegate to → Local Claude Code" in Draft, the Local tab, and relays blocked uploads to Linear storage.',get children(){return j(bj,{placeholder:`http://localhost:4577`,get value(){return n().bridgeUrl??``},onBlur:e=>{r({bridgeUrl:e.currentTarget.value.trim()||void 0})}})}})}}),null),P(e,j(Dj,{title:`Asset uploads`,get children(){return[j(Ej,{label:`GitHub token`,hint:`Linear's storage blocks browser uploads in some browsers (Safari). With this set, GIFs/screenshots upload to your GitHub repo instead and embed automatically. Fine-grained PAT with Contents read/write on the assets repo.`,get children(){return j(bj,{type:`password`,placeholder:`github_pat_…`,get value(){return n().githubToken??``},onBlur:e=>{r({githubToken:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Assets repository`,hint:`owner/repo — must be PUBLIC so Linear (and agents) can render the images. Files land under linear-grab/.`,get children(){return j(bj,{placeholder:`ahmedbanihanibh/linear-grab-assets`,get value(){return n().githubAssetsRepo??``},onBlur:e=>{r({githubAssetsRepo:e.currentTarget.value.trim()||void 0})}})}})]}}),null),P(e,j(Dj,{title:`Notifications`,get children(){return[j(Ej,{label:`Slack bot token`,hint:`Bot token (xoxb-…) with chat:write + channels:read + files:write. New issues get announced with links + demo, and the AGENT receives the token to post its finished demo video itself.`,get children(){return j(bj,{type:`password`,placeholder:`xoxb-…`,get value(){return n().slackToken??``},onBlur:e=>{r({slackToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().slackToken},get children(){return j(Ej,{label:`Slack channel`,get children(){return j(M,{get when(){return!O.isError},get fallback(){return j(jj,{message:`Couldn't list channels — check the token scopes (channels:read).`})},get children(){return j(Sj,{get value(){return n().slackChannelId??``},get disabled(){return O.isLoading},onChange:e=>{let t=e.currentTarget.value,n=O.data?.find(e=>e.id===t);r({slackChannelId:t||void 0,slackChannelName:n?.name})},get children(){return[U1(),j(We,{get each(){return O.data??[]},children:e=>(()=>{var t=o0();return t.firstChild,P(t,()=>e.name,null),D(()=>t.selected=e.id===n().slackChannelId),D(()=>t.value=e.id),t})()})]}})}})}})}}),j(Ej,{label:`Telegram bot token`,hint:`From @BotFather. The agent also receives it to send the demo video (sendVideo).`,get children(){return j(bj,{type:`password`,placeholder:`123456:ABC-…`,get value(){return n().telegramToken??``},onBlur:e=>{r({telegramToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().telegramToken},get children(){return j(Ej,{label:`Telegram chat ID`,hint:`Add the bot to your group/channel, send a message, then read the chat id from api.telegram.org/bot<token>/getUpdates.`,get children(){return j(bj,{placeholder:`-1001234567890`,get value(){return n().telegramChatId??``},onBlur:e=>{r({telegramChatId:e.currentTarget.value.trim()||void 0})}})}})}}),(()=>{var e=W1(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({notifyOnCreate:e.currentTarget.checked?void 0:!1})),D(()=>t.checked=n().notifyOnCreate!==!1),e})(),G1()]}}),null),P(e,j(Dj,{title:`AI providers`,get children(){return[j(Ej,{label:`OpenAI API key`,get children(){return j(bj,{type:`password`,placeholder:`sk-…`,get value(){return n().openaiKey??``},onBlur:e=>{r({openaiKey:e.currentTarget.value.trim()||void 0})}})}}),j(Ej,{label:`Anthropic API key`,get children(){return j(bj,{type:`password`,placeholder:`sk-ant-…`,get value(){return n().anthropicKey??``},onBlur:e=>{r({anthropicKey:e.currentTarget.value.trim()||void 0})}})}}),(()=>{var e=K1(),t=e.firstChild.nextSibling.firstChild,i=t.nextSibling,a=i.nextSibling;return t.$$click=()=>void r({preferredProvider:void 0}),i.$$click=()=>void r({preferredProvider:`openai`}),a.$$click=()=>void r({preferredProvider:`anthropic`}),D(e=>{var r=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${n().preferredProvider===void 0?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`,o=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`openai`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,s=!n().openaiKey,c=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`anthropic`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,l=!n().anthropicKey;return r!==e.e&&st(t,e.e=r),o!==e.t&&st(i,e.t=o),s!==e.a&&(i.disabled=e.a=s),c!==e.o&&st(a,e.o=c),l!==e.i&&(a.disabled=e.i=l),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e})(),(()=>{var e=J1();return P(e,j(M,{get when(){return te()},get fallback(){return s0()},get children(){var e=q1();return P(e,te),e}})),e})()]}}),null),P(e,j(Dj,{title:`How it works`,get children(){return Y1()}}),null),e})()}rt([`click`]);var l0=`linear-grab`,u0=`queries`,d0=[`my-issues`,`issue`,`sessions`,`teams`,`agents`];function f0(){return new Promise(e=>{try{let t=indexedDB.open(l0,1);t.onupgradeneeded=()=>t.result.createObjectStore(u0),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}function p0(e){return typeof e[0]==`string`&&d0.includes(e[0])}async function m0(e){let t=await f0();if(!t)return()=>{};await new Promise(n=>{try{let r=t.transaction(u0,`readonly`).objectStore(u0).openCursor();r.onsuccess=()=>{let t=r.result;if(!t)return n();try{let{queryKey:n,data:r}=t.value;p0(n)&&e.getQueryData(n)===void 0&&e.setQueryData(n,r,{updatedAt:0})}catch{}t.continue()},r.onerror=()=>n()}catch{n()}});let n=new Map,r=e.getQueryCache().subscribe(r=>{if(r.type!==`updated`||r.action.type!==`success`)return;let{queryKey:i,queryHash:a}=r.query;if(!p0(i))return;let o=n.get(a);o&&clearTimeout(o),n.set(a,setTimeout(()=>{n.delete(a);try{let n=e.getQueryData(i);if(n===void 0)return;t.transaction(u0,`readwrite`).objectStore(u0).put({queryKey:i,data:n},a)}catch{}},400))});return()=>{r();for(let e of n.values())clearTimeout(e);t.close()}}Rr();var h0=N(`<svg viewBox="0 0 100 100"fill=currentColor aria-hidden><path d="M1.22541 61.5228c-.2225-.9485.90748-1.5459 1.59638-.857L39.3342 97.1782c.6889.6889.0915 1.8189-.857 1.5964C20.0515 94.4522 5.54779 79.9485 1.22541 61.5228ZM.00189135 46.8891c-.01764375.2833.08887215.5599.28957165.7606L52.3503 99.7085c.2007.2007.4773.3075.7606.2896 2.3692-.1476 4.6938-.46 6.9624-.9259.7645-.157 1.0301-1.0963.4782-1.6481L2.57595 39.4485c-.55186-.5519-1.49117-.2863-1.648174.4782-.465915 2.2686-.77832 4.5932-.92588465 6.9624ZM4.21093 29.7054c-.16649.3738-.08169.8106.20765 1.1l64.77602 64.776c.2894.2894.7262.3742 1.1.2077 1.7861-.7956 3.5171-1.6927 5.1855-2.684.5521-.328.6373-1.0867.1832-1.5407L8.43566 24.3367c-.45409-.4541-1.21271-.3689-1.54074.1832-.99132 1.6684-1.88843 3.3994-2.68399 5.1855ZM12.6587 18.074c-.3701-.3701-.393-.9637-.0443-1.3541C21.7795 6.45931 35.1114 0 49.9519 0 77.5927 0 100 22.4073 100 50.0481c0 14.8405-6.4593 28.1724-16.7199 37.3375-.3903.3487-.984.3258-1.3541-.0443L12.6587 18.074Z">`),g0=N(`<button><svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><rect x=1.5 y=2.5 width=13 height=11 rx=1.5></rect><path d="M10 2.5v11">`),_0=N(`<button aria-label="Minimize to launcher"title="Minimize to launcher"class="text-text-dim hover:text-text hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md text-[15px] leading-none transition-colors">–`),v0=N(`<div class="bg-bg text-text flex h-full flex-col"><header><span class="text-accent mr-0.5 inline-flex shrink-0"title="Linear Grab"></span><div class="no-scrollbar flex min-w-0 flex-1 items-center gap-1 overflow-x-auto"></div></header><main class="min-h-0 flex-1"><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full>`),y0=N(`<button>`),b0=[{id:`draft`,label:`Draft`},{id:`capture`,label:`Capture`},{id:`activity`,label:`Activity`},{id:`local`,label:`Local`},{id:`prs`,label:`PRs`},{id:`settings`,label:`Settings`}],x0=new gr({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});function S0(e){return(()=>{var t=h0();return D(n=>{var r=e.size??14,i=e.size??14;return r!==n.e&&it(t,`width`,n.e=r),i!==n.t&&it(t,`height`,n.t=i),n},{e:void 0,t:void 0}),t})()}function C0(e){let[t,n]=T(`draft`),r=()=>{x0.invalidateQueries({queryKey:[`grab`]}),ZA()===`capture`&&n(`capture`),e.onGrab?.()};return O(()=>{let e=GA();e&&n(e)}),ie(()=>{let e=m0(x0),t=IZ(r),n=()=>{RO().then(GQ),FO()};n();let i=Ar(e=>{e===`settings`&&(x0.invalidateQueries({queryKey:[`settings`]}),n()),e===`grab`&&r()});ae(()=>{t(),i(),e.then(e=>e())})}),j(cr,{client:x0,get children(){var r=v0(),i=r.firstChild,a=i.firstChild,o=a.nextSibling,s=i.nextSibling.firstChild,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,d=u.nextSibling,f=d.nextSibling;return i.$$pointerdown=t=>e.onHeaderPointerDown?.(t),P(a,j(S0,{size:14})),P(o,j(We,{each:b0,children:e=>(()=>{var r=y0();return r.$$click=()=>n(e.id),P(r,()=>e.label),D(()=>st(r,`h-6 shrink-0 rounded-md px-2 text-[12px] font-medium whitespace-nowrap transition-colors ${t()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),r})()})),P(i,j(M,{get when(){return e.onTogglePin},get children(){var t=g0();return t.$$click=()=>e.onTogglePin?.(),D(n=>{var r=e.pinned?`Switch to overlay`:`Dock beside page`,i=e.pinned?`Overlay the page`:`Dock beside page (squeezes the app, DevTools-style)`,a=`hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md transition-colors ${e.pinned?`text-accent`:`text-text-dim hover:text-text`}`;return r!==n.e&&it(t,`aria-label`,n.e=r),i!==n.t&&it(t,`title`,n.t=i),a!==n.a&&st(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t}}),null),P(i,j(M,{get when(){return e.onClose},get children(){var t=_0();return t.$$click=()=>e.onClose?.(),t}}),null),P(s,j(dM,{onCreated:()=>n(`activity`)})),P(c,j(aQ,{})),P(l,j(D$,{})),P(u,j(m1,{})),P(d,j(D1,{onOpenIssue:()=>n(`activity`)})),P(f,j(c0,{})),D(n=>{var r=`border-border bg-surface flex shrink-0 items-center gap-1 border-b px-2 py-1.5 select-none ${e.onHeaderPointerDown?`cursor-grab active:cursor-grabbing`:``}`,a=t()!==`draft`,o=t()!==`capture`,p=t()!==`activity`,m=t()!==`local`,h=t()!==`prs`,g=t()!==`settings`;return r!==n.e&&st(i,n.e=r),a!==n.t&&s.classList.toggle(`hidden`,n.t=a),o!==n.a&&c.classList.toggle(`hidden`,n.a=o),p!==n.o&&l.classList.toggle(`hidden`,n.o=p),m!==n.i&&u.classList.toggle(`hidden`,n.i=m),h!==n.n&&d.classList.toggle(`hidden`,n.n=h),g!==n.s&&f.classList.toggle(`hidden`,n.s=g),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),r}})}rt([`pointerdown`,`click`]);var w0=`/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
|
|
223
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-contain-size:initial;--tw-contain-layout:initial;--tw-contain-paint:initial;--tw-contain-style:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, "SF Mono", Menlo, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-white:#fff;--spacing:.25rem;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-wide:.025em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:4px;--radius-md:6px;--radius-lg:10px;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#0b0c0e;--color-surface:#141517;--color-surface-2:#1c1d21;--color-surface-3:#24262b;--color-border:#26282d;--color-border-strong:#34363d;--color-text:#e8e9eb;--color-text-dim:#8b8e98;--color-text-faint:#5c5f6a;--color-accent:#5e6ad2;--color-accent-hover:#6e79e0;--color-accent-soft:#5e6ad226;--color-success:#4cb782;--color-warn:#f2c94c;--color-danger:#eb5757;--color-danger-soft:#eb575726}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-0\\.5{top:calc(var(--spacing) * .5)}.top-1{top:var(--spacing)}.top-1\\/2{top:50%}.top-\\[2px\\]{top:2px}.top-full{top:100%}.right-0{right:0}.right-0\\.5{right:calc(var(--spacing) * .5)}.right-4{right:calc(var(--spacing) * 4)}.right-full{right:100%}.bottom-0{bottom:0}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-\\[2px\\]{bottom:2px}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:var(--spacing)}.left-1\\/2{left:50%}.left-full{left:100%}.z-1{z-index:1}.z-10{z-index:10}.z-\\[2147483645\\]{z-index:2147483645}.z-\\[2147483646\\]{z-index:2147483646}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-m-0{margin:0}.-m-0\\.5{margin:calc(var(--spacing) * -.5)}.-m-4{margin:calc(var(--spacing) * -4)}.m-0{margin:0}.-mx-2{margin-inline:calc(var(--spacing) * -2)}.-my-1{margin-block:calc(var(--spacing) * -1)}.-my-1\\.5{margin-block:calc(var(--spacing) * -1.5)}.mt-0{margin-top:0}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-px{margin-top:1px}.mr-0{margin-right:0}.mr-0\\.5{margin-right:calc(var(--spacing) * .5)}.mr-1{margin-right:var(--spacing)}.mr-1\\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-2\\.5{margin-right:calc(var(--spacing) * 2.5)}.-mb-4{margin-bottom:calc(var(--spacing) * -4)}.mb-0{margin-bottom:0}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-2\\.5{margin-left:calc(var(--spacing) * 2.5)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.ml-px{margin-left:1px}.line-clamp-5{-webkit-line-clamp:5;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.size-0{width:0;height:0}.size-1{width:var(--spacing);height:var(--spacing)}.size-1\\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-\\[12px\\]{width:12px;height:12px}.size-\\[16px\\]{width:16px;height:16px}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-16{height:calc(var(--spacing) * 16)}.h-\\[8px\\]{height:8px}.h-\\[17px\\]{height:17px}.h-\\[18px\\]{height:18px}.h-\\[20px\\]{height:20px}.h-\\[24px\\]{height:24px}.h-fit{height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-44{max-height:calc(var(--spacing) * 44)}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\\[var\\(--rg-edit-list-max-h\\)\\]{max-height:var(--rg-edit-list-max-h)}.min-h-0{min-height:0}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-\\[2lh\\]{min-height:2lh}.min-h-\\[28px\\]{min-height:28px}.w-1{width:var(--spacing)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-16{width:calc(var(--spacing) * 16)}.w-72{width:calc(var(--spacing) * 72)}.w-\\[2px\\]{width:2px}.w-\\[calc\\(100\\%\\+16px\\)\\]{width:calc(100% + 16px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\\[55\\%\\]{max-width:55%}.max-w-\\[100vw\\]{max-width:100vw}.max-w-\\[280px\\]{max-width:280px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.min-w-\\[3\\.5ch\\]{min-width:3.5ch}.min-w-\\[4ch\\]{min-width:4ch}.min-w-\\[5ch\\]{min-width:5ch}.min-w-\\[6ch\\]{min-width:6ch}.min-w-\\[12ch\\]{min-width:12ch}.min-w-\\[36px\\]{min-width:36px}.min-w-\\[52px\\]{min-width:52px}.min-w-\\[68px\\]{min-width:68px}.min-w-\\[100px\\]{min-width:100px}.min-w-\\[150px\\]{min-width:150px}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-rotate-90{rotate:-90deg}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-decimal{list-style-type:decimal}.grid-cols-\\[0fr\\]{grid-template-columns:0fr}.grid-cols-\\[1fr\\]{grid-template-columns:1fr}.grid-rows-\\[0fr\\]{grid-template-rows:0fr}.grid-rows-\\[1fr\\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:0}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-\\[5px\\]{gap:5px}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[1px\\]{border-radius:1px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-\\[5px\\]{border-radius:5px}.rounded-\\[6px\\]{border-radius:6px}.rounded-\\[13px\\]{border-radius:13px}.rounded-\\[14px\\]{border-radius:14px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-\\[10px\\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-t-none{border-top-left-radius:0;border-top-right-radius:0}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-l-\\[10px\\]{border-top-left-radius:10px;border-bottom-left-radius:10px}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-\\[10px\\]{border-top-right-radius:10px;border-bottom-right-radius:10px}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-b-\\[6px\\]{border-bottom-right-radius:6px;border-bottom-left-radius:6px}.rounded-b-\\[10px\\]{border-bottom-right-radius:10px;border-bottom-left-radius:10px}.rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.\\[border-width\\:0\\.5px\\]{border-width:.5px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.\\[border-top-width\\:0\\.5px\\]{border-top-width:.5px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-\\[var\\(--rg-border-button\\)\\]{border-color:var(--rg-border-button)}.border-accent{border-color:var(--color-accent)}.border-accent\\/40{border-color:#5e6ad266}@supports (color:color-mix(in lab, red, red)){.border-accent\\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-border{border-color:var(--color-border)}.border-success{border-color:var(--color-success)}.border-success\\/40{border-color:#4cb78266}@supports (color:color-mix(in lab, red, red)){.border-success\\/40{border-color:color-mix(in oklab, var(--color-success) 40%, transparent)}}.border-text-dim{border-color:var(--color-text-dim)}.border-transparent{border-color:#0000}.border-warn{border-color:var(--color-warn)}.border-warn\\/40{border-color:#f2c94c66}@supports (color:color-mix(in lab, red, red)){.border-warn\\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-t-\\[var\\(--rg-border-subtle\\)\\]{border-top-color:var(--rg-border-subtle)}.border-t-transparent{border-top-color:#0000}.bg-\\[var\\(--rg-error-bg\\)\\]{background-color:var(--rg-error-bg)}.bg-\\[var\\(--rg-panel-bg\\)\\]{background-color:var(--rg-panel-bg)}.bg-\\[var\\(--rg-submit-bg\\)\\]{background-color:var(--rg-submit-bg)}.bg-\\[var\\(--rg-surface-active\\)\\]{background-color:var(--rg-surface-active)}.bg-\\[var\\(--rg-surface-hover\\)\\]{background-color:var(--rg-surface-hover)}.bg-\\[var\\(--rg-text-primary\\)\\]{background-color:var(--rg-text-primary)}.bg-\\[var\\(--rg-text-secondary\\)\\]{background-color:var(--rg-text-secondary)}.bg-accent{background-color:var(--color-accent)}.bg-accent-soft{background-color:var(--color-accent-soft)}.bg-bg{background-color:var(--color-bg)}.bg-bg\\/80{background-color:#0b0c0ecc}@supports (color:color-mix(in lab, red, red)){.bg-bg\\/80{background-color:color-mix(in oklab, var(--color-bg) 80%, transparent)}}.bg-border{background-color:var(--color-border)}.bg-current{background-color:currentColor}.bg-danger{background-color:var(--color-danger)}.bg-danger-soft{background-color:var(--color-danger-soft)}.bg-red-500{background-color:var(--color-red-500)}.bg-success{background-color:var(--color-success)}.bg-surface{background-color:var(--color-surface)}.bg-surface-2{background-color:var(--color-surface-2)}.bg-surface-3{background-color:var(--color-surface-3)}.bg-text-faint{background-color:var(--color-text-faint)}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\\.5{padding:calc(var(--spacing) * 2.5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:0}.px-0\\.25{padding-inline:calc(var(--spacing) * .25)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-\\[3px\\]{padding-inline:3px}.py-0{padding-block:0}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-0\\.25{padding-block:calc(var(--spacing) * .25)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-px{padding-block:1px}.pt-0{padding-top:0}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-1{padding-bottom:var(--spacing)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-2\\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.text-end{text-align:end}.text-justify{text-align:justify}.text-left{text-align:left}.text-right{text-align:right}.text-start{text-align:start}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-\\[9\\.5px\\]{font-size:9.5px}.text-\\[9px\\]{font-size:9px}.text-\\[10\\.5px\\]{font-size:10.5px}.text-\\[10px\\]{font-size:10px}.text-\\[11\\.5px\\]{font-size:11.5px}.text-\\[11px\\]{font-size:11px}.text-\\[12\\.5px\\]{font-size:12.5px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[15px\\]{font-size:15px}.leading-3{--tw-leading:calc(var(--spacing) * 3);line-height:calc(var(--spacing) * 3)}.leading-3\\.5{--tw-leading:calc(var(--spacing) * 3.5);line-height:calc(var(--spacing) * 3.5)}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-extralight{--tw-font-weight:var(--font-weight-extralight);font-weight:var(--font-weight-extralight)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.font-thin{--tw-font-weight:var(--font-weight-thin);font-weight:var(--font-weight-thin)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-normal{overflow-wrap:normal;word-break:normal}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.break-keep{word-break:keep-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-break-spaces{white-space:break-spaces}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[var\\(--rg-error-text\\)\\]{color:var(--rg-error-text)}.text-\\[var\\(--rg-submit-fg\\)\\]{color:var(--rg-submit-fg)}.text-\\[var\\(--rg-text-primary\\)\\]{color:var(--rg-text-primary)}.text-\\[var\\(--rg-text-primary-85\\)\\]{color:var(--rg-text-primary-85)}.text-\\[var\\(--rg-text-secondary\\)\\]{color:var(--rg-text-secondary)}.text-accent{color:var(--color-accent)}.text-danger{color:var(--color-danger)}.text-success{color:var(--color-success)}.text-text{color:var(--color-text)}.text-text-dim{color:var(--color-text-dim)}.text-text-faint{color:var(--color-text-faint)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-accent{accent-color:var(--color-accent)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.\\[box-shadow\\:var\\(--rg-shadow\\)\\]{box-shadow:var(--rg-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\\[filter\\:var\\(--rg-drop-shadow\\)\\]{filter:var(--rg-drop-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-columns\\]{transition-property:grid-template-columns;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-rows\\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[padding\\,border-radius\\,transform\\]{transition-property:padding,border-radius,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[top\\,left\\,width\\,height\\,opacity\\,border-radius\\]{transition-property:top,left,width,height,opacity,border-radius;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,color\\]{transition-property:transform,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.delay-\\[80ms\\]{transition-delay:80ms}.duration-60{--tw-duration:60ms;transition-duration:60ms}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-120{--tw-duration:.12s;transition-duration:.12s}.duration-140{--tw-duration:.14s;transition-duration:.14s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-180{--tw-duration:.18s;transition-duration:.18s}.duration-220{--tw-duration:.22s;transition-duration:.22s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-400{--tw-duration:.4s;transition-duration:.4s}.ease-\\[cubic-bezier\\(0\\,0\\,0\\.2\\,1\\)\\]{--tw-ease:cubic-bezier(0,0,.2,1);transition-timing-function:cubic-bezier(0,0,.2,1)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.will-change-\\[opacity\\,transform\\]{will-change:opacity,transform}.will-change-transform{will-change:transform}.contain-layout{--tw-contain-layout:layout;contain:var(--tw-contain-size,) var(--tw-contain-layout,) var(--tw-contain-paint,) var(--tw-contain-style,)}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.\\[corner-shape\\:superellipse\\(1\\.25\\)\\]{corner-shape:superellipse(1.25)}.\\[font-synthesis\\:none\\]{font-synthesis:none}.group-open\\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\\:text-\\[var\\(--rg-text-primary\\)\\]:is(:where(.group):hover *){color:var(--rg-text-primary)}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\\:text-text-faint::placeholder{color:var(--color-text-faint)}@media (hover:hover){.hover\\:bg-\\[var\\(--rg-error-bg-hover\\)\\]:hover{background-color:var(--rg-error-bg-hover)}.hover\\:bg-\\[var\\(--rg-surface-active\\)\\]:hover{background-color:var(--rg-surface-active)}.hover\\:bg-\\[var\\(--rg-surface-hover\\)\\]:hover{background-color:var(--rg-surface-hover)}.hover\\:bg-accent-hover:hover{background-color:var(--color-accent-hover)}.hover\\:bg-accent\\/50:hover{background-color:#5e6ad280}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-accent\\/50:hover{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\\:bg-danger\\/30:hover{background-color:#eb57574d}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-danger\\/30:hover{background-color:color-mix(in oklab, var(--color-danger) 30%, transparent)}}.hover\\:bg-surface-2:hover{background-color:var(--color-surface-2)}.hover\\:bg-surface-3:hover{background-color:var(--color-surface-3)}.hover\\:text-\\[var\\(--rg-text-primary\\)\\]:hover{color:var(--rg-text-primary)}.hover\\:text-danger:hover{color:var(--color-danger)}.hover\\:text-text:hover{color:var(--color-text)}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-80:hover{opacity:.8}}.focus\\:border-accent:focus{border-color:var(--color-accent)}.active\\:cursor-grabbing:active{cursor:grabbing}.active\\:bg-accent:active{background-color:var(--color-accent)}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-surface-3:disabled{background-color:var(--color-surface-3)}.disabled\\:text-text-faint:disabled{color:var(--color-text-faint)}.disabled\\:opacity-40:disabled{opacity:.4}@media (hover:hover){.disabled\\:hover\\:bg-surface-2:disabled:hover{background-color:var(--color-surface-2)}}}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}[data-theme=light],:host([data-theme=light]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}@media (prefers-color-scheme:light){:root:not([data-theme=dark]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}}body{background-color:var(--color-bg);font-family:var(--font-sans);color:var(--color-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-width:320px;margin:0;font-size:13px}@keyframes geist-spinner-fade{0%{opacity:1}to{opacity:.15}}[data-tip]{position:relative}[data-tip]:hover:after{content:attr(data-tip);color:#fff;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;z-index:60;background:#1b1c20;border-radius:6px;max-width:260px;padding:3px 8px;font-size:10.5px;font-weight:500;line-height:1.35;position:absolute;bottom:calc(100% + 6px);left:50%;overflow:hidden;transform:translate(-50%);box-shadow:0 4px 12px #0000004d}.no-scrollbar{scrollbar-width:none}.no-scrollbar::-webkit-scrollbar{display:none}.lg-md p{margin:0 0 6px}.lg-md p:last-child{margin-bottom:0}.lg-md a{color:var(--color-accent);word-break:break-all;text-decoration:none}.lg-md a:hover{text-decoration:underline}.lg-md code{background:var(--color-surface-2);border:1px solid var(--color-border);font-family:var(--font-mono);border-radius:4px;padding:0 4px;font-size:11px}.lg-md pre{background:var(--color-surface-2);border:1px solid var(--color-border);border-radius:6px;margin:6px 0;padding:8px;overflow-x:auto}.lg-md pre code{white-space:pre;background:0 0;border:none;padding:0;font-size:11px}.lg-md ul,.lg-md ol{flex-direction:column;gap:2px;margin:4px 0 6px;padding-left:18px;display:flex}.lg-md ul{list-style:outside}.lg-md ol{list-style:decimal}.lg-md h4{margin:8px 0 4px;font-size:12px;font-weight:600}.lg-md lg-media{display:block}.lg-md lg-media img,.lg-md lg-media video{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md video{border:1px solid var(--color-border);background:#000;border-radius:6px;max-width:100%;margin:4px 0}.lg-md img{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md strong{font-weight:600}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:var(--color-border-strong);border-radius:4px}::-webkit-scrollbar-track{background:0 0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-contain-size{syntax:"*";inherits:false}@property --tw-contain-layout{syntax:"*";inherits:false}@property --tw-contain-paint{syntax:"*";inherits:false}@property --tw-contain-style{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`;Rr();var T0=N(`<span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full">`),E0=N(`<span class="text-text min-w-[5ch] text-[11px] font-medium tabular-nums">`),D0=N(`<button class="bg-accent hover:bg-accent-hover h-7 cursor-pointer rounded-full px-2.5 text-[11px] font-medium text-white transition-colors"><span class="inline-block min-w-[4ch] text-center">Stop`),O0=N(`<p class="text-warn px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Needs review`),k0=N(`<div><p class="text-text-dim px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Running agents`),A0=N(`<div class="fixed z-[2147483646] select-none"><div class="bg-surface border-border text-text flex h-9 cursor-grab items-center gap-1 rounded-full border py-1 pr-1 pl-2.5 font-sans shadow-lg active:cursor-grabbing">`),j0=N(`<div><div title="Drag to resize">`),M0=N(`<button title="Open Linear Grab"aria-label="Open Linear Grab"class="text-accent hover:opacity-80 inline-flex cursor-pointer items-center gap-1.5">`),N0=N(`<span class="bg-border h-4 w-px"aria-hidden>`),P0=N(`<span aria-hidden class="bg-warn size-2 rounded-full">`),F0=N(`<span class="text-warn min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums"> rev`),I0=N(`<button title="Running agents"aria-label="Running agents"class="hover:bg-surface-2 flex h-7 cursor-pointer items-center gap-1.5 rounded-full px-2 transition-colors"><span aria-hidden></span><span>`),L0=N(`<p class="text-text-faint px-1.5 pb-1.5 text-[11.5px]">No agents running right now.`),R0=N(`<button class="hover:bg-surface-2 flex w-full cursor-pointer flex-col gap-0.5 rounded-md px-1.5 py-1.5 text-left transition-colors"><span class="flex min-w-0 items-center gap-1.5"><span aria-hidden class="size-1.5 shrink-0 rounded-full"></span><span class="font-mono text-text-dim shrink-0 text-[10.5px]"></span><span class="text-text truncate text-[11.5px]"></span></span><span class="text-text-faint pl-3 text-[10.5px] tabular-nums"> · <!> · `);function z0(e={}){if(typeof window>`u`||window.__LINEAR_GRAB_PAGE__)return;window.__LINEAR_GRAB_PAGE__=!0;let t=()=>{$O(),PZ();let t=document.createElement(`div`);t.id=`linear-grab-root`,document.body.appendChild(t);let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=w0,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=()=>i.setAttribute(`data-theme`,B0());a(),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,a),nt(()=>j(K0,{get defaultOpen(){return e.defaultOpen??!1}}),i)};document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function B0(){try{let e=[document.body,document.documentElement];for(let t of e){let e=getComputedStyle(t).backgroundColor.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+))?/);if(!(!e||e[4]!==void 0&&Number(e[4])===0))return .2126*e[1]+.7152*e[2]+.0722*e[3]>140?`light`:`dark`}}catch{}return matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}var V0=130,H0=36,U0=380,W0=280,G0=720;function K0(e){let[t,n]=T(e.defaultOpen),[r,i]=T(`right`),[a,o]=T({x:Math.max(8,window.innerWidth-V0-24),y:Math.max(8,window.innerHeight-H0-20)}),[s,c]=T({running:[],review:[]}),l=()=>s().running,u=()=>s().review,[d,f]=T(!1),[p,m]=T(BD().phase),[h,g]=T(0);ie(()=>{let e=setInterval(()=>{p()===`recording`&&g(Date.now()-(BD().startedAt??Date.now()))},250);ae(()=>clearInterval(e))});let _=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[v,y]=T(null),b=e=>({x:Math.min(Math.max(8,e.x),window.innerWidth-V0-8),y:Math.min(Math.max(8,e.y),window.innerHeight-H0-8)}),x=e=>({x:Math.min(Math.max(8-(te()-80),e.x),window.innerWidth-80),y:Math.min(Math.max(0,e.y),window.innerHeight-80)}),[S,C]=T(!1),[w,E]=T(`cloud`),[k,ee]=T(!1),[te,A]=T(U0),ne=e=>Math.min(G0,Math.max(W0,Math.min(e,window.innerWidth-60)));O(()=>{let e=document.documentElement,n=t()&&S();e.style.transition=`margin 0.2s ease`,e.style.marginRight=n&&r()===`right`?`${te()}px`:``,e.style.marginLeft=n&&r()===`left`?`${te()}px`:``}),ae(()=>{document.documentElement.style.marginRight=``,document.documentElement.style.marginLeft=``});let re=()=>{let e=!S();C(e),e&&y(null),wr({panelMode:e?`pinned`:`overlay`,panelPos:void 0})};ie(()=>{Cr().then(e=>{e.panelSide&&i(e.panelSide),e.launcherPos&&o(b(e.launcherPos)),e.panelPos&&y(x(e.panelPos)),e.panelWidth&&A(ne(e.panelWidth)),C(e.panelMode===`pinned`),E(e.workflowMode??`cloud`)});let e=Ar(e=>{e===`settings`&&Cr().then(e=>{i(e.panelSide??`right`),C(e.panelMode===`pinned`),E(e.workflowMode??`cloud`)}),e===`grab`&&w()!==`local`&&n(!0)}),t=()=>{ee(!0),setTimeout(()=>ee(!1),1600)};window.addEventListener(EZ,t);let r=()=>{f(!1),S()||n(!1)};window.addEventListener(DZ,r),ae(()=>{window.removeEventListener(EZ,t),window.removeEventListener(DZ,r)});let s=PQ(c),l=BD().phase,u=VD(e=>{m(e.phase),e.phase===`recording`&&l!==`recording`&&!S()&&n(!1),e.phase===`ready`&&l!==`ready`&&(YA(`capture`),n(!0)),l=e.phase}),d=()=>{o(b(a()));let e=v();e&&y(x(e))};window.addEventListener(`resize`,d),ae(()=>{e(),s(),u(),window.removeEventListener(`resize`,d)})});let oe=!1,se=e=>{if(e.button!==0)return;let t={x:e.clientX,y:e.clientY},n=a();oe=!1;let r=e=>{let r=e.clientX-t.x,i=e.clientY-t.y;Math.abs(r)+Math.abs(i)>4&&(oe=!0),oe&&o(b({x:n.x+r,y:n.y+i}))},i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i),oe&&wr({launcherPos:a()})};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},ce=()=>a().y>260,le=e=>{f(!1),YA(`activity`,e),n(!0)},ue=e=>{if(e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=e.clientX,n=te(),i=v(),a=e=>{let a=e.clientX-t,o=r()===`right`?-a:a,s=ne(n+o);A(s),i&&r()===`right`&&y(x({x:i.x+(n-s),y:i.y}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),wr({panelWidth:te(),...v()?{panelPos:v()}:{}})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},de=e=>{if(e.button!==0)return;if(e.detail===2){y(null),wr({panelPos:void 0});return}let t={x:e.clientX,y:e.clientY},n=v()??{x:r()===`right`?window.innerWidth-te():0,y:0},i=!1,a=e=>{let r=e.clientX-t.x,a=e.clientY-t.y;Math.abs(r)+Math.abs(a)>4&&(i=!0),i&&y(x({x:n.x+r,y:n.y+a}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o);let e=v();i&&e&&wr({panelPos:e})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)};return[j(M,{get when(){return!t()},get children(){var e=A0(),t=e.firstChild;return t.$$pointerdown=se,P(t,j(M,{get when(){return p()===`recording`},get fallback(){return[(()=>{var e=M0();return e.$$click=()=>{oe||(f(!1),n(!0))},P(e,j(S0,{size:13})),e})(),N0(),(()=>{var e=I0(),t=e.firstChild,n=t.nextSibling;return e.$$click=()=>{oe||f(e=>!e)},P(n,(()=>{var e=$e(()=>!!k());return()=>e()?`Copied ✓`:`${l().length} run`})()),P(e,j(M,{get when(){return $e(()=>!k())()&&u().length>0},get children(){return[P0(),(()=>{var e=F0(),t=e.firstChild;return P(e,()=>u().length,t),e})()]}}),null),D(e=>{var r=`size-2 rounded-full ${k()?`bg-success`:l().length?`bg-success animate-pulse`:`bg-text-faint`}`,i=`min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums ${k()?`text-success`:`text-text-dim`}`;return r!==e.e&&st(t,e.e=r),i!==e.t&&st(n,e.t=i),e},{e:void 0,t:void 0}),e})()]},get children(){return[T0(),(()=>{var e=E0();return P(e,()=>_(h())),e})(),(()=>{var e=D0();return e.$$click=()=>{oe||QD()},e})()]}})),P(e,j(M,{get when(){return d()},get children(){var e=k0(),t=e.firstChild;return P(e,j(M,{get when(){return u().length>0},get children(){return[O0(),j(We,{get each(){return u()},children:e=>j(q0,{agent:e,review:!0,onOpen:le})})]}}),t),P(e,j(M,{get when(){return l().length>0},get fallback(){return L0()},get children(){return j(We,{get each(){return l()},children:e=>j(q0,{agent:e,onOpen:le})})}}),null),D(()=>st(e,`bg-surface border-border absolute w-72 rounded-lg border p-1.5 font-sans shadow-2xl ${ce()?`bottom-full mb-2`:`top-full mt-2`} ${a().x>window.innerWidth-300?`right-0`:`left-0`}`)),e}}),null),D(t=>{var n=`${a().x}px`,r=`${a().y}px`;return n!==t.e&&dt(e,`left`,t.e=n),r!==t.t&&dt(e,`top`,t.t=r),t},{e:void 0,t:void 0}),e}}),j(M,{get when(){return t()},get children(){var e=j0(),t=e.firstChild;return t.$$pointerdown=ue,P(e,j(C0,{onGrab:()=>n(!0),onClose:()=>n(!1),get onHeaderPointerDown(){return S()?void 0:de},get pinned(){return S()},onTogglePin:re}),null),D(n=>{var i=`bg-bg text-text border-border fixed z-[2147483645] flex max-w-[100vw] flex-col overflow-hidden font-sans text-[13px] antialiased ${S()?``:`shadow-2xl`} ${!S()&&v()?`rounded-xl border`:r()===`right`?`top-0 right-0 h-screen border-l`:`top-0 left-0 h-screen border-r`}`,a={width:`${te()}px`,...!S()&&v()?{left:`${v().x}px`,top:`${v().y}px`,height:`${Math.min(680,window.innerHeight-16)}px`}:{}},o=`hover:bg-accent/50 active:bg-accent absolute top-0 z-10 h-full w-1 cursor-col-resize transition-colors ${r()===`right`?`left-0`:`right-0`}`;return i!==n.e&&st(e,n.e=i),n.t=ut(e,a,n.t),o!==n.a&&st(t,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}})]}function q0(e){return(()=>{var t=R0(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=n.nextSibling,s=o.firstChild,c=s.nextSibling;return c.nextSibling,t.$$click=()=>e.onOpen(e.agent.id),P(i,()=>e.agent.identifier),P(a,()=>e.agent.title),P(o,(()=>{var t=$e(()=>!!e.review);return()=>t()?`PR ready · needs review`:e.agent.stateName})(),s),P(o,()=>e.agent.delegateName,c),P(o,()=>J0(e.agent.updatedAt),null),D(t=>dt(r,`background`,e.review?`var(--color-warn)`:e.agent.stateColor)),t})()}function J0(e){let t=Math.max(0,Math.floor((Date.now()-Date.parse(e))/1e3));return t<60?`now`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}rt([`pointerdown`,`click`]),z0()})();
|