grab 0.1.0 → 0.1.1

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.
@@ -0,0 +1,106 @@
1
+ 'use strict';var chunkGJYSUTIS_cjs=require('./chunk-GJYSUTIS.cjs');/**
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
+ var Xn=Symbol("store-raw"),Jt=Symbol("store-node"),lt=Symbol("store-has"),js=Symbol("store-self");function Gs(e){let t=e[chunkGJYSUTIS_cjs.a];if(!t&&(Object.defineProperty(e,chunkGJYSUTIS_cjs.a,{value:t=new Proxy(e,yl)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let a=0,l=n.length;a<l;a++){let s=n[a];r[s].get&&Object.defineProperty(e,s,{enumerable:r[s].enumerable,get:r[s].get.bind(t)});}}return t}function Qt(e){let t;return e!=null&&typeof e=="object"&&(e[chunkGJYSUTIS_cjs.a]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function en(e,t=new Set){let n,r,a,l;if(n=e!=null&&e[Xn])return n;if(!Qt(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let s=0,f=e.length;s<f;s++)a=e[s],(r=en(a,t))!==a&&(e[s]=r);}else {Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let s=Object.keys(e),f=Object.getOwnPropertyDescriptors(e);for(let i=0,u=s.length;i<u;i++)l=s[i],!f[l].get&&(a=e[l],(r=en(a,t))!==a&&(e[l]=r));}return e}function qn(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function xn(e,t,n){if(e[t])return e[t];let[r,a]=chunkGJYSUTIS_cjs.d(n,{equals:false,internal:true});return r.$=a,e[t]=r}function hl(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return !n||n.get||!n.configurable||t===chunkGJYSUTIS_cjs.a||t===Jt||(delete n.value,delete n.writable,n.get=()=>e[chunkGJYSUTIS_cjs.a][t]),n}function Ws(e){chunkGJYSUTIS_cjs.m()&&xn(qn(e,Jt),js)();}function bl(e){return Ws(e),Reflect.ownKeys(e)}var yl={get(e,t,n){if(t===Xn)return e;if(t===chunkGJYSUTIS_cjs.a)return n;if(t===chunkGJYSUTIS_cjs.b)return Ws(e),n;let r=qn(e,Jt),a=r[t],l=a?a():e[t];if(t===Jt||t===lt||t==="__proto__")return l;if(!a){let s=Object.getOwnPropertyDescriptor(e,t);chunkGJYSUTIS_cjs.m()&&(typeof l!="function"||e.hasOwnProperty(t))&&!(s&&s.get)&&(l=xn(r,t,l)());}return Qt(l)?Gs(l):l},has(e,t){return t===Xn||t===chunkGJYSUTIS_cjs.a||t===chunkGJYSUTIS_cjs.b||t===Jt||t===lt||t==="__proto__"?true:(chunkGJYSUTIS_cjs.m()&&xn(qn(e,lt),t)(),t in e)},set(){return true},deleteProperty(){return true},ownKeys:bl,getOwnPropertyDescriptor:hl};function tn(e,t,n,r=false){if(!r&&e[t]===n)return;let a=e[t],l=e.length;n===void 0?(delete e[t],e[lt]&&e[lt][t]&&a!==void 0&&e[lt][t].$()):(e[t]=n,e[lt]&&e[lt][t]&&a===void 0&&e[lt][t].$());let s=qn(e,Jt),f;if((f=xn(s,t,a))&&f.$(()=>n),Array.isArray(e)&&e.length!==l){for(let i=e.length;i<l;i++)(f=s[i])&&f.$();(f=xn(s,"length",l))&&f.$(e.length);}(f=s[js])&&f.$();}function Ys(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let a=n[r];tn(e,a,t[a]);}}function Sl(e,t){if(typeof t=="function"&&(t=t(e)),t=en(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let a=t[n];e[n]!==a&&tn(e,n,a);}tn(e,"length",r);}else Ys(e,t);}function Cn(e,t,n=[]){let r,a=e;if(t.length>1){r=t.shift();let s=typeof r,f=Array.isArray(e);if(Array.isArray(r)){for(let i=0;i<r.length;i++)Cn(e,[r[i]].concat(t),n);return}else if(f&&s==="function"){for(let i=0;i<e.length;i++)r(e[i],i)&&Cn(e,[i].concat(t),n);return}else if(f&&s==="object"){let{from:i=0,to:u=e.length-1,by:g=1}=r;for(let T=i;T<=u;T+=g)Cn(e,[T].concat(t),n);return}else if(t.length>1){Cn(e[r],t,[r].concat(n));return}a=e[r],n=[r].concat(n);}let l=t[0];typeof l=="function"&&(l=l(a,n),l===a)||r===void 0&&l==null||(l=en(l),r===void 0||Qt(a)&&Qt(l)&&!Array.isArray(l)?Ys(a,l):tn(e,r,l));}function Jn(...[e,t]){let n=en(e||{}),r=Array.isArray(n),a=Gs(n);function l(...s){chunkGJYSUTIS_cjs.i(()=>{r&&s.length===1?Sl(n,s[0]):Cn(n,s);});}return [a,l]}var Zn=new WeakMap,Xs={get(e,t){if(t===Xn)return e;let n=e[t],r;return Qt(n)?Zn.get(n)||(Zn.set(n,r=new Proxy(n,Xs)),r):n},set(e,t,n){return tn(e,t,en(n)),true},deleteProperty(e,t){return tn(e,t,void 0,true),true}};function Je(e){return t=>{if(Qt(t)){let n;(n=Zn.get(t))||Zn.set(t,n=new Proxy(t,Xs)),e(n);}return t}}var wl=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),El=e=>{let t=e.trim();if(!t)return null;let n=parseFloat(t);return wl(n)?n:null},qs=(e,t)=>{let n=e.split(",");if(n.length!==t)return null;let r=[];for(let a of n){let l=El(a);if(l===null)return null;r.push(l);}return r},Zs=(e,t,n,r)=>e===1&&t===0&&n===0&&r===1,vl=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===1&&e[6]===0&&e[7]===0&&e[8]===0&&e[9]===0&&e[10]===1&&e[11]===0&&e[15]===1,Js=e=>{if(!e||e==="none")return "none";if(e.charCodeAt(0)===109)if(e.charCodeAt(6)===51){let n=e.length-1,r=qs(e.slice(9,n),16);if(r)return r[12]=0,r[13]=0,r[14]=0,vl(r)?"none":`matrix3d(${r[0]}, ${r[1]}, ${r[2]}, ${r[3]}, ${r[4]}, ${r[5]}, ${r[6]}, ${r[7]}, ${r[8]}, ${r[9]}, ${r[10]}, ${r[11]}, 0, 0, 0, ${r[15]})`}else {let n=e.length-1,r=qs(e.slice(7,n),6);if(r){let a=r[0],l=r[1],s=r[2],f=r[3];return Zs(a,l,s,f)?"none":`matrix(${a}, ${l}, ${s}, ${f}, 0, 0)`}}return "none"},Qs=e=>e.isIdentity?"none":e.is2D?Zs(e.a,e.b,e.c,e.d)?"none":`matrix(${e.a}, ${e.b}, ${e.c}, ${e.d}, 0, 0)`:e.m11===1&&e.m12===0&&e.m13===0&&e.m14===0&&e.m21===0&&e.m22===1&&e.m23===0&&e.m24===0&&e.m31===0&&e.m32===0&&e.m33===1&&e.m34===0&&e.m44===1?"none":`matrix3d(${e.m11}, ${e.m12}, ${e.m13}, ${e.m14}, ${e.m21}, ${e.m22}, ${e.m23}, ${e.m24}, ${e.m31}, ${e.m32}, ${e.m33}, ${e.m34}, 0, 0, 0, ${e.m44})`;var pr=new WeakMap,ei=()=>{pr=new WeakMap;},xl=(e,t)=>{let n=t&&t!=="none",r=null,a=e.parentElement,l=0;for(;a&&a!==document.documentElement&&l<chunkGJYSUTIS_cjs.pa;){let s=window.getComputedStyle(a).transform;if(s&&s!=="none")r=r?new DOMMatrix(s).multiply(r):new DOMMatrix(s);else if(!n&&!r&&l>=chunkGJYSUTIS_cjs.qa)return "none";a=a.parentElement,l++;}return r?(n&&(r=r.multiply(new DOMMatrix(t))),Qs(r)):n?Js(t):"none"},me=e=>{let t=performance.now(),n=pr.get(e);if(n&&t-n.timestamp<16)return n.bounds;let r=e.getBoundingClientRect(),a=window.getComputedStyle(e),l=xl(e,a.transform),s;if(l!=="none"&&e instanceof HTMLElement){let f=e.offsetWidth,i=e.offsetHeight;if(f>0&&i>0){let u=r.left+r.width*.5,g=r.top+r.height*.5;s={borderRadius:a.borderRadius||"0px",height:i,transform:l,width:f,x:u-f*.5,y:g-i*.5};}else s={borderRadius:a.borderRadius||"0px",height:r.height,transform:l,width:r.width,x:r.left,y:r.top};}else s={borderRadius:a.borderRadius||"0px",height:r.height,transform:l,width:r.width,x:r.left,y:r.top};return pr.set(e,{bounds:s,timestamp:t}),s};var Tl=e=>({current:{state:"idle"},wasActivatedByToggle:false,pendingCommentMode:false,hasAgentProvider:e.hasAgentProvider,keyHoldDuration:e.keyHoldDuration,pointer:{x:-1e3,y:-1e3},dragStart:{x:-1e3,y:-1e3},copyStart:{x:-1e3,y:-1e3},copyOffsetFromCenterX:0,detectedElement:null,frozenElement:null,frozenElements:[],frozenDragRect:null,lastGrabbedElement:null,lastCopiedElement:null,selectionFilePath:null,selectionLineNumber:null,inputText:"",pendingClickData:null,replySessionId:null,viewportVersion:0,grabbedBoxes:[],labelInstances:[],agentSessions:new Map,sessionElements:new Map,isTouchMode:false,theme:e.theme,activationTimestamp:null,previouslyFocusedElement:null,canUndo:false,canRedo:false,isAgentConnected:false,supportsUndo:false,supportsFollowUp:false,dismissButtonText:void 0,pendingAbortSessionId:null,contextMenuPosition:null,contextMenuElement:null,contextMenuClickOffset:null,selectedAgent:null}),ti=e=>{let[t,n]=Jn(Tl(e)),r=()=>t.current.state==="active",a=()=>t.current.state==="holding",l={startHold:s=>{s!==void 0&&n("keyHoldDuration",s),n("current",{state:"holding",startedAt:Date.now()});},release:()=>{t.current.state==="holding"&&n("current",{state:"idle"});},activate:()=>{n("current",{state:"active",phase:"hovering",isPromptMode:false,isPendingDismiss:false}),n("activationTimestamp",Date.now()),n("previouslyFocusedElement",document.activeElement);},deactivate:()=>{n("current",{state:"idle"}),n("wasActivatedByToggle",false),n("pendingCommentMode",false),n("inputText",""),n("frozenElement",null),n("frozenElements",[]),n("frozenDragRect",null),n("pendingClickData",null),n("replySessionId",null),n("pendingAbortSessionId",null),n("activationTimestamp",null),n("previouslyFocusedElement",null),n("contextMenuPosition",null),n("contextMenuElement",null),n("contextMenuClickOffset",null),n("selectedAgent",null);},toggle:()=>{t.activationTimestamp!==null?l.deactivate():(n("wasActivatedByToggle",true),l.activate());},freeze:()=>{if(t.current.state==="active"){let s=t.frozenElement??t.detectedElement;s&&n("frozenElement",s),n("current",Je(f=>{f.state==="active"&&(f.phase="frozen");}));}},unfreeze:()=>{t.current.state==="active"&&(n("frozenElement",null),n("frozenElements",[]),n("frozenDragRect",null),n("current",Je(s=>{s.state==="active"&&(s.phase="hovering");})));},startDrag:s=>{t.current.state==="active"&&(l.clearFrozenElement(),n("dragStart",{x:s.x+window.scrollX,y:s.y+window.scrollY}),n("current",Je(f=>{f.state==="active"&&(f.phase="dragging");})));},endDrag:()=>{t.current.state==="active"&&t.current.phase==="dragging"&&(n("dragStart",{x:-1e3,y:-1e3}),n("current",Je(s=>{s.state==="active"&&(s.phase="justDragged");})));},cancelDrag:()=>{t.current.state==="active"&&t.current.phase==="dragging"&&(n("dragStart",{x:-1e3,y:-1e3}),n("current",Je(s=>{s.state==="active"&&(s.phase="hovering");})));},finishJustDragged:()=>{t.current.state==="active"&&t.current.phase==="justDragged"&&n("current",Je(s=>{s.state==="active"&&(s.phase="hovering");}));},startCopy:()=>{let s=t.current.state==="active";n("current",{state:"copying",startedAt:Date.now(),wasActive:s});},completeCopy:s=>{n("pendingClickData",null),s&&n("lastCopiedElement",s);let f=t.current.state==="copying"?t.current.wasActive:false;n("current",{state:"justCopied",copiedAt:Date.now(),wasActive:f});},finishJustCopied:()=>{t.current.state==="justCopied"&&(t.current.wasActive&&!t.wasActivatedByToggle?n("current",{state:"active",phase:"hovering",isPromptMode:false,isPendingDismiss:false}):l.deactivate());},enterPromptMode:(s,f)=>{let i=me(f),u=i.x+i.width/2;n("copyStart",s),n("copyOffsetFromCenterX",s.x-u),n("pointer",s),n("frozenElement",f),n("wasActivatedByToggle",true),t.current.state!=="active"?(n("current",{state:"active",phase:"frozen",isPromptMode:true,isPendingDismiss:false}),n("activationTimestamp",Date.now()),n("previouslyFocusedElement",document.activeElement)):n("current",Je(g=>{g.state==="active"&&(g.isPromptMode=true,g.phase="frozen");}));},exitPromptMode:()=>{t.current.state==="active"&&n("current",Je(s=>{s.state==="active"&&(s.isPromptMode=false,s.isPendingDismiss=false);}));},setInputText:s=>{n("inputText",s);},clearInputText:()=>{n("inputText","");},setPendingDismiss:s=>{t.current.state==="active"&&n("current",Je(f=>{f.state==="active"&&(f.isPendingDismiss=s);}));},setPointer:s=>{n("pointer",s);},setDetectedElement:s=>{n("detectedElement",s);},setFrozenElement:s=>{n("frozenElement",s),n("frozenElements",[s]),n("frozenDragRect",null);},setFrozenElements:s=>{n("frozenElements",s),n("frozenElement",s.length>0?s[0]:null),n("frozenDragRect",null);},setFrozenDragRect:s=>{n("frozenDragRect",s);},clearFrozenElement:()=>{n("frozenElement",null),n("frozenElements",[]),n("frozenDragRect",null);},setCopyStart:(s,f)=>{let i=me(f),u=i.x+i.width/2;n("copyStart",s),n("copyOffsetFromCenterX",s.x-u);},setLastGrabbed:s=>{n("lastGrabbedElement",s);},setLastCopied:s=>{n("lastCopiedElement",s);},clearLastCopied:()=>{n("lastCopiedElement",null);},setWasActivatedByToggle:s=>{n("wasActivatedByToggle",s);},setPendingCommentMode:s=>{n("pendingCommentMode",s);},setTouchMode:s=>{n("isTouchMode",s);},setSelectionSource:(s,f)=>{n("selectionFilePath",s),n("selectionLineNumber",f);},clearSelectionSource:()=>{n("selectionFilePath",null),n("selectionLineNumber",null);},setPendingClickData:s=>{n("pendingClickData",s);},clearPendingClickData:()=>{n("pendingClickData",null);},setReplySessionId:s=>{n("replySessionId",s);},clearReplySessionId:()=>{n("replySessionId",null);},incrementViewportVersion:()=>{n("viewportVersion",s=>s+1);},addGrabbedBox:s=>{n("grabbedBoxes",f=>[...f,s]);},removeGrabbedBox:s=>{n("grabbedBoxes",f=>f.filter(i=>i.id!==s));},clearGrabbedBoxes:()=>{n("grabbedBoxes",[]);},addLabelInstance:s=>{n("labelInstances",f=>[...f,s]);},updateLabelInstance:(s,f,i)=>{let u=t.labelInstances.findIndex(g=>g.id===s);u!==-1&&n("labelInstances",u,Je(g=>{g.status=f,i!==void 0&&(g.errorMessage=i);}));},removeLabelInstance:s=>{n("labelInstances",f=>f.filter(i=>i.id!==s));},removeLabelsForElement:s=>{n("labelInstances",f=>f.filter(i=>i.element!==s));},clearLabelInstances:()=>{n("labelInstances",[]);},setHasAgentProvider:s=>{n("hasAgentProvider",s);},setUndoRedoState:(s,f)=>{n("canUndo",s),n("canRedo",f);},setAgentCapabilities:s=>{n("supportsUndo",s.supportsUndo),n("supportsFollowUp",s.supportsFollowUp),n("dismissButtonText",s.dismissButtonText),n("isAgentConnected",s.isAgentConnected);},setPendingAbortSessionId:s=>{n("pendingAbortSessionId",s);},updateSessionBounds:()=>{let s=t.agentSessions;if(s.size===0)return;let f=new Map(s),i=false;for(let[u,g]of s){let T=t.sessionElements.get(u);if(T&&document.contains(T)){let I=me(T),C=g.selectionBounds[0],z=g.position;if(C){let B=C.x+C.width/2,b=C.width/2,h=g.position.x-B,F=b>0?h/b:0,X=I.x+I.width/2,pe=I.width/2;z={...g.position,x:X+F*pe};}f.set(u,{...g,selectionBounds:[I],position:z}),i=true;}}i&&n("agentSessions",f);},addAgentSession:(s,f,i)=>{let u=new Map(t.agentSessions);u.set(s,f),n("agentSessions",u);let g=new Map(t.sessionElements);g.set(s,i),n("sessionElements",g);},updateAgentSessionStatus:(s,f)=>{let i=t.agentSessions.get(s);if(!i)return;let u=new Map(t.agentSessions);u.set(s,{...i,lastStatus:f}),n("agentSessions",u);},completeAgentSession:(s,f)=>{let i=t.agentSessions.get(s);if(!i)return;let u=new Map(t.agentSessions);u.set(s,{...i,isStreaming:false,lastStatus:f??i.lastStatus}),n("agentSessions",u);},setAgentSessionError:(s,f)=>{let i=t.agentSessions.get(s);if(!i)return;let u=new Map(t.agentSessions);u.set(s,{...i,isStreaming:false,error:f}),n("agentSessions",u);},removeAgentSession:s=>{let f=new Map(t.agentSessions);f.delete(s),n("agentSessions",f);let i=new Map(t.sessionElements);i.delete(s),n("sessionElements",i);},showContextMenu:(s,f)=>{let i=me(f),u=i.x+i.width/2,g=i.y+i.height/2;n("contextMenuPosition",s),n("contextMenuElement",f),n("contextMenuClickOffset",{x:s.x-u,y:s.y-g});},hideContextMenu:()=>{n("contextMenuPosition",null),n("contextMenuElement",null),n("contextMenuClickOffset",null);},updateContextMenuPosition:()=>{let s=t.contextMenuElement,f=t.contextMenuClickOffset;if(!s||!f||!document.contains(s))return;let i=me(s),u=i.x+i.width/2,g=i.y+i.height/2;n("contextMenuPosition",{x:u+f.x,y:g+f.y});},setSelectedAgent:s=>{n("selectedAgent",s);},clearSelectedAgent:()=>{n("selectedAgent",null);}};return {store:t,setStore:n,actions:l,isActive:r,isHolding:a}};var nn="data-react-grab",ni="react-grab-fonts",Al="https://fonts.googleapis.com/css2?family=Geist:wght@500&display=swap",Pl=()=>{if(document.getElementById(ni)||!document.head)return;let e=document.createElement("link");e.id=ni,e.rel="stylesheet",e.href=Al,document.head.appendChild(e);},oi=e=>{Pl();let t=document.querySelector(`[${nn}]`);if(t){let s=t.shadowRoot?.querySelector(`[${nn}]`);if(s instanceof HTMLDivElement&&t.shadowRoot)return s}let n=document.createElement("div");n.setAttribute(nn,"true"),n.style.zIndex="2147483646",n.style.position="fixed",n.style.top="0",n.style.left="0";let r=n.attachShadow({mode:"open"});if(e){let s=document.createElement("style");s.textContent=e,r.appendChild(s);}let a=document.createElement("div");a.setAttribute(nn,"true"),r.appendChild(a);let l=document.body??document.documentElement;return l.appendChild(n),setTimeout(()=>{l.contains(n)||l.appendChild(n);},chunkGJYSUTIS_cjs.va),a};var Ml="https://react-grab.com",on=(e,t)=>{let n=t?`&line=${t}`:"";return `${Ml}/open-file?url=${encodeURIComponent(e)}${n}`};var rn=(e,t,n)=>e+(t-e)*n;var Rl=chunkGJYSUTIS_cjs.u("<canvas data-react-grab-overlay-canvas style=position:fixed;top:0;left:0;pointer-events:none>"),ht={drag:{borderColor:chunkGJYSUTIS_cjs.H,fillColor:chunkGJYSUTIS_cjs.I,lerpFactor:.7},selection:{borderColor:chunkGJYSUTIS_cjs.J,fillColor:chunkGJYSUTIS_cjs.K,lerpFactor:.95},grabbed:{borderColor:chunkGJYSUTIS_cjs.J,fillColor:chunkGJYSUTIS_cjs.K,lerpFactor:.95},processing:{borderColor:chunkGJYSUTIS_cjs.J,fillColor:chunkGJYSUTIS_cjs.K,lerpFactor:.95}},ii=e=>{let t,n=null,r=0,a=0,l=1,s=null,f={crosshair:{canvas:null,context:null},drag:{canvas:null,context:null},selection:{canvas:null,context:null},grabbed:{canvas:null,context:null},processing:{canvas:null,context:null}},i={x:0,y:0},u=[],g=null,T=[],I=[],C=(m,y,v)=>{let R=new OffscreenCanvas(m*v,y*v),p=R.getContext("2d");return p&&p.scale(v,v),{canvas:R,context:p}},z=()=>{if(t){l=Math.max(window.devicePixelRatio||1,2),r=window.innerWidth,a=window.innerHeight,t.width=r*l,t.height=a*l,t.style.width=`${r}px`,t.style.height=`${a}px`,n=t.getContext("2d"),n&&n.scale(l,l);for(let m of Object.keys(f))f[m]=C(r,a,l);}},B=m=>{if(!m)return 0;let y=m.match(/^(\d+(?:\.\d+)?)/);return y?parseFloat(y[1]):0},b=(m,y,v)=>({id:m,current:{x:y.x,y:y.y,width:y.width,height:y.height},target:{x:y.x,y:y.y,width:y.width,height:y.height},borderRadius:B(y.borderRadius),opacity:v?.opacity??1,targetOpacity:v?.targetOpacity??v?.opacity??1,createdAt:v?.createdAt,isInitialized:true}),h=(m,y,v)=>{m.target={x:y.x,y:y.y,width:y.width,height:y.height},m.borderRadius=B(y.borderRadius),v!==void 0&&(m.targetOpacity=v);},F=m=>m.boundsMultiple??[m.bounds],X=(m,y,v,R,p,P,k,A,N=1)=>{if(R<=0||p<=0)return;let _=Math.min(R/2,p/2),D=Math.min(P,_);m.globalAlpha=N,m.beginPath(),D>0?m.roundRect(y,v,R,p,D):m.rect(y,v,R,p),m.fillStyle=k,m.fill(),m.strokeStyle=A,m.lineWidth=1,m.stroke(),m.globalAlpha=1;},pe=()=>{let m=f.crosshair;if(!m.context)return;let y=m.context;y.clearRect(0,0,r,a),e.crosshairVisible&&(y.strokeStyle=chunkGJYSUTIS_cjs.G,y.lineWidth=1,y.beginPath(),y.moveTo(i.x,0),y.lineTo(i.x,a),y.moveTo(0,i.y),y.lineTo(r,i.y),y.stroke());},ie=()=>{let m=f.drag;if(!m.context)return;let y=m.context;if(y.clearRect(0,0,r,a),!e.dragVisible||!g)return;let v=ht.drag;X(y,g.current.x,g.current.y,g.current.width,g.current.height,g.borderRadius,v.fillColor,v.borderColor);},Oe=()=>{let m=f.selection;if(!m.context)return;let y=m.context;if(y.clearRect(0,0,r,a),!e.selectionVisible)return;let v=ht.selection;for(let R of u){let p=e.selectionIsFading?0:R.opacity;X(y,R.current.x,R.current.y,R.current.width,R.current.height,R.borderRadius,v.fillColor,v.borderColor,p);}},Qe=()=>{let m=f.grabbed;if(!m.context)return;let y=m.context;y.clearRect(0,0,r,a);let v=ht.grabbed;for(let R of T)X(y,R.current.x,R.current.y,R.current.width,R.current.height,R.borderRadius,v.fillColor,v.borderColor,R.opacity);},et=()=>{let m=f.processing;if(!m.context)return;let y=m.context;y.clearRect(0,0,r,a);let v=ht.processing;for(let R of I)X(y,R.current.x,R.current.y,R.current.width,R.current.height,R.borderRadius,v.fillColor,v.borderColor,R.opacity);},He=()=>{if(!n||!t)return;n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.setTransform(l,0,0,l,0,0),pe(),ie(),Oe(),Qe(),et();let m=["crosshair","drag","selection","grabbed","processing"];for(let y of m){let v=f[y];v.canvas&&n.drawImage(v.canvas,0,0,r,a);}},Ie=(m,y,v)=>{let R=rn(m.current.x,m.target.x,y),p=rn(m.current.y,m.target.y,y),P=rn(m.current.width,m.target.width,y),k=rn(m.current.height,m.target.height,y),A=Math.abs(R-m.target.x)<.5&&Math.abs(p-m.target.y)<.5&&Math.abs(P-m.target.width)<.5&&Math.abs(k-m.target.height)<.5;m.current.x=A?m.target.x:R,m.current.y=A?m.target.y:p,m.current.width=A?m.target.width:P,m.current.height=A?m.target.height:k;let N=true;if(v?.interpolateOpacity){let _=rn(m.opacity,m.targetOpacity,y);N=Math.abs(_-m.targetOpacity)<.01,m.opacity=N?m.targetOpacity:_;}return !A||!N},H=()=>{let m=false;g?.isInitialized&&Ie(g,ht.drag.lerpFactor)&&(m=true);for(let v of u)v.isInitialized&&Ie(v,ht.selection.lerpFactor)&&(m=true);let y=Date.now();T=T.filter(v=>{let R=v.id.startsWith("label-");if(v.isInitialized&&Ie(v,ht.grabbed.lerpFactor,{interpolateOpacity:R})&&(m=true),v.createdAt){let p=y-v.createdAt,P=1600;if(p>=P)return false;if(p>1500){let k=(p-1500)/100;v.opacity=1-k,m=true;}return true}return R?!(Math.abs(v.opacity-v.targetOpacity)<.01&&v.targetOpacity===0):v.opacity>0});for(let v of I)v.isInitialized&&Ie(v,ht.processing.lerpFactor)&&(m=true);He(),m?s=requestAnimationFrame(H):s=null;},M=()=>{s===null&&(s=requestAnimationFrame(H));},S=()=>{z(),M();};return chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[e.mouseX,e.mouseY],([m,y])=>{let v=m??0,R=y??0;i.x=v,i.y=R,M();})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>e.crosshairVisible,()=>{M();})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[e.selectionVisible,e.selectionBounds,e.selectionBoundsMultiple,e.selectionIsFading,e.selectionShouldSnap],([m,y,v,,R])=>{if(!m||!y&&(!v||v.length===0)){u=[],M();return}u=(v&&v.length>0?v:y?[y]:[]).map((P,k)=>{let A=`selection-${k}`,N=u.find(_=>_.id===A);return N?(h(N,P),R&&(N.current={...N.target}),N):b(A,P)}),M();})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[e.dragVisible,e.dragBounds],([m,y])=>{if(!m||!y){g=null,M();return}g?h(g,y):g=b("drag",y),M();})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>e.grabbedBoxes,m=>{let y=m??[],v=new Set(y.map(p=>p.id)),R=new Set(T.map(p=>p.id));for(let p of y)R.has(p.id)||T.push(b(p.id,p.bounds,{createdAt:p.createdAt}));for(let p of T){let P=y.find(k=>k.id===p.id);P&&h(p,P.bounds);}T=T.filter(p=>p.id.startsWith("label-")?true:v.has(p.id)),M();})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>e.agentSessions,m=>{if(!m||m.size===0){I=[],M();return}let y=[];for(let[v,R]of m)for(let p=0;p<R.selectionBounds.length;p++){let P=R.selectionBounds[p],k=`processing-${v}-${p}`,A=I.find(N=>N.id===k);A?(h(A,P),y.push(A)):y.push(b(k,P));}I=y,M();})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>e.labelInstances,m=>{let y=m??[];for(let R of y){let p=F(R),P=R.status==="fading"?0:1;for(let k=0;k<p.length;k++){let A=p[k],N=`label-${R.id}-${k}`,_=T.find(D=>D.id===N);_?h(_,A,P):T.push(b(N,A,{opacity:1,targetOpacity:P}));}}let v=new Set;for(let R of y){let p=F(R);for(let P=0;P<p.length;P++)v.add(`label-${R.id}-${P}`);}T=T.filter(R=>R.id.startsWith("label-")?v.has(R.id):true),M();})),chunkGJYSUTIS_cjs.k(()=>{z(),M(),window.addEventListener("resize",S);let m=null,y=()=>{Math.max(window.devicePixelRatio||1,2)!==l&&(S(),v());},v=()=>{m&&m.removeEventListener("change",y),m=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),m.addEventListener("change",y);};v(),chunkGJYSUTIS_cjs.l(()=>{window.removeEventListener("resize",S),m&&m.removeEventListener("change",y),s!==null&&cancelAnimationFrame(s);});}),(()=>{var m=Rl(),y=t;return typeof y=="function"?chunkGJYSUTIS_cjs.C(y,m):t=m,chunkGJYSUTIS_cjs.e(v=>chunkGJYSUTIS_cjs.A(m,"z-index",String(2147483645))),m})()};var ai="react-grab-toolbar-state",It=()=>{try{let e=localStorage.getItem(ai);if(!e)return null;let t=JSON.parse(e);return {edge:t.edge??"bottom",ratio:t.ratio??.5,collapsed:t.collapsed??!1,enabled:t.enabled??!0}}catch(e){console.warn("[react-grab] Failed to load toolbar state from localStorage:",e);}return null},Tn=e=>{try{localStorage.setItem(ai,JSON.stringify(e));}catch(t){console.warn("[react-grab] Failed to save toolbar state to localStorage:",t);}};var ui="0.5.28",no=`bippy-${ui}`,li=Object.defineProperty,_l=Object.prototype.hasOwnProperty,An=()=>{},di=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{}},oo=(e=Ge())=>"getFiberRoots"in e,fi=false,ci,Pn=(e=Ge())=>fi?true:(typeof e.inject=="function"&&(ci=e.inject.toString()),!!ci?.includes("(injected)")),eo=new Set,kt=new Set,mi=e=>{let t=new Map,n=0,r={_instrumentationIsActive:false,_instrumentationSource:no,checkDCE:di,hasUnsupportedRendererAttached:false,inject(a){let l=++n;return t.set(l,a),kt.add(a),r._instrumentationIsActive||(r._instrumentationIsActive=true,eo.forEach(s=>s())),l},on:An,onCommitFiberRoot:An,onCommitFiberUnmount:An,onPostCommitFiberRoot:An,renderers:t,supportsFiber:true,supportsFlight:true};try{li(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:!0,get(){return r},set(s){if(s&&typeof s=="object"){let f=r.renderers;r=s,f.size>0&&(f.forEach((i,u)=>{kt.add(i),s.renderers.set(u,i);}),to(e));}}});let a=window.hasOwnProperty,l=!1;li(window,"hasOwnProperty",{configurable:!0,value:function(...s){try{if(!l&&s[0]==="__REACT_DEVTOOLS_GLOBAL_HOOK__")return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,l=!0,-0}catch{}return a.apply(this,s)},writable:!0});}catch{to(e);}return r},to=e=>{try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=di,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=no,t._instrumentationIsActive=!1;let n=oo(t);if(n||(t.on=An),t.renderers.size){t._instrumentationIsActive=!0,eo.forEach(l=>l());return}let r=t.inject,a=Pn(t);a&&!n&&(fi=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=l=>{let s=r(l);return kt.add(l),a&&t.renderers.set(s,l),t._instrumentationIsActive=!0,eo.forEach(f=>f()),s};}(t.renderers.size||t._instrumentationIsActive||Pn())&&e?.();}catch{}},br=()=>_l.call(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__"),Ge=e=>br()?(to(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):mi(e),pi=()=>!!(typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")),yr=()=>{try{pi()&&Ge();}catch{}};yr();var ro=0,so=1;var Sr=5;var io=11,wr=13,gi=14,ao=15,Er=16;var vr=19;var Cr=26,xr=27,Tr=28,Ar=30;var sn=e=>{switch(e.tag){case so:case io:case ro:case gi:case ao:return true;default:return false}};function Mn(e,t,n=false){if(!e)return null;let r=t(e);if(r instanceof Promise)return (async()=>{if(await r===true)return e;let l=n?e.return:e.child;for(;l;){let s=await Mr(l,t,n);if(s)return s;l=n?null:l.sibling;}return null})();if(r===true)return e;let a=n?e.return:e.child;for(;a;){let l=Pr(a,t,n);if(l)return l;a=n?null:a.sibling;}return null}var Pr=(e,t,n=false)=>{if(!e)return null;if(t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let a=Pr(r,t,n);if(a)return a;r=n?null:r.sibling;}return null},Mr=async(e,t,n=false)=>{if(!e)return null;if(await t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let a=await Mr(r,t,n);if(a)return a;r=n?null:r.sibling;}return null};var Or=e=>{let t=e;return typeof t=="function"?t:typeof t=="object"&&t?Or(t.type||t.render):null},bt=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=Or(t);return r&&(r.displayName||r.name)||null};var Ft=()=>!!Ge()._instrumentationIsActive||oo()||Pn();var Lt=e=>{let t=Ge();for(let n of t.renderers.values())try{let r=n.findFiberByHostInstance?.(e);if(r)return r}catch{}if(typeof e=="object"&&e){if("_reactRootContainer"in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let n in e)if(n.startsWith("__reactContainer$")||n.startsWith("__reactInternalInstance$")||n.startsWith("__reactFiber"))return e[n]||null}return null},Rr=new Set;var Me=false,_r=(e,t,n)=>{let r=e.get(t);if(r)return r;let a=n();return e.set(t,a),a},hi=new WeakMap,bi=new WeakMap,$l=new WeakMap,Nr=new Set,Ir=[],lo=[],co=new WeakMap,uo=new WeakMap,yi=new WeakSet,Si=Rr,zl=e=>{let t=e;for(;t.return;)t=t.return;return t.stateNode??null},wi=()=>{if(Si.size>0)return Si;let e=new Set,t=n=>{let r=Lt(n);if(r){let a=zl(r);a&&e.add(a);return}for(let a of Array.from(n.children))if(t(a),e.size>0)return};return t(document.body),e},Vl=(e,t)=>{if(!e)return t;if(!t)return e;if(!e.next||!t.next)return t;let n=e.next,r=t.next,a=e===n,l=t===r;return a&&l?(e.next=t,t.next=e):a?(e.next=r,t.next=e):l?(t.next=n,e.next=t):(e.next=r,t.next=n),t},Kl=e=>{if(!e||co.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=()=>Me?t.snapshotValueAtPause:t.originalGetSnapshot());let n=t.pendingValueAtPause;Object.defineProperty(e,"pending",{configurable:true,enumerable:true,get:()=>Me?t.bufferedPending:n,set:r=>{Me&&(t.bufferedPending=r),n=r;}}),co.set(e,t);},Ul=e=>{let t=co.get(e);if(!t)return;t.originalGetSnapshot&&(e.getSnapshot=t.originalGetSnapshot);let n=Vl(t.pendingValueAtPause??null,t.bufferedPending??null);t.originalPendingDescriptor?Object.defineProperty(e,"pending",t.originalPendingDescriptor):delete e.pending,e.pending=n,co.delete(e);},jl=e=>{if(uo.has(e))return;let t={originalDescriptor:Object.getOwnPropertyDescriptor(e,"memoizedValue"),frozenValue:e.memoizedValue};Object.defineProperty(e,"memoizedValue",{configurable:true,enumerable:true,get(){return Me?t.frozenValue:t.originalDescriptor?.get?t.originalDescriptor.get.call(this):this._memoizedValue},set(n){if(Me){t.pendingValue=n,t.didReceivePendingValue=true;return}t.originalDescriptor?.set?t.originalDescriptor.set.call(this,n):this._memoizedValue=n;}}),t.originalDescriptor?.get||(e._memoizedValue=t.frozenValue),uo.set(e,t);},Gl=e=>{let t=uo.get(e);t&&(t.originalDescriptor?Object.defineProperty(e,"memoizedValue",t.originalDescriptor):delete e.memoizedValue,t.didReceivePendingValue&&(e.memoizedValue=t.pendingValue),uo.delete(e));},Ei=(e,t)=>{let n=e.memoizedState;for(;n;)n.queue&&typeof n.queue=="object"&&t(n.queue),n=n.next;},vi=(e,t)=>{let n=e.dependencies?.firstContext;for(;n&&typeof n=="object"&&"memoizedValue"in n;)t(n),n=n.next;},fo=(e,t)=>{e&&(sn(e)&&t(e),fo(e.child,t),fo(e.sibling,t));},Wl=e=>{Ei(e,Kl),vi(e,jl);},Yl=e=>{Ei(e,Ul),vi(e,Gl);},Xl=e=>{if(hi.has(e))return;let t=e,n={useState:t.useState,useReducer:t.useReducer,useTransition:t.useTransition,useSyncExternalStore:t.useSyncExternalStore};hi.set(e,n),t.useState=(...r)=>{let a=n.useState.apply(e,r);if(!Me||!Array.isArray(a)||typeof a[1]!="function")return a;let[l,s]=a,f=_r(bi,s,()=>(...i)=>{Me?lo.push(()=>s(...i)):s(...i);});return [l,f]},t.useReducer=(...r)=>{let a=n.useReducer.apply(e,r);if(!Me||!Array.isArray(a)||typeof a[1]!="function")return a;let[l,s]=a,f=_r(bi,s,()=>(...i)=>{Me?lo.push(()=>s(...i)):s(...i);});return [l,f]},t.useTransition=(...r)=>{let a=n.useTransition.apply(e,r);if(!Me||!Array.isArray(a)||typeof a[1]!="function")return a;let[l,s]=a,f=_r($l,s,()=>i=>{Me?Ir.push(()=>s(i)):s(i);});return [l,f]},t.useSyncExternalStore=(r,a,l)=>{if(!Me)return n.useSyncExternalStore(r,a,l);let s=f=>r(()=>{Me?Nr.add(f):f();});return n.useSyncExternalStore(s,a,l)};},ql=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:true,enumerable:true,get:()=>(r&&typeof r=="object"&&Xl(r),r),set:a=>{r=a;}});},Zl=e=>{queueMicrotask(()=>{try{for(let t of Ge().renderers.values())if(typeof t.scheduleUpdate=="function"){for(let n of e)if(n.current)try{t.scheduleUpdate(n.current);}catch{}}}catch{}});},Dr=e=>{for(let t of e)try{t();}catch{}},Jl=()=>{for(let e of Ge().renderers.values())yi.has(e)||(ql(e),yi.add(e));},mo=()=>{if(Me)return ()=>{};Jl(),Me=true;let e=wi();for(let t of e)fo(t.current,Wl);return ()=>{if(Me)try{let t=wi();for(let l of t)fo(l.current,Yl);let n=Array.from(Nr),r=Ir.slice(),a=lo.slice();Me=!1,Dr(n),Dr(r),Dr(a),Zl(t);}finally{Nr.clear(),Ir.length=0,lo.length=0;}}};var Bt=(e,t)=>{let n=document.createElement("style");return n.setAttribute(e,""),n.textContent=t,document.head.appendChild(n),n};var Ql=`
10
+ [${chunkGJYSUTIS_cjs.W}],
11
+ [${chunkGJYSUTIS_cjs.W}] * {
12
+ animation-play-state: paused !important;
13
+ transition: none !important;
14
+ }
15
+ `,ec=`
16
+ *, *::before, *::after {
17
+ animation-play-state: paused !important;
18
+ transition: none !important;
19
+ }
20
+ `,Ci=null,On=[],kr=[],po=null,tc=()=>{Ci||(Ci=Bt("data-react-grab-frozen-styles",Ql));},nc=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]),Rn=e=>{if(e.length!==0&&!nc(e,kr)){kr=[...e],Fr(),tc(),On=e;for(let t of On)t.setAttribute(chunkGJYSUTIS_cjs.W,"");}},Fr=()=>{if(On.length!==0){for(let e of On)e.removeAttribute(chunkGJYSUTIS_cjs.W);On=[],kr=[];}},xi=e=>e.length===0?(Fr(),()=>{}):(Rn(e),Fr),go=()=>{po||(po=Bt("data-react-grab-global-freeze",ec));},ho=()=>{po?.remove(),po=null;};var Ti=(e,t=window.getComputedStyle(e))=>t.display!=="none"&&t.visibility!=="hidden"&&t.opacity!=="0";var oc=`[${nn}], [${chunkGJYSUTIS_cjs.X}]`,Lr=new WeakMap,Ai=()=>{Lr=new WeakMap;},yt=e=>{if(e.closest(oc))return false;let t=performance.now(),n=Lr.get(e);if(n&&t-n.timestamp<chunkGJYSUTIS_cjs.ta)return n.isVisible;let r=window.getComputedStyle(e),a=Ti(e,r);return Lr.set(e,{isVisible:a,timestamp:t}),a};var Ht=null,rc=(e,t,n,r)=>{let a=Math.abs(e-n),l=Math.abs(t-r);return a<=chunkGJYSUTIS_cjs.ra&&l<=chunkGJYSUTIS_cjs.ra},Br=(e,t)=>document.elementsFromPoint(e,t),an=(e,t)=>{let n=performance.now();if(Ht){let l=rc(e,t,Ht.clientX,Ht.clientY),s=n-Ht.timestamp<chunkGJYSUTIS_cjs.sa;if(l||s)return Ht.element}let r=Br(e,t),a=null;for(let l of r)if(yt(l)){a=l;break}return Ht={clientX:e,clientY:t,element:a,timestamp:n},a},bo=()=>{Ht=null;};var yo=null,So=()=>{yo||(yo=Bt("data-react-grab-pointer-override","* { pointer-events: auto !important; }"));},wo=()=>{yo?.remove(),yo=null;};var sc="* { pointer-events: none !important; }",Oi=["mouseenter","mouseleave","mouseover","mouseout","pointerenter","pointerleave","pointerover","pointerout"],Ri=["focus","blur","focusin","focusout"],_i=["background-color","color","border-color","box-shadow","transform","opacity","outline","filter","scale","visibility"],Di=["background-color","color","border-color","box-shadow","outline","outline-offset","outline-width","outline-color","outline-style","filter","opacity","ring-color","ring-width"],ic=["opacity","transform","scale","translate","rotate"],Ni=new Map,Hr=new Map,Eo=null,Ii=e=>{e.stopPropagation(),e.stopImmediatePropagation();},ki=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();},ac=e=>{let t=e.toLowerCase();return ic.some(n=>t.includes(n))},lc=()=>{let e=[];for(let t of document.querySelectorAll(":hover")){if(!(t instanceof HTMLElement))continue;let n=t.style.cssText,r=getComputedStyle(t),a=n;for(let l of _i){let s=r.getPropertyValue(l);s&&(a+=`${l}: ${s} !important; `);}e.push({element:t,originalCssText:n,frozenStyles:a});}return e},cc=()=>{let e=[];for(let t of document.querySelectorAll(":focus, :focus-visible")){if(!(t instanceof HTMLElement)||Hr.has(t))continue;let n=t.style.cssText,r=getComputedStyle(t),a=n;for(let l of Di){let s=r.getPropertyValue(l);s&&(a+=`${l}: ${s} !important; `);}e.push({element:t,originalCssText:n,frozenStyles:a});}return e},Pi=(e,t)=>{for(let{element:n,originalCssText:r,frozenStyles:a}of e)t.set(n,r),n.style.cssText=a;},Mi=(e,t)=>{for(let[n,r]of e)if(ac(r))for(let a of t)n.style.removeProperty(a);else n.style.cssText=r;e.clear();},vo=()=>{if(Eo)return;for(let n of Oi)document.addEventListener(n,Ii,true);for(let n of Ri)document.addEventListener(n,ki,true);let e=lc(),t=cc();Pi(e,Ni),Pi(t,Hr),Eo=Bt("data-react-grab-frozen-pseudo",sc),So();},Co=()=>{wo(),bo();for(let e of Oi)document.removeEventListener(e,Ii,true);for(let e of Ri)document.removeEventListener(e,ki,true);Mi(Ni,_i),Mi(Hr,Di),Eo?.remove(),Eo=null;};var uc=chunkGJYSUTIS_cjs.u("<div style=z-index:2147483647>"),$r=0,dc=()=>Date.now()-$r<chunkGJYSUTIS_cjs.Z,xo=e=>{let[t,n]=chunkGJYSUTIS_cjs.d(false),[r,a]=chunkGJYSUTIS_cjs.d(true),l;return chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>e.visible,s=>{l!==void 0&&(clearTimeout(l),l=void 0),s?dc()?(a(false),n(true)):(a(true),l=setTimeout(()=>{n(true);},chunkGJYSUTIS_cjs.Y)):(t()&&($r=Date.now()),n(false));})),chunkGJYSUTIS_cjs.l(()=>{l!==void 0&&clearTimeout(l),t()&&($r=Date.now());}),chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.r,{get when(){return t()},get children(){var s=uc();return chunkGJYSUTIS_cjs.D(s,()=>e.children),chunkGJYSUTIS_cjs.e(()=>chunkGJYSUTIS_cjs.x(s,chunkGJYSUTIS_cjs.Ba("absolute left-1/2 -translate-x-1/2 whitespace-nowrap px-1.5 py-0.5 rounded-[10px] text-[10px] text-black/60 pointer-events-none [corner-shape:superellipse(1.25)]",chunkGJYSUTIS_cjs.wa,e.position==="top"?"bottom-full mb-2.5":"top-full mt-2.5",r()&&"animate-tooltip-fade-in"))),s}})};var fc=chunkGJYSUTIS_cjs.u("<div style=z-index:2147483647>Enable to continue"),mc=chunkGJYSUTIS_cjs.u('<div data-react-grab-ignore-events data-react-grab-toolbar style=z-index:2147483647><div><div><div class="flex items-center min-w-0"><div><div class="relative overflow-visible min-w-0"><button data-react-grab-ignore-events data-react-grab-toolbar-toggle class="contain-layout flex items-center justify-center cursor-pointer interactive-scale touch-hitbox mr-1.5"></button></div></div><div><div class="relative overflow-visible min-w-0"><button data-react-grab-ignore-events data-react-grab-toolbar-comment class="contain-layout flex items-center justify-center cursor-pointer interactive-scale touch-hitbox mr-1.5"></button></div></div><div class="relative shrink-0 overflow-visible"><button data-react-grab-ignore-events data-react-grab-toolbar-enabled class="contain-layout flex items-center justify-center cursor-pointer interactive-scale outline-none mx-0.5"><div><div></div></div></button></div></div></div><button data-react-grab-ignore-events data-react-grab-toolbar-collapse class="contain-layout shrink-0 flex items-center justify-center cursor-pointer interactive-scale">'),Fi=e=>{let t,n=null,[r,a]=chunkGJYSUTIS_cjs.d(false),[l,s]=chunkGJYSUTIS_cjs.d(false),[f,i]=chunkGJYSUTIS_cjs.d(false),[u,g]=chunkGJYSUTIS_cjs.d(false),[T,I]=chunkGJYSUTIS_cjs.d(false),[C,z]=chunkGJYSUTIS_cjs.d("bottom"),[B,b]=chunkGJYSUTIS_cjs.d(.5),[h,F]=chunkGJYSUTIS_cjs.d({x:0,y:0}),[X,pe]=chunkGJYSUTIS_cjs.d({x:0,y:0}),[ie,Oe]=chunkGJYSUTIS_cjs.d({x:0,y:0}),[Qe,et]=chunkGJYSUTIS_cjs.d(false),[He,Ie]=chunkGJYSUTIS_cjs.d(false),[H,M]=chunkGJYSUTIS_cjs.d(false),[S,m]=chunkGJYSUTIS_cjs.d(false),[y,v]=chunkGJYSUTIS_cjs.d(false),[R,p]=chunkGJYSUTIS_cjs.d(false),[P,k]=chunkGJYSUTIS_cjs.d(false),A=()=>C()==="top"?"bottom":"top",N=x=>{x.stopPropagation(),x.stopImmediatePropagation();},_=x=>({onMouseEnter:()=>{x(true),e.onSelectHoverChange?.(true),n||(n=mo(),go(),vo());},onMouseLeave:()=>{x(false),e.onSelectHoverChange?.(false),!e.isActive&&!e.isContextMenuOpen&&(n?.(),n=null,ho(),Co());}}),D=()=>{if(!l())return "";let x=C();return `${{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]"}[x]} ${x==="top"||x==="bottom"?"px-2 py-0.25":"px-0.25 py-2"}`},$;chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>e.shakeCount,x=>{x&&!e.enabled&&(Ie(true),k(true),$&&clearTimeout($),$=setTimeout(()=>{k(false);},chunkGJYSUTIS_cjs.ia));})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>e.enabled,x=>{x&&P()&&(k(false),$&&clearTimeout($));})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[e.isActive,e.isContextMenuOpen],([x,L])=>{!x&&!L&&n&&(n(),n=null);}));let V={x:0,y:0,time:0},G={x:0,y:0},W={width:chunkGJYSUTIS_cjs.ga,height:chunkGJYSUTIS_cjs.ha},ce={width:chunkGJYSUTIS_cjs.da,height:chunkGJYSUTIS_cjs.ea},Ce=(x,L,Y)=>Math.max(L,Math.min(x,Y)),ge=()=>{let x=window.visualViewport;return x?{width:x.width,height:x.height,offsetLeft:x.offsetLeft,offsetTop:x.offsetTop}:{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0}},ne=(x,L)=>{let Y=ge(),q=Y.width,U=Y.height,{width:Z,height:K}=W,ue=t?.getBoundingClientRect(),be=ue?.width??chunkGJYSUTIS_cjs.da,ye=ue?.height??chunkGJYSUTIS_cjs.ea,xe;if(L==="top"||L==="bottom"){let Ne=(Z-be)/2,ze=x.x-Ne,_e=Ce(ze,Y.offsetLeft+chunkGJYSUTIS_cjs._,Y.offsetLeft+q-Z-chunkGJYSUTIS_cjs._),Fe=L==="top"?Y.offsetTop+chunkGJYSUTIS_cjs._:Y.offsetTop+U-K-chunkGJYSUTIS_cjs._;xe={x:_e,y:Fe};}else {let Ne=(K-ye)/2,ze=x.y-Ne,_e=Ce(ze,Y.offsetTop+chunkGJYSUTIS_cjs._,Y.offsetTop+U-K-chunkGJYSUTIS_cjs._);xe={x:L==="left"?Y.offsetLeft+chunkGJYSUTIS_cjs._:Y.offsetLeft+q-Z-chunkGJYSUTIS_cjs._,y:_e};}let ke=he(L,xe.x,xe.y,Z,K);return {position:xe,ratio:ke}},le=(x,L,Y,q)=>{let U=ge(),Z=U.width,K=U.height,ue=U.offsetLeft+chunkGJYSUTIS_cjs._,be=Math.max(ue,U.offsetLeft+Z-Y-chunkGJYSUTIS_cjs._),ye=U.offsetTop+chunkGJYSUTIS_cjs._,xe=Math.max(ye,U.offsetTop+K-q-chunkGJYSUTIS_cjs._);if(x==="top"||x==="bottom"){let _e=Math.max(0,Z-Y-chunkGJYSUTIS_cjs._*2);return {x:Math.min(be,Math.max(ue,U.offsetLeft+chunkGJYSUTIS_cjs._+_e*L)),y:x==="top"?ye:xe}}let ke=Math.max(0,K-q-chunkGJYSUTIS_cjs._*2),Ne=Math.min(xe,Math.max(ye,U.offsetTop+chunkGJYSUTIS_cjs._+ke*L));return {x:x==="left"?ue:be,y:Ne}},he=(x,L,Y,q,U)=>{let Z=ge(),K=Z.width,ue=Z.height;if(x==="top"||x==="bottom"){let ye=K-q-chunkGJYSUTIS_cjs._*2;return ye<=0?.5:Math.max(0,Math.min(1,(L-Z.offsetLeft-chunkGJYSUTIS_cjs._)/ye))}let be=ue-U-chunkGJYSUTIS_cjs._*2;return be<=0?.5:Math.max(0,Math.min(1,(Y-Z.offsetTop-chunkGJYSUTIS_cjs._)/be))},De=()=>{let x=t?.getBoundingClientRect();if(!x)return;let L=le(C(),B(),x.width,x.height);F(L);},We=false,we=x=>L=>{if(L.stopPropagation(),L.stopImmediatePropagation(),We){We=false;return}x();},$e=we(()=>e.onToggle?.()),Kt=we(()=>e.onComment?.()),Ut=we(()=>{let x=t?.getBoundingClientRect(),L=l(),Y=B();if(L){let{position:q,ratio:U}=ne(Xe(),C());Y=U,F(q),b(Y);}else x&&(W={width:x.width,height:x.height});M(true),s(q=>!q),Wt({edge:C(),ratio:Y,collapsed:!L,enabled:e.enabled??true}),Re&&clearTimeout(Re),Re=setTimeout(()=>{if(M(false),l()){let q=t?.getBoundingClientRect();q&&(ce={width:q.width,height:q.height});}},chunkGJYSUTIS_cjs.fa);}),Ko=we(()=>e.onToggleEnabled?.()),mn=(x,L,Y,q,U,Z)=>{let K=ge(),ue=K.width,be=K.height,ye=x+U*chunkGJYSUTIS_cjs.ca,xe=L+Z*chunkGJYSUTIS_cjs.ca,ke=xe-K.offsetTop+q/2,Ne=K.offsetTop+be-xe-q/2,ze=ye-K.offsetLeft+Y/2,_e=K.offsetLeft+ue-ye-Y/2,Fe=Math.min(ke,Ne,ze,_e);return Fe===ke?{edge:"top",x:Math.max(K.offsetLeft+chunkGJYSUTIS_cjs._,Math.min(ye,K.offsetLeft+ue-Y-chunkGJYSUTIS_cjs._)),y:K.offsetTop+chunkGJYSUTIS_cjs._}:Fe===ze?{edge:"left",x:K.offsetLeft+chunkGJYSUTIS_cjs._,y:Math.max(K.offsetTop+chunkGJYSUTIS_cjs._,Math.min(xe,K.offsetTop+be-q-chunkGJYSUTIS_cjs._))}:Fe===_e?{edge:"right",x:K.offsetLeft+ue-Y-chunkGJYSUTIS_cjs._,y:Math.max(K.offsetTop+chunkGJYSUTIS_cjs._,Math.min(xe,K.offsetTop+be-q-chunkGJYSUTIS_cjs._))}:{edge:"bottom",x:Math.max(K.offsetLeft+chunkGJYSUTIS_cjs._,Math.min(ye,K.offsetLeft+ue-Y-chunkGJYSUTIS_cjs._)),y:K.offsetTop+be-q-chunkGJYSUTIS_cjs._}},At=x=>{if(!f()||(Math.sqrt(Math.pow(x.clientX-G.x,2)+Math.pow(x.clientY-G.y,2))>chunkGJYSUTIS_cjs.ba&&et(true),!Qe()))return;let Y=performance.now(),q=Y-V.time;if(q>0){let K=(x.clientX-V.x)/q,ue=(x.clientY-V.y)/q;Oe({x:K,y:ue});}V={x:x.clientX,y:x.clientY,time:Y};let U=x.clientX-X().x,Z=x.clientY-X().y;F({x:U,y:Z});},Ke=()=>{if(!f())return;window.removeEventListener("pointermove",At),window.removeEventListener("pointerup",Ke);let x=Qe();if(i(false),!x)return;We=true;let L=t?.getBoundingClientRect();if(!L)return;let Y=ie(),q=mn(h().x,h().y,L.width,L.height,Y.x,Y.y),U=he(q.edge,q.x,q.y,L.width,L.height);z(q.edge),b(U),g(true),requestAnimationFrame(()=>{requestAnimationFrame(()=>{F({x:q.x,y:q.y}),Wt({edge:q.edge,ratio:U,collapsed:l(),enabled:e.enabled??true}),Mt=setTimeout(()=>{g(false);},chunkGJYSUTIS_cjs.aa);});});},Ue=x=>{if(l())return;let L=t?.getBoundingClientRect();L&&(G={x:x.clientX,y:x.clientY},pe({x:x.clientX-L.left,y:x.clientY-L.top}),i(true),et(false),Oe({x:0,y:0}),V={x:x.clientX,y:x.clientY,time:performance.now()},window.addEventListener("pointermove",At),window.addEventListener("pointerup",Ke));},jt=()=>{let x=C(),L=h(),{width:Y,height:q}=W,{width:U,height:Z}=ce,K=ge();switch(x){case "top":case "bottom":{let ue=(Y-U)/2,be=L.x+ue;return {x:Ce(be,K.offsetLeft,K.offsetLeft+K.width-U),y:x==="top"?K.offsetTop:K.offsetTop+K.height-Z}}case "left":case "right":{let ue=(q-Z)/2,be=L.y+ue,ye=Ce(be,K.offsetTop,K.offsetTop+K.height-Z);return {x:x==="left"?K.offsetLeft:K.offsetLeft+K.width-U,y:ye}}default:return L}},Gt=()=>{let x=C(),L=l();switch(x){case "top":return L?"rotate-180":"rotate-0";case "bottom":return L?"rotate-0":"rotate-180";case "left":return L?"rotate-90":"-rotate-90";case "right":return L?"-rotate-90":"rotate-90";default:return "rotate-0"}},Pt,Re,Mt,Ye=()=>{f()||(I(true),De(),Pt&&clearTimeout(Pt),Pt=setTimeout(()=>{I(false);let x=t?.getBoundingClientRect();if(x){let L=he(C(),h().x,h().y,x.width,x.height);b(L),Wt({edge:C(),ratio:L,collapsed:l(),enabled:e.enabled??true});}},chunkGJYSUTIS_cjs.$));},Wt=x=>{Tn(x),e.onStateChange?.(x);};chunkGJYSUTIS_cjs.k(()=>{let x=It(),L=t?.getBoundingClientRect(),Y=ge();if(x){z(x.edge),b(x.ratio),s(x.collapsed),L&&(W={width:L.width,height:L.height});let U=le(x.edge,x.ratio,W.width,W.height);F(U),x.collapsed&&requestAnimationFrame(()=>{let Z=t?.getBoundingClientRect();Z&&(ce={width:Z.width,height:Z.height});});}else if(L)W={width:L.width,height:L.height},F({x:Y.offsetLeft+(Y.width-L.width)/2,y:Y.offsetTop+Y.height-L.height-chunkGJYSUTIS_cjs._}),b(.5);else {let U=le("bottom",.5,W.width,W.height);F(U);}if(e.onSubscribeToStateChanges){let U=e.onSubscribeToStateChanges(Z=>{if(H()||!t?.getBoundingClientRect())return;let ue=l()!==Z.collapsed;if(z(Z.edge),ue&&!Z.collapsed){let be=Xe();M(true),s(Z.collapsed);let{position:ye,ratio:xe}=ne(be,Z.edge);F(ye),b(xe),Re&&clearTimeout(Re),Re=setTimeout(()=>{M(false);},chunkGJYSUTIS_cjs.fa);}else {ue&&(M(true),Re&&clearTimeout(Re),Re=setTimeout(()=>{M(false);},chunkGJYSUTIS_cjs.fa)),s(Z.collapsed);let be=le(Z.edge,Z.ratio,W.width,W.height);F(be),b(Z.ratio);}});chunkGJYSUTIS_cjs.l(U);}window.addEventListener("resize",Ye),window.visualViewport?.addEventListener("resize",Ye),window.visualViewport?.addEventListener("scroll",Ye);let q=setTimeout(()=>{a(true);},chunkGJYSUTIS_cjs.$);chunkGJYSUTIS_cjs.l(()=>{clearTimeout(q);});}),chunkGJYSUTIS_cjs.l(()=>{window.removeEventListener("resize",Ye),window.visualViewport?.removeEventListener("resize",Ye),window.visualViewport?.removeEventListener("scroll",Ye),window.removeEventListener("pointermove",At),window.removeEventListener("pointerup",Ke),Pt&&clearTimeout(Pt),Re&&clearTimeout(Re),$&&clearTimeout($),Mt&&clearTimeout(Mt),n?.();});let Xe=()=>l()?jt():h(),Ln=()=>l()?"cursor-pointer":f()?"cursor-grabbing":"cursor-grab",Yt=()=>T()?"":u()?"transition-[transform,opacity] duration-300 ease-out":H()?"transition-[transform,opacity] duration-150 ease-out":"transition-opacity duration-300 ease-out",Bn=()=>{switch(C()){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 x=mc(),L=x.firstChild,Y=L.firstChild,q=Y.firstChild,U=q.firstChild,Z=U.firstChild,K=Z.firstChild,ue=U.nextSibling,be=ue.firstChild,ye=be.firstChild,xe=ue.nextSibling,ke=xe.firstChild,Ne=ke.firstChild,ze=Ne.firstChild,_e=Y.nextSibling;x.$$pointerdown=Ue;var Fe=t;return typeof Fe=="function"?chunkGJYSUTIS_cjs.C(Fe,x):t=x,L.$$click=re=>{if(l()){re.stopPropagation();let{position:dt,ratio:Le}=ne(Xe(),C());F(dt),b(Le),M(true),s(false),Wt({edge:C(),ratio:Le,collapsed:false,enabled:e.enabled??true}),Re&&clearTimeout(Re),Re=setTimeout(()=>{M(false);},chunkGJYSUTIS_cjs.fa);}},L.addEventListener("animationend",()=>Ie(false)),K.$$click=re=>{m(false),$e(re);},chunkGJYSUTIS_cjs.y(K,"mousedown",N),chunkGJYSUTIS_cjs.y(K,"pointerdown",N),chunkGJYSUTIS_cjs.B(K,chunkGJYSUTIS_cjs.o(()=>_(m)),false,true),chunkGJYSUTIS_cjs.D(K,chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.Fa,{size:14,get class(){return chunkGJYSUTIS_cjs.Ba("transition-colors",chunkGJYSUTIS_cjs.Ia(!!e.isActive&&!e.isCommentMode,!!e.isCommentMode))}})),chunkGJYSUTIS_cjs.D(Z,chunkGJYSUTIS_cjs.n(xo,{get visible(){return chunkGJYSUTIS_cjs.s(()=>!!S())()&&!l()},get position(){return A()},children:"Select"}),null),ye.$$click=re=>{v(false),Kt(re);},chunkGJYSUTIS_cjs.y(ye,"mousedown",N),chunkGJYSUTIS_cjs.y(ye,"pointerdown",N),chunkGJYSUTIS_cjs.B(ye,chunkGJYSUTIS_cjs.o(()=>_(v)),false,true),chunkGJYSUTIS_cjs.D(ye,chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.Ga,{size:14,get class(){return chunkGJYSUTIS_cjs.Ba("transition-colors",chunkGJYSUTIS_cjs.Ia(!!e.isCommentMode,!!e.isActive&&!e.isCommentMode))}})),chunkGJYSUTIS_cjs.D(be,chunkGJYSUTIS_cjs.n(xo,{get visible(){return chunkGJYSUTIS_cjs.s(()=>!!y())()&&!l()},get position(){return A()},children:"Comment"}),null),ke.addEventListener("mouseleave",()=>p(false)),ke.addEventListener("mouseenter",()=>p(true)),ke.$$click=re=>{p(false),Ko(re);},chunkGJYSUTIS_cjs.D(xe,chunkGJYSUTIS_cjs.n(xo,{get visible(){return chunkGJYSUTIS_cjs.s(()=>!!R())()&&!l()},get position(){return A()},get children(){return e.enabled?"Disable":"Enable"}}),null),chunkGJYSUTIS_cjs.y(_e,"click",Ut,true),chunkGJYSUTIS_cjs.D(_e,chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.Ha,{get class(){return chunkGJYSUTIS_cjs.Ba("text-[#B3B3B3] transition-transform duration-150",Gt())}})),chunkGJYSUTIS_cjs.D(L,chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.r,{get when(){return P()},get children(){var re=fc();return chunkGJYSUTIS_cjs.e(()=>chunkGJYSUTIS_cjs.x(re,chunkGJYSUTIS_cjs.Ba("absolute left-1/2 -translate-x-1/2 whitespace-nowrap px-1.5 py-0.5 rounded-[10px] text-[10px] text-black/60 pointer-events-none animate-tooltip-fade-in [corner-shape:superellipse(1.25)]",chunkGJYSUTIS_cjs.wa,A()==="top"?"bottom-full mb-0.5":"top-full mt-0.5"))),re}}),null),chunkGJYSUTIS_cjs.e(re=>{var dt=chunkGJYSUTIS_cjs.Ba("fixed left-0 top-0 font-sans text-[13px] antialiased filter-[drop-shadow(0px_1px_2px_#51515140)] select-none",Ln(),Yt(),r()?"opacity-100":"opacity-0 pointer-events-none"),Le=`translate(${Xe().x}px, ${Xe().y}px)`,Ot=Bn(),st=chunkGJYSUTIS_cjs.Ba("flex items-center justify-center rounded-[10px] antialiased transition-all duration-150 ease-out relative overflow-visible [font-synthesis:none] [corner-shape:superellipse(1.25)]",chunkGJYSUTIS_cjs.wa,!l()&&"py-1.5 gap-1.5 px-2",D(),He()&&"animate-shake"),de=Bn(),Rt=chunkGJYSUTIS_cjs.Ba("grid transition-all duration-150 ease-out",l()?"grid-cols-[0fr] opacity-0 pointer-events-none":"grid-cols-[1fr] opacity-100"),pn=chunkGJYSUTIS_cjs.Ba("grid transition-all duration-150 ease-out",e.enabled?"grid-cols-[1fr] opacity-100":"grid-cols-[0fr] opacity-0"),gn=chunkGJYSUTIS_cjs.Ba("grid transition-all duration-150 ease-out",e.enabled?"grid-cols-[1fr] opacity-100":"grid-cols-[0fr] opacity-0"),Xt=chunkGJYSUTIS_cjs.Ba("relative w-5 h-3 rounded-full transition-colors",e.enabled?"bg-black":"bg-black/25"),Se=chunkGJYSUTIS_cjs.Ba("absolute top-0.5 w-2 h-2 rounded-full bg-white transition-transform",e.enabled?"left-2.5":"left-0.5");return dt!==re.e&&chunkGJYSUTIS_cjs.x(x,re.e=dt),Le!==re.t&&chunkGJYSUTIS_cjs.A(x,"transform",re.t=Le),Ot!==re.a&&chunkGJYSUTIS_cjs.A(x,"transform-origin",re.a=Ot),st!==re.o&&chunkGJYSUTIS_cjs.x(L,re.o=st),de!==re.i&&chunkGJYSUTIS_cjs.A(L,"transform-origin",re.i=de),Rt!==re.n&&chunkGJYSUTIS_cjs.x(Y,re.n=Rt),pn!==re.s&&chunkGJYSUTIS_cjs.x(U,re.s=pn),gn!==re.h&&chunkGJYSUTIS_cjs.x(ue,re.h=gn),Xt!==re.r&&chunkGJYSUTIS_cjs.x(Ne,re.r=Xt),Se!==re.d&&chunkGJYSUTIS_cjs.x(ze,re.d=Se),re},{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}),x})()};chunkGJYSUTIS_cjs.v(["pointerdown","click"]);var pc=chunkGJYSUTIS_cjs.u('<div style="position:fixed;top:0;right:0;bottom:0;left:0;pointer-events:none;transition:opacity 100ms ease-out;will-change:opacity;contain:strict;transform:translateZ(0)">'),Li=e=>[chunkGJYSUTIS_cjs.n(ii,{get crosshairVisible(){return e.crosshairVisible},get mouseX(){return e.mouseX},get mouseY(){return e.mouseY},get selectionVisible(){return e.selectionVisible},get selectionBounds(){return e.selectionBounds},get selectionBoundsMultiple(){return e.selectionBoundsMultiple},get selectionShouldSnap(){return e.selectionShouldSnap},get selectionIsFading(){return e.selectionLabelStatus==="fading"},get dragVisible(){return e.dragVisible},get dragBounds(){return e.dragBounds},get grabbedBoxes(){return e.grabbedBoxes},get agentSessions(){return e.agentSessions},get labelInstances(){return e.labelInstances}}),(()=>{var t=pc();return chunkGJYSUTIS_cjs.A(t,"z-index",2147483645),chunkGJYSUTIS_cjs.A(t,"box-shadow",`inset 0 0 ${chunkGJYSUTIS_cjs.M}px ${chunkGJYSUTIS_cjs.L}`),chunkGJYSUTIS_cjs.e(n=>chunkGJYSUTIS_cjs.A(t,"opacity",e.isFrozen?1:0)),t})(),chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.q,{get each(){return chunkGJYSUTIS_cjs.s(()=>!!e.agentSessions)()?Array.from(e.agentSessions.values()):[]},children:t=>chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.r,{get when(){return t().selectionBounds.length>0},get children(){return chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.Ca,{get tagName(){return t().tagName},get componentName(){return t().componentName},get selectionBounds(){return t().selectionBounds[0]},get mouseX(){return t().position.x},visible:true,hasAgent:true,isAgentConnected:true,get status(){return t().isFading?"fading":t().isStreaming?"copying":"copied"},get statusText(){return t().lastStatus||"Thinking\u2026"},get inputValue(){return t().context.prompt},get previousPrompt(){return t().context.prompt},get supportsUndo(){return e.supportsUndo},get supportsFollowUp(){return e.supportsFollowUp},get dismissButtonText(){return e.dismissButtonText},onAbort:()=>e.onRequestAbortSession?.(t().id),get onDismiss(){return t().isStreaming?void 0:()=>e.onDismissSession?.(t().id)},get onUndo(){return t().isStreaming?void 0:()=>e.onUndoSession?.(t().id)},get onFollowUpSubmit(){return t().isStreaming?void 0:n=>e.onFollowUpSubmitSession?.(t().id,n)},get error(){return t().error},onAcknowledgeError:()=>e.onAcknowledgeSessionError?.(t().id),onRetry:()=>e.onRetrySession?.(t().id),get isPendingAbort(){return chunkGJYSUTIS_cjs.s(()=>!!t().isStreaming)()&&e.pendingAbortSessionId===t().id},onConfirmAbort:()=>e.onAbortSession?.(t().id,true),onCancelAbort:()=>e.onAbortSession?.(t().id,false),onShowContextMenu:void 0})}})}),chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.r,{get when(){return chunkGJYSUTIS_cjs.s(()=>!!e.selectionLabelVisible)()&&e.selectionBounds},get children(){return chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.Ca,{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 replyToPrompt(){return e.replyToPrompt},get hasAgent(){return e.hasAgent},get isAgentConnected(){return e.isAgentConnected},get status(){return e.selectionLabelStatus},get filePath(){return e.selectionFilePath},get lineNumber(){return e.selectionLineNumber},get onInputChange(){return e.onInputChange},get onSubmit(){return e.onInputSubmit},get onCancel(){return e.onInputCancel},get onToggleExpand(){return e.onToggleExpand},get isPendingDismiss(){return e.isPendingDismiss},get onConfirmDismiss(){return e.onConfirmDismiss},get onCancelDismiss(){return e.onCancelDismiss},onOpen:()=>{if(e.selectionFilePath){let t=on(e.selectionFilePath,e.selectionLineNumber);window.open(t,"_blank");}},get isContextMenuOpen(){return e.contextMenuPosition!==null}})}}),chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.q,{get each(){return e.labelInstances??[]},children:t=>chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.Ca,{get tagName(){return t().tagName},get componentName(){return t().componentName},get selectionBounds(){return t().bounds},get mouseX(){return t().mouseX},visible:true,get status(){return t().status},get error(){return t().errorMessage},get onShowContextMenu(){return (t().status==="copied"||t().status==="fading")&&t().element&&(document.body??document.documentElement).contains(t().element)?()=>e.onShowContextMenuInstance?.(t().id):void 0},onHoverChange:n=>e.onLabelInstanceHoverChange?.(t().id,n)})}),chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.r,{get when(){return e.toolbarVisible!==false},get children(){return chunkGJYSUTIS_cjs.n(Fi,{get isActive(){return e.isActive},get isCommentMode(){return e.isCommentMode},get isContextMenuOpen(){return e.contextMenuPosition!==null},get onToggle(){return e.onToggleActive},get onComment(){return e.onComment},get enabled(){return e.enabled},get onToggleEnabled(){return e.onToggleEnabled},get shakeCount(){return e.shakeCount},get onStateChange(){return e.onToolbarStateChange},get onSubscribeToStateChanges(){return e.onSubscribeToToolbarStateChanges},get onSelectHoverChange(){return e.onToolbarSelectHoverChange}})}}),chunkGJYSUTIS_cjs.n(chunkGJYSUTIS_cjs.Ea,{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??false},get actions(){return e.actions},get actionContext(){return e.actionContext},get onDismiss(){return e.onContextMenuDismiss??(()=>{})},get onHide(){return e.onContextMenuHide??(()=>{})}})];var gc=Object.create,ji=Object.defineProperty,hc=Object.getOwnPropertyDescriptor,bc=Object.getOwnPropertyNames,yc=Object.getPrototypeOf,Sc=Object.prototype.hasOwnProperty,wc=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ec=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=bc(t),l=0,s=a.length,f;l<s;l++)f=a[l],!Sc.call(e,f)&&f!==n&&ji(e,f,{get:(i=>t[i]).bind(null,f),enumerable:!(r=hc(t,f))||r.enumerable});return e},vc=(e,t,n)=>(n=e==null?{}:gc(yc(e)),Ec(ji(n,"default",{value:e,enumerable:true}),e)),Bi=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,Cc=["rsc://","file:///","webpack://","webpack-internal://","node:","turbopack://","metro://","/app-pages-browser/"],Hi="about://React/",xc=["<anonymous>","eval",""],Tc=/\.(jsx|tsx|ts|js)$/,Ac=/(\.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,Pc=/^\?[\w~.\-]+(?:=[^&#]*)?(?:&[\w~.\-]+(?:=[^&#]*)?)*$/,Gi="(at Server)",Mc=/(^|@)\S+:\d+/,Wi=/^\s*at .*(\S+:\d+|\(native\))/m,Oc=/^(eval@)?(\[native code\])?$/;var Yi=(e,t)=>{{let n=e.split(`
21
+ `),r=[];for(let a of n)if(/^\s*at\s+/.test(a)){let l=$i(a,void 0)[0];l&&r.push(l);}else if(/^\s*in\s+/.test(a)){let l=a.replace(/^\s*in\s+/,"").replace(/\s*\(at .*\)$/,"");r.push({functionName:l,source:a});}else if(a.match(Mc)){let l=zi(a,void 0)[0];l&&r.push(l);}return Kr(r,t)}},Xi=e=>{if(!e.includes(":"))return [e,void 0,void 0];let t=e.startsWith("(")&&/:\d+\)$/.test(e),n=t?e.slice(1,-1):e,r=/(.+?)(?::(\d+))?(?::(\d+))?$/,a=r.exec(n);return a?[a[1],a[2]||void 0,a[3]||void 0]:[n,void 0,void 0]},Kr=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e;var $i=(e,t)=>Kr(e.split(`
22
+ `).filter(r=>!!r.match(Wi)),t).map(r=>{let a=r;a.includes("(eval ")&&(a=a.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let l=a.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),s=l.match(/ (\(.+\)$)/);l=s?l.replace(s[0],""):l;let f=Xi(s?s[1]:l),i=s&&l||void 0,u=["eval","<anonymous>"].includes(f[0])?void 0:f[0];return {functionName:i,fileName:u,lineNumber:f[1]?+f[1]:void 0,columnNumber:f[2]?+f[2]:void 0,source:a}});var zi=(e,t)=>Kr(e.split(`
23
+ `).filter(r=>!r.match(Oc)),t).map(r=>{let a=r;if(a.includes(" > eval")&&(a=a.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!a.includes("@")&&!a.includes(":"))return {functionName:a};{let l=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,s=a.match(l),f=s&&s[1]?s[1]:void 0,i=Xi(a.replace(l,""));return {functionName:f,fileName:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:a}}});var Rc=wc((e,t)=>{(function(n,r){typeof e=="object"&&t!==void 0?r(e):typeof define=="function"&&define.amd?define(["exports"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.sourcemapCodec={}));})(void 0,function(n){let r=44,a=59,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=new Uint8Array(64),f=new Uint8Array(128);for(let H=0;H<l.length;H++){let M=l.charCodeAt(H);s[H]=M,f[M]=H;}function i(H,M){let S=0,m=0,y=0;do{let R=H.next();y=f[R],S|=(y&31)<<m,m+=5;}while(y&32);let v=S&1;return S>>>=1,v&&(S=-2147483648|-S),M+S}function u(H,M,S){let m=M-S;m=m<0?-m<<1|1:m<<1;do{let y=m&31;m>>>=5,m>0&&(y|=32),H.write(s[y]);}while(m>0);return M}function g(H,M){return H.pos>=M?false:H.peek()!==r}let T=1024*16,I=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(H){return Buffer.from(H.buffer,H.byteOffset,H.byteLength).toString()}}:{decode(H){let M="";for(let S=0;S<H.length;S++)M+=String.fromCharCode(H[S]);return M}};class C{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(T);}write(M){let{buffer:S}=this;S[this.pos++]=M,this.pos===T&&(this.out+=I.decode(S),this.pos=0);}flush(){let{buffer:M,out:S,pos:m}=this;return m>0?S+I.decode(M.subarray(0,m)):S}}class z{constructor(M){this.pos=0,this.buffer=M;}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(M){let{buffer:S,pos:m}=this,y=S.indexOf(M,m);return y===-1?S.length:y}}let B=[];function b(H){let{length:M}=H,S=new z(H),m=[],y=[],v=0;for(;S.pos<M;S.pos++){v=i(S,v);let R=i(S,0);if(!g(S,M)){let _=y.pop();_[2]=v,_[3]=R;continue}let p=i(S,0),P=i(S,0),k=P&1,A=k?[v,R,0,0,p,i(S,0)]:[v,R,0,0,p],N=B;if(g(S,M)){N=[];do{let _=i(S,0);N.push(_);}while(g(S,M))}A.vars=N,m.push(A),y.push(A);}return m}function h(H){let M=new C;for(let S=0;S<H.length;)S=F(H,S,M,[0]);return M.flush()}function F(H,M,S,m){let y=H[M],{0:v,1:R,2:p,3:P,4:k,vars:A}=y;M>0&&S.write(r),m[0]=u(S,v,m[0]),u(S,R,0),u(S,k,0);let N=y.length===6?1:0;u(S,N,0),y.length===6&&u(S,y[5],0);for(let _ of A)u(S,_,0);for(M++;M<H.length;){let _=H[M],{0:D,1:$}=_;if(D>p||D===p&&$>=P)break;M=F(H,M,S,m);}return S.write(r),m[0]=u(S,p,m[0]),u(S,P,0),M}function X(H){let{length:M}=H,S=new z(H),m=[],y=[],v=0,R=0,p=0,P=0,k=0,A=0,N=0,_=0;do{let D=S.indexOf(";"),$=0;for(;S.pos<D;S.pos++){if($=i(S,$),!g(S,D)){let le=y.pop();le[2]=v,le[3]=$;continue}let V=i(S,0),G=V&1,W=V&2,ce=V&4,Ce=null,ge=B,ne;if(G){let le=i(S,R);p=i(S,R===le?p:0),R=le,ne=[v,$,0,0,le,p];}else ne=[v,$,0,0];if(ne.isScope=!!ce,W){let le=P,he=k;P=i(S,P);let De=le===P;k=i(S,De?k:0),A=i(S,De&&he===k?A:0),Ce=[P,k,A];}if(ne.callsite=Ce,g(S,D)){ge=[];do{N=v,_=$;let le=i(S,0),he;if(le<-1){he=[[i(S,0)]];for(let De=-1;De>le;De--){let We=N;N=i(S,N),_=i(S,N===We?_:0);let we=i(S,0);he.push([we,N,_]);}}else he=[[le]];ge.push(he);}while(g(S,D))}ne.bindings=ge,m.push(ne),y.push(ne);}v++,S.pos=D+1;}while(S.pos<M);return m}function pe(H){if(H.length===0)return "";let M=new C;for(let S=0;S<H.length;)S=ie(H,S,M,[0,0,0,0,0,0,0]);return M.flush()}function ie(H,M,S,m){let y=H[M],{0:v,1:R,2:p,3:P,isScope:k,callsite:A,bindings:N}=y;m[0]<v?(Oe(S,m[0],v),m[0]=v,m[1]=0):M>0&&S.write(r),m[1]=u(S,y[1],m[1]);let _=(y.length===6?1:0)|(A?2:0)|(k?4:0);if(u(S,_,0),y.length===6){let{4:D,5:$}=y;D!==m[2]&&(m[3]=0),m[2]=u(S,D,m[2]),m[3]=u(S,$,m[3]);}if(A){let{0:D,1:$,2:V}=y.callsite;D===m[4]?$!==m[5]&&(m[6]=0):(m[5]=0,m[6]=0),m[4]=u(S,D,m[4]),m[5]=u(S,$,m[5]),m[6]=u(S,V,m[6]);}if(N)for(let D of N){D.length>1&&u(S,-D.length,0);let $=D[0][0];u(S,$,0);let V=v,G=R;for(let W=1;W<D.length;W++){let ce=D[W];V=u(S,ce[1],V),G=u(S,ce[2],G),u(S,ce[0],0);}}for(M++;M<H.length;){let D=H[M],{0:$,1:V}=D;if($>p||$===p&&V>=P)break;M=ie(H,M,S,m);}return m[0]<p?(Oe(S,m[0],p),m[0]=p,m[1]=0):S.write(r),m[1]=u(S,P,m[1]),M}function Oe(H,M,S){do H.write(a);while(++M<S)}function Qe(H){let{length:M}=H,S=new z(H),m=[],y=0,v=0,R=0,p=0,P=0;do{let k=S.indexOf(";"),A=[],N=true,_=0;for(y=0;S.pos<k;){let D;y=i(S,y),y<_&&(N=false),_=y,g(S,k)?(v=i(S,v),R=i(S,R),p=i(S,p),g(S,k)?(P=i(S,P),D=[y,v,R,p,P]):D=[y,v,R,p]):D=[y],A.push(D),S.pos++;}N||et(A),m.push(A),S.pos=k+1;}while(S.pos<=M);return m}function et(H){H.sort(He);}function He(H,M){return H[0]-M[0]}function Ie(H){let M=new C,S=0,m=0,y=0,v=0;for(let R=0;R<H.length;R++){let p=H[R];if(R>0&&M.write(a),p.length===0)continue;let P=0;for(let k=0;k<p.length;k++){let A=p[k];k>0&&M.write(r),P=u(M,A[0],P),A.length!==1&&(S=u(M,A[1],S),m=u(M,A[2],m),y=u(M,A[3],y),A.length!==4&&(v=u(M,A[4],v)));}}return M.flush()}n.decode=Qe,n.decodeGeneratedRanges=X,n.decodeOriginalScopes=b,n.encode=Ie,n.encodeGeneratedRanges=pe,n.encodeOriginalScopes=h,Object.defineProperty(n,"__esModule",{value:true});});}),qi=vc(Rc()),Zi=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,_c=/^data:application\/json[^,]+base64,/,Dc=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,Ji=typeof WeakRef<"u",_n=new Map,To=new Map,Nc=e=>Ji&&e instanceof WeakRef,Vi=(e,t,n,r)=>{if(n<0||n>=e.length)return null;let a=e[n];if(!a||a.length===0)return null;let l=null;for(let g of a)if(g[0]<=r)l=g;else break;if(!l||l.length<4)return null;let[,s,f,i]=l;if(s===void 0||f===void 0||i===void 0)return null;let u=t[s];return u?{columnNumber:i,fileName:u,lineNumber:f+1}:null},Ic=(e,t,n)=>{if(e.sections){let r=null;for(let s of e.sections)if(t>s.offset.line||t===s.offset.line&&n>=s.offset.column)r=s;else break;if(!r)return null;let a=t-r.offset.line,l=t===r.offset.line?n-r.offset.column:n;return Vi(r.map.mappings,r.map.sources,a,l)}return Vi(e.mappings,e.sources,t-1,n)},kc=(e,t)=>{let n=t.split(`
24
+ `),r;for(let l=n.length-1;l>=0&&!r;l--){let s=n[l].match(Dc);s&&(r=s[1]||s[2]);}if(!r)return null;let a=Zi.test(r);if(!(_c.test(r)||a||r.startsWith("/"))){let l=e.split("/");l[l.length-1]=r,r=l.join("/");}return r},Fc=e=>({file:e.file,mappings:(0, qi.decode)(e.mappings),names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,version:3}),Lc=e=>{let t=e.sections.map(({map:r,offset:a})=>({map:{...r,mappings:(0, qi.decode)(r.mappings)},offset:a})),n=new Set;for(let r of t)for(let a of r.map.sources)n.add(a);return {file:e.file,mappings:[],names:[],sections:t,sourceRoot:void 0,sources:Array.from(n),sourcesContent:void 0,version:3}},Ki=e=>{if(!e)return false;let t=e.trim();if(!t)return false;let n=t.match(Zi);if(!n)return true;let r=n[0].toLowerCase();return r==="http:"||r==="https:"},Bc=async(e,t=fetch)=>{if(!Ki(e))return null;let n;try{let a=await t(e);if(!a.ok)return null;n=await a.text();}catch{return null}if(!n)return null;let r=kc(e,n);if(!r||!Ki(r))return null;try{let a=await t(r);if(!a.ok)return null;let l=await a.json();return "sections"in l?Lc(l):Fc(l)}catch{return null}},Hc=async(e,t=true,n)=>{if(t&&_n.has(e)){let l=_n.get(e);if(l==null)return null;if(Nc(l)){let s=l.deref();if(s)return s;_n.delete(e);}else return l}if(t&&To.has(e))return To.get(e);let r=Bc(e,n);t&&To.set(e,r);let a=await r;return t&&To.delete(e),t&&(a===null?_n.set(e,null):_n.set(e,Ji?new WeakRef(a):a)),a},$c=async(e,t=true,n)=>await Promise.all(e.map(async r=>{if(!r.fileName)return r;let a=await Hc(r.fileName,t,n);if(!a||typeof r.lineNumber!="number"||typeof r.columnNumber!="number")return r;let l=Ic(a,r.lineNumber,r.columnNumber);return l?{...r,source:l.fileName&&r.source?r.source.replace(r.fileName,l.fileName):r.source,fileName:l.fileName,lineNumber:l.lineNumber,columnNumber:l.columnNumber,isSymbolicated:true}:r})),zc=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack=="string",Vc=()=>{let e=Ge();for(let t of [...Array.from(kt),...Array.from(e.renderers.values())]){let n=t.currentDispatcherRef;if(n&&typeof n=="object")return "H"in n?n.H:n.current}return null},Ui=e=>{for(let t of kt){let n=t.currentDispatcherRef;n&&typeof n=="object"&&("H"in n?n.H=e:n.current=e);}},ut=e=>`
25
+ in ${e}`,Kc=(e,t)=>{let n=ut(e);return t&&(n+=` (at ${t})`),n},zr=false,Vr=(e,t)=>{if(!e||zr)return "";let n=Error.prepareStackTrace;Error.prepareStackTrace=void 0,zr=true;let r=Vc();Ui(null);let a=console.error,l=console.warn;console.error=()=>{},console.warn=()=>{};try{let i={DetermineComponentFrameRoot(){let I;try{if(t){let C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(C,[]);}catch(z){I=z;}Reflect.construct(e,[],C);}else {try{C.call();}catch(z){I=z;}e.call(C.prototype);}}else {try{throw Error()}catch(z){I=z;}let C=e();C&&typeof C.catch=="function"&&C.catch(()=>{});}}catch(C){if(C instanceof Error&&I instanceof Error&&typeof C.stack=="string")return [C.stack,I.stack]}return [null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot",Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name")?.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});let[g,T]=i.DetermineComponentFrameRoot();if(g&&T){let I=g.split(`
26
+ `),C=T.split(`
27
+ `),z=0,B=0;for(;z<I.length&&!I[z].includes("DetermineComponentFrameRoot");)z++;for(;B<C.length&&!C[B].includes("DetermineComponentFrameRoot");)B++;if(z===I.length||B===C.length)for(z=I.length-1,B=C.length-1;z>=1&&B>=0&&I[z]!==C[B];)B--;for(;z>=1&&B>=0;z--,B--)if(I[z]!==C[B]){if(z!==1||B!==1)do if(z--,B--,B<0||I[z]!==C[B]){let b=`
28
+ ${I[z].replace(" at new "," at ")}`,h=bt(e);return h&&b.includes("<anonymous>")&&(b=b.replace("<anonymous>",h)),b}while(z>=1&&B>=0);break}}}finally{zr=false,Error.prepareStackTrace=n,Ui(r),console.error=a,console.warn=l;}let s=e?bt(e):"";return s?ut(s):""},Uc=(e,t)=>{let n=e.tag,r="";switch(n){case Tr:r=ut("Activity");break;case so:r=Vr(e.type,true);break;case io:r=Vr(e.type.render,false);break;case ro:case ao:r=Vr(e.type,false);break;case Sr:case Cr:case xr:r=ut(e.type);break;case Er:r=ut("Lazy");break;case wr:r=e.child!==t&&t!==null?ut("Suspense Fallback"):ut("Suspense");break;case vr:r=ut("SuspenseList");break;case Ar:r=ut("ViewTransition");break;default:return ""}return r},jc=e=>{try{let t="",n=e,r=null;do{t+=Uc(n,r);let a=n._debugInfo;if(a&&Array.isArray(a))for(let l=a.length-1;l>=0;l--){let s=a[l];typeof s.name=="string"&&(t+=Kc(s.name,s.env));}r=n,n=n.return;}while(n);return t}catch(t){return t instanceof Error?`
29
+ Error generating stack: ${t.message}
30
+ ${t.stack}`:""}},Gc=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
31
+ `)&&(n=n.slice(29));let r=n.indexOf(`
32
+ `);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(`
33
+ `,r)),r!==-1)n=n.slice(0,r);else return "";return n},Wc=e=>!!(e.fileName?.startsWith("rsc://")&&e.functionName),Yc=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,Xc=e=>{let t=new Map;for(let n of e)for(let r of n.stackFrames){if(!Wc(r))continue;let a=r.functionName,l=t.get(a)??[];l.some(f=>Yc(f,r))||(l.push(r),t.set(a,l));}return t},qc=(e,t,n)=>{if(!e.functionName)return {...e,isServer:true};let r=t.get(e.functionName);if(!r||r.length===0)return {...e,isServer:true};let a=n.get(e.functionName)??0,l=r[a%r.length];return n.set(e.functionName,a+1),{...e,isServer:true,fileName:l.fileName,lineNumber:l.lineNumber,columnNumber:l.columnNumber,source:e.source?.replace(Gi,`(${l.fileName}:${l.lineNumber}:${l.columnNumber})`)}},Zc=e=>{let t=[];return Mn(e,n=>{if(!zc(n))return;let r=typeof n.type=="string"?n.type:bt(n.type)||"<anonymous>";t.push({componentName:r,stackFrames:Yi(Gc(n._debugStack?.stack))});},true),t},Qi=async(e,t=true,n)=>{let r=Zc(e),a=Yi(jc(e)),l=Xc(r),s=new Map,f=a.map(u=>u.source?.includes(Gi)??false?qc(u,l,s):u),i=f.filter((u,g,T)=>{if(g===0)return true;let I=T[g-1];return u.functionName!==I.functionName});return $c(i,t,n)};var St=e=>{if(!e||xc.some(a=>a===e))return "";let t=e;if(t.startsWith("http://")||t.startsWith("https://"))try{t=new URL(t).pathname;}catch{}if(t.startsWith(Hi)){let a=t.slice(Hi.length),l=a.indexOf("/"),s=a.indexOf(":");t=l!==-1&&(s===-1||l<s)?a.slice(l+1):a;}let n=true;for(;n;){n=false;for(let a of Cc)if(t.startsWith(a)){t=t.slice(a.length),a==="file:///"&&(t=`/${t.replace(/^\/+/,"")}`),n=true;break}}if(Bi.test(t)){let a=t.match(Bi);a&&(t=t.slice(a[0].length));}if(t.startsWith("//")){let a=t.indexOf("/",2);t=a===-1?"":t.slice(a);}let r=t.indexOf("?");if(r!==-1){let a=t.slice(r);Pc.test(a)&&(t=t.slice(0,r));}return t},wt=e=>{let t=St(e);return !(!t||!Tc.test(t)||Ac.test(t))};var ea=e=>e.length>0&&/^[A-Z]/.test(e);var Jc=new Set(["InnerLayoutRouter","RedirectErrorBoundary","RedirectBoundary","HTTPAccessFallbackErrorBoundary","HTTPAccessFallbackBoundary","LoadingBoundary","ErrorBoundary","InnerScrollAndFocusHandler","ScrollAndFocusHandler","RenderFromTemplateContext","OuterLayoutRouter","body","html","DevRootHTTPAccessFallbackBoundary","AppDevOverlayErrorBoundary","AppDevOverlay","HotReload","Router","ErrorBoundaryHandler","AppRouter","ServerRoot","SegmentStateProvider","RootErrorBoundary","LoadableComponent","MotionDOMComponent"]),Qc=new Set(["Suspense","Fragment","StrictMode","Profiler","SuspenseList"]),eu=()=>typeof document>"u"?false:!!(document.getElementById("__NEXT_DATA__")||document.querySelector("nextjs-portal")),na=e=>!!(e.startsWith("_")||Jc.has(e)||Qc.has(e)),ln=e=>!(e.length<=1||na(e)||!ea(e)||e.startsWith("Primitive.")||e.includes("Provider")&&e.includes("Context")),ta=new WeakMap,tu=async e=>{try{let t=Lt(e);return t?await Qi(t):null}catch{return null}},Et=e=>{if(!Ft())return Promise.resolve([]);let t=ta.get(e);if(t)return t;let n=tu(e);return ta.set(e,n),n},cn=async e=>{if(!Ft())return null;let t=await Et(e);if(!t)return null;for(let n of t)if(n.functionName&&ln(n.functionName))return n.functionName;return null},oa=e=>!(!e||na(e)||e.startsWith("Primitive.")||e==="SlotClone"||e==="Slot"),Ao=e=>{if(!Ft())return null;let t=Lt(e);if(!t)return null;let n=t.return;for(;n;){if(sn(n)){let r=bt(n.type);if(r&&oa(r))return r}n=n.return;}return null},nu=e=>e?e.some(t=>t.isServer||t.fileName&&wt(t.fileName)):false,ou=(e,t)=>{if(!Ft())return [];let n=Lt(e);if(!n)return [];let r=[];return Mn(n,a=>{if(r.length>=t)return true;if(sn(a)){let l=bt(a.type);l&&oa(l)&&r.push(l);}return false},true),r},Ur=async(e,t={})=>{let{maxLines:n=3}=t,r=await Et(e),a=su(e);if(nu(r)){let s=eu(),f=[];if(r)for(let i of r){if(f.length>=n)break;if(i.isServer&&(!i.functionName||ln(i.functionName))){f.push(`
34
+ in ${i.functionName||"<anonymous>"} (at Server)`);continue}if(i.fileName&&wt(i.fileName)){let u=`
35
+ in `,g=i.functionName&&ln(i.functionName);g&&(u+=`${i.functionName} (at `),u+=St(i.fileName),s&&i.lineNumber&&i.columnNumber&&(u+=`:${i.lineNumber}:${i.columnNumber}`),g&&(u+=")"),f.push(u);}}return `${a}${f.join("")}`}let l=ou(e,n);if(l.length>0){let s=l.map(f=>`
36
+ in ${f}`).join("");return `${a}${s}`}return ru(e)},ru=e=>{let t=e.tagName.toLowerCase();if(!(e instanceof HTMLElement)){let l=sa(e,{truncate:false,maxAttrs:chunkGJYSUTIS_cjs.P.length});return `<${t}${l} />`}let n=e.innerText?.trim()??e.textContent?.trim()??"",r="";for(let{name:l,value:s}of e.attributes)r+=` ${l}="${s}"`;let a=n.length>100?`${n.slice(0,100)}...`:n;return a.length>0?`<${t}${r}>
37
+ ${a}
38
+ </${t}>`:`<${t}${r} />`},ra=e=>e.length>chunkGJYSUTIS_cjs.N?`${e.slice(0,chunkGJYSUTIS_cjs.N)}...`:e,sa=(e,t={})=>{let{truncate:n=true,maxAttrs:r=chunkGJYSUTIS_cjs.O}=t,a=[];for(let l of chunkGJYSUTIS_cjs.P){if(a.length>=r)break;let s=e.getAttribute(l);if(s){let f=n?ra(s):s;a.push(`${l}="${f}"`);}}return a.length>0?` ${a.join(" ")}`:""},su=e=>{let t=e.tagName.toLowerCase();if(!(e instanceof HTMLElement)){let I=sa(e);return `<${t}${I} />`}let n=e.innerText?.trim()??e.textContent?.trim()??"",r="";for(let{name:I,value:C}of e.attributes)r+=` ${I}="${ra(C)}"`;let a=[],l=[],s=false,f=Array.from(e.childNodes);for(let I of f)I.nodeType!==Node.COMMENT_NODE&&(I.nodeType===Node.TEXT_NODE?I.textContent&&I.textContent.trim().length>0&&(s=true):I instanceof Element&&(s?l.push(I):a.push(I)));let i=I=>I.length===0?"":I.length<=2?I.map(C=>`<${C.tagName.toLowerCase()} ...>`).join(`
39
+ `):`(${I.length} elements)`,u="",g=i(a);if(g&&(u+=`
40
+ ${g}`),n.length>0){let I=n.length>100?`${n.slice(0,100)}...`:n;u+=`
41
+ ${I}`;}let T=i(l);return T&&(u+=`
42
+ ${T}`),u.length>0?`<${t}${r}>${u}
43
+ </${t}>`:`<${t}${r} />`};var jr=()=>({activate:()=>{},deactivate:()=>{},toggle:()=>{},isActive:()=>false,isEnabled:()=>false,setEnabled:()=>{},getToolbarState:()=>null,setToolbarState:()=>{},onToolbarStateChange:()=>()=>{},dispose:()=>{},copyElement:()=>Promise.resolve(false),getSource:()=>Promise.resolve(null),getState:()=>({isActive:false,isDragging:false,isCopying:false,isPromptMode:false,isCrosshairVisible:false,isSelectionBoxVisible:false,isDragBoxVisible:false,targetElement:null,dragBounds:null,grabbedBoxes:[],selectionFilePath:null,toolbarState:null}),setOptions:()=>{},registerPlugin:()=>{},unregisterPlugin:()=>{},getPlugins:()=>[],getDisplayName:()=>null});var ia=()=>{let e=new AbortController,t=(r,a,l={})=>{window.addEventListener(r,a,{...l,signal:e.signal});},n=(r,a,l={})=>{document.addEventListener(r,a,{...l,signal:e.signal});};return {signal:e.signal,abort:()=>e.abort(),addWindowListener:t,addDocumentListener:n}};var iu="application/x-lexical-editor",au="application/x-react-grab",aa=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return (e==="x"?t:t&3|8).toString(16)}),lu=(e,t,n,r)=>({detail:1,format:0,mode:"segmented",style:"",text:`@${e}`,type:"mention",version:1,mentionName:e,typeaheadType:n,storedKey:t,metadata:r,source:"chat"}),cu=e=>({detail:0,format:0,mode:"normal",style:"",text:e,type:"text",version:1}),uu=(e,t)=>{let n=String(Math.floor(Math.random()*1e4)),r=aa(),a=`<${t}>`,l={case:"file",path:`${a}.tsx`,content:e},s={key:a,type:l,payload:{file:{path:`${a}.tsx`,content:e}},id:aa(),name:a,_score:20,isSlash:false,labelMatch:[{start:0,end:2}]},f={selection:{type:0},selectedOption:s},i=JSON.stringify(f).replace(/"/g,"&quot;");return {plainText:`@${a}
44
+
45
+ ${e}
46
+ `,htmlContent:`<meta charset='utf-8'><span data-mention-key="${n}" data-lexical-mention="true" data-mention-name="${a}" data-typeahead-type="[object Object]" data-mention-metadata="${i}">@${a}</span><pre><code>${e}</code></pre>`,lexicalData:JSON.stringify({namespace:`chat-input${r}-pane`,nodes:[lu(a,n,l,f),cu(`
47
+
48
+ ${e}`)]})}},Gr=(e,t)=>{let n=t?.name??"div",{plainText:r,htmlContent:a,lexicalData:l}=uu(e,n),s={version:chunkGJYSUTIS_cjs.F,content:e,timestamp:Date.now()},f=u=>{u.preventDefault(),u.clipboardData?.setData("text/plain",r),u.clipboardData?.setData("text/html",a),u.clipboardData?.setData(iu,l),u.clipboardData?.setData(au,JSON.stringify(s));};document.addEventListener("copy",f);let i=document.createElement("textarea");i.value=e,i.style.position="fixed",i.style.left="-9999px",i.ariaHidden="true",document.body.appendChild(i),i.select();try{let u=document.execCommand("copy");return u&&t?.onSuccess?.(),u}finally{document.removeEventListener("copy",f),i.remove();}};var Dn=async(e,t={})=>(await Promise.allSettled(e.map(a=>Ur(a,t)))).map(a=>a.status==="fulfilled"?a.value:"");var la=async(e,t,n,r)=>{let a=false,l="";await t.onBeforeCopy(n);try{let s;if(e.getContent)s=await e.getContent(n);else {let f=await Dn(n,{maxLines:e.maxContextLines});s=(await Promise.all(f.map((u,g)=>u.trim()?t.transformSnippet(u,n[g]):Promise.resolve("")))).filter(u=>u.trim()).join(`
49
+
50
+ `);}if(s.trim()){let f=await t.transformCopyContent(s,n);l=r?`${r}
51
+
52
+ ${f}`:f,a=Gr(l,{name:e.componentName});}}catch(s){let f=s instanceof Error?s:new Error(String(s));t.onCopyError(f);}return a&&t.onCopySuccess(n,l),t.onAfterCopy(n,a),a};var Nn=e=>{let t=e.tagName.toUpperCase();return t==="HTML"||t==="BODY"};var du=(e,t)=>{let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),a=Math.min(e.right,t.right),l=Math.min(e.bottom,t.bottom),s=Math.max(0,a-n),f=Math.max(0,l-r);return s*f},fu=(e,t)=>e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top,un=(e,t,n)=>Math.min(n,Math.max(t,e)),mu=e=>e.sort((t,n)=>{if(t===n)return 0;let r=t.compareDocumentPosition(n);return r&Node.DOCUMENT_POSITION_FOLLOWING?-1:r&Node.DOCUMENT_POSITION_PRECEDING?1:0}),pu=e=>{if(e.width<=0||e.height<=0)return [];let t=window.innerWidth,n=window.innerHeight,r=e.x,a=e.y,l=e.x+e.width,s=e.y+e.height,f=r+e.width/2,i=a+e.height/2,u=un(Math.ceil(e.width/chunkGJYSUTIS_cjs.ka),chunkGJYSUTIS_cjs.la,chunkGJYSUTIS_cjs.ma),g=un(Math.ceil(e.height/chunkGJYSUTIS_cjs.ka),chunkGJYSUTIS_cjs.la,chunkGJYSUTIS_cjs.ma),T=u*g,I=T>chunkGJYSUTIS_cjs.na?Math.sqrt(chunkGJYSUTIS_cjs.na/T):1,C=un(Math.floor(u*I),chunkGJYSUTIS_cjs.la,chunkGJYSUTIS_cjs.ma),z=un(Math.floor(g*I),chunkGJYSUTIS_cjs.la,chunkGJYSUTIS_cjs.ma),B=new Set,b=[],h=(F,X)=>{let pe=un(Math.round(F),0,t-1),ie=un(Math.round(X),0,n-1),Oe=`${pe}:${ie}`;B.has(Oe)||(B.add(Oe),b.push({x:pe,y:ie}));};h(r+chunkGJYSUTIS_cjs.oa,a+chunkGJYSUTIS_cjs.oa),h(l-chunkGJYSUTIS_cjs.oa,a+chunkGJYSUTIS_cjs.oa),h(r+chunkGJYSUTIS_cjs.oa,s-chunkGJYSUTIS_cjs.oa),h(l-chunkGJYSUTIS_cjs.oa,s-chunkGJYSUTIS_cjs.oa),h(f,a+chunkGJYSUTIS_cjs.oa),h(f,s-chunkGJYSUTIS_cjs.oa),h(r+chunkGJYSUTIS_cjs.oa,i),h(l-chunkGJYSUTIS_cjs.oa,i),h(f,i);for(let F=0;F<C;F+=1){let X=r+(F+.5)/C*e.width;for(let pe=0;pe<z;pe+=1){let ie=a+(pe+.5)/z*e.height;h(X,ie);}}return b},gu=(e,t,n)=>{let r={left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height},a=new Set,l=pu(e);So();try{for(let f of l){let i=document.elementsFromPoint(f.x,f.y);for(let u of i)a.add(u);}}finally{wo();}let s=[];for(let f of a){if(!n){let g=(f.tagName||"").toUpperCase();if(g==="HTML"||g==="BODY")continue}if(!t(f))continue;let i=f.getBoundingClientRect();if(i.width<=0||i.height<=0)continue;let u={left:i.left,top:i.top,right:i.left+i.width,bottom:i.top+i.height};if(n){let g=du(r,u),T=i.width*i.height;T>0&&g/T>=chunkGJYSUTIS_cjs.ja&&s.push(f);}else fu(u,r)&&s.push(f);}return mu(s)},hu=e=>e.filter(t=>!e.some(n=>n!==t&&n.contains(t))),In=(e,t,n=true)=>{let r=gu(e,t,n);return hu(r)};var Po=e=>({x:e.pageX-window.scrollX,y:e.pageY-window.scrollY,width:e.width,height:e.height,borderRadius:"0px",transform:"none"}),Wr=e=>({pageX:e.x+window.scrollX,pageY:e.y+window.scrollY,width:e.width,height:e.height}),kn=e=>({...e,borderRadius:"0px",transform:"none"});var vt=e=>(e.tagName||"").toLowerCase();var dn=e=>({x:e.x+e.width/2,y:e.y+e.height/2});var bu=new Set(["c","C","\u0441","\u0421","\u023C","\u023B","\u2184","\u2183","\u1D04","\u1D9C","\u2C7C","\u217D","\u216D","\xE7","\xC7","\u0107","\u0106","\u010D","\u010C","\u0109","\u0108","\u010B","\u010A"]),Mo=(e,t)=>t==="KeyC"?true:!e||e.length!==1?false:bu.has(e);var ca=(e,t)=>{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:false};var yu={meta:"metaKey",cmd:"metaKey",command:"metaKey",win:"metaKey",windows:"metaKey",ctrl:"ctrlKey",control:"ctrlKey",shift:"shiftKey",alt:"altKey",option:"altKey",opt:"altKey"},ua=e=>{let t=e.split("+").map(r=>r.trim().toLowerCase()),n={metaKey:false,ctrlKey:false,shiftKey:false,altKey:false,key:null};for(let r of t){let a=yu[r];a?n[a]=true:n.key=r;}return n},Oo=e=>{if(typeof e=="function")return e;let t=ua(e),n=t.key;return r=>{if(n===null){let f=t.metaKey?r.metaKey||r.key==="Meta":true,i=t.ctrlKey?r.ctrlKey||r.key==="Control":true,u=t.shiftKey?r.shiftKey||r.key==="Shift":true,g=t.altKey?r.altKey||r.key==="Alt":true,T=f&&i&&u&&g,I=[t.metaKey,t.ctrlKey,t.shiftKey,t.altKey].filter(Boolean).length,C=[r.metaKey||r.key==="Meta",r.ctrlKey||r.key==="Control",r.shiftKey||r.key==="Shift",r.altKey||r.key==="Alt"].filter(Boolean).length;return T&&C>=I}let a=r.key?.toLowerCase()===n||ca(n,r.code),s=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?(t.metaKey?r.metaKey:true)&&(t.ctrlKey?r.ctrlKey:true)&&(t.shiftKey?r.shiftKey:true)&&(t.altKey?r.altKey:true):!r.metaKey&&!r.ctrlKey&&!r.shiftKey&&!r.altKey;return a&&s}},da=e=>!e||typeof e=="function"?{metaKey:chunkGJYSUTIS_cjs.Da(),ctrlKey:!chunkGJYSUTIS_cjs.Da(),shiftKey:false,altKey:false,key:null}:ua(e);var Ro=(e,t)=>{if(t.activationKey)return Oo(t.activationKey)(e);let r=(chunkGJYSUTIS_cjs.Da()?e.metaKey:e.ctrlKey)&&!e.shiftKey&&!e.altKey;return !!(e.key&&r&&Mo(e.key,e.code))};var Ct=(e,t)=>{try{return e.composedPath().some(n=>n instanceof HTMLElement&&n.hasAttribute(t))}catch{return false}};var fn=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,a=-1/0;for(let l of e)t=Math.min(t,l.x),n=Math.min(n,l.y),r=Math.max(r,l.x+l.width),a=Math.max(a,l.y+l.height);return {x:t,y:n,width:r-t,height:a-n}},Su=(e,t)=>new Promise((n,r)=>{let a=document.createElement("canvas"),l=a.getContext("2d");if(!l){r(new Error("Failed to get canvas context"));return}let s=e.videoWidth/window.innerWidth,f=e.videoHeight/window.innerHeight,i={x:t.x*s,y:t.y*f,width:t.width*s,height:t.height*f};a.width=i.width,a.height=i.height,l.drawImage(e,i.x,i.y,i.width,i.height,0,0,i.width,i.height),a.toBlob(u=>{u?n(u):r(new Error("Failed to create image blob"));},"image/png",1);}),_o=async e=>{let t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},preferCurrentTab:true}),n=document.createElement("video");n.srcObject=t,n.autoplay=true,n.playsInline=true,await new Promise((r,a)=>{let l=setTimeout(()=>{a(new Error("Video metadata loading timed out"));},chunkGJYSUTIS_cjs.R);n.onerror=()=>{clearTimeout(l),a(new Error("Video failed to load"));},n.onloadedmetadata=()=>{clearTimeout(l),n.play(),r();};}),await new Promise((r,a)=>{let l=Date.now(),s=()=>{if(n.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){r();return}if(Date.now()-l>=chunkGJYSUTIS_cjs.T){a(new Error("Video frame not ready within timeout"));return}setTimeout(s,chunkGJYSUTIS_cjs.S);};s();});try{return await Su(n,e)}finally{t.getTracks().forEach(r=>r.stop()),n.srcObject=null;}},Do=async e=>{try{return await navigator.clipboard.write([new ClipboardItem({[e.type]:e})]),!0}catch{return false}};var No=()=>{if(typeof window>"u"||typeof navigator>"u")return false;let e=typeof navigator.mediaDevices?.getDisplayMedia=="function",t=typeof navigator.clipboard?.write=="function"&&typeof ClipboardItem<"u";return e&&t};var Io=e=>new Promise(t=>setTimeout(t,e));var $t={enabled:true,hue:0,selectionBox:{enabled:true},dragBox:{enabled:true},grabbedBoxes:{enabled:true},elementLabel:{enabled:true},crosshair:{enabled:true},toolbar:{enabled:true}},wu=(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},crosshair:{enabled:t.crosshair?.enabled??e.crosshair.enabled},toolbar:{enabled:t.toolbar?.enabled??e.toolbar.enabled}}),ko=wu;var fa={activationMode:"toggle",keyHoldDuration:75,allowActivationInsideInput:true,maxContextLines:3,activationKey:void 0,getContent:void 0,freezeReactUpdates:true},ma=(e={})=>{let t=new Map,n={},[r,a]=Jn({theme:$t,options:{...fa,...e},actions:[]}),l=()=>{let b=$t,h={...fa,...e},F=[];for(let{config:X}of t.values())X.theme&&(b=ko(b,X.theme)),X.options&&(h={...h,...X.options}),X.actions&&F.push(...X.actions);h={...h,...n},a("theme",b),a("options",h),a("actions",F);},s=b=>{for(let[h,F]of Object.entries(b))F!==void 0&&(n[h]=F,a("options",h,F));},f=(b,h)=>{t.has(b.name)&&i(b.name);let F;return b.setup?F=b.setup(h)??{}:F={},b.theme&&(F.theme=F.theme?ko(ko($t,b.theme),F.theme):b.theme),b.actions&&(F.actions=[...b.actions,...F.actions??[]]),b.hooks&&(F.hooks=F.hooks?{...b.hooks,...F.hooks}:b.hooks),b.options&&(F.options=F.options?{...b.options,...F.options}:b.options),t.set(b.name,{plugin:b,config:F}),l(),F},i=b=>{let h=t.get(b);h&&(h.config.cleanup&&h.config.cleanup(),t.delete(b),l());},u=()=>Array.from(t.keys()),g=(b,...h)=>{for(let{config:F}of t.values()){let X=F.hooks?.[b];X&&X(...h);}},T=(b,...h)=>{let F=false;for(let{config:X}of t.values()){let pe=X.hooks?.[b];pe&&pe(...h)===true&&(F=true);}return F},I=async(b,...h)=>{for(let{config:F}of t.values()){let X=F.hooks?.[b];X&&await X(...h);}},C=async(b,h,...F)=>{let X=h;for(let{config:pe}of t.values()){let ie=pe.hooks?.[b];ie&&(X=await ie(X,...F));}return X},z=(b,h,...F)=>{let X=h;for(let{config:pe}of t.values()){let ie=pe.hooks?.[b];ie&&(X=ie(X,...F));}return X};return {register:f,unregister:i,getPluginNames:u,setOptions:s,store:r,hooks:{onActivate:()=>g("onActivate"),onDeactivate:()=>g("onDeactivate"),onElementHover:b=>g("onElementHover",b),onElementSelect:b=>g("onElementSelect",b),onDragStart:(b,h)=>g("onDragStart",b,h),onDragEnd:(b,h)=>g("onDragEnd",b,h),onBeforeCopy:async b=>I("onBeforeCopy",b),transformCopyContent:async(b,h)=>C("transformCopyContent",b,h),onAfterCopy:(b,h)=>g("onAfterCopy",b,h),onCopySuccess:(b,h)=>g("onCopySuccess",b,h),onCopyError:b=>g("onCopyError",b),onStateChange:b=>g("onStateChange",b),onPromptModeChange:(b,h)=>g("onPromptModeChange",b,h),onSelectionBox:(b,h,F)=>g("onSelectionBox",b,h,F),onDragBox:(b,h)=>g("onDragBox",b,h),onGrabbedBox:(b,h)=>g("onGrabbedBox",b,h),onElementLabel:(b,h,F)=>g("onElementLabel",b,h,F),onCrosshair:(b,h)=>g("onCrosshair",b,h),onContextMenu:(b,h)=>g("onContextMenu",b,h),onOpenFile:(b,h)=>T("onOpenFile",b,h),transformHtmlContent:async(b,h)=>C("transformHtmlContent",b,h),transformScreenshot:async(b,h,F)=>C("transformScreenshot",b,h,F),transformAgentContext:async(b,h)=>C("transformAgentContext",b,h),transformActionContext:b=>z("transformActionContext",b),transformOpenFileUrl:(b,h,F)=>z("transformOpenFileUrl",b,h,F),transformSnippet:async(b,h)=>C("transformSnippet",b,h)}}};var Yr="react-grab:agent-sessions",Eu=()=>`session-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,pa=(e,t,n,r,a)=>{let l=Date.now();return {id:Eu(),context:e,lastStatus:"",isStreaming:true,createdAt:l,lastUpdatedAt:l,position:t,selectionBounds:n,tagName:r,componentName:a}},zt=new Map,Fo=(e,t)=>{if(!t){zt.clear(),e.forEach((n,r)=>zt.set(r,n));return}try{let n=Object.fromEntries(e);t.setItem(Yr,JSON.stringify(n));}catch{zt.clear(),e.forEach((n,r)=>zt.set(r,n));}},Lo=(e,t)=>{let n=Bo(t);n.set(e.id,e),Fo(n,t);},Bo=e=>{if(!e)return new Map(zt);try{let t=e.getItem(Yr);if(!t)return new Map;let n=JSON.parse(t);return new Map(Object.entries(n))}catch{return new Map}},Ho=e=>{if(!e){zt.clear();return}try{e.removeItem(Yr);}catch{zt.clear();}},Xr=(e,t)=>{let n=Bo(t);n.delete(e),Fo(n,t);},xt=(e,t,n)=>{let r={...e,...t,lastUpdatedAt:Date.now()};return Lo(r,n),r};var qr=(e,t)=>{let[n,r]=chunkGJYSUTIS_cjs.d(new Map),[a,l]=chunkGJYSUTIS_cjs.d(false),[s,f]=chunkGJYSUTIS_cjs.d(false),i=new Map,u=new Map,g=new Map,T=[],I=[],C=e,z=p=>g.get(p)?.agent??C,B=p=>g.get(p)?.elements??[],b=p=>{let P=p??C,k=P?.provider?.canUndo?.()??false,A=P?.provider?.canRedo?.()??false;l(k),f(A);},h=p=>{C=p,b();},F=()=>C,X=()=>Array.from(n().values()).some(p=>p.isStreaming),pe=async(p,P,k)=>{let A=k??C,N=A?.storage,_=false;try{for await(let V of P){let W=n().get(p.id);if(!W)break;let ce=xt(W,{lastStatus:V},N);r(Ce=>new Map(Ce).set(p.id,ce)),A?.onStatus?.(V,ce);}let $=n().get(p.id);if($){let V=A?.provider?.getCompletionMessage?.(),G=xt($,{isStreaming:!1,...V?{lastStatus:V}:{}},N);r(ge=>new Map(ge).set(p.id,G));let W=B(p.id),ce=await A?.onComplete?.(G,W),Ce=I.findIndex(ge=>ge.session.id===p.id);if(Ce!==-1&&I.splice(Ce,1),I.push({session:G,elements:W,agent:A}),b(A),T.length=0,ce?.error){let ge=xt(G,{error:ce.error},N);r(ne=>new Map(ne).set(p.id,ge));}}}catch(D){let V=n().get(p.id);if(D instanceof Error&&D.name==="AbortError"){if(_=true,V){let G=B(p.id);A?.onAbort?.(V,G);}}else {let G=D instanceof Error?D.message:"Unknown error";if(V){let W=xt(V,{error:G,isStreaming:false},N);r(ce=>new Map(ce).set(p.id,W)),D instanceof Error&&A?.onError?.(D,W);}}}finally{i.delete(p.id),_&&(g.delete(p.id),Xr(p.id,N),r(D=>{let $=new Map(D);return $.delete(p.id),$}));}},ie=p=>{let{selectionBounds:P,tagName:k}=p,A=P[0];if(!A)return;let N=A.x+A.width/2,_=A.y+A.height/2,D=document.elementFromPoint(N,_);if(!(!D||k&&!k.includes(" ")&&D.tagName.toLowerCase()!==k))return D},Oe=()=>{let p=C?.storage;if(!p)return;let P=Bo(p);if(P.size===0)return;let k=Date.now(),A=Array.from(P.values()).filter(_=>{if(_.isStreaming)return true;let D=_.lastUpdatedAt??_.createdAt;return k-D<1e4&&!!_.error});if(A.length===0){Ho(p);return}if(!C?.provider?.supportsResume||!C.provider.resume){Ho(p);return}let N=new Map(A.map(_=>[_.id,_]));r(N),Fo(N,p);for(let _ of A){let D=ie(_);D&&C&&g.set(_.id,{elements:[D],agent:C});let $={..._,isStreaming:true,error:void 0,lastStatus:_.lastStatus||"Resuming...",position:_.position??{x:window.innerWidth/2,y:window.innerHeight/2}};r(W=>new Map(W).set(_.id,$)),C?.onResume?.($);let V=new AbortController;i.set(_.id,V);let G=C.provider.resume(_.id,V.signal,p);pe(_,G);}},Qe=async p=>{let{elements:P,prompt:k,position:A,selectionBounds:N,sessionId:_,agent:D}=p,$=D??(_?z(_):C),V=$?.storage;if(!$?.provider||P.length===0)return;let G=P[0],W=_?n().get(_):void 0,ce=!!_,ge={content:W?W.context.content:(await Dn(P,{maxLines:1/0})).filter(we=>we.trim()),prompt:k,options:$?.getOptions?.(),sessionId:ce?_:void 0},ne;if(W)ne=xt(W,{context:ge,isStreaming:true,lastStatus:"Thinking\u2026"},V);else {let we=P.length>1?`${P.length} elements`:(G.tagName||"").toLowerCase()||void 0,$e=P.length>1?void 0:await cn(G)||void 0;ne=pa(ge,A,N,we,$e),ne.lastStatus="Thinking\u2026";}g.set(ne.id,{elements:P,agent:$}),r(we=>new Map(we).set(ne.id,ne)),Lo(ne,V),$.onStart?.(ne,P);let le=new AbortController;i.set(ne.id,le);let he={...ge,sessionId:_??ne.id},De;try{De=t?.transformAgentContext?await t.transformAgentContext(he,P):he;}catch(we){let $e=we instanceof Error?we.message:"Context transformation failed",Kt=xt(ne,{error:$e,isStreaming:false},V);r(Ut=>new Map(Ut).set(ne.id,Kt)),i.delete(ne.id),we instanceof Error&&$.onError?.(we,Kt);return}let We=$.provider.send(De,le.signal);pe(ne,We,$);},et=p=>{if(p){let P=i.get(p);P&&P.abort();}else i.forEach(P=>P.abort()),i.clear(),u.forEach(P=>clearTimeout(P)),u.clear(),g.clear(),I.length=0,T.length=0,r(new Map),Ho(C?.storage),b();},He=(p,P,k)=>{let N=n().get(p),_=P??z(p),D=k??B(p);if(N?.isFading)return;N&&D.length>0&&_?.onDismiss?.(N,D),r(G=>{let W=new Map(G),ce=W.get(p);return ce&&W.set(p,{...ce,isFading:true}),W});let $=u.get(p);$&&clearTimeout($);let V=setTimeout(()=>{u.delete(p),g.delete(p),Xr(p,_?.storage),r(G=>{let W=new Map(G);return W.delete(p),W});},150);u.set(p,V);};return {sessions:n,isProcessing:X,canUndo:a,canRedo:s,session:{start:Qe,abort:et,dismiss:He,retry:p=>{let k=n().get(p),A=z(p);if(!k||!A?.provider)return;let N=A.storage,_=B(p),D=xt(k,{error:void 0,isStreaming:true,lastStatus:"Retrying\u2026"},N);r(W=>new Map(W).set(p,D)),Lo(D,N),_.length>0&&A.onStart?.(D,_);let $=new AbortController;i.set(p,$);let V={...D.context,sessionId:p},G=A.provider.send(V,$.signal);pe(D,G,A);},undo:p=>{let k=n().get(p),A=z(p),N=B(p);if(k){T.push({session:k,elements:N,agent:A});let _=I.findIndex(D=>D.session.id===p);_!==-1&&I.splice(_,1),A?.onUndo?.(k,N),A?.provider?.undo?.();}He(p,A,N),b(A);},getElement:p=>B(p)[0],getElements:p=>B(p),tryResume:Oe,acknowledgeError:p=>{let A=n().get(p)?.context.prompt;return He(p),A}},history:{undo:()=>{let p=I.pop();if(!p)return;let{session:P,elements:k,agent:A}=p,N=A??C;T.push(p),N?.onUndo?.(P,k),N?.provider?.undo?.(),He(P.id,N,k),b(N);},redo:()=>{let p=T.pop();if(!p)return;let P=p.agent??C,{session:k,elements:A}=p;P?.provider?.redo?.();let N=A.filter(_=>document.contains(_));if(N.length===0){let _=ie(k);_&&(N=[_]);}if(N.length>0&&P){I.push(p);let _=N.map($=>me($)),D={...k,selectionBounds:_};g.set(k.id,{elements:N,agent:P}),r($=>new Map($).set(k.id,D));}b(P);}},_internal:{updateBoundsOnViewportChange:()=>{let p=n();if(p.size===0)return;let P=new Map(p),k=false;for(let[A,N]of p){let _=B(A),D=_[0];if(D&&document.contains(D)){let $=_.filter(V=>document.contains(V)).map(V=>me(V));if($.length>0){let V=N.selectionBounds[0],G=$[0],W=N.position;if(V&&G){let ce=V.x+V.width/2,Ce=V.width/2,ge=N.position.x-ce,ne=Ce>0?ge/Ce:0,le=G.x+G.width/2,he=G.width/2;W={...N.position,x:le+ne*he};}P.set(A,{...N,selectionBounds:$,position:W}),k=true;}}}k&&r(P);},setOptions:h,getOptions:F}}};var ga=(e,t)=>{let n=[],r=(u,g)=>{let T=t(u),I=Br(T.x+T.width/2,T.y+T.height/2).filter(e),C=I.indexOf(u);return C===-1?null:I[C+g]??null},a=u=>{let g=r(u,1);return g&&n.push(u),g},l=u=>{if(n.length>0){let g=n.pop();if(document.contains(g))return g}return r(u,-1)},s=(u,g)=>{let T=z=>{let B=Array.from(z.children),b=g?B:B.reverse();for(let h of b)if(g){if(e(h))return h;let F=T(h);if(F)return F}else {let F=T(h);if(F)return F;if(e(h))return h}return null},I=z=>g?z.nextElementSibling:z.previousElementSibling,C=null;if(g&&(C=T(u)),!C){let z=u;for(;z;){let B=I(z);for(;B;){let h=T(B);if(h){C=h;break}if(e(B)){C=B;break}B=I(B);}if(C)break;let b=z.parentElement;if(!g&&b&&e(b)){C=b;break}z=b;}}return C};return {findNext:(u,g)=>{switch(u){case "ArrowUp":return a(g);case "ArrowDown":return l(g);case "ArrowRight":return s(g,true);case "ArrowLeft":return s(g,false);default:return null}},clearHistory:()=>{n=[];}}};var ha=e=>{let t=da(e.activationKey);return {metaKey:t.metaKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey}},ba=()=>{let e=new WeakSet,t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,"key"),n=false;if(t?.get&&!t.get.__reactGrabPatched){n=true;let a=t.get,l=function(){return e.has(this)?"":a.call(this)};l.__reactGrabPatched=true,Object.defineProperty(KeyboardEvent.prototype,"key",{get:l,configurable:true});}return {claimedEvents:e,originalKeyDescriptor:t,didPatch:n,restore:()=>{n&&t&&Object.defineProperty(KeyboardEvent.prototype,"key",t);}}};var Zr=(e,t)=>({top:t<25,bottom:t>window.innerHeight-25,left:e<25,right:e>window.innerWidth-25}),ya=(e,t)=>{let n=null,r=()=>{if(!t()){l();return}let f=e(),i=Zr(f.x,f.y);i.top&&window.scrollBy(0,-10),i.bottom&&window.scrollBy(0,10),i.left&&window.scrollBy(-10,0),i.right&&window.scrollBy(10,0),i.top||i.bottom||i.left||i.right?n=requestAnimationFrame(r):n=null;},a=()=>{r();},l=()=>{n!==null&&(cancelAnimationFrame(n),n=null);};return {start:a,stop:l,isActive:()=>n!==null}};var Sa=()=>{let e=globalThis;return !!(e.chrome?.runtime?.id||e.browser?.runtime?.id)};var wa=()=>{try{let e="0.1.0",t=`data:image/svg+xml;base64,${btoa(chunkGJYSUTIS_cjs.xa)}`;console.log(`%cReact Grab${e?` v${e}`:""}%c
53
+ https://react-grab.com`,`background: #330039; color: #ffffff; border: 1px solid #d75fcb; padding: 4px 4px 4px 24px; border-radius: 4px; background-image: url("${t}"); background-size: 16px 16px; background-repeat: no-repeat; background-position: 4px center; display: inline-block; margin-bottom: 4px;`,""),navigator.onLine&&e&&!Sa()&&fetch(`https://www.react-grab.com/api/version?source=browser&t=${Date.now()}`,{referrerPolicy:"origin",keepalive:!0,priority:"low",cache:"no-store"}).then(n=>n.text()).then(n=>{n&&n!==e&&console.warn(`[React Grab] v${e} is outdated (latest: v${n})`);}).catch(()=>null);}catch{}};var Ea=e=>{if("scheduler"in globalThis){globalThis.scheduler.postTask(e,{priority:"background"});return}if(typeof window<"u"&&"requestIdleCallback"in window){requestIdleCallback(e);return}setTimeout(e,0);};var va=()=>{if(typeof window>"u")return null;try{let e=document.currentScript?.getAttribute("data-options");return e?JSON.parse(e):null}catch{return null}};var Vt=e=>e==="Enter"||e==="NumpadEnter";var Ca={name:"copy",actions:[{id:"copy",label:"Copy",shortcut:"C",onAction:e=>{e.copy?.();}}]};var xa={name:"screenshot",actions:[{id:"screenshot",label:"Screenshot",shortcut:"S",enabled:()=>No(),onAction:async e=>{let t=e.elements.map(r=>{let a=r.getBoundingClientRect();return {x:a.x+window.scrollX,y:a.y+window.scrollY,width:a.width,height:a.height}}),n=fn(t);n.width===0||n.height===0||await e.performWithFeedback(async()=>{e.hideOverlay(),await Io(chunkGJYSUTIS_cjs.Q);try{let r=await _o(n),a=await e.hooks.transformScreenshot(r,e.elements,n);return await Do(a)}finally{e.showOverlay();}});}}]};var Ta={name:"copy-html",actions:[{id:"copy-html",label:"Copy HTML",onAction:async e=>{await e.performWithFeedback(async()=>{let n=e.elements.filter(a=>a instanceof HTMLElement).map(a=>a.outerHTML).join(`
54
+
55
+ `),r=await e.hooks.transformHtmlContent(n,e.elements);return r?(await navigator.clipboard.writeText(r),true):false});}}]};var Aa={name:"open",actions:[{id:"open",label:"Open",shortcut:"O",enabled:e=>!!e.filePath,onAction:e=>{if(!e.filePath)return;if(!e.hooks.onOpenFile(e.filePath,e.lineNumber)){let n=on(e.filePath,e.lineNumber),r=e.hooks.transformOpenFileUrl(n,e.filePath,e.lineNumber);window.open(r,"_blank","noopener,noreferrer");}e.hideContextMenu(),e.cleanup();}}]};var Pa={name:"comment",actions:[{id:"comment",label:"Comment",shortcut:"Enter",onAction:e=>{e.enterPromptMode?.();}}]};var Nu=[Ca,Pa,xa,Ta,Aa],Jr=false,Tt=new Set,Hg=e=>{if(typeof window>"u")return jr();let t=va(),n={enabled:true,activationMode:"toggle",keyHoldDuration:75,allowActivationInsideInput:true,maxContextLines:3,...t,...e};if(n.enabled===false||Jr)return jr();Jr=true,wa();let{enabled:r,...a}=n;return chunkGJYSUTIS_cjs.c(l=>{let s=ma(a),f=()=>{for(let o of s.store.actions)if(o.agent?.provider)return o.agent},{store:i,actions:u}=ti({theme:$t,hasAgentProvider:!!f()?.provider,keyHoldDuration:s.store.options.keyHoldDuration??75}),g=chunkGJYSUTIS_cjs.g(()=>i.current.state==="holding"),T=chunkGJYSUTIS_cjs.g(()=>i.current.state==="active");chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(T,(o,c)=>{o&&!c?(vo(),go(),document.body.style.touchAction="none"):!o&&c&&(Co(),ho(),document.body.style.touchAction="");}));let I=chunkGJYSUTIS_cjs.g(()=>i.current.state==="active"&&i.current.phase==="frozen"),C=chunkGJYSUTIS_cjs.g(()=>i.current.state==="active"&&i.current.phase==="dragging"),z=chunkGJYSUTIS_cjs.g(()=>i.current.state==="active"&&i.current.phase==="justDragged"),B=chunkGJYSUTIS_cjs.g(()=>i.current.state==="copying"),b=chunkGJYSUTIS_cjs.g(()=>i.current.state==="justCopied"),h=chunkGJYSUTIS_cjs.g(()=>i.current.state==="active"&&i.current.isPromptMode),F=chunkGJYSUTIS_cjs.g(()=>i.pendingCommentMode||h()),X=chunkGJYSUTIS_cjs.g(()=>i.current.state==="active"&&i.current.isPromptMode&&i.current.isPendingDismiss),pe=It(),[ie,Oe]=chunkGJYSUTIS_cjs.d(pe?.enabled??true),[Qe,et]=chunkGJYSUTIS_cjs.d(0),[He,Ie]=chunkGJYSUTIS_cjs.d(pe),[H,M]=chunkGJYSUTIS_cjs.d(false),S=chunkGJYSUTIS_cjs.g(()=>i.pendingAbortSessionId),m=chunkGJYSUTIS_cjs.g(()=>i.hasAgentProvider),y=()=>{W!==null&&(clearTimeout(W),W=null);},v=()=>{Ce=false,ge=false,ce=null;};chunkGJYSUTIS_cjs.f(()=>{if(i.current.state!=="holding"){y();return}ce=Date.now(),W=window.setTimeout(()=>{if(W=null,Ce){ge=true;return}u.activate();},i.keyHoldDuration),chunkGJYSUTIS_cjs.l(y);}),chunkGJYSUTIS_cjs.f(()=>{if(i.current.state!=="active"||i.current.phase!=="justDragged")return;let o=setTimeout(()=>{u.finishJustDragged();},1500);chunkGJYSUTIS_cjs.l(()=>clearTimeout(o));}),chunkGJYSUTIS_cjs.f(()=>{if(i.current.state!=="justCopied")return;let o=setTimeout(()=>{u.finishJustCopied();},1500);chunkGJYSUTIS_cjs.l(()=>clearTimeout(o));});let R=false;chunkGJYSUTIS_cjs.f(()=>{let o=g(),c=T();R&&!o&&c&&(s.store.options.activationMode!=="hold"&&u.setWasActivatedByToggle(true),s.hooks.onActivate()),R=o;});let p=new WeakMap,P=o=>{let c=p.get(o);u.setInputText(c??"");},k=(o,c,d)=>{N(o,c,d),P(o);},A=()=>{let o=i.frozenElement||U();o&&u.enterPromptMode({x:i.pointer.x,y:i.pointer.y},o);},N=(o,c,d)=>(u.setCopyStart({x:c,y:d},o),me(o)),_=0,D=null,[$,V]=chunkGJYSUTIS_cjs.d(null),G=null,W=null,ce=null,Ce=false,ge=false,ne=false,le=false,he=null,De=0,We=0,we=null,$e=null,[Kt,Ut]=chunkGJYSUTIS_cjs.d(null),[Ko,mn]=chunkGJYSUTIS_cjs.d(void 0),At=ga(yt,me),Ke=ya(()=>i.pointer,()=>C()),Ue=chunkGJYSUTIS_cjs.g(()=>T()&&!B()),jt=chunkGJYSUTIS_cjs.g(()=>s.store.theme.enabled&&s.store.theme.crosshair.enabled&&Ue()&&!C()&&!i.isTouchMode&&!I()&&!h()&&i.contextMenuPosition===null),Gt=new Map,Pt=(o,c)=>{let d=`grabbed-${Date.now()}-${Math.random()}`,w=Date.now(),E={id:d,bounds:o,createdAt:w,element:c};u.addGrabbedBox(E),s.hooks.onGrabbedBox(o,c);let O=window.setTimeout(()=>{Gt.delete(d),u.removeGrabbedBox(d);},1500);Gt.set(d,O);},Re=async o=>{let c=await Promise.all(o.map(async d=>{let w=await Et(d),E=null,O,j,Q;if(w&&w.length>0)for(let J of w){let Ee=J.functionName&&ln(J.functionName),Te=J.fileName&&wt(J.fileName);if(Ee&&!E&&(E=J.functionName),Te&&!O&&(O=St(J.fileName),j=J.lineNumber||void 0,Q=J.columnNumber||void 0),E&&O)break}E||(E=Ao(d));let oe=d instanceof HTMLElement?d.innerText?.slice(0,100):void 0;return {tagName:vt(d),id:d.id||void 0,className:d.getAttribute("class")||void 0,textContent:oe,componentName:E??void 0,filePath:O,lineNumber:j,columnNumber:Q}}));window.dispatchEvent(new CustomEvent("react-grab:element-selected",{detail:{elements:c}}));},Mt=(o,c,d,w,E,O,j,Q)=>{u.clearLabelInstances();let oe=`label-${Date.now()}-${Math.random().toString(36).slice(2)}`,J=o.x+o.width/2,Ee=o.width/2,Te=O!==void 0?O-J:void 0,qe={id:oe,bounds:o,boundsMultiple:Q,tagName:c,componentName:d,status:w,createdAt:Date.now(),element:E,elements:j,mouseX:O,mouseXOffsetFromCenter:Te,mouseXOffsetRatio:Te!==void 0&&Ee>0?Te/Ee:void 0};return u.addLabelInstance(qe),oe},Ye=(o,c,d)=>{u.updateLabelInstance(o,c,d);},Wt=o=>{Xe.delete(o),u.removeLabelInstance(o);},Xe=new Map,Ln=o=>{let c=Xe.get(o);c!==void 0&&(window.clearTimeout(c),Xe.delete(o));},Yt=o=>{Ln(o);let c=window.setTimeout(()=>{Xe.delete(o),Ye(o,"fading"),setTimeout(()=>{Wt(o);},150);},1500);Xe.set(o,c);},Bn=(o,c)=>{if(c)Ln(o);else {let d=i.labelInstances.find(w=>w.id===o);d&&d.status==="copied"&&Yt(o);}},x=async(o,c,d,w,E,O,j,Q,oe)=>{le=false,u.startCopy();let J=w&&E?Mt(w,E,O,"copying",j,o,oe):null;await d().finally(()=>{u.completeCopy(j),J&&(Ye(J,"copied"),Yt(J)),Q?de():(u.activate(),le=true,he!==null&&window.clearTimeout(he),he=window.setTimeout(()=>{le=false,he=null;},1500));});},L=(o,c)=>{let d=o[0],w=d?Ao(d):null,E=d?vt(d):null,O=w??E??void 0;return la({maxContextLines:s.store.options.maxContextLines,getContent:s.store.options.getContent,componentName:O},{onBeforeCopy:s.hooks.onBeforeCopy,transformSnippet:s.hooks.transformSnippet,transformCopyContent:s.hooks.transformCopyContent,onAfterCopy:s.hooks.onAfterCopy,onCopySuccess:s.hooks.onCopySuccess,onCopyError:s.hooks.onCopyError},o,c)},Y=async(o,c)=>{if(o.length!==0){for(let d of o)s.hooks.onElementSelect(d),s.store.theme.grabbedBoxes.enabled&&Pt(me(d),d);await new Promise(d=>requestAnimationFrame(d)),await L(o,c),Re(o);}},q=({element:o,positionX:c,positionY:d,elements:w,extraPrompt:E,shouldDeactivateAfter:O,onComplete:j,dragRect:Q})=>{let oe=w??[o],J=Q??i.frozenDragRect,Ee;J&&oe.length>1?Ee=Po(J):Ee=kn(me(o));let Te=oe.length>1?Ee.x+Ee.width/2:c,qe=vt(o);cn(o).then(je=>{x(Te,d,()=>Y(oe,E),Ee,qe,je??void 0,o,O,w).then(()=>{j?.();});});},U=chunkGJYSUTIS_cjs.g(()=>{if(!Ue()||C())return null;let o=i.detectedElement;return o&&!document.contains(o)?null:o}),Z=chunkGJYSUTIS_cjs.g(()=>i.frozenElement||(I()?null:U()));chunkGJYSUTIS_cjs.f(()=>{let o=i.detectedElement;if(!o)return;let c=setInterval(()=>{document.contains(o)||u.setDetectedElement(null);},100);chunkGJYSUTIS_cjs.l(()=>clearInterval(c));}),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>Z(),o=>{if(we!==null&&clearTimeout(we),!o){Ut(null);return}we=window.setTimeout(()=>{we=null,Ut(o);},100),chunkGJYSUTIS_cjs.l(()=>{we!==null&&(clearTimeout(we),we=null);});})),chunkGJYSUTIS_cjs.f(()=>{let o=i.frozenElements,c=xi(o);chunkGJYSUTIS_cjs.l(c);}),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(T,o=>{if(!o||!s.store.options.freezeReactUpdates)return;let c=mo();chunkGJYSUTIS_cjs.l(c);}));let K=()=>{if(i.isTouchMode&&C()){let c=i.detectedElement;return !c||Nn(c)?void 0:c}let o=Z();if(!(!o||Nn(o)))return o},ue=()=>{if(i.isTouchMode&&C()){let c=i.detectedElement;return !c||Nn(c)?false:Ue()}let o=Z();return !o||Nn(o)?false:Ue()&&!C()},be=chunkGJYSUTIS_cjs.g(()=>{i.viewportVersion;let o=i.frozenElements;if(o.length>0){let d=o[0];if(o.length===1&&d)return me(d);let w=i.frozenDragRect;if(w)return Po(w);let E=o.filter(O=>O!==null).map(O=>me(O));return kn(fn(E))}let c=K();if(c)return me(c)}),ye=chunkGJYSUTIS_cjs.g(()=>{i.viewportVersion;let o=i.frozenElements;if(o.length===0)return [];let c=i.frozenDragRect;return c&&o.length>1?[Po(c)]:o.filter(d=>d!==null).map(d=>me(d))}),xe=chunkGJYSUTIS_cjs.g(()=>i.frozenElements.length),ke=(o,c)=>{let d=o+window.scrollX,w=c+window.scrollY;return {x:Math.abs(d-i.dragStart.x),y:Math.abs(w-i.dragStart.y)}},Ne=chunkGJYSUTIS_cjs.g(()=>{if(!C())return false;let o=ke(i.pointer.x,i.pointer.y);return o.x>2||o.y>2}),ze=(o,c)=>{let d=o+window.scrollX,w=c+window.scrollY,E=Math.min(i.dragStart.x,d),O=Math.min(i.dragStart.y,w),j=Math.abs(d-i.dragStart.x),Q=Math.abs(w-i.dragStart.y);return {x:E-window.scrollX,y:O-window.scrollY,width:j,height:Q}},_e=chunkGJYSUTIS_cjs.g(()=>{if(i.viewportVersion,!Ne())return;let o=ze(i.pointer.x,i.pointer.y);return {borderRadius:"0px",height:o.height,transform:"none",width:o.width,x:o.x,y:o.y}}),Fe=chunkGJYSUTIS_cjs.g(()=>{if(i.viewportVersion,!Ne())return [];let o=$();if(!o)return [];let c=ze(o.x,o.y),d=In(c,yt);return (d.length>0?d:In(c,yt,false)).map(E=>me(E))}),re=chunkGJYSUTIS_cjs.g(()=>{let o=Fe();return o.length>0?o:ye()}),dt=chunkGJYSUTIS_cjs.g(()=>{if(B()||h()){i.viewportVersion;let o=i.frozenElement||U();if(o){let c=me(o);return {x:dn(c).x+i.copyOffsetFromCenterX,y:i.copyStart.y}}return {x:i.copyStart.x,y:i.copyStart.y}}return {x:i.pointer.x,y:i.pointer.y}});chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[U(),i.lastGrabbedElement],([o,c])=>{c&&o&&c!==o&&u.setLastGrabbed(null),o&&s.hooks.onElementHover(o);})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>U(),o=>{let c=++De,d=()=>{De===c&&u.setSelectionSource(null,null);};if(!o){d();return}Et(o).then(w=>{if(De===c&&w){for(let E of w)if(E.fileName&&wt(E.fileName)){u.setSelectionSource(St(E.fileName),E.lineNumber??null);return}d();}}).catch(()=>{De===c&&u.setSelectionSource(null,null);});})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>i.viewportVersion,()=>Se._internal.updateBoundsOnViewportChange())),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[T(),C(),B(),h(),jt(),U(),_e(),i.grabbedBoxes,s.store.theme.enabled,s.store.theme.selectionBox.enabled,s.store.theme.dragBox.enabled,Ne(),Z(),b(),He()],([o,c,d,w,E,O,j,Q,oe,J,Ee,Te,qe,je,mt])=>{let hn=!!(oe&&J&&o&&!d&&!je&&!c&&qe!=null),bn=!!(oe&&Ee&&o&&!d&&Te);s.hooks.onStateChange({isActive:o,isDragging:c,isCopying:d,isPromptMode:w,isCrosshairVisible:E??false,isSelectionBoxVisible:hn,isDragBoxVisible:bn,targetElement:O,dragBounds:j?{x:j.x,y:j.y,width:j.width,height:j.height}:null,grabbedBoxes:Q.map(qo=>({id:qo.id,bounds:qo.bounds,createdAt:qo.createdAt})),selectionFilePath:i.selectionFilePath,toolbarState:mt});})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[h(),i.pointer.x,i.pointer.y,U()],([o,c,d,w])=>{s.hooks.onPromptModeChange(o,{x:c,y:d,targetElement:w});})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[Wo(),be(),U()],([o,c,d])=>{s.hooks.onSelectionBox(!!o,c??null,d);})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[Yo(),_e()],([o,c])=>{s.hooks.onDragBox(!!o,c??null);})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[jt(),i.pointer.x,i.pointer.y],([o,c,d])=>{s.hooks.onCrosshair(!!o,{x:c,y:d});})),chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[sl(),rl(),dt(),U(),i.selectionFilePath,i.selectionLineNumber],([o,c,d,w,E,O])=>{s.hooks.onElementLabel(!!o,c,{x:d.x,y:d.y,content:"",element:w??void 0,tagName:w&&vt(w)||void 0,filePath:E??void 0,lineNumber:O??void 0});}));let Le=null,Ot=o=>{o?(Le||(Le=document.createElement("style"),Le.setAttribute("data-react-grab-cursor",""),document.head.appendChild(Le)),Le.textContent=`* { cursor: ${o} !important; }`):Le&&(Le.remove(),Le=null);};chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>[T(),B(),h()],([o,c,d])=>{Ot(c?"progress":o&&!d?"crosshair":null);}));let st=()=>{let o=g();u.activate(),o||s.hooks.onActivate();},de=()=>{let o=C(),c=i.previouslyFocusedElement;u.deactivate(),At.clearHistory(),$e=null,o&&(document.body.style.userSelect=""),G&&window.clearTimeout(G),Ke.stop(),c instanceof HTMLElement&&document.contains(c)&&c.focus(),s.hooks.onDeactivate();},Rt=()=>{u.setWasActivatedByToggle(true),st();},pn=(o,c,d)=>{let w=c[0];if(w&&document.contains(w)){let E=w.getBoundingClientRect(),O=E.top+E.height/2;u.setPointer({x:o.position.x,y:O}),u.setFrozenElements(c),u.setInputText(o.context.prompt),u.setWasActivatedByToggle(true),d&&u.setSelectedAgent(d),T()||st();}},gn=o=>({...o,onAbort:(c,d)=>{o.onAbort?.(c,d),pn(c,d,o);},onUndo:(c,d)=>{o.onUndo?.(c,d),pn(c,d,o);}}),Xt=()=>{let o=f();if(o)return gn(o)},Se=qr(Xt(),{transformAgentContext:s.hooks.transformAgentContext}),_a=o=>{u.setInputText(o);},Qr=()=>{u.setLastCopied(null);let o=[...i.frozenElements],c=i.frozenElement||U(),d=h()?i.inputText.trim():"";if(!c){de();return}let w=o.length>0?o:c?[c]:[],E=w.map(J=>me(J)),O=E[0],j=O.x+O.width/2,Q=O.y+O.height/2,oe=j+i.copyOffsetFromCenterX;if((i.selectedAgent||m())&&d){p.delete(c);let J=i.replySessionId,Ee=i.selectedAgent;de(),u.setReplySessionId(null),u.clearSelectedAgent(),Se.session.start({elements:w,prompt:d,position:{x:oe,y:Q},selectionBounds:E,sessionId:J??void 0,agent:Ee?gn(Ee):void 0});return}u.setPointer({x:j,y:Q}),u.exitPromptMode(),u.clearInputText(),u.clearReplySessionId(),d?p.set(c,d):p.delete(c),q({element:c,positionX:oe,positionY:Q,elements:w,extraPrompt:d||void 0,onComplete:de});},Uo=()=>{if(u.setLastCopied(null),!h())return;let o=i.inputText.trim();if(o&&!X()){u.setPendingDismiss(true);return}let c=i.frozenElement||U();c&&o&&p.set(c,o),u.clearInputText(),u.clearReplySessionId(),de();},Da=()=>{u.clearInputText(),u.clearReplySessionId(),de();},Na=()=>{u.setPendingDismiss(false);},Ia=(o,c)=>{u.setPendingAbortSessionId(null),c&&Se.session.abort(o);},ka=()=>{let o=i.frozenElement||U();o&&k(o,i.pointer.x,i.pointer.y),A();},Fa=(o,c)=>{let d=Se.sessions().get(o),w=Se.session.getElements(o),E=d?.selectionBounds??[],O=E[0];if(d&&w.length>0&&O){let j=d.position.x,Q=d.context.sessionId??o;Se.session.dismiss(o),Se.session.start({elements:w,prompt:c,position:{x:j,y:O.y+O.height/2},selectionBounds:E,sessionId:Q});}},La=o=>{let c=Se.session.acknowledgeError(o);c&&u.setInputText(c);},Ba=()=>{T()?de():ie()&&Rt();},es=(o,c,d)=>{u.setPendingCommentMode(false),P(o),u.enterPromptMode({x:c,y:d},o);},Ha=()=>{if(!ie())return;if(T()&&F()){de();return}u.setPendingCommentMode(true),T()||Rt();},$a=()=>{let o=!ie();Oe(o);let c=It(),d={edge:c?.edge??"bottom",ratio:c?.ratio??.5,collapsed:c?.collapsed??false,enabled:o};Tn(d),Ie(d),Tt.forEach(w=>w(d)),o||(g()&&u.release(),T()&&de(),he!==null&&(window.clearTimeout(he),he=null),le=false);},za=(o,c)=>{if(!ie()||h()||I()||i.contextMenuPosition!==null)return;u.setPointer({x:o,y:c});let d=performance.now();if(d-_>=32&&(_=d,Ea(()=>{let w=an(o,c);u.setDetectedElement(w);})),C()){D!==null&&clearTimeout(D),V(null),D=window.setTimeout(()=>{V({x:o,y:c}),D=null;},32);let w=Zr(o,c),E=w.top||w.bottom||w.left||w.right;E&&!Ke.isActive()?Ke.start():!E&&Ke.isActive()&&Ke.stop();}},Va=(o,c)=>!Ue()||B()?false:(u.startDrag({x:o,y:c}),u.setPointer({x:o,y:c}),document.body.style.userSelect="none",D!==null&&clearTimeout(D),V(null),D=window.setTimeout(()=>{V({x:o,y:c}),D=null;},32),s.hooks.onDragStart(o+window.scrollX,c+window.scrollY),true),Ka=(o,c)=>{let d=In(o,yt),w=d.length>0?d:In(o,yt,false);if(w.length===0)return;Rn(w),s.hooks.onDragEnd(w,o);let E=w[0],O=dn(me(E));u.setPointer(O),u.setFrozenElements(w);let j=Wr(o);if(u.setFrozenDragRect(j),u.freeze(),u.setLastGrabbed(E),i.pendingCommentMode){es(E,O.x,O.y);return}let Q=i.wasActivatedByToggle&&!c;q({element:E,positionX:O.x,positionY:O.y,elements:w,shouldDeactivateAfter:Q,dragRect:j});},Ua=(o,c,d)=>{let w=i.frozenElement&&document.contains(i.frozenElement)?i.frozenElement:null,E=$e&&document.contains($e)?$e:null,O=w??E??an(o,c)??(i.detectedElement&&document.contains(i.detectedElement)?i.detectedElement:null);if(!O)return;let j=!w&&E===O,Q,oe;if(w)Q=i.pointer.x,oe=i.pointer.y;else if(j){let Ee=dn(me(O));Q=Ee.x,oe=Ee.y;}else Q=o,oe=c;if($e=null,i.pendingCommentMode){es(O,Q,oe);return}let J=i.wasActivatedByToggle&&!d;u.setLastGrabbed(O),q({element:O,positionX:Q,positionY:oe,shouldDeactivateAfter:J});},ja=(o,c,d)=>{if(!C())return;D!==null&&(clearTimeout(D),D=null),V(null);let w=ke(o,c),E=w.x>2||w.y>2,O=E?ze(o,c):null;E?u.endDrag():u.cancelDrag(),Ke.stop(),document.body.style.userSelect="",O?Ka(O,d):Ua(o,c,d);},Ae=ia(),Hn=ba(),qt=o=>{let c;try{c=Hn.originalKeyDescriptor?.get?Hn.originalKeyDescriptor.get.call(o):o.key;}catch{return false}let d=c==="Enter"||Vt(o.code),w=T()||g();return d&&w&&!h()&&!i.wasActivatedByToggle?(Hn.claimedEvents.add(o),o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),true):false};Ae.addDocumentListener("keydown",qt,{capture:true}),Ae.addDocumentListener("keyup",qt,{capture:true}),Ae.addDocumentListener("keypress",qt,{capture:true});let Ga=o=>{if(!(o.code==="KeyZ"&&(o.metaKey||o.ctrlKey))||Array.from(Se.sessions().values()).some(E=>!E.isStreaming&&!E.error))return false;let w=o.shiftKey;return w&&Se.canRedo()?(o.preventDefault(),o.stopPropagation(),Se.history.redo(),true):!w&&Se.canUndo()?(o.preventDefault(),o.stopPropagation(),Se.history.undo(),true):false},ts=o=>{if(!T()||h()||!chunkGJYSUTIS_cjs.V.has(o.key))return false;let c=Z(),d=!c;if(!c){let Q=window.innerWidth/2,oe=window.innerHeight/2;c=an(Q,oe);}if(!c)return false;let w=At.findNext(o.key,c);if(!w&&!d)return false;let E=w??c;o.preventDefault(),o.stopPropagation(),u.setFrozenElement(E),u.freeze(),$e=E;let O=me(E),j=dn(O);return u.setPointer(j),i.contextMenuPosition!==null&&u.showContextMenu(j,E),true},Wa=o=>{if(!Vt(o.code))return false;let c=i.lastCopiedElement;if(!g()&&!h()&&!T()&&c&&document.contains(c)&&!i.labelInstances.some(E=>E.status==="copied"||E.status==="fading")&&c){o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation();let E=dn(me(c));return u.setPointer(E),k(c,E.x,E.y),u.setFrozenElement(c),u.setLastCopied(null),A(),T()||st(),true}if(g()&&!h()){o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation();let E=i.frozenElement||U(),O=i.pointer.x,j=i.pointer.y;return E&&k(E,O,j),u.setPointer({x:O,y:j}),E&&u.setFrozenElement(E),A(),G!==null&&(window.clearTimeout(G),G=null),T()||st(),true}return false},Ya=o=>{if(o.key?.toLowerCase()!=="o"||h()||!T()||!(o.metaKey||o.ctrlKey))return false;let c=i.selectionFilePath,d=i.selectionLineNumber;if(!c)return false;if(o.preventDefault(),o.stopPropagation(),!s.hooks.onOpenFile(c,d??void 0)){let E=on(c,d??void 0),O=s.hooks.transformOpenFileUrl(E,c,d??void 0);window.open(O,"_blank","noopener,noreferrer");}return true},Xa=o=>{if(!No()||i.contextMenuPosition!==null||o.key?.toLowerCase()!=="s"||h()||!T()||!(o.metaKey||o.ctrlKey))return false;let c=ye(),d=be(),w=i.frozenElement||U(),E=c.length>1?fn(c):d;if(!E)return false;o.preventDefault(),o.stopPropagation();let O=w&&vt(w)||"element",j=i.wasActivatedByToggle,Q=kn(E),oe=c.length>1?c:d?[d]:[],J=Mt(Q,O,void 0,"copying",w??void 0,E.x+E.width/2,void 0,oe);ne=true,Dt.style.visibility="hidden";let Ee=i.frozenElements.length>0?[...i.frozenElements]:w?[w]:[];return (async()=>{await Io(chunkGJYSUTIS_cjs.Q);let Te=false,qe;try{let je=await _o(E),mt=await s.hooks.transformScreenshot(je,Ee,E);Te=await Do(mt),Te||(qe="Failed to copy");}catch(je){qe=je instanceof Error&&je.message?je.message:"Screenshot failed";}ne=false,Dt.style.visibility="",Ye(J,Te?"copied":"error",Te?void 0:qe||"Unknown error"),Yt(J),j?de():u.unfreeze();})(),true},qa=o=>{if(!(!s.store.options.allowActivationInsideInput&&chunkGJYSUTIS_cjs.ya(o))&&!(!Ro(o,s.store.options)&&(T()&&!i.wasActivatedByToggle&&(o.metaKey||o.ctrlKey)&&!chunkGJYSUTIS_cjs.U.includes(o.key)&&!Vt(o.code)&&de(),!Vt(o.code)||!g()))){if((T()||g())&&!h()&&(o.preventDefault(),Vt(o.code)&&(o.stopPropagation(),o.stopImmediatePropagation())),T()){if(i.wasActivatedByToggle&&s.store.options.activationMode!=="hold"||o.repeat)return;G!==null&&window.clearTimeout(G),G=window.setTimeout(()=>{de();},200);return}if(g()&&o.repeat){if(Ce){let c=ge;v(),c&&u.activate();}return}if(!(B()||b())&&!g()){let d=s.store.options.keyHoldDuration??75;chunkGJYSUTIS_cjs.ya(o)?chunkGJYSUTIS_cjs.za(o)?d+=300:d+=150:chunkGJYSUTIS_cjs.Aa()&&(d+=300),v(),u.startHold(d);}}};Ae.addWindowListener("keydown",o=>{if(qt(o),!ie()){Ro(o,s.store.options)&&!o.repeat&&et(w=>w+1);return}if(Ga(o))return;let c=Vt(o.code)&&g()&&!h();if(h()&&Ro(o,s.store.options)&&!o.repeat){o.preventDefault(),o.stopPropagation(),Uo();return}let d=Ct(o,"data-react-grab-ignore-events")&&!c;if(h()||d)return o.key==="Escape"&&(S()?(o.preventDefault(),o.stopPropagation(),u.setPendingAbortSessionId(null)):i.wasActivatedByToggle&&!h()&&de()),d&&chunkGJYSUTIS_cjs.V.has(o.key)&&ts(o),void 0;if(o.key==="Escape"){if(S()){o.preventDefault(),o.stopPropagation(),u.setPendingAbortSessionId(null);return}if(Se.isProcessing())return;if(g()||i.wasActivatedByToggle){de();return}}ts(o)||Wa(o)||Ya(o)||Xa(o)||qa(o);},{capture:true}),Ae.addWindowListener("keyup",o=>{if(qt(o))return;let c=ha(s.store.options),d=c.metaKey||c.ctrlKey?chunkGJYSUTIS_cjs.Da()?!o.metaKey:!o.ctrlKey:c.shiftKey&&!o.shiftKey||c.altKey&&!o.altKey,w=s.store.options.activationKey?typeof s.store.options.activationKey=="function"?s.store.options.activationKey(o):Oo(s.store.options.activationKey)(o):Mo(o.key,o.code);if(b()||le){(w||d)&&(le=false,de());return}if(!g()&&!T()||h())return;let E=!!s.store.options.activationKey,O=s.store.options.activationMode==="hold";if(T()){let j=i.contextMenuPosition!==null;if(d){if(i.wasActivatedByToggle&&s.store.options.activationMode!=="hold"||j)return;de();}else if(O&&w){if(G!==null&&(window.clearTimeout(G),G=null),j)return;de();}else !E&&w&&G!==null&&(window.clearTimeout(G),G=null);return}if(w||d){if(i.wasActivatedByToggle&&s.store.options.activationMode!=="hold")return;if(g()||ge&&d){y();let oe=(ce?Date.now()-ce:0)>=200,J=ge&&oe&&(s.store.options.allowActivationInsideInput||!chunkGJYSUTIS_cjs.ya(o));v(),J?u.activate():u.release();}else de();}},{capture:true}),Ae.addDocumentListener("copy",()=>{g()&&(Ce=true);}),Ae.addWindowListener("keypress",qt,{capture:true}),Ae.addWindowListener("pointermove",o=>{if(!o.isPrimary)return;let c=o.pointerType==="touch";if(u.setTouchMode(c),Ct(o,"data-react-grab-ignore-events")||i.contextMenuPosition!==null)return;(c?g():T())&&!h()&&I()&&(u.unfreeze(),At.clearHistory()),za(o.clientX,o.clientY);},{passive:true}),Ae.addWindowListener("pointerdown",o=>{if(o.button!==0||!o.isPrimary||(u.setTouchMode(o.pointerType==="touch"),Ct(o,"data-react-grab-ignore-events"))||i.contextMenuPosition!==null)return;if(h()){let d=be();d&&o.clientX>=d.x&&o.clientX<=d.x+d.width&&o.clientY>=d.y&&o.clientY<=d.y+d.height?Qr():Uo();return}Va(o.clientX,o.clientY)&&(o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation());},{capture:true}),Ae.addWindowListener("pointerup",o=>{if(o.button!==0||!o.isPrimary||Ct(o,"data-react-grab-ignore-events")||i.contextMenuPosition!==null)return;let c=o.metaKey||o.ctrlKey;ja(o.clientX,o.clientY,c);},{capture:true}),Ae.addWindowListener("contextmenu",o=>{if(!Ue()||B()||h()||Ct(o,"data-react-grab-ignore-events"))return;if(i.contextMenuPosition!==null){o.preventDefault();return}o.preventDefault(),o.stopPropagation();let c=an(o.clientX,o.clientY);if(!c)return;let d=i.frozenElements;d.length>1&&d.includes(c)?Rn(d):(Rn([c]),u.setFrozenElement(c));let E={x:o.clientX,y:o.clientY};u.setPointer(E),u.freeze(),u.showContextMenu(E,c),s.hooks.onContextMenu(c,E);},{capture:true}),Ae.addWindowListener("pointercancel",o=>{o.isPrimary&&C()&&(u.cancelDrag(),Ke.stop(),document.body.style.userSelect="");}),Ae.addWindowListener("click",o=>{Ct(o,"data-react-grab-ignore-events")||i.contextMenuPosition===null&&(Ue()||B()||z())&&(o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),i.wasActivatedByToggle&&!B()&&!h()&&(g()?u.setWasActivatedByToggle(false):de()));},{capture:true}),Ae.addDocumentListener("visibilitychange",()=>{if(document.hidden){u.clearGrabbedBoxes();let o=i.activationTimestamp;T()&&!h()&&!ne&&o!==null&&Date.now()-o>500&&de();}});let Za=()=>{if(ie()&&!h()&&!I()&&!C()&&i.contextMenuPosition===null&&i.frozenElements.length===0){let o=an(i.pointer.x,i.pointer.y);u.setDetectedElement(o);}},ns=()=>{ei(),bo(),Ai(),Za(),u.incrementViewportVersion(),u.updateSessionBounds(),u.updateContextMenuPosition();};Ae.addWindowListener("scroll",ns,{capture:true});let jo=window.innerWidth,Go=window.innerHeight;Ae.addWindowListener("resize",()=>{let o=window.innerWidth,c=window.innerHeight;if(jo>0&&Go>0){let d=o/jo,w=c/Go,E=Math.abs(d-w)<chunkGJYSUTIS_cjs.ua,O=Math.abs(d-1)>chunkGJYSUTIS_cjs.ua;E&&O&&u.setPointer({x:i.pointer.x*d,y:i.pointer.y*w});}jo=o,Go=c,ns();});let _t=null,ft=null,Ja=()=>{let o=s.store.theme.enabled&&(T()||B()||i.labelInstances.length>0||i.grabbedBoxes.length>0||Se.sessions().size>0);o&&_t===null?_t=window.setInterval(()=>{ft===null&&(ft=requestAnimationFrame(()=>{ft=null,u.incrementViewportVersion(),u.updateSessionBounds();}));},100):!o&&_t!==null&&(window.clearInterval(_t),_t=null,ft!==null&&(cancelAnimationFrame(ft),ft=null));};chunkGJYSUTIS_cjs.f(()=>{s.store.theme.enabled,T(),B(),i.labelInstances.length,i.grabbedBoxes.length,Se.sessions().size,Ja();}),chunkGJYSUTIS_cjs.l(()=>{_t!==null&&window.clearInterval(_t),ft!==null&&cancelAnimationFrame(ft);}),Ae.addDocumentListener("copy",o=>{h()||Ct(o,"data-react-grab-ignore-events")||(Ue()||B())&&o.preventDefault();},{capture:true}),chunkGJYSUTIS_cjs.l(()=>{Ae.abort(),G&&window.clearTimeout(G),he&&window.clearTimeout(he),Gt.forEach(o=>window.clearTimeout(o)),Gt.clear(),Ke.stop(),document.body.style.userSelect="",document.body.style.touchAction="",Ot(null),Hn.restore();});let Dt=oi(chunkGJYSUTIS_cjs.E),Wo=chunkGJYSUTIS_cjs.g(()=>!s.store.theme.enabled||!s.store.theme.selectionBox.enabled||b()?false:Fe().length>0?true:ue()),Qa=chunkGJYSUTIS_cjs.g(()=>{let o=K();if(o)return vt(o)||void 0});chunkGJYSUTIS_cjs.f(chunkGJYSUTIS_cjs.j(()=>Kt(),o=>{let c=++We;if(!o){mn(void 0);return}cn(o).then(d=>{We===c&&mn(d??void 0);}).catch(()=>{We===c&&mn(void 0);});}));let el=Ko,tl=chunkGJYSUTIS_cjs.g(()=>i.contextMenuPosition!==null||!s.store.theme.elementLabel.enabled||b()?false:ue()),$n=new Map,nl=chunkGJYSUTIS_cjs.g(()=>{if(!s.store.theme.enabled)return [];if(!s.store.theme.grabbedBoxes.enabled)return [];i.viewportVersion;let o=new Set(i.labelInstances.map(c=>c.id));for(let c of $n.keys())o.has(c)||$n.delete(c);return i.labelInstances.map(c=>{let d=c.elements&&c.elements.length>1,w=c.element,O=!d&&w&&document.body.contains(w)?me(w):c.bounds,j=$n.get(c.id),Q=j&&j.bounds.x===O.x&&j.bounds.y===O.y&&j.bounds.width===O.width&&j.bounds.height===O.height;if(j&&j.status===c.status&&j.errorMessage===c.errorMessage&&Q)return j;let oe=O.x+O.width/2,J=O.width/2,Ee=c.mouseXOffsetRatio!==void 0&&J>0?oe+c.mouseXOffsetRatio*J:c.mouseXOffsetFromCenter!==void 0?oe+c.mouseXOffsetFromCenter:c.mouseX,Te={...c,bounds:O,mouseX:Ee};return $n.set(c.id,Te),Te})}),ol=chunkGJYSUTIS_cjs.g(()=>s.store.theme.enabled?s.store.theme.grabbedBoxes.enabled?(i.viewportVersion,i.grabbedBoxes.map(o=>!o.element||!document.body.contains(o.element)?o:{...o,bounds:me(o.element)})):[]:[]),Yo=chunkGJYSUTIS_cjs.g(()=>s.store.theme.enabled&&s.store.theme.dragBox.enabled&&Ue()&&Ne()),rl=chunkGJYSUTIS_cjs.g(()=>B()?"processing":"hover"),sl=chunkGJYSUTIS_cjs.g(()=>{if(!s.store.theme.enabled)return false;let o=s.store.theme.elementLabel.enabled,c=h(),d=B(),w=Ue(),E=C(),O=!!Z();return !o||c?false:d?true:w&&!E&&O}),os=chunkGJYSUTIS_cjs.g(()=>{i.viewportVersion;let o=i.contextMenuElement;return o?me(o):null}),il=chunkGJYSUTIS_cjs.g(()=>(i.viewportVersion,i.contextMenuPosition)),rs=chunkGJYSUTIS_cjs.g(()=>{let o=i.contextMenuElement;if(!o)return;let c=i.frozenElements.length;return c>1?`${c} elements`:vt(o)||void 0}),[ss]=chunkGJYSUTIS_cjs.h(()=>({element:i.contextMenuElement,frozenCount:i.frozenElements.length}),async({element:o,frozenCount:c})=>!o||c>1?void 0:await cn(o)??void 0),[is]=chunkGJYSUTIS_cjs.h(()=>i.contextMenuElement,async o=>{if(!o)return null;let c=await Et(o);if(!c||c.length===0)return null;for(let d of c)if(d.fileName&&wt(d.fileName))return {filePath:St(d.fileName),lineNumber:d.lineNumber};return null}),al=(o,c,d,w)=>async E=>{let O=i.contextMenuPosition??i.pointer,j=ye(),Q=os(),oe=c.length>1,J=oe?kn(fn(j)):Q,Ee=i.wasActivatedByToggle,Te=oe?j:Q?[Q]:[];if(u.hideContextMenu(),J){let qe=oe?J.x+J.width/2:O.x,je=Mt(J,d||"element",w,"copying",o,qe,oe?c:void 0,Te),mt=false,hn;try{mt=await E(),mt||(hn="Failed to copy");}catch(bn){hn=bn instanceof Error&&bn.message?bn.message:"Action failed";}Ye(je,mt?"copied":"error",mt?void 0:hn||"Unknown error"),Yt(je);}else try{await E();}catch{}Ee?de():u.unfreeze();},ll=chunkGJYSUTIS_cjs.g(()=>{let o=i.contextMenuElement;if(!o)return;let c=is(),d=i.frozenElements.length>0?i.frozenElements:[o],w=rs(),E=ss(),O={element:o,elements:d,filePath:c?.filePath,lineNumber:c?.lineNumber,componentName:E,tagName:w,enterPromptMode:ul,copy:cl,hooks:{transformHtmlContent:s.hooks.transformHtmlContent,transformScreenshot:s.hooks.transformScreenshot,onOpenFile:s.hooks.onOpenFile,transformOpenFileUrl:s.hooks.transformOpenFileUrl},performWithFeedback:al(o,d,w,E),hideContextMenu:()=>{setTimeout(()=>{u.hideContextMenu();},0);},hideOverlay:()=>{ne=true,Dt.style.visibility="hidden";},showOverlay:()=>{ne=false,Dt.style.visibility="";},cleanup:()=>{i.wasActivatedByToggle?de():u.unfreeze();}};return s.hooks.transformActionContext(O)}),cl=()=>{let o=i.contextMenuElement;if(!o)return;$e=null;let c=i.contextMenuPosition??i.pointer,d=[...i.frozenElements];q({element:o,positionX:c.x,positionY:c.y,elements:d.length>1?d:void 0,shouldDeactivateAfter:i.wasActivatedByToggle}),setTimeout(()=>{u.hideContextMenu();},0);},ul=o=>{let c=i.contextMenuElement,d=i.contextMenuPosition;!c||!d||(o&&u.setSelectedAgent(o),P(c),u.enterPromptMode(d,c),setTimeout(()=>{u.hideContextMenu();},0));},dl=()=>{setTimeout(()=>{u.hideContextMenu(),de();},0);},fl=()=>{setTimeout(()=>{u.hideContextMenu();},0);},ml=o=>{let c=Se.sessions().get(o);if(!c)return;let d=Se.session.getElement(o);d&&document.contains(d)&&setTimeout(()=>{T()||(u.setWasActivatedByToggle(true),st()),u.setPointer(c.position),u.setFrozenElement(d),u.freeze(),u.showContextMenu(c.position,d);},0);},pl=o=>{let c=i.labelInstances.find(O=>O.id===o);if(!c?.element||!document.contains(c.element))return;let d=me(c.element),w={x:c.mouseX??d.x+d.width/2,y:d.y+d.height/2},E=c.elements&&c.elements.length>0?c.elements.filter(O=>document.contains(O)):[c.element];setTimeout(()=>{T()||(u.setWasActivatedByToggle(true),st()),u.setPointer(w),u.setFrozenElements(E),E.length>1&&c.bounds&&u.setFrozenDragRect(Wr(c.bounds)),u.freeze(),u.showContextMenu(w,c.element);},0);};chunkGJYSUTIS_cjs.f(()=>{let o=s.store.theme.hue;o!==0?Dt.style.filter=`hue-rotate(${o}deg)`:Dt.style.filter="";}),s.store.theme.enabled&&chunkGJYSUTIS_cjs.t(()=>chunkGJYSUTIS_cjs.n(Li,{get selectionVisible(){return Wo()},get selectionBounds(){return be()},get selectionBoundsMultiple(){return re()},get selectionShouldSnap(){return i.frozenElements.length>0||Fe().length>0},get selectionElementsCount(){return xe()},get selectionFilePath(){return i.selectionFilePath??void 0},get selectionLineNumber(){return i.selectionLineNumber??void 0},get selectionTagName(){return Qa()},get selectionComponentName(){return el()},get selectionLabelVisible(){return tl()},selectionLabelStatus:"idle",get labelInstances(){return nl()},get dragVisible(){return Yo()},get dragBounds(){return _e()},get grabbedBoxes(){return ol()},labelZIndex:2147483647,get mouseX(){return chunkGJYSUTIS_cjs.s(()=>i.frozenElements.length>1)()?void 0:dt().x},get mouseY(){return dt().y},get crosshairVisible(){return jt()},get isFrozen(){return I()||T()||H()},get inputValue(){return i.inputText},get isPromptMode(){return h()},get hasAgent(){return m()},get isAgentConnected(){return i.isAgentConnected},get agentSessions(){return Se.sessions()},get supportsUndo(){return i.supportsUndo},get supportsFollowUp(){return i.supportsFollowUp},get dismissButtonText(){return i.dismissButtonText},get onDismissSession(){return Se.session.dismiss},get onUndoSession(){return Se.session.undo},onFollowUpSubmitSession:Fa,onAcknowledgeSessionError:La,get onRetrySession(){return Se.session.retry},onShowContextMenuSession:ml,onShowContextMenuInstance:pl,onLabelInstanceHoverChange:Bn,onInputChange:_a,onInputSubmit:()=>void Qr(),onInputCancel:Uo,onToggleExpand:ka,get isPendingDismiss(){return X()},onConfirmDismiss:Da,onCancelDismiss:Na,get pendingAbortSessionId(){return S()},onRequestAbortSession:o=>u.setPendingAbortSessionId(o),onAbortSession:Ia,get theme(){return s.store.theme},get toolbarVisible(){return s.store.theme.toolbar.enabled},get isActive(){return T()},get isCommentMode(){return F()},onToggleActive:Ba,onComment:Ha,get enabled(){return ie()},onToggleEnabled:$a,get shakeCount(){return Qe()},onToolbarStateChange:o=>{Ie(o),Tt.forEach(c=>c(o));},onSubscribeToToolbarStateChanges:o=>(Tt.add(o),()=>{Tt.delete(o);}),onToolbarSelectHoverChange:M,get contextMenuPosition(){return il()},get contextMenuBounds(){return os()},get contextMenuTagName(){return rs()},get contextMenuComponentName(){return ss()},get contextMenuHasFilePath(){return !!is()?.filePath},get actions(){return s.store.actions},get actionContext(){return ll()},onContextMenuDismiss:dl,onContextMenuHide:fl}),Dt),m()&&Se.session.tryResume();let gl=async o=>{let c=Array.isArray(o)?o:[o];return c.length===0?false:await L(c)},as=()=>{let o=Xt();o&&Se._internal.setOptions(o);let c=!!o?.provider;if(u.setHasAgentProvider(c),c&&o?.provider){let d=o.provider;u.setAgentCapabilities({supportsUndo:!!d.undo,supportsFollowUp:!!d.supportsFollowUp,dismissButtonText:d.dismissButtonText,isAgentConnected:false}),d.checkConnection&&d.checkConnection().then(w=>{Xt()?.provider===d&&u.setAgentCapabilities({supportsUndo:!!d.undo,supportsFollowUp:!!d.supportsFollowUp,dismissButtonText:d.dismissButtonText,isAgentConnected:w});}).catch(()=>{}),Se.session.tryResume();}else u.setAgentCapabilities({supportsUndo:false,supportsFollowUp:false,dismissButtonText:void 0,isAgentConnected:false});},Xo={activate:()=>{!T()&&ie()&&Rt();},deactivate:()=>{T()&&de();},toggle:()=>{T()?de():ie()&&Rt();},isActive:()=>T(),isEnabled:()=>ie(),setEnabled:o=>{o!==ie()&&(Oe(o),o||(g()&&u.release(),T()&&de(),he!==null&&(window.clearTimeout(he),he=null),le=false));},getToolbarState:()=>It(),setToolbarState:o=>{let c=It(),d={edge:o.edge??c?.edge??"bottom",ratio:o.ratio??c?.ratio??.5,collapsed:o.collapsed??c?.collapsed??false,enabled:o.enabled??c?.enabled??true};Tn(d),Ie(d),o.enabled!==void 0&&o.enabled!==ie()&&Oe(o.enabled),Tt.forEach(w=>w(d));},onToolbarStateChange:o=>(Tt.add(o),()=>{Tt.delete(o);}),dispose:()=>{Jr=false,Tt.clear(),l();},copyElement:gl,getSource:async o=>{let c=await Et(o);if(!c)return null;for(let d of c)if(d.fileName&&wt(d.fileName))return {filePath:St(d.fileName),lineNumber:d.lineNumber??null,componentName:d.functionName&&ln(d.functionName)?d.functionName:null};return null},getState:()=>({isActive:T(),isDragging:C(),isCopying:B(),isPromptMode:h(),isCrosshairVisible:jt()??false,isSelectionBoxVisible:Wo()??false,isDragBoxVisible:Yo()??false,targetElement:U(),dragBounds:_e()??null,grabbedBoxes:i.grabbedBoxes.map(o=>({id:o.id,bounds:o.bounds,createdAt:o.createdAt})),selectionFilePath:i.selectionFilePath,toolbarState:He()}),setOptions:o=>{s.setOptions(o);},registerPlugin:o=>{s.register(o,Xo),as();},unregisterPlugin:o=>{s.unregister(o),as();},getPlugins:()=>s.getPluginNames(),getDisplayName:Ao};for(let o of Nu)s.register(o,Xo);return Xo})};/*! Bundled license information:
56
+
57
+ bippy/dist/rdt-hook-5L_ky0r0.js:
58
+ (**
59
+ * @license bippy
60
+ *
61
+ * Copyright (c) Aiden Bai
62
+ *
63
+ * This source code is licensed under the MIT license found in the
64
+ * LICENSE file in the root directory of this source tree.
65
+ *)
66
+
67
+ bippy/dist/install-hook-only-CgvoC7AQ.js:
68
+ (**
69
+ * @license bippy
70
+ *
71
+ * Copyright (c) Aiden Bai
72
+ *
73
+ * This source code is licensed under the MIT license found in the
74
+ * LICENSE file in the root directory of this source tree.
75
+ *)
76
+
77
+ bippy/dist/core-U1d648PH.js:
78
+ (**
79
+ * @license bippy
80
+ *
81
+ * Copyright (c) Aiden Bai
82
+ *
83
+ * This source code is licensed under the MIT license found in the
84
+ * LICENSE file in the root directory of this source tree.
85
+ *)
86
+
87
+ bippy/dist/index.js:
88
+ (**
89
+ * @license bippy
90
+ *
91
+ * Copyright (c) Aiden Bai
92
+ *
93
+ * This source code is licensed under the MIT license found in the
94
+ * LICENSE file in the root directory of this source tree.
95
+ *)
96
+
97
+ bippy/dist/source.js:
98
+ (**
99
+ * @license bippy
100
+ *
101
+ * Copyright (c) Aiden Bai
102
+ *
103
+ * This source code is licensed under the MIT license found in the
104
+ * LICENSE file in the root directory of this source tree.
105
+ *)
106
+ */exports.a=Ft;exports.b=Et;exports.c=Ur;exports.d=Gr;exports.e=Dn;exports.f=fn;exports.g=_o;exports.h=Do;exports.i=No;exports.j=$t;exports.k=xa;exports.l=Ta;exports.m=Aa;exports.n=Pa;exports.o=Hg;