@buoy-gg/core 7.0.79 → 7.0.81

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 (43) hide show
  1. package/bundlers/vite.mjs +1 -1
  2. package/lib/commonjs/Buoy.js +1 -1
  3. package/lib/commonjs/auto.web.js +1 -1
  4. package/lib/commonjs/bundlerKey.js +1 -0
  5. package/lib/commonjs/floatingMenu/AppHost.js +1 -1
  6. package/lib/commonjs/floatingMenu/BrowserToolRuntime.js +1 -1
  7. package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -1
  8. package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +1 -1
  9. package/lib/commonjs/floatingMenu/ToolHost.js +1 -1
  10. package/lib/commonjs/floatingMenu/autoExternalSync.js +1 -1
  11. package/lib/commonjs/version.js +1 -1
  12. package/lib/module/Buoy.js +1 -1
  13. package/lib/module/auto.web.js +1 -1
  14. package/lib/module/bundlerKey.js +1 -0
  15. package/lib/module/floatingMenu/AppHost.js +1 -1
  16. package/lib/module/floatingMenu/BrowserToolRuntime.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/ToolHost.js +1 -1
  20. package/lib/module/floatingMenu/autoExternalSync.js +1 -1
  21. package/lib/module/version.js +1 -1
  22. package/lib/typescript/commonjs/Buoy.d.ts +1 -1
  23. package/lib/typescript/commonjs/auto.web.d.ts +1 -5
  24. package/lib/typescript/commonjs/bundlerKey.d.ts +6 -0
  25. package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.d.ts +2 -1
  26. package/lib/typescript/commonjs/version.d.ts +1 -1
  27. package/lib/typescript/module/Buoy.d.ts +1 -1
  28. package/lib/typescript/module/auto.web.d.ts +1 -5
  29. package/lib/typescript/module/bundlerKey.d.ts +6 -0
  30. package/lib/typescript/module/floatingMenu/FloatingDevTools.d.ts +2 -1
  31. package/lib/typescript/module/version.d.ts +1 -1
  32. package/lib/web/auto.mjs +1 -1
  33. package/lib/web/chunks/{FloatingDevTools.web-5EMC7ZIE.mjs → FloatingDevTools.web-ESKLKOSQ.mjs} +1 -1
  34. package/lib/web/chunks/FloatingDevTools.web-H4R5WRDU.mjs +1 -0
  35. package/lib/web/chunks/FloatingDevTools.web-OZM47G4Z.mjs +1 -0
  36. package/lib/web/chunks/chunk-5PL4HAS6.mjs +10 -0
  37. package/lib/web/chunks/chunk-74RBGVOS.mjs +1 -0
  38. package/lib/web/chunks/chunk-H4EIRXRJ.mjs +10 -0
  39. package/lib/web/chunks/chunk-JXTHZBMM.mjs +2 -2
  40. package/lib/web/chunks/chunk-YXDQX4XV.mjs +10 -0
  41. package/lib/web/index.mjs +1 -1
  42. package/package.json +5 -5
  43. package/lib/web/chunks/chunk-EFTCKGMC.mjs +0 -10
@@ -0,0 +1,10 @@
1
+ "use client";import{a as dt,b as H,c as K,d as Me,e as ut,f as hi,g as ko,h as yi,i as jl,j as zo,k as Ne}from"./chunk-C6HZO5XT.mjs";import{b as bi,c as vi}from"./chunk-D2FYORGY.mjs";import{a as Si}from"./chunk-74RBGVOS.mjs";import{a as i,b as Ao,e as He}from"./chunk-LOPXJLVB.mjs";import{BuoyPortal as wi,FloatingToolHost as xi}from"@buoy-gg/shared-ui/web/floating";import*as Ti from"@buoy-gg/license/web";import{LicenseManager as Ii,useLicense as Bo,sameLicenseKey as Ci,resolveDevBuild as ki,capacitorDebug as zi,isCapacitorNative as Ro,loadCapacitorAppHost as Do}from"@buoy-gg/license/web";import{AccountSetup as Ai,HintsProvider as Bi,normalizeEnvironment as Ri,registerToolOpener as Mo,setBuoyAppId as Lt,startSettingsSync as Di}from"@buoy-gg/shared-ui/web";import{useState as pt,useMemo as me,useCallback as We,useEffect as G,useRef as Oo}from"react";import{useSettings as Mi,getToolLabel as ft,getToolDescription as Oi,getToolColor as Po}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Oe,devToolsStorageKeys as gt,EnvironmentIndicator as Pi,EnvironmentSelectorInline as Ei}from"@buoy-gg/shared-ui/web";var Li=[];function Eo(){return[]}i(Eo,"autoDiscoverWebPresets");function Ft(e=[]){return[...new Map(e.map(t=>[t.id,t])).values()]}i(Ft,"autoDiscoverWithCustom");function mt(e,t){return e.filter(o=>{let r=o.slot||"both";return r==="both"||r===t})}i(mt,"getToolsBySlot");function Lo(e,t){let o=t instanceof Set?t:new Set(t);return e.filter(r=>o.has(r.id))}i(Lo,"getEnabledTools");import{filterTeamTools as Fi,isTeamToolAllowed as $i}from"@buoy-gg/floating-tools-core/web";var ji="No tools are on for your role. Ask your team admin.";import{FloatingTool as Fo,FloatingToolDivider as Ni,FloatingToolUserStatus as $o,getBubbleAnchorPosition as Hi}from"@buoy-gg/shared-ui/web/floating";import{useState as te,useEffect as Pe,useMemo as ht,useRef as yt,useCallback as bt}from"react";var jo={network:"Network",images:"Images","image-overlay":"Image Overlay",assets:"Assets",query:"React Query",storage:"Storage",env:"Env",console:"Console",events:"Events",redux:"Redux",zustand:"Zustand",jotai:"Jotai","route-events":"Routes","time-machine":"Time Machine",clock:"Clock",permissions:"Permissions","highlight-updates":"Highlight Updates","debug-borders":"Debug Borders","perf-monitor":"Bench HUD","js-top":"JS Top","js-top-modal":"JS Top",impersonate:"Impersonate","perf-monitor-modal":"Bench"};function No(e,t){return e&&jo[e]?jo[e]:t}i(No,"dialAccessibilityLabel");import{getDialLayout as Wi,getAllIconPositions as _i,getGridLineRotations as Ui,getIconStaggerInputRange as Ki,MAX_DIAL_SLOTS as Qe,DIAL_ICON_SIZE as Vi,dialAnimationConfig as Ho,getDialCSSKeyframesString as qi,getDialCSSAnimationStyles as Gi,dialColors as j,dialStyles as I,withAlpha as Wo,floatingToolsColors as Ji}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as _o,monoFont as $t,ToolBackground as Yi,useToolBackground as Xi}from"@buoy-gg/shared-ui/web";import{memo as Qi}from"react";import{RasterLayer as Zi,scatter as ea,useLoop as ta,withBgAlpha as oa}from"@buoy-gg/shared-ui/web";import{Fragment as na,jsx as Ze}from"react/jsx-runtime";var ra=.94,ia=6,aa=2400,vt=3,Uo=16,sa=Array.from({length:vt},(e,t)=>ea(22343^t*40503,Uo*4)),Ko=["#FFFFFF","#B3D9FF","#8CB3FF"],Vo=Math.PI/3,qo=14*Math.PI/180;function Go(e){let t=Math.min(5,Math.floor(e*6)),o=e*6-t;return t*Vo+qo/2+o*(Vo-qo)}i(Go,"spokeClearAngle");function Jo(e){return Math.min(ia,1/(1-e*ra))}i(Jo,"scaleAt");function Yo(e){let t=.15+.85*e*e;return e<.06?t*=e/.06:e>.94&&(t*=(1-e)/.06),Math.min(.7,t)}i(Yo,"opacityAt");function Xo(e){let t=e/vt,o=[],r=12;for(let u=0;u<=r;u++)o.push(u/r);let n=(1-t)%1;n>.001&&n<1-.001&&o.push(n-1e-4,n+1e-4),o.sort((u,d)=>u-d);let a=[],s=[],c=[];for(let u of o){let d=t===0&&u===1?1:(u+t)%1;a.push(u),s.push(Jo(d)),c.push(Yo(d))}return{input:a,scale:s,opacity:c}}i(Xo,"shellStops");var la=Array.from({length:vt},(e,t)=>Xo(t)),ca=Qi(i(function({size:e}){let t=ta(aa),o=e/2,r=[];for(let n=0;n<vt;n++){let a=sa[n],s=la[n],c=[];for(let u=0;u<Uo;u++){let d=Go(a[u*4]),g=(.15+.85*Math.sqrt(a[u*4+1]))*.5*o,x=Ko[Math.floor(a[u*4+3]*Ko.length)%3],h=o+Math.cos(d)*g,B=o+Math.sin(d)*g,k=.6,R=k*2.4;c.push(Ze(H,{style:{position:"absolute",left:h-R/2,top:B-R/2,width:R,height:R,borderRadius:R/2,backgroundColor:oa(x,.3)}},`${u}-h`),Ze(H,{style:{position:"absolute",left:h-k/2,top:B-k/2,width:k,height:k,borderRadius:k/2,backgroundColor:x}},u))}r.push(Ze(Me.View,{style:{position:"absolute",left:0,top:0,width:e,height:e,opacity:t.interpolate({inputRange:s.input,outputRange:s.opacity}),transform:[{scale:t.interpolate({inputRange:s.input,outputRange:s.scale})}]},pointerEvents:"none",children:Ze(Zi,{style:{width:e,height:e},raster:false,children:c})},n))}return Ze(na,{children:r})},"DialHyperspace"));import{useEffect as da,useState as Qo}from"react";import{dialColors as _e,withAlpha as Zo}from"@buoy-gg/floating-tools-react/web";import{ARROW_BOTTOM_OFFSET as ua,ARROW_HEIGHT as pa,SPACING_GAP as ac,getScreenCenterY as sc,calculateTooltipPosition as fa,calculateTargetPosition as lc}from"@buoy-gg/shared-ui/web/floating";import{monoFont as en}from"@buoy-gg/shared-ui/web";import{jsx as Ue,jsxs as tn}from"react/jsx-runtime";var on=false;function nn(){if(on||typeof document>"u")return;let e=document.createElement("style");e.textContent=`
2
+ @keyframes buoyOnboardPulse {
3
+ 0%, 100% { transform: scale(1); }
4
+ 50% { transform: scale(1.02); }
5
+ }
6
+ @keyframes buoyOnboardArrowBounce {
7
+ 0%, 100% { transform: translateY(0); }
8
+ 50% { transform: translateY(-8px); }
9
+ }
10
+ `,document.head.appendChild(e),on=true}i(nn,"injectOnboardingKeyframes");var jt=_e.accent;function Nt({title:e,message:t,onDismiss:o,showArrow:r=true}){let[n,a]=Qo(false),[s,c]=Qo(false);da(()=>{nn();let d=requestAnimationFrame(()=>a(true));return()=>cancelAnimationFrame(d)},[]);let u={fontFamily:en,textTransform:"uppercase"};return Ue("div",{style:{position:"fixed",left:"50%",bottom:fa(),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:tn("div",{style:{position:"relative",animation:n?"buoyOnboardPulse 3s ease-in-out infinite":"none"},children:[Ue("div",{style:{position:"absolute",inset:-4,borderRadius:18,backgroundColor:"#FFFFFF",opacity:.06}}),tn("div",{style:{position:"relative",maxWidth:280,backgroundColor:_e.dialBackground,borderRadius:16,border:`1px solid ${_e.dialBorder}`,padding:20,boxShadow:`0 0 20px ${Zo(_e.dialShadow,.6)}`,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[Ue("span",{style:{...u,fontSize:16,fontWeight:900,letterSpacing:1,color:jt,textAlign:"center"},children:e}),Ue("span",{style:{fontFamily:en,fontSize:13,lineHeight:"20px",color:_e.centerText,textAlign:"center"},children:t}),Ue("button",{onClick:o,onPointerDown:()=>c(true),onPointerUp:()=>c(false),onPointerLeave:()=>c(false),onPointerCancel:()=>c(false),style:{...u,marginTop:8,borderRadius:8,border:"none",backgroundColor:jt,padding:"10px 24px",fontSize:14,fontWeight:900,letterSpacing:1.5,color:"#000000",cursor:"pointer",opacity:s?.7:1,transform:s?"scale(0.96)":"scale(1)",transition:"transform 100ms ease, opacity 100ms ease"},children:"Got it!"})]}),r&&Ue("div",{style:{position:"absolute",left:"50%",bottom:ua,marginLeft:-12,width:0,height:0,borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:`${pa}px solid ${jt}`,filter:`drop-shadow(0 0 10px ${Zo(_e.dialShadow,.5)})`,animation:n?"buoyOnboardArrowBounce 1.6s ease-in-out infinite":"none"}})]})})}i(Nt,"OnboardingTooltip");import{useEffect as ga,useRef as ma}from"react";import{capacitorPlatform as ha,capacitorPlugin as ya}from"@buoy-gg/license/web";function rn(){return globalThis.__BUOY_HOLDS_BACK__===true}i(rn,"isBuoyHoldingBackButton");var ba=99.5,va=99.6,St=0;function an(){if(typeof document>"u")return false;let e=globalThis.Ionic;if(!e&&!document.querySelector("ion-app"))return false;try{return e?.config?.get?.("hardwareBackButton",true)!==false}catch{return true}}i(an,"ionicHandlesBack");function Ht(e,t,o=ba){let r=ma(t);r.current=t,ga(()=>{if(!e||ha()!=="android")return;let n=globalThis;St+=1,n.__BUOY_HOLDS_BACK__=true;let a=i(()=>{St=Math.max(0,St-1),n.__BUOY_HOLDS_BACK__=St>0},"release"),s;if(an()){let c=i(u=>{u.detail?.register?.(o,()=>{r.current()})},"listener");document.addEventListener("ionBackButton",c),s=i(()=>document.removeEventListener("ionBackButton",c),"cleanup")}else{let c=ya("App");if(!c?.addListener){a();return}let u=false,d=null;Promise.resolve(c.addListener("backButton",()=>r.current())).then(g=>{u?g.remove():d=g}).catch(()=>{}),s=i(()=>{u=true,d&&d.remove()},"cleanup")}return()=>{s(),a()}},[e,o])}i(Ht,"useCapacitorBackButton");import{Fragment as Sa,jsx as L,jsxs as we}from"react/jsx-runtime";var wa={x:.5,y:.5},sn="@react_buoy_settings_tooltip_shown",ln=false;function cn(){if(ln||typeof document>"u")return;let e=document.createElement("style");e.textContent=qi(),document.head.appendChild(e),ln=true}i(cn,"injectKeyframes");var Ke=i(e=>1-Math.pow(1-e,3),"easeOutCubic"),Wt=i(e=>e*e*e,"easeInCubic");function dn({icon:e,index:t,totalIcons:o,position:r,progress:n,onPress:a}){let[s,c]=te(false),[u,d]=te(false),g=!e.icon&&e.id.startsWith("empty-"),x=!g&&e.unavailable===true,h=!g&&!x,{icons:B}=Ho,k=Ki(t,o),R=0;n<=k[1]?R=0:n<=k[2]?R=(n-k[1])/(k[2]-k[1]):R=1,R=Math.max(0,Math.min(1,R));let F=Vi,M=B.pressIn.scale,P=R*(u?M:s?1.1:1),A=0;R<=0?A=0:R<=.3?A=R:A=.3+(R-.3)*(.7/.7);let V=r.x*(R-1),S=r.y*(R-1);return L("button",{role:"menuitem","aria-label":g?"Empty slot":No(e.id,e.name),"data-testid":e.id?`buoy-dial-${e.id}`:void 0,"aria-disabled":!h,tabIndex:h?0:-1,onClick:h?a:void 0,onPointerEnter:D=>h&&D.pointerType==="mouse"&&c(true),onPointerLeave:()=>{c(false),d(false)},onPointerDown:()=>h&&d(true),onPointerUp:()=>d(false),onPointerCancel:()=>d(false),style:{position:"absolute",left:`calc(50% + ${r.x}px)`,top:`calc(50% + ${r.y}px)`,width:F,height:F,marginLeft:-F/2,marginTop:-F/2,cursor:h?"pointer":"default",background:"none",border:"none",padding:0},children:L("span",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",transform:`translate(${V}px, ${S}px) scale(${P})`,opacity:A,transition:s||u?"transform 100ms ease":"none"},children:g?L("div",{style:{width:I.emptySlot.dotSize,height:I.emptySlot.dotSize,borderRadius:I.emptySlot.dotSize/2,backgroundColor:j.emptyDotBackground,border:`${I.emptySlot.borderWidth}px solid ${j.emptyDotBorder}`}}):we(Sa,{children:[L("div",{style:{position:"absolute",width:`${I.icon.gradientBgSizePercent}%`,height:`${I.icon.gradientBgSizePercent}%`,borderRadius:I.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:I.icon.gradientBgOpacity}}),L("div",{style:{position:"absolute",width:`${I.icon.innerGlowSizePercent}%`,height:`${I.icon.innerGlowSizePercent}%`,borderRadius:I.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:I.icon.innerGlowOpacity}}),L("div",{style:{marginBottom:I.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:s?"brightness(1.2)":"none"},children:e.icon}),L("span",{style:{fontSize:e.name.length>8?Math.max(I.icon.label.fontSize*.7,I.icon.label.fontSize*8/e.name.length):I.icon.label.fontSize,fontWeight:I.icon.label.fontWeight,fontFamily:I.icon.label.fontFamily,color:j.iconLabel,letterSpacing:I.icon.label.letterSpacing,marginTop:I.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:e.name}),x&&L("span",{style:{fontSize:I.icon.label.fontSize-1,fontWeight:I.icon.label.fontWeight,fontFamily:I.icon.label.fontFamily,letterSpacing:I.icon.label.letterSpacing,color:Ji.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})})}i(dn,"DialIconItem");function _t({side:e,color:t}){return L("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,r,n,a],s)=>L("line",{x1:o,y1:r,x2:n,y2:a,stroke:t,strokeWidth:2},s))})}i(_t,"PagerChevron");function Ut({side:e,disabled:t,onClick:o}){let[r,n]=te(false),a=t?j.emptyDotBorder:j.accent;return we("button",{type:"button","aria-label":`${e==="prev"?"Previous":"Next"} dial page`,"data-testid":`buoy-dial-${e}`,disabled:t,onClick:o,onPointerDown:()=>!t&&n(true),onPointerUp:()=>n(false),onPointerLeave:()=>n(false),onPointerCancel:()=>n(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${j.dialBorder}`,backgroundColor:j.dialBackground,color:t?j.iconLabelMuted:j.centerText,fontSize:12,fontWeight:900,fontFamily:$t,letterSpacing:1.5,textTransform:"uppercase",cursor:t?"default":"pointer",opacity:t?.4:1,boxShadow:t?"none":`0 0 8px ${Wo(j.dialShadow,.4)}`,transform:r?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[e==="prev"&&L(_t,{side:"prev",color:a}),e==="prev"?"PREV":"NEXT",e==="next"&&L(_t,{side:"next",color:a})]})}i(Ut,"PagerButton");function Kt({icons:e,onClose:t,centerLabel:o="MENU",onCenterPress:r,settingsOpen:n=false,hintsDisabled:a=false,emptyNote:s}){let{id:c}=Xi(),[u,d]=te(0),[g,x]=te(0),[h,B]=te(0),[k,R]=te(0),[F,M]=te(0),[P,A]=te(1),[V,S]=te(false),[D,_]=te(false),[T,E]=te(false),Q=yt(null),Z=yt(null),U=yt(null),q=yt(false),{entrance:ie,exit:ee,interaction:ne}=Ho,xe=Gi(),[ge,ye]=te(()=>({width:window.innerWidth,height:window.innerHeight}));Pe(()=>{let O=i(()=>ye({width:window.innerWidth,height:window.innerHeight}),"resize");return window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);let W=ht(()=>Wi({screenWidth:ge.width,maxCircleSize:Math.max(120,Math.min(320,ge.height-96))}),[ge]),Te=ht(()=>Ui(),[]),be=ht(()=>_i(Qe,W.iconRadius),[W.iconRadius]),[Be,Ie]=te(0),pe=Math.max(1,Math.ceil(e.length/Qe)),oe=Math.min(Be,pe-1),Re=ht(()=>{let O=oe*Qe,w=[...e.slice(O,O+Qe)];for(;w.length<Qe;)w.push({id:`empty-${w.length}`,name:"",icon:null,onPress:i(()=>{},"onPress")});return w},[e,oe]);Pe(()=>{cn()},[]),Pe(()=>{let O=ie.backdrop.duration,w=ie.dial.rotation.duration,l=ie.centerButton.delay,v=ie.icons.delay,C=ie.icons.duration,J=performance.now(),Y=i(f=>{let m=f-J;d(Math.min(1,m/O));let z=Math.min(1,m/400),X=Ke(z)*1.1;z>.7&&(X-=(z-.7)*.33),z>=1&&(X=1),x(Math.max(0,Math.min(1.05,X)));let le=Math.min(1,m/w);if(B(Ke(le)*360),m>=l){let Se=Math.min(1,(m-l)/300),Et=Ke(Se)*1.15;Se>.6&&(Et-=(Se-.6)*.375),Se>=1&&(Et=1),R(Math.max(0,Math.min(1.05,Et)))}if(m>=v){let Se=Math.min(1,(m-v)/C);M(Ke(Se))}let Xe=v+C;m<Xe?U.current=requestAnimationFrame(Y):(d(1),x(1),B(360),R(1),M(1),E(true))},"animate");return U.current=requestAnimationFrame(Y),()=>{U.current&&cancelAnimationFrame(U.current)}},[]);let fe=bt(()=>{if(q.current)return;q.current=true,_(true),U.current&&cancelAnimationFrame(U.current);let O=performance.now(),w=ee.icons.duration,l=ee.centerButton.duration,v=ee.dialScale.duration,C=Math.max(l,v),J=ee.backdrop.duration,Y=i(f=>{let m=f-O;if(m<w){let le=Wt(m/w);M(1-le),U.current=requestAnimationFrame(Y);return}let z=w;if(m<z+C){M(0);let le=Math.min(1,(m-z)/l),Xe=Math.min(1,(m-z)/v);R(1-Wt(le)),x(1-Wt(Xe)),U.current=requestAnimationFrame(Y);return}let X=z+C;if(m<X+J){x(0),R(0);let le=(m-X)/J;d(1-le),U.current=requestAnimationFrame(Y);return}d(0),t()},"animate");U.current=requestAnimationFrame(Y)},[ee,t]);Ht(true,()=>{q.current||(n?r?.():fe())},va),Pe(()=>{let O=document.activeElement,w=Q.current;return()=>{O?.isConnected&&(document.activeElement===document.body||w?.contains(document.activeElement))&&O.focus()}},[]),Pe(()=>{if(n)return;Z.current?.focus();let O=i(w=>{let l=Q.current;if(l){if(w.key==="Escape")w.preventDefault(),fe();else if(w.key==="Tab"){let v=Array.from(l.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(Y=>Y.getClientRects().length>0),C=v[0],J=v[v.length-1];(!l.contains(document.activeElement)||(w.shiftKey?document.activeElement===C:document.activeElement===J))&&(w.preventDefault(),(w.shiftKey?J:C)?.focus())}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(w.key)){let v=Array.from(l.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),C=v.indexOf(document.activeElement);if(C<0||!v.length)return;w.preventDefault();let J=w.key==="Home"?0:w.key==="End"?v.length-1:(C+(w.key==="ArrowRight"||w.key==="ArrowDown"?1:-1)+v.length)%v.length;v[J].focus()}}},"handleKeyDown");return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[fe,n]);let[Ce,ae]=te(false);Pe(()=>{if(a)return;let O=false,w=setTimeout(async()=>{let l=await _o.getItem(sn);!O&&!l&&ae(true)},1200);return()=>{O=true,clearTimeout(w)}},[a]);let ve=bt(()=>{ae(false),_o.setItem(sn,"true")},[]);Pe(()=>{n&&Ce&&ve()},[n,Ce,ve]);let Ye=bt(O=>{if(O.id.startsWith("empty-")||q.current)return;let[w,l]=ne.iconSelect.pulse,v=performance.now(),C=150,J=i(Y=>{let f=Y-v;if(f<C){let m=Ke(f/C);A(1-(1-w.scale)*m),requestAnimationFrame(J)}else if(f<C*2){let m=Ke((f-C)/C);A(w.scale+(l.scale-w.scale)*m),requestAnimationFrame(J)}else A(1)},"animatePulse");requestAnimationFrame(J),setTimeout(()=>{O.onPress(),fe()},ne.iconSelect.actionDelay)},[ne.iconSelect,fe]),$e=bt(O=>{if(q.current)return;let w=Math.max(0,Math.min(O,pe-1));w!==oe&&Ie(w)},[pe,oe]),ke=W.buttonSize*I.centerButton.containerRatio,De=W.buttonSize*I.centerButton.borderRatio,je=W.buttonSize*I.centerButton.containerRatio/2+6,se=T&&!D;return we("div",{ref:Q,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[L("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:fe,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:j.dialBackdrop,opacity:u}}),s?L("div",{role:"status","data-testid":"buoy-dial-empty-note",style:{position:"absolute",left:16,right:16,bottom:80+W.circleSize+16,color:j.iconLabel,fontSize:12,fontFamily:$t,textAlign:"center",opacity:g>.01?1:0},children:s}):null,we("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,bottom:80,width:W.circleSize,height:W.circleSize,borderRadius:"50%",backgroundColor:j.dialBackground,border:`${I.circle.borderWidth}px solid ${j.dialBorder}`,boxShadow:`0 0 ${I.circle.shadowRadius}px ${Wo(j.dialShadow,I.circle.shadowOpacity)}`,transform:`scale(${g}) rotate(${h}deg)`,opacity:g>.01?1:0,overflow:"hidden"},children:[L("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:j.dialGradient1,opacity:I.gradientLayers[0].opacity}}),L("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:j.dialGradient2,opacity:I.gradientLayers[1].opacity}}),L("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:j.dialGradient3,opacity:I.gradientLayers[2].opacity}}),Te.map(O=>L("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:I.grid.lineHeight,transform:`rotate(${O}deg)`,transformOrigin:"center"},children:["left","right"].map(w=>L("div",{style:{position:"absolute",top:0,[w]:0,width:`calc(50% - ${je}px)`,height:I.grid.lineHeight,backgroundColor:j.dialGridLine}},w))},O)),L("div",{"data-testid":"dial-background","data-background":c,style:{position:"absolute",inset:0,pointerEvents:"none"},children:c==="hyperspace"?L(ca,{size:W.circleSize}):L(Yi,{focus:wa})}),Re.map((O,w)=>L(dn,{icon:O,index:w,totalIcons:Re.length,position:be[w],progress:F,onPress:()=>Ye(O)},w)),we("div",{style:{position:"absolute",left:"50%",top:"50%",width:ke,height:ke,marginLeft:-ke/2,marginTop:-ke/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:j.hubHalo,borderRadius:W.buttonSize,overflow:"hidden",transform:`scale(${k*P})`,opacity:k>.01?1:0},children:[L("div",{style:{position:"absolute",inset:0,backgroundColor:j.dialGradient1,opacity:.5,borderRadius:W.buttonSize}}),L("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:j.dialGradient2,opacity:.3,borderRadius:W.buttonSize}}),L("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:j.dialGradient3,opacity:.2,borderRadius:W.buttonSize}}),L("div",{style:{width:De,height:De,borderRadius:W.buttonSize*I.centerButton.borderRadiusRatio,backgroundColor:j.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:L("button",{ref:Z,type:"button","aria-label":n?"Close Settings":"Open Dev Tools Settings",disabled:!r,onClick:r,onPointerEnter:O=>O.pointerType==="mouse"&&S(true),onPointerLeave:()=>S(false),style:{border:0,padding:0,background:"transparent",width:W.buttonSize,height:W.buttonSize,borderRadius:W.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:r?"pointer":"default",transform:V?`scale(${ne.centerHover.scale})`:"scale(1)",transition:`transform ${ne.centerHover.duration}ms ease`,animation:se&&!V?xe.pulse:"none"},children:n?we("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:I.centerButton.text.fontSize-2,fontWeight:I.centerButton.text.fontWeight,fontFamily:I.centerButton.text.fontFamily,color:j.centerText,letterSpacing:I.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[L("span",{style:{marginBottom:-2},children:"CLOSE"}),L("span",{style:{marginTop:-2},children:"SETTINGS"})]}):L("span",{style:{fontSize:I.centerButton.text.fontSize,fontWeight:I.centerButton.text.fontWeight,fontFamily:I.centerButton.text.fontFamily,color:j.centerText,letterSpacing:I.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase"},children:o})})})]})]}),pe>1&&we("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,top:"calc(100% - 64px)",width:W.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,g),transform:`scale(${Math.min(1,g)})`},children:[L(Ut,{side:"prev",disabled:oe<=0,onClick:()=>$e(oe-1)}),we("span",{"data-testid":"buoy-dial-page",style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:$t,letterSpacing:2,color:j.centerText,textShadow:`0 0 6px ${j.centerTextGlow}`},children:[String(oe+1).padStart(2,"0"),we("span",{style:{color:j.iconLabelMuted,textShadow:"none"},children:[" / ",String(pe).padStart(2,"0")]})]}),L(Ut,{side:"next",disabled:oe>=pe-1,onClick:()=>$e(oe+1)})]}),Ce&&!n&&L(Nt,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:ve,showArrow:false})]})}i(Kt,"DialMenu");import{persistentStorage as un,devToolsStorageKeys as xa}from"@buoy-gg/shared-ui/web";import{recordUsage as Ta,pruneUsage as Ia}from"@buoy-gg/floating-tools-core/web";var pn=xa.dial.usage(),Ve={},fn=false,Vt=null;function qt(){return Vt||(Vt=(async()=>{try{let e=await un.getItem(pn);if(e){let t=JSON.parse(e);t&&typeof t=="object"&&(Ve=t)}}catch{}finally{fn=true}})(),Vt)}i(qt,"loadDialUsage");qt();function gn(e){return e.map((t,o)=>({id:t,index:o,lastUsed:Ve[t]?.lastUsed??0})).sort((t,o)=>o.lastUsed-t.lastUsed||t.index-o.index).map(({id:t})=>t)}i(gn,"getRankedToolIds");async function mn(e){if(!e)return;fn||await qt();let t=Math.max(Date.now(),...Object.values(Ve).map(o=>o.lastUsed+1));Ve=Ia(Ta(Ve,e,t),t);try{await un.setItem(pn,JSON.stringify(Ve))}catch{}}i(mn,"recordToolUsage");import{useCallback as Ca,useMemo as hn}from"react";import{persistentStorage as ka}from"@buoy-gg/shared-ui/web";import{useState as re,useEffect as ze,useCallback as wt,useMemo as xt}from"react";import{settingsEventBus as Tt}from"@buoy-gg/floating-tools-core/web";import{useSyncExternalStore as za}from"react";import{getRegisteredToolModule as Aa}from"@buoy-gg/shared-ui/web";var Ba=i(()=>()=>{},"noopSubscribe"),Ra=i(()=>null,"serverSnapshot");function yn(){let e=Aa("@buoy-gg/external-sync");return za(e?.subscribeSyncStatus??Ba,()=>e?.getSyncStatus?.()??null,Ra)}i(yn,"useDesktopSyncStatus");import{SentryIcon as Da,WifiCircuitIcon as Ma,ImageOverlayIcon as Oa,RenderCountIcon as Pa,Info as Gt,Layers as Ea,ChevronRightIcon as bn,ChevronDown as vn,getStorageBackendType as La,getUseLicense as Fa,signOutOfBuoy as $a,persistentStorage as Ee,Trash2 as ja,CheckCircle2 as Sn,BuoyUpgradeSheet as Na,BackgroundSwitcher as Ha,night as b,NightCard as Le,NightRows as Jt,NightSectionLabel as Wa,NightFootnote as wn,NightSwitch as xn,NightButton as Yt,NightSegmented as _a,NightBadge as he,NightSeparator as Ua,monoFont as Tn}from"@buoy-gg/shared-ui/web";import{EnvIcon as In,StorageIcon as Ka,RoutesIcon as Va,NetworkIcon as qa,QueryIcon as Ga,HighlighterIcon as Ja,ReduxIcon as Ya,EventsIcon as Xa}from"@buoy-gg/floating-tools-core/web";import Qa,{createContext as Za,useContext as es}from"react";import{jsx as ts}from"react/jsx-runtime";var Cn=Za({});function Xt({children:e,defaultFloatingTools:t,defaultDialTools:o}){let r=Qa.useMemo(()=>({defaultFloatingTools:t,defaultDialTools:o}),[t,o]);return ts(Cn.Provider,{value:r,children:e})}i(Xt,"DefaultConfigProvider");function Qt(){return es(Cn)}i(Qt,"useDefaultConfig");import os from"react";import{toolTheme as ns}from"@buoy-gg/shared-ui/web";import{jsx as kn}from"react/jsx-runtime";function zn({label:e,size:t,color:o=ns.colors.text}){let r=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1),n=r<=2?t:t*1.6,a=Math.max(7,Math.min(t*(r===1?.7:.62),n/(.62*r)));return kn("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:a,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}i(zn,"AppTextIcon");function Zt(e,t){return e==null?e:typeof e=="function"?os.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions}):typeof e=="string"||typeof e=="number"?kn(zn,{label:String(e),size:t.size,color:t.color}):e}i(Zt,"renderAppIcon");import{JsModal as rs,devToolsStorageKeys as eo,onSettingsApplied as is,expandableWindowControlsSupported as as}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as ss}from"@buoy-gg/shared-ui/web";import{Fragment as et,jsx as p,jsxs as N}from"react/jsx-runtime";var qe="@react_buoy_dev_tools_settings",ls=6,It=i(e=>{let t=ls,o={};for(let[r,n]of Object.entries(e))n&&t>0?(o[r]=true,t-=1):o[r]=false;return o},"enforceDialLimit"),cs=i((e,t)=>{let{userStatus:o,environment:r,...n}=e,a=t?Object.entries(n).filter(([s])=>t.includes(s)):Object.entries(n);return{...Object.fromEntries(a),environment:r??false}},"sanitizeFloating"),An=i((e,t,o)=>{if(!t)return e;let r={...e.dialTools,...t.dialTools??{}},n=o?.allowedDialKeys?Object.entries(r).filter(([a])=>o.allowedDialKeys?.includes(a)):Object.entries(r);return{dialTools:It(Object.fromEntries(n)),floatingTools:cs({...e.floatingTools,...t.floatingTools??{}},o?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...t.globalSettings??{}}}},"mergeWithDefaults"),ds=i((e=[],t,o)=>{let r={},n={},a=new Set(t??[]),s=new Set(o??[]),c=!o||o.length===0;for(let u of e){let{id:d,slot:g="both"}=u;(g==="dial"||g==="both")&&(r[d]=c?true:s.has(d)),(g==="row"||g==="both")&&(n[d]=a.has(d))}return{dialTools:It(r),floatingTools:{...n,environment:a.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}},"generateDefaultSettings"),us=i(({visible:e,onClose:t,onSettingsChange:o,initialSettings:r,availableApps:n=[],storage:a=Ee,zIndex:s})=>{let{defaultFloatingTools:c,defaultDialTools:u}=Qt(),d=xt(()=>ds(n,c,u),[n,c,u]),g=xt(()=>Object.keys(d.dialTools),[d]),x=xt(()=>Object.keys(d.floatingTools).filter(f=>f!=="environment"),[d]),[h,B]=re(r||tt||d),[k,R]=re(to??"floating"),[F,M]=re(to!==null),[P,A]=re(new Set),[V,S]=re(false),[D,_]=re(false);ze(()=>{let f=requestAnimationFrame(()=>_(true));return()=>cancelAnimationFrame(f)},[]);let T=yn();ze(()=>{i(async()=>{try{let f=await Ee.getItem(eo.settings.activeTab());if(f&&["floating","settings","pro"].includes(f)){let m=f;to=m,R(z=>z===m?z:m)}}catch{}finally{M(true)}},"loadActiveTab")()},[]),ze(()=>{F&&Ee.setItem(eo.settings.activeTab(),k).catch(f=>{console.warn("[Buoy]","Failed to save settings active tab:",f)})},[k,F]);let E=Fa()?.(),Q=E?.isPro??false,Z=!Q&&E?.licenseKey?E.error:null,U=E?.errorKind==="transport",[q,ie]=re(Bn),[ee,ne]=re(false),[xe,ge]=re(false),[ye,W]=re(false),[Te,be]=re([]),[Be,Ie]=re(false),pe=ss(),oe=zo.get("window").height,Re=zo.get("window").width,fe=Math.floor(oe*.33),Ce=Math.min(Re-32,400),ae=wt(async()=>{try{let f=await a.getItem(qe);if(f){let m=JSON.parse(f),z=An(d,m,{allowedDialKeys:g,allowedFloatingKeys:x});tt=z,B(X=>Rn(X,z)?X:z);return}tt=d,B(m=>Rn(m,d)?m:d)}catch(f){console.error("[Buoy]","Failed to load dev tools settings:",f),B(d)}},[d,g,x,a]);ze(()=>{ae()},[ae]),ze(()=>{La().then(f=>{Bn=f,ie(m=>m===f?m:f)})},[]),ze(()=>{ye&&(Ie(true),Ee.getAllKeys().then(f=>{be(f.sort())}).catch(()=>{be([])}).finally(()=>{Ie(false)}))},[ye]);let ve=i(async f=>{try{let m=null;try{let X=await a?.getItem(qe);m=X?JSON.parse(X):null}catch{}let z={...f,dialTools:{...m?.dialTools,...It(f.dialTools)},floatingTools:{...m?.floatingTools,...f.floatingTools}};await a.setItem(qe,JSON.stringify(z)),tt=z,B(z),o?.(z),Tt.emit(z)}catch(m){console.error("[Buoy]","Failed to save dev tools settings:",m)}},"saveSettings"),Ye=i(f=>{let m={...h,floatingTools:{...h.floatingTools,[f]:!h.floatingTools[f]}};ve(m)},"toggleFloatingTool"),$e=i(f=>{let m={...h,globalSettings:{...h.globalSettings,[f]:!h.globalSettings?.[f]}};ve(m)},"toggleGlobalSetting"),ke=i(async()=>{ne(true),ge(false);try{await Ee.clear(),ge(true),B(d),a!==Ee&&await a.setItem(qe,JSON.stringify(d)),o?.(d),Tt.emit(d),setTimeout(()=>ge(false),2e3)}catch(f){console.error("[Buoy]","Failed to clear storage:",f)}finally{ne(false)}},"handleClearStorage"),De=wt(f=>{},[]),je=i(f=>{let m=n.find(z=>z.id===f);return m?.description?m.description:f==="environment"?"Environment badge.":""},"getToolDescription"),se=i(f=>f==="environment"?"Env Badge":n.find(m=>m.id===f)?.name??f.toUpperCase().replace(/_/g," "),"getToolLabel"),O=i(f=>{if(!D)return null;switch(f){case"query":return p(Ga,{size:18});case"env":return p(In,{size:18});case"sentry":return p(Da,{size:18,color:"#9945FF"});case"storage":return p(Ka,{size:18,bgColor:b.color.surface});case"wifi":case"query-wifi-toggle":return p(Ma,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return p(Va,{size:18,bgColor:b.color.surface});case"network":return p(qa,{size:18});case"environment":return p(In,{size:18});case"debug-borders":return p(Ea,{size:18,color:b.color.accent});case"highlight-updates":return p(Pa,{size:18,color:b.color.accent});case"highlight-updates-modal":return p(Ja,{size:18});case"redux":return p(Ya,{size:18});case"image-overlay":return p(Oa,{size:18});case"events":return p(Xa,{size:18});case"zustand":try{let{ZustandIcon:m}=Ao("@buoy-gg/zustand/web");return p(m,{size:18})}catch{return p(Gt,{size:18,color:b.color.textSecondary})}case"jotai":try{let{JotaiIcon:m}=Ao("@buoy-gg/jotai/web");return p(m,{size:18})}catch{return p(Gt,{size:18,color:b.color.textSecondary})}default:{let m=n.find(z=>z.id===f);return m?.icon!=null?Zt(m.icon,{slot:"row",size:18,color:m.color}):p(Gt,{size:18,color:b.color.textSecondary})}}},"getToolIcon"),w=i((f,m,z,X)=>{let le=je(f);return N(ut,{activeOpacity:z?1:.7,onPress:()=>!z&&X(),accessibilityLabel:se(f),accessibilityRole:"button",style:[y.toolRow,z&&y.rowDisabled],children:[p(H,{style:y.toolIconSlot,children:O(f)}),N(H,{style:y.rowInfo,children:[N(K,{style:y.rowLabel,children:[se(f),z?" \xB7 max 6":""]}),le?p(K,{style:y.rowCaption,numberOfLines:1,children:le}):null]}),p(xn,{value:m,disabled:z,onValueChange:()=>X(),accessibilityLabel:se(f)})]},f)},"renderToolRow"),l=i(f=>{A(m=>{let z=new Set(m);return z.has(f)?z.delete(f):z.add(f),z})},"toggleSettingExpanded"),v=i((f,m,z,X,le)=>{let Xe=h.globalSettings?.[f]??false,Se=P.has(f);return N(H,{children:[N(ut,{activeOpacity:.7,onPress:()=>l(f),accessibilityLabel:m,style:y.settingRow,children:[N(H,{style:y.rowInfo,children:[p(K,{style:y.rowLabel,children:m}),p(K,{style:y.rowCaption,numberOfLines:Se?0:1,children:z})]}),p(xn,{value:Xe,onValueChange:()=>$e(f),accessibilityLabel:m})]}),Se&&N(H,{style:y.settingRowBody,children:[p(K,{style:y.settingRowBodyText,children:X}),p(K,{style:y.settingRowBodyHint,children:le})]})]},f)},"renderGlobalSettingRow"),C=i((f,m,z)=>N(H,{children:[p(Wa,{children:f}),m,z]}),"renderSection"),J=q==="filesystem"?p(he,{label:"File System",tone:"accent"}):q==="asyncstorage"?p(he,{label:"Async Storage",tone:"warning"}):q==="localstorage"?p(he,{label:"Local Storage",tone:"accent"}):q==="memory"?p(he,{label:"Memory",tone:"danger"}):p(he,{label:"Loading\u2026",tone:"neutral"}),Y=i(()=>N(H,{style:y.container,children:[N(ko,{keyboardShouldPersistTaps:"handled",style:y.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:y.scrollContainer,children:[k==="floating"&&p(et,{children:C("Floating Tools",p(Le,{glass:true,children:p(Jt,{children:Object.entries(h.floatingTools).map(([f,m])=>w(f,m,false,()=>Ye(f)))})}),p(wn,{children:"Tools switched on here appear in the floating bubble row."}))}),k==="settings"&&N(et,{children:[C("Background",p(Le,{glass:true,padded:true,children:p(Ha,{embedded:true})})),C("Storage",N(Le,{glass:true,children:[N(ut,{activeOpacity:.7,onPress:()=>W(!ye),accessibilityLabel:"Storage Type",style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(K,{style:y.rowLabel,children:"Storage Type"})}),J,ye?p(vn,{size:16,color:b.color.textTertiary}):p(bn,{size:16,color:b.color.textTertiary})]}),ye&&N(et,{children:[N(H,{style:y.settingRowBody,children:[p(K,{style:y.settingRowBodyText,children:q==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":q==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":q==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":q==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),q==="asyncstorage"&&p(K,{style:[y.settingRowBodyText,y.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),q==="memory"&&p(K,{style:[y.settingRowBodyText,y.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),p(Ua,{}),N(H,{style:y.storageExpanded,children:[N(H,{style:y.storageExpandedHeader,children:[p(K,{style:y.storageExpandedTitle,children:"SAVED SETTINGS"}),p(K,{style:y.storageExpandedCount,children:Be?"\u2026":`${Te.length} keys`})]}),Be?p(K,{style:y.storageKeyEmpty,children:"Loading\u2026"}):Te.length===0?p(K,{style:y.storageKeyEmpty,children:"No settings saved yet"}):p(ko,{keyboardShouldPersistTaps:"handled",style:y.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:Te.map(f=>p(H,{style:y.storageKeyItem,children:p(K,{style:y.storageKeyText,numberOfLines:1,children:f.replace("@react_buoy_","")})},f))})]}),p(H,{style:y.cardButtonWrap,children:p(Yt,{label:xe?"Cleared":ee?"Clearing\u2026":"Clear All Settings",variant:xe?"secondary":"destructive",size:"md",disabled:ee,onPress:ke,icon:xe?p(Sn,{size:15,color:b.color.accent}):p(ja,{size:15,color:ee?b.color.textTertiary:b.color.danger})})})]})]})),T&&T.state!=="idle"&&C("Desktop Sync",N(Le,{glass:true,children:[N(ut,{activeOpacity:.7,onPress:()=>l("desktopSync"),accessibilityLabel:"Buoy Desktop",style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(K,{style:y.rowLabel,children:"Buoy Desktop"})}),T.state==="connected"?p(he,{label:"Connected",tone:"accent"}):T.state==="connecting"?p(he,{label:"Connecting\u2026",tone:"neutral"}):p(he,{label:"Retrying",tone:"warning"}),P.has("desktopSync")?p(vn,{size:16,color:b.color.textTertiary}):p(bn,{size:16,color:b.color.textTertiary})]}),P.has("desktopSync")&&N(H,{style:y.settingRowBody,children:[N(K,{style:y.settingRowBodyText,children:[T.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",p(K,{style:y.footnoteMono,children:T.targetURL??"(unknown URL)"}),T.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),T.state==="retrying"&&T.lastError&&N(K,{style:[y.settingRowBodyText,y.bodyWarning],children:["Last error: ",T.lastError]})]})]})),C("Modal Behavior",p(Le,{glass:true,children:N(Jt,{children:[v("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."),as(Ne.OS==="web")?v("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]})}))]}),k==="pro"&&N(et,{children:[C("License",N(Le,{glass:true,children:[N(H,{style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(K,{style:y.rowLabel,children:"License Status"})}),p(H,{testID:"buoy-settings-license-status",accessibilityLabel:Q?"License: Active":"License: Free",children:Q?p(he,{label:"Active",tone:"accent"}):p(he,{label:"Free",tone:"neutral"})})]}),E?.tierSource==="session"?N(H,{style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(K,{style:y.rowLabel,children:"Signed in with Buoy"})}),p(Yt,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void $a(),testID:"buoy-settings-signout"})]}):null,E?.teamRole?p(H,{style:y.settingRow,testID:"buoy-settings-team-role",children:N(H,{style:y.rowInfo,children:[N(K,{style:y.rowLabel,children:["Role: ",E.teamRole]}),p(K,{style:y.rowCaption,children:E.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),p(wn,{children:Q?"You have full access to all Buoy DevTools features.":Z?U?`Couldn't reach the license server (${Z}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${Z}.`:"Upgrade to Pro to unlock all features and support development."})),!Q&&N(et,{children:[C("Pro Features",p(Le,{glass:true,children:p(Jt,{children:["Advanced Settings","Priority Support"].map(f=>N(H,{style:y.featureRow,children:[p(Sn,{size:16,color:b.color.accent}),p(K,{style:y.rowLabel,children:f})]},f))})})),p(Yt,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>S(true)})]})]})]}),p(Na,{visible:V,onClose:()=>S(false)})]}),"renderContent");return p(rs,{visible:e,onClose:t,zIndex:s,variant:"night",header:{showToggleButton:false,customContent:p(H,{style:y.headerRow,children:p(_a,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:k,onChange:f=>R(f)})})},initialMode:"bottomSheet",onModeChange:De,persistenceKey:eo.settings.root(),enablePersistence:true,maxHeight:oe-pe.top,initialHeight:fe,initialFloatingPosition:{x:(Re-Ce)/2,y:pe.top+20},enableGlitchEffects:true,children:Y()})},"DevToolsSettingsModal"),ps={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}},fs=i((e,t)=>{let o=new Set(e??[]),r=new Set(t??[]),n={};for(let s of r)n[s]=true;let a={environment:o.has("environment")};for(let s of o)s!=="environment"&&(a[s]=true);return{dialTools:It(n),floatingTools:a,globalSettings:{enableSharedModalDimensions:false}}},"createDefaultsFromConfig"),tt=null,to=null,Bn=null,Rn=i((e,t)=>JSON.stringify(e)===JSON.stringify(t),"sameSettings");Tt.addListener(e=>{e&&(tt=e)});var Dn=i(()=>{let{defaultFloatingTools:e,defaultDialTools:t}=Qt(),o=xt(()=>!e&&!t?ps:fs(e,t),[e,t]),[r,n]=re(o),a=wt(async()=>{try{let c=await Ee.getItem(qe);if(c){let u=JSON.parse(c),d=An(o,u);n(d);return}n(o)}catch(c){console.error("[Buoy]","Failed to load dev tools settings:",c),n(o)}},[o]);ze(()=>is(c=>{c.includes(qe)&&a()}),[a]),ze(()=>{a();let c=Tt.addListener(u=>{try{u&&n(u)}catch{}});return()=>{c()}},[a]);let s=wt(()=>{a()},[a]);return{settings:r,refreshSettings:s}},"useDevToolsSettings"),y=dt.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:b.gutter,paddingRight:b.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:b.gutter,paddingTop:8,paddingBottom:24,gap:b.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:b.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:b.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:b.color.text,fontSize:b.font.row,fontWeight:"500"},rowCaption:{color:b.color.textTertiary,fontSize:b.font.label},settingRowBody:{paddingHorizontal:b.rowPadH,paddingBottom:b.rowPadV,gap:6},settingRowBodyText:{color:b.color.textSecondary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},settingRowBodyHint:{color:b.color.textTertiary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},bodyWarning:{color:b.color.warning},bodyDanger:{color:b.color.danger},cardButtonWrap:{paddingHorizontal:b.cardPad,paddingTop:10,paddingBottom:b.cardPad},storageExpanded:{paddingHorizontal:b.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:b.color.textSecondary,fontSize:b.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:b.color.textTertiary,fontSize:b.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:b.color.glassElevated,borderRadius:b.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:b.color.textSecondary,fontSize:b.font.micro,fontFamily:Tn},storageKeyEmpty:{color:b.color.textTertiary,fontSize:b.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Tn,fontSize:b.font.label,color:b.color.textSecondary}});import{jsx as Mn}from"react/jsx-runtime";var gs=[];function oo({visible:e,onClose:t,availableTools:o=gs,defaultFloatingTools:r,defaultDialTools:n,storage:a=ka,onSettingsChange:s}){let c=hn(()=>({getItem:i(async g=>a.getItem(g),"getItem"),setItem:i(async(g,x)=>a.setItem(g,x),"setItem")}),[a]),u=hn(()=>o.map(g=>({...g,name:g.name??g.id,icon:typeof g.icon=="function"?x=>g.icon(x.size):g.icon})),[o]),d=Ca(g=>{s?.(g)},[s]);return Mn(Xt,{defaultFloatingTools:r,defaultDialTools:n,children:Mn(us,{visible:e,onClose:t,zIndex:11e3,availableApps:u,storage:c,onSettingsChange:d})})}i(oo,"SettingsModal");import{listenBuoyKeydown as ms}from"@buoy-gg/shared-ui/web/floating";import{persistentStorage as On,setExpandableWindowControls as hs}from"@buoy-gg/shared-ui/web";import{createContext as ys,useCallback as Ae,useContext as bs,useEffect as Ct,useMemo as vs,useRef as ot,useState as Pn}from"react";var Ss=i((e,t,o)=>{if(t.singleton){let n=e.find(a=>a.id===t.id);if(n){let a=n.minimized??false;return{instanceId:n.instanceId,wasMinimized:a,apps:[...e.filter(s=>s.instanceId!==n.instanceId),{...n,minimized:false}]}}}let r=o();return{instanceId:r,wasMinimized:false,apps:[...e,{...t,instanceId:r}]}},"resolveOpenAppsState"),ws=i((e,t,o)=>{let r=e.find(n=>n.instanceId===t);return r?[...e.filter(n=>n!==r),{...r,minimized:false,restoreState:o??r.restoreState}]:e},"restoreOpenApp");import{createContext as xs,useCallback as En,useContext as Ts,useEffect as kt,useMemo as Is,useRef as Ln,useState as zt}from"react";import{JsModal as Cs,ModalHeader as nt,HeaderSearchButton as ks,TickProvider as zs,ToolScreenHeaderContext as As,devToolsStorageKeys as Fn,buoyColors as $n,gameUIColors as no}from"@buoy-gg/shared-ui/web";import{jsx as ce,jsxs as At}from"react/jsx-runtime";var rt=i(()=>{},"noop"),Bs={search:"",isSearchActive:false,clearSearch:rt,close:rt,minimize:rt,showToast:rt,setHeaderOverride:rt},jn=xs(null);function ro(){return Ts(jn)??Bs}i(ro,"useToolHost");function Nn(e,t){let{setHeaderOverride:o}=ro();kt(()=>(o(e),()=>o(null)),t)}i(Nn,"useToolHeader");var Hn=2200,Rs={success:no.success,error:no.error,info:no.info};function Wn({message:e,type:t,nonce:o}){let r=Ln(new Me.Value(0)).current;kt(()=>{r.setValue(0),Me.sequence([Me.timing(r,{toValue:1,duration:150,useNativeDriver:true}),Me.delay(Hn-450),Me.timing(r,{toValue:0,duration:300,useNativeDriver:true})]).start()},[o,r]);let n=Rs[t];return At(Me.View,{pointerEvents:"none",style:[Bt.toast,{opacity:r,borderColor:n+"60"}],children:[ce(H,{style:[Bt.toastDot,{backgroundColor:n}]}),ce(K,{style:Bt.toastText,numberOfLines:2,children:e})]})}i(Wn,"ToastView");function _n({app:e,config:t,visible:o,zIndex:r,onClose:n,onMinimize:a,initialModalState:s,enableSharedModalDimensions:c,bodyProps:u}){let d=e.component,[g,x]=zt(false),[h,B]=zt(""),[k,R]=zt(null),[F,M]=zt(null),P=Ln(null),A=En(()=>{x(false),B("")},[]),V=En((q,ie="info")=>{P.current&&clearTimeout(P.current),M(ee=>({message:q,type:ie,nonce:(ee?.nonce??0)+1})),P.current=setTimeout(()=>M(null),Hn)},[]);kt(()=>()=>{P.current&&clearTimeout(P.current)},[]);let S=Is(()=>({search:g?h:"",isSearchActive:g,clearSearch:A,close:n,minimize:i(()=>a(),"minimize"),showToast:V,setHeaderOverride:R,instanceId:e.instanceId}),[h,g,A,n,a,V,e.instanceId]),D=k?.title??t.title??e.title??e.id,_=k?.subtitle??t.subtitle,T=k?.onBack,E=k?.actions??t.headerActions,Q=k?.searchable??t.searchable;kt(()=>{!Q&&g&&A()},[Q,g,A]);let Z=c?Fn.modal.root():Fn.custom(e.id).modal(),U=At(nt,{children:[T&&!g&&ce(nt.Navigation,{onBack:T}),g?ce(nt.Search,{value:h,onChangeText:B,onCancel:A,placeholder:t.searchPlaceholder,testID:`tool-search-field-${e.id}`}):ce(nt.Content,{title:D,subtitle:_}),At(nt.Actions,{children:[!g&&E,Q&&!g&&ce(ks,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>x(true)})]})]});return ce(jn.Provider,{value:S,children:ce(Cs,{visible:o,onClose:n,onBack:T,onMinimize:a,initialModalState:s,zIndex:r,persistenceKey:Z,enablePersistence:true,initialMode:t.initialMode??"bottomSheet",header:{customContent:U,showToggleButton:true},disableScrollWrapper:true,styles:{},children:At(H,{nativeID:"buoy-tool-host",style:Bt.bodyRoot,children:[ce(zs,{children:ce(As.Provider,{value:R,children:ce(d,{...u})})}),F&&ce(Wn,{message:F.message,type:F.type,nonce:F.nonce})]})})})}i(_n,"ToolModalShell");var Bt=dt.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:$n.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:$n.text}});function Un(e,t){if(t)return{kind:"dial"};for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.launchMode!=="toggle-only"&&!n.minimized)return{kind:"tool",instanceId:n.instanceId}}let o=e[e.length-1];return o?{kind:"tool",instanceId:o.instanceId}:null}i(Un,"resolveBackTarget");import{createContext as Ds,useContext as Ms,useState as Kn,useMemo as Vn}from"react";import{jsx as Os}from"react/jsx-runtime";var qn=Ds(null);function io({children:e}){let[t,o]=Kn(false),[r,n]=Kn(false),a=Vn(()=>t||r,[t,r]),s=Vn(()=>({isDialOpen:t,isToolOpen:r,isDevToolsActive:a,setDialOpen:o,setToolOpen:n}),[t,r,a]);return Os(qn.Provider,{value:s,children:e})}i(io,"DevToolsVisibilityProvider");function it(){let e=Ms(qn);return e||{isDialOpen:false,isToolOpen:false,isDevToolsActive:false,setDialOpen:i(()=>{},"setDialOpen"),setToolOpen:i(()=>{},"setToolOpen")}}i(it,"useDevToolsVisibility");import{Fragment as Ps,jsx as de}from"react/jsx-runtime";var Gn=ys(null),Jn="@react_buoy_open_apps",ao=44,Es=12,Ls=100,Fs=16,$s=i(e=>({x:window.innerWidth-ao-Fs,y:window.innerHeight-Ls-ao-e*(ao+Es)}),"dockIconPosition"),Yn=i(({children:e})=>{let[t,o]=Pn([]),[r,n]=Pn(false),a=ot([]),s=ot(null),c=ot(false),u=ot(false),d=ot(false),g=Ae(S=>{let D="";return o(_=>{let{apps:T,instanceId:E}=Ss(_,S,()=>`${S.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);return D=E,T}),D},[]),x=Ae(()=>{if(c.current||!u.current||!d.current)return;c.current=true;let S=s.current;if(!S||S.length===0){n(true);return}s.current=null,S.forEach(({id:D,minimized:_})=>{let T=a.current.find(E=>E.id===D);if(T&&T.component){let E=Zt(T.icon,{slot:"dial",size:20,color:T.color});g({id:T.id,title:T.name,component:T.component,props:T.props,modal:T.modal,launchMode:T.launchMode||"self-modal",singleton:T.singleton??true,icon:E,color:T.color,minimized:_})}}),n(true)},[g]);Ct(()=>{let S=false;return i(async()=>{try{let D=await On.getItem(Jn);if(S)return;if(D){let _=JSON.parse(D),T;Array.isArray(_)&&_.length>0&&(typeof _[0]=="string"?T=_.map(E=>({id:E,minimized:false})):T=_.filter(E=>typeof E=="object"&&E!==null&&typeof E.id=="string"),T.length&&(s.current=T))}}catch{}S||(u.current=true,x())},"restoreOpenApps")(),()=>{S=true}},[x]),Ct(()=>{if(!r)return;let S=t.map(D=>({id:D.id,minimized:D.minimized??false}));On.setItem(Jn,JSON.stringify(S))},[t,r]);let h=Ae(S=>{a.current=S,d.current=true,x()},[x]),B=Ae(S=>{o(D=>D.length?S?D.filter(_=>_.instanceId!==S):D.slice(0,-1):D)},[]),k=Ae(()=>o([]),[]),R=Ae((S,D)=>{o(_=>_.map(T=>T.instanceId===S?{...T,minimized:true,restoreState:D}:T))},[]),F=Ae((S,D)=>{o(_=>ws(_,S,D))},[]),M=Ae(S=>t.find(D=>D.instanceId===S)?.minimized??false,[t]),P=t.some(S=>S.launchMode!=="toggle-only"&&!S.minimized);Ct(()=>P?ms(i(S=>{if(S.key!=="Escape"||S.defaultPrevented)return;let D=[...t].reverse().find(_=>_.launchMode!=="toggle-only"&&!_.minimized);D&&B(D.instanceId)},"handler")):void 0,[P,B,t]);let{isDialOpen:A}=it();Ht(t.length>0,()=>{let S=Un(t,A);S?.kind==="tool"&&B(S.instanceId)});let V=vs(()=>({openApps:t,isAnyOpen:P,open:g,close:B,closeAll:k,registerApps:h,minimize:R,restore:F,isMinimized:M}),[t,P,g,B,k,h,R,F,M]);return de(Gn.Provider,{value:V,children:e})},"AppHostProvider"),at=i(()=>{let e=bs(Gn);return e||{openApps:[],isAnyOpen:false,open:i(()=>"","open"),close:i(()=>{},"close"),closeAll:i(()=>{},"closeAll"),registerApps:i(()=>{},"registerApps"),minimize:i(()=>{},"minimize"),restore:i(()=>{},"restore"),isMinimized:i(()=>false,"isMinimized")}},"useAppHost"),js=9e3,Ns={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"},Hs={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"},Ws=i(({app:e,zIndex:t,onClose:o,onMinimize:r,minimizeTargetPosition:n,enableSharedModalDimensions:a})=>{let s=e.component,c=!e.minimized,u={...e.props??{},...a?{enableSharedModalDimensions:true}:{}};return e.modal&&(!e.launchMode||e.launchMode==="self-modal")?de("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:de(_n,{app:e,config:e.modal,visible:c,zIndex:t,onClose:o,onMinimize:r,initialModalState:e.restoreState,enableSharedModalDimensions:a,bodyProps:u})}):e.launchMode==="self-modal"?de("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:de(s,{...u,visible:c,onClose:o,onRequestClose:o,onMinimize:r,minimizeTargetPosition:n,instanceId:e.instanceId,zIndex:t,initialModalState:e.restoreState})}):e.launchMode==="inline"?c?de("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:de(s,{...u,onClose:o,onMinimize:r,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})}):null:de("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{...Ns,zIndex:t,display:c?"flex":"none"},children:de("div",{style:Hs,children:de(s,{...u,onClose:o,onMinimize:r,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})})})},"AppRenderer"),Xn=i(()=>{let{openApps:e,close:t,minimize:o}=at(),{settings:r}=Dn();Ct(()=>{hs(r.globalSettings?.expandableWindowControls!==false)},[r.globalSettings?.expandableWindowControls]);let n=e.filter(c=>c.launchMode!=="toggle-only");if(n.length===0)return null;let a=n.filter(c=>c.minimized).length,s=Hi()??$s(a);return de(Ps,{children:n.map((c,u)=>de(Ws,{app:c,zIndex:js+u,onClose:()=>t(c.instanceId),onMinimize:d=>o(c.instanceId,d),enableSharedModalDimensions:r.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:s},c.instanceId))})},"AppOverlay");import{useCallback as _s,useEffect as so,useRef as Us,useState as Qn,useSyncExternalStore as Zn}from"react";import{persistentStorage as er,getToolAttention as lo,subscribeToolAttention as tr}from"@buoy-gg/shared-ui/web";import{jsx as ue,jsxs as Rt}from"react/jsx-runtime";function or(e){return Zn(tr,()=>lo(e),()=>lo(e))}i(or,"useToolAttention");var nr={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"},rr={needsInput:3,failed:2,done:1},ir=new Map;function co(e){let t=null;for(let r of e?e.split("|"):[]){let n=lo(r);n&&(!t||rr[n.kind]>rr[t.kind])&&(t=n)}let o=ir.get(e);return o&&t&&o.kind===t.kind&&o.label===t.label?o:!o&&!t?null:(ir.set(e,t),t)}i(co,"strongest");function ar(e){let t=e.join("|");return Zn(tr,()=>co(t),()=>co(t))}i(ar,"useStrongestAttention");var sr=28,uo=32,po=6,lr=8,cr=24,dr="@react_buoy_minimized_stack_expanded",Ks=80,ur=2e3,Vs=6e3,qs="#1A1A1A",st="#888888";function fo({down:e=false}){return ue("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:ue("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:st,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}i(fo,"ChevronGlyph");function pr({id:e,title:t,icon:o,index:r,onPress:n}){let a=or(e),s=Us(null);return so(()=>{let c=true,u,d=i(()=>{s.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:Ks,easing:"linear"})},"runGlitch"),g=i(x=>{let h=x?500+Math.random()*1500+r*200:ur+Math.random()*(Vs-ur)+r*300;u=setTimeout(()=>{c&&(d(),g(false))},h)},"schedule");return g(true),()=>{c=false,clearTimeout(u)}},[r]),Rt("button",{type:"button","aria-label":a?`${t} \u2014 ${a.label}. Restore`:`Restore ${t}`,"data-testid":`buoy-dock-restore-${e}`,onClick:n,style:{width:uo,height:uo,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[ue("div",{ref:s,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:o}),a?ue("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${a.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:nr[a.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:a.kind==="needsInput"?"!":""}):null]})}i(pr,"GlitchToolButton");function fr({containerWidth:e=32}){let{openApps:t,restore:o}=at(),r=t.filter(h=>h.minimized&&h.launchMode!=="toggle-only"),[n,a]=Qn(false),[s,c]=Qn(false),u=ar(r.map(h=>h.id));so(()=>{let h=false;return i(async()=>{let B=await er.getItem(dr);!h&&B==="true"&&a(true),h||c(true)},"load")(),()=>{h=true}},[]),so(()=>{s&&er.setItem(dr,n?"true":"false")},[n,s]);let d=_s(h=>{o(h)},[o]);if(r.length===0)return null;let g=lr+r.length*uo+(r.length-1)*po+po+cr+4,x={backgroundColor:qs,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${st}66`,borderLeft:`1px solid ${st}66`,borderRight:`1px solid ${st}66`,borderBottom:"none",boxSizing:"border-box"};return Rt("div",{style:{height:sr,overflow:"visible",position:"relative"},children:[ue("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?g:0,opacity:n?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:n?"auto":"none",...x},children:Rt("div",{style:{height:g,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:lr,gap:po,boxSizing:"border-box"},children:[n&&[...r].reverse().map((h,B)=>ue(pr,{id:h.id,title:h.title||h.id,icon:h.icon??ue("span",{style:{color:"#fff",fontSize:13},children:(h.title||h.id).slice(0,1).toUpperCase()}),index:B,onPress:()=>d(h.instanceId)},h.instanceId)),ue("button",{type:"button","aria-label":"Collapse","data-testid":"buoy-dock-collapse",onClick:()=>a(false),style:{width:"100%",height:cr,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:ue(fo,{down:true})})]})}),Rt("button",{type:"button","aria-label":`Show ${r.length} minimized tools`,"data-testid":"buoy-dock-peek",tabIndex:n?-1:0,"aria-hidden":n,onClick:()=>a(true),style:{position:"absolute",bottom:0,left:0,width:e,height:sr,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:[ue(fo,{}),u?ue("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:nr[u.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:u.kind==="needsInput"?"!":""}):null,r.length>1&&ue("span",{style:{fontSize:9,fontWeight:600,color:st,marginLeft:1},children:r.length})]})]})}i(fr,"MinimizedToolsStack");var gr=class Kc{constructor(){this.listeners=new Set}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){this.listeners.forEach(t=>t())}};i(gr,"ToggleStateManager");var Gs=gr,Js=new Gs;import{registerToolModules as Ys}from"@buoy-gg/shared-ui/web";import{createElement as Xs}from"react";function Ge(e){let t=e.icon;return{...e,icon:typeof t=="function"?o=>Xs(t,{size:o,slot:e.slot??"both",color:e.color}):()=>t}}i(Ge,"createWebTool");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 go(e){Ys({core:{useDevToolsVisibility:it},license:Qs,"shared-ui":Zs,"shared-ui/dataViewer":el,...e});let t=new Set;return Object.values(e).flatMap(o=>Object.entries(o).flatMap(([r,n])=>!r.endsWith("Preset")||!n||typeof n.id!="string"||!n.component||t.has(n.id)?[]:(t.add(n.id),[Ge(n)])))}i(go,"createWebTools");import{useEffect as Dt,useMemo as Mt,useRef as tl}from"react";import{LicenseManager as mr,installCapacitorBridge as ol,resolveDevBuild as hr,useLicense as nl}from"@buoy-gg/license/web";import{registerToolAdapters as rl}from"@buoy-gg/shared-ui/web";function mo(e){return typeof e=="object"&&e!==null?e:void 0}i(mo,"externalSyncOptions");function yr({isDevelopment:e,isLicensed:t,externalSync:o,isAvailable:r}){if(o===false||!r)return false;if(e)return true;let n=mo(o);return t&&n?.enableInRelease===true&&ho(n.socketURL,n)===null}i(yr,"shouldMountExternalSync");var br="http://localhost:42831";function vr(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}i(vr,"isLoopbackHost");function ho(e,t){let o=e??br;if(t?.allowInsecureNetwork===true)return null;let r;try{r=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 r.protocol==="https:"||r.protocol==="wss:"||vr(r.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.`}i(ho,"releaseTransportProblem");var il={"ota-update-inspector":["check","fetch","reload","setHeaders","setURL"],impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};function Sr(e,t,o){if(t)return e;let r=null;for(let[n,a]of Object.entries(il)){if(o?.includes(n))continue;let s=e[n];if(!s?.actions)continue;let c={...s.actions};for(let u of a)u in c&&(c[u]=()=>{throw new Error(`${n}.${u} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)});r??(r={...e}),r[n]={...s,actions:c}}return r??e}i(Sr,"applyReleaseActionPolicy");import{useEffect as al,useMemo as sl,useState as ll}from"react";import{devToolsStorageKeys as cl,persistentStorage as dl}from"@buoy-gg/shared-ui/web";import{isCapacitorNative as ul}from"@buoy-gg/license/web";var pl=8;function wr(){let e="";for(;e.length<pl;)e+=(Math.random()*16|0).toString(16);return e}i(wr,"generateInstallId");function xr(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}i(xr,"slugify");function Tr({appName:e,hardwareName:t,platform:o,installId:r,deviceId:n}){let a=xr(e??"buoy")||"buoy",s=e??"Buoy Device",c=t?.trim()||o;return n?{deviceId:n,deviceName:`${s} (${c})`}:{deviceId:`${a}-${o}-${r}`,deviceName:`${s} (${c} \xB7 ${r.slice(-4)})`}}i(Tr,"buildDeviceIdentity");function Ir(){let e=globalThis;try{return e.sessionStorage??null}catch{return null}}i(Ir,"sessionStore");function Cr(){let e=globalThis;try{return e.localStorage??null}catch{return null}}i(Cr,"localStore");async function kr({platform:e=Ne.OS,store:t,mint:o=wr}={}){let r=cl.sync.deviceId(),n=t===void 0?ul()?Cr():e==="web"?Ir():dl:t;if(!n)return o();try{let a=await n.getItem(r);if(a&&a.length>0)return a;let s=o();return await n.setItem(r,s),s}catch{return o()}}i(kr,"loadInstallId");var yo=null;function zr(){return yo||(yo=kr()),yo}i(zr,"getInstallId");function Ar(e,t){let o=e?.deviceId,r=e?.deviceName,n=t.loadId??zr,a=t.platform??Ne.OS,[s,c]=ll(null);return al(()=>{if(o)return;let u=false;return n().then(d=>{u||c(d)}),()=>{u=true}},[o,n]),sl(()=>{if(!o&&!s)return null;let u=Tr({appName:t.appName,hardwareName:t.hardwareName,platform:a,installId:s??"",deviceId:o});return r?{...u,deviceName:r}:u},[o,r,s,t.appName,t.hardwareName,a])}i(Ar,"useDeviceIdentity");import{useEffect as fl,useState as gl}from"react";import{capacitorPlatform as ml,capacitorPlugin as Ot,isCapacitorNative as hl}from"@buoy-gg/license/web";function Br(e,t){if(t==="ios")return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":null;let o=/Android [\d.]+;\s*([^;)]+?)(?:\s+Build\/|\))/.exec(e)?.[1]?.trim();return!o||o==="K"?null:o}i(Br,"hardwareFromUserAgent");function Rr(e){return/sdk_gphone|Android SDK built for|Android ATD built for|google_sdk|Emulator|generic_/i.test(e)}i(Rr,"isAndroidEmulatorUserAgent");function bo(){return typeof navigator>"u"?"":navigator.userAgent??""}i(bo,"userAgent");function Pt(){return typeof document>"u"?null:document.title||(typeof location>"u"?null:location.hostname)||null}i(Pt,"firstPageTitle");var Dr="@react_buoy_capacitor_app_name";function Mr(e){try{let t=globalThis.localStorage;if(!t)return e;let o=t.getItem(Dr);if(o)return o;e&&t.setItem(Dr,e)}catch{}return e}i(Mr,"persistedAppName");function Or(){let e=ml();if(!e)return{platform:"web",appName:Pt(),hardwareName:"Browser",ready:true};let t=!!Ot("App");return{platform:e,appName:t?Pt():Mr(Pt()),hardwareName:Br(bo(),e)??e,extraDeviceInfo:{runtime:"capacitor"},ready:!t&&!Ot("Device")}}i(Or,"initialHostInfo");function Pr(){let[e,t]=gl(Or);return fl(()=>{if(!hl())return;let o=false,r=Ot("App"),n=Ot("Device");return Promise.all([r?.getInfo?.().catch(()=>null)??null,n?.getInfo?.().catch(()=>null)??null]).then(([a,s])=>{if(o)return;let c=a?.name?.trim(),u=s?.name?.trim()||s?.model?.trim();t(d=>({...d,appName:c||d.appName,hardwareName:u||d.hardwareName,ready:true}))}),()=>{o=true}},[]),e}i(Pr,"useHostInfo");function vo(){if(typeof location>"u")return null;let e=globalThis.WEBVIEW_SERVER_URL;return{protocol:location.protocol,hostname:location.hostname,origin:`${location.protocol}//${location.host}`,userAgent:bo(),serverUrl:typeof e=="string"?e:null}}i(vo,"pageInfo");function So(e){if(!e)return null;try{let t=new URL(e);return`${t.protocol}//${t.host}`}catch{return null}}i(So,"schemeHost");function Er(e,t){if(e==="ios"){let o=So(t.serverUrl);return o?o===So(t.origin):t.protocol==="capacitor:"}return Lr.has(t.hostname)}i(Er,"isBundledPage");var Lr=new Set(["localhost","127.0.0.1","[::1]","::1"]);function Fr(e,t,o,r=vo()){if(o==="web"||!r)return e;let n;try{n=new URL(e)}catch{return e}let a=Er(o,r);return!t&&a&&n.hostname===r.hostname&&(n.hostname="localhost"),o==="android"&&Lr.has(n.hostname)&&Rr(r.userAgent)&&(n.hostname="10.0.2.2"),n.toString().replace(/\/$/,"")}i(Fr,"capacitorBrokerURL");function $r(e,t,o=vo()){return t!=="android"||!o||o.protocol!=="https:"||!/^(http|ws):/i.test(e)?null:`[Buoy] Can't reach Buoy Desktop at ${e}. This Android WebView serves the app from https://${o.hostname} and blocks plain http/ws by default. For debug builds, set android.allowMixedContent: true and server.cleartext: true in capacitor.config, then run cap sync.`}i($r,"capacitorTransportProblem");import{getDevServerOrigin as yl,resolveReloadStrategy as bl,scheduleReloadApp as vl}from"@buoy-gg/shared-ui/web";var jr=Date.now(),Nr=yl(),Sl={platform:Ne.OS,isTV:Ne.isTV===true,isTVOS:Ne.isTVOS===true},Hr={version:3,getSnapshot:i(()=>{let e=bl("auto");return{startedAt:jr,devServerOrigin:Nr,device:Sl,reload:{available:e!==null,strategy:e}}},"getSnapshot"),subscribe:i(e=>()=>{},"subscribe"),actions:{ping:i(()=>({ok:true,startedAt:jr,devServerOrigin:Nr}),"ping"),reloadApp:i(e=>{let t=e??{},{strategy:o,delayMs:r}=vl({strategy:t.strategy,delayMs:t.delayMs});return{scheduled:true,strategy:o,delayMs:r}},"reloadApp")}};import{Fragment as wl,jsx as Fe,jsxs as xl}from"react/jsx-runtime";var Tl=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"],Il=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay","BugLinksOverlay"];function Wr(e){let t=Mt(()=>Object.fromEntries(Object.entries(e.modules).map(([r,n])=>[r.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),n])),[e.modules]),o=t["react-query"];return o?.useReactQuerySyncAdapter?Fe(_r,{...e,modules:t,query:o}):Fe(wo,{...e,modules:t})}i(Wr,"BrowserToolRuntime");function _r(e){let t=e.query.useReactQuerySyncAdapter();return Fe(wo,{...e,queryAdapter:t})}i(_r,"QueryRuntime");function wo({modules:e,apps:t,requiredEnvVars:o,externalSync:r,headless:n,sentryGetClient:a,queryAdapter:s}){let{isPro:c,tier:u}=nl(),d=Mt(()=>{let F={app:Hr};for(let[M,P]of Object.entries(e))for(let[A,V]of Object.entries(P))A.endsWith("SyncAdapter")&&V&&typeof V=="object"&&(F[M]=V);s&&(F.query=s),e.env?.createEnvSyncAdapter&&(F.env=e.env.createEnvSyncAdapter(o??[]));for(let M of t??[])M.sync&&(F[`custom:${M.id}`]=M.sync);return F},[e,t,o,s]),g=tl(d);g.current=d,Dt(()=>rl(()=>g.current),[]),Dt(()=>{let F=[],M=i(P=>{let A=P?.();typeof A=="function"&&F.push(A)},"start");return M(e.network?.startNetworkCapture),M(e.storage?.startBrowserStorageCapture),M(e.assets?.startBrowserAssetCapture),M(e.three?.startThreeCapture),hr(typeof He<"u"?He:process.env.NODE_ENV!=="production")&&M(e["time-machine"]?.startTimeMachineFloatingToolPersistence),e.storage?.storageSyncAdapter?.subscribe&&M(()=>e.storage.storageSyncAdapter.subscribe(()=>{})),e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe&&M(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{})),()=>{for(let P of F.reverse())P()}},[e]);let x=e["external-sync"],h=hr(typeof He<"u"?He:process.env.NODE_ENV!=="production"),B=yr({isDevelopment:h,isLicensed:c,externalSync:r,isAvailable:!!x}),k=mo(r);ol({release:!h&&!!k?.enableInRelease}),!h&&k?.enableInRelease&&xo(ho(k.socketURL,k));let R=e.sentry?.SentryRoot;return xl(wl,{children:[Object.entries(e).flatMap(([F,M])=>Tl.map(P=>{let A=M[P];return A?Fe(A,{},`${F}:${P}`):null})),R&&Fe(R,{getClient:a}),Object.entries(e).flatMap(([F,M])=>Il.map(P=>{let A=M[P];return A&&(!n||P==="ScenariosOverlay"||P==="ImpersonateOverlay"||P==="BugLinksOverlay")?Fe(A,{},`${F}:${P}`):null})),B&&Fe(Kr,{module:x,tools:d,options:k,isPro:c,tier:u,dev:h})]})}i(wo,"ToolRuntime");var Ur=null;function xo(e){!e||e===Ur||(Ur=e,console.warn("[Buoy]",e))}i(xo,"warnOnce");function Kr({module:e,tools:t,options:o,isPro:r,tier:n,dev:a}){let s=Pr(),c=Ar(o,{appName:s.appName,hardwareName:s.hardwareName,platform:s.platform}),u=Mt(()=>Fr(o?.socketURL??(a?e.getDefaultSocketURL():br),!!o?.socketURL,s.platform),[o?.socketURL,a,e,s.platform]),{socket:d}=e.useExternalSyncSocket({deviceName:c?.deviceName??"Buoy Browser",socketURL:u,persistentDeviceId:s.ready?c?.deviceId??null:null,platform:s.platform,extraDeviceInfo:s.extraDeviceInfo,enableLogs:o?.enableLogs});Dt(()=>{let h=$r(u,s.platform);if(!d||!h)return;let B=i(()=>xo(h),"onError");return d.on("connect_error",B),()=>{d.off("connect_error",B)}},[d,u,s.platform]),Dt(()=>{if(!d)return;let h=i(()=>{if(!d.connected||!mr.hasAccountAccess())return;let B=mr.getState();!r&&(B.isInitialized===false||B.isValidating===true)||d.emit("device-license",{isPro:r?"1":"0",tier:n})},"emit");return h(),d.on("connect",h),()=>{d.off("connect",h)}},[d,r,n]);let g=o?.releaseActions?.join(",")??"",x=Mt(()=>Sr(t,a,g?g.split(","):void 0),[t,a,g]);return e.useExternalSync({tools:x,socket:d,deviceId:s.ready?c?.deviceId??null:null,enableLogs:o?.enableLogs}),null}i(Kr,"BrowserExternalSync");import{useState as Vr}from"react";import{BuoyPortal as Cl}from"@buoy-gg/shared-ui/web/floating";import{useBuoySession as kl}from"@buoy-gg/license/web";import{Fragment as qr,jsx as Je,jsxs as Gr}from"react/jsx-runtime";var Jr="#20C997";function Yr(){let{status:e,signIn:t,signOut:o}=kl(),[r,n]=Vr(false),[a,s]=Vr(null);if(typeof document>"u")return null;let c=i(()=>{s(null),n(true),t().catch(d=>s(d instanceof Error?d.message:"Sign-in did not work. Try again.")).finally(()=>n(false))},"start"),u=e.state==="active";return Je(Cl,{children: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:u||a?"12px 14px":0,borderRadius:16,background:u||a?"#0f1419":"transparent",color:"#e6edf3",boxShadow:u||a?"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:u?Gr(qr,{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:zl,"data-testid":"buoy-signout",children:"Sign out"})]}):Gr(qr,{children:[a?Je("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:a}):null,Je("button",{type:"button",onClick:c,disabled:r,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:Jr,color:"#04130d",fontWeight:600,fontSize:14,cursor:r?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:r?"Signing in\u2026":"Sign in to Buoy"})]})})})}i(Yr,"BuoySignIn");var zl={marginTop:8,padding:0,border:"none",background:"none",color:Jr,fontSize:14,cursor:"pointer",textDecoration:"underline"};import{LicenseManager as cd}from"@buoy-gg/license/web";var Al=false;function Xr(){if(!Al){try{let e=process.env.EXPO_PUBLIC_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}}i(Xr,"defaultLicenseKey");import{useState as Bl}from"react";import{AccountSetupButton as Rl,BuoyNeedsPlanCard as Dl,BuoySignInCard as Ml,useSignInState as Ol}from"@buoy-gg/shared-ui/web";import{jsx as lt,jsxs as Qr}from"react/jsx-runtime";function To({needsPlan:e=false}){let[t,o]=Bl(false),r=Ol();return Qr(H,{pointerEvents:"box-none",style:Zr.root,children:[lt(Rl,{expanded:t,onPress:()=>o(true)}),t?lt(yi,{visible:true,transparent:true,animationType:"fade",onRequestClose:()=>o(false),children:Qr(H,{style:Zr.overlay,accessibilityViewIsModal:true,children:[lt(hi,{style:dt.absoluteFill,onPress:()=>o(false),accessible:false}),e&&r==="active"?lt(Dl,{onClose:()=>o(false)}):lt(Ml,{onClose:()=>o(false)})]})}):null]})}i(To,"BuoySignIn");var Zr=dt.create({root:{position:"absolute",bottom:30,right:16,zIndex:99999},overlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.65)",alignItems:"center",justifyContent:"center",padding:20}});function Io(e){if(e.length>6){let t=e.map(o=>`"${o}"`).join(", ");return e.slice(0,6)}return e}i(Io,"validateDialConfig");import{installedTools as Pl,installedToolsFound as El}from"@buoy-gg/core/web/installed-tools";import{Fragment as Co,jsx as $,jsxs as ct}from"react/jsx-runtime";var ei={},ti="@react_buoy_floating_menu_tooltip_shown",Ll=Oe;function oi({size:e=14,color:t="#20C997"}){let o=Math.max(2,e/4),r=Math.max(1,e/16);return $("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:r,width:e,height:e,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((n,a)=>$("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:t}},a))})}i(oi,"MenuLauncherIcon");function ni(e){let{defaultFloatingTools:t,defaultDialTools:o,disableHints:r=false,children:n}=e,a=me(()=>o&&Io(o),[o]);return $(Xt,{defaultFloatingTools:t,defaultDialTools:a,children:$(Bi,{disableHints:r,children:ct(io,{children:[$(Yn,{children:$(ci,{...e})}),n]})})})}i(ni,"AdmittedFloatingDevTools");var Fl=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function ri({modules:e=ei}){return $(Co,{children:Object.entries(e).flatMap(([t,o])=>Fl.map(r=>{let n=o[r];return n?$(n,{},`${t}:${r}`):null}))})}i(ri,"StartupCapture");function ii(){let{openApps:e,restore:t}=at();return G(()=>Mo(o=>{let r=e.find(n=>n.id===o);return r?(t(r.instanceId),true):false}),[e,t]),null}i(ii,"WebToolOpenerBridge");function ai(){let e=zi();return Ri((e===null?process.env.NODE_ENV:e?"development":"production")??"dev")}i(ai,"defaultEnvironment");function si(e,t,o,r){let n=i(g=>Object.entries(e).find(([x])=>x.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===g)?.[1],"find"),a=[],s=n("env");t?.length&&s?.createEnvTool&&s.createEnvVarConfig&&a.push(Ge(s.createEnvTool({requiredEnvVars:s.createEnvVarConfig(t)})));let c=n("storage");o?.length&&c?.createStorageTool&&a.push(Ge(c.createStorageTool({requiredStorageKeys:o})));let u=n("ask-buoy"),d=r==="hosted"?u?.hostedAskBuoy?.():r;return d&&u?.createAskBuoyTool&&a.push(Ge(u.createAskBuoyTool(d))),a}i(si,"configOverrides");function li(e){if(e.launchMode!=="toggle-only")return;let t=e.isOn;return typeof t=="function"?t():void 0}i(li,"toggleIsOn");function ci({environment:e,userRole:t="admin",availableEnvironments:o,onEnvironmentSwitch:r,apps:n,modules:a=ei,externalSync:s,requiredEnvVars:c,sentryGetClient:u,disableHints:d=false,headless:g=false,hidden:x=false,defaultFloatingTools:h,defaultDialTools:B,zustandStores:k,requiredStorageKeys:R,askBuoy:F}){let M=e??ai(),P=me(()=>B?Io(B):void 0,[B]),[A,V]=pt(false),[S,D]=pt(false),[,_]=pt(0);G(()=>Js.subscribe(()=>_(l=>l+1)),[]);let T=Oo(false),E=at(),Q=me(()=>si(a,c,R,F),[a,c,R,F]),{allowedTools:Z}=Bo(),U=me(()=>Fi(Ft([...go(a),...n??[],...Q]),Z),[n,a,Q,Z]),{openApps:q,close:ie}=E;G(()=>{if(Z)for(let l of q)$i(l.id,Z)||ie(l.instanceId)},[q,Z,ie]);let ee=me(()=>Object.entries(a).find(([l])=>l.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[a]);G(()=>{if(!k||typeof ee?.watchStores!="function")return;let l=ee.watchStores(k);return typeof l=="function"?l:void 0},[k,ee]);let ne=it(),xe=E.openApps.some(l=>!l.minimized);G(()=>{ne.setDialOpen(A)},[A,ne.setDialOpen]),G(()=>{ne.setToolOpen(xe||S)},[xe,S,ne.setToolOpen]);let{registerApps:ge}=E;G(()=>{ge(U.map(l=>{let v=l.icon;return{...l,icon:typeof v=="function"?({size:C})=>v(C):v}}))},[ge,U]);let ye=me(()=>U.map(l=>({id:l.id,name:l.name,description:l.description,slot:l.slot})),[U]);Mi({availableTools:ye,storage:Ll}),G(()=>{let l=false;return i(async()=>{let[v,C]=await Promise.all([Oe.getItem(gt.dial.isOpen()),Oe.getItem(gt.settings.modalOpen())]);l||(v==="true"&&V(true),C==="true"&&(V(true),D(true)),T.current=true)},"restore")(),()=>{l=true}},[]),G(()=>{T.current&&Oe.setItem(gt.dial.isOpen(),A?"true":"false")},[A]),G(()=>{T.current&&Oe.setItem(gt.settings.modalOpen(),S?"true":"false")},[S]);let W=We(l=>{if(mn(l.id),l.launchMode==="toggle-only"){l.onPress?.(),_(v=>v+1);return}if(l.component){let v=typeof l.icon=="function"?l.icon(20):l.icon;E.open({id:l.id,title:l.name||ft(l.id),component:l.component,props:l.props,modal:l.modal,launchMode:l.launchMode||"self-modal",singleton:l.singleton??true,icon:v,color:l.color||Po(l.id)})}else l.onPress?.()},[E]),Te=Oo({tools:U,openApps:E.openApps,openTool:W});Te.current={tools:U,openApps:E.openApps,openTool:W},G(()=>Mo(l=>{let{tools:v,openApps:C,openTool:J}=Te.current;if(C.some(f=>f.id===l))return false;let Y=v.find(f=>f.id===l);return!Y||Y.launchMode==="toggle-only"?false:(J(Y),true)}),[]);let be=me(()=>mt(U,"dial").map(l=>{let v=l.color||Po(l.id),C;return typeof l.icon=="string"?C=l.icon:typeof l.icon=="function"?C=l.icon(32):C=null,{id:l.id,name:l.name||ft(l.id),icon:C,unavailable:!l.component&&!l.onPress,color:v,onPress:i(()=>{W(l),V(false)},"onPress")}}),[U,W]),Be=me(()=>{if(!A)return be;let l=new Map(be.map(v=>[v.id,v]));return gn(be.map(v=>v.id)).map(v=>l.get(v)).filter(v=>!!v)},[A,be]),{settings:Ie}=Dn(),pe=me(()=>mt(U,"row").filter(l=>(Ie.floatingTools[l.id]??false)===true&&(l.component||l.onPress)),[U,Ie.floatingTools]),oe=me(()=>U.map(l=>({id:l.id,name:l.name||ft(l.id),description:l.description||Oi(l.id),slot:l.slot,icon:l.icon,color:l.color})),[U]),[Re,fe]=pt(false),Ce=E.openApps.some(l=>!l.minimized);G(()=>{if(d)return;let l=false,v=setTimeout(async()=>{let C=await Oe.getItem(ti);!l&&!C&&fe(true)},1e3);return()=>{l=true,clearTimeout(v)}},[d]);let ae=We(()=>{fe(false),Oe.setItem(ti,"true")},[]),ve=We(()=>{ae(),V(true)},[ae]),Ye=We(()=>{V(false),D(false)},[]),$e=We(()=>{D(l=>!l)},[]),ke=We(()=>D(false),[]),De=!!(o?.length&&r),je=Ie.floatingTools.environment!==false,se=Re&&!A&&!Ce&&!x;G(()=>{if(!se)return;let l=i(C=>{(!(C.target instanceof Element)||!C.target.closest("[data-buoy-root]"))&&ae()},"onPointerDown"),v=i(C=>{C.key==="Escape"&&ae()},"onKeyDown");return document.addEventListener("pointerdown",l,true),document.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",l,true),document.removeEventListener("keydown",v)}},[se,ae]);let O=E.openApps.some(l=>l.minimized&&l.launchMode!=="toggle-only"),w=$(Wr,{modules:a,apps:n,requiredEnvVars:c,externalSync:s,headless:g,sentryGetClient:u});return g?w:ct("div",{"data-buoy-root":"",style:{display:"contents"},children:[w,$(ii,{}),se&&$("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),$("div",{style:x?{visibility:"hidden"}:{display:"contents"},"aria-hidden":x||void 0,children:ct(Fo,{enablePositionPersistence:!se,pushToSide:A||Ce,suspendPointerEvents:A,centerOnboarding:se,minimizedStack:O?$(fr,{}):void 0,hasMinimizedStack:O,children:[M&&je&&!De&&$(Pi,{environment:M}),De&&je&&$(Ei,{currentEnvironment:M??"local",availableEnvironments:o,onSelect:r}),t?$($o,{userRole:t,onPress:ve}):$("button",{"aria-label":"Open dev tools",onClick:ve,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:$(oi,{})}),pe.map(l=>$("button",{"aria-label":l.name||ft(l.id),"aria-pressed":li(l),title:l.description,onClick:()=>W(l),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof l.icon=="function"?l.icon(16):l.icon},l.id))]})}),se&&$(Nt,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:ae}),A&&!x&&$(Kt,{icons:Be,onClose:Ye,centerLabel:"BUOY",onCenterPress:$e,settingsOpen:S,hintsDisabled:d,emptyNote:Z&&Be.length===0?ji:void 0}),S&&!x&&$(oo,{visible:true,onClose:ke,availableTools:oe,defaultFloatingTools:h,defaultDialTools:P,onSettingsChange:l=>{}}),!x&&ct(Co,{children:[$(Xn,{}),$(xi,{})]})]})}i(ci,"FloatingDevToolsInner");function di(e){let t=e&&typeof e=="object"?e.appId:void 0,o=!!e;G(()=>{if(!o)return;let r=false,n=Ti.SessionManager;if(!n)return;let a=i(s=>{r||!s||(n.configure({audience:`app:${s}`}),n.load().catch(()=>{}))},"apply");return t?a(t):Do().then(s=>a(s?.bundleId)).catch(()=>{}),()=>{r=true}},[o,t])}i(di,"useCapacitorSignInAudience");function ui(e){let t=e&&typeof e=="object"?e.appId:void 0;G(()=>{let o=false;return t?Lt(t):Ro()?Do().then(r=>{o||Lt(r?.bundleId)}).catch(()=>{}):typeof location<"u"&&location.origin&&location.origin!=="null"&&Lt(location.origin),()=>{o=true}},[t])}i(ui,"usePublishAppId");var pi=false;function fi(e){return e.modules?e:(!El&&!pi&&typeof console<"u"&&(pi=true,console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")),{...e,modules:Pl})}i(fi,"withInstalledTools");function gi(e){return $(wi,{children:$(mi,{...fi(e)})})}i(gi,"FloatingDevTools");function mi(e){let{access:t,isPro:o,licenseKey:r}=Bo();G(()=>{Ii.configure(e.licenseKey??Xr()??Si())},[e.licenseKey]);let n=e.licenseKey===void 0||Ci(e.licenseKey,r),a=ki(typeof He<"u"?He:process.env.NODE_ENV!=="production"),s=n&&t.status==="admitted";G(()=>{s&&Di()},[s]),G(()=>{a||t.status==="initializing"||(o&&s?bi():vi())},[a,o,s,t.status]);let c=Ro();return di(c?e.signIn:void 0),ui(e.signIn),!a&&!o?!e.signIn||e.headless?null:c?$(To,{needsPlan:true}):$(Yr,{}):s?$(ni,{...e}):ct(Co,{children:[t.status==="initializing"&&$(ri,{modules:e.modules}),e.headless?null:e.signIn&&c?$(To,{}):$(Ai,{})]})}i(mi,"FloatingDevToolsContent");export{Li as a,Eo as b,Ft as c,mt as d,Lo as e,Fo as f,Ni as g,$o as h,rn as i,Kt as j,oo as k,ro as l,Nn as m,io as n,it as o,Yn as p,at as q,Xn as r,Ge as s,go as t,Hr as u,gi as v};
package/lib/web/index.mjs CHANGED
@@ -1 +1 @@
1
- "use client";import{a as m,b as d,c,d as p,e as C,f as g,g as y,h as f,i as S,j as T,k as v,l as h,m as b,n as D,o as B,p as P,q as k,r as w,s as E,t as H,u as M,v as i}from"./chunks/chunk-JXTHZBMM.mjs";import{$ as A,A as F,Aa as L,B as R,Ba as q,C as x,Ca as I,D as U,Da as W,E as j,Ea as J,F as K,Fa as O,G as V,Ga as G,H as X,Ha as z,I as N,Ia as Q,J as Z,Ja as Y,K as _,Ka as $,L as aa,La as sa,M as ea,Ma as oa,N as ta,Na as ra,O as la,Oa as ia,P as na,Pa as ua,Q as ma,R as da,S as ca,T as pa,U as Ca,V as ga,W as ya,X as fa,Y as Sa,Z as Ta,_ as va,a as ha,aa as ba,b as Da,ba as Ba,c as Pa,ca as ka,d as wa,da as Ea,e as Ha,ea as Ma,f as Aa,fa as Fa,g as La,ga as Ra,h as qa,ha as xa,i as Ia,ia as Ua,j as Wa,ja,k as Ja,ka as Ka,l as Oa,la as Va,m as Ga,ma as Xa,n as za,na as Na,o as Qa,oa as Za,p as Ya,pa as _a,q as $a,qa as as,r as ss,ra as es,s as os,sa as ts,t as rs,ta as ls,u as is,ua as ns,v as us,va as ms,w as ds,wa as cs,x as ps,xa as Cs,y as gs,ya as ys,z as fs,za as Ss}from"./chunks/chunk-V4BVRDHL.mjs";import"./chunks/chunk-C6HZO5XT.mjs";import{c as Ts}from"./chunks/chunk-D2FYORGY.mjs";import{a as vs}from"./chunks/chunk-LOPXJLVB.mjs";import{useSettings as hs,useFloatingTools as bs,getToolLabel as Ds,getToolDescription as Bs,getToolColor as Ps,settingsColors as ks,settingsStyles as ws,dialColors as Es,dialStyles as Hs}from"@buoy-gg/floating-tools-react/web";import{LicenseManager as Ms}from"@buoy-gg/license/web";import{createRoot as As}from"react-dom/client";import{createElement as Fs}from"react";import{installedTools as Ls}from"@buoy-gg/core/web/installed-tools";import{jsx as Rs}from"react/jsx-runtime";function n({queryClient:s,...e}={}){let o=Object.values(e.modules??Ls).find(u=>u.QueryClientProvider)?.QueryClientProvider;if(s&&!o)throw new Error("Add the react-query tool to modules to use queryClient.");let a=document.createElement("div");a.dataset.buoyMount="",document.body.appendChild(a);let t=As(a),r=Rs(i,{...e});t.render(s?Fs(o,{client:s},r):r);let l=true;return()=>{l&&(l=false,t.unmount(),a.remove())}}vs(n,"mountBuoy");export{X as Activity,as as AlertCircle,N as AlertTriangle,P as AppHostProvider,w as AppOverlay,wa as Badge,es as BarChart3,is as BaseEventStore,ts as Bookmark,Z as Bug,Ia as Button,Ga as Card,_ as Check,aa as CheckCircle,$ as CheckSquare,ea as ChevronDown,ta as ChevronLeft,la as ChevronRight,na as ChevronUp,ma as Clock,ls as Cloud,Qa as CollapsibleSection,da as Copy,Wa as CopyButton,rs as DataViewer,ca as Database,D as DevToolsVisibilityProvider,T as DialMenu,La as DiffViewer,y as Divider,ns as Download,ms as Edit3,$a as EmptyState,os as EventStepperFooter,pa as Eye,Ca as EyeOff,ga as FileJson,ya as FileText,fa as Filter,Sa as FlaskConical,i as FloatingDevTools,g as FloatingTools,cs as GitBranch,Ta as Globe,Cs as HardDrive,va as Hash,ys as HelpCircle,Ss as Home,L as Image,A as Info,Aa as InfoRow,V as JsModal,ba as Key,Ba as Layers,Ms as LicenseManager,q as Link,ka as Lock,I as Maximize2,W as Minus,J as Palette,Ea as Pause,O as Pin,Ma as Play,Fa as Plus,Ra as Power,Ja as PowerToggle,xa as RefreshCw,us as RelativeTime,G as Route,Oa as Row,Ua as Search,ss as SearchBar,za as SectionHeader,z as Server,ja as Settings,v as SettingsModal,Ka as Shield,Q as Smartphone,Y as Square,Ha as StatusDot,Ya as TabSelector,sa as Timer,Va as Trash2,oa as Unlock,ra as Upload,Xa as User,f as UserStatus,ia as Users,Na as Wifi,Za as X,ua as XCircle,_a as Zap,M as appSyncAdapter,d as autoDiscoverWebPresets,c as autoDiscoverWithCustom,Ts as clearReleaseOptIn,K as copyToClipboard,E as createWebTool,H as createWebTools,m as defaultToolPresets,U as devToolsStorageKeys,Es as dialColors,Hs as dialStyles,ds as formatBytes,ps as formatDuration,gs as formatNumber,C as getEnabledTools,Ps as getToolColor,Bs as getToolDescription,Ds as getToolLabel,p as getToolsBySlot,S as isBuoyHoldingBackButton,Da as methodColor,n as mountBuoy,x as persistentStorage,F as safeStringify,ks as settingsColors,ws as settingsStyles,ha as statusColor,qa as toolTheme,fs as truncateMiddle,Pa as typeColor,k as useAppHost,B as useDevToolsVisibility,bs as useFloatingTools,R as usePersistedState,j as useSafeAreaInsets,hs as useSettings,b as useToolHeader,h as useToolHost};
1
+ "use client";import{a as m,b as d,c as p,d as c,e as C,f as g,g as y,h as f,i as S,j as T,k as v,l as h,m as b,n as D,o as B,p as P,q as k,r as w,s as E,t as H,u as M,v as i}from"./chunks/chunk-5PL4HAS6.mjs";import{$ as A,A as F,Aa as L,B as R,Ba as q,C as x,Ca as I,D as U,Da as W,E as j,Ea as J,F as K,Fa as O,G as V,Ga as G,H as X,Ha as z,I as N,Ia as Q,J as Z,Ja as Y,K as _,Ka as $,L as aa,La as sa,M as ea,Ma as oa,N as ta,Na as ra,O as la,Oa as ia,P as na,Pa as ua,Q as ma,R as da,S as pa,T as ca,U as Ca,V as ga,W as ya,X as fa,Y as Sa,Z as Ta,_ as va,a as ha,aa as ba,b as Da,ba as Ba,c as Pa,ca as ka,d as wa,da as Ea,e as Ha,ea as Ma,f as Aa,fa as Fa,g as La,ga as Ra,h as qa,ha as xa,i as Ia,ia as Ua,j as Wa,ja,k as Ja,ka as Ka,l as Oa,la as Va,m as Ga,ma as Xa,n as za,na as Na,o as Qa,oa as Za,p as Ya,pa as _a,q as $a,qa as as,r as ss,ra as es,s as os,sa as ts,t as rs,ta as ls,u as is,ua as ns,v as us,va as ms,w as ds,wa as ps,x as cs,xa as Cs,y as gs,ya as ys,z as fs,za as Ss}from"./chunks/chunk-V4BVRDHL.mjs";import"./chunks/chunk-C6HZO5XT.mjs";import{c as Ts}from"./chunks/chunk-D2FYORGY.mjs";import"./chunks/chunk-74RBGVOS.mjs";import{a as vs}from"./chunks/chunk-LOPXJLVB.mjs";import{useSettings as hs,useFloatingTools as bs,getToolLabel as Ds,getToolDescription as Bs,getToolColor as Ps,settingsColors as ks,settingsStyles as ws,dialColors as Es,dialStyles as Hs}from"@buoy-gg/floating-tools-react/web";import{LicenseManager as Ms}from"@buoy-gg/license/web";import{createRoot as As}from"react-dom/client";import{createElement as Fs}from"react";import{installedTools as Ls}from"@buoy-gg/core/web/installed-tools";import{jsx as Rs}from"react/jsx-runtime";function n({queryClient:s,...e}={}){let o=Object.values(e.modules??Ls).find(u=>u.QueryClientProvider)?.QueryClientProvider;if(s&&!o)throw new Error("Add the react-query tool to modules to use queryClient.");let a=document.createElement("div");a.dataset.buoyMount="",document.body.appendChild(a);let t=As(a),r=Rs(i,{...e});t.render(s?Fs(o,{client:s},r):r);let l=true;return()=>{l&&(l=false,t.unmount(),a.remove())}}vs(n,"mountBuoy");export{X as Activity,as as AlertCircle,N as AlertTriangle,P as AppHostProvider,w as AppOverlay,wa as Badge,es as BarChart3,is as BaseEventStore,ts as Bookmark,Z as Bug,Ia as Button,Ga as Card,_ as Check,aa as CheckCircle,$ as CheckSquare,ea as ChevronDown,ta as ChevronLeft,la as ChevronRight,na as ChevronUp,ma as Clock,ls as Cloud,Qa as CollapsibleSection,da as Copy,Wa as CopyButton,rs as DataViewer,pa as Database,D as DevToolsVisibilityProvider,T as DialMenu,La as DiffViewer,y as Divider,ns as Download,ms as Edit3,$a as EmptyState,os as EventStepperFooter,ca as Eye,Ca as EyeOff,ga as FileJson,ya as FileText,fa as Filter,Sa as FlaskConical,i as FloatingDevTools,g as FloatingTools,ps as GitBranch,Ta as Globe,Cs as HardDrive,va as Hash,ys as HelpCircle,Ss as Home,L as Image,A as Info,Aa as InfoRow,V as JsModal,ba as Key,Ba as Layers,Ms as LicenseManager,q as Link,ka as Lock,I as Maximize2,W as Minus,J as Palette,Ea as Pause,O as Pin,Ma as Play,Fa as Plus,Ra as Power,Ja as PowerToggle,xa as RefreshCw,us as RelativeTime,G as Route,Oa as Row,Ua as Search,ss as SearchBar,za as SectionHeader,z as Server,ja as Settings,v as SettingsModal,Ka as Shield,Q as Smartphone,Y as Square,Ha as StatusDot,Ya as TabSelector,sa as Timer,Va as Trash2,oa as Unlock,ra as Upload,Xa as User,f as UserStatus,ia as Users,Na as Wifi,Za as X,ua as XCircle,_a as Zap,M as appSyncAdapter,d as autoDiscoverWebPresets,p as autoDiscoverWithCustom,Ts as clearReleaseOptIn,K as copyToClipboard,E as createWebTool,H as createWebTools,m as defaultToolPresets,U as devToolsStorageKeys,Es as dialColors,Hs as dialStyles,ds as formatBytes,cs as formatDuration,gs as formatNumber,C as getEnabledTools,Ps as getToolColor,Bs as getToolDescription,Ds as getToolLabel,c as getToolsBySlot,S as isBuoyHoldingBackButton,Da as methodColor,n as mountBuoy,x as persistentStorage,F as safeStringify,ks as settingsColors,ws as settingsStyles,ha as statusColor,qa as toolTheme,fs as truncateMiddle,Pa as typeColor,k as useAppHost,B as useDevToolsVisibility,bs as useFloatingTools,R as usePersistedState,j as useSafeAreaInsets,hs as useSettings,b as useToolHeader,h as useToolHost};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/core",
3
- "version": "7.0.79",
3
+ "version": "7.0.81",
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",
@@ -89,10 +89,10 @@
89
89
  ],
90
90
  "dependencies": {
91
91
  "react-devtools-core": "6.1.5",
92
- "@buoy-gg/floating-tools-core": "^7.0.79",
93
- "@buoy-gg/license": "^7.0.79",
94
- "@buoy-gg/shared-ui": "^7.0.79",
95
- "@buoy-gg/floating-tools-react": "^7.0.79"
92
+ "@buoy-gg/floating-tools-core": "^7.0.81",
93
+ "@buoy-gg/floating-tools-react": "^7.0.81",
94
+ "@buoy-gg/license": "^7.0.81",
95
+ "@buoy-gg/shared-ui": "^7.0.81"
96
96
  },
97
97
  "peerDependencies": {
98
98
  "react": "*"
@@ -1,10 +0,0 @@
1
- "use client";import{a as dt,b as H,c as K,d as De,e as ut,f as pi,g as Co,h as mi,i as Ll,j as ko,k as Ne}from"./chunk-C6HZO5XT.mjs";import{b as fi,c as gi}from"./chunk-D2FYORGY.mjs";import{a as i,b as zo,e as He}from"./chunk-LOPXJLVB.mjs";import{BuoyPortal as hi,FloatingToolHost as yi}from"@buoy-gg/shared-ui/web/floating";import*as bi from"@buoy-gg/license/web";import{LicenseManager as vi,useLicense as Ao,sameLicenseKey as Si,resolveDevBuild as wi,capacitorDebug as xi,isCapacitorNative as Ti,loadCapacitorAppHost as Ii}from"@buoy-gg/license/web";import{AccountSetup as Ci,HintsProvider as ki,normalizeEnvironment as zi,registerToolOpener as Bo,startSettingsSync as Ai}from"@buoy-gg/shared-ui/web";import{useState as pt,useMemo as ge,useCallback as We,useEffect as X,useRef as Ro}from"react";import{useSettings as Bi,getToolLabel as mt,getToolDescription as Ri,getToolColor as Mo}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Oe,devToolsStorageKeys as ft,EnvironmentIndicator as Mi,EnvironmentSelectorInline as Di}from"@buoy-gg/shared-ui/web";var Oi=[];function Do(){return[]}i(Do,"autoDiscoverWebPresets");function Lt(e=[]){return[...new Map(e.map(t=>[t.id,t])).values()]}i(Lt,"autoDiscoverWithCustom");function gt(e,t){return e.filter(o=>{let r=o.slot||"both";return r==="both"||r===t})}i(gt,"getToolsBySlot");function Oo(e,t){let o=t instanceof Set?t:new Set(t);return e.filter(r=>o.has(r.id))}i(Oo,"getEnabledTools");import{filterTeamTools as Ei,isTeamToolAllowed as Pi}from"@buoy-gg/floating-tools-core/web";var Li="No tools are on for your role. Ask your team admin.";import{FloatingTool as Eo,FloatingToolDivider as Fi,FloatingToolUserStatus as Po,getBubbleAnchorPosition as $i}from"@buoy-gg/shared-ui/web/floating";import{useState as te,useEffect as Ee,useMemo as ht,useRef as yt,useCallback as bt}from"react";var Lo={network:"Network",images:"Images","image-overlay":"Image Overlay",assets:"Assets",query:"React Query",storage:"Storage",env:"Env",console:"Console",events:"Events",redux:"Redux",zustand:"Zustand",jotai:"Jotai","route-events":"Routes","time-machine":"Time Machine",clock:"Clock",permissions:"Permissions","highlight-updates":"Highlight Updates","debug-borders":"Debug Borders","perf-monitor":"Bench HUD","js-top":"JS Top","js-top-modal":"JS Top",impersonate:"Impersonate","perf-monitor-modal":"Bench"};function Fo(e,t){return e&&Lo[e]?Lo[e]:t}i(Fo,"dialAccessibilityLabel");import{getDialLayout as ji,getAllIconPositions as Ni,getGridLineRotations as Hi,getIconStaggerInputRange as Wi,MAX_DIAL_SLOTS as Qe,DIAL_ICON_SIZE as _i,dialAnimationConfig as $o,getDialCSSKeyframesString as Ui,getDialCSSAnimationStyles as Ki,dialColors as j,dialStyles as I,withAlpha as jo,floatingToolsColors as Vi}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as No,monoFont as Ft,ToolBackground as qi,useToolBackground as Gi}from"@buoy-gg/shared-ui/web";import{memo as Ji}from"react";import{RasterLayer as Yi,scatter as Xi,useLoop as Qi,withBgAlpha as Zi}from"@buoy-gg/shared-ui/web";import{Fragment as ea,jsx as Ze}from"react/jsx-runtime";var ta=.94,oa=6,na=2400,vt=3,Ho=16,ra=Array.from({length:vt},(e,t)=>Xi(22343^t*40503,Ho*4)),Wo=["#FFFFFF","#B3D9FF","#8CB3FF"],_o=Math.PI/3,Uo=14*Math.PI/180;function Ko(e){let t=Math.min(5,Math.floor(e*6)),o=e*6-t;return t*_o+Uo/2+o*(_o-Uo)}i(Ko,"spokeClearAngle");function Vo(e){return Math.min(oa,1/(1-e*ta))}i(Vo,"scaleAt");function qo(e){let t=.15+.85*e*e;return e<.06?t*=e/.06:e>.94&&(t*=(1-e)/.06),Math.min(.7,t)}i(qo,"opacityAt");function Go(e){let t=e/vt,o=[],r=12;for(let u=0;u<=r;u++)o.push(u/r);let n=(1-t)%1;n>.001&&n<1-.001&&o.push(n-1e-4,n+1e-4),o.sort((u,d)=>u-d);let a=[],s=[],c=[];for(let u of o){let d=t===0&&u===1?1:(u+t)%1;a.push(u),s.push(Vo(d)),c.push(qo(d))}return{input:a,scale:s,opacity:c}}i(Go,"shellStops");var ia=Array.from({length:vt},(e,t)=>Go(t)),aa=Ji(i(function({size:e}){let t=Qi(na),o=e/2,r=[];for(let n=0;n<vt;n++){let a=ra[n],s=ia[n],c=[];for(let u=0;u<Ho;u++){let d=Ko(a[u*4]),f=(.15+.85*Math.sqrt(a[u*4+1]))*.5*o,x=Wo[Math.floor(a[u*4+3]*Wo.length)%3],h=o+Math.cos(d)*f,B=o+Math.sin(d)*f,k=.6,R=k*2.4;c.push(Ze(H,{style:{position:"absolute",left:h-R/2,top:B-R/2,width:R,height:R,borderRadius:R/2,backgroundColor:Zi(x,.3)}},`${u}-h`),Ze(H,{style:{position:"absolute",left:h-k/2,top:B-k/2,width:k,height:k,borderRadius:k/2,backgroundColor:x}},u))}r.push(Ze(De.View,{style:{position:"absolute",left:0,top:0,width:e,height:e,opacity:t.interpolate({inputRange:s.input,outputRange:s.opacity}),transform:[{scale:t.interpolate({inputRange:s.input,outputRange:s.scale})}]},pointerEvents:"none",children:Ze(Yi,{style:{width:e,height:e},raster:false,children:c})},n))}return Ze(ea,{children:r})},"DialHyperspace"));import{useEffect as sa,useState as Jo}from"react";import{dialColors as _e,withAlpha as Yo}from"@buoy-gg/floating-tools-react/web";import{ARROW_BOTTOM_OFFSET as la,ARROW_HEIGHT as ca,SPACING_GAP as oc,getScreenCenterY as nc,calculateTooltipPosition as da,calculateTargetPosition as rc}from"@buoy-gg/shared-ui/web/floating";import{monoFont as Xo}from"@buoy-gg/shared-ui/web";import{jsx as Ue,jsxs as Qo}from"react/jsx-runtime";var Zo=false;function en(){if(Zo||typeof document>"u")return;let e=document.createElement("style");e.textContent=`
2
- @keyframes buoyOnboardPulse {
3
- 0%, 100% { transform: scale(1); }
4
- 50% { transform: scale(1.02); }
5
- }
6
- @keyframes buoyOnboardArrowBounce {
7
- 0%, 100% { transform: translateY(0); }
8
- 50% { transform: translateY(-8px); }
9
- }
10
- `,document.head.appendChild(e),Zo=true}i(en,"injectOnboardingKeyframes");var $t=_e.accent;function jt({title:e,message:t,onDismiss:o,showArrow:r=true}){let[n,a]=Jo(false),[s,c]=Jo(false);sa(()=>{en();let d=requestAnimationFrame(()=>a(true));return()=>cancelAnimationFrame(d)},[]);let u={fontFamily:Xo,textTransform:"uppercase"};return Ue("div",{style:{position:"fixed",left:"50%",bottom:da(),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:Qo("div",{style:{position:"relative",animation:n?"buoyOnboardPulse 3s ease-in-out infinite":"none"},children:[Ue("div",{style:{position:"absolute",inset:-4,borderRadius:18,backgroundColor:"#FFFFFF",opacity:.06}}),Qo("div",{style:{position:"relative",maxWidth:280,backgroundColor:_e.dialBackground,borderRadius:16,border:`1px solid ${_e.dialBorder}`,padding:20,boxShadow:`0 0 20px ${Yo(_e.dialShadow,.6)}`,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[Ue("span",{style:{...u,fontSize:16,fontWeight:900,letterSpacing:1,color:$t,textAlign:"center"},children:e}),Ue("span",{style:{fontFamily:Xo,fontSize:13,lineHeight:"20px",color:_e.centerText,textAlign:"center"},children:t}),Ue("button",{onClick:o,onPointerDown:()=>c(true),onPointerUp:()=>c(false),onPointerLeave:()=>c(false),onPointerCancel:()=>c(false),style:{...u,marginTop:8,borderRadius:8,border:"none",backgroundColor:$t,padding:"10px 24px",fontSize:14,fontWeight:900,letterSpacing:1.5,color:"#000000",cursor:"pointer",opacity:s?.7:1,transform:s?"scale(0.96)":"scale(1)",transition:"transform 100ms ease, opacity 100ms ease"},children:"Got it!"})]}),r&&Ue("div",{style:{position:"absolute",left:"50%",bottom:la,marginLeft:-12,width:0,height:0,borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:`${ca}px solid ${$t}`,filter:`drop-shadow(0 0 10px ${Yo(_e.dialShadow,.5)})`,animation:n?"buoyOnboardArrowBounce 1.6s ease-in-out infinite":"none"}})]})})}i(jt,"OnboardingTooltip");import{useEffect as ua,useRef as pa}from"react";import{capacitorPlatform as ma,capacitorPlugin as fa}from"@buoy-gg/license/web";function tn(){return globalThis.__BUOY_HOLDS_BACK__===true}i(tn,"isBuoyHoldingBackButton");var ga=99.5,ha=99.6,St=0;function on(){if(typeof document>"u")return false;let e=globalThis.Ionic;if(!e&&!document.querySelector("ion-app"))return false;try{return e?.config?.get?.("hardwareBackButton",true)!==false}catch{return true}}i(on,"ionicHandlesBack");function Nt(e,t,o=ga){let r=pa(t);r.current=t,ua(()=>{if(!e||ma()!=="android")return;let n=globalThis;St+=1,n.__BUOY_HOLDS_BACK__=true;let a=i(()=>{St=Math.max(0,St-1),n.__BUOY_HOLDS_BACK__=St>0},"release"),s;if(on()){let c=i(u=>{u.detail?.register?.(o,()=>{r.current()})},"listener");document.addEventListener("ionBackButton",c),s=i(()=>document.removeEventListener("ionBackButton",c),"cleanup")}else{let c=fa("App");if(!c?.addListener){a();return}let u=false,d=null;Promise.resolve(c.addListener("backButton",()=>r.current())).then(f=>{u?f.remove():d=f}).catch(()=>{}),s=i(()=>{u=true,d&&d.remove()},"cleanup")}return()=>{s(),a()}},[e,o])}i(Nt,"useCapacitorBackButton");import{Fragment as ya,jsx as L,jsxs as we}from"react/jsx-runtime";var ba={x:.5,y:.5},nn="@react_buoy_settings_tooltip_shown",rn=false;function an(){if(rn||typeof document>"u")return;let e=document.createElement("style");e.textContent=Ui(),document.head.appendChild(e),rn=true}i(an,"injectKeyframes");var Ke=i(e=>1-Math.pow(1-e,3),"easeOutCubic"),Ht=i(e=>e*e*e,"easeInCubic");function sn({icon:e,index:t,totalIcons:o,position:r,progress:n,onPress:a}){let[s,c]=te(false),[u,d]=te(false),f=!e.icon&&e.id.startsWith("empty-"),x=!f&&e.unavailable===true,h=!f&&!x,{icons:B}=$o,k=Wi(t,o),R=0;n<=k[1]?R=0:n<=k[2]?R=(n-k[1])/(k[2]-k[1]):R=1,R=Math.max(0,Math.min(1,R));let F=_i,D=B.pressIn.scale,E=R*(u?D:s?1.1:1),A=0;R<=0?A=0:R<=.3?A=R:A=.3+(R-.3)*(.7/.7);let V=r.x*(R-1),S=r.y*(R-1);return L("button",{role:"menuitem","aria-label":f?"Empty slot":Fo(e.id,e.name),"data-testid":e.id?`buoy-dial-${e.id}`:void 0,"aria-disabled":!h,tabIndex:h?0:-1,onClick:h?a:void 0,onPointerEnter:M=>h&&M.pointerType==="mouse"&&c(true),onPointerLeave:()=>{c(false),d(false)},onPointerDown:()=>h&&d(true),onPointerUp:()=>d(false),onPointerCancel:()=>d(false),style:{position:"absolute",left:`calc(50% + ${r.x}px)`,top:`calc(50% + ${r.y}px)`,width:F,height:F,marginLeft:-F/2,marginTop:-F/2,cursor:h?"pointer":"default",background:"none",border:"none",padding:0},children:L("span",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",transform:`translate(${V}px, ${S}px) scale(${E})`,opacity:A,transition:s||u?"transform 100ms ease":"none"},children:f?L("div",{style:{width:I.emptySlot.dotSize,height:I.emptySlot.dotSize,borderRadius:I.emptySlot.dotSize/2,backgroundColor:j.emptyDotBackground,border:`${I.emptySlot.borderWidth}px solid ${j.emptyDotBorder}`}}):we(ya,{children:[L("div",{style:{position:"absolute",width:`${I.icon.gradientBgSizePercent}%`,height:`${I.icon.gradientBgSizePercent}%`,borderRadius:I.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:I.icon.gradientBgOpacity}}),L("div",{style:{position:"absolute",width:`${I.icon.innerGlowSizePercent}%`,height:`${I.icon.innerGlowSizePercent}%`,borderRadius:I.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:I.icon.innerGlowOpacity}}),L("div",{style:{marginBottom:I.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:s?"brightness(1.2)":"none"},children:e.icon}),L("span",{style:{fontSize:e.name.length>8?Math.max(I.icon.label.fontSize*.7,I.icon.label.fontSize*8/e.name.length):I.icon.label.fontSize,fontWeight:I.icon.label.fontWeight,fontFamily:I.icon.label.fontFamily,color:j.iconLabel,letterSpacing:I.icon.label.letterSpacing,marginTop:I.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:e.name}),x&&L("span",{style:{fontSize:I.icon.label.fontSize-1,fontWeight:I.icon.label.fontWeight,fontFamily:I.icon.label.fontFamily,letterSpacing:I.icon.label.letterSpacing,color:Vi.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})})}i(sn,"DialIconItem");function Wt({side:e,color:t}){return L("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,r,n,a],s)=>L("line",{x1:o,y1:r,x2:n,y2:a,stroke:t,strokeWidth:2},s))})}i(Wt,"PagerChevron");function _t({side:e,disabled:t,onClick:o}){let[r,n]=te(false),a=t?j.emptyDotBorder:j.accent;return we("button",{type:"button","aria-label":`${e==="prev"?"Previous":"Next"} dial page`,"data-testid":`buoy-dial-${e}`,disabled:t,onClick:o,onPointerDown:()=>!t&&n(true),onPointerUp:()=>n(false),onPointerLeave:()=>n(false),onPointerCancel:()=>n(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${j.dialBorder}`,backgroundColor:j.dialBackground,color:t?j.iconLabelMuted:j.centerText,fontSize:12,fontWeight:900,fontFamily:Ft,letterSpacing:1.5,textTransform:"uppercase",cursor:t?"default":"pointer",opacity:t?.4:1,boxShadow:t?"none":`0 0 8px ${jo(j.dialShadow,.4)}`,transform:r?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[e==="prev"&&L(Wt,{side:"prev",color:a}),e==="prev"?"PREV":"NEXT",e==="next"&&L(Wt,{side:"next",color:a})]})}i(_t,"PagerButton");function Ut({icons:e,onClose:t,centerLabel:o="MENU",onCenterPress:r,settingsOpen:n=false,hintsDisabled:a=false,emptyNote:s}){let{id:c}=Gi(),[u,d]=te(0),[f,x]=te(0),[h,B]=te(0),[k,R]=te(0),[F,D]=te(0),[E,A]=te(1),[V,S]=te(false),[M,_]=te(false),[T,P]=te(false),Q=yt(null),Z=yt(null),U=yt(null),q=yt(false),{entrance:ie,exit:ee,interaction:ne}=$o,xe=Ki(),[fe,ye]=te(()=>({width:window.innerWidth,height:window.innerHeight}));Ee(()=>{let O=i(()=>ye({width:window.innerWidth,height:window.innerHeight}),"resize");return window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);let W=ht(()=>ji({screenWidth:fe.width,maxCircleSize:Math.max(120,Math.min(320,fe.height-96))}),[fe]),Te=ht(()=>Hi(),[]),be=ht(()=>Ni(Qe,W.iconRadius),[W.iconRadius]),[Be,Ie]=te(0),pe=Math.max(1,Math.ceil(e.length/Qe)),oe=Math.min(Be,pe-1),Re=ht(()=>{let O=oe*Qe,w=[...e.slice(O,O+Qe)];for(;w.length<Qe;)w.push({id:`empty-${w.length}`,name:"",icon:null,onPress:i(()=>{},"onPress")});return w},[e,oe]);Ee(()=>{an()},[]),Ee(()=>{let O=ie.backdrop.duration,w=ie.dial.rotation.duration,l=ie.centerButton.delay,v=ie.icons.delay,C=ie.icons.duration,G=performance.now(),J=i(m=>{let g=m-G;d(Math.min(1,g/O));let z=Math.min(1,g/400),Y=Ke(z)*1.1;z>.7&&(Y-=(z-.7)*.33),z>=1&&(Y=1),x(Math.max(0,Math.min(1.05,Y)));let le=Math.min(1,g/w);if(B(Ke(le)*360),g>=l){let Se=Math.min(1,(g-l)/300),Pt=Ke(Se)*1.15;Se>.6&&(Pt-=(Se-.6)*.375),Se>=1&&(Pt=1),R(Math.max(0,Math.min(1.05,Pt)))}if(g>=v){let Se=Math.min(1,(g-v)/C);D(Ke(Se))}let Xe=v+C;g<Xe?U.current=requestAnimationFrame(J):(d(1),x(1),B(360),R(1),D(1),P(true))},"animate");return U.current=requestAnimationFrame(J),()=>{U.current&&cancelAnimationFrame(U.current)}},[]);let me=bt(()=>{if(q.current)return;q.current=true,_(true),U.current&&cancelAnimationFrame(U.current);let O=performance.now(),w=ee.icons.duration,l=ee.centerButton.duration,v=ee.dialScale.duration,C=Math.max(l,v),G=ee.backdrop.duration,J=i(m=>{let g=m-O;if(g<w){let le=Ht(g/w);D(1-le),U.current=requestAnimationFrame(J);return}let z=w;if(g<z+C){D(0);let le=Math.min(1,(g-z)/l),Xe=Math.min(1,(g-z)/v);R(1-Ht(le)),x(1-Ht(Xe)),U.current=requestAnimationFrame(J);return}let Y=z+C;if(g<Y+G){x(0),R(0);let le=(g-Y)/G;d(1-le),U.current=requestAnimationFrame(J);return}d(0),t()},"animate");U.current=requestAnimationFrame(J)},[ee,t]);Nt(true,()=>{q.current||(n?r?.():me())},ha),Ee(()=>{let O=document.activeElement,w=Q.current;return()=>{O?.isConnected&&(document.activeElement===document.body||w?.contains(document.activeElement))&&O.focus()}},[]),Ee(()=>{if(n)return;Z.current?.focus();let O=i(w=>{let l=Q.current;if(l){if(w.key==="Escape")w.preventDefault(),me();else if(w.key==="Tab"){let v=Array.from(l.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(J=>J.getClientRects().length>0),C=v[0],G=v[v.length-1];(!l.contains(document.activeElement)||(w.shiftKey?document.activeElement===C:document.activeElement===G))&&(w.preventDefault(),(w.shiftKey?G:C)?.focus())}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(w.key)){let v=Array.from(l.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),C=v.indexOf(document.activeElement);if(C<0||!v.length)return;w.preventDefault();let G=w.key==="Home"?0:w.key==="End"?v.length-1:(C+(w.key==="ArrowRight"||w.key==="ArrowDown"?1:-1)+v.length)%v.length;v[G].focus()}}},"handleKeyDown");return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[me,n]);let[Ce,ae]=te(false);Ee(()=>{if(a)return;let O=false,w=setTimeout(async()=>{let l=await No.getItem(nn);!O&&!l&&ae(true)},1200);return()=>{O=true,clearTimeout(w)}},[a]);let ve=bt(()=>{ae(false),No.setItem(nn,"true")},[]);Ee(()=>{n&&Ce&&ve()},[n,Ce,ve]);let Ye=bt(O=>{if(O.id.startsWith("empty-")||q.current)return;let[w,l]=ne.iconSelect.pulse,v=performance.now(),C=150,G=i(J=>{let m=J-v;if(m<C){let g=Ke(m/C);A(1-(1-w.scale)*g),requestAnimationFrame(G)}else if(m<C*2){let g=Ke((m-C)/C);A(w.scale+(l.scale-w.scale)*g),requestAnimationFrame(G)}else A(1)},"animatePulse");requestAnimationFrame(G),setTimeout(()=>{O.onPress(),me()},ne.iconSelect.actionDelay)},[ne.iconSelect,me]),$e=bt(O=>{if(q.current)return;let w=Math.max(0,Math.min(O,pe-1));w!==oe&&Ie(w)},[pe,oe]),ke=W.buttonSize*I.centerButton.containerRatio,Me=W.buttonSize*I.centerButton.borderRatio,je=W.buttonSize*I.centerButton.containerRatio/2+6,se=T&&!M;return we("div",{ref:Q,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[L("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:me,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:j.dialBackdrop,opacity:u}}),s?L("div",{role:"status","data-testid":"buoy-dial-empty-note",style:{position:"absolute",left:16,right:16,bottom:80+W.circleSize+16,color:j.iconLabel,fontSize:12,fontFamily:Ft,textAlign:"center",opacity:f>.01?1:0},children:s}):null,we("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,bottom:80,width:W.circleSize,height:W.circleSize,borderRadius:"50%",backgroundColor:j.dialBackground,border:`${I.circle.borderWidth}px solid ${j.dialBorder}`,boxShadow:`0 0 ${I.circle.shadowRadius}px ${jo(j.dialShadow,I.circle.shadowOpacity)}`,transform:`scale(${f}) rotate(${h}deg)`,opacity:f>.01?1:0,overflow:"hidden"},children:[L("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:j.dialGradient1,opacity:I.gradientLayers[0].opacity}}),L("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:j.dialGradient2,opacity:I.gradientLayers[1].opacity}}),L("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:j.dialGradient3,opacity:I.gradientLayers[2].opacity}}),Te.map(O=>L("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:I.grid.lineHeight,transform:`rotate(${O}deg)`,transformOrigin:"center"},children:["left","right"].map(w=>L("div",{style:{position:"absolute",top:0,[w]:0,width:`calc(50% - ${je}px)`,height:I.grid.lineHeight,backgroundColor:j.dialGridLine}},w))},O)),L("div",{"data-testid":"dial-background","data-background":c,style:{position:"absolute",inset:0,pointerEvents:"none"},children:c==="hyperspace"?L(aa,{size:W.circleSize}):L(qi,{focus:ba})}),Re.map((O,w)=>L(sn,{icon:O,index:w,totalIcons:Re.length,position:be[w],progress:F,onPress:()=>Ye(O)},w)),we("div",{style:{position:"absolute",left:"50%",top:"50%",width:ke,height:ke,marginLeft:-ke/2,marginTop:-ke/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:j.hubHalo,borderRadius:W.buttonSize,overflow:"hidden",transform:`scale(${k*E})`,opacity:k>.01?1:0},children:[L("div",{style:{position:"absolute",inset:0,backgroundColor:j.dialGradient1,opacity:.5,borderRadius:W.buttonSize}}),L("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:j.dialGradient2,opacity:.3,borderRadius:W.buttonSize}}),L("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:j.dialGradient3,opacity:.2,borderRadius:W.buttonSize}}),L("div",{style:{width:Me,height:Me,borderRadius:W.buttonSize*I.centerButton.borderRadiusRatio,backgroundColor:j.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:L("button",{ref:Z,type:"button","aria-label":n?"Close Settings":"Open Dev Tools Settings",disabled:!r,onClick:r,onPointerEnter:O=>O.pointerType==="mouse"&&S(true),onPointerLeave:()=>S(false),style:{border:0,padding:0,background:"transparent",width:W.buttonSize,height:W.buttonSize,borderRadius:W.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:r?"pointer":"default",transform:V?`scale(${ne.centerHover.scale})`:"scale(1)",transition:`transform ${ne.centerHover.duration}ms ease`,animation:se&&!V?xe.pulse:"none"},children:n?we("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:I.centerButton.text.fontSize-2,fontWeight:I.centerButton.text.fontWeight,fontFamily:I.centerButton.text.fontFamily,color:j.centerText,letterSpacing:I.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[L("span",{style:{marginBottom:-2},children:"CLOSE"}),L("span",{style:{marginTop:-2},children:"SETTINGS"})]}):L("span",{style:{fontSize:I.centerButton.text.fontSize,fontWeight:I.centerButton.text.fontWeight,fontFamily:I.centerButton.text.fontFamily,color:j.centerText,letterSpacing:I.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase"},children:o})})})]})]}),pe>1&&we("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,top:"calc(100% - 64px)",width:W.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,f),transform:`scale(${Math.min(1,f)})`},children:[L(_t,{side:"prev",disabled:oe<=0,onClick:()=>$e(oe-1)}),we("span",{"data-testid":"buoy-dial-page",style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:Ft,letterSpacing:2,color:j.centerText,textShadow:`0 0 6px ${j.centerTextGlow}`},children:[String(oe+1).padStart(2,"0"),we("span",{style:{color:j.iconLabelMuted,textShadow:"none"},children:[" / ",String(pe).padStart(2,"0")]})]}),L(_t,{side:"next",disabled:oe>=pe-1,onClick:()=>$e(oe+1)})]}),Ce&&!n&&L(jt,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:ve,showArrow:false})]})}i(Ut,"DialMenu");import{persistentStorage as ln,devToolsStorageKeys as va}from"@buoy-gg/shared-ui/web";import{recordUsage as Sa,pruneUsage as wa}from"@buoy-gg/floating-tools-core/web";var cn=va.dial.usage(),Ve={},dn=false,Kt=null;function Vt(){return Kt||(Kt=(async()=>{try{let e=await ln.getItem(cn);if(e){let t=JSON.parse(e);t&&typeof t=="object"&&(Ve=t)}}catch{}finally{dn=true}})(),Kt)}i(Vt,"loadDialUsage");Vt();function un(e){return e.map((t,o)=>({id:t,index:o,lastUsed:Ve[t]?.lastUsed??0})).sort((t,o)=>o.lastUsed-t.lastUsed||t.index-o.index).map(({id:t})=>t)}i(un,"getRankedToolIds");async function pn(e){if(!e)return;dn||await Vt();let t=Math.max(Date.now(),...Object.values(Ve).map(o=>o.lastUsed+1));Ve=wa(Sa(Ve,e,t),t);try{await ln.setItem(cn,JSON.stringify(Ve))}catch{}}i(pn,"recordToolUsage");import{useCallback as xa,useMemo as mn}from"react";import{persistentStorage as Ta}from"@buoy-gg/shared-ui/web";import{useState as re,useEffect as ze,useCallback as wt,useMemo as xt}from"react";import{settingsEventBus as Tt}from"@buoy-gg/floating-tools-core/web";import{useSyncExternalStore as Ia}from"react";import{getRegisteredToolModule as Ca}from"@buoy-gg/shared-ui/web";var ka=i(()=>()=>{},"noopSubscribe"),za=i(()=>null,"serverSnapshot");function fn(){let e=Ca("@buoy-gg/external-sync");return Ia(e?.subscribeSyncStatus??ka,()=>e?.getSyncStatus?.()??null,za)}i(fn,"useDesktopSyncStatus");import{SentryIcon as Aa,WifiCircuitIcon as Ba,ImageOverlayIcon as Ra,RenderCountIcon as Ma,Info as qt,Layers as Da,ChevronRightIcon as gn,ChevronDown as hn,getStorageBackendType as Oa,getUseLicense as Ea,signOutOfBuoy as Pa,persistentStorage as Pe,Trash2 as La,CheckCircle2 as yn,BuoyUpgradeSheet as Fa,BackgroundSwitcher as $a,night as b,NightCard as Le,NightRows as Gt,NightSectionLabel as ja,NightFootnote as bn,NightSwitch as vn,NightButton as Jt,NightSegmented as Na,NightBadge as he,NightSeparator as Ha,monoFont as Sn}from"@buoy-gg/shared-ui/web";import{EnvIcon as wn,StorageIcon as Wa,RoutesIcon as _a,NetworkIcon as Ua,QueryIcon as Ka,HighlighterIcon as Va,ReduxIcon as qa,EventsIcon as Ga}from"@buoy-gg/floating-tools-core/web";import Ja,{createContext as Ya,useContext as Xa}from"react";import{jsx as Qa}from"react/jsx-runtime";var xn=Ya({});function Yt({children:e,defaultFloatingTools:t,defaultDialTools:o}){let r=Ja.useMemo(()=>({defaultFloatingTools:t,defaultDialTools:o}),[t,o]);return Qa(xn.Provider,{value:r,children:e})}i(Yt,"DefaultConfigProvider");function Xt(){return Xa(xn)}i(Xt,"useDefaultConfig");import Za from"react";import{toolTheme as es}from"@buoy-gg/shared-ui/web";import{jsx as Tn}from"react/jsx-runtime";function In({label:e,size:t,color:o=es.colors.text}){let r=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1),n=r<=2?t:t*1.6,a=Math.max(7,Math.min(t*(r===1?.7:.62),n/(.62*r)));return Tn("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:a,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}i(In,"AppTextIcon");function Qt(e,t){return e==null?e:typeof e=="function"?Za.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions}):typeof e=="string"||typeof e=="number"?Tn(In,{label:String(e),size:t.size,color:t.color}):e}i(Qt,"renderAppIcon");import{JsModal as ts,devToolsStorageKeys as Zt,onSettingsApplied as os,expandableWindowControlsSupported as ns}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as rs}from"@buoy-gg/shared-ui/web";import{Fragment as et,jsx as p,jsxs as N}from"react/jsx-runtime";var qe="@react_buoy_dev_tools_settings",is=6,It=i(e=>{let t=is,o={};for(let[r,n]of Object.entries(e))n&&t>0?(o[r]=true,t-=1):o[r]=false;return o},"enforceDialLimit"),as=i((e,t)=>{let{userStatus:o,environment:r,...n}=e,a=t?Object.entries(n).filter(([s])=>t.includes(s)):Object.entries(n);return{...Object.fromEntries(a),environment:r??false}},"sanitizeFloating"),Cn=i((e,t,o)=>{if(!t)return e;let r={...e.dialTools,...t.dialTools??{}},n=o?.allowedDialKeys?Object.entries(r).filter(([a])=>o.allowedDialKeys?.includes(a)):Object.entries(r);return{dialTools:It(Object.fromEntries(n)),floatingTools:as({...e.floatingTools,...t.floatingTools??{}},o?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...t.globalSettings??{}}}},"mergeWithDefaults"),ss=i((e=[],t,o)=>{let r={},n={},a=new Set(t??[]),s=new Set(o??[]),c=!o||o.length===0;for(let u of e){let{id:d,slot:f="both"}=u;(f==="dial"||f==="both")&&(r[d]=c?true:s.has(d)),(f==="row"||f==="both")&&(n[d]=a.has(d))}return{dialTools:It(r),floatingTools:{...n,environment:a.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}},"generateDefaultSettings"),ls=i(({visible:e,onClose:t,onSettingsChange:o,initialSettings:r,availableApps:n=[],storage:a=Pe,zIndex:s})=>{let{defaultFloatingTools:c,defaultDialTools:u}=Xt(),d=xt(()=>ss(n,c,u),[n,c,u]),f=xt(()=>Object.keys(d.dialTools),[d]),x=xt(()=>Object.keys(d.floatingTools).filter(m=>m!=="environment"),[d]),[h,B]=re(r||tt||d),[k,R]=re(eo??"floating"),[F,D]=re(eo!==null),[E,A]=re(new Set),[V,S]=re(false),[M,_]=re(false);ze(()=>{let m=requestAnimationFrame(()=>_(true));return()=>cancelAnimationFrame(m)},[]);let T=fn();ze(()=>{i(async()=>{try{let m=await Pe.getItem(Zt.settings.activeTab());if(m&&["floating","settings","pro"].includes(m)){let g=m;eo=g,R(z=>z===g?z:g)}}catch{}finally{D(true)}},"loadActiveTab")()},[]),ze(()=>{F&&Pe.setItem(Zt.settings.activeTab(),k).catch(m=>{console.warn("[Buoy]","Failed to save settings active tab:",m)})},[k,F]);let P=Ea()?.(),Q=P?.isPro??false,Z=!Q&&P?.licenseKey?P.error:null,U=P?.errorKind==="transport",[q,ie]=re(kn),[ee,ne]=re(false),[xe,fe]=re(false),[ye,W]=re(false),[Te,be]=re([]),[Be,Ie]=re(false),pe=rs(),oe=ko.get("window").height,Re=ko.get("window").width,me=Math.floor(oe*.33),Ce=Math.min(Re-32,400),ae=wt(async()=>{try{let m=await a.getItem(qe);if(m){let g=JSON.parse(m),z=Cn(d,g,{allowedDialKeys:f,allowedFloatingKeys:x});tt=z,B(Y=>zn(Y,z)?Y:z);return}tt=d,B(g=>zn(g,d)?g:d)}catch(m){console.error("[Buoy]","Failed to load dev tools settings:",m),B(d)}},[d,f,x,a]);ze(()=>{ae()},[ae]),ze(()=>{Oa().then(m=>{kn=m,ie(g=>g===m?g:m)})},[]),ze(()=>{ye&&(Ie(true),Pe.getAllKeys().then(m=>{be(m.sort())}).catch(()=>{be([])}).finally(()=>{Ie(false)}))},[ye]);let ve=i(async m=>{try{let g=null;try{let Y=await a?.getItem(qe);g=Y?JSON.parse(Y):null}catch{}let z={...m,dialTools:{...g?.dialTools,...It(m.dialTools)},floatingTools:{...g?.floatingTools,...m.floatingTools}};await a.setItem(qe,JSON.stringify(z)),tt=z,B(z),o?.(z),Tt.emit(z)}catch(g){console.error("[Buoy]","Failed to save dev tools settings:",g)}},"saveSettings"),Ye=i(m=>{let g={...h,floatingTools:{...h.floatingTools,[m]:!h.floatingTools[m]}};ve(g)},"toggleFloatingTool"),$e=i(m=>{let g={...h,globalSettings:{...h.globalSettings,[m]:!h.globalSettings?.[m]}};ve(g)},"toggleGlobalSetting"),ke=i(async()=>{ne(true),fe(false);try{await Pe.clear(),fe(true),B(d),a!==Pe&&await a.setItem(qe,JSON.stringify(d)),o?.(d),Tt.emit(d),setTimeout(()=>fe(false),2e3)}catch(m){console.error("[Buoy]","Failed to clear storage:",m)}finally{ne(false)}},"handleClearStorage"),Me=wt(m=>{},[]),je=i(m=>{let g=n.find(z=>z.id===m);return g?.description?g.description:m==="environment"?"Environment badge.":""},"getToolDescription"),se=i(m=>m==="environment"?"Env Badge":n.find(g=>g.id===m)?.name??m.toUpperCase().replace(/_/g," "),"getToolLabel"),O=i(m=>{if(!M)return null;switch(m){case"query":return p(Ka,{size:18});case"env":return p(wn,{size:18});case"sentry":return p(Aa,{size:18,color:"#9945FF"});case"storage":return p(Wa,{size:18,bgColor:b.color.surface});case"wifi":case"query-wifi-toggle":return p(Ba,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return p(_a,{size:18,bgColor:b.color.surface});case"network":return p(Ua,{size:18});case"environment":return p(wn,{size:18});case"debug-borders":return p(Da,{size:18,color:b.color.accent});case"highlight-updates":return p(Ma,{size:18,color:b.color.accent});case"highlight-updates-modal":return p(Va,{size:18});case"redux":return p(qa,{size:18});case"image-overlay":return p(Ra,{size:18});case"events":return p(Ga,{size:18});case"zustand":try{let{ZustandIcon:g}=zo("@buoy-gg/zustand/web");return p(g,{size:18})}catch{return p(qt,{size:18,color:b.color.textSecondary})}case"jotai":try{let{JotaiIcon:g}=zo("@buoy-gg/jotai/web");return p(g,{size:18})}catch{return p(qt,{size:18,color:b.color.textSecondary})}default:{let g=n.find(z=>z.id===m);return g?.icon!=null?Qt(g.icon,{slot:"row",size:18,color:g.color}):p(qt,{size:18,color:b.color.textSecondary})}}},"getToolIcon"),w=i((m,g,z,Y)=>{let le=je(m);return N(ut,{activeOpacity:z?1:.7,onPress:()=>!z&&Y(),accessibilityLabel:se(m),accessibilityRole:"button",style:[y.toolRow,z&&y.rowDisabled],children:[p(H,{style:y.toolIconSlot,children:O(m)}),N(H,{style:y.rowInfo,children:[N(K,{style:y.rowLabel,children:[se(m),z?" \xB7 max 6":""]}),le?p(K,{style:y.rowCaption,numberOfLines:1,children:le}):null]}),p(vn,{value:g,disabled:z,onValueChange:()=>Y(),accessibilityLabel:se(m)})]},m)},"renderToolRow"),l=i(m=>{A(g=>{let z=new Set(g);return z.has(m)?z.delete(m):z.add(m),z})},"toggleSettingExpanded"),v=i((m,g,z,Y,le)=>{let Xe=h.globalSettings?.[m]??false,Se=E.has(m);return N(H,{children:[N(ut,{activeOpacity:.7,onPress:()=>l(m),accessibilityLabel:g,style:y.settingRow,children:[N(H,{style:y.rowInfo,children:[p(K,{style:y.rowLabel,children:g}),p(K,{style:y.rowCaption,numberOfLines:Se?0:1,children:z})]}),p(vn,{value:Xe,onValueChange:()=>$e(m),accessibilityLabel:g})]}),Se&&N(H,{style:y.settingRowBody,children:[p(K,{style:y.settingRowBodyText,children:Y}),p(K,{style:y.settingRowBodyHint,children:le})]})]},m)},"renderGlobalSettingRow"),C=i((m,g,z)=>N(H,{children:[p(ja,{children:m}),g,z]}),"renderSection"),G=q==="filesystem"?p(he,{label:"File System",tone:"accent"}):q==="asyncstorage"?p(he,{label:"Async Storage",tone:"warning"}):q==="localstorage"?p(he,{label:"Local Storage",tone:"accent"}):q==="memory"?p(he,{label:"Memory",tone:"danger"}):p(he,{label:"Loading\u2026",tone:"neutral"}),J=i(()=>N(H,{style:y.container,children:[N(Co,{style:y.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:y.scrollContainer,children:[k==="floating"&&p(et,{children:C("Floating Tools",p(Le,{glass:true,children:p(Gt,{children:Object.entries(h.floatingTools).map(([m,g])=>w(m,g,false,()=>Ye(m)))})}),p(bn,{children:"Tools switched on here appear in the floating bubble row."}))}),k==="settings"&&N(et,{children:[C("Background",p(Le,{glass:true,padded:true,children:p($a,{embedded:true})})),C("Storage",N(Le,{glass:true,children:[N(ut,{activeOpacity:.7,onPress:()=>W(!ye),accessibilityLabel:"Storage Type",style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(K,{style:y.rowLabel,children:"Storage Type"})}),G,ye?p(hn,{size:16,color:b.color.textTertiary}):p(gn,{size:16,color:b.color.textTertiary})]}),ye&&N(et,{children:[N(H,{style:y.settingRowBody,children:[p(K,{style:y.settingRowBodyText,children:q==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":q==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":q==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":q==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),q==="asyncstorage"&&p(K,{style:[y.settingRowBodyText,y.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),q==="memory"&&p(K,{style:[y.settingRowBodyText,y.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),p(Ha,{}),N(H,{style:y.storageExpanded,children:[N(H,{style:y.storageExpandedHeader,children:[p(K,{style:y.storageExpandedTitle,children:"SAVED SETTINGS"}),p(K,{style:y.storageExpandedCount,children:Be?"\u2026":`${Te.length} keys`})]}),Be?p(K,{style:y.storageKeyEmpty,children:"Loading\u2026"}):Te.length===0?p(K,{style:y.storageKeyEmpty,children:"No settings saved yet"}):p(Co,{style:y.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:Te.map(m=>p(H,{style:y.storageKeyItem,children:p(K,{style:y.storageKeyText,numberOfLines:1,children:m.replace("@react_buoy_","")})},m))})]}),p(H,{style:y.cardButtonWrap,children:p(Jt,{label:xe?"Cleared":ee?"Clearing\u2026":"Clear All Settings",variant:xe?"secondary":"destructive",size:"md",disabled:ee,onPress:ke,icon:xe?p(yn,{size:15,color:b.color.accent}):p(La,{size:15,color:ee?b.color.textTertiary:b.color.danger})})})]})]})),T&&T.state!=="idle"&&C("Desktop Sync",N(Le,{glass:true,children:[N(ut,{activeOpacity:.7,onPress:()=>l("desktopSync"),accessibilityLabel:"Buoy Desktop",style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(K,{style:y.rowLabel,children:"Buoy Desktop"})}),T.state==="connected"?p(he,{label:"Connected",tone:"accent"}):T.state==="connecting"?p(he,{label:"Connecting\u2026",tone:"neutral"}):p(he,{label:"Retrying",tone:"warning"}),E.has("desktopSync")?p(hn,{size:16,color:b.color.textTertiary}):p(gn,{size:16,color:b.color.textTertiary})]}),E.has("desktopSync")&&N(H,{style:y.settingRowBody,children:[N(K,{style:y.settingRowBodyText,children:[T.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",p(K,{style:y.footnoteMono,children:T.targetURL??"(unknown URL)"}),T.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),T.state==="retrying"&&T.lastError&&N(K,{style:[y.settingRowBodyText,y.bodyWarning],children:["Last error: ",T.lastError]})]})]})),C("Modal Behavior",p(Le,{glass:true,children:N(Gt,{children:[v("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."),ns(Ne.OS==="web")?v("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]})}))]}),k==="pro"&&N(et,{children:[C("License",N(Le,{glass:true,children:[N(H,{style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(K,{style:y.rowLabel,children:"License Status"})}),p(H,{testID:"buoy-settings-license-status",accessibilityLabel:Q?"License: Active":"License: Free",children:Q?p(he,{label:"Active",tone:"accent"}):p(he,{label:"Free",tone:"neutral"})})]}),P?.tierSource==="session"?N(H,{style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(K,{style:y.rowLabel,children:"Signed in with Buoy"})}),p(Jt,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void Pa(),testID:"buoy-settings-signout"})]}):null,P?.teamRole?p(H,{style:y.settingRow,testID:"buoy-settings-team-role",children:N(H,{style:y.rowInfo,children:[N(K,{style:y.rowLabel,children:["Role: ",P.teamRole]}),p(K,{style:y.rowCaption,children:P.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),p(bn,{children:Q?"You have full access to all Buoy DevTools features.":Z?U?`Couldn't reach the license server (${Z}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${Z}.`:"Upgrade to Pro to unlock all features and support development."})),!Q&&N(et,{children:[C("Pro Features",p(Le,{glass:true,children:p(Gt,{children:["Advanced Settings","Priority Support"].map(m=>N(H,{style:y.featureRow,children:[p(yn,{size:16,color:b.color.accent}),p(K,{style:y.rowLabel,children:m})]},m))})})),p(Jt,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>S(true)})]})]})]}),p(Fa,{visible:V,onClose:()=>S(false)})]}),"renderContent");return p(ts,{visible:e,onClose:t,zIndex:s,variant:"night",header:{showToggleButton:false,customContent:p(H,{style:y.headerRow,children:p(Na,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:k,onChange:m=>R(m)})})},initialMode:"bottomSheet",onModeChange:Me,persistenceKey:Zt.settings.root(),enablePersistence:true,maxHeight:oe-pe.top,initialHeight:me,initialFloatingPosition:{x:(Re-Ce)/2,y:pe.top+20},enableGlitchEffects:true,children:J()})},"DevToolsSettingsModal"),cs={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}},ds=i((e,t)=>{let o=new Set(e??[]),r=new Set(t??[]),n={};for(let s of r)n[s]=true;let a={environment:o.has("environment")};for(let s of o)s!=="environment"&&(a[s]=true);return{dialTools:It(n),floatingTools:a,globalSettings:{enableSharedModalDimensions:false}}},"createDefaultsFromConfig"),tt=null,eo=null,kn=null,zn=i((e,t)=>JSON.stringify(e)===JSON.stringify(t),"sameSettings");Tt.addListener(e=>{e&&(tt=e)});var An=i(()=>{let{defaultFloatingTools:e,defaultDialTools:t}=Xt(),o=xt(()=>!e&&!t?cs:ds(e,t),[e,t]),[r,n]=re(o),a=wt(async()=>{try{let c=await Pe.getItem(qe);if(c){let u=JSON.parse(c),d=Cn(o,u);n(d);return}n(o)}catch(c){console.error("[Buoy]","Failed to load dev tools settings:",c),n(o)}},[o]);ze(()=>os(c=>{c.includes(qe)&&a()}),[a]),ze(()=>{a();let c=Tt.addListener(u=>{try{u&&n(u)}catch{}});return()=>{c()}},[a]);let s=wt(()=>{a()},[a]);return{settings:r,refreshSettings:s}},"useDevToolsSettings"),y=dt.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:b.gutter,paddingRight:b.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:b.gutter,paddingTop:8,paddingBottom:24,gap:b.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:b.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:b.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:b.color.text,fontSize:b.font.row,fontWeight:"500"},rowCaption:{color:b.color.textTertiary,fontSize:b.font.label},settingRowBody:{paddingHorizontal:b.rowPadH,paddingBottom:b.rowPadV,gap:6},settingRowBodyText:{color:b.color.textSecondary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},settingRowBodyHint:{color:b.color.textTertiary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},bodyWarning:{color:b.color.warning},bodyDanger:{color:b.color.danger},cardButtonWrap:{paddingHorizontal:b.cardPad,paddingTop:10,paddingBottom:b.cardPad},storageExpanded:{paddingHorizontal:b.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:b.color.textSecondary,fontSize:b.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:b.color.textTertiary,fontSize:b.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:b.color.glassElevated,borderRadius:b.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:b.color.textSecondary,fontSize:b.font.micro,fontFamily:Sn},storageKeyEmpty:{color:b.color.textTertiary,fontSize:b.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Sn,fontSize:b.font.label,color:b.color.textSecondary}});import{jsx as Bn}from"react/jsx-runtime";var us=[];function to({visible:e,onClose:t,availableTools:o=us,defaultFloatingTools:r,defaultDialTools:n,storage:a=Ta,onSettingsChange:s}){let c=mn(()=>({getItem:i(async f=>a.getItem(f),"getItem"),setItem:i(async(f,x)=>a.setItem(f,x),"setItem")}),[a]),u=mn(()=>o.map(f=>({...f,name:f.name??f.id,icon:typeof f.icon=="function"?x=>f.icon(x.size):f.icon})),[o]),d=xa(f=>{s?.(f)},[s]);return Bn(Yt,{defaultFloatingTools:r,defaultDialTools:n,children:Bn(ls,{visible:e,onClose:t,zIndex:11e3,availableApps:u,storage:c,onSettingsChange:d})})}i(to,"SettingsModal");import{listenBuoyKeydown as ps}from"@buoy-gg/shared-ui/web/floating";import{persistentStorage as Rn,setExpandableWindowControls as ms}from"@buoy-gg/shared-ui/web";import{createContext as fs,useCallback as Ae,useContext as gs,useEffect as Ct,useMemo as hs,useRef as ot,useState as Mn}from"react";var ys=i((e,t,o)=>{if(t.singleton){let n=e.find(a=>a.id===t.id);if(n){let a=n.minimized??false;return{instanceId:n.instanceId,wasMinimized:a,apps:[...e.filter(s=>s.instanceId!==n.instanceId),{...n,minimized:false}]}}}let r=o();return{instanceId:r,wasMinimized:false,apps:[...e,{...t,instanceId:r}]}},"resolveOpenAppsState"),bs=i((e,t,o)=>{let r=e.find(n=>n.instanceId===t);return r?[...e.filter(n=>n!==r),{...r,minimized:false,restoreState:o??r.restoreState}]:e},"restoreOpenApp");import{createContext as vs,useCallback as Dn,useContext as Ss,useEffect as kt,useMemo as ws,useRef as On,useState as zt}from"react";import{JsModal as xs,ModalHeader as nt,HeaderSearchButton as Ts,TickProvider as Is,ToolScreenHeaderContext as Cs,devToolsStorageKeys as En,buoyColors as Pn,gameUIColors as oo}from"@buoy-gg/shared-ui/web";import{jsx as ce,jsxs as At}from"react/jsx-runtime";var rt=i(()=>{},"noop"),ks={search:"",isSearchActive:false,clearSearch:rt,close:rt,minimize:rt,showToast:rt,setHeaderOverride:rt},Ln=vs(null);function no(){return Ss(Ln)??ks}i(no,"useToolHost");function Fn(e,t){let{setHeaderOverride:o}=no();kt(()=>(o(e),()=>o(null)),t)}i(Fn,"useToolHeader");var $n=2200,zs={success:oo.success,error:oo.error,info:oo.info};function jn({message:e,type:t,nonce:o}){let r=On(new De.Value(0)).current;kt(()=>{r.setValue(0),De.sequence([De.timing(r,{toValue:1,duration:150,useNativeDriver:true}),De.delay($n-450),De.timing(r,{toValue:0,duration:300,useNativeDriver:true})]).start()},[o,r]);let n=zs[t];return At(De.View,{pointerEvents:"none",style:[Bt.toast,{opacity:r,borderColor:n+"60"}],children:[ce(H,{style:[Bt.toastDot,{backgroundColor:n}]}),ce(K,{style:Bt.toastText,numberOfLines:2,children:e})]})}i(jn,"ToastView");function Nn({app:e,config:t,visible:o,zIndex:r,onClose:n,onMinimize:a,initialModalState:s,enableSharedModalDimensions:c,bodyProps:u}){let d=e.component,[f,x]=zt(false),[h,B]=zt(""),[k,R]=zt(null),[F,D]=zt(null),E=On(null),A=Dn(()=>{x(false),B("")},[]),V=Dn((q,ie="info")=>{E.current&&clearTimeout(E.current),D(ee=>({message:q,type:ie,nonce:(ee?.nonce??0)+1})),E.current=setTimeout(()=>D(null),$n)},[]);kt(()=>()=>{E.current&&clearTimeout(E.current)},[]);let S=ws(()=>({search:f?h:"",isSearchActive:f,clearSearch:A,close:n,minimize:i(()=>a(),"minimize"),showToast:V,setHeaderOverride:R,instanceId:e.instanceId}),[h,f,A,n,a,V,e.instanceId]),M=k?.title??t.title??e.title??e.id,_=k?.subtitle??t.subtitle,T=k?.onBack,P=k?.actions??t.headerActions,Q=k?.searchable??t.searchable;kt(()=>{!Q&&f&&A()},[Q,f,A]);let Z=c?En.modal.root():En.custom(e.id).modal(),U=At(nt,{children:[T&&!f&&ce(nt.Navigation,{onBack:T}),f?ce(nt.Search,{value:h,onChangeText:B,onCancel:A,placeholder:t.searchPlaceholder,testID:`tool-search-field-${e.id}`}):ce(nt.Content,{title:M,subtitle:_}),At(nt.Actions,{children:[!f&&P,Q&&!f&&ce(Ts,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>x(true)})]})]});return ce(Ln.Provider,{value:S,children:ce(xs,{visible:o,onClose:n,onBack:T,onMinimize:a,initialModalState:s,zIndex:r,persistenceKey:Z,enablePersistence:true,initialMode:t.initialMode??"bottomSheet",header:{customContent:U,showToggleButton:true},disableScrollWrapper:true,styles:{},children:At(H,{style:Bt.bodyRoot,children:[ce(Is,{children:ce(Cs.Provider,{value:R,children:ce(d,{...u})})}),F&&ce(jn,{message:F.message,type:F.type,nonce:F.nonce})]})})})}i(Nn,"ToolModalShell");var Bt=dt.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:Pn.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:Pn.text}});function Hn(e,t){if(t)return{kind:"dial"};for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.launchMode!=="toggle-only"&&!n.minimized)return{kind:"tool",instanceId:n.instanceId}}let o=e[e.length-1];return o?{kind:"tool",instanceId:o.instanceId}:null}i(Hn,"resolveBackTarget");import{createContext as As,useContext as Bs,useState as Wn,useMemo as _n}from"react";import{jsx as Rs}from"react/jsx-runtime";var Un=As(null);function ro({children:e}){let[t,o]=Wn(false),[r,n]=Wn(false),a=_n(()=>t||r,[t,r]),s=_n(()=>({isDialOpen:t,isToolOpen:r,isDevToolsActive:a,setDialOpen:o,setToolOpen:n}),[t,r,a]);return Rs(Un.Provider,{value:s,children:e})}i(ro,"DevToolsVisibilityProvider");function it(){let e=Bs(Un);return e||{isDialOpen:false,isToolOpen:false,isDevToolsActive:false,setDialOpen:i(()=>{},"setDialOpen"),setToolOpen:i(()=>{},"setToolOpen")}}i(it,"useDevToolsVisibility");import{Fragment as Ms,jsx as de}from"react/jsx-runtime";var Kn=fs(null),Vn="@react_buoy_open_apps",io=44,Ds=12,Os=100,Es=16,Ps=i(e=>({x:window.innerWidth-io-Es,y:window.innerHeight-Os-io-e*(io+Ds)}),"dockIconPosition"),qn=i(({children:e})=>{let[t,o]=Mn([]),[r,n]=Mn(false),a=ot([]),s=ot(null),c=ot(false),u=ot(false),d=ot(false),f=Ae(S=>{let M="";return o(_=>{let{apps:T,instanceId:P}=ys(_,S,()=>`${S.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);return M=P,T}),M},[]),x=Ae(()=>{if(c.current||!u.current||!d.current)return;c.current=true;let S=s.current;if(!S||S.length===0){n(true);return}s.current=null,S.forEach(({id:M,minimized:_})=>{let T=a.current.find(P=>P.id===M);if(T&&T.component){let P=Qt(T.icon,{slot:"dial",size:20,color:T.color});f({id:T.id,title:T.name,component:T.component,props:T.props,modal:T.modal,launchMode:T.launchMode||"self-modal",singleton:T.singleton??true,icon:P,color:T.color,minimized:_})}}),n(true)},[f]);Ct(()=>{let S=false;return i(async()=>{try{let M=await Rn.getItem(Vn);if(S)return;if(M){let _=JSON.parse(M),T;Array.isArray(_)&&_.length>0&&(typeof _[0]=="string"?T=_.map(P=>({id:P,minimized:false})):T=_.filter(P=>typeof P=="object"&&P!==null&&typeof P.id=="string"),T.length&&(s.current=T))}}catch{}S||(u.current=true,x())},"restoreOpenApps")(),()=>{S=true}},[x]),Ct(()=>{if(!r)return;let S=t.map(M=>({id:M.id,minimized:M.minimized??false}));Rn.setItem(Vn,JSON.stringify(S))},[t,r]);let h=Ae(S=>{a.current=S,d.current=true,x()},[x]),B=Ae(S=>{o(M=>M.length?S?M.filter(_=>_.instanceId!==S):M.slice(0,-1):M)},[]),k=Ae(()=>o([]),[]),R=Ae((S,M)=>{o(_=>_.map(T=>T.instanceId===S?{...T,minimized:true,restoreState:M}:T))},[]),F=Ae((S,M)=>{o(_=>bs(_,S,M))},[]),D=Ae(S=>t.find(M=>M.instanceId===S)?.minimized??false,[t]),E=t.some(S=>S.launchMode!=="toggle-only"&&!S.minimized);Ct(()=>E?ps(i(S=>{if(S.key!=="Escape"||S.defaultPrevented)return;let M=[...t].reverse().find(_=>_.launchMode!=="toggle-only"&&!_.minimized);M&&B(M.instanceId)},"handler")):void 0,[E,B,t]);let{isDialOpen:A}=it();Nt(t.length>0,()=>{let S=Hn(t,A);S?.kind==="tool"&&B(S.instanceId)});let V=hs(()=>({openApps:t,isAnyOpen:E,open:f,close:B,closeAll:k,registerApps:h,minimize:R,restore:F,isMinimized:D}),[t,E,f,B,k,h,R,F,D]);return de(Kn.Provider,{value:V,children:e})},"AppHostProvider"),at=i(()=>{let e=gs(Kn);return e||{openApps:[],isAnyOpen:false,open:i(()=>"","open"),close:i(()=>{},"close"),closeAll:i(()=>{},"closeAll"),registerApps:i(()=>{},"registerApps"),minimize:i(()=>{},"minimize"),restore:i(()=>{},"restore"),isMinimized:i(()=>false,"isMinimized")}},"useAppHost"),Ls=9e3,Fs={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"},$s={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"},js=i(({app:e,zIndex:t,onClose:o,onMinimize:r,minimizeTargetPosition:n,enableSharedModalDimensions:a})=>{let s=e.component,c=!e.minimized,u={...e.props??{},...a?{enableSharedModalDimensions:true}:{}};return e.modal&&(!e.launchMode||e.launchMode==="self-modal")?de("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:de(Nn,{app:e,config:e.modal,visible:c,zIndex:t,onClose:o,onMinimize:r,initialModalState:e.restoreState,enableSharedModalDimensions:a,bodyProps:u})}):e.launchMode==="self-modal"?de("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:de(s,{...u,visible:c,onClose:o,onRequestClose:o,onMinimize:r,minimizeTargetPosition:n,instanceId:e.instanceId,zIndex:t,initialModalState:e.restoreState})}):e.launchMode==="inline"?c?de("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:de(s,{...u,onClose:o,onMinimize:r,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})}):null:de("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{...Fs,zIndex:t,display:c?"flex":"none"},children:de("div",{style:$s,children:de(s,{...u,onClose:o,onMinimize:r,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})})})},"AppRenderer"),Gn=i(()=>{let{openApps:e,close:t,minimize:o}=at(),{settings:r}=An();Ct(()=>{ms(r.globalSettings?.expandableWindowControls!==false)},[r.globalSettings?.expandableWindowControls]);let n=e.filter(c=>c.launchMode!=="toggle-only");if(n.length===0)return null;let a=n.filter(c=>c.minimized).length,s=$i()??Ps(a);return de(Ms,{children:n.map((c,u)=>de(js,{app:c,zIndex:Ls+u,onClose:()=>t(c.instanceId),onMinimize:d=>o(c.instanceId,d),enableSharedModalDimensions:r.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:s},c.instanceId))})},"AppOverlay");import{useCallback as Ns,useEffect as ao,useRef as Hs,useState as Jn,useSyncExternalStore as Yn}from"react";import{persistentStorage as Xn,getToolAttention as so,subscribeToolAttention as Qn}from"@buoy-gg/shared-ui/web";import{jsx as ue,jsxs as Rt}from"react/jsx-runtime";function Zn(e){return Yn(Qn,()=>so(e),()=>so(e))}i(Zn,"useToolAttention");var er={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"},tr={needsInput:3,failed:2,done:1},or=new Map;function lo(e){let t=null;for(let r of e?e.split("|"):[]){let n=so(r);n&&(!t||tr[n.kind]>tr[t.kind])&&(t=n)}let o=or.get(e);return o&&t&&o.kind===t.kind&&o.label===t.label?o:!o&&!t?null:(or.set(e,t),t)}i(lo,"strongest");function nr(e){let t=e.join("|");return Yn(Qn,()=>lo(t),()=>lo(t))}i(nr,"useStrongestAttention");var rr=28,co=32,uo=6,ir=8,ar=24,sr="@react_buoy_minimized_stack_expanded",Ws=80,lr=2e3,_s=6e3,Us="#1A1A1A",st="#888888";function po({down:e=false}){return ue("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:ue("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:st,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}i(po,"ChevronGlyph");function cr({id:e,title:t,icon:o,index:r,onPress:n}){let a=Zn(e),s=Hs(null);return ao(()=>{let c=true,u,d=i(()=>{s.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:Ws,easing:"linear"})},"runGlitch"),f=i(x=>{let h=x?500+Math.random()*1500+r*200:lr+Math.random()*(_s-lr)+r*300;u=setTimeout(()=>{c&&(d(),f(false))},h)},"schedule");return f(true),()=>{c=false,clearTimeout(u)}},[r]),Rt("button",{type:"button","aria-label":a?`${t} \u2014 ${a.label}. Restore`:`Restore ${t}`,"data-testid":`buoy-dock-restore-${e}`,onClick:n,style:{width:co,height:co,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[ue("div",{ref:s,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:o}),a?ue("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${a.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:er[a.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:a.kind==="needsInput"?"!":""}):null]})}i(cr,"GlitchToolButton");function dr({containerWidth:e=32}){let{openApps:t,restore:o}=at(),r=t.filter(h=>h.minimized&&h.launchMode!=="toggle-only"),[n,a]=Jn(false),[s,c]=Jn(false),u=nr(r.map(h=>h.id));ao(()=>{let h=false;return i(async()=>{let B=await Xn.getItem(sr);!h&&B==="true"&&a(true),h||c(true)},"load")(),()=>{h=true}},[]),ao(()=>{s&&Xn.setItem(sr,n?"true":"false")},[n,s]);let d=Ns(h=>{o(h)},[o]);if(r.length===0)return null;let f=ir+r.length*co+(r.length-1)*uo+uo+ar+4,x={backgroundColor:Us,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${st}66`,borderLeft:`1px solid ${st}66`,borderRight:`1px solid ${st}66`,borderBottom:"none",boxSizing:"border-box"};return Rt("div",{style:{height:rr,overflow:"visible",position:"relative"},children:[ue("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?f:0,opacity:n?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:n?"auto":"none",...x},children:Rt("div",{style:{height:f,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:ir,gap:uo,boxSizing:"border-box"},children:[n&&[...r].reverse().map((h,B)=>ue(cr,{id:h.id,title:h.title||h.id,icon:h.icon??ue("span",{style:{color:"#fff",fontSize:13},children:(h.title||h.id).slice(0,1).toUpperCase()}),index:B,onPress:()=>d(h.instanceId)},h.instanceId)),ue("button",{type:"button","aria-label":"Collapse","data-testid":"buoy-dock-collapse",onClick:()=>a(false),style:{width:"100%",height:ar,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:ue(po,{down:true})})]})}),Rt("button",{type:"button","aria-label":`Show ${r.length} minimized tools`,"data-testid":"buoy-dock-peek",tabIndex:n?-1:0,"aria-hidden":n,onClick:()=>a(true),style:{position:"absolute",bottom:0,left:0,width:e,height:rr,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:[ue(po,{}),u?ue("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:er[u.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:u.kind==="needsInput"?"!":""}):null,r.length>1&&ue("span",{style:{fontSize:9,fontWeight:600,color:st,marginLeft:1},children:r.length})]})]})}i(dr,"MinimizedToolsStack");var ur=class Hc{constructor(){this.listeners=new Set}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){this.listeners.forEach(t=>t())}};i(ur,"ToggleStateManager");var Ks=ur,Vs=new Ks;import{registerToolModules as qs}from"@buoy-gg/shared-ui/web";import{createElement as Gs}from"react";function Ge(e){let t=e.icon;return{...e,icon:typeof t=="function"?o=>Gs(t,{size:o,slot:e.slot??"both",color:e.color}):()=>t}}i(Ge,"createWebTool");import*as Js from"@buoy-gg/license/web";import*as Ys from"@buoy-gg/shared-ui/web";import*as Xs from"@buoy-gg/shared-ui/web/dataViewer";function mo(e){qs({core:{useDevToolsVisibility:it},license:Js,"shared-ui":Ys,"shared-ui/dataViewer":Xs,...e});let t=new Set;return Object.values(e).flatMap(o=>Object.entries(o).flatMap(([r,n])=>!r.endsWith("Preset")||!n||typeof n.id!="string"||!n.component||t.has(n.id)?[]:(t.add(n.id),[Ge(n)])))}i(mo,"createWebTools");import{useEffect as Mt,useMemo as Dt,useRef as Qs}from"react";import{LicenseManager as pr,installCapacitorBridge as Zs,resolveDevBuild as mr,useLicense as el}from"@buoy-gg/license/web";import{registerToolAdapters as tl}from"@buoy-gg/shared-ui/web";function fo(e){return typeof e=="object"&&e!==null?e:void 0}i(fo,"externalSyncOptions");function fr({isDevelopment:e,isLicensed:t,externalSync:o,isAvailable:r}){if(o===false||!r)return false;if(e)return true;let n=fo(o);return t&&n?.enableInRelease===true&&go(n.socketURL,n)===null}i(fr,"shouldMountExternalSync");var gr="http://localhost:42831";function hr(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}i(hr,"isLoopbackHost");function go(e,t){let o=e??gr;if(t?.allowInsecureNetwork===true)return null;let r;try{r=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 r.protocol==="https:"||r.protocol==="wss:"||hr(r.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.`}i(go,"releaseTransportProblem");var ol={"ota-update-inspector":["check","fetch","reload","setHeaders","setURL"],impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};function yr(e,t,o){if(t)return e;let r=null;for(let[n,a]of Object.entries(ol)){if(o?.includes(n))continue;let s=e[n];if(!s?.actions)continue;let c={...s.actions};for(let u of a)u in c&&(c[u]=()=>{throw new Error(`${n}.${u} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)});r??(r={...e}),r[n]={...s,actions:c}}return r??e}i(yr,"applyReleaseActionPolicy");import{useEffect as nl,useMemo as rl,useState as il}from"react";import{devToolsStorageKeys as al,persistentStorage as sl}from"@buoy-gg/shared-ui/web";import{isCapacitorNative as ll}from"@buoy-gg/license/web";var cl=8;function br(){let e="";for(;e.length<cl;)e+=(Math.random()*16|0).toString(16);return e}i(br,"generateInstallId");function vr(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}i(vr,"slugify");function Sr({appName:e,hardwareName:t,platform:o,installId:r,deviceId:n}){let a=vr(e??"buoy")||"buoy",s=e??"Buoy Device",c=t?.trim()||o;return n?{deviceId:n,deviceName:`${s} (${c})`}:{deviceId:`${a}-${o}-${r}`,deviceName:`${s} (${c} \xB7 ${r.slice(-4)})`}}i(Sr,"buildDeviceIdentity");function wr(){let e=globalThis;try{return e.sessionStorage??null}catch{return null}}i(wr,"sessionStore");function xr(){let e=globalThis;try{return e.localStorage??null}catch{return null}}i(xr,"localStore");async function Tr({platform:e=Ne.OS,store:t,mint:o=br}={}){let r=al.sync.deviceId(),n=t===void 0?ll()?xr():e==="web"?wr():sl:t;if(!n)return o();try{let a=await n.getItem(r);if(a&&a.length>0)return a;let s=o();return await n.setItem(r,s),s}catch{return o()}}i(Tr,"loadInstallId");var ho=null;function Ir(){return ho||(ho=Tr()),ho}i(Ir,"getInstallId");function Cr(e,t){let o=e?.deviceId,r=e?.deviceName,n=t.loadId??Ir,a=t.platform??Ne.OS,[s,c]=il(null);return nl(()=>{if(o)return;let u=false;return n().then(d=>{u||c(d)}),()=>{u=true}},[o,n]),rl(()=>{if(!o&&!s)return null;let u=Sr({appName:t.appName,hardwareName:t.hardwareName,platform:a,installId:s??"",deviceId:o});return r?{...u,deviceName:r}:u},[o,r,s,t.appName,t.hardwareName,a])}i(Cr,"useDeviceIdentity");import{useEffect as dl,useState as ul}from"react";import{capacitorPlatform as pl,capacitorPlugin as Ot,isCapacitorNative as ml}from"@buoy-gg/license/web";function kr(e,t){if(t==="ios")return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":null;let o=/Android [\d.]+;\s*([^;)]+?)(?:\s+Build\/|\))/.exec(e)?.[1]?.trim();return!o||o==="K"?null:o}i(kr,"hardwareFromUserAgent");function zr(e){return/sdk_gphone|Android SDK built for|Android ATD built for|google_sdk|Emulator|generic_/i.test(e)}i(zr,"isAndroidEmulatorUserAgent");function yo(){return typeof navigator>"u"?"":navigator.userAgent??""}i(yo,"userAgent");function Et(){return typeof document>"u"?null:document.title||(typeof location>"u"?null:location.hostname)||null}i(Et,"firstPageTitle");var Ar="@react_buoy_capacitor_app_name";function Br(e){try{let t=globalThis.localStorage;if(!t)return e;let o=t.getItem(Ar);if(o)return o;e&&t.setItem(Ar,e)}catch{}return e}i(Br,"persistedAppName");function Rr(){let e=pl();if(!e)return{platform:"web",appName:Et(),hardwareName:"Browser",ready:true};let t=!!Ot("App");return{platform:e,appName:t?Et():Br(Et()),hardwareName:kr(yo(),e)??e,extraDeviceInfo:{runtime:"capacitor"},ready:!t&&!Ot("Device")}}i(Rr,"initialHostInfo");function Mr(){let[e,t]=ul(Rr);return dl(()=>{if(!ml())return;let o=false,r=Ot("App"),n=Ot("Device");return Promise.all([r?.getInfo?.().catch(()=>null)??null,n?.getInfo?.().catch(()=>null)??null]).then(([a,s])=>{if(o)return;let c=a?.name?.trim(),u=s?.name?.trim()||s?.model?.trim();t(d=>({...d,appName:c||d.appName,hardwareName:u||d.hardwareName,ready:true}))}),()=>{o=true}},[]),e}i(Mr,"useHostInfo");function bo(){if(typeof location>"u")return null;let e=globalThis.WEBVIEW_SERVER_URL;return{protocol:location.protocol,hostname:location.hostname,origin:`${location.protocol}//${location.host}`,userAgent:yo(),serverUrl:typeof e=="string"?e:null}}i(bo,"pageInfo");function vo(e){if(!e)return null;try{let t=new URL(e);return`${t.protocol}//${t.host}`}catch{return null}}i(vo,"schemeHost");function Dr(e,t){if(e==="ios"){let o=vo(t.serverUrl);return o?o===vo(t.origin):t.protocol==="capacitor:"}return Or.has(t.hostname)}i(Dr,"isBundledPage");var Or=new Set(["localhost","127.0.0.1","[::1]","::1"]);function Er(e,t,o,r=bo()){if(o==="web"||!r)return e;let n;try{n=new URL(e)}catch{return e}let a=Dr(o,r);return!t&&a&&n.hostname===r.hostname&&(n.hostname="localhost"),o==="android"&&Or.has(n.hostname)&&zr(r.userAgent)&&(n.hostname="10.0.2.2"),n.toString().replace(/\/$/,"")}i(Er,"capacitorBrokerURL");function Pr(e,t,o=bo()){return t!=="android"||!o||o.protocol!=="https:"||!/^(http|ws):/i.test(e)?null:`[Buoy] Can't reach Buoy Desktop at ${e}. This Android WebView serves the app from https://${o.hostname} and blocks plain http/ws by default. For debug builds, set android.allowMixedContent: true and server.cleartext: true in capacitor.config, then run cap sync.`}i(Pr,"capacitorTransportProblem");import{getDevServerOrigin as fl,resolveReloadStrategy as gl,scheduleReloadApp as hl}from"@buoy-gg/shared-ui/web";var Lr=Date.now(),Fr=fl(),yl={platform:Ne.OS,isTV:Ne.isTV===true,isTVOS:Ne.isTVOS===true},$r={version:3,getSnapshot:i(()=>{let e=gl("auto");return{startedAt:Lr,devServerOrigin:Fr,device:yl,reload:{available:e!==null,strategy:e}}},"getSnapshot"),subscribe:i(e=>()=>{},"subscribe"),actions:{ping:i(()=>({ok:true,startedAt:Lr,devServerOrigin:Fr}),"ping"),reloadApp:i(e=>{let t=e??{},{strategy:o,delayMs:r}=hl({strategy:t.strategy,delayMs:t.delayMs});return{scheduled:true,strategy:o,delayMs:r}},"reloadApp")}};import{Fragment as bl,jsx as Fe,jsxs as vl}from"react/jsx-runtime";var Sl=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"],wl=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];function jr(e){let t=Dt(()=>Object.fromEntries(Object.entries(e.modules).map(([r,n])=>[r.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),n])),[e.modules]),o=t["react-query"];return o?.useReactQuerySyncAdapter?Fe(Nr,{...e,modules:t,query:o}):Fe(So,{...e,modules:t})}i(jr,"BrowserToolRuntime");function Nr(e){let t=e.query.useReactQuerySyncAdapter();return Fe(So,{...e,queryAdapter:t})}i(Nr,"QueryRuntime");function So({modules:e,apps:t,requiredEnvVars:o,externalSync:r,headless:n,sentryGetClient:a,queryAdapter:s}){let{isPro:c,tier:u}=el(),d=Dt(()=>{let F={app:$r};for(let[D,E]of Object.entries(e))for(let[A,V]of Object.entries(E))A.endsWith("SyncAdapter")&&V&&typeof V=="object"&&(F[D]=V);s&&(F.query=s),e.env?.createEnvSyncAdapter&&(F.env=e.env.createEnvSyncAdapter(o??[]));for(let D of t??[])D.sync&&(F[`custom:${D.id}`]=D.sync);return F},[e,t,o,s]),f=Qs(d);f.current=d,Mt(()=>tl(()=>f.current),[]),Mt(()=>{let F=[],D=i(E=>{let A=E?.();typeof A=="function"&&F.push(A)},"start");return D(e.network?.startNetworkCapture),D(e.storage?.startBrowserStorageCapture),D(e.assets?.startBrowserAssetCapture),D(e.three?.startThreeCapture),mr(typeof He<"u"?He:process.env.NODE_ENV!=="production")&&D(e["time-machine"]?.startTimeMachineFloatingToolPersistence),e.storage?.storageSyncAdapter?.subscribe&&D(()=>e.storage.storageSyncAdapter.subscribe(()=>{})),e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe&&D(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{})),()=>{for(let E of F.reverse())E()}},[e]);let x=e["external-sync"],h=mr(typeof He<"u"?He:process.env.NODE_ENV!=="production"),B=fr({isDevelopment:h,isLicensed:c,externalSync:r,isAvailable:!!x}),k=fo(r);Zs({release:!h&&!!k?.enableInRelease}),!h&&k?.enableInRelease&&wo(go(k.socketURL,k));let R=e.sentry?.SentryRoot;return vl(bl,{children:[Object.entries(e).flatMap(([F,D])=>Sl.map(E=>{let A=D[E];return A?Fe(A,{},`${F}:${E}`):null})),R&&Fe(R,{getClient:a}),Object.entries(e).flatMap(([F,D])=>wl.map(E=>{let A=D[E];return A&&(!n||E==="ScenariosOverlay"||E==="ImpersonateOverlay")?Fe(A,{},`${F}:${E}`):null})),B&&Fe(Wr,{module:x,tools:d,options:k,isPro:c,tier:u,dev:h})]})}i(So,"ToolRuntime");var Hr=null;function wo(e){!e||e===Hr||(Hr=e,console.warn("[Buoy]",e))}i(wo,"warnOnce");function Wr({module:e,tools:t,options:o,isPro:r,tier:n,dev:a}){let s=Mr(),c=Cr(o,{appName:s.appName,hardwareName:s.hardwareName,platform:s.platform}),u=Dt(()=>Er(o?.socketURL??(a?e.getDefaultSocketURL():gr),!!o?.socketURL,s.platform),[o?.socketURL,a,e,s.platform]),{socket:d}=e.useExternalSyncSocket({deviceName:c?.deviceName??"Buoy Browser",socketURL:u,persistentDeviceId:s.ready?c?.deviceId??null:null,platform:s.platform,extraDeviceInfo:s.extraDeviceInfo,enableLogs:o?.enableLogs});Mt(()=>{let h=Pr(u,s.platform);if(!d||!h)return;let B=i(()=>wo(h),"onError");return d.on("connect_error",B),()=>{d.off("connect_error",B)}},[d,u,s.platform]),Mt(()=>{if(!d)return;let h=i(()=>{if(!d.connected||!pr.hasAccountAccess())return;let B=pr.getState();!r&&(B.isInitialized===false||B.isValidating===true)||d.emit("device-license",{isPro:r?"1":"0",tier:n})},"emit");return h(),d.on("connect",h),()=>{d.off("connect",h)}},[d,r,n]);let f=o?.releaseActions?.join(",")??"",x=Dt(()=>yr(t,a,f?f.split(","):void 0),[t,a,f]);return e.useExternalSync({tools:x,socket:d,deviceId:s.ready?c?.deviceId??null:null,enableLogs:o?.enableLogs}),null}i(Wr,"BrowserExternalSync");import{useState as _r}from"react";import{BuoyPortal as xl}from"@buoy-gg/shared-ui/web/floating";import{useBuoySession as Tl}from"@buoy-gg/license/web";import{Fragment as Ur,jsx as Je,jsxs as Kr}from"react/jsx-runtime";var Vr="#20C997";function qr(){let{status:e,signIn:t,signOut:o}=Tl(),[r,n]=_r(false),[a,s]=_r(null);if(typeof document>"u")return null;let c=i(()=>{s(null),n(true),t().catch(d=>s(d instanceof Error?d.message:"Sign-in did not work. Try again.")).finally(()=>n(false))},"start"),u=e.state==="active";return Je(xl,{children: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:u||a?"12px 14px":0,borderRadius:16,background:u||a?"#0f1419":"transparent",color:"#e6edf3",boxShadow:u||a?"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:u?Kr(Ur,{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:Il,"data-testid":"buoy-signout",children:"Sign out"})]}):Kr(Ur,{children:[a?Je("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:a}):null,Je("button",{type:"button",onClick:c,disabled:r,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:Vr,color:"#04130d",fontWeight:600,fontSize:14,cursor:r?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:r?"Signing in\u2026":"Sign in to Buoy"})]})})})}i(qr,"BuoySignIn");var Il={marginTop:8,padding:0,border:"none",background:"none",color:Vr,fontSize:14,cursor:"pointer",textDecoration:"underline"};import{LicenseManager as id}from"@buoy-gg/license/web";var Cl=false;function Gr(){if(!Cl){try{let e=process.env.EXPO_PUBLIC_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}}i(Gr,"defaultLicenseKey");import{useState as kl}from"react";import{AccountSetupButton as zl,BuoyNeedsPlanCard as Al,BuoySignInCard as Bl,useSignInState as Rl}from"@buoy-gg/shared-ui/web";import{jsx as lt,jsxs as Jr}from"react/jsx-runtime";function xo({needsPlan:e=false}){let[t,o]=kl(false),r=Rl();return Jr(H,{pointerEvents:"box-none",style:Yr.root,children:[lt(zl,{expanded:t,onPress:()=>o(true)}),t?lt(mi,{visible:true,transparent:true,animationType:"fade",onRequestClose:()=>o(false),children:Jr(H,{style:Yr.overlay,accessibilityViewIsModal:true,children:[lt(pi,{style:dt.absoluteFill,onPress:()=>o(false),accessible:false}),e&&r==="active"?lt(Al,{onClose:()=>o(false)}):lt(Bl,{onClose:()=>o(false)})]})}):null]})}i(xo,"BuoySignIn");var Yr=dt.create({root:{position:"absolute",bottom:30,right:16,zIndex:99999},overlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.65)",alignItems:"center",justifyContent:"center",padding:20}});function To(e){if(e.length>6){let t=e.map(o=>`"${o}"`).join(", ");return e.slice(0,6)}return e}i(To,"validateDialConfig");import{installedTools as Ml,installedToolsFound as Dl}from"@buoy-gg/core/web/installed-tools";import{Fragment as Io,jsx as $,jsxs as ct}from"react/jsx-runtime";var Xr={},Qr="@react_buoy_floating_menu_tooltip_shown",Ol=Oe;function Zr({size:e=14,color:t="#20C997"}){let o=Math.max(2,e/4),r=Math.max(1,e/16);return $("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:r,width:e,height:e,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((n,a)=>$("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:t}},a))})}i(Zr,"MenuLauncherIcon");function ei(e){let{defaultFloatingTools:t,defaultDialTools:o,disableHints:r=false,children:n}=e,a=ge(()=>o&&To(o),[o]);return $(Yt,{defaultFloatingTools:t,defaultDialTools:a,children:$(ki,{disableHints:r,children:ct(ro,{children:[$(qn,{children:$(ai,{...e})}),n]})})})}i(ei,"AdmittedFloatingDevTools");var El=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function ti({modules:e=Xr}){return $(Io,{children:Object.entries(e).flatMap(([t,o])=>El.map(r=>{let n=o[r];return n?$(n,{},`${t}:${r}`):null}))})}i(ti,"StartupCapture");function oi(){let{openApps:e,restore:t}=at();return X(()=>Bo(o=>{let r=e.find(n=>n.id===o);return r?(t(r.instanceId),true):false}),[e,t]),null}i(oi,"WebToolOpenerBridge");function ni(){let e=xi();return zi((e===null?process.env.NODE_ENV:e?"development":"production")??"dev")}i(ni,"defaultEnvironment");function ri(e,t,o,r){let n=i(f=>Object.entries(e).find(([x])=>x.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===f)?.[1],"find"),a=[],s=n("env");t?.length&&s?.createEnvTool&&s.createEnvVarConfig&&a.push(Ge(s.createEnvTool({requiredEnvVars:s.createEnvVarConfig(t)})));let c=n("storage");o?.length&&c?.createStorageTool&&a.push(Ge(c.createStorageTool({requiredStorageKeys:o})));let u=n("ask-buoy"),d=r==="hosted"?u?.hostedAskBuoy?.():r;return d&&u?.createAskBuoyTool&&a.push(Ge(u.createAskBuoyTool(d))),a}i(ri,"configOverrides");function ii(e){if(e.launchMode!=="toggle-only")return;let t=e.isOn;return typeof t=="function"?t():void 0}i(ii,"toggleIsOn");function ai({environment:e,userRole:t="admin",availableEnvironments:o,onEnvironmentSwitch:r,apps:n,modules:a=Xr,externalSync:s,requiredEnvVars:c,sentryGetClient:u,disableHints:d=false,headless:f=false,hidden:x=false,defaultFloatingTools:h,defaultDialTools:B,zustandStores:k,requiredStorageKeys:R,askBuoy:F}){let D=e??ni(),E=ge(()=>B?To(B):void 0,[B]),[A,V]=pt(false),[S,M]=pt(false),[,_]=pt(0);X(()=>Vs.subscribe(()=>_(l=>l+1)),[]);let T=Ro(false),P=at(),Q=ge(()=>ri(a,c,R,F),[a,c,R,F]),{allowedTools:Z}=Ao(),U=ge(()=>Ei(Lt([...mo(a),...n??[],...Q]),Z),[n,a,Q,Z]),{openApps:q,close:ie}=P;X(()=>{if(Z)for(let l of q)Pi(l.id,Z)||ie(l.instanceId)},[q,Z,ie]);let ee=ge(()=>Object.entries(a).find(([l])=>l.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[a]);X(()=>{if(!k||typeof ee?.watchStores!="function")return;let l=ee.watchStores(k);return typeof l=="function"?l:void 0},[k,ee]);let ne=it(),xe=P.openApps.some(l=>!l.minimized);X(()=>{ne.setDialOpen(A)},[A,ne.setDialOpen]),X(()=>{ne.setToolOpen(xe||S)},[xe,S,ne.setToolOpen]);let{registerApps:fe}=P;X(()=>{fe(U.map(l=>{let v=l.icon;return{...l,icon:typeof v=="function"?({size:C})=>v(C):v}}))},[fe,U]);let ye=ge(()=>U.map(l=>({id:l.id,name:l.name,description:l.description,slot:l.slot})),[U]);Bi({availableTools:ye,storage:Ol}),X(()=>{let l=false;return i(async()=>{let[v,C]=await Promise.all([Oe.getItem(ft.dial.isOpen()),Oe.getItem(ft.settings.modalOpen())]);l||(v==="true"&&V(true),C==="true"&&(V(true),M(true)),T.current=true)},"restore")(),()=>{l=true}},[]),X(()=>{T.current&&Oe.setItem(ft.dial.isOpen(),A?"true":"false")},[A]),X(()=>{T.current&&Oe.setItem(ft.settings.modalOpen(),S?"true":"false")},[S]);let W=We(l=>{if(pn(l.id),l.launchMode==="toggle-only"){l.onPress?.(),_(v=>v+1);return}if(l.component){let v=typeof l.icon=="function"?l.icon(20):l.icon;P.open({id:l.id,title:l.name||mt(l.id),component:l.component,props:l.props,modal:l.modal,launchMode:l.launchMode||"self-modal",singleton:l.singleton??true,icon:v,color:l.color||Mo(l.id)})}else l.onPress?.()},[P]),Te=Ro({tools:U,openApps:P.openApps,openTool:W});Te.current={tools:U,openApps:P.openApps,openTool:W},X(()=>Bo(l=>{let{tools:v,openApps:C,openTool:G}=Te.current;if(C.some(m=>m.id===l))return false;let J=v.find(m=>m.id===l);return!J||J.launchMode==="toggle-only"?false:(G(J),true)}),[]);let be=ge(()=>gt(U,"dial").map(l=>{let v=l.color||Mo(l.id),C;return typeof l.icon=="string"?C=l.icon:typeof l.icon=="function"?C=l.icon(32):C=null,{id:l.id,name:l.name||mt(l.id),icon:C,unavailable:!l.component&&!l.onPress,color:v,onPress:i(()=>{W(l),V(false)},"onPress")}}),[U,W]),Be=ge(()=>{if(!A)return be;let l=new Map(be.map(v=>[v.id,v]));return un(be.map(v=>v.id)).map(v=>l.get(v)).filter(v=>!!v)},[A,be]),{settings:Ie}=An(),pe=ge(()=>gt(U,"row").filter(l=>(Ie.floatingTools[l.id]??false)===true&&(l.component||l.onPress)),[U,Ie.floatingTools]),oe=ge(()=>U.map(l=>({id:l.id,name:l.name||mt(l.id),description:l.description||Ri(l.id),slot:l.slot,icon:l.icon,color:l.color})),[U]),[Re,me]=pt(false),Ce=P.openApps.some(l=>!l.minimized);X(()=>{if(d)return;let l=false,v=setTimeout(async()=>{let C=await Oe.getItem(Qr);!l&&!C&&me(true)},1e3);return()=>{l=true,clearTimeout(v)}},[d]);let ae=We(()=>{me(false),Oe.setItem(Qr,"true")},[]),ve=We(()=>{ae(),V(true)},[ae]),Ye=We(()=>{V(false),M(false)},[]),$e=We(()=>{M(l=>!l)},[]),ke=We(()=>M(false),[]),Me=!!(o?.length&&r),je=Ie.floatingTools.environment!==false,se=Re&&!A&&!Ce&&!x;X(()=>{if(!se)return;let l=i(C=>{(!(C.target instanceof Element)||!C.target.closest("[data-buoy-root]"))&&ae()},"onPointerDown"),v=i(C=>{C.key==="Escape"&&ae()},"onKeyDown");return document.addEventListener("pointerdown",l,true),document.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",l,true),document.removeEventListener("keydown",v)}},[se,ae]);let O=P.openApps.some(l=>l.minimized&&l.launchMode!=="toggle-only"),w=$(jr,{modules:a,apps:n,requiredEnvVars:c,externalSync:s,headless:f,sentryGetClient:u});return f?w:ct("div",{"data-buoy-root":"",style:{display:"contents"},children:[w,$(oi,{}),se&&$("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),$("div",{style:x?{visibility:"hidden"}:{display:"contents"},"aria-hidden":x||void 0,children:ct(Eo,{enablePositionPersistence:!se,pushToSide:A||Ce,suspendPointerEvents:A,centerOnboarding:se,minimizedStack:O?$(dr,{}):void 0,hasMinimizedStack:O,children:[D&&je&&!Me&&$(Mi,{environment:D}),Me&&je&&$(Di,{currentEnvironment:D??"local",availableEnvironments:o,onSelect:r}),t?$(Po,{userRole:t,onPress:ve}):$("button",{"aria-label":"Open dev tools",onClick:ve,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:$(Zr,{})}),pe.map(l=>$("button",{"aria-label":l.name||mt(l.id),"aria-pressed":ii(l),title:l.description,onClick:()=>W(l),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof l.icon=="function"?l.icon(16):l.icon},l.id))]})}),se&&$(jt,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:ae}),A&&!x&&$(Ut,{icons:Be,onClose:Ye,centerLabel:"BUOY",onCenterPress:$e,settingsOpen:S,hintsDisabled:d,emptyNote:Z&&Be.length===0?Li:void 0}),S&&!x&&$(to,{visible:true,onClose:ke,availableTools:oe,defaultFloatingTools:h,defaultDialTools:E,onSettingsChange:l=>{}}),!x&&ct(Io,{children:[$(Gn,{}),$(yi,{})]})]})}i(ai,"FloatingDevToolsInner");function si(e){let t=e&&typeof e=="object"?e.appId:void 0,o=!!e;X(()=>{if(!o)return;let r=false,n=bi.SessionManager;if(!n)return;let a=i(s=>{r||!s||(n.configure({audience:`app:${s}`}),n.load().catch(()=>{}))},"apply");return t?a(t):Ii().then(s=>a(s?.bundleId)).catch(()=>{}),()=>{r=true}},[o,t])}i(si,"useCapacitorSignInAudience");var li=false;function ci(e){return e.modules?e:(!Dl&&!li&&typeof console<"u"&&(li=true,console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")),{...e,modules:Ml})}i(ci,"withInstalledTools");function di(e){return $(hi,{children:$(ui,{...ci(e)})})}i(di,"FloatingDevTools");function ui(e){let{access:t,isPro:o,licenseKey:r}=Ao();X(()=>{vi.configure(e.licenseKey??Gr())},[e.licenseKey]);let n=e.licenseKey===void 0||Si(e.licenseKey,r),a=wi(typeof He<"u"?He:process.env.NODE_ENV!=="production"),s=n&&t.status==="admitted";X(()=>{s&&Ai()},[s]),X(()=>{a||t.status==="initializing"||(o&&s?fi():gi())},[a,o,s,t.status]);let c=Ti();return si(c?e.signIn:void 0),!a&&!o?!e.signIn||e.headless?null:c?$(xo,{needsPlan:true}):$(qr,{}):s?$(ei,{...e}):ct(Io,{children:[t.status==="initializing"&&$(ti,{modules:e.modules}),e.headless?null:e.signIn&&c?$(xo,{}):$(Ci,{})]})}i(ui,"FloatingDevToolsContent");export{Oi as a,Do as b,Lt as c,gt as d,Oo as e,Eo as f,Fi as g,Po as h,tn as i,Ut as j,to as k,no as l,Fn as m,ro as n,it as o,qn as p,at as q,Gn as r,Ge as s,mo as t,$r as u,di as v};