@buoy-gg/core 7.0.43 → 7.0.45

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.
Files changed (52) hide show
  1. package/bin/buoy.js +11 -8
  2. package/lib/commonjs/floatingMenu/BrowserToolRuntime.js +1 -1
  3. package/lib/commonjs/floatingMenu/BuoySignIn.web.js +1 -0
  4. package/lib/commonjs/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
  5. package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -1
  6. package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +1 -1
  7. package/lib/commonjs/floatingMenu/FloatingMenu.js +1 -1
  8. package/lib/commonjs/floatingMenu/ToolHost.js +1 -1
  9. package/lib/commonjs/floatingMenu/autoDiscoverPresets.js +1 -1
  10. package/lib/commonjs/floatingMenu/autoExternalSync.js +1 -1
  11. package/lib/commonjs/floatingMenu/dial/DialIcon.js +1 -1
  12. package/lib/commonjs/floatingMenu/externalSyncGate.js +1 -1
  13. package/lib/commonjs/version.js +1 -1
  14. package/lib/module/floatingMenu/BrowserToolRuntime.js +1 -1
  15. package/lib/module/floatingMenu/BuoySignIn.web.js +1 -0
  16. package/lib/module/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
  17. package/lib/module/floatingMenu/FloatingDevTools.js +1 -1
  18. package/lib/module/floatingMenu/FloatingDevTools.web.js +1 -1
  19. package/lib/module/floatingMenu/FloatingMenu.js +1 -1
  20. package/lib/module/floatingMenu/ToolHost.js +1 -1
  21. package/lib/module/floatingMenu/autoDiscoverPresets.js +1 -1
  22. package/lib/module/floatingMenu/autoExternalSync.js +1 -1
  23. package/lib/module/floatingMenu/dial/DialIcon.js +1 -1
  24. package/lib/module/floatingMenu/externalSyncGate.js +1 -1
  25. package/lib/module/version.js +1 -1
  26. package/lib/typescript/commonjs/Buoy.d.ts +1 -1
  27. package/lib/typescript/commonjs/floatingMenu/BuoySignIn.web.d.ts +12 -0
  28. package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts +7 -0
  29. package/lib/typescript/commonjs/floatingMenu/ToolOpenerBridge.d.ts +2 -1
  30. package/lib/typescript/commonjs/floatingMenu/autoExternalSync.d.ts +16 -0
  31. package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts +1 -1
  32. package/lib/typescript/commonjs/floatingMenu/externalSyncGate.d.ts +27 -0
  33. package/lib/typescript/commonjs/version.d.ts +1 -1
  34. package/lib/typescript/module/Buoy.d.ts +1 -1
  35. package/lib/typescript/module/floatingMenu/BuoySignIn.web.d.ts +12 -0
  36. package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts +7 -0
  37. package/lib/typescript/module/floatingMenu/ToolOpenerBridge.d.ts +2 -1
  38. package/lib/typescript/module/floatingMenu/autoExternalSync.d.ts +16 -0
  39. package/lib/typescript/module/floatingMenu/defaultConfig.d.ts +1 -1
  40. package/lib/typescript/module/floatingMenu/externalSyncGate.d.ts +27 -0
  41. package/lib/typescript/module/version.d.ts +1 -1
  42. package/lib/web/chunks/chunk-5NZOQR6Q.mjs +1 -0
  43. package/lib/web/chunks/chunk-CGDSLLZF.mjs +1 -0
  44. package/lib/web/chunks/chunk-DCJDUSNR.mjs +1 -0
  45. package/lib/web/chunks/chunk-IDSHFS6G.mjs +1 -0
  46. package/lib/web/chunks/chunk-JOAMJGCS.mjs +1 -0
  47. package/lib/web/chunks/chunk-KYKZ2N52.mjs +1 -0
  48. package/lib/web/chunks/chunk-NGM7JGGS.mjs +1 -0
  49. package/lib/web/chunks/chunk-Z3XWDDIO.mjs +1 -0
  50. package/lib/web/chunks/chunk-ZTGQ6TTY.mjs +1 -0
  51. package/lib/web/index.mjs +2 -2
  52. package/package.json +5 -5
package/lib/web/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- "use client";import{$ as Cn,A as Tn,Aa as In,B as zn,Ba as kn,C as Mn,Ca as Rn,D as An,Da as On,E as En,Ea as Dn,F as Bn,Fa as Fn,G as Pn,Ga as Ln,H as $n,Ha as Wn,I as jn,Ia as Hn,J as Nn,Ja as Kn,K as Un,Ka as Vn,L as _n,La as qn,M as Gn,Ma as Jn,N as Xn,Na as Yn,O as Qn,Oa as Zn,P as ea,Pa as ta,Q as oa,Qa as na,R as aa,Ra as ia,S as ra,Sa as sa,T as la,Ta as ca,U as da,Ua as ua,V as pa,Va as ma,W as ga,Wa as fa,X as ha,Xa as ya,Y as ba,Ya as Sa,Z as va,_ as wa,a as j,aa as xa,b as N,ba as Ca,c as Ze,ca as Ta,d as Wt,da as Ia,e as Pl,ea as za,f as xe,fa as ka,g as jt,ga as Ma,h as De,ha as Ra,i as Ht,ia as Aa,j as Oa,ja as Ea,k as Da,ka as Ba,l as Fa,la as Pa,m as La,ma as $a,n as Wa,na as ja,o as Ha,oa as Na,p as Ka,pa as Ua,q as Va,qa as _a,r as qa,ra as Ga,s as Ja,sa as Xa,t as Ya,ta as Qa,u as Za,ua as ei,v as ti,va as oi,w as ni,wa as ai,x as ii,xa as ri,y as si,ya as li,z as ci,za as di}from"./chunks/chunk-QZDVCMCT.mjs";import{b as ui,c as pi}from"./chunks/chunk-5SGL6QL4.mjs";import{a as Nt,d as et}from"./chunks/chunk-R7RGRTY5.mjs";import{FloatingToolHost as mi}from"@buoy-gg/shared-ui/web/floating";import{LicenseManager as gi,useLicense as fi}from"@buoy-gg/license/web";import{AccountSetup as hi}from"@buoy-gg/shared-ui/web";import{useState as vt,useMemo as Be,useCallback as Fe,useEffect as de,useRef as yi}from"react";import{useSettings as bi,getToolLabel as tt,getToolDescription as Si,getToolColor as Kt}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Ce,devToolsStorageKeys as ot,EnvironmentIndicator as vi,EnvironmentSelectorInline as wi}from"@buoy-gg/shared-ui/web";var xi=[];function Ci(){return[]}function Ut(e=[]){return[...new Map(e.map(t=>[t.id,t])).values()]}function wt(e,t){return e.filter(o=>{let a=o.slot||"both";return a==="both"||a===t})}function Ti(e,t){let o=t instanceof Set?t:new Set(t);return e.filter(a=>o.has(a.id))}import{FloatingTool as Vt,FloatingToolDivider as Ii,FloatingToolUserStatus as _t,getBubbleAnchorPosition as zi}from"@buoy-gg/shared-ui/web/floating";import{useState as Q,useEffect as Te,useMemo as nt,useRef as at,useCallback as it}from"react";import{getDialLayout as ki,getAllIconPositions as Mi,getGridLineRotations as Ri,getIconStaggerInputRange as Ai,MAX_DIAL_SLOTS as He,DIAL_ICON_SIZE as Oi,dialAnimationConfig as qt,getDialCSSKeyframesString as Ei,getDialCSSAnimationStyles as Di,dialColors as D,dialStyles as v,withAlpha as Gt,floatingToolsColors as Bi}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Jt,monoFont as Xt,ToolBackground as Fi,useToolBackground as Pi}from"@buoy-gg/shared-ui/web";import{memo as Li}from"react";import{RasterLayer as $i,scatter as Wi,useLoop as ji,withBgAlpha as Hi}from"@buoy-gg/shared-ui/web";import{Fragment as Ni,jsx as Ne}from"react/jsx-runtime";var Ki=.94,Ui=6,Vi=2400,rt=3,Yt=16,_i=Array.from({length:rt},(e,t)=>Wi(22343^t*40503,Yt*4)),Qt=["#FFFFFF","#B3D9FF","#8CB3FF"],Zt=Math.PI/3,eo=14*Math.PI/180;function qi(e){let t=Math.min(5,Math.floor(e*6)),o=e*6-t;return t*Zt+eo/2+o*(Zt-eo)}function Gi(e){return Math.min(Ui,1/(1-e*Ki))}function Ji(e){let t=.15+.85*e*e;return e<.06?t*=e/.06:e>.94&&(t*=(1-e)/.06),Math.min(.7,t)}function Xi(e){let t=e/rt,o=[],a=12;for(let d=0;d<=a;d++)o.push(d/a);let n=(1-t)%1;n>.001&&n<1-.001&&o.push(n-1e-4,n+1e-4),o.sort((d,p)=>d-p);let i=[],l=[],u=[];for(let d of o){let p=t===0&&d===1?1:(d+t)%1;i.push(d),l.push(Gi(p)),u.push(Ji(p))}return{input:i,scale:l,opacity:u}}var Yi=Array.from({length:rt},(e,t)=>Xi(t)),Qi=Li(function({size:e}){let t=ji(Vi),o=e/2,a=[];for(let n=0;n<rt;n++){let i=_i[n],l=Yi[n],u=[];for(let d=0;d<Yt;d++){let p=qi(i[d*4]),m=(.15+.85*Math.sqrt(i[d*4+1]))*.5*o,C=Qt[Math.floor(i[d*4+3]*Qt.length)%3],g=o+Math.cos(p)*m,k=o+Math.sin(p)*m,y=.6,S=y*2.4;u.push(Ne(j,{style:{position:"absolute",left:g-S/2,top:k-S/2,width:S,height:S,borderRadius:S/2,backgroundColor:Hi(C,.3)}},`${d}-h`),Ne(j,{style:{position:"absolute",left:g-y/2,top:k-y/2,width:y,height:y,borderRadius:y/2,backgroundColor:C}},d))}a.push(Ne(xe.View,{style:{position:"absolute",left:0,top:0,width:e,height:e,opacity:t.interpolate({inputRange:l.input,outputRange:l.opacity}),transform:[{scale:t.interpolate({inputRange:l.input,outputRange:l.scale})}]},pointerEvents:"none",children:Ne($i,{style:{width:e,height:e},raster:false,children:u})},n))}return Ne(Ni,{children:a})});import{useEffect as Zi,useState as to}from"react";import{dialColors as Pe,withAlpha as oo}from"@buoy-gg/floating-tools-react/web";import{ARROW_BOTTOM_OFFSET as er,ARROW_HEIGHT as tr,SPACING_GAP as tc,getScreenCenterY as oc,calculateTooltipPosition as or,calculateTargetPosition as nc}from"@buoy-gg/shared-ui/web/floating";import{monoFont as no}from"@buoy-gg/shared-ui/web";import{jsx as Le,jsxs as ao}from"react/jsx-runtime";var io=false;function nr(){if(io||typeof document>"u")return;let e=document.createElement("style");e.textContent=`
1
+ "use client";import{$ as En,A as Bn,Aa as On,B as Fn,Ba as Ln,C as Pn,Ca as $n,D as jn,Da as Hn,E as Wn,Ea as Nn,F as Vn,Fa as Un,G as Kn,Ga as _n,H as qn,Ha as Gn,I as Jn,Ia as Xn,J as Yn,Ja as Qn,K as Zn,Ka as ea,L as ta,La as oa,M as na,Ma as aa,N as ia,Na as ra,O as sa,Oa as la,P as ca,Pa as da,Q as ua,Qa as pa,R as ma,Ra as ga,S as fa,Sa as ha,T as ya,Ta as ba,U as Sa,Ua as va,V as wa,Va as xa,W as Ca,Wa as Ta,X as za,Xa as ka,Y as Ia,Ya as Ma,Z as Ra,_ as Aa,a as H,aa as Da,b as N,ba as Ea,c as et,ca as Ba,d as Nt,da as Oa,e as ec,ea as Fa,f as xe,fa as La,g as Vt,ga as Pa,h as Be,ha as $a,i as Ut,ia as ja,j as Ha,ja as Wa,k as Na,ka as Va,l as Ua,la as Ka,m as _a,ma as qa,n as Ga,na as Ja,o as Xa,oa as Ya,p as Qa,pa as Za,q as ei,qa as ti,r as oi,ra as ni,s as ai,sa as ii,t as ri,ta as si,u as li,ua as ci,v as di,va as ui,w as pi,wa as mi,x as gi,xa as fi,y as hi,ya as yi,z as bi,za as Si}from"./chunks/chunk-QZDVCMCT.mjs";import{b as vi,c as Kt}from"./chunks/chunk-5SGL6QL4.mjs";import{a as _t,d as tt}from"./chunks/chunk-R7RGRTY5.mjs";import{FloatingToolHost as wi}from"@buoy-gg/shared-ui/web/floating";import{LicenseManager as xi,useLicense as Ci}from"@buoy-gg/license/web";import{AccountSetup as Ti}from"@buoy-gg/shared-ui/web";import{useState as wt,useMemo as Oe,useCallback as Fe,useEffect as de,useRef as zi}from"react";import{useSettings as ki,getToolLabel as ot,getToolDescription as Ii,getToolColor as qt}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Ce,devToolsStorageKeys as nt,EnvironmentIndicator as Mi,EnvironmentSelectorInline as Ri}from"@buoy-gg/shared-ui/web";var Ai=[];function Di(){return[]}function Gt(e=[]){return[...new Map(e.map(t=>[t.id,t])).values()]}function xt(e,t){return e.filter(o=>{let a=o.slot||"both";return a==="both"||a===t})}function Ei(e,t){let o=t instanceof Set?t:new Set(t);return e.filter(a=>o.has(a.id))}import{FloatingTool as Jt,FloatingToolDivider as Bi,FloatingToolUserStatus as Xt,getBubbleAnchorPosition as Oi}from"@buoy-gg/shared-ui/web/floating";import{useState as Q,useEffect as Te,useMemo as at,useRef as it,useCallback as rt}from"react";import{getDialLayout as Fi,getAllIconPositions as Li,getGridLineRotations as Pi,getIconStaggerInputRange as $i,MAX_DIAL_SLOTS as We,DIAL_ICON_SIZE as ji,dialAnimationConfig as Yt,getDialCSSKeyframesString as Hi,getDialCSSAnimationStyles as Wi,dialColors as F,dialStyles as S,withAlpha as Qt,floatingToolsColors as Ni}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Zt,monoFont as eo,ToolBackground as Vi,useToolBackground as Ui}from"@buoy-gg/shared-ui/web";import{memo as Ki}from"react";import{RasterLayer as _i,scatter as qi,useLoop as Gi,withBgAlpha as Ji}from"@buoy-gg/shared-ui/web";import{Fragment as Xi,jsx as Ne}from"react/jsx-runtime";var Yi=.94,Qi=6,Zi=2400,st=3,to=16,er=Array.from({length:st},(e,t)=>qi(22343^t*40503,to*4)),oo=["#FFFFFF","#B3D9FF","#8CB3FF"],no=Math.PI/3,ao=14*Math.PI/180;function tr(e){let t=Math.min(5,Math.floor(e*6)),o=e*6-t;return t*no+ao/2+o*(no-ao)}function or(e){return Math.min(Qi,1/(1-e*Yi))}function nr(e){let t=.15+.85*e*e;return e<.06?t*=e/.06:e>.94&&(t*=(1-e)/.06),Math.min(.7,t)}function ar(e){let t=e/st,o=[],a=12;for(let d=0;d<=a;d++)o.push(d/a);let n=(1-t)%1;n>.001&&n<1-.001&&o.push(n-1e-4,n+1e-4),o.sort((d,p)=>d-p);let i=[],l=[],u=[];for(let d of o){let p=t===0&&d===1?1:(d+t)%1;i.push(d),l.push(or(p)),u.push(nr(p))}return{input:i,scale:l,opacity:u}}var ir=Array.from({length:st},(e,t)=>ar(t)),rr=Ki(function({size:e}){let t=Gi(Zi),o=e/2,a=[];for(let n=0;n<st;n++){let i=er[n],l=ir[n],u=[];for(let d=0;d<to;d++){let p=tr(i[d*4]),m=(.15+.85*Math.sqrt(i[d*4+1]))*.5*o,x=oo[Math.floor(i[d*4+3]*oo.length)%3],g=o+Math.cos(p)*m,R=o+Math.sin(p)*m,v=.6,I=v*2.4;u.push(Ne(H,{style:{position:"absolute",left:g-I/2,top:R-I/2,width:I,height:I,borderRadius:I/2,backgroundColor:Ji(x,.3)}},`${d}-h`),Ne(H,{style:{position:"absolute",left:g-v/2,top:R-v/2,width:v,height:v,borderRadius:v/2,backgroundColor:x}},d))}a.push(Ne(xe.View,{style:{position:"absolute",left:0,top:0,width:e,height:e,opacity:t.interpolate({inputRange:l.input,outputRange:l.opacity}),transform:[{scale:t.interpolate({inputRange:l.input,outputRange:l.scale})}]},pointerEvents:"none",children:Ne(_i,{style:{width:e,height:e},raster:false,children:u})},n))}return Ne(Xi,{children:a})});import{useEffect as sr,useState as io}from"react";import{dialColors as Le,withAlpha as ro}from"@buoy-gg/floating-tools-react/web";import{ARROW_BOTTOM_OFFSET as lr,ARROW_HEIGHT as cr,SPACING_GAP as Sc,getScreenCenterY as vc,calculateTooltipPosition as dr,calculateTargetPosition as wc}from"@buoy-gg/shared-ui/web/floating";import{monoFont as so}from"@buoy-gg/shared-ui/web";import{jsx as Pe,jsxs as lo}from"react/jsx-runtime";var co=false;function ur(){if(co||typeof document>"u")return;let e=document.createElement("style");e.textContent=`
2
2
  @keyframes buoyOnboardPulse {
3
3
  0%, 100% { transform: scale(1); }
4
4
  50% { transform: scale(1.02); }
@@ -7,4 +7,4 @@
7
7
  0%, 100% { transform: translateY(0); }
8
8
  50% { transform: translateY(-8px); }
9
9
  }
10
- `,document.head.appendChild(e),io=true}var xt=Pe.accent;function ro({title:e,message:t,onDismiss:o,showArrow:a=true}){let[n,i]=to(false),[l,u]=to(false);Zi(()=>{nr();let p=requestAnimationFrame(()=>i(true));return()=>cancelAnimationFrame(p)},[]);let d={fontFamily:no,textTransform:"uppercase"};return Le("div",{style:{position:"fixed",left:"50%",bottom:or(),transform:`translateX(-50%) scale(${n?1:.8})`,opacity:n?1:0,transition:"transform 300ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 300ms ease",zIndex:10002,pointerEvents:"auto"},children:ao("div",{style:{position:"relative",animation:n?"buoyOnboardPulse 3s ease-in-out infinite":"none"},children:[Le("div",{style:{position:"absolute",inset:-4,borderRadius:18,backgroundColor:"#FFFFFF",opacity:.06}}),ao("div",{style:{position:"relative",maxWidth:280,backgroundColor:Pe.dialBackground,borderRadius:16,border:`1px solid ${Pe.dialBorder}`,padding:20,boxShadow:`0 0 20px ${oo(Pe.dialShadow,.6)}`,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[Le("span",{style:{...d,fontSize:16,fontWeight:900,letterSpacing:1,color:xt,textAlign:"center"},children:e}),Le("span",{style:{fontFamily:no,fontSize:13,lineHeight:"20px",color:Pe.centerText,textAlign:"center"},children:t}),Le("button",{onClick:o,onMouseDown:()=>u(true),onMouseUp:()=>u(false),onMouseLeave:()=>u(false),style:{...d,marginTop:8,borderRadius:8,border:"none",backgroundColor:xt,padding:"10px 24px",fontSize:14,fontWeight:900,letterSpacing:1.5,color:"#000000",cursor:"pointer",opacity:l?.7:1,transform:l?"scale(0.96)":"scale(1)",transition:"transform 100ms ease, opacity 100ms ease"},children:"Got it!"})]}),a&&Le("div",{style:{position:"absolute",left:"50%",bottom:er,marginLeft:-12,width:0,height:0,borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:`${tr}px solid ${xt}`,filter:`drop-shadow(0 0 10px ${oo(Pe.dialShadow,.5)})`,animation:n?"buoyOnboardArrowBounce 1.6s ease-in-out infinite":"none"}})]})})}import{Fragment as ar,jsx as E,jsxs as ge}from"react/jsx-runtime";var ir={x:.5,y:.5},so="@react_buoy_settings_tooltip_shown",lo=false;function rr(){if(lo||typeof document>"u")return;let e=document.createElement("style");e.textContent=Ei(),document.head.appendChild(e),lo=true}var $e=e=>1-Math.pow(1-e,3),Ct=e=>e*e*e;function sr({icon:e,index:t,totalIcons:o,position:a,progress:n,onPress:i}){let[l,u]=Q(false),[d,p]=Q(false),m=!e.icon&&e.id.startsWith("empty-"),C=!m&&e.unavailable===true,g=!m&&!C,{icons:k}=qt,y=Ai(t,o),S=0;n<=y[1]?S=0:n<=y[2]?S=(n-y[1])/(y[2]-y[1]):S=1,S=Math.max(0,Math.min(1,S));let T=Oi,M=k.pressIn.scale,B=S*(d?M:l?1.1:1),_=0;S<=0?_=0:S<=.3?_=S:_=.3+(S-.3)*(.7/.7);let x=a.x*S,z=a.y*S;return E("button",{role:"menuitem","aria-label":m?"Empty slot":e.name,"aria-disabled":!g,tabIndex:g?0:-1,onClick:g?i:void 0,onMouseEnter:()=>g&&u(true),onMouseLeave:()=>{u(false),p(false)},onMouseDown:()=>g&&p(true),onMouseUp:()=>p(false),style:{position:"absolute",left:"50%",top:"50%",width:T,height:T,marginLeft:-T/2,marginTop:-T/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:g?"pointer":"default",transform:`translate(${x}px, ${z}px) scale(${B})`,opacity:_,transition:l||d?"transform 100ms ease":"none",background:"none",border:"none",padding:0},children:m?E("div",{style:{width:v.emptySlot.dotSize,height:v.emptySlot.dotSize,borderRadius:v.emptySlot.dotSize/2,backgroundColor:D.emptyDotBackground,border:`${v.emptySlot.borderWidth}px solid ${D.emptyDotBorder}`}}):ge(ar,{children:[E("div",{style:{position:"absolute",width:`${v.icon.gradientBgSizePercent}%`,height:`${v.icon.gradientBgSizePercent}%`,borderRadius:v.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:v.icon.gradientBgOpacity}}),E("div",{style:{position:"absolute",width:`${v.icon.innerGlowSizePercent}%`,height:`${v.icon.innerGlowSizePercent}%`,borderRadius:v.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:v.icon.innerGlowOpacity}}),E("div",{style:{marginBottom:v.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:l?"brightness(1.2)":"none"},children:e.icon}),E("span",{style:{fontSize:e.name.length>8?Math.max(v.icon.label.fontSize*.7,v.icon.label.fontSize*8/e.name.length):v.icon.label.fontSize,fontWeight:v.icon.label.fontWeight,fontFamily:v.icon.label.fontFamily,color:D.iconLabel,letterSpacing:v.icon.label.letterSpacing,marginTop:v.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:e.name}),C&&E("span",{style:{fontSize:v.icon.label.fontSize-1,fontWeight:v.icon.label.fontWeight,fontFamily:v.icon.label.fontFamily,letterSpacing:v.icon.label.letterSpacing,color:Bi.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})}function co({side:e,color:t}){return E("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(e==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]]).map(([o,a,n,i],l)=>E("line",{x1:o,y1:a,x2:n,y2:i,stroke:t,strokeWidth:2},l))})}function uo({side:e,disabled:t,onClick:o}){let[a,n]=Q(false),i=t?D.emptyDotBorder:D.accent;return ge("button",{type:"button","aria-label":`${e==="prev"?"Previous":"Next"} dial page`,disabled:t,onClick:o,onMouseDown:()=>!t&&n(true),onMouseUp:()=>n(false),onMouseLeave:()=>n(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${D.dialBorder}`,backgroundColor:D.dialBackground,color:t?D.iconLabelMuted:D.centerText,fontSize:12,fontWeight:900,fontFamily:Xt,letterSpacing:1.5,textTransform:"uppercase",cursor:t?"default":"pointer",opacity:t?.4:1,boxShadow:t?"none":`0 0 8px ${Gt(D.dialShadow,.4)}`,transform:a?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[e==="prev"&&E(co,{side:"prev",color:i}),e==="prev"?"PREV":"NEXT",e==="next"&&E(co,{side:"next",color:i})]})}function po({icons:e,onClose:t,centerLabel:o="MENU",onCenterPress:a,settingsOpen:n=false,hintsDisabled:i=false}){let{id:l}=Pi(),[u,d]=Q(0),[p,m]=Q(0),[C,g]=Q(0),[k,y]=Q(0),[S,T]=Q(0),[M,B]=Q(1),[_,x]=Q(false),[z,P]=Q(false),[I,R]=Q(false),oe=at(null),Z=at(null),G=at(null),le=at(false),{entrance:K,exit:ne,interaction:J}=qt,Se=Di(),[me,ve]=Q(()=>({width:window.innerWidth,height:window.innerHeight}));Te(()=>{let A=()=>ve({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[]);let L=nt(()=>ki({screenWidth:me.width,maxCircleSize:Math.max(120,Math.min(320,me.height-96))}),[me]),Re=nt(()=>Ri(),[]),fe=nt(()=>Mi(He,L.iconRadius),[L.iconRadius]),[re,we]=Q(0),ae=Math.max(1,Math.ceil(e.length/He)),r=Math.min(re,ae-1),F=nt(()=>{let A=r*He,w=[...e.slice(A,A+He)];for(;w.length<He;)w.push({id:`empty-${w.length}`,name:"",icon:null,onPress:()=>{}});return w},[e,r]);Te(()=>{rr()},[]),Te(()=>{let A=K.backdrop.duration,w=K.dial.rotation.duration,X=K.centerButton.delay,H=K.icons.delay,q=K.icons.duration,U=performance.now(),ee=ce=>{let s=ce-U;d(Math.min(1,s/A));let f=Math.min(1,s/400),O=$e(f)*1.1;f>.7&&(O-=(f-.7)*.33),f>=1&&(O=1),m(Math.max(0,Math.min(1.05,O)));let Y=Math.min(1,s/w);if(g($e(Y)*360),s>=X){let ye=Math.min(1,(s-X)/300),Ee=$e(ye)*1.15;ye>.6&&(Ee-=(ye-.6)*.375),ye>=1&&(Ee=1),y(Math.max(0,Math.min(1.05,Ee)))}if(s>=H){let ye=Math.min(1,(s-H)/q);T($e(ye))}let he=H+q;s<he?G.current=requestAnimationFrame(ee):(d(1),m(1),g(360),y(1),T(1),R(true))};return G.current=requestAnimationFrame(ee),()=>{G.current&&cancelAnimationFrame(G.current)}},[]);let W=it(()=>{if(le.current)return;le.current=true,P(true),G.current&&cancelAnimationFrame(G.current);let A=performance.now(),w=ne.icons.duration,X=ne.centerButton.duration,H=ne.dialScale.duration,q=Math.max(X,H),U=ne.backdrop.duration,ee=ce=>{let s=ce-A;if(s<w){let Y=Ct(s/w);T(1-Y),G.current=requestAnimationFrame(ee);return}let f=w;if(s<f+q){T(0);let Y=Math.min(1,(s-f)/X),he=Math.min(1,(s-f)/H);y(1-Ct(Y)),m(1-Ct(he)),G.current=requestAnimationFrame(ee);return}let O=f+q;if(s<O+U){m(0),y(0);let Y=(s-O)/U;d(1-Y),G.current=requestAnimationFrame(ee);return}d(0),t()};G.current=requestAnimationFrame(ee)},[ne,t]);Te(()=>{let A=document.activeElement,w=oe.current;return()=>{A?.isConnected&&(document.activeElement===document.body||w?.contains(document.activeElement))&&A.focus()}},[]),Te(()=>{if(n)return;Z.current?.focus();let A=w=>{let X=oe.current;if(X){if(w.key==="Escape")w.preventDefault(),W();else if(w.key==="Tab"){let H=Array.from(X.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(ee=>ee.getClientRects().length>0),q=H[0],U=H[H.length-1];(!X.contains(document.activeElement)||(w.shiftKey?document.activeElement===q:document.activeElement===U))&&(w.preventDefault(),(w.shiftKey?U:q)?.focus())}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(w.key)){let H=Array.from(X.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),q=H.indexOf(document.activeElement);if(q<0||!H.length)return;w.preventDefault();let U=w.key==="Home"?0:w.key==="End"?H.length-1:(q+(w.key==="ArrowRight"||w.key==="ArrowDown"?1:-1)+H.length)%H.length;H[U].focus()}}};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[W,n]);let[je,Je]=Q(false);Te(()=>{if(i)return;let A=false,w=setTimeout(async()=>{let X=await Jt.getItem(so);!A&&!X&&Je(true)},1200);return()=>{A=true,clearTimeout(w)}},[i]);let Ae=it(()=>{Je(false),Jt.setItem(so,"true")},[]);Te(()=>{n&&je&&Ae()},[n,je,Ae]);let Xe=it(A=>{if(A.id.startsWith("empty-")||le.current)return;let[w,X]=J.iconSelect.pulse,H=performance.now(),q=150,U=ee=>{let ce=ee-H;if(ce<q){let s=$e(ce/q);B(1-(1-w.scale)*s),requestAnimationFrame(U)}else if(ce<q*2){let s=$e((ce-q)/q);B(w.scale+(X.scale-w.scale)*s),requestAnimationFrame(U)}else B(1)};requestAnimationFrame(U),setTimeout(()=>{A.onPress(),W()},J.iconSelect.actionDelay)},[J.iconSelect,W]),Ye=it(A=>{if(le.current)return;let w=Math.max(0,Math.min(A,ae-1));w!==r&&we(w)},[ae,r]),Oe=L.buttonSize*v.centerButton.containerRatio,Qe=L.buttonSize*v.centerButton.borderRatio,bt=L.buttonSize*v.centerButton.containerRatio/2+6,St=I&&!z;return ge("div",{ref:oe,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[E("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:W,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:D.dialBackdrop,opacity:u}}),ge("div",{style:{position:"absolute",left:"50%",marginLeft:-L.circleSize/2,bottom:80,width:L.circleSize,height:L.circleSize,borderRadius:"50%",backgroundColor:D.dialBackground,border:`${v.circle.borderWidth}px solid ${D.dialBorder}`,boxShadow:`0 0 ${v.circle.shadowRadius}px ${Gt(D.dialShadow,v.circle.shadowOpacity)}`,transform:`scale(${p}) rotate(${C}deg)`,opacity:p>.01?1:0,overflow:"hidden"},children:[E("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:D.dialGradient1,opacity:v.gradientLayers[0].opacity}}),E("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:D.dialGradient2,opacity:v.gradientLayers[1].opacity}}),E("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:D.dialGradient3,opacity:v.gradientLayers[2].opacity}}),Re.map(A=>E("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:v.grid.lineHeight,transform:`rotate(${A}deg)`,transformOrigin:"center"},children:["left","right"].map(w=>E("div",{style:{position:"absolute",top:0,[w]:0,width:`calc(50% - ${bt}px)`,height:v.grid.lineHeight,backgroundColor:D.dialGridLine}},w))},A)),E("div",{"data-testid":"dial-background","data-background":l,style:{position:"absolute",inset:0,pointerEvents:"none"},children:l==="hyperspace"?E(Qi,{size:L.circleSize}):E(Fi,{focus:ir})}),F.map((A,w)=>E(sr,{icon:A,index:w,totalIcons:F.length,position:fe[w],progress:S,onPress:()=>Xe(A)},w)),ge("div",{style:{position:"absolute",left:"50%",top:"50%",width:Oe,height:Oe,marginLeft:-Oe/2,marginTop:-Oe/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:D.hubHalo,borderRadius:L.buttonSize,overflow:"hidden",transform:`scale(${k*M})`,opacity:k>.01?1:0},children:[E("div",{style:{position:"absolute",inset:0,backgroundColor:D.dialGradient1,opacity:.5,borderRadius:L.buttonSize}}),E("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:D.dialGradient2,opacity:.3,borderRadius:L.buttonSize}}),E("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:D.dialGradient3,opacity:.2,borderRadius:L.buttonSize}}),E("div",{style:{width:Qe,height:Qe,borderRadius:L.buttonSize*v.centerButton.borderRadiusRatio,backgroundColor:D.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:E("button",{ref:Z,type:"button","aria-label":n?"Close settings":"Open settings",disabled:!a,onClick:a,onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),style:{border:0,padding:0,background:"transparent",width:L.buttonSize,height:L.buttonSize,borderRadius:L.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:a?"pointer":"default",transform:_?`scale(${J.centerHover.scale})`:"scale(1)",transition:`transform ${J.centerHover.duration}ms ease`,animation:St&&!_?Se.pulse:"none"},children:n?ge("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:v.centerButton.text.fontSize-2,fontWeight:v.centerButton.text.fontWeight,fontFamily:v.centerButton.text.fontFamily,color:D.centerText,letterSpacing:v.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${D.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[E("span",{style:{marginBottom:-2},children:"CLOSE"}),E("span",{style:{marginTop:-2},children:"SETTINGS"})]}):E("span",{style:{fontSize:v.centerButton.text.fontSize,fontWeight:v.centerButton.text.fontWeight,fontFamily:v.centerButton.text.fontFamily,color:D.centerText,letterSpacing:v.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${D.centerTextGlow}`,textTransform:"uppercase"},children:o})})})]})]}),ae>1&&ge("div",{style:{position:"absolute",left:"50%",marginLeft:-L.circleSize/2,top:"calc(100% - 64px)",width:L.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,p),transform:`scale(${Math.min(1,p)})`},children:[E(uo,{side:"prev",disabled:r<=0,onClick:()=>Ye(r-1)}),ge("span",{style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:Xt,letterSpacing:2,color:D.centerText,textShadow:`0 0 6px ${D.centerTextGlow}`},children:[String(r+1).padStart(2,"0"),ge("span",{style:{color:D.iconLabelMuted,textShadow:"none"},children:[" / ",String(ae).padStart(2,"0")]})]}),E(uo,{side:"next",disabled:r>=ae-1,onClick:()=>Ye(r+1)})]}),je&&!n&&E(ro,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:Ae,showArrow:false})]})}import{persistentStorage as mo,devToolsStorageKeys as lr}from"@buoy-gg/shared-ui/web";import{recordUsage as cr,pruneUsage as dr}from"@buoy-gg/floating-tools-core/web";var go=lr.dial.usage(),We={},fo=false,Tt=null;function ho(){return Tt||(Tt=(async()=>{try{let e=await mo.getItem(go);if(e){let t=JSON.parse(e);t&&typeof t=="object"&&(We=t)}}catch{}finally{fo=true}})(),Tt)}ho();function ur(e){return e.map((t,o)=>({id:t,index:o,lastUsed:We[t]?.lastUsed??0})).sort((t,o)=>o.lastUsed-t.lastUsed||t.index-o.index).map(({id:t})=>t)}async function pr(e){if(!e)return;fo||await ho();let t=Math.max(Date.now(),...Object.values(We).map(o=>o.lastUsed+1));We=dr(cr(We,e,t),t);try{await mo.setItem(go,JSON.stringify(We))}catch{}}import{useCallback as mr,useMemo as yo}from"react";import{persistentStorage as gr}from"@buoy-gg/shared-ui/web";import{useState as te,useEffect as Ie,useCallback as st,useMemo as lt}from"react";import{settingsEventBus as ct}from"@buoy-gg/floating-tools-core/web";import{useSyncExternalStore as fr}from"react";import{getRegisteredToolModule as hr}from"@buoy-gg/shared-ui/web";var yr=()=>()=>{},br=()=>null;function Sr(){let e=hr("@buoy-gg/external-sync");return fr(e?.subscribeSyncStatus??yr,()=>e?.getSyncStatus?.()??null,br)}import{SentryIcon as vr,WifiCircuitIcon as wr,ImageOverlayIcon as xr,RenderCountIcon as Cr,Info as It,Layers as Tr,ChevronRightIcon as bo,ChevronDown as So,getStorageBackendType as Ir,getUseLicense as zr,persistentStorage as ze,Trash2 as kr,CheckCircle2 as vo,LicenseEntryModal as Mr,BackgroundSwitcher as Rr,night as h,NightCard as ke,NightRows as zt,NightSectionLabel as Ar,NightFootnote as wo,NightSwitch as xo,NightButton as Co,NightSegmented as Or,NightBadge as ue,NightSeparator as Er,monoFont as To}from"@buoy-gg/shared-ui/web";import{EnvIcon as Io,StorageIcon as Dr,RoutesIcon as Br,NetworkIcon as Fr,QueryIcon as Pr,HighlighterIcon as Lr,ReduxIcon as $r,EventsIcon as Wr}from"@buoy-gg/floating-tools-core/web";import jr,{createContext as Hr,useContext as Nr}from"react";import{jsx as Kr}from"react/jsx-runtime";var zo=Hr({});function Ur({children:e,defaultFloatingTools:t,defaultDialTools:o}){let a=jr.useMemo(()=>({defaultFloatingTools:t,defaultDialTools:o}),[t,o]);return Kr(zo.Provider,{value:a,children:e})}function ko(){return Nr(zo)}import Vr from"react";import{toolTheme as _r}from"@buoy-gg/shared-ui/web";import{jsx as Mo}from"react/jsx-runtime";function qr({label:e,size:t,color:o=_r.colors.text}){let a=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1),n=a<=2?t:t*1.6,i=Math.max(7,Math.min(t*(a===1?.7:.62),n/(.62*a)));return Mo("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:i,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}function Ro(e,t){return e==null?e:typeof e=="function"?Vr.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions}):typeof e=="string"||typeof e=="number"?Mo(qr,{label:String(e),size:t.size,color:t.color}):e}import{JsModal as Gr,devToolsStorageKeys as kt}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as Jr}from"@buoy-gg/shared-ui/web";import{Fragment as Ke,jsx as c,jsxs as $}from"react/jsx-runtime";var dt="@react_buoy_dev_tools_settings",Xr=6,ut=e=>{let t=Xr,o={};for(let[a,n]of Object.entries(e))n&&t>0?(o[a]=true,t-=1):o[a]=false;return o},Yr=(e,t)=>{let{userStatus:o,environment:a,...n}=e,i=t?Object.entries(n).filter(([l])=>t.includes(l)):Object.entries(n);return{...Object.fromEntries(i),environment:a??false}},Ao=(e,t,o)=>{if(!t)return e;let a={...e.dialTools,...t.dialTools??{}},n=o?.allowedDialKeys?Object.entries(a).filter(([i])=>o.allowedDialKeys?.includes(i)):Object.entries(a);return{dialTools:ut(Object.fromEntries(n)),floatingTools:Yr({...e.floatingTools,...t.floatingTools??{}},o?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...t.globalSettings??{}}}},Qr=(e=[],t,o)=>{let a={},n={},i=new Set(t??[]),l=new Set(o??[]),u=!o||o.length===0;for(let d of e){let{id:p,slot:m="both"}=d;(m==="dial"||m==="both")&&(a[p]=u?true:l.has(p)),(m==="row"||m==="both")&&(n[p]=i.has(p))}return{dialTools:ut(a),floatingTools:{...n,environment:i.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}},Zr=({visible:e,onClose:t,onSettingsChange:o,initialSettings:a,availableApps:n=[],storage:i=ze,zIndex:l})=>{let{defaultFloatingTools:u,defaultDialTools:d}=ko(),p=lt(()=>Qr(n,u,d),[n,u,d]),m=lt(()=>Object.keys(p.dialTools),[p]),C=lt(()=>Object.keys(p.floatingTools).filter(s=>s!=="environment"),[p]),[g,k]=te(a||Ue||p),[y,S]=te(Mt??"floating"),[T,M]=te(Mt!==null),[B,_]=te(new Set),[x,z]=te(false),[P,I]=te(false);Ie(()=>{let s=requestAnimationFrame(()=>I(true));return()=>cancelAnimationFrame(s)},[]);let R=Sr();Ie(()=>{(async()=>{try{let s=await ze.getItem(kt.settings.activeTab());if(s&&["floating","settings","pro"].includes(s)){let f=s;Mt=f,S(O=>O===f?O:f)}}catch{}finally{M(true)}})()},[]),Ie(()=>{T&&ze.setItem(kt.settings.activeTab(),y).catch(s=>{console.warn("Failed to save settings active tab:",s)})},[y,T]);let oe=zr()?.(),Z=oe?.isPro??false,G=!Z&&oe?.licenseKey?oe.error:null,le=oe?.errorKind==="transport",[K,ne]=te(Oo),[J,Se]=te(false),[me,ve]=te(false),[L,Re]=te(false),[fe,re]=te([]),[we,ae]=te(false),r=Jr(),F=jt.get("window").height,W=jt.get("window").width,je=Math.floor(F*.33),Je=Math.min(W-32,400),Ae=st(async()=>{try{let s=await i.getItem(dt);if(s){let f=JSON.parse(s),O=Ao(p,f,{allowedDialKeys:m,allowedFloatingKeys:C});Ue=O,k(Y=>Eo(Y,O)?Y:O);return}Ue=p,k(f=>Eo(f,p)?f:p)}catch(s){console.error("Failed to load dev tools settings:",s),k(p)}},[p,m,C,i]);Ie(()=>{Ae()},[Ae]),Ie(()=>{Ir().then(s=>{Oo=s,ne(f=>f===s?f:s)})},[]),Ie(()=>{L&&(ae(true),ze.getAllKeys().then(s=>{re(s.sort())}).catch(()=>{re([])}).finally(()=>{ae(false)}))},[L]);let Xe=async s=>{try{let f={...s,dialTools:ut(s.dialTools)};await i.setItem(dt,JSON.stringify(f)),Ue=f,k(f),o?.(f),ct.emit(f)}catch(f){console.error("Failed to save dev tools settings:",f)}},Ye=s=>{let f={...g,floatingTools:{...g.floatingTools,[s]:!g.floatingTools[s]}};Xe(f)},Oe=s=>{let f={...g,globalSettings:{...g.globalSettings,[s]:!g.globalSettings?.[s]}};Xe(f)},Qe=async()=>{Se(true),ve(false);try{await ze.clear(),ve(true),k(p),i!==ze&&await i.setItem(dt,JSON.stringify(p)),o?.(p),ct.emit(p),setTimeout(()=>ve(false),2e3)}catch(s){console.error("Failed to clear storage:",s)}finally{Se(false)}},bt=st(s=>{},[]),St=s=>{let f=n.find(O=>O.id===s);return f?.description?f.description:s==="environment"?"Environment badge.":""},A=s=>s==="environment"?"Env Badge":n.find(f=>f.id===s)?.name??s.toUpperCase().replace(/_/g," "),w=s=>{if(!P)return null;switch(s){case"query":return c(Pr,{size:18});case"env":return c(Io,{size:18});case"sentry":return c(vr,{size:18,color:"#9945FF"});case"storage":return c(Dr,{size:18,bgColor:h.color.surface});case"wifi":case"query-wifi-toggle":return c(wr,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return c(Br,{size:18,bgColor:h.color.surface});case"network":return c(Fr,{size:18});case"environment":return c(Io,{size:18});case"debug-borders":return c(Tr,{size:18,color:h.color.accent});case"highlight-updates":return c(Cr,{size:18,color:h.color.accent});case"highlight-updates-modal":return c(Lr,{size:18});case"redux":return c($r,{size:18});case"image-overlay":return c(xr,{size:18});case"events":return c(Wr,{size:18});case"zustand":try{let{ZustandIcon:f}=Nt("@buoy-gg/zustand/web");return c(f,{size:18})}catch{return c(It,{size:18,color:h.color.textSecondary})}case"jotai":try{let{JotaiIcon:f}=Nt("@buoy-gg/jotai/web");return c(f,{size:18})}catch{return c(It,{size:18,color:h.color.textSecondary})}default:{let f=n.find(O=>O.id===s);return f?.icon!=null?Ro(f.icon,{slot:"row",size:18,color:f.color}):c(It,{size:18,color:h.color.textSecondary})}}},X=(s,f,O,Y)=>{let he=St(s);return $(Ze,{activeOpacity:O?1:.7,onPress:()=>!O&&Y(),accessibilityLabel:A(s),accessibilityRole:"button",style:[b.toolRow,O&&b.rowDisabled],children:[c(j,{style:b.toolIconSlot,children:w(s)}),$(j,{style:b.rowInfo,children:[$(N,{style:b.rowLabel,children:[A(s),O?" \xB7 max 6":""]}),he?c(N,{style:b.rowCaption,numberOfLines:1,children:he}):null]}),c(xo,{value:f,disabled:O,onValueChange:()=>Y()})]},s)},H=s=>{_(f=>{let O=new Set(f);return O.has(s)?O.delete(s):O.add(s),O})},q=(s,f,O,Y,he)=>{let ye=g.globalSettings?.[s]??false,Ee=B.has(s);return $(j,{children:[$(Ze,{activeOpacity:.7,onPress:()=>H(s),accessibilityLabel:f,style:b.settingRow,children:[$(j,{style:b.rowInfo,children:[c(N,{style:b.rowLabel,children:f}),c(N,{style:b.rowCaption,numberOfLines:Ee?0:1,children:O})]}),c(xo,{value:ye,onValueChange:()=>Oe(s)})]}),Ee&&$(j,{style:b.settingRowBody,children:[c(N,{style:b.settingRowBodyText,children:Y}),c(N,{style:b.settingRowBodyHint,children:he})]})]},s)},U=(s,f,O)=>$(j,{children:[c(Ar,{children:s}),f,O]}),ee=K==="filesystem"?c(ue,{label:"File System",tone:"accent"}):K==="asyncstorage"?c(ue,{label:"Async Storage",tone:"warning"}):K==="localstorage"?c(ue,{label:"Local Storage",tone:"accent"}):K==="memory"?c(ue,{label:"Memory",tone:"danger"}):c(ue,{label:"Loading\u2026",tone:"neutral"}),ce=()=>$(j,{style:b.container,children:[$(Wt,{style:b.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:b.scrollContainer,children:[y==="floating"&&c(Ke,{children:U("Floating Tools",c(ke,{glass:true,children:c(zt,{children:Object.entries(g.floatingTools).map(([s,f])=>X(s,f,false,()=>Ye(s)))})}),c(wo,{children:"Tools switched on here appear in the floating bubble row."}))}),y==="settings"&&$(Ke,{children:[U("Background",c(ke,{glass:true,padded:true,children:c(Rr,{embedded:true})})),U("Storage",$(ke,{glass:true,children:[$(Ze,{activeOpacity:.7,onPress:()=>Re(!L),accessibilityLabel:"Storage Type",style:b.settingRow,children:[c(j,{style:b.rowInfo,children:c(N,{style:b.rowLabel,children:"Storage Type"})}),ee,L?c(So,{size:16,color:h.color.textTertiary}):c(bo,{size:16,color:h.color.textTertiary})]}),L&&$(Ke,{children:[$(j,{style:b.settingRowBody,children:[c(N,{style:b.settingRowBodyText,children:K==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":K==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":K==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":K==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),K==="asyncstorage"&&c(N,{style:[b.settingRowBodyText,b.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),K==="memory"&&c(N,{style:[b.settingRowBodyText,b.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),c(Er,{}),$(j,{style:b.storageExpanded,children:[$(j,{style:b.storageExpandedHeader,children:[c(N,{style:b.storageExpandedTitle,children:"SAVED SETTINGS"}),c(N,{style:b.storageExpandedCount,children:we?"\u2026":`${fe.length} keys`})]}),we?c(N,{style:b.storageKeyEmpty,children:"Loading\u2026"}):fe.length===0?c(N,{style:b.storageKeyEmpty,children:"No settings saved yet"}):c(Wt,{style:b.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:fe.map(s=>c(j,{style:b.storageKeyItem,children:c(N,{style:b.storageKeyText,numberOfLines:1,children:s.replace("@react_buoy_","")})},s))})]}),c(j,{style:b.cardButtonWrap,children:c(Co,{label:me?"Cleared":J?"Clearing\u2026":"Clear All Settings",variant:me?"secondary":"destructive",size:"md",disabled:J,onPress:Qe,icon:me?c(vo,{size:15,color:h.color.accent}):c(kr,{size:15,color:J?h.color.textTertiary:h.color.danger})})})]})]})),R&&R.state!=="idle"&&U("Desktop Sync",$(ke,{glass:true,children:[$(Ze,{activeOpacity:.7,onPress:()=>H("desktopSync"),accessibilityLabel:"Buoy Desktop",style:b.settingRow,children:[c(j,{style:b.rowInfo,children:c(N,{style:b.rowLabel,children:"Buoy Desktop"})}),R.state==="connected"?c(ue,{label:"Connected",tone:"accent"}):R.state==="connecting"?c(ue,{label:"Connecting\u2026",tone:"neutral"}):c(ue,{label:"Retrying",tone:"warning"}),B.has("desktopSync")?c(So,{size:16,color:h.color.textTertiary}):c(bo,{size:16,color:h.color.textTertiary})]}),B.has("desktopSync")&&$(j,{style:b.settingRowBody,children:[$(N,{style:b.settingRowBodyText,children:[R.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",c(N,{style:b.footnoteMono,children:R.targetURL??"(unknown URL)"}),R.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),R.state==="retrying"&&R.lastError&&$(N,{style:[b.settingRowBodyText,b.bodyWarning],children:["Last error: ",R.lastError]})]})]})),U("Modal Behavior",c(ke,{glass:true,children:$(zt,{children:[q("enableSharedModalDimensions","Shared Modal Size","Sync dimensions across all tools","When enabled, all tool modals will share the same size and position. Resizing one modal will affect all others. When disabled, each tool remembers its own size and position independently.","Keep OFF for the best experience. This allows you to customize each tool's modal size separately."),De.OS!=="web"?q("expandableWindowControls","Expand Controls","iPad-style expandable window buttons","When enabled, the window control buttons (minimize, toggle mode, close) start as small dots and expand into larger, easy-to-tap buttons when pressed. When disabled, buttons are directly tappable at their small size.","Keep ON for touch devices where the small buttons are hard to press. Turn OFF if you prefer direct single-tap access."):null]})}))]}),y==="pro"&&$(Ke,{children:[U("License",c(ke,{glass:true,children:$(j,{style:b.settingRow,children:[c(j,{style:b.rowInfo,children:c(N,{style:b.rowLabel,children:"License Status"})}),c(j,{testID:"buoy-settings-license-status",accessibilityLabel:Z?"License: Active":"License: Free",children:Z?c(ue,{label:"Active",tone:"accent"}):c(ue,{label:"Free",tone:"neutral"})})]})}),c(wo,{children:Z?"You have full access to all Buoy DevTools features.":G?le?`Couldn't reach the license server (${G}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${G}.`:"Upgrade to Pro to unlock all features and support development."})),!Z&&$(Ke,{children:[U("Pro Features",c(ke,{glass:true,children:c(zt,{children:["Advanced Settings","Priority Support"].map(s=>$(j,{style:b.featureRow,children:[c(vo,{size:16,color:h.color.accent}),c(N,{style:b.rowLabel,children:s})]},s))})})),c(Co,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>z(true)})]})]})]}),c(Mr,{visible:x,onClose:()=>z(false),onSuccess:()=>z(false)})]});return c(Gr,{visible:e,onClose:t,zIndex:l,variant:"night",header:{showToggleButton:false,customContent:c(j,{style:b.headerRow,children:c(Or,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:y,onChange:s=>S(s)})})},initialMode:"bottomSheet",onModeChange:bt,persistenceKey:kt.settings.root(),enablePersistence:true,maxHeight:F-r.top,initialHeight:je,initialFloatingPosition:{x:(W-Je)/2,y:r.top+20},enableGlitchEffects:true,children:ce()})},es={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}},ts=(e,t)=>{let o=new Set(e??[]),a=new Set(t??[]),n={};for(let l of a)n[l]=true;let i={environment:o.has("environment")};for(let l of o)l!=="environment"&&(i[l]=true);return{dialTools:ut(n),floatingTools:i,globalSettings:{enableSharedModalDimensions:false}}},Ue=null,Mt=null,Oo=null,Eo=(e,t)=>JSON.stringify(e)===JSON.stringify(t);ct.addListener(e=>{e&&(Ue=e)});var os=()=>{let{defaultFloatingTools:e,defaultDialTools:t}=ko(),o=lt(()=>!e&&!t?es:ts(e,t),[e,t]),[a,n]=te(o),i=st(async()=>{try{let u=await ze.getItem(dt);if(u){let d=JSON.parse(u),p=Ao(o,d);n(p);return}n(o)}catch(u){console.error("Failed to load dev tools settings:",u),n(o)}},[o]);Ie(()=>{i();let u=ct.addListener(d=>{try{d&&n(d)}catch{}});return()=>{u()}},[i]);let l=st(()=>{i()},[i]);return{settings:a,refreshSettings:l}},b=Ht.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:h.gutter,paddingRight:h.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:h.gutter,paddingTop:8,paddingBottom:24,gap:h.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:h.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:h.rowPadH,paddingVertical:h.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:h.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:h.color.text,fontSize:h.font.row,fontWeight:"500"},rowCaption:{color:h.color.textTertiary,fontSize:h.font.label},settingRowBody:{paddingHorizontal:h.rowPadH,paddingBottom:h.rowPadV,gap:6},settingRowBodyText:{color:h.color.textSecondary,fontSize:h.font.caption,lineHeight:h.font.caption*1.45},settingRowBodyHint:{color:h.color.textTertiary,fontSize:h.font.caption,lineHeight:h.font.caption*1.45},bodyWarning:{color:h.color.warning},bodyDanger:{color:h.color.danger},cardButtonWrap:{paddingHorizontal:h.cardPad,paddingTop:10,paddingBottom:h.cardPad},storageExpanded:{paddingHorizontal:h.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:h.color.textSecondary,fontSize:h.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:h.color.textTertiary,fontSize:h.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:h.color.glassElevated,borderRadius:h.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:h.color.textSecondary,fontSize:h.font.micro,fontFamily:To},storageKeyEmpty:{color:h.color.textTertiary,fontSize:h.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:To,fontSize:h.font.label,color:h.color.textSecondary}});import{jsx as Do}from"react/jsx-runtime";var ns=[];function Bo({visible:e,onClose:t,availableTools:o=ns,defaultFloatingTools:a,defaultDialTools:n,storage:i=gr,onSettingsChange:l}){let u=yo(()=>({getItem:async m=>i.getItem(m),setItem:async(m,C)=>i.setItem(m,C)}),[i]),d=yo(()=>o.map(m=>({...m,name:m.name??m.id,icon:typeof m.icon=="function"?C=>m.icon(C.size):m.icon})),[o]),p=mr(m=>{l?.(m)},[l]);return Do(Ur,{defaultFloatingTools:a,defaultDialTools:n,children:Do(Zr,{visible:e,onClose:t,zIndex:11e3,availableApps:d,storage:u,onSettingsChange:p})})}import{persistentStorage as Fo}from"@buoy-gg/shared-ui/web";import{createContext as as,useCallback as be,useContext as is,useEffect as Rt,useMemo as rs,useRef as Ve,useState as Po}from"react";var ss=(e,t,o)=>{if(t.singleton){let n=e.find(i=>i.id===t.id);if(n){let i=n.minimized??false;return{instanceId:n.instanceId,wasMinimized:i,apps:[...e.filter(l=>l.instanceId!==n.instanceId),{...n,minimized:false}]}}}let a=o();return{instanceId:a,wasMinimized:false,apps:[...e,{...t,instanceId:a}]}};import{createContext as ls,useCallback as Lo,useContext as cs,useEffect as pt,useMemo as ds,useRef as $o,useState as mt}from"react";import{JsModal as us,ModalHeader as _e,HeaderSearchButton as ps,TickProvider as ms,devToolsStorageKeys as Wo,buoyColors as jo,gameUIColors as At}from"@buoy-gg/shared-ui/web";import{jsx as se,jsxs as gt}from"react/jsx-runtime";var qe=()=>{},gs={search:"",isSearchActive:false,clearSearch:qe,close:qe,minimize:qe,showToast:qe,setHeaderOverride:qe},Ho=ls(null);function No(){return cs(Ho)??gs}function fs(e,t){let{setHeaderOverride:o}=No();pt(()=>(o(e),()=>o(null)),t)}var Ko=2200,hs={success:At.success,error:At.error,info:At.info};function ys({message:e,type:t,nonce:o}){let a=$o(new xe.Value(0)).current;pt(()=>{a.setValue(0),xe.sequence([xe.timing(a,{toValue:1,duration:150,useNativeDriver:true}),xe.delay(Ko-450),xe.timing(a,{toValue:0,duration:300,useNativeDriver:true})]).start()},[o,a]);let n=hs[t];return gt(xe.View,{pointerEvents:"none",style:[ft.toast,{opacity:a,borderColor:n+"60"}],children:[se(j,{style:[ft.toastDot,{backgroundColor:n}]}),se(N,{style:ft.toastText,numberOfLines:2,children:e})]})}function bs({app:e,config:t,visible:o,zIndex:a,onClose:n,onMinimize:i,initialModalState:l,enableSharedModalDimensions:u,bodyProps:d}){let p=e.component,[m,C]=mt(false),[g,k]=mt(""),[y,S]=mt(null),[T,M]=mt(null),B=$o(null),_=Lo(()=>{C(false),k("")},[]),x=Lo((K,ne="info")=>{B.current&&clearTimeout(B.current),M(J=>({message:K,type:ne,nonce:(J?.nonce??0)+1})),B.current=setTimeout(()=>M(null),Ko)},[]);pt(()=>()=>{B.current&&clearTimeout(B.current)},[]);let z=ds(()=>({search:m?g:"",isSearchActive:m,clearSearch:_,close:n,minimize:()=>i(),showToast:x,setHeaderOverride:S,instanceId:e.instanceId}),[g,m,_,n,i,x,e.instanceId]),P=y?.title??t.title??e.title??e.id,I=y?.subtitle??t.subtitle,R=y?.onBack,oe=y?.actions??t.headerActions,Z=y?.searchable??t.searchable;pt(()=>{!Z&&m&&_()},[Z,m,_]);let G=u?Wo.modal.root():Wo.custom(e.id).modal(),le=gt(_e,{children:[R&&!m&&se(_e.Navigation,{onBack:R}),m?se(_e.Search,{value:g,onChangeText:k,onCancel:_,placeholder:t.searchPlaceholder,testID:`tool-search-field-${e.id}`}):se(_e.Content,{title:P,subtitle:I}),gt(_e.Actions,{children:[!m&&oe,Z&&!m&&se(ps,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>C(true)})]})]});return se(Ho.Provider,{value:z,children:se(us,{visible:o,onClose:n,onBack:R,onMinimize:i,initialModalState:l,zIndex:a,persistenceKey:G,enablePersistence:true,initialMode:t.initialMode??"bottomSheet",header:{customContent:le,showToggleButton:true},disableScrollWrapper:true,styles:{},children:gt(j,{style:ft.bodyRoot,children:[se(ms,{children:se(p,{...d})}),T&&se(ys,{message:T.message,type:T.type,nonce:T.nonce})]})})})}var ft=Ht.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:jo.card,borderWidth:1,borderRadius:8,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOpacity:.4,shadowRadius:8,shadowOffset:{width:0,height:2},elevation:6},toastDot:{width:6,height:6,borderRadius:3},toastText:{flex:1,fontSize:12,color:jo.text}});import{Fragment as Ss,jsx as pe}from"react/jsx-runtime";var Uo=as(null),Vo="@react_buoy_open_apps",Ot=44,vs=12,ws=100,xs=16,Cs=e=>({x:window.innerWidth-Ot-xs,y:window.innerHeight-ws-Ot-e*(Ot+vs)}),_o=({children:e})=>{let[t,o]=Po([]),[a,n]=Po(false),i=Ve([]),l=Ve(null),u=Ve(false),d=Ve(false),p=Ve(false),m=be(x=>{let z="";return o(P=>{let{apps:I,instanceId:R}=ss(P,x,()=>`${x.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);return z=R,I}),z},[]),C=be(()=>{if(u.current||!d.current||!p.current)return;u.current=true;let x=l.current;if(!x||x.length===0){n(true);return}l.current=null,x.forEach(({id:z,minimized:P})=>{let I=i.current.find(R=>R.id===z);if(I&&I.component){let R=Ro(I.icon,{slot:"dial",size:20,color:I.color});m({id:I.id,title:I.name,component:I.component,props:I.props,modal:I.modal,launchMode:I.launchMode||"self-modal",singleton:I.singleton??true,icon:R,color:I.color,minimized:P})}}),n(true)},[m]);Rt(()=>{let x=false;return(async()=>{try{let z=await Fo.getItem(Vo);if(x)return;if(z){let P=JSON.parse(z),I;Array.isArray(P)&&P.length>0&&(typeof P[0]=="string"?I=P.map(R=>({id:R,minimized:false})):I=P.filter(R=>typeof R=="object"&&R!==null&&typeof R.id=="string"),I.length&&(l.current=I))}}catch{}x||(d.current=true,C())})(),()=>{x=true}},[C]),Rt(()=>{if(!a)return;let x=t.map(z=>({id:z.id,minimized:z.minimized??false}));Fo.setItem(Vo,JSON.stringify(x))},[t,a]);let g=be(x=>{i.current=x,p.current=true,C()},[C]),k=be(x=>{o(z=>z.length?x?z.filter(P=>P.instanceId!==x):z.slice(0,-1):z)},[]),y=be(()=>o([]),[]),S=be((x,z)=>{o(P=>P.map(I=>I.instanceId===x?{...I,minimized:true,restoreState:z}:I))},[]),T=be((x,z)=>{o(P=>P.map(I=>I.instanceId===x?{...I,minimized:false,restoreState:z??I.restoreState}:I))},[]),M=be(x=>t.find(z=>z.instanceId===x)?.minimized??false,[t]),B=t.some(x=>x.launchMode!=="toggle-only"&&!x.minimized);Rt(()=>{if(!B)return;let x=z=>{if(z.key!=="Escape"||z.defaultPrevented)return;let P=[...t].reverse().find(I=>I.launchMode!=="toggle-only"&&!I.minimized);P&&k(P.instanceId)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[B,k,t]);let _=rs(()=>({openApps:t,isAnyOpen:B,open:m,close:k,closeAll:y,registerApps:g,minimize:S,restore:T,isMinimized:M}),[t,B,m,k,y,g,S,T,M]);return pe(Uo.Provider,{value:_,children:e})},ht=()=>{let e=is(Uo);return e||{openApps:[],isAnyOpen:false,open:()=>"",close:()=>{},closeAll:()=>{},registerApps:()=>{},minimize:()=>{},restore:()=>{},isMinimized:()=>false}},Ts=9e3,Is={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"},zs={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"},ks=({app:e,zIndex:t,onClose:o,onMinimize:a,minimizeTargetPosition:n,enableSharedModalDimensions:i})=>{let l=e.component,u=!e.minimized,d={...e.props??{},...i?{enableSharedModalDimensions:true}:{}};return e.modal&&(!e.launchMode||e.launchMode==="self-modal")?pe(bs,{app:e,config:e.modal,visible:u,zIndex:t,onClose:o,onMinimize:a,initialModalState:e.restoreState,enableSharedModalDimensions:i,bodyProps:d}):e.launchMode==="self-modal"?pe(l,{...d,visible:u,onClose:o,onRequestClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId,zIndex:t,initialModalState:e.restoreState}):e.launchMode==="inline"?u?pe("div",{style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:pe(l,{...d,onClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId})}):null:pe("div",{style:{...Is,zIndex:t,display:u?"flex":"none"},children:pe("div",{style:zs,children:pe(l,{...d,onClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId})})})},qo=()=>{let{openApps:e,close:t,minimize:o}=ht(),{settings:a}=os(),n=e.filter(u=>u.launchMode!=="toggle-only");if(n.length===0)return null;let i=n.filter(u=>u.minimized).length,l=zi()??Cs(i);return pe(Ss,{children:n.map((u,d)=>pe(ks,{app:u,zIndex:Ts+d,onClose:()=>t(u.instanceId),onMinimize:p=>o(u.instanceId,p),enableSharedModalDimensions:a.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:l},u.instanceId))})};import{useCallback as Ms,useEffect as Et,useRef as Rs,useState as Go,useSyncExternalStore as Jo}from"react";import{persistentStorage as Xo,getToolAttention as Dt,subscribeToolAttention as Yo}from"@buoy-gg/shared-ui/web";import{jsx as ie,jsxs as yt}from"react/jsx-runtime";function As(e){return Jo(Yo,()=>Dt(e),()=>Dt(e))}var Qo={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"},Zo={needsInput:3,failed:2,done:1},en=new Map;function tn(e){let t=null;for(let a of e?e.split("|"):[]){let n=Dt(a);n&&(!t||Zo[n.kind]>Zo[t.kind])&&(t=n)}let o=en.get(e);return o&&t&&o.kind===t.kind&&o.label===t.label?o:!o&&!t?null:(en.set(e,t),t)}function Os(e){let t=e.join("|");return Jo(Yo,()=>tn(t),()=>tn(t))}var on=28,Bt=32,Ft=6,nn=8,an=24,rn="@react_buoy_minimized_stack_expanded",Es=80,sn=2e3,Ds=6e3,Bs="#1A1A1A",Ge="#888888";function ln({down:e=false}){return ie("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:ie("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:Ge,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Fs({id:e,title:t,icon:o,index:a,onPress:n}){let i=As(e),l=Rs(null);return Et(()=>{let u=true,d,p=()=>{l.current?.animate([{transform:"translateX(0) scale(1)",opacity:1,offset:0},{transform:"translateX(3px) scale(1.05)",opacity:.4,offset:.2},{transform:"translateX(-3px) scale(1.1)",opacity:1,offset:.4},{transform:"translateX(2px) scale(1.0)",opacity:.6,offset:.6},{transform:"translateX(-1px) scale(0.95)",opacity:1,offset:.8},{transform:"translateX(0) scale(1)",opacity:1,offset:1}],{duration:Es,easing:"linear"})},m=C=>{let g=C?500+Math.random()*1500+a*200:sn+Math.random()*(Ds-sn)+a*300;d=setTimeout(()=>{u&&(p(),m(false))},g)};return m(true),()=>{u=false,clearTimeout(d)}},[a]),yt("button",{type:"button","aria-label":i?`${t} \u2014 ${i.label}. Restore`:`Restore ${t}`,onClick:n,style:{width:Bt,height:Bt,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[ie("div",{ref:l,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:o}),i?ie("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${i.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Qo[i.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:i.kind==="needsInput"?"!":""}):null]})}function Ps({containerWidth:e=32}){let{openApps:t,restore:o}=ht(),a=t.filter(g=>g.minimized&&g.launchMode!=="toggle-only"),[n,i]=Go(false),[l,u]=Go(false),d=Os(a.map(g=>g.id));Et(()=>{let g=false;return(async()=>{let k=await Xo.getItem(rn);!g&&k==="true"&&i(true),g||u(true)})(),()=>{g=true}},[]),Et(()=>{l&&Xo.setItem(rn,n?"true":"false")},[n,l]);let p=Ms(g=>{o(g)},[o]);if(a.length===0)return null;let m=nn+a.length*Bt+(a.length-1)*Ft+Ft+an+4,C={backgroundColor:Bs,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${Ge}66`,borderLeft:`1px solid ${Ge}66`,borderRight:`1px solid ${Ge}66`,borderBottom:"none",boxSizing:"border-box"};return yt("div",{style:{height:on,overflow:"visible",position:"relative"},children:[ie("div",{style:{position:"absolute",bottom:"var(--buoy-stack-bottom, 0px)",top:"var(--buoy-stack-top, auto)",left:0,width:e,maxHeight:"var(--buoy-stack-space, calc(100vh - 48px))",visibility:n?"visible":"hidden",height:n?m:0,opacity:n?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:n?"auto":"none",...C},children:yt("div",{style:{height:m,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:nn,gap:Ft,boxSizing:"border-box"},children:[[...a].reverse().map((g,k)=>ie(Fs,{id:g.id,title:g.title||g.id,icon:g.icon??ie("span",{style:{color:"#fff",fontSize:13},children:(g.title||g.id).slice(0,1).toUpperCase()}),index:k,onPress:()=>p(g.instanceId)},g.instanceId)),ie("button",{type:"button","aria-label":"Collapse",onClick:()=>i(false),style:{width:"100%",height:an,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:ie(ln,{down:true})})]})}),yt("button",{type:"button","aria-label":`Show ${a.length} minimized tools`,tabIndex:n?-1:0,"aria-hidden":n,onClick:()=>i(true),style:{position:"absolute",bottom:0,left:0,width:e,height:on,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",padding:0,opacity:n?0:1,transform:n?"scale(0.9)":"scale(1)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:n?"none":"auto",...C},children:[ie(ln,{}),d?ie("span",{"aria-hidden":true,"data-testid":"buoy-dock-peek-attention",style:{position:"absolute",top:2,right:2,minWidth:11,height:11,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Qo[d.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:d.kind==="needsInput"?"!":""}):null,a.length>1&&ie("span",{style:{fontSize:9,fontWeight:600,color:Ge,marginLeft:1},children:a.length})]})]})}import{registerToolModules as Ls}from"@buoy-gg/shared-ui/web";import{createElement as $s}from"react";function cn(e){let t=e.icon;return{...e,icon:typeof t=="function"?o=>$s(t,{size:o,slot:e.slot??"both",color:e.color}):()=>t}}import{createContext as Ws,useContext as js,useState as dn,useMemo as un}from"react";import{jsx as Hs}from"react/jsx-runtime";var pn=Ws(null);function mn({children:e}){let[t,o]=dn(false),[a,n]=dn(false),i=un(()=>t||a,[t,a]),l=un(()=>({isDialOpen:t,isToolOpen:a,isDevToolsActive:i,setDialOpen:o,setToolOpen:n}),[t,a,i]);return Hs(pn.Provider,{value:l,children:e})}function Pt(){let e=js(pn);return e||{isDialOpen:false,isToolOpen:false,isDevToolsActive:false,setDialOpen:()=>{},setToolOpen:()=>{}}}import*as Ns from"@buoy-gg/license/web";import*as Ks from"@buoy-gg/shared-ui/web";import*as Us from"@buoy-gg/shared-ui/web/dataViewer";function gn(e){Ls({core:{useDevToolsVisibility:Pt},license:Ns,"shared-ui":Ks,"shared-ui/dataViewer":Us,...e});let t=new Set;return Object.values(e).flatMap(o=>Object.entries(o).flatMap(([a,n])=>!a.endsWith("Preset")||!n||typeof n.id!="string"||!n.component||t.has(n.id)?[]:(t.add(n.id),[cn(n)])))}import{useEffect as Lt,useMemo as fn,useRef as Vs}from"react";import{LicenseManager as _s,useLicense as qs}from"@buoy-gg/license/web";import{registerToolAdapters as Gs}from"@buoy-gg/shared-ui/web";function hn(e){return typeof e=="object"&&e!==null?e:void 0}function Js({isDevelopment:e,isLicensed:t,externalSync:o,isAvailable:a}){return o===false||!a?false:e?true:t&&hn(o)?.enableInRelease===true}import{useEffect as Xs,useMemo as Ys,useState as Qs}from"react";import{devToolsStorageKeys as Zs,persistentStorage as el}from"@buoy-gg/shared-ui/web";var tl=8;function ol(){let e="";for(;e.length<tl;)e+=(Math.random()*16|0).toString(16);return e}function nl(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function al({appName:e,hardwareName:t,platform:o,installId:a,deviceId:n}){let i=nl(e??"buoy")||"buoy",l=e??"Buoy Device",u=t?.trim()||o;return n?{deviceId:n,deviceName:`${l} (${u})`}:{deviceId:`${i}-${o}-${a}`,deviceName:`${l} (${u} \xB7 ${a.slice(-4)})`}}function il(){let e=globalThis;try{return e.sessionStorage??null}catch{return null}}async function rl({platform:e=De.OS,store:t,mint:o=ol}={}){let a=Zs.sync.deviceId(),n=t===void 0?e==="web"?il():el:t;if(!n)return o();try{let i=await n.getItem(a);if(i&&i.length>0)return i;let l=o();return await n.setItem(a,l),l}catch{return o()}}var $t=null;function sl(){return $t||($t=rl()),$t}function ll(e,t){let o=e?.deviceId,a=e?.deviceName,n=t.loadId??sl,i=t.platform??De.OS,[l,u]=Qs(null);return Xs(()=>{if(o)return;let d=false;return n().then(p=>{d||u(p)}),()=>{d=true}},[o,n]),Ys(()=>{if(!o&&!l)return null;let d=al({appName:t.appName,hardwareName:t.hardwareName,platform:i,installId:l??"",deviceId:o});return a?{...d,deviceName:a}:d},[o,a,l,t.appName,t.hardwareName,i])}import{getDevServerOrigin as cl,resolveReloadStrategy as dl,scheduleReloadApp as ul}from"@buoy-gg/shared-ui/web";var yn=Date.now(),bn=cl(),pl={platform:De.OS,isTV:De.isTV===true,isTVOS:De.isTVOS===true},Sn={version:3,getSnapshot:()=>{let e=dl("auto");return{startedAt:yn,devServerOrigin:bn,device:pl,reload:{available:e!==null,strategy:e}}},subscribe:e=>()=>{},actions:{ping:()=>({ok:true,startedAt:yn,devServerOrigin:bn}),reloadApp:e=>{let t=e??{},{strategy:o,delayMs:a}=ul({strategy:t.strategy,delayMs:t.delayMs});return{scheduled:true,strategy:o,delayMs:a}}}};import{Fragment as ml,jsx as Me,jsxs as gl}from"react/jsx-runtime";var fl=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"],hl=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];function yl(e){let t=fn(()=>Object.fromEntries(Object.entries(e.modules).map(([a,n])=>[a.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),n])),[e.modules]),o=t["react-query"];return o?.useReactQuerySyncAdapter?Me(bl,{...e,modules:t,query:o}):Me(vn,{...e,modules:t})}function bl(e){let t=e.query.useReactQuerySyncAdapter();return Me(vn,{...e,queryAdapter:t})}function vn({modules:e,apps:t,requiredEnvVars:o,externalSync:a,headless:n,sentryGetClient:i,queryAdapter:l}){let{isPro:u,tier:d}=qs(),p=fn(()=>{let y={app:Sn};for(let[S,T]of Object.entries(e))for(let[M,B]of Object.entries(T))M.endsWith("SyncAdapter")&&B&&typeof B=="object"&&(y[S]=B);l&&(y.query=l),e.env?.createEnvSyncAdapter&&(y.env=e.env.createEnvSyncAdapter(o??[]));for(let S of t??[])S.sync&&(y[`custom:${S.id}`]=S.sync);return y},[e,t,o,l]),m=Vs(p);m.current=p,Lt(()=>Gs(()=>m.current),[]),Lt(()=>{let y=[],S=T=>{let M=T?.();typeof M=="function"&&y.push(M)};return S(e.network?.startNetworkCapture),S(e.storage?.startBrowserStorageCapture),S(e.assets?.startBrowserAssetCapture),e.storage?.storageSyncAdapter?.subscribe&&S(()=>e.storage.storageSyncAdapter.subscribe(()=>{})),e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe&&S(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{})),()=>{for(let T of y.reverse())T()}},[e]);let C=e["external-sync"],g=Js({isDevelopment:typeof et<"u"?et:process.env.NODE_ENV!=="production",isLicensed:u,externalSync:a,isAvailable:!!C}),k=e.sentry?.SentryRoot;return gl(ml,{children:[Object.entries(e).flatMap(([y,S])=>fl.map(T=>{let M=S[T];return M?Me(M,{},`${y}:${T}`):null})),k&&Me(k,{getClient:i}),Object.entries(e).flatMap(([y,S])=>hl.map(T=>{let M=S[T];return M&&(!n||T==="ScenariosOverlay"||T==="ImpersonateOverlay")?Me(M,{},`${y}:${T}`):null})),g&&Me(Sl,{module:C,tools:p,options:hn(a),isPro:u,tier:d})]})}function Sl({module:e,tools:t,options:o,isPro:a,tier:n}){let i=ll(o,{appName:typeof document>"u"?null:document.title||location.hostname,hardwareName:"Browser",platform:"web"}),{socket:l}=e.useExternalSyncSocket({deviceName:i?.deviceName??"Buoy Browser",socketURL:o?.socketURL??e.getDefaultSocketURL(),persistentDeviceId:i?.deviceId??null,platform:"web",enableLogs:o?.enableLogs});return Lt(()=>{if(!l)return;let u=()=>{l.connected&&_s.hasAccountAccess()&&l.emit("device-license",{isPro:a?"1":"0",tier:n})};return u(),l.on("connect",u),()=>{l.off("connect",u)}},[l,a,n]),e.useExternalSync({tools:t,socket:l,deviceId:i?.deviceId??null,enableLogs:o?.enableLogs}),null}import{jsx as V,jsxs as wn}from"react/jsx-runtime";var vl={},xn="@react_buoy_floating_menu_tooltip_shown",wl=Ce;function xl({size:e=14,color:t="#20C997"}){let o=Math.max(2,e/4),a=Math.max(1,e/16);return V("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:a,width:e,height:e,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((n,i)=>V("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:t}},i))})}function Cl(e){return V(mn,{children:V(_o,{children:V(Tl,{...e})})})}function Tl({environment:e,userRole:t,availableEnvironments:o,onEnvironmentSwitch:a,apps:n,modules:i=vl,externalSync:l,requiredEnvVars:u,sentryGetClient:d,disableHints:p=false,headless:m=false}){let[C,g]=vt(false),[k,y]=vt(false),S=yi(false),T=ht(),M=Be(()=>Ut([...gn(i),...n??[]]),[n,i]),B=Pt(),_=T.openApps.some(r=>!r.minimized);de(()=>{B.setDialOpen(C)},[C,B.setDialOpen]),de(()=>{B.setToolOpen(_||k)},[_,k,B.setToolOpen]);let{registerApps:x}=T;de(()=>{x(M.map(r=>{let F=r.icon;return{...r,icon:typeof F=="function"?({size:W})=>F(W):F}}))},[x,M]);let z=Be(()=>M.map(r=>({id:r.id,name:r.name,description:r.description,slot:r.slot})),[M]),{settings:P}=bi({availableTools:z,storage:wl});de(()=>{let r=false;return(async()=>{let[F,W]=await Promise.all([Ce.getItem(ot.dial.isOpen()),Ce.getItem(ot.settings.modalOpen())]);r||(F==="true"&&g(true),W==="true"&&(g(true),y(true)),S.current=true)})(),()=>{r=true}},[]),de(()=>{S.current&&Ce.setItem(ot.dial.isOpen(),C?"true":"false")},[C]),de(()=>{S.current&&Ce.setItem(ot.settings.modalOpen(),k?"true":"false")},[k]);let I=Fe(r=>{if(pr(r.id),r.launchMode==="toggle-only"){r.onPress?.();return}if(r.component){let F=typeof r.icon=="function"?r.icon(20):r.icon;T.open({id:r.id,title:r.name||tt(r.id),component:r.component,props:r.props,modal:r.modal,launchMode:r.launchMode||"self-modal",singleton:r.singleton??true,icon:F,color:r.color||Kt(r.id)})}else r.onPress?.()},[T]),R=Be(()=>wt(M,"dial").map(r=>{let F=r.color||Kt(r.id),W;return typeof r.icon=="string"?W=r.icon:typeof r.icon=="function"?W=r.icon(32):W=null,{id:r.id,name:r.name||tt(r.id),icon:W,unavailable:!r.component&&!r.onPress,color:F,onPress:()=>{I(r),g(false)}}}),[M,I]),oe=Be(()=>{if(!C)return R;let r=new Map(R.map(F=>[F.id,F]));return ur(R.map(F=>F.id)).map(F=>r.get(F)).filter(F=>!!F)},[C,R]),Z=Be(()=>wt(M,"row").filter(r=>P.floatingTools[r.id]===true&&(r.component||r.onPress)),[M,P.floatingTools]),G=Be(()=>M.map(r=>({id:r.id,name:r.name||tt(r.id),description:r.description||Si(r.id),slot:r.slot,icon:r.icon,color:r.color})),[M]),[le,K]=vt(false),ne=T.openApps.some(r=>!r.minimized);de(()=>{if(p)return;let r=false,F=setTimeout(async()=>{let W=await Ce.getItem(xn);!r&&!W&&K(true)},1e3);return()=>{r=true,clearTimeout(F)}},[p]);let J=Fe(()=>{K(false),Ce.setItem(xn,"true")},[]),Se=Fe(()=>{J(),g(true)},[J]),me=Fe(()=>{g(false),y(false)},[]),ve=Fe(()=>{y(r=>!r)},[]),L=Fe(()=>y(false),[]),Re=!!(o?.length&&a),fe=P.floatingTools.environment!==false,re=le&&!C&&!ne;de(()=>{if(!re)return;let r=W=>{(!(W.target instanceof Element)||!W.target.closest("[data-buoy-root]"))&&J()},F=W=>{W.key==="Escape"&&J()};return document.addEventListener("pointerdown",r,true),document.addEventListener("keydown",F),()=>{document.removeEventListener("pointerdown",r,true),document.removeEventListener("keydown",F)}},[re,J]);let we=T.openApps.some(r=>r.minimized&&r.launchMode!=="toggle-only"),ae=V(yl,{modules:i,apps:n,requiredEnvVars:u,externalSync:l,headless:m,sentryGetClient:d});return m?ae:wn("div",{"data-buoy-root":"",style:{display:"contents"},children:[ae,re&&V("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),wn(Vt,{enablePositionPersistence:!re,pushToSide:C||ne,suspendPointerEvents:C,centerOnboarding:re,minimizedStack:we?V(Ps,{}):void 0,hasMinimizedStack:we,children:[e&&fe&&!Re&&V(vi,{environment:e}),Re&&fe&&V(wi,{currentEnvironment:e??"local",availableEnvironments:o,onSelect:a}),t?V(_t,{userRole:t,onPress:Se}):V("button",{"aria-label":"Open dev tools",onClick:Se,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:V(xl,{})}),Z.map(r=>V("button",{"aria-label":r.name||tt(r.id),title:r.description,onClick:()=>I(r),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof r.icon=="function"?r.icon(16):r.icon},r.id))]}),re&&V(ro,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:J}),C&&V(po,{icons:oe,onClose:me,centerLabel:"BUOY",onCenterPress:ve,settingsOpen:k,hintsDisabled:p}),V(Bo,{visible:k,onClose:L,availableTools:G,onSettingsChange:r=>{}}),V(qo,{}),V(mi,{})]})}function Il(e){let{access:t,isPro:o,licenseKey:a}=fi();de(()=>{gi.configure(e.licenseKey)},[e.licenseKey]);let n=e.licenseKey===void 0||e.licenseKey.trim().toUpperCase()===(a??""),i=typeof et<"u"?et:process.env.NODE_ENV!=="production",l=n&&t.status==="admitted";return de(()=>{!i&&o&&l&&ui()},[i,o,l]),!i&&!o?null:l?V(Cl,{...e}):e.headless?null:V(hi,{})}import{useSettings as zl,useFloatingTools as kl,getToolLabel as Ml,getToolDescription as Rl,getToolColor as Al,settingsColors as Ol,settingsStyles as El,dialColors as Dl,dialStyles as Bl}from"@buoy-gg/floating-tools-react/web";export{oa as Activity,di as AlertCircle,aa as AlertTriangle,_o as AppHostProvider,qo as AppOverlay,La as Badge,In as BarChart3,An as BaseEventStore,kn as Bookmark,ra as Bug,qa as Button,ti as Card,la as Check,da as CheckCircle,ca as CheckSquare,pa as ChevronDown,ga as ChevronLeft,ha as ChevronRight,ba as ChevronUp,va as Clock,Rn as Cloud,ii as CollapsibleSection,wa as Copy,Ja as CopyButton,Mn as DataViewer,Cn as Database,mn as DevToolsVisibilityProvider,po as DialMenu,Ka as DiffViewer,Ii as Divider,On as Download,Dn as Edit3,ci as EmptyState,zn as EventStepperFooter,xa as Eye,Ca as EyeOff,Ta as FileJson,Ia as FileText,za as Filter,ka as FlaskConical,Il as FloatingDevTools,Vt as FloatingTools,Fn as GitBranch,Ma as Globe,Ln as HardDrive,Ra as Hash,Wn as HelpCircle,Hn as Home,Kn as Image,Aa as Info,Ha as InfoRow,ea as JsModal,Ea as Key,Ba as Layers,Vn as Link,Pa as Lock,qn as Maximize2,Jn as Minus,Yn as Palette,$a as Pause,Zn as Pin,ja as Play,Na as Plus,Ua as Power,Ya as PowerToggle,_a as RefreshCw,En as RelativeTime,ta as Route,Za as Row,Ga as Search,Tn as SearchBar,ni as SectionHeader,na as Server,Xa as Settings,Bo as SettingsModal,Qa as Shield,ia as Smartphone,sa as Square,Wa as StatusDot,si as TabSelector,ua as Timer,ei as Trash2,ma as Unlock,fa as Upload,oi as User,_t as UserStatus,ya as Users,ai as Wifi,ri as X,Sa as XCircle,li as Zap,Sn as appSyncAdapter,Ci as autoDiscoverWebPresets,Ut as autoDiscoverWithCustom,pi as clearReleaseOptIn,Qn as copyToClipboard,cn as createWebTool,gn as createWebTools,xi as defaultToolPresets,Gn as devToolsStorageKeys,Dl as dialColors,Bl as dialStyles,Bn as formatBytes,Pn as formatDuration,$n as formatNumber,Ti as getEnabledTools,Al as getToolColor,Rl as getToolDescription,Ml as getToolLabel,wt as getToolsBySlot,Da as methodColor,_n as persistentStorage,Nn as safeStringify,Ol as settingsColors,El as settingsStyles,Oa as statusColor,Va as toolTheme,jn as truncateMiddle,Fa as typeColor,ht as useAppHost,Pt as useDevToolsVisibility,kl as useFloatingTools,Un as usePersistedState,Xn as useSafeAreaInsets,zl as useSettings,fs as useToolHeader,No as useToolHost};
10
+ `,document.head.appendChild(e),co=true}var Ct=Le.accent;function uo({title:e,message:t,onDismiss:o,showArrow:a=true}){let[n,i]=io(false),[l,u]=io(false);sr(()=>{ur();let p=requestAnimationFrame(()=>i(true));return()=>cancelAnimationFrame(p)},[]);let d={fontFamily:so,textTransform:"uppercase"};return Pe("div",{style:{position:"fixed",left:"50%",bottom:dr(),transform:`translateX(-50%) scale(${n?1:.8})`,opacity:n?1:0,transition:"transform 300ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 300ms ease",zIndex:10002,pointerEvents:"auto"},children:lo("div",{style:{position:"relative",animation:n?"buoyOnboardPulse 3s ease-in-out infinite":"none"},children:[Pe("div",{style:{position:"absolute",inset:-4,borderRadius:18,backgroundColor:"#FFFFFF",opacity:.06}}),lo("div",{style:{position:"relative",maxWidth:280,backgroundColor:Le.dialBackground,borderRadius:16,border:`1px solid ${Le.dialBorder}`,padding:20,boxShadow:`0 0 20px ${ro(Le.dialShadow,.6)}`,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[Pe("span",{style:{...d,fontSize:16,fontWeight:900,letterSpacing:1,color:Ct,textAlign:"center"},children:e}),Pe("span",{style:{fontFamily:so,fontSize:13,lineHeight:"20px",color:Le.centerText,textAlign:"center"},children:t}),Pe("button",{onClick:o,onMouseDown:()=>u(true),onMouseUp:()=>u(false),onMouseLeave:()=>u(false),style:{...d,marginTop:8,borderRadius:8,border:"none",backgroundColor:Ct,padding:"10px 24px",fontSize:14,fontWeight:900,letterSpacing:1.5,color:"#000000",cursor:"pointer",opacity:l?.7:1,transform:l?"scale(0.96)":"scale(1)",transition:"transform 100ms ease, opacity 100ms ease"},children:"Got it!"})]}),a&&Pe("div",{style:{position:"absolute",left:"50%",bottom:lr,marginLeft:-12,width:0,height:0,borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:`${cr}px solid ${Ct}`,filter:`drop-shadow(0 0 10px ${ro(Le.dialShadow,.5)})`,animation:n?"buoyOnboardArrowBounce 1.6s ease-in-out infinite":"none"}})]})})}import{Fragment as pr,jsx as B,jsxs as ge}from"react/jsx-runtime";var mr={x:.5,y:.5},po="@react_buoy_settings_tooltip_shown",mo=false;function gr(){if(mo||typeof document>"u")return;let e=document.createElement("style");e.textContent=Hi(),document.head.appendChild(e),mo=true}var $e=e=>1-Math.pow(1-e,3),Tt=e=>e*e*e;function fr({icon:e,index:t,totalIcons:o,position:a,progress:n,onPress:i}){let[l,u]=Q(false),[d,p]=Q(false),m=!e.icon&&e.id.startsWith("empty-"),x=!m&&e.unavailable===true,g=!m&&!x,{icons:R}=Yt,v=$i(t,o),I=0;n<=v[1]?I=0:n<=v[2]?I=(n-v[1])/(v[2]-v[1]):I=1,I=Math.max(0,Math.min(1,I));let T=ji,k=R.pressIn.scale,z=I*(d?k:l?1.1:1),O=0;I<=0?O=0:I<=.3?O=I:O=.3+(I-.3)*(.7/.7);let b=a.x*I,M=a.y*I;return B("button",{role:"menuitem","aria-label":m?"Empty slot":e.name,"aria-disabled":!g,tabIndex:g?0:-1,onClick:g?i:void 0,onMouseEnter:()=>g&&u(true),onMouseLeave:()=>{u(false),p(false)},onMouseDown:()=>g&&p(true),onMouseUp:()=>p(false),style:{position:"absolute",left:"50%",top:"50%",width:T,height:T,marginLeft:-T/2,marginTop:-T/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:g?"pointer":"default",transform:`translate(${b}px, ${M}px) scale(${z})`,opacity:O,transition:l||d?"transform 100ms ease":"none",background:"none",border:"none",padding:0},children:m?B("div",{style:{width:S.emptySlot.dotSize,height:S.emptySlot.dotSize,borderRadius:S.emptySlot.dotSize/2,backgroundColor:F.emptyDotBackground,border:`${S.emptySlot.borderWidth}px solid ${F.emptyDotBorder}`}}):ge(pr,{children:[B("div",{style:{position:"absolute",width:`${S.icon.gradientBgSizePercent}%`,height:`${S.icon.gradientBgSizePercent}%`,borderRadius:S.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:S.icon.gradientBgOpacity}}),B("div",{style:{position:"absolute",width:`${S.icon.innerGlowSizePercent}%`,height:`${S.icon.innerGlowSizePercent}%`,borderRadius:S.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:S.icon.innerGlowOpacity}}),B("div",{style:{marginBottom:S.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:l?"brightness(1.2)":"none"},children:e.icon}),B("span",{style:{fontSize:e.name.length>8?Math.max(S.icon.label.fontSize*.7,S.icon.label.fontSize*8/e.name.length):S.icon.label.fontSize,fontWeight:S.icon.label.fontWeight,fontFamily:S.icon.label.fontFamily,color:F.iconLabel,letterSpacing:S.icon.label.letterSpacing,marginTop:S.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:e.name}),x&&B("span",{style:{fontSize:S.icon.label.fontSize-1,fontWeight:S.icon.label.fontWeight,fontFamily:S.icon.label.fontFamily,letterSpacing:S.icon.label.letterSpacing,color:Ni.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})}function go({side:e,color:t}){return B("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(e==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]]).map(([o,a,n,i],l)=>B("line",{x1:o,y1:a,x2:n,y2:i,stroke:t,strokeWidth:2},l))})}function fo({side:e,disabled:t,onClick:o}){let[a,n]=Q(false),i=t?F.emptyDotBorder:F.accent;return ge("button",{type:"button","aria-label":`${e==="prev"?"Previous":"Next"} dial page`,disabled:t,onClick:o,onMouseDown:()=>!t&&n(true),onMouseUp:()=>n(false),onMouseLeave:()=>n(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${F.dialBorder}`,backgroundColor:F.dialBackground,color:t?F.iconLabelMuted:F.centerText,fontSize:12,fontWeight:900,fontFamily:eo,letterSpacing:1.5,textTransform:"uppercase",cursor:t?"default":"pointer",opacity:t?.4:1,boxShadow:t?"none":`0 0 8px ${Qt(F.dialShadow,.4)}`,transform:a?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[e==="prev"&&B(go,{side:"prev",color:i}),e==="prev"?"PREV":"NEXT",e==="next"&&B(go,{side:"next",color:i})]})}function ho({icons:e,onClose:t,centerLabel:o="MENU",onCenterPress:a,settingsOpen:n=false,hintsDisabled:i=false}){let{id:l}=Ui(),[u,d]=Q(0),[p,m]=Q(0),[x,g]=Q(0),[R,v]=Q(0),[I,T]=Q(0),[k,z]=Q(1),[O,b]=Q(false),[M,$]=Q(false),[C,A]=Q(false),ee=it(null),Z=it(null),G=it(null),le=it(false),{entrance:K,exit:ne,interaction:J}=Yt,Se=Wi(),[me,ve]=Q(()=>({width:window.innerWidth,height:window.innerHeight}));Te(()=>{let D=()=>ve({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]);let j=at(()=>Fi({screenWidth:me.width,maxCircleSize:Math.max(120,Math.min(320,me.height-96))}),[me]),Re=at(()=>Pi(),[]),fe=at(()=>Li(We,j.iconRadius),[j.iconRadius]),[se,we]=Q(0),ae=Math.max(1,Math.ceil(e.length/We)),r=Math.min(se,ae-1),L=at(()=>{let D=r*We,w=[...e.slice(D,D+We)];for(;w.length<We;)w.push({id:`empty-${w.length}`,name:"",icon:null,onPress:()=>{}});return w},[e,r]);Te(()=>{gr()},[]),Te(()=>{let D=K.backdrop.duration,w=K.dial.rotation.duration,X=K.centerButton.delay,V=K.icons.delay,q=K.icons.duration,_=performance.now(),te=ce=>{let s=ce-_;d(Math.min(1,s/D));let f=Math.min(1,s/400),E=$e(f)*1.1;f>.7&&(E-=(f-.7)*.33),f>=1&&(E=1),m(Math.max(0,Math.min(1.05,E)));let Y=Math.min(1,s/w);if(g($e(Y)*360),s>=X){let ye=Math.min(1,(s-X)/300),Ee=$e(ye)*1.15;ye>.6&&(Ee-=(ye-.6)*.375),ye>=1&&(Ee=1),v(Math.max(0,Math.min(1.05,Ee)))}if(s>=V){let ye=Math.min(1,(s-V)/q);T($e(ye))}let he=V+q;s<he?G.current=requestAnimationFrame(te):(d(1),m(1),g(360),v(1),T(1),A(true))};return G.current=requestAnimationFrame(te),()=>{G.current&&cancelAnimationFrame(G.current)}},[]);let W=rt(()=>{if(le.current)return;le.current=true,$(true),G.current&&cancelAnimationFrame(G.current);let D=performance.now(),w=ne.icons.duration,X=ne.centerButton.duration,V=ne.dialScale.duration,q=Math.max(X,V),_=ne.backdrop.duration,te=ce=>{let s=ce-D;if(s<w){let Y=Tt(s/w);T(1-Y),G.current=requestAnimationFrame(te);return}let f=w;if(s<f+q){T(0);let Y=Math.min(1,(s-f)/X),he=Math.min(1,(s-f)/V);v(1-Tt(Y)),m(1-Tt(he)),G.current=requestAnimationFrame(te);return}let E=f+q;if(s<E+_){m(0),v(0);let Y=(s-E)/_;d(1-Y),G.current=requestAnimationFrame(te);return}d(0),t()};G.current=requestAnimationFrame(te)},[ne,t]);Te(()=>{let D=document.activeElement,w=ee.current;return()=>{D?.isConnected&&(document.activeElement===document.body||w?.contains(document.activeElement))&&D.focus()}},[]),Te(()=>{if(n)return;Z.current?.focus();let D=w=>{let X=ee.current;if(X){if(w.key==="Escape")w.preventDefault(),W();else if(w.key==="Tab"){let V=Array.from(X.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(te=>te.getClientRects().length>0),q=V[0],_=V[V.length-1];(!X.contains(document.activeElement)||(w.shiftKey?document.activeElement===q:document.activeElement===_))&&(w.preventDefault(),(w.shiftKey?_:q)?.focus())}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(w.key)){let V=Array.from(X.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),q=V.indexOf(document.activeElement);if(q<0||!V.length)return;w.preventDefault();let _=w.key==="Home"?0:w.key==="End"?V.length-1:(q+(w.key==="ArrowRight"||w.key==="ArrowDown"?1:-1)+V.length)%V.length;V[_].focus()}}};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[W,n]);let[He,Xe]=Q(false);Te(()=>{if(i)return;let D=false,w=setTimeout(async()=>{let X=await Zt.getItem(po);!D&&!X&&Xe(true)},1200);return()=>{D=true,clearTimeout(w)}},[i]);let Ae=rt(()=>{Xe(false),Zt.setItem(po,"true")},[]);Te(()=>{n&&He&&Ae()},[n,He,Ae]);let Ye=rt(D=>{if(D.id.startsWith("empty-")||le.current)return;let[w,X]=J.iconSelect.pulse,V=performance.now(),q=150,_=te=>{let ce=te-V;if(ce<q){let s=$e(ce/q);z(1-(1-w.scale)*s),requestAnimationFrame(_)}else if(ce<q*2){let s=$e((ce-q)/q);z(w.scale+(X.scale-w.scale)*s),requestAnimationFrame(_)}else z(1)};requestAnimationFrame(_),setTimeout(()=>{D.onPress(),W()},J.iconSelect.actionDelay)},[J.iconSelect,W]),Qe=rt(D=>{if(le.current)return;let w=Math.max(0,Math.min(D,ae-1));w!==r&&we(w)},[ae,r]),De=j.buttonSize*S.centerButton.containerRatio,Ze=j.buttonSize*S.centerButton.borderRatio,St=j.buttonSize*S.centerButton.containerRatio/2+6,vt=C&&!M;return ge("div",{ref:ee,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[B("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:W,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:F.dialBackdrop,opacity:u}}),ge("div",{style:{position:"absolute",left:"50%",marginLeft:-j.circleSize/2,bottom:80,width:j.circleSize,height:j.circleSize,borderRadius:"50%",backgroundColor:F.dialBackground,border:`${S.circle.borderWidth}px solid ${F.dialBorder}`,boxShadow:`0 0 ${S.circle.shadowRadius}px ${Qt(F.dialShadow,S.circle.shadowOpacity)}`,transform:`scale(${p}) rotate(${x}deg)`,opacity:p>.01?1:0,overflow:"hidden"},children:[B("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:F.dialGradient1,opacity:S.gradientLayers[0].opacity}}),B("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:F.dialGradient2,opacity:S.gradientLayers[1].opacity}}),B("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:F.dialGradient3,opacity:S.gradientLayers[2].opacity}}),Re.map(D=>B("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:S.grid.lineHeight,transform:`rotate(${D}deg)`,transformOrigin:"center"},children:["left","right"].map(w=>B("div",{style:{position:"absolute",top:0,[w]:0,width:`calc(50% - ${St}px)`,height:S.grid.lineHeight,backgroundColor:F.dialGridLine}},w))},D)),B("div",{"data-testid":"dial-background","data-background":l,style:{position:"absolute",inset:0,pointerEvents:"none"},children:l==="hyperspace"?B(rr,{size:j.circleSize}):B(Vi,{focus:mr})}),L.map((D,w)=>B(fr,{icon:D,index:w,totalIcons:L.length,position:fe[w],progress:I,onPress:()=>Ye(D)},w)),ge("div",{style:{position:"absolute",left:"50%",top:"50%",width:De,height:De,marginLeft:-De/2,marginTop:-De/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:F.hubHalo,borderRadius:j.buttonSize,overflow:"hidden",transform:`scale(${R*k})`,opacity:R>.01?1:0},children:[B("div",{style:{position:"absolute",inset:0,backgroundColor:F.dialGradient1,opacity:.5,borderRadius:j.buttonSize}}),B("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:F.dialGradient2,opacity:.3,borderRadius:j.buttonSize}}),B("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:F.dialGradient3,opacity:.2,borderRadius:j.buttonSize}}),B("div",{style:{width:Ze,height:Ze,borderRadius:j.buttonSize*S.centerButton.borderRadiusRatio,backgroundColor:F.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:B("button",{ref:Z,type:"button","aria-label":n?"Close settings":"Open settings",disabled:!a,onClick:a,onMouseEnter:()=>b(true),onMouseLeave:()=>b(false),style:{border:0,padding:0,background:"transparent",width:j.buttonSize,height:j.buttonSize,borderRadius:j.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:a?"pointer":"default",transform:O?`scale(${J.centerHover.scale})`:"scale(1)",transition:`transform ${J.centerHover.duration}ms ease`,animation:vt&&!O?Se.pulse:"none"},children:n?ge("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:S.centerButton.text.fontSize-2,fontWeight:S.centerButton.text.fontWeight,fontFamily:S.centerButton.text.fontFamily,color:F.centerText,letterSpacing:S.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${F.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[B("span",{style:{marginBottom:-2},children:"CLOSE"}),B("span",{style:{marginTop:-2},children:"SETTINGS"})]}):B("span",{style:{fontSize:S.centerButton.text.fontSize,fontWeight:S.centerButton.text.fontWeight,fontFamily:S.centerButton.text.fontFamily,color:F.centerText,letterSpacing:S.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${F.centerTextGlow}`,textTransform:"uppercase"},children:o})})})]})]}),ae>1&&ge("div",{style:{position:"absolute",left:"50%",marginLeft:-j.circleSize/2,top:"calc(100% - 64px)",width:j.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,p),transform:`scale(${Math.min(1,p)})`},children:[B(fo,{side:"prev",disabled:r<=0,onClick:()=>Qe(r-1)}),ge("span",{style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:eo,letterSpacing:2,color:F.centerText,textShadow:`0 0 6px ${F.centerTextGlow}`},children:[String(r+1).padStart(2,"0"),ge("span",{style:{color:F.iconLabelMuted,textShadow:"none"},children:[" / ",String(ae).padStart(2,"0")]})]}),B(fo,{side:"next",disabled:r>=ae-1,onClick:()=>Qe(r+1)})]}),He&&!n&&B(uo,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:Ae,showArrow:false})]})}import{persistentStorage as yo,devToolsStorageKeys as hr}from"@buoy-gg/shared-ui/web";import{recordUsage as yr,pruneUsage as br}from"@buoy-gg/floating-tools-core/web";var bo=hr.dial.usage(),je={},So=false,zt=null;function vo(){return zt||(zt=(async()=>{try{let e=await yo.getItem(bo);if(e){let t=JSON.parse(e);t&&typeof t=="object"&&(je=t)}}catch{}finally{So=true}})(),zt)}vo();function Sr(e){return e.map((t,o)=>({id:t,index:o,lastUsed:je[t]?.lastUsed??0})).sort((t,o)=>o.lastUsed-t.lastUsed||t.index-o.index).map(({id:t})=>t)}async function vr(e){if(!e)return;So||await vo();let t=Math.max(Date.now(),...Object.values(je).map(o=>o.lastUsed+1));je=br(yr(je,e,t),t);try{await yo.setItem(bo,JSON.stringify(je))}catch{}}import{useCallback as wr,useMemo as wo}from"react";import{persistentStorage as xr}from"@buoy-gg/shared-ui/web";import{useState as oe,useEffect as ze,useCallback as lt,useMemo as ct}from"react";import{settingsEventBus as dt}from"@buoy-gg/floating-tools-core/web";import{useSyncExternalStore as Cr}from"react";import{getRegisteredToolModule as Tr}from"@buoy-gg/shared-ui/web";var zr=()=>()=>{},kr=()=>null;function Ir(){let e=Tr("@buoy-gg/external-sync");return Cr(e?.subscribeSyncStatus??zr,()=>e?.getSyncStatus?.()??null,kr)}import{SentryIcon as Mr,WifiCircuitIcon as Rr,ImageOverlayIcon as Ar,RenderCountIcon as Dr,Info as kt,Layers as Er,ChevronRightIcon as xo,ChevronDown as Co,getStorageBackendType as Br,getUseLicense as Or,signOutOfBuoy as Fr,persistentStorage as ke,Trash2 as Lr,CheckCircle2 as To,LicenseEntryModal as Pr,BackgroundSwitcher as $r,night as h,NightCard as Ie,NightRows as It,NightSectionLabel as jr,NightFootnote as zo,NightSwitch as ko,NightButton as Mt,NightSegmented as Hr,NightBadge as ue,NightSeparator as Wr,monoFont as Io}from"@buoy-gg/shared-ui/web";import{EnvIcon as Mo,StorageIcon as Nr,RoutesIcon as Vr,NetworkIcon as Ur,QueryIcon as Kr,HighlighterIcon as _r,ReduxIcon as qr,EventsIcon as Gr}from"@buoy-gg/floating-tools-core/web";import Jr,{createContext as Xr,useContext as Yr}from"react";import{jsx as Qr}from"react/jsx-runtime";var Ro=Xr({});function Zr({children:e,defaultFloatingTools:t,defaultDialTools:o}){let a=Jr.useMemo(()=>({defaultFloatingTools:t,defaultDialTools:o}),[t,o]);return Qr(Ro.Provider,{value:a,children:e})}function Ao(){return Yr(Ro)}import es from"react";import{toolTheme as ts}from"@buoy-gg/shared-ui/web";import{jsx as Do}from"react/jsx-runtime";function os({label:e,size:t,color:o=ts.colors.text}){let a=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1),n=a<=2?t:t*1.6,i=Math.max(7,Math.min(t*(a===1?.7:.62),n/(.62*a)));return Do("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:i,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}function Eo(e,t){return e==null?e:typeof e=="function"?es.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions}):typeof e=="string"||typeof e=="number"?Do(os,{label:String(e),size:t.size,color:t.color}):e}import{JsModal as ns,devToolsStorageKeys as Rt}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as as}from"@buoy-gg/shared-ui/web";import{Fragment as Ve,jsx as c,jsxs as P}from"react/jsx-runtime";var ut="@react_buoy_dev_tools_settings",is=6,pt=e=>{let t=is,o={};for(let[a,n]of Object.entries(e))n&&t>0?(o[a]=true,t-=1):o[a]=false;return o},rs=(e,t)=>{let{userStatus:o,environment:a,...n}=e,i=t?Object.entries(n).filter(([l])=>t.includes(l)):Object.entries(n);return{...Object.fromEntries(i),environment:a??false}},Bo=(e,t,o)=>{if(!t)return e;let a={...e.dialTools,...t.dialTools??{}},n=o?.allowedDialKeys?Object.entries(a).filter(([i])=>o.allowedDialKeys?.includes(i)):Object.entries(a);return{dialTools:pt(Object.fromEntries(n)),floatingTools:rs({...e.floatingTools,...t.floatingTools??{}},o?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...t.globalSettings??{}}}},ss=(e=[],t,o)=>{let a={},n={},i=new Set(t??[]),l=new Set(o??[]),u=!o||o.length===0;for(let d of e){let{id:p,slot:m="both"}=d;(m==="dial"||m==="both")&&(a[p]=u?true:l.has(p)),(m==="row"||m==="both")&&(n[p]=i.has(p))}return{dialTools:pt(a),floatingTools:{...n,environment:i.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}},ls=({visible:e,onClose:t,onSettingsChange:o,initialSettings:a,availableApps:n=[],storage:i=ke,zIndex:l})=>{let{defaultFloatingTools:u,defaultDialTools:d}=Ao(),p=ct(()=>ss(n,u,d),[n,u,d]),m=ct(()=>Object.keys(p.dialTools),[p]),x=ct(()=>Object.keys(p.floatingTools).filter(s=>s!=="environment"),[p]),[g,R]=oe(a||Ue||p),[v,I]=oe(At??"floating"),[T,k]=oe(At!==null),[z,O]=oe(new Set),[b,M]=oe(false),[$,C]=oe(false);ze(()=>{let s=requestAnimationFrame(()=>C(true));return()=>cancelAnimationFrame(s)},[]);let A=Ir();ze(()=>{(async()=>{try{let s=await ke.getItem(Rt.settings.activeTab());if(s&&["floating","settings","pro"].includes(s)){let f=s;At=f,I(E=>E===f?E:f)}}catch{}finally{k(true)}})()},[]),ze(()=>{T&&ke.setItem(Rt.settings.activeTab(),v).catch(s=>{console.warn("Failed to save settings active tab:",s)})},[v,T]);let ee=Or()?.(),Z=ee?.isPro??false,G=!Z&&ee?.licenseKey?ee.error:null,le=ee?.errorKind==="transport",[K,ne]=oe(Oo),[J,Se]=oe(false),[me,ve]=oe(false),[j,Re]=oe(false),[fe,se]=oe([]),[we,ae]=oe(false),r=as(),L=Vt.get("window").height,W=Vt.get("window").width,He=Math.floor(L*.33),Xe=Math.min(W-32,400),Ae=lt(async()=>{try{let s=await i.getItem(ut);if(s){let f=JSON.parse(s),E=Bo(p,f,{allowedDialKeys:m,allowedFloatingKeys:x});Ue=E,R(Y=>Fo(Y,E)?Y:E);return}Ue=p,R(f=>Fo(f,p)?f:p)}catch(s){console.error("Failed to load dev tools settings:",s),R(p)}},[p,m,x,i]);ze(()=>{Ae()},[Ae]),ze(()=>{Br().then(s=>{Oo=s,ne(f=>f===s?f:s)})},[]),ze(()=>{j&&(ae(true),ke.getAllKeys().then(s=>{se(s.sort())}).catch(()=>{se([])}).finally(()=>{ae(false)}))},[j]);let Ye=async s=>{try{let f={...s,dialTools:pt(s.dialTools)};await i.setItem(ut,JSON.stringify(f)),Ue=f,R(f),o?.(f),dt.emit(f)}catch(f){console.error("Failed to save dev tools settings:",f)}},Qe=s=>{let f={...g,floatingTools:{...g.floatingTools,[s]:!g.floatingTools[s]}};Ye(f)},De=s=>{let f={...g,globalSettings:{...g.globalSettings,[s]:!g.globalSettings?.[s]}};Ye(f)},Ze=async()=>{Se(true),ve(false);try{await ke.clear(),ve(true),R(p),i!==ke&&await i.setItem(ut,JSON.stringify(p)),o?.(p),dt.emit(p),setTimeout(()=>ve(false),2e3)}catch(s){console.error("Failed to clear storage:",s)}finally{Se(false)}},St=lt(s=>{},[]),vt=s=>{let f=n.find(E=>E.id===s);return f?.description?f.description:s==="environment"?"Environment badge.":""},D=s=>s==="environment"?"Env Badge":n.find(f=>f.id===s)?.name??s.toUpperCase().replace(/_/g," "),w=s=>{if(!$)return null;switch(s){case"query":return c(Kr,{size:18});case"env":return c(Mo,{size:18});case"sentry":return c(Mr,{size:18,color:"#9945FF"});case"storage":return c(Nr,{size:18,bgColor:h.color.surface});case"wifi":case"query-wifi-toggle":return c(Rr,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return c(Vr,{size:18,bgColor:h.color.surface});case"network":return c(Ur,{size:18});case"environment":return c(Mo,{size:18});case"debug-borders":return c(Er,{size:18,color:h.color.accent});case"highlight-updates":return c(Dr,{size:18,color:h.color.accent});case"highlight-updates-modal":return c(_r,{size:18});case"redux":return c(qr,{size:18});case"image-overlay":return c(Ar,{size:18});case"events":return c(Gr,{size:18});case"zustand":try{let{ZustandIcon:f}=_t("@buoy-gg/zustand/web");return c(f,{size:18})}catch{return c(kt,{size:18,color:h.color.textSecondary})}case"jotai":try{let{JotaiIcon:f}=_t("@buoy-gg/jotai/web");return c(f,{size:18})}catch{return c(kt,{size:18,color:h.color.textSecondary})}default:{let f=n.find(E=>E.id===s);return f?.icon!=null?Eo(f.icon,{slot:"row",size:18,color:f.color}):c(kt,{size:18,color:h.color.textSecondary})}}},X=(s,f,E,Y)=>{let he=vt(s);return P(et,{activeOpacity:E?1:.7,onPress:()=>!E&&Y(),accessibilityLabel:D(s),accessibilityRole:"button",style:[y.toolRow,E&&y.rowDisabled],children:[c(H,{style:y.toolIconSlot,children:w(s)}),P(H,{style:y.rowInfo,children:[P(N,{style:y.rowLabel,children:[D(s),E?" \xB7 max 6":""]}),he?c(N,{style:y.rowCaption,numberOfLines:1,children:he}):null]}),c(ko,{value:f,disabled:E,onValueChange:()=>Y()})]},s)},V=s=>{O(f=>{let E=new Set(f);return E.has(s)?E.delete(s):E.add(s),E})},q=(s,f,E,Y,he)=>{let ye=g.globalSettings?.[s]??false,Ee=z.has(s);return P(H,{children:[P(et,{activeOpacity:.7,onPress:()=>V(s),accessibilityLabel:f,style:y.settingRow,children:[P(H,{style:y.rowInfo,children:[c(N,{style:y.rowLabel,children:f}),c(N,{style:y.rowCaption,numberOfLines:Ee?0:1,children:E})]}),c(ko,{value:ye,onValueChange:()=>De(s)})]}),Ee&&P(H,{style:y.settingRowBody,children:[c(N,{style:y.settingRowBodyText,children:Y}),c(N,{style:y.settingRowBodyHint,children:he})]})]},s)},_=(s,f,E)=>P(H,{children:[c(jr,{children:s}),f,E]}),te=K==="filesystem"?c(ue,{label:"File System",tone:"accent"}):K==="asyncstorage"?c(ue,{label:"Async Storage",tone:"warning"}):K==="localstorage"?c(ue,{label:"Local Storage",tone:"accent"}):K==="memory"?c(ue,{label:"Memory",tone:"danger"}):c(ue,{label:"Loading\u2026",tone:"neutral"}),ce=()=>P(H,{style:y.container,children:[P(Nt,{style:y.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:y.scrollContainer,children:[v==="floating"&&c(Ve,{children:_("Floating Tools",c(Ie,{glass:true,children:c(It,{children:Object.entries(g.floatingTools).map(([s,f])=>X(s,f,false,()=>Qe(s)))})}),c(zo,{children:"Tools switched on here appear in the floating bubble row."}))}),v==="settings"&&P(Ve,{children:[_("Background",c(Ie,{glass:true,padded:true,children:c($r,{embedded:true})})),_("Storage",P(Ie,{glass:true,children:[P(et,{activeOpacity:.7,onPress:()=>Re(!j),accessibilityLabel:"Storage Type",style:y.settingRow,children:[c(H,{style:y.rowInfo,children:c(N,{style:y.rowLabel,children:"Storage Type"})}),te,j?c(Co,{size:16,color:h.color.textTertiary}):c(xo,{size:16,color:h.color.textTertiary})]}),j&&P(Ve,{children:[P(H,{style:y.settingRowBody,children:[c(N,{style:y.settingRowBodyText,children:K==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":K==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":K==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":K==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),K==="asyncstorage"&&c(N,{style:[y.settingRowBodyText,y.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),K==="memory"&&c(N,{style:[y.settingRowBodyText,y.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),c(Wr,{}),P(H,{style:y.storageExpanded,children:[P(H,{style:y.storageExpandedHeader,children:[c(N,{style:y.storageExpandedTitle,children:"SAVED SETTINGS"}),c(N,{style:y.storageExpandedCount,children:we?"\u2026":`${fe.length} keys`})]}),we?c(N,{style:y.storageKeyEmpty,children:"Loading\u2026"}):fe.length===0?c(N,{style:y.storageKeyEmpty,children:"No settings saved yet"}):c(Nt,{style:y.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:fe.map(s=>c(H,{style:y.storageKeyItem,children:c(N,{style:y.storageKeyText,numberOfLines:1,children:s.replace("@react_buoy_","")})},s))})]}),c(H,{style:y.cardButtonWrap,children:c(Mt,{label:me?"Cleared":J?"Clearing\u2026":"Clear All Settings",variant:me?"secondary":"destructive",size:"md",disabled:J,onPress:Ze,icon:me?c(To,{size:15,color:h.color.accent}):c(Lr,{size:15,color:J?h.color.textTertiary:h.color.danger})})})]})]})),A&&A.state!=="idle"&&_("Desktop Sync",P(Ie,{glass:true,children:[P(et,{activeOpacity:.7,onPress:()=>V("desktopSync"),accessibilityLabel:"Buoy Desktop",style:y.settingRow,children:[c(H,{style:y.rowInfo,children:c(N,{style:y.rowLabel,children:"Buoy Desktop"})}),A.state==="connected"?c(ue,{label:"Connected",tone:"accent"}):A.state==="connecting"?c(ue,{label:"Connecting\u2026",tone:"neutral"}):c(ue,{label:"Retrying",tone:"warning"}),z.has("desktopSync")?c(Co,{size:16,color:h.color.textTertiary}):c(xo,{size:16,color:h.color.textTertiary})]}),z.has("desktopSync")&&P(H,{style:y.settingRowBody,children:[P(N,{style:y.settingRowBodyText,children:[A.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",c(N,{style:y.footnoteMono,children:A.targetURL??"(unknown URL)"}),A.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),A.state==="retrying"&&A.lastError&&P(N,{style:[y.settingRowBodyText,y.bodyWarning],children:["Last error: ",A.lastError]})]})]})),_("Modal Behavior",c(Ie,{glass:true,children:P(It,{children:[q("enableSharedModalDimensions","Shared Modal Size","Sync dimensions across all tools","When enabled, all tool modals will share the same size and position. Resizing one modal will affect all others. When disabled, each tool remembers its own size and position independently.","Keep OFF for the best experience. This allows you to customize each tool's modal size separately."),Be.OS!=="web"?q("expandableWindowControls","Expand Controls","iPad-style expandable window buttons","When enabled, the window control buttons (minimize, toggle mode, close) start as small dots and expand into larger, easy-to-tap buttons when pressed. When disabled, buttons are directly tappable at their small size.","Keep ON for touch devices where the small buttons are hard to press. Turn OFF if you prefer direct single-tap access."):null]})}))]}),v==="pro"&&P(Ve,{children:[_("License",P(Ie,{glass:true,children:[P(H,{style:y.settingRow,children:[c(H,{style:y.rowInfo,children:c(N,{style:y.rowLabel,children:"License Status"})}),c(H,{testID:"buoy-settings-license-status",accessibilityLabel:Z?"License: Active":"License: Free",children:Z?c(ue,{label:"Active",tone:"accent"}):c(ue,{label:"Free",tone:"neutral"})})]}),ee?.tierSource==="session"?P(H,{style:y.settingRow,children:[c(H,{style:y.rowInfo,children:c(N,{style:y.rowLabel,children:"Signed in with Buoy"})}),c(Mt,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void Fr(),testID:"buoy-settings-signout"})]}):null]}),c(zo,{children:Z?"You have full access to all Buoy DevTools features.":G?le?`Couldn't reach the license server (${G}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${G}.`:"Upgrade to Pro to unlock all features and support development."})),!Z&&P(Ve,{children:[_("Pro Features",c(Ie,{glass:true,children:c(It,{children:["Advanced Settings","Priority Support"].map(s=>P(H,{style:y.featureRow,children:[c(To,{size:16,color:h.color.accent}),c(N,{style:y.rowLabel,children:s})]},s))})})),c(Mt,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>M(true)})]})]})]}),c(Pr,{visible:b,onClose:()=>M(false),onSuccess:()=>M(false)})]});return c(ns,{visible:e,onClose:t,zIndex:l,variant:"night",header:{showToggleButton:false,customContent:c(H,{style:y.headerRow,children:c(Hr,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:v,onChange:s=>I(s)})})},initialMode:"bottomSheet",onModeChange:St,persistenceKey:Rt.settings.root(),enablePersistence:true,maxHeight:L-r.top,initialHeight:He,initialFloatingPosition:{x:(W-Xe)/2,y:r.top+20},enableGlitchEffects:true,children:ce()})},cs={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}},ds=(e,t)=>{let o=new Set(e??[]),a=new Set(t??[]),n={};for(let l of a)n[l]=true;let i={environment:o.has("environment")};for(let l of o)l!=="environment"&&(i[l]=true);return{dialTools:pt(n),floatingTools:i,globalSettings:{enableSharedModalDimensions:false}}},Ue=null,At=null,Oo=null,Fo=(e,t)=>JSON.stringify(e)===JSON.stringify(t);dt.addListener(e=>{e&&(Ue=e)});var us=()=>{let{defaultFloatingTools:e,defaultDialTools:t}=Ao(),o=ct(()=>!e&&!t?cs:ds(e,t),[e,t]),[a,n]=oe(o),i=lt(async()=>{try{let u=await ke.getItem(ut);if(u){let d=JSON.parse(u),p=Bo(o,d);n(p);return}n(o)}catch(u){console.error("Failed to load dev tools settings:",u),n(o)}},[o]);ze(()=>{i();let u=dt.addListener(d=>{try{d&&n(d)}catch{}});return()=>{u()}},[i]);let l=lt(()=>{i()},[i]);return{settings:a,refreshSettings:l}},y=Ut.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:h.gutter,paddingRight:h.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:h.gutter,paddingTop:8,paddingBottom:24,gap:h.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:h.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:h.rowPadH,paddingVertical:h.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:h.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:h.color.text,fontSize:h.font.row,fontWeight:"500"},rowCaption:{color:h.color.textTertiary,fontSize:h.font.label},settingRowBody:{paddingHorizontal:h.rowPadH,paddingBottom:h.rowPadV,gap:6},settingRowBodyText:{color:h.color.textSecondary,fontSize:h.font.caption,lineHeight:h.font.caption*1.45},settingRowBodyHint:{color:h.color.textTertiary,fontSize:h.font.caption,lineHeight:h.font.caption*1.45},bodyWarning:{color:h.color.warning},bodyDanger:{color:h.color.danger},cardButtonWrap:{paddingHorizontal:h.cardPad,paddingTop:10,paddingBottom:h.cardPad},storageExpanded:{paddingHorizontal:h.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:h.color.textSecondary,fontSize:h.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:h.color.textTertiary,fontSize:h.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:h.color.glassElevated,borderRadius:h.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:h.color.textSecondary,fontSize:h.font.micro,fontFamily:Io},storageKeyEmpty:{color:h.color.textTertiary,fontSize:h.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Io,fontSize:h.font.label,color:h.color.textSecondary}});import{jsx as Lo}from"react/jsx-runtime";var ps=[];function Po({visible:e,onClose:t,availableTools:o=ps,defaultFloatingTools:a,defaultDialTools:n,storage:i=xr,onSettingsChange:l}){let u=wo(()=>({getItem:async m=>i.getItem(m),setItem:async(m,x)=>i.setItem(m,x)}),[i]),d=wo(()=>o.map(m=>({...m,name:m.name??m.id,icon:typeof m.icon=="function"?x=>m.icon(x.size):m.icon})),[o]),p=wr(m=>{l?.(m)},[l]);return Lo(Zr,{defaultFloatingTools:a,defaultDialTools:n,children:Lo(ls,{visible:e,onClose:t,zIndex:11e3,availableApps:d,storage:u,onSettingsChange:p})})}import{persistentStorage as $o}from"@buoy-gg/shared-ui/web";import{createContext as ms,useCallback as be,useContext as gs,useEffect as Dt,useMemo as fs,useRef as Ke,useState as jo}from"react";var hs=(e,t,o)=>{if(t.singleton){let n=e.find(i=>i.id===t.id);if(n){let i=n.minimized??false;return{instanceId:n.instanceId,wasMinimized:i,apps:[...e.filter(l=>l.instanceId!==n.instanceId),{...n,minimized:false}]}}}let a=o();return{instanceId:a,wasMinimized:false,apps:[...e,{...t,instanceId:a}]}};import{createContext as ys,useCallback as Ho,useContext as bs,useEffect as mt,useMemo as Ss,useRef as Wo,useState as gt}from"react";import{JsModal as vs,ModalHeader as _e,HeaderSearchButton as ws,TickProvider as xs,ToolScreenHeaderContext as Cs,devToolsStorageKeys as No,buoyColors as Vo,gameUIColors as Et}from"@buoy-gg/shared-ui/web";import{jsx as ie,jsxs as ft}from"react/jsx-runtime";var qe=()=>{},Ts={search:"",isSearchActive:false,clearSearch:qe,close:qe,minimize:qe,showToast:qe,setHeaderOverride:qe},Uo=ys(null);function Ko(){return bs(Uo)??Ts}function zs(e,t){let{setHeaderOverride:o}=Ko();mt(()=>(o(e),()=>o(null)),t)}var _o=2200,ks={success:Et.success,error:Et.error,info:Et.info};function Is({message:e,type:t,nonce:o}){let a=Wo(new xe.Value(0)).current;mt(()=>{a.setValue(0),xe.sequence([xe.timing(a,{toValue:1,duration:150,useNativeDriver:true}),xe.delay(_o-450),xe.timing(a,{toValue:0,duration:300,useNativeDriver:true})]).start()},[o,a]);let n=ks[t];return ft(xe.View,{pointerEvents:"none",style:[ht.toast,{opacity:a,borderColor:n+"60"}],children:[ie(H,{style:[ht.toastDot,{backgroundColor:n}]}),ie(N,{style:ht.toastText,numberOfLines:2,children:e})]})}function Ms({app:e,config:t,visible:o,zIndex:a,onClose:n,onMinimize:i,initialModalState:l,enableSharedModalDimensions:u,bodyProps:d}){let p=e.component,[m,x]=gt(false),[g,R]=gt(""),[v,I]=gt(null),[T,k]=gt(null),z=Wo(null),O=Ho(()=>{x(false),R("")},[]),b=Ho((K,ne="info")=>{z.current&&clearTimeout(z.current),k(J=>({message:K,type:ne,nonce:(J?.nonce??0)+1})),z.current=setTimeout(()=>k(null),_o)},[]);mt(()=>()=>{z.current&&clearTimeout(z.current)},[]);let M=Ss(()=>({search:m?g:"",isSearchActive:m,clearSearch:O,close:n,minimize:()=>i(),showToast:b,setHeaderOverride:I,instanceId:e.instanceId}),[g,m,O,n,i,b,e.instanceId]),$=v?.title??t.title??e.title??e.id,C=v?.subtitle??t.subtitle,A=v?.onBack,ee=v?.actions??t.headerActions,Z=v?.searchable??t.searchable;mt(()=>{!Z&&m&&O()},[Z,m,O]);let G=u?No.modal.root():No.custom(e.id).modal(),le=ft(_e,{children:[A&&!m&&ie(_e.Navigation,{onBack:A}),m?ie(_e.Search,{value:g,onChangeText:R,onCancel:O,placeholder:t.searchPlaceholder,testID:`tool-search-field-${e.id}`}):ie(_e.Content,{title:$,subtitle:C}),ft(_e.Actions,{children:[!m&&ee,Z&&!m&&ie(ws,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>x(true)})]})]});return ie(Uo.Provider,{value:M,children:ie(vs,{visible:o,onClose:n,onBack:A,onMinimize:i,initialModalState:l,zIndex:a,persistenceKey:G,enablePersistence:true,initialMode:t.initialMode??"bottomSheet",header:{customContent:le,showToggleButton:true},disableScrollWrapper:true,styles:{},children:ft(H,{style:ht.bodyRoot,children:[ie(xs,{children:ie(Cs.Provider,{value:I,children:ie(p,{...d})})}),T&&ie(Is,{message:T.message,type:T.type,nonce:T.nonce})]})})})}var ht=Ut.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:Vo.card,borderWidth:1,borderRadius:8,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOpacity:.4,shadowRadius:8,shadowOffset:{width:0,height:2},elevation:6},toastDot:{width:6,height:6,borderRadius:3},toastText:{flex:1,fontSize:12,color:Vo.text}});import{Fragment as Rs,jsx as pe}from"react/jsx-runtime";var qo=ms(null),Go="@react_buoy_open_apps",Bt=44,As=12,Ds=100,Es=16,Bs=e=>({x:window.innerWidth-Bt-Es,y:window.innerHeight-Ds-Bt-e*(Bt+As)}),Jo=({children:e})=>{let[t,o]=jo([]),[a,n]=jo(false),i=Ke([]),l=Ke(null),u=Ke(false),d=Ke(false),p=Ke(false),m=be(b=>{let M="";return o($=>{let{apps:C,instanceId:A}=hs($,b,()=>`${b.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);return M=A,C}),M},[]),x=be(()=>{if(u.current||!d.current||!p.current)return;u.current=true;let b=l.current;if(!b||b.length===0){n(true);return}l.current=null,b.forEach(({id:M,minimized:$})=>{let C=i.current.find(A=>A.id===M);if(C&&C.component){let A=Eo(C.icon,{slot:"dial",size:20,color:C.color});m({id:C.id,title:C.name,component:C.component,props:C.props,modal:C.modal,launchMode:C.launchMode||"self-modal",singleton:C.singleton??true,icon:A,color:C.color,minimized:$})}}),n(true)},[m]);Dt(()=>{let b=false;return(async()=>{try{let M=await $o.getItem(Go);if(b)return;if(M){let $=JSON.parse(M),C;Array.isArray($)&&$.length>0&&(typeof $[0]=="string"?C=$.map(A=>({id:A,minimized:false})):C=$.filter(A=>typeof A=="object"&&A!==null&&typeof A.id=="string"),C.length&&(l.current=C))}}catch{}b||(d.current=true,x())})(),()=>{b=true}},[x]),Dt(()=>{if(!a)return;let b=t.map(M=>({id:M.id,minimized:M.minimized??false}));$o.setItem(Go,JSON.stringify(b))},[t,a]);let g=be(b=>{i.current=b,p.current=true,x()},[x]),R=be(b=>{o(M=>M.length?b?M.filter($=>$.instanceId!==b):M.slice(0,-1):M)},[]),v=be(()=>o([]),[]),I=be((b,M)=>{o($=>$.map(C=>C.instanceId===b?{...C,minimized:true,restoreState:M}:C))},[]),T=be((b,M)=>{o($=>$.map(C=>C.instanceId===b?{...C,minimized:false,restoreState:M??C.restoreState}:C))},[]),k=be(b=>t.find(M=>M.instanceId===b)?.minimized??false,[t]),z=t.some(b=>b.launchMode!=="toggle-only"&&!b.minimized);Dt(()=>{if(!z)return;let b=M=>{if(M.key!=="Escape"||M.defaultPrevented)return;let $=[...t].reverse().find(C=>C.launchMode!=="toggle-only"&&!C.minimized);$&&R($.instanceId)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[z,R,t]);let O=fs(()=>({openApps:t,isAnyOpen:z,open:m,close:R,closeAll:v,registerApps:g,minimize:I,restore:T,isMinimized:k}),[t,z,m,R,v,g,I,T,k]);return pe(qo.Provider,{value:O,children:e})},yt=()=>{let e=gs(qo);return e||{openApps:[],isAnyOpen:false,open:()=>"",close:()=>{},closeAll:()=>{},registerApps:()=>{},minimize:()=>{},restore:()=>{},isMinimized:()=>false}},Os=9e3,Fs={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"},Ls={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"},Ps=({app:e,zIndex:t,onClose:o,onMinimize:a,minimizeTargetPosition:n,enableSharedModalDimensions:i})=>{let l=e.component,u=!e.minimized,d={...e.props??{},...i?{enableSharedModalDimensions:true}:{}};return e.modal&&(!e.launchMode||e.launchMode==="self-modal")?pe(Ms,{app:e,config:e.modal,visible:u,zIndex:t,onClose:o,onMinimize:a,initialModalState:e.restoreState,enableSharedModalDimensions:i,bodyProps:d}):e.launchMode==="self-modal"?pe(l,{...d,visible:u,onClose:o,onRequestClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId,zIndex:t,initialModalState:e.restoreState}):e.launchMode==="inline"?u?pe("div",{style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:pe(l,{...d,onClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId})}):null:pe("div",{style:{...Fs,zIndex:t,display:u?"flex":"none"},children:pe("div",{style:Ls,children:pe(l,{...d,onClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId})})})},Xo=()=>{let{openApps:e,close:t,minimize:o}=yt(),{settings:a}=us(),n=e.filter(u=>u.launchMode!=="toggle-only");if(n.length===0)return null;let i=n.filter(u=>u.minimized).length,l=Oi()??Bs(i);return pe(Rs,{children:n.map((u,d)=>pe(Ps,{app:u,zIndex:Os+d,onClose:()=>t(u.instanceId),onMinimize:p=>o(u.instanceId,p),enableSharedModalDimensions:a.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:l},u.instanceId))})};import{useCallback as $s,useEffect as Ot,useRef as js,useState as Yo,useSyncExternalStore as Qo}from"react";import{persistentStorage as Zo,getToolAttention as Ft,subscribeToolAttention as en}from"@buoy-gg/shared-ui/web";import{jsx as re,jsxs as bt}from"react/jsx-runtime";function Hs(e){return Qo(en,()=>Ft(e),()=>Ft(e))}var tn={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"},on={needsInput:3,failed:2,done:1},nn=new Map;function an(e){let t=null;for(let a of e?e.split("|"):[]){let n=Ft(a);n&&(!t||on[n.kind]>on[t.kind])&&(t=n)}let o=nn.get(e);return o&&t&&o.kind===t.kind&&o.label===t.label?o:!o&&!t?null:(nn.set(e,t),t)}function Ws(e){let t=e.join("|");return Qo(en,()=>an(t),()=>an(t))}var rn=28,Lt=32,Pt=6,sn=8,ln=24,cn="@react_buoy_minimized_stack_expanded",Ns=80,dn=2e3,Vs=6e3,Us="#1A1A1A",Ge="#888888";function un({down:e=false}){return re("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:re("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:Ge,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ks({id:e,title:t,icon:o,index:a,onPress:n}){let i=Hs(e),l=js(null);return Ot(()=>{let u=true,d,p=()=>{l.current?.animate([{transform:"translateX(0) scale(1)",opacity:1,offset:0},{transform:"translateX(3px) scale(1.05)",opacity:.4,offset:.2},{transform:"translateX(-3px) scale(1.1)",opacity:1,offset:.4},{transform:"translateX(2px) scale(1.0)",opacity:.6,offset:.6},{transform:"translateX(-1px) scale(0.95)",opacity:1,offset:.8},{transform:"translateX(0) scale(1)",opacity:1,offset:1}],{duration:Ns,easing:"linear"})},m=x=>{let g=x?500+Math.random()*1500+a*200:dn+Math.random()*(Vs-dn)+a*300;d=setTimeout(()=>{u&&(p(),m(false))},g)};return m(true),()=>{u=false,clearTimeout(d)}},[a]),bt("button",{type:"button","aria-label":i?`${t} \u2014 ${i.label}. Restore`:`Restore ${t}`,onClick:n,style:{width:Lt,height:Lt,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[re("div",{ref:l,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:o}),i?re("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${i.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:tn[i.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:i.kind==="needsInput"?"!":""}):null]})}function _s({containerWidth:e=32}){let{openApps:t,restore:o}=yt(),a=t.filter(g=>g.minimized&&g.launchMode!=="toggle-only"),[n,i]=Yo(false),[l,u]=Yo(false),d=Ws(a.map(g=>g.id));Ot(()=>{let g=false;return(async()=>{let R=await Zo.getItem(cn);!g&&R==="true"&&i(true),g||u(true)})(),()=>{g=true}},[]),Ot(()=>{l&&Zo.setItem(cn,n?"true":"false")},[n,l]);let p=$s(g=>{o(g)},[o]);if(a.length===0)return null;let m=sn+a.length*Lt+(a.length-1)*Pt+Pt+ln+4,x={backgroundColor:Us,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${Ge}66`,borderLeft:`1px solid ${Ge}66`,borderRight:`1px solid ${Ge}66`,borderBottom:"none",boxSizing:"border-box"};return bt("div",{style:{height:rn,overflow:"visible",position:"relative"},children:[re("div",{style:{position:"absolute",bottom:"var(--buoy-stack-bottom, 0px)",top:"var(--buoy-stack-top, auto)",left:0,width:e,maxHeight:"var(--buoy-stack-space, calc(100vh - 48px))",visibility:n?"visible":"hidden",height:n?m:0,opacity:n?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:n?"auto":"none",...x},children:bt("div",{style:{height:m,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:sn,gap:Pt,boxSizing:"border-box"},children:[[...a].reverse().map((g,R)=>re(Ks,{id:g.id,title:g.title||g.id,icon:g.icon??re("span",{style:{color:"#fff",fontSize:13},children:(g.title||g.id).slice(0,1).toUpperCase()}),index:R,onPress:()=>p(g.instanceId)},g.instanceId)),re("button",{type:"button","aria-label":"Collapse",onClick:()=>i(false),style:{width:"100%",height:ln,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:re(un,{down:true})})]})}),bt("button",{type:"button","aria-label":`Show ${a.length} minimized tools`,tabIndex:n?-1:0,"aria-hidden":n,onClick:()=>i(true),style:{position:"absolute",bottom:0,left:0,width:e,height:rn,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",padding:0,opacity:n?0:1,transform:n?"scale(0.9)":"scale(1)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:n?"none":"auto",...x},children:[re(un,{}),d?re("span",{"aria-hidden":true,"data-testid":"buoy-dock-peek-attention",style:{position:"absolute",top:2,right:2,minWidth:11,height:11,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:tn[d.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:d.kind==="needsInput"?"!":""}):null,a.length>1&&re("span",{style:{fontSize:9,fontWeight:600,color:Ge,marginLeft:1},children:a.length})]})]})}import{registerToolModules as qs}from"@buoy-gg/shared-ui/web";import{createElement as Gs}from"react";function pn(e){let t=e.icon;return{...e,icon:typeof t=="function"?o=>Gs(t,{size:o,slot:e.slot??"both",color:e.color}):()=>t}}import{createContext as Js,useContext as Xs,useState as mn,useMemo as gn}from"react";import{jsx as Ys}from"react/jsx-runtime";var fn=Js(null);function hn({children:e}){let[t,o]=mn(false),[a,n]=mn(false),i=gn(()=>t||a,[t,a]),l=gn(()=>({isDialOpen:t,isToolOpen:a,isDevToolsActive:i,setDialOpen:o,setToolOpen:n}),[t,a,i]);return Ys(fn.Provider,{value:l,children:e})}function $t(){let e=Xs(fn);return e||{isDialOpen:false,isToolOpen:false,isDevToolsActive:false,setDialOpen:()=>{},setToolOpen:()=>{}}}import*as Qs from"@buoy-gg/license/web";import*as Zs from"@buoy-gg/shared-ui/web";import*as el from"@buoy-gg/shared-ui/web/dataViewer";function yn(e){qs({core:{useDevToolsVisibility:$t},license:Qs,"shared-ui":Zs,"shared-ui/dataViewer":el,...e});let t=new Set;return Object.values(e).flatMap(o=>Object.entries(o).flatMap(([a,n])=>!a.endsWith("Preset")||!n||typeof n.id!="string"||!n.component||t.has(n.id)?[]:(t.add(n.id),[pn(n)])))}import{useEffect as jt,useMemo as Ht,useRef as tl}from"react";import{LicenseManager as ol,useLicense as nl}from"@buoy-gg/license/web";import{registerToolAdapters as al}from"@buoy-gg/shared-ui/web";function bn(e){return typeof e=="object"&&e!==null?e:void 0}function il({isDevelopment:e,isLicensed:t,externalSync:o,isAvailable:a}){if(o===false||!a)return false;if(e)return true;let n=bn(o);return t&&n?.enableInRelease===true&&vn(n.socketURL,n)===null}var Sn="http://localhost:42831";function rl(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}function vn(e,t){let o=e??Sn;if(t?.allowInsecureNetwork===true)return null;let a;try{a=new URL(o)}catch{return`[Buoy] externalSync.socketURL "${o}" isn't a valid URL, so this release build won't connect to Buoy Desktop.`}return a.protocol==="https:"||a.protocol==="wss:"||rl(a.hostname)?null:`[Buoy] This release build won't connect to ${o}: release sync carries real user data, and plain http to another machine is readable by anyone on the same network. Use a simulator, an emulator or adb reverse (localhost), an https:// broker, or set externalSync.allowInsecureNetwork: true for a network you trust.`}var sl={impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};function ll(e,t,o){if(t)return e;let a=null;for(let[n,i]of Object.entries(sl)){if(o?.includes(n))continue;let l=e[n];if(!l?.actions)continue;let u={...l.actions};for(let d of i)d in u&&(u[d]=()=>{throw new Error(`${n}.${d} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)});a??(a={...e}),a[n]={...l,actions:u}}return a??e}import{useEffect as cl,useMemo as dl,useState as ul}from"react";import{devToolsStorageKeys as pl,persistentStorage as ml}from"@buoy-gg/shared-ui/web";var gl=8;function fl(){let e="";for(;e.length<gl;)e+=(Math.random()*16|0).toString(16);return e}function hl(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function yl({appName:e,hardwareName:t,platform:o,installId:a,deviceId:n}){let i=hl(e??"buoy")||"buoy",l=e??"Buoy Device",u=t?.trim()||o;return n?{deviceId:n,deviceName:`${l} (${u})`}:{deviceId:`${i}-${o}-${a}`,deviceName:`${l} (${u} \xB7 ${a.slice(-4)})`}}function bl(){let e=globalThis;try{return e.sessionStorage??null}catch{return null}}async function Sl({platform:e=Be.OS,store:t,mint:o=fl}={}){let a=pl.sync.deviceId(),n=t===void 0?e==="web"?bl():ml:t;if(!n)return o();try{let i=await n.getItem(a);if(i&&i.length>0)return i;let l=o();return await n.setItem(a,l),l}catch{return o()}}var Wt=null;function vl(){return Wt||(Wt=Sl()),Wt}function wl(e,t){let o=e?.deviceId,a=e?.deviceName,n=t.loadId??vl,i=t.platform??Be.OS,[l,u]=ul(null);return cl(()=>{if(o)return;let d=false;return n().then(p=>{d||u(p)}),()=>{d=true}},[o,n]),dl(()=>{if(!o&&!l)return null;let d=yl({appName:t.appName,hardwareName:t.hardwareName,platform:i,installId:l??"",deviceId:o});return a?{...d,deviceName:a}:d},[o,a,l,t.appName,t.hardwareName,i])}import{getDevServerOrigin as xl,resolveReloadStrategy as Cl,scheduleReloadApp as Tl}from"@buoy-gg/shared-ui/web";var wn=Date.now(),xn=xl(),zl={platform:Be.OS,isTV:Be.isTV===true,isTVOS:Be.isTVOS===true},Cn={version:3,getSnapshot:()=>{let e=Cl("auto");return{startedAt:wn,devServerOrigin:xn,device:zl,reload:{available:e!==null,strategy:e}}},subscribe:e=>()=>{},actions:{ping:()=>({ok:true,startedAt:wn,devServerOrigin:xn}),reloadApp:e=>{let t=e??{},{strategy:o,delayMs:a}=Tl({strategy:t.strategy,delayMs:t.delayMs});return{scheduled:true,strategy:o,delayMs:a}}}};import{Fragment as kl,jsx as Me,jsxs as Il}from"react/jsx-runtime";var Ml=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"],Rl=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];function Al(e){let t=Ht(()=>Object.fromEntries(Object.entries(e.modules).map(([a,n])=>[a.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),n])),[e.modules]),o=t["react-query"];return o?.useReactQuerySyncAdapter?Me(Dl,{...e,modules:t,query:o}):Me(Tn,{...e,modules:t})}function Dl(e){let t=e.query.useReactQuerySyncAdapter();return Me(Tn,{...e,queryAdapter:t})}function Tn({modules:e,apps:t,requiredEnvVars:o,externalSync:a,headless:n,sentryGetClient:i,queryAdapter:l}){let{isPro:u,tier:d}=nl(),p=Ht(()=>{let T={app:Cn};for(let[k,z]of Object.entries(e))for(let[O,b]of Object.entries(z))O.endsWith("SyncAdapter")&&b&&typeof b=="object"&&(T[k]=b);l&&(T.query=l),e.env?.createEnvSyncAdapter&&(T.env=e.env.createEnvSyncAdapter(o??[]));for(let k of t??[])k.sync&&(T[`custom:${k.id}`]=k.sync);return T},[e,t,o,l]),m=tl(p);m.current=p,jt(()=>al(()=>m.current),[]),jt(()=>{let T=[],k=z=>{let O=z?.();typeof O=="function"&&T.push(O)};return k(e.network?.startNetworkCapture),k(e.storage?.startBrowserStorageCapture),k(e.assets?.startBrowserAssetCapture),e.storage?.storageSyncAdapter?.subscribe&&k(()=>e.storage.storageSyncAdapter.subscribe(()=>{})),e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe&&k(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{})),()=>{for(let z of T.reverse())z()}},[e]);let x=e["external-sync"],g=typeof tt<"u"?tt:process.env.NODE_ENV!=="production",R=il({isDevelopment:g,isLicensed:u,externalSync:a,isAvailable:!!x}),v=bn(a);!g&&v?.enableInRelease&&El(vn(v.socketURL,v));let I=e.sentry?.SentryRoot;return Il(kl,{children:[Object.entries(e).flatMap(([T,k])=>Ml.map(z=>{let O=k[z];return O?Me(O,{},`${T}:${z}`):null})),I&&Me(I,{getClient:i}),Object.entries(e).flatMap(([T,k])=>Rl.map(z=>{let O=k[z];return O&&(!n||z==="ScenariosOverlay"||z==="ImpersonateOverlay")?Me(O,{},`${T}:${z}`):null})),R&&Me(Bl,{module:x,tools:p,options:v,isPro:u,tier:d,dev:g})]})}var zn=null;function El(e){!e||e===zn||(zn=e,console.warn(e))}function Bl({module:e,tools:t,options:o,isPro:a,tier:n,dev:i}){let l=wl(o,{appName:typeof document>"u"?null:document.title||location.hostname,hardwareName:"Browser",platform:"web"}),{socket:u}=e.useExternalSyncSocket({deviceName:l?.deviceName??"Buoy Browser",socketURL:o?.socketURL??(i?e.getDefaultSocketURL():Sn),persistentDeviceId:l?.deviceId??null,platform:"web",enableLogs:o?.enableLogs});jt(()=>{if(!u)return;let m=()=>{u.connected&&ol.hasAccountAccess()&&u.emit("device-license",{isPro:a?"1":"0",tier:n})};return m(),u.on("connect",m),()=>{u.off("connect",m)}},[u,a,n]);let d=o?.releaseActions?.join(",")??"",p=Ht(()=>ll(t,i,d?d.split(","):void 0),[t,i,d]);return e.useExternalSync({tools:p,socket:u,deviceId:l?.deviceId??null,enableLogs:o?.enableLogs}),null}import{useState as kn}from"react";import{createPortal as Ol}from"react-dom";import{useBuoySession as Fl}from"@buoy-gg/license/web";import{Fragment as In,jsx as Je,jsxs as Mn}from"react/jsx-runtime";var Rn="#20C997";function Ll(){let{status:e,signIn:t,signOut:o}=Fl(),[a,n]=kn(false),[i,l]=kn(null);if(typeof document>"u")return null;let u=()=>{l(null),n(true),t().catch(p=>l(p instanceof Error?p.message:"Sign-in did not work. Try again.")).finally(()=>n(false))},d=e.state==="active";return Ol(Je("div",{"data-buoy-signin":"",style:{position:"fixed",right:"max(16px, env(safe-area-inset-right))",bottom:"max(20px, env(safe-area-inset-bottom))",zIndex:99999,maxWidth:"min(320px, calc(100vw - 32px))",padding:d||i?"12px 14px":0,borderRadius:16,background:d||i?"#0f1419":"transparent",color:"#e6edf3",boxShadow:d||i?"0 10px 30px rgba(0,0,0,.35)":"none",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",fontSize:14,lineHeight:1.45},children:d?Mn(In,{children:[Je("div",{"data-testid":"buoy-signin-needs-plan",children:"Buoy on a live site needs a Pro or Business plan."}),Je("button",{type:"button",onClick:()=>void o(),style:Pl,"data-testid":"buoy-signout",children:"Sign out"})]}):Mn(In,{children:[i?Je("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:i}):null,Je("button",{type:"button",onClick:u,disabled:a,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:Rn,color:"#04130d",fontWeight:600,fontSize:14,cursor:a?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:a?"Signing in\u2026":"Sign in to Buoy"})]})}),document.body)}var Pl={marginTop:8,padding:0,border:"none",background:"none",color:Rn,fontSize:14,cursor:"pointer",textDecoration:"underline"};import{jsx as U,jsxs as An}from"react/jsx-runtime";var $l={},Dn="@react_buoy_floating_menu_tooltip_shown",jl=Ce;function Hl({size:e=14,color:t="#20C997"}){let o=Math.max(2,e/4),a=Math.max(1,e/16);return U("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:a,width:e,height:e,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((n,i)=>U("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:t}},i))})}function Wl(e){return U(hn,{children:U(Jo,{children:U(Nl,{...e})})})}function Nl({environment:e,userRole:t,availableEnvironments:o,onEnvironmentSwitch:a,apps:n,modules:i=$l,externalSync:l,requiredEnvVars:u,sentryGetClient:d,disableHints:p=false,headless:m=false}){let[x,g]=wt(false),[R,v]=wt(false),I=zi(false),T=yt(),k=Oe(()=>Gt([...yn(i),...n??[]]),[n,i]),z=$t(),O=T.openApps.some(r=>!r.minimized);de(()=>{z.setDialOpen(x)},[x,z.setDialOpen]),de(()=>{z.setToolOpen(O||R)},[O,R,z.setToolOpen]);let{registerApps:b}=T;de(()=>{b(k.map(r=>{let L=r.icon;return{...r,icon:typeof L=="function"?({size:W})=>L(W):L}}))},[b,k]);let M=Oe(()=>k.map(r=>({id:r.id,name:r.name,description:r.description,slot:r.slot})),[k]),{settings:$}=ki({availableTools:M,storage:jl});de(()=>{let r=false;return(async()=>{let[L,W]=await Promise.all([Ce.getItem(nt.dial.isOpen()),Ce.getItem(nt.settings.modalOpen())]);r||(L==="true"&&g(true),W==="true"&&(g(true),v(true)),I.current=true)})(),()=>{r=true}},[]),de(()=>{I.current&&Ce.setItem(nt.dial.isOpen(),x?"true":"false")},[x]),de(()=>{I.current&&Ce.setItem(nt.settings.modalOpen(),R?"true":"false")},[R]);let C=Fe(r=>{if(vr(r.id),r.launchMode==="toggle-only"){r.onPress?.();return}if(r.component){let L=typeof r.icon=="function"?r.icon(20):r.icon;T.open({id:r.id,title:r.name||ot(r.id),component:r.component,props:r.props,modal:r.modal,launchMode:r.launchMode||"self-modal",singleton:r.singleton??true,icon:L,color:r.color||qt(r.id)})}else r.onPress?.()},[T]),A=Oe(()=>xt(k,"dial").map(r=>{let L=r.color||qt(r.id),W;return typeof r.icon=="string"?W=r.icon:typeof r.icon=="function"?W=r.icon(32):W=null,{id:r.id,name:r.name||ot(r.id),icon:W,unavailable:!r.component&&!r.onPress,color:L,onPress:()=>{C(r),g(false)}}}),[k,C]),ee=Oe(()=>{if(!x)return A;let r=new Map(A.map(L=>[L.id,L]));return Sr(A.map(L=>L.id)).map(L=>r.get(L)).filter(L=>!!L)},[x,A]),Z=Oe(()=>xt(k,"row").filter(r=>$.floatingTools[r.id]===true&&(r.component||r.onPress)),[k,$.floatingTools]),G=Oe(()=>k.map(r=>({id:r.id,name:r.name||ot(r.id),description:r.description||Ii(r.id),slot:r.slot,icon:r.icon,color:r.color})),[k]),[le,K]=wt(false),ne=T.openApps.some(r=>!r.minimized);de(()=>{if(p)return;let r=false,L=setTimeout(async()=>{let W=await Ce.getItem(Dn);!r&&!W&&K(true)},1e3);return()=>{r=true,clearTimeout(L)}},[p]);let J=Fe(()=>{K(false),Ce.setItem(Dn,"true")},[]),Se=Fe(()=>{J(),g(true)},[J]),me=Fe(()=>{g(false),v(false)},[]),ve=Fe(()=>{v(r=>!r)},[]),j=Fe(()=>v(false),[]),Re=!!(o?.length&&a),fe=$.floatingTools.environment!==false,se=le&&!x&&!ne;de(()=>{if(!se)return;let r=W=>{(!(W.target instanceof Element)||!W.target.closest("[data-buoy-root]"))&&J()},L=W=>{W.key==="Escape"&&J()};return document.addEventListener("pointerdown",r,true),document.addEventListener("keydown",L),()=>{document.removeEventListener("pointerdown",r,true),document.removeEventListener("keydown",L)}},[se,J]);let we=T.openApps.some(r=>r.minimized&&r.launchMode!=="toggle-only"),ae=U(Al,{modules:i,apps:n,requiredEnvVars:u,externalSync:l,headless:m,sentryGetClient:d});return m?ae:An("div",{"data-buoy-root":"",style:{display:"contents"},children:[ae,se&&U("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),An(Jt,{enablePositionPersistence:!se,pushToSide:x||ne,suspendPointerEvents:x,centerOnboarding:se,minimizedStack:we?U(_s,{}):void 0,hasMinimizedStack:we,children:[e&&fe&&!Re&&U(Mi,{environment:e}),Re&&fe&&U(Ri,{currentEnvironment:e??"local",availableEnvironments:o,onSelect:a}),t?U(Xt,{userRole:t,onPress:Se}):U("button",{"aria-label":"Open dev tools",onClick:Se,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:U(Hl,{})}),Z.map(r=>U("button",{"aria-label":r.name||ot(r.id),title:r.description,onClick:()=>C(r),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof r.icon=="function"?r.icon(16):r.icon},r.id))]}),se&&U(uo,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:J}),x&&U(ho,{icons:ee,onClose:me,centerLabel:"BUOY",onCenterPress:ve,settingsOpen:R,hintsDisabled:p}),U(Po,{visible:R,onClose:j,availableTools:G,onSettingsChange:r=>{}}),U(Xo,{}),U(wi,{})]})}function Vl(e){let{access:t,isPro:o,licenseKey:a}=Ci();de(()=>{xi.configure(e.licenseKey)},[e.licenseKey]);let n=e.licenseKey===void 0||e.licenseKey.trim().toUpperCase()===(a??""),i=typeof tt<"u"?tt:process.env.NODE_ENV!=="production",l=n&&t.status==="admitted";return de(()=>{i||t.status==="initializing"||(o&&l?vi():Kt())},[i,o,l,t.status]),!i&&!o?e.signIn&&!e.headless?U(Ll,{}):null:l?U(Wl,{...e}):e.headless?null:U(Ti,{})}import{useSettings as Ul,useFloatingTools as Kl,getToolLabel as _l,getToolDescription as ql,getToolColor as Gl,settingsColors as Jl,settingsStyles as Xl,dialColors as Yl,dialStyles as Ql}from"@buoy-gg/floating-tools-react/web";export{ua as Activity,Si as AlertCircle,ma as AlertTriangle,Jo as AppHostProvider,Xo as AppOverlay,_a as Badge,On as BarChart3,jn as BaseEventStore,Ln as Bookmark,fa as Bug,oi as Button,di as Card,ya as Check,Sa as CheckCircle,ba as CheckSquare,wa as ChevronDown,Ca as ChevronLeft,za as ChevronRight,Ia as ChevronUp,Ra as Clock,$n as Cloud,gi as CollapsibleSection,Aa as Copy,ai as CopyButton,Pn as DataViewer,En as Database,hn as DevToolsVisibilityProvider,ho as DialMenu,Qa as DiffViewer,Bi as Divider,Hn as Download,Nn as Edit3,bi as EmptyState,Fn as EventStepperFooter,Da as Eye,Ea as EyeOff,Ba as FileJson,Oa as FileText,Fa as Filter,La as FlaskConical,Vl as FloatingDevTools,Jt as FloatingTools,Un as GitBranch,Pa as Globe,_n as HardDrive,$a as Hash,Gn as HelpCircle,Xn as Home,Qn as Image,ja as Info,Xa as InfoRow,ca as JsModal,Wa as Key,Va as Layers,ea as Link,Ka as Lock,oa as Maximize2,aa as Minus,ra as Palette,qa as Pause,la as Pin,Ja as Play,Ya as Plus,Za as Power,ri as PowerToggle,ti as RefreshCw,Wn as RelativeTime,da as Route,li as Row,ni as Search,Bn as SearchBar,pi as SectionHeader,pa as Server,ii as Settings,Po as SettingsModal,si as Shield,ga as Smartphone,ha as Square,Ga as StatusDot,hi as TabSelector,va as Timer,ci as Trash2,xa as Unlock,Ta as Upload,ui as User,Xt as UserStatus,ka as Users,mi as Wifi,fi as X,Ma as XCircle,yi as Zap,Cn as appSyncAdapter,Di as autoDiscoverWebPresets,Gt as autoDiscoverWithCustom,Kt as clearReleaseOptIn,sa as copyToClipboard,pn as createWebTool,yn as createWebTools,Ai as defaultToolPresets,na as devToolsStorageKeys,Yl as dialColors,Ql as dialStyles,Vn as formatBytes,Kn as formatDuration,qn as formatNumber,Ei as getEnabledTools,Gl as getToolColor,ql as getToolDescription,_l as getToolLabel,xt as getToolsBySlot,Na as methodColor,ta as persistentStorage,Yn as safeStringify,Jl as settingsColors,Xl as settingsStyles,Ha as statusColor,ei as toolTheme,Jn as truncateMiddle,Ua as typeColor,yt as useAppHost,$t as useDevToolsVisibility,Kl as useFloatingTools,Zn as usePersistedState,ia as useSafeAreaInsets,Ul as useSettings,zs as useToolHeader,Ko as useToolHost};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/core",
3
- "version": "7.0.43",
3
+ "version": "7.0.45",
4
4
  "description": "Floating developer menu and account setup for React Native. Add tool packages and configure Desktop or MCP connections separately.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -61,10 +61,10 @@
61
61
  ],
62
62
  "dependencies": {
63
63
  "react-devtools-core": "6.1.5",
64
- "@buoy-gg/floating-tools-core": "^7.0.43",
65
- "@buoy-gg/shared-ui": "^7.0.43",
66
- "@buoy-gg/floating-tools-react": "^7.0.43",
67
- "@buoy-gg/license": "^7.0.43"
64
+ "@buoy-gg/floating-tools-core": "^7.0.45",
65
+ "@buoy-gg/floating-tools-react": "^7.0.45",
66
+ "@buoy-gg/license": "^7.0.45",
67
+ "@buoy-gg/shared-ui": "^7.0.45"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "*"