react-grab 0.1.49-dev.c704a67 → 0.1.49

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-grab",
3
- "version": "0.1.49-dev.c704a67",
3
+ "version": "0.1.49",
4
4
  "description": "Select context for coding agents directly from your website",
5
5
  "keywords": [
6
6
  "agent",
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "dependencies": {
82
82
  "bippy": "^0.6.1",
83
- "@react-grab/cli": "0.1.49-dev.c704a67"
83
+ "@react-grab/cli": "0.1.49"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@babel/core": "^7.29.0",
@@ -1,43 +0,0 @@
1
- /**
2
- * @license MIT
3
- *
4
- * Copyright (c) 2025 Aiden Bai
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE file in the root directory of this source tree.
8
- */
9
- let e=null;const t=()=>{if(e!==null)return e;try{e=window.matchMedia(`(color-gamut: p3)`).matches}catch{e=!1}return e},n=t(),r=e=>n?`color(display-p3 0.84 0.19 0.78 / ${e})`:`rgba(210, 57, 192, ${e})`,i=`0.1.49-dev.c704a67`,a=`var(--rg-panel-bg)`,o=`var(--rg-shadow)`,s=-1e3,c=.95,l=1500,u=[`/components/ui/`,`/packages/ui/`,`/design-system/`,`/design-systems/`,`/primitives/`],d=5e3,f=8e3,p=1e4,ee=.5,m=2147483647,te=2147483645,ne=.7,re=1e3/60,ie=.5,ae=.01,oe=r(.4),se=r(.05),ce=r(.5),le=r(.08),ue=r(.15),de=.2,fe=[`id`,`class`,`aria-label`,`data-testid`,`role`,`name`,`title`],pe=new Set([`id`,`data-testid`,`aria-label`,`href`,`src`,`alt`,`type`,`name`,`placeholder`,`role`,`for`,`action`,`method`,`title`,`disabled`,`checked`,`readonly`,`required`,`selected`,`open`]),me=new Set([`a`,`code`,`pre`]),he=new Set([`script`,`style`,`template`,`noscript`]),ge=[`Meta`,`Control`,`Shift`,`Alt`],_e=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]),ve=`data-react-grab-frozen`,ye=`data-react-grab-same-origin-frame`,be=.18,xe=.6,Se=.5,Ce=`data-react-grab-input`,we=.5,Te=`copy`,Ee=`comment`,De=`edit`,Oe=`superellipse(1.25)`,ke=.75,Ae=.01,je=1e3,Me={left:-9999,top:-9999},Ne={left:`left center`,right:`right center`,top:`center top`,bottom:`center bottom`},Pe=1e3,Fe=`#00000000`,Ie=`transparent`,Le=2e3,Re=`cubic-bezier(0.34, 1.56, 0.64, 1)`,ze=12e3,Be=9e3,Ve=1e4,He=8e3,Ue=5e3,We=1e3,Ge=1e7,Ke=1.2,qe=-9999,Je=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(`.`)),Ye=e=>typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE,h=e=>Ye(e)&&e.namespaceURI===`http://www.w3.org/1999/xhtml`,g=e=>h(e)&&e.tagName===`IFRAME`,Xe=new WeakMap,_=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},Ze=e=>{let t=performance.now(),n=Xe.get(e);if(n&&t-n.timestamp<16)return n.metrics;let r=e.ownerDocument.defaultView?.getComputedStyle(e),i;if(!r)i={contentOffsetX:e.clientLeft,contentOffsetY:e.clientTop,height:e.offsetHeight,width:e.offsetWidth};else{let t=_(r.borderLeftWidth),n=_(r.borderRightWidth),a=_(r.borderTopWidth),o=_(r.borderBottomWidth),s=_(r.paddingLeft),c=_(r.paddingRight),l=_(r.paddingTop),u=_(r.paddingBottom),d=_(r.width),f=_(r.height),p=t+n+s+c,ee=a+o+l+u,m=r.boxSizing===`border-box`?d:d+p,te=r.boxSizing===`border-box`?f:f+ee;i={contentOffsetX:t+s,contentOffsetY:a+l,height:te>0?te:e.offsetHeight,width:m>0?m:e.offsetWidth}}return Xe.set(e,{metrics:i,timestamp:t}),i},Qe=(e,t)=>t>0?e/t:1,$e=e=>{if(!e)return null;try{return e.frameElement}catch{return null}},et=(e,t,n)=>{let r=t,i=n,a=1,o=1,s=e;for(;s&&s!==window;){let e=$e(s);if(!e||!g(e))break;let t=e.getBoundingClientRect(),n=Ze(e),c=Qe(t.width,n.width),l=Qe(t.height,n.height);r=t.left+(n.contentOffsetX+r)*c,i=t.top+(n.contentOffsetY+i)*l,a*=c,o*=l,s=e.ownerDocument.defaultView}return{x:r,y:i,scaleX:a,scaleY:o}},tt=e=>{let t=e.ownerDocument.defaultView;return t?t.getComputedStyle(e):window.getComputedStyle(e)},nt=(e,t)=>e.replace(/([\d.]+)px/g,(e,n)=>{let r=Number(n)*Math.abs(t);return`${Number(r.toFixed(3))}px`}),rt=(e,t,n)=>{let[r,i]=e.split(`/`).map(e=>e.trim()),a=nt(r,t),o=nt(i??r,n);return i===void 0&&a===o?a:`${a} / ${o}`},it=e=>Object.assign(e,{[Symbol.dispose]:e}),at=`bippy-0.6.1`,ot=Object.defineProperty,st=Object.prototype.hasOwnProperty,v=()=>{},ct=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{}},lt=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e);let ut=!1,dt;const ft=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>ut?!0:(e&&typeof e.inject==`function`&&(dt=e.inject.toString()),!!dt?.includes(`(injected)`)),y=new Set,pt=new Set,mt=e=>{e&&y.add(e);let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:at,checkDCE:ct,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),pt.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,y.forEach(e=>e())),i},on:v,onCommitFiberRoot:v,onCommitFiberUnmount:v,onPostCommitFiberRoot:v,renderers:t,supportsFiber:!0,supportsFlight:!0};try{ot(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)=>{pt.add(e),t.renderers.set(n,e)}),ht(e))}}});let t=window.hasOwnProperty,n=!1;ot(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{ht(e)}return r},ht=e=>{e&&y.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=ct,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=at,t._instrumentationIsActive=!1;let e=lt(t);if(e||(t.on=v),t.renderers.size){t._instrumentationIsActive=!0,y.forEach(e=>e());return}let n=t.inject,r=ft(t);r&&!e&&(ut=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return pt.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,y.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||ft())&&e?.()}catch{}},gt=()=>st.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),b=e=>gt()?(ht(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):mt(e),_t=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`));
10
- /**
11
- * @license bippy
12
- *
13
- * Copyright (c) Aiden Bai
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */
18
- (()=>{try{_t()&&b()}catch{}})();
19
- /**
20
- * @license bippy
21
- *
22
- * Copyright (c) Aiden Bai
23
- *
24
- * This source code is licensed under the MIT license found in the
25
- * LICENSE file in the root directory of this source tree.
26
- */
27
- const vt=e=>{switch(e.tag){case 5:case 26:case 27:return!0;default:return typeof e.type==`string`}},yt=e=>{switch(e.tag){case 1:case 11:case 0:case 14:case 15:return!0;default:return!1}},bt=e=>!e||typeof e!=`object`?!1:`pendingProps`in e&&!(`containerInfo`in e),xt=e=>{let t=e.memoizedProps,n=e.alternate?.memoizedProps||{},r=e.flags??e.effectTag??0;switch(e.tag){case 1:case 9:case 11:case 0:case 14:case 15:return(r&1)==1;default:return e.alternate?n!==t||e.alternate.memoizedState!==e.memoizedState||e.alternate.ref!==e.ref:!0}},St=e=>{switch(e.tag){case 18:return!0;case 7:case 6:case 23:case 22:return!0;case 3:return!1;default:{let t=typeof e.type==`object`&&e.type!==null?e.type.$$typeof:e.type;if(typeof t==`symbol`)return t.description===`react.concurrent_mode`||t.description===`react.async_mode`;switch(t){case 60111:case`Symbol(react.concurrent_mode)`:case`Symbol(react.async_mode)`:return!0;default:return!1}}}},Ct=e=>{let t=[],n=[];for(vt(e)?t.push(e):e.child&&n.push(e.child);n.length;){let e=n.pop();if(!e)break;vt(e)?t.push(e):e.child&&n.push(e.child),e.sibling&&n.push(e.sibling)}return t};function wt(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 Et(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=Tt(i,t,n);if(e)return e;i=n?null:i.sibling}return null}const Tt=(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=Tt(r,t,n);if(e)return e;r=n?null:r.sibling}return null},Et=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 Et(r,t,n);if(e)return e;r=n?null:r.sibling}return null},Dt=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?Dt(t.type||t.render):null},Ot=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=Dt(t);return r&&(r.displayName||r.name)||null},kt=()=>{let e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;return!!e?._instrumentationIsActive||lt(e)||ft(e)},At=new Set,jt=e=>{let t=e.alternate;if(!t)return e;if(t.actualStartTime&&e.actualStartTime)return t.actualStartTime>e.actualStartTime?t:e;for(let t of At){let n=wt(t.current,t=>{if(t===e)return!0});if(n)return n}return e};let Mt=0;const x=new WeakMap,Nt=(e,t=Mt++)=>{x.set(e,t)},Pt=e=>{let t=x.get(e);return t===void 0&&e.alternate&&(t=x.get(e.alternate)),t===void 0&&(t=Mt++,Nt(e,t)),t},S=(e,t,n)=>{let r=t;for(;r!=null;){if(x.has(r)||Pt(r),!St(r)&&xt(r)&&e(r,`mount`),r.tag===13)if(r.memoizedState!==null){let t=r.child,n=t?t.sibling:null;if(n){let t=n.child;t!==null&&S(e,t,!1)}}else{let t=null;r.child!==null&&(t=r.child.child),t!==null&&S(e,t,!1)}else r.child!=null&&S(e,r.child,!0);r=n?r.sibling:null}},Ft=(e,t,n,r)=>{if(x.has(t)||Pt(t),!n)return;x.has(n)||Pt(n);let i=t.tag===13,a=!St(t);a&&xt(t)&&e(t,`update`);let o=i&&n.memoizedState!==null,s=i&&t.memoizedState!==null;if(o&&s){let r=t.child?.sibling??null,i=n.child?.sibling??null;r!==null&&i!==null&&Ft(e,r,i,t)}else if(o&&!s){let n=t.child;n!==null&&S(e,n,!0)}else if(!o&&s){Lt(e,n);let r=t.child?.sibling??null;r!==null&&S(e,r,!0)}else if(t.child!==n.child){let n=t.child;for(;n;){if(n.alternate){let i=n.alternate;Ft(e,n,i,a?t:r)}else S(e,n,!1);n=n.sibling}}},It=(e,t)=>{(t.tag===3||!St(t))&&e(t,`unmount`)},Lt=(e,t)=>{let n=t.tag===13&&t.memoizedState!==null,r=t.child;for(n&&(r=(t.child?.sibling??null)?.child??null);r!==null;)r.return!==null&&(It(e,r),Lt(e,r)),r=r.sibling},Rt=e=>{if(!gt())return null;let t=e;for(;t.return;)t=t.return;let n=Gt.get(t.stateNode);return n===void 0?null:b().renderers?.get(n)??null},zt=e=>Object.prototype.toString.call(e)===`[object Object]`&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),Bt=(e,t=[])=>{if(!zt(e))return[{path:t,value:e}];let n=[];for(let r in e){let i=e[r],a=t.concat(r);zt(i)?n.push(...Bt(i,a)):n.push({path:a,value:i})}return n},Vt=new Set,Ht=new Set,Ut=new Set,Wt=new Set,C=new WeakMap,Gt=new WeakMap,Kt=e=>{let t=C.get(e)??{};if(C.set(e,t),!t.onCommitFiberRoot||e.onCommitFiberRoot!==t.onCommitFiberRoot){let n=e.onCommitFiberRoot,r=(t,i,a)=>{if(n?.(t,i,a),C.get(e)?.onCommitFiberRoot===r){At.add(i),Gt.set(i,t);for(let e of Vt)e(t,i,a)}};t.onCommitFiberRoot=r,e.onCommitFiberRoot=r}if(!t.onCommitFiberUnmount||e.onCommitFiberUnmount!==t.onCommitFiberUnmount){let n=e.onCommitFiberUnmount,r=(t,i)=>{if(n?.(t,i),C.get(e)?.onCommitFiberUnmount===r)for(let e of Ht)e(t,i)};t.onCommitFiberUnmount=r,e.onCommitFiberUnmount=r}if(!t.onPostCommitFiberRoot||e.onPostCommitFiberRoot!==t.onPostCommitFiberRoot){let n=e.onPostCommitFiberRoot,r=(t,i)=>{if(n?.(t,i),C.get(e)?.onPostCommitFiberRoot===r)for(let e of Ut)e(t,i)};t.onPostCommitFiberRoot=r,e.onPostCommitFiberRoot=r}if(!t.onScheduleFiberRoot||e.onScheduleFiberRoot!==t.onScheduleFiberRoot){let n=e.onScheduleFiberRoot,r=(t,i,a)=>{if(n?.(t,i,a),C.get(e)?.onScheduleFiberRoot===r)for(let e of Wt)e(t,i,a)};t.onScheduleFiberRoot=r,e.onScheduleFiberRoot=r}},qt=e=>{let t=b(e.onActive);t._instrumentationSource=e.name??at,Kt(t);let{onActive:n,onCommitFiberRoot:r,onCommitFiberUnmount:i,onPostCommitFiberRoot:a,onScheduleFiberRoot:o}=e;return r&&Vt.add(r),i&&Ht.add(i),a&&Ut.add(a),o&&Wt.add(o),it(()=>{n&&y.delete(n),r&&Vt.delete(r),i&&Ht.delete(i),a&&Ut.delete(a),o&&Wt.delete(o)})},Jt=new Set,Yt=e=>e.startsWith(`__reactContainer$`)||e.startsWith(`__reactInternalInstance$`)||e.startsWith(`__reactFiber`),Xt=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;let t=e.__internalInstanceHandle??e._internalInstanceHandle;if(bt(t))return t;let n=e;for(let e of Jt){let t=n[e];if(t)return t}for(let e of Object.keys(n))if(Yt(e))return Jt.add(e),n[e]||null;for(let t of At){if(Rt(t.current)?.findFiberByHostInstance)continue;let n=wt(t.current,t=>t.stateNode===e);if(n)return n}}return null},Zt=new WeakMap,Qt=(e,t)=>{Zt.set(e,t)},w=e=>Zt.get(e)??null,$t=e=>w(e)?.getFiber()??Xt(e);let en=new WeakMap,tn=new WeakMap;const nn=()=>{en=new WeakMap,tn=new WeakMap},rn=(e,t,n)=>{let r=tn.get(e);if(r&&n-r.timestamp<200)return r.borderRadius;let i=(t??tt(e)).borderRadius||`0px`;return tn.set(e,{borderRadius:i,timestamp:n}),i},an=e=>{let t=performance.now(),n=en.get(e);if(n&&t-n.timestamp<16)return n.bounds;let r=w(e);if(r){let n=r.getBounds();return en.set(e,{bounds:n,timestamp:t}),n}let i=e.getBoundingClientRect(),a=et(e.ownerDocument.defaultView,i.left,i.top),o={borderRadius:rt(rn(e,null,t),a.scaleX,a.scaleY),height:i.height*a.scaleY,width:i.width*a.scaleX,x:a.x,y:a.y};return en.set(e,{bounds:o,timestamp:t}),o},on=e=>{let t=e.ownerDocument?.defaultView;return!!(t&&e instanceof t.ShadowRoot)};var T=class extends Error{constructor(e,t){super(e,t),this.name=`ReactGrabError`}},E=class extends T{constructor(e,t){super(e,{cause:t}),this.name=`RecoverableError`}},sn=class extends T{constructor(e){super(`Failed to freeze page`,{cause:e}),this.name=`FreezeError`}},cn=class extends E{constructor(e,t,n){super(`Failed to open source file "${e}"`,n),this.name=`OpenFileError`,this.filePath=e,this.lineNumber=t}},ln=class extends E{constructor(e,t,n){super(`Plugin hook "${t}" failed for "${e}"`,n),this.name=`PluginHookError`,this.pluginName=e,this.hookName=t}},un=class extends E{constructor(e,t){super(`Plugin cleanup failed for "${e}"`,t),this.name=`PluginCleanupError`,this.pluginName=e}},dn=class extends E{constructor(e,t){super(`Plugin setup failed for "${e}"`,t),this.name=`PluginSetupError`,this.pluginName=e}},fn=class extends E{constructor(e,t){super(`Action "${e}" failed`,t),this.name=`ContextMenuActionError`,this.actionId=e}},pn=class extends E{constructor(e,t){super(`Action "${e}" enabled check failed`,t),this.name=`ContextMenuActionEnabledError`,this.actionId=e}},mn=class extends T{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},hn=class extends T{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},gn=class extends T{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},_n=class extends T{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}};const vn=e=>w(e)?.getTagName()??(e.tagName||``).toLowerCase(),yn=new WeakMap,bn=(e=document)=>{let t=yn.get(e);if(t!==void 0)return t;let n=e.querySelector(`script[nonce], style[nonce]`),r=n?.nonce||n?.getAttribute(`nonce`)||null;return r&&yn.set(e,r),r},xn=[[`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`,``]],Sn=e=>{for(let[t,n]of xn)e.setAttribute(t,n);e.setAttribute(`data-testid`,`react-grab-overlay`),e.classList.add(`ph-no-capture`)},Cn=e=>typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===9,wn=e=>{if(e.assignedSlot)return e.assignedSlot;if(e.parentElement)return e.parentElement;let t=e.getRootNode();return on(t)?t.host:Cn(t)?$e(t.defaultView):null};let Tn=null;const En=e=>{Tn=e},Dn=()=>Tn,On=e=>{if(!Tn)return!0;let t=e;for(;t;){if(t===Tn)return!0;t=wn(t)}return!1},kn=e=>e,An=typeof window<`u`,jn=e=>0,Mn=e=>{},D=An?(Object.getOwnPropertyDescriptor(Window.prototype,`requestAnimationFrame`)?.value??window.requestAnimationFrame).bind(window):jn,Nn=An?(Object.getOwnPropertyDescriptor(Window.prototype,`cancelAnimationFrame`)?.value??window.cancelAnimationFrame).bind(window):Mn,Pn=()=>An?new Promise(e=>D(()=>e())):Promise.resolve(),O=e=>{try{return e.contentDocument}catch{return null}},Fn=(e,t,n)=>{let r=e.getBoundingClientRect(),i=Ze(e),a=Qe(r.width,i.width),o=Qe(r.height,i.height);return{x:(t-r.left)/a-i.contentOffsetX,y:(n-r.top)/o-i.contentOffsetY}},In=(e,t,n)=>{let r=e.elementFromPoint(t,n);for(;r;){let e=r.shadowRoot?.elementFromPoint(t,n);if(e&&e!==r){r=e;continue}if(g(r)){let e=O(r);if(!e)return r;let i=Fn(r,t,n);return In(e,i.x,i.y)??r}return r}return null},Ln=(e,t)=>In(document,e,t),Rn=e=>{let t=e;for(;t;){if(t.hasAttribute(`data-react-grab-ignore`))return!0;t=wn(t)}return!1},zn=typeof Element<`u`&&typeof Element.prototype.checkVisibility==`function`,Bn={checkOpacity:!0,checkVisibilityCSS:!0,opacityProperty:!0,visibilityProperty:!0},Vn={checkVisibilityCSS:!0,visibilityProperty:!0},Hn=(e,t)=>{if(zn&&!t)return e.checkVisibility(Bn)?!0:e.checkVisibility(Vn)?tt(e).opacity!==`0`:!1;let n=t??tt(e);return n.display!==`none`&&n.visibility!==`hidden`&&n.opacity!==`0`},Un=e=>{let t=vn(e);return t===`html`||t===`body`},Wn=[`data-react-grab`,`data-react-grab-demo`],Gn=e=>Wn.some(t=>e.hasAttribute(t)),Kn=e=>{if(Gn(e))return!0;let t=e.getRootNode();return on(t)&&Gn(t.host)},qn=e=>{let t=parseInt(e.zIndex,10);return e.pointerEvents===`none`&&e.position===`fixed`&&!isNaN(t)&&t>=2147483600},Jn=e=>{let t=e.backgroundColor;return t===`transparent`||t===`rgba(0, 0, 0, 0)`},Yn=e=>{let t=e.position;if(t!==`fixed`&&t!==`absolute`)return!1;if(Jn(e)||parseFloat(e.opacity)<.1)return!0;let n=parseInt(e.zIndex,10);return!isNaN(n)&&n>1e3};let Xn=new WeakMap;const Zn=()=>{Xn=new WeakMap},Qn=e=>{let t=w(e);if(t)return t.isConnected();if(Un(e)||Kn(e)||Rn(e))return!1;let n=performance.now(),r=Xn.get(e);if(r&&n-r.timestamp<50)return r.isVisible;if(!Hn(e))return Xn.set(e,{isVisible:!1,timestamp:n}),!1;if(e.clientWidth/(e.ownerDocument.defaultView?.innerWidth??window.innerWidth)>=.9&&e.clientHeight/(e.ownerDocument.defaultView?.innerHeight??window.innerHeight)>=.9){let t=tt(e);if(qn(t)||Yn(t))return!1}return Xn.set(e,{isVisible:!0,timestamp:n}),!0},$n=(e,t,n)=>{let r=!0;for(let i of e.elementsFromPoint(t,n)){if(Rn(i)&&(r=!1),!On(i))continue;let a=i.shadowRoot;if(r&&a&&a!==e){let e=$n(a,t,n);if(e)return e}if(r&&g(i)){let e=O(i);if(e){let r=Fn(i,t,n),a=$n(e,r.x,r.y);if(a)return a}}if(Qn(i))return i}return null},er=(e,t)=>$n(document,e,t),tr=(e,t,n,r)=>{let i=e.elementsFromPoint(t,n),a=!0;for(let o of i){if(Rn(o)&&(a=!1),a&&o.shadowRoot&&o.shadowRoot!==e&&tr(o.shadowRoot,t,n,r),a&&g(o)){let e=O(o);if(e){let i=Fn(o,t,n);tr(e,i.x,i.y,r)}}r.add(o)}},nr=(e,t)=>{let n=new Set;return tr(document,e,t,n),[...n]},rr=(e,t,n)=>e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom,ir=(e,t,n=document)=>{let r=n.createElement(`style`);r.setAttribute(e,``);let i=bn(n);return i&&(r.nonce=i),Sn(r),r.textContent=t,n.head.appendChild(r),r},ar=`html { pointer-events: none !important; }
28
- iframe[${ye}] { pointer-events: auto !important; }`,or=new Set,k=new Map;let A=!1;const sr=e=>{if(k.has(e))return;let t=ir(`data-react-grab-frozen-pseudo`,ar,e),n=ir(`data-react-grab-hittest-override`,`html, body { pointer-events: auto !important; }`,e);n.disabled=!0,k.set(e,{pointerEventsStyle:t,hitTestOverrideStyle:n})},cr=e=>{let t=k.get(e);t&&(t.pointerEventsStyle.remove(),t.hitTestOverrideStyle.remove(),k.delete(e))},lr=()=>A,ur=e=>(or.add(e),A&&sr(e),()=>{or.delete(e),cr(e)}),dr=()=>{if(!A){A=!0,or.add(document);for(let e of or)sr(e)}},fr=()=>{if(A){A=!1;for(let e of[...k.keys()])cr(e)}},pr=()=>{if(A)for(let e of k.values())e.pointerEventsStyle.disabled||(e.pointerEventsStyle.disabled=!0),e.hitTestOverrideStyle.disabled&&(e.hitTestOverrideStyle.disabled=!1)},mr=()=>{if(A)for(let e of k.values())e.pointerEventsStyle.disabled&&(e.pointerEventsStyle.disabled=!1),e.hitTestOverrideStyle.disabled||(e.hitTestOverrideStyle.disabled=!0)},hr=new WeakMap,j=new WeakMap,gr=[`name`,`position`,`rotation`,`scale`,`color`,`visible`,`args`],M=e=>typeof e==`object`&&!!e,_r=e=>typeof e==`object`&&!!e||typeof e==`function`,N=(e,t)=>typeof e[t]==`function`,vr=e=>M(e)&&typeof e.x==`number`&&typeof e.y==`number`&&typeof e.z==`number`&&N(e,`set`)&&N(e,`clone`)&&N(e,`applyMatrix4`)&&N(e,`project`),yr=e=>M(e)&&N(e,`clone`)&&N(e,`premultiply`),br=e=>M(e)&&`boundingBox`in e&&N(e,`computeBoundingBox`),xr=e=>M(e)&&typeof e.type==`string`&&M(e.props)&&Sr(e.object),Sr=e=>M(e)&&e.isObject3D===!0&&typeof e.uuid==`string`&&typeof e.name==`string`&&typeof e.type==`string`&&typeof e.visible==`boolean`&&yr(e.matrixWorld)&&N(e,`updateWorldMatrix`),Cr=e=>M(e)&&e.isCamera===!0,wr=e=>Sr(e)&&e.isScene===!0&&Array.isArray(e.children),Tr=e=>M(e)&&typeof e.tagName==`string`&&e.tagName.toLowerCase()===`canvas`&&N(e,`getContext`),Er=e=>M(e)&&Tr(e.domElement),Dr=e=>M(e)&&N(e,`set`),Or=e=>M(e)&&N(e,`setFromCamera`)&&N(e,`intersectObjects`),kr=e=>M(e)&&Er(e.gl)&&wr(e.scene)&&Cr(e.camera)&&Or(e.raycaster)&&Dr(e.pointer),Ar=e=>xr(e.__r3f)?e.__r3f:null,jr=e=>{let t=e.current.stateNode;if(!M(t)||!_r(t.containerInfo))return null;let n=Reflect.get(t.containerInfo,`getState`);if(typeof n!=`function`)return null;let r=n();return kr(r)?r:null};qt({name:`react-grab-three-selection`,onCommitFiberRoot:(e,t)=>{let n=jr(t);n&&j.set(n.gl.domElement,{isReactThreeFiber:!0,state:n})}});const Mr=e=>{let t=e;for(;t;){if(Ar(t))return t;t=t.parent}return null},Nr=e=>{let t=e;for(;t;){let e=Ar(t);if(e&&typeof e.eventCount==`number`&&e.eventCount>0)return!0;t=t.parent}return!1},Pr=(e,t)=>{let n=e;for(;n;){if(n===t)return!0;n=n.parent}return!1},Fr=(e,t,n)=>{let r=typeof n.instanceId==`number`&&Number.isInteger(n.instanceId)?n.instanceId:null,i=hr.get(t);i||(i=new Map,hr.set(t,i));let a=i.get(r);if(a)return a.canvas=e.gl.domElement,a.intersectionPoint=vr(n.point)?n.point:null,a.object=t,a.rootState=e,a.element;let o=Ar(t),s=o?Xt(o):null;if(o&&!s)return null;let c=(o?.type||t.type||`object-3d`).toLowerCase(),l=e.gl.domElement.ownerDocument.createElement(c),u={canvas:e.gl.domElement,element:l,fiber:s,instance:o,instanceId:r,intersectionPoint:vr(n.point)?n.point:null,object:t,rootState:e,tagName:c},d=l.getBoundingClientRect.bind(l);return l.getBoundingClientRect=()=>{let e=Wr(u),t=l.ownerDocument.defaultView?.DOMRect;return t?new t(e.x,e.y,e.width,e.height):d()},Qt(l,{hostElement:u.canvas,supportsDomEditing:!1,getBounds:()=>Wr(u),getFiber:()=>u.fiber?jt(u.fiber):null,getPreview:()=>zr(u),getSelector:()=>Br(u),getTagName:()=>u.tagName,isConnected:()=>u.canvas.isConnected&&Pr(u.object,u.rootState.scene)}),i.set(r,u),l},Ir=(e,t,n)=>{if(!Tr(e))return e;let r=j.get(e);if(!r)return e;let i=an(e);if(i.width<=0||i.height<=0)return e;let a=(t-i.x)/i.width*2-1,o=-((n-i.y)/i.height)*2+1;if(a<-1||a>1||o<-1||o>1)return e;try{r.state.pointer.set(a,o),r.state.raycaster.setFromCamera(r.state.pointer,r.state.camera);let e=r.state.raycaster.intersectObjects(r.state.scene.children,!0);if(r.isReactThreeFiber)for(let t of e){if(!Nr(t.object))continue;let e=Mr(t.object);if(!e||e.visible===!1)continue;let n=Fr(r.state,e,t);if(n)return n}for(let t of e){let e=r.isReactThreeFiber?Mr(t.object):t.object;if(!e||e.visible===!1)continue;let n=Fr(r.state,e,t);if(n)return n}}catch{}return e},Lr=e=>{let t={gl:e.renderer,scene:e.scene,camera:e.camera,raycaster:e.raycaster,pointer:e.pointer};if(!kr(t))throw TypeError(`Invalid Three.js scene registration`);let n=t.gl.domElement,r={isReactThreeFiber:!1,state:t};return j.set(n,r),()=>{j.get(n)===r&&j.delete(n)}},Rr=e=>typeof e==`string`?JSON.stringify(e):typeof e==`number`||typeof e==`boolean`?`{${String(e)}}`:Array.isArray(e)&&e.length<=4&&e.every(e=>typeof e==`number`||typeof e==`string`)?`{${JSON.stringify(e)}}`:null,zr=e=>{let t=e.instance?.props??{},n=[];for(let r of gr){let i=t[r];r===`name`&&i===void 0&&e.object.name&&(i=e.object.name);let a=Rr(i);a&&n.push(`${r}=${a}`)}return e.instanceId!==null&&n.push(`instanceId={${e.instanceId}}`),`<${e.tagName}${n.length>0?` ${n.join(` `)}`:``} />`},Br=e=>{if(e.object.name)return`${e.tagName}[name=${JSON.stringify(e.object.name)}]`;let t=e.instanceId===null?``:`:${e.instanceId}`;return`${e.tagName}[uuid=${JSON.stringify(`${e.object.uuid}${t}`)}]`},Vr=e=>{e.object.updateWorldMatrix(!0,!1);let t=e.object.matrixWorld.clone();if(e.instanceId===null||!e.object.getMatrixAt)return t;let n=e.object.matrixWorld.clone();return e.object.getMatrixAt(e.instanceId,n),n.premultiply(t)},Hr=e=>{if(!br(e.geometry))return null;e.geometry.boundingBox||e.geometry.computeBoundingBox();let t=e.geometry.boundingBox;return!t||!vr(t.min)||!vr(t.max)?null:t},Ur=(e,t)=>{let n=t.x+t.width/2,r=t.y+t.height/2;if(e.intersectionPoint){let i=e.intersectionPoint.clone().project(e.rootState.camera);Number.isFinite(i.x)&&Number.isFinite(i.y)&&(n=t.x+(i.x+1)/2*t.width,r=t.y+(1-i.y)/2*t.height)}return{x:n-16/2,y:r-16/2,width:16,height:16,borderRadius:`0px`}},Wr=e=>{let t=an(e.canvas),n=Hr(e.object);if(!n)return Ur(e,t);let r=Vr(e),i=[n.min.x,n.max.x],a=[n.min.y,n.max.y],o=[n.min.z,n.max.z],s=1/0,c=1/0,l=-1/0,u=-1/0,d=n.min.clone();for(let n of i)for(let i of a)for(let a of o){if(d.set(n,i,a).applyMatrix4(r).project(e.rootState.camera),!Number.isFinite(d.x)||!Number.isFinite(d.y))continue;let o=t.x+(d.x+1)/2*t.width,f=t.y+(1-d.y)/2*t.height;s=Math.min(s,o),c=Math.min(c,f),l=Math.max(l,o),u=Math.max(u,f)}if(!Number.isFinite(s)||!Number.isFinite(c)||!Number.isFinite(l)||!Number.isFinite(u))return Ur(e,t);let f=Math.max(t.x,s),p=Math.max(t.y,c),ee=Math.min(t.x+t.width,l),m=Math.min(t.y+t.height,u);return ee<=f||m<=p?Ur(e,t):{x:f,y:p,width:ee-f,height:m-p,borderRadius:`0px`}};let P=null,F=null,I=null;const Gr=()=>{I!==null&&clearTimeout(I),I=setTimeout(()=>{I=null,mr()},100)},Kr=()=>{I!==null&&(clearTimeout(I),I=null)},qr=(e,t,n,r)=>{let i=Math.abs(e-n),a=Math.abs(t-r);return i<=2&&a<=2},Jr=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return[];Kr(),pr();try{let n=nr(e,t),r=Dn()?n.filter(On):n,i=[];for(let n of r)i.push(Ir(n,e,t));return i}finally{Gr()}},Yr=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return null;let n=performance.now();if(F){let r=F.element,i=n-F.timestamp<16;if(r.isConnected&&i&&rr(e,t,F.bounds)&&!O(r))return r;F=null,P?.element===r&&(P=null)}if(P){let r=qr(e,t,P.clientX,P.clientY),i=n-P.timestamp<16;if(r||i)return P.element}Kr(),pr();try{let r=null,i=Ln(e,t),a=i?Ir(i,e,t):null;if(r=i&&a&&Qn(a)&&On(i)?a:er(e,t),r&&g(r)&&!O(r)){let e=an(r);F={element:r,timestamp:n,bounds:{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height}}}else F=null;return P={clientX:e,clientY:t,element:r,timestamp:n},r}finally{Gr()}},Xr=()=>{Kr(),mr(),P=null,F=null},L=e=>{console.warn(`[react-grab]`,e)},Zr=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]);let R=!1;const z=new Map;let Qr=-1;const $r=new WeakSet,B=new Map,V=new Map,ei=e=>$r.has(e)?!0:!R||!(`gsapVersions`in window)||!(Error().stack??``).includes(`_tick`)?!1:($r.add(e),!0);typeof window<`u`&&(window.requestAnimationFrame=e=>{if(!ei(e))return D(e);if(R){let t=Qr--;return z.set(t,e),t}let t=D(n=>{if(R){let n=Qr--;z.set(n,e),B.set(t,n);return}e(n)});return t},window.cancelAnimationFrame=e=>{if(z.has(e)){z.delete(e);return}let t=V.get(e);if(t!==void 0){Nn(t.nativeId),V.delete(e);return}let n=B.get(e);if(n!==void 0){z.delete(n),B.delete(e);return}Nn(e)});const ti=()=>{if(!R){R=!0,z.clear(),B.clear();for(let[e,{nativeId:t,callback:n}]of V)Nn(t),z.set(e,n);V.clear()}},ni=()=>{if(R){R=!1;for(let[e,t]of z.entries()){let n=D(n=>{V.delete(e),t(n)});V.set(e,{nativeId:n,callback:t})}z.clear(),B.clear()}},H=(e,t)=>{if(e.length!==0)throw e.length===1?e[0]:AggregateError(e,t)},ri=`
29
- [${ve}],
30
- [${ve}] * {
31
- animation-play-state: paused !important;
32
- transition: none !important;
33
- }
34
- `,ii=e=>e?.namespaceURI===`http://www.w3.org/2000/svg`&&e.tagName===`svg`;let ai=null,U=[],W=[],oi=[];const G=new Set,K=new Map,q=new Map;let J=[];const si=()=>K.size>0,ci=()=>{ai||=ir(`data-react-grab-frozen-styles`,ri)},li=e=>{let t=new Set;for(let n of e){let e=ii(n)?n:n.closest(`svg`);ii(e)&&t.add(e);for(let e of n.querySelectorAll(`svg`))ii(e)&&t.add(e)}return[...t]},ui=(e,t)=>{let n=Reflect.get(e,t);typeof n==`function`&&n.call(e)},di=(e,t)=>{for(let n of e){let e=q.get(n)??0;if(e===0){q.set(n,1),t.push(n),ui(n,`pauseAnimations`);continue}q.set(n,e+1),t.push(n)}},fi=(e,t)=>{let n=[];for(let r of e){let e=q.get(r);if(e){if(e===1){try{ui(r,`unpauseAnimations`),q.delete(r)}catch(e){n.push(r),t.push(e)}continue}q.set(r,e-1)}}return n},pi=e=>{let t=[];for(let n of e)for(let e of n.getAnimations({subtree:!0}))e.playState===`running`&&t.push(e);return t},mi=e=>{for(let t of e)try{t.finish()}catch{}},hi=e=>{for(let t of e)try{t.finish()}catch{try{t.play()}catch{}}},gi=e=>{if(!(e.effect instanceof KeyframeEffect))return!1;let t=e.effect.target;if(!Ye(t))return!1;let n=t.getRootNode();return on(n)&&Gn(n.host)},_i=e=>{if(e.length===0||Zr(e,oi))return;vi();let t=[...e];ci(),U=t,W=[];try{di(li(U),W);for(let e of U)e.setAttribute(ve,``);let e=pi(U);J=[];for(let t of e)t.pause(),J.push(t);oi=t}catch(e){try{vi()}catch(t){throw AggregateError([e,t],`Rolling back animation freeze failed`)}throw e}},vi=()=>{if(U.length===0&&W.length===0&&J.length===0)return;let e=U,t=W,n=J,r=[],i=[];oi=[];for(let t of e)try{t.removeAttribute(ve)}catch(e){i.push(t),r.push(e)}U=i,W=fi(t,r),hi(n),J=[],H(r,`Unfreezing element animations failed`)},yi=e=>e.length===0?(vi(),()=>{}):(_i(e),vi),bi=e=>{let t=[];for(let n of e.getAnimations())gi(n)||n.playState===`running`&&t.push(n);return{targetDocument:e,runningAnimations:t}},xi=e=>{let t=K.get(e);if(!t)return[];let n=[],r=t.styleElement;if(r){try{if(t.didUseCssFreeze){r.textContent=`
35
- *, *::before, *::after {
36
- transition: none !important;
37
- }
38
- `;let t=[];for(let n of e.getAnimations())gi(n)||t.push(n);mi(t)}else hi(t.frozenWaapiAnimations);t.didUseCssFreeze=!1,t.frozenWaapiAnimations=[]}catch(e){n.push(e)}try{r.remove(),t.styleElement=null}catch(e){n.push(e)}}return t.frozenSvgElements=fi(t.frozenSvgElements,n),t.styleElement===null&&t.frozenSvgElements.length===0&&t.frozenWaapiAnimations.length===0&&K.delete(e),n},Si=e=>{if(K.has(e.targetDocument))return;let t=ir(`data-react-grab-global-freeze`,``,e.targetDocument),n={styleElement:t,frozenSvgElements:[],frozenWaapiAnimations:[],didUseCssFreeze:!1};if(K.set(e.targetDocument,n),e.runningAnimations.length>200)t.textContent=`
39
- *, *::before, *::after {
40
- animation-play-state: paused !important;
41
- transition: none !important;
42
- }
43
- `,n.didUseCssFreeze=!0;else for(let t of e.runningAnimations)t.pause(),n.frozenWaapiAnimations.push(t);di(li(Array.from(e.targetDocument.querySelectorAll(`svg`))),n.frozenSvgElements)},Ci=e=>{G.add(e);try{si()&&Si(bi(e))}catch(t){G.delete(e);let n=xi(e);throw n.length===0?t:AggregateError([t,...n],`Freezing frame animations failed`)}return()=>{G.delete(e),H(xi(e),`Unfreezing frame animations failed`)}},wi=()=>si()?[]:(G.add(document),[...G].map(bi)),Ti=e=>{if(!si()){for(let t of e)Si(t);ti()}},Ei=()=>{if(!si())return;let e=[];for(let t of[...K.keys()])e.push(...xi(t));try{ni()}catch(t){e.push(t)}H(e,`Unfreezing global animations failed`)},Di=(e,t)=>{for(let n of e.querySelectorAll(`:hover`))if(!Kn(n)&&(h(n)&&t.add(n),n.shadowRoot&&Di(n.shadowRoot,t),g(n))){let e=O(n);e&&Di(e,t)}},Oi=()=>{let e=new Set;return Di(document,e),[...e]},ki=[`mouseenter`,`mouseleave`,`mouseover`,`mouseout`,`pointerenter`,`pointerleave`,`pointerover`,`pointerout`],Ai=[`focus`,`blur`,`focusin`,`focusout`],ji=[`background-color`,`color`,`border-color`,`box-shadow`,`transform`,`opacity`,`outline`,`filter`,`scale`,`visibility`,`display`],Mi=[`background-color`,`color`,`border-color`,`box-shadow`,`outline`,`outline-offset`,`outline-width`,`outline-color`,`outline-style`,`filter`,`opacity`,`ring-color`,`ring-width`],Ni=new Map,Pi=new Map,Y=new Set;let X=!1;const Fi=e=>{e.stopImmediatePropagation()},Ii=e=>{e.preventDefault(),e.stopImmediatePropagation()},Li=e=>{for(let t of ki)e.addEventListener(t,Fi,!0);for(let t of Ai)e.addEventListener(t,Ii,!0)},Ri=e=>{for(let t of ki)e.removeEventListener(t,Fi,!0);for(let t of Ai)e.removeEventListener(t,Ii,!0)},zi=e=>{Y.add(e);let t=ur(e);return X&&Li(e),()=>{X&&Ri(e),Y.delete(e),t()}},Bi=(e,t,n)=>{if(n?.has(e))return null;let r=getComputedStyle(e),i=new Map,a=new Map;for(let n of t){let t=r.getPropertyValue(n);t&&(i.set(n,t),a.set(n,{value:e.style.getPropertyValue(n),priority:e.style.getPropertyPriority(n)}))}return{element:e,frozenPropertyValues:i,originalPropertyValues:a}},Vi=(e,t)=>{let n=[],r=Ln(e,t);for(;r&&r!==document.documentElement&&!Kn(r);)h(r)&&n.push(r),r=wn(r);return n},Hi=()=>{let e=[],t=document.activeElement;for(;t&&t!==document.body;){if(h(t)&&e.push(t),t.shadowRoot?.activeElement){t=t.shadowRoot.activeElement;continue}if(g(t)){t=O(t)?.activeElement??null;continue}t=null}return e},Ui=(e,t)=>{for(let{element:n,frozenPropertyValues:r,originalPropertyValues:i}of e){t.set(n,i);for(let[e,t]of r)n.style.setProperty(e,t,`important`)}},Wi=e=>{let t=[];for(let[n,r]of e){for(let[e,i]of r)try{i.value?n.style.setProperty(e,i.value,i.priority):n.style.removeProperty(e),r.delete(e)}catch(e){t.push(e)}r.size===0&&e.delete(n)}return t},Gi=(e,t)=>{if(lr())return null;let n=[],r=e!==void 0&&t!==void 0&&e>=0&&t>=0&&e<window.innerWidth&&t<window.innerHeight?Vi(e,t):Oi();for(let e of r){let t=Bi(e,ji);t&&n.push(t)}let i=[];for(let e of Hi()){let t=Bi(e,Mi,Pi);t&&i.push(t)}return{hoverStates:n,focusStates:i}},Ki=e=>{if(e){X=!0,Y.add(document);for(let e of Y)Li(e);Ui(e.hoverStates,Ni),Ui(e.focusStates,Pi),dr()}},qi=()=>{Xr(),X=!1;for(let e of Y)Ri(e);let e=[...Wi(Ni),...Wi(Pi)];try{fr()}catch(t){e.push(t)}H(e,`Unfreezing pseudo states failed`)},Ji=()=>{let e=[];try{qi()}catch(t){e.push(t)}try{Ei()}catch(t){e.push(t)}return e},Yi=(e,t)=>{let n=Gi(e,t),r=wi();try{Ki(n),Ti(r)}catch(e){let t=Ji();throw t.length===0?e:AggregateError([e,...t],`Freezing global interactions failed`)}},Xi=()=>{H(Ji(),`Unfreezing global interactions failed`)};let Z=!1,Q=0;const Zi=(e,t,n)=>{let r=e.get(t);if(r)return r;let i=n();return e.set(t,i),i},Qi=new WeakMap,$i=new WeakMap,ea=new WeakMap,ta=new Set,na=[],$=[],ra=new WeakMap,ia=new WeakMap,aa=new WeakSet,oa=At,sa=new Set,ca=e=>e.rendererPackageName.startsWith(`react-dom`),la=e=>{let t=e;for(;t.return;)t=t.return;return t.stateNode??null},ua=e=>{let t=e.current?.stateNode;if(!t||typeof t!=`object`)return!1;let n=Reflect.get(t,`containerInfo`);return!!(n&&typeof n==`object`&&typeof Reflect.get(n,`nodeType`)==`number`)},da=()=>{if(oa.size>0){let e=new Set;for(let t of oa)ua(t)&&e.add(t);return e}let e=new Set,t=n=>{let r=Xt(n);if(r){let t=la(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},fa=(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},pa=e=>{if(!e||ra.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=()=>Z?t.snapshotValueAtPause:t.originalGetSnapshot());let n=t.pendingValueAtPause;Object.defineProperty(e,`pending`,{configurable:!0,enumerable:!0,get:()=>Z?null:n,set:e=>{if(Z){e!==null&&(t.bufferedPending=fa(t.bufferedPending??null,e));return}n=e}}),ra.set(e,t)},ma=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},ha=e=>{let t=ra.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=ma(t.pendingValueAtPause??null),r=ma(t.bufferedPending??null);for(let t of[...e,...r])$.push(()=>n(t))}ra.delete(e)},ga=e=>{if(ia.has(e))return;let t={originalDescriptor:Object.getOwnPropertyDescriptor(e,`memoizedValue`),frozenValue:e.memoizedValue};Object.defineProperty(e,`memoizedValue`,{configurable:!0,enumerable:!0,get(){return Z?t.frozenValue:t.originalDescriptor?.get?t.originalDescriptor.get.call(this):this._memoizedValue},set(e){if(Z){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),ia.set(e,t)},_a=e=>{let t=ia.get(e);t&&(t.originalDescriptor?Object.defineProperty(e,`memoizedValue`,t.originalDescriptor):delete e.memoizedValue,t.didReceivePendingValue&&(e.memoizedValue=t.pendingValue),ia.delete(e))},va=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&pa(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)ga(n),n=n.next},ya=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&ha(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)_a(n),n=n.next},ba=e=>{let t=e;for(;t;){if(yt(t)&&va(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}},xa=e=>{let t=e;for(;t;){if(yt(t)&&ya(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}},Sa=e=>{if(Qi.has(e))return;let t=e,n={useState:t.useState,useReducer:t.useReducer,useTransition:t.useTransition,useSyncExternalStore:t.useSyncExternalStore};Qi.set(e,n),t.useState=(...t)=>{let r=n.useState.apply(e,t);if(!Z||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,Zi($i,a,()=>(...e)=>{Z?$.push(()=>a(...e)):a(...e)})]},t.useReducer=(...t)=>{let r=n.useReducer.apply(e,t);if(!Z||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,Zi($i,a,()=>(...e)=>{Z?$.push(()=>a(...e)):a(...e)})]},t.useTransition=(...t)=>{let r=n.useTransition.apply(e,t);if(!Z||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,Zi(ea,a,()=>e=>{Z?na.push(()=>a(e)):a(e)})]},t.useSyncExternalStore=((e,t,r)=>Z?n.useSyncExternalStore(t=>e(()=>{Z?ta.add(t):t()}),t,r):n.useSyncExternalStore(e,t,r))},Ca=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`&&Sa(r),r),set:e=>{r=e}})},wa=e=>{queueMicrotask(()=>{try{for(let t of b().renderers.values())if(ca(t)&&typeof t.scheduleUpdate==`function`){for(let n of e)if(n.current)try{t.scheduleUpdate(n.current)}catch(e){L(new E(`scheduleUpdate failed during unfreeze`,e))}}}catch(e){L(new E(`scheduleReactUpdate failed`,e))}})},Ta=e=>{for(let t of e)try{t()}catch(e){L(new E(`Callback failed during state replay`,e))}},Ea=()=>{for(let e of b().renderers.values())ca(e)&&(aa.has(e)||(Ca(e),aa.add(e)))},Da=()=>{ta.clear(),na.length=0,$.length=0},Oa=()=>{let e=new Set(sa);try{for(let t of da())e.add(t)}catch(e){L(new E(`Collecting fiber roots failed during unfreeze`,e))}sa.clear(),Z=!1;for(let t of e)try{xa(t.current)}catch(e){L(new E(`Resuming a fiber root failed during unfreeze`,e))}let t=Array.from(ta),n=na.slice(),r=$.slice();Da(),Ta(t),Ta(n),Ta(r),Z||wa(e)},ka=()=>{let e=Q===0;if(Q+=1,e)try{Ea(),Z=!0;let e=da();for(let t of e)sa.add(t),ba(t.current)}catch(e){throw--Q,Z&&Oa(),e}let t=!1;return()=>{t||(t=!0,--Q,Q===0&&Oa())}},Aa=()=>{try{return ka()}catch(e){return L(new E(`Pausing React updates failed`,e)),()=>{}}};export{w as $,oe as $t,On as A,He as At,sn as B,ue as Bt,Un as C,ne as Ct,Pn as D,De as Dt,D as E,Me as Et,bn as F,Re as Ft,dn as G,Oe as Gt,cn as H,xe as Ht,vn as I,Fe as It,gn as J,Pe as Jt,T as K,ge as Kt,pn as L,Ie as Lt,wn as M,We as Mt,Cn as N,ze as Nt,Dn as O,Le as Ot,Sn as P,Be as Pt,nn as Q,ce as Qt,fn as R,l as Rt,Kn as S,Te as St,Nn as T,Ne as Tt,un as U,be as Ut,mn as V,ie as Vt,ln as W,p as Wt,on as X,ae as Xt,hn as Y,s as Yt,an as Z,Se as Zt,mr as _,i as _n,de as _t,zi as a,pe as an,Xt as at,Zn as b,te as bn,Ee as bt,Ci as c,Ce as cn,jt as ct,L as d,qe as dn,et as dt,le as en,$t as et,Xr as f,c as fn,$e as ft,Ir as g,we as gn,_e as gt,Lr as h,d as hn,Ye as ht,Xi as i,me as in,kt as it,En as j,Ue as jt,kn as k,Ve as kt,H as l,Je as ln,pt as lt,Jr as m,f as mn,h as mt,ka as n,a as nn,Ct as nt,_i as o,fe as on,vt as ot,Yr as p,u as pn,g as pt,E as q,je as qt,Yi as r,o as rn,yt as rt,yi as s,he as sn,wt as st,Aa as t,se as tn,Ot as tt,Zr as u,ye as un,b as ut,pr as v,Ae as vn,re as vt,O as w,ke as wt,Qn as x,t as xn,Ge as xt,nr as y,m as yn,ee as yt,_n as z,Ke as zt};