linear-grab 0.8.0
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 +166 -0
- package/bin/linear-grab-bridge.mjs +245 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.global.js +206 -0
- package/dist/linear-grab.js +44426 -0
- package/package.json +48 -0
|
@@ -0,0 +1,206 @@
|
|
|
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=Ce,m=1,h=2,g={owned:null,cleanups:null,context:null,owner:null},_={},v=null,y=null,b=null,x=null,S=null,ee=0;function C(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(()=>re(()=>De(o)));v=o,b=null;try{return xe(s,!0)}finally{b=n,v=r}}function w(e,t){t=t?Object.assign({},d,t):d;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[he.bind(n),e=>(typeof e==`function`&&(e=y&&y.running&&y.sources.has(n)?e(n.tValue):e(n.value)),ge(n,e))]}function T(e,t,n){_e(ye(e,t,!0,m))}function E(e,t,n){_e(ye(e,t,!1,m))}function D(e,t,n){p=we;let r=ye(e,t,!1,m),i=me&&fe(me);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),S?S.push(r):_e(r)}function O(e,t,n){n=n?Object.assign({},d,n):d;let r=ye(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,_e(r),he.bind(r)}function te(e){return e&&typeof e==`object`&&`then`in e}function ne(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||w)(o.initialValue),[x,S]=w(void 0),[ee,C]=w(void 0,{equals:!1}),[E,D]=w(f?`ready`:`unresolved`);v&&oe(()=>{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 ne(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,xe(()=>{y.running=!0,k(t,n)},!1)):k(t,n)),t}function k(e,t){xe(()=>{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 ie(){let e=me&&fe(me),t=h(),n=x();if(n!==void 0&&!s)throw n;return b&&!b.user&&e&&T(()=>{ee(),s&&(e.resolved&&y&&u?y.promises.add(s):m.has(e)||(e.increment(),m.add(e)))}),t}function ae(e=!0){if(e!==!1&&d)return;d=!1;let t=p?p():r;if(u=y&&y.running,t==null||t===!1){ne(s,re(h));return}y&&s&&y.promises.delete(s);let n,i=c===_?re(()=>{try{return a(t,{value:h(),refetching:e})}catch(e){n=e}}):c;if(n!==void 0){ne(s,void 0,ke(n),t);return}else if(!te(i))return ne(s,i,void 0,t),i;return s=i,`v`in i?(i.s===1?ne(s,i.v,void 0,t):ne(s,void 0,ke(i.v),t),i):(d=!0,queueMicrotask(()=>d=!1),xe(()=>{D(f?`refreshing`:`pending`),C()},!1),i.then(e=>ne(i,e,void 0,t),e=>ne(i,void 0,ke(e),t)))}Object.defineProperties(ie,{state:{get:()=>E()},error:{get:()=>x()},loading:{get(){let e=E();return e===`pending`||e===`refreshing`}},latest:{get(){if(!f)return ie();let e=x();if(e&&!s)throw e;return h()}}});let se=v;return p?T(()=>(se=v,ae(!1))):ae(!1),[ie,{refetch:e=>ce(se,()=>ae(e)),mutate:g}]}function k(e){return xe(e,!1)}function re(e){if(b===null)return e();let t=b;b=null;try{return e()}finally{b=t}}function ie(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=re(()=>t(o,i,n));return i=o,s}}function ae(e){D(()=>re(e))}function oe(e){return v===null||(v.cleanups===null?v.cleanups=[e]:v.cleanups.push(e)),e}function se(){return b}function ce(e,t){let n=v,r=b;v=e,b=null;try{return xe(t,!0)}catch(e){je(e)}finally{v=n,b=r}}var[le,ue]=w(!1);function de(e,t){let n=Symbol(`context`);return{id:n,Provider:Ne(n),defaultValue:e}}function fe(e){let t;return v&&v.context&&(t=v.context[e.id])!==void 0?t:e.defaultValue}function pe(e){let t=O(e),n=O(()=>Me(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var me;function he(){let e=y&&y.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===m)_e(this);else{let e=x;x=null,xe(()=>Te(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 ge(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&&xe(()=>{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&&Ee(n)),r?n.tState=m:n.state=m)}if(x.length>1e6)throw x=[],Error()},!1)}return t}function _e(e){if(!e.fn)return;De(e);let t=ee;ve(e,y&&y.running&&y.sources.has(e)?e.tValue:e.value,t),y&&!y.running&&y.sources.has(e)&&queueMicrotask(()=>{xe(()=>{y&&(y.running=!0),b=v=e,ve(e,e.tValue,t),b=v=null},!1)})}function ve(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(De),e.tOwned=void 0):(e.state=m,e.owned&&e.owned.forEach(De),e.owned=null)),e.updatedAt=n+1,je(t)}finally{b=a,v=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?ge(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 ye(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 be(e){let t=y&&y.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===h)return Te(e);if(e.suspense&&re(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<ee);){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)_e(e);else if((t?e.tState:e.state)===h){let t=x;x=null,xe(()=>Te(e,n[0]),!1),x=t}}}function xe(e,t){if(x)return e();let n=!1;t||(x=[]),S?n=!0:S=[],ee++;try{let t=e();return Se(n),t}catch(e){n||(S=null),x=null,je(e)}}function Se(e){if(x&&=(Ce(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,xe(()=>{for(let e of n)De(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)De(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}ue(!1)},!1)}else if(y.running){y.running=!1,y.effects.push.apply(y.effects,S),S=null,ue(!0);return}}let n=S;S=null,n.length&&xe(()=>p(n),!1),t&&t()}function Ce(e){for(let t=0;t<e.length;t++)be(e[t])}function we(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:be(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++)be(e[t])}function Te(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<ee)&&be(i):e===h&&Te(i,t)}}}function Ee(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&&Ee(r))}}function De(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--)De(e.tOwned[t]);delete e.tOwned}if(y&&y.running&&e.pure)Oe(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)De(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 Oe(e,t){if(t||(e.tState=0,y.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)Oe(e.owned[t])}function ke(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function Ae(e,t,n){try{for(let n of t)n(e)}catch(e){je(e,n&&n.owner||null)}}function je(e,t=v){let n=f&&t&&t.context&&t.context[f],r=ke(e);if(!n)throw r;S?S.push({fn(){Ae(r,n,t)},state:m}):Ae(r,n,t)}function Me(e){if(typeof e==`function`&&!e.length)return Me(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Me(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 Ne(e,t){return function(t){let n;return E(()=>n=re(()=>(v.context={...v.context,[e]:t.value},pe(()=>t.children))),void 0),n}}var Pe=Symbol(`fallback`);function Fe(e){for(let t=0;t<e.length;t++)e[t]()}function Ie(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return oe(()=>Fe(a)),()=>{let c=e()||[],l=c.length,d,f;return c[u],re(()=>{let e,t,u,m,h,g,_,v,y;if(l===0)o!==0&&(Fe(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Pe],i[0]=C(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]=C(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]=C(p);i=i.slice(0,o=l),r=c.slice(0)}return i});function p(e){if(a[f]=e,s){let[e,n]=w(f);return s[f]=n,t(c[f],e)}return t(c[f])}}}function Le(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return oe(()=>Fe(a)),()=>{let l=e()||[],d=l.length;return l[u],re(()=>{if(d===0)return s!==0&&(Fe(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[Pe],i[0]=C(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===Pe&&(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]=C(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]=w(l[c]);return o[c]=r,t(n,c)}}}function A(e,t){return re(()=>e(t||{}))}function Re(){return!0}var ze={get(e,t,n){return t===c?n:e.get(t)},has(e,t){return t===c||e.has(t)},set:Re,deleteProperty:Re,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Re,deleteProperty:Re}},ownKeys(e){return e.keys()}};function Be(e){return(e=typeof e==`function`?e():e)?e:{}}function Ve(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function He(...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=Be(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in Be(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(Be(e[n])));return[...new Set(t)]}},ze);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:Ve.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 Ue(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)}},ze));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))}},ze)),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 We=e=>`Stale read from <${e}>.`;function Ge(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return O(Ie(()=>e.each,e.children,t||void 0))}function Ke(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return O(Le(()=>e.each,e.children,t||void 0))}function j(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?re(()=>a(t?i:()=>{if(!re(r))throw We(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function qe(e){let t=pe(()=>e.children),n=O(()=>{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=O(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:O(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return O(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?re(()=>o(a.keyed?i():()=>{if(re(n)()?.[0]!==r)throw We(`Match`);return i()})):o},void 0,void 0)}function Je(e){return e}var Ye=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(`.`)]),Xe=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),Ze=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),Qe=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 $e(e,t){let n=Qe[e];return typeof n==`object`?n[t]?n.$:void 0:n}var et=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),tt={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},nt=e=>O(()=>e());function rt(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 it=`_$DX_DELEGATE`;function at(e,t,n,r={}){let i;return C(r=>{i=r,t===document?e():N(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function M(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?()=>re(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function ot(e,t=window.document){let n=t[it]||(t[it]=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,St))}}function st(e,t,n){vt(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function ct(e,t,n,r){vt(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function lt(e,t,n){vt(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function ut(e,t){vt(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function dt(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 ft(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]||(bt(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||(bt(e,i,!0),n[i]=o)}return n}function pt(e,t,n){if(!t)return n?st(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 mt(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function ht(e,t={},n,r){let i={};return r||E(()=>i.children=Ct(e,t.children,i.children)),E(()=>typeof t.ref==`function`&>(t.ref,e)),E(()=>_t(e,t,n,!0,i,!0)),i}function gt(e,t,n){return re(()=>e(t,n))}function N(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return Ct(e,t,r,n);E(r=>Ct(e,t(),r,n),r)}function _t(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=xt(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||Ct(e,t.children);continue}let s=t[o];i[o]=xt(e,o,s,i[o],n,a,t)}}function vt(e){return!!i.context&&!i.done&&(!e||e.isConnected)}function yt(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function bt(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 xt(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return pt(e,n,r);if(t===`classList`)return ft(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=et.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(dt(e,i,n,a),a&&ot([i]))}else if(t.slice(0,5)===`attr:`)st(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)lt(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=Xe.has(t))||!i&&((u=$e(t,e.tagName))||(c=Ye.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(vt(e))return n;t===`class`||t===`className`?ut(e,n):s&&!c&&!l?e[yt(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&tt[t.split(`:`)[0]];r?ct(e,r,t,n):st(e,Ze[t]||t,n)}return n}function St(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 Ct(e,t,n,r,i){let a=vt(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=Et(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=Et(e,n,r)}else if(o===`function`)return E(()=>{let i=t();for(;typeof i==`function`;)i=i();n=Ct(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(wt(o,t,n,i))return E(()=>n=Ct(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=Et(e,n,r),s)return n}else c?n.length===0?Tt(e,o,r):rt(e,n,o):(n&&Et(e),Tt(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=Et(e,n,r,t);Et(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function wt(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=wt(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=wt(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 Tt(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Et(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 Dt=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(){}},Ot=new class extends Dt{#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`}},kt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},At=new class{#e=kt;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 jt(e){setTimeout(e,0)}var Mt=typeof window>`u`||`Deno`in globalThis;function Nt(){}function Pt(e,t){return typeof e==`function`?e(t):e}function Ft(e){return typeof e==`number`&&e>=0&&e!==1/0}function It(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Lt(e,t){return typeof e==`function`?e(t):e}function Rt(e,t){return typeof e==`function`?e(t):e}function zt(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Vt(o,t.options))return!1}else if(!Ut(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 Bt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Ht(t.options.mutationKey)!==Ht(a))return!1}else if(!Ut(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Vt(e,t){return(t?.queryKeyHashFn||Ht)(e)}function Ht(e){return JSON.stringify(e,(e,t)=>Jt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ut(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Ut(e[n],t[n])):!1}var Wt=Object.prototype.hasOwnProperty;function Gt(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=qt(e)&&qt(t);if(!r&&!(Jt(e)&&Jt(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:Wt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Gt(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Kt(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 qt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Jt(e){if(!Yt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Yt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Yt(e){return Object.prototype.toString.call(e)===`[object Object]`}function Xt(e){return new Promise(t=>{At.setTimeout(t,e)})}function Zt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Gt(e,t)}function Qt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function $t(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var en=Symbol();function tn(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===en?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function nn(e,t){return typeof e==`function`?e(...t):!!e}function rn(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 an=(()=>{let e=()=>Mt;return{isServer(){return e()},setIsServer(t){e=t}}})();function on(){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 sn(e){let t;if(e.then(e=>(t=e,e),Nt)?.catch(Nt),t!==void 0)return{data:t}}function cn(e){return e}function ln(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??cn,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?sn(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(Nt)})}var un=jt;function dn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=un,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 fn=dn(),pn=new class extends Dt{#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 mn(e){return Math.min(1e3*2**e,3e4)}function hn(e){return(e??`online`)!==`online`||pn.isOnline()}var gn=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function _n(e){let t=!1,n=0,r,i=on(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new gn(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Ot.isFocused()&&(e.networkMode===`always`||pn.isOnline())&&e.canRun(),u=()=>hn(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??(an.isServer()?0:3),o=e.retryDelay??mn,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),Xt(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 vn=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ft(this.gcTime)&&(this.#e=At.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(an.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(At.clearTimeout(this.#e),this.#e=void 0)}};function yn(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=>{rn(e,()=>t.signal,()=>n=!0)},u=tn(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?$t:Qt;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?xn:bn,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:bn(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 bn(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 xn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Sn=class extends vn{#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=Tn(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=Tn(this.options);e.data!==void 0&&(this.setState(wn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Zt(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(Nt).catch(Nt):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=>Rt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===en||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Lt(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:!It(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=tn(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`?yn(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=_n({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof gn&&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 gn){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,...Cn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...wn(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),fn.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Cn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function wn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Tn(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 En=class extends Dt{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=on(),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),On(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return kn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return kn(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 Rt(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&&!Kt(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&An(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Rt(this.options.enabled,this.#t)!==Rt(t.enabled,this.#t)||Lt(this.options.staleTime,this.#t)!==Lt(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Rt(this.options.enabled,this.#t)!==Rt(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 Mn(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(Nt)),t}#g(){this.#b();let e=Lt(this.options.staleTime,this.#t);if(an.isServer()||this.#r.isStale||!Ft(e))return;let t=It(this.#r.dataUpdatedAt,e)+1;this.#d=At.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,!(an.isServer()||Rt(this.options.enabled,this.#t)===!1||!Ft(this.#p)||this.#p===0)&&(this.#f=At.setInterval(()=>{(this.options.refetchIntervalInBackground||Ot.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(At.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(At.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&&On(e,t),o=i&&An(e,n,t,r);(a||o)&&(l={...l,...Cn(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=Zt(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=Zt(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:jn(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Rt(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=on();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),!Kt(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){fn.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Dn(e,t){return Rt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Rt(t.retryOnMount,e)===!1)}function On(e,t){return Dn(e,t)||e.state.data!==void 0&&kn(e,t,t.refetchOnMount)}function kn(e,t,n){if(Rt(t.enabled,e)!==!1&&Lt(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&jn(e,t)}return!1}function An(e,t,n,r){return(e!==t||Rt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&jn(e,n)}function jn(e,t){return Rt(t.enabled,e)!==!1&&e.isStaleByTime(Lt(t.staleTime,e))}function Mn(e,t){return!Kt(e.getCurrentResult(),t)}var Nn=class extends vn{#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||Pn(),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=_n({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),fn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Pn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Fn=class extends Dt{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 Nn({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=In(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=In(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=In(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=In(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){fn.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=>Bt(t,e))}findAll(e={}){return this.getAll().filter(t=>Bt(e,t))}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return fn.batch(()=>Promise.all(e.map(e=>e.continue().catch(Nt))))}};function In(e){return e.options.scope?.id}var Ln=class extends Dt{#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),Kt(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Ht(t.mutationKey)!==Ht(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??Pn();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){fn.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)})})}},Rn=class extends Dt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Vt(r,t),a=this.get(i);return a||(a=new Sn({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(){fn.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=>zt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>zt(e,t)):t}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},zn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Rn,this.#t=e.mutationCache||new Fn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Ot.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=pn.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(Lt(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=Pt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return fn.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;fn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return fn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=fn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Nt).catch(Nt)}invalidateQueries(e,t={}){return fn.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=fn.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(Nt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Nt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Lt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Nt).catch(Nt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Nt).catch(Nt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return pn.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(Ht(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ut(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ht(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ut(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||=Vt(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===en&&(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()}},Bn=Symbol(`store-raw`),Vn=Symbol(`store-node`),Hn=Symbol(`store-has`),Un=Symbol(`store-self`);function Wn(e){let t=e[c];if(!t&&(Object.defineProperty(e,c,{value:t=new Proxy(e,Qn)}),!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 Gn(e){let t;return typeof e==`object`&&!!e&&(e[c]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Kn(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Bn])return n;if(!Gn(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=Kn(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=Kn(i,t))!==i&&(e[a]=r))}return e}function qn(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Jn(e,t,n){if(e[t])return e[t];let[r,i]=w(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function Yn(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===c||t===Vn?n:(delete n.value,delete n.writable,n.get=()=>e[c][t],n)}function Xn(e){se()&&Jn(qn(e,Vn),Un)()}function Zn(e){return Xn(e),Reflect.ownKeys(e)}var Qn={get(e,t,n){if(t===Bn)return e;if(t===c)return n;if(t===u)return Xn(e),n;let r=qn(e,Vn),i=r[t],a=i?i():e[t];if(t===Vn||t===Hn||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);se()&&(typeof a!=`function`||Object.prototype.hasOwnProperty.call(e,t))&&!(n&&n.get)&&(a=Jn(r,t,a)())}return Gn(a)?Wn(a):a},has(e,t){return t===Bn||t===c||t===u||t===Vn||t===Hn||t===`__proto__`?!0:(se()&&Jn(qn(e,Hn),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Zn,getOwnPropertyDescriptor:Yn};function $n(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[Hn]&&e[Hn][t]&&i!==void 0&&e[Hn][t].$()):(e[t]=n,e[Hn]&&e[Hn][t]&&i===void 0&&e[Hn][t].$());let o=qn(e,Vn),s;if((s=Jn(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=Jn(o,`length`,a))&&s.$(e.length)}(s=o[Un])&&s.$()}function er(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];tr(i)||$n(e,i,t[i])}}function tr(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function nr(e,t){if(typeof t==`function`&&(t=t(e)),t=Kn(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&&$n(e,n,r)}$n(e,`length`,r)}else er(e,t)}function rr(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&&tr(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)rr(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&rr(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)rr(e,[r].concat(t),n);return}else if(t.length>1){rr(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=Kn(a),r===void 0||Gn(i)&&Gn(a)&&!Array.isArray(a)?er(i,a):$n(e,r,a))}function ir(...[e,t]){let n=Kn(e||{}),r=Array.isArray(n),i=Wn(n);function a(...e){k(()=>{r&&e.length===1?nr(n,e[0]):rr(n,e)})}return[i,a]}var ar=Symbol(`store-root`);function or(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function sr(e,t,n,r,i){if(or(n))return;let a=t[n];if(e===a)return;let o=Array.isArray(e);if(n!==ar&&(!Gn(e)||!Gn(a)||o!==Array.isArray(a)||i&&e[i]!==a[i])){$n(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++)sr(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++)$n(a,n,e[n]);for(;n<e.length;n++)$n(a,n,f[n]),sr(e[n],a,n,r,i);a.length>e.length&&$n(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?($n(a,n,f[n]),sr(e[n],a,n,r,i)):$n(a,n,e[n])}else for(let t=0,n=e.length;t<n;t++)sr(e[t],a,t,r,i);a.length>e.length&&$n(a,`length`,e.length);return}let s=Object.keys(e);for(let t=0,n=s.length;t<n;t++)or(s[t])||sr(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&&$n(a,c[t],void 0)}function cr(e,t={}){let{merge:n,key:r=`id`}=t,i=Kn(e);return e=>{if(!Gn(e)||!Gn(i))return i;let t=sr(i,{[ar]:e},ar,n,r);return t===void 0?e:t}}var lr=de(void 0),ur=e=>{if(e)return e;let t=fe(lr);if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t()},dr=e=>(E(t=>(t?.(),e.client.mount(),e.client.unmount.bind(e.client))),oe(()=>e.client.unmount()),A(lr.Provider,{value:()=>e.client,get children(){return e.children}})),fr=de(()=>!1),pr=()=>fe(fr);fr.Provider;function mr(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=cr(i,{key:n})(e.data);return{...t,data:a}}var hr=(e,t)=>t;function gr(e,t,n){let r=O(()=>ur(n?.())),i=pr(),a=O(()=>{let t=r().defaultQueryOptions(e());return t._optimisticResults=i()?`isRestoring`:`optimistic`,t.structuralSharing=!1,t}),o=a(),[s,c]=w(new t(r(),a())),l=s().getOptimisticResult(a()),[u,d]=ir(l),f=()=>s().subscribe(e=>{l=e,queueMicrotask(()=>{h&&v()})});function p(e){let t=s().options,n=t.reconcile;d(r=>mr(r,e,n!==void 0&&n,t.queryHash))}function m(){return[()=>u,e=>{let t=Kn(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}]=ne(()=>{let e=s();return new Promise((t,n)=>{if(g=t,!h&&!i()&&(h=f()),e.updateResult(),l.isError&&!l.isFetching&&!i()&&nn(e.options.throwOnError,[l.error,e.getCurrentQuery()]))return p(l),n(l.error);if(!l.isLoading)return g=null,t(hr(e.getCurrentQuery(),l));p(l)})},{storage:m,get deferStream(){return e().deferStream},onHydrated(e,t){if(t.value&&`hydrationData`in t.value&&ln(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 T(ie(r,e=>{h&&h();let n=new t(e,a());h=f(),c(n)},{defer:!0})),T(ie(i,e=>{e||v()},{defer:!0})),oe(()=>{h&&=(h(),null),g&&=(g(l),null)}),T(ie([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 _r(e,t){return gr(O(()=>e()),En,t)}function vr(e,t){let n=new Ln(O(()=>ur(t?.()))(),e()),r=(e,t)=>{n.mutate(e,t).catch(Nt)},[i,a]=ir({...n.getCurrentResult(),mutate:r,mutateAsync:n.getCurrentResult().mutate});return T(()=>{n.setOptions(e())}),T(ie(()=>i.status,()=>{if(i.isError&&nn(n.options.throwOnError,[i.error]))throw i.error})),oe(n.subscribe(e=>{a({...e,mutate:r,mutateAsync:e.mutate})})),i}var yr=class extends zn{constructor(e={}){super(e)}},br=_r,xr=vr,Sr,Cr=t((()=>{Sr=typeof chrome<`u`&&!!chrome.runtime?.id&&!!chrome.storage?.local}));function wr(e){for(let t of Rr)t(e)}function Tr(e,t){try{let n=e.getItem(t);return n?JSON.parse(n):null}catch{return null}}async function Er(){return Sr?(await chrome.storage.local.get(Pr))[Pr]??{}:Tr(localStorage,Ir)??{}}async function Dr(e){let t={...await Er(),...e};return Sr?await chrome.storage.local.set({[Pr]:t}):(localStorage.setItem(Ir,JSON.stringify(t)),wr(`settings`)),t}async function Or(){return Sr?(await chrome.storage.session.get(Fr))[Fr]??null:Tr(sessionStorage,Lr)}async function kr(e){Sr?await chrome.storage.session.set({[Fr]:e}):(sessionStorage.setItem(Lr,JSON.stringify(e)),wr(`grab`))}async function Ar(e){let t=[...await Or()??[]];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)}await kr(t.slice(-8))}async function jr(e){await kr((await Or()??[]).filter(t=>t.grabbedAt!==e))}async function Mr(){Sr?await chrome.storage.session.remove(Fr):(sessionStorage.removeItem(Lr),wr(`grab`))}function Nr(e){if(Sr){let t=(t,n)=>{n===`local`&&e(`settings`),n===`session`&&e(`grab`)};return chrome.storage.onChanged.addListener(t),()=>chrome.storage.onChanged.removeListener(t)}return Rr.add(e),()=>Rr.delete(e)}var Pr,Fr,Ir,Lr,Rr,zr=t((()=>{Cr(),Pr=`settings`,Fr=`lastGrab`,Ir=`linear-grab:settings`,Lr=`linear-grab:last-grab`,Rr=new Set}));function Br(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}function Vr(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?!0:Array.isArray(e)?e.every(Vr):typeof e==`object`&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Vr(t)))}function Hr(e){return Array.isArray(e)&&e.every(Vr)}function Ur(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Vr(t)))}var 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,ha=t((()=>{Wr=`vercel.ai.error`,Gr=Symbol.for(Wr),Jr=class e extends (qr=Error,Kr=Gr,qr){constructor({name:e,message:t,cause:n}){super(t),this[Kr]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Wr)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},Yr=`AI_APICallError`,Xr=`vercel.ai.error.${Yr}`,Zr=Symbol.for(Xr),ei=class extends ($r=Jr,Qr=Zr,$r){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:Yr,message:e,cause:o}),this[Qr]=!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 Jr.hasMarker(e,Xr)}},ti=`AI_EmptyResponseBodyError`,ni=`vercel.ai.error.${ti}`,ri=Symbol.for(ni),oi=class extends (ai=Jr,ii=ri,ai){constructor({message:e=`Empty response body`}={}){super({name:ti,message:e}),this[ii]=!0}static isInstance(e){return Jr.hasMarker(e,ni)}},si=`AI_InvalidArgumentError`,ci=`vercel.ai.error.${si}`,li=Symbol.for(ci),fi=class extends (di=Jr,ui=li,di){constructor({message:e,cause:t,argument:n}){super({name:si,message:e,cause:t}),this[ui]=!0,this.argument=n}static isInstance(e){return Jr.hasMarker(e,ci)}},pi=`AI_InvalidPromptError`,mi=`vercel.ai.error.${pi}`,hi=Symbol.for(mi),vi=class extends (_i=Jr,gi=hi,_i){constructor({prompt:e,message:t,cause:n}){super({name:pi,message:`Invalid prompt: ${t}`,cause:n}),this[gi]=!0,this.prompt=e}static isInstance(e){return Jr.hasMarker(e,mi)}},yi=`AI_InvalidResponseDataError`,bi=`vercel.ai.error.${yi}`,xi=Symbol.for(bi),wi=class extends (Ci=Jr,Si=xi,Ci){constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:yi,message:t}),this[Si]=!0,this.data=e}static isInstance(e){return Jr.hasMarker(e,bi)}},Ti=`AI_JSONParseError`,Ei=`vercel.ai.error.${Ti}`,Di=Symbol.for(Ei),Ai=class extends (ki=Jr,Oi=Di,ki){constructor({text:e,cause:t}){super({name:Ti,message:`JSON parsing failed: Text: ${e}.
|
|
2
|
+
Error message: ${Br(t)}`,cause:t}),this[Oi]=!0,this.text=e}static isInstance(e){return Jr.hasMarker(e,Ei)}},ji=`AI_LoadAPIKeyError`,Mi=`vercel.ai.error.${ji}`,Ni=Symbol.for(Mi),Ii=class extends (Fi=Jr,Pi=Ni,Fi){constructor({message:e}){super({name:ji,message:e}),this[Pi]=!0}static isInstance(e){return Jr.hasMarker(e,Mi)}},Li=`AI_LoadSettingError`,`${Li}`,Ri=`AI_NoContentGeneratedError`,`${Ri}`,zi=`AI_NoSuchModelError`,Bi=`vercel.ai.error.${zi}`,Vi=Symbol.for(Bi),Wi=class extends (Ui=Jr,Hi=Vi,Ui){constructor({errorName:e=zi,modelId:t,modelType:n,message:r=`No such ${n}: ${t}`}){super({name:e,message:r}),this[Hi]=!0,this.modelId=t,this.modelType=n}static isInstance(e){return Jr.hasMarker(e,Bi)}},Gi=`AI_NoSuchProviderReferenceError`,Ki=`vercel.ai.error.${Gi}`,qi=Symbol.for(Ki),Xi=class extends (Yi=Jr,Ji=qi,Yi){constructor({provider:e,reference:t,message:n=`No provider reference found for provider '${e}'. Available providers: ${Object.keys(t).join(`, `)}`}){super({name:Gi,message:n}),this[Ji]=!0,this.provider=e,this.reference=t}static isInstance(e){return Jr.hasMarker(e,Ki)}},Zi=`AI_TooManyEmbeddingValuesForCallError`,Qi=`vercel.ai.error.${Zi}`,$i=Symbol.for(Qi),na=class extends (ta=Jr,ea=$i,ta){constructor(e){super({name:Zi,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[ea]=!0,this.provider=e.provider,this.modelId=e.modelId,this.maxEmbeddingsPerCall=e.maxEmbeddingsPerCall,this.values=e.values}static isInstance(e){return Jr.hasMarker(e,Qi)}},ra=`AI_TypeValidationError`,ia=`vercel.ai.error.${ra}`,aa=Symbol.for(ia),ca=class e extends (sa=Jr,oa=aa,sa){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:ra,message:`${r}: Value: ${JSON.stringify(e)}.
|
|
3
|
+
Error message: ${Br(t)}`,cause:t}),this[oa]=!0,this.value=e,this.context=n}static isInstance(e){return Jr.hasMarker(e,ia)}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})}},la=`AI_UnsupportedFunctionalityError`,ua=`vercel.ai.error.${la}`,da=Symbol.for(ua),ma=class extends (pa=Jr,fa=da,pa){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:la,message:t}),this[fa]=!0,this.functionality=e}static isInstance(e){return Jr.hasMarker(e,ua)}}}));function P(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 ga(e){return e&&Object.assign(va,e),va}var _a,va,ya=t((()=>{Object.freeze({status:`aborted`}),_a=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},va={}}));function ba(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 xa(e,t){return typeof t==`bigint`?t.toString():t}function Sa(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Ca(e){return e==null}function wa(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ta(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 Ea(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 Da(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Oa(e){return JSON.stringify(e)}function ka(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Aa(e){if(ka(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(ka(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function ja(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ma(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Na(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 Pa(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function Fa(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 Ma(e,{...e._zod.def,shape:n,checks:[]})}function Ia(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 Ma(e,{...e._zod.def,shape:n,checks:[]})}function La(e,t){if(!Aa(t))throw Error(`Invalid input to extend: expected a plain object`);return Ma(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return Da(this,`shape`,n),n},checks:[]})}function Ra(e,t){return Ma(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Da(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function za(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 Ma(t,{...t._zod.def,shape:i,checks:[]})}function Ba(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 Ma(t,{...t._zod.def,shape:i,checks:[]})}function Va(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ha(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ua(e){return typeof e==`string`?e:e?.message}function Wa(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Ua(e.inst?._zod.def?.error?.(e))??Ua(t?.error?.(e))??Ua(n.customError?.(e))??Ua(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ga(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ka(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var qa,Ja,Ya,Xa,Za=t((()=>{qa=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{},Ja=Sa(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),Ya=new Set([`string`,`number`,`symbol`]),Xa={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function Qa(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 $a(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 eo,to,no,ro=t((()=>{ya(),Za(),eo=(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,xa,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},to=P(`$ZodError`,eo),no=P(`$ZodError`,eo,{Parent:Error})})),io,ao,oo,so,co,lo,uo=t((()=>{ya(),ro(),Za(),io=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 _a;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Wa(e,a,ga())));throw qa(t,i?.callee),t}return o.value},ao=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=>Wa(e,a,ga())));throw qa(t,i?.callee),t}return o.value},oo=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 _a;return a.issues.length?{success:!1,error:new(e??to)(a.issues.map(e=>Wa(e,i,ga())))}:{success:!0,data:a.value}},so=oo(no),co=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=>Wa(e,i,ga())))}:{success:!0,data:a.value}},lo=co(no)}));function fo(){return new RegExp(Eo,`u`)}function po(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 mo(e){return RegExp(`^${po(e)}$`)}function ho(e){let t=po({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Fo}T(?:${r})$`)}var 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,Wo=t((()=>{go=/^[cC][^\s-]{8,}$/,_o=/^[0-9a-z]+$/,vo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yo=/^[0-9a-vA-V]{20}$/,bo=/^[A-Za-z0-9]{27}$/,xo=/^[a-zA-Z0-9_-]{21}$/,So=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Co=/^([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})$/,wo=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)$/,To=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Eo=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Do=/^(?:(?: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])$/,Oo=/^(([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})$/,ko=/^((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])$/,Ao=/^(([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])$/,jo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Mo=/^[A-Za-z0-9_-]*$/,No=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Po=/^\+(?:[0-9]){6,14}[0-9]$/,Fo=`(?:(?:\\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])))`,Io=RegExp(`^${Fo}$`),Lo=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ro=/^\d+$/,zo=/^-?\d+(?:\.\d+)?/i,Bo=/true|false/i,Vo=/null/i,Ho=/^[^A-Z]*$/,Uo=/^[^a-z]*$/})),Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs=t((()=>{ya(),Wo(),Za(),Go=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ko={number:`number`,bigint:`bigint`,object:`date`},qo=P(`$ZodCheckLessThan`,(e,t)=>{Go.init(e,t);let n=Ko[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})}}),Jo=P(`$ZodCheckGreaterThan`,(e,t)=>{Go.init(e,t);let n=Ko[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})}}),Yo=P(`$ZodCheckMultipleOf`,(e,t)=>{Go.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):Ta(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})}}),Xo=P(`$ZodCheckNumberFormat`,(e,t)=>{Go.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Xa[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=Ro)}),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})}}),Zo=P(`$ZodCheckMaxLength`,(e,t)=>{var n;Go.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ca(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=Ga(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Qo=P(`$ZodCheckMinLength`,(e,t)=>{var n;Go.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ca(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=Ga(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$o=P(`$ZodCheckLengthEquals`,(e,t)=>{var n;Go.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ca(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=Ga(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})}}),es=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Go.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=()=>{})}),ts=P(`$ZodCheckRegex`,(e,t)=>{es.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})}}),ns=P(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ho,es.init(e,t)}),rs=P(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Uo,es.init(e,t)}),is=P(`$ZodCheckIncludes`,(e,t)=>{Go.init(e,t);let n=ja(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})}}),as=P(`$ZodCheckStartsWith`,(e,t)=>{Go.init(e,t);let n=RegExp(`^${ja(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})}}),os=P(`$ZodCheckEndsWith`,(e,t)=>{Go.init(e,t);let n=RegExp(`.*${ja(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})}}),ss=P(`$ZodCheckOverwrite`,(e,t)=>{Go.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),ls,us=t((()=>{ls=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
|
+
`).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(`
|
|
5
|
+
`))}}})),ds,fs=t((()=>{ds={major:4,minor:0,patch:0}}));function ps(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}function ms(e){if(!Mo.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ps(t.padEnd(Math.ceil(t.length/4)*4,`=`))}function hs(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}function gs(e,t,n){e.issues.length&&t.issues.push(...Ha(n,e.issues)),t.value[n]=e.value}function _s(e,t,n){e.issues.length&&t.issues.push(...Ha(n,e.issues)),t.value[n]=e.value}function vs(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...Ha(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ys(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Wa(e,r,ga())))}),t}function bs(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Aa(e)&&Aa(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=bs(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=bs(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xs(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Va(e))return e;let r=bs(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}function Ss(e,t,n){e.issues.length&&t.issues.push(...Ha(n,e.issues)),t.value[n]=e.value}function Cs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function ws(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Ts(e,t,n){return Va(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}function Es(e){return e.value=Object.freeze(e.value),e}function Ds(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ka(e))}}var 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=t((()=>{cs(),ya(),us(),uo(),Wo(),Za(),fs(),Os=P(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ds;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Va(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new _a;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Va(e,t))});else{if(e.issues.length===t)continue;r||=Va(e,t)}}return i?i.then(()=>e):e};e._zod.run=(n,i)=>{let a=e._zod.parse(n,i);if(a instanceof Promise){if(i.async===!1)throw new _a;return a.then(e=>t(e,r,i))}return t(a,r,i)}}e[`~standard`]={validate:t=>{try{let n=so(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return lo(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}}),ks=P(`$ZodString`,(e,t)=>{Os.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Lo(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),As=P(`$ZodStringFormat`,(e,t)=>{es.init(e,t),ks.init(e,t)}),js=P(`$ZodGUID`,(e,t)=>{t.pattern??=Co,As.init(e,t)}),Ms=P(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=wo(e)}else t.pattern??=wo();As.init(e,t)}),Ns=P(`$ZodEmail`,(e,t)=>{t.pattern??=To,As.init(e,t)}),Ps=P(`$ZodURL`,(e,t)=>{As.init(e,t),e._zod.check=n=>{try{let r=n.value,i=new URL(r),a=i.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:No.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith(`/`)&&a.endsWith(`/`)?n.value=a.slice(0,-1):n.value=a;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Fs=P(`$ZodEmoji`,(e,t)=>{t.pattern??=fo(),As.init(e,t)}),Is=P(`$ZodNanoID`,(e,t)=>{t.pattern??=xo,As.init(e,t)}),Ls=P(`$ZodCUID`,(e,t)=>{t.pattern??=go,As.init(e,t)}),Rs=P(`$ZodCUID2`,(e,t)=>{t.pattern??=_o,As.init(e,t)}),zs=P(`$ZodULID`,(e,t)=>{t.pattern??=vo,As.init(e,t)}),Bs=P(`$ZodXID`,(e,t)=>{t.pattern??=yo,As.init(e,t)}),Vs=P(`$ZodKSUID`,(e,t)=>{t.pattern??=bo,As.init(e,t)}),Hs=P(`$ZodISODateTime`,(e,t)=>{t.pattern??=ho(t),As.init(e,t)}),Us=P(`$ZodISODate`,(e,t)=>{t.pattern??=Io,As.init(e,t)}),Ws=P(`$ZodISOTime`,(e,t)=>{t.pattern??=mo(t),As.init(e,t)}),Gs=P(`$ZodISODuration`,(e,t)=>{t.pattern??=So,As.init(e,t)}),Ks=P(`$ZodIPv4`,(e,t)=>{t.pattern??=Do,As.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv4`})}),qs=P(`$ZodIPv6`,(e,t)=>{t.pattern??=Oo,As.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv6`}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Js=P(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ko,As.init(e,t)}),Ys=P(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ao,As.init(e,t),e._zod.check=n=>{let[r,i]=n.value.split(`/`);try{if(!i)throw Error();let e=Number(i);if(`${e}`!==i||e<0||e>128)throw Error();new URL(`http://[${r}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}}),Xs=P(`$ZodBase64`,(e,t)=>{t.pattern??=jo,As.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64`}),e._zod.check=n=>{ps(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Zs=P(`$ZodBase64URL`,(e,t)=>{t.pattern??=Mo,As.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64url`}),e._zod.check=n=>{ms(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Qs=P(`$ZodE164`,(e,t)=>{t.pattern??=Po,As.init(e,t)}),$s=P(`$ZodJWT`,(e,t)=>{As.init(e,t),e._zod.check=n=>{hs(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ec=P(`$ZodNumber`,(e,t)=>{Os.init(e,t),e._zod.pattern=e._zod.bag.pattern??zo,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),tc=P(`$ZodNumber`,(e,t)=>{Xo.init(e,t),ec.init(e,t)}),nc=P(`$ZodBoolean`,(e,t)=>{Os.init(e,t),e._zod.pattern=Bo,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),rc=P(`$ZodNull`,(e,t)=>{Os.init(e,t),e._zod.pattern=Vo,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),ic=P(`$ZodAny`,(e,t)=>{Os.init(e,t),e._zod.parse=e=>e}),ac=P(`$ZodUnknown`,(e,t)=>{Os.init(e,t),e._zod.parse=e=>e}),oc=P(`$ZodNever`,(e,t)=>{Os.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),sc=P(`$ZodArray`,(e,t)=>{Os.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>gs(t,n,e))):gs(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}}),cc=P(`$ZodObject`,(e,t)=>{Os.init(e,t);let n=Sa(()=>{let e=Object.keys(t.shape);for(let n of e)if(!(t.shape[n]instanceof Os))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Pa(t.shape);return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}});Ea(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=e=>{let t=new ls([`shape`,`payload`,`ctx`]),r=n.value,i=e=>{let t=Oa(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of r.keys)a[e]=`key_${o++}`;t.write(`const newResult = {}`);for(let e of r.keys)if(r.optionalKeys.has(e)){let n=a[e];t.write(`const ${n} = ${i(e)};`);let r=Oa(e);t.write(`
|
|
6
|
+
if (${n}.issues.length) {
|
|
7
|
+
if (input[${r}] === undefined) {
|
|
8
|
+
if (${r} in input) {
|
|
9
|
+
newResult[${r}] = undefined;
|
|
10
|
+
}
|
|
11
|
+
} else {
|
|
12
|
+
payload.issues = payload.issues.concat(
|
|
13
|
+
${n}.issues.map((iss) => ({
|
|
14
|
+
...iss,
|
|
15
|
+
path: iss.path ? [${r}, ...iss.path] : [${r}],
|
|
16
|
+
}))
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
} else if (${n}.value === undefined) {
|
|
20
|
+
if (${r} in input) newResult[${r}] = undefined;
|
|
21
|
+
} else {
|
|
22
|
+
newResult[${r}] = ${n}.value;
|
|
23
|
+
}
|
|
24
|
+
`)}else{let n=a[e];t.write(`const ${n} = ${i(e)};`),t.write(`
|
|
25
|
+
if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
26
|
+
...iss,
|
|
27
|
+
path: iss.path ? [${Oa(e)}, ...iss.path] : [${Oa(e)}]
|
|
28
|
+
})));`),t.write(`newResult[${Oa(e)}] = ${n}.value`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},i,a=ka,o=!va.jitless,s=o&&Ja.value,c=t.catchall,l;e._zod.parse=(u,d)=>{l??=n.value;let f=u.value;if(!a(f))return u.issues.push({expected:`object`,code:`invalid_type`,input:f,inst:e}),u;let p=[];if(o&&s&&d?.async===!1&&d.jitless!==!0)i||=r(t.shape),u=i(u,d);else{u.value={};let e=l.shape;for(let t of l.keys){let n=e[t],r=n._zod.run({value:f[t],issues:[]},d),i=n._zod.optin===`optional`&&n._zod.optout===`optional`;r instanceof Promise?p.push(r.then(e=>i?vs(e,u,t,f):_s(e,u,t))):i?vs(r,u,t,f):_s(r,u,t)}}if(!c)return p.length?Promise.all(p).then(()=>u):u;let m=[],h=l.keySet,g=c._zod,_=g.def.type;for(let e of Object.keys(f)){if(h.has(e))continue;if(_===`never`){m.push(e);continue}let t=g.run({value:f[e],issues:[]},d);t instanceof Promise?p.push(t.then(t=>_s(t,u,e))):_s(t,u,e)}return m.length&&u.issues.push({code:`unrecognized_keys`,keys:m,input:f,inst:e}),p.length?Promise.all(p).then(()=>u):u}}),lc=P(`$ZodUnion`,(e,t)=>{Os.init(e,t),Ea(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Ea(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Ea(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Ea(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>wa(e.source)).join(`|`)})$`)}}),e._zod.parse=(n,r)=>{let i=!1,a=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},r);if(t instanceof Promise)a.push(t),i=!0;else{if(t.issues.length===0)return t;a.push(t)}}return i?Promise.all(a).then(t=>ys(t,n,e,r)):ys(a,n,e,r)}}),uc=P(`$ZodDiscriminatedUnion`,(e,t)=>{lc.init(e,t);let n=e._zod.parse;Ea(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Sa(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!ka(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,input:o,path:[t.discriminator],inst:e}),i)}}),dc=P(`$ZodIntersection`,(e,t)=>{Os.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>xs(e,t,n)):xs(e,i,a)}}),fc=P(`$ZodTuple`,(e,t)=>{Os.init(e,t);let n=t.items,r=n.length-[...n].reverse().findIndex(e=>e._zod.optin!==`optional`);e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=[];let s=[];if(!t.rest){let t=o.length>n.length,a=o.length<r-1;if(t||a)return i.issues.push({input:o,inst:e,origin:`array`,...t?{code:`too_big`,maximum:n.length}:{code:`too_small`,minimum:n.length}}),i}let c=-1;for(let e of n){if(c++,c>=o.length&&c>=r)continue;let t=e._zod.run({value:o[c],issues:[]},a);t instanceof Promise?s.push(t.then(e=>Ss(e,i,c))):Ss(t,i,c)}if(t.rest){let e=o.slice(n.length);for(let n of e){c++;let e=t.rest._zod.run({value:n,issues:[]},a);e instanceof Promise?s.push(e.then(e=>Ss(e,i,c))):Ss(e,i,c)}}return s.length?Promise.all(s).then(()=>i):i}}),pc=P(`$ZodRecord`,(e,t)=>{Os.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Aa(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...Ha(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Ha(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({origin:`record`,code:`invalid_key`,issues:s.issues.map(e=>Wa(e,r,ga())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Ha(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Ha(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),mc=P(`$ZodEnum`,(e,t)=>{Os.init(e,t);let n=ba(t.entries);e._zod.values=new Set(n),e._zod.pattern=RegExp(`^(${n.filter(e=>Ya.has(typeof e)).map(e=>typeof e==`string`?ja(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,r)=>{let i=t.value;return e._zod.values.has(i)||t.issues.push({code:`invalid_value`,values:n,input:i,inst:e}),t}}),hc=P(`$ZodLiteral`,(e,t)=>{Os.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?ja(e):e?e.toString():String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),gc=P(`$ZodTransform`,(e,t)=>{Os.init(e,t),e._zod.parse=(e,n)=>{let r=t.transform(e.value,e);if(n.async)return(r instanceof Promise?r:Promise.resolve(r)).then(t=>(e.value=t,e));if(r instanceof Promise)throw new _a;return e.value=r,e}}),_c=P(`$ZodOptional`,(e,t)=>{Os.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Ea(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ea(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wa(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>t.innerType._zod.optin===`optional`?t.innerType._zod.run(e,n):e.value===void 0?e:t.innerType._zod.run(e,n)}),vc=P(`$ZodNullable`,(e,t)=>{Os.init(e,t),Ea(e._zod,`optin`,()=>t.innerType._zod.optin),Ea(e._zod,`optout`,()=>t.innerType._zod.optout),Ea(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${wa(e.source)}|null)$`):void 0}),Ea(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),yc=P(`$ZodDefault`,(e,t)=>{Os.init(e,t),e._zod.optin=`optional`,Ea(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Cs(e,t)):Cs(r,t)}}),bc=P(`$ZodPrefault`,(e,t)=>{Os.init(e,t),e._zod.optin=`optional`,Ea(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),xc=P(`$ZodNonOptional`,(e,t)=>{Os.init(e,t),Ea(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ws(t,e)):ws(i,e)}}),Sc=P(`$ZodCatch`,(e,t)=>{Os.init(e,t),e._zod.optin=`optional`,Ea(e._zod,`optout`,()=>t.innerType._zod.optout),Ea(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Wa(e,n,ga()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Wa(e,n,ga()))},input:e.value}),e.issues=[]),e)}}),Cc=P(`$ZodPipe`,(e,t)=>{Os.init(e,t),Ea(e._zod,`values`,()=>t.in._zod.values),Ea(e._zod,`optin`,()=>t.in._zod.optin),Ea(e._zod,`optout`,()=>t.out._zod.optout),e._zod.parse=(e,n)=>{let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ts(e,t,n)):Ts(r,t,n)}}),wc=P(`$ZodReadonly`,(e,t)=>{Os.init(e,t),Ea(e._zod,`propValues`,()=>t.innerType._zod.propValues),Ea(e._zod,`values`,()=>t.innerType._zod.values),Ea(e._zod,`optin`,()=>t.innerType._zod.optin),Ea(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Es):Es(r)}}),Tc=P(`$ZodLazy`,(e,t)=>{Os.init(e,t),Ea(e._zod,`innerType`,()=>t.getter()),Ea(e._zod,`pattern`,()=>e._zod.innerType._zod.pattern),Ea(e._zod,`propValues`,()=>e._zod.innerType._zod.propValues),Ea(e._zod,`optin`,()=>e._zod.innerType._zod.optin),Ea(e._zod,`optout`,()=>e._zod.innerType._zod.optout),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Ec=P(`$ZodCustom`,(e,t)=>{Go.init(e,t),Os.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ds(t,n,r,e));Ds(i,n,r,e)}})}));function Oc(){return new kc}var kc,Ac,jc=t((()=>{kc=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}},Ac=Oc()}));function Mc(e,t){return new e({type:`string`,...Na(t)})}function Nc(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Na(t)})}function Pc(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Na(t)})}function Fc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Na(t)})}function Ic(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Na(t)})}function Lc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Na(t)})}function Rc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Na(t)})}function zc(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Na(t)})}function Bc(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Na(t)})}function Vc(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Na(t)})}function Hc(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Na(t)})}function Uc(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Na(t)})}function Wc(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Na(t)})}function Gc(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Na(t)})}function Kc(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Na(t)})}function qc(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Na(t)})}function Jc(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Na(t)})}function Yc(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Na(t)})}function Xc(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Na(t)})}function Zc(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Na(t)})}function Qc(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Na(t)})}function $c(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Na(t)})}function el(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Na(t)})}function tl(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Na(t)})}function nl(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Na(t)})}function rl(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Na(t)})}function il(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Na(t)})}function al(e,t){return new e({type:`number`,checks:[],...Na(t)})}function ol(e,t){return new e({type:`number`,coerce:!0,checks:[],...Na(t)})}function sl(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Na(t)})}function cl(e,t){return new e({type:`boolean`,...Na(t)})}function ll(e,t){return new e({type:`null`,...Na(t)})}function ul(e){return new e({type:`any`})}function dl(e){return new e({type:`unknown`})}function fl(e,t){return new e({type:`never`,...Na(t)})}function pl(e,t){return new qo({check:`less_than`,...Na(t),value:e,inclusive:!1})}function ml(e,t){return new qo({check:`less_than`,...Na(t),value:e,inclusive:!0})}function hl(e,t){return new Jo({check:`greater_than`,...Na(t),value:e,inclusive:!1})}function gl(e,t){return new Jo({check:`greater_than`,...Na(t),value:e,inclusive:!0})}function _l(e,t){return new Yo({check:`multiple_of`,...Na(t),value:e})}function vl(e,t){return new Zo({check:`max_length`,...Na(t),maximum:e})}function yl(e,t){return new Qo({check:`min_length`,...Na(t),minimum:e})}function bl(e,t){return new $o({check:`length_equals`,...Na(t),length:e})}function xl(e,t){return new ts({check:`string_format`,format:`regex`,...Na(t),pattern:e})}function Sl(e){return new ns({check:`string_format`,format:`lowercase`,...Na(e)})}function Cl(e){return new rs({check:`string_format`,format:`uppercase`,...Na(e)})}function wl(e,t){return new is({check:`string_format`,format:`includes`,...Na(t),includes:e})}function Tl(e,t){return new as({check:`string_format`,format:`starts_with`,...Na(t),prefix:e})}function El(e,t){return new os({check:`string_format`,format:`ends_with`,...Na(t),suffix:e})}function Dl(e){return new ss({check:`overwrite`,tx:e})}function Ol(e){return Dl(t=>t.normalize(e))}function kl(){return Dl(e=>e.trim())}function Al(){return Dl(e=>e.toLowerCase())}function jl(){return Dl(e=>e.toUpperCase())}function Ml(e,t,n){return new e({type:`array`,element:t,...Na(n)})}function Nl(e,t,n){let r=Na(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Pl(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Na(n)})}var Fl=t((()=>{cs(),Za()})),Il=t((()=>{}));function Ll(e,t){if(e instanceof kc){let n=new zl(t),r={};for(let t of e._idmap.entries()){let[e,r]=t;n.process(r)}let i={},a={registry:e,uri:t?.uri,defs:r};for(let r of e._idmap.entries()){let[e,o]=r;i[e]=n.emit(o,{...t,external:a})}return Object.keys(r).length>0&&(i.__shared={[n.target===`draft-2020-12`?`$defs`:`definitions`]:r}),{schemas:i}}let n=new zl(t);return n.process(e),n.emit(e,t)}function Rl(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;switch(r.type){case`string`:case`number`:case`bigint`:case`boolean`:case`date`:case`symbol`:case`undefined`:case`null`:case`any`:case`unknown`:case`never`:case`void`:case`literal`:case`enum`:case`nan`:case`file`:case`template_literal`:return!1;case`array`:return Rl(r.element,n);case`object`:for(let e in r.shape)if(Rl(r.shape[e],n))return!0;return!1;case`union`:for(let e of r.options)if(Rl(e,n))return!0;return!1;case`intersection`:return Rl(r.left,n)||Rl(r.right,n);case`tuple`:for(let e of r.items)if(Rl(e,n))return!0;return!!(r.rest&&Rl(r.rest,n));case`record`:return Rl(r.keyType,n)||Rl(r.valueType,n);case`map`:return Rl(r.keyType,n)||Rl(r.valueType,n);case`set`:return Rl(r.valueType,n);case`promise`:case`optional`:case`nonoptional`:case`nullable`:case`readonly`:return Rl(r.innerType,n);case`lazy`:return Rl(r.getter(),n);case`default`:return Rl(r.innerType,n);case`prefault`:return Rl(r.innerType,n);case`custom`:return!1;case`transform`:return!0;case`pipe`:return Rl(r.in,n)||Rl(r.out,n);case`success`:return!1;case`catch`:return!1;default:}throw Error(`Unknown schema type: ${r.type}`)}var zl,Bl=t((()=>{jc(),Za(),zl=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ac,this.target=e?.target??`draft-2020-12`,this.unrepresentable=e?.unrepresentable??`throw`,this.override=e?.override??(()=>{}),this.io=e?.io??`output`,this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var n;let r=e._zod.def,i={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},a=this.seen.get(e);if(a)return a.count++,t.schemaPath.includes(e)&&(a.cycle=t.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let n={...t,schemaPath:[...t.schemaPath,e],path:t.path},a=e._zod.parent;if(a)o.ref=a,this.process(a,n),this.seen.get(a).isParent=!0;else{let t=o.schema;switch(r.type){case`string`:{let n=t;n.type=`string`;let{minimum:r,maximum:a,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof r==`number`&&(n.minLength=r),typeof a==`number`&&(n.maxLength=a),s&&(n.format=i[s]??s,n.format===``&&delete n.format),l&&(n.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?n.pattern=e[0].source:e.length>1&&(o.schema.allOf=[...e.map(e=>({...this.target===`draft-7`?{type:`string`}:{},pattern:e.source}))])}break}case`number`:{let n=t,{minimum:r,maximum:i,format:a,multipleOf:o,exclusiveMaximum:s,exclusiveMinimum:c}=e._zod.bag;typeof a==`string`&&a.includes(`int`)?n.type=`integer`:n.type=`number`,typeof c==`number`&&(n.exclusiveMinimum=c),typeof r==`number`&&(n.minimum=r,typeof c==`number`&&(c>=r?delete n.minimum:delete n.exclusiveMinimum)),typeof s==`number`&&(n.exclusiveMaximum=s),typeof i==`number`&&(n.maximum=i,typeof s==`number`&&(s<=i?delete n.maximum:delete n.exclusiveMaximum)),typeof o==`number`&&(n.multipleOf=o);break}case`boolean`:{let e=t;e.type=`boolean`;break}case`bigint`:if(this.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`);break;case`symbol`:if(this.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`);break;case`null`:t.type=`null`;break;case`any`:break;case`unknown`:break;case`undefined`:if(this.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`);break;case`void`:if(this.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`);break;case`never`:t.not={};break;case`date`:if(this.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`);break;case`array`:{let i=t,{minimum:a,maximum:o}=e._zod.bag;typeof a==`number`&&(i.minItems=a),typeof o==`number`&&(i.maxItems=o),i.type=`array`,i.items=this.process(r.element,{...n,path:[...n.path,`items`]});break}case`object`:{let e=t;e.type=`object`,e.properties={};let i=r.shape;for(let t in i)e.properties[t]=this.process(i[t],{...n,path:[...n.path,`properties`,t]});let a=new Set(Object.keys(i)),o=new Set([...a].filter(e=>{let t=r.shape[e]._zod;return this.io===`input`?t.optin===void 0:t.optout===void 0}));o.size>0&&(e.required=Array.from(o)),r.catchall?._zod.def.type===`never`?e.additionalProperties=!1:r.catchall?r.catchall&&(e.additionalProperties=this.process(r.catchall,{...n,path:[...n.path,`additionalProperties`]})):this.io===`output`&&(e.additionalProperties=!1);break}case`union`:{let e=t;e.anyOf=r.options.map((e,t)=>this.process(e,{...n,path:[...n.path,`anyOf`,t]}));break}case`intersection`:{let e=t,i=this.process(r.left,{...n,path:[...n.path,`allOf`,0]}),a=this.process(r.right,{...n,path:[...n.path,`allOf`,1]}),o=e=>`allOf`in e&&Object.keys(e).length===1;e.allOf=[...o(i)?i.allOf:[i],...o(a)?a.allOf:[a]];break}case`tuple`:{let i=t;i.type=`array`;let a=r.items.map((e,t)=>this.process(e,{...n,path:[...n.path,`prefixItems`,t]}));if(this.target===`draft-2020-12`?i.prefixItems=a:i.items=a,r.rest){let e=this.process(r.rest,{...n,path:[...n.path,`items`]});this.target===`draft-2020-12`?i.items=e:i.additionalItems=e}r.rest&&(i.items=this.process(r.rest,{...n,path:[...n.path,`items`]}));let{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s);break}case`record`:{let e=t;e.type=`object`,e.propertyNames=this.process(r.keyType,{...n,path:[...n.path,`propertyNames`]}),e.additionalProperties=this.process(r.valueType,{...n,path:[...n.path,`additionalProperties`]});break}case`map`:if(this.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`);break;case`set`:if(this.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`);break;case`enum`:{let e=t,n=ba(r.entries);n.every(e=>typeof e==`number`)&&(e.type=`number`),n.every(e=>typeof e==`string`)&&(e.type=`string`),e.enum=n;break}case`literal`:{let e=t,n=[];for(let e of r.values)if(e===void 0){if(this.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(this.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);n.push(Number(e))}else n.push(e);if(n.length!==0)if(n.length===1){let t=n[0];e.type=t===null?`null`:typeof t,e.const=t}else n.every(e=>typeof e==`number`)&&(e.type=`number`),n.every(e=>typeof e==`string`)&&(e.type=`string`),n.every(e=>typeof e==`boolean`)&&(e.type=`string`),n.every(e=>e===null)&&(e.type=`null`),e.enum=n;break}case`file`:{let n=t,r={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:i,maximum:a,mime:o}=e._zod.bag;i!==void 0&&(r.minLength=i),a!==void 0&&(r.maxLength=a),o?o.length===1?(r.contentMediaType=o[0],Object.assign(n,r)):n.anyOf=o.map(e=>({...r,contentMediaType:e})):Object.assign(n,r);break}case`transform`:if(this.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`);break;case`nullable`:t.anyOf=[this.process(r.innerType,n),{type:`null`}];break;case`nonoptional`:this.process(r.innerType,n),o.ref=r.innerType;break;case`success`:{let e=t;e.type=`boolean`;break}case`default`:this.process(r.innerType,n),o.ref=r.innerType,t.default=JSON.parse(JSON.stringify(r.defaultValue));break;case`prefault`:this.process(r.innerType,n),o.ref=r.innerType,this.io===`input`&&(t._prefault=JSON.parse(JSON.stringify(r.defaultValue)));break;case`catch`:{this.process(r.innerType,n),o.ref=r.innerType;let e;try{e=r.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}t.default=e;break}case`nan`:if(this.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`);break;case`template_literal`:{let n=t,r=e._zod.pattern;if(!r)throw Error(`Pattern not found in template literal`);n.type=`string`,n.pattern=r.source;break}case`pipe`:{let e=this.io===`input`?r.in._zod.def.type===`transform`?r.out:r.in:r.out;this.process(e,n),o.ref=e;break}case`readonly`:this.process(r.innerType,n),o.ref=r.innerType,t.readOnly=!0;break;case`promise`:this.process(r.innerType,n),o.ref=r.innerType;break;case`optional`:this.process(r.innerType,n),o.ref=r.innerType;break;case`lazy`:{let t=e._zod.innerType;this.process(t,n),o.ref=t;break}case`custom`:if(this.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`);break;default:}}}let c=this.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),this.io===`input`&&Rl(e)&&(delete o.schema.examples,delete o.schema.default),this.io===`input`&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,this.seen.get(e).schema}emit(e,t){let n={cycles:t?.cycles??`ref`,reused:t?.reused??`inline`,external:t?.external??void 0},r=this.seen.get(e);if(!r)throw Error(`Unprocessed schema. This is a bug in Zod.`);let i=e=>{let t=this.target===`draft-2020-12`?`$defs`:`definitions`;if(n.external){let r=n.external.registry.get(e[0])?.id,i=n.external.uri??(e=>e);if(r)return{ref:i(r)};let a=e[1].defId??e[1].schema.id??`schema${this.counter++}`;return e[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${t}/${a}`}}if(e[1]===r)return{ref:`#`};let i=`#/${t}/`,a=e[1].schema.id??`__schema${this.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(n.cycles===`throw`)for(let e of this.seen.entries()){let t=e[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join(`/`)}/<root>
|
|
29
|
+
|
|
30
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let t of this.seen.entries()){let r=t[1];if(e===t[0]){a(t);continue}if(n.external){let r=n.external.registry.get(t[0])?.id;if(e!==t[0]&&r){a(t);continue}}if(this.metadataRegistry.get(t[0])?.id){a(t);continue}if(r.cycle){a(t);continue}if(r.count>1&&n.reused===`ref`){a(t);continue}}let o=(e,t)=>{let n=this.seen.get(e),r=n.def??n.schema,i={...r};if(n.ref===null)return;let a=n.ref;if(n.ref=null,a){o(a,t);let e=this.seen.get(a).schema;e.$ref&&t.target===`draft-7`?(r.allOf=r.allOf??[],r.allOf.push(e)):(Object.assign(r,e),Object.assign(r,i))}n.isParent||this.override({zodSchema:e,jsonSchema:r,path:n.path??[]})};for(let e of[...this.seen.entries()].reverse())o(e[0],{target:this.target});let s={};if(this.target===`draft-2020-12`?s.$schema=`https://json-schema.org/draft/2020-12/schema`:this.target===`draft-7`?s.$schema=`http://json-schema.org/draft-07/schema#`:console.warn(`Invalid target: ${this.target}`),n.external?.uri){let t=n.external.registry.get(e)?.id;if(!t)throw Error("Schema is missing an `id` property");s.$id=n.external.uri(t)}Object.assign(s,r.def);let c=n.external?.defs??{};for(let e of this.seen.entries()){let t=e[1];t.def&&t.defId&&(c[t.defId]=t.def)}n.external||Object.keys(c).length>0&&(this.target===`draft-2020-12`?s.$defs=c:s.definitions=c);try{return JSON.parse(JSON.stringify(s))}catch{throw Error(`Error converting schema to JSON.`)}}}})),Vl=t((()=>{ya(),uo(),ro(),Dc(),cs(),fs(),Za(),Wo(),jc(),us(),Il(),Fl(),Bl()})),Hl=t((()=>{Vl()}));function Ul(e){return tl(ql,e)}function Wl(e){return nl(Jl,e)}function Gl(e){return rl(Yl,e)}function Kl(e){return il(Xl,e)}var ql,Jl,Yl,Xl,Zl=t((()=>{Vl(),Od(),ql=P(`ZodISODateTime`,(e,t)=>{Hs.init(e,t),Fu.init(e,t)}),Jl=P(`ZodISODate`,(e,t)=>{Us.init(e,t),Fu.init(e,t)}),Yl=P(`ZodISOTime`,(e,t)=>{Ws.init(e,t),Fu.init(e,t)}),Xl=P(`ZodISODuration`,(e,t)=>{Gs.init(e,t),Fu.init(e,t)})})),Ql,$l,eu=t((()=>{Vl(),Ql=(e,t)=>{to.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>$a(e,t)},flatten:{value:t=>Qa(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get(){return e.issues.length===0}}})},P(`ZodError`,Ql),$l=P(`ZodError`,Ql,{Parent:Error})})),tu,nu,ru,iu,au=t((()=>{Vl(),eu(),tu=io($l),nu=ao($l),ru=oo($l),iu=co($l)}));function F(e){return Mc(Pu,e)}function I(e){return al(td,e)}function ou(e){return sl(nd,e)}function su(e){return cl(rd,e)}function cu(e){return ll(id,e)}function lu(){return ul(ad)}function uu(){return dl(od)}function du(e){return fl(sd,e)}function L(e,t){return Ml(cd,e,t)}function R(e,t){let n={type:`object`,get shape(){return Da(this,`shape`,{...e}),this.shape},...Na(t)};return new ld(n)}function fu(e,t){return new ld({type:`object`,get shape(){return Da(this,`shape`,{...e}),this.shape},catchall:uu(),...Na(t)})}function z(e,t){return new ud({type:`union`,options:e,...Na(t)})}function pu(e,t,n){return new dd({type:`union`,options:t,discriminator:e,...Na(n)})}function mu(e,t){return new fd({type:`intersection`,left:e,right:t})}function hu(e,t,n){let r=t instanceof Os;return new pd({type:`tuple`,items:e,rest:r?t:null,...Na(r?n:t)})}function gu(e,t,n){return new md({type:`record`,keyType:e,valueType:t,...Na(n)})}function B(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new hd({type:`enum`,entries:n,...Na(t)})}function V(e,t){return new gd({type:`literal`,values:Array.isArray(e)?e:[e],...Na(t)})}function _u(e){return new _d({type:`transform`,transform:e})}function vu(e){return new vd({type:`optional`,innerType:e})}function yu(e){return new yd({type:`nullable`,innerType:e})}function bu(e,t){return new bd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}function xu(e,t){return new xd({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}function Su(e,t){return new Sd({type:`nonoptional`,innerType:e,...Na(t)})}function Cu(e,t){return new Cd({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}function wu(e,t){return new wd({type:`pipe`,in:e,out:t})}function Tu(e){return new Td({type:`readonly`,innerType:e})}function Eu(e){return new Ed({type:`lazy`,getter:e})}function Du(e){let t=new Go({check:`custom`});return t._zod.check=e,t}function Ou(e,t){return Nl(Dd,e??(()=>!0),t)}function ku(e,t={}){return Pl(Dd,e,t)}function Au(e){let t=Du(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Ka(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Ka(r))}},e(n.value,n)));return t}function ju(e,t={error:`Input not instance of ${e.name}`}){let n=new Dd({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...Na(t)});return n._zod.bag.Class=e,n}var Mu,Nu,Pu,Fu,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd,Od=t((()=>{Vl(),Hl(),Zl(),au(),Mu=P(`ZodType`,(e,t)=>(Os.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),e.clone=(t,n)=>Ma(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>tu(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ru(e,t,n),e.parseAsync=async(t,n)=>nu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>iu(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(ku(t,n)),e.superRefine=t=>e.check(Au(t)),e.overwrite=t=>e.check(Dl(t)),e.optional=()=>vu(e),e.nullable=()=>yu(e),e.nullish=()=>vu(yu(e)),e.nonoptional=t=>Su(e,t),e.array=()=>L(e),e.or=t=>z([e,t]),e.and=t=>mu(e,t),e.transform=t=>wu(e,_u(t)),e.default=t=>bu(e,t),e.prefault=t=>xu(e,t),e.catch=t=>Cu(e,t),e.pipe=t=>wu(e,t),e.readonly=()=>Tu(e),e.describe=t=>{let n=e.clone();return Ac.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return Ac.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Ac.get(e);let n=e.clone();return Ac.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Nu=P(`_ZodString`,(e,t)=>{ks.init(e,t),Mu.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(xl(...t)),e.includes=(...t)=>e.check(wl(...t)),e.startsWith=(...t)=>e.check(Tl(...t)),e.endsWith=(...t)=>e.check(El(...t)),e.min=(...t)=>e.check(yl(...t)),e.max=(...t)=>e.check(vl(...t)),e.length=(...t)=>e.check(bl(...t)),e.nonempty=(...t)=>e.check(yl(1,...t)),e.lowercase=t=>e.check(Sl(t)),e.uppercase=t=>e.check(Cl(t)),e.trim=()=>e.check(kl()),e.normalize=(...t)=>e.check(Ol(...t)),e.toLowerCase=()=>e.check(Al()),e.toUpperCase=()=>e.check(jl())}),Pu=P(`ZodString`,(e,t)=>{ks.init(e,t),Nu.init(e,t),e.email=t=>e.check(Nc(Iu,t)),e.url=t=>e.check(zc(zu,t)),e.jwt=t=>e.check(el(ed,t)),e.emoji=t=>e.check(Bc(Bu,t)),e.guid=t=>e.check(Pc(Lu,t)),e.uuid=t=>e.check(Fc(Ru,t)),e.uuidv4=t=>e.check(Ic(Ru,t)),e.uuidv6=t=>e.check(Lc(Ru,t)),e.uuidv7=t=>e.check(Rc(Ru,t)),e.nanoid=t=>e.check(Vc(Vu,t)),e.guid=t=>e.check(Pc(Lu,t)),e.cuid=t=>e.check(Hc(Hu,t)),e.cuid2=t=>e.check(Uc(Uu,t)),e.ulid=t=>e.check(Wc(Wu,t)),e.base64=t=>e.check(Zc(Zu,t)),e.base64url=t=>e.check(Qc(Qu,t)),e.xid=t=>e.check(Gc(Gu,t)),e.ksuid=t=>e.check(Kc(Ku,t)),e.ipv4=t=>e.check(qc(qu,t)),e.ipv6=t=>e.check(Jc(Ju,t)),e.cidrv4=t=>e.check(Yc(Yu,t)),e.cidrv6=t=>e.check(Xc(Xu,t)),e.e164=t=>e.check($c($u,t)),e.datetime=t=>e.check(Ul(t)),e.date=t=>e.check(Wl(t)),e.time=t=>e.check(Gl(t)),e.duration=t=>e.check(Kl(t))}),Fu=P(`ZodStringFormat`,(e,t)=>{As.init(e,t),Nu.init(e,t)}),Iu=P(`ZodEmail`,(e,t)=>{Ns.init(e,t),Fu.init(e,t)}),Lu=P(`ZodGUID`,(e,t)=>{js.init(e,t),Fu.init(e,t)}),Ru=P(`ZodUUID`,(e,t)=>{Ms.init(e,t),Fu.init(e,t)}),zu=P(`ZodURL`,(e,t)=>{Ps.init(e,t),Fu.init(e,t)}),Bu=P(`ZodEmoji`,(e,t)=>{Fs.init(e,t),Fu.init(e,t)}),Vu=P(`ZodNanoID`,(e,t)=>{Is.init(e,t),Fu.init(e,t)}),Hu=P(`ZodCUID`,(e,t)=>{Ls.init(e,t),Fu.init(e,t)}),Uu=P(`ZodCUID2`,(e,t)=>{Rs.init(e,t),Fu.init(e,t)}),Wu=P(`ZodULID`,(e,t)=>{zs.init(e,t),Fu.init(e,t)}),Gu=P(`ZodXID`,(e,t)=>{Bs.init(e,t),Fu.init(e,t)}),Ku=P(`ZodKSUID`,(e,t)=>{Vs.init(e,t),Fu.init(e,t)}),qu=P(`ZodIPv4`,(e,t)=>{Ks.init(e,t),Fu.init(e,t)}),Ju=P(`ZodIPv6`,(e,t)=>{qs.init(e,t),Fu.init(e,t)}),Yu=P(`ZodCIDRv4`,(e,t)=>{Js.init(e,t),Fu.init(e,t)}),Xu=P(`ZodCIDRv6`,(e,t)=>{Ys.init(e,t),Fu.init(e,t)}),Zu=P(`ZodBase64`,(e,t)=>{Xs.init(e,t),Fu.init(e,t)}),Qu=P(`ZodBase64URL`,(e,t)=>{Zs.init(e,t),Fu.init(e,t)}),$u=P(`ZodE164`,(e,t)=>{Qs.init(e,t),Fu.init(e,t)}),ed=P(`ZodJWT`,(e,t)=>{$s.init(e,t),Fu.init(e,t)}),td=P(`ZodNumber`,(e,t)=>{ec.init(e,t),Mu.init(e,t),e.gt=(t,n)=>e.check(hl(t,n)),e.gte=(t,n)=>e.check(gl(t,n)),e.min=(t,n)=>e.check(gl(t,n)),e.lt=(t,n)=>e.check(pl(t,n)),e.lte=(t,n)=>e.check(ml(t,n)),e.max=(t,n)=>e.check(ml(t,n)),e.int=t=>e.check(ou(t)),e.safe=t=>e.check(ou(t)),e.positive=t=>e.check(hl(0,t)),e.nonnegative=t=>e.check(gl(0,t)),e.negative=t=>e.check(pl(0,t)),e.nonpositive=t=>e.check(ml(0,t)),e.multipleOf=(t,n)=>e.check(_l(t,n)),e.step=(t,n)=>e.check(_l(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}),nd=P(`ZodNumberFormat`,(e,t)=>{tc.init(e,t),td.init(e,t)}),rd=P(`ZodBoolean`,(e,t)=>{nc.init(e,t),Mu.init(e,t)}),id=P(`ZodNull`,(e,t)=>{rc.init(e,t),Mu.init(e,t)}),ad=P(`ZodAny`,(e,t)=>{ic.init(e,t),Mu.init(e,t)}),od=P(`ZodUnknown`,(e,t)=>{ac.init(e,t),Mu.init(e,t)}),sd=P(`ZodNever`,(e,t)=>{oc.init(e,t),Mu.init(e,t)}),cd=P(`ZodArray`,(e,t)=>{sc.init(e,t),Mu.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(yl(t,n)),e.nonempty=t=>e.check(yl(1,t)),e.max=(t,n)=>e.check(vl(t,n)),e.length=(t,n)=>e.check(bl(t,n)),e.unwrap=()=>e.element}),ld=P(`ZodObject`,(e,t)=>{cc.init(e,t),Mu.init(e,t),Ea(e,`shape`,()=>t.shape),e.keyof=()=>B(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:uu()}),e.loose=()=>e.clone({...e._zod.def,catchall:uu()}),e.strict=()=>e.clone({...e._zod.def,catchall:du()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>La(e,t),e.merge=t=>Ra(e,t),e.pick=t=>Fa(e,t),e.omit=t=>Ia(e,t),e.partial=(...t)=>za(vd,e,t[0]),e.required=(...t)=>Ba(Sd,e,t[0])}),ud=P(`ZodUnion`,(e,t)=>{lc.init(e,t),Mu.init(e,t),e.options=t.options}),dd=P(`ZodDiscriminatedUnion`,(e,t)=>{ud.init(e,t),uc.init(e,t)}),fd=P(`ZodIntersection`,(e,t)=>{dc.init(e,t),Mu.init(e,t)}),pd=P(`ZodTuple`,(e,t)=>{fc.init(e,t),Mu.init(e,t),e.rest=t=>e.clone({...e._zod.def,rest:t})}),md=P(`ZodRecord`,(e,t)=>{pc.init(e,t),Mu.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}),hd=P(`ZodEnum`,(e,t)=>{mc.init(e,t),Mu.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new hd({...t,checks:[],...Na(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new hd({...t,checks:[],...Na(r),entries:i})}}),gd=P(`ZodLiteral`,(e,t)=>{hc.init(e,t),Mu.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}),_d=P(`ZodTransform`,(e,t)=>{gc.init(e,t),Mu.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ka(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,t.continue??=!0,n.issues.push(Ka(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}}),vd=P(`ZodOptional`,(e,t)=>{_c.init(e,t),Mu.init(e,t),e.unwrap=()=>e._zod.def.innerType}),yd=P(`ZodNullable`,(e,t)=>{vc.init(e,t),Mu.init(e,t),e.unwrap=()=>e._zod.def.innerType}),bd=P(`ZodDefault`,(e,t)=>{yc.init(e,t),Mu.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),xd=P(`ZodPrefault`,(e,t)=>{bc.init(e,t),Mu.init(e,t),e.unwrap=()=>e._zod.def.innerType}),Sd=P(`ZodNonOptional`,(e,t)=>{xc.init(e,t),Mu.init(e,t),e.unwrap=()=>e._zod.def.innerType}),Cd=P(`ZodCatch`,(e,t)=>{Sc.init(e,t),Mu.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),wd=P(`ZodPipe`,(e,t)=>{Cc.init(e,t),Mu.init(e,t),e.in=t.in,e.out=t.out}),Td=P(`ZodReadonly`,(e,t)=>{wc.init(e,t),Mu.init(e,t)}),Ed=P(`ZodLazy`,(e,t)=>{Tc.init(e,t),Mu.init(e,t),e.unwrap=()=>e._zod.def.getter()}),Dd=P(`ZodCustom`,(e,t)=>{Ec.init(e,t),Mu.init(e,t)})})),kd=t((()=>{Vl()}));function Ad(e){return ol(td,e)}var jd=t((()=>{Vl(),Od()})),Md=t((()=>{Vl(),Od(),Hl(),eu(),au(),kd(),Za(),Zl(),jd()})),Nd=t((()=>{Md(),Md()})),Pd=t((()=>{Nd()})),Fd,Id,Ld,Rd,zd=t((()=>{(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(Fd||={}),(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Id||={}),Ld=Fd.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Rd=e=>{switch(typeof e){case`undefined`:return Ld.undefined;case`string`:return Ld.string;case`number`:return Number.isNaN(e)?Ld.nan:Ld.number;case`boolean`:return Ld.boolean;case`function`:return Ld.function;case`bigint`:return Ld.bigint;case`symbol`:return Ld.symbol;case`object`:return Array.isArray(e)?Ld.array:e===null?Ld.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?Ld.promise:typeof Map<`u`&&e instanceof Map?Ld.map:typeof Set<`u`&&e instanceof Set?Ld.set:typeof Date<`u`&&e instanceof Date?Ld.date:Ld.object;default:return Ld.unknown}}})),H,Bd,Vd=t((()=>{zd(),H=Fd.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),Bd=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Fd.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}},Bd.create=e=>new Bd(e)})),Hd,Ud=t((()=>{Vd(),zd(),Hd=(e,t)=>{let n;switch(e.code){case H.invalid_type:n=e.received===Ld.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case H.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Fd.jsonStringifyReplacer)}`;break;case H.unrecognized_keys:n=`Unrecognized key(s) in object: ${Fd.joinValues(e.keys,`, `)}`;break;case H.invalid_union:n=`Invalid input`;break;case H.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Fd.joinValues(e.options)}`;break;case H.invalid_enum_value:n=`Invalid enum value. Expected ${Fd.joinValues(e.options)}, received '${e.received}'`;break;case H.invalid_arguments:n=`Invalid function arguments`;break;case H.invalid_return_type:n=`Invalid function return type`;break;case H.invalid_date:n=`Invalid date`;break;case H.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Fd.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case H.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case H.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case H.custom:n=`Invalid input`;break;case H.invalid_intersection_types:n=`Intersection results could not be merged`;break;case H.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case H.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,Fd.assertNever(e)}return{message:n}}}));function Wd(){return Gd}var Gd,Kd=t((()=>{Ud(),Gd=Hd}));function U(e,t){let n=Wd(),r=qd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Hd?void 0:Hd].filter(e=>!!e)});e.common.issues.push(r)}var qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf=t((()=>{Kd(),Ud(),qd=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},Jd=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return Yd;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return Yd;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}},Yd=Object.freeze({status:`aborted`}),Xd=e=>({status:`dirty`,value:e}),Zd=e=>({status:`valid`,value:e}),Qd=e=>e.status===`aborted`,$d=e=>e.status===`dirty`,ef=e=>e.status===`valid`,tf=e=>typeof Promise<`u`&&e instanceof Promise})),rf=t((()=>{})),af,of=t((()=>{(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(af||={})}));function sf(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}function cf(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function lf(e){return RegExp(`^${cf(e)}$`)}function uf(e){let t=`${Lf}T${cf(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function df(e,t){return!!((t===`v4`||!t)&&jf.test(e)||(t===`v6`||!t)&&Nf.test(e))}function ff(e,t){if(!Ef.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function pf(e,t){return!!((t===`v4`||!t)&&Mf.test(e)||(t===`v6`||!t)&&Pf.test(e))}function mf(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 hf(e){if(e instanceof Qf){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=mp.create(hf(r))}return new Qf({...e._def,shape:()=>t})}else if(e instanceof Zf)return new Zf({...e._def,type:hf(e.element)});else if(e instanceof mp)return mp.create(hf(e.unwrap()));else if(e instanceof hp)return hp.create(hf(e.unwrap()));else if(e instanceof rp)return rp.create(e.items.map(e=>hf(e)));else return e}function gf(e,t){let n=Rd(e),r=Rd(t);if(e===t)return{valid:!0,data:e};if(n===Ld.object&&r===Ld.object){let n=Fd.objectKeys(t),r=Fd.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=gf(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===Ld.array&&r===Ld.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=gf(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===Ld.date&&r===Ld.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}function _f(e,t){return new up({values:e,typeName:W.ZodEnum,...sf(t)})}var 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,ep,tp,np,rp,ip,ap,op,sp,cp,lp,up,dp,fp,pp,mp,hp,gp,_p,vp,yp,bp,xp,W,Sp,Cp,wp,Tp,Ep=t((()=>{Vd(),Kd(),of(),nf(),zd(),vf=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},yf=(e,t)=>{if(ef(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Bd(e.common.issues);return this._error=t,this._error}}},bf=class{get description(){return this._def.description}_getType(e){return Rd(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Rd(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Jd,ctx:{common:e.parent.common,data:e.data,parsedType:Rd(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(tf(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rd(e)},r=this._parseSync({data:e,path:n.path,parent:n});return yf(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rd(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return ef(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>ef(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rd(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(tf(r)?r:Promise.resolve(r));return yf(n,i)}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:H.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new pp({schema:this,typeName:W.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return mp.create(this,this._def)}nullable(){return hp.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zf.create(this)}promise(){return fp.create(this,this._def)}or(e){return $f.create([this,e],this._def)}and(e){return np.create(this,e,this._def)}transform(e){return new pp({...sf(this._def),schema:this,typeName:W.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new gp({...sf(this._def),innerType:this,defaultValue:t,typeName:W.ZodDefault})}brand(){return new yp({typeName:W.ZodBranded,type:this,...sf(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new _p({...sf(this._def),innerType:this,catchValue:t,typeName:W.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return bp.create(this,e)}readonly(){return xp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},xf=/^c[^\s-]{8,}$/i,Sf=/^[0-9a-z]+$/,Cf=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wf=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Tf=/^[a-z0-9_-]{21}$/i,Ef=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Df=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Of=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kf=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,jf=/^(?:(?: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])$/,Mf=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Nf=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Pf=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ff=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,If=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lf=`((\\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])))`,Rf=RegExp(`^${Lf}$`),zf=class e extends bf{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ld.string){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.string,received:t.parsedType}),Yd}let t=new Jd,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),U(n,{code:H.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),U(n,{code:H.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?U(n,{code:H.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&U(n,{code:H.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)Of.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`email`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Af||=new RegExp(kf,`u`),Af.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`emoji`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)wf.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`uuid`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)Tf.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`nanoid`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)xf.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`cuid`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)Sf.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`cuid2`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)Cf.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`ulid`,code:H.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),U(n,{validation:`url`,code:H.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`regex`,code:H.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),U(n,{code:H.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),U(n,{code:H.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),U(n,{code:H.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?uf(r).test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{code:H.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Rf.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{code:H.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?lf(r).test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{code:H.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?Df.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`duration`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?df(e.data,r.version)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`ip`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?ff(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`jwt`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?pf(e.data,r.version)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`cidr`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?Ff.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`base64`,code:H.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?If.test(e.data)||(n=this._getOrReturnCtx(e,n),U(n,{validation:`base64url`,code:H.invalid_string,message:r.message}),t.dirty()):Fd.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:H.invalid_string,...af.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...af.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...af.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...af.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...af.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...af.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...af.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...af.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...af.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...af.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...af.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...af.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...af.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...af.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...af.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...af.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...af.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...af.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...af.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...af.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...af.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...af.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...af.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...af.errToObj(t)})}nonempty(e){return this.min(1,af.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}},zf.create=e=>new zf({checks:[],typeName:W.ZodString,coerce:e?.coerce??!1,...sf(e)}),Bf=class e extends bf{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ld.number){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.number,received:t.parsedType}),Yd}let t,n=new Jd;for(let r of this._def.checks)r.kind===`int`?Fd.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),U(t,{code:H.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),U(t,{code:H.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),U(t,{code:H.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?mf(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),U(t,{code:H.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),U(t,{code:H.not_finite,message:r.message}),n.dirty()):Fd.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,af.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,af.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,af.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,af.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:af.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:af.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:af.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:af.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:af.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:af.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:af.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:af.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:af.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:af.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&Fd.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}},Bf.create=e=>new Bf({checks:[],typeName:W.ZodNumber,coerce:e?.coerce||!1,...sf(e)}),Vf=class e extends bf{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ld.bigint)return this._getInvalidInput(e);let t,n=new Jd;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),U(t,{code:H.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),U(t,{code:H.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),U(t,{code:H.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Fd.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.bigint,received:t.parsedType}),Yd}gte(e,t){return this.setLimit(`min`,e,!0,af.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,af.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,af.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,af.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:af.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:af.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:af.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:af.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:af.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:af.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}},Vf.create=e=>new Vf({checks:[],typeName:W.ZodBigInt,coerce:e?.coerce??!1,...sf(e)}),Hf=class extends bf{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ld.boolean){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.boolean,received:t.parsedType}),Yd}return Zd(e.data)}},Hf.create=e=>new Hf({typeName:W.ZodBoolean,coerce:e?.coerce||!1,...sf(e)}),Uf=class e extends bf{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ld.date){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.date,received:t.parsedType}),Yd}if(Number.isNaN(e.data.getTime()))return U(this._getOrReturnCtx(e),{code:H.invalid_date}),Yd;let t=new Jd,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),U(n,{code:H.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),U(n,{code:H.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):Fd.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:af.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:af.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}},Uf.create=e=>new Uf({checks:[],coerce:e?.coerce||!1,typeName:W.ZodDate,...sf(e)}),Wf=class extends bf{_parse(e){if(this._getType(e)!==Ld.symbol){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.symbol,received:t.parsedType}),Yd}return Zd(e.data)}},Wf.create=e=>new Wf({typeName:W.ZodSymbol,...sf(e)}),Gf=class extends bf{_parse(e){if(this._getType(e)!==Ld.undefined){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.undefined,received:t.parsedType}),Yd}return Zd(e.data)}},Gf.create=e=>new Gf({typeName:W.ZodUndefined,...sf(e)}),Kf=class extends bf{_parse(e){if(this._getType(e)!==Ld.null){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.null,received:t.parsedType}),Yd}return Zd(e.data)}},Kf.create=e=>new Kf({typeName:W.ZodNull,...sf(e)}),qf=class extends bf{constructor(){super(...arguments),this._any=!0}_parse(e){return Zd(e.data)}},qf.create=e=>new qf({typeName:W.ZodAny,...sf(e)}),Jf=class extends bf{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Zd(e.data)}},Jf.create=e=>new Jf({typeName:W.ZodUnknown,...sf(e)}),Yf=class extends bf{_parse(e){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.never,received:t.parsedType}),Yd}},Yf.create=e=>new Yf({typeName:W.ZodNever,...sf(e)}),Xf=class extends bf{_parse(e){if(this._getType(e)!==Ld.undefined){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.void,received:t.parsedType}),Yd}return Zd(e.data)}},Xf.create=e=>new Xf({typeName:W.ZodVoid,...sf(e)}),Zf=class e extends bf{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Ld.array)return U(t,{code:H.invalid_type,expected:Ld.array,received:t.parsedType}),Yd;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(U(t,{code:e?H.too_big:H.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(U(t,{code:H.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(U(t,{code:H.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new vf(t,e,t.path,n)))).then(e=>Jd.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new vf(t,e,t.path,n)));return Jd.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:af.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:af.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:af.toString(n)}})}nonempty(e){return this.min(1,e)}},Zf.create=(e,t)=>new Zf({type:e,minLength:null,maxLength:null,exactLength:null,typeName:W.ZodArray,...sf(t)}),Qf=class e extends bf{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=Fd.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ld.object){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.object,received:t.parsedType}),Yd}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Yf&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new vf(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Yf){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(U(n,{code:H.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new vf(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Jd.mergeObjectSync(t,e)):Jd.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return af.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:af.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:W.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of Fd.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of Fd.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return hf(this)}partial(t){let n={};for(let e of Fd.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of Fd.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof mp;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return _f(Fd.objectKeys(this.shape))}},Qf.create=(e,t)=>new Qf({shape:()=>e,unknownKeys:`strip`,catchall:Yf.create(),typeName:W.ZodObject,...sf(t)}),Qf.strictCreate=(e,t)=>new Qf({shape:()=>e,unknownKeys:`strict`,catchall:Yf.create(),typeName:W.ZodObject,...sf(t)}),Qf.lazycreate=(e,t)=>new Qf({shape:e,unknownKeys:`strip`,catchall:Yf.create(),typeName:W.ZodObject,...sf(t)}),$f=class extends bf{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Bd(e.ctx.common.issues));return U(t,{code:H.invalid_union,unionErrors:n}),Yd}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Bd(e));return U(t,{code:H.invalid_union,unionErrors:i}),Yd}}get options(){return this._def.options}},$f.create=(e,t)=>new $f({options:e,typeName:W.ZodUnion,...sf(t)}),ep=e=>e instanceof cp?ep(e.schema):e instanceof pp?ep(e.innerType()):e instanceof lp?[e.value]:e instanceof up?e.options:e instanceof dp?Fd.objectValues(e.enum):e instanceof gp?ep(e._def.innerType):e instanceof Gf?[void 0]:e instanceof Kf?[null]:e instanceof mp?[void 0,...ep(e.unwrap())]:e instanceof hp?[null,...ep(e.unwrap())]:e instanceof yp||e instanceof xp?ep(e.unwrap()):e instanceof _p?ep(e._def.innerType):[],tp=class e extends bf{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ld.object)return U(t,{code:H.invalid_type,expected:Ld.object,received:t.parsedType}),Yd;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(U(t,{code:H.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Yd)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=ep(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:W.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...sf(r)})}},np=class extends bf{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Qd(e)||Qd(r))return Yd;let i=gf(e.value,r.value);return i.valid?(($d(e)||$d(r))&&t.dirty(),{status:t.value,value:i.data}):(U(n,{code:H.invalid_intersection_types}),Yd)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}},np.create=(e,t,n)=>new np({left:e,right:t,typeName:W.ZodIntersection,...sf(n)}),rp=class e extends bf{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ld.array)return U(n,{code:H.invalid_type,expected:Ld.array,received:n.parsedType}),Yd;if(n.data.length<this._def.items.length)return U(n,{code:H.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),Yd;!this._def.rest&&n.data.length>this._def.items.length&&(U(n,{code:H.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new vf(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Jd.mergeArray(t,e)):Jd.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}},rp.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new rp({items:e,typeName:W.ZodTuple,rest:null,...sf(t)})},ip=class e extends bf{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ld.object)return U(n,{code:H.invalid_type,expected:Ld.object,received:n.parsedType}),Yd;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new vf(n,e,n.path,e)),value:a._parse(new vf(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Jd.mergeObjectAsync(t,r):Jd.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof bf?new e({keyType:t,valueType:n,typeName:W.ZodRecord,...sf(r)}):new e({keyType:zf.create(),valueType:t,typeName:W.ZodRecord,...sf(n)})}},ap=class extends bf{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ld.map)return U(n,{code:H.invalid_type,expected:Ld.map,received:n.parsedType}),Yd;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new vf(n,e,n.path,[a,`key`])),value:i._parse(new vf(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return Yd;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return Yd;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}},ap.create=(e,t,n)=>new ap({valueType:t,keyType:e,typeName:W.ZodMap,...sf(n)}),op=class e extends bf{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ld.set)return U(n,{code:H.invalid_type,expected:Ld.set,received:n.parsedType}),Yd;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(U(n,{code:H.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(U(n,{code:H.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return Yd;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new vf(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:af.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:af.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},op.create=(e,t)=>new op({valueType:e,minSize:null,maxSize:null,typeName:W.ZodSet,...sf(t)}),sp=class e extends bf{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ld.function)return U(t,{code:H.invalid_type,expected:Ld.function,received:t.parsedType}),Yd;function n(e,n){return qd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Wd(),Hd].filter(e=>!!e),issueData:{code:H.invalid_arguments,argumentsError:n}})}function r(e,n){return qd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Wd(),Hd].filter(e=>!!e),issueData:{code:H.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof fp){let e=this;return Zd(async function(...t){let o=new Bd([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return Zd(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Bd([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Bd([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:rp.create(t).rest(Jf.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||rp.create([]).rest(Jf.create()),returns:n||Jf.create(),typeName:W.ZodFunction,...sf(r)})}},cp=class extends bf{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}},cp.create=(e,t)=>new cp({getter:e,typeName:W.ZodLazy,...sf(t)}),lp=class extends bf{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return U(t,{received:t.data,code:H.invalid_literal,expected:this._def.value}),Yd}return{status:`valid`,value:e.data}}get value(){return this._def.value}},lp.create=(e,t)=>new lp({value:e,typeName:W.ZodLiteral,...sf(t)}),up=class e extends bf{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return U(t,{expected:Fd.joinValues(n),received:t.parsedType,code:H.invalid_type}),Yd}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return U(t,{received:t.data,code:H.invalid_enum_value,options:n}),Yd}return Zd(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}},up.create=_f,dp=class extends bf{_parse(e){let t=Fd.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Ld.string&&n.parsedType!==Ld.number){let e=Fd.objectValues(t);return U(n,{expected:Fd.joinValues(e),received:n.parsedType,code:H.invalid_type}),Yd}if(this._cache||=new Set(Fd.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=Fd.objectValues(t);return U(n,{received:n.data,code:H.invalid_enum_value,options:e}),Yd}return Zd(e.data)}get enum(){return this._def.values}},dp.create=(e,t)=>new dp({values:e,typeName:W.ZodNativeEnum,...sf(t)}),fp=class extends bf{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==Ld.promise&&t.common.async===!1?(U(t,{code:H.invalid_type,expected:Ld.promise,received:t.parsedType}),Yd):Zd((t.parsedType===Ld.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}},fp.create=(e,t)=>new fp({type:e,typeName:W.ZodPromise,...sf(t)}),pp=class extends bf{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===W.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{U(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return Yd;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?Yd:r.status===`dirty`||t.value===`dirty`?Xd(r.value):r});{if(t.value===`aborted`)return Yd;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?Yd:r.status===`dirty`||t.value===`dirty`?Xd(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?Yd:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?Yd:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ef(e))return Yd;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>ef(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Yd);Fd.assertNever(r)}},pp.create=(e,t,n)=>new pp({schema:e,typeName:W.ZodEffects,effect:t,...sf(n)}),pp.createWithPreprocess=(e,t,n)=>new pp({schema:t,effect:{type:`preprocess`,transform:e},typeName:W.ZodEffects,...sf(n)}),mp=class extends bf{_parse(e){return this._getType(e)===Ld.undefined?Zd(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},mp.create=(e,t)=>new mp({innerType:e,typeName:W.ZodOptional,...sf(t)}),hp=class extends bf{_parse(e){return this._getType(e)===Ld.null?Zd(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},hp.create=(e,t)=>new hp({innerType:e,typeName:W.ZodNullable,...sf(t)}),gp=class extends bf{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Ld.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},gp.create=(e,t)=>new gp({innerType:e,typeName:W.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...sf(t)}),_p=class extends bf{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return tf(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Bd(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Bd(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}},_p.create=(e,t)=>new _p({innerType:e,typeName:W.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...sf(t)}),vp=class extends bf{_parse(e){if(this._getType(e)!==Ld.nan){let t=this._getOrReturnCtx(e);return U(t,{code:H.invalid_type,expected:Ld.nan,received:t.parsedType}),Yd}return{status:`valid`,value:e.data}}},vp.create=e=>new vp({typeName:W.ZodNaN,...sf(e)}),yp=class extends bf{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},bp=class e extends bf{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Yd:e.status===`dirty`?(t.dirty(),Xd(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?Yd:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:W.ZodPipeline})}},xp=class extends bf{_parse(e){let t=this._def.innerType._parse(e),n=e=>(ef(e)&&(e.value=Object.freeze(e.value)),e);return tf(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}},xp.create=(e,t)=>new xp({innerType:e,typeName:W.ZodReadonly,...sf(t)}),Qf.lazycreate,(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(W||={}),Sp=zf.create,Cp=Bf.create,vp.create,Vf.create,Hf.create,Uf.create,Wf.create,Gf.create,Kf.create,qf.create,Jf.create,Yf.create,Xf.create,wp=Zf.create,Tp=Qf.create,Qf.strictCreate,$f.create,tp.create,np.create,rp.create,ip.create,ap.create,op.create,sp.create,cp.create,lp.create,up.create,dp.create,fp.create,pp.create,mp.create,hp.create,pp.createWithPreprocess,bp.create})),Dp=t((()=>{Kd(),nf(),rf(),zd(),Ep(),Vd()})),Op=t((()=>{Dp()}));function kp(e){}function Ap(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=kp,onError:n=kp,onRetry:r=kp,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(`
|
|
31
|
+
`)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new Np(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(`
|
|
32
|
+
`,n);for(;r!==-1;){if(n===r){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0,n=r+1,r=e.indexOf(`
|
|
33
|
+
`,n);continue}let i=e.charCodeAt(n);if(jp(e,n,i)){let i=e.charCodeAt(n+5)===Ip?n+6:n+5,a=e.slice(i,r);if(d===0&&e.charCodeAt(r+1)===Pp){t({id:l,event:f,data:a}),l=void 0,u=``,f=void 0,n=r+2,r=e.indexOf(`
|
|
34
|
+
`,n);continue}u=d===0?a:`${u}
|
|
35
|
+
${a}`,d++}else Mp(e,n,i)?f=e.slice(e.charCodeAt(n+6)===Ip?n+7:n+6,r)||void 0:_(e,n,r);n=r+1,r=e.indexOf(`
|
|
36
|
+
`,n)}return e.slice(n)}for(;n<e.length;){let t=e.indexOf(`\r`,n),r=e.indexOf(`
|
|
37
|
+
`,n),i=-1;if(t!==-1&&r!==-1?i=t<r?t:r:t===-1?r!==-1&&(i=r):i=t===e.length-1?-1:t,i===-1)break;_(e,n,i),n=i+1,e.charCodeAt(n-1)===Fp&&e.charCodeAt(n)===Pp&&n++}return e.slice(n)}function _(e,t,n){if(t===n){y();return}let r=e.charCodeAt(t);if(jp(e,t,r)){let r=e.charCodeAt(t+5)===Ip?t+6:t+5,i=e.slice(r,n);u=d===0?i:`${u}
|
|
38
|
+
${i}`,d++;return}if(Mp(e,t,r)){f=e.slice(e.charCodeAt(t+6)===Ip?t+7:t+6,n)||void 0;return}if(r===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let r=e.slice(e.charCodeAt(t+3)===Ip?t+4:t+3,n);l=r.includes(`\0`)?void 0:r;return}if(r===58){if(i){let r=e.slice(t,n);i(r.slice(e.charCodeAt(t+1)===Ip?2:1))}return}let a=e.slice(t,n),o=a.indexOf(`:`);if(o===-1){v(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===Ip?2:1;v(s,a.slice(o+c),a)}function v(e,t,i){switch(e){case`event`:f=t||void 0;break;case`data`:u=d===0?t:`${u}
|
|
39
|
+
${t}`,d++;break;case`id`:l=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new Np(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new Np(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function y(){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0}function b(e={}){if(e.consume&&o.length>0){let e=o.join(``);_(e,0,e.length)}c=!0,l=void 0,u=``,d=0,f=void 0,o.length=0,s=0,p=!1}return{feed:m,reset:b}}function jp(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Mp(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var Np,Pp,Fp,Ip,Lp=t((()=>{Np=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},Pp=10,Fp=13,Ip=32})),Rp,zp=t((()=>{Lp(),Rp=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n,maxBufferSize:r}={}){let i;super({start(a){i=Ap({onEvent:e=>{a.enqueue(e)},onError(t){typeof e==`function`&&e(t),(e===`terminate`||t.type===`max-buffer-size-exceeded`)&&a.error(t)},onRetry:t,onComment:n,maxBufferSize:r})},transform(e){i.feed(e)}})}}})),Bp,Vp,Hp=t((()=>{Bp=Symbol.for(`workflow-serialize`),Vp=Symbol.for(`workflow-deserialize`)}));function Up(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function Wp(...e){return e.reduce((e,t)=>({...e,...t??{}}),{})}function Gp(e){let t=Kh(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.codePointAt(0))}function Kp(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCodePoint(e[n]);return Gh(t)}function qp(e){return e instanceof Uint8Array?Kp(e):e}function Jp(e){return e.type===`text`?new TextEncoder().encode(e.text):e.data instanceof Uint8Array?e.data:e.data instanceof ArrayBuffer?new Uint8Array(e.data):Gp(e.data)}function Yp(e,t={}){let{useArrayBrackets:n=!0}=t,r=new FormData;for(let[t,i]of Object.entries(e))if(i!=null){if(Array.isArray(i)){if(i.length===1){r.append(t,i[0]);continue}let e=n?`${t}[]`:t;for(let t of i)r.append(e,t);continue}r.append(t,i)}return r}function Xp({tools:e=[],providerToolNames:t}){let n={},r={};for(let i of e)if(i.type===`provider`&&i.id in t){let e=t[i.id];n[i.name]=e,r[e]=i.name}return{toProviderToolName:e=>n[e]??e,toCustomToolName:e=>r[e]??e}}async function Zp(e,t){if(e==null)return Promise.resolve();let n=t?.abortSignal;return new Promise((t,r)=>{if(n?.aborted){r(Qp());return}let i=setTimeout(()=>{a(),t()},e),a=()=>{clearTimeout(i),n?.removeEventListener(`abort`,o)},o=()=>{a(),r(Qp())};n?.addEventListener(`abort`,o)})}function Qp(){return new DOMException(`Delay was aborted`,`AbortError`)}function $p(e){return typeof e==`string`&&e.startsWith(`SUQz`)||typeof e!=`string`&&e.length>10&&e[0]===73&&e[1]===68&&e[2]===51?Qh(e):e}function em({data:e,signatures:t}){let n=$p(e),r=typeof n==`string`?Gp(n.substring(0,Math.min(n.length,24))):n;for(let e of t)if(r.length>=e.bytesPrefix.length&&e.bytesPrefix.every((e,t)=>e===null||r[t]===e))return e.mediaType}function tm({data:e,topLevelType:t}){if(t===void 0)return em({data:e,signatures:[...Jh,...Yh,...Xh,...Zh]});let n=$h[t];if(n!==void 0)return em({data:e,signatures:n})}function nm(e){let t=e.indexOf(`/`);return t===-1?e:e.substring(0,t)}function rm(e){let t=e.indexOf(`/`);if(t===-1)return!1;let n=e.substring(t+1);return n.length>0&&n!==`*`}async function im(e){try{await e.body?.cancel()}catch{}}function am(e=globalThis){return e.window!=null}function om(e){let t;try{t=new URL(e)}catch{throw new ag({url:e,message:`Invalid URL: ${e}`})}if(t.protocol===`data:`)return;if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new ag({url:e,message:`URL scheme must be http, https, or data, got ${t.protocol}`});let n=t.hostname.toLowerCase().replace(/\.+$/,``);if(!n)throw new ag({url:e,message:`URL must have a hostname`});if(n===`localhost`||n.endsWith(`.local`)||n.endsWith(`.localhost`))throw new ag({url:e,message:`URL with hostname ${n} is not allowed`});if(n.startsWith(`[`)&&n.endsWith(`]`)){if(um(n.slice(1,-1)))throw new ag({url:e,message:`URL with IPv6 address ${n} is not allowed`});return}if(sm(n)){if(cm(n))throw new ag({url:e,message:`URL with IP address ${n} is not allowed`});return}}function sm(e){let t=e.split(`.`);return t.length===4&&t.every(e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255&&String(t)===e})}function cm(e){let[t,n,r]=e.split(`.`).map(Number);return t===0||t===10||t===100&&n>=64&&n<=127||t===127||t===169&&n===254||t===172&&n>=16&&n<=31||t===192&&n===0&&r===0||t===192&&n===168||t===198&&(n===18||n===19)||t>=240}function lm(e){let t=e.toLowerCase(),n=t.indexOf(`%`);n!==-1&&(t=t.slice(0,n));let r=t.split(`::`);if(r.length>2)return null;let i=e=>{if(e===``)return[];let t=[],n=e.split(`:`);for(let e=0;e<n.length;e++){let r=n[e];if(r.includes(`.`)){if(e!==n.length-1||!sm(r))return null;let[i,a,o,s]=r.split(`.`).map(Number);t.push(i<<8|a,o<<8|s);continue}if(!/^[0-9a-f]{1,4}$/.test(r))return null;t.push(parseInt(r,16))}return t},a=i(r[0]);if(a===null)return null;if(r.length===2){let e=i(r[1]);if(e===null)return null;let t=8-a.length-e.length;return t<0?null:[...a,...Array(t).fill(0),...e]}return a.length===8?a:null}function um(e){let t=lm(e);if(t===null)return!0;let n=e=>t.slice(0,e).every(e=>e===0);return n(7)&&(t[7]===0||t[7]===1)||(t[0]&65024)==64512||(t[0]&65472)==65152||(t[0]&65472)==65216||(t[0]&65280)==65280?!0:n(6)||n(5)&&t[5]===65535||n(4)&&t[4]===65535&&t[5]===0||t[0]===100&&t[1]===65435&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===0||t[0]===100&&t[1]===65435&&t[2]===1?cm(`${t[6]>>8&255}.${t[6]&255}.${t[7]>>8&255}.${t[7]&255}`):!1}async function dm({url:e,headers:t,abortSignal:n,maxRedirects:r=og}){let i={signal:n};t!==void 0&&(i.headers=t);let a=e;for(let t=0;t<=r;t++){om(a);let t=await fetch(a,{...i,redirect:`manual`});if(t.type===`opaqueredirect`){if(!am())throw new ag({url:e,message:`Redirect from ${a} could not be validated and was blocked`});return await fetch(a,{...i,redirect:`follow`})}let n=t.headers.get(`location`);if(t.status>=300&&t.status<400&&n){await im(t),a=new URL(n,a).toString();continue}return t}throw new ag({url:e,message:`Too many redirects (max ${r})`})}async function fm({response:e,url:t,maxBytes:n=sg}){let r=e.headers.get(`content-length`);if(r!=null){let i=parseInt(r,10);if(!isNaN(i)&&i>n)throw await im(e),new ag({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes (Content-Length: ${i}).`})}let i=e.body;if(i==null)return new Uint8Array;let a=i.getReader(),o=[],s=0;try{for(;;){let{done:e,value:r}=await a.read();if(e)break;if(s+=r.length,s>n)throw new ag({url:t,message:`Download of ${t} exceeded maximum size of ${n} bytes.`});o.push(r)}}finally{try{await a.cancel()}finally{a.releaseLock()}}let c=new Uint8Array(s),l=0;for(let e of o)c.set(e,l),l+=e.length;return c}async function pm(e,t){try{let n=await dm({url:e,abortSignal:t?.abortSignal});if(!n.ok)throw await im(n),new ag({url:e,statusCode:n.status,statusText:n.statusText});let r=await fm({response:n,url:e,maxBytes:t?.maxBytes??sg}),i=n.headers.get(`content-type`)??void 0;return new Blob([r],i?{type:i}:void 0)}catch(t){throw ag.isInstance(t)?t:new ag({url:e,cause:t})}}function mm(e){return Object.fromEntries([...e.headers])}function hm(e){return(e instanceof Error||e instanceof DOMException)&&(e.name===`AbortError`||e.name===`ResponseAborted`||e.name===`TimeoutError`)}function gm(e){if(!(e instanceof Error))return!1;let t=e.code;return!!(typeof t==`string`&&dg.includes(t))}function _m({error:e,url:t,requestBodyValues:n}){if(hm(e))return e;if(e instanceof TypeError&&ug.includes(e.message.toLowerCase())){let r=e.cause;if(r!=null)return new ei({message:`Cannot connect to API: ${r.message}`,cause:r,url:t,requestBodyValues:n,isRetryable:!0})}return gm(e)?new ei({message:`Cannot connect to API: ${e.message}`,cause:e,url:t,requestBodyValues:n,isRetryable:!0}):e}function vm(e=globalThis){return e.window?`runtime/browser`:e.navigator?.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:e.process?.versions?.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?`runtime/vercel-edge`:`runtime/unknown`}function ym(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}function bm(e,...t){let n=new Headers(ym(e)),r=n.get(`user-agent`)||``;return n.set(`user-agent`,[r,...t].filter(Boolean).join(` `)),Object.fromEntries(n.entries())}function xm(e){return globalThis.Buffer?.isBuffer(e)??!1}function Sm(e){return e!=null}function Cm(e){return typeof e==`object`&&!!e&&!(e instanceof Uint8Array)&&!(e instanceof URL)&&!(e instanceof ArrayBuffer)&&!xm(e)&&!(`type`in e)}function wm({mediaType:e,url:t,supportedUrls:n}){t=t.toLowerCase(),e=e.toLowerCase();let r=!e.includes(`/`);return Object.entries(n).map(([e,t])=>{let n=e.toLowerCase();return n===`*`||n===`*/*`?{mediaTypePrefix:``,regexes:t}:{mediaTypePrefix:n.replace(/\*/,``),regexes:t}}).filter(({mediaTypePrefix:t})=>t===``?!0:r?`${e}/`===t:e.startsWith(t)).flatMap(({regexes:e})=>e).some(e=>e.test(t))}function Tm({apiKey:e,environmentVariableName:t,apiKeyParameterName:n=`apiKey`,description:r}){if(typeof e==`string`)return e;if(e!=null)throw new Ii({message:`${r} API key must be a string.`});if(typeof process>`u`)throw new Ii({message:`${r} API key is missing. Pass it using the '${n}' parameter. Environment variables are not supported in this environment.`});if(e=process.env[t],e==null)throw new Ii({message:`${r} API key is missing. Pass it using the '${n}' parameter or the ${t} environment variable.`});if(typeof e!=`string`)throw new Ii({message:`${r} API key must be a string. The value of the ${t} environment variable is not a string.`});return e}function Em({settingValue:e,environmentVariableName:t}){if(typeof e==`string`||!(e!=null||typeof process>`u`)&&(e=process.env[t],!(e==null||typeof e!=`string`)))return e}function Dm(e){return e!==void 0&&e!==`provider-default`}function Om({reasoning:e,effortMap:t,warnings:n}){let r=t[e];if(r==null){n.push({type:`unsupported`,feature:`reasoning`,details:`reasoning "${e}" is not supported by this model.`});return}return r!==e&&n.push({type:`compatibility`,feature:`reasoning`,details:`reasoning "${e}" is not directly supported by this model. mapped to effort "${r}".`}),r}function km({reasoning:e,maxOutputTokens:t,maxReasoningBudget:n,minReasoningBudget:r=1024,budgetPercentages:i=hg,warnings:a}){let o=i[e];if(o==null){a.push({type:`unsupported`,feature:`reasoning`,details:`reasoning "${e}" is not supported by this model.`});return}return Math.min(n,Math.max(r,Math.round(t*o)))}function Am(e){let[t,n=``]=e.toLowerCase().split(`/`);return{mpeg:`mp3`,"x-wav":`wav`,opus:`ogg`,mp4:`m4a`,"x-m4a":`m4a`}[n]??n}function jm(e){let t=JSON.parse(e);return typeof t!=`object`||!t||gg.test(e)===!1&&_g.test(e)===!1?t:Mm(t)}function Mm(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&n.constructor!==null&&typeof n.constructor==`object`&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function Nm(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return jm(e)}try{return jm(e)}finally{Error.stackTraceLimit=t}}function Pm(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){e.additionalProperties=!1;let{properties:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=Fm(t[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(Fm):Fm(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(Fm)),e.allOf!=null&&(e.allOf=e.allOf.map(Fm)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(Fm));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=Fm(t[e]);return e}function Fm(e){return typeof e==`boolean`?e:Pm(e)}function Im(){return{}}function Lm(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==W.ZodAny&&(n.items=hh(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}function Rm(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function zm(){return{type:`boolean`}}function Bm(e,t){return hh(e.type._def,t)}function Vm(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>Vm(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return Sg(e)}}function Hm(e,t){return{...hh(e.innerType._def,t),default:e.defaultValue()}}function Um(e,t){return t.effectStrategy===`input`?hh(e.schema._def,t):Im()}function Wm(e){return{type:`string`,enum:Array.from(e.values)}}function Gm(e,t){let n=[hh(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),hh(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(Cg(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}r.push(t)}}),r.length?{allOf:r}:void 0}function Km(e){let t=typeof e.value;return t!==`bigint`&&t!==`number`&&t!==`boolean`&&t!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:{type:t===`bigint`?`integer`:t,const:e.value}}function qm(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value;break;case`max`:n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`email`:switch(t.emailStrategy){case`format:email`:Xm(n,`email`,r.message,t);break;case`format:idn-email`:Xm(n,`idn-email`,r.message,t);break;case`pattern:zod`:Zm(n,Tg.email,r.message,t);break}break;case`url`:Xm(n,`uri`,r.message,t);break;case`uuid`:Xm(n,`uuid`,r.message,t);break;case`regex`:Zm(n,r.regex,r.message,t);break;case`cuid`:Zm(n,Tg.cuid,r.message,t);break;case`cuid2`:Zm(n,Tg.cuid2,r.message,t);break;case`startsWith`:Zm(n,RegExp(`^${Jm(r.value,t)}`),r.message,t);break;case`endsWith`:Zm(n,RegExp(`${Jm(r.value,t)}$`),r.message,t);break;case`datetime`:Xm(n,`date-time`,r.message,t);break;case`date`:Xm(n,`date`,r.message,t);break;case`time`:Xm(n,`time`,r.message,t);break;case`duration`:Xm(n,`duration`,r.message,t);break;case`length`:n.minLength=typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value;break;case`includes`:Zm(n,RegExp(Jm(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&Xm(n,`ipv4`,r.message,t),r.version!==`v4`&&Xm(n,`ipv6`,r.message,t);break;case`base64url`:Zm(n,Tg.base64url,r.message,t);break;case`jwt`:Zm(n,Tg.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&Zm(n,Tg.ipv4Cidr,r.message,t),r.version!==`v4`&&Zm(n,Tg.ipv6Cidr,r.message,t);break;case`emoji`:Zm(n,Tg.emoji(),r.message,t);break;case`ulid`:Zm(n,Tg.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:Xm(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:Zm(n,Tg.base64,r.message,t);break}break;case`nanoid`:Zm(n,Tg.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:}return n}function Jm(e,t){return t.patternStrategy===`escape`?Ym(e):e}function Ym(e){let t=``;for(let n=0;n<e.length;n++)Eg.has(e[n])||(t+=`\\`),t+=e[n];return t}function Xm(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function Zm(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Qm(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Qm(t,r)}function Qm(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;e<r.length;e++){if(a){i+=r[e],a=!1;continue}if(n.i){if(o){if(r[e].match(/[a-z]/)){s?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),s=!1):r[e+1]===`-`&&r[e+2]?.match(/[a-z]/)?(i+=r[e],s=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if(r[e]===`^`){i+=`(^|(?<=[\r
|
|
40
|
+
]))`;continue}else if(r[e]===`$`){i+=`($|(?=[\r
|
|
41
|
+
]))`;continue}}if(n.s&&r[e]===`.`){i+=o?`${r[e]}\r
|
|
42
|
+
`:`[${r[e]}\r
|
|
43
|
+
]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function $m(e,t){let n={type:`object`,additionalProperties:hh(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(e.keyType?._def.typeName===W.ZodString&&e.keyType._def.checks?.length){let{type:r,...i}=qm(e.keyType._def,t);return{...n,propertyNames:i}}else if(e.keyType?._def.typeName===W.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===W.ZodBranded&&e.keyType._def.type._def.typeName===W.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=Bm(e.keyType._def,t);return{...n,propertyNames:i}}return n}function eh(e,t){return t.mapStrategy===`record`?$m(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[hh(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||Im(),hh(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||Im()],minItems:2,maxItems:2}}}function th(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function nh(){return{not:Im()}}function rh(){return{type:`null`}}function ih(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in Dg&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=Dg[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return Og(e,t)}function ah(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Dg[e.innerType._def.typeName],`null`]};let n=hh(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function oh(e){let t={type:`number`};if(!e.checks)return t;for(let n of e.checks)switch(n.kind){case`int`:t.type=`integer`;break;case`min`:n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case`max`:n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case`multipleOf`:t.multipleOf=n.value;break}return t}function sh(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=lh(a),s=hh(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=ch(e,t);return a!==void 0&&(n.additionalProperties=a),n}function ch(e,t){if(e.catchall._def.typeName!==`ZodNever`)return hh(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function lh(e){try{return e.isOptional()}catch{return!0}}function uh(e,t){return hh(e.type._def,t)}function dh(e,t){let n={type:`array`,uniqueItems:!0,items:hh(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function fh(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>hh(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:hh(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>hh(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function ph(){return{not:Im()}}function mh(){return Im()}function hh(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.call(t,e,t,r,n);if(i!==vg)return i}if(r&&!n){let e=Pg(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=Mg(e,e.typeName,t),o=typeof a==`function`?hh(a(),t):a;if(o&&Fg(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}function G(e){let t;return()=>(t??=e(),t)}function gh(e,{validate:t}={}){return{[Rg]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function _h(e){return typeof e==`object`&&!!e&&Rg in e&&e[Rg]===!0&&`jsonSchema`in e&&`validate`in e}function vh(e){return e==null?gh({type:`object`,properties:{},additionalProperties:!1}):_h(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?K(e):yh(e):e()}function yh(e){return gh(()=>Pm(e[`~standard`].jsonSchema.input({target:`draft-07`})),{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new ca({value:t,cause:n.issues})}}})}function bh(e,t){let n=t?.useReferences??!1;return gh(()=>Lg(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function xh(e,t){let n=t?.useReferences??!1;return gh(()=>Pm(Ll(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await iu(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Sh(e){return`_zod`in e}function K(e,t){return Sh(e)?xh(e,t):bh(e,t)}async function Ch({value:e,schema:t,context:n}){let r=await wh({value:e,schema:t,context:n});if(!r.success)throw ca.wrap({value:e,cause:r.error,context:n});return r.value}async function wh({value:e,schema:t,context:n}){let r=vh(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:ca.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:ca.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function Th({text:e,schema:t}){try{let n=Nm(e);return t==null?n:await Ch({value:n,schema:t})}catch(t){throw Ai.isInstance(t)||ca.isInstance(t)?t:new Ai({text:e,cause:t})}}async function Eh({text:e,schema:t}){try{let n=Nm(e);return t==null?{success:!0,value:n,rawValue:n}:await wh({value:n,schema:t})}catch(t){return{success:!1,error:Ai.isInstance(t)?t:new Ai({text:e,cause:t}),rawValue:void 0}}}function Dh({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Rp).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await Eh({text:e,schema:t}))}}))}async function Oh({provider:e,providerOptions:t,schema:n}){if(t?.[e]==null)return;let r=await wh({value:t[e],schema:n});if(!r.success)throw new fi({argument:`providerOptions`,message:`invalid ${e} provider options`,cause:r.error});return r.value}function kh(e){return e}function Ah({id:e,inputSchema:t}){return({execute:n,outputSchema:r,needsApproval:i,toModelOutput:a,onInputStart:o,onInputDelta:s,onInputAvailable:c,...l})=>kh({type:`provider`,isProviderExecuted:!1,id:e,args:l,inputSchema:t,outputSchema:r,execute:n,needsApproval:i,toModelOutput:a,onInputStart:o,onInputDelta:s,onInputAvailable:c})}function jh({id:e,inputSchema:t,outputSchema:n}){return({execute:r,needsApproval:i,toModelOutput:a,onInputStart:o,onInputDelta:s,onInputAvailable:c,...l})=>kh({type:`provider`,isProviderExecuted:!1,id:e,args:l,inputSchema:t,outputSchema:n,execute:r,needsApproval:i,toModelOutput:a,onInputStart:o,onInputDelta:s,onInputAvailable:c})}function Mh({id:e,inputSchema:t,outputSchema:n,supportsDeferredResults:r}){return({onInputStart:i,onInputDelta:a,onInputAvailable:o,...s})=>kh({type:`provider`,isProviderExecuted:!0,id:e,args:s,inputSchema:t,outputSchema:n,onInputStart:i,onInputDelta:a,onInputAvailable:o,supportsDeferredResults:r})}async function Nh(e){return typeof e==`function`&&(e=e()),Promise.resolve(e)}function Ph({part:e}){if(rm(e.mediaType))return e.mediaType;if(e.data.type===`data`){let t=tm({data:e.data.data,topLevelType:nm(e.mediaType)});if(t)return t;throw new ma({functionality:`file of media type "${e.mediaType}" must specify subtype since it could not be auto-detected`})}throw new ma({functionality:`file of media type "${e.mediaType}" must specify subtype since it is not passed as inline bytes`})}function Fh({reference:e,provider:t}){let n=e[t];if(n!=null)return n;throw new Xi({provider:t,reference:e})}async function Ih(e,{maxRetries:t,delayInMs:n,backoffFactor:r,abortSignal:i,shouldRetry:a,getDelayInMs:o,createRetryError:s},c=[]){try{return await e()}catch(l){if(hm(l)||t===0)throw l;let u=Br(l),d=[...c,l],f=d.length;if(f>t)throw s({message:`Failed after ${f} attempts. Last error: ${u}`,reason:`maxRetriesExceeded`,errors:d});if(await a(l)&&f<=t)return await Zp(o({error:l,exponentialBackoffDelay:n}),{abortSignal:i}),Ih(e,{maxRetries:t,delayInMs:r*n,backoffFactor:r,abortSignal:i,shouldRetry:a,getDelayInMs:o,createRetryError:s},d);throw f===1?l:s({message:`Failed after ${f} attempts with non-retryable error: '${u}'`,reason:`errorNotRetryable`,errors:d})}}async function Lh({response:e,url:t}){return Wg.decode(await fm({response:e,url:t}))}function Rh(e){if(e==null)return!0;let t=typeof e;return t===`string`||t===`number`||t===`boolean`?!0:t===`function`||t===`symbol`||t===`bigint`?!1:Array.isArray(e)?e.every(Rh):Object.getPrototypeOf(e)===Object.prototype&&Object.values(e).every(Rh)}function zh(e){let t={};for(let[n,r]of Object.entries(e.config))if(n===`headers`){let e=Bh(r);Rh(e)&&(t[n]=e)}else Rh(r)&&(t[n]=r);return{modelId:e.modelId,config:t}}function Bh(e){let t=e;if(typeof e==`function`&&(t=e()),t instanceof Promise)throw Error(`Promise returned from resolveSync`);return t}function Vh(e){let t=e??globalThis.WebSocket;if(t==null)throw Error(`No WebSocket implementation available.`);return t}function Hh(e){let t=new URL(e);return t.protocol===`http:`?t.protocol=`ws:`:t.protocol===`https:`&&(t.protocol=`wss:`),t}async function Uh(e){return typeof e==`string`?e:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?Xg.decode(e):typeof Blob<`u`&&e instanceof Blob?e.text():String(e)}function Wh(e){return e?.replace(/\/$/,``)}var Gh,Kh,qh,Jh,Yh,Xh,Zh,Qh,$h,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=t((()=>{ha(),Pd(),Op(),zp(),Hp(),{btoa:Gh,atob:Kh}=globalThis,qh=class{constructor(){this.status={type:`pending`},this._resolve=void 0,this._reject=void 0}get promise(){return this._promise||=new Promise((e,t)=>{this.status.type===`resolved`?e(this.status.value):this.status.type===`rejected`&&t(this.status.error),this._resolve=e,this._reject=t}),this._promise}resolve(e){var t;this.status={type:`resolved`,value:e},this._promise&&((t=this._resolve)==null||t.call(this,e))}reject(e){var t;this.status={type:`rejected`,error:e},this._promise&&((t=this._reject)==null||t.call(this,e))}isResolved(){return this.status.type===`resolved`}isRejected(){return this.status.type===`rejected`}isPending(){return this.status.type===`pending`}},Jh=[{mediaType:`image/gif`,bytesPrefix:[71,73,70]},{mediaType:`image/png`,bytesPrefix:[137,80,78,71]},{mediaType:`image/jpeg`,bytesPrefix:[255,216]},{mediaType:`image/webp`,bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:`image/bmp`,bytesPrefix:[66,77]},{mediaType:`image/tiff`,bytesPrefix:[73,73,42,0]},{mediaType:`image/tiff`,bytesPrefix:[77,77,0,42]},{mediaType:`image/avif`,bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:`image/heic`,bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}],Yh=[{mediaType:`application/pdf`,bytesPrefix:[37,80,68,70]}],Xh=[{mediaType:`audio/mpeg`,bytesPrefix:[255,251]},{mediaType:`audio/mpeg`,bytesPrefix:[255,250]},{mediaType:`audio/mpeg`,bytesPrefix:[255,243]},{mediaType:`audio/mpeg`,bytesPrefix:[255,242]},{mediaType:`audio/mpeg`,bytesPrefix:[255,227]},{mediaType:`audio/mpeg`,bytesPrefix:[255,226]},{mediaType:`audio/wav`,bytesPrefix:[82,73,70,70,null,null,null,null,87,65,86,69]},{mediaType:`audio/ogg`,bytesPrefix:[79,103,103,83]},{mediaType:`audio/flac`,bytesPrefix:[102,76,97,67]},{mediaType:`audio/aac`,bytesPrefix:[64,21,0,0]},{mediaType:`audio/mp4`,bytesPrefix:[102,116,121,112]},{mediaType:`audio/webm`,bytesPrefix:[26,69,223,163]}],Zh=[{mediaType:`video/mp4`,bytesPrefix:[0,0,0,null,102,116,121,112]},{mediaType:`video/webm`,bytesPrefix:[26,69,223,163]},{mediaType:`video/quicktime`,bytesPrefix:[0,0,0,20,102,116,121,112,113,116]},{mediaType:`video/x-msvideo`,bytesPrefix:[82,73,70,70]}],Qh=e=>{let t=typeof e==`string`?Gp(e):e,n=(t[6]&127)<<21|(t[7]&127)<<14|(t[8]&127)<<7|t[9]&127;return t.slice(n+10)},$h={image:Jh,audio:Xh,video:Zh,application:Yh},eg=`AI_DownloadError`,tg=`vercel.ai.error.${eg}`,ng=Symbol.for(tg),ag=class extends (ig=Jr,rg=ng,ig){constructor({url:e,statusCode:t,statusText:n,cause:r,message:i=r==null?`Failed to download ${e}: ${t} ${n}`:`Failed to download ${e}: ${r}`}){super({name:eg,message:i,cause:r}),this[rg]=!0,this.url=e,this.statusCode=t,this.statusText=n}static isInstance(e){return Jr.hasMarker(e,tg)}},og=10,sg=2*1024*1024*1024,cg=({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i<t;i++)r[i]=n[Math.random()*e|0];return r.join(``)};if(e==null)return i;if(n.includes(r))throw new fi({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`},lg=cg(),ug=[`fetch failed`,`failed to fetch`],dg=[`ConnectionRefused`,`ConnectionClosed`,`FailedToOpenSocket`,`ECONNRESET`,`ECONNREFUSED`,`ETIMEDOUT`,`EPIPE`],fg=`5.0.7`,pg=()=>globalThis.fetch,mg=async({url:e,headers:t={},successfulResponseHandler:n,failedResponseHandler:r,abortSignal:i,fetch:a=pg()})=>{try{let o=await a(e,{method:`GET`,headers:bm(t,`ai-sdk/provider-utils/${fg}`,vm()),signal:i}),s=mm(o);if(!o.ok){let t;try{t=await r({response:o,url:e,requestBodyValues:{}})}catch(t){throw hm(t)||ei.isInstance(t)?t:new ei({message:`Failed to process error response`,cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}throw t.value}try{return await n({response:o,url:e,requestBodyValues:{}})}catch(t){throw t instanceof Error&&(hm(t)||ei.isInstance(t))?t:new ei({message:`Failed to process successful response`,cause:t,statusCode:o.status,url:e,responseHeaders:s,requestBodyValues:{}})}}catch(t){throw _m({error:t,url:e,requestBodyValues:{}})}},hg={minimal:.02,low:.1,medium:.3,high:.6,xhigh:.9},gg=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,_g=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,vg=Symbol(`Let zodToJsonSchema decide on which parser to use`),yg={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`},bg=e=>typeof e==`string`?{...yg,name:e}:{...yg,...e},xg=(e,t)=>hh(e.innerType._def,t),Sg=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value;break}return t},Cg=e=>`type`in e&&e.type===`string`?!1:`allOf`in e,wg=void 0,Tg={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(wg===void 0&&(wg=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),wg),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/},Eg=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`),Dg={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`},Og=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>hh(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0},kg=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return hh(e.innerType._def,t);let n=hh(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:Im()},n]}:Im()},Ag=(e,t)=>{if(t.pipeStrategy===`input`)return hh(e.in._def,t);if(t.pipeStrategy===`output`)return hh(e.out._def,t);let n=hh(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,hh(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}},jg=(e,t)=>hh(e.innerType._def,t),Mg=(e,t,n)=>{switch(t){case W.ZodString:return qm(e,n);case W.ZodNumber:return oh(e);case W.ZodObject:return sh(e,n);case W.ZodBigInt:return Rm(e);case W.ZodBoolean:return zm();case W.ZodDate:return Vm(e,n);case W.ZodUndefined:return ph();case W.ZodNull:return rh();case W.ZodArray:return Lm(e,n);case W.ZodUnion:case W.ZodDiscriminatedUnion:return ih(e,n);case W.ZodIntersection:return Gm(e,n);case W.ZodTuple:return fh(e,n);case W.ZodRecord:return $m(e,n);case W.ZodLiteral:return Km(e);case W.ZodEnum:return Wm(e);case W.ZodNativeEnum:return th(e);case W.ZodNullable:return ah(e,n);case W.ZodOptional:return kg(e,n);case W.ZodMap:return eh(e,n);case W.ZodSet:return dh(e,n);case W.ZodLazy:return()=>e.getter()._def;case W.ZodPromise:return uh(e,n);case W.ZodNaN:case W.ZodNever:return nh();case W.ZodEffects:return Um(e,n);case W.ZodAny:return Im();case W.ZodUnknown:return mh();case W.ZodDefault:return Hm(e,n);case W.ZodBranded:return Bm(e,n);case W.ZodReadonly:return jg(e,n);case W.ZodCatch:return xg(e,n);case W.ZodPipeline:return Ag(e,n);case W.ZodFunction:case W.ZodVoid:case W.ZodSymbol:return;default:return(e=>void 0)(t)}},Ng=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)},Pg=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:Ng(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),Im()):t.$refStrategy===`seen`?Im():void 0}},Fg=(e,t,n)=>(e.description&&(n.description=e.description),n),Ig=e=>{let t=bg(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},Lg=(e,t)=>{let n=Ig(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:hh(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??Im()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=hh(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??Im(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},Rg=Symbol.for(`vercel.ai.schema`),zg=()=>globalThis.fetch,Bg=async({url:e,headers:t,body:n,failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o})=>await Hg({url:e,headers:{"Content-Type":`application/json`,...t},body:{content:JSON.stringify(n),values:n},failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o}),Vg=async({url:e,headers:t,formData:n,failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o})=>await Hg({url:e,headers:t,body:{content:n,values:Object.fromEntries(n.entries())},failedResponseHandler:r,successfulResponseHandler:i,abortSignal:a,fetch:o}),Hg=async({url:e,headers:t={},body:n,successfulResponseHandler:r,failedResponseHandler:i,abortSignal:a,fetch:o=zg()})=>{try{let s=await o(e,{method:`POST`,headers:bm(t,`ai-sdk/provider-utils/${fg}`,vm()),body:n.content,signal:a}),c=mm(s);if(!s.ok){let t;try{t=await i({response:s,url:e,requestBodyValues:n.values})}catch(t){throw hm(t)||ei.isInstance(t)?t:new ei({message:`Failed to process error response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}throw t.value}try{return await r({response:s,url:e,requestBodyValues:n.values})}catch(t){throw t instanceof Error&&(hm(t)||ei.isInstance(t))?t:new ei({message:`Failed to process successful response`,cause:t,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:n.values})}}catch(t){throw _m({error:t,url:e,requestBodyValues:n.values})}},Ug=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:n=2,abortSignal:r,shouldRetry:i,getDelayInMs:a=({exponentialBackoffDelay:e})=>e,createRetryError:o=({message:e})=>Error(e)})=>async s=>Ih(s,{maxRetries:e,delayInMs:t,backoffFactor:n,abortSignal:r,shouldRetry:i,getDelayInMs:a,createRetryError:o}),Wg=new TextDecoder,Gg=({errorSchema:e,errorToMessage:t,isRetryable:n})=>async({response:r,url:i,requestBodyValues:a})=>{let o=await Lh({response:r,url:i}),s=mm(r);if(o.trim()===``)return{responseHeaders:s,value:new ei({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})};try{let c=await Th({text:o,schema:e});return{responseHeaders:s,value:new ei({message:t(c),url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,data:c,isRetryable:n?.(r,c)})}}catch{return{responseHeaders:s,value:new ei({message:r.statusText,url:i,requestBodyValues:a,statusCode:r.status,responseHeaders:s,responseBody:o,isRetryable:n?.(r)})}}},Kg=e=>async({response:t})=>{let n=mm(t);if(t.body==null)throw new oi({});return{responseHeaders:n,value:Dh({stream:t.body,schema:e})}},qg=e=>async({response:t,url:n,requestBodyValues:r})=>{let i=await Lh({response:t,url:n}),a=await Eh({text:i,schema:e}),o=mm(t);if(!a.success)throw new ei({message:`Invalid JSON response`,cause:a.error,statusCode:t.status,responseHeaders:o,responseBody:i,url:n,requestBodyValues:r});return{responseHeaders:o,value:a.value,rawValue:a.rawValue}},Jg=()=>async({response:e,url:t,requestBodyValues:n})=>{let r=mm(e);if(!e.body)throw new ei({message:`Response body is empty`,url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0});try{let t=await e.arrayBuffer();return{responseHeaders:r,value:new Uint8Array(t)}}catch(i){throw new ei({message:`Failed to read response as array buffer`,url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0,cause:i})}},Yg=class{constructor(e,t={}){this.toolCalls=[],this.controller=e,this._generateId=t.generateId??lg,this.typeValidation=t.typeValidation??`none`,this.extractMetadata=t.extractMetadata,this.buildToolCallProviderMetadata=t.buildToolCallProviderMetadata}processDelta(e){let t=e.index??this.toolCalls.length;this.toolCalls[t]==null?this.processNewToolCall(t,e):this.processExistingToolCall(t,e)}flush(){for(let e of this.toolCalls)e.hasFinished||this.finishToolCall(e)}processNewToolCall(e,t){if(this.typeValidation===`required`){if(t.type!==`function`)throw new wi({data:t,message:`Expected 'function' type.`})}else if(this.typeValidation===`if-present`&&t.type!=null&&t.type!==`function`)throw new wi({data:t,message:`Expected 'function' type.`});if(t.id==null)throw new wi({data:t,message:`Expected 'id' to be a string.`});if(t.function?.name==null)throw new wi({data:t,message:`Expected 'function.name' to be a string.`});this.controller.enqueue({type:`tool-input-start`,id:t.id,toolName:t.function.name});let n=this.extractMetadata?.call(this,t);this.toolCalls[e]={id:t.id,type:`function`,function:{name:t.function.name,arguments:t.function.arguments??``},hasFinished:!1,metadata:n};let r=this.toolCalls[e];r.function.arguments.length>0&&this.controller.enqueue({type:`tool-input-delta`,id:r.id,delta:r.function.arguments})}processExistingToolCall(e,t){let n=this.toolCalls[e];n.hasFinished||t.function?.arguments!=null&&(n.function.arguments+=t.function.arguments,this.controller.enqueue({type:`tool-input-delta`,id:n.id,delta:t.function.arguments}))}finishToolCall(e){this.controller.enqueue({type:`tool-input-end`,id:e.id});let t=this.buildToolCallProviderMetadata?.call(this,e.metadata);this.controller.enqueue({type:`tool-call`,toolCallId:e.id??this._generateId(),toolName:e.function.name,input:e.function.arguments,...t?{providerMetadata:t}:{}}),e.hasFinished=!0}},Xg=new TextDecoder}));function Qg(e){let t=e.startsWith(`o3`)||e.startsWith(`o4-mini`)||e.startsWith(`gpt-5`)&&!e.startsWith(`gpt-5-chat`),n=e.startsWith(`gpt-4`)||e.startsWith(`gpt-5`)&&!e.startsWith(`gpt-5-nano`)&&!e.startsWith(`gpt-5-chat`)&&!e.startsWith(`gpt-5.4-nano`)||e.startsWith(`o3`)||e.startsWith(`o4-mini`),r=e.startsWith(`o1`)||e.startsWith(`o3`)||e.startsWith(`o4-mini`)||e.startsWith(`gpt-5`)&&!e.startsWith(`gpt-5-chat`),i=e.startsWith(`gpt-5.1`)||e.startsWith(`gpt-5.2`)||e.startsWith(`gpt-5.3`)||e.startsWith(`gpt-5.4`)||e.startsWith(`gpt-5.5`)||e.startsWith(`gpt-5.6`);return{supportsFlexProcessing:t,supportsPriorityProcessing:n,isReasoningModel:r,systemMessageMode:r?`developer`:`system`,supportsNonReasoningParameters:i}}async function $g({stream:e,getError:t,isOutputChunk:n,url:r,requestBodyValues:i,responseHeaders:a}){let[o,s]=e.tee(),c=o.getReader();try{for(;;){let e=await c.read();if(e.done)return s;let o=e.value;if(!o.success)return s;let l=t(o.value);if(l!=null)throw s.cancel().catch(()=>{}),e_({frame:l,url:r,requestBodyValues:i,responseHeaders:a});if(n(o.value))return s}}finally{c.cancel().catch(()=>{}),c.releaseLock()}}function e_({frame:e,url:t,requestBodyValues:n,responseHeaders:r}){let i=t_(e);return new ei({message:i?.message??`OpenAI stream failed before any output was generated`,url:t,requestBodyValues:n,statusCode:i==null?500:n_(i),responseHeaders:r,responseBody:JSON.stringify(e),data:e})}function t_(e){let t=r_(e);if(t==null)return;if(t.type===`response.failed`){let n=r_(r_(t.response)?.error);return typeof n?.message==`string`?{message:n.message,code:i_(n.code),type:`response.failed`,frame:e}:void 0}let n=r_(t.error)??t;return typeof n.message==`string`&&(r_(t.error)!=null||typeof n.type==`string`||`code`in n||`param`in n)?{message:n.message,code:i_(n.code),type:typeof n.type==`string`?n.type:void 0,frame:e}:void 0}function n_(e){if(typeof e.code==`number`&&a_(e.code))return e.code;if(typeof e.code==`string`&&/^\d{3}$/.test(e.code)){let t=Number(e.code);if(a_(t))return t}let t=[e.code,e.type].filter(e=>typeof e==`string`||typeof e==`number`).join(` `).toLowerCase();return[`insufficient_quota`,`rate_limit`].some(e=>t.includes(e))?429:t.includes(`authentication`)?401:t.includes(`permission`)?403:t.includes(`not_found`)?404:[`invalid`,`bad_request`,`context_length`].some(e=>t.includes(e))?400:t.includes(`overload`)?503:t.includes(`timeout`)?504:500}function r_(e){return typeof e==`object`&&e?e:void 0}function i_(e){return typeof e==`string`||typeof e==`number`?e:void 0}function a_(e){return Number.isInteger(e)&&e>=400&&e<=599}function o_(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.prompt_tokens??0,n=e.completion_tokens??0,r=e.prompt_tokens_details?.cached_tokens??0,i=e.prompt_tokens_details?.cache_write_tokens??void 0,a=e.completion_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 s_(e){return JSON.stringify(e===void 0?{}:e)}function c_(e){return e?.openai?.promptCacheBreakpoint}function l_({prompt:e,systemMessageMode:t=`system`}){let n=[],r=[];for(let{role:i,content:a,providerOptions:o}of e)switch(i){case`system`:switch(t){case`system`:{let e=c_(o);n.push({role:`system`,content:e==null?a:[{type:`text`,text:a,prompt_cache_breakpoint:e}]});break}case`developer`:{let e=c_(o);n.push({role:`developer`,content:e==null?a:[{type:`text`,text:a,prompt_cache_breakpoint:e}]});break}case`remove`:r.push({type:`other`,message:`system messages are removed for this model`});break;default:throw Error(`Unsupported system message mode: ${t}`)}break;case`user`:if(a.length===1&&a[0].type===`text`&&c_(a[0].providerOptions)==null){n.push({role:`user`,content:a[0].text});break}n.push({role:`user`,content:a.map((e,t)=>{switch(e.type){case`text`:{let t=c_(e.providerOptions);return{type:`text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}}}case`file`:{let n=c_(e.providerOptions);switch(e.data.type){case`reference`:return{type:`file`,file:{file_id:Fh({reference:e.data.reference,provider:`openai`})},...n!=null&&{prompt_cache_breakpoint:n}};case`text`:throw new ma({functionality:`text file parts`});case`url`:case`data`:{let r=nm(e.mediaType);if(r===`image`)return{type:`image_url`,image_url:{url:e.data.type===`url`?e.data.url.toString():`data:${Ph({part:e})};base64,${qp(e.data.data)}`,detail:e.providerOptions?.openai?.imageDetail},...n!=null&&{prompt_cache_breakpoint:n}};if(r===`audio`){if(e.data.type===`url`)throw new ma({functionality:`audio file parts with URLs`});let t=Ph({part:e});switch(t){case`audio/wav`:return{type:`input_audio`,input_audio:{data:qp(e.data.data),format:`wav`},...n!=null&&{prompt_cache_breakpoint:n}};case`audio/mp3`:case`audio/mpeg`:return{type:`input_audio`,input_audio:{data:qp(e.data.data),format:`mp3`},...n!=null&&{prompt_cache_breakpoint:n}};default:throw new ma({functionality:`audio content parts with media type ${t}`})}}{let r=Ph({part:e});if(r!==`application/pdf`)throw new ma({functionality:`file part media type ${r}`});if(e.data.type===`url`)throw new ma({functionality:`PDF file parts with URLs`});return{type:`file`,file:{filename:e.filename??`part-${t}.pdf`,file_data:`data:application/pdf;base64,${qp(e.data.data)}`},...n!=null&&{prompt_cache_breakpoint:n}}}}}}}})});break;case`assistant`:{let e=``,t=[],r=!1,i=[];for(let n of a)switch(n.type){case`text`:{let i=c_(n.providerOptions);e+=n.text,t.push({type:`text`,text:n.text,...i!=null&&{prompt_cache_breakpoint:i}}),r||=i!=null;break}case`tool-call`:i.push({id:n.toolCallId,type:`function`,function:{name:n.toolName,arguments:s_(n.input)}});break}n.push({role:`assistant`,content:r?t:i.length>0?e||null:e,tool_calls:i.length>0?i:void 0});break}case`tool`:for(let e of a){if(e.type===`tool-approval-response`)continue;let t=e.output,r=(t.type===`content`?t.value.map(e=>c_(e.providerOptions)).find(e=>e!=null):c_(t.providerOptions))??c_(e.providerOptions),i;switch(t.type){case`text`:case`error-text`:i=t.value;break;case`execution-denied`:i=t.reason??`Tool call execution denied.`;break;case`content`:case`json`:case`error-json`:i=JSON.stringify(t.value);break}n.push({role:`tool`,tool_call_id:e.toolCallId,content:r==null?i:[{type:`text`,text:i,prompt_cache_breakpoint:r}]})}break;default:throw Error(`Unsupported role: ${i}`)}return{messages:n,warnings:r}}function u_({id:e,model:t,created:n}){return{id:e??void 0,modelId:t??void 0,timestamp:n?new Date(n*1e3):void 0}}function d_(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 f_({tools:e,toolChoice:t}){e=e?.length?e:void 0;let n=[];if(e==null)return{tools:void 0,toolChoice:void 0,toolWarnings:n};let r=[];for(let t of e)switch(t.type){case`function`:r.push({type:`function`,function:{name:t.name,description:t.description,parameters:t.inputSchema,...t.strict==null?{}:{strict:t.strict}}});break;default:n.push({type:`unsupported`,feature:`tool type: ${t.type}`});break}if(t==null)return{tools:r,toolChoice:void 0,toolWarnings:n};let i=t.type;switch(i){case`auto`:case`none`:case`required`:return{tools:r,toolChoice:i,toolWarnings:n};case`tool`:return{tools:r,toolChoice:{type:`function`,function:{name:t.toolName}},toolWarnings:n};default:throw new ma({functionality:`tool choice type: ${i}`})}}function p_(e){return`error`in e?!1:e.choices.some(e=>{let t=e.delta;return t?.content!=null&&t.content.length>0||t?.tool_calls!=null&&t.tool_calls.length>0||t?.annotations!=null&&t.annotations.length>0})}function m_(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.prompt_tokens??0,n=e.completion_tokens??0;return{inputTokens:{total:e.prompt_tokens??void 0,noCache:t,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:e.completion_tokens??void 0,text:n,reasoning:void 0},raw:e}}function h_({prompt:e,user:t=`user`,assistant:n=`assistant`}){let r=``;e[0].role===`system`&&(r+=`${e[0].content}
|
|
44
|
+
|
|
45
|
+
`,e=e.slice(1));for(let{role:i,content:a}of e)switch(i){case`system`:throw new vi({message:"Unexpected system message in prompt: ${content}",prompt:e});case`user`:{let e=a.map(e=>{switch(e.type){case`text`:return e.text}}).filter(Boolean).join(``);r+=`${t}:
|
|
46
|
+
${e}
|
|
47
|
+
|
|
48
|
+
`;break}case`assistant`:{let e=a.map(e=>{switch(e.type){case`text`:return e.text;case`tool-call`:throw new ma({functionality:`tool-call messages`})}}).join(``);r+=`${n}:
|
|
49
|
+
${e}
|
|
50
|
+
|
|
51
|
+
`;break}case`tool`:throw new ma({functionality:`tool messages`});default:throw Error(`Unsupported role: ${i}`)}return r+=`${n}:
|
|
52
|
+
`,{prompt:r,stopSequences:[`
|
|
53
|
+
${t}:`]}}function g_({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 __(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 v_(e){return!(`error`in e)&&e.choices.some(e=>e.text.length>0)}function y_(e){return Ev.some(t=>e.startsWith(t))}function b_(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 x_(e){if(!e)return;if(e.type===`url`)return pm(e.url);let t=e.data instanceof Uint8Array?e.data:Gp(e.data);return new Blob([t],{type:e.mediaType})}function S_(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 C_(e,t){switch(e.type){case`session-update`:return{type:`session.update`,session:w_(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 w_(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 T_(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 E_(e){return JSON.stringify(e===void 0?{}:e)}function D_(e,t){return e?.[t]?.promptCacheBreakpoint}function O_(e,t){return t?t.some(t=>e.startsWith(t)):!1}async function k_({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=D_(v,r);p.push({role:`system`,content:e==null?_:[{type:`input_text`,text:_,prompt_cache_breakpoint:e}]});break}case`developer`:{let e=D_(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=D_(e.providerOptions,r);return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}}}case`file`:{let n=D_(e.providerOptions,r);switch(e.data.type){case`reference`:{let t=Fh({reference:e.data.reference,provider:r});return nm(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 ma({functionality:`text file parts`});case`url`:case`data`:if(nm(e.mediaType)===`image`)return{type:`input_image`,...e.data.type===`url`?{image_url:e.data.url.toString()}:typeof e.data.data==`string`&&O_(e.data.data,i)?{file_id:e.data.data}:{image_url:`data:${Ph({part:e})};base64,${qp(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=Ph({part:e});if(r!==`application/pdf`&&!a)throw new ma({functionality:`file part media type ${r}`});return{type:`input_file`,...typeof e.data.data==`string`&&O_(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,${qp(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 Th({text:n.input,schema:ay}):await Ch({value:n.input,schema:ay}),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 Ch({value:n.input,schema:Xv});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 Ch({value:n.input,schema:$v});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 Ch({value:n.input,schema:jv});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:E_(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 Ch({value:n.output.value,schema:oy});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 Ch({value:n.output.value,schema:ey});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 Oh({provider:r,providerOptions:n.providerOptions,schema:by}),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 Ch({value:n.value,schema:oy});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 Ch({value:n.value,schema:Zv});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 Ch({value:n.value,schema:ey});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 Ch({value:n.value,schema:Mv});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=D_(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=nm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Ph({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${qp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${qp(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(Sm);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=D_(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=nm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Ph({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${qp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${qp(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(Sm);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 A_({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 j_({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=M_({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 ma({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 Ch({value:t.args,schema:Wv});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 Ch({value:t.args,schema:ny});o.push({type:`shell`,...e.environment&&{environment:N_(e.environment)}});break}case`openai.apply_patch`:o.push({type:`apply_patch`});break;case`openai.web_search_preview`:{let e=await Ch({value:t.args,schema:fy});o.push({type:`web_search_preview`,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case`openai.web_search`:{let e=await Ch({value:t.args,schema:ly});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 Ch({value:t.args,schema:Iv});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 Ch({value:t.args,schema:qv});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 Ch({value:t.args,schema:hy}),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 Ch({value:t.args,schema:zv});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 Ch({value:t.args,schema:iy});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 ma({functionality:`tool choice type: ${l}`})}}function M_({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 N_(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:P_(t.skills)}}return{type:`local`,skills:e.skills}}function P_(e){return e?.map(e=>e.type===`skillReference`?{type:`skill_reference`,skill_id:Fh({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 F_(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 I_(e){return e.type===`response.output_text.delta`}function L_(e){let t=z_(e);return t!=null&&Array.isArray(t.choices)&&typeof t.type!=`string`}function R_({value:e,cause:t,url:n,requestBodyValues:r,responseHeaders:i}){return new ei({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 z_(e){return typeof e==`object`&&e?e:void 0}function B_(e){return e.type===`response.output_item.done`}function V_(e){return e.type===`response.completed`||e.type===`response.incomplete`}function H_(e){return e.type===`response.failed`}function U_(e){return e.type===`response.created`}function W_(e){return e.type===`response.function_call_arguments.delta`}function G_(e){return e.type===`response.custom_tool_call_input.delta`}function K_(e){return e.type===`response.image_generation_call.partial_image`}function q_(e){return e.type===`response.code_interpreter_call_code.delta`}function J_(e){return e.type===`response.code_interpreter_call_code.done`}function Y_(e){return e.type===`response.apply_patch_call_operation_diff.delta`}function X_(e){return e.type===`response.apply_patch_call_operation_diff.done`}function Z_(e){return e.type===`response.output_item.added`}function Q_(e){return e.type===`response.output_text.annotation.added`}function $_(e){return e.type===`error`}function ev(e){return!(e.type===`response.created`||e.type===`response.failed`||e.type===`error`||e.type===`unknown_chunk`)}function tv(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 nv(e){return JSON.stringify(e).slice(1,-1)}function rv(e){return e===`gpt-realtime-whisper`||e.startsWith(`gpt-realtime-whisper-`)}function iv({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(Vh(e))(t,ov(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:qp(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=>{Uh(e.data).then(async e=>{let t=await Eh({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 av({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 ov(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 sv(e={}){let t=Wh(Em({settingValue:e.baseURL,environmentVariableName:`OPENAI_BASE_URL`}))??`https://api.openai.com/v1`,n=e.name??`openai`,r=()=>bm({Authorization:`Bearer ${Tm({apiKey:e.apiKey,environmentVariableName:`OPENAI_API_KEY`,description:`OpenAI`})}`,"OpenAI-Organization":e.organization,"OpenAI-Project":e.project,...e.headers},`ai-sdk/openai/${Ly}`),i=i=>new pv(i,{provider:`${n}.chat`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),a=i=>new _v(i,{provider:`${n}.completion`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),o=i=>new bv(i,{provider:`${n}.embedding`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),s=i=>new Av(i,{provider:`${n}.image`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),c=i=>new Py(i,{provider:`${n}.transcription`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,webSocket:e.webSocket}),l=i=>new Ay(i,{provider:`${n}.speech`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),u=()=>new Cv({provider:`${n}.files`,baseURL:t,headers:r,fetch:e.fetch}),d=()=>new Iy({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 Oy(i,{provider:`${n}.responses`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,fileIdPrefixes:[`file-`]}),m=i=>new yy(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=vy,g}var 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,Ry=t((()=>{Zg(),Pd(),ha(),cv=R({error:R({message:F(),type:F().nullish(),param:lu().nullish(),code:z([F(),I()]).nullish()})}),lv=Gg({errorSchema:cv,errorToMessage:e=>e.error.message}),uv=G(()=>K(R({id:F().nullish(),created:I().nullish(),model:F().nullish(),choices:L(R({message:R({role:V(`assistant`).nullish(),content:F().nullish(),tool_calls:L(R({id:F().nullish(),type:V(`function`),function:R({name:F(),arguments:F()})})).nullish(),annotations:L(R({type:V(`url_citation`),url_citation:R({start_index:I(),end_index:I(),url:F(),title:F()})})).nullish()}),index:I(),logprobs:R({content:L(R({token:F(),logprob:I(),top_logprobs:L(R({token:F(),logprob:I()}))})).nullish()}).nullish(),finish_reason:F().nullish()})),usage:R({prompt_tokens:I().nullish(),completion_tokens:I().nullish(),total_tokens:I().nullish(),prompt_tokens_details:R({cached_tokens:I().nullish(),cache_write_tokens:I().nullish()}).nullish(),completion_tokens_details:R({reasoning_tokens:I().nullish(),accepted_prediction_tokens:I().nullish(),rejected_prediction_tokens:I().nullish()}).nullish()}).nullish()}))),dv=G(()=>K(z([R({id:F().nullish(),created:I().nullish(),model:F().nullish(),choices:L(R({delta:R({role:B([`assistant`]).nullish(),content:F().nullish(),tool_calls:L(R({index:I(),id:F().nullish(),type:V(`function`).nullish(),function:R({name:F().nullish(),arguments:F().nullish()})})).nullish(),annotations:L(R({type:V(`url_citation`),url_citation:R({start_index:I(),end_index:I(),url:F(),title:F()})})).nullish()}).nullish(),logprobs:R({content:L(R({token:F(),logprob:I(),top_logprobs:L(R({token:F(),logprob:I()}))})).nullish()}).nullish(),finish_reason:F().nullish(),index:I()})),usage:R({prompt_tokens:I().nullish(),completion_tokens:I().nullish(),total_tokens:I().nullish(),prompt_tokens_details:R({cached_tokens:I().nullish(),cache_write_tokens:I().nullish()}).nullish(),completion_tokens_details:R({reasoning_tokens:I().nullish(),accepted_prediction_tokens:I().nullish(),rejected_prediction_tokens:I().nullish()}).nullish()}).nullish()}),cv]))),fv=G(()=>K(R({logitBias:gu(Ad(),I()).optional(),logprobs:z([su(),I()]).optional(),parallelToolCalls:su().optional(),user:F().optional(),reasoningEffort:B([`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]).optional(),maxCompletionTokens:I().optional(),store:su().optional(),metadata:gu(F().max(64),F().max(512)).optional(),prediction:gu(F(),lu()).optional(),serviceTier:B([`auto`,`flex`,`priority`,`default`]).optional(),strictJsonSchema:su().optional(),textVerbosity:B([`low`,`medium`,`high`]).optional(),promptCacheKey:F().optional(),promptCacheOptions:R({mode:B([`implicit`,`explicit`]).optional(),ttl:V(`30m`).optional()}).optional(),promptCacheRetention:B([`in_memory`,`24h`]).optional(),safetyIdentifier:F().optional(),systemMessageMode:B([`system`,`developer`,`remove`]).optional(),forceReasoning:su().optional()}))),pv=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](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 Oh({provider:`openai`,providerOptions:p,schema:fv})??{},g=Qg(this.modelId),_=h.reasoningEffort??(Dm(f)?f:void 0),v=h.forceReasoning??g.isReasoningModel;i!=null&&m.push({type:`unsupported`,feature:`topK`});let{messages:y,warnings:b}=l_({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:ee,toolChoice:C,toolWarnings:w}=f_({tools:u,toolChoice:d});return{args:{...S,tools:ee,tool_choice:C},warnings:[...m,...w]}}async doGenerate(e){var t;let{args:n,warnings:r}=await this.getArgs(e),{responseHeaders:i,value:a,rawValue:o}=await Bg({url:this.config.url({path:`/chat/completions`,modelId:this.modelId}),headers:Wp((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:lv,successfulResponseHandler:qg(uv),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??lg(),toolName:e.function.name,input:e.function.arguments});for(let e of s.message.annotations??[])c.push({type:`source`,sourceType:`url`,id:lg(),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:d_(s.finish_reason),raw:s.finish_reason??void 0},usage:o_(a.usage),request:{body:n},response:{...u_(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 Bg({url:a,headers:Wp((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:lv,successfulResponseHandler:Kg(dv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await $g({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:p_,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 Yg(e,{generateId:lg,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=u_(r);Object.values(e).some(Boolean)&&(f=!0,n.enqueue({type:`response-metadata`,...u_(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:d_(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:lg(),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:o_(d),...m==null?{}:{providerMetadata:m}})}})),request:{body:i},response:{headers:o}}}},mv=G(()=>K(R({id:F().nullish(),created:I().nullish(),model:F().nullish(),choices:L(R({text:F(),finish_reason:F(),logprobs:R({tokens:L(F()),token_logprobs:L(I()),top_logprobs:L(gu(F(),I())).nullish()}).nullish()})),usage:R({prompt_tokens:I(),completion_tokens:I(),total_tokens:I()}).nullish()}))),hv=G(()=>K(z([R({id:F().nullish(),created:I().nullish(),model:F().nullish(),choices:L(R({text:F(),finish_reason:F().nullish(),index:I(),logprobs:R({tokens:L(F()),token_logprobs:L(I()),top_logprobs:L(gu(F(),I())).nullish()}).nullish()})),usage:R({prompt_tokens:I(),completion_tokens:I(),total_tokens:I()}).nullish()}),cv]))),gv=G(()=>K(R({echo:su().optional(),logitBias:gu(F(),I()).optional(),suffix:F().optional(),user:F().optional(),logprobs:z([su(),I()]).optional()}))),_v=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[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](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 Oh({provider:`openai`,providerOptions:f,schema:gv}),...await Oh({provider:this.providerOptionsName,providerOptions:f,schema:gv})};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}=h_({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 Bg({url:this.config.url({path:`/completions`,modelId:this.modelId}),headers:Wp((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:lv,successfulResponseHandler:qg(mv),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:m_(a.usage),finishReason:{unified:__(s.finish_reason),raw:s.finish_reason??void 0},request:{body:n},response:{...g_(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 Bg({url:a,headers:Wp((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:lv,successfulResponseHandler:Kg(hv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await $g({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:v_,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`,...g_(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:__(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:m_(d)})}})),request:{body:i},response:{headers:o}}}},vv=G(()=>K(R({dimensions:I().optional(),user:F().optional()}))),yv=G(()=>K(R({data:L(R({embedding:L(I())})),usage:R({prompt_tokens:I()}).nullish()}))),bv=class e{constructor(e,t){this.specificationVersion=`v4`,this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=e,this.config=t}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](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 na({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:e});let a=await Oh({provider:`openai`,providerOptions:r,schema:vv})??{},{responseHeaders:o,value:s,rawValue:c}=await Bg({url:this.config.url({path:`/embeddings`,modelId:this.modelId}),headers:Wp((i=this.config).headers?.call(i),t),body:{model:this.modelId,input:e,encoding_format:`float`,dimensions:a.dimensions,user:a.user},failedResponseHandler:lv,successfulResponseHandler:qg(yv),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}}}},xv=G(()=>K(R({id:F(),object:F().nullish(),bytes:I().nullish(),created_at:I().nullish(),filename:F().nullish(),purpose:F().nullish(),status:F().nullish(),expires_at:I().nullish()}))),Sv=G(()=>K(R({purpose:F().optional(),expiresAfter:I().optional()}))),Cv=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 Oh({provider:`openai`,providerOptions:r,schema:Sv}),a=Jp(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 Vg({url:`${this.config.baseURL}/files`,headers:Wp(this.config.headers()),formData:s,failedResponseHandler:lv,successfulResponseHandler:qg(xv),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}}}}}},wv=G(()=>K(R({created:I().nullish(),data:L(R({b64_json:F(),revised_prompt:F().nullish()})),background:F().nullish(),output_format:F().nullish(),size:F().nullish(),quality:F().nullish(),usage:R({input_tokens:I().nullish(),output_tokens:I().nullish(),total_tokens:I().nullish(),input_tokens_details:R({image_tokens:I().nullish(),text_tokens:I().nullish()}).nullish()}).nullish()}))),Tv={"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},Ev=[`chatgpt-image-`,`gpt-image-1-mini`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-2`],Dv=R({quality:B([`standard`,`hd`,`low`,`medium`,`high`,`auto`]).optional(),background:B([`transparent`,`opaque`,`auto`]).optional(),outputFormat:B([`png`,`jpeg`,`webp`]).optional(),outputCompression:I().int().min(0).max(100).optional(),user:F().optional()}),Ov=G(()=>K(Dv.extend({style:B([`vivid`,`natural`]).optional(),moderation:B([`auto`,`low`]).optional()}))),kv=G(()=>K(Dv.extend({inputFidelity:B([`high`,`low`]).optional()}))),Av=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](t){return new e(t.modelId,t.config)}get maxImagesPerCall(){return Tv[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 Oh({provider:`openai`,providerOptions:s,schema:kv})??{},{value:o,responseHeaders:u}=await Vg({url:this.config.url({path:`/images/edits`,modelId:this.modelId}),headers:Wp((d=this.config).headers?.call(d),c),formData:Yp({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([Gp(e.data)],{type:e.mediaType})],{type:e.mediaType}):pm(e.url))),mask:n==null?void 0:await x_(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:lv,successfulResponseHandler:qg(wv),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,...b_(o.usage?.input_tokens_details,t,o.data.length)}))}}}}let h=await Oh({provider:`openai`,providerOptions:s,schema:Ov})??{},{value:g,responseHeaders:_}=await Bg({url:this.config.url({path:`/images/generations`,modelId:this.modelId}),headers:Wp((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,...y_(this.modelId)?{}:{response_format:`b64_json`}},failedResponseHandler:lv,successfulResponseHandler:qg(wv),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,...b_(g.usage?.input_tokens_details,t,g.data.length)}))}}}}},jv=G(()=>K(R({callId:F(),operation:pu(`type`,[R({type:V(`create_file`),path:F(),diff:F()}),R({type:V(`delete_file`),path:F()}),R({type:V(`update_file`),path:F(),diff:F()})])}))),Mv=G(()=>K(R({status:B([`completed`,`failed`]),output:F().optional()}))),Nv=jh({id:`openai.apply_patch`,inputSchema:jv,outputSchema:Mv}),Pv=G(()=>K(R({code:F().nullish(),containerId:F()}))),Fv=G(()=>K(R({outputs:L(pu(`type`,[R({type:V(`logs`),logs:F()}),R({type:V(`image`),url:F()})])).nullish()}))),Iv=G(()=>K(R({container:z([F(),R({fileIds:L(F()).optional()})]).optional()}))),Lv=Mh({id:`openai.code_interpreter`,inputSchema:Pv,outputSchema:Fv}),Rv=(e={})=>Lv(e),zv=G(()=>K(R({description:F().optional(),format:z([R({type:V(`grammar`),syntax:B([`regex`,`lark`]),definition:F()}),R({type:V(`text`)})]).optional()}))),Bv=Ah({id:`openai.custom`,inputSchema:G(()=>K(F()))}),Vv=e=>Bv(e),Hv=R({key:F(),type:B([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`]),value:z([F(),I(),su(),L(F())])}),Uv=R({type:B([`and`,`or`]),filters:L(z([Hv,Eu(()=>Uv)]))}),Wv=G(()=>K(R({vectorStoreIds:L(F()),maxNumResults:I().optional(),ranking:R({ranker:F().optional(),scoreThreshold:I().optional()}).optional(),filters:z([Hv,Uv]).optional()}))),Gv=G(()=>K(R({queries:L(F()),results:L(R({attributes:gu(F(),uu()),fileId:F(),filename:F(),score:I(),text:F()})).nullable()}))),Kv=Mh({id:`openai.file_search`,inputSchema:R({}),outputSchema:Gv}),qv=G(()=>K(R({background:B([`auto`,`opaque`,`transparent`]).optional(),inputFidelity:B([`low`,`high`]).optional(),inputImageMask:R({fileId:F().optional(),imageUrl:F().optional()}).optional(),model:F().optional(),moderation:B([`auto`]).optional(),outputCompression:I().int().min(0).max(100).optional(),outputFormat:B([`png`,`jpeg`,`webp`]).optional(),partialImages:I().int().min(0).max(3).optional(),quality:B([`auto`,`low`,`medium`,`high`]).optional(),size:B([`1024x1024`,`1024x1536`,`1536x1024`,`auto`]).optional()}).strict())),Jv=Mh({id:`openai.image_generation`,inputSchema:G(()=>K(R({}))),outputSchema:G(()=>K(R({result:F()})))}),Yv=(e={})=>Jv(e),Xv=G(()=>K(R({action:R({type:V(`exec`),command:L(F()),timeoutMs:I().optional(),user:F().optional(),workingDirectory:F().optional(),env:gu(F(),F()).optional()})}))),Zv=G(()=>K(R({output:F()}))),Qv=jh({id:`openai.local_shell`,inputSchema:Xv,outputSchema:Zv}),$v=G(()=>K(R({action:R({commands:L(F()),timeoutMs:I().optional(),maxOutputLength:I().optional()})}))),ey=G(()=>K(R({output:L(R({stdout:F(),stderr:F(),outcome:pu(`type`,[R({type:V(`timeout`)}),R({type:V(`exit`),exitCode:I()})])}))}))),ty=L(pu(`type`,[R({type:V(`skillReference`),providerReference:gu(F(),F()),version:F().optional()}),R({type:V(`inline`),name:F(),description:F(),source:R({type:V(`base64`),mediaType:V(`application/zip`),data:F()})})])).optional(),ny=G(()=>K(R({environment:z([R({type:V(`containerAuto`),fileIds:L(F()).optional(),memoryLimit:B([`1g`,`4g`,`16g`,`64g`]).optional(),networkPolicy:pu(`type`,[R({type:V(`disabled`)}),R({type:V(`allowlist`),allowedDomains:L(F()),domainSecrets:L(R({domain:F(),name:F(),value:F()})).optional()})]).optional(),skills:ty}),R({type:V(`containerReference`),containerId:F()}),R({type:V(`local`).optional(),skills:L(R({name:F(),description:F(),path:F()})).optional()})]).optional()}))),ry=jh({id:`openai.shell`,inputSchema:$v,outputSchema:ey}),iy=G(()=>K(R({execution:B([`server`,`client`]).optional(),description:F().optional(),parameters:gu(F(),uu()).optional()}))),ay=G(()=>K(R({arguments:uu().optional(),call_id:F().nullish()}))),oy=G(()=>K(R({tools:L(gu(F(),uu()))}))),sy=jh({id:`openai.tool_search`,inputSchema:ay,outputSchema:oy}),cy=(e={})=>sy(e),ly=G(()=>K(R({externalWebAccess:su().optional(),filters:R({allowedDomains:L(F()).optional()}).optional(),searchContextSize:B([`low`,`medium`,`high`]).optional(),userLocation:R({type:V(`approximate`),country:F().optional(),city:F().optional(),region:F().optional(),timezone:F().optional()}).optional()}))),uy=Mh({id:`openai.web_search`,inputSchema:G(()=>K(R({}))),outputSchema:G(()=>K(R({action:pu(`type`,[R({type:V(`search`),query:F().optional(),queries:L(F()).optional()}),R({type:V(`openPage`),url:F().nullish()}),R({type:V(`findInPage`),url:F().nullish(),pattern:F().nullish()})]).optional(),sources:L(pu(`type`,[R({type:V(`url`),url:F()}),R({type:V(`api`),name:F()})])).optional()})))}),dy=(e={})=>uy(e),fy=G(()=>K(R({searchContextSize:B([`low`,`medium`,`high`]).optional(),userLocation:R({type:V(`approximate`),country:F().optional(),city:F().optional(),region:F().optional(),timezone:F().optional()}).optional()}))),py=Mh({id:`openai.web_search_preview`,inputSchema:G(()=>K(R({}))),outputSchema:G(()=>K(R({action:pu(`type`,[R({type:V(`search`),query:F().optional()}),R({type:V(`openPage`),url:F().nullish()}),R({type:V(`findInPage`),url:F().nullish(),pattern:F().nullish()})]).optional()})))}),my=Eu(()=>z([F(),I(),su(),cu(),L(my),gu(F(),my)])),hy=G(()=>K(R({serverLabel:F(),allowedTools:z([L(F()),R({readOnly:su().optional(),toolNames:L(F()).optional()})]).optional(),authorization:F().optional(),connectorId:F().optional(),headers:gu(F(),F()).optional(),requireApproval:z([B([`always`,`never`]),R({never:R({toolNames:L(F()).optional()}).optional()})]).optional(),serverDescription:F().optional(),serverUrl:F().optional()}).refine(e=>e.serverUrl!=null||e.connectorId!=null,`One of serverUrl or connectorId must be provided.`))),gy=Mh({id:`openai.mcp`,inputSchema:G(()=>K(R({}))),outputSchema:G(()=>K(R({type:V(`call`),serverLabel:F(),name:F(),arguments:F(),output:F().nullish(),error:z([F(),my]).optional()})))}),_y=e=>gy(e),vy={applyPatch:Nv,customTool:Vv,codeInterpreter:Rv,fileSearch:Kv,imageGeneration:Yv,localShell:Qv,shell:ry,webSearchPreview:py,webSearch:dy,mcp:_y,toolSearch:cy},yy=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}:w_(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 S_(e)}serializeClientEvent(e){return C_(e,this.modelId)}buildSessionConfig(e){return w_(e,this.modelId)}},by=R({itemId:F().nullish(),reasoningEncryptedContent:F().nullish()}),xy=Eu(()=>z([F(),I(),su(),cu(),L(xy),gu(F(),xy.optional())])),Sy=R({type:V(`error`),sequence_number:I(),error:R({type:F(),code:F(),message:F(),param:F().nullish()})}),Cy=R({type:V(`error`),sequence_number:I(),code:F().nullish(),message:F(),param:F().nullish()}),wy=G(()=>K(z([R({type:V(`response.output_text.delta`),item_id:F(),delta:F(),logprobs:L(R({token:F(),logprob:I(),top_logprobs:L(R({token:F(),logprob:I()}))})).nullish()}),R({type:B([`response.completed`,`response.incomplete`]),response:R({incomplete_details:R({reason:F()}).nullish(),usage:R({input_tokens:I(),input_tokens_details:R({cached_tokens:I().nullish(),cache_write_tokens:I().nullish(),orchestration_input_tokens:I().nullish(),orchestration_input_cached_tokens:I().nullish()}).nullish(),output_tokens:I(),output_tokens_details:R({reasoning_tokens:I().nullish(),orchestration_output_tokens:I().nullish()}).nullish()}),reasoning:R({context:F().nullish()}).nullish(),service_tier:F().nullish()})}),R({type:V(`response.failed`),sequence_number:I(),response:R({error:R({code:F().nullish(),message:F()}).nullish(),incomplete_details:R({reason:F()}).nullish(),usage:R({input_tokens:I(),input_tokens_details:R({cached_tokens:I().nullish(),cache_write_tokens:I().nullish(),orchestration_input_tokens:I().nullish(),orchestration_input_cached_tokens:I().nullish()}).nullish(),output_tokens:I(),output_tokens_details:R({reasoning_tokens:I().nullish(),orchestration_output_tokens:I().nullish()}).nullish()}).nullish(),reasoning:R({context:F().nullish()}).nullish(),service_tier:F().nullish()})}),R({type:V(`response.created`),response:R({id:F(),created_at:I(),model:F(),service_tier:F().nullish()})}),R({type:V(`response.output_item.added`),output_index:I(),item:pu(`type`,[R({type:V(`message`),id:F(),phase:B([`commentary`,`final_answer`]).nullish()}),R({type:V(`reasoning`),id:F(),encrypted_content:F().nullish()}),R({type:V(`function_call`),id:F(),call_id:F(),name:F(),arguments:F(),namespace:F().nullish()}),R({type:V(`web_search_call`),id:F(),status:F()}),R({type:V(`computer_call`),id:F(),status:F()}),R({type:V(`file_search_call`),id:F()}),R({type:V(`image_generation_call`),id:F()}),R({type:V(`code_interpreter_call`),id:F(),container_id:F(),code:F().nullable(),outputs:L(pu(`type`,[R({type:V(`logs`),logs:F()}),R({type:V(`image`),url:F()})])).nullable(),status:F()}),R({type:V(`mcp_call`),id:F(),status:F(),approval_request_id:F().nullish()}),R({type:V(`mcp_list_tools`),id:F()}),R({type:V(`mcp_approval_request`),id:F()}),R({type:V(`apply_patch_call`),id:F(),call_id:F(),status:B([`in_progress`,`completed`]),operation:pu(`type`,[R({type:V(`create_file`),path:F(),diff:F()}),R({type:V(`delete_file`),path:F()}),R({type:V(`update_file`),path:F(),diff:F()})])}),R({type:V(`custom_tool_call`),id:F(),call_id:F(),name:F(),input:F()}),R({type:V(`shell_call`),id:F(),call_id:F(),status:B([`in_progress`,`completed`,`incomplete`]),action:R({commands:L(F())})}),R({type:V(`compaction`),id:F(),encrypted_content:F().nullish()}),R({type:V(`shell_call_output`),id:F(),call_id:F(),status:B([`in_progress`,`completed`,`incomplete`]),output:L(R({stdout:F(),stderr:F(),outcome:pu(`type`,[R({type:V(`timeout`)}),R({type:V(`exit`),exit_code:I()})])}))}),R({type:V(`tool_search_call`),id:F(),execution:B([`server`,`client`]),call_id:F().nullable(),status:B([`in_progress`,`completed`,`incomplete`]),arguments:uu()}),R({type:V(`tool_search_output`),id:F(),execution:B([`server`,`client`]),call_id:F().nullable(),status:B([`in_progress`,`completed`,`incomplete`]),tools:L(gu(F(),xy.optional()))})])}),R({type:V(`response.output_item.done`),output_index:I(),item:pu(`type`,[R({type:V(`message`),id:F(),phase:B([`commentary`,`final_answer`]).nullish()}),R({type:V(`reasoning`),id:F(),encrypted_content:F().nullish()}),R({type:V(`function_call`),id:F(),call_id:F(),name:F(),arguments:F(),status:V(`completed`),namespace:F().nullish()}),R({type:V(`custom_tool_call`),id:F(),call_id:F(),name:F(),input:F(),status:V(`completed`)}),R({type:V(`code_interpreter_call`),id:F(),code:F().nullable(),container_id:F(),outputs:L(pu(`type`,[R({type:V(`logs`),logs:F()}),R({type:V(`image`),url:F()})])).nullable()}),R({type:V(`image_generation_call`),id:F(),result:F()}),R({type:V(`web_search_call`),id:F(),status:F(),action:pu(`type`,[R({type:V(`search`),query:F().nullish(),queries:L(F()).nullish(),sources:L(pu(`type`,[R({type:V(`url`),url:F()}),R({type:V(`api`),name:F()})])).nullish()}),R({type:V(`open_page`),url:F().nullish()}),R({type:V(`find_in_page`),url:F().nullish(),pattern:F().nullish()})]).nullish()}),R({type:V(`file_search_call`),id:F(),queries:L(F()),results:L(R({attributes:gu(F(),z([F(),I(),su()])),file_id:F(),filename:F(),score:I(),text:F()})).nullish()}),R({type:V(`local_shell_call`),id:F(),call_id:F(),action:R({type:V(`exec`),command:L(F()),timeout_ms:I().optional(),user:F().optional(),working_directory:F().optional(),env:gu(F(),F()).optional()})}),R({type:V(`computer_call`),id:F(),status:V(`completed`)}),R({type:V(`mcp_call`),id:F(),status:F(),arguments:F(),name:F(),server_label:F(),output:F().nullish(),error:z([F(),R({type:F().optional(),code:z([I(),F()]).optional(),message:F().optional()}).loose()]).nullish(),approval_request_id:F().nullish()}),R({type:V(`mcp_list_tools`),id:F(),server_label:F(),tools:L(R({name:F(),description:F().optional(),input_schema:lu(),annotations:gu(F(),uu()).optional()})),error:z([F(),R({type:F().optional(),code:z([I(),F()]).optional(),message:F().optional()}).loose()]).optional()}),R({type:V(`mcp_approval_request`),id:F(),server_label:F(),name:F(),arguments:F(),approval_request_id:F().optional()}),R({type:V(`apply_patch_call`),id:F(),call_id:F(),status:B([`in_progress`,`completed`]),operation:pu(`type`,[R({type:V(`create_file`),path:F(),diff:F()}),R({type:V(`delete_file`),path:F()}),R({type:V(`update_file`),path:F(),diff:F()})])}),R({type:V(`shell_call`),id:F(),call_id:F(),status:B([`in_progress`,`completed`,`incomplete`]),action:R({commands:L(F())})}),R({type:V(`compaction`),id:F(),encrypted_content:F()}),R({type:V(`shell_call_output`),id:F(),call_id:F(),status:B([`in_progress`,`completed`,`incomplete`]),output:L(R({stdout:F(),stderr:F(),outcome:pu(`type`,[R({type:V(`timeout`)}),R({type:V(`exit`),exit_code:I()})])}))}),R({type:V(`tool_search_call`),id:F(),execution:B([`server`,`client`]),call_id:F().nullable(),status:B([`in_progress`,`completed`,`incomplete`]),arguments:uu()}),R({type:V(`tool_search_output`),id:F(),execution:B([`server`,`client`]),call_id:F().nullable(),status:B([`in_progress`,`completed`,`incomplete`]),tools:L(gu(F(),xy.optional()))})])}),R({type:V(`response.function_call_arguments.delta`),item_id:F(),output_index:I(),delta:F()}),R({type:V(`response.custom_tool_call_input.delta`),item_id:F(),output_index:I(),delta:F()}),R({type:V(`response.image_generation_call.partial_image`),item_id:F(),output_index:I(),partial_image_b64:F()}),R({type:V(`response.code_interpreter_call_code.delta`),item_id:F(),output_index:I(),delta:F()}),R({type:V(`response.code_interpreter_call_code.done`),item_id:F(),output_index:I(),code:F()}),R({type:V(`response.output_text.annotation.added`),annotation:pu(`type`,[R({type:V(`url_citation`),start_index:I(),end_index:I(),url:F(),title:F()}),R({type:V(`file_citation`),file_id:F(),filename:F(),index:I()}),R({type:V(`container_file_citation`),container_id:F(),file_id:F(),filename:F(),start_index:I(),end_index:I()}),R({type:V(`file_path`),file_id:F(),index:I()})])}),R({type:V(`response.reasoning_summary_part.added`),item_id:F(),summary_index:I()}),R({type:V(`response.reasoning_summary_text.delta`),item_id:F(),summary_index:I(),delta:F()}),R({type:V(`response.reasoning_summary_part.done`),item_id:F(),summary_index:I()}),R({type:V(`response.apply_patch_call_operation_diff.delta`),item_id:F(),output_index:I(),delta:F(),obfuscation:F().nullish()}),R({type:V(`response.apply_patch_call_operation_diff.done`),item_id:F(),output_index:I(),diff:F()}),Sy,Cy,R({type:F()}).loose().transform(e=>({type:`unknown_chunk`,message:e.type}))]))),Ty=G(()=>K(R({id:F().optional(),created_at:I().optional(),error:R({message:F(),type:F(),param:F().nullish(),code:F()}).nullish(),model:F().optional(),output:L(pu(`type`,[R({type:V(`message`),role:V(`assistant`),id:F(),phase:B([`commentary`,`final_answer`]).nullish(),content:L(R({type:V(`output_text`),text:F(),logprobs:L(R({token:F(),logprob:I(),top_logprobs:L(R({token:F(),logprob:I()}))})).nullish(),annotations:L(pu(`type`,[R({type:V(`url_citation`),start_index:I(),end_index:I(),url:F(),title:F()}),R({type:V(`file_citation`),file_id:F(),filename:F(),index:I()}),R({type:V(`container_file_citation`),container_id:F(),file_id:F(),filename:F(),start_index:I(),end_index:I()}),R({type:V(`file_path`),file_id:F(),index:I()})]))}))}),R({type:V(`web_search_call`),id:F(),status:F(),action:pu(`type`,[R({type:V(`search`),query:F().nullish(),queries:L(F()).nullish(),sources:L(pu(`type`,[R({type:V(`url`),url:F()}),R({type:V(`api`),name:F()})])).nullish()}),R({type:V(`open_page`),url:F().nullish()}),R({type:V(`find_in_page`),url:F().nullish(),pattern:F().nullish()})]).nullish()}),R({type:V(`file_search_call`),id:F(),queries:L(F()),results:L(R({attributes:gu(F(),z([F(),I(),su()])),file_id:F(),filename:F(),score:I(),text:F()})).nullish()}),R({type:V(`code_interpreter_call`),id:F(),code:F().nullable(),container_id:F(),outputs:L(pu(`type`,[R({type:V(`logs`),logs:F()}),R({type:V(`image`),url:F()})])).nullable()}),R({type:V(`image_generation_call`),id:F(),result:F()}),R({type:V(`local_shell_call`),id:F(),call_id:F(),action:R({type:V(`exec`),command:L(F()),timeout_ms:I().optional(),user:F().optional(),working_directory:F().optional(),env:gu(F(),F()).optional()})}),R({type:V(`function_call`),call_id:F(),name:F(),arguments:F(),id:F(),namespace:F().nullish()}),R({type:V(`custom_tool_call`),call_id:F(),name:F(),input:F(),id:F()}),R({type:V(`computer_call`),id:F(),status:F().optional()}),R({type:V(`reasoning`),id:F(),encrypted_content:F().nullish(),summary:L(R({type:V(`summary_text`),text:F()}))}),R({type:V(`mcp_call`),id:F(),status:F(),arguments:F(),name:F(),server_label:F(),output:F().nullish(),error:z([F(),R({type:F().optional(),code:z([I(),F()]).optional(),message:F().optional()}).loose()]).nullish(),approval_request_id:F().nullish()}),R({type:V(`mcp_list_tools`),id:F(),server_label:F(),tools:L(R({name:F(),description:F().optional(),input_schema:lu(),annotations:gu(F(),uu()).optional()})),error:z([F(),R({type:F().optional(),code:z([I(),F()]).optional(),message:F().optional()}).loose()]).optional()}),R({type:V(`mcp_approval_request`),id:F(),server_label:F(),name:F(),arguments:F(),approval_request_id:F().optional()}),R({type:V(`apply_patch_call`),id:F(),call_id:F(),status:B([`in_progress`,`completed`]),operation:pu(`type`,[R({type:V(`create_file`),path:F(),diff:F()}),R({type:V(`delete_file`),path:F()}),R({type:V(`update_file`),path:F(),diff:F()})])}),R({type:V(`shell_call`),id:F(),call_id:F(),status:B([`in_progress`,`completed`,`incomplete`]),action:R({commands:L(F())})}),R({type:V(`compaction`),id:F(),encrypted_content:F()}),R({type:V(`shell_call_output`),id:F(),call_id:F(),status:B([`in_progress`,`completed`,`incomplete`]),output:L(R({stdout:F(),stderr:F(),outcome:pu(`type`,[R({type:V(`timeout`)}),R({type:V(`exit`),exit_code:I()})])}))}),R({type:V(`tool_search_call`),id:F(),execution:B([`server`,`client`]),call_id:F().nullable(),status:B([`in_progress`,`completed`,`incomplete`]),arguments:uu()}),R({type:V(`tool_search_output`),id:F(),execution:B([`server`,`client`]),call_id:F().nullable(),status:B([`in_progress`,`completed`,`incomplete`]),tools:L(gu(F(),xy.optional()))})])).optional(),service_tier:F().nullish(),reasoning:R({context:F().nullish()}).nullish(),incomplete_details:R({reason:F()}).nullish(),usage:R({input_tokens:I(),input_tokens_details:R({cached_tokens:I().nullish(),cache_write_tokens:I().nullish(),orchestration_input_tokens:I().nullish(),orchestration_input_cached_tokens:I().nullish()}).nullish(),output_tokens:I(),output_tokens_details:R({reasoning_tokens:I().nullish(),orchestration_output_tokens:I().nullish()}).nullish()}).optional()}))),Ey=20,Dy=G(()=>K(R({conversation:F().nullish(),include:L(B([`reasoning.encrypted_content`,`file_search_call.results`,`web_search_call.results`,`message.output_text.logprobs`])).nullish(),instructions:F().nullish(),logprobs:z([su(),I().min(1).max(Ey)]).optional(),maxToolCalls:I().nullish(),metadata:lu().nullish(),parallelToolCalls:su().nullish(),previousResponseId:F().nullish(),promptCacheKey:F().nullish(),promptCacheOptions:R({mode:B([`implicit`,`explicit`]).optional(),ttl:V(`30m`).optional()}).optional(),promptCacheRetention:B([`in_memory`,`24h`]).nullish(),reasoningEffort:F().nullish(),reasoningMode:B([`standard`,`pro`]).optional(),reasoningContext:B([`auto`,`current_turn`,`all_turns`]).optional(),reasoningSummary:F().nullish(),safetyIdentifier:F().nullish(),serviceTier:B([`auto`,`flex`,`priority`,`default`]).nullish(),store:su().nullish(),passThroughUnsupportedFiles:su().optional(),strictJsonSchema:su().nullish(),textVerbosity:B([`low`,`medium`,`high`]).nullish(),truncation:B([`auto`,`disabled`]).nullish(),user:F().nullish(),systemMessageMode:B([`system`,`developer`,`remove`]).optional(),forceReasoning:su().optional(),contextManagement:L(R({type:V(`compaction`),compactThreshold:I()})).nullish(),allowedTools:R({toolNames:L(F()).min(1),mode:B([`auto`,`required`]).optional()}).optional()}))),Oy=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](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=Qg(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 Oh({provider:g,providerOptions:u,schema:Dy});_==null&&g!==`openai`&&(_=await Oh({provider:`openai`,providerOptions:u,schema:Dy}));let v=_?.reasoningEffort??(Dm(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=Xp({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:ee,toolChoice:C,toolWarnings:w}=await j_({tools:d,toolChoice:f,allowedTools:_?.allowedTools??void 0,toolNameMapping:x,customProviderToolNames:S}),{input:T,warnings:E}=await k_({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:ne(`openai.local_shell`),hasShellTool:ne(`openai.shell`),hasApplyPatchTool:ne(`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 ne(e){return d?.find(t=>t.type===`provider`&&t.id===e)!=null}let k=typeof _?.logprobs==`number`?_?.logprobs:_?.logprobs===!0?Ey:void 0;k&&te(`message.output_text.logprobs`);let re=d?.find(e=>e.type===`provider`&&(e.id===`openai.web_search`||e.id===`openai.web_search_preview`))?.name;re&&te(`web_search_call.action.sources`),ne(`openai.code_interpreter`)&&te(`code_interpreter_call.outputs`);let ie=_?.store;ie===!1&&b&&te(`reasoning.encrypted_content`);let ae={model:this.modelId,input:T,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:ie,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:k,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||(ae.temperature!=null&&(ae.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for reasoning models`})),ae.top_p!=null&&(ae.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 ae.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 ae.service_tier);let oe=d?.find(e=>e.type===`provider`&&e.id===`openai.shell`)?.args?.environment?.type,se=oe===`containerAuto`||oe===`containerReference`;return{webSearchToolName:re,args:{...ae,tools:ee,tool_choice:C},warnings:[...m,...w],store:ie,toolNameMapping:x,providerOptionsName:g,isShellProviderExecuted:se}}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=F_(e.prompt),{responseHeaders:h,value:g,rawValue:_}=await Bg({url:p,headers:Wp((t=this.config).headers?.call(t),e.headers),body:s,failedResponseHandler:lv,successfulResponseHandler:qg(Ty),abortSignal:e.abortSignal,fetch:this.config.fetch});if(g.error)throw new ei({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)??lg(),url:e.url,title:e.title}):e.type===`file_citation`?v.push({type:`source`,sourceType:`document`,id:(r=this.config).generateId?.call(r)??lg(),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)??lg(),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)??lg(),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:tv(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)??lg(),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}}},ee=g.usage;return{content:v,finishReason:{unified:A_({finishReason:g.incomplete_details?.reason,hasFunctionCall:b}),raw:g.incomplete_details?.reason??void 0},usage:T_(ee),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 Bg({url:l,headers:Wp((t=this.config).headers?.call(t),e.headers),body:{...n,stream:!0},failedResponseHandler:lv,successfulResponseHandler:Kg(wy),abortSignal:e.abortSignal,fetch:this.config.fetch}),f=await $g({stream:d,getError:e=>$_(e)||H_(e)&&e.response.error!=null?e:void 0,isOutputChunk:ev,url:l,requestBodyValues:n,responseHeaders:u}),p=this,m=F_(e.prompt),h=new Map,g={unified:`other`,raw:void 0},_,v=[],y=null,b={},x=[],S,ee=!1,C={},w,T,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,ne;if(e.includeRawChunks&&r.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){let e=L_(t.rawValue)?R_({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 k=t.value;if(Z_(k)){if(k.item.type===`function_call`)b[k.output_index]={toolName:k.item.name,toolCallId:k.item.call_id},r.enqueue({type:`tool-input-start`,id:k.item.call_id,toolName:k.item.name});else if(k.item.type===`custom_tool_call`){let e=a.toCustomToolName(k.item.name);b[k.output_index]={toolName:e,toolCallId:k.item.call_id},r.enqueue({type:`tool-input-start`,id:k.item.call_id,toolName:e})}else if(k.item.type===`web_search_call`)b[k.output_index]={toolName:a.toCustomToolName(i??`web_search`),toolCallId:k.item.id},r.enqueue({type:`tool-input-start`,id:k.item.id,toolName:a.toCustomToolName(i??`web_search`),providerExecuted:!0}),r.enqueue({type:`tool-input-end`,id:k.item.id}),r.enqueue({type:`tool-call`,toolCallId:k.item.id,toolName:a.toCustomToolName(i??`web_search`),input:JSON.stringify({}),providerExecuted:!0});else if(k.item.type===`computer_call`)b[k.output_index]={toolName:a.toCustomToolName(`computer_use`),toolCallId:k.item.id},r.enqueue({type:`tool-input-start`,id:k.item.id,toolName:a.toCustomToolName(`computer_use`),providerExecuted:!0});else if(k.item.type===`code_interpreter_call`)b[k.output_index]={toolName:a.toCustomToolName(`code_interpreter`),toolCallId:k.item.id,codeInterpreter:{containerId:k.item.container_id}},r.enqueue({type:`tool-input-start`,id:k.item.id,toolName:a.toCustomToolName(`code_interpreter`),providerExecuted:!0}),r.enqueue({type:`tool-input-delta`,id:k.item.id,delta:`{"containerId":"${k.item.container_id}","code":"`});else if(k.item.type===`file_search_call`)r.enqueue({type:`tool-call`,toolCallId:k.item.id,toolName:a.toCustomToolName(`file_search`),input:`{}`,providerExecuted:!0});else if(k.item.type===`image_generation_call`)r.enqueue({type:`tool-call`,toolCallId:k.item.id,toolName:a.toCustomToolName(`image_generation`),input:`{}`,providerExecuted:!0});else if(k.item.type===`tool_search_call`){let e=k.item.id,t=a.toCustomToolName(`tool_search`),n=k.item.execution===`server`;b[k.output_index]={toolName:t,toolCallId:e,toolSearchExecution:k.item.execution??`server`},n&&r.enqueue({type:`tool-input-start`,id:e,toolName:t,providerExecuted:!0})}else if(k.item.type!==`tool_search_output`&&!(k.item.type===`mcp_call`||k.item.type===`mcp_list_tools`||k.item.type===`mcp_approval_request`))if(k.item.type===`apply_patch_call`){let{call_id:e,operation:t}=k.item;if(b[k.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":"${nv(e)}","operation":{"type":"${nv(t.type)}","path":"${nv(t.path)}","diff":"`})}else k.item.type===`shell_call`?b[k.output_index]={toolName:a.toCustomToolName(`shell`),toolCallId:k.item.call_id}:k.item.type===`shell_call_output`||(k.item.type===`message`?(x.splice(0,x.length),S=k.item.phase??void 0,r.enqueue({type:`text-start`,id:k.item.id,providerMetadata:{[s]:{itemId:k.item.id,...k.item.phase!=null&&{phase:k.item.phase}}}})):Z_(k)&&k.item.type===`reasoning`&&(C[k.item.id]={encryptedContent:k.item.encrypted_content,summaryParts:{0:`active`}},r.enqueue({type:`reasoning-start`,id:`${k.item.id}:0`,providerMetadata:{[s]:{itemId:k.item.id,reasoningEncryptedContent:k.item.encrypted_content??null}}})))}else if(B_(k))if(k.item.type===`message`){let e=k.item.phase??S;S=void 0,r.enqueue({type:`text-end`,id:k.item.id,providerMetadata:{[s]:{itemId:k.item.id,...e!=null&&{phase:e},...x.length>0&&{annotations:x}}}})}else if(k.item.type===`function_call`)b[k.output_index]=void 0,ee=!0,r.enqueue({type:`tool-input-end`,id:k.item.call_id,...k.item.namespace!=null&&{providerMetadata:{[s]:{namespace:k.item.namespace}}}}),r.enqueue({type:`tool-call`,toolCallId:k.item.call_id,toolName:k.item.name,input:k.item.arguments,providerMetadata:{[s]:{itemId:k.item.id,...k.item.namespace!=null&&{namespace:k.item.namespace}}}});else if(k.item.type===`custom_tool_call`){b[k.output_index]=void 0,ee=!0;let e=a.toCustomToolName(k.item.name);r.enqueue({type:`tool-input-end`,id:k.item.call_id}),r.enqueue({type:`tool-call`,toolCallId:k.item.call_id,toolName:e,input:JSON.stringify(k.item.input),providerMetadata:{[s]:{itemId:k.item.id}}})}else if(k.item.type===`web_search_call`)b[k.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:k.item.id,toolName:a.toCustomToolName(i??`web_search`),result:tv(k.item.action)});else if(k.item.type===`computer_call`)b[k.output_index]=void 0,r.enqueue({type:`tool-input-end`,id:k.item.id}),r.enqueue({type:`tool-call`,toolCallId:k.item.id,toolName:a.toCustomToolName(`computer_use`),input:``,providerExecuted:!0}),r.enqueue({type:`tool-result`,toolCallId:k.item.id,toolName:a.toCustomToolName(`computer_use`),result:{type:`computer_use_tool_result`,status:k.item.status||`completed`}});else if(k.item.type===`file_search_call`)b[k.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:k.item.id,toolName:a.toCustomToolName(`file_search`),result:{queries:k.item.queries,results:k.item.results?.map(e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))??null}});else if(k.item.type===`code_interpreter_call`)b[k.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:k.item.id,toolName:a.toCustomToolName(`code_interpreter`),result:{outputs:k.item.outputs}});else if(k.item.type===`image_generation_call`)r.enqueue({type:`tool-result`,toolCallId:k.item.id,toolName:a.toCustomToolName(`image_generation`),result:{result:k.item.result}});else if(k.item.type===`tool_search_call`){let e=b[k.output_index],t=k.item.execution===`server`;if(e!=null){let n=t?e.toolCallId:k.item.call_id??k.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:k.item.arguments,call_id:t?null:n}),...t?{providerExecuted:!0}:{},providerMetadata:{[s]:{itemId:k.item.id}}})}b[k.output_index]=void 0}else if(k.item.type===`tool_search_output`){let e=k.item.call_id??E.shift()??k.item.id;r.enqueue({type:`tool-result`,toolCallId:e,toolName:a.toCustomToolName(`tool_search`),result:{tools:k.item.tools},providerMetadata:{[s]:{itemId:k.item.id}}})}else if(k.item.type===`mcp_call`){b[k.output_index]=void 0;let e=k.item.approval_request_id??void 0,t=e==null?k.item.id:h.get(e)??m[e]??k.item.id,n=`mcp.${k.item.name}`;r.enqueue({type:`tool-call`,toolCallId:t,toolName:n,input:k.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-result`,toolCallId:t,toolName:n,result:{type:`call`,serverLabel:k.item.server_label,name:k.item.name,arguments:k.item.arguments,...k.item.output==null?{}:{output:k.item.output},...k.item.error==null?{}:{error:k.item.error}},providerMetadata:{[s]:{itemId:k.item.id}}})}else if(k.item.type===`mcp_list_tools`)b[k.output_index]=void 0;else if(k.item.type===`apply_patch_call`){let e=b[k.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&k.item.operation.type!==`delete_file`&&(e.applyPatch.hasDiff||r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:nv(k.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&&k.item.status===`completed`&&r.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:a.toCustomToolName(`apply_patch`),input:JSON.stringify({callId:k.item.call_id,operation:k.item.operation}),providerMetadata:{[s]:{itemId:k.item.id}}}),b[k.output_index]=void 0}else if(k.item.type===`mcp_approval_request`){b[k.output_index]=void 0;let e=(d=p.config).generateId?.call(d)??lg(),t=k.item.approval_request_id??k.item.id;h.set(t,e);let n=`mcp.${k.item.name}`;r.enqueue({type:`tool-call`,toolCallId:e,toolName:n,input:k.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-approval-request`,approvalId:t,toolCallId:e})}else if(k.item.type===`local_shell_call`)b[k.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:k.item.call_id,toolName:a.toCustomToolName(`local_shell`),input:JSON.stringify({action:{type:`exec`,command:k.item.action.command,timeoutMs:k.item.action.timeout_ms,user:k.item.action.user,workingDirectory:k.item.action.working_directory,env:k.item.action.env}}),providerMetadata:{[s]:{itemId:k.item.id}}});else if(k.item.type===`shell_call`)b[k.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:k.item.call_id,toolName:a.toCustomToolName(`shell`),input:JSON.stringify({action:{commands:k.item.action.commands}}),...c&&{providerExecuted:!0},providerMetadata:{[s]:{itemId:k.item.id}}});else if(k.item.type===`shell_call_output`)r.enqueue({type:`tool-result`,toolCallId:k.item.call_id,toolName:a.toCustomToolName(`shell`),result:{output:k.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(k.item.type===`reasoning`){let e=C[k.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:`${k.item.id}:${e}`,providerMetadata:{[s]:{itemId:k.item.id,reasoningEncryptedContent:k.item.encrypted_content??null}}});delete C[k.item.id]}else k.item.type===`compaction`&&r.enqueue({type:`custom`,kind:`openai.compaction`,providerMetadata:{[s]:{type:`compaction`,itemId:k.item.id,encryptedContent:k.item.encrypted_content}}});else if(W_(k)){let e=b[k.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:k.delta})}else if(G_(k)){let e=b[k.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:k.delta})}else if(Y_(k)){let e=b[k.output_index];e?.applyPatch&&(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:nv(k.delta)}),e.applyPatch.hasDiff=!0)}else if(X_(k)){let e=b[k.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&(e.applyPatch.hasDiff||(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:nv(k.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(K_(k))r.enqueue({type:`tool-result`,toolCallId:k.item_id,toolName:a.toCustomToolName(`image_generation`),result:{result:k.partial_image_b64},preliminary:!0});else if(q_(k)){let e=b[k.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:nv(k.delta)})}else if(J_(k)){let e=b[k.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:k.code,containerId:e.codeInterpreter.containerId}),providerExecuted:!0}))}else if(U_(k))y=k.response.id,r.enqueue({type:`response-metadata`,id:k.response.id,timestamp:new Date(k.response.created_at*1e3),modelId:k.response.model});else if(I_(k))r.enqueue({type:`text-delta`,id:k.item_id,delta:k.delta}),e.providerOptions?.[s]?.logprobs&&k.logprobs&&v.push(k.logprobs);else if(k.type===`response.reasoning_summary_part.added`){if(k.summary_index>0){let e=C[k.item_id];e.summaryParts[k.summary_index]=`active`;for(let t of Object.keys(e.summaryParts))e.summaryParts[t]===`can-conclude`&&(r.enqueue({type:`reasoning-end`,id:`${k.item_id}:${t}`,providerMetadata:{[s]:{itemId:k.item_id}}}),e.summaryParts[t]=`concluded`);r.enqueue({type:`reasoning-start`,id:`${k.item_id}:${k.summary_index}`,providerMetadata:{[s]:{itemId:k.item_id,reasoningEncryptedContent:C[k.item_id]?.encryptedContent??null}}})}}else if(k.type===`response.reasoning_summary_text.delta`)r.enqueue({type:`reasoning-delta`,id:`${k.item_id}:${k.summary_index}`,delta:k.delta,providerMetadata:{[s]:{itemId:k.item_id}}});else if(k.type===`response.reasoning_summary_part.done`)o?(r.enqueue({type:`reasoning-end`,id:`${k.item_id}:${k.summary_index}`,providerMetadata:{[s]:{itemId:k.item_id}}}),C[k.item_id].summaryParts[k.summary_index]=`concluded`):C[k.item_id].summaryParts[k.summary_index]=`can-conclude`;else if(V_(k))g={unified:A_({finishReason:k.response.incomplete_details?.reason,hasFunctionCall:ee}),raw:k.response.incomplete_details?.reason??void 0},_=k.response.usage,typeof k.response.service_tier==`string`&&(w=k.response.service_tier),k.response.reasoning?.context!=null&&(T=k.response.reasoning.context);else if(H_(k)){let e=k.response.incomplete_details?.reason;g={unified:e?A_({finishReason:e,hasFunctionCall:ee}):`error`,raw:e??`error`},_=k.response.usage??void 0,k.response.reasoning?.context!=null&&(T=k.response.reasoning.context),!D&&k.response.error!=null&&(D=!0,r.enqueue({type:`error`,error:{type:`response.failed`,sequence_number:k.sequence_number,response:{error:k.response.error,incomplete_details:k.response.incomplete_details,service_tier:k.response.service_tier}}}))}else Q_(k)?(x.push(k.annotation),k.annotation.type===`url_citation`?r.enqueue({type:`source`,sourceType:`url`,id:(f=p.config).generateId?.call(f)??lg(),url:k.annotation.url,title:k.annotation.title}):k.annotation.type===`file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(O=p.config).generateId?.call(O)??lg(),mediaType:`text/plain`,title:k.annotation.filename,filename:k.annotation.filename,providerMetadata:{[s]:{type:k.annotation.type,fileId:k.annotation.file_id,index:k.annotation.index}}}):k.annotation.type===`container_file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(te=p.config).generateId?.call(te)??lg(),mediaType:`text/plain`,title:k.annotation.filename,filename:k.annotation.filename,providerMetadata:{[s]:{type:k.annotation.type,fileId:k.annotation.file_id,containerId:k.annotation.container_id}}}):k.annotation.type===`file_path`&&r.enqueue({type:`source`,sourceType:`document`,id:(ne=p.config).generateId?.call(ne)??lg(),mediaType:`application/octet-stream`,title:k.annotation.file_id,filename:k.annotation.file_id,providerMetadata:{[s]:{type:k.annotation.type,fileId:k.annotation.file_id,index:k.annotation.index}}})):$_(k)&&(D=!0,g={unified:`error`,raw:`error`},r.enqueue({type:`error`,error:k}))},flush(e){let t={[s]:{responseId:y,...v.length>0?{logprobs:v}:{},...w===void 0?{}:{serviceTier:w},...T===void 0?{}:{reasoningContext:T}}};e.enqueue({type:`finish`,finishReason:g,usage:T_(_),providerMetadata:t})}})),request:{body:n},response:{headers:u}}}},ky=G(()=>K(R({instructions:F().nullish(),speed:I().min(.25).max(4).default(1).nullish()}))),Ay=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](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 Oh({provider:`openai`,providerOptions:o,schema:ky}),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 Bg({url:this.config.url({path:`/audio/speech`,modelId:this.modelId}),headers:Wp((n=this.config).headers?.call(n),e.headers),body:i,failedResponseHandler:lv,successfulResponseHandler:Jg(),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}}}},jy=G(()=>K(R({text:F(),language:F().nullish(),duration:I().nullish(),words:L(R({word:F(),start:I(),end:I()})).nullish(),segments:L(R({id:I(),seek:I(),start:I(),end:I(),text:F(),tokens:L(I()),temperature:I(),avg_logprob:I(),compression_ratio:I(),no_speech_prob:I()})).nullish()}))),My=G(()=>K(R({include:L(F()).optional(),language:F().optional(),prompt:F().optional(),temperature:I().min(0).max(1).default(0).optional(),timestampGranularities:L(B([`word`,`segment`])).default([`segment`]).optional(),streaming:R({delay:B([`minimal`,`low`,`medium`,`high`,`xhigh`]).optional(),include:L(F()).optional()}).optional()}))),Ny={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`},Py=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](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 Oh({provider:`openai`,providerOptions:n,schema:My}),a=new FormData,o=e instanceof Uint8Array?new Blob([e]):new Blob([Gp(e)]);a.append(`model`,this.modelId);let s=Am(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(rv(this.modelId))throw new ma({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 Vg({url:this.config.url({path:`/audio/transcriptions`,modelId:this.modelId}),headers:Wp((n=this.config).headers?.call(n),e.headers),formData:i,failedResponseHandler:lv,successfulResponseHandler:qg(jy),abortSignal:e.abortSignal,fetch:this.config.fetch}),l=o.language!=null&&o.language in Ny?Ny[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(!rv(this.modelId))throw new ma({functionality:`streaming transcription with ${this.modelId}`});let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,i=await Oh({provider:`openai`,providerOptions:e.providerOptions,schema:My}),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=Wp((n=this.config).headers?.call(n),e.headers),c=av({modelId:this.modelId,inputAudioFormat:e.inputAudioFormat,providerOptions:i});return{request:{body:c},response:{timestamp:r,modelId:this.modelId},stream:iv({webSocket:this.config.webSocket,url:Hh(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})}}},Fy=G(()=>K(R({id:F(),name:F().nullish(),description:F().nullish(),default_version:F().nullish(),latest_version:F().nullish(),created_at:I(),updated_at:I().nullish()}))),Iy=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=Jp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let{value:r}=await Vg({url:this.config.url({path:`/skills`}),headers:Wp(this.config.headers()),formData:n,failedResponseHandler:lv,successfulResponseHandler:qg(Fy),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}}},Ly=`4.0.11`,sv()}));function zy(e){let t=e?.anthropic;return t?.cacheControl??t?.cache_control}async function By({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 Sb;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 Ch({value:t.args,schema:Db});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 Ch({value:t.args,schema:Hb});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 Ch({value:t.args,schema:Rb});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 Ch({value:t.args,schema:Pb});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 Ch({value:t.args,schema:Ab});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 Ch({value:t.args,schema:Cb});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 ma({functionality:`tool choice type: ${d}`})}}function Vy({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 Hy(e){return typeof e==`string`?new TextDecoder().decode(Gp(e)):new TextDecoder().decode(e)}function Uy(e){try{if(typeof e==`string`)return Nm(e);if(typeof e==`object`&&e)return e}catch{let t=e?.errorCode;return{errorCode:typeof t==`string`?t:`unavailable`}}return{}}async function Wy({prompt:e,sendReasoning:t,warnings:n,cacheControlValidator:r,toolNameMapping:i}){let a=new Set,o=Gy(e),s=r||new Sb,c,l=[];async function u(e){return(await Oh({provider:`anthropic`,providerOptions:e,schema:yb}))?.citations?.enabled??!1}async function d(e){return(await Oh({provider:`anthropic`,providerOptions:e,schema:yb}))?.containerUpload??!1}async function f(e){let t=await Oh({provider:`anthropic`,providerOptions:e,schema:yb});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=Fh({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}):nm(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=nm(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:Ph({part:r}),data:qp(r.data.data)},cache_control:c});else if(t===`application`&&(r.data.type===`url`?r.mediaType===`application/pdf`:Ph({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:qp(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:Hy(r.data.data)},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c})}else throw new ma({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=nm(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:Ph({part:e}),data:qp(e.data.data)}};if(Ph({part:e})===`application/pdf`)return a.add(`pdfs-2024-09-25`),{type:`document`,source:{type:`base64`,media_type:`application/pdf`,data:qp(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(Sm);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 Oh({provider:`anthropic`,providerOptions:o.providerOptions,schema:vb});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:qy(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=Nm(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 Ch({value:t.value,schema:Kb});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 Ch({value:t.value,schema:Qb});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 Ch({value:t.value,schema:Yb});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:Uy(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 Ch({value:t.value,schema:Ub});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:Uy(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 Ch({value:t.value,schema:Fb});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 Ch({value:t.value,schema:tx})).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 Ch({value:t.value,schema:wb});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:Ky(e)});break}default:throw Error(`content type: ${m}`)}}return{prompt:{system:c,messages:l},betas:a}}function Gy(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 Ky(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 qy(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{rawInvalidInput:e}}function Jy({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 Yy(e){return Zy(e)}function Xy(e){return typeof e==`boolean`||!tb(e)?e:Zy(e)}function Zy(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(Xy)):t.anyOf=e.anyOf.map(Xy),e.allOf!=null&&(t.allOf=e.allOf.map(Xy)),e.definitions!=null&&(t.definitions=Object.fromEntries(Object.entries(e.definitions).map(([e,t])=>[e,Xy(t)]))),n.$defs!=null){let e=t;e.$defs=Object.fromEntries(Object.entries(n.$defs).map(([e,t])=>[e,Xy(t)]))}(e.type===`object`||e.properties!=null)&&(e.properties!=null&&(t.properties=Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,Xy(t)]))),t.additionalProperties=!1,e.required!=null&&(t.required=e.required)),e.items!=null&&(t.items=Array.isArray(e.items)?e.items.map(Xy):Xy(e.items)),typeof e.format==`string`&&ix.has(e.format)&&(t.format=e.format);let r=Qy(e);return r!=null&&(t.description=t.description==null?r:`${t.description}
|
|
54
|
+
${r}`),t}function Qy(e){let t=ax.flatMap(t=>{let n=e[t];return n==null||n===!1?[]:`${$y(t)}: ${eb(n)}`});return typeof e.format==`string`&&!ix.has(e.format)&&t.push(`format: ${e.format}`),t.length===0?void 0:`${t.join(`; `)}.`}function $y(e){return e.replace(/[A-Z]/g,e=>` ${e.toLowerCase()}`)}function eb(e){return typeof e==`string`?e:JSON.stringify(e)}function tb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nb(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 rb(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 ib(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 ab({reasoning:e,supportsAdaptiveThinking:t,supportsXhighEffort:n,maxOutputTokensForModel:r,warnings:i}){if(!Dm(e))return;if(e===`none`)return{thinking:{type:`disabled`}};if(t)return{thinking:{type:`adaptive`},effort:Om({reasoning:e,effortMap:{minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:n?`xhigh`:`max`},warnings:i})};let a=km({reasoning:e,maxOutputTokens:r,maxReasoningBudget:r,warnings:i});if(a!=null)return{thinking:{type:`enabled`,budgetTokens:a}}}function ob(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 sb(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 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{execute:t,...n}=e;return cx(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 ub(e){let t=Wh(e);return t===wx?Tx:t}function db(e={}){let t=ub(Em({settingValue:e.baseURL,environmentVariableName:`ANTHROPIC_BASE_URL`}))??Tx,n=e.name??`anthropic.messages`;if(e.apiKey&&e.authToken)throw new fi({argument:`apiKey/authToken`,message:`Both apiKey and authToken were provided. Please use only one authentication method.`});let r=()=>bm({"anthropic-version":`2023-06-01`,...e.authToken?{Authorization:`Bearer ${e.authToken}`}:{"x-api-key":Tm({apiKey:e.apiKey,environmentVariableName:`ANTHROPIC_API_KEY`,description:`Anthropic`})},...e.headers},`ai-sdk/anthropic/${Cx}`),i=i=>new ox(i,{provider:n,baseURL:t,headers:r,fetch:e.fetch,generateId:e.generateId??lg,supportedUrls:()=>({"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]})}),a=()=>new Sx({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 Wi({modelId:e,modelType:`embeddingModel`})},o.textEmbeddingModel=o.embeddingModel,o.imageModel=e=>{throw new Wi({modelId:e,modelType:`imageModel`})},o.files=()=>new mb({provider:n,baseURL:t,headers:r,fetch:e.fetch}),o.skills=a,o.tools=yx,o}var 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,Ex=t((()=>{ha(),Zg(),Pd(),fb=Gg({errorSchema:G(()=>K(R({type:V(`error`),error:R({type:F(),message:F()})}))),errorToMessage:e=>e.error.message}),pb=G(()=>K(R({id:F(),type:V(`file`),filename:F(),mime_type:F(),size_bytes:I(),created_at:F(),downloadable:su().nullish()}))),mb=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=Jp(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 Vg({url:`${this.config.baseURL}/files`,headers:Wp(this.config.headers(),{"anthropic-beta":`files-api-2025-04-14`}),formData:a,failedResponseHandler:fb,successfulResponseHandler:qg(pb),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}}}}}},hb=R({type:F(),category:F().nullish(),explanation:F().nullish(),recommended_model:F().nullish()}),gb=G(()=>K(R({type:V(`message`),id:F().nullish(),model:F().nullish(),content:L(pu(`type`,[R({type:V(`text`),text:F(),citations:L(pu(`type`,[R({type:V(`web_search_result_location`),cited_text:F(),url:F(),title:F(),encrypted_index:F()}),R({type:V(`page_location`),cited_text:F(),document_index:I(),document_title:F().nullable(),start_page_number:I(),end_page_number:I()}),R({type:V(`char_location`),cited_text:F(),document_index:I(),document_title:F().nullable(),start_char_index:I(),end_char_index:I()})])).optional()}),R({type:V(`thinking`),thinking:F(),signature:F()}),R({type:V(`redacted_thinking`),data:F()}),R({type:V(`compaction`),content:F()}),R({type:V(`tool_use`),id:F(),name:F(),input:uu(),caller:z([R({type:V(`code_execution_20250825`),tool_id:F()}),R({type:V(`code_execution_20260120`),tool_id:F()}),R({type:V(`direct`)})]).optional()}),R({type:V(`server_tool_use`),id:F(),name:F(),input:gu(F(),uu()).nullish(),caller:z([R({type:V(`code_execution_20260120`),tool_id:F()}),R({type:V(`direct`)})]).optional()}),R({type:V(`mcp_tool_use`),id:F(),name:F(),input:uu(),server_name:F()}),R({type:V(`mcp_tool_result`),tool_use_id:F(),is_error:su(),content:L(z([F(),R({type:V(`text`),text:F()})]))}),R({type:V(`web_fetch_tool_result`),tool_use_id:F(),content:z([R({type:V(`web_fetch_result`),url:F(),retrieved_at:F(),content:R({type:V(`document`),title:F().nullable(),citations:R({enabled:su()}).optional(),source:z([R({type:V(`base64`),media_type:V(`application/pdf`),data:F()}),R({type:V(`text`),media_type:V(`text/plain`),data:F()})])})}),R({type:V(`web_fetch_tool_result_error`),error_code:F()})])}),R({type:V(`web_search_tool_result`),tool_use_id:F(),content:z([L(R({type:V(`web_search_result`),url:F(),title:F(),encrypted_content:F(),page_age:F().nullish()})),R({type:V(`web_search_tool_result_error`),error_code:F()})])}),R({type:V(`code_execution_tool_result`),tool_use_id:F(),content:z([R({type:V(`code_execution_result`),stdout:F(),stderr:F(),return_code:I(),content:L(R({type:V(`code_execution_output`),file_id:F()})).optional().default([])}),R({type:V(`encrypted_code_execution_result`),encrypted_stdout:F(),stderr:F(),return_code:I(),content:L(R({type:V(`code_execution_output`),file_id:F()})).optional().default([])}),R({type:V(`code_execution_tool_result_error`),error_code:F()})])}),R({type:V(`bash_code_execution_tool_result`),tool_use_id:F(),content:pu(`type`,[R({type:V(`bash_code_execution_result`),content:L(R({type:V(`bash_code_execution_output`),file_id:F()})),stdout:F(),stderr:F(),return_code:I()}),R({type:V(`bash_code_execution_tool_result_error`),error_code:F()})])}),R({type:V(`text_editor_code_execution_tool_result`),tool_use_id:F(),content:pu(`type`,[R({type:V(`text_editor_code_execution_tool_result_error`),error_code:F()}),R({type:V(`text_editor_code_execution_view_result`),content:F(),file_type:F(),num_lines:I().nullable(),start_line:I().nullable(),total_lines:I().nullable()}),R({type:V(`text_editor_code_execution_create_result`),is_file_update:su()}),R({type:V(`text_editor_code_execution_str_replace_result`),lines:L(F()).nullable(),new_lines:I().nullable(),new_start:I().nullable(),old_lines:I().nullable(),old_start:I().nullable()})])}),R({type:V(`tool_search_tool_result`),tool_use_id:F(),content:z([R({type:V(`tool_search_tool_search_result`),tool_references:L(R({type:V(`tool_reference`),tool_name:F()}))}),R({type:V(`tool_search_tool_result_error`),error_code:F()})])}),R({type:V(`advisor_tool_result`),tool_use_id:F(),content:pu(`type`,[R({type:V(`advisor_result`),text:F()}),R({type:V(`advisor_redacted_result`),encrypted_content:F()}),R({type:V(`advisor_tool_result_error`),error_code:F()})])}),R({type:V(`fallback`)})])),stop_reason:F().nullish(),stop_sequence:F().nullish(),stop_details:hb.nullish(),usage:fu({input_tokens:I(),output_tokens:I(),cache_creation_input_tokens:I().nullish(),cache_read_input_tokens:I().nullish(),iterations:L(R({type:z([V(`compaction`),V(`message`),V(`advisor_message`),V(`fallback_message`)]),model:F().nullish(),input_tokens:I(),output_tokens:I(),cache_creation_input_tokens:I().nullish(),cache_read_input_tokens:I().nullish()})).nullish()}),container:R({expires_at:F(),id:F(),skills:L(R({type:z([V(`anthropic`),V(`custom`)]),skill_id:F(),version:F()})).nullish()}).nullish(),context_management:R({applied_edits:L(z([R({type:V(`clear_tool_uses_20250919`),cleared_tool_uses:I(),cleared_input_tokens:I()}),R({type:V(`clear_thinking_20251015`),cleared_thinking_turns:I(),cleared_input_tokens:I()}),R({type:V(`compact_20260112`)})]))}).nullish()}))),_b=G(()=>K(pu(`type`,[R({type:V(`message_start`),message:R({id:F().nullish(),model:F().nullish(),role:F().nullish(),usage:fu({input_tokens:I(),cache_creation_input_tokens:I().nullish(),cache_read_input_tokens:I().nullish()}),content:L(pu(`type`,[R({type:V(`tool_use`),id:F(),name:F(),input:uu(),caller:z([R({type:V(`code_execution_20250825`),tool_id:F()}),R({type:V(`code_execution_20260120`),tool_id:F()}),R({type:V(`direct`)})]).optional()})])).nullish(),stop_reason:F().nullish(),container:R({expires_at:F(),id:F()}).nullish()})}),R({type:V(`content_block_start`),index:I(),content_block:pu(`type`,[R({type:V(`text`),text:F()}),R({type:V(`thinking`),thinking:F()}),R({type:V(`tool_use`),id:F(),name:F(),input:gu(F(),uu()).optional(),caller:z([R({type:V(`code_execution_20250825`),tool_id:F()}),R({type:V(`code_execution_20260120`),tool_id:F()}),R({type:V(`direct`)})]).optional()}),R({type:V(`redacted_thinking`),data:F()}),R({type:V(`compaction`),content:F().nullish()}),R({type:V(`server_tool_use`),id:F(),name:F(),input:gu(F(),uu()).nullish(),caller:z([R({type:V(`code_execution_20260120`),tool_id:F()}),R({type:V(`direct`)})]).optional()}),R({type:V(`mcp_tool_use`),id:F(),name:F(),input:uu(),server_name:F()}),R({type:V(`mcp_tool_result`),tool_use_id:F(),is_error:su(),content:L(z([F(),R({type:V(`text`),text:F()})]))}),R({type:V(`web_fetch_tool_result`),tool_use_id:F(),content:z([R({type:V(`web_fetch_result`),url:F(),retrieved_at:F(),content:R({type:V(`document`),title:F().nullable(),citations:R({enabled:su()}).optional(),source:z([R({type:V(`base64`),media_type:V(`application/pdf`),data:F()}),R({type:V(`text`),media_type:V(`text/plain`),data:F()})])})}),R({type:V(`web_fetch_tool_result_error`),error_code:F()})])}),R({type:V(`web_search_tool_result`),tool_use_id:F(),content:z([L(R({type:V(`web_search_result`),url:F(),title:F(),encrypted_content:F(),page_age:F().nullish()})),R({type:V(`web_search_tool_result_error`),error_code:F()})])}),R({type:V(`code_execution_tool_result`),tool_use_id:F(),content:z([R({type:V(`code_execution_result`),stdout:F(),stderr:F(),return_code:I(),content:L(R({type:V(`code_execution_output`),file_id:F()})).optional().default([])}),R({type:V(`encrypted_code_execution_result`),encrypted_stdout:F(),stderr:F(),return_code:I(),content:L(R({type:V(`code_execution_output`),file_id:F()})).optional().default([])}),R({type:V(`code_execution_tool_result_error`),error_code:F()})])}),R({type:V(`bash_code_execution_tool_result`),tool_use_id:F(),content:pu(`type`,[R({type:V(`bash_code_execution_result`),content:L(R({type:V(`bash_code_execution_output`),file_id:F()})),stdout:F(),stderr:F(),return_code:I()}),R({type:V(`bash_code_execution_tool_result_error`),error_code:F()})])}),R({type:V(`text_editor_code_execution_tool_result`),tool_use_id:F(),content:pu(`type`,[R({type:V(`text_editor_code_execution_tool_result_error`),error_code:F()}),R({type:V(`text_editor_code_execution_view_result`),content:F(),file_type:F(),num_lines:I().nullable(),start_line:I().nullable(),total_lines:I().nullable()}),R({type:V(`text_editor_code_execution_create_result`),is_file_update:su()}),R({type:V(`text_editor_code_execution_str_replace_result`),lines:L(F()).nullable(),new_lines:I().nullable(),new_start:I().nullable(),old_lines:I().nullable(),old_start:I().nullable()})])}),R({type:V(`tool_search_tool_result`),tool_use_id:F(),content:z([R({type:V(`tool_search_tool_search_result`),tool_references:L(R({type:V(`tool_reference`),tool_name:F()}))}),R({type:V(`tool_search_tool_result_error`),error_code:F()})])}),R({type:V(`advisor_tool_result`),tool_use_id:F(),content:pu(`type`,[R({type:V(`advisor_result`),text:F()}),R({type:V(`advisor_redacted_result`),encrypted_content:F()}),R({type:V(`advisor_tool_result_error`),error_code:F()})])}),R({type:V(`fallback`)})])}),R({type:V(`content_block_delta`),index:I(),delta:pu(`type`,[R({type:V(`input_json_delta`),partial_json:F()}),R({type:V(`text_delta`),text:F()}),R({type:V(`thinking_delta`),thinking:F()}),R({type:V(`signature_delta`),signature:F()}),R({type:V(`compaction_delta`),content:F().nullish()}),R({type:V(`citations_delta`),citation:pu(`type`,[R({type:V(`web_search_result_location`),cited_text:F(),url:F(),title:F(),encrypted_index:F()}),R({type:V(`page_location`),cited_text:F(),document_index:I(),document_title:F().nullable(),start_page_number:I(),end_page_number:I()}),R({type:V(`char_location`),cited_text:F(),document_index:I(),document_title:F().nullable(),start_char_index:I(),end_char_index:I()})])})])}),R({type:V(`content_block_stop`),index:I()}),R({type:V(`error`),error:R({type:F(),message:F()})}),R({type:V(`message_delta`),delta:R({stop_reason:F().nullish(),stop_sequence:F().nullish(),stop_details:hb.nullish(),container:R({expires_at:F(),id:F(),skills:L(R({type:z([V(`anthropic`),V(`custom`)]),skill_id:F(),version:F()})).nullish()}).nullish()}),usage:fu({input_tokens:I().nullish(),output_tokens:I(),cache_creation_input_tokens:I().nullish(),cache_read_input_tokens:I().nullish(),iterations:L(R({type:z([V(`compaction`),V(`message`),V(`advisor_message`),V(`fallback_message`)]),model:F().nullish(),input_tokens:I(),output_tokens:I(),cache_creation_input_tokens:I().nullish(),cache_read_input_tokens:I().nullish()})).nullish()}),context_management:R({applied_edits:L(z([R({type:V(`clear_tool_uses_20250919`),cleared_tool_uses:I(),cleared_input_tokens:I()}),R({type:V(`clear_thinking_20251015`),cleared_thinking_turns:I(),cleared_input_tokens:I()}),R({type:V(`compact_20260112`)})]))}).nullish()}),R({type:V(`message_stop`)}),R({type:V(`ping`)})]))),vb=G(()=>K(R({signature:F().optional(),redactedData:F().optional()}))),yb=R({containerUpload:su().optional(),citations:R({enabled:su()}).optional(),title:F().optional(),context:F().optional()}),bb=R({sendReasoning:su().optional(),structuredOutputMode:B([`outputFormat`,`jsonTool`,`auto`]).optional(),thinking:pu(`type`,[R({type:V(`adaptive`),display:B([`omitted`,`summarized`]).optional()}),R({type:V(`enabled`),budgetTokens:I().optional()}),R({type:V(`disabled`)})]).optional(),disableParallelToolUse:su().optional(),cacheControl:R({type:V(`ephemeral`),ttl:z([V(`5m`),V(`1h`)]).optional()}).optional(),metadata:R({userId:F().optional()}).optional(),mcpServers:L(R({type:V(`url`),name:F(),url:F(),authorizationToken:F().nullish(),toolConfiguration:R({enabled:su().nullish(),allowedTools:L(F()).nullish()}).nullish()})).optional(),container:R({id:F().optional(),skills:L(pu(`type`,[R({type:V(`anthropic`),skillId:F(),version:F().optional()}),R({type:V(`custom`),providerReference:gu(F(),F()),version:F().optional()})])).optional()}).optional(),toolStreaming:su().optional(),effort:B([`low`,`medium`,`high`,`xhigh`,`max`]).optional(),taskBudget:R({type:V(`tokens`),total:I().int().min(2e4),remaining:I().int().min(0).optional()}).optional(),speed:B([`fast`,`standard`]).optional(),inferenceGeo:B([`us`,`global`]).optional(),fallbacks:L(R({model:F(),max_tokens:I().int().optional(),thinking:gu(F(),uu()).optional(),output_config:gu(F(),uu()).optional(),speed:B([`fast`,`standard`]).optional()})).optional(),anthropicBeta:L(F()).optional(),contextManagement:R({edits:L(pu(`type`,[R({type:V(`clear_tool_uses_20250919`),trigger:pu(`type`,[R({type:V(`input_tokens`),value:I()}),R({type:V(`tool_uses`),value:I()})]).optional(),keep:R({type:V(`tool_uses`),value:I()}).optional(),clearAtLeast:R({type:V(`input_tokens`),value:I()}).optional(),clearToolInputs:su().optional(),excludeTools:L(F()).optional()}),R({type:V(`clear_thinking_20251015`),keep:z([V(`all`),R({type:V(`thinking_turns`),value:I()})]).optional()}),R({type:V(`compact_20260112`),trigger:R({type:V(`input_tokens`),value:I()}).optional(),pauseAfterCompaction:su().optional(),instructions:F().optional()})]))}).optional()}),xb=4,Sb=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(e,t){let n=zy(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>xb){this.warnings.push({type:`unsupported`,feature:`cacheControl breakpoint limit`,details:`Maximum ${xb} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return n}}getWarnings(){return this.warnings}},Cb=G(()=>K(R({model:F(),maxUses:I().optional(),caching:R({type:V(`ephemeral`),ttl:z([V(`5m`),V(`1h`)])}).optional()}))),wb=G(()=>K(pu(`type`,[R({type:V(`advisor_result`),text:F()}),R({type:V(`advisor_redacted_result`),encryptedContent:F()}),R({type:V(`advisor_tool_result_error`),errorCode:F()})]))),Tb=Mh({id:`anthropic.advisor_20260301`,inputSchema:G(()=>K(R({}).strict())),outputSchema:wb,supportsDeferredResults:!0}),Eb=e=>Tb(e),Db=G(()=>K(R({maxCharacters:I().optional()}))),Ob=Ah({id:`anthropic.text_editor_20250728`,inputSchema:G(()=>K(R({command:B([`view`,`create`,`str_replace`,`insert`]),path:F(),file_text:F().optional(),insert_line:I().int().optional(),new_str:F().optional(),insert_text:F().optional(),old_str:F().optional(),view_range:L(I().int()).optional()})))}),kb=(e={})=>Ob(e),Ab=G(()=>K(R({maxUses:I().optional(),allowedDomains:L(F()).optional(),blockedDomains:L(F()).optional(),userLocation:R({type:V(`approximate`),city:F().optional(),region:F().optional(),country:F().optional(),timezone:F().optional()}).optional()}))),jb=G(()=>K(L(R({url:F(),title:F().nullable(),pageAge:F().nullable(),encryptedContent:F(),type:V(`web_search_result`)})))),Mb=Mh({id:`anthropic.web_search_20260209`,inputSchema:G(()=>K(R({query:F()}))),outputSchema:jb,supportsDeferredResults:!0}),Nb=(e={})=>Mb(e),Pb=G(()=>K(R({maxUses:I().optional(),allowedDomains:L(F()).optional(),blockedDomains:L(F()).optional(),userLocation:R({type:V(`approximate`),city:F().optional(),region:F().optional(),country:F().optional(),timezone:F().optional()}).optional()}))),Fb=G(()=>K(L(R({url:F(),title:F().nullable(),pageAge:F().nullable(),encryptedContent:F(),type:V(`web_search_result`)})))),Ib=Mh({id:`anthropic.web_search_20250305`,inputSchema:G(()=>K(R({query:F()}))),outputSchema:Fb,supportsDeferredResults:!0}),Lb=(e={})=>Ib(e),Rb=G(()=>K(R({maxUses:I().optional(),allowedDomains:L(F()).optional(),blockedDomains:L(F()).optional(),citations:R({enabled:su()}).optional(),maxContentTokens:I().optional()}))),zb=G(()=>K(R({type:V(`web_fetch_result`),url:F(),content:R({type:V(`document`),title:F().nullable(),citations:R({enabled:su()}).optional(),source:z([R({type:V(`base64`),mediaType:V(`application/pdf`),data:F()}),R({type:V(`text`),mediaType:V(`text/plain`),data:F()})])}),retrievedAt:F().nullable()}))),Bb=Mh({id:`anthropic.web_fetch_20260209`,inputSchema:G(()=>K(R({url:F()}))),outputSchema:zb,supportsDeferredResults:!0}),Vb=(e={})=>Bb(e),Hb=G(()=>K(R({maxUses:I().optional(),allowedDomains:L(F()).optional(),blockedDomains:L(F()).optional(),citations:R({enabled:su()}).optional(),maxContentTokens:I().optional()}))),Ub=G(()=>K(R({type:V(`web_fetch_result`),url:F(),content:R({type:V(`document`),title:F().nullable(),citations:R({enabled:su()}).optional(),source:z([R({type:V(`base64`),mediaType:V(`application/pdf`),data:F()}),R({type:V(`text`),mediaType:V(`text/plain`),data:F()})])}),retrievedAt:F().nullable()}))),Wb=Mh({id:`anthropic.web_fetch_20250910`,inputSchema:G(()=>K(R({url:F()}))),outputSchema:Ub,supportsDeferredResults:!0}),Gb=(e={})=>Wb(e),Kb=G(()=>K(R({type:V(`code_execution_result`),stdout:F(),stderr:F(),return_code:I(),content:L(R({type:V(`code_execution_output`),file_id:F()})).optional().default([])}))),qb=Mh({id:`anthropic.code_execution_20250522`,inputSchema:G(()=>K(R({code:F()}))),outputSchema:Kb}),Jb=(e={})=>qb(e),Yb=G(()=>K(pu(`type`,[R({type:V(`code_execution_result`),stdout:F(),stderr:F(),return_code:I(),content:L(R({type:V(`code_execution_output`),file_id:F()})).optional().default([])}),R({type:V(`bash_code_execution_result`),content:L(R({type:V(`bash_code_execution_output`),file_id:F()})),stdout:F(),stderr:F(),return_code:I()}),R({type:V(`bash_code_execution_tool_result_error`),error_code:F()}),R({type:V(`text_editor_code_execution_tool_result_error`),error_code:F()}),R({type:V(`text_editor_code_execution_view_result`),content:F(),file_type:F(),num_lines:I().nullable(),start_line:I().nullable(),total_lines:I().nullable()}),R({type:V(`text_editor_code_execution_create_result`),is_file_update:su()}),R({type:V(`text_editor_code_execution_str_replace_result`),lines:L(F()).nullable(),new_lines:I().nullable(),new_start:I().nullable(),old_lines:I().nullable(),old_start:I().nullable()})]))),Xb=Mh({id:`anthropic.code_execution_20250825`,inputSchema:G(()=>K(pu(`type`,[R({type:V(`programmatic-tool-call`),code:F()}),R({type:V(`bash_code_execution`),command:F()}),pu(`command`,[R({type:V(`text_editor_code_execution`),command:V(`view`),path:F()}),R({type:V(`text_editor_code_execution`),command:V(`create`),path:F(),file_text:F().nullish()}),R({type:V(`text_editor_code_execution`),command:V(`str_replace`),path:F(),old_str:F(),new_str:F()})])]))),outputSchema:Yb,supportsDeferredResults:!0}),Zb=(e={})=>Xb(e),Qb=G(()=>K(pu(`type`,[R({type:V(`code_execution_result`),stdout:F(),stderr:F(),return_code:I(),content:L(R({type:V(`code_execution_output`),file_id:F()})).optional().default([])}),R({type:V(`encrypted_code_execution_result`),encrypted_stdout:F(),stderr:F(),return_code:I(),content:L(R({type:V(`code_execution_output`),file_id:F()})).optional().default([])}),R({type:V(`bash_code_execution_result`),content:L(R({type:V(`bash_code_execution_output`),file_id:F()})),stdout:F(),stderr:F(),return_code:I()}),R({type:V(`bash_code_execution_tool_result_error`),error_code:F()}),R({type:V(`text_editor_code_execution_tool_result_error`),error_code:F()}),R({type:V(`text_editor_code_execution_view_result`),content:F(),file_type:F(),num_lines:I().nullable(),start_line:I().nullable(),total_lines:I().nullable()}),R({type:V(`text_editor_code_execution_create_result`),is_file_update:su()}),R({type:V(`text_editor_code_execution_str_replace_result`),lines:L(F()).nullable(),new_lines:I().nullable(),new_start:I().nullable(),old_lines:I().nullable(),old_start:I().nullable()})]))),$b=Mh({id:`anthropic.code_execution_20260120`,inputSchema:G(()=>K(pu(`type`,[R({type:V(`programmatic-tool-call`),code:F()}),R({type:V(`bash_code_execution`),command:F()}),pu(`command`,[R({type:V(`text_editor_code_execution`),command:V(`view`),path:F()}),R({type:V(`text_editor_code_execution`),command:V(`create`),path:F(),file_text:F().nullish()}),R({type:V(`text_editor_code_execution`),command:V(`str_replace`),path:F(),old_str:F(),new_str:F()})])]))),outputSchema:Qb,supportsDeferredResults:!0}),ex=(e={})=>$b(e),tx=G(()=>K(L(R({type:V(`tool_reference`),toolName:F()})))),nx=Mh({id:`anthropic.tool_search_regex_20251119`,inputSchema:G(()=>K(R({pattern:F(),limit:I().optional()}))),outputSchema:tx,supportsDeferredResults:!0}),rx=(e={})=>nx(e),ix=new Set([`date-time`,`time`,`date`,`duration`,`email`,`hostname`,`uri`,`ipv4`,`ipv6`,`uuid`]),ax=[`minimum`,`maximum`,`exclusiveMinimum`,`exclusiveMaximum`,`multipleOf`,`minLength`,`maxLength`,`pattern`,`minItems`,`maxItems`,`uniqueItems`,`minProperties`,`maxProperties`,`not`],ox=class e{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.config=t,this.generateId=t.generateId??lg}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](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 Oh({provider:`anthropic`,providerOptions:m,schema:bb}),y=_===`anthropic`?null:await Oh({provider:_,providerOptions:m,schema:bb}),b=y!=null,x=Object.assign({},v??{},y??{}),{maxOutputTokens:S,supportsStructuredOutput:ee,supportsAdaptiveThinking:C,rejectsSamplingParameters:w,supportsXhighEffort:T,isKnownModel:E}=rb(this.modelId);w&&(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)&&ee,te=(this.config.supportsStrictTools??!0)&&ee,ne=x?.structuredOutputMode??`auto`,k=ne===`outputFormat`||ne===`auto`&&O,re=l?.type===`json`&&l.schema!=null&&!k?{type:`function`,name:`json`,description:`Respond with a JSON object.`,inputSchema:l.schema}:void 0,ie=x?.contextManagement,ae=new Sb,oe=Xp({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:se,betas:ce}=await Wy({prompt:t,sendReasoning:x?.sendReasoning??!0,warnings:g,cacheControlValidator:ae,toolNameMapping:oe});if(Dm(p)&&x?.effort==null){let e=ab({reasoning:p,supportsAdaptiveThinking:C,supportsXhighEffort:T,maxOutputTokensForModel:S,warnings:g});e!=null&&(x.thinking??=e.thinking,e.effort!=null&&x.thinking?.type!==`disabled`&&(x.effort=e.effort))}let le=x?.thinking?.type,ue=le===`enabled`||le===`adaptive`,de=ue||le===`disabled`,fe=le===`enabled`?x?.thinking?.budgetTokens:void 0,pe=le===`adaptive`?x?.thinking?.display:void 0,me=n??S,he={model:this.modelId,max_tokens:me,temperature:r,top_k:a,top_p:i,stop_sequences:c,...de&&{thinking:{type:le,...fe!=null&&{budget_tokens:fe},...pe!=null&&{display:pe}}},...(x?.effort||x?.taskBudget||k&&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}}},...k&&l?.type===`json`&&l.schema!=null&&{format:{type:`json_schema`,schema:Yy(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`?Fh({reference:e.providerReference,provider:`anthropic`}):e.skillId,version:e.version}))}:x.container.id},system:se.system,messages:se.messages,...ie&&{context_management:{edits:ie.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)}}};ue?(le===`enabled`&&fe==null&&(g.push({type:`compatibility`,feature:`extended thinking`,details:`thinking budget is required when thinking is enabled. using default budget of 1024 tokens.`}),he.thinking={type:`enabled`,budget_tokens:1024},fe=1024),he.temperature!=null&&(he.temperature=void 0,g.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported when thinking is enabled`})),a!=null&&(he.top_k=void 0,g.push({type:`unsupported`,feature:`topK`,details:`topK is not supported when thinking is enabled`})),i!=null&&(he.top_p=void 0,g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when thinking is enabled`})),he.max_tokens=me+(fe??0)):D&&i!=null&&r!=null&&(g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when temperature is set. topP is ignored.`}),he.top_p=void 0),E&&he.max_tokens>S&&(n!=null&&g.push({type:`unsupported`,feature:`maxOutputTokens`,details:`${he.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${S} max output tokens. The max output tokens have been limited to ${S}.`}),he.max_tokens=S),x?.mcpServers&&x.mcpServers.length>0&&ce.add(`mcp-client-2025-04-04`),ie&&(ce.add(`context-management-2025-06-27`),ie.edits.some(e=>e.type===`compact_20260112`)&&ce.add(`compact-2026-01-12`)),x?.container&&x.container.skills&&x.container.skills.length>0&&(ce.add(`code-execution-2025-08-25`),ce.add(`skills-2025-10-02`),ce.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&&ce.add(`task-budgets-2026-03-13`),x?.speed===`fast`&&ce.add(`fast-mode-2026-02-01`),x?.fallbacks&&x.fallbacks.length>0&&ce.add(`server-side-fallback-2026-06-01`);let ge=h&&(x?.toolStreaming??!0),{tools:_e,toolChoice:ve,toolWarnings:ye,betas:be}=await By(re==null?{tools:d??[],toolChoice:f,disableParallelToolUse:x?.disableParallelToolUse,cacheControlValidator:ae,supportsStructuredOutput:O,supportsStrictTools:te,defaultEagerInputStreaming:ge}:{tools:[...d??[],re],toolChoice:{type:`required`},disableParallelToolUse:!0,cacheControlValidator:ae,supportsStructuredOutput:!1,supportsStrictTools:te,defaultEagerInputStreaming:ge}),xe=ae.getWarnings();return{args:{...he,tools:_e,tool_choice:ve,stream:h===!0||void 0},warnings:[...g,...ye,...xe],betas:new Set([...ce,...be,...e,...x?.anthropicBeta??[]]),usesJsonResponseTool:re!=null,toolNameMapping:oe,providerOptionsName:_,usedCustomProviderKey:b}}async getHeaders({betas:e,headers:t}){return Wp(this.config.headers?await Nh(this.config.headers):void 0,t,e.size>0?{"anthropic-beta":Array.from(e).join(`,`)}:{})}async getBetasFromHeaders(e){let t=(this.config.headers?await Nh(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=ib(t.tools),{responseHeaders:u,value:d,rawValue:f}=await Bg({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:fb,successfulResponseHandler:qg(gb),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=nb(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:Jy({finishReason:d.stop_reason,isJsonResponseFromTool:g}),raw:d.stop_reason??void 0},usage:Vy({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=sb(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:ob(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=ib(t.tools),u=this.buildRequestUrl(!0),{responseHeaders:d,value:f}=await Bg({url:u,headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:fb,successfulResponseHandler:Kg(_b),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,ee=!1,C,w=this.generateId,[T,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(C=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`)ee=!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:w(),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=Nm(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]}C=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`:C===`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(ee){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=nb(e,c,w);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:Jy({finishReason:r.message.stop_reason,isJsonResponseFromTool:ee}),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:Jy({finishReason:r.delta.stop_reason,isJsonResponseFromTool:ee}),raw:r.delta.stop_reason??void 0},b=r.delta.stop_sequence??null,x=sb(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=ob(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:Vy({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=T.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 ei({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}}}},sx=Ah({id:`anthropic.bash_20241022`,inputSchema:G(()=>K(R({command:F(),restart:su().optional()})))}),cx=Ah({id:`anthropic.bash_20250124`,inputSchema:G(()=>K(R({command:F(),restart:su().optional()})))}),lx=Ah({id:`anthropic.computer_20241022`,inputSchema:G(()=>K(R({action:B([`key`,`type`,`mouse_move`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`screenshot`,`cursor_position`]),coordinate:L(I().int()).optional(),text:F().optional()})))}),ux=Ah({id:`anthropic.computer_20250124`,inputSchema:G(()=>K(R({action:B([`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:hu([I().int(),I().int()]).optional(),duration:I().optional(),scroll_amount:I().optional(),scroll_direction:B([`up`,`down`,`left`,`right`]).optional(),start_coordinate:hu([I().int(),I().int()]).optional(),text:F().optional()})))}),dx=Ah({id:`anthropic.computer_20251124`,inputSchema:G(()=>K(R({action:B([`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:hu([I().int(),I().int()]).optional(),duration:I().optional(),region:hu([I().int(),I().int(),I().int(),I().int()]).optional(),scroll_amount:I().optional(),scroll_direction:B([`up`,`down`,`left`,`right`]).optional(),start_coordinate:hu([I().int(),I().int()]).optional(),text:F().optional()})))}),fx=Ah({id:`anthropic.memory_20250818`,inputSchema:G(()=>K(pu(`command`,[R({command:V(`view`),path:F(),view_range:hu([I(),I()]).optional()}),R({command:V(`create`),path:F(),file_text:F()}),R({command:V(`str_replace`),path:F(),old_str:F(),new_str:F()}),R({command:V(`insert`),path:F(),insert_line:I(),insert_text:F()}),R({command:V(`delete`),path:F()}),R({command:V(`rename`),old_path:F(),new_path:F()})])))}),px=Ah({id:`anthropic.text_editor_20241022`,inputSchema:G(()=>K(R({command:B([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:F(),file_text:F().optional(),insert_line:I().int().optional(),new_str:F().optional(),insert_text:F().optional(),old_str:F().optional(),view_range:L(I().int()).optional()})))}),mx=Ah({id:`anthropic.text_editor_20250124`,inputSchema:G(()=>K(R({command:B([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:F(),file_text:F().optional(),insert_line:I().int().optional(),new_str:F().optional(),insert_text:F().optional(),old_str:F().optional(),view_range:L(I().int()).optional()})))}),hx=Ah({id:`anthropic.text_editor_20250429`,inputSchema:G(()=>K(R({command:B([`view`,`create`,`str_replace`,`insert`]),path:F(),file_text:F().optional(),insert_line:I().int().optional(),new_str:F().optional(),insert_text:F().optional(),old_str:F().optional(),view_range:L(I().int()).optional()})))}),gx=G(()=>K(L(R({type:V(`tool_reference`),toolName:F()})))),_x=Mh({id:`anthropic.tool_search_bm25_20251119`,inputSchema:G(()=>K(R({query:F(),limit:I().optional()}))),outputSchema:gx,supportsDeferredResults:!0}),vx=(e={})=>_x(e),yx={advisor_20260301:Eb,bash_20241022:cb,bash_20250124:lb,codeExecution_20250522:Jb,codeExecution_20250825:Zb,codeExecution_20260120:ex,computer_20241022:lx,computer_20250124:ux,computer_20251124:dx,memory_20250818:fx,textEditor_20241022:px,textEditor_20250124:mx,textEditor_20250429:hx,textEditor_20250728:kb,webFetch_20250910:Gb,webFetch_20260209:Vb,webSearch_20250305:Lb,webSearch_20260209:Nb,toolSearchRegex_20251119:rx,toolSearchBm25_20251119:vx},bx=G(()=>K(R({id:F(),display_title:F().nullish(),name:F().nullish(),description:F().nullish(),latest_version:F().nullish(),source:F(),created_at:F(),updated_at:F()}))),xx=G(()=>K(R({type:F(),skill_id:F(),name:F().nullish(),description:F().nullish()}))),Sx=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async getHeaders(){return Wp(await Nh(this.config.headers),{"anthropic-beta":`skills-2025-10-02`})}async fetchVersionMetadata({skillId:e,version:t,headers:n}){let{value:r}=await mg({url:`${this.config.baseURL}/skills/${e}/versions/${t}`,headers:n,failedResponseHandler:fb,successfulResponseHandler:qg(xx),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=Jp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let r=await this.getHeaders(),{value:i}=await Vg({url:`${this.config.baseURL}/skills`,headers:r,formData:n,failedResponseHandler:fb,successfulResponseHandler:qg(bx),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}}},Cx=`4.0.12`,wx=`https://api.anthropic.com`,Tx=`${wx}/v1`,db()}));function Dx(e,t){return t===`openai`?e.openaiKey:e.anthropicKey}function Ox(e,t,n){let r=Mx[e][n];return{model:e===`openai`?sv({apiKey:t})(r):db({apiKey:t,headers:Sr?void 0:{"anthropic-dangerous-direct-browser-access":`true`}})(r),provider:e,modelId:r}}function kx(e){let t=e.preferredProvider;return t&&Dx(e,t)?t:e.openaiKey?`openai`:e.anthropicKey?`anthropic`:null}async function Ax(e){let t=await Er(),n=kx(t);if(!n)throw new Nx;return Ox(n,Dx(t,n),e)}async function jx(e,t){let n=await Er(),r=e===`openai`?`anthropic`:`openai`,i=Dx(n,r);return i?Ox(r,i,t):null}var Mx,Nx,Px=t((()=>{Ry(),Ex(),Cr(),zr(),Mx={openai:{fast:`gpt-5.4-nano`,best:`gpt-5.2`},anthropic:{fast:`claude-haiku-4-5`,best:`claude-opus-4-8`}},Nx=class extends Error{constructor(){super(`No AI provider configured. Add an OpenAI or Anthropic API key in Settings.`),this.name=`NoProviderError`}}})),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,{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})})),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:()=>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})})),Lx=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=Fx(),d=Ix();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 Rx(e,t){let n=[tS,`${nS}${e}`];return t?.teamIdOrSlug&&n.push(`${rS}${zx(t.teamIdOrSlug)}`),n}function zx(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 Bx({response:e,statusCode:t,defaultMessage:n=`Gateway request failed`,cause:r,authMethod:i}){let a=await wh({value:e,schema:iC});if(!a.success){let i=typeof e==`object`&&e&&`generationId`in e?e.generationId:void 0;return new rC({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 pS.createContextualError({apiKeyProvided:i===`api-key`,oidcTokenProvided:i===`oidc`,statusCode:t,cause:r,generationId:l});case`invalid_request_error`:return new yS({message:c,statusCode:t,cause:r,generationId:l});case`rate_limit_exceeded`:return new TS({message:c,statusCode:t,cause:r,generationId:l});case`model_not_found`:{let e=await wh({value:o.error.param,schema:kS});return new MS({message:c,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:r,generationId:l})}case`internal_server_error`:return new RS({message:c,statusCode:t,cause:r,generationId:l});case`failed_dependency`:return new WS({message:c,statusCode:t,cause:r,generationId:l});case`forbidden`:{let e=await wh({value:o.error.param,schema:JS});return new ZS({message:c,statusCode:t,cause:r,generationId:l,ruleId:e.success?e.value.ruleId:void 0})}default:return new RS({message:c,statusCode:t,cause:r,generationId:l})}}function Vx(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return Nm(e.responseBody)}catch{return e.responseBody}return{}}function Hx(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 Ux(e,t){return sS.isInstance(e)?e:Hx(e)?uC.createTimeoutError({originalMessage:e instanceof Error?e.message:`Unknown error`,cause:e}):ei.isInstance(e)?e.cause&&Hx(e.cause)?uC.createTimeoutError({originalMessage:e.message,cause:e}):await Bx({response:Vx(e),statusCode:e.statusCode??500,defaultMessage:`Gateway request failed`,cause:e,authMethod:t}):await Bx({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:`Unknown Gateway error`,cause:e,authMethod:t})}async function Wx(e){let t=await wh({value:e[dC],schema:pC});return t.success?t.value:void 0}function Gx(e){if(e.type===`data`){let t=e.data;if(t instanceof Uint8Array)return{...e,data:Buffer.from(t).toString(`base64`)}}return e}function Kx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:Kp(e.data)}:e}function qx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:Kp(e.data)}:e}function Jx(e,t){let n=new URL(`${e.replace(/^http/,`ws`)}/realtime-model`);return n.searchParams.set(`ai-model-id`,t),n.toString()}async function Yx(){return(0,$x.getContext)().headers?.[`x-vercel-id`]}function Xx(e={}){let t=null,n=null,r=e.metadataCacheRefreshMillis??1e3*60*5,i=0,a=Wh(e.baseURL)??`https://ai-gateway.vercel.sh/v4/ai`,o=t=>bm({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":nw,[dC]:t.authMethod,...e.teamIdOrSlug==null?{}:{[fC]:e.teamIdOrSlug},...e.headers},`ai-sdk/gateway/${tw}`),s=async()=>{try{return o(await Zx(e))}catch(e){throw pS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},c=async()=>{try{return await Zx(e)}catch(e){throw pS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},l=async t=>{Qx();let n=await c(),r=o(n),i=new URL(`/v1/realtime/client-secrets`,a).toString();try{let{value:n}=await Bg({url:i,headers:r,body:{model:t.modelId,...t.expiresAfterSeconds!=null&&{expiresIn:t.expiresAfterSeconds}},successfulResponseHandler:qg(rw),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),fetch:e.fetch});return{token:n.token,...n.expiresAt!=null&&{expiresAt:n.expiresAt}}}catch(e){throw await Ux(e,await Wx(r))}},u=()=>{let e=Em({settingValue:void 0,environmentVariableName:`VERCEL_DEPLOYMENT_ID`}),t=Em({settingValue:void 0,environmentVariableName:`VERCEL_ENV`}),n=Em({settingValue:void 0,environmentVariableName:`VERCEL_REGION`}),r=Em({settingValue:void 0,environmentVariableName:`VERCEL_PROJECT_ID`});return async()=>{let i=await Yx();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 SC(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 hC({baseURL:a,headers:s,fetch:e.fetch}).getAvailableModels().then(e=>(n=e,e)).catch(async e=>{throw await Ux(e,await Wx(await s()))})),n?Promise.resolve(n):t},p=async()=>new hC({baseURL:a,headers:s,fetch:e.fetch}).getCredits().catch(async e=>{throw await Ux(e,await Wx(await s()))}),m=async t=>new vC({baseURL:a,headers:s,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await Ux(e,await Wx(await s()))}),h=async t=>new bC({baseURL:a,headers:s,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await Ux(e,await Wx(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 EC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),g.languageModel=d;let _=t=>new CC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.embeddingModel=_,g.textEmbeddingModel=_,g.videoModel=t=>new jC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});let v=t=>new IC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.rerankingModel=v,g.reranking=v;let y=t=>new zC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.speechModel=y,g.speech=y;let b=t=>new UC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.transcriptionModel=b,g.transcription=b;let x=t=>new qC(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=ew,g}async function Zx(e){let t=Em({settingValue:e.apiKey,environmentVariableName:`AI_GATEWAY_API_KEY`});return t?{token:t,authMethod:`api-key`}:{token:await(0,eS.getVercelOidcToken)(),authMethod:`oidc`}}function Qx(){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 $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,aw=t((()=>{Zg(),Pd(),ha(),$x=Lx(),eS=Lx(),tS=`ai-gateway-realtime.v1`,nS=`ai-gateway-auth.`,rS=`ai-gateway-team.`,iS=Symbol.for(`vercel.ai.gateway.error`),sS=class e extends (oS=Error,aS=iS,oS){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[aS]=!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&&iS in e&&e[iS]===!0}},cS=`GatewayAuthenticationError`,lS=`vercel.ai.gateway.error.${cS}`,uS=Symbol.for(lS),pS=class e extends (fS=sS,dS=uS,fS){constructor({message:e=`Authentication failed`,statusCode:t=401,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[dS]=!0,this.name=cS,this.type=`authentication_error`}static isInstance(e){return sS.hasMarker(e)&&uS 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
|
+
|
|
56
|
+
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
57
|
+
|
|
58
|
+
Provide an API key or Vercel access token via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:n?`AI Gateway authentication failed: Invalid OIDC token.
|
|
59
|
+
|
|
60
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
|
|
61
|
+
|
|
62
|
+
Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
63
|
+
or pass a Vercel access token via the 'apiKey' option.`:`AI Gateway authentication failed: No authentication provided.
|
|
64
|
+
|
|
65
|
+
Option 1 - API key:
|
|
66
|
+
Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
67
|
+
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
|
|
68
|
+
|
|
69
|
+
Option 2 - Vercel access token:
|
|
70
|
+
Pass a Vercel personal access token or Vercel app access token via the 'apiKey' option.
|
|
71
|
+
|
|
72
|
+
Option 3 - OIDC token:
|
|
73
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,new e({message:o,statusCode:r,cause:i,generationId:a})}},mS=`GatewayInvalidRequestError`,hS=`vercel.ai.gateway.error.${mS}`,gS=Symbol.for(hS),yS=class extends (vS=sS,_S=gS,vS){constructor({message:e=`Invalid request`,statusCode:t=400,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[_S]=!0,this.name=mS,this.type=`invalid_request_error`}static isInstance(e){return sS.hasMarker(e)&&gS in e}},bS=`GatewayRateLimitError`,xS=`vercel.ai.gateway.error.${bS}`,SS=Symbol.for(xS),TS=class extends (wS=sS,CS=SS,wS){constructor({message:e=`Rate limit exceeded`,statusCode:t=429,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[CS]=!0,this.name=bS,this.type=`rate_limit_exceeded`}static isInstance(e){return sS.hasMarker(e)&&SS in e}},ES=`GatewayModelNotFoundError`,DS=`vercel.ai.gateway.error.${ES}`,OS=Symbol.for(DS),kS=G(()=>K(R({modelId:F()}))),MS=class extends (jS=sS,AS=OS,jS){constructor({message:e=`Model not found`,statusCode:t=404,modelId:n,cause:r,generationId:i}={}){super({message:e,statusCode:t,cause:r,generationId:i}),this[AS]=!0,this.name=ES,this.type=`model_not_found`,this.modelId=n}static isInstance(e){return sS.hasMarker(e)&&OS in e}},NS=`GatewayInternalServerError`,PS=`vercel.ai.gateway.error.${NS}`,FS=Symbol.for(PS),RS=class extends (LS=sS,IS=FS,LS){constructor({message:e=`Internal server error`,statusCode:t=500,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[IS]=!0,this.name=NS,this.type=`internal_server_error`}static isInstance(e){return sS.hasMarker(e)&&FS in e}},zS=`GatewayFailedDependencyError`,BS=`vercel.ai.gateway.error.${zS}`,VS=Symbol.for(BS),WS=class extends (US=sS,HS=VS,US){constructor({message:e=`Failed dependency`,statusCode:t=424,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[HS]=!0,this.name=zS,this.type=`failed_dependency`}static isInstance(e){return sS.hasMarker(e)&&VS in e}},GS=`GatewayForbiddenError`,KS=`vercel.ai.gateway.error.${GS}`,qS=Symbol.for(KS),JS=G(()=>K(R({ruleId:F()}))),ZS=class extends (XS=sS,YS=qS,XS){constructor({message:e=`Forbidden`,statusCode:t=403,cause:n,generationId:r,ruleId:i}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[YS]=!0,this.name=GS,this.type=`forbidden`,this.ruleId=i}static isInstance(e){return sS.hasMarker(e)&&qS in e}},QS=`GatewayResponseError`,$S=`vercel.ai.gateway.error.${QS}`,eC=Symbol.for($S),rC=class extends (nC=sS,tC=eC,nC){constructor({message:e=`Invalid response from Gateway`,statusCode:t=502,response:n,validationError:r,cause:i,generationId:a}={}){super({message:e,statusCode:t,cause:i,generationId:a}),this[tC]=!0,this.name=QS,this.type=`response_error`,this.response=n,this.validationError=r}static isInstance(e){return sS.hasMarker(e)&&eC in e}},iC=G(()=>K(R({error:R({message:F(),type:F().nullish(),param:uu().nullish(),code:z([F(),I()]).nullish()}),generationId:F().nullish()}))),aC=`GatewayTimeoutError`,oC=`vercel.ai.gateway.error.${aC}`,sC=Symbol.for(oC),uC=class e extends (lC=sS,cC=sC,lC){constructor({message:e=`Request timed out`,statusCode:t=408,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[cC]=!0,this.name=aC,this.type=`timeout_error`}static isInstance(e){return sS.hasMarker(e)&&sC in e}static createTimeoutError({originalMessage:t,statusCode:n=408,cause:r,generationId:i}){let a=`Gateway request timed out: ${t}
|
|
74
|
+
|
|
75
|
+
This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`;return new e({message:a,statusCode:n,cause:r,generationId:i})}},dC=`ai-gateway-auth-method`,fC=`x-vercel-ai-gateway-team`,pC=G(()=>K(z([V(`api-key`),V(`oidc`)]))),mC=[`embedding`,`image`,`language`,`realtime`,`reranking`,`speech`,`transcription`,`video`],hC=class{constructor(e){this.config=e}async getAvailableModels(){try{let{value:e}=await mg({url:`${this.config.baseURL}/config`,headers:this.config.headers?await Nh(this.config.headers):void 0,successfulResponseHandler:qg(gC),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await Ux(e)}}async getCredits(){try{let{value:e}=await mg({url:`${new URL(this.config.baseURL).origin}/v1/credits`,headers:this.config.headers?await Nh(this.config.headers):void 0,successfulResponseHandler:qg(_C),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),fetch:this.config.fetch});return e}catch(e){throw await Ux(e)}}},gC=G(()=>K(R({models:L(R({id:F(),name:F(),description:F().nullish(),pricing:R({input:F(),output:F(),input_cache_read:F().nullish(),input_cache_write:F().nullish()}).transform(({input:e,output:t,input_cache_read:n,input_cache_write:r})=>({input:e,output:t,...n?{cachedInputTokens:n}:{},...r?{cacheCreationInputTokens:r}:{}})).nullish(),specification:R({specificationVersion:V(`v4`),provider:F(),modelId:F()}),modelType:F().nullish()})).transform(e=>e.filter(e=>e.modelType==null||mC.includes(e.modelType)))}))),_C=G(()=>K(R({balance:F(),total_used:F()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),vC=class{constructor(e){this.config=e}async getSpendReport(e){try{let t=new URL(this.config.baseURL),n=new URLSearchParams;n.set(`start_date`,e.startDate),n.set(`end_date`,e.endDate),e.groupBy&&n.set(`group_by`,e.groupBy),e.datePart&&n.set(`date_part`,e.datePart),e.userId&&n.set(`user_id`,e.userId),e.model&&n.set(`model`,e.model),e.provider&&n.set(`provider`,e.provider),e.credentialType&&n.set(`credential_type`,e.credentialType),e.tags&&e.tags.length>0&&n.set(`tags`,e.tags.join(`,`));let{value:r}=await mg({url:`${t.origin}/v1/report?${n.toString()}`,headers:this.config.headers?await Nh(this.config.headers):void 0,successfulResponseHandler:qg(yC),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),fetch:this.config.fetch});return r}catch(e){throw await Ux(e)}}},yC=G(()=>K(R({results:L(R({day:F().optional(),hour:F().optional(),user:F().optional(),model:F().optional(),tag:F().optional(),provider:F().optional(),credential_type:B([`byok`,`system`]).optional(),total_cost:I(),market_cost:I().optional(),input_tokens:I().optional(),output_tokens:I().optional(),cached_input_tokens:I().optional(),cache_creation_input_tokens:I().optional(),reasoning_tokens:I().optional(),request_count:I().optional()}).transform(({credential_type:e,total_cost:t,market_cost:n,input_tokens:r,output_tokens:i,cached_input_tokens:a,cache_creation_input_tokens:o,reasoning_tokens:s,request_count:c,...l})=>({...l,...e===void 0?{}:{credentialType:e},totalCost:t,...n===void 0?{}:{marketCost:n},...r===void 0?{}:{inputTokens:r},...i===void 0?{}:{outputTokens:i},...a===void 0?{}:{cachedInputTokens:a},...o===void 0?{}:{cacheCreationInputTokens:o},...s===void 0?{}:{reasoningTokens:s},...c===void 0?{}:{requestCount:c}})))}))),bC=class{constructor(e){this.config=e}async getGenerationInfo(e){try{let{value:t}=await mg({url:`${new URL(this.config.baseURL).origin}/v1/generation?id=${encodeURIComponent(e.id)}`,headers:this.config.headers?await Nh(this.config.headers):void 0,successfulResponseHandler:qg(xC),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),fetch:this.config.fetch});return t}catch(e){throw await Ux(e)}}},xC=G(()=>K(R({data:R({id:F(),total_cost:I(),upstream_inference_cost:I(),usage:I(),created_at:F(),model:F(),is_byok:su(),provider_name:F(),streamed:su(),finish_reason:F(),latency:I(),generation_time:I(),native_tokens_prompt:I(),native_tokens_completion:I(),native_tokens_reasoning:I(),native_tokens_cached:I(),native_tokens_cache_creation:I(),billable_web_search_calls:I()}).transform(({total_cost:e,upstream_inference_cost:t,created_at:n,is_byok:r,provider_name:i,finish_reason:a,generation_time:o,native_tokens_prompt:s,native_tokens_completion:c,native_tokens_reasoning:l,native_tokens_cached:u,native_tokens_cache_creation:d,billable_web_search_calls:f,...p})=>({...p,totalCost:e,upstreamInferenceCost:t,createdAt:n,isByok:r,providerName:i,finishReason:a,generationTime:o,promptTokens:s,completionTokens:c,reasoningTokens:l,cachedTokens:u,cacheCreationTokens:d,billableWebSearchCalls:f}))}).transform(({data:e})=>e))),SC=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`,this.supportedUrls={"*/*":[/.*/]}}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs(e){let{abortSignal:t,...n}=e;return{args:this.maybeEncodeFileParts(n),warnings:[]}}async doGenerate(e){let{args:t,warnings:n}=await this.getArgs(e),{abortSignal:r}=e,i=this.config.headers?await Nh(this.config.headers):void 0;try{let{responseHeaders:a,value:o,rawValue:s}=await Bg({url:this.getUrl(),headers:Wp(i,e.headers,this.getModelConfigHeaders(this.modelId,!1),await Nh(this.config.o11yHeaders)),body:t,successfulResponseHandler:qg(lu()),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{...o,request:{body:t},response:{headers:a,body:s},warnings:n}}catch(e){throw await Ux(e,await Wx(i??{}))}}async doStream(e){let{args:t,warnings:n}=await this.getArgs(e),{abortSignal:r}=e,i=this.config.headers?await Nh(this.config.headers):void 0;try{let{value:a,responseHeaders:o}=await Bg({url:this.getUrl(),headers:Wp(i,e.headers,this.getModelConfigHeaders(this.modelId,!0),await Nh(this.config.o11yHeaders)),body:t,successfulResponseHandler:Kg(lu()),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),...r&&{abortSignal:r},fetch:this.config.fetch});return{stream:a.pipeThrough(new TransformStream({start(e){n.length>0&&e.enqueue({type:`stream-start`,warnings:n})},transform(t,n){if(t.success){let r=t.value;if(r.type===`raw`&&!e.includeRawChunks)return;r.type===`response-metadata`&&r.timestamp&&typeof r.timestamp==`string`&&(r.timestamp=new Date(r.timestamp)),n.enqueue(r)}else n.error(t.error)}})),request:{body:t},response:{headers:o}}}catch(e){throw await Ux(e,await Wx(i??{}))}}maybeEncodeFileParts(e){for(let t of e.prompt)if(Array.isArray(t.content)){for(let e of t.content)if(e.type===`file`||e.type===`reasoning-file`)e.data=Gx(e.data);else if(e.type===`tool-result`&&e.output.type===`content`)for(let t of e.output.value)t.type===`file`&&(t.data=Gx(t.data))}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":`4`,"ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},CC=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`,this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:r}){let i=this.config.headers?await Nh(this.config.headers):void 0;try{let{responseHeaders:a,value:o,rawValue:s}=await Bg({url:this.getUrl(),headers:Wp(i,t??{},this.getModelConfigHeaders(),await Nh(this.config.o11yHeaders)),body:{values:e,...r?{providerOptions:r}:{}},successfulResponseHandler:qg(TC),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),...n&&{abortSignal:n},fetch:this.config.fetch});return{embeddings:o.embeddings,usage:o.usage??void 0,providerMetadata:o.providerMetadata,response:{headers:a,body:s},warnings:o.warnings??[]}}catch(e){throw await Ux(e,await Wx(i??{}))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":`4`,"ai-model-id":this.modelId}}},wC=pu(`type`,[R({type:V(`unsupported`),feature:F(),details:F().optional()}),R({type:V(`compatibility`),feature:F(),details:F().optional()}),R({type:V(`deprecated`),setting:F(),message:F()}),R({type:V(`other`),message:F()})]),TC=G(()=>K(R({embeddings:L(L(I())),usage:R({tokens:I()}).nullish(),warnings:L(wC).optional(),providerMetadata:gu(F(),gu(F(),uu())).optional()}))),EC=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`,this.maxImagesPerCall=2**53-1}static[Bp](e){return zh({modelId:e.modelId,config:e.config})}static[Vp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,size:n,aspectRatio:r,seed:i,files:a,mask:o,providerOptions:s,headers:c,abortSignal:l}){let u=this.config.headers?await Nh(this.config.headers):void 0;try{let{responseHeaders:d,value:f}=await Bg({url:this.getUrl(),headers:Wp(u,c??{},this.getModelConfigHeaders(),await Nh(this.config.o11yHeaders)),body:{prompt:e,n:t,...n&&{size:n},...r&&{aspectRatio:r},...i&&{seed:i},...s&&{providerOptions:s},...a&&{files:a.map(e=>Kx(e))},...o&&{mask:Kx(o)}},successfulResponseHandler:qg(AC),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),...l&&{abortSignal:l},fetch:this.config.fetch});return{images:f.images,warnings:f.warnings??[],providerMetadata:f.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:d},...f.usage!=null&&{usage:{inputTokens:f.usage.inputTokens??void 0,outputTokens:f.usage.outputTokens??void 0,totalTokens:f.usage.totalTokens??void 0}}}}catch(e){throw await Ux(e,await Wx(u??{}))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":`4`,"ai-model-id":this.modelId}}},DC=R({images:L(uu()).optional()}).catchall(uu()),OC=pu(`type`,[R({type:V(`unsupported`),feature:F(),details:F().optional()}),R({type:V(`compatibility`),feature:F(),details:F().optional()}),R({type:V(`deprecated`),setting:F(),message:F()}),R({type:V(`other`),message:F()})]),kC=R({inputTokens:I().nullish(),outputTokens:I().nullish(),totalTokens:I().nullish()}),AC=R({images:L(F()),warnings:L(OC).optional(),providerMetadata:gu(F(),DC).optional(),usage:kC.optional()}),jC=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`,this.maxVideosPerCall=2**53-1}get provider(){return this.config.provider}async doGenerate({prompt:e,n:t,aspectRatio:n,resolution:r,duration:i,fps:a,seed:o,generateAudio:s,image:c,frameImages:l,inputReferences:u,providerOptions:d,headers:f,abortSignal:p}){let m=this.config.headers?await Nh(this.config.headers):void 0;try{let{responseHeaders:h,value:g}=await Bg({url:this.getUrl(),headers:Wp(m,f??{},this.getModelConfigHeaders(),await Nh(this.config.o11yHeaders),{accept:`text/event-stream`}),body:{prompt:e,n:t,...n&&{aspectRatio:n},...r&&{resolution:r},...i&&{duration:i},...a&&{fps:a},...o&&{seed:o},...s!==void 0&&{generateAudio:s},...d&&{providerOptions:d},...c&&{image:qx(c)},...l&&{frameImages:l.map(e=>({...e,image:qx(e.image)}))},...u&&{inputReferences:u.map(e=>qx(e))}},successfulResponseHandler:async({response:e,url:t,requestBodyValues:n})=>{if(e.body==null)throw new ei({message:`SSE response body is empty`,url:t,requestBodyValues:n,statusCode:e.status});let r=Dh({stream:e.body,schema:FC}).getReader(),{done:i,value:a}=await r.read();if(r.releaseLock(),i||!a)throw new ei({message:`SSE stream ended without a data event`,url:t,requestBodyValues:n,statusCode:e.status});if(!a.success)throw new ei({message:`Failed to parse video SSE event`,cause:a.error,url:t,requestBodyValues:n,statusCode:e.status});let o=a.value;if(o.type===`error`)throw new ei({message:o.message,statusCode:o.statusCode,url:t,requestBodyValues:n,responseHeaders:Object.fromEntries([...e.headers]),responseBody:JSON.stringify(o),data:{error:{message:o.message,type:o.errorType,param:o.param}}});return{value:{videos:o.videos,warnings:o.warnings,providerMetadata:o.providerMetadata},responseHeaders:Object.fromEntries([...e.headers])}},failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),...p&&{abortSignal:p},fetch:this.config.fetch});return{videos:g.videos,warnings:g.warnings??[],providerMetadata:g.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:h}}}catch(e){throw await Ux(e,await Wx(m??{}))}}getUrl(){return`${this.config.baseURL}/video-model`}getModelConfigHeaders(){return{"ai-video-model-specification-version":`4`,"ai-model-id":this.modelId}}},MC=R({videos:L(uu()).optional()}).catchall(uu()),NC=z([R({type:V(`url`),url:F(),mediaType:F()}),R({type:V(`base64`),data:F(),mediaType:F()})]),PC=pu(`type`,[R({type:V(`unsupported`),feature:F(),details:F().optional()}),R({type:V(`compatibility`),feature:F(),details:F().optional()}),R({type:V(`deprecated`),setting:F(),message:F()}),R({type:V(`other`),message:F()})]),FC=pu(`type`,[R({type:V(`result`),videos:L(NC),warnings:L(PC).optional(),providerMetadata:gu(F(),MC).optional()}),R({type:V(`error`),message:F(),errorType:F(),statusCode:I(),param:uu().nullable()})]),IC=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}get provider(){return this.config.provider}async doRerank({documents:e,query:t,topN:n,headers:r,abortSignal:i,providerOptions:a}){let o=this.config.headers?await Nh(this.config.headers):void 0;try{let{responseHeaders:s,value:c,rawValue:l}=await Bg({url:this.getUrl(),headers:Wp(o,r??{},this.getModelConfigHeaders(),await Nh(this.config.o11yHeaders)),body:{documents:e,query:t,...n==null?{}:{topN:n},...a?{providerOptions:a}:{}},successfulResponseHandler:qg(RC),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),...i&&{abortSignal:i},fetch:this.config.fetch});return{ranking:c.ranking,providerMetadata:c.providerMetadata,response:{headers:s,body:l},warnings:c.warnings??[]}}catch(e){throw await Ux(e,await Wx(o??{}))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":`4`,"ai-model-id":this.modelId}}},LC=pu(`type`,[R({type:V(`unsupported`),feature:F(),details:F().optional()}),R({type:V(`compatibility`),feature:F(),details:F().optional()}),R({type:V(`deprecated`),setting:F(),message:F()}),R({type:V(`other`),message:F()})]),RC=G(()=>K(R({ranking:L(R({index:I(),relevanceScore:I()})),warnings:L(LC).optional(),providerMetadata:gu(F(),gu(F(),uu())).optional()}))),zC=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}get provider(){return this.config.provider}async doGenerate({text:e,voice:t,outputFormat:n,instructions:r,speed:i,language:a,providerOptions:o,headers:s,abortSignal:c}){let l=this.config.headers?await Nh(this.config.headers):void 0;try{let{responseHeaders:u,value:d,rawValue:f}=await Bg({url:this.getUrl(),headers:Wp(l,s??{},this.getModelConfigHeaders(),await Nh(this.config.o11yHeaders)),body:{text:e,...t&&{voice:t},...n&&{outputFormat:n},...r&&{instructions:r},...i!=null&&{speed:i},...a&&{language:a},...o&&{providerOptions:o}},successfulResponseHandler:qg(HC),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),...c&&{abortSignal:c},fetch:this.config.fetch});return{audio:d.audio,warnings:d.warnings??[],providerMetadata:d.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:u,body:f}}}catch(e){throw await Ux(e,await Wx(l??{}))}}getUrl(){return`${this.config.baseURL}/speech-model`}getModelConfigHeaders(){return{"ai-speech-model-specification-version":`4`,"ai-model-id":this.modelId}}},BC=R({}).catchall(uu()),VC=pu(`type`,[R({type:V(`unsupported`),feature:F(),details:F().optional()}),R({type:V(`compatibility`),feature:F(),details:F().optional()}),R({type:V(`deprecated`),setting:F(),message:F()}),R({type:V(`other`),message:F()})]),HC=R({audio:F(),warnings:L(VC).optional(),providerMetadata:gu(F(),BC).optional()}),UC=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}get provider(){return this.config.provider}async doGenerate({audio:e,mediaType:t,providerOptions:n,headers:r,abortSignal:i}){let a=this.config.headers?await Nh(this.config.headers):void 0;try{let{responseHeaders:o,value:s,rawValue:c}=await Bg({url:this.getUrl(),headers:Wp(a,r??{},this.getModelConfigHeaders(),await Nh(this.config.o11yHeaders)),body:{audio:e instanceof Uint8Array?Kp(e):e,mediaType:t,...n&&{providerOptions:n}},successfulResponseHandler:qg(KC),failedResponseHandler:Gg({errorSchema:lu(),errorToMessage:e=>e}),...i&&{abortSignal:i},fetch:this.config.fetch});return{text:s.text,segments:s.segments??[],language:s.language??void 0,durationInSeconds:s.durationInSeconds??void 0,warnings:s.warnings??[],providerMetadata:s.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:o,body:c}}}catch(e){throw await Ux(e,await Wx(a??{}))}}getUrl(){return`${this.config.baseURL}/transcription-model`}getModelConfigHeaders(){return{"ai-transcription-model-specification-version":`4`,"ai-model-id":this.modelId}}},WC=R({}).catchall(uu()),GC=pu(`type`,[R({type:V(`unsupported`),feature:F(),details:F().optional()}),R({type:V(`compatibility`),feature:F(),details:F().optional()}),R({type:V(`deprecated`),setting:F(),message:F()}),R({type:V(`other`),message:F()})]),KC=R({text:F(),segments:L(R({text:F(),startSecond:I(),endSecond:I()})).optional(),language:F().nullish(),durationInSeconds:I().nullish(),warnings:L(GC).optional(),providerMetadata:gu(F(),WC).optional()}),qC=class{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.provider=t.provider,this.config=t}async doCreateClientSecret(e){let t=await this.config.createClientSecret({modelId:this.modelId,...e?.expiresAfterSeconds!=null&&{expiresAfterSeconds:e.expiresAfterSeconds}});return{token:t.token,url:Jx(this.config.baseURL,this.modelId),...t.expiresAt!=null&&{expiresAt:t.expiresAt}}}getWebSocketConfig(e){return{url:e.url,protocols:Rx(e.token,{teamIdOrSlug:this.config.teamIdOrSlug})}}parseServerEvent(e){return e}serializeClientEvent(e){return e}buildSessionConfig(e){return e}},JC=Mh({id:`gateway.exa_search`,inputSchema:G(()=>K(R({query:F().describe(`Natural-language web search query. This is required.`),type:B([`auto`,`fast`,`instant`]).optional().describe(`Search method. Use auto for the default balance of speed and quality.`),num_results:I().optional().describe(`Maximum number of results to return (1-100, default: 10).`),category:B([`company`,`people`,`research paper`,`news`,`personal site`,`financial report`]).optional().describe(`Optional content category to focus results.`),user_location:F().optional().describe(`Two-letter ISO country code such as 'US'.`),include_domains:L(F()).optional().describe(`Only return results from these domains.`),exclude_domains:L(F()).optional().describe(`Exclude results from these domains.`),start_published_date:F().optional().describe(`Only return links published after this ISO 8601 date.`),end_published_date:F().optional().describe(`Only return links published before this ISO 8601 date.`),contents:R({text:z([su(),R({max_characters:I().optional(),include_html_tags:su().optional(),verbosity:B([`compact`,`standard`,`full`]).optional(),include_sections:L(B([`header`,`navigation`,`banner`,`body`,`sidebar`,`footer`,`metadata`])).optional(),exclude_sections:L(B([`header`,`navigation`,`banner`,`body`,`sidebar`,`footer`,`metadata`])).optional()})]).optional(),highlights:z([su(),R({query:F().optional(),max_characters:I().optional()})]).optional(),max_age_hours:I().optional(),livecrawl_timeout:I().optional(),subpages:I().optional(),subpage_target:z([F(),L(F())]).optional(),extras:R({links:I().optional(),image_links:I().optional()}).optional()}).optional().describe(`Controls extracted page content and freshness.`)}))),outputSchema:G(()=>K(z([R({requestId:F(),searchType:F().optional(),resolvedSearchType:F().optional(),results:L(R({title:F(),url:F(),id:F(),publishedDate:F().nullable().optional(),author:F().nullable().optional(),image:F().nullable().optional(),favicon:F().nullable().optional(),text:F().optional(),highlights:L(F()).optional(),highlightScores:L(I()).optional(),summary:F().optional(),subpages:L(lu()).optional(),extras:R({links:L(F()).optional(),imageLinks:L(F()).optional()}).optional()})),costDollars:R({total:I().optional(),search:gu(F(),I()).optional()}).optional()}),R({error:B([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`configuration_error`,`execution_error`,`unknown`]),statusCode:I().optional(),message:F()})])))}),YC=(e={})=>JC(e),XC=Mh({id:`gateway.parallel_search`,inputSchema:G(()=>K(R({objective:F().describe(`Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters.`),search_queries:L(F()).optional().describe(`Optional search queries to supplement the objective. Maximum 200 characters per query.`),mode:B([`one-shot`,`agentic`]).optional().describe(`Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.`),max_results:I().optional().describe(`Maximum number of results to return (1-20). Defaults to 10 if not specified.`),source_policy:R({include_domains:L(F()).optional().describe(`Limit results to these domains. Use plain domain names only — e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page).`),exclude_domains:L(F()).optional().describe(`Exclude results from these domains. Use plain domain names only — e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page).`),after_date:F().optional().describe(`Only include results published after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time.`)}).optional().describe(`Source policy for controlling which domains to include/exclude and freshness.`),excerpts:R({max_chars_per_result:I().optional().describe(`Maximum characters per result.`),max_chars_total:I().optional().describe(`Maximum total characters across all results.`)}).optional().describe(`Excerpt configuration for controlling result length.`),fetch_policy:R({max_age_seconds:I().optional().describe(`Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.`)}).optional().describe(`Fetch policy for controlling content freshness.`)}))),outputSchema:G(()=>K(z([R({searchId:F(),results:L(R({url:F(),title:F(),excerpt:F(),publishDate:F().nullable().optional(),relevanceScore:I().optional()}))}),R({error:B([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`configuration_error`,`unknown`]),statusCode:I().optional(),message:F()})])))}),ZC=(e={})=>XC(e),QC=Mh({id:`gateway.perplexity_search`,inputSchema:G(()=>K(R({query:z([F(),L(F())]).describe(`Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries.`),max_results:I().optional().describe(`Maximum number of search results to return (1-20, default: 10)`),max_tokens_per_page:I().optional().describe(`Maximum number of tokens to extract per search result page (256-2048, default: 2048)`),max_tokens:I().optional().describe(`Maximum total tokens across all search results (default: 25000, max: 1000000)`),country:F().optional().describe(`Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')`),search_domain_filter:L(F()).optional().describe(`List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']`),search_language_filter:L(F()).optional().describe(`List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']`),search_after_date:F().optional().describe(`Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter.`),search_before_date:F().optional().describe(`Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter.`),last_updated_after_filter:F().optional().describe(`Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter.`),last_updated_before_filter:F().optional().describe(`Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter.`),search_recency_filter:B([`day`,`week`,`month`,`year`]).optional().describe(`Filter results by relative time period. Cannot be used with search_after_date or search_before_date.`)}))),outputSchema:G(()=>K(z([R({results:L(R({title:F(),url:F(),snippet:F(),date:F().optional(),lastUpdated:F().optional()})),id:F()}),R({error:B([`api_error`,`rate_limit`,`timeout`,`invalid_input`,`unknown`]),statusCode:I().optional(),message:F()})])))}),$C=(e={})=>QC(e),ew={exaSearch:YC,parallelSearch:ZC,perplexitySearch:$C},tw=`4.0.16`,nw=`0.0.1`,rw=R({token:F(),expiresAt:I().nullish()}),iw=Xx()}));function ow({warning:e,provider:t,model:n}){let r=`AI SDK Warning${t!=null&&n!=null?` (${t} / ${n})`:``}:`;switch(e.type){case`unsupported`:{let t=`${r} The feature "${e.feature}" is not supported.`;return e.details&&(t+=` ${e.details}`),t}case`compatibility`:{let t=`${r} The feature "${e.feature}" is used in a compatibility mode.`;return e.details&&(t+=` ${e.details}`),t}case`deprecated`:return`${r} Deprecated: "${e.setting}". ${e.message}`;case`other`:return`${r} ${e.message}`;default:return`${r} ${JSON.stringify(e,null,2)}`}}function sw({provider:e,modelId:t}){hE({warnings:[{type:`compatibility`,feature:`specificationVersion`,details:`Using v2 specification compatibility mode. Some features may not be available.`}],provider:e,model:t})}function cw(e){return e.specificationVersion===`v3`?e:(sw({provider:e.provider,modelId:e.modelId}),new Proxy(e,{get(e,t){return t===`specificationVersion`?`v3`:e[t]}}))}function lw(e){if(e.specificationVersion===`v4`)return e;let t=e.specificationVersion===`v2`?cw(e):e;return new Proxy(t,{get(e,t){return t===`specificationVersion`?`v4`:e[t]}})}function uw(e){return e.specificationVersion===`v3`?e:(sw({provider:e.provider,modelId:e.modelId}),new Proxy(e,{get(e,t){return t===`specificationVersion`?`v3`:e[t]}}))}function dw(e){if(e.specificationVersion===`v4`)return e;let t=e.specificationVersion===`v2`?uw(e):e;return new Proxy(t,{get(e,t){return t===`specificationVersion`?`v4`:e[t]}})}function fw(e){return e.specificationVersion===`v3`?e:(sw({provider:e.provider,modelId:e.modelId}),new Proxy(e,{get(e,t){switch(t){case`specificationVersion`:return`v3`;case`doGenerate`:return async(...t)=>{let n=await e.doGenerate(...t);return{...n,finishReason:mw(n.finishReason),usage:hw(n.usage)}};case`doStream`:return async(...t)=>{let n=await e.doStream(...t);return{...n,stream:pw(n.stream)}};default:return e[t]}}}))}function pw(e){return e.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`finish`:t.enqueue({...e,finishReason:mw(e.finishReason),usage:hw(e.usage)});break;default:t.enqueue(e);break}}}))}function mw(e){return{unified:e===`unknown`?`other`:e,raw:void 0}}function hw(e){return{inputTokens:{total:e.inputTokens,noCache:void 0,cacheRead:e.cachedInputTokens,cacheWrite:void 0},outputTokens:{total:e.outputTokens,text:void 0,reasoning:e.reasoningTokens}}}function gw(e){if(e.specificationVersion===`v4`)return e;let t=e.specificationVersion===`v2`?fw(e):e;return new Proxy(t,{get(e,t){return t===`specificationVersion`?`v4`:e[t]}})}function _w(e){return e.specificationVersion===`v4`?e:new Proxy(e,{get(e,t){return t===`specificationVersion`?`v4`:e[t]}})}function vw(e){return e.specificationVersion===`v3`?e:(sw({provider:e.provider,modelId:e.modelId}),new Proxy(e,{get(e,t){return t===`specificationVersion`?`v3`:e[t]}}))}function yw(e){if(e.specificationVersion===`v4`)return e;let t=e.specificationVersion===`v2`?vw(e):e;return new Proxy(t,{get(e,t){return t===`specificationVersion`?`v4`:e[t]}})}function bw(e){return e.specificationVersion===`v3`?e:(sw({provider:e.provider,modelId:e.modelId}),new Proxy(e,{get(e,t){return t===`specificationVersion`?`v3`:e[t]}}))}function xw(e){if(e.specificationVersion===`v4`)return e;let t=e.specificationVersion===`v2`?bw(e):e;return new Proxy(t,{get(e,t){return t===`specificationVersion`?`v4`:e[t]}})}function Sw(e){if(`specificationVersion`in e&&e.specificationVersion===`v3`)return e;let t=e;return{specificationVersion:`v3`,languageModel:e=>fw(t.languageModel(e)),embeddingModel:e=>cw(t.textEmbeddingModel(e)),imageModel:e=>uw(t.imageModel(e)),transcriptionModel:t.transcriptionModel?e=>bw(t.transcriptionModel(e)):void 0,speechModel:t.speechModel?e=>vw(t.speechModel(e)):void 0,rerankingModel:void 0}}function Cw(e){if(`specificationVersion`in e&&e.specificationVersion===`v4`)return e;let t=!(`specificationVersion`in e)||e.specificationVersion!==`v3`?Sw(e):e;return{specificationVersion:`v4`,languageModel:e=>gw(t.languageModel(e)),embeddingModel:e=>lw(t.embeddingModel(e)),imageModel:e=>dw(t.imageModel(e)),transcriptionModel:t.transcriptionModel?e=>xw(t.transcriptionModel(e)):void 0,speechModel:t.speechModel?e=>yw(t.speechModel(e)):void 0,rerankingModel:t.rerankingModel?e=>_w(t.rerankingModel(e)):void 0}}function ww(e){if(typeof e==`string`)return Tw().languageModel(e);if(![`v4`,`v3`,`v2`].includes(e.specificationVersion)){let t=e;throw new YT({version:t.specificationVersion,provider:t.provider,modelId:t.modelId})}return gw(e)}function Tw(){return Cw(globalThis.AI_SDK_DEFAULT_PROVIDER??iw)}function Ew(e){try{let[t,n]=e.split(`,`);return{mediaType:t.split(`;`)[0].split(`:`)[1],base64Content:n}}catch{return{mediaType:void 0,base64Content:void 0}}}function Dw(e){if(typeof e!=`object`||!e)return!1;let t=e.type;return t===`data`||t===`url`||t===`reference`||t===`text`}function Ow(e){if(e.protocol===`data:`){let{mediaType:t,base64Content:n}=Ew(e.toString());if(t==null||n==null)throw new tE({content:e,message:`Invalid data URL format in content ${e.toString()}`});return{data:{type:`data`,data:n},mediaType:t}}return{data:{type:`url`,url:e},mediaType:void 0}}function kw(e){return e instanceof Uint8Array?{data:{type:`data`,data:e},mediaType:void 0}:e instanceof ArrayBuffer||xm(e)?{data:{type:`data`,data:new Uint8Array(e)},mediaType:void 0}:{data:{type:`data`,data:e},mediaType:void 0}}function Aw(e){if(Dw(e))switch(e.type){case`data`:if(typeof e.data==`string`&&e.data.startsWith(`data:`))throw new tE({content:e.data,message:`Data URLs are not valid inline data. Pass them as { type: "url", url } instead.`});return kw(e.data);case`url`:return Ow(e.url);case`reference`:return{data:{type:`reference`,reference:e.reference},mediaType:void 0};case`text`:return{data:{type:`text`,text:e.text},mediaType:void 0}}if(e instanceof URL)return Ow(e);if(typeof e==`string`)try{return Ow(new URL(e))}catch{return kw(e)}return Cm(e)?{data:{type:`reference`,reference:e},mediaType:void 0}:kw(e)}async function jw({prompt:e,supportedUrls:t,download:n=vE(),provider:r}){let i=await Pw(e.messages,n,t),a=new Map;for(let t of e.messages)if(t.role===`assistant`&&Array.isArray(t.content))for(let e of t.content)e.type===`tool-approval-request`&&`approvalId`in e&&`toolCallId`in e&&a.set(e.approvalId,e.toolCallId);let o=new Set;for(let t of e.messages)if(t.role===`tool`){for(let e of t.content)if(e.type===`tool-approval-response`){let t=a.get(e.approvalId);t&&o.add(t)}}let s=[...e.instructions==null?[]:typeof e.instructions==`string`?[{role:`system`,content:e.instructions}]:Up(e.instructions).map(e=>({role:`system`,content:e.content,providerOptions:e.providerOptions})),...e.messages.map(e=>Mw({message:e,downloadedAssets:i,provider:r}))],c=[];for(let e of s){if(e.role!==`tool`){c.push(e);continue}let t=c.at(-1);t?.role===`tool`?t.content.push(...e.content):c.push(e)}let l=new Set;for(let e of c)switch(e.role){case`assistant`:for(let t of e.content)t.type===`tool-call`&&!t.providerExecuted&&l.add(t.toolCallId);break;case`tool`:for(let t of e.content)t.type===`tool-result`&&l.delete(t.toolCallId);break;case`user`:case`system`:for(let e of o)l.delete(e);if(l.size>0)throw new IT({toolCallIds:Array.from(l)});break}for(let e of o)l.delete(e);if(l.size>0)throw new IT({toolCallIds:Array.from(l)});return c.filter(e=>e.role!==`tool`||e.content.length>0)}function Mw({message:e,downloadedAssets:t,provider:n}){let r=[],i=e.role;switch(i){case`system`:return{role:`system`,content:e.content,providerOptions:e.providerOptions};case`user`:{if(typeof e.content==`string`)return{role:`user`,content:[{type:`text`,text:e.content}],providerOptions:e.providerOptions};let n={role:`user`,content:e.content.map(e=>(e.type===`image`&&r.push({type:`deprecated`,setting:`"image" content part`,message:`The "image" content part type is deprecated. Use a "file" part with mediaType: 'image' (or a more specific image/* subtype) instead.`}),Nw(e))).map(e=>Fw(e,t)).filter(e=>e.type!==`text`||e.text!==``),providerOptions:e.providerOptions};return r.length>0&&hE({warnings:r}),n}case`assistant`:{if(typeof e.content==`string`)return{role:`assistant`,content:[{type:`text`,text:e.content}],providerOptions:e.providerOptions};let i={role:`assistant`,content:e.content.filter(e=>e.type!==`text`||e.text!==``||e.providerOptions!=null).filter(e=>e.type!==`tool-approval-request`).map(e=>{let i=e.providerOptions;switch(e.type){case`custom`:return{type:`custom`,kind:e.kind,providerOptions:i};case`file`:{let{data:t,mediaType:n}=Aw(e.data);return{type:`file`,data:t,filename:e.filename,mediaType:n??e.mediaType,providerOptions:i}}case`reasoning`:return{type:`reasoning`,text:e.text,providerOptions:i};case`reasoning-file`:{let{data:t,mediaType:n}=Aw(e.data);if(t.type!==`data`&&t.type!==`url`)throw Error(`Unsupported reasoning-file data type: ${t.type}`);return{type:`reasoning-file`,data:t,mediaType:n??e.mediaType,providerOptions:i}}case`text`:return{type:`text`,text:e.text,providerOptions:i};case`tool-call`:return{type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,providerExecuted:e.providerExecuted,providerOptions:i};case`tool-result`:return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:Iw({output:e.output,provider:n,warnings:r,downloadedAssets:t}),providerOptions:i}}}),providerOptions:e.providerOptions};return r.length>0&&hE({warnings:r}),i}case`tool`:{let i={role:`tool`,content:e.content.filter(e=>e.type!==`tool-approval-response`||e.providerExecuted).map(e=>{switch(e.type){case`tool-result`:return{type:`tool-result`,toolCallId:e.toolCallId,toolName:e.toolName,output:Iw({output:e.output,provider:n,warnings:r,downloadedAssets:t}),providerOptions:e.providerOptions};case`tool-approval-response`:return{type:`tool-approval-response`,approvalId:e.approvalId,approved:e.approved,reason:e.reason}}}),providerOptions:e.providerOptions};return r.length>0&&hE({warnings:r}),i}default:throw new oE({role:i})}}function Nw(e){return e.type===`image`?{type:`file`,data:e.image,mediaType:e.mediaType??`image`,providerOptions:e.providerOptions}:e}async function Pw(e,t,n){let r=[];for(let t of e){if(t.role===`user`&&Array.isArray(t.content))for(let e of t.content){let t=Nw(e);t.type===`file`&&r.push(t)}if(t.role===`tool`){for(let e of t.content)if(e.type===`tool-result`&&e.output.type===`content`)for(let t of e.output.value)t.type===`file`&&r.push(t)}if(t.role===`assistant`&&Array.isArray(t.content)){for(let e of t.content)if(e.type===`tool-result`&&e.output.type===`content`)for(let t of e.output.value)t.type===`file`&&r.push(t)}}let i=r.map(e=>{let t=e.mediaType,{data:n}=Aw(e.data);return{mediaType:t,data:n}}).filter(e=>e.data.type===`url`).map(e=>({url:e.data.url,isUrlSupportedByModel:e.mediaType!=null&&wm({url:e.data.url.toString(),mediaType:e.mediaType,supportedUrls:n})})),a=await t(i);return Object.fromEntries(a.map((e,t)=>e==null?null:[i[t].url.toString(),{data:e.data,mediaType:e.mediaType}]).filter(e=>e!=null))}function Fw(e,t){if(e.type===`text`)return{type:`text`,text:e.text,providerOptions:e.providerOptions};let{data:n,mediaType:r}=Aw(e.data),i=r??e.mediaType,a=n;if(a.type===`url`){let e=t[a.url.toString()];e&&(a={type:`data`,data:e.data},e.mediaType!=null&&(i==null||!rm(i))&&(i=e.mediaType))}if(a.type===`data`&&(a.data instanceof Uint8Array||typeof a.data==`string`)){let e=tm({data:a.data,topLevelType:`image`});e!=null&&(i=e)}if(i==null)throw Error(`Media type is missing for file part`);return{type:`file`,mediaType:i,filename:e.filename,data:a,providerOptions:e.providerOptions}}function Iw({output:e,provider:t,warnings:n=[],downloadedAssets:r}){return e.type===`content`?{type:`content`,value:e.value.map(e=>{switch(e.type){case`file`:{let t=Fw(e,r);if(t.type!==`file`)throw Error(`Expected tool result file content to convert to file.`);return t}case`file-data`:return n.push({type:`deprecated`,setting:`"tool-result" content of type "file-data"`,message:`The "file-data" type for tool result content is deprecated. Use the "file" type with mediaType and { type: 'data', data } instead.`}),{type:`file`,data:{type:`data`,data:e.data},filename:e.filename,mediaType:e.mediaType,providerOptions:e.providerOptions};case`file-url`:{let t=e.mediaType??Rw(e.url),r=`The "file-url" type for tool result content is deprecated. Use the "file" type with mediaType and { type: 'url', url } instead.`;if(!e.mediaType){let n=t===`application/octet-stream`?`Unable to infer media type from URL. Defaulting to 'application/octet-stream'.`:`Inferred media type '${t}' from URL.`;r=`The "file-url" tool result content part with URL "${e.url}" is missing a "mediaType". ${n} ${r}`}return n.push({type:`deprecated`,setting:`"tool-result" content of type "file-url"`,message:r}),{type:`file`,data:{type:`url`,url:new URL(e.url)},mediaType:t,providerOptions:e.providerOptions}}case`file-id`:return n.push({type:`deprecated`,setting:`"tool-result" content of type "file-id"`,message:`The "file-id" type for tool result content is deprecated. Use the "file" type with mediaType and { type: 'reference', reference } instead.`}),{type:`file`,data:{type:`reference`,reference:Lw({fileId:e.fileId,provider:t})},mediaType:`application`,providerOptions:e.providerOptions};case`file-reference`:return n.push({type:`deprecated`,setting:`"tool-result" content of type "file-reference"`,message:`The "file-reference" type for tool result content is deprecated. Use the "file" type with mediaType and { type: 'reference', reference } instead.`}),{type:`file`,data:{type:`reference`,reference:e.providerReference},mediaType:`application`,providerOptions:e.providerOptions};case`image-data`:return n.push({type:`deprecated`,setting:`"tool-result" content of type "image-data"`,message:`The "image-data" type for tool result content is deprecated. Use the "file" type with mediaType and { type: 'data', data } instead.`}),{type:`file`,data:{type:`data`,data:e.data},mediaType:e.mediaType,providerOptions:e.providerOptions};case`image-url`:return n.push({type:`deprecated`,setting:`"tool-result" content of type "image-url"`,message:`The "image-url" type for tool result content is deprecated. Use the "file" type with mediaType 'image' (or a specific image/* subtype) and { type: 'url', url } instead.`}),{type:`file`,data:{type:`url`,url:new URL(e.url)},mediaType:`image`,providerOptions:e.providerOptions};case`image-file-id`:return n.push({type:`deprecated`,setting:`"tool-result" content of type "image-file-id"`,message:`The "image-file-id" type for tool result content is deprecated. Use the "file" type with mediaType and { type: 'reference', reference } instead.`}),{type:`file`,data:{type:`reference`,reference:Lw({fileId:e.fileId,provider:t})},mediaType:`image`,providerOptions:e.providerOptions};case`image-file-reference`:return n.push({type:`deprecated`,setting:`"tool-result" content of type "image-file-reference"`,message:`The "image-file-reference" type for tool result content is deprecated. Use the "file" type with mediaType and { type: 'reference', reference } instead.`}),{type:`file`,data:{type:`reference`,reference:e.providerReference},mediaType:`image`,providerOptions:e.providerOptions};default:return e}})}:e}function Lw({fileId:e,provider:t}){if(typeof e==`object`)return e;if(t==null)throw Error(`Cannot convert string fileId to provider reference without a provider ID. Use a Record<string, string> fileId or switch to the file-reference type.`);return{[t]:e}}function Rw(e,t=`application/octet-stream`){try{let t=new URL(e).pathname.split(`.`).pop()?.toLowerCase();if(t&&Object.hasOwn(yE,t))return yE[t]}catch{}return t}function zw({maxOutputTokens:e,temperature:t,topP:n,topK:r,presencePenalty:i,frequencyPenalty:a,seed:o,stopSequences:s,reasoning:c}){if(e!=null){if(!Number.isInteger(e))throw new ET({parameter:`maxOutputTokens`,value:e,message:`maxOutputTokens must be an integer`});if(e<1)throw new ET({parameter:`maxOutputTokens`,value:e,message:`maxOutputTokens must be >= 1`})}if(t!=null&&typeof t!=`number`)throw new ET({parameter:`temperature`,value:t,message:`temperature must be a number`});if(n!=null&&typeof n!=`number`)throw new ET({parameter:`topP`,value:n,message:`topP must be a number`});if(r!=null&&typeof r!=`number`)throw new ET({parameter:`topK`,value:r,message:`topK must be a number`});if(i!=null&&typeof i!=`number`)throw new ET({parameter:`presencePenalty`,value:i,message:`presencePenalty must be a number`});if(a!=null&&typeof a!=`number`)throw new ET({parameter:`frequencyPenalty`,value:a,message:`frequencyPenalty must be a number`});if(o!=null&&!Number.isInteger(o))throw new ET({parameter:`seed`,value:o,message:`seed must be an integer`});return{maxOutputTokens:e,temperature:t,topP:n,topK:r,presencePenalty:i,frequencyPenalty:a,stopSequences:s,seed:o,reasoning:c}}async function Bw({allowSystemInMessages:e=!1,system:t,instructions:n=t,prompt:r,messages:i}){if(r==null&&i==null)throw new vi({prompt:r,message:`prompt or messages must be defined`});if(r!=null&&i!=null)throw new vi({prompt:r,message:`prompt and messages cannot be defined at the same time`});if(typeof n!=`string`&&!Up(n).every(e=>e.role===`system`))throw new vi({prompt:r,message:`instructions must be a string, SystemModelMessage, or array of SystemModelMessage`});if(r!=null&&typeof r==`string`)i=[{role:`user`,content:r}];else if(r!=null&&Array.isArray(r))i=r;else if(i==null)throw new vi({prompt:r,message:`prompt or messages must be defined`});if(i.length===0)throw new vi({prompt:r,message:`messages must not be empty`});if(!e&&i.some(e=>e.role===`system`))throw new vi({prompt:r,message:`System messages are not allowed in the prompt or messages fields. Use the instructions option instead.`});let a=await wh({value:i,schema:L(VE)});if(!a.success)throw new vi({prompt:r,message:`The messages do not match the ModelMessage[] schema.`,cause:a.error});return{messages:i,instructions:n}}function Vw(e){if(!pS.isInstance(e))return e;let t=(process==null?void 0:`production`)===`production`,n=`https://ai-sdk.dev/unauthenticated-ai-gateway`;return t?new Jr({name:`GatewayError`,message:`Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${n}`}):Object.assign(Error(`\x1B[1m\x1B[31mUnauthenticated request to AI Gateway.\x1B[0m
|
|
76
|
+
|
|
77
|
+
To authenticate, set the \x1B[33mAI_GATEWAY_API_KEY\x1B[0m environment variable with your API key.
|
|
78
|
+
|
|
79
|
+
Alternatively, you can use a provider module instead of the AI Gateway.
|
|
80
|
+
|
|
81
|
+
Learn more: \x1B[34m${n}\x1B[0m
|
|
82
|
+
|
|
83
|
+
`),{name:`GatewayAuthenticationError`})}function Hw(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:Ww(e.inputTokens.total,e.outputTokens.total),raw:e.raw}}function Uw(){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 Ww(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function Gw(){return(globalThis==null?void 0:globalThis.performance)?.now()??Date.now()}async function Kw(e){await Promise.all(Up(e.callbacks).map(async t=>{try{await t?.(e.event)}catch{}}))}function qw({error:e,exponentialBackoffDelay:t}){let n=ei.isInstance(e)?e.responseHeaders:ei.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 Jw({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new ET({parameter:`maxRetries`,value:e,message:`maxRetries must be an integer`});if(e<0)throw new ET({parameter:`maxRetries`,value:e,message:`maxRetries must be >= 0`})}let n=e??2;return{maxRetries:n,retry:HE({maxRetries:n,abortSignal:t})}}function Yw(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 Xw(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await Eh({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await Eh({text:Yw(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function Zw(...e){return async t=>{await Promise.allSettled(e.map(async e=>{await e?.(t)}))}}function Qw(){return typeof process<`u`&&process.release?.name===`node`}async function $w(){if(Qw())return XE??=Promise.resolve(eT(`node:diagnostics_channel`)),XE}function eT(e){let t=globalThis.process;try{return(t?.getBuiltinModule)?.call(t,e)}catch{return}}async function tT(e,t){let n=await $w(),r=(n?.tracingChannel)?.call(n,YE);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 nT({message:e,completion:t}){if(!Qw())return;let n=eT(`node:diagnostics_channel`),r=eT(`node:async_hooks`),i=(n?.tracingChannel)?.call(n,YE);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 rT(){return globalThis.AI_SDK_TELEMETRY_INTEGRATIONS??[]}function iT(e,t){return Object.assign(Object.create(Object.getPrototypeOf(e)),e,t)}function aT({telemetry:e}){if(e?.isEnabled===!1)return{};let t=e?.integrations,n=t==null?rT():Up(t),r={recordInputs:e?.recordInputs,recordOutputs:e?.recordOutputs,functionId:e?.functionId},i=e=>{let t=Zw(...n.map(t=>t[e]?.bind(t)).filter(Boolean).map(e=>t=>e(iT(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 tT({type:e,event:iT(t,r)},n),startTracingChannelContext:({type:e,event:t,completion:n})=>nT({message:{type:e,event:iT(t,r)},completion:n}),onStart:i(`onStart`),onStepStart:i(`onStepStart`),onLanguageModelCallStart:i(`onLanguageModelCallStart`),onLanguageModelCallEnd:i(`onLanguageModelCallEnd`),onToolExecutionStart:i(`onToolExecutionStart`),onToolExecutionEnd:i(`onToolExecutionEnd`),onStepEnd:Zw(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=iT(t,r),i=e;for(let e of a){let t=i;i=()=>e({...n,execute:t})}return await tT({type:`languageModelCall`,event:n},i)},executeTool:async({execute:e,...t})=>{let n=iT(t,r),i=e;for(let e of o){let t=i;i=()=>e({...n,execute:t})}return await i()}}}function oT(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 sT({status:e,statusText:t,headers:n,stream:r}){return new Response(r.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:oT(n,{"content-type":`text/plain; charset=utf-8`})})}function cT({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 lT({response:e,status:t,statusText:n,headers:r,stream:i}){cT({response:e,status:t,statusText:n,headers:Object.fromEntries(oT(r,{"content-type":`text/plain; charset=utf-8`}).entries()),stream:i.pipeThrough(new TextEncoderStream)})}function uT(e){return dT(e.pipeThrough(new TransformStream))}function dT(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 fT(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function pT(){let e=[],t=null,n=!1,r=fT(),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=fT(),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 mT({output:e,schema:t,enumValues:n}){switch(e){case`object`:return QE(vh(t));case`array`:return $E(vh(t));case`enum`:return eD(n);case`no-schema`:return ZE;default:throw Error(`Unsupported output: ${e}`)}}async function hT(e,t,n){let r=await Eh({text:e});if(!r.success)throw new HT({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 HT({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 gT(e,t,n,r){try{return await hT(e,t,r)}catch(i){if(n!=null&&HT.isInstance(i)&&(Ai.isInstance(i.cause)||ca.isInstance(i.cause))){let a=await n({text:e,error:i.cause});if(a===null)throw i;return await hT(a,t,r)}throw i}}function _T({output:e,schema:t,schemaName:n,schemaDescription:r,enumValues:i}){if(e!=null&&e!==`object`&&e!==`array`&&e!==`enum`&&e!==`no-schema`)throw new ET({parameter:`output`,value:e,message:`Invalid output type.`});if(e===`no-schema`){if(t!=null)throw new ET({parameter:`schema`,value:t,message:`Schema is not supported for no-schema output.`});if(r!=null)throw new ET({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for no-schema output.`});if(n!=null)throw new ET({parameter:`schemaName`,value:n,message:`Schema name is not supported for no-schema output.`});if(i!=null)throw new ET({parameter:`enumValues`,value:i,message:`Enum values are not supported for no-schema output.`})}if(e===`object`){if(t==null)throw new ET({parameter:`schema`,value:t,message:`Schema is required for object output.`});if(i!=null)throw new ET({parameter:`enumValues`,value:i,message:`Enum values are not supported for object output.`})}if(e===`array`){if(t==null)throw new ET({parameter:`schema`,value:t,message:`Element schema is required for array output.`});if(i!=null)throw new ET({parameter:`enumValues`,value:i,message:`Enum values are not supported for array output.`})}if(e===`enum`){if(t!=null)throw new ET({parameter:`schema`,value:t,message:`Schema is not supported for enum output.`});if(r!=null)throw new ET({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for enum output.`});if(n!=null)throw new ET({parameter:`schemaName`,value:n,message:`Schema name is not supported for enum output.`});if(i==null)throw new ET({parameter:`enumValues`,value:i,message:`Enum values are required for enum output.`});for(let e of i)if(typeof e!=`string`)throw new ET({parameter:`enumValues`,value:e,message:`Enum values must be strings.`})}}function vT(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(!vT(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)||!vT(e[i],t[i]))return!1;return!0}function yT(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:ee,_internal:{generateId:C=tD,currentDate:w=()=>new Date,now:T=Gw}={},...E}=e,D=`enum`in e&&e.enum?e.enum:void 0,{schema:O,schemaDescription:te,schemaName:ne}=`schema`in e?e:{};return _T({output:n,schema:O,schemaName:ne,schemaDescription:te,enumValues:D}),new nD({model:t,telemetry:p,headers:u,settings:E,maxRetries:c,abortSignal:l,outputStrategy:mT({output:n,schema:O,enumValues:D}),instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,schemaName:ne,schemaDescription:te,providerOptions:h,repairText:d,onStart:g??_,onStepStart:v??y,onStepFinish:b??x,onError:S,onFinish:ee,download:m,generateId:C,currentDate:w,now:T})}var 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,iD=t((()=>{Zg(),ha(),aw(),Pd(),bT=Object.defineProperty,xT=(e,t)=>{for(var n in t)bT(e,n,{get:t[n],enumerable:!0})},ST=`AI_InvalidArgumentError`,CT=`vercel.ai.error.${ST}`,wT=Symbol.for(CT),ET=class extends Jr{constructor({parameter:e,value:t,message:n}){super({name:ST,message:`Invalid argument for parameter ${e}: ${n}`}),this[TT]=!0,this.parameter=e,this.value=t}static isInstance(e){return Jr.hasMarker(e,CT)}},TT=wT,DT=`AI_InvalidStreamPartError`,`${DT}`,OT=`AI_InvalidToolApprovalError`,`${OT}`,kT=`AI_InvalidToolApprovalSignatureError`,`${kT}`,AT=`AI_InvalidToolInputError`,`${AT}`,jT=`AI_ToolCallNotFoundForApprovalError`,`${jT}`,MT=`AI_MissingToolResultsError`,NT=`vercel.ai.error.${MT}`,PT=Symbol.for(NT),IT=class extends Jr{constructor({toolCallIds:e}){super({name:MT,message:`Tool result${e.length>1?`s are`:` is`} missing for tool call${e.length>1?`s`:``} ${e.join(`, `)}.`}),this[FT]=!0,this.toolCallIds=e}static isInstance(e){return Jr.hasMarker(e,NT)}},FT=PT,LT=`AI_NoImageGeneratedError`,`${LT}`,RT=`AI_NoObjectGeneratedError`,zT=`vercel.ai.error.${RT}`,BT=Symbol.for(zT),HT=class extends Jr{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:RT,message:e,cause:t}),this[VT]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return Jr.hasMarker(e,zT)}},VT=BT,UT=`AI_NoOutputGeneratedError`,`${UT}`,WT=`AI_NoSpeechGeneratedError`,`${WT}`,GT=`AI_NoTranscriptGeneratedError`,`${GT}`,KT=`AI_NoVideoGeneratedError`,`${KT}`,qT=`AI_NoSuchToolError`,`${qT}`,JT=`AI_ToolCallRepairError`,`${JT}`,YT=class extends Jr{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}},XT=`AI_UIMessageStreamError`,`${XT}`,ZT=`AI_InvalidDataContentError`,QT=`vercel.ai.error.${ZT}`,$T=Symbol.for(QT),tE=class extends Jr{constructor({content:e,cause:t,message:n=`Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof e}.`}){super({name:ZT,message:n,cause:t}),this[eE]=!0,this.content=e}static isInstance(e){return Jr.hasMarker(e,QT)}},eE=$T,nE=`AI_InvalidMessageRoleError`,rE=`vercel.ai.error.${nE}`,iE=Symbol.for(rE),oE=class extends Jr{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:nE,message:t}),this[aE]=!0,this.role=e}static isInstance(e){return Jr.hasMarker(e,rE)}},aE=iE,sE=`AI_MessageConversionError`,`${sE}`,cE=`AI_RetryError`,lE=`vercel.ai.error.${cE}`,uE=Symbol.for(lE),fE=class extends Jr{constructor({message:e,reason:t,errors:n}){super({name:cE,message:e}),this[dE]=!0,this.reason=t,this.errors=n,this.lastError=n[n.length-1]}static isInstance(e){return Jr.hasMarker(e,lE)}},dE=uE,pE=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,mE=!1,hE=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}mE||(mE=!0,console.info(pE));for(let t of e.warnings){let n=ow({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)}}},gE=`7.0.22`,_E=async({url:e,maxBytes:t,abortSignal:n})=>{let r=e.toString();try{let e=await dm({url:r,headers:bm({},`ai-sdk/${gE}`,vm()),abortSignal:n});if(!e.ok)throw await im(e),new ag({url:r,statusCode:e.status,statusText:e.statusText});return{data:await fm({response:e,url:r,maxBytes:t??sg}),mediaType:e.headers.get(`content-type`)??void 0}}catch(e){throw ag.isInstance(e)?e:new ag({url:r,cause:e})}},vE=(e=_E)=>t=>Promise.all(t.map(async t=>t.isUrlSupportedByModel?null:await e(t))),yE={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`},bE=Eu(()=>z([cu(),F(),I(),su(),gu(F(),bE.optional()),L(bE)])),xE=gu(F(),gu(F(),bE.optional())),SE=z([F(),ju(Uint8Array),ju(ArrayBuffer),Ou(xm,{message:`Must be a Buffer`})]),CE=gu(F(),F()),wE=R({type:V(`text`),text:F(),providerOptions:xE.optional()}),TE=R({type:V(`image`),image:z([SE,ju(URL),CE]),mediaType:F().optional(),providerOptions:xE.optional()}),EE=pu(`type`,[R({type:V(`data`),data:SE}),R({type:V(`url`),url:ju(URL)}),R({type:V(`reference`),reference:CE}),R({type:V(`text`),text:F()})]),DE=pu(`type`,[R({type:V(`data`),data:SE}),R({type:V(`url`),url:ju(URL)})]),OE=R({type:V(`file`),data:z([EE,SE,ju(URL),CE]),filename:F().optional(),mediaType:F(),providerOptions:xE.optional()}),kE=R({type:V(`reasoning`),text:F(),providerOptions:xE.optional()}),AE=R({type:V(`custom`),kind:F().transform(e=>e),providerOptions:xE.optional()}),jE=R({type:V(`reasoning-file`),data:z([DE,SE,ju(URL)]),mediaType:F(),providerOptions:xE.optional()}),ME=R({type:V(`tool-call`),toolCallId:F(),toolName:F(),input:uu(),providerOptions:xE.optional(),providerExecuted:su().optional()}),NE=pu(`type`,[R({type:V(`text`),value:F(),providerOptions:xE.optional()}),R({type:V(`json`),value:bE,providerOptions:xE.optional()}),R({type:V(`execution-denied`),reason:F().optional(),providerOptions:xE.optional()}),R({type:V(`error-text`),value:F(),providerOptions:xE.optional()}),R({type:V(`error-json`),value:bE,providerOptions:xE.optional()}),R({type:V(`content`),value:L(z([R({type:V(`text`),text:F(),providerOptions:xE.optional()}),R({type:V(`file`),data:EE,mediaType:F(),filename:F().optional(),providerOptions:xE.optional()}),R({type:V(`file-data`),data:F(),mediaType:F(),filename:F().optional(),providerOptions:xE.optional()}),R({type:V(`file-url`),url:F(),mediaType:F().optional(),providerOptions:xE.optional()}),R({type:V(`file-id`),fileId:z([F(),gu(F(),F())]),providerOptions:xE.optional()}),R({type:V(`file-reference`),providerReference:gu(F(),F()),providerOptions:xE.optional()}),R({type:V(`image-data`),data:F(),mediaType:F(),providerOptions:xE.optional()}),R({type:V(`image-url`),url:F(),providerOptions:xE.optional()}),R({type:V(`image-file-id`),fileId:z([F(),gu(F(),F())]),providerOptions:xE.optional()}),R({type:V(`image-file-reference`),providerReference:gu(F(),F()),providerOptions:xE.optional()}),R({type:V(`custom`),providerOptions:xE.optional()})]))})]),PE=R({type:V(`tool-result`),toolCallId:F(),toolName:F(),output:NE,providerOptions:xE.optional()}),FE=R({type:V(`tool-approval-request`),approvalId:F(),toolCallId:F()}),IE=R({type:V(`tool-approval-response`),approvalId:F(),approved:su(),reason:F().optional()}),LE=R({role:V(`system`),content:F(),providerOptions:xE.optional()}),RE=R({role:V(`user`),content:z([F(),L(z([wE,TE,OE]))]),providerOptions:xE.optional()}),zE=R({role:V(`assistant`),content:z([F(),L(z([wE,AE,OE,kE,jE,ME,PE,FE]))]),providerOptions:xE.optional()}),BE=R({role:V(`tool`),content:L(z([PE,IE])),providerOptions:xE.optional()}),VE=z([LE,RE,zE,BE]),HE=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:n=2,abortSignal:r}={})=>Ug({maxRetries:e,initialDelayInMs:t,backoffFactor:n,abortSignal:r,shouldRetry:e=>e instanceof Error&&(ei.isInstance(e)&&e.isRetryable===!0||sS.isInstance(e)&&e.isRetryable===!0),getDelayInMs:({error:e,exponentialBackoffDelay:t})=>qw({error:e,exponentialBackoffDelay:t}),createRetryError:({message:e,reason:t,errors:n})=>new fE({message:e,reason:t,errors:n})}),UE={},xT(UE,{array:()=>KE,choice:()=>qE,json:()=>JE,object:()=>GE,text:()=>WE}),WE=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),GE=({schema:e,name:t,description:n})=>{let r=vh(e);return{name:`object`,responseFormat:Nh(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await Eh({text:e});if(!n.success)throw new HT({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 wh({value:n.value,schema:r});if(!i.success)throw new HT({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 Xw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},KE=({element:e,name:t,description:n})=>{let r=vh(e);return{name:`array`,responseFormat:Nh(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 Eh({text:e});if(!n.success)throw new HT({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 HT({message:`No object generated: response did not match schema.`,cause:new ca({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 wh({value:n,schema:r});if(!i.success)throw new HT({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 Xw(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 wh({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])}})}}},qE=({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 Eh({text:t});if(!r.success)throw new HT({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 HT({message:`No object generated: response did not match schema.`,cause:new ca({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 Xw(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(){}}),JE=({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 Eh({text:e});if(!n.success)throw new HT({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 Xw(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(){}}),YE=`ai:telemetry`,new TextEncoder,new TextEncoder,cg({prefix:`aitxt`,size:24}),cg({prefix:`call`,size:24}),TransformStream,gu(F(),bE.optional()),cg({prefix:`aitxt`,size:24}),cg({prefix:`call`,size:24}),cg({prefix:`aitxt`,size:24}),cg({prefix:`call`,size:24}),gu(F(),bE.optional()),gu(F(),F()),cg({prefix:`call`,size:24}),cg({prefix:`call`,size:24}),ZE={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 HT({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 ma({functionality:`element streams in no-schema mode`})}},QE=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 wh({value:t,schema:e})},createElementStream(){throw new ma({functionality:`element streams in object mode`})}}),$E=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(!Ur(t)||!Hr(t.elements))return{success:!1,error:new ca({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 wh({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(!Ur(t)||!Hr(t.elements))return{success:!1,error:new ca({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 wh({value:t,schema:e});if(!n.success)return n;r.push(n.value)}return{success:!0,value:r}},createElementStream(e){let t=0;return uT(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}`)}}})))}}),eD=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(!Ur(t)||typeof t.result!=`string`)return{success:!1,error:new ca({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 ca({value:t,cause:`value must be a string in the enum`})}},async validatePartialResult({value:t,textDelta:n}){if(!Ur(t)||typeof t.result!=`string`)return{success:!1,error:new ca({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 ca({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 ma({functionality:`element streams in enum mode`})}}),cg({prefix:`aiobj`,size:24}),tD=cg({prefix:`aiobj`,size:24}),nD=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:ee,now:C}){this._object=new qh,this._usage=new qh,this._providerMetadata=new qh,this._warnings=new qh,this._request=new qh,this._response=new qh,this._finishReason=new qh;let w=ww(e),{maxRetries:T,retry:E}=Jw({maxRetries:i,abortSignal:a}),D=zw(r),O=aT({telemetry:n}),te=this,ne=pT(),k=new TransformStream({transform(e,t){t.enqueue(e),e.type===`error`&&y({error:Vw(e.error)})}});this.baseStream=ne.stream.pipeThrough(k);let re=S();(async()=>{let e=await o.jsonSchema();await Kw({event:{callId:re,operationId:`ai.streamObject`,provider:w.provider,modelId:w.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:T,headers:t,providerOptions:m,output:o.type,schema:e,schemaName:f,schemaDescription:p},callbacks:[g,O.onStart]});let n=await Bw({instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d}),i={responseFormat:{type:`json`,schema:e,name:f,description:p},...zw(r),prompt:await jw({prompt:n,supportedUrls:await w.supportedUrls,download:x,provider:w.provider.split(`.`)[0]}),providerOptions:m,abortSignal:a,headers:t,includeRawChunks:!1};await Kw({event:{callId:re,stepNumber:0,provider:w.provider,modelId:w.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}}},k=C(),{stream:ie,response:ae,request:oe}=await E(()=>w.doStream(i));te._request.resolve(oe??{});let se,ce=Uw(),le,ue,de,fe,pe,me=``,he=``,ge={id:S(),timestamp:ee(),modelId:w.modelId},_e,ve,ye=!0,be=!0,xe=ie.pipeThrough(new TransformStream(y)).pipeThrough(new TransformStream({async transform(e,t){if(typeof e==`object`&&e.type===`stream-start`){se=e.warnings;return}if(ye&&=(pe=C()-k,!1),typeof e==`string`){me+=e,he+=e;let{value:n,state:r}=await Xw(me);if(n!==void 0&&!vT(_e,n)){let e=await o.validatePartialResult({value:n,textDelta:he,latestObject:ve,isFirstDelta:be,isFinalDelta:r===`successful-parse`});e.success&&!vT(ve,e.value.partial)&&(_e=n,ve=e.value.partial,t.enqueue({type:`object`,object:ve}),t.enqueue({type:`text-delta`,textDelta:e.value.textDelta}),he=``,be=!1)}return}switch(e.type){case`response-metadata`:ge={id:e.id??ge.id,timestamp:e.timestamp??ge.timestamp,modelId:e.modelId??ge.modelId};break;case`finish`:he!==``&&t.enqueue({type:`text-delta`,textDelta:he}),le=e.finishReason.unified,ce=Hw(e.usage),ue=e.providerMetadata,t.enqueue({...e,finishReason:e.finishReason.unified,usage:ce,response:ge}),hE({warnings:se??[],provider:w.provider,model:w.modelId}),te._usage.resolve(ce),te._providerMetadata.resolve(ue),te._warnings.resolve(se),te._response.resolve({...ge,headers:ae?.headers}),te._finishReason.resolve(le??`other`);try{de=await gT(me,o,h,{response:ge,usage:ce,finishReason:le}),te._object.resolve(de)}catch(e){fe=e,te._object.reject(e)}break;default:t.enqueue(e);break}},async flush(e){try{let e=ce??{promptTokens:NaN,completionTokens:NaN,totalTokens:NaN};await Kw({event:{callId:re,stepNumber:0,provider:w.provider,modelId:w.modelId,finishReason:le??`other`,usage:e,objectText:me,msToFirstChunk:pe,reasoning:void 0,warnings:se,request:oe??{},response:{...ge,headers:ae?.headers},providerMetadata:ue},callbacks:[v,O.onObjectStepEnd]}),await Kw({event:{callId:re,object:de,error:fe,reasoning:void 0,finishReason:le??`other`,usage:e,warnings:se,request:oe??{},response:{...ge,headers:ae?.headers},providerMetadata:ue},callbacks:[b,O.onEnd]})}catch(t){e.enqueue({type:`error`,error:t})}}}));ne.addStream(xe)})().catch(async e=>{await O.onError?.call(O,{callId:re,error:e}),ne.addStream(new ReadableStream({start(t){t.enqueue({type:`error`,error:e}),t.close()}}))}).finally(()=>{ne.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 uT(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 uT(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 uT(this.baseStream)}pipeTextStreamToResponse(e,t){lT({response:e,stream:this.textStream,...t})}toTextStreamResponse(e){return sT({stream:this.textStream,...e})}},rD=`AI_NoSuchProviderError`,`${rD}`,cg({prefix:`call`,size:24})})),aD=t((()=>{Dp(),Dp()})),oD,sD=t((()=>{aD(),oD=Tp({title:Sp().describe(`Concise, specific issue title. Imperative or descriptive, no trailing period.`),description:Sp().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:wp(Sp()).describe(`Ordered reproduction steps, each a single action.`),expected:Sp().describe(`Expected behavior, one or two sentences.`),actual:Sp().describe(`Actual (buggy) behavior, one or two sentences.`),impact:Sp().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:Sp().describe(`Markdown bullet list ("- …") of likely root-cause analysis based on the source context. Empty string when there is nothing substantive to say.`),suggestedNextSteps:Sp().describe(`Markdown bullet list of concrete, actionable fix suggestions the coding agent should consider first.`),priority:Cp().int().min(0).max(4).describe(`Linear priority: 0 none, 1 urgent, 2 high, 3 medium, 4 low.`),suggestedLabels:wp(Sp()).describe(`0-3 suggested label names, e.g. "Bug", "UI".`)})}));function cD(e){let t=[e.issueTemplate?.trim()||mD],n=(e.skillPaths??``).split(`
|
|
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
|
+
`)}`);let r=[];e.testUsername?.trim()&&r.push(`- Username / email: \`${e.testUsername.trim()}\``),e.testPassword?.trim()&&r.push(`- Password: \`${e.testPassword.trim()}\``),r.length&&t.push(`**Test account — log into the app with this while testing:**\n${r.join(`
|
|
86
|
+
`)}`);let i=[];return e.slackToken&&e.slackChannelId&&i.push(`- Slack: bot token \`${e.slackToken}\`, channel \`${e.slackChannelId}\`${e.slackChannelName?` (#${e.slackChannelName})`:``}. Use \`chat.postMessage\` for the message and \`files.uploadV2\` (or getUploadURLExternal + completeUploadExternal) to upload the demo video into the channel.`),e.telegramToken&&e.telegramChatId&&i.push(`- Telegram: bot token \`${e.telegramToken}\`, chat id \`${e.telegramChatId}\`. Use \`sendMessage\` and \`sendVideo\` (multipart upload of the demo file).`),i.length&&t.push(`**When the fix is complete and the PR is open, announce it yourself:**\n${i.join(`
|
|
87
|
+
`)}\n\nMessage format — keep it short: what was broken → what you changed (one-line fix summary) → links to the Linear issue, the PR, and your agent run → attach/upload the demo video → end with the CTA "👉 Review the PR". You may also use these tokens to send yourself intermediate test notifications while verifying the integration works.`),t.join(`
|
|
88
|
+
|
|
89
|
+
`)}function lD(e){let t=[];if(e.componentName&&t.push(`Component: <${e.componentName}>`),e.tagName&&t.push(`DOM element: <${e.tagName}>`),e.source?.filePath){let n=e.source.lineNumber==null?``:`:${e.source.lineNumber}`;t.push(`Source: ${e.source.filePath}${n}`)}return e.stackContext&&t.push(`Component stack:\n${e.stackContext}`),e.content&&t.push(`Element context:\n${e.content}`),t.push(`Page URL: ${e.pageUrl}`),t.join(`
|
|
90
|
+
`)}function uD(e){let t=[];t.push(`Reporter note:\n${e.note.trim()||`(none — infer from the element context)`}`);let n=e.grabbedList?.length?e.grabbedList:e.grabbed?[e.grabbed]:[];return n.slice(0,3).forEach((e,r)=>{t.push(`Captured element ${n.length>1?`${r+1}/${Math.min(n.length,3)} `:``}(via the Linear Grab picker):\n${lD(e)}`)}),e.teamName&&t.push(`Target team: ${e.teamName}`),e.template?.trim()&&t.push(`Standing agent instructions the team appends to every issue (context only — do NOT repeat them in your description, they are added automatically):\n${e.template.trim()}`),e.logs?.trim()&&t.push(`Recent dev server logs (tail — use for Analysis/Notes when relevant, do not paste wholesale):\n\`\`\`\n${e.logs.trim()}\n\`\`\``),t.push(`Draft the issue now.`),t.join(`
|
|
91
|
+
|
|
92
|
+
`)}function dD(e,t,n){let r=[`## UI element context (Linear Grab)`];if(e.componentName&&r.push(`Component: \`<${e.componentName}>\``),e.source?.filePath){let t=e.source.lineNumber==null?``:`:${e.source.lineNumber}`;r.push(`Source: \`${e.source.filePath}${t}\``)}e.tagName&&r.push(`DOM element: \`<${e.tagName}>\``),r.push(`Page: ${e.pageUrl}`),e.stackContext&&r.push(`\nComponent stack:\n\`\`\`\n${e.stackContext}\n\`\`\``);let i=(t.skillPaths??``).split(`
|
|
93
|
+
`).map(e=>e.trim()).filter(Boolean);return i.length&&r.push(`\nRead these project skills/memory files first and treat them as authoritative:\n${i.map(e=>`- \`${e}\``).join(`
|
|
94
|
+
`)}`),n?.trim()&&r.push(`\nTask:\n${n.trim()}`),r.join(`
|
|
95
|
+
`)}function fD(e){let t=[];e.description.trim()&&t.push(`### Summary\n${e.description.trim()}`);let n=e.reproSteps.map(e=>e.trim()).filter(Boolean);n.length&&t.push(`### Steps to Reproduce\n${n.map((e,t)=>`${t+1}. ${e}`).join(`
|
|
96
|
+
`)}`),e.expected.trim()&&t.push(`### Expected Behavior\n${e.expected.trim()}`),e.actual.trim()&&t.push(`### Actual Behavior\n${e.actual.trim()}`),e.impact?.trim()&&t.push(`### Impact\n${e.impact.trim()}`),e.analysisNotes?.trim()&&t.push(`### Analysis / Notes\n${e.analysisNotes.trim()}`),e.suggestedNextSteps?.trim()&&t.push(`### Suggested Next Steps\n${e.suggestedNextSteps.trim()}`);let r=(e.grabs??[]).filter(e=>e.source?.filePath||e.componentName);if(r.length){let e=r.map(e=>{let t=e.source?.filePath?`\`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:null;return`- ${[e.componentName?`\`<${e.componentName}>\``:null,t].filter(Boolean).join(` — `)}`}),n=r[0];n.stackContext&&e.push(`\n\`\`\`\n${n.stackContext}\n\`\`\``),e.push(`\nCaptured on ${n.pageUrl}`),t.push(`### Source${r.length>1?` (${r.length} elements)`:``}\n${e.join(`
|
|
97
|
+
`)}`)}e.agentInstructions?.trim()&&t.push(`### Agent instructions\n${e.agentInstructions.trim()}`);let i=[e.repo?.trim()?`[repo=${e.repo.trim()}]`:null,e.model?.trim()?`[model=${e.model.trim()}]`:null].filter(Boolean);return i.length&&t.push(i.join(` `)),t.join(`
|
|
98
|
+
|
|
99
|
+
`)}var pD,mD,hD=t((()=>{pD=`You are an expert engineer drafting a Linear issue for a development team.
|
|
100
|
+
You are given a rough note from the reporter and, when available, the exact React source
|
|
101
|
+
location of the UI element the issue is about (captured from a running dev build).
|
|
102
|
+
|
|
103
|
+
Write a crisp, actionable issue a coding agent can execute against with zero follow-up
|
|
104
|
+
questions. Be specific, never invent details you were not given, and keep the tone neutral
|
|
105
|
+
and technical. If the note implies a bug, structure it as a bug; if it implies a change or
|
|
106
|
+
feature, keep reproSteps minimal and focus the description on the desired change.
|
|
107
|
+
|
|
108
|
+
The issue renders in this exact section order — fill each field for its section:
|
|
109
|
+
Summary (description field) → Steps to Reproduce (reproSteps) → Expected Behavior
|
|
110
|
+
(expected) → Actual Behavior (actual) → Impact (impact) → Analysis / Notes
|
|
111
|
+
(analysisNotes, markdown bullets grounded in the provided source context) →
|
|
112
|
+
Suggested Next Steps (suggestedNextSteps, markdown bullets with concrete fixes).
|
|
113
|
+
The Summary is a short plain-prose paragraph — no headings inside it, no repetition
|
|
114
|
+
of the other sections.`,mD="- 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."})),gD=r({describeAiError:()=>yD,executeDraft:()=>_D});async function _D(e,t,n){let r=await Ax(e.tier);try{return await vD(r,e,t,n,!1)}catch(i){if(n.aborted)throw i;let a=await jx(r.provider,e.tier);if(!a)throw Error(yD(i));try{return await vD(a,e,t,n,!0)}catch(e){throw Error(yD(e))}}}async function vD(e,t,n,r,i){let a=yT({model:e.model,schema:oD,system:pD,prompt:uD(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 yD(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 bD=t((()=>{iD(),sD(),hD(),Px()}));Cr(),Px();function xD(e,t){return Sr?SD(e,t):CD(e,t)}function SD(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 CD(e,t){let n=new AbortController;return(async()=>{let{executeDraft:r}=await Promise.resolve().then(()=>(bD(),gD));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 Nx?`no-provider`:`unknown`)}})(),()=>n.abort()}var wD=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:()=>ue,nearestColor:()=>O,nearestColorIndex:()=>E,nearestColorIndexWithDistance:()=>D,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>w});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,ee=x+2,C=0,w=n[0],T=0;for(let e=f;e<65536;e*=2)++T;T=8-T,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)+w,a=t<<T^w;if(u[a]===r){w=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){w=d[a];break next_block}D(w),w=t,ee<1<<i?(d[a]=ee++,u[a]=r):(u.fill(-1),ee=x+2,v=!0,D(x))}return D(w),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[C++]=m&255,C>=254&&(c.writeByte(C),c.writeBytesView(l,0,C),C=0),m>>=8,h-=8;if((ee>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[C++]=m&255,C>=254&&(c.writeByte(C),c.writeBytesView(l,0,C),C=0),m>>=8,h-=8;C>0&&(c.writeByte(C),c.writeBytesView(l,0,C),C=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 ee,C,w;for(x=0;x<b;++x){m(d,x,!1);var T=d[x].err;for(C=++y[0];C>1&&(w=C>>1,!(d[ee=y[w]].err<=T));C=w)y[C]=ee;y[C]=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 T=d[O].err;for(C=1;(w=C+C)<=y[0]&&(w<y[0]&&d[y[w]].err>d[y[w+1]].err&&w++,!(T<=d[ee=y[w]].err));C=w)y[C]=ee;y[C]=O}var te=d[D.nn],ne=D.cnt,k=te.cnt,S=1/(ne+k);u&&(D.ac=S*(ne*D.ac+k*te.ac)),D.rc=S*(ne*D.rc+k*te.rc),D.gc=S*(ne*D.gc+k*te.gc),D.bc=S*(ne*D.bc+k*te.bc),D.cnt+=te.cnt,D.mtm=++x,d[te.bk].fw=te.fw,d[te.fw].bk=te.bk,te.mtm=_}let re=[];var ie=0;for(x=0;;++ie){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(re,c)||re.push(c),(x=d[x].fw)==0)break}return re}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]=ee(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]=C(l,c,a,t)}}return o}function ee(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=T(l-r);if(u>o)continue;let d=c[0];if(u+=T(d-e),u>o)continue;let f=c[1];if(u+=T(f-t),u>o)continue;let p=c[2];u+=T(p-n),!(u>o)&&(o=u,a=s)}return a}function C(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=T(c-e);if(l>a)continue;let u=s[1];if(l+=T(u-t),l>a)continue;let d=s[2];l+=T(d-n),!(l>a)&&(a=l,i=o)}return i}function w(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 T(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`);k(a,t,n,m,g),ie(a,m),h>=0&&re(a,h)}let y=Math.round(p/10);ne(a,_,y,o,f);let b=!!m&&!v;ae(a,t,n,b?m:null),b&&ie(a,m),oe(a,e,t,n,g,s,c,l)}};function d(){ce(a,`GIF89a`)}}function ne(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),se(e,n),e.writeByte(i||0),e.writeByte(0)}function k(e,t,n,r,i=8){let a=le(r.length)-1,o=i-1<<4|128|a;se(e,t),se(e,n),e.writeBytes([o,0,0])}function re(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),ce(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),se(e,t),e.writeByte(0)}function ie(e,t){let n=1<<le(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 ae(e,t,n,r){if(e.writeByte(44),se(e,0),se(e,0),se(e,t),se(e,n),r){let t=le(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function oe(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function se(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function ce(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function le(e){return Math.max(Math.ceil(Math.log2(e)),1)}var ue=te}))(),TD="(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)})}})();",ED=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,TD],{type:`text/javascript;charset=utf-8`});function DD(e){let t;try{if(t=ED&&(self.URL||self.webkitURL).createObjectURL(ED),!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(TD),{name:e?.name})}}var OD,kD=1,AD=new Map;function jD(){if(OD!==void 0)return OD;try{OD=new DD,OD.onmessage=e=>{let t=e.data?.id;if(t==null)return;let n=AD.get(t);n&&(AD.delete(t),e.data.type===`error`?n.reject(Error(e.data.message??`Worker error`)):n.resolve(e.data))},OD.onerror=()=>{for(let e of AD.values())e.reject(Error(`Image worker crashed`));AD.clear()}}catch{OD=null}return OD}function MD(e,t=[]){let n=jD();if(!n)return Promise.reject(Error(`Image worker unavailable`));let r=kD++;return new Promise((i,a)=>{AD.set(r,{resolve:i,reject:a}),n.postMessage({...e,id:r},t)})}function ND(e,t=[]){let n=jD();return n?(n.postMessage(e,t),!0):!1}var PD=6,FD=Math.round(1e3/PD),ID=3e4,LD=640,RD={phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0},zD=new Set;function BD(e){RD={...RD,...e};for(let e of zD)e(RD)}function VD(){return RD}function HD(e){return zD.add(e),()=>zD.delete(e)}var UD=null,WD=null,GD=null,KD=null,qD=null,JD=null,YD=!1,XD=0,ZD=!0;async function QD(){if(RD.phase===`recording`||RD.phase===`processing`)return;eO();try{UD=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:PD},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`,surfaceSwitching:`exclude`,monitorTypeSurfaces:`exclude`,systemAudio:`exclude`})}catch{BD({phase:`error`,error:`Screen capture was denied or cancelled.`});return}let e=UD.getVideoTracks()[0];if(!e){BD({phase:`error`,error:`No video track available.`}),rO();return}e.addEventListener(`ended`,()=>void $D()),WD=document.createElement(`video`),WD.muted=!0,WD.playsInline=!0,WD.srcObject=UD,await WD.play().catch(()=>{});let t=Date.now()+3e3;for(;!WD.videoWidth&&Date.now()<t;)await new Promise(e=>setTimeout(e,50));if(!WD.videoWidth){BD({phase:`error`,error:`Could not read the capture stream.`}),rO();return}let n=Math.min(1,LD/WD.videoWidth),r=Math.round(WD.videoWidth*n),i=Math.round(WD.videoHeight*n);if(GD=document.createElement(`canvas`),GD.width=r,GD.height=i,KD=GD.getContext(`2d`,{willReadFrequently:!0}),!KD){BD({phase:`error`,error:`Canvas is unavailable.`}),rO();return}YD=await MD({type:`gif-init`}).then(()=>!0,()=>!1),JD=YD?null:(0,wD.GIFEncoder)(),XD=0,ZD=!0,BD({phase:`recording`,startedAt:Date.now(),error:null,result:null}),qD=setInterval(()=>{if(!KD||!WD||!GD)return;let e=RD.startedAt??Date.now();if(Date.now()-e>=ID){$D();return}try{KD.drawImage(WD,0,0,GD.width,GD.height);let{data:e}=KD.getImageData(0,0,GD.width,GD.height);if(YD)ND({type:`gif-frame`,buffer:e.buffer,width:GD.width,height:GD.height,delay:FD},[e.buffer]);else if(JD){let t=(0,wD.quantize)(e,256,{format:`rgb565`}),n=(0,wD.applyPalette)(e,t,`rgb565`);JD.writeFrame(n,GD.width,GD.height,{palette:t,delay:FD,first:ZD,repeat:0}),ZD=!1}XD++}catch{}},FD)}async function $D(){if(RD.phase!==`recording`)return;let e=RD.startedAt??Date.now();BD({phase:`processing`}),qD&&=(clearInterval(qD),null);let t=GD?.width??0,n=GD?.height??0,r=XD,i=JD,a=YD;if(JD=null,YD=!1,rO(),!i&&!a||r===0){BD({phase:`error`,error:`Nothing was captured.`});return}try{let o;if(a){let e=await MD({type:`gif-finish`});o=new Uint8Array(e.buffer)}else i.finish(),o=i.bytes();let s=new Blob([o.buffer],{type:`image/gif`});BD({phase:`ready`,result:{blob:s,url:URL.createObjectURL(s),width:t,height:n,frameCount:r,durationMs:Date.now()-e}})}catch(e){BD({phase:`error`,error:e instanceof Error?e.message:`GIF encoding failed.`})}}function eO(){RD.result?.url&&URL.revokeObjectURL(RD.result.url),rO(),qD&&=(clearInterval(qD),null),YD&&ND({type:`gif-abort`}),YD=!1,JD=null,XD=0,BD({phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0})}function tO(e){BD({attachOnCreate:e})}function nO(e){RD.result&&BD({result:{...RD.result,assetUrl:e}})}function rO(){UD?.getTracks().forEach(e=>e.stop()),UD=null,WD&&=(WD.srcObject=null,null),GD=null,KD=null}zr();var iO=`https://api.linear.app/graphql`,aO=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`LinearError`}},oO=class extends aO{constructor(){super(`Not connected to Linear. Add an API key or connect OAuth in Settings.`),this.name=`LinearNotConnectedError`}};async function sO(e,t){let{linearApiKey:n,linearAccessToken:r}=await Er(),i=r?`Bearer ${r}`:n;if(!i)throw new oO;let a=await fetch(iO,{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 aO(o?.errors?.[0]?.message??`Linear request failed (${a.status})`,a.status);if(o?.errors?.length)throw new aO(o.errors[0].message);if(!o?.data)throw new aO(`Empty response from Linear`);return o.data}async function cO(){return(await sO(`query { viewer { id name email } }`)).viewer}async function lO(){return(await sO(`query { teams(first: 50) { nodes { id key name } } }`)).teams.nodes}async function uO(){return(await sO(`query {
|
|
115
|
+
users(filter: { app: { eq: true } }) {
|
|
116
|
+
nodes { id name displayName url active }
|
|
117
|
+
}
|
|
118
|
+
}`)).users.nodes.filter(e=>e.active!==!1)}async function dO(){return(await sO(`query {
|
|
119
|
+
issues(
|
|
120
|
+
first: 50
|
|
121
|
+
orderBy: updatedAt
|
|
122
|
+
filter: { creator: { isMe: { eq: true } } }
|
|
123
|
+
) {
|
|
124
|
+
nodes {
|
|
125
|
+
id identifier title url updatedAt priority
|
|
126
|
+
state { name color type }
|
|
127
|
+
delegate { id name displayName }
|
|
128
|
+
assignee { displayName }
|
|
129
|
+
attachments(first: 10) { nodes { id title url sourceType } }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}`)).issues.nodes.map(e=>({...e,attachments:e.attachments.nodes}))}async function fO(e){let{comments:t,attachments:n,...r}=(await sO(`query($id: String!) {
|
|
133
|
+
issue(id: $id) {
|
|
134
|
+
id identifier title url updatedAt priority description branchName
|
|
135
|
+
state { name color type }
|
|
136
|
+
delegate { id name displayName }
|
|
137
|
+
assignee { displayName }
|
|
138
|
+
comments(first: 50) {
|
|
139
|
+
nodes { id body createdAt parent { id } user { id name displayName app } }
|
|
140
|
+
}
|
|
141
|
+
attachments(first: 20) {
|
|
142
|
+
nodes { id title url sourceType }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}`,{id:e})).issue;return{...r,comments:t.nodes,attachments:n.nodes}}async function pO(e){try{return(await sO(`query($id: String!) {
|
|
146
|
+
issue(id: $id) {
|
|
147
|
+
agentSessions(first: 10) {
|
|
148
|
+
nodes {
|
|
149
|
+
id status summary updatedAt
|
|
150
|
+
appUser { displayName }
|
|
151
|
+
activities(first: 50) { nodes { id createdAt content } }
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}`,{id:e})).issue.agentSessions.nodes.map(e=>({...e,activities:e.activities.nodes}))}catch{return[]}}async function mO(e){let t=await sO(`mutation($input: IssueCreateInput!) {
|
|
156
|
+
issueCreate(input: $input) {
|
|
157
|
+
success
|
|
158
|
+
issue { id identifier url }
|
|
159
|
+
}
|
|
160
|
+
}`,{input:e});if(!t.issueCreate.success||!t.issueCreate.issue)throw Error(`Linear rejected the issue create`);return t.issueCreate.issue}async function hO(e,t,n){if(!(await sO(`mutation($input: CommentCreateInput!) {
|
|
161
|
+
commentCreate(input: $input) { success }
|
|
162
|
+
}`,{input:{issueId:e,body:t,...n?{parentId:n}:{}}})).commentCreate.success)throw Error(`Linear rejected the comment`)}async function gO(e,t,n){let r=`@${n.displayName||n.name||`Cursor`}`;await hO(e,`${n.url?`[${r}](${n.url})`:r} ${t}`)}function _O(e){let t=e.filter(e=>!e.parent),n=new Set;for(let t of e)t.user?.app&&n.add(t.parent?.id??t.id);return t.filter(e=>n.has(e.id)).sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}zr();async function vO(e,t){let n=await sO(`mutation($contentType: String!, $filename: String!, $size: Int!) {
|
|
163
|
+
fileUpload(contentType: $contentType, filename: $filename, size: $size) {
|
|
164
|
+
success
|
|
165
|
+
uploadFile { uploadUrl assetUrl headers { key value } }
|
|
166
|
+
}
|
|
167
|
+
}`,{contentType:e.type,filename:t,size:e.size}),r=n.fileUpload.uploadFile;if(!n.fileUpload.success||!r)throw Error(`Linear did not provide an upload URL.`);let{linearApiKey:i,linearAccessToken:a}=await Er(),o=a?`Bearer ${a}`:i??``,s=Object.fromEntries((r.headers??[]).map(e=>[e.key,e.value])),c=[{"Content-Type":e.type,...s,...o?{Authorization:o}:{}},{"Content-Type":e.type,...s},{"Content-Type":e.type}],l=null;for(let t of c)try{let n=await fetch(r.uploadUrl,{method:`PUT`,mode:`cors`,headers:t,body:e});if(n.ok)return r.assetUrl;l=Error(`Upload rejected (${n.status}).`)}catch(e){l=e}try{let{bridgeUrl:t}=await Er(),n=(t?.trim()||`http://localhost:4577`).replace(/\/$/,``);if((await fetch(`${n}/put`,{method:`POST`,headers:{"Content-Type":e.type,"x-upload-url":r.uploadUrl,"x-upload-headers":JSON.stringify({...s,...o?{Authorization:o}:{}})},body:e})).ok)return r.assetUrl}catch{}throw Error(`Upload to Linear storage failed${l instanceof Error?` — ${l.message}`:``}. Run \`npx linear-grab-bridge\` in the repo (uploads relay through it), set the GitHub fallback in Settings, or use "Copy GIF" + paste.`)}zr();async function yO(e,t){try{return await vO(e,t)}catch(n){let r=await Er();if(r.githubToken&&r.githubAssetsRepo)return bO(e,t,r.githubToken,r.githubAssetsRepo);throw n instanceof Error?Error(`${n.message} Tip: configure the GitHub assets fallback in Settings for automatic uploads in this browser.`):n}}async function bO(e,t,n,r){let i=`linear-grab/${Date.now()}-${t.replace(/[^\w.-]/g,`_`)}`,a=await fetch(`https://api.github.com/repos/${r}/contents/${i}`,{method:`PUT`,headers:{Authorization:`Bearer ${n}`,Accept:`application/vnd.github+json`,"Content-Type":`application/json`},body:JSON.stringify({message:`chore(linear-grab): asset ${t}`,content:await xO(e)})}),o=await a.json().catch(()=>null);if(!a.ok||!o?.content?.download_url)throw Error(`GitHub asset upload failed — ${o?.message??`HTTP ${a.status}`}`);return o.content.download_url}function xO(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result.split(`,`)[1]??``),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}zr();async function SO(){return((await Er()).bridgeUrl?.trim()||`http://localhost:4577`).replace(/\/$/,``)}async function CO(e,t){let n=await SO(),r=await fetch(`${n}${e}`,{...t,headers:{"Content-Type":`application/json`,...t?.headers??{}}});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(e?.error??`Bridge request failed (${r.status})`)}return await r.json()}function wO(){return CO(`/health`)}async function TO(){return(await CO(`/tasks`)).tasks}function EO(e){return CO(`/tasks/${e}`)}function DO(e,t){return CO(`/tasks`,{method:`POST`,body:JSON.stringify({title:e,prompt:t})})}function OO(e){return CO(`/tasks/${e}/stop`,{method:`POST`}).then(()=>void 0)}function kO(e,t){return[`🛠️ ${(e=>t===`slack`?`*${e}*`:e)(`${e.identifier} — ${e.title}`)}`,e.summary?.trim()?e.summary.trim().slice(0,300):null,e.impact?.trim()?`Impact: ${e.impact.trim().slice(0,200)}`:null,e.executor===`cursor`?`🤖 Delegated to the Cursor cloud agent — PR with demo video incoming.`:e.executor===`local`?`💻 Delegated to local Claude Code.`:null,e.repo?`Repo: ${e.repo}`:null,e.demoUrl?`Demo: ${e.demoUrl}`:null,`👉 Follow & review: ${e.url}`].filter(Boolean).join(`
|
|
168
|
+
`)}async function AO(e,t){let n=await(await fetch(`https://slack.com/api/chat.postMessage`,{method:`POST`,body:new URLSearchParams({token:e.slackToken,channel:e.slackChannelId,text:kO(t,`slack`),unfurl_links:`false`})})).json();if(!n.ok)throw Error(n.error??`slack error`)}async function jO(e,t){let n=`https://api.telegram.org/bot${e.telegramToken}`,r=kO(t,`telegram`),i=t.demoUrl&&/raw\.githubusercontent\.com|\.gif($|\?)/i.test(t.demoUrl),a=await(await fetch(`${n}/${i?`sendAnimation`:`sendMessage`}`,{method:`POST`,body:new URLSearchParams(i?{chat_id:e.telegramChatId,animation:t.demoUrl,caption:r.slice(0,1e3)}:{chat_id:e.telegramChatId,text:r})})).json();if(!a.ok)throw Error(a.description??`telegram error`)}async function MO(e,t){if(e.notifyOnCreate===!1)return[];let n=[];if(e.slackToken&&e.slackChannelId)try{await AO(e,t)}catch{n.push(`Slack`)}if(e.telegramToken&&e.telegramChatId)try{await jO(e,t)}catch{n.push(`Telegram`)}return n}async function NO(e){let t=await(await fetch(`https://slack.com/api/conversations.list`,{method:`POST`,body:new URLSearchParams({token:e,types:`public_channel,private_channel`,exclude_archived:`true`,limit:`200`})})).json();if(!t.ok)throw Error(t.error??`slack error`);return(t.channels??[]).map(e=>({id:e.id,name:e.name}))}var PO=12e3,FO=4e3;async function IO(e){let t=e.logUrl?.trim();if(!t)return null;let n=Math.min(500,Math.max(10,e.logLines??100)),r=new AbortController,i=setTimeout(()=>r.abort(),FO);try{let e=await fetch(t,{cache:`no-store`,signal:r.signal});if(!e.ok)throw Error(`Log fetch failed (${e.status})`);let i=(await e.text()).split(`
|
|
169
|
+
`).slice(-n).join(`
|
|
170
|
+
`).trim();return i.length>PO&&(i=`…\n${i.slice(i.length-PO)}`),i||null}finally{clearTimeout(i)}}function LO(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 RO=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function zO(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}var BO=null;function VO(e={}){return BO||(e.includeStyleProperties?(BO=e.includeStyleProperties,BO):(BO=zO(window.getComputedStyle(document.documentElement)),BO))}function HO(e,t){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace(`px`,``)):0}function UO(e){let t=HO(e,`border-left-width`),n=HO(e,`border-right-width`);return e.clientWidth+t+n}function WO(e){let t=HO(e,`border-top-width`),n=HO(e,`border-bottom-width`);return e.clientHeight+t+n}function GO(e,t={}){return{width:t.width||UO(e),height:t.height||WO(e)}}function KO(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var qO=16384;function JO(e){(e.width>qO||e.height>qO)&&(e.width>qO&&e.height>qO?e.width>e.height?(e.height*=qO/e.width,e.width=qO):(e.width*=qO/e.height,e.height=qO):e.width>qO?(e.height*=qO/e.width,e.width=qO):(e.width*=qO/e.height,e.height=qO))}function YO(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 XO(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function ZO(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),XO(i)}var QO=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||QO(n,t)};function $O(e){let t=e.getPropertyValue(`content`);return`${e.cssText} content: '${t.replace(/'|"/g,``)}';`}function ek(e,t){return VO(t).map(t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?` !important`:``};`).join(` `)}function tk(e,t,n,r){let i=`.${e}:${t}`,a=n.cssText?$O(n):ek(n,r);return document.createTextNode(`${i}{${a}}`)}function nk(e,t,n,r){let i=window.getComputedStyle(e,n),a=i.getPropertyValue(`content`);if(a===``||a===`none`)return;let o=RO();try{t.className=`${t.className} ${o}`}catch{return}let s=document.createElement(`style`);s.appendChild(tk(o,n,i,r)),t.appendChild(s)}function rk(e,t,n){nk(e,t,`:before`,n),nk(e,t,`:after`,n)}var ik=`application/font-woff`,ak=`image/jpeg`,ok={woff:ik,woff2:ik,ttf:`application/font-truetype`,eot:`application/vnd.ms-fontobject`,png:`image/png`,jpg:ak,jpeg:ak,gif:`image/gif`,tiff:`image/tiff`,svg:`image/svg+xml`,webp:`image/webp`};function sk(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:``}function ck(e){return ok[sk(e).toLowerCase()]||``}function lk(e){return e.split(/,/)[1]}function uk(e){return e.search(/^(data:)/)!==-1}function dk(e,t){return`data:${t};base64,${e}`}async function fk(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 pk={};function mk(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 hk(e,t,n){let r=mk(e,t,n.includeQueryParams);if(pk[r]!=null)return pk[r];n.cacheBust&&(e+=(/\?/.test(e)?`&`:`?`)+new Date().getTime());let i;try{i=dk(await fk(e,n.fetchRequestInit,({res:e,result:n})=>(t||=e.headers.get(`Content-Type`)||``,lk(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 pk[r]=i,i}async function gk(e){let t=e.toDataURL();return t===`data:,`?e.cloneNode(!1):YO(t)}async function _k(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),YO(t.toDataURL())}let n=e.poster;return YO(await hk(n,ck(n),t))}async function vk(e,t){try{if(e?.contentDocument?.body)return await Ok(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function yk(e,t){return QO(e,HTMLCanvasElement)?gk(e):QO(e,HTMLVideoElement)?_k(e,t):QO(e,HTMLIFrameElement)?vk(e,t):e.cloneNode(xk(e))}var bk=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SLOT`,xk=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SVG`;async function Sk(e,t,n){if(xk(t))return t;let r=[];return r=bk(e)&&e.assignedNodes?zO(e.assignedNodes()):QO(e,HTMLIFrameElement)&&e.contentDocument?.body?zO(e.contentDocument.body.childNodes):zO((e.shadowRoot??e).childNodes),r.length===0||QO(e,HTMLVideoElement)||await r.reduce((e,r)=>e.then(()=>Ok(r,n)).then(e=>{e&&t.appendChild(e)}),Promise.resolve()),t}function Ck(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):VO(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`),QO(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 wk(e,t){QO(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),QO(e,HTMLInputElement)&&t.setAttribute(`value`,e.value)}function Tk(e,t){if(QO(e,HTMLSelectElement)){let n=t,r=Array.from(n.children).find(t=>e.value===t.getAttribute(`value`));r&&r.setAttribute(`selected`,``)}}function Ek(e,t,n){return QO(t,Element)&&(Ck(e,t,n),rk(e,t,n),wk(e,t),Tk(e,t)),t}async function Dk(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 Ok(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 Ok(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(e=>yk(e,t)).then(n=>Sk(e,n,t)).then(n=>Ek(e,n,t)).then(e=>Dk(e,t))}var kk=/url\((['"]?)([^'"]+?)\1\)/g,Ak=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,jk=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Mk(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}function Nk(e){let t=[];return e.replace(kk,(e,n,r)=>(t.push(r),e)),t.filter(e=>!uk(e))}async function Pk(e,t,n,r,i){try{let a=n?LO(t,n):t,o=ck(t),s;return s=i?dk(await i(a),o):await hk(a,o,r),e.replace(Mk(t),`$1${s}$3`)}catch{}return e}function Fk(e,{preferredFontFormat:t}){return t?e.replace(jk,e=>{for(;;){let[n,,r]=Ak.exec(e)||[];if(!r)return``;if(r===t)return`src: ${n};`}}):e}function Ik(e){return e.search(kk)!==-1}async function Lk(e,t,n){if(!Ik(e))return e;let r=Fk(e,n);return Nk(r).reduce((e,r)=>e.then(e=>Pk(e,r,t,n)),Promise.resolve(r))}async function Rk(e,t,n){let r=t.style?.getPropertyValue(e);if(r){let i=await Lk(r,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function zk(e,t){await Rk(`background`,e,t)||await Rk(`background-image`,e,t),await Rk(`mask`,e,t)||await Rk(`-webkit-mask`,e,t)||await Rk(`mask-image`,e,t)||await Rk(`-webkit-mask-image`,e,t)}async function Bk(e,t){let n=QO(e,HTMLImageElement);if(!(n&&!uk(e.src))&&!(QO(e,SVGImageElement)&&!uk(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,i=await hk(r,ck(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 Vk(e,t){let n=zO(e.childNodes).map(e=>Hk(e,t));await Promise.all(n).then(()=>e)}async function Hk(e,t){QO(e,Element)&&(await zk(e,t),await Bk(e,t),await Vk(e,t))}function Uk(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 Wk={};async function Gk(e){let t=Wk[e];return t??(t={url:e,cssText:await(await fetch(e)).text()},Wk[e]=t,t)}async function Kk(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),fk(a,t.fetchRequestInit,({result:e})=>(n=n.replace(i,`url(${e})`),[i,e]))});return Promise.all(i).then(()=>n)}function qk(e){if(e==null)return[];let t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,``),r=RegExp(`((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})`,`gi`);for(;;){let e=r.exec(n);if(e===null)break;t.push(e[0])}n=n.replace(r,``);let i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a=RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=i.exec(n);if(e===null){if(e=a.exec(n),e===null)break;i.lastIndex=a.lastIndex}else a.lastIndex=i.lastIndex;t.push(e[0])}return t}async function Jk(e,t){let n=[],r=[];return e.forEach(n=>{if(`cssRules`in n)try{zO(n.cssRules||[]).forEach((e,i)=>{if(e.type===CSSRule.IMPORT_RULE){let a=i+1,o=e.href,s=Gk(o).then(e=>Kk(e,t)).then(e=>qk(e).forEach(e=>{try{n.insertRule(e,e.startsWith(`@import`)?a+=1:n.cssRules.length)}catch(t){console.error(`Error inserting rule from remote css`,{rule:e,error:t})}})).catch(e=>{console.error(`Error loading remote css`,e.toString())});r.push(s)}})}catch(i){let a=e.find(e=>e.href==null)||document.styleSheets[0];n.href!=null&&r.push(Gk(n.href).then(e=>Kk(e,t)).then(e=>qk(e).forEach(e=>{a.insertRule(e,a.cssRules.length)})).catch(e=>{console.error(`Error loading remote stylesheet`,e)})),console.error(`Error inlining remote css file`,i)}}),Promise.all(r).then(()=>(e.forEach(e=>{if(`cssRules`in e)try{zO(e.cssRules||[]).forEach(e=>{n.push(e)})}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}}),n))}function Yk(e){return e.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Ik(e.style.getPropertyValue(`src`)))}async function Xk(e,t){if(e.ownerDocument==null)throw Error(`Provided element is not within a Document`);return Yk(await Jk(zO(e.ownerDocument.styleSheets),t))}function Zk(e){return e.trim().replace(/["']/g,``)}function Qk(e){let t=new Set;function n(e){(e.style.fontFamily||getComputedStyle(e).fontFamily).split(`,`).forEach(e=>{t.add(Zk(e))}),Array.from(e.children).forEach(e=>{e instanceof HTMLElement&&n(e)})}return n(e),t}async function $k(e,t){let n=await Xk(e,t),r=Qk(e);return(await Promise.all(n.filter(e=>r.has(Zk(e.style.fontFamily))).map(e=>{let n=e.parentStyleSheet?e.parentStyleSheet.href:null;return Lk(e.cssText,n,t)}))).join(`
|
|
171
|
+
`)}async function eA(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await $k(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 tA(e,t={}){let{width:n,height:r}=GO(e,t),i=await Ok(e,t,!0);return await eA(i,t),await Hk(i,t),Uk(i,t),await ZO(i,n,r)}async function nA(e,t={}){let{width:n,height:r}=GO(e,t),i=await YO(await tA(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||KO(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||JO(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 rA(e,t={}){return $k(e,t)}var iA=6,aA=class{last=performance.now();async tick(){performance.now()-this.last<=iA||(await new Promise(e=>{`requestIdleCallback`in window?requestIdleCallback(()=>e(),{timeout:100}):setTimeout(e,0)}),this.last=performance.now())}},oA=null,sA=new Map;function cA(e){let t=sA.get(e);if(t)return t;if(!oA){let e=document.createElement(`iframe`);if(e.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden`,document.body.appendChild(e),oA=e.contentDocument,!oA)return{}}let n=oA.createElement(e);oA.body.appendChild(n);let r=oA.defaultView.getComputedStyle(n),i={};for(let e=0;e<r.length;e++){let t=r[e];i[t]=r.getPropertyValue(t)}return n.remove(),sA.set(e,i),i}function lA(){try{for(let e of[`div`,`span`,`p`,`a`,`button`,`img`,`ul`,`li`,`svg`])cA(e)}catch{}}function uA(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 dA(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 fA(e,t){if(uA(e))return null;if(e instanceof SVGSVGElement)return e.cloneNode(!0);let n=e.cloneNode(!1),r=getComputedStyle(e),i=cA(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&&dA(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 fA(r,t);e&&n.appendChild(e)}return n}async function pA(e,t){let n=e.getBoundingClientRect(),r=Math.max(1,Math.ceil(n.width)),i=Math.max(1,Math.ceil(n.height)),a=await fA(e,new aA);if(!a)throw Error(`Capture root was filtered`);a.style.margin=`0`;let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${i}"><style>${t}</style><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(a)}</div></foreignObject></svg>`,s=new Image;s.decoding=`async`,s.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(o)}`,await s.decode();let c=Math.min(window.devicePixelRatio||1,1.5),l=document.createElement(`canvas`);l.width=Math.round(r*c),l.height=Math.round(i*c);let u=l.getContext(`2d`);if(!u)throw Error(`Canvas 2d unavailable`);return u.drawImage(s,0,0,l.width,l.height),l}var mA=null;function hA(e){return mA??=rA(e).catch(()=>``),mA}function gA(){`requestIdleCallback`in window?requestIdleCallback(()=>{lA(),hA(document.body)},{timeout:3e3}):setTimeout(()=>{lA(),hA(document.body)},1500)}var _A=4e3,vA=1e3;async function yA(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=xA(e),n=t.querySelectorAll(`*`).length;n>_A&&(t=e);let r;try{r=await pA(t,await hA(t))}catch{t!==e&&n>vA&&(t=e),r=await nA(t,{pixelRatio:Math.min(window.devicePixelRatio||1,1.5),fontEmbedCSS:await hA(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&&SA(r,t,e),await bA(r)}catch{return null}}async function bA(e){try{if(typeof createImageBitmap==`function`&&typeof OffscreenCanvas<`u`){let t=await createImageBitmap(e);return(await MD({type:`encode-png`,bitmap:t},[t])).dataUrl}}catch{}return CA(e)}function xA(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 SA(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 CA(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[TA,EA]=w(null),[DA,OA]=w(null);function kA(e,t){EA(e),OA(t??null)}function AA(){EA(null),OA(null)}var jA=M(`<span class="absolute inset-0 grid place-items-center">`),MA=M(`<button><span>`),NA=M(`<span aria-hidden class="border-text-dim inline-block size-3.5 animate-spin rounded-full border-[1.5px] border-t-transparent">`),PA=M(`<input>`),FA=M(`<textarea>`),IA=M(`<select>`),LA=M(`<span class="text-text-faint text-[10.5px] leading-snug">`),RA=M(`<label class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">`),zA=M(`<section class="flex flex-col gap-2.5"><h2 class="text-text-dim text-[11px] font-semibold tracking-wide uppercase">`),BA=M(`<span>`),VA=M(`<span aria-hidden class="inline-block size-2 shrink-0 rounded-full">`),HA=M(`<div class="flex flex-col items-center gap-1.5 px-4 py-10 text-center"><p class="text-text-dim text-[12px] font-medium"></p><div class="text-text-faint text-[11.5px] leading-relaxed">`),UA=M(`<p class="bg-danger-soft text-danger rounded-md px-2.5 py-1.5 text-[11.5px] leading-snug break-words">`),WA={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 GA(e){let[t,n]=Ue(e,[`variant`,`loading`,`children`,`class`,`disabled`]);return(()=>{var e=MA(),r=e.firstChild;return ht(e,He(n,{get disabled(){return t.disabled||t.loading},get class(){return`relative inline-flex h-7 cursor-pointer items-center justify-center gap-1.5 rounded-md border px-3 text-[12px] font-medium transition-colors disabled:cursor-not-allowed ${WA[t.variant??`ghost`]} ${t.class??``}`}}),!1,!0),N(r,()=>t.children),N(e,A(j,{get when(){return t.loading},get children(){var e=jA();return N(e,A(KA,{})),e}}),null),E(()=>ut(r,`inline-flex items-center gap-1.5 ${t.loading?`invisible`:``}`)),e})()}function KA(){return NA()}function qA(e){let[t,n]=Ue(e,[`class`]);return(()=>{var e=PA();return ht(e,He(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint h-7 w-full rounded-md border px-2 text-[12px] outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function JA(e){let[t,n]=Ue(e,[`class`]);return(()=>{var e=FA();return ht(e,He(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint w-full resize-y rounded-md border px-2 py-1.5 text-[12px] leading-relaxed outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function YA(e){let[t,n]=Ue(e,[`class`,`children`]);return(()=>{var e=IA();return ht(e,He(n,{get class(){return`bg-surface-2 border-border focus:border-accent h-7 w-full cursor-pointer rounded-md border px-1.5 text-[12px] outline-none ${t.class??``}`}}),!1,!0),N(e,()=>t.children),e})()}function XA(e){return(()=>{var t=RA(),n=t.firstChild;return N(n,()=>e.label),N(t,()=>e.children,null),N(t,A(j,{get when(){return e.hint},get children(){var t=LA();return N(t,()=>e.hint),t}}),null),t})()}function ZA(e){return(()=>{var t=zA(),n=t.firstChild;return N(n,()=>e.title),N(t,()=>e.children,null),t})()}function QA(e){return(()=>{var t=BA();return N(t,()=>e.children),E(n=>{var r=`bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class??``}`,i=e.color?{color:e.color}:void 0;return r!==n.e&&ut(t,n.e=r),n.t=pt(t,i,n.t),n},{e:void 0,t:void 0}),t})()}function $A(e){return(()=>{var t=VA();return E(n=>mt(t,`background`,e.color)),t})()}function ej(e){return(()=>{var t=HA(),n=t.firstChild,r=n.nextSibling;return N(n,()=>e.title),N(r,()=>e.children),t})()}function tj(e){return(()=>{var t=UA();return N(t,()=>e.message),t})()}var nj={0:`No priority`,1:`Urgent`,2:`High`,3:`Medium`,4:`Low`};function rj(e){let t=typeof e==`number`?e:Date.parse(e),n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}zr(),Px(),hD();var ij=M(`<span class="truncate font-mono">`),aj=M(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M5.5 3.5 6.6 2h2.8l1.1 1.5H13A1.5 1.5 0 0 1 14.5 5v7A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V5A1.5 1.5 0 0 1 3 3.5h2.5Z"></path><circle cx=8 cy=8.2 r=2.4>`),oj=M(`<div class="flex items-center justify-between gap-1.5"><span class="text-text-faint text-[11px]">Model:</span><div class="flex rounded-md border border-border overflow-hidden">`),sj=M(`<span class="inline-block min-w-[12ch] text-center">`),cj=M(`<div class="flex justify-end">`),lj=M(`<div class="flex flex-col gap-1.5">`),uj=M(`<p class="text-text-faint text-[11px] leading-snug">Primary provider failed — drafted with <span class=text-text-dim></span> (<!>).`),dj=M(`<div class="flex flex-col gap-1">`),fj=M(`<option value>Select a team…`),pj=M(`<option value=cursor> — cloud agent`),mj=M(`<option value=local>Local Claude Code (bridge)`),hj=M(`<option value=none>No one — just create the issue`),gj=M(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach dev server logs <span class="text-text-dim tabular-nums">(last <!> lines)`),_j=M(`<p class="text-warn text-[11px] leading-snug">`),vj=M(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4"><div class="bg-surface border-border flex items-center gap-2 rounded-lg border px-2.5 py-2"><div class="flex min-w-0 flex-1 flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Attached context</span><div class="flex min-w-0 flex-wrap items-center gap-1.5"></div></div></div><div class="bg-bg border-border sticky bottom-0 z-10 -mb-4 flex flex-col gap-2 border-t pt-2.5 pb-3">`),yj=M(`<button>`),bj=M(`<div class="flex items-center gap-1"><span class="text-text-faint text-[11px] tabular-nums w-4 shrink-0 text-right">.</span><button class="text-text-faint hover:text-danger shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors cursor-pointer text-[12px] leading-none"aria-label="Remove step">×`),xj=M(`<option>`),Sj=M(`<option>Loading teams…`),Cj=M(`<div class="bg-surface border-border rounded-lg border p-2.5 flex items-center justify-between gap-2"><a target=_blank rel="noopener noreferrer"class="text-accent font-mono text-[12px] hover:underline">`);function wj(e){ur();let t=br(()=>({queryKey:[`grab`],queryFn:Or})),n=br(()=>({queryKey:[`settings`],queryFn:Er})),r=O(()=>n.data??{}),i=O(()=>t.data?.[0]??null),a=O(()=>!!(r().linearApiKey||r().linearAccessToken)),o=O(()=>kx(r())),[s,c]=w(``),[l,u]=w(``),[d,f]=w([]),[p,m]=w(``),[h,g]=w(``),[_,v]=w(``),[y,b]=w(``),[x,S]=w(``),[ee,C]=w(0),[T,te]=w(r().defaultTeamId??``),[ne,k]=w(r().defaultRepo??``),[re,ie]=w(`none`),[ae,se]=w(``),[ce,le]=w(`fast`),[ue,de]=w(!0),fe=!1;D(()=>{let e=n.data;fe||!e||(fe=!0,te(e.defaultTeamId??``),k(e.defaultRepo??``),ie(e.cursorAgentId?`cursor`:`none`))});let pe=br(()=>({queryKey:[`teams`],queryFn:lO,enabled:a()})),me=O(()=>(pe.data??[]).find(e=>e.id===T())?.name),[he,ge]=w(!1),[_e,ve]=w(null),[ye,be]=w(null),xe=null,Se=()=>{xe?.(),xe=null};oe(Se);let Ce=e=>{e.title!==void 0&&c(e.title),e.description!==void 0&&u(e.description),e.reproSteps!==void 0&&f(e.reproSteps),e.expected!==void 0&&m(e.expected),e.actual!==void 0&&g(e.actual),e.impact!==void 0&&v(e.impact),e.analysisNotes!==void 0&&b(e.analysisNotes),e.suggestedNextSteps!==void 0&&S(e.suggestedNextSteps),e.priority!==void 0&&C(e.priority)},we=async()=>{if(!o())return;ge(!0),ve(null),be(null),Se();let e=r().logUrl&&ue()?await IO({logUrl:r().logUrl,logLines:40}).catch(()=>void 0):void 0;xe=xD({note:ae(),grabbed:i()??null,grabbedList:t.data??void 0,teamName:me(),tier:ce(),template:cD(r()),logs:e??void 0},{onPartial:Ce,onDone:e=>{Ce(e.draft),e.fellBack&&be({provider:e.provider,modelId:e.modelId}),ge(!1),xe=null},onError:(e,t)=>{ve(t===`no-provider`?`No AI provider configured — add an OpenAI or Anthropic key in Settings.`:e),ge(!1),xe=null}})},[Te,Ee]=w(VD());oe(HD(Ee));let De=async()=>{let e=VD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await yO(e.blob,`recording-${Date.now()}.gif`);return nO(t),t},[Oe,ke]=w(null),[Ae,je]=w(null),[Me,Ne]=w(null),Pe=xr(()=>({mutationFn:async()=>{let e=fD({description:l(),reproSteps:d(),expected:p(),actual:h(),impact:_(),analysisNotes:y(),suggestedNextSteps:x(),grabs:t.data??[],repo:ne(),model:r().cursorModel,agentInstructions:cD(r())});je(null);let n=[],i=VD();if(i.result&&i.attachOnCreate)try{let t=await De();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 yO(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}`:``}`)}if(r().logUrl&&ue())try{let t=await IO(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 o=await mO({teamId:T(),title:s(),description:e,priority:ee(),delegateId:re()===`cursor`?r().cursorAgentId:void 0}),c=!1;if(re()===`local`)try{await DO(`${o.identifier} — ${s()}`,`You are delegated Linear issue ${o.identifier} (${o.url}).\n\n${e}\n\nWork in this repository until the issue is resolved, following the Agent instructions above.`),c=!0}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 u=await MO(r(),{identifier:o.identifier,title:s(),url:o.url,summary:l(),impact:_(),repo:ne()||r().defaultRepo,demoUrl:VD().result?.assetUrl,executor:re()});return u.length&&je(`${u.join(` + `)} announcement failed — check the token/channel in Settings.`),{...o,localTask:c}},onSuccess:e=>{Ne({identifier:e.identifier,url:e.url}),ke(null),be(null),eO(),e.localTask&&kA(`local`)},onError:e=>{ke(e.message)}})),Fe=O(()=>!!s().trim()&&!!T()&&a()),Ie=O(()=>{let e=o();return e?Mx[e][ce()]:null}),Le=()=>f(e=>[...e,``]),Re=e=>f(t=>t.filter((t,n)=>n!==e)),ze=(e,t)=>f(n=>n.map((n,r)=>r===e?t:n));return(()=>{var n=vj(),f=n.firstChild,w=f.firstChild.firstChild.nextSibling,D=f.nextSibling;return N(w,A(j,{get when(){return i()},get fallback(){return A(QA,{class:`text-text-faint`,children:`No element`})},get children(){return A(QA,{class:`text-accent max-w-full`,get children(){var e=ij();return N(e,(()=>{var e=nt(()=>!!i().componentName);return()=>e()?`<${i().componentName}>`:i().source?.filePath?.split(`/`).pop()??`element`})()),e}})}}),null),N(w,A(j,{get when(){return i()?.screenshotDataUrl},get children(){return A(QA,{class:`text-success`,children:`screenshot ✓`})}}),null),N(w,A(j,{get when(){return Te().result},get children(){return A(QA,{get class(){return Te().attachOnCreate?`text-success`:`text-text-faint`},get children(){return[`gif `,nt(()=>(Te().result.durationMs/1e3).toFixed(0)),`s`,nt(()=>Te().attachOnCreate?` ✓`:` (off)`)]}})}}),null),N(w,A(j,{get when(){return(t.data?.length??0)>1},get children(){return A(QA,{get children(){return[`+`,nt(()=>t.data.length-1),` more`]}})}}),null),N(w,A(j,{get when(){return Te().phase===`recording`},get children(){return A(QA,{class:`text-danger`,children:`● recording…`})}}),null),N(f,A(GA,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Manage in the Capture tab — elements, screenshots, recording`,"aria-label":`Open Capture tab`,onClick:()=>kA(`capture`),get children(){return aj()}}),null),N(n,A(ZA,{title:`AI draft`,get children(){return[A(XA,{label:`Your note`,get children(){return A(JA,{rows:3,placeholder:`Describe the problem or change in your own words…`,get value(){return ae()},onInput:e=>se(e.currentTarget.value)})}}),(()=>{var e=oj(),t=e.firstChild.nextSibling;return N(t,()=>[`fast`,`best`].map(e=>(()=>{var t=yj();return t.$$click=()=>le(e),N(t,e===`fast`?`Fast`:`Best`),E(()=>ut(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=lj();return N(e,A(j,{get when(){return o()},get fallback(){return A(GA,{variant:`ghost`,class:`w-full opacity-60 cursor-default`,disabled:!1,children:`Add an AI key in Settings`})},get children(){return A(GA,{variant:`primary`,class:`w-full`,get loading(){return he()},onClick:we,get disabled(){return he()},children:`Draft with AI`})}}),null),N(e,A(j,{get when(){return Ie()},get children(){var e=cj();return N(e,A(QA,{get children(){var e=sj();return N(e,Ie),e}})),e}}),null),e})(),A(j,{get when(){return ye()},get children(){var e=uj(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return n.nextSibling,N(t,()=>ye().provider),N(e,()=>ye().modelId,n),e}}),A(j,{get when(){return _e()},get children(){return A(tj,{get message(){return _e()}})}})]}}),D),N(n,A(ZA,{title:`Issue`,get children(){return[A(XA,{label:`Title`,get children(){return A(qA,{class:`h-8 text-[13px] font-medium`,get value(){return s()},onInput:e=>c(e.currentTarget.value),placeholder:`Brief summary of the issue`})}}),A(XA,{label:`Description`,get children(){return A(JA,{rows:6,get value(){return l()},onInput:e=>u(e.currentTarget.value),placeholder:`Markdown supported`})}}),A(XA,{label:`Reproduction steps`,get children(){var e=dj();return N(e,A(Ke,{get each(){return d()},children:(e,t)=>(()=>{var n=bj(),r=n.firstChild,i=r.firstChild,a=r.nextSibling;return N(r,t+1,i),N(n,A(qA,{class:`flex-1`,get value(){return e()},onInput:e=>ze(t,e.currentTarget.value),placeholder:`Step ${t+1}`}),a),a.$$click=()=>Re(t),n})()}),null),N(e,A(GA,{variant:`ghost`,class:`self-start h-6 px-2 text-[11px]`,onClick:Le,children:`+ Add step`}),null),e}}),A(XA,{label:`Expected`,get children(){return A(JA,{rows:2,get value(){return p()},onInput:e=>m(e.currentTarget.value),placeholder:`What should happen`})}}),A(XA,{label:`Actual`,get children(){return A(JA,{rows:2,get value(){return h()},onInput:e=>g(e.currentTarget.value),placeholder:`What actually happens`})}}),A(XA,{label:`Impact`,get children(){return A(JA,{rows:2,get value(){return _()},onInput:e=>v(e.currentTarget.value),placeholder:`Who/what is affected and how badly`})}}),A(XA,{label:`Analysis / Notes`,get children(){return A(JA,{rows:3,get value(){return y()},onInput:e=>b(e.currentTarget.value),placeholder:`- Likely root cause…`})}}),A(XA,{label:`Suggested next steps`,get children(){return A(JA,{rows:3,get value(){return x()},onInput:e=>S(e.currentTarget.value),placeholder:`- Concrete fix suggestion…`})}}),A(XA,{label:`Priority`,get children(){return A(YA,{get value(){return ee()},onChange:e=>C(Number(e.currentTarget.value)),get children(){return A(Ge,{get each(){return Object.entries(nj)},children:([e,t])=>(()=>{var n=xj();return n.value=e,N(n,t),n})()})}})}}),A(j,{get when(){return a()},get fallback(){return A(tj,{message:`Connect Linear in Settings to create issues.`})},get children(){return A(XA,{label:`Team`,get children(){return A(j,{get when(){return!pe.isLoading},get fallback(){return A(YA,{disabled:!0,get children(){return Sj()}})},get children(){return A(YA,{get value(){return T()},onChange:e=>te(e.currentTarget.value),get children(){return[fj(),A(Ge,{get each(){return pe.data??[]},children:e=>(()=>{var t=xj();return N(t,()=>e.name),E(()=>t.selected=e.id===T()),E(()=>t.value=e.id),t})()})]}})}})}})}}),A(XA,{label:`Repo`,hint:`Appended as [repo=…] so Cursor works in the right repository.`,get children(){return A(qA,{get value(){return ne()},onInput:e=>k(e.currentTarget.value),placeholder:`owner/repository`})}}),A(XA,{label:`Delegate to`,get hint(){return nt(()=>re()===`local`)()?"Requires `npx linear-grab-bridge` running in the repo — track it in the Local tab.":re()===`cursor`&&!r().cursorAgentId?`Pick the Cursor agent in Settings first.`:void 0},get children(){return A(YA,{get value(){return re()},onChange:e=>ie(e.currentTarget.value),get children(){return[(()=>{var e=pj(),t=e.firstChild;return N(e,()=>r().cursorAgentName??`Cursor`,t),E(t=>{var n=!r().cursorAgentId,i=re()===`cursor`;return n!==t.e&&(e.disabled=t.e=n),i!==t.t&&(e.selected=t.t=i),t},{e:void 0,t:void 0}),e})(),(()=>{var e=mj();return E(()=>e.selected=re()===`local`),e})(),(()=>{var e=hj();return E(()=>e.selected=re()===`none`),e})()]}})}}),A(j,{get when(){return r().logUrl},get children(){var e=gj(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,i=n.firstChild.nextSibling;return i.nextSibling,t.addEventListener(`change`,e=>de(e.currentTarget.checked)),N(n,()=>Math.min(500,Math.max(10,r().logLines??100)),i),E(()=>t.checked=ue()),e}})]}}),D),N(D,A(j,{get when(){return Oe()},get children(){return A(tj,{get message(){return Oe()}})}}),null),N(D,A(j,{get when(){return Ae()},get children(){var e=_j();return N(e,Ae),e}}),null),N(D,A(j,{get when(){return Me()},children:t=>(()=>{var n=Cj(),r=n.firstChild;return N(r,()=>t().identifier),N(n,A(GA,{variant:`ghost`,class:`h-6 px-2 text-[11px]`,onClick:()=>{Ne(null),be(null),e.onCreated()},children:`View activity`}),null),E(()=>st(r,`href`,t().url)),n})()}),null),N(D,A(GA,{variant:`primary`,get loading(){return Pe.isPending},get disabled(){return!Fe()},onClick:()=>Pe.mutate(),children:`Create issue`}),null),n})()}ot([`click`]);function Tj(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 cN(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=sN(i,t,n);if(e)return e;i=n?null:i.sibling}return null}function Ej(e,t){let n=0,r=0,i=0;do i=MN[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 Dj(e,t){return e.pos>=t?!1:e.peek()!==kN}function Oj(e){let{length:t}=e,n=new NN(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=Ej(n,i),i<u&&(l=!1),u=i,Dj(n,e)?(a=Ej(n,a),o=Ej(n,o),s=Ej(n,s),Dj(n,e)?(c=Ej(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||kj(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function kj(e){e.sort(Aj)}function Aj(e,t){return e[0]-t[0]}var jj,Mj,Nj,Pj,Fj,Ij,Lj,Rj,zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj,Yj,Xj,Zj,Qj,$j,eM,tM,nM,rM,iM,aM,oM,sM,cM,lM,uM,dM,fM,pM,mM,hM,gM,_M,vM,yM,bM,xM,SM,CM,wM,TM,EM,DM,OM,kM,AM,jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,JM,YM,XM,ZM,QM,$M,eN,tN,nN,rN,iN,aN,oN,sN,cN,lN,uN,dN,fN,pN,mN,hN,gN,_N,vN,yN,bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,YN,XN,ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,fP,pP,mP,hP,gP,_P,vP,yP,bP,xP,SP,CP,wP,TP,EP,DP,OP,kP,AP,jP,MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,JP,YP,XP,ZP,QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,MF,NF,PF,FF,IF,LF,RF,zF,BF,VF,HF,UF,WF,GF,KF,qF,JF,YF,XF,ZF,QF,$F,eI,tI,nI,rI,iI,aI,oI,sI,cI,lI,uI,dI,fI,pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,wI,TI,EI,DI,OI,kI,AI,jI,MI,NI,PI,FI,II,LI,RI,zI,BI,VI,HI,UI,WI,GI,KI,qI,JI,YI,XI,ZI,QI,$I,eL,tL,nL,rL,iL,aL,oL,sL,cL,lL,uL,dL,fL,pL=t((()=>{jj=null,Mj=()=>{if(jj!==null)return jj;try{jj=window.matchMedia(`(color-gamut: p3)`).matches}catch{jj=!1}return jj},Nj=Mj(),Pj=e=>Nj?`color(display-p3 0.84 0.19 0.78 / ${e})`:`rgba(210, 57, 192, ${e})`,Fj=null,Ij=e=>{Fj=e},Lj=()=>Fj,Rj=e=>!Fj||e!==null&&Fj.contains(e),zj=e=>e,Bj=`data-react-grab`,Vj=`0.1.48`,Hj=`var(--rg-shadow)`,Uj=-1e3,Wj=.95,Gj=1500,Kj=[`/components/ui/`,`/packages/ui/`,`/design-system/`,`/design-systems/`,`/primitives/`],qj=5e3,Jj=8e3,Yj=1e4,Xj=2147483647,Zj=2147483645,Qj=.7,$j=1e3/60,eM=.01,tM=Pj(.4),nM=Pj(.05),rM=Pj(.5),iM=Pj(.08),aM=Pj(.15),oM=.2,sM=[`id`,`class`,`aria-label`,`data-testid`,`role`,`name`,`title`],cM=new Set([`id`,`data-testid`,`aria-label`,`href`,`src`,`alt`,`type`,`name`,`placeholder`,`role`,`for`,`action`,`method`,`title`,`disabled`,`checked`,`readonly`,`required`,`selected`,`open`]),lM=new Set([`a`,`code`,`pre`]),uM=new Set([`script`,`style`,`template`,`noscript`]),dM=[`Meta`,`Control`,`Shift`,`Alt`],fM=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]),pM=`data-react-grab-frozen`,mM=.5,hM=`data-react-grab-input`,gM=.5,_M=`copy`,vM=`comment`,yM=`edit`,bM=`superellipse(1.25)`,xM=.01,SM=1e3,CM={left:-9999,top:-9999},wM={left:`left center`,right:`right center`,top:`center top`,bottom:`center bottom`},TM=1e3,EM=`#00000000`,DM=`transparent`,OM=2e3,kM=`cubic-bezier(0.34, 1.56, 0.64, 1)`,AM=12e3,jM=9e3,MM=1e4,NM=8e3,PM=5e3,FM=1e3,IM=1.2,LM=-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(`.`)),RM=e=>(e.tagName||``).toLowerCase(),BM=()=>{if(zM!==void 0)return zM;let e=document.querySelector(`script[nonce], style[nonce]`),t=e?.nonce||e?.getAttribute(`nonce`)||null;return t&&(zM=t),t},VM=[[`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`,``]],HM=e=>{for(let[t,n]of VM)e.setAttribute(t,n);e.setAttribute(`data-testid`,`react-grab-overlay`),e.classList.add(`ph-no-capture`)},UM=`bippy-0.5.43`,WM=Object.defineProperty,GM=Object.prototype.hasOwnProperty,KM=()=>{},qM=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{}},JM=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),YM=!1,ZM=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>YM?!0:(e&&typeof e.inject==`function`&&(XM=e.inject.toString()),!!XM?.includes(`(injected)`)),QM=new Set,$M=new Set,eN=e=>{let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:UM,checkDCE:qM,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),$M.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,QM.forEach(e=>e())),i},on:KM,onCommitFiberRoot:KM,onCommitFiberUnmount:KM,onPostCommitFiberRoot:KM,renderers:t,supportsFiber:!0,supportsFlight:!0};try{WM(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)=>{$M.add(e),t.renderers.set(n,e)}),tN(e))}}});let t=window.hasOwnProperty,n=!1;WM(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{tN(e)}return r},tN=e=>{e&&QM.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=qM,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=UM,t._instrumentationIsActive=!1;let e=JM(t);if(e||(t.on=KM),t.renderers.size){t._instrumentationIsActive=!0,QM.forEach(e=>e());return}let n=t.inject,r=ZM(t);r&&!e&&(YM=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return $M.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,QM.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||ZM())&&e?.()}catch{}},nN=()=>GM.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),rN=e=>nN()?(tN(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):eN(e),iN=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)),aN=()=>{try{iN()&&rN()}catch{}},oN=e=>{switch(e.tag){case 1:case 11:case 0:case 14:case 15:return!0;default:return!1}},sN=(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=sN(r,t,n);if(e)return e;r=n?null:r.sibling}return null},cN=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 cN(r,t,n);if(e)return e;r=n?null:r.sibling}return null},lN=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?lN(t.type||t.render):null},uN=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=lN(t);return r&&(r.displayName||r.name)||null},dN=()=>{let e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;return!!e?._instrumentationIsActive||JM(e)||ZM(e)},fN=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},pN=new Set,mN=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,hN=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],gN=[`<anonymous>`,`eval`,``],_N=/\.(jsx|tsx|ts|js)$/,vN=/(\.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,yN=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,bN=/\(at [^)]+\)$/,xN=/(^|@)\S+:\d+/,SN=/^\s*at .*(\S+:\d+|\(native\))/m,CN=/^(eval@)?(\[native code\])?$/,wN=(e,t)=>{if(t?.includeInElement!==!1){let n=e.split(`
|
|
172
|
+
`),r=[];for(let e of n)if(/^\s*at\s+/.test(e)){let t=DN(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(xN)){let t=ON(e,void 0)[0];t&&r.push(t)}return EN(r,t)}return e.match(SN)?DN(e,t):ON(e,t)},TN=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]},EN=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e,DN=(e,t)=>EN(e.split(`
|
|
173
|
+
`).filter(e=>!!e.match(SN)),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=TN(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}}),ON=(e,t)=>EN(e.split(`
|
|
174
|
+
`).filter(e=>!e.match(CN)),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=TN(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}}}),kN=44,AN=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,jN=new Uint8Array(64),MN=new Uint8Array(128);for(let e=0;e<AN.length;e++){let t=AN.charCodeAt(e);jN[e]=t,MN[t]=e}NN=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}},PN=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,FN=/^data:application\/json[^,]+base64,/,IN=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,LN=new Map,RN=new Map,zN=(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},BN=(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 zN(r.map.mappings,r.map.sources,i,a)}return zN(e.mappings,e.sources,t-1,n)},VN=(e,t)=>{let n=t.split(`
|
|
175
|
+
`),r;for(let e=n.length-1;e>=0&&!r;e--){let t=n[e].match(IN);t&&(r=t[1]||t[2])}if(!r)return null;let i=PN.test(r);if(!(FN.test(r)||i||r.startsWith(`/`))){let t=e.split(`/`);t[t.length-1]=r,r=t.join(`/`)}return r},HN=e=>({file:e.file,mappings:Oj(e.mappings),names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,version:3}),UN=e=>{let t=e.sections.map(({map:e,offset:t})=>({map:{...e,mappings:Oj(e.mappings)},offset:t})),n=new Set;for(let e of t)for(let t of e.map.sources)n.add(t);return{file:e.file,mappings:[],names:[],sections:t,sourceRoot:void 0,sources:Array.from(n),sourcesContent:void 0,version:3}},WN=e=>{if(!e)return!1;let t=e.trim();if(!t)return!1;let n=t.match(PN);if(!n)return!0;let r=n[0].toLowerCase();return r===`http:`||r===`https:`},GN=async(e,t=fetch)=>{if(!WN(e))return null;let n=await t(e);if(!n.ok)return null;let r=await n.text();if(!r)return null;let i=VN(e,r);if(!i||!WN(i))return null;let a=await t(i);if(!a.ok)return null;try{let e=await a.json();return`sections`in e?UN(e):HN(e)}catch{return null}},KN=async(e,t=!0,n)=>{if(t&&LN.has(e))return LN.get(e)??null;let r=t?RN.get(e):void 0;if(r)return(await r).sourceMap;let i=GN(e,n).then(e=>({sourceMap:e,isTransientFailure:!1}),()=>({sourceMap:null,isTransientFailure:!0}));t&&RN.set(e,i);let{sourceMap:a,isTransientFailure:o}=await i;return t&&(RN.delete(e),o||LN.set(e,a)),a},qN=async(e,t=!0,n)=>await Promise.all(e.map(async e=>{if(!e.fileName)return e;let r=await KN(e.fileName,t,n);if(!r||typeof e.lineNumber!=`number`||typeof e.columnNumber!=`number`)return e;let i=BN(r,e.lineNumber,e.columnNumber);return i?{...e,source:i.fileName&&e.source?e.source.replace(e.fileName,i.fileName):e.source,fileName:i.fileName,lineNumber:i.lineNumber,columnNumber:i.columnNumber,isSymbolicated:!0}:e})),JN=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack==`string`,YN=()=>{let e=rN();for(let t of[...Array.from($M),...Array.from(e.renderers.values())]){let e=t.currentDispatcherRef;if(e&&typeof e==`object`)return`H`in e?e.H:e.current}return null},XN=e=>{for(let t of $M){let n=t.currentDispatcherRef;n&&typeof n==`object`&&(`H`in n?n.H=e:n.current=e)}},ZN=e=>`\n in ${e}`,QN=(e,t)=>{let n=ZN(e);return t&&(n+=` (at ${t})`),n},$N=!1,eP=(e,t)=>{if(!e||$N)return``;let n=Error.prepareStackTrace;Error.prepareStackTrace=void 0,$N=!0;let r=YN();XN(null);let i=console.error,a=console.warn;console.error=()=>{},console.warn=()=>{};try{let n={DetermineComponentFrameRoot(){let n;try{if(t){let t=function(){throw Error()};if(Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){n=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){n=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){n=e}let t=e();t&&typeof t.catch==`function`&&t.catch(()=>{})}}catch(e){if(e instanceof Error&&n instanceof Error&&typeof e.stack==`string`)return[e.stack,n.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`,Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,`name`)?.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});let[r,i]=n.DetermineComponentFrameRoot();if(r&&i){let t=r.split(`
|
|
176
|
+
`),n=i.split(`
|
|
177
|
+
`),a=0,o=0;for(;a<t.length&&!t[a].includes(`DetermineComponentFrameRoot`);)a++;for(;o<n.length&&!n[o].includes(`DetermineComponentFrameRoot`);)o++;if(a===t.length||o===n.length)for(a=t.length-1,o=n.length-1;a>=1&&o>=0&&t[a]!==n[o];)o--;for(;a>=1&&o>=0;a--,o--)if(t[a]!==n[o]){if(a!==1||o!==1)do if(a--,o--,o<0||t[a]!==n[o]){let n=`\n${t[a].replace(` at new `,` at `)}`,r=uN(e);return r&&n.includes(`<anonymous>`)&&(n=n.replace(`<anonymous>`,r)),n}while(a>=1&&o>=0);break}}}finally{$N=!1,Error.prepareStackTrace=n,XN(r),console.error=i,console.warn=a}let o=e?uN(e):``;return o?ZN(o):``},tP=(e,t)=>{let n=e.tag,r=``;switch(n){case 28:r=ZN(`Activity`);break;case 1:r=eP(e.type,!0);break;case 11:r=eP(e.type.render,!1);break;case 0:case 15:r=eP(e.type,!1);break;case 5:case 26:case 27:r=ZN(e.type);break;case 16:r=ZN(`Lazy`);break;case 13:r=e.child!==t&&t!==null?ZN(`Suspense Fallback`):ZN(`Suspense`);break;case 19:r=ZN(`SuspenseList`);break;case 30:r=ZN(`ViewTransition`);break;default:return``}return r},nP=e=>{try{let t=``,n=e,r=null;do{t+=tP(n,r);let e=n._debugInfo;if(e&&Array.isArray(e))for(let n=e.length-1;n>=0;n--){let r=e[n];typeof r.name==`string`&&(t+=QN(r.name,r.env))}r=n,n=n.return}while(n);return t}catch(e){return e instanceof Error?`\nError generating stack: ${e.message}\n${e.stack}`:``}},rP=e=>{let t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;let n=e;if(!n)return``;Error.prepareStackTrace=t,n.startsWith(`Error: react-stack-top-frame
|
|
178
|
+
`)&&(n=n.slice(29));let r=n.indexOf(`
|
|
179
|
+
`);if(r!==-1&&(n=n.slice(r+1)),r=Math.max(n.indexOf(`react_stack_bottom_frame`),n.indexOf(`react-stack-bottom-frame`)),r!==-1&&(r=n.lastIndexOf(`
|
|
180
|
+
`,r)),r!==-1)n=n.slice(0,r);else return``;return n},iP=e=>!!(e.functionName&&e.fileName&&(e.fileName.startsWith(`rsc://`)||e.fileName.startsWith(`about://React/`))),aP=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,oP=e=>{let t=new Map;for(let n of e)for(let e of n.stackFrames){if(!iP(e))continue;let n=e.functionName,r=t.get(n)??[];r.some(t=>aP(t,e))||(r.push(e),t.set(n,r))}return t},sP=(e,t,n)=>{if(!e.functionName)return{...e,isServer:!0};let r=t.get(e.functionName);if(!r||r.length===0)return{...e,isServer:!0};let i=n.get(e.functionName)??0,a=r[i%r.length];return n.set(e.functionName,i+1),{...e,isServer:!0,fileName:a.fileName,lineNumber:a.lineNumber,columnNumber:a.columnNumber,source:e.source?.replace(`(at Server)`,`(${a.fileName}:${a.lineNumber}:${a.columnNumber})`)}},cP=e=>{let t=[];return Tj(e,e=>{if(!JN(e))return;let n=typeof e.type==`string`?e.type:uN(e.type)||`<anonymous>`;t.push({componentName:n,stackFrames:wN(rP(e._debugStack?.stack))})},!0),t},lP=async(e,t=!0,n)=>{let r=cP(e),i=wN(nP(e)),a=oP(r),o=new Map;return qN(i.map(e=>(e.source?.includes(`(at Server)`)??!1)||e.source!=null&&bN.test(e.source)?sP(e,a,o):e).filter((e,t,n)=>{if(t===0)return!0;let r=n[t-1];return e.functionName!==r.functionName}),t,n)},uP=e=>{let t=e._debugSource;return t?typeof t==`object`&&!!t&&`fileName`in t&&typeof t.fileName==`string`&&`lineNumber`in t&&typeof t.lineNumber==`number`:!1},dP=async(e,t=!0,n)=>{if(uP(e))return e._debugSource||null;let r=await lP(e,t,n);for(let e of r)if(e.fileName)return{fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,functionName:e.functionName};return null},fP=e=>e.split(`/`).filter(Boolean).length,pP=e=>e.split(`/`).filter(Boolean)[0]??null,mP=e=>{let t=e.indexOf(`/`,1);if(t===-1||fP(e.slice(0,t))!==1)return e;let n=e.slice(t);if(!_N.test(n)||fP(n)<2)return e;let r=pP(n);return!r||r.startsWith(`@`)||r.length>4?e:n},hP=e=>{if(!e||gN.some(t=>t===e))return``;let t=e,n=t.startsWith(`http://`)||t.startsWith(`https://`);if(n)try{t=new URL(t).pathname}catch{}if(n&&(t=mP(t)),t.startsWith(`about://React/`)){let e=t.slice(14),n=e.indexOf(`/`),r=e.indexOf(`:`);t=n!==-1&&(r===-1||n<r)?e.slice(n+1):e}let r=!0;for(;r;){r=!1;for(let e of hN)if(t.startsWith(e)){t=t.slice(e.length),e===`file:///`&&(t=`/${t.replace(/^\/+/,``)}`),r=!0;break}}if(mN.test(t)){let e=t.match(mN);e&&(t=t.slice(e[0].length))}if(t.startsWith(`//`)){let e=t.indexOf(`/`,2);t=e===-1?``:t.slice(e)}let i=t.indexOf(`?`);if(i!==-1){let e=t.slice(i);yN.test(e)&&(t=t.slice(0,i))}return t},gP=e=>{let t=hP(e);return!(!t||!_N.test(t)||vN.test(t))},_P=Symbol.for(`react.context`),vP=[],yP=null,bP=Error("Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render."),xP=()=>{let e=yP;return e!==null&&(yP=e.next),e},SP=e=>e._currentValue,CP=(e,t,n,r=null)=>{vP.push({displayName:r,primitive:e,stackError:Error(),value:t,dispatcherHookName:n})},wP=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.then==`function`){let e=t;switch(e.status){case`fulfilled`:return CP(`Promise`,e.value,`Use`),e.value;case`rejected`:throw e.reason}throw CP(`Unresolved`,e,`Use`),bP}if(t.$$typeof===_P&&`_currentValue`in t){let e=t,n=SP(e);return CP(`Context (use)`,n,`Use`,e.displayName||`Context`),n}}throw Error(`An unsupported type was passed to use(): `+String(e))},TP=e=>{let t=SP(e);return CP(`Context`,t,`Context`,e.displayName||null),t},EP=e=>{let t=xP(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return CP(`State`,n,`State`),[n,()=>{}]},DP=(e,t,n)=>{let r=xP(),i=r===null?n===void 0?t:n(t):r.memoizedState;return CP(`Reducer`,i,`Reducer`),[i,()=>{}]},OP=e=>{let t=xP(),n=t===null?{current:e}:t.memoizedState;return CP(`Ref`,n.current,`Ref`),n},kP=()=>{let e=xP();return CP(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},AP=e=>{xP(),CP(`LayoutEffect`,e,`LayoutEffect`)},jP=e=>{xP(),CP(`InsertionEffect`,e,`InsertionEffect`)},MP=e=>{xP(),CP(`Effect`,e,`Effect`)},NP=e=>{xP();let t;typeof e==`object`&&e&&`current`in e&&(t=e.current),CP(`ImperativeHandle`,t,`ImperativeHandle`)},PP=(e,t)=>{CP(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},FP=e=>{let t=xP();return CP(`Callback`,t===null?e:t.memoizedState[0],`Callback`),e},IP=e=>{let t=xP(),n=t===null?e():t.memoizedState[0];return CP(`Memo`,n,`Memo`),n},LP=(e,t)=>{let n=xP();xP();let r=n===null?t():n.memoizedState;return CP(`SyncExternalStore`,r,`SyncExternalStore`),r},RP=()=>{let e=xP();xP();let t=e!==null&&e.memoizedState;return CP(`Transition`,t,`Transition`),[t,()=>{}]},zP=e=>{let t=xP(),n=t===null?e:t.memoizedState;return CP(`DeferredValue`,n,`DeferredValue`),n},BP=()=>{let e=xP(),t=e===null?``:e.memoizedState;return CP(`Id`,t,`Id`),t},VP=e=>[],HP=e=>{let t=xP(),n=t===null?e:t.memoizedState;return CP(`Optimistic`,n,`Optimistic`),[n,()=>{}]},UP=(e,t)=>{let n,r=null;if(e!==null){let t=e.memoizedState;if(typeof t==`object`&&t&&`then`in t&&typeof t.then==`function`){let e=t;switch(e.status){case`fulfilled`:n=e.value;break;case`rejected`:r=e.reason;break;default:r=bP,n=e}}else n=t}else n=t;return{value:n,error:r}},WP=e=>(t,n)=>{let r=xP();xP(),xP();let i=Error(),{value:a,error:o}=UP(r,n);if(vP.push({displayName:null,primitive:e,stackError:i,value:a,dispatcherHookName:e}),o!==null)throw o;return[a,()=>{},!1]},GP=WP(`ActionState`),KP={readContext:SP,use:wP,useCallback:FP,useContext:TP,useEffect:MP,useImperativeHandle:NP,useLayoutEffect:AP,useInsertionEffect:jP,useMemo:IP,useReducer:DP,useRef:OP,useState:EP,useDebugValue:PP,useDeferredValue:zP,useTransition:RP,useSyncExternalStore:LP,useId:BP,useHostTransitionStatus:()=>{let e=SP({_currentValue:null});return CP(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:WP(`FormState`),useActionState:GP,useOptimistic:HP,useMemoCache:VP,useCacheRefresh:kP,useEffectEvent:e=>(xP(),CP(`EffectEvent`,e,`EffectEvent`),e)},typeof Proxy>`u`||new Proxy(KP,{get(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];let n=Error(`Missing method in Dispatcher: `+t);throw n.name=`ReactDebugToolsUnsupportedHookError`,n}}),aN(),qP=/^(?:\.\/)?\/?\([a-z][a-z0-9-]*\)\//,JP=e=>{let t=hP(e);return t=t.replace(qP,``),t.startsWith(`./`)&&(t=t.slice(2)),t},XP=e=>(e&&(YP=void 0),YP??=typeof document<`u`&&!!(document.getElementById(`__NEXT_DATA__`)||document.querySelector(`nextjs-portal`)),YP),QP=()=>{if(ZP!==void 0)return ZP;let e=document.querySelector(`script[src*="/_next/"]`)?.src,t=e?new URL(e).pathname:``,n=t.indexOf(`/_next/`);return ZP=n>0?t.slice(0,n):``,ZP},$P=typeof window<`u`,eF=e=>0,tF=e=>{},nF=$P?(Object.getOwnPropertyDescriptor(Window.prototype,`requestAnimationFrame`)?.value??window.requestAnimationFrame).bind(window):eF,rF=$P?(Object.getOwnPropertyDescriptor(Window.prototype,`cancelAnimationFrame`)?.value??window.cancelAnimationFrame).bind(window):tF,iF=()=>$P?new Promise(e=>nF(()=>e())):Promise.resolve(),aF=(e,t=window.getComputedStyle(e))=>t.display!==`none`&&t.visibility!==`hidden`&&t.opacity!==`0`,oF=e=>{let t=RM(e);return t===`html`||t===`body`},sF=[`data-react-grab`,`data-react-grab-demo`],cF=e=>sF.some(t=>e.hasAttribute(t)),lF=e=>{if(cF(e))return!0;let t=e.getRootNode();return t instanceof ShadowRoot&&cF(t.host)},uF=e=>e.hasAttribute(`data-react-grab-ignore`)||e.closest(`[data-react-grab-ignore]`)!==null,dF=e=>{let t=parseInt(e.zIndex,10);return e.pointerEvents===`none`&&e.position===`fixed`&&!isNaN(t)&&t>=2147483600},fF=e=>{let t=e.backgroundColor;return t===`transparent`||t===`rgba(0, 0, 0, 0)`},pF=e=>{let t=e.position;if(t!==`fixed`&&t!==`absolute`)return!1;if(fF(e)||parseFloat(e.opacity)<.1)return!0;let n=parseInt(e.zIndex,10);return!isNaN(n)&&n>1e3},mF=new WeakMap,hF=()=>{mF=new WeakMap},gF=e=>{if(oF(e)||lF(e)||uF(e))return!1;let t=performance.now(),n=mF.get(e);if(n&&t-n.timestamp<50)return n.isVisible;let r=window.getComputedStyle(e);return aF(e,r)?e.clientWidth/window.innerWidth>=.9&&e.clientHeight/window.innerHeight>=.9&&(dF(r)||pF(r))?!1:(mF.set(e,{isVisible:!0,timestamp:t}),!0):(mF.set(e,{isVisible:!1,timestamp:t}),!1)},_F=(e,t)=>{let n=document.createElement(`style`);n.setAttribute(e,``);let r=BM();return r&&(n.nonce=r),HM(n),n.textContent=t,document.head.appendChild(n),n},vF=null,yF=null,bF=()=>vF!==null,xF=()=>{vF||(vF=_F(`data-react-grab-frozen-pseudo`,`html { pointer-events: none !important; }`),yF=_F(`data-react-grab-hittest-override`,`html, body { pointer-events: auto !important; }`),yF.disabled=!0)},SF=()=>{vF?.remove(),vF=null,yF?.remove(),yF=null},CF=()=>{vF&&(vF.disabled||=!0,yF?.disabled&&(yF.disabled=!1))},wF=()=>{vF&&(vF.disabled&&=!1,yF&&!yF.disabled&&(yF.disabled=!0))},TF=null,EF=null,DF=null,OF=(e,t,n)=>e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom,kF=()=>{DF!==null&&clearTimeout(DF),DF=setTimeout(()=>{DF=null,wF()},100)},AF=()=>{DF!==null&&(clearTimeout(DF),DF=null)},jF=(e,t,n,r)=>{let i=Math.abs(e-n),a=Math.abs(t-r);return i<=2&&a<=2},MF=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return[];AF(),CF();let n=document.elementsFromPoint(e,t);return kF(),Lj()?n.filter(Rj):n},NF=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return null;let n=performance.now();if(EF&&OF(e,t,EF.rect))return EF.element;if(TF){let r=jF(e,t,TF.clientX,TF.clientY),i=n-TF.timestamp<16;if(r||i)return TF.element}AF(),CF();let r=null,i=document.elementFromPoint(e,t);if(i&&gF(i)&&Rj(i))r=i;else{let n=document.elementsFromPoint(e,t);for(let e of n)if(e!==i&&gF(e)&&Rj(e)){r=e;break}}return kF(),EF=r instanceof HTMLIFrameElement?{element:r,rect:r.getBoundingClientRect()}:null,TF={clientX:e,clientY:t,element:r,timestamp:n},r},PF=()=>{AF(),wF(),TF=null,EF=null},FF=async(e,t)=>{let n=XP(),r=new URLSearchParams({file:e}),i=n?`line1`:`line`,a=n?`column1`:`column`;t&&r.set(i,String(t)),r.set(a,`1`);let o=n?`${QP()}/__nextjs_launch-editor`:`/__open-in-editor`;return(await fetch(`${o}?${r}`)).ok},IF=async(e,t,n)=>{let r=JP(e);if(await FF(r,t).catch(()=>!1))return;let i=t?`&line=${t}`:``,a=`https://react-grab.com/open-file?url=${encodeURIComponent(r)}${i}`,o=n?n(a,r,t):a;window.open(o,`_blank`,`noopener,noreferrer`)},LF=!1,RF=new Map,zF=-1,BF=new WeakSet,VF=new Map,HF=new Map,UF=e=>BF.has(e)?!0:!LF||!(`gsapVersions`in window)||!(Error().stack??``).includes(`_tick`)?!1:(BF.add(e),!0),typeof window<`u`&&(window.requestAnimationFrame=e=>{if(!UF(e))return nF(e);if(LF){let t=zF--;return RF.set(t,e),t}let t=nF(n=>{if(LF){let n=zF--;RF.set(n,e),VF.set(t,n);return}e(n)});return t},window.cancelAnimationFrame=e=>{if(RF.has(e)){RF.delete(e);return}let t=HF.get(e);if(t!==void 0){rF(t.nativeId),HF.delete(e);return}let n=VF.get(e);if(n!==void 0){RF.delete(n),VF.delete(e);return}rF(e)}),WF=()=>{if(!LF){LF=!0,RF.clear(),VF.clear();for(let[e,{nativeId:t,callback:n}]of HF)rF(t),RF.set(e,n);HF.clear()}},GF=()=>{if(LF){LF=!1;for(let[e,t]of RF.entries()){let n=nF(n=>{HF.delete(e),t(n)});HF.set(e,{nativeId:n,callback:t})}RF.clear(),VF.clear()}},KF=`
|
|
181
|
+
[${pM}],
|
|
182
|
+
[${pM}] * {
|
|
183
|
+
animation-play-state: paused !important;
|
|
184
|
+
transition: none !important;
|
|
185
|
+
}
|
|
186
|
+
`,qF=null,JF=[],YF=[],XF=[],ZF=null,QF=[],$F=[],eI=!1,tI=new Map,nI=[],rI=()=>{qF||=_F(`data-react-grab-frozen-styles`,KF)},iI=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),aI=e=>{let t=new Set;for(let n of e){n instanceof SVGSVGElement?t.add(n):n instanceof SVGElement&&n.ownerSVGElement&&t.add(n.ownerSVGElement);for(let e of n.querySelectorAll(`svg`))e instanceof SVGSVGElement&&t.add(e)}return[...t]},oI=(e,t)=>{let n=Reflect.get(e,t);typeof n==`function`&&n.call(e)},sI=e=>{for(let t of e){let e=tI.get(t)??0;e===0&&oI(t,`pauseAnimations`),tI.set(t,e+1)}},cI=e=>{for(let t of e){let e=tI.get(t);if(e){if(e===1){tI.delete(t),oI(t,`unpauseAnimations`);continue}tI.set(t,e-1)}}},lI=e=>{let t=[];for(let n of e)for(let e of n.getAnimations({subtree:!0}))e.playState===`running`&&t.push(e);return t},uI=e=>{for(let t of e)try{t.finish()}catch{}},dI=e=>{if(!(e.effect instanceof KeyframeEffect))return!1;let t=e.effect.target;return t instanceof Element&&t.getRootNode()instanceof ShadowRoot},fI=e=>{if(e.length!==0&&!iI(e,XF)){pI(),XF=[...e],rI(),JF=e,YF=aI(JF),sI(YF);for(let e of JF)e.setAttribute(pM,``);nI=lI(JF);for(let e of nI)e.pause()}},pI=()=>{if(!(JF.length===0&&YF.length===0&&nI.length===0)){for(let e of JF)e.removeAttribute(pM);cI(YF),uI(nI),JF=[],YF=[],nI=[],XF=[]}},mI=e=>e.length===0?(pI(),()=>{}):(fI(e),pI),hI=()=>{if(ZF)return[];let e=[];for(let t of document.getAnimations())dI(t)||t.playState===`running`&&e.push(t);return e},gI=e=>{if(!ZF){if(ZF=_F(`data-react-grab-global-freeze`,``),e.length>200)ZF.textContent=`
|
|
187
|
+
*, *::before, *::after {
|
|
188
|
+
animation-play-state: paused !important;
|
|
189
|
+
transition: none !important;
|
|
190
|
+
}
|
|
191
|
+
`,eI=!0,$F=[];else{for(let t of e)t.pause();$F=e,eI=!1}QF=aI(Array.from(document.querySelectorAll(`svg`))),sI(QF),WF()}},_I=()=>{if(ZF){if(eI){ZF.textContent=`
|
|
192
|
+
*, *::before, *::after {
|
|
193
|
+
transition: none !important;
|
|
194
|
+
}
|
|
195
|
+
`;let e=[];for(let t of document.getAnimations())dI(t)||e.push(t);uI(e),eI=!1}else{for(let e of $F)try{e.finish()}catch{try{e.play()}catch{}}$F=[]}ZF.remove(),ZF=null,cI(QF),QF=[],GF()}},vI=[`mouseenter`,`mouseleave`,`mouseover`,`mouseout`,`pointerenter`,`pointerleave`,`pointerover`,`pointerout`],yI=[`focus`,`blur`,`focusin`,`focusout`],bI=[`background-color`,`color`,`border-color`,`box-shadow`,`transform`,`opacity`,`outline`,`filter`,`scale`,`visibility`],xI=[`background-color`,`color`,`border-color`,`box-shadow`,`outline`,`outline-offset`,`outline-width`,`outline-color`,`outline-style`,`filter`,`opacity`,`ring-color`,`ring-width`],SI=new Map,CI=new Map,wI=e=>{e.stopImmediatePropagation()},TI=e=>{e.preventDefault(),e.stopImmediatePropagation()},EI=(e,t)=>{let n=new Map;for(let r of t){let t=e.style.getPropertyValue(r);t&&n.set(r,t)}return n},DI=(e,t,n)=>{if(n?.has(e))return null;let r=getComputedStyle(e),i=e.style.cssText,a=EI(e,t);for(let e of t){let t=r.getPropertyValue(e);t&&(i+=`${e}: ${t} !important; `)}return{element:e,frozenStyles:i,originalPropertyValues:a}},OI=(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},kI=()=>{let e=[],t=document.activeElement;for(;t&&t!==document.body;)t instanceof HTMLElement&&e.push(t),t=t.shadowRoot?.activeElement??null;return e},AI=(e,t)=>{for(let{element:n,frozenStyles:r,originalPropertyValues:i}of e)t.set(n,i),n.style.cssText=r},jI=(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()},MI=(e,t)=>{if(bF())return null;let n=[],r=e!==void 0&&t!==void 0&&e>=0&&t>=0&&e<window.innerWidth&&t<window.innerHeight?OI(e,t):Array.from(document.querySelectorAll(`:hover`)).filter(e=>e instanceof HTMLElement);for(let e of r){let t=DI(e,bI);t&&n.push(t)}let i=[];for(let e of kI()){let t=DI(e,xI,CI);t&&i.push(t)}return{hoverStates:n,focusStates:i}},NI=e=>{if(e){for(let e of vI)document.addEventListener(e,wI,!0);for(let e of yI)document.addEventListener(e,TI,!0);AI(e.hoverStates,SI),AI(e.focusStates,CI),xF()}},PI=()=>{PF();for(let e of vI)document.removeEventListener(e,wI,!0);for(let e of yI)document.removeEventListener(e,TI,!0);jI(SI,bI),jI(CI,xI),SF()},FI=(e,t)=>{let n=MI(e,t),r=hI();NI(n),gI(r)},II=()=>{PI(),_I()},LI=!1,RI=(e,t,n)=>{let r=e.get(t);if(r)return r;let i=n();return e.set(t,i),i},zI=new WeakMap,BI=new WeakMap,VI=new WeakMap,HI=new Set,UI=[],WI=[],GI=new WeakMap,KI=new WeakMap,qI=new WeakSet,JI=pN,YI=e=>{let t=e;for(;t.return;)t=t.return;return t.stateNode??null},XI=()=>{if(JI.size>0)return JI;let e=new Set,t=n=>{let r=fN(n);if(r){let t=YI(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},ZI=(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},QI=e=>{if(!e||GI.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=()=>LI?t.snapshotValueAtPause:t.originalGetSnapshot());let n=t.pendingValueAtPause;Object.defineProperty(e,"pending",{configurable:!0,enumerable:!0,get:()=>LI?null:n,set:e=>{if(LI){e!==null&&(t.bufferedPending=ZI(t.bufferedPending??null,e));return}n=e}}),GI.set(e,t)},$I=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},eL=e=>{let t=GI.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=$I(t.pendingValueAtPause??null),r=$I(t.bufferedPending??null);for(let t of[...e,...r])WI.push(()=>n(t))}GI.delete(e)},tL=e=>{if(KI.has(e))return;let t={originalDescriptor:Object.getOwnPropertyDescriptor(e,`memoizedValue`),frozenValue:e.memoizedValue};Object.defineProperty(e,"memoizedValue",{configurable:!0,enumerable:!0,get(){return LI?t.frozenValue:t.originalDescriptor?.get?t.originalDescriptor.get.call(this):this._memoizedValue},set(e){if(LI){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),KI.set(e,t)},nL=e=>{let t=KI.get(e);t&&(t.originalDescriptor?Object.defineProperty(e,"memoizedValue",t.originalDescriptor):delete e.memoizedValue,t.didReceivePendingValue&&(e.memoizedValue=t.pendingValue),KI.delete(e))},rL=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&QI(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)tL(n),n=n.next},iL=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&eL(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)nL(n),n=n.next},aL=e=>{let t=e;for(;t;){if(oN(t)&&rL(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}},oL=e=>{let t=e;for(;t;){if(oN(t)&&iL(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}},sL=e=>{if(zI.has(e))return;let t=e,n={useState:t.useState,useReducer:t.useReducer,useTransition:t.useTransition,useSyncExternalStore:t.useSyncExternalStore};zI.set(e,n),t.useState=(...t)=>{let r=n.useState.apply(e,t);if(!LI||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,RI(BI,a,()=>(...e)=>{LI?WI.push(()=>a(...e)):a(...e)})]},t.useReducer=(...t)=>{let r=n.useReducer.apply(e,t);if(!LI||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,RI(BI,a,()=>(...e)=>{LI?WI.push(()=>a(...e)):a(...e)})]},t.useTransition=(...t)=>{let r=n.useTransition.apply(e,t);if(!LI||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,RI(VI,a,()=>e=>{LI?UI.push(()=>a(e)):a(e)})]},t.useSyncExternalStore=((e,t,r)=>LI?n.useSyncExternalStore(t=>e(()=>{LI?HI.add(t):t()}),t,r):n.useSyncExternalStore(e,t,r))},cL=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`&&sL(r),r),set:e=>{r=e}})},lL=e=>{queueMicrotask(()=>{try{for(let t of rN().renderers.values())if(typeof t.scheduleUpdate==`function`){for(let n of e)if(n.current)try{t.scheduleUpdate(n.current)}catch{}}}catch{}})},uL=e=>{for(let t of e)try{t()}catch{}},dL=()=>{for(let e of rN().renderers.values())qI.has(e)||(cL(e),qI.add(e))},fL=()=>{if(LI)return()=>{};dL(),LI=!0;let e=XI();for(let t of e)aL(t.current);return()=>{if(LI)try{let e=XI();for(let t of e)oL(t.current);let t=Array.from(HI),n=UI.slice(),r=WI.slice();LI=!1,uL(t),uL(n),uL(r),lL(e)}finally{HI.clear(),UI.length=0,WI.length=0}}}}));function mL(e){let t=String(e),n=t.length-1;return MR.context.id+(n?String.fromCharCode(96+n):``)+t}function hL(e){MR.context=e}function gL(e,t){let n=HR,r=VR,i=e.length===0,a=t===void 0?r:t,o=i?zR:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>CL(()=>WL(o)));VR=o,HR=null;try{return RL(s,!0)}finally{HR=n,VR=r}}function q(e,t){t=t?Object.assign({},LR,t):LR;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[ML.bind(n),e=>(typeof e==`function`&&(e=$&&$.running&&$.sources.has(n)?e(n.tValue):e(n.value)),NL(n,e))]}function _L(e,t,n){PL(IL(e,t,!0,1))}function vL(e,t,n){PL(IL(e,t,!1,1))}function yL(e,t,n){RR=VL;let r=IL(e,t,!1,1),i=JR&&AL(JR);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),WR?WR.push(r):PL(r)}function J(e,t,n){n=n?Object.assign({},LR,n):LR;let r=IL(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,PL(r),ML.bind(r)}function bL(e){return e&&typeof e==`object`&&`then`in e}function xL(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=BR,c=null,l=!1,u=!1,d=`initialValue`in a,f=typeof r==`function`&&J(r),p=new Set,[m,h]=(a.storage||q)(a.initialValue),[g,_]=q(void 0),[v,y]=q(void 0,{equals:!1}),[b,x]=q(d?`ready`:`unresolved`);MR.context&&(c=MR.getNextContextId(),a.ssrLoadFrom===`initial`?s=a.initialValue:MR.load&&MR.has(c)&&(s=MR.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=BR,$&&e&&l?($.promises.delete(e),l=!1,RL(()=>{$.running=!0,ee(t,n)},!1)):ee(t,n)),t}function ee(e,t){RL(()=>{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 C(){let e=JR&&AL(JR),t=m(),n=g();if(n!==void 0&&!o)throw n;return HR&&!HR.user&&e&&_L(()=>{v(),o&&(e.resolved&&$&&l?$.promises.add(o):p.has(e)||(e.increment(),p.add(e)))}),t}function w(e=!0){if(e!==!1&&u)return;u=!1;let t=f?f():r;if(l=$&&$.running,t==null||t===!1){S(o,CL(m));return}$&&o&&$.promises.delete(o);let n,a=s===BR?CL(()=>{try{return i(t,{value:m(),refetching:e})}catch(e){n=e}}):s;if(n!==void 0){S(o,void 0,KL(n),t);return}else if(!bL(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,KL(a.v),t),a):(u=!0,queueMicrotask(()=>u=!1),RL(()=>{x(d?`refreshing`:`pending`),y()},!1),a.then(e=>S(a,e,void 0,t),e=>S(a,void 0,KL(e),t)))}Object.defineProperties(C,{state:{get:()=>b()},error:{get:()=>g()},loading:{get(){let e=b();return e===`pending`||e===`refreshing`}},latest:{get(){if(!d)return C();let e=g();if(e&&!o)throw e;return m()}}});let T=VR;return f?_L(()=>(T=VR,w(!1))):w(!1),[C,{refetch:e=>OL(T,()=>w(e)),mutate:h}]}function SL(e){return RL(e,!1)}function CL(e){if(HR===null)return e();let t=HR;HR=null;try{return e()}finally{HR=t}}function wL(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=CL(()=>t(o,i,n));return i=o,s}}function TL(e){yL(()=>CL(e))}function EL(e){return VR===null||(VR.cleanups===null?VR.cleanups=[e]:VR.cleanups.push(e)),e}function DL(){return HR}function OL(e,t){let n=VR,r=HR;VR=e,HR=null;try{return RL(t,!0)}catch(e){qL(e)}finally{VR=n,HR=r}}function kL(e,t){let n=Symbol(`context`);return{id:n,Provider:YL(n),defaultValue:e}}function AL(e){let t;return VR&&VR.context&&(t=VR.context[e.id])!==void 0?t:e.defaultValue}function jL(e){let t=J(e),n=J(()=>JL(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}function ML(){let e=$&&$.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===1)PL(this);else{let e=UR;UR=null,RL(()=>HL(this),!1),UR=e}if(HR){let e=this.observers?this.observers.length:0;HR.sources?(HR.sources.push(this),HR.sourceSlots.push(e)):(HR.sources=[this],HR.sourceSlots=[e]),this.observers?(this.observers.push(HR),this.observerSlots.push(HR.sources.length-1)):(this.observers=[HR],this.observerSlots=[HR.sources.length-1])}return e&&$.sources.has(this)?this.tValue:this.value}function NL(e,t,n){let r=$&&$.running&&$.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if($){let r=$.running;(r||!n&&$.sources.has(e))&&($.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&RL(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=$&&$.running;r&&$.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?UR.push(n):WR.push(n),n.observers&&UL(n)),r?n.tState=1:n.state=1)}if(UR.length>1e6)throw UR=[],Error()},!1)}return t}function PL(e){if(!e.fn)return;WL(e);let t=GR;FL(e,$&&$.running&&$.sources.has(e)?e.tValue:e.value,t),$&&!$.running&&$.sources.has(e)&&queueMicrotask(()=>{RL(()=>{$&&($.running=!0),HR=VR=e,FL(e,e.tValue,t),HR=VR=null},!1)})}function FL(e,t,n){let r,i=VR,a=HR;HR=VR=e;try{r=e.fn(t)}catch(t){return e.pure&&($&&$.running?(e.tState=1,e.tOwned&&e.tOwned.forEach(WL),e.tOwned=void 0):(e.state=1,e.owned&&e.owned.forEach(WL),e.owned=null)),e.updatedAt=n+1,qL(t)}finally{HR=a,VR=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?NL(e,r,!0):$&&$.running&&e.pure?($.sources.has(e)||(e.value=r),$.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function IL(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:VR,context:VR?VR.context:null,pure:n};return $&&$.running&&(a.state=0,a.tState=r),VR===null||VR!==zR&&($&&$.running&&VR.pure?VR.tOwned?VR.tOwned.push(a):VR.tOwned=[a]:VR.owned?VR.owned.push(a):VR.owned=[a]),a}function LL(e){let t=$&&$.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===2)return HL(e);if(e.suspense&&CL(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<GR);){if(t&&$.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($.disposed.has(t))return}if((t?e.tState:e.state)===1)PL(e);else if((t?e.tState:e.state)===2){let t=UR;UR=null,RL(()=>HL(e,n[0]),!1),UR=t}}}function RL(e,t){if(UR)return e();let n=!1;t||(UR=[]),WR?n=!0:WR=[],GR++;try{let t=e();return zL(n),t}catch(e){n||(WR=null),UR=null,qL(e)}}function zL(e){if(UR&&=(BL(UR),null),e)return;let t;if($){if(!$.promises.size&&!$.queue.size){let e=$.sources,n=$.disposed;WR.push.apply(WR,$.effects),t=$.resolve;for(let e of WR)`tState`in e&&(e.state=e.tState),delete e.tState;$=null,RL(()=>{for(let e of n)WL(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)WL(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}qR(!1)},!1)}else if($.running){$.running=!1,$.effects.push.apply($.effects,WR),WR=null,qR(!0);return}}let n=WR;WR=null,n.length&&RL(()=>RR(n),!1),t&&t()}function BL(e){for(let t=0;t<e.length;t++)LL(e[t])}function VL(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:LL(r)}if(MR.context){if(MR.count){MR.effects||=[],MR.effects.push(...e.slice(0,n));return}hL()}for(MR.effects&&(MR.done||!MR.count)&&(e=[...MR.effects,...e],n+=MR.effects.length,delete MR.effects),t=0;t<n;t++)LL(e[t])}function HL(e,t){let n=$&&$.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<GR)&&LL(i):e===2&&HL(i,t)}}}function UL(e){let t=$&&$.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?UR.push(r):WR.push(r),r.observers&&UL(r))}}function WL(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--)WL(e.tOwned[t]);delete e.tOwned}if($&&$.running&&e.pure)GL(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)WL(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}$&&$.running?e.tState=0:e.state=0}function GL(e,t){if(t||(e.tState=0,$.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)GL(e.owned[t])}function KL(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function qL(e,t=VR){throw KL(e)}function JL(e){if(typeof e==`function`&&!e.length)return JL(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=JL(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function YL(e,t){return function(t){let n;return vL(()=>n=CL(()=>(VR.context={...VR.context,[e]:t.value},jL(()=>t.children))),void 0),n}}function XL(e){for(let t=0;t<e.length;t++)e[t]()}function ZL(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return EL(()=>XL(a)),()=>{let c=e()||[],l=c.length,u,d;return c[IR],CL(()=>{let e,t,p,m,h,g,_,v,y;if(l===0)o!==0&&(XL(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[YR],i[0]=gL(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]=gL(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]=gL(f);i=i.slice(0,o=l),r=c.slice(0)}return i});function f(e){if(a[d]=e,s){let[e,n]=q(d);return s[d]=n,t(c[d],e)}return t(c[d])}}}function QL(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return EL(()=>XL(a)),()=>{let l=e()||[],u=l.length;return l[IR],CL(()=>{if(u===0)return s!==0&&(XL(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[YR],i[0]=gL(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===YR&&(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]=gL(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]=q(l[c]);return o[c]=r,t(n,c)}}}function Y(e,t){return CL(()=>e(t||{}))}function $L(){return!0}function eR(e){return(e=typeof e==`function`?e():e)?e:{}}function tR(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function nR(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&PR in r,e[n]=typeof r==`function`?(t=!0,J(r)):r}if(FR&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=eR(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in eR(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(eR(e[n])));return[...new Set(t)]}},XR);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:tR.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 rR(e,...t){let n=t.length;if(FR&&PR 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)}},XR));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))}},XR)),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 iR(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return J(ZL(()=>e.each,e.children,t||void 0))}function aR(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return J(QL(()=>e.each,e.children,t||void 0))}function oR(e){let t=e.keyed,n=J(()=>e.when,void 0,void 0),r=t?n:J(n,void 0,{equals:(e,t)=>!e==!t});return J(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?CL(()=>a(t?i:()=>{if(!CL(r))throw ZR(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function sR(e){let t=jL(()=>e.children),n=J(()=>{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=J(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:J(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return J(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?CL(()=>o(a.keyed?i():()=>{if(CL(n)()?.[0]!==r)throw ZR(`Match`);return i()})):o},void 0,void 0)}function cR(e){return e}function lR(e,t){let n=tz[e];return typeof n==`object`?n[t]?n.$:void 0:n}function uR(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 dR(e,t,n,r={}){let i;return gL(r=>{i=r,t===document?e():Q(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function X(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?()=>CL(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function fR(e,t=window.document){let n=t[az]||(t[az]=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,DR))}}function Z(e,t,n){CR(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function pR(e,t,n,r){CR(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function mR(e,t,n){CR(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function hR(e,t){CR(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function gR(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 _R(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]||(TR(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||(TR(e,i,!0),n[i]=o)}return n}function vR(e,t,n){if(!t)return n?Z(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 yR(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function bR(e,t={},n,r){let i={};return r||vL(()=>i.children=OR(e,t.children,i.children)),vL(()=>typeof t.ref==`function`&&xR(t.ref,e)),vL(()=>SR(e,t,n,!0,i,!0)),i}function xR(e,t,n){return CL(()=>e(t,n))}function Q(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return OR(e,t,r,n);vL(r=>OR(e,t(),r,n),r)}function SR(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=ER(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||OR(e,t.children);continue}let s=t[o];i[o]=ER(e,o,s,i[o],n,a,t)}}function CR(e){return!!MR.context&&!MR.done&&(!e||e.isConnected)}function wR(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function TR(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 ER(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return vR(e,n,r);if(t===`classList`)return _R(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=nz.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(gR(e,i,n,a),a&&fR([i]))}else if(t.slice(0,5)===`attr:`)Z(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)mR(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=$R.has(t))||!i&&((u=lR(t,e.tagName))||(c=QR.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(CR(e))return n;t===`class`||t===`className`?hR(e,n):s&&!c&&!l?e[wR(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&rz[t.split(`:`)[0]];r?pR(e,r,t,n):Z(e,ez[t]||t,n)}return n}function DR(e){if(MR.registry&&MR.events&&MR.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}}),MR.registry&&!MR.done&&(MR.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 OR(e,t,n,r,i){let a=CR(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=jR(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=jR(e,n,r)}else if(o===`function`)return vL(()=>{let i=t();for(;typeof i==`function`;)i=i();n=OR(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(kR(o,t,n,i))return vL(()=>n=OR(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=jR(e,n,r),s)return n}else c?n.length===0?AR(e,o,r):uR(e,n,o):(n&&jR(e),AR(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=jR(e,n,r,t);jR(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function kR(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=kR(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=kR(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 AR(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function jR(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 MR,NR,PR,FR,IR,LR,RR,zR,BR,VR,$,HR,UR,WR,GR,KR,qR,JR,YR,XR,ZR,QR,$R,ez,tz,nz,rz,iz,az,oz,sz,cz,lz,uz,dz,fz,pz,mz,hz,gz,_z,vz,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=t((()=>{pL(),MR={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return mL(this.context.count)},getNextContextId(){return mL(this.context.count++)}},NR=(e,t)=>e===t,PR=Symbol(`solid-proxy`),FR=typeof Proxy==`function`,IR=Symbol(`solid-track`),LR={equals:NR},RR=BL,zR={owned:null,cleanups:null,context:null,owner:null},BR={},VR=null,$=null,HR=null,UR=null,WR=null,GR=0,[KR,qR]=q(!1),YR=Symbol(`fallback`),XR={get(e,t,n){return t===PR?n:e.get(t)},has(e,t){return t===PR||e.has(t)},set:$L,deleteProperty:$L,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:$L,deleteProperty:$L}},ownKeys(e){return e.keys()}},ZR=e=>`Stale read from <${e}>.`,QR=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(`.`)]),$R=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),ez=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),tz=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}}),nz=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),rz={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},iz=e=>J(()=>e()),az=`_$DX_DELEGATE`,oz=e=>!!(e?.isConnected??e?.ownerDocument?.contains(e)),sz=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`,`combobox`],cz=e=>{if(e.composed){let t=e.composedPath()[0];if(t instanceof HTMLElement)return t}else if(e.target instanceof HTMLElement)return e.target},lz=e=>{if(document.designMode===`on`)return!0;let t=cz(e);if(!t)return!1;if(t.isContentEditable)return!0;let n=RM(t);return sz.some(e=>e===n||e===t.role)},uz=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},dz=()=>{let e=window.getSelection();return e?e.toString().length>0:!1},fz=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/,pz=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`),mz=(e,t,n,r=1)=>{let i=pz(e),a=pz(t),o=pz(n);return r>=1?`#${i}${a}${o}`:`#${i}${a}${o}${pz(r*255)}`},hz=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}},gz=e=>{let t=e.match(fz);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 mz(Number(t[1]),Number(t[2]),Number(t[3]),n)},_z=e=>{let t=e.match(fz);return!t||t[4]===void 0?!1:(t[4].endsWith(`%`)?Number(t[4].slice(0,-1))/100:Number(t[4]))===0},vz=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,yz=e=>{let t=e.match(vz);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}`},bz=`rgba(0, 0, 0, 0)`,xz=/^oklch\(\s*([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+)(deg|grad|rad|turn)?(?:\s*\/\s*([+-]?\d*\.?\d+%?))?\s*\)$/i,Sz=180/Math.PI,Cz=(e,t)=>e.endsWith(`%`)?Number(e.slice(0,-1))/100*t:Number(e),wz=(e,t)=>{let n=Number(e);return t===`grad`?n*.9:t===`rad`?n*Sz:t===`turn`?n*360:n},Tz=e=>{let t=Math.max(0,Math.min(1,e));return(t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055)*255},Ez=e=>{let t=e.match(xz);if(!t)return null;let n=Cz(t[1],1),r=Cz(t[2],.4),i=wz(t[3],t[4])*Math.PI/180,a=t[5]===void 0?1:Cz(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 mz(Tz(m),Tz(h),Tz(g),Math.max(0,Math.min(1,a)))},Dz=null,Oz=()=>Dz||(typeof document>`u`?null:(Dz=document.createElement(`canvas`).getContext(`2d`,{willReadFrequently:!0}),Dz)),kz=(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?EM:mz(n[0],n[1],n[2],n[3]/255)},Az=e=>{let t=e.trim();if(!t)return null;if(t.toLowerCase()===`transparent`)return EM;let n=yz(t);if(n)return n;let r=Ez(t);if(r)return r;let i=Oz();if(!i)return null;i.fillStyle=bz,i.fillStyle=t;let a=i.fillStyle;return typeof a==`string`?a.toLowerCase()===bz?t.toLowerCase().replace(/\s+/g,``)===`rgba(0,0,0,0)`?EM:null:a.startsWith(`#`)&&a.length===7?a:a.startsWith(`rgb`)?gz(a):kz(i,t):null},jz=(e,t,n)=>Math.max(t,Math.min(e,n)),Mz=null,Nz=()=>{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},Pz=()=>{if(Mz===null){if(typeof navigator>`u`)return Mz=!1,Mz;let e=navigator.platform??Nz()??navigator.userAgent;Mz=/Mac|iPhone|iPad|iPod/i.test(e)}return Mz},Fz=(e,t)=>{try{return e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute(t))}catch{return!1}},Iz=`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(`.`),Lz=-128,Rz=-512,zz=-9999,Bz=9999,Vz=new Set([`letter-spacing`,`gap`,`row-gap`,`column-gap`]),Hz=new Set([`z-index`]),Uz=[{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`]}],Wz=[{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`]}],Gz=[{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`]}],Kz=[{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`]}],qz=[{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`]}],Jz=new Set(qz.map(e=>e.key)),Yz=[Uz,Wz,Gz,Kz,[{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`]}],qz],Xz=[{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`}],Zz=[{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`}],Qz=[{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`}],$z=e=>{let t=e.trim();return Qz.some(e=>e.value===t)?Qz:[{value:t,label:`current`},...Qz]},eB={key:`font-family`,label:`font family`},tB=[{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`}]}],nB=[...Iz,`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`],rB=e=>Number.isInteger(e)?e:Math.round(e*100)/100,iB=e=>Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,``),aB=e=>Number.isFinite(e)?iB(rB(e)):String(e),oB=e=>Math.round(e),sB=(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===`%`?iB(rB(n/100)):`${iB(rB(n))}${e.unit}`},cB={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`}},lB={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`},uB={"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`]},dB=(()=>{let e={};for(let[t,n]of Object.entries(lB))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(uB)){let r=new Set([...t[e]??[],...n]);t[e]=Array.from(r)}return t})(),fB={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`},pB=e=>lB[e]!==void 0||fB[e]!==void 0,mB=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},hB=e=>{let t=mB(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(pB(t))return t}return r[0]},gB=/-(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/,_B=(e,t)=>e!==`text`&&e!==`bg`&&e!==`border`&&!e.startsWith(`border-`)?!1:gB.test(t),vB=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(`.`)),yB=new Set([`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`,`9xl`]),bB=/^(#|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color:|color\(|var\(--.*color)/,xB=/^(-?\d|length:|size:)/,SB=e=>e.trim().toLowerCase().replace(/\s+/g,`-`).replace(/([a-z])(\d)/g,`$1-$2`),CB=e=>bB.test(e)&&!xB.test(e),wB=(e,t)=>{if(e===t)return``;let n=`${t}-`;return e.startsWith(n)?e.slice(n.length):null},TB=e=>{let t=mB(SB(e)),n=hB(t);if(!n)return null;let r=fB[n];if(!r)return null;let i=t.indexOf(`[`);if(i>=0)return CB(t.slice(i+1).replace(/\]$/,``))?r:null;let a=wB(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`&&yB.has(o)?null:vB.has(o)?r:null},EB={black:`#000000`,white:`#ffffff`,transparent:EM},DB=e=>{let t=mB(SB(e)),n=hB(t);if(!n||fB[n]===void 0||t.includes(`[`))return null;let r=wB(t,n);if(!r)return null;let i=EB[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 cB[s]?.[c]??null},OB=/^-?\d/,kB=(e,t)=>{if(t===``||t.startsWith(`[`)||OB.test(t))return!0;let n=t.split(`-`)[0];return e===`text`?yB.has(n):e===`font`||e===`border`||e.startsWith(`border-`)?!1:(e===`rounded`||e.startsWith(`rounded-`),!0)},AB={"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`}},jB=e=>{let t=SB(e);if(!t)return[];let n=IB(t);if(n)return[n.property];let r=TB(t);return r?[r]:[]},MB=e=>{let t=SB(e);if(!t)return[];let n=hB(t);if(!n)return[];let r=wB(mB(t),n);if(r===null||!kB(n,r))return[];let i=FB(n);return i?[i]:[]},NB=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=hB(e);if(!t||_B(t,e))continue;let n=IB(e);if(n){r.add(n.property);continue}let i=FB(t);i&&r.add(i)}return r},PB=e=>dB[e]??[],FB=e=>{let t=lB[e];return t===void 0?null:t},IB=e=>{let t=AB[mB(e)];return t===void 0?null:t},LB=`react-grab-toolbar-state`,RB=()=>{try{let e=localStorage.getItem(LB);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:gM,collapsed:r,enabled:!r,defaultAction:typeof n.defaultAction==`string`?n.defaultAction:_M}}catch(e){console.warn(`[react-grab] Failed to load toolbar state from localStorage:`,e)}return null},zB=e=>{try{localStorage.setItem(LB,JSON.stringify(e))}catch(e){console.warn(`[react-grab] Failed to save toolbar state to localStorage:`,e)}},BB=e=>{let[t,n]=q(!1);return TL(()=>{let t=zj(t=>n(e(t))),r=()=>n(!1);window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,t,{capture:!0}),window.addEventListener(`blur`,r),EL(()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,t,{capture:!0}),window.removeEventListener(`blur`,r)})}),t},VB=e=>e.key===`Enter`,HB=e=>e.metaKey||e.ctrlKey,UB=(e,t,n={})=>{if(!t.key)return null;if(VB(t))return e.find(e=>e.shortcut===`Enter`)??null;if(t.repeat)return null;let r=t.key.toLowerCase();return HB(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},WB=()=>{let e=!1;return{arm:()=>{e=!0},clear:()=>{e=!1},consume:()=>e?(e=!1,!0):!1}}})),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,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=t((()=>{pL(),KB=class extends Error{constructor(e){super(e),this.name=`ReactGrabError`}},qB=class extends KB{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},JB=class extends KB{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},YB=class extends KB{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},XB=class extends KB{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}},ZB=e=>e===void 0||!Number.isFinite(e)?3:Math.max(0,Math.floor(e)),QB=e=>{try{return decodeURIComponent(e)}catch{return e}},$B=/(?:^|[/\\])node_modules[/\\]/,eV=/[/\\]\.vite[/\\]deps[^/\\]*[/\\]/,tV=/\.[mc]?[jt]sx?$/i,nV=/^chunk-[A-Za-z0-9_-]+$/,rV=/[/\\]/,iV=/^(.+?)@v?\d/,aV=e=>e.split(rV).filter(Boolean),oV=e=>{let[t,n]=aV(e);return!t||t.startsWith(`.`)?null:t.startsWith(`@`)?n?`${t}/${n}`:null:t},sV=e=>{let t=aV(e)[0];if(!t)return null;let n=t.replace(tV,``);if(nV.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)}`},cV=(e,t,n)=>{let r=e.split(t);return r.length>1?n(r[r.length-1]):null},lV=e=>e?.match(iV)?.[1]??null,uV=e=>{let t;try{t=new URL(e)}catch{return null}if(!t.hostname)return null;let n=aV(t.pathname).map(QB);for(let[e,t]of n.entries()){if(t.startsWith(`@`)){let r=lV(n[e+1]);if(r)return`${t}/${r}`;continue}let r=lV(t);if(r)return r}return null},dV=e=>cV(e,eV,sV)??cV(e,$B,oV),fV=e=>{if(!e)return null;let t=hP(e);return t&&(dV(QB(t))||uV(e))||null},pV=/^@[A-Za-z0-9][A-Za-z0-9._-]*$/,mV=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,hV=new Set([`app`,`web`,`website`,`frontend`,`client`,`src`]),gV=new Set([`app`,`src`,`components`,`pages`,`features`,`modules`,`hooks`,`lib`,`utils`,`ui`,`shared`,`common`,`core`,`styles`,`assets`]),_V=e=>{let t=e;for(;t.startsWith(`../`)||t.startsWith(`./`);)t=t.slice(t.startsWith(`../`)?3:2);return t},vV=e=>{let t=_V(QB(hP(e)));if(t.startsWith(`/`))return null;let[n,r,...i]=aV(t);return!n||!r||i.length===0||!pV.test(n)||gV.has(n.slice(1))||!mV.test(r)||tV.test(r)||hV.has(r)?null:`${n}/${r}`},yV=e=>e?fV(e)??vV(e):null,bV=e=>{if(!e)return{origin:`unknown`,packageName:null};let t=yV(e);return t?{origin:`package`,packageName:t}:gP(e)?{origin:`app`,packageName:null}:{origin:`unknown`,packageName:null}},xV=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),SV=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},CV=(e,t)=>{let n=xV.has(e)||e.startsWith(`data-`)&&SV(e),r=SV(t)&&t.length<100||t.startsWith(`#`)&&SV(t.slice(1));return n&&r},wV=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},TV=e=>{let t=0;for(let n of e)t+=n.penalty;return t},EV=(e,t)=>TV(e)-TV(t),DV=(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},OV=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,kV=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,AV=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&SV(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)SV(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=DV(e,i);a!==void 0&&n.push({name:kV(i,a),penalty:10});let o=DV(e);return o!==void 0&&n.push({name:OV(i,o),penalty:50}),n},jV=(e,t=Yj,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(...jV(e.slice(1),a,[...n,i]))}return r},MV=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e instanceof Document?e:e.ownerDocument},NV=(e,t)=>t.querySelectorAll(wV(e)).length===1,PV=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=DV(n,e);if(t===void 0)return;r.push({name:kV(e,t),penalty:10}),n=n.parentElement}return NV(r,t)?r:void 0},FV=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new qB;if(e.tagName.toLowerCase()===`html`)return`html`;let i=MV(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(AV(s,r)),s=s.parentElement,c++,c>=3){let t=jV(o);t.sort(EV);for(let r of t){if(Date.now()-a>n){let t=PV(e,i);if(!t)throw new JB(n);return wV(t)}if(NV(r,i)){l=r;break}}}if(!l&&c<3){let e=jV(o);e.sort(EV);for(let t of e){if(Date.now()-a>n)break;if(NV(t,i)){l=t;break}}}if(!l)throw new YB;return wV(l)},IV=e=>e.ownerDocument.body??e.ownerDocument.documentElement,LV=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),RV=e=>e.length>0&&e.length<=120,zV=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},BV=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${CSS.escape(e.id)}`;if(zV(e,t))return t}for(let t of LV){let n=e.getAttribute(t);if(!n||!RV(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(zV(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(zV(e,i))return i}return null},VV=e=>{let t=[],n=IV(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(` > `)},HV=e=>{let t=BV(e);if(t)return t;try{let t=FV(e,IV(e),200,(e,t)=>CV(e,t)||LV.has(e)&&RV(t));if(t)return t}catch{}return VV(e)},UV=e=>{if(!e)return!1;let t=`/${JP(e)}/`.toLowerCase();return Kj.some(e=>t.includes(e))},WV=e=>e.map(e=>`\n in ${e}`).join(``),GV=[`about://React/`,`rsc://React/`],KV=e=>GV.some(t=>e.startsWith(t)),qV=e=>{for(let t of GV){if(!e.startsWith(t))continue;let n=e.indexOf(`/`,t.length);if(n===-1)continue;let r=n+1,i=e.lastIndexOf(`?`);return QB(i>r?e.slice(r,i):e.slice(r))}return e},JV=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}},YV=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:qV(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(),qj),o=()=>i.abort();t?.aborted&&i.abort(),t?.addEventListener(`abort`,o);try{let t=await fetch(`${QP()}/__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=JV(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)}},XV=e=>{let t=new Map;return Tj(e,e=>{if(!JN(e))return!1;let n=rP(e._debugStack.stack);if(!n)return!1;for(let e of wN(n))!e.functionName||!e.fileName||KV(e.fileName)&&(t.has(e.functionName)||t.set(e.functionName,{...e,isServer:!0}));return!1},!0),t},ZV=(e,t)=>{if(!t.some(e=>e.isServer&&!e.fileName&&e.functionName))return t;let n=XV(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})},QV=0,$V=[],eH=()=>QV<3?(QV+=1,Promise.resolve()):new Promise(e=>{$V.push(e)}),tH=()=>{let e=$V.shift();if(e){e();return}--QV},nH=async(e,t,n=Jj)=>{await eH();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),tH()}},rH=(e,t)=>e.length>t?`${e.slice(0,t)}...`:e,iH=e=>e.startsWith(`data-react-grab-`),aH=e=>e.replace(/\s+/g,` `).trim(),oH=e=>{let t=[];for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE)continue;let e=aH(n.textContent??``);e&&t.push(e)}return t.join(` `)},sH=e=>e.getAttribute(`aria-hidden`)===`true`||e.hasAttribute(`hidden`)?!0:uM.has(e.tagName.toLowerCase()),cH=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=aH(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!(e instanceof Element)||sH(e))return n;for(let r of e.childNodes)if(n=cH(r,t,n),n<=0)break;return n},lH=(e,t)=>{if(sH(e))return``;let n=oH(e);if(!lM.has(t)||n&&e.children.length===0)return n;let r=[];return cH(e,r,100),r.join(` `)},uH=e=>rH(e,15),dH=e=>{let t=[];for(let n of sM){let r=e.getAttribute(n);r&&t.push(`${n}="${r}"`)}return t.length>0?` ${t.join(` `)}`:``},fH=e=>e===`class`||e===`className`||e===`style`,pH=e=>{let t=[],n=[],r=``;for(let{name:i,value:a}of e.attributes)if(!iH(i)){if(fH(i)){i!==`style`&&a&&(r=` class="${uH(a)}"`);continue}cM.has(i)?t.push(a?` ${i}="${a}"`:` ${i}`):a&&n.push(` ${i}="${uH(a)}"`)}return t.join(``)+n.join(``)+r},mH=e=>e.length===0?``:e.length<=2?e.map(e=>`<${RM(e)} ...>`).join(`
|
|
196
|
+
`):`(${e.length} elements)`,hH=e=>{let t=RM(e);if(!(e instanceof HTMLElement))return`<${t}${dH(e)} />`;let n=pH(e),r=rH(lH(e,t),100);return r?`<${t}${n}>${r}</${t}>`:`<${t}${n} />`},gH=e=>{let t=RM(e),n=pH(e),r=lH(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&&lM.has(t),c=``,l=mH(i);l&&!s&&(c+=`\n ${l}`),r&&(c+=`\n ${rH(r,100)}`);let u=mH(a);return u&&!s&&(c+=`\n ${u}`),c.length>0?`<${t}${n}>${c}\n</${t}>`:`<${t}${n} />`},_H=new Set([`_`,`$`,`motion.`,`styled.`,`chakra.`,`ark.`,`Primitive.`,`Slot.`]),vH=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(`.`)),yH=new Set([`Suspense`,`Fragment`,`StrictMode`,`Profiler`,`SuspenseList`]),bH=new Set([`MotionDOMComponent`]),xH=e=>{if(vH.has(e)||yH.has(e)||bH.has(e))return!0;for(let t of _H)if(e.startsWith(t))return!0;return!1},SH=e=>!(!e||xH(e)||e===`SlotClone`||e===`Slot`),CH=e=>!(e.length<=1||xH(e)||e[0]!==e[0].toUpperCase()||e.endsWith(`Provider`)||e.endsWith(`Context`)),wH=e=>e&&CH(e)?e:null,TH=e=>{if(!dN())return e;let t=e;for(;t;){if(fN(t))return t;t=t.parentElement}return e},EH=e=>{if(!dN())return null;let t=fN(TH(e)),n=0;for(;t;){if(t.key)return t.key;if(oN(t)&&(n+=1,n===2))break;t=t.return}return null},DH=new WeakMap,OH=new WeakMap,kH=e=>t=>fetch(t,{signal:e,priority:`high`}),AH=e=>nH(async t=>{try{let n=fN(e);if(!n)return null;let r=await lP(n,!0,kH(t));return XP()?await YV(ZV(n,r),t):r}catch{return null}},null),jH=e=>{if(!dN())return Promise.resolve([]);let t=TH(e),n=DH.get(t);if(n)return n;let r=AH(t).then(e=>(e===null&&DH.delete(t),e));return DH.set(t,r),r},MH=async e=>{if(!dN())return null;let t=await jH(e);if(!t)return null;for(let e of t){let t=wH(e.functionName);if(t)return t}return null},NH=e=>e.find(e=>!!wH(e.functionName))??e[0]??null,PH=e=>!e||!oN(e)?null:wH(uN(e.type)),FH=e=>nH(async t=>{let n=fN(TH(e));if(!n)return null;try{let e=await dP(n,!0,kH(t));return e?.fileName?{filePath:JP(e.fileName),lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:wH(e.functionName)??PH(n._debugOwner),origin:bV(e.fileName).origin}:null}catch{return null}},null),IH=e=>{let t=TH(e),n=OH.get(t);if(n)return n;let r=FH(t).then(e=>(e||OH.delete(t),e));return OH.set(t,r),r},LH=[`app`,`package`],RH=(e,t)=>{for(let n of LH){if(e?.origin===n)return e;let r=NH(t.filter(e=>bV(e.fileName).origin===n));if(r?.fileName)return{filePath:JP(r.fileName),lineNumber:r.lineNumber??null,columnNumber:r.columnNumber??null,componentName:wH(r.functionName),origin:n}}return null},zH=async e=>{let t=await IH(e);return t?.origin===`app`?t:RH(t,await jH(e)??[])},BH=e=>VH(TH(e),1)[0]??null,VH=(e,t,n=()=>!0)=>{if(!dN())return[];let r=fN(e);if(!r)return[];let i=[];return Tj(r,e=>{if(i.length>=t)return!0;if(oN(e)){let t=uN(e.type);t&&SH(t)&&n(t)&&i.push(t)}return!1},!0),i},HH=[`/src/app/`,`/src/pages/`,`/app/`,`/pages/`],UH=(e,t)=>{let n=JP(e);if(!t||!n.startsWith(`/`))return n;for(let e of HH){let t=n.indexOf(e);if(t!==-1)return`/./${n.slice(t+1)}`}return n},WH=(e,t)=>{let n=UH(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}`},GH={isAppSource:!1,consumesBudget:!1},KH=(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})`,...GH}}return!a&&n?{text:i?`\n in ${n} (${i})`:`\n in ${n}`,...GH}:i?{text:`\n in ${i}`,...GH}:a?{text:WH({componentName:n,filePath:a,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null},r),isAppSource:!0,consumesBudget:!UV(a)}:null},qH=(e,t={},n=null)=>{let r=ZB(t.maxLines),i=Math.max(r,20),a=XP(),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`,UV(n.filePath)||(f+=1),p(n.componentName),o.push(WH(n,a)));for(let t of e){if(f>=r||o.length>=i)break;let e=bV(t.fileName),s=wH(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=KH(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}},JH=async e=>{let t=await IH(e);return t?.origin===`app`?t:null},YH=(e,t,n)=>{let r=VH(TH(e),n,e=>CH(e)&&!t.renderedComponentNames.has(e));return r.length===0?t:{...t,text:`${t.text}${WV(r)}`}},XH=async(e,t={})=>{let n=await JH(e),r=await jH(e),i=ZB(t.maxLines),a=qH(r??[],t,n);if(a.text)return a.hasBudgetedStackFrame?a:YH(e,a,i);let o=VH(TH(e),i);return{text:WV(o),shouldAppendSelectorHint:!0,hasBudgetedStackFrame:!1,renderedComponentNames:new Set(o)}},ZH=async(e,t={})=>(await XH(e,t)).text,QH=(e,t)=>{let n=EH(e),r=n===null?``:`\n key: "${n}"`,i=t.shouldAppendSelectorHint?`\n selector: ${HV(e)}`:``;return`${t.text}${r}${i}`},$H=async(e,t={})=>{let n=await XH(e,t);return`${hH(e)}${QH(e,n).replace(/\n\s+/g,` `)}`},eU=async(e,t={})=>{let n=TH(e);return`${gH(n)}${QH(n,await XH(n,t))}`},tU=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),nU=(e,t)=>{let n=t?.componentName??`div`,r={version:Vj,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>${tU(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()}}})),iU=r({ReactGrabRenderer:()=>Tq}),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,KU,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=t((()=>{GB(),pL(),aU=(e,t,n)=>e+(t-e)*n,oU=(e,t)=>{let n=Math.max(t,1);return 1-(1-e)**(n/$j)},sU=X(`<canvas data-react-grab-overlay-canvas style=position:fixed;top:0;left:0;pointer-events:none>`),cU={borderColor:rM,fillColor:iM,lerpFactor:Wj},lU={drag:{borderColor:tM,fillColor:nM,lerpFactor:Qj},selection:cU,grabbed:cU},uU=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=Mj()?`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=lU.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=lU.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=lU[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)},ee=()=>{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)}}},C=(e,t,n)=>{let r=aU(e.current.x,e.target.x,t),i=aU(e.current.y,e.target.y,t),a=aU(e.current.width,e.target.width,t),o=aU(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=aU(e.opacity,e.targetOpacity,t);c=Math.abs(n-e.targetOpacity)<eM,e.opacity=c?e.targetOpacity:n}return!s||!c},w=()=>{let e=performance.now(),t=s===null?$j:e-s;s=e;let n=oU(lU.drag.lerpFactor,t),r=oU(lU.selection.lerpFactor,t),i=oU(lU.grabbed.lerpFactor,t),a=!1;u?.isInitialized&&C(u,n)&&(a=!0);for(let e of l)e.isInitialized&&C(e,r)&&(a=!0);let c=Date.now();d=d.filter(t=>{let n=t.id.startsWith(`label-`);if(t.isInitialized&&C(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-Gj)/125);t.opacity=1-(1-(1-n)*(1-n)),a=!0}return!0}return n?!0:t.opacity>0}),ee(),a?o=nF(w):(o=null,s=null)},T=()=>{o===null&&(o=nF(w))},E=()=>{m(),T()};return yL(wL(()=>[e.selectionVisible,e.selectionBounds,e.selectionBoundsMultiple,e.selectionShouldSnap],([e,t,n,r])=>{if(!e||!t&&(!n||n.length===0)){l=[],T();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)}),T()})),yL(wL(()=>[e.dragVisible,e.dragBounds],([e,t])=>{if(!e||!t){u=null,T();return}u?_(u,t):u=g(`drag`,t),T()})),yL(wL(()=>[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)),T()})),TL(()=>{m(),T(),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(),EL(()=>{window.removeEventListener(`resize`,E),e&&e.removeEventListener(`change`,t),o!==null&&rF(o)})}),(()=>{var e=sU(),n=t;return typeof n==`function`?xR(n,e):t=e,vL(t=>yR(e,`z-index`,String(Zj))),e})()},dU=X(`<div style=position:fixed;pointer-events:none;will-change:opacity;contain:strict;transform:translateZ(0)>`),fU=e=>{let t=Lj(),n=t?getComputedStyle(t).borderRadius:`0px`,r=()=>t?.getBoundingClientRect()??null,[i,a]=q(r());if(t){let n=()=>a(r());TL(()=>{let e=new ResizeObserver(n);e.observe(t),window.addEventListener(`scroll`,n,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),EL(()=>{e.disconnect(),window.removeEventListener(`scroll`,n,{capture:!0}),window.removeEventListener(`resize`,n)})}),yL(()=>{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=dU();return yR(t,`border-radius`,n),yR(t,`z-index`,Zj),yR(t,`transition`,`opacity 125ms ease-out`),yR(t,`box-shadow`,`inset 0 0 50px ${aM}`),vL(n=>{var r=o(),i=s(),a=c(),u=l(),d=+!!e.visible;return r!==n.e&&yR(t,`top`,n.e=r),i!==n.t&&yR(t,`left`,n.t=i),a!==n.a&&yR(t,`width`,n.a=a),u!==n.o&&yR(t,`height`,n.o=u),d!==n.i&&yR(t,`opacity`,n.i=d),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})()},pU=(e,t)=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,t)}px`},mU=(e,t)=>{e&&e.focus(t)},hU=e=>{if(e<=0)return 8;let t=e*oM;return Math.round(Math.max(4,Math.min(8,t)))},gU=()=>{let e=Lj();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}},_U=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=_U(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},vU=(...e)=>{let t=``;for(let n of e){if(!n)continue;let e=_U(n);e&&(t=t?`${t} ${e}`:e)}return t},yU=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},bU=X(`<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">`),xU=e=>{let t=()=>e.size??10;return(()=>{var n=bU();return vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},SU=X(`<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>`),CU=e=>{let t=()=>e.size??16;return(()=>{var n=SU();return n.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling,vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},wU=X(`<svg data-react-grab-arrow class="absolute block z-10"><path>`),TU=e=>{let t=()=>e.color??`var(--rg-panel-bg)`,n=()=>e.position===`bottom`,r=()=>hU(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=wU(),s=r.firstChild;return vL(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&&Z(r,`width`,c.e=l),u!==c.t&&Z(r,`height`,c.t=u),d!==c.a&&Z(r,`viewBox`,c.a=d),f!==c.o&&yR(r,`left`,c.o=f),p!==c.i&&yR(r,`top`,c.i=p),m!==c.n&&yR(r,`bottom`,c.n=m),h!==c.s&&yR(r,`transform`,c.s=h),g!==c.h&&Z(s,`d`,c.h=g),_!==c.r&&Z(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})()},EU=X(`<span class=text-[var(--rg-text-primary)]>`),DU=X(`<span class=text-[var(--rg-text-secondary)]>.`),OU=X(`<span class="text-[13px] leading-4 h-fit font-medium overflow-hidden text-ellipsis whitespace-nowrap min-w-0">`),kU=X(`<button type=button>`),AU=X(`<div>`),jU=e=>{let t=()=>{e.onHoverChange?.(!0)},n=()=>{e.onHoverChange?.(!1)},r=()=>e.componentName?`${e.componentName}.${e.tagName}`:e.tagName,i=()=>(()=>{var t=OU();return Q(t,Y(oR,{get when(){return e.componentName},get children(){return[(()=>{var t=EU();return Q(t,()=>e.componentName),t})(),(()=>{var t=DU();return t.firstChild,Q(t,()=>e.tagName,null),t})()]}}),null),Q(t,Y(oR,{get when(){return!e.componentName},get children(){var t=EU();return Q(t,()=>e.tagName),t}}),null),t})();return Y(oR,{get when(){return e.isClickable},get fallback(){return(()=>{var r=AU();return gR(r,`click`,e.onClick,!0),r.addEventListener(`mouseleave`,n),r.addEventListener(`mouseenter`,t),Q(r,i),vL(()=>hR(r,vU(`contain-layout flex items-center gap-1 max-w-[280px] overflow-hidden`,e.shrink&&`shrink-0`))),r})()},get children(){var a=kU();return gR(a,`click`,e.onClick,!0),a.addEventListener(`mouseleave`,n),a.addEventListener(`mouseenter`,t),Q(a,i),vL(t=>{var n=`Open source for ${r()}`,i=vU(`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&&Z(a,`aria-label`,t.e=n),i!==t.t&&hR(a,t.t=i),t},{e:void 0,t:void 0}),a}})},fR([`click`]),MU=X(`<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]">`),NU=e=>(()=>{var t=MU();return Q(t,()=>e.children),t})(),PU=(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 vU(...i)},FU=X(`<div>`),IU=PU(`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`}}),LU=e=>{let[t,n]=rR(e,[`shape`,`class`]);return(()=>{var e=FU();return bR(e,nR({get class(){return vU(IU({shape:t.shape}),t.class)}},n),!1,!1),e})()},RU=null,zU={claim:e=>{RU=e},release:e=>{RU===e&&(RU=null)},isActive:e=>RU===e},BU=e=>{let t=Symbol(),n=zj(n=>{zU.isActive(t)&&(lz(n)||(n.code===`Enter`?e.onEnter?.(n):n.code===`Escape`&&e.onEscape?.(n)))});return TL(()=>{zU.claim(t),window.addEventListener(`keydown`,n,{capture:!0})}),EL(()=>{zU.release(t),window.removeEventListener(`keydown`,n,{capture:!0})}),{claimFocus:()=>zU.claim(t)}},VU=X(`<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">`),HU=e=>{let t=()=>e.size??10;return(()=>{var n=VU();return vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},UU=X(`<button>`),WU=PU(`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`}}),GU=e=>{let[t,n]=rR(e,[`variant`,`class`,`type`]);return(()=>{var e=UU();return bR(e,nR({get type(){return t.type??`button`},get class(){return vU(WU({variant:t.variant}),t.class)}},n),!1,!1),e})()},KU=X(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),qU=X(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),JU=X(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),YU=X(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),XU=X(`<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">`),ZU=e=>{let t=()=>e.showCancel??!0,{claimFocus:n}=BU({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=XU(),i=r.firstChild.firstChild;return gR(r,`click`,n,!0),gR(r,`pointerdown`,n,!0),Q(i,()=>e.label??`Discard?`),Q(r,Y(NU,{get children(){var n=YU();return Q(n,Y(oR,{get when(){return t()},get children(){return Y(GU,{"data-react-grab-discard-no":!0,get onClick(){return e.onCancel},get children(){return KU()}})}}),null),Q(n,Y(oR,{get when(){return e.onCopy},get children(){return Y(GU,{"data-react-grab-discard-copy":!0,get onClick(){return e.onCopy},get children(){return qU()}})}}),null),Q(n,Y(GU,{variant:`destructive`,class:`gap-0.5`,"data-react-grab-discard-yes":!0,get onClick(){return e.onConfirm},get children(){return[JU(),Y(HU,{size:10,class:`text-[var(--rg-error-text)] opacity-50`})]}}),null),n}}),null),r})()},fR([`pointerdown`,`click`]),QU=X(`<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">`),$U=e=>{let t=()=>e.size??12;return(()=>{var n=QU();return vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},eW=X(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Retry`),tW=X(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Ok`),nW=X(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),rW=X(`<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">`),iW=e=>{let{claimFocus:t}=BU({onEnter:t=>{t.preventDefault(),t.stopPropagation(),e.onRetry?.()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onAcknowledge?.()}}),n=()=>!!(e.onRetry||e.onAcknowledge);return(()=>{var r=rW(),i=r.firstChild,a=i.firstChild;return gR(r,`click`,t,!0),gR(r,`pointerdown`,t,!0),Q(a,()=>e.error),Q(r,Y(oR,{get when(){return n()},get children(){return Y(NU,{get children(){var t=nW();return Q(t,Y(oR,{get when(){return e.onRetry},get children(){return Y(GU,{"data-react-grab-retry":!0,class:`gap-1`,"aria-keyshortcuts":`Enter`,get onClick(){return e.onRetry},get children(){return[eW(),Y($U,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-text-secondary)]`})]}})}}),null),Q(t,Y(oR,{get when(){return e.onAcknowledge},get children(){return Y(GU,{"data-react-grab-error-ok":!0,class:`gap-1`,"aria-keyshortcuts":`Escape`,get onClick(){return e.onAcknowledge},get children(){return tW()}})}}),null),t}})}}),null),vL(t=>{var r={"pt-1.5 pb-1":n(),"py-1.5":!n()},o=e.error;return t.e=_R(i,r,t.e),o!==t.t&&Z(a,`title`,t.t=o),t},{e:void 0,t:void 0}),r})()},fR([`pointerdown`,`click`]),aW=X(`<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">`),oW=e=>{let t=()=>e.size??14;return(()=>{var n=aW();return vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},sW=X(`<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">`),cW=e=>{let t=()=>e.size??14;return(()=>{var n=sW();return vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},lW=X(`<button data-react-grab-ignore-events data-react-grab-more-options>`),uW=X(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Keep`),dW=X(`<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">`),fW=X(`<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">`),pW=e=>(()=>{var t=lW();return gR(t,`click`,t=>{t.stopImmediatePropagation(),e.onClick()}),gR(t,`pointerdown`,e=>{e.stopImmediatePropagation()}),Q(t,Y(oW,{size:14,class:`opacity-50 group-hover:opacity-100 transition-opacity`})),vL(()=>hR(t,vU(WU({variant:`ghost`}),`group size-4 text-[var(--rg-text-secondary)] hover:text-[var(--rg-text-primary)]`))),t})(),mW=e=>{let t,n,[r,i]=q(!1),[a,o]=q(!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}=BU({onEnter:e=>{e.preventDefault(),e.stopPropagation(),l()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onDismiss?.()}});return EL(()=>{t!==void 0&&window.clearTimeout(t),n!==void 0&&window.clearTimeout(n)}),Y(LU,{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[Y(oR,{get when(){return iz(()=>!r())()&&e.onDismiss},get children(){var t=dW(),n=t.firstChild,i=n.nextSibling;return Q(n,s),Q(i,Y(oR,{get when(){return e.onShowContextMenu},get children(){return Y(pW,{onClick:c})}}),null),Q(i,Y(oR,{get when(){return e.onDismiss},get children(){return Y(GU,{"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[uW(),Y(oR,{get when(){return!r()},get children(){return Y(HU,{size:10,class:`text-[var(--rg-text-secondary)]`})}})]}})}}),null),t}}),Y(oR,{get when(){return r()||!e.onDismiss},get children(){var t=fW(),n=t.firstChild;return Q(t,Y(cW,{size:14,"aria-hidden":`true`,class:`text-[var(--rg-text-primary-85)] shrink-0`}),n),Q(n,s),Q(t,Y(oR,{get when(){return e.onShowContextMenu},get children(){return Y(pW,{onClick:c})}}),null),t}})]}})},hW=X(`<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">`),gW=X(`<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">`),_W=X(`<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">`),vW=X(`<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>`),yW=X(`<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">`),bW=X(`<div data-react-grab-ignore-events data-react-grab-selection-label>`),xW={left:LM,top:LM,arrowLeftPercent:50,arrowLeftOffset:0,edgeOffsetX:0},SW=e=>{let t,n,r,i=!1,[a,o]=q(0),[s,c]=q(0),[l,u]=q(0),[d,f]=q(0),[p,m]=q(!1),[h,g]=q(!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},ee=()=>{f(e=>e+1)},C=zj(t=>{lz(t)||t.code===`Enter`&&!e.isPromptMode&&!e.discardPrompt&&_()&&(t.preventDefault(),t.stopImmediatePropagation(),e.onToggleExpand?.())});TL(()=>{let r=Lj();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&&ee()}}),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`,ee,!0),window.addEventListener(`resize`,ee),window.visualViewport?.addEventListener(`resize`,ee),window.visualViewport?.addEventListener(`scroll`,ee),e.onToggleExpand&&window.addEventListener(`keydown`,C,{capture:!0})}),EL(()=>{x?.disconnect(),window.removeEventListener(`scroll`,ee,!0),window.removeEventListener(`resize`,ee),window.visualViewport?.removeEventListener(`resize`,ee),window.visualViewport?.removeEventListener(`scroll`,ee),window.removeEventListener(`keydown`,C,{capture:!0})});let w=()=>`${e.tagName??``}:${e.componentName??``}`,T=J(t=>{d();let n=w(),r=n===t.elementIdentity?t:{position:xW,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:xW,computedArrowPosition:r.computedArrowPosition,hadValidBounds:r.hadValidBounds,elementIdentity:n};let p=gU(),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:xW,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:hU(l()),ee=y,C=0,T=b+S+4;if(o>0){let e=ee-o/2,t=ee+o/2;t>g-8&&(C=g-8-t),e+C<m+8&&(C=m+8-e)}let E=c+S+4,D=T+c<=_-8;D||(T=x-E),T<h+8&&(T=h+8);let O=o/2,te=O-C,ne=Math.min(16,O),k=Math.max(o-16,O),re=Math.max(ne,Math.min(k,te))-O;return{position:{left:ee,top:T,arrowLeftPercent:50,arrowLeftOffset:re,edgeOffsetX:C},computedArrowPosition:D?`bottom`:`top`,hadValidBounds:!0,elementIdentity:n}},{position:xW,computedArrowPosition:null,hadValidBounds:!1,elementIdentity:``}),E=()=>T().computedArrowPosition??`bottom`,D=()=>T().hadValidBounds;yL(wL(()=>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&&(pU(n,95),e.onInputChange?.(n.value))},ne=()=>yU({tagName:e.tagName,componentName:e.componentName,elementsCount:e.elementsCount}),k=J(()=>!(e.error||e.discardPrompt||_()&&e.isPromptMode)),re=t=>{if(t.stopImmediatePropagation(),e.filePath&&e.onOpen){e.onOpen();return}y()&&e.onToggleExpand?.()},ie=t=>{t.stopImmediatePropagation(),_()&&e.isPromptMode&&!e.discardPrompt&&e.onSubmit&&r&&mU(r,{preventScroll:!0})},ae=()=>D()&&(v()||e.status===`error`);return Y(oR,{get when(){return iz(()=>e.visible!==!1)()&&(e.selectionBounds||ae())},get children(){var i=bW();i.addEventListener(`mouseleave`,()=>e.onHoverChange?.(!1)),i.addEventListener(`mouseenter`,()=>e.onHoverChange?.(!0)),i.$$click=e=>{e.stopImmediatePropagation()},i.$$pointerdown=ie;var a=t;return typeof a==`function`?xR(a,i):t=i,yR(i,`z-index`,`${Xj}`),yR(i,`transition`,`opacity 125ms ease-out, filter 125ms ease-out`),Q(i,Y(oR,{get when(){return!e.hideArrow},get children(){return Y(TU,{get position(){return E()},get leftPercent(){return T().position.arrowLeftPercent},get leftOffsetPx(){return T().position.arrowLeftOffset},get labelWidth(){return l()}})}}),null),Q(i,Y(oR,{get when(){return iz(()=>!!v())()&&!e.error},get children(){return Y(mW,{get statusText(){return e.statusText??`Copied`},get onDismiss(){return e.onDismiss},onFadingChange:m,get onShowContextMenu(){return e.onShowContextMenu}})}}),null),Q(i,Y(LU,{ref:e=>n=e,get shape(){return k()?`pill`:`panel`},get class(){return vU(`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[Y(oR,{get when(){return e.status===`copying`},get children(){var t=hW(),n=t.firstChild,r=n.firstChild;return Q(n,Y(CU,{size:13,class:`text-[var(--rg-text-secondary)] shrink-0`}),r),Q(r,()=>e.statusText??`Grabbing…`),t}}),Y(oR,{get when(){return iz(()=>!!(_()&&!e.isPromptMode))()&&!e.discardPrompt},get children(){var t=gW(),n=t.firstChild;return Q(n,Y(jU,{get tagName(){return ne().tagName},get componentName(){return ne().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:re,onHoverChange:S,shrink:!0})),t}}),Y(oR,{get when(){return iz(()=>!!(_()&&e.isPromptMode))()&&!e.discardPrompt},get children(){var t=yW(),n=t.firstChild;return Q(n,Y(jU,{get tagName(){return ne().tagName},get componentName(){return ne().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:re,onHoverChange:S})),Q(t,Y(NU,{get children(){var t=vW(),n=t.firstChild;return n.$$keydown=O,n.$$input=te,xR(t=>{r=t,e.onSubmit&&queueMicrotask(()=>{mU(t,{preventScroll:!0}),pU(t,95)})},n),yR(n,`max-height`,`95px`),Q(t,Y(oR,{get when(){return e.onSubmit},get children(){var t=_W();return t.$$click=()=>e.onSubmit?.(),Q(t,Y(xU,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-submit-fg)]`})),t}}),null),vL(()=>n.readOnly=!e.onSubmit),vL(()=>n.value=e.inputValue??``),t}}),null),t}}),Y(oR,{get when(){return e.discardPrompt},keyed:!0,children:e=>Y(ZU,{get label(){return iz(()=>!!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?.(),mU(r,{preventScroll:!0})}})}),Y(oR,{get when(){return e.error},get children(){return Y(iW,{get error(){return e.error},get onAcknowledge(){return e.onAcknowledgeError},get onRetry(){return e.onRetry}})}})]}}),null),vL(t=>{var n=vU(`fixed font-sans text-[13px] antialiased select-none ease-out`),r=`${T().position.top}px`,a=`${T().position.left}px`,o=`translateX(calc(-50% + ${T().position.edgeOffsetX}px))`,s=b()?`auto`:`none`,c=e.status===`fading`||p()?0:1,l=`drop-shadow(${Hj}) blur(${e.status===`fading`||p()?`3px`:`0`})`;return n!==t.e&&hR(i,t.e=n),r!==t.t&&yR(i,`top`,t.t=r),a!==t.a&&yR(i,`left`,t.a=a),o!==t.o&&yR(i,`transform`,t.o=o),s!==t.i&&yR(i,`pointer-events`,t.i=s),c!==t.n&&yR(i,`opacity`,t.n=c),l!==t.s&&yR(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}})},fR([`pointerdown`,`click`,`input`,`keydown`]),CW=X(`<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">`),wW=e=>{let t=()=>e.size??14,n=()=>e.rotationDeg??0;return(()=>{var r=CW(),i=r.firstChild;return yR(r,`transition-duration`,`180ms`),vL(a=>{var o=vU(`inline-flex items-center justify-center will-change-transform`,e.class),s=`rotate(${n()}deg)`,c=t(),l=t();return o!==a.e&&hR(r,a.e=o),s!==a.t&&yR(r,`transform`,a.t=s),c!==a.a&&Z(i,`width`,a.a=c),l!==a.o&&Z(i,`height`,a.o=l),a},{e:void 0,t:void 0,a:void 0,o:void 0}),r})()},TW=X(`<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">`),EW=e=>{let t=()=>e.size??14;return(()=>{var n=TW();return vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},DW=X(`<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">`),OW=e=>{let t=()=>e.size??14;return(()=>{var n=DW();return vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},kW=X(`<div>`),AW=0,jW=()=>Date.now()-AW<800,MW=e=>{let[t,n]=q(!1),[r,i]=q(!0),a;yL(wL(()=>e.visible,e=>{a!==void 0&&(clearTimeout(a),a=void 0),e?jW()?(i(!1),n(!0)):(i(!0),a=setTimeout(()=>{n(!0)},400)):(t()&&(AW=Date.now()),n(!1))})),EL(()=>{a!==void 0&&clearTimeout(a),t()&&(AW=Date.now())});let o=()=>e.position===`top`||e.position===`bottom`?{left:`50%`,translate:`-50%`,"z-index":`${Xj}`}:{top:`50%`,translate:`0 -50%`,"z-index":`${Xj}`};return Y(oR,{get when(){return t()},get children(){var t=kW();return Q(t,()=>e.children),vL(n=>{var i=vU(`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&&hR(t,n.e=i),n.t=vR(t,a,n.t),n},{e:void 0,t:void 0}),t}})},NW=X(`<div><button data-react-grab-ignore-events type=button>`),PW=e=>(()=>{var t=NW(),n=t.firstChild;gR(n,`mouseleave`,e.onMouseLeave),gR(n,`mouseenter`,e.onMouseEnter),gR(n,`contextmenu`,t=>e.onContextMenu?.(t)),gR(n,`click`,e.onClick,!0);var r=e.ref;return typeof r==`function`?xR(r,n):e.ref=n,Q(n,()=>e.icon),Q(t,Y(oR,{get when(){return e.tooltip},get children(){return Y(MW,{get visible(){return!!e.tooltipVisible},get position(){return e.tooltipPosition??`top`},get children(){return e.tooltip}})}}),null),vL(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&&hR(t,r.e=i),a!==r.t&&Z(n,`data-react-grab-toolbar-toggle`,r.t=a),o!==r.a&&Z(n,`data-react-grab-toolbar-action`,r.a=o),s!==r.o&&Z(n,`aria-label`,r.o=s),c!==r.i&&Z(n,`aria-pressed`,r.i=c),l!==r.n&&hR(n,r.n=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})(),fR([`click`]),FW=X(`<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">`),IW=e=>{let t=()=>e.size??14;return(()=>{var n=FW();return vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},LW=X(`<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">`),RW=X(`<div data-react-grab-toolbar-panel><div><div><div>`),zW=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=LW();return gR(t,`pointercancel`,e.onCollapsePointerLeave),gR(t,`pointerleave`,e.onCollapsePointerLeave),gR(t,`pointerup`,e.onCollapsePointerUp,!0),gR(t,`pointerdown`,e.onCollapsePointerDown),gR(t,`click`,e.onCollapseClick,!0),Q(t,Y(IW,{size:18,get class(){return vU(`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)] transition-[transform,color] duration-150 ease-drawer -m-0.5`,s())}})),vL(n=>{var r=e.isCollapsed?`Expand toolbar`:`Collapse toolbar`,i=!e.isCollapsed;return r!==n.e&&Z(t,`aria-label`,n.e=r),i!==n.t&&Z(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=RW(),r=t.firstChild,s=r.firstChild,d=s.firstChild;return gR(t,`click`,e.onPanelClick,!0),gR(t,`animationend`,e.onAnimationEnd),Q(d,()=>e.actionButtons),Q(t,l,null),vL(l=>{var f=vU(`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=vU(`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=vU(`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]`),_=vU(`relative overflow-visible flex`,n()?`flex-col items-center`:`items-center`,a());return f!==l.e&&hR(t,l.e=f),p!==l.t&&yR(t,`transform-origin`,l.t=p),m!==l.a&&yR(t,`transform`,l.a=m),h!==l.o&&hR(r,l.o=h),g!==l.i&&hR(s,l.i=g),_!==l.n&&hR(d,l.n=_),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})()},fR([`click`,`pointerup`]),BW=e=>e===`top`||e===`bottom`,VW=e=>{let t=BW(e);return{width:t?30:16,height:t?16:30}},HW=(e,t,n,r)=>{let i=gU(),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}},UW=(e,t,n,r,i)=>{let a=gU(),o=a.width,s=a.height;if(e===`top`||e===`bottom`){let e=o-r-32;return e<=0?gM:Math.max(0,Math.min(1,(t-a.offsetLeft-16)/e))}let c=s-i-32;return c<=0?gM:Math.max(0,Math.min(1,(n-a.offsetTop-16)/c))},WW=(e,t,n,r,i)=>{let a=gU(),o=a.width,s=a.height,{width:c,height:l}=n,u;if(t===`top`||t===`bottom`){let n=(c-r)/2;u={x:jz(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=jz(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=UW(t,u.x,u.y,c,l);return{position:u,ratio:d}},GW=(e,t,n,r)=>{let i=gU(),{width:a,height:o}=n,{width:s,height:c}=r;switch(e){case`top`:case`bottom`:{let n=(a-s)/2;return{x:jz(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=jz(t.y+n,i.offsetTop,i.offsetTop+i.height-c);return{x:e===`left`?i.offsetLeft:i.offsetLeft+i.width-s,y:r}}}},KW=(e,t,n,r,i,a)=>{let o=gU(),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=>jz(e,o.offsetLeft+16,o.offsetLeft+s-n-16),_=e=>jz(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}},qW=e=>{let[t,n]=q(!1),[r,i]=q(!1),[a,o]=q(!1),[s,c]=q({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=KW(o.left,o.top,o.width,o.height,c.x,c.y),u=UW(l.edge,l.x,l.y,o.width,o.height);e.onSnapEdgeChange(l.edge,u),i(!0),nF(()=>{let t=r?.getBoundingClientRect(),n=t?{width:t.width,height:t.height}:e.getExpandedDimensions();nF(()=>{let t=HW(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=zj(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 EL(()=>{h(),clearTimeout(p)}),{isDragging:t,isSnapping:r,handlePointerDown:v,createDragAwareHandler:e=>t=>{if(t.stopImmediatePropagation(),f){f=!1;return}e()}}},JW=(e,t)=>{let n=t-e;return e+(n-Math.round(n/360)*360)},YW=X(`<div data-react-grab-ignore-events data-react-grab-toolbar>`),XW=e=>{let t,n,r=null,i=RB(),[a,o]=q(!1),[s,c]=q(!1),[l,u]=q(!1),[d,f]=q(i?.edge??`bottom`),[p,m]=q(i?.ratio??.5),[h,g]=q({x:0,y:0}),[_,v]=q(!1),[y,b]=q(!1),[x,S]=q(!1),[ee,C]=q(!1),[w,T]=q(0),[E,D]=q(null),O=()=>{r?.(),r=null,e.isActive||II()},te=qW({getContainerRef:()=>t,isCollapsed:s,getExpandedDimensions:()=>le,onDragStart:()=>{D(null),r&&O()},onPositionUpdate:e=>g(e),onSnapEdgeChange:(e,t)=>{fe(d(),e),f(e),m(t)},onSnapComplete:e=>{le=e.expandedDimensions,g(e.position),je({edge:e.edge,ratio:e.ratio,collapsed:s(),enabled:!s()})}}),ne=()=>d()===`left`||d()===`right`,k=()=>ne()?`mb-1.5`:`mr-1.5`,re=t=>e.activeActionId===t,ie=()=>!!e.isActive&&(e.activeActionId??`copy`)===`copy`,ae=t=>E()===t&&!e.isActive&&!s()&&!te.isDragging()&&!te.isSnapping()&&!e.isContextMenuOpen,oe=()=>{switch(d()){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;default:return`top`}},se=e=>{e.stopImmediatePropagation()},ce=(t,n)=>({onMouseEnter:e=>{te.isDragging()||(D(t),n?.shouldFreezeInteractions!==!1&&!r&&(r=fL(),FI(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)}});yL(wL(()=>e.shakeCount,t=>{t&&!e.enabled&&v(!0)})),yL(wL(()=>[e.isActive,e.isContextMenuOpen],([e,t])=>{!e&&!t&&r&&(r(),r=null)})),yL(wL(()=>ie(),e=>{if(!e){T(e=>JW(e,0));return}let t=zj(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;T(e=>JW(e,s))});window.addEventListener(`pointermove`,t,{passive:!0}),EL(()=>{window.removeEventListener(`pointermove`,t)})}));let le={width:78,height:28},[ue,de]=q(VW(d())),fe=(e,t)=>{BW(e)!==BW(t)&&de(VW(t))},pe=(e,n)=>{let r=t?.getBoundingClientRect(),i=VW(n);return WW(e,n,le,r?.width??i.width,r?.height??i.height)},me=()=>{g(HW(d(),p(),le.width,le.height))},he=te.createDragAwareHandler(()=>e.onToggle?.()),ge=te.createDragAwareHandler(()=>e.onActivateAction?.(vM)),_e=te.createDragAwareHandler(()=>e.onActivateAction?.(yM)),ve=`group contain-layout flex items-center justify-center cursor-pointer interactive-scale a11y-hitbox`,ye=()=>vU(`relative contain-layout flex items-center justify-center`,k()),be=e=>e?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)]`,xe=te.createDragAwareHandler(()=>{let e=t?.getBoundingClientRect(),n=s(),r=p();if(n){let{position:e,ratio:t}=pe(Me(),d());r=t,g(e),m(r)}else e&&(le={width:e.width,height:e.height});b(!0),c(e=>!e),je({edge:d(),ratio:r,collapsed:!n,enabled:n}),we&&clearTimeout(we),we=setTimeout(()=>{b(!1),Ee()},260)}),Se=()=>GW(d(),h(),le,ue()),Ce,we,Te=null,Ee=()=>{let e=t?.getBoundingClientRect();!e||e.width===0||e.height===0||(s()?de({width:e.width,height:e.height}):(le={width:e.width,height:e.height},Te={width:e.width,height:e.height}))},De=(e,t)=>{if(!(e===0||t===0)&&!(te.isDragging()||te.isSnapping())&&!y()){if(s()){let n=ue();if(n.width===e&&n.height===t)return;de({width:e,height:t});return}Te&&Te.width===e&&Te.height===t||(Te={width:e,height:t},le={width:e,height:t},g(HW(d(),p(),e,t)))}},Oe=null,ke=()=>{te.isDragging()||te.isSnapping()||Oe===null&&(Oe=nF(()=>{Oe=null,me()}))},Ae=()=>{te.isDragging()||(u(!0),me(),Ce&&clearTimeout(Ce),Ce=setTimeout(()=>{u(!1);let e=UW(d(),h().x,h().y,le.width,le.height);m(e),je({edge:d(),ratio:e,collapsed:s(),enabled:!s()})},500))},je=t=>{zB(t),e.onStateChange?.(t)};TL(()=>{t&&e.onContainerRef?.(t);let n=t?.getBoundingClientRect(),r=gU(),a=!!(n&&n.width>0&&n.height>0);i?(a&&n&&(le={width:n.width,height:n.height}),c(i.collapsed),g(HW(i.edge,i.ratio,le.width,le.height))):a&&n?(le={width:n.width,height:n.height},g({x:r.offsetLeft+(r.width-n.width)/2,y:r.offsetTop+r.height-n.height-16}),m(gM)):(g(HW(`bottom`,gM,le.width,le.height)),m(gM)),e.onSubscribeToStateChanges&&EL(e.onSubscribeToStateChanges(e=>{if(y()||!t?.getBoundingClientRect())return;let n=s()!==e.collapsed;if(fe(d(),e.edge),f(e.edge),n&&!e.collapsed){let t=Me();b(!0),c(e.collapsed);let{position:n,ratio:r}=pe(t,e.edge);g(n),m(r),clearTimeout(we),we=setTimeout(()=>{b(!1),Ee()},260)}else n&&(b(!0),clearTimeout(we),we=setTimeout(()=>{b(!1),Ee()},260)),c(e.collapsed),g(HW(e.edge,e.ratio,le.width,le.height)),m(e.ratio)})),window.addEventListener(`resize`,Ae),window.visualViewport?.addEventListener(`resize`,Ae),window.visualViewport?.addEventListener(`scroll`,Ae);let l=Lj();if(l&&(window.addEventListener(`scroll`,ke,{passive:!0,capture:!0}),typeof ResizeObserver<`u`)){let e=new ResizeObserver(ke);e.observe(l),EL(()=>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}De(i,a)});e.observe(t),EL(()=>e.disconnect())}let u=setTimeout(()=>{o(!0)},500);EL(()=>{clearTimeout(u)})}),EL(()=>{window.removeEventListener(`resize`,Ae),window.visualViewport?.removeEventListener(`resize`,Ae),window.visualViewport?.removeEventListener(`scroll`,Ae),window.removeEventListener(`scroll`,ke,{capture:!0}),Oe!==null&&rF(Oe),clearTimeout(Ce),clearTimeout(we),r&&O()});let Me=()=>s()?Se():h(),Ne=()=>s()?`cursor-pointer`:te.isDragging()?`cursor-grabbing`:`cursor-grab`,Pe=()=>ee()||!!e.isContextMenuOpen||te.isDragging()||te.isSnapping()||y()||x(),Fe=()=>!!e.isActive&&!Pe(),Ie=()=>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`,Le=()=>{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=YW();r.addEventListener(`mouseleave`,()=>{C(!1),e.onSelectHoverChange?.(!1)}),r.addEventListener(`mouseenter`,()=>{C(!0),s()||e.onSelectHoverChange?.(!0)}),gR(r,`mousedown`,se),gR(r,`pointerdown`,e=>{se(e),te.handlePointerDown(e)});var i=t;return typeof i==`function`?xR(i,r):t=r,Q(r,Y(zW,{get isCollapsed(){return s()},get snapEdge(){return d()},get isShaking(){return _()},get isChevronPressed(){return x()},get transformOrigin(){return Le()},onAnimationEnd:()=>v(!1),onCollapseClick:xe,onCollapsePointerDown:()=>S(!0),onCollapsePointerUp:()=>S(!1),onCollapsePointerLeave:()=>S(!1),onPanelClick:e=>{if(s()){e.stopPropagation();let{position:t,ratio:n}=pe(Me(),d());g(t),m(n),b(!0),c(!1),je({edge:d(),ratio:n,collapsed:!1,enabled:!0}),we&&clearTimeout(we),we=setTimeout(()=>{b(!1),Ee()},260)}},get actionButtons(){return[Y(PW,nR({actionId:_M,isToggle:!0,ref:e=>n=e,get label(){return ie()?`Stop selecting element`:`Copy element`},get isActive(){return ie()},class:ve,get wrapperClass(){return ye()},onClick:he,onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),D(null),e.onToggleToolbarMenu?.()}},()=>ce(_M),{get icon(){return Y(wW,{size:14,get rotationDeg(){return w()},get class(){return be(ie())}})},get tooltipVisible(){return ae(_M)},get tooltipPosition(){return oe()},tooltip:`Copy`})),Y(PW,nR({actionId:vM,label:`Comment on element`,get isActive(){return re(vM)},class:ve,get wrapperClass(){return ye()},onClick:ge},()=>ce(vM),{get icon(){return Y(EW,{size:14,get class(){return be(re(vM))}})},get tooltipVisible(){return ae(vM)},get tooltipPosition(){return oe()},tooltip:`Comment`})),Y(PW,nR({actionId:yM,label:`Style element`,get isActive(){return re(yM)},class:ve,get wrapperClass(){return ye()},onClick:_e},()=>ce(yM),{get icon(){return Y(OW,{size:14,get class(){return be(re(yM))}})},get tooltipVisible(){return ae(yM)},get tooltipPosition(){return oe()},tooltip:`Style`}))]}})),vL(e=>{var t=vU(`fixed left-0 top-0 font-sans text-[13px] antialiased select-none`,Ne(),Ie(),a()?`pointer-events-auto`:`pointer-events-none`),n=String(Xj),i=`translate(${Me().x}px, ${Me().y}px) scale(${Fe()?.97:1})`,o=Le(),s=a()?Fe()?.55:1:0;return t!==e.e&&hR(r,e.e=t),n!==e.t&&yR(r,`z-index`,e.t=n),i!==e.a&&yR(r,`transform`,e.a=i),o!==e.o&&yR(r,`transform-origin`,e.o=o),s!==e.i&&yR(r,`opacity`,e.i=s),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r})()},ZW=kL(),QW=()=>{let e=AL(ZW);if(!e)throw Error(`Menu subcomponents must be rendered inside <Menu.Provider>`);return e},$W=e=>Y(ZW.Provider,{get value(){return e.store},get children(){return e.children}}),eG=e=>Y(LU,{get class(){return vU(`flex flex-col w-fit h-fit`,e.class)},get style(){return e.style},get children(){return e.children}}),tG=X(`<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)]">`),nG=e=>{let t=QW();return(()=>{var n=tG(),r=n.firstChild;n.$$pointermove=()=>t.notePointerMove(),xR(n=>{t.setHighlightContainer(n),e.ref?.(n)},n);var i=t.setHighlightRail;return typeof i==`function`?xR(i,r):t.setHighlightRail=r,Q(n,()=>e.children,null),vL(r=>{var i=e.label,a=t.keyboardNavigation?t.activeDescendantId():void 0,o=t.keyboardNavigation?-1:void 0,s=vU(`relative flex flex-col`,e.class);return i!==r.e&&Z(n,`aria-label`,r.e=i),a!==r.t&&Z(n,`aria-activedescendant`,r.t=a),o!==r.a&&Z(n,`tabindex`,r.a=o),s!==r.o&&hR(n,r.o=s),r},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()},fR([`pointermove`]),rG=X(`<button data-react-grab-ignore-events type=button>`),iG=e=>{let t=QW(),n=t.createItemId(),r=e.value,i=()=>e.role??`menuitem`,a=()=>!e.disabled,o=()=>t.activeValue()===r,s;return TL(()=>{s&&(t.registerItem({value:r,domId:n,element:s,isEnabled:a,onSelect:()=>e.onSelect?.()}),EL(()=>t.unregisterItem(r)))}),(()=>{var c=rG();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`?xR(l,c):s=c,Z(c,`id`,n),Q(c,()=>e.children),vL(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=vU(`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&&Z(c,`data-react-grab-menu-item`,n.e=a),s!==n.t&&Z(c,`role`,n.t=s),l!==n.a&&Z(c,`aria-checked`,n.a=l),u!==n.o&&Z(c,`aria-disabled`,n.o=u),d!==n.i&&Z(c,`tabindex`,n.i=d),f!==n.n&&(c.disabled=n.n=f),p!==n.s&&hR(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})()},fR([`pointerdown`,`click`]),aG=X(`<span>`),oG=e=>(()=>{var t=aG();return Q(t,()=>e.children),vL(()=>hR(t,vU(`text-[13px] leading-4 font-sans font-medium`,e.class))),t})(),sG=X(`<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">`),cG=e=>{let t=()=>e.size??11;return(()=>{var n=sG();return vL(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Z(n,`width`,r.e=i),a!==r.t&&Z(n,`height`,r.t=a),o!==r.a&&Z(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},lG=X(`<span>`),uG=X(`<span style=display:inline-flex;align-items:center;gap:2px>`),dG=X(`<span>Ctrl+`),fG=e=>{let t=()=>e.shortcut===`Enter`,n=()=>e.modifier!==!1,r=Pz();return(()=>{var i=uG();return Q(i,Y(oR,{get when(){return t()},get children(){return Y(HU,{size:8})}}),null),Q(i,Y(oR,{get when(){return!t()},get children(){return Y(oR,{get when(){return n()},get fallback(){return(()=>{var t=lG();return Q(t,()=>e.shortcut),t})()},get children(){return Y(oR,{when:r,get fallback(){return(()=>{var t=dG();return t.firstChild,Q(t,()=>e.shortcut,null),t})()},get children(){return[Y(cG,{size:9}),(()=>{var t=lG();return Q(t,()=>e.shortcut),t})()]}})}})}}),null),vL(()=>hR(i,e.class)),i})()},pG=e=>Y(fG,{get shortcut(){return e.shortcut},get modifier(){return e.modifier},get class(){return vU(`text-[11px] font-sans text-[var(--rg-text-secondary)] ml-4`,e.class)}}),mG=({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)});EL(()=>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}},hG=(e,t)=>e!==t&&e instanceof HTMLElement,gG=(e,t)=>{let n=[];for(let r of Array.from(e.children))hG(r,t)&&n.push(r);return n},_G=(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=gG(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}=mG();return{containerRef:c,highlightRef:e=>{a=e,o=!1,l(e)},updateHighlight:e=>{u(e),e&&s(e)},clearHighlight:d}},vG=(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]=q(null),[l,u]=q(0),d=J(()=>o?e.value?.()??null:s()),f=t=>{if(o){e.onValueChange?.(t);return}c(t)},p=_G(e.highlight??{});yL(wL([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=J(()=>{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}},yG={Provider:$W,Panel:eG,List:nG,Item:iG,Label:oG,Shortcut:pG},bG=e=>e??!0,xG=(e,t)=>typeof e.enabled==`function`?t?e.enabled(t):!1:bG(e.enabled),SG=e=>{e.type===`contextmenu`&&e.preventDefault(),e.stopImmediatePropagation()},CG=e=>{let t=zj(t=>{e.isOpen()&&(e.shouldIgnoreKeyboardEvent?.(t)||e.shouldIgnoreInputEvents&&lz(t)||t.code===`Escape`&&(t.preventDefault(),t.stopImmediatePropagation(),e.onDismiss(`keyboard`)))}),n=zj(t=>{e.isOpen()&&(Fz(t,`data-react-grab-ignore-events`)||e.shouldIgnoreRightClick&&t instanceof MouseEvent&&t.button===2||e.onDismiss(`pointer`))}),r=nF(()=>{window.addEventListener(`mousedown`,n,{capture:!0}),window.addEventListener(`touchstart`,n,{capture:!0})});return window.addEventListener(`keydown`,t,{capture:!0}),()=>{rF(r),window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`mousedown`,n,{capture:!0}),window.removeEventListener(`touchstart`,n,{capture:!0})}},wG=X(`<div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 w-fit h-fit px-2">`),TG=X(`<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>`),EG=e=>{let t,n,r=null,i=vG({keyboardNavigation:!0,highlight:{bottomCornerRadiusPx:14,cornerShape:bM}}),[a,o]=q(0),[s,c]=q(0),l=J(()=>e.position!==null),u=J(()=>yU({tagName:e.tagName,componentName:e.componentName})),d=()=>{if(t){let e=t.getBoundingClientRect();o(e.width),c(e.height)}};yL(()=>{l()&&nF(d)});let f=J(()=>{let t=e.selectionBounds,n=e.position,r=a(),i=s();if(r===0||i===0||!t||!n)return{left:CM.left,top:CM.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=J(()=>{let t=e.actions??[],n=e.actionContext;return t.map(e=>({id:e.id,label:e.label,action:()=>{n&&e.onAction(n)},enabled:xG(e,n),shortcut:e.shortcut,shortcutModifier:e.shortcutModifier}))});yL(wL(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))&&nF(()=>{let e=document.activeElement;(e===null||e===document.body)&&a.focus({preventScroll:!0})})})),TL(()=>{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&&xG(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=UB(c,t,{includeModifierShortcuts:!0});f&&d(f)},n=CG({isOpen:l,onDismiss:e.onDismiss,shouldIgnoreRightClick:!0}),r=zj(t);window.addEventListener(`keydown`,r,{capture:!0}),EL(()=>{n(),window.removeEventListener(`keydown`,r,{capture:!0})})});let m=J(()=>{let{tagName:e,componentName:t}=u();return`Actions for ${t?`${t}.${e}`:e}`});return Y(oR,{get when(){return l()},get children(){var r=TG();gR(r,`contextmenu`,SG,!0),gR(r,`click`,SG,!0),gR(r,`mousedown`,SG,!0),gR(r,`pointerdown`,SG,!0);var a=t;return typeof a==`function`?xR(a,r):t=r,yR(r,`z-index`,`${Xj}`),Q(r,Y(TU,{get position(){return f().arrowPosition},leftPercent:0,get leftOffsetPx(){return f().arrowLeft}}),null),Q(r,Y(yG.Panel,{class:`justify-center items-start min-w-[100px]`,get children(){return[(()=>{var t=wG();return Q(t,Y(jU,{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})(),Y(NU,{get children(){return Y(yG.Provider,{store:i,get children(){return Y(yG.List,{ref:e=>n=e,get label(){return m()},class:`w-[calc(100%+16px)] -mx-2 -my-1.5 outline-none`,get children(){return Y(iR,{get each(){return p()},children:t=>Y(yG.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[Y(yG.Label,{class:`text-[var(--rg-text-primary)]`,get children(){return t.label}}),Y(oR,{get when(){return t.shortcut},children:e=>Y(yG.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})})}})}})}})]}}),null),vL(e=>{var t=`${f().top}px`,n=`${f().left}px`;return t!==e.e&&yR(r,`top`,e.e=t),n!==e.t&&yR(r,`left`,e.t=n),e},{e:void 0,t:void 0}),r}})},fR([`pointerdown`,`mousedown`,`click`,`contextmenu`]),DG=(e,t,n,r)=>Math.max(r,Math.min(e,n-t-r)),OG=({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+DG(u-r,t,a,c),top:i+DG(d-i,n,o,c)}},kG=(e,t)=>{let[n,r]=q(0),[i,a]=q(0),[o,s]=q(!1),[c,l]=q(!1),[u,d]=q(0),[f,p]=q(`bottom`),m,h,g=()=>{clearTimeout(m),h!==void 0&&(rF(h),h=void 0)},_=()=>{let t=e();t&&(r(t.offsetWidth),a(t.offsetHeight))},v=()=>{SL(()=>{d(e=>e+1),_()})},y=J(()=>t()!==null);return yL(()=>{let n=t();n?(p(n.edge),clearTimeout(m),s(!0),h!==void 0&&rF(h),h=nF(()=>{_(),e()?.offsetHeight,l(!0)})):(h!==void 0&&rF(h),l(!1),m=setTimeout(()=>{s(!1)},120)),EL(g)}),yL(()=>{if(!y())return;window.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`scroll`,v);let e=Lj(),t;e&&typeof ResizeObserver<`u`&&(t=new ResizeObserver(v),t.observe(e)),EL(()=>{window.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`scroll`,v),t?.disconnect()})}),{shouldMount:o,isAnimatedIn:c,lastAnchorEdge:f,displayPosition:J(e=>{u();let r=gU(),a=OG({anchor:t(),measuredWidth:n(),measuredHeight:i(),viewportLeft:r.offsetLeft,viewportTop:r.offsetTop,viewportWidth:r.width,viewportHeight:r.height,anchorGapPx:8,viewportPaddingPx:8,offscreenPosition:CM});return a.left===CM.left?e:a},CM),measure:_,clearAnimationHandles:g}},AG={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`}},jG=(e,t)=>{let n=AG[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}`},MG=e=>{let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement:e.ownerDocument?.activeElement??document.activeElement},NG=e=>e.toLowerCase()===`#00000000`?DM:e.toUpperCase(),PG=X(`<input data-react-grab-ignore-events data-react-grab-input type=text autocapitalize=none autocorrect=off autocomplete=off>`),FG=e=>{let[t,n]=rR(e,[`class`,`ref`,`autoFocusSelect`]);return(()=>{var e=PG();return xR(e=>{t.autoFocusSelect&&queueMicrotask(()=>{e.focus(),e.select()}),t.ref?.(e)},e),Z(e,`spellcheck`,!1),bR(e,nR({get class(){return vU(`bg-transparent border-none outline-none text-[var(--rg-text-primary)] p-0 m-0`,t.class)}},n),!1,!1),e})()},IG=`text-[13px] leading-4 font-medium`,LG={position:`absolute`,opacity:0,"pointer-events":`none`,width:`0`,height:`0`,margin:`0`,padding:`0`,overflow:`hidden`},RG=X(`<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">`),zG=X(`<span>`),BG=X(`<span class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)] cursor-text">`),VG=e=>e.length===9?e.slice(0,7):e,HG=e=>{let[t,n]=q(null),r=()=>t()!==null,i=()=>NG(e.value),a,o=!0;EL(()=>{o=!1}),TL(()=>{let t=e.onRegisterTrigger?.(()=>a?.click());EL(()=>t?.())});let s=()=>{let r=t();if(r===null)return;n(null);let i=Az(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=RG(),d=c.firstChild,f=d.firstChild,p=f.nextSibling;Q(c,Y(oR,{get when(){return e.label},children:e=>(()=>{var t=zG();return hR(t,`${IG} text-[var(--rg-text-primary)] truncate min-w-0`),Q(t,e),t})()}),d),Q(d,Y(oR,{get when(){return r()},get fallback(){return(()=>{var e=BG();return e.$$click=e=>{e.preventDefault(),e.stopPropagation(),n(i())},e.$$pointerdown=e=>e.stopPropagation(),Q(e,i),vL(()=>Z(e,`data-react-grab-value`,i())),e})()},get children(){return Y(FG,{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`?xR(m,p):a=p,vL(t=>yR(f,`background-color`,e.value)),vL(()=>p.value=VG(e.value)),c})()},fR([`pointerdown`,`mousedown`,`click`,`input`]),UG=X(`<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>`),WG=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=UG(),o=a.firstChild;return gR(a,`pointerdown`,e.onPointerDown,!0),vL(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&&yR(a,`transform`,s.e=c),l!==s.t&&yR(a,`transition`,s.t=l),u!==s.a&&Z(o,`d`,s.a=u),d!==s.o&&Z(o,`fill`,s.o=d),f!==s.i&&yR(o,`transition`,s.i=f),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a})()},fR([`pointerdown`]),GG=X(`<span>`),KG=X(`<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">`),qG=e=>{let t=()=>e.options.find(t=>t.value===e.value)?.label??e.value;return(()=>{var n=KG(),r=n.firstChild,i=r.firstChild;return Q(n,Y(oR,{get when(){return e.label},get children(){var t=GG();return hR(t,`${IG} text-[var(--rg-text-primary)] truncate min-w-0`),Q(t,()=>e.label),t}}),r),Q(r,Y(WG,{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(),Q(i,t),Q(r,Y(WG,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)}),null),vL(t=>{var n=`Cycle ${e.label??`value`}`,r=`Click to cycle (${e.options.length} options)`;return n!==t.e&&Z(i,`aria-label`,t.e=n),r!==t.t&&Z(i,`title`,t.t=r),t},{e:void 0,t:void 0}),n})()},fR([`pointerdown`,`mousedown`,`click`,`contextmenu`]),JG=e=>e.kind===`numeric`?e:null,YG=e=>e.kind===`color`?e:null,XG=e=>e.kind===`enum`?e:null,ZG=/^[0-9]$/,QG=e=>{let t=Array.from(e),n=t.findIndex(e=>ZG.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=ZG.test(n)?`digit`:`literal`;i.push({kind:r,value:n,digitDistanceFromRight:a}),r===`digit`&&(a+=1)}return{prefixLiterals:r,rightAlignedSegments:i}},$G=X(`<span class=rg-slot-column aria-hidden=true><span class=rg-slot-sizer>0</span><span class=rg-slot-cell>`),eK=X(`<span class="rg-slot-cell rg-slot-exit">`),tK=X(`<span><span class=inline-flex style=flex-direction:row-reverse>`),nK=X(`<span class="inline-block whitespace-pre"aria-hidden=true>`),rK=e=>typeof e==`number`?e:Number.parseFloat(String(e).replace(/[^0-9.-]/g,``))||0,iK=e=>{let t,[n,r]=q(null),i=null;yL(wL(()=>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})),EL(()=>{i!==null&&clearTimeout(i)});let a=()=>({"animation-delay":`${e.delayMs}ms`});return(()=>{var r=$G(),i=r.firstChild.nextSibling,o=t;return typeof o==`function`?xR(o,i):t=i,Q(i,()=>e.digit),Q(r,Y(oR,{get when(){return n()},keyed:!0,children:e=>(()=>{var t=eK();return Q(t,()=>e.digit),vL(n=>{var r=String(e.direction),i=a();return r!==n.e&&Z(t,`data-dir`,n.e=r),n.t=vR(t,i,n.t),n},{e:void 0,t:void 0}),t})()}),null),vL(t=>{var n=String(e.direction),r=a();return n!==t.e&&Z(i,`data-dir`,t.e=n),t.t=vR(i,r,t.t),t},{e:void 0,t:void 0}),r})()},aK=e=>{let t=J(()=>String(e.children??``)),n=J(()=>QG(t())),r=J(wL(()=>rK(e.children),(e,t)=>t===void 0||e===t?0:e>t?1:-1)),i=J(()=>e.direction??r());return(()=>{var r=tK(),a=r.firstChild;return Q(r,Y(aR,{get each(){return n().prefixLiterals},children:e=>(()=>{var t=nK();return Q(t,e),t})()}),a),Q(a,Y(aR,{get each(){return n().rightAlignedSegments},children:e=>Y(oR,{get when(){return e().kind===`digit`},get fallback(){return(()=>{var t=nK();return Q(t,()=>e().value),t})()},get children(){return Y(iK,{get digit(){return Number(e().value)},get direction(){return i()},get delayMs(){return e().digitDistanceFromRight*18}})}})})),vL(n=>{var i=t(),a=`inline-flex ${e.class??``}`,o={...e.style,"--rg-slot-dur":`350ms`};return i!==n.e&&Z(r,`aria-label`,n.e=i),a!==n.t&&hR(r,n.t=a),n.a=vR(r,o,n.a),n},{e:void 0,t:void 0,a:void 0}),r})()},oK=X(`<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">`),sK=X(`<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">`),cK=X(`<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">`),lK=X(`<span>`),uK=X(`<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">`),dK=X(`<span data-react-grab-tailwind-label aria-hidden=true class="text-[10px] leading-4 text-[var(--rg-text-secondary)] tabular-nums">`),fK=Array.from({length:9},(e,t)=>(t+1)*100/10),pK=/^(-?(?:\d+\.?\d*|\.\d+))\s*([a-zA-Z%]*)$/,mK=e=>{let[t,n]=q(null),[r,i]=q(0),[a,o]=q(!1),[s,c]=q(!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(aB(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))};TL(()=>{let e=()=>{d=null,o(!1),c(!1),i(0)};window.addEventListener(`blur`,e),EL(()=>window.removeEventListener(`blur`,e))});let S=()=>!!e.activeKey||a()||s(),ee=()=>{let r=t();if(r===null)return;n(null);let i=r.trim().replace(/(\d),(\d)/g,`$1.$2`).match(pK);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?.()},C=()=>{l()&&(n(null),e.onEditComplete?.())},w=e=>{if(!(e.isComposing||e.keyCode===229)){if(e.stopImmediatePropagation(),e.key===`Enter`){e.preventDefault(),ee();return}e.key===`Escape`&&(e.preventDefault(),C())}},T=()=>{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 ${kM}`}};return(()=>{var r=sK(),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,Q(i,Y(oR,{get when(){return e.emphasized},get children(){var e=oK();return vL(t=>yR(e,`opacity`,l()?0:.55)),e}}),o),Q(d,Y(aR,{each:fK,children:e=>(()=>{var t=cK();return vL(n=>{var r=`${e()}%`,i=S()?.4:0;return r!==n.e&&yR(t,`left`,n.e=r),i!==n.t&&yR(t,`opacity`,n.t=i),n},{e:void 0,t:void 0}),t})()})),Q(m,Y(oR,{get when(){return e.label},children:e=>(()=>{var t=lK();return hR(t,`${IG} text-[var(--rg-text-primary)] truncate min-w-0`),Q(t,e),t})()}),null),Q(m,Y(oR,{get when(){return l()},get fallback(){return(()=>{var t=uK(),n=t.firstChild,r=n.firstChild,i=u;return typeof i==`function`?xR(i,t):u=t,Q(t,Y(oR,{get when(){return e.tailwindLabel},children:e=>(()=>{var t=dK();return Q(t,e),t})()}),n),Q(n,Y(aK,{get children(){return aB(e.value)}}),r),Q(r,()=>e.unit),vL(n=>{var r=`${aB(e.value)}${e.unit}`,i=e.onCommitValue?`text`:`default`;return r!==n.e&&Z(t,`data-react-grab-value`,n.e=r),i!==n.t&&yR(t,`cursor`,n.t=i),n},{e:void 0,t:void 0}),t})()},get children(){return Y(FG,{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:w,onBlur:ee,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()})}}),null),Q(r,Y(oR,{get when(){return e.emphasized},get children(){return[Y(WG,{direction:`left`,get active(){return e.activeKey===`left`},onPointerDown:()=>e.onStep(-1)}),Y(WG,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)})]}}),null),vL(t=>{var n=e.label??`Value`,r=e.min,c=e.max,u=e.value,d=`${aB(e.value)}${e.unit}`,m=T(),h=`${f()}%`,g=+!l(),_=`calc(${f()}% - 1px)`,v=e.activeKey?.9:a()||s()?.35:0;return n!==t.e&&Z(i,`aria-label`,t.e=n),r!==t.t&&Z(i,`aria-valuemin`,t.t=r),c!==t.a&&Z(i,`aria-valuemax`,t.a=c),u!==t.o&&Z(i,`aria-valuenow`,t.o=u),d!==t.i&&Z(i,`aria-valuetext`,t.i=d),t.n=vR(i,m,t.n),h!==t.s&&yR(o,`width`,t.s=h),g!==t.h&&yR(o,`opacity`,t.h=g),_!==t.r&&yR(p,`left`,t.r=_),v!==t.d&&yR(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})()},fR([`pointerdown`,`pointermove`,`pointerup`]),hK=e=>Y(sR,{get children(){return[Y(cR,{get when(){return JG(e.property)},children:t=>Y(mK,{get label(){return iz(()=>!!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}})}),Y(cR,{get when(){return YG(e.property)},children:t=>Y(HG,{get label(){return iz(()=>!!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}})}),Y(cR,{get when(){return XG(e.property)},children:t=>Y(qG,{get label(){return iz(()=>!!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}})})]}}),gK=X(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),_K=e=>Y(GU,{"data-react-grab-ignore-events":!0,"data-react-grab-copy-button":!0,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.onCopy()},get children(){return gK()}}),vK=()=>{let[e,t]=q(!1),n,r=()=>{clearTimeout(n),t(!1)},i=()=>{t(!0),clearTimeout(n),n=setTimeout(()=>{t(!1)},OM)},a=()=>{clearTimeout(n)};return EL(a),{isPending:e,show:i,hide:r,cleanup:a}},yK=X(`<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)]">`),bK=X(`<div class="flex items-center w-full h-[24px]">`),xK=X(`<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">`),SK=X(`<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">`),CK=X(`<span class="font-sans text-[var(--rg-text-secondary)] tabular-nums shrink-0"><span class=text-[11px]></span><span class="text-[9px] ml-px">`),wK=X(`<span aria-hidden=true class="size-[12px] rounded-[3px] border-[var(--rg-border-button)] [border-width:0.5px] border-solid shrink-0">`),TK=X(`<span class="text-[11px] font-sans text-[var(--rg-text-secondary)] shrink-0">`),EK=e=>{let t=XG(e);return t?t.options.find(e=>e.value===t.value)?.label??t.value:``},DK=e=>{let t=[],n,r=!1,i=null,a=()=>{if(!n)return!1;let e=MG(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)}};yL(()=>{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}=_G({});yL(()=>{t.length=e.properties.length});let d;return yL(()=>{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`})}),EL(()=>{d!==void 0&&cancelAnimationFrame(d)}),(()=>{var a=yK(),l=a.firstChild;return a.$$pointermove=()=>{r=!0},xR(e=>{n=e,s(e)},a),xR(c,l),Q(a,Y(aR,{get each(){return e.properties},children:(r,a)=>{let s=()=>a===e.activeIndex;return(()=>{var c=xK();return c.$$click=t=>{t.stopPropagation(),e.onSelect(a)},c.$$mousedown=e=>{let t=n?MG(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`)}),xR(e=>{t[a]=e,EL(()=>{t[a]===e&&(t[a]=void 0)})},c),Q(c,Y(oR,{get when(){return s()},get fallback(){return(()=>{var e=SK(),t=e.firstChild;return Q(t,()=>r().label),Q(e,Y(sR,{get children(){return[Y(cR,{get when(){return JG(r())},children:e=>(()=>{var t=CK(),n=t.firstChild,r=n.nextSibling;return Q(n,()=>aB(e().value)),Q(r,()=>e().unit),t})()}),Y(cR,{get when(){return YG(r())},children:e=>(()=>{var t=wK();return vL(n=>yR(t,`background-color`,e().value)),t})()}),Y(cR,{get when(){return XG(r())},children:e=>(()=>{var t=TK();return Q(t,()=>EK(e())),t})()})]}}),null),e})()},get children(){var t=bK();return Q(t,Y(hK,{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}})),vL(e=>{var t=r().key,n=s()?`true`:void 0;return t!==e.e&&Z(c,`data-react-grab-edit-property`,e.e=t),n!==e.t&&Z(c,`aria-current`,e.t=n),e},{e:void 0,t:void 0}),c})()}}),null),a})()},fR([`pointermove`,`mousedown`,`click`]),OK=(e,t,n)=>e.kind===`color`&&typeof t==`string`&&typeof n==`string`?t.toLowerCase()===n.toLowerCase():t===n,kK=e=>e===`ArrowLeft`?-1:1,AK=e=>{let[t,n]=q(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=kK(t);i=setTimeout(()=>{a=setInterval(()=>{e.step(n,e.isShiftHeld(),e.isAltHeld(),!0)},60)},280)};return TL(()=>{window.addEventListener(`blur`,s),EL(()=>window.removeEventListener(`blur`,s))}),EL(s),{heldDirection:t,pressArrow:(t,r,i,a)=>{if(r)return;let o=kK(t);c(t),n(o),e.step(o,i,a,!1)},releaseKey:e=>{e===r&&s()},cancelRepeat:s}},jK=(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},MK=(e,t,n,r,i)=>{if(e.kind===`enum`)return jK(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=oB(jz(n,a,o));if(t!==e.value)return t}}let s=n?10:1,c=oB(jz(e.value+t*s,a,o));return c===e.value?null:c},NK=/^-?\d*\.?\d+$/,PK=e=>NK.test(e),FK=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,``),IK=e=>{if(e.kind!==`enum`)return[];let t=[];for(let n of e.options){let e=FK(n.value),r=FK(n.label);e&&t.push(e),r&&r!==e&&t.push(r)}return t},LK=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(let e of r.tailwindAliases){let i=FK(e);i&&t.push({property:r,originalIndex:n,kind:`alias`,term:i})}for(let e of IK(r))t.push({property:r,originalIndex:n,kind:`enum-option`,term:e});let i=FK(r.label);i&&t.push({property:r,originalIndex:n,kind:`name`,term:i});let a=FK(r.key);a&&a!==i&&t.push({property:r,originalIndex:n,kind:`name`,term:a});let o=FK(`${r.label} ${r.key}`);o&&t.push({property:r,originalIndex:n,kind:`label`,term:o})}return t},RK=(e,t)=>{if(t.kind===`alias`||t.kind===`enum-option`||t.kind===`name`)return e===t.term?MM+t.term.length:t.term.startsWith(e)||e.startsWith(t.term)?NM+Math.min(e.length,t.term.length):null;let n=t.term.indexOf(e);return n===-1?null:n===0?PM-t.term.length*1:FM-n*100-t.term.length*1},zK=(e,t,n,r)=>{let i=e.get(t.key);i&&i.score>=r||e.set(t.key,{property:t,score:r,originalIndex:n})},BK=e=>{let t=LK(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];zK(t,c,s,i-a)}};return{search:n=>{let i=FK(n);if(!i||PK(i))return e;let a=new Map;r(a,jB(n),AM),r(a,MB(n),jM);for(let e of t){let t=RK(i,e);t!==null&&zK(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)}}},VK=(e,t)=>e.kind===t.kind&&!OK(e,t.value,e.original),HK=e=>{let{initialProperties:t,searchQuery:n}=e,[r,i]=q({}),a=BK(t),o=J(()=>{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=J(()=>{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=VK(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&&VK(n,t))return!0}return!1},hasChangedStyleFor:e=>{let t=r()[e],n=s.get(e);return!!(t&&n&&VK(n,t))}}},UK=new Map;for(let e of Yz)for(let t of e)UK.set(t.key,t.longhands);WK=e=>{if(e.includes(`,`))return e.split(`,`);let t=UK.get(e);return t?[...t]:[e]},GK=/^-?(?:\d+\.?|\d*\.\d*)?$/,KK=e=>GK.test(e),qK=e=>{let t=e.startsWith(`-`);return{isNegative:t,base:t?e.slice(1):e}},JK=/^([a-z-]+)-(-?\d+(?:\.\d+)?)$/,YK=/^(.+?)-\[(.+)]$/,XK=/^(-?\d*\.?\d+)\s*([a-zA-Z%]*)$/,ZK=/^(-?\d*\.?\d+)(px|rem)?$/i,QK=/^(?:length|size):/i,$K=new Set([`opacity`,`border-width`,`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`,`z-index`,`font-weight`]),eq=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`numeric`)return n;return null},tq=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`enum`)return n;return null},nq=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`color`)return n;return null},rq=e=>{let t=e.replace(/^(?:color|length|size):/i,``).trim();return/(?:var|url)\(/i.test(t)?t:t.replace(/_/g,` `)},iq=e=>{let t=e.lastIndexOf(`:`),n=t>=0?e.slice(t+1):e;return(n.startsWith(`!`)?n.slice(1):n).toLowerCase()},aq=(e,t)=>{let n=e.match(ZK);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},oq=(e,t)=>{let n=WK(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())},sq=(e,t)=>oB(jz(t,e.min,e.max)),cq=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 oq(t,e).length>0},c=e=>{let t=e.trim().replace(/(\d),(\d)/g,`$1.$2`).match(XK);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):KK(e)},d=J(()=>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=sq(t,n.value);return s!==t.value&&a(t,s),!0},p=(e,n)=>{let r=eq(t,e);if(r)return r.unit===`px`?(o(!0),a(r,sq(r,n),{shouldCompact:!0}),!0):!1;let i=oq(t,e);return i.length===0?!1:(o(!0),SL(()=>{for(let e of i)a(e,sq(e,n),{shouldCompact:!0})}),!0)},m=(e,n)=>{let r=TB(e);if(!r)return!1;let i=nq(t,r);if(!i)return!1;let s=n===null?DB(e):Az(n);return s?(o(!0),a(i,s,{shouldCompact:!0}),!0):!1},h=e=>{let t=e.trim(),n=t.match(YK);if(!n)return!1;let r=n[2],i=rq(r);if(m(t,i))return!0;let a=aq(i,QK.test(r.trim()));if(a===null)return!1;let{isNegative:o,base:s}=qK(n[1]),c=FB(iq(s));return c?p(c,o?-a:a):!1},g=e=>{if(h(e))return;let n=SB(e),{isNegative:r,base:i}=qK(n),c=i.replace(/-\d*$/,``).replace(/-$/,``),l=c?FB(c):null;if(l&&s(l)&&o(!0),!r){if(m(n,null))return;let e=IB(n);if(e){let n=tq(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(JK);if(!u)return;let d=FB(u[1]);if(!d)return;let f=Number.parseFloat(u[2]);if(!Number.isFinite(f))return;let p=r?-f:f,g=$K.has(d)?p:p*4,_=eq(t,d);if(_){a(_,sq(_,g),{shouldCompact:!0});return}if(!r){let e=tq(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=oq(t,d);v.length!==0&&SL(()=>{for(let e of v)a(e,sq(e,g),{shouldCompact:!0})})},_=e=>{if(IB(e))return!0;let{base:n}=qK(e),r=n.match(JK);if(!r)return!1;let i=FB(r[1]);return i?s(i)?!0:tq(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=SB(t),r=t.split(/\s+/).filter(Boolean);if(r.length>1&&!_(n)){for(let e of r)g(e);return}g(t)}}},lq=X(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),uq=X(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),dq=X(`<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]">`),fq=X(`<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>`),pq=X(`<div>`),mq=X(`<div role=dialog aria-modal=true aria-label="Style element"data-react-grab-ignore-events data-react-grab-edit-panel>`),hq=X(`<div class="flex items-center justify-center w-full px-3 py-1.5 min-h-[28px]">`),gq=e=>Y(oR,{get when(){return e.state},children:t=>Y(oR,{keyed:!0,get when(){return t().element},children:n=>Y(_q,{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}})})}),_q=e=>{let t=e.state.properties,n,r=e.state.preview,[i,a]=q(e.state.initialSearchQuery??``),[o,s]=q(null),[c,l]=q(null),u=HK({initialProperties:t,searchQuery:()=>o()??i()}),d=()=>{let e=u.filteredProperties().findIndex(e=>e.kind===`numeric`);return e>0?e:0},[f,p]=q(d()),m=J(()=>u.hasPendingStyles()),h=J(()=>m()||!!e.state.hasSessionEdits),[g,_]=q(!1),v,y,b,x=!1,[S,ee]=q(!1),C=J(()=>S()||m()),[w,T]=q(!1),E=WB(),D=J(()=>yU({tagName:e.state.tagName,componentName:e.state.componentName})),O=J(()=>{let e=u.filteredProperties();return e.length===0?null:e[Math.min(Math.max(0,f()),e.length-1)]}),te,ne=kG(()=>te,e.position),k=e=>{l(e),clearTimeout(v),v=setTimeout(()=>{l(t=>t===e?null:t)},100)},re=J(()=>C()&&!w());yL(()=>{let t=re();e.onInteractingChange?.(t)});let ie=()=>{ee(!0),clearTimeout(y),y=setTimeout(()=>{ee(!1)},150)},ae=()=>{queueMicrotask(()=>{n&&MG(n)!==n&&mU(n,{preventScroll:!0})})},oe=()=>{o()===null&&s(i())},se=()=>{x=!1,clearTimeout(b)},ce=()=>{x=!1,clearTimeout(b),b=setTimeout(()=>{x=!0},500)},le=e=>{let t=e.trim(),n=t.replace(/^-/,``).replace(`.`,``);/[a-z%]+$/i.test(t)||n.length>1?ce():se()},ue=e=>{if(!x)return e;let t=i();if(!t||!e.startsWith(t))return se(),e;let n=e.slice(t.length);return/^[-.\d]/.test(n)?(se(),n):e},de=e=>{if(!x||e.metaKey||e.ctrlKey||e.altKey||!/^[-.\d]$/.test(e.key))return!1;e.preventDefault(),e.stopImmediatePropagation(),se();let t=e.key;return n&&(n.value=t),Se.tryApplyNumericValue(t)?(oe(),a(t),le(t),ae(),!0):(a(t),ae(),!0)},fe=()=>{se(),s(null),_(!1)},pe=(t,n,i={})=>{u.applyStyle(t,n),r.apply(t.cssProperties,sB(t,n)),e.onPendingEditsChange?.(u.buildPendingEdits()),ie(),i.isFromKeyRepeat||Te.hide(),i.flashDirection&&k(i.flashDirection===1?`right`:`left`),i.shouldFocus&&ae(),i.shouldCompact&&_(!0),i.source===`keyboard`&&E.arm()},me=BB(e=>e.shiftKey),he=BB(e=>e.altKey),ge=(t,n,r,i,a)=>{let o=O();if(!o)return null;let s=MK(o,t,n,r,e.state.designTokens);return s===null?(k(t===1?`right`:`left`),null):(pe(o,s,{flashDirection:t,shouldFocus:!0,isFromKeyRepeat:i,source:a}),o)},_e=(e,t,n,r)=>{ge(e,t,n,r,`keyboard`)&&_(!0)},ve=e=>{ge(e,!1,!1,!1,`pointer`)},ye=AK({step:_e,isShiftHeld:me,isAltHeld:he}),be=(e,t)=>{let n=O();if(n){if(n.kind===`numeric`&&typeof e==`number`){let r=oB(jz(e,n.min,n.max));r!==n.value&&pe(n,r,{source:t});return}typeof e==`string`&&(OK(n,e,n.value)||pe(n,e,{source:t}))}},xe=J(()=>{if(!me())return null;let e=O();return!e||e.kind!==`numeric`?null:jG(e.key,e.value)}),Se=cq({initialProperties:t,searchQuery:i,isCompact:g,activeProperty:O,commit:(e,t,n)=>{pe(e,t,{...n,source:`keyboard`})},setIsCompact:_}),Ce=J(()=>g()&&i()!==``&&Se.isInlineNumericEdit()),we=()=>{Te.hide(),E.clear(),e.onSubmit(u.buildPendingEdits())},Te=vK(),Ee,De=()=>{Ee&&(Ee.classList.remove(`animate-shake`),Ee.offsetWidth,Ee.classList.add(`animate-shake`))},Oe=t=>{Te.hide(),t===`discard`&&r.restore(),e.onDismiss()},ke=e=>{if(ye.cancelRepeat(),e===`pointer`&&E.clear(),Te.isPending()){Oe(`discard`);return}if(!h()){Oe(r.hasAppliedStyles()?`discard`:`preserve`);return}let t=g();fe(),!(e===`keyboard`&&t)&&(Te.show(),De())},Ae=e=>{let t=u.filteredProperties();t.length!==0&&(p(n=>(n+e+t.length)%t.length),fe())},je=()=>{E.clear(),Te.hide()},Me=[],Ne=e=>(Me.push(e),()=>{Me=Me.filter(t=>t!==e)}),Pe=()=>Me[Me.length-1]??null,Fe=(e,t)=>{if(O()?.kind===`color`){t.repeat||Pe()?.();return}ye.pressArrow(e,t.repeat,t.shiftKey,t.altKey)},Ie={ArrowUp:()=>Ae(-1),ArrowDown:()=>Ae(1),ArrowLeft:e=>Fe(`ArrowLeft`,e),ArrowRight:e=>Fe(`ArrowRight`,e),Tab:e=>Ae(e.shiftKey?-1:1),Enter:()=>{if(Te.isPending())return;let e=O(),t=Pe();if(e?.kind===`color`&&!u.hasChangedStyleFor(e.key)&&t&&!h()){t();return}we()},Escape:()=>ke(`keyboard`)},Le=e=>{if(e.isComposing||e.keyCode===229)return;if(Te.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=Ie[e.key];t&&(e.preventDefault(),e.stopImmediatePropagation(),t(e))};TL(()=>{queueMicrotask(()=>{if(mU(n,{preventScroll:!0}),n){let e=n.value.length;n.setSelectionRange(e,e)}}),ne.measure();let e=i();e&&Se.applyTailwindClass(e);let t=CG({isOpen:()=>!0,onDismiss:ke,shouldIgnoreKeyboardEvent:e=>{let t=e.composedPath()[0];return Te.isPending()&&t instanceof HTMLElement&&t.closest(`[data-react-grab-discard-button]`)!==null},shouldIgnoreRightClick:!0,shouldIgnoreInputEvents:!0}),r=zj(e=>{Fz(e,`data-react-grab-input`)||de(e)||Le(e)}),a=zj(e=>{ye.releaseKey(e.key)}),o=zj(e=>{e.pointerType===`mouse`&&(Te.isPending()||E.consume()&&h()&&ke(`pointer`))});window.addEventListener(`keydown`,r,{capture:!0}),window.addEventListener(`keyup`,a,{capture:!0}),window.addEventListener(`pointermove`,o,{capture:!0}),EL(()=>{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),Te.cleanup(),ne.clearAnimationHandles(),ee(!1)})});let A=e=>{p(e),ae()};return Y(oR,{get when(){return ne.shouldMount()},get children(){var e=mq();gR(e,`contextmenu`,SG,!0),gR(e,`click`,SG,!0),gR(e,`mousedown`,SG,!0),gR(e,`pointerdown`,SG,!0);var t=te;return typeof t==`function`?xR(t,e):te=e,yR(e,`z-index`,`${Xj}`),yR(e,`--rg-edit-list-max-h`,`280px`),Q(e,Y(LU,{ref:e=>Ee=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(${ye.heldDirection()*2}px)`,transition:`transform 280ms ${kM}`}},get children(){return[Y(oR,{get when(){return Te.isPending()},get fallback(){return Y(oR,{get when(){return!g()},get children(){var e=pq();return e.addEventListener(`mouseleave`,()=>T(!1)),e.addEventListener(`mouseenter`,()=>T(!0)),Q(e,Y(jU,{get tagName(){return D().tagName},get componentName(){return D().componentName},isClickable:!1,onClick:()=>{},shrink:!0}),null),Q(e,Y(oR,{get when(){return h()},get children(){return Y(_K,{onCopy:we})}}),null),vL(()=>hR(e,vU(`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=dq(),t=e.firstChild.nextSibling;return Q(t,Y(GU,{"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`cancel`,onClick:e=>{e.preventDefault(),e.stopPropagation(),je()},get children(){return lq()}}),null),Q(t,Y(GU,{variant:`destructive`,"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`confirm`,onClick:e=>{e.preventDefault(),e.stopPropagation(),Oe(`discard`)},get children(){return uq()}}),null),e}}),(()=>{var e=fq(),t=e.firstChild;return t.$$keydown=Le,t.$$input=e=>{let t=ue(e.currentTarget.value);if(t!==e.currentTarget.value&&(e.currentTarget.value=t),Se.tryApplyNumericValue(t)){oe(),a(t),le(t),ae();return}if(se(),Se.isInlineNumericDraft(t)){oe(),a(t),ae();return}a(t),s(null),p(t.trim()===``?d():0),fe(),Se.applyTailwindClass(t)},xR(e=>{n=e},t),Z(t,`spellcheck`,!1),vL(n=>{var r=Ce()?``:`[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=Ce()?LG:void 0,a=Ce()?-1:0,o=g()?O()?.label??`Search property`:`Search property`;return r!==n.e&&hR(e,n.e=r),n.t=vR(e,i,n.t),a!==n.a&&Z(t,`tabindex`,n.a=a),o!==n.o&&Z(t,`placeholder`,n.o=o),n},{e:void 0,t:void 0,a:void 0,o:void 0}),vL(()=>t.value=i()),e})(),Y(oR,{get when(){return u.filteredProperties().length>0},get children(){var e=pq();return Q(e,Y(DK,{get properties(){return u.filteredProperties()},get activeIndex(){return f()},get activeKey(){return c()},onHoverIndex:p,onSelect:A,onStep:ve,onCommit:be,onColorPickerRegister:Ne,onEditComplete:ae,onInvalidCommit:De,onInteract:ie,isAdjusting:S,get activeTailwindLabel(){return xe()}})),vL(t=>{var n=g()?``:`[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start w-full self-stretch antialiased`,r=g()?LG:void 0;return n!==t.e&&hR(e,t.e=n),t.t=vR(e,r,t.t),t},{e:void 0,t:void 0}),e}}),Y(oR,{get when(){return iz(()=>!!g())()&&O()},children:e=>(()=>{var t=hq();return t.$$mousedown=e=>e.preventDefault(),Q(t,Y(hK,{get property(){return e()},get activeKey(){return c()},onStep:ve,onCommit:be,onEditComplete:ae,onInvalidCommit:De,onInteract:ie,onColorPickerRegister:Ne,showLabel:!1,get tailwindLabel(){return xe()},emphasized:!0})),t})()})]}})),vL(t=>{var n=g()?`true`:`false`,r=vU(`fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none`,ne.isAnimatedIn()?`transition-[opacity,transform] duration-220 ease-spring`:`transition-[opacity,transform] duration-120 ease-drawer`),i=`${ne.displayPosition().top}px`,a=`${ne.displayPosition().left}px`,o=ne.isAnimatedIn()?`auto`:`none`,s=wM[ne.lastAnchorEdge()],c=ne.isAnimatedIn()?`1`:`0`,l=ne.isAnimatedIn()?`scale(1)`:`scale(0.92)`;return n!==t.e&&Z(e,`data-rg-compact`,t.e=n),r!==t.t&&hR(e,t.t=r),i!==t.a&&yR(e,`top`,t.a=i),a!==t.o&&yR(e,`left`,t.o=a),o!==t.i&&yR(e,`pointer-events`,t.i=o),s!==t.n&&yR(e,`transform-origin`,t.n=s),c!==t.s&&yR(e,`opacity`,t.s=c),l!==t.h&&yR(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}})},fR([`pointerdown`,`mousedown`,`click`,`contextmenu`,`input`,`keydown`]),vq=X(`<div data-react-grab-ignore-events>`),yq=e=>{let t,n=()=>e.interactive!==!1,r=kG(()=>t,()=>e.position);return TL(()=>{r.measure();let t=e.onDismiss?CG({isOpen:()=>!!e.position,onDismiss:e.onDismiss}):void 0;EL(()=>{r.clearAnimationHandles(),t?.()})}),Y(oR,{get when(){return r.shouldMount()},get children(){var i=vq(),a=t;return typeof a==`function`?xR(a,i):t=i,bR(i,nR(()=>({[e.dataAttribute]:``}),{get class(){return vU(`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":`${Xj}`,"pointer-events":n()&&r.isAnimatedIn()?`auto`:`none`,"transform-origin":wM[r.lastAnchorEdge()],opacity:r.isAnimatedIn()?`1`:`0`,transform:r.isAnimatedIn()?`scale(1)`:`scale(0.92)`}},onPointerDown:SG,onMouseDown:SG,onClick:SG,onContextMenu:SG}),!1,!0),Q(i,()=>e.children),i}})},bq=e=>{let t=vG({clearActiveOnPointerLeave:!0,highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:bM}});return Y(yq,{get position(){return e.position},dataAttribute:`data-react-grab-toolbar-menu`,get onDismiss(){return e.onDismiss},get children(){return Y(yG.Panel,{class:`overflow-hidden`,style:{"min-width":`100px`},get children(){return Y(yG.Provider,{store:t,get children(){return Y(yG.List,{label:`Default action`,get children(){return Y(iR,{get each(){return e.actions},children:t=>{let n=()=>t.id===e.defaultActionId;return Y(yG.Item,{get value(){return t.id},role:`menuitemradio`,get checked(){return n()},onSelect:()=>{e.onSetDefaultAction(t.id),e.onDismiss()},get children(){return[Y(yG.Label,{get class(){return n()?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)]`},get children(){return t.label}}),Y(oR,{get when(){return t.shortcut},children:e=>Y(yG.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})}})}})}})}})}})},xq=X(`<span aria-hidden=true class="shrink-0 font-mono text-[11px] leading-4 text-[var(--rg-text-secondary)] opacity-60 mr-1">`),Sq=X(`<span class=text-[var(--rg-text-secondary)]>.`),Cq=X(`<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">`),wq=e=>{let t=()=>e.state?.activeIndex??0,n=vG({value:()=>String(t()),highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:bM}});return Y(yq,{get position(){return e.position},dataAttribute:`data-react-grab-hierarchy-menu`,interactive:!1,get children(){return Y(yG.Panel,{class:`overflow-hidden`,style:{"min-width":`160px`},get children(){return Y(yG.Provider,{store:n,get children(){return Y(yG.List,{label:`Navigate element hierarchy`,get children(){return Y(iR,{get each(){return e.state?.items??[]},children:(e,n)=>Y(yG.Item,{get value(){return String(n())},role:`menuitemradio`,get checked(){return n()===t()},get children(){var r=Cq(),i=r.firstChild;return Q(r,Y(oR,{get when(){return e.depth>0},get children(){var t=xq();return Q(t,()=>e.isLast?`└─`:`├─`),vL(n=>yR(t,`padding-left`,`${(e.depth-1)*12}px`)),t}}),i),Q(i,Y(oR,{get when(){return e.componentName},get children(){return[iz(()=>e.componentName),Sq()]}}),null),Q(i,()=>e.tagName,null),vL(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}})})}})}})}})}})},Tq=e=>[Y(uU,{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}}),Y(fU,{get visible(){return e.isFrozen??!1}}),Y(oR,{get when(){return iz(()=>!!e.selectionLabelVisible)()&&(e.frozenLabelEntries?.length??0)>0},get children(){return Y(aR,{get each(){return e.frozenLabelEntries??[]},children:(t,n)=>Y(SW,{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}})})}}),Y(oR,{get when(){return iz(()=>!!e.selectionLabelVisible)()&&e.pendingShiftPreviewEntry},children:e=>Y(SW,{get tagName(){return e().tagName},get componentName(){return e().componentName},get selectionBounds(){return e().bounds},get mouseX(){return e().mouseX},visible:!0})}),Y(oR,{get when(){return iz(()=>!!(e.selectionLabelVisible&&e.selectionBounds))()&&(e.frozenLabelEntries?.length??0)===0},get children(){return Y(SW,{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&&IF(e.selectionFilePath,e.selectionLineNumber)},get isContextMenuOpen(){return e.contextMenuPosition!==null}})}}),Y(aR,{get each(){return e.labelInstances??[]},children:t=>Y(SW,{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`)||!oz(n.element)))return()=>e.onShowContextMenuInstance?.(n.id)},onHoverChange:n=>e.onLabelInstanceHoverChange?.(t().id,n)})}),Y(oR,{get when(){return e.toolbarVisible!==!1},get children(){return Y(XW,{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}})}}),Y(EG,{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??(()=>{})}}),Y(bq,{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??(()=>{})}}),Y(wq,{get position(){return e.hierarchyMenuPosition??null},get state(){return e.hierarchyState}}),Y(gq,{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 Dq(e){let t=e[PR];if(!t&&(Object.defineProperty(e,PR,{value:t=new Proxy(e,Kq)}),!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 Oq(e){let t;return typeof e==`object`&&!!e&&(e[PR]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function kq(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Hq])return n;if(!Oq(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=kq(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=kq(i,t))!==i&&(e[a]=r))}return e}function Aq(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function jq(e,t,n){if(e[t])return e[t];let[r,i]=q(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function Mq(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===PR||t===Uq?n:(delete n.value,delete n.writable,n.get=()=>e[PR][t],n)}function Nq(e){DL()&&jq(Aq(e,Uq),Gq)()}function Pq(e){return Nq(e),Reflect.ownKeys(e)}function Fq(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[Wq]&&e[Wq][t]&&i!==void 0&&e[Wq][t].$()):(e[t]=n,e[Wq]&&e[Wq][t]&&i===void 0&&e[Wq][t].$());let o=Aq(e,Uq),s;if((s=jq(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=jq(o,`length`,a))&&s.$(e.length)}(s=o[Gq])&&s.$()}function Iq(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];Fq(e,i,t[i])}}function Lq(e,t){if(typeof t==`function`&&(t=t(e)),t=kq(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&&Fq(e,n,r)}Fq(e,`length`,r)}else Iq(e,t)}function Rq(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++)Rq(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&Rq(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)Rq(e,[r].concat(t),n);return}else if(t.length>1){Rq(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=kq(a),r===void 0||Oq(i)&&Oq(a)&&!Array.isArray(a)?Iq(i,a):Fq(e,r,a))}function zq(...[e,t]){let n=kq(e||{}),r=Array.isArray(n),i=Dq(n);function a(...e){SL(()=>{r&&e.length===1?Lq(n,e[0]):Rq(n,e)})}return[i,a]}function Bq(e){return t=>{if(Oq(t)){let n;(n=qq.get(t))||qq.set(t,n=new Proxy(t,Jq)),e(n)}return t}}var 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,hJ,gJ,_J,vJ,yJ,bJ,xJ,SJ,CJ,wJ,TJ,EJ,DJ,OJ,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=t((()=>{GB(),pL(),rU(),Vq=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
197
|
+
@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}`,Hq=Symbol(`store-raw`),Uq=Symbol(`store-node`),Wq=Symbol(`store-has`),Gq=Symbol(`store-self`),Kq={get(e,t,n){if(t===Hq)return e;if(t===PR)return n;if(t===IR)return Nq(e),n;let r=Aq(e,Uq),i=r[t],a=i?i():e[t];if(t===Uq||t===Wq||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);DL()&&(typeof a!=`function`||e.hasOwnProperty(t))&&!(n&&n.get)&&(a=jq(r,t,a)())}return Oq(a)?Dq(a):a},has(e,t){return t===Hq||t===PR||t===IR||t===Uq||t===Wq||t===`__proto__`?!0:(DL()&&jq(Aq(e,Wq),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Pq,getOwnPropertyDescriptor:Mq},qq=new WeakMap,Jq={get(e,t){if(t===Hq)return e;let n=e[t],r;return Oq(n)?qq.get(n)||(qq.set(n,r=new Proxy(n,Jq)),r):n},set(e,t,n){return Fq(e,t,kq(n)),!0},deleteProperty(e,t){return Fq(e,t,void 0,!0),!0}},Yq=new WeakMap,Xq=new WeakMap,Zq=()=>{Yq=new WeakMap,Xq=new WeakMap},Qq=(e,t,n)=>{let r=Xq.get(e);if(r&&n-r.timestamp<200)return r.borderRadius;let i=(t??window.getComputedStyle(e)).borderRadius||`0px`;return Xq.set(e,{borderRadius:i,timestamp:n}),i},$q=e=>{let t=performance.now(),n=Yq.get(e);if(n&&t-n.timestamp<16)return n.bounds;let r=e.getBoundingClientRect(),i={borderRadius:Qq(e,null,t),height:r.height,width:r.width,x:r.left,y:r.top};return Yq.set(e,{bounds:i,timestamp:t}),i},eJ=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),tJ=e=>({selectionInteractionLockDepth:0,wasActivatedByToggle:!1,pendingCommentMode:!1,keyHoldDuration:e.keyHoldDuration,dragStart:{x:Uj,y:Uj},copyStart:{x:Uj,y:Uj},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}),nJ=e=>{let[t,n]=zq(tJ(e)),[r,i]=q({x:Uj,y:Uj}),[a,o]=q(0),[s,c]=q({state:`idle`}),l=e=>{n(Bq(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:()=>{SL(()=>{c({state:`active`,phase:`hovering`,isPromptMode:!1,isPendingDismiss:!1}),n(`activationTimestamp`,Date.now()),n(`previouslyFocusedElement`,document.activeElement)})},deactivate:()=>{SL(()=>{c({state:`idle`}),n(Bq(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`&&SL(()=>{n(Bq(e=>{e.frozenElement=null,e.frozenElements=[],e.frozenDragRect=null})),d(`hovering`)})},startDrag:(e,t)=>{s().state===`active`&&SL(()=>{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`)&&SL(()=>{n(`dragStart`,{x:-1e3,y:-1e3}),d(`justDragged`)})},cancelDrag:()=>{let e=s();e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)&&SL(()=>{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?SL(()=>{u(),c({state:`active`,phase:`hovering`,isPromptMode:!1,isPendingDismiss:!1})}):f.deactivate())},enterPromptMode:(e,t)=>{let{x:r}=eJ($q(t));SL(()=>{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}=eJ($q(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)=>{SL(()=>{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&&SL(()=>{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}=eJ($q(t));SL(()=>{n(`contextMenuPosition`,e),n(`contextMenuElement`,t),n(`contextMenuClickOffset`,{x:e.x-r,y:e.y-i})})},hideContextMenu:()=>{SL(()=>{n(`contextMenuPosition`,null),n(`contextMenuElement`,null),n(`contextMenuClickOffset`,null)})},updateContextMenuPosition:()=>{let e=t.contextMenuElement,r=t.contextMenuClickOffset;if(!e||!r||!oz(e))return;let{x:i,y:a}=eJ($q(e));n(`contextMenuPosition`,{x:i+r.x,y:a+r.y})}};return{store:t,actions:f,pointer:r,viewportVersion:a,current:s}},rJ=e=>{if(!document.body)return;let t=document.querySelectorAll(`[${Bj}]`);for(let n of t)n!==e&&n.parentNode!==e&&(n.shadowRoot||n.remove());document.body.appendChild(e)},iJ=e=>{if(document.body){rJ(e);return}let t=()=>{document.removeEventListener(`DOMContentLoaded`,t),rJ(e)};document.addEventListener(`DOMContentLoaded`,t,{once:!0})},aJ=e=>{let t=document.querySelectorAll(`[${Bj}]`);for(let e of t){let t=e.shadowRoot?.querySelector(`[${Bj}]`);if(t instanceof HTMLDivElement)return{root:t,host:e};e.remove()}let n=document.createElement(`div`);n.setAttribute(Bj,`true`),HM(n),n.style.zIndex=String(Xj),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=BM();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(Bj,`true`),r.appendChild(o),iJ(n),setTimeout(()=>{rJ(n)},SM),{root:o,host:n}},oJ=e=>{let[t,n]=q(void 0),r=0;return yL(wL(e,e=>{let t=++r;if(!e){n(void 0);return}let i=BH(e)??void 0;n(i),MH(e).then(e=>{r===t&&n(e??i)}).catch(()=>{r===t&&n(i)})})),[t,n]},sJ=[`data-theme`,`data-mode`,`data-color-scheme`,`data-bs-theme`,`data-mui-color-scheme`,`data-mantine-color-scheme`],cJ=[{attribute:`data-dark`,theme:`dark`},{attribute:`data-light`,theme:`light`}],lJ=(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},uJ=(e,t=0)=>{let n=Az(e),r=n?hz(n):null;return!r||r.alpha<=t?null:lJ(r.red,r.green,r.blue)},dJ=e=>{let t=uJ(e);return t===null?null:t<.18?`dark`:`light`},fJ=e=>dJ(getComputedStyle(e).backgroundColor),pJ=()=>{let e=uJ(getComputedStyle(document.documentElement).color,mM);return e===null?null:e>.6?`dark`:null},mJ=()=>{let e=document.createElement(`div`);e.style.cssText=`position:fixed;width:0;height:0;background-color:Canvas!important`,document.documentElement.appendChild(e);let t=dJ(getComputedStyle(e).backgroundColor);return e.remove(),t},hJ=e=>{let t=e.toLowerCase();return t===`dark`?`dark`:t===`light`?`light`:null},gJ=e=>{let t=e.style.colorScheme||getComputedStyle(e).colorScheme;return t?t.trim().toLowerCase().split(/\s+/):[]},_J=e=>{let t=gJ(e),n=t.includes(`dark`);return n===t.includes(`light`)?null:n?`dark`:`light`},vJ=e=>{if(e.classList.contains(`dark`))return`dark`;if(e.classList.contains(`light`))return`light`;for(let t of sJ){let n=e.getAttribute(t);if(!n)continue;let r=hJ(n);if(r)return r}for(let{attribute:t,theme:n}of cJ)if(e.hasAttribute(t))return n;return null},yJ=(e,t)=>{for(let n of e){if(!n)continue;let e=t(n);if(e)return e}return null},bJ=()=>{let e=[document.documentElement,document.body],t=[document.body,document.documentElement];return yJ(e,vJ)??yJ(e,_J)??yJ(t,fJ)??pJ()??mJ()??`light`},xJ=e=>e===`dark`?`light`:`dark`,SJ=()=>{let e=[];for(let t of[document.documentElement,document.body]){if(!t)continue;e.push(t.className);for(let n of sJ)e.push(t.getAttribute(n)??``);for(let{attribute:n}of cJ)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(`|`)},CJ={attributes:!0,attributeFilter:[`class`,`style`,...sJ,...cJ.map(({attribute:e})=>e)]},wJ=(e,t)=>{let n=null,r=null,i=null,a=()=>{let i=SJ();if(i===r&&n!==null)return getComputedStyle(document.body??document.documentElement).backgroundColor,n;r=i;let a=xJ(bJ());return a!==n&&(n=a,e.setAttribute(`data-rg-theme`,a),t?.(a)),a},o=()=>{i===null&&(i=nF(()=>{i=null,a()}))},s=a(),c=new MutationObserver(o);c.observe(document.documentElement,CJ);let l=null;document.body?c.observe(document.body,CJ):(l=new MutationObserver(()=>{document.body&&(l.disconnect(),l=null,c.observe(document.body,CJ),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&&rF(i)}}},TJ=()=>{},EJ=()=>({activate:TJ,deactivate:TJ,toggle:TJ,comment:TJ,isActive:()=>!1,isEnabled:()=>!1,setEnabled:TJ,getToolbarState:()=>null,setToolbarState:TJ,onToolbarStateChange:()=>TJ,reset:TJ,dispose:TJ,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:TJ,registerPlugin:TJ,unregisterPlugin:TJ,getPlugins:()=>[],getDisplayName:()=>null}),DJ=()=>{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})}}},OJ=(e,t=`Unknown error`)=>e instanceof Error&&e.message?e.message:t,kJ=e=>e instanceof Error?e:Error(String(e)),AJ=e=>({functionName:e.functionName,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,isServer:e.isServer,isSymbolicated:e.isSymbolicated}),jJ=async(e,t)=>{let n={maxLines:t},[r,i,a,o]=await Promise.all([$H(e,n),ZH(e,n),zH(e),jH(e)]);return{tagName:RM(e),componentName:a?.componentName??void 0,content:`[${r}]`,source:a,stackContext:i,frames:(o??[]).map(AJ)}},MJ=async(e,t)=>{let n=await Promise.all(e.map(e=>jJ(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(`
|
|
198
|
+
`),entries:i}:null},NJ=(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}))},PJ=async(e,t,n,r)=>{await t.onBeforeCopy(n);let i=!1,a=``;try{let o=e.getContent?{content:await e.getContent(n)}:await MJ(n,e.maxContextLines),s=o?.content;if(s?.trim()){let c=await t.transformCopyContent(s,n);a=r?`${r}\n${c}`:c,i=nU(a,{componentName:e.componentName,entries:NJ(o,a,r)})}}catch(e){t.onCopyError(kJ(e))}return i&&t.onCopySuccess(n,a),t.onAfterCopy(n,i),i},FJ=(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)},IJ=(e,t)=>e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top,LJ=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}),RJ=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=jz(Math.ceil(e.width/32),3,20),u=jz(Math.ceil(e.height/32),3,20),d=l*u,f=d>100?Math.sqrt(100/d):1,p=jz(Math.floor(l*f),3,20),m=jz(Math.floor(u*f),3,20),h=new Set,g=[],_=(e,r)=>{let i=jz(Math.round(e),0,t-1),a=jz(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},zJ=(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=RJ(e);CF();try{for(let e of a){let t=document.elementsFromPoint(e.x,e.y);for(let e of t)i.add(e)}}finally{wF()}let o=[];for(let e of i)!n&&oF(e)||Rj(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=FJ(r,i),a=t.width*t.height;a>0&&n/a>=.75&&c.push(e)}else IJ(i,r)&&c.push(e)}return LJ(c)},BJ=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})},VJ=(e,t,n=!0)=>BJ(zJ(e,t,n)),HJ=(e,t)=>e.width<=0?0:jz((t.x-e.x)/e.width,0,1),UJ=()=>{Zq(),PF(),hF()},WJ=e=>({borderRadius:`0px`,height:e.height,width:e.width,x:e.pageX-window.scrollX,y:e.pageY-window.scrollY}),GJ=e=>({pageX:e.x+window.scrollX,pageY:e.y+window.scrollY,width:e.width,height:e.height}),KJ=e=>({borderRadius:`0px`,height:e.height,width:e.width,x:e.x,y:e.y}),qJ=(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},JJ=e=>e instanceof SVGElement&&!(e instanceof SVGSVGElement),YJ=e=>{let t=e.getBoundingClientRect();return t.width>=16||t.height>=16},XJ=(e,t)=>t(e)&&!JJ(e)&&YJ(e),ZJ=new Set([`c`,`C`,`с`,`С`,`ȼ`,`Ȼ`,`ↄ`,`Ↄ`,`ᴄ`,`ᶜ`,`ⱼ`,`ⅽ`,`Ⅽ`,`ç`,`Ç`,`ć`,`Ć`,`č`,`Č`,`ĉ`,`Ĉ`,`ċ`,`Ċ`]),QJ=(e,t)=>t===`KeyC`?!0:!e||e.length!==1?!1:ZJ.has(e),$J=(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},eY={meta:`metaKey`,cmd:`metaKey`,command:`metaKey`,win:`metaKey`,windows:`metaKey`,ctrl:`ctrlKey`,control:`ctrlKey`,shift:`shiftKey`,alt:`altKey`,option:`altKey`,opt:`altKey`},tY=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=eY[e];t?n[t]=!0:n.key=e}return n},nY=e=>{if(typeof e==`function`)return e;let t=tY(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||$J(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}},rY=e=>!e||typeof e==`function`?{metaKey:Pz(),ctrlKey:!Pz(),shiftKey:!1,altKey:!1,key:null}:tY(e),iY=(e,t)=>{if(t.activationKey)return nY(t.activationKey)(e);let n=(Pz()?e.metaKey:e.ctrlKey)&&!e.shiftKey&&!e.altKey;return!!(e.key&&n&&QJ(e.key,e.code))},aY=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}},oY=e=>{let t=getComputedStyle(e),n={};for(let e of Iz)n[e]=t.getPropertyValue(e);return n},sY=e=>{let t={};for(let n of nB)t[n]=e.getPropertyValue(n);return t},cY=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 sY(getComputedStyle(i))}finally{i.remove()}}catch{return null}},lY=new Set([`display`,`width`,`height`]),uY=(e,t,n)=>e.kind===`color`?!1:e.cssProperties.some(e=>lY.has(e))?dY(e):e.cssProperties.every(e=>{let r=t[e],i=n[e];return r===void 0||i===void 0?!1:r===i}),dY=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:!Jz.has(t)&&!!(t===`width`||t===`height`||t===`width,height`||t.startsWith(`max-`)||t.startsWith(`min-`)||t===`line-height`)},fY=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},pY=(e,t)=>{let n=fY(e[t]);if(n)return n;if(t===`line-height`){let t=fY(e[`font-size`]);return t?{value:oB(t.value*IM),unit:t.unit||`px`}:null}return Vz.has(t)?{value:0,unit:`px`}:null},mY=(e,t)=>{let n=pY(e,t[0]);if(!n)return null;for(let r=1;r<t.length;r++){let i=pY(e,t[r]);if(!i||i.unit!==n.unit||Math.abs(i.value-n.value)>=.5)return null}return n},hY=(e,t)=>e===`opacity`?{value:Math.round(t.value*100),unit:`%`}:Hz.has(e)?{value:oB(t.value),unit:``}:{value:oB(t.value),unit:t.unit||`px`},gY=e=>e!==null,_Y=(e,t)=>{let n=t.map(t=>{let n=t.longhands.length===1?pY(e,t.longhands[0]):mY(e,t.longhands);return n?{definition:t,value:n}:null}).filter(gY),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)}))},vY=(e,t,n)=>e===`opacity`?{min:0,max:100}:e===`z-index`?{min:zz,max:Bz}: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))}:Jz.has(e)?{min:Rz,max:512}:n===`%`?{min:0,max:100}:{min:e.startsWith(`margin`)?Lz:0,max:384},yY=(e,t,n)=>{let r=hY(e.key,t),i=r.unit===`px`&&Math.abs(r.value)>1e7,a=vY(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:PB(e.key),isPrioritized:!1,isDefault:!1,isCanonical:n}},bY=(e,t,n,r=!1)=>{let i=Az(n),a=i?hz(i):null,o=a!==null&&a.alpha!==0;if(!o&&!r)return null;let s=o&&i?i:EM;return{kind:`color`,key:e,label:t,cssProperties:[e],value:s,original:s,tailwindAliases:PB(e),isPrioritized:r,isDefault:!1,isCanonical:!0}},xY=(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:PB(e.key),isPrioritized:!1,isDefault:!1,isCanonical:!0}},SY=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])),CY=e=>SY.get(e.key)??1/0,wY=e=>e.map((e,t)=>({property:e,index:t})).sort((e,t)=>{let n=CY(e.property)-CY(t.property);return n===0?e.index-t.index:n}).map(e=>e.property),TY=e=>{let t=oY(e),n=getComputedStyle(e),r=sY(n),i=cY(e),a=[],o=new Set,s=e=>{o.has(e.key)||(a.push(e),o.add(e.key))};for(let e of Yz)for(let n of _Y(t,e))s(yY(n.definition,n.value,n.isCanonical));for(let e of Xz){let n=pY(t,e.key);n&&s(yY({key:e.key,label:e.label,longhands:[e.key]},n,!0))}for(let{key:e,label:t,alwaysShow:r}of Zz){let i=n.getPropertyValue(e);if(!r&&(!i||_z(i)))continue;let a=bY(e,t,i,r);a&&s(a)}let c=n.getPropertyValue(eB.key);if(c){let e=xY(eB,c,$z(c));e&&s(e)}for(let e of tB){let t=n.getPropertyValue(e.key);if(!t)continue;let r=xY(e,t);r&&s(r)}return EY(a,NB(e),r,i)},EY=(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?uY(o,n,r):dY(o);a.push({...o,isDefault:e})}return[...wY(i),...wY(a)]},DY=[{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`}],OY=e=>{let t=e.toLowerCase();for(let{keyword:e,family:n}of DY)if(t.includes(e))return n;return null},kY=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,AY=e=>{let t=fY(e);return!t||t.unit!==`px`?null:oB(t.value)},jY=(e,t)=>t===null?!0:e.length===t.length?e<t:e.length<t.length,MY=(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},NY=(e,t,n)=>{let r=(t===1?Math.floor(e/n)+1:Math.ceil(e/n)-1)*n;return r<0?null:r},PY=null,FY=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),IY=()=>{let e=Array.from(document.adoptedStyleSheets??[]),t=document.styleSheets.length;if(PY&&PY.documentSheetCount===t&&FY(PY.adoptedSheets,e))return PY.names;let n=new Set;for(let t of[...document.styleSheets,...e]){let e;try{e=t.cssRules}catch{continue}LY(e,n)}return PY={documentSheetCount:t,adoptedSheets:e,names:n},n},LY=(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&&LY(n.cssRules,t)},RY={hasTokens:!1,matchColor:()=>null,matchLength:()=>null,stepLength:()=>null},zY=e=>{if(typeof document>`u`)return RY;let t=IY();if(t.size===0)return RY;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=AY(t);if(s!==null){e===`--spacing`&&s>0&&(o=s);let t=OY(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=Az(t);if(c){let t=c.toLowerCase();jY(e,r.get(t)??null)&&r.set(t,e)}}if(r.size===0&&i.size===0)return RY;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=Az(e)?.toLowerCase();return t?r.get(t)??null:null},matchLength:(e,t)=>{let n=kY(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&&jY(e.name,a)&&(a=e.name);return a},stepLength:(e,t,n)=>{let r=kY(n);if(r===null)return null;let i=Math.round(e),a=s.get(r);return a&&a.length>=2?MY(a,i,t):(r===`spacing`||r===`size`)&&o?NY(i,t,o):a?MY(a,i,t):null}}},BY=e=>e.kind===`color`||e.kind===`enum`?e.value:e.key===`opacity`&&e.unit===`%`?aB(e.value/100):`${aB(e.value)}${e.unit}`,VY=(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},HY=e=>{let t=new Map;for(let n of e.edits){let e=BY(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=VY(t,r,e.designTokens);i&&(n=!0);let a=i?` /* var(${i}) */`:``;return`${t}: ${r.cssValue};${a}`}),usesToken:n}},UY=e=>e.filePath?`${e.filePath}:${e.lineNumber}`:``,WY=e=>["```css",...e,"```"].join(`
|
|
199
|
+
`),GY=e=>{if(e.length===0)return``;let t=e.map(e=>{let{lines:t,usesToken:n}=HY(e);return{header:UY(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(WY(e.cssLines)),n.join(`
|
|
200
|
+
`)}for(let e of t)n.push(e.header?`\n${e.header}`:``),n.push(WY(e.cssLines));return n.join(`
|
|
201
|
+
`)},KY=e=>`style`in e&&e.style instanceof CSSStyleDeclaration,qY=e=>{let t=new Map,n=KY(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}},JY=(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)}},YY=(e,t)=>({element:e.element,preview:e.preview,filePath:e.filePath??``,lineNumber:e.lineNumber??0,edits:t,designTokens:e.designTokens}),XY=e=>{let[t,n]=q(null),[r,i]=q(!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=>{MH(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=TY(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:$q(r),properties:o,preview:qY(r),filePath:s,lineNumber:c,componentName:a.componentName,tagName:a.tagName??RM(r),initialSearchQuery:a.initialSearchQuery,designTokens:zY(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=TY(r);return c.length===0?!1:((o.length>0||s.preview.hasAppliedStyles())&&a.push(YY(s,o)),o=[],n({element:r,position:i,selectionBounds:$q(r),properties:c,preview:qY(r),tagName:RM(r),hasSessionEdits:a.some(e=>e.edits.length>0),designTokens:zY(r)}),zH(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,YY(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),JY(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=GY(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}},ZY={enabled:!0,hue:0,selectionBox:{enabled:!0},dragBox:{enabled:!0},grabbedBoxes:{enabled:!0},elementLabel:{enabled:!0},toolbar:{enabled:!0}},QY=(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}}),$Y={activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,activationKey:void 0,getContent:void 0,maxContextLines:3,freezeReactUpdates:!0},eX=(e={})=>{let t=new Map,n={},[r,i]=zq({theme:ZY,options:{...$Y,...e},actions:[]}),a=()=>{let r=ZY,a={...$Y,...e},o=[];for(let{config:e}of t.values())if(e.theme&&(r=QY(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?QY(QY(ZY,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:_}},tX=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,nX=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:tX(`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}},rX=(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)},Gj);n.set(t,i)};return{createInstance:(t,n,r,i,o)=>{a();let s=nX({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=nX({bounds:$q(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)}}},iX=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}},aX=(e,t,n)=>{let r=[],i=(t,r)=>{let i=iX(n(t)),a=MF(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(oz(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=[]}}},oX=e=>{let{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}=rY(e.activationKey);return{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}},sX=()=>{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)}}},cX=(e,t)=>({top:t<25,bottom:t>window.innerHeight-25,left:e<25,right:e>window.innerWidth-25}),lX=(e,t,n)=>{let r=null,i=()=>{if(!t()){a();return}let o=e(),s=cX(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?nF(i):null},a=()=>{r!==null&&(rF(r),r=null)};return{start:i,stop:a,isActive:()=>r!==null}},uX=()=>{let e=globalThis;return!!(e.chrome?.runtime?.id||e.browser?.runtime?.id)},dX=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&&!uX()&&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{}},fX=e=>typeof e==`object`&&!!e,pX=e=>{if(!fX(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},mX=()=>{if(typeof window>`u`)return null;try{let e=(document.currentScript instanceof HTMLScriptElement?document.currentScript:null)?.getAttribute(`data-options`);return e?pX(JSON.parse(e)):null}catch{return null}},hX=e=>e===`Enter`||e===`NumpadEnter`,gX=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height,_X=(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?.()}}}),vX={name:`comment`,setup:()=>({actions:[{id:`comment`,label:`Comment`,shortcut:`Enter`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterPromptMode?.()}}]})},yX={name:`edit`,setup:()=>({actions:[{id:`edit`,label:`Style`,shortcut:`S`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterEditMode?.()}}]})},bX={name:`open`,actions:[{id:`open`,label:`Open`,shortcut:`O`,enabled:e=>!!e.filePath,onAction:e=>{e.filePath&&(e.hooks.onOpenFile(e.filePath,e.lineNumber)||IF(e.filePath,e.lineNumber,e.hooks.transformOpenFileUrl),e.hideContextMenu(),e.cleanup())}}]},xX=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`},SX=()=>{let[e,t]=q(!1),[n,r]=q(null),i=WB(),a=()=>{let e=n();return oz(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()??(oz(e)?e:null);return o(),t}}},CX=async(e,t={})=>(await Promise.allSettled(e.map(e=>eU(e,t)))).map(e=>e.status===`fulfilled`?e.value:``),wX=[_X,yX,vX,bX],TX=!1,EX=new Set,DX=e=>{if(typeof window>`u`)return EJ();let t={enabled:!0,activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,...mX(),...e};if(t.enabled===!1||TX)return EJ();TX=!0,Ij(t.container??null),dX(t.telemetry!==!1);let{enabled:n,telemetry:r,container:i,...a}=t;return gL(e=>{let t=!1,n,r=eX(a),{store:i,actions:o,pointer:s,viewportVersion:c,current:l}=nJ({keyHoldDuration:r.store.options.keyHoldDuration??100}),u=J(()=>l().state===`holding`),d=J(()=>l().state===`active`),f=J(()=>{let e=l();return e.state===`active`&&e.phase===`frozen`}),p=J(()=>{let e=l();return e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)}),m=J(()=>{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=J(()=>{let e=l();return e.state===`active`&&e.phase===`dragging-reposition`}),g=J(()=>{let e=l();return e.state===`active`&&e.phase===`justDragged`}),_=J(()=>l().state===`copying`),v=J(()=>i.selectionInteractionLockDepth>0),y=J(()=>l().state===`justCopied`),b=J(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode}),x=J(()=>i.pendingCommentMode||b()),S=J(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode&&!!e.isPendingDismiss}),ee=(e,t)=>{document.body.style[e]=t};yL(wL(d,(e,t)=>{e&&!t?(FI(s().x,s().y),ee(`touchAction`,`none`)):!e&&t&&(II(),ee(`touchAction`,``))}));let C=RB(),[w,T]=q(!C||!C.collapsed),[E,D]=q(0),[O,te]=q(0),[ne,k]=q(C),[re,ie]=q(!1),ae=BB(e=>e.shiftKey),[oe,se]=q(null),[ce,le]=q(null),[ue,de]=q(null),fe=XY({store:i,actions:o,isActivated:d,activateRenderer:()=>Kt(),deactivateRenderer:()=>qt(),performCopyWithLabel:e=>ft(e),onOpen:()=>{Ar(),_e?.(),_e=kr(Or,le)},onClose:()=>{_e?.(),_e=null,le(null)}}),pe=J(()=>i.contextMenuPosition!==null||fe.isOpen()),me=J(()=>pe()||oe()!==null),he,ge=null,_e=null,ve=!1,ye=new WeakMap,be=SX(),xe=()=>!w()||b()||v()||pe()||be.isPendingDismiss(),Se=()=>{ye=new WeakMap},Ce=()=>{Re(!1),Se()},we=e=>{let t=ne()??RB(),n={edge:t?.edge??`bottom`,ratio:t?.ratio??.5,collapsed:t?.collapsed??!1,enabled:t?.enabled??!0,defaultAction:t?.defaultAction??`copy`,...e};zB(n),k(n);for(let e of EX)e(n)},Te=()=>{Ie.timerId!==null&&(clearTimeout(Ie.timerId),Ie.timerId=null)},Ee=()=>{Ie.copyWaiting=!1,Ie.holdTimerFired=!1,Ie.startTimestamp=null};yL(()=>{if(l().state!==`holding`){Te();return}Ie.startTimestamp=Date.now(),Ie.timerId=window.setTimeout(()=>{if(Ie.timerId=null,Ie.copyWaiting){Ie.holdTimerFired=!0;return}o.activate()},i.keyHoldDuration),EL(Te)}),yL(()=>{let e=l();if(e.state!==`active`||e.phase!==`justDragged`)return;let t=setTimeout(()=>{o.finishJustDragged()},Gj);EL(()=>clearTimeout(t))}),yL(()=>{if(l().state!==`justCopied`)return;let e=setTimeout(()=>{o.finishJustCopied()},Gj);EL(()=>clearTimeout(e))}),yL(wL(u,(e,t=!1)=>{!t||e||!d()||(r.store.options.activationMode!==`hold`&&o.setWasActivatedByToggle(!0),r.hooks.onActivate())}));let De=(e,t,n)=>{ke(e,t,n),o.clearInputText()},Oe=()=>{let e=i.frozenElement||mt();e&&o.enterPromptMode({x:s().x,y:s().y},e)},ke=(e,t,n)=>{o.setCopyStart({x:t,y:n},e)},Ae={lastDetectionTimestamp:0,pendingDetectionScheduledAt:0,latestPointerX:0,latestPointerY:0},je=null,[Me,Ne]=q(null),Pe=(e,t)=>{je!==null&&clearTimeout(je),Ne(null),je=window.setTimeout(()=>{Ne({x:e,y:t}),je=null},32)},Fe=null,Ie={timerId:null,startTimestamp:null,copyWaiting:!1,holdTimerFired:!1},Le=null,[A,Re]=q(!1),ze=0,Be=!1,Ve=null,He=()=>{Be=!0,Ve!==null&&window.clearTimeout(Ve),Ve=window.setTimeout(()=>{Be=!1,Ve=null},Gj)},Ue=()=>{Ve!==null&&(window.clearTimeout(Ve),Ve=null),Be=!1},We=0,Ge=null,Ke=null,[j,qe]=q(!1),[Je,Ye]=q(null),[Xe,Ze]=q(null),[Qe,$e]=oJ(Xe),et=J(()=>fe.isOpen()?yM:x()?vM:j()?Je():d()?_M:null),tt=e=>XJ(e,gF),nt=aX(gF,tt,$q),rt=lX(s,()=>p(),e=>{if(h()){if(o.shiftDragStart(e),Le){Le={x:Le.x+e.x,y:Le.y+e.y};return}let{pageX:t,pageY:n}=Dt(s().x,s().y);Le={x:t,y:n}}}),it=J(()=>d()&&!_()),at=new Map,M=(e,t)=>{let n=tX(`grabbed`),i={id:n,bounds:e,createdAt:Date.now(),element:t};o.addGrabbedBox(i),r.hooks.onGrabbedBox(e,t);let a=window.setTimeout(()=>{at.delete(n),o.removeGrabbedBox(n)},Gj+125);at.set(n,a)},ot=async e=>{let t=await Promise.all(e.map(async e=>{let t=await zH(e),n=t?.componentName??null,r=t?.filePath,i=t?.lineNumber??void 0,a=t?.columnNumber??void 0;n||=BH(e);let o=e instanceof HTMLElement?e.innerText?.slice(0,100):void 0;return{tagName:RM(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}}))},st=rX(o,()=>i.labelInstances),ct=async(e,t,n)=>{Ue(),l().state!==`copying`&&o.startCopy();let r=!1,i;try{r=await e(),r||(i=`Failed to copy`)}catch(e){i=OJ(e,`Action failed`)}if(t)for(let e of t)st.updateAfterCopy(e,r,i);l().state===`copying`&&(r&&o.completeCopy(),n?qt():r?(o.activate(),He()):o.unfreeze())},lt=(e,t,n)=>{let i=e[0],a=n??(i?BH(i):null),o=i?RM(i):null,s=a??o??void 0;return PJ({getContent:r.store.options.getContent,componentName:s,maxContextLines:r.store.options.maxContextLines},r.hooks,e,t)},ut=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&&M($q(t),t)}await iF();let o=!0;if(i.length>0&&(o=await lt(i,t,n)),a.length>0&&!(await Promise.all(a)).every(Boolean))throw new XB;return ot(e),o},dt=e=>{MH(e.primaryElement).then(async t=>{await ct(()=>ut(e.targetElements,e.extraPrompt,t??void 0),e.labelInstanceIds.length>0?e.labelInstanceIds:null,e.shouldDeactivateAfter),e.onComplete?.()}).catch(t=>{let n=OJ(t,`Action failed`);for(let t of e.labelInstanceIds)st.updateAfterCopy(t,!1,n);l().state===`copying`&&o.unfreeze()})},ft=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===bt()?Et():void 0,m=d&&f?WJ(d):p??$q(t),h=f?m.x+m.width/2:n,g=RM(t);Ue(),o.startCopy();let _=g?st.createInstance(m,g,void 0,`copying`,{element:t,mouseX:h,elements:r}):null;dt({primaryElement:t,targetElements:u,labelInstanceIds:_?[_]:[],extraPrompt:a,shouldDeactivateAfter:s,onComplete:c})},pt=e=>{let{elements:t,labelEntries:n,shouldDeactivateAfter:r,onComplete:i}=e,a=t[0];Ue(),o.startCopy(),dt({primaryElement:a,targetElements:t,labelInstanceIds:st.createPerElementInstances(n,`copying`),shouldDeactivateAfter:r,onComplete:i})},mt=J(()=>{if(c(),!it()||m()||v()||be.isPendingDismiss())return null;let e=i.detectedElement;return oz(e)?e:null}),ht=J(()=>i.frozenElement||(f()?null:mt())),gt=J(()=>!d()||b()||A()||_()||me()||be.isPendingDismiss()?null:ae()?f()?ht():mt()??i.frozenElement:be.selectedElement()),N=J(()=>{let e=gt();return e?qJ(e,gF,tt):[]}),_t=J(()=>{let e=gt();return e?Math.max(0,N().findIndex(t=>t.element===e)):0}),vt=J(()=>gt()!==null);yL(()=>{let e=i.detectedElement;if(!e)return;let t=setInterval(()=>{oz(e)||o.setDetectedElement(null)},100);EL(()=>clearInterval(t))}),yL(wL(ht,e=>{if(Ge!==null&&(clearTimeout(Ge),Ge=null),!e){Ze(null);return}Ge=window.setTimeout(()=>{Ge=null,Ze(e)},100)})),EL(()=>{Ge!==null&&(clearTimeout(Ge),Ge=null)}),yL(()=>{let e=i.frozenElements;EL(mI(e))}),yL(wL(d,e=>{e&&r.store.options.freezeReactUpdates&&EL(fL())}));let yt=()=>{if(i.isTouchMode&&p()){let e=i.detectedElement;return!e||oF(e)?void 0:e}let e=ht();if(!(!e||oF(e)))return e},bt=J(()=>yt()),xt=()=>bt()?i.isTouchMode&&p()?it():it()&&!m():!1,St=ZL(()=>i.frozenElements,e=>J(()=>(c(),$q(e)))),Ct=J(()=>{let e=i.frozenElements;if(e.length===0)return[];let t=i.frozenDragRect;return t&&e.length>1?[WJ(t)]:St().map(e=>e())}),wt=J(()=>{if(!A()||i.pendingCommentMode||j())return null;let e=i.detectedElement;return!oz(e)||oF(e)||i.frozenElements.includes(e)?null:e}),Tt=J(()=>{c();let e=wt();if(e)return $q(e)}),Et=J(()=>{c();let e=i.frozenElements;if(e.length>0){let t=Ct();if(e.length===1){let e=t[0];if(e)return e}let n=i.frozenDragRect;return n?t[0]??WJ(n):KJ(aY(t))}let t=bt();if(t)return $q(t)}),Dt=(e,t)=>({pageX:e+window.scrollX,pageY:t+window.scrollY}),Ot=(e,t)=>{let{pageX:n,pageY:r}=Dt(e,t);return{x:Math.abs(n-i.dragStart.x),y:Math.abs(r-i.dragStart.y)}},kt=J(()=>{if(!p())return!1;let e=Ot(s().x,s().y);return e.x>2||e.y>2}),At=(e,t)=>{let{pageX:n,pageY:r}=Dt(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}},jt=e=>e.code===`Space`||e.key===` `,Mt=()=>{if(!p())return;o.startDragReposition();let{pageX:e,pageY:t}=Dt(s().x,s().y);Le={x:e,y:t}},Nt=()=>{o.stopDragReposition(),Le=null},Pt=J(()=>{if(c(),kt())return KJ(At(s().x,s().y))}),Ft=J(()=>{if(c(),!kt())return[];let e=Me();if(!e)return[];let t=At(e.x,e.y),n=VJ(t,gF);return(n.length>0?n:VJ(t,gF,!1)).map(e=>$q(e))}),It=J(()=>{let e=Ft();if(e.length>0)return e;let t=Tt();return t?[...Ct(),t]:Ct()}),Lt=ZL(()=>i.frozenElements,e=>{let t=RM(e)||`element`,n=BH(e)??void 0;return J(()=>{if(c(),!oz(e))return null;let r=$q(e),i=ye.get(e);return{tagName:t,componentName:n,bounds:r,mouseX:i===void 0?void 0:r.x+r.width*i}})}),Rt=J(()=>{if(b()||i.frozenElements.length<2)return[];let e=[];for(let t of Lt()){let n=t();n!==null&&e.push(n)}return e}),zt=J(()=>{if(b())return null;let e=wt();return e?(c(),{tagName:RM(e)||`element`,componentName:BH(e)??void 0,bounds:$q(e),mouseX:s().x}):null}),Bt=J(()=>{if(_()||b()){c();let e=i.frozenElement||mt();return e?{x:eJ($q(e)).x+i.copyOffsetFromCenterX,y:i.copyStart.y}:{x:i.copyStart.x,y:i.copyStart.y}}return{x:s().x,y:s().y}}),Vt=J(()=>{if(!A()||i.frozenElements.length!==1)return;c();let e=i.frozenElements[0];if(!oz(e))return;let t=ye.get(e);if(t===void 0)return;let n=$q(e);return n.x+n.width*t});yL(wL(()=>[mt(),i.lastGrabbedElement],([e,t])=>{t&&e&&t!==e&&o.setLastGrabbed(null),e&&r.hooks.onElementHover(e)})),yL(wL(()=>mt(),e=>{let t=++We,n=()=>{We===t&&o.setSelectionSource(null,null)};if(!e){n();return}zH(e).then(e=>{if(We===t){if(!e){n();return}o.setSelectionSource(e.filePath,e.lineNumber)}}).catch(()=>{We===t&&o.setSelectionSource(null,null)})}));let Ht=J(()=>i.grabbedBoxes.map(e=>({id:e.id,bounds:e.bounds,createdAt:e.createdAt}))),Ut=J(()=>i.labelInstances.map(e=>({id:e.id,status:e.status,tagName:e.tagName,componentName:e.componentName,createdAt:e.createdAt})));yL(wL(J(()=>{let e=d(),t=p(),n=_(),a=b(),o=mt(),s=Pt(),c=r.store.theme.enabled,l=r.store.theme.selectionBox.enabled,u=r.store.theme.dragBox.enabled,f=kt(),m=ht(),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:[...Ht()],labelInstances:[...Ut()],selectionFilePath:i.selectionFilePath,toolbarState:ne()}}),e=>{r.hooks.onStateChange(e)})),yL(wL(()=>{let e=b();return{inputMode:e,position:e?s():CL(s),target:e?mt():CL(mt)}},({inputMode:e,position:t,target:n})=>{r.hooks.onPromptModeChange(e,{x:t.x,y:t.y,targetElement:n})})),yL(wL(()=>[or(),Et(),mt()],([e,t,n])=>{r.hooks.onSelectionBox(!!e,t??null,n)})),yL(wL(()=>[pr(),Pt()],([e,t])=>{r.hooks.onDragBox(!!e,t??null)})),yL(wL(()=>{let e=hr();return[e,mr(),e?Bt():CL(Bt),e?mt():CL(mt),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&&RM(i)||void 0,filePath:a??void 0,lineNumber:o??void 0})}));let Wt=null,Gt=e=>{if(e){if(!Wt){Wt=document.createElement(`style`),Wt.setAttribute(`data-react-grab-cursor`,``);let e=BM();e&&(Wt.nonce=e),HM(Wt),document.head.appendChild(Wt)}Wt.textContent=`* { cursor: ${e} !important; }`}else Wt&&=(Wt.remove(),null)};yL(wL(()=>[d(),_(),b()],([e,t,n])=>{Gt(t?`progress`:e&&!n?`crosshair`:null)}));let Kt=()=>{let e=u();o.activate(),e||r.hooks.onActivate()},qt=()=>{let e=p(),t=i.previouslyFocusedElement;Nt(),o.deactivate(),fe.resetWithDiscard(),Ar(),Ce(),Tn(),be.clear(),qe(!1),Ye(null),e&&ee(`userSelect`,``),Fe&&window.clearTimeout(Fe),rt.stop(),t instanceof HTMLElement&&t!==document.body&&t!==document.activeElement&&oz(t)&&t.focus({preventScroll:!0}),r.hooks.onDeactivate()},Jt=()=>{u()&&o.releaseHold(),d()&&qt(),Ue()},Yt=()=>{o.setWasActivatedByToggle(!0),Kt()},Xt=()=>{let e=[...i.frozenElements],t=i.frozenElement||mt(),n=b()?i.inputText.trim():``;if(!t){qt();return}let r=e.length>0?e:[t],a=r.map(e=>$q(e))[0],{x:s,y:c}=eJ(a),l=s+i.copyOffsetFromCenterX;o.setPointer({x:s,y:c}),o.exitPromptMode(),o.clearInputText(),ft({element:t,cursorX:l,selectedElements:r,extraPrompt:n||void 0,shouldDeactivateAfter:!0})},Zt=()=>{if(b()){if(S()){o.clearInputText(),qt();return}o.setPendingDismiss(!0),te(e=>e+1)}},Qt=()=>{if(be.isPendingDismiss()){On();return}o.clearInputText(),qt()},$t=()=>{o.setPendingDismiss(!1)},en=()=>{if(fe.isOpen()){fe.dismiss();return}let e=i.frozenElement||mt();e&&tn(e,{x:s().x,y:s().y})},tn=(e,t,n={})=>fe.trigger(e,t,n),nn=(e,t)=>{if(!fe.isOpen()||i.contextMenuPosition!==null)return!1;let n=MF(e,t).find(gF);if(!n)return!1;let r=fe.switchToElement(n,{x:e,y:t});return r&&fI([n]),r},rn=e=>({filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,componentName:Qe(),tagName:RM(e)||void 0}),an=()=>{Ke=null,qe(!1),o.setPendingCommentMode(!1),Ye(null)},on=e=>{let t=i.frozenElement||mt();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`?tn(t,n,rn(t))?(o.clearInputText(),o.exitPromptMode(),an(),!0):!0:(o.clearInputText(),o.exitPromptMode(),an(),a.onAction(Pn(t,n)),!0):(o.clearInputText(),o.exitPromptMode(),an(),Nr(_M),un(t,n),!0)},sn=e=>{if(d()){if(et()!==e&&b()&&on(e))return;if(et()!==e&&i.pendingCommentMode){o.setPendingCommentMode(!1),Ke=e,Ye(e),qe(!0);return}if(et()!==e&&j()){Ke=e,Ye(e);return}qt();return}w()&&(Ke=e,Ye(e),qe(!0),Yt())},cn=()=>{sn(ne()?.defaultAction??`copy`)},ln=(e,t,n)=>{an(),o.clearInputText(),o.enterPromptMode({x:t,y:n},e)},un=(e,t)=>{Ce(),jr(),o.showContextMenu(t,e),Tn(),r.hooks.onContextMenu(e,t)},dn=(e,t)=>{let n=Ke;if(Ke=null,Ye(null),!n)return;if(n===`edit`){tn(e,t,rn(e));return}let i=r.store.actions.find(e=>e.id===n);if(!i){Nr(_M),un(e,t);return}i.onAction(Pn(e,t))},fn=()=>{if(w()){if(d()&&x()){qt();return}o.setPendingCommentMode(!0),d()||Yt()}},pn=(e,t,n)=>{let r=n&&A()&&!p()&&!i.pendingCommentMode&&!j();if(xe()||f()&&!r)return;if(o.setPointer({x:e,y:t}),Ae.latestPointerX=e,Ae.latestPointerY=t,r){let n=NF(e,t);n!==i.detectedElement&&o.setDetectedElement(n);return}let a=performance.now(),s=Ae.pendingDetectionScheduledAt>0&&a-Ae.pendingDetectionScheduledAt<200;if(a-Ae.lastDetectionTimestamp>=32&&!s&&(Ae.lastDetectionTimestamp=a,Ae.pendingDetectionScheduledAt=a,setTimeout(()=>{if(xe()){Ae.pendingDetectionScheduledAt=0;return}let e=NF(Ae.latestPointerX,Ae.latestPointerY);e!==i.detectedElement&&o.setDetectedElement(e),Ae.pendingDetectionScheduledAt=0})),p()){if(h()){let{pageX:n,pageY:r}=Dt(e,t);Le&&o.shiftDragStart({x:n-Le.x,y:r-Le.y}),Le={x:n,y:r}}Pe(e,t);let n=cX(e,t),r=n.top||n.bottom||n.left||n.right;r&&!rt.isActive()?rt.start():!r&&rt.isActive()&&rt.stop()}},mn=(e,t,n)=>{if(!it()||v())return!1;!n&&A()&&Ce();let i=be.selectedElement()!==null;return o.startDrag({x:e,y:t},n||i),o.setPointer({x:e,y:t}),ee(`userSelect`,`none`),Pe(e,t),r.hooks.onDragStart(e+window.scrollX,t+window.scrollY),!0},hn=(e,t)=>{let n=i.frozenElements.includes(e),r=i.frozenElements.length===0;if(!n){let n=HJ($q(e),t);ye.set(e,n),r&&$e(BH(e)??void 0)}o.toggleFrozenElement(e),PF();let a=i.frozenElements.includes(e);if(a||ye.delete(e),i.frozenElements.length===0){Ce(),o.unfreeze();return}fI(i.frozenElements),Re(!0),o.setPointer(t),o.setLastGrabbed(a?e:i.frozenElements[i.frozenElements.length-1]),o.freeze(),Tn()},gn=()=>{let e=i.frozenElements.filter(oz),t=e.map(e=>{let t=RM(e)||`element`,n=BH(e)??void 0,r=ye.get(e),i=$q(e);return{element:e,tagName:t,componentName:n,mouseX:r===void 0?i.x+i.width/2:i.x+i.width*r}});if(Ce(),e.length===0){o.unfreeze();return}if(e.length===1){ft({element:e[0],cursorX:t[0].mouseX,selectedElements:e,shouldDeactivateAfter:i.wasActivatedByToggle});return}pt({elements:e,labelEntries:t,shouldDeactivateAfter:i.wasActivatedByToggle})},_n=(e,t,n)=>{let a=VJ(e,gF),s=a.length>0?a:VJ(e,gF,!1);if(s.length===0)return;let c=n&&!i.pendingCommentMode&&!j();if(c&&o.addFrozenElements(s),fI(c?i.frozenElements:s),r.hooks.onDragEnd(s,e),c){let e=s[s.length-1];Re(!0),PF(),o.setPointer(eJ($q(e))),o.setLastGrabbed(e),o.freeze(),Tn();return}let l=s[0],u=eJ($q(l));o.setPointer(u),o.setFrozenElements(s);let d=GJ(e);if(o.setFrozenDragRect(d),o.freeze(),o.setLastGrabbed(l),i.pendingCommentMode){ln(l,u.x,u.y);return}if(j()){qe(!1),Ke?dn(l,u):un(l,u);return}let f=i.wasActivatedByToggle&&!t;ft({element:l,cursorX:u.x,selectedElements:s,shouldDeactivateAfter:f,dragRect:d})},vn=e=>{for(let t of i.frozenElements)if(oz(t)&&gX(e,$q(t)))return t;return null},yn=(e,t,n,a)=>{let c=oz(i.frozenElement)?i.frozenElement:null,l=be.selectedElement(),u=()=>MF(e,t).find(gF)??null;if(a&&!i.pendingCommentMode&&!j()){let n=u();n!==null&&hn(n,{x:e,y:t});return}let d=u()??(oz(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=eJ($q(f));p=e.x,m=e.y}else p=e,m=t;if(i.pendingCommentMode){ln(f,p,m),be.clear();return}if(j()){qe(!1);let{wasIntercepted:e}=r.hooks.onElementSelect(f);if(e)return;be.clear(),fI([f]),o.setFrozenElement(f);let t={x:p,y:m};o.setPointer(t),o.freeze(),Ke?dn(f,t):un(f,t);return}let _=i.wasActivatedByToggle&&!n;o.setLastGrabbed(f),ft({element:f,cursorX:p,shouldDeactivateAfter:_}),be.clear()},bn=()=>{p()&&(Nt(),o.cancelDrag(),rt.stop(),ee(`userSelect`,``))},xn=(e,t,n,r)=>{if(!p())return;je!==null&&(clearTimeout(je),je=null),Ne(null);let i=Ot(e,t),a=i.x>2||i.y>2,s=a?At(e,t):null;a?o.endDrag():o.cancelDrag(),Nt(),rt.stop(),ee(`userSelect`,``),s?_n(s,n,r):yn(e,t,n,r)},Sn=DJ(),Cn=sX(),wn=e=>{let t;try{t=Cn.originalKeyDescriptor?.get?Cn.originalKeyDescriptor.get.call(e):e.key}catch{return!1}let n=t===`Enter`||hX(e.code),r=d()||u();return n&&r&&!b()&&!be.isPendingDismiss()&&!i.wasActivatedByToggle?Fz(e,`data-react-grab-input`)?!1:(Cn.claimedEvents.add(e),e.preventDefault(),e.stopImmediatePropagation(),!0):!1};Sn.addDocumentListener(`keydown`,zj(wn),{capture:!0}),Sn.addDocumentListener(`keyup`,zj(wn),{capture:!0}),Sn.addDocumentListener(`keypress`,zj(wn),{capture:!0});let Tn=()=>{nt.clearHistory(),be.clear()},En=(e,t=!1)=>{o.setFrozenElement(e),o.freeze(),be.select(e,{shouldPromptBeforeMouseHandoff:t});let n=eJ($q(e));o.setPointer(n),i.contextMenuPosition!==null&&o.showContextMenu(n,e)},Dn=()=>{be.showDismissPrompt()&&te(e=>e+1)},On=()=>{be.clear(),o.unfreeze(),Tn()},kn=()=>{let e=be.takeSelection(i.frozenElement);if(!e){On();return}let t=eJ($q(e));Tn(),o.setLastGrabbed(e),ft({element:e,cursorX:t.x,shouldDeactivateAfter:i.wasActivatedByToggle})},An=e=>fM.has(e.key)?e.key:e.key===`Tab`?e.shiftKey?`ArrowLeft`:`ArrowRight`:null,jn=(e,t={})=>{if(!d()||b()||A()||be.isPendingDismiss()&&!t.allowPendingKeyboardSelection)return!1;let n=An(e);if(!n||me())return!1;let r=ht(),i=!r;if(!r){let e=Lj()?.getBoundingClientRect();r=e?NF(e.left+e.width/2,e.top+e.height/2):NF(window.innerWidth/2,window.innerHeight/2)}if(!r)return!1;let a=n===`ArrowUp`||n===`ArrowDown`,o=nt.findNext(n,r);if(!o&&!a&&!i)return!1;let s=o??r;return e.preventDefault(),e.stopPropagation(),En(s,!0),!0},Mn=e=>e.metaKey||e.ctrlKey||e.altKey||e.repeat||lz(e)||!d()||_()||v()||me()?null:i.frozenElement||mt(),Nn=e=>{let t=Mn(e);if(!t)return null;let n=UB(r.store.actions,e);return n?{element:t,action:n}:null},Pn=(e,t)=>{let n=$q(e);return wr({element:e,filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,tagName:RM(e)||void 0,componentName:Qe(),position:t,shouldDeferHideContextMenu:!1,performWithFeedbackOptions:{fallbackBounds:n,fallbackSelectionBounds:[n],position:t}})},Fn=/^[a-zA-Z0-9-]$/,In=e=>{if(!e.key||e.key.length!==1||!Fn.test(e.key))return!1;let t=Mn(e);return!t||!fe.trigger(t,{x:s().x,y:s().y},{initialSearchQuery:e.key})?!1:(an(),e.preventDefault(),e.stopImmediatePropagation(),!0)},Ln=e=>{let t=Nn(e);if(!t)return!1;let{element:n,action:r}=t;if(b())return on(r.id)?(e.preventDefault(),e.stopImmediatePropagation(),!0):!1;let i={x:s().x,y:s().y};return r.onAction(Pn(n,i)),e.preventDefault(),e.stopImmediatePropagation(),!0},Rn=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)||IF(t,n??void 0,r.hooks.transformOpenFileUrl),!0):!1},zn=e=>{if(!d()||_()||i.contextMenuPosition!==null||fe.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||mt();if(!s)return!1;e.preventDefault(),e.stopPropagation();let c=eJ($q(s));return a?fI(r):(fI([s]),o.setFrozenElement(s)),o.setPointer(c),o.freeze(),un(s,c),!0},Bn=J(()=>N().map(e=>({tagName:RM(e.element)||`element`,componentName:BH(e.element)??void 0,depth:e.depth,isLast:e.isLast}))),Vn=J(()=>({items:Bn(),activeIndex:_t()})),Hn=e=>{if(!(!r.store.options.allowActivationInsideInput&&lz(e))&&!(!iY(e,r.store.options)&&((e.metaKey||e.ctrlKey)&&!dM.includes(e.key)&&!hX(e.code)&&(d()&&!i.wasActivatedByToggle?qt():u()&&(Te(),Ee(),o.releaseHold())),!hX(e.code)||!u()))){if((d()||u())&&!b()&&(e.preventDefault(),hX(e.code)&&e.stopImmediatePropagation()),d()){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e.repeat)return;Fe!==null&&window.clearTimeout(Fe),Fe=window.setTimeout(()=>{qt()},200);return}if(u()&&e.repeat){if(Ie.copyWaiting){let e=Ie.holdTimerFired;Ee(),e&&o.activate()}return}if(!(_()||y())&&!u()){let t=r.store.options.keyHoldDuration??100;lz(e)?uz(e)?t+=600:t+=400:dz()&&(t+=600),Ee(),o.startHold(t)}}},Un=e=>{if(!be.isPendingDismiss())return!1;if(hX(e.code))return!0;let t=fM.has(e.key),n=Nn(e)!==null;return!t&&!n?!1:t?jn(e,{allowPendingKeyboardSelection:!0}):Ln(e)?(Tn(),!0):!1};Sn.addWindowListener(`keydown`,zj(e=>{if(An(e)&&lz(e)||Un(e))return;if(wn(e),!w()){iY(e,r.store.options)&&!e.repeat&&D(e=>e+1);return}let t=hX(e.code)&&u()&&!b(),n=Fz(e,hM);if(b()&&iY(e,r.store.options)&&!e.repeat&&!n){e.preventDefault(),e.stopPropagation(),Zt();return}if(e.key===`Escape`&&me()){oe()!==null&&Ar();return}let a=Fz(e,`data-react-grab-ignore-events`)&&!t;if(b()||a)return b()&&!n&&Ln(e)||(e.key===`Escape`&&(b()?Zt():i.wasActivatedByToggle&&qt()),a&&fM.has(e.key)&&jn(e)),void 0;if(p()&&jt(e)){e.repeat||Mt(),e.preventDefault(),e.stopPropagation();return}if(e.key===`Escape`&&(u()||i.wasActivatedByToggle)){qt();return}d()&&!dM.includes(e.key)&&e.preventDefault();let o=Date.now()-ze<200;jn(e)||Rn(e)||zn(e)||Ln(e)||In(e)||o||Hn(e)}),{capture:!0}),Sn.addWindowListener(`keyup`,zj(e=>{if(wn(e))return;if(jt(e)&&h()&&(Nt(),e.preventDefault(),e.stopPropagation()),e.key===`Shift`&&A()){p()&&bn(),gn();return}if(Fz(e,`data-react-grab-ignore-events`))return;let t=oX(r.store.options),n=t.metaKey||t.ctrlKey?Pz()?!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):nY(r.store.options.activationKey)(e):QJ(e.key,e.code);if(y()||Be){(a||n)&&(Ue(),qt());return}if(!u()&&!d()||b())return;let s=!!r.store.options.activationKey,c=r.store.options.activationMode===`hold`,l=p();if(d()){let e=pe();if(n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e)return;qt()}else if(c&&a){if(Fe!==null&&(window.clearTimeout(Fe),Fe=null),e||l)return;qt()}else!s&&a&&Fe!==null&&(window.clearTimeout(Fe),Fe=null);return}if(a||n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`)return;if(u()||Ie.holdTimerFired&&n){Te();let t=(Ie.startTimestamp?Date.now()-Ie.startTimestamp:0)>=200,n=Ie.holdTimerFired&&t&&(r.store.options.allowActivationInsideInput||!lz(e));Ee(),n?o.activate():o.releaseHold()}else qt()}}),{capture:!0}),Sn.addDocumentListener(`copy`,()=>{u()&&(Ie.copyWaiting=!0)}),Sn.addWindowListener(`keypress`,zj(wn),{capture:!0}),Sn.addWindowListener(`pointermove`,zj(e=>{if(!e.isPrimary)return;let t=e.pointerType===`touch`;if(o.setTouchMode(t),!Fz(e,`data-react-grab-ignore-events`)&&!xe()&&!(t&&!u()&&!d())){if((t?u():d())&&!b()&&f()&&!e.shiftKey&&!A()){if(be.consumeMouseHandoff()){Dn();return}o.unfreeze(),Tn()}pn(e.clientX,e.clientY,e.shiftKey)}}),{passive:!0}),Sn.addWindowListener(`pointerdown`,zj(e=>{if(e.button===0&&e.isPrimary&&(o.setTouchMode(e.pointerType===`touch`),ve=!1,!Fz(e,`data-react-grab-ignore-events`))){if(pe()){nn(e.clientX,e.clientY)&&(ve=!0,e.preventDefault(),e.stopImmediatePropagation());return}if(b()){let t=Et();t&&e.clientX>=t.x&&e.clientX<=t.x+t.width&&e.clientY>=t.y&&e.clientY<=t.y+t.height?Xt():Zt();return}if(be.isPendingDismiss()){e.preventDefault(),e.stopImmediatePropagation();return}if(v()){e.preventDefault(),e.stopImmediatePropagation();return}mn(e.clientX,e.clientY,e.shiftKey)&&(e.pointerId!==void 0&&document.documentElement.setPointerCapture(e.pointerId),e.preventDefault(),e.stopImmediatePropagation())}}),{capture:!0}),Sn.addWindowListener(`pointerup`,zj(e=>{if(e.button!==0||!e.isPrimary||Fz(e,`data-react-grab-ignore-events`)||pe())return;let t=it()||v()||p(),n=e.metaKey||e.ctrlKey;xn(e.clientX,e.clientY,n,e.shiftKey),t&&(e.preventDefault(),e.stopImmediatePropagation())}),{capture:!0}),Sn.addWindowListener(`contextmenu`,zj(e=>{if(!it()||_()||b()||fe.isOpen())return;let t=Fz(e,`data-react-grab-ignore-events`),n={x:e.clientX,y:e.clientY},r=t&&i.frozenElements.length>1?vn(n):null,a=be.isPendingDismiss();if(t&&!r&&!a&&!vt())return;if(pe()){e.preventDefault();return}e.preventDefault(),e.stopPropagation();let s=r??NF(e.clientX,e.clientY);if(!s)return;let c=i.frozenElements;c.length>1&&c.includes(s)?fI(c):(fI([s]),o.setFrozenElement(s)),o.setPointer(n),o.freeze(),un(s,n)}),{capture:!0}),Sn.addWindowListener(`pointercancel`,zj(e=>{e.isPrimary&&bn()})),Sn.addWindowListener(`click`,zj(e=>{if(!Fz(e,`data-react-grab-ignore-events`)){if(ve){ve=!1,e.preventDefault(),e.stopImmediatePropagation();return}pe()||(it()||g())&&(e.preventDefault(),e.stopImmediatePropagation(),i.wasActivatedByToggle&&!b()&&!e.shiftKey&&(u()?o.setWasActivatedByToggle(!1):qt()))}}),{capture:!0}),Sn.addDocumentListener(`visibilitychange`,()=>{if(document.hidden){o.clearGrabbedBoxes();let e=i.activationTimestamp;d()&&!b()&&e!==null&&Date.now()-e>500&&qt()}}),Sn.addWindowListener(`blur`,()=>{bn(),u()&&(Te(),o.releaseHold(),Ee()),Ce()}),Sn.addWindowListener(`focus`,()=>{ze=Date.now()}),Sn.addWindowListener(`focusin`,e=>{Fz(e,Bj)&&e.stopPropagation()},{capture:!0});let Wn=()=>{if(!(i.isTouchMode&&!u()&&!d())&&!xe()&&!f()&&!p()&&i.frozenElements.length===0){let e=NF(s().x,s().y);o.setDetectedElement(e)}},Gn=null,Kn=null,qn=()=>{UJ(),Wn(),o.incrementViewportVersion(),o.updateContextMenuPosition()};Sn.addWindowListener(`scroll`,qn,{capture:!0});let Jn=window.innerWidth,Yn=window.innerHeight;Sn.addWindowListener(`resize`,()=>{let e=window.innerWidth,t=window.innerHeight;if(Jn>0&&Yn>0){let n=e/Jn,r=t/Yn,i=Math.abs(n-r)<xM,a=Math.abs(n-1)>xM;i&&a&&o.setPointer({x:s().x*n,y:s().y*r})}Jn=e,Yn=t,qn()});let Xn=window.visualViewport;if(Xn){let{signal:e}=Sn;Xn.addEventListener(`resize`,qn,{signal:e}),Xn.addEventListener(`scroll`,qn,{signal:e})}let Zn=()=>{Kn===null&&(Kn=nF(()=>{Kn=null,o.incrementViewportVersion()}))};yL(()=>{if(r.store.theme.enabled&&(d()||_()||i.labelInstances.length>0||i.grabbedBoxes.length>0)){if(Gn!==null)return;Gn=window.setInterval(()=>{Zn()},100);return}Gn!==null&&(window.clearInterval(Gn),Gn=null),Kn!==null&&(rF(Kn),Kn=null)}),EL(()=>{Gn!==null&&window.clearInterval(Gn),Kn!==null&&rF(Kn)}),Sn.addDocumentListener(`copy`,zj(e=>{b()||Fz(e,`data-react-grab-ignore-events`)||it()&&e.preventDefault()}),{capture:!0}),EL(()=>{Sn.abort(),je!==null&&window.clearTimeout(je),Fe&&window.clearTimeout(Fe),Ue(),ge?.(),ge=null,_e?.(),_e=null,at.forEach(e=>window.clearTimeout(e)),at.clear(),st.cancelAllFades(),rt.stop(),ee(`userSelect`,``),ee(`touchAction`,``),Gt(null),Cn.restore(),Ij(null)});let{root:Qn,host:$n}=aJ(Vq);EL(wJ($n).cleanup);let er=J(()=>r.store.theme.enabled),tr=J(()=>r.store.theme.selectionBox.enabled),nr=J(()=>r.store.theme.elementLabel.enabled),rr=J(()=>r.store.theme.dragBox.enabled),ir=J(()=>y()||re()&&!f()||fe.isInteracting()),ar=J(()=>Ft().length>0),or=J(()=>!er()||!tr()||ir()?!1:ar()?!0:xt()),sr=J(()=>{let e=bt();if(e)return RM(e)||void 0}),cr=J(()=>!er()||pe()||!nr()||ir()?!1:xt()),lr=new Map,ur=e=>{let t=e.elements?.filter(oz)??[],n=e.element,r=null;t.length>0?r=t.map($q):n&&oz(n)&&(r=[$q(n)]);let i=e.bounds,a=e.boundsMultiple;r&&(i=r.length>1?KJ(aY(r)):r[0],e.boundsMultiple!==void 0&&(a=e.boundsMultiple.length>1&&e.boundsMultiple.length===e.elements?.length?r:[i]));let o=lr.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 lr.set(e.id,f),f},dr=J(()=>{if(!er()||!r.store.theme.grabbedBoxes.enabled)return[];c();let e=new Set(i.labelInstances.map(e=>e.id));for(let t of lr.keys())e.has(t)||lr.delete(t);return i.labelInstances.map(ur)}),fr=J(()=>!er()||!r.store.theme.grabbedBoxes.enabled?[]:(c(),i.grabbedBoxes.map(e=>!e.element||!document.body.contains(e.element)?e:{...e,bounds:$q(e.element)}))),pr=J(()=>er()&&rr()&&it()&&kt()),mr=J(()=>_()?`processing`:`hover`),hr=J(()=>{if(!er())return!1;let e=nr(),t=b(),n=_(),r=it(),i=p(),a=!!ht(),o=re(),s=f();return!e||t||o&&!s?!1:n?!0:r&&!i&&a}),gr=J(()=>{c();let e=i.contextMenuElement;return e?$q(e):null}),_r=J(()=>(c(),i.contextMenuPosition)),vr=J(()=>{let e=i.contextMenuElement;if(!e)return;let t=i.frozenElements.length;return t>1?`${t} elements`:RM(e)||void 0}),[yr]=oJ(()=>i.frozenElements.length>1?null:i.contextMenuElement),[br]=xL(()=>i.contextMenuElement,async e=>e?zH(e):null),xr=async e=>{o.incrementSelectionInteractionLockDepth();try{return await e()}finally{o.decrementSelectionInteractionLockDepth()}},Sr=(e,t,n,r,a)=>async c=>{await xr(async()=>{let l=a?.fallbackBounds??null,u=a?.fallbackSelectionBounds??[],d=a?.position??i.contextMenuPosition??s(),f=Ct(),p=gr()??l,m=t.length>1,h=m?KJ(aY(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=st.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=OJ(e,`Action failed`)}st.updateAfterCopy(a,o,s)}else try{await c()}catch{}g?qt():o.unfreeze()})},Cr=()=>{setTimeout(()=>{o.hideContextMenu()},0)},wr=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?Cr:o.hideContextMenu,v={element:t,elements:g,filePath:n,lineNumber:a,componentName:c,tagName:s,enterPromptMode:h??(()=>{st.clearAll(),an(),m?.(),De(t,l.x,l.y),o.setPointer({x:l.x,y:l.y}),o.setFrozenElement(t),Oe(),d()||Kt(),_()}),enterEditMode:()=>{tn(t,l,{filePath:n,lineNumber:a,componentName:c,tagName:s})&&an(),_()},copy:()=>{an(),p?.(),ft({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:Sr(t,g,s,c,u),hideContextMenu:_,cleanup:()=>{i.wasActivatedByToggle?qt():o.unfreeze()}},y=r.hooks.transformActionContext(v);return{...v,...y}},Tr=J(()=>{let e=i.contextMenuElement;if(!e)return;let t=br(),n=i.contextMenuPosition??s();return wr({element:e,filePath:t?.filePath,lineNumber:t?.lineNumber??void 0,tagName:vr(),componentName:yr(),position:n,shouldDeferHideContextMenu:!0,onBeforeCopy:()=>{be.clear()},customEnterPromptMode:()=>{st.clearAll(),an(),o.clearInputText(),o.enterPromptMode(n,e),Cr()}})}),Er=()=>{setTimeout(()=>{o.hideContextMenu(),qt()},0)},Dr=()=>{if(!he)return null;let e=he.getBoundingClientRect(),t=xX(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}},Or=()=>{let e=Dr();if(e)return e;let t=fe.state();return t?{x:t.position.x,y:t.position.y,edge:`bottom`}:null},kr=(e,t)=>{let n=null,r=()=>{let i=e();i&&t(i),n=nF(r)};return r(),()=>{n!==null&&(rF(n),n=null)}};yL(()=>{if(!vt())return;let e=kr(Dr,de);EL(()=>{e(),de(null)})});let Ar=()=>{ge?.(),ge=null,se(null)},jr=()=>{o.hideContextMenu(),Ar(),fe.dismiss()},Mr=()=>{oe()===null?(o.hideContextMenu(),fe.isOpen()&&fe.closePreservingRenderer(),ge?.(),ge=kr(Dr,se)):Ar()},Nr=e=>{we({defaultAction:e})},Pr=e=>{let t=i.labelInstances.find(t=>t.id===e);if(!t?.element||!oz(t.element))return;let n=t.element,r=eJ($q(n)),a={x:t.mouseX??r.x,y:r.y},s=t.elements&&t.elements.length>0?t.elements.filter(e=>oz(e)):[n];setTimeout(()=>{Ar(),fe.isOpen()&&fe.closePreservingRenderer(),d()||(o.setWasActivatedByToggle(!0),Kt()),o.setPointer(a),o.setFrozenElements(s),s.length>1&&t.bounds&&o.setFrozenDragRect(GJ(t.bounds)),o.freeze(),o.showContextMenu(a,n)},0)};yL(()=>{let e=r.store.theme.hue;e===0?Qn.style.filter=``:Qn.style.filter=`hue-rotate(${e}deg)`}),r.store.theme.enabled&&Promise.resolve().then(()=>(Eq(),iU)).then(({ReactGrabRenderer:e})=>{t||(n=dR(()=>Y(e,{get selectionVisible(){return or()},get selectionBounds(){return Et()},get selectionBoundsMultiple(){return It()},get selectionShouldSnap(){return i.frozenElements.length>0||Ft().length>0},get selectionElementsCount(){return i.frozenElements.length},get frozenLabelEntries(){return Rt()},get pendingShiftPreviewEntry(){return zt()??void 0},get selectionFilePath(){return i.selectionFilePath??void 0},get selectionLineNumber(){return i.selectionLineNumber??void 0},get selectionTagName(){return sr()},get selectionComponentName(){return Qe()},get selectionLabelVisible(){return cr()},selectionLabelStatus:`idle`,get hierarchyState(){return Vn()},get hierarchyMenuPosition(){return ue()},get labelInstances(){return dr()},get dragVisible(){return pr()},get dragBounds(){return Pt()},get grabbedBoxes(){return fr()},get mouseX(){return iz(()=>i.frozenElements.length>1)()?void 0:Vt()??Bt().x},get isFrozen(){return f()||d()||re()},get inputValue(){return i.inputText},get isPromptMode(){return b()},onShowContextMenuInstance:Pr,get onLabelInstanceHoverChange(){return st.handleHoverChange},get onInputChange(){return o.setInputText},onInputSubmit:()=>void Xt(),onToggleExpand:en,get selectionLabelShakeCount(){return O()},onConfirmDismiss:Qt,get discardPrompt(){return iz(()=>!!be.isPendingDismiss())()?{isKeyboardSelection:!0,onConfirm:Qt,onCopy:kn}:S()?{onConfirm:Qt,onCancel:$t}:void 0},get toolbarVisible(){return r.store.theme.toolbar.enabled},get isActive(){return d()},onToggleActive:cn,onActivateAction:sn,get activeActionId(){return et()},get enabled(){return w()},get shakeCount(){return E()},onToolbarStateChange:e=>{k(e),e.enabled!==w()&&(T(e.enabled),e.enabled||(Jt(),jr())),EX.forEach(t=>t(e))},onSubscribeToToolbarStateChanges:e=>(EX.add(e),()=>{EX.delete(e)}),onToolbarSelectHoverChange:ie,onToolbarRef:e=>{he=e},get contextMenuPosition(){return _r()},get contextMenuBounds(){return gr()},get contextMenuTagName(){return vr()},get contextMenuComponentName(){return yr()},get contextMenuHasFilePath(){return!!br()?.filePath},get actions(){return r.store.actions},get actionContext(){return Tr()},onContextMenuDismiss:Er,onContextMenuHide:Cr,get toolbarMenuPosition(){return oe()},get toolbarMenuActions(){return r.store.actions.filter(e=>e.showInToolbarMenu===!0)},get defaultActionId(){return ne()?.defaultAction??`copy`},onSetDefaultAction:Nr,onToggleToolbarMenu:Mr,onToolbarMenuDismiss:Ar,get editPanelState(){return fe.state()},get editPanelPosition(){return ce()},get onEditPanelDismiss(){return fe.dismiss},get onEditPanelSubmit(){return fe.submit},get onEditPanelPendingEditsChange(){return fe.setPendingEdits},get onEditPanelInteractingChange(){return fe.setInteracting}}),Qn))}).catch(e=>{console.warn(`[react-grab] Failed to load renderer:`,e)});let Fr={activate:()=>{o.setPendingCommentMode(!1),!d()&&w()&&Yt()},deactivate:()=>{(d()||_())&&qt()},toggle:()=>{d()?qt():w()&&Yt()},comment:fn,isActive:()=>d(),isEnabled:()=>w(),setEnabled:e=>{e!==w()&&(T(e),we({enabled:e,collapsed:!e}),e||(Jt(),jr()))},getToolbarState:()=>ne()??RB(),setToolbarState:e=>{let t=ne()??RB(),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`};zB(r),k(r),r.enabled!==w()&&(T(r.enabled),r.enabled||(Jt(),jr())),EX.forEach(e=>e(r))},onToolbarStateChange:e=>(EX.add(e),()=>{EX.delete(e)}),reset:()=>{Jt(),jr(),o.clearGrabbedBoxes(),o.clearLabelInstances(),o.setSelectionSource(null,null)},dispose:()=>{t=!0,TX=!1,n?.(),ge?.(),ge=null,_e?.(),_e=null,EX.clear(),e()},copyElement:async e=>{let t=Array.isArray(e)?e:[e];return t.length!==0&&await lt(t)},getSource:async e=>{let t=await zH(e);return t?{filePath:t.filePath,lineNumber:t.lineNumber,componentName:t.componentName}:null},getStackContext:e=>ZH(e,{maxLines:r.store.options.maxContextLines}),getState:()=>({isActive:d(),isDragging:p(),isCopying:_(),isPromptMode:b(),isSelectionBoxVisible:!!or(),isDragBoxVisible:!!pr(),targetElement:mt(),dragBounds:Pt()??null,grabbedBoxes:[...Ht()],labelInstances:[...Ut()],selectionFilePath:i.selectionFilePath,toolbarState:ne()}),setOptions:e=>{r.setOptions(e)},registerPlugin:e=>{r.register(e,Fr)},unregisterPlugin:e=>{r.unregister(e)},getPlugins:()=>r.getPluginNames(),getDisplayName:BH};for(let e of wX)r.register(e,Fr);return setTimeout(()=>{XP(!0)},TM),Fr})}})),kX=r({DEFAULT_THEME:()=>ZY,commentPlugin:()=>vX,formatElementInfo:()=>eU,generateSnippet:()=>CX,getGlobalApi:()=>jX,getStack:()=>jH,init:()=>DX,isInstrumentationActive:()=>dN,openPlugin:()=>bX,registerPlugin:()=>FX,setGlobalApi:()=>MX,unregisterPlugin:()=>IX}),AX,jX,MX,NX,PX,FX,IX,LX=t((()=>{OX(),pL(),rU(),AX=null,jX=()=>typeof window>`u`?AX:window.__REACT_GRAB__??AX??null,MX=e=>{AX=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},NX=[],PX=e=>{for(;NX.length>0;){let t=NX.shift();t&&e.registerPlugin(t)}},FX=e=>{let t=jX();if(t){t.registerPlugin(e);return}NX.push(e)},IX=e=>{let t=jX();if(t){t.unregisterPlugin(e);return}let n=NX.findIndex(t=>t.name===e);n!==-1&&NX.splice(n,1)},typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?AX=window.__REACT_GRAB__:(AX=DX(),window.__REACT_GRAB__=AX),PX(AX),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:AX})))}));Cr(),zr(),hD();var RX=`linear-grab:context-copied`,zX=`linear-grab:picker-activated`,BX=0,VX=null;function HX(e){!e||e.grabbedAt===BX||Er().then(t=>{if(t.workflowMode!==`local`||e.grabbedAt===BX)return;let n=()=>{BX=e.grabbedAt,navigator.clipboard.writeText(dD(e,t)).then(()=>window.dispatchEvent(new CustomEvent(RX))).catch(()=>{BX=0})};e.source?.filePath?(VX&&clearTimeout(VX),VX=null,n()):(VX&&clearTimeout(VX),VX=setTimeout(n,900))})}function UX(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 WX(e,t){let n=null,r=0;return{plugin:{name:`linear-grab`,hooks:{onElementSelect:i=>{r=Date.now(),n=Er().then(e=>e.captureShots?yA(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)=>UX(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 GX=!1;async function KX(){if(Sr||GX)return;GX=!0;let e=await Promise.resolve().then(()=>(LX(),kX));try{e.init()}catch{GX=!1;return}let t=WX(e=>{Ar(e),HX(e[0])},()=>e.getGlobalApi());e.registerPlugin(t.plugin),gA(),window.addEventListener(`react-grab:element-selected`,e=>{t.handleSelection(e.detail.elements??[])})}async function qX(){if(Sr){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 KX();let e=await Promise.resolve().then(()=>(LX(),kX));window.dispatchEvent(new CustomEvent(zX)),e.getGlobalApi()?.activate()}function JX(e){if(!Sr)return()=>{};let t=t=>{t?.type===`grab/updated`&&e()};return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)}zr(),hD();var YX=M(`<span class="text-text-faint ml-auto text-[10.5px] font-normal normal-case tabular-nums">`),XX=M(`<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">`),ZX=M(`<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.`),QX=M(`<div class="flex flex-col gap-1.5">`),$X=M(`<span class=text-danger>●`),eZ=M(`<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.`),tZ=M(`<span class="inline-block min-w-[4ch] text-center">Stop`),nZ=M(`<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`),rZ=M(`<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…`),iZ=M(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4">`),aZ=M(`<span class="text-success text-[12px] leading-none">✓`),oZ=M(`<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">`),sZ=M(`<span class="font-mono text-text-dim break-all text-[11px] leading-snug">`),cZ=M(`<img alt="Element location screenshot"class="border-border bg-bg max-h-32 w-full rounded-md border object-contain">`),lZ=M(`<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">`),uZ=M(`<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">`),dZ=M(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M8 2.5v8M4.5 7.5 8 11l3.5-3.5M2.5 13.5h11">`),fZ=M(`<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">`),pZ=M(`<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">`),mZ=M(`<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 hZ(e){return(()=>{var t=XX(),n=t.firstChild;n.firstChild;var r=n.nextSibling;return N(n,()=>e.title,null),N(n,A(j,{get when(){return e.badge},get children(){var t=YX();return N(t,()=>e.badge),t}}),null),N(r,()=>e.children),t})()}function gZ(){let e=ur(),t=br(()=>({queryKey:[`grab`],queryFn:Or})),n=br(()=>({queryKey:[`settings`],queryFn:Er})),r=()=>t.data??[],i=()=>!!(n.data?.linearApiKey||n.data?.linearAccessToken),[a,o]=w(null),s=()=>{o(null),qX().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 Mr(),e.invalidateQueries({queryKey:[`grab`]})},[l,u]=w(null),d=async e=>{try{await navigator.clipboard.writeText(dD(e,n.data??{})),u(e.grabbedAt),setTimeout(()=>u(null),1800)}catch{o(`Clipboard was blocked — click the button again.`)}},f=async t=>{await jr(t),e.invalidateQueries({queryKey:[`grab`]})},[p,m]=w(VD());oe(HD(m));let[h,g]=w(0);D(()=>{if(p().phase!==`recording`)return;let e=setInterval(()=>g(Date.now()-(VD().startedAt??Date.now())),250);oe(()=>clearInterval(e))});let _=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[v,y]=w(`idle`),[b,x]=w(null),S=async()=>{let e=VD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await yO(e.blob,`recording-${Date.now()}.gif`);return nO(t),t},ee=async()=>{x(null),y(`busy`);try{let e=S().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())}y(`copied`),setTimeout(()=>y(`idle`),2e3)}catch{y(`idle`),await te(),x(`Direct upload is blocked in this browser — copied the GIF instead. Paste it into a Linear comment and Linear uploads it.`)}},C=()=>{let e=p().result;if(!e)return;let t=document.createElement(`a`);t.href=e.url,t.download=`linear-grab-recording.gif`,t.click()},[T,O]=w(`idle`),te=async()=>{let e=p().result;if(e){x(null),O(`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})]),x(`Browser blocks GIF clipboard — copied the first frame as PNG. Use Download for the animation.`)}O(`copied`),setTimeout(()=>O(`idle`),2e3)}catch(e){O(`idle`),x(e instanceof Error?e.message:`Copy failed.`)}}};return(()=>{var e=iZ();return N(e,A(hZ,{title:`Captured elements`,get badge(){return nt(()=>!!r().length)()?`${r().length}/8`:void 0},get children(){return[A(j,{get when(){return r().length>0},get fallback(){return A(ej,{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=ZX(),t=e.firstChild;return t.firstChild,N(e,A(Ge,{get each(){return r()},children:e=>(()=>{var t=lZ(),n=t.firstChild.firstChild,r=n.nextSibling;return N(n,(()=>{var t=nt(()=>!!e.componentName);return()=>t()?`<${e.componentName}>`:nt(()=>!!e.tagName)()?`<${e.tagName}>`:`Element`})()),N(r,A(GA,{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 A(j,{get when(){return l()===e.grabbedAt},get fallback(){return uZ()},get children(){return aZ()}})}}),null),N(r,A(GA,{class:`size-7 px-0`,variant:`ghost`,title:`Remove this element`,"aria-label":`Remove element`,onClick:()=>void f(e.grabbedAt),get children(){return oZ()}}),null),N(t,A(j,{get when(){return e.source?.filePath},get children(){var t=sZ();return N(t,()=>e.source.filePath,null),N(t,(()=>{var t=nt(()=>e.source?.lineNumber!=null);return()=>t()?`:${e.source.lineNumber}`:``})(),null),t}}),null),N(t,A(j,{get when(){return e.screenshotDataUrl},get children(){var t=cZ();return E(()=>st(t,`src`,e.screenshotDataUrl)),t}}),null),t})()}),t),N(t,A(GA,{class:`h-6 shrink-0 px-2 text-[11px]`,variant:`ghost`,onClick:c,children:`Clear all`}),null),e}}),(()=>{var e=QX();return N(e,A(GA,{variant:`primary`,onClick:s,children:`Pick element`}),null),N(e,A(j,{get when(){return a()},get children(){return A(tj,{get message(){return a()}})}}),null),e})()]}}),null),N(e,A(hZ,{title:`Recording`,get badge(){return nt(()=>!!p().result)()?`${(p().result.durationMs/1e3).toFixed(1)}s`:void 0},get children(){return[A(j,{get when(){return p().phase===`idle`||p().phase===`error`},get children(){var e=eZ(),t=e.firstChild;return N(e,A(GA,{variant:`ghost`,onClick:()=>void QD(),get children(){return[$X(),` Record interaction`]}}),t),N(e,A(j,{get when(){return nt(()=>p().phase===`error`)()&&p().error},get children(){return A(tj,{get message(){return p().error}})}}),null),e}}),A(j,{get when(){return p().phase===`recording`},get children(){var e=nZ(),t=e.firstChild.nextSibling;return t.nextSibling,N(t,()=>_(h())),N(e,A(GA,{variant:`primary`,class:`ml-auto`,onClick:()=>void $D(),get children(){return tZ()}}),null),e}}),A(j,{get when(){return p().phase===`processing`},get children(){var e=rZ(),t=e.firstChild;return N(e,A(KA,{}),t),e}}),A(j,{get when(){return nt(()=>p().phase===`ready`)()&&p().result},children:e=>(()=>{var t=pZ(),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 N(r,()=>(e().blob.size/1024).toFixed(0),a),N(r,()=>(e().durationMs/1e3).toFixed(1),o),N(r,()=>e().width,s),N(r,()=>e().height,null),l.addEventListener(`change`,e=>tO(e.currentTarget.checked)),N(u,A(GA,{variant:`ghost`,class:`size-7 px-0`,get loading(){return v()===`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 ee(),get children(){return A(j,{get when(){return v()===`copied`},get fallback(){return mZ()},get children(){return aZ()}})}}),null),N(u,A(GA,{variant:`ghost`,class:`size-7 px-0`,get loading(){return T()===`busy`},title:`Copy GIF — paste into a Linear comment and Linear uploads it`,"aria-label":`Copy GIF`,onClick:()=>void te(),get children(){return A(j,{get when(){return T()===`copied`},get fallback(){return uZ()},get children(){return aZ()}})}}),null),N(u,A(GA,{variant:`ghost`,class:`size-7 px-0`,title:`Download GIF`,"aria-label":`Download GIF`,onClick:C,get children(){return dZ()}}),null),N(u,A(GA,{variant:`danger`,class:`ml-auto size-7 px-0`,title:`Discard recording`,"aria-label":`Discard recording`,onClick:eO,get children(){return fZ()}}),null),N(t,A(j,{get when(){return b()},get children(){return A(tj,{get message(){return b()}})}}),null),E(()=>st(n,`src`,e().url)),E(()=>l.checked=p().attachOnCreate),t})()})]}}),null),e})()}function _Z(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 vZ(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 yZ(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var bZ=(e,t)=>Math.abs(e-t)<1.01,xZ=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},SZ,CZ=()=>{if(SZ!==void 0)return SZ;if(typeof navigator>`u`)return SZ=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return SZ=!0;let e=navigator.maxTouchPoints;return SZ=navigator.platform===`MacIntel`&&e!==void 0&&e>0},wZ=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},TZ=e=>e,EZ=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},DZ=(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(wZ(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(wZ(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},OZ={passive:!0},kZ=typeof window>`u`||`onscrollend`in window,AZ=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&kZ,o=0,s=a?null:xZ(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,OZ),a&&r.addEventListener(`scrollend`,u,OZ),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},jZ=(e,t)=>AZ(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),MZ=(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`]},NZ=(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})},PZ=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:TZ,rangeExtractor:EZ,onChange:()=>{},measureElement:MZ,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=vZ(()=>(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,!(!CZ()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,OZ),e.addEventListener(`touchend`,n,OZ),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&&(CZ()&&(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=vZ(()=>[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=vZ(()=>[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=_Z(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=vZ(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=LZ(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=vZ(()=>{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=vZ(()=>[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 yZ(t[FZ(0,t.length-1,r?e=>n[e*2]:e=>yZ(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&&(CZ()&&(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&&bZ(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()}},FZ=(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 IZ(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 LZ(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=IZ(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=FZ(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 RZ(e){let t=He(e),n=new PZ(t),[r,i]=ir(n.getVirtualItems()),[a,o]=w(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),ae(()=>{let e=s._didMount();s._willUpdate(),oe(e)}),T(()=>{s.setOptions(He(t,e,{onChange:(t,n)=>{var r;t._willUpdate(),i(cr(t.getVirtualItems(),{key:`index`})),o(t.getTotalSize()),(r=e.onChange)==null||r.call(e,t,n)}})),s._willUpdate(),i(cr(n.getVirtualItems(),{key:`index`})),o(n.getTotalSize())}),s}function zZ(e){return RZ(He({observeElementRect:DZ,observeElementOffset:jZ,scrollToFn:NZ},e))}zr();var BZ=3e4,VZ=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,HZ={running:[],review:[]},UZ=null,WZ=new Set;function GZ(e){return WZ.add(e),UZ||(UZ=setInterval(()=>void JZ(),BZ),JZ()),()=>{WZ.delete(e),!WZ.size&&UZ&&(clearInterval(UZ),UZ=null)}}function KZ(){JZ()}function qZ(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=>VZ.test(e.url))?.url}}async function JZ(){try{let e=await Er();if(!e.linearApiKey&&!e.linearAccessToken)return;let t=(await dO()).filter(e=>!!e.delegate&&e.state.type===`started`).map(qZ);HZ={running:t.filter(e=>!e.prUrl),review:t.filter(e=>!!e.prUrl)};for(let e of WZ)e(HZ)}catch{}}function YZ(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var XZ=/^(https?:\/\/|mailto:)/i;function ZZ(e){let t=e;return t=t.replace(/`([^`]+)`/g,(e,t)=>`<code>${t}</code>`),t=t.replace(/!\[([^\]]*)\]\((?:<)?([^()\s]+?)(?:>)?\)/g,(e,t,n)=>XZ.test(n)?`<img src="${n}" alt="${t}" loading="lazy" />`:t),t=t.replace(/\[([^\]]+)\]\((?:<)?([^()\s]+?)(?:>)?\)/g,(e,t,n)=>XZ.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 QZ(e){let t=YZ(e.trim()).split(`
|
|
202
|
+
`),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(`
|
|
203
|
+
`)}</code></pre>`);continue}let i=e.match(/^(#{1,6})\s+(.*)$/);if(i){n.push(`<h4>${ZZ(i[2])}</h4>`),r++;continue}if(/^\s*[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*[-*]\s+/.test(t[r]);)e.push(`<li>${ZZ(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>${ZZ(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>${ZZ(a.join(`<br />`))}</p>`)}return n.join(``)}zr();var $Z=M(`<div class="flex h-full flex-col">`),eQ=M(`<span class="tabular-nums text-[10.5px] text-text-faint">live · updated `),tQ=M(`<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">`),nQ=M(`<div class="flex-1 overflow-y-auto">`),rQ=M(`<div class="min-h-0 flex-1 overflow-y-auto pl-2 pr-3"><div style=position:relative>`),iQ=M(`<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">`),aQ=M(`<div style=position:absolute;top:0;left:0;width:100%>`),oQ=M(`<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">`),sQ=M(`<span class="inline-block min-w-[6ch] text-left">← Back`),cQ=M(`<span class="font-mono text-[11px] text-text-dim shrink-0">`),lQ=M(`<span class="truncate text-[12px] font-medium text-text">`),uQ=M(`<span class="text-[11.5px] text-text-faint">Loading…`),dQ=M(`<div class="flex items-center gap-2"><span class="text-[11px] text-text-dim"></span><a target=_blank rel=noreferrer class="ml-auto text-[11px] text-accent hover:underline shrink-0">Open in Linear ↗`),fQ=M(`<div class="flex flex-col gap-2">`),pQ=M(`<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-wrap gap-1.5">`),mQ=M(`<div class="flex flex-col gap-2.5"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Comments`),hQ=M(`<option value=new>Start NEW agent (@<!>)`),gQ=M(`<option value=comment>Comment only`),_Q=M(`<span class="inline-block min-w-[4ch] text-left">Send`),vQ=M(`<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">`),yQ=M(`<a target=_blank rel=noreferrer class="max-w-[200px] truncate text-[11.5px] text-accent hover:underline">`),bQ=M(`<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">`),xQ=M(`<option>Steer running agent<!> · `),SQ=M(`<span class="text-[11px] text-text-dim">`),CQ=M(`<p class="text-[12px] text-text leading-relaxed whitespace-pre-wrap break-words">`),wQ=M(`<div class="flex flex-col gap-0.5 border-t border-border pt-1.5 mt-0.5">`),TQ=M(`<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">`),EQ=M(`<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 DQ(){let[e,t]=w(null);return D(()=>{let e=DA();e&&(t(e),AA())}),(()=>{var n=$Z();return N(n,A(j,{get when(){return e()===null},get fallback(){return A(AQ,{get issueId(){return e()},onBack:()=>t(null)})},get children(){return A(OQ,{onSelect:e=>t(e)})}})),n})()}function OQ(e){let t,n=br(()=>({queryKey:[`my-issues`],queryFn:dO,refetchInterval:12e3})),r=O(()=>n.data??[]),i=zZ({get count(){return r().length},getScrollElement:()=>t,estimateSize:()=>56,overscan:5});return(()=>{var a=iQ(),o=a.firstChild.firstChild.nextSibling;return N(o,A(j,{get when(){return n.dataUpdatedAt>0},get children(){var e=eQ();return e.firstChild,N(e,()=>rj(n.dataUpdatedAt),null),e}}),null),N(o,A(GA,{class:`size-7 px-0`,get loading(){return n.isFetching},onClick:()=>void n.refetch(),title:`Refresh`,"aria-label":`Refresh issues`,get children(){return tQ()}}),null),N(a,A(j,{get when(){return n.isError},get children(){var e=nQ();return N(e,A(ej,{title:`Connect Linear in Settings`,get children(){return n.error?.message??`Unable to load issues.`}})),e}}),null),N(a,A(j,{get when(){return nt(()=>!n.isError&&!n.isPending)()&&r().length===0},get children(){var e=nQ();return N(e,A(ej,{title:`No issues found`,children:`Issues you create will appear here.`})),e}}),null),N(a,A(j,{get when(){return nt(()=>!n.isError)()&&r().length>0},get children(){var n=rQ(),a=n.firstChild,o=t;return typeof o==`function`?gt(o,n):t=n,N(a,A(Ge,{get each(){return i.getVirtualItems()},children:t=>{let n=O(()=>r()[t.index]);return(()=>{var r=aQ();return N(r,A(kQ,{get issue(){return n()},get onSelect(){return e.onSelect}})),E(e=>mt(r,`transform`,`translateY(${t.start}px)`)),r})()}})),E(e=>mt(a,`height`,`${i.getTotalSize()}px`)),n}}),null),a})()}function kQ(e){return(()=>{var t=oQ(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling,o=a.firstChild;return t.$$click=()=>e.onSelect(e.issue.id),N(n,A($A,{get color(){return e.issue.state.color}}),r),N(r,()=>e.issue.identifier),N(i,()=>e.issue.title),N(a,A(QA,{get children(){return e.issue.state.name}}),o),N(a,A(j,{get when(){return e.issue.delegate},get children(){return A(QA,{class:`text-accent`,get children(){return[`⟠ `,nt(()=>e.issue.delegate.displayName)]}})}}),o),N(a,A(j,{get when(){return nt(()=>!!(e.issue.state.type===`started`&&e.issue.delegate))()&&e.issue.attachments?.some(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url))},get children(){return A(QA,{color:`var(--color-warn)`,children:`needs review`})}}),o),N(o,()=>rj(e.issue.updatedAt)),t})()}function AQ(e){let t=ur(),n=br(()=>({queryKey:[`issue`,e.issueId],queryFn:()=>fO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),r=br(()=>({queryKey:[`sessions`,e.issueId],queryFn:()=>pO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),i=br(()=>({queryKey:[`settings`],queryFn:Er})),[a,o]=w(``),[s,c]=w(null),l=O(()=>n.data?_O(n.data.comments):[]),[u,d]=w(`comment`),f=!1;D(()=>{if(f||!n.data||!i.data)return;f=!0;let e=l();e.length?d(`thread:${e[0].id}`):n.data.delegate&&i.data.cursorAgentId&&d(`new`)});let p=xr(()=>({mutationFn:async()=>{let t=a().trim();if(!t)throw Error(`Message is empty`);let n=i.data??{},r=u();r.startsWith(`thread:`)?await hO(e.issueId,t,r.slice(7)):r===`new`&&n.cursorAgentId?await gO(e.issueId,t,{name:n.cursorAgentName,displayName:n.cursorAgentName??`Cursor`,url:n.cursorAgentUrl}):await hO(e.issueId,t)},onSuccess:()=>{o(``),c(null),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),KZ()},onError:e=>{c(e.message??`Failed to send`)}})),m=O(()=>n.data),h=O(()=>r.data??[]);return(()=>{var t=vQ(),r=t.firstChild,c=r.firstChild,f=r.nextSibling,g=f.nextSibling,_=g.firstChild;return N(c,A(GA,{class:`min-w-[68px] shrink-0 text-[11px]`,get onClick(){return e.onBack},get children(){return sQ()}}),null),N(c,A(j,{get when(){return m()},get children(){return[(()=>{var e=cQ();return N(e,()=>m().identifier),e})(),(()=>{var e=lQ();return N(e,()=>m().title),e})()]}}),null),N(c,A(j,{get when(){return nt(()=>!!n.isPending)()&&!m()},get children(){return uQ()}}),null),N(r,A(j,{get when(){return m()},get children(){var e=dQ(),t=e.firstChild,n=t.nextSibling;return N(e,A($A,{get color(){return m().state.color}}),t),N(t,()=>m().state.name),E(()=>st(n,`href`,m().url)),e}}),null),N(f,A(j,{get when(){return h().length>0},get children(){var e=fQ();return N(e,A(Ge,{get each(){return h()},children:e=>A(jQ,{session:e})})),e}}),null),N(f,A(j,{get when(){return nt(()=>!!m())()&&m().attachments.length>0},get children(){var e=pQ(),t=e.firstChild.nextSibling;return N(t,A(Ge,{get each(){return m().attachments},children:e=>(()=>{var t=yQ();return N(t,()=>e.title),E(n=>{var r=e.url,i=e.title;return r!==n.e&&st(t,`href`,n.e=r),i!==n.t&&st(t,`title`,n.t=i),n},{e:void 0,t:void 0}),t})()})),e}}),null),N(f,A(j,{get when(){return nt(()=>!!m())()&&m().comments.length>0},get children(){var e=mQ();return e.firstChild,N(e,A(Ge,{get each(){return m().comments},children:e=>(()=>{var t=bQ(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling;return N(r,()=>e.user?.displayName??e.user?.name??`Unknown`),N(n,A(j,{get when(){return e.user?.app},get children(){return A(QA,{children:`agent`})}}),i),N(i,()=>rj(e.createdAt)),E(()=>a.innerHTML=QZ(e.body)),t})()}),null),e}}),null),N(f,A(j,{get when(){return nt(()=>!!(m()&&m().comments.length===0))()&&h().length===0},get children(){return A(ej,{title:`No activity yet`,children:`Comments and agent sessions will appear here.`})}}),null),N(f,A(j,{get when(){return nt(()=>!!n.isError)()&&!m()},get children(){return A(ej,{title:`Failed to load issue`,get children(){return n.error?.message??`Unknown error`}})}}),null),N(g,A(j,{get when(){return s()},get children(){return A(tj,{get message(){return s()}})}}),_),N(g,A(JA,{rows:2,placeholder:`Reply — steer the agent or add context…`,get value(){return a()},onInput:e=>o(e.target.value),get disabled(){return p.isPending}}),_),N(_,A(YA,{class:`min-w-0 flex-1`,get value(){return u()},onChange:e=>d(e.currentTarget.value),get children(){return[A(Ge,{get each(){return l()},children:(e,t)=>(()=>{var n=xQ(),r=n.firstChild.nextSibling;return r.nextSibling,N(n,(()=>{var e=nt(()=>l().length>1);return()=>e()?` #${t()+1}`:``})(),r),N(n,()=>rj(e.createdAt),null),E(()=>n.selected=u()===`thread:${e.id}`),E(()=>n.value=`thread:${e.id}`),n})()}),A(j,{get when(){return i.data?.cursorAgentId},get children(){var e=hQ(),t=e.firstChild.nextSibling;return t.nextSibling,N(e,()=>i.data?.cursorAgentName??`Cursor`,t),E(()=>e.selected=u()===`new`),e}}),(()=>{var e=gQ();return E(()=>e.selected=u()===`comment`),e})()]}}),null),N(_,A(GA,{class:`min-w-[52px] shrink-0`,variant:`primary`,get loading(){return p.isPending},get disabled(){return a().trim().length===0},onClick:()=>p.mutate(),get children(){return _Q()}}),null),t})()}function jQ(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=TQ(),i=r.firstChild,a=i.firstChild;return N(i,A(QA,{get color(){return t()},get children(){return e.session.status}}),a),N(i,A(j,{get when(){return e.session.appUser?.displayName},get children(){var t=SQ();return N(t,()=>e.session.appUser.displayName),t}}),a),N(a,()=>rj(e.session.updatedAt)),N(r,A(j,{get when(){return e.session.summary},get children(){var t=CQ();return N(t,()=>e.session.summary),t}}),null),N(r,A(j,{get when(){return n().length>0},get children(){var e=wQ();return N(e,A(Ge,{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=EQ(),r=t.firstChild,i=r.nextSibling;return N(r,()=>rj(e.createdAt)),N(i,n),t})()}})),e}}),null),r})()}ot([`click`]);var MQ=M(`<span class="text-text-faint max-w-[55%] truncate text-[10.5px] tabular-nums"> running · `),NQ=M(`<div class="flex flex-col gap-1.5">`),PQ=M(`<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">`),FQ=M(`<span class="bg-surface-2 border-border font-mono mt-2 block rounded-md border px-2 py-1.5 text-left text-[10.5px] break-all select-all">curl -fsSL https://cdn.jsdelivr.net/gh/ahmedbanihanibh/linear-grab@main/bin/linear-grab-bridge.mjs -o /tmp/lg-bridge.mjs && node /tmp/lg-bridge.mjs`),IQ=M(`<code>npx linear-grab-bridge`),LQ=M(`<code>claude -p`),RQ=M(`<span class="inline-block min-w-[4ch] text-center">`),zQ=M(`<div class="border-border bg-bg max-h-56 overflow-y-auto rounded-md border py-1.5 pl-2 pr-3">`),BQ=M(`<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 items-center gap-1.5">`),VQ=M(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),HQ=M(`<p class="text-text-faint text-[11px]">Waiting for output…`),UQ=M(`<p class="text-text-dim font-mono text-[10.5px] leading-relaxed break-words whitespace-pre-wrap">`);function WQ(){let e=ur(),t=br(()=>({queryKey:[`bridge-health`],queryFn:wO,refetchInterval:5e3,retry:0})),n=br(()=>({queryKey:[`bridge-tasks`],queryFn:TO,refetchInterval:3e3,enabled:!!t.data?.ok})),[r,i]=w(null),a=br(()=>({queryKey:[`bridge-task`,r()],queryFn:()=>EO(r()),refetchInterval:2e3,enabled:!!r()&&!!t.data?.ok})),o=xr(()=>({mutationFn:e=>OO(e),onSuccess:()=>void e.invalidateQueries({queryKey:[`bridge-tasks`]})})),s=e=>e===`running`?`var(--color-accent)`:e===`done`?`var(--color-success)`:e===`stopped`?`var(--color-warn)`:`var(--color-danger)`;return(()=>{var e=PQ(),c=e.firstChild;c.firstChild;var l=c.nextSibling;return N(c,A(j,{get when(){return t.data?.ok},get fallback(){return A(QA,{class:`text-danger`,children:`bridge offline`})},get children(){var e=MQ(),n=e.firstChild;return N(e,()=>t.data.active,n),N(e,()=>t.data.cwd.split(`/`).slice(-2).join(`/`),null),E(()=>st(e,`title`,t.data?.cwd)),e}}),null),N(l,A(j,{get when(){return t.data?.ok},get fallback(){return A(ej,{title:`Bridge not running`,get children(){return[`Start it in your repo's terminal (one line, no install):`,FQ(),`(After the package is published to npm: `,IQ(),`.) Then delegate from the Draft tab ("Local Claude Code") or watch tasks here. The bridge spawns headless `,LQ(),` `,`sessions in the repo — your interactive terminal session stays untouched.`]}})},get children(){return A(j,{get when(){return(n.data??[]).length>0},get fallback(){return A(ej,{title:`No local tasks yet`,children:`Create an issue in Draft with "Delegate to → Local Claude Code", and it appears here with live status.`})},get children(){var e=NQ();return N(e,A(Ge,{get each(){return n.data},children:e=>(()=>{var t=BQ(),n=t.firstChild,c=n.firstChild,l=c.nextSibling,u=n.nextSibling,d=u.nextSibling;return N(n,A(j,{get when(){return e.status===`running`},get fallback(){return(()=>{var t=VQ();return E(n=>mt(t,`background`,s(e.status))),t})()},get children(){return A(KA,{})}}),c),N(c,()=>e.title),N(l,()=>rj(e.startedAt)),N(u,()=>e.lastText),N(d,A(QA,{get color(){return s(e.status)},get children(){return e.status}}),null),N(d,A(GA,{variant:`ghost`,class:`ml-auto h-6 px-2 text-[11px]`,onClick:()=>i(r()===e.id?null:e.id),get children(){var t=RQ();return N(t,()=>r()===e.id?`Hide`:`Log`),t}}),null),N(d,A(j,{get when(){return e.status===`running`},get children(){return A(GA,{variant:`danger`,class:`h-6 px-2 text-[11px]`,get loading(){return o.isPending},onClick:()=>o.mutate(e.id),children:`Stop`})}}),null),N(t,A(j,{get when(){return r()===e.id},get children(){var e=zQ();return N(e,A(j,{get when(){return(a.data?.tail??[]).length>0},get fallback(){return HQ()},get children(){return A(Ge,{get each(){return a.data.tail},children:e=>(()=>{var t=UQ();return N(t,()=>e.text),t})()})}})),e}}),null),t})()})),e}})}})),e})()}var GQ=M(`<div class="flex flex-col gap-1.5">`),KQ=M(`<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"> open from your issues</span></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),qQ=M(`<span class="inline-block min-w-[5ch] text-center">`),JQ=M(`<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 items-center gap-1.5"><a target=_blank rel=noreferrer class="text-accent ml-auto shrink-0 text-[11px] hover:underline"title="Open the issue in Linear">Open in Linear ↗`),YQ=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i;function XQ(e){let t=br(()=>({queryKey:[`my-issues`],queryFn:dO,refetchInterval:15e3})),n=O(()=>(t.data??[]).flatMap(e=>(e.attachments??[]).filter(e=>YQ.test(e.url)).map(t=>({issue:e,attachment:t})))),[r,i]=w(null),a=async e=>{try{await navigator.clipboard.writeText(e.attachment.url),i(e.attachment.id),setTimeout(()=>i(null),1500)}catch{}};return(()=>{var i=KQ(),o=i.firstChild,s=o.firstChild.nextSibling,c=s.firstChild,l=o.nextSibling;return N(s,()=>n().length,c),N(l,A(j,{get when(){return n().length>0},get fallback(){return A(ej,{title:`No PRs yet`,get children(){return t.isError?`Connect Linear in Settings.`:`PRs opened by delegated agents appear here as soon as they link back to your issues.`}})},get children(){var t=GQ();return N(t,A(Ge,{get each(){return n()},children:t=>(()=>{var n=JQ(),i=n.firstChild,o=i.nextSibling,s=o.firstChild,c=s.nextSibling,l=c.nextSibling,u=o.nextSibling,d=u.firstChild;return N(i,()=>t.attachment.title||t.attachment.url),N(o,A($A,{get color(){return t.issue.state.color}}),s),N(s,()=>t.issue.identifier),N(c,()=>t.issue.title),N(l,()=>rj(t.issue.updatedAt)),N(u,A(QA,{get children(){return t.issue.state.name}}),d),N(u,A(j,{get when(){return t.issue.delegate},get children(){return A(QA,{class:`text-accent`,get children(){return[`⟠ `,nt(()=>t.issue.delegate.displayName)]}})}}),d),N(u,A(GA,{variant:`ghost`,class:`h-6 px-2 text-[11px]`,onClick:()=>{kA(`activity`,t.issue.id),e.onOpenIssue()},children:`Issue`}),null),N(u,A(GA,{variant:`ghost`,class:`h-6 px-2 text-[11px]`,onClick:()=>void a(t),get children(){var e=qQ();return N(e,()=>r()===t.attachment.id?`Copied`:`Copy`),e}}),null),E(e=>{var n=t.attachment.url,r=t.attachment.title,a=t.issue.url;return n!==e.e&&st(i,`href`,e.e=n),r!==e.t&&st(i,`title`,e.t=r),a!==e.a&&st(d,`href`,e.a=a),e},{e:void 0,t:void 0,a:void 0}),n})()})),t}})),i})()}zr();function ZQ(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function QQ(e){let t=ZQ(crypto.getRandomValues(new Uint8Array(32))),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t)),r=ZQ(new Uint8Array(n)),i=ZQ(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 Dr({linearAccessToken:d.access_token,linearOauthClientId:e})}async function $Q(){await Dr({linearAccessToken:void 0,linearApiKey:void 0})}zr(),Cr(),Px(),hD();var e$=M(`<div class="bg-surface-2 border-border flex rounded-md border p-0.5">`),t$=M(`<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.`),n$=M(`<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`),r$=M(`<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).`),i$=M(`<span class=text-text>Connected as <span class=font-medium></span> · <span class=text-text-dim>`),a$=M(`<div class="bg-surface border-border flex items-center justify-between rounded-lg border p-2.5"><span class="text-text text-[12px]">`),o$=M(`<option value>Select a team…`),s$=M(`<p class="text-text-dim text-[11px]">No agents found — install the Cursor integration in Linear first.`),c$=M(`<span class="text-text-faint text-[10.5px] leading-snug">Empty = the default above (computer-use testing, video demo, PR + review babysitting).`),l$=M(`<div class="flex flex-col gap-1.5">`),u$=M(`<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.`),d$=M(`<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.`),f$=M(`<option value>Select a channel…`),p$=M(`<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`),m$=M(`<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.`),h$=M(`<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`),g$=M(`<p class="text-text-dim text-[11px]">`),_$=M(`<div class=min-h-[2lh]>`),v$=M(`<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.`),y$=M(`<div class="flex h-full flex-col gap-5 overflow-y-auto pt-3 pb-6 pl-3 pr-4">`),b$=M(`<button>`),x$=M(`<div class="flex gap-1.5">`),S$=M(`<p class="text-text-faint text-center text-[10.5px]">or`),C$=M(`<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">`),w$=M(`<div class="flex flex-col gap-3">`),T$=M(`<span class=text-text-dim>Connected — verifying…`),E$=M(`<option> (<!>)`),D$=M(`<option value>Select the agent…`),O$=M(`<option>`),k$=M(`<option>#`),A$=M(`<p class="text-text-dim text-[11px]">No key set — AI drafting disabled, manual drafting still works.`);function j$(){let e=ur(),t=br(()=>({queryKey:[`settings`],queryFn:Er,staleTime:0})),n=O(()=>t.data??{});async function r(t,n=!1){await Dr(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=br(()=>({queryKey:[`viewer`],queryFn:cO,enabled:i(),retry:0})),o=br(()=>({queryKey:[`teams`],queryFn:lO,enabled:i()})),s=br(()=>({queryKey:[`agents`],queryFn:uO,enabled:i()})),[c,l]=w(``),[u,d]=w(!1),[f,p]=w(``);async function m(){let e=c().trim();if(e){d(!0),p(``);try{await r({linearApiKey:e},!0),await cO(),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]=w(``),[_,v]=w(!1),[y,b]=w(``);async function x(){let t=(h()||n().linearOauthClientId||``).trim();if(!t){b(`Enter an OAuth client ID first.`);return}v(!0),b(``);try{await QQ(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,ee]=w(!1);async function C(){ee(!0);try{await $Q(),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{ee(!1)}}let T=Sr?chrome.identity.getRedirectURL():null,D=br(()=>({queryKey:[`slack-channels`,n().slackToken],queryFn:()=>NO(n().slackToken),enabled:!!n().slackToken,retry:0,staleTime:6e4})),te=O(()=>kx(n())),ne=O(()=>{let e=te();return e?`Drafting with ${e} — ${Mx[e].fast} (fast) / ${Mx[e].best} (best)`:null});return(()=>{var e=y$();return N(e,A(ZA,{title:`Workflow`,get children(){return[(()=>{var e=e$();return N(e,A(Ge,{each:[{id:`cloud`,label:`Cloud · Linear + Cursor`},{id:`local`,label:`Local · clipboard`}],children:e=>(()=>{var t=b$();return t.$$click=()=>void r({workflowMode:e.id}),N(t,()=>e.label),E(()=>ut(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})(),t$()]}}),null),N(e,A(ZA,{title:`Capture`,get children(){return[(()=>{var e=n$(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({captureShots:e.currentTarget.checked||void 0})),E(()=>t.checked=!!n().captureShots),e})(),r$()]}}),null),N(e,A(ZA,{title:`Linear`,get children(){return A(j,{get when(){return i()},get fallback(){return(()=>{var e=w$();return N(e,A(XA,{label:`Personal API key`,hint:`Create one at linear.app → Settings → API — fastest path.`,get children(){return[(()=>{var e=x$();return N(e,A(qA,{type:`password`,placeholder:`lin_api_…`,get value(){return c()},onInput:e=>l(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&m()}}),null),N(e,A(GA,{variant:`primary`,get loading(){return u()},get disabled(){return!c().trim()},onClick:()=>void m(),class:`shrink-0`,children:`Connect`}),null),e})(),A(j,{get when(){return f()},get children(){return A(tj,{get message(){return f()}})}})]}}),null),N(e,A(j,{when:Sr,get children(){return[S$(),A(XA,{label:`OAuth client ID`,get children(){return[(()=>{var e=x$();return N(e,A(qA,{placeholder:`your-client-id`,get value(){return h()||n().linearOauthClientId||``},onInput:e=>g(e.currentTarget.value)}),null),N(e,A(GA,{variant:`ghost`,get loading(){return _()},onClick:()=>void x(),class:`shrink-0 whitespace-nowrap`,children:`Connect with OAuth`}),null),e})(),A(j,{get when(){return y()},get children(){return A(tj,{get message(){return y()}})}}),(()=>{var e=C$(),t=e.firstChild.nextSibling.nextSibling;return N(t,T),e})()]}})]}}),null),e})()},get children(){var e=a$(),t=e.firstChild;return N(t,A(j,{get when(){return!a.isLoading},get fallback(){return T$()},get children(){return A(j,{get when(){return a.data},get fallback(){return A(j,{get when(){return a.isError},get fallback(){return T$()},get children(){return A(tj,{message:`Key rejected — reconnect`})}})},get children(){var e=i$(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return N(t,()=>a.data.name),N(n,()=>a.data.email),e}})}})),N(e,A(GA,{variant:`ghost`,get loading(){return S()},onClick:()=>void C(),class:`ml-2 shrink-0`,children:`Disconnect`}),null),e}})}}),null),N(e,A(j,{get when(){return i()},get children(){return A(ZA,{title:`Workspace`,get children(){return[A(XA,{label:`Default team`,get children(){return A(YA,{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[o$(),A(j,{get when(){return o.data},get children(){return A(Ge,{get each(){return o.data},children:e=>(()=>{var t=E$(),r=t.firstChild,i=r.nextSibling;return i.nextSibling,N(t,()=>e.name,r),N(t,()=>e.key,i),E(()=>t.selected=e.id===n().defaultTeamId),E(()=>t.value=e.id),t})()})}})]}})}}),A(XA,{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 A(j,{get when(){return nt(()=>!!s.data)()&&s.data.length===0},get fallback(){return A(YA,{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[D$(),A(j,{get when(){return s.data},get children(){return A(Ge,{get each(){return s.data},children:e=>(()=>{var t=O$();return N(t,()=>e.displayName),E(()=>t.selected=e.id===n().cursorAgentId),E(()=>t.value=e.id),t})()})}})]}})},get children(){return s$()}})}}),A(XA,{label:`Default repository`,hint:`Appended to delegated issues as [repo=…] so Cursor picks the right repo.`,get children(){return A(qA,{placeholder:`owner/repository`,get value(){return n().defaultRepo??``},onBlur:e=>{r({defaultRepo:e.currentTarget.value.trim()||void 0})}})}}),A(XA,{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 A(qA,{placeholder:`Cursor's default`,get value(){return n().cursorModel??``},onBlur:e=>{r({cursorModel:e.currentTarget.value.trim()||void 0})}})}}),A(XA,{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[A(JA,{rows:5,placeholder:mD,get value(){return n().issueTemplate??``},onBlur:e=>{r({issueTemplate:e.currentTarget.value.trim()||void 0})}}),c$()]}}),A(XA,{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 A(qA,{placeholder:`/dev-server.log`,get value(){return n().logUrl??``},onBlur:e=>{r({logUrl:e.currentTarget.value.trim()||void 0})}})}}),A(XA,{label:`Log lines to attach`,hint:`Trailing lines included in the issue (10–500).`,get children(){return A(qA,{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})}})}}),A(XA,{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 A(JA,{rows:4,placeholder:`.claude/skills/apple-hig-design-principles
|
|
204
|
+
.claude/CLAUDE.md
|
|
205
|
+
docs/design-tokens.md`,get value(){return n().skillPaths??``},onBlur:e=>{r({skillPaths:e.currentTarget.value.trim()||void 0})}})}}),A(XA,{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=l$();return N(e,A(qA,{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),N(e,A(qA,{type:`password`,placeholder:`Password`,get value(){return n().testPassword??``},onBlur:e=>{r({testPassword:e.currentTarget.value.trim()||void 0})}}),null),e}})]}})}}),null),N(e,A(j,{when:!Sr,get children(){return A(ZA,{title:`Panel`,get children(){return[(()=>{var e=u$(),t=e.firstChild.nextSibling;return N(t,A(Ge,{each:[{id:`overlay`,label:`Overlay`},{id:`pinned`,label:`Beside page`}],children:e=>(()=>{var t=b$();return t.$$click=()=>void r({panelMode:e.id,panelPos:void 0}),N(t,()=>e.label),E(()=>ut(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=d$(),t=e.firstChild.nextSibling;return N(t,A(Ge,{each:[`left`,`right`],children:e=>(()=>{var t=b$();return t.$$click=()=>void r({panelSide:e}),N(t,e===`left`?`Left`:`Right`),E(()=>ut(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),N(e,A(ZA,{title:`Local Claude Code`,get children(){return A(XA,{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 A(qA,{placeholder:`http://localhost:4577`,get value(){return n().bridgeUrl??``},onBlur:e=>{r({bridgeUrl:e.currentTarget.value.trim()||void 0})}})}})}}),null),N(e,A(ZA,{title:`Asset uploads`,get children(){return[A(XA,{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 A(qA,{type:`password`,placeholder:`github_pat_…`,get value(){return n().githubToken??``},onBlur:e=>{r({githubToken:e.currentTarget.value.trim()||void 0})}})}}),A(XA,{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 A(qA,{placeholder:`ahmedbanihanibh/linear-grab-assets`,get value(){return n().githubAssetsRepo??``},onBlur:e=>{r({githubAssetsRepo:e.currentTarget.value.trim()||void 0})}})}})]}}),null),N(e,A(ZA,{title:`Notifications`,get children(){return[A(XA,{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 A(qA,{type:`password`,placeholder:`xoxb-…`,get value(){return n().slackToken??``},onBlur:e=>{r({slackToken:e.currentTarget.value.trim()||void 0})}})}}),A(j,{get when(){return n().slackToken},get children(){return A(XA,{label:`Slack channel`,get children(){return A(j,{get when(){return!D.isError},get fallback(){return A(tj,{message:`Couldn't list channels — check the token scopes (channels:read).`})},get children(){return A(YA,{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[f$(),A(Ge,{get each(){return D.data??[]},children:e=>(()=>{var t=k$();return t.firstChild,N(t,()=>e.name,null),E(()=>t.selected=e.id===n().slackChannelId),E(()=>t.value=e.id),t})()})]}})}})}})}}),A(XA,{label:`Telegram bot token`,hint:`From @BotFather. The agent also receives it to send the demo video (sendVideo).`,get children(){return A(qA,{type:`password`,placeholder:`123456:ABC-…`,get value(){return n().telegramToken??``},onBlur:e=>{r({telegramToken:e.currentTarget.value.trim()||void 0})}})}}),A(j,{get when(){return n().telegramToken},get children(){return A(XA,{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 A(qA,{placeholder:`-1001234567890`,get value(){return n().telegramChatId??``},onBlur:e=>{r({telegramChatId:e.currentTarget.value.trim()||void 0})}})}})}}),(()=>{var e=p$(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({notifyOnCreate:e.currentTarget.checked?void 0:!1})),E(()=>t.checked=n().notifyOnCreate!==!1),e})(),m$()]}}),null),N(e,A(ZA,{title:`AI providers`,get children(){return[A(XA,{label:`OpenAI API key`,get children(){return A(qA,{type:`password`,placeholder:`sk-…`,get value(){return n().openaiKey??``},onBlur:e=>{r({openaiKey:e.currentTarget.value.trim()||void 0})}})}}),A(XA,{label:`Anthropic API key`,get children(){return A(qA,{type:`password`,placeholder:`sk-ant-…`,get value(){return n().anthropicKey??``},onBlur:e=>{r({anthropicKey:e.currentTarget.value.trim()||void 0})}})}}),(()=>{var e=h$(),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&&ut(t,e.e=r),o!==e.t&&ut(i,e.t=o),s!==e.a&&(i.disabled=e.a=s),c!==e.o&&ut(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=_$();return N(e,A(j,{get when(){return ne()},get fallback(){return A$()},get children(){var e=g$();return N(e,ne),e}})),e})()]}}),null),N(e,A(ZA,{title:`How it works`,get children(){return v$()}}),null),e})()}ot([`click`]);var M$=`linear-grab`,N$=`queries`,P$=[`my-issues`,`issue`,`sessions`,`teams`,`agents`];function F$(){return new Promise(e=>{try{let t=indexedDB.open(M$,1);t.onupgradeneeded=()=>t.result.createObjectStore(N$),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}function I$(e){return typeof e[0]==`string`&&P$.includes(e[0])}async function L$(e){let t=await F$();if(!t)return()=>{};await new Promise(n=>{try{let r=t.transaction(N$,`readonly`).objectStore(N$).openCursor();r.onsuccess=()=>{let t=r.result;if(!t)return n();try{let{queryKey:n,data:r}=t.value;I$(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(!I$(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(N$,`readwrite`).objectStore(N$).put({queryKey:i,data:n},a)}catch{}},400))});return()=>{r();for(let e of n.values())clearTimeout(e);t.close()}}zr();var R$=M(`<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">`),z$=M(`<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">`),B$=M(`<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">–`),V$=M(`<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">`),H$=M(`<button>`),U$=[{id:`draft`,label:`Draft`},{id:`capture`,label:`Capture`},{id:`activity`,label:`Activity`},{id:`local`,label:`Local`},{id:`prs`,label:`PRs`},{id:`settings`,label:`Settings`}],W$=new yr({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});function G$(e){return(()=>{var t=R$();return E(n=>{var r=e.size??14,i=e.size??14;return r!==n.e&&st(t,`width`,n.e=r),i!==n.t&&st(t,`height`,n.t=i),n},{e:void 0,t:void 0}),t})()}function K$(e){let[t,n]=w(`draft`),r=()=>{W$.invalidateQueries({queryKey:[`grab`]}),n(`capture`),e.onGrab?.()};return D(()=>{let e=TA();e&&n(e)}),ae(()=>{let e=L$(W$),t=JX(r),n=Nr(e=>{e===`settings`&&W$.invalidateQueries({queryKey:[`settings`]}),e===`grab`&&r()});oe(()=>{t(),n(),e.then(e=>e())})}),A(dr,{client:W$,get children(){var r=V$(),i=r.firstChild,a=i.firstChild,o=a.nextSibling,s=i.nextSibling;return i.$$pointerdown=t=>e.onHeaderPointerDown?.(t),N(a,A(G$,{size:14})),N(o,A(Ge,{each:U$,children:e=>(()=>{var r=H$();return r.$$click=()=>n(e.id),N(r,()=>e.label),E(()=>ut(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})()})),N(i,A(j,{get when(){return e.onTogglePin},get children(){var t=z$();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&&st(t,`aria-label`,n.e=r),i!==n.t&&st(t,`title`,n.t=i),a!==n.a&&ut(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t}}),null),N(i,A(j,{get when(){return e.onClose},get children(){var t=B$();return t.$$click=()=>e.onClose?.(),t}}),null),N(s,A(qe,{get children(){return[A(Je,{get when(){return t()===`draft`},get children(){return A(wj,{onCreated:()=>n(`activity`)})}}),A(Je,{get when(){return t()===`capture`},get children(){return A(gZ,{})}}),A(Je,{get when(){return t()===`activity`},get children(){return A(DQ,{})}}),A(Je,{get when(){return t()===`local`},get children(){return A(WQ,{})}}),A(Je,{get when(){return t()===`prs`},get children(){return A(XQ,{onOpenIssue:()=>n(`activity`)})}}),A(Je,{get when(){return t()===`settings`},get children(){return A(j$,{})}})]}})),E(()=>ut(i,`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`:``}`)),r}})}ot([`pointerdown`,`click`]);var q$=`/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
|
|
206
|
+
@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-1{top:var(--spacing)}.top-1\\/2{top:50%}.top-\\[2px\\]{top:2px}.top-full{top:100%}.right-0{right:0}.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-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-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-3\\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.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-\\[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-\\[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-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-\\[200px\\]{max-width:200px}.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-start{align-self:flex-start}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.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-\\[1\\.5px\\]{border-style:var(--tw-border-style);border-width:1.5px}.\\[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-border{border-color:var(--color-border)}.border-text-dim{border-color:var(--color-text-dim)}.border-transparent{border-color:#0000}.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-bg{background-color:var(--color-bg)}.bg-border{background-color:var(--color-border)}.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}.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-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-\\[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}.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}.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 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}}`;zr();var J$=M(`<span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full">`),Y$=M(`<span class="text-text min-w-[5ch] text-[11px] font-medium tabular-nums">`),X$=M(`<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`),Z$=M(`<p class="text-warn px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Needs review`),Q$=M(`<div><p class="text-text-dim px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Running agents`),$$=M(`<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">`),e1=M(`<div><div title="Drag to resize">`),t1=M(`<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">`),n1=M(`<span class="bg-border h-4 w-px"aria-hidden>`),r1=M(`<span aria-hidden class="bg-warn size-2 rounded-full">`),i1=M(`<span class="text-warn min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums"> rev`),a1=M(`<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>`),o1=M(`<p class="text-text-faint px-1.5 pb-1.5 text-[11.5px]">No agents running right now.`),s1=M(`<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 c1(e={}){if(typeof window>`u`||window.__LINEAR_GRAB_PAGE__)return;window.__LINEAR_GRAB_PAGE__=!0;let t=()=>{KX();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=q$,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=()=>i.setAttribute(`data-theme`,l1());a(),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,a),at(()=>A(h1,{get defaultOpen(){return e.defaultOpen??!1}}),i)};document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function l1(){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 u1=130,d1=36,f1=380,p1=280,m1=720;function h1(e){let[t,n]=w(e.defaultOpen),[r,i]=w(`right`),[a,o]=w({x:Math.max(8,window.innerWidth-u1-24),y:Math.max(8,window.innerHeight-d1-20)}),[s,c]=w({running:[],review:[]}),l=()=>s().running,u=()=>s().review,[d,f]=w(!1),[p,m]=w(VD().phase),[h,g]=w(0);ae(()=>{let e=setInterval(()=>{p()===`recording`&&g(Date.now()-(VD().startedAt??Date.now()))},250);oe(()=>clearInterval(e))});let _=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[v,y]=w(null),b=e=>({x:Math.min(Math.max(8,e.x),window.innerWidth-u1-8),y:Math.min(Math.max(8,e.y),window.innerHeight-d1-8)}),x=e=>({x:Math.min(Math.max(8-(ne()-80),e.x),window.innerWidth-80),y:Math.min(Math.max(0,e.y),window.innerHeight-80)}),[S,ee]=w(!1),[C,T]=w(`cloud`),[O,te]=w(!1),[ne,k]=w(f1),re=e=>Math.min(m1,Math.max(p1,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`?`${ne()}px`:``,e.style.marginLeft=n&&r()===`left`?`${ne()}px`:``}),oe(()=>{document.documentElement.style.marginRight=``,document.documentElement.style.marginLeft=``});let ie=()=>{let e=!S();ee(e),e&&y(null),Dr({panelMode:e?`pinned`:`overlay`,panelPos:void 0})};ae(()=>{Er().then(e=>{e.panelSide&&i(e.panelSide),e.launcherPos&&o(b(e.launcherPos)),e.panelPos&&y(x(e.panelPos)),e.panelWidth&&k(re(e.panelWidth)),ee(e.panelMode===`pinned`),T(e.workflowMode??`cloud`)});let e=Nr(e=>{e===`settings`&&Er().then(e=>{i(e.panelSide??`right`),ee(e.panelMode===`pinned`),T(e.workflowMode??`cloud`)}),e===`grab`&&C()!==`local`&&n(!0)}),t=()=>{te(!0),setTimeout(()=>te(!1),1600)};window.addEventListener(RX,t);let r=()=>{f(!1),S()||n(!1)};window.addEventListener(zX,r),oe(()=>{window.removeEventListener(RX,t),window.removeEventListener(zX,r)});let s=GZ(c),l=VD().phase,u=HD(e=>{m(e.phase),e.phase===`recording`&&l!==`recording`&&!S()&&n(!1),e.phase===`ready`&&l!==`ready`&&(kA(`capture`),n(!0)),l=e.phase}),d=()=>{o(b(a()));let e=v();e&&y(x(e))};window.addEventListener(`resize`,d),oe(()=>{e(),s(),u(),window.removeEventListener(`resize`,d)})});let se=!1,ce=e=>{if(e.button!==0)return;let t={x:e.clientX,y:e.clientY},n=a();se=!1;let r=e=>{let r=e.clientX-t.x,i=e.clientY-t.y;Math.abs(r)+Math.abs(i)>4&&(se=!0),se&&o(b({x:n.x+r,y:n.y+i}))},i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i),se&&Dr({launcherPos:a()})};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},le=()=>a().y>260,ue=e=>{f(!1),kA(`activity`,e),n(!0)},de=e=>{if(e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=e.clientX,n=ne(),i=v(),a=e=>{let a=e.clientX-t,o=r()===`right`?-a:a,s=re(n+o);k(s),i&&r()===`right`&&y(x({x:i.x+(n-s),y:i.y}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),Dr({panelWidth:ne(),...v()?{panelPos:v()}:{}})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},fe=e=>{if(e.button!==0)return;if(e.detail===2){y(null),Dr({panelPos:void 0});return}let t={x:e.clientX,y:e.clientY},n=v()??{x:r()===`right`?window.innerWidth-ne():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&&Dr({panelPos:e})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)};return[A(j,{get when(){return!t()},get children(){var e=$$(),t=e.firstChild;return t.$$pointerdown=ce,N(t,A(j,{get when(){return p()===`recording`},get fallback(){return[(()=>{var e=t1();return e.$$click=()=>{se||(f(!1),n(!0))},N(e,A(G$,{size:13})),e})(),n1(),(()=>{var e=a1(),t=e.firstChild,n=t.nextSibling;return e.$$click=()=>{se||f(e=>!e)},N(n,(()=>{var e=nt(()=>!!O());return()=>e()?`Copied ✓`:`${l().length} run`})()),N(e,A(j,{get when(){return nt(()=>!O())()&&u().length>0},get children(){return[r1(),(()=>{var e=i1(),t=e.firstChild;return N(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&&ut(t,e.e=r),i!==e.t&&ut(n,e.t=i),e},{e:void 0,t:void 0}),e})()]},get children(){return[J$(),(()=>{var e=Y$();return N(e,()=>_(h())),e})(),(()=>{var e=X$();return e.$$click=()=>{se||$D()},e})()]}})),N(e,A(j,{get when(){return d()},get children(){var e=Q$(),t=e.firstChild;return N(e,A(j,{get when(){return u().length>0},get children(){return[Z$(),A(Ge,{get each(){return u()},children:e=>A(g1,{agent:e,review:!0,onOpen:ue})})]}}),t),N(e,A(j,{get when(){return l().length>0},get fallback(){return o1()},get children(){return A(Ge,{get each(){return l()},children:e=>A(g1,{agent:e,onOpen:ue})})}}),null),E(()=>ut(e,`bg-surface border-border absolute w-72 rounded-lg border p-1.5 font-sans shadow-2xl ${le()?`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&&mt(e,`left`,t.e=n),r!==t.t&&mt(e,`top`,t.t=r),t},{e:void 0,t:void 0}),e}}),A(j,{get when(){return t()},get children(){var e=e1(),t=e.firstChild;return t.$$pointerdown=de,N(e,A(K$,{onGrab:()=>n(!0),onClose:()=>n(!1),get onHeaderPointerDown(){return S()?void 0:fe},get pinned(){return S()},onTogglePin:ie}),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:`${ne()}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&&ut(e,n.e=i),n.t=pt(e,a,n.t),o!==n.a&&ut(t,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}})]}function g1(e){return(()=>{var t=s1(),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),N(i,()=>e.agent.identifier),N(a,()=>e.agent.title),N(o,(()=>{var t=nt(()=>!!e.review);return()=>t()?`PR ready · needs review`:e.agent.stateName})(),s),N(o,()=>e.agent.delegateName,c),N(o,()=>_1(e.agent.updatedAt),null),E(t=>mt(r,`background`,e.review?`var(--color-warn)`:e.agent.stateColor)),t})()}function _1(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`}ot([`pointerdown`,`click`]),c1()})();
|