@buoy-gg/core 7.0.77 → 7.0.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/module/version.d.ts +1 -1
- package/lib/web/auto.mjs +1 -1
- package/lib/web/chunks/FloatingDevTools.web-FB3F35HU.mjs +1 -0
- package/lib/web/chunks/chunk-A6DQ5EDK.mjs +10 -0
- package/lib/web/chunks/chunk-LAJ3HKAL.mjs +2 -2
- package/lib/web/index.mjs +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useDevToolsSettings=exports.DevToolsSettingsModal=void 0;var _react=require("react");var _reactNative=require("react-native");var _settingsBus=require("./settingsBus.js");var _useDesktopSyncStatus=require("./useDesktopSyncStatus");var _sharedUi=require("@buoy-gg/shared-ui");var _floatingToolsCore=require("@buoy-gg/floating-tools-core");var _DefaultConfigContext=require("./DefaultConfigContext.js");var _AppIcon=require("./AppIcon");var _jsxRuntime=require("react/jsx-runtime");const STORAGE_KEY="@react_buoy_dev_tools_settings";const MAX_DIAL_SLOTS=6;const enforceDialLimit=a=>{let l=MAX_DIAL_SLOTS;const s={};for(const[c,n]of Object.entries(a)){if(n&&l>0){s[c]=true;l-=1}else{s[c]=false}}return s};const sanitizeFloating=(a,l)=>{const{userStatus:s,environment:c,...n}=a;const i=l?Object.entries(n).filter(([d])=>l.includes(d)):Object.entries(n);return{...Object.fromEntries(i),environment:c??false}};const mergeWithDefaults=(a,l,s)=>{if(!l)return a;const c={...a.dialTools,...l.dialTools??{}};const n=s?.allowedDialKeys?Object.entries(c).filter(([d])=>s.allowedDialKeys?.includes(d)):Object.entries(c);const i=enforceDialLimit(Object.fromEntries(n));return{dialTools:i,floatingTools:sanitizeFloating({...a.floatingTools,...l.floatingTools??{}},s?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...l.globalSettings??{}}}};const generateDefaultSettings=(a=[],l,s)=>{const c={};const n={};const i=new Set(l??[]);const d=new Set(s??[]);const g=!s||s.length===0;for(const x of a){const{id:r,slot:p="both"}=x;if(p==="dial"||p==="both"){c[r]=g?true:d.has(r)}if(p==="row"||p==="both"){n[r]=i.has(r)}}return{dialTools:enforceDialLimit(c),floatingTools:{...n,environment:i.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};const DevToolsSettingsModal=({visible:a,onClose:l,onSettingsChange:s,initialSettings:c,availableApps:n=[],storage:i=_sharedUi.persistentStorage,zIndex:d})=>{const{defaultFloatingTools:g,defaultDialTools:x}=(0,_DefaultConfigContext.useDefaultConfig)();const r=(0,_react.useMemo)(()=>generateDefaultSettings(n,g,x),[n,g,x]);const p=(0,_react.useMemo)(()=>Object.keys(r.dialTools),[r]);const E=(0,_react.useMemo)(()=>Object.keys(r.floatingTools).filter(e=>e!=="environment"),[r]);const[f,m]=(0,_react.useState)(c||cachedSettings||r);const[b,F]=(0,_react.useState)(cachedActiveTab??"floating");const[N,G]=(0,_react.useState)(cachedActiveTab!==null);const[C,Y]=(0,_react.useState)(new Set);const[$,O]=(0,_react.useState)(false);const[Q,X]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{const e=requestAnimationFrame(()=>X(true));return()=>cancelAnimationFrame(e)},[]);const h=(0,_useDesktopSyncStatus.useDesktopSyncStatus)();(0,_react.useEffect)(()=>{const e=async()=>{try{const t=await _sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.settings.activeTab());if(t&&["floating","settings","pro"].includes(t)){const o=t;cachedActiveTab=o;F(u=>u===o?u:o)}}catch(t){}finally{G(true)}};e()},[]);(0,_react.useEffect)(()=>{if(!N)return;_sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.activeTab(),b).catch(e=>{console.warn("[Buoy]","Failed to save settings active tab:",e)})},[b,N]);const Z=(0,_sharedUi.getUseLicense)();const S=Z?.();const j=S?.isPro??false;const I=!j&&S?.licenseKey?S.error:null;const ee=S?.errorKind==="transport";const[y,te]=(0,_react.useState)(cachedStorageBackend);const[B,V]=(0,_react.useState)(false);const[z,D]=(0,_react.useState)(false);const[T,oe]=(0,_react.useState)(false);const[R,k]=(0,_react.useState)([]);const[P,H]=(0,_react.useState)(false);const M=(0,_sharedUi.useSafeAreaInsets)();const K=_reactNative.Dimensions.get("window").height;const _=_reactNative.Dimensions.get("window").width;const se=Math.floor(K*.33);const ne=Math.min(_-32,400);const A=(0,_react.useCallback)(async()=>{try{const e=await i.getItem(STORAGE_KEY);if(e){const t=JSON.parse(e);const o=mergeWithDefaults(r,t,{allowedDialKeys:p,allowedFloatingKeys:E});cachedSettings=o;m(u=>sameSettings(u,o)?u:o);return}cachedSettings=r;m(t=>sameSettings(t,r)?t:r)}catch(e){console.error("[Buoy]","Failed to load dev tools settings:",e);m(r)}},[r,p,E,i]);(0,_react.useEffect)(()=>{A()},[A]);(0,_react.useEffect)(()=>{(0,_sharedUi.getStorageBackendType)().then(e=>{cachedStorageBackend=e;te(t=>t===e?t:e)})},[]);(0,_react.useEffect)(()=>{if(T){H(true);_sharedUi.persistentStorage.getAllKeys().then(e=>{k(e.sort())}).catch(()=>{k([])}).finally(()=>{H(false)})}},[T]);const W=async e=>{try{let t=null;try{const u=await i?.getItem(STORAGE_KEY);t=u?JSON.parse(u):null}catch{}const o={...e,dialTools:{...t?.dialTools,...enforceDialLimit(e.dialTools)},floatingTools:{...t?.floatingTools,...e.floatingTools}};await i.setItem(STORAGE_KEY,JSON.stringify(o));cachedSettings=o;m(o);s?.(o);_settingsBus.settingsBus.emit(o)}catch(t){console.error("[Buoy]","Failed to save dev tools settings:",t)}};const ie=e=>{const t={...f,floatingTools:{...f.floatingTools,[e]:!f.floatingTools[e]}};W(t)};const re=e=>{const t={...f,globalSettings:{...f.globalSettings,[e]:!f.globalSettings?.[e]}};W(t)};const ae=async()=>{V(true);D(false);try{await _sharedUi.persistentStorage.clear();D(true);m(r);if(i!==_sharedUi.persistentStorage)await i.setItem(STORAGE_KEY,JSON.stringify(r));s?.(r);_settingsBus.settingsBus.emit(r);setTimeout(()=>D(false),2e3)}catch(e){console.error("[Buoy]","Failed to clear storage:",e)}finally{V(false)}};const le=(0,_react.useCallback)(e=>{},[]);const ce=e=>{const t=n.find(o=>o.id===e);if(t?.description){return t.description}if(e==="environment"){return"Environment badge."}return""};const L=e=>{if(e==="environment"){return"Env Badge"}const t=n.find(o=>o.id===e);return t?.name??e.toUpperCase().replace(/_/g," ")};const de=e=>{if(!Q)return null;switch(e){case"query":return(0,_jsxRuntime.jsx)(_floatingToolsCore.QueryIcon,{size:18});case"env":return(0,_jsxRuntime.jsx)(_floatingToolsCore.EnvIcon,{size:18});case"sentry":return(0,_jsxRuntime.jsx)(_sharedUi.SentryIcon,{size:18,color:"#9945FF"});case"storage":return(0,_jsxRuntime.jsx)(_floatingToolsCore.StorageIcon,{size:18,bgColor:_sharedUi.night.color.surface});case"wifi":case"query-wifi-toggle":return(0,_jsxRuntime.jsx)(_sharedUi.WifiCircuitIcon,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return(0,_jsxRuntime.jsx)(_floatingToolsCore.RoutesIcon,{size:18,bgColor:_sharedUi.night.color.surface});case"network":return(0,_jsxRuntime.jsx)(_floatingToolsCore.NetworkIcon,{size:18});case"environment":return(0,_jsxRuntime.jsx)(_floatingToolsCore.EnvIcon,{size:18});case"debug-borders":return(0,_jsxRuntime.jsx)(_sharedUi.Layers,{size:18,color:_sharedUi.night.color.accent});case"highlight-updates":return(0,_jsxRuntime.jsx)(_sharedUi.RenderCountIcon,{size:18,color:_sharedUi.night.color.accent});case"highlight-updates-modal":return(0,_jsxRuntime.jsx)(_floatingToolsCore.HighlighterIcon,{size:18});case"redux":return(0,_jsxRuntime.jsx)(_floatingToolsCore.ReduxIcon,{size:18});case"image-overlay":return(0,_jsxRuntime.jsx)(_sharedUi.ImageOverlayIcon,{size:18});case"events":return(0,_jsxRuntime.jsx)(_floatingToolsCore.EventsIcon,{size:18});case"zustand":try{const{ZustandIcon:t}=require("@buoy-gg/zustand");return(0,_jsxRuntime.jsx)(t,{size:18})}catch{return(0,_jsxRuntime.jsx)(_sharedUi.Info,{size:18,color:_sharedUi.night.color.textSecondary})}case"jotai":try{const{JotaiIcon:t}=require("@buoy-gg/jotai");return(0,_jsxRuntime.jsx)(t,{size:18})}catch{return(0,_jsxRuntime.jsx)(_sharedUi.Info,{size:18,color:_sharedUi.night.color.textSecondary})}default:{const t=n.find(o=>o.id===e);if(t?.icon!=null){return(0,_AppIcon.renderAppIcon)(t.icon,{slot:"row",size:18,color:t.color})}return(0,_jsxRuntime.jsx)(_sharedUi.Info,{size:18,color:_sharedUi.night.color.textSecondary})}}};const ge=(e,t,o,u)=>{const v=ce(e);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:o?1:.7,onPress:()=>!o&&u(),accessibilityLabel:L(e),accessibilityRole:"button",style:[styles.toolRow,o&&styles.rowDisabled],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.toolIconSlot,children:de(e)}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowInfo,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.rowLabel,children:[L(e),o?" \xB7 max 6":""]}),v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowCaption,numberOfLines:1,children:v}):null]}),(0,_jsxRuntime.jsx)(_sharedUi.NightSwitch,{value:t,disabled:o,onValueChange:()=>u(),accessibilityLabel:L(e)})]},e)};const q=e=>{Y(t=>{const o=new Set(t);if(o.has(e)){o.delete(e)}else{o.add(e)}return o})};const J=(e,t,o,u,v)=>{const ye=f.globalSettings?.[e]??false;const U=C.has(e);return(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:.7,onPress:()=>q(e),accessibilityLabel:t,style:styles.settingRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowInfo,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:t}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowCaption,numberOfLines:U?0:1,children:o})]}),(0,_jsxRuntime.jsx)(_sharedUi.NightSwitch,{value:ye,onValueChange:()=>re(e),accessibilityLabel:t})]}),U&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRowBody,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyText,children:u}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyHint,children:v})]})]},e)};const w=(e,t,o)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_sharedUi.NightSectionLabel,{children:e}),t,o]});const ue=y==="filesystem"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"File System",tone:"accent"}):y==="asyncstorage"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Async Storage",tone:"warning"}):y==="localstorage"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Local Storage",tone:"accent"}):y==="memory"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Memory",tone:"danger"}):(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Loading\u2026",tone:"neutral"});const he=()=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:styles.scrollContainer,children:[b==="floating"&&(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:w("Floating Tools",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,children:(0,_jsxRuntime.jsx)(_sharedUi.NightRows,{children:Object.entries(f.floatingTools).map(([e,t])=>ge(e,t,false,()=>ie(e)))})}),(0,_jsxRuntime.jsx)(_sharedUi.NightFootnote,{children:"Tools switched on here appear in the floating bubble row."}))}),b==="settings"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[w("Background",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,padded:true,children:(0,_jsxRuntime.jsx)(_sharedUi.BackgroundSwitcher,{embedded:true})})),w("Storage",(0,_jsxRuntime.jsxs)(_sharedUi.NightCard,{glass:true,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:.7,onPress:()=>oe(!T),accessibilityLabel:"Storage Type",style:styles.settingRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:"Storage Type"})}),ue,T?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:16,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRightIcon,{size:16,color:_sharedUi.night.color.textTertiary})]}),T&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRowBody,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyText,children:y==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":y==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":y==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":y==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),y==="asyncstorage"&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.settingRowBodyText,styles.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),y==="memory"&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.settingRowBodyText,styles.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),(0,_jsxRuntime.jsx)(_sharedUi.NightSeparator,{}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storageExpanded,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storageExpandedHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageExpandedTitle,children:"SAVED SETTINGS"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageExpandedCount,children:P?"\u2026":`${R.length} keys`})]}),P?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageKeyEmpty,children:"Loading\u2026"}):R.length===0?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageKeyEmpty,children:"No settings saved yet"}):(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:R.map(e=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.storageKeyItem,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageKeyText,numberOfLines:1,children:e.replace("@react_buoy_","")})},e))})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.cardButtonWrap,children:(0,_jsxRuntime.jsx)(_sharedUi.NightButton,{label:z?"Cleared":B?"Clearing\u2026":"Clear All Settings",variant:z?"secondary":"destructive",size:"md",disabled:B,onPress:ae,icon:z?(0,_jsxRuntime.jsx)(_sharedUi.CheckCircle2,{size:15,color:_sharedUi.night.color.accent}):(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:15,color:B?_sharedUi.night.color.textTertiary:_sharedUi.night.color.danger})})})]})]})),h&&h.state!=="idle"&&w("Desktop Sync",(0,_jsxRuntime.jsxs)(_sharedUi.NightCard,{glass:true,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:.7,onPress:()=>q("desktopSync"),accessibilityLabel:"Buoy Desktop",style:styles.settingRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:"Buoy Desktop"})}),h.state==="connected"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Connected",tone:"accent"}):h.state==="connecting"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Connecting\u2026",tone:"neutral"}):(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Retrying",tone:"warning"}),C.has("desktopSync")?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:16,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRightIcon,{size:16,color:_sharedUi.night.color.textTertiary})]}),C.has("desktopSync")&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRowBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.settingRowBodyText,children:[h.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.footnoteMono,children:h.targetURL??"(unknown URL)"}),h.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),h.state==="retrying"&&h.lastError&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.settingRowBodyText,styles.bodyWarning],children:["Last error: ",h.lastError]})]})]})),w("Modal Behavior",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,children:(0,_jsxRuntime.jsxs)(_sharedUi.NightRows,{children:[J("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."),(0,_sharedUi.expandableWindowControlsSupported)(_reactNative.Platform.OS==="web")?J("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]})}))]}),b==="pro"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[w("License",(0,_jsxRuntime.jsxs)(_sharedUi.NightCard,{glass:true,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:"License Status"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"buoy-settings-license-status",accessibilityLabel:j?"License: Active":"License: Free",children:j?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Active",tone:"accent"}):(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Free",tone:"neutral"})})]}),S?.tierSource==="session"?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:"Signed in with Buoy"})}),(0,_jsxRuntime.jsx)(_sharedUi.NightButton,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void(0,_sharedUi.signOutOfBuoy)(),testID:"buoy-settings-signout"})]}):null,S?.teamRole?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.settingRow,testID:"buoy-settings-team-role",children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowInfo,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.rowLabel,children:["Role: ",S.teamRole]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowCaption,children:S.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),(0,_jsxRuntime.jsx)(_sharedUi.NightFootnote,{children:j?"You have full access to all Buoy DevTools features.":I?ee?`Couldn't reach the license server (${I}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${I}.`:"Upgrade to Pro to unlock all features and support development."})),!j&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[w("Pro Features",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,children:(0,_jsxRuntime.jsx)(_sharedUi.NightRows,{children:["Advanced Settings","Priority Support"].map(e=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.featureRow,children:[(0,_jsxRuntime.jsx)(_sharedUi.CheckCircle2,{size:16,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:e})]},e))})})),(0,_jsxRuntime.jsx)(_sharedUi.NightButton,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>O(true)})]})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.BuoyUpgradeSheet,{visible:$,onClose:()=>O(false)})]});return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:a,onClose:l,zIndex:d,variant:"night",header:{showToggleButton:false,customContent:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.headerRow,children:(0,_jsxRuntime.jsx)(_sharedUi.NightSegmented,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:b,onChange:e=>F(e)})})},initialMode:"bottomSheet",onModeChange:le,persistenceKey:_sharedUi.devToolsStorageKeys.settings.root(),enablePersistence:true,maxHeight:K-M.top,initialHeight:se,initialFloatingPosition:{x:(_-ne)/2,y:M.top+20},enableGlitchEffects:true,children:he()})};exports.DevToolsSettingsModal=DevToolsSettingsModal;const basicDefaultSettings={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const createDefaultsFromConfig=(a,l)=>{const s=new Set(a??[]);const c=new Set(l??[]);const n={};for(const d of c){n[d]=true}const i={environment:s.has("environment")};for(const d of s){if(d!=="environment"){i[d]=true}}return{dialTools:enforceDialLimit(n),floatingTools:i,globalSettings:{enableSharedModalDimensions:false}}};let cachedSettings=null;let cachedActiveTab=null;let cachedStorageBackend=null;const sameSettings=(a,l)=>JSON.stringify(a)===JSON.stringify(l);_settingsBus.settingsBus.addListener(a=>{if(a)cachedSettings=a});const useDevToolsSettings=()=>{const{defaultFloatingTools:a,defaultDialTools:l}=(0,_DefaultConfigContext.useDefaultConfig)();const s=(0,_react.useMemo)(()=>{if(!a&&!l){return basicDefaultSettings}return createDefaultsFromConfig(a,l)},[a,l]);const[c,n]=(0,_react.useState)(s);const i=(0,_react.useCallback)(async()=>{try{const g=await _sharedUi.persistentStorage.getItem(STORAGE_KEY);if(g){const x=JSON.parse(g);const r=mergeWithDefaults(s,x);n(r);return}n(s)}catch(g){console.error("[Buoy]","Failed to load dev tools settings:",g);n(s)}},[s]);(0,_react.useEffect)(()=>(0,_sharedUi.onSettingsApplied)(g=>{if(g.includes(STORAGE_KEY))void i()}),[i]);(0,_react.useEffect)(()=>{i();const g=_settingsBus.settingsBus.addListener(x=>{try{if(x){n(x)}}catch(r){}});return()=>{g()}},[i]);const d=(0,_react.useCallback)(()=>{i()},[i]);return{settings:c,refreshSettings:d}};exports.useDevToolsSettings=useDevToolsSettings;const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:_sharedUi.night.gutter,paddingRight:_sharedUi.night.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:_sharedUi.night.gutter,paddingTop:8,paddingBottom:24,gap:_sharedUi.night.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:_sharedUi.night.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"500"},rowCaption:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.label},settingRowBody:{paddingHorizontal:_sharedUi.night.rowPadH,paddingBottom:_sharedUi.night.rowPadV,gap:6},settingRowBodyText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:_sharedUi.night.font.caption*1.45},settingRowBodyHint:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption,lineHeight:_sharedUi.night.font.caption*1.45},bodyWarning:{color:_sharedUi.night.color.warning},bodyDanger:{color:_sharedUi.night.color.danger},cardButtonWrap:{paddingHorizontal:_sharedUi.night.cardPad,paddingTop:10,paddingBottom:_sharedUi.night.cardPad},storageExpanded:{paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:_sharedUi.night.color.glassElevated,borderRadius:_sharedUi.night.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontFamily:_sharedUi.monoFont},storageKeyEmpty:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:_sharedUi.monoFont,fontSize:_sharedUi.night.font.label,color:_sharedUi.night.color.textSecondary}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useDevToolsSettings=exports.DevToolsSettingsModal=void 0;var _react=require("react");var _reactNative=require("react-native");var _settingsBus=require("./settingsBus.js");var _useDesktopSyncStatus=require("./useDesktopSyncStatus");var _sharedUi=require("@buoy-gg/shared-ui");var _floatingToolsCore=require("@buoy-gg/floating-tools-core");var _DefaultConfigContext=require("./DefaultConfigContext.js");var _AppIcon=require("./AppIcon");var _jsxRuntime=require("react/jsx-runtime");const STORAGE_KEY="@react_buoy_dev_tools_settings";const MAX_DIAL_SLOTS=6;const enforceDialLimit=a=>{let l=MAX_DIAL_SLOTS;const s={};for(const[c,n]of Object.entries(a)){if(n&&l>0){s[c]=true;l-=1}else{s[c]=false}}return s};const sanitizeFloating=(a,l)=>{const{userStatus:s,environment:c,...n}=a;const i=l?Object.entries(n).filter(([d])=>l.includes(d)):Object.entries(n);return{...Object.fromEntries(i),environment:c??false}};const mergeWithDefaults=(a,l,s)=>{if(!l)return a;const c={...a.dialTools,...l.dialTools??{}};const n=s?.allowedDialKeys?Object.entries(c).filter(([d])=>s.allowedDialKeys?.includes(d)):Object.entries(c);const i=enforceDialLimit(Object.fromEntries(n));return{dialTools:i,floatingTools:sanitizeFloating({...a.floatingTools,...l.floatingTools??{}},s?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...l.globalSettings??{}}}};const generateDefaultSettings=(a=[],l,s)=>{const c={};const n={};const i=new Set(l??[]);const d=new Set(s??[]);const g=!s||s.length===0;for(const x of a){const{id:r,slot:p="both"}=x;if(p==="dial"||p==="both"){c[r]=g?true:d.has(r)}if(p==="row"||p==="both"){n[r]=i.has(r)}}return{dialTools:enforceDialLimit(c),floatingTools:{...n,environment:i.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};const DevToolsSettingsModal=({visible:a,onClose:l,onSettingsChange:s,initialSettings:c,availableApps:n=[],storage:i=_sharedUi.persistentStorage,zIndex:d})=>{const{defaultFloatingTools:g,defaultDialTools:x}=(0,_DefaultConfigContext.useDefaultConfig)();const r=(0,_react.useMemo)(()=>generateDefaultSettings(n,g,x),[n,g,x]);const p=(0,_react.useMemo)(()=>Object.keys(r.dialTools),[r]);const E=(0,_react.useMemo)(()=>Object.keys(r.floatingTools).filter(e=>e!=="environment"),[r]);const[f,m]=(0,_react.useState)(c||cachedSettings||r);const[b,k]=(0,_react.useState)(cachedActiveTab??"floating");const[F,G]=(0,_react.useState)(cachedActiveTab!==null);const[C,Y]=(0,_react.useState)(new Set);const[$,N]=(0,_react.useState)(false);const[Q,X]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{const e=requestAnimationFrame(()=>X(true));return()=>cancelAnimationFrame(e)},[]);const h=(0,_useDesktopSyncStatus.useDesktopSyncStatus)();(0,_react.useEffect)(()=>{const e=async()=>{try{const t=await _sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.settings.activeTab());if(t&&["floating","settings","pro"].includes(t)){const o=t;cachedActiveTab=o;k(u=>u===o?u:o)}}catch(t){}finally{G(true)}};e()},[]);(0,_react.useEffect)(()=>{if(!F)return;_sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.activeTab(),b).catch(e=>{console.warn("[Buoy]","Failed to save settings active tab:",e)})},[b,F]);const Z=(0,_sharedUi.getUseLicense)();const S=Z?.();const j=S?.isPro??false;const I=!j&&S?.licenseKey?S.error:null;const ee=S?.errorKind==="transport";const[y,te]=(0,_react.useState)(cachedStorageBackend);const[B,O]=(0,_react.useState)(false);const[z,D]=(0,_react.useState)(false);const[T,oe]=(0,_react.useState)(false);const[R,V]=(0,_react.useState)([]);const[P,H]=(0,_react.useState)(false);const M=(0,_sharedUi.useSafeAreaInsets)();const K=_reactNative.Dimensions.get("window").height;const _=_reactNative.Dimensions.get("window").width;const se=Math.floor(K*.33);const ne=Math.min(_-32,400);const A=(0,_react.useCallback)(async()=>{try{const e=await i.getItem(STORAGE_KEY);if(e){const t=JSON.parse(e);const o=mergeWithDefaults(r,t,{allowedDialKeys:p,allowedFloatingKeys:E});cachedSettings=o;m(u=>sameSettings(u,o)?u:o);return}cachedSettings=r;m(t=>sameSettings(t,r)?t:r)}catch(e){console.error("[Buoy]","Failed to load dev tools settings:",e);m(r)}},[r,p,E,i]);(0,_react.useEffect)(()=>{A()},[A]);(0,_react.useEffect)(()=>{(0,_sharedUi.getStorageBackendType)().then(e=>{cachedStorageBackend=e;te(t=>t===e?t:e)})},[]);(0,_react.useEffect)(()=>{if(T){H(true);_sharedUi.persistentStorage.getAllKeys().then(e=>{V(e.sort())}).catch(()=>{V([])}).finally(()=>{H(false)})}},[T]);const W=async e=>{try{let t=null;try{const u=await i?.getItem(STORAGE_KEY);t=u?JSON.parse(u):null}catch{}const o={...e,dialTools:{...t?.dialTools,...enforceDialLimit(e.dialTools)},floatingTools:{...t?.floatingTools,...e.floatingTools}};await i.setItem(STORAGE_KEY,JSON.stringify(o));cachedSettings=o;m(o);s?.(o);_settingsBus.settingsBus.emit(o)}catch(t){console.error("[Buoy]","Failed to save dev tools settings:",t)}};const ie=e=>{const t={...f,floatingTools:{...f.floatingTools,[e]:!f.floatingTools[e]}};W(t)};const re=e=>{const t={...f,globalSettings:{...f.globalSettings,[e]:!f.globalSettings?.[e]}};W(t)};const ae=async()=>{O(true);D(false);try{await _sharedUi.persistentStorage.clear();D(true);m(r);if(i!==_sharedUi.persistentStorage)await i.setItem(STORAGE_KEY,JSON.stringify(r));s?.(r);_settingsBus.settingsBus.emit(r);setTimeout(()=>D(false),2e3)}catch(e){console.error("[Buoy]","Failed to clear storage:",e)}finally{O(false)}};const le=(0,_react.useCallback)(e=>{},[]);const ce=e=>{const t=n.find(o=>o.id===e);if(t?.description){return t.description}if(e==="environment"){return"Environment badge."}return""};const L=e=>{if(e==="environment"){return"Env Badge"}const t=n.find(o=>o.id===e);return t?.name??e.toUpperCase().replace(/_/g," ")};const de=e=>{if(!Q)return null;switch(e){case"query":return(0,_jsxRuntime.jsx)(_floatingToolsCore.QueryIcon,{size:18});case"env":return(0,_jsxRuntime.jsx)(_floatingToolsCore.EnvIcon,{size:18});case"sentry":return(0,_jsxRuntime.jsx)(_sharedUi.SentryIcon,{size:18,color:"#9945FF"});case"storage":return(0,_jsxRuntime.jsx)(_floatingToolsCore.StorageIcon,{size:18,bgColor:_sharedUi.night.color.surface});case"wifi":case"query-wifi-toggle":return(0,_jsxRuntime.jsx)(_sharedUi.WifiCircuitIcon,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return(0,_jsxRuntime.jsx)(_floatingToolsCore.RoutesIcon,{size:18,bgColor:_sharedUi.night.color.surface});case"network":return(0,_jsxRuntime.jsx)(_floatingToolsCore.NetworkIcon,{size:18});case"environment":return(0,_jsxRuntime.jsx)(_floatingToolsCore.EnvIcon,{size:18});case"debug-borders":return(0,_jsxRuntime.jsx)(_sharedUi.Layers,{size:18,color:_sharedUi.night.color.accent});case"highlight-updates":return(0,_jsxRuntime.jsx)(_sharedUi.RenderCountIcon,{size:18,color:_sharedUi.night.color.accent});case"highlight-updates-modal":return(0,_jsxRuntime.jsx)(_floatingToolsCore.HighlighterIcon,{size:18});case"redux":return(0,_jsxRuntime.jsx)(_floatingToolsCore.ReduxIcon,{size:18});case"image-overlay":return(0,_jsxRuntime.jsx)(_sharedUi.ImageOverlayIcon,{size:18});case"events":return(0,_jsxRuntime.jsx)(_floatingToolsCore.EventsIcon,{size:18});case"zustand":try{const{ZustandIcon:t}=require("@buoy-gg/zustand");return(0,_jsxRuntime.jsx)(t,{size:18})}catch{return(0,_jsxRuntime.jsx)(_sharedUi.Info,{size:18,color:_sharedUi.night.color.textSecondary})}case"jotai":try{const{JotaiIcon:t}=require("@buoy-gg/jotai");return(0,_jsxRuntime.jsx)(t,{size:18})}catch{return(0,_jsxRuntime.jsx)(_sharedUi.Info,{size:18,color:_sharedUi.night.color.textSecondary})}default:{const t=n.find(o=>o.id===e);if(t?.icon!=null){return(0,_AppIcon.renderAppIcon)(t.icon,{slot:"row",size:18,color:t.color})}return(0,_jsxRuntime.jsx)(_sharedUi.Info,{size:18,color:_sharedUi.night.color.textSecondary})}}};const ge=(e,t,o,u)=>{const v=ce(e);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:o?1:.7,onPress:()=>!o&&u(),accessibilityLabel:L(e),accessibilityRole:"button",style:[styles.toolRow,o&&styles.rowDisabled],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.toolIconSlot,children:de(e)}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowInfo,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.rowLabel,children:[L(e),o?" \xB7 max 6":""]}),v?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowCaption,numberOfLines:1,children:v}):null]}),(0,_jsxRuntime.jsx)(_sharedUi.NightSwitch,{value:t,disabled:o,onValueChange:()=>u(),accessibilityLabel:L(e)})]},e)};const q=e=>{Y(t=>{const o=new Set(t);if(o.has(e)){o.delete(e)}else{o.add(e)}return o})};const J=(e,t,o,u,v)=>{const ye=f.globalSettings?.[e]??false;const U=C.has(e);return(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:.7,onPress:()=>q(e),accessibilityLabel:t,style:styles.settingRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowInfo,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:t}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowCaption,numberOfLines:U?0:1,children:o})]}),(0,_jsxRuntime.jsx)(_sharedUi.NightSwitch,{value:ye,onValueChange:()=>re(e),accessibilityLabel:t})]}),U&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRowBody,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyText,children:u}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyHint,children:v})]})]},e)};const w=(e,t,o)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_sharedUi.NightSectionLabel,{children:e}),t,o]});const ue=y==="filesystem"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"File System",tone:"accent"}):y==="asyncstorage"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Async Storage",tone:"warning"}):y==="localstorage"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Local Storage",tone:"accent"}):y==="memory"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Memory",tone:"danger"}):(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Loading\u2026",tone:"neutral"});const he=()=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:styles.scrollContainer,children:[b==="floating"&&(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:w("Floating Tools",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,children:(0,_jsxRuntime.jsx)(_sharedUi.NightRows,{children:Object.entries(f.floatingTools).map(([e,t])=>ge(e,t,false,()=>ie(e)))})}),(0,_jsxRuntime.jsx)(_sharedUi.NightFootnote,{children:"Tools switched on here appear in the floating bubble row."}))}),b==="settings"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[w("Background",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,padded:true,children:(0,_jsxRuntime.jsx)(_sharedUi.BackgroundSwitcher,{embedded:true})})),w("Storage",(0,_jsxRuntime.jsxs)(_sharedUi.NightCard,{glass:true,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:.7,onPress:()=>oe(!T),accessibilityLabel:"Storage Type",style:styles.settingRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:"Storage Type"})}),ue,T?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:16,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRightIcon,{size:16,color:_sharedUi.night.color.textTertiary})]}),T&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRowBody,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyText,children:y==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":y==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":y==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":y==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),y==="asyncstorage"&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.settingRowBodyText,styles.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),y==="memory"&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.settingRowBodyText,styles.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),(0,_jsxRuntime.jsx)(_sharedUi.NightSeparator,{}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storageExpanded,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storageExpandedHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageExpandedTitle,children:"SAVED SETTINGS"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageExpandedCount,children:P?"\u2026":`${R.length} keys`})]}),P?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageKeyEmpty,children:"Loading\u2026"}):R.length===0?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageKeyEmpty,children:"No settings saved yet"}):(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:R.map(e=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.storageKeyItem,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageKeyText,numberOfLines:1,children:e.replace("@react_buoy_","")})},e))})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.cardButtonWrap,children:(0,_jsxRuntime.jsx)(_sharedUi.NightButton,{label:z?"Cleared":B?"Clearing\u2026":"Clear All Settings",variant:z?"secondary":"destructive",size:"md",disabled:B,onPress:ae,icon:z?(0,_jsxRuntime.jsx)(_sharedUi.CheckCircle2,{size:15,color:_sharedUi.night.color.accent}):(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:15,color:B?_sharedUi.night.color.textTertiary:_sharedUi.night.color.danger})})})]})]})),h&&h.state!=="idle"&&w("Desktop Sync",(0,_jsxRuntime.jsxs)(_sharedUi.NightCard,{glass:true,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:.7,onPress:()=>q("desktopSync"),accessibilityLabel:"Buoy Desktop",style:styles.settingRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:"Buoy Desktop"})}),h.state==="connected"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Connected",tone:"accent"}):h.state==="connecting"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Connecting\u2026",tone:"neutral"}):(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Retrying",tone:"warning"}),C.has("desktopSync")?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:16,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRightIcon,{size:16,color:_sharedUi.night.color.textTertiary})]}),C.has("desktopSync")&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRowBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.settingRowBodyText,children:[h.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.footnoteMono,children:h.targetURL??"(unknown URL)"}),h.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),h.state==="retrying"&&h.lastError&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.settingRowBodyText,styles.bodyWarning],children:["Last error: ",h.lastError]})]})]})),w("Modal Behavior",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,children:(0,_jsxRuntime.jsxs)(_sharedUi.NightRows,{children:[J("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."),(0,_sharedUi.expandableWindowControlsSupported)(_reactNative.Platform.OS==="web")?J("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]})}))]}),b==="pro"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[w("License",(0,_jsxRuntime.jsxs)(_sharedUi.NightCard,{glass:true,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:"License Status"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{testID:"buoy-settings-license-status",accessibilityLabel:j?"License: Active":"License: Free",children:j?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Active",tone:"accent"}):(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Free",tone:"neutral"})})]}),S?.tierSource==="session"?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.rowInfo,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:"Signed in with Buoy"})}),(0,_jsxRuntime.jsx)(_sharedUi.NightButton,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void(0,_sharedUi.signOutOfBuoy)(),testID:"buoy-settings-signout"})]}):null,S?.teamRole?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.settingRow,testID:"buoy-settings-team-role",children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowInfo,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.rowLabel,children:["Role: ",S.teamRole]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowCaption,children:S.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),(0,_jsxRuntime.jsx)(_sharedUi.NightFootnote,{children:j?"You have full access to all Buoy DevTools features.":I?ee?`Couldn't reach the license server (${I}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${I}.`:"Upgrade to Pro to unlock all features and support development."})),!j&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[w("Pro Features",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,children:(0,_jsxRuntime.jsx)(_sharedUi.NightRows,{children:["Advanced Settings","Priority Support"].map(e=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.featureRow,children:[(0,_jsxRuntime.jsx)(_sharedUi.CheckCircle2,{size:16,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rowLabel,children:e})]},e))})})),(0,_jsxRuntime.jsx)(_sharedUi.NightButton,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>N(true)})]})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.BuoyUpgradeSheet,{visible:$,onClose:()=>N(false)})]});return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:a,onClose:l,zIndex:d,variant:"night",header:{showToggleButton:false,customContent:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.headerRow,children:(0,_jsxRuntime.jsx)(_sharedUi.NightSegmented,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:b,onChange:e=>k(e)})})},initialMode:"bottomSheet",onModeChange:le,persistenceKey:_sharedUi.devToolsStorageKeys.settings.root(),enablePersistence:true,maxHeight:K-M.top,initialHeight:se,initialFloatingPosition:{x:(_-ne)/2,y:M.top+20},enableGlitchEffects:true,children:he()})};exports.DevToolsSettingsModal=DevToolsSettingsModal;const basicDefaultSettings={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const createDefaultsFromConfig=(a,l)=>{const s=new Set(a??[]);const c=new Set(l??[]);const n={};for(const d of c){n[d]=true}const i={environment:s.has("environment")};for(const d of s){if(d!=="environment"){i[d]=true}}return{dialTools:enforceDialLimit(n),floatingTools:i,globalSettings:{enableSharedModalDimensions:false}}};let cachedSettings=null;let cachedActiveTab=null;let cachedStorageBackend=null;const sameSettings=(a,l)=>JSON.stringify(a)===JSON.stringify(l);_settingsBus.settingsBus.addListener(a=>{if(a)cachedSettings=a});const useDevToolsSettings=()=>{const{defaultFloatingTools:a,defaultDialTools:l}=(0,_DefaultConfigContext.useDefaultConfig)();const s=(0,_react.useMemo)(()=>{if(!a&&!l){return basicDefaultSettings}return createDefaultsFromConfig(a,l)},[a,l]);const[c,n]=(0,_react.useState)(s);const i=(0,_react.useCallback)(async()=>{try{const g=await _sharedUi.persistentStorage.getItem(STORAGE_KEY);if(g){const x=JSON.parse(g);const r=mergeWithDefaults(s,x);n(r);return}n(s)}catch(g){console.error("[Buoy]","Failed to load dev tools settings:",g);n(s)}},[s]);(0,_react.useEffect)(()=>(0,_sharedUi.onSettingsApplied)(g=>{if(g.includes(STORAGE_KEY))void i()}),[i]);(0,_react.useEffect)(()=>{i();const g=_settingsBus.settingsBus.addListener(x=>{try{if(x){n(x)}}catch(r){}});return()=>{g()}},[i]);const d=(0,_react.useCallback)(()=>{i()},[i]);return{settings:c,refreshSettings:d}};exports.useDevToolsSettings=useDevToolsSettings;const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:_sharedUi.night.gutter,paddingRight:_sharedUi.night.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:_sharedUi.night.gutter,paddingTop:8,paddingBottom:24,gap:_sharedUi.night.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:_sharedUi.night.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.row,fontWeight:"500"},rowCaption:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.label},settingRowBody:{paddingHorizontal:_sharedUi.night.rowPadH,paddingBottom:_sharedUi.night.rowPadV,gap:6},settingRowBodyText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,lineHeight:_sharedUi.night.font.caption*1.45},settingRowBodyHint:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption,lineHeight:_sharedUi.night.font.caption*1.45},bodyWarning:{color:_sharedUi.night.color.warning},bodyDanger:{color:_sharedUi.night.color.danger},cardButtonWrap:{paddingHorizontal:_sharedUi.night.cardPad,paddingTop:10,paddingBottom:_sharedUi.night.cardPad},storageExpanded:{paddingHorizontal:_sharedUi.night.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:_sharedUi.night.color.glassElevated,borderRadius:_sharedUi.night.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontFamily:_sharedUi.monoFont},storageKeyEmpty:{color:_sharedUi.night.color.textTertiary,fontSize:_sharedUi.night.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:_sharedUi.monoFont,fontSize:_sharedUi.night.font.label,color:_sharedUi.night.color.textSecondary}});
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.78";
|
|
@@ -1 +1 @@
|
|
|
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
|
+
"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,{keyboardShouldPersistTaps:"handled",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,{keyboardShouldPersistTaps:"handled",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}});
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export const SDK_VERSION="7.0.
|
|
1
|
+
"use strict";export const SDK_VERSION="7.0.78";
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* Drift is prevented by a test that fails when this disagrees with
|
|
10
10
|
* package.json, so a version bump that forgets this file cannot ship.
|
|
11
11
|
*/
|
|
12
|
-
export declare const SDK_VERSION = "7.0.
|
|
12
|
+
export declare const SDK_VERSION = "7.0.78";
|
|
13
13
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* Drift is prevented by a test that fails when this disagrees with
|
|
10
10
|
* package.json, so a version bump that forgets this file cannot ship.
|
|
11
11
|
*/
|
|
12
|
-
export declare const SDK_VERSION = "7.0.
|
|
12
|
+
export declare const SDK_VERSION = "7.0.78";
|
|
13
13
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/web/auto.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as o,e as u}from"./chunks/chunk-LOPXJLVB.mjs";import{createElement as l,lazy as p,Suspense as d,useEffect as m,useState as v}from"react";function n(){if(typeof window>"u")return false;let e=window.Capacitor,t=false;try{t=e?.isNativePlatform?.()===true}catch{t=false}return t?e?.DEBUG===true:typeof u<"u"?!!u:process.env.NODE_ENV!=="production"}o(n,"shouldShowBuoy");function r(){try{let e=import.meta.env.VITE_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}o(r,"bundlerKey");var a;function s(){return a??(a=p(()=>import("./chunks/FloatingDevTools.web-
|
|
1
|
+
"use client";import{a as o,e as u}from"./chunks/chunk-LOPXJLVB.mjs";import{createElement as l,lazy as p,Suspense as d,useEffect as m,useState as v}from"react";function n(){if(typeof window>"u")return false;let e=window.Capacitor,t=false;try{t=e?.isNativePlatform?.()===true}catch{t=false}return t?e?.DEBUG===true:typeof u<"u"?!!u:process.env.NODE_ENV!=="production"}o(n,"shouldShowBuoy");function r(){try{let e=import.meta.env.VITE_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}o(r,"bundlerKey");var a;function s(){return a??(a=p(()=>import("./chunks/FloatingDevTools.web-FB3F35HU.mjs").then(e=>({default:e.FloatingDevTools})))),a}o(s,"loadHost");function i({enabled:e,...t}){let[c,f]=v(false);if(m(()=>{f(e??n())},[e]),!c)return null;let y=t.licenseKey??r();return l(d,{fallback:null},l(s(),{...t,licenseKey:y}))}o(i,"BuoyDevTools");export{i as BuoyDevTools,r as bundlerKey,n as shouldShowBuoy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{v as o}from"./chunk-A6DQ5EDK.mjs";import"./chunk-C6HZO5XT.mjs";import"./chunk-D2FYORGY.mjs";import"./chunk-LOPXJLVB.mjs";export{o as FloatingDevTools};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";import{a as ct,b as H,c as U,d as De,e as dt,f as pr,g as Io,h as mr,i as Rl,j as Co,k as Ne}from"./chunk-C6HZO5XT.mjs";import{b as gr,c as fr}from"./chunk-D2FYORGY.mjs";import{a as r,b as ko,e as He}from"./chunk-LOPXJLVB.mjs";import{BuoyPortal as hr,FloatingToolHost as yr}from"@buoy-gg/shared-ui/web/floating";import*as br from"@buoy-gg/license/web";import{LicenseManager as vr,useLicense as zo,sameLicenseKey as Sr,resolveDevBuild as wr,capacitorDebug as xr,isCapacitorNative as Ao,loadCapacitorAppHost as Bo}from"@buoy-gg/license/web";import{AccountSetup as Tr,HintsProvider as Ir,normalizeEnvironment as Cr,registerToolOpener as Ro,setBuoyAppId as Pt,startSettingsSync as kr}from"@buoy-gg/shared-ui/web";import{useState as Et,useMemo as he,useCallback as _e,useEffect as Q,useRef as Mo}from"react";import{useSettings as zr,getToolLabel as ut,getToolDescription as Ar,getToolColor as Do}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Oe,devToolsStorageKeys as pt,EnvironmentIndicator as Br,EnvironmentSelectorInline as Rr}from"@buoy-gg/shared-ui/web";var Mr=[];function Oo(){return[]}r(Oo,"autoDiscoverWebPresets");function Lt(e=[]){return[...new Map(e.map(t=>[t.id,t])).values()]}r(Lt,"autoDiscoverWithCustom");function mt(e,t){return e.filter(o=>{let i=o.slot||"both";return i==="both"||i===t})}r(mt,"getToolsBySlot");function Po(e,t){let o=t instanceof Set?t:new Set(t);return e.filter(i=>o.has(i.id))}r(Po,"getEnabledTools");import{filterTeamTools as Dr,isTeamToolAllowed as Or}from"@buoy-gg/floating-tools-core/web";var Pr="No tools are on for your role. Ask your team admin.";import{FloatingTool as Eo,FloatingToolDivider as Er,FloatingToolUserStatus as Lo,getBubbleAnchorPosition as Lr}from"@buoy-gg/shared-ui/web/floating";import{useState as te,useEffect as Pe,useMemo as gt,useRef as ft,useCallback as ht}from"react";var Fo={network:"Network",images:"Images","image-overlay":"Image Overlay",assets:"Assets",query:"React Query",storage:"Storage",env:"Env",console:"Console",events:"Events",redux:"Redux",zustand:"Zustand",jotai:"Jotai","route-events":"Routes","time-machine":"Time Machine",clock:"Clock",permissions:"Permissions","highlight-updates":"Highlight Updates","debug-borders":"Debug Borders","perf-monitor":"Bench HUD","js-top":"JS Top","js-top-modal":"JS Top",impersonate:"Impersonate","perf-monitor-modal":"Bench"};function $o(e,t){return e&&Fo[e]?Fo[e]:t}r($o,"dialAccessibilityLabel");import{getDialLayout as Fr,getAllIconPositions as $r,getGridLineRotations as jr,getIconStaggerInputRange as Nr,MAX_DIAL_SLOTS as Qe,DIAL_ICON_SIZE as Hr,dialAnimationConfig as jo,getDialCSSKeyframesString as _r,getDialCSSAnimationStyles as Wr,dialColors as j,dialStyles as w,withAlpha as No,floatingToolsColors as Ur}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Ho,monoFont as Ft,ToolBackground as Kr,useToolBackground as Vr}from"@buoy-gg/shared-ui/web";import{memo as qr}from"react";import{RasterLayer as Gr,scatter as Jr,useLoop as Yr,withBgAlpha as Xr}from"@buoy-gg/shared-ui/web";import{Fragment as Qr,jsx as Ze}from"react/jsx-runtime";var Zr=.94,ea=6,ta=2400,yt=3,_o=16,oa=Array.from({length:yt},(e,t)=>Jr(22343^t*40503,_o*4)),Wo=["#FFFFFF","#B3D9FF","#8CB3FF"],Uo=Math.PI/3,Ko=14*Math.PI/180;function Vo(e){let t=Math.min(5,Math.floor(e*6)),o=e*6-t;return t*Uo+Ko/2+o*(Uo-Ko)}r(Vo,"spokeClearAngle");function qo(e){return Math.min(ea,1/(1-e*Zr))}r(qo,"scaleAt");function Go(e){let t=.15+.85*e*e;return e<.06?t*=e/.06:e>.94&&(t*=(1-e)/.06),Math.min(.7,t)}r(Go,"opacityAt");function Jo(e){let t=e/yt,o=[],i=12;for(let d=0;d<=i;d++)o.push(d/i);let n=(1-t)%1;n>.001&&n<1-.001&&o.push(n-1e-4,n+1e-4),o.sort((d,u)=>d-u);let s=[],l=[],c=[];for(let d of o){let u=t===0&&d===1?1:(d+t)%1;s.push(d),l.push(qo(u)),c.push(Go(u))}return{input:s,scale:l,opacity:c}}r(Jo,"shellStops");var na=Array.from({length:yt},(e,t)=>Jo(t)),ia=qr(r(function({size:e}){let t=Yr(ta),o=e/2,i=[];for(let n=0;n<yt;n++){let s=oa[n],l=na[n],c=[];for(let d=0;d<_o;d++){let u=Vo(s[d*4]),g=(.15+.85*Math.sqrt(s[d*4+1]))*.5*o,S=Wo[Math.floor(s[d*4+3]*Wo.length)%3],h=o+Math.cos(u)*g,B=o+Math.sin(u)*g,I=.6,R=I*2.4;c.push(Ze(H,{style:{position:"absolute",left:h-R/2,top:B-R/2,width:R,height:R,borderRadius:R/2,backgroundColor:Xr(S,.3)}},`${d}-h`),Ze(H,{style:{position:"absolute",left:h-I/2,top:B-I/2,width:I,height:I,borderRadius:I/2,backgroundColor:S}},d))}i.push(Ze(De.View,{style:{position:"absolute",left:0,top:0,width:e,height:e,opacity:t.interpolate({inputRange:l.input,outputRange:l.opacity}),transform:[{scale:t.interpolate({inputRange:l.input,outputRange:l.scale})}]},pointerEvents:"none",children:Ze(Gr,{style:{width:e,height:e},raster:false,children:c})},n))}return Ze(Qr,{children:i})},"DialHyperspace"));import{useEffect as ra,useState as Yo}from"react";import{dialColors as We,withAlpha as Xo}from"@buoy-gg/floating-tools-react/web";import{ARROW_BOTTOM_OFFSET as aa,ARROW_HEIGHT as sa,SPACING_GAP as Yl,getScreenCenterY as Xl,calculateTooltipPosition as la,calculateTargetPosition as Ql}from"@buoy-gg/shared-ui/web/floating";import{monoFont as Qo}from"@buoy-gg/shared-ui/web";import{jsx as Ue,jsxs as Zo}from"react/jsx-runtime";var en=false;function tn(){if(en||typeof document>"u")return;let e=document.createElement("style");e.textContent=`
|
|
2
|
+
@keyframes buoyOnboardPulse {
|
|
3
|
+
0%, 100% { transform: scale(1); }
|
|
4
|
+
50% { transform: scale(1.02); }
|
|
5
|
+
}
|
|
6
|
+
@keyframes buoyOnboardArrowBounce {
|
|
7
|
+
0%, 100% { transform: translateY(0); }
|
|
8
|
+
50% { transform: translateY(-8px); }
|
|
9
|
+
}
|
|
10
|
+
`,document.head.appendChild(e),en=true}r(tn,"injectOnboardingKeyframes");var $t=We.accent;function jt({title:e,message:t,onDismiss:o,showArrow:i=true}){let[n,s]=Yo(false),[l,c]=Yo(false);ra(()=>{tn();let u=requestAnimationFrame(()=>s(true));return()=>cancelAnimationFrame(u)},[]);let d={fontFamily:Qo,textTransform:"uppercase"};return Ue("div",{style:{position:"fixed",left:"50%",bottom:la(),transform:`translateX(-50%) scale(${n?1:.8})`,opacity:n?1:0,transition:"transform 300ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 300ms ease",zIndex:10002,pointerEvents:"auto"},children:Zo("div",{style:{position:"relative",animation:n?"buoyOnboardPulse 3s ease-in-out infinite":"none"},children:[Ue("div",{style:{position:"absolute",inset:-4,borderRadius:18,backgroundColor:"#FFFFFF",opacity:.06}}),Zo("div",{style:{position:"relative",maxWidth:280,backgroundColor:We.dialBackground,borderRadius:16,border:`1px solid ${We.dialBorder}`,padding:20,boxShadow:`0 0 20px ${Xo(We.dialShadow,.6)}`,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[Ue("span",{style:{...d,fontSize:16,fontWeight:900,letterSpacing:1,color:$t,textAlign:"center"},children:e}),Ue("span",{style:{fontFamily:Qo,fontSize:13,lineHeight:"20px",color:We.centerText,textAlign:"center"},children:t}),Ue("button",{onClick:o,onPointerDown:()=>c(true),onPointerUp:()=>c(false),onPointerLeave:()=>c(false),onPointerCancel:()=>c(false),style:{...d,marginTop:8,borderRadius:8,border:"none",backgroundColor:$t,padding:"10px 24px",fontSize:14,fontWeight:900,letterSpacing:1.5,color:"#000000",cursor:"pointer",opacity:l?.7:1,transform:l?"scale(0.96)":"scale(1)",transition:"transform 100ms ease, opacity 100ms ease"},children:"Got it!"})]}),i&&Ue("div",{style:{position:"absolute",left:"50%",bottom:aa,marginLeft:-12,width:0,height:0,borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:`${sa}px solid ${$t}`,filter:`drop-shadow(0 0 10px ${Xo(We.dialShadow,.5)})`,animation:n?"buoyOnboardArrowBounce 1.6s ease-in-out infinite":"none"}})]})})}r(jt,"OnboardingTooltip");import{Fragment as ca,jsx as E,jsxs as we}from"react/jsx-runtime";var da={x:.5,y:.5},on="@react_buoy_settings_tooltip_shown",nn=false;function rn(){if(nn||typeof document>"u")return;let e=document.createElement("style");e.textContent=_r(),document.head.appendChild(e),nn=true}r(rn,"injectKeyframes");var Ke=r(e=>1-Math.pow(1-e,3),"easeOutCubic"),Nt=r(e=>e*e*e,"easeInCubic");function an({icon:e,index:t,totalIcons:o,position:i,progress:n,onPress:s}){let[l,c]=te(false),[d,u]=te(false),g=!e.icon&&e.id.startsWith("empty-"),S=!g&&e.unavailable===true,h=!g&&!S,{icons:B}=jo,I=Nr(t,o),R=0;n<=I[1]?R=0:n<=I[2]?R=(n-I[1])/(I[2]-I[1]):R=1,R=Math.max(0,Math.min(1,R));let L=Hr,D=B.pressIn.scale,P=R*(d?D:l?1.1:1),z=0;R<=0?z=0:R<=.3?z=R:z=.3+(R-.3)*(.7/.7);let v=i.x*(R-1),C=i.y*(R-1);return E("button",{role:"menuitem","aria-label":g?"Empty slot":$o(e.id,e.name),"data-testid":e.id?`buoy-dial-${e.id}`:void 0,"aria-disabled":!h,tabIndex:h?0:-1,onClick:h?s:void 0,onPointerEnter:F=>h&&F.pointerType==="mouse"&&c(true),onPointerLeave:()=>{c(false),u(false)},onPointerDown:()=>h&&u(true),onPointerUp:()=>u(false),onPointerCancel:()=>u(false),style:{position:"absolute",left:`calc(50% + ${i.x}px)`,top:`calc(50% + ${i.y}px)`,width:L,height:L,marginLeft:-L/2,marginTop:-L/2,cursor:h?"pointer":"default",background:"none",border:"none",padding:0},children:E("span",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",transform:`translate(${v}px, ${C}px) scale(${P})`,opacity:z,transition:l||d?"transform 100ms ease":"none"},children:g?E("div",{style:{width:w.emptySlot.dotSize,height:w.emptySlot.dotSize,borderRadius:w.emptySlot.dotSize/2,backgroundColor:j.emptyDotBackground,border:`${w.emptySlot.borderWidth}px solid ${j.emptyDotBorder}`}}):we(ca,{children:[E("div",{style:{position:"absolute",width:`${w.icon.gradientBgSizePercent}%`,height:`${w.icon.gradientBgSizePercent}%`,borderRadius:w.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:w.icon.gradientBgOpacity}}),E("div",{style:{position:"absolute",width:`${w.icon.innerGlowSizePercent}%`,height:`${w.icon.innerGlowSizePercent}%`,borderRadius:w.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:w.icon.innerGlowOpacity}}),E("div",{style:{marginBottom:w.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:l?"brightness(1.2)":"none"},children:e.icon}),E("span",{style:{fontSize:e.name.length>8?Math.max(w.icon.label.fontSize*.7,w.icon.label.fontSize*8/e.name.length):w.icon.label.fontSize,fontWeight:w.icon.label.fontWeight,fontFamily:w.icon.label.fontFamily,color:j.iconLabel,letterSpacing:w.icon.label.letterSpacing,marginTop:w.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:e.name}),S&&E("span",{style:{fontSize:w.icon.label.fontSize-1,fontWeight:w.icon.label.fontWeight,fontFamily:w.icon.label.fontFamily,letterSpacing:w.icon.label.letterSpacing,color:Ur.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})})}r(an,"DialIconItem");function Ht({side:e,color:t}){return E("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(e==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]]).map(([o,i,n,s],l)=>E("line",{x1:o,y1:i,x2:n,y2:s,stroke:t,strokeWidth:2},l))})}r(Ht,"PagerChevron");function _t({side:e,disabled:t,onClick:o}){let[i,n]=te(false),s=t?j.emptyDotBorder:j.accent;return we("button",{type:"button","aria-label":`${e==="prev"?"Previous":"Next"} dial page`,"data-testid":`buoy-dial-${e}`,disabled:t,onClick:o,onPointerDown:()=>!t&&n(true),onPointerUp:()=>n(false),onPointerLeave:()=>n(false),onPointerCancel:()=>n(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${j.dialBorder}`,backgroundColor:j.dialBackground,color:t?j.iconLabelMuted:j.centerText,fontSize:12,fontWeight:900,fontFamily:Ft,letterSpacing:1.5,textTransform:"uppercase",cursor:t?"default":"pointer",opacity:t?.4:1,boxShadow:t?"none":`0 0 8px ${No(j.dialShadow,.4)}`,transform:i?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[e==="prev"&&E(Ht,{side:"prev",color:s}),e==="prev"?"PREV":"NEXT",e==="next"&&E(Ht,{side:"next",color:s})]})}r(_t,"PagerButton");function Wt({icons:e,onClose:t,centerLabel:o="MENU",onCenterPress:i,settingsOpen:n=false,hintsDisabled:s=false,emptyNote:l}){let{id:c}=Vr(),[d,u]=te(0),[g,S]=te(0),[h,B]=te(0),[I,R]=te(0),[L,D]=te(0),[P,z]=te(1),[v,C]=te(false),[F,M]=te(false),[T,ee]=te(false),V=ft(null),K=ft(null),J=ft(null),q=ft(false),{entrance:ne,exit:Z,interaction:ue}=jo,xe=Wr(),[be,ie]=te(()=>({width:window.innerWidth,height:window.innerHeight}));Pe(()=>{let O=r(()=>ie({width:window.innerWidth,height:window.innerHeight}),"resize");return window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);let W=gt(()=>Fr({screenWidth:be.width,maxCircleSize:Math.max(120,Math.min(320,be.height-96))}),[be]),me=gt(()=>jr(),[]),Re=gt(()=>$r(Qe,W.iconRadius),[W.iconRadius]),[Te,$e]=te(0),pe=Math.max(1,Math.ceil(e.length/Qe)),oe=Math.min(Te,pe-1),Ie=gt(()=>{let O=oe*Qe,a=[...e.slice(O,O+Qe)];for(;a.length<Qe;)a.push({id:`empty-${a.length}`,name:"",icon:null,onPress:r(()=>{},"onPress")});return a},[e,oe]);Pe(()=>{rn()},[]),Pe(()=>{let O=ne.backdrop.duration,a=ne.dial.rotation.duration,x=ne.centerButton.delay,A=ne.icons.delay,_=ne.icons.duration,G=performance.now(),Y=r(m=>{let f=m-G;u(Math.min(1,f/O));let k=Math.min(1,f/400),X=Ke(k)*1.1;k>.7&&(X-=(k-.7)*.33),k>=1&&(X=1),S(Math.max(0,Math.min(1.05,X)));let se=Math.min(1,f/a);if(B(Ke(se)*360),f>=x){let Se=Math.min(1,(f-x)/300),Ot=Ke(Se)*1.15;Se>.6&&(Ot-=(Se-.6)*.375),Se>=1&&(Ot=1),R(Math.max(0,Math.min(1.05,Ot)))}if(f>=A){let Se=Math.min(1,(f-A)/_);D(Ke(Se))}let Xe=A+_;f<Xe?J.current=requestAnimationFrame(Y):(u(1),S(1),B(360),R(1),D(1),ee(true))},"animate");return J.current=requestAnimationFrame(Y),()=>{J.current&&cancelAnimationFrame(J.current)}},[]);let ge=ht(()=>{if(q.current)return;q.current=true,M(true),J.current&&cancelAnimationFrame(J.current);let O=performance.now(),a=Z.icons.duration,x=Z.centerButton.duration,A=Z.dialScale.duration,_=Math.max(x,A),G=Z.backdrop.duration,Y=r(m=>{let f=m-O;if(f<a){let se=Nt(f/a);D(1-se),J.current=requestAnimationFrame(Y);return}let k=a;if(f<k+_){D(0);let se=Math.min(1,(f-k)/x),Xe=Math.min(1,(f-k)/A);R(1-Nt(se)),S(1-Nt(Xe)),J.current=requestAnimationFrame(Y);return}let X=k+_;if(f<X+G){S(0),R(0);let se=(f-X)/G;u(1-se),J.current=requestAnimationFrame(Y);return}u(0),t()},"animate");J.current=requestAnimationFrame(Y)},[Z,t]);Pe(()=>{let O=document.activeElement,a=V.current;return()=>{O?.isConnected&&(document.activeElement===document.body||a?.contains(document.activeElement))&&O.focus()}},[]),Pe(()=>{if(n)return;K.current?.focus();let O=r(a=>{let x=V.current;if(x){if(a.key==="Escape")a.preventDefault(),ge();else if(a.key==="Tab"){let A=Array.from(x.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(Y=>Y.getClientRects().length>0),_=A[0],G=A[A.length-1];(!x.contains(document.activeElement)||(a.shiftKey?document.activeElement===_:document.activeElement===G))&&(a.preventDefault(),(a.shiftKey?G:_)?.focus())}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(a.key)){let A=Array.from(x.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),_=A.indexOf(document.activeElement);if(_<0||!A.length)return;a.preventDefault();let G=a.key==="Home"?0:a.key==="End"?A.length-1:(_+(a.key==="ArrowRight"||a.key==="ArrowDown"?1:-1)+A.length)%A.length;A[G].focus()}}},"handleKeyDown");return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[ge,n]);let[ae,Ce]=te(false);Pe(()=>{if(s)return;let O=false,a=setTimeout(async()=>{let x=await Ho.getItem(on);!O&&!x&&Ce(true)},1200);return()=>{O=true,clearTimeout(a)}},[s]);let ke=ht(()=>{Ce(false),Ho.setItem(on,"true")},[]);Pe(()=>{n&&ae&&ke()},[n,ae,ke]);let Ye=ht(O=>{if(O.id.startsWith("empty-")||q.current)return;let[a,x]=ue.iconSelect.pulse,A=performance.now(),_=150,G=r(Y=>{let m=Y-A;if(m<_){let f=Ke(m/_);z(1-(1-a.scale)*f),requestAnimationFrame(G)}else if(m<_*2){let f=Ke((m-_)/_);z(a.scale+(x.scale-a.scale)*f),requestAnimationFrame(G)}else z(1)},"animatePulse");requestAnimationFrame(G),setTimeout(()=>{O.onPress(),ge()},ue.iconSelect.actionDelay)},[ue.iconSelect,ge]),je=ht(O=>{if(q.current)return;let a=Math.max(0,Math.min(O,pe-1));a!==oe&&$e(a)},[pe,oe]),ve=W.buttonSize*w.centerButton.containerRatio,Me=W.buttonSize*w.centerButton.borderRatio,fe=W.buttonSize*w.centerButton.containerRatio/2+6,ze=T&&!F;return we("div",{ref:V,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[E("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:ge,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:j.dialBackdrop,opacity:d}}),l?E("div",{role:"status","data-testid":"buoy-dial-empty-note",style:{position:"absolute",left:16,right:16,bottom:80+W.circleSize+16,color:j.iconLabel,fontSize:12,fontFamily:Ft,textAlign:"center",opacity:g>.01?1:0},children:l}):null,we("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,bottom:80,width:W.circleSize,height:W.circleSize,borderRadius:"50%",backgroundColor:j.dialBackground,border:`${w.circle.borderWidth}px solid ${j.dialBorder}`,boxShadow:`0 0 ${w.circle.shadowRadius}px ${No(j.dialShadow,w.circle.shadowOpacity)}`,transform:`scale(${g}) rotate(${h}deg)`,opacity:g>.01?1:0,overflow:"hidden"},children:[E("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:j.dialGradient1,opacity:w.gradientLayers[0].opacity}}),E("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:j.dialGradient2,opacity:w.gradientLayers[1].opacity}}),E("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:j.dialGradient3,opacity:w.gradientLayers[2].opacity}}),me.map(O=>E("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:w.grid.lineHeight,transform:`rotate(${O}deg)`,transformOrigin:"center"},children:["left","right"].map(a=>E("div",{style:{position:"absolute",top:0,[a]:0,width:`calc(50% - ${fe}px)`,height:w.grid.lineHeight,backgroundColor:j.dialGridLine}},a))},O)),E("div",{"data-testid":"dial-background","data-background":c,style:{position:"absolute",inset:0,pointerEvents:"none"},children:c==="hyperspace"?E(ia,{size:W.circleSize}):E(Kr,{focus:da})}),Ie.map((O,a)=>E(an,{icon:O,index:a,totalIcons:Ie.length,position:Re[a],progress:L,onPress:()=>Ye(O)},a)),we("div",{style:{position:"absolute",left:"50%",top:"50%",width:ve,height:ve,marginLeft:-ve/2,marginTop:-ve/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:j.hubHalo,borderRadius:W.buttonSize,overflow:"hidden",transform:`scale(${I*P})`,opacity:I>.01?1:0},children:[E("div",{style:{position:"absolute",inset:0,backgroundColor:j.dialGradient1,opacity:.5,borderRadius:W.buttonSize}}),E("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:j.dialGradient2,opacity:.3,borderRadius:W.buttonSize}}),E("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:j.dialGradient3,opacity:.2,borderRadius:W.buttonSize}}),E("div",{style:{width:Me,height:Me,borderRadius:W.buttonSize*w.centerButton.borderRadiusRatio,backgroundColor:j.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:E("button",{ref:K,type:"button","aria-label":n?"Close Settings":"Open Dev Tools Settings",disabled:!i,onClick:i,onPointerEnter:O=>O.pointerType==="mouse"&&C(true),onPointerLeave:()=>C(false),style:{border:0,padding:0,background:"transparent",width:W.buttonSize,height:W.buttonSize,borderRadius:W.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:i?"pointer":"default",transform:v?`scale(${ue.centerHover.scale})`:"scale(1)",transition:`transform ${ue.centerHover.duration}ms ease`,animation:ze&&!v?xe.pulse:"none"},children:n?we("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:w.centerButton.text.fontSize-2,fontWeight:w.centerButton.text.fontWeight,fontFamily:w.centerButton.text.fontFamily,color:j.centerText,letterSpacing:w.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[E("span",{style:{marginBottom:-2},children:"CLOSE"}),E("span",{style:{marginTop:-2},children:"SETTINGS"})]}):E("span",{style:{fontSize:w.centerButton.text.fontSize,fontWeight:w.centerButton.text.fontWeight,fontFamily:w.centerButton.text.fontFamily,color:j.centerText,letterSpacing:w.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase"},children:o})})})]})]}),pe>1&&we("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,top:"calc(100% - 64px)",width:W.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,g),transform:`scale(${Math.min(1,g)})`},children:[E(_t,{side:"prev",disabled:oe<=0,onClick:()=>je(oe-1)}),we("span",{"data-testid":"buoy-dial-page",style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:Ft,letterSpacing:2,color:j.centerText,textShadow:`0 0 6px ${j.centerTextGlow}`},children:[String(oe+1).padStart(2,"0"),we("span",{style:{color:j.iconLabelMuted,textShadow:"none"},children:[" / ",String(pe).padStart(2,"0")]})]}),E(_t,{side:"next",disabled:oe>=pe-1,onClick:()=>je(oe+1)})]}),ae&&!n&&E(jt,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:ke,showArrow:false})]})}r(Wt,"DialMenu");import{persistentStorage as sn,devToolsStorageKeys as ua}from"@buoy-gg/shared-ui/web";import{recordUsage as pa,pruneUsage as ma}from"@buoy-gg/floating-tools-core/web";var ln=ua.dial.usage(),Ve={},cn=false,Ut=null;function Kt(){return Ut||(Ut=(async()=>{try{let e=await sn.getItem(ln);if(e){let t=JSON.parse(e);t&&typeof t=="object"&&(Ve=t)}}catch{}finally{cn=true}})(),Ut)}r(Kt,"loadDialUsage");Kt();function dn(e){return e.map((t,o)=>({id:t,index:o,lastUsed:Ve[t]?.lastUsed??0})).sort((t,o)=>o.lastUsed-t.lastUsed||t.index-o.index).map(({id:t})=>t)}r(dn,"getRankedToolIds");async function un(e){if(!e)return;cn||await Kt();let t=Math.max(Date.now(),...Object.values(Ve).map(o=>o.lastUsed+1));Ve=ma(pa(Ve,e,t),t);try{await sn.setItem(ln,JSON.stringify(Ve))}catch{}}r(un,"recordToolUsage");import{useCallback as ga,useMemo as pn}from"react";import{persistentStorage as fa}from"@buoy-gg/shared-ui/web";import{useState as re,useEffect as Ae,useCallback as bt,useMemo as vt}from"react";import{settingsEventBus as St}from"@buoy-gg/floating-tools-core/web";import{useSyncExternalStore as ha}from"react";import{getRegisteredToolModule as ya}from"@buoy-gg/shared-ui/web";var ba=r(()=>()=>{},"noopSubscribe"),va=r(()=>null,"serverSnapshot");function mn(){let e=ya("@buoy-gg/external-sync");return ha(e?.subscribeSyncStatus??ba,()=>e?.getSyncStatus?.()??null,va)}r(mn,"useDesktopSyncStatus");import{SentryIcon as Sa,WifiCircuitIcon as wa,ImageOverlayIcon as xa,RenderCountIcon as Ta,Info as Vt,Layers as Ia,ChevronRightIcon as gn,ChevronDown as fn,getStorageBackendType as Ca,getUseLicense as ka,signOutOfBuoy as za,persistentStorage as Ee,Trash2 as Aa,CheckCircle2 as hn,BuoyUpgradeSheet as Ba,BackgroundSwitcher as Ra,night as b,NightCard as Le,NightRows as qt,NightSectionLabel as Ma,NightFootnote as yn,NightSwitch as bn,NightButton as Gt,NightSegmented as Da,NightBadge as ye,NightSeparator as Oa,monoFont as vn}from"@buoy-gg/shared-ui/web";import{EnvIcon as Sn,StorageIcon as Pa,RoutesIcon as Ea,NetworkIcon as La,QueryIcon as Fa,HighlighterIcon as $a,ReduxIcon as ja,EventsIcon as Na}from"@buoy-gg/floating-tools-core/web";import Ha,{createContext as _a,useContext as Wa}from"react";import{jsx as Ua}from"react/jsx-runtime";var wn=_a({});function Jt({children:e,defaultFloatingTools:t,defaultDialTools:o}){let i=Ha.useMemo(()=>({defaultFloatingTools:t,defaultDialTools:o}),[t,o]);return Ua(wn.Provider,{value:i,children:e})}r(Jt,"DefaultConfigProvider");function Yt(){return Wa(wn)}r(Yt,"useDefaultConfig");import Ka from"react";import{toolTheme as Va}from"@buoy-gg/shared-ui/web";import{jsx as xn}from"react/jsx-runtime";function Tn({label:e,size:t,color:o=Va.colors.text}){let i=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1),n=i<=2?t:t*1.6,s=Math.max(7,Math.min(t*(i===1?.7:.62),n/(.62*i)));return xn("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:s,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}r(Tn,"AppTextIcon");function Xt(e,t){return e==null?e:typeof e=="function"?Ka.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions}):typeof e=="string"||typeof e=="number"?xn(Tn,{label:String(e),size:t.size,color:t.color}):e}r(Xt,"renderAppIcon");import{JsModal as qa,devToolsStorageKeys as Qt,onSettingsApplied as Ga,expandableWindowControlsSupported as Ja}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as Ya}from"@buoy-gg/shared-ui/web";import{Fragment as et,jsx as p,jsxs as N}from"react/jsx-runtime";var qe="@react_buoy_dev_tools_settings",Xa=6,wt=r(e=>{let t=Xa,o={};for(let[i,n]of Object.entries(e))n&&t>0?(o[i]=true,t-=1):o[i]=false;return o},"enforceDialLimit"),Qa=r((e,t)=>{let{userStatus:o,environment:i,...n}=e,s=t?Object.entries(n).filter(([l])=>t.includes(l)):Object.entries(n);return{...Object.fromEntries(s),environment:i??false}},"sanitizeFloating"),In=r((e,t,o)=>{if(!t)return e;let i={...e.dialTools,...t.dialTools??{}},n=o?.allowedDialKeys?Object.entries(i).filter(([s])=>o.allowedDialKeys?.includes(s)):Object.entries(i);return{dialTools:wt(Object.fromEntries(n)),floatingTools:Qa({...e.floatingTools,...t.floatingTools??{}},o?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...t.globalSettings??{}}}},"mergeWithDefaults"),Za=r((e=[],t,o)=>{let i={},n={},s=new Set(t??[]),l=new Set(o??[]),c=!o||o.length===0;for(let d of e){let{id:u,slot:g="both"}=d;(g==="dial"||g==="both")&&(i[u]=c?true:l.has(u)),(g==="row"||g==="both")&&(n[u]=s.has(u))}return{dialTools:wt(i),floatingTools:{...n,environment:s.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}},"generateDefaultSettings"),es=r(({visible:e,onClose:t,onSettingsChange:o,initialSettings:i,availableApps:n=[],storage:s=Ee,zIndex:l})=>{let{defaultFloatingTools:c,defaultDialTools:d}=Yt(),u=vt(()=>Za(n,c,d),[n,c,d]),g=vt(()=>Object.keys(u.dialTools),[u]),S=vt(()=>Object.keys(u.floatingTools).filter(m=>m!=="environment"),[u]),[h,B]=re(i||tt||u),[I,R]=re(Zt??"floating"),[L,D]=re(Zt!==null),[P,z]=re(new Set),[v,C]=re(false),[F,M]=re(false);Ae(()=>{let m=requestAnimationFrame(()=>M(true));return()=>cancelAnimationFrame(m)},[]);let T=mn();Ae(()=>{r(async()=>{try{let m=await Ee.getItem(Qt.settings.activeTab());if(m&&["floating","settings","pro"].includes(m)){let f=m;Zt=f,R(k=>k===f?k:f)}}catch{}finally{D(true)}},"loadActiveTab")()},[]),Ae(()=>{L&&Ee.setItem(Qt.settings.activeTab(),I).catch(m=>{console.warn("[Buoy]","Failed to save settings active tab:",m)})},[I,L]);let ee=ka()?.(),V=ee?.isPro??false,K=!V&&ee?.licenseKey?ee.error:null,J=ee?.errorKind==="transport",[q,ne]=re(Cn),[Z,ue]=re(false),[xe,be]=re(false),[ie,W]=re(false),[me,Re]=re([]),[Te,$e]=re(false),pe=Ya(),oe=Co.get("window").height,Ie=Co.get("window").width,ge=Math.floor(oe*.33),ae=Math.min(Ie-32,400),Ce=bt(async()=>{try{let m=await s.getItem(qe);if(m){let f=JSON.parse(m),k=In(u,f,{allowedDialKeys:g,allowedFloatingKeys:S});tt=k,B(X=>kn(X,k)?X:k);return}tt=u,B(f=>kn(f,u)?f:u)}catch(m){console.error("[Buoy]","Failed to load dev tools settings:",m),B(u)}},[u,g,S,s]);Ae(()=>{Ce()},[Ce]),Ae(()=>{Ca().then(m=>{Cn=m,ne(f=>f===m?f:m)})},[]),Ae(()=>{ie&&($e(true),Ee.getAllKeys().then(m=>{Re(m.sort())}).catch(()=>{Re([])}).finally(()=>{$e(false)}))},[ie]);let ke=r(async m=>{try{let f=null;try{let X=await s?.getItem(qe);f=X?JSON.parse(X):null}catch{}let k={...m,dialTools:{...f?.dialTools,...wt(m.dialTools)},floatingTools:{...f?.floatingTools,...m.floatingTools}};await s.setItem(qe,JSON.stringify(k)),tt=k,B(k),o?.(k),St.emit(k)}catch(f){console.error("[Buoy]","Failed to save dev tools settings:",f)}},"saveSettings"),Ye=r(m=>{let f={...h,floatingTools:{...h.floatingTools,[m]:!h.floatingTools[m]}};ke(f)},"toggleFloatingTool"),je=r(m=>{let f={...h,globalSettings:{...h.globalSettings,[m]:!h.globalSettings?.[m]}};ke(f)},"toggleGlobalSetting"),ve=r(async()=>{ue(true),be(false);try{await Ee.clear(),be(true),B(u),s!==Ee&&await s.setItem(qe,JSON.stringify(u)),o?.(u),St.emit(u),setTimeout(()=>be(false),2e3)}catch(m){console.error("[Buoy]","Failed to clear storage:",m)}finally{ue(false)}},"handleClearStorage"),Me=bt(m=>{},[]),fe=r(m=>{let f=n.find(k=>k.id===m);return f?.description?f.description:m==="environment"?"Environment badge.":""},"getToolDescription"),ze=r(m=>m==="environment"?"Env Badge":n.find(f=>f.id===m)?.name??m.toUpperCase().replace(/_/g," "),"getToolLabel"),O=r(m=>{if(!F)return null;switch(m){case"query":return p(Fa,{size:18});case"env":return p(Sn,{size:18});case"sentry":return p(Sa,{size:18,color:"#9945FF"});case"storage":return p(Pa,{size:18,bgColor:b.color.surface});case"wifi":case"query-wifi-toggle":return p(wa,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return p(Ea,{size:18,bgColor:b.color.surface});case"network":return p(La,{size:18});case"environment":return p(Sn,{size:18});case"debug-borders":return p(Ia,{size:18,color:b.color.accent});case"highlight-updates":return p(Ta,{size:18,color:b.color.accent});case"highlight-updates-modal":return p($a,{size:18});case"redux":return p(ja,{size:18});case"image-overlay":return p(xa,{size:18});case"events":return p(Na,{size:18});case"zustand":try{let{ZustandIcon:f}=ko("@buoy-gg/zustand/web");return p(f,{size:18})}catch{return p(Vt,{size:18,color:b.color.textSecondary})}case"jotai":try{let{JotaiIcon:f}=ko("@buoy-gg/jotai/web");return p(f,{size:18})}catch{return p(Vt,{size:18,color:b.color.textSecondary})}default:{let f=n.find(k=>k.id===m);return f?.icon!=null?Xt(f.icon,{slot:"row",size:18,color:f.color}):p(Vt,{size:18,color:b.color.textSecondary})}}},"getToolIcon"),a=r((m,f,k,X)=>{let se=fe(m);return N(dt,{activeOpacity:k?1:.7,onPress:()=>!k&&X(),accessibilityLabel:ze(m),accessibilityRole:"button",style:[y.toolRow,k&&y.rowDisabled],children:[p(H,{style:y.toolIconSlot,children:O(m)}),N(H,{style:y.rowInfo,children:[N(U,{style:y.rowLabel,children:[ze(m),k?" \xB7 max 6":""]}),se?p(U,{style:y.rowCaption,numberOfLines:1,children:se}):null]}),p(bn,{value:f,disabled:k,onValueChange:()=>X(),accessibilityLabel:ze(m)})]},m)},"renderToolRow"),x=r(m=>{z(f=>{let k=new Set(f);return k.has(m)?k.delete(m):k.add(m),k})},"toggleSettingExpanded"),A=r((m,f,k,X,se)=>{let Xe=h.globalSettings?.[m]??false,Se=P.has(m);return N(H,{children:[N(dt,{activeOpacity:.7,onPress:()=>x(m),accessibilityLabel:f,style:y.settingRow,children:[N(H,{style:y.rowInfo,children:[p(U,{style:y.rowLabel,children:f}),p(U,{style:y.rowCaption,numberOfLines:Se?0:1,children:k})]}),p(bn,{value:Xe,onValueChange:()=>je(m),accessibilityLabel:f})]}),Se&&N(H,{style:y.settingRowBody,children:[p(U,{style:y.settingRowBodyText,children:X}),p(U,{style:y.settingRowBodyHint,children:se})]})]},m)},"renderGlobalSettingRow"),_=r((m,f,k)=>N(H,{children:[p(Ma,{children:m}),f,k]}),"renderSection"),G=q==="filesystem"?p(ye,{label:"File System",tone:"accent"}):q==="asyncstorage"?p(ye,{label:"Async Storage",tone:"warning"}):q==="localstorage"?p(ye,{label:"Local Storage",tone:"accent"}):q==="memory"?p(ye,{label:"Memory",tone:"danger"}):p(ye,{label:"Loading\u2026",tone:"neutral"}),Y=r(()=>N(H,{style:y.container,children:[N(Io,{keyboardShouldPersistTaps:"handled",style:y.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:y.scrollContainer,children:[I==="floating"&&p(et,{children:_("Floating Tools",p(Le,{glass:true,children:p(qt,{children:Object.entries(h.floatingTools).map(([m,f])=>a(m,f,false,()=>Ye(m)))})}),p(yn,{children:"Tools switched on here appear in the floating bubble row."}))}),I==="settings"&&N(et,{children:[_("Background",p(Le,{glass:true,padded:true,children:p(Ra,{embedded:true})})),_("Storage",N(Le,{glass:true,children:[N(dt,{activeOpacity:.7,onPress:()=>W(!ie),accessibilityLabel:"Storage Type",style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"Storage Type"})}),G,ie?p(fn,{size:16,color:b.color.textTertiary}):p(gn,{size:16,color:b.color.textTertiary})]}),ie&&N(et,{children:[N(H,{style:y.settingRowBody,children:[p(U,{style:y.settingRowBodyText,children:q==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":q==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":q==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":q==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),q==="asyncstorage"&&p(U,{style:[y.settingRowBodyText,y.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),q==="memory"&&p(U,{style:[y.settingRowBodyText,y.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),p(Oa,{}),N(H,{style:y.storageExpanded,children:[N(H,{style:y.storageExpandedHeader,children:[p(U,{style:y.storageExpandedTitle,children:"SAVED SETTINGS"}),p(U,{style:y.storageExpandedCount,children:Te?"\u2026":`${me.length} keys`})]}),Te?p(U,{style:y.storageKeyEmpty,children:"Loading\u2026"}):me.length===0?p(U,{style:y.storageKeyEmpty,children:"No settings saved yet"}):p(Io,{keyboardShouldPersistTaps:"handled",style:y.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:me.map(m=>p(H,{style:y.storageKeyItem,children:p(U,{style:y.storageKeyText,numberOfLines:1,children:m.replace("@react_buoy_","")})},m))})]}),p(H,{style:y.cardButtonWrap,children:p(Gt,{label:xe?"Cleared":Z?"Clearing\u2026":"Clear All Settings",variant:xe?"secondary":"destructive",size:"md",disabled:Z,onPress:ve,icon:xe?p(hn,{size:15,color:b.color.accent}):p(Aa,{size:15,color:Z?b.color.textTertiary:b.color.danger})})})]})]})),T&&T.state!=="idle"&&_("Desktop Sync",N(Le,{glass:true,children:[N(dt,{activeOpacity:.7,onPress:()=>x("desktopSync"),accessibilityLabel:"Buoy Desktop",style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"Buoy Desktop"})}),T.state==="connected"?p(ye,{label:"Connected",tone:"accent"}):T.state==="connecting"?p(ye,{label:"Connecting\u2026",tone:"neutral"}):p(ye,{label:"Retrying",tone:"warning"}),P.has("desktopSync")?p(fn,{size:16,color:b.color.textTertiary}):p(gn,{size:16,color:b.color.textTertiary})]}),P.has("desktopSync")&&N(H,{style:y.settingRowBody,children:[N(U,{style:y.settingRowBodyText,children:[T.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",p(U,{style:y.footnoteMono,children:T.targetURL??"(unknown URL)"}),T.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),T.state==="retrying"&&T.lastError&&N(U,{style:[y.settingRowBodyText,y.bodyWarning],children:["Last error: ",T.lastError]})]})]})),_("Modal Behavior",p(Le,{glass:true,children:N(qt,{children:[A("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."),Ja(Ne.OS==="web")?A("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]})}))]}),I==="pro"&&N(et,{children:[_("License",N(Le,{glass:true,children:[N(H,{style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"License Status"})}),p(H,{testID:"buoy-settings-license-status",accessibilityLabel:V?"License: Active":"License: Free",children:V?p(ye,{label:"Active",tone:"accent"}):p(ye,{label:"Free",tone:"neutral"})})]}),ee?.tierSource==="session"?N(H,{style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"Signed in with Buoy"})}),p(Gt,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void za(),testID:"buoy-settings-signout"})]}):null,ee?.teamRole?p(H,{style:y.settingRow,testID:"buoy-settings-team-role",children:N(H,{style:y.rowInfo,children:[N(U,{style:y.rowLabel,children:["Role: ",ee.teamRole]}),p(U,{style:y.rowCaption,children:ee.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),p(yn,{children:V?"You have full access to all Buoy DevTools features.":K?J?`Couldn't reach the license server (${K}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${K}.`:"Upgrade to Pro to unlock all features and support development."})),!V&&N(et,{children:[_("Pro Features",p(Le,{glass:true,children:p(qt,{children:["Advanced Settings","Priority Support"].map(m=>N(H,{style:y.featureRow,children:[p(hn,{size:16,color:b.color.accent}),p(U,{style:y.rowLabel,children:m})]},m))})})),p(Gt,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>C(true)})]})]})]}),p(Ba,{visible:v,onClose:()=>C(false)})]}),"renderContent");return p(qa,{visible:e,onClose:t,zIndex:l,variant:"night",header:{showToggleButton:false,customContent:p(H,{style:y.headerRow,children:p(Da,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:I,onChange:m=>R(m)})})},initialMode:"bottomSheet",onModeChange:Me,persistenceKey:Qt.settings.root(),enablePersistence:true,maxHeight:oe-pe.top,initialHeight:ge,initialFloatingPosition:{x:(Ie-ae)/2,y:pe.top+20},enableGlitchEffects:true,children:Y()})},"DevToolsSettingsModal"),ts={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}},os=r((e,t)=>{let o=new Set(e??[]),i=new Set(t??[]),n={};for(let l of i)n[l]=true;let s={environment:o.has("environment")};for(let l of o)l!=="environment"&&(s[l]=true);return{dialTools:wt(n),floatingTools:s,globalSettings:{enableSharedModalDimensions:false}}},"createDefaultsFromConfig"),tt=null,Zt=null,Cn=null,kn=r((e,t)=>JSON.stringify(e)===JSON.stringify(t),"sameSettings");St.addListener(e=>{e&&(tt=e)});var zn=r(()=>{let{defaultFloatingTools:e,defaultDialTools:t}=Yt(),o=vt(()=>!e&&!t?ts:os(e,t),[e,t]),[i,n]=re(o),s=bt(async()=>{try{let c=await Ee.getItem(qe);if(c){let d=JSON.parse(c),u=In(o,d);n(u);return}n(o)}catch(c){console.error("[Buoy]","Failed to load dev tools settings:",c),n(o)}},[o]);Ae(()=>Ga(c=>{c.includes(qe)&&s()}),[s]),Ae(()=>{s();let c=St.addListener(d=>{try{d&&n(d)}catch{}});return()=>{c()}},[s]);let l=bt(()=>{s()},[s]);return{settings:i,refreshSettings:l}},"useDevToolsSettings"),y=ct.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:b.gutter,paddingRight:b.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:b.gutter,paddingTop:8,paddingBottom:24,gap:b.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:b.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:b.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:b.color.text,fontSize:b.font.row,fontWeight:"500"},rowCaption:{color:b.color.textTertiary,fontSize:b.font.label},settingRowBody:{paddingHorizontal:b.rowPadH,paddingBottom:b.rowPadV,gap:6},settingRowBodyText:{color:b.color.textSecondary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},settingRowBodyHint:{color:b.color.textTertiary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},bodyWarning:{color:b.color.warning},bodyDanger:{color:b.color.danger},cardButtonWrap:{paddingHorizontal:b.cardPad,paddingTop:10,paddingBottom:b.cardPad},storageExpanded:{paddingHorizontal:b.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:b.color.textSecondary,fontSize:b.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:b.color.textTertiary,fontSize:b.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:b.color.glassElevated,borderRadius:b.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:b.color.textSecondary,fontSize:b.font.micro,fontFamily:vn},storageKeyEmpty:{color:b.color.textTertiary,fontSize:b.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:vn,fontSize:b.font.label,color:b.color.textSecondary}});import{jsx as An}from"react/jsx-runtime";var ns=[];function eo({visible:e,onClose:t,availableTools:o=ns,defaultFloatingTools:i,defaultDialTools:n,storage:s=fa,onSettingsChange:l}){let c=pn(()=>({getItem:r(async g=>s.getItem(g),"getItem"),setItem:r(async(g,S)=>s.setItem(g,S),"setItem")}),[s]),d=pn(()=>o.map(g=>({...g,name:g.name??g.id,icon:typeof g.icon=="function"?S=>g.icon(S.size):g.icon})),[o]),u=ga(g=>{l?.(g)},[l]);return An(Jt,{defaultFloatingTools:i,defaultDialTools:n,children:An(es,{visible:e,onClose:t,zIndex:11e3,availableApps:d,storage:c,onSettingsChange:u})})}r(eo,"SettingsModal");import{listenBuoyKeydown as is}from"@buoy-gg/shared-ui/web/floating";import{persistentStorage as Bn,setExpandableWindowControls as rs}from"@buoy-gg/shared-ui/web";import{createContext as as,useCallback as Be,useContext as ss,useEffect as xt,useMemo as ls,useRef as ot,useState as Rn}from"react";var cs=r((e,t,o)=>{if(t.singleton){let n=e.find(s=>s.id===t.id);if(n){let s=n.minimized??false;return{instanceId:n.instanceId,wasMinimized:s,apps:[...e.filter(l=>l.instanceId!==n.instanceId),{...n,minimized:false}]}}}let i=o();return{instanceId:i,wasMinimized:false,apps:[...e,{...t,instanceId:i}]}},"resolveOpenAppsState");import{createContext as ds,useCallback as Mn,useContext as us,useEffect as Tt,useMemo as ps,useRef as Dn,useState as It}from"react";import{JsModal as ms,ModalHeader as nt,HeaderSearchButton as gs,TickProvider as fs,ToolScreenHeaderContext as hs,devToolsStorageKeys as On,buoyColors as Pn,gameUIColors as to}from"@buoy-gg/shared-ui/web";import{jsx as le,jsxs as Ct}from"react/jsx-runtime";var it=r(()=>{},"noop"),ys={search:"",isSearchActive:false,clearSearch:it,close:it,minimize:it,showToast:it,setHeaderOverride:it},En=ds(null);function oo(){return us(En)??ys}r(oo,"useToolHost");function Ln(e,t){let{setHeaderOverride:o}=oo();Tt(()=>(o(e),()=>o(null)),t)}r(Ln,"useToolHeader");var Fn=2200,bs={success:to.success,error:to.error,info:to.info};function $n({message:e,type:t,nonce:o}){let i=Dn(new De.Value(0)).current;Tt(()=>{i.setValue(0),De.sequence([De.timing(i,{toValue:1,duration:150,useNativeDriver:true}),De.delay(Fn-450),De.timing(i,{toValue:0,duration:300,useNativeDriver:true})]).start()},[o,i]);let n=bs[t];return Ct(De.View,{pointerEvents:"none",style:[kt.toast,{opacity:i,borderColor:n+"60"}],children:[le(H,{style:[kt.toastDot,{backgroundColor:n}]}),le(U,{style:kt.toastText,numberOfLines:2,children:e})]})}r($n,"ToastView");function jn({app:e,config:t,visible:o,zIndex:i,onClose:n,onMinimize:s,initialModalState:l,enableSharedModalDimensions:c,bodyProps:d}){let u=e.component,[g,S]=It(false),[h,B]=It(""),[I,R]=It(null),[L,D]=It(null),P=Dn(null),z=Mn(()=>{S(false),B("")},[]),v=Mn((q,ne="info")=>{P.current&&clearTimeout(P.current),D(Z=>({message:q,type:ne,nonce:(Z?.nonce??0)+1})),P.current=setTimeout(()=>D(null),Fn)},[]);Tt(()=>()=>{P.current&&clearTimeout(P.current)},[]);let C=ps(()=>({search:g?h:"",isSearchActive:g,clearSearch:z,close:n,minimize:r(()=>s(),"minimize"),showToast:v,setHeaderOverride:R,instanceId:e.instanceId}),[h,g,z,n,s,v,e.instanceId]),F=I?.title??t.title??e.title??e.id,M=I?.subtitle??t.subtitle,T=I?.onBack,ee=I?.actions??t.headerActions,V=I?.searchable??t.searchable;Tt(()=>{!V&&g&&z()},[V,g,z]);let K=c?On.modal.root():On.custom(e.id).modal(),J=Ct(nt,{children:[T&&!g&&le(nt.Navigation,{onBack:T}),g?le(nt.Search,{value:h,onChangeText:B,onCancel:z,placeholder:t.searchPlaceholder,testID:`tool-search-field-${e.id}`}):le(nt.Content,{title:F,subtitle:M}),Ct(nt.Actions,{children:[!g&&ee,V&&!g&&le(gs,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>S(true)})]})]});return le(En.Provider,{value:C,children:le(ms,{visible:o,onClose:n,onBack:T,onMinimize:s,initialModalState:l,zIndex:i,persistenceKey:K,enablePersistence:true,initialMode:t.initialMode??"bottomSheet",header:{customContent:J,showToggleButton:true},disableScrollWrapper:true,styles:{},children:Ct(H,{style:kt.bodyRoot,children:[le(fs,{children:le(hs.Provider,{value:R,children:le(u,{...d})})}),L&&le($n,{message:L.message,type:L.type,nonce:L.nonce})]})})})}r(jn,"ToolModalShell");var kt=ct.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:Pn.card,borderWidth:1,borderRadius:8,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOpacity:.4,shadowRadius:8,shadowOffset:{width:0,height:2},elevation:6},toastDot:{width:6,height:6,borderRadius:3},toastText:{flex:1,fontSize:12,color:Pn.text}});import{useEffect as vs,useRef as Ss}from"react";import{capacitorPlatform as ws,capacitorPlugin as xs}from"@buoy-gg/license/web";function Nn(){return globalThis.__BUOY_HOLDS_BACK__===true}r(Nn,"isBuoyHoldingBackButton");var Ts=99.5;function Hn(){if(typeof document>"u")return false;let e=globalThis.Ionic;if(!e&&!document.querySelector("ion-app"))return false;try{return e?.config?.get?.("hardwareBackButton",true)!==false}catch{return true}}r(Hn,"ionicHandlesBack");function _n(e,t){let o=Ss(t);o.current=t,vs(()=>{if(!e||ws()!=="android")return;let i=globalThis;i.__BUOY_HOLDS_BACK__=true;let n;if(Hn()){let s=r(l=>{l.detail?.register?.(Ts,()=>{o.current()})},"listener");document.addEventListener("ionBackButton",s),n=r(()=>document.removeEventListener("ionBackButton",s),"cleanup")}else{let s=xs("App");if(!s?.addListener){i.__BUOY_HOLDS_BACK__=false;return}let l=false,c=null;Promise.resolve(s.addListener("backButton",()=>o.current())).then(d=>{l?d.remove():c=d}).catch(()=>{}),n=r(()=>{l=true,c&&c.remove()},"cleanup")}return()=>{n(),i.__BUOY_HOLDS_BACK__=false}},[e])}r(_n,"useCapacitorBackButton");import{Fragment as Is,jsx as ce}from"react/jsx-runtime";var Wn=as(null),Un="@react_buoy_open_apps",no=44,Cs=12,ks=100,zs=16,As=r(e=>({x:window.innerWidth-no-zs,y:window.innerHeight-ks-no-e*(no+Cs)}),"dockIconPosition"),Kn=r(({children:e})=>{let[t,o]=Rn([]),[i,n]=Rn(false),s=ot([]),l=ot(null),c=ot(false),d=ot(false),u=ot(false),g=Be(v=>{let C="";return o(F=>{let{apps:M,instanceId:T}=cs(F,v,()=>`${v.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);return C=T,M}),C},[]),S=Be(()=>{if(c.current||!d.current||!u.current)return;c.current=true;let v=l.current;if(!v||v.length===0){n(true);return}l.current=null,v.forEach(({id:C,minimized:F})=>{let M=s.current.find(T=>T.id===C);if(M&&M.component){let T=Xt(M.icon,{slot:"dial",size:20,color:M.color});g({id:M.id,title:M.name,component:M.component,props:M.props,modal:M.modal,launchMode:M.launchMode||"self-modal",singleton:M.singleton??true,icon:T,color:M.color,minimized:F})}}),n(true)},[g]);xt(()=>{let v=false;return r(async()=>{try{let C=await Bn.getItem(Un);if(v)return;if(C){let F=JSON.parse(C),M;Array.isArray(F)&&F.length>0&&(typeof F[0]=="string"?M=F.map(T=>({id:T,minimized:false})):M=F.filter(T=>typeof T=="object"&&T!==null&&typeof T.id=="string"),M.length&&(l.current=M))}}catch{}v||(d.current=true,S())},"restoreOpenApps")(),()=>{v=true}},[S]),xt(()=>{if(!i)return;let v=t.map(C=>({id:C.id,minimized:C.minimized??false}));Bn.setItem(Un,JSON.stringify(v))},[t,i]);let h=Be(v=>{s.current=v,u.current=true,S()},[S]),B=Be(v=>{o(C=>C.length?v?C.filter(F=>F.instanceId!==v):C.slice(0,-1):C)},[]),I=Be(()=>o([]),[]),R=Be((v,C)=>{o(F=>F.map(M=>M.instanceId===v?{...M,minimized:true,restoreState:C}:M))},[]),L=Be((v,C)=>{o(F=>{let M=F.find(T=>T.instanceId===v);return M?[...F.filter(T=>T!==M),{...M,minimized:false,restoreState:C??M.restoreState}]:F})},[]),D=Be(v=>t.find(C=>C.instanceId===v)?.minimized??false,[t]),P=t.some(v=>v.launchMode!=="toggle-only"&&!v.minimized);xt(()=>P?is(r(v=>{if(v.key!=="Escape"||v.defaultPrevented)return;let C=[...t].reverse().find(F=>F.launchMode!=="toggle-only"&&!F.minimized);C&&B(C.instanceId)},"handler")):void 0,[P,B,t]),_n(t.length>0,()=>B());let z=ls(()=>({openApps:t,isAnyOpen:P,open:g,close:B,closeAll:I,registerApps:h,minimize:R,restore:L,isMinimized:D}),[t,P,g,B,I,h,R,L,D]);return ce(Wn.Provider,{value:z,children:e})},"AppHostProvider"),rt=r(()=>{let e=ss(Wn);return e||{openApps:[],isAnyOpen:false,open:r(()=>"","open"),close:r(()=>{},"close"),closeAll:r(()=>{},"closeAll"),registerApps:r(()=>{},"registerApps"),minimize:r(()=>{},"minimize"),restore:r(()=>{},"restore"),isMinimized:r(()=>false,"isMinimized")}},"useAppHost"),Bs=9e3,Rs={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"},Ms={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"},Ds=r(({app:e,zIndex:t,onClose:o,onMinimize:i,minimizeTargetPosition:n,enableSharedModalDimensions:s})=>{let l=e.component,c=!e.minimized,d={...e.props??{},...s?{enableSharedModalDimensions:true}:{}};return e.modal&&(!e.launchMode||e.launchMode==="self-modal")?ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:ce(jn,{app:e,config:e.modal,visible:c,zIndex:t,onClose:o,onMinimize:i,initialModalState:e.restoreState,enableSharedModalDimensions:s,bodyProps:d})}):e.launchMode==="self-modal"?ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:ce(l,{...d,visible:c,onClose:o,onRequestClose:o,onMinimize:i,minimizeTargetPosition:n,instanceId:e.instanceId,zIndex:t,initialModalState:e.restoreState})}):e.launchMode==="inline"?c?ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:ce(l,{...d,onClose:o,onMinimize:i,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})}):null:ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{...Rs,zIndex:t,display:c?"flex":"none"},children:ce("div",{style:Ms,children:ce(l,{...d,onClose:o,onMinimize:i,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})})})},"AppRenderer"),Vn=r(()=>{let{openApps:e,close:t,minimize:o}=rt(),{settings:i}=zn();xt(()=>{rs(i.globalSettings?.expandableWindowControls!==false)},[i.globalSettings?.expandableWindowControls]);let n=e.filter(c=>c.launchMode!=="toggle-only");if(n.length===0)return null;let s=n.filter(c=>c.minimized).length,l=Lr()??As(s);return ce(Is,{children:n.map((c,d)=>ce(Ds,{app:c,zIndex:Bs+d,onClose:()=>t(c.instanceId),onMinimize:u=>o(c.instanceId,u),enableSharedModalDimensions:i.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:l},c.instanceId))})},"AppOverlay");import{useCallback as Os,useEffect as io,useRef as Ps,useState as qn,useSyncExternalStore as Gn}from"react";import{persistentStorage as Jn,getToolAttention as ro,subscribeToolAttention as Yn}from"@buoy-gg/shared-ui/web";import{jsx as de,jsxs as zt}from"react/jsx-runtime";function Xn(e){return Gn(Yn,()=>ro(e),()=>ro(e))}r(Xn,"useToolAttention");var Qn={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"},Zn={needsInput:3,failed:2,done:1},ei=new Map;function ao(e){let t=null;for(let i of e?e.split("|"):[]){let n=ro(i);n&&(!t||Zn[n.kind]>Zn[t.kind])&&(t=n)}let o=ei.get(e);return o&&t&&o.kind===t.kind&&o.label===t.label?o:!o&&!t?null:(ei.set(e,t),t)}r(ao,"strongest");function ti(e){let t=e.join("|");return Gn(Yn,()=>ao(t),()=>ao(t))}r(ti,"useStrongestAttention");var oi=28,so=32,lo=6,ni=8,ii=24,ri="@react_buoy_minimized_stack_expanded",Es=80,ai=2e3,Ls=6e3,Fs="#1A1A1A",at="#888888";function co({down:e=false}){return de("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:de("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:at,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}r(co,"ChevronGlyph");function si({id:e,title:t,icon:o,index:i,onPress:n}){let s=Xn(e),l=Ps(null);return io(()=>{let c=true,d,u=r(()=>{l.current?.animate([{transform:"translateX(0) scale(1)",opacity:1,offset:0},{transform:"translateX(3px) scale(1.05)",opacity:.4,offset:.2},{transform:"translateX(-3px) scale(1.1)",opacity:1,offset:.4},{transform:"translateX(2px) scale(1.0)",opacity:.6,offset:.6},{transform:"translateX(-1px) scale(0.95)",opacity:1,offset:.8},{transform:"translateX(0) scale(1)",opacity:1,offset:1}],{duration:Es,easing:"linear"})},"runGlitch"),g=r(S=>{let h=S?500+Math.random()*1500+i*200:ai+Math.random()*(Ls-ai)+i*300;d=setTimeout(()=>{c&&(u(),g(false))},h)},"schedule");return g(true),()=>{c=false,clearTimeout(d)}},[i]),zt("button",{type:"button","aria-label":s?`${t} \u2014 ${s.label}. Restore`:`Restore ${t}`,"data-testid":`buoy-dock-restore-${e}`,onClick:n,style:{width:so,height:so,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[de("div",{ref:l,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:o}),s?de("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${s.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Qn[s.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:s.kind==="needsInput"?"!":""}):null]})}r(si,"GlitchToolButton");function li({containerWidth:e=32}){let{openApps:t,restore:o}=rt(),i=t.filter(h=>h.minimized&&h.launchMode!=="toggle-only"),[n,s]=qn(false),[l,c]=qn(false),d=ti(i.map(h=>h.id));io(()=>{let h=false;return r(async()=>{let B=await Jn.getItem(ri);!h&&B==="true"&&s(true),h||c(true)},"load")(),()=>{h=true}},[]),io(()=>{l&&Jn.setItem(ri,n?"true":"false")},[n,l]);let u=Os(h=>{o(h)},[o]);if(i.length===0)return null;let g=ni+i.length*so+(i.length-1)*lo+lo+ii+4,S={backgroundColor:Fs,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${at}66`,borderLeft:`1px solid ${at}66`,borderRight:`1px solid ${at}66`,borderBottom:"none",boxSizing:"border-box"};return zt("div",{style:{height:oi,overflow:"visible",position:"relative"},children:[de("div",{style:{position:"absolute",bottom:"var(--buoy-stack-bottom, 0px)",top:"var(--buoy-stack-top, auto)",left:0,width:e,maxHeight:"var(--buoy-stack-space, calc(100vh - 48px))",visibility:n?"visible":"hidden",height:n?g:0,opacity:n?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:n?"auto":"none",...S},children:zt("div",{style:{height:g,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:ni,gap:lo,boxSizing:"border-box"},children:[n&&[...i].reverse().map((h,B)=>de(si,{id:h.id,title:h.title||h.id,icon:h.icon??de("span",{style:{color:"#fff",fontSize:13},children:(h.title||h.id).slice(0,1).toUpperCase()}),index:B,onPress:()=>u(h.instanceId)},h.instanceId)),de("button",{type:"button","aria-label":"Collapse","data-testid":"buoy-dock-collapse",onClick:()=>s(false),style:{width:"100%",height:ii,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:de(co,{down:true})})]})}),zt("button",{type:"button","aria-label":`Show ${i.length} minimized tools`,"data-testid":"buoy-dock-peek",tabIndex:n?-1:0,"aria-hidden":n,onClick:()=>s(true),style:{position:"absolute",bottom:0,left:0,width:e,height:oi,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",padding:0,opacity:n?0:1,transform:n?"scale(0.9)":"scale(1)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:n?"none":"auto",...S},children:[de(co,{}),d?de("span",{"aria-hidden":true,"data-testid":"buoy-dock-peek-attention",style:{position:"absolute",top:2,right:2,minWidth:11,height:11,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Qn[d.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:d.kind==="needsInput"?"!":""}):null,i.length>1&&de("span",{style:{fontSize:9,fontWeight:600,color:at,marginLeft:1},children:i.length})]})]})}r(li,"MinimizedToolsStack");import{registerToolModules as $s}from"@buoy-gg/shared-ui/web";import{createElement as js}from"react";function Ge(e){let t=e.icon;return{...e,icon:typeof t=="function"?o=>js(t,{size:o,slot:e.slot??"both",color:e.color}):()=>t}}r(Ge,"createWebTool");import{createContext as Ns,useContext as Hs,useState as ci,useMemo as di}from"react";import{jsx as _s}from"react/jsx-runtime";var ui=Ns(null);function uo({children:e}){let[t,o]=ci(false),[i,n]=ci(false),s=di(()=>t||i,[t,i]),l=di(()=>({isDialOpen:t,isToolOpen:i,isDevToolsActive:s,setDialOpen:o,setToolOpen:n}),[t,i,s]);return _s(ui.Provider,{value:l,children:e})}r(uo,"DevToolsVisibilityProvider");function At(){let e=Hs(ui);return e||{isDialOpen:false,isToolOpen:false,isDevToolsActive:false,setDialOpen:r(()=>{},"setDialOpen"),setToolOpen:r(()=>{},"setToolOpen")}}r(At,"useDevToolsVisibility");import*as Ws from"@buoy-gg/license/web";import*as Us from"@buoy-gg/shared-ui/web";import*as Ks from"@buoy-gg/shared-ui/web/dataViewer";function po(e){$s({core:{useDevToolsVisibility:At},license:Ws,"shared-ui":Us,"shared-ui/dataViewer":Ks,...e});let t=new Set;return Object.values(e).flatMap(o=>Object.entries(o).flatMap(([i,n])=>!i.endsWith("Preset")||!n||typeof n.id!="string"||!n.component||t.has(n.id)?[]:(t.add(n.id),[Ge(n)])))}r(po,"createWebTools");import{useEffect as Bt,useMemo as Rt,useRef as Vs}from"react";import{LicenseManager as pi,installCapacitorBridge as qs,resolveDevBuild as mi,useLicense as Gs}from"@buoy-gg/license/web";import{registerToolAdapters as Js}from"@buoy-gg/shared-ui/web";function mo(e){return typeof e=="object"&&e!==null?e:void 0}r(mo,"externalSyncOptions");function gi({isDevelopment:e,isLicensed:t,externalSync:o,isAvailable:i}){if(o===false||!i)return false;if(e)return true;let n=mo(o);return t&&n?.enableInRelease===true&&go(n.socketURL,n)===null}r(gi,"shouldMountExternalSync");var fi="http://localhost:42831";function hi(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}r(hi,"isLoopbackHost");function go(e,t){let o=e??fi;if(t?.allowInsecureNetwork===true)return null;let i;try{i=new URL(o)}catch{return`[Buoy] externalSync.socketURL "${o}" isn't a valid URL, so this release build won't connect to Buoy Desktop.`}return i.protocol==="https:"||i.protocol==="wss:"||hi(i.hostname)?null:`[Buoy] This release build won't connect to ${o}: release sync carries real user data, and plain http to another machine is readable by anyone on the same network. Use a simulator, an emulator or adb reverse (localhost), an https:// broker, or set externalSync.allowInsecureNetwork: true for a network you trust.`}r(go,"releaseTransportProblem");var Ys={impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};function yi(e,t,o){if(t)return e;let i=null;for(let[n,s]of Object.entries(Ys)){if(o?.includes(n))continue;let l=e[n];if(!l?.actions)continue;let c={...l.actions};for(let d of s)d in c&&(c[d]=()=>{throw new Error(`${n}.${d} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)});i??(i={...e}),i[n]={...l,actions:c}}return i??e}r(yi,"applyReleaseActionPolicy");import{useEffect as Xs,useMemo as Qs,useState as Zs}from"react";import{devToolsStorageKeys as el,persistentStorage as tl}from"@buoy-gg/shared-ui/web";import{isCapacitorNative as ol}from"@buoy-gg/license/web";var nl=8;function bi(){let e="";for(;e.length<nl;)e+=(Math.random()*16|0).toString(16);return e}r(bi,"generateInstallId");function vi(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}r(vi,"slugify");function Si({appName:e,hardwareName:t,platform:o,installId:i,deviceId:n}){let s=vi(e??"buoy")||"buoy",l=e??"Buoy Device",c=t?.trim()||o;return n?{deviceId:n,deviceName:`${l} (${c})`}:{deviceId:`${s}-${o}-${i}`,deviceName:`${l} (${c} \xB7 ${i.slice(-4)})`}}r(Si,"buildDeviceIdentity");function wi(){let e=globalThis;try{return e.sessionStorage??null}catch{return null}}r(wi,"sessionStore");function xi(){let e=globalThis;try{return e.localStorage??null}catch{return null}}r(xi,"localStore");async function Ti({platform:e=Ne.OS,store:t,mint:o=bi}={}){let i=el.sync.deviceId(),n=t===void 0?ol()?xi():e==="web"?wi():tl:t;if(!n)return o();try{let s=await n.getItem(i);if(s&&s.length>0)return s;let l=o();return await n.setItem(i,l),l}catch{return o()}}r(Ti,"loadInstallId");var fo=null;function Ii(){return fo||(fo=Ti()),fo}r(Ii,"getInstallId");function Ci(e,t){let o=e?.deviceId,i=e?.deviceName,n=t.loadId??Ii,s=t.platform??Ne.OS,[l,c]=Zs(null);return Xs(()=>{if(o)return;let d=false;return n().then(u=>{d||c(u)}),()=>{d=true}},[o,n]),Qs(()=>{if(!o&&!l)return null;let d=Si({appName:t.appName,hardwareName:t.hardwareName,platform:s,installId:l??"",deviceId:o});return i?{...d,deviceName:i}:d},[o,i,l,t.appName,t.hardwareName,s])}r(Ci,"useDeviceIdentity");import{useEffect as il,useState as rl}from"react";import{capacitorPlatform as al,capacitorPlugin as Mt,isCapacitorNative as sl}from"@buoy-gg/license/web";function ki(e,t){if(t==="ios")return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":null;let o=/Android [\d.]+;\s*([^;)]+?)(?:\s+Build\/|\))/.exec(e)?.[1]?.trim();return!o||o==="K"?null:o}r(ki,"hardwareFromUserAgent");function zi(e){return/sdk_gphone|Android SDK built for|Android ATD built for|google_sdk|Emulator|generic_/i.test(e)}r(zi,"isAndroidEmulatorUserAgent");function ho(){return typeof navigator>"u"?"":navigator.userAgent??""}r(ho,"userAgent");function Dt(){return typeof document>"u"?null:document.title||(typeof location>"u"?null:location.hostname)||null}r(Dt,"firstPageTitle");var Ai="@react_buoy_capacitor_app_name";function Bi(e){try{let t=globalThis.localStorage;if(!t)return e;let o=t.getItem(Ai);if(o)return o;e&&t.setItem(Ai,e)}catch{}return e}r(Bi,"persistedAppName");function Ri(){let e=al();if(!e)return{platform:"web",appName:Dt(),hardwareName:"Browser",ready:true};let t=!!Mt("App");return{platform:e,appName:t?Dt():Bi(Dt()),hardwareName:ki(ho(),e)??e,extraDeviceInfo:{runtime:"capacitor"},ready:!t&&!Mt("Device")}}r(Ri,"initialHostInfo");function Mi(){let[e,t]=rl(Ri);return il(()=>{if(!sl())return;let o=false,i=Mt("App"),n=Mt("Device");return Promise.all([i?.getInfo?.().catch(()=>null)??null,n?.getInfo?.().catch(()=>null)??null]).then(([s,l])=>{if(o)return;let c=s?.name?.trim(),d=l?.name?.trim()||l?.model?.trim();t(u=>({...u,appName:c||u.appName,hardwareName:d||u.hardwareName,ready:true}))}),()=>{o=true}},[]),e}r(Mi,"useHostInfo");function yo(){if(typeof location>"u")return null;let e=globalThis.WEBVIEW_SERVER_URL;return{protocol:location.protocol,hostname:location.hostname,origin:`${location.protocol}//${location.host}`,userAgent:ho(),serverUrl:typeof e=="string"?e:null}}r(yo,"pageInfo");function bo(e){if(!e)return null;try{let t=new URL(e);return`${t.protocol}//${t.host}`}catch{return null}}r(bo,"schemeHost");function Di(e,t){if(e==="ios"){let o=bo(t.serverUrl);return o?o===bo(t.origin):t.protocol==="capacitor:"}return Oi.has(t.hostname)}r(Di,"isBundledPage");var Oi=new Set(["localhost","127.0.0.1","[::1]","::1"]);function Pi(e,t,o,i=yo()){if(o==="web"||!i)return e;let n;try{n=new URL(e)}catch{return e}let s=Di(o,i);return!t&&s&&n.hostname===i.hostname&&(n.hostname="localhost"),o==="android"&&Oi.has(n.hostname)&&zi(i.userAgent)&&(n.hostname="10.0.2.2"),n.toString().replace(/\/$/,"")}r(Pi,"capacitorBrokerURL");function Ei(e,t,o=yo()){return t!=="android"||!o||o.protocol!=="https:"||!/^(http|ws):/i.test(e)?null:`[Buoy] Can't reach Buoy Desktop at ${e}. This Android WebView serves the app from https://${o.hostname} and blocks plain http/ws by default. For debug builds, set android.allowMixedContent: true and server.cleartext: true in capacitor.config, then run cap sync.`}r(Ei,"capacitorTransportProblem");import{getDevServerOrigin as ll,resolveReloadStrategy as cl,scheduleReloadApp as dl}from"@buoy-gg/shared-ui/web";var Li=Date.now(),Fi=ll(),ul={platform:Ne.OS,isTV:Ne.isTV===true,isTVOS:Ne.isTVOS===true},$i={version:3,getSnapshot:r(()=>{let e=cl("auto");return{startedAt:Li,devServerOrigin:Fi,device:ul,reload:{available:e!==null,strategy:e}}},"getSnapshot"),subscribe:r(e=>()=>{},"subscribe"),actions:{ping:r(()=>({ok:true,startedAt:Li,devServerOrigin:Fi}),"ping"),reloadApp:r(e=>{let t=e??{},{strategy:o,delayMs:i}=dl({strategy:t.strategy,delayMs:t.delayMs});return{scheduled:true,strategy:o,delayMs:i}},"reloadApp")}};import{Fragment as pl,jsx as Fe,jsxs as ml}from"react/jsx-runtime";var gl=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"],fl=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];function ji(e){let t=Rt(()=>Object.fromEntries(Object.entries(e.modules).map(([i,n])=>[i.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),n])),[e.modules]),o=t["react-query"];return o?.useReactQuerySyncAdapter?Fe(Ni,{...e,modules:t,query:o}):Fe(vo,{...e,modules:t})}r(ji,"BrowserToolRuntime");function Ni(e){let t=e.query.useReactQuerySyncAdapter();return Fe(vo,{...e,queryAdapter:t})}r(Ni,"QueryRuntime");function vo({modules:e,apps:t,requiredEnvVars:o,externalSync:i,headless:n,sentryGetClient:s,queryAdapter:l}){let{isPro:c,tier:d}=Gs(),u=Rt(()=>{let L={app:$i};for(let[D,P]of Object.entries(e))for(let[z,v]of Object.entries(P))z.endsWith("SyncAdapter")&&v&&typeof v=="object"&&(L[D]=v);l&&(L.query=l),e.env?.createEnvSyncAdapter&&(L.env=e.env.createEnvSyncAdapter(o??[]));for(let D of t??[])D.sync&&(L[`custom:${D.id}`]=D.sync);return L},[e,t,o,l]),g=Vs(u);g.current=u,Bt(()=>Js(()=>g.current),[]),Bt(()=>{let L=[],D=r(P=>{let z=P?.();typeof z=="function"&&L.push(z)},"start");return D(e.network?.startNetworkCapture),D(e.storage?.startBrowserStorageCapture),D(e.assets?.startBrowserAssetCapture),D(e.three?.startThreeCapture),mi(typeof He<"u"?He:process.env.NODE_ENV!=="production")&&D(e["time-machine"]?.startTimeMachineFloatingToolPersistence),e.storage?.storageSyncAdapter?.subscribe&&D(()=>e.storage.storageSyncAdapter.subscribe(()=>{})),e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe&&D(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{})),()=>{for(let P of L.reverse())P()}},[e]);let S=e["external-sync"],h=mi(typeof He<"u"?He:process.env.NODE_ENV!=="production"),B=gi({isDevelopment:h,isLicensed:c,externalSync:i,isAvailable:!!S}),I=mo(i);qs({release:!h&&!!I?.enableInRelease}),!h&&I?.enableInRelease&&So(go(I.socketURL,I));let R=e.sentry?.SentryRoot;return ml(pl,{children:[Object.entries(e).flatMap(([L,D])=>gl.map(P=>{let z=D[P];return z?Fe(z,{},`${L}:${P}`):null})),R&&Fe(R,{getClient:s}),Object.entries(e).flatMap(([L,D])=>fl.map(P=>{let z=D[P];return z&&(!n||P==="ScenariosOverlay"||P==="ImpersonateOverlay")?Fe(z,{},`${L}:${P}`):null})),B&&Fe(_i,{module:S,tools:u,options:I,isPro:c,tier:d,dev:h})]})}r(vo,"ToolRuntime");var Hi=null;function So(e){!e||e===Hi||(Hi=e,console.warn("[Buoy]",e))}r(So,"warnOnce");function _i({module:e,tools:t,options:o,isPro:i,tier:n,dev:s}){let l=Mi(),c=Ci(o,{appName:l.appName,hardwareName:l.hardwareName,platform:l.platform}),d=Rt(()=>Pi(o?.socketURL??(s?e.getDefaultSocketURL():fi),!!o?.socketURL,l.platform),[o?.socketURL,s,e,l.platform]),{socket:u}=e.useExternalSyncSocket({deviceName:c?.deviceName??"Buoy Browser",socketURL:d,persistentDeviceId:l.ready?c?.deviceId??null:null,platform:l.platform,extraDeviceInfo:l.extraDeviceInfo,enableLogs:o?.enableLogs});Bt(()=>{let h=Ei(d,l.platform);if(!u||!h)return;let B=r(()=>So(h),"onError");return u.on("connect_error",B),()=>{u.off("connect_error",B)}},[u,d,l.platform]),Bt(()=>{if(!u)return;let h=r(()=>{if(!u.connected||!pi.hasAccountAccess())return;let B=pi.getState();!i&&(B.isInitialized===false||B.isValidating===true)||u.emit("device-license",{isPro:i?"1":"0",tier:n})},"emit");return h(),u.on("connect",h),()=>{u.off("connect",h)}},[u,i,n]);let g=o?.releaseActions?.join(",")??"",S=Rt(()=>yi(t,s,g?g.split(","):void 0),[t,s,g]);return e.useExternalSync({tools:S,socket:u,deviceId:l.ready?c?.deviceId??null:null,enableLogs:o?.enableLogs}),null}r(_i,"BrowserExternalSync");import{useState as Wi}from"react";import{BuoyPortal as hl}from"@buoy-gg/shared-ui/web/floating";import{useBuoySession as yl}from"@buoy-gg/license/web";import{Fragment as Ui,jsx as Je,jsxs as Ki}from"react/jsx-runtime";var Vi="#20C997";function qi(){let{status:e,signIn:t,signOut:o}=yl(),[i,n]=Wi(false),[s,l]=Wi(null);if(typeof document>"u")return null;let c=r(()=>{l(null),n(true),t().catch(u=>l(u instanceof Error?u.message:"Sign-in did not work. Try again.")).finally(()=>n(false))},"start"),d=e.state==="active";return Je(hl,{children:Je("div",{"data-buoy-signin":"",style:{position:"fixed",right:"max(16px, env(safe-area-inset-right))",bottom:"max(20px, env(safe-area-inset-bottom))",zIndex:99999,maxWidth:"min(320px, calc(100vw - 32px))",padding:d||s?"12px 14px":0,borderRadius:16,background:d||s?"#0f1419":"transparent",color:"#e6edf3",boxShadow:d||s?"0 10px 30px rgba(0,0,0,.35)":"none",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",fontSize:14,lineHeight:1.45},children:d?Ki(Ui,{children:[Je("div",{"data-testid":"buoy-signin-needs-plan",children:"Buoy on a live site needs a Pro or Business plan."}),Je("button",{type:"button",onClick:()=>void o(),style:bl,"data-testid":"buoy-signout",children:"Sign out"})]}):Ki(Ui,{children:[s?Je("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:s}):null,Je("button",{type:"button",onClick:c,disabled:i,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:Vi,color:"#04130d",fontWeight:600,fontSize:14,cursor:i?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:i?"Signing in\u2026":"Sign in to Buoy"})]})})})}r(qi,"BuoySignIn");var bl={marginTop:8,padding:0,border:"none",background:"none",color:Vi,fontSize:14,cursor:"pointer",textDecoration:"underline"};import{LicenseManager as Qc}from"@buoy-gg/license/web";var vl=false;function Gi(){if(!vl){try{let e=process.env.EXPO_PUBLIC_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}}r(Gi,"defaultLicenseKey");import{useState as Sl}from"react";import{AccountSetupButton as wl,BuoyNeedsPlanCard as xl,BuoySignInCard as Tl,useSignInState as Il}from"@buoy-gg/shared-ui/web";import{jsx as st,jsxs as Ji}from"react/jsx-runtime";function wo({needsPlan:e=false}){let[t,o]=Sl(false),i=Il();return Ji(H,{pointerEvents:"box-none",style:Yi.root,children:[st(wl,{expanded:t,onPress:()=>o(true)}),t?st(mr,{visible:true,transparent:true,animationType:"fade",onRequestClose:()=>o(false),children:Ji(H,{style:Yi.overlay,accessibilityViewIsModal:true,children:[st(pr,{style:ct.absoluteFill,onPress:()=>o(false),accessible:false}),e&&i==="active"?st(xl,{onClose:()=>o(false)}):st(Tl,{onClose:()=>o(false)})]})}):null]})}r(wo,"BuoySignIn");var Yi=ct.create({root:{position:"absolute",bottom:30,right:16,zIndex:99999},overlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.65)",alignItems:"center",justifyContent:"center",padding:20}});function xo(e){if(e.length>6){let t=e.map(o=>`"${o}"`).join(", ");return e.slice(0,6)}return e}r(xo,"validateDialConfig");import{installedTools as Cl,installedToolsFound as kl}from"@buoy-gg/core/web/installed-tools";import{Fragment as To,jsx as $,jsxs as lt}from"react/jsx-runtime";var Xi={},Qi="@react_buoy_floating_menu_tooltip_shown",zl=Oe;function Zi({size:e=14,color:t="#20C997"}){let o=Math.max(2,e/4),i=Math.max(1,e/16);return $("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:i,width:e,height:e,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((n,s)=>$("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:t}},s))})}r(Zi,"MenuLauncherIcon");function er(e){let{defaultFloatingTools:t,defaultDialTools:o,disableHints:i=false,children:n}=e,s=he(()=>o&&xo(o),[o]);return $(Jt,{defaultFloatingTools:t,defaultDialTools:s,children:$(Ir,{disableHints:i,children:lt(uo,{children:[$(Kn,{children:$(rr,{...e})}),n]})})})}r(er,"AdmittedFloatingDevTools");var Al=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function tr({modules:e=Xi}){return $(To,{children:Object.entries(e).flatMap(([t,o])=>Al.map(i=>{let n=o[i];return n?$(n,{},`${t}:${i}`):null}))})}r(tr,"StartupCapture");function or(){let{openApps:e,restore:t}=rt();return Q(()=>Ro(o=>{let i=e.find(n=>n.id===o);return i?(t(i.instanceId),true):false}),[e,t]),null}r(or,"WebToolOpenerBridge");function nr(){let e=xr();return Cr((e===null?process.env.NODE_ENV:e?"development":"production")??"dev")}r(nr,"defaultEnvironment");function ir(e,t,o,i){let n=r(g=>Object.entries(e).find(([S])=>S.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===g)?.[1],"find"),s=[],l=n("env");t?.length&&l?.createEnvTool&&l.createEnvVarConfig&&s.push(Ge(l.createEnvTool({requiredEnvVars:l.createEnvVarConfig(t)})));let c=n("storage");o?.length&&c?.createStorageTool&&s.push(Ge(c.createStorageTool({requiredStorageKeys:o})));let d=n("ask-buoy"),u=i==="hosted"?d?.hostedAskBuoy?.():i;return u&&d?.createAskBuoyTool&&s.push(Ge(d.createAskBuoyTool(u))),s}r(ir,"configOverrides");function rr({environment:e,userRole:t="admin",availableEnvironments:o,onEnvironmentSwitch:i,apps:n,modules:s=Xi,externalSync:l,requiredEnvVars:c,sentryGetClient:d,disableHints:u=false,headless:g=false,hidden:S=false,defaultFloatingTools:h,defaultDialTools:B,zustandStores:I,requiredStorageKeys:R,askBuoy:L}){let D=e??nr(),P=he(()=>B?xo(B):void 0,[B]),[z,v]=Et(false),[C,F]=Et(false),M=Mo(false),T=rt(),ee=he(()=>ir(s,c,R,L),[s,c,R,L]),{allowedTools:V}=zo(),K=he(()=>Dr(Lt([...po(s),...n??[],...ee]),V),[n,s,ee,V]),{openApps:J,close:q}=T;Q(()=>{if(V)for(let a of J)Or(a.id,V)||q(a.instanceId)},[J,V,q]);let ne=he(()=>Object.entries(s).find(([a])=>a.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[s]);Q(()=>{if(!I||typeof ne?.watchStores!="function")return;let a=ne.watchStores(I);return typeof a=="function"?a:void 0},[I,ne]);let Z=At(),ue=T.openApps.some(a=>!a.minimized);Q(()=>{Z.setDialOpen(z)},[z,Z.setDialOpen]),Q(()=>{Z.setToolOpen(ue||C)},[ue,C,Z.setToolOpen]);let{registerApps:xe}=T;Q(()=>{xe(K.map(a=>{let x=a.icon;return{...a,icon:typeof x=="function"?({size:A})=>x(A):x}}))},[xe,K]);let be=he(()=>K.map(a=>({id:a.id,name:a.name,description:a.description,slot:a.slot})),[K]);zr({availableTools:be,storage:zl}),Q(()=>{let a=false;return r(async()=>{let[x,A]=await Promise.all([Oe.getItem(pt.dial.isOpen()),Oe.getItem(pt.settings.modalOpen())]);a||(x==="true"&&v(true),A==="true"&&(v(true),F(true)),M.current=true)},"restore")(),()=>{a=true}},[]),Q(()=>{M.current&&Oe.setItem(pt.dial.isOpen(),z?"true":"false")},[z]),Q(()=>{M.current&&Oe.setItem(pt.settings.modalOpen(),C?"true":"false")},[C]);let ie=_e(a=>{if(un(a.id),a.launchMode==="toggle-only"){a.onPress?.();return}if(a.component){let x=typeof a.icon=="function"?a.icon(20):a.icon;T.open({id:a.id,title:a.name||ut(a.id),component:a.component,props:a.props,modal:a.modal,launchMode:a.launchMode||"self-modal",singleton:a.singleton??true,icon:x,color:a.color||Do(a.id)})}else a.onPress?.()},[T]),W=Mo({tools:K,openApps:T.openApps,openTool:ie});W.current={tools:K,openApps:T.openApps,openTool:ie},Q(()=>Ro(a=>{let{tools:x,openApps:A,openTool:_}=W.current;if(A.some(Y=>Y.id===a))return false;let G=x.find(Y=>Y.id===a);return!G||G.launchMode==="toggle-only"?false:(_(G),true)}),[]);let me=he(()=>mt(K,"dial").map(a=>{let x=a.color||Do(a.id),A;return typeof a.icon=="string"?A=a.icon:typeof a.icon=="function"?A=a.icon(32):A=null,{id:a.id,name:a.name||ut(a.id),icon:A,unavailable:!a.component&&!a.onPress,color:x,onPress:r(()=>{ie(a),v(false)},"onPress")}}),[K,ie]),Re=he(()=>{if(!z)return me;let a=new Map(me.map(x=>[x.id,x]));return dn(me.map(x=>x.id)).map(x=>a.get(x)).filter(x=>!!x)},[z,me]),{settings:Te}=zn(),$e=he(()=>mt(K,"row").filter(a=>(Te.floatingTools[a.id]??false)===true&&(a.component||a.onPress)),[K,Te.floatingTools]),pe=he(()=>K.map(a=>({id:a.id,name:a.name||ut(a.id),description:a.description||Ar(a.id),slot:a.slot,icon:a.icon,color:a.color})),[K]),[oe,Ie]=Et(false),ge=T.openApps.some(a=>!a.minimized);Q(()=>{if(u)return;let a=false,x=setTimeout(async()=>{let A=await Oe.getItem(Qi);!a&&!A&&Ie(true)},1e3);return()=>{a=true,clearTimeout(x)}},[u]);let ae=_e(()=>{Ie(false),Oe.setItem(Qi,"true")},[]),Ce=_e(()=>{ae(),v(true)},[ae]),ke=_e(()=>{v(false),F(false)},[]),Ye=_e(()=>{F(a=>!a)},[]),je=_e(()=>F(false),[]),ve=!!(o?.length&&i),Me=Te.floatingTools.environment!==false,fe=oe&&!z&&!ge&&!S;Q(()=>{if(!fe)return;let a=r(A=>{(!(A.target instanceof Element)||!A.target.closest("[data-buoy-root]"))&&ae()},"onPointerDown"),x=r(A=>{A.key==="Escape"&&ae()},"onKeyDown");return document.addEventListener("pointerdown",a,true),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",a,true),document.removeEventListener("keydown",x)}},[fe,ae]);let ze=T.openApps.some(a=>a.minimized&&a.launchMode!=="toggle-only"),O=$(ji,{modules:s,apps:n,requiredEnvVars:c,externalSync:l,headless:g,sentryGetClient:d});return g?O:lt("div",{"data-buoy-root":"",style:{display:"contents"},children:[O,$(or,{}),fe&&$("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),$("div",{style:S?{visibility:"hidden"}:{display:"contents"},"aria-hidden":S||void 0,children:lt(Eo,{enablePositionPersistence:!fe,pushToSide:z||ge,suspendPointerEvents:z,centerOnboarding:fe,minimizedStack:ze?$(li,{}):void 0,hasMinimizedStack:ze,children:[D&&Me&&!ve&&$(Br,{environment:D}),ve&&Me&&$(Rr,{currentEnvironment:D??"local",availableEnvironments:o,onSelect:i}),t?$(Lo,{userRole:t,onPress:Ce}):$("button",{"aria-label":"Open dev tools",onClick:Ce,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:$(Zi,{})}),$e.map(a=>$("button",{"aria-label":a.name||ut(a.id),title:a.description,onClick:()=>ie(a),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof a.icon=="function"?a.icon(16):a.icon},a.id))]})}),fe&&$(jt,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:ae}),z&&!S&&$(Wt,{icons:Re,onClose:ke,centerLabel:"BUOY",onCenterPress:Ye,settingsOpen:C,hintsDisabled:u,emptyNote:V&&Re.length===0?Pr:void 0}),C&&!S&&$(eo,{visible:true,onClose:je,availableTools:pe,defaultFloatingTools:h,defaultDialTools:P,onSettingsChange:a=>{}}),!S&<(To,{children:[$(Vn,{}),$(yr,{})]})]})}r(rr,"FloatingDevToolsInner");function ar(e){let t=e&&typeof e=="object"?e.appId:void 0,o=!!e;Q(()=>{if(!o)return;let i=false,n=br.SessionManager;if(!n)return;let s=r(l=>{i||!l||(n.configure({audience:`app:${l}`}),n.load().catch(()=>{}))},"apply");return t?s(t):Bo().then(l=>s(l?.bundleId)).catch(()=>{}),()=>{i=true}},[o,t])}r(ar,"useCapacitorSignInAudience");function sr(e){let t=e&&typeof e=="object"?e.appId:void 0;Q(()=>{let o=false;return t?Pt(t):Ao()?Bo().then(i=>{o||Pt(i?.bundleId)}).catch(()=>{}):typeof location<"u"&&location.origin&&location.origin!=="null"&&Pt(location.origin),()=>{o=true}},[t])}r(sr,"usePublishAppId");var lr=false;function cr(e){return e.modules?e:(!kl&&!lr&&typeof console<"u"&&(lr=true,console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")),{...e,modules:Cl})}r(cr,"withInstalledTools");function dr(e){return $(hr,{children:$(ur,{...cr(e)})})}r(dr,"FloatingDevTools");function ur(e){let{access:t,isPro:o,licenseKey:i}=zo();Q(()=>{vr.configure(e.licenseKey??Gi())},[e.licenseKey]);let n=e.licenseKey===void 0||Sr(e.licenseKey,i),s=wr(typeof He<"u"?He:process.env.NODE_ENV!=="production"),l=n&&t.status==="admitted";Q(()=>{l&&kr()},[l]),Q(()=>{s||t.status==="initializing"||(o&&l?gr():fr())},[s,o,l,t.status]);let c=Ao();return ar(c?e.signIn:void 0),sr(e.signIn),!s&&!o?!e.signIn||e.headless?null:c?$(wo,{needsPlan:true}):$(qi,{}):l?$(er,{...e}):lt(To,{children:[t.status==="initializing"&&$(tr,{modules:e.modules}),e.headless?null:e.signIn&&c?$(wo,{}):$(Tr,{})]})}r(ur,"FloatingDevToolsContent");export{Mr as a,Oo as b,Lt as c,mt as d,Po as e,Eo as f,Er as g,Lo as h,Wt as i,eo as j,oo as k,Ln as l,Nn as m,Kn as n,rt as o,Vn as p,Ge as q,uo as r,At as s,po as t,$i as u,dr as v};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{a as ct,b as
|
|
1
|
+
"use client";import{a as ct,b as _,c as U,d as Me,e as dt,f as pi,g as Io,h as fi,i as Rl,j as Co,k as Ne}from"./chunk-C6HZO5XT.mjs";import{b as mi,c as gi}from"./chunk-D2FYORGY.mjs";import{a as i,b as zo,e as _e}from"./chunk-LOPXJLVB.mjs";import{BuoyPortal as hi,FloatingToolHost as yi}from"@buoy-gg/shared-ui/web/floating";import*as bi from"@buoy-gg/license/web";import{LicenseManager as vi,useLicense as ko,sameLicenseKey as Si,resolveDevBuild as xi,capacitorDebug as wi,isCapacitorNative as Ao,loadCapacitorAppHost as Bo}from"@buoy-gg/license/web";import{AccountSetup as Ti,HintsProvider as Ii,normalizeEnvironment as Ci,registerToolOpener as Ro,setBuoyAppId as Et,startSettingsSync as zi}from"@buoy-gg/shared-ui/web";import{useState as Pt,useMemo as he,useCallback as He,useEffect as Q,useRef as Do}from"react";import{useSettings as ki,getToolLabel as ut,getToolDescription as Ai,getToolColor as Mo}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Oe,devToolsStorageKeys as pt,EnvironmentIndicator as Bi,EnvironmentSelectorInline as Ri}from"@buoy-gg/shared-ui/web";var Di=[];function Oo(){return[]}i(Oo,"autoDiscoverWebPresets");function Lt(e=[]){return[...new Map(e.map(t=>[t.id,t])).values()]}i(Lt,"autoDiscoverWithCustom");function ft(e,t){return e.filter(o=>{let r=o.slot||"both";return r==="both"||r===t})}i(ft,"getToolsBySlot");function Eo(e,t){let o=t instanceof Set?t:new Set(t);return e.filter(r=>o.has(r.id))}i(Eo,"getEnabledTools");import{filterTeamTools as Mi,isTeamToolAllowed as Oi}from"@buoy-gg/floating-tools-core/web";var Ei="No tools are on for your role. Ask your team admin.";import{FloatingTool as Po,FloatingToolDivider as Pi,FloatingToolUserStatus as Lo,getBubbleAnchorPosition as Li}from"@buoy-gg/shared-ui/web/floating";import{useState as te,useEffect as Ee,useMemo as mt,useRef as gt,useCallback as ht}from"react";var Fo={network:"Network",images:"Images","image-overlay":"Image Overlay",assets:"Assets",query:"React Query",storage:"Storage",env:"Env",console:"Console",events:"Events",redux:"Redux",zustand:"Zustand",jotai:"Jotai","route-events":"Routes","time-machine":"Time Machine",clock:"Clock",permissions:"Permissions","highlight-updates":"Highlight Updates","debug-borders":"Debug Borders","perf-monitor":"Bench HUD","js-top":"JS Top","js-top-modal":"JS Top",impersonate:"Impersonate","perf-monitor-modal":"Bench"};function $o(e,t){return e&&Fo[e]?Fo[e]:t}i($o,"dialAccessibilityLabel");import{getDialLayout as Fi,getAllIconPositions as $i,getGridLineRotations as ji,getIconStaggerInputRange as Ni,MAX_DIAL_SLOTS as Qe,DIAL_ICON_SIZE as _i,dialAnimationConfig as jo,getDialCSSKeyframesString as Hi,getDialCSSAnimationStyles as Wi,dialColors as j,dialStyles as x,withAlpha as No,floatingToolsColors as Ui}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as _o,monoFont as Ft,ToolBackground as Ki,useToolBackground as Vi}from"@buoy-gg/shared-ui/web";import{memo as Gi}from"react";import{RasterLayer as qi,scatter as Yi,useLoop as Ji,withBgAlpha as Xi}from"@buoy-gg/shared-ui/web";import{Fragment as Qi,jsx as Ze}from"react/jsx-runtime";var Zi=.94,ea=6,ta=2400,yt=3,Ho=16,oa=Array.from({length:yt},(e,t)=>Yi(22343^t*40503,Ho*4)),Wo=["#FFFFFF","#B3D9FF","#8CB3FF"],Uo=Math.PI/3,Ko=14*Math.PI/180;function Vo(e){let t=Math.min(5,Math.floor(e*6)),o=e*6-t;return t*Uo+Ko/2+o*(Uo-Ko)}i(Vo,"spokeClearAngle");function Go(e){return Math.min(ea,1/(1-e*Zi))}i(Go,"scaleAt");function qo(e){let t=.15+.85*e*e;return e<.06?t*=e/.06:e>.94&&(t*=(1-e)/.06),Math.min(.7,t)}i(qo,"opacityAt");function Yo(e){let t=e/yt,o=[],r=12;for(let d=0;d<=r;d++)o.push(d/r);let n=(1-t)%1;n>.001&&n<1-.001&&o.push(n-1e-4,n+1e-4),o.sort((d,u)=>d-u);let s=[],l=[],c=[];for(let d of o){let u=t===0&&d===1?1:(d+t)%1;s.push(d),l.push(Go(u)),c.push(qo(u))}return{input:s,scale:l,opacity:c}}i(Yo,"shellStops");var na=Array.from({length:yt},(e,t)=>Yo(t)),ra=Gi(i(function({size:e}){let t=Ji(ta),o=e/2,r=[];for(let n=0;n<yt;n++){let s=oa[n],l=na[n],c=[];for(let d=0;d<Ho;d++){let u=Vo(s[d*4]),m=(.15+.85*Math.sqrt(s[d*4+1]))*.5*o,S=Wo[Math.floor(s[d*4+3]*Wo.length)%3],h=o+Math.cos(u)*m,B=o+Math.sin(u)*m,I=.6,R=I*2.4;c.push(Ze(_,{style:{position:"absolute",left:h-R/2,top:B-R/2,width:R,height:R,borderRadius:R/2,backgroundColor:Xi(S,.3)}},`${d}-h`),Ze(_,{style:{position:"absolute",left:h-I/2,top:B-I/2,width:I,height:I,borderRadius:I/2,backgroundColor:S}},d))}r.push(Ze(Me.View,{style:{position:"absolute",left:0,top:0,width:e,height:e,opacity:t.interpolate({inputRange:l.input,outputRange:l.opacity}),transform:[{scale:t.interpolate({inputRange:l.input,outputRange:l.scale})}]},pointerEvents:"none",children:Ze(qi,{style:{width:e,height:e},raster:false,children:c})},n))}return Ze(Qi,{children:r})},"DialHyperspace"));import{useEffect as ia,useState as Jo}from"react";import{dialColors as We,withAlpha as Xo}from"@buoy-gg/floating-tools-react/web";import{ARROW_BOTTOM_OFFSET as aa,ARROW_HEIGHT as sa,SPACING_GAP as Jl,getScreenCenterY as Xl,calculateTooltipPosition as la,calculateTargetPosition as Ql}from"@buoy-gg/shared-ui/web/floating";import{monoFont as Qo}from"@buoy-gg/shared-ui/web";import{jsx as Ue,jsxs as Zo}from"react/jsx-runtime";var en=false;function tn(){if(en||typeof document>"u")return;let e=document.createElement("style");e.textContent=`
|
|
2
2
|
@keyframes buoyOnboardPulse {
|
|
3
3
|
0%, 100% { transform: scale(1); }
|
|
4
4
|
50% { transform: scale(1.02); }
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
0%, 100% { transform: translateY(0); }
|
|
8
8
|
50% { transform: translateY(-8px); }
|
|
9
9
|
}
|
|
10
|
-
`,document.head.appendChild(e),en=true}r(tn,"injectOnboardingKeyframes");var $t=We.accent;function jt({title:e,message:t,onDismiss:o,showArrow:i=true}){let[n,s]=Yo(false),[l,c]=Yo(false);ra(()=>{tn();let u=requestAnimationFrame(()=>s(true));return()=>cancelAnimationFrame(u)},[]);let d={fontFamily:Qo,textTransform:"uppercase"};return Ue("div",{style:{position:"fixed",left:"50%",bottom:la(),transform:`translateX(-50%) scale(${n?1:.8})`,opacity:n?1:0,transition:"transform 300ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 300ms ease",zIndex:10002,pointerEvents:"auto"},children:Zo("div",{style:{position:"relative",animation:n?"buoyOnboardPulse 3s ease-in-out infinite":"none"},children:[Ue("div",{style:{position:"absolute",inset:-4,borderRadius:18,backgroundColor:"#FFFFFF",opacity:.06}}),Zo("div",{style:{position:"relative",maxWidth:280,backgroundColor:We.dialBackground,borderRadius:16,border:`1px solid ${We.dialBorder}`,padding:20,boxShadow:`0 0 20px ${Xo(We.dialShadow,.6)}`,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[Ue("span",{style:{...d,fontSize:16,fontWeight:900,letterSpacing:1,color:$t,textAlign:"center"},children:e}),Ue("span",{style:{fontFamily:Qo,fontSize:13,lineHeight:"20px",color:We.centerText,textAlign:"center"},children:t}),Ue("button",{onClick:o,onPointerDown:()=>c(true),onPointerUp:()=>c(false),onPointerLeave:()=>c(false),onPointerCancel:()=>c(false),style:{...d,marginTop:8,borderRadius:8,border:"none",backgroundColor:$t,padding:"10px 24px",fontSize:14,fontWeight:900,letterSpacing:1.5,color:"#000000",cursor:"pointer",opacity:l?.7:1,transform:l?"scale(0.96)":"scale(1)",transition:"transform 100ms ease, opacity 100ms ease"},children:"Got it!"})]}),i&&Ue("div",{style:{position:"absolute",left:"50%",bottom:aa,marginLeft:-12,width:0,height:0,borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:`${sa}px solid ${$t}`,filter:`drop-shadow(0 0 10px ${Xo(We.dialShadow,.5)})`,animation:n?"buoyOnboardArrowBounce 1.6s ease-in-out infinite":"none"}})]})})}r(jt,"OnboardingTooltip");import{Fragment as ca,jsx as P,jsxs as we}from"react/jsx-runtime";var da={x:.5,y:.5},on="@react_buoy_settings_tooltip_shown",nn=false;function rn(){if(nn||typeof document>"u")return;let e=document.createElement("style");e.textContent=_r(),document.head.appendChild(e),nn=true}r(rn,"injectKeyframes");var Ke=r(e=>1-Math.pow(1-e,3),"easeOutCubic"),Nt=r(e=>e*e*e,"easeInCubic");function an({icon:e,index:t,totalIcons:o,position:i,progress:n,onPress:s}){let[l,c]=te(false),[d,u]=te(false),g=!e.icon&&e.id.startsWith("empty-"),S=!g&&e.unavailable===true,h=!g&&!S,{icons:B}=jo,I=Nr(t,o),R=0;n<=I[1]?R=0:n<=I[2]?R=(n-I[1])/(I[2]-I[1]):R=1,R=Math.max(0,Math.min(1,R));let L=Hr,D=B.pressIn.scale,E=R*(d?D:l?1.1:1),z=0;R<=0?z=0:R<=.3?z=R:z=.3+(R-.3)*(.7/.7);let v=i.x*(R-1),C=i.y*(R-1);return P("button",{role:"menuitem","aria-label":g?"Empty slot":$o(e.id,e.name),"data-testid":e.id?`buoy-dial-${e.id}`:void 0,"aria-disabled":!h,tabIndex:h?0:-1,onClick:h?s:void 0,onPointerEnter:F=>h&&F.pointerType==="mouse"&&c(true),onPointerLeave:()=>{c(false),u(false)},onPointerDown:()=>h&&u(true),onPointerUp:()=>u(false),onPointerCancel:()=>u(false),style:{position:"absolute",left:`calc(50% + ${i.x}px)`,top:`calc(50% + ${i.y}px)`,width:L,height:L,marginLeft:-L/2,marginTop:-L/2,cursor:h?"pointer":"default",background:"none",border:"none",padding:0},children:P("span",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",transform:`translate(${v}px, ${C}px) scale(${E})`,opacity:z,transition:l||d?"transform 100ms ease":"none"},children:g?P("div",{style:{width:w.emptySlot.dotSize,height:w.emptySlot.dotSize,borderRadius:w.emptySlot.dotSize/2,backgroundColor:j.emptyDotBackground,border:`${w.emptySlot.borderWidth}px solid ${j.emptyDotBorder}`}}):we(ca,{children:[P("div",{style:{position:"absolute",width:`${w.icon.gradientBgSizePercent}%`,height:`${w.icon.gradientBgSizePercent}%`,borderRadius:w.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:w.icon.gradientBgOpacity}}),P("div",{style:{position:"absolute",width:`${w.icon.innerGlowSizePercent}%`,height:`${w.icon.innerGlowSizePercent}%`,borderRadius:w.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:w.icon.innerGlowOpacity}}),P("div",{style:{marginBottom:w.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:l?"brightness(1.2)":"none"},children:e.icon}),P("span",{style:{fontSize:e.name.length>8?Math.max(w.icon.label.fontSize*.7,w.icon.label.fontSize*8/e.name.length):w.icon.label.fontSize,fontWeight:w.icon.label.fontWeight,fontFamily:w.icon.label.fontFamily,color:j.iconLabel,letterSpacing:w.icon.label.letterSpacing,marginTop:w.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:e.name}),S&&P("span",{style:{fontSize:w.icon.label.fontSize-1,fontWeight:w.icon.label.fontWeight,fontFamily:w.icon.label.fontFamily,letterSpacing:w.icon.label.letterSpacing,color:Ur.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})})}r(an,"DialIconItem");function Ht({side:e,color:t}){return P("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(e==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]]).map(([o,i,n,s],l)=>P("line",{x1:o,y1:i,x2:n,y2:s,stroke:t,strokeWidth:2},l))})}r(Ht,"PagerChevron");function _t({side:e,disabled:t,onClick:o}){let[i,n]=te(false),s=t?j.emptyDotBorder:j.accent;return we("button",{type:"button","aria-label":`${e==="prev"?"Previous":"Next"} dial page`,"data-testid":`buoy-dial-${e}`,disabled:t,onClick:o,onPointerDown:()=>!t&&n(true),onPointerUp:()=>n(false),onPointerLeave:()=>n(false),onPointerCancel:()=>n(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${j.dialBorder}`,backgroundColor:j.dialBackground,color:t?j.iconLabelMuted:j.centerText,fontSize:12,fontWeight:900,fontFamily:Ft,letterSpacing:1.5,textTransform:"uppercase",cursor:t?"default":"pointer",opacity:t?.4:1,boxShadow:t?"none":`0 0 8px ${No(j.dialShadow,.4)}`,transform:i?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[e==="prev"&&P(Ht,{side:"prev",color:s}),e==="prev"?"PREV":"NEXT",e==="next"&&P(Ht,{side:"next",color:s})]})}r(_t,"PagerButton");function Wt({icons:e,onClose:t,centerLabel:o="MENU",onCenterPress:i,settingsOpen:n=false,hintsDisabled:s=false,emptyNote:l}){let{id:c}=Vr(),[d,u]=te(0),[g,S]=te(0),[h,B]=te(0),[I,R]=te(0),[L,D]=te(0),[E,z]=te(1),[v,C]=te(false),[F,M]=te(false),[T,ee]=te(false),V=ft(null),K=ft(null),J=ft(null),q=ft(false),{entrance:ne,exit:Z,interaction:ue}=jo,xe=Wr(),[be,ie]=te(()=>({width:window.innerWidth,height:window.innerHeight}));Ee(()=>{let O=r(()=>ie({width:window.innerWidth,height:window.innerHeight}),"resize");return window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);let W=gt(()=>Fr({screenWidth:be.width,maxCircleSize:Math.max(120,Math.min(320,be.height-96))}),[be]),me=gt(()=>jr(),[]),Re=gt(()=>$r(Qe,W.iconRadius),[W.iconRadius]),[Te,$e]=te(0),pe=Math.max(1,Math.ceil(e.length/Qe)),oe=Math.min(Te,pe-1),Ie=gt(()=>{let O=oe*Qe,a=[...e.slice(O,O+Qe)];for(;a.length<Qe;)a.push({id:`empty-${a.length}`,name:"",icon:null,onPress:r(()=>{},"onPress")});return a},[e,oe]);Ee(()=>{rn()},[]),Ee(()=>{let O=ne.backdrop.duration,a=ne.dial.rotation.duration,x=ne.centerButton.delay,A=ne.icons.delay,_=ne.icons.duration,G=performance.now(),Y=r(m=>{let f=m-G;u(Math.min(1,f/O));let k=Math.min(1,f/400),X=Ke(k)*1.1;k>.7&&(X-=(k-.7)*.33),k>=1&&(X=1),S(Math.max(0,Math.min(1.05,X)));let se=Math.min(1,f/a);if(B(Ke(se)*360),f>=x){let Se=Math.min(1,(f-x)/300),Ot=Ke(Se)*1.15;Se>.6&&(Ot-=(Se-.6)*.375),Se>=1&&(Ot=1),R(Math.max(0,Math.min(1.05,Ot)))}if(f>=A){let Se=Math.min(1,(f-A)/_);D(Ke(Se))}let Xe=A+_;f<Xe?J.current=requestAnimationFrame(Y):(u(1),S(1),B(360),R(1),D(1),ee(true))},"animate");return J.current=requestAnimationFrame(Y),()=>{J.current&&cancelAnimationFrame(J.current)}},[]);let ge=ht(()=>{if(q.current)return;q.current=true,M(true),J.current&&cancelAnimationFrame(J.current);let O=performance.now(),a=Z.icons.duration,x=Z.centerButton.duration,A=Z.dialScale.duration,_=Math.max(x,A),G=Z.backdrop.duration,Y=r(m=>{let f=m-O;if(f<a){let se=Nt(f/a);D(1-se),J.current=requestAnimationFrame(Y);return}let k=a;if(f<k+_){D(0);let se=Math.min(1,(f-k)/x),Xe=Math.min(1,(f-k)/A);R(1-Nt(se)),S(1-Nt(Xe)),J.current=requestAnimationFrame(Y);return}let X=k+_;if(f<X+G){S(0),R(0);let se=(f-X)/G;u(1-se),J.current=requestAnimationFrame(Y);return}u(0),t()},"animate");J.current=requestAnimationFrame(Y)},[Z,t]);Ee(()=>{let O=document.activeElement,a=V.current;return()=>{O?.isConnected&&(document.activeElement===document.body||a?.contains(document.activeElement))&&O.focus()}},[]),Ee(()=>{if(n)return;K.current?.focus();let O=r(a=>{let x=V.current;if(x){if(a.key==="Escape")a.preventDefault(),ge();else if(a.key==="Tab"){let A=Array.from(x.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(Y=>Y.getClientRects().length>0),_=A[0],G=A[A.length-1];(!x.contains(document.activeElement)||(a.shiftKey?document.activeElement===_:document.activeElement===G))&&(a.preventDefault(),(a.shiftKey?G:_)?.focus())}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(a.key)){let A=Array.from(x.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),_=A.indexOf(document.activeElement);if(_<0||!A.length)return;a.preventDefault();let G=a.key==="Home"?0:a.key==="End"?A.length-1:(_+(a.key==="ArrowRight"||a.key==="ArrowDown"?1:-1)+A.length)%A.length;A[G].focus()}}},"handleKeyDown");return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[ge,n]);let[ae,Ce]=te(false);Ee(()=>{if(s)return;let O=false,a=setTimeout(async()=>{let x=await Ho.getItem(on);!O&&!x&&Ce(true)},1200);return()=>{O=true,clearTimeout(a)}},[s]);let ke=ht(()=>{Ce(false),Ho.setItem(on,"true")},[]);Ee(()=>{n&&ae&&ke()},[n,ae,ke]);let Ye=ht(O=>{if(O.id.startsWith("empty-")||q.current)return;let[a,x]=ue.iconSelect.pulse,A=performance.now(),_=150,G=r(Y=>{let m=Y-A;if(m<_){let f=Ke(m/_);z(1-(1-a.scale)*f),requestAnimationFrame(G)}else if(m<_*2){let f=Ke((m-_)/_);z(a.scale+(x.scale-a.scale)*f),requestAnimationFrame(G)}else z(1)},"animatePulse");requestAnimationFrame(G),setTimeout(()=>{O.onPress(),ge()},ue.iconSelect.actionDelay)},[ue.iconSelect,ge]),je=ht(O=>{if(q.current)return;let a=Math.max(0,Math.min(O,pe-1));a!==oe&&$e(a)},[pe,oe]),ve=W.buttonSize*w.centerButton.containerRatio,Me=W.buttonSize*w.centerButton.borderRatio,fe=W.buttonSize*w.centerButton.containerRatio/2+6,ze=T&&!F;return we("div",{ref:V,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[P("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:ge,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:j.dialBackdrop,opacity:d}}),l?P("div",{role:"status","data-testid":"buoy-dial-empty-note",style:{position:"absolute",left:16,right:16,bottom:80+W.circleSize+16,color:j.iconLabel,fontSize:12,fontFamily:Ft,textAlign:"center",opacity:g>.01?1:0},children:l}):null,we("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,bottom:80,width:W.circleSize,height:W.circleSize,borderRadius:"50%",backgroundColor:j.dialBackground,border:`${w.circle.borderWidth}px solid ${j.dialBorder}`,boxShadow:`0 0 ${w.circle.shadowRadius}px ${No(j.dialShadow,w.circle.shadowOpacity)}`,transform:`scale(${g}) rotate(${h}deg)`,opacity:g>.01?1:0,overflow:"hidden"},children:[P("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:j.dialGradient1,opacity:w.gradientLayers[0].opacity}}),P("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:j.dialGradient2,opacity:w.gradientLayers[1].opacity}}),P("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:j.dialGradient3,opacity:w.gradientLayers[2].opacity}}),me.map(O=>P("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:w.grid.lineHeight,transform:`rotate(${O}deg)`,transformOrigin:"center"},children:["left","right"].map(a=>P("div",{style:{position:"absolute",top:0,[a]:0,width:`calc(50% - ${fe}px)`,height:w.grid.lineHeight,backgroundColor:j.dialGridLine}},a))},O)),P("div",{"data-testid":"dial-background","data-background":c,style:{position:"absolute",inset:0,pointerEvents:"none"},children:c==="hyperspace"?P(ia,{size:W.circleSize}):P(Kr,{focus:da})}),Ie.map((O,a)=>P(an,{icon:O,index:a,totalIcons:Ie.length,position:Re[a],progress:L,onPress:()=>Ye(O)},a)),we("div",{style:{position:"absolute",left:"50%",top:"50%",width:ve,height:ve,marginLeft:-ve/2,marginTop:-ve/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:j.hubHalo,borderRadius:W.buttonSize,overflow:"hidden",transform:`scale(${I*E})`,opacity:I>.01?1:0},children:[P("div",{style:{position:"absolute",inset:0,backgroundColor:j.dialGradient1,opacity:.5,borderRadius:W.buttonSize}}),P("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:j.dialGradient2,opacity:.3,borderRadius:W.buttonSize}}),P("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:j.dialGradient3,opacity:.2,borderRadius:W.buttonSize}}),P("div",{style:{width:Me,height:Me,borderRadius:W.buttonSize*w.centerButton.borderRadiusRatio,backgroundColor:j.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:P("button",{ref:K,type:"button","aria-label":n?"Close Settings":"Open Dev Tools Settings",disabled:!i,onClick:i,onPointerEnter:O=>O.pointerType==="mouse"&&C(true),onPointerLeave:()=>C(false),style:{border:0,padding:0,background:"transparent",width:W.buttonSize,height:W.buttonSize,borderRadius:W.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:i?"pointer":"default",transform:v?`scale(${ue.centerHover.scale})`:"scale(1)",transition:`transform ${ue.centerHover.duration}ms ease`,animation:ze&&!v?xe.pulse:"none"},children:n?we("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:w.centerButton.text.fontSize-2,fontWeight:w.centerButton.text.fontWeight,fontFamily:w.centerButton.text.fontFamily,color:j.centerText,letterSpacing:w.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[P("span",{style:{marginBottom:-2},children:"CLOSE"}),P("span",{style:{marginTop:-2},children:"SETTINGS"})]}):P("span",{style:{fontSize:w.centerButton.text.fontSize,fontWeight:w.centerButton.text.fontWeight,fontFamily:w.centerButton.text.fontFamily,color:j.centerText,letterSpacing:w.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase"},children:o})})})]})]}),pe>1&&we("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,top:"calc(100% - 64px)",width:W.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,g),transform:`scale(${Math.min(1,g)})`},children:[P(_t,{side:"prev",disabled:oe<=0,onClick:()=>je(oe-1)}),we("span",{"data-testid":"buoy-dial-page",style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:Ft,letterSpacing:2,color:j.centerText,textShadow:`0 0 6px ${j.centerTextGlow}`},children:[String(oe+1).padStart(2,"0"),we("span",{style:{color:j.iconLabelMuted,textShadow:"none"},children:[" / ",String(pe).padStart(2,"0")]})]}),P(_t,{side:"next",disabled:oe>=pe-1,onClick:()=>je(oe+1)})]}),ae&&!n&&P(jt,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:ke,showArrow:false})]})}r(Wt,"DialMenu");import{persistentStorage as sn,devToolsStorageKeys as ua}from"@buoy-gg/shared-ui/web";import{recordUsage as pa,pruneUsage as ma}from"@buoy-gg/floating-tools-core/web";var ln=ua.dial.usage(),Ve={},cn=false,Ut=null;function Kt(){return Ut||(Ut=(async()=>{try{let e=await sn.getItem(ln);if(e){let t=JSON.parse(e);t&&typeof t=="object"&&(Ve=t)}}catch{}finally{cn=true}})(),Ut)}r(Kt,"loadDialUsage");Kt();function dn(e){return e.map((t,o)=>({id:t,index:o,lastUsed:Ve[t]?.lastUsed??0})).sort((t,o)=>o.lastUsed-t.lastUsed||t.index-o.index).map(({id:t})=>t)}r(dn,"getRankedToolIds");async function un(e){if(!e)return;cn||await Kt();let t=Math.max(Date.now(),...Object.values(Ve).map(o=>o.lastUsed+1));Ve=ma(pa(Ve,e,t),t);try{await sn.setItem(ln,JSON.stringify(Ve))}catch{}}r(un,"recordToolUsage");import{useCallback as ga,useMemo as pn}from"react";import{persistentStorage as fa}from"@buoy-gg/shared-ui/web";import{useState as re,useEffect as Ae,useCallback as bt,useMemo as vt}from"react";import{settingsEventBus as St}from"@buoy-gg/floating-tools-core/web";import{useSyncExternalStore as ha}from"react";import{getRegisteredToolModule as ya}from"@buoy-gg/shared-ui/web";var ba=r(()=>()=>{},"noopSubscribe"),va=r(()=>null,"serverSnapshot");function mn(){let e=ya("@buoy-gg/external-sync");return ha(e?.subscribeSyncStatus??ba,()=>e?.getSyncStatus?.()??null,va)}r(mn,"useDesktopSyncStatus");import{SentryIcon as Sa,WifiCircuitIcon as wa,ImageOverlayIcon as xa,RenderCountIcon as Ta,Info as Vt,Layers as Ia,ChevronRightIcon as gn,ChevronDown as fn,getStorageBackendType as Ca,getUseLicense as ka,signOutOfBuoy as za,persistentStorage as Pe,Trash2 as Aa,CheckCircle2 as hn,BuoyUpgradeSheet as Ba,BackgroundSwitcher as Ra,night as b,NightCard as Le,NightRows as qt,NightSectionLabel as Ma,NightFootnote as yn,NightSwitch as bn,NightButton as Gt,NightSegmented as Da,NightBadge as ye,NightSeparator as Oa,monoFont as vn}from"@buoy-gg/shared-ui/web";import{EnvIcon as Sn,StorageIcon as Ea,RoutesIcon as Pa,NetworkIcon as La,QueryIcon as Fa,HighlighterIcon as $a,ReduxIcon as ja,EventsIcon as Na}from"@buoy-gg/floating-tools-core/web";import Ha,{createContext as _a,useContext as Wa}from"react";import{jsx as Ua}from"react/jsx-runtime";var wn=_a({});function Jt({children:e,defaultFloatingTools:t,defaultDialTools:o}){let i=Ha.useMemo(()=>({defaultFloatingTools:t,defaultDialTools:o}),[t,o]);return Ua(wn.Provider,{value:i,children:e})}r(Jt,"DefaultConfigProvider");function Yt(){return Wa(wn)}r(Yt,"useDefaultConfig");import Ka from"react";import{toolTheme as Va}from"@buoy-gg/shared-ui/web";import{jsx as xn}from"react/jsx-runtime";function Tn({label:e,size:t,color:o=Va.colors.text}){let i=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1),n=i<=2?t:t*1.6,s=Math.max(7,Math.min(t*(i===1?.7:.62),n/(.62*i)));return xn("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:s,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}r(Tn,"AppTextIcon");function Xt(e,t){return e==null?e:typeof e=="function"?Ka.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions}):typeof e=="string"||typeof e=="number"?xn(Tn,{label:String(e),size:t.size,color:t.color}):e}r(Xt,"renderAppIcon");import{JsModal as qa,devToolsStorageKeys as Qt,onSettingsApplied as Ga,expandableWindowControlsSupported as Ja}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as Ya}from"@buoy-gg/shared-ui/web";import{Fragment as et,jsx as p,jsxs as N}from"react/jsx-runtime";var qe="@react_buoy_dev_tools_settings",Xa=6,wt=r(e=>{let t=Xa,o={};for(let[i,n]of Object.entries(e))n&&t>0?(o[i]=true,t-=1):o[i]=false;return o},"enforceDialLimit"),Qa=r((e,t)=>{let{userStatus:o,environment:i,...n}=e,s=t?Object.entries(n).filter(([l])=>t.includes(l)):Object.entries(n);return{...Object.fromEntries(s),environment:i??false}},"sanitizeFloating"),In=r((e,t,o)=>{if(!t)return e;let i={...e.dialTools,...t.dialTools??{}},n=o?.allowedDialKeys?Object.entries(i).filter(([s])=>o.allowedDialKeys?.includes(s)):Object.entries(i);return{dialTools:wt(Object.fromEntries(n)),floatingTools:Qa({...e.floatingTools,...t.floatingTools??{}},o?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...t.globalSettings??{}}}},"mergeWithDefaults"),Za=r((e=[],t,o)=>{let i={},n={},s=new Set(t??[]),l=new Set(o??[]),c=!o||o.length===0;for(let d of e){let{id:u,slot:g="both"}=d;(g==="dial"||g==="both")&&(i[u]=c?true:l.has(u)),(g==="row"||g==="both")&&(n[u]=s.has(u))}return{dialTools:wt(i),floatingTools:{...n,environment:s.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}},"generateDefaultSettings"),es=r(({visible:e,onClose:t,onSettingsChange:o,initialSettings:i,availableApps:n=[],storage:s=Pe,zIndex:l})=>{let{defaultFloatingTools:c,defaultDialTools:d}=Yt(),u=vt(()=>Za(n,c,d),[n,c,d]),g=vt(()=>Object.keys(u.dialTools),[u]),S=vt(()=>Object.keys(u.floatingTools).filter(m=>m!=="environment"),[u]),[h,B]=re(i||tt||u),[I,R]=re(Zt??"floating"),[L,D]=re(Zt!==null),[E,z]=re(new Set),[v,C]=re(false),[F,M]=re(false);Ae(()=>{let m=requestAnimationFrame(()=>M(true));return()=>cancelAnimationFrame(m)},[]);let T=mn();Ae(()=>{r(async()=>{try{let m=await Pe.getItem(Qt.settings.activeTab());if(m&&["floating","settings","pro"].includes(m)){let f=m;Zt=f,R(k=>k===f?k:f)}}catch{}finally{D(true)}},"loadActiveTab")()},[]),Ae(()=>{L&&Pe.setItem(Qt.settings.activeTab(),I).catch(m=>{console.warn("[Buoy]","Failed to save settings active tab:",m)})},[I,L]);let ee=ka()?.(),V=ee?.isPro??false,K=!V&&ee?.licenseKey?ee.error:null,J=ee?.errorKind==="transport",[q,ne]=re(Cn),[Z,ue]=re(false),[xe,be]=re(false),[ie,W]=re(false),[me,Re]=re([]),[Te,$e]=re(false),pe=Ya(),oe=Co.get("window").height,Ie=Co.get("window").width,ge=Math.floor(oe*.33),ae=Math.min(Ie-32,400),Ce=bt(async()=>{try{let m=await s.getItem(qe);if(m){let f=JSON.parse(m),k=In(u,f,{allowedDialKeys:g,allowedFloatingKeys:S});tt=k,B(X=>kn(X,k)?X:k);return}tt=u,B(f=>kn(f,u)?f:u)}catch(m){console.error("[Buoy]","Failed to load dev tools settings:",m),B(u)}},[u,g,S,s]);Ae(()=>{Ce()},[Ce]),Ae(()=>{Ca().then(m=>{Cn=m,ne(f=>f===m?f:m)})},[]),Ae(()=>{ie&&($e(true),Pe.getAllKeys().then(m=>{Re(m.sort())}).catch(()=>{Re([])}).finally(()=>{$e(false)}))},[ie]);let ke=r(async m=>{try{let f=null;try{let X=await s?.getItem(qe);f=X?JSON.parse(X):null}catch{}let k={...m,dialTools:{...f?.dialTools,...wt(m.dialTools)},floatingTools:{...f?.floatingTools,...m.floatingTools}};await s.setItem(qe,JSON.stringify(k)),tt=k,B(k),o?.(k),St.emit(k)}catch(f){console.error("[Buoy]","Failed to save dev tools settings:",f)}},"saveSettings"),Ye=r(m=>{let f={...h,floatingTools:{...h.floatingTools,[m]:!h.floatingTools[m]}};ke(f)},"toggleFloatingTool"),je=r(m=>{let f={...h,globalSettings:{...h.globalSettings,[m]:!h.globalSettings?.[m]}};ke(f)},"toggleGlobalSetting"),ve=r(async()=>{ue(true),be(false);try{await Pe.clear(),be(true),B(u),s!==Pe&&await s.setItem(qe,JSON.stringify(u)),o?.(u),St.emit(u),setTimeout(()=>be(false),2e3)}catch(m){console.error("[Buoy]","Failed to clear storage:",m)}finally{ue(false)}},"handleClearStorage"),Me=bt(m=>{},[]),fe=r(m=>{let f=n.find(k=>k.id===m);return f?.description?f.description:m==="environment"?"Environment badge.":""},"getToolDescription"),ze=r(m=>m==="environment"?"Env Badge":n.find(f=>f.id===m)?.name??m.toUpperCase().replace(/_/g," "),"getToolLabel"),O=r(m=>{if(!F)return null;switch(m){case"query":return p(Fa,{size:18});case"env":return p(Sn,{size:18});case"sentry":return p(Sa,{size:18,color:"#9945FF"});case"storage":return p(Ea,{size:18,bgColor:b.color.surface});case"wifi":case"query-wifi-toggle":return p(wa,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return p(Pa,{size:18,bgColor:b.color.surface});case"network":return p(La,{size:18});case"environment":return p(Sn,{size:18});case"debug-borders":return p(Ia,{size:18,color:b.color.accent});case"highlight-updates":return p(Ta,{size:18,color:b.color.accent});case"highlight-updates-modal":return p($a,{size:18});case"redux":return p(ja,{size:18});case"image-overlay":return p(xa,{size:18});case"events":return p(Na,{size:18});case"zustand":try{let{ZustandIcon:f}=ko("@buoy-gg/zustand/web");return p(f,{size:18})}catch{return p(Vt,{size:18,color:b.color.textSecondary})}case"jotai":try{let{JotaiIcon:f}=ko("@buoy-gg/jotai/web");return p(f,{size:18})}catch{return p(Vt,{size:18,color:b.color.textSecondary})}default:{let f=n.find(k=>k.id===m);return f?.icon!=null?Xt(f.icon,{slot:"row",size:18,color:f.color}):p(Vt,{size:18,color:b.color.textSecondary})}}},"getToolIcon"),a=r((m,f,k,X)=>{let se=fe(m);return N(dt,{activeOpacity:k?1:.7,onPress:()=>!k&&X(),accessibilityLabel:ze(m),accessibilityRole:"button",style:[y.toolRow,k&&y.rowDisabled],children:[p(H,{style:y.toolIconSlot,children:O(m)}),N(H,{style:y.rowInfo,children:[N(U,{style:y.rowLabel,children:[ze(m),k?" \xB7 max 6":""]}),se?p(U,{style:y.rowCaption,numberOfLines:1,children:se}):null]}),p(bn,{value:f,disabled:k,onValueChange:()=>X(),accessibilityLabel:ze(m)})]},m)},"renderToolRow"),x=r(m=>{z(f=>{let k=new Set(f);return k.has(m)?k.delete(m):k.add(m),k})},"toggleSettingExpanded"),A=r((m,f,k,X,se)=>{let Xe=h.globalSettings?.[m]??false,Se=E.has(m);return N(H,{children:[N(dt,{activeOpacity:.7,onPress:()=>x(m),accessibilityLabel:f,style:y.settingRow,children:[N(H,{style:y.rowInfo,children:[p(U,{style:y.rowLabel,children:f}),p(U,{style:y.rowCaption,numberOfLines:Se?0:1,children:k})]}),p(bn,{value:Xe,onValueChange:()=>je(m),accessibilityLabel:f})]}),Se&&N(H,{style:y.settingRowBody,children:[p(U,{style:y.settingRowBodyText,children:X}),p(U,{style:y.settingRowBodyHint,children:se})]})]},m)},"renderGlobalSettingRow"),_=r((m,f,k)=>N(H,{children:[p(Ma,{children:m}),f,k]}),"renderSection"),G=q==="filesystem"?p(ye,{label:"File System",tone:"accent"}):q==="asyncstorage"?p(ye,{label:"Async Storage",tone:"warning"}):q==="localstorage"?p(ye,{label:"Local Storage",tone:"accent"}):q==="memory"?p(ye,{label:"Memory",tone:"danger"}):p(ye,{label:"Loading\u2026",tone:"neutral"}),Y=r(()=>N(H,{style:y.container,children:[N(Io,{style:y.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:y.scrollContainer,children:[I==="floating"&&p(et,{children:_("Floating Tools",p(Le,{glass:true,children:p(qt,{children:Object.entries(h.floatingTools).map(([m,f])=>a(m,f,false,()=>Ye(m)))})}),p(yn,{children:"Tools switched on here appear in the floating bubble row."}))}),I==="settings"&&N(et,{children:[_("Background",p(Le,{glass:true,padded:true,children:p(Ra,{embedded:true})})),_("Storage",N(Le,{glass:true,children:[N(dt,{activeOpacity:.7,onPress:()=>W(!ie),accessibilityLabel:"Storage Type",style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"Storage Type"})}),G,ie?p(fn,{size:16,color:b.color.textTertiary}):p(gn,{size:16,color:b.color.textTertiary})]}),ie&&N(et,{children:[N(H,{style:y.settingRowBody,children:[p(U,{style:y.settingRowBodyText,children:q==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":q==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":q==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":q==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),q==="asyncstorage"&&p(U,{style:[y.settingRowBodyText,y.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),q==="memory"&&p(U,{style:[y.settingRowBodyText,y.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),p(Oa,{}),N(H,{style:y.storageExpanded,children:[N(H,{style:y.storageExpandedHeader,children:[p(U,{style:y.storageExpandedTitle,children:"SAVED SETTINGS"}),p(U,{style:y.storageExpandedCount,children:Te?"\u2026":`${me.length} keys`})]}),Te?p(U,{style:y.storageKeyEmpty,children:"Loading\u2026"}):me.length===0?p(U,{style:y.storageKeyEmpty,children:"No settings saved yet"}):p(Io,{style:y.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:me.map(m=>p(H,{style:y.storageKeyItem,children:p(U,{style:y.storageKeyText,numberOfLines:1,children:m.replace("@react_buoy_","")})},m))})]}),p(H,{style:y.cardButtonWrap,children:p(Gt,{label:xe?"Cleared":Z?"Clearing\u2026":"Clear All Settings",variant:xe?"secondary":"destructive",size:"md",disabled:Z,onPress:ve,icon:xe?p(hn,{size:15,color:b.color.accent}):p(Aa,{size:15,color:Z?b.color.textTertiary:b.color.danger})})})]})]})),T&&T.state!=="idle"&&_("Desktop Sync",N(Le,{glass:true,children:[N(dt,{activeOpacity:.7,onPress:()=>x("desktopSync"),accessibilityLabel:"Buoy Desktop",style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"Buoy Desktop"})}),T.state==="connected"?p(ye,{label:"Connected",tone:"accent"}):T.state==="connecting"?p(ye,{label:"Connecting\u2026",tone:"neutral"}):p(ye,{label:"Retrying",tone:"warning"}),E.has("desktopSync")?p(fn,{size:16,color:b.color.textTertiary}):p(gn,{size:16,color:b.color.textTertiary})]}),E.has("desktopSync")&&N(H,{style:y.settingRowBody,children:[N(U,{style:y.settingRowBodyText,children:[T.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",p(U,{style:y.footnoteMono,children:T.targetURL??"(unknown URL)"}),T.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),T.state==="retrying"&&T.lastError&&N(U,{style:[y.settingRowBodyText,y.bodyWarning],children:["Last error: ",T.lastError]})]})]})),_("Modal Behavior",p(Le,{glass:true,children:N(qt,{children:[A("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."),Ja(Ne.OS==="web")?A("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]})}))]}),I==="pro"&&N(et,{children:[_("License",N(Le,{glass:true,children:[N(H,{style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"License Status"})}),p(H,{testID:"buoy-settings-license-status",accessibilityLabel:V?"License: Active":"License: Free",children:V?p(ye,{label:"Active",tone:"accent"}):p(ye,{label:"Free",tone:"neutral"})})]}),ee?.tierSource==="session"?N(H,{style:y.settingRow,children:[p(H,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"Signed in with Buoy"})}),p(Gt,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void za(),testID:"buoy-settings-signout"})]}):null,ee?.teamRole?p(H,{style:y.settingRow,testID:"buoy-settings-team-role",children:N(H,{style:y.rowInfo,children:[N(U,{style:y.rowLabel,children:["Role: ",ee.teamRole]}),p(U,{style:y.rowCaption,children:ee.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),p(yn,{children:V?"You have full access to all Buoy DevTools features.":K?J?`Couldn't reach the license server (${K}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${K}.`:"Upgrade to Pro to unlock all features and support development."})),!V&&N(et,{children:[_("Pro Features",p(Le,{glass:true,children:p(qt,{children:["Advanced Settings","Priority Support"].map(m=>N(H,{style:y.featureRow,children:[p(hn,{size:16,color:b.color.accent}),p(U,{style:y.rowLabel,children:m})]},m))})})),p(Gt,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>C(true)})]})]})]}),p(Ba,{visible:v,onClose:()=>C(false)})]}),"renderContent");return p(qa,{visible:e,onClose:t,zIndex:l,variant:"night",header:{showToggleButton:false,customContent:p(H,{style:y.headerRow,children:p(Da,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:I,onChange:m=>R(m)})})},initialMode:"bottomSheet",onModeChange:Me,persistenceKey:Qt.settings.root(),enablePersistence:true,maxHeight:oe-pe.top,initialHeight:ge,initialFloatingPosition:{x:(Ie-ae)/2,y:pe.top+20},enableGlitchEffects:true,children:Y()})},"DevToolsSettingsModal"),ts={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}},os=r((e,t)=>{let o=new Set(e??[]),i=new Set(t??[]),n={};for(let l of i)n[l]=true;let s={environment:o.has("environment")};for(let l of o)l!=="environment"&&(s[l]=true);return{dialTools:wt(n),floatingTools:s,globalSettings:{enableSharedModalDimensions:false}}},"createDefaultsFromConfig"),tt=null,Zt=null,Cn=null,kn=r((e,t)=>JSON.stringify(e)===JSON.stringify(t),"sameSettings");St.addListener(e=>{e&&(tt=e)});var zn=r(()=>{let{defaultFloatingTools:e,defaultDialTools:t}=Yt(),o=vt(()=>!e&&!t?ts:os(e,t),[e,t]),[i,n]=re(o),s=bt(async()=>{try{let c=await Pe.getItem(qe);if(c){let d=JSON.parse(c),u=In(o,d);n(u);return}n(o)}catch(c){console.error("[Buoy]","Failed to load dev tools settings:",c),n(o)}},[o]);Ae(()=>Ga(c=>{c.includes(qe)&&s()}),[s]),Ae(()=>{s();let c=St.addListener(d=>{try{d&&n(d)}catch{}});return()=>{c()}},[s]);let l=bt(()=>{s()},[s]);return{settings:i,refreshSettings:l}},"useDevToolsSettings"),y=ct.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:b.gutter,paddingRight:b.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:b.gutter,paddingTop:8,paddingBottom:24,gap:b.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:b.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:b.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:b.color.text,fontSize:b.font.row,fontWeight:"500"},rowCaption:{color:b.color.textTertiary,fontSize:b.font.label},settingRowBody:{paddingHorizontal:b.rowPadH,paddingBottom:b.rowPadV,gap:6},settingRowBodyText:{color:b.color.textSecondary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},settingRowBodyHint:{color:b.color.textTertiary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},bodyWarning:{color:b.color.warning},bodyDanger:{color:b.color.danger},cardButtonWrap:{paddingHorizontal:b.cardPad,paddingTop:10,paddingBottom:b.cardPad},storageExpanded:{paddingHorizontal:b.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:b.color.textSecondary,fontSize:b.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:b.color.textTertiary,fontSize:b.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:b.color.glassElevated,borderRadius:b.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:b.color.textSecondary,fontSize:b.font.micro,fontFamily:vn},storageKeyEmpty:{color:b.color.textTertiary,fontSize:b.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:vn,fontSize:b.font.label,color:b.color.textSecondary}});import{jsx as An}from"react/jsx-runtime";var ns=[];function eo({visible:e,onClose:t,availableTools:o=ns,defaultFloatingTools:i,defaultDialTools:n,storage:s=fa,onSettingsChange:l}){let c=pn(()=>({getItem:r(async g=>s.getItem(g),"getItem"),setItem:r(async(g,S)=>s.setItem(g,S),"setItem")}),[s]),d=pn(()=>o.map(g=>({...g,name:g.name??g.id,icon:typeof g.icon=="function"?S=>g.icon(S.size):g.icon})),[o]),u=ga(g=>{l?.(g)},[l]);return An(Jt,{defaultFloatingTools:i,defaultDialTools:n,children:An(es,{visible:e,onClose:t,zIndex:11e3,availableApps:d,storage:c,onSettingsChange:u})})}r(eo,"SettingsModal");import{listenBuoyKeydown as is}from"@buoy-gg/shared-ui/web/floating";import{persistentStorage as Bn,setExpandableWindowControls as rs}from"@buoy-gg/shared-ui/web";import{createContext as as,useCallback as Be,useContext as ss,useEffect as xt,useMemo as ls,useRef as ot,useState as Rn}from"react";var cs=r((e,t,o)=>{if(t.singleton){let n=e.find(s=>s.id===t.id);if(n){let s=n.minimized??false;return{instanceId:n.instanceId,wasMinimized:s,apps:[...e.filter(l=>l.instanceId!==n.instanceId),{...n,minimized:false}]}}}let i=o();return{instanceId:i,wasMinimized:false,apps:[...e,{...t,instanceId:i}]}},"resolveOpenAppsState");import{createContext as ds,useCallback as Mn,useContext as us,useEffect as Tt,useMemo as ps,useRef as Dn,useState as It}from"react";import{JsModal as ms,ModalHeader as nt,HeaderSearchButton as gs,TickProvider as fs,ToolScreenHeaderContext as hs,devToolsStorageKeys as On,buoyColors as En,gameUIColors as to}from"@buoy-gg/shared-ui/web";import{jsx as le,jsxs as Ct}from"react/jsx-runtime";var it=r(()=>{},"noop"),ys={search:"",isSearchActive:false,clearSearch:it,close:it,minimize:it,showToast:it,setHeaderOverride:it},Pn=ds(null);function oo(){return us(Pn)??ys}r(oo,"useToolHost");function Ln(e,t){let{setHeaderOverride:o}=oo();Tt(()=>(o(e),()=>o(null)),t)}r(Ln,"useToolHeader");var Fn=2200,bs={success:to.success,error:to.error,info:to.info};function $n({message:e,type:t,nonce:o}){let i=Dn(new De.Value(0)).current;Tt(()=>{i.setValue(0),De.sequence([De.timing(i,{toValue:1,duration:150,useNativeDriver:true}),De.delay(Fn-450),De.timing(i,{toValue:0,duration:300,useNativeDriver:true})]).start()},[o,i]);let n=bs[t];return Ct(De.View,{pointerEvents:"none",style:[kt.toast,{opacity:i,borderColor:n+"60"}],children:[le(H,{style:[kt.toastDot,{backgroundColor:n}]}),le(U,{style:kt.toastText,numberOfLines:2,children:e})]})}r($n,"ToastView");function jn({app:e,config:t,visible:o,zIndex:i,onClose:n,onMinimize:s,initialModalState:l,enableSharedModalDimensions:c,bodyProps:d}){let u=e.component,[g,S]=It(false),[h,B]=It(""),[I,R]=It(null),[L,D]=It(null),E=Dn(null),z=Mn(()=>{S(false),B("")},[]),v=Mn((q,ne="info")=>{E.current&&clearTimeout(E.current),D(Z=>({message:q,type:ne,nonce:(Z?.nonce??0)+1})),E.current=setTimeout(()=>D(null),Fn)},[]);Tt(()=>()=>{E.current&&clearTimeout(E.current)},[]);let C=ps(()=>({search:g?h:"",isSearchActive:g,clearSearch:z,close:n,minimize:r(()=>s(),"minimize"),showToast:v,setHeaderOverride:R,instanceId:e.instanceId}),[h,g,z,n,s,v,e.instanceId]),F=I?.title??t.title??e.title??e.id,M=I?.subtitle??t.subtitle,T=I?.onBack,ee=I?.actions??t.headerActions,V=I?.searchable??t.searchable;Tt(()=>{!V&&g&&z()},[V,g,z]);let K=c?On.modal.root():On.custom(e.id).modal(),J=Ct(nt,{children:[T&&!g&&le(nt.Navigation,{onBack:T}),g?le(nt.Search,{value:h,onChangeText:B,onCancel:z,placeholder:t.searchPlaceholder,testID:`tool-search-field-${e.id}`}):le(nt.Content,{title:F,subtitle:M}),Ct(nt.Actions,{children:[!g&&ee,V&&!g&&le(gs,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>S(true)})]})]});return le(Pn.Provider,{value:C,children:le(ms,{visible:o,onClose:n,onBack:T,onMinimize:s,initialModalState:l,zIndex:i,persistenceKey:K,enablePersistence:true,initialMode:t.initialMode??"bottomSheet",header:{customContent:J,showToggleButton:true},disableScrollWrapper:true,styles:{},children:Ct(H,{style:kt.bodyRoot,children:[le(fs,{children:le(hs.Provider,{value:R,children:le(u,{...d})})}),L&&le($n,{message:L.message,type:L.type,nonce:L.nonce})]})})})}r(jn,"ToolModalShell");var kt=ct.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:En.card,borderWidth:1,borderRadius:8,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOpacity:.4,shadowRadius:8,shadowOffset:{width:0,height:2},elevation:6},toastDot:{width:6,height:6,borderRadius:3},toastText:{flex:1,fontSize:12,color:En.text}});import{useEffect as vs,useRef as Ss}from"react";import{capacitorPlatform as ws,capacitorPlugin as xs}from"@buoy-gg/license/web";function Nn(){return globalThis.__BUOY_HOLDS_BACK__===true}r(Nn,"isBuoyHoldingBackButton");var Ts=99.5;function Hn(){if(typeof document>"u")return false;let e=globalThis.Ionic;if(!e&&!document.querySelector("ion-app"))return false;try{return e?.config?.get?.("hardwareBackButton",true)!==false}catch{return true}}r(Hn,"ionicHandlesBack");function _n(e,t){let o=Ss(t);o.current=t,vs(()=>{if(!e||ws()!=="android")return;let i=globalThis;i.__BUOY_HOLDS_BACK__=true;let n;if(Hn()){let s=r(l=>{l.detail?.register?.(Ts,()=>{o.current()})},"listener");document.addEventListener("ionBackButton",s),n=r(()=>document.removeEventListener("ionBackButton",s),"cleanup")}else{let s=xs("App");if(!s?.addListener){i.__BUOY_HOLDS_BACK__=false;return}let l=false,c=null;Promise.resolve(s.addListener("backButton",()=>o.current())).then(d=>{l?d.remove():c=d}).catch(()=>{}),n=r(()=>{l=true,c&&c.remove()},"cleanup")}return()=>{n(),i.__BUOY_HOLDS_BACK__=false}},[e])}r(_n,"useCapacitorBackButton");import{Fragment as Is,jsx as ce}from"react/jsx-runtime";var Wn=as(null),Un="@react_buoy_open_apps",no=44,Cs=12,ks=100,zs=16,As=r(e=>({x:window.innerWidth-no-zs,y:window.innerHeight-ks-no-e*(no+Cs)}),"dockIconPosition"),Kn=r(({children:e})=>{let[t,o]=Rn([]),[i,n]=Rn(false),s=ot([]),l=ot(null),c=ot(false),d=ot(false),u=ot(false),g=Be(v=>{let C="";return o(F=>{let{apps:M,instanceId:T}=cs(F,v,()=>`${v.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);return C=T,M}),C},[]),S=Be(()=>{if(c.current||!d.current||!u.current)return;c.current=true;let v=l.current;if(!v||v.length===0){n(true);return}l.current=null,v.forEach(({id:C,minimized:F})=>{let M=s.current.find(T=>T.id===C);if(M&&M.component){let T=Xt(M.icon,{slot:"dial",size:20,color:M.color});g({id:M.id,title:M.name,component:M.component,props:M.props,modal:M.modal,launchMode:M.launchMode||"self-modal",singleton:M.singleton??true,icon:T,color:M.color,minimized:F})}}),n(true)},[g]);xt(()=>{let v=false;return r(async()=>{try{let C=await Bn.getItem(Un);if(v)return;if(C){let F=JSON.parse(C),M;Array.isArray(F)&&F.length>0&&(typeof F[0]=="string"?M=F.map(T=>({id:T,minimized:false})):M=F.filter(T=>typeof T=="object"&&T!==null&&typeof T.id=="string"),M.length&&(l.current=M))}}catch{}v||(d.current=true,S())},"restoreOpenApps")(),()=>{v=true}},[S]),xt(()=>{if(!i)return;let v=t.map(C=>({id:C.id,minimized:C.minimized??false}));Bn.setItem(Un,JSON.stringify(v))},[t,i]);let h=Be(v=>{s.current=v,u.current=true,S()},[S]),B=Be(v=>{o(C=>C.length?v?C.filter(F=>F.instanceId!==v):C.slice(0,-1):C)},[]),I=Be(()=>o([]),[]),R=Be((v,C)=>{o(F=>F.map(M=>M.instanceId===v?{...M,minimized:true,restoreState:C}:M))},[]),L=Be((v,C)=>{o(F=>{let M=F.find(T=>T.instanceId===v);return M?[...F.filter(T=>T!==M),{...M,minimized:false,restoreState:C??M.restoreState}]:F})},[]),D=Be(v=>t.find(C=>C.instanceId===v)?.minimized??false,[t]),E=t.some(v=>v.launchMode!=="toggle-only"&&!v.minimized);xt(()=>E?is(r(v=>{if(v.key!=="Escape"||v.defaultPrevented)return;let C=[...t].reverse().find(F=>F.launchMode!=="toggle-only"&&!F.minimized);C&&B(C.instanceId)},"handler")):void 0,[E,B,t]),_n(t.length>0,()=>B());let z=ls(()=>({openApps:t,isAnyOpen:E,open:g,close:B,closeAll:I,registerApps:h,minimize:R,restore:L,isMinimized:D}),[t,E,g,B,I,h,R,L,D]);return ce(Wn.Provider,{value:z,children:e})},"AppHostProvider"),rt=r(()=>{let e=ss(Wn);return e||{openApps:[],isAnyOpen:false,open:r(()=>"","open"),close:r(()=>{},"close"),closeAll:r(()=>{},"closeAll"),registerApps:r(()=>{},"registerApps"),minimize:r(()=>{},"minimize"),restore:r(()=>{},"restore"),isMinimized:r(()=>false,"isMinimized")}},"useAppHost"),Bs=9e3,Rs={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"},Ms={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"},Ds=r(({app:e,zIndex:t,onClose:o,onMinimize:i,minimizeTargetPosition:n,enableSharedModalDimensions:s})=>{let l=e.component,c=!e.minimized,d={...e.props??{},...s?{enableSharedModalDimensions:true}:{}};return e.modal&&(!e.launchMode||e.launchMode==="self-modal")?ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:ce(jn,{app:e,config:e.modal,visible:c,zIndex:t,onClose:o,onMinimize:i,initialModalState:e.restoreState,enableSharedModalDimensions:s,bodyProps:d})}):e.launchMode==="self-modal"?ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:ce(l,{...d,visible:c,onClose:o,onRequestClose:o,onMinimize:i,minimizeTargetPosition:n,instanceId:e.instanceId,zIndex:t,initialModalState:e.restoreState})}):e.launchMode==="inline"?c?ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:ce(l,{...d,onClose:o,onMinimize:i,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})}):null:ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{...Rs,zIndex:t,display:c?"flex":"none"},children:ce("div",{style:Ms,children:ce(l,{...d,onClose:o,onMinimize:i,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})})})},"AppRenderer"),Vn=r(()=>{let{openApps:e,close:t,minimize:o}=rt(),{settings:i}=zn();xt(()=>{rs(i.globalSettings?.expandableWindowControls!==false)},[i.globalSettings?.expandableWindowControls]);let n=e.filter(c=>c.launchMode!=="toggle-only");if(n.length===0)return null;let s=n.filter(c=>c.minimized).length,l=Lr()??As(s);return ce(Is,{children:n.map((c,d)=>ce(Ds,{app:c,zIndex:Bs+d,onClose:()=>t(c.instanceId),onMinimize:u=>o(c.instanceId,u),enableSharedModalDimensions:i.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:l},c.instanceId))})},"AppOverlay");import{useCallback as Os,useEffect as io,useRef as Es,useState as qn,useSyncExternalStore as Gn}from"react";import{persistentStorage as Jn,getToolAttention as ro,subscribeToolAttention as Yn}from"@buoy-gg/shared-ui/web";import{jsx as de,jsxs as zt}from"react/jsx-runtime";function Xn(e){return Gn(Yn,()=>ro(e),()=>ro(e))}r(Xn,"useToolAttention");var Qn={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"},Zn={needsInput:3,failed:2,done:1},ei=new Map;function ao(e){let t=null;for(let i of e?e.split("|"):[]){let n=ro(i);n&&(!t||Zn[n.kind]>Zn[t.kind])&&(t=n)}let o=ei.get(e);return o&&t&&o.kind===t.kind&&o.label===t.label?o:!o&&!t?null:(ei.set(e,t),t)}r(ao,"strongest");function ti(e){let t=e.join("|");return Gn(Yn,()=>ao(t),()=>ao(t))}r(ti,"useStrongestAttention");var oi=28,so=32,lo=6,ni=8,ii=24,ri="@react_buoy_minimized_stack_expanded",Ps=80,ai=2e3,Ls=6e3,Fs="#1A1A1A",at="#888888";function co({down:e=false}){return de("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:de("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:at,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}r(co,"ChevronGlyph");function si({id:e,title:t,icon:o,index:i,onPress:n}){let s=Xn(e),l=Es(null);return io(()=>{let c=true,d,u=r(()=>{l.current?.animate([{transform:"translateX(0) scale(1)",opacity:1,offset:0},{transform:"translateX(3px) scale(1.05)",opacity:.4,offset:.2},{transform:"translateX(-3px) scale(1.1)",opacity:1,offset:.4},{transform:"translateX(2px) scale(1.0)",opacity:.6,offset:.6},{transform:"translateX(-1px) scale(0.95)",opacity:1,offset:.8},{transform:"translateX(0) scale(1)",opacity:1,offset:1}],{duration:Ps,easing:"linear"})},"runGlitch"),g=r(S=>{let h=S?500+Math.random()*1500+i*200:ai+Math.random()*(Ls-ai)+i*300;d=setTimeout(()=>{c&&(u(),g(false))},h)},"schedule");return g(true),()=>{c=false,clearTimeout(d)}},[i]),zt("button",{type:"button","aria-label":s?`${t} \u2014 ${s.label}. Restore`:`Restore ${t}`,"data-testid":`buoy-dock-restore-${e}`,onClick:n,style:{width:so,height:so,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[de("div",{ref:l,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:o}),s?de("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${s.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Qn[s.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:s.kind==="needsInput"?"!":""}):null]})}r(si,"GlitchToolButton");function li({containerWidth:e=32}){let{openApps:t,restore:o}=rt(),i=t.filter(h=>h.minimized&&h.launchMode!=="toggle-only"),[n,s]=qn(false),[l,c]=qn(false),d=ti(i.map(h=>h.id));io(()=>{let h=false;return r(async()=>{let B=await Jn.getItem(ri);!h&&B==="true"&&s(true),h||c(true)},"load")(),()=>{h=true}},[]),io(()=>{l&&Jn.setItem(ri,n?"true":"false")},[n,l]);let u=Os(h=>{o(h)},[o]);if(i.length===0)return null;let g=ni+i.length*so+(i.length-1)*lo+lo+ii+4,S={backgroundColor:Fs,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${at}66`,borderLeft:`1px solid ${at}66`,borderRight:`1px solid ${at}66`,borderBottom:"none",boxSizing:"border-box"};return zt("div",{style:{height:oi,overflow:"visible",position:"relative"},children:[de("div",{style:{position:"absolute",bottom:"var(--buoy-stack-bottom, 0px)",top:"var(--buoy-stack-top, auto)",left:0,width:e,maxHeight:"var(--buoy-stack-space, calc(100vh - 48px))",visibility:n?"visible":"hidden",height:n?g:0,opacity:n?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:n?"auto":"none",...S},children:zt("div",{style:{height:g,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:ni,gap:lo,boxSizing:"border-box"},children:[n&&[...i].reverse().map((h,B)=>de(si,{id:h.id,title:h.title||h.id,icon:h.icon??de("span",{style:{color:"#fff",fontSize:13},children:(h.title||h.id).slice(0,1).toUpperCase()}),index:B,onPress:()=>u(h.instanceId)},h.instanceId)),de("button",{type:"button","aria-label":"Collapse","data-testid":"buoy-dock-collapse",onClick:()=>s(false),style:{width:"100%",height:ii,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:de(co,{down:true})})]})}),zt("button",{type:"button","aria-label":`Show ${i.length} minimized tools`,"data-testid":"buoy-dock-peek",tabIndex:n?-1:0,"aria-hidden":n,onClick:()=>s(true),style:{position:"absolute",bottom:0,left:0,width:e,height:oi,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",padding:0,opacity:n?0:1,transform:n?"scale(0.9)":"scale(1)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:n?"none":"auto",...S},children:[de(co,{}),d?de("span",{"aria-hidden":true,"data-testid":"buoy-dock-peek-attention",style:{position:"absolute",top:2,right:2,minWidth:11,height:11,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Qn[d.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:d.kind==="needsInput"?"!":""}):null,i.length>1&&de("span",{style:{fontSize:9,fontWeight:600,color:at,marginLeft:1},children:i.length})]})]})}r(li,"MinimizedToolsStack");import{registerToolModules as $s}from"@buoy-gg/shared-ui/web";import{createElement as js}from"react";function Ge(e){let t=e.icon;return{...e,icon:typeof t=="function"?o=>js(t,{size:o,slot:e.slot??"both",color:e.color}):()=>t}}r(Ge,"createWebTool");import{createContext as Ns,useContext as Hs,useState as ci,useMemo as di}from"react";import{jsx as _s}from"react/jsx-runtime";var ui=Ns(null);function uo({children:e}){let[t,o]=ci(false),[i,n]=ci(false),s=di(()=>t||i,[t,i]),l=di(()=>({isDialOpen:t,isToolOpen:i,isDevToolsActive:s,setDialOpen:o,setToolOpen:n}),[t,i,s]);return _s(ui.Provider,{value:l,children:e})}r(uo,"DevToolsVisibilityProvider");function At(){let e=Hs(ui);return e||{isDialOpen:false,isToolOpen:false,isDevToolsActive:false,setDialOpen:r(()=>{},"setDialOpen"),setToolOpen:r(()=>{},"setToolOpen")}}r(At,"useDevToolsVisibility");import*as Ws from"@buoy-gg/license/web";import*as Us from"@buoy-gg/shared-ui/web";import*as Ks from"@buoy-gg/shared-ui/web/dataViewer";function po(e){$s({core:{useDevToolsVisibility:At},license:Ws,"shared-ui":Us,"shared-ui/dataViewer":Ks,...e});let t=new Set;return Object.values(e).flatMap(o=>Object.entries(o).flatMap(([i,n])=>!i.endsWith("Preset")||!n||typeof n.id!="string"||!n.component||t.has(n.id)?[]:(t.add(n.id),[Ge(n)])))}r(po,"createWebTools");import{useEffect as Bt,useMemo as Rt,useRef as Vs}from"react";import{LicenseManager as pi,installCapacitorBridge as qs,resolveDevBuild as mi,useLicense as Gs}from"@buoy-gg/license/web";import{registerToolAdapters as Js}from"@buoy-gg/shared-ui/web";function mo(e){return typeof e=="object"&&e!==null?e:void 0}r(mo,"externalSyncOptions");function gi({isDevelopment:e,isLicensed:t,externalSync:o,isAvailable:i}){if(o===false||!i)return false;if(e)return true;let n=mo(o);return t&&n?.enableInRelease===true&&go(n.socketURL,n)===null}r(gi,"shouldMountExternalSync");var fi="http://localhost:42831";function hi(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}r(hi,"isLoopbackHost");function go(e,t){let o=e??fi;if(t?.allowInsecureNetwork===true)return null;let i;try{i=new URL(o)}catch{return`[Buoy] externalSync.socketURL "${o}" isn't a valid URL, so this release build won't connect to Buoy Desktop.`}return i.protocol==="https:"||i.protocol==="wss:"||hi(i.hostname)?null:`[Buoy] This release build won't connect to ${o}: release sync carries real user data, and plain http to another machine is readable by anyone on the same network. Use a simulator, an emulator or adb reverse (localhost), an https:// broker, or set externalSync.allowInsecureNetwork: true for a network you trust.`}r(go,"releaseTransportProblem");var Ys={impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};function yi(e,t,o){if(t)return e;let i=null;for(let[n,s]of Object.entries(Ys)){if(o?.includes(n))continue;let l=e[n];if(!l?.actions)continue;let c={...l.actions};for(let d of s)d in c&&(c[d]=()=>{throw new Error(`${n}.${d} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)});i??(i={...e}),i[n]={...l,actions:c}}return i??e}r(yi,"applyReleaseActionPolicy");import{useEffect as Xs,useMemo as Qs,useState as Zs}from"react";import{devToolsStorageKeys as el,persistentStorage as tl}from"@buoy-gg/shared-ui/web";import{isCapacitorNative as ol}from"@buoy-gg/license/web";var nl=8;function bi(){let e="";for(;e.length<nl;)e+=(Math.random()*16|0).toString(16);return e}r(bi,"generateInstallId");function vi(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}r(vi,"slugify");function Si({appName:e,hardwareName:t,platform:o,installId:i,deviceId:n}){let s=vi(e??"buoy")||"buoy",l=e??"Buoy Device",c=t?.trim()||o;return n?{deviceId:n,deviceName:`${l} (${c})`}:{deviceId:`${s}-${o}-${i}`,deviceName:`${l} (${c} \xB7 ${i.slice(-4)})`}}r(Si,"buildDeviceIdentity");function wi(){let e=globalThis;try{return e.sessionStorage??null}catch{return null}}r(wi,"sessionStore");function xi(){let e=globalThis;try{return e.localStorage??null}catch{return null}}r(xi,"localStore");async function Ti({platform:e=Ne.OS,store:t,mint:o=bi}={}){let i=el.sync.deviceId(),n=t===void 0?ol()?xi():e==="web"?wi():tl:t;if(!n)return o();try{let s=await n.getItem(i);if(s&&s.length>0)return s;let l=o();return await n.setItem(i,l),l}catch{return o()}}r(Ti,"loadInstallId");var fo=null;function Ii(){return fo||(fo=Ti()),fo}r(Ii,"getInstallId");function Ci(e,t){let o=e?.deviceId,i=e?.deviceName,n=t.loadId??Ii,s=t.platform??Ne.OS,[l,c]=Zs(null);return Xs(()=>{if(o)return;let d=false;return n().then(u=>{d||c(u)}),()=>{d=true}},[o,n]),Qs(()=>{if(!o&&!l)return null;let d=Si({appName:t.appName,hardwareName:t.hardwareName,platform:s,installId:l??"",deviceId:o});return i?{...d,deviceName:i}:d},[o,i,l,t.appName,t.hardwareName,s])}r(Ci,"useDeviceIdentity");import{useEffect as il,useState as rl}from"react";import{capacitorPlatform as al,capacitorPlugin as Mt,isCapacitorNative as sl}from"@buoy-gg/license/web";function ki(e,t){if(t==="ios")return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":null;let o=/Android [\d.]+;\s*([^;)]+?)(?:\s+Build\/|\))/.exec(e)?.[1]?.trim();return!o||o==="K"?null:o}r(ki,"hardwareFromUserAgent");function zi(e){return/sdk_gphone|Android SDK built for|Android ATD built for|google_sdk|Emulator|generic_/i.test(e)}r(zi,"isAndroidEmulatorUserAgent");function ho(){return typeof navigator>"u"?"":navigator.userAgent??""}r(ho,"userAgent");function Dt(){return typeof document>"u"?null:document.title||(typeof location>"u"?null:location.hostname)||null}r(Dt,"firstPageTitle");var Ai="@react_buoy_capacitor_app_name";function Bi(e){try{let t=globalThis.localStorage;if(!t)return e;let o=t.getItem(Ai);if(o)return o;e&&t.setItem(Ai,e)}catch{}return e}r(Bi,"persistedAppName");function Ri(){let e=al();if(!e)return{platform:"web",appName:Dt(),hardwareName:"Browser",ready:true};let t=!!Mt("App");return{platform:e,appName:t?Dt():Bi(Dt()),hardwareName:ki(ho(),e)??e,extraDeviceInfo:{runtime:"capacitor"},ready:!t&&!Mt("Device")}}r(Ri,"initialHostInfo");function Mi(){let[e,t]=rl(Ri);return il(()=>{if(!sl())return;let o=false,i=Mt("App"),n=Mt("Device");return Promise.all([i?.getInfo?.().catch(()=>null)??null,n?.getInfo?.().catch(()=>null)??null]).then(([s,l])=>{if(o)return;let c=s?.name?.trim(),d=l?.name?.trim()||l?.model?.trim();t(u=>({...u,appName:c||u.appName,hardwareName:d||u.hardwareName,ready:true}))}),()=>{o=true}},[]),e}r(Mi,"useHostInfo");function yo(){if(typeof location>"u")return null;let e=globalThis.WEBVIEW_SERVER_URL;return{protocol:location.protocol,hostname:location.hostname,origin:`${location.protocol}//${location.host}`,userAgent:ho(),serverUrl:typeof e=="string"?e:null}}r(yo,"pageInfo");function bo(e){if(!e)return null;try{let t=new URL(e);return`${t.protocol}//${t.host}`}catch{return null}}r(bo,"schemeHost");function Di(e,t){if(e==="ios"){let o=bo(t.serverUrl);return o?o===bo(t.origin):t.protocol==="capacitor:"}return Oi.has(t.hostname)}r(Di,"isBundledPage");var Oi=new Set(["localhost","127.0.0.1","[::1]","::1"]);function Ei(e,t,o,i=yo()){if(o==="web"||!i)return e;let n;try{n=new URL(e)}catch{return e}let s=Di(o,i);return!t&&s&&n.hostname===i.hostname&&(n.hostname="localhost"),o==="android"&&Oi.has(n.hostname)&&zi(i.userAgent)&&(n.hostname="10.0.2.2"),n.toString().replace(/\/$/,"")}r(Ei,"capacitorBrokerURL");function Pi(e,t,o=yo()){return t!=="android"||!o||o.protocol!=="https:"||!/^(http|ws):/i.test(e)?null:`[Buoy] Can't reach Buoy Desktop at ${e}. This Android WebView serves the app from https://${o.hostname} and blocks plain http/ws by default. For debug builds, set android.allowMixedContent: true and server.cleartext: true in capacitor.config, then run cap sync.`}r(Pi,"capacitorTransportProblem");import{getDevServerOrigin as ll,resolveReloadStrategy as cl,scheduleReloadApp as dl}from"@buoy-gg/shared-ui/web";var Li=Date.now(),Fi=ll(),ul={platform:Ne.OS,isTV:Ne.isTV===true,isTVOS:Ne.isTVOS===true},$i={version:3,getSnapshot:r(()=>{let e=cl("auto");return{startedAt:Li,devServerOrigin:Fi,device:ul,reload:{available:e!==null,strategy:e}}},"getSnapshot"),subscribe:r(e=>()=>{},"subscribe"),actions:{ping:r(()=>({ok:true,startedAt:Li,devServerOrigin:Fi}),"ping"),reloadApp:r(e=>{let t=e??{},{strategy:o,delayMs:i}=dl({strategy:t.strategy,delayMs:t.delayMs});return{scheduled:true,strategy:o,delayMs:i}},"reloadApp")}};import{Fragment as pl,jsx as Fe,jsxs as ml}from"react/jsx-runtime";var gl=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"],fl=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];function ji(e){let t=Rt(()=>Object.fromEntries(Object.entries(e.modules).map(([i,n])=>[i.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),n])),[e.modules]),o=t["react-query"];return o?.useReactQuerySyncAdapter?Fe(Ni,{...e,modules:t,query:o}):Fe(vo,{...e,modules:t})}r(ji,"BrowserToolRuntime");function Ni(e){let t=e.query.useReactQuerySyncAdapter();return Fe(vo,{...e,queryAdapter:t})}r(Ni,"QueryRuntime");function vo({modules:e,apps:t,requiredEnvVars:o,externalSync:i,headless:n,sentryGetClient:s,queryAdapter:l}){let{isPro:c,tier:d}=Gs(),u=Rt(()=>{let L={app:$i};for(let[D,E]of Object.entries(e))for(let[z,v]of Object.entries(E))z.endsWith("SyncAdapter")&&v&&typeof v=="object"&&(L[D]=v);l&&(L.query=l),e.env?.createEnvSyncAdapter&&(L.env=e.env.createEnvSyncAdapter(o??[]));for(let D of t??[])D.sync&&(L[`custom:${D.id}`]=D.sync);return L},[e,t,o,l]),g=Vs(u);g.current=u,Bt(()=>Js(()=>g.current),[]),Bt(()=>{let L=[],D=r(E=>{let z=E?.();typeof z=="function"&&L.push(z)},"start");return D(e.network?.startNetworkCapture),D(e.storage?.startBrowserStorageCapture),D(e.assets?.startBrowserAssetCapture),D(e.three?.startThreeCapture),mi(typeof He<"u"?He:process.env.NODE_ENV!=="production")&&D(e["time-machine"]?.startTimeMachineFloatingToolPersistence),e.storage?.storageSyncAdapter?.subscribe&&D(()=>e.storage.storageSyncAdapter.subscribe(()=>{})),e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe&&D(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{})),()=>{for(let E of L.reverse())E()}},[e]);let S=e["external-sync"],h=mi(typeof He<"u"?He:process.env.NODE_ENV!=="production"),B=gi({isDevelopment:h,isLicensed:c,externalSync:i,isAvailable:!!S}),I=mo(i);qs({release:!h&&!!I?.enableInRelease}),!h&&I?.enableInRelease&&So(go(I.socketURL,I));let R=e.sentry?.SentryRoot;return ml(pl,{children:[Object.entries(e).flatMap(([L,D])=>gl.map(E=>{let z=D[E];return z?Fe(z,{},`${L}:${E}`):null})),R&&Fe(R,{getClient:s}),Object.entries(e).flatMap(([L,D])=>fl.map(E=>{let z=D[E];return z&&(!n||E==="ScenariosOverlay"||E==="ImpersonateOverlay")?Fe(z,{},`${L}:${E}`):null})),B&&Fe(_i,{module:S,tools:u,options:I,isPro:c,tier:d,dev:h})]})}r(vo,"ToolRuntime");var Hi=null;function So(e){!e||e===Hi||(Hi=e,console.warn("[Buoy]",e))}r(So,"warnOnce");function _i({module:e,tools:t,options:o,isPro:i,tier:n,dev:s}){let l=Mi(),c=Ci(o,{appName:l.appName,hardwareName:l.hardwareName,platform:l.platform}),d=Rt(()=>Ei(o?.socketURL??(s?e.getDefaultSocketURL():fi),!!o?.socketURL,l.platform),[o?.socketURL,s,e,l.platform]),{socket:u}=e.useExternalSyncSocket({deviceName:c?.deviceName??"Buoy Browser",socketURL:d,persistentDeviceId:l.ready?c?.deviceId??null:null,platform:l.platform,extraDeviceInfo:l.extraDeviceInfo,enableLogs:o?.enableLogs});Bt(()=>{let h=Pi(d,l.platform);if(!u||!h)return;let B=r(()=>So(h),"onError");return u.on("connect_error",B),()=>{u.off("connect_error",B)}},[u,d,l.platform]),Bt(()=>{if(!u)return;let h=r(()=>{if(!u.connected||!pi.hasAccountAccess())return;let B=pi.getState();!i&&(B.isInitialized===false||B.isValidating===true)||u.emit("device-license",{isPro:i?"1":"0",tier:n})},"emit");return h(),u.on("connect",h),()=>{u.off("connect",h)}},[u,i,n]);let g=o?.releaseActions?.join(",")??"",S=Rt(()=>yi(t,s,g?g.split(","):void 0),[t,s,g]);return e.useExternalSync({tools:S,socket:u,deviceId:l.ready?c?.deviceId??null:null,enableLogs:o?.enableLogs}),null}r(_i,"BrowserExternalSync");import{useState as Wi}from"react";import{BuoyPortal as hl}from"@buoy-gg/shared-ui/web/floating";import{useBuoySession as yl}from"@buoy-gg/license/web";import{Fragment as Ui,jsx as Je,jsxs as Ki}from"react/jsx-runtime";var Vi="#20C997";function qi(){let{status:e,signIn:t,signOut:o}=yl(),[i,n]=Wi(false),[s,l]=Wi(null);if(typeof document>"u")return null;let c=r(()=>{l(null),n(true),t().catch(u=>l(u instanceof Error?u.message:"Sign-in did not work. Try again.")).finally(()=>n(false))},"start"),d=e.state==="active";return Je(hl,{children:Je("div",{"data-buoy-signin":"",style:{position:"fixed",right:"max(16px, env(safe-area-inset-right))",bottom:"max(20px, env(safe-area-inset-bottom))",zIndex:99999,maxWidth:"min(320px, calc(100vw - 32px))",padding:d||s?"12px 14px":0,borderRadius:16,background:d||s?"#0f1419":"transparent",color:"#e6edf3",boxShadow:d||s?"0 10px 30px rgba(0,0,0,.35)":"none",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",fontSize:14,lineHeight:1.45},children:d?Ki(Ui,{children:[Je("div",{"data-testid":"buoy-signin-needs-plan",children:"Buoy on a live site needs a Pro or Business plan."}),Je("button",{type:"button",onClick:()=>void o(),style:bl,"data-testid":"buoy-signout",children:"Sign out"})]}):Ki(Ui,{children:[s?Je("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:s}):null,Je("button",{type:"button",onClick:c,disabled:i,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:Vi,color:"#04130d",fontWeight:600,fontSize:14,cursor:i?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:i?"Signing in\u2026":"Sign in to Buoy"})]})})})}r(qi,"BuoySignIn");var bl={marginTop:8,padding:0,border:"none",background:"none",color:Vi,fontSize:14,cursor:"pointer",textDecoration:"underline"};import{LicenseManager as Qc}from"@buoy-gg/license/web";var vl=false;function Gi(){if(!vl){try{let e=process.env.EXPO_PUBLIC_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}}r(Gi,"defaultLicenseKey");import{useState as Sl}from"react";import{AccountSetupButton as wl,BuoyNeedsPlanCard as xl,BuoySignInCard as Tl,useSignInState as Il}from"@buoy-gg/shared-ui/web";import{jsx as st,jsxs as Ji}from"react/jsx-runtime";function wo({needsPlan:e=false}){let[t,o]=Sl(false),i=Il();return Ji(H,{pointerEvents:"box-none",style:Yi.root,children:[st(wl,{expanded:t,onPress:()=>o(true)}),t?st(mr,{visible:true,transparent:true,animationType:"fade",onRequestClose:()=>o(false),children:Ji(H,{style:Yi.overlay,accessibilityViewIsModal:true,children:[st(pr,{style:ct.absoluteFill,onPress:()=>o(false),accessible:false}),e&&i==="active"?st(xl,{onClose:()=>o(false)}):st(Tl,{onClose:()=>o(false)})]})}):null]})}r(wo,"BuoySignIn");var Yi=ct.create({root:{position:"absolute",bottom:30,right:16,zIndex:99999},overlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.65)",alignItems:"center",justifyContent:"center",padding:20}});function xo(e){if(e.length>6){let t=e.map(o=>`"${o}"`).join(", ");return e.slice(0,6)}return e}r(xo,"validateDialConfig");import{installedTools as Cl,installedToolsFound as kl}from"@buoy-gg/core/web/installed-tools";import{Fragment as To,jsx as $,jsxs as lt}from"react/jsx-runtime";var Xi={},Qi="@react_buoy_floating_menu_tooltip_shown",zl=Oe;function Zi({size:e=14,color:t="#20C997"}){let o=Math.max(2,e/4),i=Math.max(1,e/16);return $("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:i,width:e,height:e,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((n,s)=>$("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:t}},s))})}r(Zi,"MenuLauncherIcon");function er(e){let{defaultFloatingTools:t,defaultDialTools:o,disableHints:i=false,children:n}=e,s=he(()=>o&&xo(o),[o]);return $(Jt,{defaultFloatingTools:t,defaultDialTools:s,children:$(Ir,{disableHints:i,children:lt(uo,{children:[$(Kn,{children:$(rr,{...e})}),n]})})})}r(er,"AdmittedFloatingDevTools");var Al=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function tr({modules:e=Xi}){return $(To,{children:Object.entries(e).flatMap(([t,o])=>Al.map(i=>{let n=o[i];return n?$(n,{},`${t}:${i}`):null}))})}r(tr,"StartupCapture");function or(){let{openApps:e,restore:t}=rt();return Q(()=>Ro(o=>{let i=e.find(n=>n.id===o);return i?(t(i.instanceId),true):false}),[e,t]),null}r(or,"WebToolOpenerBridge");function nr(){let e=xr();return Cr((e===null?process.env.NODE_ENV:e?"development":"production")??"dev")}r(nr,"defaultEnvironment");function ir(e,t,o,i){let n=r(g=>Object.entries(e).find(([S])=>S.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===g)?.[1],"find"),s=[],l=n("env");t?.length&&l?.createEnvTool&&l.createEnvVarConfig&&s.push(Ge(l.createEnvTool({requiredEnvVars:l.createEnvVarConfig(t)})));let c=n("storage");o?.length&&c?.createStorageTool&&s.push(Ge(c.createStorageTool({requiredStorageKeys:o})));let d=n("ask-buoy"),u=i==="hosted"?d?.hostedAskBuoy?.():i;return u&&d?.createAskBuoyTool&&s.push(Ge(d.createAskBuoyTool(u))),s}r(ir,"configOverrides");function rr({environment:e,userRole:t="admin",availableEnvironments:o,onEnvironmentSwitch:i,apps:n,modules:s=Xi,externalSync:l,requiredEnvVars:c,sentryGetClient:d,disableHints:u=false,headless:g=false,hidden:S=false,defaultFloatingTools:h,defaultDialTools:B,zustandStores:I,requiredStorageKeys:R,askBuoy:L}){let D=e??nr(),E=he(()=>B?xo(B):void 0,[B]),[z,v]=Pt(false),[C,F]=Pt(false),M=Mo(false),T=rt(),ee=he(()=>ir(s,c,R,L),[s,c,R,L]),{allowedTools:V}=zo(),K=he(()=>Dr(Lt([...po(s),...n??[],...ee]),V),[n,s,ee,V]),{openApps:J,close:q}=T;Q(()=>{if(V)for(let a of J)Or(a.id,V)||q(a.instanceId)},[J,V,q]);let ne=he(()=>Object.entries(s).find(([a])=>a.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[s]);Q(()=>{if(!I||typeof ne?.watchStores!="function")return;let a=ne.watchStores(I);return typeof a=="function"?a:void 0},[I,ne]);let Z=At(),ue=T.openApps.some(a=>!a.minimized);Q(()=>{Z.setDialOpen(z)},[z,Z.setDialOpen]),Q(()=>{Z.setToolOpen(ue||C)},[ue,C,Z.setToolOpen]);let{registerApps:xe}=T;Q(()=>{xe(K.map(a=>{let x=a.icon;return{...a,icon:typeof x=="function"?({size:A})=>x(A):x}}))},[xe,K]);let be=he(()=>K.map(a=>({id:a.id,name:a.name,description:a.description,slot:a.slot})),[K]);zr({availableTools:be,storage:zl}),Q(()=>{let a=false;return r(async()=>{let[x,A]=await Promise.all([Oe.getItem(pt.dial.isOpen()),Oe.getItem(pt.settings.modalOpen())]);a||(x==="true"&&v(true),A==="true"&&(v(true),F(true)),M.current=true)},"restore")(),()=>{a=true}},[]),Q(()=>{M.current&&Oe.setItem(pt.dial.isOpen(),z?"true":"false")},[z]),Q(()=>{M.current&&Oe.setItem(pt.settings.modalOpen(),C?"true":"false")},[C]);let ie=_e(a=>{if(un(a.id),a.launchMode==="toggle-only"){a.onPress?.();return}if(a.component){let x=typeof a.icon=="function"?a.icon(20):a.icon;T.open({id:a.id,title:a.name||ut(a.id),component:a.component,props:a.props,modal:a.modal,launchMode:a.launchMode||"self-modal",singleton:a.singleton??true,icon:x,color:a.color||Do(a.id)})}else a.onPress?.()},[T]),W=Mo({tools:K,openApps:T.openApps,openTool:ie});W.current={tools:K,openApps:T.openApps,openTool:ie},Q(()=>Ro(a=>{let{tools:x,openApps:A,openTool:_}=W.current;if(A.some(Y=>Y.id===a))return false;let G=x.find(Y=>Y.id===a);return!G||G.launchMode==="toggle-only"?false:(_(G),true)}),[]);let me=he(()=>mt(K,"dial").map(a=>{let x=a.color||Do(a.id),A;return typeof a.icon=="string"?A=a.icon:typeof a.icon=="function"?A=a.icon(32):A=null,{id:a.id,name:a.name||ut(a.id),icon:A,unavailable:!a.component&&!a.onPress,color:x,onPress:r(()=>{ie(a),v(false)},"onPress")}}),[K,ie]),Re=he(()=>{if(!z)return me;let a=new Map(me.map(x=>[x.id,x]));return dn(me.map(x=>x.id)).map(x=>a.get(x)).filter(x=>!!x)},[z,me]),{settings:Te}=zn(),$e=he(()=>mt(K,"row").filter(a=>(Te.floatingTools[a.id]??false)===true&&(a.component||a.onPress)),[K,Te.floatingTools]),pe=he(()=>K.map(a=>({id:a.id,name:a.name||ut(a.id),description:a.description||Ar(a.id),slot:a.slot,icon:a.icon,color:a.color})),[K]),[oe,Ie]=Pt(false),ge=T.openApps.some(a=>!a.minimized);Q(()=>{if(u)return;let a=false,x=setTimeout(async()=>{let A=await Oe.getItem(Qi);!a&&!A&&Ie(true)},1e3);return()=>{a=true,clearTimeout(x)}},[u]);let ae=_e(()=>{Ie(false),Oe.setItem(Qi,"true")},[]),Ce=_e(()=>{ae(),v(true)},[ae]),ke=_e(()=>{v(false),F(false)},[]),Ye=_e(()=>{F(a=>!a)},[]),je=_e(()=>F(false),[]),ve=!!(o?.length&&i),Me=Te.floatingTools.environment!==false,fe=oe&&!z&&!ge&&!S;Q(()=>{if(!fe)return;let a=r(A=>{(!(A.target instanceof Element)||!A.target.closest("[data-buoy-root]"))&&ae()},"onPointerDown"),x=r(A=>{A.key==="Escape"&&ae()},"onKeyDown");return document.addEventListener("pointerdown",a,true),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",a,true),document.removeEventListener("keydown",x)}},[fe,ae]);let ze=T.openApps.some(a=>a.minimized&&a.launchMode!=="toggle-only"),O=$(ji,{modules:s,apps:n,requiredEnvVars:c,externalSync:l,headless:g,sentryGetClient:d});return g?O:lt("div",{"data-buoy-root":"",style:{display:"contents"},children:[O,$(or,{}),fe&&$("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),$("div",{style:S?{visibility:"hidden"}:{display:"contents"},"aria-hidden":S||void 0,children:lt(Po,{enablePositionPersistence:!fe,pushToSide:z||ge,suspendPointerEvents:z,centerOnboarding:fe,minimizedStack:ze?$(li,{}):void 0,hasMinimizedStack:ze,children:[D&&Me&&!ve&&$(Br,{environment:D}),ve&&Me&&$(Rr,{currentEnvironment:D??"local",availableEnvironments:o,onSelect:i}),t?$(Lo,{userRole:t,onPress:Ce}):$("button",{"aria-label":"Open dev tools",onClick:Ce,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:$(Zi,{})}),$e.map(a=>$("button",{"aria-label":a.name||ut(a.id),title:a.description,onClick:()=>ie(a),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof a.icon=="function"?a.icon(16):a.icon},a.id))]})}),fe&&$(jt,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:ae}),z&&!S&&$(Wt,{icons:Re,onClose:ke,centerLabel:"BUOY",onCenterPress:Ye,settingsOpen:C,hintsDisabled:u,emptyNote:V&&Re.length===0?Er:void 0}),C&&!S&&$(eo,{visible:true,onClose:je,availableTools:pe,defaultFloatingTools:h,defaultDialTools:E,onSettingsChange:a=>{}}),!S&<(To,{children:[$(Vn,{}),$(yr,{})]})]})}r(rr,"FloatingDevToolsInner");function ar(e){let t=e&&typeof e=="object"?e.appId:void 0,o=!!e;Q(()=>{if(!o)return;let i=false,n=br.SessionManager;if(!n)return;let s=r(l=>{i||!l||(n.configure({audience:`app:${l}`}),n.load().catch(()=>{}))},"apply");return t?s(t):Bo().then(l=>s(l?.bundleId)).catch(()=>{}),()=>{i=true}},[o,t])}r(ar,"useCapacitorSignInAudience");function sr(e){let t=e&&typeof e=="object"?e.appId:void 0;Q(()=>{let o=false;return t?Et(t):Ao()?Bo().then(i=>{o||Et(i?.bundleId)}).catch(()=>{}):typeof location<"u"&&location.origin&&location.origin!=="null"&&Et(location.origin),()=>{o=true}},[t])}r(sr,"usePublishAppId");var lr=false;function cr(e){return e.modules?e:(!kl&&!lr&&typeof console<"u"&&(lr=true,console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")),{...e,modules:Cl})}r(cr,"withInstalledTools");function dr(e){return $(hr,{children:$(ur,{...cr(e)})})}r(dr,"FloatingDevTools");function ur(e){let{access:t,isPro:o,licenseKey:i}=zo();Q(()=>{vr.configure(e.licenseKey??Gi())},[e.licenseKey]);let n=e.licenseKey===void 0||Sr(e.licenseKey,i),s=wr(typeof He<"u"?He:process.env.NODE_ENV!=="production"),l=n&&t.status==="admitted";Q(()=>{l&&kr()},[l]),Q(()=>{s||t.status==="initializing"||(o&&l?gr():fr())},[s,o,l,t.status]);let c=Ao();return ar(c?e.signIn:void 0),sr(e.signIn),!s&&!o?!e.signIn||e.headless?null:c?$(wo,{needsPlan:true}):$(qi,{}):l?$(er,{...e}):lt(To,{children:[t.status==="initializing"&&$(tr,{modules:e.modules}),e.headless?null:e.signIn&&c?$(wo,{}):$(Tr,{})]})}r(ur,"FloatingDevToolsContent");export{Mr as a,Oo as b,Lt as c,mt as d,Eo as e,Po as f,Pr as g,Lo as h,Wt as i,eo as j,oo as k,Ln as l,Nn as m,Kn as n,rt as o,Vn as p,Ge as q,uo as r,At as s,po as t,$i as u,dr as v};
|
|
10
|
+
`,document.head.appendChild(e),en=true}i(tn,"injectOnboardingKeyframes");var $t=We.accent;function jt({title:e,message:t,onDismiss:o,showArrow:r=true}){let[n,s]=Jo(false),[l,c]=Jo(false);ia(()=>{tn();let u=requestAnimationFrame(()=>s(true));return()=>cancelAnimationFrame(u)},[]);let d={fontFamily:Qo,textTransform:"uppercase"};return Ue("div",{style:{position:"fixed",left:"50%",bottom:la(),transform:`translateX(-50%) scale(${n?1:.8})`,opacity:n?1:0,transition:"transform 300ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 300ms ease",zIndex:10002,pointerEvents:"auto"},children:Zo("div",{style:{position:"relative",animation:n?"buoyOnboardPulse 3s ease-in-out infinite":"none"},children:[Ue("div",{style:{position:"absolute",inset:-4,borderRadius:18,backgroundColor:"#FFFFFF",opacity:.06}}),Zo("div",{style:{position:"relative",maxWidth:280,backgroundColor:We.dialBackground,borderRadius:16,border:`1px solid ${We.dialBorder}`,padding:20,boxShadow:`0 0 20px ${Xo(We.dialShadow,.6)}`,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[Ue("span",{style:{...d,fontSize:16,fontWeight:900,letterSpacing:1,color:$t,textAlign:"center"},children:e}),Ue("span",{style:{fontFamily:Qo,fontSize:13,lineHeight:"20px",color:We.centerText,textAlign:"center"},children:t}),Ue("button",{onClick:o,onPointerDown:()=>c(true),onPointerUp:()=>c(false),onPointerLeave:()=>c(false),onPointerCancel:()=>c(false),style:{...d,marginTop:8,borderRadius:8,border:"none",backgroundColor:$t,padding:"10px 24px",fontSize:14,fontWeight:900,letterSpacing:1.5,color:"#000000",cursor:"pointer",opacity:l?.7:1,transform:l?"scale(0.96)":"scale(1)",transition:"transform 100ms ease, opacity 100ms ease"},children:"Got it!"})]}),r&&Ue("div",{style:{position:"absolute",left:"50%",bottom:aa,marginLeft:-12,width:0,height:0,borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:`${sa}px solid ${$t}`,filter:`drop-shadow(0 0 10px ${Xo(We.dialShadow,.5)})`,animation:n?"buoyOnboardArrowBounce 1.6s ease-in-out infinite":"none"}})]})})}i(jt,"OnboardingTooltip");import{Fragment as ca,jsx as P,jsxs as xe}from"react/jsx-runtime";var da={x:.5,y:.5},on="@react_buoy_settings_tooltip_shown",nn=false;function rn(){if(nn||typeof document>"u")return;let e=document.createElement("style");e.textContent=Hi(),document.head.appendChild(e),nn=true}i(rn,"injectKeyframes");var Ke=i(e=>1-Math.pow(1-e,3),"easeOutCubic"),Nt=i(e=>e*e*e,"easeInCubic");function an({icon:e,index:t,totalIcons:o,position:r,progress:n,onPress:s}){let[l,c]=te(false),[d,u]=te(false),m=!e.icon&&e.id.startsWith("empty-"),S=!m&&e.unavailable===true,h=!m&&!S,{icons:B}=jo,I=Ni(t,o),R=0;n<=I[1]?R=0:n<=I[2]?R=(n-I[1])/(I[2]-I[1]):R=1,R=Math.max(0,Math.min(1,R));let L=_i,M=B.pressIn.scale,E=R*(d?M:l?1.1:1),k=0;R<=0?k=0:R<=.3?k=R:k=.3+(R-.3)*(.7/.7);let v=r.x*(R-1),C=r.y*(R-1);return P("button",{role:"menuitem","aria-label":m?"Empty slot":$o(e.id,e.name),"data-testid":e.id?`buoy-dial-${e.id}`:void 0,"aria-disabled":!h,tabIndex:h?0:-1,onClick:h?s:void 0,onPointerEnter:F=>h&&F.pointerType==="mouse"&&c(true),onPointerLeave:()=>{c(false),u(false)},onPointerDown:()=>h&&u(true),onPointerUp:()=>u(false),onPointerCancel:()=>u(false),style:{position:"absolute",left:`calc(50% + ${r.x}px)`,top:`calc(50% + ${r.y}px)`,width:L,height:L,marginLeft:-L/2,marginTop:-L/2,cursor:h?"pointer":"default",background:"none",border:"none",padding:0},children:P("span",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",transform:`translate(${v}px, ${C}px) scale(${E})`,opacity:k,transition:l||d?"transform 100ms ease":"none"},children:m?P("div",{style:{width:x.emptySlot.dotSize,height:x.emptySlot.dotSize,borderRadius:x.emptySlot.dotSize/2,backgroundColor:j.emptyDotBackground,border:`${x.emptySlot.borderWidth}px solid ${j.emptyDotBorder}`}}):xe(ca,{children:[P("div",{style:{position:"absolute",width:`${x.icon.gradientBgSizePercent}%`,height:`${x.icon.gradientBgSizePercent}%`,borderRadius:x.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:x.icon.gradientBgOpacity}}),P("div",{style:{position:"absolute",width:`${x.icon.innerGlowSizePercent}%`,height:`${x.icon.innerGlowSizePercent}%`,borderRadius:x.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:x.icon.innerGlowOpacity}}),P("div",{style:{marginBottom:x.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:l?"brightness(1.2)":"none"},children:e.icon}),P("span",{style:{fontSize:e.name.length>8?Math.max(x.icon.label.fontSize*.7,x.icon.label.fontSize*8/e.name.length):x.icon.label.fontSize,fontWeight:x.icon.label.fontWeight,fontFamily:x.icon.label.fontFamily,color:j.iconLabel,letterSpacing:x.icon.label.letterSpacing,marginTop:x.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:e.name}),S&&P("span",{style:{fontSize:x.icon.label.fontSize-1,fontWeight:x.icon.label.fontWeight,fontFamily:x.icon.label.fontFamily,letterSpacing:x.icon.label.letterSpacing,color:Ui.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})})}i(an,"DialIconItem");function _t({side:e,color:t}){return P("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(e==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]]).map(([o,r,n,s],l)=>P("line",{x1:o,y1:r,x2:n,y2:s,stroke:t,strokeWidth:2},l))})}i(_t,"PagerChevron");function Ht({side:e,disabled:t,onClick:o}){let[r,n]=te(false),s=t?j.emptyDotBorder:j.accent;return xe("button",{type:"button","aria-label":`${e==="prev"?"Previous":"Next"} dial page`,"data-testid":`buoy-dial-${e}`,disabled:t,onClick:o,onPointerDown:()=>!t&&n(true),onPointerUp:()=>n(false),onPointerLeave:()=>n(false),onPointerCancel:()=>n(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${j.dialBorder}`,backgroundColor:j.dialBackground,color:t?j.iconLabelMuted:j.centerText,fontSize:12,fontWeight:900,fontFamily:Ft,letterSpacing:1.5,textTransform:"uppercase",cursor:t?"default":"pointer",opacity:t?.4:1,boxShadow:t?"none":`0 0 8px ${No(j.dialShadow,.4)}`,transform:r?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[e==="prev"&&P(_t,{side:"prev",color:s}),e==="prev"?"PREV":"NEXT",e==="next"&&P(_t,{side:"next",color:s})]})}i(Ht,"PagerButton");function Wt({icons:e,onClose:t,centerLabel:o="MENU",onCenterPress:r,settingsOpen:n=false,hintsDisabled:s=false,emptyNote:l}){let{id:c}=Vi(),[d,u]=te(0),[m,S]=te(0),[h,B]=te(0),[I,R]=te(0),[L,M]=te(0),[E,k]=te(1),[v,C]=te(false),[F,D]=te(false),[T,ee]=te(false),V=gt(null),K=gt(null),Y=gt(null),G=gt(false),{entrance:ne,exit:Z,interaction:ue}=jo,we=Wi(),[be,re]=te(()=>({width:window.innerWidth,height:window.innerHeight}));Ee(()=>{let O=i(()=>re({width:window.innerWidth,height:window.innerHeight}),"resize");return window.addEventListener("resize",O),()=>window.removeEventListener("resize",O)},[]);let W=mt(()=>Fi({screenWidth:be.width,maxCircleSize:Math.max(120,Math.min(320,be.height-96))}),[be]),fe=mt(()=>ji(),[]),Re=mt(()=>$i(Qe,W.iconRadius),[W.iconRadius]),[Te,$e]=te(0),pe=Math.max(1,Math.ceil(e.length/Qe)),oe=Math.min(Te,pe-1),Ie=mt(()=>{let O=oe*Qe,a=[...e.slice(O,O+Qe)];for(;a.length<Qe;)a.push({id:`empty-${a.length}`,name:"",icon:null,onPress:i(()=>{},"onPress")});return a},[e,oe]);Ee(()=>{rn()},[]),Ee(()=>{let O=ne.backdrop.duration,a=ne.dial.rotation.duration,w=ne.centerButton.delay,A=ne.icons.delay,H=ne.icons.duration,q=performance.now(),J=i(f=>{let g=f-q;u(Math.min(1,g/O));let z=Math.min(1,g/400),X=Ke(z)*1.1;z>.7&&(X-=(z-.7)*.33),z>=1&&(X=1),S(Math.max(0,Math.min(1.05,X)));let se=Math.min(1,g/a);if(B(Ke(se)*360),g>=w){let Se=Math.min(1,(g-w)/300),Ot=Ke(Se)*1.15;Se>.6&&(Ot-=(Se-.6)*.375),Se>=1&&(Ot=1),R(Math.max(0,Math.min(1.05,Ot)))}if(g>=A){let Se=Math.min(1,(g-A)/H);M(Ke(Se))}let Xe=A+H;g<Xe?Y.current=requestAnimationFrame(J):(u(1),S(1),B(360),R(1),M(1),ee(true))},"animate");return Y.current=requestAnimationFrame(J),()=>{Y.current&&cancelAnimationFrame(Y.current)}},[]);let me=ht(()=>{if(G.current)return;G.current=true,D(true),Y.current&&cancelAnimationFrame(Y.current);let O=performance.now(),a=Z.icons.duration,w=Z.centerButton.duration,A=Z.dialScale.duration,H=Math.max(w,A),q=Z.backdrop.duration,J=i(f=>{let g=f-O;if(g<a){let se=Nt(g/a);M(1-se),Y.current=requestAnimationFrame(J);return}let z=a;if(g<z+H){M(0);let se=Math.min(1,(g-z)/w),Xe=Math.min(1,(g-z)/A);R(1-Nt(se)),S(1-Nt(Xe)),Y.current=requestAnimationFrame(J);return}let X=z+H;if(g<X+q){S(0),R(0);let se=(g-X)/q;u(1-se),Y.current=requestAnimationFrame(J);return}u(0),t()},"animate");Y.current=requestAnimationFrame(J)},[Z,t]);Ee(()=>{let O=document.activeElement,a=V.current;return()=>{O?.isConnected&&(document.activeElement===document.body||a?.contains(document.activeElement))&&O.focus()}},[]),Ee(()=>{if(n)return;K.current?.focus();let O=i(a=>{let w=V.current;if(w){if(a.key==="Escape")a.preventDefault(),me();else if(a.key==="Tab"){let A=Array.from(w.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(J=>J.getClientRects().length>0),H=A[0],q=A[A.length-1];(!w.contains(document.activeElement)||(a.shiftKey?document.activeElement===H:document.activeElement===q))&&(a.preventDefault(),(a.shiftKey?q:H)?.focus())}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(a.key)){let A=Array.from(w.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),H=A.indexOf(document.activeElement);if(H<0||!A.length)return;a.preventDefault();let q=a.key==="Home"?0:a.key==="End"?A.length-1:(H+(a.key==="ArrowRight"||a.key==="ArrowDown"?1:-1)+A.length)%A.length;A[q].focus()}}},"handleKeyDown");return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[me,n]);let[ae,Ce]=te(false);Ee(()=>{if(s)return;let O=false,a=setTimeout(async()=>{let w=await _o.getItem(on);!O&&!w&&Ce(true)},1200);return()=>{O=true,clearTimeout(a)}},[s]);let ze=ht(()=>{Ce(false),_o.setItem(on,"true")},[]);Ee(()=>{n&&ae&&ze()},[n,ae,ze]);let Je=ht(O=>{if(O.id.startsWith("empty-")||G.current)return;let[a,w]=ue.iconSelect.pulse,A=performance.now(),H=150,q=i(J=>{let f=J-A;if(f<H){let g=Ke(f/H);k(1-(1-a.scale)*g),requestAnimationFrame(q)}else if(f<H*2){let g=Ke((f-H)/H);k(a.scale+(w.scale-a.scale)*g),requestAnimationFrame(q)}else k(1)},"animatePulse");requestAnimationFrame(q),setTimeout(()=>{O.onPress(),me()},ue.iconSelect.actionDelay)},[ue.iconSelect,me]),je=ht(O=>{if(G.current)return;let a=Math.max(0,Math.min(O,pe-1));a!==oe&&$e(a)},[pe,oe]),ve=W.buttonSize*x.centerButton.containerRatio,De=W.buttonSize*x.centerButton.borderRatio,ge=W.buttonSize*x.centerButton.containerRatio/2+6,ke=T&&!F;return xe("div",{ref:V,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[P("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:me,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:j.dialBackdrop,opacity:d}}),l?P("div",{role:"status","data-testid":"buoy-dial-empty-note",style:{position:"absolute",left:16,right:16,bottom:80+W.circleSize+16,color:j.iconLabel,fontSize:12,fontFamily:Ft,textAlign:"center",opacity:m>.01?1:0},children:l}):null,xe("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,bottom:80,width:W.circleSize,height:W.circleSize,borderRadius:"50%",backgroundColor:j.dialBackground,border:`${x.circle.borderWidth}px solid ${j.dialBorder}`,boxShadow:`0 0 ${x.circle.shadowRadius}px ${No(j.dialShadow,x.circle.shadowOpacity)}`,transform:`scale(${m}) rotate(${h}deg)`,opacity:m>.01?1:0,overflow:"hidden"},children:[P("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:j.dialGradient1,opacity:x.gradientLayers[0].opacity}}),P("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:j.dialGradient2,opacity:x.gradientLayers[1].opacity}}),P("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:j.dialGradient3,opacity:x.gradientLayers[2].opacity}}),fe.map(O=>P("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:x.grid.lineHeight,transform:`rotate(${O}deg)`,transformOrigin:"center"},children:["left","right"].map(a=>P("div",{style:{position:"absolute",top:0,[a]:0,width:`calc(50% - ${ge}px)`,height:x.grid.lineHeight,backgroundColor:j.dialGridLine}},a))},O)),P("div",{"data-testid":"dial-background","data-background":c,style:{position:"absolute",inset:0,pointerEvents:"none"},children:c==="hyperspace"?P(ra,{size:W.circleSize}):P(Ki,{focus:da})}),Ie.map((O,a)=>P(an,{icon:O,index:a,totalIcons:Ie.length,position:Re[a],progress:L,onPress:()=>Je(O)},a)),xe("div",{style:{position:"absolute",left:"50%",top:"50%",width:ve,height:ve,marginLeft:-ve/2,marginTop:-ve/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:j.hubHalo,borderRadius:W.buttonSize,overflow:"hidden",transform:`scale(${I*E})`,opacity:I>.01?1:0},children:[P("div",{style:{position:"absolute",inset:0,backgroundColor:j.dialGradient1,opacity:.5,borderRadius:W.buttonSize}}),P("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:j.dialGradient2,opacity:.3,borderRadius:W.buttonSize}}),P("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:j.dialGradient3,opacity:.2,borderRadius:W.buttonSize}}),P("div",{style:{width:De,height:De,borderRadius:W.buttonSize*x.centerButton.borderRadiusRatio,backgroundColor:j.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:P("button",{ref:K,type:"button","aria-label":n?"Close Settings":"Open Dev Tools Settings",disabled:!r,onClick:r,onPointerEnter:O=>O.pointerType==="mouse"&&C(true),onPointerLeave:()=>C(false),style:{border:0,padding:0,background:"transparent",width:W.buttonSize,height:W.buttonSize,borderRadius:W.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:r?"pointer":"default",transform:v?`scale(${ue.centerHover.scale})`:"scale(1)",transition:`transform ${ue.centerHover.duration}ms ease`,animation:ke&&!v?we.pulse:"none"},children:n?xe("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:x.centerButton.text.fontSize-2,fontWeight:x.centerButton.text.fontWeight,fontFamily:x.centerButton.text.fontFamily,color:j.centerText,letterSpacing:x.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[P("span",{style:{marginBottom:-2},children:"CLOSE"}),P("span",{style:{marginTop:-2},children:"SETTINGS"})]}):P("span",{style:{fontSize:x.centerButton.text.fontSize,fontWeight:x.centerButton.text.fontWeight,fontFamily:x.centerButton.text.fontFamily,color:j.centerText,letterSpacing:x.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${j.centerTextGlow}`,textTransform:"uppercase"},children:o})})})]})]}),pe>1&&xe("div",{style:{position:"absolute",left:"50%",marginLeft:-W.circleSize/2,top:"calc(100% - 64px)",width:W.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,m),transform:`scale(${Math.min(1,m)})`},children:[P(Ht,{side:"prev",disabled:oe<=0,onClick:()=>je(oe-1)}),xe("span",{"data-testid":"buoy-dial-page",style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:Ft,letterSpacing:2,color:j.centerText,textShadow:`0 0 6px ${j.centerTextGlow}`},children:[String(oe+1).padStart(2,"0"),xe("span",{style:{color:j.iconLabelMuted,textShadow:"none"},children:[" / ",String(pe).padStart(2,"0")]})]}),P(Ht,{side:"next",disabled:oe>=pe-1,onClick:()=>je(oe+1)})]}),ae&&!n&&P(jt,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:ze,showArrow:false})]})}i(Wt,"DialMenu");import{persistentStorage as sn,devToolsStorageKeys as ua}from"@buoy-gg/shared-ui/web";import{recordUsage as pa,pruneUsage as fa}from"@buoy-gg/floating-tools-core/web";var ln=ua.dial.usage(),Ve={},cn=false,Ut=null;function Kt(){return Ut||(Ut=(async()=>{try{let e=await sn.getItem(ln);if(e){let t=JSON.parse(e);t&&typeof t=="object"&&(Ve=t)}}catch{}finally{cn=true}})(),Ut)}i(Kt,"loadDialUsage");Kt();function dn(e){return e.map((t,o)=>({id:t,index:o,lastUsed:Ve[t]?.lastUsed??0})).sort((t,o)=>o.lastUsed-t.lastUsed||t.index-o.index).map(({id:t})=>t)}i(dn,"getRankedToolIds");async function un(e){if(!e)return;cn||await Kt();let t=Math.max(Date.now(),...Object.values(Ve).map(o=>o.lastUsed+1));Ve=fa(pa(Ve,e,t),t);try{await sn.setItem(ln,JSON.stringify(Ve))}catch{}}i(un,"recordToolUsage");import{useCallback as ma,useMemo as pn}from"react";import{persistentStorage as ga}from"@buoy-gg/shared-ui/web";import{useState as ie,useEffect as Ae,useCallback as bt,useMemo as vt}from"react";import{settingsEventBus as St}from"@buoy-gg/floating-tools-core/web";import{useSyncExternalStore as ha}from"react";import{getRegisteredToolModule as ya}from"@buoy-gg/shared-ui/web";var ba=i(()=>()=>{},"noopSubscribe"),va=i(()=>null,"serverSnapshot");function fn(){let e=ya("@buoy-gg/external-sync");return ha(e?.subscribeSyncStatus??ba,()=>e?.getSyncStatus?.()??null,va)}i(fn,"useDesktopSyncStatus");import{SentryIcon as Sa,WifiCircuitIcon as xa,ImageOverlayIcon as wa,RenderCountIcon as Ta,Info as Vt,Layers as Ia,ChevronRightIcon as mn,ChevronDown as gn,getStorageBackendType as Ca,getUseLicense as za,signOutOfBuoy as ka,persistentStorage as Pe,Trash2 as Aa,CheckCircle2 as hn,BuoyUpgradeSheet as Ba,BackgroundSwitcher as Ra,night as b,NightCard as Le,NightRows as Gt,NightSectionLabel as Da,NightFootnote as yn,NightSwitch as bn,NightButton as qt,NightSegmented as Ma,NightBadge as ye,NightSeparator as Oa,monoFont as vn}from"@buoy-gg/shared-ui/web";import{EnvIcon as Sn,StorageIcon as Ea,RoutesIcon as Pa,NetworkIcon as La,QueryIcon as Fa,HighlighterIcon as $a,ReduxIcon as ja,EventsIcon as Na}from"@buoy-gg/floating-tools-core/web";import _a,{createContext as Ha,useContext as Wa}from"react";import{jsx as Ua}from"react/jsx-runtime";var xn=Ha({});function Yt({children:e,defaultFloatingTools:t,defaultDialTools:o}){let r=_a.useMemo(()=>({defaultFloatingTools:t,defaultDialTools:o}),[t,o]);return Ua(xn.Provider,{value:r,children:e})}i(Yt,"DefaultConfigProvider");function Jt(){return Wa(xn)}i(Jt,"useDefaultConfig");import Ka from"react";import{toolTheme as Va}from"@buoy-gg/shared-ui/web";import{jsx as wn}from"react/jsx-runtime";function Tn({label:e,size:t,color:o=Va.colors.text}){let r=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1),n=r<=2?t:t*1.6,s=Math.max(7,Math.min(t*(r===1?.7:.62),n/(.62*r)));return wn("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:s,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}i(Tn,"AppTextIcon");function Xt(e,t){return e==null?e:typeof e=="function"?Ka.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions}):typeof e=="string"||typeof e=="number"?wn(Tn,{label:String(e),size:t.size,color:t.color}):e}i(Xt,"renderAppIcon");import{JsModal as Ga,devToolsStorageKeys as Qt,onSettingsApplied as qa,expandableWindowControlsSupported as Ya}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as Ja}from"@buoy-gg/shared-ui/web";import{Fragment as et,jsx as p,jsxs as N}from"react/jsx-runtime";var Ge="@react_buoy_dev_tools_settings",Xa=6,xt=i(e=>{let t=Xa,o={};for(let[r,n]of Object.entries(e))n&&t>0?(o[r]=true,t-=1):o[r]=false;return o},"enforceDialLimit"),Qa=i((e,t)=>{let{userStatus:o,environment:r,...n}=e,s=t?Object.entries(n).filter(([l])=>t.includes(l)):Object.entries(n);return{...Object.fromEntries(s),environment:r??false}},"sanitizeFloating"),In=i((e,t,o)=>{if(!t)return e;let r={...e.dialTools,...t.dialTools??{}},n=o?.allowedDialKeys?Object.entries(r).filter(([s])=>o.allowedDialKeys?.includes(s)):Object.entries(r);return{dialTools:xt(Object.fromEntries(n)),floatingTools:Qa({...e.floatingTools,...t.floatingTools??{}},o?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...t.globalSettings??{}}}},"mergeWithDefaults"),Za=i((e=[],t,o)=>{let r={},n={},s=new Set(t??[]),l=new Set(o??[]),c=!o||o.length===0;for(let d of e){let{id:u,slot:m="both"}=d;(m==="dial"||m==="both")&&(r[u]=c?true:l.has(u)),(m==="row"||m==="both")&&(n[u]=s.has(u))}return{dialTools:xt(r),floatingTools:{...n,environment:s.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}},"generateDefaultSettings"),es=i(({visible:e,onClose:t,onSettingsChange:o,initialSettings:r,availableApps:n=[],storage:s=Pe,zIndex:l})=>{let{defaultFloatingTools:c,defaultDialTools:d}=Jt(),u=vt(()=>Za(n,c,d),[n,c,d]),m=vt(()=>Object.keys(u.dialTools),[u]),S=vt(()=>Object.keys(u.floatingTools).filter(f=>f!=="environment"),[u]),[h,B]=ie(r||tt||u),[I,R]=ie(Zt??"floating"),[L,M]=ie(Zt!==null),[E,k]=ie(new Set),[v,C]=ie(false),[F,D]=ie(false);Ae(()=>{let f=requestAnimationFrame(()=>D(true));return()=>cancelAnimationFrame(f)},[]);let T=fn();Ae(()=>{i(async()=>{try{let f=await Pe.getItem(Qt.settings.activeTab());if(f&&["floating","settings","pro"].includes(f)){let g=f;Zt=g,R(z=>z===g?z:g)}}catch{}finally{M(true)}},"loadActiveTab")()},[]),Ae(()=>{L&&Pe.setItem(Qt.settings.activeTab(),I).catch(f=>{console.warn("[Buoy]","Failed to save settings active tab:",f)})},[I,L]);let ee=za()?.(),V=ee?.isPro??false,K=!V&&ee?.licenseKey?ee.error:null,Y=ee?.errorKind==="transport",[G,ne]=ie(Cn),[Z,ue]=ie(false),[we,be]=ie(false),[re,W]=ie(false),[fe,Re]=ie([]),[Te,$e]=ie(false),pe=Ja(),oe=Co.get("window").height,Ie=Co.get("window").width,me=Math.floor(oe*.33),ae=Math.min(Ie-32,400),Ce=bt(async()=>{try{let f=await s.getItem(Ge);if(f){let g=JSON.parse(f),z=In(u,g,{allowedDialKeys:m,allowedFloatingKeys:S});tt=z,B(X=>zn(X,z)?X:z);return}tt=u,B(g=>zn(g,u)?g:u)}catch(f){console.error("[Buoy]","Failed to load dev tools settings:",f),B(u)}},[u,m,S,s]);Ae(()=>{Ce()},[Ce]),Ae(()=>{Ca().then(f=>{Cn=f,ne(g=>g===f?g:f)})},[]),Ae(()=>{re&&($e(true),Pe.getAllKeys().then(f=>{Re(f.sort())}).catch(()=>{Re([])}).finally(()=>{$e(false)}))},[re]);let ze=i(async f=>{try{let g=null;try{let X=await s?.getItem(Ge);g=X?JSON.parse(X):null}catch{}let z={...f,dialTools:{...g?.dialTools,...xt(f.dialTools)},floatingTools:{...g?.floatingTools,...f.floatingTools}};await s.setItem(Ge,JSON.stringify(z)),tt=z,B(z),o?.(z),St.emit(z)}catch(g){console.error("[Buoy]","Failed to save dev tools settings:",g)}},"saveSettings"),Je=i(f=>{let g={...h,floatingTools:{...h.floatingTools,[f]:!h.floatingTools[f]}};ze(g)},"toggleFloatingTool"),je=i(f=>{let g={...h,globalSettings:{...h.globalSettings,[f]:!h.globalSettings?.[f]}};ze(g)},"toggleGlobalSetting"),ve=i(async()=>{ue(true),be(false);try{await Pe.clear(),be(true),B(u),s!==Pe&&await s.setItem(Ge,JSON.stringify(u)),o?.(u),St.emit(u),setTimeout(()=>be(false),2e3)}catch(f){console.error("[Buoy]","Failed to clear storage:",f)}finally{ue(false)}},"handleClearStorage"),De=bt(f=>{},[]),ge=i(f=>{let g=n.find(z=>z.id===f);return g?.description?g.description:f==="environment"?"Environment badge.":""},"getToolDescription"),ke=i(f=>f==="environment"?"Env Badge":n.find(g=>g.id===f)?.name??f.toUpperCase().replace(/_/g," "),"getToolLabel"),O=i(f=>{if(!F)return null;switch(f){case"query":return p(Fa,{size:18});case"env":return p(Sn,{size:18});case"sentry":return p(Sa,{size:18,color:"#9945FF"});case"storage":return p(Ea,{size:18,bgColor:b.color.surface});case"wifi":case"query-wifi-toggle":return p(xa,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return p(Pa,{size:18,bgColor:b.color.surface});case"network":return p(La,{size:18});case"environment":return p(Sn,{size:18});case"debug-borders":return p(Ia,{size:18,color:b.color.accent});case"highlight-updates":return p(Ta,{size:18,color:b.color.accent});case"highlight-updates-modal":return p($a,{size:18});case"redux":return p(ja,{size:18});case"image-overlay":return p(wa,{size:18});case"events":return p(Na,{size:18});case"zustand":try{let{ZustandIcon:g}=zo("@buoy-gg/zustand/web");return p(g,{size:18})}catch{return p(Vt,{size:18,color:b.color.textSecondary})}case"jotai":try{let{JotaiIcon:g}=zo("@buoy-gg/jotai/web");return p(g,{size:18})}catch{return p(Vt,{size:18,color:b.color.textSecondary})}default:{let g=n.find(z=>z.id===f);return g?.icon!=null?Xt(g.icon,{slot:"row",size:18,color:g.color}):p(Vt,{size:18,color:b.color.textSecondary})}}},"getToolIcon"),a=i((f,g,z,X)=>{let se=ge(f);return N(dt,{activeOpacity:z?1:.7,onPress:()=>!z&&X(),accessibilityLabel:ke(f),accessibilityRole:"button",style:[y.toolRow,z&&y.rowDisabled],children:[p(_,{style:y.toolIconSlot,children:O(f)}),N(_,{style:y.rowInfo,children:[N(U,{style:y.rowLabel,children:[ke(f),z?" \xB7 max 6":""]}),se?p(U,{style:y.rowCaption,numberOfLines:1,children:se}):null]}),p(bn,{value:g,disabled:z,onValueChange:()=>X(),accessibilityLabel:ke(f)})]},f)},"renderToolRow"),w=i(f=>{k(g=>{let z=new Set(g);return z.has(f)?z.delete(f):z.add(f),z})},"toggleSettingExpanded"),A=i((f,g,z,X,se)=>{let Xe=h.globalSettings?.[f]??false,Se=E.has(f);return N(_,{children:[N(dt,{activeOpacity:.7,onPress:()=>w(f),accessibilityLabel:g,style:y.settingRow,children:[N(_,{style:y.rowInfo,children:[p(U,{style:y.rowLabel,children:g}),p(U,{style:y.rowCaption,numberOfLines:Se?0:1,children:z})]}),p(bn,{value:Xe,onValueChange:()=>je(f),accessibilityLabel:g})]}),Se&&N(_,{style:y.settingRowBody,children:[p(U,{style:y.settingRowBodyText,children:X}),p(U,{style:y.settingRowBodyHint,children:se})]})]},f)},"renderGlobalSettingRow"),H=i((f,g,z)=>N(_,{children:[p(Da,{children:f}),g,z]}),"renderSection"),q=G==="filesystem"?p(ye,{label:"File System",tone:"accent"}):G==="asyncstorage"?p(ye,{label:"Async Storage",tone:"warning"}):G==="localstorage"?p(ye,{label:"Local Storage",tone:"accent"}):G==="memory"?p(ye,{label:"Memory",tone:"danger"}):p(ye,{label:"Loading\u2026",tone:"neutral"}),J=i(()=>N(_,{style:y.container,children:[N(Io,{style:y.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:y.scrollContainer,children:[I==="floating"&&p(et,{children:H("Floating Tools",p(Le,{glass:true,children:p(Gt,{children:Object.entries(h.floatingTools).map(([f,g])=>a(f,g,false,()=>Je(f)))})}),p(yn,{children:"Tools switched on here appear in the floating bubble row."}))}),I==="settings"&&N(et,{children:[H("Background",p(Le,{glass:true,padded:true,children:p(Ra,{embedded:true})})),H("Storage",N(Le,{glass:true,children:[N(dt,{activeOpacity:.7,onPress:()=>W(!re),accessibilityLabel:"Storage Type",style:y.settingRow,children:[p(_,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"Storage Type"})}),q,re?p(gn,{size:16,color:b.color.textTertiary}):p(mn,{size:16,color:b.color.textTertiary})]}),re&&N(et,{children:[N(_,{style:y.settingRowBody,children:[p(U,{style:y.settingRowBodyText,children:G==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":G==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":G==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":G==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),G==="asyncstorage"&&p(U,{style:[y.settingRowBodyText,y.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),G==="memory"&&p(U,{style:[y.settingRowBodyText,y.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),p(Oa,{}),N(_,{style:y.storageExpanded,children:[N(_,{style:y.storageExpandedHeader,children:[p(U,{style:y.storageExpandedTitle,children:"SAVED SETTINGS"}),p(U,{style:y.storageExpandedCount,children:Te?"\u2026":`${fe.length} keys`})]}),Te?p(U,{style:y.storageKeyEmpty,children:"Loading\u2026"}):fe.length===0?p(U,{style:y.storageKeyEmpty,children:"No settings saved yet"}):p(Io,{style:y.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:fe.map(f=>p(_,{style:y.storageKeyItem,children:p(U,{style:y.storageKeyText,numberOfLines:1,children:f.replace("@react_buoy_","")})},f))})]}),p(_,{style:y.cardButtonWrap,children:p(qt,{label:we?"Cleared":Z?"Clearing\u2026":"Clear All Settings",variant:we?"secondary":"destructive",size:"md",disabled:Z,onPress:ve,icon:we?p(hn,{size:15,color:b.color.accent}):p(Aa,{size:15,color:Z?b.color.textTertiary:b.color.danger})})})]})]})),T&&T.state!=="idle"&&H("Desktop Sync",N(Le,{glass:true,children:[N(dt,{activeOpacity:.7,onPress:()=>w("desktopSync"),accessibilityLabel:"Buoy Desktop",style:y.settingRow,children:[p(_,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"Buoy Desktop"})}),T.state==="connected"?p(ye,{label:"Connected",tone:"accent"}):T.state==="connecting"?p(ye,{label:"Connecting\u2026",tone:"neutral"}):p(ye,{label:"Retrying",tone:"warning"}),E.has("desktopSync")?p(gn,{size:16,color:b.color.textTertiary}):p(mn,{size:16,color:b.color.textTertiary})]}),E.has("desktopSync")&&N(_,{style:y.settingRowBody,children:[N(U,{style:y.settingRowBodyText,children:[T.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",p(U,{style:y.footnoteMono,children:T.targetURL??"(unknown URL)"}),T.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),T.state==="retrying"&&T.lastError&&N(U,{style:[y.settingRowBodyText,y.bodyWarning],children:["Last error: ",T.lastError]})]})]})),H("Modal Behavior",p(Le,{glass:true,children:N(Gt,{children:[A("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."),Ya(Ne.OS==="web")?A("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]})}))]}),I==="pro"&&N(et,{children:[H("License",N(Le,{glass:true,children:[N(_,{style:y.settingRow,children:[p(_,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"License Status"})}),p(_,{testID:"buoy-settings-license-status",accessibilityLabel:V?"License: Active":"License: Free",children:V?p(ye,{label:"Active",tone:"accent"}):p(ye,{label:"Free",tone:"neutral"})})]}),ee?.tierSource==="session"?N(_,{style:y.settingRow,children:[p(_,{style:y.rowInfo,children:p(U,{style:y.rowLabel,children:"Signed in with Buoy"})}),p(qt,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void ka(),testID:"buoy-settings-signout"})]}):null,ee?.teamRole?p(_,{style:y.settingRow,testID:"buoy-settings-team-role",children:N(_,{style:y.rowInfo,children:[N(U,{style:y.rowLabel,children:["Role: ",ee.teamRole]}),p(U,{style:y.rowCaption,children:ee.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),p(yn,{children:V?"You have full access to all Buoy DevTools features.":K?Y?`Couldn't reach the license server (${K}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${K}.`:"Upgrade to Pro to unlock all features and support development."})),!V&&N(et,{children:[H("Pro Features",p(Le,{glass:true,children:p(Gt,{children:["Advanced Settings","Priority Support"].map(f=>N(_,{style:y.featureRow,children:[p(hn,{size:16,color:b.color.accent}),p(U,{style:y.rowLabel,children:f})]},f))})})),p(qt,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>C(true)})]})]})]}),p(Ba,{visible:v,onClose:()=>C(false)})]}),"renderContent");return p(Ga,{visible:e,onClose:t,zIndex:l,variant:"night",header:{showToggleButton:false,customContent:p(_,{style:y.headerRow,children:p(Ma,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:I,onChange:f=>R(f)})})},initialMode:"bottomSheet",onModeChange:De,persistenceKey:Qt.settings.root(),enablePersistence:true,maxHeight:oe-pe.top,initialHeight:me,initialFloatingPosition:{x:(Ie-ae)/2,y:pe.top+20},enableGlitchEffects:true,children:J()})},"DevToolsSettingsModal"),ts={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}},os=i((e,t)=>{let o=new Set(e??[]),r=new Set(t??[]),n={};for(let l of r)n[l]=true;let s={environment:o.has("environment")};for(let l of o)l!=="environment"&&(s[l]=true);return{dialTools:xt(n),floatingTools:s,globalSettings:{enableSharedModalDimensions:false}}},"createDefaultsFromConfig"),tt=null,Zt=null,Cn=null,zn=i((e,t)=>JSON.stringify(e)===JSON.stringify(t),"sameSettings");St.addListener(e=>{e&&(tt=e)});var kn=i(()=>{let{defaultFloatingTools:e,defaultDialTools:t}=Jt(),o=vt(()=>!e&&!t?ts:os(e,t),[e,t]),[r,n]=ie(o),s=bt(async()=>{try{let c=await Pe.getItem(Ge);if(c){let d=JSON.parse(c),u=In(o,d);n(u);return}n(o)}catch(c){console.error("[Buoy]","Failed to load dev tools settings:",c),n(o)}},[o]);Ae(()=>qa(c=>{c.includes(Ge)&&s()}),[s]),Ae(()=>{s();let c=St.addListener(d=>{try{d&&n(d)}catch{}});return()=>{c()}},[s]);let l=bt(()=>{s()},[s]);return{settings:r,refreshSettings:l}},"useDevToolsSettings"),y=ct.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:b.gutter,paddingRight:b.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:b.gutter,paddingTop:8,paddingBottom:24,gap:b.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:b.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:b.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:b.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:b.color.text,fontSize:b.font.row,fontWeight:"500"},rowCaption:{color:b.color.textTertiary,fontSize:b.font.label},settingRowBody:{paddingHorizontal:b.rowPadH,paddingBottom:b.rowPadV,gap:6},settingRowBodyText:{color:b.color.textSecondary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},settingRowBodyHint:{color:b.color.textTertiary,fontSize:b.font.caption,lineHeight:b.font.caption*1.45},bodyWarning:{color:b.color.warning},bodyDanger:{color:b.color.danger},cardButtonWrap:{paddingHorizontal:b.cardPad,paddingTop:10,paddingBottom:b.cardPad},storageExpanded:{paddingHorizontal:b.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:b.color.textSecondary,fontSize:b.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:b.color.textTertiary,fontSize:b.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:b.color.glassElevated,borderRadius:b.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:b.color.textSecondary,fontSize:b.font.micro,fontFamily:vn},storageKeyEmpty:{color:b.color.textTertiary,fontSize:b.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:vn,fontSize:b.font.label,color:b.color.textSecondary}});import{jsx as An}from"react/jsx-runtime";var ns=[];function eo({visible:e,onClose:t,availableTools:o=ns,defaultFloatingTools:r,defaultDialTools:n,storage:s=ga,onSettingsChange:l}){let c=pn(()=>({getItem:i(async m=>s.getItem(m),"getItem"),setItem:i(async(m,S)=>s.setItem(m,S),"setItem")}),[s]),d=pn(()=>o.map(m=>({...m,name:m.name??m.id,icon:typeof m.icon=="function"?S=>m.icon(S.size):m.icon})),[o]),u=ma(m=>{l?.(m)},[l]);return An(Yt,{defaultFloatingTools:r,defaultDialTools:n,children:An(es,{visible:e,onClose:t,zIndex:11e3,availableApps:d,storage:c,onSettingsChange:u})})}i(eo,"SettingsModal");import{listenBuoyKeydown as rs}from"@buoy-gg/shared-ui/web/floating";import{persistentStorage as Bn,setExpandableWindowControls as is}from"@buoy-gg/shared-ui/web";import{createContext as as,useCallback as Be,useContext as ss,useEffect as wt,useMemo as ls,useRef as ot,useState as Rn}from"react";var cs=i((e,t,o)=>{if(t.singleton){let n=e.find(s=>s.id===t.id);if(n){let s=n.minimized??false;return{instanceId:n.instanceId,wasMinimized:s,apps:[...e.filter(l=>l.instanceId!==n.instanceId),{...n,minimized:false}]}}}let r=o();return{instanceId:r,wasMinimized:false,apps:[...e,{...t,instanceId:r}]}},"resolveOpenAppsState");import{createContext as ds,useCallback as Dn,useContext as us,useEffect as Tt,useMemo as ps,useRef as Mn,useState as It}from"react";import{JsModal as fs,ModalHeader as nt,HeaderSearchButton as ms,TickProvider as gs,ToolScreenHeaderContext as hs,devToolsStorageKeys as On,buoyColors as En,gameUIColors as to}from"@buoy-gg/shared-ui/web";import{jsx as le,jsxs as Ct}from"react/jsx-runtime";var rt=i(()=>{},"noop"),ys={search:"",isSearchActive:false,clearSearch:rt,close:rt,minimize:rt,showToast:rt,setHeaderOverride:rt},Pn=ds(null);function oo(){return us(Pn)??ys}i(oo,"useToolHost");function Ln(e,t){let{setHeaderOverride:o}=oo();Tt(()=>(o(e),()=>o(null)),t)}i(Ln,"useToolHeader");var Fn=2200,bs={success:to.success,error:to.error,info:to.info};function $n({message:e,type:t,nonce:o}){let r=Mn(new Me.Value(0)).current;Tt(()=>{r.setValue(0),Me.sequence([Me.timing(r,{toValue:1,duration:150,useNativeDriver:true}),Me.delay(Fn-450),Me.timing(r,{toValue:0,duration:300,useNativeDriver:true})]).start()},[o,r]);let n=bs[t];return Ct(Me.View,{pointerEvents:"none",style:[zt.toast,{opacity:r,borderColor:n+"60"}],children:[le(_,{style:[zt.toastDot,{backgroundColor:n}]}),le(U,{style:zt.toastText,numberOfLines:2,children:e})]})}i($n,"ToastView");function jn({app:e,config:t,visible:o,zIndex:r,onClose:n,onMinimize:s,initialModalState:l,enableSharedModalDimensions:c,bodyProps:d}){let u=e.component,[m,S]=It(false),[h,B]=It(""),[I,R]=It(null),[L,M]=It(null),E=Mn(null),k=Dn(()=>{S(false),B("")},[]),v=Dn((G,ne="info")=>{E.current&&clearTimeout(E.current),M(Z=>({message:G,type:ne,nonce:(Z?.nonce??0)+1})),E.current=setTimeout(()=>M(null),Fn)},[]);Tt(()=>()=>{E.current&&clearTimeout(E.current)},[]);let C=ps(()=>({search:m?h:"",isSearchActive:m,clearSearch:k,close:n,minimize:i(()=>s(),"minimize"),showToast:v,setHeaderOverride:R,instanceId:e.instanceId}),[h,m,k,n,s,v,e.instanceId]),F=I?.title??t.title??e.title??e.id,D=I?.subtitle??t.subtitle,T=I?.onBack,ee=I?.actions??t.headerActions,V=I?.searchable??t.searchable;Tt(()=>{!V&&m&&k()},[V,m,k]);let K=c?On.modal.root():On.custom(e.id).modal(),Y=Ct(nt,{children:[T&&!m&&le(nt.Navigation,{onBack:T}),m?le(nt.Search,{value:h,onChangeText:B,onCancel:k,placeholder:t.searchPlaceholder,testID:`tool-search-field-${e.id}`}):le(nt.Content,{title:F,subtitle:D}),Ct(nt.Actions,{children:[!m&&ee,V&&!m&&le(ms,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>S(true)})]})]});return le(Pn.Provider,{value:C,children:le(fs,{visible:o,onClose:n,onBack:T,onMinimize:s,initialModalState:l,zIndex:r,persistenceKey:K,enablePersistence:true,initialMode:t.initialMode??"bottomSheet",header:{customContent:Y,showToggleButton:true},disableScrollWrapper:true,styles:{},children:Ct(_,{style:zt.bodyRoot,children:[le(gs,{children:le(hs.Provider,{value:R,children:le(u,{...d})})}),L&&le($n,{message:L.message,type:L.type,nonce:L.nonce})]})})})}i(jn,"ToolModalShell");var zt=ct.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:En.card,borderWidth:1,borderRadius:8,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOpacity:.4,shadowRadius:8,shadowOffset:{width:0,height:2},elevation:6},toastDot:{width:6,height:6,borderRadius:3},toastText:{flex:1,fontSize:12,color:En.text}});import{useEffect as vs,useRef as Ss}from"react";import{capacitorPlatform as xs,capacitorPlugin as ws}from"@buoy-gg/license/web";function Nn(){return globalThis.__BUOY_HOLDS_BACK__===true}i(Nn,"isBuoyHoldingBackButton");var Ts=99.5;function _n(){if(typeof document>"u")return false;let e=globalThis.Ionic;if(!e&&!document.querySelector("ion-app"))return false;try{return e?.config?.get?.("hardwareBackButton",true)!==false}catch{return true}}i(_n,"ionicHandlesBack");function Hn(e,t){let o=Ss(t);o.current=t,vs(()=>{if(!e||xs()!=="android")return;let r=globalThis;r.__BUOY_HOLDS_BACK__=true;let n;if(_n()){let s=i(l=>{l.detail?.register?.(Ts,()=>{o.current()})},"listener");document.addEventListener("ionBackButton",s),n=i(()=>document.removeEventListener("ionBackButton",s),"cleanup")}else{let s=ws("App");if(!s?.addListener){r.__BUOY_HOLDS_BACK__=false;return}let l=false,c=null;Promise.resolve(s.addListener("backButton",()=>o.current())).then(d=>{l?d.remove():c=d}).catch(()=>{}),n=i(()=>{l=true,c&&c.remove()},"cleanup")}return()=>{n(),r.__BUOY_HOLDS_BACK__=false}},[e])}i(Hn,"useCapacitorBackButton");import{Fragment as Is,jsx as ce}from"react/jsx-runtime";var Wn=as(null),Un="@react_buoy_open_apps",no=44,Cs=12,zs=100,ks=16,As=i(e=>({x:window.innerWidth-no-ks,y:window.innerHeight-zs-no-e*(no+Cs)}),"dockIconPosition"),Kn=i(({children:e})=>{let[t,o]=Rn([]),[r,n]=Rn(false),s=ot([]),l=ot(null),c=ot(false),d=ot(false),u=ot(false),m=Be(v=>{let C="";return o(F=>{let{apps:D,instanceId:T}=cs(F,v,()=>`${v.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);return C=T,D}),C},[]),S=Be(()=>{if(c.current||!d.current||!u.current)return;c.current=true;let v=l.current;if(!v||v.length===0){n(true);return}l.current=null,v.forEach(({id:C,minimized:F})=>{let D=s.current.find(T=>T.id===C);if(D&&D.component){let T=Xt(D.icon,{slot:"dial",size:20,color:D.color});m({id:D.id,title:D.name,component:D.component,props:D.props,modal:D.modal,launchMode:D.launchMode||"self-modal",singleton:D.singleton??true,icon:T,color:D.color,minimized:F})}}),n(true)},[m]);wt(()=>{let v=false;return i(async()=>{try{let C=await Bn.getItem(Un);if(v)return;if(C){let F=JSON.parse(C),D;Array.isArray(F)&&F.length>0&&(typeof F[0]=="string"?D=F.map(T=>({id:T,minimized:false})):D=F.filter(T=>typeof T=="object"&&T!==null&&typeof T.id=="string"),D.length&&(l.current=D))}}catch{}v||(d.current=true,S())},"restoreOpenApps")(),()=>{v=true}},[S]),wt(()=>{if(!r)return;let v=t.map(C=>({id:C.id,minimized:C.minimized??false}));Bn.setItem(Un,JSON.stringify(v))},[t,r]);let h=Be(v=>{s.current=v,u.current=true,S()},[S]),B=Be(v=>{o(C=>C.length?v?C.filter(F=>F.instanceId!==v):C.slice(0,-1):C)},[]),I=Be(()=>o([]),[]),R=Be((v,C)=>{o(F=>F.map(D=>D.instanceId===v?{...D,minimized:true,restoreState:C}:D))},[]),L=Be((v,C)=>{o(F=>{let D=F.find(T=>T.instanceId===v);return D?[...F.filter(T=>T!==D),{...D,minimized:false,restoreState:C??D.restoreState}]:F})},[]),M=Be(v=>t.find(C=>C.instanceId===v)?.minimized??false,[t]),E=t.some(v=>v.launchMode!=="toggle-only"&&!v.minimized);wt(()=>E?rs(i(v=>{if(v.key!=="Escape"||v.defaultPrevented)return;let C=[...t].reverse().find(F=>F.launchMode!=="toggle-only"&&!F.minimized);C&&B(C.instanceId)},"handler")):void 0,[E,B,t]),Hn(t.length>0,()=>B());let k=ls(()=>({openApps:t,isAnyOpen:E,open:m,close:B,closeAll:I,registerApps:h,minimize:R,restore:L,isMinimized:M}),[t,E,m,B,I,h,R,L,M]);return ce(Wn.Provider,{value:k,children:e})},"AppHostProvider"),it=i(()=>{let e=ss(Wn);return e||{openApps:[],isAnyOpen:false,open:i(()=>"","open"),close:i(()=>{},"close"),closeAll:i(()=>{},"closeAll"),registerApps:i(()=>{},"registerApps"),minimize:i(()=>{},"minimize"),restore:i(()=>{},"restore"),isMinimized:i(()=>false,"isMinimized")}},"useAppHost"),Bs=9e3,Rs={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"},Ds={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"},Ms=i(({app:e,zIndex:t,onClose:o,onMinimize:r,minimizeTargetPosition:n,enableSharedModalDimensions:s})=>{let l=e.component,c=!e.minimized,d={...e.props??{},...s?{enableSharedModalDimensions:true}:{}};return e.modal&&(!e.launchMode||e.launchMode==="self-modal")?ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:ce(jn,{app:e,config:e.modal,visible:c,zIndex:t,onClose:o,onMinimize:r,initialModalState:e.restoreState,enableSharedModalDimensions:s,bodyProps:d})}):e.launchMode==="self-modal"?ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:ce(l,{...d,visible:c,onClose:o,onRequestClose:o,onMinimize:r,minimizeTargetPosition:n,instanceId:e.instanceId,zIndex:t,initialModalState:e.restoreState})}):e.launchMode==="inline"?c?ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:ce(l,{...d,onClose:o,onMinimize:r,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})}):null:ce("div",{"data-testid":`buoy-tool-instance-${e.id}`,style:{...Rs,zIndex:t,display:c?"flex":"none"},children:ce("div",{style:Ds,children:ce(l,{...d,onClose:o,onMinimize:r,minimizeTargetPosition:n,initialModalState:e.restoreState,instanceId:e.instanceId})})})},"AppRenderer"),Vn=i(()=>{let{openApps:e,close:t,minimize:o}=it(),{settings:r}=kn();wt(()=>{is(r.globalSettings?.expandableWindowControls!==false)},[r.globalSettings?.expandableWindowControls]);let n=e.filter(c=>c.launchMode!=="toggle-only");if(n.length===0)return null;let s=n.filter(c=>c.minimized).length,l=Li()??As(s);return ce(Is,{children:n.map((c,d)=>ce(Ms,{app:c,zIndex:Bs+d,onClose:()=>t(c.instanceId),onMinimize:u=>o(c.instanceId,u),enableSharedModalDimensions:r.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:l},c.instanceId))})},"AppOverlay");import{useCallback as Os,useEffect as ro,useRef as Es,useState as Gn,useSyncExternalStore as qn}from"react";import{persistentStorage as Yn,getToolAttention as io,subscribeToolAttention as Jn}from"@buoy-gg/shared-ui/web";import{jsx as de,jsxs as kt}from"react/jsx-runtime";function Xn(e){return qn(Jn,()=>io(e),()=>io(e))}i(Xn,"useToolAttention");var Qn={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"},Zn={needsInput:3,failed:2,done:1},er=new Map;function ao(e){let t=null;for(let r of e?e.split("|"):[]){let n=io(r);n&&(!t||Zn[n.kind]>Zn[t.kind])&&(t=n)}let o=er.get(e);return o&&t&&o.kind===t.kind&&o.label===t.label?o:!o&&!t?null:(er.set(e,t),t)}i(ao,"strongest");function tr(e){let t=e.join("|");return qn(Jn,()=>ao(t),()=>ao(t))}i(tr,"useStrongestAttention");var or=28,so=32,lo=6,nr=8,rr=24,ir="@react_buoy_minimized_stack_expanded",Ps=80,ar=2e3,Ls=6e3,Fs="#1A1A1A",at="#888888";function co({down:e=false}){return de("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:de("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:at,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}i(co,"ChevronGlyph");function sr({id:e,title:t,icon:o,index:r,onPress:n}){let s=Xn(e),l=Es(null);return ro(()=>{let c=true,d,u=i(()=>{l.current?.animate([{transform:"translateX(0) scale(1)",opacity:1,offset:0},{transform:"translateX(3px) scale(1.05)",opacity:.4,offset:.2},{transform:"translateX(-3px) scale(1.1)",opacity:1,offset:.4},{transform:"translateX(2px) scale(1.0)",opacity:.6,offset:.6},{transform:"translateX(-1px) scale(0.95)",opacity:1,offset:.8},{transform:"translateX(0) scale(1)",opacity:1,offset:1}],{duration:Ps,easing:"linear"})},"runGlitch"),m=i(S=>{let h=S?500+Math.random()*1500+r*200:ar+Math.random()*(Ls-ar)+r*300;d=setTimeout(()=>{c&&(u(),m(false))},h)},"schedule");return m(true),()=>{c=false,clearTimeout(d)}},[r]),kt("button",{type:"button","aria-label":s?`${t} \u2014 ${s.label}. Restore`:`Restore ${t}`,"data-testid":`buoy-dock-restore-${e}`,onClick:n,style:{width:so,height:so,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[de("div",{ref:l,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:o}),s?de("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${s.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Qn[s.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:s.kind==="needsInput"?"!":""}):null]})}i(sr,"GlitchToolButton");function lr({containerWidth:e=32}){let{openApps:t,restore:o}=it(),r=t.filter(h=>h.minimized&&h.launchMode!=="toggle-only"),[n,s]=Gn(false),[l,c]=Gn(false),d=tr(r.map(h=>h.id));ro(()=>{let h=false;return i(async()=>{let B=await Yn.getItem(ir);!h&&B==="true"&&s(true),h||c(true)},"load")(),()=>{h=true}},[]),ro(()=>{l&&Yn.setItem(ir,n?"true":"false")},[n,l]);let u=Os(h=>{o(h)},[o]);if(r.length===0)return null;let m=nr+r.length*so+(r.length-1)*lo+lo+rr+4,S={backgroundColor:Fs,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${at}66`,borderLeft:`1px solid ${at}66`,borderRight:`1px solid ${at}66`,borderBottom:"none",boxSizing:"border-box"};return kt("div",{style:{height:or,overflow:"visible",position:"relative"},children:[de("div",{style:{position:"absolute",bottom:"var(--buoy-stack-bottom, 0px)",top:"var(--buoy-stack-top, auto)",left:0,width:e,maxHeight:"var(--buoy-stack-space, calc(100vh - 48px))",visibility:n?"visible":"hidden",height:n?m:0,opacity:n?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:n?"auto":"none",...S},children:kt("div",{style:{height:m,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:nr,gap:lo,boxSizing:"border-box"},children:[n&&[...r].reverse().map((h,B)=>de(sr,{id:h.id,title:h.title||h.id,icon:h.icon??de("span",{style:{color:"#fff",fontSize:13},children:(h.title||h.id).slice(0,1).toUpperCase()}),index:B,onPress:()=>u(h.instanceId)},h.instanceId)),de("button",{type:"button","aria-label":"Collapse","data-testid":"buoy-dock-collapse",onClick:()=>s(false),style:{width:"100%",height:rr,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:de(co,{down:true})})]})}),kt("button",{type:"button","aria-label":`Show ${r.length} minimized tools`,"data-testid":"buoy-dock-peek",tabIndex:n?-1:0,"aria-hidden":n,onClick:()=>s(true),style:{position:"absolute",bottom:0,left:0,width:e,height:or,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",padding:0,opacity:n?0:1,transform:n?"scale(0.9)":"scale(1)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:n?"none":"auto",...S},children:[de(co,{}),d?de("span",{"aria-hidden":true,"data-testid":"buoy-dock-peek-attention",style:{position:"absolute",top:2,right:2,minWidth:11,height:11,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Qn[d.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:d.kind==="needsInput"?"!":""}):null,r.length>1&&de("span",{style:{fontSize:9,fontWeight:600,color:at,marginLeft:1},children:r.length})]})]})}i(lr,"MinimizedToolsStack");import{registerToolModules as $s}from"@buoy-gg/shared-ui/web";import{createElement as js}from"react";function qe(e){let t=e.icon;return{...e,icon:typeof t=="function"?o=>js(t,{size:o,slot:e.slot??"both",color:e.color}):()=>t}}i(qe,"createWebTool");import{createContext as Ns,useContext as _s,useState as cr,useMemo as dr}from"react";import{jsx as Hs}from"react/jsx-runtime";var ur=Ns(null);function uo({children:e}){let[t,o]=cr(false),[r,n]=cr(false),s=dr(()=>t||r,[t,r]),l=dr(()=>({isDialOpen:t,isToolOpen:r,isDevToolsActive:s,setDialOpen:o,setToolOpen:n}),[t,r,s]);return Hs(ur.Provider,{value:l,children:e})}i(uo,"DevToolsVisibilityProvider");function At(){let e=_s(ur);return e||{isDialOpen:false,isToolOpen:false,isDevToolsActive:false,setDialOpen:i(()=>{},"setDialOpen"),setToolOpen:i(()=>{},"setToolOpen")}}i(At,"useDevToolsVisibility");import*as Ws from"@buoy-gg/license/web";import*as Us from"@buoy-gg/shared-ui/web";import*as Ks from"@buoy-gg/shared-ui/web/dataViewer";function po(e){$s({core:{useDevToolsVisibility:At},license:Ws,"shared-ui":Us,"shared-ui/dataViewer":Ks,...e});let t=new Set;return Object.values(e).flatMap(o=>Object.entries(o).flatMap(([r,n])=>!r.endsWith("Preset")||!n||typeof n.id!="string"||!n.component||t.has(n.id)?[]:(t.add(n.id),[qe(n)])))}i(po,"createWebTools");import{useEffect as Bt,useMemo as Rt,useRef as Vs}from"react";import{LicenseManager as pr,installCapacitorBridge as Gs,resolveDevBuild as fr,useLicense as qs}from"@buoy-gg/license/web";import{registerToolAdapters as Ys}from"@buoy-gg/shared-ui/web";function fo(e){return typeof e=="object"&&e!==null?e:void 0}i(fo,"externalSyncOptions");function mr({isDevelopment:e,isLicensed:t,externalSync:o,isAvailable:r}){if(o===false||!r)return false;if(e)return true;let n=fo(o);return t&&n?.enableInRelease===true&&mo(n.socketURL,n)===null}i(mr,"shouldMountExternalSync");var gr="http://localhost:42831";function hr(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}i(hr,"isLoopbackHost");function mo(e,t){let o=e??gr;if(t?.allowInsecureNetwork===true)return null;let r;try{r=new URL(o)}catch{return`[Buoy] externalSync.socketURL "${o}" isn't a valid URL, so this release build won't connect to Buoy Desktop.`}return r.protocol==="https:"||r.protocol==="wss:"||hr(r.hostname)?null:`[Buoy] This release build won't connect to ${o}: release sync carries real user data, and plain http to another machine is readable by anyone on the same network. Use a simulator, an emulator or adb reverse (localhost), an https:// broker, or set externalSync.allowInsecureNetwork: true for a network you trust.`}i(mo,"releaseTransportProblem");var Js={impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};function yr(e,t,o){if(t)return e;let r=null;for(let[n,s]of Object.entries(Js)){if(o?.includes(n))continue;let l=e[n];if(!l?.actions)continue;let c={...l.actions};for(let d of s)d in c&&(c[d]=()=>{throw new Error(`${n}.${d} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)});r??(r={...e}),r[n]={...l,actions:c}}return r??e}i(yr,"applyReleaseActionPolicy");import{useEffect as Xs,useMemo as Qs,useState as Zs}from"react";import{devToolsStorageKeys as el,persistentStorage as tl}from"@buoy-gg/shared-ui/web";import{isCapacitorNative as ol}from"@buoy-gg/license/web";var nl=8;function br(){let e="";for(;e.length<nl;)e+=(Math.random()*16|0).toString(16);return e}i(br,"generateInstallId");function vr(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}i(vr,"slugify");function Sr({appName:e,hardwareName:t,platform:o,installId:r,deviceId:n}){let s=vr(e??"buoy")||"buoy",l=e??"Buoy Device",c=t?.trim()||o;return n?{deviceId:n,deviceName:`${l} (${c})`}:{deviceId:`${s}-${o}-${r}`,deviceName:`${l} (${c} \xB7 ${r.slice(-4)})`}}i(Sr,"buildDeviceIdentity");function xr(){let e=globalThis;try{return e.sessionStorage??null}catch{return null}}i(xr,"sessionStore");function wr(){let e=globalThis;try{return e.localStorage??null}catch{return null}}i(wr,"localStore");async function Tr({platform:e=Ne.OS,store:t,mint:o=br}={}){let r=el.sync.deviceId(),n=t===void 0?ol()?wr():e==="web"?xr():tl:t;if(!n)return o();try{let s=await n.getItem(r);if(s&&s.length>0)return s;let l=o();return await n.setItem(r,l),l}catch{return o()}}i(Tr,"loadInstallId");var go=null;function Ir(){return go||(go=Tr()),go}i(Ir,"getInstallId");function Cr(e,t){let o=e?.deviceId,r=e?.deviceName,n=t.loadId??Ir,s=t.platform??Ne.OS,[l,c]=Zs(null);return Xs(()=>{if(o)return;let d=false;return n().then(u=>{d||c(u)}),()=>{d=true}},[o,n]),Qs(()=>{if(!o&&!l)return null;let d=Sr({appName:t.appName,hardwareName:t.hardwareName,platform:s,installId:l??"",deviceId:o});return r?{...d,deviceName:r}:d},[o,r,l,t.appName,t.hardwareName,s])}i(Cr,"useDeviceIdentity");import{useEffect as rl,useState as il}from"react";import{capacitorPlatform as al,capacitorPlugin as Dt,isCapacitorNative as sl}from"@buoy-gg/license/web";function zr(e,t){if(t==="ios")return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":null;let o=/Android [\d.]+;\s*([^;)]+?)(?:\s+Build\/|\))/.exec(e)?.[1]?.trim();return!o||o==="K"?null:o}i(zr,"hardwareFromUserAgent");function kr(e){return/sdk_gphone|Android SDK built for|Android ATD built for|google_sdk|Emulator|generic_/i.test(e)}i(kr,"isAndroidEmulatorUserAgent");function ho(){return typeof navigator>"u"?"":navigator.userAgent??""}i(ho,"userAgent");function Mt(){return typeof document>"u"?null:document.title||(typeof location>"u"?null:location.hostname)||null}i(Mt,"firstPageTitle");var Ar="@react_buoy_capacitor_app_name";function Br(e){try{let t=globalThis.localStorage;if(!t)return e;let o=t.getItem(Ar);if(o)return o;e&&t.setItem(Ar,e)}catch{}return e}i(Br,"persistedAppName");function Rr(){let e=al();if(!e)return{platform:"web",appName:Mt(),hardwareName:"Browser",ready:true};let t=!!Dt("App");return{platform:e,appName:t?Mt():Br(Mt()),hardwareName:zr(ho(),e)??e,extraDeviceInfo:{runtime:"capacitor"},ready:!t&&!Dt("Device")}}i(Rr,"initialHostInfo");function Dr(){let[e,t]=il(Rr);return rl(()=>{if(!sl())return;let o=false,r=Dt("App"),n=Dt("Device");return Promise.all([r?.getInfo?.().catch(()=>null)??null,n?.getInfo?.().catch(()=>null)??null]).then(([s,l])=>{if(o)return;let c=s?.name?.trim(),d=l?.name?.trim()||l?.model?.trim();t(u=>({...u,appName:c||u.appName,hardwareName:d||u.hardwareName,ready:true}))}),()=>{o=true}},[]),e}i(Dr,"useHostInfo");function yo(){if(typeof location>"u")return null;let e=globalThis.WEBVIEW_SERVER_URL;return{protocol:location.protocol,hostname:location.hostname,origin:`${location.protocol}//${location.host}`,userAgent:ho(),serverUrl:typeof e=="string"?e:null}}i(yo,"pageInfo");function bo(e){if(!e)return null;try{let t=new URL(e);return`${t.protocol}//${t.host}`}catch{return null}}i(bo,"schemeHost");function Mr(e,t){if(e==="ios"){let o=bo(t.serverUrl);return o?o===bo(t.origin):t.protocol==="capacitor:"}return Or.has(t.hostname)}i(Mr,"isBundledPage");var Or=new Set(["localhost","127.0.0.1","[::1]","::1"]);function Er(e,t,o,r=yo()){if(o==="web"||!r)return e;let n;try{n=new URL(e)}catch{return e}let s=Mr(o,r);return!t&&s&&n.hostname===r.hostname&&(n.hostname="localhost"),o==="android"&&Or.has(n.hostname)&&kr(r.userAgent)&&(n.hostname="10.0.2.2"),n.toString().replace(/\/$/,"")}i(Er,"capacitorBrokerURL");function Pr(e,t,o=yo()){return t!=="android"||!o||o.protocol!=="https:"||!/^(http|ws):/i.test(e)?null:`[Buoy] Can't reach Buoy Desktop at ${e}. This Android WebView serves the app from https://${o.hostname} and blocks plain http/ws by default. For debug builds, set android.allowMixedContent: true and server.cleartext: true in capacitor.config, then run cap sync.`}i(Pr,"capacitorTransportProblem");import{getDevServerOrigin as ll,resolveReloadStrategy as cl,scheduleReloadApp as dl}from"@buoy-gg/shared-ui/web";var Lr=Date.now(),Fr=ll(),ul={platform:Ne.OS,isTV:Ne.isTV===true,isTVOS:Ne.isTVOS===true},$r={version:3,getSnapshot:i(()=>{let e=cl("auto");return{startedAt:Lr,devServerOrigin:Fr,device:ul,reload:{available:e!==null,strategy:e}}},"getSnapshot"),subscribe:i(e=>()=>{},"subscribe"),actions:{ping:i(()=>({ok:true,startedAt:Lr,devServerOrigin:Fr}),"ping"),reloadApp:i(e=>{let t=e??{},{strategy:o,delayMs:r}=dl({strategy:t.strategy,delayMs:t.delayMs});return{scheduled:true,strategy:o,delayMs:r}},"reloadApp")}};import{Fragment as pl,jsx as Fe,jsxs as fl}from"react/jsx-runtime";var ml=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"],gl=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];function jr(e){let t=Rt(()=>Object.fromEntries(Object.entries(e.modules).map(([r,n])=>[r.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),n])),[e.modules]),o=t["react-query"];return o?.useReactQuerySyncAdapter?Fe(Nr,{...e,modules:t,query:o}):Fe(vo,{...e,modules:t})}i(jr,"BrowserToolRuntime");function Nr(e){let t=e.query.useReactQuerySyncAdapter();return Fe(vo,{...e,queryAdapter:t})}i(Nr,"QueryRuntime");function vo({modules:e,apps:t,requiredEnvVars:o,externalSync:r,headless:n,sentryGetClient:s,queryAdapter:l}){let{isPro:c,tier:d}=qs(),u=Rt(()=>{let L={app:$r};for(let[M,E]of Object.entries(e))for(let[k,v]of Object.entries(E))k.endsWith("SyncAdapter")&&v&&typeof v=="object"&&(L[M]=v);l&&(L.query=l),e.env?.createEnvSyncAdapter&&(L.env=e.env.createEnvSyncAdapter(o??[]));for(let M of t??[])M.sync&&(L[`custom:${M.id}`]=M.sync);return L},[e,t,o,l]),m=Vs(u);m.current=u,Bt(()=>Ys(()=>m.current),[]),Bt(()=>{let L=[],M=i(E=>{let k=E?.();typeof k=="function"&&L.push(k)},"start");return M(e.network?.startNetworkCapture),M(e.storage?.startBrowserStorageCapture),M(e.assets?.startBrowserAssetCapture),M(e.three?.startThreeCapture),fr(typeof _e<"u"?_e:process.env.NODE_ENV!=="production")&&M(e["time-machine"]?.startTimeMachineFloatingToolPersistence),e.storage?.storageSyncAdapter?.subscribe&&M(()=>e.storage.storageSyncAdapter.subscribe(()=>{})),e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe&&M(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{})),()=>{for(let E of L.reverse())E()}},[e]);let S=e["external-sync"],h=fr(typeof _e<"u"?_e:process.env.NODE_ENV!=="production"),B=mr({isDevelopment:h,isLicensed:c,externalSync:r,isAvailable:!!S}),I=fo(r);Gs({release:!h&&!!I?.enableInRelease}),!h&&I?.enableInRelease&&So(mo(I.socketURL,I));let R=e.sentry?.SentryRoot;return fl(pl,{children:[Object.entries(e).flatMap(([L,M])=>ml.map(E=>{let k=M[E];return k?Fe(k,{},`${L}:${E}`):null})),R&&Fe(R,{getClient:s}),Object.entries(e).flatMap(([L,M])=>gl.map(E=>{let k=M[E];return k&&(!n||E==="ScenariosOverlay"||E==="ImpersonateOverlay")?Fe(k,{},`${L}:${E}`):null})),B&&Fe(Hr,{module:S,tools:u,options:I,isPro:c,tier:d,dev:h})]})}i(vo,"ToolRuntime");var _r=null;function So(e){!e||e===_r||(_r=e,console.warn("[Buoy]",e))}i(So,"warnOnce");function Hr({module:e,tools:t,options:o,isPro:r,tier:n,dev:s}){let l=Dr(),c=Cr(o,{appName:l.appName,hardwareName:l.hardwareName,platform:l.platform}),d=Rt(()=>Er(o?.socketURL??(s?e.getDefaultSocketURL():gr),!!o?.socketURL,l.platform),[o?.socketURL,s,e,l.platform]),{socket:u}=e.useExternalSyncSocket({deviceName:c?.deviceName??"Buoy Browser",socketURL:d,persistentDeviceId:l.ready?c?.deviceId??null:null,platform:l.platform,extraDeviceInfo:l.extraDeviceInfo,enableLogs:o?.enableLogs});Bt(()=>{let h=Pr(d,l.platform);if(!u||!h)return;let B=i(()=>So(h),"onError");return u.on("connect_error",B),()=>{u.off("connect_error",B)}},[u,d,l.platform]),Bt(()=>{if(!u)return;let h=i(()=>{if(!u.connected||!pr.hasAccountAccess())return;let B=pr.getState();!r&&(B.isInitialized===false||B.isValidating===true)||u.emit("device-license",{isPro:r?"1":"0",tier:n})},"emit");return h(),u.on("connect",h),()=>{u.off("connect",h)}},[u,r,n]);let m=o?.releaseActions?.join(",")??"",S=Rt(()=>yr(t,s,m?m.split(","):void 0),[t,s,m]);return e.useExternalSync({tools:S,socket:u,deviceId:l.ready?c?.deviceId??null:null,enableLogs:o?.enableLogs}),null}i(Hr,"BrowserExternalSync");import{useState as Wr}from"react";import{BuoyPortal as hl}from"@buoy-gg/shared-ui/web/floating";import{useBuoySession as yl}from"@buoy-gg/license/web";import{Fragment as Ur,jsx as Ye,jsxs as Kr}from"react/jsx-runtime";var Vr="#20C997";function Gr(){let{status:e,signIn:t,signOut:o}=yl(),[r,n]=Wr(false),[s,l]=Wr(null);if(typeof document>"u")return null;let c=i(()=>{l(null),n(true),t().catch(u=>l(u instanceof Error?u.message:"Sign-in did not work. Try again.")).finally(()=>n(false))},"start"),d=e.state==="active";return Ye(hl,{children:Ye("div",{"data-buoy-signin":"",style:{position:"fixed",right:"max(16px, env(safe-area-inset-right))",bottom:"max(20px, env(safe-area-inset-bottom))",zIndex:99999,maxWidth:"min(320px, calc(100vw - 32px))",padding:d||s?"12px 14px":0,borderRadius:16,background:d||s?"#0f1419":"transparent",color:"#e6edf3",boxShadow:d||s?"0 10px 30px rgba(0,0,0,.35)":"none",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",fontSize:14,lineHeight:1.45},children:d?Kr(Ur,{children:[Ye("div",{"data-testid":"buoy-signin-needs-plan",children:"Buoy on a live site needs a Pro or Business plan."}),Ye("button",{type:"button",onClick:()=>void o(),style:bl,"data-testid":"buoy-signout",children:"Sign out"})]}):Kr(Ur,{children:[s?Ye("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:s}):null,Ye("button",{type:"button",onClick:c,disabled:r,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:Vr,color:"#04130d",fontWeight:600,fontSize:14,cursor:r?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:r?"Signing in\u2026":"Sign in to Buoy"})]})})})}i(Gr,"BuoySignIn");var bl={marginTop:8,padding:0,border:"none",background:"none",color:Vr,fontSize:14,cursor:"pointer",textDecoration:"underline"};import{LicenseManager as Qc}from"@buoy-gg/license/web";var vl=false;function qr(){if(!vl){try{let e=process.env.EXPO_PUBLIC_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}}i(qr,"defaultLicenseKey");import{useState as Sl}from"react";import{AccountSetupButton as xl,BuoyNeedsPlanCard as wl,BuoySignInCard as Tl,useSignInState as Il}from"@buoy-gg/shared-ui/web";import{jsx as st,jsxs as Yr}from"react/jsx-runtime";function xo({needsPlan:e=false}){let[t,o]=Sl(false),r=Il();return Yr(_,{pointerEvents:"box-none",style:Jr.root,children:[st(xl,{expanded:t,onPress:()=>o(true)}),t?st(fi,{visible:true,transparent:true,animationType:"fade",onRequestClose:()=>o(false),children:Yr(_,{style:Jr.overlay,accessibilityViewIsModal:true,children:[st(pi,{style:ct.absoluteFill,onPress:()=>o(false),accessible:false}),e&&r==="active"?st(wl,{onClose:()=>o(false)}):st(Tl,{onClose:()=>o(false)})]})}):null]})}i(xo,"BuoySignIn");var Jr=ct.create({root:{position:"absolute",bottom:30,right:16,zIndex:99999},overlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.65)",alignItems:"center",justifyContent:"center",padding:20}});function wo(e){if(e.length>6){let t=e.map(o=>`"${o}"`).join(", ");return e.slice(0,6)}return e}i(wo,"validateDialConfig");import{installedTools as Cl,installedToolsFound as zl}from"@buoy-gg/core/web/installed-tools";import{Fragment as To,jsx as $,jsxs as lt}from"react/jsx-runtime";var Xr={},Qr="@react_buoy_floating_menu_tooltip_shown",kl=Oe;function Zr({size:e=14,color:t="#20C997"}){let o=Math.max(2,e/4),r=Math.max(1,e/16);return $("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:r,width:e,height:e,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((n,s)=>$("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:t}},s))})}i(Zr,"MenuLauncherIcon");function ei(e){let{defaultFloatingTools:t,defaultDialTools:o,disableHints:r=false,children:n}=e,s=he(()=>o&&wo(o),[o]);return $(Yt,{defaultFloatingTools:t,defaultDialTools:s,children:$(Ii,{disableHints:r,children:lt(uo,{children:[$(Kn,{children:$(ii,{...e})}),n]})})})}i(ei,"AdmittedFloatingDevTools");var Al=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function ti({modules:e=Xr}){return $(To,{children:Object.entries(e).flatMap(([t,o])=>Al.map(r=>{let n=o[r];return n?$(n,{},`${t}:${r}`):null}))})}i(ti,"StartupCapture");function oi(){let{openApps:e,restore:t}=it();return Q(()=>Ro(o=>{let r=e.find(n=>n.id===o);return r?(t(r.instanceId),true):false}),[e,t]),null}i(oi,"WebToolOpenerBridge");function ni(){let e=wi();return Ci((e===null?process.env.NODE_ENV:e?"development":"production")??"dev")}i(ni,"defaultEnvironment");function ri(e,t,o,r){let n=i(m=>Object.entries(e).find(([S])=>S.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===m)?.[1],"find"),s=[],l=n("env");t?.length&&l?.createEnvTool&&l.createEnvVarConfig&&s.push(qe(l.createEnvTool({requiredEnvVars:l.createEnvVarConfig(t)})));let c=n("storage");o?.length&&c?.createStorageTool&&s.push(qe(c.createStorageTool({requiredStorageKeys:o})));let d=n("ask-buoy"),u=r==="hosted"?d?.hostedAskBuoy?.():r;return u&&d?.createAskBuoyTool&&s.push(qe(d.createAskBuoyTool(u))),s}i(ri,"configOverrides");function ii({environment:e,userRole:t="admin",availableEnvironments:o,onEnvironmentSwitch:r,apps:n,modules:s=Xr,externalSync:l,requiredEnvVars:c,sentryGetClient:d,disableHints:u=false,headless:m=false,hidden:S=false,defaultFloatingTools:h,defaultDialTools:B,zustandStores:I,requiredStorageKeys:R,askBuoy:L}){let M=e??ni(),E=he(()=>B?wo(B):void 0,[B]),[k,v]=Pt(false),[C,F]=Pt(false),D=Do(false),T=it(),ee=he(()=>ri(s,c,R,L),[s,c,R,L]),{allowedTools:V}=ko(),K=he(()=>Mi(Lt([...po(s),...n??[],...ee]),V),[n,s,ee,V]),{openApps:Y,close:G}=T;Q(()=>{if(V)for(let a of Y)Oi(a.id,V)||G(a.instanceId)},[Y,V,G]);let ne=he(()=>Object.entries(s).find(([a])=>a.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[s]);Q(()=>{if(!I||typeof ne?.watchStores!="function")return;let a=ne.watchStores(I);return typeof a=="function"?a:void 0},[I,ne]);let Z=At(),ue=T.openApps.some(a=>!a.minimized);Q(()=>{Z.setDialOpen(k)},[k,Z.setDialOpen]),Q(()=>{Z.setToolOpen(ue||C)},[ue,C,Z.setToolOpen]);let{registerApps:we}=T;Q(()=>{we(K.map(a=>{let w=a.icon;return{...a,icon:typeof w=="function"?({size:A})=>w(A):w}}))},[we,K]);let be=he(()=>K.map(a=>({id:a.id,name:a.name,description:a.description,slot:a.slot})),[K]);ki({availableTools:be,storage:kl}),Q(()=>{let a=false;return i(async()=>{let[w,A]=await Promise.all([Oe.getItem(pt.dial.isOpen()),Oe.getItem(pt.settings.modalOpen())]);a||(w==="true"&&v(true),A==="true"&&(v(true),F(true)),D.current=true)},"restore")(),()=>{a=true}},[]),Q(()=>{D.current&&Oe.setItem(pt.dial.isOpen(),k?"true":"false")},[k]),Q(()=>{D.current&&Oe.setItem(pt.settings.modalOpen(),C?"true":"false")},[C]);let re=He(a=>{if(un(a.id),a.launchMode==="toggle-only"){a.onPress?.();return}if(a.component){let w=typeof a.icon=="function"?a.icon(20):a.icon;T.open({id:a.id,title:a.name||ut(a.id),component:a.component,props:a.props,modal:a.modal,launchMode:a.launchMode||"self-modal",singleton:a.singleton??true,icon:w,color:a.color||Mo(a.id)})}else a.onPress?.()},[T]),W=Do({tools:K,openApps:T.openApps,openTool:re});W.current={tools:K,openApps:T.openApps,openTool:re},Q(()=>Ro(a=>{let{tools:w,openApps:A,openTool:H}=W.current;if(A.some(J=>J.id===a))return false;let q=w.find(J=>J.id===a);return!q||q.launchMode==="toggle-only"?false:(H(q),true)}),[]);let fe=he(()=>ft(K,"dial").map(a=>{let w=a.color||Mo(a.id),A;return typeof a.icon=="string"?A=a.icon:typeof a.icon=="function"?A=a.icon(32):A=null,{id:a.id,name:a.name||ut(a.id),icon:A,unavailable:!a.component&&!a.onPress,color:w,onPress:i(()=>{re(a),v(false)},"onPress")}}),[K,re]),Re=he(()=>{if(!k)return fe;let a=new Map(fe.map(w=>[w.id,w]));return dn(fe.map(w=>w.id)).map(w=>a.get(w)).filter(w=>!!w)},[k,fe]),{settings:Te}=kn(),$e=he(()=>ft(K,"row").filter(a=>(Te.floatingTools[a.id]??false)===true&&(a.component||a.onPress)),[K,Te.floatingTools]),pe=he(()=>K.map(a=>({id:a.id,name:a.name||ut(a.id),description:a.description||Ai(a.id),slot:a.slot,icon:a.icon,color:a.color})),[K]),[oe,Ie]=Pt(false),me=T.openApps.some(a=>!a.minimized);Q(()=>{if(u)return;let a=false,w=setTimeout(async()=>{let A=await Oe.getItem(Qr);!a&&!A&&Ie(true)},1e3);return()=>{a=true,clearTimeout(w)}},[u]);let ae=He(()=>{Ie(false),Oe.setItem(Qr,"true")},[]),Ce=He(()=>{ae(),v(true)},[ae]),ze=He(()=>{v(false),F(false)},[]),Je=He(()=>{F(a=>!a)},[]),je=He(()=>F(false),[]),ve=!!(o?.length&&r),De=Te.floatingTools.environment!==false,ge=oe&&!k&&!me&&!S;Q(()=>{if(!ge)return;let a=i(A=>{(!(A.target instanceof Element)||!A.target.closest("[data-buoy-root]"))&&ae()},"onPointerDown"),w=i(A=>{A.key==="Escape"&&ae()},"onKeyDown");return document.addEventListener("pointerdown",a,true),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",a,true),document.removeEventListener("keydown",w)}},[ge,ae]);let ke=T.openApps.some(a=>a.minimized&&a.launchMode!=="toggle-only"),O=$(jr,{modules:s,apps:n,requiredEnvVars:c,externalSync:l,headless:m,sentryGetClient:d});return m?O:lt("div",{"data-buoy-root":"",style:{display:"contents"},children:[O,$(oi,{}),ge&&$("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),$("div",{style:S?{visibility:"hidden"}:{display:"contents"},"aria-hidden":S||void 0,children:lt(Po,{enablePositionPersistence:!ge,pushToSide:k||me,suspendPointerEvents:k,centerOnboarding:ge,minimizedStack:ke?$(lr,{}):void 0,hasMinimizedStack:ke,children:[M&&De&&!ve&&$(Bi,{environment:M}),ve&&De&&$(Ri,{currentEnvironment:M??"local",availableEnvironments:o,onSelect:r}),t?$(Lo,{userRole:t,onPress:Ce}):$("button",{"aria-label":"Open dev tools",onClick:Ce,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:$(Zr,{})}),$e.map(a=>$("button",{"aria-label":a.name||ut(a.id),title:a.description,onClick:()=>re(a),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof a.icon=="function"?a.icon(16):a.icon},a.id))]})}),ge&&$(jt,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:ae}),k&&!S&&$(Wt,{icons:Re,onClose:ze,centerLabel:"BUOY",onCenterPress:Je,settingsOpen:C,hintsDisabled:u,emptyNote:V&&Re.length===0?Ei:void 0}),C&&!S&&$(eo,{visible:true,onClose:je,availableTools:pe,defaultFloatingTools:h,defaultDialTools:E,onSettingsChange:a=>{}}),!S&<(To,{children:[$(Vn,{}),$(yi,{})]})]})}i(ii,"FloatingDevToolsInner");function ai(e){let t=e&&typeof e=="object"?e.appId:void 0,o=!!e;Q(()=>{if(!o)return;let r=false,n=bi.SessionManager;if(!n)return;let s=i(l=>{r||!l||(n.configure({audience:`app:${l}`}),n.load().catch(()=>{}))},"apply");return t?s(t):Bo().then(l=>s(l?.bundleId)).catch(()=>{}),()=>{r=true}},[o,t])}i(ai,"useCapacitorSignInAudience");function si(e){let t=e&&typeof e=="object"?e.appId:void 0;Q(()=>{let o=false;return t?Et(t):Ao()?Bo().then(r=>{o||Et(r?.bundleId)}).catch(()=>{}):typeof location<"u"&&location.origin&&location.origin!=="null"&&Et(location.origin),()=>{o=true}},[t])}i(si,"usePublishAppId");var li=false;function ci(e){return e.modules?e:(!zl&&!li&&typeof console<"u"&&(li=true,console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")),{...e,modules:Cl})}i(ci,"withInstalledTools");function di(e){return $(hi,{children:$(ui,{...ci(e)})})}i(di,"FloatingDevTools");function ui(e){let{access:t,isPro:o,licenseKey:r}=ko();Q(()=>{vi.configure(e.licenseKey??qr())},[e.licenseKey]);let n=e.licenseKey===void 0||Si(e.licenseKey,r),s=xi(typeof _e<"u"?_e:process.env.NODE_ENV!=="production"),l=n&&t.status==="admitted";Q(()=>{l&&zi()},[l]),Q(()=>{s||t.status==="initializing"||(o&&l?mi():gi())},[s,o,l,t.status]);let c=Ao();return ai(c?e.signIn:void 0),si(e.signIn),!s&&!o?!e.signIn||e.headless?null:c?$(xo,{needsPlan:true}):$(Gr,{}):l?$(ei,{...e}):lt(To,{children:[t.status==="initializing"&&$(ti,{modules:e.modules}),e.headless?null:e.signIn&&c?$(xo,{}):$(Ti,{})]})}i(ui,"FloatingDevToolsContent");export{Di as a,Oo as b,Lt as c,ft as d,Eo as e,Po as f,Pi as g,Lo as h,Wt as i,eo as j,oo as k,Ln as l,Nn as m,Kn as n,it as o,Vn as p,qe as q,uo as r,At as s,po as t,$r as u,di as v};
|
package/lib/web/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as m,b as d,c,d as p,e as C,f as g,g as y,h as f,i as S,j as T,k as v,l as h,m as b,n as D,o as B,p as P,q as k,r as w,s as E,t as H,u as M,v as i}from"./chunks/chunk-
|
|
1
|
+
"use client";import{a as m,b as d,c,d as p,e as C,f as g,g as y,h as f,i as S,j as T,k as v,l as h,m as b,n as D,o as B,p as P,q as k,r as w,s as E,t as H,u as M,v as i}from"./chunks/chunk-A6DQ5EDK.mjs";import{$ as A,A as F,Aa as L,B as R,Ba as q,C as x,Ca as I,D as U,Da as W,E as j,Ea as J,F as K,Fa as O,G as V,Ga as G,H as X,Ha as z,I as N,Ia as Q,J as Z,Ja as Y,K as _,Ka as $,L as aa,La as sa,M as ea,Ma as oa,N as ta,Na as ra,O as la,Oa as ia,P as na,Pa as ua,Q as ma,R as da,S as ca,T as pa,U as Ca,V as ga,W as ya,X as fa,Y as Sa,Z as Ta,_ as va,a as ha,aa as ba,b as Da,ba as Ba,c as Pa,ca as ka,d as wa,da as Ea,e as Ha,ea as Ma,f as Aa,fa as Fa,g as La,ga as Ra,h as qa,ha as xa,i as Ia,ia as Ua,j as Wa,ja,k as Ja,ka as Ka,l as Oa,la as Va,m as Ga,ma as Xa,n as za,na as Na,o as Qa,oa as Za,p as Ya,pa as _a,q as $a,qa as as,r as ss,ra as es,s as os,sa as ts,t as rs,ta as ls,u as is,ua as ns,v as us,va as ms,w as ds,wa as cs,x as ps,xa as Cs,y as gs,ya as ys,z as fs,za as Ss}from"./chunks/chunk-V4BVRDHL.mjs";import"./chunks/chunk-C6HZO5XT.mjs";import{c as Ts}from"./chunks/chunk-D2FYORGY.mjs";import{a as vs}from"./chunks/chunk-LOPXJLVB.mjs";import{useSettings as hs,useFloatingTools as bs,getToolLabel as Ds,getToolDescription as Bs,getToolColor as Ps,settingsColors as ks,settingsStyles as ws,dialColors as Es,dialStyles as Hs}from"@buoy-gg/floating-tools-react/web";import{LicenseManager as Ms}from"@buoy-gg/license/web";import{createRoot as As}from"react-dom/client";import{createElement as Fs}from"react";import{installedTools as Ls}from"@buoy-gg/core/web/installed-tools";import{jsx as Rs}from"react/jsx-runtime";function n({queryClient:s,...e}={}){let o=Object.values(e.modules??Ls).find(u=>u.QueryClientProvider)?.QueryClientProvider;if(s&&!o)throw new Error("Add the react-query tool to modules to use queryClient.");let a=document.createElement("div");a.dataset.buoyMount="",document.body.appendChild(a);let t=As(a),r=Rs(i,{...e});t.render(s?Fs(o,{client:s},r):r);let l=true;return()=>{l&&(l=false,t.unmount(),a.remove())}}vs(n,"mountBuoy");export{X as Activity,as as AlertCircle,N as AlertTriangle,D as AppHostProvider,P as AppOverlay,wa as Badge,es as BarChart3,is as BaseEventStore,ts as Bookmark,Z as Bug,Ia as Button,Ga as Card,_ as Check,aa as CheckCircle,$ as CheckSquare,ea as ChevronDown,ta as ChevronLeft,la as ChevronRight,na as ChevronUp,ma as Clock,ls as Cloud,Qa as CollapsibleSection,da as Copy,Wa as CopyButton,rs as DataViewer,ca as Database,w as DevToolsVisibilityProvider,S as DialMenu,La as DiffViewer,y as Divider,ns as Download,ms as Edit3,$a as EmptyState,os as EventStepperFooter,pa as Eye,Ca as EyeOff,ga as FileJson,ya as FileText,fa as Filter,Sa as FlaskConical,i as FloatingDevTools,g as FloatingTools,cs as GitBranch,Ta as Globe,Cs as HardDrive,va as Hash,ys as HelpCircle,Ss as Home,L as Image,A as Info,Aa as InfoRow,V as JsModal,ba as Key,Ba as Layers,Ms as LicenseManager,q as Link,ka as Lock,I as Maximize2,W as Minus,J as Palette,Ea as Pause,O as Pin,Ma as Play,Fa as Plus,Ra as Power,Ja as PowerToggle,xa as RefreshCw,us as RelativeTime,G as Route,Oa as Row,Ua as Search,ss as SearchBar,za as SectionHeader,z as Server,ja as Settings,T as SettingsModal,Ka as Shield,Q as Smartphone,Y as Square,Ha as StatusDot,Ya as TabSelector,sa as Timer,Va as Trash2,oa as Unlock,ra as Upload,Xa as User,f as UserStatus,ia as Users,Na as Wifi,Za as X,ua as XCircle,_a as Zap,M as appSyncAdapter,d as autoDiscoverWebPresets,c as autoDiscoverWithCustom,Ts as clearReleaseOptIn,K as copyToClipboard,k as createWebTool,H as createWebTools,m as defaultToolPresets,U as devToolsStorageKeys,Es as dialColors,Hs as dialStyles,ds as formatBytes,ps as formatDuration,gs as formatNumber,C as getEnabledTools,Ps as getToolColor,Bs as getToolDescription,Ds as getToolLabel,p as getToolsBySlot,b as isBuoyHoldingBackButton,Da as methodColor,n as mountBuoy,x as persistentStorage,F as safeStringify,ks as settingsColors,ws as settingsStyles,ha as statusColor,qa as toolTheme,fs as truncateMiddle,Pa as typeColor,B as useAppHost,E as useDevToolsVisibility,bs as useFloatingTools,R as usePersistedState,j as useSafeAreaInsets,hs as useSettings,h as useToolHeader,v as useToolHost};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/core",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.78",
|
|
4
4
|
"description": "Floating developer menu and account setup for React Native. Add tool packages and configure Desktop or MCP connections separately.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
],
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"react-devtools-core": "6.1.5",
|
|
92
|
-
"@buoy-gg/floating-tools-core": "^7.0.
|
|
93
|
-
"@buoy-gg/floating-tools-react": "^7.0.
|
|
94
|
-
"@buoy-gg/license": "^7.0.
|
|
95
|
-
"@buoy-gg/shared-ui": "^7.0.
|
|
92
|
+
"@buoy-gg/floating-tools-core": "^7.0.78",
|
|
93
|
+
"@buoy-gg/floating-tools-react": "^7.0.78",
|
|
94
|
+
"@buoy-gg/license": "^7.0.78",
|
|
95
|
+
"@buoy-gg/shared-ui": "^7.0.78"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"react": "*"
|