@buoy-gg/core 7.0.44 → 7.0.46

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/bin/buoy.js CHANGED
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
- "use strict";const http=require("node:http");const fs=require("node:fs");const path=require("node:path");const crypto=require("node:crypto");const{spawn}=require("node:child_process");const SITE=process.env.BUOY_SITE_URL||"https://buoy.gg";const LOGIN_TIMEOUT_MS=5*60*1e3;const ESC="\x1B[";const color=e=>o=>`${ESC}${e}m${o}${ESC}0m`;const cyan=color(36);const green=color(32);const red=color(31);const dim=color(2);const bold=color(1);function log(e){process.stdout.write(`${e}
2
+ "use strict";const http=require("node:http");const fs=require("node:fs");const path=require("node:path");const crypto=require("node:crypto");const{spawn}=require("node:child_process");const SITE=process.env.BUOY_SITE_URL||"https://buoy.gg";const LOGIN_TIMEOUT_MS=5*60*1e3;const ESC="\x1B[";const color=e=>n=>`${ESC}${e}m${n}${ESC}0m`;const cyan=color(36);const green=color(32);const red=color(31);const dim=color(2);const bold=color(1);function log(e){process.stdout.write(`${e}
3
3
  `)}function fail(e){process.stderr.write(`${red("x")} ${e}
4
- `);process.exit(1)}function openBrowser(e){const o=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open";const s=process.platform==="win32"?["/c","start","",e]:[e];try{spawn(o,s,{stdio:"ignore",detached:true}).unref()}catch{}}function detectEnvVarName(e){let o=null;try{const s=path.join(e,"package.json");if(fs.existsSync(s)){const i=JSON.parse(fs.readFileSync(s,"utf8"));const n=Object.assign({},i.dependencies,i.devDependencies);if(n.expo)return"EXPO_PUBLIC_BUOY_KEY";if(n.next)o="NEXT_PUBLIC_BUOY_KEY";else if(n.vite)o="VITE_BUOY_KEY"}if(fs.existsSync(path.join(e,"app.config.js"))||fs.existsSync(path.join(e,"app.config.ts"))){return"EXPO_PUBLIC_BUOY_KEY"}const t=path.join(e,"app.json");if(fs.existsSync(t)){const i=JSON.parse(fs.readFileSync(t,"utf8"));if(i&&i.expo)return"EXPO_PUBLIC_BUOY_KEY"}}catch{}return o||"BUOY_KEY"}function envFileFor(e,o){if(!["EXPO_PUBLIC_BUOY_KEY","VITE_BUOY_KEY","NEXT_PUBLIC_BUOY_KEY"].includes(e))return".env.local";return o==="pro"||o==="business"?".env.local":".env.development.local"}function removeEnvVar(e,o,s){const t=path.join(e,s);let i;try{i=fs.readFileSync(t,"utf8")}catch{return false}const n=new RegExp("^"+o+"=.*\\n?","m");if(!n.test(i))return false;fs.writeFileSync(t,i.replace(n,""),{mode:384});return true}function writeEnvVar(e,o,s,t=".env.local"){const i=path.join(e,t);let n="";try{n=fs.readFileSync(i,"utf8")}catch{}const c=`${o}=${s}`;const r=new RegExp("^"+o+"=.*$","m");if(r.test(n)){n=n.replace(r,c)}else{if(n&&!n.endsWith("\n"))n+="\n";n+=`${c}
5
- `}fs.writeFileSync(i,n,{mode:384});return i}function ensureGitignored(e,o=".env.local"){const s=path.join(e,".gitignore");let t="";try{t=fs.readFileSync(s,"utf8")}catch{return false}const i=new RegExp("^"+o.replace(/\./g,"\\.")+"$","m");if(i.test(t)||/^\.env\*|^\*\.local$|^\.env\*\.local$/m.test(t))return false;if(t&&!t.endsWith("\n"))t+="\n";t+=`
4
+ `);process.exit(1)}function openBrowser(e){const n=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open";const t=process.platform==="win32"?["/c","start","",e]:[e];try{spawn(n,t,{stdio:"ignore",detached:true}).unref()}catch{}}function detectEnvVarName(e){let n=null;try{const t=path.join(e,"package.json");if(fs.existsSync(t)){const s=JSON.parse(fs.readFileSync(t,"utf8"));const o=Object.assign({},s.dependencies,s.devDependencies);if(o.expo)return"EXPO_PUBLIC_BUOY_KEY";if(o.next)n="NEXT_PUBLIC_BUOY_KEY";else if(o.vite)n="VITE_BUOY_KEY"}if(fs.existsSync(path.join(e,"app.config.js"))||fs.existsSync(path.join(e,"app.config.ts"))){return"EXPO_PUBLIC_BUOY_KEY"}const i=path.join(e,"app.json");if(fs.existsSync(i)){const s=JSON.parse(fs.readFileSync(i,"utf8"));if(s&&s.expo)return"EXPO_PUBLIC_BUOY_KEY"}}catch{}return n||"BUOY_KEY"}function envFileFor(e,n){if(!["EXPO_PUBLIC_BUOY_KEY","VITE_BUOY_KEY","NEXT_PUBLIC_BUOY_KEY"].includes(e))return".env.local";return n==="pro"||n==="business"?".env.local":".env.development.local"}function removeEnvVar(e,n,t){const i=path.join(e,t);let s;try{s=fs.readFileSync(i,"utf8")}catch{return false}const o=new RegExp("^"+n+"=.*\\n?","m");if(!o.test(s))return false;fs.writeFileSync(i,s.replace(o,""),{mode:384});return true}function writeEnvVar(e,n,t,i=".env.local"){const s=path.join(e,i);let o="";try{o=fs.readFileSync(s,"utf8")}catch{}const a=`${n}=${t}`;const r=new RegExp("^"+n+"=.*$","m");if(r.test(o)){o=o.replace(r,a)}else{if(o&&!o.endsWith("\n"))o+="\n";o+=`${a}
5
+ `}fs.writeFileSync(s,o,{mode:384});return s}function ensureGitignored(e,n=".env.local"){const t=path.join(e,".gitignore");let i="";try{i=fs.readFileSync(t,"utf8")}catch{return false}const s=new RegExp("^"+n.replace(/\./g,"\\.")+"$","m");if(s.test(i)||/^\.env\*|^\*\.local$|^\.env\*\.local$/m.test(i))return false;if(i&&!i.endsWith("\n"))i+="\n";i+=`
6
6
  # Buoy license key (per developer - do not commit)
7
- ${o}
8
- `;fs.writeFileSync(s,t);return true}function awaitKeyFromBrowser(){return new Promise((e,o)=>{const s=crypto.randomBytes(16).toString("hex");const t=http.createServer((i,n)=>{if(i.headers.origin===SITE){n.setHeader("Access-Control-Allow-Origin",SITE);n.setHeader("Access-Control-Allow-Headers","Content-Type");n.setHeader("Access-Control-Allow-Methods","POST, OPTIONS");n.setHeader("Access-Control-Allow-Private-Network","true")}if(i.method==="OPTIONS"){n.writeHead(204).end();return}if(i.method!=="POST"){n.writeHead(405).end();return}let c="";i.on("data",r=>{c+=r;if(c.length>4096)i.destroy()});i.on("end",()=>{let r={};try{r=JSON.parse(c)}catch{}if(r.state!==s||typeof r.key!=="string"||!r.key){n.writeHead(400).end();return}n.writeHead(200,{"Content-Type":"application/json"});n.end('{"ok":true}');t.close();e({key:r.key.trim(),tier:r.tier||"free",email:r.email||""})})});t.on("error",o);t.listen(0,"127.0.0.1",()=>{const{port:i}=t.address();const n=`${SITE}/cli/login?port=${i}&state=${s}`;log("");log(` Opening ${cyan(n)}`);log(dim(" If your browser did not open, paste that URL into a browser on this computer."));log("");log(dim(" Waiting for you to finish signing in..."));openBrowser(n)});setTimeout(()=>{t.close();o(new Error("Timed out waiting for the browser (5 minutes)."))},LOGIN_TIMEOUT_MS).unref()})}async function login(){const e=process.cwd();let o;try{o=await awaitKeyFromBrowser()}catch(a){fail(`${a.message}
9
- Nothing was written.`);return}const s=detectEnvVarName(e);const t=envFileFor(s,o.tier);const i=writeEnvVar(e,s,o.key,t);const n=t!==".env.local"&&removeEnvVar(e,s,".env.local");const c=ensureGitignored(e,t);const r=path.relative(e,i)||t;log("");log(`${green("OK")} Signed in${o.email?" as "+bold(o.email):""} - ${bold(o.tier)} tier`);log(` Wrote ${cyan(s)} to ${cyan(r)}`);if(n)log(dim(` Removed the old ${s} line from .env.local`));if(t===".env.development.local"){log(dim(" This file is loaded in development, keeping the key out of production builds."))}if(c)log(dim(` Added ${t} to .gitignore`));log("");log(" Use it in your app:");log("");if(s==="VITE_BUOY_KEY"){log(cyan(" <FloatingDevTools modules={modules} licenseKey={import.meta.env.VITE_BUOY_KEY} />"));log("");log(dim(" Keep your existing tool modules and providers, then reload the web app."))}else if(s==="NEXT_PUBLIC_BUOY_KEY"){log(cyan(" <FloatingDevTools modules={modules} licenseKey={process.env.NEXT_PUBLIC_BUOY_KEY} />"));log("");log(dim(" Restart next dev so it picks up the new variable."))}else{log(cyan(` Buoy.init({ licenseKey: ${s} });`));log("");log(dim(" Swift: pass the key through BuoyConfig.licenseKey in your development build."));log(dim(" Bare React Native does not load .env.local automatically; wire your existing env loader."))}log("")}function help(){log(`
7
+ ${n}
8
+ `;fs.writeFileSync(t,i);return true}function awaitKeyFromBrowser(){return new Promise((e,n)=>{const t=crypto.randomBytes(16).toString("hex");const i=http.createServer((s,o)=>{if(s.headers.origin===SITE){o.setHeader("Access-Control-Allow-Origin",SITE);o.setHeader("Access-Control-Allow-Headers","Content-Type");o.setHeader("Access-Control-Allow-Methods","POST, OPTIONS");o.setHeader("Access-Control-Allow-Private-Network","true")}if(s.method==="OPTIONS"){o.writeHead(204).end();return}if(s.method!=="POST"){o.writeHead(405).end();return}let a="";s.on("data",r=>{a+=r;if(a.length>4096)s.destroy()});s.on("end",()=>{let r={};try{r=JSON.parse(a)}catch{}if(r.state!==t||typeof r.key!=="string"||!r.key){o.writeHead(400).end();return}o.writeHead(200,{"Content-Type":"application/json"});o.end('{"ok":true}');i.close();e({key:r.key.trim(),tier:r.tier||"free",email:r.email||""})})});i.on("error",n);i.listen(0,"127.0.0.1",()=>{const{port:s}=i.address();const o=`${SITE}/cli/login?port=${s}&state=${t}`;log("");log(` Opening ${cyan(o)}`);log(dim(" If your browser did not open, paste that URL into a browser on this computer."));log("");log(dim(" Waiting for you to finish signing in..."));openBrowser(o)});setTimeout(()=>{i.close();n(new Error("Timed out waiting for the browser (5 minutes)."))},LOGIN_TIMEOUT_MS).unref()})}function loadSessionClient(){try{const e=require("@buoy-gg/license/headless");if(typeof e.createNodeSession!=="function")return null;return e}catch{return null}}function cliSession(e){return e.createNodeSession({audience:e.CLI_AUDIENCE,signinOrigin:SITE,openBrowser:n=>{log(`${cyan(">")} Opening ${dim(n.split("?")[0])} to sign in...`);log(dim(` If nothing opens, visit:
9
+ ${n}`));openBrowser(n)}})}async function signInAndGetDevToken(){const e=loadSessionClient();if(!e)return null;const n=cliSession(e);if(!await n.isAvailable())return null;await n.signIn();const t=await n.devToken();if(!t.ok){throw new Error(`This computer is signed in to Buoy, but no dev token was made: ${t.detail}`)}return{key:t.token,tier:t.tier,email:"",devToken:true}}async function login(){const e=process.cwd();let n;try{n=await signInAndGetDevToken()||await awaitKeyFromBrowser()}catch(c){fail(`${c.message}
10
+ No env file was changed.`);return}const t=detectEnvVarName(e);const i=envFileFor(t,n.devToken?"free":n.tier);const s=writeEnvVar(e,t,n.key,i);const o=i!==".env.local"&&removeEnvVar(e,t,".env.local");const a=ensureGitignored(e,i);const r=path.relative(e,s)||i;log("");log(`${green("OK")} Signed in${n.email?" as "+bold(n.email):""} - ${bold(n.tier)} tier`);log(` Wrote ${cyan(t)} to ${cyan(r)}`);if(n.devToken){log(dim(" It is a dev token: it works in dev builds and sims for 30 days. Then run npx buoy login again."));log(dim(" This computer is signed in to Buoy too. The MCP uses it. Sign out: npx buoy logout"))}if(o)log(dim(` Removed the old ${t} line from .env.local`));if(i===".env.development.local"){log(dim(" This file is loaded in development, keeping the key out of production builds."))}if(a)log(dim(` Added ${i} to .gitignore`));log("");log(" Use it in your app:");log("");if(t==="VITE_BUOY_KEY"){log(cyan(" <FloatingDevTools modules={modules} licenseKey={import.meta.env.VITE_BUOY_KEY} />"));log("");log(dim(" Keep your existing tool modules and providers, then reload the web app."))}else if(t==="NEXT_PUBLIC_BUOY_KEY"){log(cyan(" <FloatingDevTools modules={modules} licenseKey={process.env.NEXT_PUBLIC_BUOY_KEY} />"));log("");log(dim(" Restart next dev so it picks up the new variable."))}else{log(cyan(` Buoy.init({ licenseKey: ${t} });`));log("");log(dim(" Swift: pass the key through BuoyConfig.licenseKey in your development build."));log(dim(" Bare React Native does not load .env.local automatically; wire your existing env loader."))}log("")}async function logout(){const e=loadSessionClient();if(!e)fail("This version of Buoy cannot sign in or out. Update @buoy-gg/core.");const n=cliSession(e);const t=await n.load();await n.signOut();log(t.state==="active"?`${green("OK")} Signed out of Buoy on this computer.`:"This computer was not signed in.");log(dim(" Keys in your env files are not changed."))}async function whoami(){const e=loadSessionClient();if(!e)fail("This version of Buoy cannot sign in. Update @buoy-gg/core.");const n=await cliSession(e).load();if(n.state!=="active"){log("Not signed in. Run: npx buoy login");return}log(`${green("Signed in")} - ${bold(n.claims.tier)} plan${n.grace?dim(" (offline, using the grace period)"):""}`)}function help(){log(`
10
11
  ${bold("buoy")} - React Buoy CLI
11
12
 
12
13
  ${bold("Usage")}
@@ -16,6 +17,8 @@ ${o}
16
17
 
17
18
  ${bold("Commands")}
18
19
  login Sign in and write your license key to an env file
20
+ logout Sign this computer out of Buoy
21
+ whoami Show whether this computer is signed in
19
22
  help Show this message
20
23
 
21
24
  ${bold("Notes")}
@@ -27,5 +30,5 @@ ${o}
27
30
  This command does not install tools or verify a Desktop connection.
28
31
 
29
32
  Docs: ${SITE}/buoy/latest/docs/installation
30
- `)}if(require.main===module){const e=process.argv[2];if(e==="login"){login()}else if(!e||e==="help"||e==="--help"||e==="-h"){help()}else{fail(`Unknown command: ${e}
31
- Run \`npx buoy help\` to see what is available.`)}}module.exports={detectEnvVarName,envFileFor,writeEnvVar,removeEnvVar,ensureGitignored,awaitKeyFromBrowser};
33
+ `)}if(require.main===module){const e=process.argv[2];if(e==="login"){login()}else if(e==="logout"){logout().catch(n=>fail(n.message))}else if(e==="whoami"){whoami().catch(n=>fail(n.message))}else if(!e||e==="help"||e==="--help"||e==="-h"){help()}else{fail(`Unknown command: ${e}
34
+ Run \`npx buoy help\` to see what is available.`)}}module.exports={detectEnvVarName,envFileFor,writeEnvVar,removeEnvVar,ensureGitignored,awaitKeyFromBrowser,signInAndGetDevToken};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BuoySignIn=BuoySignIn;var _react=require("react");var _reactDom=require("react-dom");var _license=require("@buoy-gg/license");var _jsxRuntime=require("react/jsx-runtime");const ACCENT="#20C997";function BuoySignIn(){const{status:s,signIn:a,signOut:d}=(0,_license.useBuoySession)();const[t,i]=(0,_react.useState)(false);const[e,o]=(0,_react.useState)(null);if(typeof document==="undefined")return null;const u=()=>{o(null);i(true);a().catch(r=>o(r instanceof Error?r.message:"Sign-in did not work. Try again.")).finally(()=>i(false))};const n=s.state==="active";return(0,_reactDom.createPortal)((0,_jsxRuntime.jsx)("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:n||e?"12px 14px":0,borderRadius:16,background:n||e?"#0f1419":"transparent",color:"#e6edf3",boxShadow:n||e?"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:n?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)("div",{"data-testid":"buoy-signin-needs-plan",children:"Buoy on a live site needs a Pro or Business plan."}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:()=>void d(),style:linkStyle,"data-testid":"buoy-signout",children:"Sign out"})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[e?(0,_jsxRuntime.jsx)("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:e}):null,(0,_jsxRuntime.jsx)("button",{type:"button",onClick:u,disabled:t,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:ACCENT,color:"#04130d",fontWeight:600,fontSize:14,cursor:t?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:t?"Signing in\u2026":"Sign in to Buoy"})]})}),document.body)}const linkStyle={marginTop:8,padding:0,border:"none",background:"none",color:ACCENT,fontSize:14,cursor:"pointer",textDecoration:"underline"};
@@ -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=r=>{let a=MAX_DIAL_SLOTS;const n={};for(const[c,s]of Object.entries(r)){if(s&&a>0){n[c]=true;a-=1}else{n[c]=false}}return n};const sanitizeFloating=(r,a)=>{const{userStatus:n,environment:c,...s}=r;const l=a?Object.entries(s).filter(([d])=>a.includes(d)):Object.entries(s);return{...Object.fromEntries(l),environment:c??false}};const mergeWithDefaults=(r,a,n)=>{if(!a)return r;const c={...r.dialTools,...a.dialTools??{}};const s=n?.allowedDialKeys?Object.entries(c).filter(([d])=>n.allowedDialKeys?.includes(d)):Object.entries(c);const l=enforceDialLimit(Object.fromEntries(s));return{dialTools:l,floatingTools:sanitizeFloating({...r.floatingTools,...a.floatingTools??{}},n?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...a.globalSettings??{}}}};const generateDefaultSettings=(r=[],a,n)=>{const c={};const s={};const l=new Set(a??[]);const d=new Set(n??[]);const g=!n||n.length===0;for(const x of r){const{id:i,slot:S="both"}=x;if(S==="dial"||S==="both"){c[i]=g?true:d.has(i)}if(S==="row"||S==="both"){s[i]=l.has(i)}}return{dialTools:enforceDialLimit(c),floatingTools:{...s,environment:l.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};const DevToolsSettingsModal=({visible:r,onClose:a,onSettingsChange:n,initialSettings:c,availableApps:s=[],storage:l=_sharedUi.persistentStorage,zIndex:d})=>{const{defaultFloatingTools:g,defaultDialTools:x}=(0,_DefaultConfigContext.useDefaultConfig)();const i=(0,_react.useMemo)(()=>generateDefaultSettings(s,g,x),[s,g,x]);const S=(0,_react.useMemo)(()=>Object.keys(i.dialTools),[i]);const R=(0,_react.useMemo)(()=>Object.keys(i.floatingTools).filter(e=>e!=="environment"),[i]);const[f,b]=(0,_react.useState)(c||cachedSettings||i);const[w,F]=(0,_react.useState)(cachedActiveTab??"floating");const[N,G]=(0,_react.useState)(cachedActiveTab!==null);const[C,Y]=(0,_react.useState)(new Set);const[$,I]=(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(y=>y===o?y:o)}}catch(t){}finally{G(true)}};e()},[]);(0,_react.useEffect)(()=>{if(!N)return;_sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.activeTab(),w).catch(e=>{console.warn("Failed to save settings active tab:",e)})},[w,N]);const Z=(0,_sharedUi.getUseLicense)();const T=Z?.();const m=T?.isPro??false;const z=!m&&T?.licenseKey?T.error:null;const ee=T?.errorKind==="transport";const[u,te]=(0,_react.useState)(cachedStorageBackend);const[D,k]=(0,_react.useState)(false);const[B,L]=(0,_react.useState)(false);const[j,oe]=(0,_react.useState)(false);const[E,O]=(0,_react.useState)([]);const[V,P]=(0,_react.useState)(false);const M=(0,_sharedUi.useSafeAreaInsets)();const H=_reactNative.Dimensions.get("window").height;const K=_reactNative.Dimensions.get("window").width;const ne=Math.floor(H*.33);const se=Math.min(K-32,400);const _=(0,_react.useCallback)(async()=>{try{const e=await l.getItem(STORAGE_KEY);if(e){const t=JSON.parse(e);const o=mergeWithDefaults(i,t,{allowedDialKeys:S,allowedFloatingKeys:R});cachedSettings=o;b(y=>sameSettings(y,o)?y:o);return}cachedSettings=i;b(t=>sameSettings(t,i)?t:i)}catch(e){console.error("Failed to load dev tools settings:",e);b(i)}},[i,S,R,l]);(0,_react.useEffect)(()=>{_()},[_]);(0,_react.useEffect)(()=>{(0,_sharedUi.getStorageBackendType)().then(e=>{cachedStorageBackend=e;te(t=>t===e?t:e)})},[]);(0,_react.useEffect)(()=>{if(j){P(true);_sharedUi.persistentStorage.getAllKeys().then(e=>{O(e.sort())}).catch(()=>{O([])}).finally(()=>{P(false)})}},[j]);const A=async e=>{try{const t={...e,dialTools:enforceDialLimit(e.dialTools)};await l.setItem(STORAGE_KEY,JSON.stringify(t));cachedSettings=t;b(t);n?.(t);_settingsBus.settingsBus.emit(t)}catch(t){console.error("Failed to save dev tools settings:",t)}};const ie=e=>{const t={...f,floatingTools:{...f.floatingTools,[e]:!f.floatingTools[e]}};A(t)};const re=e=>{const t={...f,globalSettings:{...f.globalSettings,[e]:!f.globalSettings?.[e]}};A(t)};const ae=async()=>{k(true);L(false);try{await _sharedUi.persistentStorage.clear();L(true);b(i);if(l!==_sharedUi.persistentStorage)await l.setItem(STORAGE_KEY,JSON.stringify(i));n?.(i);_settingsBus.settingsBus.emit(i);setTimeout(()=>L(false),2e3)}catch(e){console.error("Failed to clear storage:",e)}finally{k(false)}};const le=(0,_react.useCallback)(e=>{},[]);const ce=e=>{const t=s.find(o=>o.id===e);if(t?.description){return t.description}if(e==="environment"){return"Environment badge."}return""};const W=e=>{if(e==="environment"){return"Env Badge"}const t=s.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=s.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,y)=>{const v=ce(e);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:o?1:.7,onPress:()=>!o&&y(),accessibilityLabel:W(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:[W(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:()=>y()})]},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,y,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)})]}),U&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRowBody,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyText,children:y}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyHint,children:v})]})]},e)};const p=(e,t,o)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_sharedUi.NightSectionLabel,{children:e}),t,o]});const he=u==="filesystem"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"File System",tone:"accent"}):u==="asyncstorage"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Async Storage",tone:"warning"}):u==="localstorage"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Local Storage",tone:"accent"}):u==="memory"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Memory",tone:"danger"}):(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Loading\u2026",tone:"neutral"});const ue=()=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:styles.scrollContainer,children:[w==="floating"&&(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:p("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."}))}),w==="settings"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p("Background",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,padded:true,children:(0,_jsxRuntime.jsx)(_sharedUi.BackgroundSwitcher,{embedded:true})})),p("Storage",(0,_jsxRuntime.jsxs)(_sharedUi.NightCard,{glass:true,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:.7,onPress:()=>oe(!j),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"})}),he,j?(0,_jsxRuntime.jsx)(_sharedUi.ChevronDown,{size:16,color:_sharedUi.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_sharedUi.ChevronRightIcon,{size:16,color:_sharedUi.night.color.textTertiary})]}),j&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRowBody,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyText,children:u==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":u==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":u==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":u==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),u==="asyncstorage"&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.settingRowBodyText,styles.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),u==="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:V?"\u2026":`${E.length} keys`})]}),V?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageKeyEmpty,children:"Loading\u2026"}):E.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:E.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:B?"Cleared":D?"Clearing\u2026":"Clear All Settings",variant:B?"secondary":"destructive",size:"md",disabled:D,onPress:ae,icon:B?(0,_jsxRuntime.jsx)(_sharedUi.CheckCircle2,{size:15,color:_sharedUi.night.color.accent}):(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:15,color:D?_sharedUi.night.color.textTertiary:_sharedUi.night.color.danger})})})]})]})),h&&h.state!=="idle"&&p("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]})]})]})),p("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."),_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]})}))]}),w==="pro"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p("License",(0,_jsxRuntime.jsx)(_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:m?"License: Active":"License: Free",children:m?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Active",tone:"accent"}):(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Free",tone:"neutral"})})]})}),(0,_jsxRuntime.jsx)(_sharedUi.NightFootnote,{children:m?"You have full access to all Buoy DevTools features.":z?ee?`Couldn't reach the license server (${z}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${z}.`:"Upgrade to Pro to unlock all features and support development."})),!m&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p("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:()=>I(true)})]})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.LicenseEntryModal,{visible:$,onClose:()=>I(false),onSuccess:()=>I(false)})]});return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:r,onClose:a,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:w,onChange:e=>F(e)})})},initialMode:"bottomSheet",onModeChange:le,persistenceKey:_sharedUi.devToolsStorageKeys.settings.root(),enablePersistence:true,maxHeight:H-M.top,initialHeight:ne,initialFloatingPosition:{x:(K-se)/2,y:M.top+20},enableGlitchEffects:true,children:ue()})};exports.DevToolsSettingsModal=DevToolsSettingsModal;const basicDefaultSettings={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const createDefaultsFromConfig=(r,a)=>{const n=new Set(r??[]);const c=new Set(a??[]);const s={};for(const d of c){s[d]=true}const l={environment:n.has("environment")};for(const d of n){if(d!=="environment"){l[d]=true}}return{dialTools:enforceDialLimit(s),floatingTools:l,globalSettings:{enableSharedModalDimensions:false}}};let cachedSettings=null;let cachedActiveTab=null;let cachedStorageBackend=null;const sameSettings=(r,a)=>JSON.stringify(r)===JSON.stringify(a);_settingsBus.settingsBus.addListener(r=>{if(r)cachedSettings=r});const useDevToolsSettings=()=>{const{defaultFloatingTools:r,defaultDialTools:a}=(0,_DefaultConfigContext.useDefaultConfig)();const n=(0,_react.useMemo)(()=>{if(!r&&!a){return basicDefaultSettings}return createDefaultsFromConfig(r,a)},[r,a]);const[c,s]=(0,_react.useState)(n);const l=(0,_react.useCallback)(async()=>{try{const g=await _sharedUi.persistentStorage.getItem(STORAGE_KEY);if(g){const x=JSON.parse(g);const i=mergeWithDefaults(n,x);s(i);return}s(n)}catch(g){console.error("Failed to load dev tools settings:",g);s(n)}},[n]);(0,_react.useEffect)(()=>{l();const g=_settingsBus.settingsBus.addListener(x=>{try{if(x){s(x)}}catch(i){}});return()=>{g()}},[l]);const d=(0,_react.useCallback)(()=>{l()},[l]);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=r=>{let a=MAX_DIAL_SLOTS;const n={};for(const[c,s]of Object.entries(r)){if(s&&a>0){n[c]=true;a-=1}else{n[c]=false}}return n};const sanitizeFloating=(r,a)=>{const{userStatus:n,environment:c,...s}=r;const l=a?Object.entries(s).filter(([d])=>a.includes(d)):Object.entries(s);return{...Object.fromEntries(l),environment:c??false}};const mergeWithDefaults=(r,a,n)=>{if(!a)return r;const c={...r.dialTools,...a.dialTools??{}};const s=n?.allowedDialKeys?Object.entries(c).filter(([d])=>n.allowedDialKeys?.includes(d)):Object.entries(c);const l=enforceDialLimit(Object.fromEntries(s));return{dialTools:l,floatingTools:sanitizeFloating({...r.floatingTools,...a.floatingTools??{}},n?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...a.globalSettings??{}}}};const generateDefaultSettings=(r=[],a,n)=>{const c={};const s={};const l=new Set(a??[]);const d=new Set(n??[]);const g=!n||n.length===0;for(const x of r){const{id:i,slot:S="both"}=x;if(S==="dial"||S==="both"){c[i]=g?true:d.has(i)}if(S==="row"||S==="both"){s[i]=l.has(i)}}return{dialTools:enforceDialLimit(c),floatingTools:{...s,environment:l.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};const DevToolsSettingsModal=({visible:r,onClose:a,onSettingsChange:n,initialSettings:c,availableApps:s=[],storage:l=_sharedUi.persistentStorage,zIndex:d})=>{const{defaultFloatingTools:g,defaultDialTools:x}=(0,_DefaultConfigContext.useDefaultConfig)();const i=(0,_react.useMemo)(()=>generateDefaultSettings(s,g,x),[s,g,x]);const S=(0,_react.useMemo)(()=>Object.keys(i.dialTools),[i]);const E=(0,_react.useMemo)(()=>Object.keys(i.floatingTools).filter(e=>e!=="environment"),[i]);const[f,b]=(0,_react.useState)(c||cachedSettings||i);const[w,F]=(0,_react.useState)(cachedActiveTab??"floating");const[N,G]=(0,_react.useState)(cachedActiveTab!==null);const[C,Y]=(0,_react.useState)(new Set);const[$,I]=(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(y=>y===o?y:o)}}catch(t){}finally{G(true)}};e()},[]);(0,_react.useEffect)(()=>{if(!N)return;_sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.activeTab(),w).catch(e=>{console.warn("Failed to save settings active tab:",e)})},[w,N]);const Z=(0,_sharedUi.getUseLicense)();const m=Z?.();const j=m?.isPro??false;const z=!j&&m?.licenseKey?m.error:null;const ee=m?.errorKind==="transport";const[u,te]=(0,_react.useState)(cachedStorageBackend);const[B,O]=(0,_react.useState)(false);const[D,L]=(0,_react.useState)(false);const[T,oe]=(0,_react.useState)(false);const[R,k]=(0,_react.useState)([]);const[V,P]=(0,_react.useState)(false);const M=(0,_sharedUi.useSafeAreaInsets)();const H=_reactNative.Dimensions.get("window").height;const K=_reactNative.Dimensions.get("window").width;const ne=Math.floor(H*.33);const se=Math.min(K-32,400);const _=(0,_react.useCallback)(async()=>{try{const e=await l.getItem(STORAGE_KEY);if(e){const t=JSON.parse(e);const o=mergeWithDefaults(i,t,{allowedDialKeys:S,allowedFloatingKeys:E});cachedSettings=o;b(y=>sameSettings(y,o)?y:o);return}cachedSettings=i;b(t=>sameSettings(t,i)?t:i)}catch(e){console.error("Failed to load dev tools settings:",e);b(i)}},[i,S,E,l]);(0,_react.useEffect)(()=>{_()},[_]);(0,_react.useEffect)(()=>{(0,_sharedUi.getStorageBackendType)().then(e=>{cachedStorageBackend=e;te(t=>t===e?t:e)})},[]);(0,_react.useEffect)(()=>{if(T){P(true);_sharedUi.persistentStorage.getAllKeys().then(e=>{k(e.sort())}).catch(()=>{k([])}).finally(()=>{P(false)})}},[T]);const A=async e=>{try{const t={...e,dialTools:enforceDialLimit(e.dialTools)};await l.setItem(STORAGE_KEY,JSON.stringify(t));cachedSettings=t;b(t);n?.(t);_settingsBus.settingsBus.emit(t)}catch(t){console.error("Failed to save dev tools settings:",t)}};const ie=e=>{const t={...f,floatingTools:{...f.floatingTools,[e]:!f.floatingTools[e]}};A(t)};const re=e=>{const t={...f,globalSettings:{...f.globalSettings,[e]:!f.globalSettings?.[e]}};A(t)};const ae=async()=>{O(true);L(false);try{await _sharedUi.persistentStorage.clear();L(true);b(i);if(l!==_sharedUi.persistentStorage)await l.setItem(STORAGE_KEY,JSON.stringify(i));n?.(i);_settingsBus.settingsBus.emit(i);setTimeout(()=>L(false),2e3)}catch(e){console.error("Failed to clear storage:",e)}finally{O(false)}};const le=(0,_react.useCallback)(e=>{},[]);const ce=e=>{const t=s.find(o=>o.id===e);if(t?.description){return t.description}if(e==="environment"){return"Environment badge."}return""};const W=e=>{if(e==="environment"){return"Env Badge"}const t=s.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=s.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,y)=>{const v=ce(e);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:o?1:.7,onPress:()=>!o&&y(),accessibilityLabel:W(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:[W(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:()=>y()})]},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,y,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)})]}),U&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingRowBody,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyText,children:y}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingRowBodyHint,children:v})]})]},e)};const p=(e,t,o)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{children:[(0,_jsxRuntime.jsx)(_sharedUi.NightSectionLabel,{children:e}),t,o]});const he=u==="filesystem"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"File System",tone:"accent"}):u==="asyncstorage"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Async Storage",tone:"warning"}):u==="localstorage"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Local Storage",tone:"accent"}):u==="memory"?(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Memory",tone:"danger"}):(0,_jsxRuntime.jsx)(_sharedUi.NightBadge,{label:"Loading\u2026",tone:"neutral"});const ue=()=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:styles.scrollContainer,children:[w==="floating"&&(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:p("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."}))}),w==="settings"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p("Background",(0,_jsxRuntime.jsx)(_sharedUi.NightCard,{glass:true,padded:true,children:(0,_jsxRuntime.jsx)(_sharedUi.BackgroundSwitcher,{embedded:true})})),p("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"})}),he,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:u==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":u==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":u==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":u==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),u==="asyncstorage"&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.settingRowBodyText,styles.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),u==="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:V?"\u2026":`${R.length} keys`})]}),V?(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:D?"Cleared":B?"Clearing\u2026":"Clear All Settings",variant:D?"secondary":"destructive",size:"md",disabled:B,onPress:ae,icon:D?(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"&&p("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]})]})]})),p("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."),_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]})}))]}),w==="pro"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p("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"})})]}),m?.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]}),(0,_jsxRuntime.jsx)(_sharedUi.NightFootnote,{children:j?"You have full access to all Buoy DevTools features.":z?ee?`Couldn't reach the license server (${z}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${z}.`:"Upgrade to Pro to unlock all features and support development."})),!j&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p("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:()=>I(true)})]})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.LicenseEntryModal,{visible:$,onClose:()=>I(false),onSuccess:()=>I(false)})]});return(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:r,onClose:a,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:w,onChange:e=>F(e)})})},initialMode:"bottomSheet",onModeChange:le,persistenceKey:_sharedUi.devToolsStorageKeys.settings.root(),enablePersistence:true,maxHeight:H-M.top,initialHeight:ne,initialFloatingPosition:{x:(K-se)/2,y:M.top+20},enableGlitchEffects:true,children:ue()})};exports.DevToolsSettingsModal=DevToolsSettingsModal;const basicDefaultSettings={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const createDefaultsFromConfig=(r,a)=>{const n=new Set(r??[]);const c=new Set(a??[]);const s={};for(const d of c){s[d]=true}const l={environment:n.has("environment")};for(const d of n){if(d!=="environment"){l[d]=true}}return{dialTools:enforceDialLimit(s),floatingTools:l,globalSettings:{enableSharedModalDimensions:false}}};let cachedSettings=null;let cachedActiveTab=null;let cachedStorageBackend=null;const sameSettings=(r,a)=>JSON.stringify(r)===JSON.stringify(a);_settingsBus.settingsBus.addListener(r=>{if(r)cachedSettings=r});const useDevToolsSettings=()=>{const{defaultFloatingTools:r,defaultDialTools:a}=(0,_DefaultConfigContext.useDefaultConfig)();const n=(0,_react.useMemo)(()=>{if(!r&&!a){return basicDefaultSettings}return createDefaultsFromConfig(r,a)},[r,a]);const[c,s]=(0,_react.useState)(n);const l=(0,_react.useCallback)(async()=>{try{const g=await _sharedUi.persistentStorage.getItem(STORAGE_KEY);if(g){const x=JSON.parse(g);const i=mergeWithDefaults(n,x);s(i);return}s(n)}catch(g){console.error("Failed to load dev tools settings:",g);s(n)}},[n]);(0,_react.useEffect)(()=>{l();const g=_settingsBus.settingsBus.addListener(x=>{try{if(x){s(x)}}catch(i){}});return()=>{g()}},[l]);const d=(0,_react.useCallback)(()=>{l()},[l]);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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FloatingDevTools=void 0;var _sharedUi=require("@buoy-gg/shared-ui");var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _AppHost=require("./AppHost");var _FloatingMenu=require("./FloatingMenu.js");var _ToolOpenerBridge=require("./ToolOpenerBridge.js");var _autoDiscoverPresets=require("./autoDiscoverPresets.js");var _installPing=require("../telemetry/installPing.js");var _Buoy=require("../Buoy.js");var _AppIcon=require("./AppIcon");var _DevToolsVisibilityContext=require("./DevToolsVisibilityContext.js");var _optionalRequire=require("./optionalRequire.js");var _MinimizedToolsContext=require("./MinimizedToolsContext.js");var _defaultConfig=require("./defaultConfig.js");var _DefaultConfigContext=require("./DefaultConfigContext.js");var _license=require("@buoy-gg/license");var _autoExternalSync=require("./autoExternalSync.js");var _externalSyncGate=require("./externalSyncGate.js");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(n,s){if("function"==typeof WeakMap)var l=new WeakMap,v=new WeakMap;return(_interopRequireWildcard=function(r,x){if(!x&&r&&r.__esModule)return r;var u,i,c={__proto__:null,default:r};if(null===r||"object"!=typeof r&&"function"!=typeof r)return c;if(u=x?v:l){if(u.has(r))return u.get(r);u.set(r,c)}for(const o in r)"default"!==o&&{}.hasOwnProperty.call(r,o)&&((i=(u=Object.defineProperty)&&Object.getOwnPropertyDescriptor(r,o))&&(i.get||i.set)?u(c,o,i):c[o]=r[o]);return c})(n,s)}let warnedReleaseTransport=null;function warnReleaseTransportOnce(n){if(!n||n===warnedReleaseTransport)return;warnedReleaseTransport=n;console.warn(n)}const FloatingDevTools=({apps:n,requiredEnvVars:s,requiredStorageKeys:l,askBuoy:v,children:r,disableHints:x=false,defaultFloatingTools:u,defaultDialTools:i,requireLicense:c,licenseKey:o,zustandStores:m,environment:B,externalSync:b=true,headless:A=false,...D})=>{const L=B??(0,_sharedUi.normalizeEnvironment)(process.env.NODE_ENV??"dev");const{isLicensed:j}=(0,_license.useProAccess)();const{licenseKey:q,isInitialized:P,tier:h,access:a}=(0,_license.useLicense)();const U=o===void 0||o.trim().toUpperCase()===(q??"");const W=U&&a.status==="admitted";(0,_react.useEffect)(()=>{if(!P||a.status==="initializing")return;void(0,_installPing.sendInstallPing)({tier:a.status==="admitted"?h:"locked",enabled:(0,_Buoy.isTelemetryEnabled)()})},[P,a.status,h]);(0,_react.useEffect)(()=>{void _license.LicenseManager.configure(o).catch(()=>{})},[o]);(0,_react.useEffect)(()=>{if(!m||a.status==="locked")return;try{const{watchStores:e}=require("@buoy-gg/zustand");return e(m)}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/zustand",e)}},[m,a.status]);const N=(0,_react.useMemo)(()=>{if(i){return(0,_defaultConfig.validateDialConfig)(i)}return i},[i]);const O=(0,_react.useMemo)(()=>{const e=[];if(s&&s.length>0){try{const{createEnvTool:t,createEnvVarConfig:T}=require("@buoy-gg/env");e.push(t({requiredEnvVars:T(s)}))}catch(t){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/env",t)}}if(l&&l.length>0){try{const{createStorageTool:t}=require("@buoy-gg/storage");e.push(t({requiredStorageKeys:l}))}catch(t){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/storage",t)}}if(v){try{const{createAskBuoyTool:t}=require("@buoy-gg/ask-buoy");e.push(t(v))}catch(t){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/ask-buoy",t)}}return e},[s,l,v]);const _=(0,_react.useMemo)(()=>{if(!n&&O.length===0)return void 0;return[...n||[],...O]},[n,O]);const f=(0,_react.useMemo)(()=>_?(0,_autoDiscoverPresets.autoDiscoverPresetsWithCustom)(_):(0,_autoDiscoverPresets.autoDiscoverPresets)(),[_]);const R=(0,_react.useMemo)(()=>f.filter(e=>e.sync),[f]);const C=(0,_react.useMemo)(()=>{try{const{DebugBordersStandaloneOverlay:e}=require("@buoy-gg/debug-borders");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/debug-borders",e);return null}},[]);const I=(0,_react.useMemo)(()=>{try{const{HighlightUpdatesOverlay:e}=require("@buoy-gg/highlight-updates");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/highlight-updates",e);return null}},[]);const S=(0,_react.useMemo)(()=>{try{const{ImageOverlayStandalone:e}=require("@buoy-gg/image-overlay");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/image-overlay",e);return null}},[]);const k=(0,_react.useMemo)(()=>{try{const{PerfMonitorOverlay:e}=require("@buoy-gg/perf-monitor");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/perf-monitor",e);return null}},[]);const F=(0,_react.useMemo)(()=>{try{const{JsTopHudOverlay:e}=require("@buoy-gg/js-top");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/js-top",e);return null}},[]);const g=(0,_react.useMemo)(()=>{try{const{RouteTracker:e}=require("@buoy-gg/route-events");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/route-events",e);return null}},[]);const y=(0,_react.useMemo)(()=>{try{const{ReactQueryTracker:e}=require("@buoy-gg/react-query");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/react-query",e);return null}},[]);const w=(0,_react.useMemo)(()=>{try{const{ImpersonateOverlay:e}=require("@buoy-gg/impersonate");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/impersonate",e);return null}},[]);const z=(0,_react.useMemo)(()=>{try{const{ScenariosOverlay:e}=require("@buoy-gg/scenarios");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/scenarios",e);return null}},[]);const p=(0,_react.useMemo)(()=>{try{const{ReduxAutoInstrument:e}=require("@buoy-gg/redux");return e??null}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/redux",e);return null}},[]);const d=(0,_react.useMemo)(()=>{try{const{ConsoleRoot:e}=require("@buoy-gg/console");return e??null}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/console",e);return null}},[]);const G=(0,_react.useCallback)(e=>{const t=f.find(T=>T.id===e);if(!t)return null;return(0,_AppIcon.renderAppIcon)(t.icon,{slot:"dial",size:20,color:t.color})},[f]);const E=typeof __DEV__!=="undefined"&&__DEV__;if(!E&&!j){return null}const H=(0,_externalSyncGate.shouldMountExternalSync)({isDevelopment:E,isLicensed:j,externalSync:b,isAvailable:(0,_autoExternalSync.isExternalSyncAvailable)()});const M=(0,_externalSyncGate.externalSyncOptions)(b);if(!E&&M?.enableInRelease){warnReleaseTransportOnce((0,_externalSyncGate.releaseTransportProblem)(M.socketURL,M))}const V=(0,_jsxRuntime.jsx)(_autoExternalSync.ToolRegistryPublisher,{requiredEnvVars:s,customApps:R});if(!W){return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[a.status==="initializing"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p&&(0,_jsxRuntime.jsx)(p,{}),d&&(0,_jsxRuntime.jsx)(d,{}),g&&(0,_jsxRuntime.jsx)(g,{}),y&&(0,_jsxRuntime.jsx)(y,{})]}),!A&&(0,_jsxRuntime.jsx)(_sharedUi.AccountSetup,{})]})}if(A){return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p&&(0,_jsxRuntime.jsx)(p,{}),d&&(0,_jsxRuntime.jsx)(d,{}),g&&(0,_jsxRuntime.jsx)(g,{}),y&&(0,_jsxRuntime.jsx)(y,{}),V,H&&(0,_jsxRuntime.jsx)(_autoExternalSync.AutoExternalSync,{options:(0,_externalSyncGate.externalSyncOptions)(b),requiredEnvVars:s,isPro:j,tier:h,licenseKey:q,customApps:R})]})}return(0,_jsxRuntime.jsx)(_DefaultConfigContext.DefaultConfigProvider,{defaultFloatingTools:u,defaultDialTools:N,children:(0,_jsxRuntime.jsx)(_sharedUi.HintsProvider,{disableHints:x,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,pointerEvents:"box-none",__buoyDevToolsRoot:true,children:(0,_jsxRuntime.jsxs)(_DevToolsVisibilityContext.DevToolsVisibilityProvider,{children:[S&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:_reactNative.StyleSheet.absoluteFill,pointerEvents:"box-none",collapsable:false,children:(0,_jsxRuntime.jsx)(S,{})}),(0,_jsxRuntime.jsx)(_AppHost.AppHostProvider,{children:(0,_jsxRuntime.jsxs)(_MinimizedToolsContext.MinimizedToolsProvider,{getToolIcon:G,children:[(0,_jsxRuntime.jsx)(_FloatingMenu.FloatingMenu,{...D,apps:f,environment:L}),D.hidden?null:(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_AppHost.AppOverlay,{}),(0,_jsxRuntime.jsx)(_sharedUi.FloatingToolHost,{})]}),(0,_jsxRuntime.jsx)(_ToolOpenerBridge.ToolOpenerBridge,{})]})}),r,C&&(0,_jsxRuntime.jsx)(C,{}),I&&(0,_jsxRuntime.jsx)(I,{}),k&&(0,_jsxRuntime.jsx)(k,{}),F&&(0,_jsxRuntime.jsx)(F,{}),w&&(0,_jsxRuntime.jsx)(w,{}),z&&(0,_jsxRuntime.jsx)(z,{}),p&&(0,_jsxRuntime.jsx)(p,{}),d&&(0,_jsxRuntime.jsx)(d,{}),g&&(0,_jsxRuntime.jsx)(g,{}),y&&(0,_jsxRuntime.jsx)(y,{}),V,H&&(0,_jsxRuntime.jsx)(_autoExternalSync.AutoExternalSync,{options:(0,_externalSyncGate.externalSyncOptions)(b),requiredEnvVars:s,isPro:j,tier:h,licenseKey:q,customApps:R})]})})})})};exports.FloatingDevTools=FloatingDevTools;const styles=_reactNative.StyleSheet.create({container:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:9999}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FloatingDevTools=void 0;var _sharedUi=require("@buoy-gg/shared-ui");var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _AppHost=require("./AppHost");var _FloatingMenu=require("./FloatingMenu.js");var _ToolOpenerBridge=require("./ToolOpenerBridge.js");var _autoDiscoverPresets=require("./autoDiscoverPresets.js");var _installPing=require("../telemetry/installPing.js");var _Buoy=require("../Buoy.js");var _AppIcon=require("./AppIcon");var _DevToolsVisibilityContext=require("./DevToolsVisibilityContext.js");var _optionalRequire=require("./optionalRequire.js");var _MinimizedToolsContext=require("./MinimizedToolsContext.js");var _defaultConfig=require("./defaultConfig.js");var _DefaultConfigContext=require("./DefaultConfigContext.js");var _license=require("@buoy-gg/license");var _autoExternalSync=require("./autoExternalSync.js");var _externalSyncGate=require("./externalSyncGate.js");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(n,s){if("function"==typeof WeakMap)var l=new WeakMap,v=new WeakMap;return(_interopRequireWildcard=function(r,x){if(!x&&r&&r.__esModule)return r;var u,i,c={__proto__:null,default:r};if(null===r||"object"!=typeof r&&"function"!=typeof r)return c;if(u=x?v:l){if(u.has(r))return u.get(r);u.set(r,c)}for(const o in r)"default"!==o&&{}.hasOwnProperty.call(r,o)&&((i=(u=Object.defineProperty)&&Object.getOwnPropertyDescriptor(r,o))&&(i.get||i.set)?u(c,o,i):c[o]=r[o]);return c})(n,s)}let warnedReleaseTransport=null;function warnReleaseTransportOnce(n){if(!n||n===warnedReleaseTransport)return;warnedReleaseTransport=n;console.warn(n)}const FloatingDevTools=({apps:n,requiredEnvVars:s,requiredStorageKeys:l,askBuoy:v,children:r,disableHints:x=false,defaultFloatingTools:u,defaultDialTools:i,requireLicense:c,licenseKey:o,zustandStores:m,environment:V,externalSync:b=true,headless:A=false,...D})=>{const B=V??(0,_sharedUi.normalizeEnvironment)(process.env.NODE_ENV??"dev");const{isLicensed:j}=(0,_license.useProAccess)();const{licenseKey:q,isInitialized:P,tier:h,access:a}=(0,_license.useLicense)();const W=o===void 0||(0,_license.sameLicenseKey)(o,q);const U=W&&a.status==="admitted";(0,_react.useEffect)(()=>{if(!P||a.status==="initializing")return;void(0,_installPing.sendInstallPing)({tier:a.status==="admitted"?h:"locked",enabled:(0,_Buoy.isTelemetryEnabled)()})},[P,a.status,h]);(0,_react.useEffect)(()=>{void _license.LicenseManager.configure(o).catch(()=>{})},[o]);(0,_react.useEffect)(()=>{if(!m||a.status==="locked")return;try{const{watchStores:e}=require("@buoy-gg/zustand");return e(m)}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/zustand",e)}},[m,a.status]);const N=(0,_react.useMemo)(()=>{if(i){return(0,_defaultConfig.validateDialConfig)(i)}return i},[i]);const O=(0,_react.useMemo)(()=>{const e=[];if(s&&s.length>0){try{const{createEnvTool:t,createEnvVarConfig:T}=require("@buoy-gg/env");e.push(t({requiredEnvVars:T(s)}))}catch(t){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/env",t)}}if(l&&l.length>0){try{const{createStorageTool:t}=require("@buoy-gg/storage");e.push(t({requiredStorageKeys:l}))}catch(t){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/storage",t)}}if(v){try{const{createAskBuoyTool:t}=require("@buoy-gg/ask-buoy");e.push(t(v))}catch(t){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/ask-buoy",t)}}return e},[s,l,v]);const _=(0,_react.useMemo)(()=>{if(!n&&O.length===0)return void 0;return[...n||[],...O]},[n,O]);const f=(0,_react.useMemo)(()=>_?(0,_autoDiscoverPresets.autoDiscoverPresetsWithCustom)(_):(0,_autoDiscoverPresets.autoDiscoverPresets)(),[_]);const R=(0,_react.useMemo)(()=>f.filter(e=>e.sync),[f]);const C=(0,_react.useMemo)(()=>{try{const{DebugBordersStandaloneOverlay:e}=require("@buoy-gg/debug-borders");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/debug-borders",e);return null}},[]);const I=(0,_react.useMemo)(()=>{try{const{HighlightUpdatesOverlay:e}=require("@buoy-gg/highlight-updates");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/highlight-updates",e);return null}},[]);const S=(0,_react.useMemo)(()=>{try{const{ImageOverlayStandalone:e}=require("@buoy-gg/image-overlay");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/image-overlay",e);return null}},[]);const k=(0,_react.useMemo)(()=>{try{const{PerfMonitorOverlay:e}=require("@buoy-gg/perf-monitor");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/perf-monitor",e);return null}},[]);const F=(0,_react.useMemo)(()=>{try{const{JsTopHudOverlay:e}=require("@buoy-gg/js-top");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/js-top",e);return null}},[]);const g=(0,_react.useMemo)(()=>{try{const{RouteTracker:e}=require("@buoy-gg/route-events");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/route-events",e);return null}},[]);const y=(0,_react.useMemo)(()=>{try{const{ReactQueryTracker:e}=require("@buoy-gg/react-query");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/react-query",e);return null}},[]);const w=(0,_react.useMemo)(()=>{try{const{ImpersonateOverlay:e}=require("@buoy-gg/impersonate");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/impersonate",e);return null}},[]);const z=(0,_react.useMemo)(()=>{try{const{ScenariosOverlay:e}=require("@buoy-gg/scenarios");return e}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/scenarios",e);return null}},[]);const p=(0,_react.useMemo)(()=>{try{const{ReduxAutoInstrument:e}=require("@buoy-gg/redux");return e??null}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/redux",e);return null}},[]);const d=(0,_react.useMemo)(()=>{try{const{ConsoleRoot:e}=require("@buoy-gg/console");return e??null}catch(e){(0,_optionalRequire.reportOptionalRequireError)("@buoy-gg/console",e);return null}},[]);const G=(0,_react.useCallback)(e=>{const t=f.find(T=>T.id===e);if(!t)return null;return(0,_AppIcon.renderAppIcon)(t.icon,{slot:"dial",size:20,color:t.color})},[f]);const E=typeof __DEV__!=="undefined"&&__DEV__;if(!E&&!j){return null}const H=(0,_externalSyncGate.shouldMountExternalSync)({isDevelopment:E,isLicensed:j,externalSync:b,isAvailable:(0,_autoExternalSync.isExternalSyncAvailable)()});const M=(0,_externalSyncGate.externalSyncOptions)(b);if(!E&&M?.enableInRelease){warnReleaseTransportOnce((0,_externalSyncGate.releaseTransportProblem)(M.socketURL,M))}const L=(0,_jsxRuntime.jsx)(_autoExternalSync.ToolRegistryPublisher,{requiredEnvVars:s,customApps:R});if(!U){return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[a.status==="initializing"&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p&&(0,_jsxRuntime.jsx)(p,{}),d&&(0,_jsxRuntime.jsx)(d,{}),g&&(0,_jsxRuntime.jsx)(g,{}),y&&(0,_jsxRuntime.jsx)(y,{})]}),!A&&(0,_jsxRuntime.jsx)(_sharedUi.AccountSetup,{})]})}if(A){return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[p&&(0,_jsxRuntime.jsx)(p,{}),d&&(0,_jsxRuntime.jsx)(d,{}),g&&(0,_jsxRuntime.jsx)(g,{}),y&&(0,_jsxRuntime.jsx)(y,{}),L,H&&(0,_jsxRuntime.jsx)(_autoExternalSync.AutoExternalSync,{options:(0,_externalSyncGate.externalSyncOptions)(b),requiredEnvVars:s,isPro:j,tier:h,licenseKey:q,customApps:R})]})}return(0,_jsxRuntime.jsx)(_DefaultConfigContext.DefaultConfigProvider,{defaultFloatingTools:u,defaultDialTools:N,children:(0,_jsxRuntime.jsx)(_sharedUi.HintsProvider,{disableHints:x,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,pointerEvents:"box-none",__buoyDevToolsRoot:true,children:(0,_jsxRuntime.jsxs)(_DevToolsVisibilityContext.DevToolsVisibilityProvider,{children:[S&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:_reactNative.StyleSheet.absoluteFill,pointerEvents:"box-none",collapsable:false,children:(0,_jsxRuntime.jsx)(S,{})}),(0,_jsxRuntime.jsx)(_AppHost.AppHostProvider,{children:(0,_jsxRuntime.jsxs)(_MinimizedToolsContext.MinimizedToolsProvider,{getToolIcon:G,children:[(0,_jsxRuntime.jsx)(_FloatingMenu.FloatingMenu,{...D,apps:f,environment:B}),D.hidden?null:(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_AppHost.AppOverlay,{}),(0,_jsxRuntime.jsx)(_sharedUi.FloatingToolHost,{})]}),(0,_jsxRuntime.jsx)(_ToolOpenerBridge.ToolOpenerBridge,{})]})}),r,C&&(0,_jsxRuntime.jsx)(C,{}),I&&(0,_jsxRuntime.jsx)(I,{}),k&&(0,_jsxRuntime.jsx)(k,{}),F&&(0,_jsxRuntime.jsx)(F,{}),w&&(0,_jsxRuntime.jsx)(w,{}),z&&(0,_jsxRuntime.jsx)(z,{}),p&&(0,_jsxRuntime.jsx)(p,{}),d&&(0,_jsxRuntime.jsx)(d,{}),g&&(0,_jsxRuntime.jsx)(g,{}),y&&(0,_jsxRuntime.jsx)(y,{}),L,H&&(0,_jsxRuntime.jsx)(_autoExternalSync.AutoExternalSync,{options:(0,_externalSyncGate.externalSyncOptions)(b),requiredEnvVars:s,isPro:j,tier:h,licenseKey:q,customApps:R})]})})})})};exports.FloatingDevTools=FloatingDevTools;const styles=_reactNative.StyleSheet.create({container:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:9999}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FloatingDevTools=FloatingDevTools;var _floating=require("@buoy-gg/shared-ui/floating");var _license=require("@buoy-gg/license");var _sharedUi=require("@buoy-gg/shared-ui");var _react=require("react");var _floatingToolsReact=require("@buoy-gg/floating-tools-react");var _autoDiscoverPresetsWeb=require("../utils/autoDiscoverPresets.web.js");var _floatingToolsWeb=require("./floatingTools.web.js");var _DialDevToolsWeb=require("./dial/DialDevTools.web.js");var _dialUsageStore=require("./dial/dialUsageStore.js");var _OnboardingTooltipWeb=require("./dial/OnboardingTooltip.web.js");var _DevToolsSettingsModalWeb=require("./DevToolsSettingsModal.web.js");var _AppHostWeb=require("./AppHost.web.js");var _MinimizedToolsStackWeb=require("./MinimizedToolsStack.web.js");var _createWebTools=require("../utils/createWebTools.js");var _BrowserToolRuntime=require("./BrowserToolRuntime.js");var _releaseOptIn=require("../releaseOptIn.js");var _DevToolsVisibilityContext=require("./DevToolsVisibilityContext.js");var _jsxRuntime=require("react/jsx-runtime");const EMPTY_MODULES={};const MENU_TOOLTIP_KEY="@react_buoy_floating_menu_tooltip_shown";const webSettingsStorage=_sharedUi.persistentStorage;function MenuLauncherIcon({size:t=14,color:l="#20C997"}){const o=Math.max(2,t/4);const c=Math.max(1,t/16);return(0,_jsxRuntime.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:c,width:t,height:t,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((u,a)=>(0,_jsxRuntime.jsx)("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:l}},a))})}function AdmittedFloatingDevTools(t){return(0,_jsxRuntime.jsx)(_DevToolsVisibilityContext.DevToolsVisibilityProvider,{children:(0,_jsxRuntime.jsx)(_AppHostWeb.AppHostProvider,{children:(0,_jsxRuntime.jsx)(FloatingDevToolsInner,{...t})})})}function FloatingDevToolsInner({environment:t,userRole:l,availableEnvironments:o,onEnvironmentSwitch:c,apps:u,modules:a=EMPTY_MODULES,externalSync:v,requiredEnvVars:W,sentryGetClient:A,disableHints:S=false,headless:D=false}){const[i,b]=(0,_react.useState)(false);const[d,T]=(0,_react.useState)(false);const j=(0,_react.useRef)(false);const p=(0,_AppHostWeb.useAppHost)();const r=(0,_react.useMemo)(()=>(0,_autoDiscoverPresetsWeb.autoDiscoverWithCustom)([...(0,_createWebTools.createWebTools)(a),...u??[]]),[u,a]);const y=(0,_DevToolsVisibilityContext.useDevToolsVisibility)();const O=p.openApps.some(e=>!e.minimized);(0,_react.useEffect)(()=>{y.setDialOpen(i)},[i,y.setDialOpen]);(0,_react.useEffect)(()=>{y.setToolOpen(O||d)},[O,d,y.setToolOpen]);const{registerApps:w}=p;(0,_react.useEffect)(()=>{w(r.map(e=>{const n=e.icon;return{...e,icon:typeof n==="function"?({size:s})=>n(s):n}}))},[w,r]);const L=(0,_react.useMemo)(()=>r.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[r]);const{settings:x}=(0,_floatingToolsReact.useSettings)({availableTools:L,storage:webSettingsStorage});(0,_react.useEffect)(()=>{let e=false;const n=async()=>{const[s,f]=await Promise.all([_sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.dial.isOpen()),_sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.settings.modalOpen())]);if(e)return;if(s==="true")b(true);if(f==="true"){b(true);T(true)}j.current=true};void n();return()=>{e=true}},[]);(0,_react.useEffect)(()=>{if(!j.current)return;void _sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.dial.isOpen(),i?"true":"false")},[i]);(0,_react.useEffect)(()=>{if(!j.current)return;void _sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.modalOpen(),d?"true":"false")},[d]);const _=(0,_react.useCallback)(e=>{void(0,_dialUsageStore.recordToolUsage)(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const n=typeof e.icon==="function"?e.icon(20):e.icon;p.open({id:e.id,title:e.name||(0,_floatingToolsReact.getToolLabel)(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:n,color:e.color||(0,_floatingToolsReact.getToolColor)(e.id)})}else{e.onPress?.()}},[p]);const h=(0,_react.useMemo)(()=>{const e=(0,_autoDiscoverPresetsWeb.getToolsBySlot)(r,"dial");return e.map(n=>{const s=n.color||(0,_floatingToolsReact.getToolColor)(n.id);let f;if(typeof n.icon==="string"){f=n.icon}else if(typeof n.icon==="function"){f=n.icon(32)}else{f=null}return{id:n.id,name:n.name||(0,_floatingToolsReact.getToolLabel)(n.id),icon:f,unavailable:!n.component&&!n.onPress,color:s,onPress:()=>{_(n);b(false)}}})},[r,_]);const R=(0,_react.useMemo)(()=>{if(!i)return h;const e=new Map(h.map(n=>[n.id,n]));return(0,_dialUsageStore.getRankedToolIds)(h.map(n=>n.id)).map(n=>e.get(n)).filter(n=>Boolean(n))},[i,h]);const K=(0,_react.useMemo)(()=>(0,_autoDiscoverPresetsWeb.getToolsBySlot)(r,"row").filter(e=>x.floatingTools[e.id]===true&&(e.component||e.onPress)),[r,x.floatingTools]);const B=(0,_react.useMemo)(()=>r.map(e=>({id:e.id,name:e.name||(0,_floatingToolsReact.getToolLabel)(e.id),description:e.description||(0,_floatingToolsReact.getToolDescription)(e.id),slot:e.slot,icon:e.icon,color:e.color})),[r]);const[U,C]=(0,_react.useState)(false);const E=p.openApps.some(e=>!e.minimized);(0,_react.useEffect)(()=>{if(S)return;let e=false;const n=setTimeout(async()=>{const s=await _sharedUi.persistentStorage.getItem(MENU_TOOLTIP_KEY);if(!e&&!s)C(true)},1e3);return()=>{e=true;clearTimeout(n)}},[S]);const g=(0,_react.useCallback)(()=>{C(false);void _sharedUi.persistentStorage.setItem(MENU_TOOLTIP_KEY,"true")},[]);const M=(0,_react.useCallback)(()=>{g();b(true)},[g]);const V=(0,_react.useCallback)(()=>{b(false);T(false)},[]);const z=(0,_react.useCallback)(()=>{T(e=>!e)},[]);const F=(0,_react.useCallback)(()=>T(false),[]);const k=Boolean(o?.length&&c);const I=x.floatingTools.environment!==false;const m=U&&!i&&!E;(0,_react.useEffect)(()=>{if(!m)return;const e=s=>{if(!(s.target instanceof Element)||!s.target.closest("[data-buoy-root]"))g()};const n=s=>{if(s.key==="Escape")g()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",n);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",n)}},[m,g]);const P=p.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const q=(0,_jsxRuntime.jsx)(_BrowserToolRuntime.BrowserToolRuntime,{modules:a,apps:u,requiredEnvVars:W,externalSync:v,headless:D,sentryGetClient:A});if(D)return q;return(0,_jsxRuntime.jsxs)("div",{"data-buoy-root":"",style:{display:"contents"},children:[q,m&&(0,_jsxRuntime.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),(0,_jsxRuntime.jsxs)(_floatingToolsWeb.FloatingTools,{enablePositionPersistence:!m,pushToSide:i||E,suspendPointerEvents:i,centerOnboarding:m,minimizedStack:P?(0,_jsxRuntime.jsx)(_MinimizedToolsStackWeb.MinimizedToolsStack,{}):void 0,hasMinimizedStack:P,children:[t&&I&&!k&&(0,_jsxRuntime.jsx)(_sharedUi.EnvironmentIndicator,{environment:t}),k&&I&&(0,_jsxRuntime.jsx)(_sharedUi.EnvironmentSelectorInline,{currentEnvironment:t??"local",availableEnvironments:o,onSelect:c}),l?(0,_jsxRuntime.jsx)(_floatingToolsWeb.UserStatus,{userRole:l,onPress:M}):(0,_jsxRuntime.jsx)("button",{"aria-label":"Open dev tools",onClick:M,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:(0,_jsxRuntime.jsx)(MenuLauncherIcon,{})}),K.map(e=>(0,_jsxRuntime.jsx)("button",{"aria-label":e.name||(0,_floatingToolsReact.getToolLabel)(e.id),title:e.description,onClick:()=>_(e),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof e.icon==="function"?e.icon(16):e.icon},e.id))]}),m&&(0,_jsxRuntime.jsx)(_OnboardingTooltipWeb.OnboardingTooltip,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:g}),i&&(0,_jsxRuntime.jsx)(_DialDevToolsWeb.DialMenu,{icons:R,onClose:V,centerLabel:"BUOY",onCenterPress:z,settingsOpen:d,hintsDisabled:S}),(0,_jsxRuntime.jsx)(_DevToolsSettingsModalWeb.SettingsModal,{visible:d,onClose:F,availableTools:B,onSettingsChange:e=>{}}),(0,_jsxRuntime.jsx)(_AppHostWeb.AppOverlay,{}),(0,_jsxRuntime.jsx)(_floating.FloatingToolHost,{})]})}function FloatingDevTools(t){const{access:l,isPro:o,licenseKey:c}=(0,_license.useLicense)();(0,_react.useEffect)(()=>{void _license.LicenseManager.configure(t.licenseKey)},[t.licenseKey]);const u=t.licenseKey===void 0||t.licenseKey.trim().toUpperCase()===(c??"");const a=typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production";const v=u&&l.status==="admitted";(0,_react.useEffect)(()=>{if(!a&&o&&v)(0,_releaseOptIn.markReleaseOptIn)()},[a,o,v]);if(!a&&!o)return null;if(!v)return t.headless?null:(0,_jsxRuntime.jsx)(_sharedUi.AccountSetup,{});return(0,_jsxRuntime.jsx)(AdmittedFloatingDevTools,{...t})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FloatingDevTools=FloatingDevTools;var _floating=require("@buoy-gg/shared-ui/floating");var _license=require("@buoy-gg/license");var _sharedUi=require("@buoy-gg/shared-ui");var _react=require("react");var _floatingToolsReact=require("@buoy-gg/floating-tools-react");var _autoDiscoverPresetsWeb=require("../utils/autoDiscoverPresets.web.js");var _floatingToolsWeb=require("./floatingTools.web.js");var _DialDevToolsWeb=require("./dial/DialDevTools.web.js");var _dialUsageStore=require("./dial/dialUsageStore.js");var _OnboardingTooltipWeb=require("./dial/OnboardingTooltip.web.js");var _DevToolsSettingsModalWeb=require("./DevToolsSettingsModal.web.js");var _AppHostWeb=require("./AppHost.web.js");var _MinimizedToolsStackWeb=require("./MinimizedToolsStack.web.js");var _createWebTools=require("../utils/createWebTools.js");var _BrowserToolRuntime=require("./BrowserToolRuntime.js");var _releaseOptIn=require("../releaseOptIn.js");var _BuoySignInWeb=require("./BuoySignIn.web.js");var _DevToolsVisibilityContext=require("./DevToolsVisibilityContext.js");var _jsxRuntime=require("react/jsx-runtime");const EMPTY_MODULES={};const MENU_TOOLTIP_KEY="@react_buoy_floating_menu_tooltip_shown";const webSettingsStorage=_sharedUi.persistentStorage;function MenuLauncherIcon({size:t=14,color:l="#20C997"}){const o=Math.max(2,t/4);const c=Math.max(1,t/16);return(0,_jsxRuntime.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:c,width:t,height:t,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((u,a)=>(0,_jsxRuntime.jsx)("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:l}},a))})}function AdmittedFloatingDevTools(t){return(0,_jsxRuntime.jsx)(_DevToolsVisibilityContext.DevToolsVisibilityProvider,{children:(0,_jsxRuntime.jsx)(_AppHostWeb.AppHostProvider,{children:(0,_jsxRuntime.jsx)(FloatingDevToolsInner,{...t})})})}function FloatingDevToolsInner({environment:t,userRole:l,availableEnvironments:o,onEnvironmentSwitch:c,apps:u,modules:a=EMPTY_MODULES,externalSync:v,requiredEnvVars:W,sentryGetClient:L,disableHints:S=false,headless:D=false}){const[i,b]=(0,_react.useState)(false);const[d,T]=(0,_react.useState)(false);const j=(0,_react.useRef)(false);const g=(0,_AppHostWeb.useAppHost)();const r=(0,_react.useMemo)(()=>(0,_autoDiscoverPresetsWeb.autoDiscoverWithCustom)([...(0,_createWebTools.createWebTools)(a),...u??[]]),[u,a]);const y=(0,_DevToolsVisibilityContext.useDevToolsVisibility)();const O=g.openApps.some(e=>!e.minimized);(0,_react.useEffect)(()=>{y.setDialOpen(i)},[i,y.setDialOpen]);(0,_react.useEffect)(()=>{y.setToolOpen(O||d)},[O,d,y.setToolOpen]);const{registerApps:w}=g;(0,_react.useEffect)(()=>{w(r.map(e=>{const n=e.icon;return{...e,icon:typeof n==="function"?({size:s})=>n(s):n}}))},[w,r]);const A=(0,_react.useMemo)(()=>r.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[r]);const{settings:x}=(0,_floatingToolsReact.useSettings)({availableTools:A,storage:webSettingsStorage});(0,_react.useEffect)(()=>{let e=false;const n=async()=>{const[s,m]=await Promise.all([_sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.dial.isOpen()),_sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.settings.modalOpen())]);if(e)return;if(s==="true")b(true);if(m==="true"){b(true);T(true)}j.current=true};void n();return()=>{e=true}},[]);(0,_react.useEffect)(()=>{if(!j.current)return;void _sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.dial.isOpen(),i?"true":"false")},[i]);(0,_react.useEffect)(()=>{if(!j.current)return;void _sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.modalOpen(),d?"true":"false")},[d]);const _=(0,_react.useCallback)(e=>{void(0,_dialUsageStore.recordToolUsage)(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const n=typeof e.icon==="function"?e.icon(20):e.icon;g.open({id:e.id,title:e.name||(0,_floatingToolsReact.getToolLabel)(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:n,color:e.color||(0,_floatingToolsReact.getToolColor)(e.id)})}else{e.onPress?.()}},[g]);const h=(0,_react.useMemo)(()=>{const e=(0,_autoDiscoverPresetsWeb.getToolsBySlot)(r,"dial");return e.map(n=>{const s=n.color||(0,_floatingToolsReact.getToolColor)(n.id);let m;if(typeof n.icon==="string"){m=n.icon}else if(typeof n.icon==="function"){m=n.icon(32)}else{m=null}return{id:n.id,name:n.name||(0,_floatingToolsReact.getToolLabel)(n.id),icon:m,unavailable:!n.component&&!n.onPress,color:s,onPress:()=>{_(n);b(false)}}})},[r,_]);const R=(0,_react.useMemo)(()=>{if(!i)return h;const e=new Map(h.map(n=>[n.id,n]));return(0,_dialUsageStore.getRankedToolIds)(h.map(n=>n.id)).map(n=>e.get(n)).filter(n=>Boolean(n))},[i,h]);const B=(0,_react.useMemo)(()=>(0,_autoDiscoverPresetsWeb.getToolsBySlot)(r,"row").filter(e=>x.floatingTools[e.id]===true&&(e.component||e.onPress)),[r,x.floatingTools]);const K=(0,_react.useMemo)(()=>r.map(e=>({id:e.id,name:e.name||(0,_floatingToolsReact.getToolLabel)(e.id),description:e.description||(0,_floatingToolsReact.getToolDescription)(e.id),slot:e.slot,icon:e.icon,color:e.color})),[r]);const[V,E]=(0,_react.useState)(false);const C=g.openApps.some(e=>!e.minimized);(0,_react.useEffect)(()=>{if(S)return;let e=false;const n=setTimeout(async()=>{const s=await _sharedUi.persistentStorage.getItem(MENU_TOOLTIP_KEY);if(!e&&!s)E(true)},1e3);return()=>{e=true;clearTimeout(n)}},[S]);const p=(0,_react.useCallback)(()=>{E(false);void _sharedUi.persistentStorage.setItem(MENU_TOOLTIP_KEY,"true")},[]);const I=(0,_react.useCallback)(()=>{p();b(true)},[p]);const z=(0,_react.useCallback)(()=>{b(false);T(false)},[]);const U=(0,_react.useCallback)(()=>{T(e=>!e)},[]);const F=(0,_react.useCallback)(()=>T(false),[]);const M=Boolean(o?.length&&c);const k=x.floatingTools.environment!==false;const f=V&&!i&&!C;(0,_react.useEffect)(()=>{if(!f)return;const e=s=>{if(!(s.target instanceof Element)||!s.target.closest("[data-buoy-root]"))p()};const n=s=>{if(s.key==="Escape")p()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",n);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",n)}},[f,p]);const P=g.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const q=(0,_jsxRuntime.jsx)(_BrowserToolRuntime.BrowserToolRuntime,{modules:a,apps:u,requiredEnvVars:W,externalSync:v,headless:D,sentryGetClient:L});if(D)return q;return(0,_jsxRuntime.jsxs)("div",{"data-buoy-root":"",style:{display:"contents"},children:[q,f&&(0,_jsxRuntime.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),(0,_jsxRuntime.jsxs)(_floatingToolsWeb.FloatingTools,{enablePositionPersistence:!f,pushToSide:i||C,suspendPointerEvents:i,centerOnboarding:f,minimizedStack:P?(0,_jsxRuntime.jsx)(_MinimizedToolsStackWeb.MinimizedToolsStack,{}):void 0,hasMinimizedStack:P,children:[t&&k&&!M&&(0,_jsxRuntime.jsx)(_sharedUi.EnvironmentIndicator,{environment:t}),M&&k&&(0,_jsxRuntime.jsx)(_sharedUi.EnvironmentSelectorInline,{currentEnvironment:t??"local",availableEnvironments:o,onSelect:c}),l?(0,_jsxRuntime.jsx)(_floatingToolsWeb.UserStatus,{userRole:l,onPress:I}):(0,_jsxRuntime.jsx)("button",{"aria-label":"Open dev tools",onClick:I,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:(0,_jsxRuntime.jsx)(MenuLauncherIcon,{})}),B.map(e=>(0,_jsxRuntime.jsx)("button",{"aria-label":e.name||(0,_floatingToolsReact.getToolLabel)(e.id),title:e.description,onClick:()=>_(e),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof e.icon==="function"?e.icon(16):e.icon},e.id))]}),f&&(0,_jsxRuntime.jsx)(_OnboardingTooltipWeb.OnboardingTooltip,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:p}),i&&(0,_jsxRuntime.jsx)(_DialDevToolsWeb.DialMenu,{icons:R,onClose:z,centerLabel:"BUOY",onCenterPress:U,settingsOpen:d,hintsDisabled:S}),(0,_jsxRuntime.jsx)(_DevToolsSettingsModalWeb.SettingsModal,{visible:d,onClose:F,availableTools:K,onSettingsChange:e=>{}}),(0,_jsxRuntime.jsx)(_AppHostWeb.AppOverlay,{}),(0,_jsxRuntime.jsx)(_floating.FloatingToolHost,{})]})}function FloatingDevTools(t){const{access:l,isPro:o,licenseKey:c}=(0,_license.useLicense)();(0,_react.useEffect)(()=>{void _license.LicenseManager.configure(t.licenseKey)},[t.licenseKey]);const u=t.licenseKey===void 0||(0,_license.sameLicenseKey)(t.licenseKey,c);const a=typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production";const v=u&&l.status==="admitted";(0,_react.useEffect)(()=>{if(a||l.status==="initializing")return;if(o&&v)(0,_releaseOptIn.markReleaseOptIn)();else(0,_releaseOptIn.clearReleaseOptIn)()},[a,o,v,l.status]);if(!a&&!o)return t.signIn&&!t.headless?(0,_jsxRuntime.jsx)(_BuoySignInWeb.BuoySignIn,{}):null;if(!v)return t.headless?null:(0,_jsxRuntime.jsx)(_sharedUi.AccountSetup,{});return(0,_jsxRuntime.jsx)(AdmittedFloatingDevTools,{...t})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.44";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.46";
@@ -0,0 +1 @@
1
+ "use strict";import{useState as a}from"react";import{createPortal as y}from"react-dom";import{useBuoySession as x}from"@buoy-gg/license";import{jsx as t,Fragment as d,jsxs as l}from"react/jsx-runtime";const u="#20C997";export function BuoySignIn(){const{status:c,signIn:g,signOut:p}=x();const[o,i]=a(false);const[n,r]=a(null);if(typeof document==="undefined")return null;const m=()=>{r(null);i(true);g().catch(s=>r(s instanceof Error?s.message:"Sign-in did not work. Try again.")).finally(()=>i(false))};const e=c.state==="active";return y(t("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:e||n?"12px 14px":0,borderRadius:16,background:e||n?"#0f1419":"transparent",color:"#e6edf3",boxShadow:e||n?"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:e?l(d,{children:[t("div",{"data-testid":"buoy-signin-needs-plan",children:"Buoy on a live site needs a Pro or Business plan."}),t("button",{type:"button",onClick:()=>void p(),style:b,"data-testid":"buoy-signout",children:"Sign out"})]}):l(d,{children:[n?t("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:n}):null,t("button",{type:"button",onClick:m,disabled:o,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:u,color:"#04130d",fontWeight:600,fontSize:14,cursor:o?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:o?"Signing in\u2026":"Sign in to Buoy"})]})}),document.body)}const b={marginTop:8,padding:0,border:"none",background:"none",color:u,fontSize:14,cursor:"pointer",textDecoration:"underline"};
@@ -1 +1 @@
1
- "use strict";import{useState as m,useEffect as L,useCallback as K,useMemo as W}from"react";import{View as y,Text as u,StyleSheet as Xe,ScrollView as me,TouchableOpacity as j,Dimensions as Se,Platform as Ze}from"react-native";import{settingsBus as A}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as rt,Info as Q,Layers as st,ChevronRightIcon as be,ChevronDown as we,getStorageBackendType as at,getUseLicense as it,persistentStorage as D,Trash2 as lt,CheckCircle2 as Te,LicenseEntryModal as ct,BackgroundSwitcher as dt,night as o,NightCard as R,NightRows as X,NightSectionLabel as gt,NightFootnote as ve,NightSwitch as xe,NightButton as ze,NightSegmented as ut,NightBadge as v,NightSeparator as ht,monoFont as Ie}from"@buoy-gg/shared-ui";import{EnvIcon as Ce,StorageIcon as yt,RoutesIcon as ft,NetworkIcon as pt,QueryIcon as mt,HighlighterIcon as St,ReduxIcon as bt,EventsIcon as wt}from"@buoy-gg/floating-tools-core";import{useDefaultConfig as Le}from"./DefaultConfigContext.js";import{renderAppIcon as Tt}from"./AppIcon";import{JsModal as vt,devToolsStorageKeys as Z}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as xt}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as a,Fragment as k}from"react/jsx-runtime";const N="@react_buoy_dev_tools_settings";const zt=6;const V=d=>{let g=zt;const i={};for(const[f,l]of Object.entries(d)){if(l&&g>0){i[f]=true;g-=1}else{i[f]=false}}return i};const It=(d,g)=>{const{userStatus:i,environment:f,...l}=d;const h=g?Object.entries(l).filter(([p])=>g.includes(p)):Object.entries(l);return{...Object.fromEntries(h),environment:f??false}};const De=(d,g,i)=>{if(!g)return d;const f={...d.dialTools,...g.dialTools??{}};const l=i?.allowedDialKeys?Object.entries(f).filter(([p])=>i.allowedDialKeys?.includes(p)):Object.entries(f);const h=V(Object.fromEntries(l));return{dialTools:h,floatingTools:It({...d.floatingTools,...g.floatingTools??{}},i?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...g.globalSettings??{}}}};const Ct=(d=[],g,i)=>{const f={};const l={};const h=new Set(g??[]);const p=new Set(i??[]);const S=!i||i.length===0;for(const x of d){const{id:c,slot:I="both"}=x;if(I==="dial"||I==="both"){f[c]=S?true:p.has(c)}if(I==="row"||I==="both"){l[c]=h.has(c)}}return{dialTools:V(f),floatingTools:{...l,environment:h.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:d,onClose:g,onSettingsChange:i,initialSettings:f,availableApps:l=[],storage:h=D,zIndex:p})=>{const{defaultFloatingTools:S,defaultDialTools:x}=Le();const c=W(()=>Ct(l,S,x),[l,S,x]);const I=W(()=>Object.keys(c.dialTools),[c]);const te=W(()=>Object.keys(c.floatingTools).filter(t=>t!=="environment"),[c]);const[z,E]=m(f||P||c);const[B,oe]=m(ee??"floating");const[ne,Ee]=m(ee!==null);const[_,Fe]=m(new Set);const[Oe,J]=m(false);const[ke,Pe]=m(false);L(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const b=et();L(()=>{const t=async()=>{try{const r=await D.getItem(Z.settings.activeTab());if(r&&["floating","settings","pro"].includes(r)){const s=r;ee=s;oe(T=>T===s?T:s)}}catch(r){}finally{Ee(true)}};t()},[]);L(()=>{if(!ne)return;D.setItem(Z.settings.activeTab(),B).catch(t=>{console.warn("Failed to save settings active tab:",t)})},[B,ne]);const He=it();const H=He?.();const F=H?.isPro??false;const U=!F&&H?.licenseKey?H.error:null;const Me=H?.errorKind==="transport";const[w,Ke]=m(Re);const[G,re]=m(false);const[q,Y]=m(false);const[O,We]=m(false);const[$,se]=m([]);const[ae,ie]=m(false);const le=xt();const ce=Se.get("window").height;const de=Se.get("window").width;const je=Math.floor(ce*.33);const Ae=Math.min(de-32,400);const ge=K(async()=>{try{const t=await h.getItem(N);if(t){const r=JSON.parse(t);const s=De(c,r,{allowedDialKeys:I,allowedFloatingKeys:te});P=s;E(T=>Be(T,s)?T:s);return}P=c;E(r=>Be(r,c)?r:c)}catch(t){console.error("Failed to load dev tools settings:",t);E(c)}},[c,I,te,h]);L(()=>{ge()},[ge]);L(()=>{at().then(t=>{Re=t;Ke(r=>r===t?r:t)})},[]);L(()=>{if(O){ie(true);D.getAllKeys().then(t=>{se(t.sort())}).catch(()=>{se([])}).finally(()=>{ie(false)})}},[O]);const ue=async t=>{try{const r={...t,dialTools:V(t.dialTools)};await h.setItem(N,JSON.stringify(r));P=r;E(r);i?.(r);A.emit(r)}catch(r){console.error("Failed to save dev tools settings:",r)}};const Ne=t=>{const r={...z,floatingTools:{...z.floatingTools,[t]:!z.floatingTools[t]}};ue(r)};const Ve=t=>{const r={...z,globalSettings:{...z.globalSettings,[t]:!z.globalSettings?.[t]}};ue(r)};const _e=async()=>{re(true);Y(false);try{await D.clear();Y(true);E(c);if(h!==D)await h.setItem(N,JSON.stringify(c));i?.(c);A.emit(c);setTimeout(()=>Y(false),2e3)}catch(t){console.error("Failed to clear storage:",t)}finally{re(false)}};const Je=K(t=>{},[]);const Ue=t=>{const r=l.find(s=>s.id===t);if(r?.description){return r.description}if(t==="environment"){return"Environment badge."}return""};const he=t=>{if(t==="environment"){return"Env Badge"}const r=l.find(s=>s.id===t);return r?.name??t.toUpperCase().replace(/_/g," ")};const Ge=t=>{if(!ke)return null;switch(t){case"query":return e(mt,{size:18});case"env":return e(Ce,{size:18});case"sentry":return e(tt,{size:18,color:"#9945FF"});case"storage":return e(yt,{size:18,bgColor:o.color.surface});case"wifi":case"query-wifi-toggle":return e(ot,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return e(ft,{size:18,bgColor:o.color.surface});case"network":return e(pt,{size:18});case"environment":return e(Ce,{size:18});case"debug-borders":return e(st,{size:18,color:o.color.accent});case"highlight-updates":return e(rt,{size:18,color:o.color.accent});case"highlight-updates-modal":return e(St,{size:18});case"redux":return e(bt,{size:18});case"image-overlay":return e(nt,{size:18});case"events":return e(wt,{size:18});case"zustand":try{const{ZustandIcon:r}=require("@buoy-gg/zustand");return e(r,{size:18})}catch{return e(Q,{size:18,color:o.color.textSecondary})}case"jotai":try{const{JotaiIcon:r}=require("@buoy-gg/jotai");return e(r,{size:18})}catch{return e(Q,{size:18,color:o.color.textSecondary})}default:{const r=l.find(s=>s.id===t);if(r?.icon!=null){return Tt(r.icon,{slot:"row",size:18,color:r.color})}return e(Q,{size:18,color:o.color.textSecondary})}}};const qe=(t,r,s,T)=>{const M=Ue(t);return a(j,{activeOpacity:s?1:.7,onPress:()=>!s&&T(),accessibilityLabel:he(t),accessibilityRole:"button",style:[n.toolRow,s&&n.rowDisabled],children:[e(y,{style:n.toolIconSlot,children:Ge(t)}),a(y,{style:n.rowInfo,children:[a(u,{style:n.rowLabel,children:[he(t),s?" \xB7 max 6":""]}),M?e(u,{style:n.rowCaption,numberOfLines:1,children:M}):null]}),e(xe,{value:r,disabled:s,onValueChange:()=>T()})]},t)};const ye=t=>{Fe(r=>{const s=new Set(r);if(s.has(t)){s.delete(t)}else{s.add(t)}return s})};const fe=(t,r,s,T,M)=>{const Qe=z.globalSettings?.[t]??false;const pe=_.has(t);return a(y,{children:[a(j,{activeOpacity:.7,onPress:()=>ye(t),accessibilityLabel:r,style:n.settingRow,children:[a(y,{style:n.rowInfo,children:[e(u,{style:n.rowLabel,children:r}),e(u,{style:n.rowCaption,numberOfLines:pe?0:1,children:s})]}),e(xe,{value:Qe,onValueChange:()=>Ve(t)})]}),pe&&a(y,{style:n.settingRowBody,children:[e(u,{style:n.settingRowBodyText,children:T}),e(u,{style:n.settingRowBodyHint,children:M})]})]},t)};const C=(t,r,s)=>a(y,{children:[e(gt,{children:t}),r,s]});const Ye=w==="filesystem"?e(v,{label:"File System",tone:"accent"}):w==="asyncstorage"?e(v,{label:"Async Storage",tone:"warning"}):w==="localstorage"?e(v,{label:"Local Storage",tone:"accent"}):w==="memory"?e(v,{label:"Memory",tone:"danger"}):e(v,{label:"Loading\u2026",tone:"neutral"});const $e=()=>a(y,{style:n.container,children:[a(me,{style:n.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:n.scrollContainer,children:[B==="floating"&&e(k,{children:C("Floating Tools",e(R,{glass:true,children:e(X,{children:Object.entries(z.floatingTools).map(([t,r])=>qe(t,r,false,()=>Ne(t)))})}),e(ve,{children:"Tools switched on here appear in the floating bubble row."}))}),B==="settings"&&a(k,{children:[C("Background",e(R,{glass:true,padded:true,children:e(dt,{embedded:true})})),C("Storage",a(R,{glass:true,children:[a(j,{activeOpacity:.7,onPress:()=>We(!O),accessibilityLabel:"Storage Type",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(u,{style:n.rowLabel,children:"Storage Type"})}),Ye,O?e(we,{size:16,color:o.color.textTertiary}):e(be,{size:16,color:o.color.textTertiary})]}),O&&a(k,{children:[a(y,{style:n.settingRowBody,children:[e(u,{style:n.settingRowBodyText,children:w==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":w==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":w==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":w==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),w==="asyncstorage"&&e(u,{style:[n.settingRowBodyText,n.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),w==="memory"&&e(u,{style:[n.settingRowBodyText,n.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),e(ht,{}),a(y,{style:n.storageExpanded,children:[a(y,{style:n.storageExpandedHeader,children:[e(u,{style:n.storageExpandedTitle,children:"SAVED SETTINGS"}),e(u,{style:n.storageExpandedCount,children:ae?"\u2026":`${$.length} keys`})]}),ae?e(u,{style:n.storageKeyEmpty,children:"Loading\u2026"}):$.length===0?e(u,{style:n.storageKeyEmpty,children:"No settings saved yet"}):e(me,{style:n.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:$.map(t=>e(y,{style:n.storageKeyItem,children:e(u,{style:n.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(y,{style:n.cardButtonWrap,children:e(ze,{label:q?"Cleared":G?"Clearing\u2026":"Clear All Settings",variant:q?"secondary":"destructive",size:"md",disabled:G,onPress:_e,icon:q?e(Te,{size:15,color:o.color.accent}):e(lt,{size:15,color:G?o.color.textTertiary:o.color.danger})})})]})]})),b&&b.state!=="idle"&&C("Desktop Sync",a(R,{glass:true,children:[a(j,{activeOpacity:.7,onPress:()=>ye("desktopSync"),accessibilityLabel:"Buoy Desktop",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(u,{style:n.rowLabel,children:"Buoy Desktop"})}),b.state==="connected"?e(v,{label:"Connected",tone:"accent"}):b.state==="connecting"?e(v,{label:"Connecting\u2026",tone:"neutral"}):e(v,{label:"Retrying",tone:"warning"}),_.has("desktopSync")?e(we,{size:16,color:o.color.textTertiary}):e(be,{size:16,color:o.color.textTertiary})]}),_.has("desktopSync")&&a(y,{style:n.settingRowBody,children:[a(u,{style:n.settingRowBodyText,children:[b.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(u,{style:n.footnoteMono,children:b.targetURL??"(unknown URL)"}),b.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),b.state==="retrying"&&b.lastError&&a(u,{style:[n.settingRowBodyText,n.bodyWarning],children:["Last error: ",b.lastError]})]})]})),C("Modal Behavior",e(R,{glass:true,children:a(X,{children:[fe("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."),Ze.OS!=="web"?fe("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"&&a(k,{children:[C("License",e(R,{glass:true,children:a(y,{style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(u,{style:n.rowLabel,children:"License Status"})}),e(y,{testID:"buoy-settings-license-status",accessibilityLabel:F?"License: Active":"License: Free",children:F?e(v,{label:"Active",tone:"accent"}):e(v,{label:"Free",tone:"neutral"})})]})}),e(ve,{children:F?"You have full access to all Buoy DevTools features.":U?Me?`Couldn't reach the license server (${U}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${U}.`:"Upgrade to Pro to unlock all features and support development."})),!F&&a(k,{children:[C("Pro Features",e(R,{glass:true,children:e(X,{children:["Advanced Settings","Priority Support"].map(t=>a(y,{style:n.featureRow,children:[e(Te,{size:16,color:o.color.accent}),e(u,{style:n.rowLabel,children:t})]},t))})})),e(ze,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>J(true)})]})]})]}),e(ct,{visible:Oe,onClose:()=>J(false),onSuccess:()=>J(false)})]});return e(vt,{visible:d,onClose:g,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(y,{style:n.headerRow,children:e(ut,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:B,onChange:t=>oe(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:Z.settings.root(),enablePersistence:true,maxHeight:ce-le.top,initialHeight:je,initialFloatingPosition:{x:(de-Ae)/2,y:le.top+20},enableGlitchEffects:true,children:$e()})};const Lt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Dt=(d,g)=>{const i=new Set(d??[]);const f=new Set(g??[]);const l={};for(const p of f){l[p]=true}const h={environment:i.has("environment")};for(const p of i){if(p!=="environment"){h[p]=true}}return{dialTools:V(l),floatingTools:h,globalSettings:{enableSharedModalDimensions:false}}};let P=null;let ee=null;let Re=null;const Be=(d,g)=>JSON.stringify(d)===JSON.stringify(g);A.addListener(d=>{if(d)P=d});export const useDevToolsSettings=()=>{const{defaultFloatingTools:d,defaultDialTools:g}=Le();const i=W(()=>{if(!d&&!g){return Lt}return Dt(d,g)},[d,g]);const[f,l]=m(i);const h=K(async()=>{try{const S=await D.getItem(N);if(S){const x=JSON.parse(S);const c=De(i,x);l(c);return}l(i)}catch(S){console.error("Failed to load dev tools settings:",S);l(i)}},[i]);L(()=>{h();const S=A.addListener(x=>{try{if(x){l(x)}}catch(c){}});return()=>{S()}},[h]);const p=K(()=>{h()},[h]);return{settings:f,refreshSettings:p}};const n=Xe.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:o.gutter,paddingRight:o.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:o.gutter,paddingTop:8,paddingBottom:24,gap:o.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:o.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:o.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:o.color.text,fontSize:o.font.row,fontWeight:"500"},rowCaption:{color:o.color.textTertiary,fontSize:o.font.label},settingRowBody:{paddingHorizontal:o.rowPadH,paddingBottom:o.rowPadV,gap:6},settingRowBodyText:{color:o.color.textSecondary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},settingRowBodyHint:{color:o.color.textTertiary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},bodyWarning:{color:o.color.warning},bodyDanger:{color:o.color.danger},cardButtonWrap:{paddingHorizontal:o.cardPad,paddingTop:10,paddingBottom:o.cardPad},storageExpanded:{paddingHorizontal:o.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:o.color.textSecondary,fontSize:o.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:o.color.textTertiary,fontSize:o.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:o.color.glassElevated,borderRadius:o.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:o.color.textSecondary,fontSize:o.font.micro,fontFamily:Ie},storageKeyEmpty:{color:o.color.textTertiary,fontSize:o.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Ie,fontSize:o.font.label,color:o.color.textSecondary}});
1
+ "use strict";import{useState as m,useEffect as L,useCallback as K,useMemo as W}from"react";import{View as u,Text as y,StyleSheet as Xe,ScrollView as Se,TouchableOpacity as j,Dimensions as be,Platform as Ze}from"react-native";import{settingsBus as A}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as rt,Info as Q,Layers as st,ChevronRightIcon as we,ChevronDown as Te,getStorageBackendType as it,getUseLicense as at,signOutOfBuoy as lt,persistentStorage as D,Trash2 as ct,CheckCircle2 as ve,LicenseEntryModal as dt,BackgroundSwitcher as gt,night as o,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 St,HighlighterIcon as bt,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}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as zt}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as s,Fragment as P}from"react/jsx-runtime";const N="@react_buoy_dev_tools_settings";const It=6;const V=d=>{let g=It;const a={};for(const[f,l]of Object.entries(d)){if(l&&g>0){a[f]=true;g-=1}else{a[f]=false}}return a};const Ct=(d,g)=>{const{userStatus:a,environment:f,...l}=d;const h=g?Object.entries(l).filter(([p])=>g.includes(p)):Object.entries(l);return{...Object.fromEntries(h),environment:f??false}};const De=(d,g,a)=>{if(!g)return d;const f={...d.dialTools,...g.dialTools??{}};const l=a?.allowedDialKeys?Object.entries(f).filter(([p])=>a.allowedDialKeys?.includes(p)):Object.entries(f);const h=V(Object.fromEntries(l));return{dialTools:h,floatingTools:Ct({...d.floatingTools,...g.floatingTools??{}},a?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...g.globalSettings??{}}}};const Lt=(d=[],g,a)=>{const f={};const l={};const h=new Set(g??[]);const p=new Set(a??[]);const S=!a||a.length===0;for(const x of d){const{id:c,slot:I="both"}=x;if(I==="dial"||I==="both"){f[c]=S?true:p.has(c)}if(I==="row"||I==="both"){l[c]=h.has(c)}}return{dialTools:V(f),floatingTools:{...l,environment:h.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:d,onClose:g,onSettingsChange:a,initialSettings:f,availableApps:l=[],storage:h=D,zIndex:p})=>{const{defaultFloatingTools:S,defaultDialTools:x}=Le();const c=W(()=>Lt(l,S,x),[l,S,x]);const I=W(()=>Object.keys(c.dialTools),[c]);const oe=W(()=>Object.keys(c.floatingTools).filter(t=>t!=="environment"),[c]);const[z,E]=m(f||H||c);const[B,ne]=m(te??"floating");const[re,Ee]=m(te!==null);const[_,Fe]=m(new Set);const[Oe,J]=m(false);const[ke,Pe]=m(false);L(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const b=et();L(()=>{const t=async()=>{try{const r=await D.getItem(ee.settings.activeTab());if(r&&["floating","settings","pro"].includes(r)){const i=r;te=i;ne(T=>T===i?T:i)}}catch(r){}finally{Ee(true)}};t()},[]);L(()=>{if(!re)return;D.setItem(ee.settings.activeTab(),B).catch(t=>{console.warn("Failed to save settings active tab:",t)})},[B,re]);const He=at();const F=He?.();const O=F?.isPro??false;const U=!O&&F?.licenseKey?F.error:null;const Me=F?.errorKind==="transport";const[w,Ke]=m(Re);const[G,se]=m(false);const[q,Y]=m(false);const[k,We]=m(false);const[$,ie]=m([]);const[ae,le]=m(false);const ce=zt();const de=be.get("window").height;const ge=be.get("window").width;const je=Math.floor(de*.33);const Ae=Math.min(ge-32,400);const ue=K(async()=>{try{const t=await h.getItem(N);if(t){const r=JSON.parse(t);const i=De(c,r,{allowedDialKeys:I,allowedFloatingKeys:oe});H=i;E(T=>Be(T,i)?T:i);return}H=c;E(r=>Be(r,c)?r:c)}catch(t){console.error("Failed to load dev tools settings:",t);E(c)}},[c,I,oe,h]);L(()=>{ue()},[ue]);L(()=>{it().then(t=>{Re=t;Ke(r=>r===t?r:t)})},[]);L(()=>{if(k){le(true);D.getAllKeys().then(t=>{ie(t.sort())}).catch(()=>{ie([])}).finally(()=>{le(false)})}},[k]);const ye=async t=>{try{const r={...t,dialTools:V(t.dialTools)};await h.setItem(N,JSON.stringify(r));H=r;E(r);a?.(r);A.emit(r)}catch(r){console.error("Failed to save dev tools settings:",r)}};const Ne=t=>{const r={...z,floatingTools:{...z.floatingTools,[t]:!z.floatingTools[t]}};ye(r)};const Ve=t=>{const r={...z,globalSettings:{...z.globalSettings,[t]:!z.globalSettings?.[t]}};ye(r)};const _e=async()=>{se(true);Y(false);try{await D.clear();Y(true);E(c);if(h!==D)await h.setItem(N,JSON.stringify(c));a?.(c);A.emit(c);setTimeout(()=>Y(false),2e3)}catch(t){console.error("Failed to clear storage:",t)}finally{se(false)}};const Je=K(t=>{},[]);const Ue=t=>{const r=l.find(i=>i.id===t);if(r?.description){return r.description}if(t==="environment"){return"Environment badge."}return""};const he=t=>{if(t==="environment"){return"Env Badge"}const r=l.find(i=>i.id===t);return r?.name??t.toUpperCase().replace(/_/g," ")};const Ge=t=>{if(!ke)return null;switch(t){case"query":return e(St,{size:18});case"env":return e(Ce,{size:18});case"sentry":return e(tt,{size:18,color:"#9945FF"});case"storage":return e(ft,{size:18,bgColor:o.color.surface});case"wifi":case"query-wifi-toggle":return e(ot,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return e(pt,{size:18,bgColor:o.color.surface});case"network":return e(mt,{size:18});case"environment":return e(Ce,{size:18});case"debug-borders":return e(st,{size:18,color:o.color.accent});case"highlight-updates":return e(rt,{size:18,color:o.color.accent});case"highlight-updates-modal":return e(bt,{size:18});case"redux":return e(wt,{size:18});case"image-overlay":return e(nt,{size:18});case"events":return e(Tt,{size:18});case"zustand":try{const{ZustandIcon:r}=require("@buoy-gg/zustand");return e(r,{size:18})}catch{return e(Q,{size:18,color:o.color.textSecondary})}case"jotai":try{const{JotaiIcon:r}=require("@buoy-gg/jotai");return e(r,{size:18})}catch{return e(Q,{size:18,color:o.color.textSecondary})}default:{const r=l.find(i=>i.id===t);if(r?.icon!=null){return vt(r.icon,{slot:"row",size:18,color:r.color})}return e(Q,{size:18,color:o.color.textSecondary})}}};const qe=(t,r,i,T)=>{const M=Ue(t);return s(j,{activeOpacity:i?1:.7,onPress:()=>!i&&T(),accessibilityLabel:he(t),accessibilityRole:"button",style:[n.toolRow,i&&n.rowDisabled],children:[e(u,{style:n.toolIconSlot,children:Ge(t)}),s(u,{style:n.rowInfo,children:[s(y,{style:n.rowLabel,children:[he(t),i?" \xB7 max 6":""]}),M?e(y,{style:n.rowCaption,numberOfLines:1,children:M}):null]}),e(ze,{value:r,disabled:i,onValueChange:()=>T()})]},t)};const fe=t=>{Fe(r=>{const i=new Set(r);if(i.has(t)){i.delete(t)}else{i.add(t)}return i})};const pe=(t,r,i,T,M)=>{const Qe=z.globalSettings?.[t]??false;const me=_.has(t);return s(u,{children:[s(j,{activeOpacity:.7,onPress:()=>fe(t),accessibilityLabel:r,style:n.settingRow,children:[s(u,{style:n.rowInfo,children:[e(y,{style:n.rowLabel,children:r}),e(y,{style:n.rowCaption,numberOfLines:me?0:1,children:i})]}),e(ze,{value:Qe,onValueChange:()=>Ve(t)})]}),me&&s(u,{style:n.settingRowBody,children:[e(y,{style:n.settingRowBodyText,children:T}),e(y,{style:n.settingRowBodyHint,children:M})]})]},t)};const C=(t,r,i)=>s(u,{children:[e(ut,{children:t}),r,i]});const Ye=w==="filesystem"?e(v,{label:"File System",tone:"accent"}):w==="asyncstorage"?e(v,{label:"Async Storage",tone:"warning"}):w==="localstorage"?e(v,{label:"Local Storage",tone:"accent"}):w==="memory"?e(v,{label:"Memory",tone:"danger"}):e(v,{label:"Loading\u2026",tone:"neutral"});const $e=()=>s(u,{style:n.container,children:[s(Se,{style:n.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:n.scrollContainer,children:[B==="floating"&&e(P,{children:C("Floating Tools",e(R,{glass:true,children:e(X,{children:Object.entries(z.floatingTools).map(([t,r])=>qe(t,r,false,()=>Ne(t)))})}),e(xe,{children:"Tools switched on here appear in the floating bubble row."}))}),B==="settings"&&s(P,{children:[C("Background",e(R,{glass:true,padded:true,children:e(gt,{embedded:true})})),C("Storage",s(R,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>We(!k),accessibilityLabel:"Storage Type",style:n.settingRow,children:[e(u,{style:n.rowInfo,children:e(y,{style:n.rowLabel,children:"Storage Type"})}),Ye,k?e(Te,{size:16,color:o.color.textTertiary}):e(we,{size:16,color:o.color.textTertiary})]}),k&&s(P,{children:[s(u,{style:n.settingRowBody,children:[e(y,{style:n.settingRowBodyText,children:w==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":w==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":w==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":w==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),w==="asyncstorage"&&e(y,{style:[n.settingRowBodyText,n.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),w==="memory"&&e(y,{style:[n.settingRowBodyText,n.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),e(ht,{}),s(u,{style:n.storageExpanded,children:[s(u,{style:n.storageExpandedHeader,children:[e(y,{style:n.storageExpandedTitle,children:"SAVED SETTINGS"}),e(y,{style:n.storageExpandedCount,children:ae?"\u2026":`${$.length} keys`})]}),ae?e(y,{style:n.storageKeyEmpty,children:"Loading\u2026"}):$.length===0?e(y,{style:n.storageKeyEmpty,children:"No settings saved yet"}):e(Se,{style:n.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:$.map(t=>e(u,{style:n.storageKeyItem,children:e(y,{style:n.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(u,{style:n.cardButtonWrap,children:e(Z,{label:q?"Cleared":G?"Clearing\u2026":"Clear All Settings",variant:q?"secondary":"destructive",size:"md",disabled:G,onPress:_e,icon:q?e(ve,{size:15,color:o.color.accent}):e(ct,{size:15,color:G?o.color.textTertiary:o.color.danger})})})]})]})),b&&b.state!=="idle"&&C("Desktop Sync",s(R,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>fe("desktopSync"),accessibilityLabel:"Buoy Desktop",style:n.settingRow,children:[e(u,{style:n.rowInfo,children:e(y,{style:n.rowLabel,children:"Buoy Desktop"})}),b.state==="connected"?e(v,{label:"Connected",tone:"accent"}):b.state==="connecting"?e(v,{label:"Connecting\u2026",tone:"neutral"}):e(v,{label:"Retrying",tone:"warning"}),_.has("desktopSync")?e(Te,{size:16,color:o.color.textTertiary}):e(we,{size:16,color:o.color.textTertiary})]}),_.has("desktopSync")&&s(u,{style:n.settingRowBody,children:[s(y,{style:n.settingRowBodyText,children:[b.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(y,{style:n.footnoteMono,children:b.targetURL??"(unknown URL)"}),b.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),b.state==="retrying"&&b.lastError&&s(y,{style:[n.settingRowBodyText,n.bodyWarning],children:["Last error: ",b.lastError]})]})]})),C("Modal Behavior",e(R,{glass:true,children:s(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."),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]})}))]}),B==="pro"&&s(P,{children:[C("License",s(R,{glass:true,children:[s(u,{style:n.settingRow,children:[e(u,{style:n.rowInfo,children:e(y,{style:n.rowLabel,children:"License Status"})}),e(u,{testID:"buoy-settings-license-status",accessibilityLabel:O?"License: Active":"License: Free",children:O?e(v,{label:"Active",tone:"accent"}):e(v,{label:"Free",tone:"neutral"})})]}),F?.tierSource==="session"?s(u,{style:n.settingRow,children:[e(u,{style:n.rowInfo,children:e(y,{style:n.rowLabel,children:"Signed in with Buoy"})}),e(Z,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void lt(),testID:"buoy-settings-signout"})]}):null]}),e(xe,{children:O?"You have full access to all Buoy DevTools features.":U?Me?`Couldn't reach the license server (${U}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${U}.`:"Upgrade to Pro to unlock all features and support development."})),!O&&s(P,{children:[C("Pro Features",e(R,{glass:true,children:e(X,{children:["Advanced Settings","Priority Support"].map(t=>s(u,{style:n.featureRow,children:[e(ve,{size:16,color:o.color.accent}),e(y,{style:n.rowLabel,children:t})]},t))})})),e(Z,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>J(true)})]})]})]}),e(dt,{visible:Oe,onClose:()=>J(false),onSuccess:()=>J(false)})]});return e(xt,{visible:d,onClose:g,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(u,{style:n.headerRow,children:e(yt,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:B,onChange:t=>ne(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:ee.settings.root(),enablePersistence:true,maxHeight:de-ce.top,initialHeight:je,initialFloatingPosition:{x:(ge-Ae)/2,y:ce.top+20},enableGlitchEffects:true,children:$e()})};const Dt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Rt=(d,g)=>{const a=new Set(d??[]);const f=new Set(g??[]);const l={};for(const p of f){l[p]=true}const h={environment:a.has("environment")};for(const p of a){if(p!=="environment"){h[p]=true}}return{dialTools:V(l),floatingTools:h,globalSettings:{enableSharedModalDimensions:false}}};let H=null;let te=null;let Re=null;const Be=(d,g)=>JSON.stringify(d)===JSON.stringify(g);A.addListener(d=>{if(d)H=d});export const useDevToolsSettings=()=>{const{defaultFloatingTools:d,defaultDialTools:g}=Le();const a=W(()=>{if(!d&&!g){return Dt}return Rt(d,g)},[d,g]);const[f,l]=m(a);const h=K(async()=>{try{const S=await D.getItem(N);if(S){const x=JSON.parse(S);const c=De(a,x);l(c);return}l(a)}catch(S){console.error("Failed to load dev tools settings:",S);l(a)}},[a]);L(()=>{h();const S=A.addListener(x=>{try{if(x){l(x)}}catch(c){}});return()=>{S()}},[h]);const p=K(()=>{h()},[h]);return{settings:f,refreshSettings:p}};const n=Xe.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:o.gutter,paddingRight:o.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:o.gutter,paddingTop:8,paddingBottom:24,gap:o.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:o.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:o.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:o.color.text,fontSize:o.font.row,fontWeight:"500"},rowCaption:{color:o.color.textTertiary,fontSize:o.font.label},settingRowBody:{paddingHorizontal:o.rowPadH,paddingBottom:o.rowPadV,gap:6},settingRowBodyText:{color:o.color.textSecondary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},settingRowBodyHint:{color:o.color.textTertiary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},bodyWarning:{color:o.color.warning},bodyDanger:{color:o.color.danger},cardButtonWrap:{paddingHorizontal:o.cardPad,paddingTop:10,paddingBottom:o.cardPad},storageExpanded:{paddingHorizontal:o.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:o.color.textSecondary,fontSize:o.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:o.color.textTertiary,fontSize:o.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:o.color.glassElevated,borderRadius:o.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:o.color.textSecondary,fontSize:o.font.micro,fontFamily:Ie},storageKeyEmpty:{color:o.color.textTertiary,fontSize:o.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Ie,fontSize:o.font.label,color:o.color.textSecondary}});
@@ -1 +1 @@
1
- "use strict";import{FloatingToolHost as oe}from"@buoy-gg/shared-ui";import{AccountSetup as ne}from"@buoy-gg/shared-ui";import Me,{useMemo as t,useCallback as se,useEffect as P}from"react";import{View as J,StyleSheet as N}from"react-native";import{AppHostProvider as ie}from"./AppHost";import{FloatingMenu as ue}from"./FloatingMenu.js";import{AppOverlay as ce}from"./AppHost";import{ToolOpenerBridge as le}from"./ToolOpenerBridge.js";import{autoDiscoverPresets as ae,autoDiscoverPresetsWithCustom as ge}from"./autoDiscoverPresets.js";import{sendInstallPing as ye}from"../telemetry/installPing.js";import{isTelemetryEnabled as me}from"../Buoy.js";import{renderAppIcon as pe}from"./AppIcon";import{DevToolsVisibilityProvider as de}from"./DevToolsVisibilityContext.js";import{reportOptionalRequireError as n}from"./optionalRequire.js";import{HintsProvider as fe,normalizeEnvironment as be}from"@buoy-gg/shared-ui";import{MinimizedToolsProvider as ve}from"./MinimizedToolsContext.js";import{validateDialConfig as he}from"./defaultConfig.js";import{DefaultConfigProvider as Oe}from"./DefaultConfigContext.js";import{LicenseManager as Te,useProAccess as Ae,useLicense as Re}from"@buoy-gg/license";import{AutoExternalSync as Q,ToolRegistryPublisher as qe,isExternalSyncAvailable as Ee}from"./autoExternalSync.js";import{externalSyncOptions as k,releaseTransportProblem as _e,shouldMountExternalSync as Ie}from"./externalSyncGate.js";import{jsx as r,Fragment as O,jsxs as y}from"react/jsx-runtime";let W=null;function xe(s){if(!s||s===W)return;W=s;console.warn(s)}export const FloatingDevTools=({apps:s,requiredEnvVars:i,requiredStorageKeys:p,askBuoy:T,children:G,disableHints:X=false,defaultFloatingTools:Y,defaultDialTools:d,requireLicense:Pe,licenseKey:f,zustandStores:A,environment:Z,externalSync:b=true,headless:z=false,...C})=>{const $=Z??be(process.env.NODE_ENV??"dev");const{isLicensed:v}=Ae();const{licenseKey:R,isInitialized:M,tier:h,access:u}=Re();const K=f===void 0||f.trim().toUpperCase()===(R??"");const ee=K&&u.status==="admitted";P(()=>{if(!M||u.status==="initializing")return;void ye({tier:u.status==="admitted"?h:"locked",enabled:me()})},[M,u.status,h]);P(()=>{void Te.configure(f).catch(()=>{})},[f]);P(()=>{if(!A||u.status==="locked")return;try{const{watchStores:e}=require("@buoy-gg/zustand");return e(A)}catch(e){n("@buoy-gg/zustand",e)}},[A,u.status]);const re=t(()=>{if(d){return he(d)}return d},[d]);const q=t(()=>{const e=[];if(i&&i.length>0){try{const{createEnvTool:o,createEnvVarConfig:D}=require("@buoy-gg/env");e.push(o({requiredEnvVars:D(i)}))}catch(o){n("@buoy-gg/env",o)}}if(p&&p.length>0){try{const{createStorageTool:o}=require("@buoy-gg/storage");e.push(o({requiredStorageKeys:p}))}catch(o){n("@buoy-gg/storage",o)}}if(T){try{const{createAskBuoyTool:o}=require("@buoy-gg/ask-buoy");e.push(o(T))}catch(o){n("@buoy-gg/ask-buoy",o)}}return e},[i,p,T]);const E=t(()=>{if(!s&&q.length===0)return void 0;return[...s||[],...q]},[s,q]);const m=t(()=>E?ge(E):ae(),[E]);const _=t(()=>m.filter(e=>e.sync),[m]);const F=t(()=>{try{const{DebugBordersStandaloneOverlay:e}=require("@buoy-gg/debug-borders");return e}catch(e){n("@buoy-gg/debug-borders",e);return null}},[]);const H=t(()=>{try{const{HighlightUpdatesOverlay:e}=require("@buoy-gg/highlight-updates");return e}catch(e){n("@buoy-gg/highlight-updates",e);return null}},[]);const j=t(()=>{try{const{ImageOverlayStandalone:e}=require("@buoy-gg/image-overlay");return e}catch(e){n("@buoy-gg/image-overlay",e);return null}},[]);const L=t(()=>{try{const{PerfMonitorOverlay:e}=require("@buoy-gg/perf-monitor");return e}catch(e){n("@buoy-gg/perf-monitor",e);return null}},[]);const S=t(()=>{try{const{JsTopHudOverlay:e}=require("@buoy-gg/js-top");return e}catch(e){n("@buoy-gg/js-top",e);return null}},[]);const c=t(()=>{try{const{RouteTracker:e}=require("@buoy-gg/route-events");return e}catch(e){n("@buoy-gg/route-events",e);return null}},[]);const l=t(()=>{try{const{ReactQueryTracker:e}=require("@buoy-gg/react-query");return e}catch(e){n("@buoy-gg/react-query",e);return null}},[]);const w=t(()=>{try{const{ImpersonateOverlay:e}=require("@buoy-gg/impersonate");return e}catch(e){n("@buoy-gg/impersonate",e);return null}},[]);const U=t(()=>{try{const{ScenariosOverlay:e}=require("@buoy-gg/scenarios");return e}catch(e){n("@buoy-gg/scenarios",e);return null}},[]);const a=t(()=>{try{const{ReduxAutoInstrument:e}=require("@buoy-gg/redux");return e??null}catch(e){n("@buoy-gg/redux",e);return null}},[]);const g=t(()=>{try{const{ConsoleRoot:e}=require("@buoy-gg/console");return e??null}catch(e){n("@buoy-gg/console",e);return null}},[]);const te=se(e=>{const o=m.find(D=>D.id===e);if(!o)return null;return pe(o.icon,{slot:"dial",size:20,color:o.color})},[m]);const I=typeof __DEV__!=="undefined"&&__DEV__;if(!I&&!v){return null}const V=Ie({isDevelopment:I,isLicensed:v,externalSync:b,isAvailable:Ee()});const x=k(b);if(!I&&x?.enableInRelease){xe(_e(x.socketURL,x))}const B=r(qe,{requiredEnvVars:i,customApps:_});if(!ee){return y(O,{children:[u.status==="initializing"&&y(O,{children:[a&&r(a,{}),g&&r(g,{}),c&&r(c,{}),l&&r(l,{})]}),!z&&r(ne,{})]})}if(z){return y(O,{children:[a&&r(a,{}),g&&r(g,{}),c&&r(c,{}),l&&r(l,{}),B,V&&r(Q,{options:k(b),requiredEnvVars:i,isPro:v,tier:h,licenseKey:R,customApps:_})]})}return r(Oe,{defaultFloatingTools:Y,defaultDialTools:re,children:r(fe,{disableHints:X,children:r(J,{style:De.container,pointerEvents:"box-none",__buoyDevToolsRoot:true,children:y(de,{children:[j&&r(J,{style:N.absoluteFill,pointerEvents:"box-none",collapsable:false,children:r(j,{})}),r(ie,{children:y(ve,{getToolIcon:te,children:[r(ue,{...C,apps:m,environment:$}),C.hidden?null:y(O,{children:[r(ce,{}),r(oe,{})]}),r(le,{})]})}),G,F&&r(F,{}),H&&r(H,{}),L&&r(L,{}),S&&r(S,{}),w&&r(w,{}),U&&r(U,{}),a&&r(a,{}),g&&r(g,{}),c&&r(c,{}),l&&r(l,{}),B,V&&r(Q,{options:k(b),requiredEnvVars:i,isPro:v,tier:h,licenseKey:R,customApps:_})]})})})})};const De=N.create({container:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:9999}});
1
+ "use strict";import{FloatingToolHost as oe}from"@buoy-gg/shared-ui";import{AccountSetup as ne}from"@buoy-gg/shared-ui";import Fe,{useMemo as t,useCallback as se,useEffect as P}from"react";import{View as J,StyleSheet as N}from"react-native";import{AppHostProvider as ie}from"./AppHost";import{FloatingMenu as ue}from"./FloatingMenu.js";import{AppOverlay as ce}from"./AppHost";import{ToolOpenerBridge as le}from"./ToolOpenerBridge.js";import{autoDiscoverPresets as ae,autoDiscoverPresetsWithCustom as ge}from"./autoDiscoverPresets.js";import{sendInstallPing as ye}from"../telemetry/installPing.js";import{isTelemetryEnabled as me}from"../Buoy.js";import{renderAppIcon as de}from"./AppIcon";import{DevToolsVisibilityProvider as pe}from"./DevToolsVisibilityContext.js";import{reportOptionalRequireError as n}from"./optionalRequire.js";import{HintsProvider as fe,normalizeEnvironment as be}from"@buoy-gg/shared-ui";import{MinimizedToolsProvider as ve}from"./MinimizedToolsContext.js";import{validateDialConfig as he}from"./defaultConfig.js";import{DefaultConfigProvider as Oe}from"./DefaultConfigContext.js";import{LicenseManager as Te,useProAccess as Ae,useLicense as Re,sameLicenseKey as qe}from"@buoy-gg/license";import{AutoExternalSync as Q,ToolRegistryPublisher as Ee,isExternalSyncAvailable as _e}from"./autoExternalSync.js";import{externalSyncOptions as k,releaseTransportProblem as Ie,shouldMountExternalSync as xe}from"./externalSyncGate.js";import{jsx as r,Fragment as O,jsxs as y}from"react/jsx-runtime";let W=null;function De(s){if(!s||s===W)return;W=s;console.warn(s)}export const FloatingDevTools=({apps:s,requiredEnvVars:i,requiredStorageKeys:d,askBuoy:T,children:G,disableHints:X=false,defaultFloatingTools:Y,defaultDialTools:p,requireLicense:ke,licenseKey:f,zustandStores:A,environment:Z,externalSync:b=true,headless:z=false,...M})=>{const $=Z??be(process.env.NODE_ENV??"dev");const{isLicensed:v}=Ae();const{licenseKey:R,isInitialized:C,tier:h,access:u}=Re();const K=f===void 0||qe(f,R);const ee=K&&u.status==="admitted";P(()=>{if(!C||u.status==="initializing")return;void ye({tier:u.status==="admitted"?h:"locked",enabled:me()})},[C,u.status,h]);P(()=>{void Te.configure(f).catch(()=>{})},[f]);P(()=>{if(!A||u.status==="locked")return;try{const{watchStores:e}=require("@buoy-gg/zustand");return e(A)}catch(e){n("@buoy-gg/zustand",e)}},[A,u.status]);const re=t(()=>{if(p){return he(p)}return p},[p]);const q=t(()=>{const e=[];if(i&&i.length>0){try{const{createEnvTool:o,createEnvVarConfig:D}=require("@buoy-gg/env");e.push(o({requiredEnvVars:D(i)}))}catch(o){n("@buoy-gg/env",o)}}if(d&&d.length>0){try{const{createStorageTool:o}=require("@buoy-gg/storage");e.push(o({requiredStorageKeys:d}))}catch(o){n("@buoy-gg/storage",o)}}if(T){try{const{createAskBuoyTool:o}=require("@buoy-gg/ask-buoy");e.push(o(T))}catch(o){n("@buoy-gg/ask-buoy",o)}}return e},[i,d,T]);const E=t(()=>{if(!s&&q.length===0)return void 0;return[...s||[],...q]},[s,q]);const m=t(()=>E?ge(E):ae(),[E]);const _=t(()=>m.filter(e=>e.sync),[m]);const F=t(()=>{try{const{DebugBordersStandaloneOverlay:e}=require("@buoy-gg/debug-borders");return e}catch(e){n("@buoy-gg/debug-borders",e);return null}},[]);const H=t(()=>{try{const{HighlightUpdatesOverlay:e}=require("@buoy-gg/highlight-updates");return e}catch(e){n("@buoy-gg/highlight-updates",e);return null}},[]);const L=t(()=>{try{const{ImageOverlayStandalone:e}=require("@buoy-gg/image-overlay");return e}catch(e){n("@buoy-gg/image-overlay",e);return null}},[]);const j=t(()=>{try{const{PerfMonitorOverlay:e}=require("@buoy-gg/perf-monitor");return e}catch(e){n("@buoy-gg/perf-monitor",e);return null}},[]);const S=t(()=>{try{const{JsTopHudOverlay:e}=require("@buoy-gg/js-top");return e}catch(e){n("@buoy-gg/js-top",e);return null}},[]);const c=t(()=>{try{const{RouteTracker:e}=require("@buoy-gg/route-events");return e}catch(e){n("@buoy-gg/route-events",e);return null}},[]);const l=t(()=>{try{const{ReactQueryTracker:e}=require("@buoy-gg/react-query");return e}catch(e){n("@buoy-gg/react-query",e);return null}},[]);const w=t(()=>{try{const{ImpersonateOverlay:e}=require("@buoy-gg/impersonate");return e}catch(e){n("@buoy-gg/impersonate",e);return null}},[]);const V=t(()=>{try{const{ScenariosOverlay:e}=require("@buoy-gg/scenarios");return e}catch(e){n("@buoy-gg/scenarios",e);return null}},[]);const a=t(()=>{try{const{ReduxAutoInstrument:e}=require("@buoy-gg/redux");return e??null}catch(e){n("@buoy-gg/redux",e);return null}},[]);const g=t(()=>{try{const{ConsoleRoot:e}=require("@buoy-gg/console");return e??null}catch(e){n("@buoy-gg/console",e);return null}},[]);const te=se(e=>{const o=m.find(D=>D.id===e);if(!o)return null;return de(o.icon,{slot:"dial",size:20,color:o.color})},[m]);const I=typeof __DEV__!=="undefined"&&__DEV__;if(!I&&!v){return null}const U=xe({isDevelopment:I,isLicensed:v,externalSync:b,isAvailable:_e()});const x=k(b);if(!I&&x?.enableInRelease){De(Ie(x.socketURL,x))}const B=r(Ee,{requiredEnvVars:i,customApps:_});if(!ee){return y(O,{children:[u.status==="initializing"&&y(O,{children:[a&&r(a,{}),g&&r(g,{}),c&&r(c,{}),l&&r(l,{})]}),!z&&r(ne,{})]})}if(z){return y(O,{children:[a&&r(a,{}),g&&r(g,{}),c&&r(c,{}),l&&r(l,{}),B,U&&r(Q,{options:k(b),requiredEnvVars:i,isPro:v,tier:h,licenseKey:R,customApps:_})]})}return r(Oe,{defaultFloatingTools:Y,defaultDialTools:re,children:r(fe,{disableHints:X,children:r(J,{style:Pe.container,pointerEvents:"box-none",__buoyDevToolsRoot:true,children:y(pe,{children:[L&&r(J,{style:N.absoluteFill,pointerEvents:"box-none",collapsable:false,children:r(L,{})}),r(ie,{children:y(ve,{getToolIcon:te,children:[r(ue,{...M,apps:m,environment:$}),M.hidden?null:y(O,{children:[r(ce,{}),r(oe,{})]}),r(le,{})]})}),G,F&&r(F,{}),H&&r(H,{}),j&&r(j,{}),S&&r(S,{}),w&&r(w,{}),V&&r(V,{}),a&&r(a,{}),g&&r(g,{}),c&&r(c,{}),l&&r(l,{}),B,U&&r(Q,{options:k(b),requiredEnvVars:i,isPro:v,tier:h,licenseKey:R,customApps:_})]})})})})};const Pe=N.create({container:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:9999}});
@@ -1 +1 @@
1
- "use strict";import{FloatingToolHost as oe}from"@buoy-gg/shared-ui/floating";import{LicenseManager as ie,useLicense as se}from"@buoy-gg/license";import{AccountSetup as re}from"@buoy-gg/shared-ui";import{useState as x,useMemo as h,useCallback as b,useEffect as c,useRef as ae}from"react";import{useSettings as ce,getToolLabel as E,getToolDescription as le,getToolColor as F}from"@buoy-gg/floating-tools-react";import{persistentStorage as d,devToolsStorageKeys as I,EnvironmentIndicator as de,EnvironmentSelectorInline as me}from"@buoy-gg/shared-ui";import{autoDiscoverWithCustom as pe,getToolsBySlot as N}from"../utils/autoDiscoverPresets.web.js";import{FloatingTools as ue,UserStatus as fe}from"./floatingTools.web.js";import{DialMenu as ge}from"./dial/DialDevTools.web.js";import{getRankedToolIds as ye,recordToolUsage as ve}from"./dial/dialUsageStore.js";import{OnboardingTooltip as Te}from"./dial/OnboardingTooltip.web.js";import{SettingsModal as he}from"./DevToolsSettingsModal.web.js";import{AppHostProvider as be,AppOverlay as Oe,useAppHost as Se}from"./AppHost.web.js";import{MinimizedToolsStack as Ce}from"./MinimizedToolsStack.web.js";import{createWebTools as De}from"../utils/createWebTools.js";import{BrowserToolRuntime as we}from"./BrowserToolRuntime.js";import{markReleaseOptIn as Ee}from"../releaseOptIn.js";import{DevToolsVisibilityProvider as Ie,useDevToolsVisibility as _e}from"./DevToolsVisibilityContext.js";import{jsx as t,jsxs as Y}from"react/jsx-runtime";const Me={};const G="@react_buoy_floating_menu_tooltip_shown";const Pe=d;function ke({size:o=14,color:m="#20C997"}){const s=Math.max(2,o/4);const p=Math.max(1,o/16);return t("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${s}px)`,gap:p,width:o,height:o,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((u,l)=>t("div",{style:{width:s,height:s,borderRadius:s/2,backgroundColor:m}},l))})}function xe(o){return t(Ie,{children:t(be,{children:t(Ae,{...o})})})}function Ae({environment:o,userRole:m,availableEnvironments:s,onEnvironmentSwitch:p,apps:u,modules:l=Me,externalSync:O,requiredEnvVars:H,sentryGetClient:q,disableHints:_=false,headless:A=false}){const[r,S]=x(false);const[f,C]=x(false);const M=ae(false);const g=Se();const a=h(()=>pe([...De(l),...u??[]]),[u,l]);const D=_e();const L=g.openApps.some(e=>!e.minimized);c(()=>{D.setDialOpen(r)},[r,D.setDialOpen]);c(()=>{D.setToolOpen(L||f)},[L,f,D.setToolOpen]);const{registerApps:K}=g;c(()=>{K(a.map(e=>{const n=e.icon;return{...e,icon:typeof n==="function"?({size:i})=>n(i):n}}))},[K,a]);const $=h(()=>a.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[a]);const{settings:P}=ce({availableTools:$,storage:Pe});c(()=>{let e=false;const n=async()=>{const[i,T]=await Promise.all([d.getItem(I.dial.isOpen()),d.getItem(I.settings.modalOpen())]);if(e)return;if(i==="true")S(true);if(T==="true"){S(true);C(true)}M.current=true};void n();return()=>{e=true}},[]);c(()=>{if(!M.current)return;void d.setItem(I.dial.isOpen(),r?"true":"false")},[r]);c(()=>{if(!M.current)return;void d.setItem(I.settings.modalOpen(),f?"true":"false")},[f]);const k=b(e=>{void ve(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const n=typeof e.icon==="function"?e.icon(20):e.icon;g.open({id:e.id,title:e.name||E(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:n,color:e.color||F(e.id)})}else{e.onPress?.()}},[g]);const w=h(()=>{const e=N(a,"dial");return e.map(n=>{const i=n.color||F(n.id);let T;if(typeof n.icon==="string"){T=n.icon}else if(typeof n.icon==="function"){T=n.icon(32)}else{T=null}return{id:n.id,name:n.name||E(n.id),icon:T,unavailable:!n.component&&!n.onPress,color:i,onPress:()=>{k(n);S(false)}}})},[a,k]);const J=h(()=>{if(!r)return w;const e=new Map(w.map(n=>[n.id,n]));return ye(w.map(n=>n.id)).map(n=>e.get(n)).filter(n=>Boolean(n))},[r,w]);const Q=h(()=>N(a,"row").filter(e=>P.floatingTools[e.id]===true&&(e.component||e.onPress)),[a,P.floatingTools]);const X=h(()=>a.map(e=>({id:e.id,name:e.name||E(e.id),description:e.description||le(e.id),slot:e.slot,icon:e.icon,color:e.color})),[a]);const[Z,R]=x(false);const j=g.openApps.some(e=>!e.minimized);c(()=>{if(_)return;let e=false;const n=setTimeout(async()=>{const i=await d.getItem(G);if(!e&&!i)R(true)},1e3);return()=>{e=true;clearTimeout(n)}},[_]);const y=b(()=>{R(false);void d.setItem(G,"true")},[]);const V=b(()=>{y();S(true)},[y]);const ee=b(()=>{S(false);C(false)},[]);const ne=b(()=>{C(e=>!e)},[]);const te=b(()=>C(false),[]);const B=Boolean(s?.length&&p);const U=P.floatingTools.environment!==false;const v=Z&&!r&&!j;c(()=>{if(!v)return;const e=i=>{if(!(i.target instanceof Element)||!i.target.closest("[data-buoy-root]"))y()};const n=i=>{if(i.key==="Escape")y()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",n);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",n)}},[v,y]);const W=g.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const z=t(we,{modules:l,apps:u,requiredEnvVars:H,externalSync:O,headless:A,sentryGetClient:q});if(A)return z;return Y("div",{"data-buoy-root":"",style:{display:"contents"},children:[z,v&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),Y(ue,{enablePositionPersistence:!v,pushToSide:r||j,suspendPointerEvents:r,centerOnboarding:v,minimizedStack:W?t(Ce,{}):void 0,hasMinimizedStack:W,children:[o&&U&&!B&&t(de,{environment:o}),B&&U&&t(me,{currentEnvironment:o??"local",availableEnvironments:s,onSelect:p}),m?t(fe,{userRole:m,onPress:V}):t("button",{"aria-label":"Open dev tools",onClick:V,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:t(ke,{})}),Q.map(e=>t("button",{"aria-label":e.name||E(e.id),title:e.description,onClick:()=>k(e),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof e.icon==="function"?e.icon(16):e.icon},e.id))]}),v&&t(Te,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:y}),r&&t(ge,{icons:J,onClose:ee,centerLabel:"BUOY",onCenterPress:ne,settingsOpen:f,hintsDisabled:_}),t(he,{visible:f,onClose:te,availableTools:X,onSettingsChange:e=>{}}),t(Oe,{}),t(oe,{})]})}export function FloatingDevTools(o){const{access:m,isPro:s,licenseKey:p}=se();c(()=>{void ie.configure(o.licenseKey)},[o.licenseKey]);const u=o.licenseKey===void 0||o.licenseKey.trim().toUpperCase()===(p??"");const l=typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production";const O=u&&m.status==="admitted";c(()=>{if(!l&&s&&O)Ee()},[l,s,O]);if(!l&&!s)return null;if(!O)return o.headless?null:t(re,{});return t(xe,{...o})}
1
+ "use strict";import{FloatingToolHost as oe}from"@buoy-gg/shared-ui/floating";import{LicenseManager as ie,useLicense as se,sameLicenseKey as re}from"@buoy-gg/license";import{AccountSetup as ae}from"@buoy-gg/shared-ui";import{useState as x,useMemo as T,useCallback as b,useEffect as c,useRef as ce}from"react";import{useSettings as le,getToolLabel as C,getToolDescription as de,getToolColor as U}from"@buoy-gg/floating-tools-react";import{persistentStorage as m,devToolsStorageKeys as E,EnvironmentIndicator as me,EnvironmentSelectorInline as ue}from"@buoy-gg/shared-ui";import{autoDiscoverWithCustom as pe,getToolsBySlot as N}from"../utils/autoDiscoverPresets.web.js";import{FloatingTools as fe,UserStatus as ge}from"./floatingTools.web.js";import{DialMenu as ye}from"./dial/DialDevTools.web.js";import{getRankedToolIds as ve,recordToolUsage as he}from"./dial/dialUsageStore.js";import{OnboardingTooltip as Te}from"./dial/OnboardingTooltip.web.js";import{SettingsModal as be}from"./DevToolsSettingsModal.web.js";import{AppHostProvider as Oe,AppOverlay as Ie,useAppHost as Se}from"./AppHost.web.js";import{MinimizedToolsStack as De}from"./MinimizedToolsStack.web.js";import{createWebTools as we}from"../utils/createWebTools.js";import{BrowserToolRuntime as Ce}from"./BrowserToolRuntime.js";import{clearReleaseOptIn as Ee,markReleaseOptIn as _e}from"../releaseOptIn.js";import{BuoySignIn as Me}from"./BuoySignIn.web.js";import{DevToolsVisibilityProvider as Pe,useDevToolsVisibility as ke}from"./DevToolsVisibilityContext.js";import{jsx as t,jsxs as Y}from"react/jsx-runtime";const xe={};const G="@react_buoy_floating_menu_tooltip_shown";const Ae=m;function Le({size:o=14,color:d="#20C997"}){const s=Math.max(2,o/4);const u=Math.max(1,o/16);return t("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${s}px)`,gap:u,width:o,height:o,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((p,l)=>t("div",{style:{width:s,height:s,borderRadius:s/2,backgroundColor:d}},l))})}function Ke(o){return t(Pe,{children:t(Oe,{children:t(Re,{...o})})})}function Re({environment:o,userRole:d,availableEnvironments:s,onEnvironmentSwitch:u,apps:p,modules:l=xe,externalSync:O,requiredEnvVars:H,sentryGetClient:q,disableHints:_=false,headless:A=false}){const[r,I]=x(false);const[f,S]=x(false);const M=ce(false);const g=Se();const a=T(()=>pe([...we(l),...p??[]]),[p,l]);const D=ke();const L=g.openApps.some(e=>!e.minimized);c(()=>{D.setDialOpen(r)},[r,D.setDialOpen]);c(()=>{D.setToolOpen(L||f)},[L,f,D.setToolOpen]);const{registerApps:K}=g;c(()=>{K(a.map(e=>{const n=e.icon;return{...e,icon:typeof n==="function"?({size:i})=>n(i):n}}))},[K,a]);const $=T(()=>a.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[a]);const{settings:P}=le({availableTools:$,storage:Ae});c(()=>{let e=false;const n=async()=>{const[i,h]=await Promise.all([m.getItem(E.dial.isOpen()),m.getItem(E.settings.modalOpen())]);if(e)return;if(i==="true")I(true);if(h==="true"){I(true);S(true)}M.current=true};void n();return()=>{e=true}},[]);c(()=>{if(!M.current)return;void m.setItem(E.dial.isOpen(),r?"true":"false")},[r]);c(()=>{if(!M.current)return;void m.setItem(E.settings.modalOpen(),f?"true":"false")},[f]);const k=b(e=>{void he(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const n=typeof e.icon==="function"?e.icon(20):e.icon;g.open({id:e.id,title:e.name||C(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:n,color:e.color||U(e.id)})}else{e.onPress?.()}},[g]);const w=T(()=>{const e=N(a,"dial");return e.map(n=>{const i=n.color||U(n.id);let h;if(typeof n.icon==="string"){h=n.icon}else if(typeof n.icon==="function"){h=n.icon(32)}else{h=null}return{id:n.id,name:n.name||C(n.id),icon:h,unavailable:!n.component&&!n.onPress,color:i,onPress:()=>{k(n);I(false)}}})},[a,k]);const J=T(()=>{if(!r)return w;const e=new Map(w.map(n=>[n.id,n]));return ve(w.map(n=>n.id)).map(n=>e.get(n)).filter(n=>Boolean(n))},[r,w]);const Q=T(()=>N(a,"row").filter(e=>P.floatingTools[e.id]===true&&(e.component||e.onPress)),[a,P.floatingTools]);const X=T(()=>a.map(e=>({id:e.id,name:e.name||C(e.id),description:e.description||de(e.id),slot:e.slot,icon:e.icon,color:e.color})),[a]);const[Z,R]=x(false);const j=g.openApps.some(e=>!e.minimized);c(()=>{if(_)return;let e=false;const n=setTimeout(async()=>{const i=await m.getItem(G);if(!e&&!i)R(true)},1e3);return()=>{e=true;clearTimeout(n)}},[_]);const y=b(()=>{R(false);void m.setItem(G,"true")},[]);const B=b(()=>{y();I(true)},[y]);const ee=b(()=>{I(false);S(false)},[]);const ne=b(()=>{S(e=>!e)},[]);const te=b(()=>S(false),[]);const V=Boolean(s?.length&&u);const z=P.floatingTools.environment!==false;const v=Z&&!r&&!j;c(()=>{if(!v)return;const e=i=>{if(!(i.target instanceof Element)||!i.target.closest("[data-buoy-root]"))y()};const n=i=>{if(i.key==="Escape")y()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",n);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",n)}},[v,y]);const W=g.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const F=t(Ce,{modules:l,apps:p,requiredEnvVars:H,externalSync:O,headless:A,sentryGetClient:q});if(A)return F;return Y("div",{"data-buoy-root":"",style:{display:"contents"},children:[F,v&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),Y(fe,{enablePositionPersistence:!v,pushToSide:r||j,suspendPointerEvents:r,centerOnboarding:v,minimizedStack:W?t(De,{}):void 0,hasMinimizedStack:W,children:[o&&z&&!V&&t(me,{environment:o}),V&&z&&t(ue,{currentEnvironment:o??"local",availableEnvironments:s,onSelect:u}),d?t(ge,{userRole:d,onPress:B}):t("button",{"aria-label":"Open dev tools",onClick:B,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:t(Le,{})}),Q.map(e=>t("button",{"aria-label":e.name||C(e.id),title:e.description,onClick:()=>k(e),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof e.icon==="function"?e.icon(16):e.icon},e.id))]}),v&&t(Te,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:y}),r&&t(ye,{icons:J,onClose:ee,centerLabel:"BUOY",onCenterPress:ne,settingsOpen:f,hintsDisabled:_}),t(be,{visible:f,onClose:te,availableTools:X,onSettingsChange:e=>{}}),t(Ie,{}),t(oe,{})]})}export function FloatingDevTools(o){const{access:d,isPro:s,licenseKey:u}=se();c(()=>{void ie.configure(o.licenseKey)},[o.licenseKey]);const p=o.licenseKey===void 0||re(o.licenseKey,u);const l=typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production";const O=p&&d.status==="admitted";c(()=>{if(l||d.status==="initializing")return;if(s&&O)_e();else Ee()},[l,s,O,d.status]);if(!l&&!s)return o.signIn&&!o.headless?t(Me,{}):null;if(!O)return o.headless?null:t(ae,{});return t(Ke,{...o})}
@@ -1 +1 @@
1
- "use strict";export const SDK_VERSION="7.0.44";
1
+ "use strict";export const SDK_VERSION="7.0.46";
@@ -85,11 +85,11 @@ export declare const Buoy: {
85
85
  */
86
86
  getState(): {
87
87
  tier: import("@buoy-gg/license").BuoyTier;
88
+ tierSource: import("@buoy-gg/license").TierSource;
88
89
  isPro: boolean;
89
90
  access: import("@buoy-gg/license").AccountAccess;
90
91
  isInitialized: boolean;
91
92
  isValidating: boolean;
92
- tierSource: import("@buoy-gg/license").TierSource;
93
93
  licenseKey: string | null;
94
94
  error: string | null;
95
95
  errorKind: "transport" | "verdict" | null;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * "Sign in to Buoy" for a live site (BUOY_SIGN_IN_PLAN.md, step 1.5).
3
+ *
4
+ * Shown by FloatingDevTools in a production build when the site passes
5
+ * `signIn` and nobody with a paid plan is signed in. The site decides who sees
6
+ * it (its own admins), the same way it decides who sees Buoy at all.
7
+ *
8
+ * The click handler calls signIn() directly: the popup has to open before
9
+ * anything awaits, or the browser blocks it.
10
+ */
11
+ export declare function BuoySignIn(): import("react").ReactPortal | null;
12
+ //# sourceMappingURL=BuoySignIn.web.d.ts.map
@@ -24,6 +24,13 @@ export interface FloatingDevToolsProps {
24
24
  /** Keep capture and desktop sync running without the floating menu. */
25
25
  headless?: boolean;
26
26
  licenseKey?: string;
27
+ /**
28
+ * Live sites: show a "Sign in to Buoy" button when nobody with a paid plan
29
+ * is signed in. Buoy then opens for that person, with no key in the build.
30
+ * Only render FloatingDevTools with this for your own admins and testers.
31
+ * The site must be on your list at buoy.gg/dashboard/sites.
32
+ */
33
+ signIn?: boolean;
27
34
  /** @deprecated Accounts are required for all dev tools. */
28
35
  requireLicense?: boolean;
29
36
  }
@@ -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.44";
12
+ export declare const SDK_VERSION = "7.0.46";
13
13
  //# sourceMappingURL=version.d.ts.map
@@ -85,11 +85,11 @@ export declare const Buoy: {
85
85
  */
86
86
  getState(): {
87
87
  tier: import("@buoy-gg/license").BuoyTier;
88
+ tierSource: import("@buoy-gg/license").TierSource;
88
89
  isPro: boolean;
89
90
  access: import("@buoy-gg/license").AccountAccess;
90
91
  isInitialized: boolean;
91
92
  isValidating: boolean;
92
- tierSource: import("@buoy-gg/license").TierSource;
93
93
  licenseKey: string | null;
94
94
  error: string | null;
95
95
  errorKind: "transport" | "verdict" | null;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * "Sign in to Buoy" for a live site (BUOY_SIGN_IN_PLAN.md, step 1.5).
3
+ *
4
+ * Shown by FloatingDevTools in a production build when the site passes
5
+ * `signIn` and nobody with a paid plan is signed in. The site decides who sees
6
+ * it (its own admins), the same way it decides who sees Buoy at all.
7
+ *
8
+ * The click handler calls signIn() directly: the popup has to open before
9
+ * anything awaits, or the browser blocks it.
10
+ */
11
+ export declare function BuoySignIn(): import("react").ReactPortal | null;
12
+ //# sourceMappingURL=BuoySignIn.web.d.ts.map
@@ -24,6 +24,13 @@ export interface FloatingDevToolsProps {
24
24
  /** Keep capture and desktop sync running without the floating menu. */
25
25
  headless?: boolean;
26
26
  licenseKey?: string;
27
+ /**
28
+ * Live sites: show a "Sign in to Buoy" button when nobody with a paid plan
29
+ * is signed in. Buoy then opens for that person, with no key in the build.
30
+ * Only render FloatingDevTools with this for your own admins and testers.
31
+ * The site must be on your list at buoy.gg/dashboard/sites.
32
+ */
33
+ signIn?: boolean;
27
34
  /** @deprecated Accounts are required for all dev tools. */
28
35
  requireLicense?: boolean;
29
36
  }
@@ -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.44";
12
+ export declare const SDK_VERSION = "7.0.46";
13
13
  //# sourceMappingURL=version.d.ts.map
package/lib/web/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- "use client";import{$ as kn,A as In,Aa as Mn,B as Rn,Ba as An,C as Dn,Ca as En,D as On,Da as Bn,E as Fn,Ea as Ln,F as Pn,Fa as $n,G as Hn,Ga as jn,H as Wn,Ha as Nn,I as Un,Ia as Kn,J as Vn,Ja as Gn,K as _n,Ka as qn,L as Jn,La as Xn,M as Yn,Ma as Qn,N as Zn,Na as ea,O as ta,Oa as oa,P as na,Pa as aa,Q as ia,Qa as ra,R as sa,Ra as la,S as ca,Sa as da,T as ua,Ta as pa,U as ma,Ua as ga,V as fa,Va as ha,W as ya,Wa as ba,X as Sa,Xa as va,Y as wa,Ya as xa,Z as Ca,_ as Ta,a as W,aa as za,b as U,ba as ka,c as Ze,ca as Ia,d as jt,da as Ma,e as Kl,ea as Ra,f as xe,fa as Aa,g as Wt,ga as Da,h as Oe,ha as Ea,i as Nt,ia as Oa,j as Ba,ja as Fa,k as La,ka as Pa,l as $a,la as Ha,m as ja,ma as Wa,n as Na,na as Ua,o as Ka,oa as Va,p as Ga,pa as _a,q as qa,qa as Ja,r as Xa,ra as Ya,s as Qa,sa as Za,t as ei,ta as ti,u as oi,ua as ni,v as ai,va as ii,w as ri,wa as si,x as li,xa as ci,y as di,ya as ui,z as pi,za as mi}from"./chunks/chunk-QZDVCMCT.mjs";import{b as gi,c as fi}from"./chunks/chunk-5SGL6QL4.mjs";import{a as Ut,d as et}from"./chunks/chunk-R7RGRTY5.mjs";import{FloatingToolHost as hi}from"@buoy-gg/shared-ui/web/floating";import{LicenseManager as yi,useLicense as bi}from"@buoy-gg/license/web";import{AccountSetup as Si}from"@buoy-gg/shared-ui/web";import{useState as vt,useMemo as Be,useCallback as Fe,useEffect as de,useRef as vi}from"react";import{useSettings as wi,getToolLabel as tt,getToolDescription as xi,getToolColor as Kt}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Ce,devToolsStorageKeys as ot,EnvironmentIndicator as Ci,EnvironmentSelectorInline as Ti}from"@buoy-gg/shared-ui/web";var zi=[];function ki(){return[]}function Vt(e=[]){return[...new Map(e.map(t=>[t.id,t])).values()]}function wt(e,t){return e.filter(o=>{let a=o.slot||"both";return a==="both"||a===t})}function Ii(e,t){let o=t instanceof Set?t:new Set(t);return e.filter(a=>o.has(a.id))}import{FloatingTool as Gt,FloatingToolDivider as Mi,FloatingToolUserStatus as _t,getBubbleAnchorPosition as Ri}from"@buoy-gg/shared-ui/web/floating";import{useState as Q,useEffect as Te,useMemo as nt,useRef as at,useCallback as it}from"react";import{getDialLayout as Ai,getAllIconPositions as Di,getGridLineRotations as Ei,getIconStaggerInputRange as Oi,MAX_DIAL_SLOTS as We,DIAL_ICON_SIZE as Bi,dialAnimationConfig as qt,getDialCSSKeyframesString as Fi,getDialCSSAnimationStyles as Li,dialColors as F,dialStyles as S,withAlpha as Jt,floatingToolsColors as Pi}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Xt,monoFont as Yt,ToolBackground as $i,useToolBackground as Hi}from"@buoy-gg/shared-ui/web";import{memo as ji}from"react";import{RasterLayer as Wi,scatter as Ni,useLoop as Ui,withBgAlpha as Ki}from"@buoy-gg/shared-ui/web";import{Fragment as Vi,jsx as Ne}from"react/jsx-runtime";var Gi=.94,_i=6,qi=2400,rt=3,Qt=16,Ji=Array.from({length:rt},(e,t)=>Ni(22343^t*40503,Qt*4)),Zt=["#FFFFFF","#B3D9FF","#8CB3FF"],eo=Math.PI/3,to=14*Math.PI/180;function Xi(e){let t=Math.min(5,Math.floor(e*6)),o=e*6-t;return t*eo+to/2+o*(eo-to)}function Yi(e){return Math.min(_i,1/(1-e*Gi))}function Qi(e){let t=.15+.85*e*e;return e<.06?t*=e/.06:e>.94&&(t*=(1-e)/.06),Math.min(.7,t)}function Zi(e){let t=e/rt,o=[],a=12;for(let d=0;d<=a;d++)o.push(d/a);let n=(1-t)%1;n>.001&&n<1-.001&&o.push(n-1e-4,n+1e-4),o.sort((d,p)=>d-p);let i=[],l=[],u=[];for(let d of o){let p=t===0&&d===1?1:(d+t)%1;i.push(d),l.push(Yi(p)),u.push(Qi(p))}return{input:i,scale:l,opacity:u}}var er=Array.from({length:rt},(e,t)=>Zi(t)),tr=ji(function({size:e}){let t=Ui(qi),o=e/2,a=[];for(let n=0;n<rt;n++){let i=Ji[n],l=er[n],u=[];for(let d=0;d<Qt;d++){let p=Xi(i[d*4]),m=(.15+.85*Math.sqrt(i[d*4+1]))*.5*o,x=Zt[Math.floor(i[d*4+3]*Zt.length)%3],g=o+Math.cos(p)*m,R=o+Math.sin(p)*m,v=.6,I=v*2.4;u.push(Ne(W,{style:{position:"absolute",left:g-I/2,top:R-I/2,width:I,height:I,borderRadius:I/2,backgroundColor:Ki(x,.3)}},`${d}-h`),Ne(W,{style:{position:"absolute",left:g-v/2,top:R-v/2,width:v,height:v,borderRadius:v/2,backgroundColor:x}},d))}a.push(Ne(xe.View,{style:{position:"absolute",left:0,top:0,width:e,height:e,opacity:t.interpolate({inputRange:l.input,outputRange:l.opacity}),transform:[{scale:t.interpolate({inputRange:l.input,outputRange:l.scale})}]},pointerEvents:"none",children:Ne(Wi,{style:{width:e,height:e},raster:false,children:u})},n))}return Ne(Vi,{children:a})});import{useEffect as or,useState as oo}from"react";import{dialColors as Le,withAlpha as no}from"@buoy-gg/floating-tools-react/web";import{ARROW_BOTTOM_OFFSET as nr,ARROW_HEIGHT as ar,SPACING_GAP as cc,getScreenCenterY as dc,calculateTooltipPosition as ir,calculateTargetPosition as uc}from"@buoy-gg/shared-ui/web/floating";import{monoFont as ao}from"@buoy-gg/shared-ui/web";import{jsx as Pe,jsxs as io}from"react/jsx-runtime";var ro=false;function rr(){if(ro||typeof document>"u")return;let e=document.createElement("style");e.textContent=`
1
+ "use client";import{$ as En,A as Bn,Aa as On,B as Fn,Ba as Ln,C as Pn,Ca as $n,D as jn,Da as Hn,E as Wn,Ea as Nn,F as Vn,Fa as Un,G as Kn,Ga as _n,H as Gn,Ha as qn,I as Jn,Ia as Xn,J as Yn,Ja as Qn,K as Zn,Ka as ea,L as ta,La as oa,M as na,Ma as aa,N as ia,Na as ra,O as sa,Oa as la,P as ca,Pa as da,Q as ua,Qa as pa,R as ma,Ra as ga,S as fa,Sa as ha,T as ya,Ta as ba,U as Sa,Ua as va,V as wa,Va as xa,W as Ca,Wa as Ta,X as za,Xa as ka,Y as Ia,Ya as Ma,Z as Ra,_ as Aa,a as H,aa as Da,b as N,ba as Ea,c as et,ca as Ba,d as Nt,da as Oa,e as tc,ea as Fa,f as xe,fa as La,g as Vt,ga as Pa,h as Be,ha as $a,i as Ut,ia as ja,j as Ha,ja as Wa,k as Na,ka as Va,l as Ua,la as Ka,m as _a,ma as Ga,n as qa,na as Ja,o as Xa,oa as Ya,p as Qa,pa as Za,q as ei,qa as ti,r as oi,ra as ni,s as ai,sa as ii,t as ri,ta as si,u as li,ua as ci,v as di,va as ui,w as pi,wa as mi,x as gi,xa as fi,y as hi,ya as yi,z as bi,za as Si}from"./chunks/chunk-QZDVCMCT.mjs";import{b as vi,c as Kt}from"./chunks/chunk-5SGL6QL4.mjs";import{a as _t,d as tt}from"./chunks/chunk-R7RGRTY5.mjs";import{FloatingToolHost as wi}from"@buoy-gg/shared-ui/web/floating";import{LicenseManager as xi,useLicense as Ci,sameLicenseKey as Ti}from"@buoy-gg/license/web";import{AccountSetup as zi}from"@buoy-gg/shared-ui/web";import{useState as wt,useMemo as Oe,useCallback as Fe,useEffect as de,useRef as ki}from"react";import{useSettings as Ii,getToolLabel as ot,getToolDescription as Mi,getToolColor as Gt}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Ce,devToolsStorageKeys as nt,EnvironmentIndicator as Ri,EnvironmentSelectorInline as Ai}from"@buoy-gg/shared-ui/web";var Di=[];function Ei(){return[]}function qt(e=[]){return[...new Map(e.map(t=>[t.id,t])).values()]}function xt(e,t){return e.filter(o=>{let a=o.slot||"both";return a==="both"||a===t})}function Bi(e,t){let o=t instanceof Set?t:new Set(t);return e.filter(a=>o.has(a.id))}import{FloatingTool as Jt,FloatingToolDivider as Oi,FloatingToolUserStatus as Xt,getBubbleAnchorPosition as Fi}from"@buoy-gg/shared-ui/web/floating";import{useState as Q,useEffect as Te,useMemo as at,useRef as it,useCallback as rt}from"react";import{getDialLayout as Li,getAllIconPositions as Pi,getGridLineRotations as $i,getIconStaggerInputRange as ji,MAX_DIAL_SLOTS as We,DIAL_ICON_SIZE as Hi,dialAnimationConfig as Yt,getDialCSSKeyframesString as Wi,getDialCSSAnimationStyles as Ni,dialColors as F,dialStyles as S,withAlpha as Qt,floatingToolsColors as Vi}from"@buoy-gg/floating-tools-react/web";import{persistentStorage as Zt,monoFont as eo,ToolBackground as Ui,useToolBackground as Ki}from"@buoy-gg/shared-ui/web";import{memo as _i}from"react";import{RasterLayer as Gi,scatter as qi,useLoop as Ji,withBgAlpha as Xi}from"@buoy-gg/shared-ui/web";import{Fragment as Yi,jsx as Ne}from"react/jsx-runtime";var Qi=.94,Zi=6,er=2400,st=3,to=16,tr=Array.from({length:st},(e,t)=>qi(22343^t*40503,to*4)),oo=["#FFFFFF","#B3D9FF","#8CB3FF"],no=Math.PI/3,ao=14*Math.PI/180;function or(e){let t=Math.min(5,Math.floor(e*6)),o=e*6-t;return t*no+ao/2+o*(no-ao)}function nr(e){return Math.min(Zi,1/(1-e*Qi))}function ar(e){let t=.15+.85*e*e;return e<.06?t*=e/.06:e>.94&&(t*=(1-e)/.06),Math.min(.7,t)}function ir(e){let t=e/st,o=[],a=12;for(let d=0;d<=a;d++)o.push(d/a);let n=(1-t)%1;n>.001&&n<1-.001&&o.push(n-1e-4,n+1e-4),o.sort((d,p)=>d-p);let i=[],l=[],u=[];for(let d of o){let p=t===0&&d===1?1:(d+t)%1;i.push(d),l.push(nr(p)),u.push(ar(p))}return{input:i,scale:l,opacity:u}}var rr=Array.from({length:st},(e,t)=>ir(t)),sr=_i(function({size:e}){let t=Ji(er),o=e/2,a=[];for(let n=0;n<st;n++){let i=tr[n],l=rr[n],u=[];for(let d=0;d<to;d++){let p=or(i[d*4]),m=(.15+.85*Math.sqrt(i[d*4+1]))*.5*o,x=oo[Math.floor(i[d*4+3]*oo.length)%3],g=o+Math.cos(p)*m,R=o+Math.sin(p)*m,v=.6,I=v*2.4;u.push(Ne(H,{style:{position:"absolute",left:g-I/2,top:R-I/2,width:I,height:I,borderRadius:I/2,backgroundColor:Xi(x,.3)}},`${d}-h`),Ne(H,{style:{position:"absolute",left:g-v/2,top:R-v/2,width:v,height:v,borderRadius:v/2,backgroundColor:x}},d))}a.push(Ne(xe.View,{style:{position:"absolute",left:0,top:0,width:e,height:e,opacity:t.interpolate({inputRange:l.input,outputRange:l.opacity}),transform:[{scale:t.interpolate({inputRange:l.input,outputRange:l.scale})}]},pointerEvents:"none",children:Ne(Gi,{style:{width:e,height:e},raster:false,children:u})},n))}return Ne(Yi,{children:a})});import{useEffect as lr,useState as io}from"react";import{dialColors as Le,withAlpha as ro}from"@buoy-gg/floating-tools-react/web";import{ARROW_BOTTOM_OFFSET as cr,ARROW_HEIGHT as dr,SPACING_GAP as vc,getScreenCenterY as wc,calculateTooltipPosition as ur,calculateTargetPosition as xc}from"@buoy-gg/shared-ui/web/floating";import{monoFont as so}from"@buoy-gg/shared-ui/web";import{jsx as Pe,jsxs as lo}from"react/jsx-runtime";var co=false;function pr(){if(co||typeof document>"u")return;let e=document.createElement("style");e.textContent=`
2
2
  @keyframes buoyOnboardPulse {
3
3
  0%, 100% { transform: scale(1); }
4
4
  50% { transform: scale(1.02); }
@@ -7,4 +7,4 @@
7
7
  0%, 100% { transform: translateY(0); }
8
8
  50% { transform: translateY(-8px); }
9
9
  }
10
- `,document.head.appendChild(e),ro=true}var xt=Le.accent;function so({title:e,message:t,onDismiss:o,showArrow:a=true}){let[n,i]=oo(false),[l,u]=oo(false);or(()=>{rr();let p=requestAnimationFrame(()=>i(true));return()=>cancelAnimationFrame(p)},[]);let d={fontFamily:ao,textTransform:"uppercase"};return Pe("div",{style:{position:"fixed",left:"50%",bottom:ir(),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:io("div",{style:{position:"relative",animation:n?"buoyOnboardPulse 3s ease-in-out infinite":"none"},children:[Pe("div",{style:{position:"absolute",inset:-4,borderRadius:18,backgroundColor:"#FFFFFF",opacity:.06}}),io("div",{style:{position:"relative",maxWidth:280,backgroundColor:Le.dialBackground,borderRadius:16,border:`1px solid ${Le.dialBorder}`,padding:20,boxShadow:`0 0 20px ${no(Le.dialShadow,.6)}`,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[Pe("span",{style:{...d,fontSize:16,fontWeight:900,letterSpacing:1,color:xt,textAlign:"center"},children:e}),Pe("span",{style:{fontFamily:ao,fontSize:13,lineHeight:"20px",color:Le.centerText,textAlign:"center"},children:t}),Pe("button",{onClick:o,onMouseDown:()=>u(true),onMouseUp:()=>u(false),onMouseLeave:()=>u(false),style:{...d,marginTop:8,borderRadius:8,border:"none",backgroundColor:xt,padding:"10px 24px",fontSize:14,fontWeight:900,letterSpacing:1.5,color:"#000000",cursor:"pointer",opacity:l?.7:1,transform:l?"scale(0.96)":"scale(1)",transition:"transform 100ms ease, opacity 100ms ease"},children:"Got it!"})]}),a&&Pe("div",{style:{position:"absolute",left:"50%",bottom:nr,marginLeft:-12,width:0,height:0,borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:`${ar}px solid ${xt}`,filter:`drop-shadow(0 0 10px ${no(Le.dialShadow,.5)})`,animation:n?"buoyOnboardArrowBounce 1.6s ease-in-out infinite":"none"}})]})})}import{Fragment as sr,jsx as O,jsxs as ge}from"react/jsx-runtime";var lr={x:.5,y:.5},lo="@react_buoy_settings_tooltip_shown",co=false;function cr(){if(co||typeof document>"u")return;let e=document.createElement("style");e.textContent=Fi(),document.head.appendChild(e),co=true}var $e=e=>1-Math.pow(1-e,3),Ct=e=>e*e*e;function dr({icon:e,index:t,totalIcons:o,position:a,progress:n,onPress:i}){let[l,u]=Q(false),[d,p]=Q(false),m=!e.icon&&e.id.startsWith("empty-"),x=!m&&e.unavailable===true,g=!m&&!x,{icons:R}=qt,v=Oi(t,o),I=0;n<=v[1]?I=0:n<=v[2]?I=(n-v[1])/(v[2]-v[1]):I=1,I=Math.max(0,Math.min(1,I));let T=Bi,k=R.pressIn.scale,z=I*(d?k:l?1.1:1),B=0;I<=0?B=0:I<=.3?B=I:B=.3+(I-.3)*(.7/.7);let b=a.x*I,M=a.y*I;return O("button",{role:"menuitem","aria-label":m?"Empty slot":e.name,"aria-disabled":!g,tabIndex:g?0:-1,onClick:g?i:void 0,onMouseEnter:()=>g&&u(true),onMouseLeave:()=>{u(false),p(false)},onMouseDown:()=>g&&p(true),onMouseUp:()=>p(false),style:{position:"absolute",left:"50%",top:"50%",width:T,height:T,marginLeft:-T/2,marginTop:-T/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:g?"pointer":"default",transform:`translate(${b}px, ${M}px) scale(${z})`,opacity:B,transition:l||d?"transform 100ms ease":"none",background:"none",border:"none",padding:0},children:m?O("div",{style:{width:S.emptySlot.dotSize,height:S.emptySlot.dotSize,borderRadius:S.emptySlot.dotSize/2,backgroundColor:F.emptyDotBackground,border:`${S.emptySlot.borderWidth}px solid ${F.emptyDotBorder}`}}):ge(sr,{children:[O("div",{style:{position:"absolute",width:`${S.icon.gradientBgSizePercent}%`,height:`${S.icon.gradientBgSizePercent}%`,borderRadius:S.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:S.icon.gradientBgOpacity}}),O("div",{style:{position:"absolute",width:`${S.icon.innerGlowSizePercent}%`,height:`${S.icon.innerGlowSizePercent}%`,borderRadius:S.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:S.icon.innerGlowOpacity}}),O("div",{style:{marginBottom:S.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:l?"brightness(1.2)":"none"},children:e.icon}),O("span",{style:{fontSize:e.name.length>8?Math.max(S.icon.label.fontSize*.7,S.icon.label.fontSize*8/e.name.length):S.icon.label.fontSize,fontWeight:S.icon.label.fontWeight,fontFamily:S.icon.label.fontFamily,color:F.iconLabel,letterSpacing:S.icon.label.letterSpacing,marginTop:S.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:e.name}),x&&O("span",{style:{fontSize:S.icon.label.fontSize-1,fontWeight:S.icon.label.fontWeight,fontFamily:S.icon.label.fontFamily,letterSpacing:S.icon.label.letterSpacing,color:Pi.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})}function uo({side:e,color:t}){return O("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(e==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]]).map(([o,a,n,i],l)=>O("line",{x1:o,y1:a,x2:n,y2:i,stroke:t,strokeWidth:2},l))})}function po({side:e,disabled:t,onClick:o}){let[a,n]=Q(false),i=t?F.emptyDotBorder:F.accent;return ge("button",{type:"button","aria-label":`${e==="prev"?"Previous":"Next"} dial page`,disabled:t,onClick:o,onMouseDown:()=>!t&&n(true),onMouseUp:()=>n(false),onMouseLeave:()=>n(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${F.dialBorder}`,backgroundColor:F.dialBackground,color:t?F.iconLabelMuted:F.centerText,fontSize:12,fontWeight:900,fontFamily:Yt,letterSpacing:1.5,textTransform:"uppercase",cursor:t?"default":"pointer",opacity:t?.4:1,boxShadow:t?"none":`0 0 8px ${Jt(F.dialShadow,.4)}`,transform:a?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[e==="prev"&&O(uo,{side:"prev",color:i}),e==="prev"?"PREV":"NEXT",e==="next"&&O(uo,{side:"next",color:i})]})}function mo({icons:e,onClose:t,centerLabel:o="MENU",onCenterPress:a,settingsOpen:n=false,hintsDisabled:i=false}){let{id:l}=Hi(),[u,d]=Q(0),[p,m]=Q(0),[x,g]=Q(0),[R,v]=Q(0),[I,T]=Q(0),[k,z]=Q(1),[B,b]=Q(false),[M,P]=Q(false),[C,A]=Q(false),oe=at(null),Z=at(null),q=at(null),le=at(false),{entrance:K,exit:ne,interaction:J}=qt,Se=Li(),[me,ve]=Q(()=>({width:window.innerWidth,height:window.innerHeight}));Te(()=>{let D=()=>ve({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]);let $=nt(()=>Ai({screenWidth:me.width,maxCircleSize:Math.max(120,Math.min(320,me.height-96))}),[me]),Re=nt(()=>Ei(),[]),fe=nt(()=>Di(We,$.iconRadius),[$.iconRadius]),[se,we]=Q(0),ae=Math.max(1,Math.ceil(e.length/We)),r=Math.min(se,ae-1),L=nt(()=>{let D=r*We,w=[...e.slice(D,D+We)];for(;w.length<We;)w.push({id:`empty-${w.length}`,name:"",icon:null,onPress:()=>{}});return w},[e,r]);Te(()=>{cr()},[]),Te(()=>{let D=K.backdrop.duration,w=K.dial.rotation.duration,X=K.centerButton.delay,N=K.icons.delay,_=K.icons.duration,V=performance.now(),ee=ce=>{let s=ce-V;d(Math.min(1,s/D));let f=Math.min(1,s/400),E=$e(f)*1.1;f>.7&&(E-=(f-.7)*.33),f>=1&&(E=1),m(Math.max(0,Math.min(1.05,E)));let Y=Math.min(1,s/w);if(g($e(Y)*360),s>=X){let ye=Math.min(1,(s-X)/300),Ee=$e(ye)*1.15;ye>.6&&(Ee-=(ye-.6)*.375),ye>=1&&(Ee=1),v(Math.max(0,Math.min(1.05,Ee)))}if(s>=N){let ye=Math.min(1,(s-N)/_);T($e(ye))}let he=N+_;s<he?q.current=requestAnimationFrame(ee):(d(1),m(1),g(360),v(1),T(1),A(true))};return q.current=requestAnimationFrame(ee),()=>{q.current&&cancelAnimationFrame(q.current)}},[]);let j=it(()=>{if(le.current)return;le.current=true,P(true),q.current&&cancelAnimationFrame(q.current);let D=performance.now(),w=ne.icons.duration,X=ne.centerButton.duration,N=ne.dialScale.duration,_=Math.max(X,N),V=ne.backdrop.duration,ee=ce=>{let s=ce-D;if(s<w){let Y=Ct(s/w);T(1-Y),q.current=requestAnimationFrame(ee);return}let f=w;if(s<f+_){T(0);let Y=Math.min(1,(s-f)/X),he=Math.min(1,(s-f)/N);v(1-Ct(Y)),m(1-Ct(he)),q.current=requestAnimationFrame(ee);return}let E=f+_;if(s<E+V){m(0),v(0);let Y=(s-E)/V;d(1-Y),q.current=requestAnimationFrame(ee);return}d(0),t()};q.current=requestAnimationFrame(ee)},[ne,t]);Te(()=>{let D=document.activeElement,w=oe.current;return()=>{D?.isConnected&&(document.activeElement===document.body||w?.contains(document.activeElement))&&D.focus()}},[]),Te(()=>{if(n)return;Z.current?.focus();let D=w=>{let X=oe.current;if(X){if(w.key==="Escape")w.preventDefault(),j();else if(w.key==="Tab"){let N=Array.from(X.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(ee=>ee.getClientRects().length>0),_=N[0],V=N[N.length-1];(!X.contains(document.activeElement)||(w.shiftKey?document.activeElement===_:document.activeElement===V))&&(w.preventDefault(),(w.shiftKey?V:_)?.focus())}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(w.key)){let N=Array.from(X.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),_=N.indexOf(document.activeElement);if(_<0||!N.length)return;w.preventDefault();let V=w.key==="Home"?0:w.key==="End"?N.length-1:(_+(w.key==="ArrowRight"||w.key==="ArrowDown"?1:-1)+N.length)%N.length;N[V].focus()}}};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[j,n]);let[je,Je]=Q(false);Te(()=>{if(i)return;let D=false,w=setTimeout(async()=>{let X=await Xt.getItem(lo);!D&&!X&&Je(true)},1200);return()=>{D=true,clearTimeout(w)}},[i]);let Ae=it(()=>{Je(false),Xt.setItem(lo,"true")},[]);Te(()=>{n&&je&&Ae()},[n,je,Ae]);let Xe=it(D=>{if(D.id.startsWith("empty-")||le.current)return;let[w,X]=J.iconSelect.pulse,N=performance.now(),_=150,V=ee=>{let ce=ee-N;if(ce<_){let s=$e(ce/_);z(1-(1-w.scale)*s),requestAnimationFrame(V)}else if(ce<_*2){let s=$e((ce-_)/_);z(w.scale+(X.scale-w.scale)*s),requestAnimationFrame(V)}else z(1)};requestAnimationFrame(V),setTimeout(()=>{D.onPress(),j()},J.iconSelect.actionDelay)},[J.iconSelect,j]),Ye=it(D=>{if(le.current)return;let w=Math.max(0,Math.min(D,ae-1));w!==r&&we(w)},[ae,r]),De=$.buttonSize*S.centerButton.containerRatio,Qe=$.buttonSize*S.centerButton.borderRatio,bt=$.buttonSize*S.centerButton.containerRatio/2+6,St=C&&!M;return ge("div",{ref:oe,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[O("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:j,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:F.dialBackdrop,opacity:u}}),ge("div",{style:{position:"absolute",left:"50%",marginLeft:-$.circleSize/2,bottom:80,width:$.circleSize,height:$.circleSize,borderRadius:"50%",backgroundColor:F.dialBackground,border:`${S.circle.borderWidth}px solid ${F.dialBorder}`,boxShadow:`0 0 ${S.circle.shadowRadius}px ${Jt(F.dialShadow,S.circle.shadowOpacity)}`,transform:`scale(${p}) rotate(${x}deg)`,opacity:p>.01?1:0,overflow:"hidden"},children:[O("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:F.dialGradient1,opacity:S.gradientLayers[0].opacity}}),O("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:F.dialGradient2,opacity:S.gradientLayers[1].opacity}}),O("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:F.dialGradient3,opacity:S.gradientLayers[2].opacity}}),Re.map(D=>O("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:S.grid.lineHeight,transform:`rotate(${D}deg)`,transformOrigin:"center"},children:["left","right"].map(w=>O("div",{style:{position:"absolute",top:0,[w]:0,width:`calc(50% - ${bt}px)`,height:S.grid.lineHeight,backgroundColor:F.dialGridLine}},w))},D)),O("div",{"data-testid":"dial-background","data-background":l,style:{position:"absolute",inset:0,pointerEvents:"none"},children:l==="hyperspace"?O(tr,{size:$.circleSize}):O($i,{focus:lr})}),L.map((D,w)=>O(dr,{icon:D,index:w,totalIcons:L.length,position:fe[w],progress:I,onPress:()=>Xe(D)},w)),ge("div",{style:{position:"absolute",left:"50%",top:"50%",width:De,height:De,marginLeft:-De/2,marginTop:-De/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:F.hubHalo,borderRadius:$.buttonSize,overflow:"hidden",transform:`scale(${R*k})`,opacity:R>.01?1:0},children:[O("div",{style:{position:"absolute",inset:0,backgroundColor:F.dialGradient1,opacity:.5,borderRadius:$.buttonSize}}),O("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:F.dialGradient2,opacity:.3,borderRadius:$.buttonSize}}),O("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:F.dialGradient3,opacity:.2,borderRadius:$.buttonSize}}),O("div",{style:{width:Qe,height:Qe,borderRadius:$.buttonSize*S.centerButton.borderRadiusRatio,backgroundColor:F.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:O("button",{ref:Z,type:"button","aria-label":n?"Close settings":"Open settings",disabled:!a,onClick:a,onMouseEnter:()=>b(true),onMouseLeave:()=>b(false),style:{border:0,padding:0,background:"transparent",width:$.buttonSize,height:$.buttonSize,borderRadius:$.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:a?"pointer":"default",transform:B?`scale(${J.centerHover.scale})`:"scale(1)",transition:`transform ${J.centerHover.duration}ms ease`,animation:St&&!B?Se.pulse:"none"},children:n?ge("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:S.centerButton.text.fontSize-2,fontWeight:S.centerButton.text.fontWeight,fontFamily:S.centerButton.text.fontFamily,color:F.centerText,letterSpacing:S.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${F.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[O("span",{style:{marginBottom:-2},children:"CLOSE"}),O("span",{style:{marginTop:-2},children:"SETTINGS"})]}):O("span",{style:{fontSize:S.centerButton.text.fontSize,fontWeight:S.centerButton.text.fontWeight,fontFamily:S.centerButton.text.fontFamily,color:F.centerText,letterSpacing:S.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${F.centerTextGlow}`,textTransform:"uppercase"},children:o})})})]})]}),ae>1&&ge("div",{style:{position:"absolute",left:"50%",marginLeft:-$.circleSize/2,top:"calc(100% - 64px)",width:$.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,p),transform:`scale(${Math.min(1,p)})`},children:[O(po,{side:"prev",disabled:r<=0,onClick:()=>Ye(r-1)}),ge("span",{style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:Yt,letterSpacing:2,color:F.centerText,textShadow:`0 0 6px ${F.centerTextGlow}`},children:[String(r+1).padStart(2,"0"),ge("span",{style:{color:F.iconLabelMuted,textShadow:"none"},children:[" / ",String(ae).padStart(2,"0")]})]}),O(po,{side:"next",disabled:r>=ae-1,onClick:()=>Ye(r+1)})]}),je&&!n&&O(so,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:Ae,showArrow:false})]})}import{persistentStorage as go,devToolsStorageKeys as ur}from"@buoy-gg/shared-ui/web";import{recordUsage as pr,pruneUsage as mr}from"@buoy-gg/floating-tools-core/web";var fo=ur.dial.usage(),He={},ho=false,Tt=null;function yo(){return Tt||(Tt=(async()=>{try{let e=await go.getItem(fo);if(e){let t=JSON.parse(e);t&&typeof t=="object"&&(He=t)}}catch{}finally{ho=true}})(),Tt)}yo();function gr(e){return e.map((t,o)=>({id:t,index:o,lastUsed:He[t]?.lastUsed??0})).sort((t,o)=>o.lastUsed-t.lastUsed||t.index-o.index).map(({id:t})=>t)}async function fr(e){if(!e)return;ho||await yo();let t=Math.max(Date.now(),...Object.values(He).map(o=>o.lastUsed+1));He=mr(pr(He,e,t),t);try{await go.setItem(fo,JSON.stringify(He))}catch{}}import{useCallback as hr,useMemo as bo}from"react";import{persistentStorage as yr}from"@buoy-gg/shared-ui/web";import{useState as te,useEffect as ze,useCallback as st,useMemo as lt}from"react";import{settingsEventBus as ct}from"@buoy-gg/floating-tools-core/web";import{useSyncExternalStore as br}from"react";import{getRegisteredToolModule as Sr}from"@buoy-gg/shared-ui/web";var vr=()=>()=>{},wr=()=>null;function xr(){let e=Sr("@buoy-gg/external-sync");return br(e?.subscribeSyncStatus??vr,()=>e?.getSyncStatus?.()??null,wr)}import{SentryIcon as Cr,WifiCircuitIcon as Tr,ImageOverlayIcon as zr,RenderCountIcon as kr,Info as zt,Layers as Ir,ChevronRightIcon as So,ChevronDown as vo,getStorageBackendType as Mr,getUseLicense as Rr,persistentStorage as ke,Trash2 as Ar,CheckCircle2 as wo,LicenseEntryModal as Dr,BackgroundSwitcher as Er,night as h,NightCard as Ie,NightRows as kt,NightSectionLabel as Or,NightFootnote as xo,NightSwitch as Co,NightButton as To,NightSegmented as Br,NightBadge as ue,NightSeparator as Fr,monoFont as zo}from"@buoy-gg/shared-ui/web";import{EnvIcon as ko,StorageIcon as Lr,RoutesIcon as Pr,NetworkIcon as $r,QueryIcon as Hr,HighlighterIcon as jr,ReduxIcon as Wr,EventsIcon as Nr}from"@buoy-gg/floating-tools-core/web";import Ur,{createContext as Kr,useContext as Vr}from"react";import{jsx as Gr}from"react/jsx-runtime";var Io=Kr({});function _r({children:e,defaultFloatingTools:t,defaultDialTools:o}){let a=Ur.useMemo(()=>({defaultFloatingTools:t,defaultDialTools:o}),[t,o]);return Gr(Io.Provider,{value:a,children:e})}function Mo(){return Vr(Io)}import qr from"react";import{toolTheme as Jr}from"@buoy-gg/shared-ui/web";import{jsx as Ro}from"react/jsx-runtime";function Xr({label:e,size:t,color:o=Jr.colors.text}){let a=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1),n=a<=2?t:t*1.6,i=Math.max(7,Math.min(t*(a===1?.7:.62),n/(.62*a)));return Ro("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:i,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}function Ao(e,t){return e==null?e:typeof e=="function"?qr.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions}):typeof e=="string"||typeof e=="number"?Ro(Xr,{label:String(e),size:t.size,color:t.color}):e}import{JsModal as Yr,devToolsStorageKeys as It}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as Qr}from"@buoy-gg/shared-ui/web";import{Fragment as Ue,jsx as c,jsxs as H}from"react/jsx-runtime";var dt="@react_buoy_dev_tools_settings",Zr=6,ut=e=>{let t=Zr,o={};for(let[a,n]of Object.entries(e))n&&t>0?(o[a]=true,t-=1):o[a]=false;return o},es=(e,t)=>{let{userStatus:o,environment:a,...n}=e,i=t?Object.entries(n).filter(([l])=>t.includes(l)):Object.entries(n);return{...Object.fromEntries(i),environment:a??false}},Do=(e,t,o)=>{if(!t)return e;let a={...e.dialTools,...t.dialTools??{}},n=o?.allowedDialKeys?Object.entries(a).filter(([i])=>o.allowedDialKeys?.includes(i)):Object.entries(a);return{dialTools:ut(Object.fromEntries(n)),floatingTools:es({...e.floatingTools,...t.floatingTools??{}},o?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...t.globalSettings??{}}}},ts=(e=[],t,o)=>{let a={},n={},i=new Set(t??[]),l=new Set(o??[]),u=!o||o.length===0;for(let d of e){let{id:p,slot:m="both"}=d;(m==="dial"||m==="both")&&(a[p]=u?true:l.has(p)),(m==="row"||m==="both")&&(n[p]=i.has(p))}return{dialTools:ut(a),floatingTools:{...n,environment:i.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}},os=({visible:e,onClose:t,onSettingsChange:o,initialSettings:a,availableApps:n=[],storage:i=ke,zIndex:l})=>{let{defaultFloatingTools:u,defaultDialTools:d}=Mo(),p=lt(()=>ts(n,u,d),[n,u,d]),m=lt(()=>Object.keys(p.dialTools),[p]),x=lt(()=>Object.keys(p.floatingTools).filter(s=>s!=="environment"),[p]),[g,R]=te(a||Ke||p),[v,I]=te(Mt??"floating"),[T,k]=te(Mt!==null),[z,B]=te(new Set),[b,M]=te(false),[P,C]=te(false);ze(()=>{let s=requestAnimationFrame(()=>C(true));return()=>cancelAnimationFrame(s)},[]);let A=xr();ze(()=>{(async()=>{try{let s=await ke.getItem(It.settings.activeTab());if(s&&["floating","settings","pro"].includes(s)){let f=s;Mt=f,I(E=>E===f?E:f)}}catch{}finally{k(true)}})()},[]),ze(()=>{T&&ke.setItem(It.settings.activeTab(),v).catch(s=>{console.warn("Failed to save settings active tab:",s)})},[v,T]);let oe=Rr()?.(),Z=oe?.isPro??false,q=!Z&&oe?.licenseKey?oe.error:null,le=oe?.errorKind==="transport",[K,ne]=te(Eo),[J,Se]=te(false),[me,ve]=te(false),[$,Re]=te(false),[fe,se]=te([]),[we,ae]=te(false),r=Qr(),L=Wt.get("window").height,j=Wt.get("window").width,je=Math.floor(L*.33),Je=Math.min(j-32,400),Ae=st(async()=>{try{let s=await i.getItem(dt);if(s){let f=JSON.parse(s),E=Do(p,f,{allowedDialKeys:m,allowedFloatingKeys:x});Ke=E,R(Y=>Oo(Y,E)?Y:E);return}Ke=p,R(f=>Oo(f,p)?f:p)}catch(s){console.error("Failed to load dev tools settings:",s),R(p)}},[p,m,x,i]);ze(()=>{Ae()},[Ae]),ze(()=>{Mr().then(s=>{Eo=s,ne(f=>f===s?f:s)})},[]),ze(()=>{$&&(ae(true),ke.getAllKeys().then(s=>{se(s.sort())}).catch(()=>{se([])}).finally(()=>{ae(false)}))},[$]);let Xe=async s=>{try{let f={...s,dialTools:ut(s.dialTools)};await i.setItem(dt,JSON.stringify(f)),Ke=f,R(f),o?.(f),ct.emit(f)}catch(f){console.error("Failed to save dev tools settings:",f)}},Ye=s=>{let f={...g,floatingTools:{...g.floatingTools,[s]:!g.floatingTools[s]}};Xe(f)},De=s=>{let f={...g,globalSettings:{...g.globalSettings,[s]:!g.globalSettings?.[s]}};Xe(f)},Qe=async()=>{Se(true),ve(false);try{await ke.clear(),ve(true),R(p),i!==ke&&await i.setItem(dt,JSON.stringify(p)),o?.(p),ct.emit(p),setTimeout(()=>ve(false),2e3)}catch(s){console.error("Failed to clear storage:",s)}finally{Se(false)}},bt=st(s=>{},[]),St=s=>{let f=n.find(E=>E.id===s);return f?.description?f.description:s==="environment"?"Environment badge.":""},D=s=>s==="environment"?"Env Badge":n.find(f=>f.id===s)?.name??s.toUpperCase().replace(/_/g," "),w=s=>{if(!P)return null;switch(s){case"query":return c(Hr,{size:18});case"env":return c(ko,{size:18});case"sentry":return c(Cr,{size:18,color:"#9945FF"});case"storage":return c(Lr,{size:18,bgColor:h.color.surface});case"wifi":case"query-wifi-toggle":return c(Tr,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return c(Pr,{size:18,bgColor:h.color.surface});case"network":return c($r,{size:18});case"environment":return c(ko,{size:18});case"debug-borders":return c(Ir,{size:18,color:h.color.accent});case"highlight-updates":return c(kr,{size:18,color:h.color.accent});case"highlight-updates-modal":return c(jr,{size:18});case"redux":return c(Wr,{size:18});case"image-overlay":return c(zr,{size:18});case"events":return c(Nr,{size:18});case"zustand":try{let{ZustandIcon:f}=Ut("@buoy-gg/zustand/web");return c(f,{size:18})}catch{return c(zt,{size:18,color:h.color.textSecondary})}case"jotai":try{let{JotaiIcon:f}=Ut("@buoy-gg/jotai/web");return c(f,{size:18})}catch{return c(zt,{size:18,color:h.color.textSecondary})}default:{let f=n.find(E=>E.id===s);return f?.icon!=null?Ao(f.icon,{slot:"row",size:18,color:f.color}):c(zt,{size:18,color:h.color.textSecondary})}}},X=(s,f,E,Y)=>{let he=St(s);return H(Ze,{activeOpacity:E?1:.7,onPress:()=>!E&&Y(),accessibilityLabel:D(s),accessibilityRole:"button",style:[y.toolRow,E&&y.rowDisabled],children:[c(W,{style:y.toolIconSlot,children:w(s)}),H(W,{style:y.rowInfo,children:[H(U,{style:y.rowLabel,children:[D(s),E?" \xB7 max 6":""]}),he?c(U,{style:y.rowCaption,numberOfLines:1,children:he}):null]}),c(Co,{value:f,disabled:E,onValueChange:()=>Y()})]},s)},N=s=>{B(f=>{let E=new Set(f);return E.has(s)?E.delete(s):E.add(s),E})},_=(s,f,E,Y,he)=>{let ye=g.globalSettings?.[s]??false,Ee=z.has(s);return H(W,{children:[H(Ze,{activeOpacity:.7,onPress:()=>N(s),accessibilityLabel:f,style:y.settingRow,children:[H(W,{style:y.rowInfo,children:[c(U,{style:y.rowLabel,children:f}),c(U,{style:y.rowCaption,numberOfLines:Ee?0:1,children:E})]}),c(Co,{value:ye,onValueChange:()=>De(s)})]}),Ee&&H(W,{style:y.settingRowBody,children:[c(U,{style:y.settingRowBodyText,children:Y}),c(U,{style:y.settingRowBodyHint,children:he})]})]},s)},V=(s,f,E)=>H(W,{children:[c(Or,{children:s}),f,E]}),ee=K==="filesystem"?c(ue,{label:"File System",tone:"accent"}):K==="asyncstorage"?c(ue,{label:"Async Storage",tone:"warning"}):K==="localstorage"?c(ue,{label:"Local Storage",tone:"accent"}):K==="memory"?c(ue,{label:"Memory",tone:"danger"}):c(ue,{label:"Loading\u2026",tone:"neutral"}),ce=()=>H(W,{style:y.container,children:[H(jt,{style:y.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:y.scrollContainer,children:[v==="floating"&&c(Ue,{children:V("Floating Tools",c(Ie,{glass:true,children:c(kt,{children:Object.entries(g.floatingTools).map(([s,f])=>X(s,f,false,()=>Ye(s)))})}),c(xo,{children:"Tools switched on here appear in the floating bubble row."}))}),v==="settings"&&H(Ue,{children:[V("Background",c(Ie,{glass:true,padded:true,children:c(Er,{embedded:true})})),V("Storage",H(Ie,{glass:true,children:[H(Ze,{activeOpacity:.7,onPress:()=>Re(!$),accessibilityLabel:"Storage Type",style:y.settingRow,children:[c(W,{style:y.rowInfo,children:c(U,{style:y.rowLabel,children:"Storage Type"})}),ee,$?c(vo,{size:16,color:h.color.textTertiary}):c(So,{size:16,color:h.color.textTertiary})]}),$&&H(Ue,{children:[H(W,{style:y.settingRowBody,children:[c(U,{style:y.settingRowBodyText,children:K==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":K==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":K==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":K==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),K==="asyncstorage"&&c(U,{style:[y.settingRowBodyText,y.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),K==="memory"&&c(U,{style:[y.settingRowBodyText,y.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),c(Fr,{}),H(W,{style:y.storageExpanded,children:[H(W,{style:y.storageExpandedHeader,children:[c(U,{style:y.storageExpandedTitle,children:"SAVED SETTINGS"}),c(U,{style:y.storageExpandedCount,children:we?"\u2026":`${fe.length} keys`})]}),we?c(U,{style:y.storageKeyEmpty,children:"Loading\u2026"}):fe.length===0?c(U,{style:y.storageKeyEmpty,children:"No settings saved yet"}):c(jt,{style:y.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:fe.map(s=>c(W,{style:y.storageKeyItem,children:c(U,{style:y.storageKeyText,numberOfLines:1,children:s.replace("@react_buoy_","")})},s))})]}),c(W,{style:y.cardButtonWrap,children:c(To,{label:me?"Cleared":J?"Clearing\u2026":"Clear All Settings",variant:me?"secondary":"destructive",size:"md",disabled:J,onPress:Qe,icon:me?c(wo,{size:15,color:h.color.accent}):c(Ar,{size:15,color:J?h.color.textTertiary:h.color.danger})})})]})]})),A&&A.state!=="idle"&&V("Desktop Sync",H(Ie,{glass:true,children:[H(Ze,{activeOpacity:.7,onPress:()=>N("desktopSync"),accessibilityLabel:"Buoy Desktop",style:y.settingRow,children:[c(W,{style:y.rowInfo,children:c(U,{style:y.rowLabel,children:"Buoy Desktop"})}),A.state==="connected"?c(ue,{label:"Connected",tone:"accent"}):A.state==="connecting"?c(ue,{label:"Connecting\u2026",tone:"neutral"}):c(ue,{label:"Retrying",tone:"warning"}),z.has("desktopSync")?c(vo,{size:16,color:h.color.textTertiary}):c(So,{size:16,color:h.color.textTertiary})]}),z.has("desktopSync")&&H(W,{style:y.settingRowBody,children:[H(U,{style:y.settingRowBodyText,children:[A.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",c(U,{style:y.footnoteMono,children:A.targetURL??"(unknown URL)"}),A.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),A.state==="retrying"&&A.lastError&&H(U,{style:[y.settingRowBodyText,y.bodyWarning],children:["Last error: ",A.lastError]})]})]})),V("Modal Behavior",c(Ie,{glass:true,children:H(kt,{children:[_("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."),Oe.OS!=="web"?_("expandableWindowControls","Expand Controls","iPad-style expandable window buttons","When enabled, the window control buttons (minimize, toggle mode, close) start as small dots and expand into larger, easy-to-tap buttons when pressed. When disabled, buttons are directly tappable at their small size.","Keep ON for touch devices where the small buttons are hard to press. Turn OFF if you prefer direct single-tap access."):null]})}))]}),v==="pro"&&H(Ue,{children:[V("License",c(Ie,{glass:true,children:H(W,{style:y.settingRow,children:[c(W,{style:y.rowInfo,children:c(U,{style:y.rowLabel,children:"License Status"})}),c(W,{testID:"buoy-settings-license-status",accessibilityLabel:Z?"License: Active":"License: Free",children:Z?c(ue,{label:"Active",tone:"accent"}):c(ue,{label:"Free",tone:"neutral"})})]})}),c(xo,{children:Z?"You have full access to all Buoy DevTools features.":q?le?`Couldn't reach the license server (${q}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${q}.`:"Upgrade to Pro to unlock all features and support development."})),!Z&&H(Ue,{children:[V("Pro Features",c(Ie,{glass:true,children:c(kt,{children:["Advanced Settings","Priority Support"].map(s=>H(W,{style:y.featureRow,children:[c(wo,{size:16,color:h.color.accent}),c(U,{style:y.rowLabel,children:s})]},s))})})),c(To,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>M(true)})]})]})]}),c(Dr,{visible:b,onClose:()=>M(false),onSuccess:()=>M(false)})]});return c(Yr,{visible:e,onClose:t,zIndex:l,variant:"night",header:{showToggleButton:false,customContent:c(W,{style:y.headerRow,children:c(Br,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:v,onChange:s=>I(s)})})},initialMode:"bottomSheet",onModeChange:bt,persistenceKey:It.settings.root(),enablePersistence:true,maxHeight:L-r.top,initialHeight:je,initialFloatingPosition:{x:(j-Je)/2,y:r.top+20},enableGlitchEffects:true,children:ce()})},ns={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}},as=(e,t)=>{let o=new Set(e??[]),a=new Set(t??[]),n={};for(let l of a)n[l]=true;let i={environment:o.has("environment")};for(let l of o)l!=="environment"&&(i[l]=true);return{dialTools:ut(n),floatingTools:i,globalSettings:{enableSharedModalDimensions:false}}},Ke=null,Mt=null,Eo=null,Oo=(e,t)=>JSON.stringify(e)===JSON.stringify(t);ct.addListener(e=>{e&&(Ke=e)});var is=()=>{let{defaultFloatingTools:e,defaultDialTools:t}=Mo(),o=lt(()=>!e&&!t?ns:as(e,t),[e,t]),[a,n]=te(o),i=st(async()=>{try{let u=await ke.getItem(dt);if(u){let d=JSON.parse(u),p=Do(o,d);n(p);return}n(o)}catch(u){console.error("Failed to load dev tools settings:",u),n(o)}},[o]);ze(()=>{i();let u=ct.addListener(d=>{try{d&&n(d)}catch{}});return()=>{u()}},[i]);let l=st(()=>{i()},[i]);return{settings:a,refreshSettings:l}},y=Nt.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:h.gutter,paddingRight:h.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:h.gutter,paddingTop:8,paddingBottom:24,gap:h.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:h.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:h.rowPadH,paddingVertical:h.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:h.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:h.color.text,fontSize:h.font.row,fontWeight:"500"},rowCaption:{color:h.color.textTertiary,fontSize:h.font.label},settingRowBody:{paddingHorizontal:h.rowPadH,paddingBottom:h.rowPadV,gap:6},settingRowBodyText:{color:h.color.textSecondary,fontSize:h.font.caption,lineHeight:h.font.caption*1.45},settingRowBodyHint:{color:h.color.textTertiary,fontSize:h.font.caption,lineHeight:h.font.caption*1.45},bodyWarning:{color:h.color.warning},bodyDanger:{color:h.color.danger},cardButtonWrap:{paddingHorizontal:h.cardPad,paddingTop:10,paddingBottom:h.cardPad},storageExpanded:{paddingHorizontal:h.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:h.color.textSecondary,fontSize:h.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:h.color.textTertiary,fontSize:h.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:h.color.glassElevated,borderRadius:h.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:h.color.textSecondary,fontSize:h.font.micro,fontFamily:zo},storageKeyEmpty:{color:h.color.textTertiary,fontSize:h.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:zo,fontSize:h.font.label,color:h.color.textSecondary}});import{jsx as Bo}from"react/jsx-runtime";var rs=[];function Fo({visible:e,onClose:t,availableTools:o=rs,defaultFloatingTools:a,defaultDialTools:n,storage:i=yr,onSettingsChange:l}){let u=bo(()=>({getItem:async m=>i.getItem(m),setItem:async(m,x)=>i.setItem(m,x)}),[i]),d=bo(()=>o.map(m=>({...m,name:m.name??m.id,icon:typeof m.icon=="function"?x=>m.icon(x.size):m.icon})),[o]),p=hr(m=>{l?.(m)},[l]);return Bo(_r,{defaultFloatingTools:a,defaultDialTools:n,children:Bo(os,{visible:e,onClose:t,zIndex:11e3,availableApps:d,storage:u,onSettingsChange:p})})}import{persistentStorage as Lo}from"@buoy-gg/shared-ui/web";import{createContext as ss,useCallback as be,useContext as ls,useEffect as Rt,useMemo as cs,useRef as Ve,useState as Po}from"react";var ds=(e,t,o)=>{if(t.singleton){let n=e.find(i=>i.id===t.id);if(n){let i=n.minimized??false;return{instanceId:n.instanceId,wasMinimized:i,apps:[...e.filter(l=>l.instanceId!==n.instanceId),{...n,minimized:false}]}}}let a=o();return{instanceId:a,wasMinimized:false,apps:[...e,{...t,instanceId:a}]}};import{createContext as us,useCallback as $o,useContext as ps,useEffect as pt,useMemo as ms,useRef as Ho,useState as mt}from"react";import{JsModal as gs,ModalHeader as Ge,HeaderSearchButton as fs,TickProvider as hs,ToolScreenHeaderContext as ys,devToolsStorageKeys as jo,buoyColors as Wo,gameUIColors as At}from"@buoy-gg/shared-ui/web";import{jsx as ie,jsxs as gt}from"react/jsx-runtime";var _e=()=>{},bs={search:"",isSearchActive:false,clearSearch:_e,close:_e,minimize:_e,showToast:_e,setHeaderOverride:_e},No=us(null);function Uo(){return ps(No)??bs}function Ss(e,t){let{setHeaderOverride:o}=Uo();pt(()=>(o(e),()=>o(null)),t)}var Ko=2200,vs={success:At.success,error:At.error,info:At.info};function ws({message:e,type:t,nonce:o}){let a=Ho(new xe.Value(0)).current;pt(()=>{a.setValue(0),xe.sequence([xe.timing(a,{toValue:1,duration:150,useNativeDriver:true}),xe.delay(Ko-450),xe.timing(a,{toValue:0,duration:300,useNativeDriver:true})]).start()},[o,a]);let n=vs[t];return gt(xe.View,{pointerEvents:"none",style:[ft.toast,{opacity:a,borderColor:n+"60"}],children:[ie(W,{style:[ft.toastDot,{backgroundColor:n}]}),ie(U,{style:ft.toastText,numberOfLines:2,children:e})]})}function xs({app:e,config:t,visible:o,zIndex:a,onClose:n,onMinimize:i,initialModalState:l,enableSharedModalDimensions:u,bodyProps:d}){let p=e.component,[m,x]=mt(false),[g,R]=mt(""),[v,I]=mt(null),[T,k]=mt(null),z=Ho(null),B=$o(()=>{x(false),R("")},[]),b=$o((K,ne="info")=>{z.current&&clearTimeout(z.current),k(J=>({message:K,type:ne,nonce:(J?.nonce??0)+1})),z.current=setTimeout(()=>k(null),Ko)},[]);pt(()=>()=>{z.current&&clearTimeout(z.current)},[]);let M=ms(()=>({search:m?g:"",isSearchActive:m,clearSearch:B,close:n,minimize:()=>i(),showToast:b,setHeaderOverride:I,instanceId:e.instanceId}),[g,m,B,n,i,b,e.instanceId]),P=v?.title??t.title??e.title??e.id,C=v?.subtitle??t.subtitle,A=v?.onBack,oe=v?.actions??t.headerActions,Z=v?.searchable??t.searchable;pt(()=>{!Z&&m&&B()},[Z,m,B]);let q=u?jo.modal.root():jo.custom(e.id).modal(),le=gt(Ge,{children:[A&&!m&&ie(Ge.Navigation,{onBack:A}),m?ie(Ge.Search,{value:g,onChangeText:R,onCancel:B,placeholder:t.searchPlaceholder,testID:`tool-search-field-${e.id}`}):ie(Ge.Content,{title:P,subtitle:C}),gt(Ge.Actions,{children:[!m&&oe,Z&&!m&&ie(fs,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>x(true)})]})]});return ie(No.Provider,{value:M,children:ie(gs,{visible:o,onClose:n,onBack:A,onMinimize:i,initialModalState:l,zIndex:a,persistenceKey:q,enablePersistence:true,initialMode:t.initialMode??"bottomSheet",header:{customContent:le,showToggleButton:true},disableScrollWrapper:true,styles:{},children:gt(W,{style:ft.bodyRoot,children:[ie(hs,{children:ie(ys.Provider,{value:I,children:ie(p,{...d})})}),T&&ie(ws,{message:T.message,type:T.type,nonce:T.nonce})]})})})}var ft=Nt.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:Wo.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:Wo.text}});import{Fragment as Cs,jsx as pe}from"react/jsx-runtime";var Vo=ss(null),Go="@react_buoy_open_apps",Dt=44,Ts=12,zs=100,ks=16,Is=e=>({x:window.innerWidth-Dt-ks,y:window.innerHeight-zs-Dt-e*(Dt+Ts)}),_o=({children:e})=>{let[t,o]=Po([]),[a,n]=Po(false),i=Ve([]),l=Ve(null),u=Ve(false),d=Ve(false),p=Ve(false),m=be(b=>{let M="";return o(P=>{let{apps:C,instanceId:A}=ds(P,b,()=>`${b.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);return M=A,C}),M},[]),x=be(()=>{if(u.current||!d.current||!p.current)return;u.current=true;let b=l.current;if(!b||b.length===0){n(true);return}l.current=null,b.forEach(({id:M,minimized:P})=>{let C=i.current.find(A=>A.id===M);if(C&&C.component){let A=Ao(C.icon,{slot:"dial",size:20,color:C.color});m({id:C.id,title:C.name,component:C.component,props:C.props,modal:C.modal,launchMode:C.launchMode||"self-modal",singleton:C.singleton??true,icon:A,color:C.color,minimized:P})}}),n(true)},[m]);Rt(()=>{let b=false;return(async()=>{try{let M=await Lo.getItem(Go);if(b)return;if(M){let P=JSON.parse(M),C;Array.isArray(P)&&P.length>0&&(typeof P[0]=="string"?C=P.map(A=>({id:A,minimized:false})):C=P.filter(A=>typeof A=="object"&&A!==null&&typeof A.id=="string"),C.length&&(l.current=C))}}catch{}b||(d.current=true,x())})(),()=>{b=true}},[x]),Rt(()=>{if(!a)return;let b=t.map(M=>({id:M.id,minimized:M.minimized??false}));Lo.setItem(Go,JSON.stringify(b))},[t,a]);let g=be(b=>{i.current=b,p.current=true,x()},[x]),R=be(b=>{o(M=>M.length?b?M.filter(P=>P.instanceId!==b):M.slice(0,-1):M)},[]),v=be(()=>o([]),[]),I=be((b,M)=>{o(P=>P.map(C=>C.instanceId===b?{...C,minimized:true,restoreState:M}:C))},[]),T=be((b,M)=>{o(P=>P.map(C=>C.instanceId===b?{...C,minimized:false,restoreState:M??C.restoreState}:C))},[]),k=be(b=>t.find(M=>M.instanceId===b)?.minimized??false,[t]),z=t.some(b=>b.launchMode!=="toggle-only"&&!b.minimized);Rt(()=>{if(!z)return;let b=M=>{if(M.key!=="Escape"||M.defaultPrevented)return;let P=[...t].reverse().find(C=>C.launchMode!=="toggle-only"&&!C.minimized);P&&R(P.instanceId)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[z,R,t]);let B=cs(()=>({openApps:t,isAnyOpen:z,open:m,close:R,closeAll:v,registerApps:g,minimize:I,restore:T,isMinimized:k}),[t,z,m,R,v,g,I,T,k]);return pe(Vo.Provider,{value:B,children:e})},ht=()=>{let e=ls(Vo);return e||{openApps:[],isAnyOpen:false,open:()=>"",close:()=>{},closeAll:()=>{},registerApps:()=>{},minimize:()=>{},restore:()=>{},isMinimized:()=>false}},Ms=9e3,Rs={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"},As={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"},Ds=({app:e,zIndex:t,onClose:o,onMinimize:a,minimizeTargetPosition:n,enableSharedModalDimensions:i})=>{let l=e.component,u=!e.minimized,d={...e.props??{},...i?{enableSharedModalDimensions:true}:{}};return e.modal&&(!e.launchMode||e.launchMode==="self-modal")?pe(xs,{app:e,config:e.modal,visible:u,zIndex:t,onClose:o,onMinimize:a,initialModalState:e.restoreState,enableSharedModalDimensions:i,bodyProps:d}):e.launchMode==="self-modal"?pe(l,{...d,visible:u,onClose:o,onRequestClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId,zIndex:t,initialModalState:e.restoreState}):e.launchMode==="inline"?u?pe("div",{style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:pe(l,{...d,onClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId})}):null:pe("div",{style:{...Rs,zIndex:t,display:u?"flex":"none"},children:pe("div",{style:As,children:pe(l,{...d,onClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId})})})},qo=()=>{let{openApps:e,close:t,minimize:o}=ht(),{settings:a}=is(),n=e.filter(u=>u.launchMode!=="toggle-only");if(n.length===0)return null;let i=n.filter(u=>u.minimized).length,l=Ri()??Is(i);return pe(Cs,{children:n.map((u,d)=>pe(Ds,{app:u,zIndex:Ms+d,onClose:()=>t(u.instanceId),onMinimize:p=>o(u.instanceId,p),enableSharedModalDimensions:a.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:l},u.instanceId))})};import{useCallback as Es,useEffect as Et,useRef as Os,useState as Jo,useSyncExternalStore as Xo}from"react";import{persistentStorage as Yo,getToolAttention as Ot,subscribeToolAttention as Qo}from"@buoy-gg/shared-ui/web";import{jsx as re,jsxs as yt}from"react/jsx-runtime";function Bs(e){return Xo(Qo,()=>Ot(e),()=>Ot(e))}var Zo={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"},en={needsInput:3,failed:2,done:1},tn=new Map;function on(e){let t=null;for(let a of e?e.split("|"):[]){let n=Ot(a);n&&(!t||en[n.kind]>en[t.kind])&&(t=n)}let o=tn.get(e);return o&&t&&o.kind===t.kind&&o.label===t.label?o:!o&&!t?null:(tn.set(e,t),t)}function Fs(e){let t=e.join("|");return Xo(Qo,()=>on(t),()=>on(t))}var nn=28,Bt=32,Ft=6,an=8,rn=24,sn="@react_buoy_minimized_stack_expanded",Ls=80,ln=2e3,Ps=6e3,$s="#1A1A1A",qe="#888888";function cn({down:e=false}){return re("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:re("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:qe,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Hs({id:e,title:t,icon:o,index:a,onPress:n}){let i=Bs(e),l=Os(null);return Et(()=>{let u=true,d,p=()=>{l.current?.animate([{transform:"translateX(0) scale(1)",opacity:1,offset:0},{transform:"translateX(3px) scale(1.05)",opacity:.4,offset:.2},{transform:"translateX(-3px) scale(1.1)",opacity:1,offset:.4},{transform:"translateX(2px) scale(1.0)",opacity:.6,offset:.6},{transform:"translateX(-1px) scale(0.95)",opacity:1,offset:.8},{transform:"translateX(0) scale(1)",opacity:1,offset:1}],{duration:Ls,easing:"linear"})},m=x=>{let g=x?500+Math.random()*1500+a*200:ln+Math.random()*(Ps-ln)+a*300;d=setTimeout(()=>{u&&(p(),m(false))},g)};return m(true),()=>{u=false,clearTimeout(d)}},[a]),yt("button",{type:"button","aria-label":i?`${t} \u2014 ${i.label}. Restore`:`Restore ${t}`,onClick:n,style:{width:Bt,height:Bt,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[re("div",{ref:l,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:o}),i?re("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${i.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Zo[i.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:i.kind==="needsInput"?"!":""}):null]})}function js({containerWidth:e=32}){let{openApps:t,restore:o}=ht(),a=t.filter(g=>g.minimized&&g.launchMode!=="toggle-only"),[n,i]=Jo(false),[l,u]=Jo(false),d=Fs(a.map(g=>g.id));Et(()=>{let g=false;return(async()=>{let R=await Yo.getItem(sn);!g&&R==="true"&&i(true),g||u(true)})(),()=>{g=true}},[]),Et(()=>{l&&Yo.setItem(sn,n?"true":"false")},[n,l]);let p=Es(g=>{o(g)},[o]);if(a.length===0)return null;let m=an+a.length*Bt+(a.length-1)*Ft+Ft+rn+4,x={backgroundColor:$s,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${qe}66`,borderLeft:`1px solid ${qe}66`,borderRight:`1px solid ${qe}66`,borderBottom:"none",boxSizing:"border-box"};return yt("div",{style:{height:nn,overflow:"visible",position:"relative"},children:[re("div",{style:{position:"absolute",bottom:"var(--buoy-stack-bottom, 0px)",top:"var(--buoy-stack-top, auto)",left:0,width:e,maxHeight:"var(--buoy-stack-space, calc(100vh - 48px))",visibility:n?"visible":"hidden",height:n?m:0,opacity:n?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:n?"auto":"none",...x},children:yt("div",{style:{height:m,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:an,gap:Ft,boxSizing:"border-box"},children:[[...a].reverse().map((g,R)=>re(Hs,{id:g.id,title:g.title||g.id,icon:g.icon??re("span",{style:{color:"#fff",fontSize:13},children:(g.title||g.id).slice(0,1).toUpperCase()}),index:R,onPress:()=>p(g.instanceId)},g.instanceId)),re("button",{type:"button","aria-label":"Collapse",onClick:()=>i(false),style:{width:"100%",height:rn,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:re(cn,{down:true})})]})}),yt("button",{type:"button","aria-label":`Show ${a.length} minimized tools`,tabIndex:n?-1:0,"aria-hidden":n,onClick:()=>i(true),style:{position:"absolute",bottom:0,left:0,width:e,height:nn,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",padding:0,opacity:n?0:1,transform:n?"scale(0.9)":"scale(1)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:n?"none":"auto",...x},children:[re(cn,{}),d?re("span",{"aria-hidden":true,"data-testid":"buoy-dock-peek-attention",style:{position:"absolute",top:2,right:2,minWidth:11,height:11,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:Zo[d.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:d.kind==="needsInput"?"!":""}):null,a.length>1&&re("span",{style:{fontSize:9,fontWeight:600,color:qe,marginLeft:1},children:a.length})]})]})}import{registerToolModules as Ws}from"@buoy-gg/shared-ui/web";import{createElement as Ns}from"react";function dn(e){let t=e.icon;return{...e,icon:typeof t=="function"?o=>Ns(t,{size:o,slot:e.slot??"both",color:e.color}):()=>t}}import{createContext as Us,useContext as Ks,useState as un,useMemo as pn}from"react";import{jsx as Vs}from"react/jsx-runtime";var mn=Us(null);function gn({children:e}){let[t,o]=un(false),[a,n]=un(false),i=pn(()=>t||a,[t,a]),l=pn(()=>({isDialOpen:t,isToolOpen:a,isDevToolsActive:i,setDialOpen:o,setToolOpen:n}),[t,a,i]);return Vs(mn.Provider,{value:l,children:e})}function Lt(){let e=Ks(mn);return e||{isDialOpen:false,isToolOpen:false,isDevToolsActive:false,setDialOpen:()=>{},setToolOpen:()=>{}}}import*as Gs from"@buoy-gg/license/web";import*as _s from"@buoy-gg/shared-ui/web";import*as qs from"@buoy-gg/shared-ui/web/dataViewer";function fn(e){Ws({core:{useDevToolsVisibility:Lt},license:Gs,"shared-ui":_s,"shared-ui/dataViewer":qs,...e});let t=new Set;return Object.values(e).flatMap(o=>Object.entries(o).flatMap(([a,n])=>!a.endsWith("Preset")||!n||typeof n.id!="string"||!n.component||t.has(n.id)?[]:(t.add(n.id),[dn(n)])))}import{useEffect as Pt,useMemo as $t,useRef as Js}from"react";import{LicenseManager as Xs,useLicense as Ys}from"@buoy-gg/license/web";import{registerToolAdapters as Qs}from"@buoy-gg/shared-ui/web";function hn(e){return typeof e=="object"&&e!==null?e:void 0}function Zs({isDevelopment:e,isLicensed:t,externalSync:o,isAvailable:a}){if(o===false||!a)return false;if(e)return true;let n=hn(o);return t&&n?.enableInRelease===true&&bn(n.socketURL,n)===null}var yn="http://localhost:42831";function el(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}function bn(e,t){let o=e??yn;if(t?.allowInsecureNetwork===true)return null;let a;try{a=new URL(o)}catch{return`[Buoy] externalSync.socketURL "${o}" isn't a valid URL, so this release build won't connect to Buoy Desktop.`}return a.protocol==="https:"||a.protocol==="wss:"||el(a.hostname)?null:`[Buoy] This release build won't connect to ${o}: release sync carries real user data, and plain http to another machine is readable by anyone on the same network. Use a simulator, an emulator or adb reverse (localhost), an https:// broker, or set externalSync.allowInsecureNetwork: true for a network you trust.`}var tl={impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};function ol(e,t,o){if(t)return e;let a=null;for(let[n,i]of Object.entries(tl)){if(o?.includes(n))continue;let l=e[n];if(!l?.actions)continue;let u={...l.actions};for(let d of i)d in u&&(u[d]=()=>{throw new Error(`${n}.${d} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)});a??(a={...e}),a[n]={...l,actions:u}}return a??e}import{useEffect as nl,useMemo as al,useState as il}from"react";import{devToolsStorageKeys as rl,persistentStorage as sl}from"@buoy-gg/shared-ui/web";var ll=8;function cl(){let e="";for(;e.length<ll;)e+=(Math.random()*16|0).toString(16);return e}function dl(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function ul({appName:e,hardwareName:t,platform:o,installId:a,deviceId:n}){let i=dl(e??"buoy")||"buoy",l=e??"Buoy Device",u=t?.trim()||o;return n?{deviceId:n,deviceName:`${l} (${u})`}:{deviceId:`${i}-${o}-${a}`,deviceName:`${l} (${u} \xB7 ${a.slice(-4)})`}}function pl(){let e=globalThis;try{return e.sessionStorage??null}catch{return null}}async function ml({platform:e=Oe.OS,store:t,mint:o=cl}={}){let a=rl.sync.deviceId(),n=t===void 0?e==="web"?pl():sl:t;if(!n)return o();try{let i=await n.getItem(a);if(i&&i.length>0)return i;let l=o();return await n.setItem(a,l),l}catch{return o()}}var Ht=null;function gl(){return Ht||(Ht=ml()),Ht}function fl(e,t){let o=e?.deviceId,a=e?.deviceName,n=t.loadId??gl,i=t.platform??Oe.OS,[l,u]=il(null);return nl(()=>{if(o)return;let d=false;return n().then(p=>{d||u(p)}),()=>{d=true}},[o,n]),al(()=>{if(!o&&!l)return null;let d=ul({appName:t.appName,hardwareName:t.hardwareName,platform:i,installId:l??"",deviceId:o});return a?{...d,deviceName:a}:d},[o,a,l,t.appName,t.hardwareName,i])}import{getDevServerOrigin as hl,resolveReloadStrategy as yl,scheduleReloadApp as bl}from"@buoy-gg/shared-ui/web";var Sn=Date.now(),vn=hl(),Sl={platform:Oe.OS,isTV:Oe.isTV===true,isTVOS:Oe.isTVOS===true},wn={version:3,getSnapshot:()=>{let e=yl("auto");return{startedAt:Sn,devServerOrigin:vn,device:Sl,reload:{available:e!==null,strategy:e}}},subscribe:e=>()=>{},actions:{ping:()=>({ok:true,startedAt:Sn,devServerOrigin:vn}),reloadApp:e=>{let t=e??{},{strategy:o,delayMs:a}=bl({strategy:t.strategy,delayMs:t.delayMs});return{scheduled:true,strategy:o,delayMs:a}}}};import{Fragment as vl,jsx as Me,jsxs as wl}from"react/jsx-runtime";var xl=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"],Cl=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];function Tl(e){let t=$t(()=>Object.fromEntries(Object.entries(e.modules).map(([a,n])=>[a.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),n])),[e.modules]),o=t["react-query"];return o?.useReactQuerySyncAdapter?Me(zl,{...e,modules:t,query:o}):Me(xn,{...e,modules:t})}function zl(e){let t=e.query.useReactQuerySyncAdapter();return Me(xn,{...e,queryAdapter:t})}function xn({modules:e,apps:t,requiredEnvVars:o,externalSync:a,headless:n,sentryGetClient:i,queryAdapter:l}){let{isPro:u,tier:d}=Ys(),p=$t(()=>{let T={app:wn};for(let[k,z]of Object.entries(e))for(let[B,b]of Object.entries(z))B.endsWith("SyncAdapter")&&b&&typeof b=="object"&&(T[k]=b);l&&(T.query=l),e.env?.createEnvSyncAdapter&&(T.env=e.env.createEnvSyncAdapter(o??[]));for(let k of t??[])k.sync&&(T[`custom:${k.id}`]=k.sync);return T},[e,t,o,l]),m=Js(p);m.current=p,Pt(()=>Qs(()=>m.current),[]),Pt(()=>{let T=[],k=z=>{let B=z?.();typeof B=="function"&&T.push(B)};return k(e.network?.startNetworkCapture),k(e.storage?.startBrowserStorageCapture),k(e.assets?.startBrowserAssetCapture),e.storage?.storageSyncAdapter?.subscribe&&k(()=>e.storage.storageSyncAdapter.subscribe(()=>{})),e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe&&k(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{})),()=>{for(let z of T.reverse())z()}},[e]);let x=e["external-sync"],g=typeof et<"u"?et:process.env.NODE_ENV!=="production",R=Zs({isDevelopment:g,isLicensed:u,externalSync:a,isAvailable:!!x}),v=hn(a);!g&&v?.enableInRelease&&kl(bn(v.socketURL,v));let I=e.sentry?.SentryRoot;return wl(vl,{children:[Object.entries(e).flatMap(([T,k])=>xl.map(z=>{let B=k[z];return B?Me(B,{},`${T}:${z}`):null})),I&&Me(I,{getClient:i}),Object.entries(e).flatMap(([T,k])=>Cl.map(z=>{let B=k[z];return B&&(!n||z==="ScenariosOverlay"||z==="ImpersonateOverlay")?Me(B,{},`${T}:${z}`):null})),R&&Me(Il,{module:x,tools:p,options:v,isPro:u,tier:d,dev:g})]})}var Cn=null;function kl(e){!e||e===Cn||(Cn=e,console.warn(e))}function Il({module:e,tools:t,options:o,isPro:a,tier:n,dev:i}){let l=fl(o,{appName:typeof document>"u"?null:document.title||location.hostname,hardwareName:"Browser",platform:"web"}),{socket:u}=e.useExternalSyncSocket({deviceName:l?.deviceName??"Buoy Browser",socketURL:o?.socketURL??(i?e.getDefaultSocketURL():yn),persistentDeviceId:l?.deviceId??null,platform:"web",enableLogs:o?.enableLogs});Pt(()=>{if(!u)return;let m=()=>{u.connected&&Xs.hasAccountAccess()&&u.emit("device-license",{isPro:a?"1":"0",tier:n})};return m(),u.on("connect",m),()=>{u.off("connect",m)}},[u,a,n]);let d=o?.releaseActions?.join(",")??"",p=$t(()=>ol(t,i,d?d.split(","):void 0),[t,i,d]);return e.useExternalSync({tools:p,socket:u,deviceId:l?.deviceId??null,enableLogs:o?.enableLogs}),null}import{jsx as G,jsxs as Tn}from"react/jsx-runtime";var Ml={},zn="@react_buoy_floating_menu_tooltip_shown",Rl=Ce;function Al({size:e=14,color:t="#20C997"}){let o=Math.max(2,e/4),a=Math.max(1,e/16);return G("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:a,width:e,height:e,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((n,i)=>G("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:t}},i))})}function Dl(e){return G(gn,{children:G(_o,{children:G(El,{...e})})})}function El({environment:e,userRole:t,availableEnvironments:o,onEnvironmentSwitch:a,apps:n,modules:i=Ml,externalSync:l,requiredEnvVars:u,sentryGetClient:d,disableHints:p=false,headless:m=false}){let[x,g]=vt(false),[R,v]=vt(false),I=vi(false),T=ht(),k=Be(()=>Vt([...fn(i),...n??[]]),[n,i]),z=Lt(),B=T.openApps.some(r=>!r.minimized);de(()=>{z.setDialOpen(x)},[x,z.setDialOpen]),de(()=>{z.setToolOpen(B||R)},[B,R,z.setToolOpen]);let{registerApps:b}=T;de(()=>{b(k.map(r=>{let L=r.icon;return{...r,icon:typeof L=="function"?({size:j})=>L(j):L}}))},[b,k]);let M=Be(()=>k.map(r=>({id:r.id,name:r.name,description:r.description,slot:r.slot})),[k]),{settings:P}=wi({availableTools:M,storage:Rl});de(()=>{let r=false;return(async()=>{let[L,j]=await Promise.all([Ce.getItem(ot.dial.isOpen()),Ce.getItem(ot.settings.modalOpen())]);r||(L==="true"&&g(true),j==="true"&&(g(true),v(true)),I.current=true)})(),()=>{r=true}},[]),de(()=>{I.current&&Ce.setItem(ot.dial.isOpen(),x?"true":"false")},[x]),de(()=>{I.current&&Ce.setItem(ot.settings.modalOpen(),R?"true":"false")},[R]);let C=Fe(r=>{if(fr(r.id),r.launchMode==="toggle-only"){r.onPress?.();return}if(r.component){let L=typeof r.icon=="function"?r.icon(20):r.icon;T.open({id:r.id,title:r.name||tt(r.id),component:r.component,props:r.props,modal:r.modal,launchMode:r.launchMode||"self-modal",singleton:r.singleton??true,icon:L,color:r.color||Kt(r.id)})}else r.onPress?.()},[T]),A=Be(()=>wt(k,"dial").map(r=>{let L=r.color||Kt(r.id),j;return typeof r.icon=="string"?j=r.icon:typeof r.icon=="function"?j=r.icon(32):j=null,{id:r.id,name:r.name||tt(r.id),icon:j,unavailable:!r.component&&!r.onPress,color:L,onPress:()=>{C(r),g(false)}}}),[k,C]),oe=Be(()=>{if(!x)return A;let r=new Map(A.map(L=>[L.id,L]));return gr(A.map(L=>L.id)).map(L=>r.get(L)).filter(L=>!!L)},[x,A]),Z=Be(()=>wt(k,"row").filter(r=>P.floatingTools[r.id]===true&&(r.component||r.onPress)),[k,P.floatingTools]),q=Be(()=>k.map(r=>({id:r.id,name:r.name||tt(r.id),description:r.description||xi(r.id),slot:r.slot,icon:r.icon,color:r.color})),[k]),[le,K]=vt(false),ne=T.openApps.some(r=>!r.minimized);de(()=>{if(p)return;let r=false,L=setTimeout(async()=>{let j=await Ce.getItem(zn);!r&&!j&&K(true)},1e3);return()=>{r=true,clearTimeout(L)}},[p]);let J=Fe(()=>{K(false),Ce.setItem(zn,"true")},[]),Se=Fe(()=>{J(),g(true)},[J]),me=Fe(()=>{g(false),v(false)},[]),ve=Fe(()=>{v(r=>!r)},[]),$=Fe(()=>v(false),[]),Re=!!(o?.length&&a),fe=P.floatingTools.environment!==false,se=le&&!x&&!ne;de(()=>{if(!se)return;let r=j=>{(!(j.target instanceof Element)||!j.target.closest("[data-buoy-root]"))&&J()},L=j=>{j.key==="Escape"&&J()};return document.addEventListener("pointerdown",r,true),document.addEventListener("keydown",L),()=>{document.removeEventListener("pointerdown",r,true),document.removeEventListener("keydown",L)}},[se,J]);let we=T.openApps.some(r=>r.minimized&&r.launchMode!=="toggle-only"),ae=G(Tl,{modules:i,apps:n,requiredEnvVars:u,externalSync:l,headless:m,sentryGetClient:d});return m?ae:Tn("div",{"data-buoy-root":"",style:{display:"contents"},children:[ae,se&&G("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),Tn(Gt,{enablePositionPersistence:!se,pushToSide:x||ne,suspendPointerEvents:x,centerOnboarding:se,minimizedStack:we?G(js,{}):void 0,hasMinimizedStack:we,children:[e&&fe&&!Re&&G(Ci,{environment:e}),Re&&fe&&G(Ti,{currentEnvironment:e??"local",availableEnvironments:o,onSelect:a}),t?G(_t,{userRole:t,onPress:Se}):G("button",{"aria-label":"Open dev tools",onClick:Se,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:G(Al,{})}),Z.map(r=>G("button",{"aria-label":r.name||tt(r.id),title:r.description,onClick:()=>C(r),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof r.icon=="function"?r.icon(16):r.icon},r.id))]}),se&&G(so,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:J}),x&&G(mo,{icons:oe,onClose:me,centerLabel:"BUOY",onCenterPress:ve,settingsOpen:R,hintsDisabled:p}),G(Fo,{visible:R,onClose:$,availableTools:q,onSettingsChange:r=>{}}),G(qo,{}),G(hi,{})]})}function Ol(e){let{access:t,isPro:o,licenseKey:a}=bi();de(()=>{yi.configure(e.licenseKey)},[e.licenseKey]);let n=e.licenseKey===void 0||e.licenseKey.trim().toUpperCase()===(a??""),i=typeof et<"u"?et:process.env.NODE_ENV!=="production",l=n&&t.status==="admitted";return de(()=>{!i&&o&&l&&gi()},[i,o,l]),!i&&!o?null:l?G(Dl,{...e}):e.headless?null:G(Si,{})}import{useSettings as Bl,useFloatingTools as Fl,getToolLabel as Ll,getToolDescription as Pl,getToolColor as $l,settingsColors as Hl,settingsStyles as jl,dialColors as Wl,dialStyles as Nl}from"@buoy-gg/floating-tools-react/web";export{ia as Activity,mi as AlertCircle,sa as AlertTriangle,_o as AppHostProvider,qo as AppOverlay,ja as Badge,Mn as BarChart3,On as BaseEventStore,An as Bookmark,ca as Bug,Xa as Button,ai as Card,ua as Check,ma as CheckCircle,pa as CheckSquare,fa as ChevronDown,ya as ChevronLeft,Sa as ChevronRight,wa as ChevronUp,Ca as Clock,En as Cloud,li as CollapsibleSection,Ta as Copy,Qa as CopyButton,Dn as DataViewer,kn as Database,gn as DevToolsVisibilityProvider,mo as DialMenu,Ga as DiffViewer,Mi as Divider,Bn as Download,Ln as Edit3,pi as EmptyState,Rn as EventStepperFooter,za as Eye,ka as EyeOff,Ia as FileJson,Ma as FileText,Ra as Filter,Aa as FlaskConical,Ol as FloatingDevTools,Gt as FloatingTools,$n as GitBranch,Da as Globe,jn as HardDrive,Ea as Hash,Nn as HelpCircle,Kn as Home,Gn as Image,Oa as Info,Ka as InfoRow,na as JsModal,Fa as Key,Pa as Layers,qn as Link,Ha as Lock,Xn as Maximize2,Qn as Minus,ea as Palette,Wa as Pause,oa as Pin,Ua as Play,Va as Plus,_a as Power,ei as PowerToggle,Ja as RefreshCw,Fn as RelativeTime,aa as Route,oi as Row,Ya as Search,In as SearchBar,ri as SectionHeader,ra as Server,Za as Settings,Fo as SettingsModal,ti as Shield,la as Smartphone,da as Square,Na as StatusDot,di as TabSelector,ga as Timer,ni as Trash2,ha as Unlock,ba as Upload,ii as User,_t as UserStatus,va as Users,si as Wifi,ci as X,xa as XCircle,ui as Zap,wn as appSyncAdapter,ki as autoDiscoverWebPresets,Vt as autoDiscoverWithCustom,fi as clearReleaseOptIn,ta as copyToClipboard,dn as createWebTool,fn as createWebTools,zi as defaultToolPresets,Yn as devToolsStorageKeys,Wl as dialColors,Nl as dialStyles,Pn as formatBytes,Hn as formatDuration,Wn as formatNumber,Ii as getEnabledTools,$l as getToolColor,Pl as getToolDescription,Ll as getToolLabel,wt as getToolsBySlot,La as methodColor,Jn as persistentStorage,Vn as safeStringify,Hl as settingsColors,jl as settingsStyles,Ba as statusColor,qa as toolTheme,Un as truncateMiddle,$a as typeColor,ht as useAppHost,Lt as useDevToolsVisibility,Fl as useFloatingTools,_n as usePersistedState,Zn as useSafeAreaInsets,Bl as useSettings,Ss as useToolHeader,Uo as useToolHost};
10
+ `,document.head.appendChild(e),co=true}var Ct=Le.accent;function uo({title:e,message:t,onDismiss:o,showArrow:a=true}){let[n,i]=io(false),[l,u]=io(false);lr(()=>{pr();let p=requestAnimationFrame(()=>i(true));return()=>cancelAnimationFrame(p)},[]);let d={fontFamily:so,textTransform:"uppercase"};return Pe("div",{style:{position:"fixed",left:"50%",bottom:ur(),transform:`translateX(-50%) scale(${n?1:.8})`,opacity:n?1:0,transition:"transform 300ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 300ms ease",zIndex:10002,pointerEvents:"auto"},children:lo("div",{style:{position:"relative",animation:n?"buoyOnboardPulse 3s ease-in-out infinite":"none"},children:[Pe("div",{style:{position:"absolute",inset:-4,borderRadius:18,backgroundColor:"#FFFFFF",opacity:.06}}),lo("div",{style:{position:"relative",maxWidth:280,backgroundColor:Le.dialBackground,borderRadius:16,border:`1px solid ${Le.dialBorder}`,padding:20,boxShadow:`0 0 20px ${ro(Le.dialShadow,.6)}`,display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[Pe("span",{style:{...d,fontSize:16,fontWeight:900,letterSpacing:1,color:Ct,textAlign:"center"},children:e}),Pe("span",{style:{fontFamily:so,fontSize:13,lineHeight:"20px",color:Le.centerText,textAlign:"center"},children:t}),Pe("button",{onClick:o,onMouseDown:()=>u(true),onMouseUp:()=>u(false),onMouseLeave:()=>u(false),style:{...d,marginTop:8,borderRadius:8,border:"none",backgroundColor:Ct,padding:"10px 24px",fontSize:14,fontWeight:900,letterSpacing:1.5,color:"#000000",cursor:"pointer",opacity:l?.7:1,transform:l?"scale(0.96)":"scale(1)",transition:"transform 100ms ease, opacity 100ms ease"},children:"Got it!"})]}),a&&Pe("div",{style:{position:"absolute",left:"50%",bottom:cr,marginLeft:-12,width:0,height:0,borderLeft:"12px solid transparent",borderRight:"12px solid transparent",borderTop:`${dr}px solid ${Ct}`,filter:`drop-shadow(0 0 10px ${ro(Le.dialShadow,.5)})`,animation:n?"buoyOnboardArrowBounce 1.6s ease-in-out infinite":"none"}})]})})}import{Fragment as mr,jsx as B,jsxs as ge}from"react/jsx-runtime";var gr={x:.5,y:.5},po="@react_buoy_settings_tooltip_shown",mo=false;function fr(){if(mo||typeof document>"u")return;let e=document.createElement("style");e.textContent=Wi(),document.head.appendChild(e),mo=true}var $e=e=>1-Math.pow(1-e,3),Tt=e=>e*e*e;function hr({icon:e,index:t,totalIcons:o,position:a,progress:n,onPress:i}){let[l,u]=Q(false),[d,p]=Q(false),m=!e.icon&&e.id.startsWith("empty-"),x=!m&&e.unavailable===true,g=!m&&!x,{icons:R}=Yt,v=ji(t,o),I=0;n<=v[1]?I=0:n<=v[2]?I=(n-v[1])/(v[2]-v[1]):I=1,I=Math.max(0,Math.min(1,I));let T=Hi,k=R.pressIn.scale,z=I*(d?k:l?1.1:1),O=0;I<=0?O=0:I<=.3?O=I:O=.3+(I-.3)*(.7/.7);let b=a.x*I,M=a.y*I;return B("button",{role:"menuitem","aria-label":m?"Empty slot":e.name,"aria-disabled":!g,tabIndex:g?0:-1,onClick:g?i:void 0,onMouseEnter:()=>g&&u(true),onMouseLeave:()=>{u(false),p(false)},onMouseDown:()=>g&&p(true),onMouseUp:()=>p(false),style:{position:"absolute",left:"50%",top:"50%",width:T,height:T,marginLeft:-T/2,marginTop:-T/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:g?"pointer":"default",transform:`translate(${b}px, ${M}px) scale(${z})`,opacity:O,transition:l||d?"transform 100ms ease":"none",background:"none",border:"none",padding:0},children:m?B("div",{style:{width:S.emptySlot.dotSize,height:S.emptySlot.dotSize,borderRadius:S.emptySlot.dotSize/2,backgroundColor:F.emptyDotBackground,border:`${S.emptySlot.borderWidth}px solid ${F.emptyDotBorder}`}}):ge(mr,{children:[B("div",{style:{position:"absolute",width:`${S.icon.gradientBgSizePercent}%`,height:`${S.icon.gradientBgSizePercent}%`,borderRadius:S.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:S.icon.gradientBgOpacity}}),B("div",{style:{position:"absolute",width:`${S.icon.innerGlowSizePercent}%`,height:`${S.icon.innerGlowSizePercent}%`,borderRadius:S.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:S.icon.innerGlowOpacity}}),B("div",{style:{marginBottom:S.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:l?"brightness(1.2)":"none"},children:e.icon}),B("span",{style:{fontSize:e.name.length>8?Math.max(S.icon.label.fontSize*.7,S.icon.label.fontSize*8/e.name.length):S.icon.label.fontSize,fontWeight:S.icon.label.fontWeight,fontFamily:S.icon.label.fontFamily,color:F.iconLabel,letterSpacing:S.icon.label.letterSpacing,marginTop:S.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:e.name}),x&&B("span",{style:{fontSize:S.icon.label.fontSize-1,fontWeight:S.icon.label.fontWeight,fontFamily:S.icon.label.fontFamily,letterSpacing:S.icon.label.letterSpacing,color:Vi.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})}function go({side:e,color:t}){return B("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(e==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]]).map(([o,a,n,i],l)=>B("line",{x1:o,y1:a,x2:n,y2:i,stroke:t,strokeWidth:2},l))})}function fo({side:e,disabled:t,onClick:o}){let[a,n]=Q(false),i=t?F.emptyDotBorder:F.accent;return ge("button",{type:"button","aria-label":`${e==="prev"?"Previous":"Next"} dial page`,disabled:t,onClick:o,onMouseDown:()=>!t&&n(true),onMouseUp:()=>n(false),onMouseLeave:()=>n(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${F.dialBorder}`,backgroundColor:F.dialBackground,color:t?F.iconLabelMuted:F.centerText,fontSize:12,fontWeight:900,fontFamily:eo,letterSpacing:1.5,textTransform:"uppercase",cursor:t?"default":"pointer",opacity:t?.4:1,boxShadow:t?"none":`0 0 8px ${Qt(F.dialShadow,.4)}`,transform:a?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[e==="prev"&&B(go,{side:"prev",color:i}),e==="prev"?"PREV":"NEXT",e==="next"&&B(go,{side:"next",color:i})]})}function ho({icons:e,onClose:t,centerLabel:o="MENU",onCenterPress:a,settingsOpen:n=false,hintsDisabled:i=false}){let{id:l}=Ki(),[u,d]=Q(0),[p,m]=Q(0),[x,g]=Q(0),[R,v]=Q(0),[I,T]=Q(0),[k,z]=Q(1),[O,b]=Q(false),[M,$]=Q(false),[C,A]=Q(false),ee=it(null),Z=it(null),q=it(null),le=it(false),{entrance:K,exit:ne,interaction:J}=Yt,Se=Ni(),[me,ve]=Q(()=>({width:window.innerWidth,height:window.innerHeight}));Te(()=>{let D=()=>ve({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]);let j=at(()=>Li({screenWidth:me.width,maxCircleSize:Math.max(120,Math.min(320,me.height-96))}),[me]),Re=at(()=>$i(),[]),fe=at(()=>Pi(We,j.iconRadius),[j.iconRadius]),[se,we]=Q(0),ae=Math.max(1,Math.ceil(e.length/We)),r=Math.min(se,ae-1),L=at(()=>{let D=r*We,w=[...e.slice(D,D+We)];for(;w.length<We;)w.push({id:`empty-${w.length}`,name:"",icon:null,onPress:()=>{}});return w},[e,r]);Te(()=>{fr()},[]),Te(()=>{let D=K.backdrop.duration,w=K.dial.rotation.duration,X=K.centerButton.delay,V=K.icons.delay,G=K.icons.duration,_=performance.now(),te=ce=>{let s=ce-_;d(Math.min(1,s/D));let f=Math.min(1,s/400),E=$e(f)*1.1;f>.7&&(E-=(f-.7)*.33),f>=1&&(E=1),m(Math.max(0,Math.min(1.05,E)));let Y=Math.min(1,s/w);if(g($e(Y)*360),s>=X){let ye=Math.min(1,(s-X)/300),Ee=$e(ye)*1.15;ye>.6&&(Ee-=(ye-.6)*.375),ye>=1&&(Ee=1),v(Math.max(0,Math.min(1.05,Ee)))}if(s>=V){let ye=Math.min(1,(s-V)/G);T($e(ye))}let he=V+G;s<he?q.current=requestAnimationFrame(te):(d(1),m(1),g(360),v(1),T(1),A(true))};return q.current=requestAnimationFrame(te),()=>{q.current&&cancelAnimationFrame(q.current)}},[]);let W=rt(()=>{if(le.current)return;le.current=true,$(true),q.current&&cancelAnimationFrame(q.current);let D=performance.now(),w=ne.icons.duration,X=ne.centerButton.duration,V=ne.dialScale.duration,G=Math.max(X,V),_=ne.backdrop.duration,te=ce=>{let s=ce-D;if(s<w){let Y=Tt(s/w);T(1-Y),q.current=requestAnimationFrame(te);return}let f=w;if(s<f+G){T(0);let Y=Math.min(1,(s-f)/X),he=Math.min(1,(s-f)/V);v(1-Tt(Y)),m(1-Tt(he)),q.current=requestAnimationFrame(te);return}let E=f+G;if(s<E+_){m(0),v(0);let Y=(s-E)/_;d(1-Y),q.current=requestAnimationFrame(te);return}d(0),t()};q.current=requestAnimationFrame(te)},[ne,t]);Te(()=>{let D=document.activeElement,w=ee.current;return()=>{D?.isConnected&&(document.activeElement===document.body||w?.contains(document.activeElement))&&D.focus()}},[]),Te(()=>{if(n)return;Z.current?.focus();let D=w=>{let X=ee.current;if(X){if(w.key==="Escape")w.preventDefault(),W();else if(w.key==="Tab"){let V=Array.from(X.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(te=>te.getClientRects().length>0),G=V[0],_=V[V.length-1];(!X.contains(document.activeElement)||(w.shiftKey?document.activeElement===G:document.activeElement===_))&&(w.preventDefault(),(w.shiftKey?_:G)?.focus())}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(w.key)){let V=Array.from(X.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),G=V.indexOf(document.activeElement);if(G<0||!V.length)return;w.preventDefault();let _=w.key==="Home"?0:w.key==="End"?V.length-1:(G+(w.key==="ArrowRight"||w.key==="ArrowDown"?1:-1)+V.length)%V.length;V[_].focus()}}};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[W,n]);let[He,Xe]=Q(false);Te(()=>{if(i)return;let D=false,w=setTimeout(async()=>{let X=await Zt.getItem(po);!D&&!X&&Xe(true)},1200);return()=>{D=true,clearTimeout(w)}},[i]);let Ae=rt(()=>{Xe(false),Zt.setItem(po,"true")},[]);Te(()=>{n&&He&&Ae()},[n,He,Ae]);let Ye=rt(D=>{if(D.id.startsWith("empty-")||le.current)return;let[w,X]=J.iconSelect.pulse,V=performance.now(),G=150,_=te=>{let ce=te-V;if(ce<G){let s=$e(ce/G);z(1-(1-w.scale)*s),requestAnimationFrame(_)}else if(ce<G*2){let s=$e((ce-G)/G);z(w.scale+(X.scale-w.scale)*s),requestAnimationFrame(_)}else z(1)};requestAnimationFrame(_),setTimeout(()=>{D.onPress(),W()},J.iconSelect.actionDelay)},[J.iconSelect,W]),Qe=rt(D=>{if(le.current)return;let w=Math.max(0,Math.min(D,ae-1));w!==r&&we(w)},[ae,r]),De=j.buttonSize*S.centerButton.containerRatio,Ze=j.buttonSize*S.centerButton.borderRatio,St=j.buttonSize*S.centerButton.containerRatio/2+6,vt=C&&!M;return ge("div",{ref:ee,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[B("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:W,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:F.dialBackdrop,opacity:u}}),ge("div",{style:{position:"absolute",left:"50%",marginLeft:-j.circleSize/2,bottom:80,width:j.circleSize,height:j.circleSize,borderRadius:"50%",backgroundColor:F.dialBackground,border:`${S.circle.borderWidth}px solid ${F.dialBorder}`,boxShadow:`0 0 ${S.circle.shadowRadius}px ${Qt(F.dialShadow,S.circle.shadowOpacity)}`,transform:`scale(${p}) rotate(${x}deg)`,opacity:p>.01?1:0,overflow:"hidden"},children:[B("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:F.dialGradient1,opacity:S.gradientLayers[0].opacity}}),B("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:F.dialGradient2,opacity:S.gradientLayers[1].opacity}}),B("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:F.dialGradient3,opacity:S.gradientLayers[2].opacity}}),Re.map(D=>B("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:S.grid.lineHeight,transform:`rotate(${D}deg)`,transformOrigin:"center"},children:["left","right"].map(w=>B("div",{style:{position:"absolute",top:0,[w]:0,width:`calc(50% - ${St}px)`,height:S.grid.lineHeight,backgroundColor:F.dialGridLine}},w))},D)),B("div",{"data-testid":"dial-background","data-background":l,style:{position:"absolute",inset:0,pointerEvents:"none"},children:l==="hyperspace"?B(sr,{size:j.circleSize}):B(Ui,{focus:gr})}),L.map((D,w)=>B(hr,{icon:D,index:w,totalIcons:L.length,position:fe[w],progress:I,onPress:()=>Ye(D)},w)),ge("div",{style:{position:"absolute",left:"50%",top:"50%",width:De,height:De,marginLeft:-De/2,marginTop:-De/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:F.hubHalo,borderRadius:j.buttonSize,overflow:"hidden",transform:`scale(${R*k})`,opacity:R>.01?1:0},children:[B("div",{style:{position:"absolute",inset:0,backgroundColor:F.dialGradient1,opacity:.5,borderRadius:j.buttonSize}}),B("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:F.dialGradient2,opacity:.3,borderRadius:j.buttonSize}}),B("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:F.dialGradient3,opacity:.2,borderRadius:j.buttonSize}}),B("div",{style:{width:Ze,height:Ze,borderRadius:j.buttonSize*S.centerButton.borderRadiusRatio,backgroundColor:F.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:B("button",{ref:Z,type:"button","aria-label":n?"Close settings":"Open settings",disabled:!a,onClick:a,onMouseEnter:()=>b(true),onMouseLeave:()=>b(false),style:{border:0,padding:0,background:"transparent",width:j.buttonSize,height:j.buttonSize,borderRadius:j.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:a?"pointer":"default",transform:O?`scale(${J.centerHover.scale})`:"scale(1)",transition:`transform ${J.centerHover.duration}ms ease`,animation:vt&&!O?Se.pulse:"none"},children:n?ge("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:S.centerButton.text.fontSize-2,fontWeight:S.centerButton.text.fontWeight,fontFamily:S.centerButton.text.fontFamily,color:F.centerText,letterSpacing:S.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${F.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[B("span",{style:{marginBottom:-2},children:"CLOSE"}),B("span",{style:{marginTop:-2},children:"SETTINGS"})]}):B("span",{style:{fontSize:S.centerButton.text.fontSize,fontWeight:S.centerButton.text.fontWeight,fontFamily:S.centerButton.text.fontFamily,color:F.centerText,letterSpacing:S.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${F.centerTextGlow}`,textTransform:"uppercase"},children:o})})})]})]}),ae>1&&ge("div",{style:{position:"absolute",left:"50%",marginLeft:-j.circleSize/2,top:"calc(100% - 64px)",width:j.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,p),transform:`scale(${Math.min(1,p)})`},children:[B(fo,{side:"prev",disabled:r<=0,onClick:()=>Qe(r-1)}),ge("span",{style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:eo,letterSpacing:2,color:F.centerText,textShadow:`0 0 6px ${F.centerTextGlow}`},children:[String(r+1).padStart(2,"0"),ge("span",{style:{color:F.iconLabelMuted,textShadow:"none"},children:[" / ",String(ae).padStart(2,"0")]})]}),B(fo,{side:"next",disabled:r>=ae-1,onClick:()=>Qe(r+1)})]}),He&&!n&&B(uo,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:Ae,showArrow:false})]})}import{persistentStorage as yo,devToolsStorageKeys as yr}from"@buoy-gg/shared-ui/web";import{recordUsage as br,pruneUsage as Sr}from"@buoy-gg/floating-tools-core/web";var bo=yr.dial.usage(),je={},So=false,zt=null;function vo(){return zt||(zt=(async()=>{try{let e=await yo.getItem(bo);if(e){let t=JSON.parse(e);t&&typeof t=="object"&&(je=t)}}catch{}finally{So=true}})(),zt)}vo();function vr(e){return e.map((t,o)=>({id:t,index:o,lastUsed:je[t]?.lastUsed??0})).sort((t,o)=>o.lastUsed-t.lastUsed||t.index-o.index).map(({id:t})=>t)}async function wr(e){if(!e)return;So||await vo();let t=Math.max(Date.now(),...Object.values(je).map(o=>o.lastUsed+1));je=Sr(br(je,e,t),t);try{await yo.setItem(bo,JSON.stringify(je))}catch{}}import{useCallback as xr,useMemo as wo}from"react";import{persistentStorage as Cr}from"@buoy-gg/shared-ui/web";import{useState as oe,useEffect as ze,useCallback as lt,useMemo as ct}from"react";import{settingsEventBus as dt}from"@buoy-gg/floating-tools-core/web";import{useSyncExternalStore as Tr}from"react";import{getRegisteredToolModule as zr}from"@buoy-gg/shared-ui/web";var kr=()=>()=>{},Ir=()=>null;function Mr(){let e=zr("@buoy-gg/external-sync");return Tr(e?.subscribeSyncStatus??kr,()=>e?.getSyncStatus?.()??null,Ir)}import{SentryIcon as Rr,WifiCircuitIcon as Ar,ImageOverlayIcon as Dr,RenderCountIcon as Er,Info as kt,Layers as Br,ChevronRightIcon as xo,ChevronDown as Co,getStorageBackendType as Or,getUseLicense as Fr,signOutOfBuoy as Lr,persistentStorage as ke,Trash2 as Pr,CheckCircle2 as To,LicenseEntryModal as $r,BackgroundSwitcher as jr,night as h,NightCard as Ie,NightRows as It,NightSectionLabel as Hr,NightFootnote as zo,NightSwitch as ko,NightButton as Mt,NightSegmented as Wr,NightBadge as ue,NightSeparator as Nr,monoFont as Io}from"@buoy-gg/shared-ui/web";import{EnvIcon as Mo,StorageIcon as Vr,RoutesIcon as Ur,NetworkIcon as Kr,QueryIcon as _r,HighlighterIcon as Gr,ReduxIcon as qr,EventsIcon as Jr}from"@buoy-gg/floating-tools-core/web";import Xr,{createContext as Yr,useContext as Qr}from"react";import{jsx as Zr}from"react/jsx-runtime";var Ro=Yr({});function es({children:e,defaultFloatingTools:t,defaultDialTools:o}){let a=Xr.useMemo(()=>({defaultFloatingTools:t,defaultDialTools:o}),[t,o]);return Zr(Ro.Provider,{value:a,children:e})}function Ao(){return Qr(Ro)}import ts from"react";import{toolTheme as os}from"@buoy-gg/shared-ui/web";import{jsx as Do}from"react/jsx-runtime";function ns({label:e,size:t,color:o=os.colors.text}){let a=Math.max(Array.from(e.replace(/[\uFE00-\uFE0F\u200D]/g,"")).length,1),n=a<=2?t:t*1.6,i=Math.max(7,Math.min(t*(a===1?.7:.62),n/(.62*a)));return Do("span",{style:{display:"inline-flex",minWidth:t,maxWidth:n,height:t,alignItems:"center",justifyContent:"center",color:o,fontSize:i,fontWeight:800,letterSpacing:.5,whiteSpace:"nowrap",overflow:"hidden"},children:e})}function Eo(e,t){return e==null?e:typeof e=="function"?ts.createElement(e,{slot:t.slot,size:t.size,state:t.state,actions:t.actions}):typeof e=="string"||typeof e=="number"?Do(ns,{label:String(e),size:t.size,color:t.color}):e}import{JsModal as as,devToolsStorageKeys as Rt}from"@buoy-gg/shared-ui/web";import{useSafeAreaInsets as is}from"@buoy-gg/shared-ui/web";import{Fragment as Ve,jsx as c,jsxs as P}from"react/jsx-runtime";var ut="@react_buoy_dev_tools_settings",rs=6,pt=e=>{let t=rs,o={};for(let[a,n]of Object.entries(e))n&&t>0?(o[a]=true,t-=1):o[a]=false;return o},ss=(e,t)=>{let{userStatus:o,environment:a,...n}=e,i=t?Object.entries(n).filter(([l])=>t.includes(l)):Object.entries(n);return{...Object.fromEntries(i),environment:a??false}},Bo=(e,t,o)=>{if(!t)return e;let a={...e.dialTools,...t.dialTools??{}},n=o?.allowedDialKeys?Object.entries(a).filter(([i])=>o.allowedDialKeys?.includes(i)):Object.entries(a);return{dialTools:pt(Object.fromEntries(n)),floatingTools:ss({...e.floatingTools,...t.floatingTools??{}},o?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...t.globalSettings??{}}}},ls=(e=[],t,o)=>{let a={},n={},i=new Set(t??[]),l=new Set(o??[]),u=!o||o.length===0;for(let d of e){let{id:p,slot:m="both"}=d;(m==="dial"||m==="both")&&(a[p]=u?true:l.has(p)),(m==="row"||m==="both")&&(n[p]=i.has(p))}return{dialTools:pt(a),floatingTools:{...n,environment:i.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}},cs=({visible:e,onClose:t,onSettingsChange:o,initialSettings:a,availableApps:n=[],storage:i=ke,zIndex:l})=>{let{defaultFloatingTools:u,defaultDialTools:d}=Ao(),p=ct(()=>ls(n,u,d),[n,u,d]),m=ct(()=>Object.keys(p.dialTools),[p]),x=ct(()=>Object.keys(p.floatingTools).filter(s=>s!=="environment"),[p]),[g,R]=oe(a||Ue||p),[v,I]=oe(At??"floating"),[T,k]=oe(At!==null),[z,O]=oe(new Set),[b,M]=oe(false),[$,C]=oe(false);ze(()=>{let s=requestAnimationFrame(()=>C(true));return()=>cancelAnimationFrame(s)},[]);let A=Mr();ze(()=>{(async()=>{try{let s=await ke.getItem(Rt.settings.activeTab());if(s&&["floating","settings","pro"].includes(s)){let f=s;At=f,I(E=>E===f?E:f)}}catch{}finally{k(true)}})()},[]),ze(()=>{T&&ke.setItem(Rt.settings.activeTab(),v).catch(s=>{console.warn("Failed to save settings active tab:",s)})},[v,T]);let ee=Fr()?.(),Z=ee?.isPro??false,q=!Z&&ee?.licenseKey?ee.error:null,le=ee?.errorKind==="transport",[K,ne]=oe(Oo),[J,Se]=oe(false),[me,ve]=oe(false),[j,Re]=oe(false),[fe,se]=oe([]),[we,ae]=oe(false),r=is(),L=Vt.get("window").height,W=Vt.get("window").width,He=Math.floor(L*.33),Xe=Math.min(W-32,400),Ae=lt(async()=>{try{let s=await i.getItem(ut);if(s){let f=JSON.parse(s),E=Bo(p,f,{allowedDialKeys:m,allowedFloatingKeys:x});Ue=E,R(Y=>Fo(Y,E)?Y:E);return}Ue=p,R(f=>Fo(f,p)?f:p)}catch(s){console.error("Failed to load dev tools settings:",s),R(p)}},[p,m,x,i]);ze(()=>{Ae()},[Ae]),ze(()=>{Or().then(s=>{Oo=s,ne(f=>f===s?f:s)})},[]),ze(()=>{j&&(ae(true),ke.getAllKeys().then(s=>{se(s.sort())}).catch(()=>{se([])}).finally(()=>{ae(false)}))},[j]);let Ye=async s=>{try{let f={...s,dialTools:pt(s.dialTools)};await i.setItem(ut,JSON.stringify(f)),Ue=f,R(f),o?.(f),dt.emit(f)}catch(f){console.error("Failed to save dev tools settings:",f)}},Qe=s=>{let f={...g,floatingTools:{...g.floatingTools,[s]:!g.floatingTools[s]}};Ye(f)},De=s=>{let f={...g,globalSettings:{...g.globalSettings,[s]:!g.globalSettings?.[s]}};Ye(f)},Ze=async()=>{Se(true),ve(false);try{await ke.clear(),ve(true),R(p),i!==ke&&await i.setItem(ut,JSON.stringify(p)),o?.(p),dt.emit(p),setTimeout(()=>ve(false),2e3)}catch(s){console.error("Failed to clear storage:",s)}finally{Se(false)}},St=lt(s=>{},[]),vt=s=>{let f=n.find(E=>E.id===s);return f?.description?f.description:s==="environment"?"Environment badge.":""},D=s=>s==="environment"?"Env Badge":n.find(f=>f.id===s)?.name??s.toUpperCase().replace(/_/g," "),w=s=>{if(!$)return null;switch(s){case"query":return c(_r,{size:18});case"env":return c(Mo,{size:18});case"sentry":return c(Rr,{size:18,color:"#9945FF"});case"storage":return c(Vr,{size:18,bgColor:h.color.surface});case"wifi":case"query-wifi-toggle":return c(Ar,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return c(Ur,{size:18,bgColor:h.color.surface});case"network":return c(Kr,{size:18});case"environment":return c(Mo,{size:18});case"debug-borders":return c(Br,{size:18,color:h.color.accent});case"highlight-updates":return c(Er,{size:18,color:h.color.accent});case"highlight-updates-modal":return c(Gr,{size:18});case"redux":return c(qr,{size:18});case"image-overlay":return c(Dr,{size:18});case"events":return c(Jr,{size:18});case"zustand":try{let{ZustandIcon:f}=_t("@buoy-gg/zustand/web");return c(f,{size:18})}catch{return c(kt,{size:18,color:h.color.textSecondary})}case"jotai":try{let{JotaiIcon:f}=_t("@buoy-gg/jotai/web");return c(f,{size:18})}catch{return c(kt,{size:18,color:h.color.textSecondary})}default:{let f=n.find(E=>E.id===s);return f?.icon!=null?Eo(f.icon,{slot:"row",size:18,color:f.color}):c(kt,{size:18,color:h.color.textSecondary})}}},X=(s,f,E,Y)=>{let he=vt(s);return P(et,{activeOpacity:E?1:.7,onPress:()=>!E&&Y(),accessibilityLabel:D(s),accessibilityRole:"button",style:[y.toolRow,E&&y.rowDisabled],children:[c(H,{style:y.toolIconSlot,children:w(s)}),P(H,{style:y.rowInfo,children:[P(N,{style:y.rowLabel,children:[D(s),E?" \xB7 max 6":""]}),he?c(N,{style:y.rowCaption,numberOfLines:1,children:he}):null]}),c(ko,{value:f,disabled:E,onValueChange:()=>Y()})]},s)},V=s=>{O(f=>{let E=new Set(f);return E.has(s)?E.delete(s):E.add(s),E})},G=(s,f,E,Y,he)=>{let ye=g.globalSettings?.[s]??false,Ee=z.has(s);return P(H,{children:[P(et,{activeOpacity:.7,onPress:()=>V(s),accessibilityLabel:f,style:y.settingRow,children:[P(H,{style:y.rowInfo,children:[c(N,{style:y.rowLabel,children:f}),c(N,{style:y.rowCaption,numberOfLines:Ee?0:1,children:E})]}),c(ko,{value:ye,onValueChange:()=>De(s)})]}),Ee&&P(H,{style:y.settingRowBody,children:[c(N,{style:y.settingRowBodyText,children:Y}),c(N,{style:y.settingRowBodyHint,children:he})]})]},s)},_=(s,f,E)=>P(H,{children:[c(Hr,{children:s}),f,E]}),te=K==="filesystem"?c(ue,{label:"File System",tone:"accent"}):K==="asyncstorage"?c(ue,{label:"Async Storage",tone:"warning"}):K==="localstorage"?c(ue,{label:"Local Storage",tone:"accent"}):K==="memory"?c(ue,{label:"Memory",tone:"danger"}):c(ue,{label:"Loading\u2026",tone:"neutral"}),ce=()=>P(H,{style:y.container,children:[P(Nt,{style:y.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:y.scrollContainer,children:[v==="floating"&&c(Ve,{children:_("Floating Tools",c(Ie,{glass:true,children:c(It,{children:Object.entries(g.floatingTools).map(([s,f])=>X(s,f,false,()=>Qe(s)))})}),c(zo,{children:"Tools switched on here appear in the floating bubble row."}))}),v==="settings"&&P(Ve,{children:[_("Background",c(Ie,{glass:true,padded:true,children:c(jr,{embedded:true})})),_("Storage",P(Ie,{glass:true,children:[P(et,{activeOpacity:.7,onPress:()=>Re(!j),accessibilityLabel:"Storage Type",style:y.settingRow,children:[c(H,{style:y.rowInfo,children:c(N,{style:y.rowLabel,children:"Storage Type"})}),te,j?c(Co,{size:16,color:h.color.textTertiary}):c(xo,{size:16,color:h.color.textTertiary})]}),j&&P(Ve,{children:[P(H,{style:y.settingRowBody,children:[c(N,{style:y.settingRowBodyText,children:K==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":K==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":K==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":K==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),K==="asyncstorage"&&c(N,{style:[y.settingRowBodyText,y.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),K==="memory"&&c(N,{style:[y.settingRowBodyText,y.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),c(Nr,{}),P(H,{style:y.storageExpanded,children:[P(H,{style:y.storageExpandedHeader,children:[c(N,{style:y.storageExpandedTitle,children:"SAVED SETTINGS"}),c(N,{style:y.storageExpandedCount,children:we?"\u2026":`${fe.length} keys`})]}),we?c(N,{style:y.storageKeyEmpty,children:"Loading\u2026"}):fe.length===0?c(N,{style:y.storageKeyEmpty,children:"No settings saved yet"}):c(Nt,{style:y.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:fe.map(s=>c(H,{style:y.storageKeyItem,children:c(N,{style:y.storageKeyText,numberOfLines:1,children:s.replace("@react_buoy_","")})},s))})]}),c(H,{style:y.cardButtonWrap,children:c(Mt,{label:me?"Cleared":J?"Clearing\u2026":"Clear All Settings",variant:me?"secondary":"destructive",size:"md",disabled:J,onPress:Ze,icon:me?c(To,{size:15,color:h.color.accent}):c(Pr,{size:15,color:J?h.color.textTertiary:h.color.danger})})})]})]})),A&&A.state!=="idle"&&_("Desktop Sync",P(Ie,{glass:true,children:[P(et,{activeOpacity:.7,onPress:()=>V("desktopSync"),accessibilityLabel:"Buoy Desktop",style:y.settingRow,children:[c(H,{style:y.rowInfo,children:c(N,{style:y.rowLabel,children:"Buoy Desktop"})}),A.state==="connected"?c(ue,{label:"Connected",tone:"accent"}):A.state==="connecting"?c(ue,{label:"Connecting\u2026",tone:"neutral"}):c(ue,{label:"Retrying",tone:"warning"}),z.has("desktopSync")?c(Co,{size:16,color:h.color.textTertiary}):c(xo,{size:16,color:h.color.textTertiary})]}),z.has("desktopSync")&&P(H,{style:y.settingRowBody,children:[P(N,{style:y.settingRowBodyText,children:[A.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",c(N,{style:y.footnoteMono,children:A.targetURL??"(unknown URL)"}),A.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),A.state==="retrying"&&A.lastError&&P(N,{style:[y.settingRowBodyText,y.bodyWarning],children:["Last error: ",A.lastError]})]})]})),_("Modal Behavior",c(Ie,{glass:true,children:P(It,{children:[G("enableSharedModalDimensions","Shared Modal Size","Sync dimensions across all tools","When enabled, all tool modals will share the same size and position. Resizing one modal will affect all others. When disabled, each tool remembers its own size and position independently.","Keep OFF for the best experience. This allows you to customize each tool's modal size separately."),Be.OS!=="web"?G("expandableWindowControls","Expand Controls","iPad-style expandable window buttons","When enabled, the window control buttons (minimize, toggle mode, close) start as small dots and expand into larger, easy-to-tap buttons when pressed. When disabled, buttons are directly tappable at their small size.","Keep ON for touch devices where the small buttons are hard to press. Turn OFF if you prefer direct single-tap access."):null]})}))]}),v==="pro"&&P(Ve,{children:[_("License",P(Ie,{glass:true,children:[P(H,{style:y.settingRow,children:[c(H,{style:y.rowInfo,children:c(N,{style:y.rowLabel,children:"License Status"})}),c(H,{testID:"buoy-settings-license-status",accessibilityLabel:Z?"License: Active":"License: Free",children:Z?c(ue,{label:"Active",tone:"accent"}):c(ue,{label:"Free",tone:"neutral"})})]}),ee?.tierSource==="session"?P(H,{style:y.settingRow,children:[c(H,{style:y.rowInfo,children:c(N,{style:y.rowLabel,children:"Signed in with Buoy"})}),c(Mt,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void Lr(),testID:"buoy-settings-signout"})]}):null]}),c(zo,{children:Z?"You have full access to all Buoy DevTools features.":q?le?`Couldn't reach the license server (${q}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${q}.`:"Upgrade to Pro to unlock all features and support development."})),!Z&&P(Ve,{children:[_("Pro Features",c(Ie,{glass:true,children:c(It,{children:["Advanced Settings","Priority Support"].map(s=>P(H,{style:y.featureRow,children:[c(To,{size:16,color:h.color.accent}),c(N,{style:y.rowLabel,children:s})]},s))})})),c(Mt,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>M(true)})]})]})]}),c($r,{visible:b,onClose:()=>M(false),onSuccess:()=>M(false)})]});return c(as,{visible:e,onClose:t,zIndex:l,variant:"night",header:{showToggleButton:false,customContent:c(H,{style:y.headerRow,children:c(Wr,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:v,onChange:s=>I(s)})})},initialMode:"bottomSheet",onModeChange:St,persistenceKey:Rt.settings.root(),enablePersistence:true,maxHeight:L-r.top,initialHeight:He,initialFloatingPosition:{x:(W-Xe)/2,y:r.top+20},enableGlitchEffects:true,children:ce()})},ds={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}},us=(e,t)=>{let o=new Set(e??[]),a=new Set(t??[]),n={};for(let l of a)n[l]=true;let i={environment:o.has("environment")};for(let l of o)l!=="environment"&&(i[l]=true);return{dialTools:pt(n),floatingTools:i,globalSettings:{enableSharedModalDimensions:false}}},Ue=null,At=null,Oo=null,Fo=(e,t)=>JSON.stringify(e)===JSON.stringify(t);dt.addListener(e=>{e&&(Ue=e)});var ps=()=>{let{defaultFloatingTools:e,defaultDialTools:t}=Ao(),o=ct(()=>!e&&!t?ds:us(e,t),[e,t]),[a,n]=oe(o),i=lt(async()=>{try{let u=await ke.getItem(ut);if(u){let d=JSON.parse(u),p=Bo(o,d);n(p);return}n(o)}catch(u){console.error("Failed to load dev tools settings:",u),n(o)}},[o]);ze(()=>{i();let u=dt.addListener(d=>{try{d&&n(d)}catch{}});return()=>{u()}},[i]);let l=lt(()=>{i()},[i]);return{settings:a,refreshSettings:l}},y=Ut.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:h.gutter,paddingRight:h.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:h.gutter,paddingTop:8,paddingBottom:24,gap:h.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:h.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:h.rowPadH,paddingVertical:h.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:h.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:h.color.text,fontSize:h.font.row,fontWeight:"500"},rowCaption:{color:h.color.textTertiary,fontSize:h.font.label},settingRowBody:{paddingHorizontal:h.rowPadH,paddingBottom:h.rowPadV,gap:6},settingRowBodyText:{color:h.color.textSecondary,fontSize:h.font.caption,lineHeight:h.font.caption*1.45},settingRowBodyHint:{color:h.color.textTertiary,fontSize:h.font.caption,lineHeight:h.font.caption*1.45},bodyWarning:{color:h.color.warning},bodyDanger:{color:h.color.danger},cardButtonWrap:{paddingHorizontal:h.cardPad,paddingTop:10,paddingBottom:h.cardPad},storageExpanded:{paddingHorizontal:h.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:h.color.textSecondary,fontSize:h.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:h.color.textTertiary,fontSize:h.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:h.color.glassElevated,borderRadius:h.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:h.color.textSecondary,fontSize:h.font.micro,fontFamily:Io},storageKeyEmpty:{color:h.color.textTertiary,fontSize:h.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Io,fontSize:h.font.label,color:h.color.textSecondary}});import{jsx as Lo}from"react/jsx-runtime";var ms=[];function Po({visible:e,onClose:t,availableTools:o=ms,defaultFloatingTools:a,defaultDialTools:n,storage:i=Cr,onSettingsChange:l}){let u=wo(()=>({getItem:async m=>i.getItem(m),setItem:async(m,x)=>i.setItem(m,x)}),[i]),d=wo(()=>o.map(m=>({...m,name:m.name??m.id,icon:typeof m.icon=="function"?x=>m.icon(x.size):m.icon})),[o]),p=xr(m=>{l?.(m)},[l]);return Lo(es,{defaultFloatingTools:a,defaultDialTools:n,children:Lo(cs,{visible:e,onClose:t,zIndex:11e3,availableApps:d,storage:u,onSettingsChange:p})})}import{persistentStorage as $o}from"@buoy-gg/shared-ui/web";import{createContext as gs,useCallback as be,useContext as fs,useEffect as Dt,useMemo as hs,useRef as Ke,useState as jo}from"react";var ys=(e,t,o)=>{if(t.singleton){let n=e.find(i=>i.id===t.id);if(n){let i=n.minimized??false;return{instanceId:n.instanceId,wasMinimized:i,apps:[...e.filter(l=>l.instanceId!==n.instanceId),{...n,minimized:false}]}}}let a=o();return{instanceId:a,wasMinimized:false,apps:[...e,{...t,instanceId:a}]}};import{createContext as bs,useCallback as Ho,useContext as Ss,useEffect as mt,useMemo as vs,useRef as Wo,useState as gt}from"react";import{JsModal as ws,ModalHeader as _e,HeaderSearchButton as xs,TickProvider as Cs,ToolScreenHeaderContext as Ts,devToolsStorageKeys as No,buoyColors as Vo,gameUIColors as Et}from"@buoy-gg/shared-ui/web";import{jsx as ie,jsxs as ft}from"react/jsx-runtime";var Ge=()=>{},zs={search:"",isSearchActive:false,clearSearch:Ge,close:Ge,minimize:Ge,showToast:Ge,setHeaderOverride:Ge},Uo=bs(null);function Ko(){return Ss(Uo)??zs}function ks(e,t){let{setHeaderOverride:o}=Ko();mt(()=>(o(e),()=>o(null)),t)}var _o=2200,Is={success:Et.success,error:Et.error,info:Et.info};function Ms({message:e,type:t,nonce:o}){let a=Wo(new xe.Value(0)).current;mt(()=>{a.setValue(0),xe.sequence([xe.timing(a,{toValue:1,duration:150,useNativeDriver:true}),xe.delay(_o-450),xe.timing(a,{toValue:0,duration:300,useNativeDriver:true})]).start()},[o,a]);let n=Is[t];return ft(xe.View,{pointerEvents:"none",style:[ht.toast,{opacity:a,borderColor:n+"60"}],children:[ie(H,{style:[ht.toastDot,{backgroundColor:n}]}),ie(N,{style:ht.toastText,numberOfLines:2,children:e})]})}function Rs({app:e,config:t,visible:o,zIndex:a,onClose:n,onMinimize:i,initialModalState:l,enableSharedModalDimensions:u,bodyProps:d}){let p=e.component,[m,x]=gt(false),[g,R]=gt(""),[v,I]=gt(null),[T,k]=gt(null),z=Wo(null),O=Ho(()=>{x(false),R("")},[]),b=Ho((K,ne="info")=>{z.current&&clearTimeout(z.current),k(J=>({message:K,type:ne,nonce:(J?.nonce??0)+1})),z.current=setTimeout(()=>k(null),_o)},[]);mt(()=>()=>{z.current&&clearTimeout(z.current)},[]);let M=vs(()=>({search:m?g:"",isSearchActive:m,clearSearch:O,close:n,minimize:()=>i(),showToast:b,setHeaderOverride:I,instanceId:e.instanceId}),[g,m,O,n,i,b,e.instanceId]),$=v?.title??t.title??e.title??e.id,C=v?.subtitle??t.subtitle,A=v?.onBack,ee=v?.actions??t.headerActions,Z=v?.searchable??t.searchable;mt(()=>{!Z&&m&&O()},[Z,m,O]);let q=u?No.modal.root():No.custom(e.id).modal(),le=ft(_e,{children:[A&&!m&&ie(_e.Navigation,{onBack:A}),m?ie(_e.Search,{value:g,onChangeText:R,onCancel:O,placeholder:t.searchPlaceholder,testID:`tool-search-field-${e.id}`}):ie(_e.Content,{title:$,subtitle:C}),ft(_e.Actions,{children:[!m&&ee,Z&&!m&&ie(xs,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>x(true)})]})]});return ie(Uo.Provider,{value:M,children:ie(ws,{visible:o,onClose:n,onBack:A,onMinimize:i,initialModalState:l,zIndex:a,persistenceKey:q,enablePersistence:true,initialMode:t.initialMode??"bottomSheet",header:{customContent:le,showToggleButton:true},disableScrollWrapper:true,styles:{},children:ft(H,{style:ht.bodyRoot,children:[ie(Cs,{children:ie(Ts.Provider,{value:I,children:ie(p,{...d})})}),T&&ie(Ms,{message:T.message,type:T.type,nonce:T.nonce})]})})})}var ht=Ut.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:Vo.card,borderWidth:1,borderRadius:8,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOpacity:.4,shadowRadius:8,shadowOffset:{width:0,height:2},elevation:6},toastDot:{width:6,height:6,borderRadius:3},toastText:{flex:1,fontSize:12,color:Vo.text}});import{Fragment as As,jsx as pe}from"react/jsx-runtime";var Go=gs(null),qo="@react_buoy_open_apps",Bt=44,Ds=12,Es=100,Bs=16,Os=e=>({x:window.innerWidth-Bt-Bs,y:window.innerHeight-Es-Bt-e*(Bt+Ds)}),Jo=({children:e})=>{let[t,o]=jo([]),[a,n]=jo(false),i=Ke([]),l=Ke(null),u=Ke(false),d=Ke(false),p=Ke(false),m=be(b=>{let M="";return o($=>{let{apps:C,instanceId:A}=ys($,b,()=>`${b.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);return M=A,C}),M},[]),x=be(()=>{if(u.current||!d.current||!p.current)return;u.current=true;let b=l.current;if(!b||b.length===0){n(true);return}l.current=null,b.forEach(({id:M,minimized:$})=>{let C=i.current.find(A=>A.id===M);if(C&&C.component){let A=Eo(C.icon,{slot:"dial",size:20,color:C.color});m({id:C.id,title:C.name,component:C.component,props:C.props,modal:C.modal,launchMode:C.launchMode||"self-modal",singleton:C.singleton??true,icon:A,color:C.color,minimized:$})}}),n(true)},[m]);Dt(()=>{let b=false;return(async()=>{try{let M=await $o.getItem(qo);if(b)return;if(M){let $=JSON.parse(M),C;Array.isArray($)&&$.length>0&&(typeof $[0]=="string"?C=$.map(A=>({id:A,minimized:false})):C=$.filter(A=>typeof A=="object"&&A!==null&&typeof A.id=="string"),C.length&&(l.current=C))}}catch{}b||(d.current=true,x())})(),()=>{b=true}},[x]),Dt(()=>{if(!a)return;let b=t.map(M=>({id:M.id,minimized:M.minimized??false}));$o.setItem(qo,JSON.stringify(b))},[t,a]);let g=be(b=>{i.current=b,p.current=true,x()},[x]),R=be(b=>{o(M=>M.length?b?M.filter($=>$.instanceId!==b):M.slice(0,-1):M)},[]),v=be(()=>o([]),[]),I=be((b,M)=>{o($=>$.map(C=>C.instanceId===b?{...C,minimized:true,restoreState:M}:C))},[]),T=be((b,M)=>{o($=>$.map(C=>C.instanceId===b?{...C,minimized:false,restoreState:M??C.restoreState}:C))},[]),k=be(b=>t.find(M=>M.instanceId===b)?.minimized??false,[t]),z=t.some(b=>b.launchMode!=="toggle-only"&&!b.minimized);Dt(()=>{if(!z)return;let b=M=>{if(M.key!=="Escape"||M.defaultPrevented)return;let $=[...t].reverse().find(C=>C.launchMode!=="toggle-only"&&!C.minimized);$&&R($.instanceId)};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[z,R,t]);let O=hs(()=>({openApps:t,isAnyOpen:z,open:m,close:R,closeAll:v,registerApps:g,minimize:I,restore:T,isMinimized:k}),[t,z,m,R,v,g,I,T,k]);return pe(Go.Provider,{value:O,children:e})},yt=()=>{let e=fs(Go);return e||{openApps:[],isAnyOpen:false,open:()=>"",close:()=>{},closeAll:()=>{},registerApps:()=>{},minimize:()=>{},restore:()=>{},isMinimized:()=>false}},Fs=9e3,Ls={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"},Ps={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"},$s=({app:e,zIndex:t,onClose:o,onMinimize:a,minimizeTargetPosition:n,enableSharedModalDimensions:i})=>{let l=e.component,u=!e.minimized,d={...e.props??{},...i?{enableSharedModalDimensions:true}:{}};return e.modal&&(!e.launchMode||e.launchMode==="self-modal")?pe(Rs,{app:e,config:e.modal,visible:u,zIndex:t,onClose:o,onMinimize:a,initialModalState:e.restoreState,enableSharedModalDimensions:i,bodyProps:d}):e.launchMode==="self-modal"?pe(l,{...d,visible:u,onClose:o,onRequestClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId,zIndex:t,initialModalState:e.restoreState}):e.launchMode==="inline"?u?pe("div",{style:{position:"fixed",inset:0,zIndex:t,pointerEvents:"none"},children:pe(l,{...d,onClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId})}):null:pe("div",{style:{...Ls,zIndex:t,display:u?"flex":"none"},children:pe("div",{style:Ps,children:pe(l,{...d,onClose:o,onMinimize:a,minimizeTargetPosition:n,instanceId:e.instanceId})})})},Xo=()=>{let{openApps:e,close:t,minimize:o}=yt(),{settings:a}=ps(),n=e.filter(u=>u.launchMode!=="toggle-only");if(n.length===0)return null;let i=n.filter(u=>u.minimized).length,l=Fi()??Os(i);return pe(As,{children:n.map((u,d)=>pe($s,{app:u,zIndex:Fs+d,onClose:()=>t(u.instanceId),onMinimize:p=>o(u.instanceId,p),enableSharedModalDimensions:a.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:l},u.instanceId))})};import{useCallback as js,useEffect as Ot,useRef as Hs,useState as Yo,useSyncExternalStore as Qo}from"react";import{persistentStorage as Zo,getToolAttention as Ft,subscribeToolAttention as en}from"@buoy-gg/shared-ui/web";import{jsx as re,jsxs as bt}from"react/jsx-runtime";function Ws(e){return Qo(en,()=>Ft(e),()=>Ft(e))}var tn={needsInput:"#FF8329",done:"#20C997",failed:"#FF3B30"},on={needsInput:3,failed:2,done:1},nn=new Map;function an(e){let t=null;for(let a of e?e.split("|"):[]){let n=Ft(a);n&&(!t||on[n.kind]>on[t.kind])&&(t=n)}let o=nn.get(e);return o&&t&&o.kind===t.kind&&o.label===t.label?o:!o&&!t?null:(nn.set(e,t),t)}function Ns(e){let t=e.join("|");return Qo(en,()=>an(t),()=>an(t))}var rn=28,Lt=32,Pt=6,sn=8,ln=24,cn="@react_buoy_minimized_stack_expanded",Vs=80,dn=2e3,Us=6e3,Ks="#1A1A1A",qe="#888888";function un({down:e=false}){return re("svg",{width:12,height:12,viewBox:"0 0 24 24","aria-hidden":"true",style:{transform:e?"rotate(180deg)":void 0},children:re("path",{d:"M18 15l-6-6-6 6",fill:"none",stroke:qe,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function _s({id:e,title:t,icon:o,index:a,onPress:n}){let i=Ws(e),l=Hs(null);return Ot(()=>{let u=true,d,p=()=>{l.current?.animate([{transform:"translateX(0) scale(1)",opacity:1,offset:0},{transform:"translateX(3px) scale(1.05)",opacity:.4,offset:.2},{transform:"translateX(-3px) scale(1.1)",opacity:1,offset:.4},{transform:"translateX(2px) scale(1.0)",opacity:.6,offset:.6},{transform:"translateX(-1px) scale(0.95)",opacity:1,offset:.8},{transform:"translateX(0) scale(1)",opacity:1,offset:1}],{duration:Vs,easing:"linear"})},m=x=>{let g=x?500+Math.random()*1500+a*200:dn+Math.random()*(Us-dn)+a*300;d=setTimeout(()=>{u&&(p(),m(false))},g)};return m(true),()=>{u=false,clearTimeout(d)}},[a]),bt("button",{type:"button","aria-label":i?`${t} \u2014 ${i.label}. Restore`:`Restore ${t}`,onClick:n,style:{width:Lt,height:Lt,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",padding:0,cursor:"pointer",position:"relative"},children:[re("div",{ref:l,style:{display:"flex",alignItems:"center",justifyContent:"center"},children:o}),i?re("span",{"aria-hidden":true,"data-testid":`buoy-dock-badge-${e}-${i.kind}`,style:{position:"absolute",top:0,right:0,minWidth:12,height:12,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:tn[i.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:i.kind==="needsInput"?"!":""}):null]})}function Gs({containerWidth:e=32}){let{openApps:t,restore:o}=yt(),a=t.filter(g=>g.minimized&&g.launchMode!=="toggle-only"),[n,i]=Yo(false),[l,u]=Yo(false),d=Ns(a.map(g=>g.id));Ot(()=>{let g=false;return(async()=>{let R=await Zo.getItem(cn);!g&&R==="true"&&i(true),g||u(true)})(),()=>{g=true}},[]),Ot(()=>{l&&Zo.setItem(cn,n?"true":"false")},[n,l]);let p=js(g=>{o(g)},[o]);if(a.length===0)return null;let m=sn+a.length*Lt+(a.length-1)*Pt+Pt+ln+4,x={backgroundColor:Ks,borderTopLeftRadius:6,borderTopRightRadius:6,borderTop:`1px solid ${qe}66`,borderLeft:`1px solid ${qe}66`,borderRight:`1px solid ${qe}66`,borderBottom:"none",boxSizing:"border-box"};return bt("div",{style:{height:rn,overflow:"visible",position:"relative"},children:[re("div",{style:{position:"absolute",bottom:"var(--buoy-stack-bottom, 0px)",top:"var(--buoy-stack-top, auto)",left:0,width:e,maxHeight:"var(--buoy-stack-space, calc(100vh - 48px))",visibility:n?"visible":"hidden",height:n?m:0,opacity:n?1:0,overflowY:"auto",overflowX:"hidden",transition:"height 200ms ease, opacity 200ms ease",pointerEvents:n?"auto":"none",...x},children:bt("div",{style:{height:m,display:"flex",flexDirection:"column",alignItems:"center",paddingTop:sn,gap:Pt,boxSizing:"border-box"},children:[[...a].reverse().map((g,R)=>re(_s,{id:g.id,title:g.title||g.id,icon:g.icon??re("span",{style:{color:"#fff",fontSize:13},children:(g.title||g.id).slice(0,1).toUpperCase()}),index:R,onPress:()=>p(g.instanceId)},g.instanceId)),re("button",{type:"button","aria-label":"Collapse",onClick:()=>i(false),style:{width:"100%",height:ln,marginTop:3,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:re(un,{down:true})})]})}),bt("button",{type:"button","aria-label":`Show ${a.length} minimized tools`,tabIndex:n?-1:0,"aria-hidden":n,onClick:()=>i(true),style:{position:"absolute",bottom:0,left:0,width:e,height:rn,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",padding:0,opacity:n?0:1,transform:n?"scale(0.9)":"scale(1)",transition:"opacity 200ms ease, transform 200ms ease",pointerEvents:n?"none":"auto",...x},children:[re(un,{}),d?re("span",{"aria-hidden":true,"data-testid":"buoy-dock-peek-attention",style:{position:"absolute",top:2,right:2,minWidth:11,height:11,borderRadius:6,padding:"0 2px",boxSizing:"border-box",background:tn[d.kind],border:"1.5px solid #0C0C0C",color:"#000",fontSize:8,fontWeight:800,lineHeight:"9px",display:"flex",alignItems:"center",justifyContent:"center"},children:d.kind==="needsInput"?"!":""}):null,a.length>1&&re("span",{style:{fontSize:9,fontWeight:600,color:qe,marginLeft:1},children:a.length})]})]})}import{registerToolModules as qs}from"@buoy-gg/shared-ui/web";import{createElement as Js}from"react";function pn(e){let t=e.icon;return{...e,icon:typeof t=="function"?o=>Js(t,{size:o,slot:e.slot??"both",color:e.color}):()=>t}}import{createContext as Xs,useContext as Ys,useState as mn,useMemo as gn}from"react";import{jsx as Qs}from"react/jsx-runtime";var fn=Xs(null);function hn({children:e}){let[t,o]=mn(false),[a,n]=mn(false),i=gn(()=>t||a,[t,a]),l=gn(()=>({isDialOpen:t,isToolOpen:a,isDevToolsActive:i,setDialOpen:o,setToolOpen:n}),[t,a,i]);return Qs(fn.Provider,{value:l,children:e})}function $t(){let e=Ys(fn);return e||{isDialOpen:false,isToolOpen:false,isDevToolsActive:false,setDialOpen:()=>{},setToolOpen:()=>{}}}import*as Zs from"@buoy-gg/license/web";import*as el from"@buoy-gg/shared-ui/web";import*as tl from"@buoy-gg/shared-ui/web/dataViewer";function yn(e){qs({core:{useDevToolsVisibility:$t},license:Zs,"shared-ui":el,"shared-ui/dataViewer":tl,...e});let t=new Set;return Object.values(e).flatMap(o=>Object.entries(o).flatMap(([a,n])=>!a.endsWith("Preset")||!n||typeof n.id!="string"||!n.component||t.has(n.id)?[]:(t.add(n.id),[pn(n)])))}import{useEffect as jt,useMemo as Ht,useRef as ol}from"react";import{LicenseManager as nl,useLicense as al}from"@buoy-gg/license/web";import{registerToolAdapters as il}from"@buoy-gg/shared-ui/web";function bn(e){return typeof e=="object"&&e!==null?e:void 0}function rl({isDevelopment:e,isLicensed:t,externalSync:o,isAvailable:a}){if(o===false||!a)return false;if(e)return true;let n=bn(o);return t&&n?.enableInRelease===true&&vn(n.socketURL,n)===null}var Sn="http://localhost:42831";function sl(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}function vn(e,t){let o=e??Sn;if(t?.allowInsecureNetwork===true)return null;let a;try{a=new URL(o)}catch{return`[Buoy] externalSync.socketURL "${o}" isn't a valid URL, so this release build won't connect to Buoy Desktop.`}return a.protocol==="https:"||a.protocol==="wss:"||sl(a.hostname)?null:`[Buoy] This release build won't connect to ${o}: release sync carries real user data, and plain http to another machine is readable by anyone on the same network. Use a simulator, an emulator or adb reverse (localhost), an https:// broker, or set externalSync.allowInsecureNetwork: true for a network you trust.`}var ll={impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};function cl(e,t,o){if(t)return e;let a=null;for(let[n,i]of Object.entries(ll)){if(o?.includes(n))continue;let l=e[n];if(!l?.actions)continue;let u={...l.actions};for(let d of i)d in u&&(u[d]=()=>{throw new Error(`${n}.${d} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)});a??(a={...e}),a[n]={...l,actions:u}}return a??e}import{useEffect as dl,useMemo as ul,useState as pl}from"react";import{devToolsStorageKeys as ml,persistentStorage as gl}from"@buoy-gg/shared-ui/web";var fl=8;function hl(){let e="";for(;e.length<fl;)e+=(Math.random()*16|0).toString(16);return e}function yl(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function bl({appName:e,hardwareName:t,platform:o,installId:a,deviceId:n}){let i=yl(e??"buoy")||"buoy",l=e??"Buoy Device",u=t?.trim()||o;return n?{deviceId:n,deviceName:`${l} (${u})`}:{deviceId:`${i}-${o}-${a}`,deviceName:`${l} (${u} \xB7 ${a.slice(-4)})`}}function Sl(){let e=globalThis;try{return e.sessionStorage??null}catch{return null}}async function vl({platform:e=Be.OS,store:t,mint:o=hl}={}){let a=ml.sync.deviceId(),n=t===void 0?e==="web"?Sl():gl:t;if(!n)return o();try{let i=await n.getItem(a);if(i&&i.length>0)return i;let l=o();return await n.setItem(a,l),l}catch{return o()}}var Wt=null;function wl(){return Wt||(Wt=vl()),Wt}function xl(e,t){let o=e?.deviceId,a=e?.deviceName,n=t.loadId??wl,i=t.platform??Be.OS,[l,u]=pl(null);return dl(()=>{if(o)return;let d=false;return n().then(p=>{d||u(p)}),()=>{d=true}},[o,n]),ul(()=>{if(!o&&!l)return null;let d=bl({appName:t.appName,hardwareName:t.hardwareName,platform:i,installId:l??"",deviceId:o});return a?{...d,deviceName:a}:d},[o,a,l,t.appName,t.hardwareName,i])}import{getDevServerOrigin as Cl,resolveReloadStrategy as Tl,scheduleReloadApp as zl}from"@buoy-gg/shared-ui/web";var wn=Date.now(),xn=Cl(),kl={platform:Be.OS,isTV:Be.isTV===true,isTVOS:Be.isTVOS===true},Cn={version:3,getSnapshot:()=>{let e=Tl("auto");return{startedAt:wn,devServerOrigin:xn,device:kl,reload:{available:e!==null,strategy:e}}},subscribe:e=>()=>{},actions:{ping:()=>({ok:true,startedAt:wn,devServerOrigin:xn}),reloadApp:e=>{let t=e??{},{strategy:o,delayMs:a}=zl({strategy:t.strategy,delayMs:t.delayMs});return{scheduled:true,strategy:o,delayMs:a}}}};import{Fragment as Il,jsx as Me,jsxs as Ml}from"react/jsx-runtime";var Rl=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"],Al=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];function Dl(e){let t=Ht(()=>Object.fromEntries(Object.entries(e.modules).map(([a,n])=>[a.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),n])),[e.modules]),o=t["react-query"];return o?.useReactQuerySyncAdapter?Me(El,{...e,modules:t,query:o}):Me(Tn,{...e,modules:t})}function El(e){let t=e.query.useReactQuerySyncAdapter();return Me(Tn,{...e,queryAdapter:t})}function Tn({modules:e,apps:t,requiredEnvVars:o,externalSync:a,headless:n,sentryGetClient:i,queryAdapter:l}){let{isPro:u,tier:d}=al(),p=Ht(()=>{let T={app:Cn};for(let[k,z]of Object.entries(e))for(let[O,b]of Object.entries(z))O.endsWith("SyncAdapter")&&b&&typeof b=="object"&&(T[k]=b);l&&(T.query=l),e.env?.createEnvSyncAdapter&&(T.env=e.env.createEnvSyncAdapter(o??[]));for(let k of t??[])k.sync&&(T[`custom:${k.id}`]=k.sync);return T},[e,t,o,l]),m=ol(p);m.current=p,jt(()=>il(()=>m.current),[]),jt(()=>{let T=[],k=z=>{let O=z?.();typeof O=="function"&&T.push(O)};return k(e.network?.startNetworkCapture),k(e.storage?.startBrowserStorageCapture),k(e.assets?.startBrowserAssetCapture),e.storage?.storageSyncAdapter?.subscribe&&k(()=>e.storage.storageSyncAdapter.subscribe(()=>{})),e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe&&k(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{})),()=>{for(let z of T.reverse())z()}},[e]);let x=e["external-sync"],g=typeof tt<"u"?tt:process.env.NODE_ENV!=="production",R=rl({isDevelopment:g,isLicensed:u,externalSync:a,isAvailable:!!x}),v=bn(a);!g&&v?.enableInRelease&&Bl(vn(v.socketURL,v));let I=e.sentry?.SentryRoot;return Ml(Il,{children:[Object.entries(e).flatMap(([T,k])=>Rl.map(z=>{let O=k[z];return O?Me(O,{},`${T}:${z}`):null})),I&&Me(I,{getClient:i}),Object.entries(e).flatMap(([T,k])=>Al.map(z=>{let O=k[z];return O&&(!n||z==="ScenariosOverlay"||z==="ImpersonateOverlay")?Me(O,{},`${T}:${z}`):null})),R&&Me(Ol,{module:x,tools:p,options:v,isPro:u,tier:d,dev:g})]})}var zn=null;function Bl(e){!e||e===zn||(zn=e,console.warn(e))}function Ol({module:e,tools:t,options:o,isPro:a,tier:n,dev:i}){let l=xl(o,{appName:typeof document>"u"?null:document.title||location.hostname,hardwareName:"Browser",platform:"web"}),{socket:u}=e.useExternalSyncSocket({deviceName:l?.deviceName??"Buoy Browser",socketURL:o?.socketURL??(i?e.getDefaultSocketURL():Sn),persistentDeviceId:l?.deviceId??null,platform:"web",enableLogs:o?.enableLogs});jt(()=>{if(!u)return;let m=()=>{u.connected&&nl.hasAccountAccess()&&u.emit("device-license",{isPro:a?"1":"0",tier:n})};return m(),u.on("connect",m),()=>{u.off("connect",m)}},[u,a,n]);let d=o?.releaseActions?.join(",")??"",p=Ht(()=>cl(t,i,d?d.split(","):void 0),[t,i,d]);return e.useExternalSync({tools:p,socket:u,deviceId:l?.deviceId??null,enableLogs:o?.enableLogs}),null}import{useState as kn}from"react";import{createPortal as Fl}from"react-dom";import{useBuoySession as Ll}from"@buoy-gg/license/web";import{Fragment as In,jsx as Je,jsxs as Mn}from"react/jsx-runtime";var Rn="#20C997";function Pl(){let{status:e,signIn:t,signOut:o}=Ll(),[a,n]=kn(false),[i,l]=kn(null);if(typeof document>"u")return null;let u=()=>{l(null),n(true),t().catch(p=>l(p instanceof Error?p.message:"Sign-in did not work. Try again.")).finally(()=>n(false))},d=e.state==="active";return Fl(Je("div",{"data-buoy-signin":"",style:{position:"fixed",right:"max(16px, env(safe-area-inset-right))",bottom:"max(20px, env(safe-area-inset-bottom))",zIndex:99999,maxWidth:"min(320px, calc(100vw - 32px))",padding:d||i?"12px 14px":0,borderRadius:16,background:d||i?"#0f1419":"transparent",color:"#e6edf3",boxShadow:d||i?"0 10px 30px rgba(0,0,0,.35)":"none",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",fontSize:14,lineHeight:1.45},children:d?Mn(In,{children:[Je("div",{"data-testid":"buoy-signin-needs-plan",children:"Buoy on a live site needs a Pro or Business plan."}),Je("button",{type:"button",onClick:()=>void o(),style:$l,"data-testid":"buoy-signout",children:"Sign out"})]}):Mn(In,{children:[i?Je("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:i}):null,Je("button",{type:"button",onClick:u,disabled:a,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:Rn,color:"#04130d",fontWeight:600,fontSize:14,cursor:a?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:a?"Signing in\u2026":"Sign in to Buoy"})]})}),document.body)}var $l={marginTop:8,padding:0,border:"none",background:"none",color:Rn,fontSize:14,cursor:"pointer",textDecoration:"underline"};import{jsx as U,jsxs as An}from"react/jsx-runtime";var jl={},Dn="@react_buoy_floating_menu_tooltip_shown",Hl=Ce;function Wl({size:e=14,color:t="#20C997"}){let o=Math.max(2,e/4),a=Math.max(1,e/16);return U("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${o}px)`,gap:a,width:e,height:e,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((n,i)=>U("div",{style:{width:o,height:o,borderRadius:o/2,backgroundColor:t}},i))})}function Nl(e){return U(hn,{children:U(Jo,{children:U(Vl,{...e})})})}function Vl({environment:e,userRole:t,availableEnvironments:o,onEnvironmentSwitch:a,apps:n,modules:i=jl,externalSync:l,requiredEnvVars:u,sentryGetClient:d,disableHints:p=false,headless:m=false}){let[x,g]=wt(false),[R,v]=wt(false),I=ki(false),T=yt(),k=Oe(()=>qt([...yn(i),...n??[]]),[n,i]),z=$t(),O=T.openApps.some(r=>!r.minimized);de(()=>{z.setDialOpen(x)},[x,z.setDialOpen]),de(()=>{z.setToolOpen(O||R)},[O,R,z.setToolOpen]);let{registerApps:b}=T;de(()=>{b(k.map(r=>{let L=r.icon;return{...r,icon:typeof L=="function"?({size:W})=>L(W):L}}))},[b,k]);let M=Oe(()=>k.map(r=>({id:r.id,name:r.name,description:r.description,slot:r.slot})),[k]),{settings:$}=Ii({availableTools:M,storage:Hl});de(()=>{let r=false;return(async()=>{let[L,W]=await Promise.all([Ce.getItem(nt.dial.isOpen()),Ce.getItem(nt.settings.modalOpen())]);r||(L==="true"&&g(true),W==="true"&&(g(true),v(true)),I.current=true)})(),()=>{r=true}},[]),de(()=>{I.current&&Ce.setItem(nt.dial.isOpen(),x?"true":"false")},[x]),de(()=>{I.current&&Ce.setItem(nt.settings.modalOpen(),R?"true":"false")},[R]);let C=Fe(r=>{if(wr(r.id),r.launchMode==="toggle-only"){r.onPress?.();return}if(r.component){let L=typeof r.icon=="function"?r.icon(20):r.icon;T.open({id:r.id,title:r.name||ot(r.id),component:r.component,props:r.props,modal:r.modal,launchMode:r.launchMode||"self-modal",singleton:r.singleton??true,icon:L,color:r.color||Gt(r.id)})}else r.onPress?.()},[T]),A=Oe(()=>xt(k,"dial").map(r=>{let L=r.color||Gt(r.id),W;return typeof r.icon=="string"?W=r.icon:typeof r.icon=="function"?W=r.icon(32):W=null,{id:r.id,name:r.name||ot(r.id),icon:W,unavailable:!r.component&&!r.onPress,color:L,onPress:()=>{C(r),g(false)}}}),[k,C]),ee=Oe(()=>{if(!x)return A;let r=new Map(A.map(L=>[L.id,L]));return vr(A.map(L=>L.id)).map(L=>r.get(L)).filter(L=>!!L)},[x,A]),Z=Oe(()=>xt(k,"row").filter(r=>$.floatingTools[r.id]===true&&(r.component||r.onPress)),[k,$.floatingTools]),q=Oe(()=>k.map(r=>({id:r.id,name:r.name||ot(r.id),description:r.description||Mi(r.id),slot:r.slot,icon:r.icon,color:r.color})),[k]),[le,K]=wt(false),ne=T.openApps.some(r=>!r.minimized);de(()=>{if(p)return;let r=false,L=setTimeout(async()=>{let W=await Ce.getItem(Dn);!r&&!W&&K(true)},1e3);return()=>{r=true,clearTimeout(L)}},[p]);let J=Fe(()=>{K(false),Ce.setItem(Dn,"true")},[]),Se=Fe(()=>{J(),g(true)},[J]),me=Fe(()=>{g(false),v(false)},[]),ve=Fe(()=>{v(r=>!r)},[]),j=Fe(()=>v(false),[]),Re=!!(o?.length&&a),fe=$.floatingTools.environment!==false,se=le&&!x&&!ne;de(()=>{if(!se)return;let r=W=>{(!(W.target instanceof Element)||!W.target.closest("[data-buoy-root]"))&&J()},L=W=>{W.key==="Escape"&&J()};return document.addEventListener("pointerdown",r,true),document.addEventListener("keydown",L),()=>{document.removeEventListener("pointerdown",r,true),document.removeEventListener("keydown",L)}},[se,J]);let we=T.openApps.some(r=>r.minimized&&r.launchMode!=="toggle-only"),ae=U(Dl,{modules:i,apps:n,requiredEnvVars:u,externalSync:l,headless:m,sentryGetClient:d});return m?ae:An("div",{"data-buoy-root":"",style:{display:"contents"},children:[ae,se&&U("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),An(Jt,{enablePositionPersistence:!se,pushToSide:x||ne,suspendPointerEvents:x,centerOnboarding:se,minimizedStack:we?U(Gs,{}):void 0,hasMinimizedStack:we,children:[e&&fe&&!Re&&U(Ri,{environment:e}),Re&&fe&&U(Ai,{currentEnvironment:e??"local",availableEnvironments:o,onSelect:a}),t?U(Xt,{userRole:t,onPress:Se}):U("button",{"aria-label":"Open dev tools",onClick:Se,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:U(Wl,{})}),Z.map(r=>U("button",{"aria-label":r.name||ot(r.id),title:r.description,onClick:()=>C(r),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof r.icon=="function"?r.icon(16):r.icon},r.id))]}),se&&U(uo,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:J}),x&&U(ho,{icons:ee,onClose:me,centerLabel:"BUOY",onCenterPress:ve,settingsOpen:R,hintsDisabled:p}),U(Po,{visible:R,onClose:j,availableTools:q,onSettingsChange:r=>{}}),U(Xo,{}),U(wi,{})]})}function Ul(e){let{access:t,isPro:o,licenseKey:a}=Ci();de(()=>{xi.configure(e.licenseKey)},[e.licenseKey]);let n=e.licenseKey===void 0||Ti(e.licenseKey,a),i=typeof tt<"u"?tt:process.env.NODE_ENV!=="production",l=n&&t.status==="admitted";return de(()=>{i||t.status==="initializing"||(o&&l?vi():Kt())},[i,o,l,t.status]),!i&&!o?e.signIn&&!e.headless?U(Pl,{}):null:l?U(Nl,{...e}):e.headless?null:U(zi,{})}import{useSettings as Kl,useFloatingTools as _l,getToolLabel as Gl,getToolDescription as ql,getToolColor as Jl,settingsColors as Xl,settingsStyles as Yl,dialColors as Ql,dialStyles as Zl}from"@buoy-gg/floating-tools-react/web";export{ua as Activity,Si as AlertCircle,ma as AlertTriangle,Jo as AppHostProvider,Xo as AppOverlay,_a as Badge,On as BarChart3,jn as BaseEventStore,Ln as Bookmark,fa as Bug,oi as Button,di as Card,ya as Check,Sa as CheckCircle,ba as CheckSquare,wa as ChevronDown,Ca as ChevronLeft,za as ChevronRight,Ia as ChevronUp,Ra as Clock,$n as Cloud,gi as CollapsibleSection,Aa as Copy,ai as CopyButton,Pn as DataViewer,En as Database,hn as DevToolsVisibilityProvider,ho as DialMenu,Qa as DiffViewer,Oi as Divider,Hn as Download,Nn as Edit3,bi as EmptyState,Fn as EventStepperFooter,Da as Eye,Ea as EyeOff,Ba as FileJson,Oa as FileText,Fa as Filter,La as FlaskConical,Ul as FloatingDevTools,Jt as FloatingTools,Un as GitBranch,Pa as Globe,_n as HardDrive,$a as Hash,qn as HelpCircle,Xn as Home,Qn as Image,ja as Info,Xa as InfoRow,ca as JsModal,Wa as Key,Va as Layers,ea as Link,Ka as Lock,oa as Maximize2,aa as Minus,ra as Palette,Ga as Pause,la as Pin,Ja as Play,Ya as Plus,Za as Power,ri as PowerToggle,ti as RefreshCw,Wn as RelativeTime,da as Route,li as Row,ni as Search,Bn as SearchBar,pi as SectionHeader,pa as Server,ii as Settings,Po as SettingsModal,si as Shield,ga as Smartphone,ha as Square,qa as StatusDot,hi as TabSelector,va as Timer,ci as Trash2,xa as Unlock,Ta as Upload,ui as User,Xt as UserStatus,ka as Users,mi as Wifi,fi as X,Ma as XCircle,yi as Zap,Cn as appSyncAdapter,Ei as autoDiscoverWebPresets,qt as autoDiscoverWithCustom,Kt as clearReleaseOptIn,sa as copyToClipboard,pn as createWebTool,yn as createWebTools,Di as defaultToolPresets,na as devToolsStorageKeys,Ql as dialColors,Zl as dialStyles,Vn as formatBytes,Kn as formatDuration,Gn as formatNumber,Bi as getEnabledTools,Jl as getToolColor,ql as getToolDescription,Gl as getToolLabel,xt as getToolsBySlot,Na as methodColor,ta as persistentStorage,Yn as safeStringify,Xl as settingsColors,Yl as settingsStyles,Ha as statusColor,ei as toolTheme,Jn as truncateMiddle,Ua as typeColor,yt as useAppHost,$t as useDevToolsVisibility,_l as useFloatingTools,Zn as usePersistedState,ia as useSafeAreaInsets,Kl as useSettings,ks as useToolHeader,Ko as useToolHost};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/core",
3
- "version": "7.0.44",
3
+ "version": "7.0.46",
4
4
  "description": "Floating developer menu and account setup for React Native. Add tool packages and configure Desktop or MCP connections separately.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -61,10 +61,10 @@
61
61
  ],
62
62
  "dependencies": {
63
63
  "react-devtools-core": "6.1.5",
64
- "@buoy-gg/shared-ui": "^7.0.44",
65
- "@buoy-gg/floating-tools-core": "^7.0.44",
66
- "@buoy-gg/license": "^7.0.44",
67
- "@buoy-gg/floating-tools-react": "^7.0.44"
64
+ "@buoy-gg/floating-tools-core": "^7.0.46",
65
+ "@buoy-gg/floating-tools-react": "^7.0.46",
66
+ "@buoy-gg/shared-ui": "^7.0.46",
67
+ "@buoy-gg/license": "^7.0.46"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "*"