@buoy-gg/core 7.0.74 → 7.0.76

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 (50) hide show
  1. package/bin/buoy.js +5 -5
  2. package/bundlers/vite.d.ts +11 -4
  3. package/bundlers/vite.mjs +4 -4
  4. package/lib/commonjs/floatingMenu/AppHost.web.js +1 -1
  5. package/lib/commonjs/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
  6. package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -1
  7. package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +1 -1
  8. package/lib/commonjs/floatingMenu/FloatingMenu.js +1 -1
  9. package/lib/commonjs/floatingMenu/TeamToolCloser.js +1 -0
  10. package/lib/commonjs/floatingMenu/dial/DialDevTools.js +1 -1
  11. package/lib/commonjs/floatingMenu/dial/DialDevTools.web.js +1 -1
  12. package/lib/commonjs/floatingMenu/teamToolsNote.js +1 -0
  13. package/lib/commonjs/telemetry/installPing.js +1 -1
  14. package/lib/commonjs/version.js +1 -1
  15. package/lib/module/floatingMenu/AppHost.web.js +1 -1
  16. package/lib/module/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
  17. package/lib/module/floatingMenu/FloatingDevTools.js +1 -1
  18. package/lib/module/floatingMenu/FloatingDevTools.web.js +1 -1
  19. package/lib/module/floatingMenu/FloatingMenu.js +1 -1
  20. package/lib/module/floatingMenu/TeamToolCloser.js +1 -0
  21. package/lib/module/floatingMenu/dial/DialDevTools.js +1 -1
  22. package/lib/module/floatingMenu/dial/DialDevTools.web.js +1 -1
  23. package/lib/module/floatingMenu/teamToolsNote.js +1 -0
  24. package/lib/module/telemetry/installPing.js +1 -1
  25. package/lib/module/version.js +1 -1
  26. package/lib/typescript/commonjs/Buoy.d.ts +2 -0
  27. package/lib/typescript/commonjs/floatingMenu/FloatingMenu.d.ts +2 -0
  28. package/lib/typescript/commonjs/floatingMenu/TeamToolCloser.d.ts +13 -0
  29. package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.d.ts +2 -0
  30. package/lib/typescript/commonjs/floatingMenu/dial/DialDevTools.web.d.ts +3 -1
  31. package/lib/typescript/commonjs/floatingMenu/teamToolsNote.d.ts +6 -0
  32. package/lib/typescript/commonjs/version.d.ts +1 -1
  33. package/lib/typescript/module/Buoy.d.ts +2 -0
  34. package/lib/typescript/module/floatingMenu/FloatingMenu.d.ts +2 -0
  35. package/lib/typescript/module/floatingMenu/TeamToolCloser.d.ts +13 -0
  36. package/lib/typescript/module/floatingMenu/dial/DialDevTools.d.ts +2 -0
  37. package/lib/typescript/module/floatingMenu/dial/DialDevTools.web.d.ts +3 -1
  38. package/lib/typescript/module/floatingMenu/teamToolsNote.d.ts +6 -0
  39. package/lib/typescript/module/version.d.ts +1 -1
  40. package/lib/web/auto.mjs +1 -1
  41. package/lib/web/chunks/FloatingDevTools.web-NMBTDON7.mjs +1 -0
  42. package/lib/web/chunks/chunk-2N5IPIMV.mjs +10 -0
  43. package/lib/web/chunks/chunk-C6HZO5XT.mjs +1 -0
  44. package/lib/web/chunks/chunk-LU4GPZ5L.mjs +2 -2
  45. package/lib/web/chunks/chunk-RBPDZUHO.mjs +1 -1
  46. package/lib/web/chunks/chunk-V4BVRDHL.mjs +1 -0
  47. package/lib/web/chunks/chunk-Z6I7ZD34.mjs +1 -1
  48. package/lib/web/index.mjs +1 -1
  49. package/lib/web/toolkit.mjs +1 -1
  50. package/package.json +5 -5
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DialDevTools=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _DialIcon=require("./DialIcon.js");var _DialHyperspace=require("./DialHyperspace.js");var _DialPagination=require("./DialPagination.js");var _dialUsageStore=require("./dialUsageStore.js");var _DevToolsSettingsModal=require("../DevToolsSettingsModal");var _license=require("@buoy-gg/license");var _AppIcon=require("../AppIcon");var _AppHost=require("../AppHost");var _OnboardingTooltip=require("./OnboardingTooltip");var _floatingToolsCore=require("@buoy-gg/floating-tools-core");var _jsxRuntime=require("react/jsx-runtime");const BUTTON_SIZE=_floatingToolsCore.DIAL_BUTTON_SIZE;const DIAL_BACKGROUND_FOCUS={x:.5,y:.5};const HUB_CLEARANCE=BUTTON_SIZE*.75+6;const DIAL_IDLE_PULSE=false;const ONBOARDING_STORAGE_KEY="@react_buoy_settings_tooltip_shown";const createEmptySlot=r=>({id:`empty-${r}`,name:`empty-${r}`,icon:null,color:"transparent",onPress:()=>{}});const DialDevTools=({onClose:r,onSettingsPress:P,autoOpenSettings:T=false,apps:m,state:oe,actions:D})=>{const[N,F]=(0,_react.useState)(-1);const[n,l]=(0,_react.useState)(false);const[C,G]=(0,_react.useState)(false);const[I,j]=(0,_react.useState)(false);const y=(0,_react.useRef)(false);const k=(0,_sharedUi.useHintsDisabled)();const{refreshSettings:q}=(0,_DevToolsSettingsModal.useDevToolsSettings)();const{open:L}=(0,_AppHost.useAppHost)();const{isPro:U,isWeekendFree:_}=(0,_license.useProAccess)();const{width:b,height:z}=(0,_reactNative.useWindowDimensions)();const i=(0,_floatingToolsCore.getDialLayout)({screenWidth:b}).circleSize;const{id:H}=(0,_sharedUi.useToolBackground)();const a=(0,_react.useMemo)(()=>({parent:{width:i,height:i},circle:{width:i,height:i,borderRadius:i/2},rounded:{borderRadius:i/2},gridLine:{width:i},spoke:{width:i/2-HUB_CLEARANCE}}),[i]);(0,_react.useEffect)(()=>{const t=async()=>{try{const e=await _sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.settings.modalOpen());if(e==="true"){l(true)}}catch(e){}finally{G(true)}};t()},[]);(0,_react.useEffect)(()=>{if(!C)return;_sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.modalOpen(),n?"true":"false").catch(t=>{console.warn("[Buoy]","Failed to save settings modal state:",t)})},[n,C]);(0,_react.useEffect)(()=>{if(T&&!n){l(true)}},[T,n]);(0,_react.useEffect)(()=>{if(k){return}const t=async()=>{try{const e=await _sharedUi.persistentStorage.getItem(ONBOARDING_STORAGE_KEY);if(!e){setTimeout(()=>{j(true)},1200)}}catch(e){}};t()},[k]);const S=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const d=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const x=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const c=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const f=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const v=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current;const W=(0,_react.useMemo)(()=>m.map(({id:t,name:e,slot:o,description:p,icon:ee,color:te})=>({id:t,name:e,slot:o,description:p,icon:ee,color:te})),[m]);const u=(0,_react.useRef)(null);const X=()=>{if(n){l(false);return}l(true);if(I&&!y.current){E()}P?.()};const g=(0,_react.useMemo)(()=>m.filter(t=>(t.slot??"both")!=="row"),[m]);const O=(0,_react.useMemo)(()=>{const t=new Map;for(const e of g){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??_sharedUi.buoyColors.primary,onPress:()=>{void(0,_dialUsageStore.recordToolUsage)(e.id);e?.onPress?.(D);if(e.launchMode!=="toggle-only"){const o=(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color});L({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:o,color:e.color,modal:e.modal})}r?.()}})}return t},[g,D,L,r]);const[A,V]=(0,_react.useState)(()=>(0,_dialUsageStore.getRankedToolIds)(g.map(t=>t.id)));(0,_react.useEffect)(()=>{const t=g.map(o=>o.id);if((0,_dialUsageStore.isDialUsageLoaded)()){V((0,_dialUsageStore.getRankedToolIds)(t));return}let e=false;(0,_dialUsageStore.loadDialUsage)().then(()=>{if(!e)V((0,_dialUsageStore.getRankedToolIds)(t))});return()=>{e=true}},[g]);const h=Math.max(1,Math.ceil(A.length/_floatingToolsCore.MAX_DIAL_SLOTS));const[$,K]=(0,_react.useState)(0);const s=Math.min($,h-1);const w=(0,_react.useMemo)(()=>{return A.map(t=>O.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/_floatingToolsCore.MAX_DIAL_SLOTS),slot:e%_floatingToolsCore.MAX_DIAL_SLOTS}))},[A,O]);const Y=(0,_react.useMemo)(()=>{const t=w.filter(o=>o.page===s).length;const e=[];for(let o=t;o<_floatingToolsCore.MAX_DIAL_SLOTS;o+=1)e.push(o);return e},[w,s]);const R=t=>{const e=Math.max(0,Math.min(t,h-1));if(e!==s)K(e)};(0,_react.useEffect)(()=>{const t=_floatingToolsCore.dialAnimationConfig??{entrance:{backdrop:{duration:400},dial:{scale:{damping:15,stiffness:150,mass:1},rotation:{duration:800}},centerButton:{delay:150,damping:10,stiffness:200},icons:{delay:200,duration:400},circuitTraces:{delay:600,duration:1e3}},continuous:{glitch:{interval:3e3,offset:2,stepDuration:50},pulse:{maxScale:1.02,minScale:.98,duration:1e3},floating:{maxY:-8,minY:0,duration:3e3},breathing:{maxScale:1.05,minScale:.98,duration:2500}}};const{entrance:e,continuous:o}=t;_reactNative.Animated.timing(S,{toValue:1,duration:e.backdrop.duration,useNativeDriver:true}).start();_reactNative.Animated.spring(d,{toValue:1,damping:e.dial.scale.damping,stiffness:e.dial.scale.stiffness,mass:e.dial.scale.mass,useNativeDriver:true}).start();_reactNative.Animated.sequence([_reactNative.Animated.timing(x,{toValue:1,duration:e.dial.rotation.duration,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.timing(x,{toValue:0,duration:0,useNativeDriver:true})]).start();_reactNative.Animated.sequence([_reactNative.Animated.delay(e.centerButton.delay),_reactNative.Animated.spring(c,{toValue:1,damping:e.centerButton.damping,stiffness:e.centerButton.stiffness,useNativeDriver:true})]).start();_reactNative.Animated.sequence([_reactNative.Animated.delay(e.icons.delay),_reactNative.Animated.timing(f,{toValue:1,duration:e.icons.duration,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:true})]).start();if(!DIAL_IDLE_PULSE)return;u.current=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(v,{toValue:o.pulse.maxScale,duration:o.pulse.duration,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:true}),_reactNative.Animated.timing(v,{toValue:o.pulse.minScale,duration:o.pulse.duration,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:true})]));u.current.start();return()=>{u.current?.stop()}},[]);const E=()=>{y.current=true;j(false);_sharedUi.persistentStorage.setItem(ONBOARDING_STORAGE_KEY,"true").catch(t=>{console.warn("[Buoy]","Failed to save dial onboarding state:",t)})};const M=()=>{if(u.current){u.current.stop()}const t=_floatingToolsCore.dialAnimationConfig?.exit??{icons:{duration:300},centerButton:{duration:200},dialScale:{duration:250},backdrop:{duration:200}};_reactNative.Animated.sequence([_reactNative.Animated.timing(f,{toValue:0,duration:t.icons.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.parallel([_reactNative.Animated.timing(c,{toValue:0,duration:t.centerButton.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.timing(d,{toValue:0,duration:t.dialScale.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true})]),_reactNative.Animated.timing(S,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(r){setTimeout(()=>{r()},0)}})};const B=t=>{F(1);const e=_floatingToolsCore.dialAnimationConfig?.interaction??{iconSelect:{pulse:[{scale:.9,damping:15,stiffness:500},{scale:1,damping:10,stiffness:200}],actionDelay:50}};const[o,p]=e.iconSelect.pulse;_reactNative.Animated.sequence([_reactNative.Animated.spring(c,{toValue:o.scale,damping:o.damping,stiffness:o.stiffness,useNativeDriver:true}),_reactNative.Animated.spring(c,{toValue:p.scale,damping:p.damping,stiffness:p.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){M()}},e.iconSelect.actionDelay)};const Z={opacity:S};const J={transform:[{scale:c}]};const Q={transform:[{scale:N>=0?1:v}]};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,nativeID:"dial-devtools-root",children:[(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.backdrop,Z],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_sharedUi.absoluteFill,onPress:M})}),(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[styles.parent,a.parent,{position:"absolute",left:(b-i)/2,bottom:80,transform:[{scale:d},{rotate:x.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[styles.circle,a.circle],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.gradientBackground,a.rounded],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer1,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer2,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer3,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.gridPattern,children:Array.from({length:6}).map((t,e)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.gridLine,a.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spoke,a.spoke,styles.spokeLeft]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spoke,a.spoke,styles.spokeRight]})]},e))}),H==="hyperspace"?(0,_jsxRuntime.jsx)(_DialHyperspace.DialHyperspace,{size:i}):(0,_jsxRuntime.jsx)(_sharedUi.ToolBackground,{focus:DIAL_BACKGROUND_FOCUS})]}),w.filter(({page:t})=>t===s).map(({icon:t,slot:e})=>(0,_jsxRuntime.jsx)(_DialIcon.DialIcon,{onPress:B,iconsProgress:f,icon:t,index:e,totalIcons:_floatingToolsCore.MAX_DIAL_SLOTS,active:true},t.id??`page${s}-${e}`)),Y.map(t=>(0,_jsxRuntime.jsx)(_DialIcon.DialIcon,{onPress:B,iconsProgress:f,icon:createEmptySlot(t),index:t,totalIcons:_floatingToolsCore.MAX_DIAL_SLOTS,active:true},`empty-${t}`))]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.buttonContainer,J],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.buttonGradient,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer1}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer2}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer3}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonBorder,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.button,Q],children:(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityRole:"button",accessibilityLabel:n?"Close Settings":"Open Dev Tools Settings",onPress:X,activeOpacity:.5,style:styles.buttonPressable,children:n?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.centerText,styles.closeTextTop],children:"CLOSE"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.centerText,styles.closeTextBottom],children:"SETTINGS"})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.centerText,children:"BUOY"}),U&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.proText,_&&styles.weekendText],children:_?"WEEKEND":"PRO"})]})})})})]})})]}),h>1&&(0,_jsxRuntime.jsx)(_DialPagination.DialPagination,{page:s,pageCount:h,onPrev:()=>R(s-1),onNext:()=>R(s+1),animatedStyle:{position:"absolute",left:(b-i)/2,top:z-80+16,width:i,opacity:d,transform:[{scale:d}]}}),n&&(0,_jsxRuntime.jsx)(_DevToolsSettingsModal.DevToolsSettingsModal,{visible:true,onClose:()=>{l(false);q()},availableApps:W}),I&&!n&&!y.current&&(0,_jsxRuntime.jsx)(_OnboardingTooltip.OnboardingTooltip,{visible:true,onDismiss:E})]})};exports.DialDevTools=DialDevTools;const styles=_reactNative.StyleSheet.create({container:{..._sharedUi.absoluteFill,zIndex:9999},backdrop:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialBackdrop},parent:{alignItems:"center",justifyContent:"center"},circle:{position:"absolute",backgroundColor:"transparent",borderWidth:1,borderColor:_floatingToolsCore.dialColors.dialBorder,shadowColor:_floatingToolsCore.dialColors.dialShadow,shadowOffset:{width:0,height:0},shadowOpacity:.5,shadowRadius:20,elevation:10},gradientBackground:{width:"100%",height:"100%",position:"relative",backgroundColor:_floatingToolsCore.dialColors.dialBackground,overflow:"hidden"},gradientLayer1:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient1,opacity:.6},gradientLayer2:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient2,opacity:.4,top:"30%",left:"30%"},gradientLayer3:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient3,opacity:.3,top:"50%",left:"50%"},gridPattern:{..._sharedUi.absoluteFill,alignItems:"center",justifyContent:"center"},gridLine:{position:"absolute",height:1},spoke:{position:"absolute",top:0,height:1,backgroundColor:_floatingToolsCore.dialColors.dialGridLine},spokeLeft:{left:0},spokeRight:{right:0},buttonContainer:{zIndex:1,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",position:"absolute",width:BUTTON_SIZE*1.5,height:BUTTON_SIZE*1.5,borderRadius:BUTTON_SIZE},buttonGradient:{width:"100%",height:"100%",borderRadius:BUTTON_SIZE,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:_floatingToolsCore.dialColors.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient1,opacity:.5,borderRadius:BUTTON_SIZE},buttonGradientLayer2:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:BUTTON_SIZE},buttonGradientLayer3:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:BUTTON_SIZE},buttonBorder:{backgroundColor:_floatingToolsCore.dialColors.hubFill,alignItems:"center",justifyContent:"center",width:BUTTON_SIZE*1.2,height:BUTTON_SIZE*1.2,borderRadius:BUTTON_SIZE*.6},button:{width:BUTTON_SIZE,height:BUTTON_SIZE,borderRadius:BUTTON_SIZE/2,justifyContent:"center",alignItems:"center",position:"relative",overflow:"hidden"},buttonPressable:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},centerText:{color:_floatingToolsCore.dialColors.centerText,fontSize:10,fontWeight:"900",fontFamily:_sharedUi.monoFont,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:_floatingToolsCore.dialColors.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},closeTextBottom:{marginTop:-2},proText:{color:_sharedUi.buoyColors.warning,fontSize:8,fontWeight:"900",fontFamily:_sharedUi.monoFont,letterSpacing:2,textAlign:"center",textShadowColor:_floatingToolsCore.dialColors.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},weekendText:{color:"#BF5AF2",letterSpacing:1}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DialDevTools=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _DialIcon=require("./DialIcon.js");var _DialHyperspace=require("./DialHyperspace.js");var _DialPagination=require("./DialPagination.js");var _dialUsageStore=require("./dialUsageStore.js");var _DevToolsSettingsModal=require("../DevToolsSettingsModal");var _license=require("@buoy-gg/license");var _AppIcon=require("../AppIcon");var _AppHost=require("../AppHost");var _OnboardingTooltip=require("./OnboardingTooltip");var _floatingToolsCore=require("@buoy-gg/floating-tools-core");var _jsxRuntime=require("react/jsx-runtime");const BUTTON_SIZE=_floatingToolsCore.DIAL_BUTTON_SIZE;const DIAL_BACKGROUND_FOCUS={x:.5,y:.5};const HUB_CLEARANCE=BUTTON_SIZE*.75+6;const DIAL_IDLE_PULSE=false;const ONBOARDING_STORAGE_KEY="@react_buoy_settings_tooltip_shown";const createEmptySlot=r=>({id:`empty-${r}`,name:`empty-${r}`,icon:null,color:"transparent",onPress:()=>{}});const DialDevTools=({onClose:r,onSettingsPress:F,autoOpenSettings:T=false,apps:m,emptyNote:D,state:ie,actions:C})=>{const[N,G]=(0,_react.useState)(-1);const[n,d]=(0,_react.useState)(false);const[I,q]=(0,_react.useState)(false);const[j,k]=(0,_react.useState)(false);const y=(0,_react.useRef)(false);const L=(0,_sharedUi.useHintsDisabled)();const{refreshSettings:U}=(0,_DevToolsSettingsModal.useDevToolsSettings)();const{open:_}=(0,_AppHost.useAppHost)();const{isPro:z,isWeekendFree:O}=(0,_license.useProAccess)();const{width:b,height:H}=(0,_reactNative.useWindowDimensions)();const i=(0,_floatingToolsCore.getDialLayout)({screenWidth:b}).circleSize;const{id:W}=(0,_sharedUi.useToolBackground)();const a=(0,_react.useMemo)(()=>({parent:{width:i,height:i},circle:{width:i,height:i,borderRadius:i/2},rounded:{borderRadius:i/2},gridLine:{width:i},spoke:{width:i/2-HUB_CLEARANCE}}),[i]);(0,_react.useEffect)(()=>{const t=async()=>{try{const e=await _sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.settings.modalOpen());if(e==="true"){d(true)}}catch(e){}finally{q(true)}};t()},[]);(0,_react.useEffect)(()=>{if(!I)return;_sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.modalOpen(),n?"true":"false").catch(t=>{console.warn("[Buoy]","Failed to save settings modal state:",t)})},[n,I]);(0,_react.useEffect)(()=>{if(T&&!n){d(true)}},[T,n]);(0,_react.useEffect)(()=>{if(L){return}const t=async()=>{try{const e=await _sharedUi.persistentStorage.getItem(ONBOARDING_STORAGE_KEY);if(!e){setTimeout(()=>{k(true)},1200)}}catch(e){}};t()},[L]);const S=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const c=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const x=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const u=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const f=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const v=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current;const $=(0,_react.useMemo)(()=>m.map(({id:t,name:e,slot:o,description:p,icon:te,color:oe})=>({id:t,name:e,slot:o,description:p,icon:te,color:oe})),[m]);const g=(0,_react.useRef)(null);const X=()=>{if(n){d(false);return}d(true);if(j&&!y.current){M()}F?.()};const l=(0,_react.useMemo)(()=>m.filter(t=>(t.slot??"both")!=="row"),[m]);const R=(0,_react.useMemo)(()=>{const t=new Map;for(const e of l){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??_sharedUi.buoyColors.primary,onPress:()=>{void(0,_dialUsageStore.recordToolUsage)(e.id);e?.onPress?.(C);if(e.launchMode!=="toggle-only"){const o=(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color});_({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:o,color:e.color,modal:e.modal})}r?.()}})}return t},[l,C,_,r]);const[A,V]=(0,_react.useState)(()=>(0,_dialUsageStore.getRankedToolIds)(l.map(t=>t.id)));(0,_react.useEffect)(()=>{const t=l.map(o=>o.id);if((0,_dialUsageStore.isDialUsageLoaded)()){V((0,_dialUsageStore.getRankedToolIds)(t));return}let e=false;(0,_dialUsageStore.loadDialUsage)().then(()=>{if(!e)V((0,_dialUsageStore.getRankedToolIds)(t))});return()=>{e=true}},[l]);const h=Math.max(1,Math.ceil(A.length/_floatingToolsCore.MAX_DIAL_SLOTS));const[K,Y]=(0,_react.useState)(0);const s=Math.min(K,h-1);const w=(0,_react.useMemo)(()=>{return A.map(t=>R.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/_floatingToolsCore.MAX_DIAL_SLOTS),slot:e%_floatingToolsCore.MAX_DIAL_SLOTS}))},[A,R]);const Z=(0,_react.useMemo)(()=>{const t=w.filter(o=>o.page===s).length;const e=[];for(let o=t;o<_floatingToolsCore.MAX_DIAL_SLOTS;o+=1)e.push(o);return e},[w,s]);const E=t=>{const e=Math.max(0,Math.min(t,h-1));if(e!==s)Y(e)};(0,_react.useEffect)(()=>{const t=_floatingToolsCore.dialAnimationConfig??{entrance:{backdrop:{duration:400},dial:{scale:{damping:15,stiffness:150,mass:1},rotation:{duration:800}},centerButton:{delay:150,damping:10,stiffness:200},icons:{delay:200,duration:400},circuitTraces:{delay:600,duration:1e3}},continuous:{glitch:{interval:3e3,offset:2,stepDuration:50},pulse:{maxScale:1.02,minScale:.98,duration:1e3},floating:{maxY:-8,minY:0,duration:3e3},breathing:{maxScale:1.05,minScale:.98,duration:2500}}};const{entrance:e,continuous:o}=t;_reactNative.Animated.timing(S,{toValue:1,duration:e.backdrop.duration,useNativeDriver:true}).start();_reactNative.Animated.spring(c,{toValue:1,damping:e.dial.scale.damping,stiffness:e.dial.scale.stiffness,mass:e.dial.scale.mass,useNativeDriver:true}).start();_reactNative.Animated.sequence([_reactNative.Animated.timing(x,{toValue:1,duration:e.dial.rotation.duration,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.timing(x,{toValue:0,duration:0,useNativeDriver:true})]).start();_reactNative.Animated.sequence([_reactNative.Animated.delay(e.centerButton.delay),_reactNative.Animated.spring(u,{toValue:1,damping:e.centerButton.damping,stiffness:e.centerButton.stiffness,useNativeDriver:true})]).start();_reactNative.Animated.sequence([_reactNative.Animated.delay(e.icons.delay),_reactNative.Animated.timing(f,{toValue:1,duration:e.icons.duration,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:true})]).start();if(!DIAL_IDLE_PULSE)return;g.current=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(v,{toValue:o.pulse.maxScale,duration:o.pulse.duration,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:true}),_reactNative.Animated.timing(v,{toValue:o.pulse.minScale,duration:o.pulse.duration,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:true})]));g.current.start();return()=>{g.current?.stop()}},[]);const M=()=>{y.current=true;k(false);_sharedUi.persistentStorage.setItem(ONBOARDING_STORAGE_KEY,"true").catch(t=>{console.warn("[Buoy]","Failed to save dial onboarding state:",t)})};const B=()=>{if(g.current){g.current.stop()}const t=_floatingToolsCore.dialAnimationConfig?.exit??{icons:{duration:300},centerButton:{duration:200},dialScale:{duration:250},backdrop:{duration:200}};_reactNative.Animated.sequence([_reactNative.Animated.timing(f,{toValue:0,duration:t.icons.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.parallel([_reactNative.Animated.timing(u,{toValue:0,duration:t.centerButton.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.timing(c,{toValue:0,duration:t.dialScale.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true})]),_reactNative.Animated.timing(S,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(r){setTimeout(()=>{r()},0)}})};const P=t=>{G(1);const e=_floatingToolsCore.dialAnimationConfig?.interaction??{iconSelect:{pulse:[{scale:.9,damping:15,stiffness:500},{scale:1,damping:10,stiffness:200}],actionDelay:50}};const[o,p]=e.iconSelect.pulse;_reactNative.Animated.sequence([_reactNative.Animated.spring(u,{toValue:o.scale,damping:o.damping,stiffness:o.stiffness,useNativeDriver:true}),_reactNative.Animated.spring(u,{toValue:p.scale,damping:p.damping,stiffness:p.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){B()}},e.iconSelect.actionDelay)};const J={opacity:S};const Q={transform:[{scale:u}]};const ee={transform:[{scale:N>=0?1:v}]};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,nativeID:"dial-devtools-root",children:[(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.backdrop,J],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_sharedUi.absoluteFill,onPress:B})}),l.length===0&&D?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.emptyNote,{bottom:80+i+16}],accessibilityLiveRegion:"polite",testID:"buoy-dial-empty-note",children:D}):null,(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[styles.parent,a.parent,{position:"absolute",left:(b-i)/2,bottom:80,transform:[{scale:c},{rotate:x.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[styles.circle,a.circle],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.gradientBackground,a.rounded],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer1,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer2,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer3,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.gridPattern,children:Array.from({length:6}).map((t,e)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.gridLine,a.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spoke,a.spoke,styles.spokeLeft]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spoke,a.spoke,styles.spokeRight]})]},e))}),W==="hyperspace"?(0,_jsxRuntime.jsx)(_DialHyperspace.DialHyperspace,{size:i}):(0,_jsxRuntime.jsx)(_sharedUi.ToolBackground,{focus:DIAL_BACKGROUND_FOCUS})]}),w.filter(({page:t})=>t===s).map(({icon:t,slot:e})=>(0,_jsxRuntime.jsx)(_DialIcon.DialIcon,{onPress:P,iconsProgress:f,icon:t,index:e,totalIcons:_floatingToolsCore.MAX_DIAL_SLOTS,active:true},`${t.id??"icon"}:${s}:${e}`)),Z.map(t=>(0,_jsxRuntime.jsx)(_DialIcon.DialIcon,{onPress:P,iconsProgress:f,icon:createEmptySlot(t),index:t,totalIcons:_floatingToolsCore.MAX_DIAL_SLOTS,active:true},`empty-${t}`))]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.buttonContainer,Q],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.buttonGradient,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer1}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer2}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer3}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonBorder,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.button,ee],children:(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityRole:"button",accessibilityLabel:n?"Close Settings":"Open Dev Tools Settings",onPress:X,activeOpacity:.5,style:styles.buttonPressable,children:n?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.centerText,styles.closeTextTop],children:"CLOSE"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.centerText,styles.closeTextBottom],children:"SETTINGS"})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.centerText,children:"BUOY"}),z&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.proText,O&&styles.weekendText],children:O?"WEEKEND":"PRO"})]})})})})]})})]}),h>1&&(0,_jsxRuntime.jsx)(_DialPagination.DialPagination,{page:s,pageCount:h,onPrev:()=>E(s-1),onNext:()=>E(s+1),animatedStyle:{position:"absolute",left:(b-i)/2,top:H-80+16,width:i,opacity:c,transform:[{scale:c}]}}),n&&(0,_jsxRuntime.jsx)(_DevToolsSettingsModal.DevToolsSettingsModal,{visible:true,onClose:()=>{d(false);U()},availableApps:$}),j&&!n&&!y.current&&(0,_jsxRuntime.jsx)(_OnboardingTooltip.OnboardingTooltip,{visible:true,onDismiss:M})]})};exports.DialDevTools=DialDevTools;const styles=_reactNative.StyleSheet.create({container:{..._sharedUi.absoluteFill,zIndex:9999},backdrop:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialBackdrop},parent:{alignItems:"center",justifyContent:"center"},circle:{position:"absolute",backgroundColor:"transparent",borderWidth:1,borderColor:_floatingToolsCore.dialColors.dialBorder,shadowColor:_floatingToolsCore.dialColors.dialShadow,shadowOffset:{width:0,height:0},shadowOpacity:.5,shadowRadius:20,elevation:10},gradientBackground:{width:"100%",height:"100%",position:"relative",backgroundColor:_floatingToolsCore.dialColors.dialBackground,overflow:"hidden"},gradientLayer1:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient1,opacity:.6},gradientLayer2:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient2,opacity:.4,top:"30%",left:"30%"},gradientLayer3:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient3,opacity:.3,top:"50%",left:"50%"},gridPattern:{..._sharedUi.absoluteFill,alignItems:"center",justifyContent:"center"},gridLine:{position:"absolute",height:1},spoke:{position:"absolute",top:0,height:1,backgroundColor:_floatingToolsCore.dialColors.dialGridLine},spokeLeft:{left:0},spokeRight:{right:0},buttonContainer:{zIndex:1,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",position:"absolute",width:BUTTON_SIZE*1.5,height:BUTTON_SIZE*1.5,borderRadius:BUTTON_SIZE},buttonGradient:{width:"100%",height:"100%",borderRadius:BUTTON_SIZE,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:_floatingToolsCore.dialColors.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient1,opacity:.5,borderRadius:BUTTON_SIZE},buttonGradientLayer2:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:BUTTON_SIZE},buttonGradientLayer3:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:BUTTON_SIZE},buttonBorder:{backgroundColor:_floatingToolsCore.dialColors.hubFill,alignItems:"center",justifyContent:"center",width:BUTTON_SIZE*1.2,height:BUTTON_SIZE*1.2,borderRadius:BUTTON_SIZE*.6},button:{width:BUTTON_SIZE,height:BUTTON_SIZE,borderRadius:BUTTON_SIZE/2,justifyContent:"center",alignItems:"center",position:"relative",overflow:"hidden"},buttonPressable:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},centerText:{color:_floatingToolsCore.dialColors.centerText,fontSize:10,fontWeight:"900",fontFamily:_sharedUi.monoFont,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:_floatingToolsCore.dialColors.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},emptyNote:{position:"absolute",left:16,right:16,color:_floatingToolsCore.dialColors.iconLabel,fontSize:12,fontFamily:_sharedUi.monoFont,textAlign:"center"},closeTextBottom:{marginTop:-2},proText:{color:_sharedUi.buoyColors.warning,fontSize:8,fontWeight:"900",fontFamily:_sharedUi.monoFont,letterSpacing:2,textAlign:"center",textShadowColor:_floatingToolsCore.dialColors.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},weekendText:{color:"#BF5AF2",letterSpacing:1}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DialMenu=DialMenu;var _react=require("react");var _dialA11y=require("./dialA11y.js");var _floatingToolsReact=require("@buoy-gg/floating-tools-react");var _sharedUi=require("@buoy-gg/shared-ui");var _DialHyperspace=require("./DialHyperspace.js");var _OnboardingTooltipWeb=require("./OnboardingTooltip.web.js");var _jsxRuntime=require("react/jsx-runtime");const DIAL_BACKGROUND_FOCUS={x:.5,y:.5};const SETTINGS_TOOLTIP_KEY="@react_buoy_settings_tooltip_shown";let keyframesInjected=false;function injectKeyframes(){if(keyframesInjected||typeof document==="undefined")return;const t=document.createElement("style");t.textContent=(0,_floatingToolsReact.getDialCSSKeyframesString)();document.head.appendChild(t);keyframesInjected=true}const easeOutCubic=t=>1-Math.pow(1-t,3);const easeInCubic=t=>t*t*t;function DialIconItem({icon:t,index:l,totalIcons:k,position:f,progress:r,onPress:y}){const[v,z]=(0,_react.useState)(false);const[T,S]=(0,_react.useState)(false);const h=!t.icon&&t.id.startsWith("empty-");const _=!h&&t.unavailable===true;const b=!h&&!_;const{icons:F}=_floatingToolsReact.dialAnimationConfig;const m=(0,_floatingToolsReact.getIconStaggerInputRange)(l,k);let c=0;if(r<=m[1]){c=0}else if(r<=m[2]){c=(r-m[1])/(m[2]-m[1])}else{c=1}c=Math.max(0,Math.min(1,c));const x=_floatingToolsReact.DIAL_ICON_SIZE;const G=F.pressIn.scale;const B=1.1;const W=c*(T?G:v?B:1);let A=0;if(c<=0){A=0}else if(c<=.3){A=c}else{A=.3+(c-.3)*(.7/.7)}const H=f.x*c;const U=f.y*c;return(0,_jsxRuntime.jsx)("button",{role:"menuitem","aria-label":h?"Empty slot":(0,_dialA11y.dialAccessibilityLabel)(t.id,t.name),"data-testid":t.id?`buoy-dial-${t.id}`:void 0,"aria-disabled":!b,tabIndex:b?0:-1,onClick:b?y:void 0,onPointerEnter:K=>b&&K.pointerType==="mouse"&&z(true),onPointerLeave:()=>{z(false);S(false)},onPointerDown:()=>b&&S(true),onPointerUp:()=>S(false),onPointerCancel:()=>S(false),style:{position:"absolute",left:"50%",top:"50%",width:x,height:x,marginLeft:-x/2,marginTop:-x/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:b?"pointer":"default",transform:`translate(${H}px, ${U}px) scale(${W})`,opacity:A,transition:v||T?"transform 100ms ease":"none",background:"none",border:"none",padding:0},children:h?(0,_jsxRuntime.jsx)("div",{style:{width:_floatingToolsReact.dialStyles.emptySlot.dotSize,height:_floatingToolsReact.dialStyles.emptySlot.dotSize,borderRadius:_floatingToolsReact.dialStyles.emptySlot.dotSize/2,backgroundColor:_floatingToolsReact.dialColors.emptyDotBackground,border:`${_floatingToolsReact.dialStyles.emptySlot.borderWidth}px solid ${_floatingToolsReact.dialColors.emptyDotBorder}`}}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",width:`${_floatingToolsReact.dialStyles.icon.gradientBgSizePercent}%`,height:`${_floatingToolsReact.dialStyles.icon.gradientBgSizePercent}%`,borderRadius:_floatingToolsReact.dialStyles.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:_floatingToolsReact.dialStyles.icon.gradientBgOpacity}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",width:`${_floatingToolsReact.dialStyles.icon.innerGlowSizePercent}%`,height:`${_floatingToolsReact.dialStyles.icon.innerGlowSizePercent}%`,borderRadius:_floatingToolsReact.dialStyles.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:_floatingToolsReact.dialStyles.icon.innerGlowOpacity}}),(0,_jsxRuntime.jsx)("div",{style:{marginBottom:_floatingToolsReact.dialStyles.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:v?"brightness(1.2)":"none"},children:t.icon}),(0,_jsxRuntime.jsx)("span",{style:{fontSize:t.name.length>8?Math.max(_floatingToolsReact.dialStyles.icon.label.fontSize*.7,_floatingToolsReact.dialStyles.icon.label.fontSize*8/t.name.length):_floatingToolsReact.dialStyles.icon.label.fontSize,fontWeight:_floatingToolsReact.dialStyles.icon.label.fontWeight,fontFamily:_floatingToolsReact.dialStyles.icon.label.fontFamily,color:_floatingToolsReact.dialColors.iconLabel,letterSpacing:_floatingToolsReact.dialStyles.icon.label.letterSpacing,marginTop:_floatingToolsReact.dialStyles.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:t.name}),_&&(0,_jsxRuntime.jsx)("span",{style:{fontSize:_floatingToolsReact.dialStyles.icon.label.fontSize-1,fontWeight:_floatingToolsReact.dialStyles.icon.label.fontWeight,fontFamily:_floatingToolsReact.dialStyles.icon.label.fontFamily,letterSpacing:_floatingToolsReact.dialStyles.icon.label.letterSpacing,color:_floatingToolsReact.floatingToolsColors.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})}function PagerChevron({side:t,color:l}){const k=t==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]];return(0,_jsxRuntime.jsx)("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:k.map(([f,r,y,v],z)=>(0,_jsxRuntime.jsx)("line",{x1:f,y1:r,x2:y,y2:v,stroke:l,strokeWidth:2},z))})}function PagerButton({side:t,disabled:l,onClick:k}){const[f,r]=(0,_react.useState)(false);const y=l?_floatingToolsReact.dialColors.emptyDotBorder:_floatingToolsReact.dialColors.accent;return(0,_jsxRuntime.jsxs)("button",{type:"button","aria-label":`${t==="prev"?"Previous":"Next"} dial page`,"data-testid":`buoy-dial-${t}`,disabled:l,onClick:k,onPointerDown:()=>!l&&r(true),onPointerUp:()=>r(false),onPointerLeave:()=>r(false),onPointerCancel:()=>r(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${_floatingToolsReact.dialColors.dialBorder}`,backgroundColor:_floatingToolsReact.dialColors.dialBackground,color:l?_floatingToolsReact.dialColors.iconLabelMuted:_floatingToolsReact.dialColors.centerText,fontSize:12,fontWeight:900,fontFamily:_sharedUi.monoFont,letterSpacing:1.5,textTransform:"uppercase",cursor:l?"default":"pointer",opacity:l?.4:1,boxShadow:l?"none":`0 0 8px ${(0,_floatingToolsReact.withAlpha)(_floatingToolsReact.dialColors.dialShadow,.4)}`,transform:f?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[t==="prev"&&(0,_jsxRuntime.jsx)(PagerChevron,{side:"prev",color:y}),t==="prev"?"PREV":"NEXT",t==="next"&&(0,_jsxRuntime.jsx)(PagerChevron,{side:"next",color:y})]})}function DialMenu({icons:t,onClose:l,centerLabel:k="MENU",onCenterPress:f,settingsOpen:r=false,hintsDisabled:y=false}){const{id:v}=(0,_sharedUi.useToolBackground)();const[z,T]=(0,_react.useState)(0);const[S,h]=(0,_react.useState)(0);const[_,b]=(0,_react.useState)(0);const[F,m]=(0,_react.useState)(0);const[c,x]=(0,_react.useState)(0);const[G,B]=(0,_react.useState)(1);const[W,A]=(0,_react.useState)(false);const[H,U]=(0,_react.useState)(false);const[K,ie]=(0,_react.useState)(false);const N=(0,_react.useRef)(null);const Q=(0,_react.useRef)(null);const g=(0,_react.useRef)(null);const O=(0,_react.useRef)(false);const{entrance:M,exit:E,interaction:L}=_floatingToolsReact.dialAnimationConfig;const ae=(0,_floatingToolsReact.getDialCSSAnimationStyles)();const[X,re]=(0,_react.useState)(()=>({width:window.innerWidth,height:window.innerHeight}));(0,_react.useEffect)(()=>{const o=()=>re({width:window.innerWidth,height:window.innerHeight});window.addEventListener("resize",o);return()=>window.removeEventListener("resize",o)},[]);const i=(0,_react.useMemo)(()=>(0,_floatingToolsReact.getDialLayout)({screenWidth:X.width,maxCircleSize:Math.max(120,Math.min(320,X.height-96))}),[X]);const se=(0,_react.useMemo)(()=>(0,_floatingToolsReact.getGridLineRotations)(),[]);const le=(0,_react.useMemo)(()=>(0,_floatingToolsReact.getAllIconPositions)(_floatingToolsReact.MAX_DIAL_SLOTS,i.iconRadius),[i.iconRadius]);const[ce,de]=(0,_react.useState)(0);const I=Math.max(1,Math.ceil(t.length/_floatingToolsReact.MAX_DIAL_SLOTS));const C=Math.min(ce,I-1);const ee=(0,_react.useMemo)(()=>{const o=C*_floatingToolsReact.MAX_DIAL_SLOTS;const e=[...t.slice(o,o+_floatingToolsReact.MAX_DIAL_SLOTS)];while(e.length<_floatingToolsReact.MAX_DIAL_SLOTS){e.push({id:`empty-${e.length}`,name:"",icon:null,onPress:()=>{}})}return e},[t,C]);(0,_react.useEffect)(()=>{injectKeyframes()},[]);(0,_react.useEffect)(()=>{const o=M.backdrop.duration;const e=M.dial.rotation.duration;const d=M.centerButton.delay;const a=M.icons.delay;const s=M.icons.duration;const u=performance.now();const p=j=>{const n=j-u;T(Math.min(1,n/o));const w=Math.min(1,n/400);let R=easeOutCubic(w)*1.1;if(w>.7){R-=(w-.7)*.33}if(w>=1)R=1;h(Math.max(0,Math.min(1.05,R)));const D=Math.min(1,n/e);b(easeOutCubic(D)*360);if(n>=d){const P=Math.min(1,(n-d)/300);let J=easeOutCubic(P)*1.15;if(P>.6){J-=(P-.6)*.375}if(P>=1)J=1;m(Math.max(0,Math.min(1.05,J)))}if(n>=a){const P=Math.min(1,(n-a)/s);x(easeOutCubic(P))}const Z=a+s;if(n<Z){g.current=requestAnimationFrame(p)}else{T(1);h(1);b(360);m(1);x(1);ie(true)}};g.current=requestAnimationFrame(p);return()=>{if(g.current)cancelAnimationFrame(g.current)}},[]);const $=(0,_react.useCallback)(()=>{if(O.current)return;O.current=true;U(true);if(g.current){cancelAnimationFrame(g.current)}const o=performance.now();const e=E.icons.duration;const d=E.centerButton.duration;const a=E.dialScale.duration;const s=Math.max(d,a);const u=E.backdrop.duration;const p=j=>{const n=j-o;if(n<e){const D=easeInCubic(n/e);x(1-D);g.current=requestAnimationFrame(p);return}const w=e;if(n<w+s){x(0);const D=Math.min(1,(n-w)/d);const Z=Math.min(1,(n-w)/a);m(1-easeInCubic(D));h(1-easeInCubic(Z));g.current=requestAnimationFrame(p);return}const R=w+s;if(n<R+u){h(0);m(0);const D=(n-R)/u;T(1-D);g.current=requestAnimationFrame(p);return}T(0);l()};g.current=requestAnimationFrame(p)},[E,l]);(0,_react.useEffect)(()=>{const o=document.activeElement;const e=N.current;return()=>{if(o?.isConnected&&(document.activeElement===document.body||e?.contains(document.activeElement))){o.focus()}}},[]);(0,_react.useEffect)(()=>{if(r)return;Q.current?.focus();const o=e=>{const d=N.current;if(!d)return;if(e.key==="Escape"){e.preventDefault();$()}else if(e.key==="Tab"){const a=Array.from(d.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(p=>p.getClientRects().length>0);const s=a[0];const u=a[a.length-1];if(!d.contains(document.activeElement)||(e.shiftKey?document.activeElement===s:document.activeElement===u)){e.preventDefault();(e.shiftKey?u:s)?.focus()}}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(e.key)){const a=Array.from(d.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])'));const s=a.indexOf(document.activeElement);if(s<0||!a.length)return;e.preventDefault();const u=e.key==="Home"?0:e.key==="End"?a.length-1:(s+(e.key==="ArrowRight"||e.key==="ArrowDown"?1:-1)+a.length)%a.length;a[u].focus()}};document.addEventListener("keydown",o);return()=>document.removeEventListener("keydown",o)},[$,r]);const[V,te]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{if(y)return;let o=false;const e=setTimeout(async()=>{const d=await _sharedUi.persistentStorage.getItem(SETTINGS_TOOLTIP_KEY);if(!o&&!d)te(true)},1200);return()=>{o=true;clearTimeout(e)}},[y]);const Y=(0,_react.useCallback)(()=>{te(false);void _sharedUi.persistentStorage.setItem(SETTINGS_TOOLTIP_KEY,"true")},[]);(0,_react.useEffect)(()=>{if(r&&V){Y()}},[r,V,Y]);const ue=(0,_react.useCallback)(o=>{if(o.id.startsWith("empty-")||O.current)return;const[e,d]=L.iconSelect.pulse;const a=performance.now();const s=150;const u=p=>{const j=p-a;if(j<s){const n=easeOutCubic(j/s);B(1-(1-e.scale)*n);requestAnimationFrame(u)}else if(j<s*2){const n=easeOutCubic((j-s)/s);B(e.scale+(d.scale-e.scale)*n);requestAnimationFrame(u)}else{B(1)}};requestAnimationFrame(u);setTimeout(()=>{o.onPress();$()},L.iconSelect.actionDelay)},[L.iconSelect,$]);const oe=(0,_react.useCallback)(o=>{if(O.current)return;const e=Math.max(0,Math.min(o,I-1));if(e!==C)de(e)},[I,C]);const q=i.buttonSize*_floatingToolsReact.dialStyles.centerButton.containerRatio;const ne=i.buttonSize*_floatingToolsReact.dialStyles.centerButton.borderRatio;const pe=i.buttonSize*_floatingToolsReact.dialStyles.centerButton.containerRatio/2+6;const fe=K&&!H;return(0,_jsxRuntime.jsxs)("div",{ref:N,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[(0,_jsxRuntime.jsx)("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:$,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:_floatingToolsReact.dialColors.dialBackdrop,opacity:z}}),(0,_jsxRuntime.jsxs)("div",{style:{position:"absolute",left:"50%",marginLeft:-i.circleSize/2,bottom:80,width:i.circleSize,height:i.circleSize,borderRadius:"50%",backgroundColor:_floatingToolsReact.dialColors.dialBackground,border:`${_floatingToolsReact.dialStyles.circle.borderWidth}px solid ${_floatingToolsReact.dialColors.dialBorder}`,boxShadow:`0 0 ${_floatingToolsReact.dialStyles.circle.shadowRadius}px ${(0,_floatingToolsReact.withAlpha)(_floatingToolsReact.dialColors.dialShadow,_floatingToolsReact.dialStyles.circle.shadowOpacity)}`,transform:`scale(${S}) rotate(${_}deg)`,opacity:S>.01?1:0,overflow:"hidden"},children:[(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:_floatingToolsReact.dialColors.dialGradient1,opacity:_floatingToolsReact.dialStyles.gradientLayers[0].opacity}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:_floatingToolsReact.dialColors.dialGradient2,opacity:_floatingToolsReact.dialStyles.gradientLayers[1].opacity}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:_floatingToolsReact.dialColors.dialGradient3,opacity:_floatingToolsReact.dialStyles.gradientLayers[2].opacity}}),se.map(o=>(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:_floatingToolsReact.dialStyles.grid.lineHeight,transform:`rotate(${o}deg)`,transformOrigin:"center"},children:["left","right"].map(e=>(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",top:0,[e]:0,width:`calc(50% - ${pe}px)`,height:_floatingToolsReact.dialStyles.grid.lineHeight,backgroundColor:_floatingToolsReact.dialColors.dialGridLine}},e))},o)),(0,_jsxRuntime.jsx)("div",{"data-testid":"dial-background","data-background":v,style:{position:"absolute",inset:0,pointerEvents:"none"},children:v==="hyperspace"?(0,_jsxRuntime.jsx)(_DialHyperspace.DialHyperspace,{size:i.circleSize}):(0,_jsxRuntime.jsx)(_sharedUi.ToolBackground,{focus:DIAL_BACKGROUND_FOCUS})}),ee.map((o,e)=>(0,_jsxRuntime.jsx)(DialIconItem,{icon:o,index:e,totalIcons:ee.length,position:le[e],progress:c,onPress:()=>ue(o)},e)),(0,_jsxRuntime.jsxs)("div",{style:{position:"absolute",left:"50%",top:"50%",width:q,height:q,marginLeft:-q/2,marginTop:-q/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:_floatingToolsReact.dialColors.hubHalo,borderRadius:i.buttonSize,overflow:"hidden",transform:`scale(${F*G})`,opacity:F>.01?1:0},children:[(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,backgroundColor:_floatingToolsReact.dialColors.dialGradient1,opacity:.5,borderRadius:i.buttonSize}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:_floatingToolsReact.dialColors.dialGradient2,opacity:.3,borderRadius:i.buttonSize}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:_floatingToolsReact.dialColors.dialGradient3,opacity:.2,borderRadius:i.buttonSize}}),(0,_jsxRuntime.jsx)("div",{style:{width:ne,height:ne,borderRadius:i.buttonSize*_floatingToolsReact.dialStyles.centerButton.borderRadiusRatio,backgroundColor:_floatingToolsReact.dialColors.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,_jsxRuntime.jsx)("button",{ref:Q,type:"button","aria-label":r?"Close Settings":"Open Dev Tools Settings",disabled:!f,onClick:f,onPointerEnter:o=>o.pointerType==="mouse"&&A(true),onPointerLeave:()=>A(false),style:{border:0,padding:0,background:"transparent",width:i.buttonSize,height:i.buttonSize,borderRadius:i.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:f?"pointer":"default",transform:W?`scale(${L.centerHover.scale})`:"scale(1)",transition:`transform ${L.centerHover.duration}ms ease`,animation:fe&&!W?ae.pulse:"none"},children:r?(0,_jsxRuntime.jsxs)("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:_floatingToolsReact.dialStyles.centerButton.text.fontSize-2,fontWeight:_floatingToolsReact.dialStyles.centerButton.text.fontWeight,fontFamily:_floatingToolsReact.dialStyles.centerButton.text.fontFamily,color:_floatingToolsReact.dialColors.centerText,letterSpacing:_floatingToolsReact.dialStyles.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${_floatingToolsReact.dialColors.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[(0,_jsxRuntime.jsx)("span",{style:{marginBottom:-2},children:"CLOSE"}),(0,_jsxRuntime.jsx)("span",{style:{marginTop:-2},children:"SETTINGS"})]}):(0,_jsxRuntime.jsx)("span",{style:{fontSize:_floatingToolsReact.dialStyles.centerButton.text.fontSize,fontWeight:_floatingToolsReact.dialStyles.centerButton.text.fontWeight,fontFamily:_floatingToolsReact.dialStyles.centerButton.text.fontFamily,color:_floatingToolsReact.dialColors.centerText,letterSpacing:_floatingToolsReact.dialStyles.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${_floatingToolsReact.dialColors.centerTextGlow}`,textTransform:"uppercase"},children:k})})})]})]}),I>1&&(0,_jsxRuntime.jsxs)("div",{style:{position:"absolute",left:"50%",marginLeft:-i.circleSize/2,top:"calc(100% - 64px)",width:i.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,S),transform:`scale(${Math.min(1,S)})`},children:[(0,_jsxRuntime.jsx)(PagerButton,{side:"prev",disabled:C<=0,onClick:()=>oe(C-1)}),(0,_jsxRuntime.jsxs)("span",{"data-testid":"buoy-dial-page",style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:_sharedUi.monoFont,letterSpacing:2,color:_floatingToolsReact.dialColors.centerText,textShadow:`0 0 6px ${_floatingToolsReact.dialColors.centerTextGlow}`},children:[String(C+1).padStart(2,"0"),(0,_jsxRuntime.jsxs)("span",{style:{color:_floatingToolsReact.dialColors.iconLabelMuted,textShadow:"none"},children:[" / ",String(I).padStart(2,"0")]})]}),(0,_jsxRuntime.jsx)(PagerButton,{side:"next",disabled:C>=I-1,onClick:()=>oe(C+1)})]}),V&&!r&&(0,_jsxRuntime.jsx)(_OnboardingTooltipWeb.OnboardingTooltip,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:Y,showArrow:false})]})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DialMenu=DialMenu;var _react=require("react");var _dialA11y=require("./dialA11y.js");var _floatingToolsReact=require("@buoy-gg/floating-tools-react");var _sharedUi=require("@buoy-gg/shared-ui");var _DialHyperspace=require("./DialHyperspace.js");var _OnboardingTooltipWeb=require("./OnboardingTooltip.web.js");var _jsxRuntime=require("react/jsx-runtime");const DIAL_BACKGROUND_FOCUS={x:.5,y:.5};const SETTINGS_TOOLTIP_KEY="@react_buoy_settings_tooltip_shown";let keyframesInjected=false;function injectKeyframes(){if(keyframesInjected||typeof document==="undefined")return;const t=document.createElement("style");t.textContent=(0,_floatingToolsReact.getDialCSSKeyframesString)();document.head.appendChild(t);keyframesInjected=true}const easeOutCubic=t=>1-Math.pow(1-t,3);const easeInCubic=t=>t*t*t;function DialIconItem({icon:t,index:c,totalIcons:j,position:p,progress:r,onPress:y}){const[x,k]=(0,_react.useState)(false);const[F,S]=(0,_react.useState)(false);const m=!t.icon&&t.id.startsWith("empty-");const T=!m&&t.unavailable===true;const C=!m&&!T;const{icons:W}=_floatingToolsReact.dialAnimationConfig;const w=(0,_floatingToolsReact.getIconStaggerInputRange)(c,j);let s=0;if(r<=w[1]){s=0}else if(r<=w[2]){s=(r-w[1])/(w[2]-w[1])}else{s=1}s=Math.max(0,Math.min(1,s));const D=_floatingToolsReact.DIAL_ICON_SIZE;const I=W.pressIn.scale;const H=1.1;const M=s*(F?I:x?H:1);let A=0;if(s<=0){A=0}else if(s<=.3){A=s}else{A=.3+(s-.3)*(.7/.7)}const O=p.x*(s-1);const U=p.y*(s-1);return(0,_jsxRuntime.jsx)("button",{role:"menuitem","aria-label":m?"Empty slot":(0,_dialA11y.dialAccessibilityLabel)(t.id,t.name),"data-testid":t.id?`buoy-dial-${t.id}`:void 0,"aria-disabled":!C,tabIndex:C?0:-1,onClick:C?y:void 0,onPointerEnter:K=>C&&K.pointerType==="mouse"&&k(true),onPointerLeave:()=>{k(false);S(false)},onPointerDown:()=>C&&S(true),onPointerUp:()=>S(false),onPointerCancel:()=>S(false),style:{position:"absolute",left:`calc(50% + ${p.x}px)`,top:`calc(50% + ${p.y}px)`,width:D,height:D,marginLeft:-D/2,marginTop:-D/2,cursor:C?"pointer":"default",background:"none",border:"none",padding:0},children:(0,_jsxRuntime.jsx)("span",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",transform:`translate(${O}px, ${U}px) scale(${M})`,opacity:A,transition:x||F?"transform 100ms ease":"none"},children:m?(0,_jsxRuntime.jsx)("div",{style:{width:_floatingToolsReact.dialStyles.emptySlot.dotSize,height:_floatingToolsReact.dialStyles.emptySlot.dotSize,borderRadius:_floatingToolsReact.dialStyles.emptySlot.dotSize/2,backgroundColor:_floatingToolsReact.dialColors.emptyDotBackground,border:`${_floatingToolsReact.dialStyles.emptySlot.borderWidth}px solid ${_floatingToolsReact.dialColors.emptyDotBorder}`}}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",width:`${_floatingToolsReact.dialStyles.icon.gradientBgSizePercent}%`,height:`${_floatingToolsReact.dialStyles.icon.gradientBgSizePercent}%`,borderRadius:_floatingToolsReact.dialStyles.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:_floatingToolsReact.dialStyles.icon.gradientBgOpacity}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",width:`${_floatingToolsReact.dialStyles.icon.innerGlowSizePercent}%`,height:`${_floatingToolsReact.dialStyles.icon.innerGlowSizePercent}%`,borderRadius:_floatingToolsReact.dialStyles.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:_floatingToolsReact.dialStyles.icon.innerGlowOpacity}}),(0,_jsxRuntime.jsx)("div",{style:{marginBottom:_floatingToolsReact.dialStyles.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:x?"brightness(1.2)":"none"},children:t.icon}),(0,_jsxRuntime.jsx)("span",{style:{fontSize:t.name.length>8?Math.max(_floatingToolsReact.dialStyles.icon.label.fontSize*.7,_floatingToolsReact.dialStyles.icon.label.fontSize*8/t.name.length):_floatingToolsReact.dialStyles.icon.label.fontSize,fontWeight:_floatingToolsReact.dialStyles.icon.label.fontWeight,fontFamily:_floatingToolsReact.dialStyles.icon.label.fontFamily,color:_floatingToolsReact.dialColors.iconLabel,letterSpacing:_floatingToolsReact.dialStyles.icon.label.letterSpacing,marginTop:_floatingToolsReact.dialStyles.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:t.name}),T&&(0,_jsxRuntime.jsx)("span",{style:{fontSize:_floatingToolsReact.dialStyles.icon.label.fontSize-1,fontWeight:_floatingToolsReact.dialStyles.icon.label.fontWeight,fontFamily:_floatingToolsReact.dialStyles.icon.label.fontFamily,letterSpacing:_floatingToolsReact.dialStyles.icon.label.letterSpacing,color:_floatingToolsReact.floatingToolsColors.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})})}function PagerChevron({side:t,color:c}){const j=t==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]];return(0,_jsxRuntime.jsx)("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:j.map(([p,r,y,x],k)=>(0,_jsxRuntime.jsx)("line",{x1:p,y1:r,x2:y,y2:x,stroke:c,strokeWidth:2},k))})}function PagerButton({side:t,disabled:c,onClick:j}){const[p,r]=(0,_react.useState)(false);const y=c?_floatingToolsReact.dialColors.emptyDotBorder:_floatingToolsReact.dialColors.accent;return(0,_jsxRuntime.jsxs)("button",{type:"button","aria-label":`${t==="prev"?"Previous":"Next"} dial page`,"data-testid":`buoy-dial-${t}`,disabled:c,onClick:j,onPointerDown:()=>!c&&r(true),onPointerUp:()=>r(false),onPointerLeave:()=>r(false),onPointerCancel:()=>r(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${_floatingToolsReact.dialColors.dialBorder}`,backgroundColor:_floatingToolsReact.dialColors.dialBackground,color:c?_floatingToolsReact.dialColors.iconLabelMuted:_floatingToolsReact.dialColors.centerText,fontSize:12,fontWeight:900,fontFamily:_sharedUi.monoFont,letterSpacing:1.5,textTransform:"uppercase",cursor:c?"default":"pointer",opacity:c?.4:1,boxShadow:c?"none":`0 0 8px ${(0,_floatingToolsReact.withAlpha)(_floatingToolsReact.dialColors.dialShadow,.4)}`,transform:p?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[t==="prev"&&(0,_jsxRuntime.jsx)(PagerChevron,{side:"prev",color:y}),t==="prev"?"PREV":"NEXT",t==="next"&&(0,_jsxRuntime.jsx)(PagerChevron,{side:"next",color:y})]})}function DialMenu({icons:t,onClose:c,centerLabel:j="MENU",onCenterPress:p,settingsOpen:r=false,hintsDisabled:y=false,emptyNote:x}){const{id:k}=(0,_sharedUi.useToolBackground)();const[F,S]=(0,_react.useState)(0);const[m,T]=(0,_react.useState)(0);const[C,W]=(0,_react.useState)(0);const[w,s]=(0,_react.useState)(0);const[D,I]=(0,_react.useState)(0);const[H,M]=(0,_react.useState)(1);const[A,O]=(0,_react.useState)(false);const[U,K]=(0,_react.useState)(false);const[ie,ae]=(0,_react.useState)(false);const N=(0,_react.useRef)(null);const Q=(0,_react.useRef)(null);const g=(0,_react.useRef)(null);const q=(0,_react.useRef)(false);const{entrance:E,exit:L,interaction:$}=_floatingToolsReact.dialAnimationConfig;const re=(0,_floatingToolsReact.getDialCSSAnimationStyles)();const[X,se]=(0,_react.useState)(()=>({width:window.innerWidth,height:window.innerHeight}));(0,_react.useEffect)(()=>{const o=()=>se({width:window.innerWidth,height:window.innerHeight});window.addEventListener("resize",o);return()=>window.removeEventListener("resize",o)},[]);const n=(0,_react.useMemo)(()=>(0,_floatingToolsReact.getDialLayout)({screenWidth:X.width,maxCircleSize:Math.max(120,Math.min(320,X.height-96))}),[X]);const le=(0,_react.useMemo)(()=>(0,_floatingToolsReact.getGridLineRotations)(),[]);const ce=(0,_react.useMemo)(()=>(0,_floatingToolsReact.getAllIconPositions)(_floatingToolsReact.MAX_DIAL_SLOTS,n.iconRadius),[n.iconRadius]);const[de,ue]=(0,_react.useState)(0);const R=Math.max(1,Math.ceil(t.length/_floatingToolsReact.MAX_DIAL_SLOTS));const h=Math.min(de,R-1);const ee=(0,_react.useMemo)(()=>{const o=h*_floatingToolsReact.MAX_DIAL_SLOTS;const e=[...t.slice(o,o+_floatingToolsReact.MAX_DIAL_SLOTS)];while(e.length<_floatingToolsReact.MAX_DIAL_SLOTS){e.push({id:`empty-${e.length}`,name:"",icon:null,onPress:()=>{}})}return e},[t,h]);(0,_react.useEffect)(()=>{injectKeyframes()},[]);(0,_react.useEffect)(()=>{const o=E.backdrop.duration;const e=E.dial.rotation.duration;const d=E.centerButton.delay;const a=E.icons.delay;const l=E.icons.duration;const u=performance.now();const f=v=>{const i=v-u;S(Math.min(1,i/o));const b=Math.min(1,i/400);let P=easeOutCubic(b)*1.1;if(b>.7){P-=(b-.7)*.33}if(b>=1)P=1;T(Math.max(0,Math.min(1.05,P)));const z=Math.min(1,i/e);W(easeOutCubic(z)*360);if(i>=d){const B=Math.min(1,(i-d)/300);let J=easeOutCubic(B)*1.15;if(B>.6){J-=(B-.6)*.375}if(B>=1)J=1;s(Math.max(0,Math.min(1.05,J)))}if(i>=a){const B=Math.min(1,(i-a)/l);I(easeOutCubic(B))}const Z=a+l;if(i<Z){g.current=requestAnimationFrame(f)}else{S(1);T(1);W(360);s(1);I(1);ae(true)}};g.current=requestAnimationFrame(f);return()=>{if(g.current)cancelAnimationFrame(g.current)}},[]);const _=(0,_react.useCallback)(()=>{if(q.current)return;q.current=true;K(true);if(g.current){cancelAnimationFrame(g.current)}const o=performance.now();const e=L.icons.duration;const d=L.centerButton.duration;const a=L.dialScale.duration;const l=Math.max(d,a);const u=L.backdrop.duration;const f=v=>{const i=v-o;if(i<e){const z=easeInCubic(i/e);I(1-z);g.current=requestAnimationFrame(f);return}const b=e;if(i<b+l){I(0);const z=Math.min(1,(i-b)/d);const Z=Math.min(1,(i-b)/a);s(1-easeInCubic(z));T(1-easeInCubic(Z));g.current=requestAnimationFrame(f);return}const P=b+l;if(i<P+u){T(0);s(0);const z=(i-P)/u;S(1-z);g.current=requestAnimationFrame(f);return}S(0);c()};g.current=requestAnimationFrame(f)},[L,c]);(0,_react.useEffect)(()=>{const o=document.activeElement;const e=N.current;return()=>{if(o?.isConnected&&(document.activeElement===document.body||e?.contains(document.activeElement))){o.focus()}}},[]);(0,_react.useEffect)(()=>{if(r)return;Q.current?.focus();const o=e=>{const d=N.current;if(!d)return;if(e.key==="Escape"){e.preventDefault();_()}else if(e.key==="Tab"){const a=Array.from(d.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(f=>f.getClientRects().length>0);const l=a[0];const u=a[a.length-1];if(!d.contains(document.activeElement)||(e.shiftKey?document.activeElement===l:document.activeElement===u)){e.preventDefault();(e.shiftKey?u:l)?.focus()}}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(e.key)){const a=Array.from(d.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])'));const l=a.indexOf(document.activeElement);if(l<0||!a.length)return;e.preventDefault();const u=e.key==="Home"?0:e.key==="End"?a.length-1:(l+(e.key==="ArrowRight"||e.key==="ArrowDown"?1:-1)+a.length)%a.length;a[u].focus()}};document.addEventListener("keydown",o);return()=>document.removeEventListener("keydown",o)},[_,r]);const[V,te]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{if(y)return;let o=false;const e=setTimeout(async()=>{const d=await _sharedUi.persistentStorage.getItem(SETTINGS_TOOLTIP_KEY);if(!o&&!d)te(true)},1200);return()=>{o=true;clearTimeout(e)}},[y]);const Y=(0,_react.useCallback)(()=>{te(false);void _sharedUi.persistentStorage.setItem(SETTINGS_TOOLTIP_KEY,"true")},[]);(0,_react.useEffect)(()=>{if(r&&V){Y()}},[r,V,Y]);const pe=(0,_react.useCallback)(o=>{if(o.id.startsWith("empty-")||q.current)return;const[e,d]=$.iconSelect.pulse;const a=performance.now();const l=150;const u=f=>{const v=f-a;if(v<l){const i=easeOutCubic(v/l);M(1-(1-e.scale)*i);requestAnimationFrame(u)}else if(v<l*2){const i=easeOutCubic((v-l)/l);M(e.scale+(d.scale-e.scale)*i);requestAnimationFrame(u)}else{M(1)}};requestAnimationFrame(u);setTimeout(()=>{o.onPress();_()},$.iconSelect.actionDelay)},[$.iconSelect,_]);const oe=(0,_react.useCallback)(o=>{if(q.current)return;const e=Math.max(0,Math.min(o,R-1));if(e!==h)ue(e)},[R,h]);const G=n.buttonSize*_floatingToolsReact.dialStyles.centerButton.containerRatio;const ne=n.buttonSize*_floatingToolsReact.dialStyles.centerButton.borderRatio;const fe=n.buttonSize*_floatingToolsReact.dialStyles.centerButton.containerRatio/2+6;const me=ie&&!U;return(0,_jsxRuntime.jsxs)("div",{ref:N,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[(0,_jsxRuntime.jsx)("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:_,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:_floatingToolsReact.dialColors.dialBackdrop,opacity:F}}),x?(0,_jsxRuntime.jsx)("div",{role:"status","data-testid":"buoy-dial-empty-note",style:{position:"absolute",left:16,right:16,bottom:80+n.circleSize+16,color:_floatingToolsReact.dialColors.iconLabel,fontSize:12,fontFamily:_sharedUi.monoFont,textAlign:"center",opacity:m>.01?1:0},children:x}):null,(0,_jsxRuntime.jsxs)("div",{style:{position:"absolute",left:"50%",marginLeft:-n.circleSize/2,bottom:80,width:n.circleSize,height:n.circleSize,borderRadius:"50%",backgroundColor:_floatingToolsReact.dialColors.dialBackground,border:`${_floatingToolsReact.dialStyles.circle.borderWidth}px solid ${_floatingToolsReact.dialColors.dialBorder}`,boxShadow:`0 0 ${_floatingToolsReact.dialStyles.circle.shadowRadius}px ${(0,_floatingToolsReact.withAlpha)(_floatingToolsReact.dialColors.dialShadow,_floatingToolsReact.dialStyles.circle.shadowOpacity)}`,transform:`scale(${m}) rotate(${C}deg)`,opacity:m>.01?1:0,overflow:"hidden"},children:[(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:_floatingToolsReact.dialColors.dialGradient1,opacity:_floatingToolsReact.dialStyles.gradientLayers[0].opacity}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:_floatingToolsReact.dialColors.dialGradient2,opacity:_floatingToolsReact.dialStyles.gradientLayers[1].opacity}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:_floatingToolsReact.dialColors.dialGradient3,opacity:_floatingToolsReact.dialStyles.gradientLayers[2].opacity}}),le.map(o=>(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:_floatingToolsReact.dialStyles.grid.lineHeight,transform:`rotate(${o}deg)`,transformOrigin:"center"},children:["left","right"].map(e=>(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",top:0,[e]:0,width:`calc(50% - ${fe}px)`,height:_floatingToolsReact.dialStyles.grid.lineHeight,backgroundColor:_floatingToolsReact.dialColors.dialGridLine}},e))},o)),(0,_jsxRuntime.jsx)("div",{"data-testid":"dial-background","data-background":k,style:{position:"absolute",inset:0,pointerEvents:"none"},children:k==="hyperspace"?(0,_jsxRuntime.jsx)(_DialHyperspace.DialHyperspace,{size:n.circleSize}):(0,_jsxRuntime.jsx)(_sharedUi.ToolBackground,{focus:DIAL_BACKGROUND_FOCUS})}),ee.map((o,e)=>(0,_jsxRuntime.jsx)(DialIconItem,{icon:o,index:e,totalIcons:ee.length,position:ce[e],progress:D,onPress:()=>pe(o)},e)),(0,_jsxRuntime.jsxs)("div",{style:{position:"absolute",left:"50%",top:"50%",width:G,height:G,marginLeft:-G/2,marginTop:-G/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:_floatingToolsReact.dialColors.hubHalo,borderRadius:n.buttonSize,overflow:"hidden",transform:`scale(${w*H})`,opacity:w>.01?1:0},children:[(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,backgroundColor:_floatingToolsReact.dialColors.dialGradient1,opacity:.5,borderRadius:n.buttonSize}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:_floatingToolsReact.dialColors.dialGradient2,opacity:.3,borderRadius:n.buttonSize}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:_floatingToolsReact.dialColors.dialGradient3,opacity:.2,borderRadius:n.buttonSize}}),(0,_jsxRuntime.jsx)("div",{style:{width:ne,height:ne,borderRadius:n.buttonSize*_floatingToolsReact.dialStyles.centerButton.borderRadiusRatio,backgroundColor:_floatingToolsReact.dialColors.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,_jsxRuntime.jsx)("button",{ref:Q,type:"button","aria-label":r?"Close Settings":"Open Dev Tools Settings",disabled:!p,onClick:p,onPointerEnter:o=>o.pointerType==="mouse"&&O(true),onPointerLeave:()=>O(false),style:{border:0,padding:0,background:"transparent",width:n.buttonSize,height:n.buttonSize,borderRadius:n.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:p?"pointer":"default",transform:A?`scale(${$.centerHover.scale})`:"scale(1)",transition:`transform ${$.centerHover.duration}ms ease`,animation:me&&!A?re.pulse:"none"},children:r?(0,_jsxRuntime.jsxs)("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:_floatingToolsReact.dialStyles.centerButton.text.fontSize-2,fontWeight:_floatingToolsReact.dialStyles.centerButton.text.fontWeight,fontFamily:_floatingToolsReact.dialStyles.centerButton.text.fontFamily,color:_floatingToolsReact.dialColors.centerText,letterSpacing:_floatingToolsReact.dialStyles.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${_floatingToolsReact.dialColors.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[(0,_jsxRuntime.jsx)("span",{style:{marginBottom:-2},children:"CLOSE"}),(0,_jsxRuntime.jsx)("span",{style:{marginTop:-2},children:"SETTINGS"})]}):(0,_jsxRuntime.jsx)("span",{style:{fontSize:_floatingToolsReact.dialStyles.centerButton.text.fontSize,fontWeight:_floatingToolsReact.dialStyles.centerButton.text.fontWeight,fontFamily:_floatingToolsReact.dialStyles.centerButton.text.fontFamily,color:_floatingToolsReact.dialColors.centerText,letterSpacing:_floatingToolsReact.dialStyles.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${_floatingToolsReact.dialColors.centerTextGlow}`,textTransform:"uppercase"},children:j})})})]})]}),R>1&&(0,_jsxRuntime.jsxs)("div",{style:{position:"absolute",left:"50%",marginLeft:-n.circleSize/2,top:"calc(100% - 64px)",width:n.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,m),transform:`scale(${Math.min(1,m)})`},children:[(0,_jsxRuntime.jsx)(PagerButton,{side:"prev",disabled:h<=0,onClick:()=>oe(h-1)}),(0,_jsxRuntime.jsxs)("span",{"data-testid":"buoy-dial-page",style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:_sharedUi.monoFont,letterSpacing:2,color:_floatingToolsReact.dialColors.centerText,textShadow:`0 0 6px ${_floatingToolsReact.dialColors.centerTextGlow}`},children:[String(h+1).padStart(2,"0"),(0,_jsxRuntime.jsxs)("span",{style:{color:_floatingToolsReact.dialColors.iconLabelMuted,textShadow:"none"},children:[" / ",String(R).padStart(2,"0")]})]}),(0,_jsxRuntime.jsx)(PagerButton,{side:"next",disabled:h>=R-1,onClick:()=>oe(h+1)})]}),V&&!r&&(0,_jsxRuntime.jsx)(_OnboardingTooltipWeb.OnboardingTooltip,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:Y,showArrow:false})]})}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.NO_TEAM_TOOLS_NOTE=void 0;const NO_TEAM_TOOLS_NOTE=exports.NO_TEAM_TOOLS_NOTE="No tools are on for your role. Ask your team admin.";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.__resetInstallPingForTests=__resetInstallPingForTests;exports.detectFramework=detectFramework;exports.sendInstallPing=sendInstallPing;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _license=require("@buoy-gg/license");var _version=require("../version.js");const STORAGE_KEY="@react_buoy_install";const ENDPOINT="https://buoy.gg/api/t";const PING_INTERVAL_MS=24*60*60*1e3;function uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;const n=t==="x"?e:e&3|8;return n.toString(16)})}async function readState(){try{const t=await _sharedUi.persistentStorage.getItem(STORAGE_KEY);if(!t)return null;const e=JSON.parse(t);if(typeof e?.installId!=="string")return null;return{installId:e.installId,lastPingAt:typeof e.lastPingAt==="number"?e.lastPingAt:0}}catch{return null}}function announceOnce(){console.log("[Buoy] Anonymous usage ping enabled: a random install id, the Buoy version, your platform and framework, and your license tier \u2014 no project, app, or tool data, and only in development. Opt out with Buoy.init({ telemetry: false }). Details: https://buoy.gg/buoy/latest/docs/telemetry")}let sentThisSession=false;function detectFramework(){if(_reactNative.Platform.isTV)return"tv";if(_reactNative.Platform.OS!=="web")return"react-native";if((0,_license.isCapacitorNative)())return"capacitor";const t=globalThis.__BUOY_FRAMEWORK__;if(t==="angular")return"angular";if(t==="solid")return"solid";return"web"}async function sendInstallPing(t){const e=typeof __DEV__!=="undefined"&&__DEV__;if(!e)return;if(!t.enabled)return;if(sentThisSession)return;sentThisSession=true;try{const n=await readState();const r=Date.now();if(n&&r-n.lastPingAt<PING_INTERVAL_MS)return;const a=n?.installId??uuid();if(!n)announceOnce();await _sharedUi.persistentStorage.setItem(STORAGE_KEY,JSON.stringify({installId:a,lastPingAt:r}));await fetch(ENDPOINT,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({installId:a,version:_version.SDK_VERSION,platform:_reactNative.Platform.OS,tier:t.tier,framework:detectFramework()})})}catch{}}function __resetInstallPingForTests(){sentThisSession=false}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.__resetInstallPingForTests=__resetInstallPingForTests;exports.detectFramework=detectFramework;exports.sendInstallPing=sendInstallPing;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _license=require("@buoy-gg/license");var _version=require("../version.js");const STORAGE_KEY="@react_buoy_install";const ENDPOINT="https://buoy.gg/api/t";const PING_INTERVAL_MS=24*60*60*1e3;function uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;const n=t==="x"?e:e&3|8;return n.toString(16)})}async function readState(){try{const t=await _sharedUi.persistentStorage.getItem(STORAGE_KEY);if(!t)return null;const e=JSON.parse(t);if(typeof e?.installId!=="string")return null;return{installId:e.installId,lastPingAt:typeof e.lastPingAt==="number"?e.lastPingAt:0}}catch{return null}}function announceOnce(){console.log("[Buoy] Anonymous usage ping enabled: a random install id, the Buoy version, your platform and framework, and your license tier \u2014 no project, app, or tool data, and only in development. Opt out with Buoy.init({ telemetry: false }). Details: https://buoy.gg/buoy/latest/docs/telemetry")}let sentThisSession=false;function detectFramework(){if(_reactNative.Platform.isTV)return"tv";if(_reactNative.Platform.OS!=="web")return"react-native";if((0,_license.isCapacitorNative)())return"capacitor";const t=globalThis.__BUOY_FRAMEWORK__;if(t==="angular")return"angular";if(t==="solid")return"solid";if(t==="vue")return"vue";if(t==="nuxt")return"nuxt";return"web"}async function sendInstallPing(t){const e=typeof __DEV__!=="undefined"&&__DEV__;if(!e)return;if(!t.enabled)return;if(sentThisSession)return;sentThisSession=true;try{const n=await readState();const r=Date.now();if(n&&r-n.lastPingAt<PING_INTERVAL_MS)return;const a=n?.installId??uuid();if(!n)announceOnce();await _sharedUi.persistentStorage.setItem(STORAGE_KEY,JSON.stringify({installId:a,lastPingAt:r}));await fetch(ENDPOINT,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({installId:a,version:_version.SDK_VERSION,platform:_reactNative.Platform.OS,tier:t.tier,framework:detectFramework()})})}catch{}}function __resetInstallPingForTests(){sentThisSession=false}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.74";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.76";
@@ -1 +1 @@
1
- "use strict";import{listenBuoyKeydown as D}from"@buoy-gg/shared-ui/floating";import{persistentStorage as P,setExpandableWindowControls as $}from"@buoy-gg/shared-ui";import{createContext as B,useCallback as p,useContext as F,useEffect as M,useMemo as H,useRef as S,useState as w}from"react";import{resolveOpenAppsState as N}from"./AppHostLogic.js";import{renderAppIcon as j}from"./AppIcon";import{ToolModalShell as W}from"./ToolHost.js";import{useDevToolsSettings as G}from"./DevToolsSettingsModal.shared.js";import{getBubbleAnchorPosition as J}from"./floatingTools.web.js";import{useCapacitorBackButton as K}from"./capacitorBackButton.js";import{jsx as d,Fragment as V}from"react/jsx-runtime";const _=B(null);const T="@react_buoy_open_apps";const z=44;const Z=12;const q=100;const X=16;const Y=t=>({x:window.innerWidth-z-X,y:window.innerHeight-q-z-t*(z+Z)});export const AppHostProvider=({children:t})=>{const[i,l]=w([]);const[c,a]=w(false);const g=S([]);const m=S(null);const r=S(false);const f=S(false);const b=S(false);const A=p(n=>{let o="";l(s=>{const{apps:e,instanceId:u}=N(s,n,()=>`${n.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);o=u;return e});return o},[]);const v=p(()=>{if(r.current||!f.current||!b.current)return;r.current=true;const n=m.current;if(!n||n.length===0){a(true);return}m.current=null;n.forEach(({id:o,minimized:s})=>{const e=g.current.find(u=>u.id===o);if(e&&e.component){const u=j(e.icon,{slot:"dial",size:20,color:e.color});A({id:e.id,title:e.name,component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:u,color:e.color,minimized:s})}});a(true)},[A]);M(()=>{let n=false;const o=async()=>{try{const s=await P.getItem(T);if(n)return;if(s){const e=JSON.parse(s);let u;if(Array.isArray(e)&&e.length>0){if(typeof e[0]==="string"){u=e.map(y=>({id:y,minimized:false}))}else{u=e.filter(y=>typeof y==="object"&&y!==null&&typeof y.id==="string")}if(u.length){m.current=u}}}}catch{}if(n)return;f.current=true;v()};void o();return()=>{n=true}},[v]);M(()=>{if(!c)return;const n=i.map(o=>({id:o.id,minimized:o.minimized??false}));void P.setItem(T,JSON.stringify(n))},[i,c]);const x=p(n=>{g.current=n;b.current=true;v()},[v]);const h=p(n=>{l(o=>{if(!o.length)return o;if(!n)return o.slice(0,-1);return o.filter(s=>s.instanceId!==n)})},[]);const C=p(()=>l([]),[]);const O=p((n,o)=>{l(s=>s.map(e=>e.instanceId===n?{...e,minimized:true,restoreState:o}:e))},[]);const R=p((n,o)=>{l(s=>s.map(e=>e.instanceId===n?{...e,minimized:false,restoreState:o??e.restoreState}:e))},[]);const E=p(n=>{const o=i.find(s=>s.instanceId===n);return o?.minimized??false},[i]);const I=i.some(n=>n.launchMode!=="toggle-only"&&!n.minimized);M(()=>{if(!I)return;const n=o=>{if(o.key!=="Escape")return;if(o.defaultPrevented)return;const s=[...i].reverse().find(e=>e.launchMode!=="toggle-only"&&!e.minimized);if(s)h(s.instanceId)};return D(n)},[I,h,i]);K(i.length>0,()=>h());const k=H(()=>({openApps:i,isAnyOpen:I,open:A,close:h,closeAll:C,registerApps:x,minimize:O,restore:R,isMinimized:E}),[i,I,A,h,C,x,O,R,E]);return d(_.Provider,{value:k,children:t})};export const useAppHost=()=>{const t=F(_);if(!t){return{openApps:[],isAnyOpen:false,open:()=>"",close:()=>{},closeAll:()=>{},registerApps:()=>{},minimize:()=>{},restore:()=>{},isMinimized:()=>false}}return t};const L=9e3;const Q={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"};const U={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"};const ee=({app:t,zIndex:i,onClose:l,onMinimize:c,minimizeTargetPosition:a,enableSharedModalDimensions:g})=>{const m=t.component;const r=!t.minimized;const f={...t.props??{},...g?{enableSharedModalDimensions:true}:{}};if(t.modal&&(!t.launchMode||t.launchMode==="self-modal")){return d("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{position:"fixed",inset:0,zIndex:i,pointerEvents:"none"},children:d(W,{app:t,config:t.modal,visible:r,zIndex:i,onClose:l,onMinimize:c,initialModalState:t.restoreState,enableSharedModalDimensions:g,bodyProps:f})})}if(t.launchMode==="self-modal"){return d("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{position:"fixed",inset:0,zIndex:i,pointerEvents:"none"},children:d(m,{...f,visible:r,onClose:l,onRequestClose:l,onMinimize:c,minimizeTargetPosition:a,instanceId:t.instanceId,zIndex:i,initialModalState:t.restoreState})})}if(t.launchMode==="inline"){if(!r)return null;return d("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{position:"fixed",inset:0,zIndex:i,pointerEvents:"none"},children:d(m,{...f,onClose:l,onMinimize:c,minimizeTargetPosition:a,initialModalState:t.restoreState,instanceId:t.instanceId})})}return d("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{...Q,zIndex:i,display:r?"flex":"none"},children:d("div",{style:U,children:d(m,{...f,onClose:l,onMinimize:c,minimizeTargetPosition:a,initialModalState:t.restoreState,instanceId:t.instanceId})})})};export const AppOverlay=()=>{const{openApps:t,close:i,minimize:l}=useAppHost();const{settings:c}=G();M(()=>{$(c.globalSettings?.expandableWindowControls!==false)},[c.globalSettings?.expandableWindowControls]);const a=t.filter(r=>r.launchMode!=="toggle-only");if(a.length===0)return null;const g=a.filter(r=>r.minimized).length;const m=J()??Y(g);return d(V,{children:a.map((r,f)=>d(ee,{app:r,zIndex:L+f,onClose:()=>i(r.instanceId),onMinimize:b=>l(r.instanceId,b),enableSharedModalDimensions:c.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:m},r.instanceId))})};
1
+ "use strict";import{listenBuoyKeydown as D}from"@buoy-gg/shared-ui/floating";import{persistentStorage as P,setExpandableWindowControls as $}from"@buoy-gg/shared-ui";import{createContext as B,useCallback as p,useContext as F,useEffect as M,useMemo as H,useRef as S,useState as w}from"react";import{resolveOpenAppsState as N}from"./AppHostLogic.js";import{renderAppIcon as j}from"./AppIcon";import{ToolModalShell as W}from"./ToolHost.js";import{useDevToolsSettings as G}from"./DevToolsSettingsModal.shared.js";import{getBubbleAnchorPosition as J}from"./floatingTools.web.js";import{useCapacitorBackButton as K}from"./capacitorBackButton.js";import{jsx as c,Fragment as V}from"react/jsx-runtime";const _=B(null);const T="@react_buoy_open_apps";const z=44;const Z=12;const q=100;const X=16;const Y=t=>({x:window.innerWidth-z-X,y:window.innerHeight-q-z-t*(z+Z)});export const AppHostProvider=({children:t})=>{const[i,d]=w([]);const[a,u]=w(false);const g=S([]);const m=S(null);const r=S(false);const f=S(false);const b=S(false);const A=p(n=>{let o="";d(s=>{const{apps:e,instanceId:l}=N(s,n,()=>`${n.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);o=l;return e});return o},[]);const v=p(()=>{if(r.current||!f.current||!b.current)return;r.current=true;const n=m.current;if(!n||n.length===0){u(true);return}m.current=null;n.forEach(({id:o,minimized:s})=>{const e=g.current.find(l=>l.id===o);if(e&&e.component){const l=j(e.icon,{slot:"dial",size:20,color:e.color});A({id:e.id,title:e.name,component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:l,color:e.color,minimized:s})}});u(true)},[A]);M(()=>{let n=false;const o=async()=>{try{const s=await P.getItem(T);if(n)return;if(s){const e=JSON.parse(s);let l;if(Array.isArray(e)&&e.length>0){if(typeof e[0]==="string"){l=e.map(y=>({id:y,minimized:false}))}else{l=e.filter(y=>typeof y==="object"&&y!==null&&typeof y.id==="string")}if(l.length){m.current=l}}}}catch{}if(n)return;f.current=true;v()};void o();return()=>{n=true}},[v]);M(()=>{if(!a)return;const n=i.map(o=>({id:o.id,minimized:o.minimized??false}));void P.setItem(T,JSON.stringify(n))},[i,a]);const x=p(n=>{g.current=n;b.current=true;v()},[v]);const h=p(n=>{d(o=>{if(!o.length)return o;if(!n)return o.slice(0,-1);return o.filter(s=>s.instanceId!==n)})},[]);const C=p(()=>d([]),[]);const O=p((n,o)=>{d(s=>s.map(e=>e.instanceId===n?{...e,minimized:true,restoreState:o}:e))},[]);const R=p((n,o)=>{d(s=>{const e=s.find(l=>l.instanceId===n);if(!e)return s;return[...s.filter(l=>l!==e),{...e,minimized:false,restoreState:o??e.restoreState}]})},[]);const E=p(n=>{const o=i.find(s=>s.instanceId===n);return o?.minimized??false},[i]);const I=i.some(n=>n.launchMode!=="toggle-only"&&!n.minimized);M(()=>{if(!I)return;const n=o=>{if(o.key!=="Escape")return;if(o.defaultPrevented)return;const s=[...i].reverse().find(e=>e.launchMode!=="toggle-only"&&!e.minimized);if(s)h(s.instanceId)};return D(n)},[I,h,i]);K(i.length>0,()=>h());const k=H(()=>({openApps:i,isAnyOpen:I,open:A,close:h,closeAll:C,registerApps:x,minimize:O,restore:R,isMinimized:E}),[i,I,A,h,C,x,O,R,E]);return c(_.Provider,{value:k,children:t})};export const useAppHost=()=>{const t=F(_);if(!t){return{openApps:[],isAnyOpen:false,open:()=>"",close:()=>{},closeAll:()=>{},registerApps:()=>{},minimize:()=>{},restore:()=>{},isMinimized:()=>false}}return t};const L=9e3;const Q={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"};const U={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"};const ee=({app:t,zIndex:i,onClose:d,onMinimize:a,minimizeTargetPosition:u,enableSharedModalDimensions:g})=>{const m=t.component;const r=!t.minimized;const f={...t.props??{},...g?{enableSharedModalDimensions:true}:{}};if(t.modal&&(!t.launchMode||t.launchMode==="self-modal")){return c("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{position:"fixed",inset:0,zIndex:i,pointerEvents:"none"},children:c(W,{app:t,config:t.modal,visible:r,zIndex:i,onClose:d,onMinimize:a,initialModalState:t.restoreState,enableSharedModalDimensions:g,bodyProps:f})})}if(t.launchMode==="self-modal"){return c("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{position:"fixed",inset:0,zIndex:i,pointerEvents:"none"},children:c(m,{...f,visible:r,onClose:d,onRequestClose:d,onMinimize:a,minimizeTargetPosition:u,instanceId:t.instanceId,zIndex:i,initialModalState:t.restoreState})})}if(t.launchMode==="inline"){if(!r)return null;return c("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{position:"fixed",inset:0,zIndex:i,pointerEvents:"none"},children:c(m,{...f,onClose:d,onMinimize:a,minimizeTargetPosition:u,initialModalState:t.restoreState,instanceId:t.instanceId})})}return c("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{...Q,zIndex:i,display:r?"flex":"none"},children:c("div",{style:U,children:c(m,{...f,onClose:d,onMinimize:a,minimizeTargetPosition:u,initialModalState:t.restoreState,instanceId:t.instanceId})})})};export const AppOverlay=()=>{const{openApps:t,close:i,minimize:d}=useAppHost();const{settings:a}=G();M(()=>{$(a.globalSettings?.expandableWindowControls!==false)},[a.globalSettings?.expandableWindowControls]);const u=t.filter(r=>r.launchMode!=="toggle-only");if(u.length===0)return null;const g=u.filter(r=>r.minimized).length;const m=J()??Y(g);return c(V,{children:u.map((r,f)=>c(ee,{app:r,zIndex:L+f,onClose:()=>i(r.instanceId),onMinimize:b=>d(r.instanceId,b),enableSharedModalDimensions:a.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:m},r.instanceId))})};
@@ -1 +1 @@
1
- "use strict";import{useState as S,useEffect as I,useCallback as W,useMemo as A}from"react";import{View as y,Text as h,StyleSheet as Xe,ScrollView as Se,TouchableOpacity as j,Dimensions as be,Platform as Ze}from"react-native";import{settingsBus as N}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as rt,Info as $,Layers as st,ChevronRightIcon as we,ChevronDown as Te,getStorageBackendType as it,getUseLicense as at,signOutOfBuoy as lt,persistentStorage as L,Trash2 as ct,CheckCircle2 as ve,BuoyUpgradeSheet as dt,BackgroundSwitcher as gt,night as o,NightCard as D,NightRows as Q,NightSectionLabel as ut,NightFootnote as xe,NightSwitch as ze,NightButton as X,NightSegmented as yt,NightBadge as v,NightSeparator as ht,monoFont as Ie}from"@buoy-gg/shared-ui";import{EnvIcon as Ce,StorageIcon as ft,RoutesIcon as pt,NetworkIcon as mt,QueryIcon as St,HighlighterIcon as bt,ReduxIcon as wt,EventsIcon as Tt}from"@buoy-gg/floating-tools-core";import{useDefaultConfig as Be}from"./DefaultConfigContext.js";import{renderAppIcon as vt}from"./AppIcon";import{JsModal as xt,devToolsStorageKeys as Z,onSettingsApplied as zt,expandableWindowControlsSupported as It}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as Ct}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as s,Fragment as P}from"react/jsx-runtime";const H="@react_buoy_dev_tools_settings";const Bt=6;const V=d=>{let g=Bt;const a={};for(const[f,l]of Object.entries(d)){if(l&&g>0){a[f]=true;g-=1}else{a[f]=false}}return a};const Lt=(d,g)=>{const{userStatus:a,environment:f,...l}=d;const u=g?Object.entries(l).filter(([p])=>g.includes(p)):Object.entries(l);return{...Object.fromEntries(u),environment:f??false}};const Le=(d,g,a)=>{if(!g)return d;const f={...d.dialTools,...g.dialTools??{}};const l=a?.allowedDialKeys?Object.entries(f).filter(([p])=>a.allowedDialKeys?.includes(p)):Object.entries(f);const u=V(Object.fromEntries(l));return{dialTools:u,floatingTools:Lt({...d.floatingTools,...g.floatingTools??{}},a?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...g.globalSettings??{}}}};const Dt=(d=[],g,a)=>{const f={};const l={};const u=new Set(g??[]);const p=new Set(a??[]);const m=!a||a.length===0;for(const x of d){const{id:c,slot:C="both"}=x;if(C==="dial"||C==="both"){f[c]=m?true:p.has(c)}if(C==="row"||C==="both"){l[c]=u.has(c)}}return{dialTools:V(f),floatingTools:{...l,environment:u.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:d,onClose:g,onSettingsChange:a,initialSettings:f,availableApps:l=[],storage:u=L,zIndex:p})=>{const{defaultFloatingTools:m,defaultDialTools:x}=Be();const c=A(()=>Dt(l,m,x),[l,m,x]);const C=A(()=>Object.keys(c.dialTools),[c]);const te=A(()=>Object.keys(c.floatingTools).filter(t=>t!=="environment"),[c]);const[z,E]=S(f||M||c);const[R,oe]=S(ee??"floating");const[ne,Ee]=S(ee!==null);const[_,Fe]=S(new Set);const[Oe,re]=S(false);const[ke,Pe]=S(false);I(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const b=et();I(()=>{const t=async()=>{try{const r=await L.getItem(Z.settings.activeTab());if(r&&["floating","settings","pro"].includes(r)){const i=r;ee=i;oe(T=>T===i?T:i)}}catch(r){}finally{Ee(true)}};t()},[]);I(()=>{if(!ne)return;L.setItem(Z.settings.activeTab(),R).catch(t=>{console.warn("[Buoy]","Failed to save settings active tab:",t)})},[R,ne]);const He=at();const F=He?.();const O=F?.isPro??false;const J=!O&&F?.licenseKey?F.error:null;const Me=F?.errorKind==="transport";const[w,Ke]=S(De);const[U,se]=S(false);const[G,q]=S(false);const[k,We]=S(false);const[Y,ie]=S([]);const[ae,le]=S(false);const ce=Ct();const de=be.get("window").height;const ge=be.get("window").width;const Ae=Math.floor(de*.33);const je=Math.min(ge-32,400);const ue=W(async()=>{try{const t=await u.getItem(H);if(t){const r=JSON.parse(t);const i=Le(c,r,{allowedDialKeys:C,allowedFloatingKeys:te});M=i;E(T=>Re(T,i)?T:i);return}M=c;E(r=>Re(r,c)?r:c)}catch(t){console.error("[Buoy]","Failed to load dev tools settings:",t);E(c)}},[c,C,te,u]);I(()=>{ue()},[ue]);I(()=>{it().then(t=>{De=t;Ke(r=>r===t?r:t)})},[]);I(()=>{if(k){le(true);L.getAllKeys().then(t=>{ie(t.sort())}).catch(()=>{ie([])}).finally(()=>{le(false)})}},[k]);const ye=async t=>{try{const r={...t,dialTools:V(t.dialTools)};await u.setItem(H,JSON.stringify(r));M=r;E(r);a?.(r);N.emit(r)}catch(r){console.error("[Buoy]","Failed to save dev tools settings:",r)}};const Ne=t=>{const r={...z,floatingTools:{...z.floatingTools,[t]:!z.floatingTools[t]}};ye(r)};const Ve=t=>{const r={...z,globalSettings:{...z.globalSettings,[t]:!z.globalSettings?.[t]}};ye(r)};const _e=async()=>{se(true);q(false);try{await L.clear();q(true);E(c);if(u!==L)await u.setItem(H,JSON.stringify(c));a?.(c);N.emit(c);setTimeout(()=>q(false),2e3)}catch(t){console.error("[Buoy]","Failed to clear storage:",t)}finally{se(false)}};const Je=W(t=>{},[]);const Ue=t=>{const r=l.find(i=>i.id===t);if(r?.description){return r.description}if(t==="environment"){return"Environment badge."}return""};const he=t=>{if(t==="environment"){return"Env Badge"}const r=l.find(i=>i.id===t);return r?.name??t.toUpperCase().replace(/_/g," ")};const Ge=t=>{if(!ke)return null;switch(t){case"query":return e(St,{size:18});case"env":return e(Ce,{size:18});case"sentry":return e(tt,{size:18,color:"#9945FF"});case"storage":return e(ft,{size:18,bgColor:o.color.surface});case"wifi":case"query-wifi-toggle":return e(ot,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return e(pt,{size:18,bgColor:o.color.surface});case"network":return e(mt,{size:18});case"environment":return e(Ce,{size:18});case"debug-borders":return e(st,{size:18,color:o.color.accent});case"highlight-updates":return e(rt,{size:18,color:o.color.accent});case"highlight-updates-modal":return e(bt,{size:18});case"redux":return e(wt,{size:18});case"image-overlay":return e(nt,{size:18});case"events":return e(Tt,{size:18});case"zustand":try{const{ZustandIcon:r}=require("@buoy-gg/zustand");return e(r,{size:18})}catch{return e($,{size:18,color:o.color.textSecondary})}case"jotai":try{const{JotaiIcon:r}=require("@buoy-gg/jotai");return e(r,{size:18})}catch{return e($,{size:18,color:o.color.textSecondary})}default:{const r=l.find(i=>i.id===t);if(r?.icon!=null){return vt(r.icon,{slot:"row",size:18,color:r.color})}return e($,{size:18,color:o.color.textSecondary})}}};const qe=(t,r,i,T)=>{const K=Ue(t);return s(j,{activeOpacity:i?1:.7,onPress:()=>!i&&T(),accessibilityLabel:he(t),accessibilityRole:"button",style:[n.toolRow,i&&n.rowDisabled],children:[e(y,{style:n.toolIconSlot,children:Ge(t)}),s(y,{style:n.rowInfo,children:[s(h,{style:n.rowLabel,children:[he(t),i?" \xB7 max 6":""]}),K?e(h,{style:n.rowCaption,numberOfLines:1,children:K}):null]}),e(ze,{value:r,disabled:i,onValueChange:()=>T()})]},t)};const fe=t=>{Fe(r=>{const i=new Set(r);if(i.has(t)){i.delete(t)}else{i.add(t)}return i})};const pe=(t,r,i,T,K)=>{const Qe=z.globalSettings?.[t]??false;const me=_.has(t);return s(y,{children:[s(j,{activeOpacity:.7,onPress:()=>fe(t),accessibilityLabel:r,style:n.settingRow,children:[s(y,{style:n.rowInfo,children:[e(h,{style:n.rowLabel,children:r}),e(h,{style:n.rowCaption,numberOfLines:me?0:1,children:i})]}),e(ze,{value:Qe,onValueChange:()=>Ve(t)})]}),me&&s(y,{style:n.settingRowBody,children:[e(h,{style:n.settingRowBodyText,children:T}),e(h,{style:n.settingRowBodyHint,children:K})]})]},t)};const B=(t,r,i)=>s(y,{children:[e(ut,{children:t}),r,i]});const Ye=w==="filesystem"?e(v,{label:"File System",tone:"accent"}):w==="asyncstorage"?e(v,{label:"Async Storage",tone:"warning"}):w==="localstorage"?e(v,{label:"Local Storage",tone:"accent"}):w==="memory"?e(v,{label:"Memory",tone:"danger"}):e(v,{label:"Loading\u2026",tone:"neutral"});const $e=()=>s(y,{style:n.container,children:[s(Se,{style:n.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:n.scrollContainer,children:[R==="floating"&&e(P,{children:B("Floating Tools",e(D,{glass:true,children:e(Q,{children:Object.entries(z.floatingTools).map(([t,r])=>qe(t,r,false,()=>Ne(t)))})}),e(xe,{children:"Tools switched on here appear in the floating bubble row."}))}),R==="settings"&&s(P,{children:[B("Background",e(D,{glass:true,padded:true,children:e(gt,{embedded:true})})),B("Storage",s(D,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>We(!k),accessibilityLabel:"Storage Type",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{style:n.rowLabel,children:"Storage Type"})}),Ye,k?e(Te,{size:16,color:o.color.textTertiary}):e(we,{size:16,color:o.color.textTertiary})]}),k&&s(P,{children:[s(y,{style:n.settingRowBody,children:[e(h,{style:n.settingRowBodyText,children:w==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":w==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":w==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":w==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),w==="asyncstorage"&&e(h,{style:[n.settingRowBodyText,n.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),w==="memory"&&e(h,{style:[n.settingRowBodyText,n.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),e(ht,{}),s(y,{style:n.storageExpanded,children:[s(y,{style:n.storageExpandedHeader,children:[e(h,{style:n.storageExpandedTitle,children:"SAVED SETTINGS"}),e(h,{style:n.storageExpandedCount,children:ae?"\u2026":`${Y.length} keys`})]}),ae?e(h,{style:n.storageKeyEmpty,children:"Loading\u2026"}):Y.length===0?e(h,{style:n.storageKeyEmpty,children:"No settings saved yet"}):e(Se,{style:n.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:Y.map(t=>e(y,{style:n.storageKeyItem,children:e(h,{style:n.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(y,{style:n.cardButtonWrap,children:e(X,{label:G?"Cleared":U?"Clearing\u2026":"Clear All Settings",variant:G?"secondary":"destructive",size:"md",disabled:U,onPress:_e,icon:G?e(ve,{size:15,color:o.color.accent}):e(ct,{size:15,color:U?o.color.textTertiary:o.color.danger})})})]})]})),b&&b.state!=="idle"&&B("Desktop Sync",s(D,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>fe("desktopSync"),accessibilityLabel:"Buoy Desktop",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{style:n.rowLabel,children:"Buoy Desktop"})}),b.state==="connected"?e(v,{label:"Connected",tone:"accent"}):b.state==="connecting"?e(v,{label:"Connecting\u2026",tone:"neutral"}):e(v,{label:"Retrying",tone:"warning"}),_.has("desktopSync")?e(Te,{size:16,color:o.color.textTertiary}):e(we,{size:16,color:o.color.textTertiary})]}),_.has("desktopSync")&&s(y,{style:n.settingRowBody,children:[s(h,{style:n.settingRowBodyText,children:[b.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(h,{style:n.footnoteMono,children:b.targetURL??"(unknown URL)"}),b.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),b.state==="retrying"&&b.lastError&&s(h,{style:[n.settingRowBodyText,n.bodyWarning],children:["Last error: ",b.lastError]})]})]})),B("Modal Behavior",e(D,{glass:true,children:s(Q,{children:[pe("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."),It(Ze.OS==="web")?pe("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]})}))]}),R==="pro"&&s(P,{children:[B("License",s(D,{glass:true,children:[s(y,{style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{style:n.rowLabel,children:"License Status"})}),e(y,{testID:"buoy-settings-license-status",accessibilityLabel:O?"License: Active":"License: Free",children:O?e(v,{label:"Active",tone:"accent"}):e(v,{label:"Free",tone:"neutral"})})]}),F?.tierSource==="session"?s(y,{style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{style:n.rowLabel,children:"Signed in with Buoy"})}),e(X,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void lt(),testID:"buoy-settings-signout"})]}):null]}),e(xe,{children:O?"You have full access to all Buoy DevTools features.":J?Me?`Couldn't reach the license server (${J}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${J}.`:"Upgrade to Pro to unlock all features and support development."})),!O&&s(P,{children:[B("Pro Features",e(D,{glass:true,children:e(Q,{children:["Advanced Settings","Priority Support"].map(t=>s(y,{style:n.featureRow,children:[e(ve,{size:16,color:o.color.accent}),e(h,{style:n.rowLabel,children:t})]},t))})})),e(X,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>re(true)})]})]})]}),e(dt,{visible:Oe,onClose:()=>re(false)})]});return e(xt,{visible:d,onClose:g,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(y,{style:n.headerRow,children:e(yt,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:R,onChange:t=>oe(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:Z.settings.root(),enablePersistence:true,maxHeight:de-ce.top,initialHeight:Ae,initialFloatingPosition:{x:(ge-je)/2,y:ce.top+20},enableGlitchEffects:true,children:$e()})};const Rt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Et=(d,g)=>{const a=new Set(d??[]);const f=new Set(g??[]);const l={};for(const p of f){l[p]=true}const u={environment:a.has("environment")};for(const p of a){if(p!=="environment"){u[p]=true}}return{dialTools:V(l),floatingTools:u,globalSettings:{enableSharedModalDimensions:false}}};let M=null;let ee=null;let De=null;const Re=(d,g)=>JSON.stringify(d)===JSON.stringify(g);N.addListener(d=>{if(d)M=d});export const useDevToolsSettings=()=>{const{defaultFloatingTools:d,defaultDialTools:g}=Be();const a=A(()=>{if(!d&&!g){return Rt}return Et(d,g)},[d,g]);const[f,l]=S(a);const u=W(async()=>{try{const m=await L.getItem(H);if(m){const x=JSON.parse(m);const c=Le(a,x);l(c);return}l(a)}catch(m){console.error("[Buoy]","Failed to load dev tools settings:",m);l(a)}},[a]);I(()=>zt(m=>{if(m.includes(H))void u()}),[u]);I(()=>{u();const m=N.addListener(x=>{try{if(x){l(x)}}catch(c){}});return()=>{m()}},[u]);const p=W(()=>{u()},[u]);return{settings:f,refreshSettings:p}};const n=Xe.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:o.gutter,paddingRight:o.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:o.gutter,paddingTop:8,paddingBottom:24,gap:o.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:o.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:o.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:o.color.text,fontSize:o.font.row,fontWeight:"500"},rowCaption:{color:o.color.textTertiary,fontSize:o.font.label},settingRowBody:{paddingHorizontal:o.rowPadH,paddingBottom:o.rowPadV,gap:6},settingRowBodyText:{color:o.color.textSecondary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},settingRowBodyHint:{color:o.color.textTertiary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},bodyWarning:{color:o.color.warning},bodyDanger:{color:o.color.danger},cardButtonWrap:{paddingHorizontal:o.cardPad,paddingTop:10,paddingBottom:o.cardPad},storageExpanded:{paddingHorizontal:o.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:o.color.textSecondary,fontSize:o.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:o.color.textTertiary,fontSize:o.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:o.color.glassElevated,borderRadius:o.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:o.color.textSecondary,fontSize:o.font.micro,fontFamily:Ie},storageKeyEmpty:{color:o.color.textTertiary,fontSize:o.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Ie,fontSize:o.font.label,color:o.color.textSecondary}});
1
+ "use strict";import{useState as S,useEffect as C,useCallback as W,useMemo as A}from"react";import{View as l,Text as c,StyleSheet as Xe,ScrollView as be,TouchableOpacity as j,Dimensions as Se,Platform as Ze}from"react-native";import{settingsBus as N}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as st,Info as Q,Layers as rt,ChevronRightIcon as we,ChevronDown as Te,getStorageBackendType as it,getUseLicense as at,signOutOfBuoy as lt,persistentStorage as D,Trash2 as ct,CheckCircle2 as ve,BuoyUpgradeSheet as dt,BackgroundSwitcher as gt,night as n,NightCard as R,NightRows as X,NightSectionLabel as ut,NightFootnote as xe,NightSwitch as ze,NightButton as Z,NightSegmented as yt,NightBadge as v,NightSeparator as ht,monoFont as Ie}from"@buoy-gg/shared-ui";import{EnvIcon as Ce,StorageIcon as ft,RoutesIcon as pt,NetworkIcon as mt,QueryIcon as bt,HighlighterIcon as St,ReduxIcon as wt,EventsIcon as Tt}from"@buoy-gg/floating-tools-core";import{useDefaultConfig as Le}from"./DefaultConfigContext.js";import{renderAppIcon as vt}from"./AppIcon";import{JsModal as xt,devToolsStorageKeys as ee,onSettingsApplied as zt,expandableWindowControlsSupported as It}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as Ct}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as i,Fragment as H}from"react/jsx-runtime";const O="@react_buoy_dev_tools_settings";const Lt=6;const V=y=>{let h=Lt;const a={};for(const[f,d]of Object.entries(y)){if(d&&h>0){a[f]=true;h-=1}else{a[f]=false}}return a};const Bt=(y,h)=>{const{userStatus:a,environment:f,...d}=y;const g=h?Object.entries(d).filter(([p])=>h.includes(p)):Object.entries(d);return{...Object.fromEntries(g),environment:f??false}};const Be=(y,h,a)=>{if(!h)return y;const f={...y.dialTools,...h.dialTools??{}};const d=a?.allowedDialKeys?Object.entries(f).filter(([p])=>a.allowedDialKeys?.includes(p)):Object.entries(f);const g=V(Object.fromEntries(d));return{dialTools:g,floatingTools:Bt({...y.floatingTools,...h.floatingTools??{}},a?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...h.globalSettings??{}}}};const Dt=(y=[],h,a)=>{const f={};const d={};const g=new Set(h??[]);const p=new Set(a??[]);const m=!a||a.length===0;for(const x of y){const{id:u,slot:L="both"}=x;if(L==="dial"||L==="both"){f[u]=m?true:p.has(u)}if(L==="row"||L==="both"){d[u]=g.has(u)}}return{dialTools:V(f),floatingTools:{...d,environment:g.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:y,onClose:h,onSettingsChange:a,initialSettings:f,availableApps:d=[],storage:g=D,zIndex:p})=>{const{defaultFloatingTools:m,defaultDialTools:x}=Le();const u=A(()=>Dt(d,m,x),[d,m,x]);const L=A(()=>Object.keys(u.dialTools),[u]);const oe=A(()=>Object.keys(u.floatingTools).filter(t=>t!=="environment"),[u]);const[z,F]=S(f||M||u);const[E,ne]=S(te??"floating");const[se,Ee]=S(te!==null);const[_,Oe]=S(new Set);const[Fe,re]=S(false);const[ke,Pe]=S(false);C(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const w=et();C(()=>{const t=async()=>{try{const s=await D.getItem(ee.settings.activeTab());if(s&&["floating","settings","pro"].includes(s)){const r=s;te=r;ne(b=>b===r?b:r)}}catch(s){}finally{Ee(true)}};t()},[]);C(()=>{if(!se)return;D.setItem(ee.settings.activeTab(),E).catch(t=>{console.warn("[Buoy]","Failed to save settings active tab:",t)})},[E,se]);const He=at();const I=He?.();const k=I?.isPro??false;const J=!k&&I?.licenseKey?I.error:null;const Me=I?.errorKind==="transport";const[T,Ke]=S(De);const[U,ie]=S(false);const[G,q]=S(false);const[P,We]=S(false);const[Y,ae]=S([]);const[le,ce]=S(false);const de=Ct();const ge=Se.get("window").height;const ue=Se.get("window").width;const Ae=Math.floor(ge*.33);const je=Math.min(ue-32,400);const ye=W(async()=>{try{const t=await g.getItem(O);if(t){const s=JSON.parse(t);const r=Be(u,s,{allowedDialKeys:L,allowedFloatingKeys:oe});M=r;F(b=>Re(b,r)?b:r);return}M=u;F(s=>Re(s,u)?s:u)}catch(t){console.error("[Buoy]","Failed to load dev tools settings:",t);F(u)}},[u,L,oe,g]);C(()=>{ye()},[ye]);C(()=>{it().then(t=>{De=t;Ke(s=>s===t?s:t)})},[]);C(()=>{if(P){ce(true);D.getAllKeys().then(t=>{ae(t.sort())}).catch(()=>{ae([])}).finally(()=>{ce(false)})}},[P]);const he=async t=>{try{let s=null;try{const b=await g?.getItem(O);s=b?JSON.parse(b):null}catch{}const r={...t,dialTools:{...s?.dialTools,...V(t.dialTools)},floatingTools:{...s?.floatingTools,...t.floatingTools}};await g.setItem(O,JSON.stringify(r));M=r;F(r);a?.(r);N.emit(r)}catch(s){console.error("[Buoy]","Failed to save dev tools settings:",s)}};const Ne=t=>{const s={...z,floatingTools:{...z.floatingTools,[t]:!z.floatingTools[t]}};he(s)};const Ve=t=>{const s={...z,globalSettings:{...z.globalSettings,[t]:!z.globalSettings?.[t]}};he(s)};const _e=async()=>{ie(true);q(false);try{await D.clear();q(true);F(u);if(g!==D)await g.setItem(O,JSON.stringify(u));a?.(u);N.emit(u);setTimeout(()=>q(false),2e3)}catch(t){console.error("[Buoy]","Failed to clear storage:",t)}finally{ie(false)}};const Je=W(t=>{},[]);const Ue=t=>{const s=d.find(r=>r.id===t);if(s?.description){return s.description}if(t==="environment"){return"Environment badge."}return""};const $=t=>{if(t==="environment"){return"Env Badge"}const s=d.find(r=>r.id===t);return s?.name??t.toUpperCase().replace(/_/g," ")};const Ge=t=>{if(!ke)return null;switch(t){case"query":return e(bt,{size:18});case"env":return e(Ce,{size:18});case"sentry":return e(tt,{size:18,color:"#9945FF"});case"storage":return e(ft,{size:18,bgColor:n.color.surface});case"wifi":case"query-wifi-toggle":return e(ot,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return e(pt,{size:18,bgColor:n.color.surface});case"network":return e(mt,{size:18});case"environment":return e(Ce,{size:18});case"debug-borders":return e(rt,{size:18,color:n.color.accent});case"highlight-updates":return e(st,{size:18,color:n.color.accent});case"highlight-updates-modal":return e(St,{size:18});case"redux":return e(wt,{size:18});case"image-overlay":return e(nt,{size:18});case"events":return e(Tt,{size:18});case"zustand":try{const{ZustandIcon:s}=require("@buoy-gg/zustand");return e(s,{size:18})}catch{return e(Q,{size:18,color:n.color.textSecondary})}case"jotai":try{const{JotaiIcon:s}=require("@buoy-gg/jotai");return e(s,{size:18})}catch{return e(Q,{size:18,color:n.color.textSecondary})}default:{const s=d.find(r=>r.id===t);if(s?.icon!=null){return vt(s.icon,{slot:"row",size:18,color:s.color})}return e(Q,{size:18,color:n.color.textSecondary})}}};const qe=(t,s,r,b)=>{const K=Ue(t);return i(j,{activeOpacity:r?1:.7,onPress:()=>!r&&b(),accessibilityLabel:$(t),accessibilityRole:"button",style:[o.toolRow,r&&o.rowDisabled],children:[e(l,{style:o.toolIconSlot,children:Ge(t)}),i(l,{style:o.rowInfo,children:[i(c,{style:o.rowLabel,children:[$(t),r?" \xB7 max 6":""]}),K?e(c,{style:o.rowCaption,numberOfLines:1,children:K}):null]}),e(ze,{value:s,disabled:r,onValueChange:()=>b(),accessibilityLabel:$(t)})]},t)};const fe=t=>{Oe(s=>{const r=new Set(s);if(r.has(t)){r.delete(t)}else{r.add(t)}return r})};const pe=(t,s,r,b,K)=>{const Qe=z.globalSettings?.[t]??false;const me=_.has(t);return i(l,{children:[i(j,{activeOpacity:.7,onPress:()=>fe(t),accessibilityLabel:s,style:o.settingRow,children:[i(l,{style:o.rowInfo,children:[e(c,{style:o.rowLabel,children:s}),e(c,{style:o.rowCaption,numberOfLines:me?0:1,children:r})]}),e(ze,{value:Qe,onValueChange:()=>Ve(t),accessibilityLabel:s})]}),me&&i(l,{style:o.settingRowBody,children:[e(c,{style:o.settingRowBodyText,children:b}),e(c,{style:o.settingRowBodyHint,children:K})]})]},t)};const B=(t,s,r)=>i(l,{children:[e(ut,{children:t}),s,r]});const Ye=T==="filesystem"?e(v,{label:"File System",tone:"accent"}):T==="asyncstorage"?e(v,{label:"Async Storage",tone:"warning"}):T==="localstorage"?e(v,{label:"Local Storage",tone:"accent"}):T==="memory"?e(v,{label:"Memory",tone:"danger"}):e(v,{label:"Loading\u2026",tone:"neutral"});const $e=()=>i(l,{style:o.container,children:[i(be,{style:o.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:o.scrollContainer,children:[E==="floating"&&e(H,{children:B("Floating Tools",e(R,{glass:true,children:e(X,{children:Object.entries(z.floatingTools).map(([t,s])=>qe(t,s,false,()=>Ne(t)))})}),e(xe,{children:"Tools switched on here appear in the floating bubble row."}))}),E==="settings"&&i(H,{children:[B("Background",e(R,{glass:true,padded:true,children:e(gt,{embedded:true})})),B("Storage",i(R,{glass:true,children:[i(j,{activeOpacity:.7,onPress:()=>We(!P),accessibilityLabel:"Storage Type",style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"Storage Type"})}),Ye,P?e(Te,{size:16,color:n.color.textTertiary}):e(we,{size:16,color:n.color.textTertiary})]}),P&&i(H,{children:[i(l,{style:o.settingRowBody,children:[e(c,{style:o.settingRowBodyText,children:T==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":T==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":T==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":T==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),T==="asyncstorage"&&e(c,{style:[o.settingRowBodyText,o.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),T==="memory"&&e(c,{style:[o.settingRowBodyText,o.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),e(ht,{}),i(l,{style:o.storageExpanded,children:[i(l,{style:o.storageExpandedHeader,children:[e(c,{style:o.storageExpandedTitle,children:"SAVED SETTINGS"}),e(c,{style:o.storageExpandedCount,children:le?"\u2026":`${Y.length} keys`})]}),le?e(c,{style:o.storageKeyEmpty,children:"Loading\u2026"}):Y.length===0?e(c,{style:o.storageKeyEmpty,children:"No settings saved yet"}):e(be,{style:o.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:Y.map(t=>e(l,{style:o.storageKeyItem,children:e(c,{style:o.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(l,{style:o.cardButtonWrap,children:e(Z,{label:G?"Cleared":U?"Clearing\u2026":"Clear All Settings",variant:G?"secondary":"destructive",size:"md",disabled:U,onPress:_e,icon:G?e(ve,{size:15,color:n.color.accent}):e(ct,{size:15,color:U?n.color.textTertiary:n.color.danger})})})]})]})),w&&w.state!=="idle"&&B("Desktop Sync",i(R,{glass:true,children:[i(j,{activeOpacity:.7,onPress:()=>fe("desktopSync"),accessibilityLabel:"Buoy Desktop",style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"Buoy Desktop"})}),w.state==="connected"?e(v,{label:"Connected",tone:"accent"}):w.state==="connecting"?e(v,{label:"Connecting\u2026",tone:"neutral"}):e(v,{label:"Retrying",tone:"warning"}),_.has("desktopSync")?e(Te,{size:16,color:n.color.textTertiary}):e(we,{size:16,color:n.color.textTertiary})]}),_.has("desktopSync")&&i(l,{style:o.settingRowBody,children:[i(c,{style:o.settingRowBodyText,children:[w.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(c,{style:o.footnoteMono,children:w.targetURL??"(unknown URL)"}),w.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),w.state==="retrying"&&w.lastError&&i(c,{style:[o.settingRowBodyText,o.bodyWarning],children:["Last error: ",w.lastError]})]})]})),B("Modal Behavior",e(R,{glass:true,children:i(X,{children:[pe("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."),It(Ze.OS==="web")?pe("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]})}))]}),E==="pro"&&i(H,{children:[B("License",i(R,{glass:true,children:[i(l,{style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"License Status"})}),e(l,{testID:"buoy-settings-license-status",accessibilityLabel:k?"License: Active":"License: Free",children:k?e(v,{label:"Active",tone:"accent"}):e(v,{label:"Free",tone:"neutral"})})]}),I?.tierSource==="session"?i(l,{style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"Signed in with Buoy"})}),e(Z,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void lt(),testID:"buoy-settings-signout"})]}):null,I?.teamRole?e(l,{style:o.settingRow,testID:"buoy-settings-team-role",children:i(l,{style:o.rowInfo,children:[i(c,{style:o.rowLabel,children:["Role: ",I.teamRole]}),e(c,{style:o.rowCaption,children:I.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),e(xe,{children:k?"You have full access to all Buoy DevTools features.":J?Me?`Couldn't reach the license server (${J}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${J}.`:"Upgrade to Pro to unlock all features and support development."})),!k&&i(H,{children:[B("Pro Features",e(R,{glass:true,children:e(X,{children:["Advanced Settings","Priority Support"].map(t=>i(l,{style:o.featureRow,children:[e(ve,{size:16,color:n.color.accent}),e(c,{style:o.rowLabel,children:t})]},t))})})),e(Z,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>re(true)})]})]})]}),e(dt,{visible:Fe,onClose:()=>re(false)})]});return e(xt,{visible:y,onClose:h,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(l,{style:o.headerRow,children:e(yt,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:E,onChange:t=>ne(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:ee.settings.root(),enablePersistence:true,maxHeight:ge-de.top,initialHeight:Ae,initialFloatingPosition:{x:(ue-je)/2,y:de.top+20},enableGlitchEffects:true,children:$e()})};const Rt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Et=(y,h)=>{const a=new Set(y??[]);const f=new Set(h??[]);const d={};for(const p of f){d[p]=true}const g={environment:a.has("environment")};for(const p of a){if(p!=="environment"){g[p]=true}}return{dialTools:V(d),floatingTools:g,globalSettings:{enableSharedModalDimensions:false}}};let M=null;let te=null;let De=null;const Re=(y,h)=>JSON.stringify(y)===JSON.stringify(h);N.addListener(y=>{if(y)M=y});export const useDevToolsSettings=()=>{const{defaultFloatingTools:y,defaultDialTools:h}=Le();const a=A(()=>{if(!y&&!h){return Rt}return Et(y,h)},[y,h]);const[f,d]=S(a);const g=W(async()=>{try{const m=await D.getItem(O);if(m){const x=JSON.parse(m);const u=Be(a,x);d(u);return}d(a)}catch(m){console.error("[Buoy]","Failed to load dev tools settings:",m);d(a)}},[a]);C(()=>zt(m=>{if(m.includes(O))void g()}),[g]);C(()=>{g();const m=N.addListener(x=>{try{if(x){d(x)}}catch(u){}});return()=>{m()}},[g]);const p=W(()=>{g()},[g]);return{settings:f,refreshSettings:p}};const o=Xe.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:n.gutter,paddingRight:n.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:n.gutter,paddingTop:8,paddingBottom:24,gap:n.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:n.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:n.rowPadH,paddingVertical:n.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:n.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:n.color.text,fontSize:n.font.row,fontWeight:"500"},rowCaption:{color:n.color.textTertiary,fontSize:n.font.label},settingRowBody:{paddingHorizontal:n.rowPadH,paddingBottom:n.rowPadV,gap:6},settingRowBodyText:{color:n.color.textSecondary,fontSize:n.font.caption,lineHeight:n.font.caption*1.45},settingRowBodyHint:{color:n.color.textTertiary,fontSize:n.font.caption,lineHeight:n.font.caption*1.45},bodyWarning:{color:n.color.warning},bodyDanger:{color:n.color.danger},cardButtonWrap:{paddingHorizontal:n.cardPad,paddingTop:10,paddingBottom:n.cardPad},storageExpanded:{paddingHorizontal:n.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:n.color.textSecondary,fontSize:n.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:n.color.textTertiary,fontSize:n.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:n.color.glassElevated,borderRadius:n.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:n.color.textSecondary,fontSize:n.font.micro,fontFamily:Ie},storageKeyEmpty:{color:n.color.textTertiary,fontSize:n.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Ie,fontSize:n.font.label,color:n.color.textSecondary}});
@@ -1 +1 @@
1
- "use strict";import{FloatingToolHost as se}from"@buoy-gg/shared-ui";import{AccountSetup as ce,startSettingsSync as ue}from"@buoy-gg/shared-ui";import Be,{useMemo as t,useCallback as ae,useEffect as v}from"react";import{View as $,StyleSheet as G}from"react-native";import{AppHostProvider as le}from"./AppHost";import{FloatingMenu as ge}from"./FloatingMenu.js";import{AppOverlay as ye}from"./AppHost";import{ToolOpenerBridge as pe}from"./ToolOpenerBridge.js";import{autoDiscoverPresets as de,autoDiscoverPresetsWithCustom as me}from"./autoDiscoverPresets.js";import{sendInstallPing as fe}from"../telemetry/installPing.js";import{isTelemetryEnabled as ve}from"../Buoy.js";import{renderAppIcon as be}from"./AppIcon";import{DevToolsVisibilityProvider as he}from"./DevToolsVisibilityContext.js";import{reportOptionalRequireError as n}from"./optionalRequire.js";import{HintsProvider as Oe,normalizeEnvironment as Te}from"@buoy-gg/shared-ui";import{MinimizedToolsProvider as Ae}from"./MinimizedToolsContext.js";import{validateDialConfig as qe}from"./defaultConfig.js";import{DefaultConfigProvider as Re}from"./DefaultConfigContext.js";import{LicenseManager as Ie,useProAccess as xe,useLicense as Ee,sameLicenseKey as _e}from"@buoy-gg/license";import*as Pe from"@buoy-gg/license";import{BuoySignIn as X}from"./BuoySignIn";import{AutoExternalSync as Y,ToolRegistryPublisher as ke,isExternalSyncAvailable as De}from"./autoExternalSync.js";import{externalSyncOptions as j,releaseTransportProblem as Se,shouldMountExternalSync as Me}from"./externalSyncGate.js";import{jsx as r,Fragment as R,jsxs as d}from"react/jsx-runtime";let Z=null;function ze(i){if(!i||i===Z)return;Z=i;console.warn("[Buoy]",i)}function Ce(i){if(i&&typeof i==="object"&&i.appId)return i.appId;try{const{Platform:s}=require("react-native");const c=require("expo-constants");const a=(c?.default??c)?.expoConfig;const m=s.OS==="android"?a?.android?.package:a?.ios?.bundleIdentifier;if(typeof m==="string"&&m)return m}catch{}try{const s=require("expo-application");const c=(s?.default??s)?.applicationId;if(typeof c==="string"&&c)return c}catch{}return null}export const FloatingDevTools=({apps:i,requiredEnvVars:s,requiredStorageKeys:c,askBuoy:a,children:m,disableHints:K=false,defaultFloatingTools:ee,defaultDialTools:b,requireLicense:Fe,licenseKey:h,zustandStores:I,environment:re,externalSync:O=true,headless:x=false,signIn:T,...F})=>{const te=re??Te(process.env.NODE_ENV??"dev");const{isLicensed:A}=xe();const{licenseKey:E,isInitialized:H,tier:q,access:u}=Ee();const oe=h===void 0||_e(h,E);const _=oe&&u.status==="admitted";v(()=>{if(!H||u.status==="initializing")return;void fe({tier:u.status==="admitted"?q:"locked",enabled:ve()})},[H,u.status,q]);const P=T?Ce(T):null;v(()=>{if(!P)return;const e=Pe.SessionManager;if(!e)return;e.configure({audience:`app:${P}`});void e.load().catch(()=>{})},[P]);v(()=>{void Ie.configure(h).catch(()=>{})},[h]);v(()=>{if(_)ue()},[_]);v(()=>{if(!I||u.status==="locked")return;try{const{watchStores:e}=require("@buoy-gg/zustand");return e(I)}catch(e){n("@buoy-gg/zustand",e)}},[I,u.status]);const ne=t(()=>{if(b){return qe(b)}return b},[b]);const k=t(()=>{const e=[];if(s&&s.length>0){try{const{createEnvTool:o,createEnvVarConfig:C}=require("@buoy-gg/env");e.push(o({requiredEnvVars:C(s)}))}catch(o){n("@buoy-gg/env",o)}}if(c&&c.length>0){try{const{createStorageTool:o}=require("@buoy-gg/storage");e.push(o({requiredStorageKeys:c}))}catch(o){n("@buoy-gg/storage",o)}}if(a){try{const{createAskBuoyTool:o}=require("@buoy-gg/ask-buoy");e.push(o(a))}catch(o){n("@buoy-gg/ask-buoy",o)}}return e},[s,c,a]);const D=t(()=>{if(!i&&k.length===0)return void 0;return[...i||[],...k]},[i,k]);const f=t(()=>D?me(D):de(),[D]);const S=t(()=>f.filter(e=>e.sync),[f]);const L=t(()=>{try{const{DebugBordersStandaloneOverlay:e}=require("@buoy-gg/debug-borders");return e}catch(e){n("@buoy-gg/debug-borders",e);return null}},[]);const w=t(()=>{try{const{HighlightUpdatesOverlay:e}=require("@buoy-gg/highlight-updates");return e}catch(e){n("@buoy-gg/highlight-updates",e);return null}},[]);const B=t(()=>{try{const{ImageOverlayStandalone:e}=require("@buoy-gg/image-overlay");return e}catch(e){n("@buoy-gg/image-overlay",e);return null}},[]);const V=t(()=>{try{const{PerfMonitorOverlay:e}=require("@buoy-gg/perf-monitor");return e}catch(e){n("@buoy-gg/perf-monitor",e);return null}},[]);const U=t(()=>{try{const{JsTopHudOverlay:e}=require("@buoy-gg/js-top");return e}catch(e){n("@buoy-gg/js-top",e);return null}},[]);const l=t(()=>{try{const{RouteTracker:e}=require("@buoy-gg/route-events");return e}catch(e){n("@buoy-gg/route-events",e);return null}},[]);const g=t(()=>{try{const{ReactQueryTracker:e}=require("@buoy-gg/react-query");return e}catch(e){n("@buoy-gg/react-query",e);return null}},[]);const J=t(()=>{try{const{ImpersonateOverlay:e}=require("@buoy-gg/impersonate");return e}catch(e){n("@buoy-gg/impersonate",e);return null}},[]);const N=t(()=>{try{const{ScenariosOverlay:e}=require("@buoy-gg/scenarios");return e}catch(e){n("@buoy-gg/scenarios",e);return null}},[]);const y=t(()=>{try{const{ReduxAutoInstrument:e}=require("@buoy-gg/redux");return e??null}catch(e){n("@buoy-gg/redux",e);return null}},[]);const p=t(()=>{try{const{ConsoleRoot:e}=require("@buoy-gg/console");return e??null}catch(e){n("@buoy-gg/console",e);return null}},[]);const ie=ae(e=>{const o=f.find(C=>C.id===e);if(!o)return null;return be(o.icon,{slot:"dial",size:20,color:o.color})},[f]);const M=typeof __DEV__!=="undefined"&&__DEV__;if(!M&&!A){return T&&!x?r(X,{needsPlan:true}):null}const Q=Me({isDevelopment:M,isLicensed:A,externalSync:O,isAvailable:De()});const z=j(O);if(!M&&z?.enableInRelease){ze(Se(z.socketURL,z))}const W=r(ke,{requiredEnvVars:s,customApps:S});if(!_){return d(R,{children:[u.status==="initializing"&&d(R,{children:[y&&r(y,{}),p&&r(p,{}),l&&r(l,{}),g&&r(g,{})]}),!x&&(T?r(X,{}):r(ce,{}))]})}if(x){return d(R,{children:[y&&r(y,{}),p&&r(p,{}),l&&r(l,{}),g&&r(g,{}),W,Q&&r(Y,{options:j(O),requiredEnvVars:s,isPro:A,tier:q,licenseKey:E,customApps:S})]})}return r(Re,{defaultFloatingTools:ee,defaultDialTools:ne,children:r(Oe,{disableHints:K,children:r($,{style:je.container,pointerEvents:"box-none",__buoyDevToolsRoot:true,children:d(he,{children:[B&&r($,{style:G.absoluteFill,pointerEvents:"box-none",collapsable:false,children:r(B,{})}),r(le,{children:d(Ae,{getToolIcon:ie,children:[r(ge,{...F,apps:f,environment:te}),F.hidden?null:d(R,{children:[r(ye,{}),r(se,{})]}),r(pe,{})]})}),m,L&&r(L,{}),w&&r(w,{}),V&&r(V,{}),U&&r(U,{}),J&&r(J,{}),N&&r(N,{}),y&&r(y,{}),p&&r(p,{}),l&&r(l,{}),g&&r(g,{}),W,Q&&r(Y,{options:j(O),requiredEnvVars:s,isPro:A,tier:q,licenseKey:E,customApps:S})]})})})})};const je=G.create({container:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:9999}});
1
+ "use strict";import{FloatingToolHost as ce}from"@buoy-gg/shared-ui";import{AccountSetup as le,startSettingsSync as ae}from"@buoy-gg/shared-ui";import Qe,{useMemo as o,useCallback as ge,useEffect as v}from"react";import{View as G,StyleSheet as X}from"react-native";import{AppHostProvider as ye}from"./AppHost";import{TeamToolCloser as pe}from"./TeamToolCloser.js";import{NO_TEAM_TOOLS_NOTE as de}from"./teamToolsNote.js";import{FloatingMenu as me}from"./FloatingMenu.js";import{AppOverlay as fe}from"./AppHost";import{ToolOpenerBridge as ve}from"./ToolOpenerBridge.js";import{autoDiscoverPresets as be,autoDiscoverPresetsWithCustom as he}from"./autoDiscoverPresets.js";import{sendInstallPing as Te}from"../telemetry/installPing.js";import{isTelemetryEnabled as Oe}from"../Buoy.js";import{renderAppIcon as Ae}from"./AppIcon";import{DevToolsVisibilityProvider as qe}from"./DevToolsVisibilityContext.js";import{reportOptionalRequireError as n}from"./optionalRequire.js";import{HintsProvider as Re,normalizeEnvironment as _e}from"@buoy-gg/shared-ui";import{MinimizedToolsProvider as Ee}from"./MinimizedToolsContext.js";import{validateDialConfig as Ie}from"./defaultConfig.js";import{DefaultConfigProvider as xe}from"./DefaultConfigContext.js";import{LicenseManager as Pe,useProAccess as Se,useLicense as ke,sameLicenseKey as De}from"@buoy-gg/license";import*as Me from"@buoy-gg/license";import{filterTeamTools as Ce}from"@buoy-gg/floating-tools-core";import{BuoySignIn as Y}from"./BuoySignIn";import{AutoExternalSync as Z,ToolRegistryPublisher as ze,isExternalSyncAvailable as Le}from"./autoExternalSync.js";import{externalSyncOptions as j,releaseTransportProblem as je,shouldMountExternalSync as we}from"./externalSyncGate.js";import{jsx as r,Fragment as _,jsxs as m}from"react/jsx-runtime";let K=null;function Fe(i){if(!i||i===K)return;K=i;console.warn("[Buoy]",i)}function He(i){if(i&&typeof i==="object"&&i.appId)return i.appId;try{const{Platform:s}=require("react-native");const u=require("expo-constants");const l=(u?.default??u)?.expoConfig;const f=s.OS==="android"?l?.android?.package:l?.ios?.bundleIdentifier;if(typeof f==="string"&&f)return f}catch{}try{const s=require("expo-application");const u=(s?.default??s)?.applicationId;if(typeof u==="string"&&u)return u}catch{}return null}export const FloatingDevTools=({apps:i,requiredEnvVars:s,requiredStorageKeys:u,askBuoy:l,children:f,disableHints:ee=false,defaultFloatingTools:re,defaultDialTools:b,requireLicense:Be,licenseKey:h,zustandStores:E,environment:oe,externalSync:T=true,headless:I=false,signIn:O,...w})=>{const te=oe??_e(process.env.NODE_ENV??"dev");const{isLicensed:A}=Se();const{licenseKey:x,isInitialized:F,tier:q,access:c,allowedTools:R}=ke();const ne=h===void 0||De(h,x);const P=ne&&c.status==="admitted";v(()=>{if(!F||c.status==="initializing")return;void Te({tier:c.status==="admitted"?q:"locked",enabled:Oe()})},[F,c.status,q]);const S=O?He(O):null;v(()=>{if(!S)return;const e=Me.SessionManager;if(!e)return;e.configure({audience:`app:${S}`});void e.load().catch(()=>{})},[S]);v(()=>{void Pe.configure(h).catch(()=>{})},[h]);v(()=>{if(P)ae()},[P]);v(()=>{if(!E||c.status==="locked")return;try{const{watchStores:e}=require("@buoy-gg/zustand");return e(E)}catch(e){n("@buoy-gg/zustand",e)}},[E,c.status]);const ie=o(()=>{if(b){return Ie(b)}return b},[b]);const k=o(()=>{const e=[];if(s&&s.length>0){try{const{createEnvTool:t,createEnvVarConfig:L}=require("@buoy-gg/env");e.push(t({requiredEnvVars:L(s)}))}catch(t){n("@buoy-gg/env",t)}}if(u&&u.length>0){try{const{createStorageTool:t}=require("@buoy-gg/storage");e.push(t({requiredStorageKeys:u}))}catch(t){n("@buoy-gg/storage",t)}}if(l){try{const{createAskBuoyTool:t}=require("@buoy-gg/ask-buoy");e.push(t(l))}catch(t){n("@buoy-gg/ask-buoy",t)}}return e},[s,u,l]);const D=o(()=>{if(!i&&k.length===0)return void 0;return[...i||[],...k]},[i,k]);const a=o(()=>D?he(D):be(),[D]);const M=o(()=>a.filter(e=>e.sync),[a]);const se=o(()=>Ce(a,R),[a,R]);const H=o(()=>{try{const{DebugBordersStandaloneOverlay:e}=require("@buoy-gg/debug-borders");return e}catch(e){n("@buoy-gg/debug-borders",e);return null}},[]);const N=o(()=>{try{const{HighlightUpdatesOverlay:e}=require("@buoy-gg/highlight-updates");return e}catch(e){n("@buoy-gg/highlight-updates",e);return null}},[]);const B=o(()=>{try{const{ImageOverlayStandalone:e}=require("@buoy-gg/image-overlay");return e}catch(e){n("@buoy-gg/image-overlay",e);return null}},[]);const V=o(()=>{try{const{PerfMonitorOverlay:e}=require("@buoy-gg/perf-monitor");return e}catch(e){n("@buoy-gg/perf-monitor",e);return null}},[]);const U=o(()=>{try{const{JsTopHudOverlay:e}=require("@buoy-gg/js-top");return e}catch(e){n("@buoy-gg/js-top",e);return null}},[]);const g=o(()=>{try{const{RouteTracker:e}=require("@buoy-gg/route-events");return e}catch(e){n("@buoy-gg/route-events",e);return null}},[]);const y=o(()=>{try{const{ReactQueryTracker:e}=require("@buoy-gg/react-query");return e}catch(e){n("@buoy-gg/react-query",e);return null}},[]);const J=o(()=>{try{const{ImpersonateOverlay:e}=require("@buoy-gg/impersonate");return e}catch(e){n("@buoy-gg/impersonate",e);return null}},[]);const Q=o(()=>{try{const{ScenariosOverlay:e}=require("@buoy-gg/scenarios");return e}catch(e){n("@buoy-gg/scenarios",e);return null}},[]);const p=o(()=>{try{const{ReduxAutoInstrument:e}=require("@buoy-gg/redux");return e??null}catch(e){n("@buoy-gg/redux",e);return null}},[]);const d=o(()=>{try{const{ConsoleRoot:e}=require("@buoy-gg/console");return e??null}catch(e){n("@buoy-gg/console",e);return null}},[]);const ue=ge(e=>{const t=a.find(L=>L.id===e);if(!t)return null;return Ae(t.icon,{slot:"dial",size:20,color:t.color})},[a]);const C=typeof __DEV__!=="undefined"&&__DEV__;if(!C&&!A){return O&&!I?r(Y,{needsPlan:true}):null}const W=we({isDevelopment:C,isLicensed:A,externalSync:T,isAvailable:Le()});const z=j(T);if(!C&&z?.enableInRelease){Fe(je(z.socketURL,z))}const $=r(ze,{requiredEnvVars:s,customApps:M});if(!P){return m(_,{children:[c.status==="initializing"&&m(_,{children:[p&&r(p,{}),d&&r(d,{}),g&&r(g,{}),y&&r(y,{})]}),!I&&(O?r(Y,{}):r(le,{}))]})}if(I){return m(_,{children:[p&&r(p,{}),d&&r(d,{}),g&&r(g,{}),y&&r(y,{}),$,W&&r(Z,{options:j(T),requiredEnvVars:s,isPro:A,tier:q,licenseKey:x,customApps:M})]})}return r(xe,{defaultFloatingTools:re,defaultDialTools:ie,children:r(Re,{disableHints:ee,children:r(G,{style:Ne.container,pointerEvents:"box-none",__buoyDevToolsRoot:true,children:m(qe,{children:[B&&r(G,{style:X.absoluteFill,pointerEvents:"box-none",collapsable:false,children:r(B,{})}),r(ye,{children:m(Ee,{getToolIcon:ue,children:[r(me,{...w,apps:se,emptyNote:R?de:void 0,environment:te}),w.hidden?null:m(_,{children:[r(fe,{}),r(ce,{})]}),r(ve,{}),r(pe,{allowedTools:R??null})]})}),f,H&&r(H,{}),N&&r(N,{}),V&&r(V,{}),U&&r(U,{}),J&&r(J,{}),Q&&r(Q,{}),p&&r(p,{}),d&&r(d,{}),g&&r(g,{}),y&&r(y,{}),$,W&&r(Z,{options:j(T),requiredEnvVars:s,isPro:A,tier:q,licenseKey:x,customApps:M})]})})})})};const Ne=X.create({container:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:9999}});
@@ -1 +1 @@
1
- "use strict";import{BuoyPortal as Ie,FloatingToolHost as Ee}from"@buoy-gg/shared-ui/floating";import*as we from"@buoy-gg/license";import{LicenseManager as Ae,useLicense as _e,sameLicenseKey as ke,resolveDevBuild as Me,capacitorDebug as Pe,isCapacitorNative as xe,loadCapacitorAppHost as Re}from"@buoy-gg/license";import{AccountSetup as Be,HintsProvider as Fe,normalizeEnvironment as Le,registerToolOpener as se,startSettingsSync as je}from"@buoy-gg/shared-ui";import{useState as K,useMemo as g,useCallback as D,useEffect as d,useRef as re}from"react";import{useSettings as Ve,getToolLabel as x,getToolDescription as ze,getToolColor as ae}from"@buoy-gg/floating-tools-react";import{persistentStorage as h,devToolsStorageKeys as R,EnvironmentIndicator as Ne,EnvironmentSelectorInline as We}from"@buoy-gg/shared-ui";import{autoDiscoverWithCustom as Ke,getToolsBySlot as le}from"../utils/autoDiscoverPresets.web.js";import{FloatingTools as He,UserStatus as Ue}from"./floatingTools.web.js";import{DialMenu as $e}from"./dial/DialDevTools.web.js";import{getRankedToolIds as Ye,recordToolUsage as Ge}from"./dial/dialUsageStore.js";import{OnboardingTooltip as Qe}from"./dial/OnboardingTooltip.web.js";import{SettingsModal as Je}from"./DevToolsSettingsModal.web.js";import{AppHostProvider as Xe,AppOverlay as Ze,useAppHost as ce}from"./AppHost.web.js";import{MinimizedToolsStack as qe}from"./MinimizedToolsStack.web.js";import{createWebTools as en}from"../utils/createWebTools.js";import{BrowserToolRuntime as nn}from"./BrowserToolRuntime.js";import{clearReleaseOptIn as tn,markReleaseOptIn as on}from"../releaseOptIn.js";import{BuoySignIn as sn}from"./BuoySignIn.web.js";import{BuoySignIn as de}from"./BuoyCodeSignIn.js";import{DevToolsVisibilityProvider as rn,useDevToolsVisibility as an}from"./DevToolsVisibilityContext.js";import{createWebTool as H}from"../utils/createWebTool.js";import{DefaultConfigProvider as ln}from"./DefaultConfigContext.js";import{useDevToolsSettings as cn}from"./DevToolsSettingsModal.shared.js";import{validateDialConfig as ue}from"./defaultConfig.js";import{installedTools as dn,installedToolsFound as un}from"../installedTools.js";import{jsx as o,jsxs as A,Fragment as U}from"react/jsx-runtime";const fe={};const pe="@react_buoy_floating_menu_tooltip_shown";const fn=h;function pn({size:n=14,color:s="#20C997"}){const i=Math.max(2,n/4);const l=Math.max(1,n/16);return o("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${i}px)`,gap:l,width:n,height:n,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((a,r)=>o("div",{style:{width:i,height:i,borderRadius:i/2,backgroundColor:s}},r))})}function mn(n){const{defaultFloatingTools:s,defaultDialTools:i,disableHints:l=false,children:a}=n;const r=g(()=>i?ue(i):i,[i]);return o(ln,{defaultFloatingTools:s,defaultDialTools:r,children:o(Fe,{disableHints:l,children:A(rn,{children:[o(Xe,{children:o(bn,{...n})}),a]})})})}const gn=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function vn({modules:n=fe}){return o(U,{children:Object.entries(n).flatMap(([s,i])=>gn.map(l=>{const a=i[l];return a?o(a,{},`${s}:${l}`):null}))})}function yn(){const{openApps:n,restore:s}=ce();d(()=>se(i=>{const l=n.find(a=>a.id===i);if(!l)return false;s(l.instanceId);return true}),[n,s]);return null}function Tn(){const n=Pe();const s=n===null?process.env.NODE_ENV:n?"development":"production";return Le(s??"dev")}function hn(n,s,i,l){const a=_=>Object.entries(n).find(([v])=>v.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===_)?.[1];const r=[];const c=a("env");if(s?.length&&c?.createEnvTool&&c.createEnvVarConfig){r.push(H(c.createEnvTool({requiredEnvVars:c.createEnvVarConfig(s)})))}const p=a("storage");if(i?.length&&p?.createStorageTool){r.push(H(p.createStorageTool({requiredStorageKeys:i})))}const I=a("ask-buoy");const b=l==="hosted"?I?.hostedAskBuoy?.():l;if(b&&I?.createAskBuoyTool)r.push(H(I.createAskBuoyTool(b)));return r}function bn({environment:n,userRole:s="admin",availableEnvironments:i,onEnvironmentSwitch:l,apps:a,modules:r=fe,externalSync:c,requiredEnvVars:p,sentryGetClient:I,disableHints:b=false,headless:_=false,hidden:v=false,defaultFloatingTools:ge,defaultDialTools:B,zustandStores:F,requiredStorageKeys:$,askBuoy:Y}){const L=n??Tn();const ve=g(()=>B?ue(B):void 0,[B]);const[m,E]=K(false);const[O,k]=K(false);const j=re(false);const y=ce();const G=g(()=>hn(r,p,$,Y),[r,p,$,Y]);const f=g(()=>Ke([...en(r),...a??[],...G]),[a,r,G]);const V=g(()=>Object.entries(r).find(([e])=>e.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[r]);d(()=>{if(!F||typeof V?.watchStores!=="function")return;const e=V.watchStores(F);return typeof e==="function"?e:void 0},[F,V]);const M=an();const Q=y.openApps.some(e=>!e.minimized);d(()=>{M.setDialOpen(m)},[m,M.setDialOpen]);d(()=>{M.setToolOpen(Q||O)},[Q,O,M.setToolOpen]);const{registerApps:J}=y;d(()=>{J(f.map(e=>{const t=e.icon;return{...e,icon:typeof t==="function"?({size:u})=>t(u):t}}))},[J,f]);const ye=g(()=>f.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[f]);Ve({availableTools:ye,storage:fn});d(()=>{let e=false;const t=async()=>{const[u,T]=await Promise.all([h.getItem(R.dial.isOpen()),h.getItem(R.settings.modalOpen())]);if(e)return;if(u==="true")E(true);if(T==="true"){E(true);k(true)}j.current=true};void t();return()=>{e=true}},[]);d(()=>{if(!j.current)return;void h.setItem(R.dial.isOpen(),m?"true":"false")},[m]);d(()=>{if(!j.current)return;void h.setItem(R.settings.modalOpen(),O?"true":"false")},[O]);const w=D(e=>{void Ge(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const t=typeof e.icon==="function"?e.icon(20):e.icon;y.open({id:e.id,title:e.name||x(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:t,color:e.color||ae(e.id)})}else{e.onPress?.()}},[y]);const X=re({tools:f,openApps:y.openApps,openTool:w});X.current={tools:f,openApps:y.openApps,openTool:w};d(()=>se(e=>{const{tools:t,openApps:u,openTool:T}=X.current;if(u.some(W=>W.id===e))return false;const N=t.find(W=>W.id===e);if(!N||N.launchMode==="toggle-only")return false;T(N);return true}),[]);const P=g(()=>{const e=le(f,"dial");return e.map(t=>{const u=t.color||ae(t.id);let T;if(typeof t.icon==="string"){T=t.icon}else if(typeof t.icon==="function"){T=t.icon(32)}else{T=null}return{id:t.id,name:t.name||x(t.id),icon:T,unavailable:!t.component&&!t.onPress,color:u,onPress:()=>{w(t);E(false)}}})},[f,w]);const Te=g(()=>{if(!m)return P;const e=new Map(P.map(t=>[t.id,t]));return Ye(P.map(t=>t.id)).map(t=>e.get(t)).filter(t=>Boolean(t))},[m,P]);const{settings:z}=cn();const he=g(()=>le(f,"row").filter(e=>(z.floatingTools[e.id]??false)===true&&(e.component||e.onPress)),[f,z.floatingTools]);const be=g(()=>f.map(e=>({id:e.id,name:e.name||x(e.id),description:e.description||ze(e.id),slot:e.slot,icon:e.icon,color:e.color})),[f]);const[Oe,Z]=K(false);const q=y.openApps.some(e=>!e.minimized);d(()=>{if(b)return;let e=false;const t=setTimeout(async()=>{const u=await h.getItem(pe);if(!e&&!u)Z(true)},1e3);return()=>{e=true;clearTimeout(t)}},[b]);const S=D(()=>{Z(false);void h.setItem(pe,"true")},[]);const ee=D(()=>{S();E(true)},[S]);const Se=D(()=>{E(false);k(false)},[]);const Ce=D(()=>{k(e=>!e)},[]);const De=D(()=>k(false),[]);const ne=Boolean(i?.length&&l);const te=z.floatingTools.environment!==false;const C=Oe&&!m&&!q&&!v;d(()=>{if(!C)return;const e=u=>{if(!(u.target instanceof Element)||!u.target.closest("[data-buoy-root]"))S()};const t=u=>{if(u.key==="Escape")S()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",t);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",t)}},[C,S]);const oe=y.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const ie=o(nn,{modules:r,apps:a,requiredEnvVars:p,externalSync:c,headless:_,sentryGetClient:I});if(_)return ie;return A("div",{"data-buoy-root":"",style:{display:"contents"},children:[ie,o(yn,{}),C&&o("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),o("div",{style:v?{visibility:"hidden"}:{display:"contents"},"aria-hidden":v||void 0,children:A(He,{enablePositionPersistence:!C,pushToSide:m||q,suspendPointerEvents:m,centerOnboarding:C,minimizedStack:oe?o(qe,{}):void 0,hasMinimizedStack:oe,children:[L&&te&&!ne&&o(Ne,{environment:L}),ne&&te&&o(We,{currentEnvironment:L??"local",availableEnvironments:i,onSelect:l}),s?o(Ue,{userRole:s,onPress:ee}):o("button",{"aria-label":"Open dev tools",onClick:ee,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:o(pn,{})}),he.map(e=>o("button",{"aria-label":e.name||x(e.id),title:e.description,onClick:()=>w(e),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof e.icon==="function"?e.icon(16):e.icon},e.id))]})}),C&&o(Qe,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:S}),m&&!v&&o($e,{icons:Te,onClose:Se,centerLabel:"BUOY",onCenterPress:Ce,settingsOpen:O,hintsDisabled:b}),O&&!v&&o(Je,{visible:true,onClose:De,availableTools:be,defaultFloatingTools:ge,defaultDialTools:ve,onSettingsChange:e=>{}}),!v&&A(U,{children:[o(Ze,{}),o(Ee,{})]})]})}function On(n){const s=n&&typeof n==="object"?n.appId:void 0;const i=!!n;d(()=>{if(!i)return;let l=false;const a=we.SessionManager;if(!a)return;const r=c=>{if(l||!c)return;a.configure({audience:`app:${c}`});void a.load().catch(()=>{})};if(s)r(s);else void Re().then(c=>r(c?.bundleId)).catch(()=>{});return()=>{l=true}},[i,s])}let me=false;function Sn(n){if(n.modules)return n;if(!un&&!me&&typeof console!=="undefined"){me=true;console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")}return{...n,modules:dn}}export function FloatingDevTools(n){return o(Ie,{children:o(Cn,{...Sn(n)})})}function Cn(n){const{access:s,isPro:i,licenseKey:l}=_e();d(()=>{void Ae.configure(n.licenseKey)},[n.licenseKey]);const a=n.licenseKey===void 0||ke(n.licenseKey,l);const r=Me(typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production");const c=a&&s.status==="admitted";d(()=>{if(c)je()},[c]);d(()=>{if(r||s.status==="initializing")return;if(i&&c)on();else tn()},[r,i,c,s.status]);const p=xe();On(p?n.signIn:void 0);if(!r&&!i){if(!n.signIn||n.headless)return null;return p?o(de,{needsPlan:true}):o(sn,{})}if(!c){return A(U,{children:[s.status==="initializing"&&o(vn,{modules:n.modules}),n.headless?null:n.signIn&&p?o(de,{}):o(Be,{})]})}return o(mn,{...n})}
1
+ "use strict";import{BuoyPortal as _e,FloatingToolHost as Me}from"@buoy-gg/shared-ui/floating";import*as ke from"@buoy-gg/license";import{LicenseManager as Pe,useLicense as ce,sameLicenseKey as xe,resolveDevBuild as Re,capacitorDebug as Be,isCapacitorNative as Fe,loadCapacitorAppHost as Le}from"@buoy-gg/license";import{AccountSetup as je,HintsProvider as Ne,normalizeEnvironment as Ve,registerToolOpener as de,startSettingsSync as ze}from"@buoy-gg/shared-ui";import{useState as H,useMemo as g,useCallback as I,useEffect as d,useRef as ue}from"react";import{useSettings as We,getToolLabel as R,getToolDescription as Ke,getToolColor as fe}from"@buoy-gg/floating-tools-react";import{persistentStorage as h,devToolsStorageKeys as B,EnvironmentIndicator as He,EnvironmentSelectorInline as Ue}from"@buoy-gg/shared-ui";import{autoDiscoverWithCustom as $e,getToolsBySlot as pe}from"../utils/autoDiscoverPresets.web.js";import{filterTeamTools as Ye,isTeamToolAllowed as Ge}from"@buoy-gg/floating-tools-core";import{NO_TEAM_TOOLS_NOTE as Qe}from"./teamToolsNote.js";import{FloatingTools as Je,UserStatus as Xe}from"./floatingTools.web.js";import{DialMenu as Ze}from"./dial/DialDevTools.web.js";import{getRankedToolIds as qe,recordToolUsage as en}from"./dial/dialUsageStore.js";import{OnboardingTooltip as nn}from"./dial/OnboardingTooltip.web.js";import{SettingsModal as on}from"./DevToolsSettingsModal.web.js";import{AppHostProvider as tn,AppOverlay as sn,useAppHost as me}from"./AppHost.web.js";import{MinimizedToolsStack as rn}from"./MinimizedToolsStack.web.js";import{createWebTools as an}from"../utils/createWebTools.js";import{BrowserToolRuntime as ln}from"./BrowserToolRuntime.js";import{clearReleaseOptIn as cn,markReleaseOptIn as dn}from"../releaseOptIn.js";import{BuoySignIn as un}from"./BuoySignIn.web.js";import{BuoySignIn as ge}from"./BuoyCodeSignIn.js";import{DevToolsVisibilityProvider as fn,useDevToolsVisibility as pn}from"./DevToolsVisibilityContext.js";import{createWebTool as U}from"../utils/createWebTool.js";import{DefaultConfigProvider as mn}from"./DefaultConfigContext.js";import{useDevToolsSettings as gn}from"./DevToolsSettingsModal.shared.js";import{validateDialConfig as Te}from"./defaultConfig.js";import{installedTools as Tn,installedToolsFound as vn}from"../installedTools.js";import{jsx as t,jsxs as _,Fragment as $}from"react/jsx-runtime";const ve={};const ye="@react_buoy_floating_menu_tooltip_shown";const yn=h;function hn({size:n=14,color:s="#20C997"}){const i=Math.max(2,n/4);const l=Math.max(1,n/16);return t("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${i}px)`,gap:l,width:n,height:n,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((a,r)=>t("div",{style:{width:i,height:i,borderRadius:i/2,backgroundColor:s}},r))})}function bn(n){const{defaultFloatingTools:s,defaultDialTools:i,disableHints:l=false,children:a}=n;const r=g(()=>i?Te(i):i,[i]);return t(mn,{defaultFloatingTools:s,defaultDialTools:r,children:t(Ne,{disableHints:l,children:_(fn,{children:[t(tn,{children:t(En,{...n})}),a]})})})}const On=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function Sn({modules:n=ve}){return t($,{children:Object.entries(n).flatMap(([s,i])=>On.map(l=>{const a=i[l];return a?t(a,{},`${s}:${l}`):null}))})}function Cn(){const{openApps:n,restore:s}=me();d(()=>de(i=>{const l=n.find(a=>a.id===i);if(!l)return false;s(l.instanceId);return true}),[n,s]);return null}function Dn(){const n=Be();const s=n===null?process.env.NODE_ENV:n?"development":"production";return Ve(s??"dev")}function In(n,s,i,l){const a=M=>Object.entries(n).find(([v])=>v.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===M)?.[1];const r=[];const c=a("env");if(s?.length&&c?.createEnvTool&&c.createEnvVarConfig){r.push(U(c.createEnvTool({requiredEnvVars:c.createEnvVarConfig(s)})))}const p=a("storage");if(i?.length&&p?.createStorageTool){r.push(U(p.createStorageTool({requiredStorageKeys:i})))}const E=a("ask-buoy");const b=l==="hosted"?E?.hostedAskBuoy?.():l;if(b&&E?.createAskBuoyTool)r.push(U(E.createAskBuoyTool(b)));return r}function En({environment:n,userRole:s="admin",availableEnvironments:i,onEnvironmentSwitch:l,apps:a,modules:r=ve,externalSync:c,requiredEnvVars:p,sentryGetClient:E,disableHints:b=false,headless:M=false,hidden:v=false,defaultFloatingTools:be,defaultDialTools:F,zustandStores:L,requiredStorageKeys:Y,askBuoy:G}){const j=n??Dn();const Oe=g(()=>F?Te(F):void 0,[F]);const[m,w]=H(false);const[O,k]=H(false);const N=ue(false);const T=me();const Q=g(()=>In(r,p,Y,G),[r,p,Y,G]);const{allowedTools:S}=ce();const f=g(()=>Ye($e([...an(r),...a??[],...Q]),S),[a,r,Q,S]);const{openApps:J,close:X}=T;d(()=>{if(!S)return;for(const e of J){if(!Ge(e.id,S))X(e.instanceId)}},[J,S,X]);const V=g(()=>Object.entries(r).find(([e])=>e.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[r]);d(()=>{if(!L||typeof V?.watchStores!=="function")return;const e=V.watchStores(L);return typeof e==="function"?e:void 0},[L,V]);const P=pn();const Z=T.openApps.some(e=>!e.minimized);d(()=>{P.setDialOpen(m)},[m,P.setDialOpen]);d(()=>{P.setToolOpen(Z||O)},[Z,O,P.setToolOpen]);const{registerApps:q}=T;d(()=>{q(f.map(e=>{const o=e.icon;return{...e,icon:typeof o==="function"?({size:u})=>o(u):o}}))},[q,f]);const Se=g(()=>f.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[f]);We({availableTools:Se,storage:yn});d(()=>{let e=false;const o=async()=>{const[u,y]=await Promise.all([h.getItem(B.dial.isOpen()),h.getItem(B.settings.modalOpen())]);if(e)return;if(u==="true")w(true);if(y==="true"){w(true);k(true)}N.current=true};void o();return()=>{e=true}},[]);d(()=>{if(!N.current)return;void h.setItem(B.dial.isOpen(),m?"true":"false")},[m]);d(()=>{if(!N.current)return;void h.setItem(B.settings.modalOpen(),O?"true":"false")},[O]);const A=I(e=>{void en(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const o=typeof e.icon==="function"?e.icon(20):e.icon;T.open({id:e.id,title:e.name||R(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:o,color:e.color||fe(e.id)})}else{e.onPress?.()}},[T]);const ee=ue({tools:f,openApps:T.openApps,openTool:A});ee.current={tools:f,openApps:T.openApps,openTool:A};d(()=>de(e=>{const{tools:o,openApps:u,openTool:y}=ee.current;if(u.some(K=>K.id===e))return false;const W=o.find(K=>K.id===e);if(!W||W.launchMode==="toggle-only")return false;y(W);return true}),[]);const x=g(()=>{const e=pe(f,"dial");return e.map(o=>{const u=o.color||fe(o.id);let y;if(typeof o.icon==="string"){y=o.icon}else if(typeof o.icon==="function"){y=o.icon(32)}else{y=null}return{id:o.id,name:o.name||R(o.id),icon:y,unavailable:!o.component&&!o.onPress,color:u,onPress:()=>{A(o);w(false)}}})},[f,A]);const ne=g(()=>{if(!m)return x;const e=new Map(x.map(o=>[o.id,o]));return qe(x.map(o=>o.id)).map(o=>e.get(o)).filter(o=>Boolean(o))},[m,x]);const{settings:z}=gn();const Ce=g(()=>pe(f,"row").filter(e=>(z.floatingTools[e.id]??false)===true&&(e.component||e.onPress)),[f,z.floatingTools]);const De=g(()=>f.map(e=>({id:e.id,name:e.name||R(e.id),description:e.description||Ke(e.id),slot:e.slot,icon:e.icon,color:e.color})),[f]);const[Ie,oe]=H(false);const te=T.openApps.some(e=>!e.minimized);d(()=>{if(b)return;let e=false;const o=setTimeout(async()=>{const u=await h.getItem(ye);if(!e&&!u)oe(true)},1e3);return()=>{e=true;clearTimeout(o)}},[b]);const C=I(()=>{oe(false);void h.setItem(ye,"true")},[]);const ie=I(()=>{C();w(true)},[C]);const Ee=I(()=>{w(false);k(false)},[]);const we=I(()=>{k(e=>!e)},[]);const Ae=I(()=>k(false),[]);const se=Boolean(i?.length&&l);const re=z.floatingTools.environment!==false;const D=Ie&&!m&&!te&&!v;d(()=>{if(!D)return;const e=u=>{if(!(u.target instanceof Element)||!u.target.closest("[data-buoy-root]"))C()};const o=u=>{if(u.key==="Escape")C()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",o);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",o)}},[D,C]);const ae=T.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const le=t(ln,{modules:r,apps:a,requiredEnvVars:p,externalSync:c,headless:M,sentryGetClient:E});if(M)return le;return _("div",{"data-buoy-root":"",style:{display:"contents"},children:[le,t(Cn,{}),D&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),t("div",{style:v?{visibility:"hidden"}:{display:"contents"},"aria-hidden":v||void 0,children:_(Je,{enablePositionPersistence:!D,pushToSide:m||te,suspendPointerEvents:m,centerOnboarding:D,minimizedStack:ae?t(rn,{}):void 0,hasMinimizedStack:ae,children:[j&&re&&!se&&t(He,{environment:j}),se&&re&&t(Ue,{currentEnvironment:j??"local",availableEnvironments:i,onSelect:l}),s?t(Xe,{userRole:s,onPress:ie}):t("button",{"aria-label":"Open dev tools",onClick:ie,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:t(hn,{})}),Ce.map(e=>t("button",{"aria-label":e.name||R(e.id),title:e.description,onClick:()=>A(e),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof e.icon==="function"?e.icon(16):e.icon},e.id))]})}),D&&t(nn,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:C}),m&&!v&&t(Ze,{icons:ne,onClose:Ee,centerLabel:"BUOY",onCenterPress:we,settingsOpen:O,hintsDisabled:b,emptyNote:S&&ne.length===0?Qe:void 0}),O&&!v&&t(on,{visible:true,onClose:Ae,availableTools:De,defaultFloatingTools:be,defaultDialTools:Oe,onSettingsChange:e=>{}}),!v&&_($,{children:[t(sn,{}),t(Me,{})]})]})}function wn(n){const s=n&&typeof n==="object"?n.appId:void 0;const i=!!n;d(()=>{if(!i)return;let l=false;const a=ke.SessionManager;if(!a)return;const r=c=>{if(l||!c)return;a.configure({audience:`app:${c}`});void a.load().catch(()=>{})};if(s)r(s);else void Le().then(c=>r(c?.bundleId)).catch(()=>{});return()=>{l=true}},[i,s])}let he=false;function An(n){if(n.modules)return n;if(!vn&&!he&&typeof console!=="undefined"){he=true;console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")}return{...n,modules:Tn}}export function FloatingDevTools(n){return t(_e,{children:t(_n,{...An(n)})})}function _n(n){const{access:s,isPro:i,licenseKey:l}=ce();d(()=>{void Pe.configure(n.licenseKey)},[n.licenseKey]);const a=n.licenseKey===void 0||xe(n.licenseKey,l);const r=Re(typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production");const c=a&&s.status==="admitted";d(()=>{if(c)ze()},[c]);d(()=>{if(r||s.status==="initializing")return;if(i&&c)dn();else cn()},[r,i,c,s.status]);const p=Fe();wn(p?n.signIn:void 0);if(!r&&!i){if(!n.signIn||n.headless)return null;return p?t(ge,{needsPlan:true}):t(un,{})}if(!c){return _($,{children:[s.status==="initializing"&&t(Sn,{modules:n.modules}),n.headless?null:n.signIn&&p?t(ge,{}):t(je,{})]})}return t(bn,{...n})}
@@ -1 +1 @@
1
- "use strict";import Oe,{useEffect as r,useMemo as M,useRef as A,useState as m}from"react";import{TouchableOpacity as K,StyleSheet as se,View as l}from"react-native";import{absoluteFill as U,registerToolOpener as ie}from"@buoy-gg/shared-ui";import{FloatingTools as re,UserStatus as le}from"./floatingTools";import{renderAppIcon as Y}from"./AppIcon";import{DialDevTools as ae}from"./dial/DialDevTools";import{EnvironmentIndicator as ce,persistentStorage as y,useHintsDisabled as de,devToolsStorageKeys as $,buoyColors as ue}from"@buoy-gg/shared-ui";import{useDevToolsSettings as me}from"./DevToolsSettingsModal";import{useAppHost as ge}from"./AppHost";import{useDevToolsVisibility as fe}from"./DevToolsVisibilityContext.js";import{toggleStateManager as he}from"./ToggleStateManager.js";import{OnboardingTooltip as be}from"./dial/OnboardingTooltip";import{jsx as n,jsxs as x,Fragment as pe}from"react/jsx-runtime";const q="@react_buoy_floating_menu_tooltip_shown";const Re="@react_buoy_onboarding_step";export const FloatingMenu=({apps:t,state:f,actions:a,hidden:h,environment:c,userRole:w="admin",availableEnvironments:b,onEnvironmentSwitch:B})=>{const[P,O]=m(false);const[s,d]=m(false);const[R,J]=m(false);const[Q,E]=m(null);const[,F]=m(0);const H=A(false);const S=de();r(()=>{const e=async()=>{try{const o=await y.getItem($.dial.isOpen());if(o==="true"){d(true)}}catch(o){}finally{J(true)}};e()},[]);r(()=>{if(!R)return;y.setItem($.dial.isOpen(),s?"true":"false").catch(e=>{console.warn("[Buoy]","Failed to save dial state:",e)})},[s,R]);const j=Boolean(b?.length&&B);const{isAnyOpen:i,open:X,registerApps:D,openApps:z}=ge();const k=A(i);const{setDialOpen:L,setToolOpen:N}=fe();r(()=>{if(S){return}const e=async()=>{try{const o=await y.getItem(q);if(!o){setTimeout(()=>{E("positioning")},1e3)}}catch(o){}};e()},[S]);r(()=>{const e=he.subscribe(()=>{F(o=>o+1)});return e},[]);r(()=>{L(s)},[s,L]);r(()=>{N(i)},[i,N]);const Z=M(()=>Boolean(s||i),[s,i]);const v=M(()=>Boolean(h??P),[h,P]);const{settings:p}=me();r(()=>{if(D){D(t)}},[t,D]);const T=M(()=>{return{...a??{},closeMenu:()=>d(false),hideFloatingRow:()=>O(true),showFloatingRow:()=>O(false),notifyToggleChange:()=>F(e=>e+1)}},[a]);r(()=>{if(k.current&&!i){O(false);d(false)}k.current=i},[i]);const ee=e=>{if(!p)return false;return p.floatingTools[e]??false};const I=e=>{e?.onPress?.(T);if(e.launchMode!=="toggle-only"){const o=Y(e.icon,{slot:"dial",size:20,color:e.color});X({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:o,color:e.color,modal:e.modal})}};const W=A({apps:t,openApps:z,handlePress:I});W.current={apps:t,openApps:z,handlePress:I};r(()=>ie(e=>{const{apps:o,openApps:ne,handlePress:te}=W.current;if(ne.some(C=>C.id===e))return false;const _=o.find(C=>C.id===e);if(!_||_.launchMode==="toggle-only")return false;te(_);return true}),[]);const G=()=>{H.current=true;E(null);y.setItem(q,"true").catch(e=>{console.warn("[Buoy]","Failed to save onboarding state:",e)})};const V=()=>{if(u){G()}d(true)};const u=Q==="positioning"&&!H.current&&!S;const oe=!u;return x(pe,{children:[u&&!s&&!i&&x(l,{style:g.onboardingContainer,children:[n(l,{style:g.onboardingBackdrop}),n(be,{visible:true,onDismiss:G,title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools."})]}),n(l,{nativeID:"floating-devtools-root",pointerEvents:v||s?"none":"box-none",style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:u?10001:9999,opacity:v?0:1},children:x(re,{enablePositionPersistence:oe,pushToSide:Z,centerOnboarding:u,environment:c,availableEnvironments:b,onEnvironmentSwitch:B,showEnvironmentSelector:j&&p?.floatingTools?.environment,children:[c&&p?.floatingTools?.environment!==false&&!j?n(ce,{environment:c}):null,w?n(le,{userRole:w,onPress:V}):n(K,{accessibilityLabel:"Open Dev Tools Menu",onPress:V,style:g.fab,children:n(l,{style:g.menuButton,children:n(ye,{size:14})})}),t.filter(e=>(e.slot??"both")!=="dial"&&ee(e.id)).map(e=>n(K,{accessibilityLabel:e.name,onPress:()=>I(e),style:g.fab,children:(()=>{if(typeof e.icon==="function"){const o=e.icon;return n(o,{slot:"row",size:16,state:f,actions:T})}return Y(e.icon,{slot:"row",size:16,color:e.color})})()},`row-${e.id}`))]})}),s&&!v&&n(ae,{apps:t,state:f,actions:T,onClose:()=>{d(false)}})]})};const g=se.create({fab:{paddingHorizontal:6,paddingVertical:4,borderRadius:6,marginRight:4,alignItems:"center",justifyContent:"center",minWidth:0,minHeight:0,backgroundColor:"transparent"},menuButton:{paddingHorizontal:4,paddingVertical:2,minWidth:16,alignItems:"center",justifyContent:"center"},menuDots:{color:"#8CA2C8",fontSize:14,fontWeight:"900"},onboardingContainer:{...U,zIndex:1e4},onboardingBackdrop:{...U,backgroundColor:"rgba(0, 0, 0, 0.85)"}});const ye=({size:t=14,color:f=ue.primary})=>{const a=Math.max(2,Math.floor(t/4));const h=Math.max(1,Math.floor(t/16));const c=Array.from({length:9});return n(l,{style:{width:t,height:t,flexDirection:"row",flexWrap:"wrap",alignContent:"center",justifyContent:"center"},children:c.map((w,b)=>n(l,{style:{width:a,height:a,margin:h,borderRadius:2,backgroundColor:f}},b))})};
1
+ "use strict";import Se,{useEffect as r,useMemo as M,useRef as A,useState as u}from"react";import{TouchableOpacity as U,StyleSheet as ie,View as l}from"react-native";import{absoluteFill as Y,registerToolOpener as re}from"@buoy-gg/shared-ui";import{FloatingTools as le,UserStatus as ae}from"./floatingTools";import{renderAppIcon as $}from"./AppIcon";import{DialDevTools as ce}from"./dial/DialDevTools";import{EnvironmentIndicator as de,persistentStorage as y,useHintsDisabled as ue,devToolsStorageKeys as q,buoyColors as me}from"@buoy-gg/shared-ui";import{useDevToolsSettings as ge}from"./DevToolsSettingsModal";import{useAppHost as fe}from"./AppHost";import{useDevToolsVisibility as he}from"./DevToolsVisibilityContext.js";import{toggleStateManager as be}from"./ToggleStateManager.js";import{OnboardingTooltip as pe}from"./dial/OnboardingTooltip";import{jsx as n,jsxs as x,Fragment as ye}from"react/jsx-runtime";const J="@react_buoy_floating_menu_tooltip_shown";const Ee="@react_buoy_onboarding_step";export const FloatingMenu=({apps:t,emptyNote:w,state:a,actions:g,hidden:f,environment:h,userRole:b="admin",availableEnvironments:B,onEnvironmentSwitch:P})=>{const[R,O]=u(false);const[s,c]=u(false);const[E,Q]=u(false);const[X,F]=u(null);const[,H]=u(0);const j=A(false);const S=ue();r(()=>{const e=async()=>{try{const o=await y.getItem(q.dial.isOpen());if(o==="true"){c(true)}}catch(o){}finally{Q(true)}};e()},[]);r(()=>{if(!E)return;y.setItem(q.dial.isOpen(),s?"true":"false").catch(e=>{console.warn("[Buoy]","Failed to save dial state:",e)})},[s,E]);const z=Boolean(B?.length&&P);const{isAnyOpen:i,open:Z,registerApps:D,openApps:N}=fe();const k=A(i);const{setDialOpen:L,setToolOpen:W}=he();r(()=>{if(S){return}const e=async()=>{try{const o=await y.getItem(J);if(!o){setTimeout(()=>{F("positioning")},1e3)}}catch(o){}};e()},[S]);r(()=>{const e=be.subscribe(()=>{H(o=>o+1)});return e},[]);r(()=>{L(s)},[s,L]);r(()=>{W(i)},[i,W]);const ee=M(()=>Boolean(s||i),[s,i]);const v=M(()=>Boolean(f??R),[f,R]);const{settings:p}=ge();r(()=>{if(D){D(t)}},[t,D]);const T=M(()=>{return{...g??{},closeMenu:()=>c(false),hideFloatingRow:()=>O(true),showFloatingRow:()=>O(false),notifyToggleChange:()=>H(e=>e+1)}},[g]);r(()=>{if(k.current&&!i){O(false);c(false)}k.current=i},[i]);const oe=e=>{if(!p)return false;return p.floatingTools[e]??false};const I=e=>{e?.onPress?.(T);if(e.launchMode!=="toggle-only"){const o=$(e.icon,{slot:"dial",size:20,color:e.color});Z({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:o,color:e.color,modal:e.modal})}};const G=A({apps:t,openApps:N,handlePress:I});G.current={apps:t,openApps:N,handlePress:I};r(()=>re(e=>{const{apps:o,openApps:te,handlePress:se}=G.current;if(te.some(C=>C.id===e))return false;const _=o.find(C=>C.id===e);if(!_||_.launchMode==="toggle-only")return false;se(_);return true}),[]);const V=()=>{j.current=true;F(null);y.setItem(J,"true").catch(e=>{console.warn("[Buoy]","Failed to save onboarding state:",e)})};const K=()=>{if(d){V()}c(true)};const d=X==="positioning"&&!j.current&&!S;const ne=!d;return x(ye,{children:[d&&!s&&!i&&x(l,{style:m.onboardingContainer,children:[n(l,{style:m.onboardingBackdrop}),n(pe,{visible:true,onDismiss:V,title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools."})]}),n(l,{nativeID:"floating-devtools-root",pointerEvents:v||s?"none":"box-none",style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:d?10001:9999,opacity:v?0:1},children:x(le,{enablePositionPersistence:ne,pushToSide:ee,centerOnboarding:d,environment:h,availableEnvironments:B,onEnvironmentSwitch:P,showEnvironmentSelector:z&&p?.floatingTools?.environment,children:[h&&p?.floatingTools?.environment!==false&&!z?n(de,{environment:h}):null,b?n(ae,{userRole:b,onPress:K}):n(U,{accessibilityLabel:"Open Dev Tools Menu",onPress:K,style:m.fab,children:n(l,{style:m.menuButton,children:n(we,{size:14})})}),t.filter(e=>(e.slot??"both")!=="dial"&&oe(e.id)).map(e=>n(U,{accessibilityLabel:e.name,onPress:()=>I(e),style:m.fab,children:(()=>{if(typeof e.icon==="function"){const o=e.icon;return n(o,{slot:"row",size:16,state:a,actions:T})}return $(e.icon,{slot:"row",size:16,color:e.color})})()},`row-${e.id}`))]})}),s&&!v&&n(ce,{apps:t,emptyNote:w,state:a,actions:T,onClose:()=>{c(false)}})]})};const m=ie.create({fab:{paddingHorizontal:6,paddingVertical:4,borderRadius:6,marginRight:4,alignItems:"center",justifyContent:"center",minWidth:0,minHeight:0,backgroundColor:"transparent"},menuButton:{paddingHorizontal:4,paddingVertical:2,minWidth:16,alignItems:"center",justifyContent:"center"},menuDots:{color:"#8CA2C8",fontSize:14,fontWeight:"900"},onboardingContainer:{...Y,zIndex:1e4},onboardingBackdrop:{...Y,backgroundColor:"rgba(0, 0, 0, 0.85)"}});const we=({size:t=14,color:w=me.primary})=>{const a=Math.max(2,Math.floor(t/4));const g=Math.max(1,Math.floor(t/16));const f=Array.from({length:9});return n(l,{style:{width:t,height:t,flexDirection:"row",flexWrap:"wrap",alignContent:"center",justifyContent:"center"},children:f.map((h,b)=>n(l,{style:{width:a,height:a,margin:g,borderRadius:2,backgroundColor:w}},b))})};
@@ -0,0 +1 @@
1
+ "use strict";import{useEffect as p}from"react";import{isTeamToolAllowed as f}from"@buoy-gg/floating-tools-core";import{useAppHost as i}from"./AppHost";export function TeamToolCloser({allowedTools:o}){const{openApps:r,close:t}=i();p(()=>{if(!o)return;for(const e of r){if(!f(e.id,o))t(e.instanceId)}},[r,o,t]);return null}
@@ -1 +1 @@
1
- "use strict";import{useEffect as b,useMemo as S,useRef as f,useState as w}from"react";import{Pressable as Ie,StyleSheet as Le,TouchableOpacity as Be,View as s,useWindowDimensions as Oe,Text as P,Animated as o,Easing as l}from"react-native";import{absoluteFill as u,monoFont as oe}from"@buoy-gg/shared-ui";import{DialIcon as ne}from"./DialIcon.js";import{DialHyperspace as Pe}from"./DialHyperspace.js";import{DialPagination as Re}from"./DialPagination.js";import{getRankedToolIds as F,isDialUsageLoaded as Ae,loadDialUsage as Ve,recordToolUsage as Ne}from"./dialUsageStore.js";import{persistentStorage as R,useHintsDisabled as Ge,devToolsStorageKeys as ie,buoyColors as re,ToolBackground as Me,useToolBackground as _e}from"@buoy-gg/shared-ui";import{DevToolsSettingsModal as Ee,useDevToolsSettings as Fe}from"../DevToolsSettingsModal";import{useProAccess as je}from"@buoy-gg/license";import{renderAppIcon as ae}from"../AppIcon";import{useAppHost as ze}from"../AppHost";import{OnboardingTooltip as Ue}from"./OnboardingTooltip";import{getDialLayout as We,MAX_DIAL_SLOTS as v,DIAL_BUTTON_SIZE as qe,dialAnimationConfig as j,dialColors as a}from"@buoy-gg/floating-tools-core";import{jsx as i,jsxs as h,Fragment as se}from"react/jsx-runtime";const c=qe;const He={x:.5,y:.5};const $e=c*.75+6;const Ke=false;const le="@react_buoy_settings_tooltip_shown";const Ye=y=>({id:`empty-${y}`,name:`empty-${y}`,icon:null,color:"transparent",onPress:()=>{}});export const DialDevTools=({onClose:y,onSettingsPress:ce,autoOpenSettings:z=false,apps:L,state:Ze,actions:U})=>{const[de,ue]=w(-1);const[g,T]=w(false);const[W,ge]=w(false);const[q,H]=w(false);const A=f(false);const $=Ge();const{refreshSettings:pe}=Fe();const{open:K}=ze();const{isPro:me,isWeekendFree:Y}=je();const{width:V,height:fe}=Oe();const d=We({screenWidth:V}).circleSize;const{id:he}=_e();const p=S(()=>({parent:{width:d,height:d},circle:{width:d,height:d,borderRadius:d/2},rounded:{borderRadius:d/2},gridLine:{width:d},spoke:{width:d/2-$e}}),[d]);b(()=>{const t=async()=>{try{const e=await R.getItem(ie.settings.modalOpen());if(e==="true"){T(true)}}catch(e){}finally{ge(true)}};t()},[]);b(()=>{if(!W)return;R.setItem(ie.settings.modalOpen(),g?"true":"false").catch(t=>{console.warn("[Buoy]","Failed to save settings modal state:",t)})},[g,W]);b(()=>{if(z&&!g){T(true)}},[z,g]);b(()=>{if($){return}const t=async()=>{try{const e=await R.getItem(le);if(!e){setTimeout(()=>{H(true)},1200)}}catch(e){}};t()},[$]);const N=f(new o.Value(0)).current;const k=f(new o.Value(0)).current;const G=f(new o.Value(0)).current;const D=f(new o.Value(0)).current;const B=f(new o.Value(0)).current;const M=f(new o.Value(1)).current;const ye=S(()=>L.map(({id:t,name:e,slot:r,description:I,icon:xe,color:Ce})=>({id:t,name:e,slot:r,description:I,icon:xe,color:Ce})),[L]);const x=f(null);const be=()=>{if(g){T(false);return}T(true);if(q&&!A.current){Q()}ce?.()};const C=S(()=>L.filter(t=>(t.slot??"both")!=="row"),[L]);const Z=S(()=>{const t=new Map;for(const e of C){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:ae(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??re.primary,onPress:()=>{void Ne(e.id);e?.onPress?.(U);if(e.launchMode!=="toggle-only"){const r=ae(e.icon,{slot:"dial",size:20,color:e.color});K({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:r,color:e.color,modal:e.modal})}y?.()}})}return t},[C,U,K,y]);const[_,X]=w(()=>F(C.map(t=>t.id)));b(()=>{const t=C.map(r=>r.id);if(Ae()){X(F(t));return}let e=false;Ve().then(()=>{if(!e)X(F(t))});return()=>{e=true}},[C]);const O=Math.max(1,Math.ceil(_.length/v));const[Se,we]=w(0);const m=Math.min(Se,O-1);const E=S(()=>{return _.map(t=>Z.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/v),slot:e%v}))},[_,Z]);const ve=S(()=>{const t=E.filter(r=>r.page===m).length;const e=[];for(let r=t;r<v;r+=1)e.push(r);return e},[E,m]);const J=t=>{const e=Math.max(0,Math.min(t,O-1));if(e!==m)we(e)};b(()=>{const t=j??{entrance:{backdrop:{duration:400},dial:{scale:{damping:15,stiffness:150,mass:1},rotation:{duration:800}},centerButton:{delay:150,damping:10,stiffness:200},icons:{delay:200,duration:400},circuitTraces:{delay:600,duration:1e3}},continuous:{glitch:{interval:3e3,offset:2,stepDuration:50},pulse:{maxScale:1.02,minScale:.98,duration:1e3},floating:{maxY:-8,minY:0,duration:3e3},breathing:{maxScale:1.05,minScale:.98,duration:2500}}};const{entrance:e,continuous:r}=t;o.timing(N,{toValue:1,duration:e.backdrop.duration,useNativeDriver:true}).start();o.spring(k,{toValue:1,damping:e.dial.scale.damping,stiffness:e.dial.scale.stiffness,mass:e.dial.scale.mass,useNativeDriver:true}).start();o.sequence([o.timing(G,{toValue:1,duration:e.dial.rotation.duration,easing:l.out(l.cubic),useNativeDriver:true}),o.timing(G,{toValue:0,duration:0,useNativeDriver:true})]).start();o.sequence([o.delay(e.centerButton.delay),o.spring(D,{toValue:1,damping:e.centerButton.damping,stiffness:e.centerButton.stiffness,useNativeDriver:true})]).start();o.sequence([o.delay(e.icons.delay),o.timing(B,{toValue:1,duration:e.icons.duration,easing:l.out(l.cubic),useNativeDriver:true})]).start();if(!Ke)return;x.current=o.loop(o.sequence([o.timing(M,{toValue:r.pulse.maxScale,duration:r.pulse.duration,easing:l.inOut(l.ease),useNativeDriver:true}),o.timing(M,{toValue:r.pulse.minScale,duration:r.pulse.duration,easing:l.inOut(l.ease),useNativeDriver:true})]));x.current.start();return()=>{x.current?.stop()}},[]);const Q=()=>{A.current=true;H(false);R.setItem(le,"true").catch(t=>{console.warn("[Buoy]","Failed to save dial onboarding state:",t)})};const ee=()=>{if(x.current){x.current.stop()}const t=j?.exit??{icons:{duration:300},centerButton:{duration:200},dialScale:{duration:250},backdrop:{duration:200}};o.sequence([o.timing(B,{toValue:0,duration:t.icons.duration,easing:l.in(l.cubic),useNativeDriver:true}),o.parallel([o.timing(D,{toValue:0,duration:t.centerButton.duration,easing:l.in(l.cubic),useNativeDriver:true}),o.timing(k,{toValue:0,duration:t.dialScale.duration,easing:l.in(l.cubic),useNativeDriver:true})]),o.timing(N,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(y){setTimeout(()=>{y()},0)}})};const te=t=>{ue(1);const e=j?.interaction??{iconSelect:{pulse:[{scale:.9,damping:15,stiffness:500},{scale:1,damping:10,stiffness:200}],actionDelay:50}};const[r,I]=e.iconSelect.pulse;o.sequence([o.spring(D,{toValue:r.scale,damping:r.damping,stiffness:r.stiffness,useNativeDriver:true}),o.spring(D,{toValue:I.scale,damping:I.damping,stiffness:I.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){ee()}},e.iconSelect.actionDelay)};const Te={opacity:N};const ke={transform:[{scale:D}]};const De={transform:[{scale:de>=0?1:M}]};return h(s,{style:n.container,nativeID:"dial-devtools-root",children:[i(o.View,{style:[n.backdrop,Te],children:i(Ie,{style:u,onPress:ee})}),h(o.View,{style:[n.parent,p.parent,{position:"absolute",left:(V-d)/2,bottom:80,transform:[{scale:k},{rotate:G.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[h(o.View,{style:[n.circle,p.circle],children:[h(s,{style:[n.gradientBackground,p.rounded],children:[i(s,{style:[n.gradientLayer1,p.rounded]}),i(s,{style:[n.gradientLayer2,p.rounded]}),i(s,{style:[n.gradientLayer3,p.rounded]}),i(s,{style:n.gridPattern,children:Array.from({length:6}).map((t,e)=>h(s,{style:[n.gridLine,p.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[i(s,{style:[n.spoke,p.spoke,n.spokeLeft]}),i(s,{style:[n.spoke,p.spoke,n.spokeRight]})]},e))}),he==="hyperspace"?i(Pe,{size:d}):i(Me,{focus:He})]}),E.filter(({page:t})=>t===m).map(({icon:t,slot:e})=>i(ne,{onPress:te,iconsProgress:B,icon:t,index:e,totalIcons:v,active:true},t.id??`page${m}-${e}`)),ve.map(t=>i(ne,{onPress:te,iconsProgress:B,icon:Ye(t),index:t,totalIcons:v,active:true},`empty-${t}`))]}),i(o.View,{style:[n.buttonContainer,ke],children:h(s,{style:n.buttonGradient,children:[i(s,{style:n.buttonGradientLayer1}),i(s,{style:n.buttonGradientLayer2}),i(s,{style:n.buttonGradientLayer3}),i(s,{style:n.buttonBorder,children:i(o.View,{style:[n.button,De],children:i(Be,{accessibilityRole:"button",accessibilityLabel:g?"Close Settings":"Open Dev Tools Settings",onPress:be,activeOpacity:.5,style:n.buttonPressable,children:g?h(se,{children:[i(P,{style:[n.centerText,n.closeTextTop],children:"CLOSE"}),i(P,{style:[n.centerText,n.closeTextBottom],children:"SETTINGS"})]}):h(se,{children:[i(P,{style:n.centerText,children:"BUOY"}),me&&i(P,{style:[n.proText,Y&&n.weekendText],children:Y?"WEEKEND":"PRO"})]})})})})]})})]}),O>1&&i(Re,{page:m,pageCount:O,onPrev:()=>J(m-1),onNext:()=>J(m+1),animatedStyle:{position:"absolute",left:(V-d)/2,top:fe-80+16,width:d,opacity:k,transform:[{scale:k}]}}),g&&i(Ee,{visible:true,onClose:()=>{T(false);pe()},availableApps:ye}),q&&!g&&!A.current&&i(Ue,{visible:true,onDismiss:Q})]})};const n=Le.create({container:{...u,zIndex:9999},backdrop:{...u,backgroundColor:a.dialBackdrop},parent:{alignItems:"center",justifyContent:"center"},circle:{position:"absolute",backgroundColor:"transparent",borderWidth:1,borderColor:a.dialBorder,shadowColor:a.dialShadow,shadowOffset:{width:0,height:0},shadowOpacity:.5,shadowRadius:20,elevation:10},gradientBackground:{width:"100%",height:"100%",position:"relative",backgroundColor:a.dialBackground,overflow:"hidden"},gradientLayer1:{...u,backgroundColor:a.dialGradient1,opacity:.6},gradientLayer2:{...u,backgroundColor:a.dialGradient2,opacity:.4,top:"30%",left:"30%"},gradientLayer3:{...u,backgroundColor:a.dialGradient3,opacity:.3,top:"50%",left:"50%"},gridPattern:{...u,alignItems:"center",justifyContent:"center"},gridLine:{position:"absolute",height:1},spoke:{position:"absolute",top:0,height:1,backgroundColor:a.dialGridLine},spokeLeft:{left:0},spokeRight:{right:0},buttonContainer:{zIndex:1,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",position:"absolute",width:c*1.5,height:c*1.5,borderRadius:c},buttonGradient:{width:"100%",height:"100%",borderRadius:c,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:a.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{...u,backgroundColor:a.dialGradient1,opacity:.5,borderRadius:c},buttonGradientLayer2:{...u,backgroundColor:a.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:c},buttonGradientLayer3:{...u,backgroundColor:a.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:c},buttonBorder:{backgroundColor:a.hubFill,alignItems:"center",justifyContent:"center",width:c*1.2,height:c*1.2,borderRadius:c*.6},button:{width:c,height:c,borderRadius:c/2,justifyContent:"center",alignItems:"center",position:"relative",overflow:"hidden"},buttonPressable:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},centerText:{color:a.centerText,fontSize:10,fontWeight:"900",fontFamily:oe,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},closeTextBottom:{marginTop:-2},proText:{color:re.warning,fontSize:8,fontWeight:"900",fontFamily:oe,letterSpacing:2,textAlign:"center",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},weekendText:{color:"#BF5AF2",letterSpacing:1}});
1
+ "use strict";import{useEffect as S,useMemo as v,useRef as f,useState as w}from"react";import{Pressable as Le,StyleSheet as Be,TouchableOpacity as Oe,View as l,useWindowDimensions as Re,Text as L,Animated as o,Easing as c}from"react-native";import{absoluteFill as u,monoFont as F}from"@buoy-gg/shared-ui";import{DialIcon as ie}from"./DialIcon.js";import{DialHyperspace as Pe}from"./DialHyperspace.js";import{DialPagination as Ae}from"./DialPagination.js";import{getRankedToolIds as j,isDialUsageLoaded as Ve,loadDialUsage as Ne,recordToolUsage as Ge}from"./dialUsageStore.js";import{persistentStorage as P,useHintsDisabled as Me,devToolsStorageKeys as re,buoyColors as ae,ToolBackground as _e,useToolBackground as Ee}from"@buoy-gg/shared-ui";import{DevToolsSettingsModal as Fe,useDevToolsSettings as je}from"../DevToolsSettingsModal";import{useProAccess as ze}from"@buoy-gg/license";import{renderAppIcon as se}from"../AppIcon";import{useAppHost as Ue}from"../AppHost";import{OnboardingTooltip as We}from"./OnboardingTooltip";import{getDialLayout as $e,MAX_DIAL_SLOTS as T,DIAL_BUTTON_SIZE as qe,dialAnimationConfig as z,dialColors as a}from"@buoy-gg/floating-tools-core";import{jsx as i,jsxs as h,Fragment as le}from"react/jsx-runtime";const d=qe;const He={x:.5,y:.5};const Ke=d*.75+6;const Ye=false;const ce="@react_buoy_settings_tooltip_shown";const Ze=y=>({id:`empty-${y}`,name:`empty-${y}`,icon:null,color:"transparent",onPress:()=>{}});export const DialDevTools=({onClose:y,onSettingsPress:de,autoOpenSettings:U=false,apps:B,emptyNote:W,state:Xe,actions:$})=>{const[ue,ge]=w(-1);const[g,k]=w(false);const[q,pe]=w(false);const[H,K]=w(false);const A=f(false);const Y=Me();const{refreshSettings:me}=je();const{open:Z}=Ue();const{isPro:fe,isWeekendFree:X}=ze();const{width:V,height:he}=Re();const s=$e({screenWidth:V}).circleSize;const{id:ye}=Ee();const p=v(()=>({parent:{width:s,height:s},circle:{width:s,height:s,borderRadius:s/2},rounded:{borderRadius:s/2},gridLine:{width:s},spoke:{width:s/2-Ke}}),[s]);S(()=>{const t=async()=>{try{const e=await P.getItem(re.settings.modalOpen());if(e==="true"){k(true)}}catch(e){}finally{pe(true)}};t()},[]);S(()=>{if(!q)return;P.setItem(re.settings.modalOpen(),g?"true":"false").catch(t=>{console.warn("[Buoy]","Failed to save settings modal state:",t)})},[g,q]);S(()=>{if(U&&!g){k(true)}},[U,g]);S(()=>{if(Y){return}const t=async()=>{try{const e=await P.getItem(ce);if(!e){setTimeout(()=>{K(true)},1200)}}catch(e){}};t()},[Y]);const N=f(new o.Value(0)).current;const D=f(new o.Value(0)).current;const G=f(new o.Value(0)).current;const x=f(new o.Value(0)).current;const O=f(new o.Value(0)).current;const M=f(new o.Value(1)).current;const be=v(()=>B.map(({id:t,name:e,slot:r,description:I,icon:Ce,color:Ie})=>({id:t,name:e,slot:r,description:I,icon:Ce,color:Ie})),[B]);const C=f(null);const Se=()=>{if(g){k(false);return}k(true);if(H&&!A.current){te()}de?.()};const b=v(()=>B.filter(t=>(t.slot??"both")!=="row"),[B]);const J=v(()=>{const t=new Map;for(const e of b){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:se(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??ae.primary,onPress:()=>{void Ge(e.id);e?.onPress?.($);if(e.launchMode!=="toggle-only"){const r=se(e.icon,{slot:"dial",size:20,color:e.color});Z({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:r,color:e.color,modal:e.modal})}y?.()}})}return t},[b,$,Z,y]);const[_,Q]=w(()=>j(b.map(t=>t.id)));S(()=>{const t=b.map(r=>r.id);if(Ve()){Q(j(t));return}let e=false;Ne().then(()=>{if(!e)Q(j(t))});return()=>{e=true}},[b]);const R=Math.max(1,Math.ceil(_.length/T));const[ve,we]=w(0);const m=Math.min(ve,R-1);const E=v(()=>{return _.map(t=>J.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/T),slot:e%T}))},[_,J]);const Te=v(()=>{const t=E.filter(r=>r.page===m).length;const e=[];for(let r=t;r<T;r+=1)e.push(r);return e},[E,m]);const ee=t=>{const e=Math.max(0,Math.min(t,R-1));if(e!==m)we(e)};S(()=>{const t=z??{entrance:{backdrop:{duration:400},dial:{scale:{damping:15,stiffness:150,mass:1},rotation:{duration:800}},centerButton:{delay:150,damping:10,stiffness:200},icons:{delay:200,duration:400},circuitTraces:{delay:600,duration:1e3}},continuous:{glitch:{interval:3e3,offset:2,stepDuration:50},pulse:{maxScale:1.02,minScale:.98,duration:1e3},floating:{maxY:-8,minY:0,duration:3e3},breathing:{maxScale:1.05,minScale:.98,duration:2500}}};const{entrance:e,continuous:r}=t;o.timing(N,{toValue:1,duration:e.backdrop.duration,useNativeDriver:true}).start();o.spring(D,{toValue:1,damping:e.dial.scale.damping,stiffness:e.dial.scale.stiffness,mass:e.dial.scale.mass,useNativeDriver:true}).start();o.sequence([o.timing(G,{toValue:1,duration:e.dial.rotation.duration,easing:c.out(c.cubic),useNativeDriver:true}),o.timing(G,{toValue:0,duration:0,useNativeDriver:true})]).start();o.sequence([o.delay(e.centerButton.delay),o.spring(x,{toValue:1,damping:e.centerButton.damping,stiffness:e.centerButton.stiffness,useNativeDriver:true})]).start();o.sequence([o.delay(e.icons.delay),o.timing(O,{toValue:1,duration:e.icons.duration,easing:c.out(c.cubic),useNativeDriver:true})]).start();if(!Ye)return;C.current=o.loop(o.sequence([o.timing(M,{toValue:r.pulse.maxScale,duration:r.pulse.duration,easing:c.inOut(c.ease),useNativeDriver:true}),o.timing(M,{toValue:r.pulse.minScale,duration:r.pulse.duration,easing:c.inOut(c.ease),useNativeDriver:true})]));C.current.start();return()=>{C.current?.stop()}},[]);const te=()=>{A.current=true;K(false);P.setItem(ce,"true").catch(t=>{console.warn("[Buoy]","Failed to save dial onboarding state:",t)})};const oe=()=>{if(C.current){C.current.stop()}const t=z?.exit??{icons:{duration:300},centerButton:{duration:200},dialScale:{duration:250},backdrop:{duration:200}};o.sequence([o.timing(O,{toValue:0,duration:t.icons.duration,easing:c.in(c.cubic),useNativeDriver:true}),o.parallel([o.timing(x,{toValue:0,duration:t.centerButton.duration,easing:c.in(c.cubic),useNativeDriver:true}),o.timing(D,{toValue:0,duration:t.dialScale.duration,easing:c.in(c.cubic),useNativeDriver:true})]),o.timing(N,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(y){setTimeout(()=>{y()},0)}})};const ne=t=>{ge(1);const e=z?.interaction??{iconSelect:{pulse:[{scale:.9,damping:15,stiffness:500},{scale:1,damping:10,stiffness:200}],actionDelay:50}};const[r,I]=e.iconSelect.pulse;o.sequence([o.spring(x,{toValue:r.scale,damping:r.damping,stiffness:r.stiffness,useNativeDriver:true}),o.spring(x,{toValue:I.scale,damping:I.damping,stiffness:I.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){oe()}},e.iconSelect.actionDelay)};const ke={opacity:N};const De={transform:[{scale:x}]};const xe={transform:[{scale:ue>=0?1:M}]};return h(l,{style:n.container,nativeID:"dial-devtools-root",children:[i(o.View,{style:[n.backdrop,ke],children:i(Le,{style:u,onPress:oe})}),b.length===0&&W?i(L,{style:[n.emptyNote,{bottom:80+s+16}],accessibilityLiveRegion:"polite",testID:"buoy-dial-empty-note",children:W}):null,h(o.View,{style:[n.parent,p.parent,{position:"absolute",left:(V-s)/2,bottom:80,transform:[{scale:D},{rotate:G.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[h(o.View,{style:[n.circle,p.circle],children:[h(l,{style:[n.gradientBackground,p.rounded],children:[i(l,{style:[n.gradientLayer1,p.rounded]}),i(l,{style:[n.gradientLayer2,p.rounded]}),i(l,{style:[n.gradientLayer3,p.rounded]}),i(l,{style:n.gridPattern,children:Array.from({length:6}).map((t,e)=>h(l,{style:[n.gridLine,p.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[i(l,{style:[n.spoke,p.spoke,n.spokeLeft]}),i(l,{style:[n.spoke,p.spoke,n.spokeRight]})]},e))}),ye==="hyperspace"?i(Pe,{size:s}):i(_e,{focus:He})]}),E.filter(({page:t})=>t===m).map(({icon:t,slot:e})=>i(ie,{onPress:ne,iconsProgress:O,icon:t,index:e,totalIcons:T,active:true},`${t.id??"icon"}:${m}:${e}`)),Te.map(t=>i(ie,{onPress:ne,iconsProgress:O,icon:Ze(t),index:t,totalIcons:T,active:true},`empty-${t}`))]}),i(o.View,{style:[n.buttonContainer,De],children:h(l,{style:n.buttonGradient,children:[i(l,{style:n.buttonGradientLayer1}),i(l,{style:n.buttonGradientLayer2}),i(l,{style:n.buttonGradientLayer3}),i(l,{style:n.buttonBorder,children:i(o.View,{style:[n.button,xe],children:i(Oe,{accessibilityRole:"button",accessibilityLabel:g?"Close Settings":"Open Dev Tools Settings",onPress:Se,activeOpacity:.5,style:n.buttonPressable,children:g?h(le,{children:[i(L,{style:[n.centerText,n.closeTextTop],children:"CLOSE"}),i(L,{style:[n.centerText,n.closeTextBottom],children:"SETTINGS"})]}):h(le,{children:[i(L,{style:n.centerText,children:"BUOY"}),fe&&i(L,{style:[n.proText,X&&n.weekendText],children:X?"WEEKEND":"PRO"})]})})})})]})})]}),R>1&&i(Ae,{page:m,pageCount:R,onPrev:()=>ee(m-1),onNext:()=>ee(m+1),animatedStyle:{position:"absolute",left:(V-s)/2,top:he-80+16,width:s,opacity:D,transform:[{scale:D}]}}),g&&i(Fe,{visible:true,onClose:()=>{k(false);me()},availableApps:be}),H&&!g&&!A.current&&i(We,{visible:true,onDismiss:te})]})};const n=Be.create({container:{...u,zIndex:9999},backdrop:{...u,backgroundColor:a.dialBackdrop},parent:{alignItems:"center",justifyContent:"center"},circle:{position:"absolute",backgroundColor:"transparent",borderWidth:1,borderColor:a.dialBorder,shadowColor:a.dialShadow,shadowOffset:{width:0,height:0},shadowOpacity:.5,shadowRadius:20,elevation:10},gradientBackground:{width:"100%",height:"100%",position:"relative",backgroundColor:a.dialBackground,overflow:"hidden"},gradientLayer1:{...u,backgroundColor:a.dialGradient1,opacity:.6},gradientLayer2:{...u,backgroundColor:a.dialGradient2,opacity:.4,top:"30%",left:"30%"},gradientLayer3:{...u,backgroundColor:a.dialGradient3,opacity:.3,top:"50%",left:"50%"},gridPattern:{...u,alignItems:"center",justifyContent:"center"},gridLine:{position:"absolute",height:1},spoke:{position:"absolute",top:0,height:1,backgroundColor:a.dialGridLine},spokeLeft:{left:0},spokeRight:{right:0},buttonContainer:{zIndex:1,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",position:"absolute",width:d*1.5,height:d*1.5,borderRadius:d},buttonGradient:{width:"100%",height:"100%",borderRadius:d,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:a.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{...u,backgroundColor:a.dialGradient1,opacity:.5,borderRadius:d},buttonGradientLayer2:{...u,backgroundColor:a.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:d},buttonGradientLayer3:{...u,backgroundColor:a.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:d},buttonBorder:{backgroundColor:a.hubFill,alignItems:"center",justifyContent:"center",width:d*1.2,height:d*1.2,borderRadius:d*.6},button:{width:d,height:d,borderRadius:d/2,justifyContent:"center",alignItems:"center",position:"relative",overflow:"hidden"},buttonPressable:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},centerText:{color:a.centerText,fontSize:10,fontWeight:"900",fontFamily:F,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},emptyNote:{position:"absolute",left:16,right:16,color:a.iconLabel,fontSize:12,fontFamily:F,textAlign:"center"},closeTextBottom:{marginTop:-2},proText:{color:ae.warning,fontSize:8,fontWeight:"900",fontFamily:F,letterSpacing:2,textAlign:"center",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},weekendText:{color:"#BF5AF2",letterSpacing:1}});